本文整理汇总了PHP中String::encodeEmail方法的典型用法代码示例。如果您正苦于以下问题:PHP String::encodeEmail方法的具体用法?PHP String::encodeEmail怎么用?PHP String::encodeEmail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类String
的用法示例。
在下文中一共展示了String::encodeEmail方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: 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);
}
}
}
}
示例3: compile
/**
* Generate the module
*/
protected function compile()
{
global $objPage;
$this->Template->content = '';
$this->Template->referer = 'javascript:history.go(-1)';
$this->Template->back = $GLOBALS['TL_LANG']['MSC']['goBack'];
if (TL_MODE == 'FE' && BE_USER_LOGGED_IN) {
$objNewsletter = \NewsletterModel::findByIdOrAlias(\Input::get('items'));
} else {
$objNewsletter = \NewsletterModel::findSentByParentAndIdOrAlias(\Input::get('items'), $this->nl_channels);
}
if ($objNewsletter === 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->content = '<p class="error">' . sprintf($GLOBALS['TL_LANG']['MSC']['invalidPage'], \Input::get('items')) . '</p>';
return;
}
// Overwrite the page title (see #2853 and #4955)
if ($objNewsletter->subject != '') {
$objPage->pageTitle = strip_tags(strip_insert_tags($objNewsletter->subject));
}
// Add enclosure
if ($objNewsletter->addFile) {
$this->addEnclosuresToTemplate($this->Template, $objNewsletter->row(), 'files');
}
if (!$objNewsletter->sendText) {
$nl2br = $objPage->outputFormat == 'xhtml' ? 'nl2br_xhtml' : 'nl2br_html5';
$strContent = '';
$objContentElements = \ContentModel::findPublishedByPidAndTable($objNewsletter->id, 'tl_newsletter');
if ($objContentElements !== null) {
if (!defined('NEWSLETTER_CONTENT_PREVIEW')) {
define('NEWSLETTER_CONTENT_PREVIEW', true);
}
foreach ($objContentElements as $objContentElement) {
$strContent .= $this->getContentElement($objContentElement->id);
}
}
// Parse simple tokens and insert tags
$strContent = $this->replaceInsertTags($strContent);
$strContent = \String::parseSimpleTokens($strContent, array());
// Encode e-mail addresses
$strContent = \String::encodeEmail($strContent);
$this->Template->content = $strContent;
} else {
$strContent = str_ireplace(' align="center"', '', $objNewsletter->content);
}
// Convert relative URLs
$strContent = $this->convertRelativeUrls($strContent);
// Parse simple tokens and insert tags
$strContent = $this->replaceInsertTags($strContent);
$strContent = \String::parseSimpleTokens($strContent, array());
// Encode e-mail addresses
$strContent = \String::encodeEmail($strContent);
$this->Template->content = $strContent;
$this->Template->subject = $objNewsletter->subject;
}
示例4: setHref
/**
* Set Link href.
*
* @param Attributes $attributes Link attributes.
*
* @return void
*/
protected function setHref(Attributes $attributes)
{
if (substr($this->url, 0, 7) == 'mailto:') {
$attributes->setAttribute('href', \String::encodeEmail($this->url));
} else {
$attributes->setAttribute('href', ampersand($this->url));
}
}
示例5: 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'];
}
示例6: compile
/**
* Generate the content element
*/
protected function compile()
{
global $objPage;
if (substr($this->url, 0, 7) == 'mailto:') {
$this->url = \String::encodeEmail($this->url);
} else {
$this->url = ampersand($this->url);
}
$embed = explode('%s', $this->embed);
if ($this->linkTitle == '') {
$this->linkTitle = $this->url;
}
// Use an image instead of the title
if ($this->useImage && $this->singleSRC != '' && is_numeric($this->singleSRC)) {
$objModel = \FilesModel::findByPk($this->singleSRC);
if ($objModel !== null && is_file(TL_ROOT . '/' . $objModel->path)) {
$this->Template = new \FrontendTemplate('ce_hyperlink_image');
$this->Template->setData($this->arrData);
$objFile = new \File($objModel->path);
if ($objFile->isGdImage) {
$size = deserialize($this->size);
$intMaxWidth = TL_MODE == 'BE' ? 320 : $GLOBALS['TL_CONFIG']['maxImageWidth'];
// Adjust the image size
if ($intMaxWidth > 0 && ($size[0] > $intMaxWidth || !$size[0] && $objFile->width > $intMaxWidth)) {
$size[0] = $intMaxWidth;
$size[1] = floor($intMaxWidth * $objFile->height / $objFile->width);
}
$src = \Image::get($objModel->path, $size[0], $size[1], $size[2]);
if (($imgSize = @getimagesize(TL_ROOT . '/' . rawurldecode($src))) !== false) {
$this->Template->arrSize = $imgSize;
$this->Template->imgSize = ' ' . $imgSize[3];
}
$this->Template->src = TL_FILES_URL . $src;
$this->Template->alt = specialchars($this->alt);
$this->Template->linkTitle = specialchars($this->linkTitle);
$this->Template->caption = $this->caption;
}
}
}
if (strncmp($this->rel, 'lightbox', 8) !== 0 || $objPage->outputFormat == 'xhtml') {
$this->Template->attribute = ' rel="' . $this->rel . '"';
} else {
$this->Template->attribute = ' data-lightbox="' . substr($this->rel, 9, -1) . '"';
}
$this->Template->rel = $this->rel;
// Backwards compatibility
$this->Template->href = $this->url;
$this->Template->embed_pre = $embed[0];
$this->Template->embed_post = $embed[1];
$this->Template->link = $this->linkTitle;
$this->Template->linkTitle = specialchars($this->linkTitle);
$this->Template->target = '';
// Override the link target
if ($this->target) {
$this->Template->target = $objPage->outputFormat == 'xhtml' ? ' onclick="return !window.open(this.href)"' : ' target="_blank"';
}
}
示例7: compile
/**
* Generate the content element
*/
protected function compile()
{
/** @var \PageModel $objPage */
global $objPage;
if (substr($this->url, 0, 7) == 'mailto:') {
$this->url = \String::encodeEmail($this->url);
} else {
$this->url = ampersand($this->url);
}
$embed = explode('%s', $this->embed);
if ($this->linkTitle == '') {
$this->linkTitle = $this->url;
}
// Use an image instead of the title
if ($this->useImage && $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)) {
/** @var \FrontendTemplate|object $objTemplate */
$objTemplate = new \FrontendTemplate('ce_hyperlink_image');
$this->Template = $objTemplate;
$this->Template->setData($this->arrData);
$this->singleSRC = $objModel->path;
$this->addImageToTemplate($this->Template, $this->arrData);
$this->Template->linkTitle = specialchars($this->linkTitle);
}
}
if (strncmp($this->rel, 'lightbox', 8) !== 0 || $objPage->outputFormat == 'xhtml') {
$this->Template->attribute = ' rel="' . $this->rel . '"';
} else {
$this->Template->attribute = ' data-lightbox="' . substr($this->rel, 9, -1) . '"';
}
$this->Template->rel = $this->rel;
// Backwards compatibility
$this->Template->href = $this->url;
$this->Template->embed_pre = $embed[0];
$this->Template->embed_post = $embed[1];
$this->Template->link = $this->linkTitle;
$this->Template->linkTitle = specialchars($this->titleText ?: $this->linkTitle);
$this->Template->target = '';
// Override the link target
if ($this->target) {
$this->Template->target = $objPage->outputFormat == 'xhtml' ? ' onclick="return !window.open(this.href)"' : ' target="_blank"';
}
// Unset the title attributes in the back end (see #6258)
if (TL_MODE == 'BE') {
$this->Template->title = '';
$this->Template->linkTitle = '';
}
}
示例8: 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;
}
示例9: compile
/**
* Generate module
*/
protected function compile()
{
$GLOBALS['TL_JAVASCRIPT']['googleapis-maps'] = 'https://maps.googleapis.com/maps/api/js?sensor=false&language=' . $GLOBALS['TL_LANGUAGE'];
$GLOBALS['TL_JAVASCRIPT']['markerclusterer'] = 'system/modules/anyStores/assets/js/markerclusterer.js';
// get published stores from categories
$objStores = AnyStoresModel::findPublishedByCategory(deserialize($this->anystores_categories));
// return if no stores found
if (!$objStores) {
return;
}
// generate entries
while ($objStores->next()) {
// generate jump to
//@todo copy do AnyStoresModule and extends from it
if ($this->jumpTo) {
if (($objLocation = \PageModel::findByPk($this->jumpTo)) !== null) {
//@todo language parameter
$strStoreKey = !$GLOBALS['TL_CONFIG']['useAutoItem'] ? '/store/' : '/';
$strStoreValue = $objStores->alias;
$objStores->href = \Controller::generateFrontendUrl($objLocation->row(), $strStoreKey . $strStoreValue);
}
}
// unset logo because json_encode drops error:
// Malformed UTF-8 characters, possibly incorrectly encoded
//@todo maybe ->loadDetails() fix it
$objStores->logo = null;
// encode email
$objStores->email = \String::encodeEmail($objStores->email);
}
// get all stores
$arrStores = $objStores->fetchAll();
$this->Template->entries = $arrStores;
if (!($strJson = json_encode($arrStores))) {
$this->log(json_last_error_msg(), __METHOD__, TL_ERROR);
//@todo stop display the broken module
return;
}
// Temporär
$this->Template->json = $strJson;
//@todo cleanup
$path = 'system/modules/anyStores/html/' . $this->id . '-locations.json';
$this->Template->path = $path;
//JSON schreiben
//@todo: Muss noch in tl_storelocator_map zum save_callback verschoben werden!!!
#$file = new \File($path);
#$file->write($strJson);
//@todo language
#$this->log('Neue JSON-Datei erstellt', __METHOD__, TL_FILES);
}
示例10: 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);
}
示例11: compile
/**
* compile button element, inspired by ContentHyperlink
*/
protected function compile()
{
if ($this->linkTitle == '') {
$this->linkTitle = $this->url;
}
$attributes = new Attributes();
$attributes->addClass('btn');
// @See: #6258
if (TL_MODE != 'BE') {
$attributes->setAttribute('title', $this->titleText ?: $this->linkTitle);
}
if (substr($this->url, 0, 7) == 'mailto:') {
$attributes->setAttribute('href', \String::encodeEmail($this->url));
} else {
$attributes->setAttribute('href', ampersand($this->url));
}
if (strncmp($this->rel, 'lightbox', 8) !== 0) {
$attributes->setAttribute('rel', $this->rel);
} else {
$attributes->setAttribute('data-lightbox', substr($this->rel, 9, -1));
}
// Override the link target
if ($this->target) {
$attributes->setAttribute('target', '_blank');
}
if ($this->cssID[1] == '') {
$attributes->addClass('btn-default');
} else {
$attributes->addClass($this->cssID[1]);
}
if ($this->icon) {
$this->Template->icon = Bootstrap::generateIcon($this->bootstrap_icon);
}
// add data attributes
$this->bootstrap_dataAttributes = deserialize($this->bootstrap_dataAttributes, true);
if (!empty($this->bootstrap_dataAttributes)) {
foreach ($this->bootstrap_dataAttributes as $attribute) {
if (trim($attribute['value']) != '' && $attribute['name'] != '') {
$attributes->setAttribute('data-' . $attribute['name'], $attribute['value']);
}
}
}
$this->Template->attributes = $attributes;
$this->Template->link = $this->linkTitle;
}
示例12: compile
/**
* compile button element, inspired by ContentHyperlink
*/
protected function compile()
{
if (substr($this->url, 0, 7) == 'mailto:') {
$this->url = \String::encodeEmail($this->url);
} else {
$this->url = ampersand($this->url);
}
if ($this->linkTitle == '') {
$this->linkTitle = $this->url;
}
if (strncmp($this->rel, 'lightbox', 8) !== 0) {
$this->Template->attribute = ' rel="' . $this->rel . '"';
} else {
$this->Template->attribute = ' data-lightbox="' . substr($this->rel, 9, -1) . '"';
}
// Override the link target
if ($this->target) {
$this->Template->target = ' target="_blank"';
}
if ($this->cssID[1] == '') {
$cssID = $this->cssID;
$cssID[1] = 'btn-default';
$this->cssID = $cssID;
}
if ($this->icon) {
$this->Template->icon = Icons::generateIcon($this->icon);
}
// add data attributes
$this->dataAttributes = deserialize($this->dataAttributes, true);
if (!empty($this->dataAttributes)) {
$attributes = array();
foreach ($this->dataAttributes as $attribute) {
if (trim($attribute['value']) != '' && $attribute['name'] != '') {
$attributes[] = 'data-' . $attribute['name'] . '=' . $attribute['value'];
}
}
$this->Template->attribute = trim($this->attribute . ' ' . implode(' ', $attributes));
}
$this->Template->rel = $this->rel;
// Backwards compatibility
$this->Template->href = $this->url;
$this->Template->link = $this->linkTitle;
$this->Template->linkTitle = specialchars($this->titleText ?: $this->linkTitle);
}
示例13: parseBbCode
/**
* Replace bbcode and return the HTML string
*
* Supports the following tags:
* - [b][/b] bold
* - [i][/i] italic
* - [u][/u] underline
* - [img][/img]
* - [code][/code]
* - [color=#ff0000][/color]
* - [quote][/quote]
* - [quote=tim][/quote]
* - [url][/url]
* - [url=http://][/url]
* - [email][/email]
* - [email=name@example.com][/email]
* @param string
* @return string
*/
public function parseBbCode($strComment)
{
$arrSearch = array('@\\[b\\](.*)\\[/b\\]@Uis', '@\\[i\\](.*)\\[/i\\]@Uis', '@\\[u\\](.*)\\[/u\\]@Uis', '@\\s*\\[code\\](.*)\\[/code\\]\\s*@Uis', '@\\[color=([^\\]" ]+)\\](.*)\\[/color\\]@Uis', '@\\s*\\[quote\\](.*)\\[/quote\\]\\s*@Uis', '@\\s*\\[quote=([^\\]]+)\\](.*)\\[/quote\\]\\s*@Uis', '@\\[img\\]\\s*([^\\[" ]+\\.(jpe?g|png|gif|bmp|tiff?|ico))\\s*\\[/img\\]@i', '@\\[url\\]\\s*([^\\[" ]+)\\s*\\[/url\\]@i', '@\\[url=([^\\]" ]+)\\](.*)\\[/url\\]@Uis', '@\\[email\\]\\s*([^\\[" ]+)\\s*\\[/email\\]@i', '@\\[email=([^\\]" ]+)\\](.*)\\[/email\\]@Uis', '@href="(([a-z0-9]+\\.)*[a-z0-9]+\\.([a-z]{2}|asia|biz|com|info|name|net|org|tel)(/|"))@i');
$arrReplace = array('<strong>$1</strong>', '<em>$1</em>', '<span style="text-decoration:underline">$1</span>', "\n\n" . '<div class="code"><p>' . $GLOBALS['TL_LANG']['MSC']['com_code'] . '</p><pre>$1</pre></div>' . "\n\n", '<span style="color:$1">$2</span>', "\n\n" . '<div class="quote">$1</div>' . "\n\n", "\n\n" . '<div class="quote"><p>' . sprintf($GLOBALS['TL_LANG']['MSC']['com_quote'], '$1') . '</p>$2</div>' . "\n\n", '<img src="$1" alt="" />', '<a href="$1">$1</a>', '<a href="$1">$2</a>', '<a href="mailto:$1">$1</a>', '<a href="mailto:$1">$2</a>', 'href="http://$1');
$strComment = preg_replace($arrSearch, $arrReplace, $strComment);
// Encode e-mail addresses
if (strpos($strComment, 'mailto:') !== false) {
$strComment = \String::encodeEmail($strComment);
}
return $strComment;
}
示例14: header
header('Content-Type: application/json');
echo json_encode(array('status' => 'NO_STORES'));
exit;
}
while ($objStores->next()) {
// generate jump to
if ($objModule->jumpTo) {
if (($objLocation = \PageModel::findByPk($objModule->jumpTo)) !== null) {
//@todo language parameter
$strStoreKey = !$GLOBALS['TL_CONFIG']['useAutoItem'] ? '/store/' : '/';
$strStoreValue = $objStores->alias;
$objStores->href = \Controller::generateFrontendUrl($objLocation->row(), $strStoreKey . $strStoreValue);
}
}
// Encode email
$objStores->email = \String::encodeEmail($objStores->email);
// Encode opening times
$objStores->opening_times = deserialize($objStores->opening_times);
// decode logo
if (\Validator::isBinaryUuid($objStores->logo)) {
if (($objFile = \FilesModel::findByPk($objStores->logo)) !== null) {
$objStores->logo = $objFile->path;
}
}
// decode marker
if (\Validator::isBinaryUuid($objStores->marker)) {
if (($objFile = \FilesModel::findByPk($objStores->marker)) !== null) {
$objStores->marker = $objFile->path;
}
}
// add category marker
示例15: compile
/**
* Generate the module
*/
protected function compile()
{
global $objPage;
$this->Template->back = $GLOBALS['TL_LANG']['MSC']['goBack'];
$this->Template->referer = 'javascript:history.go(-1)';
$objFaq = \FaqModel::findPublishedByParentAndIdOrAlias(\Input::get('items'), $this->faq_categories);
if ($objFaq === 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->error = '<p class="error">' . sprintf($GLOBALS['TL_LANG']['MSC']['invalidPage'], \Input::get('items')) . '</p>';
return;
}
// Overwrite the page title and description
if ($objFaq->question != '') {
$objPage->pageTitle = strip_insert_tags($objFaq->question);
$objPage->description = $this->prepareMetaDescription($objFaq->question);
}
$this->Template->question = $objFaq->question;
// Clean RTE output
if ($objPage->outputFormat == 'xhtml') {
$objFaq->answer = \String::toXhtml($objFaq->answer);
} else {
$objFaq->answer = \String::toHtml5($objFaq->answer);
}
$this->Template->answer = \String::encodeEmail($objFaq->answer);
$this->Template->addImage = false;
// Add image
if ($objFaq->addImage && $objFaq->singleSRC != '') {
if (!is_numeric($objFaq->singleSRC)) {
$this->Template->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($this->Template, $objFaq->row());
}
}
}
$this->Template->enclosure = array();
// Add enclosure
if ($objFaq->addEnclosure) {
$this->addEnclosuresToTemplate($this->Template, $objFaq->row());
}
$this->Template->info = sprintf($GLOBALS['TL_LANG']['MSC']['faqCreatedBy'], $this->parseDate($objPage->dateFormat, $objFaq->tstamp), $objFaq->getRelated('author')->name);
// HOOK: comments extension required
if ($objFaq->noComments || !in_array('comments', $this->Config->getActiveModules())) {
$this->Template->allowComments = false;
return;
}
$objCategory = $objFaq->getRelated('pid');
// Check whether comments are allowed
if (!$objCategory->allowComments) {
$this->Template->allowComments = false;
return;
}
$this->Template->allowComments = true;
// Adjust the comments headline level
$intHl = min(intval(str_replace('h', '', $this->hl)), 5);
$this->Template->hlc = 'h' . ($intHl + 1);
$this->import('Comments');
$arrNotifies = array();
// Notify the system administrator
if ($objCategory->notify != 'notify_author') {
$arrNotifies[] = $GLOBALS['TL_ADMIN_EMAIL'];
}
// Notify the author
if ($objCategory->notify != 'notify_admin') {
if (($objAuthor = $objFaq->getRelated('author')) !== null && $objAuthor->email != '') {
$arrNotifies[] = $objAuthor->email;
}
}
$objConfig = new \stdClass();
$objConfig->perPage = $objCategory->perPage;
$objConfig->order = $objCategory->sortOrder;
$objConfig->template = $this->com_template;
$objConfig->requireLogin = $objCategory->requireLogin;
$objConfig->disableCaptcha = $objCategory->disableCaptcha;
$objConfig->bbcode = $objCategory->bbcode;
$objConfig->moderate = $objCategory->moderate;
$this->Comments->addCommentsToTemplate($this->Template, $objConfig, 'tl_faq', $objFaq->id, $arrNotifies);
}