本文整理汇总了PHP中CrowdfundingHelperRoute类的典型用法代码示例。如果您正苦于以下问题:PHP CrowdfundingHelperRoute类的具体用法?PHP CrowdfundingHelperRoute怎么用?PHP CrowdfundingHelperRoute使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CrowdfundingHelperRoute类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
public function display($tpl = null)
{
$userId = JFactory::getUser()->get("id");
if (!$userId) {
$this->app->enqueueMessage(JText::_("COM_CROWDFUNDING_ERROR_NOT_LOG_IN"), "notice");
$this->app->redirect(JRoute::_("index.php?option=com_users&view=login", false));
return;
}
$this->items = $this->get('Items');
$this->state = $this->get('State');
$this->pagination = $this->get('Pagination');
// Get params
/** @var $params Joomla\Registry\Registry */
$params = $this->state->get("params");
$this->params = $params;
if (!empty($this->items)) {
// Get currency
$currency = Crowdfunding\Currency::getInstance(JFactory::getDbo(), $this->params->get("project_currency"));
$this->amount = new Crowdfunding\Amount($this->params);
$this->amount->setCurrency($currency);
}
// Prepare filters
$this->listOrder = $this->escape($this->state->get('list.ordering'));
$this->listDirn = $this->escape($this->state->get('list.direction'));
$this->saveOrder = strcmp($this->listOrder, 'a.ordering') != 0 ? false : true;
$this->userId = JFactory::getUser()->get("id");
$this->redirectUrl = CrowdfundingHelperRoute::getTransactionsRoute();
$this->prepareDocument();
parent::display($tpl);
}
示例2: display
public function display($tpl = null)
{
$this->app = JFactory::getApplication();
$this->option = $this->app->input->get('option');
$userId = JFactory::getUser()->get('id');
if (!$userId) {
$this->app->enqueueMessage(JText::_('COM_CROWDFUNDING_ERROR_NOT_LOG_IN'), 'notice');
$this->app->redirect(JRoute::_('index.php?option=com_users&view=login', false));
return;
}
$this->items = $this->get('Items');
$this->state = $this->get('State');
$this->pagination = $this->get('Pagination');
$this->params = $this->state->get('params');
/** @var $params Joomla\Registry\Registry */
if (is_array($this->items) and count($this->items) > 0) {
$currency = Crowdfunding\Currency::getInstance(JFactory::getDbo(), $this->params->get('project_currency'));
$this->amount = new Crowdfunding\Amount($this->params);
$this->amount->setCurrency($currency);
}
// Prepare filters
$this->listOrder = $this->escape($this->state->get('list.ordering'));
$this->listDirn = $this->escape($this->state->get('list.direction'));
$this->saveOrder = strcmp($this->listOrder, 'a.ordering') === 0;
$this->userId = JFactory::getUser()->get('id');
$this->redirectUrl = CrowdfundingHelperRoute::getTransactionsRoute();
$this->prepareDocument();
parent::display($tpl);
}
示例3: display
public function display($tpl = null)
{
$this->app = JFactory::getApplication();
$this->option = JFactory::getApplication()->input->get('option');
// Get model state.
$this->state = $this->get('State');
$this->item = $this->get('Item');
// Get params
$this->params = $this->state->get('params');
/** @var $this->params Joomla\Registry\Registry */
$model = $this->getModel();
$userId = JFactory::getUser()->get('id');
if (!$this->item or $model->isRestricted($this->item, $userId)) {
$this->app->enqueueMessage(JText::_('COM_CROWDFUNDING_ERROR_INVALID_PROJECT'), 'notice');
$this->app->redirect(JRoute::_('index.php?option=com_crowdfunding&view=discover', false));
return;
}
$this->container = Prism\Container::getContainer();
$this->prepareMoneyFormatter($this->container, $this->params);
// Get the path to the images.
$this->imageFolder = $this->params->get('images_directory', 'images/crowdfunding');
$this->defaultAvatar = JUri::base() . $this->params->get('integration_avatars_default');
$this->avatarsSize = $this->params->get('integration_avatars_size', 'small');
// Prepare the link that points to project page.
$host = JUri::getInstance()->toString(array('scheme', 'host'));
$this->item->link = $host . JRoute::_(CrowdfundingHelperRoute::getDetailsRoute($this->item->slug, $this->item->catslug));
// Prepare the link that points to project image.
$this->item->link_image = $host . '/' . $this->imageFolder . '/' . $this->item->image;
// Get the current screen.
$this->screen = $this->app->input->getCmd('screen', 'home');
$this->prepareDocument();
// Import content plugins
JPluginHelper::importPlugin('content');
switch ($this->screen) {
case 'updates':
$this->prepareUpdatesScreen();
break;
case 'comments':
$this->prepareCommentsScreen();
break;
case 'funders':
$this->prepareFundersScreen();
break;
default:
// Home
break;
}
// Events
$dispatcher = JEventDispatcher::getInstance();
$this->item->event = new stdClass();
$results = $dispatcher->trigger('onContentBeforeDisplay', array('com_crowdfunding.details', &$this->item, &$this->params));
$this->item->event->beforeDisplayContent = trim(implode("\n", $results));
$results = $dispatcher->trigger('onContentAfterDisplayMedia', array('com_crowdfunding.details', &$this->item, &$this->params));
$this->item->event->onContentAfterDisplayMedia = trim(implode("\n", $results));
$results = $dispatcher->trigger('onContentAfterDisplay', array('com_crowdfunding.details', &$this->item, &$this->params));
$this->item->event->onContentAfterDisplay = trim(implode("\n", $results));
// Count hits
$model->hit($this->item->id);
parent::display($tpl);
}
示例4: send
public function send()
{
// Check for request forgeries.
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
// Get the data from the form POST
$data = $this->input->post->get('cfreport', array(), 'array');
$itemId = Joomla\Utilities\ArrayHelper::getValue($data, 'id');
if (!$itemId) {
$redirectOptions = array('force_direction' => CrowdfundingHelperRoute::getReportRoute());
$this->displayNotice(JText::_('COM_CROWDFUNDING_ERROR_INVALID_PROJECT'), $redirectOptions);
return;
}
// Get project
$item = Crowdfunding\Project::getInstance(JFactory::getDbo(), $itemId);
$redirectOptions = array('force_direction' => CrowdfundingHelperRoute::getReportRoute($item->getId()));
$model = $this->getModel();
/** @var $model CrowdfundingModelReport */
$form = $model->getForm($data, false);
/** @var $form JForm */
if (!$form) {
throw new Exception(JText::_('COM_CROWDFUNDING_ERROR_FORM_CANNOT_BE_LOADED'));
}
// Test if the data is valid.
$validData = $model->validate($form, $data);
// Check for validation errors.
if ($validData === false) {
$errors = $form->getErrors();
$error = array_shift($errors);
$msg = $error->getMessage();
$this->displayNotice($msg, $redirectOptions);
return;
}
try {
$userId = (int) JFactory::getUser()->get('id');
if ($userId > 0) {
$validData['user_id'] = $userId;
}
$model->save($validData);
} catch (RuntimeException $e) {
$this->displayNotice($e->getMessage(), $redirectOptions);
return;
} catch (Exception $e) {
JLog::add($e->getMessage(), JLog::ERROR, 'com_crowdfunding');
throw new Exception(JText::_('COM_CROWDFUNDING_ERROR_SYSTEM'));
}
// Redirect to next page
$this->displayMessage(JText::_('COM_CROWDFUNDING_REPORT_SENT_SUCCESSFULLY'), $redirectOptions);
}
示例5: save
public function save($key = null, $urlVar = null)
{
// Check for request forgeries.
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
$userId = (int) JFactory::getUser()->get('id');
if (!$userId) {
$redirectOptions = array('force_direction' => 'index.php?option=com_users&view=login');
$this->displayNotice(JText::_('COM_CROWDFUNDING_ERROR_NOT_LOG_IN'), $redirectOptions);
return;
}
// Get the data from the form POST
$data = $this->input->post->get('jform', array(), 'array');
$itemId = Joomla\Utilities\ArrayHelper::getValue($data, 'project_id', 0, 'int');
// Get project
$item = Crowdfunding\Project::getInstance(JFactory::getDbo(), $itemId);
$redirectOptions = array('force_direction' => CrowdfundingHelperRoute::getDetailsRoute($item->getSlug(), $item->getCatSlug(), 'updates'));
// Check for valid owner.
if ($userId !== $item->getUserId()) {
$this->displayWarning(JText::_('COM_CROWDFUNDING_ERROR_INVALID_PROJECT'), $redirectOptions);
return;
}
$model = $this->getModel();
/** @var $model CrowdfundingModelUpdate */
$form = $model->getForm($data, false);
/** @var $form JForm */
if (!$form) {
throw new Exception(JText::_('COM_CROWDFUNDING_ERROR_FORM_CANNOT_BE_LOADED'));
}
// Test if the data is valid.
$validData = $model->validate($form, $data);
// Check for validation errors.
if ($validData === false) {
$errors = $form->getErrors();
$error = array_shift($errors);
$msg = $error->getMessage();
$this->displayNotice($msg, $redirectOptions);
return;
}
try {
$model->save($validData);
} catch (Exception $e) {
JLog::add($e->getMessage(), JLog::ERROR, 'com_crowdfunding');
throw new Exception(JText::_('COM_CROWDFUNDING_ERROR_SYSTEM'));
}
// Redirect to next page
$this->displayMessage(JText::_('COM_CROWDFUNDING_UPDATE_SUCCESSFULLY_SAVED'), $redirectOptions);
}
示例6: send
public function send()
{
// Check for request forgeries.
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
$redirectOptions = array("view" => "discover");
$params = JComponentHelper::getParams("com_crowdfunding");
/** @var $params Joomla\Registry\Registry */
if (!$params->get("security_display_friend_form", 0)) {
$this->displayNotice(JText::_('COM_CROWDFUNDING_ERROR_CANT_SEND_MAIL'), $redirectOptions);
return;
}
// Get the data from the form POST
$data = $this->input->post->get('jform', array(), 'array');
$itemId = Joomla\Utilities\ArrayHelper::getValue($data, "id", 0, "uint");
// Get project
$item = Crowdfunding\Project::getInstance(JFactory::getDbo(), $itemId);
// Prepare redirect link
$link = CrowdfundingHelperRoute::getEmbedRoute($item->getSlug(), $item->getCatSlug(), "email");
$redirectOptions = array("force_direction" => $link);
$model = $this->getModel();
/** @var $model CrowdfundingModelFriendMail */
$form = $model->getForm($data, false);
/** @var $form JForm */
if (!$form) {
throw new Exception(JText::_("COM_CROWDFUNDING_ERROR_FORM_CANNOT_BE_LOADED"));
}
// Test if the data is valid.
$validData = $model->validate($form, $data);
// Check for validation errors.
if ($validData === false) {
$this->displayNotice($form->getErrors(), $redirectOptions);
return;
}
try {
$model->send($validData);
} catch (Exception $e) {
JLog::add($e->getMessage());
throw new Exception(JText::_('COM_CROWDFUNDING_ERROR_SYSTEM'));
}
// Redirect to next page
$this->displayMessage(JText::_("COM_CROWDFUNDING_FRIEND_MAIL_SUCCESSFULLY_SEND"), $redirectOptions);
}
示例7: loadFormData
/**
* Method to get the data that should be injected in the form.
*
* @throws \Exception
* @return mixed The data for the form.
* @since 1.6
*/
protected function loadFormData()
{
$app = JFactory::getApplication();
/** @var $app JApplicationSite */
$data = $app->getUserState($this->option . '.edit.friendmail.data', array());
if (!$data) {
$item = $this->getItem();
// Prepare default content of the form
if ((int) $item->id > 0) {
$link = JRoute::_(CrowdfundingHelperRoute::getDetailsRoute($item->slug, $item->catslug));
$data = array('id' => $item->id, 'subject' => JText::sprintf('COM_CROWDFUNDING_SEND_FRIEND_DEFAULT_SUBJECT', $item->title), 'message' => JText::sprintf('COM_CROWDFUNDING_SEND_FRIEND_DEFAULT_MESSAGE', $link));
// Set user data
$user = JFactory::getUser();
if ((int) $user->get('id') > 0) {
$data['sender_name'] = $user->name;
$data['sender'] = $user->email;
}
}
}
return $data;
}
示例8: notifyAjax
/**
* Catch a request from payment plugin via AJAX and process a transaction.
*/
public function notifyAjax()
{
$response = new Prism\Response\Json();
// Check for disabled payment functionality
if ($this->params->get('debug_payment_disabled', 0)) {
$errorData = JText::sprintf('COM_CROWDFUNDING_TRANSACTION_DATA', var_export($_REQUEST, true));
$this->log->add(JText::_('COM_CROWDFUNDING_ERROR_PAYMENT_HAS_BEEN_DISABLED'), 'ERROR_CONTROLLER_NOTIFIER_AJAX', $errorData);
// Send response to the browser
$response->setTitle(JText::_('COM_CROWDFUNDING_FAIL'))->setText(JText::_('COM_CROWDFUNDING_ERROR_PAYMENT_HAS_BEEN_DISABLED_MESSAGE'))->failure();
echo $response;
$this->app->close();
}
// Get model object.
$model = $this->getModel();
$paymentResult = null;
$redirectUrl = null;
$message = null;
$project = null;
/** @var Crowdfunding\Project $project */
// Trigger the event
try {
// Import Crowdfunding Payment Plugins
JPluginHelper::importPlugin('crowdfundingpayment');
// Trigger onPaymentNotify event.
$dispatcher = JEventDispatcher::getInstance();
$results = $dispatcher->trigger('onPaymentNotify', array($this->context, &$this->params));
if (is_array($results) and count($results) > 0) {
foreach ($results as $result) {
if (is_object($result) and isset($result->transaction)) {
$paymentResult = $result;
$project = isset($result->project) ? $result->project : null;
$redirectUrl = isset($result->redirectUrl) ? $result->redirectUrl : null;
$message = isset($result->message) ? $result->message : null;
break;
}
}
}
// If there is no transaction data, the status might be pending or another one.
// So, we have to stop the script execution.
if (!$paymentResult) {
// Send response to the browser
$response->setTitle(JText::_('COM_CROWDFUNDING_FAIL'))->setText(JText::_('COM_CROWDFUNDING_TRANSACTION_NOT_PROCESSED_SUCCESSFULLY'))->failure();
echo $response;
$this->app->close();
}
// Trigger the event onAfterPaymentNotify
$dispatcher->trigger('onAfterPaymentNotify', array($this->context, &$paymentResult, &$this->params));
// Trigger the event onAfterPayment
$dispatcher->trigger('onAfterPayment', array($this->context, &$paymentResult, &$this->params));
} catch (Exception $e) {
// Store log data to the database.
$error = 'AJAX NOTIFIER ERROR: ' . $e->getMessage() . "\n";
$errorData = 'INPUT:' . var_export($this->app->input, true) . "\n";
$this->log->add($error, 'ERROR_CONTROLLER_NOTIFIER_AJAX', $errorData);
// Send response to the browser
$response->failure()->setTitle(JText::_('COM_CROWDFUNDING_FAIL'))->setText(JText::_('COM_CROWDFUNDING_ERROR_SYSTEM'));
// Send notification about the error to the administrator.
$model->sendMailToAdministrator();
echo $response;
$this->app->close();
}
// Generate redirect URL
if (!$redirectUrl and is_object($project)) {
$uri = JUri::getInstance();
$redirectUrl = $uri->toString(array('scheme', 'host')) . JRoute::_(CrowdfundingHelperRoute::getBackingRoute($project->getSlug(), $project->getCatSlug(), 'share'));
}
if (!$message) {
$message = JText::_('COM_CROWDFUNDING_TRANSACTION_PROCESSED_SUCCESSFULLY');
}
// Send response to the browser
$response->success()->setTitle(JText::_('COM_CROWDFUNDING_SUCCESS'))->setText($message)->setRedirectUrl($redirectUrl);
echo $response;
$this->app->close();
}
示例9: htmlspecialchars
echo $imageFolder . "/" . $project->getImage();
?>
" alt="<?php
echo htmlspecialchars($project->getTitle(), ENT_QUOTES, "UTF-8");
?>
" width="<?php
echo $imageWidth;
?>
" height="<?php
echo $imageHeight;
?>
" />
<div class="caption">
<h3>
<a href="<?php
echo JRoute::_(CrowdfundingHelperRoute::getDetailsRoute($project->getSlug(), $project->getCatSlug()));
?>
">
<?php
echo htmlspecialchars($project->getTitle(), ENT_QUOTES, "UTF-8");
?>
</a>
</h3>
<span class="font-xxsmall">
<?php
echo JText::_("MOD_CROWDFUNDINGDETAILS_BY");
if (!empty($socialProfileLink)) {
?>
<a href="<?php
echo $socialProfileLink;
?>
示例10:
echo JHtml::_('crowdfunding.approved', $item->approved);
?>
</td>
<td class="text-center hidden-phone">
<a href="<?php
echo JRoute::_(CrowdfundingHelperRoute::getFormRoute($item->id));
?>
"
class="btn btn-primary btn-sm">
<span class="fa fa-edit"></span>
<?php
echo JText::_('COM_CROWDFUNDING_EDIT');
?>
</a>
<a href="<?php
echo JRoute::_(CrowdfundingHelperRoute::getFormRoute($item->id, 'manager'));
?>
"
class="btn btn-default btn-sm">
<span class="fa fa-wrench"></span>
<?php
echo JText::_('COM_CROWDFUNDING_MANAGER');
?>
</a>
</td>
</tr>
<?php
}
?>
</tbody>
示例11: sendMail
protected function sendMail($project, $emailId)
{
$app = JFactory::getApplication();
/** @var $app JApplicationSite */
// Get website
$uri = JUri::getInstance();
$website = $uri->toString(array("scheme", "host"));
$emailMode = $this->params->get("email_mode", "plain");
// Route project URI
$appSite = JApplicationCms::getInstance('site');
$router = $appSite->getRouter('site');
$routedUri = $router->build(CrowdfundingHelperRoute::getDetailsRoute($project->slug, $project->catslug));
if ($routedUri instanceof JUri) {
$routedUri = $routedUri->toString();
}
if (0 === strpos($routedUri, "/administrator")) {
$routedUri = str_replace("/administrator", "", $routedUri);
}
// Prepare data for parsing
$data = array("site_name" => $app->get("sitename"), "site_url" => JUri::root(), "item_title" => $project->title, "item_url" => $website . $routedUri);
// Send mail to the administrator
if (!$emailId) {
return false;
}
$email = new EmailTemplates\Email();
$email->setDb(JFactory::getDbo());
$email->load($emailId);
if (!$email->getSenderName()) {
$email->setSenderName($app->get("fromname"));
}
if (!$email->getSenderEmail()) {
$email->setSenderEmail($app->get("mailfrom"));
}
$recipientName = $project->name;
$recipientMail = $project->email;
// Prepare data for parsing
$data["sender_name"] = $email->getSenderName();
$data["sender_email"] = $email->getSenderEmail();
$data["recipient_name"] = $recipientName;
$data["recipient_email"] = $recipientMail;
$email->parse($data);
$subject = $email->getSubject();
$body = $email->getBody($emailMode);
$mailer = JFactory::getMailer();
if (strcmp("html", $emailMode) == 0) {
// Send as HTML message
$result = $mailer->sendMail($email->getSenderEmail(), $email->getSenderName(), $recipientMail, $subject, $body, Prism\Constants::MAIL_MODE_HTML);
} else {
// Send as plain text.
$result = $mailer->sendMail($email->getSenderEmail(), $email->getSenderName(), $recipientMail, $subject, $body, Prism\Constants::MAIL_MODE_PLAIN);
}
// Log the error.
if ($result !== true) {
$this->log->add(JText::sprintf("PLG_CONTENT_CROWDFUNDINGUSERMAIL_ERROR_SEND_MAIL", $this->name), "PLG_CONTENT_USERE_MAIL_ERROR", JText::sprintf("PLG_CONTENT_CROWDFUNDINGUSERMAIL_ERROR_SEND_MAIL_NOTE", $mailer->ErrorInfo));
return false;
}
return true;
}
示例12: htmlspecialchars
?>
</div>
<div class="cf-frss pull-center"><?php
echo JHtml::_('crowdfunding.resultStateText', $project->getFundedPercent(), $project->getFundingType());
?>
</div>
</div>
<?php
} else {
?>
<div class="cfinfo-funding-action">
<a class="btn btn-default btn-large btn-block <?php
echo !$isValidEndDate ? 'disabled' : '';
?>
" href="<?php
echo JRoute::_(CrowdfundingHelperRoute::getBackingRoute($project->getSlug(), $project->getCatSlug()));
?>
">
<?php
if (!$params->get('button_title_custom')) {
echo JText::_($params->get('button_title', 'MOD_CROWDFUNDINGINFO_BUTTON_CONTRIBUTE'));
} else {
echo htmlspecialchars($params->get('button_title_custom'), ENT_COMPAT, 'UTF-8');
}
?>
</a>
</div>
<?php
}
?>
示例13: onPayoutsDeauthorize
/**
* Disconnect user from payment gateway.
*
* @param string $context
* @param Joomla\Registry\Registry $params
*
* @return null|array
*/
public function onPayoutsDeauthorize($context, $params)
{
if (strcmp('com_crowdfundingfinance.payouts.deauthorize.stripeconnect', $context) !== 0) {
return null;
}
if ($this->app->isAdmin()) {
return null;
}
$doc = JFactory::getDocument();
/** @var $doc JDocumentHtml */
// Check document type
$docType = $doc->getType();
if (strcmp('html', $docType) !== 0) {
return null;
}
// Prepare output data.
$output = array('redirect_url' => '', 'message' => '');
$errorOutput = array('redirect_url' => JRoute::_(CrowdfundingHelperRoute::getDiscoverRoute()), 'message' => '');
// DEBUG DATA
JDEBUG ? $this->log->add(JText::_($this->textPrefix . '_DEBUG_GET_RESPONSE_AUTHORIZE'), $this->debugType, $_GET) : null;
$userId = JFactory::getUser()->get('id');
if (!$userId) {
$errorOutput['message'] = JText::_($this->textPrefix . '_ERROR_NOT_REGISTERED_USER');
return $errorOutput;
}
// Get token
$state = $this->app->input->get('state');
if (!$state) {
$errorOutput['message'] = JText::_($this->textPrefix . '_ERROR_INVALID_AUTHORIZATION_DATA');
return $errorOutput;
}
// Get project ID and redirect URL from the session.
$stateData = $this->app->getUserState($state);
if (count($stateData) === 0 or (!$stateData['redirect_url'] or !$stateData['project_id'])) {
$errorOutput['message'] = JText::_($this->textPrefix . '_ERROR_INVALID_AUTHORIZATION_DATA');
return $errorOutput;
}
$cfFinanceParams = JComponentHelper::getParams('com_crowdfundingfinance');
$apiKeys = Crowdfundingfinance\Stripe\Helper::getKeys($cfFinanceParams);
if (!$apiKeys['client_id'] or !$apiKeys['secret_key']) {
$errorOutput['message'] = JText::_($this->textPrefix . '_ERROR_CONFIGURATION');
return $errorOutput;
}
$payout = new Crowdfundingfinance\Payout(JFactory::getDbo());
$payout->setSecretKey($this->app->get('secret'));
$payout->load(array('project_id' => (int) $stateData['project_id']));
if (!$payout->getId()) {
$errorOutput['message'] = JText::_($this->textPrefix . '_ERROR_INVALID_PAYOUT');
return $errorOutput;
}
$alias = !$apiKeys['test'] ? 'production' : 'test';
$stripeData = $payout->getStripe();
if (!$stripeData->get('stripeconnect.' . $alias . '.account_id')) {
$errorOutput['message'] = JText::_($this->textPrefix . '_ERROR_NOT_CONNECTED');
return $errorOutput;
}
Crowdfundingfinance\Stripe\Helper::deauthorize($apiKeys, $stripeData->get('stripeconnect.' . $alias . '.account_id'));
$stripeData->set('stripeconnect.' . $alias . '.access_token', '');
$stripeData->set('stripeconnect.' . $alias . '.refresh_token', '');
$stripeData->set('stripeconnect.' . $alias . '.account_id', '');
$stripeData->set('stripeconnect.' . $alias . '.expires', 0);
$payout->setStripe($stripeData);
$payout->storeStripe();
// Get next URL.
$output['redirect_url'] = base64_decode($stateData['redirect_url']);
return $output;
}
示例14: onContentBeforeDisplay
/**
* @param string $context
* @param object $article
* @param Joomla\Registry\Registry $params
* @param int $page
*
* @return null|string
* @throws Exception
*/
public function onContentBeforeDisplay($context, &$article, &$params, $page = 0)
{
$app = JFactory::getApplication();
/** @var $app JApplicationSite */
if ($app->isAdmin()) {
return null;
}
$doc = JFactory::getDocument();
/** @var $doc JDocumentHtml */
// Check document type
$docType = $doc->getType();
if (strcmp("html", $docType) != 0) {
return null;
}
if (strcmp("com_crowdfunding.details", $context) != 0) {
return null;
}
// Load language
$this->loadLanguage();
$itemId = $app->input->getInt("id");
$stats = CrowdfundingHelper::getProjectData($itemId);
$screen = $app->input->getCmd("screen", "home");
$html = '<ul class="nav nav-pills cf-plg-navigation">';
if ($this->params->get("display_home")) {
$class = 'class="cf-plg-nav-home';
if (strcmp($screen, "home") == 0) {
$class .= ' active';
}
$class .= '"';
$html .= '<li ' . $class . '><a href="' . JRoute::_(CrowdfundingHelperRoute::getDetailsRoute($article->slug, $article->catslug)) . '">' . JText::_("PLG_CONTENT_CROWDFUNDINGNAV_HOME") . "</a></li>";
}
if ($this->params->get("display_updates")) {
$class = 'class="cf-plg-nav-updates';
if (strcmp($screen, "updates") == 0) {
$class .= ' active';
}
$class .= '"';
$stat = '<span class="badge">' . Joomla\Utilities\ArrayHelper::getValue($stats, "updates", 0) . '</span>';
$html .= '<li ' . $class . '><a href="' . JRoute::_(CrowdfundingHelperRoute::getDetailsRoute($article->slug, $article->catslug, "updates")) . '">' . JText::_("PLG_CONTENT_CROWDFUNDINGNAV_UPDATES") . ' ' . $stat . '</a></li>';
}
if ($this->params->get("display_comments")) {
$class = 'class="cf-plg-nav-comments';
if (strcmp($screen, "comments") == 0) {
$class .= ' active';
}
$class .= '"';
if (!$params->get("comments_enabled", 1)) {
$stat = '<span class="cf-dclabel"> </span>';
} else {
$stat = '<span class="badge">' . Joomla\Utilities\ArrayHelper::getValue($stats, "comments", 0) . '</span>';
}
$html .= '<li ' . $class . '><a href="' . JRoute::_(CrowdfundingHelperRoute::getDetailsRoute($article->slug, $article->catslug, "comments")) . '">' . JText::_("PLG_CONTENT_CROWDFUNDINGNAV_COMMENTS") . ' ' . $stat . '</a></li>';
}
if ($this->params->get("display_funders")) {
$class = 'class="cf-plg-nav-funders';
if (strcmp($screen, "funders") == 0) {
$class .= ' active';
}
$class .= '"';
$stat = '<span class="badge">' . Joomla\Utilities\ArrayHelper::getValue($stats, "funders", 0) . '</span>';
$html .= '<li ' . $class . '><a href="' . JRoute::_(CrowdfundingHelperRoute::getDetailsRoute($article->slug, $article->catslug, "funders")) . '">' . JText::_("PLG_CONTENT_CROWDFUNDINGNAV_FUNDERS") . ' ' . $stat . '</a></li>';
}
$html .= '</ul>';
return $html;
}
示例15: foreach
?>
<div class="cfrewards<?php
echo $moduleclassSfx;
?>
">
<div class="reward_title center"><?php
echo JText::_("MOD_CROWDFUNDINGREWARDS_PLEDGE_REWARDS");
?>
</div>
<?php
foreach ($rewards as $reward) {
?>
<div class="reward">
<a href="<?php
echo JRoute::_(CrowdfundingHelperRoute::getBackingRoute($project->getSlug(), $project->getCatSlug(), "default", $reward["id"]));
?>
">
<span class="ramount">
<?php
$amount = $currency->getAmountString($reward["amount"]);
echo JText::sprintf("MOD_CROWDFUNDINGREWARDS_INVEST_MORE", $amount);
?>
</span>
<span class="rtitle"><?php
echo htmlspecialchars($reward["title"], ENT_QUOTES, "UTF-8");
?>
</span>
<span class="rdesc"><?php
echo htmlspecialchars($reward["description"], ENT_QUOTES, "UTF-8");
?>