Version Description
- Initial version.
=
Download this release
Release Info
| Developer | claudiosanches |
| Plugin | |
| Version | 1.0.0 |
| Comparing to | |
| See all releases | |
Version 1.0.0
- assets/css/editor.css +1 -0
- assets/css/editor.scss +16 -0
- assets/js/editor.js +776 -0
- assets/js/editor.min.js +1 -0
- includes/class-wc-shortcodes-admin.php +100 -0
- includes/wc-shortcodes-editor-i18n.php +67 -0
- languages/woocommerce-shortcodes.pot +262 -0
- readme.txt +66 -0
- woocommerce-shortcodes.php +106 -0
assets/css/editor.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
| 1 |
+
i.mce-i-woocommerce-shortcodes{position:relative}i.mce-i-woocommerce-shortcodes:before{font-family:'WooCommerce';speak:none;-webkit-font-smoothing:antialiased;position:absolute;top:0;left:0;width:100%;height:100%;text-align:center;content:"\e03d"}
|
assets/css/editor.scss
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
i.mce-i-woocommerce-shortcodes {
|
| 2 |
+
position: relative;
|
| 3 |
+
|
| 4 |
+
&:before {
|
| 5 |
+
font-family: 'WooCommerce';
|
| 6 |
+
speak: none;
|
| 7 |
+
-webkit-font-smoothing: antialiased;
|
| 8 |
+
position: absolute;
|
| 9 |
+
top: 0;
|
| 10 |
+
left: 0;
|
| 11 |
+
width: 100%;
|
| 12 |
+
height: 100%;
|
| 13 |
+
text-align: center;
|
| 14 |
+
content: "\e03d";
|
| 15 |
+
}
|
| 16 |
+
}
|
assets/js/editor.js
ADDED
|
@@ -0,0 +1,776 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
/*global tinymce */
|
| 2 |
+
( function () {
|
| 3 |
+
|
| 4 |
+
/**
|
| 5 |
+
* Check is empty.
|
| 6 |
+
*
|
| 7 |
+
* @param {string} value
|
| 8 |
+
* @return {bool}
|
| 9 |
+
*/
|
| 10 |
+
function wcShortcodesIsEmpty( value ) {
|
| 11 |
+
value = value.toString();
|
| 12 |
+
|
| 13 |
+
if ( 0 !== value.length ) {
|
| 14 |
+
return false;
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
return true;
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
/**
|
| 21 |
+
* Add the shortcodes downdown.
|
| 22 |
+
*/
|
| 23 |
+
tinymce.PluginManager.add( 'woocommerce_shortcodes', function ( editor ) {
|
| 24 |
+
var ed = tinymce.activeEditor;
|
| 25 |
+
editor.addButton( 'woocommerce_shortcodes', {
|
| 26 |
+
text: ed.getLang( 'woocommerce_shortcodes.shortcode_title' ),
|
| 27 |
+
icon: 'woocommerce-shortcodes',
|
| 28 |
+
type: 'menubutton',
|
| 29 |
+
menu: [
|
| 30 |
+
{
|
| 31 |
+
text: ed.getLang( 'woocommerce_shortcodes.product' ),
|
| 32 |
+
menu: [
|
| 33 |
+
{
|
| 34 |
+
text: ed.getLang( 'woocommerce_shortcodes.add_to_cart' ),
|
| 35 |
+
onclick: function () {
|
| 36 |
+
editor.windowManager.open({
|
| 37 |
+
title: ed.getLang( 'woocommerce_shortcodes.product' ) + ' ' + ed.getLang( 'woocommerce_shortcodes.add_to_cart' ),
|
| 38 |
+
body: [
|
| 39 |
+
{
|
| 40 |
+
type: 'textbox',
|
| 41 |
+
name: 'id',
|
| 42 |
+
label: ed.getLang( 'woocommerce_shortcodes.id' )
|
| 43 |
+
},
|
| 44 |
+
{
|
| 45 |
+
type: 'textbox',
|
| 46 |
+
name: 'sku',
|
| 47 |
+
label: ed.getLang( 'woocommerce_shortcodes.sku' )
|
| 48 |
+
},
|
| 49 |
+
{
|
| 50 |
+
type: 'textbox',
|
| 51 |
+
name: 'style',
|
| 52 |
+
label: ed.getLang( 'woocommerce_shortcodes.style' )
|
| 53 |
+
},
|
| 54 |
+
{
|
| 55 |
+
type: 'checkbox',
|
| 56 |
+
name: 'show_price',
|
| 57 |
+
label: ed.getLang( 'woocommerce_shortcodes.show_price' ),
|
| 58 |
+
checked: true
|
| 59 |
+
}
|
| 60 |
+
],
|
| 61 |
+
onsubmit: function ( e ) {
|
| 62 |
+
var id = wcShortcodesIsEmpty( e.data.id ) ? '' : ' id="' + e.data.id + '"',
|
| 63 |
+
sku = wcShortcodesIsEmpty( e.data.sku ) ? '' : ' sku="' + e.data.sku + '"',
|
| 64 |
+
style = wcShortcodesIsEmpty( e.data.style ) ? '' : ' style="' + e.data.style + '"',
|
| 65 |
+
show_price = e.data.show_price ? '' : ' show_price="' + e.data.show_price + '"';
|
| 66 |
+
|
| 67 |
+
if ( ! wcShortcodesIsEmpty( e.data.id ) || ! wcShortcodesIsEmpty( e.data.sku ) ) {
|
| 68 |
+
editor.insertContent( '[add_to_cart' + id + sku + style + show_price + ']' );
|
| 69 |
+
} else {
|
| 70 |
+
editor.windowManager.alert( ed.getLang( 'woocommerce_shortcodes.need_id_or_sku' ) );
|
| 71 |
+
}
|
| 72 |
+
}
|
| 73 |
+
});
|
| 74 |
+
}
|
| 75 |
+
},
|
| 76 |
+
{
|
| 77 |
+
text: ed.getLang( 'woocommerce_shortcodes.add_to_cart_url' ),
|
| 78 |
+
onclick: function () {
|
| 79 |
+
editor.windowManager.open({
|
| 80 |
+
title: ed.getLang( 'woocommerce_shortcodes.product' ) + ' ' + ed.getLang( 'woocommerce_shortcodes.add_to_cart_url' ),
|
| 81 |
+
body: [
|
| 82 |
+
{
|
| 83 |
+
type: 'textbox',
|
| 84 |
+
name: 'id',
|
| 85 |
+
label: ed.getLang( 'woocommerce_shortcodes.id' )
|
| 86 |
+
},
|
| 87 |
+
{
|
| 88 |
+
type: 'textbox',
|
| 89 |
+
name: 'sku',
|
| 90 |
+
label: ed.getLang( 'woocommerce_shortcodes.sku' )
|
| 91 |
+
}
|
| 92 |
+
],
|
| 93 |
+
onsubmit: function ( e ) {
|
| 94 |
+
var id = wcShortcodesIsEmpty( e.data.id ) ? '' : ' id="' + e.data.id + '"',
|
| 95 |
+
sku = wcShortcodesIsEmpty( e.data.sku ) ? '' : ' sku="' + e.data.sku + '"';
|
| 96 |
+
|
| 97 |
+
if ( ! wcShortcodesIsEmpty( e.data.id ) || ! wcShortcodesIsEmpty( e.data.sku ) ) {
|
| 98 |
+
editor.insertContent( '[add_to_cart_url' + id + sku + ']' );
|
| 99 |
+
} else {
|
| 100 |
+
editor.windowManager.alert( ed.getLang( 'woocommerce_shortcodes.need_id_or_sku' ) );
|
| 101 |
+
}
|
| 102 |
+
}
|
| 103 |
+
});
|
| 104 |
+
}
|
| 105 |
+
},
|
| 106 |
+
{
|
| 107 |
+
text: ed.getLang( 'woocommerce_shortcodes.product_by_sku' ),
|
| 108 |
+
onclick: function () {
|
| 109 |
+
editor.windowManager.open({
|
| 110 |
+
title: ed.getLang( 'woocommerce_shortcodes.product' ) + ' ' + ed.getLang( 'woocommerce_shortcodes.product_by_sku' ),
|
| 111 |
+
body: [
|
| 112 |
+
{
|
| 113 |
+
type: 'textbox',
|
| 114 |
+
name: 'id',
|
| 115 |
+
label: ed.getLang( 'woocommerce_shortcodes.id' )
|
| 116 |
+
},
|
| 117 |
+
{
|
| 118 |
+
type: 'textbox',
|
| 119 |
+
name: 'sku',
|
| 120 |
+
label: ed.getLang( 'woocommerce_shortcodes.sku' )
|
| 121 |
+
}
|
| 122 |
+
],
|
| 123 |
+
onsubmit: function ( e ) {
|
| 124 |
+
var id = wcShortcodesIsEmpty( e.data.id ) ? '' : ' id="' + e.data.id + '"',
|
| 125 |
+
sku = wcShortcodesIsEmpty( e.data.sku ) ? '' : ' sku="' + e.data.sku + '"';
|
| 126 |
+
|
| 127 |
+
if ( ! wcShortcodesIsEmpty( e.data.id ) || ! wcShortcodesIsEmpty( e.data.sku ) ) {
|
| 128 |
+
editor.insertContent( '[product' + id + sku + ']' );
|
| 129 |
+
} else {
|
| 130 |
+
editor.windowManager.alert( ed.getLang( 'woocommerce_shortcodes.need_id_or_sku' ) );
|
| 131 |
+
}
|
| 132 |
+
}
|
| 133 |
+
});
|
| 134 |
+
}
|
| 135 |
+
}
|
| 136 |
+
]
|
| 137 |
+
},
|
| 138 |
+
{
|
| 139 |
+
text: ed.getLang( 'woocommerce_shortcodes.list' ),
|
| 140 |
+
menu: [
|
| 141 |
+
{
|
| 142 |
+
text: ed.getLang( 'woocommerce_shortcodes.products_by_sku' ),
|
| 143 |
+
onclick: function () {
|
| 144 |
+
editor.windowManager.open({
|
| 145 |
+
title: ed.getLang( 'woocommerce_shortcodes.product_by_sku' ),
|
| 146 |
+
body: [
|
| 147 |
+
{
|
| 148 |
+
type: 'textbox',
|
| 149 |
+
name: 'ids',
|
| 150 |
+
label: ed.getLang( 'woocommerce_shortcodes.ids' ),
|
| 151 |
+
tooltip: ed.getLang( 'woocommerce_shortcodes.comma_tooltip' )
|
| 152 |
+
},
|
| 153 |
+
{
|
| 154 |
+
type: 'textbox',
|
| 155 |
+
name: 'skus',
|
| 156 |
+
label: ed.getLang( 'woocommerce_shortcodes.skus' ),
|
| 157 |
+
tooltip: ed.getLang( 'woocommerce_shortcodes.comma_tooltip' )
|
| 158 |
+
}
|
| 159 |
+
],
|
| 160 |
+
onsubmit: function ( e ) {
|
| 161 |
+
var ids = wcShortcodesIsEmpty( e.data.ids ) ? '' : ' ids="' + e.data.ids + '"',
|
| 162 |
+
skus = wcShortcodesIsEmpty( e.data.skus ) ? '' : ' skus="' + e.data.skus + '"';
|
| 163 |
+
|
| 164 |
+
if ( ! wcShortcodesIsEmpty( e.data.ids ) || ! wcShortcodesIsEmpty( e.data.skus ) ) {
|
| 165 |
+
editor.insertContent( '[products' + ids + skus + ']' );
|
| 166 |
+
} else {
|
| 167 |
+
editor.windowManager.alert( ed.getLang( 'woocommerce_shortcodes.need_id_or_sku' ) );
|
| 168 |
+
}
|
| 169 |
+
}
|
| 170 |
+
});
|
| 171 |
+
}
|
| 172 |
+
},
|
| 173 |
+
{
|
| 174 |
+
text: ed.getLang( 'woocommerce_shortcodes.product_categories' ),
|
| 175 |
+
onclick: function () {
|
| 176 |
+
editor.windowManager.open({
|
| 177 |
+
title: ed.getLang( 'woocommerce_shortcodes.product_categories' ),
|
| 178 |
+
body: [
|
| 179 |
+
{
|
| 180 |
+
type: 'textbox',
|
| 181 |
+
name: 'number',
|
| 182 |
+
label: ed.getLang( 'woocommerce_shortcodes.number' )
|
| 183 |
+
},
|
| 184 |
+
{
|
| 185 |
+
type: 'listbox',
|
| 186 |
+
name: 'orderby',
|
| 187 |
+
label: ed.getLang( 'woocommerce_shortcodes.orderby' ),
|
| 188 |
+
values: [
|
| 189 |
+
{
|
| 190 |
+
text: ed.getLang( 'woocommerce_shortcodes.name' ),
|
| 191 |
+
value: 'name'
|
| 192 |
+
},
|
| 193 |
+
{
|
| 194 |
+
text: ed.getLang( 'woocommerce_shortcodes.id' ),
|
| 195 |
+
value: 'id'
|
| 196 |
+
},
|
| 197 |
+
{
|
| 198 |
+
text: ed.getLang( 'woocommerce_shortcodes.count' ),
|
| 199 |
+
value: 'count'
|
| 200 |
+
},
|
| 201 |
+
{
|
| 202 |
+
text: ed.getLang( 'woocommerce_shortcodes.slug' ),
|
| 203 |
+
value: 'slug'
|
| 204 |
+
},
|
| 205 |
+
{
|
| 206 |
+
text: ed.getLang( 'woocommerce_shortcodes.none' ),
|
| 207 |
+
value: 'none'
|
| 208 |
+
}
|
| 209 |
+
]
|
| 210 |
+
},
|
| 211 |
+
{
|
| 212 |
+
type: 'listbox',
|
| 213 |
+
name: 'order',
|
| 214 |
+
label: ed.getLang( 'woocommerce_shortcodes.order' ),
|
| 215 |
+
values: [
|
| 216 |
+
{
|
| 217 |
+
text: ed.getLang( 'woocommerce_shortcodes.asc' ),
|
| 218 |
+
value: 'ASC'
|
| 219 |
+
},
|
| 220 |
+
{
|
| 221 |
+
text: ed.getLang( 'woocommerce_shortcodes.desc' ),
|
| 222 |
+
value: 'DESC'
|
| 223 |
+
}
|
| 224 |
+
]
|
| 225 |
+
},
|
| 226 |
+
{
|
| 227 |
+
type: 'textbox',
|
| 228 |
+
name: 'columns',
|
| 229 |
+
label: ed.getLang( 'woocommerce_shortcodes.columns' )
|
| 230 |
+
},
|
| 231 |
+
{
|
| 232 |
+
type: 'checkbox',
|
| 233 |
+
name: 'hide_empty',
|
| 234 |
+
label: ed.getLang( 'woocommerce_shortcodes.hide_empty' ),
|
| 235 |
+
checked: true
|
| 236 |
+
},
|
| 237 |
+
{
|
| 238 |
+
type: 'textbox',
|
| 239 |
+
name: 'parent_id',
|
| 240 |
+
label: ed.getLang( 'woocommerce_shortcodes.parent_id' )
|
| 241 |
+
},
|
| 242 |
+
{
|
| 243 |
+
type: 'textbox',
|
| 244 |
+
name: 'ids',
|
| 245 |
+
label: ed.getLang( 'woocommerce_shortcodes.ids' ),
|
| 246 |
+
tooltip: ed.getLang( 'woocommerce_shortcodes.comma_tooltip' )
|
| 247 |
+
}
|
| 248 |
+
],
|
| 249 |
+
onsubmit: function ( e ) {
|
| 250 |
+
var number = wcShortcodesIsEmpty( e.data.number ) ? '' : ' number="' + e.data.number + '"',
|
| 251 |
+
columns = wcShortcodesIsEmpty( e.data.columns ) ? '' : ' columns="' + e.data.columns + '"',
|
| 252 |
+
hide_empty = e.data.hide_empty ? '' : ' hide_empty="' + e.data.hide_empty + '"',
|
| 253 |
+
parent_id = wcShortcodesIsEmpty( e.data.parent_id ) ? '' : ' parent="' + e.data.parent_id + '"',
|
| 254 |
+
ids = wcShortcodesIsEmpty( e.data.ids ) ? '' : ' ids="' + e.data.ids + '"';
|
| 255 |
+
|
| 256 |
+
editor.insertContent( '[product_categories' + number + columns + ' orderby="' + e.data.orderby + '" order="' + e.data.order + '"' + hide_empty + parent_id + ids + ']' );
|
| 257 |
+
}
|
| 258 |
+
});
|
| 259 |
+
}
|
| 260 |
+
},
|
| 261 |
+
{
|
| 262 |
+
text: ed.getLang( 'woocommerce_shortcodes.products_by_cat_slug' ),
|
| 263 |
+
onclick: function () {
|
| 264 |
+
editor.windowManager.open({
|
| 265 |
+
title: ed.getLang( 'woocommerce_shortcodes.products_by_cat_slug' ),
|
| 266 |
+
body: [
|
| 267 |
+
{
|
| 268 |
+
type: 'textbox',
|
| 269 |
+
name: 'category_slug',
|
| 270 |
+
label: ed.getLang( 'woocommerce_shortcodes.category_slug' )
|
| 271 |
+
},
|
| 272 |
+
{
|
| 273 |
+
type: 'textbox',
|
| 274 |
+
name: 'per_page',
|
| 275 |
+
label: ed.getLang( 'woocommerce_shortcodes.categories_per_page' ),
|
| 276 |
+
value: '12'
|
| 277 |
+
},
|
| 278 |
+
{
|
| 279 |
+
type: 'textbox',
|
| 280 |
+
name: 'columns',
|
| 281 |
+
label: ed.getLang( 'woocommerce_shortcodes.columns' ),
|
| 282 |
+
value: '4'
|
| 283 |
+
},
|
| 284 |
+
{
|
| 285 |
+
type: 'listbox',
|
| 286 |
+
name: 'orderby',
|
| 287 |
+
label: ed.getLang( 'woocommerce_shortcodes.orderby' ),
|
| 288 |
+
values: [
|
| 289 |
+
{
|
| 290 |
+
text: ed.getLang( 'woocommerce_shortcodes.default' ),
|
| 291 |
+
value: 'default'
|
| 292 |
+
},
|
| 293 |
+
{
|
| 294 |
+
text: ed.getLang( 'woocommerce_shortcodes.rand' ),
|
| 295 |
+
value: 'rand'
|
| 296 |
+
},
|
| 297 |
+
{
|
| 298 |
+
text: ed.getLang( 'woocommerce_shortcodes.date' ),
|
| 299 |
+
value: 'date'
|
| 300 |
+
},
|
| 301 |
+
{
|
| 302 |
+
text: ed.getLang( 'woocommerce_shortcodes.price' ),
|
| 303 |
+
value: 'price'
|
| 304 |
+
},
|
| 305 |
+
{
|
| 306 |
+
text: ed.getLang( 'woocommerce_shortcodes.popularity' ),
|
| 307 |
+
value: 'popularity'
|
| 308 |
+
},
|
| 309 |
+
{
|
| 310 |
+
text: ed.getLang( 'woocommerce_shortcodes.rating' ),
|
| 311 |
+
value: 'rating'
|
| 312 |
+
},
|
| 313 |
+
{
|
| 314 |
+
text: ed.getLang( 'woocommerce_shortcodes.title' ),
|
| 315 |
+
value: 'title'
|
| 316 |
+
}
|
| 317 |
+
]
|
| 318 |
+
},
|
| 319 |
+
{
|
| 320 |
+
type: 'listbox',
|
| 321 |
+
name: 'order',
|
| 322 |
+
label: ed.getLang( 'woocommerce_shortcodes.order' ),
|
| 323 |
+
values: [
|
| 324 |
+
{
|
| 325 |
+
text: ed.getLang( 'woocommerce_shortcodes.asc' ),
|
| 326 |
+
value: 'ASC'
|
| 327 |
+
},
|
| 328 |
+
{
|
| 329 |
+
text: ed.getLang( 'woocommerce_shortcodes.desc' ),
|
| 330 |
+
value: 'DESC'
|
| 331 |
+
}
|
| 332 |
+
]
|
| 333 |
+
},
|
| 334 |
+
{
|
| 335 |
+
type: 'listbox',
|
| 336 |
+
name: 'operator',
|
| 337 |
+
label: ed.getLang( 'woocommerce_shortcodes.operator' ),
|
| 338 |
+
values: [
|
| 339 |
+
{
|
| 340 |
+
text: ed.getLang( 'woocommerce_shortcodes.in' ),
|
| 341 |
+
value: 'IN'
|
| 342 |
+
},
|
| 343 |
+
{
|
| 344 |
+
text: ed.getLang( 'woocommerce_shortcodes.not_in' ),
|
| 345 |
+
value: 'NOT IN'
|
| 346 |
+
},
|
| 347 |
+
{
|
| 348 |
+
text: ed.getLang( 'woocommerce_shortcodes.and' ),
|
| 349 |
+
value: 'AND'
|
| 350 |
+
}
|
| 351 |
+
]
|
| 352 |
+
}
|
| 353 |
+
],
|
| 354 |
+
onsubmit: function ( e ) {
|
| 355 |
+
var category = wcShortcodesIsEmpty( e.data.category_slug ) ? '' : ' category="' + e.data.category_slug + '"';
|
| 356 |
+
|
| 357 |
+
if ( ! wcShortcodesIsEmpty( e.data.category_slug ) ) {
|
| 358 |
+
editor.insertContent( '[product_category' + category + ' per_page="' + e.data.per_page + '" columns="' + e.data.columns + '" orderby="' + e.data.orderby + '" order="' + e.data.order + '" operator="' + e.data.operator + '"]' );
|
| 359 |
+
} else {
|
| 360 |
+
editor.windowManager.alert( ed.getLang( 'woocommerce_shortcodes.need_category_slug' ) );
|
| 361 |
+
}
|
| 362 |
+
}
|
| 363 |
+
});
|
| 364 |
+
}
|
| 365 |
+
},
|
| 366 |
+
{
|
| 367 |
+
text: ed.getLang( 'woocommerce_shortcodes.products_by_attribute' ),
|
| 368 |
+
onclick: function () {
|
| 369 |
+
editor.windowManager.open({
|
| 370 |
+
title: ed.getLang( 'woocommerce_shortcodes.products_by_attribute' ),
|
| 371 |
+
body: [
|
| 372 |
+
{
|
| 373 |
+
type: 'textbox',
|
| 374 |
+
name: 'attribute_slug',
|
| 375 |
+
label: ed.getLang( 'woocommerce_shortcodes.attribute_slug' )
|
| 376 |
+
},
|
| 377 |
+
{
|
| 378 |
+
type: 'textbox',
|
| 379 |
+
name: 'terms_slug',
|
| 380 |
+
label: ed.getLang( 'woocommerce_shortcodes.terms_slug' ),
|
| 381 |
+
tooltip: ed.getLang( 'woocommerce_shortcodes.comma_tooltip' )
|
| 382 |
+
},
|
| 383 |
+
{
|
| 384 |
+
type: 'textbox',
|
| 385 |
+
name: 'per_page',
|
| 386 |
+
label: ed.getLang( 'woocommerce_shortcodes.products_per_page' ),
|
| 387 |
+
value: '12'
|
| 388 |
+
},
|
| 389 |
+
{
|
| 390 |
+
type: 'textbox',
|
| 391 |
+
name: 'columns',
|
| 392 |
+
label: ed.getLang( 'woocommerce_shortcodes.columns' ),
|
| 393 |
+
value: '4'
|
| 394 |
+
},
|
| 395 |
+
{
|
| 396 |
+
type: 'listbox',
|
| 397 |
+
name: 'orderby',
|
| 398 |
+
label: ed.getLang( 'woocommerce_shortcodes.orderby' ),
|
| 399 |
+
values: [
|
| 400 |
+
{
|
| 401 |
+
text: ed.getLang( 'woocommerce_shortcodes.date' ),
|
| 402 |
+
value: 'date'
|
| 403 |
+
},
|
| 404 |
+
{
|
| 405 |
+
text: ed.getLang( 'woocommerce_shortcodes.rand' ),
|
| 406 |
+
value: 'rand'
|
| 407 |
+
},
|
| 408 |
+
{
|
| 409 |
+
text: ed.getLang( 'woocommerce_shortcodes.title' ),
|
| 410 |
+
value: 'title'
|
| 411 |
+
},
|
| 412 |
+
{
|
| 413 |
+
text: ed.getLang( 'woocommerce_shortcodes.none' ),
|
| 414 |
+
value: 'none'
|
| 415 |
+
}
|
| 416 |
+
]
|
| 417 |
+
},
|
| 418 |
+
{
|
| 419 |
+
type: 'listbox',
|
| 420 |
+
name: 'order',
|
| 421 |
+
label: ed.getLang( 'woocommerce_shortcodes.order' ),
|
| 422 |
+
values: [
|
| 423 |
+
{
|
| 424 |
+
text: ed.getLang( 'woocommerce_shortcodes.asc' ),
|
| 425 |
+
value: 'ASC'
|
| 426 |
+
},
|
| 427 |
+
{
|
| 428 |
+
text: ed.getLang( 'woocommerce_shortcodes.desc' ),
|
| 429 |
+
value: 'DESC'
|
| 430 |
+
}
|
| 431 |
+
]
|
| 432 |
+
}
|
| 433 |
+
],
|
| 434 |
+
onsubmit: function ( e ) {
|
| 435 |
+
if ( ! wcShortcodesIsEmpty( e.data.attribute_slug ) && ! wcShortcodesIsEmpty( e.data.terms_slug ) ) {
|
| 436 |
+
editor.insertContent( '[product_attribute attribute="' + e.data.attribute_slug + '" filter="' + e.data.terms_slug + '" per_page="' + e.data.per_page + '" columns="' + e.data.columns + '" orderby="' + e.data.orderby + '" order="' + e.data.order + '"]' );
|
| 437 |
+
} else {
|
| 438 |
+
editor.windowManager.alert( ed.getLang( 'woocommerce_shortcodes.need_attribute_and_terms_slugs' ) );
|
| 439 |
+
}
|
| 440 |
+
}
|
| 441 |
+
});
|
| 442 |
+
}
|
| 443 |
+
},
|
| 444 |
+
{
|
| 445 |
+
text: ed.getLang( 'woocommerce_shortcodes.recent_products' ),
|
| 446 |
+
onclick: function () {
|
| 447 |
+
editor.windowManager.open({
|
| 448 |
+
title: ed.getLang( 'woocommerce_shortcodes.recent_products' ),
|
| 449 |
+
body: [
|
| 450 |
+
{
|
| 451 |
+
type: 'textbox',
|
| 452 |
+
name: 'per_page',
|
| 453 |
+
label: ed.getLang( 'woocommerce_shortcodes.products_per_page' ),
|
| 454 |
+
value: '12'
|
| 455 |
+
},
|
| 456 |
+
{
|
| 457 |
+
type: 'textbox',
|
| 458 |
+
name: 'columns',
|
| 459 |
+
label: ed.getLang( 'woocommerce_shortcodes.columns' ),
|
| 460 |
+
value: '4'
|
| 461 |
+
},
|
| 462 |
+
{
|
| 463 |
+
type: 'listbox',
|
| 464 |
+
name: 'orderby',
|
| 465 |
+
label: ed.getLang( 'woocommerce_shortcodes.orderby' ),
|
| 466 |
+
values: [
|
| 467 |
+
{
|
| 468 |
+
text: ed.getLang( 'woocommerce_shortcodes.date' ),
|
| 469 |
+
value: 'date'
|
| 470 |
+
},
|
| 471 |
+
{
|
| 472 |
+
text: ed.getLang( 'woocommerce_shortcodes.rand' ),
|
| 473 |
+
value: 'rand'
|
| 474 |
+
},
|
| 475 |
+
{
|
| 476 |
+
text: ed.getLang( 'woocommerce_shortcodes.title' ),
|
| 477 |
+
value: 'title'
|
| 478 |
+
},
|
| 479 |
+
{
|
| 480 |
+
text: ed.getLang( 'woocommerce_shortcodes.none' ),
|
| 481 |
+
value: 'none'
|
| 482 |
+
}
|
| 483 |
+
]
|
| 484 |
+
},
|
| 485 |
+
{
|
| 486 |
+
type: 'listbox',
|
| 487 |
+
name: 'order',
|
| 488 |
+
label: ed.getLang( 'woocommerce_shortcodes.order' ),
|
| 489 |
+
values: [
|
| 490 |
+
{
|
| 491 |
+
text: ed.getLang( 'woocommerce_shortcodes.asc' ),
|
| 492 |
+
value: 'ASC'
|
| 493 |
+
},
|
| 494 |
+
{
|
| 495 |
+
text: ed.getLang( 'woocommerce_shortcodes.desc' ),
|
| 496 |
+
value: 'DESC'
|
| 497 |
+
}
|
| 498 |
+
]
|
| 499 |
+
}
|
| 500 |
+
],
|
| 501 |
+
onsubmit: function ( e ) {
|
| 502 |
+
editor.insertContent( '[recent_products per_page="' + e.data.per_page + '" columns="' + e.data.columns + '" orderby="' + e.data.orderby + '" order="' + e.data.order + '"]' );
|
| 503 |
+
}
|
| 504 |
+
});
|
| 505 |
+
}
|
| 506 |
+
},
|
| 507 |
+
{
|
| 508 |
+
text: ed.getLang( 'woocommerce_shortcodes.featured_products' ),
|
| 509 |
+
onclick: function () {
|
| 510 |
+
editor.windowManager.open({
|
| 511 |
+
title: ed.getLang( 'woocommerce_shortcodes.featured_products' ),
|
| 512 |
+
body: [
|
| 513 |
+
{
|
| 514 |
+
type: 'textbox',
|
| 515 |
+
name: 'per_page',
|
| 516 |
+
label: ed.getLang( 'woocommerce_shortcodes.products_per_page' ),
|
| 517 |
+
value: '12'
|
| 518 |
+
},
|
| 519 |
+
{
|
| 520 |
+
type: 'textbox',
|
| 521 |
+
name: 'columns',
|
| 522 |
+
label: ed.getLang( 'woocommerce_shortcodes.columns' ),
|
| 523 |
+
value: '4'
|
| 524 |
+
},
|
| 525 |
+
{
|
| 526 |
+
type: 'listbox',
|
| 527 |
+
name: 'orderby',
|
| 528 |
+
label: ed.getLang( 'woocommerce_shortcodes.orderby' ),
|
| 529 |
+
values: [
|
| 530 |
+
{
|
| 531 |
+
text: ed.getLang( 'woocommerce_shortcodes.date' ),
|
| 532 |
+
value: 'date'
|
| 533 |
+
},
|
| 534 |
+
{
|
| 535 |
+
text: ed.getLang( 'woocommerce_shortcodes.rand' ),
|
| 536 |
+
value: 'rand'
|
| 537 |
+
},
|
| 538 |
+
{
|
| 539 |
+
text: ed.getLang( 'woocommerce_shortcodes.title' ),
|
| 540 |
+
value: 'title'
|
| 541 |
+
},
|
| 542 |
+
{
|
| 543 |
+
text: ed.getLang( 'woocommerce_shortcodes.none' ),
|
| 544 |
+
value: 'none'
|
| 545 |
+
}
|
| 546 |
+
]
|
| 547 |
+
},
|
| 548 |
+
{
|
| 549 |
+
type: 'listbox',
|
| 550 |
+
name: 'order',
|
| 551 |
+
label: ed.getLang( 'woocommerce_shortcodes.order' ),
|
| 552 |
+
values: [
|
| 553 |
+
{
|
| 554 |
+
text: ed.getLang( 'woocommerce_shortcodes.asc' ),
|
| 555 |
+
value: 'ASC'
|
| 556 |
+
},
|
| 557 |
+
{
|
| 558 |
+
text: ed.getLang( 'woocommerce_shortcodes.desc' ),
|
| 559 |
+
value: 'DESC'
|
| 560 |
+
}
|
| 561 |
+
]
|
| 562 |
+
}
|
| 563 |
+
],
|
| 564 |
+
onsubmit: function ( e ) {
|
| 565 |
+
editor.insertContent( '[featured_products per_page="' + e.data.per_page + '" columns="' + e.data.columns + '" orderby="' + e.data.orderby + '" order="' + e.data.order + '"]' );
|
| 566 |
+
}
|
| 567 |
+
});
|
| 568 |
+
}
|
| 569 |
+
},
|
| 570 |
+
{
|
| 571 |
+
text: ed.getLang( 'woocommerce_shortcodes.sale_products' ),
|
| 572 |
+
onclick: function () {
|
| 573 |
+
editor.windowManager.open({
|
| 574 |
+
title: ed.getLang( 'woocommerce_shortcodes.sale_products' ),
|
| 575 |
+
body: [
|
| 576 |
+
{
|
| 577 |
+
type: 'textbox',
|
| 578 |
+
name: 'per_page',
|
| 579 |
+
label: ed.getLang( 'woocommerce_shortcodes.products_per_page' ),
|
| 580 |
+
value: '12'
|
| 581 |
+
},
|
| 582 |
+
{
|
| 583 |
+
type: 'textbox',
|
| 584 |
+
name: 'columns',
|
| 585 |
+
label: ed.getLang( 'woocommerce_shortcodes.columns' ),
|
| 586 |
+
value: '4'
|
| 587 |
+
},
|
| 588 |
+
{
|
| 589 |
+
type: 'listbox',
|
| 590 |
+
name: 'orderby',
|
| 591 |
+
label: ed.getLang( 'woocommerce_shortcodes.orderby' ),
|
| 592 |
+
values: [
|
| 593 |
+
{
|
| 594 |
+
text: ed.getLang( 'woocommerce_shortcodes.date' ),
|
| 595 |
+
value: 'date'
|
| 596 |
+
},
|
| 597 |
+
{
|
| 598 |
+
text: ed.getLang( 'woocommerce_shortcodes.rand' ),
|
| 599 |
+
value: 'rand'
|
| 600 |
+
},
|
| 601 |
+
{
|
| 602 |
+
text: ed.getLang( 'woocommerce_shortcodes.title' ),
|
| 603 |
+
value: 'title'
|
| 604 |
+
},
|
| 605 |
+
{
|
| 606 |
+
text: ed.getLang( 'woocommerce_shortcodes.none' ),
|
| 607 |
+
value: 'none'
|
| 608 |
+
}
|
| 609 |
+
]
|
| 610 |
+
},
|
| 611 |
+
{
|
| 612 |
+
type: 'listbox',
|
| 613 |
+
name: 'order',
|
| 614 |
+
label: ed.getLang( 'woocommerce_shortcodes.order' ),
|
| 615 |
+
values: [
|
| 616 |
+
{
|
| 617 |
+
text: ed.getLang( 'woocommerce_shortcodes.asc' ),
|
| 618 |
+
value: 'ASC'
|
| 619 |
+
},
|
| 620 |
+
{
|
| 621 |
+
text: ed.getLang( 'woocommerce_shortcodes.desc' ),
|
| 622 |
+
value: 'DESC'
|
| 623 |
+
}
|
| 624 |
+
]
|
| 625 |
+
}
|
| 626 |
+
],
|
| 627 |
+
onsubmit: function ( e ) {
|
| 628 |
+
editor.insertContent( '[sale_products per_page="' + e.data.per_page + '" columns="' + e.data.columns + '" orderby="' + e.data.orderby + '" order="' + e.data.order + '"]' );
|
| 629 |
+
}
|
| 630 |
+
});
|
| 631 |
+
}
|
| 632 |
+
},
|
| 633 |
+
{
|
| 634 |
+
text: ed.getLang( 'woocommerce_shortcodes.best_selling_products' ),
|
| 635 |
+
onclick: function () {
|
| 636 |
+
editor.windowManager.open({
|
| 637 |
+
title: ed.getLang( 'woocommerce_shortcodes.best_selling_products' ),
|
| 638 |
+
body: [
|
| 639 |
+
{
|
| 640 |
+
type: 'textbox',
|
| 641 |
+
name: 'per_page',
|
| 642 |
+
label: ed.getLang( 'woocommerce_shortcodes.products_per_page' ),
|
| 643 |
+
value: '12'
|
| 644 |
+
},
|
| 645 |
+
{
|
| 646 |
+
type: 'textbox',
|
| 647 |
+
name: 'columns',
|
| 648 |
+
label: ed.getLang( 'woocommerce_shortcodes.columns' ),
|
| 649 |
+
value: '4'
|
| 650 |
+
},
|
| 651 |
+
{
|
| 652 |
+
type: 'listbox',
|
| 653 |
+
name: 'orderby',
|
| 654 |
+
label: ed.getLang( 'woocommerce_shortcodes.orderby' ),
|
| 655 |
+
values: [
|
| 656 |
+
{
|
| 657 |
+
text: ed.getLang( 'woocommerce_shortcodes.date' ),
|
| 658 |
+
value: 'date'
|
| 659 |
+
},
|
| 660 |
+
{
|
| 661 |
+
text: ed.getLang( 'woocommerce_shortcodes.rand' ),
|
| 662 |
+
value: 'rand'
|
| 663 |
+
},
|
| 664 |
+
{
|
| 665 |
+
text: ed.getLang( 'woocommerce_shortcodes.title' ),
|
| 666 |
+
value: 'title'
|
| 667 |
+
},
|
| 668 |
+
{
|
| 669 |
+
text: ed.getLang( 'woocommerce_shortcodes.none' ),
|
| 670 |
+
value: 'none'
|
| 671 |
+
}
|
| 672 |
+
]
|
| 673 |
+
},
|
| 674 |
+
{
|
| 675 |
+
type: 'listbox',
|
| 676 |
+
name: 'order',
|
| 677 |
+
label: ed.getLang( 'woocommerce_shortcodes.order' ),
|
| 678 |
+
values: [
|
| 679 |
+
{
|
| 680 |
+
text: ed.getLang( 'woocommerce_shortcodes.asc' ),
|
| 681 |
+
value: 'ASC'
|
| 682 |
+
},
|
| 683 |
+
{
|
| 684 |
+
text: ed.getLang( 'woocommerce_shortcodes.desc' ),
|
| 685 |
+
value: 'DESC'
|
| 686 |
+
}
|
| 687 |
+
]
|
| 688 |
+
}
|
| 689 |
+
],
|
| 690 |
+
onsubmit: function ( e ) {
|
| 691 |
+
editor.insertContent( '[best_selling_products per_page="' + e.data.per_page + '" columns="' + e.data.columns + '" orderby="' + e.data.orderby + '" order="' + e.data.order + '"]' );
|
| 692 |
+
}
|
| 693 |
+
});
|
| 694 |
+
}
|
| 695 |
+
},
|
| 696 |
+
{
|
| 697 |
+
text: ed.getLang( 'woocommerce_shortcodes.top_rated_products' ),
|
| 698 |
+
onclick: function () {
|
| 699 |
+
editor.windowManager.open({
|
| 700 |
+
title: ed.getLang( 'woocommerce_shortcodes.top_rated_products' ),
|
| 701 |
+
body: [
|
| 702 |
+
{
|
| 703 |
+
type: 'textbox',
|
| 704 |
+
name: 'per_page',
|
| 705 |
+
label: ed.getLang( 'woocommerce_shortcodes.products_per_page' ),
|
| 706 |
+
value: '12'
|
| 707 |
+
},
|
| 708 |
+
{
|
| 709 |
+
type: 'textbox',
|
| 710 |
+
name: 'columns',
|
| 711 |
+
label: ed.getLang( 'woocommerce_shortcodes.columns' ),
|
| 712 |
+
value: '4'
|
| 713 |
+
},
|
| 714 |
+
{
|
| 715 |
+
type: 'listbox',
|
| 716 |
+
name: 'orderby',
|
| 717 |
+
label: ed.getLang( 'woocommerce_shortcodes.orderby' ),
|
| 718 |
+
values: [
|
| 719 |
+
{
|
| 720 |
+
text: ed.getLang( 'woocommerce_shortcodes.date' ),
|
| 721 |
+
value: 'date'
|
| 722 |
+
},
|
| 723 |
+
{
|
| 724 |
+
text: ed.getLang( 'woocommerce_shortcodes.rand' ),
|
| 725 |
+
value: 'rand'
|
| 726 |
+
},
|
| 727 |
+
{
|
| 728 |
+
text: ed.getLang( 'woocommerce_shortcodes.title' ),
|
| 729 |
+
value: 'title'
|
| 730 |
+
},
|
| 731 |
+
{
|
| 732 |
+
text: ed.getLang( 'woocommerce_shortcodes.none' ),
|
| 733 |
+
value: 'none'
|
| 734 |
+
}
|
| 735 |
+
]
|
| 736 |
+
},
|
| 737 |
+
{
|
| 738 |
+
type: 'listbox',
|
| 739 |
+
name: 'order',
|
| 740 |
+
label: ed.getLang( 'woocommerce_shortcodes.order' ),
|
| 741 |
+
values: [
|
| 742 |
+
{
|
| 743 |
+
text: ed.getLang( 'woocommerce_shortcodes.asc' ),
|
| 744 |
+
value: 'ASC'
|
| 745 |
+
},
|
| 746 |
+
{
|
| 747 |
+
text: ed.getLang( 'woocommerce_shortcodes.desc' ),
|
| 748 |
+
value: 'DESC'
|
| 749 |
+
}
|
| 750 |
+
]
|
| 751 |
+
}
|
| 752 |
+
],
|
| 753 |
+
onsubmit: function ( e ) {
|
| 754 |
+
editor.insertContent( '[top_rated_products per_page="' + e.data.per_page + '" columns="' + e.data.columns + '" orderby="' + e.data.orderby + '" order="' + e.data.order + '"]' );
|
| 755 |
+
}
|
| 756 |
+
});
|
| 757 |
+
}
|
| 758 |
+
}
|
| 759 |
+
]
|
| 760 |
+
},
|
| 761 |
+
{
|
| 762 |
+
text: ed.getLang( 'woocommerce_shortcodes.shop_messages' ),
|
| 763 |
+
onclick: function () {
|
| 764 |
+
editor.insertContent( '[' + ed.getLang( 'woocommerce_shortcodes.shop_messages_shortcode' ) + ']' );
|
| 765 |
+
}
|
| 766 |
+
},
|
| 767 |
+
{
|
| 768 |
+
text: ed.getLang( 'woocommerce_shortcodes.order_tracking' ),
|
| 769 |
+
onclick: function () {
|
| 770 |
+
editor.insertContent( '[' + ed.getLang( 'woocommerce_shortcodes.order_tracking_shortcode' ) + ']' );
|
| 771 |
+
}
|
| 772 |
+
}
|
| 773 |
+
]
|
| 774 |
+
});
|
| 775 |
+
});
|
| 776 |
+
})();
|
assets/js/editor.min.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
| 1 |
+
!function(){function a(a){return a=a.toString(),0!==a.length?!1:!0}tinymce.PluginManager.add("woocommerce_shortcodes",function(b){var c=tinymce.activeEditor;b.addButton("woocommerce_shortcodes",{text:c.getLang("woocommerce_shortcodes.shortcode_title"),icon:"woocommerce-shortcodes",type:"menubutton",menu:[{text:c.getLang("woocommerce_shortcodes.product"),menu:[{text:c.getLang("woocommerce_shortcodes.add_to_cart"),onclick:function(){b.windowManager.open({title:c.getLang("woocommerce_shortcodes.product")+" "+c.getLang("woocommerce_shortcodes.add_to_cart"),body:[{type:"textbox",name:"id",label:c.getLang("woocommerce_shortcodes.id")},{type:"textbox",name:"sku",label:c.getLang("woocommerce_shortcodes.sku")},{type:"textbox",name:"style",label:c.getLang("woocommerce_shortcodes.style")},{type:"checkbox",name:"show_price",label:c.getLang("woocommerce_shortcodes.show_price"),checked:!0}],onsubmit:function(d){var e=a(d.data.id)?"":' id="'+d.data.id+'"',f=a(d.data.sku)?"":' sku="'+d.data.sku+'"',g=a(d.data.style)?"":' style="'+d.data.style+'"',h=d.data.show_price?"":' show_price="'+d.data.show_price+'"';a(d.data.id)&&a(d.data.sku)?b.windowManager.alert(c.getLang("woocommerce_shortcodes.need_id_or_sku")):b.insertContent("[add_to_cart"+e+f+g+h+"]")}})}},{text:c.getLang("woocommerce_shortcodes.add_to_cart_url"),onclick:function(){b.windowManager.open({title:c.getLang("woocommerce_shortcodes.product")+" "+c.getLang("woocommerce_shortcodes.add_to_cart_url"),body:[{type:"textbox",name:"id",label:c.getLang("woocommerce_shortcodes.id")},{type:"textbox",name:"sku",label:c.getLang("woocommerce_shortcodes.sku")}],onsubmit:function(d){var e=a(d.data.id)?"":' id="'+d.data.id+'"',f=a(d.data.sku)?"":' sku="'+d.data.sku+'"';a(d.data.id)&&a(d.data.sku)?b.windowManager.alert(c.getLang("woocommerce_shortcodes.need_id_or_sku")):b.insertContent("[add_to_cart_url"+e+f+"]")}})}},{text:c.getLang("woocommerce_shortcodes.product_by_sku"),onclick:function(){b.windowManager.open({title:c.getLang("woocommerce_shortcodes.product")+" "+c.getLang("woocommerce_shortcodes.product_by_sku"),body:[{type:"textbox",name:"id",label:c.getLang("woocommerce_shortcodes.id")},{type:"textbox",name:"sku",label:c.getLang("woocommerce_shortcodes.sku")}],onsubmit:function(d){var e=a(d.data.id)?"":' id="'+d.data.id+'"',f=a(d.data.sku)?"":' sku="'+d.data.sku+'"';a(d.data.id)&&a(d.data.sku)?b.windowManager.alert(c.getLang("woocommerce_shortcodes.need_id_or_sku")):b.insertContent("[product"+e+f+"]")}})}}]},{text:c.getLang("woocommerce_shortcodes.list"),menu:[{text:c.getLang("woocommerce_shortcodes.products_by_sku"),onclick:function(){b.windowManager.open({title:c.getLang("woocommerce_shortcodes.product_by_sku"),body:[{type:"textbox",name:"ids",label:c.getLang("woocommerce_shortcodes.ids"),tooltip:c.getLang("woocommerce_shortcodes.comma_tooltip")},{type:"textbox",name:"skus",label:c.getLang("woocommerce_shortcodes.skus"),tooltip:c.getLang("woocommerce_shortcodes.comma_tooltip")}],onsubmit:function(d){var e=a(d.data.ids)?"":' ids="'+d.data.ids+'"',f=a(d.data.skus)?"":' skus="'+d.data.skus+'"';a(d.data.ids)&&a(d.data.skus)?b.windowManager.alert(c.getLang("woocommerce_shortcodes.need_id_or_sku")):b.insertContent("[products"+e+f+"]")}})}},{text:c.getLang("woocommerce_shortcodes.product_categories"),onclick:function(){b.windowManager.open({title:c.getLang("woocommerce_shortcodes.product_categories"),body:[{type:"textbox",name:"number",label:c.getLang("woocommerce_shortcodes.number")},{type:"listbox",name:"orderby",label:c.getLang("woocommerce_shortcodes.orderby"),values:[{text:c.getLang("woocommerce_shortcodes.name"),value:"name"},{text:c.getLang("woocommerce_shortcodes.id"),value:"id"},{text:c.getLang("woocommerce_shortcodes.count"),value:"count"},{text:c.getLang("woocommerce_shortcodes.slug"),value:"slug"},{text:c.getLang("woocommerce_shortcodes.none"),value:"none"}]},{type:"listbox",name:"order",label:c.getLang("woocommerce_shortcodes.order"),values:[{text:c.getLang("woocommerce_shortcodes.asc"),value:"ASC"},{text:c.getLang("woocommerce_shortcodes.desc"),value:"DESC"}]},{type:"textbox",name:"columns",label:c.getLang("woocommerce_shortcodes.columns")},{type:"checkbox",name:"hide_empty",label:c.getLang("woocommerce_shortcodes.hide_empty"),checked:!0},{type:"textbox",name:"parent_id",label:c.getLang("woocommerce_shortcodes.parent_id")},{type:"textbox",name:"ids",label:c.getLang("woocommerce_shortcodes.ids"),tooltip:c.getLang("woocommerce_shortcodes.comma_tooltip")}],onsubmit:function(c){var d=a(c.data.number)?"":' number="'+c.data.number+'"',e=a(c.data.columns)?"":' columns="'+c.data.columns+'"',f=c.data.hide_empty?"":' hide_empty="'+c.data.hide_empty+'"',g=a(c.data.parent_id)?"":' parent="'+c.data.parent_id+'"',h=a(c.data.ids)?"":' ids="'+c.data.ids+'"';b.insertContent("[product_categories"+d+e+' orderby="'+c.data.orderby+'" order="'+c.data.order+'"'+f+g+h+"]")}})}},{text:c.getLang("woocommerce_shortcodes.products_by_cat_slug"),onclick:function(){b.windowManager.open({title:c.getLang("woocommerce_shortcodes.products_by_cat_slug"),body:[{type:"textbox",name:"category_slug",label:c.getLang("woocommerce_shortcodes.category_slug")},{type:"textbox",name:"per_page",label:c.getLang("woocommerce_shortcodes.categories_per_page"),value:"12"},{type:"textbox",name:"columns",label:c.getLang("woocommerce_shortcodes.columns"),value:"4"},{type:"listbox",name:"orderby",label:c.getLang("woocommerce_shortcodes.orderby"),values:[{text:c.getLang("woocommerce_shortcodes.default"),value:"default"},{text:c.getLang("woocommerce_shortcodes.rand"),value:"rand"},{text:c.getLang("woocommerce_shortcodes.date"),value:"date"},{text:c.getLang("woocommerce_shortcodes.price"),value:"price"},{text:c.getLang("woocommerce_shortcodes.popularity"),value:"popularity"},{text:c.getLang("woocommerce_shortcodes.rating"),value:"rating"},{text:c.getLang("woocommerce_shortcodes.title"),value:"title"}]},{type:"listbox",name:"order",label:c.getLang("woocommerce_shortcodes.order"),values:[{text:c.getLang("woocommerce_shortcodes.asc"),value:"ASC"},{text:c.getLang("woocommerce_shortcodes.desc"),value:"DESC"}]},{type:"listbox",name:"operator",label:c.getLang("woocommerce_shortcodes.operator"),values:[{text:c.getLang("woocommerce_shortcodes.in"),value:"IN"},{text:c.getLang("woocommerce_shortcodes.not_in"),value:"NOT IN"},{text:c.getLang("woocommerce_shortcodes.and"),value:"AND"}]}],onsubmit:function(d){var e=a(d.data.category_slug)?"":' category="'+d.data.category_slug+'"';a(d.data.category_slug)?b.windowManager.alert(c.getLang("woocommerce_shortcodes.need_category_slug")):b.insertContent("[product_category"+e+' per_page="'+d.data.per_page+'" columns="'+d.data.columns+'" orderby="'+d.data.orderby+'" order="'+d.data.order+'" operator="'+d.data.operator+'"]')}})}},{text:c.getLang("woocommerce_shortcodes.products_by_attribute"),onclick:function(){b.windowManager.open({title:c.getLang("woocommerce_shortcodes.products_by_attribute"),body:[{type:"textbox",name:"attribute_slug",label:c.getLang("woocommerce_shortcodes.attribute_slug")},{type:"textbox",name:"terms_slug",label:c.getLang("woocommerce_shortcodes.terms_slug"),tooltip:c.getLang("woocommerce_shortcodes.comma_tooltip")},{type:"textbox",name:"per_page",label:c.getLang("woocommerce_shortcodes.products_per_page"),value:"12"},{type:"textbox",name:"columns",label:c.getLang("woocommerce_shortcodes.columns"),value:"4"},{type:"listbox",name:"orderby",label:c.getLang("woocommerce_shortcodes.orderby"),values:[{text:c.getLang("woocommerce_shortcodes.date"),value:"date"},{text:c.getLang("woocommerce_shortcodes.rand"),value:"rand"},{text:c.getLang("woocommerce_shortcodes.title"),value:"title"},{text:c.getLang("woocommerce_shortcodes.none"),value:"none"}]},{type:"listbox",name:"order",label:c.getLang("woocommerce_shortcodes.order"),values:[{text:c.getLang("woocommerce_shortcodes.asc"),value:"ASC"},{text:c.getLang("woocommerce_shortcodes.desc"),value:"DESC"}]}],onsubmit:function(d){a(d.data.attribute_slug)||a(d.data.terms_slug)?b.windowManager.alert(c.getLang("woocommerce_shortcodes.need_attribute_and_terms_slugs")):b.insertContent('[product_attribute attribute="'+d.data.attribute_slug+'" filter="'+d.data.terms_slug+'" per_page="'+d.data.per_page+'" columns="'+d.data.columns+'" orderby="'+d.data.orderby+'" order="'+d.data.order+'"]')}})}},{text:c.getLang("woocommerce_shortcodes.recent_products"),onclick:function(){b.windowManager.open({title:c.getLang("woocommerce_shortcodes.recent_products"),body:[{type:"textbox",name:"per_page",label:c.getLang("woocommerce_shortcodes.products_per_page"),value:"12"},{type:"textbox",name:"columns",label:c.getLang("woocommerce_shortcodes.columns"),value:"4"},{type:"listbox",name:"orderby",label:c.getLang("woocommerce_shortcodes.orderby"),values:[{text:c.getLang("woocommerce_shortcodes.date"),value:"date"},{text:c.getLang("woocommerce_shortcodes.rand"),value:"rand"},{text:c.getLang("woocommerce_shortcodes.title"),value:"title"},{text:c.getLang("woocommerce_shortcodes.none"),value:"none"}]},{type:"listbox",name:"order",label:c.getLang("woocommerce_shortcodes.order"),values:[{text:c.getLang("woocommerce_shortcodes.asc"),value:"ASC"},{text:c.getLang("woocommerce_shortcodes.desc"),value:"DESC"}]}],onsubmit:function(a){b.insertContent('[recent_products per_page="'+a.data.per_page+'" columns="'+a.data.columns+'" orderby="'+a.data.orderby+'" order="'+a.data.order+'"]')}})}},{text:c.getLang("woocommerce_shortcodes.featured_products"),onclick:function(){b.windowManager.open({title:c.getLang("woocommerce_shortcodes.featured_products"),body:[{type:"textbox",name:"per_page",label:c.getLang("woocommerce_shortcodes.products_per_page"),value:"12"},{type:"textbox",name:"columns",label:c.getLang("woocommerce_shortcodes.columns"),value:"4"},{type:"listbox",name:"orderby",label:c.getLang("woocommerce_shortcodes.orderby"),values:[{text:c.getLang("woocommerce_shortcodes.date"),value:"date"},{text:c.getLang("woocommerce_shortcodes.rand"),value:"rand"},{text:c.getLang("woocommerce_shortcodes.title"),value:"title"},{text:c.getLang("woocommerce_shortcodes.none"),value:"none"}]},{type:"listbox",name:"order",label:c.getLang("woocommerce_shortcodes.order"),values:[{text:c.getLang("woocommerce_shortcodes.asc"),value:"ASC"},{text:c.getLang("woocommerce_shortcodes.desc"),value:"DESC"}]}],onsubmit:function(a){b.insertContent('[featured_products per_page="'+a.data.per_page+'" columns="'+a.data.columns+'" orderby="'+a.data.orderby+'" order="'+a.data.order+'"]')}})}},{text:c.getLang("woocommerce_shortcodes.sale_products"),onclick:function(){b.windowManager.open({title:c.getLang("woocommerce_shortcodes.sale_products"),body:[{type:"textbox",name:"per_page",label:c.getLang("woocommerce_shortcodes.products_per_page"),value:"12"},{type:"textbox",name:"columns",label:c.getLang("woocommerce_shortcodes.columns"),value:"4"},{type:"listbox",name:"orderby",label:c.getLang("woocommerce_shortcodes.orderby"),values:[{text:c.getLang("woocommerce_shortcodes.date"),value:"date"},{text:c.getLang("woocommerce_shortcodes.rand"),value:"rand"},{text:c.getLang("woocommerce_shortcodes.title"),value:"title"},{text:c.getLang("woocommerce_shortcodes.none"),value:"none"}]},{type:"listbox",name:"order",label:c.getLang("woocommerce_shortcodes.order"),values:[{text:c.getLang("woocommerce_shortcodes.asc"),value:"ASC"},{text:c.getLang("woocommerce_shortcodes.desc"),value:"DESC"}]}],onsubmit:function(a){b.insertContent('[sale_products per_page="'+a.data.per_page+'" columns="'+a.data.columns+'" orderby="'+a.data.orderby+'" order="'+a.data.order+'"]')}})}},{text:c.getLang("woocommerce_shortcodes.best_selling_products"),onclick:function(){b.windowManager.open({title:c.getLang("woocommerce_shortcodes.best_selling_products"),body:[{type:"textbox",name:"per_page",label:c.getLang("woocommerce_shortcodes.products_per_page"),value:"12"},{type:"textbox",name:"columns",label:c.getLang("woocommerce_shortcodes.columns"),value:"4"},{type:"listbox",name:"orderby",label:c.getLang("woocommerce_shortcodes.orderby"),values:[{text:c.getLang("woocommerce_shortcodes.date"),value:"date"},{text:c.getLang("woocommerce_shortcodes.rand"),value:"rand"},{text:c.getLang("woocommerce_shortcodes.title"),value:"title"},{text:c.getLang("woocommerce_shortcodes.none"),value:"none"}]},{type:"listbox",name:"order",label:c.getLang("woocommerce_shortcodes.order"),values:[{text:c.getLang("woocommerce_shortcodes.asc"),value:"ASC"},{text:c.getLang("woocommerce_shortcodes.desc"),value:"DESC"}]}],onsubmit:function(a){b.insertContent('[best_selling_products per_page="'+a.data.per_page+'" columns="'+a.data.columns+'" orderby="'+a.data.orderby+'" order="'+a.data.order+'"]')}})}},{text:c.getLang("woocommerce_shortcodes.top_rated_products"),onclick:function(){b.windowManager.open({title:c.getLang("woocommerce_shortcodes.top_rated_products"),body:[{type:"textbox",name:"per_page",label:c.getLang("woocommerce_shortcodes.products_per_page"),value:"12"},{type:"textbox",name:"columns",label:c.getLang("woocommerce_shortcodes.columns"),value:"4"},{type:"listbox",name:"orderby",label:c.getLang("woocommerce_shortcodes.orderby"),values:[{text:c.getLang("woocommerce_shortcodes.date"),value:"date"},{text:c.getLang("woocommerce_shortcodes.rand"),value:"rand"},{text:c.getLang("woocommerce_shortcodes.title"),value:"title"},{text:c.getLang("woocommerce_shortcodes.none"),value:"none"}]},{type:"listbox",name:"order",label:c.getLang("woocommerce_shortcodes.order"),values:[{text:c.getLang("woocommerce_shortcodes.asc"),value:"ASC"},{text:c.getLang("woocommerce_shortcodes.desc"),value:"DESC"}]}],onsubmit:function(a){b.insertContent('[top_rated_products per_page="'+a.data.per_page+'" columns="'+a.data.columns+'" orderby="'+a.data.orderby+'" order="'+a.data.order+'"]')}})}}]},{text:c.getLang("woocommerce_shortcodes.shop_messages"),onclick:function(){b.insertContent("["+c.getLang("woocommerce_shortcodes.shop_messages_shortcode")+"]")}},{text:c.getLang("woocommerce_shortcodes.order_tracking"),onclick:function(){b.insertContent("["+c.getLang("woocommerce_shortcodes.order_tracking_shortcode")+"]")}}]})})}();
|
includes/class-wc-shortcodes-admin.php
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
| 3 |
+
exit; // Exit if accessed directly
|
| 4 |
+
}
|
| 5 |
+
|
| 6 |
+
/**
|
| 7 |
+
* WooCommerce Shortcodes Admin class.
|
| 8 |
+
*/
|
| 9 |
+
class WC_Shortcodes_Admin {
|
| 10 |
+
|
| 11 |
+
/**
|
| 12 |
+
* Constructor.
|
| 13 |
+
*/
|
| 14 |
+
public function __construct() {
|
| 15 |
+
add_action( 'admin_head', array( $this, 'add_shortcode_button' ) );
|
| 16 |
+
add_filter( 'tiny_mce_version', array( $this, 'refresh_mce' ) );
|
| 17 |
+
add_filter( 'mce_external_languages', array( $this, 'add_tinymce_locales' ), 20, 1 );
|
| 18 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'admin_scripts' ) );
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
/**
|
| 22 |
+
* Add a button for shortcodes to the WP editor.
|
| 23 |
+
*/
|
| 24 |
+
public function add_shortcode_button() {
|
| 25 |
+
if ( ! current_user_can( 'edit_posts' ) && ! current_user_can( 'edit_pages' ) ) {
|
| 26 |
+
return;
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
if ( 'true' == get_user_option( 'rich_editing' ) ) {
|
| 30 |
+
add_filter( 'mce_external_plugins', array( $this, 'add_shortcode_tinymce_plugin' ) );
|
| 31 |
+
add_filter( 'mce_buttons', array( $this, 'register_shortcode_button' ) );
|
| 32 |
+
}
|
| 33 |
+
}
|
| 34 |
+
|
| 35 |
+
/**
|
| 36 |
+
* TinyMCE locales function.
|
| 37 |
+
*
|
| 38 |
+
* @param array $locales TinyMCE locales.
|
| 39 |
+
*
|
| 40 |
+
* @return array
|
| 41 |
+
*/
|
| 42 |
+
public function add_tinymce_locales( $locales ) {
|
| 43 |
+
$locales['woocommerce_shortcodes'] = plugin_dir_path( __FILE__ ) . 'wc-shortcodes-editor-i18n.php';
|
| 44 |
+
|
| 45 |
+
return $locales;
|
| 46 |
+
}
|
| 47 |
+
|
| 48 |
+
/**
|
| 49 |
+
* Register the shortcode button.
|
| 50 |
+
*
|
| 51 |
+
* @param array $buttons
|
| 52 |
+
* @return array
|
| 53 |
+
*/
|
| 54 |
+
public function register_shortcode_button( $buttons ) {
|
| 55 |
+
array_push( $buttons, '|', 'woocommerce_shortcodes' );
|
| 56 |
+
|
| 57 |
+
return $buttons;
|
| 58 |
+
}
|
| 59 |
+
|
| 60 |
+
/**
|
| 61 |
+
* Add the shortcode button to TinyMCE.
|
| 62 |
+
*
|
| 63 |
+
* @param array $plugins TinyMCE plugins.
|
| 64 |
+
*
|
| 65 |
+
* @return array WooCommerce TinyMCE plugin.
|
| 66 |
+
*/
|
| 67 |
+
public function add_shortcode_tinymce_plugin( $plugins ) {
|
| 68 |
+
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
|
| 69 |
+
|
| 70 |
+
$plugins['woocommerce_shortcodes'] = plugins_url( 'assets/js/editor' . $suffix . '.js', plugin_dir_path( __FILE__ ) );
|
| 71 |
+
|
| 72 |
+
return $plugins;
|
| 73 |
+
}
|
| 74 |
+
|
| 75 |
+
/**
|
| 76 |
+
* Force TinyMCE to refresh.
|
| 77 |
+
*
|
| 78 |
+
* @param int $version
|
| 79 |
+
*
|
| 80 |
+
* @return int
|
| 81 |
+
*/
|
| 82 |
+
public function refresh_mce( $version ) {
|
| 83 |
+
$version += 3;
|
| 84 |
+
|
| 85 |
+
return $version;
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
/**
|
| 89 |
+
* Admin scripts.
|
| 90 |
+
*
|
| 91 |
+
* @param string $hook Page slug.
|
| 92 |
+
*
|
| 93 |
+
* @return void
|
| 94 |
+
*/
|
| 95 |
+
public function admin_scripts( $hook ) {
|
| 96 |
+
wp_enqueue_style( 'woocommerce-shortcodes', plugins_url( 'assets/css/editor.css', plugin_dir_path( __FILE__ ) ), array( 'woocommerce_admin_menu_styles' ), WooCommerce_Shortcodes::VERSION, 'all' );
|
| 97 |
+
}
|
| 98 |
+
}
|
| 99 |
+
|
| 100 |
+
new WC_Shortcodes_Admin();
|
includes/wc-shortcodes-editor-i18n.php
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
| 3 |
+
exit; // Exit if accessed directly
|
| 4 |
+
}
|
| 5 |
+
|
| 6 |
+
$strings = 'tinyMCE.addI18n({' . _WP_Editors::$mce_locale . ': {
|
| 7 |
+
woocommerce_shortcodes: {
|
| 8 |
+
shortcode_title: "' . esc_js( __( 'WooCommerce', 'woocommerce-shortcodes' ) ) . '",
|
| 9 |
+
product: "' . esc_js( __( 'Product', 'woocommerce-shortcodes' ) ) . '",
|
| 10 |
+
list: "' . esc_js( __( 'List', 'woocommerce-shortcodes' ) ) . '",
|
| 11 |
+
add_to_cart: "' . esc_js( __( 'Price/cart button', 'woocommerce-shortcodes' ) ) . '",
|
| 12 |
+
add_to_cart_url: "' . esc_js( __( 'Add to cart URL', 'woocommerce-shortcodes' ) ) . '",
|
| 13 |
+
product_by_sku: "' . esc_js( __( 'By SKU/ID', 'woocommerce-shortcodes' ) ) . '",
|
| 14 |
+
products_by_sku: "' . esc_js( __( 'Products by SKU/ID', 'woocommerce-shortcodes' ) ) . '",
|
| 15 |
+
product_categories: "' . esc_js( __( 'Product categories', 'woocommerce-shortcodes' ) ) . '",
|
| 16 |
+
products_by_cat_slug: "' . esc_js( __( 'Products by category slug', 'woocommerce-shortcodes' ) ) . '",
|
| 17 |
+
products_by_attribute: "' . esc_js( __( 'Products by attributes', 'woocommerce-shortcodes' ) ) . '",
|
| 18 |
+
recent_products: "' . esc_js( __( 'Recent products', 'woocommerce-shortcodes' ) ) . '",
|
| 19 |
+
featured_products: "' . esc_js( __( 'Featured products', 'woocommerce-shortcodes' ) ) . '",
|
| 20 |
+
sale_products: "' . esc_js( __( 'Sale products', 'woocommerce-shortcodes' ) ) . '",
|
| 21 |
+
best_selling_products: "' . esc_js( __( 'Best selling products', 'woocommerce-shortcodes' ) ) . '",
|
| 22 |
+
top_rated_products: "' . esc_js( __( 'Top rated products', 'woocommerce-shortcodes' ) ) . '",
|
| 23 |
+
shop_messages: "' . esc_js( __( 'Shop Messages', 'woocommerce-shortcodes' ) ) . '",
|
| 24 |
+
order_tracking: "' . esc_js( __( 'Order tracking', 'woocommerce-shortcodes' ) ) . '",
|
| 25 |
+
shop_messages_shortcode: "' . esc_js( apply_filters( 'shop_messages_shortcode_tag', 'woocommerce_shop_messages' ) ) . '",
|
| 26 |
+
order_tracking_shortcode: "' . esc_js( apply_filters( 'woocommerce_order_tracking_shortcode_tag', 'woocommerce_order_tracking' ) ) . '",
|
| 27 |
+
id: "' . esc_js( __( 'ID', 'woocommerce-shortcodes' ) ) . '",
|
| 28 |
+
ids: "' . esc_js( __( 'IDs', 'woocommerce-shortcodes' ) ) . '",
|
| 29 |
+
sku: "' . esc_js( __( 'SKU', 'woocommerce-shortcodes' ) ) . '",
|
| 30 |
+
skus: "' . esc_js( __( 'SKUs', 'woocommerce-shortcodes' ) ) . '",
|
| 31 |
+
style: "' . esc_js( __( 'Inline Style', 'woocommerce-shortcodes' ) ) . '",
|
| 32 |
+
show_price: "' . esc_js( __( 'Show Price', 'woocommerce-shortcodes' ) ) . '",
|
| 33 |
+
comma_tooltip: "' . esc_js( __( 'Separate the values with comma', 'woocommerce-shortcodes' ) ) . '",
|
| 34 |
+
number: "' . esc_js( __( 'Number', 'woocommerce-shortcodes' ) ) . '",
|
| 35 |
+
orderby: "' . esc_js( __( 'Order By', 'woocommerce-shortcodes' ) ) . '",
|
| 36 |
+
name: "' . esc_js( __( 'Name', 'woocommerce-shortcodes' ) ) . '",
|
| 37 |
+
count: "' . esc_js( __( 'Count', 'woocommerce-shortcodes' ) ) . '",
|
| 38 |
+
slug: "' . esc_js( __( 'Slug', 'woocommerce-shortcodes' ) ) . '",
|
| 39 |
+
none: "' . esc_js( __( 'None', 'woocommerce-shortcodes' ) ) . '",
|
| 40 |
+
order: "' . esc_js( __( 'Order', 'woocommerce-shortcodes' ) ) . '",
|
| 41 |
+
asc: "' . esc_js( __( 'ASC', 'woocommerce-shortcodes' ) ) . '",
|
| 42 |
+
desc: "' . esc_js( __( 'DESC', 'woocommerce-shortcodes' ) ) . '",
|
| 43 |
+
columns: "' . esc_js( __( 'Columns', 'woocommerce-shortcodes' ) ) . '",
|
| 44 |
+
hide_empty: "' . esc_js( __( 'Hide Empty', 'woocommerce-shortcodes' ) ) . '",
|
| 45 |
+
parent_id: "' . esc_js( __( 'Parent ID', 'woocommerce-shortcodes' ) ) . '",
|
| 46 |
+
category_slug: "' . esc_js( __( 'Category Slug', 'woocommerce-shortcodes' ) ) . '",
|
| 47 |
+
default: "' . esc_js( __( 'Default', 'woocommerce-shortcodes' ) ) . '",
|
| 48 |
+
rand: "' . esc_js( __( 'Random', 'woocommerce-shortcodes' ) ) . '",
|
| 49 |
+
date: "' . esc_js( __( 'Date', 'woocommerce-shortcodes' ) ) . '",
|
| 50 |
+
price: "' . esc_js( __( 'Price', 'woocommerce-shortcodes' ) ) . '",
|
| 51 |
+
popularity: "' . esc_js( __( 'Popularity', 'woocommerce-shortcodes' ) ) . '",
|
| 52 |
+
rating: "' . esc_js( __( 'Rating', 'woocommerce-shortcodes' ) ) . '",
|
| 53 |
+
title: "' . esc_js( __( 'Title', 'woocommerce-shortcodes' ) ) . '",
|
| 54 |
+
operator: "' . esc_js( __( 'Operator', 'woocommerce-shortcodes' ) ) . '",
|
| 55 |
+
in: "' . esc_js( __( 'IN', 'woocommerce-shortcodes' ) ) . '",
|
| 56 |
+
not_in: "' . esc_js( __( 'NOT IN', 'woocommerce-shortcodes' ) ) . '",
|
| 57 |
+
and: "' . esc_js( __( 'AND', 'woocommerce-shortcodes' ) ) . '",
|
| 58 |
+
attribute_slug: "' . esc_js( __( 'Attribute slug', 'woocommerce-shortcodes' ) ) . '",
|
| 59 |
+
terms_slug: "' . esc_js( __( 'Terms slug', 'woocommerce-shortcodes' ) ) . '",
|
| 60 |
+
categories_per_page: "' . esc_js( __( 'Categories Per Page', 'woocommerce-shortcodes' ) ) . '",
|
| 61 |
+
products_per_page: "' . esc_js( __( 'Products Per Page', 'woocommerce-shortcodes' ) ) . '",
|
| 62 |
+
need_id_or_sku: "' . esc_js( __( 'You need to use an ID or SKU!', 'woocommerce-shortcodes' ) ) . '",
|
| 63 |
+
need_ids_or_skus: "' . esc_js( __( 'You need to use an IDs or SKUs!', 'woocommerce-shortcodes' ) ) . '",
|
| 64 |
+
need_category_slug: "' . esc_js( __( 'You need enter with a category slug!', 'woocommerce-shortcodes' ) ) . '",
|
| 65 |
+
need_attribute_and_terms_slugs: "' . esc_js( __( 'You need enter with an attribute and terms slugs!', 'woocommerce-shortcodes' ) ) . '"
|
| 66 |
+
}
|
| 67 |
+
}});';
|
languages/woocommerce-shortcodes.pot
ADDED
|
@@ -0,0 +1,262 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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+
msgid ""
|
| 4 |
+
msgstr ""
|
| 5 |
+
"Project-Id-Version: WooCommerce Shortcodes 1.0.0\n"
|
| 6 |
+
"Report-Msgid-Bugs-To: http://wordpress.org/support/plugin/woocommerce-"
|
| 7 |
+
"shortcodes\n"
|
| 8 |
+
"POT-Creation-Date: 2014-07-05 04:51:11+00:00\n"
|
| 9 |
+
"MIME-Version: 1.0\n"
|
| 10 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
| 11 |
+
"Content-Transfer-Encoding: 8bit\n"
|
| 12 |
+
"PO-Revision-Date: 2014-MO-DA HO:MI+ZONE\n"
|
| 13 |
+
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
| 14 |
+
"Language-Team: LANGUAGE <LL@li.org>\n"
|
| 15 |
+
|
| 16 |
+
#: includes/wc-shortcodes-editor-i18n.php:8 woocommerce-shortcodes.php:99
|
| 17 |
+
msgid "WooCommerce"
|
| 18 |
+
msgstr ""
|
| 19 |
+
|
| 20 |
+
#: includes/wc-shortcodes-editor-i18n.php:9
|
| 21 |
+
msgid "Product"
|
| 22 |
+
msgstr ""
|
| 23 |
+
|
| 24 |
+
#: includes/wc-shortcodes-editor-i18n.php:10
|
| 25 |
+
msgid "List"
|
| 26 |
+
msgstr ""
|
| 27 |
+
|
| 28 |
+
#: includes/wc-shortcodes-editor-i18n.php:11
|
| 29 |
+
msgid "Price/cart button"
|
| 30 |
+
msgstr ""
|
| 31 |
+
|
| 32 |
+
#: includes/wc-shortcodes-editor-i18n.php:12
|
| 33 |
+
msgid "Add to cart URL"
|
| 34 |
+
msgstr ""
|
| 35 |
+
|
| 36 |
+
#: includes/wc-shortcodes-editor-i18n.php:13
|
| 37 |
+
msgid "By SKU/ID"
|
| 38 |
+
msgstr ""
|
| 39 |
+
|
| 40 |
+
#: includes/wc-shortcodes-editor-i18n.php:14
|
| 41 |
+
msgid "Products by SKU/ID"
|
| 42 |
+
msgstr ""
|
| 43 |
+
|
| 44 |
+
#: includes/wc-shortcodes-editor-i18n.php:15
|
| 45 |
+
msgid "Product categories"
|
| 46 |
+
msgstr ""
|
| 47 |
+
|
| 48 |
+
#: includes/wc-shortcodes-editor-i18n.php:16
|
| 49 |
+
msgid "Products by category slug"
|
| 50 |
+
msgstr ""
|
| 51 |
+
|
| 52 |
+
#: includes/wc-shortcodes-editor-i18n.php:17
|
| 53 |
+
msgid "Products by attributes"
|
| 54 |
+
msgstr ""
|
| 55 |
+
|
| 56 |
+
#: includes/wc-shortcodes-editor-i18n.php:18
|
| 57 |
+
msgid "Recent products"
|
| 58 |
+
msgstr ""
|
| 59 |
+
|
| 60 |
+
#: includes/wc-shortcodes-editor-i18n.php:19
|
| 61 |
+
msgid "Featured products"
|
| 62 |
+
msgstr ""
|
| 63 |
+
|
| 64 |
+
#: includes/wc-shortcodes-editor-i18n.php:20
|
| 65 |
+
msgid "Sale products"
|
| 66 |
+
msgstr ""
|
| 67 |
+
|
| 68 |
+
#: includes/wc-shortcodes-editor-i18n.php:21
|
| 69 |
+
msgid "Best selling products"
|
| 70 |
+
msgstr ""
|
| 71 |
+
|
| 72 |
+
#: includes/wc-shortcodes-editor-i18n.php:22
|
| 73 |
+
msgid "Top rated products"
|
| 74 |
+
msgstr ""
|
| 75 |
+
|
| 76 |
+
#: includes/wc-shortcodes-editor-i18n.php:23
|
| 77 |
+
msgid "Shop Messages"
|
| 78 |
+
msgstr ""
|
| 79 |
+
|
| 80 |
+
#: includes/wc-shortcodes-editor-i18n.php:24
|
| 81 |
+
msgid "Order tracking"
|
| 82 |
+
msgstr ""
|
| 83 |
+
|
| 84 |
+
#: includes/wc-shortcodes-editor-i18n.php:27
|
| 85 |
+
msgid "ID"
|
| 86 |
+
msgstr ""
|
| 87 |
+
|
| 88 |
+
#: includes/wc-shortcodes-editor-i18n.php:28
|
| 89 |
+
msgid "IDs"
|
| 90 |
+
msgstr ""
|
| 91 |
+
|
| 92 |
+
#: includes/wc-shortcodes-editor-i18n.php:29
|
| 93 |
+
msgid "SKU"
|
| 94 |
+
msgstr ""
|
| 95 |
+
|
| 96 |
+
#: includes/wc-shortcodes-editor-i18n.php:30
|
| 97 |
+
msgid "SKUs"
|
| 98 |
+
msgstr ""
|
| 99 |
+
|
| 100 |
+
#: includes/wc-shortcodes-editor-i18n.php:31
|
| 101 |
+
msgid "Inline Style"
|
| 102 |
+
msgstr ""
|
| 103 |
+
|
| 104 |
+
#: includes/wc-shortcodes-editor-i18n.php:32
|
| 105 |
+
msgid "Show Price"
|
| 106 |
+
msgstr ""
|
| 107 |
+
|
| 108 |
+
#: includes/wc-shortcodes-editor-i18n.php:33
|
| 109 |
+
msgid "Separate the values with comma"
|
| 110 |
+
msgstr ""
|
| 111 |
+
|
| 112 |
+
#: includes/wc-shortcodes-editor-i18n.php:34
|
| 113 |
+
msgid "Number"
|
| 114 |
+
msgstr ""
|
| 115 |
+
|
| 116 |
+
#: includes/wc-shortcodes-editor-i18n.php:35
|
| 117 |
+
msgid "Order By"
|
| 118 |
+
msgstr ""
|
| 119 |
+
|
| 120 |
+
#: includes/wc-shortcodes-editor-i18n.php:36
|
| 121 |
+
msgid "Name"
|
| 122 |
+
msgstr ""
|
| 123 |
+
|
| 124 |
+
#: includes/wc-shortcodes-editor-i18n.php:37
|
| 125 |
+
msgid "Count"
|
| 126 |
+
msgstr ""
|
| 127 |
+
|
| 128 |
+
#: includes/wc-shortcodes-editor-i18n.php:38
|
| 129 |
+
msgid "Slug"
|
| 130 |
+
msgstr ""
|
| 131 |
+
|
| 132 |
+
#: includes/wc-shortcodes-editor-i18n.php:39
|
| 133 |
+
msgid "None"
|
| 134 |
+
msgstr ""
|
| 135 |
+
|
| 136 |
+
#: includes/wc-shortcodes-editor-i18n.php:40
|
| 137 |
+
msgid "Order"
|
| 138 |
+
msgstr ""
|
| 139 |
+
|
| 140 |
+
#: includes/wc-shortcodes-editor-i18n.php:41
|
| 141 |
+
msgid "ASC"
|
| 142 |
+
msgstr ""
|
| 143 |
+
|
| 144 |
+
#: includes/wc-shortcodes-editor-i18n.php:42
|
| 145 |
+
msgid "DESC"
|
| 146 |
+
msgstr ""
|
| 147 |
+
|
| 148 |
+
#: includes/wc-shortcodes-editor-i18n.php:43
|
| 149 |
+
msgid "Columns"
|
| 150 |
+
msgstr ""
|
| 151 |
+
|
| 152 |
+
#: includes/wc-shortcodes-editor-i18n.php:44
|
| 153 |
+
msgid "Hide Empty"
|
| 154 |
+
msgstr ""
|
| 155 |
+
|
| 156 |
+
#: includes/wc-shortcodes-editor-i18n.php:45
|
| 157 |
+
msgid "Parent ID"
|
| 158 |
+
msgstr ""
|
| 159 |
+
|
| 160 |
+
#: includes/wc-shortcodes-editor-i18n.php:46
|
| 161 |
+
msgid "Category Slug"
|
| 162 |
+
msgstr ""
|
| 163 |
+
|
| 164 |
+
#: includes/wc-shortcodes-editor-i18n.php:47
|
| 165 |
+
msgid "Default"
|
| 166 |
+
msgstr ""
|
| 167 |
+
|
| 168 |
+
#: includes/wc-shortcodes-editor-i18n.php:48
|
| 169 |
+
msgid "Random"
|
| 170 |
+
msgstr ""
|
| 171 |
+
|
| 172 |
+
#: includes/wc-shortcodes-editor-i18n.php:49
|
| 173 |
+
msgid "Date"
|
| 174 |
+
msgstr ""
|
| 175 |
+
|
| 176 |
+
#: includes/wc-shortcodes-editor-i18n.php:50
|
| 177 |
+
msgid "Price"
|
| 178 |
+
msgstr ""
|
| 179 |
+
|
| 180 |
+
#: includes/wc-shortcodes-editor-i18n.php:51
|
| 181 |
+
msgid "Popularity"
|
| 182 |
+
msgstr ""
|
| 183 |
+
|
| 184 |
+
#: includes/wc-shortcodes-editor-i18n.php:52
|
| 185 |
+
msgid "Rating"
|
| 186 |
+
msgstr ""
|
| 187 |
+
|
| 188 |
+
#: includes/wc-shortcodes-editor-i18n.php:53
|
| 189 |
+
msgid "Title"
|
| 190 |
+
msgstr ""
|
| 191 |
+
|
| 192 |
+
#: includes/wc-shortcodes-editor-i18n.php:54
|
| 193 |
+
msgid "Operator"
|
| 194 |
+
msgstr ""
|
| 195 |
+
|
| 196 |
+
#: includes/wc-shortcodes-editor-i18n.php:55
|
| 197 |
+
msgid "IN"
|
| 198 |
+
msgstr ""
|
| 199 |
+
|
| 200 |
+
#: includes/wc-shortcodes-editor-i18n.php:56
|
| 201 |
+
msgid "NOT IN"
|
| 202 |
+
msgstr ""
|
| 203 |
+
|
| 204 |
+
#: includes/wc-shortcodes-editor-i18n.php:57
|
| 205 |
+
msgid "AND"
|
| 206 |
+
msgstr ""
|
| 207 |
+
|
| 208 |
+
#: includes/wc-shortcodes-editor-i18n.php:58
|
| 209 |
+
msgid "Attribute slug"
|
| 210 |
+
msgstr ""
|
| 211 |
+
|
| 212 |
+
#: includes/wc-shortcodes-editor-i18n.php:59
|
| 213 |
+
msgid "Terms slug"
|
| 214 |
+
msgstr ""
|
| 215 |
+
|
| 216 |
+
#: includes/wc-shortcodes-editor-i18n.php:60
|
| 217 |
+
msgid "Categories Per Page"
|
| 218 |
+
msgstr ""
|
| 219 |
+
|
| 220 |
+
#: includes/wc-shortcodes-editor-i18n.php:61
|
| 221 |
+
msgid "Products Per Page"
|
| 222 |
+
msgstr ""
|
| 223 |
+
|
| 224 |
+
#: includes/wc-shortcodes-editor-i18n.php:62
|
| 225 |
+
msgid "You need to use an ID or SKU!"
|
| 226 |
+
msgstr ""
|
| 227 |
+
|
| 228 |
+
#: includes/wc-shortcodes-editor-i18n.php:63
|
| 229 |
+
msgid "You need to use an IDs or SKUs!"
|
| 230 |
+
msgstr ""
|
| 231 |
+
|
| 232 |
+
#: includes/wc-shortcodes-editor-i18n.php:64
|
| 233 |
+
msgid "You need enter with a category slug!"
|
| 234 |
+
msgstr ""
|
| 235 |
+
|
| 236 |
+
#: includes/wc-shortcodes-editor-i18n.php:65
|
| 237 |
+
msgid "You need enter with an attribute and terms slugs!"
|
| 238 |
+
msgstr ""
|
| 239 |
+
|
| 240 |
+
#: woocommerce-shortcodes.php:99
|
| 241 |
+
msgid "WooCommerce Shortcodes depends on the last version of %s to work!"
|
| 242 |
+
msgstr ""
|
| 243 |
+
|
| 244 |
+
#. Plugin Name of the plugin/theme
|
| 245 |
+
msgid "WooCommerce Shortcodes"
|
| 246 |
+
msgstr ""
|
| 247 |
+
|
| 248 |
+
#. Plugin URI of the plugin/theme
|
| 249 |
+
msgid "https://www.woothemes.com/"
|
| 250 |
+
msgstr ""
|
| 251 |
+
|
| 252 |
+
#. Description of the plugin/theme
|
| 253 |
+
msgid "WooCommerce Shortcodes."
|
| 254 |
+
msgstr ""
|
| 255 |
+
|
| 256 |
+
#. Author of the plugin/theme
|
| 257 |
+
msgid "WooThemes, Claudio Sanches"
|
| 258 |
+
msgstr ""
|
| 259 |
+
|
| 260 |
+
#. Author URI of the plugin/theme
|
| 261 |
+
msgid "http://woothemes.com"
|
| 262 |
+
msgstr ""
|
readme.txt
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
=== WooCommerce Shortcodes ===
|
| 2 |
+
Contributors: woothemes, claudiosanches
|
| 3 |
+
Tags: woocommerce, shortcodes
|
| 4 |
+
Requires at least: 3.9
|
| 5 |
+
Tested up to: 4.8
|
| 6 |
+
Stable tag: 1.0.0
|
| 7 |
+
License: GPLv2 or later
|
| 8 |
+
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 9 |
+
|
| 10 |
+
Adds a button in TinyMCE editor allowing use of WooCommerce shortcodes. Beautifully.
|
| 11 |
+
|
| 12 |
+
== Description ==
|
| 13 |
+
|
| 14 |
+
This plugin provides a TinyMCE dropdown button for you use all [WooCommerce](http://wordpress.org/plugins/woocommerce/) shortcodes.
|
| 15 |
+
See list of shortcodes in [Shortcodes included with WooCommerce](http://docs.woothemes.com/document/woocommerce-shortcodes/).
|
| 16 |
+
|
| 17 |
+
Starting WooCommerce 2.2, this TinyMCE button will no longer be part of WooCommerce and will only be available by using this plugin.
|
| 18 |
+
|
| 19 |
+
= Requeriments =
|
| 20 |
+
|
| 21 |
+
* WordPress 3.9 or later.
|
| 22 |
+
* WooCommerce 2.2 or later.
|
| 23 |
+
|
| 24 |
+
= Contribute =
|
| 25 |
+
|
| 26 |
+
You can contribute to the source code in our [GitHub](https://github.com/woothemes/woocommerce-shortcodes/) page.
|
| 27 |
+
|
| 28 |
+
== Installation ==
|
| 29 |
+
|
| 30 |
+
* Upload plugin files to your plugins folder, or install using WordPress built-in Add New Plugin installer;
|
| 31 |
+
* Activate the plugin;
|
| 32 |
+
* This ready! You can now use the WooCommerce shortcodes in any WordPress text editor.
|
| 33 |
+
|
| 34 |
+
== Frequently Asked Questions ==
|
| 35 |
+
|
| 36 |
+
= What is the plugin license? =
|
| 37 |
+
|
| 38 |
+
* This plugin is released under a GPL license.
|
| 39 |
+
|
| 40 |
+
= What is needed to use this plugin? =
|
| 41 |
+
|
| 42 |
+
* WordPress 3.9 or later.
|
| 43 |
+
* WooCommerce 2.2 or later.
|
| 44 |
+
|
| 45 |
+
= How this plugin works? =
|
| 46 |
+
|
| 47 |
+
* Works just adding a dropdown button on TinyMCE editor for use the WooCommerce shortcodes.
|
| 48 |
+
* This plugin creates no shortcode, just use the [shortcodes included in WooCommerce](http://docs.woothemes.com/document/woocommerce-shortcodes/).
|
| 49 |
+
|
| 50 |
+
== Screenshots ==
|
| 51 |
+
|
| 52 |
+
1. WooCommerce Shortcodes dropdown button
|
| 53 |
+
2. Example of adding the product button shortcode
|
| 54 |
+
3. Example of adding the feature products shortcodes
|
| 55 |
+
|
| 56 |
+
== Changelog ==
|
| 57 |
+
|
| 58 |
+
= 1.0.0 =
|
| 59 |
+
|
| 60 |
+
* Initial version.
|
| 61 |
+
|
| 62 |
+
== Upgrade Notice ==
|
| 63 |
+
|
| 64 |
+
= 1.0.0 =
|
| 65 |
+
|
| 66 |
+
* Initial version.
|
woocommerce-shortcodes.php
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<?php
|
| 2 |
+
/**
|
| 3 |
+
* Plugin Name: WooCommerce Shortcodes
|
| 4 |
+
* Plugin URI: https://www.woothemes.com/
|
| 5 |
+
* Description: WooCommerce Shortcodes.
|
| 6 |
+
* Version: 1.0.0
|
| 7 |
+
* Author: WooThemes, Claudio Sanches
|
| 8 |
+
* Author URI: http://woothemes.com
|
| 9 |
+
* Text Domain: woocommerce-shortcodes
|
| 10 |
+
* Domain Path: /languages
|
| 11 |
+
*/
|
| 12 |
+
|
| 13 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
| 14 |
+
exit;
|
| 15 |
+
}
|
| 16 |
+
|
| 17 |
+
if ( ! class_exists( 'WooCommerce_Shortcodes' ) ) :
|
| 18 |
+
|
| 19 |
+
/**
|
| 20 |
+
* WooCommerce Shortcodes main class.
|
| 21 |
+
*/
|
| 22 |
+
class WooCommerce_Shortcodes {
|
| 23 |
+
|
| 24 |
+
/**
|
| 25 |
+
* Plugin version.
|
| 26 |
+
*
|
| 27 |
+
* @var string
|
| 28 |
+
*/
|
| 29 |
+
const VERSION = '1.0.0';
|
| 30 |
+
|
| 31 |
+
/**
|
| 32 |
+
* Instance of this class.
|
| 33 |
+
*
|
| 34 |
+
* @var object
|
| 35 |
+
*/
|
| 36 |
+
protected static $instance = null;
|
| 37 |
+
|
| 38 |
+
/**
|
| 39 |
+
* Initialize the plugin.
|
| 40 |
+
*/
|
| 41 |
+
private function __construct() {
|
| 42 |
+
// Load plugin text domain
|
| 43 |
+
add_action( 'init', array( $this, 'load_plugin_textdomain' ) );
|
| 44 |
+
|
| 45 |
+
// Checks with WooCommerce is installed.
|
| 46 |
+
if ( class_exists( 'WooCommerce' ) ) {
|
| 47 |
+
|
| 48 |
+
// Admin classes.
|
| 49 |
+
if ( is_admin() ) {
|
| 50 |
+
$this->admin_includes();
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
} else {
|
| 54 |
+
add_action( 'admin_notices', array( $this, 'woocommerce_missing_notice' ) );
|
| 55 |
+
}
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
/**
|
| 59 |
+
* Return an instance of this class.
|
| 60 |
+
*
|
| 61 |
+
* @return object A single instance of this class.
|
| 62 |
+
*/
|
| 63 |
+
public static function get_instance() {
|
| 64 |
+
// If the single instance hasn't been set, set it now.
|
| 65 |
+
if ( null == self::$instance ) {
|
| 66 |
+
self::$instance = new self;
|
| 67 |
+
}
|
| 68 |
+
|
| 69 |
+
return self::$instance;
|
| 70 |
+
}
|
| 71 |
+
|
| 72 |
+
/**
|
| 73 |
+
* Load the plugin text domain for translation.
|
| 74 |
+
*
|
| 75 |
+
* @return void
|
| 76 |
+
*/
|
| 77 |
+
public function load_plugin_textdomain() {
|
| 78 |
+
$locale = apply_filters( 'plugin_locale', get_locale(), 'woocommerce-shortcodes' );
|
| 79 |
+
|
| 80 |
+
load_textdomain( 'woocommerce-shortcodes', trailingslashit( WP_LANG_DIR ) . 'woocommerce-shortcodes/woocommerce-shortcodes-' . $locale . '.mo' );
|
| 81 |
+
load_plugin_textdomain( 'woocommerce-shortcodes', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
|
| 82 |
+
}
|
| 83 |
+
|
| 84 |
+
/**
|
| 85 |
+
* Admin includes.
|
| 86 |
+
*
|
| 87 |
+
* @return void
|
| 88 |
+
*/
|
| 89 |
+
public function admin_includes() {
|
| 90 |
+
require_once 'includes/class-wc-shortcodes-admin.php';
|
| 91 |
+
}
|
| 92 |
+
|
| 93 |
+
/**
|
| 94 |
+
* WooCommerce fallback notice.
|
| 95 |
+
*
|
| 96 |
+
* @return string
|
| 97 |
+
*/
|
| 98 |
+
public function woocommerce_missing_notice() {
|
| 99 |
+
echo '<div class="error"><p>' . sprintf( __( 'WooCommerce Shortcodes depends on the last version of %s to work!', 'woocommerce-shortcodes' ), '<a href="http://www.woothemes.com/woocommerce/" target="_blank">' . __( 'WooCommerce', 'woocommerce-shortcodes' ) . '</a>' ) . '</p></div>';
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
}
|
| 103 |
+
|
| 104 |
+
add_action( 'plugins_loaded', array( 'WooCommerce_Shortcodes', 'get_instance' ), 0 );
|
| 105 |
+
|
| 106 |
+
endif;
|
