Overview

Packages

  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Datatype
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationMain
    • NavigationTop
  • mpAutoloaderClassMap
  • None
  • Plugin
    • ContentAllocation
    • CronjobOverview
    • FormAssistant
    • FrontendLogic
    • FrontendUsers
    • Linkchecker
    • ModRewrite
    • Newsletter
    • Repository
      • FrontendNavigation
      • KeywordDensity
    • SearchSolr
    • SmartyWrapper
    • UrlShortener
    • UserForum
    • Workflow
  • PluginManager
  • Setup
    • Form
    • GUI
    • Helper
      • Environment
      • Filesystem
      • MySQL
      • PHP
    • UpgradeJob

Classes

  • cValidatorAbstract
  • cValidatorEmail
  • cValidatorFactory
  • cValidatorRegex
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo
 1: <?php
 2: /**
 3:  * This file contains the regular expression validator class.
 4:  *
 5:  * @package    Core
 6:  * @subpackage Validation
 7:  * @version    SVN Revision $Rev:$
 8:  *
 9:  * @author     Murat Purc <murat@purc.de>
10:  * @copyright  four for business AG <www.4fb.de>
11:  * @license    http://www.contenido.org/license/LIZENZ.txt
12:  * @link       http://www.4fb.de
13:  * @link       http://www.contenido.org
14:  */
15: 
16: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
17: 
18: /**
19:  * Regular expression validation.
20:  *
21:  * Supports following options:
22:  * <pre>
23:  * - pattern  (string)  The regular expression pattern
24:  * </pre>
25:  *
26:  * @package    Core
27:  * @subpackage Validation
28:  */
29: class cValidatorRegex extends cValidatorAbstract {
30: 
31:     /**
32:      * {@inheritdoc}
33:      */
34:     protected function _isValid($value) {
35:         if (!is_string($value)) {
36:             $this->addError('Invalid value', 1);
37:             return false;
38:         } elseif (!$this->getOption('pattern')) {
39:             $this->addError('Missing pattern', 2);
40:             return false;
41:         }
42: 
43:         $status = @preg_match($this->getOption('pattern'), $value);
44:         if (false === $status) {
45:             $this->addError('Pattern error', 3);
46:             return false;
47:         }
48: 
49:         if (!$status) {
50:             $this->addError('No match', 4);
51:             return false;
52:         }
53: 
54:         return true;
55:     }
56: 
57: }
58: 
CMS CONTENIDO 4.9.0 API documentation generated by ApiGen 2.8.0