__CLASS__, 'description' => __('Allow the user to bookmark a page and then jump to it upon return.','comicpress') ); $this->WP_Widget(__CLASS__, __('ComicPress Bookmark','comicpress'), $widget_ops); } $this->text_fields = array( 'three-button' => array( 'tag-page' => array( 'label' => __('Tag page', 'comicpress'), 'default' => __('Bookmark', 'comicpress') ), 'clear-tag-off' => array( 'label' => __('Clear tag off', 'comicpress'), 'default' => '' ), 'clear-tag-on' => array( 'label' => __('Clear tag on', 'comicpress'), 'default' => __('Clear', 'comicpress') ), 'goto-tag-off' => array( 'label' => __('Goto tag off', 'comicpress'), 'default' => '' ), 'goto-tag-on' => array( 'label' => __('Goto tag on', 'comicpress'), 'default' => __('Goto', 'comicpress') ) ), 'one-button' => array( 'bookmark-clicker-off' => array( 'label' => __('Set bookmark', 'comicpress'), 'default' => __('+Bookmark', 'comicpress') ), 'bookmark-clicker-on' => array( 'label' => __('Use bookmark', 'comicpress'), 'default' => __('>>Bookmark', 'comicpress') ) ) ); $this->default_instance = array( 'title' => __('Bookmark This Page', 'comicpress'), 'mode' => array_shift(array_keys($this->text_fields)) ); foreach (array_values($this->text_fields) as $fields) { foreach ($fields as $field => $info) { $this->default_instance[$field] = $info['default']; } } } function init() {} function is_active() { add_action('template_redirect', array(&$this, 'template_redirect')); } function template_redirect() { wp_enqueue_script('prototype'); wp_enqueue_script('cookiejar', plugin_dir_url(dirname(__FILE__)) . 'js/cookiejar.js', array('prototype')); wp_enqueue_script('bookmark', plugin_dir_url(dirname(__FILE__)) . 'js/bookmark.js', array('prototype', 'cookiejar')); } // @codeCoverageIgnoreEnd function form($instance) { $instance = array_merge($this->default_instance, (array)$instance); ?>
__('Three-button mode', 'comicpress'), 'one-button' => __('One-button mode', 'comicpress') ) as $mode => $label) { ?>
text_fields[$mode] as $name => $info) {
extract($info);
$value = empty($instance[$name]) ? $default : $instance[$name];
?>