本文整理汇总了PHP中HTMLPurifier_Bootstrap::getPath方法的典型用法代码示例。如果您正苦于以下问题:PHP HTMLPurifier_Bootstrap::getPath方法的具体用法?PHP HTMLPurifier_Bootstrap::getPath怎么用?PHP HTMLPurifier_Bootstrap::getPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTMLPurifier_Bootstrap
的用法示例。
在下文中一共展示了HTMLPurifier_Bootstrap::getPath方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: autoload
/**
* Autoload function for HTML Purifier
* @param $class Class to load
*/
public static function autoload($class)
{
$file = HTMLPurifier_Bootstrap::getPath($class);
if (!$file) {
return false;
}
require_once HTMLPURIFIER_PREFIX . '/' . $file;
return true;
}
示例2: autoload
/**
* Autoload function for HTML Purifier
* @param string $class Class to load
* @return bool
*/
public static function autoload($class)
{
$file = HTMLPurifier_Bootstrap::getPath($class);
if (!$file) {
return false;
}
// Technically speaking, it should be ok and more efficient to
// just do 'require', but Antonio Parraga reports that with
// Zend extensions such as Zend debugger and APC, this invariant
// may be broken. Since we have efficient alternatives, pay
// the cost here and avoid the bug.
require_once HTMLPURIFIER_PREFIX . '/' . $file;
return true;
}
示例3: get_dependency_lookup
/**
* Returns a lookup array of dependencies for a file.
*
* @note This function expects that format $name extends $parent on one line
*
* @param $file
* File to check dependencies of.
* @return
* Lookup array of files the file is dependent on, sorted accordingly.
*/
function get_dependency_lookup($file)
{
static $cache = array();
if (isset($cache[$file])) {
return $cache[$file];
}
if (!file_exists($file)) {
echo "File doesn't exist: {$file}\n";
return array();
}
$fh = fopen($file, 'r');
$deps = array();
while (!feof($fh)) {
$line = fgets($fh);
if (strncmp('class', $line, 5) === 0) {
// The implementation here is fragile and will break if we attempt
// to use interfaces. Beware!
list(, $parent) = explode(' extends ', trim($line, ' {' . "\n\r"), 2);
if (empty($parent)) {
break;
}
$dep_file = HTMLPurifier_Bootstrap::getPath($parent);
if (!$dep_file) {
break;
}
$deps[$dep_file] = true;
break;
}
}
fclose($fh);
foreach (array_keys($deps) as $file) {
// Extra dependencies must come *before* base dependencies
$deps = get_dependency_lookup($file) + $deps;
}
$cache[$file] = $deps;
return $deps;
}