From 00cf0d7c0dba53d1517db030f03bd1dfdf43d71f Mon Sep 17 00:00:00 2001 From: daomapsieucap Date: Thu, 21 Apr 2022 11:41:42 +0700 Subject: [PATCH] :rocket: release v4.0.0, improve php code --- CHANGELOG.md | 2 +- README.md | 11 +++--- acf-icomoon.php | 13 +++---- changelog.txt | 2 +- {includes => compatibility}/js_composer.php | 40 ++++++++++----------- includes/helper.php | 1 + readme.txt | 10 +++--- 7 files changed, 38 insertions(+), 41 deletions(-) rename {includes => compatibility}/js_composer.php (98%) diff --git a/CHANGELOG.md b/CHANGELOG.md index e970c7f..4219c35 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ All notable changes to this project will be documented in this file. ## Changelog -### v4.0.0 - 2022-04-20 +### v4.0.0 - 2022-04-21 - New: Mass upgrade with VueJS and a brand-new layout. diff --git a/README.md b/README.md index 3db7467..cb11f5f 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@
- + Icomoon for Advanced Custom Fields - +

IcoMoon for Advanced Custom Fields

- +

A new ACF field that allows to select icon from IcoMoon json.

@@ -22,7 +22,6 @@

- ## Getting started ### Download @@ -36,11 +35,11 @@ from [releases](https://github.com/viivue/acf-icomoon/releases) Go to Field Groups > Create new Field and choose Icomoon Type in Content Group. -![Screenshot 1](https://ps.w.org/acf-icomoon/assets/screenshot-3.png) +![Screenshot 3](https://ps.w.org/acf-icomoon/assets/screenshot-3.png) How it looks in the page -![Screenshot 2](https://ps.w.org/acf-icomoon/assets/screenshot-1.png) +![Screenshot 1](https://ps.w.org/acf-icomoon/assets/screenshot-1.png) ![Screenshot 2](https://ps.w.org/acf-icomoon/assets/screenshot-2.png) ## Compatibility diff --git a/acf-icomoon.php b/acf-icomoon.php index 116c3c8..fee1ef0 100644 --- a/acf-icomoon.php +++ b/acf-icomoon.php @@ -25,7 +25,7 @@ * Definitions */ -define('ACFICOMOON_VERSION', '4.0.0'); +const ACFICOMOON_VERSION = '4.0.0'; define("ACFICOMOON_DIR", plugin_dir_path(__FILE__)); define("ACFICOMOON_ASSETS_URL", plugin_dir_url(__FILE__) . 'assets/'); define("ACFICOMOON_STYLESHEET_DIR", get_stylesheet_directory()); @@ -41,15 +41,12 @@ include_once(ACFICOMOON_DIR . 'includes/acf-icomoon.php'); /** - * Init Functions + * WPBakery Page Builder */ -add_action('init', 'viivue_icomoon_init'); -function viivue_icomoon_init(){ - // WPBakery Page Builder Param - if(defined('WPB_VC_VERSION')){ - include_once(ACFICOMOON_DIR . 'includes/js_composer.php'); - } +add_action('vc_before_init', 'viivue_icomoon_vc_param'); +function viivue_icomoon_vc_param(){ + include_once(ACFICOMOON_DIR . 'compatibility/js_composer.php'); } /** diff --git a/changelog.txt b/changelog.txt index 8e887e3..f73db29 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,7 +1,7 @@ == Changelog == = 4.0.0 = -*Release Date - 20 April 2022* +*Release Date - 21 April 2022* - New: Mass upgrade with VueJS and a brand-new layout. diff --git a/includes/js_composer.php b/compatibility/js_composer.php similarity index 98% rename from includes/js_composer.php rename to compatibility/js_composer.php index ef2767c..b10126e 100644 --- a/includes/js_composer.php +++ b/compatibility/js_composer.php @@ -1,21 +1,21 @@ -viivue_get_icomoon_json($json_path); - $type = viivue_array_key_exists("type", $settings); - $param_name = viivue_array_key_exists("param_name", $settings); - $value = esc_attr($value); - $input_html = ''; - - $html = $acf_icomoon->viivue_icomoon_select_html($icon_array, $value, $input_html, true); - $html .= ''; - - return $html; +viivue_get_icomoon_json($json_path); + $type = viivue_array_key_exists("type", $settings); + $param_name = viivue_array_key_exists("param_name", $settings); + $value = esc_attr($value); + $input_html = ''; + + $html = $acf_icomoon->viivue_icomoon_select_html($icon_array, $value, $input_html, true); + $html .= ''; + + return $html; } \ No newline at end of file diff --git a/includes/helper.php b/includes/helper.php index 16d0889..1782a40 100644 --- a/includes/helper.php +++ b/includes/helper.php @@ -2,6 +2,7 @@ /** * Get specific item from array with callback default value */ + if(!function_exists('viivue_array_key_exists')){ function viivue_array_key_exists($key, $array, $default = ''){ if($array && is_array($array)){ diff --git a/readme.txt b/readme.txt index a7f582b..60f0597 100644 --- a/readme.txt +++ b/readme.txt @@ -2,8 +2,8 @@ Contributors: viivue, daomapsieucap, phucbm Tags: Advanced Custom Fields, ACF, Icomoon Requires at least: 4.7 -Tested up to: 5.8 -Requires PHP: 5.6 +Tested up to: 5.9.3 +Requires PHP: 7.0 Stable tag: 4.0.0 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -17,7 +17,7 @@ This ACF field type is compatible with: == Installation == -1. Download Support For Icomoon with Advanced Custom Fields plugin +1. Download "Support For Icomoon with Advanced Custom Fields" plugin 2. Upload it to your wp-content/plugins directory 3. Go to CMS admin plugins list and activate the plugin 4. Go to Field Groups > Create new Field and choose Icomoon Type in Content Group. @@ -26,11 +26,11 @@ This ACF field type is compatible with: 1. New field type Icomoon in ACF 2. Select icon -3. Additional field for WPBakery (formerly Visual Composer) +3. Additional field for WPBakery Page Builder plugin (formerly Visual Composer) == Changelog == = 4.0.0 = -*Release Date - 20 April 2022* +*Release Date - 21 April 2022* - New: Mass upgrade with VueJS and a brand-new layout. \ No newline at end of file