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


PHP KInflector::variablize方法代码示例

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


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

示例1: render

 public function render()
 {
     $name = $this->getName();
     $img = KTemplateAbstract::loadHelper('admin::com.ninja.helper.default.img', '/32/' . $name . '.png');
     if ($img) {
         KTemplateAbstract::loadHelper('admin::com.ninja.helper.default.css', '.toolbar .icon-32-' . $name . ' { background-image: url(' . $img . '); }');
     }
     $text = JText::_($this->_options['text']);
     $view = KRequest::get('get.view', 'cmd');
     $link = ' href="' . JRoute::_($this->getLink()) . '"';
     $html = array();
     // Sanitize the url since we can't trust the server var
     $url = KFactory::get('lib.koowa.filter.url')->sanitize($this->getLink());
     // Create the URI object
     $uri = KFactory::tmp('lib.koowa.http.uri', array('uri' => $url));
     $query = $uri->getQuery(1);
     $html[] = '<td class="button" id="' . $this->getId() . '">';
     $active = $view == KInflector::variablize(KInflector::pluralize($query['view'])) || $view == KInflector::variablize(KInflector::singularize($query['view']));
     $hide = !KInflector::isPlural($view);
     if ($active || $hide || !$this->modal) {
         $html[] = '<a class="toolbar inactive">';
     } else {
         $html[] = '<a' . $link . ' onclick="' . $this->getOnClick() . '" class="toolbar">';
     }
     $html[] = '<span class="' . $this->getClass() . '" title="' . $text . '">';
     $html[] = '</span>';
     $html[] = $text;
     if (!$active && !$hide || $this->modal) {
         $html[] = '</a>';
     } else {
         $html[] = '</a>';
     }
     $html[] = '</td>';
     return implode(PHP_EOL, $html);
 }
开发者ID:ravenlife,项目名称:Ninja-Framework,代码行数:35,代码来源:link.php

示例2: execute

 /**
  * Executes an authorization action with the passed arguments.
  * 
  * @param string          $name    The command name
  * @param KCommandContext $context The command context
  * 
  * @return bool Can return both true or false.  
  */
 public final function execute($action, KCommandContext $context)
 {
     $method = '_' . KInflector::variablize('authorize.' . $action);
     $result = self::AUTH_NOT_IMPLEMENTED;
     if (method_exists($this, $method)) {
         $this->_entity = $context->mixer;
         $this->_viewer = $context->viewer;
         $result = $this->{$method}($context);
     }
     return $result;
 }
开发者ID:stonyyi,项目名称:anahita,代码行数:19,代码来源:abstract.php

示例3: applyFilters

 /**
  * Applies an array of fiters to query by calling each filter as method
  * on the query.
  *
  * @param AnDomainQuery $query   Query Object
  * @param array         $filters An array of filter
  */
 public static function applyFilters($query, $filters)
 {
     foreach ($filters as $filter => $value) {
         $method = KInflector::variablize($filter);
         $value = KConfig::unbox($value);
         if (!is_array($value) || !is_numeric(key($value))) {
             $args = array($value);
         } else {
             $args = $value;
         }
         call_object_method($query, $method, $args);
     }
 }
开发者ID:stonyyi,项目名称:anahita,代码行数:20,代码来源:helper.php

示例4: _initialize

 /**
  * Initializes the options for the object
  *
  * Called from {@link __construct()} as a first step of object instantiation.
  *
  * @param 	object 	An optional KConfig object with configuration options.
  * @return 	void
  */
 protected function _initialize(KConfig $config)
 {
     $identifier = clone $this->_parent;
     $identifier->name = KInflector::singularize($this->_name);
     $config->append(array('entityset' => 'anahita:domain.entityset.manytomany', 'target' => $identifier, 'target_child_key' => KInflector::variablize($identifier->name), 'target_parent_key' => 'id'));
     if (!$config->as) {
         //keep the as always the same for the two many to many relationship
         $names = array($config->parent->name, KInflector::singularize($config->name));
         sort($names);
         $config->as = $names[0] . ucfirst(KInflector::pluralize($names[1]));
     }
     parent::_initialize($config);
 }
开发者ID:walteraries,项目名称:anahita,代码行数:21,代码来源:manytomany.php

示例5: __construct

 /** 
  * Constructor.
  *
  * @param KConfig $config An optional KConfig object with configuration options.
  * 
  * @return void
  */
 public function __construct(KConfig $config)
 {
     $this->_initialize($config);
     if (!empty($config->aliases)) {
         foreach ($config->aliases as $alias => $property) {
             $this->setAlias($property, $alias);
         }
     }
     $this->_entity_identifier = $config->entity_identifier;
     $this->_repository = $config->repository;
     if (!$this->_repository) {
         throw new AnDomainDescriptionException("repository [AnDomainRepositoryAbstract] option is required");
     }
     if ($config->inheritance) {
         $this->_inheritance_column = $config->inheritance->column;
         //an object can only be abstract if it's
         //supports single table inheritance
         $this->_is_abstract = $config->inheritance->abstract;
         if ($config->inheritance->ignore) {
             $ignore = (array) $config->inheritance['ignore'];
             foreach ($ignore as $class) {
                 $this->_class_alias[$class] = '';
             }
         }
     }
     if (is_string($this->_inheritance_column)) {
         $this->_inheritance_column = $this->_repository->getResources()->getColumn($this->_inheritance_column);
     }
     $this->_entity_identifier = $this->_repository->getIdentifier($config->entity_identifier);
     if (!$config->identity_property) {
         $columns = $this->_repository->getResources()->main()->getColumns();
         foreach ($columns as $column) {
             if ($column->primary) {
                 $config->identity_property = KInflector::variablize($column->name);
                 break;
             }
         }
     }
     $this->_identity_property = $config->identity_property;
     //try to generate some of the propreties
     //from the database columns
     if ($config->auto_generate) {
         //if auto generate default set the identity property with the primary key
         $config->append(array('attributes' => array($this->_identity_property => array('key' => true))));
         $attributes = $config['attributes'];
         $columns = $this->_repository->getResources()->main()->getColumns();
         foreach ($columns as $column) {
             $name = KInflector::variablize($column->name);
             //merge the existing attributes
             $attributes[$name] = array_merge(array('required' => $column->required, 'column' => $column, 'type' => $column->type, 'default' => $column->default), isset($attributes[$name]) ? $attributes[$name] : array());
         }
         $config['attributes'] = $attributes;
     }
 }
开发者ID:walteraries,项目名称:anahita,代码行数:61,代码来源:abstract.php

示例6: __call

 /**
  * Converts methods to tags. For example $this->h1 will create a h1 tag
  * 	 
  */
 public function __call($method, $args)
 {
     $inflected = strtolower(KInflector::variablize($method));
     if (method_exists($this, $inflected)) {
         return call_user_func_array(array($this, $inflected), $args);
     }
     $content = isset($args[0]) ? $args[0] : '';
     $attributes = isset($args[1]) ? $args[1] : array();
     return $this->tag($method, $content, $attributes);
 }
开发者ID:walteraries,项目名称:anahita,代码行数:14,代码来源:html.php


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