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


PHP StringUtil::stripHTML方法代码示例

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


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

示例1: getParsedTag

 /**
  * @see \wcf\system\bbcode\IBBCode::getParsedTag()
  */
 public function getParsedTag(array $openingTag, $content, array $closingTag, BBCodeParser $parser)
 {
     // copyright
     TeraliosBBCodesCopyright::callCopyright();
     $tag = mb_strtolower($openingTag['name']);
     // heading and subheading tag html.
     if ($parser->getOutputType() == 'text/html') {
         // map attributes
         $this->mapAttributes($openingTag);
         // assign attributes
         $anchor = $this->anchor;
         $noIndex = $this->noIndex;
         // check anchor and set automark
         if (BBCODES_HEADLINE_AUTOMARK == 1 && empty($anchor)) {
             $anchor = substr(md5($content), 0, 10);
         } else {
             if (empty($anchor)) {
                 $anchor = '';
             }
         }
         // check anchor
         if (!empty($anchor)) {
             $anchor = sprintf(static::$anchorPrefix, static::anchorExists($anchor, $anchor));
             if ($noIndex != true) {
                 $anchor = Directory::getInstance()->addEntry($anchor, StringUtil::decodeHTML($content), $tag == 'h1' ? true : false);
             } else {
                 $anchor = new Entry($anchor, StringUtil::decodeHTML($content));
             }
         }
         // assign to template
         WCF::getTPL()->assign(array('hsTag' => $tag, 'hsEntry' => $anchor, 'hsHeading' => $content, 'hsLinkTitle' => StringUtil::stripHTML($content)));
         return WCF::getTPL()->fetch('headingBBCode');
     } else {
         if ($parser->getOutputType('text/simplified-html')) {
             switch ($tag) {
                 case 'h1':
                     $return = '--- ' . $content . ' ---<br />';
                     break;
                 default:
                     $return = '-- ' . $content . ' --<br />';
                     break;
             }
             return $return;
         }
     }
 }
开发者ID:Zumarta,项目名称:de.teralios.bbcodes,代码行数:49,代码来源:HeadingBBCode.class.php

示例2: readData

 /**
  * @see	\wcf\page\IPage::readData()
  */
 public function readData()
 {
     parent::readData();
     // add breadcrumbs
     WCF::getBreadcrumbs()->add(new Breadcrumb(WCF::getLanguage()->get('cms.header.menu.news'), LinkHandler::getInstance()->getLink('NewsOverview', array('application' => 'cms'))));
     if ($this->entry->isArchived) {
         WCF::getBreadcrumbs()->add(new Breadcrumb(WCF::getLanguage()->get('cms.header.menu.news.archive'), LinkHandler::getInstance()->getLink('NewsArchive', array('application' => 'cms'))));
     }
     $categories = array();
     $leafCategories = $this->entry->getLeafCategories();
     $category = reset($leafCategories);
     while ($category !== null) {
         $categories[] = $category;
         $category = $category->getParentCategory();
     }
     foreach (array_reverse($categories) as $parentCategory) {
         WCF::getBreadcrumbs()->add($parentCategory->getBreadcrumb());
     }
     // update news view count
     $this->entry->updateVisits();
     // update news visit
     if ($this->entry->isNew()) {
         $entryAction = new EntryAction(array($this->entry->getDecoratedObject()), 'markAsRead', array('viewableEntry' => $this->entry));
         $entryAction->executeAction();
     }
     // fetch news likes
     if (MODULE_LIKE) {
         $objectType = LikeHandler::getInstance()->getObjectType('de.incendium.cms.like.likeableNews');
         LikeHandler::getInstance()->loadLikeObjects($objectType, array($this->entryID));
         $this->entryLikeData = LikeHandler::getInstance()->getLikeObjects($objectType);
     }
     // get news tags
     if (MODULE_TAGGING) {
         $this->tags = TagEngine::getInstance()->getObjectTags('de.incendium.cms.news.entry', $this->entry->entryID, array($this->entry->languageID === null ? LanguageFactory::getInstance()->getDefaultLanguageID() : ""));
     }
     // get news comments
     if ($this->commentManager === null) {
         $this->objectTypeID = CommentHandler::getInstance()->getObjectTypeID('de.incendium.cms.news.comment');
         $objectType = CommentHandler::getInstance()->getObjectType($this->objectTypeID);
         $this->commentManager = $objectType->getProcessor();
     }
     $this->commentList = CommentHandler::getInstance()->getCommentList($this->commentManager, $this->objectTypeID, $this->entryID);
     // more news from this category
     $this->moreEntryList = new AccessibleEntryList();
     $this->moreEntryList->getConditionBuilder()->add("news_entry.entryID IN (SELECT entryID FROM cms" . WCF_N . "_news_entry_to_category WHERE entryID != ? AND categoryID IN (?))", array($this->entryID, $this->entry->getCategoryIDs()));
     $this->moreEntryList->sqlLimit = CMS_DASHBOARD_SIDEBAR_NEWSENTRIES;
     $this->moreEntryList->readObjects();
     // meta tags
     MetaTagHandler::getInstance()->addTag('og:title', 'og:title', $this->entry->subject . ' - ' . WCF::getLanguage()->get(PAGE_TITLE), true);
     MetaTagHandler::getInstance()->addTag('og:url', 'og:url', LinkHandler::getInstance()->getLink('NewsEntry', array('application' => 'cms', 'object' => $this->entry)), true);
     MetaTagHandler::getInstance()->addTag('og:type', 'og:type', 'article', true);
     MetaTagHandler::getInstance()->addTag('og:description', 'og:description', StringUtil::decodeHTML(StringUtil::stripHTML($this->entry->getExcerpt())), true);
     // add tags as keywords
     if (!empty($this->tags)) {
         $keywords = '';
         foreach ($this->tags as $tag) {
             if (!empty($keywords)) {
                 $keywords .= ', ';
             }
             $keywords .= $tag->name;
         }
         MetaTagHandler::getInstance()->addTag('keywords', 'keywords', $keywords);
     }
     // quotes
     MessageQuoteManager::getInstance()->initObjects('de.incendium.cms.news.entry', array($this->entry->entryID));
 }
开发者ID:Griborim,项目名称:de.incendium.cms.news,代码行数:69,代码来源:NewsEntryPage.class.php

示例3: parse

 /**
  * Formats a message for search result output.
  * 
  * @param	string		$text
  * @return	string
  */
 public function parse($text)
 {
     // remove nonessentials
     $text = Regex::compile('<!-- begin:parser_nonessential -->.*?<!-- end:parser_nonessential -->', Regex::DOT_ALL)->replace($text, '');
     // remove html codes
     $text = StringUtil::stripHTML($text);
     // decode html
     $text = StringUtil::decodeHTML($text);
     // get abstract
     $text = $this->getMessageAbstract($text);
     // encode html
     $text = StringUtil::encodeHTML($text);
     // do highlighting
     return KeywordHighlighter::getInstance()->doHighlight($text);
 }
开发者ID:nick-strohm,项目名称:WCF,代码行数:21,代码来源:SearchResultTextParser.class.php

示例4: stripHTML

 /**
  * Returns a text-only version of given message.
  * 
  * @param	string		$message
  * @return	string
  */
 public function stripHTML($message)
 {
     // remove img tags (smilies)
     $message = preg_replace('~<img src="[^"]+" alt="([^"]+)" />~', '\\1', $message);
     // strip other HTML tags
     $message = StringUtil::stripHTML($message);
     // decode HTML entities
     $message = StringUtil::decodeHTML($message);
     return $message;
 }
开发者ID:nick-strohm,项目名称:WCF,代码行数:16,代码来源:MessageParser.class.php

示例5: readData

 public function readData()
 {
     parent::readData();
     VisitCountHandler::getInstance()->count();
     WCF::getBreadcrumbs()->add(new Breadcrumb(WCF::getLanguage()->get('cms.page.news'), LinkHandler::getInstance()->getLink('NewsCategoryList', array('application' => 'cms'))));
     $this->commentObjectTypeID = CommentHandler::getInstance()->getObjectTypeID('de.codequake.cms.news.comment');
     $this->commentManager = CommentHandler::getInstance()->getObjectType($this->commentObjectTypeID)->getProcessor();
     $this->commentList = CommentHandler::getInstance()->getCommentList($this->commentManager, $this->commentObjectTypeID, $this->newsID);
     $newsEditor = new NewsEditor($this->news->getDecoratedObject());
     $newsEditor->update(array('clicks' => $this->news->clicks + 1));
     // get Tags
     if (MODULE_TAGGING) {
         $this->tags = $this->news->getTags();
     }
     if ($this->news->teaser != '') {
         MetaTagHandler::getInstance()->addTag('description', 'description', $this->news->teaser);
     } else {
         MetaTagHandler::getInstance()->addTag('description', 'description', StringUtil::decodeHTML(StringUtil::stripHTML($this->news->getExcerpt())));
     }
     if (!empty($this->tags)) {
         MetaTagHandler::getInstance()->addTag('keywords', 'keywords', implode(',', $this->tags));
     }
     MetaTagHandler::getInstance()->addTag('og:title', 'og:title', $this->news->subject . ' - ' . WCF::getLanguage()->get(PAGE_TITLE), true);
     MetaTagHandler::getInstance()->addTag('og:url', 'og:url', LinkHandler::getInstance()->getLink('News', array('application' => 'cms', 'object' => $this->news->getDecoratedObject())), true);
     MetaTagHandler::getInstance()->addTag('og:type', 'og:type', 'article', true);
     if ($this->news->getImage() != null) {
         MetaTagHandler::getInstance()->addTag('og:image', 'og:image', $this->news->getImage()->getLink(), true);
     }
     if ($this->news->getUserProfile()->facebook != '') {
         MetaTagHandler::getInstance()->addTag('article:author', 'article:author', 'https://facebook.com/' . $this->news->getUserProfile()->facebook, true);
     }
     if (FACEBOOK_PUBLIC_KEY != '') {
         MetaTagHandler::getInstance()->addTag('fb:app_id', 'fb:app_id', FACEBOOK_PUBLIC_KEY, true);
     }
     MetaTagHandler::getInstance()->addTag('og:description', 'og:description', StringUtil::decodeHTML(StringUtil::stripHTML($this->news->getExcerpt())), true);
     if ($this->news->isNew()) {
         $newsAction = new NewsAction(array($this->news->getDecoratedObject()), 'markAsRead', array('viewableNews' => $this->news));
         $newsAction->executeAction();
     }
     // fetch likes
     if (MODULE_LIKE) {
         $objectType = LikeHandler::getInstance()->getObjectType('de.codequake.cms.likeableNews');
         LikeHandler::getInstance()->loadLikeObjects($objectType, array($this->newsID));
         $this->likeData = LikeHandler::getInstance()->getLikeObjects($objectType);
     }
 }
开发者ID:jacboy,项目名称:Fireball_News,代码行数:46,代码来源:NewsPage.class.php

示例6: fixMessage

 private static function fixMessage($string)
 {
     // align
     $string = preg_replace('~<p style="text-align:(left|center|right);">(.*?)</p>~is', "[align=\\1]\\2[/align]\n\n", $string);
     // <p> to newline
     $string = str_ireplace('<p>', "", $string);
     $string = str_ireplace('</p>', "\n\n", $string);
     $string = str_ireplace('<br>', "\n", $string);
     // strike
     $string = str_ireplace('<s>', '[s]', $string);
     $string = str_ireplace('</s>', '[/s]', $string);
     // super
     $string = str_ireplace('<sup>', '[sup]', $string);
     $string = str_ireplace('</sup>', '[/sup]', $string);
     // subscript
     $string = str_ireplace('<sub>', '[sub]', $string);
     $string = str_ireplace('</sub>', '[/sub]', $string);
     // bold
     $string = str_ireplace('<strong>', '[b]', $string);
     $string = str_ireplace('</strong>', '[/b]', $string);
     $string = str_ireplace('<b>', '[b]', $string);
     $string = str_ireplace('</b>', '[/b]', $string);
     // italic
     $string = str_ireplace('<em>', '[i]', $string);
     $string = str_ireplace('</em>', '[/i]', $string);
     $string = str_ireplace('<i>', '[i]', $string);
     $string = str_ireplace('</i>', '[/i]', $string);
     // underline
     $string = str_ireplace('<u>', '[u]', $string);
     $string = str_ireplace('</u>', '[/u]', $string);
     // font color
     $string = preg_replace('~<span style="color:(.*?);?">(.*?)</span>~is', '[color=\\1]\\2[/color]', $string);
     // font size
     $string = preg_replace('~<span style="font-size:(\\d+)px;">(.*?)</span>~is', '[size=\\1]\\2[/size]', $string);
     // font face
     $string = preg_replace_callback('~<span style="font-family:(.*?)">(.*?)</span>~is', function ($matches) {
         return "[font='" . str_replace(";", '', str_replace("'", '', $matches[1])) . "']" . $matches[2] . "[/font]";
     }, $string);
     // embedded attachments
     $string = preg_replace('~<a class="ipsAttachLink" (?:rel="[^"]*" )?href="[^"]*id=(\\d+)[^"]*".*?</a>~i', '[attach]\\1[/attach]', $string);
     $string = preg_replace('~<a.*?><img data-fileid="(\\d+)".*?</a>~i', '[attach]\\1[/attach]', $string);
     // urls
     $string = preg_replace('~<a.*?href=(?:"|\')mailto:([^"]*)(?:"|\')>(.*?)</a>~is', '[email=\'\\1\']\\2[/email]', $string);
     $string = preg_replace('~<a.*?href=(?:"|\')([^"]*)(?:"|\')>(.*?)</a>~is', '[url=\'\\1\']\\2[/url]', $string);
     // quotes
     $string = preg_replace('~<blockquote[^>]*>(.*?)</blockquote>~is', '[quote]\\1[/quote]', $string);
     // code
     $string = preg_replace('~<pre[^>]*>(.*?)</pre>~is', '[code]\\1[/code]', $string);
     // smileys
     $string = preg_replace('~<img title="([^"]*)" alt="[^"]*" src="<fileStore.core_Emoticons>[^"]*">~is', '\\1', $string);
     $string = preg_replace('~<img src="<fileStore.core_Emoticons>[^"]*" alt="[^"]*" title="([^"]*)">~is', '\\1', $string);
     // list
     $string = str_ireplace('</ol>', '[/list]', $string);
     $string = str_ireplace('</ul>', '[/list]', $string);
     $string = str_ireplace('<ul>', '[list]', $string);
     $string = str_ireplace("<ol type='1'>", '[list=1]', $string);
     $string = str_ireplace("<ol>", '[list=1]', $string);
     $string = str_ireplace('<li>', '[*]', $string);
     $string = str_ireplace('</li>', '', $string);
     // images
     $string = preg_replace('~<img[^>]+src=["\']([^"\']+)["\'][^>]*/?>~is', '[img]\\1[/img]', $string);
     // strip tags
     $string = StringUtil::stripHTML($string);
     // decode html entities
     $string = StringUtil::decodeHTML($string);
     return StringUtil::trim($string);
 }
开发者ID:NurPech,项目名称:com.woltlab.wcf.exporter,代码行数:67,代码来源:IPB4xExporter.class.php

示例7: readDatabaseConnection

 /**
  * Reads the database connection.
  */
 protected function readDatabaseConnection()
 {
     while (true) {
         CLIWCF::getReader()->println(WCF::getLanguage()->get('wcf.acp.dataImport.configure.database'));
         $this->dbHost = CLIWCF::getReader()->readLine(WCF::getLanguage()->get('wcf.acp.dataImport.configure.database.host') . '> ');
         if ($this->dbHost === null) {
             exit;
         }
         $this->dbUser = CLIWCF::getReader()->readLine(WCF::getLanguage()->get('wcf.acp.dataImport.configure.database.user') . '> ');
         if ($this->dbUser === null) {
             exit;
         }
         $this->dbPassword = CLIWCF::getReader()->readLine(WCF::getLanguage()->get('wcf.acp.dataImport.configure.database.password') . '> ', '*');
         if ($this->dbPassword === null) {
             exit;
         }
         $this->dbName = CLIWCF::getReader()->readLine(WCF::getLanguage()->get('wcf.acp.dataImport.configure.database.name') . '> ');
         if ($this->dbName === null) {
             exit;
         }
         $this->dbPrefix = CLIWCF::getReader()->readLine(WCF::getLanguage()->get('wcf.acp.dataImport.configure.database.prefix') . '> ');
         if ($this->dbPrefix === null) {
             exit;
         }
         $this->exporter->setData($this->dbHost, $this->dbUser, $this->dbPassword, $this->dbName, $this->dbPrefix, '', array());
         try {
             $this->exporter->validateDatabaseAccess();
         } catch (DatabaseException $e) {
             $errorMessage = WCF::getLanguage()->getDynamicVariable('wcf.acp.dataImport.configure.database.error', array('exception' => $e));
             $errorMessageLines = explode('<br />', $errorMessage);
             foreach ($errorMessageLines as &$line) {
                 $line = StringUtil::stripHTML($line);
             }
             unset($line);
             foreach ($errorMessageLines as $line) {
                 CLIWCF::getReader()->println($line);
             }
             continue;
         }
         break;
     }
 }
开发者ID:nick-strohm,项目名称:WCF,代码行数:45,代码来源:ImportCLICommand.class.php


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