diff --git a/class/dashboard/subpage-main.php b/class/dashboard/subpage-main.php index 4e93eb5..d3b9f08 100644 --- a/class/dashboard/subpage-main.php +++ b/class/dashboard/subpage-main.php @@ -15,299 +15,299 @@ */ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine { - /** - * Returns a Priority index. Lower numbers have a higher Priority. - * - * @author Stefan Herndler - * @since 1.5.0 - * @return int - */ - public function getPriority() { - return 10; - } + /** + * Returns a Priority index. Lower numbers have a higher Priority. + * + * @author Stefan Herndler + * @since 1.5.0 + * @return int + */ + public function getPriority() { + return 10; + } - /** - * Returns the unique slug of the sub page. - * - * @author Stefan Herndler - * @since 1.5.0 - * @return string - */ - protected function getSubPageSlug() { - return "-" . MCI_Footnotes_Config::C_STR_PLUGIN_NAME; - } + /** + * Returns the unique slug of the sub page. + * + * @author Stefan Herndler + * @since 1.5.0 + * @return string + */ + protected function getSubPageSlug() { + return "-" . MCI_Footnotes_Config::C_STR_PLUGIN_NAME; + } - /** - * Returns the title of the sub page. - * - * @author Stefan Herndler - * @since 1.5.0 - * @return string - */ - protected function getSubPageTitle() { - return MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME; - } + /** + * Returns the title of the sub page. + * + * @author Stefan Herndler + * @since 1.5.0 + * @return string + */ + protected function getSubPageTitle() { + return MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME; + } - /** - * Returns an array of all registered sections for the sub page. - * - * @author Stefan Herndler - * @since 1.5.0 - * @return array - */ - protected function getSections() { + /** + * Returns an array of all registered sections for the sub page. + * + * @author Stefan Herndler + * @since 1.5.0 + * @return array + */ + protected function getSections() { $l_arr_Tabs = array(); $l_arr_Tabs[] = $this->addSection("settings", __("Settings", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), 0, true); $l_arr_Tabs[] = $this->addSection("customize", __("Customize", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), 1, true); if (MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_EXPERT_MODE))) { $l_arr_Tabs[] = $this->addSection("expert", __("Expert mode", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), 2, true); } - $l_arr_Tabs[] = $this->addSection("how-to", __("Preview", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), null, false); - return $l_arr_Tabs; - } + $l_arr_Tabs[] = $this->addSection("how-to", __("How to", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), null, false); + return $l_arr_Tabs; + } - /** - * Returns an array of all registered meta boxes for each section of the sub page. - * - * @author Stefan Herndler - * @since 1.5.0 - * @return array - */ - protected function getMetaBoxes() { - return array( - $this->addMetaBox("settings", "reference-container", __("References Container", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "ReferenceContainer"), - $this->addMetaBox("settings", "styling", sprintf(__("%s styling", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME), "Styling"), - $this->addMetaBox("settings", "love", MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME . ' ' . MCI_Footnotes_Config::C_STR_LOVE_SYMBOL, "Love"), - $this->addMetaBox("settings", "other", __("Other", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "Other"), + /** + * Returns an array of all registered meta boxes for each section of the sub page. + * + * @author Stefan Herndler + * @since 1.5.0 + * @return array + */ + protected function getMetaBoxes() { + return array( + $this->addMetaBox("settings", "reference-container", __("References Container", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "ReferenceContainer"), + $this->addMetaBox("settings", "styling", sprintf(__("%s styling", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME), "Styling"), + $this->addMetaBox("settings", "love", MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME . ' ' . MCI_Footnotes_Config::C_STR_LOVE_SYMBOL, "Love"), + $this->addMetaBox("settings", "other", __("Other", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "Other"), - $this->addMetaBox("customize", "superscript", __("Superscript layout", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "Superscript"), - $this->addMetaBox("customize", "mouse-over-box", __("Mouse-over box", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "MouseOverBox"), - $this->addMetaBox("customize", "hyperlink-arrow", __("Hyperlink symbol in the Reference container", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "HyperlinkArrow"), - $this->addMetaBox("customize", "custom-css", __("Add custom CSS to the public page", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "CustomCSS"), + $this->addMetaBox("customize", "superscript", __("Superscript layout", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "Superscript"), + $this->addMetaBox("customize", "mouse-over-box", __("Mouse-over box", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "MouseOverBox"), + + $this->addMetaBox("customize", "custom-css", __("Add custom CSS to the public page", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "CustomCSS"), $this->addMetaBox("expert", "lookup", __("WordPress hooks to look for Footnote short codes", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "lookupHooks"), - $this->addMetaBox("how-to", "help", __("Brief introduction in how to use the plugin", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "Help"), - $this->addMetaBox("how-to", "donate", __("Help us to improve our Plugin", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "Donate") - ); - } + $this->addMetaBox("how-to", "help", __("Brief introduction in how to use the plugin", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "Help"), + $this->addMetaBox("how-to", "donate", __("Help us to improve our Plugin", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), "Donate") + ); + } - /** - * Displays all settings for the reference container. - * - * @author Stefan Herndler - * @since 1.5.0 - */ - public function ReferenceContainer() { - // options for the positioning of the reference container - $l_arr_Positions = array( - "footer" => __("in the footer", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), - "post_end" => __("at the end of the post", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), - "widget" => __("in the widget area", MCI_Footnotes_Config::C_STR_PLUGIN_NAME) - ); + /** + * Displays all settings for the reference container. + * + * @author Stefan Herndler + * @since 1.5.0 + */ + public function ReferenceContainer() { + // options for the positioning of the reference container + $l_arr_Positions = array( + "footer" => __("in the footer", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), + "post_end" => __("at the end of the post", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), + "widget" => __("in the widget area", MCI_Footnotes_Config::C_STR_PLUGIN_NAME) + ); - // load template file - $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "settings-reference-container"); - // replace all placeholders - $l_obj_Template->replace( - array( - "label-name" => $this->addLabel(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_NAME, __("References label", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), - "name" => $this->addTextBox(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_NAME), + // load template file + $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "settings-reference-container"); + // replace all placeholders + $l_obj_Template->replace( + array( + "label-name" => $this->addLabel(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_NAME, __("References label", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), + "name" => $this->addTextBox(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_NAME), - "label-collapse" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_COLLAPSE, __("Collapse references by default", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), - "collapse" => $this->addCheckbox(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_COLLAPSE), + "label-collapse" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_COLLAPSE, __("Collapse references by default", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), + "collapse" => $this->addCheckbox(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_COLLAPSE), - "label-position" => $this->addLabel(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION, __("Where shall the reference container appear", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), - "position" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION, $l_arr_Positions) - ) - ); - // display template with replaced placeholders - echo $l_obj_Template->getContent(); - } + "label-position" => $this->addLabel(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION, __("Where shall the reference container appear", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), + "position" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION, $l_arr_Positions) + ) + ); + // display template with replaced placeholders + echo $l_obj_Template->getContent(); + } - /** - * Displays all settings for the footnotes styling. - * - * @author Stefan Herndler - * @since 1.5.0 - */ - public function Styling() { - // define some space for the output - $l_str_Space = "     "; - // options for the combination of identical footnotes - $l_arr_CombineIdentical = array( - "yes" => __("Yes", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), - "no" => __("No", MCI_Footnotes_Config::C_STR_PLUGIN_NAME) - ); - // options for the start of the footnotes short code - $l_arr_ShortCodeStart = array( - "((" => "((", - htmlspecialchars("") => htmlspecialchars(""), - "[ref]" => "[ref]", - "userdefined" => __('user defined', MCI_Footnotes_Config::C_STR_PLUGIN_NAME) - ); - // options for the end of the footnotes short code - $l_arr_ShortCodeEnd = array( - "))" => "))", - htmlspecialchars("") => htmlspecialchars(""), - "[/ref]" => "[/ref]", - "userdefined" => __('user defined', MCI_Footnotes_Config::C_STR_PLUGIN_NAME) - ); - // options for the counter style of the footnotes - $l_arr_CounterStyle = array( - "arabic_plain" => __("Arabic Numbers - Plain", MCI_Footnotes_Config::C_STR_PLUGIN_NAME) . $l_str_Space . "1, 2, 3, 4, 5, ...", - "arabic_leading" => __("Arabic Numbers - Leading 0", MCI_Footnotes_Config::C_STR_PLUGIN_NAME) . $l_str_Space . "01, 02, 03, 04, 05, ...", - "latin_low" => __("Latin Character - lower case", MCI_Footnotes_Config::C_STR_PLUGIN_NAME) . $l_str_Space . "a, b, c, d, e, ...", - "latin_high" => __("Latin Character - upper case", MCI_Footnotes_Config::C_STR_PLUGIN_NAME) . $l_str_Space . "A, B, C, D, E, ...", - "romanic" => __("Roman Numerals", MCI_Footnotes_Config::C_STR_PLUGIN_NAME) . $l_str_Space . "I, II, III, IV, V, ..." - ); + /** + * Displays all settings for the footnotes styling. + * + * @author Stefan Herndler + * @since 1.5.0 + */ + public function Styling() { + // define some space for the output + $l_str_Space = "     "; + // options for the combination of identical footnotes + $l_arr_CombineIdentical = array( + "yes" => __("Yes", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), + "no" => __("No", MCI_Footnotes_Config::C_STR_PLUGIN_NAME) + ); + // options for the start of the footnotes short code + $l_arr_ShortCodeStart = array( + "((" => "((", + htmlspecialchars("") => htmlspecialchars(""), + "[ref]" => "[ref]", + "userdefined" => __('user defined', MCI_Footnotes_Config::C_STR_PLUGIN_NAME) + ); + // options for the end of the footnotes short code + $l_arr_ShortCodeEnd = array( + "))" => "))", + htmlspecialchars("") => htmlspecialchars(""), + "[/ref]" => "[/ref]", + "userdefined" => __('user defined', MCI_Footnotes_Config::C_STR_PLUGIN_NAME) + ); + // options for the counter style of the footnotes + $l_arr_CounterStyle = array( + "arabic_plain" => __("Arabic Numbers - Plain", MCI_Footnotes_Config::C_STR_PLUGIN_NAME) . $l_str_Space . "1, 2, 3, 4, 5, ...", + "arabic_leading" => __("Arabic Numbers - Leading 0", MCI_Footnotes_Config::C_STR_PLUGIN_NAME) . $l_str_Space . "01, 02, 03, 04, 05, ...", + "latin_low" => __("Latin Character - lower case", MCI_Footnotes_Config::C_STR_PLUGIN_NAME) . $l_str_Space . "a, b, c, d, e, ...", + "latin_high" => __("Latin Character - upper case", MCI_Footnotes_Config::C_STR_PLUGIN_NAME) . $l_str_Space . "A, B, C, D, E, ...", + "romanic" => __("Roman Numerals", MCI_Footnotes_Config::C_STR_PLUGIN_NAME) . $l_str_Space . "I, II, III, IV, V, ..." + ); - // load template file - $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "settings-styling"); - // replace all placeholders - $l_obj_Template->replace( - array( - "label-identical" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_COMBINE_IDENTICAL_FOOTNOTES, __("Combine identical footnotes", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), - "identical" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_COMBINE_IDENTICAL_FOOTNOTES, $l_arr_CombineIdentical), + // load template file + $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "settings-styling"); + // replace all placeholders + $l_obj_Template->replace( + array( + "label-identical" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_COMBINE_IDENTICAL_FOOTNOTES, __("Combine identical footnotes", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), + "identical" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_COMBINE_IDENTICAL_FOOTNOTES, $l_arr_CombineIdentical), - "label-short-code-start" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START, __("Footnote tag starts with", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), - "short-code-start" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START, $l_arr_ShortCodeStart), + "label-short-code-start" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START, __("Footnote tag starts with", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), + "short-code-start" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START, $l_arr_ShortCodeStart), - "label-short-code-end" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END, __("and ends with", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), - "short-code-end" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END, $l_arr_ShortCodeEnd), + "label-short-code-end" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END, __("and ends with", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), + "short-code-end" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END, $l_arr_ShortCodeEnd), - "label-short-code-start-user" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START_USER_DEFINED, ""), - "short-code-start-user" => $this->addTextBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START_USER_DEFINED), + "label-short-code-start-user" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START_USER_DEFINED, ""), + "short-code-start-user" => $this->addTextBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START_USER_DEFINED), - "label-short-code-end-user" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END_USER_DEFINED, ""), - "short-code-end-user" => $this->addTextBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END_USER_DEFINED), + "label-short-code-end-user" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END_USER_DEFINED, ""), + "short-code-end-user" => $this->addTextBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END_USER_DEFINED), - "label-counter-style" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE, __("Counter style", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), - "counter-style" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE, $l_arr_CounterStyle), + "label-counter-style" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE, __("Counter style", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), + "counter-style" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE, $l_arr_CounterStyle), - "short-code-start-id" => MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START, - "short-code-end-id" => MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END, - "short-code-start-user-id" => MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START_USER_DEFINED, - "short-code-end-user-id" => MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END_USER_DEFINED, - ) - ); - // display template with replaced placeholders - echo $l_obj_Template->getContent(); - } + "short-code-start-id" => MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START, + "short-code-end-id" => MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END, + "short-code-start-user-id" => MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START_USER_DEFINED, + "short-code-end-user-id" => MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END_USER_DEFINED, + ) + ); + // display template with replaced placeholders + echo $l_obj_Template->getContent(); + } - /** - * Displays all settings for 'I love Footnotes'. - * - * @author Stefan Herndler - * @since 1.5.0 - */ - public function Love() { - // options for the positioning of the reference container - $l_arr_Love = array( - "text-1" => sprintf(__('I %s %s', MCI_Footnotes_Config::C_STR_PLUGIN_NAME), MCI_Footnotes_Config::C_STR_LOVE_SYMBOL, MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME), - "text-2" => sprintf(__('this site uses the awesome %s Plugin', MCI_Footnotes_Config::C_STR_PLUGIN_NAME), MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME), - "text-3" => sprintf(__('extra smooth %s', MCI_Footnotes_Config::C_STR_PLUGIN_NAME), MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME), - "random" => __('random text', MCI_Footnotes_Config::C_STR_PLUGIN_NAME), - "no" => sprintf(__("Don't display a %s %s text in my footer.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME, MCI_Footnotes_Config::C_STR_LOVE_SYMBOL) - ); + /** + * Displays all settings for 'I love Footnotes'. + * + * @author Stefan Herndler + * @since 1.5.0 + */ + public function Love() { + // options for the positioning of the reference container + $l_arr_Love = array( + "text-1" => sprintf(__('I %s %s', MCI_Footnotes_Config::C_STR_PLUGIN_NAME), MCI_Footnotes_Config::C_STR_LOVE_SYMBOL, MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME), + "text-2" => sprintf(__('this site uses the awesome %s Plugin', MCI_Footnotes_Config::C_STR_PLUGIN_NAME), MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME), + "text-3" => sprintf(__('extra smooth %s', MCI_Footnotes_Config::C_STR_PLUGIN_NAME), MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME), + "random" => __('random text', MCI_Footnotes_Config::C_STR_PLUGIN_NAME), + "no" => sprintf(__("Don't display a %s %s text in my footer.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME, MCI_Footnotes_Config::C_STR_LOVE_SYMBOL) + ); - // load template file - $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "settings-love"); - // replace all placeholders - $l_obj_Template->replace( - array( - "label-love" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_LOVE, sprintf(__("Tell the world you're using %s", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME)), - "love" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_LOVE, $l_arr_Love), + // load template file + $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "settings-love"); + // replace all placeholders + $l_obj_Template->replace( + array( + "label-love" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_LOVE, sprintf(__("Tell the world you're using %s", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME)), + "love" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_LOVE, $l_arr_Love), - "label-no-love" => $this->addText(sprintf(__("Don't tell the world you're using %s on specific pages by adding the following short code:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME)), - "no-love" => $this->addText(MCI_Footnotes_Config::C_STR_NO_LOVE_SLUG) - ) - ); - // display template with replaced placeholders - echo $l_obj_Template->getContent(); - } + "label-no-love" => $this->addText(sprintf(__("Don't tell the world you're using %s on specific pages by adding the following short code:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME)), + "no-love" => $this->addText(MCI_Footnotes_Config::C_STR_NO_LOVE_SLUG) + ) + ); + // display template with replaced placeholders + echo $l_obj_Template->getContent(); + } - /** - * Displays all settings that are not grouped in special meta boxes. - * - * @author Stefan Herndler - * @since 1.5.0 - */ - public function Other() { - // options for the Footnotes to be replaced in excerpt - $l_arr_Enabled = array( - "yes" => __("Yes", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), - "no" => __("No", MCI_Footnotes_Config::C_STR_PLUGIN_NAME) - ); + /** + * Displays all settings that are not grouped in special meta boxes. + * + * @author Stefan Herndler + * @since 1.5.0 + */ + public function Other() { + // options for the Footnotes to be replaced in excerpt + $l_arr_Enabled = array( + "yes" => __("Yes", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), + "no" => __("No", MCI_Footnotes_Config::C_STR_PLUGIN_NAME) + ); - // load template file - $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "settings-other"); - // replace all placeholders - $l_obj_Template->replace( - array( - "label-excerpt" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_IN_EXCERPT, __("Allow footnotes on Summarized Posts", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), - "excerpt" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_IN_EXCERPT, $l_arr_Enabled), + // load template file + $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "settings-other"); + // replace all placeholders + $l_obj_Template->replace( + array( + "label-excerpt" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_IN_EXCERPT, __("Allow footnotes on Summarized Posts", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), + "excerpt" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_IN_EXCERPT, $l_arr_Enabled), "label-expert-mode" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_EXPERT_MODE, __("Enable the Expert mode", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), "expert-mode" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_EXPERT_MODE, $l_arr_Enabled) - ) - ); - // display template with replaced placeholders - echo $l_obj_Template->getContent(); - } + ) + ); + // display template with replaced placeholders + echo $l_obj_Template->getContent(); + } - /** - * Displays all settings for the footnotes Superscript. - * - * @author Stefan Herndler - * @since 1.5.0 - */ - public function Superscript() { - // load template file - $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "customize-superscript"); - // replace all placeholders - $l_obj_Template->replace( - array( - "label-before" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_STYLING_BEFORE, __("Before Footnotes index", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), - "before" => $this->addTextBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_STYLING_BEFORE), + /** + * Displays all settings for the footnotes Superscript. + * + * @author Stefan Herndler + * @since 1.5.0 + */ + public function Superscript() { + // load template file + $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "customize-superscript"); + // replace all placeholders + $l_obj_Template->replace( + array( + "label-before" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_STYLING_BEFORE, __("Before Footnotes index", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), + "before" => $this->addTextBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_STYLING_BEFORE), - "label-after" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_STYLING_AFTER, __("After Footnotes index", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), - "after" => $this->addTextBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_STYLING_AFTER) - ) - ); - // display template with replaced placeholders - echo $l_obj_Template->getContent(); - } + "label-after" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_STYLING_AFTER, __("After Footnotes index", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), + "after" => $this->addTextBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_STYLING_AFTER) + ) + ); + // display template with replaced placeholders + echo $l_obj_Template->getContent(); + } - /** - * Displays all settings for the footnotes mouse-over box. - * - * @author Stefan Herndler - * @since 1.5.2 - */ - public function MouseOverBox() { - // options for the Footnotes to be replaced in excerpt - $l_arr_Enabled = array( - "yes" => __("Yes", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), - "no" => __("No", MCI_Footnotes_Config::C_STR_PLUGIN_NAME) - ); - // options for the Mouse-over box position - $l_arr_Position = array( - "top left" => __("top left", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), - "top center" => __("top center", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), - "top right" => __("top right", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), - "center right" => __("center right", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), - "bottom right" => __("bottom right", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), - "bottom center" => __("bottom center", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), - "bottom left" => __("bottom left", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), - "center left" => __("center left", MCI_Footnotes_Config::C_STR_PLUGIN_NAME) - ); - // load template file - $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "customize-mouse-over-box"); - // replace all placeholders - $l_obj_Template->replace( - array( - "label-enable" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ENABLED, __("Enable the mouse-over box", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), - "enable" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ENABLED, $l_arr_Enabled), + /** + * Displays all settings for the footnotes mouse-over box. + * + * @author Stefan Herndler + * @since 1.5.2 + */ + public function MouseOverBox() { + // options for the Footnotes to be replaced in excerpt + $l_arr_Enabled = array( + "yes" => __("Yes", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), + "no" => __("No", MCI_Footnotes_Config::C_STR_PLUGIN_NAME) + ); + // options for the Mouse-over box position + $l_arr_Position = array( + "top left" => __("top left", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), + "top center" => __("top center", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), + "top right" => __("top right", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), + "center right" => __("center right", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), + "bottom right" => __("bottom right", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), + "bottom center" => __("bottom center", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), + "bottom left" => __("bottom left", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), + "center left" => __("center left", MCI_Footnotes_Config::C_STR_PLUGIN_NAME) + ); + // load template file + $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "customize-mouse-over-box"); + // replace all placeholders + $l_obj_Template->replace( + array( + "label-enable" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ENABLED, __("Enable the mouse-over box", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), + "enable" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ENABLED, $l_arr_Enabled), "label-activate-excerpt" => $this->addLabel(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_ENABLED, __("Display only an excerpt", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), "activate-excerpt" => $this->addSelectBox(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_ENABLED, $l_arr_Enabled), @@ -315,18 +315,18 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine { "label-excerpt-length" => $this->addLabel(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_LENGTH, __("Maximum characters for the excerpt", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), "excerpt-length" => $this->addTextBox(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_LENGTH), - "label-position" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_POSITION, __("Position", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), - "position" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_POSITION, $l_arr_Position), + "label-position" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_POSITION, __("Position", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), + "position" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_POSITION, $l_arr_Position), - "label-offset-x" => $this->addLabel(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_X, __("Offset X (px)", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), - "offset-x" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_X, -50, 50), - "notice-offset-x" => __("Offset (X axis) in px (may be negative)", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), + "label-offset-x" => $this->addLabel(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_X, __("Offset X (px)", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), + "offset-x" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_X, -50, 50), + "notice-offset-x" => __("Offset (X axis) in px (may be negative)", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), - "label-offset-y" => $this->addLabel(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_Y, __("Offset Y (px)", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), - "offset-y" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_Y, -50, 50), - "notice-offset-y" => __("Offset (Y axis) in px (may be negative)", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), + "label-offset-y" => $this->addLabel(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_Y, __("Offset Y (px)", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), + "offset-y" => $this->addNumBox(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_Y, -50, 50), + "notice-offset-y" => __("Offset (Y axis) in px (may be negative)", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), - "label-color" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_COLOR, __("Color", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), + "label-color" => $this->addLabel(MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_COLOR, __("Color", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), "color" => $this->addColorSelection(MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_COLOR), "notice-color" => __("Empty color will use the default color defined by your current theme.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), @@ -354,72 +354,45 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine { "box-shadow-color" => $this->addColorSelection(MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_SHADOW_COLOR), "notice-box-shadow-color" => __("Empty color will use the default box shadow defined by your current theme.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), - ) - ); - // display template with replaced placeholders - echo $l_obj_Template->getContent(); - } + ) + ); + // display template with replaced placeholders + echo $l_obj_Template->getContent(); + } - /** - * Displays all settings for the hyperlink arrow. - * - * @author Stefan Herndler - * @since 1.5.0 - */ - public function HyperlinkArrow() { - // load template file - $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "customize-hyperlink-arrow"); - // replace all placeholders - $l_obj_Template->replace( - array( - "label-symbol" => $this->addLabel(MCI_Footnotes_Settings::C_STR_HYPERLINK_ARROW, __("Hyperlink symbol", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), - "symbol" => $this->addSelectBox(MCI_Footnotes_Settings::C_STR_HYPERLINK_ARROW, MCI_Footnotes_Convert::getArrow()), + /** + * Displays the custom css box. + * + * @author Stefan Herndler + * @since 1.5.0 + */ + public function CustomCSS() { + // load template file + $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "customize-css"); + // replace all placeholders + $l_obj_Template->replace( + array( + "label-css" => $this->addLabel(MCI_Footnotes_Settings::C_STR_CUSTOM_CSS, __("Add custom CSS", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), + "css" => $this->addTextArea(MCI_Footnotes_Settings::C_STR_CUSTOM_CSS), - "label-user-defined" => $this->addLabel(MCI_Footnotes_Settings::C_STR_HYPERLINK_ARROW_USER_DEFINED, __("or enter a user defined symbol", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), - "user-defined" => $this->addTextBox(MCI_Footnotes_Settings::C_STR_HYPERLINK_ARROW_USER_DEFINED), - "comment" => __("if set it overrides the hyperlink symbol above", MCI_Footnotes_Config::C_STR_PLUGIN_NAME) - ) - ); - // display template with replaced placeholders - echo $l_obj_Template->getContent(); - } + "headline" => $this->addText(__("Available CSS classes to customize the footnotes and the reference container", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), - /** - * Displays the custom css box. - * - * @author Stefan Herndler - * @since 1.5.0 - */ - public function CustomCSS() { - // load template file - $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "customize-css"); - // replace all placeholders - $l_obj_Template->replace( - array( - "label-css" => $this->addLabel(MCI_Footnotes_Settings::C_STR_CUSTOM_CSS, __("Add custom CSS", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), - "css" => $this->addTextArea(MCI_Footnotes_Settings::C_STR_CUSTOM_CSS), + "label-class-1" => ".footnote_plugin_tooltip_text", + "class-1" => $this->addText(__("superscript, Footnotes index", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), - "headline" => $this->addText(__("Available CSS classes to customize the footnotes and the reference container", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), + "label-class-2" => ".footnote_tooltip", + "class-2" => $this->addText(__("mouse-over box, tooltip for each superscript", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), - "label-class-1" => ".footnote_plugin_tooltip_text", - "class-1" => $this->addText(__("superscript, Footnotes index", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), + "label-class-3" => ".footnote_plugin_index", + "class-3" => $this->addText(__("1st column of the Reference Container, Footnotes index", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), - "label-class-2" => ".footnote_tooltip", - "class-2" => $this->addText(__("mouse-over box, tooltip for each superscript", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), - - "label-class-3" => ".footnote_plugin_index", - "class-3" => $this->addText(__("1st column of the Reference Container, Footnotes index", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), - - "label-class-4" => ".footnote_plugin_link", - "class-4" => $this->addText(__("2nd column of the Reference Container, Arrow / Hyperlink", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)), - - "label-class-5" => ".footnote_plugin_text", - "class-5" => $this->addText(__("3rd column of the Reference Container, Footnote text", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)) - ) - ); - // display template with replaced placeholders - echo $l_obj_Template->getContent(); - } + "label-class-4" => ".footnote_plugin_text", + "class-4" => $this->addText(__("2nd column of the Reference Container, Footnote text", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)) + ) + ); + // display template with replaced placeholders + echo $l_obj_Template->getContent(); + } /** * Displays available Hooks to look for Footnote short codes. @@ -466,71 +439,71 @@ class MCI_Footnotes_Layout_Settings extends MCI_Footnotes_LayoutEngine { echo $l_obj_Template->getContent(); } - /** - * Displays a short introduction of the Plugin. - * - * @author Stefan Herndler - * @since 1.5.0 - */ - public function Help() { - global $g_obj_MCI_Footnotes; - // load footnotes starting and end tag - $l_arr_Footnote_StartingTag = $this->LoadSetting(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START); - $l_arr_Footnote_EndingTag = $this->LoadSetting(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END); + /** + * Displays a short introduction of the Plugin. + * + * @author Stefan Herndler + * @since 1.5.0 + */ + public function Help() { + global $g_obj_MCI_Footnotes; + // load footnotes starting and end tag + $l_arr_Footnote_StartingTag = $this->LoadSetting(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START); + $l_arr_Footnote_EndingTag = $this->LoadSetting(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END); - if ($l_arr_Footnote_StartingTag["value"] == "userdefined" || $l_arr_Footnote_EndingTag["value"] == "userdefined") { - // load user defined starting and end tag - $l_arr_Footnote_StartingTag = $this->LoadSetting(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START_USER_DEFINED); - $l_arr_Footnote_EndingTag = $this->LoadSetting(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END_USER_DEFINED); - } - $l_str_Example = "Hello" . $l_arr_Footnote_StartingTag["value"] . - "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,". - " sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum.". - " Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet,". - " consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.". - " At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet." - . $l_arr_Footnote_EndingTag["value"] . " World!"; + if ($l_arr_Footnote_StartingTag["value"] == "userdefined" || $l_arr_Footnote_EndingTag["value"] == "userdefined") { + // load user defined starting and end tag + $l_arr_Footnote_StartingTag = $this->LoadSetting(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START_USER_DEFINED); + $l_arr_Footnote_EndingTag = $this->LoadSetting(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END_USER_DEFINED); + } + $l_str_Example = "Hello" . $l_arr_Footnote_StartingTag["value"] . + "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,". + " sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum.". + " Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet,". + " consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.". + " At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet." + . $l_arr_Footnote_EndingTag["value"] . " World!"; - // load template file - $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "how-to-help"); - // replace all placeholders - $l_obj_Template->replace( - array( - "label-start" => __("Start your footnote with the following short code:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), - "start" => $l_arr_Footnote_StartingTag["value"], + // load template file + $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "how-to-help"); + // replace all placeholders + $l_obj_Template->replace( + array( + "label-start" => __("Start your footnote with the following short code:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), + "start" => $l_arr_Footnote_StartingTag["value"], - "label-end" => __("...and end your footnote with this short code:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), - "end" => $l_arr_Footnote_EndingTag["value"], + "label-end" => __("...and end your footnote with this short code:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), + "end" => $l_arr_Footnote_EndingTag["value"], - "example-code" => $l_str_Example, - "example-string" => "
" . __("will be displayed as:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), - "example" => $g_obj_MCI_Footnotes->a_obj_Task->exec($l_str_Example, true), + "example-code" => $l_str_Example, + "example-string" => "
" . __("will be displayed as:", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), + "example" => $g_obj_MCI_Footnotes->a_obj_Task->exec($l_str_Example, true), - "information" => sprintf(__("For further information please check out our %ssupport forum%s on WordPress.org.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), '', '') - ) - ); - // call wp_head function to get the Styling of the mouse-over box - $g_obj_MCI_Footnotes->a_obj_Task->wp_head(); - // display template with replaced placeholders - echo $l_obj_Template->getContent(); - } + "information" => sprintf(__("For further information please check out our %ssupport forum%s on WordPress.org.", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), '', '') + ) + ); + // call wp_head function to get the Styling of the mouse-over box + $g_obj_MCI_Footnotes->a_obj_Task->wp_head(); + // display template with replaced placeholders + echo $l_obj_Template->getContent(); + } - /** - * Displays all Donate button to support the developers. - * - * @author Stefan Herndler - * @since 1.5.0 - */ - public function Donate() { - // load template file - $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "how-to-donate"); - // replace all placeholders - $l_obj_Template->replace( - array( - "caption" => __('Donate now',MCI_Footnotes_Config::C_STR_PLUGIN_NAME) - ) - ); - // display template with replaced placeholders - echo $l_obj_Template->getContent(); - } -} \ No newline at end of file + /** + * Displays all Donate button to support the developers. + * + * @author Stefan Herndler + * @since 1.5.0 + */ + public function Donate() { + // load template file + $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "how-to-donate"); + // replace all placeholders + $l_obj_Template->replace( + array( + "caption" => __('Donate now',MCI_Footnotes_Config::C_STR_PLUGIN_NAME) + ) + ); + // display template with replaced placeholders + echo $l_obj_Template->getContent(); + } +} diff --git a/class/init.php b/class/init.php index 9187fdd..e3cccf2 100644 --- a/class/init.php +++ b/class/init.php @@ -6,7 +6,8 @@ * @author Stefan Herndler * @since 1.5.0 12.09.14 10:56 */ - +// Added jQueryUI on 2020-10-26T1907+0100 +// Following @vonpiernik /** * Entry point of the Plugin. Loads the Dashboard and executes the Task. @@ -90,9 +91,17 @@ class MCI_Footnotes { * @since 1.5.0 */ public function registerPublic() { + + // Add jQueryUI following @vonpiernik : + wp_register_script( 'jQueryUI', 'https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js', null, null, true ); + wp_enqueue_script( 'jQueryUI' ); + + wp_enqueue_style('mci-footnotes-css-public', plugins_url('../css/public.css', __FILE__)); // add the jQuery plugin (already registered by WordPress) wp_enqueue_script('jquery'); - wp_enqueue_script('mci-footnotes-js-jquery-tools', plugins_url('../js/jquery.tools.min.js', __FILE__)); + + // Finish adding jQueryUI: + wp_enqueue_script('mci-footnotes-js-jquery-tools', plugins_url('../js/jquery.tools.min.js', __FILE__), ['jQueryUI']); } } diff --git a/class/language.php b/class/language.php index f115e40..9ec44b5 100644 --- a/class/language.php +++ b/class/language.php @@ -31,7 +31,12 @@ class MCI_Footnotes_Language { */ public static function loadTextDomain() { // language file with localization exists - if (self::load(apply_filters('plugin_locale', get_locale()))) { + if (self::load(apply_filters('plugin_locale', get_locale(), ''))) { + // added 3rd (empty) parameter as a PHP-related bug fix thanks to MatKus (@matkus) in + // + // + // "Fatal error: Uncaught ArgumentCountError: Too few arguments […]" + // 2020-10-26T1609+0100 return; } // fallback to english @@ -50,4 +55,4 @@ class MCI_Footnotes_Language { return load_textdomain(MCI_Footnotes_Config::C_STR_PLUGIN_NAME, dirname(__FILE__) . "/../languages/" . $p_str_LanguageCode . '.mo'); } -} \ No newline at end of file +} diff --git a/class/task.php b/class/task.php index fb12af8..2834743 100644 --- a/class/task.php +++ b/class/task.php @@ -6,7 +6,19 @@ * @author Stefan Herndler * @since 1.5.0 */ - +/* +Customization: 2020-06-23T0613+0200 custom styles, fixed print output [now in public.css] +Customization: 2020-09-09T2140+0200 raised scroll level, shorter scroll time [reference-container.html] +Customization: 2020-09-09T2140+0200 changed parameters off dashboard [tooltip.html] +Debugging: 2020-09-09T2140+0200 fixed missing or wrong links #0# +Usability: 2020-09-09T2140+0200 voided $a_str_Prefix #1# +Usability: 2020-09-09T2140+0200 added line breaks #2# +Translation: 2020-09-10T2104+0200 fix infobox text and missing setting #0# +Upgrade v1.6.5: 2020-10-23T0252+0200 #3# +Last modified: 2020-10-23T0611+0200 +*/ +// If called directly, abort: +defined( 'ABSPATH' ) or die; /** * Looks for Footnotes short codes and replaces them. Also displays the Reference Container. @@ -16,45 +28,45 @@ */ class MCI_Footnotes_Task { - /** - * Contains all footnotes found on current public page. - * - * @author Stefan Herndler - * @since 1.5.0 - * @var array - */ - public static $a_arr_Footnotes = array(); + /** + * Contains all footnotes found on current public page. + * + * @author Stefan Herndler + * @since 1.5.0 + * @var array + */ + public static $a_arr_Footnotes = array(); - /** - * Flag if the display of 'LOVE FOOTNOTES' is allowed on the current public page. - * - * @author Stefan Herndler - * @since 1.5.0 - * @var bool - */ - public static $a_bool_AllowLoveMe = true; + /** + * Flag if the display of 'LOVE FOOTNOTES' is allowed on the current public page. + * + * @author Stefan Herndler + * @since 1.5.0 + * @var bool + */ + public static $a_bool_AllowLoveMe = true; - /** - * Prefix for the Footnote html element ID. - * - * @author Stefan Herndler - * @since 1.5.8 - * @var string - */ - public static $a_str_Prefix = ""; + /** + * Prefix for the Footnote html element ID. + * + * @author Stefan Herndler + * @since 1.5.8 + * @var string + */ + public static $a_str_Prefix = ""; - /** - * Register WordPress Hooks to replace Footnotes in the content of a public page. - * - * @author Stefan Herndler - * @since 1.5.0 - */ - public function registerHooks() { - // append custom css to the header - add_filter('wp_head', array($this, "wp_head"), PHP_INT_MAX); + /** + * Register WordPress Hooks to replace Footnotes in the content of a public page. + * + * @author Stefan Herndler + * @since 1.5.0 + */ + public function registerHooks() { + // append custom css to the header + add_filter('wp_head', array($this, "wp_head"), PHP_INT_MAX); - // append the love and share me slug to the footer - add_filter('wp_footer', array($this, "wp_footer"), PHP_INT_MAX); + // append the love and share me slug to the footer + add_filter('wp_footer', array($this, "wp_footer"), PHP_INT_MAX); if (MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_EXPERT_LOOKUP_THE_TITLE))) { add_filter('the_title', array($this, "the_title"), PHP_INT_MAX); @@ -77,24 +89,24 @@ class MCI_Footnotes_Task { // reset stored footnotes when displaying the header self::$a_arr_Footnotes = array(); self::$a_bool_AllowLoveMe = true; - } + } - /** - * Outputs the custom css to the header of the public page. - * - * @author Stefan Herndler - * @since 1.5.0 - */ - public function wp_head() { + /** + * Outputs the custom css to the header of the public page. + * + * @author Stefan Herndler + * @since 1.5.0 + */ + public function wp_head() { $l_str_Color = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_COLOR); $l_str_Background = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_BACKGROUND); $l_int_BorderWidth = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_WIDTH); $l_str_BorderColor = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_BORDER_COLOR); $l_int_BorderRadius = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_BORDER_RADIUS); $l_int_MaxWidth = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_MAX_WIDTH); - $l_str_BoxShadowColor = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_SHADOW_COLOR); - ?> - - get(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION) == "footer") { echo $this->ReferenceContainer(); } - // get setting for love and share this plugin - $l_str_LoveMeIndex = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_LOVE); - // check if the admin allows to add a link to the footer - if (empty($l_str_LoveMeIndex) || strtolower($l_str_LoveMeIndex) == "no" || !self::$a_bool_AllowLoveMe) { - return; - } - // set a hyperlink to the word "footnotes" in the Love slug - $l_str_LinkedName = sprintf('%s',MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME); - // get random love me text - if (strtolower($l_str_LoveMeIndex) == "random") { - $l_str_LoveMeIndex = "text-" . rand(1,3); - } - switch ($l_str_LoveMeIndex) { - case "text-1": - $l_str_LoveMeText = sprintf(__('I %s %s', MCI_Footnotes_Config::C_STR_PLUGIN_NAME), MCI_Footnotes_Config::C_STR_LOVE_SYMBOL, $l_str_LinkedName); - break; - case "text-2": - $l_str_LoveMeText = sprintf(__('this site uses the awesome %s Plugin', MCI_Footnotes_Config::C_STR_PLUGIN_NAME), $l_str_LinkedName); - break; - case "text-3": - default: - $l_str_LoveMeText = sprintf(__('extra smooth %s', MCI_Footnotes_Config::C_STR_PLUGIN_NAME), $l_str_LinkedName); - break; - } - echo sprintf('
%s
', $l_str_LoveMeText); - } + // get setting for love and share this plugin + $l_str_LoveMeIndex = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_LOVE); + // check if the admin allows to add a link to the footer + if (empty($l_str_LoveMeIndex) || strtolower($l_str_LoveMeIndex) == "no" || !self::$a_bool_AllowLoveMe) { + return; + } + // set a hyperlink to the word "footnotes" in the Love slug + $l_str_LinkedName = sprintf('%s',MCI_Footnotes_Config::C_STR_PLUGIN_PUBLIC_NAME); + // get random love me text + if (strtolower($l_str_LoveMeIndex) == "random") { + $l_str_LoveMeIndex = "text-" . rand(1,3); + } + switch ($l_str_LoveMeIndex) { + case "text-1": + $l_str_LoveMeText = sprintf(__('I %s %s', MCI_Footnotes_Config::C_STR_PLUGIN_NAME), MCI_Footnotes_Config::C_STR_LOVE_SYMBOL, $l_str_LinkedName); + break; + case "text-2": + $l_str_LoveMeText = sprintf(__('this site uses the awesome %s Plugin', MCI_Footnotes_Config::C_STR_PLUGIN_NAME), $l_str_LinkedName); + break; + case "text-3": + default: + $l_str_LoveMeText = sprintf(__('extra smooth %s', MCI_Footnotes_Config::C_STR_PLUGIN_NAME), $l_str_LinkedName); + break; + } + echo sprintf('
%s
', $l_str_LoveMeText); + } /** * Replaces footnotes in the post/page title. @@ -177,30 +189,30 @@ class MCI_Footnotes_Task { return $this->exec($p_str_Content, false); } - /** - * Replaces footnotes in the content of the current page/post. - * - * @author Stefan Herndler - * @since 1.5.0 - * @param string $p_str_Content Page/Post content. - * @return string Content with replaced footnotes. - */ - public function the_content($p_str_Content) { - // appends the reference container if set to "post_end" - return $this->exec($p_str_Content, MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION) == "post_end" ? true : false); - } + /** + * Replaces footnotes in the content of the current page/post. + * + * @author Stefan Herndler + * @since 1.5.0 + * @param string $p_str_Content Page/Post content. + * @return string Content with replaced footnotes. + */ + public function the_content($p_str_Content) { + // appends the reference container if set to "post_end" + return $this->exec($p_str_Content, MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION) == "post_end" ? true : false); + } - /** - * Replaces footnotes in the excerpt of the current page/post. - * - * @author Stefan Herndler - * @since 1.5.0 - * @param string $p_str_Content Page/Post content. - * @return string Content with replaced footnotes. - */ - public function the_excerpt($p_str_Content) { - return $this->exec($p_str_Content, false, !MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_IN_EXCERPT))); - } + /** + * Replaces footnotes in the excerpt of the current page/post. + * + * @author Stefan Herndler + * @since 1.5.0 + * @param string $p_str_Content Page/Post content. + * @return string Content with replaced footnotes. + */ + public function the_excerpt($p_str_Content) { + return $this->exec($p_str_Content, false, !MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_IN_EXCERPT))); + } /** * Replaces footnotes in the widget title. @@ -215,18 +227,18 @@ class MCI_Footnotes_Task { return $this->exec($p_str_Content, false); } - /** - * Replaces footnotes in the content of the current widget. - * - * @author Stefan Herndler - * @since 1.5.0 - * @param string $p_str_Content Widget content. - * @return string Content with replaced footnotes. - */ - public function widget_text($p_str_Content) { - // appends the reference container if set to "post_end" - return $this->exec($p_str_Content, MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION) == "post_end" ? true : false); - } + /** + * Replaces footnotes in the content of the current widget. + * + * @author Stefan Herndler + * @since 1.5.0 + * @param string $p_str_Content Widget content. + * @return string Content with replaced footnotes. + */ + public function widget_text($p_str_Content) { + // appends the reference container if set to "post_end" + return $this->exec($p_str_Content, MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_POSITION) == "post_end" ? true : false); + } /** * Replaces footnotes in each Content var of the current Post object. @@ -263,105 +275,106 @@ class MCI_Footnotes_Task { return $p_obj_Post; } - /** - * Replaces all footnotes that occur in the given content. - * - * @author Stefan Herndler - * @since 1.5.0 - * @param string $p_str_Content Any string that may contain footnotes to be replaced. - * @param bool $p_bool_OutputReferences Appends the Reference Container to the output if set to true, default true. - * @param bool $p_bool_HideFootnotesText Hide footnotes found in the string. - * @return string - */ - public function exec($p_str_Content, $p_bool_OutputReferences = false, $p_bool_HideFootnotesText = false) { - // replace all footnotes in the content, settings are converted to html characters - $p_str_Content = $this->search($p_str_Content, true, $p_bool_HideFootnotesText); - // replace all footnotes in the content, settings are NOT converted to html characters - $p_str_Content = $this->search($p_str_Content, false, $p_bool_HideFootnotesText); + /** + * Replaces all footnotes that occur in the given content. + * + * @author Stefan Herndler + * @since 1.5.0 + * @param string $p_str_Content Any string that may contain footnotes to be replaced. + * @param bool $p_bool_OutputReferences Appends the Reference Container to the output if set to true, default true. + * @param bool $p_bool_HideFootnotesText Hide footnotes found in the string. + * @return string + */ + public function exec($p_str_Content, $p_bool_OutputReferences = false, $p_bool_HideFootnotesText = false) { + // replace all footnotes in the content, settings are converted to html characters + $p_str_Content = $this->search($p_str_Content, true, $p_bool_HideFootnotesText); + // replace all footnotes in the content, settings are NOT converted to html characters + $p_str_Content = $this->search($p_str_Content, false, $p_bool_HideFootnotesText); - // append the reference container - if ($p_bool_OutputReferences) { - $p_str_Content = $p_str_Content . $this->ReferenceContainer(); - } + // append the reference container + if ($p_bool_OutputReferences) { + $p_str_Content = $p_str_Content . $this->ReferenceContainer(); + } - // take a look if the LOVE ME slug should NOT be displayed on this page/post, remove the short code if found - if (strpos($p_str_Content, MCI_Footnotes_Config::C_STR_NO_LOVE_SLUG) !== false) { - self::$a_bool_AllowLoveMe = false; - $p_str_Content = str_replace(MCI_Footnotes_Config::C_STR_NO_LOVE_SLUG, "", $p_str_Content); - } - // return the content with replaced footnotes and optional reference container append - return $p_str_Content; - } + // take a look if the LOVE ME slug should NOT be displayed on this page/post, remove the short code if found + if (strpos($p_str_Content, MCI_Footnotes_Config::C_STR_NO_LOVE_SLUG) !== false) { + self::$a_bool_AllowLoveMe = false; + $p_str_Content = str_replace(MCI_Footnotes_Config::C_STR_NO_LOVE_SLUG, "", $p_str_Content); + } + // return the content with replaced footnotes and optional reference container append + return $p_str_Content; + } - /** - * Replaces all footnotes in the given content and appends them to the static property. - * - * @author Stefan Herndler - * @since 1.5.0 - * @param string $p_str_Content Content to be searched for footnotes. - * @param bool $p_bool_ConvertHtmlChars html encode settings, default true. - * @param bool $p_bool_HideFootnotesText Hide footnotes found in the string. - * @return string - */ - public function search($p_str_Content, $p_bool_ConvertHtmlChars, $p_bool_HideFootnotesText) { - // contains the index for the next footnote on this page - $l_int_FootnoteIndex = count(self::$a_arr_Footnotes) + 1; - // contains the starting position for the lookup of a footnote - $l_int_PosStart = 0; - // get start and end tag for the footnotes short code - $l_str_StartingTag = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START); - $l_str_EndingTag = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END); - if ($l_str_StartingTag == "userdefined" || $l_str_EndingTag == "userdefined") { - $l_str_StartingTag = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START_USER_DEFINED); - $l_str_EndingTag = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END_USER_DEFINED); - } - // decode html special chars - if ($p_bool_ConvertHtmlChars) { - $l_str_StartingTag = htmlspecialchars($l_str_StartingTag); - $l_str_EndingTag = htmlspecialchars($l_str_EndingTag); - } - // if footnotes short code is empty, return the content without changes - if (empty($l_str_StartingTag) || empty($l_str_EndingTag)) { - return $p_str_Content; - } + /** + * Replaces all footnotes in the given content and appends them to the static property. + * + * @author Stefan Herndler + * @since 1.5.0 + * @param string $p_str_Content Content to be searched for footnotes. + * @param bool $p_bool_ConvertHtmlChars html encode settings, default true. + * @param bool $p_bool_HideFootnotesText Hide footnotes found in the string. + * @return string + */ + public function search($p_str_Content, $p_bool_ConvertHtmlChars, $p_bool_HideFootnotesText) { + // contains the index for the next footnote on this page + $l_int_FootnoteIndex = count(self::$a_arr_Footnotes) + 1; + // contains the starting position for the lookup of a footnote + $l_int_PosStart = 0; + // get start and end tag for the footnotes short code + $l_str_StartingTag = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START); + $l_str_EndingTag = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END); + if ($l_str_StartingTag == "userdefined" || $l_str_EndingTag == "userdefined") { + $l_str_StartingTag = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_START_USER_DEFINED); + $l_str_EndingTag = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_SHORT_CODE_END_USER_DEFINED); + } + // decode html special chars + if ($p_bool_ConvertHtmlChars) { + $l_str_StartingTag = htmlspecialchars($l_str_StartingTag); + $l_str_EndingTag = htmlspecialchars($l_str_EndingTag); + } + // if footnotes short code is empty, return the content without changes + if (empty($l_str_StartingTag) || empty($l_str_EndingTag)) { + return $p_str_Content; + } - if (!$p_bool_HideFootnotesText) { - // load template file - $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_PUBLIC, "footnote"); - $l_obj_TemplateTooltip = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_PUBLIC, "tooltip"); - } else { - $l_obj_Template = null; - $l_obj_TemplateTooltip = null; - } + if (!$p_bool_HideFootnotesText) { + // load template file + $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_PUBLIC, "footnote"); + $l_obj_TemplateTooltip = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_PUBLIC, "tooltip"); + } else { + $l_obj_Template = null; + $l_obj_TemplateTooltip = null; + } - // search footnotes short codes in the content - do { - // get first occurrence of the footnote short code [start] - $i_int_len_Content = strlen($p_str_Content); - if ($l_int_PosStart > $i_int_len_Content) $l_int_PosStart = $i_int_len_Content; - $l_int_PosStart = strpos($p_str_Content, $l_str_StartingTag, $l_int_PosStart); - // no short code found, stop here - if ($l_int_PosStart === false) { - break; - } - // get first occurrence of a footnote short code [end] - $l_int_PosEnd = strpos($p_str_Content, $l_str_EndingTag, $l_int_PosStart); - // no short code found, stop here - if ($l_int_PosEnd === false) { - break; - } - // calculate the length of the footnote - $l_int_Length = $l_int_PosEnd - $l_int_PosStart; - // get footnote text - $l_str_FootnoteText = substr($p_str_Content, $l_int_PosStart + strlen($l_str_StartingTag), $l_int_Length - strlen($l_str_StartingTag)); - // Text to be displayed instead of the footnote - $l_str_FootnoteReplaceText = ""; - // display the footnote as mouse-over box - if (!$p_bool_HideFootnotesText) { - $l_str_Index = MCI_Footnotes_Convert::Index($l_int_FootnoteIndex, MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE)); + // search footnotes short codes in the content + do { + // get first occurrence of the footnote short code [start] + $i_int_len_Content = strlen($p_str_Content); + // #3# upgrade v1.6.5: + if ($l_int_PosStart > $i_int_len_Content) $l_int_PosStart = $i_int_len_Content; + $l_int_PosStart = strpos($p_str_Content, $l_str_StartingTag, $l_int_PosStart); + // no short code found, stop here + if ($l_int_PosStart === false) { + break; + } + // get first occurrence of a footnote short code [end] + $l_int_PosEnd = strpos($p_str_Content, $l_str_EndingTag, $l_int_PosStart); + // no short code found, stop here + if ($l_int_PosEnd === false) { + break; + } + // calculate the length of the footnote + $l_int_Length = $l_int_PosEnd - $l_int_PosStart; + // get footnote text + $l_str_FootnoteText = substr($p_str_Content, $l_int_PosStart + strlen($l_str_StartingTag), $l_int_Length - strlen($l_str_StartingTag)); + // Text to be displayed instead of the footnote + $l_str_FootnoteReplaceText = ""; + // display the footnote as mouse-over box + if (!$p_bool_HideFootnotesText) { + $l_str_Index = MCI_Footnotes_Convert::Index($l_int_FootnoteIndex, MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE)); // display only an excerpt of the footnotes text if enabled - $l_str_ExcerptText = $l_str_FootnoteText; + $l_str_ExcerptText = $l_str_FootnoteText; $l_bool_EnableExcerpt = MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_ENABLED)); $l_int_MaxLength = intval(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_EXCERPT_LENGTH)); if ($l_bool_EnableExcerpt) { @@ -369,137 +382,148 @@ class MCI_Footnotes_Task { if (is_int($l_int_MaxLength) && strlen($l_str_DummyText) > $l_int_MaxLength) { $l_str_ExcerptText = substr($l_str_DummyText, 0, $l_int_MaxLength); $l_str_ExcerptText = substr($l_str_ExcerptText, 0, strrpos($l_str_ExcerptText, ' ')); - $l_str_ExcerptText .= " ..." . sprintf(__("%scontinue%s", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), '', ''); + // #0# + // col 48: replaced space with no-break space. + // col 54: replaced three dots with horizontal ellipsis (…): “use the single Unicode …, and not three dots” + // col 139: added class. + // col 162: added fragment id, or the footnote won’t work if JS is disabled. + // col 294: added the random prefix for consistency, even if disabled. + $l_str_ExcerptText .= ' … ' . sprintf(__("%scontinue%s", MCI_Footnotes_Config::C_STR_PLUGIN_NAME), '', ''); } } - // fill the footnotes template - $l_obj_Template->replace( - array( - "id" => self::$a_str_Prefix . $l_str_Index, - "index" => $l_str_Index, - "text" => MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ENABLED)) ? $l_str_ExcerptText : "", - "before" => MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_STYLING_BEFORE), - "after" => MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_STYLING_AFTER) - ) - ); - $l_str_FootnoteReplaceText = $l_obj_Template->getContent(); - // reset the template - $l_obj_Template->reload(); - if (MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ENABLED))) { - $l_int_OffsetY = intval(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_Y)); - $l_int_OffsetX = intval(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_X)); - $l_obj_TemplateTooltip->replace( - array( - "id" => self::$a_str_Prefix . $l_str_Index, - "position" => MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_POSITION), - "offset-y" => !empty($l_int_OffsetY) ? $l_int_OffsetY : 0, - "offset-x" => !empty($l_int_OffsetX) ? $l_int_OffsetX : 0 - ) - ); - $l_str_FootnoteReplaceText .= $l_obj_TemplateTooltip->getContent(); - $l_obj_TemplateTooltip->reload(); - } - } - // replace the footnote with the template - $p_str_Content = substr_replace($p_str_Content, $l_str_FootnoteReplaceText, $l_int_PosStart, $l_int_Length + strlen($l_str_EndingTag)); - // add footnote only if not empty - if (!empty($l_str_FootnoteText)) { - // set footnote to the output box at the end - self::$a_arr_Footnotes[] = $l_str_FootnoteText; - // increase footnote index - $l_int_FootnoteIndex++; - } - // add offset to the new starting position - $l_int_PosStart += $l_int_Length + strlen($l_str_EndingTag); - $l_int_PosStart = $l_int_Length + strlen($l_str_FootnoteReplaceText); - } while (true); + // fill the footnotes template + $l_obj_Template->replace( + array( + "id" => self::$a_str_Prefix . $l_str_Index, + "index" => $l_str_Index, + "text" => MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ENABLED)) ? $l_str_ExcerptText : "", + "before" => MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_STYLING_BEFORE), + "after" => MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_STYLING_AFTER) + ) + ); + $l_str_FootnoteReplaceText = $l_obj_Template->getContent(); + // reset the template + $l_obj_Template->reload(); + if (MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_FOOTNOTES_MOUSE_OVER_BOX_ENABLED))) { + $l_int_OffsetY = intval(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_Y)); + $l_int_OffsetX = intval(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_INT_FOOTNOTES_MOUSE_OVER_BOX_OFFSET_X)); + $l_obj_TemplateTooltip->replace( + array( + "id" => self::$a_str_Prefix . $l_str_Index, + "position" => MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_MOUSE_OVER_BOX_POSITION), + "offset-y" => !empty($l_int_OffsetY) ? $l_int_OffsetY : 0, + "offset-x" => !empty($l_int_OffsetX) ? $l_int_OffsetX : 0 + ) + ); + $l_str_FootnoteReplaceText .= $l_obj_TemplateTooltip->getContent(); + $l_obj_TemplateTooltip->reload(); + } + } + // replace the footnote with the template + $p_str_Content = substr_replace($p_str_Content, $l_str_FootnoteReplaceText, $l_int_PosStart, $l_int_Length + strlen($l_str_EndingTag)); + // add footnote only if not empty + if (!empty($l_str_FootnoteText)) { + // set footnote to the output box at the end + self::$a_arr_Footnotes[] = $l_str_FootnoteText; + // increase footnote index + $l_int_FootnoteIndex++; + } + // add offset to the new starting position + $l_int_PosStart += $l_int_Length + strlen($l_str_EndingTag); + $l_int_PosStart = $l_int_Length + strlen($l_str_FootnoteReplaceText); + } while (true); - // return content - return $p_str_Content; - } + // return content + return $p_str_Content; + } - /** - * Generates the reference container. - * - * @author Stefan Herndler - * @since 1.5.0 - * @return string - */ - public function ReferenceContainer() { - // no footnotes has been replaced on this page - if (empty(self::$a_arr_Footnotes)) { - return ""; - } - // get html arrow - $l_str_Arrow = MCI_Footnotes_Convert::getArrow(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_HYPERLINK_ARROW)); - // set html arrow to the first one if invalid index defined - if (is_array($l_str_Arrow)) { - $l_str_Arrow = MCI_Footnotes_Convert::getArrow(0); - } - // get user defined arrow - $l_str_ArrowUserDefined = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_HYPERLINK_ARROW_USER_DEFINED); - if (!empty($l_str_ArrowUserDefined)) { - $l_str_Arrow = $l_str_ArrowUserDefined; - } + /** + * Generates the reference container. + * + * @author Stefan Herndler + * @since 1.5.0 + * @return string + */ + public function ReferenceContainer() { + // no footnotes has been replaced on this page + if (empty(self::$a_arr_Footnotes)) { + return ""; + } + // get html arrow + $l_str_Arrow = MCI_Footnotes_Convert::getArrow(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_HYPERLINK_ARROW)); + // set html arrow to the first one if invalid index defined + if (is_array($l_str_Arrow)) { + $l_str_Arrow = MCI_Footnotes_Convert::getArrow(0); + } + // get user defined arrow + $l_str_ArrowUserDefined = MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_HYPERLINK_ARROW_USER_DEFINED); + if (!empty($l_str_ArrowUserDefined)) { + $l_str_Arrow = $l_str_ArrowUserDefined; + } - // load template file - $l_str_Body = ""; - $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_PUBLIC, "reference-container-body"); + // load template file + $l_str_Body = ""; + $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_PUBLIC, "reference-container-body"); - // loop through all footnotes found in the page - for ($l_str_Index = 0; $l_str_Index < count(self::$a_arr_Footnotes); $l_str_Index++) { - // get footnote text - $l_str_FootnoteText = self::$a_arr_Footnotes[$l_str_Index]; - // if footnote is empty, get to the next one - if (empty($l_str_FootnoteText)) { - continue; - } - // get footnote index - $l_str_FirstFootnoteIndex = ($l_str_Index + 1); - $l_str_FootnoteIndex = MCI_Footnotes_Convert::Index(($l_str_Index + 1), MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE)); + // loop through all footnotes found in the page + for ($l_str_Index = 0; $l_str_Index < count(self::$a_arr_Footnotes); $l_str_Index++) { + // get footnote text + $l_str_FootnoteText = self::$a_arr_Footnotes[$l_str_Index]; + // if footnote is empty, get to the next one + if (empty($l_str_FootnoteText)) { + continue; + } + // get footnote index + $l_str_FirstFootnoteIndex = ($l_str_Index + 1); + $l_str_FootnoteIndex = MCI_Footnotes_Convert::Index(($l_str_Index + 1), MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE)); - // check if it isn't the last footnote in the array - if ($l_str_FirstFootnoteIndex < count(self::$a_arr_Footnotes) && MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_COMBINE_IDENTICAL_FOOTNOTES))) { - // get all footnotes that I haven't passed yet - for ($l_str_CheckIndex = $l_str_FirstFootnoteIndex; $l_str_CheckIndex < count(self::$a_arr_Footnotes); $l_str_CheckIndex++) { - // check if a further footnote is the same as the actual one - if ($l_str_FootnoteText == self::$a_arr_Footnotes[$l_str_CheckIndex]) { - // set the further footnote as empty so it won't be displayed later - self::$a_arr_Footnotes[$l_str_CheckIndex] = ""; - // add the footnote index to the actual index - $l_str_FootnoteIndex .= ", " . MCI_Footnotes_Convert::Index(($l_str_CheckIndex + 1), MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE)); - } - } - } - // replace all placeholders in the template - $l_obj_Template->replace( - array( - "index" => $l_str_FootnoteIndex, - "id" => self::$a_str_Prefix . MCI_Footnotes_Convert::Index($l_str_FirstFootnoteIndex, MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE)), - "arrow" => $l_str_Arrow, - "text" => $l_str_FootnoteText - ) - ); - $l_str_Body .= $l_obj_Template->getContent(); - $l_obj_Template->reload(); - } + // check if it isn't the last footnote in the array + if ($l_str_FirstFootnoteIndex < count(self::$a_arr_Footnotes) && MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_COMBINE_IDENTICAL_FOOTNOTES))) { + // get all footnotes that I haven't passed yet + for ($l_str_CheckIndex = $l_str_FirstFootnoteIndex; $l_str_CheckIndex < count(self::$a_arr_Footnotes); $l_str_CheckIndex++) { + // check if a further footnote is the same as the actual one + if ($l_str_FootnoteText == self::$a_arr_Footnotes[$l_str_CheckIndex]) { + // set the further footnote as empty so it won't be displayed later + self::$a_arr_Footnotes[$l_str_CheckIndex] = ""; + // add the footnote index to the actual index + $l_str_FootnoteIndex .= ", " . MCI_Footnotes_Convert::Index(($l_str_CheckIndex + 1), MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE)); + } + } + } + // replace all placeholders in the template + $l_obj_Template->replace( + array( + "index" => $l_str_FootnoteIndex, + "id" => self::$a_str_Prefix . MCI_Footnotes_Convert::Index($l_str_FirstFootnoteIndex, MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_FOOTNOTES_COUNTER_STYLE)), + "arrow" => $l_str_Arrow, + "text" => $l_str_FootnoteText + ) + ); + // #2# added line breaks for source code legibility: + $footnote_item_temp = $l_obj_Template->getContent(); + $footnote_item_temp .= "\r\n\r\n"; + $l_str_Body .= $footnote_item_temp; + $l_obj_Template->reload(); + } - // load template file - $l_obj_TemplateContainer = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_PUBLIC, "reference-container"); - $l_obj_TemplateContainer->replace( - array( - "label" => MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_NAME), - "button-style" => !MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_COLLAPSE)) ? 'display: none;' : '', - "id" => "footnote_references_container", - "style" => MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_COLLAPSE)) ? 'display: none;' : '', - "content" => $l_str_Body - ) - ); + // load template file + $l_obj_TemplateContainer = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_PUBLIC, "reference-container"); + $l_obj_TemplateContainer->replace( + array( + "label" => MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_STR_REFERENCE_CONTAINER_NAME), + "button-style" => !MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_COLLAPSE)) ? 'display: none;' : '', + "id" => "footnote_references_container", + "style" => MCI_Footnotes_Convert::toBool(MCI_Footnotes_Settings::instance()->get(MCI_Footnotes_Settings::C_BOOL_REFERENCE_CONTAINER_COLLAPSE)) ? 'display: none;' : '', + "content" => $l_str_Body + ) + ); - // free all found footnotes if reference container will be displayed - self::$a_arr_Footnotes = array(); - self::$a_str_Prefix = rand(1000, 9999) . "_"; - return $l_obj_TemplateContainer->getContent(); - } + // free all found footnotes if reference container will be displayed + self::$a_arr_Footnotes = array(); + + // #1# Disabled the random prefix preventing fn refs from being shared. + //self::$a_str_Prefix = rand(1000, 9999) . "_"; + return $l_obj_TemplateContainer->getContent(); + } } diff --git a/css/public.css b/css/public.css index bc8d29f..7c739b7 100755 --- a/css/public.css +++ b/css/public.css @@ -6,6 +6,13 @@ * Version: 1.0.7 * Since: 1.0 */ +/* + * On the basis of version 1.6.5 + * v1.6.6 unchanged. + * bug fixes prior to v1.7.0-beta of 2020-10-26T0547+0100 + * Support Forum bug fixes from 2020-10-26T0622+0100 on. + * Last modified: 2020-10-26T0651+0100 + */ /* Footnotes */ .footnote_tag_styling, .footnote_tag_styling:hover { @@ -26,7 +33,8 @@ vertical-align: top !important; position: relative !important; top: 0.4em !important; - cursor: pointer; + cursor: pointer; + z-index: 1; } /* reference container label */ @@ -75,18 +83,33 @@ max-width:10% !important; } -/* arrow */ -.footnote_plugin_link { - vertical-align: top; - white-space: nowrap; - padding-right: 5px; - text-align: left; - cursor: pointer; -} - /* text */ .footnote_plugin_text { vertical-align: top; width: 99%; text-align: left; } + +@media print { + .footnote_tooltip { + display: none; + } +} +.footnote_tooltip { + text-align: left; + z-index: 99; +} +.footnote_plugin_index { + width: 9px; + cursor: pointer; + color: #000099; + border: none; +} +.footnote_plugin_text { + border: none; +} +/*fix for https://wordpress.org/support/topic/box-around-c-references-container/#post-13579381 */ + +.footnote_plugin_text a { + color: #000099; +} diff --git a/footnotes.php b/footnotes.php index 6970d11..b5e2f1e 100755 --- a/footnotes.php +++ b/footnotes.php @@ -4,13 +4,13 @@ Plugin URI: http://wordpress.org/plugins/footnotes/ Description: time to bring footnotes to your website! footnotes are known from offline publishing and everybody takes them for granted when reading a magazine. Author: Mark Cheret - Version: 1.6.4 + Version: 2.0.0 Author URI: http://cheret.de/plugins/footnotes-2/ Text Domain: footnotes Domain Path: /languages */ /* - Copyright 2019 Mark Cheret (email : mark@cheret.de) + Copyright 2020 Mark Cheret (email : mark@cheret.de) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 3, as @@ -25,6 +25,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +// Forked on GitHub by @pewgeuges +// Last modified: 2020-10-26T1913+0100 /** * @filesource * @author Stefan Herndler diff --git a/js/jquery.tools.min.js b/js/jquery.tools.min.js index d97b9be..885fb3b 100644 --- a/js/jquery.tools.min.js +++ b/js/jquery.tools.min.js @@ -21,13 +21,17 @@ * * ----- * + * Added jQueryUI and checks whether a.browser exists + * Following @vonpiernik + * 2020-10-26T2005+0100 + * Last modified: 2020-10-26T2006+0100 */ (function (a) { a.tools = a.tools || {version: "v1.2.7"}; var b; b = a.tools.expose = {conf: {maskId: "exposeMask", loadSpeed: "slow", closeSpeed: "fast", closeOnClick: !0, closeOnEsc: !0, zIndex: 9998, opacity: .8, startOpacity: 0, color: "#fff", onLoad: null, onClose: null}}; function c() { - if (a.browser.msie) { + if (a.browser && a.browser.msie) { var b = a(document).height(), c = a(window).height(); return[window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth, b - c < 20 ? c : b] } @@ -199,7 +203,7 @@ (function (a) { var b, c, d, e; a.tools = a.tools || {version: "v1.2.7"}, a.tools.history = {init: function (g) { - e || (a.browser.msie && a.browser.version < "8" ? c || (c = a("