@@ -6,14 +6,14 @@ |
||
6 | 6 | */ |
7 | 7 | class EE_All_Caps_Text_Field extends EE_Text_Field_Base |
8 | 8 | { |
9 | - /** |
|
10 | - * makes it all upper case, and key-like |
|
11 | - * |
|
12 | - * @param string $value_inputted_for_field_on_model_object |
|
13 | - * @return string |
|
14 | - */ |
|
15 | - function prepare_for_set($value_inputted_for_field_on_model_object) |
|
16 | - { |
|
17 | - return strtoupper(sanitize_key($value_inputted_for_field_on_model_object)); |
|
18 | - } |
|
9 | + /** |
|
10 | + * makes it all upper case, and key-like |
|
11 | + * |
|
12 | + * @param string $value_inputted_for_field_on_model_object |
|
13 | + * @return string |
|
14 | + */ |
|
15 | + function prepare_for_set($value_inputted_for_field_on_model_object) |
|
16 | + { |
|
17 | + return strtoupper(sanitize_key($value_inputted_for_field_on_model_object)); |
|
18 | + } |
|
19 | 19 | } |
20 | 20 | \ No newline at end of file |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | /** @var string $default_hidden_inputs */ |
5 | 5 | ?> |
6 | 6 | <p id="spco-attendee_information-pg" class="spco-steps-pg small-text drk-grey-text"> |
7 | - <?php echo apply_filters( 'FHEE__registration_page_attendee_information__attendee_information_pg', sprintf( __('In order to process your registration, we ask you to provide the following information.%1$sPlease note that all fields marked with an asterisk (%2$s) are required.', 'event_espresso'), '<br />', '<span class="asterisk">*</span>' )); ?> |
|
7 | + <?php echo apply_filters('FHEE__registration_page_attendee_information__attendee_information_pg', sprintf(__('In order to process your registration, we ask you to provide the following information.%1$sPlease note that all fields marked with an asterisk (%2$s) are required.', 'event_espresso'), '<br />', '<span class="asterisk">*</span>')); ?> |
|
8 | 8 | </p> |
9 | 9 | |
10 | 10 | <?php |
@@ -12,34 +12,34 @@ discard block |
||
12 | 12 | $prev_event = 0; |
13 | 13 | $prev_ticket = 0; |
14 | 14 | |
15 | -if ( count( $registrations ) > 0 ) { |
|
16 | - foreach ( $registrations as $registration ) { |
|
17 | - if ( $registration instanceof EE_Registration ) { |
|
15 | +if (count($registrations) > 0) { |
|
16 | + foreach ($registrations as $registration) { |
|
17 | + if ($registration instanceof EE_Registration) { |
|
18 | 18 | $att_nmbr++; |
19 | 19 | ?> |
20 | 20 | |
21 | - <div id="spco-attendee-panel-dv-<?php echo $registration->reg_url_link();?>" class="spco-attendee-panel-dv spco-attendee-ticket-<?php echo $registration->ticket()->ID();?>"> |
|
21 | + <div id="spco-attendee-panel-dv-<?php echo $registration->reg_url_link(); ?>" class="spco-attendee-panel-dv spco-attendee-ticket-<?php echo $registration->ticket()->ID(); ?>"> |
|
22 | 22 | |
23 | - <?php if ( $registration->event()->ID() !== $prev_event ) { ?> |
|
23 | + <?php if ($registration->event()->ID() !== $prev_event) { ?> |
|
24 | 24 | <h4 id="event_title-<?php echo $registration->event()->ID() ?>" class="big-event-title-hdr"> |
25 | 25 | <?php echo $registration->event()->name(); ?> |
26 | 26 | </h4> |
27 | 27 | <?php } ?> |
28 | - <?php if ( $registration->ticket()->ID() !== $prev_ticket ) { ?> |
|
29 | - <?php if ( ! $revisit ) { ?> |
|
28 | + <?php if ($registration->ticket()->ID() !== $prev_ticket) { ?> |
|
29 | + <?php if ( ! $revisit) { ?> |
|
30 | 30 | <div class="spco-ticket-info-dv small-text"> |
31 | - <h5><?php _e('Details', 'event_espresso');?></h5> |
|
31 | + <h5><?php _e('Details', 'event_espresso'); ?></h5> |
|
32 | 32 | <table> |
33 | 33 | <thead> |
34 | 34 | <tr> |
35 | - <th scope="col" width=""><?php _e('Name and Description', 'event_espresso');?></th> |
|
36 | - <th scope="col" width="7.5%" class="jst-rght"><?php _e('Qty', 'event_espresso');?></th> |
|
37 | - <th scope="col" width="17.5%" class="jst-rght"><?php _e('Price', 'event_espresso');?></th> |
|
38 | - <th scope="col" width="17.5%" class="jst-rght"><?php _e('Total', 'event_espresso');?></th> |
|
35 | + <th scope="col" width=""><?php _e('Name and Description', 'event_espresso'); ?></th> |
|
36 | + <th scope="col" width="7.5%" class="jst-rght"><?php _e('Qty', 'event_espresso'); ?></th> |
|
37 | + <th scope="col" width="17.5%" class="jst-rght"><?php _e('Price', 'event_espresso'); ?></th> |
|
38 | + <th scope="col" width="17.5%" class="jst-rght"><?php _e('Total', 'event_espresso'); ?></th> |
|
39 | 39 | </tr> |
40 | 40 | </thead> |
41 | 41 | <tbody> |
42 | - <?php echo $ticket_line_item[ $registration->ticket()->ID() ]; ?> |
|
42 | + <?php echo $ticket_line_item[$registration->ticket()->ID()]; ?> |
|
43 | 43 | </tbody> |
44 | 44 | </table> |
45 | 45 | </div> |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | |
49 | 49 | <?php |
50 | 50 | // ATTENDEE QUESTIONS |
51 | - $reg_form = EE_Template_Layout::get_subform_name( $registration->reg_url_link() ); |
|
51 | + $reg_form = EE_Template_Layout::get_subform_name($registration->reg_url_link()); |
|
52 | 52 | echo ${$reg_form}; |
53 | 53 | ?> |
54 | 54 |
@@ -3,15 +3,15 @@ |
||
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 |
@@ -7,26 +7,26 @@ |
||
7 | 7 | */ |
8 | 8 | class EE_Integer_Field extends EE_Model_Field_Base |
9 | 9 | { |
10 | - /** |
|
11 | - * @param string $table_column |
|
12 | - * @param string $nicename |
|
13 | - * @param bool $nullable |
|
14 | - * @param null $default_value |
|
15 | - */ |
|
16 | - public function __construct($table_column, $nicename, $nullable, $default_value = null) |
|
17 | - { |
|
18 | - parent::__construct($table_column, $nicename, $nullable, $default_value); |
|
19 | - $this->setSchemaType('integer'); |
|
20 | - } |
|
10 | + /** |
|
11 | + * @param string $table_column |
|
12 | + * @param string $nicename |
|
13 | + * @param bool $nullable |
|
14 | + * @param null $default_value |
|
15 | + */ |
|
16 | + public function __construct($table_column, $nicename, $nullable, $default_value = null) |
|
17 | + { |
|
18 | + parent::__construct($table_column, $nicename, $nullable, $default_value); |
|
19 | + $this->setSchemaType('integer'); |
|
20 | + } |
|
21 | 21 | |
22 | 22 | |
23 | - function prepare_for_set($value_inputted_for_field_on_model_object) |
|
24 | - { |
|
25 | - return intval($value_inputted_for_field_on_model_object); |
|
26 | - } |
|
23 | + function prepare_for_set($value_inputted_for_field_on_model_object) |
|
24 | + { |
|
25 | + return intval($value_inputted_for_field_on_model_object); |
|
26 | + } |
|
27 | 27 | |
28 | - function prepare_for_set_from_db($value_inputted_for_field_on_model_object) |
|
29 | - { |
|
30 | - return intval($value_inputted_for_field_on_model_object); |
|
31 | - } |
|
28 | + function prepare_for_set_from_db($value_inputted_for_field_on_model_object) |
|
29 | + { |
|
30 | + return intval($value_inputted_for_field_on_model_object); |
|
31 | + } |
|
32 | 32 | } |
@@ -11,77 +11,77 @@ |
||
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 "∞"; |
|
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 "∞"; |
|
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 | } |
@@ -10,72 +10,72 @@ |
||
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 | } |
@@ -19,7 +19,7 @@ |
||
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 |
@@ -8,64 +8,64 @@ |
||
8 | 8 | class EE_Float_Field extends EE_Model_Field_Base |
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('number'); |
|
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('number'); |
|
21 | + } |
|
22 | 22 | |
23 | 23 | |
24 | - /** |
|
25 | - * If provided a string, strips out number-related formatting, like commas, periods, spaces, other junk, etc. |
|
26 | - * However, treats commas and periods as thousand-separators ro decimal marks, as indicate by the config's currency. |
|
27 | - * So if you want to pass in a string that NEEDS to interpret periods as decimal marks, call floatval() on it first. |
|
28 | - * Returns a float |
|
29 | - * |
|
30 | - * @param type $value_inputted_for_field_on_model_object |
|
31 | - * @return float |
|
32 | - */ |
|
33 | - function prepare_for_set($value_inputted_for_field_on_model_object) |
|
34 | - { |
|
24 | + /** |
|
25 | + * If provided a string, strips out number-related formatting, like commas, periods, spaces, other junk, etc. |
|
26 | + * However, treats commas and periods as thousand-separators ro decimal marks, as indicate by the config's currency. |
|
27 | + * So if you want to pass in a string that NEEDS to interpret periods as decimal marks, call floatval() on it first. |
|
28 | + * Returns a float |
|
29 | + * |
|
30 | + * @param type $value_inputted_for_field_on_model_object |
|
31 | + * @return float |
|
32 | + */ |
|
33 | + function prepare_for_set($value_inputted_for_field_on_model_object) |
|
34 | + { |
|
35 | 35 | // echo __LINE__."$value_inputted_for_field_on_model_object<br>"; |
36 | - //remove whitespaces and thousands separators |
|
37 | - if (is_string($value_inputted_for_field_on_model_object)) { |
|
38 | - $value_inputted_for_field_on_model_object = str_replace(array(" ", EE_Config::instance()->currency->thsnds), |
|
39 | - "", $value_inputted_for_field_on_model_object); |
|
36 | + //remove whitespaces and thousands separators |
|
37 | + if (is_string($value_inputted_for_field_on_model_object)) { |
|
38 | + $value_inputted_for_field_on_model_object = str_replace(array(" ", EE_Config::instance()->currency->thsnds), |
|
39 | + "", $value_inputted_for_field_on_model_object); |
|
40 | 40 | //echo __LINE__."$value_inputted_for_field_on_model_object<br>"; |
41 | 41 | //normalize it so periods are decimal marks (we don't care where you're from: we're talking PHP now) |
42 | - $value_inputted_for_field_on_model_object = str_replace(EE_Config::instance()->currency->dec_mrk, ".", |
|
43 | - $value_inputted_for_field_on_model_object); |
|
42 | + $value_inputted_for_field_on_model_object = str_replace(EE_Config::instance()->currency->dec_mrk, ".", |
|
43 | + $value_inputted_for_field_on_model_object); |
|
44 | 44 | //echo __LINE__."$value_inputted_for_field_on_model_object<br>"; |
45 | 45 | //double-check there's absolutely nothing left on this string besides numbers |
46 | - $value_inputted_for_field_on_model_object = preg_replace("/[^0-9,.]/", "", |
|
47 | - $value_inputted_for_field_on_model_object); |
|
48 | - } |
|
46 | + $value_inputted_for_field_on_model_object = preg_replace("/[^0-9,.]/", "", |
|
47 | + $value_inputted_for_field_on_model_object); |
|
48 | + } |
|
49 | 49 | // echo __LINE__."$value_inputted_for_field_on_model_object<br>"; |
50 | - return floatval($value_inputted_for_field_on_model_object); |
|
51 | - } |
|
50 | + return floatval($value_inputted_for_field_on_model_object); |
|
51 | + } |
|
52 | 52 | |
53 | - /** |
|
54 | - * Returns the number formatted according to local custom (set by the country of the blog). |
|
55 | - * |
|
56 | - * @param float $value_on_field_to_be_outputted |
|
57 | - * @return string |
|
58 | - */ |
|
59 | - function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null) |
|
60 | - { |
|
61 | - $EE = EE_Registry::instance(); |
|
62 | - return number_format($value_on_field_to_be_outputted, $EE->CFG->currency->dec_plc, $EE->CFG->currency->dec_mrk, |
|
63 | - $EE->CFG->currency->thsnds); |
|
64 | - } |
|
53 | + /** |
|
54 | + * Returns the number formatted according to local custom (set by the country of the blog). |
|
55 | + * |
|
56 | + * @param float $value_on_field_to_be_outputted |
|
57 | + * @return string |
|
58 | + */ |
|
59 | + function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null) |
|
60 | + { |
|
61 | + $EE = EE_Registry::instance(); |
|
62 | + return number_format($value_on_field_to_be_outputted, $EE->CFG->currency->dec_plc, $EE->CFG->currency->dec_mrk, |
|
63 | + $EE->CFG->currency->thsnds); |
|
64 | + } |
|
65 | 65 | |
66 | - function prepare_for_set_from_db($value_found_in_db_for_model_object) |
|
67 | - { |
|
66 | + function prepare_for_set_from_db($value_found_in_db_for_model_object) |
|
67 | + { |
|
68 | 68 | // echo "prepare for set from db of ";d($value_found_in_db_for_model_object); |
69 | - return floatval($value_found_in_db_for_model_object); |
|
70 | - } |
|
69 | + return floatval($value_found_in_db_for_model_object); |
|
70 | + } |
|
71 | 71 | } |
72 | 72 | \ No newline at end of file |
@@ -10,115 +10,115 @@ |
||
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 | } |
@@ -38,7 +38,7 @@ discard block |
||
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 |
||
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 |
@@ -11,28 +11,28 @@ |
||
11 | 11 | abstract class EE_DB_Only_Field_Base 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->setSchemaReadOnly(true); |
|
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->setSchemaReadOnly(true); |
|
24 | + } |
|
25 | 25 | |
26 | 26 | |
27 | - /** |
|
28 | - * All these children classes are for the db-only (meaning, we should select them |
|
29 | - * on get_all queries, update, delete, and will still want to set their default value |
|
30 | - * on inserts, but the model object won't have reference to these fields) |
|
31 | - * |
|
32 | - * @return boolean |
|
33 | - */ |
|
34 | - function is_db_only_field() |
|
35 | - { |
|
36 | - return true; |
|
37 | - } |
|
27 | + /** |
|
28 | + * All these children classes are for the db-only (meaning, we should select them |
|
29 | + * on get_all queries, update, delete, and will still want to set their default value |
|
30 | + * on inserts, but the model object won't have reference to these fields) |
|
31 | + * |
|
32 | + * @return boolean |
|
33 | + */ |
|
34 | + function is_db_only_field() |
|
35 | + { |
|
36 | + return true; |
|
37 | + } |
|
38 | 38 | } |
39 | 39 | \ No newline at end of file |