Skip to content

Commit

Permalink
🔖 release v4.0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
daomapsieucap committed Aug 24, 2022
1 parent f921990 commit 6c8b832
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 21 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.

## Changelog

### v4.0.5 - 2022-08-24

- Fixed: Check icon multicolor before output SVG.

### v4.0.4 - 2022-08-23

- Fixed: Fix issue Uncaught TypeError: Cannot access offset of type string on string in
Expand Down
2 changes: 1 addition & 1 deletion acf-icomoon.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Support For Icomoon with Advanced Custom Fields
* Plugin URI: https://wordpress.org/plugins/acf-icomoon/
* Description: 🔩 Add a field to select icons from a selection.json file generated by IcoMoon
* Version: 4.0.4
* Version: 4.0.5
* Requires at least: 5.2
* Requires PHP: 7.2
* Author: ViiVue
Expand Down
5 changes: 5 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
== Changelog ==

= 4.0.5 =
*Release Date - 24 August 2022*

- Fixed: Check icon multicolor before output SVG.

= 4.0.4 =
*Release Date - 23 August 2022*

Expand Down
36 changes: 20 additions & 16 deletions includes/fields/acf-field-icomoon.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,26 +132,30 @@ function viivue_get_icomoon_json($json_path = ''): array{
$icons = viivue_array_key_exists('icons', $icomoon_json);
if($icons){
foreach($icons as $icon){
$icon_obj = viivue_array_key_exists('icon', $icon);
$icon_paths = viivue_array_key_exists('paths', $icon_obj);
$icon_attrs = viivue_array_key_exists('attrs', $icon_obj);
$icon_props = viivue_array_key_exists('properties', $icon);
$icon_name = viivue_array_key_exists('name', $icon_props);
$icon_class = $prefix . $icon_name;
$icon_obj = viivue_array_key_exists('icon', $icon);
$icon_paths = viivue_array_key_exists('paths', $icon_obj);
$icon_attrs = viivue_array_key_exists('attrs', $icon_obj);
$is_multicolor = viivue_array_key_exists('isMulticolor', $icon_obj);
$icon_props = viivue_array_key_exists('properties', $icon);
$icon_name = viivue_array_key_exists('name', $icon_props);
$icon_class = $prefix . $icon_name;

// loop icon data
$icon_html_inner = '';
$icon_svg_inner = '';
foreach($icon_paths as $index => $path){
$fill = viivue_array_key_exists('fill', $icon_attrs[$index]);

// svg
$icon_svg_inner .= '<path fill="' . $fill . '" d="' . $path . '"></path>';

// html
if(count($icon_paths) > 1){
// only output span if there are more than 1 path
$icon_html_inner .= '<span class="path' . ($index + 1) . '"></span>';
if($icon_paths){
foreach($icon_paths as $index => $path){
$fill = viivue_array_key_exists('fill', $icon_attrs[$index]);
if($fill){
// svg
$icon_svg_inner .= '<path fill="' . $fill . '" d="' . $path . '"></path>';

// html
if($is_multicolor){
// only output span if there are more than 1 path
$icon_html_inner .= '<span class="path' . ($index + 1) . '"></span>';
}
}
}
}

Expand Down
8 changes: 4 additions & 4 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Tags: Advanced Custom Fields, ACF, Icomoon
Requires at least: 4.7
Tested up to: 6.0.1
Requires PHP: 7.0
Stable tag: 4.0.3
Stable tag: 4.0.5
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand All @@ -30,7 +30,7 @@ This ACF field type is compatible with:

== Changelog ==

= 4.0.4 =
*Release Date - 23 August 2022*
= 4.0.5 =
*Release Date - 24 August 2022*

- Fixed: Fix issue Uncaught TypeError: Cannot access offset of type string on string in acf-icomoon/includes/fields/acf-field-icomoon.php:146.
- Fixed: Check icon multicolor before output SVG.

0 comments on commit 6c8b832

Please sign in to comment.