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


PHP String::toHtml5方法代码示例

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


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

示例1: compile

 /**
  * Generate the content element
  */
 protected function compile()
 {
     global $objPage;
     // Clean the RTE output
     if ($objPage->outputFormat == 'xhtml') {
         $this->text = \String::toXhtml($this->text);
     } else {
         $this->text = \String::toHtml5($this->text);
     }
     // Add the static files URL to images
     if (TL_FILES_URL != '') {
         $path = $GLOBALS['TL_CONFIG']['uploadPath'] . '/';
         $this->text = str_replace(' src="' . $path, ' src="' . TL_FILES_URL . $path, $this->text);
     }
     $this->Template->text = \String::encodeEmail($this->text);
     $this->Template->addImage = false;
     // Add an image
     if ($this->addImage && $this->singleSRC != '') {
         if (!is_numeric($this->singleSRC)) {
             $this->Template->text = '<p class="error">' . $GLOBALS['TL_LANG']['ERR']['version2format'] . '</p>';
         } else {
             $objModel = \FilesModel::findByPk($this->singleSRC);
             if ($objModel !== null && is_file(TL_ROOT . '/' . $objModel->path)) {
                 $this->singleSRC = $objModel->path;
                 $this->addImageToTemplate($this->Template, $this->arrData);
             }
         }
     }
 }
开发者ID:rburch,项目名称:core,代码行数:32,代码来源:ContentText.php

示例2: compile

 /**
  * Generate the content element
  */
 protected function compile()
 {
     /** @var \PageModel $objPage */
     global $objPage;
     // Clean RTE output
     if ($objPage->outputFormat == 'xhtml') {
         $this->text = \String::toXhtml($this->text);
     } else {
         $this->text = \String::toHtml5($this->text);
     }
     $this->Template->text = \String::encodeEmail($this->text);
     $this->Template->addImage = false;
     // Add an image
     if ($this->addImage && $this->singleSRC != '') {
         $objModel = \FilesModel::findByUuid($this->singleSRC);
         if ($objModel === null) {
             if (!\Validator::isUuid($this->singleSRC)) {
                 $this->Template->text = '<p class="error">' . $GLOBALS['TL_LANG']['ERR']['version2format'] . '</p>';
             }
         } elseif (is_file(TL_ROOT . '/' . $objModel->path)) {
             $this->singleSRC = $objModel->path;
             $this->addImageToTemplate($this->Template, $this->arrData);
         }
     }
     $classes = deserialize($this->mooClasses);
     $this->Template->toggler = $classes[0] ?: 'toggler';
     $this->Template->accordion = $classes[1] ?: 'accordion';
     $this->Template->headlineStyle = $this->mooStyle;
     $this->Template->headline = $this->mooHeadline;
 }
开发者ID:juergen83,项目名称:contao,代码行数:33,代码来源:ContentAccordion.php

示例3: compile

 /**
  * Generate the module
  */
 protected function compile()
 {
     $objFaq = \FaqModel::findPublishedByPids($this->faq_categories);
     if ($objFaq === null) {
         $this->Template->faq = array();
         return;
     }
     global $objPage;
     $arrFaq = array_fill_keys($this->faq_categories, array());
     // Add FAQs
     while ($objFaq->next()) {
         $objTemp = (object) $objFaq->row();
         // Clean RTE output
         if ($objPage->outputFormat == 'xhtml') {
             $objFaq->answer = \String::toXhtml($objFaq->answer);
         } else {
             $objFaq->answer = \String::toHtml5($objFaq->answer);
         }
         $objTemp->answer = \String::encodeEmail($objFaq->answer);
         $objTemp->addImage = false;
         // Add an image
         if ($objFaq->addImage && $objFaq->singleSRC != '') {
             if (!is_numeric($objFaq->singleSRC)) {
                 $objTemp->answer = '<p class="error">' . $GLOBALS['TL_LANG']['ERR']['version2format'] . '</p>';
             } else {
                 $objModel = \FilesModel::findByPk($objFaq->singleSRC);
                 if ($objModel !== null && is_file(TL_ROOT . '/' . $objModel->path)) {
                     $objFaq->singleSRC = $objModel->path;
                     $this->addImageToTemplate($objTemp, $objFaq->row());
                 }
             }
         }
         $objTemp->enclosure = array();
         // Add enclosure
         if ($objFaq->addEnclosure) {
             $this->addEnclosuresToTemplate($objTemp, $objFaq->row());
         }
         $objTemp->info = sprintf($GLOBALS['TL_LANG']['MSC']['faqCreatedBy'], $this->parseDate($objPage->dateFormat, $objFaq->tstamp), $objFaq->getRelated('author')->name);
         // Order by PID
         $arrFaq[$objFaq->pid]['items'][] = $objTemp;
         $arrFaq[$objFaq->pid]['headline'] = $objFaq->category;
     }
     $arrFaq = array_values(array_filter($arrFaq));
     $limit_i = count($arrFaq) - 1;
     // Add classes first, last, even and odd
     for ($i = 0; $i <= $limit_i; $i++) {
         $class = ($i == 0 ? 'first ' : '') . ($i == $limit_i ? 'last ' : '') . ($i % 2 == 0 ? 'even' : 'odd');
         $arrFaq[$i]['class'] = trim($class);
         $limit_j = count($arrFaq[$i]['items']) - 1;
         for ($j = 0; $j <= $limit_j; $j++) {
             $class = ($j == 0 ? 'first ' : '') . ($j == $limit_j ? 'last ' : '') . ($j % 2 == 0 ? 'even' : 'odd');
             $arrFaq[$i]['items'][$j]->class = trim($class);
         }
     }
     $this->Template->faq = $arrFaq;
     $this->Template->request = $this->getIndexFreeRequest(true);
     $this->Template->topLink = $GLOBALS['TL_LANG']['MSC']['backToTop'];
 }
开发者ID:rburch,项目名称:core,代码行数:61,代码来源:ModuleFaqPage.php

示例4: generate

 /**
  * Generate the widget and return it as string
  * @return string
  */
 public function generate()
 {
     global $objPage;
     // Clean RTE output
     if ($objPage->outputFormat == 'xhtml') {
         return \String::toXhtml($this->text);
     } else {
         return \String::toHtml5($this->text);
     }
 }
开发者ID:rburch,项目名称:core,代码行数:14,代码来源:FormExplanation.php

示例5: generate

 /**
  * Generate the widget and return it as string
  *
  * @return string The widget markup
  */
 public function generate()
 {
     /** @var \PageModel $objPage */
     global $objPage;
     // Clean RTE output
     if ($objPage->outputFormat == 'xhtml') {
         $this->text = \String::toXhtml($this->text);
     } else {
         $this->text = \String::toHtml5($this->text);
     }
     return $this->text;
 }
开发者ID:juergen83,项目名称:contao,代码行数:17,代码来源:FormHeadline.php

示例6: compile

 /**
  * Generate the content element
  */
 protected function compile()
 {
     // Accordion start
     if ($this->mooType == 'mooStart') {
         if (TL_MODE == 'FE') {
             $this->strTemplate = 'ce_accordion_start';
             $this->Template = new \FrontendTemplate($this->strTemplate);
             $this->Template->setData($this->arrData);
         } else {
             $this->strTemplate = 'be_wildcard';
             $this->Template = new \BackendTemplate($this->strTemplate);
             $this->Template->title = $this->mooHeadline;
         }
     } elseif ($this->mooType == 'mooStop') {
         if (TL_MODE == 'FE') {
             $this->strTemplate = 'ce_accordion_stop';
             $this->Template = new \FrontendTemplate($this->strTemplate);
             $this->Template->setData($this->arrData);
         } else {
             $this->strTemplate = 'be_wildcard';
             $this->Template = new \BackendTemplate($this->strTemplate);
         }
     } else {
         global $objPage;
         // Clean RTE output
         if ($objPage->outputFormat == 'xhtml') {
             $this->text = \String::toXhtml($this->text);
         } else {
             $this->text = \String::toHtml5($this->text);
         }
         $this->Template->text = \String::encodeEmail($this->text);
         $this->Template->addImage = false;
         // Add an image
         if ($this->addImage && $this->singleSRC != '') {
             if (!is_numeric($this->singleSRC)) {
                 $this->Template->text = '<p class="error">' . $GLOBALS['TL_LANG']['ERR']['version2format'] . '</p>';
             } else {
                 $objModel = \FilesModel::findByPk($this->singleSRC);
                 if ($objModel !== null && is_file(TL_ROOT . '/' . $objModel->path)) {
                     $this->singleSRC = $objModel->path;
                     $this->addImageToTemplate($this->Template, $this->arrData);
                 }
             }
         }
     }
     $classes = deserialize($this->mooClasses);
     $this->Template->toggler = $classes[0] ?: 'toggler';
     $this->Template->accordion = $classes[1] ?: 'accordion';
     $this->Template->headlineStyle = $this->mooStyle;
     $this->Template->headline = $this->mooHeadline;
 }
开发者ID:rburch,项目名称:core,代码行数:54,代码来源:ContentAccordion.php

示例7: generate

 /**
  * Generate the widget and return it as string
  *
  * @return string The widget markup
  */
 public function generate()
 {
     global $objPage;
     // Clean RTE output
     if ($objPage->outputFormat == 'xhtml') {
         $this->text = \String::toXhtml($this->text);
     } else {
         $this->text = \String::toHtml5($this->text);
     }
     // Add the static files URL to images
     if (TL_FILES_URL != '') {
         $path = \Config::get('uploadPath') . '/';
         $this->text = str_replace(' src="' . $path, ' src="' . TL_FILES_URL . $path, $this->text);
     }
     return \String::encodeEmail($this->text);
 }
开发者ID:iCodr8,项目名称:core,代码行数:21,代码来源:FormExplanation.php

示例8: compile

 /**
  * Generate the content element
  */
 protected function compile()
 {
     global $objPage;
     $link = '/articles/';
     $objArticle = $this->objArticle;
     if ($objArticle->inColumn != 'main') {
         $link .= $objArticle->inColumn . ':';
     }
     $link .= $objArticle->alias != '' && !\Config::get('disableAlias') ? $objArticle->alias : $objArticle->id;
     $this->Template->href = $this->generateFrontendUrl($this->objParent->row(), $link);
     // Clean the RTE output
     if ($objPage->outputFormat == 'xhtml') {
         $this->Template->text = \String::toXhtml($objArticle->teaser);
     } else {
         $this->Template->text = \String::toHtml5($objArticle->teaser);
     }
     $this->Template->headline = $objArticle->title;
     $this->Template->readMore = specialchars(sprintf($GLOBALS['TL_LANG']['MSC']['readMore'], $objArticle->title));
     $this->Template->more = $GLOBALS['TL_LANG']['MSC']['more'];
 }
开发者ID:iCodr8,项目名称:core,代码行数:23,代码来源:ContentTeaser.php

示例9: replace


//.........这里部分代码省略.........
                     if (($objArticle = \ArticleModel::findByPk($objEvent->articleId, array('eager' => true))) !== null && ($objPid = $objArticle->getRelated('pid')) !== null) {
                         $strUrl = $this->generateFrontendUrl($objPid->row(), '/articles/' . (!\Config::get('disableAlias') && $objArticle->alias != '' ? $objArticle->alias : $objArticle->id));
                     }
                 } else {
                     if (($objCalendar = $objEvent->getRelated('pid')) !== null && ($objJumpTo = $objCalendar->getRelated('jumpTo')) !== null) {
                         $strUrl = $this->generateFrontendUrl($objJumpTo->row(), (\Config::get('useAutoItem') && !\Config::get('disableAlias') ? '/' : '/events/') . (!\Config::get('disableAlias') && $objEvent->alias != '' ? $objEvent->alias : $objEvent->id));
                     }
                 }
                 // Replace the tag
                 switch (strtolower($elements[0])) {
                     case 'event':
                         $strLink = specialchars($objEvent->title);
                         $arrCache[$strTag] = sprintf('<a href="%s" title="%s">%s</a>', $strUrl, $strLink, $strLink);
                         break;
                     case 'event_open':
                         $arrCache[$strTag] = sprintf('<a href="%s" title="%s">', $strUrl, specialchars($objEvent->title));
                         break;
                     case 'event_url':
                         $arrCache[$strTag] = $strUrl;
                         break;
                     case 'event_title':
                         $arrCache[$strTag] = specialchars($objEvent->title);
                         break;
                 }
                 break;
                 // Article teaser
             // Article teaser
             case 'article_teaser':
                 $objTeaser = \ArticleModel::findByIdOrAlias($elements[1]);
                 if ($objTeaser !== null) {
                     if ($objPage->outputFormat == 'xhtml') {
                         $arrCache[$strTag] = \String::toXhtml($this->replaceInsertTags($objTeaser->teaser, $blnCache));
                     } else {
                         $arrCache[$strTag] = \String::toHtml5($this->replaceInsertTags($objTeaser->teaser, $blnCache));
                     }
                 }
                 break;
                 // News teaser
             // News teaser
             case 'news_teaser':
                 $objTeaser = \NewsModel::findByIdOrAlias($elements[1]);
                 if ($objTeaser !== null) {
                     if ($objPage->outputFormat == 'xhtml') {
                         $arrCache[$strTag] = \String::toXhtml($this->replaceInsertTags($objTeaser->teaser, $blnCache));
                     } else {
                         $arrCache[$strTag] = \String::toHtml5($this->replaceInsertTags($objTeaser->teaser, $blnCache));
                     }
                 }
                 break;
                 // Event teaser
             // Event teaser
             case 'event_teaser':
                 $objTeaser = \CalendarEventsModel::findByIdOrAlias($elements[1]);
                 if ($objTeaser !== null) {
                     if ($objPage->outputFormat == 'xhtml') {
                         $arrCache[$strTag] = \String::toXhtml($this->replaceInsertTags($objTeaser->teaser, $blnCache));
                     } else {
                         $arrCache[$strTag] = \String::toHtml5($this->replaceInsertTags($objTeaser->teaser, $blnCache));
                     }
                 }
                 break;
                 // News feed URL
             // News feed URL
             case 'news_feed':
                 $objFeed = \NewsFeedModel::findByPk($elements[1]);
                 if ($objFeed !== null) {
开发者ID:juergen83,项目名称:contao,代码行数:67,代码来源:InsertTags.php

示例10: compile

 /**
  * Generate the module
  */
 protected function compile()
 {
     global $objPage;
     $this->Template->event = '';
     $this->Template->referer = 'javascript:history.go(-1)';
     $this->Template->back = $GLOBALS['TL_LANG']['MSC']['goBack'];
     // Get the current event
     $objEvent = \CalendarEventsModel::findPublishedByParentAndIdOrAlias(\Input::get('events'), $this->cal_calendar);
     if ($objEvent === null) {
         // Do not index or cache the page
         $objPage->noSearch = 1;
         $objPage->cache = 0;
         // Send a 404 header
         header('HTTP/1.1 404 Not Found');
         $this->Template->event = '<p class="error">' . sprintf($GLOBALS['TL_LANG']['MSC']['invalidPage'], \Input::get('events')) . '</p>';
         return;
     }
     // Overwrite the page title
     if ($objEvent->title != '') {
         $objPage->pageTitle = strip_insert_tags($objEvent->title);
     }
     // Overwrite the page description
     if ($objEvent->teaser != '') {
         $objPage->description = $this->prepareMetaDescription($objEvent->teaser);
     }
     $span = \Calendar::calculateSpan($objEvent->startTime, $objEvent->endTime);
     if ($objPage->outputFormat == 'xhtml') {
         $strTimeStart = '';
         $strTimeEnd = '';
         $strTimeClose = '';
     } else {
         $strTimeStart = '<time datetime="' . date('Y-m-d\\TH:i:sP', $objEvent->startTime) . '">';
         $strTimeEnd = '<time datetime="' . date('Y-m-d\\TH:i:sP', $objEvent->endTime) . '">';
         $strTimeClose = '</time>';
     }
     // Get date
     if ($span > 0) {
         $date = $strTimeStart . $this->parseDate($objEvent->addTime ? $objPage->datimFormat : $objPage->dateFormat, $objEvent->startTime) . $strTimeClose . ' - ' . $strTimeEnd . $this->parseDate($objEvent->addTime ? $objPage->datimFormat : $objPage->dateFormat, $objEvent->endTime) . $strTimeClose;
     } elseif ($objEvent->startTime == $objEvent->endTime) {
         $date = $strTimeStart . $this->parseDate($objPage->dateFormat, $objEvent->startTime) . ($objEvent->addTime ? ' (' . $this->parseDate($objPage->timeFormat, $objEvent->startTime) . ')' : '') . $strTimeClose;
     } else {
         $date = $strTimeStart . $this->parseDate($objPage->dateFormat, $objEvent->startTime) . ($objEvent->addTime ? ' (' . $this->parseDate($objPage->timeFormat, $objEvent->startTime) . $strTimeClose . ' - ' . $strTimeEnd . $this->parseDate($objPage->timeFormat, $objEvent->endTime) . ')' : '') . $strTimeClose;
     }
     $until = '';
     $recurring = '';
     // Recurring event
     if ($objEvent->recurring) {
         $arrRange = deserialize($objEvent->repeatEach);
         $strKey = 'cal_' . $arrRange['unit'];
         $recurring = sprintf($GLOBALS['TL_LANG']['MSC'][$strKey], $arrRange['value']);
         if ($objEvent->recurrences > 0) {
             $until = sprintf($GLOBALS['TL_LANG']['MSC']['cal_until'], $this->parseDate($objPage->dateFormat, $objEvent->repeatEnd));
         }
     }
     // Override the default image size
     if ($this->imgSize != '') {
         $size = deserialize($this->imgSize);
         if ($size[0] > 0 || $size[1] > 0) {
             $objEvent->size = $this->imgSize;
         }
     }
     $objTemplate = new \FrontendTemplate($this->cal_template);
     $objTemplate->setData($objEvent->row());
     $objTemplate->date = $date;
     $objTemplate->start = $objEvent->startTime;
     $objTemplate->end = $objEvent->endTime;
     $objTemplate->class = $objEvent->cssClass != '' ? ' ' . $objEvent->cssClass : '';
     $objTemplate->recurring = $recurring;
     $objTemplate->until = $until;
     // Clean the RTE output
     if ($objPage->outputFormat == 'xhtml') {
         $objEvent->details = \String::toXhtml($objEvent->details);
     } else {
         $objEvent->details = \String::toHtml5($objEvent->details);
     }
     $objTemplate->details = \String::encodeEmail($objEvent->details);
     $objTemplate->addImage = false;
     // Add an image
     if ($objEvent->addImage && $objEvent->singleSRC != '') {
         if (!is_numeric($objEvent->singleSRC)) {
             $objTemplate->details = '<p class="error">' . $GLOBALS['TL_LANG']['ERR']['version2format'] . '</p>';
         } else {
             $objModel = \FilesModel::findByPk($objEvent->singleSRC);
             if ($objModel !== null && is_file(TL_ROOT . '/' . $objModel->path)) {
                 $objEvent->singleSRC = $objModel->path;
                 $this->addImageToTemplate($objTemplate, $objEvent->row());
             }
         }
     }
     $objTemplate->enclosure = array();
     // Add enclosures
     if ($objEvent->addEnclosure) {
         $this->addEnclosuresToTemplate($objTemplate, $objEvent->row());
     }
     $this->Template->event = $objTemplate->parse();
     // HOOK: comments extension required
     if ($objEvent->noComments || !in_array('comments', $this->Config->getActiveModules())) {
//.........这里部分代码省略.........
开发者ID:rikaix,项目名称:core,代码行数:101,代码来源:ModuleEventReader.php

示例11: addCommentsToTemplate

 /**
  * Add comments to a template
  * @param \FrontendTemplate
  * @param \stdClass
  * @param string
  * @param integer
  * @param mixed
  */
 public function addCommentsToTemplate(\FrontendTemplate $objTemplate, \stdClass $objConfig, $strSource, $intParent, $varNotifies)
 {
     global $objPage;
     $limit = 0;
     $offset = 0;
     $total = 0;
     $gtotal = 0;
     $arrComments = array();
     $objTemplate->comments = array();
     // see #4064
     // Pagination
     if ($objConfig->perPage > 0) {
         // Get the total number of comments
         $intTotal = \CommentsModel::countPublishedBySourceAndParent($strSource, $intParent);
         $total = $gtotal = $intTotal;
         // Calculate the key (e.g. tl_form_field becomes page_cff12)
         $key = '';
         $chunks = explode('_', substr($strSource, strncmp($strSource, 'tl_', 3) === 0 ? 3 : 0));
         foreach ($chunks as $chunk) {
             $key .= substr($chunk, 0, 1);
         }
         // Get the current page
         $id = 'page_c' . $key . $intParent;
         // see #4141
         $page = \Input::get($id) ?: 1;
         // Do not index or cache the page if the page number is outside the range
         if ($page < 1 || $page > max(ceil($total / $objConfig->perPage), 1)) {
             global $objPage;
             $objPage->noSearch = 1;
             $objPage->cache = 0;
             // Send a 404 header
             header('HTTP/1.1 404 Not Found');
             $objTemplate->allowComments = false;
             return;
         }
         // Set limit and offset
         $limit = $objConfig->perPage;
         $offset = ($page - 1) * $objConfig->perPage;
         // Initialize the pagination menu
         $objPagination = new \Pagination($total, $objConfig->perPage, \Config::get('maxPaginationLinks'), $id);
         $objTemplate->pagination = $objPagination->generate("\n  ");
     }
     $objTemplate->allowComments = true;
     // Get all published comments
     if ($limit) {
         $objComments = \CommentsModel::findPublishedBySourceAndParent($strSource, $intParent, $objConfig->order == 'descending', $limit, $offset);
     } else {
         $objComments = \CommentsModel::findPublishedBySourceAndParent($strSource, $intParent, $objConfig->order == 'descending');
     }
     // Parse the comments
     if ($objComments !== null && ($total = $objComments->count()) > 0) {
         $count = 0;
         if ($objConfig->template == '') {
             $objConfig->template = 'com_default';
         }
         $objPartial = new \FrontendTemplate($objConfig->template);
         while ($objComments->next()) {
             $objPartial->setData($objComments->row());
             // Clean the RTE output
             if ($objPage->outputFormat == 'xhtml') {
                 $objPartial->comment = \String::toXhtml($objComments->comment);
             } else {
                 $objPartial->comment = \String::toHtml5($objComments->comment);
             }
             $objPartial->comment = trim(str_replace(array('{{', '}}'), array('&#123;&#123;', '&#125;&#125;'), $objPartial->comment));
             $objPartial->datim = \Date::parse($objPage->datimFormat, $objComments->date);
             $objPartial->date = \Date::parse($objPage->dateFormat, $objComments->date);
             $objPartial->class = ($count < 1 ? ' first' : '') . ($count >= $total - 1 ? ' last' : '') . ($count % 2 == 0 ? ' even' : ' odd');
             $objPartial->by = $GLOBALS['TL_LANG']['MSC']['com_by'];
             $objPartial->id = 'c' . $objComments->id;
             $objPartial->timestamp = $objComments->date;
             $objPartial->datetime = date('Y-m-d\\TH:i:sP', $objComments->date);
             $objPartial->addReply = false;
             // Reply
             if ($objComments->addReply && $objComments->reply != '') {
                 if (($objAuthor = $objComments->getRelated('author')) !== null) {
                     $objPartial->addReply = true;
                     $objPartial->rby = $GLOBALS['TL_LANG']['MSC']['com_reply'];
                     $objPartial->reply = $this->replaceInsertTags($objComments->reply);
                     $objPartial->author = $objAuthor;
                     // Clean the RTE output
                     if ($objPage->outputFormat == 'xhtml') {
                         $objPartial->reply = \String::toXhtml($objPartial->reply);
                     } else {
                         $objPartial->reply = \String::toHtml5($objPartial->reply);
                     }
                 }
             }
             $arrComments[] = $objPartial->parse();
             ++$count;
         }
     }
//.........这里部分代码省略.........
开发者ID:iCodr8,项目名称:core,代码行数:101,代码来源:Comments.php

示例12: compile

 /**
  * Generate the module
  */
 protected function compile()
 {
     /** @var \PageModel $objPage */
     global $objPage;
     if ($this->blnNoMarkup) {
         /** @var \FrontendTemplate|object $objTemplate */
         $objTemplate = new \BackendTemplate('mod_article_plain');
         $this->Template = $objTemplate;
         $this->Template->setData($this->arrData);
     }
     $alias = $this->alias ?: 'article';
     if (in_array($alias, array('article', 'top', 'wrapper', 'header', 'container', 'left', 'main', 'right', 'footer'))) {
         $alias .= '-' . $this->id;
     }
     $alias = standardize($alias);
     // Generate the cssID if it is not set
     if ($this->cssID[0] == '') {
         $this->cssID = array($alias, $this->cssID[1]);
     }
     $this->Template->column = $this->inColumn;
     // Add the modification date
     $this->Template->timestamp = $this->tstamp;
     $this->Template->date = \Date::parse($objPage->datimFormat, $this->tstamp);
     // Clean the RTE output
     if ($objPage->outputFormat == 'xhtml') {
         $this->teaser = \String::toXhtml($this->teaser);
     } else {
         $this->teaser = \String::toHtml5($this->teaser);
     }
     // Show the teaser only
     if ($this->multiMode && $this->showTeaser) {
         /** @var \FrontendTemplate|object $objTemplate */
         $objTemplate = new \BackendTemplate('mod_article_teaser');
         $this->Template = $objTemplate;
         $this->Template->setData($this->arrData);
         $this->cssID = array($alias, '');
         $arrCss = deserialize($this->teaserCssID);
         // Override the CSS ID and class
         if (is_array($arrCss) && count($arrCss) == 2) {
             if ($arrCss[0] == '') {
                 $arrCss[0] = $alias;
             }
             $this->cssID = $arrCss;
         }
         $article = !\Config::get('disableAlias') && $this->alias != '' ? $this->alias : $this->id;
         $href = '/articles/' . ($this->inColumn != 'main' ? $this->inColumn . ':' : '') . $article;
         $this->Template->headline = $this->headline;
         $this->Template->href = $this->generateFrontendUrl($objPage->row(), $href);
         $this->Template->teaser = $this->teaser;
         $this->Template->readMore = specialchars(sprintf($GLOBALS['TL_LANG']['MSC']['readMore'], $this->headline), true);
         $this->Template->more = $GLOBALS['TL_LANG']['MSC']['more'];
         return;
     }
     // Get section and article alias
     list($strSection, $strArticle) = explode(':', \Input::get('articles'));
     if ($strArticle === null) {
         $strArticle = $strSection;
     }
     // Overwrite the page title (see #2853 and #4955)
     if (!$this->blnNoMarkup && $strArticle != '' && ($strArticle == $this->id || $strArticle == $this->alias) && $this->title != '') {
         $objPage->pageTitle = strip_tags(strip_insert_tags($this->title));
         if ($this->teaser != '') {
             $objPage->description = $this->prepareMetaDescription($this->teaser);
         }
     }
     $this->Template->printable = false;
     $this->Template->backlink = false;
     // Back link
     if (!$this->multiMode && $strArticle != '' && ($strArticle == $this->id || $strArticle == $this->alias)) {
         $this->Template->backlink = 'javascript:history.go(-1)';
         // see #6955
         $this->Template->back = specialchars($GLOBALS['TL_LANG']['MSC']['goBack']);
     }
     $arrElements = array();
     $objCte = \ContentModel::findPublishedByPidAndTable($this->id, 'tl_article');
     if ($objCte !== null) {
         $intCount = 0;
         $intLast = $objCte->count() - 1;
         while ($objCte->next()) {
             $arrCss = array();
             /** @var \ContentModel $objRow */
             $objRow = $objCte->current();
             // Add the "first" and "last" classes (see #2583)
             if ($intCount == 0 || $intCount == $intLast) {
                 if ($intCount == 0) {
                     $arrCss[] = 'first';
                 }
                 if ($intCount == $intLast) {
                     $arrCss[] = 'last';
                 }
             }
             $objRow->classes = $arrCss;
             $arrElements[] = $this->getContentElement($objRow, $this->strColumn);
             ++$intCount;
         }
     }
     $this->Template->teaser = $this->teaser;
//.........这里部分代码省略.........
开发者ID:juergen83,项目名称:contao,代码行数:101,代码来源:ModuleArticle.php

示例13: replaceInsertTags


//.........这里部分代码省略.........
                 } elseif ($objEvent->source == 'article') {
                     $objArticle = \ArticleModel::findByPk($objEvent->articleId, array('eager' => true));
                     $strUrl = $this->generateFrontendUrl($objArticle->pid, '/articles/' . (!$GLOBALS['TL_CONFIG']['disableAlias'] && $objArticle->alias != '' ? $objArticle->alias : $objArticle->id));
                 } elseif ($objEvent->source == 'external') {
                     $strUrl = $objEvent->url;
                 } else {
                     $strUrl = $this->generateFrontendUrl($objEvent->pid, ($GLOBALS['TL_CONFIG']['useAutoItem'] ? '/' : '/events/') . (!$GLOBALS['TL_CONFIG']['disableAlias'] && $objEvent->alias != '' ? $objEvent->alias : $objEvent->id));
                 }
                 // Replace the tag
                 switch (strtolower($elements[0])) {
                     case 'event':
                         $strLink = specialchars($objEvent->title);
                         $arrCache[$strTag] = sprintf('<a href="%s" title="%s">%s</a>', $strUrl, $strLink, $strLink);
                         break;
                     case 'event_open':
                         $arrCache[$strTag] = sprintf('<a href="%s" title="%s">', $strUrl, specialchars($objEvent->title));
                         break;
                     case 'event_url':
                         $arrCache[$strTag] = $strUrl;
                         break;
                     case 'event_title':
                         $arrCache[$strTag] = specialchars($objEvent->title);
                         break;
                 }
                 break;
                 // Article teaser
             // Article teaser
             case 'article_teaser':
                 $objTeaser = \ArticleModel::findByIdOrAlias($elements[1]);
                 if ($objTeaser !== null) {
                     if ($objPage->outputFormat == 'xhtml') {
                         $arrCache[$strTag] = \String::toXhtml($this->replaceInsertTags($objTeaser->teaser));
                     } else {
                         $arrCache[$strTag] = \String::toHtml5($this->replaceInsertTags($objTeaser->teaser));
                     }
                 }
                 break;
                 // News teaser
             // News teaser
             case 'news_teaser':
                 $objTeaser = \NewsModel::findByIdOrAlias($elements[1]);
                 if ($objTeaser !== null) {
                     if ($objPage->outputFormat == 'xhtml') {
                         $arrCache[$strTag] = \String::toXhtml($objTeaser->teaser);
                     } else {
                         $arrCache[$strTag] = \String::toHtml5($objTeaser->teaser);
                     }
                 }
                 break;
                 // Event teaser
             // Event teaser
             case 'event_teaser':
                 $objTeaser = \CalendarEventsModel::findByIdOrAlias($elements[1]);
                 if ($objTeaser !== null) {
                     if ($objPage->outputFormat == 'xhtml') {
                         $arrCache[$strTag] = \String::toXhtml($objTeaser->teaser);
                     } else {
                         $arrCache[$strTag] = \String::toHtml5($objTeaser->teaser);
                     }
                 }
                 break;
                 // News feed URL
             // News feed URL
             case 'news_feed':
                 // FIXME: feeds are now in tl_calendar_feed
                 $objFeed = \NewsArchiveModel::findByPk($elements[1]);
开发者ID:rikaix,项目名称:core,代码行数:67,代码来源:Controller.php

示例14: getPictureInformationArray

 /**
  * Returns the information-array about an album
  *
  * @param null $intPictureId
  * @param $objThis
  * @return array|null
  */
 public static function getPictureInformationArray($intPictureId = null, $objThis)
 {
     if ($intPictureId < 1) {
         return;
     }
     global $objPage;
     $defaultThumbSRC = $objThis->defaultThumb;
     if (\Config::get('gc_error404_thumb') !== '') {
         $objFile = \FilesModel::findByUuid(\Config::get('gc_error404_thumb'));
         if ($objFile !== null) {
             if (\Validator::isUuid(\Config::get('gc_error404_thumb'))) {
                 if (is_file(TL_ROOT . '/' . $objFile->path)) {
                     $defaultThumbSRC = $objFile->path;
                 }
             }
         }
     }
     // Get the page model
     $objPageModel = \PageModel::findByPk($objPage->id);
     $objPicture = \Database::getInstance()->prepare('SELECT * FROM tl_gallery_creator_pictures WHERE id=?')->execute($intPictureId);
     //Alle Informationen zum Album in ein array packen
     $objAlbum = \Database::getInstance()->prepare('SELECT * FROM tl_gallery_creator_albums WHERE id=?')->execute($objPicture->pid);
     $arrAlbumInfo = $objAlbum->fetchAssoc();
     //Bild-Besitzer
     $objOwner = \Database::getInstance()->prepare('SELECT name FROM tl_user WHERE id=?')->execute($objPicture->owner);
     $strImageSrc = '';
     $arrMeta = array();
     $objFileModel = \FilesModel::findByUuid($objPicture->uuid);
     if ($objFileModel == null) {
         $strImageSrc = $defaultThumbSRC;
     } else {
         $strImageSrc = $objFileModel->path;
         if (!is_file(TL_ROOT . '/' . $strImageSrc)) {
             // Fallback to the default thumb
             $strImageSrc = $defaultThumbSRC;
         }
         //meta
         $arrMeta = $objThis->getMetaData($objFileModel->meta, $objPage->language);
         // Use the file name as title if none is given
         if ($arrMeta['title'] == '') {
             $arrMeta['title'] = specialchars($objFileModel->name);
         }
     }
     // get thumb dimensions
     $arrSize = unserialize($objThis->gc_size_detailview);
     //Generate the thumbnails and the picture element
     try {
         $thumbSrc = \Image::create($strImageSrc, $arrSize)->executeResize()->getResizedPath();
         $picture = \Picture::create($strImageSrc, $arrSize)->getTemplateData();
         if ($thumbSrc !== $strImageSrc) {
             $objFile = new \File(rawurldecode($thumbSrc), true);
         }
     } catch (\Exception $e) {
         \System::log('Image "' . $strImageSrc . '" could not be processed: ' . $e->getMessage(), __METHOD__, TL_ERROR);
         $thumbSrc = '';
         $picture = array('img' => array('src' => '', 'srcset' => ''), 'sources' => array());
     }
     $picture['alt'] = $objPicture->title != '' ? specialchars($objPicture->title) : specialchars($arrMeta['title']);
     $picture['title'] = $objPicture->comment != '' ? $objPage->outputFormat == 'xhtml' ? specialchars(\String::toXhtml($objPicture->comment)) : specialchars(\String::toHtml5($objPicture->comment)) : specialchars($arrMeta['caption']);
     $objFileThumb = new \File(rawurldecode($thumbSrc));
     $arrSize[0] = $objFileThumb->width;
     $arrSize[1] = $objFileThumb->height;
     $arrFile["thumb_width"] = $objFileThumb->width;
     $arrFile["thumb_height"] = $objFileThumb->height;
     // get some image params
     if (is_file(TL_ROOT . '/' . $strImageSrc)) {
         $objFileImage = new \File($strImageSrc);
         if (!$objFileImage->isGdImage) {
             return null;
         }
         $arrFile["path"] = $objFileImage->path;
         $arrFile["basename"] = $objFileImage->basename;
         // filename without extension
         $arrFile["filename"] = $objFileImage->filename;
         $arrFile["extension"] = $objFileImage->extension;
         $arrFile["dirname"] = $objFileImage->dirname;
         $arrFile["image_width"] = $objFileImage->width;
         $arrFile["image_height"] = $objFileImage->height;
     } else {
         return null;
     }
     //check if there is a custom thumbnail selected
     if ($objPicture->addCustomThumb && !empty($objPicture->customThumb)) {
         $customThumbModel = \FilesModel::findByUuid($objPicture->customThumb);
         if ($customThumbModel !== null) {
             if (is_file(TL_ROOT . '/' . $customThumbModel->path)) {
                 $objFileCustomThumb = new \File($customThumbModel->path, true);
                 if ($objFileCustomThumb->isGdImage) {
                     $arrSize = unserialize($objThis->gc_size_detailview);
                     $thumbSrc = \Image::get($objFileCustomThumb->path, $arrSize[0], $arrSize[1], $arrSize[2]);
                     $objFileCustomThumb = new \File(rawurldecode($thumbSrc));
                     $arrSize[0] = $objFileCustomThumb->width;
                     $arrSize[1] = $objFileCustomThumb->height;
//.........这里部分代码省略.........
开发者ID:Aiod,项目名称:gallery_creator,代码行数:101,代码来源:GcHelpers.php

示例15: getContent

 /**
  * Get modal content.
  *
  * @return string
  */
 private function getContent()
 {
     $config = Bootstrap::getConfig();
     switch ($this->bootstrap_modalContentType) {
         case 'article':
             return $this->getArticle($this->bootstrap_article, false, true);
         case 'form':
             return $this->generateForm($config);
         case 'module':
             return $this->getFrontendModule($this->bootstrap_module);
         case 'html':
             return TL_MODE == 'FE' ? $this->html : htmlspecialchars($this->bootstrap_html);
         case 'template':
             ob_start();
             include $this->getTemplate($this->bootstrap_modalTemplate);
             $buffer = ob_get_contents();
             ob_end_clean();
             return $buffer;
         case 'text':
             return \String::toHtml5($this->bootstrap_text);
         default:
             return '';
     }
 }
开发者ID:contao-bootstrap,项目名称:components,代码行数:29,代码来源:Modal.php


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