Пример #1
0
function cloudfw_icomoon_classes($icon_list = array())
{
    $pattern = '/\\.(icomoon-?[_a-zA-Z]+[_a-zA-Z0-9-]*)(?![^\\{]*\\})/';
    $css_file = untrailingslashit(dirname(__FILE__)) . '/source/css/icomoon.css';
    if (file_exists($css_file)) {
        $subject = cloudfw_get_file_contents($css_file);
    } else {
        return array();
    }
    preg_match_all($pattern, $subject, $matches, PREG_SET_ORDER);
    $icons = array();
    foreach ($matches as $match) {
        $class = $match[1];
        $title = str_replace('icomoon-', '', $class);
        $title = str_replace('icomoon-', '', $class);
        $title = str_replace('-', ' ', $title);
        $title = ucwords($title);
        $icons['Icomoon/' . $class] = $title;
    }
    asort($icons);
    $icons = stripslashes_deep($icons);
    $icon_list = $icon_list + $icons;
    return $icon_list;
}
Пример #2
0
function cloudfw_fontawesome_classes($icon_list = array())
{
    $pattern = '/\\.(fontawesome-(?:\\w+(?:-)?)+):before\\s+{\\s*content:\\s*"(.+)";\\s+}/';
    $css_file = untrailingslashit(dirname(__FILE__)) . '/source/css/font-awesome.css';
    if (file_exists($css_file)) {
        $subject = cloudfw_get_file_contents($css_file);
    } else {
        return array();
    }
    preg_match_all($pattern, $subject, $matches, PREG_SET_ORDER);
    $icons = array();
    foreach ($matches as $match) {
        $class = $match[1];
        $title = str_replace('fontawesome-', '', $class);
        $title = str_replace('fontawesome-', '', $class);
        $title = str_replace('-', ' ', $title);
        $title = ucwords($title);
        $icons['FontAwesome/' . $class] = $title;
    }
    asort($icons);
    $icons = stripslashes_deep($icons);
    $icon_list = $icon_list + $icons;
    return $icon_list;
}