Settings'; array_push($links, $settings_link); } return $links; } public function addoptions() { require_once(plugin_dir_path(__FILE__) .'/annie_admin.php'); add_options_page('Annie Plugin Options', 'Annie', 'manage_options', basename(__FILE__), 'annie_options_subpanel'); } public function highlight_shortcode($annie_attributes, $annieText = '') { $default_style = get_option('annie_defaultHighlight', 'yellow'); if ($default_style == "custom") { $default_style = get_option('annie_defaultHighlightCustom', 'yellow'); } extract( shortcode_atts( array( 'style' => $default_style ), $annie_attributes ) ); $hilight_text = ''. $annieText .''; $this->highlightText[] = $annieText; // Take care of any nested shortcodes $hilight_text = do_shortcode($hilight_text); $this->showToolbox = true; return $hilight_text; } public function footnote_shortcode($annie_attributes, $annieText = '') { global $post, $tippy; // Store the text in our array $this->footnoteText[$this->footcount] = $annieText; // No markup for footnotes; just the text. $annieShortcodeText = do_shortcode($annieText); $annie_cleanText = $annieShortcodeText; // $annie_cleanText = str_replace('[', '{', $annie_cleanText); // Format the footnote reference if (is_object($tippy) && get_option('annie_footnoteDisplay', 'link') == 'tooltip') { $annie_footnoteLink = get_permalink($post->ID) ."#foot_text_". $post->ID . "_". $this->footcount; $annie_footnoteTitle = $this->footcount; if (get_option('annie_footnoteFormat', 'numbers') == "other") { $annie_footnoteTitle = get_option('annie_footnoteFormatText', '*'); } $annie_tippyValues = array( 'header' => 'off', 'title' => $annie_footnoteTitle, 'href' => $annie_footnoteLink, 'text' => $annie_cleanText, 'class' => 'annie_footnoteRef annie_custom', 'name' => 'foot_loc_'. $post->ID . '_'. $this->footcount, 'item' => 'foot_tip_'. $post->ID . '_'. $this->footcount, 'useDiv' => true ); $annie_returnLink = $tippy->getLink($annie_tippyValues); } else { $annie_returnLink = ''. $this->footcount .''; } $this->footcount++; $this->showToolbox = true; return $annie_returnLink; } public function footnote_display_shortcode($annie_attributes = '', $annie_text = '') { $annie_returnText = $this->process_content(''); $this->footnotesShowing = true; return $annie_returnText; } public function process_content($content) { global $post; if (!$this->footnotesShowing && (is_single() || $this->is_page_val) && get_option('annie_footnoteShowNotes', 'show') == 'show' && sizeof($this->footnoteText) > 0) { $footnoteHeader = get_option('annie_footnoteNotesHeader', 'Notes:'); $content .= '
'. $footnoteHeader .'
'; foreach ($this->footnoteText as $footnoteIndex => $footnoteText) { $linkTitle = $footnoteIndex; if (get_option('annie_footnoteFormat', 'numbers') == "other") { $linkTitle = get_option('annie_footnoteFormatText', '*'); } $content .= "\n"; $content .= '
'. $linkTitle .'. '. $footnoteText .'
'; $content .= "\n"; } $content .= '
'; } $this->footnoteText = array(); $this->footcount = 1; return $content; } public function toolbox() { if (sizeof($this->highlightText) > 0) { $this->show_toolbox(); echo '
'; // Output the div with highlights foreach ($this->highlightText as $discard => $annie_text) { echo $annie_text ."

"; } echo '
'; } } public function show_toolbox() { if (!$this->toolboxShowing && get_option('annie_showToolbox', 'true') == "true") { // Toolbox code $annie_toolboxMarkup = '
Hide Highlights Read Highlighted Text
«
'; echo $annie_toolboxMarkup; $this->toolboxShowing = true; } } public function load_scripts() { // Load jQuery, if not already present wp_enqueue_script('jquery'); // Load the Tippy script wp_register_script('Annie', plugins_url() .'/annie/annie.js', array('jquery')); wp_enqueue_script('Annie'); } public function load_styles() { wp_register_style('Annie', plugins_url() .'/annie/annie.css'); wp_enqueue_style('Annie'); } public function load_for_admin() { echo ''; } public function load_globals() { $this->is_page_val = is_page(); } } $annie = new Annie(); ?>