"000000", "Affiliate_ID" => "ABU-1338563844", "Thank_you_page" => "http://abundatrade.com/trade/thank-you.php?a=abundatrade", "Theme" => "classic" )); if (get_option("skel_abundatrade_options", false) === false) { $options = array(); } else { $options = get_option("skel_abundatrade_options"); } $options = array_merge($default, $options); return $options; } public function applySettings($var) { foreach($var as $setting => $value) { if (isset($this->$setting)) $this->$setting = $value; } } /** * Reduces the class's settings to an array and returns them * @var mixed $settings Other settings to merge these with (for addons) * @return mixed The settings array */ function getSettings($settings) { $this->reduceSettings(); return array_merge($settings, $this->settings_array); } /** * Run update code here * @var string $version The version that was installed previously * @var string $coded_version The version that is currently running (or to update to) */ function update($version, $coded_version) { switch ($version) { case "0.0": // a fresh install break; case "0.1": // from the very first version break; case "0.2": // from this version ... slightly confused break; case "0.6": // from before the theme default: // from an unknown version ... break; } if ($coded_version >= 010601) { $dir = wp_upload_dir(); mkdir($dir['basedir'] . '/abundatrade/themes/', 0770, true); } } /** * Gets the plugin settings * @return skel__settings This plugin's settings class */ public static function Settings() { $settings = apply_filters("abundatrade(settings)", array()); return $settings[0]; } public static function RenderBox($title, $description = '', $inputs = null) { ?>

">

" . $input['name'] . ": "; $type = $input['type']; switch ($type) { case 'select': $options = $input['options']; unset($input['options']); $selected = $input['value']; unset($input['value']); echo ""; break; default: echo " $value) { echo $part . "=\"" . $value . "\""; } echo " />

"; break; } } } ?>
settings_array = apply_filters("abundatrade(default_options)", array()); foreach ($this->settings_array as $setting => $setto) { $this->$setting = $setto; } if ($this->version != $this->coded_version) { do_action("abundatrade(update)", $this->version, $this->coded_version); $this->version = $this->coded_version; } add_action("shutdown", array($this, "save")); } /** * Reduces all class vars into an array for saving or distribution */ private function reduceSettings() { foreach ($this->settings_array as $setting => $setto) { $this->settings_array[$setting] = $this->$setting; } } /** * Reduces class vars and then saves them to the db */ function save() { $this->reduceSettings(); update_option("skel_abundatrade_options", $this->settings_array); } }