Custom Product Tabs for WooCommerce - Version 1.7.0

Version Description

  • March 10th, 2020 =
  • Toggle the content filter on or off setting added. Use this to help with compatibility.
  • Support WooCommerce 4.0.
  • Support WordPress 5.4.
Download this release

Release Info

Developer fmixell
Plugin Icon 128x128 Custom Product Tabs for WooCommerce
Version 1.7.0
Comparing to
See all releases

Code changes from version 1.6.13 to 1.7.0

admin/class.premium.php CHANGED
@@ -22,8 +22,7 @@
22
  *
23
  * @param string | $page | The slug of the page we're currently on
24
  */
25
- public function enqueue_scripts( $page ) {
26
-
27
  if ( $page === 'custom-product-tabs_page_' . YIKES_Custom_Product_Tabs_Premium_Page ) {
28
 
29
  wp_enqueue_style ( 'lightslider-styles', YIKES_Custom_Product_Tabs_URI . 'slider/css/lightslider.min.css' );
@@ -70,7 +69,6 @@
70
  if ( defined( 'YIKES_Custom_Product_Tabs_Pro_Enabled' ) ) {
71
  return;
72
  }
73
-
74
  ?>
75
  <div class="yikes-woo-all-about-us">
76
  <div class="postbox yikes-woo-review-us">
@@ -112,6 +110,8 @@
112
  </a>
113
  </div><!-- .yikes-woo-buy-us-body -->
114
  </div>
 
 
115
  </div>
116
  <?php
117
  }
22
  *
23
  * @param string | $page | The slug of the page we're currently on
24
  */
25
+ public function enqueue_scripts( $page ) {
 
26
  if ( $page === 'custom-product-tabs_page_' . YIKES_Custom_Product_Tabs_Premium_Page ) {
27
 
28
  wp_enqueue_style ( 'lightslider-styles', YIKES_Custom_Product_Tabs_URI . 'slider/css/lightslider.min.css' );
69
  if ( defined( 'YIKES_Custom_Product_Tabs_Pro_Enabled' ) ) {
70
  return;
71
  }
 
72
  ?>
73
  <div class="yikes-woo-all-about-us">
74
  <div class="postbox yikes-woo-review-us">
110
  </a>
111
  </div><!-- .yikes-woo-buy-us-body -->
112
  </div>
113
+
114
+ <?php do_action( 'yikes-woo-settings-area' ); ?>
115
  </div>
116
  <?php
117
  }
admin/class.settings.php ADDED
@@ -0,0 +1,161 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * YIKES Inc. Custom WooCommerce Product Tabs
4
+ *
5
+ * @author Freddie Mixell
6
+ * @since 1.7.0
7
+ */
8
+
9
+ class YIKES_Custom_Product_Tabs_Settings {
10
+
11
+ /**
12
+ * Constructor
13
+ */
14
+ public function __construct() {
15
+
16
+ // Enqueue scripts & styles.
17
+ add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ), 10, 1 );
18
+
19
+ // Render settings area.
20
+ add_action( 'yikes-woo-settings-area', array( $this, 'render_settings_area' ), 10 );
21
+
22
+ // REST API.
23
+ add_action( 'rest_api_init', array( $this, 'register_rest_route' ) );
24
+
25
+ // Admin Notice.
26
+ add_action( 'yikes-woo-display-too-many-products-warning', array( $this, 'generate_messages' ) );
27
+
28
+ if ( $this->maybe_use_the_content_filter() ) {
29
+ add_filter( 'yikes_woo_use_the_content_filter', '__return_false' );
30
+ add_filter( 'yikes_woo_filter_main_tab_content', array( $this, 'yikes_the_content_filter' ), 10, 1 );
31
+ }
32
+ }
33
+
34
+ /**
35
+ * Replacement function for the_content
36
+ *
37
+ * @param string $content post content.
38
+ */
39
+ public function yikes_the_content_filter( $content ) {
40
+ $content = function_exists( 'capital_P_dangit' ) ? capital_P_dangit( $content ) : $content;
41
+ $content = function_exists( 'wptexturize' ) ? wptexturize( $content ) : $content;
42
+ $content = function_exists( 'convert_smilies' ) ? convert_smilies( $content ) : $content;
43
+ $content = function_exists( 'wpautop' ) ? wpautop( $content ) : $content;
44
+ $content = function_exists( 'shortcode_unautop' ) ? shortcode_unautop( $content ) : $content;
45
+ $content = function_exists( 'prepend_attachment' ) ? prepend_attachment( $content ) : $content;
46
+ $content = function_exists( 'wp_make_content_images_responsive' ) ? wp_make_content_images_responsive( $content ) : $content;
47
+ $content = function_exists( 'do_shortcode' ) ? do_shortcode( $content ) : $content;
48
+
49
+ if ( class_exists( 'WP_Embed' ) ) {
50
+ // Deal with URLs
51
+ $embed = new WP_Embed;
52
+ $content = method_exists( $embed, 'autoembed' ) ? $embed->autoembed( $content ) : $content;
53
+ }
54
+
55
+ return $content;
56
+ }
57
+
58
+ /**
59
+ * Enqueue assets
60
+ */
61
+ public function enqueue_scripts() {
62
+ if ( defined( 'YIKES_Custom_Product_Tabs_Pro_Enabled' ) ) {
63
+ return;
64
+ }
65
+
66
+ $extention = ! defined( 'SCRIPT_DEBUG' ) ? '.min' : '';
67
+
68
+ wp_register_script( 'yikes-cpt-settings-modal', YIKES_Custom_Product_Tabs_URI . "js/settings{$extention}.js", array( 'jquery' ), '1.0.0', true );
69
+
70
+ wp_localize_script(
71
+ 'yikes-cpt-settings-modal',
72
+ 'yikesCptSettings',
73
+ array(
74
+ 'root' => esc_url_raw( rest_url() ),
75
+ 'nonce' => wp_create_nonce( 'wp_rest' ),
76
+ )
77
+ );
78
+
79
+ wp_enqueue_script( 'yikes-cpt-settings-modal' );
80
+ }
81
+
82
+ /**
83
+ * Register Rest API Route.
84
+ */
85
+ public function register_rest_route() {
86
+ register_rest_route(
87
+ 'yikes/cpt/v1',
88
+ '/settings',
89
+ array(
90
+ 'methods' => 'POST',
91
+ 'callback' => array( $this, 'rest_response' ),
92
+ )
93
+ );
94
+ }
95
+
96
+ /**
97
+ * REST API Response
98
+ *
99
+ * @param WP_REST_Request $request current WP Rest Request.
100
+ */
101
+ public function rest_response( WP_REST_Request $request ) {
102
+ $response = new WP_REST_Response();
103
+
104
+ $toggle_the_content = isset( $request['toggle_the_content'] ) ? sanitize_text_field( $request['toggle_the_content'] ) : 'false';
105
+
106
+ update_option( 'yikes_cpt_use_the_content', $toggle_the_content );
107
+
108
+ $response->set_data( array(
109
+ 'status' => 'success',
110
+ 'message' => 'Settings updated.'
111
+ ) );
112
+
113
+ return $response;
114
+ }
115
+
116
+ /**
117
+ * Generate Admin Notices
118
+ */
119
+ public function generate_messages() {
120
+ ?>
121
+ <div style="display: none;" id="settings-updated" class="updated notice is-dismissible"><p>Settings updated.</p><button type="button" class="notice-dismiss"><span class="screen-reader-text">Dismiss this notice.</span></button></div>
122
+ <?php
123
+ }
124
+
125
+ /**
126
+ * Render settings area
127
+ */
128
+ public function render_settings_area() {
129
+ if ( defined( 'YIKES_Custom_Product_Tabs_Pro_Enabled' ) ) {
130
+ return;
131
+ }
132
+
133
+ $toggle_the_content = get_option( 'yikes_cpt_use_the_content' );
134
+ ?>
135
+ <div class="postbox yikes-woo-buy-us yikes-woo-all-about-us-box" id="yikes-woo-buy-us">
136
+ <h3 class="yikes-woo-settings-title">Settings</h3>
137
+ <div class="yikes-woo-buy-us-body">
138
+ <h4><?php _e( 'Use a custom filter for the_content', 'yikes-inc-easy-custom-woocommerce-product-tabs' ); ?> </h4>
139
+ <p><?php _e( 'If you\'re using a page builder and you\'re having issues toggle this setting on. This will allow other plugins to use the WordPress \'the_content\' filter will we use our own custom version.', 'yikes-inc-easy-custom-woocommerce-product-tabs' ); ?></p>
140
+ <p>
141
+ <label>Toggle the_content filter.
142
+ <input id="yikes-woo-toggle-content-input" type="checkbox" name="yikes-the-content-toggle" id="yikes-the-content-toggle" <?php checked( 'true' === $toggle_the_content ); ?> />
143
+ </label>
144
+ <p>
145
+ <a id="yikes-woo-toggle-content" class="button button-primary" href="https://yikesplugins.com/plugin/custom-product-tabs-pro/" target="_blank">
146
+ <?php _e( 'Save Settings', 'yikes-inc-easy-custom-woocommerce-product-tabs' ); ?>
147
+ </a>
148
+ </div><!-- .yikes-woo-buy-us-body -->
149
+ </div>
150
+ <?php
151
+ }
152
+
153
+ /**
154
+ * Check if we should use the filter
155
+ */
156
+ public function maybe_use_the_content_filter() {
157
+ return 'true' === get_option( 'yikes_cpt_use_the_content' );
158
+ }
159
+ }
160
+
161
+ new YIKES_Custom_Product_Tabs_Settings();
assets/banner-1544x500.png ADDED
Binary file
assets/banner-772x250.png ADDED
Binary file
assets/icon-128x128.png ADDED
Binary file
assets/icon-256x256.png ADDED
Binary file
assets/screenshot-1.png ADDED
Binary file
assets/screenshot-2.png ADDED
Binary file
assets/screenshot-3.png ADDED
Binary file
assets/screenshot-4.png ADDED
Binary file
js/settings.js ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery( document ).ready( function( $ ) {
2
+
3
+ let toggleInput = $( '#yikes-woo-toggle-content-input' );
4
+ let savBtn = $( '#yikes-woo-toggle-content' );
5
+
6
+ savBtn.click( 'click', yikesToggleTheContent );
7
+
8
+ function yikesToggleTheContent( event ) {
9
+
10
+ event.preventDefault();
11
+
12
+ let isChecked = ( toggleInput.prop('checked') ) ? 'true' : 'false';
13
+
14
+ $.ajax( {
15
+ url: yikesCptSettings.root + 'yikes/cpt/v1/settings',
16
+ method: 'POST',
17
+ beforeSend: function ( xhr ) {
18
+ xhr.setRequestHeader( 'X-WP-Nonce', yikesCptSettings.nonce );
19
+ },
20
+ data:{
21
+ 'toggle_the_content' : isChecked,
22
+ }
23
+ } ).success( function ( response ) {
24
+ $("html, body").animate({ scrollTop: 0 }, "slow");
25
+ $( '#settings-updated' ).css( 'display', 'block' )
26
+
27
+ setTimeout( function() {
28
+ $( '#settings-updated' ).fadeOut();
29
+ }, 2000 );
30
+
31
+ } )
32
+ .fail(e => console.error(e));
33
+
34
+ }
35
+
36
+ } );
js/settings.min.js ADDED
@@ -0,0 +1 @@
 
1
+ jQuery(document).ready(function(e){let t=e("#yikes-woo-toggle-content-input");e("#yikes-woo-toggle-content").click("click",function(o){o.preventDefault();let n=t.prop("checked")?"true":"false";e.ajax({url:yikesCptSettings.root+"yikes/cpt/v1/settings",method:"POST",beforeSend:function(e){e.setRequestHeader("X-WP-Nonce",yikesCptSettings.nonce)},data:{toggle_the_content:n}}).success(function(t){e("html, body").animate({scrollTop:0},"slow"),e("#settings-updated").css("display","block"),setTimeout(function(){e("#settings-updated").fadeOut()},2e3)}).fail(e=>console.error(e))})});
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: yikesinc, eherman24, liljimmi, yikesitskevin, metalandcoffee, mial
3
  Donate link: http://yikesinc.com
4
  Tags: woocommerce, product tabs, repeatable, duplicate, customize, custom, tabs, product, woo, commerce
5
  Requires at least: 3.8
6
- Tested up to: 5.3
7
- Stable tag: 1.6.13
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -75,6 +75,11 @@ Yes! Since v1.4 we've added the necessary code to ensure the custom tab data is
75
 
76
  == Changelog ==
77
 
 
 
 
 
 
78
  = 1.6.13 - January 22nd, 2020 =
79
  * Support WooCommerce 3.9.
80
 
3
  Donate link: http://yikesinc.com
4
  Tags: woocommerce, product tabs, repeatable, duplicate, customize, custom, tabs, product, woo, commerce
5
  Requires at least: 3.8
6
+ Tested up to: 5.4
7
+ Stable tag: 1.7.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
75
 
76
  == Changelog ==
77
 
78
+ = 1.7.0 - March 10th, 2020 =
79
+ * Toggle the content filter on or off setting added. Use this to help with compatibility.
80
+ * Support WooCommerce 4.0.
81
+ * Support WordPress 5.4.
82
+
83
  = 1.6.13 - January 22nd, 2020 =
84
  * Support WooCommerce 3.9.
85
 
yikes-inc-easy-custom-woocommerce-product-tabs.php CHANGED
@@ -5,12 +5,12 @@
5
  * Description: Extend WooCommerce to add and manage custom product tabs. Create as many product tabs as needed per product.
6
  * Author: YIKES, Inc.
7
  * Author URI: http://www.yikesinc.com
8
- * Version: 1.6.13
9
  * Text Domain: yikes-inc-easy-custom-woocommerce-product-tabs
10
  * Domain Path: languages/
11
  *
12
  * WC requires at least: 3.0.0
13
- * WC tested up to: 3.9
14
  *
15
  * Copyright: (c) 2014-2015 YIKES Inc.
16
  *
@@ -81,6 +81,7 @@ class YIKES_Custom_Product_Tabs {
81
  require_once YIKES_Custom_Product_Tabs_Path . 'admin/class.yikes-woo-tabs.php';
82
  require_once YIKES_Custom_Product_Tabs_Path . 'admin/class.support.php';
83
  require_once YIKES_Custom_Product_Tabs_Path . 'public/class.yikes-woo-tabs-display.php';
 
84
  require_once YIKES_Custom_Product_Tabs_Path . 'admin/class.premium.php';
85
  require_once YIKES_Custom_Product_Tabs_Path . 'admin/class.export.php';
86
  require_once YIKES_Custom_Product_Tabs_Path . 'admin/class.import.php';
@@ -104,7 +105,7 @@ class YIKES_Custom_Product_Tabs {
104
  * Define the plugin's version.
105
  */
106
  if ( ! defined( 'YIKES_Custom_Product_Tabs_Version' ) ) {
107
- define( 'YIKES_Custom_Product_Tabs_Version', '1.6.13' );
108
  }
109
 
110
  /**
5
  * Description: Extend WooCommerce to add and manage custom product tabs. Create as many product tabs as needed per product.
6
  * Author: YIKES, Inc.
7
  * Author URI: http://www.yikesinc.com
8
+ * Version: 1.7.0
9
  * Text Domain: yikes-inc-easy-custom-woocommerce-product-tabs
10
  * Domain Path: languages/
11
  *
12
  * WC requires at least: 3.0.0
13
+ * WC tested up to: 4.0
14
  *
15
  * Copyright: (c) 2014-2015 YIKES Inc.
16
  *
81
  require_once YIKES_Custom_Product_Tabs_Path . 'admin/class.yikes-woo-tabs.php';
82
  require_once YIKES_Custom_Product_Tabs_Path . 'admin/class.support.php';
83
  require_once YIKES_Custom_Product_Tabs_Path . 'public/class.yikes-woo-tabs-display.php';
84
+ require_once YIKES_Custom_Product_Tabs_Path . 'admin/class.settings.php';
85
  require_once YIKES_Custom_Product_Tabs_Path . 'admin/class.premium.php';
86
  require_once YIKES_Custom_Product_Tabs_Path . 'admin/class.export.php';
87
  require_once YIKES_Custom_Product_Tabs_Path . 'admin/class.import.php';
105
  * Define the plugin's version.
106
  */
107
  if ( ! defined( 'YIKES_Custom_Product_Tabs_Version' ) ) {
108
+ define( 'YIKES_Custom_Product_Tabs_Version', '1.7.0' );
109
  }
110
 
111
  /**