Version Description
(December 16, 2016) =
* Change shortcode formatting to add a space before the self-closing trailing slash.
* Fix alignment of attachment previews with long filenames.
* Bug fix: Set an initial value on select fields (previously, no value would be set for a select field unless the user interacts with the field).
* Enhancement/fix: Reuse one copy of the media modal and reset its state upon closing, rather than creating duplicate markup each time the modal is accessed.
* Compatability: Uses "full" version of select2.js 4.0.3 to prevent plugin conflicts with other plugins which expect the full version to be enqueued.
* Compatability: Add SELECT2_NOCONFLICT
flag to load Select2 in a unique namespace to prevent conflicts with other plugins which are loading select2.js version 3.
* Added Norwegian translation.
* Multiple coding style fixes.
Release Info
Developer | goldenapples |
Plugin | Shortcake (Shortcode UI) |
Version | 0.7.1 |
Comparing to | |
See all releases |
Code changes from version 0.7.0 to 0.7.1
- Gruntfile.js +1 -1
- css/sass/_field-image.scss +6 -1
- css/shortcode-ui.css +4 -1
- css/shortcode-ui.css.map +1 -1
- inc/class-shortcode-ui.php +23 -7
- inc/fields/{class-field-attachment.php → class-shortcode-ui-field-attachment.php} +6 -6
- inc/fields/{class-field-color.php → class-shortcode-ui-field-color.php} +4 -4
- inc/fields/{class-field-post-select.php → class-shortcode-ui-field-post-select.php} +18 -4
- inc/fields/{class-field-term-select.php → class-shortcode-ui-field-term-select.php} +15 -4
- inc/fields/{class-field-user-select.php → class-shortcode-ui-field-user-select.php} +14 -7
- js/build/shortcode-ui.js +118 -55
- js/src/controllers/media-controller.js +46 -3
- js/src/models/shortcode.js +1 -1
- js/src/shortcode-ui.js +21 -6
- js/src/utils/shortcode-view-constructor.js +20 -6
- js/src/views/edit-attribute-field.js +9 -0
- js/src/views/media-frame.js +17 -36
- js/src/views/select2-field.js +3 -3
- js/src/views/shortcode-ui.js +2 -1
- languages/shortcode-ui-nb_NO.mo +0 -0
- languages/shortcode-ui-nb_NO.po +184 -0
- languages/shortcode-ui.pot +75 -39
- readme.txt +25 -5
- shortcode-ui.php +20 -14
@@ -73,7 +73,7 @@ module.exports = function( grunt ) {
|
|
73 |
src: './'
|
74 |
},
|
75 |
options: {
|
76 |
-
bin: "vendor/bin/phpcs --extensions=php --ignore=\"*/vendor/*,*/node_modules/*,dev.php\"",
|
77 |
standard: "phpcs.ruleset.xml"
|
78 |
}
|
79 |
},
|
73 |
src: './'
|
74 |
},
|
75 |
options: {
|
76 |
+
bin: "vendor/bin/phpcs --extensions=php --ignore=\"*/php-tests/*,*/vendor/*,*/node_modules/*,dev.php\"",
|
77 |
standard: "phpcs.ruleset.xml"
|
78 |
}
|
79 |
},
|
@@ -7,9 +7,14 @@
|
|
7 |
}
|
8 |
|
9 |
.shortcake-attachment-preview {
|
10 |
-
|
|
|
11 |
margin: 0 20px 20px 0;
|
12 |
width: 150px;
|
|
|
|
|
|
|
|
|
13 |
}
|
14 |
|
15 |
.shortcode-ui-field-attachment .description {
|
7 |
}
|
8 |
|
9 |
.shortcake-attachment-preview {
|
10 |
+
display: inline-block;
|
11 |
+
vertical-align: top;
|
12 |
margin: 0 20px 20px 0;
|
13 |
width: 150px;
|
14 |
+
|
15 |
+
div.filename{
|
16 |
+
word-wrap: break-word;
|
17 |
+
}
|
18 |
}
|
19 |
|
20 |
.shortcode-ui-field-attachment .description {
|
@@ -115,9 +115,12 @@
|
|
115 |
margin-bottom: 15px; }
|
116 |
|
117 |
.edit-shortcode-form .shortcake-attachment-preview {
|
118 |
-
|
|
|
119 |
margin: 0 20px 20px 0;
|
120 |
width: 150px; }
|
|
|
|
|
121 |
|
122 |
.edit-shortcode-form .shortcode-ui-field-attachment .description {
|
123 |
margin: 10px 0; }
|
115 |
margin-bottom: 15px; }
|
116 |
|
117 |
.edit-shortcode-form .shortcake-attachment-preview {
|
118 |
+
display: inline-block;
|
119 |
+
vertical-align: top;
|
120 |
margin: 0 20px 20px 0;
|
121 |
width: 150px; }
|
122 |
+
.edit-shortcode-form .shortcake-attachment-preview div.filename {
|
123 |
+
word-wrap: break-word; }
|
124 |
|
125 |
.edit-shortcode-form .shortcode-ui-field-attachment .description {
|
126 |
margin: 10px 0; }
|
@@ -1 +1 @@
|
|
1 |
-
{"version":3,"sources":["sass/shortcode-ui.scss","sass/_field-image.scss","sass/_select2-fields.scss"],"names":[],"mappings":"AAAA;EACC,mBAAmB,EACnB;;AAED;EAGE,iBAAiB;EACjB,kBAAkB;EAClB,aAAa,EACb;;AANF;EASE,UAAU,EACV;;AAIF;EACC,gBAAgB,EAuDhB;EAxDD;IAIE,aAAa;IACb,YAAY;IAEZ,kFAAqE;IACrE,iBAAiB;IACjB,gBAAgB;IAChB,mBAAmB;IACnB,mBAAmB;IACnB,aAAa;IACb,cAAc,EAyCd;IAtDF;MAgBG,mBAAmB;MACnB,cAAc;MACd,gBAAgB,EAgBhB;MAlCH;;QAsBI,mBAAmB;QACnB,SAAS;QACT,UAAU;QACV,yCAAoB;gBAApB,iCAAoB;QACpB,mBAAmB;QACnB,qBAAqB;QACrB,YAAY;QACZ,aAAa;QACb,eAAe;QACf,gBAAgB,EAChB;IAhCJ;MAqCG,uBAAuB;MACvB,mBAAmB;MACnB,UAAU;MACV,QAAQ;MACR,YAAY;MACZ,UAAU;MACV,iBAAiB;MACjB,aAAa;MACb,iBAAiB;MACjB,iBAAiB;MACjB,sBAAsB;MACtB,mBAAmB;MACnB,kBAAkB;MAClB,qCAAgB;MAEhB,gDAAgC,EAChC;;AAKH;EAEE,aAAa;EACb,qBAAqB,EACrB;;AAJF;EAOE,cAAc;EACd,2BAA2B,EAC3B;;AATF;EAYE,8BAA8B,EAC9B;;AAbF;EAgBE,mBAAmB;EACnB,aAAa,EACb;;AAGF;EAEC,kBAAkB,EA2DlB;EA7DD;IAKE,eAAe;IACf,YAAY,EACZ;EAPF;;IAWE,uBAAuB;IAEvB,gDAAgC;IAChC,uBAAuB;IACvB,YAAY;IACZ,cAAc;IACd,mDAAmD;IACnD,2CAA2C;IAC3C,gBAAgB,EAChB;EApBF;IAwBE,iBAAiB,EACjB;EAzBF;IA4BE,sBAAsB;IACtB,iBAAiB;IACjB,oBAAoB,EACpB;EA/BF;IAkCE,YAAY;IACZ,gBAAgB;IAChB,kBAAkB,EAClB;EArCF;IAwCU,oBAAoB,EAAI;EAxClC;IA4CE,eAAe,EAKf;IAjDF;MA8CG,eAAe;MACf,oBAAoB,EACpB;EAhDH;IAuDE,kBAAkB,EAClB;IAxDF;MAqDG,sBAAsB,EACtB;EAtDH;IA2DE,YAAY,EACZ;;AC7JF;EAGE,eAAe;EACf,YAAY;EACZ,oBAAoB,EACpB;;AANF;EASE,
|
1 |
+
{"version":3,"sources":["sass/shortcode-ui.scss","sass/_field-image.scss","sass/_select2-fields.scss"],"names":[],"mappings":"AAAA;EACC,mBAAmB,EACnB;;AAED;EAGE,iBAAiB;EACjB,kBAAkB;EAClB,aAAa,EACb;;AANF;EASE,UAAU,EACV;;AAIF;EACC,gBAAgB,EAuDhB;EAxDD;IAIE,aAAa;IACb,YAAY;IAEZ,kFAAqE;IACrE,iBAAiB;IACjB,gBAAgB;IAChB,mBAAmB;IACnB,mBAAmB;IACnB,aAAa;IACb,cAAc,EAyCd;IAtDF;MAgBG,mBAAmB;MACnB,cAAc;MACd,gBAAgB,EAgBhB;MAlCH;;QAsBI,mBAAmB;QACnB,SAAS;QACT,UAAU;QACV,yCAAoB;gBAApB,iCAAoB;QACpB,mBAAmB;QACnB,qBAAqB;QACrB,YAAY;QACZ,aAAa;QACb,eAAe;QACf,gBAAgB,EAChB;IAhCJ;MAqCG,uBAAuB;MACvB,mBAAmB;MACnB,UAAU;MACV,QAAQ;MACR,YAAY;MACZ,UAAU;MACV,iBAAiB;MACjB,aAAa;MACb,iBAAiB;MACjB,iBAAiB;MACjB,sBAAsB;MACtB,mBAAmB;MACnB,kBAAkB;MAClB,qCAAgB;MAEhB,gDAAgC,EAChC;;AAKH;EAEE,aAAa;EACb,qBAAqB,EACrB;;AAJF;EAOE,cAAc;EACd,2BAA2B,EAC3B;;AATF;EAYE,8BAA8B,EAC9B;;AAbF;EAgBE,mBAAmB;EACnB,aAAa,EACb;;AAGF;EAEC,kBAAkB,EA2DlB;EA7DD;IAKE,eAAe;IACf,YAAY,EACZ;EAPF;;IAWE,uBAAuB;IAEvB,gDAAgC;IAChC,uBAAuB;IACvB,YAAY;IACZ,cAAc;IACd,mDAAmD;IACnD,2CAA2C;IAC3C,gBAAgB,EAChB;EApBF;IAwBE,iBAAiB,EACjB;EAzBF;IA4BE,sBAAsB;IACtB,iBAAiB;IACjB,oBAAoB,EACpB;EA/BF;IAkCE,YAAY;IACZ,gBAAgB;IAChB,kBAAkB,EAClB;EArCF;IAwCU,oBAAoB,EAAI;EAxClC;IA4CE,eAAe,EAKf;IAjDF;MA8CG,eAAe;MACf,oBAAoB,EACpB;EAhDH;IAuDE,kBAAkB,EAClB;IAxDF;MAqDG,sBAAsB,EACtB;EAtDH;IA2DE,YAAY,EACZ;;AC7JF;EAGE,eAAe;EACf,YAAY;EACZ,oBAAoB,EACpB;;AANF;EASE,sBAAsB;EACtB,oBAAoB;EACpB,sBAAsB;EACtB,aAAa,EAKb;EAjBF;IAeG,sBAAsB,EACtB;;AAhBH;EAoBE,eAAe,EACf;;AArBF;EAyBE,wBAAwB;EACxB,yBAAyB;EACzB,sBAAsB;EACtB,mBAAmB;EACnB,mBAAmB;EACnB,WAAW,EAmFX;EAjHF;IAiCG,cAAc,EACd;EAlCH;IAsCG,WAAW;IACX,eAAe;IACf,mBAAmB;IACnB,SAAS;IACT,WAAW;IACX,uBAAuB;IACvB,0CAA0B;IAC1B,kBAAkB;IAClB,mBAAmB;IACnB,YAAY;IACZ,aAAa;IACb,WAAW;IACX,iBAAgB,EAUhB;IA5DH;MAqDI,iBAAiB;MACjB,mBAAmB;MACnB,UAAU;MACV,UAAU;MACV,gBAAgB;MAChB,eAAe,EACf;EA3DJ;IA+DG,gBAAgB;IAChB,iBAAiB;IACjB,YAAY;IACZ,aAAa,EACb;EAnEH;;IAuEG,cAAc,EACd;EAxEH;IA2EG,eAAe;IACf,mBAAmB;IACnB,YAAY;IACZ,aAAa,EACb;EA/EH;IAmFI,gBAAgB;IAChB,cAAc;IACd,mBAAmB;IACnB,YAAY;IACZ,mBAAmB;IACnB,uBAAuB,EACvB;EAzFJ;IA2FI,YAAY;IACZ,YAAY;IACZ,iBAAiB;IACjB,8BAA8B;IAC9B,qBAAqB,EAWrB;IA1GJ;MAkGK,0BAA0B;MAC1B,oBAAoB;MACpB,YAAY;MACZ,YAAY;MACZ,eAAe;MACf,sEAAsE;MACtE,8DAA8D,EAC9D;EAzGL;IA8GG,mBACA,EAAC;;AAMJ;EACC,cAAc,EAKd;EAND;IAIE,eAAe,EACf;;AAGF;EACC;IACC,mBAAmB,EAAA;EAEpB;IACC,kBAAkB,EAAA,EAAA;;AAIpB;EACC;IACC,mBAAmB,EAAA;EAEpB;IACC,kBAAkB,EAAA,EAAA;;AC3IpB;EAEE,iBAAiB,EACjB;;AAHF;EAME,iBAAiB;EACjB,yBAAyB,EACzB;;AARF;EAWE,gBAAgB,EAChB;;AAZF;EAeE,UAAU,EACV;;AAhBF;EAmBE,oBAAoB,EACpB;;AApBF;EAuBE,gBAAgB,EAChB;;AAxBF;EA2BE,iBAAiB;EACjB,mBAAmB;EACnB,gDAAgC;EAChC,uBAAuB;EACvB,YAAY;EACZ,cAAc,EACd;;AAjCF;EAoCE,sBAAsB;EACtB,4CAAwB,EACxB;;AAIF;EACC,gBAAgB;EAChB,iBAAiB,EACjB;;AAED;EACC,UAAU,EACV","file":"shortcode-ui.css"}
|
@@ -37,6 +37,14 @@ class Shortcode_UI {
|
|
37 |
*/
|
38 |
private static $instance;
|
39 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
/**
|
41 |
* Get instance of Shortcake controller.
|
42 |
*
|
@@ -197,14 +205,20 @@ class Shortcode_UI {
|
|
197 |
public function action_admin_enqueue_scripts( $editor_supports ) {
|
198 |
add_editor_style( trailingslashit( $this->plugin_url ) . 'css/shortcode-ui-editor-styles.css' );
|
199 |
|
200 |
-
$min = '';
|
201 |
|
202 |
-
wp_register_script(
|
203 |
-
trailingslashit( $this->plugin_url ) . "lib/select2/js/select2{$min}.js",
|
204 |
array( 'jquery', 'jquery-ui-sortable' ), '4.0.3'
|
205 |
);
|
206 |
-
|
207 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
208 |
null, '4.0.3'
|
209 |
);
|
210 |
}
|
@@ -247,7 +261,8 @@ class Shortcode_UI {
|
|
247 |
'strings' => array(
|
248 |
'media_frame_title' => __( 'Insert Post Element', 'shortcode-ui' ),
|
249 |
'media_frame_menu_insert_label' => __( 'Insert Post Element', 'shortcode-ui' ),
|
250 |
-
|
|
|
251 |
'media_frame_toolbar_insert_label' => __( 'Insert Element', 'shortcode-ui' ),
|
252 |
'media_frame_toolbar_update_label' => __( 'Update', 'shortcode-ui' ),
|
253 |
'media_frame_no_attributes_message' => __( 'There are no attributes to configure for this Post Element.', 'shortcode-ui' ),
|
@@ -255,10 +270,11 @@ class Shortcode_UI {
|
|
255 |
'search_placeholder' => __( 'Search', 'shortcode-ui' ),
|
256 |
'insert_content_label' => __( 'Insert Content', 'shortcode-ui' ),
|
257 |
),
|
258 |
-
'nonces'
|
259 |
'preview' => wp_create_nonce( 'shortcode-ui-preview' ),
|
260 |
'thumbnailImage' => wp_create_nonce( 'shortcode-ui-get-thumbnail-image' ),
|
261 |
),
|
|
|
262 |
) );
|
263 |
|
264 |
// add templates to the footer, instead of where we're at now
|
37 |
*/
|
38 |
private static $instance;
|
39 |
|
40 |
+
/**
|
41 |
+
* Select2 library handle.
|
42 |
+
*
|
43 |
+
* @access public
|
44 |
+
* @var string
|
45 |
+
*/
|
46 |
+
public static $select2_handle = 'select2';
|
47 |
+
|
48 |
/**
|
49 |
* Get instance of Shortcake controller.
|
50 |
*
|
205 |
public function action_admin_enqueue_scripts( $editor_supports ) {
|
206 |
add_editor_style( trailingslashit( $this->plugin_url ) . 'css/shortcode-ui-editor-styles.css' );
|
207 |
|
208 |
+
$min = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
|
209 |
|
210 |
+
wp_register_script( self::$select2_handle,
|
211 |
+
trailingslashit( $this->plugin_url ) . "lib/select2/js/select2.full{$min}.js",
|
212 |
array( 'jquery', 'jquery-ui-sortable' ), '4.0.3'
|
213 |
);
|
214 |
+
|
215 |
+
if ( 'select2' !== self::$select2_handle ) {
|
216 |
+
wp_add_inline_script( self::$select2_handle, 'var existingSelect2 = jQuery.fn.select2 || null; if (existingSelect2) { delete jQuery.fn.select2; }', 'before' );
|
217 |
+
wp_add_inline_script( self::$select2_handle, 'jQuery.fn[ shortcodeUIData.select2_handle ] = jQuery.fn.select2; if (existingSelect2) { delete jQuery.fn.select2; jQuery.fn.select2 = existingSelect2; }', 'after' );
|
218 |
+
}
|
219 |
+
|
220 |
+
wp_register_style( self::$select2_handle,
|
221 |
+
trailingslashit( $this->plugin_url ) . "lib/select2/css/select2{$min}.css",
|
222 |
null, '4.0.3'
|
223 |
);
|
224 |
}
|
261 |
'strings' => array(
|
262 |
'media_frame_title' => __( 'Insert Post Element', 'shortcode-ui' ),
|
263 |
'media_frame_menu_insert_label' => __( 'Insert Post Element', 'shortcode-ui' ),
|
264 |
+
/* Translators: Ignore placeholder. This is replaced with the Shortcode name string in JS */
|
265 |
+
'media_frame_menu_update_label' => __( '%s Details', 'shortcode-ui' ),
|
266 |
'media_frame_toolbar_insert_label' => __( 'Insert Element', 'shortcode-ui' ),
|
267 |
'media_frame_toolbar_update_label' => __( 'Update', 'shortcode-ui' ),
|
268 |
'media_frame_no_attributes_message' => __( 'There are no attributes to configure for this Post Element.', 'shortcode-ui' ),
|
270 |
'search_placeholder' => __( 'Search', 'shortcode-ui' ),
|
271 |
'insert_content_label' => __( 'Insert Content', 'shortcode-ui' ),
|
272 |
),
|
273 |
+
'nonces' => array(
|
274 |
'preview' => wp_create_nonce( 'shortcode-ui-preview' ),
|
275 |
'thumbnailImage' => wp_create_nonce( 'shortcode-ui-get-thumbnail-image' ),
|
276 |
),
|
277 |
+
'select2_handle' => self::$select2_handle,
|
278 |
) );
|
279 |
|
280 |
// add templates to the footer, instead of where we're at now
|
@@ -1,12 +1,12 @@
|
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
-
* Primary controller class for
|
5 |
*/
|
6 |
-
class
|
7 |
|
8 |
/**
|
9 |
-
*
|
10 |
*
|
11 |
* @access private
|
12 |
* @var object
|
@@ -35,11 +35,11 @@ class Shortcake_Field_Attachment {
|
|
35 |
);
|
36 |
|
37 |
/**
|
38 |
-
* Get instance of
|
39 |
*
|
40 |
* Instantiates object on the fly when not already loaded.
|
41 |
*
|
42 |
-
* @return
|
43 |
*/
|
44 |
public static function get_instance() {
|
45 |
if ( ! isset( self::$instance ) ) {
|
@@ -69,7 +69,7 @@ class Shortcake_Field_Attachment {
|
|
69 |
}
|
70 |
|
71 |
/**
|
72 |
-
* Add localization data needed for
|
73 |
*/
|
74 |
public function action_enqueue_shortcode_ui() {
|
75 |
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
+
* Primary controller class for Shortcode UI Attachment Field
|
5 |
*/
|
6 |
+
class Shortcode_UI_Field_Attachment {
|
7 |
|
8 |
/**
|
9 |
+
* Shortcode UI Attachment Field controller instance.
|
10 |
*
|
11 |
* @access private
|
12 |
* @var object
|
35 |
);
|
36 |
|
37 |
/**
|
38 |
+
* Get instance of Shortcode UI Attachment Field controller.
|
39 |
*
|
40 |
* Instantiates object on the fly when not already loaded.
|
41 |
*
|
42 |
+
* @return Shortcode_UI_Field_Attachment
|
43 |
*/
|
44 |
public static function get_instance() {
|
45 |
if ( ! isset( self::$instance ) ) {
|
69 |
}
|
70 |
|
71 |
/**
|
72 |
+
* Add localization data needed for Shortcode UI Attachment Field
|
73 |
*/
|
74 |
public function action_enqueue_shortcode_ui() {
|
75 |
|
@@ -1,12 +1,12 @@
|
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
-
* Primary controller class for
|
5 |
*/
|
6 |
-
class
|
7 |
|
8 |
/**
|
9 |
-
*
|
10 |
*
|
11 |
* @access private
|
12 |
* @var object
|
@@ -35,7 +35,7 @@ class Shortcake_Field_Color {
|
|
35 |
);
|
36 |
|
37 |
/**
|
38 |
-
* Get instance of
|
39 |
*
|
40 |
* Instantiates object on the fly when not already loaded.
|
41 |
*
|
1 |
<?php
|
2 |
|
3 |
/**
|
4 |
+
* Primary controller class for Shortcode UI Color Field
|
5 |
*/
|
6 |
+
class Shortcode_UI_Field_Color {
|
7 |
|
8 |
/**
|
9 |
+
* Shortcode UI Color Field controller instance.
|
10 |
*
|
11 |
* @access private
|
12 |
* @var object
|
35 |
);
|
36 |
|
37 |
/**
|
38 |
+
* Get instance of Shortcode UI Color Field controller.
|
39 |
*
|
40 |
* Instantiates object on the fly when not already loaded.
|
41 |
*
|
@@ -15,6 +15,10 @@ class Shortcode_UI_Field_Post_Select {
|
|
15 |
),
|
16 |
);
|
17 |
|
|
|
|
|
|
|
|
|
18 |
public static function get_instance() {
|
19 |
if ( ! isset( self::$instance ) ) {
|
20 |
self::$instance = new self;
|
@@ -38,8 +42,8 @@ class Shortcode_UI_Field_Post_Select {
|
|
38 |
|
39 |
public function action_enqueue_shortcode_ui() {
|
40 |
|
41 |
-
wp_enqueue_script(
|
42 |
-
wp_enqueue_style(
|
43 |
|
44 |
wp_localize_script( 'shortcode-ui', 'shortcodeUiPostFieldData', array(
|
45 |
'nonce' => wp_create_nonce( 'shortcode_ui_field_post_select' ),
|
@@ -81,7 +85,12 @@ class Shortcode_UI_Field_Post_Select {
|
|
81 |
$nonce = isset( $_GET['nonce'] ) ? sanitize_text_field( $_GET['nonce'] ) : null;
|
82 |
$requested_shortcode = isset( $_GET['shortcode'] ) ? sanitize_text_field( $_GET['shortcode'] ) : null;
|
83 |
$requested_attr = isset( $_GET['attr'] ) ? sanitize_text_field( $_GET['attr'] ) : null;
|
84 |
-
|
|
|
|
|
|
|
|
|
|
|
85 |
|
86 |
$shortcodes = Shortcode_UI::get_instance()->get_shortcodes();
|
87 |
|
@@ -129,7 +138,12 @@ class Shortcode_UI_Field_Post_Select {
|
|
129 |
$query = new WP_Query( $query_args );
|
130 |
|
131 |
foreach ( $query->posts as $post_id ) {
|
132 |
-
array_push( $response['items'],
|
|
|
|
|
|
|
|
|
|
|
133 |
}
|
134 |
|
135 |
$response['found_items'] = $query->found_posts;
|
15 |
),
|
16 |
);
|
17 |
|
18 |
+
/**
|
19 |
+
* Setup the instance.
|
20 |
+
* @return Shortcode_UI_Field_Post_Select
|
21 |
+
*/
|
22 |
public static function get_instance() {
|
23 |
if ( ! isset( self::$instance ) ) {
|
24 |
self::$instance = new self;
|
42 |
|
43 |
public function action_enqueue_shortcode_ui() {
|
44 |
|
45 |
+
wp_enqueue_script( Shortcode_UI::$select2_handle );
|
46 |
+
wp_enqueue_style( Shortcode_UI::$select2_handle );
|
47 |
|
48 |
wp_localize_script( 'shortcode-ui', 'shortcodeUiPostFieldData', array(
|
49 |
'nonce' => wp_create_nonce( 'shortcode_ui_field_post_select' ),
|
85 |
$nonce = isset( $_GET['nonce'] ) ? sanitize_text_field( $_GET['nonce'] ) : null;
|
86 |
$requested_shortcode = isset( $_GET['shortcode'] ) ? sanitize_text_field( $_GET['shortcode'] ) : null;
|
87 |
$requested_attr = isset( $_GET['attr'] ) ? sanitize_text_field( $_GET['attr'] ) : null;
|
88 |
+
|
89 |
+
$response = array(
|
90 |
+
'items' => array(),
|
91 |
+
'found_items' => 0,
|
92 |
+
'items_per_page' => 0,
|
93 |
+
);
|
94 |
|
95 |
$shortcodes = Shortcode_UI::get_instance()->get_shortcodes();
|
96 |
|
138 |
$query = new WP_Query( $query_args );
|
139 |
|
140 |
foreach ( $query->posts as $post_id ) {
|
141 |
+
array_push( $response['items'],
|
142 |
+
array(
|
143 |
+
'id' => $post_id,
|
144 |
+
'text' => html_entity_decode( get_the_title( $post_id ) ),
|
145 |
+
)
|
146 |
+
);
|
147 |
}
|
148 |
|
149 |
$response['found_items'] = $query->found_posts;
|
@@ -52,8 +52,8 @@ class Shortcode_UI_Field_Term_Select {
|
|
52 |
*/
|
53 |
public function action_enqueue_shortcode_ui() {
|
54 |
|
55 |
-
wp_enqueue_script(
|
56 |
-
wp_enqueue_style(
|
57 |
|
58 |
wp_localize_script( 'shortcode-ui', 'shortcodeUiTermFieldData', array(
|
59 |
'nonce' => wp_create_nonce( 'shortcode_ui_field_term_select' ),
|
@@ -96,7 +96,13 @@ class Shortcode_UI_Field_Term_Select {
|
|
96 |
$requested_attr = isset( $_GET['attr'] ) ? sanitize_text_field( $_GET['attr'] ) : null;
|
97 |
$page = isset( $_GET['page'] ) ? absint( $_GET['page'] ) : null;
|
98 |
$search = isset( $_GET['s'] ) ? sanitize_text_field( $_GET['s'] ) : '';
|
99 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
|
101 |
if ( ! wp_verify_nonce( $nonce, 'shortcode_ui_field_term_select' ) ) {
|
102 |
wp_send_json_error( $response );
|
@@ -158,7 +164,12 @@ class Shortcode_UI_Field_Term_Select {
|
|
158 |
$results = get_terms( $args );
|
159 |
|
160 |
foreach ( $results as $result ) {
|
161 |
-
array_push( $response['items'],
|
|
|
|
|
|
|
|
|
|
|
162 |
}
|
163 |
|
164 |
wp_send_json_success( $response );
|
52 |
*/
|
53 |
public function action_enqueue_shortcode_ui() {
|
54 |
|
55 |
+
wp_enqueue_script( Shortcode_UI::$select2_handle );
|
56 |
+
wp_enqueue_style( Shortcode_UI::$select2_handle );
|
57 |
|
58 |
wp_localize_script( 'shortcode-ui', 'shortcodeUiTermFieldData', array(
|
59 |
'nonce' => wp_create_nonce( 'shortcode_ui_field_term_select' ),
|
96 |
$requested_attr = isset( $_GET['attr'] ) ? sanitize_text_field( $_GET['attr'] ) : null;
|
97 |
$page = isset( $_GET['page'] ) ? absint( $_GET['page'] ) : null;
|
98 |
$search = isset( $_GET['s'] ) ? sanitize_text_field( $_GET['s'] ) : '';
|
99 |
+
|
100 |
+
$response = array(
|
101 |
+
'items' => array(),
|
102 |
+
'found_items' => 0,
|
103 |
+
'items_per_page' => 10,
|
104 |
+
'page' => $page,
|
105 |
+
);
|
106 |
|
107 |
if ( ! wp_verify_nonce( $nonce, 'shortcode_ui_field_term_select' ) ) {
|
108 |
wp_send_json_error( $response );
|
164 |
$results = get_terms( $args );
|
165 |
|
166 |
foreach ( $results as $result ) {
|
167 |
+
array_push( $response['items'],
|
168 |
+
array(
|
169 |
+
'id' => $result->term_id,
|
170 |
+
'text' => html_entity_decode( $result->name ),
|
171 |
+
)
|
172 |
+
);
|
173 |
}
|
174 |
|
175 |
wp_send_json_success( $response );
|
@@ -58,8 +58,8 @@ class Shortcode_UI_Field_User_Select {
|
|
58 |
*/
|
59 |
public function action_enqueue_shortcode_ui() {
|
60 |
|
61 |
-
wp_enqueue_script(
|
62 |
-
wp_enqueue_style(
|
63 |
|
64 |
wp_localize_script( 'shortcode-ui', 'shortcodeUiUserFieldData', array(
|
65 |
'nonce' => wp_create_nonce( 'shortcode_ui_field_user_select' ),
|
@@ -101,7 +101,12 @@ class Shortcode_UI_Field_User_Select {
|
|
101 |
$requested_attr = isset( $_GET['attr'] ) ? sanitize_text_field( wp_unslash( $_GET['attr'] ) ) : null;
|
102 |
$page = isset( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : null;
|
103 |
$search_str = isset( $_GET['s'] ) ? sanitize_text_field( wp_unslash( $_GET['s'] ) ) : null;
|
104 |
-
|
|
|
|
|
|
|
|
|
|
|
105 |
|
106 |
$include = null;
|
107 |
if ( isset( $_GET['include'] ) ) {
|
@@ -151,10 +156,12 @@ class Shortcode_UI_Field_User_Select {
|
|
151 |
$query = new WP_User_Query( $query_args );
|
152 |
|
153 |
foreach ( $query->get_results() as $user ) {
|
154 |
-
array_push( $response['items'],
|
155 |
-
|
156 |
-
|
157 |
-
|
|
|
|
|
158 |
}
|
159 |
|
160 |
$response['found_items'] = $query->get_total();
|
58 |
*/
|
59 |
public function action_enqueue_shortcode_ui() {
|
60 |
|
61 |
+
wp_enqueue_script( Shortcode_UI::$select2_handle );
|
62 |
+
wp_enqueue_style( Shortcode_UI::$select2_handle );
|
63 |
|
64 |
wp_localize_script( 'shortcode-ui', 'shortcodeUiUserFieldData', array(
|
65 |
'nonce' => wp_create_nonce( 'shortcode_ui_field_user_select' ),
|
101 |
$requested_attr = isset( $_GET['attr'] ) ? sanitize_text_field( wp_unslash( $_GET['attr'] ) ) : null;
|
102 |
$page = isset( $_GET['page'] ) ? sanitize_text_field( wp_unslash( $_GET['page'] ) ) : null;
|
103 |
$search_str = isset( $_GET['s'] ) ? sanitize_text_field( wp_unslash( $_GET['s'] ) ) : null;
|
104 |
+
|
105 |
+
$response = array(
|
106 |
+
'items' => array(),
|
107 |
+
'found_items' => 0,
|
108 |
+
'items_per_page' => 0,
|
109 |
+
);
|
110 |
|
111 |
$include = null;
|
112 |
if ( isset( $_GET['include'] ) ) {
|
156 |
$query = new WP_User_Query( $query_args );
|
157 |
|
158 |
foreach ( $query->get_results() as $user ) {
|
159 |
+
array_push( $response['items'],
|
160 |
+
array(
|
161 |
+
'id' => $user->ID,
|
162 |
+
'text' => html_entity_decode( $user->display_name ),
|
163 |
+
)
|
164 |
+
);
|
165 |
}
|
166 |
|
167 |
$response['found_items'] = $query->get_total();
|
@@ -36,9 +36,9 @@ module.exports = Shortcodes;
|
|
36 |
},{"./../models/shortcode.js":6}],3:[function(require,module,exports){
|
37 |
(function (global){
|
38 |
var Backbone = (typeof window !== "undefined" ? window['Backbone'] : typeof global !== "undefined" ? global['Backbone'] : null),
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
|
43 |
var MediaController = wp.media.controller.State.extend({
|
44 |
|
@@ -84,6 +84,49 @@ var MediaController = wp.media.controller.State.extend({
|
|
84 |
this.props.set( 'search', null );
|
85 |
},
|
86 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
87 |
});
|
88 |
|
89 |
sui.controllers.MediaController = MediaController;
|
@@ -238,7 +281,7 @@ Shortcode = Backbone.Model.extend({
|
|
238 |
template += "]{{ content }}[/{{ shortcode }}]";
|
239 |
} else {
|
240 |
// add closing slash to shortcodes without content
|
241 |
-
template += "/]";
|
242 |
}
|
243 |
|
244 |
template = template.replace( /{{ shortcode }}/g, this.get('shortcode_tag') );
|
@@ -280,8 +323,10 @@ $(document).ready(function(){
|
|
280 |
} );
|
281 |
|
282 |
$(document.body).on( 'click', '.shortcake-add-post-element', function( event ) {
|
283 |
-
|
284 |
-
|
|
|
|
|
285 |
options = {
|
286 |
frame: 'post',
|
287 |
state: 'shortcode-ui',
|
@@ -292,12 +337,25 @@ $(document).ready(function(){
|
|
292 |
|
293 |
// Remove focus from the `.shortcake-add-post-element` button.
|
294 |
// Prevents Opera from showing the outline of the button above the modal.
|
295 |
-
//
|
296 |
// See: https://core.trac.wordpress.org/ticket/22445
|
297 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
298 |
|
299 |
-
wp.media.editor.remove( editor );
|
300 |
-
wp.media.editor.open( editor, options );
|
301 |
} );
|
302 |
|
303 |
});
|
@@ -587,13 +645,27 @@ var shortcodeViewConstructor = {
|
|
587 |
|
588 |
if ( currentShortcode ) {
|
589 |
|
590 |
-
var
|
591 |
-
frame : "post",
|
592 |
-
state : 'shortcode-ui',
|
593 |
-
currentShortcode : currentShortcode,
|
594 |
-
});
|
595 |
|
596 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
597 |
|
598 |
/* Trigger render_edit */
|
599 |
/*
|
@@ -1143,6 +1215,15 @@ var editAttributeField = Backbone.View.extend( {
|
|
1143 |
data.options = this.parseOptions( data.options );
|
1144 |
}
|
1145 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1146 |
this.$el.html( this.template( data ) );
|
1147 |
this.triggerCallbacks();
|
1148 |
|
@@ -1451,41 +1532,33 @@ var mediaFrame = postMediaFrame.extend( {
|
|
1451 |
|
1452 |
var id = 'shortcode-ui';
|
1453 |
|
1454 |
-
|
1455 |
-
id
|
1456 |
-
search
|
1457 |
-
router
|
1458 |
-
toolbar
|
1459 |
-
menu
|
1460 |
-
title
|
1461 |
-
tabs
|
1462 |
-
priority: 66,
|
1463 |
-
content
|
1464 |
-
};
|
1465 |
-
|
1466 |
-
if ( 'currentShortcode' in this.options ) {
|
1467 |
-
opts.title = shortcodeUIData.strings.media_frame_menu_update_label.replace( /%s/, this.options.currentShortcode.attributes.label );
|
1468 |
-
}
|
1469 |
-
|
1470 |
-
this.mediaController = new MediaController( opts );
|
1471 |
|
1472 |
if ( 'currentShortcode' in this.options ) {
|
1473 |
-
this.mediaController.
|
1474 |
-
this.mediaController.props.set( 'action', 'update' );
|
1475 |
}
|
1476 |
|
1477 |
this.states.add([ this.mediaController ]);
|
1478 |
|
1479 |
this.on( 'content:render:' + id + '-content-insert', _.bind( this.contentRender, this, 'shortcode-ui', 'insert' ) );
|
1480 |
this.on( 'toolbar:create:' + id + '-toolbar', this.toolbarCreate, this );
|
1481 |
-
this.on( 'toolbar:render:' + id + '-toolbar', this.toolbarRender, this );
|
1482 |
this.on( 'menu:render:default', this.renderShortcodeUIMenu );
|
1483 |
|
1484 |
},
|
1485 |
|
1486 |
events: function() {
|
1487 |
return _.extend( {}, postMediaFrame.prototype.events, {
|
1488 |
-
'click .media-menu-item'
|
1489 |
} );
|
1490 |
},
|
1491 |
|
@@ -1505,15 +1578,15 @@ var mediaFrame = postMediaFrame.extend( {
|
|
1505 |
);
|
1506 |
},
|
1507 |
|
1508 |
-
toolbarRender: function( toolbar ) {},
|
1509 |
-
|
1510 |
toolbarCreate : function( toolbar ) {
|
|
|
1511 |
var text = shortcodeUIData.strings.media_frame_toolbar_insert_label;
|
1512 |
-
|
|
|
1513 |
text = shortcodeUIData.strings.media_frame_toolbar_update_label;
|
1514 |
}
|
1515 |
|
1516 |
-
toolbar.view = new
|
1517 |
controller : this,
|
1518 |
items: {
|
1519 |
insert: {
|
@@ -1536,17 +1609,6 @@ var mediaFrame = postMediaFrame.extend( {
|
|
1536 |
priority: 65
|
1537 |
})
|
1538 |
});
|
1539 |
-
|
1540 |
-
// Hide menu if editing.
|
1541 |
-
// @todo - fix this.
|
1542 |
-
// This is a hack.
|
1543 |
-
// I just can't work out how to do it properly...
|
1544 |
-
if ( view.controller.state().props && view.controller.state().props.get( 'currentShortcode' ) ) {
|
1545 |
-
window.setTimeout( function() {
|
1546 |
-
view.controller.$el.addClass( 'hide-menu' );
|
1547 |
-
} );
|
1548 |
-
}
|
1549 |
-
|
1550 |
},
|
1551 |
|
1552 |
insertAction: function() {
|
@@ -1759,7 +1821,7 @@ sui.views.editAttributeSelect2Field = sui.views.editAttributeField.extend( {
|
|
1759 |
|
1760 |
this.preselect( $field );
|
1761 |
|
1762 |
-
|
1763 |
placeholder: "Search",
|
1764 |
multiple: this.model.get( 'multiple' ),
|
1765 |
|
@@ -1825,7 +1887,7 @@ sui.controllers.MediaController = mediaController.extend({
|
|
1825 |
},
|
1826 |
|
1827 |
destroySelect2UI: function() {
|
1828 |
-
|
1829 |
}
|
1830 |
|
1831 |
});
|
@@ -1918,7 +1980,7 @@ var Shortcode_UI = Backbone.View.extend({
|
|
1918 |
},
|
1919 |
|
1920 |
select: function(e) {
|
1921 |
-
|
1922 |
var target = $(e.currentTarget).closest( '.shortcode-list-item' );
|
1923 |
var shortcode = sui.shortcodes.findWhere( { shortcode_tag: target.attr( 'data-shortcode' ) } );
|
1924 |
|
@@ -1926,6 +1988,7 @@ var Shortcode_UI = Backbone.View.extend({
|
|
1926 |
return;
|
1927 |
}
|
1928 |
|
|
|
1929 |
this.controller.props.set( 'currentShortcode', shortcode.clone() );
|
1930 |
|
1931 |
this.render();
|
36 |
},{"./../models/shortcode.js":6}],3:[function(require,module,exports){
|
37 |
(function (global){
|
38 |
var Backbone = (typeof window !== "undefined" ? window['Backbone'] : typeof global !== "undefined" ? global['Backbone'] : null),
|
39 |
+
wp = (typeof window !== "undefined" ? window['wp'] : typeof global !== "undefined" ? global['wp'] : null),
|
40 |
+
sui = require('./../utils/sui.js'),
|
41 |
+
Shortcodes = require('./../collections/shortcodes.js');
|
42 |
|
43 |
var MediaController = wp.media.controller.State.extend({
|
44 |
|
84 |
this.props.set( 'search', null );
|
85 |
},
|
86 |
|
87 |
+
setActionSelect: function() {
|
88 |
+
this.attributes.title = shortcodeUIData.strings.media_frame_menu_insert_label;
|
89 |
+
this.props.set( 'currentShortcode', null );
|
90 |
+
this.props.set( 'action', 'select' );
|
91 |
+
|
92 |
+
// Update menuItem text.
|
93 |
+
var menuItem = this.frame.menu.get().get('shortcode-ui');
|
94 |
+
menuItem.options.text = this.attributes.title;
|
95 |
+
menuItem.render();
|
96 |
+
|
97 |
+
this.frame.setState( 'shortcode-ui' );
|
98 |
+
this.frame.render();
|
99 |
+
},
|
100 |
+
|
101 |
+
setActionUpdate: function( currentShortcode ) {
|
102 |
+
|
103 |
+
this.attributes.title = shortcodeUIData.strings.media_frame_menu_update_label;
|
104 |
+
this.attributes.title = this.attributes.title.replace( /%s/, currentShortcode.attributes.label );
|
105 |
+
|
106 |
+
this.props.set( 'currentShortcode', currentShortcode );
|
107 |
+
this.props.set( 'action', 'update' );
|
108 |
+
|
109 |
+
// If a new frame is being created, it may not exist yet.
|
110 |
+
// Defer to ensure it does.
|
111 |
+
_.defer( function() {
|
112 |
+
|
113 |
+
this.frame.setState( 'shortcode-ui' );
|
114 |
+
this.frame.content.render();
|
115 |
+
|
116 |
+
this.toggleSidebar( true );
|
117 |
+
|
118 |
+
this.frame.once( 'close', function() {
|
119 |
+
this.frame.mediaController.toggleSidebar( false );
|
120 |
+
}.bind( this ) );
|
121 |
+
|
122 |
+
}.bind( this ) );
|
123 |
+
|
124 |
+
},
|
125 |
+
|
126 |
+
toggleSidebar: function( show ) {
|
127 |
+
this.frame.$el.toggleClass( 'hide-menu', show );
|
128 |
+
},
|
129 |
+
|
130 |
});
|
131 |
|
132 |
sui.controllers.MediaController = MediaController;
|
281 |
template += "]{{ content }}[/{{ shortcode }}]";
|
282 |
} else {
|
283 |
// add closing slash to shortcodes without content
|
284 |
+
template += " /]";
|
285 |
}
|
286 |
|
287 |
template = template.replace( /{{ shortcode }}/g, this.get('shortcode_tag') );
|
323 |
} );
|
324 |
|
325 |
$(document.body).on( 'click', '.shortcake-add-post-element', function( event ) {
|
326 |
+
|
327 |
+
var $el = $( event.currentTarget ),
|
328 |
+
editor = $el.data('editor'),
|
329 |
+
frame = wp.media.editor.get( editor ),
|
330 |
options = {
|
331 |
frame: 'post',
|
332 |
state: 'shortcode-ui',
|
337 |
|
338 |
// Remove focus from the `.shortcake-add-post-element` button.
|
339 |
// Prevents Opera from showing the outline of the button above the modal.
|
|
|
340 |
// See: https://core.trac.wordpress.org/ticket/22445
|
341 |
+
$el.blur();
|
342 |
+
|
343 |
+
if ( frame ) {
|
344 |
+
frame.mediaController.setActionSelect();
|
345 |
+
frame.open();
|
346 |
+
} else {
|
347 |
+
frame = wp.media.editor.open( editor, options );
|
348 |
+
}
|
349 |
+
|
350 |
+
// Make sure to reset state when closed.
|
351 |
+
frame.once( 'close submit', function() {
|
352 |
+
frame.state().props.set('currentShortcode', false);
|
353 |
+
var menuItem = frame.menu.get().get('shortcode-ui');
|
354 |
+
menuItem.options.text = shortcodeUIData.strings.media_frame_title;
|
355 |
+
menuItem.render();
|
356 |
+
frame.setState( 'insert' );
|
357 |
+
} );
|
358 |
|
|
|
|
|
359 |
} );
|
360 |
|
361 |
});
|
645 |
|
646 |
if ( currentShortcode ) {
|
647 |
|
648 |
+
var frame = wp.media.editor.get( window.wpActiveEditor );
|
|
|
|
|
|
|
|
|
649 |
|
650 |
+
if ( frame ) {
|
651 |
+
frame.mediaController.setActionUpdate( currentShortcode );
|
652 |
+
frame.open();
|
653 |
+
} else {
|
654 |
+
frame = wp.media.editor.open( window.wpActiveEditor, {
|
655 |
+
frame : "post",
|
656 |
+
state : 'shortcode-ui',
|
657 |
+
currentShortcode : currentShortcode,
|
658 |
+
});
|
659 |
+
}
|
660 |
+
|
661 |
+
// Make sure to reset state when closed.
|
662 |
+
frame.once( 'close submit', function() {
|
663 |
+
frame.state().props.set('currentShortcode', false);
|
664 |
+
var menuItem = frame.menu.get().get('shortcode-ui');
|
665 |
+
menuItem.options.text = shortcodeUIData.strings.media_frame_title;
|
666 |
+
menuItem.render();
|
667 |
+
frame.setState( 'insert' );
|
668 |
+
} );
|
669 |
|
670 |
/* Trigger render_edit */
|
671 |
/*
|
1215 |
data.options = this.parseOptions( data.options );
|
1216 |
}
|
1217 |
|
1218 |
+
// Ensure default value for select field.
|
1219 |
+
if ( 'select' === data.type && '' === this.model.get( 'value' ) && ! _.findWhere( data.options, { value: '' } ) ) {
|
1220 |
+
var firstVisibleOption = _.first( data.options );
|
1221 |
+
if ( 'undefined' !== typeof firstVisibleOption.value ) {
|
1222 |
+
this.setValue( firstVisibleOption.value );
|
1223 |
+
data.value = firstVisibleOption.value;
|
1224 |
+
}
|
1225 |
+
}
|
1226 |
+
|
1227 |
this.$el.html( this.template( data ) );
|
1228 |
this.triggerCallbacks();
|
1229 |
|
1532 |
|
1533 |
var id = 'shortcode-ui';
|
1534 |
|
1535 |
+
this.mediaController = new MediaController({
|
1536 |
+
id : id,
|
1537 |
+
search : true,
|
1538 |
+
router : false,
|
1539 |
+
toolbar : id + '-toolbar',
|
1540 |
+
menu : 'default',
|
1541 |
+
title : shortcodeUIData.strings.media_frame_menu_insert_label,
|
1542 |
+
tabs : [ 'insert' ],
|
1543 |
+
priority : 66,
|
1544 |
+
content : id + '-content-insert',
|
1545 |
+
});
|
|
|
|
|
|
|
|
|
|
|
|
|
1546 |
|
1547 |
if ( 'currentShortcode' in this.options ) {
|
1548 |
+
this.mediaController.setActionUpdate( this.options.currentShortcode );
|
|
|
1549 |
}
|
1550 |
|
1551 |
this.states.add([ this.mediaController ]);
|
1552 |
|
1553 |
this.on( 'content:render:' + id + '-content-insert', _.bind( this.contentRender, this, 'shortcode-ui', 'insert' ) );
|
1554 |
this.on( 'toolbar:create:' + id + '-toolbar', this.toolbarCreate, this );
|
|
|
1555 |
this.on( 'menu:render:default', this.renderShortcodeUIMenu );
|
1556 |
|
1557 |
},
|
1558 |
|
1559 |
events: function() {
|
1560 |
return _.extend( {}, postMediaFrame.prototype.events, {
|
1561 |
+
'click .media-menu-item' : 'resetMediaController',
|
1562 |
} );
|
1563 |
},
|
1564 |
|
1578 |
);
|
1579 |
},
|
1580 |
|
|
|
|
|
1581 |
toolbarCreate : function( toolbar ) {
|
1582 |
+
|
1583 |
var text = shortcodeUIData.strings.media_frame_toolbar_insert_label;
|
1584 |
+
|
1585 |
+
if ( this.state().props.get('currentShortcode') ) {
|
1586 |
text = shortcodeUIData.strings.media_frame_toolbar_update_label;
|
1587 |
}
|
1588 |
|
1589 |
+
toolbar.view = new Toolbar( {
|
1590 |
controller : this,
|
1591 |
items: {
|
1592 |
insert: {
|
1609 |
priority: 65
|
1610 |
})
|
1611 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1612 |
},
|
1613 |
|
1614 |
insertAction: function() {
|
1821 |
|
1822 |
this.preselect( $field );
|
1823 |
|
1824 |
+
var $fieldSelect2 = $field[ shortcodeUIData.select2_handle ]({
|
1825 |
placeholder: "Search",
|
1826 |
multiple: this.model.get( 'multiple' ),
|
1827 |
|
1887 |
},
|
1888 |
|
1889 |
destroySelect2UI: function() {
|
1890 |
+
$fieldSelect2[ shortcodeUIData.select2_handle ]( 'close' );
|
1891 |
}
|
1892 |
|
1893 |
});
|
1980 |
},
|
1981 |
|
1982 |
select: function(e) {
|
1983 |
+
|
1984 |
var target = $(e.currentTarget).closest( '.shortcode-list-item' );
|
1985 |
var shortcode = sui.shortcodes.findWhere( { shortcode_tag: target.attr( 'data-shortcode' ) } );
|
1986 |
|
1988 |
return;
|
1989 |
}
|
1990 |
|
1991 |
+
this.controller.props.set( 'action', 'insert' );
|
1992 |
this.controller.props.set( 'currentShortcode', shortcode.clone() );
|
1993 |
|
1994 |
this.render();
|
@@ -1,7 +1,7 @@
|
|
1 |
var Backbone = require('backbone'),
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
|
6 |
var MediaController = wp.media.controller.State.extend({
|
7 |
|
@@ -47,6 +47,49 @@ var MediaController = wp.media.controller.State.extend({
|
|
47 |
this.props.set( 'search', null );
|
48 |
},
|
49 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
});
|
51 |
|
52 |
sui.controllers.MediaController = MediaController;
|
1 |
var Backbone = require('backbone'),
|
2 |
+
wp = require('wp'),
|
3 |
+
sui = require('sui-utils/sui'),
|
4 |
+
Shortcodes = require('sui-collections/shortcodes');
|
5 |
|
6 |
var MediaController = wp.media.controller.State.extend({
|
7 |
|
47 |
this.props.set( 'search', null );
|
48 |
},
|
49 |
|
50 |
+
setActionSelect: function() {
|
51 |
+
this.attributes.title = shortcodeUIData.strings.media_frame_menu_insert_label;
|
52 |
+
this.props.set( 'currentShortcode', null );
|
53 |
+
this.props.set( 'action', 'select' );
|
54 |
+
|
55 |
+
// Update menuItem text.
|
56 |
+
var menuItem = this.frame.menu.get().get('shortcode-ui');
|
57 |
+
menuItem.options.text = this.attributes.title;
|
58 |
+
menuItem.render();
|
59 |
+
|
60 |
+
this.frame.setState( 'shortcode-ui' );
|
61 |
+
this.frame.render();
|
62 |
+
},
|
63 |
+
|
64 |
+
setActionUpdate: function( currentShortcode ) {
|
65 |
+
|
66 |
+
this.attributes.title = shortcodeUIData.strings.media_frame_menu_update_label;
|
67 |
+
this.attributes.title = this.attributes.title.replace( /%s/, currentShortcode.attributes.label );
|
68 |
+
|
69 |
+
this.props.set( 'currentShortcode', currentShortcode );
|
70 |
+
this.props.set( 'action', 'update' );
|
71 |
+
|
72 |
+
// If a new frame is being created, it may not exist yet.
|
73 |
+
// Defer to ensure it does.
|
74 |
+
_.defer( function() {
|
75 |
+
|
76 |
+
this.frame.setState( 'shortcode-ui' );
|
77 |
+
this.frame.content.render();
|
78 |
+
|
79 |
+
this.toggleSidebar( true );
|
80 |
+
|
81 |
+
this.frame.once( 'close', function() {
|
82 |
+
this.frame.mediaController.toggleSidebar( false );
|
83 |
+
}.bind( this ) );
|
84 |
+
|
85 |
+
}.bind( this ) );
|
86 |
+
|
87 |
+
},
|
88 |
+
|
89 |
+
toggleSidebar: function( show ) {
|
90 |
+
this.frame.$el.toggleClass( 'hide-menu', show );
|
91 |
+
},
|
92 |
+
|
93 |
});
|
94 |
|
95 |
sui.controllers.MediaController = MediaController;
|
@@ -102,7 +102,7 @@ Shortcode = Backbone.Model.extend({
|
|
102 |
template += "]{{ content }}[/{{ shortcode }}]";
|
103 |
} else {
|
104 |
// add closing slash to shortcodes without content
|
105 |
-
template += "/]";
|
106 |
}
|
107 |
|
108 |
template = template.replace( /{{ shortcode }}/g, this.get('shortcode_tag') );
|
102 |
template += "]{{ content }}[/{{ shortcode }}]";
|
103 |
} else {
|
104 |
// add closing slash to shortcodes without content
|
105 |
+
template += " /]";
|
106 |
}
|
107 |
|
108 |
template = template.replace( /{{ shortcode }}/g, this.get('shortcode_tag') );
|
@@ -23,8 +23,10 @@ $(document).ready(function(){
|
|
23 |
} );
|
24 |
|
25 |
$(document.body).on( 'click', '.shortcake-add-post-element', function( event ) {
|
26 |
-
|
27 |
-
|
|
|
|
|
28 |
options = {
|
29 |
frame: 'post',
|
30 |
state: 'shortcode-ui',
|
@@ -35,12 +37,25 @@ $(document).ready(function(){
|
|
35 |
|
36 |
// Remove focus from the `.shortcake-add-post-element` button.
|
37 |
// Prevents Opera from showing the outline of the button above the modal.
|
38 |
-
//
|
39 |
// See: https://core.trac.wordpress.org/ticket/22445
|
40 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
|
42 |
-
wp.media.editor.remove( editor );
|
43 |
-
wp.media.editor.open( editor, options );
|
44 |
} );
|
45 |
|
46 |
});
|
23 |
} );
|
24 |
|
25 |
$(document.body).on( 'click', '.shortcake-add-post-element', function( event ) {
|
26 |
+
|
27 |
+
var $el = $( event.currentTarget ),
|
28 |
+
editor = $el.data('editor'),
|
29 |
+
frame = wp.media.editor.get( editor ),
|
30 |
options = {
|
31 |
frame: 'post',
|
32 |
state: 'shortcode-ui',
|
37 |
|
38 |
// Remove focus from the `.shortcake-add-post-element` button.
|
39 |
// Prevents Opera from showing the outline of the button above the modal.
|
|
|
40 |
// See: https://core.trac.wordpress.org/ticket/22445
|
41 |
+
$el.blur();
|
42 |
+
|
43 |
+
if ( frame ) {
|
44 |
+
frame.mediaController.setActionSelect();
|
45 |
+
frame.open();
|
46 |
+
} else {
|
47 |
+
frame = wp.media.editor.open( editor, options );
|
48 |
+
}
|
49 |
+
|
50 |
+
// Make sure to reset state when closed.
|
51 |
+
frame.once( 'close submit', function() {
|
52 |
+
frame.state().props.set('currentShortcode', false);
|
53 |
+
var menuItem = frame.menu.get().get('shortcode-ui');
|
54 |
+
menuItem.options.text = shortcodeUIData.strings.media_frame_title;
|
55 |
+
menuItem.render();
|
56 |
+
frame.setState( 'insert' );
|
57 |
+
} );
|
58 |
|
|
|
|
|
59 |
} );
|
60 |
|
61 |
});
|
@@ -166,13 +166,27 @@ var shortcodeViewConstructor = {
|
|
166 |
|
167 |
if ( currentShortcode ) {
|
168 |
|
169 |
-
var
|
170 |
-
frame : "post",
|
171 |
-
state : 'shortcode-ui',
|
172 |
-
currentShortcode : currentShortcode,
|
173 |
-
});
|
174 |
|
175 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
176 |
|
177 |
/* Trigger render_edit */
|
178 |
/*
|
166 |
|
167 |
if ( currentShortcode ) {
|
168 |
|
169 |
+
var frame = wp.media.editor.get( window.wpActiveEditor );
|
|
|
|
|
|
|
|
|
170 |
|
171 |
+
if ( frame ) {
|
172 |
+
frame.mediaController.setActionUpdate( currentShortcode );
|
173 |
+
frame.open();
|
174 |
+
} else {
|
175 |
+
frame = wp.media.editor.open( window.wpActiveEditor, {
|
176 |
+
frame : "post",
|
177 |
+
state : 'shortcode-ui',
|
178 |
+
currentShortcode : currentShortcode,
|
179 |
+
});
|
180 |
+
}
|
181 |
+
|
182 |
+
// Make sure to reset state when closed.
|
183 |
+
frame.once( 'close submit', function() {
|
184 |
+
frame.state().props.set('currentShortcode', false);
|
185 |
+
var menuItem = frame.menu.get().get('shortcode-ui');
|
186 |
+
menuItem.options.text = shortcodeUIData.strings.media_frame_title;
|
187 |
+
menuItem.render();
|
188 |
+
frame.setState( 'insert' );
|
189 |
+
} );
|
190 |
|
191 |
/* Trigger render_edit */
|
192 |
/*
|
@@ -47,6 +47,15 @@ var editAttributeField = Backbone.View.extend( {
|
|
47 |
data.options = this.parseOptions( data.options );
|
48 |
}
|
49 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
this.$el.html( this.template( data ) );
|
51 |
this.triggerCallbacks();
|
52 |
|
47 |
data.options = this.parseOptions( data.options );
|
48 |
}
|
49 |
|
50 |
+
// Ensure default value for select field.
|
51 |
+
if ( 'select' === data.type && '' === this.model.get( 'value' ) && ! _.findWhere( data.options, { value: '' } ) ) {
|
52 |
+
var firstVisibleOption = _.first( data.options );
|
53 |
+
if ( 'undefined' !== typeof firstVisibleOption.value ) {
|
54 |
+
this.setValue( firstVisibleOption.value );
|
55 |
+
data.value = firstVisibleOption.value;
|
56 |
+
}
|
57 |
+
}
|
58 |
+
|
59 |
this.$el.html( this.template( data ) );
|
60 |
this.triggerCallbacks();
|
61 |
|
@@ -13,41 +13,33 @@ var mediaFrame = postMediaFrame.extend( {
|
|
13 |
|
14 |
var id = 'shortcode-ui';
|
15 |
|
16 |
-
|
17 |
-
id
|
18 |
-
search
|
19 |
-
router
|
20 |
-
toolbar
|
21 |
-
menu
|
22 |
-
title
|
23 |
-
tabs
|
24 |
-
priority: 66,
|
25 |
-
content
|
26 |
-
};
|
27 |
-
|
28 |
-
if ( 'currentShortcode' in this.options ) {
|
29 |
-
opts.title = shortcodeUIData.strings.media_frame_menu_update_label.replace( /%s/, this.options.currentShortcode.attributes.label );
|
30 |
-
}
|
31 |
-
|
32 |
-
this.mediaController = new MediaController( opts );
|
33 |
|
34 |
if ( 'currentShortcode' in this.options ) {
|
35 |
-
this.mediaController.
|
36 |
-
this.mediaController.props.set( 'action', 'update' );
|
37 |
}
|
38 |
|
39 |
this.states.add([ this.mediaController ]);
|
40 |
|
41 |
this.on( 'content:render:' + id + '-content-insert', _.bind( this.contentRender, this, 'shortcode-ui', 'insert' ) );
|
42 |
this.on( 'toolbar:create:' + id + '-toolbar', this.toolbarCreate, this );
|
43 |
-
this.on( 'toolbar:render:' + id + '-toolbar', this.toolbarRender, this );
|
44 |
this.on( 'menu:render:default', this.renderShortcodeUIMenu );
|
45 |
|
46 |
},
|
47 |
|
48 |
events: function() {
|
49 |
return _.extend( {}, postMediaFrame.prototype.events, {
|
50 |
-
'click .media-menu-item'
|
51 |
} );
|
52 |
},
|
53 |
|
@@ -67,15 +59,15 @@ var mediaFrame = postMediaFrame.extend( {
|
|
67 |
);
|
68 |
},
|
69 |
|
70 |
-
toolbarRender: function( toolbar ) {},
|
71 |
-
|
72 |
toolbarCreate : function( toolbar ) {
|
|
|
73 |
var text = shortcodeUIData.strings.media_frame_toolbar_insert_label;
|
74 |
-
|
|
|
75 |
text = shortcodeUIData.strings.media_frame_toolbar_update_label;
|
76 |
}
|
77 |
|
78 |
-
toolbar.view = new
|
79 |
controller : this,
|
80 |
items: {
|
81 |
insert: {
|
@@ -98,17 +90,6 @@ var mediaFrame = postMediaFrame.extend( {
|
|
98 |
priority: 65
|
99 |
})
|
100 |
});
|
101 |
-
|
102 |
-
// Hide menu if editing.
|
103 |
-
// @todo - fix this.
|
104 |
-
// This is a hack.
|
105 |
-
// I just can't work out how to do it properly...
|
106 |
-
if ( view.controller.state().props && view.controller.state().props.get( 'currentShortcode' ) ) {
|
107 |
-
window.setTimeout( function() {
|
108 |
-
view.controller.$el.addClass( 'hide-menu' );
|
109 |
-
} );
|
110 |
-
}
|
111 |
-
|
112 |
},
|
113 |
|
114 |
insertAction: function() {
|
13 |
|
14 |
var id = 'shortcode-ui';
|
15 |
|
16 |
+
this.mediaController = new MediaController({
|
17 |
+
id : id,
|
18 |
+
search : true,
|
19 |
+
router : false,
|
20 |
+
toolbar : id + '-toolbar',
|
21 |
+
menu : 'default',
|
22 |
+
title : shortcodeUIData.strings.media_frame_menu_insert_label,
|
23 |
+
tabs : [ 'insert' ],
|
24 |
+
priority : 66,
|
25 |
+
content : id + '-content-insert',
|
26 |
+
});
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
|
28 |
if ( 'currentShortcode' in this.options ) {
|
29 |
+
this.mediaController.setActionUpdate( this.options.currentShortcode );
|
|
|
30 |
}
|
31 |
|
32 |
this.states.add([ this.mediaController ]);
|
33 |
|
34 |
this.on( 'content:render:' + id + '-content-insert', _.bind( this.contentRender, this, 'shortcode-ui', 'insert' ) );
|
35 |
this.on( 'toolbar:create:' + id + '-toolbar', this.toolbarCreate, this );
|
|
|
36 |
this.on( 'menu:render:default', this.renderShortcodeUIMenu );
|
37 |
|
38 |
},
|
39 |
|
40 |
events: function() {
|
41 |
return _.extend( {}, postMediaFrame.prototype.events, {
|
42 |
+
'click .media-menu-item' : 'resetMediaController',
|
43 |
} );
|
44 |
},
|
45 |
|
59 |
);
|
60 |
},
|
61 |
|
|
|
|
|
62 |
toolbarCreate : function( toolbar ) {
|
63 |
+
|
64 |
var text = shortcodeUIData.strings.media_frame_toolbar_insert_label;
|
65 |
+
|
66 |
+
if ( this.state().props.get('currentShortcode') ) {
|
67 |
text = shortcodeUIData.strings.media_frame_toolbar_update_label;
|
68 |
}
|
69 |
|
70 |
+
toolbar.view = new Toolbar( {
|
71 |
controller : this,
|
72 |
items: {
|
73 |
insert: {
|
90 |
priority: 65
|
91 |
})
|
92 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
},
|
94 |
|
95 |
insertAction: function() {
|
@@ -103,7 +103,7 @@ sui.views.editAttributeSelect2Field = sui.views.editAttributeField.extend( {
|
|
103 |
|
104 |
this.preselect( $field );
|
105 |
|
106 |
-
var $fieldSelect2 = $field.
|
107 |
placeholder: "Search",
|
108 |
multiple: this.model.get( 'multiple' ),
|
109 |
|
@@ -134,6 +134,7 @@ sui.views.editAttributeSelect2Field = sui.views.editAttributeField.extend( {
|
|
134 |
},
|
135 |
cache: true
|
136 |
},
|
|
|
137 |
escapeMarkup: function( markup ) { return markup; },
|
138 |
minimumInputLength: 1,
|
139 |
templateResult: this.templateResult,
|
@@ -169,8 +170,7 @@ sui.controllers.MediaController = mediaController.extend({
|
|
169 |
},
|
170 |
|
171 |
destroySelect2UI: function() {
|
172 |
-
$fieldSelect2.
|
173 |
}
|
174 |
|
175 |
});
|
176 |
-
|
103 |
|
104 |
this.preselect( $field );
|
105 |
|
106 |
+
var $fieldSelect2 = $field[ shortcodeUIData.select2_handle ]({
|
107 |
placeholder: "Search",
|
108 |
multiple: this.model.get( 'multiple' ),
|
109 |
|
134 |
},
|
135 |
cache: true
|
136 |
},
|
137 |
+
|
138 |
escapeMarkup: function( markup ) { return markup; },
|
139 |
minimumInputLength: 1,
|
140 |
templateResult: this.templateResult,
|
170 |
},
|
171 |
|
172 |
destroySelect2UI: function() {
|
173 |
+
$fieldSelect2[ shortcodeUIData.select2_handle ]( 'close' );
|
174 |
}
|
175 |
|
176 |
});
|
|
@@ -82,7 +82,7 @@ var Shortcode_UI = Backbone.View.extend({
|
|
82 |
},
|
83 |
|
84 |
select: function(e) {
|
85 |
-
|
86 |
var target = $(e.currentTarget).closest( '.shortcode-list-item' );
|
87 |
var shortcode = sui.shortcodes.findWhere( { shortcode_tag: target.attr( 'data-shortcode' ) } );
|
88 |
|
@@ -90,6 +90,7 @@ var Shortcode_UI = Backbone.View.extend({
|
|
90 |
return;
|
91 |
}
|
92 |
|
|
|
93 |
this.controller.props.set( 'currentShortcode', shortcode.clone() );
|
94 |
|
95 |
this.render();
|
82 |
},
|
83 |
|
84 |
select: function(e) {
|
85 |
+
|
86 |
var target = $(e.currentTarget).closest( '.shortcode-list-item' );
|
87 |
var shortcode = sui.shortcodes.findWhere( { shortcode_tag: target.attr( 'data-shortcode' ) } );
|
88 |
|
90 |
return;
|
91 |
}
|
92 |
|
93 |
+
this.controller.props.set( 'action', 'insert' );
|
94 |
this.controller.props.set( 'currentShortcode', shortcode.clone() );
|
95 |
|
96 |
this.render();
|
Binary file
|
@@ -0,0 +1,184 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: \n"
|
4 |
+
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/shortcode-"
|
5 |
+
"ui\n"
|
6 |
+
"POT-Creation-Date: 2017-03-07 12:35+0100\n"
|
7 |
+
"PO-Revision-Date: 2017-03-07 12:47+0100\n"
|
8 |
+
"Last-Translator: \n"
|
9 |
+
"Language-Team: \n"
|
10 |
+
"Language: nb\n"
|
11 |
+
"MIME-Version: 1.0\n"
|
12 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
13 |
+
"Content-Transfer-Encoding: 8bit\n"
|
14 |
+
"X-Generator: Poedit 1.8.12\n"
|
15 |
+
"X-Poedit-Basepath: .\n"
|
16 |
+
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
17 |
+
|
18 |
+
#: dev.php:68
|
19 |
+
msgid ""
|
20 |
+
"Shortcode UI plugin must be active for Shortcode UI Example plugin to "
|
21 |
+
"function."
|
22 |
+
msgstr ""
|
23 |
+
"Shortcode UI plugin må være aktivert for at Shortcode UI Example "
|
24 |
+
"plugin skal fungere."
|
25 |
+
|
26 |
+
#: dev.php:119
|
27 |
+
msgid "Shortcake With No Attributes"
|
28 |
+
msgstr "Shortcake uten attributter"
|
29 |
+
|
30 |
+
#: dev.php:159
|
31 |
+
msgid "Attachment"
|
32 |
+
msgstr "Vedlegg"
|
33 |
+
|
34 |
+
#: dev.php:169 dev.php:170
|
35 |
+
msgid "Select Image"
|
36 |
+
msgstr "Velg bilde"
|
37 |
+
|
38 |
+
#: dev.php:173
|
39 |
+
msgid "Citation Source"
|
40 |
+
msgstr "Kilde"
|
41 |
+
|
42 |
+
#: dev.php:178
|
43 |
+
msgid "Test placeholder"
|
44 |
+
msgstr "Test placeholder"
|
45 |
+
|
46 |
+
#: dev.php:183
|
47 |
+
msgid "Select Page"
|
48 |
+
msgstr "Velg Side"
|
49 |
+
|
50 |
+
#: dev.php:190
|
51 |
+
msgid "Background Color"
|
52 |
+
msgstr "Bagrunnsfarge"
|
53 |
+
|
54 |
+
#: dev.php:195
|
55 |
+
msgid "Hex color code"
|
56 |
+
msgstr "Fargens hex kode verdi"
|
57 |
+
|
58 |
+
#: dev.php:199
|
59 |
+
msgid "Alignment"
|
60 |
+
msgstr "Justering"
|
61 |
+
|
62 |
+
#: dev.php:200
|
63 |
+
msgid ""
|
64 |
+
"Whether the quotation should be displayed as pull-left, pull-right, or "
|
65 |
+
"neither."
|
66 |
+
msgstr "Om sitat skal vises som venstre, høyre eller ingen av de."
|
67 |
+
|
68 |
+
#: dev.php:204
|
69 |
+
msgid "None"
|
70 |
+
msgstr "Ingen"
|
71 |
+
|
72 |
+
#: dev.php:205
|
73 |
+
msgid "Pull Left"
|
74 |
+
msgstr "Ventrejuster"
|
75 |
+
|
76 |
+
#: dev.php:206
|
77 |
+
msgid "Pull Right"
|
78 |
+
msgstr "Høyrejuster"
|
79 |
+
|
80 |
+
#: dev.php:210
|
81 |
+
msgid "Year"
|
82 |
+
msgstr "År"
|
83 |
+
|
84 |
+
#: dev.php:211
|
85 |
+
msgid "Optional. The year the quotation is from."
|
86 |
+
msgstr "Valgfri. Året sitatet er fra."
|
87 |
+
|
88 |
+
#: dev.php:230
|
89 |
+
msgid "Shortcake Dev"
|
90 |
+
msgstr "Shortcake Dev"
|
91 |
+
|
92 |
+
#: dev.php:249
|
93 |
+
msgid "Quote"
|
94 |
+
msgstr "Sitat"
|
95 |
+
|
96 |
+
#: dev.php:250
|
97 |
+
msgid "Include a statement from someone famous."
|
98 |
+
msgstr "Inkluder påstand fra noen berømt."
|
99 |
+
|
100 |
+
#: dev.php:288
|
101 |
+
msgid "Content:"
|
102 |
+
msgstr "Innhold:"
|
103 |
+
|
104 |
+
#: dev.php:289
|
105 |
+
msgid "Source:"
|
106 |
+
msgstr "Kilde:"
|
107 |
+
|
108 |
+
#: dev.php:290
|
109 |
+
msgid "Image:"
|
110 |
+
msgstr "Bilde:"
|
111 |
+
|
112 |
+
#: inc/class-shortcode-ui.php:109
|
113 |
+
msgid "Inner Content"
|
114 |
+
msgstr "Indre innhold:"
|
115 |
+
|
116 |
+
#: inc/class-shortcode-ui.php:236 inc/class-shortcode-ui.php:237
|
117 |
+
msgid "Insert Post Element"
|
118 |
+
msgstr "Sett inn Innlegg-element"
|
119 |
+
|
120 |
+
#: inc/class-shortcode-ui.php:238
|
121 |
+
msgid "%s Details"
|
122 |
+
msgstr "%s Detaljer"
|
123 |
+
|
124 |
+
#: inc/class-shortcode-ui.php:239
|
125 |
+
msgid "Insert Element"
|
126 |
+
msgstr "Sett inn element"
|
127 |
+
|
128 |
+
#: inc/class-shortcode-ui.php:240
|
129 |
+
msgid "Update"
|
130 |
+
msgstr "Oppdater"
|
131 |
+
|
132 |
+
#: inc/class-shortcode-ui.php:241
|
133 |
+
msgid "There are no attributes to configure for this Post Element."
|
134 |
+
msgstr ""
|
135 |
+
"Det er ingen attributter for å konfigurere dette Innleggselementet."
|
136 |
+
|
137 |
+
#: inc/class-shortcode-ui.php:242
|
138 |
+
msgid "Failed to load preview"
|
139 |
+
msgstr "Fikk ikke lastet forhåndsvisning"
|
140 |
+
|
141 |
+
#: inc/class-shortcode-ui.php:243
|
142 |
+
msgid "Search"
|
143 |
+
msgstr "Søk"
|
144 |
+
|
145 |
+
#: inc/class-shortcode-ui.php:244
|
146 |
+
msgid "Insert Content"
|
147 |
+
msgstr "Sett inn innhold"
|
148 |
+
|
149 |
+
#: inc/class-shortcode-ui.php:339
|
150 |
+
msgid "Something's rotten in the state of Denmark"
|
151 |
+
msgstr "Noe er rottent i Dannmark"
|
152 |
+
|
153 |
+
#: inc/fields/class-field-attachment.php:79
|
154 |
+
#: inc/fields/class-field-attachment.php:80
|
155 |
+
msgid "Select Attachment"
|
156 |
+
msgstr "Velg vedlegg"
|
157 |
+
|
158 |
+
#: inc/fields/class-field-attachment.php:104
|
159 |
+
msgid "Thumbnail Details"
|
160 |
+
msgstr "Thumbnail detaljer"
|
161 |
+
|
162 |
+
#: inc/fields/class-field-attachment.php:109
|
163 |
+
msgid "Edit Attachment"
|
164 |
+
msgstr "Endre vedlegg"
|
165 |
+
|
166 |
+
#: inc/templates/edit-form.tpl.php:3
|
167 |
+
msgid "Back to list"
|
168 |
+
msgstr "Tilbake til listen"
|
169 |
+
|
170 |
+
#. Plugin Name of the plugin/theme
|
171 |
+
msgid "Shortcake (Shortcode UI)"
|
172 |
+
msgstr ""
|
173 |
+
|
174 |
+
#. Description of the plugin/theme
|
175 |
+
msgid "User Interface for adding shortcodes."
|
176 |
+
msgstr "Brukergrensesnitt for å legge til shortcodes."
|
177 |
+
|
178 |
+
#. Author of the plugin/theme
|
179 |
+
msgid "Fusion Engineering and community"
|
180 |
+
msgstr ""
|
181 |
+
|
182 |
+
#. Author URI of the plugin/theme
|
183 |
+
msgid "http://next.fusion.net/tag/shortcode-ui/"
|
184 |
+
msgstr ""
|
@@ -2,9 +2,9 @@
|
|
2 |
# This file is distributed under the GPL v2 or later.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
-
"Project-Id-Version: Shortcake (Shortcode UI) 0.7.
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/shortcode-ui\n"
|
7 |
-
"POT-Creation-Date: 2016-
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=utf-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
@@ -42,117 +42,161 @@ msgstr ""
|
|
42 |
msgid "Select Image"
|
43 |
msgstr ""
|
44 |
|
45 |
-
#: dev.php:
|
|
|
|
|
|
|
|
|
46 |
msgid "Citation Source"
|
47 |
msgstr ""
|
48 |
|
49 |
-
#: dev.php:
|
50 |
msgid "Test placeholder"
|
51 |
msgstr ""
|
52 |
|
53 |
-
#: dev.php:
|
54 |
msgid "Select Page"
|
55 |
msgstr ""
|
56 |
|
57 |
-
#: dev.php:
|
58 |
-
msgid "
|
|
|
|
|
|
|
|
|
59 |
msgstr ""
|
60 |
|
61 |
-
#: dev.php:
|
|
|
|
|
|
|
|
|
62 |
msgid "Hex color code"
|
63 |
msgstr ""
|
64 |
|
65 |
-
#: dev.php:
|
66 |
msgid "Alignment"
|
67 |
msgstr ""
|
68 |
|
69 |
-
#: dev.php:
|
70 |
msgid ""
|
71 |
"Whether the quotation should be displayed as pull-left, pull-right, or "
|
72 |
"neither."
|
73 |
msgstr ""
|
74 |
|
75 |
-
#: dev.php:
|
76 |
msgid "None"
|
77 |
msgstr ""
|
78 |
|
79 |
-
#: dev.php:
|
80 |
msgid "Pull Left"
|
81 |
msgstr ""
|
82 |
|
83 |
-
#: dev.php:
|
84 |
msgid "Pull Right"
|
85 |
msgstr ""
|
86 |
|
87 |
-
#: dev.php:
|
88 |
msgid "Year"
|
89 |
msgstr ""
|
90 |
|
91 |
-
#: dev.php:
|
92 |
msgid "Optional. The year the quotation is from."
|
93 |
msgstr ""
|
94 |
|
95 |
-
#: dev.php:
|
96 |
msgid "Shortcake Dev"
|
97 |
msgstr ""
|
98 |
|
99 |
-
#: dev.php:
|
100 |
msgid "Quote"
|
101 |
msgstr ""
|
102 |
|
103 |
-
#: dev.php:
|
104 |
msgid "Include a statement from someone famous."
|
105 |
msgstr ""
|
106 |
|
107 |
-
#: dev.php:
|
108 |
msgid "Content:"
|
109 |
msgstr ""
|
110 |
|
111 |
-
#: dev.php:
|
112 |
msgid "Source:"
|
113 |
msgstr ""
|
114 |
|
115 |
-
#: dev.php:
|
116 |
msgid "Image:"
|
117 |
msgstr ""
|
118 |
|
119 |
-
#:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
120 |
msgid "Inner Content"
|
121 |
msgstr ""
|
122 |
|
123 |
-
#: inc/class-shortcode-ui.php:
|
124 |
msgid "Insert Post Element"
|
125 |
msgstr ""
|
126 |
|
127 |
-
#: inc/class-shortcode-ui.php:
|
128 |
msgid "%s Details"
|
129 |
msgstr ""
|
130 |
|
131 |
-
#: inc/class-shortcode-ui.php:
|
132 |
msgid "Insert Element"
|
133 |
msgstr ""
|
134 |
|
135 |
-
#: inc/class-shortcode-ui.php:
|
136 |
msgid "Update"
|
137 |
msgstr ""
|
138 |
|
139 |
-
#: inc/class-shortcode-ui.php:
|
140 |
msgid "There are no attributes to configure for this Post Element."
|
141 |
msgstr ""
|
142 |
|
143 |
-
#: inc/class-shortcode-ui.php:
|
144 |
msgid "Failed to load preview"
|
145 |
msgstr ""
|
146 |
|
147 |
-
#: inc/class-shortcode-ui.php:
|
148 |
msgid "Search"
|
149 |
msgstr ""
|
150 |
|
151 |
-
#: inc/class-shortcode-ui.php:
|
152 |
msgid "Insert Content"
|
153 |
msgstr ""
|
154 |
|
155 |
-
#: inc/class-shortcode-ui.php:
|
|
|
|
|
|
|
|
|
156 |
msgid "Something's rotten in the state of Denmark"
|
157 |
msgstr ""
|
158 |
|
@@ -161,14 +205,6 @@ msgstr ""
|
|
161 |
msgid "Select Attachment"
|
162 |
msgstr ""
|
163 |
|
164 |
-
#: inc/fields/class-field-attachment.php:104
|
165 |
-
msgid "Thumbnail Details"
|
166 |
-
msgstr ""
|
167 |
-
|
168 |
-
#: inc/fields/class-field-attachment.php:109
|
169 |
-
msgid "Edit Attachment"
|
170 |
-
msgstr ""
|
171 |
-
|
172 |
#: inc/templates/edit-form.tpl.php:3
|
173 |
msgid "Back to list"
|
174 |
msgstr ""
|
2 |
# This file is distributed under the GPL v2 or later.
|
3 |
msgid ""
|
4 |
msgstr ""
|
5 |
+
"Project-Id-Version: Shortcake (Shortcode UI) 0.7.1\n"
|
6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/shortcode-ui\n"
|
7 |
+
"POT-Creation-Date: 2016-12-16 22:19:41+00:00\n"
|
8 |
"MIME-Version: 1.0\n"
|
9 |
"Content-Type: text/plain; charset=utf-8\n"
|
10 |
"Content-Transfer-Encoding: 8bit\n"
|
42 |
msgid "Select Image"
|
43 |
msgstr ""
|
44 |
|
45 |
+
#: dev.php:175
|
46 |
+
msgid "You can select multiple images."
|
47 |
+
msgstr ""
|
48 |
+
|
49 |
+
#: dev.php:183
|
50 |
msgid "Citation Source"
|
51 |
msgstr ""
|
52 |
|
53 |
+
#: dev.php:188
|
54 |
msgid "Test placeholder"
|
55 |
msgstr ""
|
56 |
|
57 |
+
#: dev.php:193
|
58 |
msgid "Select Page"
|
59 |
msgstr ""
|
60 |
|
61 |
+
#: dev.php:200
|
62 |
+
msgid "Select Term"
|
63 |
+
msgstr ""
|
64 |
+
|
65 |
+
#: dev.php:207
|
66 |
+
msgid "User Select"
|
67 |
msgstr ""
|
68 |
|
69 |
+
#: dev.php:213
|
70 |
+
msgid "Color"
|
71 |
+
msgstr ""
|
72 |
+
|
73 |
+
#: dev.php:218
|
74 |
msgid "Hex color code"
|
75 |
msgstr ""
|
76 |
|
77 |
+
#: dev.php:222
|
78 |
msgid "Alignment"
|
79 |
msgstr ""
|
80 |
|
81 |
+
#: dev.php:223
|
82 |
msgid ""
|
83 |
"Whether the quotation should be displayed as pull-left, pull-right, or "
|
84 |
"neither."
|
85 |
msgstr ""
|
86 |
|
87 |
+
#: dev.php:227
|
88 |
msgid "None"
|
89 |
msgstr ""
|
90 |
|
91 |
+
#: dev.php:228 dev.php:233
|
92 |
msgid "Pull Left"
|
93 |
msgstr ""
|
94 |
|
95 |
+
#: dev.php:229 dev.php:234
|
96 |
msgid "Pull Right"
|
97 |
msgstr ""
|
98 |
|
99 |
+
#: dev.php:240
|
100 |
msgid "Year"
|
101 |
msgstr ""
|
102 |
|
103 |
+
#: dev.php:241
|
104 |
msgid "Optional. The year the quotation is from."
|
105 |
msgstr ""
|
106 |
|
107 |
+
#: dev.php:260
|
108 |
msgid "Shortcake Dev"
|
109 |
msgstr ""
|
110 |
|
111 |
+
#: dev.php:279
|
112 |
msgid "Quote"
|
113 |
msgstr ""
|
114 |
|
115 |
+
#: dev.php:280
|
116 |
msgid "Include a statement from someone famous."
|
117 |
msgstr ""
|
118 |
|
119 |
+
#: dev.php:352
|
120 |
msgid "Content:"
|
121 |
msgstr ""
|
122 |
|
123 |
+
#: dev.php:356
|
124 |
msgid "Source:"
|
125 |
msgstr ""
|
126 |
|
127 |
+
#: dev.php:360
|
128 |
msgid "Image:"
|
129 |
msgstr ""
|
130 |
|
131 |
+
#: dev.php:364
|
132 |
+
msgid "Gallery:"
|
133 |
+
msgstr ""
|
134 |
+
|
135 |
+
#: dev.php:372
|
136 |
+
msgid "Pages:"
|
137 |
+
msgstr ""
|
138 |
+
|
139 |
+
#: dev.php:376
|
140 |
+
msgid "Terms:"
|
141 |
+
msgstr ""
|
142 |
+
|
143 |
+
#: dev.php:380
|
144 |
+
msgid "Users:"
|
145 |
+
msgstr ""
|
146 |
+
|
147 |
+
#: dev.php:384
|
148 |
+
msgid "Color:"
|
149 |
+
msgstr ""
|
150 |
+
|
151 |
+
#: dev.php:388
|
152 |
+
msgid "Alignment:"
|
153 |
+
msgstr ""
|
154 |
+
|
155 |
+
#: dev.php:392
|
156 |
+
msgid "Year:"
|
157 |
+
msgstr ""
|
158 |
+
|
159 |
+
#: inc/class-shortcode-ui.php:110
|
160 |
msgid "Inner Content"
|
161 |
msgstr ""
|
162 |
|
163 |
+
#: inc/class-shortcode-ui.php:249 inc/class-shortcode-ui.php:250
|
164 |
msgid "Insert Post Element"
|
165 |
msgstr ""
|
166 |
|
167 |
+
#: inc/class-shortcode-ui.php:251
|
168 |
msgid "%s Details"
|
169 |
msgstr ""
|
170 |
|
171 |
+
#: inc/class-shortcode-ui.php:252
|
172 |
msgid "Insert Element"
|
173 |
msgstr ""
|
174 |
|
175 |
+
#: inc/class-shortcode-ui.php:253
|
176 |
msgid "Update"
|
177 |
msgstr ""
|
178 |
|
179 |
+
#: inc/class-shortcode-ui.php:254
|
180 |
msgid "There are no attributes to configure for this Post Element."
|
181 |
msgstr ""
|
182 |
|
183 |
+
#: inc/class-shortcode-ui.php:255
|
184 |
msgid "Failed to load preview"
|
185 |
msgstr ""
|
186 |
|
187 |
+
#: inc/class-shortcode-ui.php:256
|
188 |
msgid "Search"
|
189 |
msgstr ""
|
190 |
|
191 |
+
#: inc/class-shortcode-ui.php:257
|
192 |
msgid "Insert Content"
|
193 |
msgstr ""
|
194 |
|
195 |
+
#: inc/class-shortcode-ui.php:297
|
196 |
+
msgid "Add Post Element"
|
197 |
+
msgstr ""
|
198 |
+
|
199 |
+
#: inc/class-shortcode-ui.php:365
|
200 |
msgid "Something's rotten in the state of Denmark"
|
201 |
msgstr ""
|
202 |
|
205 |
msgid "Select Attachment"
|
206 |
msgstr ""
|
207 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
208 |
#: inc/templates/edit-form.tpl.php:3
|
209 |
msgid "Back to list"
|
210 |
msgstr ""
|
@@ -2,8 +2,8 @@
|
|
2 |
Contributors: fusionengineering, mattheu, danielbachhuber, zebulonj, goldenapples, jitendraharpalani, sanchothefat, bfintal, davisshaver, garyj, mte90, fredserva, khromov, bronsonquick, dashaluna, mehigh, sc0ttkclark, kraftner, pravdomil
|
3 |
Tags: shortcodes
|
4 |
Requires at least: 4.5
|
5 |
-
Tested up to: 4.7
|
6 |
-
Stable tag: 0.7.
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -27,9 +27,19 @@ New in 0.4.0 is the ability to [attach javascript functions to event attribute u
|
|
27 |
|
28 |
== Frequently Asked Questions ==
|
29 |
|
30 |
-
= How do I register UI for arbitrary key
|
31 |
|
32 |
-
Shortcake doesn't support custom key=>value pairs as shortcode attributes because it isn't a great user experience.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
|
34 |
== Running tests ==
|
35 |
|
@@ -58,6 +68,16 @@ We've removed the compatibility shim for the magical `content` attribute. If you
|
|
58 |
|
59 |
== Changelog ==
|
60 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
= 0.7.0 (November 18, 2016) =
|
62 |
* Adds "Add post element" button to media buttons - one click to open the shortcode list, rather than clicking "Add media" button and then finding "insert post element" in the menu.
|
63 |
* Added "Term Select" field type.
|
@@ -178,7 +198,7 @@ We've removed the compatibility shim for the magical `content` attribute. If you
|
|
178 |
|
179 |
* Supports all HTML5 input types for form fields.
|
180 |
* Shortcode preview tab within the editing experience.
|
181 |
-
* Re-labeled the UI around “Post Elements”, which is more descriptive than “Content Items.”
|
182 |
* Many bug fixes.
|
183 |
* [Full release notes](http://next.fusion.net/2014/12/23/shortcake-v0-1-0-live-previews-fieldmanager-integration/).
|
184 |
|
2 |
Contributors: fusionengineering, mattheu, danielbachhuber, zebulonj, goldenapples, jitendraharpalani, sanchothefat, bfintal, davisshaver, garyj, mte90, fredserva, khromov, bronsonquick, dashaluna, mehigh, sc0ttkclark, kraftner, pravdomil
|
3 |
Tags: shortcodes
|
4 |
Requires at least: 4.5
|
5 |
+
Tested up to: 4.7.3
|
6 |
+
Stable tag: 0.7.1
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
27 |
|
28 |
== Frequently Asked Questions ==
|
29 |
|
30 |
+
= How do I register UI for arbitrary key/value pairs as shortcode attributes? =
|
31 |
|
32 |
+
Shortcake doesn't support custom key => value pairs as shortcode attributes because it isn't a great user experience.
|
33 |
+
|
34 |
+
= After upgrading to Shortcake 0.7.x, some of the shortcode UI fields (post select, user select, etc) don't work as expected. What can I do? =
|
35 |
+
|
36 |
+
In version 0.7.0, we updated to the most recent branch of the Select2 library, which provides the enhanced select fields in these field types. This causes a known conflict with plugins that enqueue older versions of Select2. (Popular plugins with known conflicts include WooCommerce and Advanced Custom Fields Pro, among others.)
|
37 |
+
|
38 |
+
If you find that you're experiencing conflicts with these plugins, you can set a flag to load select2 in a distinct namespace by defining the constant `SELECT2_NOCONFLICT` in your wp-config.php (or anywhere that's defined before the 'init' hook.)
|
39 |
+
|
40 |
+
`
|
41 |
+
define( 'SELECT2_NOCONFLICT', true );
|
42 |
+
`
|
43 |
|
44 |
== Running tests ==
|
45 |
|
68 |
|
69 |
== Changelog ==
|
70 |
|
71 |
+
= 0.7.1 (December 16, 2016) =
|
72 |
+
* Change shortcode formatting to add a space before the self-closing trailing slash.
|
73 |
+
* Fix alignment of attachment previews with long filenames.
|
74 |
+
* Bug fix: Set an initial value on select fields (previously, no value would be set for a select field unless the user interacts with the field).
|
75 |
+
* Enhancement/fix: Reuse one copy of the media modal and reset its state upon closing, rather than creating duplicate markup each time the modal is accessed.
|
76 |
+
* Compatability: Uses "full" version of select2.js 4.0.3 to prevent plugin conflicts with other plugins which expect the full version to be enqueued.
|
77 |
+
* Compatability: Add `SELECT2_NOCONFLICT` flag to load Select2 in a unique namespace to prevent conflicts with other plugins which are loading select2.js version 3.
|
78 |
+
* Added Norwegian translation.
|
79 |
+
* Multiple coding style fixes.
|
80 |
+
|
81 |
= 0.7.0 (November 18, 2016) =
|
82 |
* Adds "Add post element" button to media buttons - one click to open the shortcode list, rather than clicking "Add media" button and then finding "insert post element" in the menu.
|
83 |
* Added "Term Select" field type.
|
198 |
|
199 |
* Supports all HTML5 input types for form fields.
|
200 |
* Shortcode preview tab within the editing experience.
|
201 |
+
}* Re-labeled the UI around “Post Elements”, which is more descriptive than “Content Items.”
|
202 |
* Many bug fixes.
|
203 |
* [Full release notes](http://next.fusion.net/2014/12/23/shortcake-v0-1-0-live-previews-fieldmanager-integration/).
|
204 |
|
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* Plugin Name: Shortcake (Shortcode UI)
|
4 |
-
* Version: 0.7.
|
5 |
* Description: User Interface for adding shortcodes.
|
6 |
* Author: Fusion Engineering and community
|
7 |
* Author URI: http://next.fusion.net/tag/shortcode-ui/
|
@@ -19,15 +19,15 @@
|
|
19 |
* GNU General Public License for more details.
|
20 |
*/
|
21 |
|
22 |
-
define( 'SHORTCODE_UI_VERSION', '0.7.
|
23 |
|
24 |
require_once dirname( __FILE__ ) . '/inc/class-shortcode-ui.php';
|
25 |
require_once dirname( __FILE__ ) . '/inc/fields/class-shortcode-ui-fields.php';
|
26 |
-
require_once dirname( __FILE__ ) . '/inc/fields/class-field-attachment.php';
|
27 |
-
require_once dirname( __FILE__ ) . '/inc/fields/class-field-color.php';
|
28 |
-
require_once dirname( __FILE__ ) . '/inc/fields/class-field-post-select.php';
|
29 |
-
require_once dirname( __FILE__ ) . '/inc/fields/class-field-term-select.php';
|
30 |
-
require_once dirname( __FILE__ ) . '/inc/fields/class-field-user-select.php';
|
31 |
|
32 |
add_action( 'init', 'shortcode_ui_load_textdomain' );
|
33 |
|
@@ -39,10 +39,15 @@ add_action( 'init', 'shortcode_ui_init', 5 );
|
|
39 |
* @return null
|
40 |
*/
|
41 |
function shortcode_ui_init() {
|
|
|
|
|
|
|
|
|
|
|
42 |
$shortcode_ui = Shortcode_UI::get_instance();
|
43 |
$fields = Shortcode_UI_Fields::get_instance();
|
44 |
-
$attachment_field =
|
45 |
-
$color_field =
|
46 |
$post_field = Shortcode_UI_Field_Post_Select::get_instance();
|
47 |
$term_field = Shortcode_UI_Field_Term_Select::get_instance();
|
48 |
$user_field = Shortcode_UI_Field_User_Select::get_instance();
|
@@ -62,13 +67,14 @@ function shortcode_ui_load_textdomain() {
|
|
62 |
$path = dirname( __FILE__ ) . '/languages';
|
63 |
// Load the textdomain according to the plugin first
|
64 |
$mofile = $domain . '-' . $locale . '.mo';
|
65 |
-
|
66 |
-
|
|
|
|
|
|
|
|
|
67 |
}
|
68 |
|
69 |
-
// Otherwise, load from the languages directory
|
70 |
-
$mofile = WP_LANG_DIR . '/plugins/' . $mofile;
|
71 |
-
load_textdomain( $domain, $mofile );
|
72 |
}
|
73 |
|
74 |
/**
|
1 |
<?php
|
2 |
/**
|
3 |
* Plugin Name: Shortcake (Shortcode UI)
|
4 |
+
* Version: 0.7.1
|
5 |
* Description: User Interface for adding shortcodes.
|
6 |
* Author: Fusion Engineering and community
|
7 |
* Author URI: http://next.fusion.net/tag/shortcode-ui/
|
19 |
* GNU General Public License for more details.
|
20 |
*/
|
21 |
|
22 |
+
define( 'SHORTCODE_UI_VERSION', '0.7.1' );
|
23 |
|
24 |
require_once dirname( __FILE__ ) . '/inc/class-shortcode-ui.php';
|
25 |
require_once dirname( __FILE__ ) . '/inc/fields/class-shortcode-ui-fields.php';
|
26 |
+
require_once dirname( __FILE__ ) . '/inc/fields/class-shortcode-ui-field-attachment.php';
|
27 |
+
require_once dirname( __FILE__ ) . '/inc/fields/class-shortcode-ui-field-color.php';
|
28 |
+
require_once dirname( __FILE__ ) . '/inc/fields/class-shortcode-ui-field-post-select.php';
|
29 |
+
require_once dirname( __FILE__ ) . '/inc/fields/class-shortcode-ui-field-term-select.php';
|
30 |
+
require_once dirname( __FILE__ ) . '/inc/fields/class-shortcode-ui-field-user-select.php';
|
31 |
|
32 |
add_action( 'init', 'shortcode_ui_load_textdomain' );
|
33 |
|
39 |
* @return null
|
40 |
*/
|
41 |
function shortcode_ui_init() {
|
42 |
+
|
43 |
+
if ( defined( 'SELECT2_NOCONFLICT' ) && SELECT2_NOCONFLICT ) {
|
44 |
+
Shortcode_UI::$select2_handle = 'select2v4';
|
45 |
+
}
|
46 |
+
|
47 |
$shortcode_ui = Shortcode_UI::get_instance();
|
48 |
$fields = Shortcode_UI_Fields::get_instance();
|
49 |
+
$attachment_field = Shortcode_UI_Field_Attachment::get_instance();
|
50 |
+
$color_field = Shortcode_UI_Field_Color::get_instance();
|
51 |
$post_field = Shortcode_UI_Field_Post_Select::get_instance();
|
52 |
$term_field = Shortcode_UI_Field_Term_Select::get_instance();
|
53 |
$user_field = Shortcode_UI_Field_User_Select::get_instance();
|
67 |
$path = dirname( __FILE__ ) . '/languages';
|
68 |
// Load the textdomain according to the plugin first
|
69 |
$mofile = $domain . '-' . $locale . '.mo';
|
70 |
+
$loaded = load_textdomain( $domain, $path . '/' . $mofile );
|
71 |
+
|
72 |
+
// If not loaded, load from the languages directory
|
73 |
+
if ( ! $loaded ) {
|
74 |
+
$mofile = WP_LANG_DIR . '/plugins/' . $mofile;
|
75 |
+
load_textdomain( $domain, $mofile );
|
76 |
}
|
77 |
|
|
|
|
|
|
|
78 |
}
|
79 |
|
80 |
/**
|