@@ -18,27 +18,27 @@ |
||
18 | 18 | */ |
19 | 19 | class ModelConfigurationException extends DomainException |
20 | 20 | { |
21 | - /** |
|
22 | - * ModelConfigurationException constructor. |
|
23 | - * |
|
24 | - * @param EEM_Base $model |
|
25 | - * @param string $message Describe what's misconfigured about this model (don't bother mentioning which model, |
|
26 | - * that will be automatically added to the message based on the $model provided in the previous parameter). |
|
27 | - * @param int $code |
|
28 | - * @param Exception $previous |
|
29 | - */ |
|
30 | - public function __construct(EEM_Base $model, $message, $code = 0, Exception $previous = null) |
|
31 | - { |
|
32 | - $message_part_1 = sprintf( |
|
33 | - /* |
|
21 | + /** |
|
22 | + * ModelConfigurationException constructor. |
|
23 | + * |
|
24 | + * @param EEM_Base $model |
|
25 | + * @param string $message Describe what's misconfigured about this model (don't bother mentioning which model, |
|
26 | + * that will be automatically added to the message based on the $model provided in the previous parameter). |
|
27 | + * @param int $code |
|
28 | + * @param Exception $previous |
|
29 | + */ |
|
30 | + public function __construct(EEM_Base $model, $message, $code = 0, Exception $previous = null) |
|
31 | + { |
|
32 | + $message_part_1 = sprintf( |
|
33 | + /* |
|
34 | 34 | * translators: 1: the model name |
35 | 35 | */ |
36 | - esc_html__('The model "%1$s" appears to be misconfigured.', 'event_espresso'), |
|
37 | - $model->get_this_model_name() |
|
38 | - ); |
|
39 | - $message = $message_part_1 . ' ' . $message; |
|
40 | - parent::__construct($message, $code, $previous); |
|
41 | - } |
|
36 | + esc_html__('The model "%1$s" appears to be misconfigured.', 'event_espresso'), |
|
37 | + $model->get_this_model_name() |
|
38 | + ); |
|
39 | + $message = $message_part_1 . ' ' . $message; |
|
40 | + parent::__construct($message, $code, $previous); |
|
41 | + } |
|
42 | 42 | } |
43 | 43 | // End of file ModelConfigurationException.php |
44 | 44 | // Location: EventEspresso\core\exceptions/ModelConfigurationException.php |
@@ -36,7 +36,7 @@ |
||
36 | 36 | esc_html__('The model "%1$s" appears to be misconfigured.', 'event_espresso'), |
37 | 37 | $model->get_this_model_name() |
38 | 38 | ); |
39 | - $message = $message_part_1 . ' ' . $message; |
|
39 | + $message = $message_part_1.' '.$message; |
|
40 | 40 | parent::__construct($message, $code, $previous); |
41 | 41 | } |
42 | 42 | } |
@@ -16,17 +16,17 @@ |
||
16 | 16 | */ |
17 | 17 | class RestPasswordIncorrectException extends RestException |
18 | 18 | { |
19 | - public function __construct($previous = null) |
|
20 | - { |
|
21 | - parent::__construct( |
|
22 | - 'rest_post_incorrect_password', |
|
23 | - esc_html__('Incorrect password.', 'event_espresso'), |
|
24 | - array( |
|
25 | - 'status' => 403, |
|
26 | - ), |
|
27 | - $previous |
|
28 | - ); |
|
29 | - } |
|
19 | + public function __construct($previous = null) |
|
20 | + { |
|
21 | + parent::__construct( |
|
22 | + 'rest_post_incorrect_password', |
|
23 | + esc_html__('Incorrect password.', 'event_espresso'), |
|
24 | + array( |
|
25 | + 'status' => 403, |
|
26 | + ), |
|
27 | + $previous |
|
28 | + ); |
|
29 | + } |
|
30 | 30 | } |
31 | 31 | // End of file RestPasswordIncorrectException.php |
32 | 32 | // Location: EventEspresso\core\exceptions/RestPasswordIncorrectException.php |
@@ -42,10 +42,10 @@ |
||
42 | 42 | ); |
43 | 43 | // this model is generally available for reading |
44 | 44 | $path_to_event = 'Datetime.Event'; |
45 | - $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Event_Related_Public($path_to_event); |
|
46 | - $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Event_Related_Protected($path_to_event); |
|
47 | - $this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Event_Related_Protected($path_to_event); |
|
48 | - $this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Event_Related_Protected($path_to_event, EEM_Base::caps_edit); |
|
45 | + $this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Event_Related_Public($path_to_event); |
|
46 | + $this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Event_Related_Protected($path_to_event); |
|
47 | + $this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Event_Related_Protected($path_to_event); |
|
48 | + $this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Event_Related_Protected($path_to_event, EEM_Base::caps_edit); |
|
49 | 49 | $this->model_chain_to_password = $path_to_event; |
50 | 50 | parent::__construct($timezone); |
51 | 51 | } |
@@ -13,41 +13,41 @@ |
||
13 | 13 | { |
14 | 14 | |
15 | 15 | |
16 | - // private instance of the EEM_Datetime_Ticket object |
|
17 | - protected static $_instance = null; |
|
16 | + // private instance of the EEM_Datetime_Ticket object |
|
17 | + protected static $_instance = null; |
|
18 | 18 | |
19 | - /** |
|
20 | - * private constructor to prevent direct creation |
|
21 | - * @Constructor |
|
22 | - * @access private |
|
23 | - * @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) |
|
24 | - * @return void |
|
25 | - */ |
|
26 | - protected function __construct($timezone) |
|
27 | - { |
|
28 | - $this->singular_item = esc_html__('Datetime Ticket', 'event_espresso'); |
|
29 | - $this->plural_item = esc_html__('Datetime Tickets', 'event_espresso'); |
|
19 | + /** |
|
20 | + * private constructor to prevent direct creation |
|
21 | + * @Constructor |
|
22 | + * @access private |
|
23 | + * @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) |
|
24 | + * @return void |
|
25 | + */ |
|
26 | + protected function __construct($timezone) |
|
27 | + { |
|
28 | + $this->singular_item = esc_html__('Datetime Ticket', 'event_espresso'); |
|
29 | + $this->plural_item = esc_html__('Datetime Tickets', 'event_espresso'); |
|
30 | 30 | |
31 | - $this->_tables = array( |
|
32 | - 'Datetime_Ticket' => new EE_Primary_Table('esp_datetime_ticket', 'DTK_ID') |
|
33 | - ); |
|
34 | - $this->_fields = array( |
|
35 | - 'Datetime_Ticket' => array( |
|
36 | - 'DTK_ID' => new EE_Primary_Key_Int_Field('DTK_ID', esc_html__('Datetime Ticket ID', 'event_espresso')), |
|
37 | - 'DTT_ID' => new EE_Foreign_Key_Int_Field('DTT_ID', esc_html__('The ID to the Datetime', 'event_espresso'), false, 0, 'Datetime'), |
|
38 | - 'TKT_ID' => new EE_Foreign_Key_Int_Field('TKT_ID', esc_html__('The ID to the Ticket', 'event_espresso'), false, 0, 'Ticket') |
|
39 | - )); |
|
40 | - $this->_model_relations = array( |
|
41 | - 'Ticket' => new EE_Belongs_To_Relation(), |
|
42 | - 'Datetime' => new EE_Belongs_To_Relation() |
|
43 | - ); |
|
44 | - // this model is generally available for reading |
|
45 | - $path_to_event = 'Datetime.Event'; |
|
46 | - $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Event_Related_Public($path_to_event); |
|
47 | - $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Event_Related_Protected($path_to_event); |
|
48 | - $this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Event_Related_Protected($path_to_event); |
|
49 | - $this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Event_Related_Protected($path_to_event, EEM_Base::caps_edit); |
|
50 | - $this->model_chain_to_password = $path_to_event; |
|
51 | - parent::__construct($timezone); |
|
52 | - } |
|
31 | + $this->_tables = array( |
|
32 | + 'Datetime_Ticket' => new EE_Primary_Table('esp_datetime_ticket', 'DTK_ID') |
|
33 | + ); |
|
34 | + $this->_fields = array( |
|
35 | + 'Datetime_Ticket' => array( |
|
36 | + 'DTK_ID' => new EE_Primary_Key_Int_Field('DTK_ID', esc_html__('Datetime Ticket ID', 'event_espresso')), |
|
37 | + 'DTT_ID' => new EE_Foreign_Key_Int_Field('DTT_ID', esc_html__('The ID to the Datetime', 'event_espresso'), false, 0, 'Datetime'), |
|
38 | + 'TKT_ID' => new EE_Foreign_Key_Int_Field('TKT_ID', esc_html__('The ID to the Ticket', 'event_espresso'), false, 0, 'Ticket') |
|
39 | + )); |
|
40 | + $this->_model_relations = array( |
|
41 | + 'Ticket' => new EE_Belongs_To_Relation(), |
|
42 | + 'Datetime' => new EE_Belongs_To_Relation() |
|
43 | + ); |
|
44 | + // this model is generally available for reading |
|
45 | + $path_to_event = 'Datetime.Event'; |
|
46 | + $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Event_Related_Public($path_to_event); |
|
47 | + $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Event_Related_Protected($path_to_event); |
|
48 | + $this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Event_Related_Protected($path_to_event); |
|
49 | + $this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Event_Related_Protected($path_to_event, EEM_Base::caps_edit); |
|
50 | + $this->model_chain_to_password = $path_to_event; |
|
51 | + parent::__construct($timezone); |
|
52 | + } |
|
53 | 53 | } |
@@ -58,24 +58,24 @@ discard block |
||
58 | 58 | 'Term_Taxonomy' => new EE_Belongs_To_Relation(), |
59 | 59 | ); |
60 | 60 | foreach ($models_this_can_attach_to as $model_name) { |
61 | - $this->_model_relations[ $model_name ] = new EE_Belongs_To_Relation(); |
|
61 | + $this->_model_relations[$model_name] = new EE_Belongs_To_Relation(); |
|
62 | 62 | } |
63 | 63 | $this->_wp_core_model = true; |
64 | 64 | $this->_indexes = array( |
65 | 65 | 'PRIMARY' => new EE_Primary_Key_Index(array('object_id', 'term_taxonomy_id')), |
66 | 66 | ); |
67 | 67 | $path_to_event_model = 'Event'; |
68 | - $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Event_Related_Public( |
|
68 | + $this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Event_Related_Public( |
|
69 | 69 | $path_to_event_model |
70 | 70 | ); |
71 | - $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = |
|
71 | + $this->_cap_restriction_generators[EEM_Base::caps_read_admin] = |
|
72 | 72 | new EE_Restriction_Generator_Event_Related_Protected( |
73 | 73 | $path_to_event_model |
74 | 74 | ); |
75 | - $this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Event_Related_Protected( |
|
75 | + $this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Event_Related_Protected( |
|
76 | 76 | $path_to_event_model |
77 | 77 | ); |
78 | - $this->_cap_restriction_generators[ EEM_Base::caps_delete ] = |
|
78 | + $this->_cap_restriction_generators[EEM_Base::caps_delete] = |
|
79 | 79 | new EE_Restriction_Generator_Event_Related_Protected( |
80 | 80 | $path_to_event_model, |
81 | 81 | EEM_Base::caps_edit |
@@ -85,27 +85,27 @@ discard block |
||
85 | 85 | // and for deleting term relations too |
86 | 86 | $cap_contexts_affected = array(EEM_Base::caps_edit, EEM_Base::caps_delete); |
87 | 87 | foreach ($cap_contexts_affected as $cap_context_affected) { |
88 | - $this->_cap_restrictions[ $cap_context_affected ]['ee_assign_event_category'] = |
|
88 | + $this->_cap_restrictions[$cap_context_affected]['ee_assign_event_category'] = |
|
89 | 89 | new EE_Default_Where_Conditions( |
90 | 90 | array( |
91 | - $path_to_tax_model . 'taxonomy*ee_assign_event_category' => array( |
|
91 | + $path_to_tax_model.'taxonomy*ee_assign_event_category' => array( |
|
92 | 92 | '!=', |
93 | 93 | 'espresso_event_categories', |
94 | 94 | ), |
95 | 95 | ) |
96 | 96 | ); |
97 | - $this->_cap_restrictions[ $cap_context_affected ]['ee_assign_venue_category'] = |
|
97 | + $this->_cap_restrictions[$cap_context_affected]['ee_assign_venue_category'] = |
|
98 | 98 | new EE_Default_Where_Conditions( |
99 | 99 | array( |
100 | - $path_to_tax_model . 'taxonomy*ee_assign_venue_category' => array( |
|
100 | + $path_to_tax_model.'taxonomy*ee_assign_venue_category' => array( |
|
101 | 101 | '!=', |
102 | 102 | 'espresso_venue_categories', |
103 | 103 | ), |
104 | 104 | ) |
105 | 105 | ); |
106 | - $this->_cap_restrictions[ $cap_context_affected ]['ee_assign_event_type'] = new EE_Default_Where_Conditions( |
|
106 | + $this->_cap_restrictions[$cap_context_affected]['ee_assign_event_type'] = new EE_Default_Where_Conditions( |
|
107 | 107 | array( |
108 | - $path_to_tax_model . 'taxonomy*ee_assign_event_type' => array('!=', 'espresso_event_type'), |
|
108 | + $path_to_tax_model.'taxonomy*ee_assign_event_type' => array('!=', 'espresso_event_type'), |
|
109 | 109 | ) |
110 | 110 | ); |
111 | 111 | } |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | { |
233 | 233 | if ($model === EEM_Term_Relationship::instance()) { |
234 | 234 | $taxonomies = get_taxonomies(array('show_in_rest' => true)); |
235 | - if (! empty($taxonomies)) { |
|
235 | + if ( ! empty($taxonomies)) { |
|
236 | 236 | $model_query_params[0]['Term_Taxonomy.taxonomy'] = array('IN', $taxonomies); |
237 | 237 | } |
238 | 238 | } |
@@ -10,233 +10,233 @@ |
||
10 | 10 | class EEM_Term_Relationship extends EEM_Base |
11 | 11 | { |
12 | 12 | |
13 | - // private instance of the Attendee object |
|
14 | - protected static $_instance = null; |
|
15 | - |
|
16 | - |
|
17 | - |
|
18 | - /** |
|
19 | - * EEM_Term_Relationship constructor. |
|
20 | - * |
|
21 | - * @param string $timezone |
|
22 | - */ |
|
23 | - protected function __construct($timezone = null) |
|
24 | - { |
|
25 | - $this->singular_item = esc_html__('Term Relationship', 'event_espresso'); |
|
26 | - $this->plural_item = esc_html__('Term Relationships', 'event_espresso'); |
|
27 | - $this->_tables = array( |
|
28 | - 'Term_Relationship' => new EE_Primary_Table('term_relationships'), |
|
29 | - ); |
|
30 | - $models_this_can_attach_to = array_keys(EE_Registry::instance()->cpt_models()); |
|
31 | - $this->_fields = array( |
|
32 | - 'Term_Relationship' => array( |
|
33 | - 'object_id' => new EE_Foreign_Key_Int_Field( |
|
34 | - 'object_id', |
|
35 | - esc_html__('Object(Post) ID', 'event_espresso'), |
|
36 | - false, |
|
37 | - 0, |
|
38 | - $models_this_can_attach_to |
|
39 | - ), |
|
40 | - 'term_taxonomy_id' => new EE_Foreign_Key_Int_Field( |
|
41 | - 'term_taxonomy_id', |
|
42 | - esc_html__( |
|
43 | - 'Term (in context of a taxonomy) ID', |
|
44 | - 'event_espresso' |
|
45 | - ), |
|
46 | - false, |
|
47 | - 0, |
|
48 | - 'Term_Taxonomy' |
|
49 | - ), |
|
50 | - 'term_order' => new EE_Integer_Field( |
|
51 | - 'term_order', |
|
52 | - esc_html__('Term Order', 'event_espresso'), |
|
53 | - false, |
|
54 | - 0 |
|
55 | - ), |
|
56 | - ), |
|
57 | - ); |
|
58 | - $this->_model_relations = array( |
|
59 | - 'Term_Taxonomy' => new EE_Belongs_To_Relation(), |
|
60 | - ); |
|
61 | - foreach ($models_this_can_attach_to as $model_name) { |
|
62 | - $this->_model_relations[ $model_name ] = new EE_Belongs_To_Relation(); |
|
63 | - } |
|
64 | - $this->_wp_core_model = true; |
|
65 | - $this->_indexes = array( |
|
66 | - 'PRIMARY' => new EE_Primary_Key_Index(array('object_id', 'term_taxonomy_id')), |
|
67 | - ); |
|
68 | - $path_to_event_model = 'Event'; |
|
69 | - $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Event_Related_Public( |
|
70 | - $path_to_event_model |
|
71 | - ); |
|
72 | - $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = |
|
73 | - new EE_Restriction_Generator_Event_Related_Protected( |
|
74 | - $path_to_event_model |
|
75 | - ); |
|
76 | - $this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Event_Related_Protected( |
|
77 | - $path_to_event_model |
|
78 | - ); |
|
79 | - $this->_cap_restriction_generators[ EEM_Base::caps_delete ] = |
|
80 | - new EE_Restriction_Generator_Event_Related_Protected( |
|
81 | - $path_to_event_model, |
|
82 | - EEM_Base::caps_edit |
|
83 | - ); |
|
84 | - $path_to_tax_model = 'Term_Taxonomy.'; |
|
85 | - // add cap restrictions for editing term relations to the "ee_assign_*" |
|
86 | - // and for deleting term relations too |
|
87 | - $cap_contexts_affected = array(EEM_Base::caps_edit, EEM_Base::caps_delete); |
|
88 | - foreach ($cap_contexts_affected as $cap_context_affected) { |
|
89 | - $this->_cap_restrictions[ $cap_context_affected ]['ee_assign_event_category'] = |
|
90 | - new EE_Default_Where_Conditions( |
|
91 | - array( |
|
92 | - $path_to_tax_model . 'taxonomy*ee_assign_event_category' => array( |
|
93 | - '!=', |
|
94 | - 'espresso_event_categories', |
|
95 | - ), |
|
96 | - ) |
|
97 | - ); |
|
98 | - $this->_cap_restrictions[ $cap_context_affected ]['ee_assign_venue_category'] = |
|
99 | - new EE_Default_Where_Conditions( |
|
100 | - array( |
|
101 | - $path_to_tax_model . 'taxonomy*ee_assign_venue_category' => array( |
|
102 | - '!=', |
|
103 | - 'espresso_venue_categories', |
|
104 | - ), |
|
105 | - ) |
|
106 | - ); |
|
107 | - $this->_cap_restrictions[ $cap_context_affected ]['ee_assign_event_type'] = new EE_Default_Where_Conditions( |
|
108 | - array( |
|
109 | - $path_to_tax_model . 'taxonomy*ee_assign_event_type' => array('!=', 'espresso_event_type'), |
|
110 | - ) |
|
111 | - ); |
|
112 | - } |
|
113 | - parent::__construct($timezone); |
|
114 | - add_filter( |
|
115 | - 'FHEE__Read__create_model_query_params', |
|
116 | - array('EEM_Term_Relationship', 'rest_api_query_params'), |
|
117 | - 10, |
|
118 | - 3 |
|
119 | - ); |
|
120 | - } |
|
121 | - |
|
122 | - |
|
123 | - /** |
|
124 | - * Makes sure all term-taxonomy counts are correct |
|
125 | - * |
|
126 | - * @param int $term_taxonomy_id the id of the term taxonomy to update. If NULL, updates ALL |
|
127 | - * @global wpdb $wpdb |
|
128 | - * @return int the number of rows affected |
|
129 | - * @throws EE_Error |
|
130 | - */ |
|
131 | - public function update_term_taxonomy_counts($term_taxonomy_id = null) |
|
132 | - { |
|
133 | - // because this uses a subquery and sometimes assigning to column to be another column's |
|
134 | - // value, we just write the SQL directly. |
|
135 | - global $wpdb; |
|
136 | - |
|
137 | - $query = " |
|
13 | + // private instance of the Attendee object |
|
14 | + protected static $_instance = null; |
|
15 | + |
|
16 | + |
|
17 | + |
|
18 | + /** |
|
19 | + * EEM_Term_Relationship constructor. |
|
20 | + * |
|
21 | + * @param string $timezone |
|
22 | + */ |
|
23 | + protected function __construct($timezone = null) |
|
24 | + { |
|
25 | + $this->singular_item = esc_html__('Term Relationship', 'event_espresso'); |
|
26 | + $this->plural_item = esc_html__('Term Relationships', 'event_espresso'); |
|
27 | + $this->_tables = array( |
|
28 | + 'Term_Relationship' => new EE_Primary_Table('term_relationships'), |
|
29 | + ); |
|
30 | + $models_this_can_attach_to = array_keys(EE_Registry::instance()->cpt_models()); |
|
31 | + $this->_fields = array( |
|
32 | + 'Term_Relationship' => array( |
|
33 | + 'object_id' => new EE_Foreign_Key_Int_Field( |
|
34 | + 'object_id', |
|
35 | + esc_html__('Object(Post) ID', 'event_espresso'), |
|
36 | + false, |
|
37 | + 0, |
|
38 | + $models_this_can_attach_to |
|
39 | + ), |
|
40 | + 'term_taxonomy_id' => new EE_Foreign_Key_Int_Field( |
|
41 | + 'term_taxonomy_id', |
|
42 | + esc_html__( |
|
43 | + 'Term (in context of a taxonomy) ID', |
|
44 | + 'event_espresso' |
|
45 | + ), |
|
46 | + false, |
|
47 | + 0, |
|
48 | + 'Term_Taxonomy' |
|
49 | + ), |
|
50 | + 'term_order' => new EE_Integer_Field( |
|
51 | + 'term_order', |
|
52 | + esc_html__('Term Order', 'event_espresso'), |
|
53 | + false, |
|
54 | + 0 |
|
55 | + ), |
|
56 | + ), |
|
57 | + ); |
|
58 | + $this->_model_relations = array( |
|
59 | + 'Term_Taxonomy' => new EE_Belongs_To_Relation(), |
|
60 | + ); |
|
61 | + foreach ($models_this_can_attach_to as $model_name) { |
|
62 | + $this->_model_relations[ $model_name ] = new EE_Belongs_To_Relation(); |
|
63 | + } |
|
64 | + $this->_wp_core_model = true; |
|
65 | + $this->_indexes = array( |
|
66 | + 'PRIMARY' => new EE_Primary_Key_Index(array('object_id', 'term_taxonomy_id')), |
|
67 | + ); |
|
68 | + $path_to_event_model = 'Event'; |
|
69 | + $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Event_Related_Public( |
|
70 | + $path_to_event_model |
|
71 | + ); |
|
72 | + $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = |
|
73 | + new EE_Restriction_Generator_Event_Related_Protected( |
|
74 | + $path_to_event_model |
|
75 | + ); |
|
76 | + $this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Event_Related_Protected( |
|
77 | + $path_to_event_model |
|
78 | + ); |
|
79 | + $this->_cap_restriction_generators[ EEM_Base::caps_delete ] = |
|
80 | + new EE_Restriction_Generator_Event_Related_Protected( |
|
81 | + $path_to_event_model, |
|
82 | + EEM_Base::caps_edit |
|
83 | + ); |
|
84 | + $path_to_tax_model = 'Term_Taxonomy.'; |
|
85 | + // add cap restrictions for editing term relations to the "ee_assign_*" |
|
86 | + // and for deleting term relations too |
|
87 | + $cap_contexts_affected = array(EEM_Base::caps_edit, EEM_Base::caps_delete); |
|
88 | + foreach ($cap_contexts_affected as $cap_context_affected) { |
|
89 | + $this->_cap_restrictions[ $cap_context_affected ]['ee_assign_event_category'] = |
|
90 | + new EE_Default_Where_Conditions( |
|
91 | + array( |
|
92 | + $path_to_tax_model . 'taxonomy*ee_assign_event_category' => array( |
|
93 | + '!=', |
|
94 | + 'espresso_event_categories', |
|
95 | + ), |
|
96 | + ) |
|
97 | + ); |
|
98 | + $this->_cap_restrictions[ $cap_context_affected ]['ee_assign_venue_category'] = |
|
99 | + new EE_Default_Where_Conditions( |
|
100 | + array( |
|
101 | + $path_to_tax_model . 'taxonomy*ee_assign_venue_category' => array( |
|
102 | + '!=', |
|
103 | + 'espresso_venue_categories', |
|
104 | + ), |
|
105 | + ) |
|
106 | + ); |
|
107 | + $this->_cap_restrictions[ $cap_context_affected ]['ee_assign_event_type'] = new EE_Default_Where_Conditions( |
|
108 | + array( |
|
109 | + $path_to_tax_model . 'taxonomy*ee_assign_event_type' => array('!=', 'espresso_event_type'), |
|
110 | + ) |
|
111 | + ); |
|
112 | + } |
|
113 | + parent::__construct($timezone); |
|
114 | + add_filter( |
|
115 | + 'FHEE__Read__create_model_query_params', |
|
116 | + array('EEM_Term_Relationship', 'rest_api_query_params'), |
|
117 | + 10, |
|
118 | + 3 |
|
119 | + ); |
|
120 | + } |
|
121 | + |
|
122 | + |
|
123 | + /** |
|
124 | + * Makes sure all term-taxonomy counts are correct |
|
125 | + * |
|
126 | + * @param int $term_taxonomy_id the id of the term taxonomy to update. If NULL, updates ALL |
|
127 | + * @global wpdb $wpdb |
|
128 | + * @return int the number of rows affected |
|
129 | + * @throws EE_Error |
|
130 | + */ |
|
131 | + public function update_term_taxonomy_counts($term_taxonomy_id = null) |
|
132 | + { |
|
133 | + // because this uses a subquery and sometimes assigning to column to be another column's |
|
134 | + // value, we just write the SQL directly. |
|
135 | + global $wpdb; |
|
136 | + |
|
137 | + $query = " |
|
138 | 138 | UPDATE {$wpdb->term_taxonomy} AS tt |
139 | 139 | SET count = ( |
140 | 140 | select count(*) as proper_count from {$wpdb->term_relationships} AS tr |
141 | 141 | WHERE tt.term_taxonomy_id = tr.term_taxonomy_id |
142 | 142 | )"; |
143 | 143 | |
144 | - if ($term_taxonomy_id) { |
|
145 | - $query .= ' WHERE tt.term_taxonomy_id = %d'; |
|
146 | - $query = $wpdb->prepare( |
|
147 | - $query, |
|
148 | - $term_taxonomy_id |
|
149 | - ); |
|
150 | - } |
|
151 | - $rows_affected = $this->_do_wpdb_query( |
|
152 | - 'query', |
|
153 | - array( |
|
154 | - $query, |
|
155 | - ) |
|
156 | - ); |
|
157 | - return $rows_affected; |
|
158 | - } |
|
159 | - |
|
160 | - |
|
161 | - |
|
162 | - /** |
|
163 | - * Overrides the parent to also make sure term-taxonomy counts are up-to-date after |
|
164 | - * inserting |
|
165 | - * |
|
166 | - * @param array $field_n_values @see EEM_Base::insert |
|
167 | - * @return boolean |
|
168 | - */ |
|
169 | - public function insert($field_n_values) |
|
170 | - { |
|
171 | - $return = parent::insert($field_n_values); |
|
172 | - if (isset($field_n_values['term_taxonomy_id'])) { |
|
173 | - $this->update_term_taxonomy_counts($field_n_values['term_taxonomy_id']); |
|
174 | - } |
|
175 | - return $return; |
|
176 | - } |
|
177 | - |
|
178 | - |
|
179 | - |
|
180 | - /** |
|
181 | - * Overrides parent so that after an update, we also check the term_taxonomy_counts are |
|
182 | - * all ok |
|
183 | - * |
|
184 | - * @param array $fields_n_values see EEM_Base::update |
|
185 | - * @param array $query_params @see https://github.com/eventespresso/event-espresso-core/tree/master/docs/G--Model-System/model-query-params.md |
|
186 | - * @param boolean $keep_model_objs_in_sync if TRUE, makes sure we ALSO update model objects |
|
187 | - * in this model's entity map according to $fields_n_values that match |
|
188 | - * $query_params. This obviously has some overhead, so you can disable it |
|
189 | - * by setting this to FALSE, but be aware that model objects being used |
|
190 | - * could get out-of-sync with the database |
|
191 | - * @return int |
|
192 | - */ |
|
193 | - public function update($fields_n_values, $query_params, $keep_model_objs_in_sync = true) |
|
194 | - { |
|
195 | - $count = parent::update($fields_n_values, $query_params, $keep_model_objs_in_sync); |
|
196 | - if ($count) { |
|
197 | - $this->update_term_taxonomy_counts(); |
|
198 | - } |
|
199 | - return $count; |
|
200 | - } |
|
201 | - |
|
202 | - |
|
203 | - |
|
204 | - /** |
|
205 | - * Overrides parent so that after running this, we also double-check |
|
206 | - * the term taxonomy counts are up-to-date |
|
207 | - * |
|
208 | - * @param array $query_params @see https://github.com/eventespresso/event-espresso-core/tree/master/docs/G--Model-System/model-query-params.md |
|
209 | - * @param boolean $allow_blocking |
|
210 | - * @return int @see EEM_Base::delete |
|
211 | - */ |
|
212 | - public function delete($query_params, $allow_blocking = true) |
|
213 | - { |
|
214 | - $count = parent::delete($query_params, $allow_blocking); |
|
215 | - if ($count) { |
|
216 | - $this->update_term_taxonomy_counts(); |
|
217 | - } |
|
218 | - return $count; |
|
219 | - } |
|
220 | - |
|
221 | - |
|
222 | - |
|
223 | - /** |
|
224 | - * Makes sure that during REST API queries, we only return term relationships |
|
225 | - * for term taxonomies which should be shown in the rest api |
|
226 | - * |
|
227 | - * @param array $model_query_params |
|
228 | - * @param array $querystring_query_params |
|
229 | - * @param EEM_Base $model |
|
230 | - * @return array |
|
231 | - */ |
|
232 | - public static function rest_api_query_params($model_query_params, $querystring_query_params, $model) |
|
233 | - { |
|
234 | - if ($model === EEM_Term_Relationship::instance()) { |
|
235 | - $taxonomies = get_taxonomies(array('show_in_rest' => true)); |
|
236 | - if (! empty($taxonomies)) { |
|
237 | - $model_query_params[0]['Term_Taxonomy.taxonomy'] = array('IN', $taxonomies); |
|
238 | - } |
|
239 | - } |
|
240 | - return $model_query_params; |
|
241 | - } |
|
144 | + if ($term_taxonomy_id) { |
|
145 | + $query .= ' WHERE tt.term_taxonomy_id = %d'; |
|
146 | + $query = $wpdb->prepare( |
|
147 | + $query, |
|
148 | + $term_taxonomy_id |
|
149 | + ); |
|
150 | + } |
|
151 | + $rows_affected = $this->_do_wpdb_query( |
|
152 | + 'query', |
|
153 | + array( |
|
154 | + $query, |
|
155 | + ) |
|
156 | + ); |
|
157 | + return $rows_affected; |
|
158 | + } |
|
159 | + |
|
160 | + |
|
161 | + |
|
162 | + /** |
|
163 | + * Overrides the parent to also make sure term-taxonomy counts are up-to-date after |
|
164 | + * inserting |
|
165 | + * |
|
166 | + * @param array $field_n_values @see EEM_Base::insert |
|
167 | + * @return boolean |
|
168 | + */ |
|
169 | + public function insert($field_n_values) |
|
170 | + { |
|
171 | + $return = parent::insert($field_n_values); |
|
172 | + if (isset($field_n_values['term_taxonomy_id'])) { |
|
173 | + $this->update_term_taxonomy_counts($field_n_values['term_taxonomy_id']); |
|
174 | + } |
|
175 | + return $return; |
|
176 | + } |
|
177 | + |
|
178 | + |
|
179 | + |
|
180 | + /** |
|
181 | + * Overrides parent so that after an update, we also check the term_taxonomy_counts are |
|
182 | + * all ok |
|
183 | + * |
|
184 | + * @param array $fields_n_values see EEM_Base::update |
|
185 | + * @param array $query_params @see https://github.com/eventespresso/event-espresso-core/tree/master/docs/G--Model-System/model-query-params.md |
|
186 | + * @param boolean $keep_model_objs_in_sync if TRUE, makes sure we ALSO update model objects |
|
187 | + * in this model's entity map according to $fields_n_values that match |
|
188 | + * $query_params. This obviously has some overhead, so you can disable it |
|
189 | + * by setting this to FALSE, but be aware that model objects being used |
|
190 | + * could get out-of-sync with the database |
|
191 | + * @return int |
|
192 | + */ |
|
193 | + public function update($fields_n_values, $query_params, $keep_model_objs_in_sync = true) |
|
194 | + { |
|
195 | + $count = parent::update($fields_n_values, $query_params, $keep_model_objs_in_sync); |
|
196 | + if ($count) { |
|
197 | + $this->update_term_taxonomy_counts(); |
|
198 | + } |
|
199 | + return $count; |
|
200 | + } |
|
201 | + |
|
202 | + |
|
203 | + |
|
204 | + /** |
|
205 | + * Overrides parent so that after running this, we also double-check |
|
206 | + * the term taxonomy counts are up-to-date |
|
207 | + * |
|
208 | + * @param array $query_params @see https://github.com/eventespresso/event-espresso-core/tree/master/docs/G--Model-System/model-query-params.md |
|
209 | + * @param boolean $allow_blocking |
|
210 | + * @return int @see EEM_Base::delete |
|
211 | + */ |
|
212 | + public function delete($query_params, $allow_blocking = true) |
|
213 | + { |
|
214 | + $count = parent::delete($query_params, $allow_blocking); |
|
215 | + if ($count) { |
|
216 | + $this->update_term_taxonomy_counts(); |
|
217 | + } |
|
218 | + return $count; |
|
219 | + } |
|
220 | + |
|
221 | + |
|
222 | + |
|
223 | + /** |
|
224 | + * Makes sure that during REST API queries, we only return term relationships |
|
225 | + * for term taxonomies which should be shown in the rest api |
|
226 | + * |
|
227 | + * @param array $model_query_params |
|
228 | + * @param array $querystring_query_params |
|
229 | + * @param EEM_Base $model |
|
230 | + * @return array |
|
231 | + */ |
|
232 | + public static function rest_api_query_params($model_query_params, $querystring_query_params, $model) |
|
233 | + { |
|
234 | + if ($model === EEM_Term_Relationship::instance()) { |
|
235 | + $taxonomies = get_taxonomies(array('show_in_rest' => true)); |
|
236 | + if (! empty($taxonomies)) { |
|
237 | + $model_query_params[0]['Term_Taxonomy.taxonomy'] = array('IN', $taxonomies); |
|
238 | + } |
|
239 | + } |
|
240 | + return $model_query_params; |
|
241 | + } |
|
242 | 242 | } |
@@ -10,322 +10,322 @@ |
||
10 | 10 | class EEM_Ticket extends EEM_Soft_Delete_Base |
11 | 11 | { |
12 | 12 | |
13 | - /** |
|
14 | - * private instance of the EEM_Ticket object |
|
15 | - * |
|
16 | - * @var EEM_Ticket $_instance |
|
17 | - */ |
|
18 | - protected static $_instance; |
|
13 | + /** |
|
14 | + * private instance of the EEM_Ticket object |
|
15 | + * |
|
16 | + * @var EEM_Ticket $_instance |
|
17 | + */ |
|
18 | + protected static $_instance; |
|
19 | 19 | |
20 | 20 | |
21 | - /** |
|
22 | - * private constructor to prevent direct creation |
|
23 | - * |
|
24 | - * @Constructor |
|
25 | - * @access private |
|
26 | - * @param string $timezone string representing the timezone we want to set for returned Date Time Strings |
|
27 | - * (and any incoming timezone data that gets saved). |
|
28 | - * Note this just sends the timezone info to the date time model field objects. |
|
29 | - * Default is NULL |
|
30 | - * (and will be assumed using the set timezone in the 'timezone_string' wp option) |
|
31 | - * @throws EE_Error |
|
32 | - */ |
|
33 | - protected function __construct($timezone) |
|
34 | - { |
|
35 | - $this->singular_item = esc_html__('Ticket', 'event_espresso'); |
|
36 | - $this->plural_item = esc_html__('Tickets', 'event_espresso'); |
|
37 | - $this->_tables = array( |
|
38 | - 'Ticket' => new EE_Primary_Table('esp_ticket', 'TKT_ID'), |
|
39 | - ); |
|
40 | - $this->_fields = array( |
|
41 | - 'Ticket' => array( |
|
42 | - 'TKT_ID' => new EE_Primary_Key_Int_Field( |
|
43 | - 'TKT_ID', |
|
44 | - esc_html__('Ticket ID', 'event_espresso') |
|
45 | - ), |
|
46 | - 'TTM_ID' => new EE_Foreign_Key_Int_Field( |
|
47 | - 'TTM_ID', |
|
48 | - esc_html__('Ticket Template ID', 'event_espresso'), |
|
49 | - false, |
|
50 | - 0, |
|
51 | - 'Ticket_Template' |
|
52 | - ), |
|
53 | - 'TKT_name' => new EE_Plain_Text_Field( |
|
54 | - 'TKT_name', |
|
55 | - esc_html__('Ticket Name', 'event_espresso'), |
|
56 | - false, |
|
57 | - '' |
|
58 | - ), |
|
59 | - 'TKT_description' => new EE_Post_Content_Field( |
|
60 | - 'TKT_description', |
|
61 | - esc_html__('Description of Ticket', 'event_espresso'), |
|
62 | - false, |
|
63 | - '' |
|
64 | - ), |
|
65 | - 'TKT_start_date' => new EE_Datetime_Field( |
|
66 | - 'TKT_start_date', |
|
67 | - esc_html__('Start time/date of Ticket', 'event_espresso'), |
|
68 | - false, |
|
69 | - EE_Datetime_Field::now, |
|
70 | - $timezone |
|
71 | - ), |
|
72 | - 'TKT_end_date' => new EE_Datetime_Field( |
|
73 | - 'TKT_end_date', |
|
74 | - esc_html__('End time/date of Ticket', 'event_espresso'), |
|
75 | - false, |
|
76 | - EE_Datetime_Field::now, |
|
77 | - $timezone |
|
78 | - ), |
|
79 | - 'TKT_min' => new EE_Integer_Field( |
|
80 | - 'TKT_min', |
|
81 | - esc_html__('Minimum quantity of this ticket that must be purchased', 'event_espresso'), |
|
82 | - false, |
|
83 | - 0 |
|
84 | - ), |
|
85 | - 'TKT_max' => new EE_Infinite_Integer_Field( |
|
86 | - 'TKT_max', |
|
87 | - esc_html__( |
|
88 | - 'Maximum quantity of this ticket that can be purchased in one transaction', |
|
89 | - 'event_espresso' |
|
90 | - ), |
|
91 | - false, |
|
92 | - EE_INF |
|
93 | - ), |
|
94 | - 'TKT_price' => new EE_Money_Field( |
|
95 | - 'TKT_price', |
|
96 | - esc_html__('Final calculated price for ticket', 'event_espresso'), |
|
97 | - false, |
|
98 | - 0 |
|
99 | - ), |
|
100 | - 'TKT_sold' => new EE_Integer_Field( |
|
101 | - 'TKT_sold', |
|
102 | - esc_html__('Number of this ticket sold', 'event_espresso'), |
|
103 | - false, |
|
104 | - 0 |
|
105 | - ), |
|
106 | - 'TKT_qty' => new EE_Infinite_Integer_Field( |
|
107 | - 'TKT_qty', |
|
108 | - esc_html__('Quantity of this ticket that is available', 'event_espresso'), |
|
109 | - false, |
|
110 | - EE_INF |
|
111 | - ), |
|
112 | - 'TKT_reserved' => new EE_Integer_Field( |
|
113 | - 'TKT_reserved', |
|
114 | - esc_html__( |
|
115 | - 'Quantity of this ticket that is reserved, but not yet fully purchased', |
|
116 | - 'event_espresso' |
|
117 | - ), |
|
118 | - false, |
|
119 | - 0 |
|
120 | - ), |
|
121 | - 'TKT_uses' => new EE_Infinite_Integer_Field( |
|
122 | - 'TKT_uses', |
|
123 | - esc_html__('Number of datetimes this ticket can be used at', 'event_espresso'), |
|
124 | - false, |
|
125 | - EE_INF |
|
126 | - ), |
|
127 | - 'TKT_required' => new EE_Boolean_Field( |
|
128 | - 'TKT_required', |
|
129 | - esc_html__( |
|
130 | - 'Flag indicating whether this ticket must be purchased with a transaction', |
|
131 | - 'event_espresso' |
|
132 | - ), |
|
133 | - false, |
|
134 | - false |
|
135 | - ), |
|
136 | - 'TKT_taxable' => new EE_Boolean_Field( |
|
137 | - 'TKT_taxable', |
|
138 | - esc_html__( |
|
139 | - 'Flag indicating whether there is tax applied on this ticket', |
|
140 | - 'event_espresso' |
|
141 | - ), |
|
142 | - false, |
|
143 | - false |
|
144 | - ), |
|
145 | - 'TKT_is_default' => new EE_Boolean_Field( |
|
146 | - 'TKT_is_default', |
|
147 | - esc_html__('Flag indicating that this ticket is a default ticket', 'event_espresso'), |
|
148 | - false, |
|
149 | - false |
|
150 | - ), |
|
151 | - 'TKT_order' => new EE_Integer_Field( |
|
152 | - 'TKT_order', |
|
153 | - esc_html__( |
|
154 | - 'The order in which the Ticket is displayed in the editor (used for autosaves when the form doesn\'t have the ticket ID yet)', |
|
155 | - 'event_espresso' |
|
156 | - ), |
|
157 | - false, |
|
158 | - 0 |
|
159 | - ), |
|
160 | - 'TKT_row' => new EE_Integer_Field( |
|
161 | - 'TKT_row', |
|
162 | - esc_html__('How tickets are displayed in the ui', 'event_espresso'), |
|
163 | - false, |
|
164 | - 0 |
|
165 | - ), |
|
166 | - 'TKT_deleted' => new EE_Trashed_Flag_Field( |
|
167 | - 'TKT_deleted', |
|
168 | - esc_html__('Flag indicating if this has been archived or not', 'event_espresso'), |
|
169 | - false, |
|
170 | - false |
|
171 | - ), |
|
172 | - 'TKT_wp_user' => new EE_WP_User_Field( |
|
173 | - 'TKT_wp_user', |
|
174 | - esc_html__('Ticket Creator ID', 'event_espresso'), |
|
175 | - false |
|
176 | - ), |
|
177 | - 'TKT_parent' => new EE_Integer_Field( |
|
178 | - 'TKT_parent', |
|
179 | - esc_html__( |
|
180 | - 'Indicates what TKT_ID is the parent of this TKT_ID (used in autosaves/revisions)', |
|
181 | - 'event_espresso' |
|
182 | - ), |
|
183 | - true, |
|
184 | - 0 |
|
185 | - ), |
|
186 | - ), |
|
187 | - ); |
|
188 | - $this->_model_relations = array( |
|
189 | - 'Datetime' => new EE_HABTM_Relation('Datetime_Ticket'), |
|
190 | - 'Datetime_Ticket' => new EE_Has_Many_Relation(), |
|
191 | - 'Price' => new EE_HABTM_Relation('Ticket_Price'), |
|
192 | - 'Ticket_Template' => new EE_Belongs_To_Relation(), |
|
193 | - 'Registration' => new EE_Has_Many_Relation(), |
|
194 | - 'WP_User' => new EE_Belongs_To_Relation(), |
|
195 | - ); |
|
196 | - // this model is generally available for reading |
|
197 | - $path_to_event = 'Datetime.Event'; |
|
198 | - $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Default_Public( |
|
199 | - 'TKT_is_default', |
|
200 | - $path_to_event |
|
201 | - ); |
|
202 | - // account for default tickets in the caps |
|
203 | - $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Default_Protected( |
|
204 | - 'TKT_is_default', |
|
205 | - $path_to_event |
|
206 | - ); |
|
207 | - $this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Default_Protected( |
|
208 | - 'TKT_is_default', |
|
209 | - $path_to_event |
|
210 | - ); |
|
211 | - $this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Default_Protected( |
|
212 | - 'TKT_is_default', |
|
213 | - $path_to_event |
|
214 | - ); |
|
215 | - $this->model_chain_to_password = $path_to_event; |
|
216 | - parent::__construct($timezone); |
|
217 | - } |
|
21 | + /** |
|
22 | + * private constructor to prevent direct creation |
|
23 | + * |
|
24 | + * @Constructor |
|
25 | + * @access private |
|
26 | + * @param string $timezone string representing the timezone we want to set for returned Date Time Strings |
|
27 | + * (and any incoming timezone data that gets saved). |
|
28 | + * Note this just sends the timezone info to the date time model field objects. |
|
29 | + * Default is NULL |
|
30 | + * (and will be assumed using the set timezone in the 'timezone_string' wp option) |
|
31 | + * @throws EE_Error |
|
32 | + */ |
|
33 | + protected function __construct($timezone) |
|
34 | + { |
|
35 | + $this->singular_item = esc_html__('Ticket', 'event_espresso'); |
|
36 | + $this->plural_item = esc_html__('Tickets', 'event_espresso'); |
|
37 | + $this->_tables = array( |
|
38 | + 'Ticket' => new EE_Primary_Table('esp_ticket', 'TKT_ID'), |
|
39 | + ); |
|
40 | + $this->_fields = array( |
|
41 | + 'Ticket' => array( |
|
42 | + 'TKT_ID' => new EE_Primary_Key_Int_Field( |
|
43 | + 'TKT_ID', |
|
44 | + esc_html__('Ticket ID', 'event_espresso') |
|
45 | + ), |
|
46 | + 'TTM_ID' => new EE_Foreign_Key_Int_Field( |
|
47 | + 'TTM_ID', |
|
48 | + esc_html__('Ticket Template ID', 'event_espresso'), |
|
49 | + false, |
|
50 | + 0, |
|
51 | + 'Ticket_Template' |
|
52 | + ), |
|
53 | + 'TKT_name' => new EE_Plain_Text_Field( |
|
54 | + 'TKT_name', |
|
55 | + esc_html__('Ticket Name', 'event_espresso'), |
|
56 | + false, |
|
57 | + '' |
|
58 | + ), |
|
59 | + 'TKT_description' => new EE_Post_Content_Field( |
|
60 | + 'TKT_description', |
|
61 | + esc_html__('Description of Ticket', 'event_espresso'), |
|
62 | + false, |
|
63 | + '' |
|
64 | + ), |
|
65 | + 'TKT_start_date' => new EE_Datetime_Field( |
|
66 | + 'TKT_start_date', |
|
67 | + esc_html__('Start time/date of Ticket', 'event_espresso'), |
|
68 | + false, |
|
69 | + EE_Datetime_Field::now, |
|
70 | + $timezone |
|
71 | + ), |
|
72 | + 'TKT_end_date' => new EE_Datetime_Field( |
|
73 | + 'TKT_end_date', |
|
74 | + esc_html__('End time/date of Ticket', 'event_espresso'), |
|
75 | + false, |
|
76 | + EE_Datetime_Field::now, |
|
77 | + $timezone |
|
78 | + ), |
|
79 | + 'TKT_min' => new EE_Integer_Field( |
|
80 | + 'TKT_min', |
|
81 | + esc_html__('Minimum quantity of this ticket that must be purchased', 'event_espresso'), |
|
82 | + false, |
|
83 | + 0 |
|
84 | + ), |
|
85 | + 'TKT_max' => new EE_Infinite_Integer_Field( |
|
86 | + 'TKT_max', |
|
87 | + esc_html__( |
|
88 | + 'Maximum quantity of this ticket that can be purchased in one transaction', |
|
89 | + 'event_espresso' |
|
90 | + ), |
|
91 | + false, |
|
92 | + EE_INF |
|
93 | + ), |
|
94 | + 'TKT_price' => new EE_Money_Field( |
|
95 | + 'TKT_price', |
|
96 | + esc_html__('Final calculated price for ticket', 'event_espresso'), |
|
97 | + false, |
|
98 | + 0 |
|
99 | + ), |
|
100 | + 'TKT_sold' => new EE_Integer_Field( |
|
101 | + 'TKT_sold', |
|
102 | + esc_html__('Number of this ticket sold', 'event_espresso'), |
|
103 | + false, |
|
104 | + 0 |
|
105 | + ), |
|
106 | + 'TKT_qty' => new EE_Infinite_Integer_Field( |
|
107 | + 'TKT_qty', |
|
108 | + esc_html__('Quantity of this ticket that is available', 'event_espresso'), |
|
109 | + false, |
|
110 | + EE_INF |
|
111 | + ), |
|
112 | + 'TKT_reserved' => new EE_Integer_Field( |
|
113 | + 'TKT_reserved', |
|
114 | + esc_html__( |
|
115 | + 'Quantity of this ticket that is reserved, but not yet fully purchased', |
|
116 | + 'event_espresso' |
|
117 | + ), |
|
118 | + false, |
|
119 | + 0 |
|
120 | + ), |
|
121 | + 'TKT_uses' => new EE_Infinite_Integer_Field( |
|
122 | + 'TKT_uses', |
|
123 | + esc_html__('Number of datetimes this ticket can be used at', 'event_espresso'), |
|
124 | + false, |
|
125 | + EE_INF |
|
126 | + ), |
|
127 | + 'TKT_required' => new EE_Boolean_Field( |
|
128 | + 'TKT_required', |
|
129 | + esc_html__( |
|
130 | + 'Flag indicating whether this ticket must be purchased with a transaction', |
|
131 | + 'event_espresso' |
|
132 | + ), |
|
133 | + false, |
|
134 | + false |
|
135 | + ), |
|
136 | + 'TKT_taxable' => new EE_Boolean_Field( |
|
137 | + 'TKT_taxable', |
|
138 | + esc_html__( |
|
139 | + 'Flag indicating whether there is tax applied on this ticket', |
|
140 | + 'event_espresso' |
|
141 | + ), |
|
142 | + false, |
|
143 | + false |
|
144 | + ), |
|
145 | + 'TKT_is_default' => new EE_Boolean_Field( |
|
146 | + 'TKT_is_default', |
|
147 | + esc_html__('Flag indicating that this ticket is a default ticket', 'event_espresso'), |
|
148 | + false, |
|
149 | + false |
|
150 | + ), |
|
151 | + 'TKT_order' => new EE_Integer_Field( |
|
152 | + 'TKT_order', |
|
153 | + esc_html__( |
|
154 | + 'The order in which the Ticket is displayed in the editor (used for autosaves when the form doesn\'t have the ticket ID yet)', |
|
155 | + 'event_espresso' |
|
156 | + ), |
|
157 | + false, |
|
158 | + 0 |
|
159 | + ), |
|
160 | + 'TKT_row' => new EE_Integer_Field( |
|
161 | + 'TKT_row', |
|
162 | + esc_html__('How tickets are displayed in the ui', 'event_espresso'), |
|
163 | + false, |
|
164 | + 0 |
|
165 | + ), |
|
166 | + 'TKT_deleted' => new EE_Trashed_Flag_Field( |
|
167 | + 'TKT_deleted', |
|
168 | + esc_html__('Flag indicating if this has been archived or not', 'event_espresso'), |
|
169 | + false, |
|
170 | + false |
|
171 | + ), |
|
172 | + 'TKT_wp_user' => new EE_WP_User_Field( |
|
173 | + 'TKT_wp_user', |
|
174 | + esc_html__('Ticket Creator ID', 'event_espresso'), |
|
175 | + false |
|
176 | + ), |
|
177 | + 'TKT_parent' => new EE_Integer_Field( |
|
178 | + 'TKT_parent', |
|
179 | + esc_html__( |
|
180 | + 'Indicates what TKT_ID is the parent of this TKT_ID (used in autosaves/revisions)', |
|
181 | + 'event_espresso' |
|
182 | + ), |
|
183 | + true, |
|
184 | + 0 |
|
185 | + ), |
|
186 | + ), |
|
187 | + ); |
|
188 | + $this->_model_relations = array( |
|
189 | + 'Datetime' => new EE_HABTM_Relation('Datetime_Ticket'), |
|
190 | + 'Datetime_Ticket' => new EE_Has_Many_Relation(), |
|
191 | + 'Price' => new EE_HABTM_Relation('Ticket_Price'), |
|
192 | + 'Ticket_Template' => new EE_Belongs_To_Relation(), |
|
193 | + 'Registration' => new EE_Has_Many_Relation(), |
|
194 | + 'WP_User' => new EE_Belongs_To_Relation(), |
|
195 | + ); |
|
196 | + // this model is generally available for reading |
|
197 | + $path_to_event = 'Datetime.Event'; |
|
198 | + $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Default_Public( |
|
199 | + 'TKT_is_default', |
|
200 | + $path_to_event |
|
201 | + ); |
|
202 | + // account for default tickets in the caps |
|
203 | + $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Default_Protected( |
|
204 | + 'TKT_is_default', |
|
205 | + $path_to_event |
|
206 | + ); |
|
207 | + $this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Default_Protected( |
|
208 | + 'TKT_is_default', |
|
209 | + $path_to_event |
|
210 | + ); |
|
211 | + $this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Default_Protected( |
|
212 | + 'TKT_is_default', |
|
213 | + $path_to_event |
|
214 | + ); |
|
215 | + $this->model_chain_to_password = $path_to_event; |
|
216 | + parent::__construct($timezone); |
|
217 | + } |
|
218 | 218 | |
219 | 219 | |
220 | - /** |
|
221 | - * This returns all tickets that are defaults from the db |
|
222 | - * |
|
223 | - * @return EE_Ticket[] |
|
224 | - * @throws EE_Error |
|
225 | - */ |
|
226 | - public function get_all_default_tickets() |
|
227 | - { |
|
228 | - /** @type EE_Ticket[] $tickets */ |
|
229 | - $tickets = $this->get_all(array(array('TKT_is_default' => 1), 'order_by' => array('TKT_ID' => 'ASC'))); |
|
230 | - // we need to set the start date and end date to today's date and the start of the default dtt |
|
231 | - return $this->_set_default_dates($tickets); |
|
232 | - } |
|
220 | + /** |
|
221 | + * This returns all tickets that are defaults from the db |
|
222 | + * |
|
223 | + * @return EE_Ticket[] |
|
224 | + * @throws EE_Error |
|
225 | + */ |
|
226 | + public function get_all_default_tickets() |
|
227 | + { |
|
228 | + /** @type EE_Ticket[] $tickets */ |
|
229 | + $tickets = $this->get_all(array(array('TKT_is_default' => 1), 'order_by' => array('TKT_ID' => 'ASC'))); |
|
230 | + // we need to set the start date and end date to today's date and the start of the default dtt |
|
231 | + return $this->_set_default_dates($tickets); |
|
232 | + } |
|
233 | 233 | |
234 | 234 | |
235 | - /** |
|
236 | - * sets up relevant start and end date for EE_Ticket (s) |
|
237 | - * |
|
238 | - * @param EE_Ticket[] $tickets |
|
239 | - * @return EE_Ticket[] |
|
240 | - * @throws EE_Error |
|
241 | - */ |
|
242 | - private function _set_default_dates($tickets) |
|
243 | - { |
|
244 | - foreach ($tickets as $ticket) { |
|
245 | - $ticket->set( |
|
246 | - 'TKT_start_date', |
|
247 | - (int) $this->current_time_for_query('TKT_start_date', true) |
|
248 | - ); |
|
249 | - $ticket->set( |
|
250 | - 'TKT_end_date', |
|
251 | - (int) $this->current_time_for_query('TKT_end_date', true) + MONTH_IN_SECONDS |
|
252 | - ); |
|
253 | - $ticket->set_end_time( |
|
254 | - $this->convert_datetime_for_query( |
|
255 | - 'TKT_end_date', |
|
256 | - '11:59 pm', |
|
257 | - 'g:i a', |
|
258 | - $this->_timezone |
|
259 | - ) |
|
260 | - ); |
|
261 | - } |
|
262 | - return $tickets; |
|
263 | - } |
|
235 | + /** |
|
236 | + * sets up relevant start and end date for EE_Ticket (s) |
|
237 | + * |
|
238 | + * @param EE_Ticket[] $tickets |
|
239 | + * @return EE_Ticket[] |
|
240 | + * @throws EE_Error |
|
241 | + */ |
|
242 | + private function _set_default_dates($tickets) |
|
243 | + { |
|
244 | + foreach ($tickets as $ticket) { |
|
245 | + $ticket->set( |
|
246 | + 'TKT_start_date', |
|
247 | + (int) $this->current_time_for_query('TKT_start_date', true) |
|
248 | + ); |
|
249 | + $ticket->set( |
|
250 | + 'TKT_end_date', |
|
251 | + (int) $this->current_time_for_query('TKT_end_date', true) + MONTH_IN_SECONDS |
|
252 | + ); |
|
253 | + $ticket->set_end_time( |
|
254 | + $this->convert_datetime_for_query( |
|
255 | + 'TKT_end_date', |
|
256 | + '11:59 pm', |
|
257 | + 'g:i a', |
|
258 | + $this->_timezone |
|
259 | + ) |
|
260 | + ); |
|
261 | + } |
|
262 | + return $tickets; |
|
263 | + } |
|
264 | 264 | |
265 | 265 | |
266 | - /** |
|
267 | - * Gets the total number of tickets available at a particular datetime (does |
|
268 | - * NOT take int account the datetime's spaces available) |
|
269 | - * |
|
270 | - * @param int $DTT_ID |
|
271 | - * @param array $query_params |
|
272 | - * @return int |
|
273 | - */ |
|
274 | - public function sum_tickets_currently_available_at_datetime($DTT_ID, $query_params = array()) |
|
275 | - { |
|
276 | - return EEM_Datetime::instance()->sum_tickets_currently_available_at_datetime($DTT_ID, $query_params); |
|
277 | - } |
|
266 | + /** |
|
267 | + * Gets the total number of tickets available at a particular datetime (does |
|
268 | + * NOT take int account the datetime's spaces available) |
|
269 | + * |
|
270 | + * @param int $DTT_ID |
|
271 | + * @param array $query_params |
|
272 | + * @return int |
|
273 | + */ |
|
274 | + public function sum_tickets_currently_available_at_datetime($DTT_ID, $query_params = array()) |
|
275 | + { |
|
276 | + return EEM_Datetime::instance()->sum_tickets_currently_available_at_datetime($DTT_ID, $query_params); |
|
277 | + } |
|
278 | 278 | |
279 | 279 | |
280 | - /** |
|
281 | - * Updates the TKT_sold quantity on all the tickets matching $query_params |
|
282 | - * |
|
283 | - * @param EE_Ticket[] $tickets |
|
284 | - * @return void |
|
285 | - * @throws EE_Error |
|
286 | - */ |
|
287 | - public function update_tickets_sold($tickets) |
|
288 | - { |
|
289 | - foreach ($tickets as $ticket) { |
|
290 | - /* @var $ticket EE_Ticket */ |
|
291 | - $ticket->update_tickets_sold(); |
|
292 | - } |
|
293 | - } |
|
280 | + /** |
|
281 | + * Updates the TKT_sold quantity on all the tickets matching $query_params |
|
282 | + * |
|
283 | + * @param EE_Ticket[] $tickets |
|
284 | + * @return void |
|
285 | + * @throws EE_Error |
|
286 | + */ |
|
287 | + public function update_tickets_sold($tickets) |
|
288 | + { |
|
289 | + foreach ($tickets as $ticket) { |
|
290 | + /* @var $ticket EE_Ticket */ |
|
291 | + $ticket->update_tickets_sold(); |
|
292 | + } |
|
293 | + } |
|
294 | 294 | |
295 | 295 | |
296 | - /** |
|
297 | - * returns an array of EE_Ticket objects with a non-zero value for TKT_reserved |
|
298 | - * |
|
299 | - * @return EE_Base_Class[]|EE_Ticket[] |
|
300 | - * @throws EE_Error |
|
301 | - */ |
|
302 | - public function get_tickets_with_reservations() |
|
303 | - { |
|
304 | - return $this->get_all( |
|
305 | - array( |
|
306 | - array( |
|
307 | - 'TKT_reserved' => array('>', 0), |
|
308 | - ), |
|
309 | - ) |
|
310 | - ); |
|
311 | - } |
|
296 | + /** |
|
297 | + * returns an array of EE_Ticket objects with a non-zero value for TKT_reserved |
|
298 | + * |
|
299 | + * @return EE_Base_Class[]|EE_Ticket[] |
|
300 | + * @throws EE_Error |
|
301 | + */ |
|
302 | + public function get_tickets_with_reservations() |
|
303 | + { |
|
304 | + return $this->get_all( |
|
305 | + array( |
|
306 | + array( |
|
307 | + 'TKT_reserved' => array('>', 0), |
|
308 | + ), |
|
309 | + ) |
|
310 | + ); |
|
311 | + } |
|
312 | 312 | |
313 | 313 | |
314 | - /** |
|
315 | - * returns an array of EE_Ticket objects matching the supplied list of IDs |
|
316 | - * |
|
317 | - * @param array $ticket_IDs |
|
318 | - * @return EE_Base_Class[]|EE_Ticket[] |
|
319 | - * @throws EE_Error |
|
320 | - */ |
|
321 | - public function get_tickets_with_IDs(array $ticket_IDs) |
|
322 | - { |
|
323 | - return $this->get_all( |
|
324 | - array( |
|
325 | - array( |
|
326 | - 'TKT_ID' => array('IN', $ticket_IDs), |
|
327 | - ), |
|
328 | - ) |
|
329 | - ); |
|
330 | - } |
|
314 | + /** |
|
315 | + * returns an array of EE_Ticket objects matching the supplied list of IDs |
|
316 | + * |
|
317 | + * @param array $ticket_IDs |
|
318 | + * @return EE_Base_Class[]|EE_Ticket[] |
|
319 | + * @throws EE_Error |
|
320 | + */ |
|
321 | + public function get_tickets_with_IDs(array $ticket_IDs) |
|
322 | + { |
|
323 | + return $this->get_all( |
|
324 | + array( |
|
325 | + array( |
|
326 | + 'TKT_ID' => array('IN', $ticket_IDs), |
|
327 | + ), |
|
328 | + ) |
|
329 | + ); |
|
330 | + } |
|
331 | 331 | } |
@@ -195,20 +195,20 @@ |
||
195 | 195 | ); |
196 | 196 | // this model is generally available for reading |
197 | 197 | $path_to_event = 'Datetime.Event'; |
198 | - $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Default_Public( |
|
198 | + $this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Default_Public( |
|
199 | 199 | 'TKT_is_default', |
200 | 200 | $path_to_event |
201 | 201 | ); |
202 | 202 | // account for default tickets in the caps |
203 | - $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Default_Protected( |
|
203 | + $this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Default_Protected( |
|
204 | 204 | 'TKT_is_default', |
205 | 205 | $path_to_event |
206 | 206 | ); |
207 | - $this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Default_Protected( |
|
207 | + $this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Default_Protected( |
|
208 | 208 | 'TKT_is_default', |
209 | 209 | $path_to_event |
210 | 210 | ); |
211 | - $this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Default_Protected( |
|
211 | + $this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Default_Protected( |
|
212 | 212 | 'TKT_is_default', |
213 | 213 | $path_to_event |
214 | 214 | ); |
@@ -191,7 +191,7 @@ |
||
191 | 191 | 'Term_Taxonomy' => new EE_HABTM_Relation('Term_Relationship'), |
192 | 192 | ); |
193 | 193 | // this model is generally available for reading |
194 | - $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public(); |
|
194 | + $this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public(); |
|
195 | 195 | $this->model_chain_to_password = ''; |
196 | 196 | parent::__construct($timezone); |
197 | 197 | } |
@@ -11,189 +11,189 @@ |
||
11 | 11 | class EEM_Venue extends EEM_CPT_Base |
12 | 12 | { |
13 | 13 | |
14 | - // private instance of the Attendee object |
|
15 | - protected static $_instance = null; |
|
14 | + // private instance of the Attendee object |
|
15 | + protected static $_instance = null; |
|
16 | 16 | |
17 | 17 | |
18 | 18 | |
19 | - protected function __construct($timezone = null) |
|
20 | - { |
|
21 | - $this->singular_item = esc_html__('Venue', 'event_espresso'); |
|
22 | - $this->plural_item = esc_html__('Venues', 'event_espresso'); |
|
23 | - $this->_tables = array( |
|
24 | - 'Venue_CPT' => new EE_Primary_Table('posts', 'ID'), |
|
25 | - 'Venue_Meta' => new EE_Secondary_Table('esp_venue_meta', 'VNUM_ID', 'VNU_ID'), |
|
26 | - ); |
|
27 | - $this->_fields = array( |
|
28 | - 'Venue_CPT' => array( |
|
29 | - 'VNU_ID' => new EE_Primary_Key_Int_Field('ID', esc_html__("Venue ID", "event_espresso")), |
|
30 | - 'VNU_name' => new EE_Plain_Text_Field( |
|
31 | - 'post_title', |
|
32 | - esc_html__("Venue Name", "event_espresso"), |
|
33 | - false, |
|
34 | - '' |
|
35 | - ), |
|
36 | - 'VNU_desc' => new EE_Post_Content_Field( |
|
37 | - 'post_content', |
|
38 | - esc_html__("Venue Description", "event_espresso"), |
|
39 | - false, |
|
40 | - '' |
|
41 | - ), |
|
42 | - 'VNU_identifier' => new EE_Slug_Field('post_name', esc_html__("Venue Identifier", "event_espresso"), false, ''), |
|
43 | - 'VNU_created' => new EE_Datetime_Field( |
|
44 | - 'post_date', |
|
45 | - esc_html__("Date Venue Created", "event_espresso"), |
|
46 | - false, |
|
47 | - EE_Datetime_Field::now |
|
48 | - ), |
|
49 | - 'VNU_short_desc' => new EE_Plain_Text_Field( |
|
50 | - 'post_excerpt', |
|
51 | - esc_html__("Short Description of Venue", "event_espresso"), |
|
52 | - true, |
|
53 | - '' |
|
54 | - ), |
|
55 | - 'VNU_modified' => new EE_Datetime_Field( |
|
56 | - 'post_modified', |
|
57 | - esc_html__("Venue Modified Date", "event_espresso"), |
|
58 | - false, |
|
59 | - EE_Datetime_Field::now |
|
60 | - ), |
|
61 | - 'VNU_wp_user' => new EE_WP_User_Field( |
|
62 | - 'post_author', |
|
63 | - esc_html__("Venue Creator ID", "event_espresso"), |
|
64 | - false |
|
65 | - ), |
|
66 | - 'parent' => new EE_Integer_Field( |
|
67 | - 'post_parent', |
|
68 | - esc_html__("Venue Parent ID", "event_espresso"), |
|
69 | - false, |
|
70 | - 0 |
|
71 | - ), |
|
72 | - 'VNU_order' => new EE_Integer_Field('menu_order', esc_html__("Venue order", "event_espresso"), false, 1), |
|
73 | - 'post_type' => new EE_WP_Post_Type_Field('espresso_venues'), |
|
74 | - 'password' => new EE_Password_Field( |
|
75 | - 'post_password', |
|
76 | - esc_html__('Password', 'event_espresso'), |
|
77 | - false, |
|
78 | - '', |
|
79 | - array( |
|
80 | - 'VNU_desc', |
|
81 | - 'VNU_short_desc', |
|
82 | - 'VNU_address', |
|
83 | - 'VNU_address2', |
|
84 | - 'VNU_city', |
|
85 | - 'STA_ID', |
|
86 | - 'CNT_ISO', |
|
87 | - 'VNU_zip', |
|
88 | - 'VNU_phone', |
|
89 | - 'VNU_capacity', |
|
90 | - 'VNU_url', |
|
91 | - 'VNU_virtual_phone', |
|
92 | - 'VNU_virtual_url', |
|
93 | - 'VNU_google_map_link', |
|
94 | - 'VNU_enable_for_gmap', |
|
95 | - ) |
|
96 | - ) |
|
97 | - ), |
|
98 | - 'Venue_Meta' => array( |
|
99 | - 'VNUM_ID' => new EE_DB_Only_Int_Field( |
|
100 | - 'VNUM_ID', |
|
101 | - esc_html__("ID of Venue Meta Row", "event_espresso"), |
|
102 | - false |
|
103 | - ), |
|
104 | - 'VNU_ID_fk' => new EE_DB_Only_Int_Field( |
|
105 | - 'VNU_ID', |
|
106 | - esc_html__("Foreign Key to Venue Post ", "event_espresso"), |
|
107 | - false |
|
108 | - ), |
|
109 | - 'VNU_address' => new EE_Plain_Text_Field( |
|
110 | - 'VNU_address', |
|
111 | - esc_html__("Venue Address line 1", "event_espresso"), |
|
112 | - true, |
|
113 | - '' |
|
114 | - ), |
|
115 | - 'VNU_address2' => new EE_Plain_Text_Field( |
|
116 | - 'VNU_address2', |
|
117 | - esc_html__("Venue Address line 2", "event_espresso"), |
|
118 | - true, |
|
119 | - '' |
|
120 | - ), |
|
121 | - 'VNU_city' => new EE_Plain_Text_Field( |
|
122 | - 'VNU_city', |
|
123 | - esc_html__("Venue City", "event_espresso"), |
|
124 | - true, |
|
125 | - '' |
|
126 | - ), |
|
127 | - 'STA_ID' => new EE_Foreign_Key_Int_Field( |
|
128 | - 'STA_ID', |
|
129 | - esc_html__("State ID", "event_espresso"), |
|
130 | - true, |
|
131 | - null, |
|
132 | - 'State' |
|
133 | - ), |
|
134 | - 'CNT_ISO' => new EE_Foreign_Key_String_Field( |
|
135 | - 'CNT_ISO', |
|
136 | - esc_html__("Country Code", "event_espresso"), |
|
137 | - true, |
|
138 | - null, |
|
139 | - 'Country' |
|
140 | - ), |
|
141 | - 'VNU_zip' => new EE_Plain_Text_Field( |
|
142 | - 'VNU_zip', |
|
143 | - esc_html__("Venue Zip/Postal Code", "event_espresso"), |
|
144 | - true |
|
145 | - ), |
|
146 | - 'VNU_phone' => new EE_Plain_Text_Field( |
|
147 | - 'VNU_phone', |
|
148 | - esc_html__("Venue Phone", "event_espresso"), |
|
149 | - true |
|
150 | - ), |
|
151 | - 'VNU_capacity' => new EE_Infinite_Integer_Field( |
|
152 | - 'VNU_capacity', |
|
153 | - esc_html__("Venue Capacity", "event_espresso"), |
|
154 | - true, |
|
155 | - EE_INF |
|
156 | - ), |
|
157 | - 'VNU_url' => new EE_Plain_Text_Field( |
|
158 | - 'VNU_url', |
|
159 | - esc_html__('Venue Website', 'event_espresso'), |
|
160 | - true |
|
161 | - ), |
|
162 | - 'VNU_virtual_phone' => new EE_Plain_Text_Field( |
|
163 | - 'VNU_virtual_phone', |
|
164 | - esc_html__('Call in Number', 'event_espresso'), |
|
165 | - true |
|
166 | - ), |
|
167 | - 'VNU_virtual_url' => new EE_Plain_Text_Field( |
|
168 | - 'VNU_virtual_url', |
|
169 | - esc_html__('Virtual URL', 'event_espresso'), |
|
170 | - true |
|
171 | - ), |
|
172 | - 'VNU_google_map_link' => new EE_Plain_Text_Field( |
|
173 | - 'VNU_google_map_link', |
|
174 | - esc_html__('Google Map Link', 'event_espresso'), |
|
175 | - true |
|
176 | - ), |
|
177 | - 'VNU_enable_for_gmap' => new EE_Boolean_Field( |
|
178 | - 'VNU_enable_for_gmap', |
|
179 | - esc_html__('Show Google Map?', 'event_espresso'), |
|
180 | - false, |
|
181 | - false |
|
182 | - ), |
|
183 | - ), |
|
184 | - ); |
|
185 | - $this->_model_relations = array( |
|
186 | - 'Event' => new EE_HABTM_Relation('Event_Venue'), |
|
187 | - 'State' => new EE_Belongs_To_Relation(), |
|
188 | - 'Country' => new EE_Belongs_To_Relation(), |
|
189 | - 'Event_Venue' => new EE_Has_Many_Relation(), |
|
190 | - 'WP_User' => new EE_Belongs_To_Relation(), |
|
191 | - 'Term_Relationship' => new EE_Has_Many_Relation(), |
|
192 | - 'Term_Taxonomy' => new EE_HABTM_Relation('Term_Relationship'), |
|
193 | - ); |
|
194 | - // this model is generally available for reading |
|
195 | - $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public(); |
|
196 | - $this->model_chain_to_password = ''; |
|
197 | - parent::__construct($timezone); |
|
198 | - } |
|
19 | + protected function __construct($timezone = null) |
|
20 | + { |
|
21 | + $this->singular_item = esc_html__('Venue', 'event_espresso'); |
|
22 | + $this->plural_item = esc_html__('Venues', 'event_espresso'); |
|
23 | + $this->_tables = array( |
|
24 | + 'Venue_CPT' => new EE_Primary_Table('posts', 'ID'), |
|
25 | + 'Venue_Meta' => new EE_Secondary_Table('esp_venue_meta', 'VNUM_ID', 'VNU_ID'), |
|
26 | + ); |
|
27 | + $this->_fields = array( |
|
28 | + 'Venue_CPT' => array( |
|
29 | + 'VNU_ID' => new EE_Primary_Key_Int_Field('ID', esc_html__("Venue ID", "event_espresso")), |
|
30 | + 'VNU_name' => new EE_Plain_Text_Field( |
|
31 | + 'post_title', |
|
32 | + esc_html__("Venue Name", "event_espresso"), |
|
33 | + false, |
|
34 | + '' |
|
35 | + ), |
|
36 | + 'VNU_desc' => new EE_Post_Content_Field( |
|
37 | + 'post_content', |
|
38 | + esc_html__("Venue Description", "event_espresso"), |
|
39 | + false, |
|
40 | + '' |
|
41 | + ), |
|
42 | + 'VNU_identifier' => new EE_Slug_Field('post_name', esc_html__("Venue Identifier", "event_espresso"), false, ''), |
|
43 | + 'VNU_created' => new EE_Datetime_Field( |
|
44 | + 'post_date', |
|
45 | + esc_html__("Date Venue Created", "event_espresso"), |
|
46 | + false, |
|
47 | + EE_Datetime_Field::now |
|
48 | + ), |
|
49 | + 'VNU_short_desc' => new EE_Plain_Text_Field( |
|
50 | + 'post_excerpt', |
|
51 | + esc_html__("Short Description of Venue", "event_espresso"), |
|
52 | + true, |
|
53 | + '' |
|
54 | + ), |
|
55 | + 'VNU_modified' => new EE_Datetime_Field( |
|
56 | + 'post_modified', |
|
57 | + esc_html__("Venue Modified Date", "event_espresso"), |
|
58 | + false, |
|
59 | + EE_Datetime_Field::now |
|
60 | + ), |
|
61 | + 'VNU_wp_user' => new EE_WP_User_Field( |
|
62 | + 'post_author', |
|
63 | + esc_html__("Venue Creator ID", "event_espresso"), |
|
64 | + false |
|
65 | + ), |
|
66 | + 'parent' => new EE_Integer_Field( |
|
67 | + 'post_parent', |
|
68 | + esc_html__("Venue Parent ID", "event_espresso"), |
|
69 | + false, |
|
70 | + 0 |
|
71 | + ), |
|
72 | + 'VNU_order' => new EE_Integer_Field('menu_order', esc_html__("Venue order", "event_espresso"), false, 1), |
|
73 | + 'post_type' => new EE_WP_Post_Type_Field('espresso_venues'), |
|
74 | + 'password' => new EE_Password_Field( |
|
75 | + 'post_password', |
|
76 | + esc_html__('Password', 'event_espresso'), |
|
77 | + false, |
|
78 | + '', |
|
79 | + array( |
|
80 | + 'VNU_desc', |
|
81 | + 'VNU_short_desc', |
|
82 | + 'VNU_address', |
|
83 | + 'VNU_address2', |
|
84 | + 'VNU_city', |
|
85 | + 'STA_ID', |
|
86 | + 'CNT_ISO', |
|
87 | + 'VNU_zip', |
|
88 | + 'VNU_phone', |
|
89 | + 'VNU_capacity', |
|
90 | + 'VNU_url', |
|
91 | + 'VNU_virtual_phone', |
|
92 | + 'VNU_virtual_url', |
|
93 | + 'VNU_google_map_link', |
|
94 | + 'VNU_enable_for_gmap', |
|
95 | + ) |
|
96 | + ) |
|
97 | + ), |
|
98 | + 'Venue_Meta' => array( |
|
99 | + 'VNUM_ID' => new EE_DB_Only_Int_Field( |
|
100 | + 'VNUM_ID', |
|
101 | + esc_html__("ID of Venue Meta Row", "event_espresso"), |
|
102 | + false |
|
103 | + ), |
|
104 | + 'VNU_ID_fk' => new EE_DB_Only_Int_Field( |
|
105 | + 'VNU_ID', |
|
106 | + esc_html__("Foreign Key to Venue Post ", "event_espresso"), |
|
107 | + false |
|
108 | + ), |
|
109 | + 'VNU_address' => new EE_Plain_Text_Field( |
|
110 | + 'VNU_address', |
|
111 | + esc_html__("Venue Address line 1", "event_espresso"), |
|
112 | + true, |
|
113 | + '' |
|
114 | + ), |
|
115 | + 'VNU_address2' => new EE_Plain_Text_Field( |
|
116 | + 'VNU_address2', |
|
117 | + esc_html__("Venue Address line 2", "event_espresso"), |
|
118 | + true, |
|
119 | + '' |
|
120 | + ), |
|
121 | + 'VNU_city' => new EE_Plain_Text_Field( |
|
122 | + 'VNU_city', |
|
123 | + esc_html__("Venue City", "event_espresso"), |
|
124 | + true, |
|
125 | + '' |
|
126 | + ), |
|
127 | + 'STA_ID' => new EE_Foreign_Key_Int_Field( |
|
128 | + 'STA_ID', |
|
129 | + esc_html__("State ID", "event_espresso"), |
|
130 | + true, |
|
131 | + null, |
|
132 | + 'State' |
|
133 | + ), |
|
134 | + 'CNT_ISO' => new EE_Foreign_Key_String_Field( |
|
135 | + 'CNT_ISO', |
|
136 | + esc_html__("Country Code", "event_espresso"), |
|
137 | + true, |
|
138 | + null, |
|
139 | + 'Country' |
|
140 | + ), |
|
141 | + 'VNU_zip' => new EE_Plain_Text_Field( |
|
142 | + 'VNU_zip', |
|
143 | + esc_html__("Venue Zip/Postal Code", "event_espresso"), |
|
144 | + true |
|
145 | + ), |
|
146 | + 'VNU_phone' => new EE_Plain_Text_Field( |
|
147 | + 'VNU_phone', |
|
148 | + esc_html__("Venue Phone", "event_espresso"), |
|
149 | + true |
|
150 | + ), |
|
151 | + 'VNU_capacity' => new EE_Infinite_Integer_Field( |
|
152 | + 'VNU_capacity', |
|
153 | + esc_html__("Venue Capacity", "event_espresso"), |
|
154 | + true, |
|
155 | + EE_INF |
|
156 | + ), |
|
157 | + 'VNU_url' => new EE_Plain_Text_Field( |
|
158 | + 'VNU_url', |
|
159 | + esc_html__('Venue Website', 'event_espresso'), |
|
160 | + true |
|
161 | + ), |
|
162 | + 'VNU_virtual_phone' => new EE_Plain_Text_Field( |
|
163 | + 'VNU_virtual_phone', |
|
164 | + esc_html__('Call in Number', 'event_espresso'), |
|
165 | + true |
|
166 | + ), |
|
167 | + 'VNU_virtual_url' => new EE_Plain_Text_Field( |
|
168 | + 'VNU_virtual_url', |
|
169 | + esc_html__('Virtual URL', 'event_espresso'), |
|
170 | + true |
|
171 | + ), |
|
172 | + 'VNU_google_map_link' => new EE_Plain_Text_Field( |
|
173 | + 'VNU_google_map_link', |
|
174 | + esc_html__('Google Map Link', 'event_espresso'), |
|
175 | + true |
|
176 | + ), |
|
177 | + 'VNU_enable_for_gmap' => new EE_Boolean_Field( |
|
178 | + 'VNU_enable_for_gmap', |
|
179 | + esc_html__('Show Google Map?', 'event_espresso'), |
|
180 | + false, |
|
181 | + false |
|
182 | + ), |
|
183 | + ), |
|
184 | + ); |
|
185 | + $this->_model_relations = array( |
|
186 | + 'Event' => new EE_HABTM_Relation('Event_Venue'), |
|
187 | + 'State' => new EE_Belongs_To_Relation(), |
|
188 | + 'Country' => new EE_Belongs_To_Relation(), |
|
189 | + 'Event_Venue' => new EE_Has_Many_Relation(), |
|
190 | + 'WP_User' => new EE_Belongs_To_Relation(), |
|
191 | + 'Term_Relationship' => new EE_Has_Many_Relation(), |
|
192 | + 'Term_Taxonomy' => new EE_HABTM_Relation('Term_Relationship'), |
|
193 | + ); |
|
194 | + // this model is generally available for reading |
|
195 | + $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public(); |
|
196 | + $this->model_chain_to_password = ''; |
|
197 | + parent::__construct($timezone); |
|
198 | + } |
|
199 | 199 | } |
@@ -32,10 +32,10 @@ |
||
32 | 32 | ); |
33 | 33 | // this model is generally available for reading |
34 | 34 | $path_to_event = 'Event'; |
35 | - $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Event_Related_Public($path_to_event); |
|
36 | - $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Event_Related_Protected($path_to_event); |
|
37 | - $this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Event_Related_Protected($path_to_event); |
|
38 | - $this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Event_Related_Protected($path_to_event, EEM_Base::caps_edit); |
|
35 | + $this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Event_Related_Public($path_to_event); |
|
36 | + $this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Event_Related_Protected($path_to_event); |
|
37 | + $this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Event_Related_Protected($path_to_event); |
|
38 | + $this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Event_Related_Protected($path_to_event, EEM_Base::caps_edit); |
|
39 | 39 | $this->model_chain_to_password = $path_to_event; |
40 | 40 | parent::__construct($timezone); |
41 | 41 | } |
@@ -8,36 +8,36 @@ |
||
8 | 8 | */ |
9 | 9 | class EEM_Event_Venue extends EEM_Base |
10 | 10 | { |
11 | - // private instance of the Attendee object |
|
12 | - protected static $_instance = null; |
|
11 | + // private instance of the Attendee object |
|
12 | + protected static $_instance = null; |
|
13 | 13 | |
14 | - protected function __construct($timezone = null) |
|
15 | - { |
|
16 | - $this->singular_item = esc_html__('Event to Question Group Link', 'event_espresso'); |
|
17 | - $this->plural_item = esc_html__('Event to Question Group Links', 'event_espresso'); |
|
18 | - $this->_tables = array( |
|
19 | - 'Event_Venue' => new EE_Primary_Table('esp_event_venue', 'EVV_ID') |
|
20 | - ); |
|
21 | - $this->_fields = array( |
|
22 | - 'Event_Venue' => array( |
|
23 | - 'EVV_ID' => new EE_Primary_Key_Int_Field('EVV_ID', esc_html__('Event to Venue Link ID', 'event_espresso')), |
|
24 | - 'EVT_ID' => new EE_Foreign_Key_Int_Field('EVT_ID', esc_html__('Event ID', 'event_espresso'), false, 0, 'Event'), |
|
25 | - 'VNU_ID' => new EE_Foreign_Key_Int_Field('VNU_ID', esc_html__('Venue ID', 'event_espresso'), false, 0, 'Venue'), |
|
26 | - 'EVV_primary' => new EE_Boolean_Field('EVV_primary', esc_html__("Flag indicating venue is primary one for event", "event_espresso"), false, true) |
|
14 | + protected function __construct($timezone = null) |
|
15 | + { |
|
16 | + $this->singular_item = esc_html__('Event to Question Group Link', 'event_espresso'); |
|
17 | + $this->plural_item = esc_html__('Event to Question Group Links', 'event_espresso'); |
|
18 | + $this->_tables = array( |
|
19 | + 'Event_Venue' => new EE_Primary_Table('esp_event_venue', 'EVV_ID') |
|
20 | + ); |
|
21 | + $this->_fields = array( |
|
22 | + 'Event_Venue' => array( |
|
23 | + 'EVV_ID' => new EE_Primary_Key_Int_Field('EVV_ID', esc_html__('Event to Venue Link ID', 'event_espresso')), |
|
24 | + 'EVT_ID' => new EE_Foreign_Key_Int_Field('EVT_ID', esc_html__('Event ID', 'event_espresso'), false, 0, 'Event'), |
|
25 | + 'VNU_ID' => new EE_Foreign_Key_Int_Field('VNU_ID', esc_html__('Venue ID', 'event_espresso'), false, 0, 'Venue'), |
|
26 | + 'EVV_primary' => new EE_Boolean_Field('EVV_primary', esc_html__("Flag indicating venue is primary one for event", "event_espresso"), false, true) |
|
27 | 27 | |
28 | - ) |
|
29 | - ); |
|
30 | - $this->_model_relations = array( |
|
31 | - 'Event' => new EE_Belongs_To_Relation(), |
|
32 | - 'Venue' => new EE_Belongs_To_Relation() |
|
33 | - ); |
|
34 | - // this model is generally available for reading |
|
35 | - $path_to_event = 'Event'; |
|
36 | - $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Event_Related_Public($path_to_event); |
|
37 | - $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Event_Related_Protected($path_to_event); |
|
38 | - $this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Event_Related_Protected($path_to_event); |
|
39 | - $this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Event_Related_Protected($path_to_event, EEM_Base::caps_edit); |
|
40 | - $this->model_chain_to_password = $path_to_event; |
|
41 | - parent::__construct($timezone); |
|
42 | - } |
|
28 | + ) |
|
29 | + ); |
|
30 | + $this->_model_relations = array( |
|
31 | + 'Event' => new EE_Belongs_To_Relation(), |
|
32 | + 'Venue' => new EE_Belongs_To_Relation() |
|
33 | + ); |
|
34 | + // this model is generally available for reading |
|
35 | + $path_to_event = 'Event'; |
|
36 | + $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Event_Related_Public($path_to_event); |
|
37 | + $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Event_Related_Protected($path_to_event); |
|
38 | + $this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Event_Related_Protected($path_to_event); |
|
39 | + $this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Event_Related_Protected($path_to_event, EEM_Base::caps_edit); |
|
40 | + $this->model_chain_to_password = $path_to_event; |
|
41 | + parent::__construct($timezone); |
|
42 | + } |
|
43 | 43 | } |
@@ -12,45 +12,45 @@ |
||
12 | 12 | */ |
13 | 13 | class EE_Password_Field extends EE_Text_Field_Base |
14 | 14 | { |
15 | - /** |
|
16 | - * @var array |
|
17 | - */ |
|
18 | - protected $protected_fields; |
|
15 | + /** |
|
16 | + * @var array |
|
17 | + */ |
|
18 | + protected $protected_fields; |
|
19 | 19 | |
20 | - /** |
|
21 | - * EE_Password_Field constructor. |
|
22 | - * @param $table_column |
|
23 | - * @param $nicename |
|
24 | - * @param $nullable |
|
25 | - * @param null $default_value |
|
26 | - * @param array $protected_fields |
|
27 | - */ |
|
28 | - public function __construct($table_column, $nicename, $nullable, $default_value = null, $protected_fields = array()) |
|
29 | - { |
|
30 | - $this->protected_fields = $protected_fields; |
|
31 | - parent::__construct($table_column, $nicename, $nullable, $default_value); |
|
32 | - } |
|
20 | + /** |
|
21 | + * EE_Password_Field constructor. |
|
22 | + * @param $table_column |
|
23 | + * @param $nicename |
|
24 | + * @param $nullable |
|
25 | + * @param null $default_value |
|
26 | + * @param array $protected_fields |
|
27 | + */ |
|
28 | + public function __construct($table_column, $nicename, $nullable, $default_value = null, $protected_fields = array()) |
|
29 | + { |
|
30 | + $this->protected_fields = $protected_fields; |
|
31 | + parent::__construct($table_column, $nicename, $nullable, $default_value); |
|
32 | + } |
|
33 | 33 | |
34 | - /** |
|
35 | - * Returns the names of the fields on this model that this password field should protect |
|
36 | - * @since 4.9.74.p |
|
37 | - * @return array |
|
38 | - */ |
|
39 | - public function protectedFields() |
|
40 | - { |
|
41 | - return $this->protected_fields; |
|
42 | - } |
|
34 | + /** |
|
35 | + * Returns the names of the fields on this model that this password field should protect |
|
36 | + * @since 4.9.74.p |
|
37 | + * @return array |
|
38 | + */ |
|
39 | + public function protectedFields() |
|
40 | + { |
|
41 | + return $this->protected_fields; |
|
42 | + } |
|
43 | 43 | |
44 | - /** |
|
45 | - * Returns whether or not the specified field is protected by this model |
|
46 | - * @since 4.9.74.p |
|
47 | - * @param $field_name |
|
48 | - * @return bool |
|
49 | - */ |
|
50 | - public function fieldIsProtected($field_name) |
|
51 | - { |
|
52 | - return in_array($field_name, $this->protectedFields(), true); |
|
53 | - } |
|
44 | + /** |
|
45 | + * Returns whether or not the specified field is protected by this model |
|
46 | + * @since 4.9.74.p |
|
47 | + * @param $field_name |
|
48 | + * @return bool |
|
49 | + */ |
|
50 | + public function fieldIsProtected($field_name) |
|
51 | + { |
|
52 | + return in_array($field_name, $this->protectedFields(), true); |
|
53 | + } |
|
54 | 54 | } |
55 | 55 | // End of file EE_Password_Field.php |
56 | 56 | // Location: ${NAMESPACE}/EE_Password_Field.php |
@@ -13,140 +13,140 @@ |
||
13 | 13 | interface RequestTypeContextCheckerInterface |
14 | 14 | { |
15 | 15 | |
16 | - /** |
|
17 | - * true if the current request involves some form of activation |
|
18 | - * |
|
19 | - * @return bool |
|
20 | - */ |
|
21 | - public function isActivation(); |
|
16 | + /** |
|
17 | + * true if the current request involves some form of activation |
|
18 | + * |
|
19 | + * @return bool |
|
20 | + */ |
|
21 | + public function isActivation(); |
|
22 | 22 | |
23 | 23 | |
24 | - /** |
|
25 | - * @param $is_activation |
|
26 | - * @return bool |
|
27 | - */ |
|
28 | - public function setIsActivation($is_activation); |
|
24 | + /** |
|
25 | + * @param $is_activation |
|
26 | + * @return bool |
|
27 | + */ |
|
28 | + public function setIsActivation($is_activation); |
|
29 | 29 | |
30 | 30 | |
31 | - /** |
|
32 | - * true if the current request is for the admin and is not being made via AJAX |
|
33 | - * |
|
34 | - * @return bool |
|
35 | - */ |
|
36 | - public function isAdmin(); |
|
31 | + /** |
|
32 | + * true if the current request is for the admin and is not being made via AJAX |
|
33 | + * |
|
34 | + * @return bool |
|
35 | + */ |
|
36 | + public function isAdmin(); |
|
37 | 37 | |
38 | 38 | |
39 | - /** |
|
40 | - * true if the current request is for the admin AND is being made via AJAX |
|
41 | - * and the ajax request contains the request parameter "ee_admin_ajax" |
|
42 | - * |
|
43 | - * @return bool |
|
44 | - */ |
|
45 | - public function isAdminAjax(); |
|
39 | + /** |
|
40 | + * true if the current request is for the admin AND is being made via AJAX |
|
41 | + * and the ajax request contains the request parameter "ee_admin_ajax" |
|
42 | + * |
|
43 | + * @return bool |
|
44 | + */ |
|
45 | + public function isAdminAjax(); |
|
46 | 46 | |
47 | 47 | |
48 | - /** |
|
49 | - * true if the current request is being made via AJAX... any AJAX |
|
50 | - * |
|
51 | - * @return bool |
|
52 | - */ |
|
53 | - public function isAjax(); |
|
48 | + /** |
|
49 | + * true if the current request is being made via AJAX... any AJAX |
|
50 | + * |
|
51 | + * @return bool |
|
52 | + */ |
|
53 | + public function isAjax(); |
|
54 | 54 | |
55 | 55 | |
56 | - /** |
|
57 | - * true if the current request is for the EE REST API |
|
58 | - * |
|
59 | - * @return bool |
|
60 | - */ |
|
61 | - public function isApi(); |
|
56 | + /** |
|
57 | + * true if the current request is for the EE REST API |
|
58 | + * |
|
59 | + * @return bool |
|
60 | + */ |
|
61 | + public function isApi(); |
|
62 | 62 | |
63 | 63 | |
64 | - /** |
|
65 | - * true if the current request is from the command line |
|
66 | - * |
|
67 | - * @return bool |
|
68 | - */ |
|
69 | - public function isCli(); |
|
64 | + /** |
|
65 | + * true if the current request is from the command line |
|
66 | + * |
|
67 | + * @return bool |
|
68 | + */ |
|
69 | + public function isCli(); |
|
70 | 70 | |
71 | 71 | |
72 | - /** |
|
73 | - * true if the current request is for a WP_Cron |
|
74 | - * |
|
75 | - * @return bool |
|
76 | - */ |
|
77 | - public function isCron(); |
|
72 | + /** |
|
73 | + * true if the current request is for a WP_Cron |
|
74 | + * |
|
75 | + * @return bool |
|
76 | + */ |
|
77 | + public function isCron(); |
|
78 | 78 | |
79 | 79 | |
80 | - /** |
|
81 | - * true if the current request is for either the EE admin or EE frontend AND is being made via AJAX |
|
82 | - * |
|
83 | - * @return bool |
|
84 | - */ |
|
85 | - public function isEeAjax(); |
|
80 | + /** |
|
81 | + * true if the current request is for either the EE admin or EE frontend AND is being made via AJAX |
|
82 | + * |
|
83 | + * @return bool |
|
84 | + */ |
|
85 | + public function isEeAjax(); |
|
86 | 86 | |
87 | 87 | |
88 | - /** |
|
89 | - * true if the current request is for a feed (ie: RSS) |
|
90 | - * |
|
91 | - * @return bool |
|
92 | - */ |
|
93 | - public function isFeed(); |
|
88 | + /** |
|
89 | + * true if the current request is for a feed (ie: RSS) |
|
90 | + * |
|
91 | + * @return bool |
|
92 | + */ |
|
93 | + public function isFeed(); |
|
94 | 94 | |
95 | 95 | |
96 | - /** |
|
97 | - * true if the current request is for the frontend and is not being made via AJAX |
|
98 | - * |
|
99 | - * @return bool |
|
100 | - */ |
|
101 | - public function isFrontend(); |
|
96 | + /** |
|
97 | + * true if the current request is for the frontend and is not being made via AJAX |
|
98 | + * |
|
99 | + * @return bool |
|
100 | + */ |
|
101 | + public function isFrontend(); |
|
102 | 102 | |
103 | 103 | |
104 | - /** |
|
105 | - * @return bool |
|
106 | - */ |
|
107 | - public function isFrontAjax(); |
|
104 | + /** |
|
105 | + * @return bool |
|
106 | + */ |
|
107 | + public function isFrontAjax(); |
|
108 | 108 | |
109 | 109 | |
110 | - /** |
|
111 | - * @return bool |
|
112 | - */ |
|
113 | - public function isIframe(); |
|
110 | + /** |
|
111 | + * @return bool |
|
112 | + */ |
|
113 | + public function isIframe(); |
|
114 | 114 | |
115 | 115 | |
116 | - /** |
|
117 | - * true if the current request is being made via AJAX but is NOT for EE related logic |
|
118 | - * |
|
119 | - * @return bool |
|
120 | - */ |
|
121 | - public function isOtherAjax(); |
|
116 | + /** |
|
117 | + * true if the current request is being made via AJAX but is NOT for EE related logic |
|
118 | + * |
|
119 | + * @return bool |
|
120 | + */ |
|
121 | + public function isOtherAjax(); |
|
122 | 122 | |
123 | 123 | |
124 | - /** |
|
125 | - * true if the current request is for the WP REST API |
|
126 | - * |
|
127 | - * @return bool |
|
128 | - */ |
|
129 | - public function isWordPressApi(); |
|
124 | + /** |
|
125 | + * true if the current request is for the WP REST API |
|
126 | + * |
|
127 | + * @return bool |
|
128 | + */ |
|
129 | + public function isWordPressApi(); |
|
130 | 130 | |
131 | 131 | |
132 | - /** |
|
133 | - * true if the current request is being made via AJAX for the WP Heartbeat |
|
134 | - * |
|
135 | - * @return bool |
|
136 | - */ |
|
137 | - public function isWordPressHeartbeat(); |
|
132 | + /** |
|
133 | + * true if the current request is being made via AJAX for the WP Heartbeat |
|
134 | + * |
|
135 | + * @return bool |
|
136 | + */ |
|
137 | + public function isWordPressHeartbeat(); |
|
138 | 138 | |
139 | 139 | |
140 | - /** |
|
141 | - * true if the current request is a loopback sent from WP core to test for errors |
|
142 | - * |
|
143 | - * @return bool |
|
144 | - */ |
|
145 | - public function isWordPressScrape(); |
|
140 | + /** |
|
141 | + * true if the current request is a loopback sent from WP core to test for errors |
|
142 | + * |
|
143 | + * @return bool |
|
144 | + */ |
|
145 | + public function isWordPressScrape(); |
|
146 | 146 | |
147 | 147 | |
148 | - /** |
|
149 | - * @return string |
|
150 | - */ |
|
151 | - public function slug(); |
|
148 | + /** |
|
149 | + * @return string |
|
150 | + */ |
|
151 | + public function slug(); |
|
152 | 152 | } |