WP Shortcode by MyThemeShop - Version 1.4.14

Version Description

  • Updated admin notices
Download this release

Release Info

Developer MyThemeShop
Plugin Icon 128x128 WP Shortcode by MyThemeShop
Version 1.4.14
Comparing to
See all releases

Code changes from version 1.4.13 to 1.4.14

Files changed (3) hide show
  1. js/admin.js +13 -0
  2. readme.txt +4 -1
  3. wp-shortcode.php +14 -10
js/admin.js ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ jQuery(document).on('click', '.mts-notice-dismiss', function(e){
2
+ e.preventDefault();
3
+ jQuery(this).parent().remove();
4
+ jQuery.ajax({
5
+ type: "POST",
6
+ url: ajaxurl,
7
+ data: {
8
+ action: 'mts_dismiss_plugin_notice',
9
+ dismiss: jQuery(this).data('ignore')
10
+ }
11
+ });
12
+ return false;
13
+ });
readme.txt CHANGED
@@ -4,7 +4,7 @@ Creator's website link: http://mythemeshop.com/
4
  Tags: shortcodes, shortcode, shortcodes list, toggle shortcode, buttons, google map shortcode, youtube shortcode, vimeo shortcode, alert shortcode, notification shortcode, column shortcodes
5
  Requires at least: 3.0.1
6
  Tested up to: 4.9.4
7
- Stable tag: 1.4.13
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -65,6 +65,9 @@ Please disable all plugins and check if shortcode plugin is working properly. Th
65
 
66
  == Changelog ==
67
 
 
 
 
68
  = 1.4.13 =
69
  * Changed admin notices
70
 
4
  Tags: shortcodes, shortcode, shortcodes list, toggle shortcode, buttons, google map shortcode, youtube shortcode, vimeo shortcode, alert shortcode, notification shortcode, column shortcodes
5
  Requires at least: 3.0.1
6
  Tested up to: 4.9.4
7
+ Stable tag: 1.4.14
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
65
 
66
  == Changelog ==
67
 
68
+ = 1.4.14 =
69
+ * Updated admin notices
70
+
71
  = 1.4.13 =
72
  * Changed admin notices
73
 
wp-shortcode.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: WP Shortcode by MyThemeShop
4
  Plugin URI: http://mythemeshop.com/
5
  Description: With the vast array of shortcodes, you can quickly and easily build content for your posts and pages and turbocharge your blogging experience.
6
  Author: MyThemeShop
7
- Version: 1.4.13
8
  Author URI: http://mythemeshop.com/
9
  */
10
 
@@ -16,6 +16,10 @@ function mts_wpshortcodes_scripts() {
16
  }
17
  add_action('wp_enqueue_scripts', 'mts_wpshortcodes_scripts', 99);
18
 
 
 
 
 
19
  function mts_wps_enqueue_scripts($shortcode = '') {
20
 
21
  if($shortcode == 'tooltip') {
@@ -501,31 +505,31 @@ function wp_shortcode_admin_notice() {
501
  /* Only show the notice 2 days after plugin activation */
502
  if ( ! get_user_meta($user_id, 'wp_shortcode_ignore_notice') && time() >= (get_option( 'wp_shortcode_activated', 0 ) + (2 * 24 * 60 * 60)) ) {
503
  echo '<div class="updated notice-info wp-shortcode-notice" id="wpshortcode-notice" style="position:relative;">';
504
- printf(__('<p>Like WP Shortcode plugin? You will LOVE <a target="_blank" href="https://mythemeshop.com/plugins/wp-shortcode-pro/?utm_source=WP+Shortcode&utm_medium=Notification+Link&utm_content=WP+Shortcode+Pro+LP&utm_campaign=WordPressOrg"><strong>WP Shortcode Pro!</strong></a></p><a class="notice-dismiss" href="%1$s"></a>', 'wp-shortcode'), '?wp_shortcode_admin_notice_ignore=0');
505
  echo "</div>";
506
  }
507
  /* Other notice appears right after activating */
508
  /* And it gets hidden after showing 3 times */
509
- if ( ! get_user_meta($user_id, 'wp_shortcode_ignore_notice_2') && get_option('wp_shortcode_notice_views', 0) < 3 ) {
510
  $views = get_option('wp_shortcode_notice_views', 0);
511
  update_option( 'wp_shortcode_notice_views', ($views + 1) );
512
  echo '<div class="updated notice-info wp-shortcode-notice" id="wpshortcode-notice2" style="position:relative;">';
513
  echo '<p>';
514
  _e('Thank you for trying WP Shortcode. We hope you will like it.', 'wp-shortcode');
515
- echo '</p><a class="notice-dismiss" href="?wp_shortcode_admin_notice_ignore=0"></a>';
516
  echo "</div>";
517
  }
518
  }
519
- add_action('admin_init', 'wp_shortcode_admin_notice_ignore');
520
- function wp_shortcode_admin_notice_ignore() {
521
  global $current_user;
522
  $user_id = $current_user->ID;
523
  /* If user clicks to ignore the notice, add that to their user meta */
524
- if ( isset($_GET['wp_shortcode_admin_notice_ignore']) ) {
525
- if ( '0' == $_GET['wp_shortcode_admin_notice_ignore'] ) {
526
  add_user_meta($user_id, 'wp_shortcode_ignore_notice', '1', true);
527
- } elseif ( '1' == $_GET['wp_shortcode_admin_notice_ignore'] ) {
528
  add_user_meta($user_id, 'wp_shortcode_ignore_notice_2', '1', true);
529
  }
530
  }
531
- }
4
  Plugin URI: http://mythemeshop.com/
5
  Description: With the vast array of shortcodes, you can quickly and easily build content for your posts and pages and turbocharge your blogging experience.
6
  Author: MyThemeShop
7
+ Version: 1.4.14
8
  Author URI: http://mythemeshop.com/
9
  */
10
 
16
  }
17
  add_action('wp_enqueue_scripts', 'mts_wpshortcodes_scripts', 99);
18
 
19
+ add_action('admin_enqueue_scripts', function(){
20
+ wp_enqueue_script( 'mts_wpshortcodes_admin', plugins_url('js/admin.js', __FILE__), array('jquery') );
21
+ });
22
+
23
  function mts_wps_enqueue_scripts($shortcode = '') {
24
 
25
  if($shortcode == 'tooltip') {
505
  /* Only show the notice 2 days after plugin activation */
506
  if ( ! get_user_meta($user_id, 'wp_shortcode_ignore_notice') && time() >= (get_option( 'wp_shortcode_activated', 0 ) + (2 * 24 * 60 * 60)) ) {
507
  echo '<div class="updated notice-info wp-shortcode-notice" id="wpshortcode-notice" style="position:relative;">';
508
+ printf(__('<p>Like WP Shortcode plugin? You will LOVE <a target="_blank" href="https://mythemeshop.com/plugins/wp-shortcode-pro/?utm_source=WP+Shortcode&utm_medium=Notification+Link&utm_content=WP+Shortcode+Pro+LP&utm_campaign=WordPressOrg"><strong>WP Shortcode Pro!</strong></a></p><a class="notice-dismiss mts-notice-dismiss" data-ignore="0" href="%1$s"></a>', 'wp-shortcode'), '?wp_shortcode_admin_notice_ignore=0');
509
  echo "</div>";
510
  }
511
  /* Other notice appears right after activating */
512
  /* And it gets hidden after showing 3 times */
513
+ if ( ! get_user_meta($user_id, 'wp_shortcode_ignore_notice_2') && get_option('wp_shortcode_notice_views', 0) < 3 && get_option( 'wp_shortcode_activated', 0 ) ) {
514
  $views = get_option('wp_shortcode_notice_views', 0);
515
  update_option( 'wp_shortcode_notice_views', ($views + 1) );
516
  echo '<div class="updated notice-info wp-shortcode-notice" id="wpshortcode-notice2" style="position:relative;">';
517
  echo '<p>';
518
  _e('Thank you for trying WP Shortcode. We hope you will like it.', 'wp-shortcode');
519
+ echo '</p><a class="notice-dismiss mts-notice-dismiss" data-ignore="1" href="?wp_shortcode_admin_notice_ignore=0"></a>';
520
  echo "</div>";
521
  }
522
  }
523
+
524
+ add_action('wp_ajax_mts_dismiss_plugin_notice', function(){
525
  global $current_user;
526
  $user_id = $current_user->ID;
527
  /* If user clicks to ignore the notice, add that to their user meta */
528
+ if ( isset($_POST['dismiss']) ) {
529
+ if ( '0' == $_POST['dismiss'] ) {
530
  add_user_meta($user_id, 'wp_shortcode_ignore_notice', '1', true);
531
+ } elseif ( '1' == $_POST['dismiss'] ) {
532
  add_user_meta($user_id, 'wp_shortcode_ignore_notice_2', '1', true);
533
  }
534
  }
535
+ });