Example #1
0
 public static function init($args = '')
 {
     if (!is_array($args)) {
         $args = wp_parse_args($args);
     }
     self::$fields = $args['fields'];
     self::$file = isset($args['file']) && $args['file'] ? $args['file'] : __FILE__;
     self::$id = $args['id'];
     self::$menu_title = $args['menu_title'];
     self::$title = $args['title'];
     self::$role = isset($args['role']) && $args['role'] ? $args['role'] : self::$role;
     self::build_settings();
     add_options_page(self::$title, self::$menu_title, self::$role, self::$file, array('tinyTOC_Options', 'page'));
 }
Example #2
0
 public static function init_settings()
 {
     $settings = array('id' => 'tinytoc_options', 'title' => __('tinyTOC Options', 'tinytoc'), 'menu_title' => __('tinyTOC', 'tinytoc'), 'fields' => array("general" => array('title' => __('Main Settings', 'tinytoc'), 'callback' => '', 'options' => array('min' => array('title' => __('Minimum entries for TOC', 'tinytoc'), 'callback' => 'number', 'args' => array('min' => 1, 'max' => 10, 'step' => 1, 'description' => __('How many headings have to be found in post content for TOC to be generated?', 'tinytoc'))), 'list_type' => array('title' => __('List appearance', 'tinytoc'), 'callback' => 'radio', 'args' => array('values' => array('ol' => __('Numbers', 'tinytoc'), 'ul' => __('Bullets', 'tinytoc')))), 'position' => array('title' => __('Insert TOC', 'tinytoc'), 'callback' => 'radio', 'args' => array('description' => __('Where to insert TOC in post content. Choose "Do not display autmatically" if you want to use widget/shortcode instead.', 'tinytoc'), 'values' => array('before' => __('Above the text', 'tinytoc'), 'after' => __('Below the text', 'tinytoc'), 'false' => __('Do not display automatically', 'tinytoc')))), 'bookmark' => array('title' => __('Link format', 'tinytoc'), 'callback' => 'radio', 'args' => array('description' => __('What format to use for auto generated TOC links.', 'tinytoc'), 'values' => array('numeric' => __('Numeric (e.g. #h1, #h2 ...)', 'tinytoc'), 'slug' => __('Text (e.g. #my-title-here)', 'tinytoc'), 'combined' => __('Combined (e.g. #h1-my-title-here)', 'tinytoc')))), 'widget' => array('title' => __('Enable Widget', 'tinytoc'), 'callback' => 'checkbox', 'args' => array('description' => __('If unchecked, the tinyTOC widget will not be loaded.', 'tinytoc')))))));
     tinyTOC_Options::init($settings);
 }