@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -require_once( EE_MODELS . 'fields/EE_Foreign_Key_Field_Base.php'); |
|
3 | -class EE_Foreign_Key_Int_Field extends EE_Foreign_Key_Field_Base{ |
|
4 | - function get_wpdb_data_type(){ |
|
2 | +require_once(EE_MODELS.'fields/EE_Foreign_Key_Field_Base.php'); |
|
3 | +class EE_Foreign_Key_Int_Field extends EE_Foreign_Key_Field_Base { |
|
4 | + function get_wpdb_data_type() { |
|
5 | 5 | return '%d'; |
6 | 6 | } |
7 | 7 | /** |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | * @return int |
11 | 11 | */ |
12 | 12 | function prepare_for_set($value_inputted_for_field_on_model_object) { |
13 | - if($this->is_model_obj_of_type_pointed_to($value_inputted_for_field_on_model_object)){ |
|
13 | + if ($this->is_model_obj_of_type_pointed_to($value_inputted_for_field_on_model_object)) { |
|
14 | 14 | $value_inputted_for_field_on_model_object = $value_inputted_for_field_on_model_object->ID(); |
15 | 15 | } |
16 | 16 | return absint($value_inputted_for_field_on_model_object); |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | -require_once( EE_MODELS . 'fields/EE_Foreign_Key_Field_Base.php'); |
|
3 | -class EE_Foreign_Key_String_Field extends EE_Foreign_Key_Field_Base{ |
|
4 | - function get_wpdb_data_type(){ |
|
2 | +require_once(EE_MODELS.'fields/EE_Foreign_Key_Field_Base.php'); |
|
3 | +class EE_Foreign_Key_String_Field extends EE_Foreign_Key_Field_Base { |
|
4 | + function get_wpdb_data_type() { |
|
5 | 5 | return '%s'; |
6 | 6 | } |
7 | 7 | /** |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | * @return string |
11 | 11 | */ |
12 | 12 | function prepare_for_set($value_inputted_for_field_on_model_object) { |
13 | - if($this->is_model_obj_of_type_pointed_to($value_inputted_for_field_on_model_object)){ |
|
13 | + if ($this->is_model_obj_of_type_pointed_to($value_inputted_for_field_on_model_object)) { |
|
14 | 14 | $value_inputted_for_field_on_model_object = $value_inputted_for_field_on_model_object->ID(); |
15 | 15 | } |
16 | 16 | return strtoupper(wp_strip_all_tags($value_inputted_for_field_on_model_object)); |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | -require_once( EE_MODELS . 'fields/EE_Text_Field_Base.php' ); |
|
3 | -class EE_Full_HTML_Field extends EE_Text_Field_Base{ |
|
2 | +require_once(EE_MODELS.'fields/EE_Text_Field_Base.php'); |
|
3 | +class EE_Full_HTML_Field extends EE_Text_Field_Base { |
|
4 | 4 | |
5 | 5 | |
6 | 6 | /** |
@@ -10,11 +10,11 @@ discard block |
||
10 | 10 | * @return string |
11 | 11 | */ |
12 | 12 | function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null) { |
13 | - if($schema =='form_input'){ |
|
13 | + if ($schema == 'form_input') { |
|
14 | 14 | return parent::prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema); |
15 | - }elseif($schema == 'no_wpautop'){ |
|
15 | + }elseif ($schema == 'no_wpautop') { |
|
16 | 16 | return do_shortcode(parent::prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema)); |
17 | - }else{ |
|
17 | + } else { |
|
18 | 18 | return wpautop(do_shortcode(parent::prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema))); |
19 | 19 | } |
20 | 20 | } |
@@ -12,9 +12,9 @@ |
||
12 | 12 | function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null) { |
13 | 13 | if($schema =='form_input'){ |
14 | 14 | return parent::prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema); |
15 | - }elseif($schema == 'no_wpautop'){ |
|
15 | + } elseif($schema == 'no_wpautop'){ |
|
16 | 16 | return do_shortcode(parent::prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema)); |
17 | - }else{ |
|
17 | + } else{ |
|
18 | 18 | return wpautop(do_shortcode(parent::prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema))); |
19 | 19 | } |
20 | 20 | } |
@@ -7,32 +7,32 @@ discard block |
||
7 | 7 | * other than explicitly setting it to INF. |
8 | 8 | * Makes use of constant EE_INF_IN_DB set in espresso.php, and INF, which is a PHP constant definedin the ether |
9 | 9 | */ |
10 | -class EE_Infinite_Integer_Field extends EE_Model_Field_Base{ |
|
11 | - function get_wpdb_data_type(){ |
|
10 | +class EE_Infinite_Integer_Field extends EE_Model_Field_Base { |
|
11 | + function get_wpdb_data_type() { |
|
12 | 12 | return '%d'; |
13 | 13 | } |
14 | 14 | function prepare_for_use_in_db($value_of_field_on_model_object) { |
15 | - if($value_of_field_on_model_object === INF){ |
|
15 | + if ($value_of_field_on_model_object === INF) { |
|
16 | 16 | return EE_INF_IN_DB; |
17 | - }else{ |
|
17 | + } else { |
|
18 | 18 | return intval($value_of_field_on_model_object); |
19 | 19 | } |
20 | 20 | } |
21 | 21 | function prepare_for_set($value_inputted_for_field_on_model_object) { |
22 | - if($value_inputted_for_field_on_model_object === EE_INF_IN_DB || |
|
22 | + if ($value_inputted_for_field_on_model_object === EE_INF_IN_DB || |
|
23 | 23 | $value_inputted_for_field_on_model_object === INF || |
24 | 24 | $value_inputted_for_field_on_model_object === "INF" |
25 | - ){ |
|
25 | + ) { |
|
26 | 26 | return INF; |
27 | - }else{ |
|
27 | + } else { |
|
28 | 28 | return intval($value_inputted_for_field_on_model_object); |
29 | 29 | } |
30 | 30 | } |
31 | 31 | function prepare_for_set_from_db($value_inputted_for_field_on_model_object) { |
32 | 32 | $intval = intval($value_inputted_for_field_on_model_object); |
33 | - if($intval == EE_INF_IN_DB){ |
|
33 | + if ($intval == EE_INF_IN_DB) { |
|
34 | 34 | return INF; |
35 | - }else{ |
|
35 | + } else { |
|
36 | 36 | return $intval; |
37 | 37 | } |
38 | 38 | } |
@@ -45,9 +45,9 @@ discard block |
||
45 | 45 | * @param string $schema input, symbol, text; or any string you want to show if the value equals INF |
46 | 46 | * @return string |
47 | 47 | */ |
48 | - function prepare_for_pretty_echoing( $value_on_field_to_be_outputted, $schema = null ) { |
|
49 | - if( $value_on_field_to_be_outputted === INF ){ |
|
50 | - switch($schema){ |
|
48 | + function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null) { |
|
49 | + if ($value_on_field_to_be_outputted === INF) { |
|
50 | + switch ($schema) { |
|
51 | 51 | case 'input': |
52 | 52 | return ''; |
53 | 53 | case 'symbol': |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | function prepare_for_use_in_db($value_of_field_on_model_object) { |
15 | 15 | if($value_of_field_on_model_object === INF){ |
16 | 16 | return EE_INF_IN_DB; |
17 | - }else{ |
|
17 | + } else{ |
|
18 | 18 | return intval($value_of_field_on_model_object); |
19 | 19 | } |
20 | 20 | } |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | $value_inputted_for_field_on_model_object === "INF" |
25 | 25 | ){ |
26 | 26 | return INF; |
27 | - }else{ |
|
27 | + } else{ |
|
28 | 28 | return intval($value_inputted_for_field_on_model_object); |
29 | 29 | } |
30 | 30 | } |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | $intval = intval($value_inputted_for_field_on_model_object); |
33 | 33 | if($intval == EE_INF_IN_DB){ |
34 | 34 | return INF; |
35 | - }else{ |
|
35 | + } else{ |
|
36 | 36 | return $intval; |
37 | 37 | } |
38 | 38 | } |
@@ -3,8 +3,8 @@ |
||
3 | 3 | /** |
4 | 4 | * Text_Fields is a base class for any fields which are have integer value. (Exception: foreign and private key fields. Wish PHP had multiple-inheritance for this...) |
5 | 5 | */ |
6 | -class EE_Integer_Field extends EE_Model_Field_Base{ |
|
7 | - function get_wpdb_data_type(){ |
|
6 | +class EE_Integer_Field extends EE_Model_Field_Base { |
|
7 | + function get_wpdb_data_type() { |
|
8 | 8 | return '%d'; |
9 | 9 | } |
10 | 10 | function prepare_for_set($value_inputted_for_field_on_model_object) { |
@@ -4,17 +4,17 @@ discard block |
||
4 | 4 | /** |
5 | 5 | * For a db text column, which can either be an array in PHP code or a string. |
6 | 6 | */ |
7 | -require_once( EE_MODELS . 'fields/EE_Text_Field_Base.php' ); |
|
8 | -class EE_Maybe_Serialized_Text_Field extends EE_Serialized_Text_Field{ |
|
7 | +require_once(EE_MODELS.'fields/EE_Text_Field_Base.php'); |
|
8 | +class EE_Maybe_Serialized_Text_Field extends EE_Serialized_Text_Field { |
|
9 | 9 | /** |
10 | 10 | * Value could be an array or a string. If its an array, serialize it. Otherwise, leave it as a string |
11 | 11 | * @param array|string $value_of_field_on_model_object |
12 | 12 | * @return string (possibly serialized) |
13 | 13 | */ |
14 | 14 | function prepare_for_use_in_db($value_of_field_on_model_object) { |
15 | - if(is_array($value_of_field_on_model_object)){ |
|
15 | + if (is_array($value_of_field_on_model_object)) { |
|
16 | 16 | return parent::prepare_for_use_in_db($value_of_field_on_model_object); |
17 | - }else{ |
|
17 | + } else { |
|
18 | 18 | return $value_of_field_on_model_object; |
19 | 19 | } |
20 | 20 | } |
@@ -26,9 +26,9 @@ discard block |
||
26 | 26 | */ |
27 | 27 | function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null) { |
28 | 28 | $pretty_value = null; |
29 | - if(is_array($value_on_field_to_be_outputted)){ |
|
29 | + if (is_array($value_on_field_to_be_outputted)) { |
|
30 | 30 | $pretty_value = parent::prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema); |
31 | - }else{ |
|
31 | + } else { |
|
32 | 32 | $pretty_value = $value_on_field_to_be_outputted; |
33 | 33 | } |
34 | 34 | return $pretty_value; |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | function prepare_for_use_in_db($value_of_field_on_model_object) { |
15 | 15 | if(is_array($value_of_field_on_model_object)){ |
16 | 16 | return parent::prepare_for_use_in_db($value_of_field_on_model_object); |
17 | - }else{ |
|
17 | + } else{ |
|
18 | 18 | return $value_of_field_on_model_object; |
19 | 19 | } |
20 | 20 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | $pretty_value = null; |
29 | 29 | if(is_array($value_on_field_to_be_outputted)){ |
30 | 30 | $pretty_value = parent::prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema); |
31 | - }else{ |
|
31 | + } else{ |
|
32 | 32 | $pretty_value = $value_on_field_to_be_outputted; |
33 | 33 | } |
34 | 34 | return $pretty_value; |
@@ -74,7 +74,7 @@ |
||
74 | 74 | function get_name(){ |
75 | 75 | if($this->_name){ |
76 | 76 | return $this->_name; |
77 | - }else{ |
|
77 | + } else{ |
|
78 | 78 | throw new EE_Error(sprintf(__("Model field '%s' has no name set. Did you make a model and forget to call the parent model constructor?", "event_espresso"),get_class($this))); |
79 | 79 | } |
80 | 80 | } |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | * should be considered a string when inserting, updating, or using in a where clause for any queries (get_wpdb_data_type()), |
11 | 11 | * should be unserialized when being retrieved from the db (prepare_for_set_from_db()), and whatever else. |
12 | 12 | */ |
13 | -abstract class EE_Model_Field_Base{ |
|
13 | +abstract class EE_Model_Field_Base { |
|
14 | 14 | var $_table_alias; |
15 | 15 | var $_table_column; |
16 | 16 | var $_name; |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * @param $nullable |
27 | 27 | * @param null $default_value |
28 | 28 | */ |
29 | - function __construct($table_column, $nicename, $nullable, $default_value = null){ |
|
29 | + function __construct($table_column, $nicename, $nullable, $default_value = null) { |
|
30 | 30 | $this->_table_column = $table_column; |
31 | 31 | $this->_nicename = $nicename; |
32 | 32 | $this->_nullable = $nullable; |
@@ -37,22 +37,22 @@ discard block |
||
37 | 37 | * @param $table_alias |
38 | 38 | * @param $name |
39 | 39 | */ |
40 | - function _construct_finalize($table_alias, $name, $model_name){ |
|
40 | + function _construct_finalize($table_alias, $name, $model_name) { |
|
41 | 41 | $this->_table_alias = $table_alias; |
42 | 42 | $this->_name = $name; |
43 | 43 | $this->_model_name = $model_name; |
44 | 44 | } |
45 | - function get_table_alias(){ |
|
45 | + function get_table_alias() { |
|
46 | 46 | return $this->_table_alias; |
47 | 47 | } |
48 | - function get_table_column(){ |
|
48 | + function get_table_column() { |
|
49 | 49 | return $this->_table_column; |
50 | 50 | } |
51 | 51 | /** |
52 | 52 | * Returns the name of the model this field is on. Eg 'Event' or 'Ticket_Datetime' |
53 | 53 | * @return string |
54 | 54 | */ |
55 | - function get_model_name(){ |
|
55 | + function get_model_name() { |
|
56 | 56 | return $this->_model_name; |
57 | 57 | } |
58 | 58 | |
@@ -60,17 +60,17 @@ discard block |
||
60 | 60 | * @throws \EE_Error |
61 | 61 | * @return string |
62 | 62 | */ |
63 | - function get_name(){ |
|
64 | - if($this->_name){ |
|
63 | + function get_name() { |
|
64 | + if ($this->_name) { |
|
65 | 65 | return $this->_name; |
66 | - }else{ |
|
67 | - throw new EE_Error(sprintf(__("Model field '%s' has no name set. Did you make a model and forget to call the parent model constructor?", "event_espresso"),get_class($this))); |
|
66 | + } else { |
|
67 | + throw new EE_Error(sprintf(__("Model field '%s' has no name set. Did you make a model and forget to call the parent model constructor?", "event_espresso"), get_class($this))); |
|
68 | 68 | } |
69 | 69 | } |
70 | - function get_nicename(){ |
|
70 | + function get_nicename() { |
|
71 | 71 | return $this->_nicename; |
72 | 72 | } |
73 | - function is_nullable(){ |
|
73 | + function is_nullable() { |
|
74 | 74 | return $this->_nullable; |
75 | 75 | } |
76 | 76 | /** |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | * on insertion it can be null. However, on updates it must be present. |
79 | 79 | * @return boolean |
80 | 80 | */ |
81 | - function is_auto_increment(){ |
|
81 | + function is_auto_increment() { |
|
82 | 82 | return false; |
83 | 83 | } |
84 | 84 | /** |
@@ -86,14 +86,14 @@ discard block |
||
86 | 86 | * value domains at the top of EEM_Base |
87 | 87 | * @return mixed |
88 | 88 | */ |
89 | - function get_default_value(){ |
|
89 | + function get_default_value() { |
|
90 | 90 | return $this->_default_value; |
91 | 91 | } |
92 | 92 | |
93 | 93 | /** |
94 | 94 | * @return string |
95 | 95 | */ |
96 | - function get_qualified_column(){ |
|
96 | + function get_qualified_column() { |
|
97 | 97 | return $this->get_table_alias().".".$this->get_table_column(); |
98 | 98 | } |
99 | 99 | /** |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | * @param mixed $value_of_field_on_model_object |
105 | 105 | * @return mixed |
106 | 106 | */ |
107 | - function prepare_for_get($value_of_field_on_model_object){ |
|
107 | + function prepare_for_get($value_of_field_on_model_object) { |
|
108 | 108 | return $value_of_field_on_model_object; |
109 | 109 | } |
110 | 110 | /** |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | * @param mixed $value_of_field_on_model_object |
115 | 115 | * @return mixed |
116 | 116 | */ |
117 | - function prepare_for_use_in_db($value_of_field_on_model_object){ |
|
117 | + function prepare_for_use_in_db($value_of_field_on_model_object) { |
|
118 | 118 | return $value_of_field_on_model_object; |
119 | 119 | } |
120 | 120 | |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | * @param mixed $value_inputted_for_field_on_model_object |
126 | 126 | * @return mixed |
127 | 127 | */ |
128 | - function prepare_for_set($value_inputted_for_field_on_model_object){ |
|
128 | + function prepare_for_set($value_inputted_for_field_on_model_object) { |
|
129 | 129 | return $value_inputted_for_field_on_model_object; |
130 | 130 | } |
131 | 131 | |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | * @param mixed $value_found_in_db_for_model_object |
137 | 137 | * @return mixed |
138 | 138 | */ |
139 | - function prepare_for_set_from_db($value_found_in_db_for_model_object){ |
|
139 | + function prepare_for_set_from_db($value_found_in_db_for_model_object) { |
|
140 | 140 | return $this->prepare_for_set($value_found_in_db_for_model_object); |
141 | 141 | } |
142 | 142 | |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | * @param mixed $value_on_field_to_be_outputted |
148 | 148 | * @return mixed |
149 | 149 | */ |
150 | - function prepare_for_pretty_echoing( $value_on_field_to_be_outputted ){ |
|
150 | + function prepare_for_pretty_echoing($value_on_field_to_be_outputted) { |
|
151 | 151 | return $value_on_field_to_be_outputted; |
152 | 152 | } |
153 | 153 | |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | * By default, all fields aren't db-only. |
163 | 163 | * @return boolean |
164 | 164 | */ |
165 | - function is_db_only_field(){ |
|
165 | + function is_db_only_field() { |
|
166 | 166 | return false; |
167 | 167 | } |
168 | 168 | } |
169 | 169 | \ No newline at end of file |
@@ -2,8 +2,8 @@ discard block |
||
2 | 2 | /** |
3 | 3 | * Text_Fields is a base class for any fields which are have float value. (Exception: foreign and private key fields. Wish PHP had multiple-inheritance for this...) |
4 | 4 | */ |
5 | -class EE_Money_Field extends EE_Float_Field{ |
|
6 | - function get_wpdb_data_type(){ |
|
5 | +class EE_Money_Field extends EE_Float_Field { |
|
6 | + function get_wpdb_data_type() { |
|
7 | 7 | return '%f'; |
8 | 8 | } |
9 | 9 | /** |
@@ -15,21 +15,21 @@ discard block |
||
15 | 15 | * @param type $schema |
16 | 16 | * @return string |
17 | 17 | */ |
18 | - function prepare_for_pretty_echoing($value_on_field_to_be_outputted,$schema = null){ |
|
18 | + function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null) { |
|
19 | 19 | $pretty_float = parent::prepare_for_pretty_echoing($value_on_field_to_be_outputted); |
20 | 20 | |
21 | - if($schema == 'localized_float'){ |
|
21 | + if ($schema == 'localized_float') { |
|
22 | 22 | return $pretty_float; |
23 | 23 | } |
24 | - EE_Registry::instance()->load_helper( 'Template' ); |
|
25 | - if($schema == 'no_currency_code'){ |
|
24 | + EE_Registry::instance()->load_helper('Template'); |
|
25 | + if ($schema == 'no_currency_code') { |
|
26 | 26 | // echo "schema no currency!"; |
27 | 27 | $display_code = false; |
28 | - }else{ |
|
28 | + } else { |
|
29 | 29 | $display_code = true; |
30 | 30 | } |
31 | 31 | //we don't use the $pretty_float because format_currency will take care of it. |
32 | - return EEH_Template::format_currency( $value_on_field_to_be_outputted, false, $display_code ); |
|
32 | + return EEH_Template::format_currency($value_on_field_to_be_outputted, false, $display_code); |
|
33 | 33 | } |
34 | 34 | |
35 | 35 | /** |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | //now it's a float-style string or number |
49 | 49 | $float_val = parent::prepare_for_set($value_inputted_for_field_on_model_object); |
50 | 50 | //round to the correctly number of decimal places for this currency |
51 | - $rounded_value = round($float_val, EE_Registry::instance()->CFG->currency->dec_plc); |
|
51 | + $rounded_value = round($float_val, EE_Registry::instance()->CFG->currency->dec_plc); |
|
52 | 52 | return $rounded_value; |
53 | 53 | } |
54 | 54 |
@@ -25,7 +25,7 @@ |
||
25 | 25 | if($schema == 'no_currency_code'){ |
26 | 26 | // echo "schema no currency!"; |
27 | 27 | $display_code = false; |
28 | - }else{ |
|
28 | + } else{ |
|
29 | 29 | $display_code = true; |
30 | 30 | } |
31 | 31 | //we don't use the $pretty_float because format_currency will take care of it. |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | -require_once( EE_MODELS . 'fields/EE_Text_Field_Base.php' ); |
|
3 | -class EE_Plain_Text_Field extends EE_Text_Field_Base{ |
|
2 | +require_once(EE_MODELS.'fields/EE_Text_Field_Base.php'); |
|
3 | +class EE_Plain_Text_Field extends EE_Text_Field_Base { |
|
4 | 4 | /** |
5 | 5 | * removes all tags when setting |
6 | 6 | * @param string $value_inputted_for_field_on_model_object |