本文整理汇总了PHP中HTMLPurifier_Bootstrap类的典型用法代码示例。如果您正苦于以下问题:PHP HTMLPurifier_Bootstrap类的具体用法?PHP HTMLPurifier_Bootstrap怎么用?PHP HTMLPurifier_Bootstrap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了HTMLPurifier_Bootstrap类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:hukumonline,项目名称:admin,代码行数:7,代码来源:Bootstrap.php
示例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;
}
}
开发者ID:Aetasiric,项目名称:Garden,代码行数:35,代码来源:functions.general.php
示例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));
}
开发者ID:lynguyetvan88,项目名称:webtuthien,代码行数:8,代码来源:Bootstrap.php
示例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));
}
开发者ID:tests1,项目名称:zendcasts,代码行数:9,代码来源:HTMLPurifier.php
示例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);
}
开发者ID:GEANT,项目名称:CORE,代码行数:9,代码来源:HTMLPurifier.php
示例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;
}
开发者ID:laiello,项目名称:lion-framework,代码行数:13,代码来源:Bootstrap.php
示例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);
}
开发者ID:tests1,项目名称:zendcasts,代码行数:9,代码来源:HTMLPurifier.php
示例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;
}
开发者ID:sebbie42,项目名称:casebox,代码行数:13,代码来源:common.php
示例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);
}
开发者ID:jovanepires,项目名称:sige,代码行数:13,代码来源:HTMLPurifier.php
示例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;
}
开发者ID:ajnok,项目名称:yii2mis,代码行数:19,代码来源:Bootstrap.php
示例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);
}
开发者ID:finalclass,项目名称:netcore,代码行数:15,代码来源:HTMLPurifier.php
示例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;
}
开发者ID:nnnnathann,项目名称:piwik,代码行数:22,代码来源:HTMLPurifier.php
示例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;
}
开发者ID:chaudhary4k4,项目名称:vtigercrm,代码行数:47,代码来源:generate-includes.php
示例14: require_once
<?php
/**
* CMarkdownParser class file.
*
* @author Qiang Xue <[email protected]>
* @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
*
开发者ID:alsvader,项目名称:hackbanero,代码行数:31,代码来源:CMarkdownParser.php
示例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);
}
开发者ID:blas-dmx,项目名称:dolphin.pro,代码行数:32,代码来源:utils.inc.php
示例16: CargarDatos
function CargarDatos($id_publicacion, $id_usuario)
{
// HTML purifier
require_once "PHP/HTMLPurifier.standalone.php";
$config = HTMLPurifier_Config::createDefault();
$config->set('HTML.Doctype', 'XHTML 1.0 Strict');
$config->set('Filter.YouTube', true);
$purifier = new HTMLPurifier($config);
HTMLPurifier_Bootstrap::autoload('HTMLPurifier_Filter_YouTube');
$id_publicacion = db_codex($id_publicacion);
$id_usuario = db_codex($id_usuario);
if (_F_usuario_cache('nivel') != _N_administrador) {
$datos["tipo"] = _A_temporal;
$datos["fecha_ini"] = mysql_datetime();
$datos["fecha_fin"] = mysql_datetime();
}
$datos["id_categoria"] = _F_form_cache("id_categoria");
// $datos["id_usuario"] = $id_usuario; // No usar.
$datos["precio"] = _F_form_cache("precio");
$datos["titulo"] = _F_form_cache("titulo");
$datos["descripcion_corta"] = strip_html_tags(_F_form_cache("descripcion_corta"));
$datos["descripcion"] = $purifier->purify(_F_form_cache("descripcion"));
$ret = db_actualizar_datos("ventas_publicaciones", $datos, "id_publicacion='{$id_publicacion}'");
unset($datos);
// Tags
// Procesamos los nuevos tags (eliminamos los espacios, las comas finales y hacemos array)
// Nota: no evaluamos las comas finales con posibles espacios porque se eliminan con la primera pasada
$tags = explode(",", preg_replace(array('/ */', '/^,/', '/,$/'), '$1', @$_POST['tags']), 5);
// Eliminamos posible exploit en los tags
$tags = db_codex($tags);
// Insertamos los nuevos tags
$val_tags = implode("'),('", $tags);
db_consultar("INSERT IGNORE INTO ventas_tag (tag) VALUES('{$val_tags}')");
// Ponemos los tags en referencia a la publicación actual
// +Eliminados los tags de esta publicación primero+++++++++++++++++++++++++
$val_tags = implode("','", $tags);
$c = "DELETE FROM ventas_tag_uso WHERE id_publicacion='{$id_publicacion}'";
$r = db_consultar($c);
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
db_consultar("INSERT INTO ventas_tag_uso (id_tag,id_publicacion) SELECT id, {$id_publicacion} FROM ventas_tag WHERE tag IN ('{$val_tags}')");
// Hay que eliminar los flags antes que nada.
$c = "DELETE FROM ventas_flags_pub WHERE id_publicacion='{$id_publicacion}'";
$r = db_consultar($c);
$datos['id'] = NULL;
$datos['id_publicacion'] = $id_publicacion;
foreach (array("venta", "pago", "entrega") as $campo) {
if (isset($_POST[$campo]) && is_array($_POST[$campo])) {
foreach ($_POST[$campo] as $llave => $valor) {
$datos['id_flag'] = $valor;
$datos['tipo'] = $campo;
db_agregar_datos("ventas_flags_pub", $datos);
}
}
}
}
开发者ID:vlad88sv,项目名称:YoMachete,代码行数:55,代码来源:stubs.php
示例17: _common_autoloader
/**
* Automatically loads classes in PHP5 way, using SPL.
* @param string $class The class name, no namespaces are supported.
* @return bool TRUE if a class have been found and loaded, FALSE otherwise.
* @author Ivan Tcholakov, 2013
* @license The MIT License
*/
function _common_autoloader($class)
{
static $locations = null;
if (!isset($locations)) {
$locations = array();
$autoload = null;
_autoload_classes_read_config($autoload, APPPATH . 'config/autoload_classes.php');
_autoload_classes_read_config($autoload, APPPATH . 'config/' . ENVIRONMENT . '/autoload_classes.php');
if (isset($autoload) && is_array($autoload) && isset($autoload['classes']) && is_array($autoload['classes'])) {
$locations = $autoload['classes'];
}
}
$class = (string) $class;
// No class name? Abort.
if ($class == '') {
return false;
}
// Scanning for classes in specific directories (see the array above).
if (isset($locations[$class])) {
require $locations[$class];
return true;
}
// Autoload CodeIgniter classes.
if (strpos($class, 'CI_') === 0) {
if (is_file($location = BASEPATH . 'core/' . substr($class, 3) . '.php')) {
require $location;
return true;
}
if (is_file($location = BASEPATH . 'libraries/' . substr($class, 3) . '.php')) {
require $location;
return true;
}
if (is_file($location = BASEPATH . 'libraries/' . substr($class, 3) . '/' . substr($class, 3) . '.php')) {
require $location;
return true;
}
}
// Autoload core classes.
if (is_file($location = APPPATH . "core/{$class}.php")) {
require $location;
return true;
}
// Autoload Modular Extensions MX core classes.
if (strpos($class, 'MX_') === 0 && is_file($location = APPPATH . 'third_party/MX/' . substr($class, 3) . '.php')) {
require $location;
return true;
}
// Autoload library classes.
if (is_file($location = APPPATH . "libraries/{$class}.php")) {
require $location;
return true;
}
// Autoload models (that are extended by other models).
if (is_file($location = APPPATH . "models/{$class}.php")) {
require $location;
return true;
}
// Autoload custom classes, non-standard way.
if (is_file($location = APPPATH . "classes/{$class}.php")) {
require $location;
return true;
}
// PSR-0 autoloading.
if (is_file($location = APPPATH . 'classes/' . str_replace('_', DIRECTORY_SEPARATOR, $class) . '.php')) {
require $location;
return true;
}
// Autoload HTMLPurifier classes.
if (HTMLPurifier_Bootstrap::autoload($class)) {
return true;
}
// Autoload PEAR packages that are integrated in this platform.
if (is_file($location = APPPATH . 'third_party/pear/' . str_replace('_', DIRECTORY_SEPARATOR, $class) . '.php')) {
require $location;
return true;
}
return false;
}
开发者ID:jaffarsolo,项目名称:starter-public-edition-3,代码行数:85,代码来源:autoload.php
示例18: 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('HTML.SafeObject', 'true');
$oConfig->set('Output.FlashCompat', 'true');
$oConfig->set('HTML.FlashAllowFullScreen', 'true');
$oConfig->set('Filter.Custom', array(new HTMLPurifier_Filter_LocalMovie()));
$oConfig->set('Filter.Custom', array(new HTMLPurifier_Filter_YouTube()));
$oConfig->set('Filter.Custom', array(new HTMLPurifier_Filter_YoutubeIframe()));
$oDef = $oConfig->getHTMLDefinition(true);
$oDef->addAttribute('a', 'target', 'Enum#_blank,_self,_target,_top');
$oHtmlPurifier = new HTMLPurifier($oConfig);
}
return $oHtmlPurifier->purify($val);
}
开发者ID:Arvindvi,项目名称:dolphin,代码行数:23,代码来源:utils.inc.php
示例19: clear_xss
function clear_xss($val)
{
// HTML Purifier plugin
global $oHtmlPurifier;
if (!isset($oHtmlPurifier) && !$GLOBALS['logged']['admin']) {
require_once BX_DIRECTORY_PATH_PLUGINS . 'htmlpurifier/HTMLPurifier.standalone.php';
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()));
$oConfig->set('HTML.DefinitionID', 'html5-definitions');
$oConfig->set('HTML.DefinitionRev', 1);
if ($def = $oConfig->maybeGetRawHTMLDefinition()) {
$def->addElement('section', 'Block', 'Flow', 'Common');
$def->addElement('nav', 'Block', 'Flow', 'Common');
$def->addElement('article', 'Block', 'Flow', 'Common');
$def->addElement('aside', 'Block', 'Flow', 'Common');
$def->addElement('header', 'Block', 'Flow', 'Common');
$def->addElement('footer', 'Block', 'Flow', 'Common');
$def->addElement('video', 'Block', 'Optional: (source, Flow) | (Flow, source) | Flow', 'Common', array('src' => 'URI', 'type' => 'Text', 'width' => 'Length', 'height' => 'Length', 'poster' => 'URI', 'preload' => 'Enum#auto,metadata,none', 'controls' => 'Bool'));
$def->addElement('source', 'Block', 'Flow', 'Common', array('src' => 'URI', 'type' => 'Text'));
}
$oHtmlPurifier = new HTMLPurifier($oConfig);
}
if (!$GLOBALS['logged']['admin']) {
$val = $oHtmlPurifier->purify($val);
}
$oZ = new BxDolAlerts('system', 'clear_xss', 0, 0, array('oHtmlPurifier' => $oHtmlPurifier, 'return_data' => &$val));
$oZ->alert();
return $val;
}
开发者ID:Prashank25,项目名称:dolphin.pro,代码行数:44,代码来源:utils.inc.php
示例20: autoload
/**
* Autoload-Method
*
* @param string $class name of the class
*/
public function autoload($class)
{
HTMLPurifier_Bootstrap::autoload($class);
}
开发者ID:robo47,项目名称:robo47-components,代码行数:9,代码来源:HtmlPurifier.php
注:本文中的HTMLPurifier_Bootstrap类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论