@@ -3,9 +3,9 @@ discard block |
||
| 3 | 3 | <table class="form-table"> |
| 4 | 4 | <tbody> |
| 5 | 5 | <tr valign="top"> |
| 6 | - <th><label for="PRT_ID"><?php _e('Type', 'event_espresso'); ?></label> <?php echo EEH_Template::get_help_tab_link('type_field_info');?></th> |
|
| 6 | + <th><label for="PRT_ID"><?php _e('Type', 'event_espresso'); ?></label> <?php echo EEH_Template::get_help_tab_link('type_field_info'); ?></th> |
|
| 7 | 7 | <td> |
| 8 | - <?php if ( $price->type_obj() && $price->type_obj()->base_type() === 1 ) : ?> |
|
| 8 | + <?php if ($price->type_obj() && $price->type_obj()->base_type() === 1) : ?> |
|
| 9 | 9 | <input type="hidden" name="PRT_ID" id="PRT_ID" value="<?php echo $price->type(); ?>" /> |
| 10 | 10 | <p><strong><?php _e('Price', 'event_espresso'); ?></strong></p> |
| 11 | 11 | <p class="description"><?php _e('This is the default base price. Every new ticket created will start off with this base price.', 'event_espresso'); ?></p> |
@@ -16,13 +16,13 @@ discard block |
||
| 16 | 16 | </td> |
| 17 | 17 | </tr> |
| 18 | 18 | <tr valign="top"> |
| 19 | - <th><label for="PRC_name"><?php _e('Name', 'event_espresso'); ?></label> <?php echo EEH_Template::get_help_tab_link('name_field_info');?></th> |
|
| 19 | + <th><label for="PRC_name"><?php _e('Name', 'event_espresso'); ?></label> <?php echo EEH_Template::get_help_tab_link('name_field_info'); ?></th> |
|
| 20 | 20 | <td> |
| 21 | 21 | <input class="regular-text" type="text" id="PRC_name" name="PRC_name" value="<?php echo htmlentities($price->name()); ?>"/> |
| 22 | 22 | </td> |
| 23 | 23 | </tr> |
| 24 | 24 | <tr valign="top"> |
| 25 | - <th><label for="PRC_desc"><?php _e('Description', 'event_espresso'); ?></label> <?php echo EEH_Template::get_help_tab_link('description_field_info');?></th> |
|
| 25 | + <th><label for="PRC_desc"><?php _e('Description', 'event_espresso'); ?></label> <?php echo EEH_Template::get_help_tab_link('description_field_info'); ?></th> |
|
| 26 | 26 | <td> |
| 27 | 27 | <textarea class="regular-text" id="PRC_desc" name="PRC_desc" rows="5" ><?php |
| 28 | 28 | echo $price->desc(); |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | </td> |
| 31 | 31 | </tr> |
| 32 | 32 | <tr valign="top"> |
| 33 | - <th><label for="PRC_amount"><?php _e('Amount', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('amount_field_info');?></label></th> |
|
| 33 | + <th><label for="PRC_amount"><?php _e('Amount', 'event_espresso'); ?> <?php echo EEH_Template::get_help_tab_link('amount_field_info'); ?></label></th> |
|
| 34 | 34 | <td> |
| 35 | 35 | <input class="small-text ee-numeric" type="text" id="PRC_amount" name="PRC_amount" value="<?php echo $price->amount(); ?>"/> |
| 36 | 36 | </td> |
@@ -9,8 +9,11 @@ |
||
| 9 | 9 | <input type="hidden" name="PRT_ID" id="PRT_ID" value="<?php echo $price->type(); ?>" /> |
| 10 | 10 | <p><strong><?php _e('Price', 'event_espresso'); ?></strong></p> |
| 11 | 11 | <p class="description"><?php _e('This is the default base price. Every new ticket created will start off with this base price.', 'event_espresso'); ?></p> |
| 12 | - <?php else : ?> |
|
| 13 | - <?php echo EEH_Form_Fields::select_input('PRT_ID', $price_types, $price->type(), 'id="PRT_ID"'); ?> |
|
| 12 | + <?php else { |
|
| 13 | + : ?> |
|
| 14 | + <?php echo EEH_Form_Fields::select_input('PRT_ID', $price_types, $price->type(), 'id="PRT_ID"'); |
|
| 15 | +} |
|
| 16 | +?> |
|
| 14 | 17 | <p class="description"><?php _e('Price Modifier. Default items will apply to ALL new events you create.', 'event_espresso'); ?></p> |
| 15 | 18 | <?php endif; ?> |
| 16 | 19 | </td> |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | <label for="PRT_name"><?php _e('Price Type Name', 'event_espresso'); ?></label> |
| 19 | 19 | </th> |
| 20 | 20 | <td> |
| 21 | - <input class="regular-text" type="text" id="PRT_name" name="PRT_name" value="<?php echo htmlentities($price_type->name()) ;?>"/> |
|
| 21 | + <input class="regular-text" type="text" id="PRT_name" name="PRT_name" value="<?php echo htmlentities($price_type->name()); ?>"/> |
|
| 22 | 22 | <p class="description"><?php _e('A name for this Price Type.', 'event_espresso'); ?></p> |
| 23 | 23 | </td> |
| 24 | 24 | </tr> |
@@ -29,18 +29,18 @@ discard block |
||
| 29 | 29 | </th> |
| 30 | 30 | <td> |
| 31 | 31 | <?php $yes_checked = $price_type->is_percent() ? ' checked="checked"' : ''; ?> |
| 32 | - <label style="margin-right:15px;"><input type="radio" name="PRT_is_percent" value="1"<?php echo $yes_checked;?> style="margin-right:5px;"> |
|
| 33 | - <?php _e('Percentage', 'event_espresso');?> |
|
| 32 | + <label style="margin-right:15px;"><input type="radio" name="PRT_is_percent" value="1"<?php echo $yes_checked; ?> style="margin-right:5px;"> |
|
| 33 | + <?php _e('Percentage', 'event_espresso'); ?> |
|
| 34 | 34 | </label> |
| 35 | 35 | <?php $no_checked = $price_type->is_percent() ? '' : ' checked="checked"'; ?> |
| 36 | - <label style="margin-right:15px;"><input type="radio" name="PRT_is_percent" value="0"<?php echo $no_checked;?> style="margin-right:5px;"> |
|
| 37 | - <?php _e('Fixed', 'event_espresso');?> |
|
| 36 | + <label style="margin-right:15px;"><input type="radio" name="PRT_is_percent" value="0"<?php echo $no_checked; ?> style="margin-right:5px;"> |
|
| 37 | + <?php _e('Fixed', 'event_espresso'); ?> |
|
| 38 | 38 | </label> |
| 39 | 39 | <p class="description"><?php _e('Whether this Price Type will be applied as a percentage or applied as a set fixed amount.', 'event_espresso'); ?></p> |
| 40 | - <?php if ( $price_type->base_type() == EEM_Price_Type::base_type_tax ) : |
|
| 40 | + <?php if ($price_type->base_type() == EEM_Price_Type::base_type_tax) : |
|
| 41 | 41 | //base type is tax so let's just let the user know that taxes are always percentage. |
| 42 | 42 | ?> |
| 43 | - <p class="description" style="color:#E44064"><?php _e( 'The selected base type for this price type is "Tax". Taxes are always assumed to be a percentage. If you want to use a fixed value for a tax then please change the base type to a surcharge.', 'event_espresso' ); ?></p> |
|
| 43 | + <p class="description" style="color:#E44064"><?php _e('The selected base type for this price type is "Tax". Taxes are always assumed to be a percentage. If you want to use a fixed value for a tax then please change the base type to a surcharge.', 'event_espresso'); ?></p> |
|
| 44 | 44 | <?php endif; ?> |
| 45 | 45 | </td> |
| 46 | 46 | </tr> |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | protected function _set_page_routes() { |
| 54 | 54 | |
| 55 | - $tkt_id = ! empty( $this->_req_data['TKT_ID'] ) && ! is_array( $this->_req_data['TKT_ID'] ) ? $this->_req_data['TKT_ID'] : 0; |
|
| 55 | + $tkt_id = ! empty($this->_req_data['TKT_ID']) && ! is_array($this->_req_data['TKT_ID']) ? $this->_req_data['TKT_ID'] : 0; |
|
| 56 | 56 | |
| 57 | 57 | $this->_page_routes = array( |
| 58 | 58 | 'default' => array( |
@@ -62,14 +62,14 @@ discard block |
||
| 62 | 62 | 'trash_ticket' => array( |
| 63 | 63 | 'func' => '_trash_or_restore_ticket', |
| 64 | 64 | 'noheader' => TRUE, |
| 65 | - 'args' => array( 'trash' => TRUE ), |
|
| 65 | + 'args' => array('trash' => TRUE), |
|
| 66 | 66 | 'capability' => 'ee_delete_default_ticket', |
| 67 | 67 | 'obj_id' => $tkt_id |
| 68 | 68 | ), |
| 69 | 69 | 'trash_tickets' => array( |
| 70 | 70 | 'func' => '_trash_or_restore_ticket', |
| 71 | 71 | 'noheader' => TRUE, |
| 72 | - 'args' => array( 'trash' => TRUE ), |
|
| 72 | + 'args' => array('trash' => TRUE), |
|
| 73 | 73 | 'capability' => 'ee_delete_default_tickets' |
| 74 | 74 | ), |
| 75 | 75 | 'restore_ticket' => array( |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | 'label' => __('Trash', 'event_espresso'), |
| 144 | 144 | 'count' => 0, |
| 145 | 145 | 'bulk_action' => array( |
| 146 | - 'restore_tickets' => __('Restore from Trash' , 'event_espresso'), |
|
| 146 | + 'restore_tickets' => __('Restore from Trash', 'event_espresso'), |
|
| 147 | 147 | 'delete_tickets' => __('Delete Permanently', 'event_espresso') |
| 148 | 148 | ) |
| 149 | 149 | ) |
@@ -161,53 +161,53 @@ discard block |
||
| 161 | 161 | |
| 162 | 162 | |
| 163 | 163 | |
| 164 | - public function get_default_tickets( $per_page = 10, $count = FALSE, $trashed = FALSE ) { |
|
| 164 | + public function get_default_tickets($per_page = 10, $count = FALSE, $trashed = FALSE) { |
|
| 165 | 165 | |
| 166 | - $orderby= empty( $this->_req_data['orderby'] ) ? 'TKT_name' : $this->_req_data['orderby']; |
|
| 167 | - $order = empty( $this->_req_data['order'] ) ? 'ASC' : $order; |
|
| 166 | + $orderby = empty($this->_req_data['orderby']) ? 'TKT_name' : $this->_req_data['orderby']; |
|
| 167 | + $order = empty($this->_req_data['order']) ? 'ASC' : $order; |
|
| 168 | 168 | |
| 169 | - switch ( $orderby ) { |
|
| 169 | + switch ($orderby) { |
|
| 170 | 170 | case 'TKT_name' : |
| 171 | - $orderby = array( 'TKT_name' => $order ); |
|
| 171 | + $orderby = array('TKT_name' => $order); |
|
| 172 | 172 | break; |
| 173 | 173 | |
| 174 | 174 | case 'TKT_price' : |
| 175 | - $orderby = array( 'TKT_price' => $order ); |
|
| 175 | + $orderby = array('TKT_price' => $order); |
|
| 176 | 176 | break; |
| 177 | 177 | |
| 178 | 178 | case 'TKT_uses' : |
| 179 | - $orderby = array( 'TKT_uses' => $order ); |
|
| 179 | + $orderby = array('TKT_uses' => $order); |
|
| 180 | 180 | break; |
| 181 | 181 | |
| 182 | 182 | case 'TKT_min' : |
| 183 | - $orderby = array( 'TKT_min' => $order ); |
|
| 183 | + $orderby = array('TKT_min' => $order); |
|
| 184 | 184 | break; |
| 185 | 185 | |
| 186 | 186 | case 'TKT_max' : |
| 187 | - $orderby = array( 'TKT_max' => $order ); |
|
| 187 | + $orderby = array('TKT_max' => $order); |
|
| 188 | 188 | break; |
| 189 | 189 | |
| 190 | 190 | case 'TKT_qty' : |
| 191 | - $orderby = array( 'TKT_qty' => $order ); |
|
| 191 | + $orderby = array('TKT_qty' => $order); |
|
| 192 | 192 | break; |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
| 196 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
| 195 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
| 196 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
| 197 | 197 | |
| 198 | 198 | $_where = array( |
| 199 | 199 | 'TKT_is_default' => 1, |
| 200 | 200 | 'TKT_deleted' => $trashed |
| 201 | 201 | ); |
| 202 | 202 | |
| 203 | - $offset = ($current_page-1)*$per_page; |
|
| 204 | - $limit = array( $offset, $per_page ); |
|
| 203 | + $offset = ($current_page - 1) * $per_page; |
|
| 204 | + $limit = array($offset, $per_page); |
|
| 205 | 205 | |
| 206 | - if ( isset( $this->_req_data['s'] ) ) { |
|
| 207 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
| 206 | + if (isset($this->_req_data['s'])) { |
|
| 207 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
| 208 | 208 | $_where['OR'] = array( |
| 209 | - 'TKT_name' => array('LIKE',$sstr ), |
|
| 210 | - 'TKT_description' => array('LIKE',$sstr ) |
|
| 209 | + 'TKT_name' => array('LIKE', $sstr), |
|
| 210 | + 'TKT_description' => array('LIKE', $sstr) |
|
| 211 | 211 | ); |
| 212 | 212 | } |
| 213 | 213 | |
@@ -218,9 +218,9 @@ discard block |
||
| 218 | 218 | 'group_by'=>'TKT_ID' |
| 219 | 219 | ); |
| 220 | 220 | |
| 221 | - if($count){ |
|
| 221 | + if ($count) { |
|
| 222 | 222 | return EEM_Ticket::instance()->count_deleted_and_undeleted(array($_where)); |
| 223 | - }else{ |
|
| 223 | + } else { |
|
| 224 | 224 | return EEM_Ticket::instance()->get_all_deleted_and_undeleted($query_params); |
| 225 | 225 | } |
| 226 | 226 | |
@@ -230,41 +230,41 @@ discard block |
||
| 230 | 230 | |
| 231 | 231 | |
| 232 | 232 | |
| 233 | - protected function _trash_or_restore_ticket( $trash = FALSE ) { |
|
| 233 | + protected function _trash_or_restore_ticket($trash = FALSE) { |
|
| 234 | 234 | $success = 1; |
| 235 | 235 | |
| 236 | 236 | $TKT = EEM_Ticket::instance(); |
| 237 | 237 | |
| 238 | 238 | //checkboxes? |
| 239 | - if ( !empty( $this->_req_data['checkbox'] ) && is_array( $this->_req_data['checkbox'] ) ) { |
|
| 239 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
| 240 | 240 | //if array has more than one element then success message should be plural |
| 241 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
| 241 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
| 242 | 242 | |
| 243 | 243 | //cycle thru the boxes |
| 244 | - while ( list( $TKT_ID, $value ) = each( $this->_req_data['checkbox'] ) ) { |
|
| 245 | - if ( $trash ) { |
|
| 246 | - if ( ! $TKT->delete_by_ID( $TKT_ID ) ) |
|
| 244 | + while (list($TKT_ID, $value) = each($this->_req_data['checkbox'])) { |
|
| 245 | + if ($trash) { |
|
| 246 | + if ( ! $TKT->delete_by_ID($TKT_ID)) |
|
| 247 | 247 | $success = 0; |
| 248 | 248 | } else { |
| 249 | - if ( ! $TKT->restore_by_ID( $TKT_ID ) ) |
|
| 249 | + if ( ! $TKT->restore_by_ID($TKT_ID)) |
|
| 250 | 250 | $success = 0; |
| 251 | 251 | } |
| 252 | 252 | } |
| 253 | 253 | } else { |
| 254 | 254 | //grab single id and trash |
| 255 | - $TKT_ID = absint( $this->_req_data['TKT_ID'] ); |
|
| 255 | + $TKT_ID = absint($this->_req_data['TKT_ID']); |
|
| 256 | 256 | |
| 257 | - if ( $trash ) { |
|
| 258 | - if ( ! $TKT->delete_by_ID( $TKT_ID ) ) |
|
| 257 | + if ($trash) { |
|
| 258 | + if ( ! $TKT->delete_by_ID($TKT_ID)) |
|
| 259 | 259 | $success = 0; |
| 260 | 260 | } else { |
| 261 | - if ( ! $TKT->restore_by_ID( $TKT_ID ) ) |
|
| 261 | + if ( ! $TKT->restore_by_ID($TKT_ID)) |
|
| 262 | 262 | $success = 0; |
| 263 | 263 | } |
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | $action_desc = $trash ? 'moved to the trash' : 'restored'; |
| 267 | - $this->_redirect_after_action( $success, 'Tickets', $action_desc, array() ); |
|
| 267 | + $this->_redirect_after_action($success, 'Tickets', $action_desc, array()); |
|
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | |
@@ -277,34 +277,34 @@ discard block |
||
| 277 | 277 | $TKT = EEM_Ticket::instance(); |
| 278 | 278 | |
| 279 | 279 | //checkboxes? |
| 280 | - if ( !empty( $this->_req_data['checkbox'] ) && is_array( $this->_req_data['checkbox'] ) ) { |
|
| 280 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
| 281 | 281 | //if array has more than one element then success message should be plural |
| 282 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
| 282 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
| 283 | 283 | |
| 284 | 284 | //cycle thru the boxes |
| 285 | - while ( list( $TKT_ID, $value ) = each( $this->_req_data['checkbox'] ) ) { |
|
| 285 | + while (list($TKT_ID, $value) = each($this->_req_data['checkbox'])) { |
|
| 286 | 286 | //delete |
| 287 | - if ( ! $this->_delete_the_ticket( $TKT_ID ) ) { |
|
| 287 | + if ( ! $this->_delete_the_ticket($TKT_ID)) { |
|
| 288 | 288 | $success = 0; |
| 289 | 289 | } |
| 290 | 290 | } |
| 291 | 291 | } else { |
| 292 | 292 | //grab single id and trash |
| 293 | - $TKT_ID = absint( $this->_req_data['TKT_ID'] ); |
|
| 294 | - if ( ! $this->_delete_the_ticket( $TKT_ID ) ) { |
|
| 293 | + $TKT_ID = absint($this->_req_data['TKT_ID']); |
|
| 294 | + if ( ! $this->_delete_the_ticket($TKT_ID)) { |
|
| 295 | 295 | $success = 0; |
| 296 | 296 | } |
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 | $action_desc = 'deleted'; |
| 300 | - $this->_redirect_after_action( $success, 'Tickets', $action_desc, array() ); |
|
| 300 | + $this->_redirect_after_action($success, 'Tickets', $action_desc, array()); |
|
| 301 | 301 | } |
| 302 | 302 | |
| 303 | 303 | |
| 304 | 304 | |
| 305 | 305 | |
| 306 | - protected function _delete_the_ticket( $TKT_ID ) { |
|
| 307 | - $tkt = EEM_Ticket::instance()->get_one_by_ID( $TKT_ID ); |
|
| 306 | + protected function _delete_the_ticket($TKT_ID) { |
|
| 307 | + $tkt = EEM_Ticket::instance()->get_one_by_ID($TKT_ID); |
|
| 308 | 308 | |
| 309 | 309 | //delete all related prices first |
| 310 | 310 | $tkt->delete_related_permanently('Price'); |
@@ -1,4 +1,6 @@ discard block |
||
| 1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
| 1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
| 2 | + exit('No direct script access allowed'); |
|
| 3 | +} |
|
| 2 | 4 | /** |
| 3 | 5 | * Event Espresso |
| 4 | 6 | * |
@@ -220,7 +222,7 @@ discard block |
||
| 220 | 222 | |
| 221 | 223 | if($count){ |
| 222 | 224 | return EEM_Ticket::instance()->count_deleted_and_undeleted(array($_where)); |
| 223 | - }else{ |
|
| 225 | + } else{ |
|
| 224 | 226 | return EEM_Ticket::instance()->get_all_deleted_and_undeleted($query_params); |
| 225 | 227 | } |
| 226 | 228 | |
@@ -243,11 +245,13 @@ discard block |
||
| 243 | 245 | //cycle thru the boxes |
| 244 | 246 | while ( list( $TKT_ID, $value ) = each( $this->_req_data['checkbox'] ) ) { |
| 245 | 247 | if ( $trash ) { |
| 246 | - if ( ! $TKT->delete_by_ID( $TKT_ID ) ) |
|
| 247 | - $success = 0; |
|
| 248 | + if ( ! $TKT->delete_by_ID( $TKT_ID ) ) { |
|
| 249 | + $success = 0; |
|
| 250 | + } |
|
| 248 | 251 | } else { |
| 249 | - if ( ! $TKT->restore_by_ID( $TKT_ID ) ) |
|
| 250 | - $success = 0; |
|
| 252 | + if ( ! $TKT->restore_by_ID( $TKT_ID ) ) { |
|
| 253 | + $success = 0; |
|
| 254 | + } |
|
| 251 | 255 | } |
| 252 | 256 | } |
| 253 | 257 | } else { |
@@ -255,11 +259,13 @@ discard block |
||
| 255 | 259 | $TKT_ID = absint( $this->_req_data['TKT_ID'] ); |
| 256 | 260 | |
| 257 | 261 | if ( $trash ) { |
| 258 | - if ( ! $TKT->delete_by_ID( $TKT_ID ) ) |
|
| 259 | - $success = 0; |
|
| 262 | + if ( ! $TKT->delete_by_ID( $TKT_ID ) ) { |
|
| 263 | + $success = 0; |
|
| 264 | + } |
|
| 260 | 265 | } else { |
| 261 | - if ( ! $TKT->restore_by_ID( $TKT_ID ) ) |
|
| 262 | - $success = 0; |
|
| 266 | + if ( ! $TKT->restore_by_ID( $TKT_ID ) ) { |
|
| 267 | + $success = 0; |
|
| 268 | + } |
|
| 263 | 269 | } |
| 264 | 270 | } |
| 265 | 271 | |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | * |
| 24 | 24 | * ------------------------------------------------------------------------ |
| 25 | 25 | */ |
| 26 | -class Tickets_Admin_Page_Init extends EE_Admin_Page_Init { |
|
| 26 | +class Tickets_Admin_Page_Init extends EE_Admin_Page_Init { |
|
| 27 | 27 | |
| 28 | 28 | |
| 29 | 29 | |
@@ -36,19 +36,19 @@ discard block |
||
| 36 | 36 | */ |
| 37 | 37 | public function __construct() { |
| 38 | 38 | |
| 39 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
| 39 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
| 40 | 40 | |
| 41 | - define( 'TICKETS_PG_SLUG', 'tickets' ); |
|
| 42 | - define( 'TICKETS_LABEL', __('Default Tickets', 'event_espresso')); |
|
| 43 | - define( 'TICKETS_ADMIN', EE_CORE_CAF_ADMIN . 'new' . DS . TICKETS_PG_SLUG . DS ); |
|
| 44 | - define( 'TICKETS_ADMIN_URL', admin_url( 'admin.php?page=' . TICKETS_PG_SLUG )); |
|
| 45 | - define( 'TICKETS_ASSETS_PATH', TICKETS_ADMIN . 'assets' . DS ); |
|
| 46 | - define( 'TICKETS_ASSETS_URL', EE_CORE_CAF_ADMIN_URL . 'new' . DS . TICKETS_PG_SLUG .'/assets/' ); |
|
| 47 | - define( 'TICKETS_TEMPLATE_PATH', TICKETS_ADMIN . 'templates' . DS ); |
|
| 48 | - define( 'TICKETS_TEMPLATE_URL', EE_CORE_CAF_ADMIN_URL . 'new' . DS . TICKETS_PG_SLUG . DS . 'templates/' ); |
|
| 41 | + define('TICKETS_PG_SLUG', 'tickets'); |
|
| 42 | + define('TICKETS_LABEL', __('Default Tickets', 'event_espresso')); |
|
| 43 | + define('TICKETS_ADMIN', EE_CORE_CAF_ADMIN.'new'.DS.TICKETS_PG_SLUG.DS); |
|
| 44 | + define('TICKETS_ADMIN_URL', admin_url('admin.php?page='.TICKETS_PG_SLUG)); |
|
| 45 | + define('TICKETS_ASSETS_PATH', TICKETS_ADMIN.'assets'.DS); |
|
| 46 | + define('TICKETS_ASSETS_URL', EE_CORE_CAF_ADMIN_URL.'new'.DS.TICKETS_PG_SLUG.'/assets/'); |
|
| 47 | + define('TICKETS_TEMPLATE_PATH', TICKETS_ADMIN.'templates'.DS); |
|
| 48 | + define('TICKETS_TEMPLATE_URL', EE_CORE_CAF_ADMIN_URL.'new'.DS.TICKETS_PG_SLUG.DS.'templates/'); |
|
| 49 | 49 | |
| 50 | 50 | parent::__construct(); |
| 51 | - $this->_folder_path = EE_CORE_CAF_ADMIN . 'new' . DS . $this->_folder_name . DS; |
|
| 51 | + $this->_folder_path = EE_CORE_CAF_ADMIN.'new'.DS.$this->_folder_name.DS; |
|
| 52 | 52 | |
| 53 | 53 | } |
| 54 | 54 | |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | |
| 63 | 63 | |
| 64 | 64 | protected function _set_menu_map() { |
| 65 | - $this->_menu_map = new EE_Admin_Page_Sub_Menu( array( |
|
| 65 | + $this->_menu_map = new EE_Admin_Page_Sub_Menu(array( |
|
| 66 | 66 | 'menu_group' => 'management', |
| 67 | 67 | 'menu_order' => 15, |
| 68 | 68 | 'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY, |
@@ -1,4 +1,6 @@ |
||
| 1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
| 1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
| 2 | + exit('No direct script access allowed'); |
|
| 3 | +} |
|
| 2 | 4 | /** |
| 3 | 5 | * Event Espresso |
| 4 | 6 | * |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | 'TKT_taxable' => __('Taxable', 'event_espresso') |
| 60 | 60 | ); |
| 61 | 61 | |
| 62 | - $this->_sortable_columns = array( |
|
| 62 | + $this->_sortable_columns = array( |
|
| 63 | 63 | // TRUE means its already sorted |
| 64 | 64 | 'TKT_name' => array( 'TKT_name', TRUE ), |
| 65 | 65 | 'TKT_description' => array( 'TKT_description', FALSE ), |
@@ -68,9 +68,9 @@ discard block |
||
| 68 | 68 | 'TKT_min' => array( 'TKT_min', FALSE ), |
| 69 | 69 | 'TKT_max' => array( 'TKT_max', FALSE ), |
| 70 | 70 | 'TKT_price' => array( 'TKT_price', FALSE ) |
| 71 | - ); |
|
| 71 | + ); |
|
| 72 | 72 | |
| 73 | - $this->_hidden_columns = array( |
|
| 73 | + $this->_hidden_columns = array( |
|
| 74 | 74 | ); |
| 75 | 75 | |
| 76 | 76 | } |
@@ -31,9 +31,9 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | protected function _setup_data() { |
| 33 | 33 | $trashed = $this->_admin_page->get_view() == 'trashed' ? TRUE : FALSE; |
| 34 | - $this->_data = $this->_admin_page->get_default_tickets( $this->_per_page, FALSE, $trashed ); |
|
| 35 | - $this->_all_data_count = $this->_admin_page->get_default_tickets( $this->_per_page, TRUE, FALSE ); |
|
| 36 | - $this->_trashed_count = $this->_admin_page->get_default_tickets( $this->_per_page, TRUE, TRUE ); |
|
| 34 | + $this->_data = $this->_admin_page->get_default_tickets($this->_per_page, FALSE, $trashed); |
|
| 35 | + $this->_all_data_count = $this->_admin_page->get_default_tickets($this->_per_page, TRUE, FALSE); |
|
| 36 | + $this->_trashed_count = $this->_admin_page->get_default_tickets($this->_per_page, TRUE, TRUE); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | |
@@ -61,13 +61,13 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | $this->_sortable_columns = array( |
| 63 | 63 | // TRUE means its already sorted |
| 64 | - 'TKT_name' => array( 'TKT_name', TRUE ), |
|
| 65 | - 'TKT_description' => array( 'TKT_description', FALSE ), |
|
| 66 | - 'TKT_qty' => array( 'TKT_qty', FALSE ), |
|
| 67 | - 'TKT_uses' => array( 'TKT_uses', FALSE ), |
|
| 68 | - 'TKT_min' => array( 'TKT_min', FALSE ), |
|
| 69 | - 'TKT_max' => array( 'TKT_max', FALSE ), |
|
| 70 | - 'TKT_price' => array( 'TKT_price', FALSE ) |
|
| 64 | + 'TKT_name' => array('TKT_name', TRUE), |
|
| 65 | + 'TKT_description' => array('TKT_description', FALSE), |
|
| 66 | + 'TKT_qty' => array('TKT_qty', FALSE), |
|
| 67 | + 'TKT_uses' => array('TKT_uses', FALSE), |
|
| 68 | + 'TKT_min' => array('TKT_min', FALSE), |
|
| 69 | + 'TKT_max' => array('TKT_max', FALSE), |
|
| 70 | + 'TKT_price' => array('TKT_price', FALSE) |
|
| 71 | 71 | ); |
| 72 | 72 | |
| 73 | 73 | $this->_hidden_columns = array( |
@@ -87,14 +87,14 @@ discard block |
||
| 87 | 87 | |
| 88 | 88 | protected function _add_view_counts() { |
| 89 | 89 | $this->_views['all']['count'] = $this->_all_data_count; |
| 90 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_default_tickets', 'trash_ticket')) |
|
| 90 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_tickets', 'trash_ticket')) |
|
| 91 | 91 | $this->_views['trashed']['count'] = $this->_trashed_count; |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | |
| 95 | 95 | |
| 96 | 96 | function column_cb($item) { |
| 97 | - return $item->ID() === 1 ? '<span class="ee-lock-icon"></span>' : sprintf( '<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', /* $1%s */ $item->ID() ); |
|
| 97 | + return $item->ID() === 1 ? '<span class="ee-lock-icon"></span>' : sprintf('<input type="checkbox" name="checkbox[%1$s]" value="%1$s" />', /* $1%s */ $item->ID()); |
|
| 98 | 98 | |
| 99 | 99 | } |
| 100 | 100 | |
@@ -105,21 +105,21 @@ discard block |
||
| 105 | 105 | $actions = array(); |
| 106 | 106 | |
| 107 | 107 | //trash links |
| 108 | - if ( $item->ID() !== 1 ) { |
|
| 109 | - if ( $this->_view == 'all' ) { |
|
| 110 | - $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'trash_ticket', 'TKT_ID' => $item->ID() ), TICKETS_ADMIN_URL ); |
|
| 111 | - $actions['trash'] = '<a href="' . $trash_lnk_url . '" title="' . esc_attr__('Move Ticket to trash', 'event_espresso') . '">' . __('Trash', 'event_espresso') . '</a>'; |
|
| 108 | + if ($item->ID() !== 1) { |
|
| 109 | + if ($this->_view == 'all') { |
|
| 110 | + $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'trash_ticket', 'TKT_ID' => $item->ID()), TICKETS_ADMIN_URL); |
|
| 111 | + $actions['trash'] = '<a href="'.$trash_lnk_url.'" title="'.esc_attr__('Move Ticket to trash', 'event_espresso').'">'.__('Trash', 'event_espresso').'</a>'; |
|
| 112 | 112 | } else { |
| 113 | 113 | // restore price link |
| 114 | - $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'restore_ticket', 'TKT_ID'=>$item->ID() ), TICKETS_ADMIN_URL ); |
|
| 115 | - $actions['restore'] = '<a href="'.$restore_lnk_url.'" title="' . esc_attr__( 'Restore Ticket', 'event_espresso' ) . '">' . __( 'Restore', 'event_espresso' ) . '</a>'; |
|
| 114 | + $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'restore_ticket', 'TKT_ID'=>$item->ID()), TICKETS_ADMIN_URL); |
|
| 115 | + $actions['restore'] = '<a href="'.$restore_lnk_url.'" title="'.esc_attr__('Restore Ticket', 'event_espresso').'">'.__('Restore', 'event_espresso').'</a>'; |
|
| 116 | 116 | // delete price link |
| 117 | - $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'delete_ticket', 'TKT_ID'=>$item->ID() ), TICKETS_ADMIN_URL ); |
|
| 118 | - $actions['delete'] = '<a href="'.$delete_lnk_url.'" title="' . esc_attr__( 'Delete Ticket Permanently', 'event_espresso' ) . '">' . __( 'Delete Permanently', 'event_espresso' ) . '</a>'; |
|
| 117 | + $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'delete_ticket', 'TKT_ID'=>$item->ID()), TICKETS_ADMIN_URL); |
|
| 118 | + $actions['delete'] = '<a href="'.$delete_lnk_url.'" title="'.esc_attr__('Delete Ticket Permanently', 'event_espresso').'">'.__('Delete Permanently', 'event_espresso').'</a>'; |
|
| 119 | 119 | } |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - return $item->get('TKT_name') . $this->row_actions( $actions ); |
|
| 122 | + return $item->get('TKT_name').$this->row_actions($actions); |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | |
@@ -132,13 +132,13 @@ discard block |
||
| 132 | 132 | |
| 133 | 133 | |
| 134 | 134 | function column_TKT_qty($item) { |
| 135 | - return $item->get_pretty('TKT_qty','text'); |
|
| 135 | + return $item->get_pretty('TKT_qty', 'text'); |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | |
| 139 | 139 | |
| 140 | 140 | function column_TKT_uses($item) { |
| 141 | - return $item->get_pretty('TKT_uses','text'); |
|
| 141 | + return $item->get_pretty('TKT_uses', 'text'); |
|
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | |
| 150 | 150 | |
| 151 | 151 | function column_TKT_max($item) { |
| 152 | - return $item->get_pretty('TKT_max','text'); |
|
| 152 | + return $item->get_pretty('TKT_max', 'text'); |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | |
@@ -1,4 +1,6 @@ discard block |
||
| 1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
| 1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
| 2 | + exit('No direct script access allowed'); |
|
| 3 | +} |
|
| 2 | 4 | |
| 3 | 5 | /** |
| 4 | 6 | * Event Espresso |
@@ -87,8 +89,9 @@ discard block |
||
| 87 | 89 | |
| 88 | 90 | protected function _add_view_counts() { |
| 89 | 91 | $this->_views['all']['count'] = $this->_all_data_count; |
| 90 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_default_tickets', 'trash_ticket')) |
|
| 91 | - $this->_views['trashed']['count'] = $this->_trashed_count; |
|
| 92 | + if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_default_tickets', 'trash_ticket')) { |
|
| 93 | + $this->_views['trashed']['count'] = $this->_trashed_count; |
|
| 94 | + } |
|
| 92 | 95 | } |
| 93 | 96 | |
| 94 | 97 | |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
| 2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
| 3 | 3 | exit('NO direct script access allowed'); |
| 4 | 4 | |
| 5 | 5 | /** |
@@ -35,8 +35,8 @@ discard block |
||
| 35 | 35 | |
| 36 | 36 | |
| 37 | 37 | protected function _setup_data() { |
| 38 | - $this->_data = $this->_admin_page->get_categories( $this->_per_page, $this->_current_page); |
|
| 39 | - $this->_all_data_count = $this->_admin_page->get_categories( $this->_per_page, $this->_current_page, TRUE ); |
|
| 38 | + $this->_data = $this->_admin_page->get_categories($this->_per_page, $this->_current_page); |
|
| 39 | + $this->_all_data_count = $this->_admin_page->get_categories($this->_per_page, $this->_current_page, TRUE); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | |
@@ -45,8 +45,8 @@ discard block |
||
| 45 | 45 | |
| 46 | 46 | protected function _set_properties() { |
| 47 | 47 | $this->_wp_list_args = array( |
| 48 | - 'singular' => __('venue category', 'event_espresso' ), |
|
| 49 | - 'plural' => __('venue categories', 'event_espresso' ), |
|
| 48 | + 'singular' => __('venue category', 'event_espresso'), |
|
| 49 | + 'plural' => __('venue categories', 'event_espresso'), |
|
| 50 | 50 | 'ajax' => TRUE, //for now, |
| 51 | 51 | 'screen' => $this->_admin_page->get_current_screen()->id |
| 52 | 52 | ); |
@@ -60,9 +60,9 @@ discard block |
||
| 60 | 60 | ); |
| 61 | 61 | |
| 62 | 62 | $this->_sortable_columns = array( |
| 63 | - 'id' => array( 'Term.term_id' => true ), |
|
| 64 | - 'name' => array( 'Term.slug' => false ), |
|
| 65 | - 'count' => array( 'term_count' => false ) |
|
| 63 | + 'id' => array('Term.term_id' => true), |
|
| 64 | + 'name' => array('Term.slug' => false), |
|
| 65 | + 'count' => array('term_count' => false) |
|
| 66 | 66 | ); |
| 67 | 67 | |
| 68 | 68 | $this->_hidden_columns = array(); |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | |
| 93 | 93 | |
| 94 | 94 | public function column_cb($item) { |
| 95 | - return sprintf( '<input type="checkbox" name="VEN_CAT_ID[]" value="%s" />', $item->get('term_id') ); |
|
| 95 | + return sprintf('<input type="checkbox" name="VEN_CAT_ID[]" value="%s" />', $item->get('term_id')); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | |
@@ -120,17 +120,17 @@ discard block |
||
| 120 | 120 | 'VEN_CAT_ID' => $item->get('term_id') |
| 121 | 121 | ); |
| 122 | 122 | |
| 123 | - $edit_link = EE_Admin_Page::add_query_args_and_nonce( $edit_query_args, EE_VENUES_ADMIN_URL ); |
|
| 124 | - $delete_link = EE_Admin_Page::add_query_args_and_nonce( $delete_query_args, EE_VENUES_ADMIN_URL ); |
|
| 123 | + $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EE_VENUES_ADMIN_URL); |
|
| 124 | + $delete_link = EE_Admin_Page::add_query_args_and_nonce($delete_query_args, EE_VENUES_ADMIN_URL); |
|
| 125 | 125 | |
| 126 | 126 | $actions = array( |
| 127 | - 'edit' => '<a href="' . $edit_link . '" title="' . esc_attr__('Edit Category', 'event_espresso') . '">' . __('Edit', 'event_espresso') . '</a>' |
|
| 127 | + 'edit' => '<a href="'.$edit_link.'" title="'.esc_attr__('Edit Category', 'event_espresso').'">'.__('Edit', 'event_espresso').'</a>' |
|
| 128 | 128 | ); |
| 129 | 129 | |
| 130 | 130 | |
| 131 | - $actions['delete'] = '<a href="' . $delete_link . '" title="' . esc_attr__('Delete Category', 'event_espresso') . '">' . __('Delete', 'event_espresso') . '</a>'; |
|
| 131 | + $actions['delete'] = '<a href="'.$delete_link.'" title="'.esc_attr__('Delete Category', 'event_espresso').'">'.__('Delete', 'event_espresso').'</a>'; |
|
| 132 | 132 | |
| 133 | - $content = '<strong><a class="row-title" href="' . $edit_link . '">' . $item->get_first_related('Term')->get('name') . '</a></strong>'; |
|
| 133 | + $content = '<strong><a class="row-title" href="'.$edit_link.'">'.$item->get_first_related('Term')->get('name').'</a></strong>'; |
|
| 134 | 134 | $content .= $this->row_actions($actions); |
| 135 | 135 | return $content; |
| 136 | 136 | } |
@@ -139,20 +139,20 @@ discard block |
||
| 139 | 139 | |
| 140 | 140 | |
| 141 | 141 | public function column_shortcode($item) { |
| 142 | - $content = '[EVENT_ESPRESSO_CATEGORY category_id="' . $item->get_first_related('Term')->get('slug') . '"]'; |
|
| 142 | + $content = '[EVENT_ESPRESSO_CATEGORY category_id="'.$item->get_first_related('Term')->get('slug').'"]'; |
|
| 143 | 143 | return $content; |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | |
| 147 | 147 | |
| 148 | 148 | |
| 149 | - public function column_count( $item ) { |
|
| 149 | + public function column_count($item) { |
|
| 150 | 150 | $e_args = array( |
| 151 | 151 | 'action' => 'default', |
| 152 | 152 | 'category' => $item->get_first_related('Term')->ID() |
| 153 | 153 | ); |
| 154 | - $e_link = EE_Admin_Page::add_query_args_and_nonce( $e_args, EE_VENUES_ADMIN_URL ); |
|
| 155 | - $content = '<a href="' . $e_link . '">' . $item->get('term_count') . '</a>'; |
|
| 154 | + $e_link = EE_Admin_Page::add_query_args_and_nonce($e_args, EE_VENUES_ADMIN_URL); |
|
| 155 | + $content = '<a href="'.$e_link.'">'.$item->get('term_count').'</a>'; |
|
| 156 | 156 | return $content; |
| 157 | 157 | } |
| 158 | 158 | } |
@@ -1,6 +1,7 @@ |
||
| 1 | 1 | <?php |
| 2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
| 2 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
| 3 | 3 | exit('NO direct script access allowed'); |
| 4 | +} |
|
| 4 | 5 | |
| 5 | 6 | /** |
| 6 | 7 | * Event Espresso |
@@ -1,6 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
| 2 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
| 3 | 3 | exit('NO direct script access allowed'); |
| 4 | +} |
|
| 4 | 5 | |
| 5 | 6 | /** |
| 6 | 7 | * Event Espresso |
@@ -893,8 +894,9 @@ discard block |
||
| 893 | 894 | } |
| 894 | 895 | $action = $venue_status == 'trash' ? 'moved to the trash' : 'restored from the trash'; |
| 895 | 896 | |
| 896 | - if ( $redirect_after ) |
|
| 897 | - $this->_redirect_after_action($success, 'Venue', $action, array('action' => 'default')); |
|
| 897 | + if ( $redirect_after ) { |
|
| 898 | + $this->_redirect_after_action($success, 'Venue', $action, array('action' => 'default')); |
|
| 899 | + } |
|
| 898 | 900 | |
| 899 | 901 | } |
| 900 | 902 | |
@@ -1013,8 +1015,9 @@ discard block |
||
| 1013 | 1015 | $msg = __('An error occurred. An venue could not be deleted because a valid venue ID was not not supplied.', 'event_espresso'); |
| 1014 | 1016 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
| 1015 | 1017 | } |
| 1016 | - if ( $redirect_after ) |
|
| 1017 | - $this->_redirect_after_action($success, 'Venue', 'deleted', array('action' => 'default')); |
|
| 1018 | + if ( $redirect_after ) { |
|
| 1019 | + $this->_redirect_after_action($success, 'Venue', 'deleted', array('action' => 'default')); |
|
| 1020 | + } |
|
| 1018 | 1021 | } |
| 1019 | 1022 | |
| 1020 | 1023 | |
@@ -1185,8 +1188,10 @@ discard block |
||
| 1185 | 1188 | * @return void |
| 1186 | 1189 | */ |
| 1187 | 1190 | private function _set_category_object() { |
| 1188 | - if ( isset( $this->_category->id ) && !empty( $this->_category->id ) ) |
|
| 1189 | - return; //already have the category object so get out. |
|
| 1191 | + if ( isset( $this->_category->id ) && !empty( $this->_category->id ) ) { |
|
| 1192 | + return; |
|
| 1193 | + } |
|
| 1194 | + //already have the category object so get out. |
|
| 1190 | 1195 | |
| 1191 | 1196 | //set default category object |
| 1192 | 1197 | $this->_set_empty_category_object(); |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
| 2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
| 3 | 3 | exit('NO direct script access allowed'); |
| 4 | 4 | |
| 5 | 5 | /** |
@@ -62,10 +62,10 @@ discard block |
||
| 62 | 62 | |
| 63 | 63 | |
| 64 | 64 | protected function _init_page_props() { |
| 65 | - require_once( EE_MODELS . 'EEM_Venue.model.php' ); |
|
| 65 | + require_once(EE_MODELS.'EEM_Venue.model.php'); |
|
| 66 | 66 | $this->page_slug = EE_VENUES_PG_SLUG; |
| 67 | 67 | $this->_admin_base_url = EE_VENUES_ADMIN_URL; |
| 68 | - $this->_admin_base_path = EE_CORE_CAF_ADMIN . 'new/venues'; |
|
| 68 | + $this->_admin_base_path = EE_CORE_CAF_ADMIN.'new/venues'; |
|
| 69 | 69 | $this->page_label = __('Event Venues', 'event_espresso'); |
| 70 | 70 | $this->_cpt_model_names = array( |
| 71 | 71 | 'create_new' => 'EEM_Venue', |
@@ -119,13 +119,13 @@ discard block |
||
| 119 | 119 | protected function _set_page_routes() { |
| 120 | 120 | |
| 121 | 121 | //load formatter helper |
| 122 | - EE_Registry::instance()->load_helper( 'Formatter' ); |
|
| 122 | + EE_Registry::instance()->load_helper('Formatter'); |
|
| 123 | 123 | //load field generator helper |
| 124 | - EE_Registry::instance()->load_helper( 'Form_Fields' ); |
|
| 124 | + EE_Registry::instance()->load_helper('Form_Fields'); |
|
| 125 | 125 | |
| 126 | 126 | //is there a vnu_id in the request? |
| 127 | - $vnu_id = ! empty( $this->_req_data['VNU_ID'] ) && ! is_array( $this->_req_data['VNU_ID'] ) ? $this->_req_data['VNU_ID'] : 0; |
|
| 128 | - $vnu_id = ! empty( $this->_req_data['post'] ) ? $this->_req_data['post'] : $vnu_id; |
|
| 127 | + $vnu_id = ! empty($this->_req_data['VNU_ID']) && ! is_array($this->_req_data['VNU_ID']) ? $this->_req_data['VNU_ID'] : 0; |
|
| 128 | + $vnu_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $vnu_id; |
|
| 129 | 129 | |
| 130 | 130 | $this->_page_routes = array( |
| 131 | 131 | 'default' => array( |
@@ -143,27 +143,27 @@ discard block |
||
| 143 | 143 | ), |
| 144 | 144 | 'trash_venue' => array( |
| 145 | 145 | 'func' => '_trash_or_restore_venue', |
| 146 | - 'args' => array( 'venue_status' => 'trash' ), |
|
| 146 | + 'args' => array('venue_status' => 'trash'), |
|
| 147 | 147 | 'noheader' => TRUE, |
| 148 | 148 | 'capability' => 'ee_delete_venue', |
| 149 | 149 | 'obj_id' => $vnu_id |
| 150 | 150 | ), |
| 151 | 151 | 'trash_venues' => array( |
| 152 | 152 | 'func' => '_trash_or_restore_venues', |
| 153 | - 'args' => array( 'venue_status' => 'trash' ), |
|
| 153 | + 'args' => array('venue_status' => 'trash'), |
|
| 154 | 154 | 'noheader' => TRUE, |
| 155 | 155 | 'capability' => 'ee_delete_venues' |
| 156 | 156 | ), |
| 157 | 157 | 'restore_venue' => array( |
| 158 | 158 | 'func' => '_trash_or_restore_venue', |
| 159 | - 'args' => array( 'venue_status' => 'draft' ), |
|
| 159 | + 'args' => array('venue_status' => 'draft'), |
|
| 160 | 160 | 'noheader' => TRUE, |
| 161 | 161 | 'capability' => 'ee_delete_venue', |
| 162 | 162 | 'obj_id' => $vnu_id |
| 163 | 163 | ), |
| 164 | 164 | 'restore_venues' => array( |
| 165 | 165 | 'func' => '_trash_or_restore_venues', |
| 166 | - 'args' => array( 'venue_status' => 'draft' ), |
|
| 166 | + 'args' => array('venue_status' => 'draft'), |
|
| 167 | 167 | 'noheader' => TRUE, |
| 168 | 168 | 'capability' => 'ee_delete_venues' |
| 169 | 169 | ), |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | 'filename' => 'venues_overview_views_bulk_actions_search' |
| 256 | 256 | ) |
| 257 | 257 | ), |
| 258 | - 'help_tour' => array( 'Venues_Overview_Help_Tour' ), |
|
| 258 | + 'help_tour' => array('Venues_Overview_Help_Tour'), |
|
| 259 | 259 | 'metaboxes' => array('_espresso_news_post_box', '_espresso_links_post_box'), |
| 260 | 260 | 'require_nonce' => FALSE |
| 261 | 261 | ), |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | 'filename' => 'venues_editor_other' |
| 292 | 292 | ) |
| 293 | 293 | ), |
| 294 | - 'help_tour' => array( 'Venues_Add_Venue_Help_Tour' ), |
|
| 294 | + 'help_tour' => array('Venues_Add_Venue_Help_Tour'), |
|
| 295 | 295 | 'metaboxes' => array('_venue_editor_metaboxes'), |
| 296 | 296 | 'require_nonce' => FALSE |
| 297 | 297 | ), |
@@ -300,7 +300,7 @@ discard block |
||
| 300 | 300 | 'label' => __('Edit Venue', 'event_espresso'), |
| 301 | 301 | 'order' => 5, |
| 302 | 302 | 'persistent' => FALSE, |
| 303 | - 'url' => isset($this->_req_data['post']) ? add_query_arg(array('post' => $this->_req_data['post'] ), $this->_current_page_view_url ) : $this->_admin_base_url |
|
| 303 | + 'url' => isset($this->_req_data['post']) ? add_query_arg(array('post' => $this->_req_data['post']), $this->_current_page_view_url) : $this->_admin_base_url |
|
| 304 | 304 | ), |
| 305 | 305 | 'help_tabs' => array( |
| 306 | 306 | 'venues_editor_help_tab' => array( |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | 'filename' => 'venues_editor_other' |
| 329 | 329 | ) |
| 330 | 330 | ), |
| 331 | - 'help_tour' => array( 'Venues_Edit_Venue_Help_Tour' ), |
|
| 331 | + 'help_tour' => array('Venues_Edit_Venue_Help_Tour'), |
|
| 332 | 332 | 'metaboxes' => array('_venue_editor_metaboxes'), |
| 333 | 333 | 'require_nonce' => FALSE |
| 334 | 334 | ), |
@@ -345,7 +345,7 @@ discard block |
||
| 345 | 345 | 'filename' => 'venues_add_category' |
| 346 | 346 | ) |
| 347 | 347 | ), |
| 348 | - 'help_tour' => array( 'Venues_Add_Category_Help_Tour' ), |
|
| 348 | + 'help_tour' => array('Venues_Add_Category_Help_Tour'), |
|
| 349 | 349 | 'require_nonce' => FALSE |
| 350 | 350 | ), |
| 351 | 351 | 'edit_category' => array( |
@@ -353,7 +353,7 @@ discard block |
||
| 353 | 353 | 'label' => __('Edit Category', 'event_espresso'), |
| 354 | 354 | 'order' => 15, |
| 355 | 355 | 'persistent' => FALSE, |
| 356 | - 'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg(array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID'] ), $this->_current_page_view_url ) : $this->_admin_base_url |
|
| 356 | + 'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg(array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID']), $this->_current_page_view_url) : $this->_admin_base_url |
|
| 357 | 357 | ), |
| 358 | 358 | 'metaboxes' => array('_publish_post_box'), |
| 359 | 359 | 'help_tabs' => array( |
@@ -362,7 +362,7 @@ discard block |
||
| 362 | 362 | 'filename' => 'venues_edit_category' |
| 363 | 363 | ) |
| 364 | 364 | ), |
| 365 | - 'help_tour' => array( 'Venues_Edit_Category_Help_Tour' ), |
|
| 365 | + 'help_tour' => array('Venues_Edit_Category_Help_Tour'), |
|
| 366 | 366 | 'require_nonce' => FALSE |
| 367 | 367 | ), |
| 368 | 368 | 'category_list' => array( |
@@ -389,7 +389,7 @@ discard block |
||
| 389 | 389 | 'filename' => 'venues_categories_other' |
| 390 | 390 | ) |
| 391 | 391 | ), |
| 392 | - 'help_tour' => array( 'Venues_Categories_Help_Tour' ), |
|
| 392 | + 'help_tour' => array('Venues_Categories_Help_Tour'), |
|
| 393 | 393 | 'metaboxes' => array('_espresso_news_post_box', '_espresso_links_post_box', '_espresso_sponsors_post_box'), |
| 394 | 394 | 'require_nonce' => FALSE |
| 395 | 395 | ) |
@@ -446,7 +446,7 @@ discard block |
||
| 446 | 446 | |
| 447 | 447 | |
| 448 | 448 | public function load_scripts_styles() { |
| 449 | - wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL . 'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION ); |
|
| 449 | + wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL.'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION); |
|
| 450 | 450 | wp_enqueue_style('ee-cat-admin'); |
| 451 | 451 | } |
| 452 | 452 | |
@@ -469,7 +469,7 @@ discard block |
||
| 469 | 469 | public function load_scripts_styles_edit() { |
| 470 | 470 | //styles |
| 471 | 471 | wp_enqueue_style('espresso-ui-theme'); |
| 472 | - wp_register_style( 'espresso_venues', EE_VENUES_ASSETS_URL . 'ee-venues-admin.css', array(), EVENT_ESPRESSO_VERSION ); |
|
| 472 | + wp_register_style('espresso_venues', EE_VENUES_ASSETS_URL.'ee-venues-admin.css', array(), EVENT_ESPRESSO_VERSION); |
|
| 473 | 473 | wp_enqueue_style('espresso_venues'); |
| 474 | 474 | } |
| 475 | 475 | |
@@ -516,7 +516,7 @@ discard block |
||
| 516 | 516 | |
| 517 | 517 | |
| 518 | 518 | protected function _overview_list_table() { |
| 519 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
| 519 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
| 520 | 520 | $this->_admin_page_title .= $this->get_action_link_or_button('create_new', 'add', array(), 'add-new-h2'); |
| 521 | 521 | $this->_search_btn_label = __('Venues', 'event_espresso'); |
| 522 | 522 | $this->display_admin_list_table_page_with_sidebar(); |
@@ -530,8 +530,8 @@ discard block |
||
| 530 | 530 | 'vnu_url' => $this->_cpt_model_obj->venue_url(), |
| 531 | 531 | 'vnu_phone' => $this->_cpt_model_obj->phone() |
| 532 | 532 | ); |
| 533 | - $template = EE_VENUES_TEMPLATE_PATH . 'venue_publish_box_extras.template.php'; |
|
| 534 | - EEH_Template::display_template( $template, $extra_rows ); |
|
| 533 | + $template = EE_VENUES_TEMPLATE_PATH.'venue_publish_box_extras.template.php'; |
|
| 534 | + EEH_Template::display_template($template, $extra_rows); |
|
| 535 | 535 | } |
| 536 | 536 | |
| 537 | 537 | |
@@ -539,9 +539,9 @@ discard block |
||
| 539 | 539 | protected function _venue_editor_metaboxes() { |
| 540 | 540 | $this->verify_cpt_object(); |
| 541 | 541 | |
| 542 | - add_meta_box( 'espresso_venue_address_options', __('Physical Location', 'event_espresso'), array( $this, 'venue_address_metabox'), $this->page_slug, 'side', 'default' ); |
|
| 543 | - add_meta_box( 'espresso_venue_gmap_options', __('Google Map', 'event_espresso'), array( $this, 'venue_gmap_metabox'), $this->page_slug, 'side', 'default' ); |
|
| 544 | - add_meta_box( 'espresso_venue_virtual_loc_options', __('Virtual Location', 'event_espresso'), array( $this, 'venue_virtual_loc_metabox'), $this->page_slug, 'side', 'default' ); |
|
| 542 | + add_meta_box('espresso_venue_address_options', __('Physical Location', 'event_espresso'), array($this, 'venue_address_metabox'), $this->page_slug, 'side', 'default'); |
|
| 543 | + add_meta_box('espresso_venue_gmap_options', __('Google Map', 'event_espresso'), array($this, 'venue_gmap_metabox'), $this->page_slug, 'side', 'default'); |
|
| 544 | + add_meta_box('espresso_venue_virtual_loc_options', __('Virtual Location', 'event_espresso'), array($this, 'venue_virtual_loc_metabox'), $this->page_slug, 'side', 'default'); |
|
| 545 | 545 | |
| 546 | 546 | } |
| 547 | 547 | |
@@ -549,23 +549,23 @@ discard block |
||
| 549 | 549 | |
| 550 | 550 | public function venue_gmap_metabox() { |
| 551 | 551 | $template_args = array( |
| 552 | - 'vnu_enable_for_gmap' => EEH_Form_Fields::select_input('vnu_enable_for_gmap', $this->get_yes_no_values(), $this->_cpt_model_obj->enable_for_gmap() ), |
|
| 552 | + 'vnu_enable_for_gmap' => EEH_Form_Fields::select_input('vnu_enable_for_gmap', $this->get_yes_no_values(), $this->_cpt_model_obj->enable_for_gmap()), |
|
| 553 | 553 | 'vnu_google_map_link' => $this->_cpt_model_obj->google_map_link(), |
| 554 | 554 | ); |
| 555 | - $template = EE_VENUES_TEMPLATE_PATH . 'venue_gmap_metabox_content.template.php'; |
|
| 556 | - EEH_Template::display_template( $template, $template_args ); |
|
| 555 | + $template = EE_VENUES_TEMPLATE_PATH.'venue_gmap_metabox_content.template.php'; |
|
| 556 | + EEH_Template::display_template($template, $template_args); |
|
| 557 | 557 | } |
| 558 | 558 | |
| 559 | 559 | |
| 560 | 560 | |
| 561 | 561 | public function venue_address_metabox() { |
| 562 | 562 | |
| 563 | - $template_args['_venue'] =$this->_cpt_model_obj; |
|
| 563 | + $template_args['_venue'] = $this->_cpt_model_obj; |
|
| 564 | 564 | |
| 565 | 565 | $template_args['states_dropdown'] = EEH_Form_Fields::generate_form_input( |
| 566 | 566 | $QFI = new EE_Question_Form_Input( |
| 567 | - EE_Question::new_instance( array( 'QST_display_text' => 'State', 'QST_system' => 'state' )), |
|
| 568 | - EE_Answer::new_instance( array( 'ANS_value'=> $this->_cpt_model_obj->state_ID() )), |
|
| 567 | + EE_Question::new_instance(array('QST_display_text' => 'State', 'QST_system' => 'state')), |
|
| 568 | + EE_Answer::new_instance(array('ANS_value'=> $this->_cpt_model_obj->state_ID())), |
|
| 569 | 569 | array( |
| 570 | 570 | 'input_name' => 'sta_id', |
| 571 | 571 | 'input_id' => 'sta_id', |
@@ -577,8 +577,8 @@ discard block |
||
| 577 | 577 | ); |
| 578 | 578 | $template_args['countries_dropdown'] = EEH_Form_Fields::generate_form_input( |
| 579 | 579 | $QFI = new EE_Question_Form_Input( |
| 580 | - EE_Question::new_instance( array( 'QST_display_text' => 'Country', 'QST_system' => 'country' )), |
|
| 581 | - EE_Answer::new_instance( array( 'ANS_value'=> $this->_cpt_model_obj->country_ID() )), |
|
| 580 | + EE_Question::new_instance(array('QST_display_text' => 'Country', 'QST_system' => 'country')), |
|
| 581 | + EE_Answer::new_instance(array('ANS_value'=> $this->_cpt_model_obj->country_ID())), |
|
| 582 | 582 | array( |
| 583 | 583 | 'input_name' => 'cnt_iso', |
| 584 | 584 | 'input_id' => 'cnt_iso', |
@@ -589,8 +589,8 @@ discard block |
||
| 589 | 589 | ) |
| 590 | 590 | ); |
| 591 | 591 | |
| 592 | - $template = EE_VENUES_TEMPLATE_PATH . 'venue_address_metabox_content.template.php'; |
|
| 593 | - EEH_Template::display_template( $template, $template_args ); |
|
| 592 | + $template = EE_VENUES_TEMPLATE_PATH.'venue_address_metabox_content.template.php'; |
|
| 593 | + EEH_Template::display_template($template, $template_args); |
|
| 594 | 594 | } |
| 595 | 595 | |
| 596 | 596 | |
@@ -602,8 +602,8 @@ discard block |
||
| 602 | 602 | $template_args = array( |
| 603 | 603 | '_venue' => $this->_cpt_model_obj |
| 604 | 604 | ); |
| 605 | - $template = EE_VENUES_TEMPLATE_PATH . 'venue_virtual_location_metabox_content.template.php'; |
|
| 606 | - EEH_Template::display_template( $template, $template_args ); |
|
| 605 | + $template = EE_VENUES_TEMPLATE_PATH.'venue_virtual_location_metabox_content.template.php'; |
|
| 606 | + EEH_Template::display_template($template, $template_args); |
|
| 607 | 607 | } |
| 608 | 608 | |
| 609 | 609 | |
@@ -626,47 +626,47 @@ discard block |
||
| 626 | 626 | * @param object $post Post object (with "blessed" WP properties) |
| 627 | 627 | * @return void |
| 628 | 628 | */ |
| 629 | - protected function _insert_update_cpt_item( $post_id, $post ) { |
|
| 630 | - $wheres = array( $this->_venue_model->primary_key_name() => $post_id ); |
|
| 629 | + protected function _insert_update_cpt_item($post_id, $post) { |
|
| 630 | + $wheres = array($this->_venue_model->primary_key_name() => $post_id); |
|
| 631 | 631 | |
| 632 | 632 | $venue_values = array( |
| 633 | - 'VNU_address' => !empty( $this->_req_data['vnu_address'] ) ? $this->_req_data['vnu_address'] : NULL, |
|
| 634 | - 'VNU_address2' => !empty( $this->_req_data['vnu_address2'] ) ? $this->_req_data['vnu_address2'] : NULL, |
|
| 635 | - 'VNU_city' => !empty( $this->_req_data['vnu_city'] ) ? $this->_req_data['vnu_city'] : NULL, |
|
| 636 | - 'STA_ID' => !empty( $this->_req_data['sta_id'] ) ? $this->_req_data['sta_id'] : NULL, |
|
| 637 | - 'CNT_ISO' => !empty( $this->_req_data['cnt_iso'] ) ? $this->_req_data['cnt_iso'] : NULL, |
|
| 638 | - 'VNU_zip' => !empty( $this->_req_data['vnu_zip'] ) ? $this->_req_data['vnu_zip'] : NULL, |
|
| 639 | - 'VNU_phone' => !empty( $this->_req_data['vnu_phone'] ) ? $this->_req_data['vnu_phone'] : NULL, |
|
| 640 | - 'VNU_capacity' => !empty( $this->_req_data['vnu_capacity'] ) ? str_replace( ',', '', $this->_req_data['vnu_capacity'] ) : INF, |
|
| 641 | - 'VNU_url' => !empty( $this->_req_data['vnu_url'] ) ? $this->_req_data['vnu_url'] : NULL, |
|
| 642 | - 'VNU_virtual_phone' => !empty( $this->_req_data['vnu_virtual_phone'] ) ? $this->_req_data['vnu_virtual_phone'] : NULL, |
|
| 643 | - 'VNU_virtual_url' => !empty( $this->_req_data['vnu_virtual_url'] ) ? $this->_req_data['vnu_virtual_url'] : NULL, |
|
| 644 | - 'VNU_enable_for_gmap' => !empty( $this->_req_data['vnu_enable_for_gmap'] ) ? TRUE : FALSE, |
|
| 645 | - 'VNU_google_map_link' => !empty( $this->_req_data['vnu_google_map_link'] ) ? $this->_req_data['vnu_google_map_link'] : NULL |
|
| 633 | + 'VNU_address' => ! empty($this->_req_data['vnu_address']) ? $this->_req_data['vnu_address'] : NULL, |
|
| 634 | + 'VNU_address2' => ! empty($this->_req_data['vnu_address2']) ? $this->_req_data['vnu_address2'] : NULL, |
|
| 635 | + 'VNU_city' => ! empty($this->_req_data['vnu_city']) ? $this->_req_data['vnu_city'] : NULL, |
|
| 636 | + 'STA_ID' => ! empty($this->_req_data['sta_id']) ? $this->_req_data['sta_id'] : NULL, |
|
| 637 | + 'CNT_ISO' => ! empty($this->_req_data['cnt_iso']) ? $this->_req_data['cnt_iso'] : NULL, |
|
| 638 | + 'VNU_zip' => ! empty($this->_req_data['vnu_zip']) ? $this->_req_data['vnu_zip'] : NULL, |
|
| 639 | + 'VNU_phone' => ! empty($this->_req_data['vnu_phone']) ? $this->_req_data['vnu_phone'] : NULL, |
|
| 640 | + 'VNU_capacity' => ! empty($this->_req_data['vnu_capacity']) ? str_replace(',', '', $this->_req_data['vnu_capacity']) : INF, |
|
| 641 | + 'VNU_url' => ! empty($this->_req_data['vnu_url']) ? $this->_req_data['vnu_url'] : NULL, |
|
| 642 | + 'VNU_virtual_phone' => ! empty($this->_req_data['vnu_virtual_phone']) ? $this->_req_data['vnu_virtual_phone'] : NULL, |
|
| 643 | + 'VNU_virtual_url' => ! empty($this->_req_data['vnu_virtual_url']) ? $this->_req_data['vnu_virtual_url'] : NULL, |
|
| 644 | + 'VNU_enable_for_gmap' => ! empty($this->_req_data['vnu_enable_for_gmap']) ? TRUE : FALSE, |
|
| 645 | + 'VNU_google_map_link' => ! empty($this->_req_data['vnu_google_map_link']) ? $this->_req_data['vnu_google_map_link'] : NULL |
|
| 646 | 646 | ); |
| 647 | 647 | |
| 648 | 648 | //update venue |
| 649 | - $success = $this->_venue_model->update( $venue_values, array( $wheres ) ); |
|
| 649 | + $success = $this->_venue_model->update($venue_values, array($wheres)); |
|
| 650 | 650 | |
| 651 | 651 | //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! |
| 652 | - $get_one_where = array( $this->_venue_model->primary_key_name() => $post_id, 'status' => $post->post_status ); |
|
| 653 | - $venue = $this->_venue_model->get_one( array( $get_one_where ) ); |
|
| 652 | + $get_one_where = array($this->_venue_model->primary_key_name() => $post_id, 'status' => $post->post_status); |
|
| 653 | + $venue = $this->_venue_model->get_one(array($get_one_where)); |
|
| 654 | 654 | |
| 655 | 655 | //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. |
| 656 | - $venue_update_callbacks = apply_filters( 'FHEE__Venues_Admin_Page___insert_update_cpt_item__venue_update_callbacks', array() ); |
|
| 656 | + $venue_update_callbacks = apply_filters('FHEE__Venues_Admin_Page___insert_update_cpt_item__venue_update_callbacks', array()); |
|
| 657 | 657 | |
| 658 | 658 | $att_success = TRUE; |
| 659 | 659 | |
| 660 | - foreach ( $venue_update_callbacks as $v_callback ) { |
|
| 661 | - $_succ = call_user_func_array( $v_callback, array( $venue, $this->_req_data ) ); |
|
| 662 | - $att_success = !$att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message |
|
| 660 | + foreach ($venue_update_callbacks as $v_callback) { |
|
| 661 | + $_succ = call_user_func_array($v_callback, array($venue, $this->_req_data)); |
|
| 662 | + $att_success = ! $att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message |
|
| 663 | 663 | } |
| 664 | 664 | |
| 665 | 665 | //any errors? |
| 666 | - if ( $success && !$att_success ) { |
|
| 667 | - EE_Error::add_error( __('Venue Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 668 | - } else if ( $success === FALSE ) { |
|
| 669 | - EE_Error::add_error( __('Venue Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 666 | + if ($success && ! $att_success) { |
|
| 667 | + EE_Error::add_error(__('Venue Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
| 668 | + } else if ($success === FALSE) { |
|
| 669 | + EE_Error::add_error(__('Venue Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
| 670 | 670 | } |
| 671 | 671 | } |
| 672 | 672 | |
@@ -674,9 +674,9 @@ discard block |
||
| 674 | 674 | |
| 675 | 675 | |
| 676 | 676 | |
| 677 | - public function trash_cpt_item( $post_id ) { |
|
| 677 | + public function trash_cpt_item($post_id) { |
|
| 678 | 678 | $this->_req_data['VNU_ID'] = $post_id; |
| 679 | - $this->_trash_or_restore_venue( 'trash', FALSE ); |
|
| 679 | + $this->_trash_or_restore_venue('trash', FALSE); |
|
| 680 | 680 | } |
| 681 | 681 | |
| 682 | 682 | |
@@ -684,18 +684,18 @@ discard block |
||
| 684 | 684 | |
| 685 | 685 | |
| 686 | 686 | |
| 687 | - public function restore_cpt_item( $post_id ) { |
|
| 687 | + public function restore_cpt_item($post_id) { |
|
| 688 | 688 | $this->_req_data['VNU_ID'] = $post_id; |
| 689 | - $this->_trash_or_restore_venue( 'draft', FALSE ); |
|
| 689 | + $this->_trash_or_restore_venue('draft', FALSE); |
|
| 690 | 690 | } |
| 691 | 691 | |
| 692 | 692 | |
| 693 | 693 | |
| 694 | 694 | |
| 695 | 695 | |
| 696 | - public function delete_cpt_item( $post_id ) { |
|
| 696 | + public function delete_cpt_item($post_id) { |
|
| 697 | 697 | $this->_req_data['VNU_ID'] = $post_id; |
| 698 | - $this->_delete_venue( FALSE ); |
|
| 698 | + $this->_delete_venue(FALSE); |
|
| 699 | 699 | } |
| 700 | 700 | |
| 701 | 701 | |
@@ -710,15 +710,15 @@ discard block |
||
| 710 | 710 | |
| 711 | 711 | |
| 712 | 712 | |
| 713 | - protected function _trash_or_restore_venue( $venue_stats = 'trash', $redirect_after = TRUE ) { |
|
| 714 | - $VNU_ID = isset( $this->_req_data['VNU_ID'] ) ? absint( $this->_req_data['VNU_ID'] ) : FALSE; |
|
| 713 | + protected function _trash_or_restore_venue($venue_stats = 'trash', $redirect_after = TRUE) { |
|
| 714 | + $VNU_ID = isset($this->_req_data['VNU_ID']) ? absint($this->_req_data['VNU_ID']) : FALSE; |
|
| 715 | 715 | |
| 716 | 716 | //loop thru venues |
| 717 | - if ( $VNU_ID ) { |
|
| 717 | + if ($VNU_ID) { |
|
| 718 | 718 | //clean status |
| 719 | - $venue_status = strtoupper( sanitize_key( $venue_status ) ); |
|
| 719 | + $venue_status = strtoupper(sanitize_key($venue_status)); |
|
| 720 | 720 | // grab status |
| 721 | - if (!empty($venue_status)) { |
|
| 721 | + if ( ! empty($venue_status)) { |
|
| 722 | 722 | $success = $this->_change_venue_status($VNU_ID, $venue_status); |
| 723 | 723 | } else { |
| 724 | 724 | $success = FALSE; |
@@ -732,7 +732,7 @@ discard block |
||
| 732 | 732 | } |
| 733 | 733 | $action = $venue_status == 'trash' ? 'moved to the trash' : 'restored from the trash'; |
| 734 | 734 | |
| 735 | - if ( $redirect_after ) |
|
| 735 | + if ($redirect_after) |
|
| 736 | 736 | $this->_redirect_after_action($success, 'Venue', $action, array('action' => 'default')); |
| 737 | 737 | |
| 738 | 738 | } |
@@ -741,11 +741,11 @@ discard block |
||
| 741 | 741 | |
| 742 | 742 | |
| 743 | 743 | |
| 744 | - protected function _trash_or_restore_venues( $venue_status = 'trash' ) { |
|
| 744 | + protected function _trash_or_restore_venues($venue_status = 'trash') { |
|
| 745 | 745 | // clean status |
| 746 | 746 | $venue_status = strtoupper(sanitize_key($venue_status)); |
| 747 | 747 | // grab status |
| 748 | - if (!empty($venue_status)) { |
|
| 748 | + if ( ! empty($venue_status)) { |
|
| 749 | 749 | $success = TRUE; |
| 750 | 750 | //determine the event id and set to array. |
| 751 | 751 | $VNU_IDs = isset($this->_req_data['VNU_IDs']) ? (array) $this->_req_data['VNU_IDs'] : array(); |
@@ -785,15 +785,15 @@ discard block |
||
| 785 | 785 | * @param string $event_status |
| 786 | 786 | * @return void |
| 787 | 787 | */ |
| 788 | - private function _change_venue_status( $VNU_ID = FALSE, $venue_status = FALSE ) { |
|
| 788 | + private function _change_venue_status($VNU_ID = FALSE, $venue_status = FALSE) { |
|
| 789 | 789 | // grab venue id |
| 790 | - if (!$VNU_ID) { |
|
| 790 | + if ( ! $VNU_ID) { |
|
| 791 | 791 | $msg = __('An error occurred. No Venue ID or an invalid Venue ID was received.', 'event_espresso'); |
| 792 | 792 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
| 793 | 793 | return FALSE; |
| 794 | 794 | } |
| 795 | 795 | |
| 796 | - $this->_set_model_object( $VNU_ID ); |
|
| 796 | + $this->_set_model_object($VNU_ID); |
|
| 797 | 797 | |
| 798 | 798 | // clean status |
| 799 | 799 | $venue_status = strtoupper(sanitize_key($venue_status)); |
@@ -819,7 +819,7 @@ discard block |
||
| 819 | 819 | $hook = FALSE; |
| 820 | 820 | } |
| 821 | 821 | //use class to change status |
| 822 | - $this->_cpt_model_obj->set_status( $venue_status ); |
|
| 822 | + $this->_cpt_model_obj->set_status($venue_status); |
|
| 823 | 823 | $success = $this->_cpt_model_obj->save(); |
| 824 | 824 | |
| 825 | 825 | if ($success === FALSE) { |
@@ -838,21 +838,21 @@ discard block |
||
| 838 | 838 | * @param boolean $redirect_after [description] |
| 839 | 839 | * @return [type] [description] |
| 840 | 840 | */ |
| 841 | - protected function _delete_venue( $redirect_after = TRUE ) { |
|
| 841 | + protected function _delete_venue($redirect_after = TRUE) { |
|
| 842 | 842 | //determine the venue id and set to array. |
| 843 | 843 | $VNU_ID = isset($this->_req_data['VNU_ID']) ? absint($this->_req_data['VNU_ID']) : NULL; |
| 844 | - $VNU_ID = isset( $this->_req_data['post'] ) ? absint( $this->_req_data['post'] ) : NULL; |
|
| 844 | + $VNU_ID = isset($this->_req_data['post']) ? absint($this->_req_data['post']) : NULL; |
|
| 845 | 845 | |
| 846 | 846 | |
| 847 | 847 | // loop thru venues |
| 848 | 848 | if ($VNU_ID) { |
| 849 | - $success = $this->_delete_or_trash_venue( $VNU_ID ); |
|
| 849 | + $success = $this->_delete_or_trash_venue($VNU_ID); |
|
| 850 | 850 | } else { |
| 851 | 851 | $success = FALSE; |
| 852 | 852 | $msg = __('An error occurred. An venue could not be deleted because a valid venue ID was not not supplied.', 'event_espresso'); |
| 853 | 853 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
| 854 | 854 | } |
| 855 | - if ( $redirect_after ) |
|
| 855 | + if ($redirect_after) |
|
| 856 | 856 | $this->_redirect_after_action($success, 'Venue', 'deleted', array('action' => 'default')); |
| 857 | 857 | } |
| 858 | 858 | |
@@ -884,7 +884,7 @@ discard block |
||
| 884 | 884 | //todo: put in parent |
| 885 | 885 | private function _delete_or_trash_venue($VNU_ID = FALSE) { |
| 886 | 886 | // grab event id |
| 887 | - if (!$VNU_ID = absint($VNU_ID)) { |
|
| 887 | + if ( ! $VNU_ID = absint($VNU_ID)) { |
|
| 888 | 888 | $msg = __('An error occurred. No Venue ID or an invalid Venue ID was received.', 'event_espresso'); |
| 889 | 889 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
| 890 | 890 | return FALSE; |
@@ -904,7 +904,7 @@ discard block |
||
| 904 | 904 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
| 905 | 905 | return FALSE; |
| 906 | 906 | } |
| 907 | - do_action( 'AHEE__Venues_Admin_Page___delete_or_trash_venue__after_venue_deleted' ); |
|
| 907 | + do_action('AHEE__Venues_Admin_Page___delete_or_trash_venue__after_venue_deleted'); |
|
| 908 | 908 | return TRUE; |
| 909 | 909 | } |
| 910 | 910 | |
@@ -915,11 +915,11 @@ discard block |
||
| 915 | 915 | /* QUERIES */ |
| 916 | 916 | |
| 917 | 917 | |
| 918 | - public function get_venues( $per_page = 10, $count = FALSE ) { |
|
| 918 | + public function get_venues($per_page = 10, $count = FALSE) { |
|
| 919 | 919 | |
| 920 | - $_orderby = !empty( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : ''; |
|
| 920 | + $_orderby = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : ''; |
|
| 921 | 921 | |
| 922 | - switch ( $_orderby ) { |
|
| 922 | + switch ($_orderby) { |
|
| 923 | 923 | case 'id': |
| 924 | 924 | $orderby = 'VNU_ID'; |
| 925 | 925 | break; |
@@ -937,64 +937,64 @@ discard block |
||
| 937 | 937 | } |
| 938 | 938 | |
| 939 | 939 | |
| 940 | - $sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC'; |
|
| 940 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC'; |
|
| 941 | 941 | |
| 942 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
| 943 | - $per_page = isset( $per_page ) && !empty( $per_page ) ? $per_page : 10; |
|
| 944 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
| 942 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
| 943 | + $per_page = isset($per_page) && ! empty($per_page) ? $per_page : 10; |
|
| 944 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
| 945 | 945 | |
| 946 | 946 | |
| 947 | - $offset = ($current_page-1)*$per_page; |
|
| 947 | + $offset = ($current_page - 1) * $per_page; |
|
| 948 | 948 | $limit = array($offset, $per_page); |
| 949 | 949 | |
| 950 | - $category = isset( $this->_req_data['category'] ) && $this->_req_data['category'] > 0 ? $this->_req_data['category'] : NULL; |
|
| 950 | + $category = isset($this->_req_data['category']) && $this->_req_data['category'] > 0 ? $this->_req_data['category'] : NULL; |
|
| 951 | 951 | |
| 952 | 952 | $where = array( |
| 953 | - 'status' => isset( $this->_req_data['venue_status'] ) && $this->_req_data['venue_status'] != '' ? $this->_req_data['venue_status'] : array('IN', array('publish', 'draft') ) |
|
| 953 | + 'status' => isset($this->_req_data['venue_status']) && $this->_req_data['venue_status'] != '' ? $this->_req_data['venue_status'] : array('IN', array('publish', 'draft')) |
|
| 954 | 954 | //todo add filter by category |
| 955 | 955 | ); |
| 956 | 956 | |
| 957 | - if ( $category ) { |
|
| 957 | + if ($category) { |
|
| 958 | 958 | $where['Term_Taxonomy.taxonomy'] = 'espresso_venue_categories'; |
| 959 | 959 | $where['Term_Taxonomy.term_id'] = $category; |
| 960 | 960 | } |
| 961 | 961 | |
| 962 | 962 | //cap checks |
| 963 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_edit_private_venues', 'get_venue' ) ) { |
|
| 964 | - if ( ! empty( $where['status'][0] ) && $where['status'][0] == 'IN' ) { |
|
| 963 | + if (EE_Registry::instance()->CAP->current_user_can('ee_edit_private_venues', 'get_venue')) { |
|
| 964 | + if ( ! empty($where['status'][0]) && $where['status'][0] == 'IN') { |
|
| 965 | 965 | $where['status'][1][] = 'private'; |
| 966 | 966 | } |
| 967 | 967 | } |
| 968 | 968 | |
| 969 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_venues', 'get_venues' ) ) { |
|
| 970 | - $where['VNU_wp_user'] = get_current_user_id(); |
|
| 969 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_venues', 'get_venues')) { |
|
| 970 | + $where['VNU_wp_user'] = get_current_user_id(); |
|
| 971 | 971 | } |
| 972 | 972 | |
| 973 | 973 | |
| 974 | - if ( isset( $this->_req_data['s'] ) ) { |
|
| 975 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
| 974 | + if (isset($this->_req_data['s'])) { |
|
| 975 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
| 976 | 976 | $where['OR'] = array( |
| 977 | - 'VNU_name' => array('LIKE',$sstr ), |
|
| 978 | - 'VNU_desc' => array('LIKE',$sstr ), |
|
| 979 | - 'VNU_short_desc' => array( 'LIKE',$sstr ), |
|
| 980 | - 'VNU_address' => array( 'LIKE', $sstr ), |
|
| 981 | - 'VNU_address2' => array( 'LIKE', $sstr ), |
|
| 982 | - 'VNU_city' => array( 'LIKE', $sstr ), |
|
| 983 | - 'VNU_zip' => array( 'LIKE', $sstr ), |
|
| 984 | - 'VNU_phone' => array( 'LIKE', $sstr ), |
|
| 985 | - 'VNU_url' => array( 'LIKE', $sstr ), |
|
| 986 | - 'VNU_virtual_phone' => array( 'LIKE', $sstr ), |
|
| 987 | - 'VNU_virtual_url' => array( 'LIKE', $sstr ), |
|
| 988 | - 'VNU_google_map_link' => array( 'LIKE', $sstr ), |
|
| 989 | - 'Event.EVT_name' => array('LIKE', $sstr ), |
|
| 990 | - 'Event.EVT_desc' => array('LIKE', $sstr ), |
|
| 991 | - 'Event.EVT_phone' => array('LIKE', $sstr ), |
|
| 992 | - 'Event.EVT_external_URL' => array('LIKE', $sstr ), |
|
| 977 | + 'VNU_name' => array('LIKE', $sstr), |
|
| 978 | + 'VNU_desc' => array('LIKE', $sstr), |
|
| 979 | + 'VNU_short_desc' => array('LIKE', $sstr), |
|
| 980 | + 'VNU_address' => array('LIKE', $sstr), |
|
| 981 | + 'VNU_address2' => array('LIKE', $sstr), |
|
| 982 | + 'VNU_city' => array('LIKE', $sstr), |
|
| 983 | + 'VNU_zip' => array('LIKE', $sstr), |
|
| 984 | + 'VNU_phone' => array('LIKE', $sstr), |
|
| 985 | + 'VNU_url' => array('LIKE', $sstr), |
|
| 986 | + 'VNU_virtual_phone' => array('LIKE', $sstr), |
|
| 987 | + 'VNU_virtual_url' => array('LIKE', $sstr), |
|
| 988 | + 'VNU_google_map_link' => array('LIKE', $sstr), |
|
| 989 | + 'Event.EVT_name' => array('LIKE', $sstr), |
|
| 990 | + 'Event.EVT_desc' => array('LIKE', $sstr), |
|
| 991 | + 'Event.EVT_phone' => array('LIKE', $sstr), |
|
| 992 | + 'Event.EVT_external_URL' => array('LIKE', $sstr), |
|
| 993 | 993 | ); |
| 994 | 994 | } |
| 995 | 995 | |
| 996 | 996 | |
| 997 | - $venues = $count ? $this->_venue_model->count( array($where), 'VNU_ID' ) : $this->_venue_model->get_all( array( $where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $sort ) ); |
|
| 997 | + $venues = $count ? $this->_venue_model->count(array($where), 'VNU_ID') : $this->_venue_model->get_all(array($where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $sort)); |
|
| 998 | 998 | |
| 999 | 999 | return $venues; |
| 1000 | 1000 | |
@@ -1012,22 +1012,22 @@ discard block |
||
| 1012 | 1012 | * @return void |
| 1013 | 1013 | */ |
| 1014 | 1014 | private function _set_category_object() { |
| 1015 | - if ( isset( $this->_category->id ) && !empty( $this->_category->id ) ) |
|
| 1015 | + if (isset($this->_category->id) && ! empty($this->_category->id)) |
|
| 1016 | 1016 | return; //already have the category object so get out. |
| 1017 | 1017 | |
| 1018 | 1018 | //set default category object |
| 1019 | 1019 | $this->_set_empty_category_object(); |
| 1020 | 1020 | |
| 1021 | 1021 | //only set if we've got an id |
| 1022 | - if ( !isset($this->_req_data['VEN_CAT_ID'] ) ) { |
|
| 1022 | + if ( ! isset($this->_req_data['VEN_CAT_ID'])) { |
|
| 1023 | 1023 | return; |
| 1024 | 1024 | } |
| 1025 | 1025 | |
| 1026 | 1026 | $category_id = absint($this->_req_data['VEN_CAT_ID']); |
| 1027 | - $term = get_term( $category_id, 'espresso_venue_categories' ); |
|
| 1027 | + $term = get_term($category_id, 'espresso_venue_categories'); |
|
| 1028 | 1028 | |
| 1029 | 1029 | |
| 1030 | - if ( !empty( $term ) ) { |
|
| 1030 | + if ( ! empty($term)) { |
|
| 1031 | 1031 | $this->_category->category_name = $term->name; |
| 1032 | 1032 | $this->_category->category_identifier = $term->slug; |
| 1033 | 1033 | $this->_category->category_desc = $term->description; |
@@ -1041,14 +1041,14 @@ discard block |
||
| 1041 | 1041 | |
| 1042 | 1042 | private function _set_empty_category_object() { |
| 1043 | 1043 | $this->_category = new stdClass(); |
| 1044 | - $this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc = ''; |
|
| 1044 | + $this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc = ''; |
|
| 1045 | 1045 | $this->_category->id = $this->_category->parent = 0; |
| 1046 | 1046 | } |
| 1047 | 1047 | |
| 1048 | 1048 | |
| 1049 | 1049 | |
| 1050 | 1050 | protected function _category_list_table() { |
| 1051 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
| 1051 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
| 1052 | 1052 | $this->_admin_page_title .= $this->get_action_link_or_button('add_category', 'add_category', array(), 'add-new-h2'); |
| 1053 | 1053 | $this->_search_btn_label = __('Venue Categories', 'event_espresso'); |
| 1054 | 1054 | $this->display_admin_list_table_page_with_sidebar(); |
@@ -1058,21 +1058,21 @@ discard block |
||
| 1058 | 1058 | protected function _category_details($view) { |
| 1059 | 1059 | |
| 1060 | 1060 | //load formatter helper |
| 1061 | - EE_Registry::instance()->load_helper( 'Formatter' ); |
|
| 1061 | + EE_Registry::instance()->load_helper('Formatter'); |
|
| 1062 | 1062 | //load field generator helper |
| 1063 | - EE_Registry::instance()->load_helper( 'Form_Fields' ); |
|
| 1063 | + EE_Registry::instance()->load_helper('Form_Fields'); |
|
| 1064 | 1064 | |
| 1065 | 1065 | $route = $view == 'edit' ? 'update_category' : 'insert_category'; |
| 1066 | 1066 | $this->_set_add_edit_form_tags($route); |
| 1067 | 1067 | |
| 1068 | 1068 | $this->_set_category_object(); |
| 1069 | - $id = !empty($this->_category->id) ? $this->_category->id : ''; |
|
| 1069 | + $id = ! empty($this->_category->id) ? $this->_category->id : ''; |
|
| 1070 | 1070 | |
| 1071 | 1071 | $delete_action = 'delete_category'; |
| 1072 | 1072 | |
| 1073 | - $redirect = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'category_list' ), $this->_admin_base_url ); |
|
| 1073 | + $redirect = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'category_list'), $this->_admin_base_url); |
|
| 1074 | 1074 | |
| 1075 | - $this->_set_publish_post_box_vars( 'VEN_CAT_ID', $id, $delete_action, $redirect ); |
|
| 1075 | + $this->_set_publish_post_box_vars('VEN_CAT_ID', $id, $delete_action, $redirect); |
|
| 1076 | 1076 | |
| 1077 | 1077 | //take care of contents |
| 1078 | 1078 | $this->_template_args['admin_page_content'] = $this->_category_details_content(); |
@@ -1086,25 +1086,25 @@ discard block |
||
| 1086 | 1086 | 'type' => 'wp_editor', |
| 1087 | 1087 | 'value' => EEH_Formatter::admin_format_content($this->_category->category_desc), |
| 1088 | 1088 | 'class' => 'my_editor_custom', |
| 1089 | - 'wpeditor_args' => array( 'media_buttons' => FALSE ) |
|
| 1089 | + 'wpeditor_args' => array('media_buttons' => FALSE) |
|
| 1090 | 1090 | ); |
| 1091 | - $_wp_editor = $this->_generate_admin_form_fields( $editor_args, 'array' ); |
|
| 1091 | + $_wp_editor = $this->_generate_admin_form_fields($editor_args, 'array'); |
|
| 1092 | 1092 | |
| 1093 | - $all_terms = get_terms( array('espresso_venue_categories' ), array( 'hide_empty' => 0, 'exclude' => array( $this->_category->id ) ) ); |
|
| 1093 | + $all_terms = get_terms(array('espresso_venue_categories'), array('hide_empty' => 0, 'exclude' => array($this->_category->id))); |
|
| 1094 | 1094 | |
| 1095 | 1095 | //setup category select for term parents. |
| 1096 | 1096 | $category_select_values[] = array( |
| 1097 | 1097 | 'text' => __('No Parent', 'event_espresso'), |
| 1098 | 1098 | 'id' => 0 |
| 1099 | 1099 | ); |
| 1100 | - foreach ( $all_terms as $term ) { |
|
| 1100 | + foreach ($all_terms as $term) { |
|
| 1101 | 1101 | $category_select_values[] = array( |
| 1102 | 1102 | 'text' => $term->name, |
| 1103 | 1103 | 'id' => $term->term_id |
| 1104 | 1104 | ); |
| 1105 | 1105 | } |
| 1106 | 1106 | |
| 1107 | - $category_select = EEH_Form_Fields::select_input( 'category_parent', $category_select_values, $this->_category->parent ); |
|
| 1107 | + $category_select = EEH_Form_Fields::select_input('category_parent', $category_select_values, $this->_category->parent); |
|
| 1108 | 1108 | $template_args = array( |
| 1109 | 1109 | 'category' => $this->_category, |
| 1110 | 1110 | 'category_select' => $category_select, |
@@ -1113,15 +1113,15 @@ discard block |
||
| 1113 | 1113 | 'disable' => '', |
| 1114 | 1114 | 'disabled_message' =>FALSE |
| 1115 | 1115 | ); |
| 1116 | - $template = EVENTS_TEMPLATE_PATH . 'event_category_details.template.php'; |
|
| 1117 | - return EEH_Template::display_template($template, $template_args, TRUE ); |
|
| 1116 | + $template = EVENTS_TEMPLATE_PATH.'event_category_details.template.php'; |
|
| 1117 | + return EEH_Template::display_template($template, $template_args, TRUE); |
|
| 1118 | 1118 | } |
| 1119 | 1119 | |
| 1120 | 1120 | |
| 1121 | 1121 | protected function _delete_categories() { |
| 1122 | - $cat_ids = isset( $this->_req_data['VEN_CAT_ID'] ) ? (array) $this->_req_data['VEN_CAT_ID'] : (array) $this->_req_data['category_id']; |
|
| 1122 | + $cat_ids = isset($this->_req_data['VEN_CAT_ID']) ? (array) $this->_req_data['VEN_CAT_ID'] : (array) $this->_req_data['category_id']; |
|
| 1123 | 1123 | |
| 1124 | - foreach ( $cat_ids as $cat_id ) { |
|
| 1124 | + foreach ($cat_ids as $cat_id) { |
|
| 1125 | 1125 | $this->_delete_category($cat_id); |
| 1126 | 1126 | } |
| 1127 | 1127 | |
@@ -1129,7 +1129,7 @@ discard block |
||
| 1129 | 1129 | $query_args = array( |
| 1130 | 1130 | 'action' => 'category_list' |
| 1131 | 1131 | ); |
| 1132 | - $this->_redirect_after_action(0,'','',$query_args); |
|
| 1132 | + $this->_redirect_after_action(0, '', '', $query_args); |
|
| 1133 | 1133 | |
| 1134 | 1134 | } |
| 1135 | 1135 | |
@@ -1138,47 +1138,47 @@ discard block |
||
| 1138 | 1138 | |
| 1139 | 1139 | |
| 1140 | 1140 | protected function _delete_category($cat_id) { |
| 1141 | - $cat_id = absint( $cat_id ); |
|
| 1142 | - wp_delete_term( $cat_id, 'espresso_venue_categories' ); |
|
| 1141 | + $cat_id = absint($cat_id); |
|
| 1142 | + wp_delete_term($cat_id, 'espresso_venue_categories'); |
|
| 1143 | 1143 | } |
| 1144 | 1144 | |
| 1145 | 1145 | |
| 1146 | 1146 | |
| 1147 | 1147 | protected function _insert_or_update_category($new_category) { |
| 1148 | 1148 | |
| 1149 | - $cat_id = $new_category ? $this->_insert_category() : $this->_insert_category( TRUE ); |
|
| 1149 | + $cat_id = $new_category ? $this->_insert_category() : $this->_insert_category(TRUE); |
|
| 1150 | 1150 | $success = 0; //we already have a success message so lets not send another. |
| 1151 | 1151 | $query_args = array( |
| 1152 | 1152 | 'action' => 'edit_category', |
| 1153 | 1153 | 'VEN_CAT_ID' => $cat_id |
| 1154 | 1154 | ); |
| 1155 | - $this->_redirect_after_action( $success, '','', $query_args, TRUE ); |
|
| 1155 | + $this->_redirect_after_action($success, '', '', $query_args, TRUE); |
|
| 1156 | 1156 | |
| 1157 | 1157 | } |
| 1158 | 1158 | |
| 1159 | 1159 | |
| 1160 | 1160 | |
| 1161 | - private function _insert_category( $update = FALSE ) { |
|
| 1161 | + private function _insert_category($update = FALSE) { |
|
| 1162 | 1162 | $cat_id = $update ? $this->_req_data['VEN_CAT_ID'] : ''; |
| 1163 | - $category_name= isset( $this->_req_data['category_name'] ) ? $this->_req_data['category_name'] : ''; |
|
| 1164 | - $category_desc= isset( $this->_req_data['category_desc'] ) ? $this->_req_data['category_desc'] : ''; |
|
| 1165 | - $category_parent = isset( $this->_req_data['category_parent'] ) ? $this->_req_data['category_parent'] : 0; |
|
| 1163 | + $category_name = isset($this->_req_data['category_name']) ? $this->_req_data['category_name'] : ''; |
|
| 1164 | + $category_desc = isset($this->_req_data['category_desc']) ? $this->_req_data['category_desc'] : ''; |
|
| 1165 | + $category_parent = isset($this->_req_data['category_parent']) ? $this->_req_data['category_parent'] : 0; |
|
| 1166 | 1166 | |
| 1167 | - $term_args=array( |
|
| 1167 | + $term_args = array( |
|
| 1168 | 1168 | 'name'=>$category_name, |
| 1169 | 1169 | 'description'=>$category_desc, |
| 1170 | 1170 | 'parent'=>$category_parent |
| 1171 | 1171 | ); |
| 1172 | 1172 | |
| 1173 | - $insert_ids = $update ? wp_update_term( $cat_id, 'espresso_venue_categories', $term_args ) :wp_insert_term( $category_name, 'espresso_venue_categories', $term_args ); |
|
| 1173 | + $insert_ids = $update ? wp_update_term($cat_id, 'espresso_venue_categories', $term_args) : wp_insert_term($category_name, 'espresso_venue_categories', $term_args); |
|
| 1174 | 1174 | |
| 1175 | - if ( !is_array( $insert_ids ) ) { |
|
| 1176 | - $msg = __( 'An error occurred and the category has not been saved to the database.', 'event_espresso', 'event_espresso' ); |
|
| 1177 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1175 | + if ( ! is_array($insert_ids)) { |
|
| 1176 | + $msg = __('An error occurred and the category has not been saved to the database.', 'event_espresso', 'event_espresso'); |
|
| 1177 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 1178 | 1178 | } else { |
| 1179 | 1179 | $cat_id = $insert_ids['term_id']; |
| 1180 | - $msg = sprintf ( __('The category %s was successfuly created', 'event_espresso'), $category_name ); |
|
| 1181 | - EE_Error::add_success( $msg ); |
|
| 1180 | + $msg = sprintf(__('The category %s was successfuly created', 'event_espresso'), $category_name); |
|
| 1181 | + EE_Error::add_success($msg); |
|
| 1182 | 1182 | } |
| 1183 | 1183 | |
| 1184 | 1184 | return $cat_id; |
@@ -1198,12 +1198,12 @@ discard block |
||
| 1198 | 1198 | 'category_ids' => $this->_req_data['VEN_CAT_ID'] |
| 1199 | 1199 | ); |
| 1200 | 1200 | |
| 1201 | - $this->_req_data = array_merge( $this->_req_data, $new_request_args ); |
|
| 1201 | + $this->_req_data = array_merge($this->_req_data, $new_request_args); |
|
| 1202 | 1202 | |
| 1203 | - EE_Registry::instance()->load_helper( 'File' ); |
|
| 1204 | - if ( is_readable( EE_CLASSES . 'EE_Export.class.php') ) { |
|
| 1205 | - require_once( EE_CLASSES . 'EE_Export.class.php'); |
|
| 1206 | - $EE_Export = EE_Export::instance( $this->_req_data ); |
|
| 1203 | + EE_Registry::instance()->load_helper('File'); |
|
| 1204 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
| 1205 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
| 1206 | + $EE_Export = EE_Export::instance($this->_req_data); |
|
| 1207 | 1207 | $EE_Export->export(); |
| 1208 | 1208 | } |
| 1209 | 1209 | |
@@ -1215,7 +1215,7 @@ discard block |
||
| 1215 | 1215 | |
| 1216 | 1216 | protected function _import_categories() { |
| 1217 | 1217 | |
| 1218 | - require_once(EE_CLASSES . 'EE_Import.class.php'); |
|
| 1218 | + require_once(EE_CLASSES.'EE_Import.class.php'); |
|
| 1219 | 1219 | EE_Import::instance()->import(); |
| 1220 | 1220 | |
| 1221 | 1221 | } |
@@ -1223,29 +1223,29 @@ discard block |
||
| 1223 | 1223 | |
| 1224 | 1224 | |
| 1225 | 1225 | |
| 1226 | - public function get_categories( $per_page = 10, $current_page = 1, $count = FALSE ) { |
|
| 1226 | + public function get_categories($per_page = 10, $current_page = 1, $count = FALSE) { |
|
| 1227 | 1227 | |
| 1228 | 1228 | //testing term stuff |
| 1229 | - $orderby = isset( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : 'Term.term_id'; |
|
| 1230 | - $order = isset( $this->_req_data['order'] ) ? $this->_req_data['order'] : 'DESC'; |
|
| 1231 | - $limit = ($current_page-1)*$per_page; |
|
| 1232 | - $where = array( 'taxonomy' => 'espresso_venue_categories' ); |
|
| 1233 | - if ( isset( $this->_req_data['s'] ) ) { |
|
| 1234 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
| 1229 | + $orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'Term.term_id'; |
|
| 1230 | + $order = isset($this->_req_data['order']) ? $this->_req_data['order'] : 'DESC'; |
|
| 1231 | + $limit = ($current_page - 1) * $per_page; |
|
| 1232 | + $where = array('taxonomy' => 'espresso_venue_categories'); |
|
| 1233 | + if (isset($this->_req_data['s'])) { |
|
| 1234 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
| 1235 | 1235 | $where['OR'] = array( |
| 1236 | - 'Term.name' => array( 'LIKE', $sstr), |
|
| 1237 | - 'description' => array( 'LIKE', $sstr ) |
|
| 1236 | + 'Term.name' => array('LIKE', $sstr), |
|
| 1237 | + 'description' => array('LIKE', $sstr) |
|
| 1238 | 1238 | ); |
| 1239 | 1239 | } |
| 1240 | 1240 | |
| 1241 | 1241 | $query_params = array( |
| 1242 | 1242 | $where, |
| 1243 | - 'order_by' => array( $orderby => $order ), |
|
| 1244 | - 'limit' => $limit . ',' . $per_page, |
|
| 1243 | + 'order_by' => array($orderby => $order), |
|
| 1244 | + 'limit' => $limit.','.$per_page, |
|
| 1245 | 1245 | 'force_join' => array('Term') |
| 1246 | 1246 | ); |
| 1247 | 1247 | |
| 1248 | - $categories = $count ? EEM_Term_Taxonomy::instance()->count( $query_params, 'term_id' ) :EEM_Term_Taxonomy::instance()->get_all( $query_params ); |
|
| 1248 | + $categories = $count ? EEM_Term_Taxonomy::instance()->count($query_params, 'term_id') : EEM_Term_Taxonomy::instance()->get_all($query_params); |
|
| 1249 | 1249 | |
| 1250 | 1250 | return $categories; |
| 1251 | 1251 | } |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
| 2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
| 3 | 3 | exit('NO direct script access allowed'); |
| 4 | 4 | |
| 5 | 5 | /** |
@@ -32,13 +32,13 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | public function __construct() { |
| 34 | 34 | //define some event categories related constants |
| 35 | - define( 'EE_VENUES_PG_SLUG', 'espresso_venues' ); |
|
| 36 | - define( 'EE_VENUES_ADMIN_URL', admin_url('admin.php?page=' . EE_VENUES_PG_SLUG )); |
|
| 37 | - define( 'EE_VENUES_ASSETS_URL', EE_CORE_CAF_ADMIN_URL . 'new/venues/assets/'); |
|
| 38 | - define( 'EE_VENUES_TEMPLATE_PATH', EE_CORE_CAF_ADMIN . 'new/venues/templates/' ); |
|
| 35 | + define('EE_VENUES_PG_SLUG', 'espresso_venues'); |
|
| 36 | + define('EE_VENUES_ADMIN_URL', admin_url('admin.php?page='.EE_VENUES_PG_SLUG)); |
|
| 37 | + define('EE_VENUES_ASSETS_URL', EE_CORE_CAF_ADMIN_URL.'new/venues/assets/'); |
|
| 38 | + define('EE_VENUES_TEMPLATE_PATH', EE_CORE_CAF_ADMIN.'new/venues/templates/'); |
|
| 39 | 39 | |
| 40 | 40 | parent::__construct(); |
| 41 | - $this->_folder_path = EE_CORE_CAF_ADMIN . 'new/' . $this->_folder_name . DS; |
|
| 41 | + $this->_folder_path = EE_CORE_CAF_ADMIN.'new/'.$this->_folder_name.DS; |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | protected function _set_init_properties() { |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | |
| 50 | 50 | |
| 51 | 51 | protected function _set_menu_map() { |
| 52 | - $this->_menu_map = new EE_Admin_Page_Sub_Menu( array( |
|
| 52 | + $this->_menu_map = new EE_Admin_Page_Sub_Menu(array( |
|
| 53 | 53 | 'menu_group' => 'management', |
| 54 | 54 | 'menu_order' => 40, |
| 55 | 55 | 'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY, |
@@ -1,6 +1,7 @@ |
||
| 1 | 1 | <?php |
| 2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
| 2 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
| 3 | 3 | exit('NO direct script access allowed'); |
| 4 | +} |
|
| 4 | 5 | |
| 5 | 6 | /** |
| 6 | 7 | * Event Espresso |
@@ -1,6 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
| 2 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
| 3 | 3 | exit('NO direct script access allowed'); |
| 4 | +} |
|
| 4 | 5 | |
| 5 | 6 | /** |
| 6 | 7 | * Event Espresso |
@@ -163,11 +164,14 @@ discard block |
||
| 163 | 164 | $evt_venue = $evtobj->venues(); |
| 164 | 165 | $evt_venue = !empty( $evt_venue ) ? array_shift( $evt_venue ) : NULL; |
| 165 | 166 | |
| 166 | - if ( !empty( $evt_venue ) && $evt_venue->ID() != $venue_id ) |
|
| 167 | - $evtobj->_remove_relation_to( $evt_venue->ID(), 'Venue' ); |
|
| 167 | + if ( !empty( $evt_venue ) && $evt_venue->ID() != $venue_id ) { |
|
| 168 | + $evtobj->_remove_relation_to( $evt_venue->ID(), 'Venue' ); |
|
| 169 | + } |
|
| 168 | 170 | |
| 169 | - if ( empty( $venue_id ) ) |
|
| 170 | - return TRUE; //no venue to attach |
|
| 171 | + if ( empty( $venue_id ) ) { |
|
| 172 | + return TRUE; |
|
| 173 | + } |
|
| 174 | + //no venue to attach |
|
| 171 | 175 | |
| 172 | 176 | // this should take care of adding to revisions as well as main post object |
| 173 | 177 | $success = $evtobj->_add_relation_to( $venue_id, 'Venue' ); |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
| 2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
| 3 | 3 | exit('NO direct script access allowed'); |
| 4 | 4 | |
| 5 | 5 | /** |
@@ -33,8 +33,8 @@ discard block |
||
| 33 | 33 | protected $_event; |
| 34 | 34 | |
| 35 | 35 | |
| 36 | - public function __construct( EE_Admin_Page $admin_page ) { |
|
| 37 | - parent::__construct( $admin_page ); |
|
| 36 | + public function __construct(EE_Admin_Page $admin_page) { |
|
| 37 | + parent::__construct($admin_page); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | |
@@ -42,11 +42,11 @@ discard block |
||
| 42 | 42 | $this->_name = 'venues'; |
| 43 | 43 | $this->_remove_metaboxes = array( |
| 44 | 44 | 0 => array( |
| 45 | - 'page_route' => array( 'create_new', 'edit' ), |
|
| 45 | + 'page_route' => array('create_new', 'edit'), |
|
| 46 | 46 | 'id' => 'espresso_event_editor_venue', |
| 47 | 47 | 'context' => 'normal' |
| 48 | 48 | ) |
| 49 | - );/**/ |
|
| 49 | + ); /**/ |
|
| 50 | 50 | $this->_metaboxes = array( |
| 51 | 51 | 0 => array( |
| 52 | 52 | 'page_route' => array('edit', 'create_new'), |
@@ -55,18 +55,18 @@ discard block |
||
| 55 | 55 | 'priority' => 'high', |
| 56 | 56 | 'context' => 'normal' |
| 57 | 57 | ) |
| 58 | - );/**/ |
|
| 58 | + ); /**/ |
|
| 59 | 59 | |
| 60 | 60 | $this->_scripts_styles = array( |
| 61 | 61 | 'registers' => array( |
| 62 | 62 | 'ee_event_venues' => array( |
| 63 | 63 | 'type' => 'js', |
| 64 | - 'url' => EE_VENUES_ASSETS_URL . 'ee-event-venues-admin.js', |
|
| 64 | + 'url' => EE_VENUES_ASSETS_URL.'ee-event-venues-admin.js', |
|
| 65 | 65 | 'depends' => array('jquery') |
| 66 | 66 | ), |
| 67 | 67 | 'ee_event_venues_css' => array( |
| 68 | 68 | 'type' => 'css', |
| 69 | - 'url' => EE_VENUES_ASSETS_URL . 'ee-event-venues-admin.css', |
|
| 69 | + 'url' => EE_VENUES_ASSETS_URL.'ee-event-venues-admin.css', |
|
| 70 | 70 | ) |
| 71 | 71 | ), |
| 72 | 72 | 'enqueues' => array( |
@@ -76,24 +76,24 @@ discard block |
||
| 76 | 76 | ); |
| 77 | 77 | |
| 78 | 78 | //hook into the handler for saving venue |
| 79 | - add_filter( 'FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array( $this, 'modify_callbacks' ), 10 ); |
|
| 79 | + add_filter('FHEE__Events_Admin_Page___insert_update_cpt_item__event_update_callbacks', array($this, 'modify_callbacks'), 10); |
|
| 80 | 80 | |
| 81 | 81 | //remove default ee_autosave returns for DECAF venues (not needed for CAF venues cause we have a dropdown selector) |
| 82 | - add_filter( 'FHEE__Events_Admin_Page__ee_autosave_edit_do_decaf_venue_save', '__return_false' ); |
|
| 82 | + add_filter('FHEE__Events_Admin_Page__ee_autosave_edit_do_decaf_venue_save', '__return_false'); |
|
| 83 | 83 | |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | |
| 87 | - public function modify_callbacks( $callbacks ) { |
|
| 87 | + public function modify_callbacks($callbacks) { |
|
| 88 | 88 | // first remove default venue callback |
| 89 | - foreach ( $callbacks as $key => $callback ) { |
|
| 90 | - if ( $callback[1] == '_default_venue_update' ) { |
|
| 91 | - unset( $callbacks[$key] ); |
|
| 89 | + foreach ($callbacks as $key => $callback) { |
|
| 90 | + if ($callback[1] == '_default_venue_update') { |
|
| 91 | + unset($callbacks[$key]); |
|
| 92 | 92 | } |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | //now let's add the caf version |
| 96 | - $callbacks[] = array( $this, 'caf_venue_update' ); |
|
| 96 | + $callbacks[] = array($this, 'caf_venue_update'); |
|
| 97 | 97 | return $callbacks; |
| 98 | 98 | } |
| 99 | 99 | |
@@ -109,61 +109,61 @@ discard block |
||
| 109 | 109 | $evt_id = $evt_obj->ID(); |
| 110 | 110 | |
| 111 | 111 | //first let's see if we have a venue already |
| 112 | - $evt_venues = !empty( $evt_id ) ? $evt_obj->venues() : array(); |
|
| 113 | - $evt_venue = !empty( $evt_venues ) ? array_shift( $evt_venues ) : NULL; |
|
| 114 | - $evt_venue_id = !empty( $evt_venue ) ? $evt_venue->ID() : NULL; |
|
| 112 | + $evt_venues = ! empty($evt_id) ? $evt_obj->venues() : array(); |
|
| 113 | + $evt_venue = ! empty($evt_venues) ? array_shift($evt_venues) : NULL; |
|
| 114 | + $evt_venue_id = ! empty($evt_venue) ? $evt_venue->ID() : NULL; |
|
| 115 | 115 | |
| 116 | 116 | //possibly private venues. |
| 117 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_venues', 'get_venues' ) ) { |
|
| 118 | - $vnu_where['status']= array( 'IN' , array( 'publish', 'private' ) ); |
|
| 117 | + if (EE_Registry::instance()->CAP->current_user_can('ee_read_private_venues', 'get_venues')) { |
|
| 118 | + $vnu_where['status'] = array('IN', array('publish', 'private')); |
|
| 119 | 119 | } else { |
| 120 | 120 | $vnu_where['status'] = 'publish'; |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | //cap checks |
| 124 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_venues', 'get_venues' ) ) { |
|
| 124 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_venues', 'get_venues')) { |
|
| 125 | 125 | $vnu_where['VNU_wp_user'] = get_current_user_id(); |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | - $vnumdl = EE_Registry::instance()->load_model( 'Venue' ); |
|
| 129 | - $venues = $vnumdl->get_all( array( $vnu_where ) ); |
|
| 128 | + $vnumdl = EE_Registry::instance()->load_model('Venue'); |
|
| 129 | + $venues = $vnumdl->get_all(array($vnu_where)); |
|
| 130 | 130 | |
| 131 | 131 | $ven_select = array(); |
| 132 | 132 | $ven_select[0] = __('Select a Venue', 'event_espresso'); |
| 133 | 133 | //setup venues for selector |
| 134 | - foreach ( $venues as $venue ) { |
|
| 134 | + foreach ($venues as $venue) { |
|
| 135 | 135 | $ven_select[$venue->ID()] = $venue->name(); |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | $template_args['venues'] = $venues; |
| 139 | 139 | $template_args['evt_venue_id'] = $evt_venue_id; |
| 140 | - $template_args['venue_selector'] = EEH_Form_Fields::select_input('venue_id', $ven_select, $evt_venue_id, 'id="venue_id"' ); |
|
| 141 | - $template_args['enable_for_gmap'] = EEH_Form_Fields::select_input('enable_for_gmap', $values, is_object( $evt_venue ) ? $evt_venue->enable_for_gmap() : NULL, 'id="enable_for_gmap"'); |
|
| 142 | - $template_path = empty( $venues ) ? EE_VENUES_TEMPLATE_PATH . 'event_venues_metabox_content.template.php' : EE_VENUES_TEMPLATE_PATH . 'event_venues_metabox_content_from_manager.template.php'; |
|
| 143 | - EEH_Template::display_template( $template_path, $template_args ); |
|
| 140 | + $template_args['venue_selector'] = EEH_Form_Fields::select_input('venue_id', $ven_select, $evt_venue_id, 'id="venue_id"'); |
|
| 141 | + $template_args['enable_for_gmap'] = EEH_Form_Fields::select_input('enable_for_gmap', $values, is_object($evt_venue) ? $evt_venue->enable_for_gmap() : NULL, 'id="enable_for_gmap"'); |
|
| 142 | + $template_path = empty($venues) ? EE_VENUES_TEMPLATE_PATH . 'event_venues_metabox_content.template.php' : EE_VENUES_TEMPLATE_PATH.'event_venues_metabox_content_from_manager.template.php'; |
|
| 143 | + EEH_Template::display_template($template_path, $template_args); |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | |
| 147 | 147 | |
| 148 | 148 | |
| 149 | - public function caf_venue_update( $evtobj, $data ) { |
|
| 149 | + public function caf_venue_update($evtobj, $data) { |
|
| 150 | 150 | EE_Registry::instance()->load_model('Venue'); |
| 151 | - $venue_id = !empty( $data['venue_id'] ) ? $data['venue_id'] : NULL; |
|
| 151 | + $venue_id = ! empty($data['venue_id']) ? $data['venue_id'] : NULL; |
|
| 152 | 152 | |
| 153 | 153 | |
| 154 | 154 | //first let's check if the selected venue matches any existing venue attached to the event |
| 155 | 155 | $evt_venue = $evtobj->venues(); |
| 156 | - $evt_venue = !empty( $evt_venue ) ? array_shift( $evt_venue ) : NULL; |
|
| 156 | + $evt_venue = ! empty($evt_venue) ? array_shift($evt_venue) : NULL; |
|
| 157 | 157 | |
| 158 | - if ( !empty( $evt_venue ) && $evt_venue->ID() != $venue_id ) |
|
| 159 | - $evtobj->_remove_relation_to( $evt_venue->ID(), 'Venue' ); |
|
| 158 | + if ( ! empty($evt_venue) && $evt_venue->ID() != $venue_id) |
|
| 159 | + $evtobj->_remove_relation_to($evt_venue->ID(), 'Venue'); |
|
| 160 | 160 | |
| 161 | - if ( empty( $venue_id ) ) |
|
| 161 | + if (empty($venue_id)) |
|
| 162 | 162 | return TRUE; //no venue to attach |
| 163 | 163 | |
| 164 | 164 | // this should take care of adding to revisions as well as main post object |
| 165 | - $success = $evtobj->_add_relation_to( $venue_id, 'Venue' ); |
|
| 166 | - return !empty($success) ? TRUE : FALSE; |
|
| 165 | + $success = $evtobj->_add_relation_to($venue_id, 'Venue'); |
|
| 166 | + return ! empty($success) ? TRUE : FALSE; |
|
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | |