本文整理匯總了PHP中FabrikHelperHTML::getContentTemplate方法的典型用法代碼示例。如果您正苦於以下問題:PHP FabrikHelperHTML::getContentTemplate方法的具體用法?PHP FabrikHelperHTML::getContentTemplate怎麽用?PHP FabrikHelperHTML::getContentTemplate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類FabrikHelperHTML
的用法示例。
在下文中一共展示了FabrikHelperHTML::getContentTemplate方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: _message
/**
* Get the message from the designated template files.
*
* @return array ($phpMsg (bool), $message (string))
*/
private function _message()
{
$phpMsg = false;
$params = $this->getParams();
$contentTemplate = $params->get('emailtable_template_content', '');
$content = empty($contentTemplate) ? '' : FabrikHelperHTML::getContentTemplate($contentTemplate);
$emailTemplate = $this->_emailTemplate();
if (JFile::exists($emailTemplate)) {
if (JFile::getExt($emailTemplate) == 'php') {
$message = '';
$phpMsg = true;
} else {
$message = FabrikHelperHTML::getTemplateFile($emailTemplate);
}
$message = str_replace('{content}', $content, $message);
} else {
$message = $contentTemplate != '' ? $content : '';
}
return array($phpMsg, $message);
}
示例2: onAfterProcess
/**
* Run right at the end of the form processing
* form needs to be set to record in database for this to hook to be called
*
* @return bool
*/
public function onAfterProcess()
{
$profiler = JProfiler::getInstance('Application');
JDEBUG ? $profiler->mark("email: start: onAfterProcess") : null;
$params = $this->getParams();
$input = $this->app->input;
jimport('joomla.mail.helper');
$w = new FabrikWorker();
/** @var \FabrikFEModelForm $formModel */
$formModel = $this->getModel();
$emailTemplate = JPath::clean(JPATH_SITE . '/plugins/fabrik_form/email/tmpl/' . $params->get('email_template', ''));
$this->data = $this->getProcessData();
/* $$$ hugh - moved this to here from above the previous line, 'cos it needs $this->data
* check if condition exists and is met
*/
if ($this->alreadySent() || !$this->shouldProcess('email_conditon', null, $params)) {
return true;
}
/**
* Added option to run content plugins on message text. Note that rather than run it one time at the
* end of the following code, after we have assembled all the various options in to a single $message,
* it needs to be run separately on each type of content. This is because we do placeholder replacement
* in various places, which will strip all {text} which doesn't match element names.
*/
$runContentPlugins = $params->get('email_run_content_plugins', '0') === '1';
$contentTemplate = $params->get('email_template_content');
$content = $contentTemplate != '' ? FabrikHelperHTML::getContentTemplate($contentTemplate, 'both', $runContentPlugins) : '';
// Always send as html as even text email can contain html from wysiwyg editors
$htmlEmail = true;
$messageTemplate = '';
if (JFile::exists($emailTemplate)) {
$messageTemplate = JFile::getExt($emailTemplate) == 'php' ? $this->_getPHPTemplateEmail($emailTemplate) : $this->_getTemplateEmail($emailTemplate);
// $$$ hugh - added ability for PHP template to return false to abort, same as if 'condition' was was false
if ($messageTemplate === false) {
return true;
}
if ($runContentPlugins === true) {
FabrikHelperHTML::runContentPlugins($messageTemplate);
}
$messageTemplate = str_replace('{content}', $content, $messageTemplate);
}
$messageText = $params->get('email_message_text', '');
if (!empty($messageText)) {
if ($runContentPlugins === true) {
FabrikHelperHTML::runContentPlugins($messageText);
}
$messageText = str_replace('{content}', $content, $messageText);
$messageText = str_replace('{template}', $messageTemplate, $messageText);
$messageText = $w->parseMessageForPlaceholder($messageText, $this->data, false);
}
if (!empty($messageText)) {
$message = $messageText;
} elseif (!empty($messageTemplate)) {
$message = $messageTemplate;
} elseif (!empty($content)) {
$message = $content;
} else {
$message = $this->_getTextEmail();
}
$this->addAttachments();
$cc = null;
$bcc = null;
// $$$ hugh - test stripslashes(), should be safe enough.
$message = stripslashes($message);
$editURL = COM_FABRIK_LIVESITE . 'index.php?option=com_' . $this->package . '&view=form&fabrik=' . $formModel->get('id') . '&rowid=' . $input->get('rowid', '', 'string');
$viewURL = COM_FABRIK_LIVESITE . 'index.php?option=com_' . $this->package . '&view=details&fabrik=' . $formModel->get('id') . '&rowid=' . $input->get('rowid', '', 'string');
$editLink = '<a href="' . $editURL . '">' . FText::_('EDIT') . '</a>';
$viewLink = '<a href="' . $viewURL . '">' . FText::_('VIEW') . '</a>';
$message = str_replace('{fabrik_editlink}', $editLink, $message);
$message = str_replace('{fabrik_viewlink}', $viewLink, $message);
$message = str_replace('{fabrik_editurl}', $editURL, $message);
$message = str_replace('{fabrik_viewurl}', $viewURL, $message);
// $$$ rob if email_to is not a valid email address check the raw value to see if that is
$emailTo = explode(',', $params->get('email_to'));
foreach ($emailTo as &$emailKey) {
$emailKey = $w->parseMessageForPlaceholder($emailKey, $this->data, false);
// Can be in repeat group in which case returns "email1,email2"
$emailKey = explode(',', $emailKey);
foreach ($emailKey as &$key) {
// $$$ rob added strstr test as no point trying to add raw suffix if not placeholder in $emailKey
if (!FabrikWorker::isEmail($key) && trim($key) !== '' && strstr($key, '}')) {
$key = explode('}', $key);
if (substr($key[0], -4) !== '_raw') {
$key = $key[0] . '_raw}';
} else {
$key = $key[0] . '}';
}
$key = $w->parseMessageForPlaceholder($key, $this->data, false);
}
}
}
// Reduce back down to single dimension array
foreach ($emailTo as $i => $a) {
foreach ($a as $v) {
//.........這裏部分代碼省略.........