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


PHP inflector::underscore方法代码示例

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


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

示例1: render

 public function render(&$render_variables, $errors = array())
 {
     $result = parent::render($render_variables, $errors);
     // Clean attributes
     $id = $this->_clean_attributes($result['attributes'], 'id');
     $buffer = array();
     foreach ($this->options as $value => $title) {
         if ($this->value == $value) {
             $buffer[inflector::underscore($title)] = form::radio($result['attributes'], $value, TRUE);
         } else {
             $buffer[inflector::underscore($title)] = form::radio($result['attributes'], $value);
         }
     }
     $result['template']->element = $buffer;
     return (string) $result['template']->render();
 }
开发者ID:samsoir,项目名称:morf,代码行数:16,代码来源:Morf_Radiogroup.php

示例2: _cellToAnchor

 /**
  *
  * This function takes the result cell, the link parameters, and the result row
  * and puts it all together to wrap a cell in a appropriate link!
  *
  * @return string HTML of cell wrapped in link
  * @param string $cell The current value of the cell (to be wrapped)
  * @param array $link The link parameter array
  * @param array $result The current result row
  */
 private function _cellToAnchor($cell, $link, $result, $reqAllArgs = false)
 {
     // Ensure there is something for a url
     if (!empty($link['link'])) {
         $url = $link['link'];
     } elseif (is_string($link)) {
         $url = $link;
     } else {
         $url = '';
     }
     $cell = self::_i18n($cell);
     //  Ensure attributes and arguments are set so we are not dealing with unset vars
     $attributes = empty($link['attributes']) ? '' : $link['attributes'];
     $arguments = array();
     // This ensures there is a title tag on the link
     if (empty($attributes['title'])) {
         $attributes['title'] = inflector::underscore($cell);
     }
     // Tack on any argumnets
     if (!empty($link['arguments'])) {
         // Standardize strings as arrays
         $link['arguments'] = is_array($link['arguments']) ? $link['arguments'] : array($link['arguments']);
         foreach ($link['arguments'] as $argument) {
             extract(self::_splitPath($argument));
             // If we can not fulfill the arguments (ie there was no result for an argument)
             // and we are required to do so then return false
             if (!isset($result[$hydrateName]) && $reqAllArgs) {
                 return false;
             }
             // This looks for the optional passAsSegments parameter for a column link
             if (!isset($link['passAsSegments']) || $link['passAsSegments'] == true) {
                 // If the args are passed as segments then we need to maintain the total count and order
                 $arguments[] = isset($result[$hydrateName]) ? $result[$hydrateName] : '';
             } else {
                 // If we are passing these args a GETs then we only need to do those that are set
                 if (isset($result[$hydrateName])) {
                     $arguments[] = $column . '=' . $result[$hydrateName];
                 }
             }
         }
     }
     // If arguments are passed as segments then the seperator is / and there will ALWAYS be a set amount
     if (!isset($link['passAsSegments']) || $link['passAsSegments'] == true) {
         $url = rtrim($url, '/') . '/' . rawurlencode(self::_implode($arguments, '/'));
     } else {
         // If the arguments are GETs then join on &, if there are any
         if ($args = self::_implode($arguments, '&')) {
             $url .= '?' . $args;
         }
     }
     $cell = htmlspecialchars($cell);
     // Wrap the cell results in a anchor tag
     return html::anchor($url, $cell, $attributes);
 }
开发者ID:swk,项目名称:bluebox,代码行数:64,代码来源:jgrid.php

示例3: title_slug

 /**
  * Returns a URL Safe Title Slug, limited to the specified characters
  * 
  * @param	string	title
  * @param	int		limit (default 25)
  * @return	string	url safe slug
  */
 public static function title_slug($title, $limit = 25)
 {
     return preg_replace("/([_+]|_)\$/", "", str::limit_chars(inflector::underscore(str::strip_all_but(strtolower($title), "a-z0-9 \\_")), $limit, ""));
 }
开发者ID:enormego,项目名称:EightPHP,代码行数:11,代码来源:inflector.php

示例4: get_path

 public function get_path()
 {
     return url::site() . 'themes/' . inflector::underscore($this->name) . '/';
 }
开发者ID:sydlawrence,项目名称:SocialFeed,代码行数:4,代码来源:Theme.php


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