/** * Start up */ public function __construct() { // set options $this->options = custom_get_options(); // actions add_action('admin_menu', array($this, 'add_plugin_page')); add_action('admin_init', array($this, 'page_init')); }
/** * retrieve custom option value * @param string $id : option id * @return multiple : option value - null if doesn't exists */ function custom_get_option($slug) { $res = null; $options = custom_get_options(); if (!empty($options)) { foreach ($options as $value) { if (isset($options[$slug])) { $res = $options[$slug]; } } } return $res; }