* This file provides the framework for a plugin architecture.
*
* Documentation on how to write plugins might show up some time.
*
* This file provides the framework for a plugin architecture.
*
* Documentation on how to write plugins might show up some time.
*
/* Variable-length argument lists have a slight problem when */
/* passing values by reference. Pity. This is a workaround. */
return $data;
/* Variable-length argument lists have a slight problem when */
/* passing values by reference. Pity. This is a workaround. */
return $data;
* @return mixed the return value of the hook function
*/
function do_hook_function($name,$parm=NULL) {
* @return mixed the return value of the hook function
*/
function do_hook_function($name,$parm=NULL) {
/* Variable-length argument lists have a slight problem when */
/* passing values by reference. Pity. This is a workaround. */
return $ret;
/* Variable-length argument lists have a slight problem when */
/* passing values by reference. Pity. This is a workaround. */
return $ret;
* @return string a concatenation of the results of each plugin function
*/
function concat_hook_function($name,$parm=NULL) {
* @return string a concatenation of the results of each plugin function
*/
function concat_hook_function($name,$parm=NULL) {
/* Variable-length argument lists have a slight problem when */
/* passing values by reference. Pity. This is a workaround. */
return $ret;
/* Variable-length argument lists have a slight problem when */
/* passing values by reference. Pity. This is a workaround. */
return $ret;
* @return bool the result of the function
*/
function boolean_hook_function($name,$parm=NULL,$priority=0,$tie=false) {
* @return bool the result of the function
*/
function boolean_hook_function($name,$parm=NULL,$priority=0,$tie=false) {
/* Examine the aftermath and assign the return value appropriately */
if (($priority > 0) && ($yea)) {
/* Examine the aftermath and assign the return value appropriately */
if (($priority > 0) && ($yea)) {
* This function checks whether the user's USER_AGENT is known to
* be broken. If so, returns true and the plugin is invisible to the
* offending browser.
* This function checks whether the user's USER_AGENT is known to
* be broken. If so, returns true and the plugin is invisible to the
* offending browser.
- $soup_menu = array('Mozilla/3','Mozilla/2','Mozilla/1', 'Opera 4',
- 'Opera/4', 'OmniWeb', 'Lynx');
- sqgetGlobalVar('HTTP_USER_AGENT', $user_agent, SQ_SERVER);
- foreach($soup_menu as $browser) {
- if(stristr($user_agent, $browser)) {
- return 1;
- }
- }
- return 0;
+/**
+ * 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 ***/
/*************************************/
/* On startup, register all plugins configured for use. */
if (isset($plugins) && is_array($plugins)) {
/*************************************/
/*** MAIN PLUGIN LOADING CODE HERE ***/
/*************************************/
/* On startup, register all plugins configured for use. */
if (isset($plugins) && is_array($plugins)) {