From 14cda8a316d3d86c82e2a93baee15404313fab24 Mon Sep 17 00:00:00 2001 From: Aricura Date: Sat, 27 Sep 2014 07:56:40 +0000 Subject: [PATCH] - Add: List with Features - Add: Hyperlink to manfisher.eu in the "other plugins" page - Bugfix: Load text domain - Bugfix: Display the Footnotes button in the plain text editor of posts/pages git-svn-id: https://plugins.svn.wordpress.org/footnotes/trunk@997524 b8457f37-d9ea-0310-8a92-e5e31aec5664 --- class/dashboard/init.php | 23 +++++++++++++++++++---- class/language.php | 24 +++++++++++++++++------- class/wysiwyg.php | 7 ++++++- features.txt | 22 ++++++++++++++++++++++ js/wysiwyg-editor.js | 1 - readme.txt | 7 +++++-- templates/dashboard/editor-button.html | 3 +-- 7 files changed, 70 insertions(+), 17 deletions(-) create mode 100644 features.txt diff --git a/class/dashboard/init.php b/class/dashboard/init.php index 448cf5a..6bca181 100644 --- a/class/dashboard/init.php +++ b/class/dashboard/init.php @@ -141,6 +141,23 @@ class MCI_Footnotes_Layout_Init { * @since 1.5.0 */ public function displayOtherPlugins() { + printf("
"); + printf("

%s

", __('Take a look on other Plugins we have developed.', MCI_Footnotes_Config::C_STR_PLUGIN_NAME)); + printf('visit ManFisher Medien ManuFaktur'); + printf("

"); +/* + // collect plugin list as JSON + $l_arr_Response = wp_remote_get("http://herndler.org/wordpress/plugins/get.json"); + // check if response is valid + if (is_wp_error($l_arr_Response)) { + printf(__("Error loading other WordPress Plugins from Manfisher. Sorry!", MCI_Footnotes_Config::C_STR_PLUGIN_NAME)); + return; + } + // get the body of the response + $l_str_Response = $l_arr_Response["body"]; + // convert the body to a json string + $l_arr_Plugins = json_decode($l_str_Response, true); +*/ $l_arr_Plugins = array( array("name" => "identity", "title" => "Identity"), array("name" => "google-keyword-suggest", "title" => "Google Keyword Suggest"), @@ -151,9 +168,7 @@ class MCI_Footnotes_Layout_Init { // load template file $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "other-plugins"); - echo sprintf("

%s


", __('Take a look on other Plugins we have developed.', MCI_Footnotes_Config::C_STR_PLUGIN_NAME)); - - echo '
'; + printf('
'); // iterate through each Plugin foreach($l_arr_Plugins as $l_arr_PluginInfo) { // replace Plugin information @@ -168,7 +183,7 @@ class MCI_Footnotes_Layout_Init { // reload template $l_obj_Template->reload(); } - echo '
'; + printf('
'); } /** diff --git a/class/language.php b/class/language.php index ba582dd..743d8c0 100644 --- a/class/language.php +++ b/class/language.php @@ -30,19 +30,29 @@ class MCI_Footnotes_Language { * @since 1.5.0 */ public static function loadTextDomain() { - $l_str_LanguagePath = dirname(__FILE__) . "/../languages/" . MCI_Footnotes_Config::C_STR_PLUGIN_NAME - "-"; // language file with localization exists - $l_bool_DomainLoaded = load_textdomain(MCI_Footnotes_Config::C_STR_PLUGIN_NAME, $l_str_LanguagePath . apply_filters('plugin_locale', get_locale(), MCI_Footnotes_Config::C_STR_PLUGIN_NAME) . '.mo'); - if (!empty($l_bool_DomainLoaded)) { + if (self::load(apply_filters('plugin_locale', get_locale()))) { return; } // language file without localization exists - $l_bool_DomainLoaded = load_textdomain(MCI_Footnotes_Config::C_STR_PLUGIN_NAME, $l_str_LanguagePath . self::getLanguageCode() . '.mo'); - if (!empty($l_bool_DomainLoaded)) { + if (self::load(self::getLanguageCode())) { return; } // fallback to english - load_textdomain(MCI_Footnotes_Config::C_STR_PLUGIN_NAME, $l_str_LanguagePath . '-en.mo'); + self::load("en"); + } + + /** + * Loads a specific text domain. + * + * @author Stefan Herndler + * @since 1.5.1 + * @param string $p_str_LanguageCode Language Code to load a specific text domain. + * @return bool + */ + private static function load($p_str_LanguageCode) { + return load_textdomain(MCI_Footnotes_Config::C_STR_PLUGIN_NAME, + dirname(__FILE__) . "/../languages/" . MCI_Footnotes_Config::C_STR_PLUGIN_NAME . "-" . $p_str_LanguageCode . '.mo'); } /** @@ -54,7 +64,7 @@ class MCI_Footnotes_Language { */ private static function getLanguageCode() { // read current WordPress language - $l_str_locale = apply_filters('plugin_locale', get_locale(), MCI_Footnotes_Config::C_STR_PLUGIN_NAME); + $l_str_locale = apply_filters('plugin_locale', get_locale()); // check if WordPress language has a localization (e.g. "en_US" or "de_AT") if (strpos($l_str_locale, "_") !== false) { // remove localization code diff --git a/class/wysiwyg.php b/class/wysiwyg.php index 87d8b55..c034185 100644 --- a/class/wysiwyg.php +++ b/class/wysiwyg.php @@ -7,6 +7,11 @@ * @since 1.5.0 14.09.14 17:30 */ +/** + * + * @author Stefan Herndler + * @since 1.5.0 + */ class MCI_Footnotes_WYSIWYG { public static function registerHooks() { @@ -41,7 +46,7 @@ class MCI_Footnotes_WYSIWYG { */ public static function newPlainTextEditorButton() { $l_obj_Template = new MCI_Footnotes_Template(MCI_Footnotes_Template::C_STR_DASHBOARD, "editor-button"); - $l_obj_Template->getContent(); + echo $l_obj_Template->getContent(); } /** diff --git a/features.txt b/features.txt new file mode 100644 index 0000000..736ddc5 --- /dev/null +++ b/features.txt @@ -0,0 +1,22 @@ + + +== List of other Plugins == +- Add downloads (real time from WordPress API) +- Add image (from JSON string) +- Add rating (display the stars) +- Add "Compatible up to" WordPress Version +- Add last updated timestamp + + +== Diagnostics == +- Add current WordPress Theme (Name, Version, Author, Url) + + +== Footnotes == +- Add public css file to the "How to" tab +- Add setting to customize the mouse-over box +- Add setting to disable the mouse-over box +- Display the mouse-over box to the left if near the right margin +- Abbreviate the mouse-over text if more than XXX characters (ending with "...") +- Performance of the task so PHP won't throw an error when there are more than 120? Footnotes + - Maybe increase PHP max execution time while processing the Footnotes task \ No newline at end of file diff --git a/js/wysiwyg-editor.js b/js/wysiwyg-editor.js index f4417bd..69de96b 100644 --- a/js/wysiwyg-editor.js +++ b/js/wysiwyg-editor.js @@ -29,7 +29,6 @@ success: function(data, textStatus, XMLHttpRequest){ var l_arr_Tags = JSON.parse(data); var return_text = l_arr_Tags['start'] + ed.selection.getContent() + l_arr_Tags['end']; - console.log(return_text); ed.execCommand('insertHTML', true, return_text); }, error: function(MLHttpRequest, textStatus, errorThrown){ diff --git a/readme.txt b/readme.txt index 90fde87..89c70c5 100755 --- a/readme.txt +++ b/readme.txt @@ -73,11 +73,14 @@ Visit this swift write-up from a **footnotes** user by the name of **Southwest** == Changelog == = 1.5.0 = -- Update: Refactored the whole source code - Add: Grouped the Plugin Settings into a new Menu Page called "ManFisher Plugins" -- Update: Moved the Diagnostics Sections to into a new Sub Page called "Diagnostics" - Add: Sub Page to list all other Plugins of the Contributors +- Add: Hyperlink to manfisher.eu in the "other plugins" page +- Update: Refactored the whole source code +- Update: Moved the Diagnostics Sections to into a new Sub Page called "Diagnostics" - Bugfix: Line up Footnotes with multiple lines in the Reference container +- Bugfix: Load text domain +- Bugfix: Display the Footnotes button in the plain text editor of posts/pages = 1.4.0 = - Feature: WPML Config XML file for easy multi language string translation (WPML String Translation Support File) diff --git a/templates/dashboard/editor-button.html b/templates/dashboard/editor-button.html index df47ef5..b1c8695 100644 --- a/templates/dashboard/editor-button.html +++ b/templates/dashboard/editor-button.html @@ -28,8 +28,7 @@ type: 'POST', url: '/wp-admin/admin-ajax.php', data: { - action: 'footnotes_getTags', - data: '' + action: 'footnotes_getTags' }, success: function(data, textStatus, XMLHttpRequest){ var l_arr_Tags = JSON.parse(data);