Updates plugin to version 2.6

git-svn-id: https://plugins.svn.wordpress.org/prismatic/trunk@2416915 b8457f37-d9ea-0310-8a92-e5e31aec5664
This commit is contained in:
Jeff Starr 2020-11-12 00:10:24 +00:00
parent 4cde14f5cc
commit df496742e3
11 changed files with 238 additions and 161 deletions

View File

@ -1,15 +1,14 @@
/* Prismatic - Settings Styles */
.prismatic-version { color: #c7c7c7; font-size: 90%; }
.wp-admin form h2 { margin-top: 20px; }
.wp-admin .prismatic-label { display: block; margin: 3px 0 0 3px; color: #777; font-size: 13px; font-style: italic; }
.wp-admin .inline-block { display: inline-block; vertical-align: baseline; }
.wp-admin textarea + label { margin: 0 0 0 3px; }
.wp-admin .prismatic-label { color: #777; font-size: 13px; font-style: italic; }
.wp-admin .inline-block { margin: 5px 0 0 3px; display: inline-block; vertical-align: baseline; }
.wp-admin .inline { display: inline; }
.wp-admin input[type=checkbox] { margin-top: -3px; }
.wp-admin input[type=checkbox] + label { margin: 0; }
.wp-admin textarea + label { display: block; margin: 0 0 0 3px; }
.wp-admin input[type=checkbox] { margin-top: -1px; }
.ui-dialog .ui-dialog-buttonpane, .ui-dialog .ui-dialog-titlebar, .ui-dialog .cfx-modal-dialog { text-align: center; }
.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { float: none; }

View File

@ -2,7 +2,7 @@
function prismatic_buttons() {
if (current_user_can('edit_posts') && current_user_can('edit_pages')) {
if (current_user_can('edit_posts')) {
add_filter('mce_buttons', 'prismatic_register_buttons');
add_filter('mce_external_plugins', 'prismatic_add_buttons');

View File

@ -52,6 +52,8 @@ function prismatic_encode($text) {
function prismatic_decode($text, $replace = false) {
if (!is_string($text)) return $text;
$output = '';
$split = preg_split("/(\[prismatic_encoded.*\].*\[\/prismatic_encoded\])/Us", $text, -1, PREG_SPLIT_DELIM_CAPTURE);
$count = count($split);
@ -219,3 +221,30 @@ function prismatic_get_default_options($section) {
return $options;
}
function prismatic_block_styles() {
global $prismatic_options_general;
$disable = isset($prismatic_options_general['disable_block_styles']) ? $prismatic_options_general['disable_block_styles'] : false;
if ($disable) wp_deregister_style('prismatic-blocks');
}
function prismatic_code_shortcode($attr, $content = null) {
extract(shortcode_atts(array(
'class' => '',
), $attr));
$class = $class ? ' class="'. $class .'"' : '';
$encode = prismatic_encode($content);
$decode = prismatic_decode($encode);
return '<code'. $class .'>'. $decode .'</code>';
}

View File

@ -230,7 +230,7 @@ function prismatic_callback_checkbox($args) {
$checked = isset($options[$id]) ? checked($options[$id], 1, false) : '';
echo '<input name="'. $setting .'['. $id .']" value="1" type="checkbox" '. $checked .'> ';
echo '<label for="'. $setting .'['. $id .']" class="prismatic-label inline-block">'. $label .'</label>';
echo '<label for="'. $setting .'['. $id .']" class="prismatic-label inline">'. $label .'</label>';
}

View File

@ -12,9 +12,10 @@ function prismatic_register_settings() {
add_settings_section('settings_general', 'General settings', 'prismatic_section_general', 'prismatic_options_general');
// add_settings_field( $id, $title, $callback, $page, $section, $args )
add_settings_field('library', 'Library', 'prismatic_callback_select', 'prismatic_options_general', 'settings_general', array('id' => 'library', 'section' => 'general', 'label' => esc_html__('', 'prismatic')));
add_settings_field('null_reset_options', 'Reset Options', 'prismatic_callback_reset', 'prismatic_options_general', 'settings_general', array('id' => 'null_reset_options', 'section' => 'general', 'label' => esc_html__('Restore default options', 'prismatic')));
add_settings_field('null_rate_plugin', 'Support Plugin', 'prismatic_callback_rate', 'prismatic_options_general', 'settings_general', array('id' => 'null_rate_plugin', 'section' => 'general', 'label' => esc_html__('Show support with a 5-star rating &raquo;', 'prismatic')));
add_settings_field('library', 'Library', 'prismatic_callback_select', 'prismatic_options_general', 'settings_general', array('id' => 'library', 'section' => 'general', 'label' => esc_html__('', 'prismatic')));
add_settings_field('disable_block_styles', 'Block Styles', 'prismatic_callback_checkbox', 'prismatic_options_general', 'settings_general', array('id' => 'disable_block_styles', 'section' => 'general', 'label' => esc_html__('Disable the Prismatic block stylesheet on the frontend', 'prismatic')));
add_settings_field('null_reset_options', 'Reset Options', 'prismatic_callback_reset', 'prismatic_options_general', 'settings_general', array('id' => 'null_reset_options', 'section' => 'general', 'label' => esc_html__('Restore default options', 'prismatic')));
add_settings_field('null_rate_plugin', 'Support Plugin', 'prismatic_callback_rate', 'prismatic_options_general', 'settings_general', array('id' => 'null_rate_plugin', 'section' => 'general', 'label' => esc_html__('Show support with a 5-star rating &raquo;', 'prismatic')));
// Prism

View File

@ -9,6 +9,9 @@ function prismatic_validate_general($input) {
if (!isset($input['library'])) $input['library'] = null;
if (!array_key_exists($input['library'], $library)) $input['library'] = null;
if (!isset($input['disable_block_styles'])) $input['disable_block_styles'] = null;
$input['disable_block_styles'] = ($input['disable_block_styles'] == 1 ? 1 : 0);
return $input;
}

View File

@ -117,7 +117,7 @@
],
onsubmit : function() {
ed.insertContent('<pre><code class="language-'+ code.language +'">'+ code.snippet + '</code></pre>');
ed.insertContent('<pre><code class="language-'+ code.language +'">'+ tinymce.DOM.encode(code.snippet) + '</code></pre>');
}
});

View File

@ -15,7 +15,8 @@ jQuery(document).ready(function($) {
title: prismatic_settings.reset_title,
buttons: button_names,
modal: true,
width: 350
width: 350,
closeText: ''
});
});

View File

@ -3,7 +3,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-11-02 19:47+0000\n"
"POT-Creation-Date: 2020-11-11 23:59+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: \n"
@ -14,78 +14,138 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Loco https://localise.biz/"
#: prismatic.php:175
#: prismatic.php:179
msgid "Settings"
msgstr ""
#: prismatic.php:189
#: prismatic.php:193
msgid "Plugin Homepage"
msgstr ""
#: prismatic.php:190
#: prismatic.php:194
msgid "Homepage"
msgstr ""
#: prismatic.php:195
#: prismatic.php:199
msgid "Click here to rate and review this plugin on WordPress.org"
msgstr ""
#: prismatic.php:196
#: prismatic.php:200
msgid "Rate this plugin"
msgstr ""
#: prismatic.php:201
#: prismatic.php:205
msgid "Get Prismatic Pro!"
msgstr ""
#: prismatic.php:202
#: prismatic.php:206
msgid "Go&nbsp;Pro"
msgstr ""
#: prismatic.php:221
#: prismatic.php:225
msgid "Warning:"
msgstr ""
#: prismatic.php:222
#: prismatic.php:226
msgid ""
"Pro version of Prismatic currently active. Free and Pro versions cannot be "
"activated at the same time. "
msgstr ""
#: prismatic.php:223 prismatic.php:248
#: prismatic.php:227 prismatic.php:252
msgid "Please return to the"
msgstr ""
#: prismatic.php:223 prismatic.php:249
#: prismatic.php:227 prismatic.php:253
msgid "WP Admin Area"
msgstr ""
#: prismatic.php:224
#: prismatic.php:228
msgid "and try again."
msgstr ""
#: prismatic.php:246
#: prismatic.php:250
msgid "requires WordPress "
msgstr ""
#: prismatic.php:247
#: prismatic.php:251
msgid " or higher, and has been deactivated! "
msgstr ""
#: prismatic.php:249
#: prismatic.php:253
msgid "to upgrade WordPress and try again."
msgstr ""
#: prismatic.php:269 prismatic.php:275
#: prismatic.php:273 prismatic.php:279
msgid "Cheatin&rsquo; huh?"
msgstr ""
#: inc/settings-reset.php:15
msgid "Default options restored."
#: inc/settings-register.php:16
msgid "Disable the Prismatic block stylesheet on the frontend"
msgstr ""
#: inc/settings-reset.php:19
msgid "No changes made to options."
#: inc/settings-register.php:17
msgid "Restore default options"
msgstr ""
#: inc/settings-register.php:18 inc/settings-callbacks.php:271
msgid "Show support with a 5-star rating &raquo;"
msgstr ""
#: inc/settings-register.php:26
msgid "Prism theme"
msgstr ""
#: inc/settings-register.php:27 inc/settings-register.php:28
#: inc/settings-register.php:29 inc/settings-register.php:30
msgid "Enable"
msgstr ""
#: inc/settings-register.php:27
msgid "Line Highlight"
msgstr ""
#: inc/settings-register.php:28
msgid "Line Numbers"
msgstr ""
#: inc/settings-register.php:29
msgid "Show Language"
msgstr ""
#: inc/settings-register.php:30
msgid "Copy to Clipboard"
msgstr ""
#: inc/settings-register.php:31 inc/settings-register.php:48
msgid "Limit to Posts and Pages"
msgstr ""
#: inc/settings-register.php:35 inc/settings-register.php:52
#: inc/settings-register.php:62
msgid "Code escaping for content"
msgstr ""
#: inc/settings-register.php:36 inc/settings-register.php:53
#: inc/settings-register.php:63
msgid "Code escaping for excerpts"
msgstr ""
#: inc/settings-register.php:37 inc/settings-register.php:54
#: inc/settings-register.php:64
msgid "Code escaping for comments"
msgstr ""
#: inc/settings-register.php:45
msgid "Highlight theme"
msgstr ""
#: inc/settings-register.php:46
msgid "Init script for Highlight.js (required)"
msgstr ""
#: inc/settings-register.php:47
msgid "Support no-prefix class names"
msgstr ""
#: inc/settings-display.php:15
@ -151,7 +211,7 @@ msgstr ""
msgid "Coy"
msgstr ""
#: inc/settings-callbacks.php:103 lib/highlight/themes.php:149
#: inc/settings-callbacks.php:103 lib/highlight/themes.php:153
msgid "Dark"
msgstr ""
@ -171,7 +231,7 @@ msgstr ""
msgid "Solarized"
msgstr ""
#: inc/settings-callbacks.php:123 lib/highlight/themes.php:333
#: inc/settings-callbacks.php:123 lib/highlight/themes.php:361
msgid "Tomorrow Night"
msgstr ""
@ -187,8 +247,12 @@ msgstr ""
msgid "Help keep Prismatic going strong! A huge THANK YOU for your support!"
msgstr ""
#: inc/settings-callbacks.php:271 inc/settings-register.php:17
msgid "Show support with a 5-star rating &raquo;"
#: inc/settings-reset.php:15
msgid "Default options restored."
msgstr ""
#: inc/settings-reset.php:19
msgid "No changes made to options."
msgstr ""
#: inc/resources-enqueue.php:91
@ -207,66 +271,6 @@ msgstr ""
msgid "No, abort mission."
msgstr ""
#: inc/settings-register.php:16
msgid "Restore default options"
msgstr ""
#: inc/settings-register.php:25
msgid "Prism theme"
msgstr ""
#: inc/settings-register.php:26 inc/settings-register.php:27
#: inc/settings-register.php:28 inc/settings-register.php:29
msgid "Enable"
msgstr ""
#: inc/settings-register.php:26
msgid "Line Highlight"
msgstr ""
#: inc/settings-register.php:27
msgid "Line Numbers"
msgstr ""
#: inc/settings-register.php:28
msgid "Show Language"
msgstr ""
#: inc/settings-register.php:29
msgid "Copy to Clipboard"
msgstr ""
#: inc/settings-register.php:30 inc/settings-register.php:47
msgid "Limit to Posts and Pages"
msgstr ""
#: inc/settings-register.php:34 inc/settings-register.php:51
#: inc/settings-register.php:61
msgid "Code escaping for content"
msgstr ""
#: inc/settings-register.php:35 inc/settings-register.php:52
#: inc/settings-register.php:62
msgid "Code escaping for excerpts"
msgstr ""
#: inc/settings-register.php:36 inc/settings-register.php:53
#: inc/settings-register.php:63
msgid "Code escaping for comments"
msgstr ""
#: inc/settings-register.php:44
msgid "Highlight theme"
msgstr ""
#: inc/settings-register.php:45
msgid "Init script for Highlight.js (required)"
msgstr ""
#: inc/settings-register.php:46
msgid "Support no-prefix class names"
msgstr ""
#: lib/highlight/themes.php:9
msgid "a11y dark"
msgstr ""
@ -396,19 +400,19 @@ msgid "Brown Paper"
msgstr ""
#: lib/highlight/themes.php:137
msgid "Codepen Embed"
msgid "Brown Paper SQ"
msgstr ""
#: lib/highlight/themes.php:141
msgid "Color Brewer"
msgid "Codepen Embed"
msgstr ""
#: lib/highlight/themes.php:145
msgid "Darcula"
msgid "Color Brewer"
msgstr ""
#: lib/highlight/themes.php:153
msgid "Darkula"
#: lib/highlight/themes.php:149
msgid "Darcula"
msgstr ""
#: lib/highlight/themes.php:161
@ -444,162 +448,194 @@ msgid "Googlecode"
msgstr ""
#: lib/highlight/themes.php:193
msgid "Grayscale"
msgid "Gradient Dark"
msgstr ""
#: lib/highlight/themes.php:197
msgid "Gruvbox Dark"
msgid "Grayscale"
msgstr ""
#: lib/highlight/themes.php:201
msgid "Gruvbox Light"
msgid "Gruvbox Dark"
msgstr ""
#: lib/highlight/themes.php:205
msgid "Hopscotch"
msgid "Gruvbox Light"
msgstr ""
#: lib/highlight/themes.php:209
msgid "Hybrid"
msgid "Hopscotch"
msgstr ""
#: lib/highlight/themes.php:213
msgid "Idea"
msgid "Hybrid"
msgstr ""
#: lib/highlight/themes.php:217
msgid "IR Black"
msgid "Idea"
msgstr ""
#: lib/highlight/themes.php:221
msgid "ISBL Editor Dark"
msgid "IR Black"
msgstr ""
#: lib/highlight/themes.php:225
msgid "ISBL Editor Light"
msgid "ISBL Editor Dark"
msgstr ""
#: lib/highlight/themes.php:229
msgid "Kimbie Dark"
msgid "ISBL Editor Light"
msgstr ""
#: lib/highlight/themes.php:233
msgid "Kimbie Light"
msgid "Kimbie Dark"
msgstr ""
#: lib/highlight/themes.php:237
msgid "Lightfair"
msgid "Kimbie Light"
msgstr ""
#: lib/highlight/themes.php:241
msgid "Magula"
msgid "Lightfair"
msgstr ""
#: lib/highlight/themes.php:245
msgid "Mono Blue"
msgid "Lioshi"
msgstr ""
#: lib/highlight/themes.php:249
msgid "Monokai Sublime"
msgid "Magula"
msgstr ""
#: lib/highlight/themes.php:253
msgid "Monokai"
msgid "Mono Blue"
msgstr ""
#: lib/highlight/themes.php:257
msgid "Nord"
msgid "Monokai Sublime"
msgstr ""
#: lib/highlight/themes.php:261
msgid "Obsidian"
msgid "Monokai"
msgstr ""
#: lib/highlight/themes.php:265
msgid "Ocean"
msgid "Night Owl"
msgstr ""
#: lib/highlight/themes.php:269
msgid "Paraiso Dark"
msgid "NNFX Dark"
msgstr ""
#: lib/highlight/themes.php:273
msgid "Paraiso Light"
msgid "NNFX"
msgstr ""
#: lib/highlight/themes.php:277
msgid "Pojoaque"
msgid "Nord"
msgstr ""
#: lib/highlight/themes.php:281
msgid "Purebasic"
msgid "Obsidian"
msgstr ""
#: lib/highlight/themes.php:285
msgid "Qtcreator Dark"
msgid "Ocean"
msgstr ""
#: lib/highlight/themes.php:289
msgid "Qtcreator Light"
msgid "Paraiso Dark"
msgstr ""
#: lib/highlight/themes.php:293
msgid "Railscasts"
msgid "Paraiso Light"
msgstr ""
#: lib/highlight/themes.php:297
msgid "Rainbow"
msgid "Pojoaque"
msgstr ""
#: lib/highlight/themes.php:301
msgid "School Book"
msgid "Purebasic"
msgstr ""
#: lib/highlight/themes.php:305
msgid "Shades of Purple"
msgid "Qtcreator Dark"
msgstr ""
#: lib/highlight/themes.php:309
msgid "Solarized Dark"
msgid "Qtcreator Light"
msgstr ""
#: lib/highlight/themes.php:313
msgid "Solarized Light"
msgid "Railscasts"
msgstr ""
#: lib/highlight/themes.php:317
msgid "Sunburst"
msgid "Rainbow"
msgstr ""
#: lib/highlight/themes.php:321
msgid "Tomorrow Night Blue"
msgid "Routeros"
msgstr ""
#: lib/highlight/themes.php:325
msgid "Tomorrow Night Bright"
msgid "School Book"
msgstr ""
#: lib/highlight/themes.php:329
msgid "Tomorrow Night Eighties"
msgid "Shades of Purple"
msgstr ""
#: lib/highlight/themes.php:333
msgid "Solarized Dark"
msgstr ""
#: lib/highlight/themes.php:337
msgid "Tomorrow"
msgid "Solarized Light"
msgstr ""
#: lib/highlight/themes.php:341
msgid "Vs"
msgid "Srcery"
msgstr ""
#: lib/highlight/themes.php:345
msgid "Xcode"
msgid "Sunburst"
msgstr ""
#: lib/highlight/themes.php:349
msgid "Xt256"
msgid "Tomorrow Night Blue"
msgstr ""
#: lib/highlight/themes.php:353
msgid "Tomorrow Night Bright"
msgstr ""
#: lib/highlight/themes.php:357
msgid "Tomorrow Night Eighties"
msgstr ""
#: lib/highlight/themes.php:365
msgid "Tomorrow"
msgstr ""
#: lib/highlight/themes.php:369
msgid "Vs"
msgstr ""
#: lib/highlight/themes.php:373
msgid "Vs 2015"
msgstr ""
#: lib/highlight/themes.php:377
msgid "Xcode"
msgstr ""
#: lib/highlight/themes.php:381
msgid "Xt256"
msgstr ""
#: lib/highlight/themes.php:385
msgid "Zenburn"
msgstr ""
@ -617,7 +653,6 @@ msgstr ""
msgid "Jeff Starr"
msgstr ""
#. URI of the plugin
#. Author URI of the plugin
msgid "https://plugin-planet.com/"
msgstr ""

View File

@ -9,9 +9,9 @@
Author URI: https://plugin-planet.com/
Donate link: https://monzillamedia.com/donate.html
Requires at least: 4.1
Tested up to: 5.5
Stable tag: 2.5
Version: 2.5
Tested up to: 5.6
Stable tag: 2.6
Version: 2.6
Requires PHP: 5.6.20
Text Domain: prismatic
Domain Path: /languages
@ -57,6 +57,7 @@ if (!class_exists('Prismatic')) {
add_filter('plugin_action_links', array(self::$instance, 'action_links'), 10, 2);
add_filter('plugin_row_meta', array(self::$instance, 'plugin_links'), 10, 2);
add_action('wp_enqueue_scripts', 'prismatic_block_styles');
add_action('wp_enqueue_scripts', 'prismatic_enqueue');
add_action('admin_enqueue_scripts', 'prismatic_enqueue');
add_action('admin_enqueue_scripts', 'prismatic_enqueue_settings');
@ -71,6 +72,8 @@ if (!class_exists('Prismatic')) {
add_action('init', 'prismatic_register_block_assets');
add_action('init', 'prismatic_add_filters');
add_shortcode('prismatic_code', 'prismatic_code_shortcode');
}
return self::$instance;
@ -82,6 +85,7 @@ if (!class_exists('Prismatic')) {
$options = array(
'library' => 'none',
'disable_block_styles' => false,
);
@ -142,7 +146,7 @@ if (!class_exists('Prismatic')) {
private function constants() {
if (!defined('PRISMATIC_VERSION')) define('PRISMATIC_VERSION', '2.5');
if (!defined('PRISMATIC_VERSION')) define('PRISMATIC_VERSION', '2.6');
if (!defined('PRISMATIC_REQUIRE')) define('PRISMATIC_REQUIRE', '4.1');
if (!defined('PRISMATIC_NAME')) define('PRISMATIC_NAME', 'Prismatic');
if (!defined('PRISMATIC_AUTHOR')) define('PRISMATIC_AUTHOR', 'Jeff Starr');

View File

@ -9,9 +9,9 @@ Contributors: specialk
Author URI: https://plugin-planet.com/
Donate link: https://monzillamedia.com/donate.html
Requires at least: 4.1
Tested up to: 5.5
Stable tag: 2.5
Version: 2.5
Tested up to: 5.6
Stable tag: 2.6
Version: 2.6
Requires PHP: 5.6.20
Text Domain: prismatic
Domain Path: /languages
@ -547,17 +547,9 @@ For Prismatic plugin to work with Autoptimize, a script needs to be excluded. Fo
**How to disable block styles on frontend?**
If you are not using Gutenberg Block Editor, you can disable the plugin's block styles by adding the following line to your theme functions.php:
If you are not using Gutenberg Block Editor, you can disable the plugin's block stylesheet. Simply enable the plugin setting, "Block Styles". Save changes and done.
`// disable Prismatic block styles
function prismatic_enqueue_scripts() {
wp_deregister_style('prismatic-blocks');
}
add_action('wp_enqueue_scripts', 'prismatic_enqueue_scripts');`
FYI: the Prismatic block styles are included via: `/wp-content/plugins/prismatic/css/styles-blocks.css`
FYI: the Prismatic block styles are included via: `/prismatic/css/styles-blocks.css`
**Got a question?**
@ -580,7 +572,7 @@ And/or purchase one of my premium WordPress plugins:
* [BBQ Pro](https://plugin-planet.com/bbq-pro/) - Super fast WordPress firewall
* [Blackhole Pro](https://plugin-planet.com/blackhole-pro/) - Automatically block bad bots
* [Banhammer Pro](https://plugin-planet.com/banhammer-pro/) - Monitor traffic and ban the bad guys
* [GA Google Analytics Pro](https://plugin-planet.com/ga-google-analytics-pro/) - Connect your WordPress to Google Analytics
* [GA Google Analytics Pro](https://plugin-planet.com/ga-google-analytics-pro/) - Connect WordPress to Google Analytics
* [USP Pro](https://plugin-planet.com/usp-pro/) - Unlimited front-end forms
Links, tweets and likes also appreciated. Thank you! :)
@ -592,6 +584,19 @@ Links, tweets and likes also appreciated. Thank you! :)
Thank you to everyone providing feedback! If you like Prismatic, please take a moment to [give a 5-star rating](https://wordpress.org/support/plugin/prismatic/reviews/?rate=5#new-post). It helps to keep development and support going strong. Thank you!
**2.6 (2020/11/10)**
* Adds option to disable the Prismatic block stylesheet
* Adds `[prismatic_code]` shortcode for [nested code tags](https://wordpress.org/support/topic/sourcecode-with-tags-i-e-nested-tags/)
* Updates plugin script to account for changes in jQuery UI
* Fixes PHP Warnings re: `preg_split()` and `count()`
* Fixes bug with Visual Editor button and contributors
* Fixes bug with Visual Editor and code escaping (Thanks [@mgongee](https://wordpress.org/support/topic/html-tags-are-stripped-out-instead-of-being-escaped/))
* Improves the appearance of the plugin settings page
* Updates default translation template
* Tests on PHP 7.4 and 8.0
* Tests on WordPress 5.6
**2.5 (2020/08/07)**
Prism.js