private function setOption($strOptionKey) { $vOption = get_option($strOptionKey); // Avoid casting array because it causes a zero key when the subject is null. $vOption = $vOption === false ? array() : $vOption; // Now $vOption is an array so merge with the default option to avoid undefined index warnings. $arrOptions = $this->uniteArraysRecursive($vOption, self::$arrStructure_Options); // If the template option array is empty, retrieve the active template arrays. if (empty($arrOptions['arrTemplates'])) { $oTemplate = new FetchTweets_Templates(); $arrDefaultTemplate = $oTemplate->findDefaultTemplateDetails(); $arrOptions['arrTemplates'][$arrDefaultTemplate['strSlug']] = $arrDefaultTemplate; $arrOptions['arrDefaultTemplate'] = $arrDefaultTemplate; // Schedule updating the option at the end of the script. add_action('shutdown', array($this, 'saveOptions')); } return $arrOptions; }
public function setUp() { $oTemplates = new FetchTweets_Templates(); $this->addSettingFields(array('strFieldID' => 'fetch_tweets_template', 'strTitle' => __('Select Template', 'fetch-tweets'), 'strDescription' => __('Sets a default template for this rule. If a template is specified in a widget, the shortcode, or the function, this setting will be overriden.', 'fetch-tweets'), 'vLabel' => $arr = $oTemplates->getTemplateArrayForSelectLabel(), 'strType' => 'select', 'vDefault' => $oTemplates->getDefaultTemplateSlug()), array()); }