/** * Assemble the list of icon types with MLA filtering * * @since 1.40 * * @return boolean Success (true) or failure (false) of the operation */ private static function _get_current_icon_types() { if (NULL != self::$mla_current_icon_types) { return true; } /* * Get the directories in reverse order, so earlier entries will overwrite later entries and win */ $icon_dir = apply_filters('icon_dir', ABSPATH . WPINC . '/images/crystal'); $icon_dir_uri = apply_filters('icon_dir_uri', includes_url('images/crystal')); $dirs = array_reverse(apply_filters('icon_dirs', array($icon_dir => $icon_dir_uri)), true); self::$mla_current_icon_types = array(); while ($dirs) { $keys = array_keys($dirs); $dir = array_shift($keys); $uri = array_shift($dirs); if ($dh = opendir($dir)) { while (false !== ($file = readdir($dh))) { $file = basename($file); if (substr($file, 0, 1) == '.') { continue; } if (!in_array(strtolower(substr($file, -4)), array('.png', '.gif', '.jpg'))) { if (is_dir("{$dir}/{$file}")) { $dirs["{$dir}/{$file}"] = "{$uri}/{$file}"; } continue; } $name = substr($file, 0, -4); self::$mla_current_icon_types[$name] = "{$uri}/{$file}"; } closedir($dh); } } return true; }