From 8172c5a2d2843c7f2e695d6901974a0da488b8e8 Mon Sep 17 00:00:00 2001 From: Andi Dittrich Date: Thu, 6 Sep 2018 14:47:42 +0200 Subject: [PATCH] added plugin-path env check --- CHANGES.md | 1 + class/EnvironmentCheck.php | 5 + lang/Enlighter.pot | 185 ++++++++++++++++++++--------------- readme.txt | 78 +++------------ util/ThemeFetcher.php | 2 +- views/admin/Changes.html | 2 + views/admin/SystemInfo.phtml | 21 ++-- 7 files changed, 141 insertions(+), 153 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index b7b2e88..0f5ec81 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -5,6 +5,7 @@ * Added: experimental Gutenberg editor integration - [EnlighterJS/Plugin.Gutenberg on GitHub](https://github.com/EnlighterJS/Plugin.Gutenberg) * Added: keyboard shortcut `+x` to highlight inline code - requested by [dahnark on WordPress.org Forums](https://wordpress.org/support/topic/override-theme-code-style/) * Added: Visual Editor Plugin ([EnlighterJS.TinyMCE](https://github.com/EnlighterJS/Plugin.TinyMCE)) **v3.5.0** +* Added: Environment check to ensure the plugin is uploaded into `wp-content/plugins/enlighter/` * Changed: moved experimental settings into panel "Beta" * Removed: outdated translations * Bugfix: styles of the "plugin upgrade notification" were broken diff --git a/class/EnvironmentCheck.php b/class/EnvironmentCheck.php index c28317b..b333f64 100644 --- a/class/EnvironmentCheck.php +++ b/class/EnvironmentCheck.php @@ -76,6 +76,11 @@ public function check(){ } } + // plugin path wp-content/plugins/enlighter ? + if (strpos(__DIR__, 'enlighter/class') === false){ + $errors[] = __('The plugin is located within an invalid path - the enlighter/ directory name is mandatory', 'enlighter'); + } + return array( 'errors' => $errors, 'warnings' => $warnings diff --git a/lang/Enlighter.pot b/lang/Enlighter.pot index 877dca8..50b43a1 100644 --- a/lang/Enlighter.pot +++ b/lang/Enlighter.pot @@ -2,10 +2,10 @@ msgid "" msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"POT-Creation-Date: 2018-06-14 08:32:03+00:00\n" +"POT-Creation-Date: 2018-09-06 12:47:14+00:00\n" "PO-Revision-Date: 2018-MO-DA HO:MI+ZONE\n" "MIME-Version: 1.0\n" -"Project-Id-Version: Enlighter 3.7\n" +"Project-Id-Version: Enlighter 3.8\n" "Report-Msgid-Bugs-To: andi DOT dittrich AT a3non DOT org\n" "Last-Translator: Andi Dittrich\n" @@ -41,7 +41,7 @@ msgstr "" msgid "External Themes" msgstr "" -#: views/admin/SettingsPage.phtml:38 +#: views/admin/SettingsPage.phtml:39 msgid "Enlighter - Customizable Syntax Highlighter" msgstr "" @@ -77,6 +77,10 @@ msgstr "" msgid "Autoset Permissions failed - Please change the directory permission (chmod 0644 or 0777) manually!" msgstr "" +#: class/EnvironmentCheck.php:81 +msgid "The plugin is located within an invalid path - the enlighter/ directory name is mandatory" +msgstr "" + #: class/TinyMCE.php:131 msgid "Enlighter Codeblocks" msgstr "" @@ -165,6 +169,46 @@ msgstr "" msgid "Info-button" msgstr "" +#: views/admin/Beta.phtml:5 +msgid "BETA Features" +msgstr "" + +#: views/admin/Beta.phtml:8 +msgid "Warning: These options are for advanced users only and subjected to change!" +msgstr "" + +#: views/admin/Beta.phtml:11 +msgid "Dynamic Resource Invocation (DRI)" +msgstr "" + +#: views/admin/Beta.phtml:12 +msgid "To optimize your website load-time it`s possible to load the EnlighterJS script dependencies only if they are required (requires script-position: footer)." +msgstr "" + +#: views/admin/Beta.phtml:13 +msgid "In case it`s enable, the plugin will observer it`s invocation (visual editor, shortcodes, markdown)." +msgstr "" + +#: views/admin/Beta.phtml:15 +msgid "Enable DRI" +msgstr "" + +#: views/admin/Beta.phtml:18 +msgid "Gutenberg Editor Plugin" +msgstr "" + +#: views/admin/Beta.phtml:19 +msgid "To use EnlighterJS within Gutenberg you can enable this feature. It loads the EnlighterJS Gutenberg.Plugin." +msgstr "" + +#: views/admin/Beta.phtml:20 +msgid "Warning: Please keep in mind that this version of Enlighter Plugin.Gutenberg is still BETA software and may have some serious bugs!" +msgstr "" + +#: views/admin/Beta.phtml:22 +msgid "Enable" +msgstr "" + #: views/admin/Compatibility.phtml:5 msgid "Compatibility Mode / 3rd Party Migration" msgstr "" @@ -501,30 +545,6 @@ msgstr "" msgid "Enable I18n" msgstr "" -#: views/admin/Options.phtml:83 -msgid "EXPERIMENTAL OPTIONS" -msgstr "" - -#: views/admin/Options.phtml:86 -msgid "Warning: These options are for advanced users only and subjected to change!" -msgstr "" - -#: views/admin/Options.phtml:89 -msgid "Dynamic Resource Invocation (DRI)" -msgstr "" - -#: views/admin/Options.phtml:90 -msgid "To optimize your website load-time it`s possible to load the EnlighterJS script dependencies only if they are required (requires script-position: footer)." -msgstr "" - -#: views/admin/Options.phtml:91 -msgid "In case it`s enable, the plugin will observer it`s invocation (visual editor, shortcodes, markdown)." -msgstr "" - -#: views/admin/Options.phtml:93 -msgid "Enable DRI" -msgstr "" - #: views/admin/Related.phtml:4 msgid "Enlighter Related" msgstr "" @@ -557,31 +577,26 @@ msgstr "" msgid "Options" msgstr "" -#: views/admin/SettingsPage.phtml:39 +#: views/admin/SettingsPage.phtml:35 +msgid "BETA" +msgstr "" + +#: views/admin/SettingsPage.phtml:40 msgid "Select the content you want to highlight and Enlighter takes care of the rest." msgstr "" -#: views/admin/SettingsPage.phtml:107 +#: views/admin/SettingsPage.phtml:112 msgid "is developed by" msgstr "" -#: views/admin/SettingsPage.phtml:108 +#: views/admin/SettingsPage.phtml:113 msgid "It`s released under the terms of the %s. " msgstr "" -#: views/admin/SettingsPage.phtml:108 +#: views/admin/SettingsPage.phtml:113 msgid "MIT X11 License" msgstr "" -#: views/admin/SettingsPage.phtml:109 views/admin/SettingsPage.phtml:110 -#: views/admin/SettingsPage.phtml:111 -msgid "License" -msgstr "" - -#: views/admin/SettingsPage.phtml:110 views/admin/SettingsPage.phtml:111 -msgid "by" -msgstr "" - #: views/admin/SystemInfo.phtml:4 msgid "System Info" msgstr "" @@ -590,60 +605,64 @@ msgstr "" msgid "PHP Version:" msgstr "" -#: views/admin/SystemInfo.phtml:12 -msgid "Server Software:" +#: views/admin/SystemInfo.phtml:13 views/admin/SystemInfo.phtml:15 +msgid "PHP JSON Extension" msgstr "" -#: views/admin/SystemInfo.phtml:15 -msgid "Enlighter Plugin Version:" +#: views/admin/SystemInfo.phtml:13 +msgid "available" msgstr "" -#: views/admin/SystemInfo.phtml:18 -msgid "EnlighterJS Version:" +#: views/admin/SystemInfo.phtml:15 +msgid "not installed" msgstr "" -#: views/admin/SystemInfo.phtml:21 -msgid "TinyMCE Extension:" +#: views/admin/SystemInfo.phtml:19 +msgid "Server Software:" msgstr "" -#: views/admin/SystemInfo.phtml:25 views/admin/SystemInfo.phtml:27 -msgid "Cache writeable" +#: views/admin/SystemInfo.phtml:29 +msgid "Enlighter Plugin Version:" msgstr "" -#: views/admin/SystemInfo.phtml:25 -msgid "true" +#: views/admin/SystemInfo.phtml:32 +msgid "EnlighterJS Version:" msgstr "" -#: views/admin/SystemInfo.phtml:27 -msgid "false" +#: views/admin/SystemInfo.phtml:35 +msgid "TinyMCE Extension:" msgstr "" -#: views/admin/SystemInfo.phtml:32 views/admin/SystemInfo.phtml:34 -msgid "JSON Extension" +#: views/admin/SystemInfo.phtml:38 +msgid "Gutenberg Extension:" msgstr "" -#: views/admin/SystemInfo.phtml:32 -msgid "installed" +#: views/admin/SystemInfo.phtml:42 views/admin/SystemInfo.phtml:44 +msgid "Cache writeable" msgstr "" -#: views/admin/SystemInfo.phtml:34 -msgid "not installed" +#: views/admin/SystemInfo.phtml:42 +msgid "true" msgstr "" -#: views/admin/SystemInfo.phtml:40 views/admin/SystemInfo.phtml:42 #: views/admin/SystemInfo.phtml:44 +msgid "false" +msgstr "" + +#: views/admin/SystemInfo.phtml:50 views/admin/SystemInfo.phtml:52 +#: views/admin/SystemInfo.phtml:54 msgid "Shortcode Processor" msgstr "" -#: views/admin/SystemInfo.phtml:40 +#: views/admin/SystemInfo.phtml:50 msgid "disabled" msgstr "" -#: views/admin/SystemInfo.phtml:42 +#: views/admin/SystemInfo.phtml:52 msgid "WordPress internal" msgstr "" -#: views/admin/SystemInfo.phtml:44 +#: views/admin/SystemInfo.phtml:54 msgid "Enlighter low-level" msgstr "" @@ -795,7 +814,7 @@ msgstr "" msgid "Font Styles" msgstr "" -#: views/admin/VisualEditing.phtml:34 +#: views/admin/VisualEditing.phtml:37 msgid "Font-Family" msgstr "" @@ -804,7 +823,7 @@ msgstr "" msgid "e.g. Monaco, Courier, Monospace" msgstr "" -#: views/admin/VisualEditing.phtml:37 +#: views/admin/VisualEditing.phtml:40 msgid "Font-Size" msgstr "" @@ -812,7 +831,7 @@ msgstr "" msgid "e.g. 12px, 1.2em, 11pt" msgstr "" -#: views/admin/VisualEditing.phtml:40 +#: views/admin/VisualEditing.phtml:43 msgid "Line height" msgstr "" @@ -820,7 +839,7 @@ msgstr "" msgid "e.g. 16px, 1.5em" msgstr "" -#: views/admin/VisualEditing.phtml:43 +#: views/admin/VisualEditing.phtml:46 msgid "Font-Color" msgstr "" @@ -841,7 +860,7 @@ msgstr "" msgid "RAW Font Styles" msgstr "" -#: views/admin/VisualEditing.phtml:46 +#: views/admin/VisualEditing.phtml:49 msgid "Background-Color" msgstr "" @@ -1018,46 +1037,54 @@ msgid "Add Editor Formats" msgstr "" #: views/admin/VisualEditing.phtml:24 -msgid "By default, the tab button does not add indentation to the content. Enlighter comes with its own editing plugin which allows you to use tabs within the Editor to align code." +msgid "The default keyboard shortcut (shift+alt+x) action can be modified to convert the current selection into an Enlighter codeblock." msgstr "" #: views/admin/VisualEditing.phtml:25 +msgid "Enable Keyboard Shortcut" +msgstr "" + +#: views/admin/VisualEditing.phtml:27 +msgid "By default, the tab button does not add indentation to the content. Enlighter comes with its own editing plugin which allows you to use tabs within the Editor to align code." +msgstr "" + +#: views/admin/VisualEditing.phtml:28 msgid "This option disables the tabfocus plugin and requires that the Enlighter indent option has been set to spaces!" msgstr "" -#: views/admin/VisualEditing.phtml:26 +#: views/admin/VisualEditing.phtml:29 msgid "Enable Tab Indentation" msgstr "" -#: views/admin/VisualEditing.phtml:29 +#: views/admin/VisualEditing.phtml:32 msgid "Code-Block Styles" msgstr "" -#: views/admin/VisualEditing.phtml:30 +#: views/admin/VisualEditing.phtml:33 msgid "It is also possible to influence the code-block styles of the Visual-Editor. Maybe you like another background color or font-family." msgstr "" -#: views/admin/VisualEditing.phtml:34 +#: views/admin/VisualEditing.phtml:37 msgid "e.g. \"Source Code Pro\", \"Liberation Mono\", \"Courier New\", Courier, monospace" msgstr "" -#: views/admin/VisualEditing.phtml:37 +#: views/admin/VisualEditing.phtml:40 msgid "e.g. 0.7em" msgstr "" -#: views/admin/VisualEditing.phtml:40 +#: views/admin/VisualEditing.phtml:43 msgid "e.g. 1.4em" msgstr "" -#: views/admin/VisualEditing.phtml:43 +#: views/admin/VisualEditing.phtml:46 msgid "e.g. #565b60" msgstr "" -#: views/admin/VisualEditing.phtml:46 +#: views/admin/VisualEditing.phtml:49 msgid "e.g. #f7f7f7" msgstr "" -#: views/admin/VisualEditing.phtml:49 +#: views/admin/VisualEditing.phtml:52 msgid "Restore defaults" msgstr "" diff --git a/readme.txt b/readme.txt index 2408369..95f41de 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Tags: syntax highlighting, javascript, code, coding, sourcecode, mootools, jquer Donate link: https://enlighterjs.org Requires at least: 3.9 Tested up to: 4.9 -Stable tag: 3.7 +Stable tag: 3.8 License: MIT X11-License License URI: http://opensource.org/licenses/MIT @@ -19,6 +19,7 @@ It also supports the automatic creation of tab-panes to display code-groups toge = Plugin Features = * Support for all common used languages including powerful generic highlighting +* **Full** Gutenberg Editor Integration (currently experimental) * **Full** Visual-Editor (TinyMCE) Integration (Admin Panel + Frontend) * Theme Customizer including **LIVE Preview Mode** * Inline Syntax Highlighting @@ -73,71 +74,6 @@ Click to view Language/Theme Examples * [Shell](https://enlighterjs.org/Language.Shell.html) * [VHDL](https://enlighterjs.org/Language.VHDL.html) * [XML](https://enlighterjs.org/Language.XML.html) - -= Shortcode Quickstart Example = -Highlight javascript code (theme defined on your settings page) - - [js] - window.addEvent('domready', function(){ - console.info('Hello Enlighter'); - }); - [/js] - -= Inline Syntax Highlighting with Shortcode = - - Lorem ipsum dolor sit amet, [js]window.alert('Hello World');[/js] consetetur sadipscing elitr, - sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. - -= Codegroup Example = -Display multiple codes within a tab-pane. You can define a custom tab-pane title for each snippet if you want. - - [codegroup] - [js tab="Javascript Message"] - window.addEvent('domready', function(){ - // display string on console - console.info('Hello Enlighter'); - - // show element - $('#myelement').show(); - }); - [/js] - - [html] -
- INITIALIZATION START -
- [/html] - - [css tab="Styling"] - #myelement{ - color: #cc2222; - padding: 15px; - font-size: 20px; - text-align: center; - } - [/css] - [/codegroup] - -= Legacy Example = -It's also possible to use the plugin with legacy shortcode (disabled language shortcodes) - - [enlighter lang="js"] - window.addEvent('domready', function(){ - // display string on console - console.info('Hello Enlighter'); - - // show element - $('#myelement').show(); - }); - [/enlighter] - - -= Translations (I18n) = -Please keep in mind that not all translations are up to date. You are welcome to contribute! - -* **English** (default) -* **German** (de_DE by Andi Dittrich) -* **Serbo-Croatian** (sr_RS by Borisa Djuraskovic from webhostinghub.com) = Related Links = * [Enlighter Plugin Docs + Tutorials](https://github.com/EnlighterJS/Plugin.WordPress/docs) @@ -268,6 +204,16 @@ In case you found a security issue in this plugin - please write a message **dir Write a message to [Andi Dittrich](http://andidittrich.de/contact) (andi DOT dittrich AT a3non DOT O R G) or open a [New Issue on GitHub](https://github.com/EnlighterJS/Plugin.WordPress/issues) == Changelog == += 3.8 = + +* Added: experimental Gutenberg editor integration - [EnlighterJS/Plugin.Gutenberg on GitHub](https://github.com/EnlighterJS/Plugin.Gutenberg) +* Added: keyboard shortcut `+x` to highlight inline code - requested by [dahnark on WordPress.org Forums](https://wordpress.org/support/topic/override-theme-code-style/) +* Added: Visual Editor Plugin ([EnlighterJS.TinyMCE](https://github.com/EnlighterJS/Plugin.TinyMCE)) **v3.5.0** +* Added: Environment check to ensure the plugin is uploaded into `wp-content/plugins/enlighter/` +* Changed: moved experimental settings into panel "Beta" +* Removed: outdated translations +* Bugfix: styles of the "plugin upgrade notification" were broken + = 3.7 = * Added: msdos language support (EnlighterJS v2.12.0) - thanks to [audioscavenger on GitHub](https://github.com/EnlighterJS/EnlighterJS/pull/33/commits) diff --git a/util/ThemeFetcher.php b/util/ThemeFetcher.php index a30456f..0daf32b 100644 --- a/util/ThemeFetcher.php +++ b/util/ThemeFetcher.php @@ -19,7 +19,7 @@ $themes = explode(' ', 'Enlighter Godzilla Beyond Classic MooTwo Eclipse Droide Minimal Atomic Rowhammer Git Mocha MooTools Panic Tutti Twilight'); // github fetching url -$gitHubURL = 'https://raw.githubusercontent.com/AndiDittrich/EnlighterJS/master/Source/Themes/'; +$gitHubURL = 'https://raw.githubusercontent.com/EnlighterJS/EnlighterJS/v2-legacy/Source/Themes/'; // js Theme Template $ThemeStyles = array(); diff --git a/views/admin/Changes.html b/views/admin/Changes.html index c42333a..c04afac 100644 --- a/views/admin/Changes.html +++ b/views/admin/Changes.html @@ -2,6 +2,8 @@
  • Added: experimental Gutenberg editor integration - EnlighterJS/Plugin.Gutenberg on GitHub
  • Added: keyboard shortcut +x to highlight inline code - requested by dahnark on WordPress.org Forums
  • Added: Visual Editor Plugin (EnlighterJS.TinyMCE) v3.5.0
  • +
  • Added: Environment check to ensure the plugin is uploaded into wp-content/plugins/enlighter/
  • Changed: moved experimental settings into panel "Beta"
  • +
  • Removed: outdated translations
  • Bugfix: styles of the "plugin upgrade notification" were broken
  • \ No newline at end of file diff --git a/views/admin/SystemInfo.phtml b/views/admin/SystemInfo.phtml index d478d45..2827b2a 100644 --- a/views/admin/SystemInfo.phtml +++ b/views/admin/SystemInfo.phtml @@ -8,8 +8,22 @@ ', __('PHP Version:', 'enlighter'), ' ', phpversion(), ''; + // json encoding available ? + if (function_exists('json_encode')) { + echo '
  • ', __('PHP JSON Extension', 'enlighter'), ': ', __('available', 'enlighter'), '
  • '; + } else { + echo '
  • ', __('PHP JSON Extension', 'enlighter'), ': ', __('not installed', 'enlighter'), '
  • '; + } + // server os echo '
  • ', __('Server Software:', 'enlighter'), ' ', PHP_OS, '
  • '; + ?> + + +
    + +