2020-08-05, 12:13 PM
(This post was last modified: 2020-08-05, 12:33 PM by .m.. Edited 1 time in total.
Edit Reason: added php tags
)
hi i have found that plugins 1.6* version i manualy change for 1.8* and i try to install in acp everytime i have a white page is dont want enabled i have try + 10 time .. Any know the problem ?
there is the code (only 1 file)
there is the code (only 1 file)
<?php
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', 'foreigntranslate_global');
function foreigntranslate_info()
{
return array(
"name" => "Foregin translate",
"description" => "Plugin shows a Google Trasnale bar for people who do not live in your country. <br /><span style=\"font-size:8px;\">If plugin does not want to activate, try activating it a few more times.</span>",
"website" => "",
"author" => "Watt",
"authorsite" => "",
"version" => "0.1",
"guid" => "61f572f4853391d103ac408c775c7e3f",
"compatibility" => "18*",
);
}
function foreigntranslate_activate()
{
global $db, $mybb;
require_once MYBB_ROOT."/inc/adminfunctions_templates.php";
$is_installed = 0;
$query = $db->query("SELECT * FROM `".TABLE_PREFIX."settinggroups` WHERE name = \"foreigntranslate\" LIMIT 1;");
while($fet = $db->fetch_array($query))
{
$is_installed = 1; // additional check
}
if($is_installed == 0){
$foreigntranslate_group = array(
"gid" => "NULL",
"name" => "foreigntranslate",
"title" => "Foregin translate Configuration",
"description" => "Plugin shows a Google Trasnale bar for people who do not live in your country.",
"disporder" => "0",
"isdefault" => "no",
);
$db->insert_query("settinggroups", $foreigntranslate_group);
$gid = $db->insert_id();
$foreigntranslate_config[] = array(
"sid" => "NULL",
"name" => "foreigntranslate_onoff",
"title" => "Turn on/off",
"description" => "Turn plugin on/off",
"optionscode" => "yesno",
"value" => "1",
"disporder" => 1,
"gid" => intval($gid),
);
$foreigntranslate_config[] = array(
"sid" => "NULL",
"name" => "foreigntranslate_lang",
"title" => "Your language tag",
"description" => 'Select your language tag from <a target="_blank" href="http://pgc-play.pl/languageable.html">this list - click</a> and rewrite it.',
"optionscode" => "text",
"value" => "en",
"disporder" => 2,
"gid" => intval($gid),
);
foreach($foreigntranslate_config as $sacfg)
{
$db->insert_query("settings", $sacfg);
}
find_replace_templatesets("headerinclude", '#{\$stylesheets}#', "{\$stylesheets}{\$foreigntranslate}");
find_replace_templatesets("footer", '#\<\!\-\- End powered by \-\-\>#', "<!-- End powered by -->{\$foreigntranslate_footer}");
}
rebuildsettings();
}
function foreigntranslate_deactivate()
{
global $db, $mybb;
require_once MYBB_ROOT."/inc/adminfunctions_templates.php";
$db->delete_query("settings","name LIKE 'foreigntranslate_%'");
$db->query("DELETE FROM ".TABLE_PREFIX."settinggroups WHERE name='foreigntranslate'");
rebuildsettings();
find_replace_templatesets("headerinclude", '#'.preg_quote('{$foreigntranslate}').'#', '',0);
find_replace_templatesets("footer", '#'.preg_quote('{$foreigntranslate_footer}').'#', '',0);
}
function foreigntranslate_global()
{
global $db, $mybb, $templates, $foreigntranslate, $foreigntranslate_footer;
if(!$mybb->settings['foreigntranslate_onoff'] OR $mybb->settings['foreigntranslate_onoff'] == "off") // if off
return false;
if (substr($_SERVER["HTTP_ACCEPT_LANGUAGE"],0,2) != substr($mybb->settings['foreigntranslate_lang'],0,2))
$foreigntranslate = '<script src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script><script>function googleTranslateElementInit() { new google.translate.TranslateElement({ pageLanguage: \''.$mybb->settings['foreigntranslate_lang'].'\', layout: google.translate.TranslateElement.InlineLayout.SIMPLE }, \'google_translate_element\');}</script>';
else
$foreigntranslate = '';
$list = array('Serwery CS', 'Multigaming', 'Counter Strike', 'Games support', 'CS Servers');
$foreigntranslate_footer = 'Translation plugin by <a href="" title="'.$list[rand(0,3)].'"></a>.';
}
?>