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


PHP Sanitizer::htmlStripTags2UTF8方法代码示例

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


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

示例1: formatStory

 protected function formatStory($story, $mode)
 {
     $item = array('GUID' => $story->getGUID(), 'link' => $story->getLink(), 'title' => Sanitizer::htmlStripTags2UTF8($story->getTitle()), 'description' => Sanitizer::htmlStripTags2UTF8($story->getDescription()), 'pubDate' => $story->getPubTimestamp());
     if ($story->getContent()) {
         if ($mode == 'full') {
             $item['body'] = $story->getContent();
         }
         $item['hasBody'] = TRUE;
     } else {
         $item['hasBody'] = FALSE;
     }
     $thumbnail = $story->getThumbnail();
     if ($thumbnail && $thumbnail->getURL()) {
         $key = $this->requestedVersion < 2 ? 'image' : 'thumbnail';
         $item[$key] = array('src' => $thumbnail->getURL(), 'width' => $thumbnail->getWidth(), 'height' => $thumbnail->getHeight());
     }
     if ($this->requestedVersion >= 2) {
         $image = $story->getImage();
         if ($image && $image->getURL()) {
             $item['image'] = array('src' => $image->getURL(), 'width' => $image->getWidth(), 'height' => $image->getHeight());
         }
     }
     $author = $story->getAuthor();
     $item['author'] = $author ? $author : "";
     return $item;
 }
开发者ID:sponto,项目名称:Kurogo-Mobile-Web,代码行数:26,代码来源:NewsAPIModule.php

示例2: arrayFromVideo

 protected function arrayFromVideo($video, $section)
 {
     $videoArray = array("id" => $video->getID(), "type" => $video->getType(), "title" => $video->getTitle(), "description" => Sanitizer::htmlStripTags2UTF8($video->getDescription()), "author" => $video->getAuthor(), "published" => array('date' => $video->getPublished()->format('Y-m-d H:i:s'), 'timezone_type' => 1, 'timezone' => $video->getPublished()->format('P')), "date" => $video->getPublished()->format('M n, Y'), "url" => $video->getURL(), "image" => $video->getImage(), "width" => $video->getWidth(), "height" => $video->getHeight(), "aspect" => $video->getAspectRatio(), "duration" => $video->getDuration(), "tags" => $video->getTags(), "mobileURL" => $video->getMobileURL(), "streamingURL" => $video->getStreamingURL(), "stillFrameImage" => $video->getStillFrameImage(), "playerURL" => FULL_URL_BASE . $this->configModule . '/player?' . http_build_query(array('section' => $section, 'videoid' => $video->getID())));
     if ($this->requestedVersion >= 2) {
         $videoArray['published']['timestamp'] = $video->getPublished()->format('U');
         $videoArray['playerURL'] = $video->getPlayerURL();
     }
     return $videoArray;
 }
开发者ID:sponto,项目名称:Kurogo-Mobile-Web,代码行数:9,代码来源:VideoAPIModule.php

示例3: initializeForCommand

 protected function initializeForCommand()
 {
     switch ($this->command) {
         case 'notice':
             if ($noticeConfig = $this->getOptionalModuleSection('notice', 'feeds')) {
                 $modelClass = isset($noticeConfig['MODEL_CLASS']) ? $noticeConfig['MODEL_CLASS'] : 'EmergencyNoticeDataModel';
                 $emergencyNoticeController = EmergencyNoticeDataModel::factory($modelClass, $noticeConfig);
                 $emergencyNotice = $emergencyNoticeController->getFeaturedEmergencyNotice();
                 if (isset($emergencyNotice['text'])) {
                     $emergencyNotice['text'] = Sanitizer::htmlStripTags2UTF8($emergencyNotice['text']);
                 }
                 if (isset($emergencyNotice['body'])) {
                     $emergencyNotice['body'] = Sanitizer::htmlStripTags2UTF8($emergencyNotice['body']);
                 }
                 // if there is no emergency notice and a no-notice section
                 // is set, use it as a feed
                 if (!isset($emergencyNotice) && ($noEmergencyConfig = $this->getOptionalModuleSection('no-notice', 'feeds'))) {
                     $modelClass = isset($noEmergencyConfig['MODEL_CLASS']) ? $noEmergencyConfig['MODEL_CLASS'] : 'EmergencyNoticeDataModel';
                     if (!isset($noEmergencyConfig['NOTICE_EXPIRATION'])) {
                         $noEmergencyConfig['NOTICE_EXPIRATION'] = 0;
                     }
                     $noEmergencyNoticeController = EmergencyNoticeDataModel::factory($modelClass, $noEmergencyConfig);
                     $emergencyNotice = $noEmergencyNoticeController->getFeaturedEmergencyNotice();
                 } else {
                     if (!isset($emergencyNotice)) {
                         // if there is not a no emergency feed, there may be a no emergency string
                         if ($noEmergencyString = $this->getOptionalModuleVar('NO_EMERGENCY', null, 'strings')) {
                             $emergencyNotice['text'] = $noEmergencyString;
                             $emergencyNotice['unixtime'] = time();
                         }
                     }
                 }
                 $noticeEnabled = true;
             } else {
                 // Config section 'notice' not set, there is not notice
                 $emergencyNotice = null;
                 $noticeEnabled = false;
             }
             $response = array('notice' => $emergencyNotice, 'noticeEnabled' => $noticeEnabled);
             $this->setResponse($response);
             $this->setResponseVersion(2);
             break;
         case 'contacts':
             if ($contactsConfig = $this->getOptionalModuleSection('contacts', 'feeds')) {
                 $modelClass = isset($contactsConfig['MODEL_CLASS']) ? $contactsConfig['MODEL_CLASS'] : 'EmergencyContactsDataModel';
                 $contactsController = EmergencyContactsDataModel::factory($modelClass, $contactsConfig);
                 $response = array('primary' => self::formatContacts($contactsController->getPrimaryContacts()), 'secondary' => self::formatContacts($contactsController->getSecondaryContacts()));
             } else {
                 $response = new stdClass();
             }
             $this->setResponse($response);
             $this->setResponseVersion(2);
             break;
     }
 }
开发者ID:sponto,项目名称:Kurogo-Mobile-Web,代码行数:55,代码来源:EmergencyAPIModule.php

示例4: getAllEmergencyNotices

 public function getAllEmergencyNotices()
 {
     if ($this->emergencyNotices === NULL) {
         $now = time();
         $this->emergencyNotices = array();
         $items = $this->getData();
         foreach ($items as $item) {
             if ($this->NOTICE_EXPIRATION && $now - $item->getPubTimestamp() > $this->NOTICE_EXPIRATION) {
                 break;
                 // items too old
             }
             $this->emergencyNotices[] = array('title' => $item->getTitle(), 'text' => Sanitizer::htmlStripTags2UTF8($item->getDescription()), 'body' => $item->getContent(false), 'link' => $item->getLink(), 'date' => $item->getPubDate() ? DateFormatter::formatDate($item->getPubDate(), DateFormatter::MEDIUM_STYLE, DateFormatter::MEDIUM_STYLE) : '', 'unixtime' => $item->getPubTimestamp());
             if (isset($this->NOTICE_MAX_COUNT) && count($this->emergencyNotices) >= $this->NOTICE_MAX_COUNT) {
                 break;
                 // hit max count
             }
         }
     }
     return $this->emergencyNotices;
 }
开发者ID:sponto,项目名称:Kurogo-Mobile-Web,代码行数:20,代码来源:EmergencyNoticeDataModel.php

示例5: arrayForPhoto

 private function arrayForPhoto($albumId, $photoData)
 {
     $photo = array('id' => strval($photoData->getID()), 'title' => $photoData->getTitle(), 'albumId' => strval($albumId), 'thumbnailUrl' => $photoData->getThumbnailUrl(), 'imgUrl' => $photoData->getUrl(), 'description' => Sanitizer::htmlStripTags2UTF8($photoData->getDescription()), 'author' => $photoData->getAuthor(), 'published' => $photoData->getPublished()->getTimestamp());
     return $photo;
 }
开发者ID:sponto,项目名称:Kurogo-Mobile-Web,代码行数:5,代码来源:PhotosAPIModule.php


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