Scripts n Styles - Version 3.4.3

Version Description

  • No newline at end of file
  • Remove closing php tags
  • More guards against PHP 7.1 array conversion breaking change
Download this release

Release Info

Developer WraithKenny
Plugin Icon wp plugin Scripts n Styles
Version 3.4.3
Comparing to
See all releases

Code changes from version 3.4.2 to 3.4.3

README.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: WraithKenny, CaptainN
3
  Tags: admin, CSS, javascript, code, custom, Style
4
  Requires at least: 4.7.2
5
  Tested up to: 4.8.1
6
- Stable tag: 3.4.2
7
  License: GPLv3 or later
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
@@ -58,6 +58,11 @@ Sure, if you are an Admin, just go to the plugin editor and wipe out the uninsta
58
 
59
  == Changelog ==
60
 
 
 
 
 
 
61
  = 3.4.2 =
62
  * Silence alert debug message.
63
 
3
  Tags: admin, CSS, javascript, code, custom, Style
4
  Requires at least: 4.7.2
5
  Tested up to: 4.8.1
6
+ Stable tag: 3.4.3
7
  License: GPLv3 or later
8
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
9
 
58
 
59
  == Changelog ==
60
 
61
+ = 3.4.3 =
62
+ * No newline at end of file
63
+ * Remove closing php tags
64
+ * More guards against PHP 7.1 array conversion breaking change
65
+
66
  = 3.4.2 =
67
  * Silence alert debug message.
68
 
includes/class-sns-admin.php CHANGED
@@ -201,6 +201,4 @@ class SnS_Admin
201
  return $actions;
202
  }
203
 
204
- }
205
-
206
- ?>
201
  return $actions;
202
  }
203
 
204
+ }
 
 
includes/class-sns-ajax.php CHANGED
@@ -125,6 +125,7 @@ class SnS_AJAX
125
 
126
  $options = get_option( 'SnS_options' );
127
  $SnS = get_post_meta( $post_id, '_SnS', true );
 
128
  $styles = isset( $SnS['styles'] ) ? $SnS[ 'styles' ]: array();
129
 
130
  header('Content-Type: text/css; charset=UTF-8');
@@ -146,6 +147,7 @@ class SnS_AJAX
146
 
147
  $post_id = absint( $_REQUEST[ 'post_id' ] );
148
  $SnS = get_post_meta( $post_id, '_SnS', true );
 
149
  $styles = isset( $SnS['styles'] ) ? $SnS[ 'styles' ]: array();
150
 
151
  $styles = self::maybe_set( $styles, 'classes_body' );
@@ -176,6 +178,7 @@ class SnS_AJAX
176
 
177
  $post_id = absint( $_REQUEST[ 'post_id' ] );
178
  $SnS = get_post_meta( $post_id, '_SnS', true );
 
179
  $scripts = isset( $SnS['scripts'] ) ? $SnS[ 'scripts' ]: array();
180
 
181
  $scripts = self::maybe_set( $scripts, 'scripts_in_head' );
@@ -206,6 +209,7 @@ class SnS_AJAX
206
 
207
  $post_id = absint( $_REQUEST[ 'post_id' ] );
208
  $SnS = get_post_meta( $post_id, '_SnS', true );
 
209
  $styles = isset( $SnS['styles'] ) ? $SnS[ 'styles' ]: array();
210
 
211
  $styles = self::maybe_set( $styles, 'styles' );
@@ -242,6 +246,7 @@ class SnS_AJAX
242
  $post_id = absint( $_REQUEST[ 'post_id' ] );
243
 
244
  $SnS = get_post_meta( $post_id, '_SnS', true );
 
245
  $styles = isset( $SnS['styles'] ) ? $SnS[ 'styles' ]: array();
246
 
247
  if ( ! isset( $styles[ 'classes_mce' ] ) ) $styles[ 'classes_mce' ] = array();
@@ -266,6 +271,7 @@ class SnS_AJAX
266
  if ( empty( $_REQUEST[ 'post_id' ] ) ) exit( 'Bad post ID.' );
267
  $post_id = absint( $_REQUEST[ 'post_id' ] );
268
  $SnS = get_post_meta( $post_id, '_SnS', true );
 
269
  $styles = isset( $SnS['styles'] ) ? $SnS[ 'styles' ]: array();
270
 
271
  $title = $_REQUEST[ 'delete' ];
@@ -306,6 +312,7 @@ class SnS_AJAX
306
 
307
  $post_id = absint( $_REQUEST[ 'post_id' ] );
308
  $SnS = get_post_meta( $post_id, '_SnS', true );
 
309
  $shortcodes = isset( $SnS[ 'shortcodes' ] ) ? $SnS[ 'shortcodes' ]: array();
310
  $message = '';
311
  $code = 0;
@@ -411,5 +418,4 @@ class SnS_AJAX
411
  update_post_meta( $id, $name, $meta );
412
  }
413
  }
414
- }
415
- ?>
125
 
126
  $options = get_option( 'SnS_options' );
127
  $SnS = get_post_meta( $post_id, '_SnS', true );
128
+ $SnS = is_array( $SnS ) ? $SnS: array();
129
  $styles = isset( $SnS['styles'] ) ? $SnS[ 'styles' ]: array();
130
 
131
  header('Content-Type: text/css; charset=UTF-8');
147
 
148
  $post_id = absint( $_REQUEST[ 'post_id' ] );
149
  $SnS = get_post_meta( $post_id, '_SnS', true );
150
+ $SnS = is_array( $SnS ) ? $SnS: array();
151
  $styles = isset( $SnS['styles'] ) ? $SnS[ 'styles' ]: array();
152
 
153
  $styles = self::maybe_set( $styles, 'classes_body' );
178
 
179
  $post_id = absint( $_REQUEST[ 'post_id' ] );
180
  $SnS = get_post_meta( $post_id, '_SnS', true );
181
+ $SnS = is_array( $SnS ) ? $SnS: array();
182
  $scripts = isset( $SnS['scripts'] ) ? $SnS[ 'scripts' ]: array();
183
 
184
  $scripts = self::maybe_set( $scripts, 'scripts_in_head' );
209
 
210
  $post_id = absint( $_REQUEST[ 'post_id' ] );
211
  $SnS = get_post_meta( $post_id, '_SnS', true );
212
+ $SnS = is_array( $SnS ) ? $SnS: array();
213
  $styles = isset( $SnS['styles'] ) ? $SnS[ 'styles' ]: array();
214
 
215
  $styles = self::maybe_set( $styles, 'styles' );
246
  $post_id = absint( $_REQUEST[ 'post_id' ] );
247
 
248
  $SnS = get_post_meta( $post_id, '_SnS', true );
249
+ $SnS = is_array( $SnS ) ? $SnS: array();
250
  $styles = isset( $SnS['styles'] ) ? $SnS[ 'styles' ]: array();
251
 
252
  if ( ! isset( $styles[ 'classes_mce' ] ) ) $styles[ 'classes_mce' ] = array();
271
  if ( empty( $_REQUEST[ 'post_id' ] ) ) exit( 'Bad post ID.' );
272
  $post_id = absint( $_REQUEST[ 'post_id' ] );
273
  $SnS = get_post_meta( $post_id, '_SnS', true );
274
+ $SnS = is_array( $SnS ) ? $SnS: array();
275
  $styles = isset( $SnS['styles'] ) ? $SnS[ 'styles' ]: array();
276
 
277
  $title = $_REQUEST[ 'delete' ];
312
 
313
  $post_id = absint( $_REQUEST[ 'post_id' ] );
314
  $SnS = get_post_meta( $post_id, '_SnS', true );
315
+ $SnS = is_array( $SnS ) ? $SnS: array();
316
  $shortcodes = isset( $SnS[ 'shortcodes' ] ) ? $SnS[ 'shortcodes' ]: array();
317
  $message = '';
318
  $code = 0;
418
  update_post_meta( $id, $name, $meta );
419
  }
420
  }
421
+ }
 
includes/class-sns-code-editor.php CHANGED
@@ -32,5 +32,4 @@ class SnS_Admin_Code_Editor
32
  'nonce' => wp_create_nonce( 'sns_plugin_editor')
33
  ) );
34
  }
35
- }
36
- ?>
32
  'nonce' => wp_create_nonce( 'sns_plugin_editor')
33
  ) );
34
  }
35
+ }
 
includes/class-sns-form.php CHANGED
@@ -182,5 +182,4 @@ class SnS_Form
182
  </div>
183
  <?php
184
  }
185
- }
186
- ?>
182
  </div>
183
  <?php
184
  }
185
+ }
 
includes/class-sns-global-page.php CHANGED
@@ -198,5 +198,4 @@ class SnS_Global_Page
198
  </div>
199
  <?php
200
  }
201
- }
202
- ?>
198
  </div>
199
  <?php
200
  }
201
+ }
 
includes/class-sns-hoops-page.php CHANGED
@@ -190,5 +190,4 @@ class SnS_Hoops_Page
190
  </div>
191
  <?php
192
  }
193
- }
194
- ?>
190
  </div>
191
  <?php
192
  }
193
+ }
 
includes/class-sns-list-usage.php CHANGED
@@ -163,6 +163,7 @@ class SnS_List_Usage extends WP_List_Table {
163
  function _add_meta_data( $posts ) {
164
  foreach( $posts as $post) {
165
  $SnS = get_post_meta( $post->ID, '_SnS', true );
 
166
  $styles = isset( $SnS[ 'styles' ] ) ? $SnS[ 'styles' ]: array();
167
  $scripts = isset( $SnS[ 'scripts' ] ) ? $SnS[ 'scripts' ]: array();
168
  if ( ! empty( $styles ) )
@@ -172,5 +173,4 @@ class SnS_List_Usage extends WP_List_Table {
172
  }
173
  return $posts;
174
  }
175
- }
176
- ?>
163
  function _add_meta_data( $posts ) {
164
  foreach( $posts as $post) {
165
  $SnS = get_post_meta( $post->ID, '_SnS', true );
166
+ $SnS = is_array( $SnS ) ? $SnS: array();
167
  $styles = isset( $SnS[ 'styles' ] ) ? $SnS[ 'styles' ]: array();
168
  $scripts = isset( $SnS[ 'scripts' ] ) ? $SnS[ 'scripts' ]: array();
169
  if ( ! empty( $styles ) )
173
  }
174
  return $posts;
175
  }
176
+ }
 
includes/class-sns-meta-box.php CHANGED
@@ -27,6 +27,7 @@ class SnS_Admin_Meta_Box
27
  static function mce_buttons_2( $buttons ) {
28
  global $post;
29
  $SnS = get_post_meta( $post->ID, '_SnS', true );
 
30
  $styles = isset( $SnS['styles'] ) ? $SnS[ 'styles' ]: array();
31
 
32
  if ( ! empty( $styles[ 'classes_mce' ] ) )
@@ -37,6 +38,7 @@ class SnS_Admin_Meta_Box
37
  static function tiny_mce_before_init( $initArray ) {
38
  global $post;
39
  $SnS = get_post_meta( $post->ID, '_SnS', true );
 
40
  $styles = isset( $SnS['styles'] ) ? $SnS[ 'styles' ]: array();
41
 
42
  // Add div as a format option, should probably use a string replace thing here.
@@ -119,6 +121,7 @@ class SnS_Admin_Meta_Box
119
  static function admin_meta_box( $post ) {
120
  $registered_handles = Scripts_n_Styles::get_wp_registered();
121
  $SnS = get_post_meta( $post->ID, '_SnS', true );
 
122
  $styles = isset( $SnS['styles'] ) ? $SnS[ 'styles' ]: array();
123
  $scripts = isset( $SnS['scripts'] ) ? $SnS[ 'scripts' ]: array();
124
 
@@ -247,6 +250,7 @@ class SnS_Admin_Meta_Box
247
  <?php
248
  $meta_name = 'SnS_shortcodes';
249
  $SnS = get_post_meta( $post->ID, '_SnS', true );
 
250
  $shortcodes = isset( $SnS['shortcodes'] ) ? $SnS[ 'shortcodes' ] : array();
251
  ?>
252
  <label for="<?php echo $meta_name; ?>">Name: </label>
@@ -333,7 +337,7 @@ class SnS_Admin_Meta_Box
333
  */
334
 
335
  $SnS = get_post_meta( $post_id, '_SnS', true );
336
- $SnS = is_array( $SnS ) ? $SnS: array(); // Something changed in PHP 7/WP 4.8
337
  $scripts = isset( $SnS['scripts'] ) ? $SnS[ 'scripts' ]: array();
338
  $styles = isset( $SnS['styles'] ) ? $SnS[ 'styles' ]: array();
339
 
@@ -418,5 +422,4 @@ class SnS_Admin_Meta_Box
418
  }
419
  return $o;
420
  }
421
- }
422
- ?>
27
  static function mce_buttons_2( $buttons ) {
28
  global $post;
29
  $SnS = get_post_meta( $post->ID, '_SnS', true );
30
+ $SnS = is_array( $SnS ) ? $SnS: array();
31
  $styles = isset( $SnS['styles'] ) ? $SnS[ 'styles' ]: array();
32
 
33
  if ( ! empty( $styles[ 'classes_mce' ] ) )
38
  static function tiny_mce_before_init( $initArray ) {
39
  global $post;
40
  $SnS = get_post_meta( $post->ID, '_SnS', true );
41
+ $SnS = is_array( $SnS ) ? $SnS: array();
42
  $styles = isset( $SnS['styles'] ) ? $SnS[ 'styles' ]: array();
43
 
44
  // Add div as a format option, should probably use a string replace thing here.
121
  static function admin_meta_box( $post ) {
122
  $registered_handles = Scripts_n_Styles::get_wp_registered();
123
  $SnS = get_post_meta( $post->ID, '_SnS', true );
124
+ $SnS = is_array( $SnS ) ? $SnS: array();
125
  $styles = isset( $SnS['styles'] ) ? $SnS[ 'styles' ]: array();
126
  $scripts = isset( $SnS['scripts'] ) ? $SnS[ 'scripts' ]: array();
127
 
250
  <?php
251
  $meta_name = 'SnS_shortcodes';
252
  $SnS = get_post_meta( $post->ID, '_SnS', true );
253
+ $SnS = is_array( $SnS ) ? $SnS: array();
254
  $shortcodes = isset( $SnS['shortcodes'] ) ? $SnS[ 'shortcodes' ] : array();
255
  ?>
256
  <label for="<?php echo $meta_name; ?>">Name: </label>
337
  */
338
 
339
  $SnS = get_post_meta( $post_id, '_SnS', true );
340
+ $SnS = is_array( $SnS ) ? $SnS: array(); // automatic array conversion became an error in PHP 7.1
341
  $scripts = isset( $SnS['scripts'] ) ? $SnS[ 'scripts' ]: array();
342
  $styles = isset( $SnS['styles'] ) ? $SnS[ 'styles' ]: array();
343
 
422
  }
423
  return $o;
424
  }
425
+ }
 
includes/class-sns-settings-page.php CHANGED
@@ -183,5 +183,4 @@ function hello($who) {
183
  </div>
184
  <?php
185
  }
186
- }
187
- ?>
183
  </div>
184
  <?php
185
  }
186
+ }
 
includes/class-sns-theme-page.php CHANGED
@@ -167,5 +167,4 @@ class SnS_Theme_Page
167
  </div>
168
  <?php
169
  }
170
- }
171
- ?>
167
  </div>
168
  <?php
169
  }
170
+ }
 
includes/class-sns-usage-page.php CHANGED
@@ -86,5 +86,4 @@ class SnS_Usage_Page
86
  $usageTable->prepare_items();
87
  $usageTable->display();
88
  }
89
- }
90
- ?>
86
  $usageTable->prepare_items();
87
  $usageTable->display();
88
  }
89
+ }
 
scripts-n-styles.php CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://www.unfocus.com/projects/scripts-n-styles/
5
  Description: Allows WordPress admin users the ability to add custom CSS and JavaScript directly to individual Post, Pages or custom post types.
6
  Author: unFocus Projects
7
  Author URI: http://www.unfocus.com/
8
- Version: 3.4.2
9
  License: GPLv3 or later
10
  Text Domain: scripts-n-styles
11
  */
@@ -60,7 +60,7 @@ endif;
60
  * @link http://www.unfocus.com/projects/scripts-n-styles/ Plugin URI
61
  * @author unFocus Projects
62
  * @link http://www.unfocus.com/ Author URI
63
- * @version 3.4.2
64
  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
65
  * @copyright Copyright (c) 2010 - 2017, Kenneth Newman
66
  * @copyright Copyright (c) 2012, Kevin Newman
@@ -78,7 +78,7 @@ class Scripts_n_Styles
78
  /**#@+
79
  * @static
80
  */
81
- const VERSION = '3.4.2';
82
  static $file = __FILE__;
83
  static $cm_themes = array( 'default', '3024-day', '3024-night', 'ambiance',
84
  'base16-dark', 'base16-light',
@@ -478,5 +478,4 @@ class SnS_Widget extends WP_Widget
478
  <p><input id="<?php echo $this->get_field_id( 'filter' ); ?>" name="<?php echo $this->get_field_name( 'filter' ); ?>" type="checkbox" <?php checked( isset( $instance[ 'filter' ] ) ? $instance[ 'filter' ] : 0 ); ?> />&nbsp;<label for="<?php echo $this->get_field_id( 'filter' ); ?>"><?php _e( 'Automatically add paragraphs' ); ?></label></p>
479
  <?php
480
  }
481
- }
482
- ?>
5
  Description: Allows WordPress admin users the ability to add custom CSS and JavaScript directly to individual Post, Pages or custom post types.
6
  Author: unFocus Projects
7
  Author URI: http://www.unfocus.com/
8
+ Version: 3.4.3
9
  License: GPLv3 or later
10
  Text Domain: scripts-n-styles
11
  */
60
  * @link http://www.unfocus.com/projects/scripts-n-styles/ Plugin URI
61
  * @author unFocus Projects
62
  * @link http://www.unfocus.com/ Author URI
63
+ * @version 3.4.3
64
  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
65
  * @copyright Copyright (c) 2010 - 2017, Kenneth Newman
66
  * @copyright Copyright (c) 2012, Kevin Newman
78
  /**#@+
79
  * @static
80
  */
81
+ const VERSION = '3.4.3';
82
  static $file = __FILE__;
83
  static $cm_themes = array( 'default', '3024-day', '3024-night', 'ambiance',
84
  'base16-dark', 'base16-light',
478
  <p><input id="<?php echo $this->get_field_id( 'filter' ); ?>" name="<?php echo $this->get_field_name( 'filter' ); ?>" type="checkbox" <?php checked( isset( $instance[ 'filter' ] ) ? $instance[ 'filter' ] : 0 ); ?> />&nbsp;<label for="<?php echo $this->get_field_id( 'filter' ); ?>"><?php _e( 'Automatically add paragraphs' ); ?></label></p>
479
  <?php
480
  }
481
+ }