@@ -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 |
@@ -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 |
@@ -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 |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * |
26 | 26 | * ------------------------------------------------------------------------ |
27 | 27 | */ |
28 | -class EE_WP_User_Field extends EE_Foreign_Key_Int_Field{ |
|
28 | +class EE_WP_User_Field extends EE_Foreign_Key_Int_Field { |
|
29 | 29 | /** |
30 | 30 | * No need to provide a default or the model pointed to- the default is |
31 | 31 | * always get_current_user_id() and the model pointed to is always WP_User |
@@ -33,8 +33,8 @@ discard block |
||
33 | 33 | * @param string $nicename should eb internationalized with __('blah','event_espresso') |
34 | 34 | * @param boolean $nullable |
35 | 35 | */ |
36 | - function __construct($table_column, $nicename, $nullable){ |
|
37 | - parent::__construct($table_column, $nicename, $nullable, null, 'WP_User' ); |
|
36 | + function __construct($table_column, $nicename, $nullable) { |
|
37 | + parent::__construct($table_column, $nicename, $nullable, null, 'WP_User'); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | /** |
@@ -42,11 +42,11 @@ discard block |
||
42 | 42 | * constructing the model field because that's done before $current_user is set |
43 | 43 | * @return mixed |
44 | 44 | */ |
45 | - function get_default_value(){ |
|
46 | - if( did_action( 'init' ) ) { |
|
45 | + function get_default_value() { |
|
46 | + if (did_action('init')) { |
|
47 | 47 | return get_current_user_id(); |
48 | - }else{ |
|
49 | - EE_Error::doing_it_wrong('EE_WP_User_Field::get_default_value', __( 'You cant get a default value for a wp_User_Field because the "init" action is called, because current_user global hasnt yet been setup. Consider doing your business logic on the "init" hook or later.', 'event_espresso' ), '4.6.20' ); |
|
48 | + } else { |
|
49 | + EE_Error::doing_it_wrong('EE_WP_User_Field::get_default_value', __('You cant get a default value for a wp_User_Field because the "init" action is called, because current_user global hasnt yet been setup. Consider doing your business logic on the "init" hook or later.', 'event_espresso'), '4.6.20'); |
|
50 | 50 | return 1; |
51 | 51 | } |
52 | 52 | } |
@@ -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 | * |
@@ -45,7 +47,7 @@ discard block |
||
45 | 47 | function get_default_value(){ |
46 | 48 | if( did_action( 'init' ) ) { |
47 | 49 | return get_current_user_id(); |
48 | - }else{ |
|
50 | + } else{ |
|
49 | 51 | EE_Error::doing_it_wrong('EE_WP_User_Field::get_default_value', __( 'You cant get a default value for a wp_User_Field because the "init" action is called, because current_user global hasnt yet been setup. Consider doing your business logic on the "init" hook or later.', 'event_espresso' ), '4.6.20' ); |
50 | 52 | return 1; |
51 | 53 | } |
@@ -4,18 +4,18 @@ discard block |
||
4 | 4 | * Parent class for indicating indexes on models. As of writing this, it is only used |
5 | 5 | * when deleting model objects that have no primary key, but clearly this can be expanded |
6 | 6 | */ |
7 | -class EE_Index{ |
|
7 | +class EE_Index { |
|
8 | 8 | protected $_name; |
9 | 9 | protected $_field_names; |
10 | 10 | protected $_model_name; |
11 | - public function __construct($fields){ |
|
11 | + public function __construct($fields) { |
|
12 | 12 | $this->_field_names = $fields; |
13 | 13 | } |
14 | - public function _construct_finalize($name,$model_name){ |
|
14 | + public function _construct_finalize($name, $model_name) { |
|
15 | 15 | $this->_name = $name; |
16 | 16 | $this->_model_name = $model_name; |
17 | 17 | } |
18 | - public function field_names(){ |
|
18 | + public function field_names() { |
|
19 | 19 | return $this->_field_names; |
20 | 20 | } |
21 | 21 | /** |
@@ -23,19 +23,19 @@ discard block |
||
23 | 23 | * @param string $model_name like Event, Question_Group, etc. omit the EEM_ |
24 | 24 | * @return EEM_Base |
25 | 25 | */ |
26 | - protected function _get_model($model_name){ |
|
27 | - $modelInstance=call_user_func("EEM_".$model_name."::instance"); |
|
26 | + protected function _get_model($model_name) { |
|
27 | + $modelInstance = call_user_func("EEM_".$model_name."::instance"); |
|
28 | 28 | return $modelInstance; |
29 | 29 | } |
30 | 30 | /** |
31 | 31 | * Gets all the fields for this index |
32 | 32 | * @return EE_Model_Field_Base[] |
33 | 33 | */ |
34 | - public function fields(){ |
|
34 | + public function fields() { |
|
35 | 35 | $fields = array(); |
36 | 36 | $model = $this->_get_model($this->_model_name); |
37 | - foreach($model->field_settings() as $field_name => $field_obj){ |
|
38 | - if(in_array($field_name,$this->field_names())){ |
|
37 | + foreach ($model->field_settings() as $field_name => $field_obj) { |
|
38 | + if (in_array($field_name, $this->field_names())) { |
|
39 | 39 | $fields[$field_name] = $field_obj; |
40 | 40 | } |
41 | 41 | } |