Completed
Branch FET-10325-remove-caffeinated-m... (ba33af)
by
unknown
34:17 queued 23:38
created
core/db_models/fields/EE_DB_Only_Float_Field.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -3,8 +3,8 @@
 block discarded – undo
3 3
 
4 4
 class EE_DB_Only_Float_Field extends EE_DB_Only_Field_Base
5 5
 {
6
-    function get_wpdb_data_type()
7
-    {
8
-        return '%f';
9
-    }
6
+	function get_wpdb_data_type()
7
+	{
8
+		return '%f';
9
+	}
10 10
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-require_once(EE_MODELS . 'fields/EE_DB_Only_Field_Base.php');
3
+require_once(EE_MODELS.'fields/EE_DB_Only_Field_Base.php');
4 4
 
5 5
 class EE_DB_Only_Int_Field extends EE_DB_Only_Field_Base
6 6
 {
Please login to merge, or discard this patch.
core/db_models/fields/EE_Float_Field.php 1 patch
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -6,57 +6,57 @@
 block discarded – undo
6 6
  */
7 7
 class EE_Float_Field extends EE_Model_Field_Base
8 8
 {
9
-    function get_wpdb_data_type()
10
-    {
11
-        return '%f';
12
-    }
9
+	function get_wpdb_data_type()
10
+	{
11
+		return '%f';
12
+	}
13 13
 
14
-    /**
15
-     * If provided a string, strips out number-related formatting, like commas, periods, spaces, other junk, etc.
16
-     * However, treats commas and periods as thousand-separators ro decimal marks, as indicate by the config's currency.
17
-     * So if you want to pass in a string that NEEDS to interpret periods as decimal marks, call floatval() on it first.
18
-     * Returns a float
19
-     *
20
-     * @param type $value_inputted_for_field_on_model_object
21
-     * @return float
22
-     */
23
-    function prepare_for_set($value_inputted_for_field_on_model_object)
24
-    {
14
+	/**
15
+	 * If provided a string, strips out number-related formatting, like commas, periods, spaces, other junk, etc.
16
+	 * However, treats commas and periods as thousand-separators ro decimal marks, as indicate by the config's currency.
17
+	 * So if you want to pass in a string that NEEDS to interpret periods as decimal marks, call floatval() on it first.
18
+	 * Returns a float
19
+	 *
20
+	 * @param type $value_inputted_for_field_on_model_object
21
+	 * @return float
22
+	 */
23
+	function prepare_for_set($value_inputted_for_field_on_model_object)
24
+	{
25 25
 //		echo __LINE__."$value_inputted_for_field_on_model_object<br>";
26
-        //remove whitespaces and thousands separators
27
-        if (is_string($value_inputted_for_field_on_model_object)) {
28
-            $value_inputted_for_field_on_model_object = str_replace(array(" ", EE_Config::instance()->currency->thsnds),
29
-                "", $value_inputted_for_field_on_model_object);
26
+		//remove whitespaces and thousands separators
27
+		if (is_string($value_inputted_for_field_on_model_object)) {
28
+			$value_inputted_for_field_on_model_object = str_replace(array(" ", EE_Config::instance()->currency->thsnds),
29
+				"", $value_inputted_for_field_on_model_object);
30 30
 //echo __LINE__."$value_inputted_for_field_on_model_object<br>";
31 31
 //normalize it so periods are decimal marks (we don't care where you're from: we're talking PHP now)
32
-            $value_inputted_for_field_on_model_object = str_replace(EE_Config::instance()->currency->dec_mrk, ".",
33
-                $value_inputted_for_field_on_model_object);
32
+			$value_inputted_for_field_on_model_object = str_replace(EE_Config::instance()->currency->dec_mrk, ".",
33
+				$value_inputted_for_field_on_model_object);
34 34
 //echo __LINE__."$value_inputted_for_field_on_model_object<br>";
35 35
 //double-check there's absolutely nothing left on this string besides numbers
36
-            $value_inputted_for_field_on_model_object = preg_replace("/[^0-9,.]/", "",
37
-                $value_inputted_for_field_on_model_object);
38
-        }
36
+			$value_inputted_for_field_on_model_object = preg_replace("/[^0-9,.]/", "",
37
+				$value_inputted_for_field_on_model_object);
38
+		}
39 39
 //		echo __LINE__."$value_inputted_for_field_on_model_object<br>";
40
-        return floatval($value_inputted_for_field_on_model_object);
41
-    }
40
+		return floatval($value_inputted_for_field_on_model_object);
41
+	}
42 42
 
43
-    /**
44
-     * Returns the number formatted according to local custom (set by the country of the blog).
45
-     *
46
-     * @param float $value_on_field_to_be_outputted
47
-     * @return string
48
-     */
49
-    function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null)
50
-    {
51
-        $EE = EE_Registry::instance();
52
-        return number_format($value_on_field_to_be_outputted, $EE->CFG->currency->dec_plc, $EE->CFG->currency->dec_mrk,
53
-            $EE->CFG->currency->thsnds);
54
-    }
43
+	/**
44
+	 * Returns the number formatted according to local custom (set by the country of the blog).
45
+	 *
46
+	 * @param float $value_on_field_to_be_outputted
47
+	 * @return string
48
+	 */
49
+	function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null)
50
+	{
51
+		$EE = EE_Registry::instance();
52
+		return number_format($value_on_field_to_be_outputted, $EE->CFG->currency->dec_plc, $EE->CFG->currency->dec_mrk,
53
+			$EE->CFG->currency->thsnds);
54
+	}
55 55
 
56
-    function prepare_for_set_from_db($value_found_in_db_for_model_object)
57
-    {
56
+	function prepare_for_set_from_db($value_found_in_db_for_model_object)
57
+	{
58 58
 //		echo "prepare for set from db of ";d($value_found_in_db_for_model_object);
59
-        return floatval($value_found_in_db_for_model_object);
60
-    }
59
+		return floatval($value_found_in_db_for_model_object);
60
+	}
61 61
 
62 62
 }
63 63
\ No newline at end of file
Please login to merge, or discard this patch.
core/db_models/fields/EE_Maybe_Serialized_Text_Field.php 2 patches
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -8,36 +8,36 @@
 block discarded – undo
8 8
 
9 9
 class EE_Maybe_Serialized_Text_Field extends EE_Serialized_Text_Field
10 10
 {
11
-    /**
12
-     * Value could be an array or a string. If its an array, serialize it. Otherwise, leave it as a string
13
-     *
14
-     * @param array|string $value_of_field_on_model_object
15
-     * @return string (possibly serialized)
16
-     */
17
-    function prepare_for_use_in_db($value_of_field_on_model_object)
18
-    {
19
-        if (is_array($value_of_field_on_model_object)) {
20
-            return parent::prepare_for_use_in_db($value_of_field_on_model_object);
21
-        } else {
22
-            return $value_of_field_on_model_object;
23
-        }
24
-    }
11
+	/**
12
+	 * Value could be an array or a string. If its an array, serialize it. Otherwise, leave it as a string
13
+	 *
14
+	 * @param array|string $value_of_field_on_model_object
15
+	 * @return string (possibly serialized)
16
+	 */
17
+	function prepare_for_use_in_db($value_of_field_on_model_object)
18
+	{
19
+		if (is_array($value_of_field_on_model_object)) {
20
+			return parent::prepare_for_use_in_db($value_of_field_on_model_object);
21
+		} else {
22
+			return $value_of_field_on_model_object;
23
+		}
24
+	}
25 25
 
26
-    /**
27
-     * Formats the array (or string) according to $schema. Right now, just implode with commas
28
-     *
29
-     * @param type $value_on_field_to_be_outputted
30
-     * @param type $schema
31
-     * @return strubg
32
-     */
33
-    function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null)
34
-    {
35
-        $pretty_value = null;
36
-        if (is_array($value_on_field_to_be_outputted)) {
37
-            $pretty_value = parent::prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema);
38
-        } else {
39
-            $pretty_value = $value_on_field_to_be_outputted;
40
-        }
41
-        return $pretty_value;
42
-    }
26
+	/**
27
+	 * Formats the array (or string) according to $schema. Right now, just implode with commas
28
+	 *
29
+	 * @param type $value_on_field_to_be_outputted
30
+	 * @param type $schema
31
+	 * @return strubg
32
+	 */
33
+	function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null)
34
+	{
35
+		$pretty_value = null;
36
+		if (is_array($value_on_field_to_be_outputted)) {
37
+			$pretty_value = parent::prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema);
38
+		} else {
39
+			$pretty_value = $value_on_field_to_be_outputted;
40
+		}
41
+		return $pretty_value;
42
+	}
43 43
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-require_once(EE_MODELS . 'fields/EE_Text_Field_Base.php');
2
+require_once(EE_MODELS.'fields/EE_Text_Field_Base.php');
3 3
 
4 4
 class EE_Plain_Text_Field extends EE_Text_Field_Base
5 5
 {
Please login to merge, or discard this patch.
core/db_models/fields/EE_Foreign_Key_Int_Field.php 2 patches
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -3,25 +3,25 @@
 block discarded – undo
3 3
 
4 4
 class EE_Foreign_Key_Int_Field extends EE_Foreign_Key_Field_Base
5 5
 {
6
-    function get_wpdb_data_type()
7
-    {
8
-        return '%d';
9
-    }
6
+	function get_wpdb_data_type()
7
+	{
8
+		return '%d';
9
+	}
10 10
 
11
-    /**
12
-     * @param int|EE_Base_Class $value_inputted_for_field_on_model_object
13
-     * @return int
14
-     */
15
-    function prepare_for_set($value_inputted_for_field_on_model_object)
16
-    {
17
-        if ($this->is_model_obj_of_type_pointed_to($value_inputted_for_field_on_model_object)) {
18
-            $value_inputted_for_field_on_model_object = $value_inputted_for_field_on_model_object->ID();
19
-        }
20
-        return absint($value_inputted_for_field_on_model_object);
21
-    }
11
+	/**
12
+	 * @param int|EE_Base_Class $value_inputted_for_field_on_model_object
13
+	 * @return int
14
+	 */
15
+	function prepare_for_set($value_inputted_for_field_on_model_object)
16
+	{
17
+		if ($this->is_model_obj_of_type_pointed_to($value_inputted_for_field_on_model_object)) {
18
+			$value_inputted_for_field_on_model_object = $value_inputted_for_field_on_model_object->ID();
19
+		}
20
+		return absint($value_inputted_for_field_on_model_object);
21
+	}
22 22
 
23
-    function prepare_for_set_from_db($value_found_in_db_for_model_object)
24
-    {
25
-        return intval($value_found_in_db_for_model_object);
26
-    }
23
+	function prepare_for_set_from_db($value_found_in_db_for_model_object)
24
+	{
25
+		return intval($value_found_in_db_for_model_object);
26
+	}
27 27
 }
28 28
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-require_once(EE_MODELS . 'fields/EE_Foreign_Key_Field_Base.php');
2
+require_once(EE_MODELS.'fields/EE_Foreign_Key_Field_Base.php');
3 3
 
4 4
 class EE_Foreign_Key_Int_Field extends EE_Foreign_Key_Field_Base
5 5
 {
Please login to merge, or discard this patch.
core/db_models/fields/EE_WP_Post_Type_Field.php.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -5,12 +5,12 @@
 block discarded – undo
5 5
  */
6 6
 class EE_WP_Post_Type_Field extends EE_DB_Only_Text_Field
7 7
 {
8
-    /**
9
-     * @param string $post_type the exact string to be used for the post type
10
-     *                          of all these post type model objects/rows
11
-     */
12
-    function __construct($post_type)
13
-    {
14
-        parent::__construct('post_type', __("Post Type", 'event_espresso'), false, $post_type);
15
-    }
8
+	/**
9
+	 * @param string $post_type the exact string to be used for the post type
10
+	 *                          of all these post type model objects/rows
11
+	 */
12
+	function __construct($post_type)
13
+	{
14
+		parent::__construct('post_type', __("Post Type", 'event_espresso'), false, $post_type);
15
+	}
16 16
 }
17 17
\ No newline at end of file
Please login to merge, or discard this patch.
core/db_models/fields/EE_DB_Only_Text_Field.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -3,8 +3,8 @@
 block discarded – undo
3 3
 
4 4
 class EE_DB_Only_Text_Field extends EE_DB_Only_Field_Base
5 5
 {
6
-    function get_wpdb_data_type()
7
-    {
8
-        return '%s';
9
-    }
6
+	function get_wpdb_data_type()
7
+	{
8
+		return '%s';
9
+	}
10 10
 }
11 11
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-require_once(EE_MODELS . 'fields/EE_DB_Only_Field_Base.php');
3
+require_once(EE_MODELS.'fields/EE_DB_Only_Field_Base.php');
4 4
 
5 5
 class EE_DB_Only_Int_Field extends EE_DB_Only_Field_Base
6 6
 {
Please login to merge, or discard this patch.
core/db_models/fields/EE_Serialized_Text_Field.php 2 patches
Indentation   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -11,59 +11,59 @@
 block discarded – undo
11 11
 
12 12
 class EE_Serialized_Text_Field extends EE_Text_Field_Base
13 13
 {
14
-    /**
15
-     * Value SHOULD be an array, and we want to now convert it to a serialized string
16
-     *
17
-     * @param array $value_of_field_on_model_object
18
-     * @return string
19
-     */
20
-    function prepare_for_use_in_db($value_of_field_on_model_object)
21
-    {
22
-        return maybe_serialize($value_of_field_on_model_object);
23
-    }
14
+	/**
15
+	 * Value SHOULD be an array, and we want to now convert it to a serialized string
16
+	 *
17
+	 * @param array $value_of_field_on_model_object
18
+	 * @return string
19
+	 */
20
+	function prepare_for_use_in_db($value_of_field_on_model_object)
21
+	{
22
+		return maybe_serialize($value_of_field_on_model_object);
23
+	}
24 24
 
25
-    function prepare_for_set($value_inputted_for_field_on_model_object)
26
-    {
27
-        $value_inputted_for_field_on_model_object = EEH_Array::maybe_unserialize($value_inputted_for_field_on_model_object);
28
-        if (is_string($value_inputted_for_field_on_model_object)) {
29
-            return parent::prepare_for_set($value_inputted_for_field_on_model_object);
30
-        } elseif (is_array($value_inputted_for_field_on_model_object)) {
31
-            return array_map(array($this, 'prepare_for_set'), $value_inputted_for_field_on_model_object);
32
-        } else {//so they passed NULL or an INT or something wack
33
-            return $value_inputted_for_field_on_model_object;
34
-        }
35
-    }
25
+	function prepare_for_set($value_inputted_for_field_on_model_object)
26
+	{
27
+		$value_inputted_for_field_on_model_object = EEH_Array::maybe_unserialize($value_inputted_for_field_on_model_object);
28
+		if (is_string($value_inputted_for_field_on_model_object)) {
29
+			return parent::prepare_for_set($value_inputted_for_field_on_model_object);
30
+		} elseif (is_array($value_inputted_for_field_on_model_object)) {
31
+			return array_map(array($this, 'prepare_for_set'), $value_inputted_for_field_on_model_object);
32
+		} else {//so they passed NULL or an INT or something wack
33
+			return $value_inputted_for_field_on_model_object;
34
+		}
35
+	}
36 36
 
37
-    /**
38
-     * Value provided should definetely be a serialized string. We should unserialize into an array
39
-     *
40
-     * @param string $value_found_in_db_for_model_object
41
-     * @return array
42
-     */
43
-    function prepare_for_set_from_db($value_found_in_db_for_model_object)
44
-    {
45
-        return EEH_Array::maybe_unserialize($value_found_in_db_for_model_object);
46
-    }
37
+	/**
38
+	 * Value provided should definetely be a serialized string. We should unserialize into an array
39
+	 *
40
+	 * @param string $value_found_in_db_for_model_object
41
+	 * @return array
42
+	 */
43
+	function prepare_for_set_from_db($value_found_in_db_for_model_object)
44
+	{
45
+		return EEH_Array::maybe_unserialize($value_found_in_db_for_model_object);
46
+	}
47 47
 
48
-    /**
49
-     * Gets a string representation of the array
50
-     *
51
-     * @param type   $value_on_field_to_be_outputted
52
-     * @param string $schema , possible values are ',', others can be added
53
-     * @return string
54
-     */
55
-    function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null)
56
-    {
57
-        switch ($schema) {
58
-            case 'print_r':
59
-                $pretty_value = print_r($value_on_field_to_be_outputted, true);
60
-                break;
61
-            case 'as_table':
62
-                $pretty_value = EEH_Template::layout_array_as_table($value_on_field_to_be_outputted);
63
-                break;
64
-            default:
65
-                $pretty_value = implode(", ", $value_on_field_to_be_outputted);
66
-        }
67
-        return $pretty_value;
68
-    }
48
+	/**
49
+	 * Gets a string representation of the array
50
+	 *
51
+	 * @param type   $value_on_field_to_be_outputted
52
+	 * @param string $schema , possible values are ',', others can be added
53
+	 * @return string
54
+	 */
55
+	function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null)
56
+	{
57
+		switch ($schema) {
58
+			case 'print_r':
59
+				$pretty_value = print_r($value_on_field_to_be_outputted, true);
60
+				break;
61
+			case 'as_table':
62
+				$pretty_value = EEH_Template::layout_array_as_table($value_on_field_to_be_outputted);
63
+				break;
64
+			default:
65
+				$pretty_value = implode(", ", $value_on_field_to_be_outputted);
66
+		}
67
+		return $pretty_value;
68
+	}
69 69
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-require_once(EE_MODELS . 'fields/EE_Text_Field_Base.php');
2
+require_once(EE_MODELS.'fields/EE_Text_Field_Base.php');
3 3
 
4 4
 class EE_Plain_Text_Field extends EE_Text_Field_Base
5 5
 {
Please login to merge, or discard this patch.
core/db_models/fields/EE_DB_Only_Field_Base.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -9,15 +9,15 @@
 block discarded – undo
9 9
  */
10 10
 abstract class EE_DB_Only_Field_Base extends EE_Model_Field_Base
11 11
 {
12
-    /**
13
-     * All these children classes are for the db-only (meaning, we should select them
14
-     * on get_all queries, update, delete, and will still want to set their default value
15
-     * on inserts, but the model object won't have reference to these fields)
16
-     *
17
-     * @return boolean
18
-     */
19
-    function is_db_only_field()
20
-    {
21
-        return true;
22
-    }
12
+	/**
13
+	 * All these children classes are for the db-only (meaning, we should select them
14
+	 * on get_all queries, update, delete, and will still want to set their default value
15
+	 * on inserts, but the model object won't have reference to these fields)
16
+	 *
17
+	 * @return boolean
18
+	 */
19
+	function is_db_only_field()
20
+	{
21
+		return true;
22
+	}
23 23
 }
24 24
\ No newline at end of file
Please login to merge, or discard this patch.
core/db_models/fields/EE_Email_Field.php 1 patch
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -9,35 +9,35 @@
 block discarded – undo
9 9
 class EE_Email_Field extends EE_Text_Field_Base
10 10
 {
11 11
 
12
-    /**
13
-     * In form inputs, we should have called htmlentities and addslashes() on form inputs,
14
-     * so we need to undo that on setting of these fields
15
-     *
16
-     * @param string $email_address
17
-     * @return string
18
-     */
19
-    function prepare_for_set($email_address)
20
-    {
21
-        $validation_level = isset(EE_Registry::instance()->CFG->registration->email_validation_level)
22
-            ? EE_Registry::instance()->CFG->registration->email_validation_level
23
-            : 'wp_default';
24
-        if ($validation_level === 'basic' && ! preg_match('/^.+\@\S+$/', $email_address)) {
25
-            // email not even in correct {string}@{string} format
26
-            return '';
27
-        } else if ($validation_level === 'wp_default' && ! is_email($email_address)) {
28
-            //not a valid email.
29
-            return '';
30
-        } else if (
31
-            ($validation_level === 'i18n' || $validation_level === 'i18n_dns')
32
-            // plz see http://stackoverflow.com/a/24817336 re: the following regex
33
-            && ! preg_match(
34
-                '/^(?!\.)((?!.*\.{2})[a-zA-Z0-9\x{0080}-\x{00FF}\x{0100}-\x{017F}\x{0180}-\x{024F}\x{0250}-\x{02AF}\x{0300}-\x{036F}\x{0370}-\x{03FF}\x{0400}-\x{04FF}\x{0500}-\x{052F}\x{0530}-\x{058F}\x{0590}-\x{05FF}\x{0600}-\x{06FF}\x{0700}-\x{074F}\x{0750}-\x{077F}\x{0780}-\x{07BF}\x{07C0}-\x{07FF}\x{0900}-\x{097F}\x{0980}-\x{09FF}\x{0A00}-\x{0A7F}\x{0A80}-\x{0AFF}\x{0B00}-\x{0B7F}\x{0B80}-\x{0BFF}\x{0C00}-\x{0C7F}\x{0C80}-\x{0CFF}\x{0D00}-\x{0D7F}\x{0D80}-\x{0DFF}\x{0E00}-\x{0E7F}\x{0E80}-\x{0EFF}\x{0F00}-\x{0FFF}\x{1000}-\x{109F}\x{10A0}-\x{10FF}\x{1100}-\x{11FF}\x{1200}-\x{137F}\x{1380}-\x{139F}\x{13A0}-\x{13FF}\x{1400}-\x{167F}\x{1680}-\x{169F}\x{16A0}-\x{16FF}\x{1700}-\x{171F}\x{1720}-\x{173F}\x{1740}-\x{175F}\x{1760}-\x{177F}\x{1780}-\x{17FF}\x{1800}-\x{18AF}\x{1900}-\x{194F}\x{1950}-\x{197F}\x{1980}-\x{19DF}\x{19E0}-\x{19FF}\x{1A00}-\x{1A1F}\x{1B00}-\x{1B7F}\x{1D00}-\x{1D7F}\x{1D80}-\x{1DBF}\x{1DC0}-\x{1DFF}\x{1E00}-\x{1EFF}\x{1F00}-\x{1FFF}\x{20D0}-\x{20FF}\x{2100}-\x{214F}\x{2C00}-\x{2C5F}\x{2C60}-\x{2C7F}\x{2C80}-\x{2CFF}\x{2D00}-\x{2D2F}\x{2D30}-\x{2D7F}\x{2D80}-\x{2DDF}\x{2F00}-\x{2FDF}\x{2FF0}-\x{2FFF}\x{3040}-\x{309F}\x{30A0}-\x{30FF}\x{3100}-\x{312F}\x{3130}-\x{318F}\x{3190}-\x{319F}\x{31C0}-\x{31EF}\x{31F0}-\x{31FF}\x{3200}-\x{32FF}\x{3300}-\x{33FF}\x{3400}-\x{4DBF}\x{4DC0}-\x{4DFF}\x{4E00}-\x{9FFF}\x{A000}-\x{A48F}\x{A490}-\x{A4CF}\x{A700}-\x{A71F}\x{A800}-\x{A82F}\x{A840}-\x{A87F}\x{AC00}-\x{D7AF}\x{F900}-\x{FAFF}\.!#$%&\'*+-\/=?^_`{|}~\-\d]+)@(?!\.)([a-zA-Z0-9\x{0080}-\x{00FF}\x{0100}-\x{017F}\x{0180}-\x{024F}\x{0250}-\x{02AF}\x{0300}-\x{036F}\x{0370}-\x{03FF}\x{0400}-\x{04FF}\x{0500}-\x{052F}\x{0530}-\x{058F}\x{0590}-\x{05FF}\x{0600}-\x{06FF}\x{0700}-\x{074F}\x{0750}-\x{077F}\x{0780}-\x{07BF}\x{07C0}-\x{07FF}\x{0900}-\x{097F}\x{0980}-\x{09FF}\x{0A00}-\x{0A7F}\x{0A80}-\x{0AFF}\x{0B00}-\x{0B7F}\x{0B80}-\x{0BFF}\x{0C00}-\x{0C7F}\x{0C80}-\x{0CFF}\x{0D00}-\x{0D7F}\x{0D80}-\x{0DFF}\x{0E00}-\x{0E7F}\x{0E80}-\x{0EFF}\x{0F00}-\x{0FFF}\x{1000}-\x{109F}\x{10A0}-\x{10FF}\x{1100}-\x{11FF}\x{1200}-\x{137F}\x{1380}-\x{139F}\x{13A0}-\x{13FF}\x{1400}-\x{167F}\x{1680}-\x{169F}\x{16A0}-\x{16FF}\x{1700}-\x{171F}\x{1720}-\x{173F}\x{1740}-\x{175F}\x{1760}-\x{177F}\x{1780}-\x{17FF}\x{1800}-\x{18AF}\x{1900}-\x{194F}\x{1950}-\x{197F}\x{1980}-\x{19DF}\x{19E0}-\x{19FF}\x{1A00}-\x{1A1F}\x{1B00}-\x{1B7F}\x{1D00}-\x{1D7F}\x{1D80}-\x{1DBF}\x{1DC0}-\x{1DFF}\x{1E00}-\x{1EFF}\x{1F00}-\x{1FFF}\x{20D0}-\x{20FF}\x{2100}-\x{214F}\x{2C00}-\x{2C5F}\x{2C60}-\x{2C7F}\x{2C80}-\x{2CFF}\x{2D00}-\x{2D2F}\x{2D30}-\x{2D7F}\x{2D80}-\x{2DDF}\x{2F00}-\x{2FDF}\x{2FF0}-\x{2FFF}\x{3040}-\x{309F}\x{30A0}-\x{30FF}\x{3100}-\x{312F}\x{3130}-\x{318F}\x{3190}-\x{319F}\x{31C0}-\x{31EF}\x{31F0}-\x{31FF}\x{3200}-\x{32FF}\x{3300}-\x{33FF}\x{3400}-\x{4DBF}\x{4DC0}-\x{4DFF}\x{4E00}-\x{9FFF}\x{A000}-\x{A48F}\x{A490}-\x{A4CF}\x{A700}-\x{A71F}\x{A800}-\x{A82F}\x{A840}-\x{A87F}\x{AC00}-\x{D7AF}\x{F900}-\x{FAFF}\-\.\d]+)((\.([a-zA-Z\x{0080}-\x{00FF}\x{0100}-\x{017F}\x{0180}-\x{024F}\x{0250}-\x{02AF}\x{0300}-\x{036F}\x{0370}-\x{03FF}\x{0400}-\x{04FF}\x{0500}-\x{052F}\x{0530}-\x{058F}\x{0590}-\x{05FF}\x{0600}-\x{06FF}\x{0700}-\x{074F}\x{0750}-\x{077F}\x{0780}-\x{07BF}\x{07C0}-\x{07FF}\x{0900}-\x{097F}\x{0980}-\x{09FF}\x{0A00}-\x{0A7F}\x{0A80}-\x{0AFF}\x{0B00}-\x{0B7F}\x{0B80}-\x{0BFF}\x{0C00}-\x{0C7F}\x{0C80}-\x{0CFF}\x{0D00}-\x{0D7F}\x{0D80}-\x{0DFF}\x{0E00}-\x{0E7F}\x{0E80}-\x{0EFF}\x{0F00}-\x{0FFF}\x{1000}-\x{109F}\x{10A0}-\x{10FF}\x{1100}-\x{11FF}\x{1200}-\x{137F}\x{1380}-\x{139F}\x{13A0}-\x{13FF}\x{1400}-\x{167F}\x{1680}-\x{169F}\x{16A0}-\x{16FF}\x{1700}-\x{171F}\x{1720}-\x{173F}\x{1740}-\x{175F}\x{1760}-\x{177F}\x{1780}-\x{17FF}\x{1800}-\x{18AF}\x{1900}-\x{194F}\x{1950}-\x{197F}\x{1980}-\x{19DF}\x{19E0}-\x{19FF}\x{1A00}-\x{1A1F}\x{1B00}-\x{1B7F}\x{1D00}-\x{1D7F}\x{1D80}-\x{1DBF}\x{1DC0}-\x{1DFF}\x{1E00}-\x{1EFF}\x{1F00}-\x{1FFF}\x{20D0}-\x{20FF}\x{2100}-\x{214F}\x{2C00}-\x{2C5F}\x{2C60}-\x{2C7F}\x{2C80}-\x{2CFF}\x{2D00}-\x{2D2F}\x{2D30}-\x{2D7F}\x{2D80}-\x{2DDF}\x{2F00}-\x{2FDF}\x{2FF0}-\x{2FFF}\x{3040}-\x{309F}\x{30A0}-\x{30FF}\x{3100}-\x{312F}\x{3130}-\x{318F}\x{3190}-\x{319F}\x{31C0}-\x{31EF}\x{31F0}-\x{31FF}\x{3200}-\x{32FF}\x{3300}-\x{33FF}\x{3400}-\x{4DBF}\x{4DC0}-\x{4DFF}\x{4E00}-\x{9FFF}\x{A000}-\x{A48F}\x{A490}-\x{A4CF}\x{A700}-\x{A71F}\x{A800}-\x{A82F}\x{A840}-\x{A87F}\x{AC00}-\x{D7AF}\x{F900}-\x{FAFF}]){2,63})+)$/u',
35
-                $email_address
36
-            )
37
-        ) {
38
-            //not a valid email.
39
-            return '';
40
-        }
41
-        return $email_address;
42
-    }
12
+	/**
13
+	 * In form inputs, we should have called htmlentities and addslashes() on form inputs,
14
+	 * so we need to undo that on setting of these fields
15
+	 *
16
+	 * @param string $email_address
17
+	 * @return string
18
+	 */
19
+	function prepare_for_set($email_address)
20
+	{
21
+		$validation_level = isset(EE_Registry::instance()->CFG->registration->email_validation_level)
22
+			? EE_Registry::instance()->CFG->registration->email_validation_level
23
+			: 'wp_default';
24
+		if ($validation_level === 'basic' && ! preg_match('/^.+\@\S+$/', $email_address)) {
25
+			// email not even in correct {string}@{string} format
26
+			return '';
27
+		} else if ($validation_level === 'wp_default' && ! is_email($email_address)) {
28
+			//not a valid email.
29
+			return '';
30
+		} else if (
31
+			($validation_level === 'i18n' || $validation_level === 'i18n_dns')
32
+			// plz see http://stackoverflow.com/a/24817336 re: the following regex
33
+			&& ! preg_match(
34
+				'/^(?!\.)((?!.*\.{2})[a-zA-Z0-9\x{0080}-\x{00FF}\x{0100}-\x{017F}\x{0180}-\x{024F}\x{0250}-\x{02AF}\x{0300}-\x{036F}\x{0370}-\x{03FF}\x{0400}-\x{04FF}\x{0500}-\x{052F}\x{0530}-\x{058F}\x{0590}-\x{05FF}\x{0600}-\x{06FF}\x{0700}-\x{074F}\x{0750}-\x{077F}\x{0780}-\x{07BF}\x{07C0}-\x{07FF}\x{0900}-\x{097F}\x{0980}-\x{09FF}\x{0A00}-\x{0A7F}\x{0A80}-\x{0AFF}\x{0B00}-\x{0B7F}\x{0B80}-\x{0BFF}\x{0C00}-\x{0C7F}\x{0C80}-\x{0CFF}\x{0D00}-\x{0D7F}\x{0D80}-\x{0DFF}\x{0E00}-\x{0E7F}\x{0E80}-\x{0EFF}\x{0F00}-\x{0FFF}\x{1000}-\x{109F}\x{10A0}-\x{10FF}\x{1100}-\x{11FF}\x{1200}-\x{137F}\x{1380}-\x{139F}\x{13A0}-\x{13FF}\x{1400}-\x{167F}\x{1680}-\x{169F}\x{16A0}-\x{16FF}\x{1700}-\x{171F}\x{1720}-\x{173F}\x{1740}-\x{175F}\x{1760}-\x{177F}\x{1780}-\x{17FF}\x{1800}-\x{18AF}\x{1900}-\x{194F}\x{1950}-\x{197F}\x{1980}-\x{19DF}\x{19E0}-\x{19FF}\x{1A00}-\x{1A1F}\x{1B00}-\x{1B7F}\x{1D00}-\x{1D7F}\x{1D80}-\x{1DBF}\x{1DC0}-\x{1DFF}\x{1E00}-\x{1EFF}\x{1F00}-\x{1FFF}\x{20D0}-\x{20FF}\x{2100}-\x{214F}\x{2C00}-\x{2C5F}\x{2C60}-\x{2C7F}\x{2C80}-\x{2CFF}\x{2D00}-\x{2D2F}\x{2D30}-\x{2D7F}\x{2D80}-\x{2DDF}\x{2F00}-\x{2FDF}\x{2FF0}-\x{2FFF}\x{3040}-\x{309F}\x{30A0}-\x{30FF}\x{3100}-\x{312F}\x{3130}-\x{318F}\x{3190}-\x{319F}\x{31C0}-\x{31EF}\x{31F0}-\x{31FF}\x{3200}-\x{32FF}\x{3300}-\x{33FF}\x{3400}-\x{4DBF}\x{4DC0}-\x{4DFF}\x{4E00}-\x{9FFF}\x{A000}-\x{A48F}\x{A490}-\x{A4CF}\x{A700}-\x{A71F}\x{A800}-\x{A82F}\x{A840}-\x{A87F}\x{AC00}-\x{D7AF}\x{F900}-\x{FAFF}\.!#$%&\'*+-\/=?^_`{|}~\-\d]+)@(?!\.)([a-zA-Z0-9\x{0080}-\x{00FF}\x{0100}-\x{017F}\x{0180}-\x{024F}\x{0250}-\x{02AF}\x{0300}-\x{036F}\x{0370}-\x{03FF}\x{0400}-\x{04FF}\x{0500}-\x{052F}\x{0530}-\x{058F}\x{0590}-\x{05FF}\x{0600}-\x{06FF}\x{0700}-\x{074F}\x{0750}-\x{077F}\x{0780}-\x{07BF}\x{07C0}-\x{07FF}\x{0900}-\x{097F}\x{0980}-\x{09FF}\x{0A00}-\x{0A7F}\x{0A80}-\x{0AFF}\x{0B00}-\x{0B7F}\x{0B80}-\x{0BFF}\x{0C00}-\x{0C7F}\x{0C80}-\x{0CFF}\x{0D00}-\x{0D7F}\x{0D80}-\x{0DFF}\x{0E00}-\x{0E7F}\x{0E80}-\x{0EFF}\x{0F00}-\x{0FFF}\x{1000}-\x{109F}\x{10A0}-\x{10FF}\x{1100}-\x{11FF}\x{1200}-\x{137F}\x{1380}-\x{139F}\x{13A0}-\x{13FF}\x{1400}-\x{167F}\x{1680}-\x{169F}\x{16A0}-\x{16FF}\x{1700}-\x{171F}\x{1720}-\x{173F}\x{1740}-\x{175F}\x{1760}-\x{177F}\x{1780}-\x{17FF}\x{1800}-\x{18AF}\x{1900}-\x{194F}\x{1950}-\x{197F}\x{1980}-\x{19DF}\x{19E0}-\x{19FF}\x{1A00}-\x{1A1F}\x{1B00}-\x{1B7F}\x{1D00}-\x{1D7F}\x{1D80}-\x{1DBF}\x{1DC0}-\x{1DFF}\x{1E00}-\x{1EFF}\x{1F00}-\x{1FFF}\x{20D0}-\x{20FF}\x{2100}-\x{214F}\x{2C00}-\x{2C5F}\x{2C60}-\x{2C7F}\x{2C80}-\x{2CFF}\x{2D00}-\x{2D2F}\x{2D30}-\x{2D7F}\x{2D80}-\x{2DDF}\x{2F00}-\x{2FDF}\x{2FF0}-\x{2FFF}\x{3040}-\x{309F}\x{30A0}-\x{30FF}\x{3100}-\x{312F}\x{3130}-\x{318F}\x{3190}-\x{319F}\x{31C0}-\x{31EF}\x{31F0}-\x{31FF}\x{3200}-\x{32FF}\x{3300}-\x{33FF}\x{3400}-\x{4DBF}\x{4DC0}-\x{4DFF}\x{4E00}-\x{9FFF}\x{A000}-\x{A48F}\x{A490}-\x{A4CF}\x{A700}-\x{A71F}\x{A800}-\x{A82F}\x{A840}-\x{A87F}\x{AC00}-\x{D7AF}\x{F900}-\x{FAFF}\-\.\d]+)((\.([a-zA-Z\x{0080}-\x{00FF}\x{0100}-\x{017F}\x{0180}-\x{024F}\x{0250}-\x{02AF}\x{0300}-\x{036F}\x{0370}-\x{03FF}\x{0400}-\x{04FF}\x{0500}-\x{052F}\x{0530}-\x{058F}\x{0590}-\x{05FF}\x{0600}-\x{06FF}\x{0700}-\x{074F}\x{0750}-\x{077F}\x{0780}-\x{07BF}\x{07C0}-\x{07FF}\x{0900}-\x{097F}\x{0980}-\x{09FF}\x{0A00}-\x{0A7F}\x{0A80}-\x{0AFF}\x{0B00}-\x{0B7F}\x{0B80}-\x{0BFF}\x{0C00}-\x{0C7F}\x{0C80}-\x{0CFF}\x{0D00}-\x{0D7F}\x{0D80}-\x{0DFF}\x{0E00}-\x{0E7F}\x{0E80}-\x{0EFF}\x{0F00}-\x{0FFF}\x{1000}-\x{109F}\x{10A0}-\x{10FF}\x{1100}-\x{11FF}\x{1200}-\x{137F}\x{1380}-\x{139F}\x{13A0}-\x{13FF}\x{1400}-\x{167F}\x{1680}-\x{169F}\x{16A0}-\x{16FF}\x{1700}-\x{171F}\x{1720}-\x{173F}\x{1740}-\x{175F}\x{1760}-\x{177F}\x{1780}-\x{17FF}\x{1800}-\x{18AF}\x{1900}-\x{194F}\x{1950}-\x{197F}\x{1980}-\x{19DF}\x{19E0}-\x{19FF}\x{1A00}-\x{1A1F}\x{1B00}-\x{1B7F}\x{1D00}-\x{1D7F}\x{1D80}-\x{1DBF}\x{1DC0}-\x{1DFF}\x{1E00}-\x{1EFF}\x{1F00}-\x{1FFF}\x{20D0}-\x{20FF}\x{2100}-\x{214F}\x{2C00}-\x{2C5F}\x{2C60}-\x{2C7F}\x{2C80}-\x{2CFF}\x{2D00}-\x{2D2F}\x{2D30}-\x{2D7F}\x{2D80}-\x{2DDF}\x{2F00}-\x{2FDF}\x{2FF0}-\x{2FFF}\x{3040}-\x{309F}\x{30A0}-\x{30FF}\x{3100}-\x{312F}\x{3130}-\x{318F}\x{3190}-\x{319F}\x{31C0}-\x{31EF}\x{31F0}-\x{31FF}\x{3200}-\x{32FF}\x{3300}-\x{33FF}\x{3400}-\x{4DBF}\x{4DC0}-\x{4DFF}\x{4E00}-\x{9FFF}\x{A000}-\x{A48F}\x{A490}-\x{A4CF}\x{A700}-\x{A71F}\x{A800}-\x{A82F}\x{A840}-\x{A87F}\x{AC00}-\x{D7AF}\x{F900}-\x{FAFF}]){2,63})+)$/u',
35
+				$email_address
36
+			)
37
+		) {
38
+			//not a valid email.
39
+			return '';
40
+		}
41
+		return $email_address;
42
+	}
43 43
 }
Please login to merge, or discard this patch.