本文整理汇总了PHP中Cake\Utility\Inflector::rules方法的典型用法代码示例。如果您正苦于以下问题:PHP Inflector::rules方法的具体用法?PHP Inflector::rules怎么用?PHP Inflector::rules使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cake\Utility\Inflector
的用法示例。
在下文中一共展示了Inflector::rules方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testCustomRuleWithReset
/**
* Test resetting inflection rules.
*
* @return void
*/
public function testCustomRuleWithReset()
{
$uninflected = ['atlas', 'lapis', 'onibus', 'pires', 'virus', '.*x'];
$pluralIrregular = ['as' => 'ases'];
Inflector::rules('singular', ['/^(.*)(a|e|o|u)is$/i' => '\\1\\2l'], true);
Inflector::rules('plural', ['/^(.*)(a|e|o|u)l$/i' => '\\1\\2is'], true);
Inflector::rules('uninflected', $uninflected, true);
Inflector::rules('irregular', $pluralIrregular, true);
$this->assertEquals('Alcoois', Inflector::pluralize('Alcool'));
$this->assertEquals('Atlas', Inflector::pluralize('Atlas'));
$this->assertEquals('Alcool', Inflector::singularize('Alcoois'));
$this->assertEquals('Atlas', Inflector::singularize('Atlas'));
}
示例2: function
});
Request::addDetector('tablet', function ($request) {
$detector = new \Detection\MobileDetect();
return $detector->isTablet();
});
/**
* Custom Inflector rules, can be set to correctly pluralize or singularize
* table, model, controller names or whatever other string is passed to the
* inflection functions.
*
* Inflector::rules('plural', ['/^(inflect)or$/i' => '\1ables']);
* Inflector::rules('irregular' => ['red' => 'redlings']);
* Inflector::rules('uninflected', ['dontinflectme']);
* Inflector::rules('transliteration', ['/å/' => 'aa']);
*/
Inflector::rules('uninflected', ['activity']);
/**
* Plugins need to be loaded manually, you can either load them one by one or all of them in a single call
* Uncomment one of the lines below, as you need. make sure you read the documentation on Plugin to use more
* advanced ways of loading plugins
*
* Plugin::loadAll(); // Loads all plugins at once
* Plugin::load('Migrations'); //Loads a single plugin named Migrations
*
*/
Plugin::load('Migrations');
// Only try to load DebugKit in development mode
// Debug Kit should not be installed on a production system
if (Configure::read('debug')) {
Plugin::load('DebugKit', ['bootstrap' => true]);
}
示例3: testCustomRuleWithReset
/**
* Test resetting inflection rules.
*
* @return void
*/
public function testCustomRuleWithReset()
{
$uninflected = array('atlas', 'lapis', 'onibus', 'pires', 'virus', '.*x');
$pluralIrregular = array('as' => 'ases');
Inflector::rules('singular', array('rules' => array('/^(.*)(a|e|o|u)is$/i' => '\\1\\2l'), 'uninflected' => $uninflected), true);
Inflector::rules('plural', array('rules' => array('/^(.*)(a|e|o|u)l$/i' => '\\1\\2is'), 'uninflected' => $uninflected, 'irregular' => $pluralIrregular), true);
$this->assertEquals(Inflector::pluralize('Alcool'), 'Alcoois');
$this->assertEquals(Inflector::pluralize('Atlas'), 'Atlas');
$this->assertEquals(Inflector::singularize('Alcoois'), 'Alcool');
$this->assertEquals(Inflector::singularize('Atlas'), 'Atlas');
}
示例4: function
});
Request::addDetector('tablet', function ($request) {
$detector = new \Detection\MobileDetect();
return $detector->isTablet();
});
/**
* Custom Inflector rules, can be set to correctly pluralize or singularize
* table, model, controller names or whatever other string is passed to the
* inflection functions.
*
* Inflector::rules('plural', ['/^(inflect)or$/i' => '\1ables']);
* Inflector::rules('irregular', ['red' => 'redlings']);
* Inflector::rules('uninflected', ['dontinflectme']);
* Inflector::rules('transliteration', ['/å/' => 'aa']);
*/
Inflector::rules('irregular', ['clazz' => 'clazzes']);
/**
* Plugins need to be loaded manually, you can either load them one by one or all of them in a single call
* Uncomment one of the lines below, as you need. make sure you read the documentation on Plugin to use more
* advanced ways of loading plugins
*
* Plugin::loadAll(); // Loads all plugins at once
* Plugin::load('Migrations'); //Loads a single plugin named Migrations
*
*/
Plugin::load('Migrations');
// Only try to load DebugKit in development mode
// Debug Kit should not be installed on a production system
if (Configure::read('debug')) {
//Plugin::load('DebugKit', ['bootstrap' => true]);
}
示例5: strpos
define('COMPANY_EMAIL', 'info@xxx.xxx.x');
define('COMPANY_LOGO_TEXT', 'Quisque egestas efficitur magna, in congue velit congue semper.');
define('COMPANY_SLOGAN', 'Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit.');
define('COMPANY_SLOGAN_2', 'Lorem Ipsum');
define('ARTICLE_STATUS_ACTIVE', 1);
define('ARTICLE_STATUS_INACTIVE', 2);
define('ARTICLE_TYPE_SYSTEM', 4);
define('ARTICLE_TIMESTAMP', false);
define('ARTICLE_SHOW_RELATED', true);
define('NAV_MENU_CACHE', false);
define('COMM_NEW', 1);
define('COMM_PENDING', 2);
define('COMM_COMPLETED', 3);
define('COMM_DELAYED', 4);
define('WEBSITE_DOMAIN', 'thiswebsite.com');
define('GA_SITE_ID', strpos(env('SERVER_SOFTWARE'), 'PHP') ? 'UA-XXXXXXXX' : 'UA-YYYYYYYY-Y');
//Plugin::load('Cache');
Plugin::load('Bootstrap');
Plugin::load('AssetCompress', ['bootstrap' => true]);
/**
* Custom Inflector rules, can be set to correctly pluralize or singularize
* table, model, controller names or whatever other string is passed to the
* inflection functions.
*
* Inflector::rules('plural', ['/^(inflect)or$/i' => '\1ables']);
* Inflector::rules('irregular' => ['red' => 'redlings']);
* Inflector::rules('uninflected', ['dontinflectme']);
* Inflector::rules('transliteration', ['/å/' => 'aa']);
*/
Inflector::rules('uninflected', ['comms']);
示例6:
/**
* Custom Inflector rules, can be set to correctly pluralize or singularize
* table, model, controller names or whatever other string is passed to the
* inflection functions.
*
* Inflector::rules('plural', ['/^(inflect)or$/i' => '\1ables']);
* Inflector::rules('irregular', ['red' => 'redlings']);
* Inflector::rules('uninflected', ['dontinflectme']);
* Inflector::rules('transliteration', ['/å/' => 'aa']);
*/
Inflector::rules('transliteration', ['/å/' => 'aa']);
Inflector::rules('transliteration', ['/æ/' => 'ae']);
Inflector::rules('transliteration', ['/ø/' => 'oe']);
Inflector::rules('transliteration', ['/Å/' => 'Aa']);
Inflector::rules('transliteration', ['/Æ/' => 'Ae']);
Inflector::rules('transliteration', ['/Ø/' => 'Oe']);
/**
* Plugins need to be loaded manually, you can either load them one by one or all of them in a single call
* Uncomment one of the lines below, as you need. make sure you read the documentation on Plugin to use more
* advanced ways of loading plugins
*
* Plugin::loadAll(); // Loads all plugins at once
* Plugin::load('Migrations'); //Loads a single plugin named Migrations
*
*/
Plugin::load('Migrations');
// Only try to load DebugKit in development mode
// Debug Kit should not be installed on a production system
if (Configure::read('debug')) {
Plugin::load('DebugKit', ['bootstrap' => true]);
}
示例7:
<?php
/**
* Ajustes das inflections para português
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @filesource
* @author Juan Basso <jrbasso@gmail.com>
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
* @link http://wiki.github.com/jrbasso/cake_ptbr/inflections
*/
use Cake\Utility\Inflector;
// Alteração do inflector
Inflector::rules('singular', ['/^(.*)(oes|aes|aos)$/i' => '\\1ao', '/^(.*)(a|e|o|u)is$/i' => '\\1\\2l', '/^(.*)e?is$/i' => '\\1il', '/^(.*)(r|s|z)es$/i' => '\\1\\2', '/^(.*)ns$/i' => '\\1m', '/^(.*)s$/i' => '\\1']);
Inflector::rules('plural', ['/^(.*)ao$/i' => '\\1oes', '/^(.*)(r|s|z)$/i' => '\\1\\2es', '/^(.*)(a|e|o|u)l$/i' => '\\1\\2is', '/^(.*)il$/i' => '\\1is', '/^(.*)(m|n)$/i' => '\\1ns', '/^(.*)$/i' => '\\1s']);
Inflector::rules('uninflected', ['atlas', 'lapis', 'onibus', 'pires', 'virus', '.*x', 'status']);
Inflector::rules('irregular', ['abdomen' => 'abdomens', 'alemao' => 'alemaes', 'artesa' => 'artesaos', 'as' => 'ases', 'bencao' => 'bencaos', 'cao' => 'caes', 'campus' => 'campi', 'capelao' => 'capelaes', 'capitao' => 'capitaes', 'chao' => 'chaos', 'charlatao' => 'charlataes', 'cidadao' => 'cidadaos', 'consul' => 'consules', 'cristao' => 'cristaos', 'dificil' => 'dificeis', 'email' => 'emails', 'escrivao' => 'escrivaes', 'fossel' => 'fosseis', 'germens' => 'germen', 'grao' => 'graos', 'hifens' => 'hifen', 'irmao' => 'irmaos', 'liquens' => 'liquen', 'mal' => 'males', 'mao' => 'maos', 'orfao' => 'orfaos', 'pais' => 'paises', 'pai' => 'pais', 'pao' => 'paes', 'projetil' => 'projeteis', 'reptil' => 'repteis', 'sacristao' => 'sacristaes', 'sotao' => 'sotaos', 'tabeliao' => 'tabeliaes', 'gas' => 'gases', 'alcool' => 'alcoois']);
Inflector::rules('transliteration', ['À' => 'A', 'Á' => 'A', 'Â' => 'A', 'Ã' => 'A', 'Ä' => 'A', 'Å' => 'A', 'È' => 'E', 'É' => 'E', 'Ê' => 'E', 'Ë' => 'E', 'Ì' => 'I', 'Í' => 'I', 'Î' => 'I', 'Ï' => 'I', 'Ò' => 'O', 'Ó' => 'O', 'Ô' => 'O', 'Õ' => 'O', 'Ö' => 'O', 'Ø' => 'O', 'Ù' => 'U', 'Ú' => 'U', 'Û' => 'U', 'Ü' => 'U', 'Ç' => 'C', 'Ð' => 'D', 'Ñ' => 'N', 'Š' => 'S', 'Ý' => 'Y', 'Ÿ' => 'Y', 'Ž' => 'Z', 'Æ' => 'AE', 'ß' => 'ss', 'Œ' => 'OE', 'à' => 'a', 'á' => 'a', 'â' => 'a', 'ã' => 'a', 'ä' => 'a', 'å' => 'a', 'ª' => 'a', 'è' => 'e', 'é' => 'e', 'ê' => 'e', 'ë' => 'e', '&' => 'e', 'ì' => 'i', 'í' => 'i', 'î' => 'i', 'ï' => 'i', 'ò' => 'o', 'ó' => 'o', 'ô' => 'o', 'õ' => 'o', 'ö' => 'o', 'ø' => 'o', 'º' => 'o', 'ù' => 'u', 'ú' => 'u', 'û' => 'u', 'ü' => 'u', 'ç' => 'c', 'ð' => 'd', 'ñ' => 'n', 'š' => 's', 'ý' => 'y', 'ÿ' => 'ÿ', 'ž' => 'z', 'æ' => 'ae', 'œ' => 'oe', 'ƒ' => 'f']);