@@ -2,22 +2,22 @@ |
||
2 | 2 | exit( 'No direct script access allowed' ); |
3 | 3 | } |
4 | 4 | /** |
5 | - * |
|
6 | - * EE_Model_Field_Base class |
|
7 | - * |
|
8 | - * Base class for all EE_*_Field classes. These classes are for providing information and functions specific to each |
|
9 | - * field. They define the field's data type for insertion into the db (eg, if the value should be treated as an int, float, or string), |
|
10 | - * what values for the field are acceptable (eg, if setting EVT_ID to a float is acceptable), and generally any functionality within |
|
11 | - * EEM_Base or EE_Base_Class which depend on the field's type. (ie, you shouldn't need any logic within your model |
|
12 | - * or model object which are dependent on the field's type, ideally). For example, EE_Serialized_Text_Field, specifies that any fields of this type |
|
13 | - * should be serialized before insertion into the db (prepare_for_insertion_into_db()), |
|
14 | - * should be considered a string when inserting, updating, or using in a where clause for any queries (get_wpdb_data_type()), |
|
15 | - * should be unserialized when being retrieved from the db (prepare_for_set_from_db()), and whatever else. |
|
16 | - * |
|
17 | - * @package Event Espresso |
|
18 | - * @subpackage /core/db_models/fields/EE_Model_Field_Base.php |
|
19 | - * @author Michael Nelson |
|
20 | - */ |
|
5 | + * |
|
6 | + * EE_Model_Field_Base class |
|
7 | + * |
|
8 | + * Base class for all EE_*_Field classes. These classes are for providing information and functions specific to each |
|
9 | + * field. They define the field's data type for insertion into the db (eg, if the value should be treated as an int, float, or string), |
|
10 | + * what values for the field are acceptable (eg, if setting EVT_ID to a float is acceptable), and generally any functionality within |
|
11 | + * EEM_Base or EE_Base_Class which depend on the field's type. (ie, you shouldn't need any logic within your model |
|
12 | + * or model object which are dependent on the field's type, ideally). For example, EE_Serialized_Text_Field, specifies that any fields of this type |
|
13 | + * should be serialized before insertion into the db (prepare_for_insertion_into_db()), |
|
14 | + * should be considered a string when inserting, updating, or using in a where clause for any queries (get_wpdb_data_type()), |
|
15 | + * should be unserialized when being retrieved from the db (prepare_for_set_from_db()), and whatever else. |
|
16 | + * |
|
17 | + * @package Event Espresso |
|
18 | + * @subpackage /core/db_models/fields/EE_Model_Field_Base.php |
|
19 | + * @author Michael Nelson |
|
20 | + */ |
|
21 | 21 | abstract class EE_Model_Field_Base{ |
22 | 22 | var $_table_alias; |
23 | 23 | var $_table_column; |
@@ -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,22 +48,22 @@ 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 | - function get_table_alias(){ |
|
56 | + function get_table_alias() { |
|
57 | 57 | return $this->_table_alias; |
58 | 58 | } |
59 | - function get_table_column(){ |
|
59 | + function get_table_column() { |
|
60 | 60 | return $this->_table_column; |
61 | 61 | } |
62 | 62 | /** |
63 | 63 | * Returns the name of the model this field is on. Eg 'Event' or 'Ticket_Datetime' |
64 | 64 | * @return string |
65 | 65 | */ |
66 | - function get_model_name(){ |
|
66 | + function get_model_name() { |
|
67 | 67 | return $this->_model_name; |
68 | 68 | } |
69 | 69 | |
@@ -71,17 +71,17 @@ discard block |
||
71 | 71 | * @throws \EE_Error |
72 | 72 | * @return string |
73 | 73 | */ |
74 | - function get_name(){ |
|
75 | - if($this->_name){ |
|
74 | + function get_name() { |
|
75 | + if ($this->_name) { |
|
76 | 76 | return $this->_name; |
77 | - }else{ |
|
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))); |
|
77 | + } else { |
|
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 | } |
81 | - function get_nicename(){ |
|
81 | + function get_nicename() { |
|
82 | 82 | return $this->_nicename; |
83 | 83 | } |
84 | - function is_nullable(){ |
|
84 | + function is_nullable() { |
|
85 | 85 | return $this->_nullable; |
86 | 86 | } |
87 | 87 | /** |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | * on insertion it can be null. However, on updates it must be present. |
90 | 90 | * @return boolean |
91 | 91 | */ |
92 | - function is_auto_increment(){ |
|
92 | + function is_auto_increment() { |
|
93 | 93 | return false; |
94 | 94 | } |
95 | 95 | /** |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | * value domains at the top of EEM_Base |
98 | 98 | * @return mixed |
99 | 99 | */ |
100 | - function get_default_value(){ |
|
100 | + function get_default_value() { |
|
101 | 101 | return $this->_default_value; |
102 | 102 | } |
103 | 103 | |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | * in the current query |
109 | 109 | * @return string |
110 | 110 | */ |
111 | - function get_qualified_column(){ |
|
111 | + function get_qualified_column() { |
|
112 | 112 | return $this->get_table_alias().".".$this->get_table_column(); |
113 | 113 | } |
114 | 114 | /** |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | * @param mixed $value_of_field_on_model_object |
120 | 120 | * @return mixed |
121 | 121 | */ |
122 | - function prepare_for_get($value_of_field_on_model_object){ |
|
122 | + function prepare_for_get($value_of_field_on_model_object) { |
|
123 | 123 | return $value_of_field_on_model_object; |
124 | 124 | } |
125 | 125 | /** |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | * @param mixed $value_of_field_on_model_object |
130 | 130 | * @return mixed |
131 | 131 | */ |
132 | - function prepare_for_use_in_db($value_of_field_on_model_object){ |
|
132 | + function prepare_for_use_in_db($value_of_field_on_model_object) { |
|
133 | 133 | return $value_of_field_on_model_object; |
134 | 134 | } |
135 | 135 | |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | * @param mixed $value_inputted_for_field_on_model_object |
141 | 141 | * @return mixed |
142 | 142 | */ |
143 | - function prepare_for_set($value_inputted_for_field_on_model_object){ |
|
143 | + function prepare_for_set($value_inputted_for_field_on_model_object) { |
|
144 | 144 | return $value_inputted_for_field_on_model_object; |
145 | 145 | } |
146 | 146 | |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | * @param mixed $value_found_in_db_for_model_object |
152 | 152 | * @return mixed |
153 | 153 | */ |
154 | - function prepare_for_set_from_db($value_found_in_db_for_model_object){ |
|
154 | + function prepare_for_set_from_db($value_found_in_db_for_model_object) { |
|
155 | 155 | return $this->prepare_for_set($value_found_in_db_for_model_object); |
156 | 156 | } |
157 | 157 | |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | * @param mixed $value_on_field_to_be_outputted |
163 | 163 | * @return mixed |
164 | 164 | */ |
165 | - function prepare_for_pretty_echoing( $value_on_field_to_be_outputted ){ |
|
165 | + function prepare_for_pretty_echoing($value_on_field_to_be_outputted) { |
|
166 | 166 | return $value_on_field_to_be_outputted; |
167 | 167 | } |
168 | 168 | |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | * By default, all fields aren't db-only. |
178 | 178 | * @return boolean |
179 | 179 | */ |
180 | - function is_db_only_field(){ |
|
180 | + function is_db_only_field() { |
|
181 | 181 | return false; |
182 | 182 | } |
183 | 183 | } |
184 | 184 | \ No newline at end of file |
@@ -90,7 +90,7 @@ |
||
90 | 90 | //so in case teh IPN is arriving later, let's try to process an IPN! |
91 | 91 | if($_SERVER['REQUEST_METHOD'] == 'POST'){ |
92 | 92 | return $this->handle_ipn($_POST, $transaction ); |
93 | - }else{ |
|
93 | + } else{ |
|
94 | 94 | return parent::finalize_payment_for( $transaction ); |
95 | 95 | } |
96 | 96 | } |
@@ -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){ |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
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 | - */ |
|
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 | + */ |
|
5 | 5 | class EE_Money_Field extends EE_Float_Field{ |
6 | 6 | function get_wpdb_data_type(){ |
7 | 7 | return '%f'; |
@@ -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 |
@@ -90,7 +90,7 @@ |
||
90 | 90 | //so in case teh IPN is arriving later, let's try to process an IPN! |
91 | 91 | if($_SERVER['REQUEST_METHOD'] == 'POST'){ |
92 | 92 | return $this->handle_ipn($_POST, $transaction ); |
93 | - }else{ |
|
93 | + } else{ |
|
94 | 94 | return parent::finalize_payment_for( $transaction ); |
95 | 95 | } |
96 | 96 | } |
@@ -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,8 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Field to only allow tags that are normally allowed on post_content: |
|
4 | - * address,a,abbr,acronym,area,article,aside,b,big,blockquote,br,button,caption,cite,code,col,del,dd,dfn,details,div,dl,dt,em,fieldset,figure,figcaption,font,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,hr,i,img,ins,kbd,label,legend,li,map,mark,menu,nav,p,pre,q,s,samp,span,section,small,strike,strong,sub,summary,sup,table,tbody,td,textarea,tfoot,th,thead,title,tr,tt,u,ul,ol,var |
|
5 | - */ |
|
3 | + * Field to only allow tags that are normally allowed on post_content: |
|
4 | + * address,a,abbr,acronym,area,article,aside,b,big,blockquote,br,button,caption,cite,code,col,del,dd,dfn,details,div,dl,dt,em,fieldset,figure,figcaption,font,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,hr,i,img,ins,kbd,label,legend,li,map,mark,menu,nav,p,pre,q,s,samp,span,section,small,strike,strong,sub,summary,sup,table,tbody,td,textarea,tfoot,th,thead,title,tr,tt,u,ul,ol,var |
|
5 | + */ |
|
6 | 6 | class EE_Post_Content_Field extends EE_Text_Field_Base{ |
7 | 7 | /** |
8 | 8 | * removes all tags which a WP Post wouldn't allow in its content normally |
@@ -3,18 +3,18 @@ |
||
3 | 3 | * Field to only allow tags that are normally allowed on post_content: |
4 | 4 | * address,a,abbr,acronym,area,article,aside,b,big,blockquote,br,button,caption,cite,code,col,del,dd,dfn,details,div,dl,dt,em,fieldset,figure,figcaption,font,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,hr,i,img,ins,kbd,label,legend,li,map,mark,menu,nav,p,pre,q,s,samp,span,section,small,strike,strong,sub,summary,sup,table,tbody,td,textarea,tfoot,th,thead,title,tr,tt,u,ul,ol,var |
5 | 5 | */ |
6 | -class EE_Post_Content_Field extends EE_Full_HTML_Field{ |
|
6 | +class EE_Post_Content_Field extends EE_Full_HTML_Field { |
|
7 | 7 | /** |
8 | 8 | * removes all tags which a WP Post wouldn't allow in its content normally |
9 | 9 | * @param string $value_inputted_for_field_on_model_object |
10 | 10 | * @return string |
11 | 11 | */ |
12 | 12 | function prepare_for_set($value_inputted_for_field_on_model_object) { |
13 | - $value_with_select_tags = wp_kses("$value_inputted_for_field_on_model_object",wp_kses_allowed_html( 'post' )); |
|
13 | + $value_with_select_tags = wp_kses("$value_inputted_for_field_on_model_object", wp_kses_allowed_html('post')); |
|
14 | 14 | return parent::prepare_for_set($value_with_select_tags); |
15 | 15 | } |
16 | 16 | |
17 | - function prepare_for_set_from_db($value_found_in_db_for_model_object){ |
|
17 | + function prepare_for_set_from_db($value_found_in_db_for_model_object) { |
|
18 | 18 | return $value_found_in_db_for_model_object; |
19 | 19 | } |
20 | 20 | } |
21 | 21 | \ No newline at end of file |
@@ -1,14 +1,14 @@ |
||
1 | 1 | <?php |
2 | -require_once( EE_MODELS . 'fields/EE_Primary_Key_Field_Base.php'); |
|
3 | -class EE_Primary_Key_Int_Field extends EE_Primary_Key_Field_Base{ |
|
4 | - function get_wpdb_data_type(){ |
|
2 | +require_once(EE_MODELS.'fields/EE_Primary_Key_Field_Base.php'); |
|
3 | +class EE_Primary_Key_Int_Field extends EE_Primary_Key_Field_Base { |
|
4 | + function get_wpdb_data_type() { |
|
5 | 5 | return '%d'; |
6 | 6 | } |
7 | 7 | public function __construct($table_column, $nicename) { |
8 | 8 | parent::__construct($table_column, $nicename, 0); |
9 | 9 | } |
10 | 10 | function prepare_for_set($value_inputted_for_field_on_model_object) { |
11 | - if($this->is_model_obj_of_type_pointed_to($value_inputted_for_field_on_model_object)){ |
|
11 | + if ($this->is_model_obj_of_type_pointed_to($value_inputted_for_field_on_model_object)) { |
|
12 | 12 | $value_inputted_for_field_on_model_object = $value_inputted_for_field_on_model_object->ID(); |
13 | 13 | } |
14 | 14 | return absint($value_inputted_for_field_on_model_object); |
@@ -4,6 +4,10 @@ |
||
4 | 4 | function get_wpdb_data_type(){ |
5 | 5 | return '%s'; |
6 | 6 | } |
7 | + |
|
8 | + /** |
|
9 | + * @param string $table_column |
|
10 | + */ |
|
7 | 11 | public function __construct($table_column, $nicename) { |
8 | 12 | parent::__construct($table_column, $nicename, NULL); |
9 | 13 | } |
@@ -20,9 +20,9 @@ |
||
20 | 20 | function prepare_for_set($value_inputted_for_field_on_model_object) { |
21 | 21 | if(is_string($value_inputted_for_field_on_model_object)){ |
22 | 22 | return parent::prepare_for_set($value_inputted_for_field_on_model_object); |
23 | - }elseif(is_array($value_inputted_for_field_on_model_object)){ |
|
23 | + } elseif(is_array($value_inputted_for_field_on_model_object)){ |
|
24 | 24 | return array_map(array($this,'prepare_for_set'), $value_inputted_for_field_on_model_object); |
25 | - }else{//so they passed NULL or an INT or something wack |
|
25 | + } else{//so they passed NULL or an INT or something wack |
|
26 | 26 | return $value_inputted_for_field_on_model_object; |
27 | 27 | } |
28 | 28 | } |
@@ -7,8 +7,8 @@ discard block |
||
7 | 7 | * However, when inserting into the DB, it should be serialized. |
8 | 8 | * Upon retrieval from the DB, it should be unserialized back into an array. |
9 | 9 | */ |
10 | -require_once( EE_MODELS . 'fields/EE_Text_Field_Base.php' ); |
|
11 | -class EE_Serialized_Text_Field extends EE_Text_Field_Base{ |
|
10 | +require_once(EE_MODELS.'fields/EE_Text_Field_Base.php'); |
|
11 | +class EE_Serialized_Text_Field extends EE_Text_Field_Base { |
|
12 | 12 | /** |
13 | 13 | * Value SHOULD be an array, and we want to now convert it to a serialized string |
14 | 14 | * @param array $value_of_field_on_model_object |
@@ -18,13 +18,13 @@ discard block |
||
18 | 18 | return maybe_serialize($value_of_field_on_model_object); |
19 | 19 | } |
20 | 20 | function prepare_for_set($value_inputted_for_field_on_model_object) { |
21 | - EE_Registry::instance()->load_helper( 'Array' ); |
|
22 | - $value_inputted_for_field_on_model_object = EEH_Array::maybe_unserialize( $value_inputted_for_field_on_model_object ); |
|
23 | - if(is_string($value_inputted_for_field_on_model_object)){ |
|
21 | + EE_Registry::instance()->load_helper('Array'); |
|
22 | + $value_inputted_for_field_on_model_object = EEH_Array::maybe_unserialize($value_inputted_for_field_on_model_object); |
|
23 | + if (is_string($value_inputted_for_field_on_model_object)) { |
|
24 | 24 | return parent::prepare_for_set($value_inputted_for_field_on_model_object); |
25 | - }elseif(is_array($value_inputted_for_field_on_model_object)){ |
|
26 | - return array_map(array($this,'prepare_for_set'), $value_inputted_for_field_on_model_object); |
|
27 | - }else{//so they passed NULL or an INT or something wack |
|
25 | + }elseif (is_array($value_inputted_for_field_on_model_object)) { |
|
26 | + return array_map(array($this, 'prepare_for_set'), $value_inputted_for_field_on_model_object); |
|
27 | + } else {//so they passed NULL or an INT or something wack |
|
28 | 28 | return $value_inputted_for_field_on_model_object; |
29 | 29 | } |
30 | 30 | } |
@@ -34,8 +34,8 @@ discard block |
||
34 | 34 | * @return array |
35 | 35 | */ |
36 | 36 | function prepare_for_set_from_db($value_found_in_db_for_model_object) { |
37 | - EE_Registry::instance()->load_helper( 'Array' ); |
|
38 | - return EEH_Array::maybe_unserialize( $value_found_in_db_for_model_object ); |
|
37 | + EE_Registry::instance()->load_helper('Array'); |
|
38 | + return EEH_Array::maybe_unserialize($value_found_in_db_for_model_object); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | /** |
@@ -45,16 +45,16 @@ discard block |
||
45 | 45 | * @return string |
46 | 46 | */ |
47 | 47 | function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null) { |
48 | - switch($schema){ |
|
48 | + switch ($schema) { |
|
49 | 49 | case 'print_r': |
50 | - $pretty_value = print_r($value_on_field_to_be_outputted,true); |
|
50 | + $pretty_value = print_r($value_on_field_to_be_outputted, true); |
|
51 | 51 | break; |
52 | 52 | case 'as_table': |
53 | 53 | EE_Registry::instance()->load_helper('Template'); |
54 | 54 | $pretty_value = EEH_Template::layout_array_as_table($value_on_field_to_be_outputted); |
55 | 55 | break; |
56 | 56 | default: |
57 | - $pretty_value = implode(", ",$value_on_field_to_be_outputted); |
|
57 | + $pretty_value = implode(", ", $value_on_field_to_be_outputted); |
|
58 | 58 | } |
59 | 59 | return $pretty_value; |
60 | 60 | } |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | require_once( EE_MODELS . 'fields/EE_Text_Field_Base.php' ); |
3 | 3 | /** |
4 | - * Only allows a select, small number of html tags: a,abbr,acronym,b,blockquote,cite,code,del,em,i,q,strike,strong,ol,ul,li |
|
5 | - * If you want more use EE_Post_Content_Field, or if you want to allow ALL, use EE_Full_HTML_Field. |
|
6 | - * If you want NONE, use EE_Plain_Text_Field. |
|
7 | - */ |
|
4 | + * Only allows a select, small number of html tags: a,abbr,acronym,b,blockquote,cite,code,del,em,i,q,strike,strong,ol,ul,li |
|
5 | + * If you want more use EE_Post_Content_Field, or if you want to allow ALL, use EE_Full_HTML_Field. |
|
6 | + * If you want NONE, use EE_Plain_Text_Field. |
|
7 | + */ |
|
8 | 8 | class EE_Simple_HTML_Field extends EE_Text_Field_Base{ |
9 | 9 | /** |
10 | 10 | * removes all tags when setting |
@@ -1,11 +1,11 @@ discard block |
||
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 | * Only allows a select, small number of html tags: a,abbr,acronym,b,blockquote,cite,code,del,em,i,q,strike,strong,ol,ul,li |
5 | 5 | * If you want more use EE_Post_Content_Field, or if you want to allow ALL, use EE_Full_HTML_Field. |
6 | 6 | * If you want NONE, use EE_Plain_Text_Field. |
7 | 7 | */ |
8 | -class EE_Simple_HTML_Field extends EE_Text_Field_Base{ |
|
8 | +class EE_Simple_HTML_Field extends EE_Text_Field_Base { |
|
9 | 9 | /** |
10 | 10 | * removes all tags when setting |
11 | 11 | * @param string $value_inputted_for_field_on_model_object |
@@ -13,10 +13,10 @@ discard block |
||
13 | 13 | */ |
14 | 14 | function prepare_for_set($value_inputted_for_field_on_model_object) { |
15 | 15 | global $allowedtags; |
16 | - $allowedtags['ol']=array(); |
|
17 | - $allowedtags['ul']=array(); |
|
18 | - $allowedtags['li']=array(); |
|
19 | - $value_with_select_tags = wp_kses("$value_inputted_for_field_on_model_object",$allowedtags); |
|
16 | + $allowedtags['ol'] = array(); |
|
17 | + $allowedtags['ul'] = array(); |
|
18 | + $allowedtags['li'] = array(); |
|
19 | + $value_with_select_tags = wp_kses("$value_inputted_for_field_on_model_object", $allowedtags); |
|
20 | 20 | return parent::prepare_for_set($value_with_select_tags); |
21 | 21 | } |
22 | 22 |
@@ -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 |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
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 | - */ |
|
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 | + */ |
|
5 | 5 | abstract class EE_Text_Field_Base extends EE_Model_Field_Base{ |
6 | 6 | function get_wpdb_data_type(){ |
7 | 7 | return '%s'; |
@@ -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 |