PluginProbe
Event Post / 5.6.1
Event Post v5.6.1
6.1.1 6.1.0 6.0.1 6.0.0 5.12.0 trunk 3.9 4.0 4.2 4.3 4.4 4.5 5.0 5.1 5.10.0 5.10.1 5.10.2 5.10.3 5.10.4 5.11.0 5.11.1 5.2 5.5 5.6 5.6.1 All 46 releases
event-post / inc / icons.php

icons.php in Event Post 5.6.1, at inc/icons.php

47 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace EventPost;
4 /*
5 * @package event-post
6 */
7
8
9 class DashIcons{
10 public $icons;
11 public $icons_html_entities;
12 public $transient_name;
13 public $transient_name_html_entities;
14
15 function __construct(){
16 $this->icons = [];
17 $this->icons_html_entities = [];
18 $this->transient_name = "dashicons_list";
19 $this->transient_name_html_entities = "dashicons_list_html_entities";
20 add_action('init', array(&$this,'init_icons'));
21 }
22 function init_icons() {
23 if(get_transient($this->transient_name) && get_transient($this->transient_name_html_entities)){
24 $this->icons = get_transient($this->transient_name);
25 $this->icons_html_entities = get_transient($this->transient_name_html_entities);
26 }else{
27 $css_file = file_get_contents(ABSPATH. 'wp-includes/css/dashicons.css');
28 $css_array = explode('}',$css_file);
29 foreach ($css_array as $rule) {
30 $matches = [];
31 if(preg_match( "/\.dashicons-((?:\w+-?)+\w+):before {\s*content:\s*[\"\']\\\(\w+)[\"\'];/m",
32 $rule,
33 $matches))
34 {
35 if(isset($matches[1]) && isset($matches[2])){
36 $this->icons[$matches[1]] = $matches[2];
37 $this->icons_html_entities[$matches[1]] = '&#x'.$matches[2].'; '.$matches[1];
38 }
39 }
40 }
41 set_transient($this->transient_name , $this->icons, MONTH_IN_SECONDS );
42 set_transient($this->transient_name_html_entities , $this->icons_html_entities, MONTH_IN_SECONDS );
43 }
44 }
45
46 }
47