Files
ultimatemember/includes/core/class-fonticons.php
T

53 lines
994 B
PHP
Raw Normal View History

<?php
namespace um\core;
// Exit if accessed directly
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 {
2018-03-20 13:24:38 +02:00
/**
* FontIcons constructor.
*/
function __construct() {
2018-03-20 13:24:38 +02:00
if ( ! get_option( 'um_cache_fonticons' ) ) {
2018-03-20 13:24:38 +02:00
$files['ii'] = um_path . 'assets/css/um-fonticons-ii.css';
$files['fa'] = um_path . 'assets/css/um-fonticons-fa.css';
2018-03-20 13:24:38 +02:00
foreach ( $files as $c => $file ) {
2018-03-20 13:24:38 +02:00
$css = file_get_contents( $file );
2018-03-20 13:24:38 +02:00
if ( $c == 'fa' ) {
preg_match_all('/(um-faicon-.*?)\s?\{/', $css, $matches);
} else {
preg_match_all('/(um-icon-.*?)\s?\{/', $css, $matches);
}
2018-03-20 13:24:38 +02:00
unset( $matches[1][0] );
foreach ( $matches[1] as $match ) {
$icon = str_replace( ':before', '', $match );
$array[] = $icon;
}
2018-03-20 13:24:38 +02:00
}
2018-03-20 13:24:38 +02:00
update_option( 'um_cache_fonticons', $array );
}
$this->all = get_option( 'um_cache_fonticons' );
}
}
}