Changeset 15121 for extensions/GooglePlusOne/main.inc.php
- Timestamp:
- May 19, 2012, 1:11:01 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/GooglePlusOne/main.inc.php
r11600 r15121 22 22 global $conf, $template, $user; 23 23 24 $conf['GooglePlusOne'] = explode(',',$conf['GooglePlusOne']);24 $conf['GooglePlusOne'] = unserialize($conf['GooglePlusOne']); 25 25 $conf['GooglePlusOne']['lang'] = array( 26 'ar','bg','ca',' hr','cs','da','nl','et','fi','fr','de','el','iw','hi',27 ' hu','id','it','ja','ko','lv','lt','ms','no','fa','pl','ro','ru','sr',28 ' sk','sl','es','sv','th','tr','uk','vi'26 'ar','bg','ca','zh-CN','zh-TW','hr','cs','da','nl','en-US','en-GB','et','fi','fr','de', 27 'el','iw','hi','hu','id','it','ja','ko','lv','lt','ms','no','fa','pl','pt-BR','pt-PT', 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 )); 30 35 31 36 if (script_basename() == 'picture') 32 37 { 33 $template->assign(array( 34 'GPLUS1_SIZE' => $conf['GooglePlusOne'][0], 35 'GPLUS1_POSITON' => $conf['GooglePlusOne'][1], 36 )); 37 38 $template->assign('GPLUS1_POSITON', $conf['GooglePlusOne']['position']); 38 39 $template->set_prefilter('picture', 'gplus1_add_button_prefilter'); 39 40 } 40 41 else if (script_basename() == 'index') 41 42 { 42 $template->assign(array( 43 'GPLUS1_SIZE' => $conf['GooglePlusOne'][0], 44 'GPLUS1_POSITON' => 'index', 45 )); 46 43 $template->assign('GPLUS1_POSITON', 'index'); 47 44 $template->set_prefilter('index', 'gplus1_add_button_prefilter'); 48 45 } 49 46 50 47 // if the link is in the toolbar, we must use smallier buttons 51 if ( script_basename() == 'index' OR $conf['GooglePlusOne'][ 1] == 'toolbar')48 if ( script_basename() == 'index' OR $conf['GooglePlusOne']['position'] == 'toolbar') 52 49 { 53 if ($conf['GooglePlusOne'][ 0] == 'tall')50 if ($conf['GooglePlusOne']['size'] == 'tall' AND $conf['GooglePlusOne']['annotation'] == 'bubble') 54 51 { 55 52 $template->assign('GPLUS1_SIZE', 'standard'); … … 58 55 59 56 // button language 57 if ( in_array(str_replace('_','-',$user['language']), $conf['GooglePlusOne']['lang']) ) 58 { 59 $template->assign('GPLUS1_LANG', str_replace('_','-',$user['language'])); 60 } 60 61 if ( in_array(substr($user['language'],0,2), $conf['GooglePlusOne']['lang']) ) 61 62 { … … 72 73 global $template; 73 74 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 74 79 switch ($template->get_template_vars('GPLUS1_POSITON')) 75 80 { 76 81 case 'top': 77 82 $search = '<div id="theImage">'; 78 $replace = '<div> <g:plusone size="{$GPLUS1_SIZE}"></g:plusone></div>';83 $replace = '<div>'.$replace.'</div>'; 79 84 break; 80 85 81 86 case 'bottom': 82 87 $search = '{$ELEMENT_CONTENT}'; 83 $replace = '<g:plusone size="{$GPLUS1_SIZE}"></g:plusone>';84 88 break; 85 89 86 90 case 'toolbar': 87 $search = '{*caddie management END*}'; 88 $replace = '<g:plusone size="{$GPLUS1_SIZE}"></g:plusone>'; 91 $search = '<div class="actionButtons">'; 89 92 break; 90 93 91 94 case 'index': 92 95 $search = '<ul class="categoryActions">'; 93 $replace = '<li> <g:plusone size="{$GPLUS1_SIZE}"></g:plusone></li>';96 $replace = '<li>'.$replace.'</li>'; 94 97 break; 95 98 } 96 $replace = $search.$replace.'97 {combine_script id=\'google_plusone\' path=\'https://apis.google.com/js/plusone.js\'}98 <script type="text/javascript">{ldelim}lang: \'{$GPLUS1_LANG}\'}</script>';99 99 100 return str_replace($search, $ replace, $content);100 return str_replace($search, $search.$replace, $content); 101 101 } 102 102 … … 108 108 function gplus1_plugin_admin_menu($menu) 109 109 { 110 array_push( 111 $menu, 112 array( 113 'NAME' => 'Google+1', 114 'URL' => get_root_url().'admin.php?page=plugin-'.basename(dirname(__FILE__)) 115 ) 116 ); 117 110 array_push($menu, array( 111 'NAME' => 'Google+1', 112 'URL' => get_root_url().'admin.php?page=plugin-'.basename(dirname(__FILE__)) 113 )); 118 114 return $menu; 119 115 }
Note: See TracChangeset
for help on using the changeset viewer.