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


PHP ArrayHelper::fromObject方法代码示例

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


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

示例1: renderListData

 /**
  * Shows the data formatted for the list view
  *
  * @param   string    $data      Elements data
  * @param   stdClass  &$thisRow  All the data in the lists current row
  * @param   array     $opts      Rendering options
  *
  * @return  string	formatted value
  */
 public function renderListData($data, stdClass &$thisRow, $opts = array())
 {
     $listModel = $this->getListModel();
     $params = $this->getParams();
     $w = (int) $params->get('fb_gm_table_mapwidth');
     $h = (int) $params->get('fb_gm_table_mapheight');
     $z = (int) $params->get('fb_gm_table_zoomlevel');
     $data = FabrikWorker::JSONtoData($data, true);
     foreach ($data as $i => &$d) {
         if ($params->get('fb_gm_staticmap_tableview')) {
             $d = $this->_staticMap($d, $w, $h, $z, $i, true, ArrayHelper::fromObject($thisRow));
         }
         if ($params->get('icon_folder') == '1' && ArrayHelper::getValue($opts, 'icon', 1)) {
             // $$$ rob was returning here but that stopped us being able to use links and icons together
             $d = $this->replaceWithIcons($d, 'list', $listModel->getTmpl());
         } else {
             if (!$params->get('fb_gm_staticmap_tableview')) {
                 $d = $params->get('fb_gm_staticmap_tableview_type_coords', 'num') == 'dms' ? $this->_dmsformat($d) : $this->_microformat($d);
             }
         }
         if (ArrayHelper::getValue($opts, 'rollover', 1)) {
             $d = $this->rollover($d, $thisRow, 'list');
         }
         if (ArrayHelper::getValue($opts, 'link', 1)) {
             $d = $listModel->_addLink($d, $this, $thisRow, $i);
         }
     }
     return $this->renderListDataFinal($data);
 }
开发者ID:jfquestiaux,项目名称:fabrik,代码行数:38,代码来源:googlemap.php

示例2: fkData

 /**
  * Get the foreign keys value.
  *
  * @return  mixed string|int
  */
 protected function fkData()
 {
     if (!isset($this->fkData)) {
         /** @var FabrikFEModelForm $formModel */
         $formModel = $this->getModel();
         $params = $this->getParams();
         $this->fkData = array();
         // Get the foreign key element
         $fkElement = $this->fkElement();
         if ($fkElement) {
             $fkElementKey = $fkElement->getFullName();
             $this->fkData = json_decode(FArrayHelper::getValue($formModel->formData, $fkElementKey));
             if (is_object($this->fkData)) {
                 $this->fkData = ArrayHelper::fromObject($this->fkData);
             }
             $fkEval = $params->get('foreign_key_eval', '');
             if ($fkEval !== '') {
                 $fkData = $this->fkData;
                 $eval = eval($fkEval);
                 if ($eval !== false) {
                     $this->fkData = $eval;
                 }
             }
         }
     }
     return $this->fkData;
 }
开发者ID:jfquestiaux,项目名称:fabrik,代码行数:32,代码来源:rest.php

示例3: render

 /**
  * Method to render the view.
  *
  * @return  string  The rendered view.
  *
  * @since   1.0
  * @throws  \RuntimeException
  */
 public function render()
 {
     // Set the vars to the template.
     $this->renderer->set('group', ArrayHelper::fromObject($this->model->getItem()));
     $this->renderer->set('project', $this->getProject());
     return parent::render();
 }
开发者ID:dextercowley,项目名称:jissues,代码行数:15,代码来源:GroupHtmlView.php

示例4: admin_postinstall_eaccelerator_action

/**
 * Disables the unsupported eAccelerator caching method, replacing it with the "file" caching method.
 *
 * @return  void
 *
 * @since   3.2
 */
function admin_postinstall_eaccelerator_action()
{
    $prev = ArrayHelper::fromObject(new JConfig());
    $data = array_merge($prev, array('cacheHandler' => 'file'));
    $config = new Registry($data);
    jimport('joomla.filesystem.path');
    jimport('joomla.filesystem.file');
    // Set the configuration file path.
    $file = JPATH_CONFIGURATION . '/configuration.php';
    // Get the new FTP credentials.
    $ftp = JClientHelper::getCredentials('ftp', true);
    // Attempt to make the file writeable if using FTP.
    if (!$ftp['enabled'] && JPath::isOwner($file) && !JPath::setPermissions($file, '0644')) {
        JError::raiseNotice('SOME_ERROR_CODE', JText::_('COM_CONFIG_ERROR_CONFIGURATION_PHP_NOTWRITABLE'));
    }
    // Attempt to write the configuration file as a PHP class named JConfig.
    $configuration = $config->toString('PHP', array('class' => 'JConfig', 'closingtag' => false));
    if (!JFile::write($file, $configuration)) {
        JFactory::getApplication()->enqueueMessage(JText::_('COM_CONFIG_ERROR_WRITE_FAILED'), 'error');
        return;
    }
    // Attempt to make the file unwriteable if using FTP.
    if (!$ftp['enabled'] && JPath::isOwner($file) && !JPath::setPermissions($file, '0444')) {
        JError::raiseNotice('SOME_ERROR_CODE', JText::_('COM_CONFIG_ERROR_CONFIGURATION_PHP_NOTUNWRITABLE'));
    }
}
开发者ID:eshiol,项目名称:joomla-cms,代码行数:33,代码来源:eaccelerator.php

示例5: filterValue

 /**
  * Short cut for getting the element's filter value, or false if no value
  *
  * @param   int  $elementId  Element id
  *
  * @since   3.0.7
  *
  * @return  mixed
  */
 public static function filterValue($elementId)
 {
     $app = JFactory::getApplication();
     $pluginManager = FabrikWorker::getPluginManager();
     $model = $pluginManager->getElementPlugin($elementId);
     $listModel = $model->getListModel();
     $listId = $listModel->getId();
     $key = 'com_fabrik.list' . $listId . '_com_fabrik_' . $listId . '.filter';
     $filters = ArrayHelper::fromObject($app->getUserState($key));
     $elementIds = (array) FArrayHelper::getValue($filters, 'elementid', array());
     $index = array_search($elementId, $elementIds);
     $value = $index === false ? false : FArrayHelper::getValue($filters['value'], $index, false);
     return $value;
 }
开发者ID:glauberm,项目名称:cinevi,代码行数:23,代码来源:element.php

示例6: onCanDelete

 /**
  * Can the row be deleted
  *
  * @param   object  $row  Current row to test
  *
  * @return boolean
  */
 public function onCanDelete($row)
 {
     $params = $this->getParams();
     // If $row is null, we were called from the table's canEdit() in a per-table rather than per-row context,
     // and we don't have an opinion on per-table delete permissions, so just return true.
     if (is_null($row) || is_null($row[0])) {
         return true;
     }
     if (is_array($row[0])) {
         $data = ArrayHelper::toObject($row[0]);
     } else {
         $data = $row[0];
     }
     $field = str_replace('.', '___', $params->get('candeleterow_field'));
     // If they provided some PHP to eval, we ignore the other settings and just run their code
     $canDeleteRowEval = $params->get('candeleterow_eval', '');
     // $$$ rob if no can delete field selected in admin return true
     if (trim($field) == '' && trim($canDeleteRowEval) == '') {
         return true;
     }
     if (!empty($canDeleteRowEval)) {
         $w = new FabrikWorker();
         $data = ArrayHelper::fromObject($data);
         $canDeleteRowEval = $w->parseMessageForPlaceHolder($canDeleteRowEval, $data);
         FabrikWorker::clearEval();
         $canDeleteRowEval = @eval($canDeleteRowEval);
         FabrikWorker::logEval($canDeleteRowEval, 'Caught exception on eval in can delete row : %s');
         return $canDeleteRowEval;
     } else {
         // No PHP given, so just do a simple match on the specified element and value settings.
         if ($params->get('candeleterow_useraw', '0') == '1') {
             $field .= '_raw';
         }
         $value = $params->get('candeleterow_value');
         $operator = $params->get('operator', '=');
         if (!isset($data->{$field})) {
             return false;
         }
         switch ($operator) {
             case '=':
             default:
                 return $data->{$field} == $value;
                 break;
             case "!=":
                 return $data->{$field} != $value;
                 break;
         }
     }
 }
开发者ID:jfquestiaux,项目名称:fabrik,代码行数:56,代码来源:candeleterow.php

示例7: display

 /**
  * Display a json object representing the table data.
  *
  * @param   string  $tpl  The name of the template file to parse; automatically searches through the template paths.
  *
  * @return  void
  */
 public function display($tpl = null)
 {
     $app = JFactory::getApplication();
     $input = $app->input;
     $model = JModelLegacy::getInstance('List', 'FabrikFEModel');
     $model->setId($input->getInt('listid'));
     $this->setModel($model, true);
     $item = $model->getTable();
     $params = $model->getParams();
     $model->render();
     $this->emptyDataMessage = FText::_($params->get('empty_data_msg', 'COM_FABRIK_LIST_NO_DATA_MSG'));
     $rowid = $input->getString('rowid', '', 'string');
     list($this->headings, $groupHeadings, $this->headingClass, $this->cellClass) = $this->get('Headings');
     $data = $model->getData();
     $nav = $model->getPagination();
     $c = 0;
     foreach ($data as $groupk => $group) {
         foreach ($group as $i => $x) {
             $o = new stdClass();
             if (is_object($data[$groupk])) {
                 $o->data = ArrayHelper::fromObject($data[$groupk]);
             } else {
                 $o->data = $data[$groupk][$i];
             }
             $o->cursor = $i + $nav->limitstart;
             $o->total = $nav->total;
             $o->id = 'list_' . $item->id . '_row_' . @$o->data->__pk_val;
             $o->class = "fabrik_row oddRow" . $c;
             if (is_object($data[$groupk])) {
                 $data[$groupk] = $o;
             } else {
                 $data[$groupk][$i] = $o;
             }
             $c = 1 - $c;
         }
     }
     // $$$ hugh - heading[3] doesn't exist any more?  Trying [0] instead.
     $d = array('id' => $item->id, 'rowid' => $rowid, 'model' => 'list', 'data' => $data, 'headings' => $this->headings, 'formid' => $model->getTable()->form_id, 'lastInsertedRow' => JFactory::getSession()->get('lastInsertedRow', 'test'));
     $d['nav'] = get_object_vars($nav);
     $d['htmlnav'] = $params->get('show-table-nav', 1) ? $nav->getListFooter($model->getId(), $this->getTmpl()) : '';
     $d['calculations'] = $model->getCalculations();
     $msg = $app->getMessageQueue();
     if (!empty($msg)) {
         $d['msg'] = $msg[0]['message'];
     }
     echo json_encode($d);
 }
开发者ID:glauberm,项目名称:cinevi,代码行数:54,代码来源:view.raw.php

示例8: qrCodeLink

 /**
  * Get a link to this element which will call onAjax_renderQRCode().
  *
  * @param   array|object  $thisRow  Row data
  *
  * @since 3.1
  *
  * @return   string  QR code link
  */
 protected function qrCodeLink($thisRow)
 {
     if (is_object($thisRow)) {
         $thisRow = ArrayHelper::fromObject($thisRow);
     }
     $formModel = $this->getFormModel();
     $formId = $formModel->getId();
     $rowId = $formModel->getRowId();
     if (empty($rowId)) {
         /**
          * Meh.  See commentary at the start of $formModel->getEmailData() about rowid.  For now, if this is a new row,
          * the only place we're going to find it is in the list model's lastInsertId.  Bah humbug.
          * But check __pk_val first anyway, what the heck.
          */
         $rowId = FArrayHelper::getValue($thisRow, '__pk_val', '');
         if (empty($rowId)) {
             /**
              * Nope.  Try lastInsertId. Or maybe on top of the fridge?  Or in the microwave?  Down the back
              * of the couch cushions?
              */
             $rowId = $formModel->getListModel()->lastInsertId;
             /**
              * OK, give up.  If *still* no rowid, we're probably being called from something like getEmailData() on onBeforeProcess or
              * onBeforeStore, and it's a new form, so no rowid yet.  So no point returning anything yet.
              */
             if (empty($rowId)) {
                 return '';
             }
         }
     }
     /*
      * YAY!!!  w00t!!  We have a rowid.  Whoop de freakin' doo!!
      */
     $elementId = $this->getId();
     $src = COM_FABRIK_LIVESITE . 'index.php?option=com_' . $this->package . '&task=plugin.pluginAjax&plugin=field&method=ajax_renderQRCode&' . 'format=raw&element_id=' . $elementId . '&formid=' . $formId . '&rowid=' . $rowId . '&repeatcount=0';
     $layout = $this->getLayout('qr');
     $displayData = new stdClass();
     $displayData->src = $src;
     return $layout->render($displayData);
 }
开发者ID:glauberm,项目名称:cinevi,代码行数:49,代码来源:field.php

示例9: editLabel

 /**
  * Get edit row button label
  *
  * @param   object  $row  active table row
  *
  * @since   3.1rc1
  *
  * @return  string
  */
 public function editLabel($row)
 {
     $params = $this->getParams();
     $row = ArrayHelper::fromObject($row);
     return FText::_($this->parseMessageForRowHolder($params->get('editlabel', FText::_('COM_FABRIK_EDIT')), $row));
 }
开发者ID:pascal26,项目名称:fabrik,代码行数:15,代码来源:list.php

示例10: setJoinData


//.........这里部分代码省略.........
     // No joins so leave !
     if (!is_array($this->aJoinObjs) || $this->rowId === '') {
         return;
     }
     if (!array_key_exists(0, $data)) {
         $data[0] = new stdClass();
     }
     $groups = $this->getGroupsHiarachy();
     /**
      * $$$ hugh - adding the "PK's seen" stuff, otherwise we end up adding multiple
      * rows when we have multiple repeat groups.  For instance, if we had two repeated
      * groups, one with 2 repeats and one with 3, we ended up with 6 repeats for each
      * group, with 3 and 2 copies of each respectively.  So we need to track which
      * instances of each repeat we have already copied into the main row.
      *
      * So $joinPksSeen will be indexed by $joinPksSeen[groupid][elementid]
      */
     $joinPksSeen = array();
     /**
      * Have to copy the data for the PK's seen stuff, as we're modifying the original $data
      * as we go, which screws up the PK logic once we've modified the PK value itself in the
      * original $data.  Probably only needed for $data[0], as that's the only row we actually
      * modify, but for now I'm just copying the whole thing, which then gets used for doing the ...
      * $joinPkVal = $data_copy[$row_index]->$joinPk;
      * ... inside the $data iteration below.
      *
      * PS, could probably just do a $data_copy = $data, as our usage of the copy isn't going to
      * involve nested arrays (which get copied by reference when using =), but I've been burned
      * so many times with array copying, I'm going to do a "deep copy" using serialize/unserialize!
      */
     $data_copy = unserialize(serialize($data));
     foreach ($groups as $groupId => $groupModel) {
         $group = $groupModel->getGroup();
         $joinPksSeen[$groupId] = array();
         $elementModels = $groupModel->getMyElements();
         foreach ($elementModels as $elementModelID => $elementModel) {
             if ($groupModel->isJoin() || $elementModel->isJoin()) {
                 if ($groupModel->isJoin()) {
                     $joinModel = $groupModel->getJoinModel();
                     $joinPk = $joinModel->getForeignID();
                     $joinPksSeen[$groupId][$elementModelID] = array();
                 }
                 $names = $elementModel->getJoinDataNames();
                 foreach ($data as $row_index => $row) {
                     // Might be a string if new record ?
                     $row = (object) $row;
                     if ($groupModel->isJoin()) {
                         /**
                          * If the join's PK element isn't published or for any other reason not
                          * in $data, we're hosed!
                          */
                         if (!isset($data_copy[$row_index]->{$joinPk})) {
                             continue;
                         }
                         $joinPkVal = $data_copy[$row_index]->{$joinPk};
                         /**
                          * if we've seen the PK value for this element's row before, skip it.
                          * Check for empty as well, just in case - as we're loading existing data,
                          * it darn well should have a value!
                          */
                         if (empty($joinPkVal) || in_array($joinPkVal, $joinPksSeen[$groupId][$elementModelID])) {
                             continue;
                         }
                     }
                     for ($i = 0; $i < count($names); $i++) {
                         $name = $names[$i];
                         if (array_key_exists($name, $row)) {
                             $v = $row->{$name};
                             $v = FabrikWorker::JSONtoData($v, $elementModel->isJoin());
                             // New record or csv export
                             if (!isset($data[0]->{$name})) {
                                 $data[0]->{$name} = $v;
                             }
                             if (!is_array($data[0]->{$name})) {
                                 if ($groupModel->isJoin() && $groupModel->canRepeat()) {
                                     $v = array($v);
                                 }
                                 $data[0]->{$name} = $v;
                             } else {
                                 if ($groupModel->isJoin() && $groupModel->canRepeat()) {
                                     $n =& $data[0]->{$name};
                                     $n[] = $v;
                                 }
                             }
                         }
                     }
                     if ($groupModel->isJoin()) {
                         /**
                          * Make a Note To Self that we've now handled the data for this element's row,
                          * and can skip it from now on.
                          */
                         $joinPksSeen[$groupId][$elementModelID][] = $joinPkVal;
                     }
                 }
             }
         }
     }
     // Remove the additional rows - they should have been merged into [0] above. if no [0] then use main array
     $data = ArrayHelper::fromObject(FArrayHelper::getValue($data, 0, $data));
 }
开发者ID:glauberm,项目名称:cinevi,代码行数:101,代码来源:form.php

示例11: doAdd

 protected function doAdd($data)
 {
     if (empty($this->list_route)) {
         throw new \Exception('Must define a route for listing the items');
     }
     if (empty($this->create_item_route)) {
         throw new \Exception('Must define a route for creating the item');
     }
     if (empty($this->edit_item_route)) {
         throw new \Exception('Must define a route for editing the item');
     }
     if (!isset($data['submitType'])) {
         $data['submitType'] = "save_edit";
     }
     $f3 = \Base::instance();
     $flash = \Dsc\Flash::instance();
     $model = $this->getModel();
     // save
     try {
         $values = $data;
         $create = array_filter($values['stripe']);
         //make a method for this, convert float to cents
         $create['amount'] = (int) $create['amount'];
         $settings = \Striper\Models\Settings::fetch();
         // Set your secret key: remember to change this to your live secret key in production
         // See your keys here https://manage.stripe.com/account
         \Stripe\Stripe::setApiKey($settings->{$settings->mode . '.secret_key'});
         $plan = \Stripe\Plan::create($create);
         $values['stripe'] = array('id' => $plan->id, 'name' => $plan->name, 'created' => $plan->created, 'amount' => $plan->amount, 'interval' => $plan->interval, 'currency' => $plan->currency, 'interval_count' => $plan->interval_count, 'trial_period_days' => $plan->trial_period_days);
         unset($values['submitType']);
         //\Dsc\System::instance()->addMessage(\Dsc\Debug::dump($values), 'warning');
         $this->item = $model->create($values);
     } catch (\Exception $e) {
         \Dsc\System::instance()->addMessage('Save failed with the following errors:', 'error');
         \Dsc\System::instance()->addMessage($e->getMessage(), 'error');
         if (\Base::instance()->get('DEBUG')) {
             \Dsc\System::instance()->addMessage($e->getTraceAsString(), 'error');
         }
         if ($f3->get('AJAX')) {
             // output system messages in response object
             return $this->outputJson($this->getJsonResponse(array('error' => true, 'message' => \Dsc\System::instance()->renderMessages())));
         }
         // redirect back to the create form with the fields pre-populated
         \Dsc\System::instance()->setUserState('use_flash.' . $this->create_item_route, true);
         $flash->store($data);
         $this->setRedirect($this->create_item_route);
         return false;
     }
     // redirect to the editing form for the new item
     \Dsc\System::instance()->addMessage('Item saved', 'success');
     if (method_exists($this->item, 'cast')) {
         $this->item_data = $this->item->cast();
     } else {
         $this->item_data = \Joomla\Utilities\ArrayHelper::fromObject($this->item);
     }
     if ($f3->get('AJAX')) {
         return $this->outputJson($this->getJsonResponse(array('message' => \Dsc\System::instance()->renderMessages(), 'result' => $this->item_data)));
     }
     switch ($data['submitType']) {
         case "save_new":
             $route = $this->create_item_route;
             break;
         case "save_close":
             $route = $this->list_route;
             break;
         default:
             $flash->store($this->item_data);
             $id = $this->item->get($this->getItemKey());
             $route = str_replace('{id}', $id, $this->edit_item_route);
             break;
     }
     $this->setRedirect($route);
     return $this;
 }
开发者ID:dioscouri,项目名称:f3-striper,代码行数:74,代码来源:Plan.php

示例12: onCanEdit

 /**
  * Can the row be edited
  *
  * @param   object  $row  Current row to test
  *
  * @return boolean
  */
 public function onCanEdit($row)
 {
     $params = $this->getParams();
     // If $row is null, we were called from the list's canEdit() in a per-table rather than per-row context,
     // and we don't have an opinion on per-table edit permissions, so just return true.
     if (is_null($row) || is_null($row[0])) {
         return true;
     }
     if (is_array($row[0])) {
         $data = ArrayHelper::toObject($row[0]);
     } else {
         $data = $row[0];
     }
     /**
      * If __pk_val is not set or empty, then we've probably been called from somewhere in form processing,
      * and this is a new row.  In which case this plugin cannot offer any opinion!
      */
     if (!isset($data->__pk_val) || empty($data->__pk_val)) {
         return true;
     }
     $field = str_replace('.', '___', $params->get('caneditrow_field'));
     // If they provided some PHP to eval, we ignore the other settings and just run their code
     $caneditrow_eval = $params->get('caneditrow_eval', '');
     // $$$ rob if no can edit field selected in admin return true
     if (trim($field) == '' && trim($caneditrow_eval) == '') {
         $this->acl[$data->__pk_val] = true;
         return true;
     }
     if (!empty($caneditrow_eval)) {
         $w = new FabrikWorker();
         $data = ArrayHelper::fromObject($data);
         $caneditrow_eval = $w->parseMessageForPlaceHolder($caneditrow_eval, $data);
         FabrikWorker::clearEval();
         $caneditrow_eval = @eval($caneditrow_eval);
         FabrikWorker::logEval($caneditrow_eval, 'Caught exception on eval in can edit row : %s');
         $this->acl[$data['__pk_val']] = $caneditrow_eval;
         return $caneditrow_eval;
     } else {
         // No PHP given, so just do a simple match on the specified element and value settings.
         if ($params->get('caneditrow_useraw', '0') == '1') {
             $field .= '_raw';
         }
         $value = $params->get('caneditrow_value');
         $operator = $params->get('operator', '=');
         if (is_object($data->{$field})) {
             $data->{$field} = ArrayHelper::fromObject($data->{$field});
         }
         switch ($operator) {
             case '=':
             default:
                 $return = is_array($data->{$field}) ? in_array($value, $data->{$field}) : $data->{$field} == $value;
                 break;
             case "!=":
                 $return = is_array($data->{$field}) ? !in_array($value, $data->{$field}) : $data->{$field} != $value;
                 break;
         }
         $this->acl[$data->__pk_val] = $return;
         return $return;
     }
 }
开发者ID:jfquestiaux,项目名称:fabrik,代码行数:67,代码来源:caneditrow.php

示例13: canUserDo

 /**
  * Access control function for determining if the user can perform
  * a designated function on a specific row
  *
  * @param   object $params Item params to test
  * @param   object $row    Data
  * @param   string $col    Access control setting to compare against
  *
  * @return    mixed    - if ACL setting defined here return bool, otherwise return -1 to continue with default acl
  *                     setting
  */
 public static function canUserDo($params, $row, $col)
 {
     if (!is_null($row)) {
         $app = JFactory::getApplication();
         $input = $app->input;
         $user = JFactory::getUser();
         $userCol = $params->get($col, '');
         if ($userCol != '') {
             $userCol = FabrikString::safeColNameToArrayKey($userCol);
             if (!array_key_exists($userCol, $row)) {
                 return false;
             } else {
                 if (array_key_exists($userCol . '_raw', $row)) {
                     $userCol .= '_raw';
                 }
                 $myId = $user->get('id');
                 // -1 for menu items that link to their own records
                 $userColVal = is_array($row) ? $row[$userCol] : $row->{$userCol};
                 // User element stores as object
                 if (is_object($userColVal)) {
                     $userColVal = ArrayHelper::fromObject($userColVal);
                 }
                 // Could be coming back from a failed validation in which case val might be an array
                 if (is_array($userColVal)) {
                     $userColVal = array_shift($userColVal);
                 }
                 if (empty($userColVal) && empty($myId)) {
                     return false;
                 }
                 if (intVal($userColVal) === intVal($myId) || $input->get('rowid') == -1) {
                     return true;
                 }
             }
         }
     }
     return -1;
 }
开发者ID:glauberm,项目名称:cinevi,代码行数:48,代码来源:parent.php

示例14: onAfterProcess


//.........这里部分代码省略.........
     if (trim($item) == '') {
         $itemRaw = FArrayHelper::getValue($this->data, FabrikString::safeColNameToArrayKey($params->get('paypal_item_element') . '_raw'));
         $item = $this->data[FabrikString::safeColNameToArrayKey($params->get('paypal_item_element'))];
         if (is_array($item)) {
             $item = array_shift($item);
         }
         if (is_array($itemRaw)) {
             $itemRaw = array_shift($itemRaw);
         }
     }
     // $$$ hugh - strip any HTML tags from the item name, as PayPal doesn't like them.
     $opts['item_name'] = strip_tags($item);
     // $$$ rob add in subscription variables
     if ($this->isSubscription($params)) {
         $subTable = JModelLegacy::getInstance('List', 'FabrikFEModel');
         $subTable->setId((int) $params->get('paypal_subs_table'));
         $idEl = FabrikString::safeColName($params->get('paypal_subs_id', ''));
         $durationEl = FabrikString::safeColName($params->get('paypal_subs_duration', ''));
         $durationPerEl = FabrikString::safeColName($params->get('paypal_subs_duration_period', ''));
         $name = $params->get('paypal_subs_name', '');
         $subDb = $subTable->getDb();
         $query = $subDb->getQuery(true);
         $query->select('*, ' . $durationEl . ' AS p3, ' . $durationPerEl . ' AS t3, ' . $subDb->q($itemRaw) . ' AS item_number')->from($subTable->getTable()->db_table_name)->where($idEl . ' = ' . $subDb->quote($itemRaw));
         $subDb->setQuery($query);
         $sub = $subDb->loadObject();
         if (is_object($sub)) {
             $opts['p3'] = $sub->p3;
             $opts['t3'] = $sub->t3;
             $opts['a3'] = $amount;
             $opts['no_note'] = 1;
             $opts['custom'] = '';
             $filter = JFilterInput::getInstance();
             $post = $filter->clean($_POST, 'array');
             $tmp = array_merge($post, ArrayHelper::fromObject($sub));
             // 'http://fabrikar.com/ '.$sub->item_name.' - User: subtest26012010 (subtest26012010)';
             $opts['item_name'] = $w->parseMessageForPlaceHolder($name, $tmp);
             $opts['invoice'] = $w->parseMessageForPlaceHolder($params->get('paypal_subs_invoice'), $tmp, false);
             if ($opts['invoice'] == '') {
                 $opts['invoice'] = uniqid('', true);
             }
             $opts['src'] = $w->parseMessageForPlaceHolder($params->get('paypal_subs_recurring'), $tmp);
             $amount = $opts['amount'];
             unset($opts['amount']);
         } else {
             throw new RuntimeException('Could not determine subscription period, please check your settings', 500);
         }
     }
     if (!$this->isSubscription($params)) {
         // Reset the amount which was unset during subscription code
         $opts['amount'] = $amount;
         $opts['cmd'] = '_xclick';
         // Unset any subscription options we may have set
         unset($opts['p3']);
         unset($opts['t3']);
         unset($opts['a3']);
         unset($opts['no_note']);
     }
     $shipping_table = $this->shippingTable();
     if ($shipping_table !== false) {
         $thisTable = $formModel->getListModel()->getTable()->db_table_name;
         $shippingUserId = $userId;
         /*
          * If the shipping table is the same as the form's table, and no user logged in
          * then use the shipping data entered into the form:
          * see http://fabrikar.com/forums/index.php?threads/paypal-shipping-address-without-joomla-userid.33229/
          */
开发者ID:jfquestiaux,项目名称:fabrik,代码行数:67,代码来源:paypal.php

示例15: removeroot

 /**
  * Method to unset the root_user value from configuration data.
  *
  * This method will load the global configuration data straight from
  * JConfig and remove the root_user value for security, then save the configuration.
  *
  * @return	boolean  True on success, false on failure.
  *
  * @since	1.6
  */
 public function removeroot()
 {
     // Get the previous configuration.
     $prev = new JConfig();
     $prev = ArrayHelper::fromObject($prev);
     // Create the new configuration object, and unset the root_user property
     unset($prev['root_user']);
     $config = new Registry($prev);
     // Write the configuration file.
     return $this->writeConfigFile($config);
 }
开发者ID:eshiol,项目名称:joomla-cms,代码行数:21,代码来源:application.php


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