Removed unused TinyMCE button
This commit is contained in:
parent
42f9eab1bc
commit
09a9463b0a
|
@ -1,52 +0,0 @@
|
||||||
(
|
|
||||||
function(){
|
|
||||||
|
|
||||||
tinymce.create(
|
|
||||||
"tinymce.plugins.WooCommerceShortcodes",
|
|
||||||
{
|
|
||||||
init: function(d,e) {},
|
|
||||||
createControl:function(d,e)
|
|
||||||
{
|
|
||||||
|
|
||||||
var ed = tinymce.activeEditor;
|
|
||||||
|
|
||||||
if(d=="woocommerce_shortcodes_button"){
|
|
||||||
|
|
||||||
d=e.createMenuButton( "woocommerce_shortcodes_button",{
|
|
||||||
title: ed.getLang('woocommerce.insert'),
|
|
||||||
icons: false
|
|
||||||
});
|
|
||||||
|
|
||||||
var a=this;d.onRenderMenu.add(function(c,b){
|
|
||||||
|
|
||||||
a.addImmediate(b, ed.getLang('woocommerce.order_tracking'), '[' + ed.getLang('woocommerce.order_tracking_shortcode') + ']' );
|
|
||||||
a.addImmediate(b, ed.getLang('woocommerce.price_button'), '[add_to_cart id="" sku=""]');
|
|
||||||
a.addImmediate(b, ed.getLang('woocommerce.product_by_sku'), '[product id="" sku=""]');
|
|
||||||
a.addImmediate(b, ed.getLang('woocommerce.products_by_sku'), '[products ids="" skus=""]');
|
|
||||||
a.addImmediate(b, ed.getLang('woocommerce.product_categories'), '[product_categories number=""]');
|
|
||||||
a.addImmediate(b, ed.getLang('woocommerce.products_by_cat_slug'), '[product_category category="" per_page="12" columns="4" orderby="date" order="desc"]');
|
|
||||||
|
|
||||||
b.addSeparator();
|
|
||||||
|
|
||||||
a.addImmediate(b, ed.getLang('woocommerce.recent_products'), '[recent_products per_page="12" columns="4" orderby="date" order="desc"]');
|
|
||||||
a.addImmediate(b, ed.getLang('woocommerce.featured_products'), '[featured_products per_page="12" columns="4" orderby="date" order="desc"]');
|
|
||||||
|
|
||||||
b.addSeparator();
|
|
||||||
|
|
||||||
a.addImmediate(b, ed.getLang('woocommerce.shop_messages'), '[' + ed.getLang('woocommerce.shop_messages_shortcode') + ']');
|
|
||||||
});
|
|
||||||
return d
|
|
||||||
|
|
||||||
} // End IF Statement
|
|
||||||
|
|
||||||
return null
|
|
||||||
},
|
|
||||||
|
|
||||||
addImmediate:function(d,e,a){d.add({title:e,onclick:function(){tinyMCE.activeEditor.execCommand( "mceInsertContent",false,a)}})}
|
|
||||||
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
tinymce.PluginManager.add( "WooCommerceShortcodes", tinymce.plugins.WooCommerceShortcodes);
|
|
||||||
}
|
|
||||||
)();
|
|
|
@ -1 +0,0 @@
|
||||||
!function(){tinymce.create("tinymce.plugins.WooCommerceShortcodes",{init:function(){},createControl:function(a,b){var c=tinymce.activeEditor;if("woocommerce_shortcodes_button"==a){a=b.createMenuButton("woocommerce_shortcodes_button",{title:c.getLang("woocommerce.insert"),icons:!1});var d=this;return a.onRenderMenu.add(function(a,b){d.addImmediate(b,c.getLang("woocommerce.order_tracking"),"["+c.getLang("woocommerce.order_tracking_shortcode")+"]"),d.addImmediate(b,c.getLang("woocommerce.price_button"),'[add_to_cart id="" sku=""]'),d.addImmediate(b,c.getLang("woocommerce.product_by_sku"),'[product id="" sku=""]'),d.addImmediate(b,c.getLang("woocommerce.products_by_sku"),'[products ids="" skus=""]'),d.addImmediate(b,c.getLang("woocommerce.product_categories"),'[product_categories number=""]'),d.addImmediate(b,c.getLang("woocommerce.products_by_cat_slug"),'[product_category category="" per_page="12" columns="4" orderby="date" order="desc"]'),b.addSeparator(),d.addImmediate(b,c.getLang("woocommerce.recent_products"),'[recent_products per_page="12" columns="4" orderby="date" order="desc"]'),d.addImmediate(b,c.getLang("woocommerce.featured_products"),'[featured_products per_page="12" columns="4" orderby="date" order="desc"]'),b.addSeparator(),d.addImmediate(b,c.getLang("woocommerce.shop_messages"),"["+c.getLang("woocommerce.shop_messages_shortcode")+"]")}),a}return null},addImmediate:function(a,b,c){a.add({title:b,onclick:function(){tinyMCE.activeEditor.execCommand("mceInsertContent",!1,c)}})}}),tinymce.PluginManager.add("WooCommerceShortcodes",tinymce.plugins.WooCommerceShortcodes)}();
|
|
|
@ -1,19 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
$strings = 'tinyMCE.addI18n({' . _WP_Editors::$mce_locale . ':{
|
|
||||||
woocommerce:{
|
|
||||||
insert: "' . esc_js( __( 'Insert Shortcode', 'woocommerce' ) ) . '",
|
|
||||||
price_button: "' . esc_js( __( 'Product price/cart button', 'woocommerce' ) ) . '",
|
|
||||||
product_by_sku: "' . esc_js( __( 'Product by SKU/ID', 'woocommerce' ) ) . '",
|
|
||||||
products_by_sku: "' . esc_js( __( 'Products by SKU/ID', 'woocommerce' ) ) . '",
|
|
||||||
product_categories: "' . esc_js( __( 'Product categories', 'woocommerce' ) ) . '",
|
|
||||||
products_by_cat_slug: "' . esc_js( __( 'Products by category slug', 'woocommerce' ) ) . '",
|
|
||||||
recent_products: "' . esc_js( __( 'Recent products', 'woocommerce' ) ) . '",
|
|
||||||
featured_products: "' . esc_js( __( 'Featured products', 'woocommerce' ) ) . '",
|
|
||||||
shop_messages: "' . esc_js( __( 'Shop Messages', 'woocommerce' ) ) . '",
|
|
||||||
order_tracking: "' . esc_js( __( 'Order tracking', 'woocommerce' ) ) . '",
|
|
||||||
my_account: "' . esc_js( __( 'My Account', 'woocommerce' ) ) . '",
|
|
||||||
shop_messages_shortcode: "' . esc_js( apply_filters( "shop_messages_shortcode_tag", 'woocommerce_shop_messages' ) ) . '",
|
|
||||||
order_tracking_shortcode: "' . esc_js( apply_filters( "woocommerce_order_tracking_shortcode_tag", 'woocommerce_order_tracking' ) ) . '"
|
|
||||||
}
|
|
||||||
}})';
|
|
|
@ -1,88 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* Admin Editor
|
|
||||||
*
|
|
||||||
* Methods which tweak the WP Editor.
|
|
||||||
*
|
|
||||||
* @author WooThemes
|
|
||||||
* @category Admin
|
|
||||||
* @package WooCommerce/Admin
|
|
||||||
* @version 2.0.0
|
|
||||||
*/
|
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
|
||||||
|
|
||||||
/**
|
|
||||||
* WC_Admin_Editor class.
|
|
||||||
*
|
|
||||||
* @since 2.0
|
|
||||||
*/
|
|
||||||
class WC_Admin_Editor {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor
|
|
||||||
*/
|
|
||||||
public function __construct() {
|
|
||||||
add_action( 'admin_init', array( $this, 'add_shortcode_button' ) );
|
|
||||||
add_filter( 'tiny_mce_version', array( $this, 'refresh_mce' ) );
|
|
||||||
add_filter( 'mce_external_languages', array( $this, 'add_tinymce_lang' ), 10, 1 );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add a button for shortcodes to the WP editor.
|
|
||||||
*/
|
|
||||||
public function add_shortcode_button() {
|
|
||||||
if ( ! current_user_can('edit_posts') && ! current_user_can('edit_pages') ) return;
|
|
||||||
if ( get_user_option('rich_editing') == 'true') :
|
|
||||||
add_filter( 'mce_external_plugins', array( $this, 'add_shortcode_tinymce_plugin' ) );
|
|
||||||
add_filter( 'mce_buttons', array( $this, 'register_shortcode_button' ) );
|
|
||||||
endif;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* woocommerce_add_tinymce_lang function.
|
|
||||||
*
|
|
||||||
* @param array $arr
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function add_tinymce_lang( $arr ) {
|
|
||||||
$arr['WooCommerceShortcodes'] = WC()->plugin_path() . '/assets/js/admin/editor_plugin_lang.php';
|
|
||||||
return $arr;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Register the shortcode button.
|
|
||||||
*
|
|
||||||
* @param array $buttons
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function register_shortcode_button( $buttons ) {
|
|
||||||
array_push( $buttons, "|", "woocommerce_shortcodes_button" );
|
|
||||||
return $buttons;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add the shortcode button to TinyMCE
|
|
||||||
*
|
|
||||||
* @param array $plugin_array
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function add_shortcode_tinymce_plugin( $plugin_array ) {
|
|
||||||
$plugin_array['WooCommerceShortcodes'] = WC()->plugin_url() . '/assets/js/admin/editor_plugin.js';
|
|
||||||
return $plugin_array;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Force TinyMCE to refresh.
|
|
||||||
*
|
|
||||||
* @param int $ver
|
|
||||||
* @return int
|
|
||||||
*/
|
|
||||||
public function refresh_mce( $ver ) {
|
|
||||||
$ver += 3;
|
|
||||||
return $ver;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
new WC_Admin_Editor();
|
|
|
@ -45,7 +45,6 @@ class WC_Admin {
|
||||||
include( 'class-wc-admin-notices.php' );
|
include( 'class-wc-admin-notices.php' );
|
||||||
include( 'class-wc-admin-assets.php' );
|
include( 'class-wc-admin-assets.php' );
|
||||||
include( 'class-wc-admin-permalink-settings.php' );
|
include( 'class-wc-admin-permalink-settings.php' );
|
||||||
include( 'class-wc-admin-editor.php' );
|
|
||||||
|
|
||||||
// Help
|
// Help
|
||||||
if ( apply_filters( 'woocommerce_enable_admin_help_tab', true ) )
|
if ( apply_filters( 'woocommerce_enable_admin_help_tab', true ) )
|
||||||
|
|
Loading…
Reference in New Issue