Completed
Branch Gutenberg/event-attendees-bloc... (c8d45d)
by
unknown
76:01 queued 62:31
created
core/db_models/fields/EE_Money_Field.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@
 block discarded – undo
12 12
      * @param string $table_column
13 13
      * @param string $nicename
14 14
      * @param bool   $nullable
15
-     * @param null   $default_value
15
+     * @param integer   $default_value
16 16
      */
17 17
     public function __construct($table_column, $nicename, $nullable, $default_value = null)
18 18
     {
Please login to merge, or discard this patch.
Indentation   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -8,91 +8,91 @@
 block discarded – undo
8 8
 class EE_Money_Field extends EE_Float_Field
9 9
 {
10 10
 
11
-    /**
12
-     * @param string $table_column
13
-     * @param string $nicename
14
-     * @param bool   $nullable
15
-     * @param null   $default_value
16
-     */
17
-    public function __construct($table_column, $nicename, $nullable, $default_value = null)
18
-    {
19
-        parent::__construct($table_column, $nicename, $nullable, $default_value);
20
-        $this->setSchemaType('object');
21
-    }
11
+	/**
12
+	 * @param string $table_column
13
+	 * @param string $nicename
14
+	 * @param bool   $nullable
15
+	 * @param null   $default_value
16
+	 */
17
+	public function __construct($table_column, $nicename, $nullable, $default_value = null)
18
+	{
19
+		parent::__construct($table_column, $nicename, $nullable, $default_value);
20
+		$this->setSchemaType('object');
21
+	}
22 22
 
23 23
 
24
-    /**
25
-     * Schemas:
26
-     *    'localized_float': "3,023.00"
27
-     *    'no_currency_code': "$3,023.00"
28
-     *    null: "$3,023.00<span>USD</span>"
29
-     *
30
-     * @param string $value_on_field_to_be_outputted
31
-     * @param string $schema
32
-     * @return string
33
-     */
34
-    function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null)
35
-    {
36
-        $pretty_float = parent::prepare_for_pretty_echoing($value_on_field_to_be_outputted);
24
+	/**
25
+	 * Schemas:
26
+	 *    'localized_float': "3,023.00"
27
+	 *    'no_currency_code': "$3,023.00"
28
+	 *    null: "$3,023.00<span>USD</span>"
29
+	 *
30
+	 * @param string $value_on_field_to_be_outputted
31
+	 * @param string $schema
32
+	 * @return string
33
+	 */
34
+	function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null)
35
+	{
36
+		$pretty_float = parent::prepare_for_pretty_echoing($value_on_field_to_be_outputted);
37 37
 
38
-        if ($schema == 'localized_float') {
39
-            return $pretty_float;
40
-        }
41
-        if ($schema == 'no_currency_code') {
38
+		if ($schema == 'localized_float') {
39
+			return $pretty_float;
40
+		}
41
+		if ($schema == 'no_currency_code') {
42 42
 //			echo "schema no currency!";
43
-            $display_code = false;
44
-        } else {
45
-            $display_code = true;
46
-        }
47
-        //we don't use the $pretty_float because format_currency will take care of it.
48
-        return EEH_Template::format_currency($value_on_field_to_be_outputted, false, $display_code);
49
-    }
43
+			$display_code = false;
44
+		} else {
45
+			$display_code = true;
46
+		}
47
+		//we don't use the $pretty_float because format_currency will take care of it.
48
+		return EEH_Template::format_currency($value_on_field_to_be_outputted, false, $display_code);
49
+	}
50 50
 
51
-    /**
52
-     * If provided with a string, strips out money-related formatting to turn it into a proper float.
53
-     * Rounds the float to the correct number of decimal places for this country's currency.
54
-     * Also, interprets periods and commas according to the country's currency settings.
55
-     * So if you want to pass in a string that NEEDS to interpret periods as decimal marks, call floatval() on it first.
56
-     *
57
-     * @param string $value_inputted_for_field_on_model_object
58
-     * @return float
59
-     */
60
-    function prepare_for_set($value_inputted_for_field_on_model_object)
61
-    {
62
-        //remove any currencies etc.
51
+	/**
52
+	 * If provided with a string, strips out money-related formatting to turn it into a proper float.
53
+	 * Rounds the float to the correct number of decimal places for this country's currency.
54
+	 * Also, interprets periods and commas according to the country's currency settings.
55
+	 * So if you want to pass in a string that NEEDS to interpret periods as decimal marks, call floatval() on it first.
56
+	 *
57
+	 * @param string $value_inputted_for_field_on_model_object
58
+	 * @return float
59
+	 */
60
+	function prepare_for_set($value_inputted_for_field_on_model_object)
61
+	{
62
+		//remove any currencies etc.
63 63
 //		if(is_string($value_inputted_for_field_on_model_object)){
64 64
 //			$value_inputted_for_field_on_model_object = preg_replace("/[^0-9,.]/", "", $value_inputted_for_field_on_model_object);
65 65
 //		}
66
-        //now it's a float-style string or number
67
-        $float_val = parent::prepare_for_set($value_inputted_for_field_on_model_object);
68
-        //round to the correctly number of decimal places for this  currency
69
-        $rounded_value = round($float_val, EE_Registry::instance()->CFG->currency->dec_plc);
70
-        return $rounded_value;
71
-    }
66
+		//now it's a float-style string or number
67
+		$float_val = parent::prepare_for_set($value_inputted_for_field_on_model_object);
68
+		//round to the correctly number of decimal places for this  currency
69
+		$rounded_value = round($float_val, EE_Registry::instance()->CFG->currency->dec_plc);
70
+		return $rounded_value;
71
+	}
72 72
 
73
-    function prepare_for_get($value_of_field_on_model_object)
74
-    {
75
-        $c = EE_Registry::instance()->CFG->currency;
76
-        return round(parent::prepare_for_get($value_of_field_on_model_object), $c->dec_plc);
77
-    }
73
+	function prepare_for_get($value_of_field_on_model_object)
74
+	{
75
+		$c = EE_Registry::instance()->CFG->currency;
76
+		return round(parent::prepare_for_get($value_of_field_on_model_object), $c->dec_plc);
77
+	}
78 78
 
79
-    public function getSchemaProperties()
80
-    {
81
-        return array(
82
-            'raw' => array(
83
-                'description' =>  sprintf(
84
-                    __('%s - the raw value as it exists in the database as a simple float.', 'event_espresso'),
85
-                    $this->get_nicename()
86
-                ),
87
-                'type' => 'number'
88
-            ),
89
-            'pretty' => array(
90
-                'description' =>  sprintf(
91
-                    __('%s - formatted for display in the set currency and decimal places.', 'event_espresso'),
92
-                    $this->get_nicename()
93
-                ),
94
-                'type' => 'string'
95
-            )
96
-        );
97
-    }
79
+	public function getSchemaProperties()
80
+	{
81
+		return array(
82
+			'raw' => array(
83
+				'description' =>  sprintf(
84
+					__('%s - the raw value as it exists in the database as a simple float.', 'event_espresso'),
85
+					$this->get_nicename()
86
+				),
87
+				'type' => 'number'
88
+			),
89
+			'pretty' => array(
90
+				'description' =>  sprintf(
91
+					__('%s - formatted for display in the set currency and decimal places.', 'event_espresso'),
92
+					$this->get_nicename()
93
+				),
94
+				'type' => 'string'
95
+			)
96
+		);
97
+	}
98 98
 }
99 99
\ No newline at end of file
Please login to merge, or discard this patch.
core/db_models/fields/EE_DB_Only_Int_Field.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -3,15 +3,15 @@
 block discarded – undo
3 3
 
4 4
 class EE_DB_Only_Int_Field extends EE_DB_Only_Field_Base
5 5
 {
6
-    /**
7
-     * @param string $table_column
8
-     * @param string $nicename
9
-     * @param bool   $nullable
10
-     * @param null   $default_value
11
-     */
12
-    public function __construct($table_column, $nicename, $nullable, $default_value = null)
13
-    {
14
-        parent::__construct($table_column, $nicename, $nullable, $default_value);
15
-        $this->setSchemaType('integer');
16
-    }
6
+	/**
7
+	 * @param string $table_column
8
+	 * @param string $nicename
9
+	 * @param bool   $nullable
10
+	 * @param null   $default_value
11
+	 */
12
+	public function __construct($table_column, $nicename, $nullable, $default_value = null)
13
+	{
14
+		parent::__construct($table_column, $nicename, $nullable, $default_value);
15
+		$this->setSchemaType('integer');
16
+	}
17 17
 }
18 18
\ No newline at end of file
Please login to merge, or discard this patch.
core/db_models/fields/EE_Infinite_Integer_Field.php 1 patch
Indentation   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -11,77 +11,77 @@
 block discarded – undo
11 11
 class EE_Infinite_Integer_Field extends EE_Model_Field_Base
12 12
 {
13 13
 
14
-    /**
15
-     * @param string $table_column
16
-     * @param string $nicename
17
-     * @param bool   $nullable
18
-     * @param null   $default_value
19
-     */
20
-    public function __construct($table_column, $nicename, $nullable, $default_value = null)
21
-    {
22
-        parent::__construct($table_column, $nicename, $nullable, $default_value);
23
-        $this->setSchemaType(array('integer', 'null'));
24
-    }
14
+	/**
15
+	 * @param string $table_column
16
+	 * @param string $nicename
17
+	 * @param bool   $nullable
18
+	 * @param null   $default_value
19
+	 */
20
+	public function __construct($table_column, $nicename, $nullable, $default_value = null)
21
+	{
22
+		parent::__construct($table_column, $nicename, $nullable, $default_value);
23
+		$this->setSchemaType(array('integer', 'null'));
24
+	}
25 25
 
26 26
 
27
-    function prepare_for_use_in_db($value_of_field_on_model_object)
28
-    {
29
-        if ($value_of_field_on_model_object === EE_INF) {
30
-            return EE_INF_IN_DB;
31
-        } else {
32
-            return intval($value_of_field_on_model_object);
33
-        }
34
-    }
27
+	function prepare_for_use_in_db($value_of_field_on_model_object)
28
+	{
29
+		if ($value_of_field_on_model_object === EE_INF) {
30
+			return EE_INF_IN_DB;
31
+		} else {
32
+			return intval($value_of_field_on_model_object);
33
+		}
34
+	}
35 35
 
36
-    function prepare_for_set($value_inputted_for_field_on_model_object)
37
-    {
38
-        if ($value_inputted_for_field_on_model_object === EE_INF_IN_DB ||
39
-            $value_inputted_for_field_on_model_object === EE_INF ||
40
-            $value_inputted_for_field_on_model_object === "EE_INF" ||
41
-            $value_inputted_for_field_on_model_object === ""
42
-        ) {
43
-            return EE_INF;
44
-        } else {
45
-            return intval($value_inputted_for_field_on_model_object);
46
-        }
47
-    }
36
+	function prepare_for_set($value_inputted_for_field_on_model_object)
37
+	{
38
+		if ($value_inputted_for_field_on_model_object === EE_INF_IN_DB ||
39
+			$value_inputted_for_field_on_model_object === EE_INF ||
40
+			$value_inputted_for_field_on_model_object === "EE_INF" ||
41
+			$value_inputted_for_field_on_model_object === ""
42
+		) {
43
+			return EE_INF;
44
+		} else {
45
+			return intval($value_inputted_for_field_on_model_object);
46
+		}
47
+	}
48 48
 
49
-    function prepare_for_set_from_db($value_inputted_for_field_on_model_object)
50
-    {
51
-        $intval = intval($value_inputted_for_field_on_model_object);
52
-        if ($intval == EE_INF_IN_DB) {
53
-            return EE_INF;
54
-        } else {
55
-            return $intval;
56
-        }
57
-    }
49
+	function prepare_for_set_from_db($value_inputted_for_field_on_model_object)
50
+	{
51
+		$intval = intval($value_inputted_for_field_on_model_object);
52
+		if ($intval == EE_INF_IN_DB) {
53
+			return EE_INF;
54
+		} else {
55
+			return $intval;
56
+		}
57
+	}
58 58
 
59
-    /**
60
-     * For outputting this field's value. If you want to output it into an input or something,
61
-     * use $schema=='input', as it will replace EE_INF with ''. If you want a readable version, use $schema=='text'
62
-     * as it will replace EE_INF with i18n Infinite
63
-     *
64
-     * @param type   $value_on_field_to_be_outputted
65
-     * @param string $schema input, symbol, text; or any string you want to show if the value equals EE_INF
66
-     * @return string
67
-     */
68
-    function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null)
69
-    {
70
-        if ($value_on_field_to_be_outputted === EE_INF) {
71
-            switch ($schema) {
72
-                case 'input':
73
-                case 'form_input':
74
-                    return '';
75
-                case 'symbol':
76
-                    return "&infin;";
77
-                case 'text':
78
-                case null:
79
-                    return __("Unlimited", "event_espresso");
80
-                default:
81
-                    return $schema;
82
-            }
83
-        } else {
84
-            return $value_on_field_to_be_outputted;
85
-        }
86
-    }
59
+	/**
60
+	 * For outputting this field's value. If you want to output it into an input or something,
61
+	 * use $schema=='input', as it will replace EE_INF with ''. If you want a readable version, use $schema=='text'
62
+	 * as it will replace EE_INF with i18n Infinite
63
+	 *
64
+	 * @param type   $value_on_field_to_be_outputted
65
+	 * @param string $schema input, symbol, text; or any string you want to show if the value equals EE_INF
66
+	 * @return string
67
+	 */
68
+	function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null)
69
+	{
70
+		if ($value_on_field_to_be_outputted === EE_INF) {
71
+			switch ($schema) {
72
+				case 'input':
73
+				case 'form_input':
74
+					return '';
75
+				case 'symbol':
76
+					return "&infin;";
77
+				case 'text':
78
+				case null:
79
+					return __("Unlimited", "event_espresso");
80
+				default:
81
+					return $schema;
82
+			}
83
+		} else {
84
+			return $value_on_field_to_be_outputted;
85
+		}
86
+	}
87 87
 }
Please login to merge, or discard this patch.
core/db_models/fields/EE_Serialized_Text_Field.php 2 patches
Indentation   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -10,72 +10,72 @@
 block discarded – undo
10 10
 class EE_Serialized_Text_Field extends EE_Text_Field_Base
11 11
 {
12 12
 
13
-    /**
14
-     * @param string $table_column
15
-     * @param string $nicename
16
-     * @param bool   $nullable
17
-     * @param null   $default_value
18
-     */
19
-    public function __construct($table_column, $nicename, $nullable, $default_value = null)
20
-    {
21
-        parent::__construct($table_column, $nicename, $nullable, $default_value);
22
-        $this->setSchemaType(array('object','string'));
23
-    }
13
+	/**
14
+	 * @param string $table_column
15
+	 * @param string $nicename
16
+	 * @param bool   $nullable
17
+	 * @param null   $default_value
18
+	 */
19
+	public function __construct($table_column, $nicename, $nullable, $default_value = null)
20
+	{
21
+		parent::__construct($table_column, $nicename, $nullable, $default_value);
22
+		$this->setSchemaType(array('object','string'));
23
+	}
24 24
 
25 25
 
26
-    /**
27
-     * Value SHOULD be an array, and we want to now convert it to a serialized string
28
-     *
29
-     * @param array $value_of_field_on_model_object
30
-     * @return string
31
-     */
32
-    function prepare_for_use_in_db($value_of_field_on_model_object)
33
-    {
34
-        return maybe_serialize($value_of_field_on_model_object);
35
-    }
26
+	/**
27
+	 * Value SHOULD be an array, and we want to now convert it to a serialized string
28
+	 *
29
+	 * @param array $value_of_field_on_model_object
30
+	 * @return string
31
+	 */
32
+	function prepare_for_use_in_db($value_of_field_on_model_object)
33
+	{
34
+		return maybe_serialize($value_of_field_on_model_object);
35
+	}
36 36
 
37
-    function prepare_for_set($value_inputted_for_field_on_model_object)
38
-    {
39
-        $value_inputted_for_field_on_model_object = EEH_Array::maybe_unserialize($value_inputted_for_field_on_model_object);
40
-        if (is_string($value_inputted_for_field_on_model_object)) {
41
-            return parent::prepare_for_set($value_inputted_for_field_on_model_object);
42
-        } elseif (is_array($value_inputted_for_field_on_model_object)) {
43
-            return array_map(array($this, 'prepare_for_set'), $value_inputted_for_field_on_model_object);
44
-        } else {//so they passed NULL or an INT or something wack
45
-            return $value_inputted_for_field_on_model_object;
46
-        }
47
-    }
37
+	function prepare_for_set($value_inputted_for_field_on_model_object)
38
+	{
39
+		$value_inputted_for_field_on_model_object = EEH_Array::maybe_unserialize($value_inputted_for_field_on_model_object);
40
+		if (is_string($value_inputted_for_field_on_model_object)) {
41
+			return parent::prepare_for_set($value_inputted_for_field_on_model_object);
42
+		} elseif (is_array($value_inputted_for_field_on_model_object)) {
43
+			return array_map(array($this, 'prepare_for_set'), $value_inputted_for_field_on_model_object);
44
+		} else {//so they passed NULL or an INT or something wack
45
+			return $value_inputted_for_field_on_model_object;
46
+		}
47
+	}
48 48
 
49
-    /**
50
-     * Value provided should definetely be a serialized string. We should unserialize into an array
51
-     *
52
-     * @param string $value_found_in_db_for_model_object
53
-     * @return array
54
-     */
55
-    function prepare_for_set_from_db($value_found_in_db_for_model_object)
56
-    {
57
-        return EEH_Array::maybe_unserialize($value_found_in_db_for_model_object);
58
-    }
49
+	/**
50
+	 * Value provided should definetely be a serialized string. We should unserialize into an array
51
+	 *
52
+	 * @param string $value_found_in_db_for_model_object
53
+	 * @return array
54
+	 */
55
+	function prepare_for_set_from_db($value_found_in_db_for_model_object)
56
+	{
57
+		return EEH_Array::maybe_unserialize($value_found_in_db_for_model_object);
58
+	}
59 59
 
60
-    /**
61
-     * Gets a string representation of the array
62
-     *
63
-     * @param type   $value_on_field_to_be_outputted
64
-     * @param string $schema , possible values are ',', others can be added
65
-     * @return string
66
-     */
67
-    function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null)
68
-    {
69
-        switch ($schema) {
70
-            case 'print_r':
71
-                $pretty_value = print_r($value_on_field_to_be_outputted, true);
72
-                break;
73
-            case 'as_table':
74
-                $pretty_value = EEH_Template::layout_array_as_table($value_on_field_to_be_outputted);
75
-                break;
76
-            default:
77
-                $pretty_value = implode(", ", $value_on_field_to_be_outputted);
78
-        }
79
-        return $pretty_value;
80
-    }
60
+	/**
61
+	 * Gets a string representation of the array
62
+	 *
63
+	 * @param type   $value_on_field_to_be_outputted
64
+	 * @param string $schema , possible values are ',', others can be added
65
+	 * @return string
66
+	 */
67
+	function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null)
68
+	{
69
+		switch ($schema) {
70
+			case 'print_r':
71
+				$pretty_value = print_r($value_on_field_to_be_outputted, true);
72
+				break;
73
+			case 'as_table':
74
+				$pretty_value = EEH_Template::layout_array_as_table($value_on_field_to_be_outputted);
75
+				break;
76
+			default:
77
+				$pretty_value = implode(", ", $value_on_field_to_be_outputted);
78
+		}
79
+		return $pretty_value;
80
+	}
81 81
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
     public function __construct($table_column, $nicename, $nullable, $default_value = null)
20 20
     {
21 21
         parent::__construct($table_column, $nicename, $nullable, $default_value);
22
-        $this->setSchemaType(array('object','string'));
22
+        $this->setSchemaType(array('object', 'string'));
23 23
     }
24 24
 
25 25
 
Please login to merge, or discard this patch.
core/db_models/fields/EE_Enum_Integer_Field.php 2 patches
Indentation   +102 added lines, -102 removed lines patch added patch discarded remove patch
@@ -10,115 +10,115 @@
 block discarded – undo
10 10
  */
11 11
 class EE_Enum_Integer_Field extends EE_Integer_Field
12 12
 {
13
-    /**
14
-     * @var array $_allowed_enum_values
15
-     */
16
-    public $_allowed_enum_values;
13
+	/**
14
+	 * @var array $_allowed_enum_values
15
+	 */
16
+	public $_allowed_enum_values;
17 17
 
18 18
 
19
-    /**
20
-     * @param string  $table_column
21
-     * @param string  $nicename
22
-     * @param boolean $nullable
23
-     * @param int     $default_value
24
-     * @param array   $allowed_enum_values keys are values to be used in the DB, values are how they should be displayed
25
-     */
26
-    public function __construct($table_column, $nicename, $nullable, $default_value, $allowed_enum_values)
27
-    {
28
-        $this->_allowed_enum_values = $allowed_enum_values;
29
-        parent::__construct($table_column, $nicename, $nullable, $default_value);
30
-        $this->setSchemaType('object');
31
-    }
19
+	/**
20
+	 * @param string  $table_column
21
+	 * @param string  $nicename
22
+	 * @param boolean $nullable
23
+	 * @param int     $default_value
24
+	 * @param array   $allowed_enum_values keys are values to be used in the DB, values are how they should be displayed
25
+	 */
26
+	public function __construct($table_column, $nicename, $nullable, $default_value, $allowed_enum_values)
27
+	{
28
+		$this->_allowed_enum_values = $allowed_enum_values;
29
+		parent::__construct($table_column, $nicename, $nullable, $default_value);
30
+		$this->setSchemaType('object');
31
+	}
32 32
 
33
-    /**
34
-     * Returns the list of allowed enum options, but filterable.
35
-     * This is used internally
36
-     *
37
-     * @return array
38
-     */
39
-    protected function _allowed_enum_values()
40
-    {
41
-        return (array)apply_filters(
42
-            'FHEE__EE_Enum_Integer_Field___allowed_enum_options',
43
-            $this->_allowed_enum_values,
44
-            $this
45
-        );
46
-    }
33
+	/**
34
+	 * Returns the list of allowed enum options, but filterable.
35
+	 * This is used internally
36
+	 *
37
+	 * @return array
38
+	 */
39
+	protected function _allowed_enum_values()
40
+	{
41
+		return (array)apply_filters(
42
+			'FHEE__EE_Enum_Integer_Field___allowed_enum_options',
43
+			$this->_allowed_enum_values,
44
+			$this
45
+		);
46
+	}
47 47
 
48
-    /**
49
-     * When setting, just verify that the value being used matches what we've defined as allowable enum values.
50
-     * If not, throw an error (but if WP_DEBUG is false, just set the value to default)
51
-     *
52
-     * @param int $value_inputted_for_field_on_model_object
53
-     * @return int
54
-     * @throws EE_Error
55
-     */
56
-    public function prepare_for_set($value_inputted_for_field_on_model_object)
57
-    {
58
-        $allowed_enum_values = $this->_allowed_enum_values();
59
-        if (
60
-            $value_inputted_for_field_on_model_object !== null
61
-            && ! array_key_exists($value_inputted_for_field_on_model_object, $allowed_enum_values)
62
-        ) {
63
-            if (defined('WP_DEBUG') && WP_DEBUG) {
64
-                $msg = sprintf(
65
-                    __('System is assigning incompatible value "%1$s" to field "%2$s"', 'event_espresso'),
66
-                    $value_inputted_for_field_on_model_object,
67
-                    $this->_name
68
-                );
69
-                $msg2 = sprintf(
70
-                    __('Allowed values for "%1$s" are "%2$s". You provided "%3$s"', 'event_espresso'),
71
-                    $this->_name,
72
-                    implode(', ', array_keys($allowed_enum_values)),
73
-                    $value_inputted_for_field_on_model_object
74
-                );
75
-                EE_Error::add_error("{$msg}||{$msg2}", __FILE__, __FUNCTION__, __LINE__);
76
-            }
77
-            return $this->get_default_value();
78
-        }
79
-        return (int)$value_inputted_for_field_on_model_object;
80
-    }
48
+	/**
49
+	 * When setting, just verify that the value being used matches what we've defined as allowable enum values.
50
+	 * If not, throw an error (but if WP_DEBUG is false, just set the value to default)
51
+	 *
52
+	 * @param int $value_inputted_for_field_on_model_object
53
+	 * @return int
54
+	 * @throws EE_Error
55
+	 */
56
+	public function prepare_for_set($value_inputted_for_field_on_model_object)
57
+	{
58
+		$allowed_enum_values = $this->_allowed_enum_values();
59
+		if (
60
+			$value_inputted_for_field_on_model_object !== null
61
+			&& ! array_key_exists($value_inputted_for_field_on_model_object, $allowed_enum_values)
62
+		) {
63
+			if (defined('WP_DEBUG') && WP_DEBUG) {
64
+				$msg = sprintf(
65
+					__('System is assigning incompatible value "%1$s" to field "%2$s"', 'event_espresso'),
66
+					$value_inputted_for_field_on_model_object,
67
+					$this->_name
68
+				);
69
+				$msg2 = sprintf(
70
+					__('Allowed values for "%1$s" are "%2$s". You provided "%3$s"', 'event_espresso'),
71
+					$this->_name,
72
+					implode(', ', array_keys($allowed_enum_values)),
73
+					$value_inputted_for_field_on_model_object
74
+				);
75
+				EE_Error::add_error("{$msg}||{$msg2}", __FILE__, __FUNCTION__, __LINE__);
76
+			}
77
+			return $this->get_default_value();
78
+		}
79
+		return (int)$value_inputted_for_field_on_model_object;
80
+	}
81 81
 
82 82
 
83 83
 
84
-    /**
85
-     * Gets the pretty version of the enum's value.
86
-     *
87
-     * @param int | string $value_on_field_to_be_outputted
88
-     * @param null         $schema
89
-     * @return string
90
-     */
91
-    public function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null)
92
-    {
93
-        $options = $this->_allowed_enum_values();
94
-        if (isset($options[$value_on_field_to_be_outputted])) {
95
-            return $options[$value_on_field_to_be_outputted];
96
-        } else {
97
-            return $value_on_field_to_be_outputted;
98
-        }
99
-    }
84
+	/**
85
+	 * Gets the pretty version of the enum's value.
86
+	 *
87
+	 * @param int | string $value_on_field_to_be_outputted
88
+	 * @param null         $schema
89
+	 * @return string
90
+	 */
91
+	public function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null)
92
+	{
93
+		$options = $this->_allowed_enum_values();
94
+		if (isset($options[$value_on_field_to_be_outputted])) {
95
+			return $options[$value_on_field_to_be_outputted];
96
+		} else {
97
+			return $value_on_field_to_be_outputted;
98
+		}
99
+	}
100 100
 
101 101
 
102
-    public function getSchemaProperties()
103
-    {
104
-        return array(
105
-            'raw' => array(
106
-                'description' =>  sprintf(
107
-                    __('%s - the value in the database.', 'event_espresso'),
108
-                    $this->get_nicename()
109
-                ),
110
-                'enum' => array_keys($this->_allowed_enum_values()),
111
-                'type' => 'integer'
112
-            ),
113
-            'pretty' => array(
114
-                'description' =>  sprintf(
115
-                    __('%s - the value for display.', 'event_espresso'),
116
-                    $this->get_nicename()
117
-                ),
118
-                'enum' => array_values($this->_allowed_enum_values()),
119
-                'type' => 'string',
120
-                'read_only' => true
121
-            )
122
-        );
123
-    }
102
+	public function getSchemaProperties()
103
+	{
104
+		return array(
105
+			'raw' => array(
106
+				'description' =>  sprintf(
107
+					__('%s - the value in the database.', 'event_espresso'),
108
+					$this->get_nicename()
109
+				),
110
+				'enum' => array_keys($this->_allowed_enum_values()),
111
+				'type' => 'integer'
112
+			),
113
+			'pretty' => array(
114
+				'description' =>  sprintf(
115
+					__('%s - the value for display.', 'event_espresso'),
116
+					$this->get_nicename()
117
+				),
118
+				'enum' => array_values($this->_allowed_enum_values()),
119
+				'type' => 'string',
120
+				'read_only' => true
121
+			)
122
+		);
123
+	}
124 124
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
      */
39 39
     protected function _allowed_enum_values()
40 40
     {
41
-        return (array)apply_filters(
41
+        return (array) apply_filters(
42 42
             'FHEE__EE_Enum_Integer_Field___allowed_enum_options',
43 43
             $this->_allowed_enum_values,
44 44
             $this
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
             }
77 77
             return $this->get_default_value();
78 78
         }
79
-        return (int)$value_inputted_for_field_on_model_object;
79
+        return (int) $value_inputted_for_field_on_model_object;
80 80
     }
81 81
 
82 82
 
Please login to merge, or discard this patch.
core/db_models/fields/EE_Boolean_Field.php 2 patches
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -3,50 +3,50 @@
 block discarded – undo
3 3
 
4 4
 class EE_Boolean_Field extends EE_Integer_Field
5 5
 {
6
-    /**
7
-     * @param string $table_column
8
-     * @param string $nicename
9
-     * @param bool   $nullable
10
-     * @param null   $default_value
11
-     */
12
-    public function __construct($table_column, $nicename, $nullable, $default_value = null)
13
-    {
14
-        parent::__construct($table_column, $nicename, $nullable, $default_value);
15
-        $this->setSchemaType('boolean');
16
-    }
6
+	/**
7
+	 * @param string $table_column
8
+	 * @param string $nicename
9
+	 * @param bool   $nullable
10
+	 * @param null   $default_value
11
+	 */
12
+	public function __construct($table_column, $nicename, $nullable, $default_value = null)
13
+	{
14
+		parent::__construct($table_column, $nicename, $nullable, $default_value);
15
+		$this->setSchemaType('boolean');
16
+	}
17 17
 
18
-    public function prepare_for_set($value_inputted_for_field_on_model_object)
19
-    {
20
-        if ($value_inputted_for_field_on_model_object) {
21
-            return true;
22
-        } else {
23
-            return false;
24
-        }
25
-    }
18
+	public function prepare_for_set($value_inputted_for_field_on_model_object)
19
+	{
20
+		if ($value_inputted_for_field_on_model_object) {
21
+			return true;
22
+		} else {
23
+			return false;
24
+		}
25
+	}
26 26
 
27
-    /**
28
-     * Make sure we're returning booleans
29
-     *
30
-     * @param string $value_inputted_for_field_on_model_object
31
-     * @return boolean
32
-     */
33
-    public function prepare_for_set_from_db($value_inputted_for_field_on_model_object)
34
-    {
35
-        return intval($value_inputted_for_field_on_model_object) ? true : false;
36
-    }
27
+	/**
28
+	 * Make sure we're returning booleans
29
+	 *
30
+	 * @param string $value_inputted_for_field_on_model_object
31
+	 * @return boolean
32
+	 */
33
+	public function prepare_for_set_from_db($value_inputted_for_field_on_model_object)
34
+	{
35
+		return intval($value_inputted_for_field_on_model_object) ? true : false;
36
+	}
37 37
 
38
-    /**
39
-     * Gets a nice Yes/No value for this field
40
-     *
41
-     * @param boolean $value_on_field_to_be_outputted
42
-     * @return string Yes or No
43
-     */
44
-    public function prepare_for_pretty_echoing($value_on_field_to_be_outputted)
45
-    {
46
-        return apply_filters(
47
-            'FHEE__EE_Boolean_Field__prepare_for_pretty_echoing__return',
48
-            $value_on_field_to_be_outputted ? __('Yes', 'event_espresso') : __('No', 'event_espresso'),
49
-            $value_on_field_to_be_outputted
50
-        );
51
-    }
38
+	/**
39
+	 * Gets a nice Yes/No value for this field
40
+	 *
41
+	 * @param boolean $value_on_field_to_be_outputted
42
+	 * @return string Yes or No
43
+	 */
44
+	public function prepare_for_pretty_echoing($value_on_field_to_be_outputted)
45
+	{
46
+		return apply_filters(
47
+			'FHEE__EE_Boolean_Field__prepare_for_pretty_echoing__return',
48
+			$value_on_field_to_be_outputted ? __('Yes', 'event_espresso') : __('No', 'event_espresso'),
49
+			$value_on_field_to_be_outputted
50
+		);
51
+	}
52 52
 }
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
-defined( 'EVENT_ESPRESSO_VERSION') || exit;
2
+defined('EVENT_ESPRESSO_VERSION') || exit;
3 3
 
4 4
 class EE_Boolean_Field extends EE_Integer_Field
5 5
 {
Please login to merge, or discard this patch.
core/db_models/fields/EE_DB_Only_Float_Field.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -3,16 +3,16 @@
 block discarded – undo
3 3
 
4 4
 class EE_DB_Only_Float_Field extends EE_DB_Only_Field_Base
5 5
 {
6
-    /**
7
-     * @param string $table_column
8
-     * @param string $nicename
9
-     * @param bool   $nullable
10
-     * @param null   $default_value
11
-     */
12
-    public function __construct($table_column, $nicename, $nullable, $default_value = null)
13
-    {
14
-        parent::__construct($table_column, $nicename, $nullable, $default_value);
15
-        $this->setSchemaType('number');
16
-    }
6
+	/**
7
+	 * @param string $table_column
8
+	 * @param string $nicename
9
+	 * @param bool   $nullable
10
+	 * @param null   $default_value
11
+	 */
12
+	public function __construct($table_column, $nicename, $nullable, $default_value = null)
13
+	{
14
+		parent::__construct($table_column, $nicename, $nullable, $default_value);
15
+		$this->setSchemaType('number');
16
+	}
17 17
 
18 18
 }
Please login to merge, or discard this patch.
core/db_models/fields/EE_Primary_Key_Int_Field.php 2 patches
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -4,27 +4,27 @@
 block discarded – undo
4 4
 class EE_Primary_Key_Int_Field extends EE_Primary_Key_Field_Base
5 5
 {
6 6
 
7
-    public function __construct($table_column, $nicename)
8
-    {
9
-        parent::__construct($table_column, $nicename, 0);
10
-        $this->setSchemaType('integer');
11
-    }
7
+	public function __construct($table_column, $nicename)
8
+	{
9
+		parent::__construct($table_column, $nicename, 0);
10
+		$this->setSchemaType('integer');
11
+	}
12 12
 
13
-    function prepare_for_set($value_inputted_for_field_on_model_object)
14
-    {
15
-        if ($this->is_model_obj_of_type_pointed_to($value_inputted_for_field_on_model_object)) {
16
-            $value_inputted_for_field_on_model_object = $value_inputted_for_field_on_model_object->ID();
17
-        }
18
-        return absint($value_inputted_for_field_on_model_object);
19
-    }
13
+	function prepare_for_set($value_inputted_for_field_on_model_object)
14
+	{
15
+		if ($this->is_model_obj_of_type_pointed_to($value_inputted_for_field_on_model_object)) {
16
+			$value_inputted_for_field_on_model_object = $value_inputted_for_field_on_model_object->ID();
17
+		}
18
+		return absint($value_inputted_for_field_on_model_object);
19
+	}
20 20
 
21
-    function prepare_for_set_from_db($value_found_in_db_for_model_object)
22
-    {
23
-        return intval($value_found_in_db_for_model_object);
24
-    }
21
+	function prepare_for_set_from_db($value_found_in_db_for_model_object)
22
+	{
23
+		return intval($value_found_in_db_for_model_object);
24
+	}
25 25
 
26
-    function is_auto_increment()
27
-    {
28
-        return true;
29
-    }
26
+	function is_auto_increment()
27
+	{
28
+		return true;
29
+	}
30 30
 }
31 31
\ No newline at end of file
Please login to merge, or discard this patch.
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -4,6 +4,9 @@
 block discarded – undo
4 4
 class EE_Primary_Key_Int_Field extends EE_Primary_Key_Field_Base
5 5
 {
6 6
 
7
+    /**
8
+     * @param string $table_column
9
+     */
7 10
     public function __construct($table_column, $nicename)
8 11
     {
9 12
         parent::__construct($table_column, $nicename, 0);
Please login to merge, or discard this patch.
core/db_models/fields/EE_Enum_Text_Field.php 1 patch
Indentation   +127 added lines, -127 removed lines patch added patch discarded remove patch
@@ -12,131 +12,131 @@
 block discarded – undo
12 12
 class EE_Enum_Text_Field extends EE_Text_Field_Base
13 13
 {
14 14
 
15
-    /**
16
-     * @var array $_allowed_enum_values
17
-     */
18
-    public $_allowed_enum_values;
19
-
20
-    /**
21
-     * @param string  $table_column
22
-     * @param string  $nice_name
23
-     * @param boolean $nullable
24
-     * @param mixed   $default_value
25
-     * @param array   $allowed_enum_values keys are values to be used in the DB, values are how they should be displayed
26
-     */
27
-    function __construct($table_column, $nice_name, $nullable, $default_value, $allowed_enum_values)
28
-    {
29
-        $this->_allowed_enum_values = $allowed_enum_values;
30
-        parent::__construct($table_column, $nice_name, $nullable, $default_value);
31
-        $this->setSchemaType('object');
32
-    }
33
-
34
-
35
-
36
-    /**
37
-     * Returns the list of allowed enum options, but filterable.
38
-     * This is used internally
39
-     *
40
-     * @return array
41
-     */
42
-    protected function _allowed_enum_values()
43
-    {
44
-        return apply_filters(
45
-            'FHEE__EE_Enum_Text_Field___allowed_enum_options',
46
-            $this->_allowed_enum_values,
47
-            $this
48
-        );
49
-    }
50
-
51
-
52
-
53
-    /**
54
-     * When setting, just verify that the value being used matches what we've defined as allowable enum values.
55
-     * If not, throw an error (but if WP_DEBUG is false, just set the value to default).
56
-     *
57
-     * @param string $value_inputted_for_field_on_model_object
58
-     * @return string
59
-     * @throws EE_Error
60
-     */
61
-    public function prepare_for_set($value_inputted_for_field_on_model_object)
62
-    {
63
-        if (
64
-            $value_inputted_for_field_on_model_object !== null
65
-            && ! array_key_exists($value_inputted_for_field_on_model_object, $this->_allowed_enum_values())
66
-        ) {
67
-            if (defined('WP_DEBUG') && WP_DEBUG) {
68
-                $msg = sprintf(
69
-                    __('System is assigning incompatible value "%1$s" to field "%2$s"', 'event_espresso'),
70
-                    $value_inputted_for_field_on_model_object,
71
-                    $this->_name
72
-                );
73
-                $msg2 = sprintf(
74
-                    __('Allowed values for "%1$s" are "%2$s". You provided: "%3$s"', 'event_espresso'),
75
-                    $this->_name,
76
-                    implode(', ', array_keys($this->_allowed_enum_values())),
77
-                    $value_inputted_for_field_on_model_object
78
-                );
79
-                EE_Error::add_error("{$msg}||{$msg2}", __FILE__, __FUNCTION__, __LINE__);
80
-            }
81
-            return $this->get_default_value();
82
-        }
83
-        return $value_inputted_for_field_on_model_object;
84
-    }
85
-
86
-
87
-    /**
88
-     * Gets the pretty version of the enum's value.
89
-     *
90
-     * @param     int |string $value_on_field_to_be_outputted
91
-     * @param    null         $schema
92
-     * @return    string
93
-     */
94
-    public function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null)
95
-    {
96
-        $options = $this->_allowed_enum_values();
97
-        if (isset($options[$value_on_field_to_be_outputted])) {
98
-            return $options[$value_on_field_to_be_outputted];
99
-        } else {
100
-            return $value_on_field_to_be_outputted;
101
-        }
102
-    }
103
-
104
-
105
-
106
-    /**
107
-     * When retrieving something from the DB, don't enforce the enum's options. If it's in the DB, we just have to live
108
-     * with that. Note also: when we're saving to the DB again, we also don't enforce the enum options. It's ONLY
109
-     * when we're receiving USER input from prepare_for_set() that we enforce the enum options.
110
-     *
111
-     * @param mixed $value_in_db
112
-     * @return mixed
113
-     */
114
-    public function prepare_for_set_from_db($value_in_db)
115
-    {
116
-        return $value_in_db;
117
-    }
118
-
119
-
120
-    public function getSchemaProperties()
121
-    {
122
-        return array(
123
-            'raw' => array(
124
-                'description' =>  sprintf(
125
-                    __('%s - the value in the database.', 'event_espresso'),
126
-                    $this->get_nicename()
127
-                ),
128
-                'type' => 'string',
129
-                'enum' => array_keys($this->_allowed_enum_values)
130
-            ),
131
-            'pretty' => array(
132
-                'description' =>  sprintf(
133
-                    __('%s - the value for display.', 'event_espresso'),
134
-                    $this->get_nicename()
135
-                ),
136
-                'type' => 'string',
137
-                'enum' => array_values($this->_allowed_enum_values),
138
-                'read_only' => true
139
-            )
140
-        );
141
-    }
15
+	/**
16
+	 * @var array $_allowed_enum_values
17
+	 */
18
+	public $_allowed_enum_values;
19
+
20
+	/**
21
+	 * @param string  $table_column
22
+	 * @param string  $nice_name
23
+	 * @param boolean $nullable
24
+	 * @param mixed   $default_value
25
+	 * @param array   $allowed_enum_values keys are values to be used in the DB, values are how they should be displayed
26
+	 */
27
+	function __construct($table_column, $nice_name, $nullable, $default_value, $allowed_enum_values)
28
+	{
29
+		$this->_allowed_enum_values = $allowed_enum_values;
30
+		parent::__construct($table_column, $nice_name, $nullable, $default_value);
31
+		$this->setSchemaType('object');
32
+	}
33
+
34
+
35
+
36
+	/**
37
+	 * Returns the list of allowed enum options, but filterable.
38
+	 * This is used internally
39
+	 *
40
+	 * @return array
41
+	 */
42
+	protected function _allowed_enum_values()
43
+	{
44
+		return apply_filters(
45
+			'FHEE__EE_Enum_Text_Field___allowed_enum_options',
46
+			$this->_allowed_enum_values,
47
+			$this
48
+		);
49
+	}
50
+
51
+
52
+
53
+	/**
54
+	 * When setting, just verify that the value being used matches what we've defined as allowable enum values.
55
+	 * If not, throw an error (but if WP_DEBUG is false, just set the value to default).
56
+	 *
57
+	 * @param string $value_inputted_for_field_on_model_object
58
+	 * @return string
59
+	 * @throws EE_Error
60
+	 */
61
+	public function prepare_for_set($value_inputted_for_field_on_model_object)
62
+	{
63
+		if (
64
+			$value_inputted_for_field_on_model_object !== null
65
+			&& ! array_key_exists($value_inputted_for_field_on_model_object, $this->_allowed_enum_values())
66
+		) {
67
+			if (defined('WP_DEBUG') && WP_DEBUG) {
68
+				$msg = sprintf(
69
+					__('System is assigning incompatible value "%1$s" to field "%2$s"', 'event_espresso'),
70
+					$value_inputted_for_field_on_model_object,
71
+					$this->_name
72
+				);
73
+				$msg2 = sprintf(
74
+					__('Allowed values for "%1$s" are "%2$s". You provided: "%3$s"', 'event_espresso'),
75
+					$this->_name,
76
+					implode(', ', array_keys($this->_allowed_enum_values())),
77
+					$value_inputted_for_field_on_model_object
78
+				);
79
+				EE_Error::add_error("{$msg}||{$msg2}", __FILE__, __FUNCTION__, __LINE__);
80
+			}
81
+			return $this->get_default_value();
82
+		}
83
+		return $value_inputted_for_field_on_model_object;
84
+	}
85
+
86
+
87
+	/**
88
+	 * Gets the pretty version of the enum's value.
89
+	 *
90
+	 * @param     int |string $value_on_field_to_be_outputted
91
+	 * @param    null         $schema
92
+	 * @return    string
93
+	 */
94
+	public function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null)
95
+	{
96
+		$options = $this->_allowed_enum_values();
97
+		if (isset($options[$value_on_field_to_be_outputted])) {
98
+			return $options[$value_on_field_to_be_outputted];
99
+		} else {
100
+			return $value_on_field_to_be_outputted;
101
+		}
102
+	}
103
+
104
+
105
+
106
+	/**
107
+	 * When retrieving something from the DB, don't enforce the enum's options. If it's in the DB, we just have to live
108
+	 * with that. Note also: when we're saving to the DB again, we also don't enforce the enum options. It's ONLY
109
+	 * when we're receiving USER input from prepare_for_set() that we enforce the enum options.
110
+	 *
111
+	 * @param mixed $value_in_db
112
+	 * @return mixed
113
+	 */
114
+	public function prepare_for_set_from_db($value_in_db)
115
+	{
116
+		return $value_in_db;
117
+	}
118
+
119
+
120
+	public function getSchemaProperties()
121
+	{
122
+		return array(
123
+			'raw' => array(
124
+				'description' =>  sprintf(
125
+					__('%s - the value in the database.', 'event_espresso'),
126
+					$this->get_nicename()
127
+				),
128
+				'type' => 'string',
129
+				'enum' => array_keys($this->_allowed_enum_values)
130
+			),
131
+			'pretty' => array(
132
+				'description' =>  sprintf(
133
+					__('%s - the value for display.', 'event_espresso'),
134
+					$this->get_nicename()
135
+				),
136
+				'type' => 'string',
137
+				'enum' => array_values($this->_allowed_enum_values),
138
+				'read_only' => true
139
+			)
140
+		);
141
+	}
142 142
 }
Please login to merge, or discard this patch.