本文整理汇总了PHP中KRequest::has方法的典型用法代码示例。如果您正苦于以下问题:PHP KRequest::has方法的具体用法?PHP KRequest::has怎么用?PHP KRequest::has使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KRequest
的用法示例。
在下文中一共展示了KRequest::has方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: id
/**
* Helper for creating DOM element ids used by javascript behaviors
*
* If no type and package identifiers were supplied,
* uses the current option $_GET variable, and changing com_foo_bar to com-foo_bar.
* '-' are used as separators, and in our javascript used to parse identifier strings.
* If a form got the id com-foo_bar-people,
* then we can assume that the toolbar will have the id toolbar-people,
*
* @author Stian Didriksen <stian@ninjaforge.com>
* @param array | int $parts
* @return string
*/
public function id($parts = array())
{
if (!is_array($parts) && is_int($parts)) {
$parts['id'] = (int) $parts;
}
// If we pass a string, set $parts back as an array in order to proceed.
if (!is_array($parts)) {
settype($parts, 'array');
}
// Set the defaults, if needed
$defaults = array();
if (!isset($parts['type.package'])) {
// We only want to replace the first underscore, not the rest.
$defaults['type_package'] = str_replace('com_', 'com-', KRequest::get('get.option', 'cmd'));
}
if (!isset($parts['view'])) {
$view = KRequest::get('get.view', 'cmd');
// The view part always needs to be plural to allow ajax BREAD.
if (KInflector::isSingular($view)) {
$view = KInflector::pluralize($view);
}
$defaults['view'] = $view;
}
if (!isset($parts['id']) && KRequest::has('get.id', 'int')) {
$defaults['id'] = KRequest::get('get.id', 'int');
}
// Filter away parts that are unset on purpose using a null value, or a negative boolean.
return implode('-', array_filter(array_merge($defaults, $parts)));
}
示例2: addFile
public function addFile(KCommandContext $context)
{
if (empty($context->data->file) && KRequest::has('files.file.tmp_name')) {
$context->data->file = KRequest::get('files.file.tmp_name', 'raw');
if (empty($context->data->name)) {
$context->data->name = KRequest::get('files.file.name', 'raw');
}
}
}
示例3: __construct
/**
* Constructor
*
* @param object An optional KConfig object with configuration options
*/
public function __construct(KConfig $options)
{
parent::__construct($options);
$this->registerCallback('before.add', array($this, 'setTitle'))->registerCallback('before.edit', array($this, 'setTitle'))->registerCallback('after.add', array($this, 'setPermissions'))->registerCallback('after.edit', array($this, 'setPermissions'));
$showReminder = KFactory::get('admin::com.ninja.helper.default')->formid('show-reminder');
if (!KRequest::has('cookie.' . $showReminder) && $this->getModel()->getTotal() > 0) {
$this->registerCallback('after.browse', array($this, 'showReminder'));
}
}
示例4: fetchElement
public function fetchElement($name, $value, &$node, $control_name)
{
$key = (string) $node['key'];
$request = isset($node['request']) ? $node['request'] : $key;
//@TODO make the following optional
$current = KRequest::has('get.id') ? '&' . KRequest::get('get.view', 'cmd') . '=' . KRequest::get('get.id', 'int') : false;
//@TODO make this an reusabe MooTools class
KFactory::get('admin::com.ninja.helper.default')->js("\n\t\t\twindow.addEvent('domready', function(){\n\t\t\t\tvar input = \$('" . $this->id . "'), load = new URI(" . json_encode(JRoute::_((string) $node['load'] . $current, false)) . "), runway = new Element('div', {text: load}).set('load', {onSuccess: function(){window.fireEvent('domupdate')}}), fieldset = input.getParent('fieldset');\n\t\t\t\tif(input) {\n\t\t\t\t\tfieldset.grab(runway, 'after');\n\t\t\t\t\t\n\t\t\t\t\tinput.addEvent('change', function(){\n\t\t\t\t\t\trunway.empty().load(load.setData({" . $key . ": this.value}, true).toString());\n\t\t\t\t\t}).fireEvent('change');\n\t\t\t\t}\n\t\t\t});\n\t\t");
return parent::fetchElement($name, $value, $node, $control_name);
}
示例5: _actionDispatch
/**
* Dispatch the controller and redirect
*
* This function divert the standard behavior and will redirect if no view
* information can be found in the request.
*
* @param string The view to dispatch. If null, it will default to
* retrieve the controller information from the request or
* default to the component name if no controller info can
* be found.
*
* @return KDispatcherDefault
*/
protected function _actionDispatch(KCommandContext $context)
{
//Redirect if no view information can be found in the request
if (!KRequest::has('get.view')) {
$url = clone KRequest::url();
$url->query['view'] = $this->getController()->getView()->getName();
JFactory::getApplication()->redirect($url);
}
return parent::_actionDispatch($context);
}
示例6: _actionDispatch
/**
* Dispatch the controller and redirect
*
* This function divert the standard behavior and will redirect if no view
* information can be found in the request.
*
* @param string The view to dispatch. If null, it will default to
* retrieve the controller information from the request or
* default to the component name if no controller info can
* be found.
*
* @return KDispatcherDefault
*/
protected function _actionDispatch(KCommandContext $context)
{
//Redirect if no view information can be found in the request
if (!KRequest::has('get.view')) {
$view = count($context->data) ? $context->data : $this->_controller_default;
$url = clone KRequest::url();
$url->query['view'] = $view;
KFactory::get('lib.joomla.application')->redirect($url);
}
return parent::_actionDispatch($context);
}
示例7: _actionDispatch
/**
* Dispatch the controller and redirect
*
* This function divert the standard behavior and will redirect if no view
* information can be found in the request.
*
* @param string The view to dispatch. If null, it will default to
* retrieve the controller information from the request or
* default to the component name if no controller info can
* be found.
*
* @return KDispatcherDefault
*/
protected function _actionDispatch(KCommandContext $context)
{
//Redirect if no view information can be found in the request
if (!KRequest::has('get.view')) {
$package = $this->getIdentifier()->package;
$view = $this->getController()->getView()->getName();
$route = JRoute::_('index.php?option=com_' . $package . '&view=' . $view, false);
JFactory::getApplication()->redirect($route);
}
return parent::_actionDispatch($context);
}
示例8: _actionDispatch
protected function _actionDispatch(KCommandContext $context)
{
if (KRequest::method() == KHttpRequest::GET) {
$view = KRequest::get('get.view', 'cmd', $this->_controller);
if ($view == 'modules' && !KRequest::has('get.application')) {
$url = clone KRequest::url();
$url->query['application'] = 'site';
JFactory::getApplication()->redirect($url);
}
}
return parent::_actionDispatch($context);
}
示例9: _actionRender
/**
* Draw the toolbar
*
* @param KCommandContext $context The command context
*
* @return string
*/
protected function _actionRender(KCommandContext $context)
{
if ($context->result !== false) {
$view = $this->getController()->getView();
//Set the document mimetype
JFactory::getDocument()->setMimeEncoding($view->mimetype);
//Disabled the application menubar
if (!KInflector::isPlural($view->getName()) && !KRequest::has('get.hidemainmenu')) {
KRequest::set('get.hidemainmenu', 1);
}
}
return parent::_actionRender($context);
}
示例10: display
/**
* Renders and echo's the views output wrapping it in a js callback if present
*
* @return string JSON data
*/
public function display()
{
if (!KRequest::has('get.callback')) {
return parent::display();
}
$callback = KRequest::get('get.callback', 'cmd');
$json = $callback . '(';
$json .= parent::display();
//Set the correct mime type
$this->_document->setMimeEncoding('application/javascript');
$json .= ');';
return $json;
}
示例11: _actionDispatch
/**
* Dispatch the controller and redirect
*
* This function divert the standard behavior and will redirect if no view
* information can be found in the request.
*
* @param string The view to dispatch. If null, it will default to
* retrieve the controller information from the request or
* default to the component name if no controller info can
* be found.
*
* @return KDispatcherDefault
*/
protected function _actionDispatch(KCommandContext $context)
{
//Redirect if no view information can be found in the request
if(!KRequest::has('get.view'))
{
$url = clone(KRequest::url());
$url->query['option'] = 'com_'.$this->getIdentifier()->package;
$url->query['view'] = $this->getController()->getView()->getName();
KFactory::get('joomla:application')->redirect($url);
}
return parent::_actionDispatch($context);
}
示例12: getRequest
public function getRequest()
{
$request = parent::getRequest();
if (KRequest::has('post.paths')) {
$paths = KRequest::get('post.paths', 'raw');
if ($paths) {
$request->paths = $paths;
}
}
if (!in_array($request->container, array('docman-files', 'docman-icons', 'docman-images'))) {
$request->container = 'docman-files';
}
return $request;
}
示例13: editCover
/**
* edit a cover
*
* @param KCommandContext $context Context parameter
*
* @return AnDomainEntityAbstract
*/
public function editCover(KCommandContext $context)
{
$entity = $this->getItem();
if ($entity->isCoverable() && KRequest::has('files.cover')) {
$file = KRequest::get('files.cover', 'raw');
if ($this->_mixer->bellowSizeLimit($file) && $file['error'] == 0) {
$this->getItem()->setCover(array('url' => $file['tmp_name'], 'mimetype' => $file['type']));
$story = $this->createStory(array('name' => 'cover_edit', 'owner' => $entity, 'target' => $entity));
} else {
//$this->_mixer->getItem()->removeCoverImage();
$entity->removeCoverImage();
}
}
return $entity;
}
示例14: setReferrer
/**
* Set the referrer
*
* @return void
*/
public function setReferrer()
{
$identifier = $this->getMixer()->getIdentifier();
if (!KRequest::has('cookie.referrer_locked')) {
$request = KRequest::url();
$referrer = KRequest::referrer();
//Compare request url and referrer
if (!isset($referrer) || (string) $referrer == (string) $request) {
$option = 'com_' . $identifier->package;
$view = KInflector::pluralize($identifier->name);
$url = 'index.php?option=' . $option . '&view=' . $view;
$referrer = $this->getService('koowa:http.url', array('url' => $url));
}
KRequest::set('cookie.referrer', (string) $referrer);
}
}
示例15: getRequest
public function getRequest()
{
$request = parent::getRequest();
/*
* If there is a storage_path array in the post, set it as a GET parameter
*
* This is used to circumvent the URL size exceeding problem (after 2k bytes)
* that happens in "create documents" screen
*/
if (KRequest::has('post.storage_path')) {
$paths = KRequest::get('post.storage_path', 'raw');
if (is_array($paths)) {
$request->storage_path = $paths;
}
}
return $request;
}