SproutCMS

This is the code documentation for the SproutCMS project

class Validity

New validation class for Sprout 3.
All of its methods should give useful errors by throwing a ValidationException.
Used with the Validator class.

Source code (52 results)

/config/sprout.php   Highlighted file source

Line 309: * Complexity requirements for password validation using the {@see Validity::password} method

/config/sprout.php   Highlighted file source

Line 309: * Complexity requirements for password validation using the {@see Validity::password} method

/modules/Demo/Controllers/MultiStepDemoController.php   Highlighted file source

Line 84: ['email', 'Validity::email'],
Line 85: ['email', 'Validity::length', 0, 60],
Line 95: ['phone', 'Validity::phone'],
Line 96: ['phone', 'Validity::length', 0, 20],
Line 97: ['mobile', 'Validity::phone'],
Line 98: ['mobile', 'Validity::length', 0, 20],
Line 103: $valid->multipleCheck(['phone', 'mobile'], 'Validity::oneRequired');
Line 115: ['how_heard', 'Validity::inEnum', 'multistep_demo_submissions', 'how_heard'],
Line 116: ['why_love', 'Validity::length', 0, PHP_INT_MAX],

/modules/Welcome/Controllers/WelcomeController.php   Highlighted file source

Line 556: $valid->check('username', 'Validity::length', 0, 50);
Line 559: $valid->check('username', 'Validity::uniqueValue', 'operators', 'username', 0, 'An operator already exists with that username');
Line 565: $valid->check('username', 'Validity::regex', '/^[a-zA-Z0-9]+$/');
Line 566: $valid->check('password1', 'Validity::length', 8, 60);
Line 567: $valid->check('password2', 'Validity::length', 8, 60);
Line 568: $valid->multipleCheck(['password1', 'password2'], 'Validity::allMatch');

/sprout/Controllers/Admin/CategoryAdminController.php   Highlighted file source

Line 170: $valid->check('name', 'Validity::length', 0, 50);
Line 256: $valid->check('name', 'Validity::length', 0, 50);

/sprout/Controllers/Admin/CategoryAdminController.php   Highlighted file source

Line 170: $valid->check('name', 'Validity::length', 0, 50);
Line 256: $valid->check('name', 'Validity::length', 0, 50);

/sprout/Controllers/Admin/EmailTextAdminController.php   Highlighted file source

Line 98: $valid->check('text', 'Validity::length', 0, 5000);

/sprout/Controllers/Admin/EmailTextAdminController.php   Highlighted file source

Line 98: $valid->check('text', 'Validity::length', 0, 5000);

/sprout/Controllers/Admin/FileAdminController.php   Highlighted file source

Line 774: $valid->check('name', 'Validity::length', 1, 200);
Line 775: $valid->check('description', 'Validity::length', 1, 10000);
Line 776: $valid->check('author', 'Validity::length', 1, 80);

/sprout/Controllers/Admin/FileAdminController.php   Highlighted file source

Line 774: $valid->check('name', 'Validity::length', 1, 200);
Line 775: $valid->check('description', 'Validity::length', 1, 10000);
Line 776: $valid->check('author', 'Validity::length', 1, 80);

/sprout/Controllers/Admin/MySettingsAdminController.php   Highlighted file source

Line 86: $valid->check('name', 'Validity::length', 1, 200);
Line 87: $valid->check('email', 'Validity::length', 1, 200);
Line 88: $valid->check('email', 'Validity::email');
Line 89: $valid->multipleCheck(['password1', 'password2'], 'Validity::allMatch');

/sprout/Controllers/Admin/MySettingsAdminController.php   Highlighted file source

Line 86: $valid->check('name', 'Validity::length', 1, 200);
Line 87: $valid->check('email', 'Validity::length', 1, 200);
Line 88: $valid->check('email', 'Validity::email');
Line 89: $valid->multipleCheck(['password1', 'password2'], 'Validity::allMatch');

/sprout/Controllers/Admin/OperatorAdminController.php   Highlighted file source

Line 184: $valid->check('name', 'Validity::length', 0, 200);
Line 185: $valid->check('email', 'Validity::email');
Line 186: $valid->check('email', 'Validity::length', 0, 200);
Line 187: $valid->check('username', 'Validity::length', 0, 50);
Line 188: $valid->check('username', 'Validity::uniqueValue', 'operators', 'username', 0, 'An operator already exists with that username');
Line 189: $valid->check('username', 'Validity::regex', '/^[a-zA-Z0-9]+$/');
Line 190: $valid->check('password1', 'Validity::length', 8, self::MAX_PASSWORD_LENGTH);
Line 191: $valid->check('password2', 'Validity::length', 8, self::MAX_PASSWORD_LENGTH);
Line 192: $valid->multipleCheck(['password1', 'password2'], 'Validity::allMatch');
Line 314: $valid->check('username', 'Validity::length', 0, 50);
Line 315: $valid->check('username', 'Validity::uniqueValue', 'operators', 'username', $item_id, 'An operator already exists with that username');
Line 316: $valid->check('username', 'Validity::regex', '/^[a-zA-Z0-9]+$/');
Line 317: $valid->check('name', 'Validity::length', 0, 200);
Line 318: $valid->check('email', 'Validity::length', 0, 200);
Line 319: $valid->check('password1', 'Validity::length', 8, self::MAX_PASSWORD_LENGTH);
Line 320: $valid->check('password2', 'Validity::length', 8, self::MAX_PASSWORD_LENGTH);
Line 321: $valid->multipleCheck(['password1', 'password2'], 'Validity::allMatch');

/sprout/Controllers/Admin/OperatorAdminController.php   Highlighted file source

Line 184: $valid->check('name', 'Validity::length', 0, 200);
Line 185: $valid->check('email', 'Validity::email');
Line 186: $valid->check('email', 'Validity::length', 0, 200);
Line 187: $valid->check('username', 'Validity::length', 0, 50);
Line 188: $valid->check('username', 'Validity::uniqueValue', 'operators', 'username', 0, 'An operator already exists with that username');
Line 189: $valid->check('username', 'Validity::regex', '/^[a-zA-Z0-9]+$/');
Line 190: $valid->check('password1', 'Validity::length', 8, self::MAX_PASSWORD_LENGTH);
Line 191: $valid->check('password2', 'Validity::length', 8, self::MAX_PASSWORD_LENGTH);
Line 192: $valid->multipleCheck(['password1', 'password2'], 'Validity::allMatch');
Line 314: $valid->check('username', 'Validity::length', 0, 50);
Line 315: $valid->check('username', 'Validity::uniqueValue', 'operators', 'username', $item_id, 'An operator already exists with that username');
Line 316: $valid->check('username', 'Validity::regex', '/^[a-zA-Z0-9]+$/');
Line 317: $valid->check('name', 'Validity::length', 0, 200);
Line 318: $valid->check('email', 'Validity::length', 0, 200);
Line 319: $valid->check('password1', 'Validity::length', 8, self::MAX_PASSWORD_LENGTH);
Line 320: $valid->check('password2', 'Validity::length', 8, self::MAX_PASSWORD_LENGTH);
Line 321: $valid->multipleCheck(['password1', 'password2'], 'Validity::allMatch');

/sprout/Controllers/Admin/OperatorCategoryAdminController.php   Highlighted file source

Line 23: use Sprout\Helpers\Validity;
Line 131: $valid->check('name', 'Validity::length', 0, 200);
Line 132: $valid->check('allowed_ips', 'Validity::length', 0, 200);
Line 136: Validity::ipv4AddrOrCidr($ip);

/sprout/Controllers/Admin/OperatorCategoryAdminController.php   Highlighted file source

Line 23: use Sprout\Helpers\Validity;
Line 131: $valid->check('name', 'Validity::length', 0, 200);
Line 132: $valid->check('allowed_ips', 'Validity::length', 0, 200);
Line 136: Validity::ipv4AddrOrCidr($ip);

/sprout/Controllers/Admin/PageAdminController.php   Highlighted file source

Line 303: $valid->check('name', 'Validity::length', 1, 200);
Line 304: $valid->check('meta_description', 'Validity::length', 0, 200);
Line 320: $valid->check('controller_entrance', 'Validity::length', 1, 200);
Line 1437: $valid->check('name', 'Validity::length', 1, 200);
Line 1438: $valid->check('slug', 'Validity::length', 1, 200);
Line 1448: $valid->check('meta_keywords', 'Validity::length', 0, 200);
Line 1449: $valid->check('meta_description', 'Validity::length', 0, 200);
Line 1450: $valid->check('alt_browser_title', 'Validity::length', 0, 200);
Line 1451: $valid->check('alt_nav_title', 'Validity::length', 0, 200);
Line 1454: $valid->check('redirect', 'Validity::length', 0, 200);
Line 1457: $valid->check('changes_made', 'Validity::length', 0, 250);
Line 1477: $valid->check('controller_entrance', 'Validity::length', 1, 200);

/sprout/Controllers/Admin/PageAdminController.php   Highlighted file source

Line 303: $valid->check('name', 'Validity::length', 1, 200);
Line 304: $valid->check('meta_description', 'Validity::length', 0, 200);
Line 320: $valid->check('controller_entrance', 'Validity::length', 1, 200);
Line 1437: $valid->check('name', 'Validity::length', 1, 200);
Line 1438: $valid->check('slug', 'Validity::length', 1, 200);
Line 1448: $valid->check('meta_keywords', 'Validity::length', 0, 200);
Line 1449: $valid->check('meta_description', 'Validity::length', 0, 200);
Line 1450: $valid->check('alt_browser_title', 'Validity::length', 0, 200);
Line 1451: $valid->check('alt_nav_title', 'Validity::length', 0, 200);
Line 1454: $valid->check('redirect', 'Validity::length', 0, 200);
Line 1457: $valid->check('changes_made', 'Validity::length', 0, 250);
Line 1477: $valid->check('controller_entrance', 'Validity::length', 1, 200);

/sprout/Controllers/Admin/SubsiteAdminController.php   Highlighted file source

Line 60: $valid->check('name', 'Validity::length', 0, 50);
Line 61: $valid->check('code', 'Validity::length', 0, 15);
Line 62: $valid->check('cond_directory', 'Validity::length', 0, 150);
Line 63: $valid->check('override_site_title', 'Validity::length', 0, 150);

/sprout/Controllers/Admin/SubsiteAdminController.php   Highlighted file source

Line 60: $valid->check('name', 'Validity::length', 0, 50);
Line 61: $valid->check('code', 'Validity::length', 0, 15);
Line 62: $valid->check('cond_directory', 'Validity::length', 0, 150);
Line 63: $valid->check('override_site_title', 'Validity::length', 0, 150);

/sprout/Controllers/DbToolsController.php   Highlighted file source

Line 70: use Sprout\Helpers\Validity;
Line 1767: $json .= "{$t}{$t}{$t}{$t}{$t}{\"func\": \"Validity::length\", \"args\": [0, {$field_len}]}\n";
Line 2134: $json .= "{$tab}{$tab}{$tab}{$tab}{$tab}{\"func\": \"Validity::length\", \"args\": [0, {$field_len}]}\n";
Line 2808: Validity::email($_POST['from']);
Line 2820: Validity::email($e);

/sprout/Controllers/DbToolsController.php   Highlighted file source

Line 70: use Sprout\Helpers\Validity;
Line 1767: $json .= "{$t}{$t}{$t}{$t}{$t}{\"func\": \"Validity::length\", \"args\": [0, {$field_len}]}\n";
Line 2134: $json .= "{$tab}{$tab}{$tab}{$tab}{$tab}{\"func\": \"Validity::length\", \"args\": [0, {$field_len}]}\n";
Line 2808: Validity::email($_POST['from']);
Line 2820: Validity::email($e);

/sprout/Controllers/EmailShareController.php   Highlighted file source

Line 154: $valid->check('title', 'Validity::length', 0, 255);
Line 155: $valid->check('url', 'Validity::length', 0, 255);
Line 156: $valid->check('their_name', 'Validity::length', 0, 255);
Line 157: $valid->check('their_email', 'Validity::email');
Line 158: $valid->check('their_email', 'Validity::length', 0, 255);
Line 159: $valid->check('message', 'Validity::length', 0, 500);

/sprout/Controllers/EmailShareController.php   Highlighted file source

Line 154: $valid->check('title', 'Validity::length', 0, 255);
Line 155: $valid->check('url', 'Validity::length', 0, 255);
Line 156: $valid->check('their_name', 'Validity::length', 0, 255);
Line 157: $valid->check('their_email', 'Validity::email');
Line 158: $valid->check('their_email', 'Validity::length', 0, 255);
Line 159: $valid->check('message', 'Validity::length', 0, 500);

/sprout/Controllers/MultiStepFormController.php   Highlighted file source

Line 203: * e.g. [['first_name', 'Validity::length', 0, 20], ['last_name', 'Validity::length', 0, 20]]

/sprout/Controllers/MultiStepFormController.php   Highlighted file source

Line 203: * e.g. [['first_name', 'Validity::length', 0, 20], ['last_name', 'Validity::length', 0, 20]]

/sprout/Exceptions/ValidationException.php   Highlighted file source

Line 19: * Exception thrown by Validity::* methods when validation fails

/sprout/Exceptions/ValidationException.php   Highlighted file source

Line 19: * Exception thrown by Validity::* methods when validation fails

/sprout/Helpers/Fb.php   Highlighted file source

Line 1159: if (isset($options['min'])) Validity::dateMySQL($options['min']);
Line 1160: if (isset($options['max'])) Validity::dateMySQL($options['max']);
Line 1217: if (isset($options['min'])) Validity::dateMySQL($options['min']);
Line 1218: if (isset($options['max'])) Validity::dateMySQL($options['max']);
Line 1265: if (isset($options['min'])) Validity::dateMySQL($options['min']);
Line 1266: if (isset($options['max'])) Validity::dateMySQL($options['max']);
Line 1322: if (isset($options['min'])) Validity::dateTimeMySQL($options['min']);
Line 1323: if (isset($options['max'])) Validity::dateTimeMySQL($options['max']);
Line 1404: if (isset($options['min'])) Validity::datetimeMySQL($options['min']);
Line 1405: if (isset($options['max'])) Validity::datetimeMySQL($options['max']);
Line 1406: if (isset($options['incr'])) Validity::range($options['incr'], 1, 59);

/sprout/Helpers/Fb.php   Highlighted file source

Line 1159: if (isset($options['min'])) Validity::dateMySQL($options['min']);
Line 1160: if (isset($options['max'])) Validity::dateMySQL($options['max']);
Line 1217: if (isset($options['min'])) Validity::dateMySQL($options['min']);
Line 1218: if (isset($options['max'])) Validity::dateMySQL($options['max']);
Line 1265: if (isset($options['min'])) Validity::dateMySQL($options['min']);
Line 1266: if (isset($options['max'])) Validity::dateMySQL($options['max']);
Line 1322: if (isset($options['min'])) Validity::dateTimeMySQL($options['min']);
Line 1323: if (isset($options['max'])) Validity::dateTimeMySQL($options['max']);
Line 1404: if (isset($options['min'])) Validity::datetimeMySQL($options['min']);
Line 1405: if (isset($options['max'])) Validity::datetimeMySQL($options['max']);
Line 1406: if (isset($options['incr'])) Validity::range($options['incr'], 1, 59);

/sprout/Helpers/Locales/LocaleInfo.php   Highlighted file source

Line 307: $valid->check('street', 'Validity::length', 0, 200);
Line 308: $valid->check('street2', 'Validity::length', 0, 200);
Line 311: $valid->check('town', 'Validity::length', 0, 100);
Line 315: $valid->check('state', 'Validity::length', 0, 100);
Line 319: $valid->check('state', 'Validity::inArray', $states);
Line 325: $valid->check('postcode', 'Validity::length', 0, 10);

/sprout/Helpers/Locales/LocaleInfo.php   Highlighted file source

Line 307: $valid->check('street', 'Validity::length', 0, 200);
Line 308: $valid->check('street2', 'Validity::length', 0, 200);
Line 311: $valid->check('town', 'Validity::length', 0, 100);
Line 315: $valid->check('state', 'Validity::length', 0, 100);
Line 319: $valid->check('state', 'Validity::inArray', $states);
Line 325: $valid->check('postcode', 'Validity::length', 0, 10);

/sprout/Helpers/Locales/LocaleInfoAUS.php   Highlighted file source

Line 51: $valid->check('postcode', 'Validity::positiveInt');
Line 52: $valid->check('postcode', 'Validity::length', 4, 4);

/sprout/Helpers/Locales/LocaleInfoAUS.php   Highlighted file source

Line 51: $valid->check('postcode', 'Validity::positiveInt');
Line 52: $valid->check('postcode', 'Validity::length', 4, 4);

/sprout/Helpers/Locales/LocaleInfoCAN.php   Highlighted file source

Line 87: $valid->check('postcode', 'Validity::length', 7, 7);

/sprout/Helpers/Locales/LocaleInfoCAN.php   Highlighted file source

Line 87: $valid->check('postcode', 'Validity::length', 7, 7);

/sprout/Helpers/Locales/LocaleInfoCHN.php   Highlighted file source

Line 88: $valid->check('postcode', 'Validity::length', 6, 6);

/sprout/Helpers/Locales/LocaleInfoCHN.php   Highlighted file source

Line 88: $valid->check('postcode', 'Validity::length', 6, 6);

/sprout/Helpers/Locales/LocaleInfoGBR.php   Highlighted file source

Line 182: $valid->check('postcode', 'Validity::length', 6, 8);

/sprout/Helpers/Locales/LocaleInfoGBR.php   Highlighted file source

Line 182: $valid->check('postcode', 'Validity::length', 6, 8);

/sprout/Helpers/Locales/LocaleInfoNZL.php   Highlighted file source

Line 42: $valid->check('postcode', 'Validity::positiveInt');
Line 43: $valid->check('postcode', 'Validity::length', 4, 4);

/sprout/Helpers/Locales/LocaleInfoNZL.php   Highlighted file source

Line 42: $valid->check('postcode', 'Validity::positiveInt');
Line 43: $valid->check('postcode', 'Validity::length', 4, 4);

/sprout/Helpers/Locales/LocaleInfoUSA.php   Highlighted file source

Line 113: $valid->check('postcode', 'Validity::length', 5, PHP_INT_MAX);

/sprout/Helpers/Locales/LocaleInfoUSA.php   Highlighted file source

Line 113: $valid->check('postcode', 'Validity::length', 5, PHP_INT_MAX);

/sprout/Helpers/Validator.php   Highlighted file source

Line 22: * Used with the {@see Validity} class.
Line 31: * $valid->check('name', 'Validity::length', 1, 100);
Line 32: * $valid->check('email', 'Validity::email');
Line 46: * $valid->check('name', 'Validity::length', 1, 100);
Line 71: * $multi_valid->check('name', 'Validity::length', 1, 100);
Line 72: * $multi_valid->check('email', 'Validity::email');
Line 250: * $result = $validator->arrayCheck('vals', 'Validity::positiveInt');
Line 296: * methods, which work on a set of fields instead of a single field (e.g. Validity::oneRequired)

/sprout/Helpers/Validity.php   Highlighted file source

Line 28: class Validity
Line 35: * $valid->check('name', 'Validity::length', 1, 100)
Line 58: * $valid->check('email', 'Validity::email')
Line 77: * $valid->check('password', 'Validity::password')
Line 107: * $valid->check('mobile', 'Validity::phone', 10)
Line 149: * $valid->check('region_id', 'Validity::positiveInt')
Line 175: * $valid->check('name', 'Validity::proseText')
Line 193: * $valid->check('date_published', 'Validity::dateMySQL')
Line 223: * $valid->check('event_time', 'Validity::timeMySQL')
Line 253: * $valid->check('start_date', 'Validity::datetimeMySQL')
Line 276: * $valid->check('code', 'Validity::uniqueValue', 'events', 'code')
Line 279: * $valid->check('email', 'Validity::uniqueValue', 'users', 'email', UserAuth::get_id())
Line 309: * $valid->check('days', 'Validity::allInSet', 'events', 'days')
Line 331: * $valid->multipleCheck(['email', 'phone'], 'Validity::oneRequired')
Line 354: * $valid->multipleCheck(['password1', 'password2'], 'Validity::allMatch')
Line 373: * $valid->multipleCheck(['home_phone', 'work_phone'], 'Validity::allUnique')
Line 391: * $valid->check('vowel', 'Validity::inArray', ['a', 'e', 'i', 'o', 'u'])
Line 410: * $valid->check('vowel', 'Validity::allInArray', ['a', 'e', 'i', 'o', 'u'])
Line 428: * $valid->check('user_id', 'Validity::inTable', 'users')
Line 455: * $valid->check('favourite_cities', 'Validity::allInTable', 'cities')
Line 501: * $valid->check('cost', 'Validity::numeric')
Line 518: * $valid->check('active', 'Validity::binary')
Line 535: * $valid->check('cost', 'Validity::range', 0, 5000)
Line 572: * $valid->multipleCheck(['date_start', 'date_end'], 'Validity::dateRange', '1999-01-01', '2099-01-01')

/sprout/tests/validiatorTest.php   Highlighted file source

Line 22: ['aa', 'Validity::email'],
Line 23: ['@example.com', 'Validity::email'],
Line 24: ['test@', 'Validity::email'],
Line 25: ['A', 'Validity::length', 2],
Line 26: ['A', 'Validity::length', 2, 3],
Line 27: ['A', 'Validity::positiveInt'],
Line 55: $results = $validator->arrayCheck('vals', 'Validity::positiveInt');

/sprout/tests/validiatorTest.php   Highlighted file source

Line 22: ['aa', 'Validity::email'],
Line 23: ['@example.com', 'Validity::email'],
Line 24: ['test@', 'Validity::email'],
Line 25: ['A', 'Validity::length', 2],
Line 26: ['A', 'Validity::length', 2, 3],
Line 27: ['A', 'Validity::positiveInt'],
Line 55: $results = $validator->arrayCheck('vals', 'Validity::positiveInt');

/sprout/tests/validityTest.php   Highlighted file source

Line 14: use Sprout\Helpers\Validity;
Line 18: class validityTest extends PHPUnit_Framework_TestCase
Line 36: Validity::email($value);
Line 61: Validity::positiveInt($value);
Line 96: Validity::binary($value);
Line 128: Validity::dateMySQL($value);

/sprout/tests/validityTest.php   Highlighted file source

Line 14: use Sprout\Helpers\Validity;
Line 18: class validityTest extends PHPUnit_Framework_TestCase
Line 36: Validity::email($value);
Line 61: Validity::positiveInt($value);
Line 96: Validity::binary($value);
Line 128: Validity::dateMySQL($value);

A total of 247 lines in 52 files were found