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


PHP StringUtils::titleize方法代码示例

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


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

示例1: validateNode

 public function validateNode(Node $node, $mode = 'edit')
 {
     // Validates all fields, metas, and tags defined in the current scope
     $this->Logger->debug('Validating node [' . $node->getNodeRef() . '] with partials [' . $node->getNodePartials() . ']');
     // Fields
     // Check the model schema for NodeDBMeta to check fields
     foreach ($this->NodeDBMeta->getModelSchema() as $fieldName => $props) {
         $value = $node->{$fieldName};
         $fieldResolved = $this->resolveField($node->getNodeRef(), $fieldName);
         $title = isset($props['title']) ? $props['title'] : StringUtils::titleize($fieldName);
         $validation = $props['validation'];
         if ($fieldName == 'Slug' && $node->getNodeRef()->getElement()->isAllowSlugSlashes()) {
             $validation['datatype'] = 'slugwithslash';
         }
         if ($fieldName != 'Slug' || $fieldName == 'Slug' && !$this->getErrors()->hasFieldError($this->resolveField($node->getNodeRef(), 'Title'))) {
             $this->getErrors()->rejectIfInvalid($fieldResolved, 'field', $title, $value, new ValidationExpression($validation));
         }
     }
     // SCHEMA VALIDATION
     $schema = $node->getNodeRef()->getElement()->getSchema();
     // Validate tags scope
     // Find all meta tags and validate them against the partials string
     $this->validateMetaPartials($node->getNodePartials()->getMetaPartials(), $node->getMetas(), $schema);
     // Validate OutTag scope
     $node->setOutTags($this->validateTagPartials('out', $node->getNodePartials()->getOutPartials(), $node->getOutTags(), $schema));
     // Validate InTag scope
     $node->setInTags($this->validateTagPartials('in', $node->getNodePartials()->getInPartials(), $node->getInTags(), $schema));
     // Validate Sections scope
     //$this->validateSectionPartials($node->getNodePartials()->getSectionPartials(), $node->getSections(), $schema);
     // Validate metas
     $this->validateMetas($node, $node, $schema, $mode);
     // Validate tags
     $this->validateTags($node, $node, $schema);
     // Sections
     //        if (is_array($node->getSections())) {
     //            $section_type_counts = array();
     //            foreach( $node->getSections() as $key => $section ) {
     //                $section_type = $section->getSectionType();
     //                $section_def  = $schema->getSectionDef($section_type);
     //
     //                @$section_type_counts[$section_type]++;
     //
     //                $section_title = $section_def->Title;
     //                if ($section_def->Max == '*' || (integer)$section_def->Max > 1) {
     //                    $section_title .= " #" . $section_type_counts[$section_type];
     //                }
     //
     //                // Validate Schema Metas
     //                $this->validateMetas($node, $section, $section_def);
     //
     //                // Validate Schema Tags
     //                $this->validateTags($node, $section, $section_def);
     //            }
     //        }
     return $this->getErrors();
 }
开发者ID:wb-crowdfusion,项目名称:crowdfusion,代码行数:56,代码来源:NodeValidator.php


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