當前位置: 首頁>>代碼示例>>PHP>>正文


PHP lmb_i18n函數代碼示例

本文整理匯總了PHP中lmb_i18n函數的典型用法代碼示例。如果您正苦於以下問題:PHP lmb_i18n函數的具體用法?PHP lmb_i18n怎麽用?PHP lmb_i18n使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了lmb_i18n函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testRequiredRuleFailure

 function testRequiredRuleFailure()
 {
     $rule = new lmbRequiredRule('testfield');
     $dataspace = new lmbSet();
     $this->error_list->expectOnce('addError', array(lmb_i18n('{Field} is required', 'validation'), array('Field' => 'testfield'), array()));
     $rule->validate($dataspace, $this->error_list);
 }
開發者ID:snowjobgit,項目名稱:limb,代碼行數:7,代碼來源:lmbRequiredRuleTest.class.php

示例2: testLocaleDateRuleError

 function testLocaleDateRuleError()
 {
     $rule = new lmbLocaleDateRule('test', new lmbLocale('en', new lmbIni(dirname(__FILE__) . '/en.ini')));
     $data = new lmbSet(array('test' => '02jjklklak/sdsdskj34-sdsdsjkjkj78'));
     $this->error_list->expectOnce('addError', array(lmb_i18n('{Field} must have a valid date format', 'validation'), array('Field' => 'test'), array()));
     $rule->validate($data, $this->error_list);
 }
開發者ID:snowjobgit,項目名稱:limb,代碼行數:7,代碼來源:lmbLocaleDateRuleTest.class.php

示例3: testSizeRangeRuleTooSmall

 function testSizeRangeRuleTooSmall()
 {
     $rule = new lmbI18NSizeRangeRule('testfield', 30, 100);
     $data = new lmbSet(array('testfield' => 'тест'));
     $this->error_list->expectOnce('addError', array(lmb_i18n('{Field} must be greater than {min} and less than {max} characters.', 'validation'), array('Field' => 'testfield'), array('min' => 30, 'max' => 100)));
     $rule->validate($data, $this->error_list);
 }
開發者ID:snowjobgit,項目名稱:limb,代碼行數:7,代碼來源:lmbI18NSizeRangeTest.class.php

示例4: _generateErrorMessage

 protected function _generateErrorMessage()
 {
     for ($i = 0; $i < count($this->field_names); $i++) {
         $fields[] = '{' . $i . '}';
     }
     return lmb_i18n('Atleast one field required among: {fields}', array('{fields}' => implode(', ', $fields)), 'validation');
 }
開發者ID:knevcher,項目名稱:limb,代碼行數:7,代碼來源:lmbAtleastOneFieldRequiredRule.class.php

示例5: testInvalidAndMoreFields

 function testInvalidAndMoreFields()
 {
     $dataspace = new lmbSet();
     $rule = new lmbAtleastOneFieldRequiredRule(array('field1', 'field2', 'field3'));
     $this->error_list->expectOnce('addError', array(lmb_i18n('Atleast one field required among: {fields}', array('{fields}' => '{0}, {1}, {2}'), 'validation'), array('field1', 'field2', 'field3'), array()));
     $rule->validate($dataspace, $this->error_list);
 }
開發者ID:snowjobgit,項目名稱:limb,代碼行數:7,代碼來源:lmbAtleastOneFieldRequiredRuleTest.class.php

示例6: testNotValidWithClassRestriction

 function testNotValidWithClassRestriction()
 {
     $rule = new lmbRequiredObjectRule('testfield', 'Foo');
     $dataspace = new lmbSet();
     $dataspace->set('testfield', new TestObjectForThisRule());
     $this->error_list->expectOnce('addError', array(lmb_i18n('Object {Field} is required', 'validation'), array('Field' => 'testfield'), array()));
     $rule->validate($dataspace, $this->error_list);
 }
開發者ID:snowjobgit,項目名稱:limb,代碼行數:8,代碼來源:lmbRequiredObjectRuleTest.class.php

示例7: testEmailRuleInvalidDomain

 function testEmailRuleInvalidDomain()
 {
     $rule = new lmbEmailRule('testfield');
     $dataspace = new lmbSet();
     $dataspace->set('testfield', 'billgates@micro$oft.com');
     $this->error_list->expectOnce('addError', array(lmb_i18n('{Field} must contain only letters, numbers, hyphens, and periods.', 'validation'), array('Field' => 'testfield'), array()));
     $rule->validate($dataspace, $this->error_list);
 }
開發者ID:snowjobgit,項目名稱:limb,代碼行數:8,代碼來源:lmbEmailRuleTest.class.php

示例8: testInArrayError

 function testInArrayError()
 {
     $rule = new lmbNotInArrayRule('testfield', array('www', 'ftp', 'smtp', 'mail'));
     $data = new lmbSet();
     $data->set('testfield', 'www');
     $this->error_list->expectOnce('addError', array(lmb_i18n('{Field} has not allowed value.', 'validation'), array('Field' => 'testfield'), array()));
     $rule->validate($data, $this->error_list);
 }
開發者ID:snowjobgit,項目名稱:limb,代碼行數:8,代碼來源:lmbNotInArrayRuleTest.class.php

示例9: _doValidate

 /**
  * @see lmbBaseValidationRule :: _doValidate()
  */
 protected function _doValidate($datasource)
 {
     $value = $datasource->get($this->field_name);
     if (is_null($value) || is_string($value) && trim($value) === '') {
         $error = $this->custom_error ? $this->custom_error : lmb_i18n('{Field} is required', 'validation');
         $this->error($error, array('Field' => $this->field_name));
     }
 }
開發者ID:knevcher,項目名稱:limb,代碼行數:11,代碼來源:lmbRequiredRule.class.php

示例10: testSizeRangeRuleTooSmall

 function testSizeRangeRuleTooSmall()
 {
     $rule = new lmbSizeRangeRule('testfield', 30, 100);
     $dataspace = new lmbSet();
     $dataspace->set('testfield', '12345678901234567890');
     $this->error_list->expectOnce('addError', array(lmb_i18n('{Field} must be greater than {min} characters.', 'validation'), array('Field' => 'testfield'), array('min' => 30, 'max' => 100)));
     $rule->validate($dataspace, $this->error_list);
 }
開發者ID:snowjobgit,項目名稱:limb,代碼行數:8,代碼來源:lmbSizeRangeRuleTest.class.php

示例11: testUrlRuleDomain

 function testUrlRuleDomain()
 {
     $rule = new lmbUrlRule('testfield');
     $dataspace = new lmbSet();
     $dataspace->set('testfield', 'http://www.source--forge.net/');
     $this->error_list->expectOnce('addError', array(lmb_i18n('{Field} may not contain double hyphens (--).', 'validation'), array('Field' => 'testfield'), array()));
     $rule->validate($dataspace, $this->error_list);
 }
開發者ID:snowjobgit,項目名稱:limb,代碼行數:8,代碼來源:lmbUrlRuleTest.class.php

示例12: testFieldNotValid2

 function testFieldNotValid2()
 {
     $rule = new lmbUniqueTableFieldRule('test', 'test_table', 'field1');
     $data = new lmbSet();
     $data->set('test', "001");
     $this->error_list->expectOnce('addError', array(lmb_i18n('{Field} must have other value since {Value} already exists', 'web_app'), array('Field' => 'test'), array('Value' => '001')));
     $rule->validate($data, $this->error_list);
 }
開發者ID:snowjobgit,項目名稱:limb,代碼行數:8,代碼來源:lmbUniqueTableFieldRuleTest.class.php

示例13: testValidValueRule_Error_Int

 function testValidValueRule_Error_Int()
 {
     $rule = new lmbValidValueRule('testfield', 1);
     $data = new lmbSet();
     $data->set('testfield', 0);
     $this->error_list->expectOnce('addError', array(lmb_i18n('{Field} value is wrong', 'validation'), array('Field' => 'testfield'), array()));
     $rule->validate($data, $this->error_list);
 }
開發者ID:snowjobgit,項目名稱:limb,代碼行數:8,代碼來源:lmbValidValueRuleTest.class.php

示例14: testNotValidContainsSlash

 function testNotValidContainsSlash()
 {
     $rule = new lmbIdentifierRule('test');
     $data = new lmbSet();
     $data->set('test', 'test/test');
     $this->error_list->expectOnce('addError', array(lmb_i18n('{Field} must contain only letters and numbers', 'validation'), array('Field' => 'test'), array()));
     $rule->validate($data, $this->error_list);
 }
開發者ID:snowjobgit,項目名稱:limb,代碼行數:8,代碼來源:lmbIdentifierRuleTest.class.php

示例15: testPatternRuleFailed

 function testPatternRuleFailed()
 {
     $rule = new lmbPatternRule('testfield', '/^\\w+$/');
     $data = new lmbSet();
     $data->set('testfield', 'Simpletest is Cool!');
     $this->error_list->expectOnce('addError', array(lmb_i18n('{Field} value is wrong', 'validation'), array('Field' => 'testfield'), array()));
     $rule->validate($data, $this->error_list);
 }
開發者ID:snowjobgit,項目名稱:limb,代碼行數:8,代碼來源:lmbPatternRuleTest.class.php


注:本文中的lmb_i18n函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。