Simple Custom CSS and JS - Version 3.38

Version Description

  • 11/09/2021
  • Fix: compatibility with the HTML Editor Syntax Highlighter plugin
  • Fix: escape labels on the "Add new custom code" page
  • Feature: Keep the last cursor position in the editor and let the editor get focus when the page loads
Download this release

Release Info

Developer diana_burduja
Plugin Icon 128x128 Simple Custom CSS and JS
Version 3.38
Comparing to
See all releases

Code changes from version 3.37 to 3.38

Files changed (3) hide show
  1. custom-css-js.php +3 -3
  2. includes/admin-screens.php +22 -8
  3. readme.txt +8 -2
custom-css-js.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Simple Custom CSS and JS
4
  * Plugin URI: https://wordpress.org/plugins/custom-css-js/
5
  * Description: Easily add Custom CSS or JS to your website with an awesome editor.
6
- * Version: 3.37
7
  * Author: SilkyPress.com
8
  * Author URI: https://www.silkypress.com
9
  * License: GPL2
@@ -12,7 +12,7 @@
12
  * Domain Path: /languages/
13
  *
14
  * WC requires at least: 3.0.0
15
- * WC tested up to: 5.5
16
  */
17
 
18
  if ( ! defined( 'ABSPATH' ) ) {
@@ -228,7 +228,7 @@ if ( ! class_exists( 'CustomCSSandJS' ) ) :
228
  function set_constants() {
229
  $dir = wp_upload_dir();
230
  $constants = array(
231
- 'CCJ_VERSION' => '3.37',
232
  'CCJ_UPLOAD_DIR' => $dir['basedir'] . '/custom-css-js',
233
  'CCJ_UPLOAD_URL' => $dir['baseurl'] . '/custom-css-js',
234
  'CCJ_PLUGIN_FILE' => __FILE__,
3
  * Plugin Name: Simple Custom CSS and JS
4
  * Plugin URI: https://wordpress.org/plugins/custom-css-js/
5
  * Description: Easily add Custom CSS or JS to your website with an awesome editor.
6
+ * Version: 3.38
7
  * Author: SilkyPress.com
8
  * Author URI: https://www.silkypress.com
9
  * License: GPL2
12
  * Domain Path: /languages/
13
  *
14
  * WC requires at least: 3.0.0
15
+ * WC tested up to: 6.0
16
  */
17
 
18
  if ( ! defined( 'ABSPATH' ) ) {
228
  function set_constants() {
229
  $dir = wp_upload_dir();
230
  $constants = array(
231
+ 'CCJ_VERSION' => '3.38',
232
  'CCJ_UPLOAD_DIR' => $dir['basedir'] . '/custom-css-js',
233
  'CCJ_UPLOAD_URL' => $dir['baseurl'] . '/custom-css-js',
234
  'CCJ_PLUGIN_FILE' => __FILE__,
includes/admin-screens.php CHANGED
@@ -60,6 +60,7 @@ class CustomCSSandJS_Admin {
60
  'save_post' => 'options_save_meta_box_data',
61
  'trashed_post' => 'trash_post',
62
  'untrashed_post' => 'trash_post',
 
63
  'wp_ajax_ccj_active_code' => 'wp_ajax_ccj_active_code',
64
  'wp_ajax_ccj_permalink' => 'wp_ajax_ccj_permalink',
65
  'post_submitbox_start' => 'post_submitbox_start',
@@ -716,10 +717,10 @@ End of comment */ ',
716
  '<!-- Add HTML code to the header or the footer.
717
 
718
  For example, you can use the following code for loading the jQuery library from Google CDN:
719
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
720
 
721
- or the following one for loading the Bootstrap library from MaxCDN:
722
- <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
723
 
724
  -- End of the comment --> ',
725
  'custom-css-js'
@@ -774,7 +775,7 @@ End of comment */ ',
774
  </div>
775
 
776
  <div class="code-mirror-before"><div><?php echo htmlentities( $code_mirror_before ); ?></div></div>
777
- <textarea class="wp-editor-area" id="ccj_content" mode="<?php echo htmlentities( $code_mirror_mode ); ?>" name="content"><?php echo $post->post_content; ?></textarea>
778
  <div class="code-mirror-after"><div><?php echo htmlentities( $code_mirror_after ); ?></div></div>
779
 
780
  <table id="post-status-info"><tbody><tr>
@@ -845,7 +846,7 @@ End of comment */ ',
845
  continue;
846
  }
847
 
848
- $output .= '<h3>' . $a['title'] . '</h3>' . PHP_EOL;
849
 
850
  $output .= $this->render_input( $_key, $a, $options );
851
 
@@ -1283,6 +1284,19 @@ endif;
1283
  }
1284
 
1285
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1286
  /**
1287
  * Render the checkboxes, radios, selects and inputs
1288
  */
@@ -1302,7 +1316,7 @@ endif;
1302
  }
1303
  $selected .= ( $__key == $options[ $_key ] ) ? ' checked="checked" ' : '';
1304
  $output .= '<input type="radio" ' . $selected . 'value="' . $__key . '" name="' . $name . '" id="' . $id . '">' . PHP_EOL;
1305
- $output .= '<label class="' . $dashicons . '" for="' . $id . '"> ' . $__value['title'] . '</label><br />' . PHP_EOL;
1306
  }
1307
  $output .= '</div>' . PHP_EOL;
1308
  }
@@ -1316,7 +1330,7 @@ endif;
1316
  }
1317
  $output .= '<div class="radio-group">' . PHP_EOL;
1318
  $output .= '<input type="checkbox" ' . $selected . ' value="1" name="' . $name . '" id="' . $name . '">' . PHP_EOL;
1319
- $output .= '<label class="' . $dashicons . '" for="' . $name . '"> ' . $a['title'] . '</label>';
1320
  $output .= '</div>' . PHP_EOL;
1321
  }
1322
 
@@ -1326,7 +1340,7 @@ endif;
1326
  $output .= '<select name="' . $name . '" id="' . $name . '">' . PHP_EOL;
1327
  foreach ( $a['values'] as $__key => $__value ) {
1328
  $selected = ( isset( $options[ $_key ] ) && $options[ $_key ] == $__key ) ? ' selected="selected"' : '';
1329
- $output .= '<option value="' . $__key . '"' . $selected . '>' . $__value . '</option>' . PHP_EOL;
1330
  }
1331
  $output .= '</select>' . PHP_EOL;
1332
  $output .= '</div>' . PHP_EOL;
60
  'save_post' => 'options_save_meta_box_data',
61
  'trashed_post' => 'trash_post',
62
  'untrashed_post' => 'trash_post',
63
+ 'wp_loaded' => 'wp_loaded',
64
  'wp_ajax_ccj_active_code' => 'wp_ajax_ccj_active_code',
65
  'wp_ajax_ccj_permalink' => 'wp_ajax_ccj_permalink',
66
  'post_submitbox_start' => 'post_submitbox_start',
717
  '<!-- Add HTML code to the header or the footer.
718
 
719
  For example, you can use the following code for loading the jQuery library from Google CDN:
720
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
721
 
722
+ or the following one for loading the Bootstrap library from jsDelivr:
723
+ <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
724
 
725
  -- End of the comment --> ',
726
  'custom-css-js'
775
  </div>
776
 
777
  <div class="code-mirror-before"><div><?php echo htmlentities( $code_mirror_before ); ?></div></div>
778
+ <textarea class="wp-editor-area" id="ccj_content" mode="<?php echo htmlentities( $code_mirror_mode ); ?>" name="content" autofocus><?php echo $post->post_content; ?></textarea>
779
  <div class="code-mirror-after"><div><?php echo htmlentities( $code_mirror_after ); ?></div></div>
780
 
781
  <table id="post-status-info"><tbody><tr>
846
  continue;
847
  }
848
 
849
+ $output .= '<h3>' . esc_attr( $a['title'] ) . '</h3>' . PHP_EOL;
850
 
851
  $output .= $this->render_input( $_key, $a, $options );
852
 
1284
  }
1285
 
1286
 
1287
+ /**
1288
+ * Compatibility with `HTML Editor Syntax Highlighter` plugin
1289
+ */
1290
+ function wp_loaded() {
1291
+ global $wp_filter;
1292
+ foreach ( $wp_filter['admin_enqueue_scripts']->callbacks[10] as $_id => $_function ) {
1293
+ if ( strstr( $_id, 'hesh_admin_enqueue_scripts' ) ) {
1294
+ unset( $wp_filter['admin_enqueue_scripts']->callbacks[10][$_id] );
1295
+ }
1296
+ }
1297
+ }
1298
+
1299
+
1300
  /**
1301
  * Render the checkboxes, radios, selects and inputs
1302
  */
1316
  }
1317
  $selected .= ( $__key == $options[ $_key ] ) ? ' checked="checked" ' : '';
1318
  $output .= '<input type="radio" ' . $selected . 'value="' . $__key . '" name="' . $name . '" id="' . $id . '">' . PHP_EOL;
1319
+ $output .= '<label class="' . $dashicons . '" for="' . $id . '"> ' . esc_attr( $__value['title'] ) . '</label><br />' . PHP_EOL;
1320
  }
1321
  $output .= '</div>' . PHP_EOL;
1322
  }
1330
  }
1331
  $output .= '<div class="radio-group">' . PHP_EOL;
1332
  $output .= '<input type="checkbox" ' . $selected . ' value="1" name="' . $name . '" id="' . $name . '">' . PHP_EOL;
1333
+ $output .= '<label class="' . $dashicons . '" for="' . $name . '"> ' . esc_attr( $a['title'] ) . '</label>';
1334
  $output .= '</div>' . PHP_EOL;
1335
  }
1336
 
1340
  $output .= '<select name="' . $name . '" id="' . $name . '">' . PHP_EOL;
1341
  foreach ( $a['values'] as $__key => $__value ) {
1342
  $selected = ( isset( $options[ $_key ] ) && $options[ $_key ] == $__key ) ? ' selected="selected"' : '';
1343
+ $output .= '<option value="' . $__key . '"' . $selected . '>' . esc_attr( $__value ) . '</option>' . PHP_EOL;
1344
  }
1345
  $output .= '</select>' . PHP_EOL;
1346
  $output .= '</div>' . PHP_EOL;
readme.txt CHANGED
@@ -4,8 +4,8 @@ Contributors: diana_burduja
4
  Email: diana@burduja.eu
5
  Tags: CSS, JS, javascript, custom CSS, custom JS, custom style, site css, add style, customize theme, custom code, external css, css3, style, styles, stylesheet, theme, editor, design, admin
6
  Requires at least: 3.0.1
7
- Tested up to: 5.8
8
- Stable tag: 3.37
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
11
  Requires PHP: 5.2.4
@@ -105,6 +105,12 @@ $. Add/Edit HTML
105
 
106
  == Changelog ==
107
 
 
 
 
 
 
 
108
  = 3.37 =
109
  * 07/12/2021
110
  * Fix: allow the TablePress plugin to load its JS files on the "Add custom code" page in admin
4
  Email: diana@burduja.eu
5
  Tags: CSS, JS, javascript, custom CSS, custom JS, custom style, site css, add style, customize theme, custom code, external css, css3, style, styles, stylesheet, theme, editor, design, admin
6
  Requires at least: 3.0.1
7
+ Tested up to: 5.9
8
+ Stable tag: 3.38
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
11
  Requires PHP: 5.2.4
105
 
106
  == Changelog ==
107
 
108
+ = 3.38 =
109
+ * 11/09/2021
110
+ * Fix: compatibility with the `HTML Editor Syntax Highlighter` plugin
111
+ * Fix: escape labels on the "Add new custom code" page
112
+ * Feature: Keep the last cursor position in the editor and let the editor get focus when the page loads
113
+
114
  = 3.37 =
115
  * 07/12/2021
116
  * Fix: allow the TablePress plugin to load its JS files on the "Add custom code" page in admin