Version Description
- 11/01/2020
- Feature: enqueue the jQuery library if one of the JS custom codes requires it
- Fix: set cookie SameSite attribute to lax
Download this release
Release Info
Developer | diana_burduja |
Plugin | Simple Custom CSS and JS |
Version | 3.34 |
Comparing to | |
See all releases |
Code changes from version 3.33 to 3.34
- assets/ccj_admin.js +1 -1
- custom-css-js.php +13 -2
- includes/admin-screens.php +12 -4
- readme.txt +6 -1
assets/ccj_admin.js
CHANGED
@@ -87,7 +87,7 @@ jQuery(document).ready( function($) {
|
|
87 |
// Saving cursor state
|
88 |
editor.on('cursorActivity', function () {
|
89 |
var curPos = editor.getCursor();
|
90 |
-
document.cookie = 'hesh_plugin_pos=' + postID + ',' + curPos.line + ',' + curPos.ch;
|
91 |
});
|
92 |
|
93 |
// Restoring cursor state
|
87 |
// Saving cursor state
|
88 |
editor.on('cursorActivity', function () {
|
89 |
var curPos = editor.getCursor();
|
90 |
+
document.cookie = 'hesh_plugin_pos=' + postID + ',' + curPos.line + ',' + curPos.ch + '; SameSite=Lax';
|
91 |
});
|
92 |
|
93 |
// Restoring cursor state
|
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.
|
7 |
* Author: SilkyPress.com
|
8 |
* Author URI: https://www.silkypress.com
|
9 |
* License: GPL2
|
@@ -95,6 +95,9 @@ if ( ! class_exists( 'CustomCSSandJS' ) ) :
|
|
95 |
|
96 |
if ( is_null( self::$_instance ) ) {
|
97 |
$this->print_code_actions();
|
|
|
|
|
|
|
98 |
}
|
99 |
}
|
100 |
|
@@ -211,13 +214,21 @@ if ( ! class_exists( 'CustomCSSandJS' ) ) :
|
|
211 |
}
|
212 |
|
213 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
214 |
/**
|
215 |
* Set constants for later use
|
216 |
*/
|
217 |
function set_constants() {
|
218 |
$dir = wp_upload_dir();
|
219 |
$constants = array(
|
220 |
-
'CCJ_VERSION' => '3.
|
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.34
|
7 |
* Author: SilkyPress.com
|
8 |
* Author URI: https://www.silkypress.com
|
9 |
* License: GPL2
|
95 |
|
96 |
if ( is_null( self::$_instance ) ) {
|
97 |
$this->print_code_actions();
|
98 |
+
if ( isset ( $this->search_tree['jquery'] ) && $this->search_tree['jquery'] === true ) {
|
99 |
+
add_action( 'wp_enqueue_scripts', 'CustomCSSandJS::wp_enqueue_scripts' );
|
100 |
+
}
|
101 |
}
|
102 |
}
|
103 |
|
214 |
}
|
215 |
|
216 |
|
217 |
+
/**
|
218 |
+
* Enqueue the jQuery library, if necessary
|
219 |
+
*/
|
220 |
+
public static function wp_enqueue_scripts() {
|
221 |
+
wp_enqueue_script( 'jquery' );
|
222 |
+
}
|
223 |
+
|
224 |
+
|
225 |
/**
|
226 |
* Set constants for later use
|
227 |
*/
|
228 |
function set_constants() {
|
229 |
$dir = wp_upload_dir();
|
230 |
$constants = array(
|
231 |
+
'CCJ_VERSION' => '3.34',
|
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
@@ -935,12 +935,12 @@ End of comment */ ',
|
|
935 |
'none' => array(
|
936 |
'title' => __( 'None', 'custom-css-js' ),
|
937 |
),
|
|
|
|
|
|
|
938 |
'less' => array(
|
939 |
'title' => __( 'Less', 'custom-css-js' ),
|
940 |
),
|
941 |
-
'sass' => array(
|
942 |
-
'title' => __( 'SASS (only SCSS syntax)', 'custom-css-js' ),
|
943 |
-
),
|
944 |
),
|
945 |
'disabled' => true,
|
946 |
),
|
@@ -1114,7 +1114,7 @@ End of comment */ ',
|
|
1114 |
$options[ $_field ] = isset( $_POST[ 'custom_code_' . $_field ] ) ? esc_attr( strtolower( $_POST[ 'custom_code_' . $_field ] ) ) : $_default;
|
1115 |
}
|
1116 |
|
1117 |
-
$options['custom_code_language'] = in_array( $options['
|
1118 |
|
1119 |
update_post_meta( $post_id, 'options', $options );
|
1120 |
|
@@ -1259,6 +1259,14 @@ endif;
|
|
1259 |
// Add the code file to the tree branch
|
1260 |
$tree[ $tree_branch ][] = $filename;
|
1261 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1262 |
}
|
1263 |
|
1264 |
// Save the tree in the database
|
935 |
'none' => array(
|
936 |
'title' => __( 'None', 'custom-css-js' ),
|
937 |
),
|
938 |
+
'sass' => array(
|
939 |
+
'title' => __( 'Sass (only SCSS syntax)', 'custom-css-js' ),
|
940 |
+
),
|
941 |
'less' => array(
|
942 |
'title' => __( 'Less', 'custom-css-js' ),
|
943 |
),
|
|
|
|
|
|
|
944 |
),
|
945 |
'disabled' => true,
|
946 |
),
|
1114 |
$options[ $_field ] = isset( $_POST[ 'custom_code_' . $_field ] ) ? esc_attr( strtolower( $_POST[ 'custom_code_' . $_field ] ) ) : $_default;
|
1115 |
}
|
1116 |
|
1117 |
+
$options['custom_code_language'] = in_array( $options['language'], array( 'html', 'css', 'js' ), true ) ? $options['language'] : $defaults['language'];
|
1118 |
|
1119 |
update_post_meta( $post_id, 'options', $options );
|
1120 |
|
1259 |
// Add the code file to the tree branch
|
1260 |
$tree[ $tree_branch ][] = $filename;
|
1261 |
|
1262 |
+
// Mark to enqueue the jQuery library, if necessary
|
1263 |
+
if ( $options['language'] === 'js' ) {
|
1264 |
+
$_post->post_content = preg_replace( '@/\* Add your JavaScript code here[\s\S]*?End of comment \*/@im', '/* Default comment here */', $_post->post_content );
|
1265 |
+
if ( preg_match( '/jquery\s*(\(|\.)/i', $_post->post_content ) && ! isset( $tree['jquery'] ) ) {
|
1266 |
+
$tree['jquery'] = true;
|
1267 |
+
}
|
1268 |
+
}
|
1269 |
+
|
1270 |
}
|
1271 |
|
1272 |
// Save the tree in the database
|
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.
|
9 |
License: GPLv3
|
10 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
11 |
Requires PHP: 5.2.4
|
@@ -105,6 +105,11 @@ $. Add/Edit HTML
|
|
105 |
|
106 |
== Changelog ==
|
107 |
|
|
|
|
|
|
|
|
|
|
|
108 |
= 3.33 =
|
109 |
* 08/20/2020
|
110 |
* Fix: the user language preferrence was ignored in favor of the site defined language
|
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.34
|
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.34 =
|
109 |
+
* 11/01/2020
|
110 |
+
* Feature: enqueue the jQuery library if one of the JS custom codes requires it
|
111 |
+
* Fix: set cookie SameSite attribute to lax
|
112 |
+
|
113 |
= 3.33 =
|
114 |
* 08/20/2020
|
115 |
* Fix: the user language preferrence was ignored in favor of the site defined language
|