Changeset 19394


Ignore:
Timestamp:
Dec 11, 2012, 4:54:12 PM (8 years ago)
Author:
mistic100
Message:

allow to choose shared size, compatible with 'question_mark_in_url'=false

Location:
extensions/TumblrShare
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • extensions/TumblrShare/admin.php

    r19361 r19394  
    1212    'type' => $_POST['type'],
    1313    'position' => $_POST['position'],
     14    'img_size' => $_POST['img_size'],
    1415    );
    1516 
     
    2425  'type' => $conf['TumblrShare']['type'],
    2526  'position' => $conf['TumblrShare']['position'],
     27  'img_size' => $conf['TumblrShare']['img_size'],
     28  'img_sizes' => array_merge(ImageStdParams::get_all_types(), array('Original')),
    2629  'TUMBLR_PATH' => TUMBLR_PATH,
    2730));
  • extensions/TumblrShare/admin.tpl

    r19361 r19394  
    6767      </tr>
    6868     
     69      <tr class="property">
     70        <td>
     71          {'Shared picture size'|@translate}
     72        </td>
     73        <td>
     74          {html_options name="img_size" values=$img_sizes output=$img_sizes|translate selected=$img_size}
     75        </td>
     76      </tr>
     77     
    6978      <tr class="submit">
    7079        <td colspan="2" style="text-align:center;">
  • extensions/TumblrShare/language/en_UK/plugin.lang.php

    r19361 r19394  
    66$lang['Button size'] = 'Button size';
    77$lang['Share on Tumblr'] = 'Share on Tumblr';
     8$lang['Shared picture size'] = 'Shared picture size';
    89?>
  • extensions/TumblrShare/language/fr_FR/plugin.lang.php

    r19361 r19394  
    66$lang['Button size'] = 'Taille du bouton';
    77$lang['Share on Tumblr'] = 'Partager sur Tumblr';
     8$lang['Shared picture size'] = 'Taille des photos partagées';
    89?>
  • extensions/TumblrShare/main.inc.php

    r19361 r19394  
    3939  if (script_basename() == 'picture')
    4040  {
    41     $current_picture = $template->get_template_vars('current');
     41    global $picture;
    4242   
    4343    $template->assign(array(
    4444      'TUMBLR_MODE' => 'photo',
    45       'TUMBLR_URL' => $root_url.duplicate_picture_url(),
    46       'TUMBLR_TITLE' => $current_picture['TITLE'],
     45      'TUMBLR_URL' => $root_url.ltrim(duplicate_picture_url(), './'),
     46      'TUMBLR_TITLE' => $picture['current']['TITLE'],
    4747      ));
    4848   
    49     if (!empty($current_picture['selected_derivative']))
     49    if ($conf['TumblrShare']['img_size'] == 'Original')
    5050    {
    51       $template->assign('TUMBLR_SOURCE', $root_url.$current_picture['selected_derivative']->get_url());
     51      $template->assign('TUMBLR_SOURCE', $root_url.ltrim($picture['current']['src_image']->get_url(), './'));
    5252    }
    5353    else
    5454    {
    55       $template->assign('TUMBLR_SOURCE', $root_url.ltrim($current_picture['src_image']->rel_path, './'));
     55      $template->assign('TUMBLR_SOURCE', $root_url.ltrim(DerivativeImage::url($conf['TumblrShare']['img_size'], $picture['current']['src_image']), './'));
    5656    }
    5757  }
     
    6262    $template->assign(array(
    6363      'TUMBLR_MODE' => 'link',
    64       'TUMBLR_URL' => $root_url.duplicate_index_url(),
     64      'TUMBLR_URL' => $root_url.ltrim(duplicate_index_url(), './'),
    6565      'TUMBLR_TITLE' => strip_tags($page['title']),
    6666      ));
  • extensions/TumblrShare/maintain.inc.php

    r19361 r19394  
    55    'type' => 'share_1',
    66    'position' => 'toolbar',
     7    'img_size' => 'Original',
    78    );
    89     
    910  conf_update_param('TumblrShare', serialize($tumblr_conf));
     11}
     12
     13function plugin_activate()
     14{
     15  global $conf;
     16 
     17  $tumblr_conf = unserialize($conf['TumblrShare']);
     18  if (!isset($tumblr_conf['img_size']))
     19  {
     20    $tumblr_conf['img_size'] = 'Original';
     21    conf_update_param('TumblrShare', serialize($tumblr_conf));
     22  }
    1023}
    1124
Note: See TracChangeset for help on using the changeset viewer.