Vergleich inc/plugins/hello.php - 1.8.7 - 1.8.8

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 13Zeile 13
{
die('This file cannot be accessed directly.');
}

{
die('This file cannot be accessed directly.');
}

	



// cache templates - this is important when it comes to performance
// THIS_SCRIPT is defined by some of the MyBB scripts, including index.php
if(defined('THIS_SCRIPT'))

// cache templates - this is important when it comes to performance
// THIS_SCRIPT is defined by some of the MyBB scripts, including index.php
if(defined('THIS_SCRIPT'))

{

{

    global $templatelist;

if(isset($templatelist))

    global $templatelist;

if(isset($templatelist))

Zeile 42Zeile 42
	$plugins->add_hook('admin_config_settings_change', 'hello_settings');
$plugins->add_hook('admin_config_settings_start', 'hello_settings');
// We could hook at 'admin_config_settings_begin' only for simplicity sake.

	$plugins->add_hook('admin_config_settings_change', 'hello_settings');
$plugins->add_hook('admin_config_settings_start', 'hello_settings');
// We could hook at 'admin_config_settings_begin' only for simplicity sake.

}

}

else
{
// Add our hello_index() function to the index_start hook so when that hook is run our function is executed
$plugins->add_hook('index_start', 'hello_index');

else
{
// Add our hello_index() function to the index_start hook so when that hook is run our function is executed
$plugins->add_hook('index_start', 'hello_index');





	// Add our hello_post() function to the postbit hook so it gets executed on every post
$plugins->add_hook('postbit', 'hello_post');

	// Add our hello_post() function to the postbit hook so it gets executed on every post
$plugins->add_hook('postbit', 'hello_post');





	// Add our hello_new() function to the misc_start hook so our misc.php?action=hello inserts a new message into the created DB table.
$plugins->add_hook('misc_start', 'hello_new');

	// Add our hello_new() function to the misc_start hook so our misc.php?action=hello inserts a new message into the created DB table.
$plugins->add_hook('misc_start', 'hello_new');

}


}


function hello_info()
{
global $lang;

function hello_info()
{
global $lang;

Zeile 74Zeile 74
	return array(
'name' => 'Hello World!',
'description' => $lang->hello_desc,

	return array(
'name' => 'Hello World!',
'description' => $lang->hello_desc,

		'website'		=> 'http://mybb.com',

		'website'		=> 'https://mybb.com',

		'author'		=> 'MyBB Group',

		'author'		=> 'MyBB Group',

		'authorsite'	=> 'http://www.mybb.com',

		'authorsite'	=> 'https://mybb.com',

		'version'		=> '2.0',
'compatibility' => '18*',
'codename' => 'hello'

		'version'		=> '2.0',
'compatibility' => '18*',
'codename' => 'hello'

Zeile 318Zeile 318

// Delete deprecated entries.
$db->delete_query('settings', "gid='{$gid}' AND description='HELLODELETEMARKER'");


// Delete deprecated entries.
$db->delete_query('settings', "gid='{$gid}' AND description='HELLODELETEMARKER'");

	



	// This is required so it updates the settings.php file as well and not only the database - they must be synchronized!
rebuild_settings();

	// This is required so it updates the settings.php file as well and not only the database - they must be synchronized!
rebuild_settings();





	// Include this file because it is where find_replace_templatesets is defined

	// Include this file because it is where find_replace_templatesets is defined

	require_once MYBB_ROOT.'inc/adminfunctions_templates.php';


	require_once MYBB_ROOT.'inc/adminfunctions_templates.php';


	// Edit the index template and add our variable to above {$forums}
find_replace_templatesets('index', '#'.preg_quote('{$forums}').'#', "{\$hello}\n{\$forums}");
}

	// Edit the index template and add our variable to above {$forums}
find_replace_templatesets('index', '#'.preg_quote('{$forums}').'#', "{\$hello}\n{\$forums}");
}

Zeile 339Zeile 339
function hello_deactivate()
{
require_once MYBB_ROOT.'inc/adminfunctions_templates.php';

function hello_deactivate()
{
require_once MYBB_ROOT.'inc/adminfunctions_templates.php';

	



	// remove template edits
find_replace_templatesets('index', '#'.preg_quote('{$hello}').'#', '');
}

	// remove template edits
find_replace_templatesets('index', '#'.preg_quote('{$hello}').'#', '');
}