Version Description
- 01/12/2018
- Feature: add the "Keep the HTML entities, don't convert to its character" option
Download this release
Release Info
Developer | diana_burduja |
Plugin | Simple Custom CSS and JS |
Version | 3.13 |
Comparing to | |
See all releases |
Code changes from version 3.12 to 3.13
- custom-css-js.php +3 -2
- includes/admin-config.php +194 -0
- includes/admin-screens.php +4 -1
- readme.txt +5 -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.
|
7 |
* Author: Diana Burduja
|
8 |
* Author URI: https://www.silkypress.com/
|
9 |
* License: GPL2
|
@@ -72,6 +72,7 @@ final class CustomCSSandJS {
|
|
72 |
$this->load_plugin_textdomain();
|
73 |
add_action('admin_init', array($this, 'create_roles'));
|
74 |
include_once( 'includes/admin-screens.php' );
|
|
|
75 |
include_once( 'includes/admin-addons.php' );
|
76 |
include_once( 'includes/admin-warnings.php' );
|
77 |
include_once( 'includes/admin-notices.php' );
|
@@ -196,7 +197,7 @@ final class CustomCSSandJS {
|
|
196 |
function set_constants() {
|
197 |
$dir = wp_upload_dir();
|
198 |
$constants = array(
|
199 |
-
'CCJ_VERSION' => '3.
|
200 |
'CCJ_UPLOAD_DIR' => $dir['basedir'] . '/custom-css-js',
|
201 |
'CCJ_UPLOAD_URL' => $dir['baseurl'] . '/custom-css-js',
|
202 |
'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.13
|
7 |
* Author: Diana Burduja
|
8 |
* Author URI: https://www.silkypress.com/
|
9 |
* License: GPL2
|
72 |
$this->load_plugin_textdomain();
|
73 |
add_action('admin_init', array($this, 'create_roles'));
|
74 |
include_once( 'includes/admin-screens.php' );
|
75 |
+
include_once( 'includes/admin-config.php' );
|
76 |
include_once( 'includes/admin-addons.php' );
|
77 |
include_once( 'includes/admin-warnings.php' );
|
78 |
include_once( 'includes/admin-notices.php' );
|
197 |
function set_constants() {
|
198 |
$dir = wp_upload_dir();
|
199 |
$constants = array(
|
200 |
+
'CCJ_VERSION' => '3.13',
|
201 |
'CCJ_UPLOAD_DIR' => $dir['basedir'] . '/custom-css-js',
|
202 |
'CCJ_UPLOAD_URL' => $dir['baseurl'] . '/custom-css-js',
|
203 |
'CCJ_PLUGIN_FILE' => __FILE__,
|
includes/admin-config.php
ADDED
@@ -0,0 +1,194 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Custom CSS and JS
|
4 |
+
*
|
5 |
+
*/
|
6 |
+
|
7 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
8 |
+
exit; // Exit if accessed directly
|
9 |
+
}
|
10 |
+
|
11 |
+
/**
|
12 |
+
* CustomCSSandJS_AdminConfig
|
13 |
+
*/
|
14 |
+
class CustomCSSandJS_AdminConfig {
|
15 |
+
|
16 |
+
var $settings_default;
|
17 |
+
|
18 |
+
var $settings;
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Constructor
|
22 |
+
*/
|
23 |
+
public function __construct() {
|
24 |
+
// Get the "default settings"
|
25 |
+
$settings_default = apply_filters( 'ccj_settings_default', array() );
|
26 |
+
|
27 |
+
// Get the saved settings
|
28 |
+
$settings = get_option('ccj_settings');
|
29 |
+
if ( $settings == false ) {
|
30 |
+
$settings = $settings_default;
|
31 |
+
} else {
|
32 |
+
foreach( $settings_default as $_key => $_value ) {
|
33 |
+
if ( ! isset($settings[$_key] ) ) {
|
34 |
+
$settings[$_key] = $_value;
|
35 |
+
}
|
36 |
+
}
|
37 |
+
}
|
38 |
+
$this->settings = $settings;
|
39 |
+
$this->settings_default = $settings_default;
|
40 |
+
|
41 |
+
//Add actions and filters
|
42 |
+
add_action( 'admin_menu', array( $this, 'admin_menu' ) );
|
43 |
+
add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) );
|
44 |
+
|
45 |
+
|
46 |
+
add_action( 'ccj_settings_form', array( $this, 'ccj_settings_form' ), 11 );
|
47 |
+
add_filter( 'ccj_settings_default', array( $this, 'ccj_settings_default' ) );
|
48 |
+
add_filter( 'ccj_settings_save', array( $this, 'ccj_settings_save' ) );
|
49 |
+
}
|
50 |
+
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Add submenu pages
|
54 |
+
*/
|
55 |
+
function admin_menu() {
|
56 |
+
$menu_slug = 'edit.php?post_type=custom-css-js';
|
57 |
+
|
58 |
+
add_submenu_page( $menu_slug, __('Settings', 'custom-css-js'), __('Settings', 'custom-css-js'), 'manage_options', 'custom-css-js-config', array( $this, 'config_page' ) );
|
59 |
+
|
60 |
+
}
|
61 |
+
|
62 |
+
|
63 |
+
/**
|
64 |
+
* Enqueue the scripts and styles
|
65 |
+
*/
|
66 |
+
public function admin_enqueue_scripts( $hook ) {
|
67 |
+
|
68 |
+
$screen = get_current_screen();
|
69 |
+
|
70 |
+
// Only for custom-css-js post type
|
71 |
+
if ( $screen->post_type != 'custom-css-js' )
|
72 |
+
return false;
|
73 |
+
|
74 |
+
if ( $hook != 'custom-css-js_page_custom-css-js-config' )
|
75 |
+
return false;
|
76 |
+
|
77 |
+
// Some handy variables
|
78 |
+
$a = plugins_url( '/', CCJ_PLUGIN_FILE). 'assets';
|
79 |
+
$v = CCJ_VERSION;
|
80 |
+
|
81 |
+
wp_enqueue_script( 'tipsy', $a . '/jquery.tipsy.js', array('jquery'), $v, false );
|
82 |
+
wp_enqueue_style( 'tipsy', $a . '/tipsy.css', array(), $v );
|
83 |
+
}
|
84 |
+
|
85 |
+
|
86 |
+
|
87 |
+
/**
|
88 |
+
* Template for the config page
|
89 |
+
*/
|
90 |
+
function config_page() {
|
91 |
+
|
92 |
+
if ( isset( $_POST['ccj_settings-nonce'] ) ) {
|
93 |
+
check_admin_referer('ccj_settings', 'ccj_settings-nonce');
|
94 |
+
|
95 |
+
$data = apply_filters( 'ccj_settings_save', array() );
|
96 |
+
|
97 |
+
update_option( 'ccj_settings', $data );
|
98 |
+
|
99 |
+
} else {
|
100 |
+
$data = $this->settings;
|
101 |
+
}
|
102 |
+
|
103 |
+
?>
|
104 |
+
<div class="wrap">
|
105 |
+
|
106 |
+
<?php $this->config_page_header('editor'); ?>
|
107 |
+
|
108 |
+
<form action="<?php echo admin_url('edit.php'); ?>?post_type=custom-css-js&page=custom-css-js-config" id="ccj_settings" method="post">
|
109 |
+
<table class="form-table">
|
110 |
+
<?php do_action( 'ccj_settings_form' ); ?>
|
111 |
+
|
112 |
+
<tr>
|
113 |
+
<th> </th>
|
114 |
+
<td>
|
115 |
+
<input type="submit" name="Submit" class="button-primary" value="<?php _e('Save'); ?>" />
|
116 |
+
<?php wp_nonce_field('ccj_settings', 'ccj_settings-nonce', false); ?>
|
117 |
+
</td>
|
118 |
+
</tr>
|
119 |
+
|
120 |
+
</table>
|
121 |
+
</form>
|
122 |
+
</div>
|
123 |
+
<?php
|
124 |
+
}
|
125 |
+
|
126 |
+
|
127 |
+
/**
|
128 |
+
* Template for config page header
|
129 |
+
*/
|
130 |
+
function config_page_header( $tab = 'editor' ) {
|
131 |
+
|
132 |
+
$url = '?post_type=custom-css-js&page=custom-css-js-config';
|
133 |
+
|
134 |
+
$active = array('editor' => '', 'general' => '', 'debug' => '');
|
135 |
+
$active[$tab] = 'nav-tab-active';
|
136 |
+
|
137 |
+
?>
|
138 |
+
<style type="text/css">.form-table th { width: 500px; } </style>
|
139 |
+
<h1><?php _e('Custom CSS & JS Settings'); ?></h1>
|
140 |
+
|
141 |
+
<h2 class="nav-tab-wrapper woo-nav-tab-wrapper">
|
142 |
+
<a href="<?php echo $url; ?>" class="nav-tab <?php echo $active['editor']; ?>"><?php echo __('Editor Settings', 'custom-css-js'); ?></a>
|
143 |
+
</h2>
|
144 |
+
|
145 |
+
<?php
|
146 |
+
}
|
147 |
+
|
148 |
+
/**
|
149 |
+
* Add the default for the theme
|
150 |
+
*/
|
151 |
+
function ccj_settings_default( $defaults ) {
|
152 |
+
return array_merge( $defaults, array( 'ccj_htmlentities' => false) );
|
153 |
+
}
|
154 |
+
|
155 |
+
|
156 |
+
/**
|
157 |
+
* Add the 'ccj_htmlentities' value to the $_POST for the Settings page
|
158 |
+
*/
|
159 |
+
function ccj_settings_save( $data ) {
|
160 |
+
$default['htmlentities'] = false;
|
161 |
+
$htmlentities = isset($_POST['ccj_htmlentities']) ? true : false;
|
162 |
+
|
163 |
+
return array_merge( $data, array('ccj_htmlentities' => $htmlentities) );
|
164 |
+
}
|
165 |
+
|
166 |
+
|
167 |
+
|
168 |
+
/**
|
169 |
+
* Form for "Editor Theme" field
|
170 |
+
*/
|
171 |
+
function ccj_settings_form() {
|
172 |
+
|
173 |
+
// Get the setting
|
174 |
+
$settings = get_option('ccj_settings');
|
175 |
+
$htmlentities = (isset($settings['ccj_htmlentities']) && $settings['ccj_htmlentities']) ? true : false;
|
176 |
+
|
177 |
+
|
178 |
+
$title = __('If you want to use an HTML entity in your code (for example '. htmlentities('> or "').'), but the editor keeps on changing them to its equivalent character (> and " for the previous example), then you might want to enable this option.', 'custom-css-js');
|
179 |
+
$help = '<span class="dashicons dashicons-editor-help" rel="tipsy" title="'.$title.'"></span>';
|
180 |
+
|
181 |
+
?>
|
182 |
+
<tr>
|
183 |
+
<th scope="row"><label for="ccj_htmlentities"><?php _e('Keep the HTML entities, don\'t convert to its character', 'custom-css-js') ?> <?php echo $help; ?></label></th>
|
184 |
+
<td><input type="checkbox" name="ccj_htmlentities" id = "ccj_htmlentities" value="1" <?php checked($htmlentities, true); ?> />
|
185 |
+
</td>
|
186 |
+
</tr>
|
187 |
+
<?php
|
188 |
+
}
|
189 |
+
|
190 |
+
|
191 |
+
|
192 |
+
}
|
193 |
+
|
194 |
+
return new CustomCSSandJS_AdminConfig();
|
includes/admin-screens.php
CHANGED
@@ -576,8 +576,11 @@ class CustomCSSandJS_Admin {
|
|
576 |
}
|
577 |
$language = $this->get_language($post_id);
|
578 |
|
|
|
|
|
|
|
579 |
// Replace the htmlentities (https://wordpress.org/support/topic/annoying-bug-in-text-editor/), but only selectively
|
580 |
-
if ( strstr($post->post_content, '&') ) {
|
581 |
|
582 |
// First the ampresands
|
583 |
$post->post_content = str_replace('&', htmlentities('&'), $post->post_content );
|
576 |
}
|
577 |
$language = $this->get_language($post_id);
|
578 |
|
579 |
+
$settings = get_option( 'ccj_settings' );
|
580 |
+
|
581 |
+
|
582 |
// Replace the htmlentities (https://wordpress.org/support/topic/annoying-bug-in-text-editor/), but only selectively
|
583 |
+
if ( isset($settings['ccj_htmlentities']) && $settings['ccj_htmlentities'] == 1 && strstr($post->post_content, '&') ) {
|
584 |
|
585 |
// First the ampresands
|
586 |
$post->post_content = str_replace('&', htmlentities('&'), $post->post_content );
|
readme.txt
CHANGED
@@ -1,12 +1,11 @@
|
|
1 |
=== Simple Custom CSS and JS ===
|
2 |
Created: 06/12/2015
|
3 |
Contributors: diana_burduja
|
4 |
-
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=diana.burduja@gmail.com&lc=AT&item_name=Diana%20Burduja&item_number=Simple%2dCustom%2dCSS%2dand%2dJS%2dplugin¤cy_code=EUR&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted
|
5 |
Email: diana@burduja.eu
|
6 |
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
|
7 |
Requires at least: 3.0.1
|
8 |
Tested up to: 4.9
|
9 |
-
Stable tag: 3.
|
10 |
License: GPLv3
|
11 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
12 |
|
@@ -115,6 +114,10 @@ $. Add/Edit HTML
|
|
115 |
|
116 |
== Changelog ==
|
117 |
|
|
|
|
|
|
|
|
|
118 |
= 3.12 =
|
119 |
* 01/03/2018
|
120 |
* Reverse to the `wp_footer` function for the footer scripts, as the `print_footer_scripts` function is used also in the admin, which lead to many broken back-ends
|
1 |
=== Simple Custom CSS and JS ===
|
2 |
Created: 06/12/2015
|
3 |
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: 4.9
|
8 |
+
Stable tag: 3.13
|
9 |
License: GPLv3
|
10 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
11 |
|
114 |
|
115 |
== Changelog ==
|
116 |
|
117 |
+
= 3.13 =
|
118 |
+
* 01/12/2018
|
119 |
+
* Feature: add the "Keep the HTML entities, don't convert to its character" option
|
120 |
+
|
121 |
= 3.12 =
|
122 |
* 01/03/2018
|
123 |
* Reverse to the `wp_footer` function for the footer scripts, as the `print_footer_scripts` function is used also in the admin, which lead to many broken back-ends
|