Version Description
- 04/22/2018
- Fix: "The link you followed has expired" on custom code save if the WP Quads Pro plugin is active
- Fix: PHP warning for PHP 7.2
- Change: add/remove the "Web Designer" role only on activating/deactivating the option in the Settings page
Download this release
Release Info
Developer | diana_burduja |
Plugin | Simple Custom CSS and JS |
Version | 3.16 |
Comparing to | |
See all releases |
Code changes from version 3.15 to 3.16
- custom-css-js.php +22 -97
- includes/admin-config.php +138 -33
- includes/admin-screens.php +10 -11
- readme.txt +7 -1
custom-css-js.php
CHANGED
@@ -3,9 +3,9 @@
|
|
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:
|
8 |
-
* Author URI: https://www.silkypress.com
|
9 |
* License: GPL2
|
10 |
*
|
11 |
* Text Domain: custom-css-js
|
@@ -70,7 +70,6 @@ final class CustomCSSandJS {
|
|
70 |
|
71 |
if ( is_admin() ) {
|
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' );
|
@@ -199,7 +198,7 @@ final class CustomCSSandJS {
|
|
199 |
function set_constants() {
|
200 |
$dir = wp_upload_dir();
|
201 |
$constants = array(
|
202 |
-
'CCJ_VERSION' => '3.
|
203 |
'CCJ_UPLOAD_DIR' => $dir['basedir'] . '/custom-css-js',
|
204 |
'CCJ_UPLOAD_URL' => $dir['baseurl'] . '/custom-css-js',
|
205 |
'CCJ_PLUGIN_FILE' => __FILE__,
|
@@ -273,98 +272,7 @@ final class CustomCSSandJS {
|
|
273 |
register_post_type( 'custom-css-js', $args );
|
274 |
}
|
275 |
|
276 |
-
|
277 |
-
/**
|
278 |
-
* Create roles and capabilities.
|
279 |
-
*/
|
280 |
-
function create_roles() {
|
281 |
-
global $wp_roles;
|
282 |
-
|
283 |
-
|
284 |
-
if ( !current_user_can('update_plugins') )
|
285 |
-
return;
|
286 |
-
|
287 |
-
if ( ! class_exists( 'WP_Roles' ) ) {
|
288 |
-
return;
|
289 |
-
}
|
290 |
-
|
291 |
-
if ( ! isset( $wp_roles ) ) {
|
292 |
-
$wp_roles = new WP_Roles();
|
293 |
-
}
|
294 |
-
|
295 |
-
if ( isset($wp_roles->roles['css_js_designer']))
|
296 |
-
return;
|
297 |
-
|
298 |
-
// Add Web Designer role
|
299 |
-
add_role( 'css_js_designer', __( 'Web Designer', 'custom-css-js'), array(
|
300 |
-
'level_9' => true,
|
301 |
-
'level_8' => true,
|
302 |
-
'level_7' => true,
|
303 |
-
'level_6' => true,
|
304 |
-
'level_5' => true,
|
305 |
-
'level_4' => true,
|
306 |
-
'level_3' => true,
|
307 |
-
'level_2' => true,
|
308 |
-
'level_1' => true,
|
309 |
-
'level_0' => true,
|
310 |
-
'read' => true,
|
311 |
-
'read_private_pages' => true,
|
312 |
-
'read_private_posts' => true,
|
313 |
-
'edit_users' => true,
|
314 |
-
'edit_posts' => true,
|
315 |
-
'edit_pages' => true,
|
316 |
-
'edit_published_posts' => true,
|
317 |
-
'edit_published_pages' => true,
|
318 |
-
'edit_private_pages' => true,
|
319 |
-
'edit_private_posts' => true,
|
320 |
-
'edit_others_posts' => true,
|
321 |
-
'edit_others_pages' => true,
|
322 |
-
'publish_posts' => true,
|
323 |
-
'publish_pages' => true,
|
324 |
-
'delete_posts' => true,
|
325 |
-
'delete_pages' => true,
|
326 |
-
'delete_private_pages' => true,
|
327 |
-
'delete_private_posts' => true,
|
328 |
-
'delete_published_pages' => true,
|
329 |
-
'delete_published_posts' => true,
|
330 |
-
'delete_others_posts' => true,
|
331 |
-
'delete_others_pages' => true,
|
332 |
-
'manage_categories' => true,
|
333 |
-
'moderate_comments' => true,
|
334 |
-
'unfiltered_html' => true,
|
335 |
-
'upload_files' => true,
|
336 |
-
) );
|
337 |
-
|
338 |
-
$capabilities = array();
|
339 |
-
|
340 |
-
$capability_types = array( 'custom_css' );
|
341 |
-
|
342 |
-
foreach ( $capability_types as $capability_type ) {
|
343 |
-
|
344 |
-
$capabilities[ $capability_type ] = array(
|
345 |
-
// Post type
|
346 |
-
"edit_{$capability_type}",
|
347 |
-
"read_{$capability_type}",
|
348 |
-
"delete_{$capability_type}",
|
349 |
-
"edit_{$capability_type}s",
|
350 |
-
"edit_others_{$capability_type}s",
|
351 |
-
"publish_{$capability_type}s",
|
352 |
-
"delete_{$capability_type}s",
|
353 |
-
"delete_published_{$capability_type}s",
|
354 |
-
"delete_others_{$capability_type}s",
|
355 |
-
"edit_published_{$capability_type}s",
|
356 |
-
);
|
357 |
-
}
|
358 |
-
|
359 |
-
foreach ( $capabilities as $cap_group ) {
|
360 |
-
foreach ( $cap_group as $cap ) {
|
361 |
-
$wp_roles->add_cap( 'css_js_designer', $cap );
|
362 |
-
$wp_roles->add_cap( 'administrator', $cap );
|
363 |
-
}
|
364 |
-
}
|
365 |
-
}
|
366 |
-
|
367 |
-
|
368 |
public function load_plugin_textdomain() {
|
369 |
load_plugin_textdomain( 'custom-css-js', false, plugin_basename( dirname( __FILE__ ) ) . '/languages' );
|
370 |
}
|
@@ -399,3 +307,20 @@ function custom_css_js_plugin_action_links( $links ) {
|
|
399 |
add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), 'custom_css_js_plugin_action_links' );
|
400 |
|
401 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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.16
|
7 |
+
* Author: SilkyPres.com
|
8 |
+
* Author URI: https://www.silkypress.com
|
9 |
* License: GPL2
|
10 |
*
|
11 |
* Text Domain: custom-css-js
|
70 |
|
71 |
if ( is_admin() ) {
|
72 |
$this->load_plugin_textdomain();
|
|
|
73 |
include_once( 'includes/admin-screens.php' );
|
74 |
include_once( 'includes/admin-config.php' );
|
75 |
include_once( 'includes/admin-addons.php' );
|
198 |
function set_constants() {
|
199 |
$dir = wp_upload_dir();
|
200 |
$constants = array(
|
201 |
+
'CCJ_VERSION' => '3.16',
|
202 |
'CCJ_UPLOAD_DIR' => $dir['basedir'] . '/custom-css-js',
|
203 |
'CCJ_UPLOAD_URL' => $dir['baseurl'] . '/custom-css-js',
|
204 |
'CCJ_PLUGIN_FILE' => __FILE__,
|
272 |
register_post_type( 'custom-css-js', $args );
|
273 |
}
|
274 |
|
275 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
276 |
public function load_plugin_textdomain() {
|
277 |
load_plugin_textdomain( 'custom-css-js', false, plugin_basename( dirname( __FILE__ ) ) . '/languages' );
|
278 |
}
|
307 |
add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), 'custom_css_js_plugin_action_links' );
|
308 |
|
309 |
|
310 |
+
|
311 |
+
/**
|
312 |
+
* Compatibility with the WP Quads Pro plugin,
|
313 |
+
* otherwise on a Custom Code save there is a
|
314 |
+
* "The link you followed has expired." page shown.
|
315 |
+
*/
|
316 |
+
if ( ! function_exists('custom_css_js_quads_pro_compat') ) {
|
317 |
+
function custom_css_js_quads_pro_compat( $post_types ) {
|
318 |
+
$match = array_search('custom-css-js', $post_types);
|
319 |
+
if ( $match ) {
|
320 |
+
unset($post_types[$match]);
|
321 |
+
}
|
322 |
+
return $post_types;
|
323 |
+
}
|
324 |
+
add_filter('quads_meta_box_post_types', 'custom_css_js_quads_pro_compat', 20);
|
325 |
+
}
|
326 |
+
|
includes/admin-config.php
CHANGED
@@ -94,6 +94,22 @@ class CustomCSSandJS_AdminConfig {
|
|
94 |
|
95 |
$data = apply_filters( 'ccj_settings_save', array() );
|
96 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
97 |
update_option( 'ccj_settings', $data );
|
98 |
|
99 |
} else {
|
@@ -106,18 +122,9 @@ class CustomCSSandJS_AdminConfig {
|
|
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 |
-
|
|
|
121 |
</form>
|
122 |
</div>
|
123 |
<?php
|
@@ -135,13 +142,13 @@ class CustomCSSandJS_AdminConfig {
|
|
135 |
$active[$tab] = 'nav-tab-active';
|
136 |
|
137 |
?>
|
138 |
-
<style type="text/css"
|
|
|
|
|
|
|
|
|
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 |
|
@@ -150,10 +157,11 @@ class CustomCSSandJS_AdminConfig {
|
|
150 |
/**
|
151 |
* Add the defaults for the `General Settings` form
|
152 |
*/
|
153 |
-
function general_extra_default( $defaults ) {
|
154 |
return array_merge( $defaults, array(
|
155 |
-
'ccj_htmlentities'
|
156 |
-
'ccj_htmlentities2'
|
|
|
157 |
) );
|
158 |
}
|
159 |
|
@@ -161,17 +169,15 @@ class CustomCSSandJS_AdminConfig {
|
|
161 |
/**
|
162 |
* Add the `General Settings` form values to the $_POST for the Settings page
|
163 |
*/
|
164 |
-
function general_extra_save( $data ) {
|
165 |
-
$
|
166 |
-
$htmlentities = isset($_POST['ccj_htmlentities']) ? true : false;
|
167 |
-
$htmlentities2 = isset($_POST['ccj_htmlentities2']) ? true : false;
|
168 |
-
|
169 |
-
return array_merge( $data, array(
|
170 |
-
'ccj_htmlentities' => $htmlentities,
|
171 |
-
'ccj_htmlentities2' => $htmlentities2,
|
172 |
-
) );
|
173 |
-
}
|
174 |
|
|
|
|
|
|
|
|
|
|
|
|
|
175 |
|
176 |
|
177 |
/**
|
@@ -181,8 +187,23 @@ class CustomCSSandJS_AdminConfig {
|
|
181 |
|
182 |
// Get the setting
|
183 |
$settings = get_option('ccj_settings');
|
184 |
-
$
|
185 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
186 |
|
187 |
$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-pro');
|
188 |
$help = '<span class="dashicons dashicons-editor-help" rel="tipsy" title="'.$title.'"></span>';
|
@@ -191,19 +212,103 @@ class CustomCSSandJS_AdminConfig {
|
|
191 |
$help2 = '<span class="dashicons dashicons-editor-help" rel="tipsy" title="'.$title2.'"></span>';
|
192 |
|
193 |
?>
|
|
|
|
|
|
|
194 |
<tr>
|
195 |
<th scope="row"><label for="ccj_htmlentities"><?php _e('Keep the HTML entities, don\'t convert to its character', 'custom-css-js-pro') ?> <?php echo $help; ?></label></th>
|
196 |
-
<td><input type="checkbox" name="ccj_htmlentities" id = "ccj_htmlentities" value="1" <?php checked($
|
197 |
</td>
|
198 |
</tr>
|
199 |
<tr>
|
200 |
<th scope="row"><label for="ccj_htmlentities2"><?php _e('Encode the HTML entities', 'custom-css-js-pro') ?> <?php echo $help2; ?></label></th>
|
201 |
-
<td><input type="checkbox" name="ccj_htmlentities2" id = "ccj_htmlentities2" value="1" <?php checked($
|
202 |
</td>
|
203 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
204 |
<?php
|
205 |
}
|
206 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
207 |
|
208 |
}
|
209 |
|
94 |
|
95 |
$data = apply_filters( 'ccj_settings_save', array() );
|
96 |
|
97 |
+
$settings = get_option('ccj_settings');
|
98 |
+
if ( !isset($settings['add_role'] ) ) $settings['add_role'] = false;
|
99 |
+
|
100 |
+
// If the "add role" option changed
|
101 |
+
if ( $data['add_role'] !== $settings['add_role'] ) {
|
102 |
+
// Add the 'css_js_designer' role
|
103 |
+
if ( $data['add_role'] ) {
|
104 |
+
$this->create_roles();
|
105 |
+
}
|
106 |
+
|
107 |
+
// Remove the 'css_js_designer' role
|
108 |
+
if ( !$data['add_role'] ) {
|
109 |
+
remove_role('css_js_designer');
|
110 |
+
}
|
111 |
+
}
|
112 |
+
|
113 |
update_option( 'ccj_settings', $data );
|
114 |
|
115 |
} else {
|
122 |
<?php $this->config_page_header('editor'); ?>
|
123 |
|
124 |
<form action="<?php echo admin_url('edit.php'); ?>?post_type=custom-css-js&page=custom-css-js-config" id="ccj_settings" method="post">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
|
126 |
+
<?php do_action( 'ccj_settings_form' ); ?>
|
127 |
+
|
128 |
</form>
|
129 |
</div>
|
130 |
<?php
|
142 |
$active[$tab] = 'nav-tab-active';
|
143 |
|
144 |
?>
|
145 |
+
<style type="text/css">
|
146 |
+
.custom-css-js_page_custom-css-js-config h1 { margin-bottom: 40px; }
|
147 |
+
.form-table { margin-left: 2%; width: 98%;}
|
148 |
+
.form-table th { width: 500px; }
|
149 |
+
</style>
|
150 |
<h1><?php _e('Custom CSS & JS Settings'); ?></h1>
|
151 |
|
|
|
|
|
|
|
|
|
152 |
<?php
|
153 |
}
|
154 |
|
157 |
/**
|
158 |
* Add the defaults for the `General Settings` form
|
159 |
*/
|
160 |
+
function general_extra_default( $defaults = array() ) {
|
161 |
return array_merge( $defaults, array(
|
162 |
+
'ccj_htmlentities' => false,
|
163 |
+
'ccj_htmlentities2' => false,
|
164 |
+
'add_role' => false,
|
165 |
) );
|
166 |
}
|
167 |
|
169 |
/**
|
170 |
* Add the `General Settings` form values to the $_POST for the Settings page
|
171 |
*/
|
172 |
+
function general_extra_save( $data = array() ) {
|
173 |
+
$values = $this->general_extra_default();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
174 |
|
175 |
+
foreach($values as $_key => $_value ) {
|
176 |
+
$values[$_key] = isset($_POST[$_key]) ? true : false;
|
177 |
+
}
|
178 |
+
|
179 |
+
return array_merge( $data, $values );
|
180 |
+
}
|
181 |
|
182 |
|
183 |
/**
|
187 |
|
188 |
// Get the setting
|
189 |
$settings = get_option('ccj_settings');
|
190 |
+
$defaults = $this->general_extra_default();
|
191 |
+
|
192 |
+
foreach( $defaults as $_key => $_value ) {
|
193 |
+
if ( !isset($settings[$_key] ) ) {
|
194 |
+
$settings[$_key] = $_value;
|
195 |
+
}
|
196 |
+
}
|
197 |
+
|
198 |
+
if ( !get_role('css_js_designer') && $settings['add_role'] ) {
|
199 |
+
$settings['add_role'] = false;
|
200 |
+
update_option( 'ccj_settings', $settings );
|
201 |
+
}
|
202 |
+
|
203 |
+
if ( get_role('css_js_designer') && !$settings['add_role']) {
|
204 |
+
$settings['add_role'] = true;
|
205 |
+
update_option( 'ccj_settings', $settings );
|
206 |
+
}
|
207 |
|
208 |
$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-pro');
|
209 |
$help = '<span class="dashicons dashicons-editor-help" rel="tipsy" title="'.$title.'"></span>';
|
212 |
$help2 = '<span class="dashicons dashicons-editor-help" rel="tipsy" title="'.$title2.'"></span>';
|
213 |
|
214 |
?>
|
215 |
+
|
216 |
+
<h2><?php echo __('Editor Settings', 'custom-css-js'); ?></h2>
|
217 |
+
<table class="form-table">
|
218 |
<tr>
|
219 |
<th scope="row"><label for="ccj_htmlentities"><?php _e('Keep the HTML entities, don\'t convert to its character', 'custom-css-js-pro') ?> <?php echo $help; ?></label></th>
|
220 |
+
<td><input type="checkbox" name="ccj_htmlentities" id = "ccj_htmlentities" value="1" <?php checked($settings['ccj_htmlentities'], true); ?> />
|
221 |
</td>
|
222 |
</tr>
|
223 |
<tr>
|
224 |
<th scope="row"><label for="ccj_htmlentities2"><?php _e('Encode the HTML entities', 'custom-css-js-pro') ?> <?php echo $help2; ?></label></th>
|
225 |
+
<td><input type="checkbox" name="ccj_htmlentities2" id = "ccj_htmlentities2" value="1" <?php checked($settings['ccj_htmlentities2'], true); ?> />
|
226 |
</td>
|
227 |
</tr>
|
228 |
+
|
229 |
+
|
230 |
+
</table>
|
231 |
+
|
232 |
+
|
233 |
+
|
234 |
+
<?php if ( current_user_can('update_plugins') ) : ?>
|
235 |
+
<h2><?php echo __('General Settings', 'custom-css-js'); ?></h2>
|
236 |
+
<table class="form-table">
|
237 |
+
<tr>
|
238 |
+
<th scope="row"><label for="add_role"><?php _e('Add the "css_js_designer" role', 'custom-css-js-pro') ?> <?php echo $help; ?></label></th>
|
239 |
+
<td><input type="checkbox" name="add_role" id = "add_role" value="1" <?php checked($settings['add_role'], true); ?> />
|
240 |
+
</td>
|
241 |
+
</tr>
|
242 |
+
</table>
|
243 |
+
<?php endif; ?>
|
244 |
+
<table class="form-table">
|
245 |
+
<tr>
|
246 |
+
<th> </th>
|
247 |
+
<td>
|
248 |
+
<input type="submit" name="Submit" class="button-primary" value="<?php _e('Save'); ?>" />
|
249 |
+
<?php wp_nonce_field('ccj_settings', 'ccj_settings-nonce', false); ?>
|
250 |
+
</td>
|
251 |
+
</tr>
|
252 |
+
</table>
|
253 |
+
|
254 |
<?php
|
255 |
}
|
256 |
|
257 |
+
|
258 |
+
/**
|
259 |
+
* Create roles and capabilities.
|
260 |
+
*/
|
261 |
+
function create_roles() {
|
262 |
+
global $wp_roles;
|
263 |
+
|
264 |
+
|
265 |
+
if ( !current_user_can('update_plugins') )
|
266 |
+
return;
|
267 |
+
|
268 |
+
if ( ! class_exists( 'WP_Roles' ) ) {
|
269 |
+
return;
|
270 |
+
}
|
271 |
+
|
272 |
+
if ( ! isset( $wp_roles ) ) {
|
273 |
+
$wp_roles = new WP_Roles();
|
274 |
+
}
|
275 |
+
|
276 |
+
if ( isset($wp_roles->roles['css_js_designer']))
|
277 |
+
return;
|
278 |
+
|
279 |
+
// Add Web Designer role
|
280 |
+
add_role( 'css_js_designer', __( 'Web Designer', 'custom-css-js'), array() );
|
281 |
+
|
282 |
+
$capabilities = array();
|
283 |
+
|
284 |
+
$capability_types = array( 'custom_css' );
|
285 |
+
|
286 |
+
foreach ( $capability_types as $capability_type ) {
|
287 |
+
|
288 |
+
$capabilities[ $capability_type ] = array(
|
289 |
+
// Post type
|
290 |
+
"edit_{$capability_type}",
|
291 |
+
"read_{$capability_type}",
|
292 |
+
"delete_{$capability_type}",
|
293 |
+
"edit_{$capability_type}s",
|
294 |
+
"edit_others_{$capability_type}s",
|
295 |
+
"publish_{$capability_type}s",
|
296 |
+
"delete_{$capability_type}s",
|
297 |
+
"delete_published_{$capability_type}s",
|
298 |
+
"delete_others_{$capability_type}s",
|
299 |
+
"edit_published_{$capability_type}s",
|
300 |
+
);
|
301 |
+
}
|
302 |
+
|
303 |
+
foreach ( $capabilities as $cap_group ) {
|
304 |
+
foreach ( $cap_group as $cap ) {
|
305 |
+
$wp_roles->add_cap( 'css_js_designer', $cap );
|
306 |
+
$wp_roles->add_cap( 'administrator', $cap );
|
307 |
+
}
|
308 |
+
}
|
309 |
+
}
|
310 |
+
|
311 |
+
|
312 |
|
313 |
}
|
314 |
|
includes/admin-screens.php
CHANGED
@@ -301,22 +301,20 @@ class CustomCSSandJS_Admin {
|
|
301 |
}
|
302 |
|
303 |
if ( $column == 'modified' ) {
|
304 |
-
if (
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
if ( version_compare( $wp_version, '4.6', '>=' ) ) {
|
309 |
-
$m_time = get_the_modified_time( __('Y/m/d g:i:s a'), $post_id );
|
310 |
} else {
|
311 |
-
$
|
|
|
312 |
}
|
313 |
|
314 |
-
$time_diff = time() - $
|
315 |
|
316 |
if ( $time_diff > 0 && $time_diff < DAY_IN_SECONDS ) {
|
317 |
-
$h_time = sprintf( __( '%s ago' ), human_time_diff( $
|
318 |
} else {
|
319 |
-
$h_time = mysql2date( get_option('date_format'), $
|
320 |
}
|
321 |
|
322 |
echo $h_time;
|
@@ -594,7 +592,8 @@ class CustomCSSandJS_Admin {
|
|
594 |
$post->post_content = str_replace('&', htmlentities('&'), $post->post_content );
|
595 |
|
596 |
// Then the rest of the entities
|
597 |
-
$
|
|
|
598 |
unset( $entities[ array_search('&', $entities) ]);
|
599 |
$regular_expression = str_replace(';', '', '/('.implode('|', $entities).')/i');
|
600 |
preg_match_all($regular_expression, $post->post_content, $matches);
|
301 |
}
|
302 |
|
303 |
if ( $column == 'modified' ) {
|
304 |
+
if ( $column == 'modified' ) {
|
305 |
+
$f_time = get_the_modified_time( __('Y/m/d g:i:s a'), $post_id );
|
306 |
+
$g_time = get_the_modified_time( 'G', $post_id );
|
|
|
|
|
|
|
307 |
} else {
|
308 |
+
$f_time = get_the_time( __('Y/m/d g:i:s a' ) );
|
309 |
+
$g_time = get_the_time( 'G' );
|
310 |
}
|
311 |
|
312 |
+
$time_diff = time() - $g_time;
|
313 |
|
314 |
if ( $time_diff > 0 && $time_diff < DAY_IN_SECONDS ) {
|
315 |
+
$h_time = sprintf( __( '%s ago', 'custom-css-js-pro' ), human_time_diff( $g_time) );
|
316 |
} else {
|
317 |
+
$h_time = mysql2date( get_option('date_format'), $f_time );
|
318 |
}
|
319 |
|
320 |
echo $h_time;
|
592 |
$post->post_content = str_replace('&', htmlentities('&'), $post->post_content );
|
593 |
|
594 |
// Then the rest of the entities
|
595 |
+
$html_flags = defined('ENT_HTML5') ? ENT_QUOTES | ENT_HTML5 : ENT_QUOTES;
|
596 |
+
$entities = get_html_translation_table(HTML_ENTITIES, $html_flags);
|
597 |
unset( $entities[ array_search('&', $entities) ]);
|
598 |
$regular_expression = str_replace(';', '', '/('.implode('|', $entities).')/i');
|
599 |
preg_match_all($regular_expression, $post->post_content, $matches);
|
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: 4.9
|
8 |
-
Stable tag: 3.
|
9 |
License: GPLv3
|
10 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
11 |
|
@@ -114,6 +114,12 @@ $. Add/Edit HTML
|
|
114 |
|
115 |
== Changelog ==
|
116 |
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
= 3.15 =
|
118 |
* 03/27/2018
|
119 |
* Change: check the option name against an array of allowed values
|
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.16
|
9 |
License: GPLv3
|
10 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
11 |
|
114 |
|
115 |
== Changelog ==
|
116 |
|
117 |
+
= 3.16 =
|
118 |
+
* 04/22/2018
|
119 |
+
* Fix: "The link you followed has expired" on custom code save if the WP Quads Pro plugin is active
|
120 |
+
* Fix: PHP warning for PHP 7.2
|
121 |
+
* Change: add/remove the "Web Designer" role only on activating/deactivating the option in the Settings page
|
122 |
+
|
123 |
= 3.15 =
|
124 |
* 03/27/2018
|
125 |
* Change: check the option name against an array of allowed values
|