本文整理汇总了PHP中JApplication::enqueueMessage方法的典型用法代码示例。如果您正苦于以下问题:PHP JApplication::enqueueMessage方法的具体用法?PHP JApplication::enqueueMessage怎么用?PHP JApplication::enqueueMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JApplication
的用法示例。
在下文中一共展示了JApplication::enqueueMessage方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: replyTopic
/**
* @param $row
* @param KunenaForumCategory $category
* @param KunenaForumTopic $topic
* @param $subject
*
* @return bool|string
*/
protected function replyTopic($row, KunenaForumCategory $category, KunenaForumTopic $topic, $subject)
{
$uri = JFactory::getURI();
if (JSession::checkToken() == false) {
$this->app->enqueueMessage(JText::_('COM_KUNENA_ERROR_TOKEN'), 'error');
return false;
}
/*if ($this->hasCaptcha() && !$this->verifyCaptcha()) {
return $this->showForm ( $row, $category, $topic, $subject );
}*/
// Create topic if it doesn't exist
if (!$topic->exists()) {
$topic = $this->createTopic($row, $category, $subject);
}
$params = array('name' => JRequest::getString('name', $this->user->getName(), 'POST'), 'email' => JRequest::getString('email', null, 'POST'), 'subject' => $subject, 'message' => JRequest::getString('message', null, 'POST'));
if ($this->hasCaptcha() && !$this->verifyCaptcha()) {
$this->app->redirect($uri->toString(), $result);
}
$message = $topic->newReply($params);
$success = $message->save();
if (!$success) {
$this->app->enqueueMessage($message->getError(), 'error');
return false;
}
$message->sendNotification();
if ($message->hold) {
$result = JText::_('PLG_KUNENADISCUSS_PENDING_MODERATOR_APPROVAL');
} else {
$result = JText::_('PLG_KUNENADISCUSS_MESSAGE_POSTED');
}
// Redirect
$app = JFactory::getApplication('site');
$app->redirect($uri->toString(), $result);
return '';
}
示例2: onAfterRoute
/**
* Event handler to re-parse request URI.
*
* @return void
*/
public function onAfterRoute()
{
// Get installed Joomla version
$JVersion = new JVersion();
$JVersion = $JVersion->getShortVersion();
$option = trim((string) $this->option);
if (self::$_app->isAdmin() && version_compare($JVersion, '3.0', '>=') && in_array($option, JSNVersion::$products)) {
$manifestFile = JPATH_ADMINISTRATOR . '/components/' . $option . '/' . str_replace('com_', '', $option) . '.xml';
if (file_exists($manifestFile)) {
$xml = JSNUtilsXml::load($manifestFile);
$attr = $xml->attributes();
if (count($attr)) {
if (isset($attr['version']) && (string) $attr['version'] != '') {
$version = (string) $attr['version'];
if ($option == 'com_imageshow') {
$version = str_replace('.x', '.0', $version);
}
if (version_compare($version, '3.0', '<')) {
// Check if all JSN Extensions are compatible with Joomla 3.x, if not, redirect to index.php and show a warning message
self::$_app->enqueueMessage(JText::sprintf('You are running a Joomla 2.5 version of %1$s on Joomla 3.x. Please download %1$s for Joomla 3.x and reinstall via Joomla! Installer to fix the problem.', 'JSN ' . ucfirst(str_replace('com_', '', $option))), 'warning');
self::$_app->redirect('index.php');
return false;
}
}
}
}
}
// Make sure our onAfterRender event handler is the last one executed
self::$_app->registerEvent('onAfterRender', 'jsnExtFrameworkFinalize');
}
示例3: verifyCaptcha
/**
* @return bool
*/
protected function verifyCaptcha()
{
$captcha = KunenaSpamRecaptcha::getInstance();
$result = $captcha->verify();
if (!$result) {
$this->app->enqueueMessage($captcha->getError());
}
return $result;
}
示例4: enqueueMessage
/**
* Enqueues into the session a message to display on next displayed page
*
* @param string $message HTML message to display
* @param string $messageType Message type ('message' or 'error')
*/
function enqueueMessage($message = null, $messageType = 'message')
{
if (trim($message) != '') {
if (method_exists($this->_baseFramework, 'enqueueMessage')) {
$this->_baseFramework->enqueueMessage($message, $messageType);
} else {
echo '<div class="' . htmlspecialchars($messageType) . '">' . $message . '</div>';
}
}
}
示例5: onContentAfterSave
/**
* Sends message if possible
*
* @param type $context
* @param type $article
* @param type $isNew
* @return type
*/
public function onContentAfterSave($context, &$article, $isNew)
{
if (0 !== strpos($context, 'com_content')) {
return;
}
$message = $this->session->get('asar.message');
if (!empty($message)) {
$this->app->enqueueMessage($message);
$this->session->clear('asar.message');
}
}