public function __construct() { parent::__construct(); $this->preferences_fields = RWP_Preferences_Page::get_preferences_fields(); $this->menu_slug = 'reviewer-preferences-page'; $this->parent_menu_slug = 'reviewer-main-page'; $this->option_name = 'rwp_preferences'; $this->option_value = RWP_Reviewer::get_option($this->option_name); $this->add_menu_page(); $this->register_page_fields(); add_action('admin_enqueue_scripts', array($this, 'localize_script')); }
public static function preferences_field($field, $preferences, $return = false) { $default_preferences = RWP_Preferences_Page::get_preferences_fields(); $value = isset($preferences[$field]) ? $preferences[$field] : $default_preferences[$field]['default']; if ($return) { return $value; } echo $value; }
public function preferences_field($field, $return = false) { if (null == $this->default_preferences) { $this->default_preferences = RWP_Preferences_Page::get_preferences_fields(); } $value = isset($this->preferences[$field]) ? $this->preferences[$field] : $this->default_preferences[$field]['default']; if ($return) { return $value; } echo $value; }