Overview

Packages

  • CONTENIDO
  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentRssCreator
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
    • ScriptCookieDirective
  • 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: /**
 4:  * This file contains the regular expression validator class.
 5:  *
 6:  * @package    Core
 7:  * @subpackage Validation
 8:  * @version    SVN Revision $Rev:$
 9:  *
10:  * @author     Murat Purc <murat@purc.de>
11:  * @copyright  four for business AG <www.4fb.de>
12:  * @license    http://www.contenido.org/license/LIZENZ.txt
13:  * @link       http://www.4fb.de
14:  * @link       http://www.contenido.org
15:  */
16: 
17: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
18: 
19: /**
20:  * Regular expression validation.
21:  *
22:  * Supports following options:
23:  * <pre>
24:  * - pattern  (string)  The regular expression pattern
25:  * </pre>
26:  *
27:  * @package    Core
28:  * @subpackage Validation
29:  */
30: class cValidatorRegex extends cValidatorAbstract {
31: 
32:     /**
33:      *
34:      * @see cValidatorAbstract::_isValid()
35:      * @param mixed $value
36:      * @return bool
37:      */
38:     protected function _isValid($value) {
39:         if (!is_string($value)) {
40:             $this->addError('Invalid value', 1);
41:             return false;
42:         } elseif (!$this->getOption('pattern')) {
43:             $this->addError('Missing pattern', 2);
44:             return false;
45:         }
46: 
47:         $status = @preg_match($this->getOption('pattern'), $value);
48:         if (false === $status) {
49:             $this->addError('Pattern error', 3);
50:             return false;
51:         }
52: 
53:         if (!$status) {
54:             $this->addError('No match', 4);
55:             return false;
56:         }
57: 
58:         return true;
59:     }
60: 
61: }
62: 
CMS CONTENIDO 4.9.8 API documentation generated by ApiGen 2.8.0