@@ -21,8 +21,8 @@ discard block |
||
21 | 21 | * |
22 | 22 | * ------------------------------------------------------------------------ |
23 | 23 | */ |
24 | -require_once ( EE_MODELS . 'EEM_Base.model.php' ); |
|
25 | -require_once ( EE_CLASSES . 'EE_Ticket_Template.class.php' ); |
|
24 | +require_once (EE_MODELS.'EEM_Base.model.php'); |
|
25 | +require_once (EE_CLASSES.'EE_Ticket_Template.class.php'); |
|
26 | 26 | |
27 | 27 | class EEM_Ticket_Template extends EEM_Base { |
28 | 28 | |
@@ -38,29 +38,29 @@ discard block |
||
38 | 38 | * @param string $timezone string representing the timezone we want to set for returned Date Time Strings (and any incoming timezone data that gets saved). Note this just sends the timezone info to the date time model field objects. Default is NULL (and will be assumed using the set timezone in the 'timezone_string' wp option) |
39 | 39 | * @return void |
40 | 40 | */ |
41 | - protected function __construct( $timezone ) { |
|
42 | - $this->singular_item = __('Ticket Template','event_espresso'); |
|
43 | - $this->plural_item = __('Ticket Templates','event_espresso'); |
|
41 | + protected function __construct($timezone) { |
|
42 | + $this->singular_item = __('Ticket Template', 'event_espresso'); |
|
43 | + $this->plural_item = __('Ticket Templates', 'event_espresso'); |
|
44 | 44 | |
45 | 45 | $this->_tables = array( |
46 | 46 | 'Ticket_Template'=> new EE_Primary_Table('esp_ticket_template', 'TTM_ID') |
47 | 47 | ); |
48 | 48 | $this->_fields = array( |
49 | 49 | 'Ticket_Template'=>array( |
50 | - 'TTM_ID'=>new EE_Primary_Key_Int_Field('TTM_ID', __('Ticket Template ID','event_espresso')), |
|
51 | - 'TTM_name'=>new EE_Plain_Text_Field('TTM_name', __('The name of the ticket template','event_espresso'), false, '' ), |
|
52 | - 'TTM_description'=>new EE_Plain_Text_Field('TTM_description', __('The description for the ticket template','event_espresso'), true, '' ), |
|
53 | - 'TTM_file'=>new EE_Plain_Text_Field('TTM_file', __('The file name for the actual template file saved on disk','event_espresso'), true, '' ), |
|
50 | + 'TTM_ID'=>new EE_Primary_Key_Int_Field('TTM_ID', __('Ticket Template ID', 'event_espresso')), |
|
51 | + 'TTM_name'=>new EE_Plain_Text_Field('TTM_name', __('The name of the ticket template', 'event_espresso'), false, ''), |
|
52 | + 'TTM_description'=>new EE_Plain_Text_Field('TTM_description', __('The description for the ticket template', 'event_espresso'), true, ''), |
|
53 | + 'TTM_file'=>new EE_Plain_Text_Field('TTM_file', __('The file name for the actual template file saved on disk', 'event_espresso'), true, ''), |
|
54 | 54 | )); |
55 | 55 | $this->_model_relations = array( |
56 | 56 | 'Ticket'=>new EE_Has_Many_Relation() |
57 | 57 | ); |
58 | 58 | $this->_model_chain_to_wp_user = 'Ticket'; |
59 | - $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Default_Public('Ticket.TKT_is_default', 'Ticket.Datetime.Event' ); |
|
59 | + $this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Default_Public('Ticket.TKT_is_default', 'Ticket.Datetime.Event'); |
|
60 | 60 | //account for default tickets in the caps |
61 | - $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Default_Protected( 'Ticket.TKT_is_default', 'Ticket.Datetime.Event'); |
|
62 | - $this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Default_Protected( 'Ticket.TKT_is_default', 'Ticket.Datetime.Event'); |
|
63 | - $this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Default_Protected( 'Ticket.TKT_is_default', 'Ticket.Datetime.Event'); |
|
64 | - parent::__construct( $timezone ); |
|
61 | + $this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Default_Protected('Ticket.TKT_is_default', 'Ticket.Datetime.Event'); |
|
62 | + $this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Default_Protected('Ticket.TKT_is_default', 'Ticket.Datetime.Event'); |
|
63 | + $this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Default_Protected('Ticket.TKT_is_default', 'Ticket.Datetime.Event'); |
|
64 | + parent::__construct($timezone); |
|
65 | 65 | } |
66 | 66 | } //end EEM_Ticket_Template class |
67 | 67 | \ No newline at end of file |
@@ -1,4 +1,6 @@ |
||
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 | * |
@@ -2,8 +2,8 @@ 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 | -class EE_All_Caps_Text_Field extends EE_Text_Field_Base{ |
|
6 | - function get_wpdb_data_type(){ |
|
5 | +class EE_All_Caps_Text_Field extends EE_Text_Field_Base { |
|
6 | + function get_wpdb_data_type() { |
|
7 | 7 | return '%s'; |
8 | 8 | } |
9 | 9 | |
@@ -13,6 +13,6 @@ discard block |
||
13 | 13 | * @return string |
14 | 14 | */ |
15 | 15 | function prepare_for_set($value_inputted_for_field_on_model_object) { |
16 | - return strtoupper( sanitize_key($value_inputted_for_field_on_model_object)); |
|
16 | + return strtoupper(sanitize_key($value_inputted_for_field_on_model_object)); |
|
17 | 17 | } |
18 | 18 | } |
19 | 19 | \ No newline at end of file |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -require_once( EE_MODELS . 'fields/EE_DB_Only_Field_Base.php'); |
|
2 | +require_once(EE_MODELS.'fields/EE_DB_Only_Field_Base.php'); |
|
3 | 3 | /** |
4 | 4 | * Used by EE_Belongs_To_Any_Relations and EE_Has_Many_Any_Relations to identify the model the foreign key points to. |
5 | 5 | * Note: the array of model names on this field should match the array of model names on the |
@@ -8,8 +8,8 @@ discard block |
||
8 | 8 | * 'obj_id'=>new EE_Foreign_Key_Int_Field('obj_id_column',__('Related Object ID'),false,0,array('Registration','Transaction')), |
9 | 9 | * 'obj_type'=>new EE_Any_Foreign_Model_Name_Field('obj_type_column',__('Related Object type'),false,null,array('Registration','Transaction'))); |
10 | 10 | */ |
11 | -class EE_Any_Foreign_Model_Name_Field extends EE_Field_With_Model_Name{ |
|
12 | - function get_wpdb_data_type(){ |
|
11 | +class EE_Any_Foreign_Model_Name_Field extends EE_Field_With_Model_Name { |
|
12 | + function get_wpdb_data_type() { |
|
13 | 13 | return '%s'; |
14 | 14 | } |
15 | 15 | } |
16 | 16 | \ No newline at end of file |
@@ -7,7 +7,7 @@ |
||
7 | 7 | * special default values for them, or some other column-specific functionality. So we can add them as fields, |
8 | 8 | * but db-only ones |
9 | 9 | */ |
10 | -abstract class EE_DB_Only_Field_Base extends EE_Model_Field_Base{ |
|
10 | +abstract class EE_DB_Only_Field_Base extends EE_Model_Field_Base { |
|
11 | 11 | /** |
12 | 12 | * All these children classes are for the db-only (meaning, we should select them |
13 | 13 | * on get_all queries, update, delete, and will still want to set their default value |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php |
2 | -require_once( EE_MODELS . 'fields/EE_DB_Only_Field_Base.php'); |
|
3 | -class EE_DB_Only_Float_Field extends EE_DB_Only_Field_Base{ |
|
4 | - function get_wpdb_data_type(){ |
|
2 | +require_once(EE_MODELS.'fields/EE_DB_Only_Field_Base.php'); |
|
3 | +class EE_DB_Only_Float_Field extends EE_DB_Only_Field_Base { |
|
4 | + function get_wpdb_data_type() { |
|
5 | 5 | return '%f'; |
6 | 6 | } |
7 | 7 | } |
@@ -1,8 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -require_once( EE_MODELS . 'fields/EE_DB_Only_Field_Base.php'); |
|
4 | -class EE_DB_Only_Int_Field extends EE_DB_Only_Field_Base{ |
|
5 | - function get_wpdb_data_type(){ |
|
3 | +require_once(EE_MODELS.'fields/EE_DB_Only_Field_Base.php'); |
|
4 | +class EE_DB_Only_Int_Field extends EE_DB_Only_Field_Base { |
|
5 | + function get_wpdb_data_type() { |
|
6 | 6 | return '%d'; |
7 | 7 | } |
8 | 8 | } |
9 | 9 | \ No newline at end of file |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php |
2 | -require_once( EE_MODELS . 'fields/EE_DB_Only_Field_Base.php'); |
|
3 | -class EE_DB_Only_Text_Field extends EE_DB_Only_Field_Base{ |
|
4 | - function get_wpdb_data_type(){ |
|
2 | +require_once(EE_MODELS.'fields/EE_DB_Only_Field_Base.php'); |
|
3 | +class EE_DB_Only_Text_Field extends EE_DB_Only_Field_Base { |
|
4 | + function get_wpdb_data_type() { |
|
5 | 5 | return '%s'; |
6 | 6 | } |
7 | 7 | } |
8 | 8 | \ No newline at end of file |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
2 | -require_once( EE_MODELS . 'fields/EE_Integer_Field.php' ); |
|
2 | +require_once(EE_MODELS.'fields/EE_Integer_Field.php'); |
|
3 | 3 | /** |
4 | 4 | * Class EE_Enum_Integer_Field |
5 | 5 | * |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * @author Mike Nelson |
9 | 9 | * |
10 | 10 | */ |
11 | -class EE_Enum_Integer_Field extends EE_Integer_Field{ |
|
11 | +class EE_Enum_Integer_Field extends EE_Integer_Field { |
|
12 | 12 | |
13 | 13 | var $_allowed_enum_values; |
14 | 14 | |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | * @param int $default_value |
21 | 21 | * @param array $allowed_enum_values keys are values to be used in the DB, values are how they should be displayed |
22 | 22 | */ |
23 | - function __construct($table_column, $nicename, $nullable, $default_value, $allowed_enum_values){ |
|
23 | + function __construct($table_column, $nicename, $nullable, $default_value, $allowed_enum_values) { |
|
24 | 24 | $this->_allowed_enum_values = $allowed_enum_values; |
25 | 25 | parent::__construct($table_column, $nicename, $nullable, $default_value); |
26 | 26 | } |
@@ -32,20 +32,20 @@ discard block |
||
32 | 32 | * @throws EE_Error |
33 | 33 | */ |
34 | 34 | function prepare_for_set($value_inputted_for_field_on_model_object) { |
35 | - if( $value_inputted_for_field_on_model_object !== NULL && ! array_key_exists( $value_inputted_for_field_on_model_object, $this->_allowed_enum_values )){ |
|
36 | - if( defined( 'WP_DEBUG' ) && WP_DEBUG ){ |
|
35 | + if ($value_inputted_for_field_on_model_object !== NULL && ! array_key_exists($value_inputted_for_field_on_model_object, $this->_allowed_enum_values)) { |
|
36 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
37 | 37 | $msg = sprintf( |
38 | - __('System is assigning incompatible value "%1$s" to field "%2$s"','event_espresso'), |
|
38 | + __('System is assigning incompatible value "%1$s" to field "%2$s"', 'event_espresso'), |
|
39 | 39 | $value_inputted_for_field_on_model_object, |
40 | 40 | $this->_name |
41 | 41 | ); |
42 | 42 | $msg2 = sprintf( |
43 | - __('Allowed values for "%1$s" are "%2$s". You provided "%3$s"','event_espresso'), |
|
43 | + __('Allowed values for "%1$s" are "%2$s". You provided "%3$s"', 'event_espresso'), |
|
44 | 44 | $this->_name, |
45 | - implode( ', ', array_keys( $this->_allowed_enum_values )), |
|
45 | + implode(', ', array_keys($this->_allowed_enum_values)), |
|
46 | 46 | $value_inputted_for_field_on_model_object |
47 | 47 | ); |
48 | - EE_Error::add_error("$msg||$msg2", __FILE__, __FUNCTION__, __LINE__ ); |
|
48 | + EE_Error::add_error("$msg||$msg2", __FILE__, __FUNCTION__, __LINE__); |
|
49 | 49 | } |
50 | 50 | return $this->get_default_value(); |
51 | 51 | |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | * @param null $schema |
63 | 63 | * @return string |
64 | 64 | */ |
65 | - function prepare_for_pretty_echoing( $value_on_field_to_be_outputted, $schema = NULL ) { |
|
65 | + function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = NULL) { |
|
66 | 66 | return $this->_allowed_enum_values[$value_on_field_to_be_outputted]; |
67 | 67 | } |
68 | 68 | } |
@@ -1,4 +1,6 @@ |
||
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 | * |
@@ -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_Float_Field extends EE_Model_Field_Base{ |
|
6 | - function get_wpdb_data_type(){ |
|
5 | +class EE_Float_Field extends EE_Model_Field_Base { |
|
6 | + function get_wpdb_data_type() { |
|
7 | 7 | return '%f'; |
8 | 8 | } |
9 | 9 | /** |
@@ -17,26 +17,26 @@ discard block |
||
17 | 17 | function prepare_for_set($value_inputted_for_field_on_model_object) { |
18 | 18 | // echo __LINE__."$value_inputted_for_field_on_model_object<br>"; |
19 | 19 | //remove whitespaces and thousands separators |
20 | - if(is_string($value_inputted_for_field_on_model_object)){ |
|
21 | - $value_inputted_for_field_on_model_object = str_replace(array(" ",EE_Config::instance()->currency->thsnds),"",$value_inputted_for_field_on_model_object); |
|
20 | + if (is_string($value_inputted_for_field_on_model_object)) { |
|
21 | + $value_inputted_for_field_on_model_object = str_replace(array(" ", EE_Config::instance()->currency->thsnds), "", $value_inputted_for_field_on_model_object); |
|
22 | 22 | //echo __LINE__."$value_inputted_for_field_on_model_object<br>"; |
23 | 23 | //normalize it so periods are decimal marks (we don't care where you're from: we're talking PHP now) |
24 | - $value_inputted_for_field_on_model_object = str_replace( EE_Config::instance()->currency->dec_mrk, ".", $value_inputted_for_field_on_model_object) ; |
|
24 | + $value_inputted_for_field_on_model_object = str_replace(EE_Config::instance()->currency->dec_mrk, ".", $value_inputted_for_field_on_model_object); |
|
25 | 25 | //echo __LINE__."$value_inputted_for_field_on_model_object<br>"; |
26 | 26 | //double-check there's absolutely nothing left on this string besides numbers |
27 | - $value_inputted_for_field_on_model_object = preg_replace( "/[^0-9,.]/", "", $value_inputted_for_field_on_model_object); |
|
27 | + $value_inputted_for_field_on_model_object = preg_replace("/[^0-9,.]/", "", $value_inputted_for_field_on_model_object); |
|
28 | 28 | } |
29 | 29 | // echo __LINE__."$value_inputted_for_field_on_model_object<br>"; |
30 | - return floatval( $value_inputted_for_field_on_model_object ); |
|
30 | + return floatval($value_inputted_for_field_on_model_object); |
|
31 | 31 | } |
32 | 32 | /** |
33 | 33 | * Returns the number formatted according to local custom (set by the country of the blog). |
34 | 34 | * @param float $value_on_field_to_be_outputted |
35 | 35 | * @return string |
36 | 36 | */ |
37 | - function prepare_for_pretty_echoing($value_on_field_to_be_outputted,$schema = null){ |
|
37 | + function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null) { |
|
38 | 38 | $EE = EE_Registry::instance(); |
39 | - return number_format( $value_on_field_to_be_outputted, $EE->CFG->currency->dec_plc, $EE->CFG->currency->dec_mrk, $EE->CFG->currency->thsnds) ; |
|
39 | + return number_format($value_on_field_to_be_outputted, $EE->CFG->currency->dec_plc, $EE->CFG->currency->dec_mrk, $EE->CFG->currency->thsnds); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | function prepare_for_set_from_db($value_found_in_db_for_model_object) { |