@@ -12,52 +12,52 @@ |
||
12 | 12 | */ |
13 | 13 | class Messages_Admin_Page_Init extends EE_Admin_Page_Init |
14 | 14 | { |
15 | - /** |
|
16 | - *constructor |
|
17 | - * |
|
18 | - * @Constructor |
|
19 | - * @access public |
|
20 | - * @return void |
|
21 | - */ |
|
22 | - public function __construct() |
|
23 | - { |
|
15 | + /** |
|
16 | + *constructor |
|
17 | + * |
|
18 | + * @Constructor |
|
19 | + * @access public |
|
20 | + * @return void |
|
21 | + */ |
|
22 | + public function __construct() |
|
23 | + { |
|
24 | 24 | |
25 | - do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
25 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
26 | 26 | |
27 | - if (! defined('EE_MSG_PG_SLUG')) { |
|
28 | - define('EE_MSG_PG_SLUG', 'espresso_messages'); |
|
29 | - define('EE_MSG_PG_NAME', ucwords(str_replace('_', '', EE_MSG_PG_SLUG))); |
|
30 | - define('EE_MSG_ADMIN', EE_ADMIN_PAGES . 'messages' . DS); |
|
31 | - define('EE_MSG_ADMIN_URL', admin_url('admin.php?page=' . EE_MSG_PG_SLUG)); |
|
32 | - define('EE_MSG_ASSETS_PATH', EE_MSG_ADMIN . 'assets' . DS); |
|
33 | - define('EE_MSG_ASSETS_URL', EE_ADMIN_PAGES_URL . 'messages/assets/'); |
|
34 | - define('EE_MSG_TEMPLATE_PATH', EE_MSG_ADMIN . 'templates' . DS); |
|
35 | - define('EE_MSG_TEMPLATE_URL', EE_ADMIN_PAGES_URL . 'messages/templates/'); |
|
36 | - } |
|
27 | + if (! defined('EE_MSG_PG_SLUG')) { |
|
28 | + define('EE_MSG_PG_SLUG', 'espresso_messages'); |
|
29 | + define('EE_MSG_PG_NAME', ucwords(str_replace('_', '', EE_MSG_PG_SLUG))); |
|
30 | + define('EE_MSG_ADMIN', EE_ADMIN_PAGES . 'messages' . DS); |
|
31 | + define('EE_MSG_ADMIN_URL', admin_url('admin.php?page=' . EE_MSG_PG_SLUG)); |
|
32 | + define('EE_MSG_ASSETS_PATH', EE_MSG_ADMIN . 'assets' . DS); |
|
33 | + define('EE_MSG_ASSETS_URL', EE_ADMIN_PAGES_URL . 'messages/assets/'); |
|
34 | + define('EE_MSG_TEMPLATE_PATH', EE_MSG_ADMIN . 'templates' . DS); |
|
35 | + define('EE_MSG_TEMPLATE_URL', EE_ADMIN_PAGES_URL . 'messages/templates/'); |
|
36 | + } |
|
37 | 37 | |
38 | - parent::__construct(); |
|
39 | - } |
|
38 | + parent::__construct(); |
|
39 | + } |
|
40 | 40 | |
41 | 41 | |
42 | - protected function _set_init_properties() |
|
43 | - { |
|
44 | - $this->label = __('Messages System', 'event_espresso'); |
|
45 | - } |
|
42 | + protected function _set_init_properties() |
|
43 | + { |
|
44 | + $this->label = __('Messages System', 'event_espresso'); |
|
45 | + } |
|
46 | 46 | |
47 | 47 | |
48 | - protected function _set_menu_map() |
|
49 | - { |
|
50 | - $this->_menu_map = new EE_Admin_Page_Sub_Menu( |
|
51 | - array( |
|
52 | - 'menu_group' => 'management', |
|
53 | - 'menu_order' => 10, |
|
54 | - 'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY, |
|
55 | - 'parent_slug' => 'espresso_events', |
|
56 | - 'menu_slug' => EE_MSG_PG_SLUG, |
|
57 | - 'menu_label' => __('Messages', 'event_espresso'), |
|
58 | - 'capability' => 'ee_read_global_messages', |
|
59 | - 'admin_init_page' => $this, |
|
60 | - ) |
|
61 | - ); |
|
62 | - } |
|
48 | + protected function _set_menu_map() |
|
49 | + { |
|
50 | + $this->_menu_map = new EE_Admin_Page_Sub_Menu( |
|
51 | + array( |
|
52 | + 'menu_group' => 'management', |
|
53 | + 'menu_order' => 10, |
|
54 | + 'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY, |
|
55 | + 'parent_slug' => 'espresso_events', |
|
56 | + 'menu_slug' => EE_MSG_PG_SLUG, |
|
57 | + 'menu_label' => __('Messages', 'event_espresso'), |
|
58 | + 'capability' => 'ee_read_global_messages', |
|
59 | + 'admin_init_page' => $this, |
|
60 | + ) |
|
61 | + ); |
|
62 | + } |
|
63 | 63 | } |
@@ -24,15 +24,15 @@ |
||
24 | 24 | |
25 | 25 | do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
26 | 26 | |
27 | - if (! defined('EE_MSG_PG_SLUG')) { |
|
27 | + if ( ! defined('EE_MSG_PG_SLUG')) { |
|
28 | 28 | define('EE_MSG_PG_SLUG', 'espresso_messages'); |
29 | 29 | define('EE_MSG_PG_NAME', ucwords(str_replace('_', '', EE_MSG_PG_SLUG))); |
30 | - define('EE_MSG_ADMIN', EE_ADMIN_PAGES . 'messages' . DS); |
|
31 | - define('EE_MSG_ADMIN_URL', admin_url('admin.php?page=' . EE_MSG_PG_SLUG)); |
|
32 | - define('EE_MSG_ASSETS_PATH', EE_MSG_ADMIN . 'assets' . DS); |
|
33 | - define('EE_MSG_ASSETS_URL', EE_ADMIN_PAGES_URL . 'messages/assets/'); |
|
34 | - define('EE_MSG_TEMPLATE_PATH', EE_MSG_ADMIN . 'templates' . DS); |
|
35 | - define('EE_MSG_TEMPLATE_URL', EE_ADMIN_PAGES_URL . 'messages/templates/'); |
|
30 | + define('EE_MSG_ADMIN', EE_ADMIN_PAGES.'messages'.DS); |
|
31 | + define('EE_MSG_ADMIN_URL', admin_url('admin.php?page='.EE_MSG_PG_SLUG)); |
|
32 | + define('EE_MSG_ASSETS_PATH', EE_MSG_ADMIN.'assets'.DS); |
|
33 | + define('EE_MSG_ASSETS_URL', EE_ADMIN_PAGES_URL.'messages/assets/'); |
|
34 | + define('EE_MSG_TEMPLATE_PATH', EE_MSG_ADMIN.'templates'.DS); |
|
35 | + define('EE_MSG_TEMPLATE_URL', EE_ADMIN_PAGES_URL.'messages/templates/'); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | parent::__construct(); |
@@ -12,9 +12,9 @@ |
||
12 | 12 | <?php _e('This option will save all Event Espresso registration form data, and debugging information to a file in the /wp-content/uploads/espresso/logs directory on your server. This will occur each time a page is accessed on your site until this option is turned off.', 'event_espresso'); ?> |
13 | 13 | <br/> |
14 | 14 | <?php printf( |
15 | - __('Note that if you are accessing your filesystem over FTP or SSH, and logging writes to the filesystem on every request, you should put your credentials in your wp-config.php file, as described %1$shere.%2$s', 'event_espresso'), |
|
16 | - '<a href="https://codex.wordpress.org/Editing_wp-config.php#WordPress_Upgrade_Constants" target="_blank">', |
|
17 | - '</a>' |
|
15 | + __('Note that if you are accessing your filesystem over FTP or SSH, and logging writes to the filesystem on every request, you should put your credentials in your wp-config.php file, as described %1$shere.%2$s', 'event_espresso'), |
|
16 | + '<a href="https://codex.wordpress.org/Editing_wp-config.php#WordPress_Upgrade_Constants" target="_blank">', |
|
17 | + '</a>' |
|
18 | 18 | ); ?> |
19 | 19 | </li> |
20 | 20 | <li> |
@@ -18,37 +18,37 @@ |
||
18 | 18 | class General_Settings_Admin_Page_Init extends EE_Admin_Page_Init |
19 | 19 | { |
20 | 20 | |
21 | - public function __construct() |
|
22 | - { |
|
23 | - // define some constants |
|
24 | - define('GEN_SET_PG_SLUG', 'espresso_general_settings'); |
|
25 | - define('GEN_SET_LABEL', __('General Settings', 'event_espresso')); |
|
26 | - define('GEN_SET_ADMIN', EE_ADMIN_PAGES . 'general_settings' . DS); |
|
27 | - define('GEN_SET_ADMIN_URL', admin_url('admin.php?page=' . GEN_SET_PG_SLUG)); |
|
28 | - define('GEN_SET_TEMPLATE_PATH', GEN_SET_ADMIN . 'templates' . DS); |
|
29 | - define('GEN_SET_ASSETS_URL', EE_ADMIN_PAGES_URL . 'general_settings/assets/'); |
|
21 | + public function __construct() |
|
22 | + { |
|
23 | + // define some constants |
|
24 | + define('GEN_SET_PG_SLUG', 'espresso_general_settings'); |
|
25 | + define('GEN_SET_LABEL', __('General Settings', 'event_espresso')); |
|
26 | + define('GEN_SET_ADMIN', EE_ADMIN_PAGES . 'general_settings' . DS); |
|
27 | + define('GEN_SET_ADMIN_URL', admin_url('admin.php?page=' . GEN_SET_PG_SLUG)); |
|
28 | + define('GEN_SET_TEMPLATE_PATH', GEN_SET_ADMIN . 'templates' . DS); |
|
29 | + define('GEN_SET_ASSETS_URL', EE_ADMIN_PAGES_URL . 'general_settings/assets/'); |
|
30 | 30 | |
31 | - parent::__construct(); |
|
32 | - } |
|
31 | + parent::__construct(); |
|
32 | + } |
|
33 | 33 | |
34 | - protected function _set_init_properties() |
|
35 | - { |
|
36 | - $this->label = GEN_SET_LABEL; |
|
37 | - } |
|
34 | + protected function _set_init_properties() |
|
35 | + { |
|
36 | + $this->label = GEN_SET_LABEL; |
|
37 | + } |
|
38 | 38 | |
39 | - protected function _set_menu_map() |
|
40 | - { |
|
41 | - $this->_menu_map = new EE_Admin_Page_Sub_Menu( |
|
42 | - array( |
|
43 | - 'menu_group' => 'settings', |
|
44 | - 'menu_order' => 20, |
|
45 | - 'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY, |
|
46 | - 'parent_slug' => 'espresso_events', |
|
47 | - 'menu_slug' => GEN_SET_PG_SLUG, |
|
48 | - 'menu_label' => GEN_SET_LABEL, |
|
49 | - 'capability' => 'manage_options', |
|
50 | - 'admin_init_page' => $this, |
|
51 | - ) |
|
52 | - ); |
|
53 | - } |
|
39 | + protected function _set_menu_map() |
|
40 | + { |
|
41 | + $this->_menu_map = new EE_Admin_Page_Sub_Menu( |
|
42 | + array( |
|
43 | + 'menu_group' => 'settings', |
|
44 | + 'menu_order' => 20, |
|
45 | + 'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY, |
|
46 | + 'parent_slug' => 'espresso_events', |
|
47 | + 'menu_slug' => GEN_SET_PG_SLUG, |
|
48 | + 'menu_label' => GEN_SET_LABEL, |
|
49 | + 'capability' => 'manage_options', |
|
50 | + 'admin_init_page' => $this, |
|
51 | + ) |
|
52 | + ); |
|
53 | + } |
|
54 | 54 | } |
@@ -23,10 +23,10 @@ |
||
23 | 23 | // define some constants |
24 | 24 | define('GEN_SET_PG_SLUG', 'espresso_general_settings'); |
25 | 25 | define('GEN_SET_LABEL', __('General Settings', 'event_espresso')); |
26 | - define('GEN_SET_ADMIN', EE_ADMIN_PAGES . 'general_settings' . DS); |
|
27 | - define('GEN_SET_ADMIN_URL', admin_url('admin.php?page=' . GEN_SET_PG_SLUG)); |
|
28 | - define('GEN_SET_TEMPLATE_PATH', GEN_SET_ADMIN . 'templates' . DS); |
|
29 | - define('GEN_SET_ASSETS_URL', EE_ADMIN_PAGES_URL . 'general_settings/assets/'); |
|
26 | + define('GEN_SET_ADMIN', EE_ADMIN_PAGES.'general_settings'.DS); |
|
27 | + define('GEN_SET_ADMIN_URL', admin_url('admin.php?page='.GEN_SET_PG_SLUG)); |
|
28 | + define('GEN_SET_TEMPLATE_PATH', GEN_SET_ADMIN.'templates'.DS); |
|
29 | + define('GEN_SET_ASSETS_URL', EE_ADMIN_PAGES_URL.'general_settings/assets/'); |
|
30 | 30 | |
31 | 31 | parent::__construct(); |
32 | 32 | } |
@@ -5,15 +5,15 @@ discard block |
||
5 | 5 | </h2> |
6 | 6 | <p class="ee-attention"> |
7 | 7 | <?php |
8 | - echo sprintf( |
|
9 | - __( |
|
10 | - 'The following shortcodes and page settings are required for Event Espresso to function properly. These shortcodes should not be replaced with any other shortcodes. Please view %sthis page%s for a list of optional shortcodes you can use on other pages.', |
|
11 | - 'event_espresso' |
|
12 | - ), |
|
13 | - '<a href="admin.php?page=espresso_support">', |
|
14 | - '</a>' |
|
15 | - ); |
|
16 | - ?> |
|
8 | + echo sprintf( |
|
9 | + __( |
|
10 | + 'The following shortcodes and page settings are required for Event Espresso to function properly. These shortcodes should not be replaced with any other shortcodes. Please view %sthis page%s for a list of optional shortcodes you can use on other pages.', |
|
11 | + 'event_espresso' |
|
12 | + ), |
|
13 | + '<a href="admin.php?page=espresso_support">', |
|
14 | + '</a>' |
|
15 | + ); |
|
16 | + ?> |
|
17 | 17 | </p> |
18 | 18 | |
19 | 19 | <table class="form-table"> |
@@ -39,21 +39,21 @@ discard block |
||
39 | 39 | </select> |
40 | 40 | <span> |
41 | 41 | <?php echo General_Settings_Admin_Page::page_and_shortcode_status( |
42 | - $reg_page_obj, |
|
43 | - '[ESPRESSO_CHECKOUT]' |
|
44 | - ); ?> |
|
42 | + $reg_page_obj, |
|
43 | + '[ESPRESSO_CHECKOUT]' |
|
44 | + ); ?> |
|
45 | 45 | </span> |
46 | 46 | <br/> |
47 | 47 | <p class="description"> |
48 | 48 | <?php |
49 | - echo sprintf( |
|
50 | - __( |
|
51 | - 'This page can be hidden from navigation if desired, but should always contain the %s shortcode.', |
|
52 | - 'event_espresso' |
|
53 | - ), |
|
54 | - '<span class="highlight" style="padding:3px;margin:0;">[ESPRESSO_CHECKOUT]</span>' |
|
55 | - ); |
|
56 | - ?> |
|
49 | + echo sprintf( |
|
50 | + __( |
|
51 | + 'This page can be hidden from navigation if desired, but should always contain the %s shortcode.', |
|
52 | + 'event_espresso' |
|
53 | + ), |
|
54 | + '<span class="highlight" style="padding:3px;margin:0;">[ESPRESSO_CHECKOUT]</span>' |
|
55 | + ); |
|
56 | + ?> |
|
57 | 57 | </p> |
58 | 58 | <br/><br/> |
59 | 59 | </td> |
@@ -69,9 +69,9 @@ discard block |
||
69 | 69 | <br/> |
70 | 70 | <span class="lt-grey-text"> |
71 | 71 | <?php _e( |
72 | - 'Notify URL (processes payments)', |
|
73 | - 'event_espresso' |
|
74 | - ); ?></span><br/> |
|
72 | + 'Notify URL (processes payments)', |
|
73 | + 'event_espresso' |
|
74 | + ); ?></span><br/> |
|
75 | 75 | <?php echo General_Settings_Admin_Page::edit_view_links($txn_page_id); ?> |
76 | 76 | </label> |
77 | 77 | </th> |
@@ -84,21 +84,21 @@ discard block |
||
84 | 84 | </select> |
85 | 85 | <span> |
86 | 86 | <?php echo General_Settings_Admin_Page::page_and_shortcode_status( |
87 | - $txn_page_obj, |
|
88 | - '[ESPRESSO_TXN_PAGE]' |
|
89 | - ); ?> |
|
87 | + $txn_page_obj, |
|
88 | + '[ESPRESSO_TXN_PAGE]' |
|
89 | + ); ?> |
|
90 | 90 | </span> |
91 | 91 | <br/> |
92 | 92 | <p class="description"> |
93 | 93 | <?php |
94 | - echo sprintf( |
|
95 | - __( |
|
96 | - 'This page should be hidden from your navigation, but still viewable to the public (not password protected), and should always contain the %s shortcode.', |
|
97 | - 'event_espresso' |
|
98 | - ), |
|
99 | - '<span class="highlight" style="padding:3px;margin:0;">[ESPRESSO_TXN_PAGE]</span>' |
|
100 | - ); |
|
101 | - ?> |
|
94 | + echo sprintf( |
|
95 | + __( |
|
96 | + 'This page should be hidden from your navigation, but still viewable to the public (not password protected), and should always contain the %s shortcode.', |
|
97 | + 'event_espresso' |
|
98 | + ), |
|
99 | + '<span class="highlight" style="padding:3px;margin:0;">[ESPRESSO_TXN_PAGE]</span>' |
|
100 | + ); |
|
101 | + ?> |
|
102 | 102 | </p> |
103 | 103 | <br/><br/> |
104 | 104 | </td> |
@@ -124,21 +124,21 @@ discard block |
||
124 | 124 | </select> |
125 | 125 | <span> |
126 | 126 | <?php echo General_Settings_Admin_Page::page_and_shortcode_status( |
127 | - $thank_you_page_obj, |
|
128 | - '[ESPRESSO_THANK_YOU]' |
|
129 | - ); ?> |
|
127 | + $thank_you_page_obj, |
|
128 | + '[ESPRESSO_THANK_YOU]' |
|
129 | + ); ?> |
|
130 | 130 | </span> |
131 | 131 | <br/> |
132 | 132 | <p class="description"> |
133 | 133 | <?php |
134 | - echo sprintf( |
|
135 | - __( |
|
136 | - 'This page should be hidden from your navigation, but still viewable to the public (not password protected), and should always contain the %s shortcode.', |
|
137 | - 'event_espresso' |
|
138 | - ), |
|
139 | - '<span class="highlight" style="padding:3px;margin:0;">[ESPRESSO_THANK_YOU]</span>' |
|
140 | - ); |
|
141 | - ?> |
|
134 | + echo sprintf( |
|
135 | + __( |
|
136 | + 'This page should be hidden from your navigation, but still viewable to the public (not password protected), and should always contain the %s shortcode.', |
|
137 | + 'event_espresso' |
|
138 | + ), |
|
139 | + '<span class="highlight" style="padding:3px;margin:0;">[ESPRESSO_THANK_YOU]</span>' |
|
140 | + ); |
|
141 | + ?> |
|
142 | 142 | </p> |
143 | 143 | <br/><br/> |
144 | 144 | </td> |
@@ -164,21 +164,21 @@ discard block |
||
164 | 164 | </select> |
165 | 165 | <span> |
166 | 166 | <?php echo General_Settings_Admin_Page::page_and_shortcode_status( |
167 | - $cancel_page_obj, |
|
168 | - '[ESPRESSO_CANCELLED]' |
|
169 | - ); ?> |
|
167 | + $cancel_page_obj, |
|
168 | + '[ESPRESSO_CANCELLED]' |
|
169 | + ); ?> |
|
170 | 170 | </span> |
171 | 171 | <br/> |
172 | 172 | <p class="description"> |
173 | 173 | <?php |
174 | - echo sprintf( |
|
175 | - __( |
|
176 | - 'This page should be hidden from your navigation, but still viewable to the public (not password protected), and should always contain a "cancelled transaction" message and the %s shortcode.', |
|
177 | - 'event_espresso' |
|
178 | - ), |
|
179 | - '<span class="highlight" style="padding:3px;margin:0;">[ESPRESSO_CANCELLED]</span>' |
|
180 | - ); |
|
181 | - ?> |
|
174 | + echo sprintf( |
|
175 | + __( |
|
176 | + 'This page should be hidden from your navigation, but still viewable to the public (not password protected), and should always contain a "cancelled transaction" message and the %s shortcode.', |
|
177 | + 'event_espresso' |
|
178 | + ), |
|
179 | + '<span class="highlight" style="padding:3px;margin:0;">[ESPRESSO_CANCELLED]</span>' |
|
180 | + ); |
|
181 | + ?> |
|
182 | 182 | </p> |
183 | 183 | <br/><br/> |
184 | 184 | </td> |
@@ -194,27 +194,27 @@ discard block |
||
194 | 194 | <br/> |
195 | 195 | <a href='<?php echo get_post_type_archive_link('espresso_events') ?>'> |
196 | 196 | <?php _e( |
197 | - 'View', |
|
198 | - 'event_espresso' |
|
199 | - ); ?></a> |
|
197 | + 'View', |
|
198 | + 'event_espresso' |
|
199 | + ); ?></a> |
|
200 | 200 | </label> |
201 | 201 | </th> |
202 | 202 | <td> |
203 | 203 | <p class="description"> |
204 | 204 | <?php echo __( |
205 | - 'Events are custom post types and use WordPress\' normal archive pages for displaying events.', |
|
206 | - 'event_espresso' |
|
207 | - ) ?> |
|
205 | + 'Events are custom post types and use WordPress\' normal archive pages for displaying events.', |
|
206 | + 'event_espresso' |
|
207 | + ) ?> |
|
208 | 208 | </p> |
209 | 209 | <p class="description"> |
210 | 210 | <?php printf( |
211 | - __( |
|
212 | - 'If you would still like your events on a page like in Event Espresso 3.1 or earlier, simply create a page and place a shortcode to display them on the page, as described %s here %s', |
|
213 | - 'event_espresso' |
|
214 | - ), |
|
215 | - '<a href="admin.php?page=espresso_support">', |
|
216 | - '</a>' |
|
217 | - ) ?> |
|
211 | + __( |
|
212 | + 'If you would still like your events on a page like in Event Espresso 3.1 or earlier, simply create a page and place a shortcode to display them on the page, as described %s here %s', |
|
213 | + 'event_espresso' |
|
214 | + ), |
|
215 | + '<a href="admin.php?page=espresso_support">', |
|
216 | + '</a>' |
|
217 | + ) ?> |
|
218 | 218 | </p> |
219 | 219 | <br/><br/> |
220 | 220 | </td> |
@@ -230,27 +230,27 @@ discard block |
||
230 | 230 | <br/> |
231 | 231 | <a href='<?php echo get_post_type_archive_link('espresso_venues') ?>'> |
232 | 232 | <?php _e( |
233 | - 'View', |
|
234 | - 'event_espresso' |
|
235 | - ); ?></a> |
|
233 | + 'View', |
|
234 | + 'event_espresso' |
|
235 | + ); ?></a> |
|
236 | 236 | </label> |
237 | 237 | </th> |
238 | 238 | <td> |
239 | 239 | <p class="description"> |
240 | 240 | <?php echo __( |
241 | - 'Venues are custom post types and use WordPress\' normal archive pages for displaying events.', |
|
242 | - 'event_espresso' |
|
243 | - ) ?> |
|
241 | + 'Venues are custom post types and use WordPress\' normal archive pages for displaying events.', |
|
242 | + 'event_espresso' |
|
243 | + ) ?> |
|
244 | 244 | </p> |
245 | 245 | <p class="description"> |
246 | 246 | <?php printf( |
247 | - __( |
|
248 | - 'If you would still like your venues on a page like in Event Espresso 3.1 or earlier, simply create a page and place a shortcode to display them on the page, as described %s here %s', |
|
249 | - 'event_espresso' |
|
250 | - ), |
|
251 | - '<a href="admin.php?page=espresso_support">', |
|
252 | - '</a>' |
|
253 | - ) ?> |
|
247 | + __( |
|
248 | + 'If you would still like your venues on a page like in Event Espresso 3.1 or earlier, simply create a page and place a shortcode to display them on the page, as described %s here %s', |
|
249 | + 'event_espresso' |
|
250 | + ), |
|
251 | + '<a href="admin.php?page=espresso_support">', |
|
252 | + '</a>' |
|
253 | + ) ?> |
|
254 | 254 | </p> |
255 | 255 | </td> |
256 | 256 | </tr> |
@@ -5,24 +5,24 @@ discard block |
||
5 | 5 | <th><?php _e('Name', 'event_espresso'); ?></th> |
6 | 6 | <th colspan="2"><span class="small-text"> |
7 | 7 | <?php _e( |
8 | - 'State Appears in<br/>Dropdown Select Lists ', |
|
9 | - 'event_espresso' |
|
10 | - ); ?></span></th> |
|
8 | + 'State Appears in<br/>Dropdown Select Lists ', |
|
9 | + 'event_espresso' |
|
10 | + ); ?></span></th> |
|
11 | 11 | </tr> |
12 | 12 | </thead> |
13 | 13 | <tbody> |
14 | 14 | <?php |
15 | - if ($states) { |
|
16 | - foreach ($states as $STA_ID => $state) { |
|
17 | - ?> |
|
15 | + if ($states) { |
|
16 | + foreach ($states as $STA_ID => $state) { |
|
17 | + ?> |
|
18 | 18 | <tr id="state-<?php echo $STA_ID; ?>-tr" class="country-state-columns"> |
19 | 19 | <?php |
20 | - foreach ($state['inputs'] as $ID => $input) { |
|
21 | - if ($ID != 'STA_ID' && $ID != 'CNT_ISO') { |
|
22 | - echo EEH_Form_Fields::generate_form_input($input); |
|
23 | - } |
|
24 | - } |
|
25 | - ?> |
|
20 | + foreach ($state['inputs'] as $ID => $input) { |
|
21 | + if ($ID != 'STA_ID' && $ID != 'CNT_ISO') { |
|
22 | + echo EEH_Form_Fields::generate_form_input($input); |
|
23 | + } |
|
24 | + } |
|
25 | + ?> |
|
26 | 26 | <td class="delete-state-td"> |
27 | 27 | <a id="delete-state-<?php echo $STA_ID; ?>-lnk" |
28 | 28 | class="dashicons dashicons-post-trash ee-icon-size-20 delete-state-lnk" rel="<?php echo $STA_ID; ?>" |
@@ -31,8 +31,8 @@ discard block |
||
31 | 31 | </td> |
32 | 32 | </tr> |
33 | 33 | <?php |
34 | - } |
|
35 | - ?> |
|
34 | + } |
|
35 | + ?> |
|
36 | 36 | </tbody> |
37 | 37 | </table> |
38 | 38 | <br/> |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | value="<?php _e('Save States/Provinces', 'event_espresso'); ?>"/><br/> |
41 | 41 | |
42 | 42 | <?php |
43 | - } |
|
43 | + } |
|
44 | 44 | ?> |
45 | 45 | <table class="form-table add-new-state-tbl"> |
46 | 46 | <tbody> |
@@ -17,39 +17,39 @@ |
||
17 | 17 | { |
18 | 18 | |
19 | 19 | |
20 | - public function __construct() |
|
21 | - { |
|
22 | - // define some event categories related constants |
|
23 | - define('EE_VENUES_PG_SLUG', 'espresso_venues'); |
|
24 | - define('EE_VENUES_ADMIN_URL', admin_url('admin.php?page=' . EE_VENUES_PG_SLUG)); |
|
25 | - define('EE_VENUES_ASSETS_URL', EE_ADMIN_PAGES_URL . 'venues/assets/'); |
|
26 | - define('EE_VENUES_TEMPLATE_PATH', EE_ADMIN_PAGES . 'venues/templates/'); |
|
20 | + public function __construct() |
|
21 | + { |
|
22 | + // define some event categories related constants |
|
23 | + define('EE_VENUES_PG_SLUG', 'espresso_venues'); |
|
24 | + define('EE_VENUES_ADMIN_URL', admin_url('admin.php?page=' . EE_VENUES_PG_SLUG)); |
|
25 | + define('EE_VENUES_ASSETS_URL', EE_ADMIN_PAGES_URL . 'venues/assets/'); |
|
26 | + define('EE_VENUES_TEMPLATE_PATH', EE_ADMIN_PAGES . 'venues/templates/'); |
|
27 | 27 | |
28 | - parent::__construct(); |
|
29 | - $this->_folder_path = EE_ADMIN_PAGES . $this->_folder_name . DS; |
|
30 | - } |
|
28 | + parent::__construct(); |
|
29 | + $this->_folder_path = EE_ADMIN_PAGES . $this->_folder_name . DS; |
|
30 | + } |
|
31 | 31 | |
32 | - protected function _set_init_properties() |
|
33 | - { |
|
34 | - $this->label = __('Event Venues', 'event_espresso'); |
|
35 | - $this->menu_label = __('Venues', 'event_espresso'); |
|
36 | - $this->menu_slug = EE_VENUES_PG_SLUG; |
|
37 | - } |
|
32 | + protected function _set_init_properties() |
|
33 | + { |
|
34 | + $this->label = __('Event Venues', 'event_espresso'); |
|
35 | + $this->menu_label = __('Venues', 'event_espresso'); |
|
36 | + $this->menu_slug = EE_VENUES_PG_SLUG; |
|
37 | + } |
|
38 | 38 | |
39 | 39 | |
40 | - protected function _set_menu_map() |
|
41 | - { |
|
42 | - $this->_menu_map = new EE_Admin_Page_Sub_Menu( |
|
43 | - array( |
|
44 | - 'menu_group' => 'management', |
|
45 | - 'menu_order' => 40, |
|
46 | - 'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY, |
|
47 | - 'parent_slug' => 'espresso_events', |
|
48 | - 'menu_slug' => EE_VENUES_PG_SLUG, |
|
49 | - 'menu_label' => __('Venues', 'event_espresso'), |
|
50 | - 'capability' => 'ee_read_venues', |
|
51 | - 'admin_init_page' => $this, |
|
52 | - ) |
|
53 | - ); |
|
54 | - } |
|
40 | + protected function _set_menu_map() |
|
41 | + { |
|
42 | + $this->_menu_map = new EE_Admin_Page_Sub_Menu( |
|
43 | + array( |
|
44 | + 'menu_group' => 'management', |
|
45 | + 'menu_order' => 40, |
|
46 | + 'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY, |
|
47 | + 'parent_slug' => 'espresso_events', |
|
48 | + 'menu_slug' => EE_VENUES_PG_SLUG, |
|
49 | + 'menu_label' => __('Venues', 'event_espresso'), |
|
50 | + 'capability' => 'ee_read_venues', |
|
51 | + 'admin_init_page' => $this, |
|
52 | + ) |
|
53 | + ); |
|
54 | + } |
|
55 | 55 | } |
@@ -21,12 +21,12 @@ |
||
21 | 21 | { |
22 | 22 | // define some event categories related constants |
23 | 23 | define('EE_VENUES_PG_SLUG', 'espresso_venues'); |
24 | - define('EE_VENUES_ADMIN_URL', admin_url('admin.php?page=' . EE_VENUES_PG_SLUG)); |
|
25 | - define('EE_VENUES_ASSETS_URL', EE_ADMIN_PAGES_URL . 'venues/assets/'); |
|
26 | - define('EE_VENUES_TEMPLATE_PATH', EE_ADMIN_PAGES . 'venues/templates/'); |
|
24 | + define('EE_VENUES_ADMIN_URL', admin_url('admin.php?page='.EE_VENUES_PG_SLUG)); |
|
25 | + define('EE_VENUES_ASSETS_URL', EE_ADMIN_PAGES_URL.'venues/assets/'); |
|
26 | + define('EE_VENUES_TEMPLATE_PATH', EE_ADMIN_PAGES.'venues/templates/'); |
|
27 | 27 | |
28 | 28 | parent::__construct(); |
29 | - $this->_folder_path = EE_ADMIN_PAGES . $this->_folder_name . DS; |
|
29 | + $this->_folder_path = EE_ADMIN_PAGES.$this->_folder_name.DS; |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | protected function _set_init_properties() |
@@ -17,1518 +17,1518 @@ |
||
17 | 17 | { |
18 | 18 | |
19 | 19 | |
20 | - /** |
|
21 | - * _venue |
|
22 | - * This will hold the venue object for venue_details screen. |
|
23 | - * |
|
24 | - * @access protected |
|
25 | - * @var object |
|
26 | - */ |
|
27 | - protected $_venue; |
|
28 | - |
|
29 | - |
|
30 | - /** |
|
31 | - * This will hold the category object for category_details screen. |
|
32 | - * |
|
33 | - * @var object |
|
34 | - */ |
|
35 | - protected $_category; |
|
36 | - |
|
37 | - |
|
38 | - /** |
|
39 | - * This property will hold the venue model instance |
|
40 | - * |
|
41 | - * @var object |
|
42 | - */ |
|
43 | - protected $_venue_model; |
|
44 | - |
|
45 | - |
|
46 | - protected function _init_page_props() |
|
47 | - { |
|
48 | - require_once(EE_MODELS . 'EEM_Venue.model.php'); |
|
49 | - $this->page_slug = EE_VENUES_PG_SLUG; |
|
50 | - $this->_admin_base_url = EE_VENUES_ADMIN_URL; |
|
51 | - $this->_admin_base_path = EE_ADMIN_PAGES . 'venues'; |
|
52 | - $this->page_label = __('Event Venues', 'event_espresso'); |
|
53 | - $this->_cpt_model_names = array( |
|
54 | - 'create_new' => 'EEM_Venue', |
|
55 | - 'edit' => 'EEM_Venue', |
|
56 | - ); |
|
57 | - $this->_cpt_edit_routes = array( |
|
58 | - 'espresso_venues' => 'edit', |
|
59 | - ); |
|
60 | - $this->_venue_model = EEM_Venue::instance(); |
|
61 | - } |
|
62 | - |
|
63 | - |
|
64 | - protected function _ajax_hooks() |
|
65 | - { |
|
66 | - // todo: all hooks for ee_venues ajax goes in here. |
|
67 | - } |
|
68 | - |
|
69 | - |
|
70 | - protected function _define_page_props() |
|
71 | - { |
|
72 | - $this->_admin_page_title = $this->page_label; |
|
73 | - $this->_labels = array( |
|
74 | - 'buttons' => array( |
|
75 | - 'add' => __('Add New Venue', 'event_espresso'), |
|
76 | - 'edit' => __('Edit Venue', 'event_espresso'), |
|
77 | - 'delete' => __('Delete Venue', 'event_espresso'), |
|
78 | - 'add_category' => __('Add New Category', 'event_espresso'), |
|
79 | - 'edit_category' => __('Edit Category', 'event_espresso'), |
|
80 | - 'delete_category' => __('Delete Category', 'event_espresso'), |
|
81 | - ), |
|
82 | - 'editor_title' => array( |
|
83 | - 'espresso_venues' => __('Enter Venue name here', 'event_espresso'), |
|
84 | - ), |
|
85 | - 'publishbox' => array( |
|
86 | - 'create_new' => __('Save New Venue', 'event_espresso'), |
|
87 | - 'edit' => __('Update Venue', 'event_espresso'), |
|
88 | - 'add_category' => __('Save New Category', 'event_espresso'), |
|
89 | - 'edit_category' => __('Update Category', 'event_espresso'), |
|
90 | - 'google_map_settings' => __('Update Settings', 'event_espresso'), |
|
91 | - ), |
|
92 | - ); |
|
93 | - } |
|
94 | - |
|
95 | - |
|
96 | - protected function _set_page_routes() |
|
97 | - { |
|
98 | - |
|
99 | - // load formatter helper |
|
100 | - // load field generator helper |
|
101 | - |
|
102 | - // is there a vnu_id in the request? |
|
103 | - $vnu_id = ! empty($this->_req_data['VNU_ID']) && ! is_array($this->_req_data['VNU_ID']) |
|
104 | - ? $this->_req_data['VNU_ID'] : 0; |
|
105 | - $vnu_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $vnu_id; |
|
106 | - |
|
107 | - $this->_page_routes = array( |
|
108 | - 'default' => array( |
|
109 | - 'func' => '_overview_list_table', |
|
110 | - 'capability' => 'ee_read_venues', |
|
111 | - ), |
|
112 | - 'create_new' => array( |
|
113 | - 'func' => '_create_new_cpt_item', |
|
114 | - 'capability' => 'ee_edit_venues', |
|
115 | - ), |
|
116 | - 'edit' => array( |
|
117 | - 'func' => '_edit_cpt_item', |
|
118 | - 'capability' => 'ee_edit_venue', |
|
119 | - 'obj_id' => $vnu_id, |
|
120 | - ), |
|
121 | - 'trash_venue' => array( |
|
122 | - 'func' => '_trash_or_restore_venue', |
|
123 | - 'args' => array('venue_status' => 'trash'), |
|
124 | - 'noheader' => true, |
|
125 | - 'capability' => 'ee_delete_venue', |
|
126 | - 'obj_id' => $vnu_id, |
|
127 | - ), |
|
128 | - 'trash_venues' => array( |
|
129 | - 'func' => '_trash_or_restore_venues', |
|
130 | - 'args' => array('venue_status' => 'trash'), |
|
131 | - 'noheader' => true, |
|
132 | - 'capability' => 'ee_delete_venues', |
|
133 | - ), |
|
134 | - 'restore_venue' => array( |
|
135 | - 'func' => '_trash_or_restore_venue', |
|
136 | - 'args' => array('venue_status' => 'draft'), |
|
137 | - 'noheader' => true, |
|
138 | - 'capability' => 'ee_delete_venue', |
|
139 | - 'obj_id' => $vnu_id, |
|
140 | - ), |
|
141 | - 'restore_venues' => array( |
|
142 | - 'func' => '_trash_or_restore_venues', |
|
143 | - 'args' => array('venue_status' => 'draft'), |
|
144 | - 'noheader' => true, |
|
145 | - 'capability' => 'ee_delete_venues', |
|
146 | - ), |
|
147 | - 'delete_venues' => array( |
|
148 | - 'func' => '_delete_venues', |
|
149 | - 'noheader' => true, |
|
150 | - 'capability' => 'ee_delete_venues', |
|
151 | - ), |
|
152 | - 'delete_venue' => array( |
|
153 | - 'func' => '_delete_venue', |
|
154 | - 'noheader' => true, |
|
155 | - 'capability' => 'ee_delete_venue', |
|
156 | - 'obj_id' => $vnu_id, |
|
157 | - ), |
|
158 | - // settings related |
|
159 | - 'google_map_settings' => array( |
|
160 | - 'func' => '_google_map_settings', |
|
161 | - 'capability' => 'manage_options', |
|
162 | - ), |
|
163 | - 'update_google_map_settings' => array( |
|
164 | - 'func' => '_update_google_map_settings', |
|
165 | - 'capability' => 'manage_options', |
|
166 | - 'noheader' => true, |
|
167 | - ), |
|
168 | - // venue category tab related |
|
169 | - 'add_category' => array( |
|
170 | - 'func' => '_category_details', |
|
171 | - 'args' => array('add'), |
|
172 | - 'capability' => 'ee_edit_venue_category', |
|
173 | - ), |
|
174 | - 'edit_category' => array( |
|
175 | - 'func' => '_category_details', |
|
176 | - 'args' => array('edit'), |
|
177 | - 'capability' => 'ee_edit_venue_category', |
|
178 | - ), |
|
179 | - 'delete_categories' => array( |
|
180 | - 'func' => '_delete_categories', |
|
181 | - 'noheader' => true, |
|
182 | - 'capability' => 'ee_delete_venue_category', |
|
183 | - ), |
|
184 | - |
|
185 | - 'delete_category' => array( |
|
186 | - 'func' => '_delete_categories', |
|
187 | - 'noheader' => true, |
|
188 | - 'capability' => 'ee_delete_venue_category', |
|
189 | - ), |
|
190 | - |
|
191 | - 'insert_category' => array( |
|
192 | - 'func' => '_insert_or_update_category', |
|
193 | - 'args' => array('new_category' => true), |
|
194 | - 'noheader' => true, |
|
195 | - 'capability' => 'ee_edit_venue_category', |
|
196 | - ), |
|
197 | - |
|
198 | - 'update_category' => array( |
|
199 | - 'func' => '_insert_or_update_category', |
|
200 | - 'args' => array('new_category' => false), |
|
201 | - 'noheader' => true, |
|
202 | - 'capability' => 'ee_edit_venue_category', |
|
203 | - ), |
|
204 | - 'export_categories' => array( |
|
205 | - 'func' => '_categories_export', |
|
206 | - 'noheader' => true, |
|
207 | - 'capability' => 'export', |
|
208 | - ), |
|
209 | - 'import_categories' => array( |
|
210 | - 'func' => '_import_categories', |
|
211 | - 'capability' => 'import', |
|
212 | - ), |
|
213 | - 'category_list' => array( |
|
214 | - 'func' => '_category_list_table', |
|
215 | - 'capability' => 'ee_manage_venue_categories', |
|
216 | - ), |
|
217 | - ); |
|
218 | - } |
|
219 | - |
|
220 | - |
|
221 | - protected function _set_page_config() |
|
222 | - { |
|
223 | - $this->_page_config = array( |
|
224 | - 'default' => array( |
|
225 | - 'nav' => array( |
|
226 | - 'label' => __('Overview', 'event_espresso'), |
|
227 | - 'order' => 10, |
|
228 | - ), |
|
229 | - 'list_table' => 'Venues_Admin_List_Table', |
|
230 | - 'help_tabs' => array( |
|
231 | - 'venues_overview_help_tab' => array( |
|
232 | - 'title' => __('Venues Overview', 'event_espresso'), |
|
233 | - 'filename' => 'venues_overview', |
|
234 | - ), |
|
235 | - 'venues_overview_table_column_headings_help_tab' => array( |
|
236 | - 'title' => __('Venues Overview Table Column Headings', 'event_espresso'), |
|
237 | - 'filename' => 'venues_overview_table_column_headings', |
|
238 | - ), |
|
239 | - 'venues_overview_views_bulk_actions_search_help_tab' => array( |
|
240 | - 'title' => __('Venues Overview Views & Bulk Actions & Search', 'event_espresso'), |
|
241 | - 'filename' => 'venues_overview_views_bulk_actions_search', |
|
242 | - ), |
|
243 | - ), |
|
244 | - 'help_tour' => array('Venues_Overview_Help_Tour'), |
|
245 | - 'metaboxes' => array('_espresso_news_post_box', '_espresso_links_post_box'), |
|
246 | - 'require_nonce' => false, |
|
247 | - ), |
|
248 | - 'create_new' => array( |
|
249 | - 'nav' => array( |
|
250 | - 'label' => __('Add Venue', 'event_espresso'), |
|
251 | - 'order' => 5, |
|
252 | - 'persistent' => false, |
|
253 | - ), |
|
254 | - 'help_tabs' => array( |
|
255 | - 'venues_editor_help_tab' => array( |
|
256 | - 'title' => __('Venue Editor', 'event_espresso'), |
|
257 | - 'filename' => 'venues_editor', |
|
258 | - ), |
|
259 | - 'venues_editor_title_richtexteditor_help_tab' => array( |
|
260 | - 'title' => __('Venue Title & Rich Text Editor', 'event_espresso'), |
|
261 | - 'filename' => 'venues_editor_title_richtexteditor', |
|
262 | - ), |
|
263 | - 'venues_editor_tags_categories_help_tab' => array( |
|
264 | - 'title' => __('Venue Tags & Categories', 'event_espresso'), |
|
265 | - 'filename' => 'venues_editor_tags_categories', |
|
266 | - ), |
|
267 | - 'venues_editor_physical_location_google_map_virtual_location_help_tab' => array( |
|
268 | - 'title' => __( |
|
269 | - 'Venue Editor Physical Location & Google Map & Virtual Location', |
|
270 | - 'event_espresso' |
|
271 | - ), |
|
272 | - 'filename' => 'venues_editor_physical_location_google_map_virtual_location', |
|
273 | - ), |
|
274 | - 'venues_editor_save_new_venue_help_tab' => array( |
|
275 | - 'title' => __('Save New Venue', 'event_espresso'), |
|
276 | - 'filename' => 'venues_editor_save_new_venue', |
|
277 | - ), |
|
278 | - 'venues_editor_other_help_tab' => array( |
|
279 | - 'title' => __('Venue Editor Other', 'event_espresso'), |
|
280 | - 'filename' => 'venues_editor_other', |
|
281 | - ), |
|
282 | - ), |
|
283 | - 'help_tour' => array('Venues_Add_Venue_Help_Tour'), |
|
284 | - 'metaboxes' => array('_venue_editor_metaboxes'), |
|
285 | - 'require_nonce' => false, |
|
286 | - ), |
|
287 | - 'edit' => array( |
|
288 | - 'nav' => array( |
|
289 | - 'label' => __('Edit Venue', 'event_espresso'), |
|
290 | - 'order' => 5, |
|
291 | - 'persistent' => false, |
|
292 | - 'url' => isset($this->_req_data['post']) ? add_query_arg( |
|
293 | - array('post' => $this->_req_data['post']), |
|
294 | - $this->_current_page_view_url |
|
295 | - ) : $this->_admin_base_url, |
|
296 | - ), |
|
297 | - 'help_tabs' => array( |
|
298 | - 'venues_editor_help_tab' => array( |
|
299 | - 'title' => __('Venue Editor', 'event_espresso'), |
|
300 | - 'filename' => 'venues_editor', |
|
301 | - ), |
|
302 | - 'venues_editor_title_richtexteditor_help_tab' => array( |
|
303 | - 'title' => __('Venue Title & Rich Text Editor', 'event_espresso'), |
|
304 | - 'filename' => 'venues_editor_title_richtexteditor', |
|
305 | - ), |
|
306 | - 'venues_editor_tags_categories_help_tab' => array( |
|
307 | - 'title' => __('Venue Tags & Categories', 'event_espresso'), |
|
308 | - 'filename' => 'venues_editor_tags_categories', |
|
309 | - ), |
|
310 | - 'venues_editor_physical_location_google_map_virtual_location_help_tab' => array( |
|
311 | - 'title' => __( |
|
312 | - 'Venue Editor Physical Location & Google Map & Virtual Location', |
|
313 | - 'event_espresso' |
|
314 | - ), |
|
315 | - 'filename' => 'venues_editor_physical_location_google_map_virtual_location', |
|
316 | - ), |
|
317 | - 'venues_editor_save_new_venue_help_tab' => array( |
|
318 | - 'title' => __('Save New Venue', 'event_espresso'), |
|
319 | - 'filename' => 'venues_editor_save_new_venue', |
|
320 | - ), |
|
321 | - 'venues_editor_other_help_tab' => array( |
|
322 | - 'title' => __('Venue Editor Other', 'event_espresso'), |
|
323 | - 'filename' => 'venues_editor_other', |
|
324 | - ), |
|
325 | - ), |
|
326 | - /*'help_tour' => array( 'Venues_Edit_Venue_Help_Tour' ),*/ |
|
327 | - 'metaboxes' => array('_venue_editor_metaboxes'), |
|
328 | - 'require_nonce' => false, |
|
329 | - ), |
|
330 | - 'google_map_settings' => array( |
|
331 | - 'nav' => array( |
|
332 | - 'label' => esc_html__('Google Maps', 'event_espresso'), |
|
333 | - 'order' => 40, |
|
334 | - ), |
|
335 | - 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
336 | - 'help_tabs' => array( |
|
337 | - 'general_settings_google_maps_help_tab' => array( |
|
338 | - 'title' => __('Google Maps', 'event_espresso'), |
|
339 | - 'filename' => 'general_settings_google_maps', |
|
340 | - ), |
|
341 | - ), |
|
342 | - 'help_tour' => array('Google_Maps_Help_Tour'), |
|
343 | - 'require_nonce' => false, |
|
344 | - ), |
|
345 | - // venue category stuff |
|
346 | - 'add_category' => array( |
|
347 | - 'nav' => array( |
|
348 | - 'label' => __('Add Category', 'event_espresso'), |
|
349 | - 'order' => 15, |
|
350 | - 'persistent' => false, |
|
351 | - ), |
|
352 | - 'metaboxes' => array('_publish_post_box'), |
|
353 | - 'help_tabs' => array( |
|
354 | - 'venues_add_category_help_tab' => array( |
|
355 | - 'title' => __('Add New Venue Category', 'event_espresso'), |
|
356 | - 'filename' => 'venues_add_category', |
|
357 | - ), |
|
358 | - ), |
|
359 | - 'help_tour' => array('Venues_Add_Category_Help_Tour'), |
|
360 | - 'require_nonce' => false, |
|
361 | - ), |
|
362 | - 'edit_category' => array( |
|
363 | - 'nav' => array( |
|
364 | - 'label' => __('Edit Category', 'event_espresso'), |
|
365 | - 'order' => 15, |
|
366 | - 'persistent' => false, |
|
367 | - 'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg( |
|
368 | - array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID']), |
|
369 | - $this->_current_page_view_url |
|
370 | - ) : $this->_admin_base_url, |
|
371 | - ), |
|
372 | - 'metaboxes' => array('_publish_post_box'), |
|
373 | - 'help_tabs' => array( |
|
374 | - 'venues_edit_category_help_tab' => array( |
|
375 | - 'title' => __('Edit Venue Category', 'event_espresso'), |
|
376 | - 'filename' => 'venues_edit_category', |
|
377 | - ), |
|
378 | - ), |
|
379 | - /*'help_tour' => array( 'Venues_Edit_Category_Help_Tour' ),*/ |
|
380 | - 'require_nonce' => false, |
|
381 | - ), |
|
382 | - 'category_list' => array( |
|
383 | - 'nav' => array( |
|
384 | - 'label' => __('Categories', 'event_espresso'), |
|
385 | - 'order' => 20, |
|
386 | - ), |
|
387 | - 'list_table' => 'Venue_Categories_Admin_List_Table', |
|
388 | - 'help_tabs' => array( |
|
389 | - 'venues_categories_help_tab' => array( |
|
390 | - 'title' => __('Venue Categories', 'event_espresso'), |
|
391 | - 'filename' => 'venues_categories', |
|
392 | - ), |
|
393 | - 'venues_categories_table_column_headings_help_tab' => array( |
|
394 | - 'title' => __('Venue Categories Table Column Headings', 'event_espresso'), |
|
395 | - 'filename' => 'venues_categories_table_column_headings', |
|
396 | - ), |
|
397 | - 'venues_categories_views_help_tab' => array( |
|
398 | - 'title' => __('Venue Categories Views', 'event_espresso'), |
|
399 | - 'filename' => 'venues_categories_views', |
|
400 | - ), |
|
401 | - 'venues_categories_other_help_tab' => array( |
|
402 | - 'title' => __('Venue Categories Other', 'event_espresso'), |
|
403 | - 'filename' => 'venues_categories_other', |
|
404 | - ), |
|
405 | - ), |
|
406 | - 'help_tour' => array('Venues_Categories_Help_Tour'), |
|
407 | - 'metaboxes' => $this->_default_espresso_metaboxes, |
|
408 | - 'require_nonce' => false, |
|
409 | - ), |
|
410 | - ); |
|
411 | - } |
|
412 | - |
|
413 | - |
|
414 | - protected function _add_screen_options() |
|
415 | - { |
|
416 | - // todo |
|
417 | - } |
|
418 | - |
|
419 | - |
|
420 | - protected function _add_screen_options_default() |
|
421 | - { |
|
422 | - $this->_per_page_screen_option(); |
|
423 | - } |
|
424 | - |
|
425 | - |
|
426 | - protected function _add_screen_options_category_list() |
|
427 | - { |
|
428 | - $page_title = $this->_admin_page_title; |
|
429 | - $this->_admin_page_title = __('Venue Categories', 'event_espresso'); |
|
430 | - $this->_per_page_screen_option(); |
|
431 | - $this->_admin_page_title = $page_title; |
|
432 | - } |
|
433 | - |
|
434 | - |
|
435 | - // none of the below group are currently used for Event Venues |
|
436 | - protected function _add_feature_pointers() |
|
437 | - { |
|
438 | - } |
|
439 | - |
|
440 | - public function admin_init() |
|
441 | - { |
|
442 | - } |
|
443 | - |
|
444 | - public function admin_notices() |
|
445 | - { |
|
446 | - } |
|
447 | - |
|
448 | - public function admin_footer_scripts() |
|
449 | - { |
|
450 | - } |
|
451 | - |
|
452 | - |
|
453 | - public function load_scripts_styles_create_new() |
|
454 | - { |
|
455 | - $this->load_scripts_styles_edit(); |
|
456 | - } |
|
457 | - |
|
458 | - |
|
459 | - public function load_scripts_styles() |
|
460 | - { |
|
461 | - wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL . 'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION); |
|
462 | - wp_enqueue_style('ee-cat-admin'); |
|
463 | - } |
|
464 | - |
|
465 | - |
|
466 | - public function load_scripts_styles_add_category() |
|
467 | - { |
|
468 | - $this->load_scripts_styles_edit_category(); |
|
469 | - } |
|
470 | - |
|
471 | - |
|
472 | - public function load_scripts_styles_edit_category() |
|
473 | - { |
|
474 | - } |
|
475 | - |
|
476 | - |
|
477 | - public function load_scripts_styles_edit() |
|
478 | - { |
|
479 | - // styles |
|
480 | - wp_enqueue_style('espresso-ui-theme'); |
|
481 | - wp_register_style( |
|
482 | - 'espresso_venues', |
|
483 | - EE_VENUES_ASSETS_URL . 'ee-venues-admin.css', |
|
484 | - array(), |
|
485 | - EVENT_ESPRESSO_VERSION |
|
486 | - ); |
|
487 | - wp_enqueue_style('espresso_venues'); |
|
488 | - } |
|
489 | - |
|
490 | - |
|
491 | - protected function _set_list_table_views_default() |
|
492 | - { |
|
493 | - $this->_views = array( |
|
494 | - 'all' => array( |
|
495 | - 'slug' => 'all', |
|
496 | - 'label' => __('View All Venues', 'event_espresso'), |
|
497 | - 'count' => 0, |
|
498 | - 'bulk_action' => array(), |
|
499 | - ), |
|
500 | - ); |
|
501 | - |
|
502 | - if (EE_Registry::instance()->CAP->current_user_can('ee_delete_venues', 'espresso_venues_trash_venues')) { |
|
503 | - $this->_views['all']['bulk_action'] = array( |
|
504 | - 'trash_venues' => __('Move to Trash', 'event_espresso'), |
|
505 | - ); |
|
506 | - $this->_views['trash'] = array( |
|
507 | - 'slug' => 'trash', |
|
508 | - 'label' => __('Trash', 'event_espresso'), |
|
509 | - 'count' => 0, |
|
510 | - 'bulk_action' => array( |
|
511 | - 'restore_venues' => __('Restore from Trash', 'event_espresso'), |
|
512 | - 'delete_venues' => __('Delete', 'event_espresso'), |
|
513 | - ), |
|
514 | - ); |
|
515 | - } |
|
516 | - } |
|
517 | - |
|
518 | - |
|
519 | - protected function _set_list_table_views_category_list() |
|
520 | - { |
|
521 | - $this->_views = array( |
|
522 | - 'all' => array( |
|
523 | - 'slug' => 'all', |
|
524 | - 'label' => __('All', 'event_espresso'), |
|
525 | - 'count' => 0, |
|
526 | - 'bulk_action' => array( |
|
527 | - 'delete_categories' => __('Delete Permanently', 'event_espresso'), |
|
528 | - ), |
|
529 | - ), |
|
530 | - ); |
|
531 | - } |
|
532 | - |
|
533 | - |
|
534 | - protected function _overview_list_table() |
|
535 | - { |
|
536 | - do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
537 | - $this->_template_args['after_list_table'] = EEH_Template::get_button_or_link( |
|
538 | - get_post_type_archive_link('espresso_venues'), |
|
539 | - __("View Venue Archive Page", "event_espresso"), |
|
540 | - 'button' |
|
541 | - ); |
|
542 | - $this->_admin_page_title .= ' ' . $this->get_action_link_or_button('create_new', 'add', array(), 'add-new-h2'); |
|
543 | - $this->_search_btn_label = __('Venues', 'event_espresso'); |
|
544 | - $this->display_admin_list_table_page_with_sidebar(); |
|
545 | - } |
|
546 | - |
|
547 | - |
|
548 | - public function extra_misc_actions_publish_box() |
|
549 | - { |
|
550 | - $extra_rows = array( |
|
551 | - 'vnu_capacity' => $this->_cpt_model_obj->get_f('VNU_capacity'), |
|
552 | - 'vnu_url' => $this->_cpt_model_obj->get_f('VNU_url'), |
|
553 | - 'vnu_phone' => $this->_cpt_model_obj->get_f('VNU_phone'), |
|
554 | - ); |
|
555 | - $template = EE_VENUES_TEMPLATE_PATH . 'venue_publish_box_extras.template.php'; |
|
556 | - EEH_Template::display_template($template, $extra_rows); |
|
557 | - } |
|
558 | - |
|
559 | - |
|
560 | - /************* Google Maps *************/ |
|
561 | - |
|
562 | - |
|
563 | - protected function _google_map_settings() |
|
564 | - { |
|
565 | - |
|
566 | - |
|
567 | - $this->_template_args['values'] = $this->_yes_no_values; |
|
568 | - $default_map_settings = new stdClass(); |
|
569 | - $default_map_settings->use_google_maps = true; |
|
570 | - $default_map_settings->google_map_api_key = ''; |
|
571 | - // for event details pages (reg page) |
|
572 | - $default_map_settings->event_details_map_width = 585; // ee_map_width_single |
|
573 | - $default_map_settings->event_details_map_height = 362; // ee_map_height_single |
|
574 | - $default_map_settings->event_details_map_zoom = 14; // ee_map_zoom_single |
|
575 | - $default_map_settings->event_details_display_nav = true; // ee_map_nav_display_single |
|
576 | - $default_map_settings->event_details_nav_size = false; // ee_map_nav_size_single |
|
577 | - $default_map_settings->event_details_control_type = 'default'; // ee_map_type_control_single |
|
578 | - $default_map_settings->event_details_map_align = 'center'; // ee_map_align_single |
|
579 | - // for event list pages |
|
580 | - $default_map_settings->event_list_map_width = 300; // ee_map_width |
|
581 | - $default_map_settings->event_list_map_height = 185; // ee_map_height |
|
582 | - $default_map_settings->event_list_map_zoom = 12; // ee_map_zoom |
|
583 | - $default_map_settings->event_list_display_nav = false; // ee_map_nav_display |
|
584 | - $default_map_settings->event_list_nav_size = true; // ee_map_nav_size |
|
585 | - $default_map_settings->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
586 | - $default_map_settings->event_list_map_align = 'center'; // ee_map_align |
|
587 | - |
|
588 | - $this->_template_args['map_settings'] = |
|
589 | - isset(EE_Registry::instance()->CFG->map_settings) |
|
590 | - && ! empty(EE_Registry::instance()->CFG->map_settings) |
|
591 | - ? (object) array_merge( |
|
592 | - (array) $default_map_settings, |
|
593 | - (array) EE_Registry::instance()->CFG->map_settings |
|
594 | - ) |
|
595 | - : $default_map_settings; |
|
596 | - |
|
597 | - $this->_set_add_edit_form_tags('update_google_map_settings'); |
|
598 | - $this->_set_publish_post_box_vars(null, false, false, null, false); |
|
599 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
|
600 | - EE_VENUES_TEMPLATE_PATH . 'google_map.template.php', |
|
601 | - $this->_template_args, |
|
602 | - true |
|
603 | - ); |
|
604 | - $this->display_admin_page_with_sidebar(); |
|
605 | - } |
|
606 | - |
|
607 | - protected function _update_google_map_settings() |
|
608 | - { |
|
609 | - |
|
610 | - EE_Registry::instance()->CFG->map_settings->use_google_maps = |
|
611 | - isset($this->_req_data['use_google_maps']) |
|
612 | - ? absint($this->_req_data['use_google_maps']) |
|
613 | - : EE_Registry::instance()->CFG->map_settings->use_google_maps; |
|
614 | - |
|
615 | - EE_Registry::instance()->CFG->map_settings->google_map_api_key = |
|
616 | - isset($this->_req_data['google_map_api_key']) |
|
617 | - ? sanitize_text_field($this->_req_data['google_map_api_key']) |
|
618 | - : EE_Registry::instance()->CFG->map_settings->google_map_api_key; |
|
619 | - |
|
620 | - EE_Registry::instance()->CFG->map_settings->event_details_map_width = |
|
621 | - isset($this->_req_data['event_details_map_width']) |
|
622 | - ? absint($this->_req_data['event_details_map_width']) |
|
623 | - : EE_Registry::instance()->CFG->map_settings->event_details_map_width; |
|
624 | - |
|
625 | - EE_Registry::instance()->CFG->map_settings->event_details_map_height = |
|
626 | - isset($this->_req_data['event_details_map_height']) |
|
627 | - ? absint($this->_req_data['event_details_map_height']) |
|
628 | - : EE_Registry::instance()->CFG->map_settings->event_details_map_height; |
|
629 | - |
|
630 | - EE_Registry::instance()->CFG->map_settings->event_details_map_zoom = |
|
631 | - isset($this->_req_data['event_details_map_zoom']) |
|
632 | - ? absint($this->_req_data['event_details_map_zoom']) |
|
633 | - : EE_Registry::instance()->CFG->map_settings->event_details_map_zoom; |
|
634 | - |
|
635 | - EE_Registry::instance()->CFG->map_settings->event_details_display_nav = |
|
636 | - isset($this->_req_data['event_details_display_nav']) |
|
637 | - ? absint($this->_req_data['event_details_display_nav']) |
|
638 | - : EE_Registry::instance()->CFG->map_settings->event_details_display_nav; |
|
639 | - |
|
640 | - EE_Registry::instance()->CFG->map_settings->event_details_nav_size = |
|
641 | - isset($this->_req_data['event_details_nav_size']) |
|
642 | - ? absint($this->_req_data['event_details_nav_size']) |
|
643 | - : EE_Registry::instance()->CFG->map_settings->event_details_nav_size; |
|
644 | - |
|
645 | - EE_Registry::instance()->CFG->map_settings->event_details_control_type = |
|
646 | - isset($this->_req_data['event_details_control_type']) |
|
647 | - ? sanitize_text_field($this->_req_data['event_details_control_type']) |
|
648 | - : EE_Registry::instance()->CFG->map_settings->event_details_control_type; |
|
649 | - |
|
650 | - EE_Registry::instance()->CFG->map_settings->event_details_map_align = |
|
651 | - isset($this->_req_data['event_details_map_align']) |
|
652 | - ? sanitize_text_field($this->_req_data['event_details_map_align']) |
|
653 | - : EE_Registry::instance()->CFG->map_settings->event_details_map_align; |
|
654 | - |
|
655 | - EE_Registry::instance()->CFG->map_settings->event_list_map_width = |
|
656 | - isset($this->_req_data['event_list_map_width']) |
|
657 | - ? absint($this->_req_data['event_list_map_width']) |
|
658 | - : EE_Registry::instance()->CFG->map_settings->event_list_map_width; |
|
659 | - |
|
660 | - EE_Registry::instance()->CFG->map_settings->event_list_map_height = |
|
661 | - isset($this->_req_data['event_list_map_height']) |
|
662 | - ? absint($this->_req_data['event_list_map_height']) |
|
663 | - : EE_Registry::instance()->CFG->map_settings->event_list_map_height; |
|
664 | - |
|
665 | - EE_Registry::instance()->CFG->map_settings->event_list_map_zoom = |
|
666 | - isset($this->_req_data['event_list_map_zoom']) |
|
667 | - ? absint($this->_req_data['event_list_map_zoom']) |
|
668 | - : EE_Registry::instance()->CFG->map_settings->event_list_map_zoom; |
|
669 | - |
|
670 | - EE_Registry::instance()->CFG->map_settings->event_list_display_nav = |
|
671 | - isset($this->_req_data['event_list_display_nav']) |
|
672 | - ? absint($this->_req_data['event_list_display_nav']) |
|
673 | - : EE_Registry::instance()->CFG->map_settings->event_list_display_nav; |
|
674 | - |
|
675 | - EE_Registry::instance()->CFG->map_settings->event_list_nav_size = |
|
676 | - isset($this->_req_data['event_list_nav_size']) |
|
677 | - ? absint($this->_req_data['event_list_nav_size']) |
|
678 | - : EE_Registry::instance()->CFG->map_settings->event_list_nav_size; |
|
679 | - |
|
680 | - EE_Registry::instance()->CFG->map_settings->event_list_control_type = |
|
681 | - isset($this->_req_data['event_list_control_type']) |
|
682 | - ? sanitize_text_field($this->_req_data['event_list_control_type']) |
|
683 | - : EE_Registry::instance()->CFG->map_settings->event_list_control_type; |
|
684 | - |
|
685 | - EE_Registry::instance()->CFG->map_settings->event_list_map_align = |
|
686 | - isset($this->_req_data['event_list_map_align']) |
|
687 | - ? sanitize_text_field($this->_req_data['event_list_map_align']) |
|
688 | - : EE_Registry::instance()->CFG->map_settings->event_list_map_align; |
|
689 | - |
|
690 | - EE_Registry::instance()->CFG->map_settings = apply_filters( |
|
691 | - 'FHEE__Extend_General_Settings_Admin_Page___update_google_map_settings__CFG_map_settings', |
|
692 | - EE_Registry::instance()->CFG->map_settings |
|
693 | - ); |
|
694 | - |
|
695 | - $what = 'Google Map Settings'; |
|
696 | - $success = $this->_update_espresso_configuration( |
|
697 | - $what, |
|
698 | - EE_Registry::instance()->CFG->map_settings, |
|
699 | - __FILE__, |
|
700 | - __FUNCTION__, |
|
701 | - __LINE__ |
|
702 | - ); |
|
703 | - $this->_redirect_after_action($success, $what, 'updated', array('action' => 'google_map_settings')); |
|
704 | - } |
|
705 | - |
|
706 | - |
|
707 | - protected function _venue_editor_metaboxes() |
|
708 | - { |
|
709 | - $this->verify_cpt_object(); |
|
710 | - |
|
711 | - add_meta_box( |
|
712 | - 'espresso_venue_address_options', |
|
713 | - __('Physical Location', 'event_espresso'), |
|
714 | - array($this, 'venue_address_metabox'), |
|
715 | - $this->page_slug, |
|
716 | - 'side', |
|
717 | - 'default' |
|
718 | - ); |
|
719 | - add_meta_box( |
|
720 | - 'espresso_venue_gmap_options', |
|
721 | - __('Google Map', 'event_espresso'), |
|
722 | - array($this, 'venue_gmap_metabox'), |
|
723 | - $this->page_slug, |
|
724 | - 'side', |
|
725 | - 'default' |
|
726 | - ); |
|
727 | - add_meta_box( |
|
728 | - 'espresso_venue_virtual_loc_options', |
|
729 | - __('Virtual Location', 'event_espresso'), |
|
730 | - array($this, 'venue_virtual_loc_metabox'), |
|
731 | - $this->page_slug, |
|
732 | - 'side', |
|
733 | - 'default' |
|
734 | - ); |
|
735 | - } |
|
736 | - |
|
737 | - |
|
738 | - public function venue_gmap_metabox() |
|
739 | - { |
|
740 | - $template_args = array( |
|
741 | - 'vnu_enable_for_gmap' => EEH_Form_Fields::select_input( |
|
742 | - 'vnu_enable_for_gmap', |
|
743 | - $this->get_yes_no_values(), |
|
744 | - $this->_cpt_model_obj->enable_for_gmap() |
|
745 | - ), |
|
746 | - 'vnu_google_map_link' => $this->_cpt_model_obj->google_map_link(), |
|
747 | - ); |
|
748 | - $template = EE_VENUES_TEMPLATE_PATH . 'venue_gmap_metabox_content.template.php'; |
|
749 | - EEH_Template::display_template($template, $template_args); |
|
750 | - } |
|
751 | - |
|
752 | - |
|
753 | - public function venue_address_metabox() |
|
754 | - { |
|
755 | - |
|
756 | - $template_args['_venue'] = $this->_cpt_model_obj; |
|
757 | - |
|
758 | - $template_args['states_dropdown'] = EEH_Form_Fields::generate_form_input( |
|
759 | - $QFI = new EE_Question_Form_Input( |
|
760 | - EE_Question::new_instance( |
|
761 | - array('QST_display_text' => esc_html__('State', 'event_espresso'), 'QST_system' => 'state') |
|
762 | - ), |
|
763 | - EE_Answer::new_instance(array('ANS_value' => $this->_cpt_model_obj->state_ID())), |
|
764 | - array( |
|
765 | - 'input_name' => 'sta_id', |
|
766 | - 'input_id' => 'sta_id', |
|
767 | - 'input_class' => '', |
|
768 | - 'input_prefix' => '', |
|
769 | - 'append_qstn_id' => false, |
|
770 | - ) |
|
771 | - ) |
|
772 | - ); |
|
773 | - $template_args['countries_dropdown'] = EEH_Form_Fields::generate_form_input( |
|
774 | - $QFI = new EE_Question_Form_Input( |
|
775 | - EE_Question::new_instance( |
|
776 | - array('QST_display_text' => esc_html__('Country', 'event_espresso'), 'QST_system' => 'country') |
|
777 | - ), |
|
778 | - EE_Answer::new_instance(array('ANS_value' => $this->_cpt_model_obj->country_ID())), |
|
779 | - array( |
|
780 | - 'input_name' => 'cnt_iso', |
|
781 | - 'input_id' => 'cnt_iso', |
|
782 | - 'input_class' => '', |
|
783 | - 'input_prefix' => '', |
|
784 | - 'append_qstn_id' => false, |
|
785 | - ) |
|
786 | - ) |
|
787 | - ); |
|
788 | - |
|
789 | - $template = EE_VENUES_TEMPLATE_PATH . 'venue_address_metabox_content.template.php'; |
|
790 | - EEH_Template::display_template($template, $template_args); |
|
791 | - } |
|
792 | - |
|
793 | - |
|
794 | - public function venue_virtual_loc_metabox() |
|
795 | - { |
|
796 | - $template_args = array( |
|
797 | - '_venue' => $this->_cpt_model_obj, |
|
798 | - ); |
|
799 | - $template = EE_VENUES_TEMPLATE_PATH . 'venue_virtual_location_metabox_content.template.php'; |
|
800 | - EEH_Template::display_template($template, $template_args); |
|
801 | - } |
|
802 | - |
|
803 | - |
|
804 | - protected function _restore_cpt_item($post_id, $revision_id) |
|
805 | - { |
|
806 | - $venue_obj = $this->_venue_model->get_one_by_ID($post_id); |
|
807 | - |
|
808 | - // meta revision restore |
|
809 | - $venue_obj->restore_revision($revision_id); |
|
810 | - } |
|
811 | - |
|
812 | - |
|
813 | - /** |
|
814 | - * Handles updates for venue cpts |
|
815 | - * |
|
816 | - * @param int $post_id ID of Venue CPT |
|
817 | - * @param object $post Post object (with "blessed" WP properties) |
|
818 | - * @return void |
|
819 | - */ |
|
820 | - protected function _insert_update_cpt_item($post_id, $post) |
|
821 | - { |
|
822 | - |
|
823 | - if ($post instanceof WP_Post && $post->post_type !== 'espresso_venues') { |
|
824 | - return;// get out we're not processing the saving of venues. |
|
825 | - } |
|
826 | - |
|
827 | - $wheres = array($this->_venue_model->primary_key_name() => $post_id); |
|
828 | - |
|
829 | - $venue_values = array( |
|
830 | - 'VNU_address' => ! empty($this->_req_data['vnu_address']) ? $this->_req_data['vnu_address'] : null, |
|
831 | - 'VNU_address2' => ! empty($this->_req_data['vnu_address2']) ? $this->_req_data['vnu_address2'] |
|
832 | - : null, |
|
833 | - 'VNU_city' => ! empty($this->_req_data['vnu_city']) ? $this->_req_data['vnu_city'] : null, |
|
834 | - 'STA_ID' => ! empty($this->_req_data['sta_id']) ? $this->_req_data['sta_id'] : null, |
|
835 | - 'CNT_ISO' => ! empty($this->_req_data['cnt_iso']) ? $this->_req_data['cnt_iso'] : null, |
|
836 | - 'VNU_zip' => ! empty($this->_req_data['vnu_zip']) ? $this->_req_data['vnu_zip'] : null, |
|
837 | - 'VNU_phone' => ! empty($this->_req_data['vnu_phone']) ? $this->_req_data['vnu_phone'] : null, |
|
838 | - 'VNU_capacity' => ! empty($this->_req_data['vnu_capacity']) ? str_replace( |
|
839 | - ',', |
|
840 | - '', |
|
841 | - $this->_req_data['vnu_capacity'] |
|
842 | - ) : EE_INF, |
|
843 | - 'VNU_url' => ! empty($this->_req_data['vnu_url']) ? $this->_req_data['vnu_url'] : null, |
|
844 | - 'VNU_virtual_phone' => ! empty($this->_req_data['vnu_virtual_phone']) |
|
845 | - ? $this->_req_data['vnu_virtual_phone'] : null, |
|
846 | - 'VNU_virtual_url' => ! empty($this->_req_data['vnu_virtual_url']) ? $this->_req_data['vnu_virtual_url'] |
|
847 | - : null, |
|
848 | - 'VNU_enable_for_gmap' => ! empty($this->_req_data['vnu_enable_for_gmap']) ? true : false, |
|
849 | - 'VNU_google_map_link' => ! empty($this->_req_data['vnu_google_map_link']) |
|
850 | - ? $this->_req_data['vnu_google_map_link'] : null, |
|
851 | - ); |
|
852 | - |
|
853 | - // update venue |
|
854 | - $success = $this->_venue_model->update($venue_values, array($wheres)); |
|
855 | - |
|
856 | - // get venue_object for other metaboxes that might be added via the filter... though it would seem to make sense to just use $this->_venue_model->get_one_by_ID( $post_id ).. i have to setup where conditions to override the filters in the model that filter out autodraft and inherit statuses so we GET the inherit id! |
|
857 | - $get_one_where = array($this->_venue_model->primary_key_name() => $post_id, 'status' => $post->post_status); |
|
858 | - $venue = $this->_venue_model->get_one(array($get_one_where)); |
|
859 | - |
|
860 | - // notice we've applied a filter for venue metabox callbacks but we don't actually have any default venue metaboxes in use. So this is just here for addons to more easily hook into venue saves. |
|
861 | - $venue_update_callbacks = apply_filters( |
|
862 | - 'FHEE__Venues_Admin_Page___insert_update_cpt_item__venue_update_callbacks', |
|
863 | - array() |
|
864 | - ); |
|
865 | - |
|
866 | - $att_success = true; |
|
867 | - |
|
868 | - foreach ($venue_update_callbacks as $v_callback) { |
|
869 | - $_succ = call_user_func_array($v_callback, array($venue, $this->_req_data)); |
|
870 | - $att_success = ! $att_success ? $att_success |
|
871 | - : $_succ; // if ANY of these updates fail then we want the appropriate global error message |
|
872 | - } |
|
873 | - |
|
874 | - // any errors? |
|
875 | - if ($success && ! $att_success) { |
|
876 | - EE_Error::add_error( |
|
877 | - __( |
|
878 | - 'Venue Details saved successfully but something went wrong with saving attachments.', |
|
879 | - 'event_espresso' |
|
880 | - ), |
|
881 | - __FILE__, |
|
882 | - __FUNCTION__, |
|
883 | - __LINE__ |
|
884 | - ); |
|
885 | - } elseif ($success === false) { |
|
886 | - EE_Error::add_error( |
|
887 | - __('Venue Details did not save successfully.', 'event_espresso'), |
|
888 | - __FILE__, |
|
889 | - __FUNCTION__, |
|
890 | - __LINE__ |
|
891 | - ); |
|
892 | - } |
|
893 | - } |
|
894 | - |
|
895 | - |
|
896 | - public function trash_cpt_item($post_id) |
|
897 | - { |
|
898 | - $this->_req_data['VNU_ID'] = $post_id; |
|
899 | - $this->_trash_or_restore_venue('trash', false); |
|
900 | - } |
|
901 | - |
|
902 | - |
|
903 | - public function restore_cpt_item($post_id) |
|
904 | - { |
|
905 | - $this->_req_data['VNU_ID'] = $post_id; |
|
906 | - $this->_trash_or_restore_venue('draft', false); |
|
907 | - } |
|
908 | - |
|
909 | - |
|
910 | - public function delete_cpt_item($post_id) |
|
911 | - { |
|
912 | - $this->_req_data['VNU_ID'] = $post_id; |
|
913 | - $this->_delete_venue(false); |
|
914 | - } |
|
915 | - |
|
916 | - |
|
917 | - public function get_venue_object() |
|
918 | - { |
|
919 | - return $this->_cpt_model_obj; |
|
920 | - } |
|
921 | - |
|
922 | - |
|
923 | - protected function _trash_or_restore_venue($venue_status = 'trash', $redirect_after = true) |
|
924 | - { |
|
925 | - $VNU_ID = isset($this->_req_data['VNU_ID']) ? absint($this->_req_data['VNU_ID']) : false; |
|
926 | - |
|
927 | - // loop thru venues |
|
928 | - if ($VNU_ID) { |
|
929 | - // clean status |
|
930 | - $venue_status = sanitize_key($venue_status); |
|
931 | - // grab status |
|
932 | - if (! empty($venue_status)) { |
|
933 | - $success = $this->_change_venue_status($VNU_ID, $venue_status); |
|
934 | - } else { |
|
935 | - $success = false; |
|
936 | - $msg = __( |
|
937 | - 'An error occurred. The venue could not be moved to the trash because a valid venue status was not not supplied.', |
|
938 | - 'event_espresso' |
|
939 | - ); |
|
940 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
941 | - } |
|
942 | - } else { |
|
943 | - $success = false; |
|
944 | - $msg = __( |
|
945 | - 'An error occurred. The venue could not be moved to the trash because a valid venue ID was not not supplied.', |
|
946 | - 'event_espresso' |
|
947 | - ); |
|
948 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
949 | - } |
|
950 | - $action = $venue_status == 'trash' ? 'moved to the trash' : 'restored from the trash'; |
|
951 | - |
|
952 | - if ($redirect_after) { |
|
953 | - $this->_redirect_after_action($success, 'Venue', $action, array('action' => 'default')); |
|
954 | - } |
|
955 | - } |
|
956 | - |
|
957 | - |
|
958 | - protected function _trash_or_restore_venues($venue_status = 'trash') |
|
959 | - { |
|
960 | - // clean status |
|
961 | - $venue_status = sanitize_key($venue_status); |
|
962 | - // grab status |
|
963 | - if (! empty($venue_status)) { |
|
964 | - $success = true; |
|
965 | - // determine the event id and set to array. |
|
966 | - $VNU_IDs = isset($this->_req_data['venue_id']) ? (array) $this->_req_data['venue_id'] : array(); |
|
967 | - // loop thru events |
|
968 | - foreach ($VNU_IDs as $VNU_ID) { |
|
969 | - if ($VNU_ID = absint($VNU_ID)) { |
|
970 | - $results = $this->_change_venue_status($VNU_ID, $venue_status); |
|
971 | - $success = $results !== false ? $success : false; |
|
972 | - } else { |
|
973 | - $msg = sprintf( |
|
974 | - __( |
|
975 | - 'An error occurred. Venue #%d could not be moved to the trash because a valid venue ID was not not supplied.', |
|
976 | - 'event_espresso' |
|
977 | - ), |
|
978 | - $VNU_ID |
|
979 | - ); |
|
980 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
981 | - $success = false; |
|
982 | - } |
|
983 | - } |
|
984 | - } else { |
|
985 | - $success = false; |
|
986 | - $msg = __( |
|
987 | - 'An error occurred. The venue could not be moved to the trash because a valid venue status was not not supplied.', |
|
988 | - 'event_espresso' |
|
989 | - ); |
|
990 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
991 | - } |
|
992 | - // in order to force a pluralized result message we need to send back a success status greater than 1 |
|
993 | - $success = $success ? 2 : false; |
|
994 | - $action = $venue_status == 'trash' ? 'moved to the trash' : 'restored from the trash'; |
|
995 | - $this->_redirect_after_action($success, 'Venues', $action, array('action' => 'default')); |
|
996 | - } |
|
997 | - |
|
998 | - |
|
999 | - /** |
|
1000 | - * _trash_or_restore_venues |
|
1001 | - * |
|
1002 | - * //todo this is pretty much the same as the corresponding change_event_status method in Events_Admin_Page. We |
|
1003 | - * should probably abstract this up to the EE_Admin_Page_CPT (or even EE_Admin_Page) and make this a common method |
|
1004 | - * accepting a certain number of params. |
|
1005 | - * |
|
1006 | - * @access private |
|
1007 | - * @param int $VNU_ID |
|
1008 | - * @param string $venue_status |
|
1009 | - * @return void |
|
1010 | - */ |
|
1011 | - private function _change_venue_status($VNU_ID = 0, $venue_status = '') |
|
1012 | - { |
|
1013 | - // grab venue id |
|
1014 | - if (! $VNU_ID) { |
|
1015 | - $msg = __('An error occurred. No Venue ID or an invalid Venue ID was received.', 'event_espresso'); |
|
1016 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1017 | - return false; |
|
1018 | - } |
|
1019 | - |
|
1020 | - $this->_cpt_model_obj = EEM_Venue::instance()->get_one_by_ID($VNU_ID); |
|
1021 | - |
|
1022 | - // clean status |
|
1023 | - $venue_status = sanitize_key($venue_status); |
|
1024 | - // grab status |
|
1025 | - if (! $venue_status) { |
|
1026 | - $msg = __('An error occurred. No Venue Status or an invalid Venue Status was received.', 'event_espresso'); |
|
1027 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1028 | - return false; |
|
1029 | - } |
|
1030 | - |
|
1031 | - // was event trashed or restored ? |
|
1032 | - switch ($venue_status) { |
|
1033 | - case 'draft': |
|
1034 | - $action = 'restored from the trash'; |
|
1035 | - $hook = 'AHEE_venue_restored_from_trash'; |
|
1036 | - break; |
|
1037 | - case 'trash': |
|
1038 | - $action = 'moved to the trash'; |
|
1039 | - $hook = 'AHEE_venue_moved_to_trash'; |
|
1040 | - break; |
|
1041 | - default: |
|
1042 | - $action = 'updated'; |
|
1043 | - $hook = false; |
|
1044 | - } |
|
1045 | - // use class to change status |
|
1046 | - $this->_cpt_model_obj->set_status($venue_status); |
|
1047 | - $success = $this->_cpt_model_obj->save(); |
|
1048 | - |
|
1049 | - if ($success === false) { |
|
1050 | - $msg = sprintf(__('An error occurred. The venue could not be %s.', 'event_espresso'), $action); |
|
1051 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1052 | - return false; |
|
1053 | - } |
|
1054 | - if ($hook) { |
|
1055 | - do_action($hook); |
|
1056 | - } |
|
1057 | - return true; |
|
1058 | - } |
|
1059 | - |
|
1060 | - |
|
1061 | - /** |
|
1062 | - * @param bool $redirect_after |
|
1063 | - * @return void |
|
1064 | - */ |
|
1065 | - protected function _delete_venue($redirect_after = true) |
|
1066 | - { |
|
1067 | - // determine the venue id and set to array. |
|
1068 | - $VNU_ID = isset($this->_req_data['VNU_ID']) ? absint($this->_req_data['VNU_ID']) : null; |
|
1069 | - $VNU_ID = isset($this->_req_data['post']) ? absint($this->_req_data['post']) : $VNU_ID; |
|
1070 | - |
|
1071 | - |
|
1072 | - // loop thru venues |
|
1073 | - if ($VNU_ID) { |
|
1074 | - $success = $this->_delete_or_trash_venue($VNU_ID); |
|
1075 | - } else { |
|
1076 | - $success = false; |
|
1077 | - $msg = __( |
|
1078 | - 'An error occurred. An venue could not be deleted because a valid venue ID was not not supplied.', |
|
1079 | - 'event_espresso' |
|
1080 | - ); |
|
1081 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1082 | - } |
|
1083 | - if ($redirect_after) { |
|
1084 | - $this->_redirect_after_action($success, 'Venue', 'deleted', array('action' => 'default')); |
|
1085 | - } |
|
1086 | - } |
|
1087 | - |
|
1088 | - |
|
1089 | - protected function _delete_venues() |
|
1090 | - { |
|
1091 | - $success = true; |
|
1092 | - // determine the event id and set to array. |
|
1093 | - $VNU_IDs = isset($this->_req_data['venue_id']) ? (array) $this->_req_data['venue_id'] : array(); |
|
1094 | - // loop thru events |
|
1095 | - foreach ($VNU_IDs as $VNU_ID) { |
|
1096 | - if ($VNU_ID = absint($VNU_ID)) { |
|
1097 | - $results = $this->_delete_or_trash_venue($VNU_ID); |
|
1098 | - $success = $results !== false ? $success : false; |
|
1099 | - } else { |
|
1100 | - $success = false; |
|
1101 | - $msg = __( |
|
1102 | - 'An error occurred. An venue could not be deleted because a valid venue ID was not not supplied.', |
|
1103 | - 'event_espresso' |
|
1104 | - ); |
|
1105 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1106 | - } |
|
1107 | - } |
|
1108 | - // in order to force a pluralized result message we need to send back a success status greater than 1 |
|
1109 | - $success = $success ? 2 : false; |
|
1110 | - $this->_redirect_after_action( |
|
1111 | - $success, |
|
1112 | - __('Venues', 'event_espresso'), |
|
1113 | - __('deleted', 'event_espresso'), |
|
1114 | - array('action' => 'default') |
|
1115 | - ); |
|
1116 | - } |
|
1117 | - |
|
1118 | - |
|
1119 | - // todo: put in parent |
|
1120 | - private function _delete_or_trash_venue($VNU_ID = false) |
|
1121 | - { |
|
1122 | - // grab event id |
|
1123 | - if (! $VNU_ID = absint($VNU_ID)) { |
|
1124 | - $msg = __('An error occurred. No Venue ID or an invalid Venue ID was received.', 'event_espresso'); |
|
1125 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1126 | - return false; |
|
1127 | - } |
|
1128 | - |
|
1129 | - |
|
1130 | - $venue = EEM_Venue::instance()->get_one_by_ID($VNU_ID); |
|
1131 | - // first need to remove all term relationships |
|
1132 | - $venue->_remove_relations('Term_Taxonomy'); |
|
1133 | - $success = $venue->delete_permanently(); |
|
1134 | - // did it all go as planned ? |
|
1135 | - if ($success) { |
|
1136 | - $msg = sprintf(__('Venue ID # %d has been deleted.', 'event_espresso'), $VNU_ID); |
|
1137 | - EE_Error::add_success($msg); |
|
1138 | - } else { |
|
1139 | - $msg = sprintf(__('An error occurred. Venue ID # %d could not be deleted.', 'event_espresso'), $VNU_ID); |
|
1140 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1141 | - return false; |
|
1142 | - } |
|
1143 | - do_action('AHEE__Venues_Admin_Page___delete_or_trash_venue__after_venue_deleted'); |
|
1144 | - return true; |
|
1145 | - } |
|
1146 | - |
|
1147 | - |
|
1148 | - |
|
1149 | - |
|
1150 | - /***********/ |
|
1151 | - /* QUERIES */ |
|
1152 | - |
|
1153 | - |
|
1154 | - public function get_venues($per_page = 10, $count = false) |
|
1155 | - { |
|
1156 | - |
|
1157 | - $_orderby = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : ''; |
|
1158 | - |
|
1159 | - switch ($_orderby) { |
|
1160 | - case 'id': |
|
1161 | - $orderby = 'VNU_ID'; |
|
1162 | - break; |
|
1163 | - |
|
1164 | - case 'capacity': |
|
1165 | - $orderby = 'VNU_capacity'; |
|
1166 | - break; |
|
1167 | - |
|
1168 | - case 'city': |
|
1169 | - $orderby = 'VNU_city'; |
|
1170 | - break; |
|
1171 | - |
|
1172 | - default: |
|
1173 | - $orderby = 'VNU_name'; |
|
1174 | - } |
|
1175 | - |
|
1176 | - |
|
1177 | - $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] |
|
1178 | - : 'ASC'; |
|
1179 | - |
|
1180 | - $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) |
|
1181 | - ? $this->_req_data['paged'] : 1; |
|
1182 | - $per_page = isset($per_page) && ! empty($per_page) ? $per_page : 10; |
|
1183 | - $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) |
|
1184 | - ? $this->_req_data['perpage'] : $per_page; |
|
1185 | - |
|
1186 | - |
|
1187 | - $offset = ($current_page - 1) * $per_page; |
|
1188 | - $limit = array($offset, $per_page); |
|
1189 | - |
|
1190 | - $category = isset($this->_req_data['category']) && $this->_req_data['category'] > 0 |
|
1191 | - ? $this->_req_data['category'] : null; |
|
1192 | - $where = array(); |
|
1193 | - |
|
1194 | - // only set initial status if it is in the incoming request. Otherwise the "all" view display's all statuses. |
|
1195 | - if (isset($this->_req_data['status']) && $this->_req_data['status'] != 'all') { |
|
1196 | - $where['status'] = $this->_req_data['status']; |
|
1197 | - } |
|
1198 | - |
|
1199 | - if (isset($this->_req_data['venue_status'])) { |
|
1200 | - $where['status'] = $this->_req_data['venue_status']; |
|
1201 | - } |
|
1202 | - |
|
1203 | - |
|
1204 | - if ($category) { |
|
1205 | - $where['Term_Taxonomy.taxonomy'] = 'espresso_venue_categories'; |
|
1206 | - $where['Term_Taxonomy.term_id'] = $category; |
|
1207 | - } |
|
1208 | - |
|
1209 | - |
|
1210 | - if (! EE_Registry::instance()->CAP->current_user_can('ee_read_others_venues', 'get_venues')) { |
|
1211 | - $where['VNU_wp_user'] = get_current_user_id(); |
|
1212 | - } else { |
|
1213 | - if (! EE_Registry::instance()->CAP->current_user_can('ee_read_private_venues', 'get_venues')) { |
|
1214 | - $where['OR'] = array( |
|
1215 | - 'status*restrict_private' => array('!=', 'private'), |
|
1216 | - 'AND' => array( |
|
1217 | - 'status*inclusive' => array('=', 'private'), |
|
1218 | - 'VNU_wp_user' => get_current_user_id(), |
|
1219 | - ), |
|
1220 | - ); |
|
1221 | - } |
|
1222 | - } |
|
1223 | - |
|
1224 | - |
|
1225 | - if (isset($this->_req_data['s'])) { |
|
1226 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
1227 | - $where['OR'] = array( |
|
1228 | - 'VNU_name' => array('LIKE', $sstr), |
|
1229 | - 'VNU_desc' => array('LIKE', $sstr), |
|
1230 | - 'VNU_short_desc' => array('LIKE', $sstr), |
|
1231 | - 'VNU_address' => array('LIKE', $sstr), |
|
1232 | - 'VNU_address2' => array('LIKE', $sstr), |
|
1233 | - 'VNU_city' => array('LIKE', $sstr), |
|
1234 | - 'VNU_zip' => array('LIKE', $sstr), |
|
1235 | - 'VNU_phone' => array('LIKE', $sstr), |
|
1236 | - 'VNU_url' => array('LIKE', $sstr), |
|
1237 | - 'VNU_virtual_phone' => array('LIKE', $sstr), |
|
1238 | - 'VNU_virtual_url' => array('LIKE', $sstr), |
|
1239 | - 'VNU_google_map_link' => array('LIKE', $sstr), |
|
1240 | - 'Event.EVT_name' => array('LIKE', $sstr), |
|
1241 | - 'Event.EVT_desc' => array('LIKE', $sstr), |
|
1242 | - 'Event.EVT_phone' => array('LIKE', $sstr), |
|
1243 | - 'Event.EVT_external_URL' => array('LIKE', $sstr), |
|
1244 | - ); |
|
1245 | - } |
|
20 | + /** |
|
21 | + * _venue |
|
22 | + * This will hold the venue object for venue_details screen. |
|
23 | + * |
|
24 | + * @access protected |
|
25 | + * @var object |
|
26 | + */ |
|
27 | + protected $_venue; |
|
28 | + |
|
29 | + |
|
30 | + /** |
|
31 | + * This will hold the category object for category_details screen. |
|
32 | + * |
|
33 | + * @var object |
|
34 | + */ |
|
35 | + protected $_category; |
|
36 | + |
|
37 | + |
|
38 | + /** |
|
39 | + * This property will hold the venue model instance |
|
40 | + * |
|
41 | + * @var object |
|
42 | + */ |
|
43 | + protected $_venue_model; |
|
44 | + |
|
45 | + |
|
46 | + protected function _init_page_props() |
|
47 | + { |
|
48 | + require_once(EE_MODELS . 'EEM_Venue.model.php'); |
|
49 | + $this->page_slug = EE_VENUES_PG_SLUG; |
|
50 | + $this->_admin_base_url = EE_VENUES_ADMIN_URL; |
|
51 | + $this->_admin_base_path = EE_ADMIN_PAGES . 'venues'; |
|
52 | + $this->page_label = __('Event Venues', 'event_espresso'); |
|
53 | + $this->_cpt_model_names = array( |
|
54 | + 'create_new' => 'EEM_Venue', |
|
55 | + 'edit' => 'EEM_Venue', |
|
56 | + ); |
|
57 | + $this->_cpt_edit_routes = array( |
|
58 | + 'espresso_venues' => 'edit', |
|
59 | + ); |
|
60 | + $this->_venue_model = EEM_Venue::instance(); |
|
61 | + } |
|
62 | + |
|
63 | + |
|
64 | + protected function _ajax_hooks() |
|
65 | + { |
|
66 | + // todo: all hooks for ee_venues ajax goes in here. |
|
67 | + } |
|
68 | + |
|
69 | + |
|
70 | + protected function _define_page_props() |
|
71 | + { |
|
72 | + $this->_admin_page_title = $this->page_label; |
|
73 | + $this->_labels = array( |
|
74 | + 'buttons' => array( |
|
75 | + 'add' => __('Add New Venue', 'event_espresso'), |
|
76 | + 'edit' => __('Edit Venue', 'event_espresso'), |
|
77 | + 'delete' => __('Delete Venue', 'event_espresso'), |
|
78 | + 'add_category' => __('Add New Category', 'event_espresso'), |
|
79 | + 'edit_category' => __('Edit Category', 'event_espresso'), |
|
80 | + 'delete_category' => __('Delete Category', 'event_espresso'), |
|
81 | + ), |
|
82 | + 'editor_title' => array( |
|
83 | + 'espresso_venues' => __('Enter Venue name here', 'event_espresso'), |
|
84 | + ), |
|
85 | + 'publishbox' => array( |
|
86 | + 'create_new' => __('Save New Venue', 'event_espresso'), |
|
87 | + 'edit' => __('Update Venue', 'event_espresso'), |
|
88 | + 'add_category' => __('Save New Category', 'event_espresso'), |
|
89 | + 'edit_category' => __('Update Category', 'event_espresso'), |
|
90 | + 'google_map_settings' => __('Update Settings', 'event_espresso'), |
|
91 | + ), |
|
92 | + ); |
|
93 | + } |
|
94 | + |
|
95 | + |
|
96 | + protected function _set_page_routes() |
|
97 | + { |
|
98 | + |
|
99 | + // load formatter helper |
|
100 | + // load field generator helper |
|
101 | + |
|
102 | + // is there a vnu_id in the request? |
|
103 | + $vnu_id = ! empty($this->_req_data['VNU_ID']) && ! is_array($this->_req_data['VNU_ID']) |
|
104 | + ? $this->_req_data['VNU_ID'] : 0; |
|
105 | + $vnu_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $vnu_id; |
|
106 | + |
|
107 | + $this->_page_routes = array( |
|
108 | + 'default' => array( |
|
109 | + 'func' => '_overview_list_table', |
|
110 | + 'capability' => 'ee_read_venues', |
|
111 | + ), |
|
112 | + 'create_new' => array( |
|
113 | + 'func' => '_create_new_cpt_item', |
|
114 | + 'capability' => 'ee_edit_venues', |
|
115 | + ), |
|
116 | + 'edit' => array( |
|
117 | + 'func' => '_edit_cpt_item', |
|
118 | + 'capability' => 'ee_edit_venue', |
|
119 | + 'obj_id' => $vnu_id, |
|
120 | + ), |
|
121 | + 'trash_venue' => array( |
|
122 | + 'func' => '_trash_or_restore_venue', |
|
123 | + 'args' => array('venue_status' => 'trash'), |
|
124 | + 'noheader' => true, |
|
125 | + 'capability' => 'ee_delete_venue', |
|
126 | + 'obj_id' => $vnu_id, |
|
127 | + ), |
|
128 | + 'trash_venues' => array( |
|
129 | + 'func' => '_trash_or_restore_venues', |
|
130 | + 'args' => array('venue_status' => 'trash'), |
|
131 | + 'noheader' => true, |
|
132 | + 'capability' => 'ee_delete_venues', |
|
133 | + ), |
|
134 | + 'restore_venue' => array( |
|
135 | + 'func' => '_trash_or_restore_venue', |
|
136 | + 'args' => array('venue_status' => 'draft'), |
|
137 | + 'noheader' => true, |
|
138 | + 'capability' => 'ee_delete_venue', |
|
139 | + 'obj_id' => $vnu_id, |
|
140 | + ), |
|
141 | + 'restore_venues' => array( |
|
142 | + 'func' => '_trash_or_restore_venues', |
|
143 | + 'args' => array('venue_status' => 'draft'), |
|
144 | + 'noheader' => true, |
|
145 | + 'capability' => 'ee_delete_venues', |
|
146 | + ), |
|
147 | + 'delete_venues' => array( |
|
148 | + 'func' => '_delete_venues', |
|
149 | + 'noheader' => true, |
|
150 | + 'capability' => 'ee_delete_venues', |
|
151 | + ), |
|
152 | + 'delete_venue' => array( |
|
153 | + 'func' => '_delete_venue', |
|
154 | + 'noheader' => true, |
|
155 | + 'capability' => 'ee_delete_venue', |
|
156 | + 'obj_id' => $vnu_id, |
|
157 | + ), |
|
158 | + // settings related |
|
159 | + 'google_map_settings' => array( |
|
160 | + 'func' => '_google_map_settings', |
|
161 | + 'capability' => 'manage_options', |
|
162 | + ), |
|
163 | + 'update_google_map_settings' => array( |
|
164 | + 'func' => '_update_google_map_settings', |
|
165 | + 'capability' => 'manage_options', |
|
166 | + 'noheader' => true, |
|
167 | + ), |
|
168 | + // venue category tab related |
|
169 | + 'add_category' => array( |
|
170 | + 'func' => '_category_details', |
|
171 | + 'args' => array('add'), |
|
172 | + 'capability' => 'ee_edit_venue_category', |
|
173 | + ), |
|
174 | + 'edit_category' => array( |
|
175 | + 'func' => '_category_details', |
|
176 | + 'args' => array('edit'), |
|
177 | + 'capability' => 'ee_edit_venue_category', |
|
178 | + ), |
|
179 | + 'delete_categories' => array( |
|
180 | + 'func' => '_delete_categories', |
|
181 | + 'noheader' => true, |
|
182 | + 'capability' => 'ee_delete_venue_category', |
|
183 | + ), |
|
184 | + |
|
185 | + 'delete_category' => array( |
|
186 | + 'func' => '_delete_categories', |
|
187 | + 'noheader' => true, |
|
188 | + 'capability' => 'ee_delete_venue_category', |
|
189 | + ), |
|
190 | + |
|
191 | + 'insert_category' => array( |
|
192 | + 'func' => '_insert_or_update_category', |
|
193 | + 'args' => array('new_category' => true), |
|
194 | + 'noheader' => true, |
|
195 | + 'capability' => 'ee_edit_venue_category', |
|
196 | + ), |
|
197 | + |
|
198 | + 'update_category' => array( |
|
199 | + 'func' => '_insert_or_update_category', |
|
200 | + 'args' => array('new_category' => false), |
|
201 | + 'noheader' => true, |
|
202 | + 'capability' => 'ee_edit_venue_category', |
|
203 | + ), |
|
204 | + 'export_categories' => array( |
|
205 | + 'func' => '_categories_export', |
|
206 | + 'noheader' => true, |
|
207 | + 'capability' => 'export', |
|
208 | + ), |
|
209 | + 'import_categories' => array( |
|
210 | + 'func' => '_import_categories', |
|
211 | + 'capability' => 'import', |
|
212 | + ), |
|
213 | + 'category_list' => array( |
|
214 | + 'func' => '_category_list_table', |
|
215 | + 'capability' => 'ee_manage_venue_categories', |
|
216 | + ), |
|
217 | + ); |
|
218 | + } |
|
219 | + |
|
220 | + |
|
221 | + protected function _set_page_config() |
|
222 | + { |
|
223 | + $this->_page_config = array( |
|
224 | + 'default' => array( |
|
225 | + 'nav' => array( |
|
226 | + 'label' => __('Overview', 'event_espresso'), |
|
227 | + 'order' => 10, |
|
228 | + ), |
|
229 | + 'list_table' => 'Venues_Admin_List_Table', |
|
230 | + 'help_tabs' => array( |
|
231 | + 'venues_overview_help_tab' => array( |
|
232 | + 'title' => __('Venues Overview', 'event_espresso'), |
|
233 | + 'filename' => 'venues_overview', |
|
234 | + ), |
|
235 | + 'venues_overview_table_column_headings_help_tab' => array( |
|
236 | + 'title' => __('Venues Overview Table Column Headings', 'event_espresso'), |
|
237 | + 'filename' => 'venues_overview_table_column_headings', |
|
238 | + ), |
|
239 | + 'venues_overview_views_bulk_actions_search_help_tab' => array( |
|
240 | + 'title' => __('Venues Overview Views & Bulk Actions & Search', 'event_espresso'), |
|
241 | + 'filename' => 'venues_overview_views_bulk_actions_search', |
|
242 | + ), |
|
243 | + ), |
|
244 | + 'help_tour' => array('Venues_Overview_Help_Tour'), |
|
245 | + 'metaboxes' => array('_espresso_news_post_box', '_espresso_links_post_box'), |
|
246 | + 'require_nonce' => false, |
|
247 | + ), |
|
248 | + 'create_new' => array( |
|
249 | + 'nav' => array( |
|
250 | + 'label' => __('Add Venue', 'event_espresso'), |
|
251 | + 'order' => 5, |
|
252 | + 'persistent' => false, |
|
253 | + ), |
|
254 | + 'help_tabs' => array( |
|
255 | + 'venues_editor_help_tab' => array( |
|
256 | + 'title' => __('Venue Editor', 'event_espresso'), |
|
257 | + 'filename' => 'venues_editor', |
|
258 | + ), |
|
259 | + 'venues_editor_title_richtexteditor_help_tab' => array( |
|
260 | + 'title' => __('Venue Title & Rich Text Editor', 'event_espresso'), |
|
261 | + 'filename' => 'venues_editor_title_richtexteditor', |
|
262 | + ), |
|
263 | + 'venues_editor_tags_categories_help_tab' => array( |
|
264 | + 'title' => __('Venue Tags & Categories', 'event_espresso'), |
|
265 | + 'filename' => 'venues_editor_tags_categories', |
|
266 | + ), |
|
267 | + 'venues_editor_physical_location_google_map_virtual_location_help_tab' => array( |
|
268 | + 'title' => __( |
|
269 | + 'Venue Editor Physical Location & Google Map & Virtual Location', |
|
270 | + 'event_espresso' |
|
271 | + ), |
|
272 | + 'filename' => 'venues_editor_physical_location_google_map_virtual_location', |
|
273 | + ), |
|
274 | + 'venues_editor_save_new_venue_help_tab' => array( |
|
275 | + 'title' => __('Save New Venue', 'event_espresso'), |
|
276 | + 'filename' => 'venues_editor_save_new_venue', |
|
277 | + ), |
|
278 | + 'venues_editor_other_help_tab' => array( |
|
279 | + 'title' => __('Venue Editor Other', 'event_espresso'), |
|
280 | + 'filename' => 'venues_editor_other', |
|
281 | + ), |
|
282 | + ), |
|
283 | + 'help_tour' => array('Venues_Add_Venue_Help_Tour'), |
|
284 | + 'metaboxes' => array('_venue_editor_metaboxes'), |
|
285 | + 'require_nonce' => false, |
|
286 | + ), |
|
287 | + 'edit' => array( |
|
288 | + 'nav' => array( |
|
289 | + 'label' => __('Edit Venue', 'event_espresso'), |
|
290 | + 'order' => 5, |
|
291 | + 'persistent' => false, |
|
292 | + 'url' => isset($this->_req_data['post']) ? add_query_arg( |
|
293 | + array('post' => $this->_req_data['post']), |
|
294 | + $this->_current_page_view_url |
|
295 | + ) : $this->_admin_base_url, |
|
296 | + ), |
|
297 | + 'help_tabs' => array( |
|
298 | + 'venues_editor_help_tab' => array( |
|
299 | + 'title' => __('Venue Editor', 'event_espresso'), |
|
300 | + 'filename' => 'venues_editor', |
|
301 | + ), |
|
302 | + 'venues_editor_title_richtexteditor_help_tab' => array( |
|
303 | + 'title' => __('Venue Title & Rich Text Editor', 'event_espresso'), |
|
304 | + 'filename' => 'venues_editor_title_richtexteditor', |
|
305 | + ), |
|
306 | + 'venues_editor_tags_categories_help_tab' => array( |
|
307 | + 'title' => __('Venue Tags & Categories', 'event_espresso'), |
|
308 | + 'filename' => 'venues_editor_tags_categories', |
|
309 | + ), |
|
310 | + 'venues_editor_physical_location_google_map_virtual_location_help_tab' => array( |
|
311 | + 'title' => __( |
|
312 | + 'Venue Editor Physical Location & Google Map & Virtual Location', |
|
313 | + 'event_espresso' |
|
314 | + ), |
|
315 | + 'filename' => 'venues_editor_physical_location_google_map_virtual_location', |
|
316 | + ), |
|
317 | + 'venues_editor_save_new_venue_help_tab' => array( |
|
318 | + 'title' => __('Save New Venue', 'event_espresso'), |
|
319 | + 'filename' => 'venues_editor_save_new_venue', |
|
320 | + ), |
|
321 | + 'venues_editor_other_help_tab' => array( |
|
322 | + 'title' => __('Venue Editor Other', 'event_espresso'), |
|
323 | + 'filename' => 'venues_editor_other', |
|
324 | + ), |
|
325 | + ), |
|
326 | + /*'help_tour' => array( 'Venues_Edit_Venue_Help_Tour' ),*/ |
|
327 | + 'metaboxes' => array('_venue_editor_metaboxes'), |
|
328 | + 'require_nonce' => false, |
|
329 | + ), |
|
330 | + 'google_map_settings' => array( |
|
331 | + 'nav' => array( |
|
332 | + 'label' => esc_html__('Google Maps', 'event_espresso'), |
|
333 | + 'order' => 40, |
|
334 | + ), |
|
335 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
336 | + 'help_tabs' => array( |
|
337 | + 'general_settings_google_maps_help_tab' => array( |
|
338 | + 'title' => __('Google Maps', 'event_espresso'), |
|
339 | + 'filename' => 'general_settings_google_maps', |
|
340 | + ), |
|
341 | + ), |
|
342 | + 'help_tour' => array('Google_Maps_Help_Tour'), |
|
343 | + 'require_nonce' => false, |
|
344 | + ), |
|
345 | + // venue category stuff |
|
346 | + 'add_category' => array( |
|
347 | + 'nav' => array( |
|
348 | + 'label' => __('Add Category', 'event_espresso'), |
|
349 | + 'order' => 15, |
|
350 | + 'persistent' => false, |
|
351 | + ), |
|
352 | + 'metaboxes' => array('_publish_post_box'), |
|
353 | + 'help_tabs' => array( |
|
354 | + 'venues_add_category_help_tab' => array( |
|
355 | + 'title' => __('Add New Venue Category', 'event_espresso'), |
|
356 | + 'filename' => 'venues_add_category', |
|
357 | + ), |
|
358 | + ), |
|
359 | + 'help_tour' => array('Venues_Add_Category_Help_Tour'), |
|
360 | + 'require_nonce' => false, |
|
361 | + ), |
|
362 | + 'edit_category' => array( |
|
363 | + 'nav' => array( |
|
364 | + 'label' => __('Edit Category', 'event_espresso'), |
|
365 | + 'order' => 15, |
|
366 | + 'persistent' => false, |
|
367 | + 'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg( |
|
368 | + array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID']), |
|
369 | + $this->_current_page_view_url |
|
370 | + ) : $this->_admin_base_url, |
|
371 | + ), |
|
372 | + 'metaboxes' => array('_publish_post_box'), |
|
373 | + 'help_tabs' => array( |
|
374 | + 'venues_edit_category_help_tab' => array( |
|
375 | + 'title' => __('Edit Venue Category', 'event_espresso'), |
|
376 | + 'filename' => 'venues_edit_category', |
|
377 | + ), |
|
378 | + ), |
|
379 | + /*'help_tour' => array( 'Venues_Edit_Category_Help_Tour' ),*/ |
|
380 | + 'require_nonce' => false, |
|
381 | + ), |
|
382 | + 'category_list' => array( |
|
383 | + 'nav' => array( |
|
384 | + 'label' => __('Categories', 'event_espresso'), |
|
385 | + 'order' => 20, |
|
386 | + ), |
|
387 | + 'list_table' => 'Venue_Categories_Admin_List_Table', |
|
388 | + 'help_tabs' => array( |
|
389 | + 'venues_categories_help_tab' => array( |
|
390 | + 'title' => __('Venue Categories', 'event_espresso'), |
|
391 | + 'filename' => 'venues_categories', |
|
392 | + ), |
|
393 | + 'venues_categories_table_column_headings_help_tab' => array( |
|
394 | + 'title' => __('Venue Categories Table Column Headings', 'event_espresso'), |
|
395 | + 'filename' => 'venues_categories_table_column_headings', |
|
396 | + ), |
|
397 | + 'venues_categories_views_help_tab' => array( |
|
398 | + 'title' => __('Venue Categories Views', 'event_espresso'), |
|
399 | + 'filename' => 'venues_categories_views', |
|
400 | + ), |
|
401 | + 'venues_categories_other_help_tab' => array( |
|
402 | + 'title' => __('Venue Categories Other', 'event_espresso'), |
|
403 | + 'filename' => 'venues_categories_other', |
|
404 | + ), |
|
405 | + ), |
|
406 | + 'help_tour' => array('Venues_Categories_Help_Tour'), |
|
407 | + 'metaboxes' => $this->_default_espresso_metaboxes, |
|
408 | + 'require_nonce' => false, |
|
409 | + ), |
|
410 | + ); |
|
411 | + } |
|
412 | + |
|
413 | + |
|
414 | + protected function _add_screen_options() |
|
415 | + { |
|
416 | + // todo |
|
417 | + } |
|
418 | + |
|
419 | + |
|
420 | + protected function _add_screen_options_default() |
|
421 | + { |
|
422 | + $this->_per_page_screen_option(); |
|
423 | + } |
|
424 | + |
|
425 | + |
|
426 | + protected function _add_screen_options_category_list() |
|
427 | + { |
|
428 | + $page_title = $this->_admin_page_title; |
|
429 | + $this->_admin_page_title = __('Venue Categories', 'event_espresso'); |
|
430 | + $this->_per_page_screen_option(); |
|
431 | + $this->_admin_page_title = $page_title; |
|
432 | + } |
|
433 | + |
|
434 | + |
|
435 | + // none of the below group are currently used for Event Venues |
|
436 | + protected function _add_feature_pointers() |
|
437 | + { |
|
438 | + } |
|
439 | + |
|
440 | + public function admin_init() |
|
441 | + { |
|
442 | + } |
|
443 | + |
|
444 | + public function admin_notices() |
|
445 | + { |
|
446 | + } |
|
447 | + |
|
448 | + public function admin_footer_scripts() |
|
449 | + { |
|
450 | + } |
|
451 | + |
|
452 | + |
|
453 | + public function load_scripts_styles_create_new() |
|
454 | + { |
|
455 | + $this->load_scripts_styles_edit(); |
|
456 | + } |
|
457 | + |
|
458 | + |
|
459 | + public function load_scripts_styles() |
|
460 | + { |
|
461 | + wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL . 'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION); |
|
462 | + wp_enqueue_style('ee-cat-admin'); |
|
463 | + } |
|
464 | + |
|
465 | + |
|
466 | + public function load_scripts_styles_add_category() |
|
467 | + { |
|
468 | + $this->load_scripts_styles_edit_category(); |
|
469 | + } |
|
470 | + |
|
471 | + |
|
472 | + public function load_scripts_styles_edit_category() |
|
473 | + { |
|
474 | + } |
|
475 | + |
|
476 | + |
|
477 | + public function load_scripts_styles_edit() |
|
478 | + { |
|
479 | + // styles |
|
480 | + wp_enqueue_style('espresso-ui-theme'); |
|
481 | + wp_register_style( |
|
482 | + 'espresso_venues', |
|
483 | + EE_VENUES_ASSETS_URL . 'ee-venues-admin.css', |
|
484 | + array(), |
|
485 | + EVENT_ESPRESSO_VERSION |
|
486 | + ); |
|
487 | + wp_enqueue_style('espresso_venues'); |
|
488 | + } |
|
489 | + |
|
490 | + |
|
491 | + protected function _set_list_table_views_default() |
|
492 | + { |
|
493 | + $this->_views = array( |
|
494 | + 'all' => array( |
|
495 | + 'slug' => 'all', |
|
496 | + 'label' => __('View All Venues', 'event_espresso'), |
|
497 | + 'count' => 0, |
|
498 | + 'bulk_action' => array(), |
|
499 | + ), |
|
500 | + ); |
|
501 | + |
|
502 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_venues', 'espresso_venues_trash_venues')) { |
|
503 | + $this->_views['all']['bulk_action'] = array( |
|
504 | + 'trash_venues' => __('Move to Trash', 'event_espresso'), |
|
505 | + ); |
|
506 | + $this->_views['trash'] = array( |
|
507 | + 'slug' => 'trash', |
|
508 | + 'label' => __('Trash', 'event_espresso'), |
|
509 | + 'count' => 0, |
|
510 | + 'bulk_action' => array( |
|
511 | + 'restore_venues' => __('Restore from Trash', 'event_espresso'), |
|
512 | + 'delete_venues' => __('Delete', 'event_espresso'), |
|
513 | + ), |
|
514 | + ); |
|
515 | + } |
|
516 | + } |
|
517 | + |
|
518 | + |
|
519 | + protected function _set_list_table_views_category_list() |
|
520 | + { |
|
521 | + $this->_views = array( |
|
522 | + 'all' => array( |
|
523 | + 'slug' => 'all', |
|
524 | + 'label' => __('All', 'event_espresso'), |
|
525 | + 'count' => 0, |
|
526 | + 'bulk_action' => array( |
|
527 | + 'delete_categories' => __('Delete Permanently', 'event_espresso'), |
|
528 | + ), |
|
529 | + ), |
|
530 | + ); |
|
531 | + } |
|
532 | + |
|
533 | + |
|
534 | + protected function _overview_list_table() |
|
535 | + { |
|
536 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
537 | + $this->_template_args['after_list_table'] = EEH_Template::get_button_or_link( |
|
538 | + get_post_type_archive_link('espresso_venues'), |
|
539 | + __("View Venue Archive Page", "event_espresso"), |
|
540 | + 'button' |
|
541 | + ); |
|
542 | + $this->_admin_page_title .= ' ' . $this->get_action_link_or_button('create_new', 'add', array(), 'add-new-h2'); |
|
543 | + $this->_search_btn_label = __('Venues', 'event_espresso'); |
|
544 | + $this->display_admin_list_table_page_with_sidebar(); |
|
545 | + } |
|
546 | + |
|
547 | + |
|
548 | + public function extra_misc_actions_publish_box() |
|
549 | + { |
|
550 | + $extra_rows = array( |
|
551 | + 'vnu_capacity' => $this->_cpt_model_obj->get_f('VNU_capacity'), |
|
552 | + 'vnu_url' => $this->_cpt_model_obj->get_f('VNU_url'), |
|
553 | + 'vnu_phone' => $this->_cpt_model_obj->get_f('VNU_phone'), |
|
554 | + ); |
|
555 | + $template = EE_VENUES_TEMPLATE_PATH . 'venue_publish_box_extras.template.php'; |
|
556 | + EEH_Template::display_template($template, $extra_rows); |
|
557 | + } |
|
558 | + |
|
559 | + |
|
560 | + /************* Google Maps *************/ |
|
561 | + |
|
562 | + |
|
563 | + protected function _google_map_settings() |
|
564 | + { |
|
565 | + |
|
566 | + |
|
567 | + $this->_template_args['values'] = $this->_yes_no_values; |
|
568 | + $default_map_settings = new stdClass(); |
|
569 | + $default_map_settings->use_google_maps = true; |
|
570 | + $default_map_settings->google_map_api_key = ''; |
|
571 | + // for event details pages (reg page) |
|
572 | + $default_map_settings->event_details_map_width = 585; // ee_map_width_single |
|
573 | + $default_map_settings->event_details_map_height = 362; // ee_map_height_single |
|
574 | + $default_map_settings->event_details_map_zoom = 14; // ee_map_zoom_single |
|
575 | + $default_map_settings->event_details_display_nav = true; // ee_map_nav_display_single |
|
576 | + $default_map_settings->event_details_nav_size = false; // ee_map_nav_size_single |
|
577 | + $default_map_settings->event_details_control_type = 'default'; // ee_map_type_control_single |
|
578 | + $default_map_settings->event_details_map_align = 'center'; // ee_map_align_single |
|
579 | + // for event list pages |
|
580 | + $default_map_settings->event_list_map_width = 300; // ee_map_width |
|
581 | + $default_map_settings->event_list_map_height = 185; // ee_map_height |
|
582 | + $default_map_settings->event_list_map_zoom = 12; // ee_map_zoom |
|
583 | + $default_map_settings->event_list_display_nav = false; // ee_map_nav_display |
|
584 | + $default_map_settings->event_list_nav_size = true; // ee_map_nav_size |
|
585 | + $default_map_settings->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
586 | + $default_map_settings->event_list_map_align = 'center'; // ee_map_align |
|
587 | + |
|
588 | + $this->_template_args['map_settings'] = |
|
589 | + isset(EE_Registry::instance()->CFG->map_settings) |
|
590 | + && ! empty(EE_Registry::instance()->CFG->map_settings) |
|
591 | + ? (object) array_merge( |
|
592 | + (array) $default_map_settings, |
|
593 | + (array) EE_Registry::instance()->CFG->map_settings |
|
594 | + ) |
|
595 | + : $default_map_settings; |
|
596 | + |
|
597 | + $this->_set_add_edit_form_tags('update_google_map_settings'); |
|
598 | + $this->_set_publish_post_box_vars(null, false, false, null, false); |
|
599 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
|
600 | + EE_VENUES_TEMPLATE_PATH . 'google_map.template.php', |
|
601 | + $this->_template_args, |
|
602 | + true |
|
603 | + ); |
|
604 | + $this->display_admin_page_with_sidebar(); |
|
605 | + } |
|
606 | + |
|
607 | + protected function _update_google_map_settings() |
|
608 | + { |
|
609 | + |
|
610 | + EE_Registry::instance()->CFG->map_settings->use_google_maps = |
|
611 | + isset($this->_req_data['use_google_maps']) |
|
612 | + ? absint($this->_req_data['use_google_maps']) |
|
613 | + : EE_Registry::instance()->CFG->map_settings->use_google_maps; |
|
614 | + |
|
615 | + EE_Registry::instance()->CFG->map_settings->google_map_api_key = |
|
616 | + isset($this->_req_data['google_map_api_key']) |
|
617 | + ? sanitize_text_field($this->_req_data['google_map_api_key']) |
|
618 | + : EE_Registry::instance()->CFG->map_settings->google_map_api_key; |
|
619 | + |
|
620 | + EE_Registry::instance()->CFG->map_settings->event_details_map_width = |
|
621 | + isset($this->_req_data['event_details_map_width']) |
|
622 | + ? absint($this->_req_data['event_details_map_width']) |
|
623 | + : EE_Registry::instance()->CFG->map_settings->event_details_map_width; |
|
624 | + |
|
625 | + EE_Registry::instance()->CFG->map_settings->event_details_map_height = |
|
626 | + isset($this->_req_data['event_details_map_height']) |
|
627 | + ? absint($this->_req_data['event_details_map_height']) |
|
628 | + : EE_Registry::instance()->CFG->map_settings->event_details_map_height; |
|
629 | + |
|
630 | + EE_Registry::instance()->CFG->map_settings->event_details_map_zoom = |
|
631 | + isset($this->_req_data['event_details_map_zoom']) |
|
632 | + ? absint($this->_req_data['event_details_map_zoom']) |
|
633 | + : EE_Registry::instance()->CFG->map_settings->event_details_map_zoom; |
|
634 | + |
|
635 | + EE_Registry::instance()->CFG->map_settings->event_details_display_nav = |
|
636 | + isset($this->_req_data['event_details_display_nav']) |
|
637 | + ? absint($this->_req_data['event_details_display_nav']) |
|
638 | + : EE_Registry::instance()->CFG->map_settings->event_details_display_nav; |
|
639 | + |
|
640 | + EE_Registry::instance()->CFG->map_settings->event_details_nav_size = |
|
641 | + isset($this->_req_data['event_details_nav_size']) |
|
642 | + ? absint($this->_req_data['event_details_nav_size']) |
|
643 | + : EE_Registry::instance()->CFG->map_settings->event_details_nav_size; |
|
644 | + |
|
645 | + EE_Registry::instance()->CFG->map_settings->event_details_control_type = |
|
646 | + isset($this->_req_data['event_details_control_type']) |
|
647 | + ? sanitize_text_field($this->_req_data['event_details_control_type']) |
|
648 | + : EE_Registry::instance()->CFG->map_settings->event_details_control_type; |
|
649 | + |
|
650 | + EE_Registry::instance()->CFG->map_settings->event_details_map_align = |
|
651 | + isset($this->_req_data['event_details_map_align']) |
|
652 | + ? sanitize_text_field($this->_req_data['event_details_map_align']) |
|
653 | + : EE_Registry::instance()->CFG->map_settings->event_details_map_align; |
|
654 | + |
|
655 | + EE_Registry::instance()->CFG->map_settings->event_list_map_width = |
|
656 | + isset($this->_req_data['event_list_map_width']) |
|
657 | + ? absint($this->_req_data['event_list_map_width']) |
|
658 | + : EE_Registry::instance()->CFG->map_settings->event_list_map_width; |
|
659 | + |
|
660 | + EE_Registry::instance()->CFG->map_settings->event_list_map_height = |
|
661 | + isset($this->_req_data['event_list_map_height']) |
|
662 | + ? absint($this->_req_data['event_list_map_height']) |
|
663 | + : EE_Registry::instance()->CFG->map_settings->event_list_map_height; |
|
664 | + |
|
665 | + EE_Registry::instance()->CFG->map_settings->event_list_map_zoom = |
|
666 | + isset($this->_req_data['event_list_map_zoom']) |
|
667 | + ? absint($this->_req_data['event_list_map_zoom']) |
|
668 | + : EE_Registry::instance()->CFG->map_settings->event_list_map_zoom; |
|
669 | + |
|
670 | + EE_Registry::instance()->CFG->map_settings->event_list_display_nav = |
|
671 | + isset($this->_req_data['event_list_display_nav']) |
|
672 | + ? absint($this->_req_data['event_list_display_nav']) |
|
673 | + : EE_Registry::instance()->CFG->map_settings->event_list_display_nav; |
|
674 | + |
|
675 | + EE_Registry::instance()->CFG->map_settings->event_list_nav_size = |
|
676 | + isset($this->_req_data['event_list_nav_size']) |
|
677 | + ? absint($this->_req_data['event_list_nav_size']) |
|
678 | + : EE_Registry::instance()->CFG->map_settings->event_list_nav_size; |
|
679 | + |
|
680 | + EE_Registry::instance()->CFG->map_settings->event_list_control_type = |
|
681 | + isset($this->_req_data['event_list_control_type']) |
|
682 | + ? sanitize_text_field($this->_req_data['event_list_control_type']) |
|
683 | + : EE_Registry::instance()->CFG->map_settings->event_list_control_type; |
|
684 | + |
|
685 | + EE_Registry::instance()->CFG->map_settings->event_list_map_align = |
|
686 | + isset($this->_req_data['event_list_map_align']) |
|
687 | + ? sanitize_text_field($this->_req_data['event_list_map_align']) |
|
688 | + : EE_Registry::instance()->CFG->map_settings->event_list_map_align; |
|
689 | + |
|
690 | + EE_Registry::instance()->CFG->map_settings = apply_filters( |
|
691 | + 'FHEE__Extend_General_Settings_Admin_Page___update_google_map_settings__CFG_map_settings', |
|
692 | + EE_Registry::instance()->CFG->map_settings |
|
693 | + ); |
|
694 | + |
|
695 | + $what = 'Google Map Settings'; |
|
696 | + $success = $this->_update_espresso_configuration( |
|
697 | + $what, |
|
698 | + EE_Registry::instance()->CFG->map_settings, |
|
699 | + __FILE__, |
|
700 | + __FUNCTION__, |
|
701 | + __LINE__ |
|
702 | + ); |
|
703 | + $this->_redirect_after_action($success, $what, 'updated', array('action' => 'google_map_settings')); |
|
704 | + } |
|
705 | + |
|
706 | + |
|
707 | + protected function _venue_editor_metaboxes() |
|
708 | + { |
|
709 | + $this->verify_cpt_object(); |
|
710 | + |
|
711 | + add_meta_box( |
|
712 | + 'espresso_venue_address_options', |
|
713 | + __('Physical Location', 'event_espresso'), |
|
714 | + array($this, 'venue_address_metabox'), |
|
715 | + $this->page_slug, |
|
716 | + 'side', |
|
717 | + 'default' |
|
718 | + ); |
|
719 | + add_meta_box( |
|
720 | + 'espresso_venue_gmap_options', |
|
721 | + __('Google Map', 'event_espresso'), |
|
722 | + array($this, 'venue_gmap_metabox'), |
|
723 | + $this->page_slug, |
|
724 | + 'side', |
|
725 | + 'default' |
|
726 | + ); |
|
727 | + add_meta_box( |
|
728 | + 'espresso_venue_virtual_loc_options', |
|
729 | + __('Virtual Location', 'event_espresso'), |
|
730 | + array($this, 'venue_virtual_loc_metabox'), |
|
731 | + $this->page_slug, |
|
732 | + 'side', |
|
733 | + 'default' |
|
734 | + ); |
|
735 | + } |
|
736 | + |
|
737 | + |
|
738 | + public function venue_gmap_metabox() |
|
739 | + { |
|
740 | + $template_args = array( |
|
741 | + 'vnu_enable_for_gmap' => EEH_Form_Fields::select_input( |
|
742 | + 'vnu_enable_for_gmap', |
|
743 | + $this->get_yes_no_values(), |
|
744 | + $this->_cpt_model_obj->enable_for_gmap() |
|
745 | + ), |
|
746 | + 'vnu_google_map_link' => $this->_cpt_model_obj->google_map_link(), |
|
747 | + ); |
|
748 | + $template = EE_VENUES_TEMPLATE_PATH . 'venue_gmap_metabox_content.template.php'; |
|
749 | + EEH_Template::display_template($template, $template_args); |
|
750 | + } |
|
751 | + |
|
752 | + |
|
753 | + public function venue_address_metabox() |
|
754 | + { |
|
755 | + |
|
756 | + $template_args['_venue'] = $this->_cpt_model_obj; |
|
757 | + |
|
758 | + $template_args['states_dropdown'] = EEH_Form_Fields::generate_form_input( |
|
759 | + $QFI = new EE_Question_Form_Input( |
|
760 | + EE_Question::new_instance( |
|
761 | + array('QST_display_text' => esc_html__('State', 'event_espresso'), 'QST_system' => 'state') |
|
762 | + ), |
|
763 | + EE_Answer::new_instance(array('ANS_value' => $this->_cpt_model_obj->state_ID())), |
|
764 | + array( |
|
765 | + 'input_name' => 'sta_id', |
|
766 | + 'input_id' => 'sta_id', |
|
767 | + 'input_class' => '', |
|
768 | + 'input_prefix' => '', |
|
769 | + 'append_qstn_id' => false, |
|
770 | + ) |
|
771 | + ) |
|
772 | + ); |
|
773 | + $template_args['countries_dropdown'] = EEH_Form_Fields::generate_form_input( |
|
774 | + $QFI = new EE_Question_Form_Input( |
|
775 | + EE_Question::new_instance( |
|
776 | + array('QST_display_text' => esc_html__('Country', 'event_espresso'), 'QST_system' => 'country') |
|
777 | + ), |
|
778 | + EE_Answer::new_instance(array('ANS_value' => $this->_cpt_model_obj->country_ID())), |
|
779 | + array( |
|
780 | + 'input_name' => 'cnt_iso', |
|
781 | + 'input_id' => 'cnt_iso', |
|
782 | + 'input_class' => '', |
|
783 | + 'input_prefix' => '', |
|
784 | + 'append_qstn_id' => false, |
|
785 | + ) |
|
786 | + ) |
|
787 | + ); |
|
788 | + |
|
789 | + $template = EE_VENUES_TEMPLATE_PATH . 'venue_address_metabox_content.template.php'; |
|
790 | + EEH_Template::display_template($template, $template_args); |
|
791 | + } |
|
792 | + |
|
793 | + |
|
794 | + public function venue_virtual_loc_metabox() |
|
795 | + { |
|
796 | + $template_args = array( |
|
797 | + '_venue' => $this->_cpt_model_obj, |
|
798 | + ); |
|
799 | + $template = EE_VENUES_TEMPLATE_PATH . 'venue_virtual_location_metabox_content.template.php'; |
|
800 | + EEH_Template::display_template($template, $template_args); |
|
801 | + } |
|
802 | + |
|
803 | + |
|
804 | + protected function _restore_cpt_item($post_id, $revision_id) |
|
805 | + { |
|
806 | + $venue_obj = $this->_venue_model->get_one_by_ID($post_id); |
|
807 | + |
|
808 | + // meta revision restore |
|
809 | + $venue_obj->restore_revision($revision_id); |
|
810 | + } |
|
811 | + |
|
812 | + |
|
813 | + /** |
|
814 | + * Handles updates for venue cpts |
|
815 | + * |
|
816 | + * @param int $post_id ID of Venue CPT |
|
817 | + * @param object $post Post object (with "blessed" WP properties) |
|
818 | + * @return void |
|
819 | + */ |
|
820 | + protected function _insert_update_cpt_item($post_id, $post) |
|
821 | + { |
|
822 | + |
|
823 | + if ($post instanceof WP_Post && $post->post_type !== 'espresso_venues') { |
|
824 | + return;// get out we're not processing the saving of venues. |
|
825 | + } |
|
826 | + |
|
827 | + $wheres = array($this->_venue_model->primary_key_name() => $post_id); |
|
828 | + |
|
829 | + $venue_values = array( |
|
830 | + 'VNU_address' => ! empty($this->_req_data['vnu_address']) ? $this->_req_data['vnu_address'] : null, |
|
831 | + 'VNU_address2' => ! empty($this->_req_data['vnu_address2']) ? $this->_req_data['vnu_address2'] |
|
832 | + : null, |
|
833 | + 'VNU_city' => ! empty($this->_req_data['vnu_city']) ? $this->_req_data['vnu_city'] : null, |
|
834 | + 'STA_ID' => ! empty($this->_req_data['sta_id']) ? $this->_req_data['sta_id'] : null, |
|
835 | + 'CNT_ISO' => ! empty($this->_req_data['cnt_iso']) ? $this->_req_data['cnt_iso'] : null, |
|
836 | + 'VNU_zip' => ! empty($this->_req_data['vnu_zip']) ? $this->_req_data['vnu_zip'] : null, |
|
837 | + 'VNU_phone' => ! empty($this->_req_data['vnu_phone']) ? $this->_req_data['vnu_phone'] : null, |
|
838 | + 'VNU_capacity' => ! empty($this->_req_data['vnu_capacity']) ? str_replace( |
|
839 | + ',', |
|
840 | + '', |
|
841 | + $this->_req_data['vnu_capacity'] |
|
842 | + ) : EE_INF, |
|
843 | + 'VNU_url' => ! empty($this->_req_data['vnu_url']) ? $this->_req_data['vnu_url'] : null, |
|
844 | + 'VNU_virtual_phone' => ! empty($this->_req_data['vnu_virtual_phone']) |
|
845 | + ? $this->_req_data['vnu_virtual_phone'] : null, |
|
846 | + 'VNU_virtual_url' => ! empty($this->_req_data['vnu_virtual_url']) ? $this->_req_data['vnu_virtual_url'] |
|
847 | + : null, |
|
848 | + 'VNU_enable_for_gmap' => ! empty($this->_req_data['vnu_enable_for_gmap']) ? true : false, |
|
849 | + 'VNU_google_map_link' => ! empty($this->_req_data['vnu_google_map_link']) |
|
850 | + ? $this->_req_data['vnu_google_map_link'] : null, |
|
851 | + ); |
|
852 | + |
|
853 | + // update venue |
|
854 | + $success = $this->_venue_model->update($venue_values, array($wheres)); |
|
855 | + |
|
856 | + // get venue_object for other metaboxes that might be added via the filter... though it would seem to make sense to just use $this->_venue_model->get_one_by_ID( $post_id ).. i have to setup where conditions to override the filters in the model that filter out autodraft and inherit statuses so we GET the inherit id! |
|
857 | + $get_one_where = array($this->_venue_model->primary_key_name() => $post_id, 'status' => $post->post_status); |
|
858 | + $venue = $this->_venue_model->get_one(array($get_one_where)); |
|
859 | + |
|
860 | + // notice we've applied a filter for venue metabox callbacks but we don't actually have any default venue metaboxes in use. So this is just here for addons to more easily hook into venue saves. |
|
861 | + $venue_update_callbacks = apply_filters( |
|
862 | + 'FHEE__Venues_Admin_Page___insert_update_cpt_item__venue_update_callbacks', |
|
863 | + array() |
|
864 | + ); |
|
865 | + |
|
866 | + $att_success = true; |
|
867 | + |
|
868 | + foreach ($venue_update_callbacks as $v_callback) { |
|
869 | + $_succ = call_user_func_array($v_callback, array($venue, $this->_req_data)); |
|
870 | + $att_success = ! $att_success ? $att_success |
|
871 | + : $_succ; // if ANY of these updates fail then we want the appropriate global error message |
|
872 | + } |
|
873 | + |
|
874 | + // any errors? |
|
875 | + if ($success && ! $att_success) { |
|
876 | + EE_Error::add_error( |
|
877 | + __( |
|
878 | + 'Venue Details saved successfully but something went wrong with saving attachments.', |
|
879 | + 'event_espresso' |
|
880 | + ), |
|
881 | + __FILE__, |
|
882 | + __FUNCTION__, |
|
883 | + __LINE__ |
|
884 | + ); |
|
885 | + } elseif ($success === false) { |
|
886 | + EE_Error::add_error( |
|
887 | + __('Venue Details did not save successfully.', 'event_espresso'), |
|
888 | + __FILE__, |
|
889 | + __FUNCTION__, |
|
890 | + __LINE__ |
|
891 | + ); |
|
892 | + } |
|
893 | + } |
|
894 | + |
|
895 | + |
|
896 | + public function trash_cpt_item($post_id) |
|
897 | + { |
|
898 | + $this->_req_data['VNU_ID'] = $post_id; |
|
899 | + $this->_trash_or_restore_venue('trash', false); |
|
900 | + } |
|
901 | + |
|
902 | + |
|
903 | + public function restore_cpt_item($post_id) |
|
904 | + { |
|
905 | + $this->_req_data['VNU_ID'] = $post_id; |
|
906 | + $this->_trash_or_restore_venue('draft', false); |
|
907 | + } |
|
908 | + |
|
909 | + |
|
910 | + public function delete_cpt_item($post_id) |
|
911 | + { |
|
912 | + $this->_req_data['VNU_ID'] = $post_id; |
|
913 | + $this->_delete_venue(false); |
|
914 | + } |
|
915 | + |
|
916 | + |
|
917 | + public function get_venue_object() |
|
918 | + { |
|
919 | + return $this->_cpt_model_obj; |
|
920 | + } |
|
921 | + |
|
922 | + |
|
923 | + protected function _trash_or_restore_venue($venue_status = 'trash', $redirect_after = true) |
|
924 | + { |
|
925 | + $VNU_ID = isset($this->_req_data['VNU_ID']) ? absint($this->_req_data['VNU_ID']) : false; |
|
926 | + |
|
927 | + // loop thru venues |
|
928 | + if ($VNU_ID) { |
|
929 | + // clean status |
|
930 | + $venue_status = sanitize_key($venue_status); |
|
931 | + // grab status |
|
932 | + if (! empty($venue_status)) { |
|
933 | + $success = $this->_change_venue_status($VNU_ID, $venue_status); |
|
934 | + } else { |
|
935 | + $success = false; |
|
936 | + $msg = __( |
|
937 | + 'An error occurred. The venue could not be moved to the trash because a valid venue status was not not supplied.', |
|
938 | + 'event_espresso' |
|
939 | + ); |
|
940 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
941 | + } |
|
942 | + } else { |
|
943 | + $success = false; |
|
944 | + $msg = __( |
|
945 | + 'An error occurred. The venue could not be moved to the trash because a valid venue ID was not not supplied.', |
|
946 | + 'event_espresso' |
|
947 | + ); |
|
948 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
949 | + } |
|
950 | + $action = $venue_status == 'trash' ? 'moved to the trash' : 'restored from the trash'; |
|
951 | + |
|
952 | + if ($redirect_after) { |
|
953 | + $this->_redirect_after_action($success, 'Venue', $action, array('action' => 'default')); |
|
954 | + } |
|
955 | + } |
|
956 | + |
|
957 | + |
|
958 | + protected function _trash_or_restore_venues($venue_status = 'trash') |
|
959 | + { |
|
960 | + // clean status |
|
961 | + $venue_status = sanitize_key($venue_status); |
|
962 | + // grab status |
|
963 | + if (! empty($venue_status)) { |
|
964 | + $success = true; |
|
965 | + // determine the event id and set to array. |
|
966 | + $VNU_IDs = isset($this->_req_data['venue_id']) ? (array) $this->_req_data['venue_id'] : array(); |
|
967 | + // loop thru events |
|
968 | + foreach ($VNU_IDs as $VNU_ID) { |
|
969 | + if ($VNU_ID = absint($VNU_ID)) { |
|
970 | + $results = $this->_change_venue_status($VNU_ID, $venue_status); |
|
971 | + $success = $results !== false ? $success : false; |
|
972 | + } else { |
|
973 | + $msg = sprintf( |
|
974 | + __( |
|
975 | + 'An error occurred. Venue #%d could not be moved to the trash because a valid venue ID was not not supplied.', |
|
976 | + 'event_espresso' |
|
977 | + ), |
|
978 | + $VNU_ID |
|
979 | + ); |
|
980 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
981 | + $success = false; |
|
982 | + } |
|
983 | + } |
|
984 | + } else { |
|
985 | + $success = false; |
|
986 | + $msg = __( |
|
987 | + 'An error occurred. The venue could not be moved to the trash because a valid venue status was not not supplied.', |
|
988 | + 'event_espresso' |
|
989 | + ); |
|
990 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
991 | + } |
|
992 | + // in order to force a pluralized result message we need to send back a success status greater than 1 |
|
993 | + $success = $success ? 2 : false; |
|
994 | + $action = $venue_status == 'trash' ? 'moved to the trash' : 'restored from the trash'; |
|
995 | + $this->_redirect_after_action($success, 'Venues', $action, array('action' => 'default')); |
|
996 | + } |
|
997 | + |
|
998 | + |
|
999 | + /** |
|
1000 | + * _trash_or_restore_venues |
|
1001 | + * |
|
1002 | + * //todo this is pretty much the same as the corresponding change_event_status method in Events_Admin_Page. We |
|
1003 | + * should probably abstract this up to the EE_Admin_Page_CPT (or even EE_Admin_Page) and make this a common method |
|
1004 | + * accepting a certain number of params. |
|
1005 | + * |
|
1006 | + * @access private |
|
1007 | + * @param int $VNU_ID |
|
1008 | + * @param string $venue_status |
|
1009 | + * @return void |
|
1010 | + */ |
|
1011 | + private function _change_venue_status($VNU_ID = 0, $venue_status = '') |
|
1012 | + { |
|
1013 | + // grab venue id |
|
1014 | + if (! $VNU_ID) { |
|
1015 | + $msg = __('An error occurred. No Venue ID or an invalid Venue ID was received.', 'event_espresso'); |
|
1016 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1017 | + return false; |
|
1018 | + } |
|
1019 | + |
|
1020 | + $this->_cpt_model_obj = EEM_Venue::instance()->get_one_by_ID($VNU_ID); |
|
1021 | + |
|
1022 | + // clean status |
|
1023 | + $venue_status = sanitize_key($venue_status); |
|
1024 | + // grab status |
|
1025 | + if (! $venue_status) { |
|
1026 | + $msg = __('An error occurred. No Venue Status or an invalid Venue Status was received.', 'event_espresso'); |
|
1027 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1028 | + return false; |
|
1029 | + } |
|
1030 | + |
|
1031 | + // was event trashed or restored ? |
|
1032 | + switch ($venue_status) { |
|
1033 | + case 'draft': |
|
1034 | + $action = 'restored from the trash'; |
|
1035 | + $hook = 'AHEE_venue_restored_from_trash'; |
|
1036 | + break; |
|
1037 | + case 'trash': |
|
1038 | + $action = 'moved to the trash'; |
|
1039 | + $hook = 'AHEE_venue_moved_to_trash'; |
|
1040 | + break; |
|
1041 | + default: |
|
1042 | + $action = 'updated'; |
|
1043 | + $hook = false; |
|
1044 | + } |
|
1045 | + // use class to change status |
|
1046 | + $this->_cpt_model_obj->set_status($venue_status); |
|
1047 | + $success = $this->_cpt_model_obj->save(); |
|
1048 | + |
|
1049 | + if ($success === false) { |
|
1050 | + $msg = sprintf(__('An error occurred. The venue could not be %s.', 'event_espresso'), $action); |
|
1051 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1052 | + return false; |
|
1053 | + } |
|
1054 | + if ($hook) { |
|
1055 | + do_action($hook); |
|
1056 | + } |
|
1057 | + return true; |
|
1058 | + } |
|
1059 | + |
|
1060 | + |
|
1061 | + /** |
|
1062 | + * @param bool $redirect_after |
|
1063 | + * @return void |
|
1064 | + */ |
|
1065 | + protected function _delete_venue($redirect_after = true) |
|
1066 | + { |
|
1067 | + // determine the venue id and set to array. |
|
1068 | + $VNU_ID = isset($this->_req_data['VNU_ID']) ? absint($this->_req_data['VNU_ID']) : null; |
|
1069 | + $VNU_ID = isset($this->_req_data['post']) ? absint($this->_req_data['post']) : $VNU_ID; |
|
1070 | + |
|
1071 | + |
|
1072 | + // loop thru venues |
|
1073 | + if ($VNU_ID) { |
|
1074 | + $success = $this->_delete_or_trash_venue($VNU_ID); |
|
1075 | + } else { |
|
1076 | + $success = false; |
|
1077 | + $msg = __( |
|
1078 | + 'An error occurred. An venue could not be deleted because a valid venue ID was not not supplied.', |
|
1079 | + 'event_espresso' |
|
1080 | + ); |
|
1081 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1082 | + } |
|
1083 | + if ($redirect_after) { |
|
1084 | + $this->_redirect_after_action($success, 'Venue', 'deleted', array('action' => 'default')); |
|
1085 | + } |
|
1086 | + } |
|
1087 | + |
|
1088 | + |
|
1089 | + protected function _delete_venues() |
|
1090 | + { |
|
1091 | + $success = true; |
|
1092 | + // determine the event id and set to array. |
|
1093 | + $VNU_IDs = isset($this->_req_data['venue_id']) ? (array) $this->_req_data['venue_id'] : array(); |
|
1094 | + // loop thru events |
|
1095 | + foreach ($VNU_IDs as $VNU_ID) { |
|
1096 | + if ($VNU_ID = absint($VNU_ID)) { |
|
1097 | + $results = $this->_delete_or_trash_venue($VNU_ID); |
|
1098 | + $success = $results !== false ? $success : false; |
|
1099 | + } else { |
|
1100 | + $success = false; |
|
1101 | + $msg = __( |
|
1102 | + 'An error occurred. An venue could not be deleted because a valid venue ID was not not supplied.', |
|
1103 | + 'event_espresso' |
|
1104 | + ); |
|
1105 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1106 | + } |
|
1107 | + } |
|
1108 | + // in order to force a pluralized result message we need to send back a success status greater than 1 |
|
1109 | + $success = $success ? 2 : false; |
|
1110 | + $this->_redirect_after_action( |
|
1111 | + $success, |
|
1112 | + __('Venues', 'event_espresso'), |
|
1113 | + __('deleted', 'event_espresso'), |
|
1114 | + array('action' => 'default') |
|
1115 | + ); |
|
1116 | + } |
|
1117 | + |
|
1118 | + |
|
1119 | + // todo: put in parent |
|
1120 | + private function _delete_or_trash_venue($VNU_ID = false) |
|
1121 | + { |
|
1122 | + // grab event id |
|
1123 | + if (! $VNU_ID = absint($VNU_ID)) { |
|
1124 | + $msg = __('An error occurred. No Venue ID or an invalid Venue ID was received.', 'event_espresso'); |
|
1125 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1126 | + return false; |
|
1127 | + } |
|
1128 | + |
|
1129 | + |
|
1130 | + $venue = EEM_Venue::instance()->get_one_by_ID($VNU_ID); |
|
1131 | + // first need to remove all term relationships |
|
1132 | + $venue->_remove_relations('Term_Taxonomy'); |
|
1133 | + $success = $venue->delete_permanently(); |
|
1134 | + // did it all go as planned ? |
|
1135 | + if ($success) { |
|
1136 | + $msg = sprintf(__('Venue ID # %d has been deleted.', 'event_espresso'), $VNU_ID); |
|
1137 | + EE_Error::add_success($msg); |
|
1138 | + } else { |
|
1139 | + $msg = sprintf(__('An error occurred. Venue ID # %d could not be deleted.', 'event_espresso'), $VNU_ID); |
|
1140 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1141 | + return false; |
|
1142 | + } |
|
1143 | + do_action('AHEE__Venues_Admin_Page___delete_or_trash_venue__after_venue_deleted'); |
|
1144 | + return true; |
|
1145 | + } |
|
1146 | + |
|
1147 | + |
|
1148 | + |
|
1149 | + |
|
1150 | + /***********/ |
|
1151 | + /* QUERIES */ |
|
1152 | + |
|
1153 | + |
|
1154 | + public function get_venues($per_page = 10, $count = false) |
|
1155 | + { |
|
1156 | + |
|
1157 | + $_orderby = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : ''; |
|
1158 | + |
|
1159 | + switch ($_orderby) { |
|
1160 | + case 'id': |
|
1161 | + $orderby = 'VNU_ID'; |
|
1162 | + break; |
|
1163 | + |
|
1164 | + case 'capacity': |
|
1165 | + $orderby = 'VNU_capacity'; |
|
1166 | + break; |
|
1167 | + |
|
1168 | + case 'city': |
|
1169 | + $orderby = 'VNU_city'; |
|
1170 | + break; |
|
1171 | + |
|
1172 | + default: |
|
1173 | + $orderby = 'VNU_name'; |
|
1174 | + } |
|
1175 | + |
|
1176 | + |
|
1177 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] |
|
1178 | + : 'ASC'; |
|
1179 | + |
|
1180 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) |
|
1181 | + ? $this->_req_data['paged'] : 1; |
|
1182 | + $per_page = isset($per_page) && ! empty($per_page) ? $per_page : 10; |
|
1183 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) |
|
1184 | + ? $this->_req_data['perpage'] : $per_page; |
|
1185 | + |
|
1186 | + |
|
1187 | + $offset = ($current_page - 1) * $per_page; |
|
1188 | + $limit = array($offset, $per_page); |
|
1189 | + |
|
1190 | + $category = isset($this->_req_data['category']) && $this->_req_data['category'] > 0 |
|
1191 | + ? $this->_req_data['category'] : null; |
|
1192 | + $where = array(); |
|
1193 | + |
|
1194 | + // only set initial status if it is in the incoming request. Otherwise the "all" view display's all statuses. |
|
1195 | + if (isset($this->_req_data['status']) && $this->_req_data['status'] != 'all') { |
|
1196 | + $where['status'] = $this->_req_data['status']; |
|
1197 | + } |
|
1198 | + |
|
1199 | + if (isset($this->_req_data['venue_status'])) { |
|
1200 | + $where['status'] = $this->_req_data['venue_status']; |
|
1201 | + } |
|
1202 | + |
|
1203 | + |
|
1204 | + if ($category) { |
|
1205 | + $where['Term_Taxonomy.taxonomy'] = 'espresso_venue_categories'; |
|
1206 | + $where['Term_Taxonomy.term_id'] = $category; |
|
1207 | + } |
|
1208 | + |
|
1209 | + |
|
1210 | + if (! EE_Registry::instance()->CAP->current_user_can('ee_read_others_venues', 'get_venues')) { |
|
1211 | + $where['VNU_wp_user'] = get_current_user_id(); |
|
1212 | + } else { |
|
1213 | + if (! EE_Registry::instance()->CAP->current_user_can('ee_read_private_venues', 'get_venues')) { |
|
1214 | + $where['OR'] = array( |
|
1215 | + 'status*restrict_private' => array('!=', 'private'), |
|
1216 | + 'AND' => array( |
|
1217 | + 'status*inclusive' => array('=', 'private'), |
|
1218 | + 'VNU_wp_user' => get_current_user_id(), |
|
1219 | + ), |
|
1220 | + ); |
|
1221 | + } |
|
1222 | + } |
|
1223 | + |
|
1224 | + |
|
1225 | + if (isset($this->_req_data['s'])) { |
|
1226 | + $sstr = '%' . $this->_req_data['s'] . '%'; |
|
1227 | + $where['OR'] = array( |
|
1228 | + 'VNU_name' => array('LIKE', $sstr), |
|
1229 | + 'VNU_desc' => array('LIKE', $sstr), |
|
1230 | + 'VNU_short_desc' => array('LIKE', $sstr), |
|
1231 | + 'VNU_address' => array('LIKE', $sstr), |
|
1232 | + 'VNU_address2' => array('LIKE', $sstr), |
|
1233 | + 'VNU_city' => array('LIKE', $sstr), |
|
1234 | + 'VNU_zip' => array('LIKE', $sstr), |
|
1235 | + 'VNU_phone' => array('LIKE', $sstr), |
|
1236 | + 'VNU_url' => array('LIKE', $sstr), |
|
1237 | + 'VNU_virtual_phone' => array('LIKE', $sstr), |
|
1238 | + 'VNU_virtual_url' => array('LIKE', $sstr), |
|
1239 | + 'VNU_google_map_link' => array('LIKE', $sstr), |
|
1240 | + 'Event.EVT_name' => array('LIKE', $sstr), |
|
1241 | + 'Event.EVT_desc' => array('LIKE', $sstr), |
|
1242 | + 'Event.EVT_phone' => array('LIKE', $sstr), |
|
1243 | + 'Event.EVT_external_URL' => array('LIKE', $sstr), |
|
1244 | + ); |
|
1245 | + } |
|
1246 | 1246 | |
1247 | 1247 | |
1248 | - $venues = $count |
|
1249 | - ? $this->_venue_model->count(array($where), 'VNU_ID') |
|
1250 | - : $this->_venue_model->get_all( |
|
1251 | - array($where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $sort) |
|
1252 | - ); |
|
1253 | - |
|
1254 | - return $venues; |
|
1255 | - } |
|
1256 | - |
|
1257 | - |
|
1258 | - |
|
1259 | - |
|
1260 | - /** Venue Category Stuff **/ |
|
1261 | - |
|
1262 | - /** |
|
1263 | - * set the _category property with the category object for the loaded page. |
|
1264 | - * |
|
1265 | - * @access private |
|
1266 | - * @return void |
|
1267 | - */ |
|
1268 | - private function _set_category_object() |
|
1269 | - { |
|
1270 | - if (isset($this->_category->id) && ! empty($this->_category->id)) { |
|
1271 | - return; |
|
1272 | - } // already have the category object so get out. |
|
1273 | - |
|
1274 | - // set default category object |
|
1275 | - $this->_set_empty_category_object(); |
|
1276 | - |
|
1277 | - // only set if we've got an id |
|
1278 | - if (! isset($this->_req_data['VEN_CAT_ID'])) { |
|
1279 | - return; |
|
1280 | - } |
|
1281 | - |
|
1282 | - $category_id = absint($this->_req_data['VEN_CAT_ID']); |
|
1283 | - $term = get_term($category_id, 'espresso_venue_categories'); |
|
1284 | - |
|
1285 | - |
|
1286 | - if (! empty($term)) { |
|
1287 | - $this->_category->category_name = $term->name; |
|
1288 | - $this->_category->category_identifier = $term->slug; |
|
1289 | - $this->_category->category_desc = $term->description; |
|
1290 | - $this->_category->id = $term->term_id; |
|
1291 | - $this->_category->parent = $term->parent; |
|
1292 | - } |
|
1293 | - } |
|
1294 | - |
|
1295 | - |
|
1296 | - private function _set_empty_category_object() |
|
1297 | - { |
|
1298 | - $this->_category = new stdClass(); |
|
1299 | - $this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc = ''; |
|
1300 | - $this->_category->id = $this->_category->parent = 0; |
|
1301 | - } |
|
1302 | - |
|
1303 | - |
|
1304 | - protected function _category_list_table() |
|
1305 | - { |
|
1306 | - do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1307 | - $this->_admin_page_title .= ' ' . $this->get_action_link_or_button( |
|
1308 | - 'add_category', |
|
1309 | - 'add_category', |
|
1310 | - array(), |
|
1311 | - 'add-new-h2' |
|
1312 | - ); |
|
1313 | - $this->_search_btn_label = __('Venue Categories', 'event_espresso'); |
|
1314 | - $this->display_admin_list_table_page_with_sidebar(); |
|
1315 | - } |
|
1316 | - |
|
1317 | - |
|
1318 | - protected function _category_details($view) |
|
1319 | - { |
|
1320 | - |
|
1321 | - // load formatter helper |
|
1322 | - // load field generator helper |
|
1323 | - |
|
1324 | - $route = $view == 'edit' ? 'update_category' : 'insert_category'; |
|
1325 | - $this->_set_add_edit_form_tags($route); |
|
1326 | - |
|
1327 | - $this->_set_category_object(); |
|
1328 | - $id = ! empty($this->_category->id) ? $this->_category->id : ''; |
|
1329 | - |
|
1330 | - $delete_action = 'delete_category'; |
|
1331 | - |
|
1332 | - $redirect = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'category_list'), $this->_admin_base_url); |
|
1333 | - |
|
1334 | - $this->_set_publish_post_box_vars('VEN_CAT_ID', $id, $delete_action, $redirect); |
|
1335 | - |
|
1336 | - // take care of contents |
|
1337 | - $this->_template_args['admin_page_content'] = $this->_category_details_content(); |
|
1338 | - $this->display_admin_page_with_sidebar(); |
|
1339 | - } |
|
1340 | - |
|
1341 | - |
|
1342 | - protected function _category_details_content() |
|
1343 | - { |
|
1344 | - $editor_args['category_desc'] = array( |
|
1345 | - 'type' => 'wp_editor', |
|
1346 | - 'value' => EEH_Formatter::admin_format_content($this->_category->category_desc), |
|
1347 | - 'class' => 'my_editor_custom', |
|
1348 | - 'wpeditor_args' => array('media_buttons' => false), |
|
1349 | - ); |
|
1350 | - $_wp_editor = $this->_generate_admin_form_fields($editor_args, 'array'); |
|
1351 | - |
|
1352 | - $all_terms = get_terms( |
|
1353 | - array('espresso_venue_categories'), |
|
1354 | - array('hide_empty' => 0, 'exclude' => array($this->_category->id)) |
|
1355 | - ); |
|
1356 | - |
|
1357 | - // setup category select for term parents. |
|
1358 | - $category_select_values[] = array( |
|
1359 | - 'text' => __('No Parent', 'event_espresso'), |
|
1360 | - 'id' => 0, |
|
1361 | - ); |
|
1362 | - foreach ($all_terms as $term) { |
|
1363 | - $category_select_values[] = array( |
|
1364 | - 'text' => $term->name, |
|
1365 | - 'id' => $term->term_id, |
|
1366 | - ); |
|
1367 | - } |
|
1368 | - |
|
1369 | - $category_select = EEH_Form_Fields::select_input( |
|
1370 | - 'category_parent', |
|
1371 | - $category_select_values, |
|
1372 | - $this->_category->parent |
|
1373 | - ); |
|
1374 | - $template_args = array( |
|
1375 | - 'category' => $this->_category, |
|
1376 | - 'category_select' => $category_select, |
|
1377 | - 'unique_id_info_help_link' => $this->_get_help_tab_link('unique_id_info'), |
|
1378 | - 'category_desc_editor' => $_wp_editor['category_desc']['field'], |
|
1379 | - 'disable' => '', |
|
1380 | - 'disabled_message' => false, |
|
1381 | - ); |
|
1382 | - $template = EVENTS_TEMPLATE_PATH . 'event_category_details.template.php'; |
|
1383 | - return EEH_Template::display_template($template, $template_args, true); |
|
1384 | - } |
|
1385 | - |
|
1386 | - |
|
1387 | - protected function _delete_categories() |
|
1388 | - { |
|
1389 | - $cat_ids = isset($this->_req_data['VEN_CAT_ID']) ? (array) $this->_req_data['VEN_CAT_ID'] |
|
1390 | - : (array) $this->_req_data['category_id']; |
|
1391 | - |
|
1392 | - foreach ($cat_ids as $cat_id) { |
|
1393 | - $this->_delete_category($cat_id); |
|
1394 | - } |
|
1395 | - |
|
1396 | - // doesn't matter what page we're coming from... we're going to the same place after delete. |
|
1397 | - $query_args = array( |
|
1398 | - 'action' => 'category_list', |
|
1399 | - ); |
|
1400 | - $this->_redirect_after_action(0, '', '', $query_args); |
|
1401 | - } |
|
1402 | - |
|
1403 | - |
|
1404 | - protected function _delete_category($cat_id) |
|
1405 | - { |
|
1406 | - $cat_id = absint($cat_id); |
|
1407 | - wp_delete_term($cat_id, 'espresso_venue_categories'); |
|
1408 | - } |
|
1409 | - |
|
1410 | - |
|
1411 | - protected function _insert_or_update_category($new_category) |
|
1412 | - { |
|
1413 | - |
|
1414 | - $cat_id = $new_category ? $this->_insert_category() : $this->_insert_category(true); |
|
1415 | - $success = 0; // we already have a success message so lets not send another. |
|
1416 | - if ($cat_id) { |
|
1417 | - $query_args = array( |
|
1418 | - 'action' => 'edit_category', |
|
1419 | - 'VEN_CAT_ID' => $cat_id, |
|
1420 | - ); |
|
1421 | - } else { |
|
1422 | - $query_args = array('action' => 'add_category'); |
|
1423 | - } |
|
1424 | - $this->_redirect_after_action($success, '', '', $query_args, true); |
|
1425 | - } |
|
1426 | - |
|
1427 | - |
|
1428 | - private function _insert_category($update = false) |
|
1429 | - { |
|
1430 | - $cat_id = $update ? $this->_req_data['VEN_CAT_ID'] : ''; |
|
1431 | - $category_name = isset($this->_req_data['category_name']) ? $this->_req_data['category_name'] : ''; |
|
1432 | - $category_desc = isset($this->_req_data['category_desc']) ? $this->_req_data['category_desc'] : ''; |
|
1433 | - $category_parent = isset($this->_req_data['category_parent']) ? $this->_req_data['category_parent'] : 0; |
|
1434 | - |
|
1435 | - if (empty($category_name)) { |
|
1436 | - $msg = __('You must add a name for the category.', 'event_espresso'); |
|
1437 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1438 | - return false; |
|
1439 | - } |
|
1440 | - |
|
1441 | - |
|
1442 | - $term_args = array( |
|
1443 | - 'name' => $category_name, |
|
1444 | - 'description' => $category_desc, |
|
1445 | - 'parent' => $category_parent, |
|
1446 | - ); |
|
1447 | - |
|
1448 | - $insert_ids = $update |
|
1449 | - ? wp_update_term($cat_id, 'espresso_venue_categories', $term_args) |
|
1450 | - : wp_insert_term( |
|
1451 | - $category_name, |
|
1452 | - 'espresso_venue_categories', |
|
1453 | - $term_args |
|
1454 | - ); |
|
1455 | - |
|
1456 | - if (! is_array($insert_ids)) { |
|
1457 | - $msg = __('An error occurred and the category has not been saved to the database.', 'event_espresso'); |
|
1458 | - EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1459 | - } else { |
|
1460 | - $cat_id = $insert_ids['term_id']; |
|
1461 | - $msg = sprintf(__('The category %s was successfully created', 'event_espresso'), $category_name); |
|
1462 | - EE_Error::add_success($msg); |
|
1463 | - } |
|
1464 | - |
|
1465 | - return $cat_id; |
|
1466 | - } |
|
1467 | - |
|
1468 | - |
|
1469 | - /** |
|
1470 | - * TODO handle category exports() |
|
1471 | - * |
|
1472 | - * @return file export |
|
1473 | - */ |
|
1474 | - protected function _categories_export() |
|
1475 | - { |
|
1476 | - |
|
1477 | - // todo: I don't like doing this but it'll do until we modify EE_Export Class. |
|
1478 | - $new_request_args = array( |
|
1479 | - 'export' => 'report', |
|
1480 | - 'action' => 'categories', |
|
1481 | - 'category_ids' => $this->_req_data['VEN_CAT_ID'], |
|
1482 | - ); |
|
1483 | - |
|
1484 | - $this->_req_data = array_merge($this->_req_data, $new_request_args); |
|
1485 | - |
|
1486 | - if (is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
1487 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
1488 | - $EE_Export = EE_Export::instance($this->_req_data); |
|
1489 | - $EE_Export->export(); |
|
1490 | - } |
|
1491 | - } |
|
1492 | - |
|
1493 | - |
|
1494 | - protected function _import_categories() |
|
1495 | - { |
|
1496 | - |
|
1497 | - require_once(EE_CLASSES . 'EE_Import.class.php'); |
|
1498 | - EE_Import::instance()->import(); |
|
1499 | - } |
|
1500 | - |
|
1501 | - |
|
1502 | - public function get_categories($per_page = 10, $current_page = 1, $count = false) |
|
1503 | - { |
|
1504 | - |
|
1505 | - // testing term stuff |
|
1506 | - $orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'Term.term_id'; |
|
1507 | - $order = isset($this->_req_data['order']) ? $this->_req_data['order'] : 'DESC'; |
|
1508 | - $limit = ($current_page - 1) * $per_page; |
|
1509 | - $where = array('taxonomy' => 'espresso_venue_categories'); |
|
1510 | - if (isset($this->_req_data['s'])) { |
|
1511 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
1512 | - $where['OR'] = array( |
|
1513 | - 'Term.name' => array('LIKE', $sstr), |
|
1514 | - 'description' => array('LIKE', $sstr), |
|
1515 | - ); |
|
1516 | - } |
|
1517 | - |
|
1518 | - $query_params = array( |
|
1519 | - $where, |
|
1520 | - 'order_by' => array($orderby => $order), |
|
1521 | - 'limit' => $limit . ',' . $per_page, |
|
1522 | - 'force_join' => array('Term'), |
|
1523 | - ); |
|
1524 | - |
|
1525 | - $categories = $count ? EEM_Term_Taxonomy::instance()->count($query_params, 'term_id') |
|
1526 | - : EEM_Term_Taxonomy::instance()->get_all($query_params); |
|
1527 | - |
|
1528 | - return $categories; |
|
1529 | - } |
|
1530 | - |
|
1531 | - |
|
1532 | - /* end category stuff */ |
|
1533 | - /**************/ |
|
1248 | + $venues = $count |
|
1249 | + ? $this->_venue_model->count(array($where), 'VNU_ID') |
|
1250 | + : $this->_venue_model->get_all( |
|
1251 | + array($where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $sort) |
|
1252 | + ); |
|
1253 | + |
|
1254 | + return $venues; |
|
1255 | + } |
|
1256 | + |
|
1257 | + |
|
1258 | + |
|
1259 | + |
|
1260 | + /** Venue Category Stuff **/ |
|
1261 | + |
|
1262 | + /** |
|
1263 | + * set the _category property with the category object for the loaded page. |
|
1264 | + * |
|
1265 | + * @access private |
|
1266 | + * @return void |
|
1267 | + */ |
|
1268 | + private function _set_category_object() |
|
1269 | + { |
|
1270 | + if (isset($this->_category->id) && ! empty($this->_category->id)) { |
|
1271 | + return; |
|
1272 | + } // already have the category object so get out. |
|
1273 | + |
|
1274 | + // set default category object |
|
1275 | + $this->_set_empty_category_object(); |
|
1276 | + |
|
1277 | + // only set if we've got an id |
|
1278 | + if (! isset($this->_req_data['VEN_CAT_ID'])) { |
|
1279 | + return; |
|
1280 | + } |
|
1281 | + |
|
1282 | + $category_id = absint($this->_req_data['VEN_CAT_ID']); |
|
1283 | + $term = get_term($category_id, 'espresso_venue_categories'); |
|
1284 | + |
|
1285 | + |
|
1286 | + if (! empty($term)) { |
|
1287 | + $this->_category->category_name = $term->name; |
|
1288 | + $this->_category->category_identifier = $term->slug; |
|
1289 | + $this->_category->category_desc = $term->description; |
|
1290 | + $this->_category->id = $term->term_id; |
|
1291 | + $this->_category->parent = $term->parent; |
|
1292 | + } |
|
1293 | + } |
|
1294 | + |
|
1295 | + |
|
1296 | + private function _set_empty_category_object() |
|
1297 | + { |
|
1298 | + $this->_category = new stdClass(); |
|
1299 | + $this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc = ''; |
|
1300 | + $this->_category->id = $this->_category->parent = 0; |
|
1301 | + } |
|
1302 | + |
|
1303 | + |
|
1304 | + protected function _category_list_table() |
|
1305 | + { |
|
1306 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1307 | + $this->_admin_page_title .= ' ' . $this->get_action_link_or_button( |
|
1308 | + 'add_category', |
|
1309 | + 'add_category', |
|
1310 | + array(), |
|
1311 | + 'add-new-h2' |
|
1312 | + ); |
|
1313 | + $this->_search_btn_label = __('Venue Categories', 'event_espresso'); |
|
1314 | + $this->display_admin_list_table_page_with_sidebar(); |
|
1315 | + } |
|
1316 | + |
|
1317 | + |
|
1318 | + protected function _category_details($view) |
|
1319 | + { |
|
1320 | + |
|
1321 | + // load formatter helper |
|
1322 | + // load field generator helper |
|
1323 | + |
|
1324 | + $route = $view == 'edit' ? 'update_category' : 'insert_category'; |
|
1325 | + $this->_set_add_edit_form_tags($route); |
|
1326 | + |
|
1327 | + $this->_set_category_object(); |
|
1328 | + $id = ! empty($this->_category->id) ? $this->_category->id : ''; |
|
1329 | + |
|
1330 | + $delete_action = 'delete_category'; |
|
1331 | + |
|
1332 | + $redirect = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'category_list'), $this->_admin_base_url); |
|
1333 | + |
|
1334 | + $this->_set_publish_post_box_vars('VEN_CAT_ID', $id, $delete_action, $redirect); |
|
1335 | + |
|
1336 | + // take care of contents |
|
1337 | + $this->_template_args['admin_page_content'] = $this->_category_details_content(); |
|
1338 | + $this->display_admin_page_with_sidebar(); |
|
1339 | + } |
|
1340 | + |
|
1341 | + |
|
1342 | + protected function _category_details_content() |
|
1343 | + { |
|
1344 | + $editor_args['category_desc'] = array( |
|
1345 | + 'type' => 'wp_editor', |
|
1346 | + 'value' => EEH_Formatter::admin_format_content($this->_category->category_desc), |
|
1347 | + 'class' => 'my_editor_custom', |
|
1348 | + 'wpeditor_args' => array('media_buttons' => false), |
|
1349 | + ); |
|
1350 | + $_wp_editor = $this->_generate_admin_form_fields($editor_args, 'array'); |
|
1351 | + |
|
1352 | + $all_terms = get_terms( |
|
1353 | + array('espresso_venue_categories'), |
|
1354 | + array('hide_empty' => 0, 'exclude' => array($this->_category->id)) |
|
1355 | + ); |
|
1356 | + |
|
1357 | + // setup category select for term parents. |
|
1358 | + $category_select_values[] = array( |
|
1359 | + 'text' => __('No Parent', 'event_espresso'), |
|
1360 | + 'id' => 0, |
|
1361 | + ); |
|
1362 | + foreach ($all_terms as $term) { |
|
1363 | + $category_select_values[] = array( |
|
1364 | + 'text' => $term->name, |
|
1365 | + 'id' => $term->term_id, |
|
1366 | + ); |
|
1367 | + } |
|
1368 | + |
|
1369 | + $category_select = EEH_Form_Fields::select_input( |
|
1370 | + 'category_parent', |
|
1371 | + $category_select_values, |
|
1372 | + $this->_category->parent |
|
1373 | + ); |
|
1374 | + $template_args = array( |
|
1375 | + 'category' => $this->_category, |
|
1376 | + 'category_select' => $category_select, |
|
1377 | + 'unique_id_info_help_link' => $this->_get_help_tab_link('unique_id_info'), |
|
1378 | + 'category_desc_editor' => $_wp_editor['category_desc']['field'], |
|
1379 | + 'disable' => '', |
|
1380 | + 'disabled_message' => false, |
|
1381 | + ); |
|
1382 | + $template = EVENTS_TEMPLATE_PATH . 'event_category_details.template.php'; |
|
1383 | + return EEH_Template::display_template($template, $template_args, true); |
|
1384 | + } |
|
1385 | + |
|
1386 | + |
|
1387 | + protected function _delete_categories() |
|
1388 | + { |
|
1389 | + $cat_ids = isset($this->_req_data['VEN_CAT_ID']) ? (array) $this->_req_data['VEN_CAT_ID'] |
|
1390 | + : (array) $this->_req_data['category_id']; |
|
1391 | + |
|
1392 | + foreach ($cat_ids as $cat_id) { |
|
1393 | + $this->_delete_category($cat_id); |
|
1394 | + } |
|
1395 | + |
|
1396 | + // doesn't matter what page we're coming from... we're going to the same place after delete. |
|
1397 | + $query_args = array( |
|
1398 | + 'action' => 'category_list', |
|
1399 | + ); |
|
1400 | + $this->_redirect_after_action(0, '', '', $query_args); |
|
1401 | + } |
|
1402 | + |
|
1403 | + |
|
1404 | + protected function _delete_category($cat_id) |
|
1405 | + { |
|
1406 | + $cat_id = absint($cat_id); |
|
1407 | + wp_delete_term($cat_id, 'espresso_venue_categories'); |
|
1408 | + } |
|
1409 | + |
|
1410 | + |
|
1411 | + protected function _insert_or_update_category($new_category) |
|
1412 | + { |
|
1413 | + |
|
1414 | + $cat_id = $new_category ? $this->_insert_category() : $this->_insert_category(true); |
|
1415 | + $success = 0; // we already have a success message so lets not send another. |
|
1416 | + if ($cat_id) { |
|
1417 | + $query_args = array( |
|
1418 | + 'action' => 'edit_category', |
|
1419 | + 'VEN_CAT_ID' => $cat_id, |
|
1420 | + ); |
|
1421 | + } else { |
|
1422 | + $query_args = array('action' => 'add_category'); |
|
1423 | + } |
|
1424 | + $this->_redirect_after_action($success, '', '', $query_args, true); |
|
1425 | + } |
|
1426 | + |
|
1427 | + |
|
1428 | + private function _insert_category($update = false) |
|
1429 | + { |
|
1430 | + $cat_id = $update ? $this->_req_data['VEN_CAT_ID'] : ''; |
|
1431 | + $category_name = isset($this->_req_data['category_name']) ? $this->_req_data['category_name'] : ''; |
|
1432 | + $category_desc = isset($this->_req_data['category_desc']) ? $this->_req_data['category_desc'] : ''; |
|
1433 | + $category_parent = isset($this->_req_data['category_parent']) ? $this->_req_data['category_parent'] : 0; |
|
1434 | + |
|
1435 | + if (empty($category_name)) { |
|
1436 | + $msg = __('You must add a name for the category.', 'event_espresso'); |
|
1437 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1438 | + return false; |
|
1439 | + } |
|
1440 | + |
|
1441 | + |
|
1442 | + $term_args = array( |
|
1443 | + 'name' => $category_name, |
|
1444 | + 'description' => $category_desc, |
|
1445 | + 'parent' => $category_parent, |
|
1446 | + ); |
|
1447 | + |
|
1448 | + $insert_ids = $update |
|
1449 | + ? wp_update_term($cat_id, 'espresso_venue_categories', $term_args) |
|
1450 | + : wp_insert_term( |
|
1451 | + $category_name, |
|
1452 | + 'espresso_venue_categories', |
|
1453 | + $term_args |
|
1454 | + ); |
|
1455 | + |
|
1456 | + if (! is_array($insert_ids)) { |
|
1457 | + $msg = __('An error occurred and the category has not been saved to the database.', 'event_espresso'); |
|
1458 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1459 | + } else { |
|
1460 | + $cat_id = $insert_ids['term_id']; |
|
1461 | + $msg = sprintf(__('The category %s was successfully created', 'event_espresso'), $category_name); |
|
1462 | + EE_Error::add_success($msg); |
|
1463 | + } |
|
1464 | + |
|
1465 | + return $cat_id; |
|
1466 | + } |
|
1467 | + |
|
1468 | + |
|
1469 | + /** |
|
1470 | + * TODO handle category exports() |
|
1471 | + * |
|
1472 | + * @return file export |
|
1473 | + */ |
|
1474 | + protected function _categories_export() |
|
1475 | + { |
|
1476 | + |
|
1477 | + // todo: I don't like doing this but it'll do until we modify EE_Export Class. |
|
1478 | + $new_request_args = array( |
|
1479 | + 'export' => 'report', |
|
1480 | + 'action' => 'categories', |
|
1481 | + 'category_ids' => $this->_req_data['VEN_CAT_ID'], |
|
1482 | + ); |
|
1483 | + |
|
1484 | + $this->_req_data = array_merge($this->_req_data, $new_request_args); |
|
1485 | + |
|
1486 | + if (is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
1487 | + require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
1488 | + $EE_Export = EE_Export::instance($this->_req_data); |
|
1489 | + $EE_Export->export(); |
|
1490 | + } |
|
1491 | + } |
|
1492 | + |
|
1493 | + |
|
1494 | + protected function _import_categories() |
|
1495 | + { |
|
1496 | + |
|
1497 | + require_once(EE_CLASSES . 'EE_Import.class.php'); |
|
1498 | + EE_Import::instance()->import(); |
|
1499 | + } |
|
1500 | + |
|
1501 | + |
|
1502 | + public function get_categories($per_page = 10, $current_page = 1, $count = false) |
|
1503 | + { |
|
1504 | + |
|
1505 | + // testing term stuff |
|
1506 | + $orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'Term.term_id'; |
|
1507 | + $order = isset($this->_req_data['order']) ? $this->_req_data['order'] : 'DESC'; |
|
1508 | + $limit = ($current_page - 1) * $per_page; |
|
1509 | + $where = array('taxonomy' => 'espresso_venue_categories'); |
|
1510 | + if (isset($this->_req_data['s'])) { |
|
1511 | + $sstr = '%' . $this->_req_data['s'] . '%'; |
|
1512 | + $where['OR'] = array( |
|
1513 | + 'Term.name' => array('LIKE', $sstr), |
|
1514 | + 'description' => array('LIKE', $sstr), |
|
1515 | + ); |
|
1516 | + } |
|
1517 | + |
|
1518 | + $query_params = array( |
|
1519 | + $where, |
|
1520 | + 'order_by' => array($orderby => $order), |
|
1521 | + 'limit' => $limit . ',' . $per_page, |
|
1522 | + 'force_join' => array('Term'), |
|
1523 | + ); |
|
1524 | + |
|
1525 | + $categories = $count ? EEM_Term_Taxonomy::instance()->count($query_params, 'term_id') |
|
1526 | + : EEM_Term_Taxonomy::instance()->get_all($query_params); |
|
1527 | + |
|
1528 | + return $categories; |
|
1529 | + } |
|
1530 | + |
|
1531 | + |
|
1532 | + /* end category stuff */ |
|
1533 | + /**************/ |
|
1534 | 1534 | } |
@@ -45,10 +45,10 @@ discard block |
||
45 | 45 | |
46 | 46 | protected function _init_page_props() |
47 | 47 | { |
48 | - require_once(EE_MODELS . 'EEM_Venue.model.php'); |
|
48 | + require_once(EE_MODELS.'EEM_Venue.model.php'); |
|
49 | 49 | $this->page_slug = EE_VENUES_PG_SLUG; |
50 | 50 | $this->_admin_base_url = EE_VENUES_ADMIN_URL; |
51 | - $this->_admin_base_path = EE_ADMIN_PAGES . 'venues'; |
|
51 | + $this->_admin_base_path = EE_ADMIN_PAGES.'venues'; |
|
52 | 52 | $this->page_label = __('Event Venues', 'event_espresso'); |
53 | 53 | $this->_cpt_model_names = array( |
54 | 54 | 'create_new' => 'EEM_Venue', |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | |
459 | 459 | public function load_scripts_styles() |
460 | 460 | { |
461 | - wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL . 'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION); |
|
461 | + wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL.'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION); |
|
462 | 462 | wp_enqueue_style('ee-cat-admin'); |
463 | 463 | } |
464 | 464 | |
@@ -480,7 +480,7 @@ discard block |
||
480 | 480 | wp_enqueue_style('espresso-ui-theme'); |
481 | 481 | wp_register_style( |
482 | 482 | 'espresso_venues', |
483 | - EE_VENUES_ASSETS_URL . 'ee-venues-admin.css', |
|
483 | + EE_VENUES_ASSETS_URL.'ee-venues-admin.css', |
|
484 | 484 | array(), |
485 | 485 | EVENT_ESPRESSO_VERSION |
486 | 486 | ); |
@@ -539,7 +539,7 @@ discard block |
||
539 | 539 | __("View Venue Archive Page", "event_espresso"), |
540 | 540 | 'button' |
541 | 541 | ); |
542 | - $this->_admin_page_title .= ' ' . $this->get_action_link_or_button('create_new', 'add', array(), 'add-new-h2'); |
|
542 | + $this->_admin_page_title .= ' '.$this->get_action_link_or_button('create_new', 'add', array(), 'add-new-h2'); |
|
543 | 543 | $this->_search_btn_label = __('Venues', 'event_espresso'); |
544 | 544 | $this->display_admin_list_table_page_with_sidebar(); |
545 | 545 | } |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | 'vnu_url' => $this->_cpt_model_obj->get_f('VNU_url'), |
553 | 553 | 'vnu_phone' => $this->_cpt_model_obj->get_f('VNU_phone'), |
554 | 554 | ); |
555 | - $template = EE_VENUES_TEMPLATE_PATH . 'venue_publish_box_extras.template.php'; |
|
555 | + $template = EE_VENUES_TEMPLATE_PATH.'venue_publish_box_extras.template.php'; |
|
556 | 556 | EEH_Template::display_template($template, $extra_rows); |
557 | 557 | } |
558 | 558 | |
@@ -569,21 +569,21 @@ discard block |
||
569 | 569 | $default_map_settings->use_google_maps = true; |
570 | 570 | $default_map_settings->google_map_api_key = ''; |
571 | 571 | // for event details pages (reg page) |
572 | - $default_map_settings->event_details_map_width = 585; // ee_map_width_single |
|
573 | - $default_map_settings->event_details_map_height = 362; // ee_map_height_single |
|
574 | - $default_map_settings->event_details_map_zoom = 14; // ee_map_zoom_single |
|
575 | - $default_map_settings->event_details_display_nav = true; // ee_map_nav_display_single |
|
576 | - $default_map_settings->event_details_nav_size = false; // ee_map_nav_size_single |
|
577 | - $default_map_settings->event_details_control_type = 'default'; // ee_map_type_control_single |
|
578 | - $default_map_settings->event_details_map_align = 'center'; // ee_map_align_single |
|
572 | + $default_map_settings->event_details_map_width = 585; // ee_map_width_single |
|
573 | + $default_map_settings->event_details_map_height = 362; // ee_map_height_single |
|
574 | + $default_map_settings->event_details_map_zoom = 14; // ee_map_zoom_single |
|
575 | + $default_map_settings->event_details_display_nav = true; // ee_map_nav_display_single |
|
576 | + $default_map_settings->event_details_nav_size = false; // ee_map_nav_size_single |
|
577 | + $default_map_settings->event_details_control_type = 'default'; // ee_map_type_control_single |
|
578 | + $default_map_settings->event_details_map_align = 'center'; // ee_map_align_single |
|
579 | 579 | // for event list pages |
580 | - $default_map_settings->event_list_map_width = 300; // ee_map_width |
|
581 | - $default_map_settings->event_list_map_height = 185; // ee_map_height |
|
582 | - $default_map_settings->event_list_map_zoom = 12; // ee_map_zoom |
|
583 | - $default_map_settings->event_list_display_nav = false; // ee_map_nav_display |
|
584 | - $default_map_settings->event_list_nav_size = true; // ee_map_nav_size |
|
585 | - $default_map_settings->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
586 | - $default_map_settings->event_list_map_align = 'center'; // ee_map_align |
|
580 | + $default_map_settings->event_list_map_width = 300; // ee_map_width |
|
581 | + $default_map_settings->event_list_map_height = 185; // ee_map_height |
|
582 | + $default_map_settings->event_list_map_zoom = 12; // ee_map_zoom |
|
583 | + $default_map_settings->event_list_display_nav = false; // ee_map_nav_display |
|
584 | + $default_map_settings->event_list_nav_size = true; // ee_map_nav_size |
|
585 | + $default_map_settings->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
586 | + $default_map_settings->event_list_map_align = 'center'; // ee_map_align |
|
587 | 587 | |
588 | 588 | $this->_template_args['map_settings'] = |
589 | 589 | isset(EE_Registry::instance()->CFG->map_settings) |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | $this->_set_add_edit_form_tags('update_google_map_settings'); |
598 | 598 | $this->_set_publish_post_box_vars(null, false, false, null, false); |
599 | 599 | $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
600 | - EE_VENUES_TEMPLATE_PATH . 'google_map.template.php', |
|
600 | + EE_VENUES_TEMPLATE_PATH.'google_map.template.php', |
|
601 | 601 | $this->_template_args, |
602 | 602 | true |
603 | 603 | ); |
@@ -745,7 +745,7 @@ discard block |
||
745 | 745 | ), |
746 | 746 | 'vnu_google_map_link' => $this->_cpt_model_obj->google_map_link(), |
747 | 747 | ); |
748 | - $template = EE_VENUES_TEMPLATE_PATH . 'venue_gmap_metabox_content.template.php'; |
|
748 | + $template = EE_VENUES_TEMPLATE_PATH.'venue_gmap_metabox_content.template.php'; |
|
749 | 749 | EEH_Template::display_template($template, $template_args); |
750 | 750 | } |
751 | 751 | |
@@ -786,7 +786,7 @@ discard block |
||
786 | 786 | ) |
787 | 787 | ); |
788 | 788 | |
789 | - $template = EE_VENUES_TEMPLATE_PATH . 'venue_address_metabox_content.template.php'; |
|
789 | + $template = EE_VENUES_TEMPLATE_PATH.'venue_address_metabox_content.template.php'; |
|
790 | 790 | EEH_Template::display_template($template, $template_args); |
791 | 791 | } |
792 | 792 | |
@@ -796,7 +796,7 @@ discard block |
||
796 | 796 | $template_args = array( |
797 | 797 | '_venue' => $this->_cpt_model_obj, |
798 | 798 | ); |
799 | - $template = EE_VENUES_TEMPLATE_PATH . 'venue_virtual_location_metabox_content.template.php'; |
|
799 | + $template = EE_VENUES_TEMPLATE_PATH.'venue_virtual_location_metabox_content.template.php'; |
|
800 | 800 | EEH_Template::display_template($template, $template_args); |
801 | 801 | } |
802 | 802 | |
@@ -821,7 +821,7 @@ discard block |
||
821 | 821 | { |
822 | 822 | |
823 | 823 | if ($post instanceof WP_Post && $post->post_type !== 'espresso_venues') { |
824 | - return;// get out we're not processing the saving of venues. |
|
824 | + return; // get out we're not processing the saving of venues. |
|
825 | 825 | } |
826 | 826 | |
827 | 827 | $wheres = array($this->_venue_model->primary_key_name() => $post_id); |
@@ -929,7 +929,7 @@ discard block |
||
929 | 929 | // clean status |
930 | 930 | $venue_status = sanitize_key($venue_status); |
931 | 931 | // grab status |
932 | - if (! empty($venue_status)) { |
|
932 | + if ( ! empty($venue_status)) { |
|
933 | 933 | $success = $this->_change_venue_status($VNU_ID, $venue_status); |
934 | 934 | } else { |
935 | 935 | $success = false; |
@@ -960,7 +960,7 @@ discard block |
||
960 | 960 | // clean status |
961 | 961 | $venue_status = sanitize_key($venue_status); |
962 | 962 | // grab status |
963 | - if (! empty($venue_status)) { |
|
963 | + if ( ! empty($venue_status)) { |
|
964 | 964 | $success = true; |
965 | 965 | // determine the event id and set to array. |
966 | 966 | $VNU_IDs = isset($this->_req_data['venue_id']) ? (array) $this->_req_data['venue_id'] : array(); |
@@ -1011,7 +1011,7 @@ discard block |
||
1011 | 1011 | private function _change_venue_status($VNU_ID = 0, $venue_status = '') |
1012 | 1012 | { |
1013 | 1013 | // grab venue id |
1014 | - if (! $VNU_ID) { |
|
1014 | + if ( ! $VNU_ID) { |
|
1015 | 1015 | $msg = __('An error occurred. No Venue ID or an invalid Venue ID was received.', 'event_espresso'); |
1016 | 1016 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1017 | 1017 | return false; |
@@ -1022,7 +1022,7 @@ discard block |
||
1022 | 1022 | // clean status |
1023 | 1023 | $venue_status = sanitize_key($venue_status); |
1024 | 1024 | // grab status |
1025 | - if (! $venue_status) { |
|
1025 | + if ( ! $venue_status) { |
|
1026 | 1026 | $msg = __('An error occurred. No Venue Status or an invalid Venue Status was received.', 'event_espresso'); |
1027 | 1027 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1028 | 1028 | return false; |
@@ -1120,7 +1120,7 @@ discard block |
||
1120 | 1120 | private function _delete_or_trash_venue($VNU_ID = false) |
1121 | 1121 | { |
1122 | 1122 | // grab event id |
1123 | - if (! $VNU_ID = absint($VNU_ID)) { |
|
1123 | + if ( ! $VNU_ID = absint($VNU_ID)) { |
|
1124 | 1124 | $msg = __('An error occurred. No Venue ID or an invalid Venue ID was received.', 'event_espresso'); |
1125 | 1125 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1126 | 1126 | return false; |
@@ -1207,10 +1207,10 @@ discard block |
||
1207 | 1207 | } |
1208 | 1208 | |
1209 | 1209 | |
1210 | - if (! EE_Registry::instance()->CAP->current_user_can('ee_read_others_venues', 'get_venues')) { |
|
1210 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_venues', 'get_venues')) { |
|
1211 | 1211 | $where['VNU_wp_user'] = get_current_user_id(); |
1212 | 1212 | } else { |
1213 | - if (! EE_Registry::instance()->CAP->current_user_can('ee_read_private_venues', 'get_venues')) { |
|
1213 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_venues', 'get_venues')) { |
|
1214 | 1214 | $where['OR'] = array( |
1215 | 1215 | 'status*restrict_private' => array('!=', 'private'), |
1216 | 1216 | 'AND' => array( |
@@ -1223,7 +1223,7 @@ discard block |
||
1223 | 1223 | |
1224 | 1224 | |
1225 | 1225 | if (isset($this->_req_data['s'])) { |
1226 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
1226 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
1227 | 1227 | $where['OR'] = array( |
1228 | 1228 | 'VNU_name' => array('LIKE', $sstr), |
1229 | 1229 | 'VNU_desc' => array('LIKE', $sstr), |
@@ -1275,7 +1275,7 @@ discard block |
||
1275 | 1275 | $this->_set_empty_category_object(); |
1276 | 1276 | |
1277 | 1277 | // only set if we've got an id |
1278 | - if (! isset($this->_req_data['VEN_CAT_ID'])) { |
|
1278 | + if ( ! isset($this->_req_data['VEN_CAT_ID'])) { |
|
1279 | 1279 | return; |
1280 | 1280 | } |
1281 | 1281 | |
@@ -1283,7 +1283,7 @@ discard block |
||
1283 | 1283 | $term = get_term($category_id, 'espresso_venue_categories'); |
1284 | 1284 | |
1285 | 1285 | |
1286 | - if (! empty($term)) { |
|
1286 | + if ( ! empty($term)) { |
|
1287 | 1287 | $this->_category->category_name = $term->name; |
1288 | 1288 | $this->_category->category_identifier = $term->slug; |
1289 | 1289 | $this->_category->category_desc = $term->description; |
@@ -1304,7 +1304,7 @@ discard block |
||
1304 | 1304 | protected function _category_list_table() |
1305 | 1305 | { |
1306 | 1306 | do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
1307 | - $this->_admin_page_title .= ' ' . $this->get_action_link_or_button( |
|
1307 | + $this->_admin_page_title .= ' '.$this->get_action_link_or_button( |
|
1308 | 1308 | 'add_category', |
1309 | 1309 | 'add_category', |
1310 | 1310 | array(), |
@@ -1379,7 +1379,7 @@ discard block |
||
1379 | 1379 | 'disable' => '', |
1380 | 1380 | 'disabled_message' => false, |
1381 | 1381 | ); |
1382 | - $template = EVENTS_TEMPLATE_PATH . 'event_category_details.template.php'; |
|
1382 | + $template = EVENTS_TEMPLATE_PATH.'event_category_details.template.php'; |
|
1383 | 1383 | return EEH_Template::display_template($template, $template_args, true); |
1384 | 1384 | } |
1385 | 1385 | |
@@ -1453,7 +1453,7 @@ discard block |
||
1453 | 1453 | $term_args |
1454 | 1454 | ); |
1455 | 1455 | |
1456 | - if (! is_array($insert_ids)) { |
|
1456 | + if ( ! is_array($insert_ids)) { |
|
1457 | 1457 | $msg = __('An error occurred and the category has not been saved to the database.', 'event_espresso'); |
1458 | 1458 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1459 | 1459 | } else { |
@@ -1483,8 +1483,8 @@ discard block |
||
1483 | 1483 | |
1484 | 1484 | $this->_req_data = array_merge($this->_req_data, $new_request_args); |
1485 | 1485 | |
1486 | - if (is_readable(EE_CLASSES . 'EE_Export.class.php')) { |
|
1487 | - require_once(EE_CLASSES . 'EE_Export.class.php'); |
|
1486 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
1487 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
1488 | 1488 | $EE_Export = EE_Export::instance($this->_req_data); |
1489 | 1489 | $EE_Export->export(); |
1490 | 1490 | } |
@@ -1494,7 +1494,7 @@ discard block |
||
1494 | 1494 | protected function _import_categories() |
1495 | 1495 | { |
1496 | 1496 | |
1497 | - require_once(EE_CLASSES . 'EE_Import.class.php'); |
|
1497 | + require_once(EE_CLASSES.'EE_Import.class.php'); |
|
1498 | 1498 | EE_Import::instance()->import(); |
1499 | 1499 | } |
1500 | 1500 | |
@@ -1508,7 +1508,7 @@ discard block |
||
1508 | 1508 | $limit = ($current_page - 1) * $per_page; |
1509 | 1509 | $where = array('taxonomy' => 'espresso_venue_categories'); |
1510 | 1510 | if (isset($this->_req_data['s'])) { |
1511 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
1511 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
1512 | 1512 | $where['OR'] = array( |
1513 | 1513 | 'Term.name' => array('LIKE', $sstr), |
1514 | 1514 | 'description' => array('LIKE', $sstr), |
@@ -1518,7 +1518,7 @@ discard block |
||
1518 | 1518 | $query_params = array( |
1519 | 1519 | $where, |
1520 | 1520 | 'order_by' => array($orderby => $order), |
1521 | - 'limit' => $limit . ',' . $per_page, |
|
1521 | + 'limit' => $limit.','.$per_page, |
|
1522 | 1522 | 'force_join' => array('Term'), |
1523 | 1523 | ); |
1524 | 1524 |
@@ -8,8 +8,8 @@ |
||
8 | 8 | </label> |
9 | 9 | <textarea id="url-event" cols="30" rows="4" tabindex="112" name="vnu_virtual_url"> |
10 | 10 | <?php $_venue->f( |
11 | - 'VNU_virtual_url' |
|
12 | - ); ?></textarea> |
|
11 | + 'VNU_virtual_url' |
|
12 | + ); ?></textarea> |
|
13 | 13 | </p> |
14 | 14 | <p> |
15 | 15 | <label for="call-in-num" style="display:inline-block; width:100px;"> |
@@ -3,10 +3,10 @@ discard block |
||
3 | 3 | <td valign="top"> |
4 | 4 | <fieldset> |
5 | 5 | <?php |
6 | - if (isset(EE_Registry::instance()->CFG->map_settings) |
|
7 | - && isset(EE_Registry::instance()->CFG->map_settings->use_google_maps) |
|
8 | - && EE_Registry::instance()->CFG->map_settings->use_google_maps |
|
9 | - ) { ?> |
|
6 | + if (isset(EE_Registry::instance()->CFG->map_settings) |
|
7 | + && isset(EE_Registry::instance()->CFG->map_settings->use_google_maps) |
|
8 | + && EE_Registry::instance()->CFG->map_settings->use_google_maps |
|
9 | + ) { ?> |
|
10 | 10 | <p> |
11 | 11 | <label for="enable_for_gmap"> |
12 | 12 | <?php _e('Display Google Map for this venue? ', 'event_espresso') ?> |
@@ -19,22 +19,22 @@ discard block |
||
19 | 19 | </p> --> |
20 | 20 | <?php } ?> |
21 | 21 | <?php |
22 | - if (! isset(EE_Registry::instance()->CFG->map_settings) |
|
23 | - || ! isset(EE_Registry::instance()->CFG->map_settings->use_google_maps) |
|
24 | - || ! EE_Registry::instance()->CFG->map_settings->use_google_maps |
|
25 | - ) { ?> |
|
22 | + if (! isset(EE_Registry::instance()->CFG->map_settings) |
|
23 | + || ! isset(EE_Registry::instance()->CFG->map_settings->use_google_maps) |
|
24 | + || ! EE_Registry::instance()->CFG->map_settings->use_google_maps |
|
25 | + ) { ?> |
|
26 | 26 | <p class="ee-notice"> |
27 | 27 | <?php |
28 | - echo sprintf( |
|
29 | - __( |
|
30 | - 'To display a Google Map for event venues, go to %sEvent Espresso General Settings%sGoogle Maps%s, and set "Activate Google Maps" to "Yes"', |
|
31 | - 'event_espresso' |
|
32 | - ), |
|
33 | - '<b>', |
|
34 | - '</b> » <b>', |
|
35 | - '</b>' |
|
36 | - ); |
|
37 | - ?> |
|
28 | + echo sprintf( |
|
29 | + __( |
|
30 | + 'To display a Google Map for event venues, go to %sEvent Espresso General Settings%sGoogle Maps%s, and set "Activate Google Maps" to "Yes"', |
|
31 | + 'event_espresso' |
|
32 | + ), |
|
33 | + '<b>', |
|
34 | + '</b> » <b>', |
|
35 | + '</b>' |
|
36 | + ); |
|
37 | + ?> |
|
38 | 38 | </p> |
39 | 39 | <?php } ?> |
40 | 40 |
@@ -19,7 +19,7 @@ |
||
19 | 19 | </p> --> |
20 | 20 | <?php } ?> |
21 | 21 | <?php |
22 | - if (! isset(EE_Registry::instance()->CFG->map_settings) |
|
22 | + if ( ! isset(EE_Registry::instance()->CFG->map_settings) |
|
23 | 23 | || ! isset(EE_Registry::instance()->CFG->map_settings->use_google_maps) |
24 | 24 | || ! EE_Registry::instance()->CFG->map_settings->use_google_maps |
25 | 25 | ) { ?> |