Simple Custom CSS and JS - Version 3.31

Version Description

  • 03/21/2020
  • Feature: add "After tag" option for HTML codes, if the theme allows it
  • Feature: don't show type attribute for script and style tags if the theme adds html5 support for it
  • Code refactory
  • Fix: the permalink was mistakingly showing a ".css" file extension when being edited
Download this release

Release Info

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

Code changes from version 3.30 to 3.31

Files changed (4) hide show
  1. assets/ccj_admin.js +29 -0
  2. custom-css-js.php +248 -247
  3. includes/admin-screens.php +12 -1
  4. readme.txt +9 -1
assets/ccj_admin.js CHANGED
@@ -108,6 +108,34 @@ jQuery(document).ready( function($) {
108
  });
109
  });
110
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
111
  // Toggle the signs for activating/deactivating codes
112
  function ccj_activate_deactivate(code_id, action) {
113
  var row = $('tr#post-'+code_id);
@@ -184,6 +212,7 @@ jQuery(document).ready( function($) {
184
  code_id: $('#post_ID').val(),
185
  new_slug: new_slug,
186
  permalink: permalinkHref,
 
187
  ccj_permalink_nonce: $('#ccj-permalink-nonce').val()
188
  },
189
  function(data) {
108
  });
109
  });
110
 
111
+
112
+ // The "After <body> tag" option cannot go together with the "In Admin" option
113
+ custom_code_type_change();
114
+ $( 'input[name=custom_code_type]' ).on( 'change', custom_code_type_change );
115
+ function custom_code_type_change() {
116
+ if ( $( 'input[name=custom_code_type]:checked' ).val() === 'body_open' ) {
117
+ $( '#custom_code_side-admin' ).prop( 'disabled', true );
118
+ if ( $( 'input[name=custom_code_side]:checked' ).val() === 'admin' ) {
119
+ $( '#custom_code_side-admin' ).prop( 'checked', 'checked' );
120
+ }
121
+ } else {
122
+ $( '#custom_code_side-admin' ).prop( 'disabled', false );
123
+ }
124
+ }
125
+ custom_code_side_change();
126
+ $( 'input[name=custom_code_side]' ).on( 'change', custom_code_side_change );
127
+ function custom_code_side_change() {
128
+ if ( $( 'input[name=custom_code_side]:checked' ).val() === 'admin' ) {
129
+ $( '#custom_code_type-body_open' ).prop( 'disabled', true );
130
+ } else {
131
+ $( '#custom_code_type-body_open' ).prop( 'disabled', false );
132
+ if ( $( 'input[name=custom_code_type]:checked' ).val() === 'body_open' ) {
133
+ $( '#custom_code_type-body_open' ).prop( 'checked', true );
134
+ }
135
+ }
136
+ }
137
+
138
+
139
  // Toggle the signs for activating/deactivating codes
140
  function ccj_activate_deactivate(code_id, action) {
141
  var row = $('tr#post-'+code_id);
212
  code_id: $('#post_ID').val(),
213
  new_slug: new_slug,
214
  permalink: permalinkHref,
215
+ filetype: $('#editable-post-name-full').data('filetype'),
216
  ccj_permalink_nonce: $('#ccj-permalink-nonce').val()
217
  },
218
  function(data) {
custom-css-js.php CHANGED
@@ -1,14 +1,14 @@
1
  <?php
2
  /**
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.30
7
- * Author: SilkyPress.com
8
  * Author URI: https://www.silkypress.com
9
  * License: GPL2
10
  *
11
- * Text Domain: custom-css-js
12
  * Domain Path: /languages/
13
  *
14
  * WC requires at least: 2.3.0
@@ -16,273 +16,274 @@
16
  */
17
 
18
  if ( ! defined( 'ABSPATH' ) ) {
19
- exit; // Exit if accessed directly
20
  }
21
 
22
  if ( ! class_exists( 'CustomCSSandJS' ) ) :
23
- /**
24
- * Main CustomCSSandJS Class
25
- *
26
- * @class CustomCSSandJS
27
- */
28
- final class CustomCSSandJS {
29
-
30
- public $search_tree = false;
31
- protected static $_instance = null;
32
- private $settings = array();
33
-
34
-
35
- /**
36
- * Main CustomCSSandJS Instance
37
- *
38
- * Ensures only one instance of CustomCSSandJS is loaded or can be loaded
39
- *
40
- * @static
41
- * @return CustomCSSandJS - Main instance
42
- */
43
- public static function instance() {
44
- if ( is_null( self::$_instance ) ) {
45
- self::$_instance = new self();
46
- }
47
- return self::$_instance;
48
- }
49
-
50
- /**
51
- * Cloning is forbidden.
52
- */
53
- public function __clone() {
54
- _doing_it_wrong( __FUNCTION__, __( 'An error has occurred. Please reload the page and try again.' ), '1.0' );
55
- }
56
-
57
- /**
58
- * Unserializing instances of this class is forbidden.
59
- */
60
- public function __wakeup() {
61
- _doing_it_wrong( __FUNCTION__, __( 'An error has occurred. Please reload the page and try again.' ), '1.0' );
62
- }
63
-
64
- /**
65
- * CustomCSSandJS Constructor
66
- * @access public
67
- */
68
- public function __construct() {
69
-
70
- include_once( 'includes/admin-install.php' );
71
- register_activation_hook(__FILE__, array('CustomCSSandJS_Install', 'install'));
72
- add_action( 'init', array( 'CustomCSSandJS_Install', 'register_post_type' ) );
73
-
74
- $this->set_constants();
75
-
76
- if ( is_admin() ) {
77
- $this->load_plugin_textdomain();
78
- include_once( 'includes/admin-screens.php' );
79
- include_once( 'includes/admin-config.php' );
80
- include_once( 'includes/admin-addons.php' );
81
- include_once( 'includes/admin-warnings.php' );
82
- include_once( 'includes/admin-notices.php' );
83
- }
84
-
85
- $this->search_tree = get_option( 'custom-css-js-tree' );
86
- $this->settings = get_option('ccj_settings');
87
-
88
- if ( ! $this->search_tree || count( $this->search_tree ) == 0 ) {
89
- return false;
90
- }
91
-
92
- if ( is_null( self::$_instance ) ) {
93
- $this->print_code_actions();
94
- }
95
- }
96
-
97
- /**
98
- * Add the appropriate wp actions
99
- */
100
- function print_code_actions() {
101
- foreach( $this->search_tree as $_key => $_value ) {
102
- $action = 'wp_';
103
- if ( strpos( $_key, 'admin' ) !== false ) {
104
- $action = 'admin_';
105
- }
106
- if ( strpos( $_key, 'login' ) !== false ) {
107
- $action = 'login_';
108
- }
109
- if ( strpos( $_key, 'header' ) !== false ) {
110
- $action .= 'head';
111
- } else {
112
- $action .= 'footer';
113
- }
114
-
115
- $priority = ( $action == 'wp_footer' ) ? 40 : 10;
116
-
117
- add_action( $action, array( $this, 'print_' . $_key ), $priority );
118
- }
119
- }
120
-
121
- /**
122
- * Print the custom code.
123
- */
124
- public function __call( $function, $args ) {
125
-
126
-
127
- if ( strpos( $function, 'print_' ) === false ) {
128
- return false;
129
- }
130
-
131
- $function = str_replace( 'print_', '', $function );
132
-
133
- if ( ! isset( $this->search_tree[ $function ] ) ) {
134
- return false;
135
- }
136
-
137
- $args = $this->search_tree[ $function ];
138
-
139
- if ( ! is_array( $args ) || count( $args ) == 0 ) {
140
- return false;
141
- }
142
-
143
- // print the `internal` code
144
- if ( strpos( $function, 'internal' ) !== false ) {
145
- if ( isset($this->settings['remove_comments']) && $this->settings['remove_comments'] ) {
146
- $before = '';
147
- $after = '';
148
- } else {
149
- $before = '<!-- start Simple Custom CSS and JS -->' . PHP_EOL;
150
- $after = '<!-- end Simple Custom CSS and JS -->' . PHP_EOL;
151
- }
152
- if ( strpos( $function, 'css' ) !== false ) {
153
- $before .= '<style type="text/css">' . PHP_EOL;
154
- $after = '</style>' . PHP_EOL . $after;
155
- }
156
- if ( strpos( $function, 'js' ) !== false ) {
157
- $before .= '<script type="text/javascript">' . PHP_EOL;
158
- $after = '</script>' . PHP_EOL . $after;
159
- }
160
-
161
-
162
- foreach( $args as $_post_id ) {
163
- if ( strstr( $_post_id, 'css' ) || strstr( $_post_id, 'js' ) ) {
164
- if ( isset($this->settings['remove_comments']) && $this->settings['remove_comments'] ) {
165
- ob_start();
166
- @include_once( CCJ_UPLOAD_DIR . '/' . $_post_id );
167
- $custom_code = ob_get_clean();
168
- $custom_code = str_replace(array('<!-- start Simple Custom CSS and JS -->' . PHP_EOL, '<!-- end Simple Custom CSS and JS -->' . PHP_EOL), '', $custom_code);
169
- echo $custom_code;
170
- } else {
171
- @include_once( CCJ_UPLOAD_DIR . '/' . $_post_id );
172
- }
173
- } else {
174
- $post = get_post( $_post_id );
175
- echo $before . $post->post_content . $after;
176
- }
177
- }
178
- }
179
-
180
- // link the `external` code
181
- if ( strpos( $function, 'external' ) !== false) {
182
- $in_footer = false;
183
- if ( strpos( $function, 'footer' ) !== false ) {
184
- $in_footer = true;
185
- }
186
-
187
- $upload_url = str_replace(array('https://', 'http://'), '//', CCJ_UPLOAD_URL) . '/';
188
-
189
- if ( strpos( $function, 'js' ) !== false ) {
190
- foreach( $args as $_filename ) {
191
- echo PHP_EOL . "<script type='text/javascript' src='".$upload_url . $_filename."'></script>" . PHP_EOL;
192
- }
193
- }
194
-
195
- if ( strpos( $function, 'css' ) !== false ) {
196
- foreach( $args as $_filename ) {
197
- $shortfilename = preg_replace( '@\.css\?v=.*$@', '', $_filename );
198
- echo PHP_EOL . "<link rel='stylesheet' id='".$shortfilename ."-css' href='".$upload_url . $_filename."' type='text/css' media='all' />" . PHP_EOL;
199
- }
200
- }
201
- }
202
-
203
- // link the HTML code
204
- if ( strpos( $function, 'html' ) !== false ) {
205
- foreach( $args as $_post_id ) {
206
- $_post_id = str_replace('.html', '', $_post_id);
207
- $post = get_post( $_post_id );
208
- echo $post->post_content . PHP_EOL;
209
- }
210
-
211
- }
212
- }
213
-
214
-
215
- /**
216
- * Set constants for later use
217
- */
218
- function set_constants() {
219
- $dir = wp_upload_dir();
220
- $constants = array(
221
- 'CCJ_VERSION' => '3.30',
222
- 'CCJ_UPLOAD_DIR' => $dir['basedir'] . '/custom-css-js',
223
- 'CCJ_UPLOAD_URL' => $dir['baseurl'] . '/custom-css-js',
224
- 'CCJ_PLUGIN_FILE' => __FILE__,
225
- );
226
- foreach( $constants as $_key => $_value ) {
227
- if (!defined($_key)) {
228
- define( $_key, $_value );
229
- }
230
- }
231
- }
232
-
233
-
234
- public function load_plugin_textdomain() {
235
- load_plugin_textdomain( 'custom-css-js', false, plugin_basename( dirname( __FILE__ ) ) . '/languages' );
236
- }
 
237
 
238
- }
239
 
240
- endif;
241
 
242
  /**
243
- * Returns the main instance of CustomCSSandJS
244
  *
245
- * @return CustomCSSandJS
246
  */
247
- if ( ! function_exists('CustomCSSandJS' ) ) {
248
- function CustomCSSandJS() {
249
- return CustomCSSandJS::instance();
250
- }
251
 
252
- CustomCSSandJS();
253
  }
254
 
255
 
256
  /**
257
  * Plugin action link to Settings page
258
  */
259
- if ( ! function_exists('custom_css_js_plugin_action_links') ) {
260
- function custom_css_js_plugin_action_links( $links ) {
261
 
262
- $settings_link = '<a href="edit.php?post_type=custom-css-js">' .
263
- esc_html( __('Settings', 'custom-css-js' ) ) . '</a>';
264
 
265
- return array_merge( array( $settings_link), $links );
266
-
267
- }
268
- add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), 'custom_css_js_plugin_action_links' );
269
  }
270
 
271
 
272
 
273
  /**
274
- * Compatibility with the WP Quads Pro plugin,
275
- * otherwise on a Custom Code save there is a
276
  * "The link you followed has expired." page shown.
277
  */
278
- if ( ! function_exists('custom_css_js_quads_pro_compat') ) {
279
- function custom_css_js_quads_pro_compat( $post_types ) {
280
- $match = array_search('custom-css-js', $post_types);
281
- if ( $match ) {
282
- unset($post_types[$match]);
283
- }
284
- return $post_types;
285
- }
286
- add_filter('quads_meta_box_post_types', 'custom_css_js_quads_pro_compat', 20);
287
  }
288
 
1
  <?php
2
  /**
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.31
7
+ * Author: SilkyPress.com
8
  * Author URI: https://www.silkypress.com
9
  * License: GPL2
10
  *
11
+ * Text Domain: custom-css-js
12
  * Domain Path: /languages/
13
  *
14
  * WC requires at least: 2.3.0
16
  */
17
 
18
  if ( ! defined( 'ABSPATH' ) ) {
19
+ exit; // Exit if accessed directly
20
  }
21
 
22
  if ( ! class_exists( 'CustomCSSandJS' ) ) :
23
+ /**
24
+ * Main CustomCSSandJS Class
25
+ *
26
+ * @class CustomCSSandJS
27
+ */
28
+ final class CustomCSSandJS {
29
+
30
+ public $search_tree = false;
31
+ protected static $_instance = null;
32
+ private $settings = array();
33
+
34
+
35
+ /**
36
+ * Main CustomCSSandJS Instance
37
+ *
38
+ * Ensures only one instance of CustomCSSandJS is loaded or can be loaded
39
+ *
40
+ * @static
41
+ * @return CustomCSSandJS - Main instance
42
+ */
43
+ public static function instance() {
44
+ if ( is_null( self::$_instance ) ) {
45
+ self::$_instance = new self();
46
+ }
47
+ return self::$_instance;
48
+ }
49
+
50
+ /**
51
+ * Cloning is forbidden.
52
+ */
53
+ public function __clone() {
54
+ _doing_it_wrong( __FUNCTION__, __( 'An error has occurred. Please reload the page and try again.' ), '1.0' );
55
+ }
56
+
57
+ /**
58
+ * Unserializing instances of this class is forbidden.
59
+ */
60
+ public function __wakeup() {
61
+ _doing_it_wrong( __FUNCTION__, __( 'An error has occurred. Please reload the page and try again.' ), '1.0' );
62
+ }
63
+
64
+ /**
65
+ * CustomCSSandJS Constructor
66
+ *
67
+ * @access public
68
+ */
69
+ public function __construct() {
70
+
71
+ include_once 'includes/admin-install.php';
72
+ register_activation_hook( __FILE__, array( 'CustomCSSandJS_Install', 'install' ) );
73
+ add_action( 'init', array( 'CustomCSSandJS_Install', 'register_post_type' ) );
74
+
75
+ $this->set_constants();
76
+
77
+ if ( is_admin() ) {
78
+ $this->load_plugin_textdomain();
79
+ include_once 'includes/admin-screens.php';
80
+ include_once 'includes/admin-config.php';
81
+ include_once 'includes/admin-addons.php';
82
+ include_once 'includes/admin-warnings.php';
83
+ include_once 'includes/admin-notices.php';
84
+ }
85
+
86
+ $this->search_tree = get_option( 'custom-css-js-tree' );
87
+ $this->settings = get_option( 'ccj_settings' );
88
+ if ( ! isset( $this->settings['remove_comments'] ) ) {
89
+ $this->settings['remove_comments'] = false;
90
+ }
91
+
92
+ if ( ! $this->search_tree || count( $this->search_tree ) == 0 ) {
93
+ return false;
94
+ }
95
+
96
+ if ( is_null( self::$_instance ) ) {
97
+ $this->print_code_actions();
98
+ }
99
+ }
100
+
101
+ /**
102
+ * Add the appropriate wp actions
103
+ */
104
+ function print_code_actions() {
105
+ foreach ( $this->search_tree as $_key => $_value ) {
106
+ $action = 'wp_';
107
+ if ( strpos( $_key, 'admin' ) !== false ) {
108
+ $action = 'admin_';
109
+ }
110
+ if ( strpos( $_key, 'login' ) !== false ) {
111
+ $action = 'login_';
112
+ }
113
+ if ( strpos( $_key, 'header' ) !== false ) {
114
+ $action .= 'head';
115
+ } elseif ( strpos( $_key, 'body_open' ) !== false ) {
116
+ $action .= 'body_open';
117
+ } else {
118
+ $action .= 'footer';
119
+ }
120
+
121
+ $priority = ( $action == 'wp_footer' ) ? 40 : 10;
122
+
123
+ add_action( $action, array( $this, 'print_' . $_key ), $priority );
124
+ }
125
+ }
126
+
127
+ /**
128
+ * Print the custom code.
129
+ */
130
+ public function __call( $function, $args ) {
131
+
132
+ if ( strpos( $function, 'print_' ) === false ) {
133
+ return false;
134
+ }
135
+
136
+ $function = str_replace( 'print_', '', $function );
137
+
138
+ if ( ! isset( $this->search_tree[ $function ] ) ) {
139
+ return false;
140
+ }
141
+
142
+ $args = $this->search_tree[ $function ];
143
+
144
+ if ( ! is_array( $args ) || count( $args ) == 0 ) {
145
+ return false;
146
+ }
147
+
148
+ $where = strpos( $function, 'external' ) !== false ? 'external' : 'internal';
149
+ $type = strpos( $function, 'css' ) !== false ? 'css' : '';
150
+ $type = strpos( $function, 'js' ) !== false ? 'js' : $type;
151
+ $type = strpos( $function, 'html' ) !== false ? 'html' : $type;
152
+ $tag = array( 'css' => 'style', 'js' => 'script' );
153
+
154
+ $type_attr = ( $type === 'js' && ! current_theme_supports( 'html5', 'script' ) ) ? ' type="text/javascript"' : '';
155
+ $type_attr = ( $type === 'css' && ! current_theme_supports( 'html5', 'style' ) ) ? ' type="text/css"' : $type_attr;
156
+
157
+ $upload_url = str_replace( array( 'https://', 'http://' ), '//', CCJ_UPLOAD_URL ) . '/';
158
+
159
+ if ( $where === 'internal' ) {
160
+
161
+ $before = $this->settings['remove_comments'] ? '' : '<!-- start Simple Custom CSS and JS -->' . PHP_EOL;
162
+ $after = $this->settings['remove_comments'] ? '' : '<!-- end Simple Custom CSS and JS -->' . PHP_EOL;
163
+
164
+ if ( $type === 'css' || $type === 'js' ) {
165
+ $before .= '<' . $tag[ $type ] . ' ' . $type_attr . '>' . PHP_EOL;
166
+ $after = '</' . $tag[ $type ] . '>' . PHP_EOL . $after;
167
+ }
168
+
169
+ }
170
+
171
+ foreach ( $args as $_filename ) {
172
+
173
+ if ( $where === 'internal' && ( strstr( $_filename, 'css' ) || strstr( $_filename, 'js' ) ) ) {
174
+ if ( $this->settings['remove_comments'] || empty( $type_attr ) ) {
175
+ ob_start();
176
+ @include_once CCJ_UPLOAD_DIR . '/' . $_filename;
177
+ $custom_code = ob_get_clean();
178
+ if ( $this->settings['remove_comments'] ) {
179
+ $custom_code = str_replace( array(
180
+ '<!-- start Simple Custom CSS and JS -->' . PHP_EOL,
181
+ '<!-- end Simple Custom CSS and JS -->' . PHP_EOL
182
+ ), '', $custom_code );
183
+ }
184
+ if ( empty( $type_attr ) ) {
185
+ $custom_code = str_replace( array( ' type="text/javascript"', ' type="text/css"' ), '', $custom_code );
186
+ }
187
+ echo $custom_code;
188
+ } else {
189
+ @include_once CCJ_UPLOAD_DIR . '/' . $_filename;
190
+ }
191
+ }
192
+
193
+ if ( $where === 'internal' && ! strstr( $_filename, 'css' ) && ! strstr( $_filename, 'js' ) ) {
194
+ $post = get_post( $_filename );
195
+ echo $before . $post->post_content . $after;
196
+ }
197
+
198
+ if ( $where === 'external' && $type === 'js' ) {
199
+ echo PHP_EOL . "<script{$type_attr} src='{$upload_url}{$_filename}'></script>" . PHP_EOL;
200
+ }
201
+
202
+ if ( $where === 'external' && $type === 'css' ) {
203
+ $shortfilename = preg_replace( '@\.css\?v=.*$@', '', $_filename );
204
+ echo PHP_EOL . "<link rel='stylesheet' id='{$shortfilename}-css' href='{$upload_url}{$_filename}'{$type_attr} media='all' />" . PHP_EOL;
205
+ }
206
+
207
+ if ( $where === 'external' && $type === 'html' ) {
208
+ $_filename = str_replace( '.html', '', $_filename );
209
+ $post = get_post( $_filename );
210
+ echo $post->post_content . PHP_EOL;
211
+ }
212
+ }
213
+ }
214
+
215
+
216
+ /**
217
+ * Set constants for later use
218
+ */
219
+ function set_constants() {
220
+ $dir = wp_upload_dir();
221
+ $constants = array(
222
+ 'CCJ_VERSION' => '3.31',
223
+ 'CCJ_UPLOAD_DIR' => $dir['basedir'] . '/custom-css-js',
224
+ 'CCJ_UPLOAD_URL' => $dir['baseurl'] . '/custom-css-js',
225
+ 'CCJ_PLUGIN_FILE' => __FILE__,
226
+ );
227
+ foreach ( $constants as $_key => $_value ) {
228
+ if ( ! defined( $_key ) ) {
229
+ define( $_key, $_value );
230
+ }
231
+ }
232
+ }
233
+
234
+
235
+ public function load_plugin_textdomain() {
236
+ load_plugin_textdomain( 'custom-css-js', false, plugin_basename( dirname( __FILE__ ) ) . '/languages' );
237
+ }
238
 
239
+ }
240
 
241
+ endif;
242
 
243
  /**
244
+ * Returns the main instance of CustomCSSandJS
245
  *
246
+ * @return CustomCSSandJS
247
  */
248
+ if ( ! function_exists( 'CustomCSSandJS' ) ) {
249
+ function CustomCSSandJS() {
250
+ return CustomCSSandJS::instance();
251
+ }
252
 
253
+ CustomCSSandJS();
254
  }
255
 
256
 
257
  /**
258
  * Plugin action link to Settings page
259
  */
260
+ if ( ! function_exists( 'custom_css_js_plugin_action_links' ) ) {
261
+ function custom_css_js_plugin_action_links( $links ) {
262
 
263
+ $settings_link = '<a href="edit.php?post_type=custom-css-js">' .
264
+ esc_html( __( 'Settings', 'custom-css-js' ) ) . '</a>';
265
 
266
+ return array_merge( array( $settings_link ), $links );
267
+
268
+ }
269
+ add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), 'custom_css_js_plugin_action_links' );
270
  }
271
 
272
 
273
 
274
  /**
275
+ * Compatibility with the WP Quads Pro plugin,
276
+ * otherwise on a Custom Code save there is a
277
  * "The link you followed has expired." page shown.
278
  */
279
+ if ( ! function_exists( 'custom_css_js_quads_pro_compat' ) ) {
280
+ function custom_css_js_quads_pro_compat( $post_types ) {
281
+ $match = array_search( 'custom-css-js', $post_types );
282
+ if ( $match ) {
283
+ unset( $post_types[ $match ] );
284
+ }
285
+ return $post_types;
286
+ }
287
+ add_filter( 'quads_meta_box_post_types', 'custom_css_js_quads_pro_compat', 20 );
288
  }
289
 
includes/admin-screens.php CHANGED
@@ -962,6 +962,17 @@ End of comment */ ',
962
 
963
  );
964
 
 
 
 
 
 
 
 
 
 
 
 
965
  return $options;
966
  }
967
 
@@ -1338,7 +1349,7 @@ endif;
1338
  <strong>Permalink:</strong>
1339
  <span id="sample-permalink"><a href="<?php echo esc_url( $permalink ); ?>"><?php echo esc_html( CCJ_UPLOAD_URL ) . '/'; ?><span id="editable-post-name"><?php echo esc_html( $filename ); ?></span>.<?php echo esc_html( $filetype ); ?></a></span>
1340
  &lrm;<span id="ccj-edit-slug-buttons"><button type="button" class="ccj-edit-slug button button-small hide-if-no-js" aria-label="Edit permalink">Edit</button></span>
1341
- <span id="editable-post-name-full"><?php echo esc_html( $filename ); ?></span>
1342
  </div>
1343
  <?php wp_nonce_field( 'ccj-permalink', 'ccj-permalink-nonce' ); ?>
1344
  </div>
962
 
963
  );
964
 
965
+ if ( function_exists( 'wp_body_open' ) ) {
966
+ $tmp = $options['type']['values'];
967
+ unset( $options['type']['values'] );
968
+ $options['type']['values']['header'] = $tmp['header'];
969
+ $options['type']['values']['body_open'] = array(
970
+ 'title' => __( 'After &lt;body&gt; tag', 'custom-css-js' ),
971
+ 'dashicon' => 'editor-code',
972
+ );
973
+ $options['type']['values']['footer'] = $tmp['footer'];
974
+ }
975
+
976
  return $options;
977
  }
978
 
1349
  <strong>Permalink:</strong>
1350
  <span id="sample-permalink"><a href="<?php echo esc_url( $permalink ); ?>"><?php echo esc_html( CCJ_UPLOAD_URL ) . '/'; ?><span id="editable-post-name"><?php echo esc_html( $filename ); ?></span>.<?php echo esc_html( $filetype ); ?></a></span>
1351
  &lrm;<span id="ccj-edit-slug-buttons"><button type="button" class="ccj-edit-slug button button-small hide-if-no-js" aria-label="Edit permalink">Edit</button></span>
1352
+ <span id="editable-post-name-full" data-filetype="<?php echo $filetype; ?>"><?php echo esc_html( $filename ); ?></span>
1353
  </div>
1354
  <?php wp_nonce_field( 'ccj-permalink', 'ccj-permalink-nonce' ); ?>
1355
  </div>
readme.txt CHANGED
@@ -5,7 +5,7 @@ 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.4
8
- Stable tag: 3.30
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
11
  Requires PHP: 5.2.4
@@ -105,6 +105,14 @@ $. Add/Edit HTML
105
 
106
  == Changelog ==
107
 
 
 
 
 
 
 
 
 
108
  = 3.30 =
109
  * 03/12/2020
110
  * Feature: color the matching brackets in the editor
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.4
8
+ Stable tag: 3.31
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
+
109
+ = 3.31 =
110
+ * 03/21/2020
111
+ * Feature: add "After <body> tag" option for HTML codes, if the theme allows it
112
+ * Feature: don't show type attribute for script and style tags if the theme adds html5 support for it
113
+ * Code refactory
114
+ * Fix: the permalink was mistakingly showing a ".css" file extension when being edited
115
+
116
  = 3.30 =
117
  * 03/12/2020
118
  * Feature: color the matching brackets in the editor