X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=functions%2Fplugin.php;h=6e66aa60a1885aea62035c41fd9a7e9334e57c0b;hb=c3806a9dc07e4bf45491e7120a1c931332f2e555;hp=b28f550d89effcb9efc1942f9dbc4b31d55dadb9;hpb=6c84ba1ec45ab854c37b6f65c5b4d84ab1c7aad4;p=squirrelmail.git diff --git a/functions/plugin.php b/functions/plugin.php index b28f550d..6e66aa60 100644 --- a/functions/plugin.php +++ b/functions/plugin.php @@ -3,24 +3,16 @@ /** * plugin.php * - * Copyright (c) 1999-2005 The SquirrelMail Project Team - * Licensed under the GNU GPL. For full terms see the file COPYING. - * * This file provides the framework for a plugin architecture. * * Documentation on how to write plugins might show up some time. * + * @copyright © 1999-2006 The SquirrelMail Project Team + * @license http://opensource.org/licenses/gpl-license.php GNU Public License * @version $Id$ * @package squirrelmail */ -/** Everything needs global.. */ -require_once(SM_PATH . 'functions/global.php'); -require_once(SM_PATH . 'functions/prefs.php'); - -global $squirrelmail_plugin_hooks; -$squirrelmail_plugin_hooks = array(); - /** * This function adds a plugin. * @param string $name Internal plugin name (ie. delete_move_next) @@ -184,19 +176,34 @@ function boolean_hook_function($name,$parm=NULL,$priority=0,$tie=false) { * FIXME: This function needs to have its name changed! * * @return bool whether this browser properly supports JavaScript + * @deprecated use checkForJavascript() since 1.5.1 */ function soupNazi(){ return !checkForJavascript(); } -/*************************************/ -/*** MAIN PLUGIN LOADING CODE HERE ***/ -/*************************************/ - -/* On startup, register all plugins configured for use. */ -if (isset($plugins) && is_array($plugins)) { - foreach ($plugins as $name) { - use_plugin($name); - } -} -?> \ No newline at end of file +/** + * Check if plugin is enabled + * @param string $plugin_name plugin name + * @since 1.5.1 + * @return boolean + */ +function is_plugin_enabled($plugin_name) { + global $plugins; + + /** + * check if variable is empty. if var is not set, php empty + * returns true without error notice. + * + * then check if it is an array + */ + if (empty($plugins) || ! is_array($plugins)) + return false; + + if ( in_array($plugin_name,$plugins) ) { + return true; + } else { + return false; + } +} +?>