Update shortcodes dropin

This commit is contained in:
Robin Cornett
2017-10-25 12:00:55 -04:00
parent 8fc9cf880e
commit 0da84e5bf4
4 changed files with 36 additions and 16 deletions
@@ -102,6 +102,10 @@ If an image ID is required, Six/Ten Press image fields in a group will work, as
### Changelog
#### 0.3.3
* fixed: check for script/style enqueue
* fixed: localized scripts/inline styles output only once
#### 0.3.2
* reduced unnecessary CSS
* tweaked filter for hooks on which to load the modal buttons
@@ -1,4 +1,8 @@
<?php
/**
* Copyright (c) 2017 Robin Cornett
*/
/**
* Add a hook to initialize our code.
*/
@@ -127,11 +131,11 @@ class SixTenPressShortcodes {
*/
public function start_editor() {
add_filter( 'sixtenpress_shortcode_localization', array( $this, 'localization_args' ) );
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue' ) );
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_script' ) );
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_style' ) );
add_action( 'media_buttons', array( $this, 'media_buttons' ), 98 );
add_action( 'admin_footer', array( $this, 'widget_builder_modal' ) );
add_filter( 'sixtenpress_admin_color_picker', '__return_true' );
add_action( 'admin_print_scripts', array( $this, 'localize' ) );
}
/**
@@ -157,12 +161,24 @@ class SixTenPressShortcodes {
}
/**
* Enqueue the scripts and styles needed for the modal.
* Enqueue the scripts needed for the modal.
*/
public function enqueue() {
public function enqueue_script() {
if ( wp_script_is( 'sixtenpress-editor-script', 'enqueued' ) ) {
return;
}
$minify = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
wp_enqueue_script( 'sixtenpress-editor-script', plugin_dir_url( __FILE__ ) . "js/shortcode-editor{$minify}.js", array( 'jquery' ), SIXTENPRESSSHORTCODES_VERSION, true );
add_action( 'admin_print_scripts', array( $this, 'localize' ) );
}
/**
* Enqueue the styles needed for the modal.
*/
public function enqueue_style() {
if ( wp_style_is( 'sixtenpress-editor', 'enqueued' ) ) {
return;
}
add_filter( 'sixtenpress_admin_style', '__return_true' );
wp_enqueue_style( 'sixtenpress-editor', plugin_dir_url( __FILE__ ) . 'css/sixtenpress-editor.css', array(), SIXTENPRESSSHORTCODES_VERSION, 'screen' );
@@ -8,22 +8,22 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: includes/class-sixtenpress-shortcodes.php:111
#: includes/class-sixtenpress-shortcodes.php:115
msgid "Add Element"
msgstr ""
#: includes/class-sixtenpress-shortcodes.php:115
#: includes/class-sixtenpress-shortcodes.php:119
msgid "Create"
msgstr ""
#: includes/class-sixtenpress-shortcodes.php:116
#: includes/class-sixtenpress-shortcodes.php:120
msgid "Close"
msgstr ""
#: includes/class-sixtenpress-shortcodes.php:117
#: includes/class-sixtenpress-shortcodes.php:121
msgid "Cancel"
msgstr ""
#: includes/class-sixtenpress-shortcodes.php:118
#: includes/class-sixtenpress-shortcodes.php:122
msgid "Insert"
msgstr ""
@@ -10,7 +10,7 @@
* @author Robin Cornett <hello@robincornett.com>
* @copyright 2016 Robin Cornett <hello@robincornett.com>
* @license GPL-2.0+
* @version 0.3.2
* @version 0.3.3
* @link https://gitlab.com/robincornett/sixtenpress-shortcodes
* @since 0.1.0
*/
@@ -37,7 +37,7 @@
* Loader versioning: http://jtsternberg.github.io/wp-lib-loader/
*/
if ( ! class_exists( 'SixTenPressShortcodes_032', false ) ) {
if ( ! class_exists( 'SixTenPressShortcodes_033', false ) ) {
/**
* Versioned loader class-name
@@ -48,18 +48,18 @@ if ( ! class_exists( 'SixTenPressShortcodes_032', false ) ) {
* @package SixTenPressShortcodes
* @author Robin Cornett <hello@robincornett.com>
* @license GPL-2.0+
* @version 0.3.2
* @version 0.3.3
* @link https://gitlab.com/robincornett/sixtenpress-shortcodes
* @since 0.1.0
*/
class SixTenPressShortcodes_032 {
class SixTenPressShortcodes_033 {
/**
* SixTenPressShortcodes version number
* @var string
* @since 0.1.0
*/
const VERSION = '0.3.2';
const VERSION = '0.3.3';
/**
* Current version hook priority.
@@ -68,7 +68,7 @@ if ( ! class_exists( 'SixTenPressShortcodes_032', false ) ) {
* @var int
* @since 0.1.0
*/
const PRIORITY = 9992;
const PRIORITY = 9991;
/**
* Starts the version checking process.
@@ -152,5 +152,5 @@ if ( ! class_exists( 'SixTenPressShortcodes_032', false ) ) {
}
// Kick it off.
new SixTenPressShortcodes_032();
new SixTenPressShortcodes_033();
}