Released under the terms of the GNU General Public License. You should have received a copy of the GNU General Public License, along with this software. In the main directory, see: /licensing/ If not, see: . */ /* WARNING: This is a system configuration file, please DO NOT EDIT this file directly! ... Instead, use the widget options panel in WordPress® to override these settings. */ /* Direct access denial. */ if (realpath (__FILE__) === realpath ($_SERVER["SCRIPT_FILENAME"])) exit ("Do not access this file directly."); /* Detect if this is WordPress® with Multisite/Networking. */ if (($GLOBALS["WS_WIDGET__"]["ad_codes"]["c"]["is_multisite"] = ((function_exists ("is_multisite") && is_multisite ()) || function_exists ("wpmu_current_site")))/**/ && ((defined ("MULTISITE_FARM") && MULTISITE_FARM) || file_exists (dirname (dirname (__FILE__)) . "/multisite.farm"))) /* For Multisite Blog Farms. */ $GLOBALS["WS_WIDGET__"]["ad_codes"]["c"]["is_multisite_farm"] = true; /* Configure important global values for this widget + default values for options. */ $GLOBALS["WS_WIDGET__"]["ad_codes"]["c"]["name"] = "Ad Codes"; $GLOBALS["WS_WIDGET__"]["ad_codes"]["c"]["control_w"] = "400"; /* Width of the control box. */ $GLOBALS["WS_WIDGET__"]["ad_codes"]["c"]["description"] = "Supports AdSense®, Javascript, XHTML and PHP code."; /**/ if ($GLOBALS["WS_WIDGET__"]["ad_codes"]["c"]["is_multisite_farm"]) /* PHP eval() will be disabled here. */ $GLOBALS["WS_WIDGET__"]["ad_codes"]["c"]["description"] = "Supports AdSense®, Javascript, XHTML, etc."; /* Determine the full url to the directory this plugin resides in. */ $GLOBALS["WS_WIDGET__"]["ad_codes"]["c"]["dir_url"] = WP_CONTENT_URL . /* URL to the plugin directory. */ preg_replace ("/^(.*?)(\/" . preg_quote (basename (WP_CONTENT_DIR), "/") . ")/", "", dirname (dirname (__FILE__))); /* Check if the plugin has been configured *should be set after the first config via options panel*. */ $GLOBALS["WS_WIDGET__"]["ad_codes"]["c"]["configured"] = get_option ("ws_widget__ad_codes_configured"); /* Configure the right menu options panel for this software. */ $GLOBALS["WS_WIDGET__"]["ad_codes"]["c"]["menu_pages"] = array ("installation" => false, "tools" => true, "support" => true, "donations" => true); /* Configure the file modification time for the syscon.inc.php file. */ $GLOBALS["WS_WIDGET__"]["ad_codes"]["c"]["filemtime"] = filemtime (__FILE__); /* Configure & validate all of the widget options; and set their defaults. */ function ws_widget__ad_codes_configure_options_and_their_defaults ($options = FALSE, $per_widget_options = FALSE) { /* Here we build the default options array, which will be merged with the user options. It is important to note that sometimes default options may not or should not be pre-filled on an options form. These defaults are for the system to use in various ways, we may choose not to pre-fill certain fields. In other words, some defaults may be used internally, but to the user, the option will be empty. */ $default_options = apply_filters ("ws_widget__ad_codes_default_options", array ( /* For filters. */ /**/ "options_version" => "1.0", /* Used internally to keep runtime files up-to-date. */ /**/ "run_deactivation_routines" => "1")); /* Should deactivation routines be processed? */ /* We also build the default widget options array, these get merged on a per-widget basis. It is important to note that sometimes default options may not or should not be pre-filled on an options form. These defaults are for the system to use in various ways, we may choose not to pre-fill certain fields. In other words, some defaults may be used internally, but to the user, the option will be empty. */ $default_per_widget_options = apply_filters ("ws_widget__ad_codes_default_per_widget_options", array (/**/ /**/ "title" => "Ad Codes Widget", /* Ok for this to be empty. */ /**/ "code" => 'Ad Code')); /* Are we dealing with per-widget options here? */ if ($per_widget_options !== false): /* If so we need to work differently. */ /* Here they are merged. user options will overwrite some or all defaults. */ $WS_WIDGET__per_widget_options = array_merge ($default_per_widget_options, (array)$per_widget_options); /* Validate each option, possibly reverting back to default if invalid. */ foreach ($WS_WIDGET__per_widget_options as $key => &$value) { if (!is_array ($value)) $value = trim (stripslashes ($value)); else /* A string, or an array of strings. */ foreach ($value as $k => $v) $value[$k] = trim (stripslashes ($v)); /**/ if (!isset ($default_per_widget_options[$key]) && !preg_match ("/^pro_/", $key)) unset($WS_WIDGET__per_widget_options[$key]); /**/ else if ($key === "title" && !is_string ($value)) $value = $default_per_widget_options[$key]; /**/ else if ($key === "code" && (!is_string ($value) || !strlen ($value))) $value = $default_per_widget_options[$key]; } /**/ return apply_filters ("ws_widget__ad_codes_per_widget_options", $WS_WIDGET__per_widget_options); /* Else we are dealing with the main plugin option configuration or validation. */ else: /* We need to validate these while checking to see if options were passed in. */ /* Here they are merged. user options will overwrite some or all defaults. */ $GLOBALS["WS_WIDGET__"]["ad_codes"]["o"] = array_merge ($default_options, (($options !== false) ? (array)$options : (array)get_option ("ws_widget__ad_codes_options"))); /* Validate each option, possibly reverting back to default if invalid. */ foreach ($GLOBALS["WS_WIDGET__"]["ad_codes"]["o"] as $key => &$value) { if (!is_array ($value)) $value = trim (stripslashes ($value)); else /* A string, or an array of strings. */ foreach ($value as $k => $v) $value[$k] = trim (stripslashes ($v)); /**/ if (!isset ($default_options[$key]) && !preg_match ("/^pro_/", $key)) unset($GLOBALS["WS_WIDGET__"]["ad_codes"]["o"][$key]); /**/ else if ($key === "options_version" && (!is_string ($value) || !is_numeric ($value))) $value = $default_options[$key]; /**/ else if ($key === "run_deactivation_routines" && (!is_string ($value) || !is_numeric ($value))) $value = $default_options[$key]; } /**/ return apply_filters ("ws_widget__ad_codes_options", $GLOBALS["WS_WIDGET__"]["ad_codes"]["o"]); /**/ endif; } /**/ call_user_func("ws_widget__ad_codes_configure_options_and_their_defaults"); ?>