Simple Custom CSS and JS - Version 3.4

Version Description

  • 07/11/2017
  • Security fix according to VN: JVN#31459091 / TN: JPCERT#91837758
Download this release

Release Info

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

Code changes from version 2.10 to 3.4

custom-css-js.php CHANGED
@@ -3,11 +3,14 @@
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: 2.10
7
  * Author: Diana Burduja
8
  * Author URI: https://www.silkypress.com/
9
  * License: GPL2
10
  *
 
 
 
11
  */
12
 
13
  if ( ! defined( 'ABSPATH' ) ) {
@@ -15,7 +18,7 @@ if ( ! defined( 'ABSPATH' ) ) {
15
  }
16
 
17
  if ( ! class_exists( 'CustomCSSandJS' ) ) :
18
- define( 'CCJ_VERSION', '2.10' );
19
  /**
20
  * Main CustomCSSandJS Class
21
  *
@@ -50,14 +53,14 @@ final class CustomCSSandJS {
50
  * Cloning is forbidden.
51
  */
52
  public function __clone() {
53
- _doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?' ), '1.0' );
54
  }
55
 
56
  /**
57
  * Unserializing instances of this class is forbidden.
58
  */
59
  public function __wakeup() {
60
- _doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?' ), '1.0' );
61
  }
62
 
63
  /**
@@ -72,6 +75,8 @@ final class CustomCSSandJS {
72
  $this->upload_dir = $wp_upload_dir['basedir'] . '/custom-css-js';
73
  $this->upload_url = $wp_upload_dir['baseurl'] . '/custom-css-js';
74
  if ( is_admin() ) {
 
 
75
  include_once( 'includes/admin-screens.php' );
76
  include_once( 'includes/admin-addons.php' );
77
  include_once( 'includes/admin-warnings.php' );
@@ -98,6 +103,9 @@ final class CustomCSSandJS {
98
  if ( strpos( $_key, 'admin' ) !== false ) {
99
  $action = 'admin_';
100
  }
 
 
 
101
  if ( strpos( $_key, 'header' ) !== false ) {
102
  $action .= 'head';
103
  } else {
@@ -190,45 +198,157 @@ final class CustomCSSandJS {
190
  */
191
  public function register_post_type() {
192
  $labels = array(
193
- 'name' => _x( 'Custom Code', 'post type general name'),
194
- 'singular_name' => _x( 'Custom Code', 'post type singular name'),
195
- 'menu_name' => _x( 'Custom CSS & JS', 'admin menu'),
196
- 'name_admin_bar' => _x( 'Custom Code', 'add new on admin bar'),
197
- 'add_new' => _x( 'Add Custom Code', 'add new'),
198
- 'add_new_item' => __( 'Add Custom Code'),
199
- 'new_item' => __( 'New Custom Code'),
200
- 'edit_item' => __( 'Edit Custom Code'),
201
- 'view_item' => __( 'View Custom Code'),
202
- 'all_items' => __( 'All Custom Code'),
203
- 'search_items' => __( 'Search Custom Code'),
204
- 'parent_item_colon' => __( 'Parent Custom Code:'),
205
- 'not_found' => __( 'No Custom Code found.'),
206
- 'not_found_in_trash' => __( 'No Custom Code found in Trash.')
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
207
  );
208
 
209
  $args = array(
210
- 'labels' => $labels,
211
- 'description' => __( 'Custom CSS and JS code' ),
212
- 'public' => false,
213
- 'publicly_queryable' => false,
214
- 'show_ui' => true,
215
- 'show_in_menu' => true,
216
- 'menu_position' => 100,
217
- 'menu_icon' => 'dashicons-plus-alt',
218
- 'query_var' => false,
219
- 'rewrite' => array( 'slug' => 'custom-css-js' ),
220
- 'capability_type' => 'post',
221
- 'has_archive' => true,
222
- 'hierarchical' => false,
223
- 'exclude_from_search' => true,
224
- 'menu_position' => null,
225
- 'can_export' => false,
226
- 'supports' => array( 'title' )
 
227
  );
228
 
229
  register_post_type( 'custom-css-js', $args );
230
  }
231
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
232
 
233
  }
234
 
@@ -252,9 +372,11 @@ CustomCSSandJS();
252
  function custom_css_js_plugin_action_links( $links ) {
253
 
254
  $settings_link = '<a href="edit.php?post_type=custom-css-js">' .
255
- esc_html( __('Settings' ) ) . '</a>';
256
 
257
  return array_merge( array( $settings_link), $links );
258
 
259
  }
260
  add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), 'custom_css_js_plugin_action_links' );
 
 
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.4
7
  * Author: Diana Burduja
8
  * Author URI: https://www.silkypress.com/
9
  * License: GPL2
10
  *
11
+ * Text Domain: custom-css-js
12
+ * Domain Path: /languages/
13
+ *
14
  */
15
 
16
  if ( ! defined( 'ABSPATH' ) ) {
18
  }
19
 
20
  if ( ! class_exists( 'CustomCSSandJS' ) ) :
21
+ define( 'CCJ_VERSION', '3.4' );
22
  /**
23
  * Main CustomCSSandJS Class
24
  *
53
  * Cloning is forbidden.
54
  */
55
  public function __clone() {
56
+ _doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'custom-css-js' ), '1.0' );
57
  }
58
 
59
  /**
60
  * Unserializing instances of this class is forbidden.
61
  */
62
  public function __wakeup() {
63
+ _doing_it_wrong( __FUNCTION__, __( 'Cheatin&#8217; huh?', 'custom-css-js' ), '1.0' );
64
  }
65
 
66
  /**
75
  $this->upload_dir = $wp_upload_dir['basedir'] . '/custom-css-js';
76
  $this->upload_url = $wp_upload_dir['baseurl'] . '/custom-css-js';
77
  if ( is_admin() ) {
78
+ $this->load_plugin_textdomain();
79
+ add_action('admin_init', array($this, 'create_roles'));
80
  include_once( 'includes/admin-screens.php' );
81
  include_once( 'includes/admin-addons.php' );
82
  include_once( 'includes/admin-warnings.php' );
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 {
198
  */
199
  public function register_post_type() {
200
  $labels = array(
201
+ 'name' => _x( 'Custom Code', 'post type general name', 'custom-css-js'),
202
+ 'singular_name' => _x( 'Custom Code', 'post type singular name', 'custom-css-js'),
203
+ 'menu_name' => _x( 'Custom CSS & JS', 'admin menu', 'custom-css-js'),
204
+ 'name_admin_bar' => _x( 'Custom Code', 'add new on admin bar', 'custom-css-js'),
205
+ 'add_new' => _x( 'Add Custom Code', 'add new', 'custom-css-js'),
206
+ 'add_new_item' => __( 'Add Custom Code', 'custom-css-js'),
207
+ 'new_item' => __( 'New Custom Code', 'custom-css-js'),
208
+ 'edit_item' => __( 'Edit Custom Code', 'custom-css-js'),
209
+ 'view_item' => __( 'View Custom Code', 'custom-css-js'),
210
+ 'all_items' => __( 'All Custom Code', 'custom-css-js'),
211
+ 'search_items' => __( 'Search Custom Code', 'custom-css-js'),
212
+ 'parent_item_colon' => __( 'Parent Custom Code:', 'custom-css-js'),
213
+ 'not_found' => __( 'No Custom Code found.', 'custom-css-js'),
214
+ 'not_found_in_trash' => __( 'No Custom Code found in Trash.', 'custom-css-js')
215
+ );
216
+
217
+ $capability_type = 'custom_css';
218
+ $capabilities = array(
219
+ 'edit_post' => "edit_{$capability_type}",
220
+ 'read_post' => "read_{$capability_type}",
221
+ 'delete_post' => "delete_{$capability_type}",
222
+ 'edit_posts' => "edit_{$capability_type}s",
223
+ 'edit_others_posts' => "edit_others_{$capability_type}s",
224
+ 'publish_posts' => "publish_{$capability_type}s",
225
+ 'read' => "read",
226
+ 'delete_posts' => "delete_{$capability_type}s",
227
+ 'delete_published_posts' => "delete_published_{$capability_type}s",
228
+ 'delete_others_posts' => "delete_others_{$capability_type}s",
229
+ 'edit_published_posts' => "edit_published_{$capability_type}s",
230
+ 'create_posts' => "edit_{$capability_type}s",
231
  );
232
 
233
  $args = array(
234
+ 'labels' => $labels,
235
+ 'description' => __( 'Custom CSS and JS code', 'custom-css-js' ),
236
+ 'public' => false,
237
+ 'publicly_queryable' => false,
238
+ 'show_ui' => true,
239
+ 'show_in_menu' => true,
240
+ 'menu_position' => 100,
241
+ 'menu_icon' => 'dashicons-plus-alt',
242
+ 'query_var' => false,
243
+ 'rewrite' => array( 'slug' => 'custom-css-js' ),
244
+ 'capability_type' => $capability_type,
245
+ 'capabilities' => $capabilities,
246
+ 'has_archive' => true,
247
+ 'hierarchical' => false,
248
+ 'exclude_from_search' => true,
249
+ 'menu_position' => null,
250
+ 'can_export' => false,
251
+ 'supports' => array( 'title' )
252
  );
253
 
254
  register_post_type( 'custom-css-js', $args );
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
+ 'level_9' => true,
282
+ 'level_8' => true,
283
+ 'level_7' => true,
284
+ 'level_6' => true,
285
+ 'level_5' => true,
286
+ 'level_4' => true,
287
+ 'level_3' => true,
288
+ 'level_2' => true,
289
+ 'level_1' => true,
290
+ 'level_0' => true,
291
+ 'read' => true,
292
+ 'read_private_pages' => true,
293
+ 'read_private_posts' => true,
294
+ 'edit_users' => true,
295
+ 'edit_posts' => true,
296
+ 'edit_pages' => true,
297
+ 'edit_published_posts' => true,
298
+ 'edit_published_pages' => true,
299
+ 'edit_private_pages' => true,
300
+ 'edit_private_posts' => true,
301
+ 'edit_others_posts' => true,
302
+ 'edit_others_pages' => true,
303
+ 'publish_posts' => true,
304
+ 'publish_pages' => true,
305
+ 'delete_posts' => true,
306
+ 'delete_pages' => true,
307
+ 'delete_private_pages' => true,
308
+ 'delete_private_posts' => true,
309
+ 'delete_published_pages' => true,
310
+ 'delete_published_posts' => true,
311
+ 'delete_others_posts' => true,
312
+ 'delete_others_pages' => true,
313
+ 'manage_categories' => true,
314
+ 'moderate_comments' => true,
315
+ 'unfiltered_html' => true,
316
+ 'upload_files' => true,
317
+ ) );
318
+
319
+ $capabilities = array();
320
+
321
+ $capability_types = array( 'custom_css' );
322
+
323
+ foreach ( $capability_types as $capability_type ) {
324
+
325
+ $capabilities[ $capability_type ] = array(
326
+ // Post type
327
+ "edit_{$capability_type}",
328
+ "read_{$capability_type}",
329
+ "delete_{$capability_type}",
330
+ "edit_{$capability_type}s",
331
+ "edit_others_{$capability_type}s",
332
+ "publish_{$capability_type}s",
333
+ "delete_{$capability_type}s",
334
+ "delete_published_{$capability_type}s",
335
+ "delete_others_{$capability_type}s",
336
+ "edit_published_{$capability_type}s",
337
+ );
338
+ }
339
+
340
+ foreach ( $capabilities as $cap_group ) {
341
+ foreach ( $cap_group as $cap ) {
342
+ $wp_roles->add_cap( 'css_js_designer', $cap );
343
+ $wp_roles->add_cap( 'administrator', $cap );
344
+ }
345
+ }
346
+ }
347
+
348
+
349
+ public function load_plugin_textdomain() {
350
+ load_plugin_textdomain( 'custom-css-js', false, plugin_basename( dirname( __FILE__ ) ) . '/languages' );
351
+ }
352
 
353
  }
354
 
372
  function custom_css_js_plugin_action_links( $links ) {
373
 
374
  $settings_link = '<a href="edit.php?post_type=custom-css-js">' .
375
+ esc_html( __('Settings', 'custom-css-js' ) ) . '</a>';
376
 
377
  return array_merge( array( $settings_link), $links );
378
 
379
  }
380
  add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), 'custom_css_js_plugin_action_links' );
381
+
382
+
includes/admin-addons.php CHANGED
@@ -39,7 +39,7 @@ class CustomCSSandJS_Addons {
39
  ?>
40
  <div class="ccj_only_premium ccj_only_premium-first">
41
  <div>
42
- <a href="https://www.silkypress.com/simple-custom-css-js-pro/?utm_source=wordpress&utm_campaign=ccj_free&utm_medium=banner" target="_blank">Available only in <br />Simple Custom CSS and JS Pro</a>
43
  </div>
44
  </div>
45
  <?php
@@ -51,9 +51,9 @@ class CustomCSSandJS_Addons {
51
  */
52
  function add_meta_boxes() {
53
 
54
- add_meta_box( 'previewdiv', __('Preview'), array( $this, 'previews_meta_box_callback' ), 'custom-css-js', 'normal' );
55
- add_meta_box( 'url-rules', __('Apply only on these URLs'), array( $this, 'url_rules_meta_box_callback' ), 'custom-css-js', 'normal' );
56
- add_meta_box( 'revisionsdiv', __('Code Revisions'), array( $this, 'revisions_meta_box_callback' ), 'custom-css-js', 'normal' );
57
  }
58
 
59
 
@@ -64,8 +64,8 @@ class CustomCSSandJS_Addons {
64
  ?>
65
  <div id="preview-action">
66
  <div>
67
- <input type="text" name="preview_url" id="ccj-preview_url" placeholder="Full URL on which to preview the changes ..." disabled="disabled" />
68
- <a class="preview button button-primary button-large" id="ccj-preview">Preview Changes</a>
69
  </div>
70
  </div>
71
  <?php
@@ -79,14 +79,14 @@ class CustomCSSandJS_Addons {
79
  function url_rules_meta_box_callback( $post ) {
80
 
81
  $filters = array(
82
- 'all' => __('All Website'),
83
- 'first-page' => __('First page'),
84
- 'contains' => __('Contains'),
85
- 'not-contains' => __('Not contains'),
86
- 'equal-to' => __('Is equal to'),
87
- 'not-equal-to' => __('Not equal to'),
88
- 'begins-with' => __('Starts with'),
89
- 'ends-by' => __('Ends by'),
90
  );
91
  $filters_html = '';
92
  foreach( $filters as $_key => $_value ) {
@@ -97,10 +97,10 @@ class CustomCSSandJS_Addons {
97
 
98
  ?>
99
  <input type="hidden" name="scan_anchor_filters" id="wplnst-scan-anchor-filters" value='<?php echo $applied_filters; ?>' />
100
- <table id="wplnst-elist-anchor-filters" class="wplnst-elist" cellspacing="0" cellpadding="0" border="0" data-editable="true" data-label="<?php _e('URL'); ?>"></table>
101
- <?php _e('URL'); ?> <select id="wplnst-af-new-type"><?php echo $filters_html ?></select>&nbsp;
102
- <input id="wplnst-af-new" type="text" class="regular-text" value="" placeholder="<?php _e('Text filter'); ?>" />&nbsp;
103
- <input class="button button-primary" type="button" id="wplnst-af-new-add" value="<?php _e('Add'); ?>" /></td>
104
 
105
  <?php
106
  }
@@ -133,11 +133,11 @@ class CustomCSSandJS_Addons {
133
  ?>
134
  <table class="revisions">
135
  <thead><tr>
136
- <th class="revisions-compare">Compare</th>
137
- <th>Revision</th>
138
- <th>Author</th>
139
- <th><input type="checkbox" name="delete[]" value="all" id="ccj-delete-checkbox" /> Delete</th>
140
- <th>Restore</th>
141
  </tr></thead>
142
  <tbody>
143
  <?php foreach( $revisions as $revision ) : ?>
@@ -160,17 +160,17 @@ class CustomCSSandJS_Addons {
160
  <input type="checkbox" name="delete[]" value="<?php echo $revision['ID']; ?>" <?php echo $delete_disabled . $delete_tooltip; ?>/>
161
  </td>
162
  <td class="revisions-restore">
163
- <a href="<?php echo $restore_url; ?>"><?php _e('Restore'); ?></a>
164
  </td>
165
  </tr>
166
  <?php endforeach; ?>
167
  <tr>
168
  <td>
169
- <input type="button" class="button-secondary" value="<?php esc_attr_e('Compare'); ?>" id="revisions-compare-button" />
170
  </td>
171
  <td colspan="2"> &nbsp;</td>
172
  <td>
173
- <input type="button" class="button-secondary" value="<?php esc_attr_e('Delete'); ?>" id="revisions-delete-button" />
174
  </td>
175
  <td> &nbsp; </td>
176
  </tr>
39
  ?>
40
  <div class="ccj_only_premium ccj_only_premium-first">
41
  <div>
42
+ <a href="https://www.silkypress.com/simple-custom-css-js-pro/?utm_source=wordpress&utm_campaign=ccj_free&utm_medium=banner" target="_blank"><?php _e('Available only in <br />Simple Custom CSS and JS Pro', 'custom-css-js'); ?></a>
43
  </div>
44
  </div>
45
  <?php
51
  */
52
  function add_meta_boxes() {
53
 
54
+ add_meta_box( 'previewdiv', __('Preview', 'custom-css-js'), array( $this, 'previews_meta_box_callback' ), 'custom-css-js', 'normal' );
55
+ add_meta_box( 'url-rules', __('Apply only on these URLs', 'custom-css-js'), array( $this, 'url_rules_meta_box_callback' ), 'custom-css-js', 'normal' );
56
+ add_meta_box( 'revisionsdiv', __('Code Revisions', 'custom-css-js'), array( $this, 'revisions_meta_box_callback' ), 'custom-css-js', 'normal' );
57
  }
58
 
59
 
64
  ?>
65
  <div id="preview-action">
66
  <div>
67
+ <input type="text" name="preview_url" id="ccj-preview_url" placeholder="<?php _e('Full URL on which to preview the changes ...', 'custom-css-js'); ?>" disabled="disabled" />
68
+ <a class="preview button button-primary button-large" id="ccj-preview"><?php _e('Preview Changes', 'custom-css-js'); ?></a>
69
  </div>
70
  </div>
71
  <?php
79
  function url_rules_meta_box_callback( $post ) {
80
 
81
  $filters = array(
82
+ 'all' => __('All Website', 'custom-css-js'),
83
+ 'first-page' => __('First page', 'custom-css-js'),
84
+ 'contains' => __('Contains', 'custom-css-js'),
85
+ 'not-contains' => __('Not contains', 'custom-css-js'),
86
+ 'equal-to' => __('Is equal to', 'custom-css-js'),
87
+ 'not-equal-to' => __('Not equal to', 'custom-css-js'),
88
+ 'begins-with' => __('Starts with', 'custom-css-js'),
89
+ 'ends-by' => __('Ends by', 'custom-css-js'),
90
  );
91
  $filters_html = '';
92
  foreach( $filters as $_key => $_value ) {
97
 
98
  ?>
99
  <input type="hidden" name="scan_anchor_filters" id="wplnst-scan-anchor-filters" value='<?php echo $applied_filters; ?>' />
100
+ <table id="wplnst-elist-anchor-filters" class="wplnst-elist" cellspacing="0" cellpadding="0" border="0" data-editable="true" data-label="<?php _e('URL', 'custom-css-js'); ?>"></table>
101
+ <?php _e('URL', 'custom-css-js'); ?> <select id="wplnst-af-new-type"><?php echo $filters_html ?></select>&nbsp;
102
+ <input id="wplnst-af-new" type="text" class="regular-text" value="" placeholder="<?php _e('Text filter', 'custom-css-js'); ?>" />&nbsp;
103
+ <input class="button button-primary" type="button" id="wplnst-af-new-add" value="<?php _e('Add', 'custom-css-js'); ?>" /></td>
104
 
105
  <?php
106
  }
133
  ?>
134
  <table class="revisions">
135
  <thead><tr>
136
+ <th class="revisions-compare"><?php _e('Compare', 'custom-css-js'); ?></th>
137
+ <th><?php _e('Revision', 'custom-css-js'); ?></th>
138
+ <th><?php _e('Author', 'custom-css-js'); ?></th>
139
+ <th><input type="checkbox" name="delete[]" value="all" id="ccj-delete-checkbox" /> <?php _e('Delete', 'custom-css-js'); ?></th>
140
+ <th><?php _e('Restore', 'custom-css-js'); ?></th>
141
  </tr></thead>
142
  <tbody>
143
  <?php foreach( $revisions as $revision ) : ?>
160
  <input type="checkbox" name="delete[]" value="<?php echo $revision['ID']; ?>" <?php echo $delete_disabled . $delete_tooltip; ?>/>
161
  </td>
162
  <td class="revisions-restore">
163
+ <a href="<?php echo $restore_url; ?>"><?php _e('Restore', 'custom-css-js'); ?></a>
164
  </td>
165
  </tr>
166
  <?php endforeach; ?>
167
  <tr>
168
  <td>
169
+ <input type="button" class="button-secondary" value="<?php esc_attr_e('Compare', 'custom-css-js'); ?>" id="revisions-compare-button" />
170
  </td>
171
  <td colspan="2"> &nbsp;</td>
172
  <td>
173
+ <input type="button" class="button-secondary" value="<?php esc_attr_e('Delete', 'custom-css-js'); ?>" id="revisions-delete-button" />
174
  </td>
175
  <td> &nbsp; </td>
176
  </tr>
includes/admin-notices.php CHANGED
@@ -44,7 +44,7 @@ class CustomCSSandJS_Notices {
44
 
45
  if ( !isset($screen->post_type) || $screen->post_type !== 'custom-css-js' )
46
  return;
47
-
48
  if ( ! $notice = $this->choose_notice() )
49
  return;
50
 
@@ -86,18 +86,18 @@ class CustomCSSandJS_Notices {
86
  $days_passed = ceil( ( $now - $this->activation_time ) / 86400 );
87
 
88
  switch ( $days_passed ) {
89
- case 1 : return '1_day';
90
- case 2 : return '2_day';
91
- case 3 : break; //return '3_day';
 
92
  case 4 : break;
93
  case 5 : break;
94
- case 6 : break;
95
- case 7 : break; // return '7_day';
96
  case 8 : break;
97
  case 9 : break;
98
  case 10 : break;
99
- case 11 : break;
100
- case 12 : break; //return '12_day';
101
  }
102
  }
103
 
@@ -122,7 +122,7 @@ class CustomCSSandJS_Notices {
122
  $link = 'https://www.silkypress.com/simple-custom-css-js-pro/?a=' . $this->convert_numbers_letters( $this->activation_time ) . '&utm_source=wordpress&utm_campaign=ccj_free&utm_medium=banner';
123
  }
124
 
125
- $lower_part = sprintf( '<div style="margin-top: 7px;"><a href="%s" target="_blank">%s</a> | <a href="#" class="dismiss_notice" target="_parent">%s</a></div>', $link, 'Get your discount now', 'Dismiss this notice' );
126
 
127
  switch ( $notice ) {
128
  case '1_day' :
44
 
45
  if ( !isset($screen->post_type) || $screen->post_type !== 'custom-css-js' )
46
  return;
47
+
48
  if ( ! $notice = $this->choose_notice() )
49
  return;
50
 
86
  $days_passed = ceil( ( $now - $this->activation_time ) / 86400 );
87
 
88
  switch ( $days_passed ) {
89
+ case 0 : return '1_day';
90
+ case 1 : return '2_day';
91
+ case 2 : break; //return '3_day';
92
+ case 3 : break;
93
  case 4 : break;
94
  case 5 : break;
95
+ case 6 : break; // return '7_day';
96
+ case 7 : break;
97
  case 8 : break;
98
  case 9 : break;
99
  case 10 : break;
100
+ case 11 : break; //return '12_day';
 
101
  }
102
  }
103
 
122
  $link = 'https://www.silkypress.com/simple-custom-css-js-pro/?a=' . $this->convert_numbers_letters( $this->activation_time ) . '&utm_source=wordpress&utm_campaign=ccj_free&utm_medium=banner';
123
  }
124
 
125
+ $lower_part = sprintf( '<div style="margin-top: 7px;"><a href="%s" target="_blank">%s</a> | <a href="#" class="dismiss_notice" target="_parent">%s</a></div>', $link, __('Get your discount now', 'custom-css-js'), __('Dismiss this notice', 'custom-css-js') );
126
 
127
  switch ( $notice ) {
128
  case '1_day' :
includes/admin-screens.php CHANGED
@@ -89,16 +89,17 @@ class CustomCSSandJS_Admin {
89
  $menu_slug = 'edit.php?post_type=custom-css-js';
90
  $submenu_slug = 'post-new.php?post_type=custom-css-js';
91
 
92
- $title = __('Add Custom CSS');
93
- add_submenu_page( $menu_slug, $title, $title, 'manage_options', $submenu_slug .'&language=css');
94
 
95
- $title = __('Add Custom JS');
96
- add_submenu_page( $menu_slug, $title, $title, 'manage_options', $submenu_slug . '&language=js');
97
 
98
- $title = __('Add Custom HTML');
99
- add_submenu_page( $menu_slug, $title, $title, 'manage_options', $submenu_slug . '&language=html');
 
 
 
100
 
101
- remove_submenu_page( $menu_slug, $submenu_slug);
102
  }
103
 
104
 
@@ -173,6 +174,7 @@ class CustomCSSandJS_Admin {
173
  'advanced-ads-code-highlighter/advanced-ads-code-highlighter.php',
174
  'wp-custom-backend-css/wp-custom-backend-css.php',
175
  'custom-css-whole-site-and-per-post/h5ab-custom-styling.php',
 
176
  );
177
 
178
  foreach( $conflicting_plugins as $_plugin ) {
@@ -185,7 +187,7 @@ class CustomCSSandJS_Admin {
185
  }
186
 
187
  public function add_meta_boxes() {
188
- add_meta_box('custom-code-options', __('Options'), array( $this, 'custom_code_options_meta_box_callback'), 'custom-css-js', 'side', 'low');
189
 
190
  remove_meta_box( 'slugdiv', 'custom-css-js', 'normal' );
191
  }
@@ -245,9 +247,9 @@ class CustomCSSandJS_Admin {
245
  }
246
  ?>
247
  <div class="updated buttons">
248
- <a href="post-new.php?post_type=custom-css-js&language=css" class="custom-btn custom-css-btn">Add CSS code</a>
249
- <a href="post-new.php?post_type=custom-css-js&language=js" class="custom-btn custom-js-btn">Add JS code</a>
250
- <a href="post-new.php?post_type=custom-css-js&language=html" class="custom-btn custom-js-btn">Add HTML code</a>
251
  <!-- a href="post-new.php?post_type=custom-css-js&language=php" class="custom-btn custom-php-btn">Add PHP code</a -->
252
  </div>
253
  <?php
@@ -260,13 +262,13 @@ class CustomCSSandJS_Admin {
260
  */
261
  function manage_custom_posts_columns( $columns ) {
262
  return array(
263
- 'cb' => '<input type="checkbox" />',
264
- 'active' => '<span class="ccj-dashicons dashicons dashicons-star-empty" title="Active"></span>',
265
- 'type' => 'Type',
266
- 'title' => 'Title',
267
- 'author' => 'Author',
268
- 'date' => 'Date',
269
- 'modified' => 'Modified',
270
  );
271
  }
272
 
@@ -305,11 +307,13 @@ class CustomCSSandJS_Admin {
305
 
306
  if ( $column == 'active' ) {
307
  $url = wp_nonce_url( admin_url( 'admin-ajax.php?action=ccj_active_code&code_id=' . $post_id ), 'ccj-active-code' );
308
- echo '<a href="' . esc_url( $url ) . '" title="'. __( 'Toggle active' ) . '">';
309
  if ( $this->is_active( $post_id ) ) {
310
- echo '<span class="dashicons dashicons-star-filled" title="The code is active. Click to inactivate it"></span>';
 
311
  } else {
312
- echo '<span class="dashicons dashicons-star-empty ccj_row" title="The code is inactive. Click to activate it"></span>';
 
313
  }
314
  echo '</a>';
315
 
@@ -359,10 +363,10 @@ class CustomCSSandJS_Admin {
359
  <script type="text/javascript">
360
  /* <![CDATA[ */
361
  jQuery(window).ready(function($){
362
- var h1 = 'Custom Code ';
363
- h1 += '<a href="post-new.php?post_type=custom-css-js&language=css" class="page-title-action">Add CSS Code</a>';
364
- h1 += '<a href="post-new.php?post_type=custom-css-js&language=js" class="page-title-action">Add JS Code</a>';
365
- h1 += '<a href="post-new.php?post_type=custom-css-js&language=html" class="page-title-action">Add HTML Code</a>';
366
  $("#wpbody-content h1").html(h1);
367
  });
368
 
@@ -371,7 +375,6 @@ class CustomCSSandJS_Admin {
371
  }
372
 
373
 
374
-
375
  /**
376
  * Reformat the `post` screen
377
  */
@@ -381,19 +384,19 @@ class CustomCSSandJS_Admin {
381
 
382
  if ( isset( $_GET['post'] ) ) {
383
  $action = 'Edit';
384
- $language = $this->get_options( $_GET['post'] );
385
- $language = $language['language'];
386
  } else {
387
  $action = 'Add';
388
- $language = isset( $_GET['language'] ) ? $_GET['language'] : 'css';
389
  }
 
390
 
391
  $title = $action . ' ' . strtoupper( $language ) . ' code';
392
 
393
  if ( $action == 'Edit' ) {
394
- $title .= ' <a href="post-new.php?post_type=custom-css-js&language=css" class="page-title-action">Add CSS Code</a> ';
395
- $title .= '<a href="post-new.php?post_type=custom-css-js&language=js" class="page-title-action">Add JS Code</a>';
396
- $title .= '<a href="post-new.php?post_type=custom-css-js&language=html" class="page-title-action">Add HTML Code</a>';
397
  }
398
 
399
  ?>
@@ -401,7 +404,7 @@ class CustomCSSandJS_Admin {
401
  /* <![CDATA[ */
402
  jQuery(window).ready(function($){
403
  $("#wpbody-content h1").html('<?php echo $title; ?>');
404
- $("#message.updated.notice").html('<p>Code updated</p>');
405
 
406
  var from_top = -$("#normal-sortables").height();
407
  if ( from_top != 0 ) {
@@ -432,6 +435,7 @@ class CustomCSSandJS_Admin {
432
  function remove_unallowed_metaboxes() {
433
  global $wp_meta_boxes;
434
 
 
435
  $allowed = array( 'submitdiv', 'custom-code-options' );
436
 
437
  $allowed = apply_filters( 'custom-css-js-meta-boxes', $allowed );
@@ -443,6 +447,19 @@ class CustomCSSandJS_Admin {
443
  }
444
  }
445
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
446
  }
447
 
448
 
@@ -459,18 +476,18 @@ class CustomCSSandJS_Admin {
459
 
460
  if ( empty( $post->title ) && empty( $post->post_content ) ) {
461
  $new_post = true;
462
- $language = isset( $_GET['language'] ) ? $_GET['language'] : 'css';
463
  } else {
464
  $new_post = false;
465
  if ( ! isset( $_GET['post'] ) ) $_GET['post'] = $post->id;
466
- $language = $this->get_options( $_GET['post'] );
467
- $language = $language['language'];
468
  }
 
469
 
470
  switch ( $language ) {
471
  case 'js' :
472
  if ( $new_post ) {
473
- $post->post_content = '/* Add your JavaScript code here.
474
 
475
  If you are using the jQuery library, then don\'t forget to wrap your code inside jQuery.ready() as follows:
476
 
@@ -478,7 +495,7 @@ jQuery(document).ready(function( $ ){
478
  // Your code in here
479
  });
480
 
481
- End of comment */ ' . PHP_EOL . PHP_EOL;
482
  }
483
  $code_mirror_mode = 'text/javascript';
484
  $code_mirror_before = '<script type="text/javascript">';
@@ -486,7 +503,7 @@ End of comment */ ' . PHP_EOL . PHP_EOL;
486
  break;
487
  case 'html' :
488
  if ( $new_post ) {
489
- $post->post_content = '<!-- Add HTML code to the header or the footer.
490
 
491
  For example, you can use the following code for loading the jQuery library from Google CDN:
492
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
@@ -494,7 +511,7 @@ For example, you can use the following code for loading the jQuery library from
494
  or the following one for loading the Bootstrap library from MaxCDN:
495
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
496
 
497
- -- End of the comment --> ' . PHP_EOL . PHP_EOL;
498
  }
499
  $code_mirror_mode = 'html';
500
  $code_mirror_before = '';
@@ -512,7 +529,7 @@ or the following one for loading the Bootstrap library from MaxCDN:
512
  break;
513
  default :
514
  if ( $new_post ) {
515
- $post->post_content = '/* Add your CSS code here.
516
 
517
  For example:
518
  .example {
@@ -521,7 +538,7 @@ For example:
521
 
522
  For brushing up on your CSS knowledge, check out http://www.w3schools.com/css/css_syntax.asp
523
 
524
- End of comment */ ' . PHP_EOL . PHP_EOL;
525
 
526
  }
527
  $code_mirror_mode = 'text/css';
@@ -534,7 +551,7 @@ End of comment */ ' . PHP_EOL . PHP_EOL;
534
  <form style="position: relative; margin-top: .5em;">
535
 
536
  <div class="code-mirror-before"><div><?php echo htmlentities( $code_mirror_before );?></div></div>
537
- <textarea class="wp-editor-area" id="content" mode="<?php echo htmlentities($code_mirror_mode); ?>" name="content"><?php echo htmlentities($post->post_content); ?></textarea>
538
  <div class="code-mirror-after"><div><?php echo htmlentities( $code_mirror_after );?></div></div>
539
 
540
  <input type="hidden" id="update-post_<?php echo $post->ID ?>" value="<?php echo wp_create_nonce('update-post_'. $post->ID ); ?>" />
@@ -556,7 +573,7 @@ End of comment */ ' . PHP_EOL . PHP_EOL;
556
 
557
 
558
  if ( isset( $_GET['language'] ) ) {
559
- $options['language'] = $_GET['language'];
560
  }
561
 
562
  $meta = $this->get_options_meta();
@@ -611,7 +628,7 @@ End of comment */ ' . PHP_EOL . PHP_EOL;
611
 
612
  <div class="ccj_only_premium ccj_only_premium-right">
613
  <div>
614
- <a href="https://www.silkypress.com/simple-custom-css-js-pro/?utm_source=wordpress&utm_campaign=ccj_free&utm_medium=banner" target="_blank">Available only in <br />Simple Custom CSS and JS Pro</a>
615
  </div>
616
  </div>
617
 
@@ -626,81 +643,85 @@ End of comment */ ' . PHP_EOL . PHP_EOL;
626
  function get_options_meta() {
627
  $options = array(
628
  'linking' => array(
629
- 'title' => 'Linking type',
630
  'type' => 'radio',
631
  'default' => 'internal',
632
  'values' => array(
633
  'external' => array(
634
- 'title' => 'External File',
635
  'dashicon' => 'media-code',
636
  ),
637
  'internal' => array(
638
- 'title' => 'Internal',
639
  'dashicon' => 'editor-alignleft',
640
  ),
641
  ),
642
  ),
643
  'type' => array(
644
- 'title' => 'Where on page',
645
  'type' => 'radio',
646
  'default' => 'header',
647
  'values' => array(
648
  'header' => array(
649
- 'title' => 'Header',
650
  'dashicon' => 'arrow-up-alt2',
651
  ),
652
  'footer' => array(
653
- 'title' => 'Footer',
654
  'dashicon' => 'arrow-down-alt2',
655
  ),
656
  ),
657
  ),
658
  'side' => array(
659
- 'title' => 'Where in site',
660
  'type' => 'radio',
661
  'default' => 'frontend',
662
  'values' => array(
663
  'frontend' => array(
664
- 'title' => 'In Frontend',
665
  'dashicon' => 'tagcloud',
666
  ),
667
  'admin' => array(
668
- 'title' => 'In Admin',
669
  'dashicon' => 'id',
670
  ),
 
 
 
 
671
  ),
672
  ),
673
  'preprocessor' => array(
674
- 'title' => 'CSS Preprocessor',
675
  'type' => 'radio',
676
  'default' => 'none',
677
  'values' => array(
678
  'none' => array(
679
- 'title' => 'None',
680
  ),
681
  'less' => array(
682
- 'title' => 'Less',
683
  ),
684
  'sass' => array(
685
- 'title' => 'SASS (only SCSS syntax)',
686
  ),
687
  ),
688
  'disabled' => true,
689
  ),
690
  'minify' => array(
691
- 'title' => 'Minify the code',
692
  'type' => 'checkbox',
693
  'default' => false,
694
  'dashicon' => 'editor-contract',
695
  'disabled' => true,
696
  ),
697
  'priority' => array(
698
- 'title' => 'Priority',
699
  'type' => 'select',
700
  'default' => 5,
701
  'dashicon' => 'sort',
702
  'values' => array(
703
- 1 => '1 (highest)',
704
  2 => '2',
705
  3 => '3',
706
  4 => '4',
@@ -709,7 +730,7 @@ End of comment */ ' . PHP_EOL . PHP_EOL;
709
  7 => '7',
710
  8 => '8',
711
  9 => '9',
712
- 10 => '10 (lowest)',
713
  ),
714
  'disabled' => true,
715
  ),
@@ -725,63 +746,63 @@ End of comment */ ' . PHP_EOL . PHP_EOL;
725
  function get_options_meta_html() {
726
  $options = array(
727
  'type' => array(
728
- 'title' => 'Where on page',
729
  'type' => 'radio',
730
  'default' => 'header',
731
  'values' => array(
732
  'header' => array(
733
- 'title' => 'Header',
734
  'dashicon' => 'arrow-up-alt2',
735
  ),
736
  'footer' => array(
737
- 'title' => 'Footer',
738
  'dashicon' => 'arrow-down-alt2',
739
  ),
740
  ),
741
  ),
742
  'side' => array(
743
- 'title' => 'Where in site',
744
  'type' => 'radio',
745
  'default' => 'frontend',
746
  'values' => array(
747
  'frontend' => array(
748
- 'title' => 'In Frontend',
749
  'dashicon' => 'tagcloud',
750
  ),
751
  'admin' => array(
752
- 'title' => 'In Admin',
753
  'dashicon' => 'id',
754
  ),
755
  ),
756
  ),
757
  'linking' => array(
758
- 'title' => 'On which device',
759
  'type' => 'radio',
760
  'default' => 'both',
761
  'dashicon' => '',
762
  'values' => array(
763
  'desktop' => array(
764
- 'title' => 'Desktop',
765
  'dashicon' => 'desktop',
766
  ),
767
  'mobile' => array(
768
- 'title' => 'Mobile',
769
  'dashicon' => 'smartphone',
770
  ),
771
  'both' => array(
772
- 'title' => 'Both',
773
  'dashicon' => 'tablet',
774
  ),
775
  ),
776
  'disabled' => true,
777
  ),
778
  'priority' => array(
779
- 'title' => 'Priority',
780
  'type' => 'select',
781
  'default' => 5,
782
  'dashicon' => 'sort',
783
  'values' => array(
784
- 1 => '1 (highest)',
785
  2 => '2',
786
  3 => '3',
787
  4 => '4',
@@ -790,7 +811,7 @@ End of comment */ ' . PHP_EOL . PHP_EOL;
790
  7 => '7',
791
  8 => '8',
792
  9 => '9',
793
- 10 => '10 (lowest)',
794
  ),
795
  'disabled' => true,
796
  ),
@@ -843,7 +864,7 @@ End of comment */ ' . PHP_EOL . PHP_EOL;
843
  }
844
 
845
  foreach( $defaults as $_field => $_default ) {
846
- $options[ $_field ] = isset( $_POST['custom_code_'.$_field] ) ? $_POST['custom_code_'.$_field] : $_default;
847
  }
848
 
849
  update_post_meta( $post_id, 'options', $options );
@@ -912,8 +933,8 @@ End of comment */ ' . PHP_EOL . PHP_EOL;
912
  // Show a message if it couldn't create the dir
913
  if ( ! file_exists( $dir ) ) : ?>
914
  <div class="notice notice-error is-dismissible">
915
- <p>The <b>custom-css-js</b> directory could not be created</p>
916
- <p>Please run the following commands in order to make the directory: <br /><strong>mkdir <?php echo $dir; ?>; </strong><br /><strong>chmod 777 <?php echo $dir; ?>;</strong></p>
917
  </div>
918
  <?php return; endif;
919
 
@@ -921,8 +942,8 @@ End of comment */ ' . PHP_EOL . PHP_EOL;
921
  // Show a message if the dir is not writable
922
  if ( ! wp_is_writable( $dir ) ) : ?>
923
  <div class="notice notice-error is-dismissible">
924
- <p>The <b><?php echo $dir; ?></b> directory is not writable, therefore the CSS and JS files cannot be saved.</p>
925
- <p>Please run the following command to make the directory writable:<br /><strong>chmod 777 <?php echo $dir; ?> </strong></p>
926
  </div>
927
  <?php return; endif;
928
 
@@ -1048,6 +1069,20 @@ End of comment */ ' . PHP_EOL . PHP_EOL;
1048
  }
1049
 
1050
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1051
  }
1052
 
1053
  return new CustomCSSandJS_Admin();
89
  $menu_slug = 'edit.php?post_type=custom-css-js';
90
  $submenu_slug = 'post-new.php?post_type=custom-css-js';
91
 
92
+ remove_submenu_page( $menu_slug, $submenu_slug);
 
93
 
94
+ $title = __('Add Custom CSS', 'custom-css-js');
95
+ add_submenu_page( $menu_slug, $title, $title, 'publish_custom_csss', $submenu_slug .'&language=css');
96
 
97
+ $title = __('Add Custom JS', 'custom-css-js');
98
+ add_submenu_page( $menu_slug, $title, $title, 'publish_custom_csss', $submenu_slug . '&language=js');
99
+
100
+ $title = __('Add Custom HTML', 'custom-css-js');
101
+ add_submenu_page( $menu_slug, $title, $title, 'publish_custom_csss', $submenu_slug . '&language=html');
102
 
 
103
  }
104
 
105
 
174
  'advanced-ads-code-highlighter/advanced-ads-code-highlighter.php',
175
  'wp-custom-backend-css/wp-custom-backend-css.php',
176
  'custom-css-whole-site-and-per-post/h5ab-custom-styling.php',
177
+ 'html-editor-syntax-highlighter/html-editor-syntax-highlighter.php',
178
  );
179
 
180
  foreach( $conflicting_plugins as $_plugin ) {
187
  }
188
 
189
  public function add_meta_boxes() {
190
+ add_meta_box('custom-code-options', __('Options', 'custom-css-js'), array( $this, 'custom_code_options_meta_box_callback'), 'custom-css-js', 'side', 'low');
191
 
192
  remove_meta_box( 'slugdiv', 'custom-css-js', 'normal' );
193
  }
247
  }
248
  ?>
249
  <div class="updated buttons">
250
+ <a href="post-new.php?post_type=custom-css-js&language=css" class="custom-btn custom-css-btn"><?php _e('Add CSS code', 'custom-css-js'); ?></a>
251
+ <a href="post-new.php?post_type=custom-css-js&language=js" class="custom-btn custom-js-btn"><?php _e('Add JS code', 'custom-css-js'); ?></a>
252
+ <a href="post-new.php?post_type=custom-css-js&language=html" class="custom-btn custom-js-btn"><?php _e('Add HTML code', 'custom-css-js'); ?></a>
253
  <!-- a href="post-new.php?post_type=custom-css-js&language=php" class="custom-btn custom-php-btn">Add PHP code</a -->
254
  </div>
255
  <?php
262
  */
263
  function manage_custom_posts_columns( $columns ) {
264
  return array(
265
+ 'cb' => '<input type="checkbox" />',
266
+ 'active' => '<span class="ccj-dashicons dashicons dashicons-star-empty" title="'.__('Active', 'custom-css-js') .'"></span>',
267
+ 'type' => __('Type', 'custom-css-js'),
268
+ 'title' => __('Title', 'custom-css-js'),
269
+ 'author' => __('Author', 'custom-css-js'),
270
+ 'date' => __('Date', 'custom-css-js'),
271
+ 'modified' => __('Modified', 'custom-css-js'),
272
  );
273
  }
274
 
307
 
308
  if ( $column == 'active' ) {
309
  $url = wp_nonce_url( admin_url( 'admin-ajax.php?action=ccj_active_code&code_id=' . $post_id ), 'ccj-active-code' );
310
+ echo '<a href="' . esc_url( $url ) . '" title="'. __( 'Toggle active', 'custom-css-js' ) . '">';
311
  if ( $this->is_active( $post_id ) ) {
312
+ $active_title = __('The code is active. Click to deactivate it', 'custom-css-js');
313
+ echo '<span class="dashicons dashicons-star-filled" title="'.$active_title.'"></span>';
314
  } else {
315
+ $active_title = __('The code is inactive. Click to activate it', 'custom-css-js');
316
+ echo '<span class="dashicons dashicons-star-empty ccj_row" title="'.$active_title.'"></span>';
317
  }
318
  echo '</a>';
319
 
363
  <script type="text/javascript">
364
  /* <![CDATA[ */
365
  jQuery(window).ready(function($){
366
+ var h1 = '<?php _e('Custom Code', 'custom-css-js'); ?> ';
367
+ h1 += '<a href="post-new.php?post_type=custom-css-js&language=css" class="page-title-action"><?php _e('Add CSS Code', 'custom-css-js'); ?></a>';
368
+ h1 += '<a href="post-new.php?post_type=custom-css-js&language=js" class="page-title-action"><?php _e('Add JS Code', 'custom-css-js'); ?></a>';
369
+ h1 += '<a href="post-new.php?post_type=custom-css-js&language=html" class="page-title-action"><?php _e('Add HTML Code', 'custom-css-js'); ?></a>';
370
  $("#wpbody-content h1").html(h1);
371
  });
372
 
375
  }
376
 
377
 
 
378
  /**
379
  * Reformat the `post` screen
380
  */
384
 
385
  if ( isset( $_GET['post'] ) ) {
386
  $action = 'Edit';
387
+ $post_id = esc_attr($_GET['post']);
 
388
  } else {
389
  $action = 'Add';
390
+ $post_id = false;
391
  }
392
+ $language = $this->get_language($post_id);
393
 
394
  $title = $action . ' ' . strtoupper( $language ) . ' code';
395
 
396
  if ( $action == 'Edit' ) {
397
+ $title .= ' <a href="post-new.php?post_type=custom-css-js&language=css" class="page-title-action">'.__('Add CSS Code', 'custom-css-js') .'</a> ';
398
+ $title .= '<a href="post-new.php?post_type=custom-css-js&language=js" class="page-title-action">'.__('Add JS Code', 'custom-css-js') .'</a>';
399
+ $title .= '<a href="post-new.php?post_type=custom-css-js&language=html" class="page-title-action">'.__('Add HTML Code', 'custom-css-js') .'</a>';
400
  }
401
 
402
  ?>
404
  /* <![CDATA[ */
405
  jQuery(window).ready(function($){
406
  $("#wpbody-content h1").html('<?php echo $title; ?>');
407
+ $("#message.updated.notice").html('<p><?php _e('Code updated', 'custom-css-js'); ?></p>');
408
 
409
  var from_top = -$("#normal-sortables").height();
410
  if ( from_top != 0 ) {
435
  function remove_unallowed_metaboxes() {
436
  global $wp_meta_boxes;
437
 
438
+ // Side boxes
439
  $allowed = array( 'submitdiv', 'custom-code-options' );
440
 
441
  $allowed = apply_filters( 'custom-css-js-meta-boxes', $allowed );
447
  }
448
  }
449
  }
450
+
451
+ // Normal boxes
452
+ $allowed = array( 'slugdiv', 'previewdiv', 'url-rules', 'revisionsdiv' );
453
+
454
+ $allowed = apply_filters( 'custom-css-js-meta-boxes-normal', $allowed );
455
+
456
+ foreach( $wp_meta_boxes['custom-css-js']['normal'] as $_priority => $_boxes ) {
457
+ foreach( $_boxes as $_key => $_value ) {
458
+ if ( ! in_array( $_key, $allowed ) ) {
459
+ unset( $wp_meta_boxes['custom-css-js']['normal'][$_priority][$_key] );
460
+ }
461
+ }
462
+ }
463
  }
464
 
465
 
476
 
477
  if ( empty( $post->title ) && empty( $post->post_content ) ) {
478
  $new_post = true;
479
+ $post_id = false;
480
  } else {
481
  $new_post = false;
482
  if ( ! isset( $_GET['post'] ) ) $_GET['post'] = $post->id;
483
+ $post_id = esc_attr($_GET['post']);
 
484
  }
485
+ $language = $this->get_language($post_id);
486
 
487
  switch ( $language ) {
488
  case 'js' :
489
  if ( $new_post ) {
490
+ $post->post_content = __('/* Add your JavaScript code here.
491
 
492
  If you are using the jQuery library, then don\'t forget to wrap your code inside jQuery.ready() as follows:
493
 
495
  // Your code in here
496
  });
497
 
498
+ End of comment */ ', 'custom-css-js') . PHP_EOL . PHP_EOL;
499
  }
500
  $code_mirror_mode = 'text/javascript';
501
  $code_mirror_before = '<script type="text/javascript">';
503
  break;
504
  case 'html' :
505
  if ( $new_post ) {
506
+ $post->post_content = __('<!-- Add HTML code to the header or the footer.
507
 
508
  For example, you can use the following code for loading the jQuery library from Google CDN:
509
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
511
  or the following one for loading the Bootstrap library from MaxCDN:
512
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
513
 
514
+ -- End of the comment --> ', 'custom-css-js') . PHP_EOL . PHP_EOL;
515
  }
516
  $code_mirror_mode = 'html';
517
  $code_mirror_before = '';
529
  break;
530
  default :
531
  if ( $new_post ) {
532
+ $post->post_content = __('/* Add your CSS code here.
533
 
534
  For example:
535
  .example {
538
 
539
  For brushing up on your CSS knowledge, check out http://www.w3schools.com/css/css_syntax.asp
540
 
541
+ End of comment */ ', 'custom-css-js') . PHP_EOL . PHP_EOL;
542
 
543
  }
544
  $code_mirror_mode = 'text/css';
551
  <form style="position: relative; margin-top: .5em;">
552
 
553
  <div class="code-mirror-before"><div><?php echo htmlentities( $code_mirror_before );?></div></div>
554
+ <textarea class="wp-editor-area" id="content" mode="<?php echo htmlentities($code_mirror_mode); ?>" name="content"><?php echo $post->post_content; ?></textarea>
555
  <div class="code-mirror-after"><div><?php echo htmlentities( $code_mirror_after );?></div></div>
556
 
557
  <input type="hidden" id="update-post_<?php echo $post->ID ?>" value="<?php echo wp_create_nonce('update-post_'. $post->ID ); ?>" />
573
 
574
 
575
  if ( isset( $_GET['language'] ) ) {
576
+ $options['language'] = $this->get_language();
577
  }
578
 
579
  $meta = $this->get_options_meta();
628
 
629
  <div class="ccj_only_premium ccj_only_premium-right">
630
  <div>
631
+ <a href="https://www.silkypress.com/simple-custom-css-js-pro/?utm_source=wordpress&utm_campaign=ccj_free&utm_medium=banner" target="_blank"><?php _e('Available only in <br />Simple Custom CSS and JS Pro', 'custom-css-js'); ?></a>
632
  </div>
633
  </div>
634
 
643
  function get_options_meta() {
644
  $options = array(
645
  'linking' => array(
646
+ 'title' => __('Linking type', 'custom-css-js'),
647
  'type' => 'radio',
648
  'default' => 'internal',
649
  'values' => array(
650
  'external' => array(
651
+ 'title' => __('External File', 'custom-css-js'),
652
  'dashicon' => 'media-code',
653
  ),
654
  'internal' => array(
655
+ 'title' => __('Internal', 'custom-css-js'),
656
  'dashicon' => 'editor-alignleft',
657
  ),
658
  ),
659
  ),
660
  'type' => array(
661
+ 'title' => __('Where on page', 'custom-css-js'),
662
  'type' => 'radio',
663
  'default' => 'header',
664
  'values' => array(
665
  'header' => array(
666
+ 'title' => __('Header', 'custom-css-js'),
667
  'dashicon' => 'arrow-up-alt2',
668
  ),
669
  'footer' => array(
670
+ 'title' => __('Footer', 'custom-css-js'),
671
  'dashicon' => 'arrow-down-alt2',
672
  ),
673
  ),
674
  ),
675
  'side' => array(
676
+ 'title' => __('Where in site', 'custom-css-js'),
677
  'type' => 'radio',
678
  'default' => 'frontend',
679
  'values' => array(
680
  'frontend' => array(
681
+ 'title' => __('In Frontend', 'custom-css-js'),
682
  'dashicon' => 'tagcloud',
683
  ),
684
  'admin' => array(
685
+ 'title' => __('In Admin', 'custom-css-js'),
686
  'dashicon' => 'id',
687
  ),
688
+ 'login' => array(
689
+ 'title' => __('On Login Page', 'custom-css-js'),
690
+ 'dashicon' => 'admin-network',
691
+ ),
692
  ),
693
  ),
694
  'preprocessor' => array(
695
+ 'title' => __('CSS Preprocessor', 'custom-css-js'),
696
  'type' => 'radio',
697
  'default' => 'none',
698
  'values' => array(
699
  'none' => array(
700
+ 'title' => __('None', 'custom-css-js'),
701
  ),
702
  'less' => array(
703
+ 'title' => __('Less', 'custom-css-js'),
704
  ),
705
  'sass' => array(
706
+ 'title' => __('SASS (only SCSS syntax)', 'custom-css-js'),
707
  ),
708
  ),
709
  'disabled' => true,
710
  ),
711
  'minify' => array(
712
+ 'title' => __('Minify the code', 'custom-css-js'),
713
  'type' => 'checkbox',
714
  'default' => false,
715
  'dashicon' => 'editor-contract',
716
  'disabled' => true,
717
  ),
718
  'priority' => array(
719
+ 'title' => __('Priority', 'custom-css-js'),
720
  'type' => 'select',
721
  'default' => 5,
722
  'dashicon' => 'sort',
723
  'values' => array(
724
+ 1 => _x('1 (highest)', '1 is the highest priority', 'custom-css-js'),
725
  2 => '2',
726
  3 => '3',
727
  4 => '4',
730
  7 => '7',
731
  8 => '8',
732
  9 => '9',
733
+ 10 => _x('10 (lowest)', '10 is the lowest priority', 'custom-css-js'),
734
  ),
735
  'disabled' => true,
736
  ),
746
  function get_options_meta_html() {
747
  $options = array(
748
  'type' => array(
749
+ 'title' => __('Where on page', 'custom-css-js'),
750
  'type' => 'radio',
751
  'default' => 'header',
752
  'values' => array(
753
  'header' => array(
754
+ 'title' => __('Header', 'custom-css-js'),
755
  'dashicon' => 'arrow-up-alt2',
756
  ),
757
  'footer' => array(
758
+ 'title' => __('Footer', 'custom-css-js'),
759
  'dashicon' => 'arrow-down-alt2',
760
  ),
761
  ),
762
  ),
763
  'side' => array(
764
+ 'title' => __('Where in site', 'custom-css-js'),
765
  'type' => 'radio',
766
  'default' => 'frontend',
767
  'values' => array(
768
  'frontend' => array(
769
+ 'title' => __('In Frontend', 'custom-css-js'),
770
  'dashicon' => 'tagcloud',
771
  ),
772
  'admin' => array(
773
+ 'title' => __('In Admin', 'custom-css-js'),
774
  'dashicon' => 'id',
775
  ),
776
  ),
777
  ),
778
  'linking' => array(
779
+ 'title' => __('On which device', 'custom-css-js'),
780
  'type' => 'radio',
781
  'default' => 'both',
782
  'dashicon' => '',
783
  'values' => array(
784
  'desktop' => array(
785
+ 'title' => __('Desktop', 'custom-css-js'),
786
  'dashicon' => 'desktop',
787
  ),
788
  'mobile' => array(
789
+ 'title' => __('Mobile', 'custom-css-js'),
790
  'dashicon' => 'smartphone',
791
  ),
792
  'both' => array(
793
+ 'title' => __('Both', 'custom-css-js'),
794
  'dashicon' => 'tablet',
795
  ),
796
  ),
797
  'disabled' => true,
798
  ),
799
  'priority' => array(
800
+ 'title' => __('Priority', 'custom-css-js'),
801
  'type' => 'select',
802
  'default' => 5,
803
  'dashicon' => 'sort',
804
  'values' => array(
805
+ 1 => _x('1 (highest)', '1 is the highest priority', 'custom-css-js'),
806
  2 => '2',
807
  3 => '3',
808
  4 => '4',
811
  7 => '7',
812
  8 => '8',
813
  9 => '9',
814
+ 10 => _x('10 (lowest)', '10 is the lowest priority', 'custom-css-js'),
815
  ),
816
  'disabled' => true,
817
  ),
864
  }
865
 
866
  foreach( $defaults as $_field => $_default ) {
867
+ $options[ $_field ] = isset( $_POST['custom_code_'.$_field] ) ? esc_attr($_POST['custom_code_'.$_field]) : $_default;
868
  }
869
 
870
  update_post_meta( $post_id, 'options', $options );
933
  // Show a message if it couldn't create the dir
934
  if ( ! file_exists( $dir ) ) : ?>
935
  <div class="notice notice-error is-dismissible">
936
+ <p><?php printf(__('The %s directory could not be created', 'custom-css-js'), '<b>custom-css-js</b>'); ?></p>
937
+ <p><?php _e('Please run the following commands in order to make the directory', 'custom-css-js'); ?>: <br /><strong>mkdir <?php echo $dir; ?>; </strong><br /><strong>chmod 777 <?php echo $dir; ?>;</strong></p>
938
  </div>
939
  <?php return; endif;
940
 
942
  // Show a message if the dir is not writable
943
  if ( ! wp_is_writable( $dir ) ) : ?>
944
  <div class="notice notice-error is-dismissible">
945
+ <p><?php printf(__('The %s directory is not writable, therefore the CSS and JS files cannot be saved.', 'custom-css-js'), '<b>'.$dir.'</b>'); ?></p>
946
+ <p><?php _e('Please run the following command to make the directory writable', 'custom-css-js'); ?>:<br /><strong>chmod 777 <?php echo $dir; ?> </strong></p>
947
  </div>
948
  <?php return; endif;
949
 
1069
  }
1070
 
1071
 
1072
+ /**
1073
+ * Get the language for the current post
1074
+ */
1075
+ function get_language( $post_id = false ) {
1076
+ if( $post_id !== false ) {
1077
+ $options = $this->get_options( $post_id );
1078
+ $language = $options['language'];
1079
+ } else {
1080
+ $language = isset( $_GET['language'] ) ? esc_attr(strtolower($_GET['language'])) : 'css';
1081
+ }
1082
+ if ( !in_array($language, array('css', 'js', 'html'))) $language = 'css';
1083
+
1084
+ return $language;
1085
+ }
1086
  }
1087
 
1088
  return new CustomCSSandJS_Admin();
includes/admin-warnings.php CHANGED
@@ -52,7 +52,7 @@ class CustomCSSandJS_Warnings {
52
  function check_qtranslate_notice() {
53
  $id = 'ccj_dismiss_qtranslate';
54
  $class = 'notice notice-warning is-dismissible';
55
- $message = __( 'Please remove the <b>custom-css-js</b> post type from the <b>qTranslate settings</b> in order to avoid some malfunctions in the Simple Custom CSS & JS plugin. Check out <a href="https://www.silkypress.com/wp-content/uploads/2016/08/ccj_qtranslate_compatibility.png" target="_blank">this screenshot</a> for more details on how to do that.' );
56
 
57
  printf( '<div class="%1$s" id="%2$s"><p>%3$s</p></div>', $class, $id, $message );
58
 
52
  function check_qtranslate_notice() {
53
  $id = 'ccj_dismiss_qtranslate';
54
  $class = 'notice notice-warning is-dismissible';
55
+ $message = sprintf(__( 'Please remove the <b>custom-css-js</b> post type from the <b>qTranslate settings</b> in order to avoid some malfunctions in the Simple Custom CSS & JS plugin. Check out <a href="%s" target="_blank">this screenshot</a> for more details on how to do that.', 'custom-css-js'), 'https://www.silkypress.com/wp-content/uploads/2016/08/ccj_qtranslate_compatibility.png' );
56
 
57
  printf( '<div class="%1$s" id="%2$s"><p>%3$s</p></div>', $class, $id, $message );
58
 
languages/custom-css-js.pot ADDED
@@ -0,0 +1,455 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2017 Simple Custom CSS and JS
2
+ # This file is distributed under the same license as the Simple Custom CSS and JS package.
3
+ msgid ""
4
+ msgstr ""
5
+ "Project-Id-Version: Simple Custom CSS and JS 3.0\n"
6
+ "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/custom-css-js-"
7
+ "svn\n"
8
+ "POT-Creation-Date: 2017-05-13 18:45:06+00:00\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "PO-Revision-Date: 2017-MO-DA HO:MI+ZONE\n"
13
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
+ "Language-Team: LANGUAGE <LL@li.org>\n"
15
+
16
+ #: custom-css-js.php:56 custom-css-js.php:63
17
+ msgid "Cheatin&#8217; huh?"
18
+ msgstr ""
19
+
20
+ #: custom-css-js.php:198
21
+ msgctxt "post type general name"
22
+ msgid "Custom Code"
23
+ msgstr ""
24
+
25
+ #: custom-css-js.php:199
26
+ msgctxt "post type singular name"
27
+ msgid "Custom Code"
28
+ msgstr ""
29
+
30
+ #: custom-css-js.php:200
31
+ msgctxt "admin menu"
32
+ msgid "Custom CSS & JS"
33
+ msgstr ""
34
+
35
+ #: custom-css-js.php:201
36
+ msgctxt "add new on admin bar"
37
+ msgid "Custom Code"
38
+ msgstr ""
39
+
40
+ #: custom-css-js.php:202
41
+ msgctxt "add new"
42
+ msgid "Add Custom Code"
43
+ msgstr ""
44
+
45
+ #: custom-css-js.php:203
46
+ msgid "Add Custom Code"
47
+ msgstr ""
48
+
49
+ #: custom-css-js.php:204
50
+ msgid "New Custom Code"
51
+ msgstr ""
52
+
53
+ #: custom-css-js.php:205
54
+ msgid "Edit Custom Code"
55
+ msgstr ""
56
+
57
+ #: custom-css-js.php:206
58
+ msgid "View Custom Code"
59
+ msgstr ""
60
+
61
+ #: custom-css-js.php:207
62
+ msgid "All Custom Code"
63
+ msgstr ""
64
+
65
+ #: custom-css-js.php:208
66
+ msgid "Search Custom Code"
67
+ msgstr ""
68
+
69
+ #: custom-css-js.php:209
70
+ msgid "Parent Custom Code:"
71
+ msgstr ""
72
+
73
+ #: custom-css-js.php:210
74
+ msgid "No Custom Code found."
75
+ msgstr ""
76
+
77
+ #: custom-css-js.php:211
78
+ msgid "No Custom Code found in Trash."
79
+ msgstr ""
80
+
81
+ #: custom-css-js.php:232
82
+ msgid "Custom CSS and JS code"
83
+ msgstr ""
84
+
85
+ #: custom-css-js.php:277
86
+ msgid "Web Designer"
87
+ msgstr ""
88
+
89
+ #: custom-css-js.php:372
90
+ msgid "Settings"
91
+ msgstr ""
92
+
93
+ #: includes/admin-addons.php:42 includes/admin-screens.php:631
94
+ msgid "Available only in <br />Simple Custom CSS and JS Pro"
95
+ msgstr ""
96
+
97
+ #: includes/admin-addons.php:54
98
+ msgid "Preview"
99
+ msgstr ""
100
+
101
+ #: includes/admin-addons.php:55
102
+ msgid "Apply only on these URLs"
103
+ msgstr ""
104
+
105
+ #: includes/admin-addons.php:56
106
+ msgid "Code Revisions"
107
+ msgstr ""
108
+
109
+ #: includes/admin-addons.php:67
110
+ msgid "Full URL on which to preview the changes ..."
111
+ msgstr ""
112
+
113
+ #: includes/admin-addons.php:68
114
+ msgid "Preview Changes"
115
+ msgstr ""
116
+
117
+ #: includes/admin-addons.php:82
118
+ msgid "All Website"
119
+ msgstr ""
120
+
121
+ #: includes/admin-addons.php:83
122
+ msgid "First page"
123
+ msgstr ""
124
+
125
+ #: includes/admin-addons.php:84
126
+ msgid "Contains"
127
+ msgstr ""
128
+
129
+ #: includes/admin-addons.php:85
130
+ msgid "Not contains"
131
+ msgstr ""
132
+
133
+ #: includes/admin-addons.php:86
134
+ msgid "Is equal to"
135
+ msgstr ""
136
+
137
+ #: includes/admin-addons.php:87
138
+ msgid "Not equal to"
139
+ msgstr ""
140
+
141
+ #: includes/admin-addons.php:88
142
+ msgid "Starts with"
143
+ msgstr ""
144
+
145
+ #: includes/admin-addons.php:89
146
+ msgid "Ends by"
147
+ msgstr ""
148
+
149
+ #: includes/admin-addons.php:100 includes/admin-addons.php:101
150
+ msgid "URL"
151
+ msgstr ""
152
+
153
+ #: includes/admin-addons.php:102
154
+ msgid "Text filter"
155
+ msgstr ""
156
+
157
+ #: includes/admin-addons.php:103
158
+ msgid "Add"
159
+ msgstr ""
160
+
161
+ #: includes/admin-addons.php:114
162
+ msgctxt "revision date format"
163
+ msgid "F j, Y @ H:i:s"
164
+ msgstr ""
165
+
166
+ #: includes/admin-addons.php:136 includes/admin-addons.php:169
167
+ msgid "Compare"
168
+ msgstr ""
169
+
170
+ #: includes/admin-addons.php:137
171
+ msgid "Revision"
172
+ msgstr ""
173
+
174
+ #: includes/admin-addons.php:138 includes/admin-screens.php:268
175
+ msgid "Author"
176
+ msgstr ""
177
+
178
+ #: includes/admin-addons.php:139 includes/admin-addons.php:173
179
+ msgid "Delete"
180
+ msgstr ""
181
+
182
+ #: includes/admin-addons.php:140 includes/admin-addons.php:163
183
+ msgid "Restore"
184
+ msgstr ""
185
+
186
+ #: includes/admin-notices.php:125
187
+ msgid "Get your discount now"
188
+ msgstr ""
189
+
190
+ #: includes/admin-notices.php:125 includes/admin-notices.php:190
191
+ msgid "Dismiss this notice"
192
+ msgstr ""
193
+
194
+ #: includes/admin-screens.php:94
195
+ msgid "Add Custom CSS"
196
+ msgstr ""
197
+
198
+ #: includes/admin-screens.php:97
199
+ msgid "Add Custom JS"
200
+ msgstr ""
201
+
202
+ #: includes/admin-screens.php:100
203
+ msgid "Add Custom HTML"
204
+ msgstr ""
205
+
206
+ #: includes/admin-screens.php:189
207
+ msgid "Options"
208
+ msgstr ""
209
+
210
+ #: includes/admin-screens.php:249
211
+ msgid "Add CSS code"
212
+ msgstr ""
213
+
214
+ #: includes/admin-screens.php:250
215
+ msgid "Add JS code"
216
+ msgstr ""
217
+
218
+ #: includes/admin-screens.php:251
219
+ msgid "Add HTML code"
220
+ msgstr ""
221
+
222
+ #: includes/admin-screens.php:265
223
+ msgid "Active"
224
+ msgstr ""
225
+
226
+ #: includes/admin-screens.php:266
227
+ msgid "Type"
228
+ msgstr ""
229
+
230
+ #: includes/admin-screens.php:267
231
+ msgid "Title"
232
+ msgstr ""
233
+
234
+ #: includes/admin-screens.php:269
235
+ msgid "Date"
236
+ msgstr ""
237
+
238
+ #: includes/admin-screens.php:270
239
+ msgid "Modified"
240
+ msgstr ""
241
+
242
+ #: includes/admin-screens.php:299
243
+ msgid "%s ago"
244
+ msgstr ""
245
+
246
+ #: includes/admin-screens.php:301
247
+ msgid "Y/m/d"
248
+ msgstr ""
249
+
250
+ #: includes/admin-screens.php:309
251
+ msgid "Toggle active"
252
+ msgstr ""
253
+
254
+ #: includes/admin-screens.php:311
255
+ msgid "The code is active. Click to deactivate it"
256
+ msgstr ""
257
+
258
+ #: includes/admin-screens.php:314
259
+ msgid "The code is inactive. Click to activate it"
260
+ msgstr ""
261
+
262
+ #: includes/admin-screens.php:365
263
+ msgid "Custom Code"
264
+ msgstr ""
265
+
266
+ #: includes/admin-screens.php:366 includes/admin-screens.php:397
267
+ msgid "Add CSS Code"
268
+ msgstr ""
269
+
270
+ #: includes/admin-screens.php:367 includes/admin-screens.php:398
271
+ msgid "Add JS Code"
272
+ msgstr ""
273
+
274
+ #: includes/admin-screens.php:368 includes/admin-screens.php:399
275
+ msgid "Add HTML Code"
276
+ msgstr ""
277
+
278
+ #: includes/admin-screens.php:407
279
+ msgid "Code updated"
280
+ msgstr ""
281
+
282
+ #: includes/admin-screens.php:490
283
+ msgid ""
284
+ "/* Add your JavaScript code here.\n"
285
+ " \n"
286
+ "If you are using the jQuery library, then don't forget to wrap your code "
287
+ "inside jQuery.ready() as follows:\n"
288
+ "\n"
289
+ "jQuery(document).ready(function( $ ){\n"
290
+ " // Your code in here \n"
291
+ "});\n"
292
+ "\n"
293
+ "End of comment */ "
294
+ msgstr ""
295
+
296
+ #: includes/admin-screens.php:506
297
+ msgid ""
298
+ "<!-- Add HTML code to the header or the footer. \n"
299
+ "\n"
300
+ "For example, you can use the following code for loading the jQuery library "
301
+ "from Google CDN:\n"
302
+ "<script src=\"https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min."
303
+ "js\"></script>\n"
304
+ "\n"
305
+ "or the following one for loading the Bootstrap library from MaxCDN:\n"
306
+ "<link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com/"
307
+ "bootstrap/3.3.7/css/bootstrap.min.css\" integrity=\"sha384-"
308
+ "BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u\" "
309
+ "crossorigin=\"anonymous\">\n"
310
+ "\n"
311
+ "-- End of the comment --> "
312
+ msgstr ""
313
+
314
+ #: includes/admin-screens.php:532
315
+ msgid ""
316
+ "/* Add your CSS code here.\n"
317
+ " \n"
318
+ "For example:\n"
319
+ ".example {\n"
320
+ " color: red;\n"
321
+ "}\n"
322
+ "\n"
323
+ "For brushing up on your CSS knowledge, check out http://www.w3schools.com/"
324
+ "css/css_syntax.asp\n"
325
+ "\n"
326
+ "End of comment */ "
327
+ msgstr ""
328
+
329
+ #: includes/admin-screens.php:646
330
+ msgid "Linking type"
331
+ msgstr ""
332
+
333
+ #: includes/admin-screens.php:651
334
+ msgid "External File"
335
+ msgstr ""
336
+
337
+ #: includes/admin-screens.php:655
338
+ msgid "Internal"
339
+ msgstr ""
340
+
341
+ #: includes/admin-screens.php:661 includes/admin-screens.php:745
342
+ msgid "Where on page"
343
+ msgstr ""
344
+
345
+ #: includes/admin-screens.php:666 includes/admin-screens.php:750
346
+ msgid "Header"
347
+ msgstr ""
348
+
349
+ #: includes/admin-screens.php:670 includes/admin-screens.php:754
350
+ msgid "Footer"
351
+ msgstr ""
352
+
353
+ #: includes/admin-screens.php:676 includes/admin-screens.php:760
354
+ msgid "Where in site"
355
+ msgstr ""
356
+
357
+ #: includes/admin-screens.php:681 includes/admin-screens.php:765
358
+ msgid "In Frontend"
359
+ msgstr ""
360
+
361
+ #: includes/admin-screens.php:685 includes/admin-screens.php:769
362
+ msgid "In Admin"
363
+ msgstr ""
364
+
365
+ #: includes/admin-screens.php:691
366
+ msgid "CSS Preprocessor"
367
+ msgstr ""
368
+
369
+ #: includes/admin-screens.php:696
370
+ msgid "None"
371
+ msgstr ""
372
+
373
+ #: includes/admin-screens.php:699
374
+ msgid "Less"
375
+ msgstr ""
376
+
377
+ #: includes/admin-screens.php:702
378
+ msgid "SASS (only SCSS syntax)"
379
+ msgstr ""
380
+
381
+ #: includes/admin-screens.php:708
382
+ msgid "Minify the code"
383
+ msgstr ""
384
+
385
+ #: includes/admin-screens.php:715 includes/admin-screens.php:796
386
+ msgid "Priority"
387
+ msgstr ""
388
+
389
+ #: includes/admin-screens.php:720 includes/admin-screens.php:801
390
+ msgctxt "1 is the highest priority"
391
+ msgid "1 (highest)"
392
+ msgstr ""
393
+
394
+ #: includes/admin-screens.php:729 includes/admin-screens.php:810
395
+ msgctxt "10 is the lowest priority"
396
+ msgid "10 (lowest)"
397
+ msgstr ""
398
+
399
+ #: includes/admin-screens.php:775
400
+ msgid "On which device"
401
+ msgstr ""
402
+
403
+ #: includes/admin-screens.php:781
404
+ msgid "Desktop"
405
+ msgstr ""
406
+
407
+ #: includes/admin-screens.php:785
408
+ msgid "Mobile"
409
+ msgstr ""
410
+
411
+ #: includes/admin-screens.php:789
412
+ msgid "Both"
413
+ msgstr ""
414
+
415
+ #: includes/admin-screens.php:932
416
+ msgid "The %s directory could not be created"
417
+ msgstr ""
418
+
419
+ #: includes/admin-screens.php:933
420
+ msgid "Please run the following commands in order to make the directory"
421
+ msgstr ""
422
+
423
+ #: includes/admin-screens.php:941
424
+ msgid ""
425
+ "The %s directory is not writable, therefore the CSS and JS files cannot be "
426
+ "saved."
427
+ msgstr ""
428
+
429
+ #: includes/admin-screens.php:942
430
+ msgid "Please run the following command to make the directory writable"
431
+ msgstr ""
432
+
433
+ #: includes/admin-warnings.php:55
434
+ msgid ""
435
+ "Please remove the <b>custom-css-js</b> post type from the <b>qTranslate "
436
+ "settings</b> in order to avoid some malfunctions in the Simple Custom CSS & "
437
+ "JS plugin. Check out <a href=\"%s\" target=\"_blank\">this screenshot</a> "
438
+ "for more details on how to do that."
439
+ msgstr ""
440
+
441
+ #. Plugin URI of the plugin/theme
442
+ msgid "https://wordpress.org/plugins/custom-css-js/"
443
+ msgstr ""
444
+
445
+ #. Description of the plugin/theme
446
+ msgid "Easily add Custom CSS or JS to your website with an awesome editor."
447
+ msgstr ""
448
+
449
+ #. Author of the plugin/theme
450
+ msgid "Diana Burduja"
451
+ msgstr ""
452
+
453
+ #. Author URI of the plugin/theme
454
+ msgid "https://www.silkypress.com/"
455
+ msgstr ""
readme.txt CHANGED
@@ -5,8 +5,8 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=diana
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.7
9
- Stable tag: 2.10
10
  License: GPLv3
11
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
12
 
@@ -24,46 +24,6 @@ Customize your WordPress site's appearance by easily adding custom CSS and JS co
24
  * Add as many codes as you want
25
  * Keep your changes also when you change the theme
26
 
27
- = Frequently Asked Questions =
28
-
29
- * **What if I want to add multiple external CSS codes?**
30
- If you write multiple codes of the same type (for example: two external CSS codes), then all of them will be printed one after another
31
-
32
- * **Will this plugin affect the loading time?**
33
- When you click the `Save` button the codes will be cached in files, so there are no tedious database queries.
34
-
35
- * **Does the plugin modify the code I write in the editor?**
36
- No, the code is printed exactly as in the editor. It is not modified/checked/validated in any way. You take the full responsability for what is written in there.
37
-
38
- * **My code doesn't show on the website**
39
- Try one of the following:
40
- 1. If you are using any caching plugin (like "W3 Total Cache" or "WP Fastest Cache"), then don't forget to delete the cache before seing the code printed on the website.
41
- 2. Make sure the code is in **Published** state (not **Draft** or **in Trash**).
42
- 3. Check if the `wp-content/uploads/custom-css-js` folder exists and is writable
43
-
44
- * **Does it work with a Multisite Network?**
45
- Yes.
46
-
47
- * **What if I change the theme?**
48
- The CSS and JS are independent of the theme and they will persist through a theme change. This is particularly useful if you apply CSS and JS for modifying a plugin's output.
49
-
50
- * **Can I use a CSS preprocesor like LESS or Sass?**
51
- For the moment only plain CSS is supported, but you can check out the [Pro version](https://www.silkypress.com/simple-custom-css-js-pro/?utm_source=wordpress&utm_campaign=ccj_free&utm_medium=banner) in case you need a CSS preprocessor.
52
-
53
- * **Can I upload images for use with my CSS?**
54
- Yes. You can upload an image to your Media Library, then refer to it by its direct URL from within the CSS stylesheet. For example:
55
- `div#content {
56
- background-image: url('http://example.com/wp-content/uploads/2015/12/image.jpg');
57
- }`
58
-
59
- * **Can I use CSS rules like @import and @font-face?**
60
- Yes.
61
-
62
- * **CSS Help.**
63
- If you are just starting with CSS, then here you'll find some resources:
64
- * [codecademy.com - Learn HTML & CSS](https://www.codecademy.com/learn/web)
65
- * [Wordpress.org - Finding Your CSS Styles](https://codex.wordpress.org/Finding_Your_CSS_Styles)
66
-
67
  == Installation ==
68
 
69
  * From the WP admin panel, click "Plugins" -> "Add new".
@@ -93,16 +53,54 @@ OR...
93
  = Requirements =
94
  PHP >= 5.3
95
 
96
- = Browser requirements =
97
  * Firefox - version 4 and up
98
  * Chrome - any version
99
  * Safari - version 5.2 and up
100
  * Internet Explorer - version 8 and up
101
  * Opera - version 9 and up
102
 
103
- = Small incompatibilities =
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
104
  * If the [qTranslate X](https://wordpress.org/plugins/qtranslate-x/) plugin is adding some `[:]` or `[:en]` characters to your code, then you need to remove the `custom-css-js` post type from the qTranslate settings. Check out [this screenshot](https://www.silkypress.com/wp-content/uploads/2016/08/ccj_qtranslate_compatibility.png) on how to do that.
105
 
 
 
106
  == Screenshots ==
107
 
108
  1. Manage Custom Codes
@@ -115,8 +113,29 @@ $. Add/Edit HTML
115
 
116
  == Changelog ==
117
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
118
  = 2.10 =
119
- * 02/05/2016
120
  * Feature: circumvent external file caching by adding a GET parameter
121
  * Add special offer for Simple Custom CSS and JS pro
122
 
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.8
9
+ Stable tag: 3.4
10
  License: GPLv3
11
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
12
 
24
  * Add as many codes as you want
25
  * Keep your changes also when you change the theme
26
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  == Installation ==
28
 
29
  * From the WP admin panel, click "Plugins" -> "Add new".
53
  = Requirements =
54
  PHP >= 5.3
55
 
56
+ **Browser requirements**
57
  * Firefox - version 4 and up
58
  * Chrome - any version
59
  * Safari - version 5.2 and up
60
  * Internet Explorer - version 8 and up
61
  * Opera - version 9 and up
62
 
63
+ = What if I want to add multiple external CSS codes? =
64
+ If you write multiple codes of the same type (for example: two external CSS codes), then all of them will be printed one after another
65
+
66
+ = Will this plugin affect the loading time? =
67
+ When you click the `Save` button the codes will be cached in files, so there are no tedious database queries.
68
+
69
+ = Does the plugin modify the code I write in the editor? =
70
+ No, the code is printed exactly as in the editor. It is not modified/checked/validated in any way. You take the full responsability for what is written in there.
71
+
72
+ = My code doesn't show on the website =
73
+ Try one of the following:
74
+ 1. If you are using any caching plugin (like "W3 Total Cache" or "WP Fastest Cache"), then don't forget to delete the cache before seing the code printed on the website.
75
+ 2. Make sure the code is in **Published** state (not **Draft** or **in Trash**).
76
+ 3. Check if the `wp-content/uploads/custom-css-js` folder exists and is writable
77
+
78
+ = Does it work with a Multisite Network? =
79
+ Yes.
80
+
81
+ = What if I change the theme? =
82
+ The CSS and JS are independent of the theme and they will persist through a theme change. This is particularly useful if you apply CSS and JS for modifying a plugin's output.
83
+
84
+ = Can I use a CSS preprocesor like LESS or Sass? =
85
+ For the moment only plain CSS is supported, but you can check out the [Pro version](https://www.silkypress.com/simple-custom-css-js-pro/?utm_source=wordpress&utm_campaign=ccj_free&utm_medium=banner) in case you need a CSS preprocessor.
86
+
87
+ = Can I upload images for use with my CSS? =
88
+ Yes. You can upload an image to your Media Library, then refer to it by its direct URL from within the CSS stylesheet. For example:
89
+ `div#content {
90
+ background-image: url('http://example.com/wp-content/uploads/2015/12/image.jpg');
91
+ }`
92
+
93
+ = Can I use CSS rules like @import and @font-face? =
94
+ Yes.
95
+
96
+ = Who can publish/edit/delete Custom Codes? =
97
+ By default only the Administrator will be able to publish/edit/delete Custom Codes. Check out [this article](https://www.silkypress.com/simple_custom_css_js/user-capabilities-simple-custom-css-js-plugin/) for more details on roles and user capabilities customizations.
98
+
99
+ = Compatibility with qTranslate X plugin =
100
  * If the [qTranslate X](https://wordpress.org/plugins/qtranslate-x/) plugin is adding some `[:]` or `[:en]` characters to your code, then you need to remove the `custom-css-js` post type from the qTranslate settings. Check out [this screenshot](https://www.silkypress.com/wp-content/uploads/2016/08/ccj_qtranslate_compatibility.png) on how to do that.
101
 
102
+
103
+
104
  == Screenshots ==
105
 
106
  1. Manage Custom Codes
113
 
114
  == Changelog ==
115
 
116
+ = 3.4 =
117
+ * 07/11/2017
118
+ * Security fix according to VN: JVN#31459091 / TN: JPCERT#91837758
119
+
120
+ = 3.3 =
121
+ * 06/23/2017
122
+ * Feature: option for adding Codes to the Login Page
123
+
124
+ = 3.2 =
125
+ * 06/13/2017
126
+ * Fix: compatibility issue with the HTML Editor Syntax Highlighter plugin
127
+
128
+ = 3.1 =
129
+ * 05/14/2017
130
+ * Feature: prepare the plugin for translation
131
+
132
+ = 3.0 =
133
+ * 04/12/2017
134
+ * Feature: create the Web Designer role
135
+ * Feature: allow Custom Codes to be managed only by users with the right capabilities
136
+
137
  = 2.10 =
138
+ * 02/05/2017
139
  * Feature: circumvent external file caching by adding a GET parameter
140
  * Add special offer for Simple Custom CSS and JS pro
141
 
screenshot-1.jpg DELETED
Binary file
screenshot-2.jpg DELETED
Binary file
screenshot-3.jpg DELETED
Binary file
screenshot-4.jpg DELETED
Binary file