WP Add Custom CSS - Version 1.1.5

Version Description

  • Changed default code editor
  • Advanced code editor is now resizable
  • Fixed textarea direction for RTL languages
Download this release

Release Info

Developer danieledesantis
Plugin Icon 128x128 WP Add Custom CSS
Version 1.1.5
Comparing to
See all releases

Code changes from version 1.1.4 to 1.1.5

images/btn_donate.gif ADDED
Binary file
images/resize-handle.png ADDED
Binary file
images/resize-handle.svg ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Generator: Adobe Illustrator 22.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
+ <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
4
+ viewBox="0 0 22 5" style="enable-background:new 0 0 22 5;" xml:space="preserve">
5
+ <style type="text/css">
6
+ .st0{fill:#4D4D4D;}
7
+ </style>
8
+ <g>
9
+ <g>
10
+ <circle class="st0" cx="4" cy="2.5" r="2.5"/>
11
+ </g>
12
+ <g>
13
+ <circle class="st0" cx="11" cy="2.5" r="2.5"/>
14
+ </g>
15
+ <g>
16
+ <circle class="st0" cx="18" cy="2.5" r="2.5"/>
17
+ </g>
18
+ </g>
19
+ </svg>
js/scripts-ace.js CHANGED
@@ -22,6 +22,15 @@
22
  editor.getSession().on('change', function(){
23
  textarea.val(editor.getSession().getValue());
24
  });
 
 
 
 
 
 
 
 
 
25
  });
26
 
27
  })(jQuery);
22
  editor.getSession().on('change', function(){
23
  textarea.val(editor.getSession().getValue());
24
  });
25
+
26
+ $('.wpacc_editor_container').resizable({
27
+ maxHeight: 2000,
28
+ minHeight: 300,
29
+ handles: 's',
30
+ resize: function( event, ui ) {
31
+ editor.resize();
32
+ }
33
+ });
34
  });
35
 
36
  })(jQuery);
lib/ace/ace-custom.css CHANGED
@@ -7,4 +7,12 @@
7
  right: 0;
8
  bottom: 0;
9
  left: 0;
 
 
 
 
 
 
 
 
10
  }
7
  right: 0;
8
  bottom: 0;
9
  left: 0;
10
+ }
11
+ .ui-resizable-s {
12
+ background-color: #e6e6e6;
13
+ background-image: url(../../images/resize-handle.png);
14
+ background-image: url(../../images/resize-handle.svg), none;
15
+ background-size: 22px 9px;
16
+ background-repeat: no-repeat;
17
+ background-position: center;
18
  }
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: danieledesantis
3
  Tags: css, custom css, style, styles, stylesheet, custom stylesheet, single post css, site css, single page css, custom post type css, product css
4
  Requires at least: 4.0
5
- Tested up to: 5.0.3
6
- Stable tag: 1.1.4
7
  License: GPLv2
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -63,6 +63,11 @@ Click on the "Screen option" link from your post/page editing area and be sure t
63
 
64
  == Changelog ==
65
 
 
 
 
 
 
66
  = 1.1.4 =
67
  * Fixed compatibility issue with The Events Calendar
68
 
@@ -114,6 +119,11 @@ Click on the "Screen option" link from your post/page editing area and be sure t
114
 
115
  == Upgrade Notice ==
116
 
 
 
 
 
 
117
  = 1.1.4 =
118
  * Fixed compatibility issue with The Events Calendar
119
 
2
  Contributors: danieledesantis
3
  Tags: css, custom css, style, styles, stylesheet, custom stylesheet, single post css, site css, single page css, custom post type css, product css
4
  Requires at least: 4.0
5
+ Tested up to: 5.2.2
6
+ Stable tag: 1.1.5
7
  License: GPLv2
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
63
 
64
  == Changelog ==
65
 
66
+ = 1.1.5 =
67
+ * Changed default code editor
68
+ * Advanced code editor is now resizable
69
+ * Fixed textarea direction for RTL languages
70
+
71
  = 1.1.4 =
72
  * Fixed compatibility issue with The Events Calendar
73
 
119
 
120
  == Upgrade Notice ==
121
 
122
+ = 1.1.5 =
123
+ * Changed default code editor
124
+ * Advanced code editor is now resizable
125
+ * Fixed textarea direction for RTL languages
126
+
127
  = 1.1.4 =
128
  * Fixed compatibility issue with The Events Calendar
129
 
wordpress-add-custom-css.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: WP Add Custom CSS
4
  Plugin URI: http://www.danieledesantis.net
5
  Description: Add custom css to the whole website and to specific posts, pages and custom post types.
6
- Version: 1.1.4
7
  Author: Daniele De Santis
8
  Author URI: http://www.danieledesantis.net
9
  Text Domain: wp-add-custom-css
@@ -69,15 +69,24 @@ if(!class_exists('Wpacc'))
69
  if ( ( in_array( $hook, array('post.php', 'post-new.php') ) && $this->is_enabled_post_type() ) || $hook === 'toplevel_page_wp-add-custom-css_settings' ) {
70
  $this->options = get_option( 'wpacc_settings' );
71
  if ( isset($this->options['enable_advanced_editor']) ) {
72
- global $current_screen;
73
  if (!isset($current_screen)) {$current_screen = get_current_screen();}
74
  if ( ( method_exists($current_screen, 'is_block_editor') && $current_screen->is_block_editor() )
75
  || ( function_exists('is_gutenberg_page') && is_gutenberg_page() )
76
- || ( $hook === 'toplevel_page_wp-add-custom-css_settings' && function_exists('is_gutenberg_page') ) ) {
 
 
 
 
 
 
 
 
 
77
  wp_enqueue_style( 'wpacc_ace', plugin_dir_url( __FILE__ ) . 'lib/ace/ace-custom.css' );
78
  wp_enqueue_script( 'wpacc_ace', plugin_dir_url( __FILE__ ) . 'lib/ace/ace.js');
79
- wp_enqueue_script( 'wpacc_scripts_ace', plugin_dir_url( __FILE__ ) . 'js/scripts-ace.js', array('jquery', 'wpacc_ace') );
80
- } else {
81
  wp_enqueue_style( 'wpacc_codemirror', plugin_dir_url( __FILE__ ) . 'lib/codemirror/codemirror.css' );
82
  if ( isset($this->options['advanced_editor_theme']) && $this->options['advanced_editor_theme'] === 'dark' ) {
83
  wp_enqueue_style( 'wpacc_codemirror_dark', plugin_dir_url( __FILE__ ) . 'lib/codemirror/theme/tomorrow-night-bright.css', array('wpacc_codemirror') );
@@ -85,7 +94,7 @@ if(!class_exists('Wpacc'))
85
  wp_enqueue_script( 'wpacc_codemirror', plugin_dir_url( __FILE__ ) . 'lib/codemirror/codemirror.js' );
86
  wp_enqueue_script( 'wpacc_codemirror_css', plugin_dir_url( __FILE__ ) . 'lib/codemirror/mode/css/css.js', array('wpacc_codemirror') );
87
  wp_enqueue_script( 'wpacc_scripts', plugin_dir_url( __FILE__ ) . 'js/scripts.js', array('jquery', 'wpacc_codemirror_css') );
88
- }
89
  }
90
  }
91
  }
@@ -118,10 +127,11 @@ if(!class_exists('Wpacc'))
118
  public function render_meta_box_content( $post ) {
119
  wp_nonce_field( 'single_add_custom_css_box', 'wp_add_custom_css_box_nonce' );
120
  $single_custom_css = get_post_meta( $post->ID, '_single_add_custom_css', true );
 
121
  $class = ( isset($this->options['advanced_editor_theme']) && $this->options['advanced_editor_theme'] === 'dark' ) ? ' class="wpacc_editor_dark"' : '';
122
  echo '<p>'. sprintf( __( 'Add custom CSS rules for this %s', 'wp-add-custom-css' ), $post->post_type ). '</p> ';
123
  echo '<div class="wpacc_editor_container">';
124
- echo '<textarea id="single_custom_css" name="single_custom_css" style="width:100%; min-height:200px;"' . $class . '>' . esc_attr( $single_custom_css ) . '</textarea>';
125
  echo '<div id="single_custom_css_ace" class="custom_css_ace"></div>';
126
  echo '</div>';
127
  }
@@ -141,9 +151,22 @@ if(!class_exists('Wpacc'))
141
  <?php do_settings_sections( 'wp-add-custom-css_settings' ); ?>
142
  <?php submit_button( __('Save', 'wp-add-custom-css') ); ?>
143
  </form>
 
 
 
 
 
 
 
 
 
 
 
 
 
144
  <h3><?php echo __('Credits', 'wp-add-custom-css'); ?></h3>
145
  <ul>
146
- <li><?php echo __('If you like "WP Add Custom CSS" leave a', 'wp-add-custom-css'); ?> <a href="https://wordpress.org/support/plugin/wp-add-custom-css/reviews/?filter=5" target="_blank" title="Daniele De Santis"><?php echo __('5 star review,', 'wp-add-custom-css'); ?></a> <?php echo __('thank you!', 'wp-add-custom-css'); ?></li>
147
  <li><?php echo __('"WP Add Custom CSS" is a plugin by', 'wp-add-custom-css'); ?> <a href="http://www.danieledesantis.net/" target="_blank" title="Daniele De Santis">Daniele De Santis</a></li>
148
  </ul>
149
  </div>
@@ -157,8 +180,9 @@ if(!class_exists('Wpacc'))
157
  public function main_css_input() {
158
  $custom_rules = isset( $this->options['main_custom_style'] ) ? esc_attr( $this->options['main_custom_style'] ) : '';
159
  $class = ( isset($this->options['advanced_editor_theme']) && $this->options['advanced_editor_theme'] === 'dark' ) ? ' class="wpacc_editor_dark"' : '';
 
160
  echo '<div class="wpacc_editor_container">';
161
- echo '<textarea id="main_custom_css" name="wpacc_settings[main_custom_style]" style="width:100%; min-height:300px;"' . $class . '>' . $custom_rules . '</textarea>';
162
  echo '<div id="main_custom_css_ace" class="custom_css_ace"></div>';
163
  echo '</div>';
164
  }
3
  Plugin Name: WP Add Custom CSS
4
  Plugin URI: http://www.danieledesantis.net
5
  Description: Add custom css to the whole website and to specific posts, pages and custom post types.
6
+ Version: 1.1.5
7
  Author: Daniele De Santis
8
  Author URI: http://www.danieledesantis.net
9
  Text Domain: wp-add-custom-css
69
  if ( ( in_array( $hook, array('post.php', 'post-new.php') ) && $this->is_enabled_post_type() ) || $hook === 'toplevel_page_wp-add-custom-css_settings' ) {
70
  $this->options = get_option( 'wpacc_settings' );
71
  if ( isset($this->options['enable_advanced_editor']) ) {
72
+ /*global $current_screen;
73
  if (!isset($current_screen)) {$current_screen = get_current_screen();}
74
  if ( ( method_exists($current_screen, 'is_block_editor') && $current_screen->is_block_editor() )
75
  || ( function_exists('is_gutenberg_page') && is_gutenberg_page() )
76
+ || ( $hook === 'toplevel_page_wp-add-custom-css_settings' && function_exists('is_gutenberg_page') ) ) {*/
77
+ $wp_scripts = wp_scripts();
78
+ wp_enqueue_style(
79
+ 'jquery-ui-theme-smoothness',
80
+ sprintf(
81
+ '//ajax.googleapis.com/ajax/libs/jqueryui/%s/themes/smoothness/jquery-ui.css',
82
+ $wp_scripts->registered['jquery-ui-core']->ver
83
+ )
84
+ );
85
+ wp_enqueue_script('jquery-ui-resizable');
86
  wp_enqueue_style( 'wpacc_ace', plugin_dir_url( __FILE__ ) . 'lib/ace/ace-custom.css' );
87
  wp_enqueue_script( 'wpacc_ace', plugin_dir_url( __FILE__ ) . 'lib/ace/ace.js');
88
+ wp_enqueue_script( 'wpacc_scripts_ace', plugin_dir_url( __FILE__ ) . 'js/scripts-ace.js', array('jquery', 'jquery-ui-resizable', 'wpacc_ace') );
89
+ /*} else {
90
  wp_enqueue_style( 'wpacc_codemirror', plugin_dir_url( __FILE__ ) . 'lib/codemirror/codemirror.css' );
91
  if ( isset($this->options['advanced_editor_theme']) && $this->options['advanced_editor_theme'] === 'dark' ) {
92
  wp_enqueue_style( 'wpacc_codemirror_dark', plugin_dir_url( __FILE__ ) . 'lib/codemirror/theme/tomorrow-night-bright.css', array('wpacc_codemirror') );
94
  wp_enqueue_script( 'wpacc_codemirror', plugin_dir_url( __FILE__ ) . 'lib/codemirror/codemirror.js' );
95
  wp_enqueue_script( 'wpacc_codemirror_css', plugin_dir_url( __FILE__ ) . 'lib/codemirror/mode/css/css.js', array('wpacc_codemirror') );
96
  wp_enqueue_script( 'wpacc_scripts', plugin_dir_url( __FILE__ ) . 'js/scripts.js', array('jquery', 'wpacc_codemirror_css') );
97
+ }*/
98
  }
99
  }
100
  }
127
  public function render_meta_box_content( $post ) {
128
  wp_nonce_field( 'single_add_custom_css_box', 'wp_add_custom_css_box_nonce' );
129
  $single_custom_css = get_post_meta( $post->ID, '_single_add_custom_css', true );
130
+ $rtl_style = is_rtl() ? ' direction: ltr;' : '';
131
  $class = ( isset($this->options['advanced_editor_theme']) && $this->options['advanced_editor_theme'] === 'dark' ) ? ' class="wpacc_editor_dark"' : '';
132
  echo '<p>'. sprintf( __( 'Add custom CSS rules for this %s', 'wp-add-custom-css' ), $post->post_type ). '</p> ';
133
  echo '<div class="wpacc_editor_container">';
134
+ echo '<textarea id="single_custom_css" name="single_custom_css" style="width:100%; min-height:300px;' . $rtl_style . '"' . $class . '>' . esc_attr( $single_custom_css ) . '</textarea>';
135
  echo '<div id="single_custom_css_ace" class="custom_css_ace"></div>';
136
  echo '</div>';
137
  }
151
  <?php do_settings_sections( 'wp-add-custom-css_settings' ); ?>
152
  <?php submit_button( __('Save', 'wp-add-custom-css') ); ?>
153
  </form>
154
+ <h3><?php echo __('Donations', 'wp-add-custom-css'); ?></h3>
155
+ <p><?php echo __('Help me mantaining WP Add Custom CSS by making a donation:', 'wp-add-custom-css'); ?></p>
156
+ <p><?php echo __('If you have a PayPal account use', 'wp-add-custom-css'); ?> <strong><?php echo __('paypal.me (it has lower fees):', 'wp-add-custom-css'); ?></strong></p>
157
+ <a href="https://paypal.me/dandesantis" target="_blank" rel="nofollow" style="padding: 2px 6px;"><img src="<?php echo plugin_dir_url( __FILE__ ) . 'images/btn_donate.gif'; ?>"></a>
158
+ <br>
159
+ <p><?php echo __('If you don\'t have a PayPal account use this PayPal donate button:', 'wp-add-custom-css'); ?></p>
160
+ <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
161
+ <input type="hidden" name="cmd" value="_s-xclick" />
162
+ <input type="hidden" name="hosted_button_id" value="LKSYYTM9GRMEL" />
163
+ <input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif" border="0" name="submit" title="PayPal - The safer, easier way to pay online!" alt="Donate with PayPal button" />
164
+ <img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1" />
165
+ </form>
166
+ <br>
167
  <h3><?php echo __('Credits', 'wp-add-custom-css'); ?></h3>
168
  <ul>
169
+ <li><?php echo __('If you like "WP Add Custom CSS" leave a', 'wp-add-custom-css'); ?> <a href="https://wordpress.org/support/plugin/wp-add-custom-css/reviews/?filter=5" target="_blank" title="Daniele De Santis"><?php echo __('5 star review,', 'wp-add-custom-css'); ?></a> <?php echo __('thank you!', 'wp-add-custom-css'); ?></li>
170
  <li><?php echo __('"WP Add Custom CSS" is a plugin by', 'wp-add-custom-css'); ?> <a href="http://www.danieledesantis.net/" target="_blank" title="Daniele De Santis">Daniele De Santis</a></li>
171
  </ul>
172
  </div>
180
  public function main_css_input() {
181
  $custom_rules = isset( $this->options['main_custom_style'] ) ? esc_attr( $this->options['main_custom_style'] ) : '';
182
  $class = ( isset($this->options['advanced_editor_theme']) && $this->options['advanced_editor_theme'] === 'dark' ) ? ' class="wpacc_editor_dark"' : '';
183
+ $rtl_style = is_rtl() ? ' direction: ltr;' : '';
184
  echo '<div class="wpacc_editor_container">';
185
+ echo '<textarea id="main_custom_css" name="wpacc_settings[main_custom_style]" style="width:100%; min-height:300px;' . $rtl_style . '"' . $class . '>' . $custom_rules . '</textarea>';
186
  echo '<div id="main_custom_css_ace" class="custom_css_ace"></div>';
187
  echo '</div>';
188
  }