assign(array( 'GPLUS1_SIZE' => $conf['GooglePlusOne']['size'], 'GPLUS1_ANNO' => $conf['GooglePlusOne']['annotation'], 'GPLUS1_POSITON' => $conf['GooglePlusOne']['position'], )); // button language if ( in_array(str_replace('_','-',$user['language']), $conf['GooglePlusOne']['lang']) ) { $template->assign('GPLUS1_LANG', str_replace('_','-',$user['language'])); } if ( in_array(substr($user['language'],0,2), $conf['GooglePlusOne']['lang']) ) { $template->assign('GPLUS1_LANG', substr($user['language'],0,2)); } else { $template->assign('GPLUS1_LANG', 'en-GB'); } $template->set_filename('gplus1_button', dirname(__FILE__).'/button.tpl'); $button = $template->parse('gplus1_button', true); switch ($conf['GooglePlusOne']['position']) { case 'index': // $template->add_index_button('
  • '.$button.'
  • ', 100); $template->concat('PLUGIN_INDEX_ACTIONS', '
  • '.$button.'
  • '); break; case 'toolbar': // $template->add_picture_button($button, 100); $template->concat('PLUGIN_PICTURE_ACTIONS', $button); break; default; $template->assign('GPLUS1_BUTTON', $button); $template->set_prefilter('picture', 'gplus1_add_button_prefilter'); } } function gplus1_add_button_prefilter($content, &$smarty) { global $template; switch ($template->get_template_vars('GPLUS1_POSITION')) { case 'top': $search = '
    '; $replace = '
    {$GPLUS1_BUTTON}
    '; break; case 'bottom': $search = '{$ELEMENT_CONTENT}'; $replace = '{$GPLUS1_BUTTON}'; break; } return str_replace($search, $search.$replace, $content); } if (script_basename() == 'admin') { add_event_handler('get_admin_plugin_menu_links', 'gplus1_plugin_admin_menu'); function gplus1_plugin_admin_menu($menu) { array_push($menu, array( 'NAME' => 'Google+1', 'URL' => get_root_url().'admin.php?page=plugin-'.basename(dirname(__FILE__)) )); return $menu; } } ?>