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


PHP JApplicationCms类代码示例

本文整理汇总了PHP中JApplicationCms的典型用法代码示例。如果您正苦于以下问题:PHP JApplicationCms类的具体用法?PHP JApplicationCms怎么用?PHP JApplicationCms使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: __construct

 /**
  * MonitorRouter constructor.
  *
  * @param   JApplicationCms      $app           Application object that the router should use
  * @param   JMenu                $menu          Menu object that the router should use
  * @param   MonitorModelProject  $modelProject  Project model to use in the router.
  * @param   MonitorModelIssue    $modelIssue    Issue model to use in the router.
  *
  * @throws Exception
  */
 public function __construct($app = null, $menu = null, $modelProject = null, $modelIssue = null)
 {
     JLoader::register('MonitorModelAbstract', JPATH_ROOT . '/administrator/components/com_monitor/model/abstract.php');
     JLoader::register('MonitorModelProject', JPATH_ROOT . '/administrator/components/com_monitor/model/project.php');
     JLoader::register('MonitorModelIssue', JPATH_ROOT . '/administrator/components/com_monitor/model/issue.php');
     if ($app) {
         $this->app = $app;
     } else {
         $this->app = JFactory::getApplication();
     }
     if ($menu) {
         $this->menu = $menu;
     } else {
         $this->menu = $this->app->getMenu();
     }
     if ($modelProject) {
         $this->modelProject = $modelProject;
     } else {
         $this->modelProject = new MonitorModelProject($app, false);
     }
     if ($modelIssue) {
         $this->modelIssue = $modelIssue;
     } else {
         $this->modelIssue = new MonitorModelIssue($app, false);
     }
 }
开发者ID:Harmageddon,项目名称:com_monitor,代码行数:36,代码来源:router.php

示例2: __construct

 /**
  * Class constructor.
  *
  * @param   JApplicationCms  $app   Application-object that the router should use
  * @param   JMenu            $menu  Menu-object that the router should use
  *
  * @since   3.4
  */
 public function __construct($app = null, $menu = null)
 {
     if ($app) {
         $this->app = $app;
     } else {
         $this->app = JFactory::getApplication('site');
     }
     if ($menu) {
         $this->menu = $menu;
     } else {
         $this->menu = $this->app->getMenu();
     }
 }
开发者ID:adjaika,项目名称:J3Base,代码行数:21,代码来源:base.php

示例3: execute

 /**
  * Execute the controller.
  *
  * @return  boolean  True if controller finished execution, false if the controller did not
  *                   finish execution. A controller might return false if some precondition for
  *                   the controller to run has not been satisfied.
  *
  * @since   12.1
  * @throws  LogicException
  * @throws  RuntimeException
  */
 public function execute()
 {
     $model = new MonitorModelIssue();
     $id = $this->input->getInt('id');
     $user = JFactory::getUser();
     // Get the params
     // TODO: may be removed when new MVC is implemented completely
     $this->app = JFactory::getApplication();
     if ($this->app instanceof JApplicationSite) {
         $params = $this->app->getParams();
     }
     if (!$model->canEdit($user, $id)) {
         if ($user->guest && isset($params) && $params->get('redirect_login', 1)) {
             $this->app->enqueueMessage(JText::_('JGLOBAL_YOU_MUST_LOGIN_FIRST'), 'error');
             $this->app->redirect(JRoute::_('index.php?option=com_users&view=login&return=' . base64_encode(JUri::getInstance()->toString()), '403'));
         } else {
             throw new Exception(JText::_('JERROR_ALERTNOAUTHOR'), 403);
         }
     }
     if ($id) {
         $model->setIssueId($id);
     }
     $model->loadForm();
     $view = new MonitorViewIssueHtml($model);
     $view->setLayout('edit');
     $view->loadForm();
     echo $view->render();
     return true;
 }
开发者ID:Harmageddon,项目名称:com_monitor,代码行数:40,代码来源:edit.php

示例4: onUserLoginFailure

 public function onUserLoginFailure($response)
 {
     var_dump($response);
     if ($response['status'] === 4 && $response['error_message'] == "suspended") {
         $this->app->redirect(JRoute::_('account-suspended', false));
     }
     //die();
 }
开发者ID:camigreen,项目名称:ttop,代码行数:8,代码来源:zoostore.php

示例5: execute

 /**
  * Method to remove root in global configuration.
  *
  * @return  boolean  True on success.
  *
  * @since   3.2
  */
 public function execute()
 {
     // Check for request forgeries.
     if (!JSession::checkToken('get')) {
         $this->app->enqueueMessage(JText::_('JINVALID_TOKEN'));
         $this->app->redirect('index.php');
     }
     // Check if the user is authorized to do this.
     if (!JFactory::getUser()->authorise('core.admin')) {
         $this->app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'));
         $this->app->redirect('index.php');
     }
     // Initialise model.
     $model = new ConfigModelApplication();
     // Attempt to save the configuration and remove root.
     try {
         $model->removeroot();
     } catch (RuntimeException $e) {
         // Save failed, go back to the screen and display a notice.
         $this->app->enqueueMessage(JText::sprintf('JERROR_SAVE_FAILED', $e->getMessage()), 'error');
         $this->app->redirect(JRoute::_('index.php', false));
     }
     // Set the redirect based on the task.
     $this->app->enqueueMessage(JText::_('COM_CONFIG_SAVE_SUCCESS'));
     $this->app->redirect(JRoute::_('index.php', false));
 }
开发者ID:01J,项目名称:skazkipronebo,代码行数:33,代码来源:removeroot.php

示例6: onAfterInitialise

 /**
  * Listener for the `onAfterInitialise` event
  *
  * @return  void
  *
  * @since   3.5
  */
 public function onAfterInitialise()
 {
     if (!$this->app->isAdmin() || !$this->isAllowedUser()) {
         return;
     }
     if (!$this->isDebugEnabled() && !$this->isUpdateRequired()) {
         return;
     }
     JHtml::_('jquery.framework');
     JHtml::script('plg_system_stats/stats.js', false, true, false);
 }
开发者ID:nemmar,项目名称:joomla-cms,代码行数:18,代码来源:stats.php

示例7: __construct

 /**
  * Constructor
  *
  * @param   array  $config  An array of configuration options (name, state, dbo, table_path, ignore_request).
  *
  * @since   3.3.4
  * @throws  Exception
  */
 public function __construct($config = array())
 {
     $this->app = JArrayHelper::getValue($config, 'app', JFactory::getApplication());
     $this->user = JArrayHelper::getValue($config, 'user', JFactory::getUser());
     $this->config = JArrayHelper::getValue($config, 'config', JFactory::getConfig());
     $this->session = JArrayHelper::getValue($config, 'session', JFactory::getSession());
     $this->date = JArrayHelper::getValue($config, 'date', JFactory::getDate());
     $this->lang = JArrayHelper::getValue($config, 'lang', JFactory::getLanguage());
     $this->package = $this->app->getUserState('com_fabrik.package', 'fabrik');
     parent::__construct($config);
 }
开发者ID:LGBGit,项目名称:tierno,代码行数:19,代码来源:fabrik.php

示例8: createView

 /**
  * @param array $data
  * @return Renderer
  */
 public function createView(array $data = array())
 {
     $renderer = new Renderer($data);
     $name = $this->getName();
     // Add the default view path
     $renderer->addIncludePath(COMPONENT_ROOT . '/src/views/' . $this->getName());
     $template = $this->app->getTemplate();
     $option = $this->input->get('option');
     // Prepend the template path
     $renderer->addIncludePath(JPATH_ROOT . '/templates/' . $template . '/html/' . $option . '/' . $this->getName(), true);
     return $renderer;
 }
开发者ID:beingsane,项目名称:com_framework,代码行数:16,代码来源:AbstractBaseController.php

示例9: execute

 /**
  * Method to save global configuration.
  *
  * @return  boolean  True on success.
  *
  * @since   3.2
  */
 public function execute()
 {
     // Check for request forgeries.
     if (!JSession::checkToken()) {
         $this->app->enqueueMessage(JText::_('JINVALID_TOKEN'));
         $this->app->redirect('index.php');
     }
     // Check if the user is authorized to do this.
     if (!JFactory::getUser()->authorise('core.admin')) {
         $this->app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'));
         $this->app->redirect('index.php');
     }
     // Set FTP credentials, if given.
     JClientHelper::setCredentialsFromRequest('ftp');
     $model = new ConfigModelConfig();
     $form = $model->getForm();
     $data = $this->input->post->get('jform', array(), 'array');
     // Validate the posted data.
     $return = $model->validate($form, $data);
     // Check for validation errors.
     if ($return === false) {
         /*
          * The validate method enqueued all messages for us, so we just need to redirect back.
          */
         // Save the data in the session.
         $this->app->setUserState('com_config.config.global.data', $data);
         // Redirect back to the edit screen.
         $this->app->redirect(JRoute::_('index.php?option=com_config&controller=config.display.config', false));
     }
     // Attempt to save the configuration.
     $data = $return;
     // Access back-end com_config
     JLoader::registerPrefix('Config', JPATH_ADMINISTRATOR . '/components/com_config');
     $saveClass = new ConfigControllerApplicationSave();
     // Get a document object
     $document = JFactory::getDocument();
     // Set back-end required params
     $document->setType('json');
     // Execute back-end controller
     $return = $saveClass->execute();
     // Reset params back after requesting from service
     $document->setType('html');
     // Check the return value.
     if ($return === false) {
         /*
          * The save method enqueued all messages for us, so we just need to redirect back.
          */
         // Save the data in the session.
         $this->app->setUserState('com_config.config.global.data', $data);
         // Save failed, go back to the screen and display a notice.
         $this->app->redirect(JRoute::_('index.php?option=com_config&controller=config.display.config', false));
     }
     // Redirect back to com_config display
     $this->app->enqueueMessage(JText::_('COM_CONFIG_SAVE_SUCCESS'));
     $this->app->redirect(JRoute::_('index.php?option=com_config&controller=config.display.config', false));
     return true;
 }
开发者ID:01J,项目名称:skazkipronebo,代码行数:64,代码来源:save.php

示例10: onUserLogout

 public function onUserLogout($options)
 {
     // No remember me for admin
     if ($this->app->isAdmin()) {
         return false;
     }
     $cookieName = JUserHelper::getShortHashedUserAgent();
     // Check for the cookie
     if ($this->app->input->cookie->get($cookieName)) {
         // Make sure authentication group is loaded to process onUserAfterLogout event
         JPluginHelper::importPlugin('authentication');
     }
 }
开发者ID:Tommar,项目名称:vino2,代码行数:13,代码来源:remember.php

示例11: onAfterInitialise

 /**
  * Listener for onAfterInitialise event
  *
  * @return  void
  */
 public function onAfterInitialise()
 {
     // Only for site
     if (!$this->app->isSite()) {
         return;
     }
     // Register listeners for JHtml helpers
     if (!JHtml::isRegistered('bootstrap.loadCss')) {
         JHtml::register('bootstrap.loadCss', 'PlgSystemBootstrap3::loadCss');
     }
     if (!JHtml::isRegistered('bootstrap.carousel')) {
         JHtml::register('bootstrap.carousel', 'PlgSystemBootstrap3::carousel');
     }
 }
开发者ID:brianteeman,项目名称:bs3-demo,代码行数:19,代码来源:bootstrap3.php

示例12: execute

 /**
  * Execute the controller.
  *
  * @return  boolean  True if controller finished execution, false if the controller did not
  *                   finish execution. A controller might return false if some precondition for
  *                   the controller to run has not been satisfied.
  *
  * @since   12.1
  * @throws  LogicException
  * @throws  RuntimeException
  */
 public function execute()
 {
     $id = $this->input->getInt('id');
     $user = JFactory::getUser();
     if ($user->guest) {
         $this->app->enqueueMessage(JText::_('JGLOBAL_YOU_MUST_LOGIN_FIRST'), 'error');
     } else {
         $model = new MonitorModelSubscription();
         if ($model->isSubscriberIssue($id, $user->id)) {
             $model->unsubscribeIssue($id, $user->id);
             $this->app->enqueueMessage(JText::_('COM_MONITOR_SUBSCRIPTION_ISSUE_UNSUBSCRIBED'), 'message');
         }
     }
     $this->app->redirect(JRoute::_('index.php?option=com_monitor&view=issue&id=' . $id, false));
 }
开发者ID:Harmageddon,项目名称:com_monitor,代码行数:26,代码来源:unsubscribe.php

示例13: onAfterRouteAdmin

 /**
  * Re-route Gantry templates to Gantry Administration component.
  */
 private function onAfterRouteAdmin()
 {
     $input = $this->app->input;
     $option = $input->getCmd('option');
     $task = $input->getCmd('task');
     if (in_array($option, ['com_templates', 'com_advancedtemplates']) && $task && strpos($task, 'style') === 0) {
         // Get all ids.
         $cid = $input->post->get('cid', (array) $input->getInt('id'), 'array');
         if ($cid) {
             $styles = $this->getStyles();
             $selected = array_intersect(array_keys($styles), $cid);
             // If no Gantry templates were selected, just let com_templates deal with the request.
             if (!$selected) {
                 return;
             }
             // Special handling for tasks coming from com_template.
             if ($task == 'style.edit') {
                 $id = (int) array_shift($cid);
                 if (isset($styles[$id])) {
                     $token = JSession::getFormToken();
                     $this->app->redirect("index.php?option=com_gantry5&view=configurations/{$id}/styles&style={$id}&{$token}=1");
                 }
             }
         }
     }
 }
开发者ID:Ettore495,项目名称:Ettore-Work,代码行数:29,代码来源:gantry5.php

示例14: onUserLogout

 /**
  * This method should handle any logout logic and report back to the subject
  *
  * @param   array  $user     Holds the user data.
  * @param   array  $options  Array holding options (client, ...).
  *
  * @return  object  True on success
  *
  * @since   1.5
  */
 public function onUserLogout($user, $options = array())
 {
     $my = JFactory::getUser();
     $session = JFactory::getSession();
     // Make sure we're a valid user first
     if ($user['id'] == 0 && !$my->get('tmp_user')) {
         return true;
     }
     // Check to see if we're deleting the current session
     if ($my->get('id') == $user['id'] && $options['clientid'] == $this->app->getClientId()) {
         // Hit the user last visit field
         $my->setLastVisit();
         // Destroy the php session for this user
         $session->destroy();
     }
     // Enable / Disable Forcing logout all users with same userid
     $forceLogout = $this->params->get('forceLogout', 1);
     if ($forceLogout) {
         $query = $this->db->getQuery(true)->delete($this->db->quoteName('#__session'))->where($this->db->quoteName('userid') . ' = ' . (int) $user['id'])->where($this->db->quoteName('client_id') . ' = ' . (int) $options['clientid']);
         try {
             $this->db->setQuery($query)->execute();
         } catch (RuntimeException $e) {
             return false;
         }
     }
     return true;
 }
开发者ID:brenot,项目名称:forumdesenvolvimento,代码行数:37,代码来源:joomla.php

示例15: __construct

 /**
  * Class constructor.
  *
  * @since   3.1
  */
 public function __construct()
 {
     // Run the parent constructor
     parent::__construct();
     // Load and set the dispatcher
     $this->loadDispatcher();
     // Enable sessions by default.
     if (is_null($this->config->get('session'))) {
         $this->config->set('session', true);
     }
     // Set the session default name.
     if (is_null($this->config->get('session_name'))) {
         $this->config->set('session_name', 'installation');
     }
     // Create the session if a session name is passed.
     if ($this->config->get('session') !== false) {
         $this->loadSession();
         // Register the session with JFactory
         JFactory::$session = $this->getSession();
     }
     // Store the debug value to config based on the JDEBUG flag
     $this->config->set('debug', JDEBUG);
     // Register the config to JFactory
     JFactory::$config = $this->config;
     // Register the application to JFactory
     JFactory::$application = $this;
     // Register the application name
     $this->_name = 'installation';
     // Register the client ID
     $this->_clientId = 2;
     // Set the root in the URI one level up.
     $parts = explode('/', JUri::base(true));
     array_pop($parts);
     JUri::root(null, implode('/', $parts));
 }
开发者ID:shoffmann52,项目名称:install-from-web-server,代码行数:40,代码来源:web.php


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