@@ -37,18 +37,18 @@ discard block |
||
37 | 37 | 'priority' => 'high', |
38 | 38 | 'context' => 'normal', |
39 | 39 | ), |
40 | - );/**/ |
|
40 | + ); /**/ |
|
41 | 41 | |
42 | 42 | $this->_scripts_styles = array( |
43 | 43 | 'registers' => array( |
44 | 44 | 'ee_event_venues' => array( |
45 | 45 | 'type' => 'js', |
46 | - 'url' => EE_VENUES_ASSETS_URL . 'ee-event-venues-admin.js', |
|
46 | + 'url' => EE_VENUES_ASSETS_URL.'ee-event-venues-admin.js', |
|
47 | 47 | 'depends' => array('jquery'), |
48 | 48 | ), |
49 | 49 | 'ee_event_venues_css' => array( |
50 | 50 | 'type' => 'css', |
51 | - 'url' => EE_VENUES_ASSETS_URL . 'ee-event-venues-admin.css', |
|
51 | + 'url' => EE_VENUES_ASSETS_URL.'ee-event-venues-admin.css', |
|
52 | 52 | ), |
53 | 53 | ), |
54 | 54 | 'enqueues' => array( |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | // first remove default venue callback |
75 | 75 | foreach ($callbacks as $key => $callback) { |
76 | 76 | if ($callback[1] == '_default_venue_update') { |
77 | - unset($callbacks[ $key ]); |
|
77 | + unset($callbacks[$key]); |
|
78 | 78 | } |
79 | 79 | } |
80 | 80 | |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | } |
103 | 103 | |
104 | 104 | // cap checks |
105 | - if (! EE_Registry::instance()->CAP->current_user_can('ee_read_others_venues', 'get_venues')) { |
|
105 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_venues', 'get_venues')) { |
|
106 | 106 | $vnu_where['VNU_wp_user'] = get_current_user_id(); |
107 | 107 | } |
108 | 108 | |
@@ -113,14 +113,14 @@ discard block |
||
113 | 113 | $ven_select[0] = __('Select a Venue', 'event_espresso'); |
114 | 114 | // setup venues for selector |
115 | 115 | foreach ($venues as $venue) { |
116 | - $ven_select[ $venue->ID() ] = $venue->name(); |
|
116 | + $ven_select[$venue->ID()] = $venue->name(); |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | // if $ven_select does not have the existing venue attached to event then let's add that because we'll always |
120 | 120 | // show existing attached venues even if it's trashed (or some other restricted status). |
121 | 121 | |
122 | - if ($evt_venue_id && ! isset($ven_select[ $evt_venue_id ])) { |
|
123 | - $ven_select[ $evt_venue_id ] = $evt_venue->name(); |
|
122 | + if ($evt_venue_id && ! isset($ven_select[$evt_venue_id])) { |
|
123 | + $ven_select[$evt_venue_id] = $evt_venue->name(); |
|
124 | 124 | $venues = array_merge($venues, array($evt_venue)); |
125 | 125 | } |
126 | 126 | |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | ); |
185 | 185 | |
186 | 186 | $template_path = empty($venues) ? EE_VENUES_TEMPLATE_PATH . 'event_venues_metabox_content.template.php' |
187 | - : EE_VENUES_TEMPLATE_PATH . 'event_venues_metabox_content_from_manager.template.php'; |
|
187 | + : EE_VENUES_TEMPLATE_PATH.'event_venues_metabox_content_from_manager.template.php'; |
|
188 | 188 | |
189 | 189 | // Allow events venue metabox template args filtering. |
190 | 190 | $template_args = apply_filters( |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | $evt_venue = $evtobj->venues(); |
208 | 208 | $evt_venue = ! empty($evt_venue) ? array_shift($evt_venue) : null; |
209 | 209 | |
210 | - if (! empty($evt_venue) && $evt_venue->ID() != $venue_id) { |
|
210 | + if ( ! empty($evt_venue) && $evt_venue->ID() != $venue_id) { |
|
211 | 211 | $evtobj->_remove_relation_to($evt_venue->ID(), 'Venue'); |
212 | 212 | } |
213 | 213 |
@@ -16,207 +16,207 @@ |
||
16 | 16 | { |
17 | 17 | |
18 | 18 | |
19 | - protected $_event; |
|
20 | - |
|
21 | - |
|
22 | - public function __construct(EE_Admin_Page $admin_page) |
|
23 | - { |
|
24 | - parent::__construct($admin_page); |
|
25 | - } |
|
26 | - |
|
27 | - |
|
28 | - protected function _set_hooks_properties() |
|
29 | - { |
|
30 | - $this->_name = 'venues'; |
|
31 | - |
|
32 | - $this->_metaboxes = array( |
|
33 | - 0 => array( |
|
34 | - 'page_route' => array('edit', 'create_new'), |
|
35 | - 'func' => 'venue_metabox', |
|
36 | - 'label' => __('Venue Details', 'event_espresso'), |
|
37 | - 'priority' => 'high', |
|
38 | - 'context' => 'normal', |
|
39 | - ), |
|
40 | - );/**/ |
|
41 | - |
|
42 | - $this->_scripts_styles = array( |
|
43 | - 'registers' => array( |
|
44 | - 'ee_event_venues' => array( |
|
45 | - 'type' => 'js', |
|
46 | - 'url' => EE_VENUES_ASSETS_URL . 'ee-event-venues-admin.js', |
|
47 | - 'depends' => array('jquery'), |
|
48 | - ), |
|
49 | - 'ee_event_venues_css' => array( |
|
50 | - 'type' => 'css', |
|
51 | - 'url' => EE_VENUES_ASSETS_URL . 'ee-event-venues-admin.css', |
|
52 | - ), |
|
53 | - ), |
|
54 | - 'enqueues' => array( |
|
55 | - 'ee_event_venues' => array('edit', 'create_new'), |
|
56 | - 'ee_event_venues_css' => array('edit', 'create_new'), |
|
57 | - ), |
|
58 | - ); |
|
59 | - |
|
60 | - // hook into the handler for saving venue |
|
61 | - add_filter( |
|
62 | - 'FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', |
|
63 | - array($this, 'modify_callbacks'), |
|
64 | - 10 |
|
65 | - ); |
|
66 | - |
|
67 | - // remove default ee_autosave returns for DECAF venues (not needed for CAF venues cause we have a dropdown selector) |
|
68 | - add_filter('FHEE__Events_Admin_Page__ee_autosave_edit_do_decaf_venue_save', '__return_false'); |
|
69 | - } |
|
70 | - |
|
71 | - |
|
72 | - public function modify_callbacks($callbacks) |
|
73 | - { |
|
74 | - // first remove default venue callback |
|
75 | - foreach ($callbacks as $key => $callback) { |
|
76 | - if ($callback[1] == '_default_venue_update') { |
|
77 | - unset($callbacks[ $key ]); |
|
78 | - } |
|
79 | - } |
|
80 | - |
|
81 | - // now let's add the caf version |
|
82 | - $callbacks[] = array($this, 'caf_venue_update'); |
|
83 | - return $callbacks; |
|
84 | - } |
|
85 | - |
|
86 | - |
|
87 | - public function venue_metabox() |
|
88 | - { |
|
89 | - $evt_obj = $this->_adminpage_obj->get_event_object(); |
|
90 | - $evt_id = $evt_obj->ID(); |
|
91 | - |
|
92 | - // first let's see if we have a venue already |
|
93 | - $evt_venues = ! empty($evt_id) ? $evt_obj->venues() : array(); |
|
94 | - $evt_venue = $evt_venues && is_array($evt_venues) ? reset($evt_venues) : null; |
|
95 | - $evt_venue_id = $evt_venue instanceof EE_Venue ? $evt_venue->ID() : null; |
|
96 | - |
|
97 | - // possibly private venues. |
|
98 | - if (EE_Registry::instance()->CAP->current_user_can('ee_read_private_venues', 'get_venues')) { |
|
99 | - $vnu_where['status'] = array('IN', array('publish', 'private')); |
|
100 | - } else { |
|
101 | - $vnu_where['status'] = 'publish'; |
|
102 | - } |
|
103 | - |
|
104 | - // cap checks |
|
105 | - if (! EE_Registry::instance()->CAP->current_user_can('ee_read_others_venues', 'get_venues')) { |
|
106 | - $vnu_where['VNU_wp_user'] = get_current_user_id(); |
|
107 | - } |
|
108 | - |
|
109 | - $vnumdl = EE_Registry::instance()->load_model('Venue'); |
|
110 | - $venues = $vnumdl->get_all(array($vnu_where, 'order_by' => array('VNU_name' => 'ASC'))); |
|
111 | - |
|
112 | - $ven_select = array(); |
|
113 | - $ven_select[0] = __('Select a Venue', 'event_espresso'); |
|
114 | - // setup venues for selector |
|
115 | - foreach ($venues as $venue) { |
|
116 | - $ven_select[ $venue->ID() ] = $venue->name(); |
|
117 | - } |
|
118 | - |
|
119 | - // if $ven_select does not have the existing venue attached to event then let's add that because we'll always |
|
120 | - // show existing attached venues even if it's trashed (or some other restricted status). |
|
121 | - |
|
122 | - if ($evt_venue_id && ! isset($ven_select[ $evt_venue_id ])) { |
|
123 | - $ven_select[ $evt_venue_id ] = $evt_venue->name(); |
|
124 | - $venues = array_merge($venues, array($evt_venue)); |
|
125 | - } |
|
126 | - |
|
127 | - $template_args['venues'] = $venues; |
|
128 | - $template_args['evt_venue_id'] = $evt_venue_id; |
|
129 | - $venue_selector = new EE_Select_Input( |
|
130 | - $ven_select, |
|
131 | - array( |
|
132 | - 'html_name' => 'venue_id', |
|
133 | - 'html_id' => 'venue_id', |
|
134 | - 'html_class' => 'wide', |
|
135 | - 'default' => $evt_venue_id ? $evt_venue_id : '0' |
|
136 | - ) |
|
137 | - ); |
|
138 | - $template_args['venue_selector'] = $venue_selector->get_html_for_input(); |
|
139 | - $enable_for_gmap = new EE_Yes_No_Input( |
|
140 | - array( |
|
141 | - 'html_name' => 'enable_for_gmap', |
|
142 | - 'html_id' => 'enable_for_gmap', |
|
143 | - 'default' => $evt_venue instanceof EE_Venue ? $evt_venue->enable_for_gmap() : false |
|
144 | - ) |
|
145 | - ); |
|
146 | - $template_args['enable_for_gmap'] = $enable_for_gmap->get_html_for_input(); |
|
147 | - $template_args['new_venue_link'] = EEH_HTML::link( |
|
148 | - EE_Admin_Page::add_query_args_and_nonce( |
|
149 | - array('action' => 'create_new'), |
|
150 | - EE_VENUES_ADMIN_URL |
|
151 | - ), |
|
152 | - esc_html_x('Add new Venue', 'a link to add a new venue', 'event_espresso'), |
|
153 | - esc_html_x('Add new Venue', 'a link to add a new venue', 'event_espresso'), |
|
154 | - 'ev_new_venue_link', |
|
155 | - 'button', |
|
156 | - 'margin-left:10px;', |
|
157 | - 'target="_blank"' |
|
158 | - ); |
|
159 | - |
|
160 | - // Decide on an info text when there are no venues to display. |
|
161 | - $no_venues_info_txt = esc_html_x( |
|
162 | - 'You have not created any venues yet.', |
|
163 | - 'Information text displayed in the venues metabox when there are no venues to display', |
|
164 | - 'event_espresso' |
|
165 | - ); |
|
166 | - if (empty($venues)) { |
|
167 | - $unpublished_where = $vnu_where; |
|
168 | - $unpublished_where['status'] = 'draft'; |
|
169 | - $unpublished_venues = $vnumdl->get_all(array($unpublished_where, 'order_by' => array('VNU_name' => 'ASC'))); |
|
170 | - if (count($unpublished_venues) > 0) { |
|
171 | - $no_venues_info_txt = esc_html_x( |
|
172 | - // @codingStandardsIgnoreStart |
|
173 | - 'Use the link below to publish your venue through the venue editor so it appears here for selection.', |
|
174 | - // @codingStandardsIgnoreEnd |
|
175 | - 'Information text displayed in the venues metabox when there are no venues to display', |
|
176 | - 'event_espresso' |
|
177 | - ); |
|
178 | - } |
|
179 | - } |
|
180 | - $template_args['no_venues_info'] = EEH_HTML::p( |
|
181 | - EEH_HTML::strong($no_venues_info_txt), |
|
182 | - 'no_venues_info', |
|
183 | - 'info' |
|
184 | - ); |
|
185 | - |
|
186 | - $template_path = empty($venues) ? EE_VENUES_TEMPLATE_PATH . 'event_venues_metabox_content.template.php' |
|
187 | - : EE_VENUES_TEMPLATE_PATH . 'event_venues_metabox_content_from_manager.template.php'; |
|
188 | - |
|
189 | - // Allow events venue metabox template args filtering. |
|
190 | - $template_args = apply_filters( |
|
191 | - 'FHEE__espresso_events_Venues_Hooks___venue_metabox__template_args', |
|
192 | - $template_args, |
|
193 | - $template_path |
|
194 | - ); |
|
195 | - |
|
196 | - EEH_Template::display_template($template_path, $template_args); |
|
197 | - } |
|
198 | - |
|
199 | - |
|
200 | - public function caf_venue_update($evtobj, $data) |
|
201 | - { |
|
202 | - EE_Registry::instance()->load_model('Venue'); |
|
203 | - $venue_id = ! empty($data['venue_id']) ? $data['venue_id'] : null; |
|
204 | - |
|
205 | - |
|
206 | - // first let's check if the selected venue matches any existing venue attached to the event |
|
207 | - $evt_venue = $evtobj->venues(); |
|
208 | - $evt_venue = ! empty($evt_venue) ? array_shift($evt_venue) : null; |
|
209 | - |
|
210 | - if (! empty($evt_venue) && $evt_venue->ID() != $venue_id) { |
|
211 | - $evtobj->_remove_relation_to($evt_venue->ID(), 'Venue'); |
|
212 | - } |
|
213 | - |
|
214 | - if (empty($venue_id)) { |
|
215 | - return true; |
|
216 | - } //no venue to attach |
|
217 | - |
|
218 | - // this should take care of adding to revisions as well as main post object |
|
219 | - $success = $evtobj->_add_relation_to($venue_id, 'Venue'); |
|
220 | - return ! empty($success) ? true : false; |
|
221 | - } |
|
19 | + protected $_event; |
|
20 | + |
|
21 | + |
|
22 | + public function __construct(EE_Admin_Page $admin_page) |
|
23 | + { |
|
24 | + parent::__construct($admin_page); |
|
25 | + } |
|
26 | + |
|
27 | + |
|
28 | + protected function _set_hooks_properties() |
|
29 | + { |
|
30 | + $this->_name = 'venues'; |
|
31 | + |
|
32 | + $this->_metaboxes = array( |
|
33 | + 0 => array( |
|
34 | + 'page_route' => array('edit', 'create_new'), |
|
35 | + 'func' => 'venue_metabox', |
|
36 | + 'label' => __('Venue Details', 'event_espresso'), |
|
37 | + 'priority' => 'high', |
|
38 | + 'context' => 'normal', |
|
39 | + ), |
|
40 | + );/**/ |
|
41 | + |
|
42 | + $this->_scripts_styles = array( |
|
43 | + 'registers' => array( |
|
44 | + 'ee_event_venues' => array( |
|
45 | + 'type' => 'js', |
|
46 | + 'url' => EE_VENUES_ASSETS_URL . 'ee-event-venues-admin.js', |
|
47 | + 'depends' => array('jquery'), |
|
48 | + ), |
|
49 | + 'ee_event_venues_css' => array( |
|
50 | + 'type' => 'css', |
|
51 | + 'url' => EE_VENUES_ASSETS_URL . 'ee-event-venues-admin.css', |
|
52 | + ), |
|
53 | + ), |
|
54 | + 'enqueues' => array( |
|
55 | + 'ee_event_venues' => array('edit', 'create_new'), |
|
56 | + 'ee_event_venues_css' => array('edit', 'create_new'), |
|
57 | + ), |
|
58 | + ); |
|
59 | + |
|
60 | + // hook into the handler for saving venue |
|
61 | + add_filter( |
|
62 | + 'FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', |
|
63 | + array($this, 'modify_callbacks'), |
|
64 | + 10 |
|
65 | + ); |
|
66 | + |
|
67 | + // remove default ee_autosave returns for DECAF venues (not needed for CAF venues cause we have a dropdown selector) |
|
68 | + add_filter('FHEE__Events_Admin_Page__ee_autosave_edit_do_decaf_venue_save', '__return_false'); |
|
69 | + } |
|
70 | + |
|
71 | + |
|
72 | + public function modify_callbacks($callbacks) |
|
73 | + { |
|
74 | + // first remove default venue callback |
|
75 | + foreach ($callbacks as $key => $callback) { |
|
76 | + if ($callback[1] == '_default_venue_update') { |
|
77 | + unset($callbacks[ $key ]); |
|
78 | + } |
|
79 | + } |
|
80 | + |
|
81 | + // now let's add the caf version |
|
82 | + $callbacks[] = array($this, 'caf_venue_update'); |
|
83 | + return $callbacks; |
|
84 | + } |
|
85 | + |
|
86 | + |
|
87 | + public function venue_metabox() |
|
88 | + { |
|
89 | + $evt_obj = $this->_adminpage_obj->get_event_object(); |
|
90 | + $evt_id = $evt_obj->ID(); |
|
91 | + |
|
92 | + // first let's see if we have a venue already |
|
93 | + $evt_venues = ! empty($evt_id) ? $evt_obj->venues() : array(); |
|
94 | + $evt_venue = $evt_venues && is_array($evt_venues) ? reset($evt_venues) : null; |
|
95 | + $evt_venue_id = $evt_venue instanceof EE_Venue ? $evt_venue->ID() : null; |
|
96 | + |
|
97 | + // possibly private venues. |
|
98 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_private_venues', 'get_venues')) { |
|
99 | + $vnu_where['status'] = array('IN', array('publish', 'private')); |
|
100 | + } else { |
|
101 | + $vnu_where['status'] = 'publish'; |
|
102 | + } |
|
103 | + |
|
104 | + // cap checks |
|
105 | + if (! EE_Registry::instance()->CAP->current_user_can('ee_read_others_venues', 'get_venues')) { |
|
106 | + $vnu_where['VNU_wp_user'] = get_current_user_id(); |
|
107 | + } |
|
108 | + |
|
109 | + $vnumdl = EE_Registry::instance()->load_model('Venue'); |
|
110 | + $venues = $vnumdl->get_all(array($vnu_where, 'order_by' => array('VNU_name' => 'ASC'))); |
|
111 | + |
|
112 | + $ven_select = array(); |
|
113 | + $ven_select[0] = __('Select a Venue', 'event_espresso'); |
|
114 | + // setup venues for selector |
|
115 | + foreach ($venues as $venue) { |
|
116 | + $ven_select[ $venue->ID() ] = $venue->name(); |
|
117 | + } |
|
118 | + |
|
119 | + // if $ven_select does not have the existing venue attached to event then let's add that because we'll always |
|
120 | + // show existing attached venues even if it's trashed (or some other restricted status). |
|
121 | + |
|
122 | + if ($evt_venue_id && ! isset($ven_select[ $evt_venue_id ])) { |
|
123 | + $ven_select[ $evt_venue_id ] = $evt_venue->name(); |
|
124 | + $venues = array_merge($venues, array($evt_venue)); |
|
125 | + } |
|
126 | + |
|
127 | + $template_args['venues'] = $venues; |
|
128 | + $template_args['evt_venue_id'] = $evt_venue_id; |
|
129 | + $venue_selector = new EE_Select_Input( |
|
130 | + $ven_select, |
|
131 | + array( |
|
132 | + 'html_name' => 'venue_id', |
|
133 | + 'html_id' => 'venue_id', |
|
134 | + 'html_class' => 'wide', |
|
135 | + 'default' => $evt_venue_id ? $evt_venue_id : '0' |
|
136 | + ) |
|
137 | + ); |
|
138 | + $template_args['venue_selector'] = $venue_selector->get_html_for_input(); |
|
139 | + $enable_for_gmap = new EE_Yes_No_Input( |
|
140 | + array( |
|
141 | + 'html_name' => 'enable_for_gmap', |
|
142 | + 'html_id' => 'enable_for_gmap', |
|
143 | + 'default' => $evt_venue instanceof EE_Venue ? $evt_venue->enable_for_gmap() : false |
|
144 | + ) |
|
145 | + ); |
|
146 | + $template_args['enable_for_gmap'] = $enable_for_gmap->get_html_for_input(); |
|
147 | + $template_args['new_venue_link'] = EEH_HTML::link( |
|
148 | + EE_Admin_Page::add_query_args_and_nonce( |
|
149 | + array('action' => 'create_new'), |
|
150 | + EE_VENUES_ADMIN_URL |
|
151 | + ), |
|
152 | + esc_html_x('Add new Venue', 'a link to add a new venue', 'event_espresso'), |
|
153 | + esc_html_x('Add new Venue', 'a link to add a new venue', 'event_espresso'), |
|
154 | + 'ev_new_venue_link', |
|
155 | + 'button', |
|
156 | + 'margin-left:10px;', |
|
157 | + 'target="_blank"' |
|
158 | + ); |
|
159 | + |
|
160 | + // Decide on an info text when there are no venues to display. |
|
161 | + $no_venues_info_txt = esc_html_x( |
|
162 | + 'You have not created any venues yet.', |
|
163 | + 'Information text displayed in the venues metabox when there are no venues to display', |
|
164 | + 'event_espresso' |
|
165 | + ); |
|
166 | + if (empty($venues)) { |
|
167 | + $unpublished_where = $vnu_where; |
|
168 | + $unpublished_where['status'] = 'draft'; |
|
169 | + $unpublished_venues = $vnumdl->get_all(array($unpublished_where, 'order_by' => array('VNU_name' => 'ASC'))); |
|
170 | + if (count($unpublished_venues) > 0) { |
|
171 | + $no_venues_info_txt = esc_html_x( |
|
172 | + // @codingStandardsIgnoreStart |
|
173 | + 'Use the link below to publish your venue through the venue editor so it appears here for selection.', |
|
174 | + // @codingStandardsIgnoreEnd |
|
175 | + 'Information text displayed in the venues metabox when there are no venues to display', |
|
176 | + 'event_espresso' |
|
177 | + ); |
|
178 | + } |
|
179 | + } |
|
180 | + $template_args['no_venues_info'] = EEH_HTML::p( |
|
181 | + EEH_HTML::strong($no_venues_info_txt), |
|
182 | + 'no_venues_info', |
|
183 | + 'info' |
|
184 | + ); |
|
185 | + |
|
186 | + $template_path = empty($venues) ? EE_VENUES_TEMPLATE_PATH . 'event_venues_metabox_content.template.php' |
|
187 | + : EE_VENUES_TEMPLATE_PATH . 'event_venues_metabox_content_from_manager.template.php'; |
|
188 | + |
|
189 | + // Allow events venue metabox template args filtering. |
|
190 | + $template_args = apply_filters( |
|
191 | + 'FHEE__espresso_events_Venues_Hooks___venue_metabox__template_args', |
|
192 | + $template_args, |
|
193 | + $template_path |
|
194 | + ); |
|
195 | + |
|
196 | + EEH_Template::display_template($template_path, $template_args); |
|
197 | + } |
|
198 | + |
|
199 | + |
|
200 | + public function caf_venue_update($evtobj, $data) |
|
201 | + { |
|
202 | + EE_Registry::instance()->load_model('Venue'); |
|
203 | + $venue_id = ! empty($data['venue_id']) ? $data['venue_id'] : null; |
|
204 | + |
|
205 | + |
|
206 | + // first let's check if the selected venue matches any existing venue attached to the event |
|
207 | + $evt_venue = $evtobj->venues(); |
|
208 | + $evt_venue = ! empty($evt_venue) ? array_shift($evt_venue) : null; |
|
209 | + |
|
210 | + if (! empty($evt_venue) && $evt_venue->ID() != $venue_id) { |
|
211 | + $evtobj->_remove_relation_to($evt_venue->ID(), 'Venue'); |
|
212 | + } |
|
213 | + |
|
214 | + if (empty($venue_id)) { |
|
215 | + return true; |
|
216 | + } //no venue to attach |
|
217 | + |
|
218 | + // this should take care of adding to revisions as well as main post object |
|
219 | + $success = $evtobj->_add_relation_to($venue_id, 'Venue'); |
|
220 | + return ! empty($success) ? true : false; |
|
221 | + } |
|
222 | 222 | } |
@@ -5,14 +5,14 @@ discard block |
||
5 | 5 | <?php echo $venue_selector; ?> |
6 | 6 | <?php echo $new_venue_link; ?> |
7 | 7 | <?php foreach ($venues as $venue) : |
8 | - $selected = $evt_venue_id == $venue->ID() ? '' : ' style="display:none;"'; |
|
9 | - $edit_url = EE_Admin_Page::add_query_args_and_nonce( |
|
10 | - array('action' => 'edit', 'post' => $venue->ID()), |
|
11 | - EE_VENUES_ADMIN_URL |
|
12 | - ); |
|
13 | - $state_name = is_object($venue->state_obj()) ? $venue->state_obj()->name() : null; |
|
14 | - $country_name = is_object($venue->country_obj()) ? $venue->country_obj()->name() : null; |
|
15 | - ?> |
|
8 | + $selected = $evt_venue_id == $venue->ID() ? '' : ' style="display:none;"'; |
|
9 | + $edit_url = EE_Admin_Page::add_query_args_and_nonce( |
|
10 | + array('action' => 'edit', 'post' => $venue->ID()), |
|
11 | + EE_VENUES_ADMIN_URL |
|
12 | + ); |
|
13 | + $state_name = is_object($venue->state_obj()) ? $venue->state_obj()->name() : null; |
|
14 | + $country_name = is_object($venue->country_obj()) ? $venue->country_obj()->name() : null; |
|
15 | + ?> |
|
16 | 16 | <fieldset id="eebox_<?php echo $venue->ID(); ?>" class="eebox"<?php echo $selected; ?>> |
17 | 17 | <ul class="address-view"> |
18 | 18 | <li> |
@@ -27,9 +27,9 @@ discard block |
||
27 | 27 | <br/></p> |
28 | 28 | <a href="<?php echo $edit_url; ?>" target="_blank"> |
29 | 29 | <?php _e( |
30 | - 'Edit this Venue', |
|
31 | - 'event_espresso' |
|
32 | - ); ?></a> |
|
30 | + 'Edit this Venue', |
|
31 | + 'event_espresso' |
|
32 | + ); ?></a> |
|
33 | 33 | </li> |
34 | 34 | </ul> |
35 | 35 | </fieldset> |
@@ -5,9 +5,9 @@ |
||
5 | 5 | <?php echo $no_venues_info; ?> |
6 | 6 | <p><a href="admin.php?page=espresso_venues"> |
7 | 7 | <?php echo __( |
8 | - 'Add venues to the Venue Manager', |
|
9 | - 'event_espresso' |
|
10 | - ) ?></a></p> |
|
8 | + 'Add venues to the Venue Manager', |
|
9 | + 'event_espresso' |
|
10 | + ) ?></a></p> |
|
11 | 11 | </fieldset> |
12 | 12 | </td> |
13 | 13 | </tr> |
@@ -38,103 +38,103 @@ |
||
38 | 38 | * @since 4.0 |
39 | 39 | */ |
40 | 40 | if (function_exists('espresso_version')) { |
41 | - if (! function_exists('espresso_duplicate_plugin_error')) { |
|
42 | - /** |
|
43 | - * espresso_duplicate_plugin_error |
|
44 | - * displays if more than one version of EE is activated at the same time |
|
45 | - */ |
|
46 | - function espresso_duplicate_plugin_error() |
|
47 | - { |
|
48 | - ?> |
|
41 | + if (! function_exists('espresso_duplicate_plugin_error')) { |
|
42 | + /** |
|
43 | + * espresso_duplicate_plugin_error |
|
44 | + * displays if more than one version of EE is activated at the same time |
|
45 | + */ |
|
46 | + function espresso_duplicate_plugin_error() |
|
47 | + { |
|
48 | + ?> |
|
49 | 49 | <div class="error"> |
50 | 50 | <p> |
51 | 51 | <?php |
52 | - echo esc_html__( |
|
53 | - 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', |
|
54 | - 'event_espresso' |
|
55 | - ); ?> |
|
52 | + echo esc_html__( |
|
53 | + 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', |
|
54 | + 'event_espresso' |
|
55 | + ); ?> |
|
56 | 56 | </p> |
57 | 57 | </div> |
58 | 58 | <?php |
59 | - espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
60 | - } |
|
61 | - } |
|
62 | - add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
59 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
60 | + } |
|
61 | + } |
|
62 | + add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
63 | 63 | } else { |
64 | - define('EE_MIN_PHP_VER_REQUIRED', '5.4.0'); |
|
65 | - if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
66 | - /** |
|
67 | - * espresso_minimum_php_version_error |
|
68 | - * |
|
69 | - * @return void |
|
70 | - */ |
|
71 | - function espresso_minimum_php_version_error() |
|
72 | - { |
|
73 | - ?> |
|
64 | + define('EE_MIN_PHP_VER_REQUIRED', '5.4.0'); |
|
65 | + if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
66 | + /** |
|
67 | + * espresso_minimum_php_version_error |
|
68 | + * |
|
69 | + * @return void |
|
70 | + */ |
|
71 | + function espresso_minimum_php_version_error() |
|
72 | + { |
|
73 | + ?> |
|
74 | 74 | <div class="error"> |
75 | 75 | <p> |
76 | 76 | <?php |
77 | - printf( |
|
78 | - esc_html__( |
|
79 | - 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', |
|
80 | - 'event_espresso' |
|
81 | - ), |
|
82 | - EE_MIN_PHP_VER_REQUIRED, |
|
83 | - PHP_VERSION, |
|
84 | - '<br/>', |
|
85 | - '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>' |
|
86 | - ); |
|
87 | - ?> |
|
77 | + printf( |
|
78 | + esc_html__( |
|
79 | + 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', |
|
80 | + 'event_espresso' |
|
81 | + ), |
|
82 | + EE_MIN_PHP_VER_REQUIRED, |
|
83 | + PHP_VERSION, |
|
84 | + '<br/>', |
|
85 | + '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>' |
|
86 | + ); |
|
87 | + ?> |
|
88 | 88 | </p> |
89 | 89 | </div> |
90 | 90 | <?php |
91 | - espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
92 | - } |
|
91 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
92 | + } |
|
93 | 93 | |
94 | - add_action('admin_notices', 'espresso_minimum_php_version_error', 1); |
|
95 | - } else { |
|
96 | - define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
97 | - /** |
|
98 | - * espresso_version |
|
99 | - * Returns the plugin version |
|
100 | - * |
|
101 | - * @return string |
|
102 | - */ |
|
103 | - function espresso_version() |
|
104 | - { |
|
105 | - return apply_filters('FHEE__espresso__espresso_version', '4.9.69.rc.010'); |
|
106 | - } |
|
94 | + add_action('admin_notices', 'espresso_minimum_php_version_error', 1); |
|
95 | + } else { |
|
96 | + define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
97 | + /** |
|
98 | + * espresso_version |
|
99 | + * Returns the plugin version |
|
100 | + * |
|
101 | + * @return string |
|
102 | + */ |
|
103 | + function espresso_version() |
|
104 | + { |
|
105 | + return apply_filters('FHEE__espresso__espresso_version', '4.9.69.rc.010'); |
|
106 | + } |
|
107 | 107 | |
108 | - /** |
|
109 | - * espresso_plugin_activation |
|
110 | - * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
|
111 | - */ |
|
112 | - function espresso_plugin_activation() |
|
113 | - { |
|
114 | - update_option('ee_espresso_activation', true); |
|
115 | - } |
|
108 | + /** |
|
109 | + * espresso_plugin_activation |
|
110 | + * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
|
111 | + */ |
|
112 | + function espresso_plugin_activation() |
|
113 | + { |
|
114 | + update_option('ee_espresso_activation', true); |
|
115 | + } |
|
116 | 116 | |
117 | - register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
117 | + register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
118 | 118 | |
119 | - require_once __DIR__ . '/core/bootstrap_espresso.php'; |
|
120 | - bootstrap_espresso(); |
|
121 | - } |
|
119 | + require_once __DIR__ . '/core/bootstrap_espresso.php'; |
|
120 | + bootstrap_espresso(); |
|
121 | + } |
|
122 | 122 | } |
123 | 123 | if (! function_exists('espresso_deactivate_plugin')) { |
124 | - /** |
|
125 | - * deactivate_plugin |
|
126 | - * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
|
127 | - * |
|
128 | - * @access public |
|
129 | - * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
|
130 | - * @return void |
|
131 | - */ |
|
132 | - function espresso_deactivate_plugin($plugin_basename = '') |
|
133 | - { |
|
134 | - if (! function_exists('deactivate_plugins')) { |
|
135 | - require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
136 | - } |
|
137 | - unset($_GET['activate'], $_REQUEST['activate']); |
|
138 | - deactivate_plugins($plugin_basename); |
|
139 | - } |
|
124 | + /** |
|
125 | + * deactivate_plugin |
|
126 | + * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
|
127 | + * |
|
128 | + * @access public |
|
129 | + * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
|
130 | + * @return void |
|
131 | + */ |
|
132 | + function espresso_deactivate_plugin($plugin_basename = '') |
|
133 | + { |
|
134 | + if (! function_exists('deactivate_plugins')) { |
|
135 | + require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
136 | + } |
|
137 | + unset($_GET['activate'], $_REQUEST['activate']); |
|
138 | + deactivate_plugins($plugin_basename); |
|
139 | + } |
|
140 | 140 | } |