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


PHP KInflector::humanize方法代码示例

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


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

示例1: _initialize

 /**
  * Initializes the default configuration for the object
  *
  * Called from {@link __construct()} as a first step of object instantiation.
  *
  * @param KConfig $config An optional KConfig object with configuration options.
  *
  * @return void
  */
 protected function _initialize(KConfig $config)
 {
     $package = KInflector::humanize($this->getIdentifier()->package);
     $name = KInflector::humanize(KInflector::pluralize($this->getName()));
     $config->append(array('title' => $package . ' - ' . $name));
     parent::_initialize($config);
 }
开发者ID:walteraries,项目名称:anahita,代码行数:16,代码来源:default.php

示例2: _splitview

 /**
  * Generates an HTML optionlist based on the distinct data from a model column.
  * 
  * The column used will be defined by the name -> value => column options in
  * cascading order. 
  * 
  * If no 'model' name is specified the model identifier will be created using 
  * the helper identifier. The model name will be the pluralised package name. 
  * 
  * If no 'value' option is specified the 'name' option will be used instead. 
  * If no 'text'  option is specified the 'value' option will be used instead.
  * 
  * @param 	array 	An optional array with configuration options
  * @return	string	Html
  * @see __call()
  */
 protected function _splitview($config = array())
 {
     $config = new KConfig($config);
     $config->append(array('id' => 'splitview', 'name' => '', 'package' => 'com_' . $this->getIdentifier()->package))->append(array('master_view' => KInflector::pluralize($config->name), 'detail_view' => KInflector::singularize($config->name)))->append(array('options' => array('master_url' => '?option=' . $config->package . '&view=' . $config->master_view . '&format=json&sort=created_on&direction=desc', 'detail_url' => '?option=' . $config->package . '&view=' . $config->detail_view . '&format=raw', 'label' => array('empty' => JText::_('No ' . KInflector::humanize($config->master_view) . '.'), 'select' => JText::_('No ' . KInflector::humanize($config->detail_view) . ' selected.')))));
     KFactory::get('admin::com.ninja.helper.default')->js('/splitview.js');
     KFactory::get('admin::com.ninja.helper.default')->js("\njQuery(function(\$){\n\t\t\t\$('#" . $config->id . "').splitview(" . json_encode($config->options->toArray()) . ");\n\t\t});\n");
     return '<div id="' . $config->id . '" class="splitview"></div>';
 }
开发者ID:ravenlife,项目名称:Ninja-Framework,代码行数:24,代码来源:splitview.php

示例3: _initialize

 /**
  * Initializes the options for the object
  *
  * Called from {@link __construct()} as a first step of object instantiation.
  *
  * @param   array   Options
  * @return  array   Options
  */
 protected function _initialize(KConfig $options)
 {
     $name = isset($options->name) ? $options->name : (string) $this->node['name'];
     $id = isset($options->id) ? $options->id : isset($this->node['id']) ? (string) $this->node['id'] : $name;
     $label = isset($this->node['label']) ? (string) $this->node['label'] : false;
     $label = $label ? $label : KInflector::humanize((string) $this->node['name']);
     $options->append(array('parent' => false, 'identifier' => null, 'group' => false, 'fetchTooltip' => true, 'name' => $name, 'id' => $id, 'label' => $label));
     parent::_initialize($options);
 }
开发者ID:ravenlife,项目名称:Ninja-Framework,代码行数:17,代码来源:abstract.php

示例4: _initialize

 /**
  * Initializes the config 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)
 {
     $config->append(array(
         'title'         => KInflector::humanize($this->getName()),
         'icon'          => $this->getName(),
         'controller'    => null,
     ));
     
     parent::_initialize($config);
 }
开发者ID:raeldc,项目名称:com_learn,代码行数:18,代码来源:abstract.php

示例5: display

 public function display()
 {
     $name = $this->getName();
     $toolbar = KFactory::get($this->getToolbar());
     $toolbar->setTitle('Jedi: ' . KInflector::humanize($this->getName()));
     //Apend enable and disbale button for all the list views
     if (KInflector::isPlural($name)) {
         $toolbar->append('divider')->append('enable')->append('disable');
     }
     return parent::display();
 }
开发者ID:ercanozkaya,项目名称:com_jedi,代码行数:11,代码来源:html.php

示例6: id

 /**
  * @param int The row index
  * @param int The record id
  * @param boolean
  * @param string The name of the form element
  * @return string
  */
 public function id($config = array())
 {
     $config = new KConfig($config);
     $config->append(array('value' => false, 'locked' => false, 'name' => 'id', 'label' => KInflector::humanize(KInflector::singularize(KRequest::get('get.view', 'cmd'))), 'checked' => false));
     if ($config->checked) {
         $config->checked = ' checked="checked"';
     }
     if ($config->locked) {
         return '';
     }
     return '<input type="checkbox" name="' . $config->name . '[]" class="id validate-reqchk-byname label:\'' . $config->label . '\'" value="' . $config->value . '"' . $config->checked . ' />';
 }
开发者ID:ravenlife,项目名称:Ninja-Framework,代码行数:19,代码来源:grid.php

示例7: __construct

 /**
  * Constructor
  *
  * @param   object  An optional KConfig object with configuration options
  */
 public function __construct(KConfig $config = null)
 {
     //If no config is passed create it
     if (!isset($config)) {
         $config = new KConfig();
     }
     parent::__construct($config);
     // Set the title
     $title = empty($config->title) ? KInflector::humanize($this->getName()) : $config->title;
     $this->setTitle($title);
     // Set the icon
     $this->setIcon($config->icon);
 }
开发者ID:ravenlife,项目名称:Ninja-Framework,代码行数:18,代码来源:abstract.php

示例8: getPermissions

 /**
  * Get a list over permissions for a group
  *
  * @param  int $id			The primary key
  * @return KDatabaseRowset
  */
 public function getPermissions($id)
 {
     $table = KFactory::get('admin::com.ninjaboard.database.table.assets');
     $query = $table->getDatabase()->getQuery();
     $prefx = $table->getDatabase()->getTablePrefix();
     $query->where('tbl.name', 'LIKE', 'com_ninjaboard.usergroup.' . $id . '.%');
     $permissions = array();
     foreach ($table->select($query, KDatabase::FETCH_ROWSET) as $permission) {
         $permission->column = end(explode('.', $permission->name));
         $permission->title = KInflector::humanize($permission->column);
         $permissions[$permission->column] = $permission;
     }
     return $permissions;
 }
开发者ID:ravenlife,项目名称:Ninjaboard,代码行数:20,代码来源:usergroups.php

示例9: __get

 /**
  * Retrieve row field value
  *
  * @param  	string 	The column name.
  * @return 	string 	The corresponding column value.
  */
 public function __get($column)
 {
     $result = parent::__get($column);
     if ($column != 'theme' || is_string($this->params) || !isset($this->params->board_details->theme)) {
         return $result;
     }
     if (!isset($this->_theme)) {
         if (!isset($this->_data['theme']) || !$this->_data['theme']) {
             $this->_data['theme'] = $this->params->board_details->theme;
         }
         $this->_theme = KInflector::humanize($this->_data['theme']);
     }
     return $this->_theme;
 }
开发者ID:ravenlife,项目名称:Ninjaboard,代码行数:20,代码来源:setting.php

示例10: display

 public function display()
 {
     if (!$this->getModel()->getTotal()) {
         return parent::display();
     }
     $this->_createToolbar()->prepend('spacer')->prepend(KFactory::get('admin::com.ninja.toolbar.button.modal', array('text' => 'Map', 'icon' => 'icon-32-map', 'link' => $this->createRoute('view=joomlausergroupmaps&tmpl=component'), 'y' => 470, 'handler' => 'iframe', 'ajaxOptions' => '{evalScripts:true}')));
     $permissions = array();
     $objects = KFactory::get('admin::com.ninjaboard.permissions')->getObjects();
     foreach ($objects as $permission) {
         $permissions[$permission] = KInflector::humanize($permission);
     }
     $this->assign('columns', $permissions);
     $this->assign('colspan', 4 + count($permissions));
     return parent::display();
 }
开发者ID:ravenlife,项目名称:Ninjaboard,代码行数:15,代码来源:html.php

示例11: _actionEdit

 protected function _actionEdit()
 {
     $identifier = $this->getIdentifier();
     $id = $identifier->type . '_' . $identifier->package . '.' . $identifier->name . '.';
     $data = KRequest::get('post', 'string');
     $assets = KFactory::get('admin::com.ninja.helper.access')->models->assets;
     $model = KFactory::get($assets);
     foreach ($data['access'] as $controller => $access) {
         $name = $id . $controller;
         $data = array('name' => $name, 'title' => KInflector::humanize($controller) . ' permissions', 'rules' => json_encode($access));
         $table = KFactory::get($model->getTable());
         $query = KFactory::tmp('lib.koowa.database.query')->where('name', '=', $name);
         $table->fetchRow($query)->setData($data)->save();
     }
     $this->_redirect = 'index.php?option=com_ninjaboard&view=permissions';
     return $this->getModel()->getList();
 }
开发者ID:ravenlife,项目名称:Ninjaboard,代码行数:17,代码来源:permission.php

示例12: pagination

 /**
  * Render item pagination
  *
  * @param	array $config	Configuration array
  * @return	string	Html
  * @see  	http://developer.yahoo.com/ypatterns/navigation/pagination/
  */
 public function pagination($config = array())
 {
     $config = new KConfig($config);
     $config->append(array('total' => 0, 'display' => 5, 'ajax' => false, 'name' => $this->name));
     $this->_ajax = (bool) $config->ajax;
     if (is_string($config->ajax)) {
         $this->_ajax_layout = $config->ajax;
     }
     KFactory::get('admin::com.ninja.helper.default')->css('/pagination.css');
     // Paginator object
     $paginator = KFactory::tmp('lib.koowa.model.paginator')->setData(array('total' => $config->total, 'offset' => $config->offset, 'limit' => $config->limit, 'dispay' => $config->display));
     $view = $config->name;
     $items = (int) $config->total === 1 ? KInflector::singularize($view) : $view;
     if ($config->total <= 10) {
         return '<div class="pagination"><div class="limit">' . sprintf(JText::_('Listing %s ' . KInflector::humanize($items)), $config->total) . '</div></div>';
     }
     // Get the paginator data
     $list = $paginator->getList();
     $limitlist = $config->total > 10 ? $this->limit($config->toArray()) : $config->total;
     $html = '<div class="pagination">';
     $html .= '<div class="limit">' . sprintf(JText::_('Listing %s ' . KInflector::humanize($items)), $limitlist) . '</div>';
     $html .= $this->pages($list);
     $html .= '<div class="count"> ' . JText::_('Pages') . ' ' . $paginator->current . ' ' . JText::_('of') . ' ' . $paginator->count . '</div>';
     $html .= '</div>';
     if ($this->_ajax) {
         jimport('joomla.environment.browser');
         $uagent = JBrowser::getInstance()->getAgentString();
         $windoze = strpos($uagent, 'Windows') ? true : false;
         $url = clone KRequest::url();
         $url->fragment = 'offset=@{offset}';
         $formid = KFactory::tmp('admin::com.ninja.helper.default')->formid();
         $cookie = KRequest::get('cookie.' . $formid, 'string', false);
         $states = array('total' => $total, 'offset' => $offset, 'limit' => $limit, 'display' => $display);
         if ($cookie) {
             $merge = KHelperArray::merge(json_decode($cookie, true), $states);
             KRequest::set('cookie.' . $formid, json_encode($merge), 'string');
         }
         //Temp fix
         $cookie = false;
         $states = $cookie ? array() : array('state' => $states);
         KFactory::get('admin::com.ninja.helper.default')->js('/pagination.js');
         KFactory::get('admin::com.ninja.helper.default')->js('window.addEvent(\'domready\', function(){ $$(\'div.pagination\')[0].paginator(' . json_encode(array_merge(array('identificator' => $formid, 'text' => array('count' => sprintf(JText::_('Pages %s of %s'), '@{current}', '@{total}'), 'first' => sprintf(JText::_('%s First'), $windoze ? '<<' : '&#10094;&#10094;'), 'previous' => sprintf(JText::_('%s Previous'), $windoze ? '<' : '&#10094;'), 'next' => sprintf(JText::_('Next %s'), $windoze ? '>' : '&#10095;'), 'last' => sprintf(JText::_('Last %s'), $windoze ? '>>' : '&#10095;&#10095;'))), $states)) . '); });');
     }
     return $html;
 }
开发者ID:ravenlife,项目名称:Ninja-Framework,代码行数:52,代码来源:paginator.php

示例13: __construct

 public function __construct(KConfig $config)
 {
     parent::__construct($config);
     $lang =& JFactory::getLanguage();
     $orphans = $lang->getOrphans();
     if ($orphans) {
         ksort($orphans, SORT_STRING);
         $guesses = array();
         foreach ($orphans as $key => $occurance) {
             if (is_array($occurance) and isset($occurance[0])) {
                 $info =& $occurance[0];
                 $file = @$info['step']['file'];
                 $guess = str_replace('_', ' ', $info['string']);
                 // Integers isn't translatable
                 if (is_numeric($key) || strpos($key, '??') === 0 || strpos($guess, '&bull;') === 0) {
                     continue;
                 }
                 $guesses[] = array('file' => $file, 'keys' => strtoupper($key) . '=' . $guess);
             }
         }
         $append = false;
         foreach ($guesses as $guess) {
             if (!$guess['file'] || strpos($guess['file'], '/components/' . $config->option . '/') === false && strpos($guess['file'], '/components/com_ninja/') === false) {
                 continue;
             }
             $append .= "\n" . $guess['keys'];
         }
         if (!$append) {
             return;
         }
         $langfile = key($lang->getPaths($config->option));
         $readfile = JFile::read($langfile);
         $text = $readfile . "\n\n# " . KInflector::humanize(KRequest::get('get.view', 'cmd')) . "\n# @file     " . $guess['file'] . "\n# @url      " . KRequest::url() . "\n# @referrer " . KRequest::referrer() . "\n" . $append;
         JFile::write($langfile, $text);
         //echo $readfile;
         //die('<pre>'.var_export($langfile, true).'</pre>');
     }
     //die('<script type="text/javascript">console.log('.json_encode($orphans).')</script>');
 }
开发者ID:ravenlife,项目名称:Ninja-Framework,代码行数:39,代码来源:language.php

示例14: __construct

 /**
  * Constructor
  *
  * @param	array An optional associative array of configuration settings.
  */
 public function __construct(KConfig $options)
 {
     parent::__construct($options);
     if (!isset($this->_buttons)) {
         $this->_buttons = array();
     }
     $this->_name = empty($options->name) ? KRequest::get('get.view', 'cmd') : $options->name;
     $this->_title = empty($options->title) ? KInflector::humanize($this->getName()) : $options->title;
     KFactory::get('admin::com.ninja.helper.default')->css('/toolbar.css');
     KFactory::get('admin::com.ninja.helper.default')->js('/toolbar.js');
     if (KInflector::isSingular(KRequest::get('get.view', 'cmd', 'items'))) {
         KFactory::get('admin::com.ninja.helper.default')->js('window.addEvent(\'domready\',function(){if(formToolbar = $(\'' . KFactory::get('admin::com.ninja.helper.default')->formid() . '\')) formToolbar.addClass(\'validator-inline\');});');
     }
     if (KInflector::isPlural($this->getName())) {
         $this->append('new')->append('edit')->append('delete');
     } else {
         $this->append('save')->append('apply')->append('cancel');
     }
     $template = KFactory::get('lib.joomla.application')->getTemplate();
     $path = JPATH_THEMES . '/' . $template . '/html/com_' . $this->_identifier->package . '/toolbar';
     KFactory::get($this->getTemplate())->addPath($path);
     $this->setLayout('admin::com.ninja.view.toolbar.toolbar_render');
     $this->id = 'toolbar-' . $this->getName();
 }
开发者ID:ravenlife,项目名称:Ninja-Framework,代码行数:29,代码来源:html.php

示例15: append

 public function append($name = null, $attr = null, $msg = 'Add %s&hellip;')
 {
     if (!$name) {
         $name = $this->name;
     }
     $attributes = array('class' => $name, 'style' => '-moz-user-select: none', 'onselectstart' => 'return false;', 'ondragstart' => 'return false;', 'onclick' => "this.addClass('active'); return this;");
     if (is_string($attr)) {
         $attributes['href'] = $attr;
     } else {
         $attributes = array_merge($attributes, (array) $attr);
     }
     $icon = KFactory::get('admin::com.ninja.helper.default')->img('/32/' . $name . '.png');
     $style = '.placeholder .' . $attributes['class'] . ' > span { background-image: url(' . $icon . '); }';
     if ($icon) {
         KFactory::get('lib.joomla.document')->addStyleDeclaration($style);
     }
     $attributes['class'] .= ' button';
     $title = KInflector::humanize(KInflector::singularize($name));
     $text = sprintf(JText::_($msg), JText::_($title));
     if ($this->showButton) {
         $this->buttons[$name] = '<a ' . KHelperArray::toString($attributes) . '><span><span></span></span>' . $text . '</a>';
     }
     return $this;
 }
开发者ID:ravenlife,项目名称:Ninja-Framework,代码行数:24,代码来源:placeholder.php


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