23 lines
No EOL
775 B
PHP
23 lines
No EOL
775 B
PHP
<?php
|
|
|
|
//directory where icons arent
|
|
$files = scandir(get_stylesheet_directory().'/icons2');
|
|
|
|
function store_svg_icons_to_json($files) {
|
|
// init empty array
|
|
$json_svgs=[];
|
|
// loop into files list
|
|
foreach($files as $file) {
|
|
// remove empty files
|
|
if($file!='.' && $file!='..'){
|
|
$name = str_replace('.svg','',$file);
|
|
$icon = esc_html(file_get_contents(get_stylesheet_directory().'/icons2/'.$file));
|
|
$icon = str_replace('http://www.w3.org/2000/svg">','',$icon);
|
|
$jsons_svgs[] = [
|
|
'name'=>$name,
|
|
'icon'=>str_replace('http://www.w3.org/2000/svg">','',$icon)
|
|
];
|
|
}
|
|
}
|
|
return $jsons_svgs;
|
|
} |