@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -44,7 +46,7 @@ discard block |
||
44 | 46 | foreach( $value as $key => $v ) { |
45 | 47 | $value[ $key ] = $this->_remove_tags( $v ); |
46 | 48 | } |
47 | - }elseif( is_string( $value ) ) { |
|
49 | + } elseif( is_string( $value ) ) { |
|
48 | 50 | $value = wp_kses("$value", $this->_get_allowed_tags() ); |
49 | 51 | } |
50 | 52 | return $value; |
@@ -24,14 +24,14 @@ discard block |
||
24 | 24 | * But either way, the string or the array's values can ONLY contain simple HTML tags. |
25 | 25 | * If you want to allow Full HTML in the value, use EE_Maybe_Serialized_Text_Field |
26 | 26 | */ |
27 | -class EE_Maybe_Serialized_Simple_HTML_Field extends EE_Maybe_Serialized_Text_Field{ |
|
27 | +class EE_Maybe_Serialized_Simple_HTML_Field extends EE_Maybe_Serialized_Text_Field { |
|
28 | 28 | /** |
29 | 29 | * removes all non-basic tags when setting |
30 | 30 | * @param string $value_inputted_for_field_on_model_object |
31 | 31 | * @return string |
32 | 32 | */ |
33 | 33 | function prepare_for_set($value_inputted_for_field_on_model_object) { |
34 | - return parent::prepare_for_set( $this->_remove_tags( $value_inputted_for_field_on_model_object ) ); |
|
34 | + return parent::prepare_for_set($this->_remove_tags($value_inputted_for_field_on_model_object)); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
@@ -39,13 +39,13 @@ discard block |
||
39 | 39 | * @param array|string $value |
40 | 40 | * @return array|string |
41 | 41 | */ |
42 | - protected function _remove_tags( $value ) { |
|
43 | - if( is_array( $value ) ) { |
|
44 | - foreach( $value as $key => $v ) { |
|
45 | - $value[ $key ] = $this->_remove_tags( $v ); |
|
42 | + protected function _remove_tags($value) { |
|
43 | + if (is_array($value)) { |
|
44 | + foreach ($value as $key => $v) { |
|
45 | + $value[$key] = $this->_remove_tags($v); |
|
46 | 46 | } |
47 | - }elseif( is_string( $value ) ) { |
|
48 | - $value = wp_kses("$value", $this->_get_allowed_tags() ); |
|
47 | + }elseif (is_string($value)) { |
|
48 | + $value = wp_kses("$value", $this->_get_allowed_tags()); |
|
49 | 49 | } |
50 | 50 | return $value; |
51 | 51 | } |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | * @return array|string |
57 | 57 | */ |
58 | 58 | function prepare_for_set_from_db($value_found_in_db_for_model_object) { |
59 | - return $this->_remove_tags( parent::prepare_for_set_from_db( $value_found_in_db_for_model_object ) ); |
|
59 | + return $this->_remove_tags(parent::prepare_for_set_from_db($value_found_in_db_for_model_object)); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | * @global array $allowedtags |
66 | 66 | * @return array |
67 | 67 | */ |
68 | - function _get_allowed_tags(){ |
|
69 | - return apply_filters( 'FHEE__EE_Maybe_Serialized_Simple_HTML_Field___get_allowed_tags', EEH_HTML::get_simple_tags(), $this ); |
|
68 | + function _get_allowed_tags() { |
|
69 | + return apply_filters('FHEE__EE_Maybe_Serialized_Simple_HTML_Field___get_allowed_tags', EEH_HTML::get_simple_tags(), $this); |
|
70 | 70 | } |
71 | 71 | } |
@@ -19,7 +19,6 @@ |
||
19 | 19 | * @package Event Espresso |
20 | 20 | * @subpackage includes/models/ |
21 | 21 | * @author Michael Nelson |
22 | - |
|
23 | 22 | * Model field for representing a column that CAN contain serialized text, or a regular string. |
24 | 23 | * But either way, the string or the array's values can ONLY contain simple HTML tags. |
25 | 24 | * If you want to allow Full HTML in the value, use EE_Maybe_Serialized_Text_Field |
@@ -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 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | /** |
5 | 5 | * |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | * @subpackage /core/db_models/fields/EE_Model_Field_Base.php |
19 | 19 | * @author Michael Nelson |
20 | 20 | */ |
21 | -abstract class EE_Model_Field_Base{ |
|
21 | +abstract class EE_Model_Field_Base { |
|
22 | 22 | var $_table_alias; |
23 | 23 | var $_table_column; |
24 | 24 | var $_name; |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | * @param $nullable |
35 | 35 | * @param null $default_value |
36 | 36 | */ |
37 | - function __construct($table_column, $nicename, $nullable, $default_value = null){ |
|
37 | + function __construct($table_column, $nicename, $nullable, $default_value = null) { |
|
38 | 38 | $this->_table_column = $table_column; |
39 | 39 | $this->_nicename = $nicename; |
40 | 40 | $this->_nullable = $nullable; |
@@ -48,27 +48,27 @@ discard block |
||
48 | 48 | * @param $name |
49 | 49 | * @param $model_name |
50 | 50 | */ |
51 | - function _construct_finalize($table_alias, $name, $model_name){ |
|
51 | + function _construct_finalize($table_alias, $name, $model_name) { |
|
52 | 52 | $this->_table_alias = $table_alias; |
53 | 53 | $this->_name = $name; |
54 | 54 | $this->_model_name = $model_name; |
55 | 55 | /** |
56 | 56 | * allow for changing the defaults |
57 | 57 | */ |
58 | - $this->_nicename = apply_filters( 'FHEE__EE_Model_Field_Base___construct_finalize___nicename', $this->_nicename, $this ); |
|
59 | - $this->_default_value = apply_filters( 'FHEE__EE_Model_Field_Base___construct_finalize___default_value', $this->_default_value, $this ); |
|
58 | + $this->_nicename = apply_filters('FHEE__EE_Model_Field_Base___construct_finalize___nicename', $this->_nicename, $this); |
|
59 | + $this->_default_value = apply_filters('FHEE__EE_Model_Field_Base___construct_finalize___default_value', $this->_default_value, $this); |
|
60 | 60 | } |
61 | - function get_table_alias(){ |
|
61 | + function get_table_alias() { |
|
62 | 62 | return $this->_table_alias; |
63 | 63 | } |
64 | - function get_table_column(){ |
|
64 | + function get_table_column() { |
|
65 | 65 | return $this->_table_column; |
66 | 66 | } |
67 | 67 | /** |
68 | 68 | * Returns the name of the model this field is on. Eg 'Event' or 'Ticket_Datetime' |
69 | 69 | * @return string |
70 | 70 | */ |
71 | - function get_model_name(){ |
|
71 | + function get_model_name() { |
|
72 | 72 | return $this->_model_name; |
73 | 73 | } |
74 | 74 | |
@@ -76,17 +76,17 @@ discard block |
||
76 | 76 | * @throws \EE_Error |
77 | 77 | * @return string |
78 | 78 | */ |
79 | - function get_name(){ |
|
80 | - if($this->_name){ |
|
79 | + function get_name() { |
|
80 | + if ($this->_name) { |
|
81 | 81 | return $this->_name; |
82 | - }else{ |
|
83 | - 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))); |
|
82 | + } else { |
|
83 | + 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))); |
|
84 | 84 | } |
85 | 85 | } |
86 | - function get_nicename(){ |
|
86 | + function get_nicename() { |
|
87 | 87 | return $this->_nicename; |
88 | 88 | } |
89 | - function is_nullable(){ |
|
89 | + function is_nullable() { |
|
90 | 90 | return $this->_nullable; |
91 | 91 | } |
92 | 92 | /** |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | * on insertion it can be null. However, on updates it must be present. |
95 | 95 | * @return boolean |
96 | 96 | */ |
97 | - function is_auto_increment(){ |
|
97 | + function is_auto_increment() { |
|
98 | 98 | return false; |
99 | 99 | } |
100 | 100 | /** |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | * value domains at the top of EEM_Base |
103 | 103 | * @return mixed |
104 | 104 | */ |
105 | - function get_default_value(){ |
|
105 | + function get_default_value() { |
|
106 | 106 | return $this->_default_value; |
107 | 107 | } |
108 | 108 | |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | * in the current query |
114 | 114 | * @return string |
115 | 115 | */ |
116 | - function get_qualified_column(){ |
|
116 | + function get_qualified_column() { |
|
117 | 117 | return $this->get_table_alias().".".$this->get_table_column(); |
118 | 118 | } |
119 | 119 | /** |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | * @param mixed $value_of_field_on_model_object |
125 | 125 | * @return mixed |
126 | 126 | */ |
127 | - function prepare_for_get($value_of_field_on_model_object){ |
|
127 | + function prepare_for_get($value_of_field_on_model_object) { |
|
128 | 128 | return $value_of_field_on_model_object; |
129 | 129 | } |
130 | 130 | /** |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | * @param mixed $value_of_field_on_model_object |
135 | 135 | * @return mixed |
136 | 136 | */ |
137 | - function prepare_for_use_in_db($value_of_field_on_model_object){ |
|
137 | + function prepare_for_use_in_db($value_of_field_on_model_object) { |
|
138 | 138 | return $value_of_field_on_model_object; |
139 | 139 | } |
140 | 140 | |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | * @param mixed $value_inputted_for_field_on_model_object |
146 | 146 | * @return mixed |
147 | 147 | */ |
148 | - function prepare_for_set($value_inputted_for_field_on_model_object){ |
|
148 | + function prepare_for_set($value_inputted_for_field_on_model_object) { |
|
149 | 149 | return $value_inputted_for_field_on_model_object; |
150 | 150 | } |
151 | 151 | |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | * @param mixed $value_found_in_db_for_model_object |
157 | 157 | * @return mixed |
158 | 158 | */ |
159 | - function prepare_for_set_from_db($value_found_in_db_for_model_object){ |
|
159 | + function prepare_for_set_from_db($value_found_in_db_for_model_object) { |
|
160 | 160 | return $this->prepare_for_set($value_found_in_db_for_model_object); |
161 | 161 | } |
162 | 162 | |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | * @param mixed $value_on_field_to_be_outputted |
168 | 168 | * @return mixed |
169 | 169 | */ |
170 | - function prepare_for_pretty_echoing( $value_on_field_to_be_outputted ){ |
|
170 | + function prepare_for_pretty_echoing($value_on_field_to_be_outputted) { |
|
171 | 171 | return $value_on_field_to_be_outputted; |
172 | 172 | } |
173 | 173 | |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | * By default, all fields aren't db-only. |
183 | 183 | * @return boolean |
184 | 184 | */ |
185 | - function is_db_only_field(){ |
|
185 | + function is_db_only_field() { |
|
186 | 186 | return false; |
187 | 187 | } |
188 | 188 | } |
189 | 189 | \ No newline at end of file |
@@ -29,9 +29,9 @@ |
||
29 | 29 | protected $_model_name; |
30 | 30 | |
31 | 31 | /** |
32 | - * @param $table_column |
|
32 | + * @param string $table_column |
|
33 | 33 | * @param $nicename |
34 | - * @param $nullable |
|
34 | + * @param boolean $nullable |
|
35 | 35 | * @param null $default_value |
36 | 36 | */ |
37 | 37 | function __construct($table_column, $nicename, $nullable, $default_value = null){ |
@@ -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. |
@@ -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,20 +15,20 @@ 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 | - if($schema == 'no_currency_code'){ |
|
24 | + if ($schema == 'no_currency_code') { |
|
25 | 25 | // echo "schema no currency!"; |
26 | 26 | $display_code = false; |
27 | - }else{ |
|
27 | + } else { |
|
28 | 28 | $display_code = true; |
29 | 29 | } |
30 | 30 | //we don't use the $pretty_float because format_currency will take care of it. |
31 | - return EEH_Template::format_currency( $value_on_field_to_be_outputted, false, $display_code ); |
|
31 | + return EEH_Template::format_currency($value_on_field_to_be_outputted, false, $display_code); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | /** |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | //now it's a float-style string or number |
48 | 48 | $float_val = parent::prepare_for_set($value_inputted_for_field_on_model_object); |
49 | 49 | //round to the correctly number of decimal places for this currency |
50 | - $rounded_value = round($float_val, EE_Registry::instance()->CFG->currency->dec_plc); |
|
50 | + $rounded_value = round($float_val, EE_Registry::instance()->CFG->currency->dec_plc); |
|
51 | 51 | return $rounded_value; |
52 | 52 | } |
53 | 53 |
@@ -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 |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | -require_once( EE_MODELS . 'fields/EE_Text_Field_Base.php' ); |
|
3 | -class EE_Slug_Field extends EE_Text_Field_Base{ |
|
2 | +require_once(EE_MODELS.'fields/EE_Text_Field_Base.php'); |
|
3 | +class EE_Slug_Field extends EE_Text_Field_Base { |
|
4 | 4 | /** |
5 | 5 | * ensures string is usable in URLs |
6 | 6 | * @param string $value_inputted_for_field_on_model_object |
@@ -2,13 +2,13 @@ discard block |
||
2 | 2 | /** |
3 | 3 | * Text_Fields is a base class for any fields which are have text value. (Exception: foreign and private key fields. Wish PHP had multiple-inheritance for this...) |
4 | 4 | */ |
5 | -abstract class EE_Text_Field_Base extends EE_Model_Field_Base{ |
|
6 | - function get_wpdb_data_type(){ |
|
5 | +abstract class EE_Text_Field_Base extends EE_Model_Field_Base { |
|
6 | + function get_wpdb_data_type() { |
|
7 | 7 | return '%s'; |
8 | 8 | } |
9 | 9 | |
10 | - function prepare_for_get( $value_of_field_on_model_object ) { |
|
11 | - return is_string($value_of_field_on_model_object) ? stripslashes( $value_of_field_on_model_object ) : $value_of_field_on_model_object; |
|
10 | + function prepare_for_get($value_of_field_on_model_object) { |
|
11 | + return is_string($value_of_field_on_model_object) ? stripslashes($value_of_field_on_model_object) : $value_of_field_on_model_object; |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | /** |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | * @return string |
19 | 19 | */ |
20 | 20 | function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null) { |
21 | - if($schema=='form_input'){ |
|
21 | + if ($schema == 'form_input') { |
|
22 | 22 | $value_on_field_to_be_outputted = htmlentities($value_on_field_to_be_outputted, ENT_QUOTES, 'UTF-8'); |
23 | 23 | } |
24 | 24 | return parent::prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema); |
@@ -30,6 +30,6 @@ discard block |
||
30 | 30 | * @return string |
31 | 31 | */ |
32 | 32 | function prepare_for_set($value_inputted_for_field_on_model_object) { |
33 | - return stripslashes(html_entity_decode(parent::prepare_for_set($value_inputted_for_field_on_model_object),ENT_QUOTES,'UTF-8')); |
|
33 | + return stripslashes(html_entity_decode(parent::prepare_for_set($value_inputted_for_field_on_model_object), ENT_QUOTES, 'UTF-8')); |
|
34 | 34 | } |
35 | 35 | } |
36 | 36 | \ No newline at end of file |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | -require_once( EE_MODELS . 'fields/EE_Boolean_Field.php'); |
|
3 | -class EE_Trashed_Flag_Field extends EE_Boolean_Field{ |
|
2 | +require_once(EE_MODELS.'fields/EE_Boolean_Field.php'); |
|
3 | +class EE_Trashed_Flag_Field extends EE_Boolean_Field { |
|
4 | 4 | //note: some client code simply checks if a field IS an EE_Trashed_Flag_Field |
5 | 5 | //...otherwise, these fields are mostly the same as boolean fields |
6 | 6 | } |
@@ -2,13 +2,13 @@ |
||
2 | 2 | /** |
3 | 3 | * For CPT models who have a post type field |
4 | 4 | */ |
5 | -class EE_WP_Post_Type_Field extends EE_DB_Only_Text_Field{ |
|
5 | +class EE_WP_Post_Type_Field extends EE_DB_Only_Text_Field { |
|
6 | 6 | /** |
7 | 7 | * |
8 | 8 | * @param string $post_type the exact string to be used for the post type |
9 | 9 | * of all these post type model objects/rows |
10 | 10 | */ |
11 | - function __construct($post_type){ |
|
11 | + function __construct($post_type) { |
|
12 | 12 | parent::__construct('post_type', __("Post Type", 'event_espresso'), false, $post_type); |
13 | 13 | } |
14 | 14 | } |
15 | 15 | \ No newline at end of file |