Uname: Linux premium72.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
Software: LiteSpeed
PHP version: 8.2.29 [ PHP INFO ] PHP os: Linux
Server Ip: 198.54.125.95
Your Ip: 216.73.216.164
User: matican (532) | Group: matican (531)
Safe Mode: OFF
Disable Function:
NONE

name : Regex.php
<?php

/**
 * @copyright Copyright (c) 2009-2022 ThemeCatcher (https://www.themecatcher.net)
 */
class Quform_Filter_Regex extends Quform_Filter_Abstract
{
    /**
     * Filter any characters matched by the set regular expression pattern
     *
     * If the value provided is not a string, the value will remain unfiltered
     *
     * @param   string  $value  The value to filter
     * @return  string          The filtered value
     */
    public function filter($value)
    {
        if ( ! is_string($value)) {
            return $value;
        }

        if (Quform::isNonEmptyString($this->config('pattern'))) {
            $value = preg_replace($this->config('pattern'), '', $value);
        }

        return $value;
    }

    /**
     * Get the default config for this filter
     *
     * @param   string|null  $key  Get the config by key, if omitted the full config is returned
     * @return  array
     */
    public static function getDefaultConfig($key = null)
    {
        $config = apply_filters('quform_default_config_filter_regex', array(
            'pattern' => ''
        ));

        $config['type'] = 'regex';

        if (Quform::isNonEmptyString($key)) {
            return Quform::get($config, $key);
        }

        return $config;
    }
}
© 2025 XylotrechusZ