2011-06-08, 03:22 AM
So I was making a plugin to add the new google +1 button to threads but I have a issue. No errors when going into the plugins section but it's not showing up, so I cant activate it...?
<?php
// Disallow direct access to this file for security reasons
if(!defined("IN_MYBB"))
{
die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}
function google1_info()
{
global $db;
return array(
'name' => 'Goole +1',
'description' => 'Adds a Google +1 button to the first post of a thread.',
'website' => 'http://mods.mybb.com/',
'author' => 'Blake',
'authorsite' => 'http://mcmines.com',
'version' => '1.0',
'compatibility' => '16*',
'guid' => ''
);
}
function google1_activate()
{
global $db;
require MYBB_ROOT."/inc/adminfunctions_templates.php";
find_replace_templatesets("postbit", "#".preg_quote("{\$ignore_bit}")."#i", "<script type=\"text/javascript\" src=\"http://apis.google.com/js/plusone.js\"></script> {\$ignore_bit}");
find_replace_templatesets("postbit", "#".preg_quote("{\$post['message']}<br />")."#i", "<div style=\"float: right;\"><g:plusone></g:plusone></div> {\$post['message']}<br />");
}
function google1_deactivate()
{
require MYBB_ROOT."/inc/adminfunctions_templates.php";
find_replace_templatesets("postbit", "#".preg_quote("<script type=\"text/javascript\" src=\"http://apis.google.com/js/plusone.js\"></script>")."#i", '', 0);
find_replace_templatesets("postbit", "#".preg_quote("<div style=\"float: right;\"><g:plusone></g:plusone></div>")."#i", '', 0);
}
?>