Advanced Custom Fields: Font Awesome Field - Version 1.6.3

Version Description

  • Fixed asset path errors when including this add-on from a theme instead of the plugins directory
Download this release

Release Info

Developer mattkeys
Plugin Icon 128x128 Advanced Custom Fields: Font Awesome Field
Version 1.6.3
Comparing to
See all releases

Code changes from version 1.6.2 to 1.6.3

acf-font-awesome-v5.php CHANGED
@@ -35,13 +35,13 @@ class acf_field_font_awesome extends acf_field {
35
 
36
  $this->settings = array(
37
  'path' => dirname(__FILE__),
38
- 'dir' => plugin_dir_url( __FILE__ ),
39
  'version' => '1.5'
40
  );
41
 
42
  add_filter('acf/load_field', array( $this, 'maybe_enqueue_font_awesome' ) );
43
 
44
- parent::__construct();
45
  }
46
 
47
  function get_icons()
@@ -284,7 +284,7 @@ class acf_field_font_awesome extends acf_field {
284
  */
285
 
286
  function input_admin_enqueue_scripts() {
287
-
288
  // register acf scripts
289
  wp_enqueue_script('acf-input-font-awesome-edit-input', $this->settings['dir'] . 'js/edit_input.js', array(), $this->settings['version']);
290
  wp_enqueue_style('acf-input-font-awesome-input', $this->settings['dir'] . 'css/input.css', array(), $this->settings['version']);
@@ -306,7 +306,7 @@ class acf_field_font_awesome extends acf_field {
306
  */
307
 
308
  function field_group_admin_enqueue_scripts() {
309
-
310
  // register acf scripts
311
  wp_enqueue_script('font-awesome-create-input', $this->settings['dir'] . 'js/create_input.js', array(), $this->settings['version']);
312
  wp_enqueue_style('acf-input-font-awesome-input', $this->settings['dir'] . 'css/input.css', array(), $this->settings['version']);
@@ -356,7 +356,40 @@ class acf_field_font_awesome extends acf_field {
356
 
357
  return $value;
358
  }
359
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
360
  }
361
 
362
 
35
 
36
  $this->settings = array(
37
  'path' => dirname(__FILE__),
38
+ 'dir' => $this->helpers_get_dir( __FILE__ ),
39
  'version' => '1.5'
40
  );
41
 
42
  add_filter('acf/load_field', array( $this, 'maybe_enqueue_font_awesome' ) );
43
 
44
+ parent::__construct();
45
  }
46
 
47
  function get_icons()
284
  */
285
 
286
  function input_admin_enqueue_scripts() {
287
+
288
  // register acf scripts
289
  wp_enqueue_script('acf-input-font-awesome-edit-input', $this->settings['dir'] . 'js/edit_input.js', array(), $this->settings['version']);
290
  wp_enqueue_style('acf-input-font-awesome-input', $this->settings['dir'] . 'css/input.css', array(), $this->settings['version']);
306
  */
307
 
308
  function field_group_admin_enqueue_scripts() {
309
+
310
  // register acf scripts
311
  wp_enqueue_script('font-awesome-create-input', $this->settings['dir'] . 'js/create_input.js', array(), $this->settings['version']);
312
  wp_enqueue_style('acf-input-font-awesome-input', $this->settings['dir'] . 'css/input.css', array(), $this->settings['version']);
356
 
357
  return $value;
358
  }
359
+
360
+ /*
361
+ * helpers_get_dir()
362
+ *
363
+ * Helper function taken from ACF 4.x to allow finding of asset paths when plugin is included from outside the plugins directory
364
+ *
365
+ */
366
+
367
+ function helpers_get_dir( $file ) {
368
+ $dir = trailingslashit( dirname( $file ) );
369
+ $count = 0;
370
+
371
+ // sanitize for Win32 installs
372
+ $dir = str_replace('\\' ,'/', $dir);
373
+
374
+ // if file is in plugins folder
375
+ $wp_plugin_dir = str_replace( '\\' ,'/', WP_PLUGIN_DIR );
376
+ $dir = str_replace( $wp_plugin_dir, plugins_url(), $dir, $count );
377
+
378
+ if ( $count < 1 ) {
379
+ // if file is in wp-content folder
380
+ $wp_content_dir = str_replace( '\\' ,'/', WP_CONTENT_DIR );
381
+ $dir = str_replace( $wp_content_dir, content_url(), $dir, $count );
382
+ }
383
+
384
+ if ( $count < 1 ) {
385
+ // if file is in ??? folder
386
+ $wp_dir = str_replace( '\\' ,'/', ABSPATH );
387
+ $dir = str_replace( $wp_dir, site_url( '/' ), $dir );
388
+ }
389
+
390
+ return $dir;
391
+ }
392
+
393
  }
394
 
395
 
acf-font-awesome.php CHANGED
@@ -2,7 +2,7 @@
2
  /*
3
  Plugin Name: Advanced Custom Fields: Font Awesome
4
  Description: Add a Font Awesome field type to Advanced Custom Fields
5
- Version: 1.6.2
6
  Author: Matt Keys
7
  Author URI: http://mattkeys.me/
8
  License: GPLv2 or later
2
  /*
3
  Plugin Name: Advanced Custom Fields: Font Awesome
4
  Description: Add a Font Awesome field type to Advanced Custom Fields
5
+ Version: 1.6.3
6
  Author: Matt Keys
7
  Author URI: http://mattkeys.me/
8
  License: GPLv2 or later
better-font-awesome-library/README.md CHANGED
File without changes
better-font-awesome-library/better-font-awesome-library.php CHANGED
File without changes
better-font-awesome-library/css/admin-styles.css CHANGED
File without changes
better-font-awesome-library/js/tinymce-icons-old.js CHANGED
File without changes
better-font-awesome-library/js/tinymce-icons.js CHANGED
File without changes
better-font-awesome-library/lib/fallback-font-awesome/README.md CHANGED
File without changes
better-font-awesome-library/lib/fallback-font-awesome/css/font-awesome.css CHANGED
File without changes
better-font-awesome-library/lib/fallback-font-awesome/css/font-awesome.min.css CHANGED
File without changes
better-font-awesome-library/lib/fallback-font-awesome/fonts/FontAwesome.otf CHANGED
File without changes
better-font-awesome-library/lib/fallback-font-awesome/fonts/fontawesome-webfont.eot CHANGED
File without changes
better-font-awesome-library/lib/fallback-font-awesome/fonts/fontawesome-webfont.svg CHANGED
File without changes
better-font-awesome-library/lib/fallback-font-awesome/fonts/fontawesome-webfont.ttf CHANGED
File without changes
better-font-awesome-library/lib/fallback-font-awesome/fonts/fontawesome-webfont.woff CHANGED
File without changes
better-font-awesome-library/lib/fallback-font-awesome/package.json CHANGED
File without changes
css/input.css CHANGED
File without changes
js/create_input.js CHANGED
File without changes
js/edit_input.js CHANGED
File without changes
js/select2/select2_locale_zh-TW.js CHANGED
File without changes
readme.txt CHANGED
@@ -40,6 +40,9 @@ This ACF field type is compatible with:
40
 
41
  == Changelog ==
42
 
 
 
 
43
  = 1.6.2 =
44
  * Rolling back changes from 1.6.1 after a number of bugs were reported. Incompatibility issues with Better Font Awesome have been corrected in that plugins code.
45
 
@@ -79,6 +82,9 @@ This ACF field type is compatible with:
79
 
80
  == Upgrade Notice ==
81
 
 
 
 
82
  = 1.6.2 =
83
  Rolling back changes from 1.6.1 after a number of bugs were reported. Incompatibility issues with Better Font Awesome have been corrected in that plugins code.
84
 
40
 
41
  == Changelog ==
42
 
43
+ = 1.6.3 =
44
+ * Fixed asset path errors when including this add-on from a theme instead of the plugins directory
45
+
46
  = 1.6.2 =
47
  * Rolling back changes from 1.6.1 after a number of bugs were reported. Incompatibility issues with Better Font Awesome have been corrected in that plugins code.
48
 
82
 
83
  == Upgrade Notice ==
84
 
85
+ = 1.6.3 =
86
+ Fixed asset path errors when including this add-on from a theme instead of the plugins directory
87
+
88
  = 1.6.2 =
89
  Rolling back changes from 1.6.1 after a number of bugs were reported. Incompatibility issues with Better Font Awesome have been corrected in that plugins code.
90