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


PHP JControllerLegacy::getInstance方法代码示例

本文整理汇总了PHP中JControllerLegacy::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP JControllerLegacy::getInstance方法的具体用法?PHP JControllerLegacy::getInstance怎么用?PHP JControllerLegacy::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JControllerLegacy的用法示例。


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

示例1: display

 function display($tpl = null)
 {
     $app = JFactory::getApplication();
     $params = $app->getParams();
     $dispatcher = JDispatcher::getInstance();
     $model = $this->getModel('addeditwalk');
     $this->controller = JControllerLegacy::getInstance('SWG_WalkLibrary');
     // Get some data from the models
     $state = $this->get('State');
     $this->form = $this->get('Form');
     $this->walk = $this->get('Walk');
     // Check the current user can edit this walk (or add a new one)
     if ($model->editing() && !$this->controller->canEdit($this->walk) || !$model->editing() && !$this->controller->canAdd()) {
         return JError::raiseWarning(403, JText::_('JERROR_ALERTNOAUTHOR'));
     }
     // Check for errors.
     if (count($errors = $this->get('Errors'))) {
         JError::raiseError(500, implode('<br />', $errors));
         return false;
     }
     $this->showForm = true;
     $this->editing = $model->editing();
     // Display the view
     parent::display($tpl);
 }
开发者ID:SheffieldWalkingGroup,项目名称:swgwebsite,代码行数:25,代码来源:view.html.php

示例2: joooid_getController

function joooid_getController()
{
    if (version_compare(JVERSION, '3.0', '<')) {
        return JController::getInstance('joooid');
    }
    return JControllerLegacy::getInstance('joooid');
}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:7,代码来源:joooid.php

示例3: getCSS

 public static function getCSS()
 {
     if (version_compare(JVERSION, '3.0', 'ge')) {
         $document = JFactory::getDocument();
         $view = JRequest::getCmd('view', 'cpanel');
         $document->addStyleSheet(JUri::base() . 'components/com_bt_portfolio/views/' . $view . '/tmpl/css/legacy.css');
         return JControllerLegacy::getInstance('Bt_portfolio');
     }
 }
开发者ID:Tommar,项目名称:remate,代码行数:9,代码来源:legacy.php

示例4: getCSS

 public static function getCSS()
 {
     if (version_compare(JVERSION, '3.0', 'ge')) {
         $document = JFactory::getDocument();
         $jinput = JFactory::getApplication()->input;
         $view = $jinput->get('view', 'cpanel', 'CMD');
         $document->addStyleSheet(JUri::base() . 'components/com_bt_socialconnect/views/' . $view . '/tmpl/css/legacy.css');
         return JControllerLegacy::getInstance('Bt_Socialconnect');
     }
 }
开发者ID:juanferden,项目名称:adoperp,代码行数:10,代码来源:legacy.php

示例5: onSloginCheck

 public function onSloginCheck()
 {
     require_once JPATH_BASE . '/components/com_slogin/controller.php';
     $controller = new SLoginController();
     $input = JFactory::getApplication()->input;
     $error = $input->getString('error', '');
     if ($error == 'access_denied') {
         $config = JComponentHelper::getParams('com_slogin');
         JModel::addIncludePath(JPATH_ROOT . '/components/com_slogin/models');
         $model = JModel::getInstance('Linking_user', 'SloginModel');
         $redirect = base64_decode($model->getReturnURL($config, 'failure_redirect'));
         $controller = JControllerLegacy::getInstance('SLogin');
         $controller->displayRedirect($redirect, true);
     }
     $request = null;
     $code = $input->get('code', null, 'STRING');
     $returnRequest = new SloginRequest();
     if ($code) {
         // get access_token from API
         $params = array('grant_type=authorization_code', 'code=' . $code, 'client_id=' . $this->params->get('id'), 'client_secret=' . $this->params->get('password'));
         $params = implode('&', $params);
         $url = 'https://oauth.yandex.ru/token';
         $request = $controller->open_http($url, true, $params);
         $request = json_decode($request);
         if (!empty($request->error)) {
             echo 'Error - ' . $request->error;
             exit;
         }
         if (empty($request->access_token)) {
             echo 'Error - empty access tocken';
             exit;
         }
         $url = 'https://login.yandex.ru/info?format=json&oauth_token=' . $request->access_token;
         $request = json_decode($controller->open_http($url));
         if (empty($request)) {
             echo 'Error - empty user data';
             exit;
         }
         $name = explode(' ', $request->real_name);
         $returnRequest->first_name = isset($name[1]) ? $name[1] : '';
         $returnRequest->last_name = isset($name[0]) ? $name[0] : '';
         $returnRequest->email = $request->default_email;
         $returnRequest->id = $request->id;
         $returnRequest->real_name = $request->real_name;
         $returnRequest->sex = $request->sex;
         $returnRequest->display_name = $request->display_name;
         $returnRequest->birthday = $request->birthday;
         $returnRequest->all_request = $request;
         return $returnRequest;
     } else {
         echo 'Error - empty code';
         exit;
     }
 }
开发者ID:janich,项目名称:slogin,代码行数:54,代码来源:yandex.php

示例6: onSloginCheck

 public function onSloginCheck()
 {
     $redirect = JURI::base() . '?option=com_slogin&task=check&plugin=linkedin';
     $app = JFactory::getApplication();
     $input = $app->input;
     $oauth_problem = $input->getString('oauth_problem', '');
     if ($oauth_problem == 'user_refused') {
         $config = JComponentHelper::getParams('com_slogin');
         JModel::addIncludePath(JPATH_ROOT . '/components/com_slogin/models');
         $model = JModel::getInstance('Linking_user', 'SloginModel');
         $redirect = base64_decode($model->getReturnURL($config, 'failure_redirect'));
         $controller = JControllerLegacy::getInstance('SLogin');
         $controller->displayRedirect($redirect, true);
     }
     # First step is to initialize with your consumer key and secret. We'll use an out-of-band oauth_callback
     $linkedin = new LinkedIn($this->params->get('api_key'), $this->params->get('secret_key'), $redirect);
     //$linkedin->debug = true;
     $oauth_verifier = $input->getString('oauth_verifier', '');
     $requestToken = unserialize($app->getUserState('requestToken'));
     $linkedin->request_token = $requestToken;
     $linkedin->oauth_verifier = $app->getUserState('oauth_verifier');
     if (!empty($oauth_verifier)) {
         $app->setUserState('oauth_verifier', $oauth_verifier);
         $linkedin->getAccessToken($oauth_verifier);
         $app->setUserState('oauth_access_token', serialize($linkedin->access_token));
         header("Location: " . $redirect);
         exit;
     } else {
         $linkedin->access_token = unserialize($app->getUserState('oauth_access_token'));
     }
     # You now have a $linkedin->access_token and can make calls on behalf of the current member
     //$request = $linkedin->getProfile("~:(id,first-name,last-name,headline,picture-url)");
     $request = $linkedin->getProfile("~:(id,first-name,last-name,headline,picture-url,email-address)?format=json");
     $request = json_decode($request);
     if (empty($request)) {
         echo 'Error - empty user data';
         exit;
     } else {
         if (!empty($request->errorCode)) {
             echo 'Error - ' . $request->message;
             exit;
         }
     }
     $returnRequest = new SloginRequest();
     $returnRequest->first_name = $request->firstName;
     $returnRequest->last_name = $request->lastName;
     //            $returnRequest->email       = $request->email;
     $returnRequest->id = $request->id;
     $returnRequest->real_name = $request->firstName . ' ' . $request->lastName;
     $returnRequest->display_name = $request->firstName;
     $returnRequest->all_request = $request;
     return $returnRequest;
 }
开发者ID:gaetanodanelli,项目名称:slogin,代码行数:53,代码来源:linkedin.php

示例7: addSubmenu

 /**
  * Configure the Linkbar.
  */
 public static function addSubmenu($vName = '')
 {
     JHtmlSidebar::addEntry(JText::_('COM_DZPRODUCT_TITLE_ITEMS'), 'index.php?option=com_dzproduct&view=items', $vName == 'items');
     JHtmlSidebar::addEntry(JText::_('COM_DZPRODUCT_TITLE_CATEGORIES'), "index.php?option=com_categories&extension=com_dzproduct.items.catid", $vName == 'categories.items');
     if ($vName == 'categories.items') {
         JToolBarHelper::title('DZ Products: Categories (Items - Item )');
         // A hack to use our categories template instead of built-in categories template
         $controller = JControllerLegacy::getInstance('', 'CategoriesController');
         $view = $controller->getView();
         $view->addTemplatePath(JPATH_ADMINISTRATOR . '/components/com_dzproduct/views/categories/tmpl');
     }
     JHtmlSidebar::addEntry(JText::_('COM_DZPRODUCT_TITLE_FIELDS'), 'index.php?option=com_dzproduct&view=fields', $vName == 'fields');
     JHtmlSidebar::addEntry(JText::_('COM_DZPRODUCT_TITLE_GROUPS'), 'index.php?option=com_dzproduct&view=groups', $vName == 'groups');
     JHtmlSidebar::addEntry(JText::_('COM_DZPRODUCT_TITLE_ORDERS'), 'index.php?option=com_dzproduct&view=orders', $vName == 'orders');
 }
开发者ID:nadsrosun,项目名称:ProductComparisonDemo,代码行数:18,代码来源:dzproduct.php

示例8: display

 /**
  * Display the view
  */
 public function display($tpl = null)
 {
     $doc = JFactory::getDocument();
     $class = JRequest::getVar('class');
     $method = JRequest::getVar('method');
     if (!$class) {
         ApiError::raiseError(404, 'Class not found.');
     }
     // Session
     // =================================================================
     //$this->handleSession() ;
     // Excute method
     // =================================================================
     $ctrl = JControllerLegacy::getInstance('Webgallery');
     $model = $ctrl->getModel($class);
     if (!$model) {
         ApiError::raiseError(404, "Class: {$class} not exists.");
         return false;
     }
     if (!$method) {
         $method = $model->get('default_method', 'getItems');
     }
     if (!is_callable(array($model, $method))) {
         ApiError::raiseError(404, "Method: {$class}::{$method} not exists.");
         return false;
     }
     $data = $model->{$method}();
     // Check for errors.
     // =================================================================
     if (count($errors = $this->get('Errors'))) {
         ApiError::raiseError(500, implode("\n", $errors));
         return false;
     }
     // render Result
     // =================================================================
     $result = new JObject();
     $result->set('ApiResult', $data);
     if (JDEBUG) {
         $result->set('debug', ApiError::$debug);
     }
     echo $json = json_encode($result);
     return true;
 }
开发者ID:ForAEdesWeb,项目名称:AEW3,代码行数:46,代码来源:viewapi.class.php

示例9: loadOtherTemplate

 public function loadOtherTemplate($tpl = null, $layout, $view_name = null, array $vars = array())
 {
     if (!empty($view_name)) {
         $controller = JControllerLegacy::getInstance(ucfirst($this->ext_name) . 'Controller' . ucfirst($view_name));
         $view = $controller->getView($view_name, 'html');
         $model = $controller->getModel($view_name);
         $current_layout = $this->getLayout();
         $view->setModel($model, true);
         $view->setLayout($layout);
         foreach ($vars as $name => $var) {
             $view->assign($vars);
         }
         $html = $view->loadTemplate($tpl);
         $view->setLayout($current_layout);
     } else {
         $html = parent::loadTemplate($tpl);
     }
     return $html;
 }
开发者ID:JexyRu,项目名称:Ksenmart,代码行数:19,代码来源:viewks.php

示例10: render

 /**
  * Render the application
  *
  * @return	void
  */
 public function render()
 {
     $document = JFactory::getDocument();
     $config = JFactory::getConfig();
     $user = JFactory::getUser();
     switch ($document->getType()) {
         case 'html':
             // Set metadata
             $document->setTitle(JText::_('INSTL_PAGE_TITLE'));
             break;
         default:
             break;
     }
     // Define component path
     define('JPATH_COMPONENT', JPATH_BASE);
     define('JPATH_COMPONENT_SITE', JPATH_SITE);
     define('JPATH_COMPONENT_ADMINISTRATOR', JPATH_ADMINISTRATOR);
     // Start the output buffer.
     ob_start();
     // Import the controller.
     require_once JPATH_COMPONENT . '/controller.php';
     // Execute the task.
     $controller = JControllerLegacy::getInstance('JInstallation');
     $controller->execute(JRequest::getVar('task'));
     $controller->redirect();
     // Get output from the buffer and clean it.
     $contents = ob_get_contents();
     ob_end_clean();
     $file = JRequest::getCmd('tmpl', 'index');
     $params = array('template' => 'template', 'file' => $file . '.php', 'directory' => JPATH_THEMES, 'params' => '{}');
     $document->setBuffer($contents, 'installation');
     $document->setTitle(JText::_('INSTL_PAGE_TITLE'));
     $data = $document->render(false, $params);
     JResponse::setBody($data);
     if (JFactory::getConfig()->get('debug_lang')) {
         $this->debugLanguage();
     }
 }
开发者ID:brojask,项目名称:colegio-abogados-joomla,代码行数:43,代码来源:application.php

示例11: __construct

 public function __construct()
 {
     if (!php_Boot::$skip_constructor) {
         $GLOBALS['%s']->push("MainAdmin::new");
         $__hx__spos = $GLOBALS['%s']->length;
         defined('_JEXEC') or die('no joomla here');
         $gc = JControllerLegacy::getInstance('Joomlahaxe');
         try {
             $gc->execute(JRequest::getCmd('task'));
         } catch (Exception $__hx__e) {
             $_ex_ = $__hx__e instanceof HException ? $__hx__e->e : $__hx__e;
             $e = $_ex_;
             $GLOBALS['%e'] = new _hx_array(array());
             while ($GLOBALS['%s']->length >= $__hx__spos) {
                 $GLOBALS['%e']->unshift($GLOBALS['%s']->pop());
             }
             $GLOBALS['%s']->push($GLOBALS['%e'][0]);
             php_Lib::hprint($e);
         }
         $gc->redirect();
         $GLOBALS['%s']->pop();
     }
 }
开发者ID:ConfidantCommunications,项目名称:JoomlaHaxe,代码行数:23,代码来源:MainAdmin.class.php

示例12: defined

<?php

/**
 * @package     Joomla.Administrator
 * @subpackage  com_cpanel
 *
 * @copyright   Copyright (C) 2005 - 2014 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */
defined('_JEXEC') or die;
// No access check.
$controller = JControllerLegacy::getInstance('Cpanel');
$controller->execute(JFactory::getApplication()->input->get('task'));
$controller->redirect();
开发者ID:01J,项目名称:skazkipronebo,代码行数:14,代码来源:cpanel.php

示例13: defined

<?php

// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// Get an instance of the controller prefixed by SoleilBlog
$controller = JControllerLegacy::getInstance('SoleilBlog');
// Perform the Request task
$controller->execute(JFactory::getApplication()->input->get('task'));
// Redirect if set by the controller
$controller->redirect();
开发者ID:seed880505,项目名称:v2.soleilsplendide.com,代码行数:10,代码来源:soleilblog.php

示例14: defined

<?php

/**
 * @package		Joomla.Administrator
 * @subpackage	com_menus
 * @copyright	Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
 * @license		GNU General Public License version 2 or later; see LICENSE.txt
 */
defined('_JEXEC') or die;
// Access check.
if (!JFactory::getUser()->authorise('core.manage', 'com_menus')) {
    return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'));
}
// Execute the task.
$controller = JControllerLegacy::getInstance('Menus');
$controller->execute(JRequest::getCmd('task'));
$controller->redirect();
开发者ID:christianesperar,项目名称:joomla-example,代码行数:17,代码来源:menus.php

示例15: defined

<?php

// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// Set some global property
$document = JFactory::getDocument();
// import joomla controller library
jimport('joomla.application.component.controller');
// Get an instance of the controller prefixed by AdvancedOpenPortal
$controller = JControllerLegacy::getInstance('AdvancedOpenPortal');
// Perform the Request task
$controller->execute(JRequest::getCmd('task'));
// Redirect if set by the controller
$controller->redirect();
开发者ID:salesagility,项目名称:SuiteCRM-Portal-Joomla,代码行数:14,代码来源:advancedopenportal.php


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