Social Buttons instead.'; } function tweet_add_button() { global $conf, $template, $user; $conf['TweetThis'] = unserialize($conf['TweetThis']); $conf['TweetThis']['lang'] = array( 'no','de','zh-cn','en','pl','sv','zh-tw','tr','es','th','fa','hu','pt','it','ar','he', 'ko','id','ru','ja','da','fi','hi','ur','fr','nl', ); // urls and position if (script_basename() == 'picture') { $template->assign('TWEET_URL', get_absolute_root_url().ltrim(duplicate_picture_url(), './')); } else if (script_basename() == 'index') { $conf['TweetThis']['position'] = 'index'; $template->assign('TWEET_URL', get_absolute_root_url().ltrim(duplicate_index_url(array(), array('start')), './')); } else { return; } // config $template->assign(array( 'TWEET_POSITION' => $conf['TweetThis']['position'], 'TWEET_SIZE' => $conf['TweetThis']['size'], 'TWEET_COUNT' => $conf['TweetThis']['count'], 'TWEET_VIA' => $conf['TweetThis']['via'], )); // button language if ( in_array(str_replace('_','-',strtolower($user['language'])), $conf['TweetThis']['lang']) ) { $template->assign('TWEET_LANG', str_replace('_','-',strtolower($user['language']))); } if ( in_array(substr($user['language'],0,2), $conf['TweetThis']['lang']) ) { $template->assign('TWEET_LANG', substr($user['language'],0,2)); } else { $template->assign('TWEET_LANG', 'en'); } $template->set_filename('tweet_button', dirname(__FILE__).'/button.tpl'); $button = $template->parse('tweet_button', true); switch ($conf['TweetThis']['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('TWEET_BUTTON', $button); $template->set_prefilter('picture', 'tweet_add_button_prefilter'); } } function tweet_add_button_prefilter($content, &$smarty) { global $template; switch ($template->get_template_vars('TWEET_POSITION')) { case 'top': $search = '
    '; $replace = '
    {$TWEET_BUTTON}
    '; break; case 'bottom': $search = '{$ELEMENT_CONTENT}'; $replace = '{$TWEET_BUTTON}'; break; } return str_replace($search, $search.$replace, $content); } if (script_basename() == 'admin') { add_event_handler('get_admin_plugin_menu_links', 'tweet_plugin_admin_menu'); function tweet_plugin_admin_menu($menu) { array_push($menu, array( 'NAME' => 'TweetThis', 'URL' => get_root_url().'admin.php?page=plugin-'.basename(dirname(__FILE__)) )); return $menu; } } ?>