本文整理汇总了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;
}
示例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;
}
示例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;
}
}
示例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;
}
示例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;
}