Custom Icons for Elementor - Version 0.2.1

Version Description

  • Improve CSS Regen to fix changed URLs
  • Tweak CSS display of icons to match native icons
  • Change CSS font-face path to relative URLs
  • Add uninstall method to clean up left over files
Download this release

Release Info

Developer michaelbourne
Plugin Icon 128x128 Custom Icons for Elementor
Version 0.2.1
Comparing to
See all releases

Code changes from version 0.1.4 to 0.2.1

README.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: michaelbourne
3
  Donate link: https://www.paypal.me/yycpro
4
  Tags: elementor, icons, fontello, icon fonts
5
  Requires at least: 4.5
6
- Tested up to: 4.9.8
7
- Stable tag: 0.1.4
8
  License: GPLv3 or later
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.en.html
10
 
@@ -16,10 +16,9 @@ Enables the user to add their own custom icons to the built in Elementor icon co
16
 
17
  = Plugin Features =
18
 
19
- * Add unlimited icons and SVG icons to your website
20
- * Upload multiple icon packs from Fontello
21
- * View the icons in each uploaded pack, delete individually if desired
22
- * Use icons anywhere you would normally with the default Elementor icon selector
23
 
24
  Please note, this plugin requires the Elementor Page Builder to be installed and active. [Elementor is a free plugin](https://en-ca.wordpress.org/plugins/elementor/).
25
 
@@ -46,11 +45,11 @@ You bet! Upload as many as you like, they will all work. However, make sure you
46
 
47
  = HELP! It doesnt work?! =
48
 
49
- There is a small, small chance this plugin may not work on your web host. This is caused by two things generally: a mod_security rule flagging the ZIP upload, or the lack of PHP libraries needed to unzip files. Here's the good news: your host can fix both of these easily. If they refuse, consider moving to a more modern host.
50
 
51
  == Plugin Removal ==
52
 
53
- Removing this plugin will render your custom icons to be broken. Take care to remove them from your elements prior to plugin removal.
54
 
55
  == Screenshots ==
56
 
@@ -58,6 +57,12 @@ None yet
58
 
59
  == Changelog ==
60
 
 
 
 
 
 
 
61
  = 0.1.4 =
62
  * Fix the "empty box" icon error seen on some sites. Please reupload any affected fonts and regen your css.
63
 
@@ -83,6 +88,9 @@ None yet
83
 
84
  == Upgrade Notice ==
85
 
 
 
 
86
  = 0.1.4 =
87
  Fix broken icons on some sites. Font re-upload and regen required if you're affected.
88
 
3
  Donate link: https://www.paypal.me/yycpro
4
  Tags: elementor, icons, fontello, icon fonts
5
  Requires at least: 4.5
6
+ Tested up to: 5.0.2
7
+ Stable tag: 0.2.1
8
  License: GPLv3 or later
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.en.html
10
 
16
 
17
  = Plugin Features =
18
 
19
+ * Add unlimited icons and SVG icons to your website via Fontello
20
+ * View the icons in each uploaded pack, delete individual packs if desired
21
+ * Use icons anywhere you would normally with the default Elementor icon selectors
 
22
 
23
  Please note, this plugin requires the Elementor Page Builder to be installed and active. [Elementor is a free plugin](https://en-ca.wordpress.org/plugins/elementor/).
24
 
45
 
46
  = HELP! It doesnt work?! =
47
 
48
+ There is a small, small chance this plugin may not work on your web host. This is caused by two things generally: a mod_security rule flagging the ZIP upload, or the lack of PHP libraries needed to unzip files (ZipArchive). Here's the good news: your host can fix both of these easily. If they refuse, consider moving to a more modern host.
49
 
50
  == Plugin Removal ==
51
 
52
+ Removing this plugin will render your custom icons to be deleted. Take care to un-select them from your icon elements prior to plugin removal.
53
 
54
  == Screenshots ==
55
 
57
 
58
  == Changelog ==
59
 
60
+ = 0.2.1 =
61
+ * Improve CSS Regen to fix changed URLs
62
+ * Tweak CSS display of icons to match native icons
63
+ * Change CSS font-face path to relative URLs
64
+ * Add uninstall method to clean up left over files
65
+
66
  = 0.1.4 =
67
  * Fix the "empty box" icon error seen on some sites. Please reupload any affected fonts and regen your css.
68
 
88
 
89
  == Upgrade Notice ==
90
 
91
+ = 0.2.1 =
92
+ You MUST 'regen CSS' after this update.
93
+
94
  = 0.1.4 =
95
  Fix broken icons on some sites. Font re-upload and regen required if you're affected.
96
 
assets/js/elementor-custom-icons.js CHANGED
@@ -189,30 +189,6 @@ jQuery(document).ready(function($) {
189
 
190
  } );
191
 
192
- /* FUTURE: status change*/
193
- $( '.wrapper-list-fonts' ).on( 'click', '.eci-extension-status-icon', function( e ) {
194
-
195
- e.preventDefault();
196
-
197
- var request = new FormData(),
198
- $this = $( this ),
199
- data = $this.closest( '.font-item' ).find( '.delete-font' ).data( 'font' );
200
-
201
- request.append( "file_name", data.name );
202
- request.append( "action", "ec_icons_change_status" );
203
- request.append( "_wpnonce", $( '.ec-icons-drop' ).find( '#_wpnonce' ).val() );
204
-
205
- if ( $this.hasClass( 'enabled' ) ) {
206
- request.append( "sub_action", "enabled" );
207
- } else {
208
- request.append( "sub_action", "disabled" );
209
- }
210
-
211
- ajaxSend( request, function() {
212
-
213
- } );
214
-
215
- } );
216
 
217
  $('.eci-main').on('click', '.eci-extension-info-details', function(){
218
  $(this).next( $('.iconlist') ).slideToggle('slow');
189
 
190
  } );
191
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
192
 
193
  $('.eci-main').on('click', '.eci-extension-info-details', function(){
194
  $(this).next( $('.iconlist') ).slideToggle('slow');
elementor-custom-icons.php CHANGED
@@ -2,7 +2,7 @@
2
  /*
3
  Plugin Name: Custom Icons for Elementor
4
  Description: Add custom icon fonts to the built in Elementor controls
5
- Version: 0.1.4
6
  Author: Michael Bourne
7
  Author URI: https://michaelbourne.ca
8
  License: GPL3
@@ -10,7 +10,7 @@ License URI: https://www.gnu.org/licenses/gpl-3.0.en.html
10
  Text Domain: custom-icons-for-elementor
11
  Domain Path: /languages
12
  */
13
- /**
14
  Custom Icons for Elementor is a plugin for WordPress that enables you to add custom icon fonts to the built in Elementor controls.
15
  Copyright (c) 2018 Michael Bourne.
16
 
@@ -21,14 +21,18 @@ This program is distributed in the hope that it will be useful, but WITHOUT ANY
21
  You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>
22
 
23
  You can contact me at michael@michaelbourne.ca
24
- **/
 
 
 
 
25
 
26
  defined( 'ECIcons_ROOT' ) or define( 'ECIcons_ROOT', dirname( __FILE__ ) );
27
  defined( 'ECIcons_URI' ) or define( 'ECIcons_URI', plugin_dir_url( __FILE__ ) );
 
 
28
 
29
- if ( ! class_exists( 'ECIcons' ) ) {
30
-
31
- class ECIcons {
32
 
33
  /**
34
  * Core singleton class
@@ -45,14 +49,14 @@ if ( ! class_exists( 'ECIcons' ) ) {
45
  private $prefix;
46
 
47
  /**
48
- * Path download folder
49
  *
50
  * @var $upload_dir
51
  */
52
  public $upload_dir;
53
 
54
  /**
55
- * URL download folder
56
  *
57
  * @var $upload_url
58
  */
@@ -72,21 +76,13 @@ if ( ! class_exists( 'ECIcons' ) ) {
72
  */
73
  private $prefix_icon;
74
 
75
- /**
76
- * Plugin version
77
- *
78
- * @var $version
79
- */
80
- private $version;
81
-
82
  /**
83
  * Constructor.
84
  */
85
  private function __construct() {
86
 
87
- include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
88
 
89
- // merge css
90
  include_once( ECIcons_ROOT . '/includes/merge.css.php' );
91
 
92
  // save font class
@@ -111,17 +107,18 @@ if ( ! class_exists( 'ECIcons' ) ) {
111
  // load icons
112
  add_action( 'elementor/controls/controls_registered', array( $this, 'icons_filters' ), 10, 1);
113
 
 
114
  $upload = wp_upload_dir();
115
 
116
  // main variables
117
  $this->prefix = 'eci_';
118
  $this->prefix_icon = 'efs-';
119
- $this->upload_dir = $upload['basedir'] . '/elementor_icons_files';
120
- $this->upload_url = $upload['baseurl'] . '/elementor_icons_files';
121
- $this->upload_dir_single = str_replace( get_option('siteurl'), '', $this->upload_url );
122
 
123
  // set plugin version
124
- $this->version = '0.1.4';
125
 
126
  // SSL fix because WordPress core function wp_upload_dir() doesn't check protocol.
127
  if ( is_ssl() ) $this->upload_url = str_replace( 'http://', 'https://', $this->upload_url );
@@ -214,13 +211,13 @@ if ( ! class_exists( 'ECIcons' ) ) {
214
 
215
 
216
  /**
217
- * Admin enqueue scripts
218
  */
219
  public function admin_enqueue_scripts() {
220
 
221
- wp_enqueue_style( 'elementor-custom-icons-css', ECIcons_URI . 'assets/css/elementor-custom-icons.css', array(), $this->version );
222
 
223
- wp_enqueue_script( 'elementor-custom-icons', ECIcons_URI . 'assets/js/elementor-custom-icons.js', array('jquery'), $this->version, true );
224
 
225
  if ( is_admin() ) {
226
  $eci_script = array(
@@ -240,7 +237,7 @@ if ( ! class_exists( 'ECIcons' ) ) {
240
  }
241
 
242
  /**
243
- * Enqueue scripts
244
  */
245
  public function enqueue_scripts() {
246
 
@@ -270,11 +267,11 @@ if ( ! class_exists( 'ECIcons' ) ) {
270
  }
271
  }
272
 
273
-
274
  /**
275
- * @param Get font info
276
  *
277
- * @return array
 
278
  */
279
  public function get_config_font( $file_name ) {
280
 
@@ -292,14 +289,15 @@ if ( ! class_exists( 'ECIcons' ) ) {
292
  }
293
 
294
  if ( is_string( $file ) && strpos( $file, 'css' ) !== false ) {
295
- $file_part = explode( $this->upload_dir_single, $file );
296
  $data['css_folder'] = $file;
297
  $css_folder = $file_part[1];
298
  }
299
 
300
  if ( is_string( $file ) && strpos( $file, 'font' ) !== false ) {
301
- $file_part = explode( $this->upload_dir_single, $file );
302
- $data['font_url'] = $this->upload_url . $file_part[1];
 
303
  }
304
 
305
  }
@@ -323,11 +321,10 @@ if ( ! class_exists( 'ECIcons' ) ) {
323
  }
324
 
325
  /**
326
- * Add new icons to elementor
327
- *
328
- * @param $config
329
  *
330
- * @return array
 
331
  */
332
  public function icons_filters( $controls_registry ) {
333
 
@@ -361,11 +358,11 @@ if ( ! class_exists( 'ECIcons' ) ) {
361
 
362
 
363
  /**
364
- * Parse CSS to get icons.
365
  *
366
- * @param $css_file
367
- *
368
- * @return array
369
  */
370
  protected function parse_css( $css_file, $name ) {
371
 
@@ -386,11 +383,11 @@ if ( ! class_exists( 'ECIcons' ) ) {
386
 
387
 
388
  /**
389
- * Parse CSS to get icon reverse alias.
390
- *
391
- * @param $css_file
392
  *
393
- * @return array
 
 
394
  */
395
  protected function parse_css_reverse( $css_file, $name ) {
396
 
@@ -412,7 +409,8 @@ if ( ! class_exists( 'ECIcons' ) ) {
412
  /**
413
  * remove folder (recursive)
414
  *
415
- * @param $dir
 
416
  */
417
  protected function rrmdir( $dir ) {
418
 
@@ -433,7 +431,7 @@ if ( ! class_exists( 'ECIcons' ) ) {
433
  }
434
 
435
  /**
436
- * @param $name
437
  * @param bool $default
438
  * @param string $type
439
  *
@@ -450,15 +448,10 @@ if ( ! class_exists( 'ECIcons' ) ) {
450
 
451
  }
452
 
453
- }
454
-
455
- ECIcons::getInstance();
456
 
457
- /**
458
- * Main manager
459
- */
460
- function ec_icons_manager() {
461
- return ECIcons::getInstance();
462
- }
463
 
464
- }
2
  /*
3
  Plugin Name: Custom Icons for Elementor
4
  Description: Add custom icon fonts to the built in Elementor controls
5
+ Version: 0.2.1
6
  Author: Michael Bourne
7
  Author URI: https://michaelbourne.ca
8
  License: GPL3
10
  Text Domain: custom-icons-for-elementor
11
  Domain Path: /languages
12
  */
13
+ /*
14
  Custom Icons for Elementor is a plugin for WordPress that enables you to add custom icon fonts to the built in Elementor controls.
15
  Copyright (c) 2018 Michael Bourne.
16
 
21
  You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>
22
 
23
  You can contact me at michael@michaelbourne.ca
24
+ */
25
+
26
+ if( ! defined( 'ABSPATH' ) ) {
27
+ return;
28
+ }
29
 
30
  defined( 'ECIcons_ROOT' ) or define( 'ECIcons_ROOT', dirname( __FILE__ ) );
31
  defined( 'ECIcons_URI' ) or define( 'ECIcons_URI', plugin_dir_url( __FILE__ ) );
32
+ defined( 'ECIcons_VERSION' ) or define( 'ECIcons_VERSION', '0.2.1' );
33
+ defined( 'ECIcons_UPLOAD' ) or define( 'ECIcons_UPLOAD', 'elementor_icons_files' );
34
 
35
+ class ECIcons {
 
 
36
 
37
  /**
38
  * Core singleton class
49
  private $prefix;
50
 
51
  /**
52
+ * Path upload folder
53
  *
54
  * @var $upload_dir
55
  */
56
  public $upload_dir;
57
 
58
  /**
59
+ * URL upload folder
60
  *
61
  * @var $upload_url
62
  */
76
  */
77
  private $prefix_icon;
78
 
 
 
 
 
 
 
 
79
  /**
80
  * Constructor.
81
  */
82
  private function __construct() {
83
 
 
84
 
85
+ // merge font css to single .css file
86
  include_once( ECIcons_ROOT . '/includes/merge.css.php' );
87
 
88
  // save font class
107
  // load icons
108
  add_action( 'elementor/controls/controls_registered', array( $this, 'icons_filters' ), 10, 1);
109
 
110
+ // default wp upload directory
111
  $upload = wp_upload_dir();
112
 
113
  // main variables
114
  $this->prefix = 'eci_';
115
  $this->prefix_icon = 'efs-';
116
+ $this->upload_dir = $upload['basedir'] . '/' . ECIcons_UPLOAD;
117
+ $this->upload_url = $upload['baseurl'] . '/' . ECIcons_UPLOAD;
118
+ //$this->upload_dir_single = str_replace( get_option('siteurl'), '', $this->upload_url );
119
 
120
  // set plugin version
121
+ $this->version = '0.2.0';
122
 
123
  // SSL fix because WordPress core function wp_upload_dir() doesn't check protocol.
124
  if ( is_ssl() ) $this->upload_url = str_replace( 'http://', 'https://', $this->upload_url );
211
 
212
 
213
  /**
214
+ * Enqueue admin scripts
215
  */
216
  public function admin_enqueue_scripts() {
217
 
218
+ wp_enqueue_style( 'elementor-custom-icons-css', ECIcons_URI . 'assets/css/elementor-custom-icons.css', array(), ECIcons_VERSION );
219
 
220
+ wp_enqueue_script( 'elementor-custom-icons', ECIcons_URI . 'assets/js/elementor-custom-icons.js', array('jquery'), ECIcons_VERSION, true );
221
 
222
  if ( is_admin() ) {
223
  $eci_script = array(
237
  }
238
 
239
  /**
240
+ * Enqueue public scripts
241
  */
242
  public function enqueue_scripts() {
243
 
267
  }
268
  }
269
 
 
270
  /**
271
+ * Get uploaded font package's config file
272
  *
273
+ * @param string $file_name
274
+ * @return array $data
275
  */
276
  public function get_config_font( $file_name ) {
277
 
289
  }
290
 
291
  if ( is_string( $file ) && strpos( $file, 'css' ) !== false ) {
292
+ $file_part = explode( ECIcons_UPLOAD . '/', $file );
293
  $data['css_folder'] = $file;
294
  $css_folder = $file_part[1];
295
  }
296
 
297
  if ( is_string( $file ) && strpos( $file, 'font' ) !== false ) {
298
+ $file_part = explode( ECIcons_UPLOAD . '/', $file );
299
+ //$data['font_url'] = $this->upload_url . $file_part[1];
300
+ $data['font_url'] = $file_part[1];
301
  }
302
 
303
  }
321
  }
322
 
323
  /**
324
+ * Add custom icons to Elementor registry
 
 
325
  *
326
+ * @param object $controls_registry
327
+ * @return void
328
  */
329
  public function icons_filters( $controls_registry ) {
330
 
358
 
359
 
360
  /**
361
+ * Parse CSS file to get proper icon names
362
  *
363
+ * @param string $css_file
364
+ * @param string $name
365
+ * @return array $icons
366
  */
367
  protected function parse_css( $css_file, $name ) {
368
 
383
 
384
 
385
  /**
386
+ * Parse CSS file to get proper icon names (reverse parse)
 
 
387
  *
388
+ * @param string $css_file
389
+ * @param string $name
390
+ * @return array $icons
391
  */
392
  protected function parse_css_reverse( $css_file, $name ) {
393
 
409
  /**
410
  * remove folder (recursive)
411
  *
412
+ * @param string $dir
413
+ * @return void
414
  */
415
  protected function rrmdir( $dir ) {
416
 
431
  }
432
 
433
  /**
434
+ * @param string $name
435
  * @param bool $default
436
  * @param string $type
437
  *
448
 
449
  }
450
 
451
+ }
 
 
452
 
453
+ function ec_icons_manager() {
454
+ return ECIcons::getInstance();
455
+ }
 
 
 
456
 
457
+ ec_icons_manager();
includes/merge.css.php CHANGED
@@ -9,6 +9,9 @@
9
  * @since 0.1.0
10
  */
11
 
 
 
 
12
 
13
  class MergeCss_ECIcons extends ECIcons {
14
 
@@ -24,7 +27,14 @@ class MergeCss_ECIcons extends ECIcons {
24
  $options = get_option( 'ec_icons_fonts' );
25
 
26
 
27
- $css_content = "i.eci{ font-style: normal; }\n";
 
 
 
 
 
 
 
28
  if ( !empty( $options ) && is_array($options) ) {
29
  foreach ( $options as $key => $font ) {
30
 
9
  * @since 0.1.0
10
  */
11
 
12
+ if( ! defined( 'ABSPATH' ) ) {
13
+ return;
14
+ }
15
 
16
  class MergeCss_ECIcons extends ECIcons {
17
 
27
  $options = get_option( 'ec_icons_fonts' );
28
 
29
 
30
+ $css_content = "i.eci{
31
+ display: inline-block;
32
+ font: normal normal normal 14px/1 FontAwesome;
33
+ font-size: inherit;
34
+ text-rendering: auto;
35
+ -webkit-font-smoothing: antialiased;
36
+ -moz-osx-font-smoothing: grayscale;
37
+ }\n";
38
  if ( !empty( $options ) && is_array($options) ) {
39
  foreach ( $options as $key => $font ) {
40
 
includes/save.font.php CHANGED
@@ -9,6 +9,10 @@
9
  * @since 0.1.0
10
  */
11
 
 
 
 
 
12
  class SaveFont_ECIcons extends ECIcons {
13
 
14
 
@@ -84,6 +88,13 @@ class SaveFont_ECIcons extends ECIcons {
84
 
85
  }
86
 
 
 
 
 
 
 
 
87
  private function update_options( $font_data, $status ) {
88
 
89
  if ( empty( $font_data['name'] ) ) {
@@ -117,7 +128,7 @@ class SaveFont_ECIcons extends ECIcons {
117
  */
118
  public function ec_icons_delete_font() {
119
 
120
- //if ( wp_verify_nonce( $this->getRequest( '_wpnonce' ), 'ec_icons_nonce' ) ) {
121
 
122
  $file_name = $this->getRequest( 'file_name', 'font' );
123
 
@@ -148,7 +159,15 @@ class SaveFont_ECIcons extends ECIcons {
148
 
149
  echo json_encode( $result );
150
 
151
- //}
 
 
 
 
 
 
 
 
152
 
153
  die();
154
  }
@@ -156,7 +175,33 @@ class SaveFont_ECIcons extends ECIcons {
156
  /**
157
  * Regenerate CSS file
158
  */
159
- public function ec_icons_regenerate() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
160
 
161
  new MergeCss_ECIcons();
162
 
9
  * @since 0.1.0
10
  */
11
 
12
+ if( ! defined( 'ABSPATH' ) ) {
13
+ return;
14
+ }
15
+
16
  class SaveFont_ECIcons extends ECIcons {
17
 
18
 
88
 
89
  }
90
 
91
+ /**
92
+ * Update Options table
93
+ *
94
+ * @param array $font_data
95
+ * @param string $status
96
+ * @return null|string
97
+ */
98
  private function update_options( $font_data, $status ) {
99
 
100
  if ( empty( $font_data['name'] ) ) {
128
  */
129
  public function ec_icons_delete_font() {
130
 
131
+ if ( wp_verify_nonce( $this->getRequest( '_wpnonce' ), 'ec_icons_nonce' ) ) {
132
 
133
  $file_name = $this->getRequest( 'file_name', 'font' );
134
 
159
 
160
  echo json_encode( $result );
161
 
162
+ } else {
163
+
164
+ $result = array(
165
+ 'status_save' => 'deletefailed',
166
+ );
167
+
168
+ echo json_encode( $result );
169
+
170
+ }
171
 
172
  die();
173
  }
175
  /**
176
  * Regenerate CSS file
177
  */
178
+ static function ec_icons_regenerate() {
179
+
180
+ $options = get_option( 'ec_icons_fonts' );
181
+
182
+ if ( !empty( $options ) && is_array($options) ) {
183
+
184
+ $newoptions = array();
185
+
186
+ foreach ( $options as $key => $font ) {
187
+
188
+ if ( empty( $font['data'] ) ) {
189
+ continue;
190
+ }
191
+
192
+ $font_decode = json_decode($font['data'],true);
193
+
194
+ $font_data = $this->get_config_font( $font_decode['file_name'] );
195
+
196
+ $newoptions[ $font_data['name'] ] = array(
197
+ 'status' => '1',
198
+ 'data' => json_encode( $font_data ),
199
+ );
200
+
201
+ }
202
+ update_option( 'ec_icons_fonts', $newoptions );
203
+
204
+ }
205
 
206
  new MergeCss_ECIcons();
207
 
includes/template.options.page.php CHANGED
@@ -9,6 +9,10 @@
9
  * @since 0.1.0
10
  */
11
 
 
 
 
 
12
  $options = get_option( 'ec_icons_fonts' );
13
 
14
  ?>
@@ -23,7 +27,6 @@ $options = get_option( 'ec_icons_fonts' );
23
  <h2 class="eci-box-title"><?php esc_html_e( 'Elementor Custom Icons', 'custom-icons-for-elementor' ); ?></h2>
24
  </header>
25
 
26
-
27
  <div class="eci-box-content">
28
  <ul class="eci-box-features">
29
  <li>
@@ -131,7 +134,7 @@ $options = get_option( 'ec_icons_fonts' );
131
  <div class="bar"></div>
132
  </div>
133
  </output>
134
- <input id="ec-icons-files" multiple="true" name="files[]" type="file" accept=".zip" />
135
  <?php wp_nonce_field( 'ec_icons_nonce' ); ?>
136
  </div>
137
  </div>
@@ -179,7 +182,7 @@ $options = get_option( 'ec_icons_fonts' );
179
  }
180
 
181
  $font_data = json_decode( $font['data'], true );
182
- $icons = $this->parse_css( $font_data['css_root'], $key );
183
  $first_icon = ! empty( $icons ) ? key( $icons ) : '';
184
 
185
  ?>
@@ -228,7 +231,7 @@ $options = get_option( 'ec_icons_fonts' );
228
  </header>
229
 
230
  <div class="eci-box-content">
231
- <p><?php esc_html_e( 'Sometimes you may need to regenerate the CSS file for your custom icons, such as when you change your WordPress domain or update this plugin.', 'custom-icons-for-elementor' ); ?></p>
232
  <div class="ec-icons-regen">
233
  <?php esc_html_e( 'Regenerate', 'custom-icons-for-elementor' ); ?>
234
  </div>
9
  * @since 0.1.0
10
  */
11
 
12
+ if( ! defined( 'ABSPATH' ) ) {
13
+ return;
14
+ }
15
+
16
  $options = get_option( 'ec_icons_fonts' );
17
 
18
  ?>
27
  <h2 class="eci-box-title"><?php esc_html_e( 'Elementor Custom Icons', 'custom-icons-for-elementor' ); ?></h2>
28
  </header>
29
 
 
30
  <div class="eci-box-content">
31
  <ul class="eci-box-features">
32
  <li>
134
  <div class="bar"></div>
135
  </div>
136
  </output>
137
+ <input id="ec-icons-files" name="files[]" type="file" accept=".zip" />
138
  <?php wp_nonce_field( 'ec_icons_nonce' ); ?>
139
  </div>
140
  </div>
182
  }
183
 
184
  $font_data = json_decode( $font['data'], true );
185
+ $icons = ec_icons_manager()->parse_css( $font_data['css_root'], $key );
186
  $first_icon = ! empty( $icons ) ? key( $icons ) : '';
187
 
188
  ?>
231
  </header>
232
 
233
  <div class="eci-box-content">
234
+ <p><?php esc_html_e( 'Sometimes you may need to regenerate the CSS file for your custom icons, such as when you change your WordPress domain, add SSL, or update this plugin and notice font issues.', 'custom-icons-for-elementor' ); ?></p>
235
  <div class="ec-icons-regen">
236
  <?php esc_html_e( 'Regenerate', 'custom-icons-for-elementor' ); ?>
237
  </div>
uninstall.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if (!defined('WP_UNINSTALL_PLUGIN')) {
4
+ die;
5
+ }
6
+
7
+ function ecicons_rrmdir( $dir ) {
8
+
9
+ if ( is_dir( $dir ) ) {
10
+ $objects = scandir( $dir );
11
+ foreach ( $objects as $object ) {
12
+ if ( $object != "." && $object != ".." ) {
13
+ if ( is_dir( $dir . "/" . $object ) ) {
14
+ ecicons_rrmdir( $dir . "/" . $object );
15
+ } else {
16
+ unlink( $dir . "/" . $object );
17
+ }
18
+ }
19
+ }
20
+ rmdir( $dir );
21
+ }
22
+
23
+ }
24
+
25
+ $upload = wp_upload_dir();
26
+ $upload_dir = $upload['basedir'] . '/elementor_icons_files';
27
+
28
+ $options = get_option( 'ec_icons_fonts' );
29
+
30
+ if ( !empty( $options ) && is_array($options) ) {
31
+
32
+ foreach ( $options as $key => $font ) {
33
+
34
+ if ( empty( $font['data'] ) ) {
35
+ continue;
36
+ }
37
+
38
+ $font_decode = json_decode($font['data'],true);
39
+
40
+ ecicons_rrmdir( $upload_dir . '/' . $font_decode['file_name'] );
41
+
42
+ }
43
+
44
+ }
45
+ unlink( $upload_dir . '/merged-icons-font.css');
46
+ delete_option('ec_icons_fonts');