Files

57 lines
1.1 KiB
PHP
Raw Permalink Normal View History

<?php
namespace um\core;
2023-06-08 14:11:42 +03:00
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
2018-03-26 01:27:46 +03:00
if ( ! class_exists( 'um\core\FontIcons' ) ) {
2018-03-20 13:24:38 +02:00
/**
* Class FontIcons
* @package um\core
*/
class FontIcons {
2023-06-08 14:11:42 +03:00
/**
* The list of the FontIcons.
*
* @var array
*/
public $all = array();
2018-03-20 13:24:38 +02:00
/**
* FontIcons constructor.
*/
2023-06-08 14:11:42 +03:00
public function __construct() {
$cached_option = get_option( 'um_cache_fonticons', array() );
2023-06-08 14:11:42 +03:00
if ( empty( $cached_option ) ) {
2023-09-26 12:25:49 +03:00
$files['ii'] = UM_PATH . 'assets/libs/legacy/fonticons/fonticons-ii.css';
$files['fa'] = UM_PATH . 'assets/libs/legacy/fonticons/fonticons-fa.css';
$array = array();
2018-03-20 13:24:38 +02:00
foreach ( $files as $c => $file ) {
$css = file_get_contents( $file );
2023-06-08 14:11:42 +03:00
if ( 'fa' === $c ) {
preg_match_all( '/\.(um-faicon-.*?):before/', $css, $matches );
2018-03-20 13:24:38 +02:00
} else {
2023-06-08 14:11:42 +03:00
preg_match_all( '/\.(um-icon-.*?):before/', $css, $matches );
2018-03-20 13:24:38 +02:00
}
2018-03-20 13:24:38 +02:00
foreach ( $matches[1] as $match ) {
2023-06-08 14:11:42 +03:00
$icon = str_replace( ':before', '', $match );
2018-03-20 13:24:38 +02:00
$array[] = $icon;
}
$array = array_unique( $array );
2018-03-20 13:24:38 +02:00
}
2018-03-20 13:24:38 +02:00
update_option( 'um_cache_fonticons', $array );
}
2023-06-08 14:11:42 +03:00
$this->all = $cached_option;
2018-03-20 13:24:38 +02:00
}
}
2023-06-08 14:11:42 +03:00
}