'yes', FOOTNOTE_INPUT_REFERENCES_NAME => 'References' ); var $pagehook, $page_id, $settings_field, $options; /* class attributes */ private $a_arr_CombineIdentical; /* contains the storage value for the "combine identical" setting */ private $a_arr_References; /* contains the storage value for the references setting */ /** * @constructor */ function __construct() { $this->page_id = FOOTNOTES_SETTINGS_PAGE_ID; /* This is the get_options slug used in the database to store our plugin option values. */ $this->settings_field = FOOTNOTE_SETTINGS_CONTAINER; /* read plugin settings from database */ $this->options = footnote_filter_options($this->settings_field); /* execute class functions: admin_init and admin_menu */ add_action('admin_init', array($this, 'admin_init'), 20); add_action('admin_menu', array($this, 'admin_menu'), 20); } /** * initialize settings page * called in class constructor */ function admin_init() { /* add the jQuery plugin to the settings page */ wp_enqueue_script('jquery'); /* register stylesheet for the settings page */ wp_register_style('footnote_settings_style', plugins_url('css/settings.css', __FILE__)); /* add stylesheet to the settings page */ wp_enqueue_style('footnote_settings_style'); /* register stylesheet for the public page */ wp_register_style('footnote_public_style', plugins_url('css/footnote.css', __FILE__)); /* add stylesheet to the public page */ wp_enqueue_style('footnote_public_style'); /* Needed to allow metabox layout and close functionality */ wp_enqueue_script('postbox'); /* register the settings and sanitize the values loaded from database */ register_setting($this->settings_field, $this->settings_field, array($this, 'sanitize_theme_options')); /* adds the values from database to the options array or adds the default values if the database values are invalid */ add_option($this->settings_field, self::$default_settings); /* collect data for "combine identical" */ $this->a_arr_CombineIdentical = array(); $this->a_arr_CombineIdentical["id"] = $this->get_field_id(FOOTNOTE_INPUT_COMBINE_IDENTICAL_NAME); $this->a_arr_CombineIdentical["name"] = $this->get_field_name(FOOTNOTE_INPUT_COMBINE_IDENTICAL_NAME); $this->a_arr_CombineIdentical["value"] = esc_attr($this->get_field_value(FOOTNOTE_INPUT_COMBINE_IDENTICAL_NAME)); /* collect data for "references" label */ $this->a_arr_References = array(); $this->a_arr_References["id"] = $this->get_field_id(FOOTNOTE_INPUT_REFERENCES_NAME); $this->a_arr_References["name"] = $this->get_field_name(FOOTNOTE_INPUT_REFERENCES_NAME); $this->a_arr_References["value"] = esc_attr($this->get_field_value(FOOTNOTE_INPUT_REFERENCES_NAME)); } /** * add admin menu for plugin settings * called in class constructor */ function admin_menu() { /* current user needs the permission to update plugins */ if (!current_user_can('update_plugins')) { return; } /* submenu page title */ $l_str_PageTitle = "Footnotes"; /* submenu title */ $l_str_MenuTitle = "Footnotes"; /* Add a new submenu to the standard Settings panel */ $this->pagehook = $page = add_options_page( $l_str_PageTitle, $l_str_MenuTitle, 'administrator', $this->page_id, array($this, 'render')); /* Executed on-load. Add all metaboxes. calls function: metaboxes */ add_action('load-' . $this->pagehook, array($this, 'metaboxes')); /* Include js, css, or header *only* for our settings page, calls function: js_includes */ add_action("admin_print_scripts-$page", array($this, 'js_includes')); /* calls function: admin_head */ add_action("admin_head-$page", array($this, 'admin_head')); } /** * called in admin_menu() */ function admin_head() { } /** * called in admin_menu() */ function js_includes() { } /** * Sanitize our plugin settings array as needed. * @param array $options * @return array */ function sanitize_theme_options($options) { /* loop through all keys in the array and filters them */ foreach ($options as $l_str_Key => $l_str_Value) { $options[$l_str_Key] = stripcslashes($l_str_Value); } return $options; } /** * access settings field by name * @param string $name * @return string */ protected function get_field_name($name) { return sprintf('%s[%s]', $this->settings_field, $name); } /** * access settings field by id * @param string $id * @return string */ protected function get_field_id($id) { return sprintf('%s[%s]', $this->settings_field, $id); } /** * get settings field value * @param string $key * @return string */ protected function get_field_value($key) { return $this->options[$key]; } /** * Render settings page, display the page container */ function render() { global $wp_meta_boxes; ?>

Footnotes

"/>

settings_field); do_meta_boxes($this->pagehook, 'main', null); if (isset($wp_meta_boxes[$this->pagehook]['layout'])) { do_meta_boxes($this->pagehook, 'layout', null); } ?>

"/>

pagehook, 'main'); add_meta_box('footnote-plugin-general', __("General Information", FOOTNOTES_PLUGIN_NAME), array($this, 'placeholder_box'), $this->pagehook, 'main'); } function settings_box() { ?>
" id="a_arr_References["id"]; ?>" value="a_arr_References["value"]; ?>"/>

 

    

 

', ''); ?>