- fixed PHP errors;

This commit is contained in:
Mykyta Synelnikov
2023-06-08 14:11:42 +03:00
parent 336e807a50
commit 75050b93de
+18 -15
View File
@@ -1,42 +1,47 @@
<?php
namespace um\core;
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) exit;
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'um\core\FontIcons' ) ) {
/**
* Class FontIcons
* @package um\core
*/
class FontIcons {
/**
* The list of the FontIcons.
*
* @var array
*/
public $all = array();
/**
* FontIcons constructor.
*/
function __construct() {
if ( ! get_option( 'um_cache_fonticons' ) ) {
public function __construct() {
$cached_option = get_option( 'um_cache_fonticons', array() );
if ( empty( $cached_option ) ) {
$files['ii'] = um_path . 'assets/css/um-fonticons-ii.css';
$files['fa'] = um_path . 'assets/css/um-fonticons-fa.css';
$array = array();
foreach ( $files as $c => $file ) {
$css = file_get_contents( $file );
if ( $c == 'fa' ) {
preg_match_all('/\.(um-faicon-.*?):before/', $css, $matches);
if ( 'fa' === $c ) {
preg_match_all( '/\.(um-faicon-.*?):before/', $css, $matches );
} else {
preg_match_all('/\.(um-icon-.*?):before/', $css, $matches);
preg_match_all( '/\.(um-icon-.*?):before/', $css, $matches );
}
foreach ( $matches[1] as $match ) {
$icon = str_replace( ':before', '', $match );
$icon = str_replace( ':before', '', $match );
$array[] = $icon;
}
$array = array_unique( $array );
@@ -45,9 +50,7 @@ if ( ! class_exists( 'um\core\FontIcons' ) ) {
update_option( 'um_cache_fonticons', $array );
}
$this->all = get_option( 'um_cache_fonticons' );
$this->all = $cached_option;
}
}
}
}