From 68351cbbaa5225aa6ba56ed40372e39fa033b9b9 Mon Sep 17 00:00:00 2001 From: Aricura Date: Fri, 8 Aug 2014 09:43:47 +0000 Subject: [PATCH] - Added: Setting to customize the text before and after the footnotes index in the superscript git-svn-id: https://plugins.svn.wordpress.org/footnotes/trunk@962317 b8457f37-d9ea-0310-8a92-e5e31aec5664 --- classes/tab_custom.php | 30 +++++++++++++++++++++++++++--- classes/task.php | 6 ++++++ includes/defines.php | 3 ++- includes/plugin-settings.php | 4 +++- index.php | 2 +- templates/footnote.html | 2 +- 6 files changed, 40 insertions(+), 7 deletions(-) diff --git a/classes/tab_custom.php b/classes/tab_custom.php index 076b3b2..d3d9672 100644 --- a/classes/tab_custom.php +++ b/classes/tab_custom.php @@ -25,7 +25,7 @@ class MCI_Footnotes_Tab_Custom extends MCI_Footnotes_Admin { */ public function __construct(&$p_arr_Tabs) { // add tab to the tab array - $p_arr_Tabs[FOOTNOTES_SETTINGS_TAB_CUSTOM] = __("Custom CSS", FOOTNOTES_PLUGIN_NAME); + $p_arr_Tabs[FOOTNOTES_SETTINGS_TAB_CUSTOM] = __("Customize", FOOTNOTES_PLUGIN_NAME); // register settings tab add_settings_section( "MCI_Footnotes_Settings_Section_Custom", @@ -33,9 +33,17 @@ class MCI_Footnotes_Tab_Custom extends MCI_Footnotes_Admin { array($this, 'Description'), FOOTNOTES_SETTINGS_TAB_CUSTOM ); - // help + // styling add_meta_box( - 'MCI_Footnotes_Tab_HowTo_Custom', + 'MCI_Footnotes_Tab_Custom_Styling', + __("Layout", FOOTNOTES_PLUGIN_NAME), + array($this, 'Styling'), + FOOTNOTES_SETTINGS_TAB_CUSTOM, + 'main' + ); + // custom css + add_meta_box( + 'MCI_Footnotes_Tab_Custom_Customize', __("Add custom CSS to the public page", FOOTNOTES_PLUGIN_NAME), array($this, 'CSS'), FOOTNOTES_SETTINGS_TAB_CUSTOM, @@ -52,6 +60,22 @@ class MCI_Footnotes_Tab_Custom extends MCI_Footnotes_Admin { } /** + * footnotes layout before and after the index in text + * @since 1.3.1 + */ + public function Styling() { + // setting for 'before footnotes' + $this->AddLabel(FOOTNOTES_INPUT_CUSTOM_STYLING_BEFORE, __("Before Footnotes:", FOOTNOTES_PLUGIN_NAME)); + $this->AddTextbox(FOOTNOTES_INPUT_CUSTOM_STYLING_BEFORE, "footnote_plugin_50"); + $this->AddNewline(); + // setting for 'after footnotes' + $this->AddLabel(FOOTNOTES_INPUT_CUSTOM_STYLING_AFTER, __("After Footnotes:", FOOTNOTES_PLUGIN_NAME)); + $this->AddTextbox(FOOTNOTES_INPUT_CUSTOM_STYLING_AFTER, "footnote_plugin_50"); + $this->AddNewline(); + } + + /** + * customize css box for public page * @since 1.3 */ public function CSS() { diff --git a/classes/task.php b/classes/task.php index b1d50d1..674f81a 100644 --- a/classes/task.php +++ b/classes/task.php @@ -201,6 +201,10 @@ class MCI_Footnotes_Task { $l_str_EndingTag = $this->a_arr_Settings[FOOTNOTES_INPUT_PLACEHOLDER_END]; // get footnote counter style $l_str_CounterStyle = $this->a_arr_Settings[FOOTNOTES_INPUT_COUNTER_STYLE]; + // get footnote layout before index + $l_str_BeforeIndex = $this->a_arr_Settings[FOOTNOTES_INPUT_CUSTOM_STYLING_BEFORE]; + // get footnote layout after index + $l_str_AfterIndex = $this->a_arr_Settings[FOOTNOTES_INPUT_CUSTOM_STYLING_AFTER]; if ($l_str_StartingTag == "userdefined" || $l_str_EndingTag == "userdefined") { // get user defined footnote starting tag @@ -237,6 +241,8 @@ class MCI_Footnotes_Task { // set replacing string for the footnote $l_str_ReplaceText = str_replace("[[FOOTNOTE INDEX]]", MCI_Footnotes_Convert::Index($l_int_FootnoteIndex, $l_str_CounterStyle), $l_str_FootnoteTemplate); $l_str_ReplaceText = str_replace("[[FOOTNOTE TEXT]]", $l_str_FootnoteText, $l_str_ReplaceText); + $l_str_ReplaceText = str_replace("[[FOOTNOTE BEFORE]]", $l_str_BeforeIndex, $l_str_ReplaceText); + $l_str_ReplaceText = str_replace("[[FOOTNOTE AFTER]]", $l_str_AfterIndex, $l_str_ReplaceText); $l_str_ReplaceText = preg_replace('@[\s]{2,}@',' ',$l_str_ReplaceText); // replace footnote in content $p_str_Content = substr_replace($p_str_Content, $l_str_ReplaceText, $l_int_PosStart, $l_int_Length + strlen($l_str_EndingTag)); diff --git a/includes/defines.php b/includes/defines.php index 285d11f..56b22ce 100644 --- a/includes/defines.php +++ b/includes/defines.php @@ -51,7 +51,8 @@ define("FOOTNOTES_INPUT_REFERENCE_CONTAINER_PLACE", "footnote_inputfield_referen define("FOOTNOTES_INPUT_PLACEHOLDER_START_USERDEFINED", "footnote_inputfield_placeholder_start_user_defined"); // id of input field for 'user defined placeholder start tag define("FOOTNOTES_INPUT_PLACEHOLDER_END_USERDEFINED", "footnote_inputfield_placeholder_end_user_defined"); // id of input field for 'user defined placeholder end tag define("FOOTNOTES_INPUT_CUSTOM_CSS", "footnote_inputfield_custom_css"); // if of input field for 'custom css' setting - +define("FOOTNOTES_INPUT_CUSTOM_STYLING_BEFORE", "footnote_inputfield_custom_styling_before"); // if of input field for 'footnotes styling before' setting +define("FOOTNOTES_INPUT_CUSTOM_STYLING_AFTER", "footnote_inputfield_custom_styling_after"); // if of input field for 'footnotes styling after' setting // PLUGIN REFERENCES CONTAINER ID define("FOOTNOTES_REFERENCES_CONTAINER_ID", "footnote_references_container"); // id for the div surrounding the footnotes diff --git a/includes/plugin-settings.php b/includes/plugin-settings.php index bce2891..d56c168 100644 --- a/includes/plugin-settings.php +++ b/includes/plugin-settings.php @@ -57,7 +57,9 @@ function MCI_Footnotes_getOptions($p_bool_ConvertHtmlChars = true) { ); // default settings for the 'custom' settings container $l_arr_Default_Custom = array( - FOOTNOTES_INPUT_CUSTOM_CSS => '' + FOOTNOTES_INPUT_CUSTOM_CSS => '', + FOOTNOTES_INPUT_CUSTOM_STYLING_BEFORE => '', + FOOTNOTES_INPUT_CUSTOM_STYLING_AFTER => ')' ); $l_arr_General = MCI_Footnotes_ValidateOptions(get_option(FOOTNOTES_SETTINGS_CONTAINER), $l_arr_Default_General, $p_bool_ConvertHtmlChars); diff --git a/index.php b/index.php index b56b89a..b4742c4 100755 --- a/index.php +++ b/index.php @@ -4,7 +4,7 @@ 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: media competence institute - Version: 1.3.0 + Version: 1.3.1 Author URI: http://cheret.co.uk/mci Text Domain: footnotes Domain Path: /languages diff --git a/templates/footnote.html b/templates/footnote.html index 0656eef..6c59428 100755 --- a/templates/footnote.html +++ b/templates/footnote.html @@ -3,7 +3,7 @@ id="footnote_plugin_tooltip_[[FOOTNOTE INDEX]]" class="footnote_plugin_tooltip_text" onclick="footnote_expand_reference_container('#footnote_plugin_reference_[[FOOTNOTE INDEX]]');"> - [[FOOTNOTE INDEX]]) + [[FOOTNOTE BEFORE]][[FOOTNOTE INDEX]][[FOOTNOTE AFTER]] [[FOOTNOTE TEXT]]