當前位置: 首頁>>代碼示例>>PHP>>正文


PHP JArrayHelper::getValue方法代碼示例

本文整理匯總了PHP中JArrayHelper::getValue方法的典型用法代碼示例。如果您正苦於以下問題:PHP JArrayHelper::getValue方法的具體用法?PHP JArrayHelper::getValue怎麽用?PHP JArrayHelper::getValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在JArrayHelper的用法示例。


在下文中一共展示了JArrayHelper::getValue方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: featured

 /**
  * Method to toggle the featured setting of a list of articles.
  *
  * @return	void
  * @since	1.6
  */
 function featured()
 {
     // Check for request forgeries
     JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
     // Initialise variables.
     $user = JFactory::getUser();
     $ids = JRequest::getVar('cid', array(), '', 'array');
     $values = array('featured' => 1, 'unfeatured' => 0);
     $task = $this->getTask();
     $value = JArrayHelper::getValue($values, $task, 0, 'int');
     // Access checks.
     foreach ($ids as $i => $id) {
         if (!$user->authorise('core.edit.state', 'com_content.article.' . (int) $id)) {
             // Prune items that you can't change.
             unset($ids[$i]);
             JError::raiseNotice(403, JText::_('JLIB_APPLICATION_ERROR_EDITSTATE_NOT_PERMITTED'));
         }
     }
     if (empty($ids)) {
         JError::raiseWarning(500, JText::_('JERROR_NO_ITEMS_SELECTED'));
     } else {
         // Get the model.
         $model = $this->getModel();
         // Publish the items.
         if (!$model->featured($ids, $value)) {
             JError::raiseWarning(500, $model->getError());
         }
     }
     $this->setRedirect('index.php?option=com_content&view=articles');
 }
開發者ID:joomline,項目名稱:Joomla2.5.999,代碼行數:36,代碼來源:articles.php

示例2: getInput

 /**
  * Method to get the field input markup.
  *
  * @return	string	The field input markup.
  * @since	1.6
  */
 protected function getInput()
 {
     // Initialise variables.
     $html = array();
     $recordId = (int) $this->form->getValue('id');
     $size = ($v = $this->element['size']) ? ' size="' . $v . '"' : '';
     $class = ($v = $this->element['class']) ? ' class="' . $v . '"' : 'class="text_area"';
     // Get a reverse lookup of the base link URL to Title
     $model = JModel::getInstance('menutypes', 'menusModel');
     $rlu = $model->getReverseLookup();
     switch ($this->value) {
         case 'url':
             $value = JText::_('COM_MENUS_TYPE_EXTERNAL_URL');
             break;
         case 'alias':
             $value = JText::_('COM_MENUS_TYPE_ALIAS');
             break;
         case 'separator':
             $value = JText::_('COM_MENUS_TYPE_SEPARATOR');
             break;
         default:
             $link = $this->form->getValue('link');
             // Clean the link back to the option, view and layout
             $value = JText::_(JArrayHelper::getValue($rlu, MenusHelper::getLinkKey($link)));
             break;
     }
     // Load the javascript and css
     JHtml::_('behavior.framework');
     JHtml::_('behavior.modal');
     $html[] = '<input type="text" readonly="readonly" disabled="disabled" value="' . $value . '"' . $size . $class . ' />';
     $html[] = '<input type="button" value="' . JText::_('JSELECT') . '" onclick="SqueezeBox.fromElement(this, {handler:\'iframe\', size: {x: 600, y: 450}, url:\'' . JRoute::_('index.php?option=com_menus&view=menutypes&tmpl=component&recordId=' . $recordId) . '\'})" />';
     $html[] = '<input type="hidden" name="' . $this->name . '" value="' . htmlspecialchars($this->value, ENT_COMPAT, 'UTF-8') . '" />';
     return implode("\n", $html);
 }
開發者ID:laiello,項目名稱:senluonirvana,代碼行數:40,代碼來源:menutype.php

示例3: setDefault

 /**
  * Method to set the home property for a list of items
  *
  * @since	1.6
  */
 function setDefault()
 {
     // Check for request forgeries
     JSession::checkToken('request') or die(JText::_('JINVALID_TOKEN'));
     // Get items to publish from the request.
     $cid = JRequest::getVar('cid', array(), '', 'array');
     $data = array('setDefault' => 1, 'unsetDefault' => 0);
     $task = $this->getTask();
     $value = JArrayHelper::getValue($data, $task, 0, 'int');
     if (empty($cid)) {
         JError::raiseWarning(500, JText::_($this->text_prefix . '_NO_ITEM_SELECTED'));
     } else {
         // Get the model.
         $model = $this->getModel();
         // Make sure the item ids are integers
         JArrayHelper::toInteger($cid);
         // Publish the items.
         if (!$model->setHome($cid, $value)) {
             JError::raiseWarning(500, $model->getError());
         } else {
             if ($value == 1) {
                 $ntext = 'COM_MENUS_ITEMS_SET_HOME';
             } else {
                 $ntext = 'COM_MENUS_ITEMS_UNSET_HOME';
             }
             $this->setMessage(JText::plural($ntext, count($cid)));
         }
     }
     $this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list, false));
 }
開發者ID:exntu,項目名稱:joomla-cms,代碼行數:35,代碼來源:items.php

示例4: save

 /**
  * Save data into the DB.
  *
  * @param array $data The data of item
  *
  * @return  int
  */
 public function save($data)
 {
     $id = JArrayHelper::getValue($data, "id");
     $name = JArrayHelper::getValue($data, "name");
     $default = JArrayHelper::getValue($data, "default");
     $params = JArrayHelper::getValue($data, "params");
     // Encode parameters to JSON format.
     if (!empty($params)) {
         $params = json_encode($params);
     } else {
         $params = null;
     }
     // Load a record from the database
     $row = $this->getTable();
     /** @var $row UserIdeasTableStatus */
     $row->load($id);
     $row->set("name", $name);
     $row->set("default", $default);
     $row->set("params", $params);
     $this->prepareTable($row);
     $row->store(true);
     // Set the item as default.
     if ($row->get("default")) {
         $this->setDefault($row->get("id"));
     }
     return $row->get("id");
 }
開發者ID:pippogsm,項目名稱:UserIdeas,代碼行數:34,代碼來源:status.php

示例5: bind

 /**
  * Overloaded bind function to pre-process the params.
  *
  * @param    array        Named array
  *
  * @return   null|string  null is operation was satisfactory, otherwise returns an error
  * @see      JTable::bind
  */
 public function bind($array, $ignore = '')
 {
     // For Fields group
     // Convert jform[fields_group][field] to jform[field] or JTable cannot bind data.
     // ==========================================================================================
     $data = array();
     $array = AKHelper::_('array.pivotFromTwoDimension', $array);
     // Set field['param_xxx'] to params
     // ==========================================================================================
     if (empty($array['params'])) {
         $array['params'] = AKHelper::_('array.pivotFromPrefix', 'param_', $array, JArrayHelper::getValue($array, 'params', array()));
     }
     // Set params to JRegistry
     // ==========================================================================================
     if (isset($array['params']) && is_array($array['params'])) {
         $registry = new JRegistry();
         $registry->loadArray($array['params']);
         $array['params'] = (string) $registry;
     }
     // Bind the rules.
     // ==========================================================================================
     if (isset($array['rules']) && is_array($array['rules'])) {
         $rules = new JAccessRules($array['rules']);
         $this->setRules($rules);
     }
     return parent::bind($array, $ignore);
 }
開發者ID:beingsane,項目名稱:quickcontent,代碼行數:35,代碼來源:table.php

示例6: toggleInList

 public function toggleInList()
 {
     // Check for request forgeries
     JRequest::checkToken() or die(JText::_('JINVALID_TOKEN'));
     // Get items to publish from the request.
     $cid = JRequest::getVar('cid', array(), '', 'array');
     $data = array('showInListView' => 1, 'hideFromListView' => 0);
     $task = $this->getTask();
     $value = JArrayHelper::getValue($data, $task, 0, 'int');
     if (empty($cid)) {
         JError::raiseWarning(500, JText::_($this->text_prefix . '_NO_ITEM_SELECTED'));
     } else {
         // Get the model.
         $model = $this->getModel();
         // Make sure the item ids are integers
         JArrayHelper::toInteger($cid);
         // Publish the items.
         if (!$model->addToListView($cid, $value)) {
             JError::raiseWarning(500, $model->getError());
         } else {
             if ($value == 1) {
                 $ntext = $this->text_prefix . '_N_ITEMS_ADDED_TO_LIST_VIEW';
             } else {
                 $ntext = $this->text_prefix . '_N_ITEMS_REMOVED_FROM_LIST_VIEW';
             }
             $this->setMessage(JText::plural($ntext, count($cid)));
         }
     }
     $this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list, false));
 }
開發者ID:rogeriocc,項目名稱:fabrik,代碼行數:30,代碼來源:elements.php

示例7: JHP_Geshi_replacer

function JHP_Geshi_replacer(&$matches)
{
    //	print_r($matches);
    //// 	die();
    jimport('geshi.geshi');
    jimport('domit.xml_saxy_shared');
    $args = SAXY_Parser_Base::parseAttributes($matches[1]);
    // 	print_r($args);
    $text = $matches[2];
    $lang = JArrayHelper::getValue($args, 'lang', 'phpz');
    $lines = JArrayHelper::getValue($args, 'lines', 'true');
    $html_entities_match = array("|\\<br \\/\\>|", "#<#", "#>#", "|&#39;|", '#&quot;#', '#&nbsp;#');
    $html_entities_replace = array("\n", '&lt;', '&gt;', "'", '"', ' ');
    $text = preg_replace($html_entities_match, $html_entities_replace, $text);
    $text = str_replace('&lt;', '<', $text);
    $text = str_replace('&gt;', '>', $text);
    $text = str_replace("\t", '  ', $text);
    $geshi = new GeSHi($text, $lang);
    if ($lines == 'true') {
        $geshi->enable_line_numbers(GESHI_FANCY_LINE_NUMBERS);
    }
    $text = $geshi->parse_code();
    $text = '???' . $text . '???';
    return $text;
}
開發者ID:phpsa,項目名稱:jhproject,代碼行數:25,代碼來源:plgbbcode.php

示例8: onUserBeforeSave

 /**
  * Method is called before user data is stored in the database.
  *
  * Changes the password in LDAP if the user changed their password.
  *
  * @param   array    $user   Holds the old user data.
  * @param   boolean  $isNew  True if a new user is stored.
  * @param   array    $new    Holds the new user data.
  *
  * @return  boolean  Cancels the save if False.
  *
  * @since   2.0
  */
 public function onUserBeforeSave($user, $isNew, $new)
 {
     if ($isNew) {
         // We dont want to deal with new users here
         return;
     }
     // Get username and password to use for authenticating with Ldap
     $username = JArrayHelper::getValue($user, 'username', false, 'string');
     $password = JArrayHelper::getValue($new, 'password_clear', null, 'string');
     if (!empty($password)) {
         $auth = array('authenticate' => SHLdap::AUTH_USER, 'username' => $username, 'password' => $password);
         try {
             // We will double check the password for double safety (breaks password reset if on)
             $authenticate = $this->params->get('authenticate', 0);
             // Get the user adapter then set the password on it
             $adapter = SHFactory::getUserAdapter($auth);
             $adapter->setPassword($password, JArrayHelper::getValue($new, 'current-password', null, 'string'), $authenticate);
             SHLog::add(JText::sprintf('PLG_LDAP_PASSWORD_INFO_12411', $username), 12411, JLog::INFO, 'ldap');
         } catch (Exception $e) {
             // Log and Error out
             SHLog::add($e, 12401, JLog::ERROR, 'ldap');
             return false;
         }
     }
 }
開發者ID:philbertphotos,項目名稱:JMapMyLDAP,代碼行數:38,代碼來源:password.php

示例9: publish

 /**
  * Method to change the state of a list of records.
  */
 public function publish()
 {
     // Check for request forgeries.
     JRequest::checkToken() or jexit(JText::_('JInvalid_Token'));
     // Initialise variables.
     $user = JFactory::getUser();
     $ids = JRequest::getVar('cid', array(), '', 'array');
     $values = array('publish' => 1, 'unpublish' => 0);
     $task = $this->getTask();
     $value = JArrayHelper::getValue($values, $task, 0, 'int');
     if (empty($ids)) {
         JError::raiseWarning(500, JText::_('JError_No_items_selected'));
     } else {
         // Get the model.
         $model = $this->getModel();
         // Change the state of the records.
         if (!$model->publish($ids, $value)) {
             JError::raiseWarning(500, $model->getError());
         } else {
             if ($value == 1) {
                 $text = 'JSuccess_N_Items_published';
             } else {
                 $text = 'JSuccess_N_Items_unpublished';
             }
             $this->setMessage(JText::sprintf($text, count($ids)));
         }
     }
     $this->setRedirect('index.php?option=com_plugins&view=plugins');
 }
開發者ID:joebushi,項目名稱:joomla,代碼行數:32,代碼來源:plugins.php

示例10: save

 public function save($key = null, $urlVar = null)
 {
     JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
     $data = $this->input->post->get('jform', array(), 'array');
     $itemId = JArrayHelper::getValue($data, "id");
     $redirectOptions = array("task" => $this->getTask(), "id" => $itemId);
     $model = $this->getModel();
     /** @var $model UserIdeasModelItem * */
     $form = $model->getForm($data, false);
     /** @var $form JForm * */
     if (!$form) {
         throw new Exception(JText::_("COM_USERIDEAS_ERROR_FORM_CANNOT_BE_LOADED"), 500);
     }
     // Validate the form
     $validData = $model->validate($form, $data);
     // Check for errors
     if ($validData === false) {
         $this->displayNotice($form->getErrors(), $redirectOptions);
         return;
     }
     try {
         $itemId = $model->save($validData);
         $redirectOptions["id"] = $itemId;
     } catch (Exception $e) {
         JLog::add($e->getMessage());
         throw new Exception(JText::_('COM_USERIDEAS_ERROR_SYSTEM'));
     }
     $this->displayMessage(JText::_('COM_USERIDEAS_ITEM_SAVED'), $redirectOptions);
 }
開發者ID:johngrange,項目名稱:wookeyholeweb,代碼行數:29,代碼來源:item.php

示例11: changeBlock

 /**
  * Method to change the block status on a record.
  *
  * @return  void
  *
  * @since   1.6
  */
 public function changeBlock()
 {
     // Check for request forgeries.
     JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
     // Initialise variables.
     $ids = JRequest::getVar('cid', array(), '', 'array');
     $values = array('block' => 1, 'unblock' => 0);
     $task = $this->getTask();
     $value = JArrayHelper::getValue($values, $task, 0, 'int');
     if (empty($ids)) {
         JError::raiseWarning(500, JText::_('COM_USERS_USERS_NO_ITEM_SELECTED'));
     } else {
         // Get the model.
         $model = $this->getModel();
         // Change the state of the records.
         if (!$model->block($ids, $value)) {
             JError::raiseWarning(500, $model->getError());
         } else {
             if ($value == 1) {
                 $this->setMessage(JText::plural('COM_USERS_N_USERS_BLOCKED', count($ids)));
             } elseif ($value == 0) {
                 $this->setMessage(JText::plural('COM_USERS_N_USERS_UNBLOCKED', count($ids)));
             }
         }
     }
     $this->setRedirect('index.php?option=com_users&view=users');
 }
開發者ID:NavaINT1876,項目名稱:ccustoms,代碼行數:34,代碼來源:users.php

示例12: getTree

 function getTree(&$xmap, &$parent, &$params)
 {
     $link_query = parse_url($parent->link);
     parse_str(html_entity_decode($link_query['query']), $link_vars);
     $view = JArrayHelper::getValue($link_vars, 'view', 0);
     $include_categories = JArrayHelper::getValue($params, 'include_categories', 1, '');
     $include_categories = $include_categories == 1 || $include_categories == 2 && $xmap->view == 'xml' || $include_categories == 3 && $xmap->view == 'html' || $xmap->view == 'navigator';
     $params['include_categories'] = $include_categories;
     $include_items = JArrayHelper::getValue($params, 'include_items', 1, '');
     $include_items = $include_items == 1 || $include_items == 2 && $xmap->view == 'xml' || $include_items == 3 && $xmap->view == 'html' || $xmap->view == 'navigator';
     $params['include_items'] = $include_items;
     $priority = JArrayHelper::getValue($params, 'cat_priority', $parent->priority, '');
     $changefreq = JArrayHelper::getValue($params, 'cat_changefreq', $parent->changefreq, '');
     if ($priority == '-1') {
         $priority = $parent->priority;
     }
     if ($changefreq == '-1') {
         $changefreq = $parent->changefreq;
     }
     $params['cat_priority'] = $priority;
     $params['cat_changefreq'] = $changefreq;
     $priority = JArrayHelper::getValue($params, 'item_priority', $parent->priority, '');
     $changefreq = JArrayHelper::getValue($params, 'item_changefreq', $parent->changefreq, '');
     if ($priority == '-1') {
         $priority = $parent->priority;
     }
     if ($changefreq == '-1') {
         $changefreq = $parent->changefreq;
     }
     $params['item_priority'] = $priority;
     $params['item_changefreq'] = $changefreq;
     self::getCategoryTree($xmap, $parent, $params);
 }
開發者ID:b2un0,項目名稱:joomla-plugin-xmap-zoo,代碼行數:33,代碼來源:com_zoo.php

示例13: getTree

 /**
  * @param XmapDisplayerInterface $xmap
  * @param stdClass $parent
  * @param array $params
  */
 public static function getTree($xmap, stdClass $parent, array &$params)
 {
     $uri = new JUri($parent->link);
     if (!self::$enabled || !in_array($uri->getVar('view'), self::$views)) {
         return;
     }
     $params['include_entries'] = JArrayHelper::getValue($params, 'include_entries', 1);
     $params['include_entries'] = $params['include_entries'] == 1 || $params['include_entries'] == 2 && $xmap->view == 'xml' || $params['include_entries'] == 3 && $xmap->view == 'html';
     $params['include_expired_entries'] = JArrayHelper::getValue($params, 'include_expired_entries', 0);
     $params['include_expired_entries'] = $params['include_expired_entries'] == 1 || $params['include_expired_entries'] == 2 && $xmap->view == 'xml' || $params['include_expired_entries'] == 3 && $xmap->view == 'html';
     $params['category_priority'] = JArrayHelper::getValue($params, 'category_priority', $parent->priority);
     $params['category_changefreq'] = JArrayHelper::getValue($params, 'category_changefreq', $parent->changefreq);
     if ($params['category_priority'] == -1) {
         $params['category_priority'] = $parent->priority;
     }
     if ($params['category_changefreq'] == -1) {
         $params['category_changefreq'] = $parent->changefreq;
     }
     $params['entry_priority'] = JArrayHelper::getValue($params, 'entry_priority', $parent->priority);
     $params['entry_changefreq'] = JArrayHelper::getValue($params, 'entry_changefreq', $parent->changefreq);
     if ($params['entry_priority'] == -1) {
         $params['entry_priority'] = $parent->priority;
     }
     if ($params['entry_changefreq'] == -1) {
         $params['entry_changefreq'] = $parent->changefreq;
     }
     switch ($uri->getVar('view')) {
         case 'front':
             self::getCategoryTree($xmap, $parent, $params, 0);
             break;
         case 'list':
             self::getEntries($xmap, $parent, $params, $uri->getVar('catid'));
             break;
     }
 }
開發者ID:b2un0,項目名稱:joomla-plugin-xmap-adsmanager,代碼行數:40,代碼來源:com_adsmanager.php

示例14: sticky_publish

 /**
  * Stick items
  *
  * @return  void
  *
  * @since   1.6
  */
 public function sticky_publish()
 {
     // Check for request forgeries.
     JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
     $ids = $this->input->get('cid', array(), 'array');
     $values = array('sticky_publish' => 1, 'sticky_unpublish' => 0);
     $task = $this->getTask();
     $value = JArrayHelper::getValue($values, $task, 0, 'int');
     if (empty($ids)) {
         JError::raiseWarning(500, JText::_('COM_BANNERS_NO_BANNERS_SELECTED'));
     } else {
         // Get the model.
         $model = $this->getModel();
         // Change the state of the records.
         if (!$model->stick($ids, $value)) {
             JError::raiseWarning(500, $model->getError());
         } else {
             if ($value == 1) {
                 $ntext = 'COM_BANNERS_N_BANNERS_STUCK';
             } else {
                 $ntext = 'COM_BANNERS_N_BANNERS_UNSTUCK';
             }
             $this->setMessage(JText::plural($ntext, count($ids)));
         }
     }
     $this->setRedirect('index.php?option=com_banners&view=banners');
 }
開發者ID:WineWorld,項目名稱:joomlatrialcmbg,代碼行數:34,代碼來源:banners.php

示例15: loadForm

 /**
  * Method to get a form object.
  *
  * @param   string   $name     The name of the form.
  * @param   string   $source   The form source. Can be XML string if file flag is set to false.
  * @param   array    $options  Optional array of options for the form creation.
  * @param   boolean  $clear    Optional argument to force load a new form.
  * @param   mixed    $xpath    An optional xpath to search for the fields.
  *
  * @return  mixed  JForm object on success, False on error.
  */
 protected function loadForm($name, $source = null, $options = array(), $clear = false, $xpath = false)
 {
     static $form = null;
     // Handle the optional arguments.
     $options['control'] = JArrayHelper::getValue($options, 'control', false);
     // Create a signature hash.
     $hash = md5($source . serialize($options));
     // Check if we can use a previously loaded form.
     if (isset($this->_forms[$hash]) && !$clear) {
         return $this->_forms[$hash];
     }
     // Get the form.
     RForm::addFormPath(JPATH_COMPONENT . '/models/forms');
     RForm::addFieldPath(JPATH_COMPONENT . '/models/fields');
     try {
         $form = RForm::getInstance($name, $source, $options, false, $xpath);
         if (isset($options['load_data']) && $options['load_data']) {
             // Get the data for the form.
             $data = $this->loadFormData();
         } else {
             $data = array();
         }
         // Allow for additional modification of the form, and events to be triggered.
         // We pass the data because plugins may require it.
         $this->preprocessForm($form, $data);
         // Load the data into the form after the plugins have operated.
         $form->bind($data);
     } catch (Exception $e) {
         $this->setError($e->getMessage());
         return false;
     }
     // Store the form for later.
     $this->_forms[$hash] = $form;
     return $form;
 }
開發者ID:prox91,項目名稱:joomla-dev,代碼行數:46,代碼來源:field.php


注:本文中的JArrayHelper::getValue方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。