Shortcoder - Version 4.0.2

Version Description

  • Fix: Sometimes get_current_screen() was called early in some setups.
Download this release

Release Info

Developer vaakash
Plugin Icon 128x128 Shortcoder
Version 4.0.2
Comparing to
See all releases

Code changes from version 4.0.1 to 4.0.2

Files changed (4) hide show
  1. admin/css/style.css +5 -2
  2. admin/sc-admin.php +29 -8
  3. readme.txt +4 -1
  4. shortcoder.php +3 -3
admin/css/style.css CHANGED
@@ -291,12 +291,12 @@ h1.sc_title .title-count {
291
  .rate_link{
292
  float: right;
293
  }
294
- .rate_link a{
295
  color: #e7711b;
296
  text-decoration: none;
297
  font-size: 13px;
298
  }
299
- .rate_link:hover a{
300
  text-decoration: underline;
301
  }
302
  .rate_link .dashicons {
@@ -314,6 +314,9 @@ h1.sc_title .title-count {
314
  height: 32px;
315
  color: #607D8B;
316
  }
 
 
 
317
 
318
  @keyframes spin {
319
  from {transform:rotate(0deg);}
291
  .rate_link{
292
  float: right;
293
  }
294
+ .rate_link .dashicons{
295
  color: #e7711b;
296
  text-decoration: none;
297
  font-size: 13px;
298
  }
299
+ .rate_link:hover .dashicons{
300
  text-decoration: underline;
301
  }
302
  .rate_link .dashicons {
314
  height: 32px;
315
  color: #607D8B;
316
  }
317
+ .help_link:hover .dashicons{
318
+ color: #000;
319
+ }
320
 
321
  @keyframes spin {
322
  from {transform:rotate(0deg);}
admin/sc-admin.php CHANGED
@@ -22,8 +22,7 @@ class Shortcoder_Admin{
22
  add_action( 'admin_footer', array( __class__, 'add_qt_button' ) );
23
 
24
  // Add TinyMCE button
25
- add_filter( 'mce_buttons', array( __class__, 'register_mce_button' ) );
26
- add_filter( 'mce_external_plugins', array( __class__, 'register_mce_js' ) );
27
 
28
  }
29
 
@@ -342,10 +341,14 @@ class Shortcoder_Admin{
342
  </script>';
343
  }
344
 
 
 
 
 
 
345
  public static function register_mce_button( $buttons ){
346
 
347
- $screen = get_current_screen();
348
- if( self::$pagehook == $screen->id )
349
  return $buttons;
350
 
351
  array_push( $buttons, 'separator', 'shortcoder' );
@@ -354,8 +357,7 @@ class Shortcoder_Admin{
354
 
355
  public static function register_mce_js( $plugins ){
356
 
357
- $screen = get_current_screen();
358
- if( self::$pagehook == $screen->id )
359
  return $plugins;
360
 
361
  $plugins[ 'shortcoder' ] = SC_ADMIN_URL . '/js/tinymce/editor_plugin.js';
@@ -386,7 +388,11 @@ class Shortcoder_Admin{
386
  <p>Thank you for using Shortcoder. If you found the plugin useful buy me a coffee ! Your donation will motivate and make me happy for all the efforts. You can donate via PayPal.</p>';
387
  echo '</div>';
388
 
389
- echo '<p class="credits_box"><img src="' . SC_ADMIN_URL . '/images/aw.png" /> Created by <a href="https://goo.gl/aHKnsM" target="_blank">Aakash Chakravarthy</a> - Follow me on <a href="https://twitter.com/vaakash", target="_blank">Twitter</a>, <a href="https://fb.com/aakashweb" target="_blank">Facebook</a>, <a href="https://www.linkedin.com/in/vaakash/" target="_blank">LinkedIn</a>. Check out <a href="https://goo.gl/OAxx4l" target="_blank">my other works</a>. <span class="rate_link">Rate <a href="https://goo.gl/ltvnIE" target="_blank"><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span></a> if you like Shortcoder</span></p>';
 
 
 
 
390
 
391
  }
392
 
@@ -394,7 +400,8 @@ class Shortcoder_Admin{
394
  echo '
395
  <div class="top_sharebar">
396
 
397
- <a href="https://goo.gl/r8Qr7Y" class="help_link" target="_blank"><span class="dashicons dashicons-editor-help"></span></a>
 
398
 
399
  <div class="a2a_kit a2a_kit_size_32 a2a_default_style">
400
  <a class="a2a_button_twitter"></a>
@@ -482,6 +489,20 @@ class Shortcoder_Admin{
482
 
483
  }
484
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
485
  }
486
 
487
  Shortcoder_Admin::init();
22
  add_action( 'admin_footer', array( __class__, 'add_qt_button' ) );
23
 
24
  // Add TinyMCE button
25
+ add_action( 'admin_init', array( __class__, 'register_mce' ) );
 
26
 
27
  }
28
 
341
  </script>';
342
  }
343
 
344
+ public static function register_mce(){
345
+ add_filter( 'mce_buttons', array( __class__, 'register_mce_button' ) );
346
+ add_filter( 'mce_external_plugins', array( __class__, 'register_mce_js' ) );
347
+ }
348
+
349
  public static function register_mce_button( $buttons ){
350
 
351
+ if( self::is_sc_admin() )
 
352
  return $buttons;
353
 
354
  array_push( $buttons, 'separator', 'shortcoder' );
357
 
358
  public static function register_mce_js( $plugins ){
359
 
360
+ if( self::is_sc_admin() )
 
361
  return $plugins;
362
 
363
  $plugins[ 'shortcoder' ] = SC_ADMIN_URL . '/js/tinymce/editor_plugin.js';
388
  <p>Thank you for using Shortcoder. If you found the plugin useful buy me a coffee ! Your donation will motivate and make me happy for all the efforts. You can donate via PayPal.</p>';
389
  echo '</div>';
390
 
391
+ echo '<p class="credits_box"><img src="' . SC_ADMIN_URL . '/images/aw.png" /> Created by <a href="https://goo.gl/aHKnsM" target="_blank">Aakash Chakravarthy</a> - Follow me on <a href="https://twitter.com/vaakash", target="_blank">Twitter</a>, <a href="https://fb.com/aakashweb" target="_blank">Facebook</a>, <a href="https://www.linkedin.com/in/vaakash/" target="_blank">LinkedIn</a>. Check out <a href="https://goo.gl/OAxx4l" target="_blank">my other works</a>.
392
+
393
+ <a href="https://goo.gl/ltvnIE" class="rate_link" target="_blank">Rate <span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span><span class="dashicons dashicons-star-filled"></span> if you like Shortcoder</a>
394
+
395
+ </p>';
396
 
397
  }
398
 
400
  echo '
401
  <div class="top_sharebar">
402
 
403
+ <a href="https://goo.gl/r8Qr7Y" class="help_link" target="_blank" title="Help"><span class="dashicons dashicons-editor-help"></span></a>
404
+ <a href="https://goo.gl/URfxp2" class="help_link" target="_blank" title="Report issue"><span class="dashicons dashicons-flag"></span></a>
405
 
406
  <div class="a2a_kit a2a_kit_size_32 a2a_default_style">
407
  <a class="a2a_button_twitter"></a>
489
 
490
  }
491
 
492
+ public static function is_sc_admin(){
493
+
494
+ if( !function_exists( 'get_current_screen' ) )
495
+ return false;
496
+
497
+ $screen = get_current_screen();
498
+ if( self::$pagehook == $screen->id ){
499
+ return true;
500
+ }else{
501
+ return false;
502
+ }
503
+
504
+ }
505
+
506
  }
507
 
508
  Shortcoder_Admin::init();
readme.txt CHANGED
@@ -7,7 +7,7 @@ Donate link: https://goo.gl/qMF3iE
7
  License: GPLv2 or later
8
  Requires at least: 3.3
9
  Tested up to: 4.8
10
- Stable tag: 4.0.1
11
 
12
  Create custom "Shortcodes" easily for HTML, Javascript snippets and use the shortcodes within posts, pages & widgets.
13
 
@@ -91,6 +91,9 @@ Note: When you disable a shortcode, the shortcode will not be executed in the pa
91
 
92
  == Changelog ==
93
 
 
 
 
94
  = 4.0.1 =
95
  * Fix: Servers with PHP version < 5.5 were facing HTTP 500 error because of misuse of PHP language construct in code.
96
 
7
  License: GPLv2 or later
8
  Requires at least: 3.3
9
  Tested up to: 4.8
10
+ Stable tag: 4.0.2
11
 
12
  Create custom "Shortcodes" easily for HTML, Javascript snippets and use the shortcodes within posts, pages & widgets.
13
 
91
 
92
  == Changelog ==
93
 
94
+ = 4.0.2 =
95
+ * Fix: Sometimes `get_current_screen()` was called early in some setups.
96
+
97
  = 4.0.1 =
98
  * Fix: Servers with PHP version < 5.5 were facing HTTP 500 error because of misuse of PHP language construct in code.
99
 
shortcoder.php CHANGED
@@ -2,13 +2,13 @@
2
  /*
3
  Plugin Name: Shortcoder
4
  Plugin URI: https://www.aakashweb.com
5
- Description: Shortcoder is a plugin which allows to create a custom shortcode and store HTML, Javascript and other snippets in it. So if that shortcode is used in any post or pages, then the code stored in the shortcode get exceuted in that place. You can create a shortcode for Youtube videos, adsense ads, buttons and more.
6
  Author: Aakash Chakravarthy
7
- Version: 4.0.1
8
  Author URI: https://www.aakashweb.com/
9
  */
10
 
11
- define( 'SC_VERSION', '4.0.1');
12
  define( 'SC_PATH', plugin_dir_path( __FILE__ ) ); // All have trailing slash
13
  define( 'SC_URL', plugin_dir_url( __FILE__ ) );
14
  define( 'SC_ADMIN_URL', trailingslashit( plugin_dir_url( __FILE__ ) . 'admin' ) );
2
  /*
3
  Plugin Name: Shortcoder
4
  Plugin URI: https://www.aakashweb.com
5
+ Description: Shortcoder is a plugin which allows to create a custom shortcode and store HTML, Javascript and other snippets in it. So if that shortcode is used in any post or pages, then the code stored in the shortcode get executed in that place. You can create a shortcode for Youtube videos, adsense ads, buttons and more.
6
  Author: Aakash Chakravarthy
7
+ Version: 4.0.2
8
  Author URI: https://www.aakashweb.com/
9
  */
10
 
11
+ define( 'SC_VERSION', '4.0.2');
12
  define( 'SC_PATH', plugin_dir_path( __FILE__ ) ); // All have trailing slash
13
  define( 'SC_URL', plugin_dir_url( __FILE__ ) );
14
  define( 'SC_ADMIN_URL', trailingslashit( plugin_dir_url( __FILE__ ) . 'admin' ) );