WP Tab Widget - Version 1.2.10

Version Description

[June 30, 2018] = * Changed admin notices * Fixed deprecated notice

Download this release

Release Info

Developer MyThemeShop
Plugin Icon 128x128 WP Tab Widget
Version 1.2.10
Comparing to
See all releases

Code changes from version 1.2.9 to 1.2.10

Files changed (3) hide show
  1. js/wpt-admin.js +14 -0
  2. readme.txt +5 -1
  3. wp-tab-widget.php +19 -19
js/wpt-admin.js CHANGED
@@ -42,4 +42,18 @@ jQuery(document).on('click', function(e) {
42
  var $related = $form.find('.wpt_advanced_options');
43
  $related.slideToggle();
44
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  });
42
  var $related = $form.find('.wpt_advanced_options');
43
  $related.slideToggle();
44
  }
45
+ });
46
+
47
+ jQuery(document).on('click', '.tabwidget-notice-dismiss', function(e){
48
+ e.preventDefault();
49
+ jQuery(this).parent().remove();
50
+ jQuery.ajax({
51
+ type: "POST",
52
+ url: ajaxurl,
53
+ data: {
54
+ action: 'mts_dismiss_tabwidget_notice',
55
+ dismiss: jQuery(this).data('ignore')
56
+ }
57
+ });
58
+ return false;
59
  });
readme.txt CHANGED
@@ -4,7 +4,7 @@ Creator's website link: http://mythemeshop.com/
4
  Tags: tabs, tab widget, recent posts tab, tabs widget, ajax tabs, ajax widget.
5
  Requires at least: 4.0
6
  Tested up to: 4.9.5
7
- Stable tag: 1.2.9
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -101,6 +101,10 @@ add_filter( 'wpt_sampling_rate', 'wpt_my_sampling_rate' );
101
 
102
  == Changelog ==
103
 
 
 
 
 
104
  = 1.2.9 [June 29, 2018] =
105
  * Updated admin notices
106
 
4
  Tags: tabs, tab widget, recent posts tab, tabs widget, ajax tabs, ajax widget.
5
  Requires at least: 4.0
6
  Tested up to: 4.9.5
7
+ Stable tag: 1.2.10
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
101
 
102
  == Changelog ==
103
 
104
+ = 1.2.10 [June 30, 2018] =
105
+ * Changed admin notices
106
+ * Fixed deprecated notice
107
+
108
  = 1.2.9 [June 29, 2018] =
109
  * Updated admin notices
110
 
wp-tab-widget.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: WP Tab Widget
4
  Plugin URI: http://mythemeshop.com/plugins/wp-tab-widget/
5
  Description: WP Tab Widget is the AJAXified plugin which loads content by demand, and thus it makes the plugin incredibly lightweight.
6
  Author: MyThemeShop
7
- Version: 1.2.9
8
  Author URI: http://mythemeshop.com/
9
  */
10
  if ( !class_exists('wpt_widget') ) {
@@ -34,8 +34,6 @@ if ( !class_exists('wpt_widget') ) {
34
  add_image_size( 'wp_review_large', 320, 240, true ); // large thumb
35
  }
36
  function wpt_admin_scripts($hook) {
37
- if ($hook != 'widgets.php')
38
- return;
39
  wp_register_script('wpt_widget_admin', plugins_url('js/wpt-admin.js', __FILE__), array('jquery'));
40
  wp_enqueue_script('wpt_widget_admin');
41
  }
@@ -587,7 +585,10 @@ if ( !class_exists('wpt_widget') ) {
587
  }
588
  }
589
  }
590
- add_action( 'widgets_init', create_function( '', 'register_widget( "wpt_widget" );' ) );
 
 
 
591
 
592
  // post view count
593
  // AJAX is used to support caching plugins
@@ -683,10 +684,10 @@ function wp_tab_widget_admin_notice() {
683
  global $current_user ;
684
  $user_id = $current_user->ID;
685
  /* Check that the user hasn't already clicked to ignore the message */
686
- if ( ! get_user_meta($user_id, 'wp_tab_widget_ignore_notice') ) {
687
  echo '<div class="updated notice-info wp-tab-widget-pro-notice" style="position:relative;"><p>';
688
- printf(__('Like WP Tab Widget? You will <strong>LOVE WP Tab Widget Pro</strong>!','wp-tab-widget').'<a href="https://mythemeshop.com/plugins/wp-tab-widget-pro/?utm_source=WP+Tab+Widget+Free&utm_medium=Notification+Link&utm_content=WP+Tab+Widget+Pro+LP&utm_campaign=WordPressOrg&wpmts" target="_blank">&nbsp;'.__('Click here for all the exciting features.','wp-tab-widget').'</a><a href="%1$s" class="dashicons dashicons-dismiss dashicons-dismiss-icon" style="position: absolute; top: 8px; right: 8px; color: #222; opacity: 0.4; text-decoration: none !important;"></a>', '?wp_tab_widget_notice_ignore=0');
689
- echo "</p></div>";
690
  }
691
 
692
  /* Other notice appears right after activating */
@@ -698,21 +699,20 @@ function wp_tab_widget_admin_notice() {
698
  echo '<p>';
699
  _e('Thank you for trying WP Tab Widget. We hope you will like it.', 'wp-tab-widget');
700
  echo '</p>';
701
- echo '<a class="notice-dismiss" href="?wp_tab_widget_notice_ignore=0"></a>';
702
  echo "</div>";
703
  }
704
  }
705
 
706
- add_action('admin_init', 'wp_tab_widget_notice_ignore');
707
- function wp_tab_widget_notice_ignore() {
708
- global $current_user;
709
  $user_id = $current_user->ID;
710
  /* If user clicks to ignore the notice, add that to their user meta */
711
- if ( isset($_GET['wp_tab_widget_notice_ignore']) ) {
712
- if ( '0' == $_GET['wp_tab_widget_notice_ignore'] ) {
713
- add_user_meta($user_id, 'wp_tab_widget_ignore_notice', '1', true);
714
- } elseif ( '1' == $_GET['wp_tab_widget_notice_ignore'] ) {
715
- add_user_meta($user_id, 'wp_tab_widget_ignore_notice_2', '1', true);
716
- }
717
- }
718
- }
4
  Plugin URI: http://mythemeshop.com/plugins/wp-tab-widget/
5
  Description: WP Tab Widget is the AJAXified plugin which loads content by demand, and thus it makes the plugin incredibly lightweight.
6
  Author: MyThemeShop
7
+ Version: 1.2.10
8
  Author URI: http://mythemeshop.com/
9
  */
10
  if ( !class_exists('wpt_widget') ) {
34
  add_image_size( 'wp_review_large', 320, 240, true ); // large thumb
35
  }
36
  function wpt_admin_scripts($hook) {
 
 
37
  wp_register_script('wpt_widget_admin', plugins_url('js/wpt-admin.js', __FILE__), array('jquery'));
38
  wp_enqueue_script('wpt_widget_admin');
39
  }
585
  }
586
  }
587
  }
588
+
589
+ add_action('widgets_init', function(){
590
+ return register_widget('wpt_widget');
591
+ });
592
 
593
  // post view count
594
  // AJAX is used to support caching plugins
684
  global $current_user ;
685
  $user_id = $current_user->ID;
686
  /* Check that the user hasn't already clicked to ignore the message */
687
+ if ( ! get_user_meta($user_id, 'wp_tab_widget_ignore_notice') && time() >= (get_option( 'wp_tab_widget_activated', 0 ) + (2 * 24 * 60 * 60)) ) {
688
  echo '<div class="updated notice-info wp-tab-widget-pro-notice" style="position:relative;"><p>';
689
+ echo __('Like WP Tab Widget? You will <strong>LOVE WP Tab Widget Pro</strong>!','wp-tab-widget').'<a href="https://mythemeshop.com/plugins/wp-tab-widget-pro/?utm_source=WP+Tab+Widget+Free&utm_medium=Notification+Link&utm_content=WP+Tab+Widget+Pro+LP&utm_campaign=WordPressOrg&wpmts" target="_blank">&nbsp;'.__('Click here for all the exciting features.','wp-tab-widget').'</a></p><a href="%1$s" class="dashicons dashicons-dismiss dashicons-dismiss-icon tabwidget-notice-dismiss" data-ignore="0" style="position: absolute; top: 8px; right: 8px; color: #222; opacity: 0.4; text-decoration: none !important;"></a>';
690
+ echo "</div>";
691
  }
692
 
693
  /* Other notice appears right after activating */
699
  echo '<p>';
700
  _e('Thank you for trying WP Tab Widget. We hope you will like it.', 'wp-tab-widget');
701
  echo '</p>';
702
+ echo '<a class="notice-dismiss tabwidget-notice-dismiss" data-ignore="1" href="#"></a>';
703
  echo "</div>";
704
  }
705
  }
706
 
707
+ add_action('wp_ajax_mts_dismiss_tabwidget_notice', function(){
708
+ global $current_user;
 
709
  $user_id = $current_user->ID;
710
  /* If user clicks to ignore the notice, add that to their user meta */
711
+ if ( isset($_POST['dismiss']) ) {
712
+ if ( '0' == $_POST['dismiss'] ) {
713
+ add_user_meta($user_id, 'wp_tab_widget_ignore_notice', '1', true);
714
+ } elseif ( '1' == $_POST['dismiss'] ) {
715
+ add_user_meta($user_id, 'wp_tab_widget_ignore_notice_2', '1', true);
716
+ }
717
+ }
718
+ });