/** * Reads entire file into an array * * @access public * * @param string $file Path to the file. * @return array|bool the file contents in an array or false on failure. */ public function get_contents_array($file) { if ($this->authorized()) { return parent::get_contents_array($file); } else { return false; } }
function dt_exctract_icon($file = "", $pref = "") { $wp_filesystem = new WP_Filesystem_Direct(array()); if (!$wp_filesystem->is_file($file) || !$wp_filesystem->exists($file)) { return false; } if ($buffers = $wp_filesystem->get_contents_array($file)) { $icons = array(); foreach ($buffers as $line => $buffer) { if (preg_match("/^(\\." . $pref . ")([^:\\]\"].*?):before/i", $buffer, $out)) { if ($out[2] !== "") { $icons[$pref . $out[2]] = $pref . $out[2]; } } } return $icons; } else { return false; } }