當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Gdn_Format::unembedContent方法代碼示例

本文整理匯總了PHP中Gdn_Format::unembedContent方法的典型用法代碼示例。如果您正苦於以下問題:PHP Gdn_Format::unembedContent方法的具體用法?PHP Gdn_Format::unembedContent怎麽用?PHP Gdn_Format::unembedContent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Gdn_Format的用法示例。


在下文中一共展示了Gdn_Format::unembedContent方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: format

 /**
  * Filter provided HTML through htmlLawed and return the result.
  *
  * @param string $html String of HTML to filter.
  * @return string Returns the filtered HTML.
  */
 public function format($html)
 {
     $attributes = c('Garden.Html.BlockedAttributes', 'on*');
     $config = ['anti_link_spam' => ['`.`', ''], 'balance' => 1, 'cdata' => 3, 'comment' => 1, 'css_expression' => 1, 'deny_attribute' => $attributes, 'direct_list_nest' => 1, 'elements' => '*-applet-form-input-textarea-iframe-script-style-embed-object-select-option-button-fieldset-optgroup-legend', 'keep_bad' => 0, 'schemes' => 'classid:clsid; href: aim, feed, file, ftp, gopher, http, https, irc, mailto, news, nntp, sftp, ssh, telnet; style: nil; *:file, http, https', 'unique_ids' => 1, 'valid_xhtml' => 0];
     // Turn embedded videos into simple links (legacy workaround)
     $html = Gdn_Format::unembedContent($html);
     // We check the flag within Gdn_Format to see
     // if htmLawed should place rel="nofollow" links
     // within output or not.
     // A plugin can set this flag (for example).
     // The default is to show rel="nofollow" on all links.
     if (Gdn_Format::$DisplayNoFollow) {
         // display rel="nofollow" on all links.
         $config['anti_link_spam'] = ['`.`', ''];
     } else {
         // never display rel="nofollow"
         $config['anti_link_spam'] = ['', ''];
     }
     // Deny all class and style attributes.
     // A lot of damage can be done by hackers with these attributes.
     $config['deny_attribute'] .= ',style,class';
     // Block some IDs so you can't break Javascript
     $GLOBALS['hl_Ids'] = ['Bookmarks' => 1, 'CommentForm' => 1, 'Content' => 1, 'Definitions' => 1, 'DiscussionForm' => 1, 'Foot' => 1, 'Form_Comment' => 1, 'Form_User_Password' => 1, 'Form_User_SignIn' => 1, 'Head' => 1, 'HighlightColor' => 1, 'InformMessageStack' => 1, 'Menu' => 1, 'PagerMore' => 1, 'Panel' => 1, 'Status' => 1];
     $spec = 'object=-classid-type, -codebase; embed=type(oneof=application/x-shockwave-flash); ';
     // Define elements allowed to have a `class`.
     $spec .= implode(',', $this->classedElements);
     // Whitelist classes we allow.
     $spec .= '=class(oneof=' . implode('|', $this->allowedClasses) . '); ';
     return Htmlawed::filter($html, $config, $spec);
 }
開發者ID:vanilla,項目名稱:vanilla,代碼行數:36,代碼來源:class.htmlawed.plugin.php


注:本文中的Gdn_Format::unembedContent方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。