Ignore:
Timestamp:
Jul 2, 2012, 11:54:13 PM (12 years ago)
Author:
mistic100
Message:

another fix for stripped

Location:
extensions/GooglePlusOne
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • extensions/GooglePlusOne/main.inc.php

    r15121 r16310  
    2828    'ro','ru','sr','sk','sl','es','sv','th','tr','uk','vi',
    2929    );
    30    
    31   $template->assign(array(
    32     'GPLUS1_SIZE' => $conf['GooglePlusOne']['size'],
    33     'GPLUS1_ANNO' => $conf['GooglePlusOne']['annotation'],
    34   ));
    3530 
    36   if (script_basename() == 'picture')
     31  // position for index
     32  if (script_basename() == 'index')
    3733  {
    38     $template->assign('GPLUS1_POSITON', $conf['GooglePlusOne']['position']);
    39     $template->set_prefilter('picture', 'gplus1_add_button_prefilter');
    40   }
    41   else if (script_basename() == 'index')
    42   {
    43     $template->assign('GPLUS1_POSITON', 'index');
    44     $template->set_prefilter('index', 'gplus1_add_button_prefilter');
     34    $conf['GooglePlusOne']['position'] = 'index';
    4535  }
    4636 
     
    5040    if ($conf['GooglePlusOne']['size'] == 'tall' AND $conf['GooglePlusOne']['annotation'] == 'bubble')
    5141    {
    52         $template->assign('GPLUS1_SIZE', 'standard');
     42      $conf['GooglePlusOne']['size'] = 'standard';
    5343    }
    5444  }
     45 
     46  // config
     47  $template->assign(array(
     48    'GPLUS1_SIZE' => $conf['GooglePlusOne']['size'],
     49    'GPLUS1_ANNO' => $conf['GooglePlusOne']['annotation'],
     50    'GPLUS1_POSITON' => $conf['GooglePlusOne']['position'],
     51  ));
    5552 
    5653  // button language
     
    6764    $template->assign('GPLUS1_LANG', 'en-GB');
    6865  }
     66 
     67 
     68  $template->set_filename('gplus1_button', dirname(__FILE__).'/button.tpl');
     69  $button = $template->parse('gplus1_button', true);
     70 
     71  switch ($conf['GooglePlusOne']['position'])
     72  {
     73    case 'index':
     74      $template->concat('PLUGIN_INDEX_ACTIONS', '<li>'.$button.'</li>');
     75      break;
     76    case 'toolbar':
     77      $template->concat('PLUGIN_PICTURE_ACTIONS', $button);
     78      break;
     79    default;
     80      $template->assign('GPLUS1_BUTTON', $button);
     81      $template->set_prefilter('picture', 'gplus1_add_button_prefilter');
     82  }
    6983}
    7084
     
    7387  global $template;
    7488 
    75   $replace = '{combine_script id=\'google_plusone\' path=\'https://apis.google.com/js/plusone.js\'}
    76 <script type="text/javascript">window.___gcfg = {ldelim}lang: \'{$GPLUS1_LANG}\'};</script>
    77 <g:plusone size="{$GPLUS1_SIZE}" annotation="{$GPLUS1_ANNO}"></g:plusone>';
    78  
    7989  switch ($template->get_template_vars('GPLUS1_POSITON'))
    8090  {
    8191    case 'top':
    8292      $search = '<div id="theImage">';
    83       $replace = '<div>'.$replace.'</div>';
     93      $replace = '<div>{$GPLUS1_BUTTON}</div>';
    8494      break;
    8595     
    8696    case 'bottom':
    8797      $search = '{$ELEMENT_CONTENT}';
    88       break;
    89      
    90     case 'toolbar':
    91       $search = '<div class="actionButtons">';
    92       break;
    93      
    94     case 'index': 
    95       $search = '<ul class="categoryActions">';
    96       $replace = '<li>'.$replace.'</li>';
     98      $replace = '{$GPLUS1_BUTTON}';
    9799      break;
    98100  }
Note: See TracChangeset for help on using the changeset viewer.