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


PHP HTMLPurifier_ConfigSchema::makeFromSerial方法代码示例

本文整理汇总了PHP中HTMLPurifier_ConfigSchema::makeFromSerial方法的典型用法代码示例。如果您正苦于以下问题:PHP HTMLPurifier_ConfigSchema::makeFromSerial方法的具体用法?PHP HTMLPurifier_ConfigSchema::makeFromSerial怎么用?PHP HTMLPurifier_ConfigSchema::makeFromSerial使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HTMLPurifier_ConfigSchema的用法示例。


在下文中一共展示了HTMLPurifier_ConfigSchema::makeFromSerial方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: instance

 /**
  * Retrieves an instance of the application-wide configuration definition.
  */
 public static function instance($prototype = null)
 {
     if ($prototype !== null) {
         HTMLPurifier_ConfigSchema::$singleton = $prototype;
     } elseif (HTMLPurifier_ConfigSchema::$singleton === null || $prototype === true) {
         HTMLPurifier_ConfigSchema::$singleton = HTMLPurifier_ConfigSchema::makeFromSerial();
     }
     return HTMLPurifier_ConfigSchema::$singleton;
 }
开发者ID:rwebley,项目名称:Beowulf---PAS,代码行数:12,代码来源:ConfigSchema.php

示例2: create

 /**
  * @param  string|array|HTMLPurifier_Config $config
  * @param  HTMLPurifier_ConfigSchema $schema
  * @return HTMLPurifier_Config
  */
 public static function create($config = null, HTMLPurifier_ConfigSchema $schema = null)
 {
     if (!$schema instanceof HTMLPurifier_ConfigSchema) {
         $schema = HTMLPurifier_ConfigSchema::makeFromSerial();
     }
     if ($config instanceof HTMLPurifier_Config) {
         $configObj = $config;
     } else {
         $configObj = new HTMLPurifier_Config($schema);
         $configObj->set('Core.Encoding', 'UTF-8');
         $configObj->set('HTML.Doctype', 'HTML 4.01 Transitional');
         if (is_string($config)) {
             $configObj->loadIni($config);
         } elseif (is_array($config)) {
             $configObj->loadArray($config);
         }
     }
     $def = $configObj->getHTMLDefinition(true);
     // this finalizes config
     HTMLPurifier_HTML5Definition::setup($def);
     return $configObj;
 }
开发者ID:xemlock,项目名称:htmlpurifier-html5,代码行数:27,代码来源:HTML5Config.php

示例3: _purifyBodyContent

 /**
  * use html purifier to remove 'bad' tags/attributes from html body
  *
  * @param string $_content
  * @param string $messageId
  * @return string
  */
 protected function _purifyBodyContent($_content, $messageId)
 {
     if (!defined('HTMLPURIFIER_PREFIX')) {
         define('HTMLPURIFIER_PREFIX', realpath(dirname(__FILE__) . '/../../library/HTMLPurifier'));
     }
     $config = Tinebase_Core::getConfig();
     $path = $config->caching && $config->caching->active && $config->caching->path ? $config->caching->path : Tinebase_Core::getTempDir();
     if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
         Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Purifying html body. (cache path: ' . $path . ')');
     }
     if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
         Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' Current mem usage before purify: ' . memory_get_usage() / 1024 / 1024);
     }
     // add custom schema for passing message id to URIScheme
     $configSchema = HTMLPurifier_ConfigSchema::makeFromSerial();
     $configSchema->add('Felamimail.messageId', NULL, 'string', TRUE);
     $config = HTMLPurifier_Config::create(NULL, $configSchema);
     $config->set('HTML.DefinitionID', 'purify message body contents');
     $config->set('HTML.DefinitionRev', 1);
     // @see: http://htmlpurifier.org/live/configdoc/plain.html#Attr.EnableID
     $config->set('Attr.EnableID', TRUE);
     $config->set('Attr.IDPrefix', 'felamimail_inline_');
     // @see: http://htmlpurifier.org/live/configdoc/plain.html#HTML.TidyLevel
     $config->set('HTML.TidyLevel', 'heavy');
     // some config values to consider
     /*
     $config->set('Attr.EnableID', true);
     $config->set('Attr.ClassUseCDATA', true);
     $config->set('CSS.AllowTricky', true);
     */
     $config->set('Cache.SerializerPath', $path);
     $config->set('URI.AllowedSchemes', array('http' => true, 'https' => true, 'mailto' => true, 'data' => true, 'cid' => true));
     $config->set('Felamimail.messageId', $messageId);
     $this->_transformBodyTags($config);
     // add uri filter
     $uri = $config->getDefinition('URI');
     $uri->addFilter(new Felamimail_HTMLPurifier_URIFilter_TransformURI(), $config);
     // add cid uri scheme
     require_once dirname(dirname(__FILE__)) . '/HTMLPurifier/URIScheme/cid.php';
     $purifier = new HTMLPurifier($config);
     $content = $purifier->purify($_content);
     if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
         Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' Current mem usage after purify: ' . memory_get_usage() / 1024 / 1024);
     }
     return $content;
 }
开发者ID:bitExpert,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:53,代码来源:Message.php

示例4: chdir

<?php

chdir(dirname(__FILE__));
//require_once '../library/HTMLPurifier.path.php';
shell_exec('php ../maintenance/generate-schema-cache.php');
require_once '../library/HTMLPurifier.path.php';
require_once 'HTMLPurifier.includes.php';
$begin = xdebug_memory_usage();
$schema = HTMLPurifier_ConfigSchema::makeFromSerial();
echo xdebug_memory_usage() - $begin;
// vim: et sw=4 sts=4
开发者ID:renztoygwapo,项目名称:openlist,代码行数:11,代码来源:ConfigSchema.php


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