Changeset 16310
- Timestamp:
- Jul 2, 2012, 11:54:13 PM (12 years ago)
- Location:
- extensions/GooglePlusOne
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/GooglePlusOne/main.inc.php
r15121 r16310 28 28 'ro','ru','sr','sk','sl','es','sv','th','tr','uk','vi', 29 29 ); 30 31 $template->assign(array(32 'GPLUS1_SIZE' => $conf['GooglePlusOne']['size'],33 'GPLUS1_ANNO' => $conf['GooglePlusOne']['annotation'],34 ));35 30 36 if (script_basename() == 'picture') 31 // position for index 32 if (script_basename() == 'index') 37 33 { 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'; 45 35 } 46 36 … … 50 40 if ($conf['GooglePlusOne']['size'] == 'tall' AND $conf['GooglePlusOne']['annotation'] == 'bubble') 51 41 { 52 $template->assign('GPLUS1_SIZE', 'standard');42 $conf['GooglePlusOne']['size'] = 'standard'; 53 43 } 54 44 } 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 )); 55 52 56 53 // button language … … 67 64 $template->assign('GPLUS1_LANG', 'en-GB'); 68 65 } 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 } 69 83 } 70 84 … … 73 87 global $template; 74 88 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 79 89 switch ($template->get_template_vars('GPLUS1_POSITON')) 80 90 { 81 91 case 'top': 82 92 $search = '<div id="theImage">'; 83 $replace = '<div> '.$replace.'</div>';93 $replace = '<div>{$GPLUS1_BUTTON}</div>'; 84 94 break; 85 95 86 96 case 'bottom': 87 97 $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}'; 97 99 break; 98 100 }
Note: See TracChangeset
for help on using the changeset viewer.