Version Description
- 08/02/2020
- Fix: add "Cmd + " editor shortcuts for MacOS computers
Download this release
Release Info
Developer | diana_burduja |
Plugin | Simple Custom CSS and JS |
Version | 3.32.3 |
Comparing to | |
See all releases |
Code changes from version 3.32.2 to 3.32.3
- assets/ccj_admin.js +4 -2
- custom-css-js.php +3 -3
- includes/admin-notices.php +2 -1
- includes/admin-screens.php +20 -18
- readme.txt +5 -1
assets/ccj_admin.js
CHANGED
@@ -19,9 +19,11 @@ jQuery(document).ready( function($) {
|
|
19 |
autoCloseBrackets: true,
|
20 |
extraKeys: {
|
21 |
"Ctrl-Space": "autocomplete",
|
|
|
22 |
"Ctrl-F": "findPersistent",
|
23 |
-
|
24 |
-
|
|
|
25 |
},
|
26 |
};
|
27 |
|
19 |
autoCloseBrackets: true,
|
20 |
extraKeys: {
|
21 |
"Ctrl-Space": "autocomplete",
|
22 |
+
"Cmd-Space": "autocomplete",
|
23 |
"Ctrl-F": "findPersistent",
|
24 |
+
"Cmd-F": "findPersistent",
|
25 |
+
"Ctrl-/": "toggleComment",
|
26 |
+
"Cmd-/": "toggleComment",
|
27 |
},
|
28 |
};
|
29 |
|
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.32.
|
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: 2.3.0
|
15 |
-
* WC tested up to:
|
16 |
*/
|
17 |
|
18 |
if ( ! defined( 'ABSPATH' ) ) {
|
@@ -217,7 +217,7 @@ if ( ! class_exists( 'CustomCSSandJS' ) ) :
|
|
217 |
function set_constants() {
|
218 |
$dir = wp_upload_dir();
|
219 |
$constants = array(
|
220 |
-
'CCJ_VERSION' => '3.32.
|
221 |
'CCJ_UPLOAD_DIR' => $dir['basedir'] . '/custom-css-js',
|
222 |
'CCJ_UPLOAD_URL' => $dir['baseurl'] . '/custom-css-js',
|
223 |
'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.32.3
|
7 |
* Author: SilkyPress.com
|
8 |
* Author URI: https://www.silkypress.com
|
9 |
* License: GPL2
|
12 |
* Domain Path: /languages/
|
13 |
*
|
14 |
* WC requires at least: 2.3.0
|
15 |
+
* WC tested up to: 5.0
|
16 |
*/
|
17 |
|
18 |
if ( ! defined( 'ABSPATH' ) ) {
|
217 |
function set_constants() {
|
218 |
$dir = wp_upload_dir();
|
219 |
$constants = array(
|
220 |
+
'CCJ_VERSION' => '3.32.3',
|
221 |
'CCJ_UPLOAD_DIR' => $dir['basedir'] . '/custom-css-js',
|
222 |
'CCJ_UPLOAD_URL' => $dir['baseurl'] . '/custom-css-js',
|
223 |
'CCJ_PLUGIN_FILE' => __FILE__,
|
includes/admin-notices.php
CHANGED
@@ -83,7 +83,7 @@ class CustomCSSandJS_Notices {
|
|
83 |
public function choose_notice() {
|
84 |
$now = time();
|
85 |
|
86 |
-
$days_passed =
|
87 |
|
88 |
switch ( $days_passed ) {
|
89 |
case 0 : return '1_day';
|
@@ -98,6 +98,7 @@ class CustomCSSandJS_Notices {
|
|
98 |
case 9 : break;
|
99 |
case 10 : break;
|
100 |
case 11 : break; //return '12_day';
|
|
|
101 |
}
|
102 |
}
|
103 |
|
83 |
public function choose_notice() {
|
84 |
$now = time();
|
85 |
|
86 |
+
$days_passed = floor( ( $now - $this->activation_time ) / 86400 );
|
87 |
|
88 |
switch ( $days_passed ) {
|
89 |
case 0 : return '1_day';
|
98 |
case 9 : break;
|
99 |
case 10 : break;
|
100 |
case 11 : break; //return '12_day';
|
101 |
+
default: break;
|
102 |
}
|
103 |
}
|
104 |
|
includes/admin-screens.php
CHANGED
@@ -156,7 +156,6 @@ class CustomCSSandJS_Admin {
|
|
156 |
wp_enqueue_style( 'cm-dialog', $cma . 'dialog/dialog.css', array(), $v );
|
157 |
wp_enqueue_script( 'ccj-comment', $cma . 'comment/comment.js', array( 'ccj-codemirror' ), $v, false );
|
158 |
|
159 |
-
|
160 |
// Hint Addons
|
161 |
wp_enqueue_script( 'ccj-hint', $cma . 'hint/show-hint.js', array( 'ccj-codemirror' ), $v, false );
|
162 |
wp_enqueue_script( 'ccj-hint-js', $cma . 'hint/javascript-hint.js', array( 'ccj-codemirror' ), $v, false );
|
@@ -166,8 +165,6 @@ class CustomCSSandJS_Admin {
|
|
166 |
wp_enqueue_script( 'ccj-hint-anyword', $cma . 'hint/anyword-hint.js', array( 'ccj-codemirror' ), $v, false );
|
167 |
wp_enqueue_style( 'ccj-hint', $cma . 'hint/show-hint.css', array(), $v );
|
168 |
|
169 |
-
|
170 |
-
|
171 |
// remove the assets from other plugins so it doesn't interfere with CodeMirror
|
172 |
global $wp_scripts;
|
173 |
if ( is_array( $wp_scripts->registered ) && count( $wp_scripts->registered ) != 0 ) {
|
@@ -179,6 +176,7 @@ class CustomCSSandJS_Admin {
|
|
179 |
if ( strstr( $_value->src, 'wp-content/plugins' ) !== false
|
180 |
&& strstr( $_value->src, 'plugins/custom-css-js/assets' ) === false
|
181 |
&& strstr( $_value->src, 'plugins/advanced-custom-fields/' ) === false
|
|
|
182 |
&& strstr( $_value->src, 'plugins/advanced-custom-fields-pro/' ) === false ) {
|
183 |
unset( $wp_scripts->registered[ $_key ] );
|
184 |
}
|
@@ -350,8 +348,8 @@ class CustomCSSandJS_Admin {
|
|
350 |
* Make the 'Modified' column sortable
|
351 |
*/
|
352 |
function manage_edit_posts_sortable_columns( $columns ) {
|
353 |
-
$columns['active']
|
354 |
-
$columns['type']
|
355 |
$columns['modified'] = 'modified';
|
356 |
$columns['published'] = 'published';
|
357 |
return $columns;
|
@@ -379,10 +377,11 @@ class CustomCSSandJS_Admin {
|
|
379 |
if ( ! is_string( $filter ) || strlen( $filter ) == 0 ) {
|
380 |
return $query;
|
381 |
}
|
|
|
382 |
|
383 |
global $wpdb;
|
384 |
$post_id_query = "SELECT post_id FROM {$wpdb->postmeta} WHERE meta_key = %s AND meta_value LIKE %s";
|
385 |
-
$post_ids = $wpdb->get_col( $wpdb->prepare( $post_id_query, 'options',
|
386 |
if ( ! is_array( $post_ids ) || count( $post_ids ) == 0 ) {
|
387 |
$post_ids = array( -1 );
|
388 |
}
|
@@ -419,7 +418,6 @@ class CustomCSSandJS_Admin {
|
|
419 |
|
420 |
/**
|
421 |
* Order table by Type and Active columns
|
422 |
-
*
|
423 |
*/
|
424 |
function posts_orderby( $orderby, $query ) {
|
425 |
if ( ! is_admin() ) {
|
@@ -490,16 +488,13 @@ class CustomCSSandJS_Admin {
|
|
490 |
|
491 |
if ( 'custom-css-js' === get_post_type( $code_id ) ) {
|
492 |
$active = get_post_meta( $code_id, '_active', true );
|
493 |
-
|
494 |
-
$active = 'yes';
|
495 |
-
}
|
496 |
-
$response = $active;
|
497 |
-
update_post_meta( $code_id, '_active', $active === 'yes' ? 'no' : 'yes' );
|
498 |
|
|
|
499 |
$this->build_search_tree();
|
500 |
}
|
501 |
}
|
502 |
-
echo $
|
503 |
|
504 |
die();
|
505 |
}
|
@@ -1101,9 +1096,11 @@ End of comment */ ',
|
|
1101 |
}
|
1102 |
|
1103 |
foreach ( $defaults as $_field => $_default ) {
|
1104 |
-
$options[ $_field ] = isset( $_POST[ 'custom_code_' . $_field ] ) ? esc_attr( $_POST[ 'custom_code_' . $_field ] ) : $_default;
|
1105 |
}
|
1106 |
|
|
|
|
|
1107 |
update_post_meta( $post_id, 'options', $options );
|
1108 |
|
1109 |
if ( $options['language'] == 'html' ) {
|
@@ -1147,7 +1144,7 @@ End of comment */ ',
|
|
1147 |
$before = '/******* Do not edit this file *******' . PHP_EOL .
|
1148 |
'Simple Custom CSS and JS - by Silkypress.com' . PHP_EOL .
|
1149 |
'Saved: ' . date( 'M d Y | H:i:s' ) . ' */' . PHP_EOL;
|
1150 |
-
$after
|
1151 |
}
|
1152 |
|
1153 |
if ( wp_is_writable( CCJ_UPLOAD_DIR ) ) {
|
@@ -1158,7 +1155,7 @@ End of comment */ ',
|
|
1158 |
// save the file as the Permalink slug
|
1159 |
$slug = get_post_meta( $post_id, '_slug', true );
|
1160 |
if ( $slug ) {
|
1161 |
-
@file_put_contents( CCJ_UPLOAD_DIR . '/' . $slug . '.' . $options['language'], $file_content );
|
1162 |
}
|
1163 |
}
|
1164 |
|
@@ -1510,8 +1507,13 @@ endif;
|
|
1510 |
return;
|
1511 |
}
|
1512 |
|
1513 |
-
$options
|
1514 |
-
$
|
|
|
|
|
|
|
|
|
|
|
1515 |
$file_name = $postid . '.' . $options['language'];
|
1516 |
|
1517 |
@unlink( CCJ_UPLOAD_DIR . '/' . $file_name );
|
156 |
wp_enqueue_style( 'cm-dialog', $cma . 'dialog/dialog.css', array(), $v );
|
157 |
wp_enqueue_script( 'ccj-comment', $cma . 'comment/comment.js', array( 'ccj-codemirror' ), $v, false );
|
158 |
|
|
|
159 |
// Hint Addons
|
160 |
wp_enqueue_script( 'ccj-hint', $cma . 'hint/show-hint.js', array( 'ccj-codemirror' ), $v, false );
|
161 |
wp_enqueue_script( 'ccj-hint-js', $cma . 'hint/javascript-hint.js', array( 'ccj-codemirror' ), $v, false );
|
165 |
wp_enqueue_script( 'ccj-hint-anyword', $cma . 'hint/anyword-hint.js', array( 'ccj-codemirror' ), $v, false );
|
166 |
wp_enqueue_style( 'ccj-hint', $cma . 'hint/show-hint.css', array(), $v );
|
167 |
|
|
|
|
|
168 |
// remove the assets from other plugins so it doesn't interfere with CodeMirror
|
169 |
global $wp_scripts;
|
170 |
if ( is_array( $wp_scripts->registered ) && count( $wp_scripts->registered ) != 0 ) {
|
176 |
if ( strstr( $_value->src, 'wp-content/plugins' ) !== false
|
177 |
&& strstr( $_value->src, 'plugins/custom-css-js/assets' ) === false
|
178 |
&& strstr( $_value->src, 'plugins/advanced-custom-fields/' ) === false
|
179 |
+
&& strstr( $_value->src, 'plugins/wp-jquery-update-test/' ) === false
|
180 |
&& strstr( $_value->src, 'plugins/advanced-custom-fields-pro/' ) === false ) {
|
181 |
unset( $wp_scripts->registered[ $_key ] );
|
182 |
}
|
348 |
* Make the 'Modified' column sortable
|
349 |
*/
|
350 |
function manage_edit_posts_sortable_columns( $columns ) {
|
351 |
+
$columns['active'] = 'active';
|
352 |
+
$columns['type'] = 'type';
|
353 |
$columns['modified'] = 'modified';
|
354 |
$columns['published'] = 'published';
|
355 |
return $columns;
|
377 |
if ( ! is_string( $filter ) || strlen( $filter ) == 0 ) {
|
378 |
return $query;
|
379 |
}
|
380 |
+
$filter = '%' . $wpdb->esc_like( $filter ) . '%';
|
381 |
|
382 |
global $wpdb;
|
383 |
$post_id_query = "SELECT post_id FROM {$wpdb->postmeta} WHERE meta_key = %s AND meta_value LIKE %s";
|
384 |
+
$post_ids = $wpdb->get_col( $wpdb->prepare( $post_id_query, 'options', $filter ) );
|
385 |
if ( ! is_array( $post_ids ) || count( $post_ids ) == 0 ) {
|
386 |
$post_ids = array( -1 );
|
387 |
}
|
418 |
|
419 |
/**
|
420 |
* Order table by Type and Active columns
|
|
|
421 |
*/
|
422 |
function posts_orderby( $orderby, $query ) {
|
423 |
if ( ! is_admin() ) {
|
488 |
|
489 |
if ( 'custom-css-js' === get_post_type( $code_id ) ) {
|
490 |
$active = get_post_meta( $code_id, '_active', true );
|
491 |
+
$active = ( $active !== 'no' ) ? $active = 'yes' : 'no';
|
|
|
|
|
|
|
|
|
492 |
|
493 |
+
update_post_meta( $code_id, '_active', $active === 'yes' ? 'no' : 'yes' );
|
494 |
$this->build_search_tree();
|
495 |
}
|
496 |
}
|
497 |
+
echo $active;
|
498 |
|
499 |
die();
|
500 |
}
|
1096 |
}
|
1097 |
|
1098 |
foreach ( $defaults as $_field => $_default ) {
|
1099 |
+
$options[ $_field ] = isset( $_POST[ 'custom_code_' . $_field ] ) ? esc_attr( strtolower( $_POST[ 'custom_code_' . $_field ] ) ) : $_default;
|
1100 |
}
|
1101 |
|
1102 |
+
$options['custom_code_language'] = in_array( $options['custom_code_language'], array( 'html', 'css', 'js' ), true ) ? $options['custom_code_language'] : $defaults['language'];
|
1103 |
+
|
1104 |
update_post_meta( $post_id, 'options', $options );
|
1105 |
|
1106 |
if ( $options['language'] == 'html' ) {
|
1144 |
$before = '/******* Do not edit this file *******' . PHP_EOL .
|
1145 |
'Simple Custom CSS and JS - by Silkypress.com' . PHP_EOL .
|
1146 |
'Saved: ' . date( 'M d Y | H:i:s' ) . ' */' . PHP_EOL;
|
1147 |
+
$after = '';
|
1148 |
}
|
1149 |
|
1150 |
if ( wp_is_writable( CCJ_UPLOAD_DIR ) ) {
|
1155 |
// save the file as the Permalink slug
|
1156 |
$slug = get_post_meta( $post_id, '_slug', true );
|
1157 |
if ( $slug ) {
|
1158 |
+
@file_put_contents( CCJ_UPLOAD_DIR . '/' . sanitize_file_name( $slug ) . '.' . $options['language'], $file_content );
|
1159 |
}
|
1160 |
}
|
1161 |
|
1507 |
return;
|
1508 |
}
|
1509 |
|
1510 |
+
$options = get_post_meta( $postid, 'options', true );
|
1511 |
+
$options['language'] = strtolower( $options['language'] );
|
1512 |
+
$options['language'] = in_array( $options['language'], array( 'html', 'js', 'css' ), true ) ? $options['language'] : 'css';
|
1513 |
+
|
1514 |
+
$slug = get_post_meta( $postid, '_slug', true );
|
1515 |
+
$slug = sanitize_file_name( $slug );
|
1516 |
+
|
1517 |
$file_name = $postid . '.' . $options['language'];
|
1518 |
|
1519 |
@unlink( CCJ_UPLOAD_DIR . '/' . $file_name );
|
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.5
|
8 |
-
Stable tag: 3.32.
|
9 |
License: GPLv3
|
10 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
11 |
Requires PHP: 5.2.4
|
@@ -105,6 +105,10 @@ $. Add/Edit HTML
|
|
105 |
|
106 |
== Changelog ==
|
107 |
|
|
|
|
|
|
|
|
|
108 |
= 3.32.2 =
|
109 |
* 07/14/2020
|
110 |
* Fix: use file_get_contents instead of include_once to load the custom codes
|
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.5
|
8 |
+
Stable tag: 3.32.3
|
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.32.3 =
|
109 |
+
* 08/02/2020
|
110 |
+
* Fix: add "Cmd + " editor shortcuts for MacOS computers
|
111 |
+
|
112 |
= 3.32.2 =
|
113 |
* 07/14/2020
|
114 |
* Fix: use file_get_contents instead of include_once to load the custom codes
|