本文整理汇总了PHP中HTMLPurifier_Bootstrap类的典型用法代码示例。如果您正苦于以下问题:PHP HTMLPurifier_Bootstrap类的具体用法?PHP HTMLPurifier_Bootstrap怎么用?PHP HTMLPurifier_Bootstrap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了HTMLPurifier_Bootstrap类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _initAutoload
protected function _initAutoload()
{
require_once 'htmlpurifier/HTMLPurifier/Bootstrap.php';
HTMLPurifier_Bootstrap::registerAutoload();
$moduleLoader = new Zend_Application_Module_Autoloader(array('namespace' => 'App', 'basePath' => APPLICATION_PATH));
return $moduleLoader;
}
示例2: __autoload
function __autoload($ClassName)
{
// echo $ClassName;
if (class_exists('HTMLPurifier_Bootstrap', FALSE) && HTMLPurifier_Bootstrap::autoload($ClassName)) {
return true;
}
if (!class_exists('Gdn_FileSystem', FALSE)) {
return false;
}
if (substr($ClassName, 0, 4) === 'Gdn_') {
$LibraryFileName = 'class.' . strtolower(substr($ClassName, 4)) . '.php';
} else {
$LibraryFileName = 'class.' . strtolower($ClassName) . '.php';
}
if (!is_null($ApplicationManager = Gdn::Factory('ApplicationManager'))) {
$ApplicationWhiteList = Gdn::Factory('ApplicationManager')->EnabledApplicationFolders();
} else {
$ApplicationWhiteList = NULL;
}
$LibraryPath = FALSE;
// If this is a model, look in the models folder(s)
if (strtolower(substr($ClassName, -5)) == 'model') {
$LibraryPath = Gdn_FileSystem::FindByMapping('library_mappings.php', 'Library', PATH_APPLICATIONS, $ApplicationWhiteList, 'models' . DS . $LibraryFileName);
}
if ($LibraryPath === FALSE) {
$LibraryPath = Gdn_FileSystem::FindByMapping('library_mappings.php', 'Library', PATH_LIBRARY, array('core', 'database', 'vendors' . DS . 'phpmailer', 'vendors' . DS . 'htmlpurifier'), $LibraryFileName);
}
// If it still hasn't been found, check for modules
if ($LibraryPath === FALSE) {
$LibraryPath = Gdn_FileSystem::FindByMapping('library_mappings.php', 'Library', PATH_APPLICATIONS, $ApplicationWhiteList, 'modules' . DS . $LibraryFileName);
}
if ($LibraryPath !== FALSE) {
include_once $LibraryPath;
}
}
示例3: _initFilter
public function _initFilter()
{
HTMLPurifier_Bootstrap::registerAutoload();
$config = HTMLPurifier_Config::createDefault();
$config->set('Attr.EnableID', true);
$config->set('HTML.Strict', true);
Zend_Registry::set('purifier', new HTMLPurifier($config));
}
示例4: init
public function init()
{
HTMLPurifier_Bootstrap::registerAutoload();
$config = HTMLPurifier_Config::createDefault();
foreach ($this->getOptions() as $k => $item) {
$config->set(str_replace('_', '.', $k), $item);
}
Zend_Registry::set('HTMLPurifier', new HTMLPurifier($config));
}
示例5: __construct
public function __construct($options = null)
{
HTMLPurifier_Bootstrap::registerAutoLoad();
$config = HTMLPurifier_Config::createDefault();
$config->set('Attr.EnableID', true);
$config->set('Attr.IDPrefix', 'MyPrefix_');
$config->set('Cache.SerializerPath', APPLICATION_PATH . '/../cache');
$this->_purifier = new HTMLPurifier($config);
}
示例6: 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;
}
示例7: __construct
public function __construct($options = null)
{
HTMLPurifier_Bootstrap::registerAutoload();
$config = HTMLPurifier_Config::createDefault();
$config->set('HTML.Strict', true);
$config->set('Attr.EnableID', true);
$config->set('Attr.IDPrefix', 'MyPrefix_');
$this->purifier = new HTMLPurifier($config);
}
示例8: __autoload
function __autoload($class)
{
if (!function_exists('spl_autoload_register')) {
if (HTMLPurifier_Bootstrap::autoload($class)) {
return true;
}
if (HTMLPurifierExtras::autoload($class)) {
return true;
}
}
require str_replace('_', '/', $class) . '.php';
return true;
}
示例9: __construct
public function __construct($options = null)
{
// lista de chaves para $config->set($key, $value)
HTMLPurifier_Bootstrap::registerAutoload();
$config = HTMLPurifier_Config::createDefault();
$config->set('HTML.Strict', true);
$config->set('Attr.EnableID', true);
$config->set('HTML.TargetBlank', true);
// vídeos do youtube e object's do HTML
$config->set('HTML.SafeObject', true);
$config->set('Output.FlashCompat', true);
$this->purifier = new HTMLPurifier($config);
}
示例10: 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;
}
示例11: __construct
public function __construct($options = array())
{
if (self::$purifier !== null) {
return;
}
\HTMLPurifier_Bootstrap::registerAutoload();
$config = \HTMLPurifier_Config::createDefault();
foreach ($options as $key => $val) {
if ($val === '1' || $val === '') {
$val = (bool) $val;
}
$config->set(str_replace('_', '.', $key), $val);
}
self::$purifier = new \BasePurifier($config);
}
示例12: getInstance
/**
* Returns the singleton HTMLPurifier or a mock object
*
* @return HTMLPurifier|Piwik_HTMLPurifier
*/
public static function getInstance()
{
if (self::$instance == null) {
if (file_exists(PIWIK_INCLUDE_PATH . '/libs/HTMLPurifier.php')) {
if (!class_exists('HTMLPurifier_Bootstrap', false)) {
HTMLPurifier_Bootstrap::registerAutoload();
}
$config = HTMLPurifier_Config::createDefault();
$config->set('Cache.SerializerPath', PIWIK_USER_PATH . '/tmp/purifier');
self::$instance = new HTMLPurifier($config);
} else {
$c = __CLASS__;
self::$instance = new $c();
}
}
return self::$instance;
}
示例13: 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;
}
示例14: require_once
<?php
/**
* CMarkdownParser class file.
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @link http://www.yiiframework.com/
* @copyright Copyright © 2008-2011 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
require_once(Yii::getPathOfAlias('system.vendors.markdown.markdown').'.php');
if(!class_exists('HTMLPurifier_Bootstrap',false))
{
require_once(Yii::getPathOfAlias('system.vendors.htmlpurifier').DIRECTORY_SEPARATOR.'HTMLPurifier.standalone.php');
HTMLPurifier_Bootstrap::registerAutoload();
}
/**
* CMarkdownParser is a wrapper of {@link http://michelf.com/projects/php-markdown/extra/ MarkdownExtra_Parser}.
*
* CMarkdownParser extends MarkdownExtra_Parser by using Text_Highlighter
* to highlight code blocks with specific language syntax.
* In particular, if a code block starts with the following:
* <pre>
* [language]
* </pre>
* The syntax for the specified language will be used to highlight
* code block. The languages supported include (case-insensitive):
* ABAP, CPP, CSS, DIFF, DTD, HTML, JAVA, JAVASCRIPT,
* MYSQL, PERL, PHP, PYTHON, RUBY, SQL, XML
*
示例15: clear_xss
function clear_xss($val)
{
if ($GLOBALS['logged']['admin']) {
return $val;
}
// HTML Purifier plugin
global $oHtmlPurifier;
require_once BX_DIRECTORY_PATH_PLUGINS . 'htmlpurifier/HTMLPurifier.standalone.php';
if (!isset($oHtmlPurifier)) {
HTMLPurifier_Bootstrap::registerAutoload();
$oConfig = HTMLPurifier_Config::createDefault();
$oConfig->set('Cache.SerializerPath', rtrim(BX_DIRECTORY_PATH_CACHE, '/'));
$oConfig->set('Cache.SerializerPermissions', 0777);
$oConfig->set('HTML.SafeObject', 'true');
$oConfig->set('Output.FlashCompat', 'true');
$oConfig->set('HTML.FlashAllowFullScreen', 'true');
if (getParam('sys_antispam_add_nofollow')) {
$sHost = parse_url(BX_DOL_URL_ROOT, PHP_URL_HOST);
$oConfig->set('URI.Host', $sHost);
$oConfig->set('HTML.Nofollow', 'true');
}
if ($sSafeIframeRegexp = getParam('sys_safe_iframe_regexp')) {
$oConfig->set('HTML.SafeIframe', 'true');
$oConfig->set('URI.SafeIframeRegexp', $sSafeIframeRegexp);
}
$oConfig->set('Filter.Custom', array(new HTMLPurifier_Filter_LocalMovie(), new HTMLPurifier_Filter_YouTube(), new HTMLPurifier_Filter_YoutubeIframe(), new HTMLPurifier_Filter_AddBxLinksClass()));
$oDef = $oConfig->getHTMLDefinition(true);
$oDef->addAttribute('a', 'target', 'Enum#_blank,_self,_target,_top');
$oHtmlPurifier = new HTMLPurifier($oConfig);
}
return $oHtmlPurifier->purify($val);
}