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


PHP FOFInflector::implode方法代码示例

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


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

示例1: getOptions

 /**
  * Method to get the field options.
  *
  * @return  array  The field option objects.
  */
 protected function getOptions()
 {
     $options = array();
     // Initialize some field attributes.
     $key = $this->element['key_field'] ? (string) $this->element['key_field'] : 'value';
     $value = $this->element['value_field'] ? (string) $this->element['value_field'] : (string) $this->element['name'];
     $applyAccess = $this->element['apply_access'] ? (string) $this->element['apply_access'] : 'false';
     $modelName = (string) $this->element['model'];
     $nonePlaceholder = (string) $this->element['none'];
     $translate = empty($this->element['translate']) ? 'true' : (string) $this->element['translate'];
     $translate = in_array(strtolower($translate), array('true', 'yes', '1', 'on')) ? true : false;
     if (!empty($nonePlaceholder)) {
         $options[] = JHtml::_('select.option', JText::_($nonePlaceholder), null);
     }
     // Process field atrtibutes
     $applyAccess = strtolower($applyAccess);
     $applyAccess = in_array($applyAccess, array('yes', 'on', 'true', '1'));
     // Explode model name into model name and prefix
     $parts = FOFInflector::explode($modelName);
     $mName = ucfirst(array_pop($parts));
     $mPrefix = FOFInflector::implode($parts);
     // Get the model object
     $config = array('savestate' => 0);
     $model = FOFModel::getTmpInstance($mName, $mPrefix, $config);
     if ($applyAccess) {
         $model->applyAccessFiltering();
     }
     // Process state variables
     foreach ($this->element->children() as $stateoption) {
         // Only add <option /> elements.
         if ($stateoption->getName() != 'state') {
             continue;
         }
         $stateKey = (string) $stateoption['key'];
         $stateValue = (string) $stateoption;
         $model->setState($stateKey, $stateValue);
     }
     // Set the query and get the result list.
     $items = $model->getItemList(true);
     // Build the field options.
     if (!empty($items)) {
         foreach ($items as $item) {
             if ($translate == true) {
                 $options[] = JHtml::_('select.option', $item->{$key}, JText::_($item->{$value}));
             } else {
                 $options[] = JHtml::_('select.option', $item->{$key}, $item->{$value});
             }
         }
     }
     // Merge any additional options in the XML definition.
     $options = array_merge(parent::getOptions(), $options);
     return $options;
 }
开发者ID:01J,项目名称:skazkipronebo,代码行数:58,代码来源:model.php

示例2: normaliseItemName

 /**
  * Normalises the format of a relation name
  *
  * @param   string   $itemName   The raw relation name
  * @param   boolean  $pluralise  Should I pluralise the name? If not, I will singularise it
  *
  * @return  string  The normalised relation key name
  */
 protected function normaliseItemName($itemName, $pluralise = false)
 {
     // Explode the item name
     $itemNameParts = explode('_', $itemName);
     // If we have multiple parts the first part is considered to be the component name
     if (count($itemNameParts) > 1) {
         $prefix = array_shift($itemNameParts);
     } else {
         $prefix = null;
     }
     // If we still have multiple parts we need to pluralise/singularise the last part and join everything in
     // CamelCase format
     if (count($itemNameParts) > 1) {
         $name = array_pop($itemNameParts);
         $name = $pluralise ? FOFInflector::pluralize($name) : FOFInflector::singularize($name);
         $itemNameParts[] = $name;
         $itemName = FOFInflector::implode($itemNameParts);
     } else {
         $name = array_pop($itemNameParts);
         $itemName = $pluralise ? FOFInflector::pluralize($name) : FOFInflector::singularize($name);
     }
     if (!empty($prefix)) {
         $itemName = $prefix . '_' . $itemName;
     }
     return $itemName;
 }
开发者ID:educakanchay,项目名称:kanchay,代码行数:34,代码来源:relations.php

示例3: getThisView

 /**
  * Returns current view object
  *
  * @param   array  $config  Configuration variables for the model
  *
  * @return  FOFView  The global instance of the view object (singleton)
  */
 public final function getThisView($config = array())
 {
     if (!is_object($this->_viewObject)) {
         // Make sure $config is an array
         if (is_object($config)) {
             $config = (array) $config;
         } elseif (!is_array($config)) {
             $config = array();
         }
         $prefix = null;
         $viewName = null;
         $viewType = null;
         if (!empty($this->viewName)) {
             $parts = FOFInflector::explode($this->viewName);
             $viewName = ucfirst(array_pop($parts));
             $prefix = FOFInflector::implode($parts);
         } else {
             $prefix = ucfirst($this->bareComponent) . 'View';
             $viewName = ucfirst($this->view);
         }
         $document = FOFPlatform::getInstance()->getDocument();
         if ($document instanceof JDocument) {
             $viewType = $document->getType();
         } else {
             $viewType = $this->input->getCmd('format', 'html');
         }
         if ($viewType == 'html' && $this->hasForm) {
             $viewType = 'form';
         }
         if (!array_key_exists('input', $config) || !$config['input'] instanceof FOFInput) {
             $config['input'] = $this->input;
         }
         $config['input']->set('base_path', $this->basePath);
         $this->_viewObject = $this->getView($viewName, $viewType, $prefix, $config);
     }
     return $this->_viewObject;
 }
开发者ID:alvarovladimir,项目名称:messermeister_ab_rackservers,代码行数:44,代码来源:controller.php


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