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


PHP HTMLPurifier_URISchemeRegistry::instance方法代码示例

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


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

示例1: getSchemeObj

 /**
  * Retrieves a scheme object corresponding to the URI's scheme/default
  * @param $config Instance of HTMLPurifier_Config
  * @param $context Instance of HTMLPurifier_Context
  * @return Scheme object appropriate for validating this URI
  */
 function getSchemeObj($config, &$context)
 {
     $registry =& HTMLPurifier_URISchemeRegistry::instance();
     if ($this->scheme !== null) {
         $scheme_obj = $registry->getScheme($this->scheme, $config, $context);
         if (!$scheme_obj) {
             return false;
         }
         // invalid scheme, clean it out
     } else {
         // no scheme: retrieve the default one
         $def = $config->getDefinition('URI');
         $scheme_obj = $registry->getScheme($def->defaultScheme, $config, $context);
         if (!$scheme_obj) {
             // something funky happened to the default scheme object
             trigger_error('Default scheme object "' . $def->defaultScheme . '" was not readable', E_USER_WARNING);
             return false;
         }
     }
     return $scheme_obj;
 }
开发者ID:fferriere,项目名称:web,代码行数:27,代码来源:URI.php

示例2: filter

 public function filter(&$uri, $config, $context)
 {
     if ($context->get('EmbeddedURI', true) && !$this->doEmbed) {
         return true;
     }
     $scheme_obj = $uri->getSchemeObj($config, $context);
     if (!$scheme_obj) {
         return true;
     }
     // ignore unknown schemes, maybe another postfilter did it
     if (!$scheme_obj->browsable) {
         return true;
     }
     // ignore non-browseable schemes
     // don't redirect if target host is our host
     if ($uri->isLocal($config, $context)) {
         $uri_definition = $config->getDefinition('URI');
         // but do redirect if we're currently on a secure scheme,
         // and the target scheme is insecure
         $current_scheme_obj = HTMLPurifier_URISchemeRegistry::instance()->getScheme($uri_definition->defaultScheme, $config, $context);
         if ($scheme_obj->secure || !$current_scheme_obj->secure) {
             return true;
         }
         // target scheme was not secure, but we were secure
     }
     $this->makeReplace($uri, $config, $context);
     $this->replace = array_map('rawurlencode', $this->replace);
     $new_uri = strtr($this->target, $this->replace);
     $new_uri = $this->parser->parse($new_uri);
     // don't redirect if the target host is the same as the
     // starting host
     if ($uri->host === $new_uri->host) {
         return true;
     }
     $uri = $new_uri;
     // overwrite
     return true;
 }
开发者ID:TheoJD,项目名称:portail,代码行数:38,代码来源:Munge.php

示例3: getDefaultScheme

 public function getDefaultScheme($config, $context)
 {
     return HTMLPurifier_URISchemeRegistry::instance()->getScheme($this->defaultScheme, $config, $context);
 }
开发者ID:dingdong2310,项目名称:g5_theme,代码行数:4,代码来源:HTMLPurifier.standalone.php

示例4: __construct

 function __construct()
 {
     global $sugar_config;
     $config = HTMLPurifier_Config::createDefault();
     if (!is_dir(sugar_cached("htmlclean"))) {
         create_cache_directory("htmlclean/");
     }
     $config->set('HTML.Doctype', 'XHTML 1.0 Transitional');
     $config->set('Core.Encoding', 'UTF-8');
     $hidden_tags = ['script' => true, 'style' => true, 'title' => true, 'head' => true];
     $config->set('Core.HiddenElements', $hidden_tags);
     $config->set('Cache.SerializerPath', sugar_cached("htmlclean"));
     $config->set('URI.Base', $sugar_config['site_url']);
     $config->set('CSS.Proprietary', true);
     $config->set('HTML.TidyLevel', 'light');
     $config->set('HTML.ForbiddenElements', ['body' => true, 'html' => true]);
     $config->set('AutoFormat.RemoveEmpty', false);
     $config->set('Cache.SerializerPermissions', 0775);
     // for style
     //$config->set('Filter.ExtractStyleBlocks', true);
     $config->set('Filter.ExtractStyleBlocks.TidyImpl', false);
     // can't use csstidy, GPL
     if (!empty($GLOBALS['sugar_config']['html_allow_objects'])) {
         // for object
         $config->set('HTML.SafeObject', true);
         // for embed
         $config->set('HTML.SafeEmbed', true);
     }
     $config->set('Output.FlashCompat', true);
     // for iframe and xmp
     $config->set('Filter.Custom', [new HTMLPurifier_Filter_Xmp()]);
     // for link
     $config->set('HTML.DefinitionID', 'Sugar HTML Def');
     $config->set('HTML.DefinitionRev', 2);
     $config->set('Cache.SerializerPath', sugar_cached('htmlclean/'));
     // IDs are namespaced
     $config->set('Attr.EnableID', true);
     $config->set('Attr.IDPrefix', 'sugar_text_');
     if ($def = $config->maybeGetRawHTMLDefinition()) {
         $form = $def->addElement('link', 'Flow', 'Empty', 'Core', ['href*' => 'URI', 'rel' => 'Enum#stylesheet', 'type' => 'Enum#text/css']);
         $iframe = $def->addElement('iframe', 'Flow', 'Optional: #PCDATA | Flow | Block', 'Core', ['src*' => 'URI', 'frameborder' => 'Enum#0,1', 'marginwidth' => 'Pixels', 'marginheight' => 'Pixels', 'scrolling' => 'Enum#|yes,no,auto', 'align' => 'Enum#top,middle,bottom,left,right,center', 'height' => 'Length', 'width' => 'Length']);
         $iframe->excludes = ['iframe'];
     }
     $uri = $config->getDefinition('URI');
     $uri->addFilter(new SugarURIFilter(), $config);
     HTMLPurifier_URISchemeRegistry::instance()->register('cid', new HTMLPurifier_URIScheme_cid());
     $this->purifier = new HTMLPurifier($config);
 }
开发者ID:butschster,项目名称:sugarcrm_dev,代码行数:48,代码来源:clean.php

示例5: tearDownSchemeRegistryMock

 protected function tearDownSchemeRegistryMock()
 {
     HTMLPurifier_URISchemeRegistry::instance($this->oldRegistry);
 }
开发者ID:patdunlavey,项目名称:Williamstown-Beat,代码行数:4,代码来源:URITest.php


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