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


PHP inflector::humanize方法代码示例

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


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

示例1: __toString

 public function __toString()
 {
     if ($this->name) {
         return $this->name;
     }
     return inflector::humanize(current(explode('@', $this->email)));
 }
开发者ID:hdragomir,项目名称:ProjectsLounge,代码行数:7,代码来源:user.php

示例2: packageData

 public static function packageData(&$metadata, $filepath)
 {
     $metadata['directory'] = dirname($filepath);
     if (empty($metadata['packageName'])) {
         $metadata['packageName'] = dirname(str_replace(DOCROOT, '', $filepath));
     }
     if (empty($metadata['identifier'])) {
         //kohana::log('debug', 'Creating identifier from md5(\'' .$metadata['packageName'] .$metadata['version'] .'\');');
         $metadata['identifier'] = md5($metadata['packageName'] . $metadata['version']);
     }
     if (empty($metadata['displayName'])) {
         $metadata['displayName'] = ucfirst(inflector::humanize($metadata['packageName']));
     }
     if (!is_bool($metadata['default'])) {
         $metadata['default'] = FALSE;
     }
     if (!is_array($metadata['required'])) {
         $metadata['required'] = array();
         Package_Message::log('error', 'Package ' . $metadata['packageName'] . ' required parameter is poorly formated, ignoring');
     }
     if (is_numeric($metadata['version'])) {
         $versionParts = explode('.', $metadata['version']);
         $versionParts = array_pad($versionParts, 3, 0);
         $metadata['version'] = implode('.', $versionParts);
     }
     $metadata['version'] = (string) $metadata['version'];
     $metadata['upgrades'] = array();
     $metadata['downgrades'] = array();
     $metadata['basedir'] = dirname(str_replace(DOCROOT, '', $filepath));
     $metadata['status'] = Package_Manager::STATUS_UNINSTALLED;
     $metadata['datastore_id'] = NULL;
 }
开发者ID:swk,项目名称:bluebox,代码行数:32,代码来源:Standardize.php

示例3: label

 public function label($val = NULL)
 {
     if ($val === NULL) {
         // Do not display labels for checkboxes, labels wrap checkboxes
         return '';
     } else {
         $this->data['label'] = $val === TRUE ? utf8::ucwords(inflector::humanize($this->name)) : $val;
         return $this;
     }
 }
开发者ID:Juuro,项目名称:Dreamapp-Website,代码行数:10,代码来源:Form_Checkbox.php

示例4: label

 public function label($val = nil)
 {
     if ($val === nil) {
         if ($label = $this->data['label']) {
             return $this->data['label'];
         }
     } else {
         $this->data['label'] = $val === YES ? ucwords(inflector::humanize($this->data['name'])) : $val;
         return $this;
     }
 }
开发者ID:enormego,项目名称:EightPHP,代码行数:11,代码来源:group.php

示例5: label

 public function label($val = NULL)
 {
     if ($val === NULL) {
         if ($label = $this->data['label']) {
             return html::purify($this->data['label']);
         }
     } else {
         $this->data['label'] = $val === TRUE ? ucwords(inflector::humanize($this->data['name'])) : $val;
         return $this;
     }
 }
开发者ID:JasonWiki,项目名称:docs,代码行数:11,代码来源:Form_Group.php

示例6: initialize

 /**
  *
  * @param Yada_Meta $meta
  * @param Yada_Model $model
  * @param <type> $name
  * @param <type> $alias
  */
 public function initialize(Yada_Meta $meta, Yada_Model $model, $name, $alias)
 {
     $this->meta = $meta;
     // This will come in handy for setting complex relationships
     $this->model = $model;
     // This is for naming form fields
     $this->name = $name;
     // This is the alias of the table
     $this->alias = $alias;
     // Check for a name, because we can easily provide a default
     if (!$this->label) {
         $this->label = inflector::humanize($name);
     }
 }
开发者ID:jerfowler,项目名称:yada,代码行数:21,代码来源:core.php

示例7: action_index

 public function action_index()
 {
     // Get all methods
     $methods = get_class_methods($this);
     // Start a new test list
     $tests = array();
     foreach ($methods as $method) {
         if (strpos($method, 'action_') === 0 and $method !== 'action_index') {
             // Remove "action" prefix
             $method = substr($method, 7);
             // Add the method to the test list
             $tests[$this->request->url(array('action' => $method))] = $method;
         }
     }
     // Get the controller name
     $controller = inflector::humanize(substr(get_class($this), 16));
     // Show the test list
     $this->request->response = View::factory('test/index')->set('controller', $controller)->set('tests', $tests);
 }
开发者ID:ukd1,项目名称:kohana,代码行数:19,代码来源:test.php

示例8: listPackages

 /**
  * This function scans the bluebox module path for configure files and returns a list
  * of packages.
  *
  * @return array
  * @param string $category[optional]
  * @param bool $ignoreDB[optional] If this is set to true then we will not consider the installed modules
  */
 public static function listPackages($filter = array(), $ignoreDB = false)
 {
     // Reset the error and warning vars, also create a instance if it doesnt exist
     self::init();
     // Initialize a empty packages array
     $packages = array();
     // Check if there are any filters
     if (!empty($filter)) {
         // If we are only supplied with a string then assume it is a inlcude filter
         if (is_string($filter)) {
             $filter = array('include' => array($filter));
             // If we are given a one dimentional array then assume it is also an include filter
         } else {
             if (is_array($filter) && empty($filter['include']) && empty($filter['exclude'])) {
                 $filter = array('include' => $filter);
             }
         }
         // Ensure are sub-keys are arrays themselfs
         if (!empty($filter['include']) && is_string($filter['include'])) {
             $filter['include'] = array($filter['include']);
         }
         if (!empty($filter['exclude']) && is_string($filter['exclude'])) {
             $filter['exclude'] = array($filter['exclude']);
         }
     }
     if (!is_array($filter)) {
         $filter = array();
     }
     // Merge the corrected filters array with the defaults to fill in any blanks
     $filter = array_merge(array('include' => array(), 'exclude' => array()), $filter);
     // Get a list of what's already installed. Defaults to modules, but can be languages, telephony drivers, etc.
     $configurations = glob(MODPATH . '*/configure.php', GLOB_MARK);
     // Run through all the config files and include them
     foreach ($configurations as $configuration) {
         // Add what we think might be a configure.php file
         $declaredBefore = get_declared_classes();
         require_once $configuration;
         // Get the last added class
         $declaredAfter = get_declared_classes();
         if (count($declaredBefore) == count($declaredAfter)) {
             continue;
         }
         $foundClass = end($declaredAfter);
         // Check if we found a Bluebox_Configure class
         if ($foundClass && is_subclass_of($foundClass, 'Bluebox_Configure')) {
             // If we have found a configure class add it to the list
             self::$configurations[$foundClass] = $configuration;
         }
     }
     // Run down the array of configuration classes that where found during this session
     foreach (self::$configurations as $class => $configuration) {
         // Get a list of all the static vars of this class
         $packageVars = get_class_vars($class);
         // If the moduleName is empty use the class name
         if (empty($packageVars['packageName'])) {
             $packageVars['packageName'] = str_replace('_Configure', '', $class);
         }
         // moduleName is used in a lot of places, and I am lazy ;)
         $packageName = $packageVars['packageName'];
         // If this module is already been loaded into the modules array skip the rest of this
         if (array_key_exists($packageName, $packages)) {
             continue;
         }
         // If there is no displayName specified then attempt to make a pretty version of moduleName
         if (empty($packageVars['displayName'])) {
             $packageVars['displayName'] = ucfirst(inflector::humanize($packageName));
         }
         // make sure the defualt value is a bool
         if (!is_bool($packageVars['default'])) {
             $packageVars['default'] = false;
         }
         // make sure to save the directory to the module arrays
         $packageVars['directory'] = dirname(str_replace(DOCROOT, '', $configuration));
         // Standardize the type list
         //            if (!defined('Bluebox_Installer::' . $packageVars['type']))
         //            {
         //                $packageVars['type'] = Bluebox_Installer::TYPE_DEFAULT;
         //            }
         if ($packageVars['type'] == Bluebox_Installer::TYPE_DEFAULT) {
             kohana::log('alert', 'Module ' . $packageName . ' is using the default package type!');
         }
         // Standardize the required list as an array, assuming they ment core if only a string
         $packageVars['required'] = is_string($packageVars['required']) ? array('core' => $packageVars['required']) : $packageVars['required'];
         // Save the name of the configuration class
         $packageVars['configureClass'] = $class;
         // Default installedAs and action
         $packageVars['installedAs'] = FALSE;
         $packageVars['action'] = FALSE;
         // if the navStructures array is missing or not an array build it from the individual values
         if (!isset($packageVars['navStructures']) || !is_array($packageVars['navStructures'])) {
             if (!is_null($packageVars['navURL'])) {
                 $packageVars['navStructures'] = array(array_intersect_key($packageVars, array_flip(array('navBranch', 'navURL', 'navLabel', 'navSummary', 'navSubmenu'))));
//.........这里部分代码省略.........
开发者ID:swk,项目名称:bluebox,代码行数:101,代码来源:Bluebox_Installer.php

示例9: label

 /**
  * Creates an HTML form label tag.
  *
  * @param   string|array  label "for" name or an array of HTML attributes
  * @param   string        label text or HTML
  * @param   string        a string to be attached to the end of the attributes
  * @return  string
  */
 public static function label($data = '', $text = NULL, $extra = '')
 {
     if (!is_array($data)) {
         if (is_string($data)) {
             // Specify the input this label is for
             $data = array('for' => $data);
         } else {
             // No input specified
             $data = array();
         }
     }
     if ($text === NULL and isset($data['for'])) {
         // Make the text the human-readable input name
         $text = ucwords(inflector::humanize($data['for']));
     }
     return '<label' . form::attributes($data) . ' ' . $extra . '>' . $text . '</label>';
 }
开发者ID:plusjade,项目名称:plusjade,代码行数:25,代码来源:form.php

示例10: targetList

 function targetList()
 {
     App::import('Lib', 'Migration.MigrationConfig');
     $targets = MigrationConfig::load('target_instances');
     $list = array();
     foreach ($targets as $key => $opt) {
         $list[$key] = !empty($opt['label']) ? $opt['label'] : __(inflector::humanize($key), true);
     }
     return $list;
 }
开发者ID:kevthunder,项目名称:cake-migration,代码行数:10,代码来源:migration.php

示例11: initialize

 /**
  * This is called after construction so that fields can finish
  * constructing themselves with a copy of the column it represents.
  *
  * @param   string  $model
  * @param   string  $column
  * @return  void
  **/
 public function initialize($model, $column)
 {
     // This will come in handy for setting complex relationships
     $this->model = $model;
     // This is for naming form fields
     $this->name = $column;
     if (!$this->column) {
         $this->column = $column;
     }
     // Check for a name, because we can easily provide a default
     if (!$this->label) {
         $this->label = inflector::humanize($column);
     }
 }
开发者ID:rcapp,项目名称:kohana-jelly,代码行数:22,代码来源:core.php

示例12: render

 /**
  * Render this element, this should be overloaded by each extention type
  *
  * @param string $content 
  * @param string $print 
  * @return string rendered content
  * @author Sam Clark
  */
 public function render(&$render_variables, $errors = array())
 {
     // Override the template name for this element if locally modified
     if (isset($this->template)) {
         $template_name = $this->template;
     } else {
         $template_name = Kohana::config('morf.elements.' . $this->type . '.template');
     }
     $result = array('template' => new View('morf/' . $template_name));
     if (!in_array($this->type, array('submit', 'hidden'))) {
         // Process post
         if ($this->post) {
             $this->_process_post();
         }
         // Discover if there is an error
         if (isset($this->attributes['name']) and $errors and array_key_exists($this->name, $errors)) {
             $this->add_class(Kohana::config('morf.errors.class'));
             $result['template']->error = $errors[$this->name];
         }
         if ($this->label === TRUE) {
             if (isset($this->attributes['name'])) {
                 $name = $this->name;
             } elseif (isset($this->attributes['id'])) {
                 $name = $this->id;
             } else {
                 $name = FALSE;
             }
             if ($name) {
                 $result['template']->label = form::label($this->name, ucwords(inflector::humanize($name)));
             }
         } elseif (is_string($this->label)) {
             $result['template']->label = form::label($this->name, $this->label);
         }
     }
     if ($this->type === 'file') {
         $upload = TRUE;
     }
     // Attributes
     $result['attributes'] = $this->_format_attributes();
     return $result;
 }
开发者ID:samsoir,项目名称:morf,代码行数:49,代码来源:Morf_Element.php

示例13: foreach

				</tfoot>

				<tbody>
					<?php 
foreach ($activity as $row) {
    ?>
					<tr>
						<td><?php 
    echo $row->user->first_name;
    ?>
 <?php 
    echo $row->user->last_name;
    ?>
</td>
						<td><?php 
    echo ucwords(inflector::humanize($row->action->name));
    ?>
</td>
						<td><?php 
    echo $row->details;
    ?>
</td>
						<td><?php 
    echo date('M j, Y \\@ g:i a', $row->created);
    ?>
</td>
					</tr>
					<?php 
}
?>
				</tbody>
开发者ID:ngonchan,项目名称:Kooshy,代码行数:31,代码来源:dashboard.php

示例14: isset

<dl>
	<?if (isset($error) OR isset($label)):?>
	<dt>
	<?if (isset($error)) : ?><?php 
echo $error;
?>
 <?endif;?><?if (isset($label)) :?><?php 
echo $label;
?>
<?endif;?>
	</dt>
	<?endif;?>
	<dd>
	<?if (isset($element)) : ?>
	<?foreach ($element as $text => $radio) :?>
		<p><?php 
echo $radio;
?>
 <?php 
echo inflector::humanize($text);
?>
</p>
	<?endforeach;?>
	<?endif;?>
	</dd>
</dl>
开发者ID:samsoir,项目名称:morf,代码行数:26,代码来源:radiogroup.php

示例15: breadcrumb

 /**
  * Generate a "breadcrumb" list of anchors representing the URI.
  *
  * @param   array   segments to use as breadcrumbs, defaults to using Router::$segments
  * @return  string
  */
 public static function breadcrumb($segments = NULL)
 {
     empty($segments) and $segments = Router::$segments;
     $array = array();
     while ($segment = array_pop($segments)) {
         $array[] = html::anchor(implode('/', $segments) . '/' . $segment, ucwords(inflector::humanize($segment)));
     }
     // Retrun the array of all the segments
     return array_reverse($array);
 }
开发者ID:Juuro,项目名称:Dreamapp-Website,代码行数:16,代码来源:html.php


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