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


PHP sfInflector::humanize方法代码示例

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


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

示例1: compile

 protected function compile()
 {
     parent::compile();
     // ===================================
     // = Add for exporting configuration =
     // ===================================
     $this->configuration['credentials']['export'] = array();
     $this->configuration['export'] = array('fields' => array(), 'title' => $this->getExportTitle(), 'actions' => $this->getExportActions() ? $this->getExportActions() : array('_list' => array('action' => 'index', 'label' => 'Back')));
     $config = $this->getConfig();
     foreach (array_keys($config['default']) as $field) {
         $formConfig = array_merge($config['default'][$field], isset($config['form'][$field]) ? $config['form'][$field] : array());
         $this->configuration['export']['fields'][$field] = new sfModelGeneratorConfigurationField($field, array_merge(array('label' => sfInflector::humanize(sfInflector::underscore($field))), $config['default'][$field], isset($config['export'][$field]) ? $config['export'][$field] : array()));
     }
     foreach ($this->getExportDisplay() as $field) {
         list($field, $flag) = sfModelGeneratorConfigurationField::splitFieldWithFlag($field);
         $this->configuration['export']['fields'][$field] = new sfModelGeneratorConfigurationField($field, array_merge(array('type' => 'Text', 'label' => sfInflector::humanize(sfInflector::underscore($field))), isset($config['default'][$field]) ? $config['default'][$field] : array(), isset($config['export'][$field]) ? $config['export'][$field] : array(), array('flag' => $flag)));
     }
     // export actions
     foreach ($this->configuration['export']['actions'] as $action => $parameters) {
         $this->configuration['export']['actions'][$action] = $this->fixActionParameters($action, $parameters);
     }
     $this->configuration['export']['display'] = array();
     foreach ($this->getExportDisplay() as $name) {
         list($name, $flag) = sfModelGeneratorConfigurationField::splitFieldWithFlag($name);
         if (!isset($this->configuration['export']['fields'][$name])) {
             throw new InvalidArgumentException(sprintf('The field "%s" does not exist.', $name));
         }
         $field = $this->configuration['export']['fields'][$name];
         $field->setFlag($flag);
         $this->configuration['export']['display'][$name] = $field;
     }
 }
开发者ID:bshaffer,项目名称:Symfony-Snippets,代码行数:32,代码来源:csModelGeneratorConfiguration.class.php

示例2: addFields

 public function addFields()
 {
     // Information object attribute (db column) to perform s/r on
     $map = new InformationObjectI18nTableMap();
     foreach ($map->getColumns() as $col) {
         if (!$col->isPrimaryKey() && !$col->isForeignKey()) {
             $col_name = $col->getPhpName();
             $choices[$col_name] = sfInflector::humanize(sfInflector::underscore($col_name));
         }
     }
     $this->form->setValidator('column', new sfValidatorString());
     $this->form->setWidget('column', new sfWidgetFormSelect(array('choices' => $choices), array('style' => 'width: auto')));
     // Search-replace values
     $this->form->setValidator('pattern', new sfValidatorString());
     $this->form->setWidget('pattern', new sfWidgetFormInput());
     $this->form->setValidator('replacement', new sfValidatorString());
     $this->form->setWidget('replacement', new sfWidgetFormInput());
     $this->form->setValidator('caseSensitive', new sfValidatorBoolean());
     $this->form->setWidget('caseSensitive', new sfWidgetFormInputCheckbox());
     $this->form->setValidator('allowRegex', new sfValidatorBoolean());
     $this->form->setWidget('allowRegex', new sfWidgetFormInputCheckbox());
     if ($this->request->isMethod('post') && !isset($this->request->confirm) && !empty($this->request->pattern) && !empty($this->request->replacement)) {
         $this->form->setValidator('confirm', new sfValidatorBoolean());
         $this->form->setWidget('confirm', new sfWidgetFormInputHidden(array(), array('value' => true)));
     }
 }
开发者ID:nurfiantara,项目名称:ehri-ica-atom,代码行数:26,代码来源:globalReplaceAction.class.php

示例3: processSave

 /**
  * Saving changed page information
  *
  * @return afResponse
  * @author Sergey Startsev
  */
 protected function processSave()
 {
     // Getting needed parameters - page, application name, and sure definition
     $page_name = pathinfo($this->getParameter('page'), PATHINFO_FILENAME);
     $application = $this->getParameter('app');
     $definition = $this->getParameter('definition', array());
     $module = $this->getParameter('module', self::PAGES_MODULE);
     $permissions = new Permissions();
     $is_writable = $permissions->isWritable(sfConfig::get('sf_apps_dir') . '/' . $application . '/config/pages/');
     if ($is_writable !== true) {
         return $is_writable;
     }
     //idXml is stored inside the portal_state table from appFlowerPlugin
     $idXml = "pages/{$page_name}";
     $page = afsPageModelHelper::retrieve($page_name, $application);
     $is_new = $page->isNew();
     $page->setTitle(sfInflector::humanize(sfInflector::underscore($page_name)));
     $page->setDefinition($definition);
     $saveResponse = $page->save();
     $response = afResponseHelper::create();
     if ($saveResponse->getParameter(afResponseSuccessDecorator::IDENTIFICATOR)) {
         $console = afStudioConsole::getInstance()->execute(array("sf appflower:portal-state-cc {$idXml}", "sf appflower:validator-cache frontend cache yes", 'sf afs:fix-perms'));
         return $response->success(true)->content(!$is_new ? sprintf('Page <b>%s</b> has been saved', $page_name) : sprintf('Page <b>%s</b> has been created', $page_name))->console($console);
     }
     $response->success(false);
     if ($saveResponse->hasParameter(afResponseMessageDecorator::IDENTIFICATOR)) {
         $response->content($saveResponse->getParameter(afResponseMessageDecorator::IDENTIFICATOR));
     }
     return $response;
 }
开发者ID:cbsistem,项目名称:appflower_studio,代码行数:36,代码来源:afStudioLayoutCommand.class.php

示例4: setup

  public function setup($options, $parameters = array())
  {
    $ret = parent::setup($options, $parameters);

    $this->humanizedModuleName = sfInflector::humanize($this->moduleName);

    return $ret;
  }
开发者ID:nurhidayatullah,项目名称:inventory,代码行数:8,代码来源:crudBrowserAdmin15.class.php

示例5: getGenereatedLabel

 public function getGenereatedLabel($name)
 {
     $label = $this->getLabel();
     if (null === $label) {
         $label = sfInflector::humanize($name);
     }
     return $label;
 }
开发者ID:nykopol,项目名称:sfExtraDoctrinePagerPlugin,代码行数:8,代码来源:sfWidgetPagerColumn.class.php

示例6: configure

 public function configure()
 {
     $target = $this->getOption('target');
     $options = array('file_src' => '', 'is_image' => true, 'with_delete' => false, 'label' => sfInflector::humanize($target));
     sfContext::getInstance()->getConfiguration()->loadHelpers('Partial');
     $options['template'] = get_partial('opSkinClassicPlugin/formEditImage', array('target' => $target));
     $this->setWidget('image', new sfWidgetFormInputFileEditable($options, array('size' => 10)));
     $this->setValidator('image', new opValidatorImageFile(array('required' => true)));
     $this->widgetSchema->setNameFormat('image[' . $target . '][%s]');
 }
开发者ID:kawahara,项目名称:OpenPNE3,代码行数:10,代码来源:opSkinClassicImageForm.class.php

示例7: configure

 public function configure()
 {
     foreach (opSkinClassicConfig::getAllowdColors() as $color) {
         $this->setWidget($color, new sfWidgetFormInputText());
         $this->widgetSchema->setLabel($color, sfInflector::humanize($color));
         $this->setValidator($color, new sfValidatorCallback(array('callback' => array('opSkinClassicColorForm', 'validateHex'))));
         $this->setDefault($color, opSkinClassicConfig::get($color));
     }
     $this->widgetSchema->setNameFormat('color[%s]');
 }
开发者ID:kawahara,项目名称:OpenPNE3,代码行数:10,代码来源:opSkinClassicColorForm.class.php

示例8: run

 /**
  * Runs all test methods
  * 
  * @return null
  */
 public function run()
 {
     foreach ($this->getTestMethods() as $method) {
         $test = $method->getName();
         $this->info(sfInflector::humanize(sfInflector::underscore(substr($test, 4))));
         $this->setUp();
         $this->{$test}();
         $this->tearDown();
     }
 }
开发者ID:jakzal,项目名称:gyImagenePlugin,代码行数:15,代码来源:gyLimeTest.class.php

示例9: getThemeWidgetAndValidator

 /**
  * Builds and returns an array with the widget and validator to use with
  * any choice field for a theme
  *
  * @return array $widgetAndValidator
  */
 public function getThemeWidgetAndValidator()
 {
     $themes = sfApplicationConfiguration::getActive()->getPluginConfiguration('sfThemePlugin')->getThemeManager()->getAvailableThemes();
     $options = array('' => '');
     foreach ($themes as $name => $theme) {
         $options[$name] = sfInflector::humanize($name);
     }
     $widget = new sfWidgetFormChoice(array('choices' => $options));
     $validator = new sfValidatorChoice(array('choices' => array_keys($options), 'required' => false));
     return array('widget' => $widget, 'validator' => $validator);
 }
开发者ID:rafaelgou,项目名称:sfThemePlugin,代码行数:17,代码来源:sfThemeToolkit.class.php

示例10: getConfig

 /**
  * Returns the configuration value for a given key.
  *
  * If the key is null, the method returns all the configuration array.
  *
  * @param  string  $key     A key string
  * @param  mixed   $default The default value if the key does not exist
  * @param  Boolean $escaped Whether to escape single quote (false by default)
  *
  * @return mixed   The configuration value associated with the key
  */
 public function getConfig($key = null, $default = null, $escaped = false)
 {
     if (is_null($key)) {
         return $this->config;
     }
     if ('label' == $key && !isset($this->config['label'])) {
         return sfInflector::humanize(sfInflector::underscore($this->name));
     }
     $value = sfModelGeneratorConfiguration::getFieldConfigValue($this->config, $key, $default);
     return $escaped ? str_replace("'", "\\'", $value) : $value;
 }
开发者ID:WIZARDISHUNGRY,项目名称:symfony,代码行数:22,代码来源:sfModelGeneratorConfigurationField.class.php

示例11: _getOrCreateSite

 /**
  * Ensures that the site record has been created
  */
 protected function _getOrCreateSite($arguments, $options)
 {
     $site = Doctrine_Core::getTable('sfSympalSite')->createQuery('s')->where('s.slug = ?', $arguments['site'])->fetchOne();
     if (!$site) {
         $this->logSection('sympal', 'Creating new site record in database...');
         $site = new sfSympalSite();
         $site->title = sfInflector::humanize($arguments['site']);
         $site->slug = $arguments['site'];
     }
     $site->save();
     return $site;
 }
开发者ID:sympal,项目名称:sympal,代码行数:15,代码来源:sfSympalCreateSiteTask.class.php

示例12: setup

 /**
  * @see rtSiteForm
  */
 public function setup()
 {
     parent::setup();
     $social_media_locations = array('devour_url', 'facebook_url', 'flickr_url', 'google_plus_url', 'instagram_url', 'pinterest_url', 'tumblr_url', 'twitter_url', 'vimeo_url', 'youtube_url', 'linkedin_url');
     $this->useFields(array_merge($social_media_locations, array('title', 'sub_title', 'type', 'meta_title_suffix', 'meta_keyword_suffix', 'domain', 'reference_key', 'admin_email_address', 'content', 'published', 'html_snippet_suffix', 'email_signature', 'public_url', 'position', 'content_summery', 'email_contact_address', 'email_contact_response', 'email_booking_address', 'email_booking_response', 'redirects')));
     $this->widgetSchema->setLabel('meta_title_suffix', 'Meta Title Suffix');
     $this->widgetSchema->setHelp('meta_title_suffix', 'Will be glued as a suffix to the title meta tag content. Eg. "My Page Title | meta_title_suffix"');
     $this->widgetSchema['meta_title_suffix']->setAttribute('placeholder', 'Acme Consulting - Industry Leader for Consulting, Legal, Accounting');
     $this->widgetSchema->setLabel('meta_keyword_suffix', 'Meta Keyword Suffix');
     $this->widgetSchema->setHelp('meta_keyword_suffix', 'Will be glued as a suffix to the keywords meta tag content.');
     $this->widgetSchema['meta_keyword_suffix']->setAttribute('placeholder', 'consulting, legal, accounting');
     $categories = new rtSiteCategoriesToolkit();
     $this->setWidget('type', new sfWidgetFormChoice(array('choices' => $categories->getCategories())));
     $this->setWidget('content', $this->getWidgetFormTextarea());
     $this->widgetSchema->setLabel('content', 'Description');
     $this->setWidget('content_summery', new sfWidgetFormTextarea());
     $this->widgetSchema->setLabel('content_summery', 'Brief Description');
     $this->widgetSchema->setLabel('public_url', 'Public URL');
     $this->setWidget('email_contact_response', new sfWidgetFormTextarea());
     $this->widgetSchema->setLabel('email_contact_address', 'Email Address');
     $this->widgetSchema->setLabel('email_contact_response', 'Response');
     $this->setWidget('email_booking_response', new sfWidgetFormTextarea());
     $this->widgetSchema->setLabel('email_booking_address', 'Email Address');
     $this->widgetSchema->setLabel('email_booking_response', 'Response');
     // Social Media
     foreach ($social_media_locations as $k => $v) {
         $this->widgetSchema->setLabel($v, str_replace('url', 'URL', sfInflector::humanize($v)));
         $this->setValidator($v, new sfValidatorUrl(array('required' => false), array('invalid' => 'Must be a valid URL, eg. https://www.acme.com/...')));
     }
     $this->setWidget('html_snippet_suffix', new sfWidgetFormTextarea());
     $this->widgetSchema->setLabel('html_snippet_suffix', 'Included HTML');
     $this->setWidget('redirects', new sfWidgetFormTextarea());
     $this->widgetSchema->setLabel('redirects', 'HTTP Redirects (YAML)');
     $this->widgetSchema->setHelp('redirects', 'Set of YAML formatted arrays Eg. "- /old-page.html, /new-page, 301"');
     // Populate position dropdown
     $query = Doctrine::getTable('rtSite')->getQuery()->andWhere('site.position is not null');
     if (!$this->isNew()) {
         $query->andWhere('site.id != ?', $this->getObject()->getId());
     }
     $query->orderBy('site.position ASC');
     $site_positions = array();
     $site_positions[1] = 'First';
     $i = 2;
     foreach ($query->execute() as $tw_job) {
         $site_positions[$i] = 'Below ' . $tw_job->getTitle();
         $i++;
     }
     $this->setValidator('admin_email_address', new sfValidatorEmail(array('required' => true), array('invalid' => 'Must be a valid email address')));
     $this->widgetSchema['position'] = new sfWidgetFormSelect(array('choices' => $site_positions));
     $this->setValidator('public_url', new sfValidatorUrl(array('required' => false), array('invalid' => 'Must be a valid URL, eg. http://example.com')));
     $this->setEmbeddedForms();
 }
开发者ID:pierswarmers,项目名称:rtCorePlugin,代码行数:55,代码来源:PluginrtSiteForm.class.php

示例13: getSlotAction

 /**
  * Returns HTML code for slot action.
  *
  * @param string  $actionName   The action name
  * @param array   $params       The parameters
  * @param boolean $pk_link      Whether to add a primary key link or not
  *
  * @return string HTML code
  */
 public function getSlotAction($actionName, $params, $pk_link = false)
 {
     $action = isset($params['action']) ? $params['action'] : 'List' . sfInflector::camelize($actionName);
     //Default parameters definition
     $params['params'] = isset($params['params']) ? $params['params'] : array();
     $params['label'] = isset($params['label']) ? $params['label'] : sfInflector::humanize($params['action']);
     $params['icon'] = isset($params['icon']) ? $params['icon'] : $this->getDefaultValue('slot.icon');
     $params['params']['class'] = isset($params['params']['class']) ? $params['params']['class'] : $this->getDefaultValue('slot.class');
     $params['params']['image_class'] = isset($params['params']['image_class']) ? $params['params']['image_class'] : $this->getDefaultValue('slot.image_class');
     $params['params']['text_class'] = isset($params['params']['text_class']) ? $params['params']['text_class'] : $this->getDefaultValue('slot.text_class');
     $url_params = $pk_link ? '?' . $this->getPrimaryKeyUrlParams() : '\'';
     $content = '$helper->getSlotActionImage(' . $this->asPhp($params) . ') . $helper->getSlotActionText(' . $this->asPhp($params) . ')';
     return '[?php echo link_to(' . $content . ', \'' . $this->getModuleName() . '/' . $action . $url_params . ', ' . $this->asPhp($params['params']) . ', \'' . $this->getI18nCatalogue() . '\') ?]';
 }
开发者ID:nvidela,项目名称:kimkelen,代码行数:23,代码来源:sfPropelRevisitedGenerator.class.php

示例14: _renderValue

 /**
  * Render a value of a single server check unit
  *
  * @param string $value
  * @param sfSympalServerCheckUnit $unit 
  * @return string $renderedValue
  */
 protected function _renderValue($value, sfSympalServerCheckUnit $unit)
 {
     switch ($unit->getType()) {
         case sfSympalServerCheckUnit::TYPE_BOOL:
             $response = $value ? 'ON' : 'OFF';
             break;
         case sfSympalServerCheckUnit::TYPE_BYTE:
             $response = sfInflector::humanize($value);
             break;
         default:
             $response = $value ? $value : '-';
     }
     return $response;
 }
开发者ID:sympal,项目名称:sympal,代码行数:21,代码来源:sfSympalServerCheckRenderer.class.php

示例15: addField

 public function addField($space, $name, $options = array())
 {
     $type = isset($options['type']) ? strtolower($options['type']) : 'text';
     $class = sfInflector::classify($type) . 'ConfigField';
     if (class_exists($class)) {
         if (!isset($options['options']['label'])) {
             $options['options']['label'] = sfInflector::humanize($name);
         }
         $this->_fields[$space][$name] = new $class($options['options']);
         $this->widgetSchema[$space][$name] = $this->_fields[$space][$name]->getWidget();
         $this->validatorSchema[$space][$name] = $this->_fields[$space][$name]->getValidator();
     } else {
         throw new InvalidArgumentException('This field type doesn\'t, you need to create a classe named ' . $class);
     }
 }
开发者ID:benji07,项目名称:myConfigurationPlugin,代码行数:15,代码来源:myParamsForm.class.php


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