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


PHP FOFInput::get方法代码示例

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


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

示例1: setIDsFromRequest

 /**
  * Sets the list of IDs from the request data
  *
  * @return FOFModel
  */
 public function setIDsFromRequest()
 {
     // Get the ID or list of IDs from the request or the configuration
     $cid = $this->input->get('cid', array(), 'array');
     $id = $this->input->getInt('id', 0);
     $kid = $this->input->getInt($this->getTable($this->table)->getKeyName(), 0);
     if (is_array($cid) && !empty($cid)) {
         $this->setIds($cid);
     } else {
         if (empty($id)) {
             $this->setId($kid);
         } else {
             $this->setId($id);
         }
     }
     return $this;
 }
开发者ID:joomla-projects,项目名称:media-manager-improvement,代码行数:22,代码来源:model.php

示例2: renderFormRaw

 /**
  * Renders a raw FOFForm and returns the corresponding HTML
  *
  * @param   FOFForm   &$form     The form to render
  * @param   FOFModel  $model     The model providing our data
  * @param   FOFInput  $input     The input object
  * @param   string    $formType  The form type e.g. 'edit' or 'read'
  *
  * @return  string    The HTML rendering of the form
  */
 protected function renderFormRaw(FOFForm &$form, FOFModel $model, FOFInput $input, $formType)
 {
     $html = '';
     foreach ($form->getFieldsets() as $fieldset) {
         $fields = $form->getFieldset($fieldset->name);
         if (isset($fieldset->class)) {
             $class = 'class="' . $fieldset->class . '"';
         } else {
             $class = '';
         }
         $html .= "\t" . '<div id="' . $fieldset->name . '" ' . $class . '>' . PHP_EOL;
         if (isset($fieldset->label) && !empty($fieldset->label)) {
             $html .= "\t\t" . '<h3>' . JText::_($fieldset->label) . '</h3>' . PHP_EOL;
         }
         foreach ($fields as $field) {
             $required = $field->required;
             $labelClass = $field->labelClass;
             $groupClass = $form->getFieldAttribute($field->fieldname, 'groupclass', '', $field->group);
             // Auto-generate label and description if needed
             // Field label
             $title = $form->getFieldAttribute($field->fieldname, 'label', '', $field->group);
             $emptylabel = $form->getFieldAttribute($field->fieldname, 'emptylabel', false, $field->group);
             if (empty($title) && !$emptylabel) {
                 $model->getName();
                 $title = strtoupper($input->get('option') . '_' . $model->getName() . '_' . $field->id . '_LABEL');
             }
             // Field description
             $description = $form->getFieldAttribute($field->fieldname, 'description', '', $field->group);
             /**
              * The following code is backwards incompatible. Most forms don't require a description in their form
              * fields. Having to use emptydescription="1" on each one of them is an overkill. Removed.
              */
             /*
             $emptydescription   = $form->getFieldAttribute($field->fieldname, 'emptydescription', false, $field->group);
             if (empty($description) && !$emptydescription)
             {
             	$description = strtoupper($input->get('option') . '_' . $model->getName() . '_' . $field->id . '_DESC');
             }
             */
             if ($formType == 'read') {
                 $inputField = $field->static;
             } elseif ($formType == 'edit') {
                 $inputField = $field->input;
             }
             if (empty($title)) {
                 $html .= "\t\t\t" . $inputField . PHP_EOL;
                 if (!empty($description) && $formType == 'edit') {
                     $html .= "\t\t\t\t" . '<span class="help-block">';
                     $html .= JText::_($description) . '</span>' . PHP_EOL;
                 }
             } else {
                 $html .= "\t\t\t" . '<div class="control-group ' . $groupClass . '">' . PHP_EOL;
                 $html .= "\t\t\t\t" . '<label class="control-label ' . $labelClass . '" for="' . $field->id . '">' . PHP_EOL;
                 $html .= "\t\t\t\t" . JText::_($title) . PHP_EOL;
                 if ($required) {
                     $html .= ' *';
                 }
                 $html .= "\t\t\t\t" . '</label>' . PHP_EOL;
                 $html .= "\t\t\t\t" . '<div class="controls">' . PHP_EOL;
                 $html .= "\t\t\t\t" . $inputField . PHP_EOL;
                 if (!empty($description)) {
                     $html .= "\t\t\t\t" . '<span class="help-block">';
                     $html .= JText::_($description) . '</span>' . PHP_EOL;
                 }
                 $html .= "\t\t\t\t" . '</div>' . PHP_EOL;
                 $html .= "\t\t\t" . '</div>' . PHP_EOL;
             }
         }
         $html .= "\t" . '</div>' . PHP_EOL;
     }
     return $html;
 }
开发者ID:shoffmann52,项目名称:install-from-web-server,代码行数:82,代码来源:strapper.php

示例3: renderToolbar

 /**
  * Renders the toolbar for the current view and task
  *
  * @param   string    $view   The view of the component
  * @param   string    $task   The exact task of the view
  * @param   FOFInput  $input  An optional input object used to determine the defaults
  *
  * @return  void
  */
 public function renderToolbar($view = null, $task = null, $input = null)
 {
     if (!empty($input)) {
         $saveInput = $this->input;
         $this->input = $input;
     }
     // If tmpl=component the default behaviour is to not render the toolbar
     if ($this->input->getCmd('tmpl', '') == 'component') {
         $render_toolbar = false;
     } else {
         $render_toolbar = true;
     }
     // If there is a render_toolbar=0 in the URL, do not render a toolbar
     $render_toolbar = $this->input->getBool('render_toolbar', $render_toolbar);
     if (!$render_toolbar) {
         return;
     }
     // Get the view and task
     if (empty($view)) {
         $view = $this->input->getCmd('view', 'cpanel');
     }
     if (empty($task)) {
         $task = $this->input->getCmd('task', 'default');
     }
     $this->view = $view;
     $this->task = $task;
     $view = FOFInflector::pluralize($view);
     $component = $input->get('option', 'com_foobar', 'cmd');
     $configProvider = new FOFConfigProvider();
     $toolbar = $configProvider->get($component . '.views.' . '.toolbar');
     // If we have a toolbar config specified
     if (!empty($toolbar)) {
         return $this->renderFromConfig($toolbar);
     }
     // Check for an onViewTask method
     $methodName = 'on' . ucfirst($view) . ucfirst($task);
     if (method_exists($this, $methodName)) {
         return $this->{$methodName}();
     }
     // Check for an onView method
     $methodName = 'on' . ucfirst($view);
     if (method_exists($this, $methodName)) {
         return $this->{$methodName}();
     }
     // Check for an onTask method
     $methodName = 'on' . ucfirst($task);
     if (method_exists($this, $methodName)) {
         return $this->{$methodName}();
     }
     if (!empty($input)) {
         $this->input = $saveInput;
     }
 }
开发者ID:Tommar,项目名称:vino2,代码行数:62,代码来源:toolbar.php

示例4: getUserStateFromRequest

 /**
  * This method will try retrieving a variable from the request (input) data.
  *
  * @param   string    $key           The user state key for the variable
  * @param   string    $request       The request variable name for the variable
  * @param   FOFInput  $input         The FOFInput object with the request (input) data
  * @param   mixed     $default       The default value. Default: null
  * @param   string    $type          The filter type for the variable data. Default: none (no filtering)
  * @param   boolean   $setUserState  Should I set the user state with the fetched value?
  *
  * @see FOFPlatformInterface::getUserStateFromRequest()
  *
  * @return  mixed  The value of the variable
  */
 public function getUserStateFromRequest($key, $request, $input, $default = null, $type = 'none', $setUserState = true)
 {
     return $input->get($request, $default, $type);
 }
开发者ID:naka211,项目名称:studiekorrektur,代码行数:18,代码来源:platform.php

示例5: getContentType

 /**
  * Get the content type for ucm
  *
  * @return string The content type alias
  */
 public function getContentType()
 {
     if ($this->contentType) {
         return $this->contentType;
     }
     /**
      * When tags was first introduced contentType variable didn't exist - so we guess one
      * This will fail if content history behvaiour is enabled. This code is deprecated
      * and will be removed in FOF 3.0 in favour of the content type class variable
      */
     $component = $this->input->get('option');
     $view = FOFInflector::singularize($this->input->get('view'));
     $alias = $component . '.' . $view;
     return $alias;
 }
开发者ID:deenison,项目名称:joomla-cms,代码行数:20,代码来源:table.php

示例6: getUserStateFromRequest

 /**
  * This method will try retrieving a variable from the request (input) data.
  *
  * @param   string    $key           The user state key for the variable
  * @param   string    $request       The request variable name for the variable
  * @param   FOFInput  $input         The FOFInput object with the request (input) data
  * @param   mixed     $default       The default value. Default: null
  * @param   string    $type          The filter type for the variable data. Default: none (no filtering)
  * @param   boolean   $setUserState  Should I set the user state with the fetched value?
  *
  * @see FOFPlatformInterface::getUserStateFromRequest()
  *
  * @return  mixed  The value of the variable
  */
 public function getUserStateFromRequest($key, $request, $input, $default = null, $type = 'none', $setUserState = true)
 {
     list($isCLI, $isAdmin) = $this->isCliAdmin();
     if ($isCLI) {
         return $input->get($request, $default, $type);
     }
     $app = JFactory::getApplication();
     if (method_exists($app, 'getUserState')) {
         $old_state = $app->getUserState($key, $default);
     } else {
         $old_state = null;
     }
     $cur_state = !is_null($old_state) ? $old_state : $default;
     $new_state = $input->get($request, null, $type);
     // Save the new value only if it was set in this request
     if ($setUserState) {
         if ($new_state !== null) {
             $app->setUserState($key, $new_state);
         } else {
             $new_state = $cur_state;
         }
     } elseif (is_null($new_state)) {
         $new_state = $cur_state;
     }
     return $new_state;
 }
开发者ID:alvarovladimir,项目名称:messermeister_ab_rackservers,代码行数:40,代码来源:platform.php

示例7: __callStatic

 /**
  * Old static methods are now deprecated. This magic method makes sure there
  * is a continuity in our approach. The downside is that it's only compatible
  * with PHP 5.3.0. Sorry!
  *
  * @param   string  $name       Name of the method we're calling
  * @param   array   $arguments  The arguments passed to the method
  *
  * @return  mixed
  */
 public static function __callStatic($name, $arguments)
 {
     FOFPlatform::getInstance()->logDeprecated('FOFInput: static getXXX() methods are deprecated. Use the input object\'s methods instead.');
     if (substr($name, 0, 3) == 'get') {
         // Initialise arguments
         $key = array_shift($arguments);
         $default = array_shift($arguments);
         $input = array_shift($arguments);
         $type = 'none';
         $mask = 0;
         $type = strtolower(substr($name, 3));
         if ($type == 'var') {
             $type = array_shift($arguments);
             $mask = array_shift($arguments);
         }
         if (is_null($type)) {
             $type = 'none';
         }
         if (is_null($mask)) {
             $mask = 0;
         }
         if (!$input instanceof FOFInput && !$input instanceof JInput) {
             $input = new FOFInput($input);
         }
         return $input->get($key, $default, $type, $mask);
     }
     return false;
 }
开发者ID:deenison,项目名称:joomla-cms,代码行数:38,代码来源:input.php

示例8: _csrfProtection

 /**
  * Applies CSRF protection by means of a standard Joomla! token (nonce) check.
  * Raises a 403 Access Forbidden error through JError or an exception
  * (depending the Joomla! version) if the check fails.
  *
  * @return  boolean  True if the CSRF check is successful
  *
  * @throws Exception
  */
 protected function _csrfProtection()
 {
     static $isCli = null, $isAdmin = null;
     if (is_null($isCli)) {
         $isCli = FOFPlatform::getInstance()->isCli();
         $isAdmin = FOFPlatform::getInstance()->isBackend();
     }
     switch ($this->csrfProtection) {
         // Never
         case 0:
             return true;
             break;
             // Always
         // Always
         case 1:
             break;
             // Only back-end and HTML format
         // Only back-end and HTML format
         case 2:
             if ($isCli) {
                 return true;
             } elseif (!$isAdmin && $this->input->get('format', 'html', 'cmd') != 'html') {
                 return true;
             }
             break;
             // Only back-end
         // Only back-end
         case 3:
             if (!$isAdmin) {
                 return true;
             }
             break;
     }
     $hasToken = false;
     $session = JFactory::getSession();
     // Joomla! 1.5/1.6/1.7/2.5 (classic Joomla! API) method
     if (method_exists('JUtility', 'getToken')) {
         $token = JUtility::getToken();
         $hasToken = $this->input->get($token, false, 'none') == 1;
         if (!$hasToken) {
             $hasToken = $this->input->get('_token', null, 'none') == $token;
         }
     }
     // Joomla! 2.5+ (Platform 12.1+) method
     if (!$hasToken) {
         if (method_exists($session, 'getToken')) {
             $token = $session->getToken();
             $hasToken = $this->input->get($token, false, 'none') == 1;
             if (!$hasToken) {
                 $hasToken = $this->input->get('_token', null, 'none') == $token;
             }
         }
     }
     // Joomla! 2.5+ formToken method
     if (!$hasToken) {
         if (method_exists($session, 'getFormToken')) {
             $token = $session->getFormToken();
             $hasToken = $this->input->get($token, false, 'none') == 1;
             if (!$hasToken) {
                 $hasToken = $this->input->get('_token', null, 'none') == $token;
             }
         }
     }
     if (!$hasToken) {
         if (version_compare(JVERSION, '3.0', 'ge')) {
             throw new Exception(JText::_('JLIB_APPLICATION_ERROR_ACCESS_FORBIDDEN'), 403);
         } else {
             JError::raiseError('403', JText::_('JLIB_APPLICATION_ERROR_ACCESS_FORBIDDEN'));
         }
         return false;
     }
 }
开发者ID:alvarovladimir,项目名称:messermeister_ab_rackservers,代码行数:81,代码来源:controller.php

示例9: getContentType

 /**
  * Get the content type for ucm
  *
  * @return string The content type alias
  */
 public function getContentType()
 {
     $component = $this->input->get('option');
     $view = FOFInflector::singularize($this->input->get('view'));
     $alias = $component . '.' . $view;
     return $alias;
 }
开发者ID:shoffmann52,项目名称:install-from-web-server,代码行数:12,代码来源:table.php

示例10: renderFieldset

 /**
  * Renders a raw fieldset of a FOFForm and returns the corresponding HTML
  *
  * @param   stdClass  &$fieldset   The fieldset to render
  * @param   FOFForm   &$form       The form to render
  * @param   FOFModel  $model       The model providing our data
  * @param   FOFInput  $input       The input object
  * @param   string    $formType    The form type e.g. 'edit' or 'read'
  * @param   boolean   $showHeader  Should I render the fieldset's header?
  *
  * @return  string    The HTML rendering of the fieldset
  */
 protected function renderFieldset(stdClass &$fieldset, FOFForm &$form, FOFModel $model, FOFInput $input, $formType, $showHeader = true)
 {
     $html = '';
     $fields = $form->getFieldset($fieldset->name);
     if (isset($fieldset->class)) {
         $class = 'class="' . $fieldset->class . '"';
     } else {
         $class = '';
     }
     $element = empty($fields) ? 'div' : 'fieldset';
     $html .= "\t" . '<' . $element . ' id="' . $fieldset->name . '" ' . $class . '>' . PHP_EOL;
     $isTabbedFieldset = $this->isTabFieldset($fieldset);
     if (isset($fieldset->label) && !empty($fieldset->label) && !$isTabbedFieldset) {
         $html .= "\t\t" . '<h3>' . JText::_($fieldset->label) . '</h3>' . PHP_EOL;
     }
     foreach ($fields as $field) {
         $groupClass = $form->getFieldAttribute($field->fieldname, 'groupclass', '', $field->group);
         // Auto-generate label and description if needed
         // Field label
         $title = $form->getFieldAttribute($field->fieldname, 'label', '', $field->group);
         $emptylabel = $form->getFieldAttribute($field->fieldname, 'emptylabel', false, $field->group);
         if (empty($title) && !$emptylabel) {
             $model->getName();
             $title = strtoupper($input->get('option') . '_' . $model->getName() . '_' . $field->id . '_LABEL');
         }
         // Field description
         $description = $form->getFieldAttribute($field->fieldname, 'description', '', $field->group);
         /**
          * The following code is backwards incompatible. Most forms don't require a description in their form
          * fields. Having to use emptydescription="1" on each one of them is an overkill. Removed.
          */
         /*
         $emptydescription   = $form->getFieldAttribute($field->fieldname, 'emptydescription', false, $field->group);
         if (empty($description) && !$emptydescription)
         {
         	$description = strtoupper($input->get('option') . '_' . $model->getName() . '_' . $field->id . '_DESC');
         }
         */
         if ($formType == 'read') {
             $inputField = $field->static;
         } elseif ($formType == 'edit') {
             $inputField = $field->input;
         }
         if (empty($title)) {
             $html .= "\t\t\t" . $inputField . PHP_EOL;
             if (!empty($description) && $formType == 'edit') {
                 $html .= "\t\t\t\t" . '<span class="help-block">';
                 $html .= JText::_($description) . '</span>' . PHP_EOL;
             }
         } else {
             $html .= "\t\t\t" . '<div class="fof-row ' . $groupClass . '">' . PHP_EOL;
             $html .= $this->renderFieldsetLabel($field, $form, $title);
             $html .= "\t\t\t\t" . $inputField . PHP_EOL;
             if (!empty($description)) {
                 $html .= "\t\t\t\t" . '<span class="help-block">';
                 $html .= JText::_($description) . '</span>' . PHP_EOL;
             }
             $html .= "\t\t\t" . '</div>' . PHP_EOL;
         }
     }
     $element = empty($fields) ? 'div' : 'fieldset';
     $html .= "\t" . '</' . $element . '>' . PHP_EOL;
     return $html;
 }
开发者ID:educakanchay,项目名称:kanchay,代码行数:76,代码来源:joomla.php


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