adding error checking in deliver_sendmail class.
[squirrelmail.git] / functions / plugin.php
index bcf034f412263ea29f491f83467e398ddd989cca..8cf261b73cb23d3d3d47c77f16b42d4d84ec42a2 100644 (file)
@@ -3,13 +3,12 @@
 /**
  * plugin.php
  *
- * Copyright (c) 1999-2004 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-2005 The SquirrelMail Project Team
+ * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  * @version $Id$
  * @package squirrelmail
  */
@@ -184,10 +183,37 @@ 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();
 }
+
+/**
+ * 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;
+  }
+}
+
 /*************************************/
 /*** MAIN PLUGIN LOADING CODE HERE ***/
 /*************************************/