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


PHP KRequest::format方法代码示例

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


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

示例1: _actionForward

 /**
  * Overloaded to comply with FancyUpload.
  * It doesn't let us pass AJAX headers so this is needed.
  */
 public function _actionForward(KCommandContext $context)
 {
     if (KRequest::type() == 'FLASH' || KRequest::format() == 'json') {
         $context->result = $this->getController()->execute('display', $context);
     } else {
         parent::_actionForward($context);
     }
     return $context->result;
 }
开发者ID:raeldc,项目名称:nooku-server,代码行数:13,代码来源:dispatcher.php

示例2: _initialize

    /**
     * Initializes the options for the object
     *
     * Called from {@link __construct()} as a first step of object instantiation.
     *
     * @param 	object 	An optional KConfig object with configuration options.
     * @return 	void
     */
    protected function _initialize(KConfig $config)
    {
    	$config->append(array(
        	'controller'			=> $this->_identifier->package,
    		'request'				=> KRequest::get('get', 'string'),
        ))->append(array(
            'request' 				=> array('format' => KRequest::format() ? KRequest::format() : 'html')
        ));

        parent::_initialize($config);
    }
开发者ID:raeldc,项目名称:com_learn,代码行数:19,代码来源:abstract.php

示例3: onAfterRender

 public function onAfterRender()
 {
     $application = JFactory::getApplication();
     $format = KRequest::format();
     // If the format is NULL, nooku defaults back to html, so there is a separate check for html and raw.
     if (is_null($format) || $format == 'html' || $format == 'raw') {
         if ($application->isSite()) {
             $body = JResponse::getBody();
             while (preg_match($this->params->regex_link, $body, $regs, PREG_OFFSET_CAPTURE)) {
                 $mail = str_replace('&', '&', $regs[2][0]);
                 $protected = $this->_protectEmail($mail, $regs[5][0], $regs[1][0], $regs[4][0]);
                 $body = substr_replace($body, $protected, $regs[0][1], strlen($regs[0][0]));
             }
             while (preg_match($this->params->regex, $body, $regs, PREG_OFFSET_CAPTURE)) {
                 $protected = $this->_protectEmail('', $regs[1][0]);
                 $body = substr_replace($body, $protected, $regs[1][1], strlen($regs[1][0]));
             }
             JResponse::setBody($body);
         }
     }
 }
开发者ID:kedweber,项目名称:plg_email_cloaking,代码行数:21,代码来源:cloak.php

示例4: setView

 /**
  * Method to set a view object attached to the controller
  *
  * @param	mixed	An object that implements KObjectServiceable, KServiceIdentifier object 
  * 					or valid identifier string
  * @throws	KDatabaseRowsetException	If the identifier is not a view identifier
  * @return	KControllerAbstract
  */
 public function setView($view)
 {
     if (!$view instanceof KViewAbstract) {
         if (is_string($view) && strpos($view, '.') === false) {
             $identifier = clone $this->getIdentifier();
             $identifier->path = array('view', $view);
             $identifier->name = KRequest::format() ? KRequest::format() : 'html';
         } else {
             $identifier = $this->getIdentifier($view);
         }
         if ($identifier->path[0] != 'view') {
             throw new KTemplateException('Identifier: ' . $identifier . ' is not a view identifier');
         }
         $view = $identifier;
     }
     $this->_view = $view;
     return $this;
 }
开发者ID:JSWebdesign,项目名称:intranet-platform,代码行数:26,代码来源:abstract.php

示例5: onAfterInitialise

 /**
  * Remebers handling.
  */
 public function onAfterInitialise()
 {
     global $mainframe;
     $viewer = get_viewer();
     if (!$viewer->guest() && !$viewer->enabled) {
         KService::get('com://site/people.helper.person')->logout();
     }
     // No remember me for admin
     if ($mainframe->isAdmin()) {
         return;
     }
     jimport('joomla.utilities.utility');
     jimport('joomla.utilities.simplecrypt');
     $user = array();
     $remember = JUtility::getHash('JLOGIN_REMEMBER');
     // for json requests obtain the username and password from the $_SERVER array
     // else if the remember me cookie exists, decrypt and obtain the username and password from it
     if ($viewer->guest() && KRequest::has('server.PHP_AUTH_USER') && KRequest::has('server.PHP_AUTH_PW') && KRequest::format() == 'json') {
         $user['username'] = KRequest::get('server.PHP_AUTH_USER', 'raw');
         $user['password'] = KRequest::get('server.PHP_AUTH_PW', 'raw');
     } elseif ($viewer->guest() && isset($_COOKIE[$remember]) && $_COOKIE[$remember] != '') {
         $key = JUtility::getHash(KRequest::get('server.HTTP_USER_AGENT', 'raw'));
         if ($key) {
             $crypt = new JSimpleCrypt($key);
             $cookie = $crypt->decrypt($_COOKIE[$remember]);
             $user = (array) @unserialize($cookie);
         }
     } else {
         return;
     }
     if ($viewer->guest() && count($user)) {
         try {
             jimport('joomla.user.authentication');
             $authentication =& JAuthentication::getInstance();
             $authResponse = $authentication->authenticate($user, array());
             if ($authResponse->status == JAUTHENTICATE_STATUS_SUCCESS) {
                 KService::get('com://site/people.helper.person')->login($user, true);
             }
         } catch (RuntimeException $e) {
             //only throws exception if we are using JSON format
             //otherwise let the current app handle it
             if (KRequest::format() == 'json') {
                 throw $e;
             }
         }
     }
     return;
 }
开发者ID:stonyyi,项目名称:anahita,代码行数:51,代码来源:anahita.php

示例6: onAfterRoute

 /**
  * On after route event handler
  *
  * @return void
  */
 public function onAfterRoute()
 {
     /*
      * Special handling for AJAX requests
      *
      * If the format is AJAX and the format is 'html' or the tmpl is empty we re-create
      * a 'raw' document rendered and force it's type to the active format
      */
     if (KRequest::type() == 'AJAX') {
         if (KRequest::get('get.format', 'cmd', 'html') != 'html' || KRequest::get('get.tmpl', 'cmd') === '') {
             $format = JRequest::getWord('format', 'html');
             JRequest::setVar('format', 'raw');
             //force format to raw
             @($document =& JFactory::getDocument());
             $document = null;
             JFactory::getDocument()->setType($format);
             JRequest::setVar('format', $format);
             //revert format to original
         }
     }
     //Set the request format
     if (!KRequest::has('request.format')) {
         KRequest::set('request.format', KRequest::format());
     }
 }
开发者ID:janssit,项目名称:www.marlinfishingcanaria.com,代码行数:30,代码来源:koowa.php

示例7: getView

 /**
  * Get the identifier for the view with the same name
  *
  * @return	KIdentifierInterface
  */
 public function getView()
 {
     if (!$this->_view) {
         if (!isset($this->_request->view)) {
             $name = $this->_identifier->name;
             if ($this->getModel()->getState()->isUnique()) {
                 $this->_request->view = $name;
             } else {
                 $this->_request->view = KInflector::pluralize($name);
             }
         }
         $identifier = clone $this->_identifier;
         $identifier->path = array('view', $this->_request->view);
         $identifier->name = KRequest::format() ? KRequest::format() : 'html';
         $config = array('auto_filter' => $this->isDispatched());
         $this->_view = KFactory::get($identifier, $config);
     }
     return $this->_view;
 }
开发者ID:ravenlife,项目名称:Ninja-Framework,代码行数:24,代码来源:view.php

示例8: _initialize

 /**
  * Initializes the default configuration for the object.
  *
  * Called from {@link __construct()} as a first step of object instantiation.
  *
  * @param KConfig $config An optional KConfig object with configuration options.
  */
 protected function _initialize(KConfig $config)
 {
     $config->append(array('enabled' => KRequest::format() == 'html' && $config->mixer->isDispatched()));
     parent::_initialize($config);
 }
开发者ID:stonyyi,项目名称:anahita,代码行数:12,代码来源:message.php

示例9: _fixUrlForParsing

 /**
  * Fixes the url path
  * 
  * @param KHttpUrl $url
  * 
  * @return void
  */
 protected function _fixUrlForParsing($url)
 {
     $path = $url->path;
     //bug in request
     if ($url->format == 'php') {
         $path .= '.php';
         $url->format = null;
     }
     $path = substr_replace($path, '', 0, strlen($this->_base_url->path));
     $path = preg_replace('/index\\/?.php/', '', $path);
     $path = trim($path, '/');
     $url->path = $path;
     $url->format = $url->format ? $url->format : pick(KRequest::format(), 'html');
     if (!empty($url->format)) {
         $url->query['format'] = $url->format;
     }
 }
开发者ID:walteraries,项目名称:anahita,代码行数:24,代码来源:router.php


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