Ignore:
Timestamp:
Oct 6, 2013, 9:05:18 PM (11 years ago)
Author:
mistic100
Message:

improve facebook light link and clean code & conf

Location:
extensions/SocialButtons/include
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • extensions/SocialButtons/include/install.inc.php

    r24758 r24788  
    1111      'position' => 'toolbar',
    1212      'on_index' => true,
     13      'img_size' => 'Original',
    1314      'light' => false,
    1415      'twitter' => array(
     
    2627        'enabled' => true,
    2728        'type' => 'share_1',
    28         'img_size' => 'Original',
    2929        ),
    3030      'facebook' => array(
     
    3636        'enabled' => true,
    3737        'layout' => 'horizontal',
    38         'img_size' => 'Original',
    3938        ),
    4039      'reddit' => array(
     
    4847    {
    4948      $temp = is_string($conf['TumblrShare']) ? unserialize($conf['TumblrShare']) : $conf['TumblrShare'];
    50       if (!empty($temp['type']))      $default_config['tumblr']['type'] =     $temp['type'];
    51       if (!empty($temp['img_size']))  $default_config['tumblr']['img_size'] = $temp['img_size'];
     49      if (!empty($temp['type']))      $default_config['tumblr']['type'] = $temp['type'];
     50      if (!empty($temp['img_size']))  $default_config['img_size'] =      $temp['img_size'];
    5251    }
    5352    if (isset($conf['TweetThis']))
     
    7776        'enabled' => true,
    7877        'layout' => 'horizontal',
    79         'img_size' => 'Original',
    8078        );
    8179    }
     
    105103    }
    106104   
     105    if (!isset($new_conf['img_size']))
     106    {
     107      $new_conf['img_size'] = isset($new_conf['tumblr']['img_size']) ? $new_conf['tumblr']['img_size'] : 'Original';
     108      unset($new_conf['tumblr']['img_size'], $new_conf['pinterest']['img_size']);
     109    }
     110   
    107111    $conf['SocialButtons'] = serialize($new_conf);
    108112    conf_update_param('SocialButtons', $conf['SocialButtons']);
  • extensions/SocialButtons/include/pinterest.inc.php

    r24757 r24788  
    1010  }
    1111 
    12   global $conf, $template, $picture;
     12  global $conf, $template;
    1313 
    1414  // config
    1515  $tpl_vars['PINTEREST'] = $conf['SocialButtons']['pinterest'];
    16   $tpl_vars['PINTEREST']['title'] = $picture['current']['TITLE'];
    17  
    18   if ($conf['SocialButtons']['pinterest']['img_size'] == 'Original')
    19   {
    20     $tpl_vars['PINTEREST']['source'] = $picture['current']['src_image']->get_url();
    21   }
    22   else
    23   {
    24     $tpl_vars['PINTEREST']['source'] = DerivativeImage::url($conf['SocialButtons']['pinterest']['img_size'], $picture['current']['src_image']);
    25   }
    26  
    2716 
    2817  $template->set_filename('pinterest_button', realpath(SOCIALBUTT_PATH .'template/pinterest.tpl'));
  • extensions/SocialButtons/include/reddit.inc.php

    r24758 r24788  
    1919    $conf['SocialButtons']['reddit']['type'] = 'spreddit7';
    2020  }
     21 
    2122 
    2223  // config
  • extensions/SocialButtons/include/tumblr.inc.php

    r23202 r24788  
    99  $tpl_vars['TUMBLR'] = $conf['SocialButtons']['tumblr'];
    1010 
    11   // button on piture page
    12   if ($basename == 'picture')
    13   {
    14     global $picture;
    15    
    16     $tpl_vars['TUMBLR']['mode'] = 'photo';
    17     $tpl_vars['TUMBLR']['title'] = $picture['current']['TITLE'];
    18    
    19     if ($conf['SocialButtons']['tumblr']['img_size'] == 'Original')
    20     {
    21       $tpl_vars['TUMBLR']['source'] = $picture['current']['src_image']->get_url();
    22     }
    23     else
    24     {
    25       $tpl_vars['TUMBLR']['source'] = DerivativeImage::url($conf['SocialButtons']['tumblr']['img_size'], $picture['current']['src_image']);
    26     }
    27   }
    28   // button on other pages
    29   else if ($basename == 'index')
    30   {
    31     global $page;
    32    
    33     $tpl_vars['TUMBLR']['mode'] = 'link';
    34     $tpl_vars['TUMBLR']['title'] = strip_tags($page['title']);
    35   }
    36  
    37  
    3811  $template->set_filename('tumblr_button', realpath(SOCIALBUTT_PATH .'template/tumblr.tpl'));
    3912  $buttons[] = 'tumblr_button';
Note: See TracChangeset for help on using the changeset viewer.