From 72c239feb1792f0fc858e85e7722ba8dde148ba2 Mon Sep 17 00:00:00 2001 From: Aricura Date: Thu, 22 May 2014 12:47:54 +0000 Subject: [PATCH] - Feature: Short code to not display the 'love me' slug on specific pages ( short code = [[no footnotes: love]] ) - Update: Setting where the reference container appears on public pages can also be set to the widget area git-svn-id: https://plugins.svn.wordpress.org/footnotes/trunk@919367 b8457f37-d9ea-0310-8a92-e5e31aec5664 --- classes/footnotes_settings.php | 3 ++- includes/defines.php | 8 +++++++- includes/replacer.php | 24 +++++++++++++++++++++--- index.php | 4 ++-- readme.txt | 8 ++++++-- 5 files changed, 38 insertions(+), 9 deletions(-) diff --git a/classes/footnotes_settings.php b/classes/footnotes_settings.php index 0ebc561..5d48a72 100644 --- a/classes/footnotes_settings.php +++ b/classes/footnotes_settings.php @@ -403,7 +403,8 @@ class Class_FootnotesSettings */ $l_arr_Options = array( "footer" => __("in the footer", FOOTNOTES_PLUGIN_NAME), - "post_end" => __("at the end of the post", FOOTNOTES_PLUGIN_NAME) + "post_end" => __("at the end of the post", FOOTNOTES_PLUGIN_NAME), + "widget" => __("in the widget area", FOOTNOTES_PLUGIN_NAME) ); $this->AddLabel(FOOTNOTE_INPUTFIELD_REFERENCE_CONTAINER_PLACE, __("Where shall the reference container appear:", FOOTNOTES_PLUGIN_NAME)); $this->AddSelectbox(FOOTNOTE_INPUTFIELD_REFERENCE_CONTAINER_PLACE, $l_arr_Options, "footnote_plugin_50"); diff --git a/includes/defines.php b/includes/defines.php index 728a1f8..116b852 100644 --- a/includes/defines.php +++ b/includes/defines.php @@ -46,4 +46,10 @@ define("FOOTNOTE_REFERENCES_CONTAINER_ID", "footnote_references_container"); /* /* PLUGIN DIRECTORIES */ define("FOOTNOTES_PLUGIN_DIR_NAME", "footnotes"); define("FOOTNOTES_LANGUAGE_DIR", dirname(__FILE__) . "/../languages/"); -define("FOOTNOTES_TEMPLATES_DIR", dirname(__FILE__) . "/../templates/"); \ No newline at end of file +define("FOOTNOTES_TEMPLATES_DIR", dirname(__FILE__) . "/../templates/"); + +/* + * PLUGIN PLACEHOLDER TO NOT DISPLAY THE 'LOVE ME' SLUG + * @since 1.1.1 + */ +define("FOOTNOTES_NO_SLUGME_PLUG", "[[no footnotes: love]]"); \ No newline at end of file diff --git a/includes/replacer.php b/includes/replacer.php index c94d87c..fda63f6 100644 --- a/includes/replacer.php +++ b/includes/replacer.php @@ -4,7 +4,7 @@ * User: Stefan * Date: 15.05.14 * Time: 16:21 - * Version: 1.0.7 + * Version: 1.1.1 * Since: 1.0 */ @@ -26,6 +26,12 @@ $g_arr_FootnotesSettings = array(); */ $g_bool_FootnotesReplacementStarted = false; +/* + * flag to know íf the user wants to have NO 'love me' slug on the current page + * @since 1.1.1 + */ +$g_bool_NoLoveMeSlugOnCurrentPage = false; + /** * register all functions needed for the replacement in the wordpress core * @since 1.0-gamma @@ -49,7 +55,7 @@ function footnotes_RegisterReplacementFunctions() add_filter('widget_text', 'footnotes_Replacer_WidgetText'); /* adds the love and share me slug to the footer */ - add_filter('wp_footer', 'footnotes_LoveAndShareMe'); + add_action('wp_footer', 'footnotes_LoveAndShareMe'); } @@ -162,6 +168,7 @@ function footnotes_LoveAndShareMe() { /* access to the global settings collection */ global $g_arr_FootnotesSettings; + global $g_bool_NoLoveMeSlugOnCurrentPage; /* * updated url to wordpress.org plugin page instead of the github page * also updated the font-style and translation the string "footnotes" @@ -174,7 +181,7 @@ function footnotes_LoveAndShareMe() /* get setting for love and share this plugin and convert it to boolean */ $l_bool_LoveMe = footnotes_ConvertToBool($g_arr_FootnotesSettings[FOOTNOTE_INPUTFIELD_LOVE]); /* check if the admin allows to add a link to the footer */ - if ($l_bool_LoveMe) { + if ($l_bool_LoveMe && !$g_bool_NoLoveMeSlugOnCurrentPage) { echo '
' . sprintf(__("Hey there, I'm using the awesome WordPress Plugin called %s", FOOTNOTES_PLUGIN_NAME), '' . FOOTNOTES_PLUGIN_PUBLIC_NAME . '') . @@ -208,6 +215,17 @@ function footnotes_replaceFootnotes($p_str_Content, $p_bool_OutputReferences = t /* free all found footnotes if reference container will be displayed */ $g_arr_Footnotes = array(); } + + /* + * checks if the user doesn't want to have a 'love me' on current page + * @since 1.1.1 + */ + if (strpos($p_str_Content, FOOTNOTES_NO_SLUGME_PLUG) !== false) { + global $g_bool_NoLoveMeSlugOnCurrentPage; + $g_bool_NoLoveMeSlugOnCurrentPage = true; + $p_str_Content = str_replace(FOOTNOTES_NO_SLUGME_PLUG, "", $p_str_Content); + } + /* return the replaced content */ return $p_str_Content; } diff --git a/index.php b/index.php index 8a5626f..fd4e8a8 100755 --- a/index.php +++ b/index.php @@ -4,7 +4,7 @@ Plugin URI: https://github.com/media-competence-institute/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.1.0 + Version: 1.1.1 Author URI: http://cheret.co.uk/mci Text Domain: footnotes Domain Path: /languages @@ -31,7 +31,7 @@ * User: Stefan * Date: 15.05.14 * Time: 16:21 - * Version: 1.0.5 + * Version: 1.1.1 * Since: 1.0 */ diff --git a/readme.txt b/readme.txt index 1dc7323..b441e7b 100755 --- a/readme.txt +++ b/readme.txt @@ -38,13 +38,17 @@ No, this Plugin has been written from scratch. Of course some inspirations on ho == Changelog == += 1.1.1 = +- Feature: Short code to not display the 'love me' slug on specific pages ( short code = [[no footnotes: love]] ) +- Update: Setting where the reference container appears on public pages can also be set to the widget area + = 1.1.0 = - Update: Global styling for the public plugin name - Update: Easier usage of the public plugin name in translations - Update: New Layout for the settings page to group similar settings to get a better overview - Update: Display settings submit button only if there is at least 1 editable setting in the current tab -- Add: setting where the reference container appears on public pages (needs some corrections!) -- Bugfix: displays only one reference container in front of the footer on category pages +- Add: Setting where the reference container appears on public pages (needs some corrections!) +- Bugfix: Displays only one reference container in front of the footer on category pages = 1.0.6 = - Bugfix: Uninstall function to delete all plugin settings