I got this error when going into the settings of the plugin in the ACP
Warning [2] implode() [function.implode]: Invalid arguments passed - Line: 1157 - File: admin/modules/config/settings.php PHP 5.2.16 (Linux)
File Line Function
errorHandler->error
/admin/modules/config/settings.php 1157 implode
/admin/index.php 483 require
This was on the index.
The following warnings occurred:
Warning [2] call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'adsense_code_insert_header' was given - Line: 101 - File: inc/class_plugins.php PHP 5.2.16 (Linux)
File Line Function
[PHP] errorHandler->error
/inc/class_plugins.php 101 call_user_func_array
/global.php 95 pluginSystem->run_hooks
/index.php 18 require_once
Warning [2] call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'adsense_code_insert_footer' was given - Line: 101 - File: inc/class_plugins.php PHP 5.2.16 (Linux)
File Line Function
[PHP] errorHandler->error
/inc/class_plugins.php 101 call_user_func_array
/index.php 25 pluginSystem->run_hooks
code.
<?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.");
}
$plugins->add_hook('global_start','adsense_code_insert_header');
$plugins->add_hook('index_start','adsense_code_insert_footer');
function adsense_info()
{
global $db;
return array(
'name' => 'AdSense Code',
'description' => 'Add your adsense code (or any ad!) to your index.',
'website' => 'http://mods.mybb.com/',
'author' => 'Blake',
'authorsite' => 'http://mcmines.com',
'version' => '1.1',
'compatibility' => '16*',
'guid' => 'dc9443796a5dfaeb9d75fd5d0bf08be2'
);
}
function adsense_activate()
{
global $db;
require MYBB_ROOT."/inc/adminfunctions_templates.php";
$confirm_group = array(
'gid' => 'NULL',
'name' => 'google_adsense',
'title' => 'Adsense Code',
'description' => 'Edit your Ad details in here.',
'disporder' => "1",
'isdefault' => '0',
);
$db->insert_query('settinggroups', $confirm_group);
$gid = $db->insert_id();
$adsense_setting_1 = array(
"sid" => "NULL",
"name" => "adsense_on_off_header",
"title" => "Is the plugin active for the header?",
"description" => "No means off",
"optionscode" => "yesno",
"value" => "no",
"disporder" => "1",
"gid" => intval($gid),
);
$adsense_setting_2 = array(
"sid" => "NULL",
"name" => "adsense_code_header",
"title" => "Adsense Header Code",
"description" => "Post your Ad Code in here",
"optionscode" => "textarea",
"value" => '',
"disporder" => "2",
"gid" => intval($gid),
);
$adsense_setting_3 = array(
"sid" => "NULL",
"name" => "adsense_on_off_footer",
"title" => "Is the plugin active for the footer?",
"description" => "No means off",
"optionscode" => "yesno",
"value" => "no",
"disporder" => "3",
"gid" => intval($gid),
);
$adsense_setting_4 = array(
"sid" => "NULL",
"name" => "adsense_code_footer",
"title" => "Adsense Footer Code",
"description" => "Post your Ad Code in here",
"optionscode" => "textarea",
"value" => '',
"disporder" => "4",
"gid" => intval($gid),
);
$adsense_setting_5 = array(
"sid" => "NULL",
"name" => "adsense_name",
"title" => "Adsense Name",
"description" => "Name the box for your ads! Note, If you are using this plugin for google ads you should keep the default!",
"optionscode" => "textbox",
"value" => "Sponsored Links",
"disporder" => "5",
"gid" => intval($gid),
);
$db->insert_query('settings', $adsense_setting_1);
$db->insert_query('settings', $adsense_setting_2);
$db->insert_query('settings', $adsense_setting_3);
$db->insert_query('settings', $adsense_setting_4);
$db->insert_query('settings', $adsense_setting_5);
require_once MYBB_ROOT."/inc/adminfunctions_templates.php";
find_replace_templatesets("header", "#".preg_quote("<navigation>")."#i", "{\$adsense_code_header}");
require_once MYBB_ROOT."/inc/adminfunctions_templates.php";
find_replace_templatesets("index", "#".preg_quote("</dl>")."#i", "{\$adsense_code_footer}");
}
function adsense_deactivate()
{
global $db;
require MYBB_ROOT."/inc/adminfunctions_templates.php";
$db->delete_query("settings", "name='adsense_on_off'");
$db->delete_query("settings", "name='adsense_on_off_footer'");
$db->delete_query("settings", "name='adsense_code_footer'");
$db->delete_query("settings", "name='adsense_code_header'");
$db->delete_query("settings", "name='adsense_name'");
$db->delete_query("settinggroups", "name='google_adsense'");
rebuild_settings();
require_once MYBB_ROOT."/inc/adminfunctions_templates.php";
find_replace_templatesets("index", "#".preg_quote("{\$adsense_code_footer}")."#i", "", 0);
require_once MYBB_ROOT."/inc/adminfunctions_templates.php";
find_replace_templatesets("header", "#".preg_quote("{\$adsense_code_header}")."#i", "", 0);
}
//Header Insert
function myplugin_header()
{
global $mybb, $adsense_code;
if($mybb->settings['adsense_on_off_header'] == "1")
{
$adsense_code_header = "<div style=\"padding: 6px 0px 0px 0px\">
<table class=\"tborder\" cellpadding=\"6\" cellspacing=\"1\" border=\"0\" width=\"100%\" align=\"center\">
<tr>
<td class=\"thead\">
{$mybb->settings['adsense_name']}
</td>
</tr>
<tr>
<td class=\"alt1\" align=\"center\">
{$mybb->settings['adsense_code_header']}
</td>
</tr>
</table>
<br>
</div>";
}
}
//Footer Insert
function myplugin_index()
{
global $mybb, $adsense_code;
if($mybb->settings['adsense_on_off_footer'] == "1")
{
$adsense_code_footer = "<div style=\"padding: 6px 0px 0px 0px\">
<table class=\"tborder\" cellpadding=\"6\" cellspacing=\"1\" border=\"0\" width=\"100%\" align=\"center\">
<tr>
<td class=\"thead\">
{$mybb->settings['adsense_name']}
</td>
</tr>
<tr>
<td class=\"alt1\" align=\"center\">
{$mybb->settings['adsense_code_footer']}
</td>
</tr>
</table>
<br>
</div>";
}
}
?>