当前位置: 首页>>代码示例>>PHP>>正文


PHP HTMLPurifier_Bootstrap类代码示例

本文整理汇总了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;
 }
开发者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 <qiang.xue@gmail.com>
 * @link http://www.yiiframework.com/
 * @copyright Copyright &copy; 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


注:本文中的HTMLPurifier_Bootstrap类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。