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


PHP JRequest::getMethod方法代码示例

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


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

示例1: onAfterRoute

    public function onAfterRoute()
    {
        $application = JFactory::getApplication();

        if($application->isSite())
        {
            switch(JRequest::getVar('option', null, 'method', 'cmd'))
            {
                case 'com_user':
                    JRequest::setVar('option', 'com_users', 'get');

                    switch(JRequest::getVar('view', null, 'method', 'cmd'))
                    {
                        case 'login':
                            if(!JFactory::getUser()->guest) {
                                JRequest::setVar('view', 'logout', 'get');
                            }

                            break;

                        case 'remind':
                            JRequest::setVar('view', 'remind', 'get');

                            break;

                        case 'register':
                            JRequest::setVar('view', 'user', 'get');
                            JRequest::setVar('layout', 'register', 'get');

                            break;

                        case 'user':
                            if(JRequest::getVar('task', null, 'get', 'cmd') == 'edit') {
                                JRequest::setVar('layout', 'form', 'get');
                            }
                    }

                    switch(JRequest::getVar('task', null, 'method', 'cmd'))
                    {
                        case 'login':
                            JRequest::setVar('view', 'login', 'get');
                            JRequest::setVar('action', 'login', 'post');
                            JRequest::setVar('password', JRequest::getVar('passwd', null, 'method', 'none'), 'post');

                            break;
                    }

                    break;
            }

            if(JRequest::getMethod() == 'POST')
            {
                $token = JUtility::getToken();

                if(JRequest::getVar($token, null, 'post', 'alnum') == 1) {
                    JRequest::setVar('_token', $token, 'post');
                }
            }
        }
    }
开发者ID:raeldc,项目名称:com_learn,代码行数:60,代码来源:legacy.php

示例2: getInstance

 public static function getInstance($name)
 {
     if (isset(self::$instances[$name])) {
         return self::$instances[$name];
     }
     $plugin = JPluginHelper::getPlugin('api', $name);
     if (empty($plugin)) {
         throw new Exception(JText::_('COM_API_PLUGIN_CLASS_NOT_FOUND'), 400);
     }
     jimport('joomla.filesystem.file');
     $plgfile = JPATH_BASE . self::$plg_path . $name . DS . $name . '.php';
     $param_path = JPATH_BASE . self::$plg_path . $name . DS . $name . '.xml';
     if (!JFile::exists($plgfile)) {
         throw new Exception(JText::_('COM_API_FILE_NOT_FOUND'), 400);
     }
     include $plgfile;
     $class = self::$plg_prefix . ucwords($name);
     if (!class_exists($class)) {
         throw new Exception(JText::_('COM_API_PLUGIN_CLASS_NOT_FOUND'), 400);
     }
     $handler = new $class();
     $cparams = JComponentHelper::getParams('com_api');
     $params = new JRegistry();
     $params->loadString($plugin->params);
     $cparams->merge($params);
     $handler->set('params', $cparams);
     $handler->set('component', JRequest::getCmd('app'));
     $handler->set('resource', JRequest::getCmd('resource'));
     $handler->set('format', $handler->negotiateContent(JRequest::getCmd('output', null)));
     $handler->set('request_method', JRequest::getMethod());
     self::$instances[$name] = $handler;
     return self::$instances[$name];
 }
开发者ID:rcorral,项目名称:com_api,代码行数:33,代码来源:plugin.php

示例3: testGetMethod

	function testGetMethod()
	{
		$_SERVER['REQUEST_METHOD'] = 'post';
		$this -> assertEquals('POST', JRequest::getMethod());
		$_SERVER['REQUEST_METHOD'] = 'get';
		$this -> assertEquals('GET', JRequest::getMethod());
	}
开发者ID:realityking,项目名称:JAJAX,代码行数:7,代码来源:JRequestGetmethodTest.php

示例4: getInstance

 public static function getInstance($name)
 {
     if (isset(self::$instances[$name])) {
         return self::$instances[$name];
     }
     $plugin = JPluginHelper::getPlugin('api', $name);
     if (empty($plugin)) {
         ApiError::raiseError(400, JText::_('COM_API_PLUGIN_CLASS_NOT_FOUND'));
     }
     jimport('joomla.filesystem.file');
     $plgfile = JPATH_BASE . self::$plg_path . $name . '.php';
     $param_path = JPATH_BASE . self::$plg_path . $name . '.xml';
     if (!JFile::exists($plgfile)) {
         ApiError::raiseError(400, JText::_('COM_API_FILE_NOT_FOUND'));
     }
     include_once $plgfile;
     $class = self::$plg_prefix . ucwords($name);
     if (!class_exists($class)) {
         ApiError::raiseError(400, JText::_('COM_API_PLUGIN_CLASS_NOT_FOUND'));
     }
     $handler = new $class();
     $cparams = JComponentHelper::getParams('com_api');
     $params = new JParameter($plugin->params, $param_path);
     $cparams->merge($params);
     $handler->set('params', $cparams);
     $handler->set('component', JRequest::getCmd('app'));
     $handler->set('resource', JRequest::getCmd('resource'));
     $handler->set('format', JRequest::getCmd('output'));
     $handler->set('request_method', JRequest::getMethod());
     self::$instances[$name] = $handler;
     return self::$instances[$name];
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:32,代码来源:plugin.php

示例5: display

 public function display($tpl = null)
 {
     $id = JRequest::getInt('id', 0);
     $badge = DiscussHelper::getTable('Badges');
     $badge->load($id);
     if (!$badge->created) {
         $date = DiscussHelper::getHelper('Date')->dateWithOffset(DiscussHelper::getDate()->toMySQL());
         $badge->created = $date->toMySQL();
     }
     // There could be some errors here.
     if (JRequest::getMethod() == 'POST') {
         $badge->bind(JRequest::get('post'));
         // Description might contain html codes
         $description = JRequest::getVar('description', '', 'post', 'string', JREQUEST_ALLOWRAW);
         $badge->description = $description;
     }
     $jConfig = DiscussHelper::getJConfig();
     $editor = JFactory::getEditor($jConfig->get('editor'));
     $model = $this->getModel('Badges');
     $rules = $model->getRules();
     $badges = $this->getBadges();
     $this->assign('editor', $editor);
     $this->assign('badges', $badges);
     $this->assign('rules', $rules);
     $this->assign('badge', $badge);
     parent::display($tpl);
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:27,代码来源:view.html.php

示例6: doSave

 private function doSave()
 {
     // Check for request forgeries
     JRequest::checkToken() or jexit('Invalid Token');
     $mainframe = JFactory::getApplication();
     if (!JRequest::getMethod() == 'POST') {
         $mainframe->enqueueMessage(JText::_('COM_KOMENTO_ACL_STORE_INVALID_REQUEST', 'error'));
         return false;
     }
     // Unset unecessary post data.
     $post = JRequest::get('POST');
     unset($post['task']);
     unset($post['option']);
     unset($post['c']);
     $token = Komento::_('getToken');
     unset($post[$token]);
     // check the target component
     if (!$post['target_component']) {
         $mainframe->enqueueMessage(JText::_('COM_KOMENTO_ACL_MISSING_TARGET_COMPONENT'));
         return false;
     }
     // rememeber user's choice
     // $mainframe->setUserState('com_komento.acl.component', $post['target_component']);
     // Save post data
     $model = Komento::getModel('Acl', true);
     if (!$model->save($post)) {
         $mainframe->enqueueMessage(JText::_('COM_KOMENTO_ACL_STORE_ERROR', 'error'));
         return false;
     }
     $mainframe->enqueueMessage(JText::_('COM_KOMENTO_ACL_STORE_SUCCESS', 'message'));
     // Clear the component's cache
     $cache = JFactory::getCache('com_komento');
     $cache->clean();
     return true;
 }
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:35,代码来源:acl.php

示例7: save

 function save()
 {
     // Check for request forgeries
     JRequest::checkToken() or jexit('Invalid Token');
     // @task: Check for acl rules.
     $this->checkAccess('trackback');
     $mainframe = JFactory::getApplication();
     $message = '';
     $type = 'message';
     if (JRequest::getMethod() != 'POST') {
         $mainframe->redirect('index.php?option=com_easyblog&view=trackbacks', JText::_('COM_EASYBLOG_TRACKBACKS_INVALID_REQUEST'), 'error');
         $mainframe->close();
     }
     $post = JRequest::get('POST');
     $my = JFactory::getUser();
     $id = JRequest::getInt('id', 0);
     JTable::addIncludePath(EBLOG_TABLES);
     $trackback = EasyBlogHelper::getTable('Trackback', 'Table');
     $trackback->load($id);
     $trackback->bind($post);
     if (!$trackback->store()) {
         $mainframe->redirect('index.php?option=com_easyblog&view=trackbacks', JText::_('COM_EASYBLOG_TRACKBACKS_SAVE_ERROR'), 'error');
         $mainframe->close();
     }
     $mainframe->redirect('index.php?option=com_easyblog&view=trackbacks', JText::_('COM_EASYBLOG_TRACKBACKS_SAVE_SUCCESS'));
     $mainframe->close();
 }
开发者ID:alexinteam,项目名称:joomla3,代码行数:27,代码来源:trackback.php

示例8: onAfterInitialise

 /**
  * Helper method to handle event onAfterInitialise
  *
  * @return void
  */
 public static function onAfterInitialise()
 {
     $isAjax = !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest';
     if ($isAjax) {
         return;
     }
     // Handle global form post
     if (JRequest::getMethod() == 'POST') {
         self::handlePostRequest();
     } else {
         self::handleGetRequest();
     }
 }
开发者ID:akilajwasala,项目名称:BuffetCorner,代码行数:18,代码来源:history.php

示例9: _store

 private function _store()
 {
     $mainframe = JFactory::getApplication();
     $message = '';
     $type = 'success';
     if (JRequest::getMethod() == 'POST') {
         $model = $this->getModel('Settings');
         $postArray = JRequest::get('post');
         $saveData = array();
         // Unset unecessary data.
         unset($postArray['controller']);
         unset($postArray['active']);
         unset($postArray['child']);
         unset($postArray['layout']);
         unset($postArray['task']);
         unset($postArray['option']);
         unset($postArray['c']);
         $token = DiscussHelper::getToken();
         unset($postArray[$token]);
         foreach ($postArray as $index => $value) {
             // Filter out the dummy checkbox_display_xxx entry
             if (substr($index, 0, 17) == 'checkbox_display_') {
                 continue;
             }
             if ($index == 'integration_google_adsense_code') {
                 $value = str_ireplace(';"', ';', $value);
             }
             if ($index != 'task') {
             }
             $saveData[$index] = $value;
             if (is_array($value)) {
                 $saveData[$index] = implode(',', $value);
             }
         }
         // reset the setting 'main_allowdelete' to use from configuration.ini
         $saveData['main_allowdelete'] = DiscussHelper::getDefaultConfigValue('main_allowdelete', '');
         // reset the setting 'layout_featuredpost_style' to always use from configuration.ini
         $saveData['layout_featuredpost_style'] = DiscussHelper::getDefaultConfigValue('layout_featuredpost_style', '0');
         if ($model->save($saveData)) {
             $message = JText::_('COM_EASYDISCUSS_CONFIGURATION_SAVED');
         } else {
             $message = JText::_('COM_EASYDISCUSS_CONFIGURATION_SAVE_ERROR');
             $type = 'error';
         }
     } else {
         $message = JText::_('COM_EASYDISCUSS_INVALID_FORM_METHOD');
         $type = 'error';
     }
     return array('message' => $message, 'type' => $type);
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:50,代码来源:settings.php

示例10: _store

 function _store()
 {
     // Check for request forgeries
     JRequest::checkToken() or jexit('Invalid Token');
     $mainframe = JFactory::getApplication();
     $message = '';
     $type = 'success';
     if (JRequest::getMethod() == 'POST') {
         $cid = JRequest::getVar('cid', null, 'POST');
         $acltype = JRequest::getVar('type', '', 'POST');
         $name = JRequest::getVar('name', '', 'POST');
         if (!is_null($cid) || !empty($acltype)) {
             $model = $this->getModel('Acl');
             $db = DiscussHelper::getDBO();
             if ($model->deleteRuleset($cid, $acltype)) {
                 $postArray = JRequest::get('post');
                 $saveData = array();
                 // Unset unecessary data.
                 unset($postArray['task']);
                 unset($postArray['option']);
                 unset($postArray['c']);
                 unset($postArray['cid']);
                 unset($postArray['name']);
                 unset($postArray['type']);
                 foreach ($postArray as $index => $value) {
                     if ($index != 'task') {
                     }
                     $saveData[$index] = $value;
                 }
                 if ($model->insertRuleset($cid, $acltype, $saveData)) {
                     $message = JText::_('ACL settings successfully saved.');
                 } else {
                     $message = JText::_('There was an error while trying to save the ACL settings.');
                     $type = 'error';
                 }
             } else {
                 $message = JText::_('There was an error while trying to update the ACL.');
                 $type = 'error';
             }
         } else {
             $message = JText::_('Invalid ID or ACL type, please try again.');
             $type = 'error';
         }
     } else {
         $message = JText::_('Invalid request method. This form needs to be submitted through a "POST" request.');
         $type = 'error';
     }
     return array('message' => $message, 'type' => $type);
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:49,代码来源:acl.php

示例11: onAfterRoute

 function onAfterRoute()
 {
     $app = JFactory::getApplication();
     // Temporary hack until it is possible to get Joomla to add PUT, DELETE support
     if ($app->isSite() && in_array(JRequest::getMethod(), array('PUT', 'DELETE'))) {
         $putdata = $this->getPutParameters(file_get_contents('php://input'));
         $putdata['format'] = 'raw';
         if (isset($putdata['option']) && 'com_api' == $putdata['option']) {
             $_REQUEST = array_merge($_REQUEST, $putdata);
             $_POST = array_merge($_POST, $putdata);
         }
     }
     if ('com_api' == JRequest::getVar('option') && $app->isSite()) {
         JRequest::setVar('format', 'raw');
     }
 }
开发者ID:rcorral,项目名称:com_api,代码行数:16,代码来源:api.php

示例12: save

 /**
  * Method to save the configuration
  **/
 function save()
 {
     // Test if this is really a post request
     $method = JRequest::getMethod();
     if ($method == 'GET') {
         JError::raiseError(500, JText::_('CC ACCESS METHOD NOT ALLOWED'));
         return;
     }
     $mainframe =& JFactory::getApplication();
     $model =& $this->getModel('Network');
     // Try to save network configurations
     if ($model->save()) {
         $message = JText::_('CC NETWORK CONFIGURATION UPDATED');
         $mainframe->redirect('index.php?option=com_community&view=network', $message);
     } else {
         JError::raiseWarning(100, JText::_('CC UNABLE TO SAVE NETWORK CONFIGURATION INTO DATABASE PLEASE ENSURE THAT THE TABLE JOS_COMMUNITY_CONFIG EXISTS'));
     }
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:21,代码来源:network.php

示例13: save

 /**
  * Method to save the configuration
  **/
 public function save()
 {
     // Test if this is really a post request
     $method = JRequest::getMethod();
     if ($method == 'GET') {
         JError::raiseError(500, JText::_('COM_COMMUNITY_ACCESS_NOT_ALLOWED'));
         return;
     }
     $mainframe =& JFactory::getApplication();
     $model =& $this->getModel('Network');
     // Try to save network configurations
     if ($model->save()) {
         $message = JText::_('COM_COMMUNITY_NETWORK_CONFIGURATION_UPDATED');
         $mainframe->redirect('index.php?option=com_community&view=network', $message);
     } else {
         JError::raiseWarning(100, JText::_('COM_COMMUNITY_CONFIGURATION_NETWORK_SAVE_FAIL'));
     }
 }
开发者ID:Simarpreet05,项目名称:joomla,代码行数:21,代码来源:network.php

示例14: _store

 function _store()
 {
     $mainframe = JFactory::getApplication();
     $message = '';
     $type = 'message';
     if (JRequest::getMethod() == 'POST') {
         $model = $this->getModel('Settings');
         $post = JRequest::get('post');
         $postArray = JRequest::get('post');
         $saveData = array();
         $layout = $postArray['layout'];
         $step = $postArray['step'];
         // Unset unecessary data.
         unset($postArray['task']);
         unset($postArray['option']);
         unset($postArray['layout']);
         unset($postArray['controller']);
         unset($postArray['step']);
         if (!isset($postArray['main_autopost_' . $layout . '_page_id'])) {
             $postArray['main_autopost_' . $layout . '_page_id'] = '';
         }
         if (empty($postArray)) {
             // Nothing else to be configured. Assuming that this is the final step.
             return array('message' => JText::sprintf('COM_EASYDISCUSS_AUTOPOST_LINKED_SUCCESSFULLY', ucfirst($layout)), 'type' => 'completed');
         }
         foreach ($postArray as $index => $value) {
             $saveData[$index] = $value;
         }
         if ($model->save($saveData)) {
             $message = JText::_('COM_EASYDISCUSS_CONFIGURATION_SAVED');
             if ($step == 2 || $step == 'completed') {
                 return array('message' => JText::sprintf('COM_EASYDISCUSS_AUTOPOST_SETTING_SAVED_SUCCESSFULLY', ucfirst($layout)), 'type' => 'completed');
             }
         } else {
             $message = JText::_('COM_EASYDISCUSS_CONFIGURATION_SAVE_ERROR');
             $type = 'error';
         }
     } else {
         $message = JText::_('COM_EASYDISCUSS_INVALID_FORM_METHOD');
         $type = 'error';
     }
     return array('message' => $message, 'type' => $type);
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:43,代码来源:autoposting.php

示例15: unbind

 /**
  * Unbind the subscriber from the list
  *
  * @return void
  * @since 1.0
  */
 public function unbind()
 {
     if (JRequest::getMethod() == "POST") {
         try {
             $sid = JRequest::getInt('subscriber_id', null, 'post');
             $lid = JRequest::getInt('list_to_unbind', null, 'post');
             $model = JModel::getInstance('Subscriber', 'NewsletterModelEntity');
             if (!$model->load($sid)) {
                 throw new Exception();
             }
             if (!$model->unbindFromList($lid)) {
                 throw new Exception();
             }
             $this->setMessage(JText::_("COM_NEWSLETTER_UNBIND_SUCCESS"));
         } catch (Exception $e) {
             $this->setMessage(JText::_("COM_NEWSLETTER_UNBIND_FAILED"), 'error');
         }
     }
     $this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_item . $this->getRedirectToItemAppend($sid, 'subscriber_id'), false));
 }
开发者ID:Rikisha,项目名称:proj,代码行数:26,代码来源:subscriber.php


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