@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
| 2 | -require_once ( EE_MODELS . 'EEM_Base.model.php' ); |
|
| 2 | +require_once (EE_MODELS.'EEM_Base.model.php'); |
|
| 3 | 3 | |
| 4 | 4 | /** |
| 5 | 5 | * |
@@ -20,17 +20,17 @@ discard block |
||
| 20 | 20 | /** |
| 21 | 21 | *__construct |
| 22 | 22 | */ |
| 23 | - protected function __construct( $timezone = NULL ) { |
|
| 24 | - $this->singular_item = __('Term','event_espresso'); |
|
| 25 | - $this->plural_item = __('Terms','event_espresso'); |
|
| 23 | + protected function __construct($timezone = NULL) { |
|
| 24 | + $this->singular_item = __('Term', 'event_espresso'); |
|
| 25 | + $this->plural_item = __('Terms', 'event_espresso'); |
|
| 26 | 26 | $this->_tables = array( |
| 27 | 27 | 'Term'=> new EE_Primary_Table('terms', 'term_id') |
| 28 | 28 | ); |
| 29 | 29 | $this->_fields = array( |
| 30 | 30 | 'Term'=>array( |
| 31 | - 'term_id'=> new EE_Primary_Key_Int_Field('term_id', __('Term ID','event_espresso')), |
|
| 32 | - 'name'=>new EE_Plain_Text_Field('name',__('Term Name','event_espresso'),false, ''), |
|
| 33 | - 'slug'=>new EE_Slug_Field('slug', __('Term Slug','event_espresso'), false), |
|
| 31 | + 'term_id'=> new EE_Primary_Key_Int_Field('term_id', __('Term ID', 'event_espresso')), |
|
| 32 | + 'name'=>new EE_Plain_Text_Field('name', __('Term Name', 'event_espresso'), false, ''), |
|
| 33 | + 'slug'=>new EE_Slug_Field('slug', __('Term Slug', 'event_espresso'), false), |
|
| 34 | 34 | 'term_group'=>new EE_Integer_Field('term_group', __("Term Group", "event_espresso"), false, 0) |
| 35 | 35 | )); |
| 36 | 36 | $this->_model_relations = array( |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | 'slug'=>new EE_Unique_Index(array('slug')) |
| 41 | 41 | ); |
| 42 | 42 | |
| 43 | - parent::__construct( $timezone ); |
|
| 43 | + parent::__construct($timezone); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | |
@@ -51,20 +51,20 @@ discard block |
||
| 51 | 51 | * |
| 52 | 52 | * @access public |
| 53 | 53 | */ |
| 54 | - public function get_all_ee_categories( $show_uncategorized = FALSE ) { |
|
| 54 | + public function get_all_ee_categories($show_uncategorized = FALSE) { |
|
| 55 | 55 | |
| 56 | 56 | $where_params = array( |
| 57 | 57 | 'Term_Taxonomy.taxonomy' => 'espresso_event_categories', |
| 58 | - 'NOT' => array( 'name' => __( 'Uncategorized', 'event_espresso' )) |
|
| 58 | + 'NOT' => array('name' => __('Uncategorized', 'event_espresso')) |
|
| 59 | 59 | ); |
| 60 | 60 | |
| 61 | - if ( $show_uncategorized ) { |
|
| 62 | - unset( $where_params['NOT'] ); |
|
| 61 | + if ($show_uncategorized) { |
|
| 62 | + unset($where_params['NOT']); |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - return EEM_Term::instance()->get_all( array( |
|
| 65 | + return EEM_Term::instance()->get_all(array( |
|
| 66 | 66 | $where_params, |
| 67 | - 'order_by' => array( 'name' => 'ASC' ) |
|
| 67 | + 'order_by' => array('name' => 'ASC') |
|
| 68 | 68 | )); |
| 69 | 69 | } |
| 70 | 70 | |
@@ -77,8 +77,8 @@ discard block |
||
| 77 | 77 | * @param string $post_type |
| 78 | 78 | * @return array |
| 79 | 79 | */ |
| 80 | - public function get_all_CPT_post_tags( $post_type = '' ) { |
|
| 81 | - switch( $post_type ) { |
|
| 80 | + public function get_all_CPT_post_tags($post_type = '') { |
|
| 81 | + switch ($post_type) { |
|
| 82 | 82 | case 'espresso_events' : |
| 83 | 83 | return $this->get_all_event_post_tags(); |
| 84 | 84 | break; |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | default : |
| 89 | 89 | $event_tags = $this->get_all_event_post_tags(); |
| 90 | 90 | $venue_tags = $this->get_all_venue_post_tags(); |
| 91 | - return array_merge( $event_tags, $venue_tags ); |
|
| 91 | + return array_merge($event_tags, $venue_tags); |
|
| 92 | 92 | } |
| 93 | 93 | return array(); |
| 94 | 94 | } |
@@ -101,19 +101,19 @@ discard block |
||
| 101 | 101 | * @return EE_Soft_Delete_Base_Class[] |
| 102 | 102 | */ |
| 103 | 103 | public function get_all_event_post_tags() { |
| 104 | - $post_tags = EEM_Term::instance()->get_all( array( |
|
| 104 | + $post_tags = EEM_Term::instance()->get_all(array( |
|
| 105 | 105 | array( |
| 106 | 106 | 'Term_Taxonomy.taxonomy' => 'post_tag', |
| 107 | 107 | 'Term_Taxonomy.Event.post_type' => 'espresso_events', |
| 108 | 108 | ), |
| 109 | - 'order_by' => array( 'name' => 'ASC' ), |
|
| 110 | - 'force_join' => array( 'Term_Taxonomy.Event' ) |
|
| 109 | + 'order_by' => array('name' => 'ASC'), |
|
| 110 | + 'force_join' => array('Term_Taxonomy.Event') |
|
| 111 | 111 | )); |
| 112 | - foreach ( $post_tags as $key => $post_tag ) { |
|
| 113 | - if ( ! isset( $post_tags[ $key ]->post_type )) { |
|
| 114 | - $post_tags[ $key ]->post_type = array(); |
|
| 112 | + foreach ($post_tags as $key => $post_tag) { |
|
| 113 | + if ( ! isset($post_tags[$key]->post_type)) { |
|
| 114 | + $post_tags[$key]->post_type = array(); |
|
| 115 | 115 | } |
| 116 | - $post_tags[ $key ]->post_type[] = 'espresso_events'; |
|
| 116 | + $post_tags[$key]->post_type[] = 'espresso_events'; |
|
| 117 | 117 | } |
| 118 | 118 | return $post_tags; |
| 119 | 119 | // return array( 'espresso_events' => $post_tags ); |
@@ -127,19 +127,19 @@ discard block |
||
| 127 | 127 | * @return EE_Soft_Delete_Base_Class[] |
| 128 | 128 | */ |
| 129 | 129 | public function get_all_venue_post_tags() { |
| 130 | - $post_tags = EEM_Term::instance()->get_all( array( |
|
| 130 | + $post_tags = EEM_Term::instance()->get_all(array( |
|
| 131 | 131 | array( |
| 132 | 132 | 'Term_Taxonomy.taxonomy' => 'post_tag', |
| 133 | 133 | 'Term_Taxonomy.Venue.post_type' => 'espresso_venues', |
| 134 | 134 | ), |
| 135 | - 'order_by' => array( 'name' => 'ASC' ), |
|
| 136 | - 'force_join' => array( 'Term_Taxonomy' ) |
|
| 135 | + 'order_by' => array('name' => 'ASC'), |
|
| 136 | + 'force_join' => array('Term_Taxonomy') |
|
| 137 | 137 | )); |
| 138 | - foreach ( $post_tags as $key => $post_tag ) { |
|
| 139 | - if ( ! isset( $post_tags[ $key ]->post_type )) { |
|
| 140 | - $post_tags[ $key ]->post_type = array(); |
|
| 138 | + foreach ($post_tags as $key => $post_tag) { |
|
| 139 | + if ( ! isset($post_tags[$key]->post_type)) { |
|
| 140 | + $post_tags[$key]->post_type = array(); |
|
| 141 | 141 | } |
| 142 | - $post_tags[ $key ]->post_type[] = 'espresso_venues'; |
|
| 142 | + $post_tags[$key]->post_type[] = 'espresso_venues'; |
|
| 143 | 143 | } |
| 144 | 144 | return $post_tags; |
| 145 | 145 | // return array( 'espresso_venues' => $post_tags ); |
@@ -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 | require_once ( EE_MODELS . 'EEM_Base.model.php' ); |
| 3 | 5 | |
| 4 | 6 | /** |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | * |
| 22 | 22 | * ------------------------------------------------------------------------ |
| 23 | 23 | */ |
| 24 | -require_once ( EE_MODELS . 'EEM_Base.model.php' ); |
|
| 24 | +require_once (EE_MODELS.'EEM_Base.model.php'); |
|
| 25 | 25 | |
| 26 | 26 | class EEM_Term_Taxonomy extends EEM_Base { |
| 27 | 27 | |
@@ -29,19 +29,19 @@ discard block |
||
| 29 | 29 | protected static $_instance = NULL; |
| 30 | 30 | |
| 31 | 31 | |
| 32 | - protected function __construct( $timezone = NULL ) { |
|
| 33 | - $this->singular_item = __('Term Taxonomy','event_espresso'); |
|
| 34 | - $this->plural_item = __('Term Taxonomy','event_espresso'); |
|
| 32 | + protected function __construct($timezone = NULL) { |
|
| 33 | + $this->singular_item = __('Term Taxonomy', 'event_espresso'); |
|
| 34 | + $this->plural_item = __('Term Taxonomy', 'event_espresso'); |
|
| 35 | 35 | $this->_tables = array( |
| 36 | 36 | 'Term_Taxonomy'=> new EE_Primary_Table('term_taxonomy', 'term_taxonomy_id') |
| 37 | 37 | ); |
| 38 | 38 | $this->_fields = array( |
| 39 | 39 | 'Term_Taxonomy'=>array( |
| 40 | - 'term_taxonomy_id'=> new EE_Primary_Key_Int_Field('term_taxonomy_id', __('Term-Taxonomy ID','event_espresso')), |
|
| 41 | - 'term_id'=>new EE_Foreign_Key_Int_Field('term_id', __("Term Id", "event_espresso"), false, 0, 'Term'), //EE_Foreign_Key_Int_Field('term_taxonomy_id', __('Term (in context of a taxonomy) ID','event_espresso'), false, 0, 'Term_Taxonomy'), |
|
| 42 | - 'taxonomy'=>new EE_Plain_Text_Field('taxonomy', __('Taxonomy Name','event_espresso'), false, 'category'), |
|
| 43 | - 'description'=>new EE_Simple_HTML_Field('description', __("Description of Term", "event_espresso"), false,''), |
|
| 44 | - 'parent'=>new EE_Integer_Field('parent', __("Parent Term ID", "event_espresso"), false,0), |
|
| 40 | + 'term_taxonomy_id'=> new EE_Primary_Key_Int_Field('term_taxonomy_id', __('Term-Taxonomy ID', 'event_espresso')), |
|
| 41 | + 'term_id'=>new EE_Foreign_Key_Int_Field('term_id', __("Term Id", "event_espresso"), false, 0, 'Term'), //EE_Foreign_Key_Int_Field('term_taxonomy_id', __('Term (in context of a taxonomy) ID','event_espresso'), false, 0, 'Term_Taxonomy'), |
|
| 42 | + 'taxonomy'=>new EE_Plain_Text_Field('taxonomy', __('Taxonomy Name', 'event_espresso'), false, 'category'), |
|
| 43 | + 'description'=>new EE_Simple_HTML_Field('description', __("Description of Term", "event_espresso"), false, ''), |
|
| 44 | + 'parent'=>new EE_Integer_Field('parent', __("Parent Term ID", "event_espresso"), false, 0), |
|
| 45 | 45 | 'term_count'=> new EE_Integer_Field('count', __("Count of Objects attached", 'event_espresso'), false, 0) |
| 46 | 46 | )); |
| 47 | 47 | $this->_model_relations = array( |
@@ -52,10 +52,10 @@ discard block |
||
| 52 | 52 | 'Attendee'=>new EE_HABTM_Relation('Term_Relationship') |
| 53 | 53 | ); |
| 54 | 54 | $this->_indexes = array( |
| 55 | - 'term_id_taxonomy'=>new EE_Unique_Index(array('term_id','taxonomy')) |
|
| 55 | + 'term_id_taxonomy'=>new EE_Unique_Index(array('term_id', 'taxonomy')) |
|
| 56 | 56 | ); |
| 57 | 57 | |
| 58 | - parent::__construct( $timezone ); |
|
| 58 | + parent::__construct($timezone); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | |
@@ -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 | * |
@@ -22,8 +22,8 @@ discard block |
||
| 22 | 22 | * ------------------------------------------------------------------------ |
| 23 | 23 | */ |
| 24 | 24 | |
| 25 | -require_once ( EE_CLASSES . 'EE_Ticket_Price.class.php' ); |
|
| 26 | -require_once ( EE_MODELS . 'EEM_Base.model.php' ); |
|
| 25 | +require_once (EE_CLASSES.'EE_Ticket_Price.class.php'); |
|
| 26 | +require_once (EE_MODELS.'EEM_Base.model.php'); |
|
| 27 | 27 | |
| 28 | 28 | class EEM_Ticket_Price extends EEM_Base { |
| 29 | 29 | |
@@ -37,12 +37,12 @@ discard block |
||
| 37 | 37 | * @param string $timezone string representing the timezone we want to set for returned Date Time Strings (and any incoming timezone data that gets saved). Note this just sends the timezone info to the date time model field objects. Default is NULL (and will be assumed using the set timezone in the 'timezone_string' wp option) |
| 38 | 38 | * @return void |
| 39 | 39 | */ |
| 40 | - protected function __construct( $timezone ) { |
|
| 41 | - $this->singular_item = __('Ticket Price','event_espresso'); |
|
| 42 | - $this->plural_item = __('Ticket Prices','event_espresso'); |
|
| 40 | + protected function __construct($timezone) { |
|
| 41 | + $this->singular_item = __('Ticket Price', 'event_espresso'); |
|
| 42 | + $this->plural_item = __('Ticket Prices', 'event_espresso'); |
|
| 43 | 43 | |
| 44 | 44 | $this->_tables = array( |
| 45 | - 'Ticket_Price'=>new EE_Primary_Table('esp_ticket_price','TKP_ID') |
|
| 45 | + 'Ticket_Price'=>new EE_Primary_Table('esp_ticket_price', 'TKP_ID') |
|
| 46 | 46 | ); |
| 47 | 47 | $this->_fields = array( |
| 48 | 48 | 'Ticket_Price'=> array( |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | 'Ticket'=>new EE_Belongs_To_Relation(), |
| 56 | 56 | 'Price'=>new EE_Belongs_To_Relation() |
| 57 | 57 | ); |
| 58 | - parent::__construct( $timezone ); |
|
| 58 | + parent::__construct($timezone); |
|
| 59 | 59 | |
| 60 | 60 | } |
| 61 | 61 | |
@@ -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 | * |
@@ -21,8 +21,8 @@ discard block |
||
| 21 | 21 | * |
| 22 | 22 | * ------------------------------------------------------------------------ |
| 23 | 23 | */ |
| 24 | -require_once ( EE_MODELS . 'EEM_Base.model.php' ); |
|
| 25 | -require_once ( EE_CLASSES . 'EE_Ticket_Template.class.php' ); |
|
| 24 | +require_once (EE_MODELS.'EEM_Base.model.php'); |
|
| 25 | +require_once (EE_CLASSES.'EE_Ticket_Template.class.php'); |
|
| 26 | 26 | |
| 27 | 27 | class EEM_Ticket_Template extends EEM_Base { |
| 28 | 28 | |
@@ -38,25 +38,25 @@ discard block |
||
| 38 | 38 | * @param string $timezone string representing the timezone we want to set for returned Date Time Strings (and any incoming timezone data that gets saved). Note this just sends the timezone info to the date time model field objects. Default is NULL (and will be assumed using the set timezone in the 'timezone_string' wp option) |
| 39 | 39 | * @return void |
| 40 | 40 | */ |
| 41 | - protected function __construct( $timezone ) { |
|
| 42 | - $this->singular_item = __('Ticket Template','event_espresso'); |
|
| 43 | - $this->plural_item = __('Ticket Templates','event_espresso'); |
|
| 41 | + protected function __construct($timezone) { |
|
| 42 | + $this->singular_item = __('Ticket Template', 'event_espresso'); |
|
| 43 | + $this->plural_item = __('Ticket Templates', 'event_espresso'); |
|
| 44 | 44 | |
| 45 | 45 | $this->_tables = array( |
| 46 | 46 | 'Ticket_Template'=> new EE_Primary_Table('esp_ticket_template', 'TTM_ID') |
| 47 | 47 | ); |
| 48 | 48 | $this->_fields = array( |
| 49 | 49 | 'Ticket_Template'=>array( |
| 50 | - 'TTM_ID'=>new EE_Primary_Key_Int_Field('TTM_ID', __('Ticket Template ID','event_espresso')), |
|
| 51 | - 'TTM_name'=>new EE_Plain_Text_Field('TTM_name', __('The name of the ticket template','event_espresso'), false, '' ), |
|
| 52 | - 'TTM_description'=>new EE_Plain_Text_Field('TTM_description', __('The description for the ticket template','event_espresso'), true, '' ), |
|
| 53 | - 'TTM_file'=>new EE_Plain_Text_Field('TTM_file', __('The file name for the actual template file saved on disk','event_espresso'), true, '' ), |
|
| 50 | + 'TTM_ID'=>new EE_Primary_Key_Int_Field('TTM_ID', __('Ticket Template ID', 'event_espresso')), |
|
| 51 | + 'TTM_name'=>new EE_Plain_Text_Field('TTM_name', __('The name of the ticket template', 'event_espresso'), false, ''), |
|
| 52 | + 'TTM_description'=>new EE_Plain_Text_Field('TTM_description', __('The description for the ticket template', 'event_espresso'), true, ''), |
|
| 53 | + 'TTM_file'=>new EE_Plain_Text_Field('TTM_file', __('The file name for the actual template file saved on disk', 'event_espresso'), true, ''), |
|
| 54 | 54 | )); |
| 55 | 55 | $this->_model_relations = array( |
| 56 | 56 | 'Ticket'=>new EE_Has_Many_Relation() |
| 57 | 57 | ); |
| 58 | 58 | $this->_model_chain_to_wp_user = 'Ticket'; |
| 59 | 59 | |
| 60 | - parent::__construct( $timezone ); |
|
| 60 | + parent::__construct($timezone); |
|
| 61 | 61 | } |
| 62 | 62 | } //end EEM_Ticket_Template class |
| 63 | 63 | \ No newline at end of file |
@@ -1,4 +1,6 @@ |
||
| 1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
| 1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
| 2 | + exit('No direct script access allowed'); |
|
| 3 | +} |
|
| 2 | 4 | /** |
| 3 | 5 | * Event Espresso |
| 4 | 6 | * |
@@ -21,16 +21,16 @@ discard block |
||
| 21 | 21 | * |
| 22 | 22 | * ------------------------------------------------------------------------ |
| 23 | 23 | */ |
| 24 | -require_once ( EE_MODELS . 'EEM_Base.model.php' ); |
|
| 24 | +require_once (EE_MODELS.'EEM_Base.model.php'); |
|
| 25 | 25 | |
| 26 | 26 | class EEM_Venue extends EEM_CPT_Base { |
| 27 | 27 | |
| 28 | 28 | // private instance of the Attendee object |
| 29 | 29 | protected static $_instance = NULL; |
| 30 | 30 | |
| 31 | - protected function __construct( $timezone = NULL ) { |
|
| 32 | - $this->singular_item = __('Venue','event_espresso'); |
|
| 33 | - $this->plural_item = __('Venues','event_espresso'); |
|
| 31 | + protected function __construct($timezone = NULL) { |
|
| 32 | + $this->singular_item = __('Venue', 'event_espresso'); |
|
| 33 | + $this->plural_item = __('Venues', 'event_espresso'); |
|
| 34 | 34 | $this->_tables = array( |
| 35 | 35 | 'Venue_CPT'=> new EE_Primary_Table('posts', 'ID'), |
| 36 | 36 | 'Venue_Meta'=>new EE_Secondary_Table('esp_venue_meta', 'VNUM_ID', 'VNU_ID') |
@@ -39,32 +39,32 @@ discard block |
||
| 39 | 39 | 'Venue_CPT'=>array( |
| 40 | 40 | 'VNU_ID'=>new EE_Primary_Key_Int_Field('ID', __("Venue ID", "event_espresso")), |
| 41 | 41 | 'VNU_name'=>new EE_Plain_Text_Field('post_title', __("Venue Name", "event_espresso"), false, ''), |
| 42 | - 'VNU_desc'=>new EE_Post_Content_Field('post_content', __("Venue Description", "event_espresso"), false,''), |
|
| 43 | - 'VNU_identifier'=>new EE_Slug_Field('post_name', __("Venue Identifier", "event_espresso"), false,''), |
|
| 44 | - 'VNU_created'=>new EE_Datetime_Field('post_date', __("Date Venue Created", "event_espresso"), FALSE,current_time('timestamp')), |
|
| 45 | - 'VNU_short_desc'=>new EE_Plain_Text_Field('post_excerpt', __("Short Description of Venue", "event_espresso"), true,''), |
|
| 46 | - 'VNU_modified'=>new EE_Datetime_Field('post_modified', __("Venue Modified Date", "event_espresso"), FALSE,current_time('timestamp')), |
|
| 47 | - 'VNU_wp_user'=>new EE_WP_User_Field('post_author', __("Venue Creator ID", "event_espresso"), false ), |
|
| 48 | - 'parent'=>new EE_Integer_Field('post_parent', __("Venue Parent ID", "event_espresso"), false,0), |
|
| 42 | + 'VNU_desc'=>new EE_Post_Content_Field('post_content', __("Venue Description", "event_espresso"), false, ''), |
|
| 43 | + 'VNU_identifier'=>new EE_Slug_Field('post_name', __("Venue Identifier", "event_espresso"), false, ''), |
|
| 44 | + 'VNU_created'=>new EE_Datetime_Field('post_date', __("Date Venue Created", "event_espresso"), FALSE, current_time('timestamp')), |
|
| 45 | + 'VNU_short_desc'=>new EE_Plain_Text_Field('post_excerpt', __("Short Description of Venue", "event_espresso"), true, ''), |
|
| 46 | + 'VNU_modified'=>new EE_Datetime_Field('post_modified', __("Venue Modified Date", "event_espresso"), FALSE, current_time('timestamp')), |
|
| 47 | + 'VNU_wp_user'=>new EE_WP_User_Field('post_author', __("Venue Creator ID", "event_espresso"), false), |
|
| 48 | + 'parent'=>new EE_Integer_Field('post_parent', __("Venue Parent ID", "event_espresso"), false, 0), |
|
| 49 | 49 | 'VNU_order'=>new EE_Integer_Field('menu_order', __("Venue order", "event_espresso"), false, 1), |
| 50 | - 'post_type'=>new EE_WP_Post_Type_Field('espresso_venues'),// EE_Plain_Text_Field('post_type', __("Venue post type", "event_espresso"), false, 'espresso_venues'), |
|
| 50 | + 'post_type'=>new EE_WP_Post_Type_Field('espresso_venues'), // EE_Plain_Text_Field('post_type', __("Venue post type", "event_espresso"), false, 'espresso_venues'), |
|
| 51 | 51 | ), |
| 52 | 52 | 'Venue_Meta'=>array( |
| 53 | 53 | 'VNUM_ID'=>new EE_DB_Only_Int_Field('VNUM_ID', __("ID of Venue Meta Row", "event_espresso"), false), |
| 54 | 54 | 'VNU_ID_fk'=>new EE_DB_Only_Int_Field('VNU_ID', __("Foreign Key to Venue Post ", "event_espresso"), false), |
| 55 | 55 | 'VNU_address'=>new EE_Plain_Text_Field('VNU_address', __("Venue Address line 1", "event_espresso"), true, ''), |
| 56 | - 'VNU_address2'=>new EE_Plain_Text_Field('VNU_address2', __("Venue Address line 2", "event_espresso"), true,''), |
|
| 56 | + 'VNU_address2'=>new EE_Plain_Text_Field('VNU_address2', __("Venue Address line 2", "event_espresso"), true, ''), |
|
| 57 | 57 | 'VNU_city'=>new EE_Plain_Text_Field('VNU_city', __("Venue City", "event_espresso"), true, ''), |
| 58 | 58 | 'STA_ID'=>new EE_Foreign_Key_Int_Field('STA_ID', __("State ID", "event_espresso"), true, null, 'State'), |
| 59 | 59 | 'CNT_ISO'=>new EE_Foreign_Key_String_Field('CNT_ISO', __("Country Code", "event_espresso"), true, null, 'Country'), |
| 60 | 60 | 'VNU_zip'=>new EE_Plain_Text_Field('VNU_zip', __("Venue Zip/Postal Code", "event_espresso"), true), |
| 61 | 61 | 'VNU_phone'=>new EE_Plain_Text_Field('VNU_phone', __("Venue Phone", "event_espresso"), true), |
| 62 | - 'VNU_capacity'=>new EE_Infinite_Integer_Field('VNU_capacity', __("Venue Capacity", "event_espresso"), true,INF), |
|
| 62 | + 'VNU_capacity'=>new EE_Infinite_Integer_Field('VNU_capacity', __("Venue Capacity", "event_espresso"), true, INF), |
|
| 63 | 63 | 'VNU_url'=>new EE_Plain_Text_Field('VNU_url', __('Venue Website', 'event_espresso'), true), |
| 64 | 64 | 'VNU_virtual_phone'=>new EE_Plain_Text_Field('VNU_virtual_phone', __('Call in Number', 'event_espresso'), true), |
| 65 | - 'VNU_virtual_url'=>new EE_Plain_Text_Field('VNU_virtual_url', __('Virtual URL', 'event_espresso'), true ), |
|
| 66 | - 'VNU_google_map_link'=>new EE_Plain_Text_Field('VNU_google_map_link', __('Google Map Link', 'event_espresso'), true ), |
|
| 67 | - 'VNU_enable_for_gmap'=>new EE_Boolean_Field('VNU_enable_for_gmap', __('Show Google Map?', 'event_espresso'), false, false ) |
|
| 65 | + 'VNU_virtual_url'=>new EE_Plain_Text_Field('VNU_virtual_url', __('Virtual URL', 'event_espresso'), true), |
|
| 66 | + 'VNU_google_map_link'=>new EE_Plain_Text_Field('VNU_google_map_link', __('Google Map Link', 'event_espresso'), true), |
|
| 67 | + 'VNU_enable_for_gmap'=>new EE_Boolean_Field('VNU_enable_for_gmap', __('Show Google Map?', 'event_espresso'), false, false) |
|
| 68 | 68 | |
| 69 | 69 | )); |
| 70 | 70 | $this->_model_relations = array( |
@@ -74,10 +74,10 @@ discard block |
||
| 74 | 74 | 'Event_Venue'=>new EE_Has_Many_Relation(), |
| 75 | 75 | 'WP_User' => new EE_Belongs_To_Relation() |
| 76 | 76 | ); |
| 77 | - require_once( EE_CLASSES . 'EE_Venue.class.php'); |
|
| 78 | - require_once( EE_MODELS . 'strategies/EE_CPT_Where_Conditions.strategy.php'); |
|
| 77 | + require_once(EE_CLASSES.'EE_Venue.class.php'); |
|
| 78 | + require_once(EE_MODELS.'strategies/EE_CPT_Where_Conditions.strategy.php'); |
|
| 79 | 79 | $this->_default_where_conditions_strategy = new EE_CPT_Where_Conditions('espresso_venues', 'VNUM_ID'); |
| 80 | - parent::__construct( $timezone ); |
|
| 80 | + parent::__construct($timezone); |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | } |
@@ -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 | * |
@@ -3,11 +3,11 @@ discard block |
||
| 3 | 3 | /* |
| 4 | 4 | * Strategy specifically for adding where conditions specific to CPT models. |
| 5 | 5 | */ |
| 6 | -class EE_CPT_Where_Conditions extends EE_Default_Where_Conditions{ |
|
| 6 | +class EE_CPT_Where_Conditions extends EE_Default_Where_Conditions { |
|
| 7 | 7 | |
| 8 | 8 | protected $_post_type; |
| 9 | 9 | protected $_meta_field; |
| 10 | - function __construct($post_type, $meta_field_to_chk){ |
|
| 10 | + function __construct($post_type, $meta_field_to_chk) { |
|
| 11 | 11 | $this->_post_type = $post_type; |
| 12 | 12 | $this->_meta_field = $meta_field_to_chk; |
| 13 | 13 | } |
@@ -17,10 +17,10 @@ discard block |
||
| 17 | 17 | * @param string $column column name |
| 18 | 18 | * @return EE_Model_Field_Base |
| 19 | 19 | */ |
| 20 | - protected function _get_field_on_column($column){ |
|
| 20 | + protected function _get_field_on_column($column) { |
|
| 21 | 21 | $all_fields = $this->_model->field_settings(true); |
| 22 | - foreach($all_fields as $field_name => $field_obj){ |
|
| 23 | - if($column == $field_obj->get_table_column()){ |
|
| 22 | + foreach ($all_fields as $field_name => $field_obj) { |
|
| 23 | + if ($column == $field_obj->get_table_column()) { |
|
| 24 | 24 | return $field_obj; |
| 25 | 25 | } |
| 26 | 26 | } |
@@ -30,10 +30,10 @@ discard block |
||
| 30 | 30 | * @param string $model_relation_path. Eg, from Event to Payment, this should be "Registration.Transaction.Payment" |
| 31 | 31 | * @return array like EEM_Base::get_all's $query_params's index [0] (where conditions) |
| 32 | 32 | */ |
| 33 | - function get_default_where_conditions($model_relation_chain = null){ |
|
| 33 | + function get_default_where_conditions($model_relation_chain = null) { |
|
| 34 | 34 | //make sure there's a period at the end of $model_relation_chain |
| 35 | - if($model_relation_chain != '' && $model_relation_chain[strlen($model_relation_chain)-1] !='.'){ |
|
| 36 | - $model_relation_chain=$model_relation_chain."."; |
|
| 35 | + if ($model_relation_chain != '' && $model_relation_chain[strlen($model_relation_chain) - 1] != '.') { |
|
| 36 | + $model_relation_chain = $model_relation_chain."."; |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | //find post_type field |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | // return $default_where_conditions; |
| 61 | 61 | return array( |
| 62 | 62 | $post_type_field_name => $this->_post_type, |
| 63 | - $status_field_name => array('NOT IN',array('auto-draft','trash')) |
|
| 63 | + $status_field_name => array('NOT IN', array('auto-draft', 'trash')) |
|
| 64 | 64 | ); |
| 65 | 65 | } |
| 66 | 66 | } |
@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | * Strategy to be used for getting default where conditions for EEM_Base children. |
| 5 | 5 | * Should be initialized and set on construction of model |
| 6 | 6 | */ |
| 7 | -class EE_Default_Where_Conditions{ |
|
| 7 | +class EE_Default_Where_Conditions { |
|
| 8 | 8 | /** |
| 9 | 9 | * Model fo rwhich this strategy find default where conditions |
| 10 | 10 | * @var EEM_Base |
@@ -15,10 +15,10 @@ discard block |
||
| 15 | 15 | * for querying of the model. |
| 16 | 16 | * @param EEM_Base $model |
| 17 | 17 | */ |
| 18 | - function _finalize_construct(EEM_Base $model){ |
|
| 18 | + function _finalize_construct(EEM_Base $model) { |
|
| 19 | 19 | $this->_model = $model; |
| 20 | 20 | } |
| 21 | - function get_default_where_conditions(){ |
|
| 21 | + function get_default_where_conditions() { |
|
| 22 | 22 | return array(); |
| 23 | 23 | } |
| 24 | 24 | } |
@@ -1,4 +1,4 @@ discard block |
||
| 1 | -<?php if (!defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
|
| 1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } |
|
| 2 | 2 | /** |
| 3 | 3 | * |
| 4 | 4 | * EEH_Line_Item |
@@ -34,20 +34,20 @@ discard block |
||
| 34 | 34 | * @param boolean $code if set to a value, ensures there is only one line item with that code |
| 35 | 35 | * @return boolean success |
| 36 | 36 | */ |
| 37 | - public static function add_unrelated_item( EE_Line_Item $total_line_item, $name, $unit_price, $description = '', $quantity = 1, $taxable = FALSE, $code = NULL ){ |
|
| 38 | - $items_subtotal = self::get_items_subtotal( $total_line_item ); |
|
| 37 | + public static function add_unrelated_item(EE_Line_Item $total_line_item, $name, $unit_price, $description = '', $quantity = 1, $taxable = FALSE, $code = NULL) { |
|
| 38 | + $items_subtotal = self::get_items_subtotal($total_line_item); |
|
| 39 | 39 | $line_item = EE_Line_Item::new_instance(array( |
| 40 | 40 | 'LIN_name' => $name, |
| 41 | 41 | 'LIN_desc' => $description, |
| 42 | 42 | 'LIN_unit_price' => $unit_price, |
| 43 | 43 | 'LIN_quantity' => $quantity, |
| 44 | 44 | 'LIN_is_taxable' => $taxable, |
| 45 | - 'LIN_order' => $items_subtotal instanceof EE_Line_Item ? count( $items_subtotal->children() ) : 0, |
|
| 46 | - 'LIN_total' => floatval( $unit_price ) * intval( $quantity ), |
|
| 45 | + 'LIN_order' => $items_subtotal instanceof EE_Line_Item ? count($items_subtotal->children()) : 0, |
|
| 46 | + 'LIN_total' => floatval($unit_price) * intval($quantity), |
|
| 47 | 47 | 'LIN_type'=> EEM_Line_Item::type_line_item, |
| 48 | 48 | 'LIN_code' => $code, |
| 49 | 49 | )); |
| 50 | - return self::add_item($total_line_item, $line_item ); |
|
| 50 | + return self::add_item($total_line_item, $line_item); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | |
@@ -59,16 +59,16 @@ discard block |
||
| 59 | 59 | * @param int $qty |
| 60 | 60 | * @return EE_Line_Item |
| 61 | 61 | */ |
| 62 | - public static function add_ticket_purchase(EE_Line_Item $total_line_item, EE_Ticket $ticket, $qty = 1 ){ |
|
| 62 | + public static function add_ticket_purchase(EE_Line_Item $total_line_item, EE_Ticket $ticket, $qty = 1) { |
|
| 63 | 63 | $datetimes = $ticket->datetimes(); |
| 64 | 64 | $event_names = array(); |
| 65 | - foreach($datetimes as $datetime){ |
|
| 65 | + foreach ($datetimes as $datetime) { |
|
| 66 | 66 | $event = $datetime->event(); |
| 67 | 67 | $event_names[$event->ID()] = $event->name(); |
| 68 | 68 | } |
| 69 | - $description_addition = " (For ".implode(", ",$event_names).")"; |
|
| 69 | + $description_addition = " (For ".implode(", ", $event_names).")"; |
|
| 70 | 70 | $full_description = $ticket->description().$description_addition; |
| 71 | - $items_subtotal = self::get_items_subtotal( $total_line_item ); |
|
| 71 | + $items_subtotal = self::get_items_subtotal($total_line_item); |
|
| 72 | 72 | // add $ticket to cart |
| 73 | 73 | $line_item = EE_Line_Item::new_instance(array( |
| 74 | 74 | 'LIN_name'=>$ticket->name(), |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | 'LIN_unit_price'=>$ticket->price(), |
| 77 | 77 | 'LIN_quantity'=>$qty, |
| 78 | 78 | 'LIN_is_taxable'=>$ticket->taxable(), |
| 79 | - 'LIN_order'=> $items_subtotal instanceof EE_Line_Item ? count( $items_subtotal->children() ) : 0, |
|
| 79 | + 'LIN_order'=> $items_subtotal instanceof EE_Line_Item ? count($items_subtotal->children()) : 0, |
|
| 80 | 80 | 'LIN_total'=>$ticket->price() * $qty, |
| 81 | 81 | 'LIN_type'=> EEM_Line_Item::type_line_item, |
| 82 | 82 | 'OBJ_ID'=>$ticket->ID(), |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | )); |
| 85 | 85 | //now add the sub-line items |
| 86 | 86 | $running_total_for_ticket = 0; |
| 87 | - foreach($ticket->prices(array('order_by'=>array('PRC_order'=>'ASC'))) as $price){ |
|
| 87 | + foreach ($ticket->prices(array('order_by'=>array('PRC_order'=>'ASC'))) as $price) { |
|
| 88 | 88 | $sign = $price->is_discount() ? -1 : 1; |
| 89 | 89 | $price_total = $price->is_percent() ? $running_total_for_ticket * $price->amount() / 100 : $price->amount() * $qty; |
| 90 | 90 | |
@@ -99,16 +99,16 @@ discard block |
||
| 99 | 99 | 'OBJ_ID'=>$price->ID(), |
| 100 | 100 | 'OBJ_type'=>'Price' |
| 101 | 101 | )); |
| 102 | - if($price->is_percent()){ |
|
| 102 | + if ($price->is_percent()) { |
|
| 103 | 103 | $sub_line_item->set_percent($sign * $price->amount()); |
| 104 | - }else{ |
|
| 104 | + } else { |
|
| 105 | 105 | $sub_line_item->set_unit_price($sign * $price->amount()); |
| 106 | 106 | } |
| 107 | 107 | $running_total_for_ticket += $price_total; |
| 108 | 108 | $line_item->add_child_line_item($sub_line_item); |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | - self::add_item( $total_line_item, $line_item ); |
|
| 111 | + self::add_item($total_line_item, $line_item); |
|
| 112 | 112 | return $line_item; |
| 113 | 113 | } |
| 114 | 114 | |
@@ -120,12 +120,12 @@ discard block |
||
| 120 | 120 | * @param EE_Line_Item $item to be added |
| 121 | 121 | * @return boolean |
| 122 | 122 | */ |
| 123 | - public static function add_item(EE_Line_Item $total_line_item, EE_Line_Item $item ){ |
|
| 123 | + public static function add_item(EE_Line_Item $total_line_item, EE_Line_Item $item) { |
|
| 124 | 124 | // add item to cart |
| 125 | - $ticket_items = self::get_items_subtotal( $total_line_item ); |
|
| 126 | - if($ticket_items){ |
|
| 125 | + $ticket_items = self::get_items_subtotal($total_line_item); |
|
| 126 | + if ($ticket_items) { |
|
| 127 | 127 | $success = $ticket_items->add_child_line_item($item); |
| 128 | - }else{ |
|
| 128 | + } else { |
|
| 129 | 129 | return FALSE; |
| 130 | 130 | } |
| 131 | 131 | // recalculate cart totals based on new items |
@@ -141,9 +141,9 @@ discard block |
||
| 141 | 141 | * @param EE_Line_Item $total_line_item of type EEM_Line_Item::type_total |
| 142 | 142 | * @return \EE_Line_Item |
| 143 | 143 | */ |
| 144 | - public static function get_items_subtotal( EE_Line_Item $total_line_item ){ |
|
| 144 | + public static function get_items_subtotal(EE_Line_Item $total_line_item) { |
|
| 145 | 145 | $tickets = $total_line_item->get_child_line_item('tickets'); |
| 146 | - return $tickets ? $tickets : self::create_default_items_subtotal( $total_line_item ); |
|
| 146 | + return $tickets ? $tickets : self::create_default_items_subtotal($total_line_item); |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | |
@@ -153,9 +153,9 @@ discard block |
||
| 153 | 153 | * @param EE_Line_Item $total_line_item of type EEM_Line_Item::type_total |
| 154 | 154 | * @return \EE_Line_Item |
| 155 | 155 | */ |
| 156 | - public static function get_taxes_subtotal( EE_Line_Item $total_line_item ){ |
|
| 156 | + public static function get_taxes_subtotal(EE_Line_Item $total_line_item) { |
|
| 157 | 157 | $taxes = $total_line_item->get_child_line_item('taxes'); |
| 158 | - return $taxes ? $taxes : self::create_default_taxes_subtotal( $total_line_item ); |
|
| 158 | + return $taxes ? $taxes : self::create_default_taxes_subtotal($total_line_item); |
|
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | |
@@ -167,19 +167,19 @@ discard block |
||
| 167 | 167 | * @param EE_Transaction $transaction |
| 168 | 168 | * @return \EE_Line_Item of type total |
| 169 | 169 | */ |
| 170 | - public static function create_default_total_line_item( $transaction = NULL){ |
|
| 170 | + public static function create_default_total_line_item($transaction = NULL) { |
|
| 171 | 171 | $line_item = EE_Line_Item::new_instance(array( |
| 172 | 172 | 'LIN_code'=>'total', |
| 173 | 173 | 'LIN_name'=> __('Grand Total', 'event_espresso'), |
| 174 | 174 | 'LIN_type'=> EEM_Line_Item::type_total, |
| 175 | 175 | 'OBJ_type'=>'Transaction' |
| 176 | 176 | )); |
| 177 | - if( $transaction ){ |
|
| 178 | - $transaction = EEM_Transaction::instance()->ensure_is_ID( $transaction ); |
|
| 179 | - $line_item->set_TXN_ID( $transaction ); |
|
| 177 | + if ($transaction) { |
|
| 178 | + $transaction = EEM_Transaction::instance()->ensure_is_ID($transaction); |
|
| 179 | + $line_item->set_TXN_ID($transaction); |
|
| 180 | 180 | } |
| 181 | - self::create_default_items_subtotal( $line_item, $transaction ); |
|
| 182 | - self::create_default_taxes_subtotal( $line_item, $transaction ); |
|
| 181 | + self::create_default_items_subtotal($line_item, $transaction); |
|
| 182 | + self::create_default_taxes_subtotal($line_item, $transaction); |
|
| 183 | 183 | return $line_item; |
| 184 | 184 | } |
| 185 | 185 | |
@@ -191,15 +191,15 @@ discard block |
||
| 191 | 191 | * @param EE_Transaction $transaction |
| 192 | 192 | * @return EE_Line_Item |
| 193 | 193 | */ |
| 194 | - protected static function create_default_items_subtotal(EE_Line_Item $total_line_item, $transaction = NULL ){ |
|
| 194 | + protected static function create_default_items_subtotal(EE_Line_Item $total_line_item, $transaction = NULL) { |
|
| 195 | 195 | $items_line_item = EE_Line_Item::new_instance(array( |
| 196 | 196 | 'LIN_code'=>'tickets', |
| 197 | 197 | 'LIN_name'=> __('Tickets', 'event_espresso'), |
| 198 | 198 | 'LIN_type'=> EEM_Line_Item::type_sub_total |
| 199 | 199 | )); |
| 200 | - if( $transaction ){ |
|
| 201 | - $transaction = EEM_Transaction::instance()->ensure_is_ID( $transaction ); |
|
| 202 | - $total_line_item->set_TXN_ID( $transaction ); |
|
| 200 | + if ($transaction) { |
|
| 201 | + $transaction = EEM_Transaction::instance()->ensure_is_ID($transaction); |
|
| 202 | + $total_line_item->set_TXN_ID($transaction); |
|
| 203 | 203 | } |
| 204 | 204 | $total_line_item->add_child_line_item($items_line_item); |
| 205 | 205 | return $items_line_item; |
@@ -214,19 +214,19 @@ discard block |
||
| 214 | 214 | * @param EE_Transaction $transaction |
| 215 | 215 | * @return EE_Line_Item |
| 216 | 216 | */ |
| 217 | - protected static function create_default_taxes_subtotal( EE_Line_Item $total_line_item, $transaction = NULL ){ |
|
| 217 | + protected static function create_default_taxes_subtotal(EE_Line_Item $total_line_item, $transaction = NULL) { |
|
| 218 | 218 | $tax_line_item = EE_Line_Item::new_instance(array( |
| 219 | 219 | 'LIN_code'=>'taxes', |
| 220 | 220 | 'LIN_name'=> __('Taxes', 'event_espresso'), |
| 221 | 221 | 'LIN_type'=> EEM_Line_Item::type_tax_sub_total |
| 222 | 222 | )); |
| 223 | - if( $transaction ){ |
|
| 224 | - $transaction = EEM_Transaction::instance()->ensure_is_ID( $transaction ); |
|
| 225 | - $total_line_item->set_TXN_ID( $transaction ); |
|
| 223 | + if ($transaction) { |
|
| 224 | + $transaction = EEM_Transaction::instance()->ensure_is_ID($transaction); |
|
| 225 | + $total_line_item->set_TXN_ID($transaction); |
|
| 226 | 226 | } |
| 227 | 227 | $total_line_item->add_child_line_item($tax_line_item); |
| 228 | 228 | //and lastly, add the actual taxes |
| 229 | - self::apply_taxes( $total_line_item ); |
|
| 229 | + self::apply_taxes($total_line_item); |
|
| 230 | 230 | return $tax_line_item; |
| 231 | 231 | } |
| 232 | 232 | |
@@ -238,17 +238,17 @@ discard block |
||
| 238 | 238 | * any old taxes are removed |
| 239 | 239 | * @param EE_Line_Item $total_line_item of type EEM_Line_Item::type_total |
| 240 | 240 | */ |
| 241 | - public static function apply_taxes( EE_Line_Item $total_line_item ){ |
|
| 241 | + public static function apply_taxes(EE_Line_Item $total_line_item) { |
|
| 242 | 242 | // get array of taxes via Price Model |
| 243 | - $ordered_taxes = EE_Registry::instance()->load_model( 'Price' )->get_all_prices_that_are_taxes(); |
|
| 244 | - ksort( $ordered_taxes ); |
|
| 245 | - $taxes_line_item = self::get_taxes_subtotal( $total_line_item ); |
|
| 243 | + $ordered_taxes = EE_Registry::instance()->load_model('Price')->get_all_prices_that_are_taxes(); |
|
| 244 | + ksort($ordered_taxes); |
|
| 245 | + $taxes_line_item = self::get_taxes_subtotal($total_line_item); |
|
| 246 | 246 | //just to be safe, remove its old tax line items |
| 247 | 247 | $taxes_line_item->delete_children_line_items(); |
| 248 | 248 | //loop thru taxes |
| 249 | - foreach ( $ordered_taxes as $order => $taxes ) { |
|
| 250 | - foreach ( $taxes as $tax ) { |
|
| 251 | - if ( $tax instanceof EE_Price ) { |
|
| 249 | + foreach ($ordered_taxes as $order => $taxes) { |
|
| 250 | + foreach ($taxes as $tax) { |
|
| 251 | + if ($tax instanceof EE_Price) { |
|
| 252 | 252 | $taxes_line_item->add_child_line_item(EE_Line_Item::new_instance(array( |
| 253 | 253 | 'LIN_name'=>$tax->name(), |
| 254 | 254 | 'LIN_desc'=>$tax->desc(), |
@@ -274,10 +274,10 @@ discard block |
||
| 274 | 274 | * @param EE_Line_Item $total_line_item of type EEM_Line_Item::type_total |
| 275 | 275 | * @return float |
| 276 | 276 | */ |
| 277 | - public static function ensure_taxes_applied( $total_line_item ){ |
|
| 278 | - $taxes_subtotal = self::get_taxes_subtotal( $total_line_item ); |
|
| 279 | - if( ! $taxes_subtotal->children()){ |
|
| 280 | - self::apply_taxes( $total_line_item ); |
|
| 277 | + public static function ensure_taxes_applied($total_line_item) { |
|
| 278 | + $taxes_subtotal = self::get_taxes_subtotal($total_line_item); |
|
| 279 | + if ( ! $taxes_subtotal->children()) { |
|
| 280 | + self::apply_taxes($total_line_item); |
|
| 281 | 281 | } |
| 282 | 282 | return $taxes_subtotal->total(); |
| 283 | 283 | } |
@@ -290,27 +290,27 @@ discard block |
||
| 290 | 290 | * @param array|bool|string $line_item_codes |
| 291 | 291 | * @return int number of items successfully removed |
| 292 | 292 | */ |
| 293 | - public static function delete_items( EE_Line_Item $total_line_item, $line_item_codes = FALSE ) { |
|
| 293 | + public static function delete_items(EE_Line_Item $total_line_item, $line_item_codes = FALSE) { |
|
| 294 | 294 | |
| 295 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
| 295 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
| 296 | 296 | |
| 297 | 297 | // check if only a single line_item_id was passed |
| 298 | - if ( ! empty( $line_item_codes ) && ! is_array( $line_item_codes )) { |
|
| 298 | + if ( ! empty($line_item_codes) && ! is_array($line_item_codes)) { |
|
| 299 | 299 | // place single line_item_id in an array to appear as multiple line_item_ids |
| 300 | - $line_item_codes = array ( $line_item_codes ); |
|
| 300 | + $line_item_codes = array($line_item_codes); |
|
| 301 | 301 | } |
| 302 | 302 | |
| 303 | - $items_line_item = self::get_items_subtotal( $total_line_item ); |
|
| 304 | - if( ! $items_line_item){ |
|
| 303 | + $items_line_item = self::get_items_subtotal($total_line_item); |
|
| 304 | + if ( ! $items_line_item) { |
|
| 305 | 305 | return 0; |
| 306 | 306 | } |
| 307 | 307 | $removals = 0; |
| 308 | 308 | // cycle thru line_item_ids |
| 309 | - foreach ( $line_item_codes as $line_item_id ) { |
|
| 309 | + foreach ($line_item_codes as $line_item_id) { |
|
| 310 | 310 | $removals += $items_line_item->delete_child_line_item($line_item_id); |
| 311 | 311 | } |
| 312 | 312 | |
| 313 | - if ( $removals > 0 ) { |
|
| 313 | + if ($removals > 0) { |
|
| 314 | 314 | $total_line_item->recalculate_taxes_and_tax_total(); |
| 315 | 315 | return $removals; |
| 316 | 316 | } else { |
@@ -327,23 +327,23 @@ discard block |
||
| 327 | 327 | * @param string $description |
| 328 | 328 | * @return EE_Line_Item the new tax line item created |
| 329 | 329 | */ |
| 330 | - public static function set_total_tax_to( EE_Line_Item $total_line_item, $amount, $name = NULL, $description = NULL ){ |
|
| 330 | + public static function set_total_tax_to(EE_Line_Item $total_line_item, $amount, $name = NULL, $description = NULL) { |
|
| 331 | 331 | //first: remove all tax descendants |
| 332 | 332 | //add this as a new tax descendant |
| 333 | - $tax_subtotal = self::get_taxes_subtotal( $total_line_item ); |
|
| 333 | + $tax_subtotal = self::get_taxes_subtotal($total_line_item); |
|
| 334 | 334 | $tax_subtotal->delete_children_line_items(); |
| 335 | 335 | $taxable_total = $total_line_item->taxable_total(); |
| 336 | 336 | $new_tax = EE_Line_Item::new_instance(array( |
| 337 | 337 | 'TXN_ID' => $total_line_item->TXN_ID(), |
| 338 | 338 | 'LIN_name' => $name ? $name : __('Tax', 'event_espresso'), |
| 339 | 339 | 'LIN_desc' => $description ? $description : '', |
| 340 | - 'LIN_percent' => $taxable_total ? ( $amount / $total_line_item->taxable_total() * 100 ) : 0, |
|
| 340 | + 'LIN_percent' => $taxable_total ? ($amount / $total_line_item->taxable_total() * 100) : 0, |
|
| 341 | 341 | 'LIN_total' => $amount, |
| 342 | 342 | 'LIN_parent' => $tax_subtotal->ID(), |
| 343 | 343 | 'LIN_type' => EEM_Line_Item::type_tax |
| 344 | 344 | )); |
| 345 | 345 | $new_tax->save(); |
| 346 | - $tax_subtotal->set_total( $amount ); |
|
| 346 | + $tax_subtotal->set_total($amount); |
|
| 347 | 347 | $tax_subtotal->save(); |
| 348 | 348 | $total_line_item->recalculate_total_including_taxes(); |
| 349 | 349 | return $new_tax; |
@@ -355,17 +355,17 @@ discard block |
||
| 355 | 355 | * @param int $indentation |
| 356 | 356 | * @return void |
| 357 | 357 | */ |
| 358 | - public static function visualize( EE_Line_Item $line_item, $indentation = 0 ){ |
|
| 358 | + public static function visualize(EE_Line_Item $line_item, $indentation = 0) { |
|
| 359 | 359 | echo "\r\n"; |
| 360 | - for( $i = 0; $i < $indentation; $i++ ){ |
|
| 360 | + for ($i = 0; $i < $indentation; $i++) { |
|
| 361 | 361 | echo "-"; |
| 362 | 362 | } |
| 363 | - echo $line_item->name() . ": " . $line_item->type() . " $" . $line_item->total(); |
|
| 364 | - if( $line_item->is_taxable() ){ |
|
| 363 | + echo $line_item->name().": ".$line_item->type()." $".$line_item->total(); |
|
| 364 | + if ($line_item->is_taxable()) { |
|
| 365 | 365 | echo " taxable"; |
| 366 | 366 | } |
| 367 | - if( $line_item->children() ){ |
|
| 368 | - foreach($line_item->children() as $child){ |
|
| 367 | + if ($line_item->children()) { |
|
| 368 | + foreach ($line_item->children() as $child) { |
|
| 369 | 369 | self::visualize($child, $indentation + 1); |
| 370 | 370 | } |
| 371 | 371 | } |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | )); |
| 102 | 102 | if($price->is_percent()){ |
| 103 | 103 | $sub_line_item->set_percent($sign * $price->amount()); |
| 104 | - }else{ |
|
| 104 | + } else{ |
|
| 105 | 105 | $sub_line_item->set_unit_price($sign * $price->amount()); |
| 106 | 106 | } |
| 107 | 107 | $running_total_for_ticket += $price_total; |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | $ticket_items = self::get_items_subtotal( $total_line_item ); |
| 126 | 126 | if($ticket_items){ |
| 127 | 127 | $success = $ticket_items->add_child_line_item($item); |
| 128 | - }else{ |
|
| 128 | + } else{ |
|
| 129 | 129 | return FALSE; |
| 130 | 130 | } |
| 131 | 131 | // recalculate cart totals based on new items |
@@ -44,16 +44,16 @@ discard block |
||
| 44 | 44 | * regardless of access. |
| 45 | 45 | * @return EE_Venue | null |
| 46 | 46 | */ |
| 47 | - public static function get_venue( $VNU_ID = 0, $look_in_event = TRUE, $privacy_check = true ) { |
|
| 48 | - $VNU_ID = absint( $VNU_ID ); |
|
| 47 | + public static function get_venue($VNU_ID = 0, $look_in_event = TRUE, $privacy_check = true) { |
|
| 48 | + $VNU_ID = absint($VNU_ID); |
|
| 49 | 49 | // do we already have the Venue you are looking for? |
| 50 | - if ( EEH_Venue_View::$_venue instanceof EE_Venue && EEH_Venue_View::$_venue->ID() == $VNU_ID ) { |
|
| 51 | - return EEH_Venue_View::_get_venue( $privacy_check ); |
|
| 50 | + if (EEH_Venue_View::$_venue instanceof EE_Venue && EEH_Venue_View::$_venue->ID() == $VNU_ID) { |
|
| 51 | + return EEH_Venue_View::_get_venue($privacy_check); |
|
| 52 | 52 | } |
| 53 | 53 | // international newspaper? |
| 54 | 54 | global $post; |
| 55 | - if ( $post instanceof WP_Post ) { |
|
| 56 | - switch ( $post->post_type ) { |
|
| 55 | + if ($post instanceof WP_Post) { |
|
| 56 | + switch ($post->post_type) { |
|
| 57 | 57 | // if this is being called from an EE_Venue post, |
| 58 | 58 | // and the EE_Venue post corresponds to the EE_Venue that is being asked for, |
| 59 | 59 | // then we can try to just grab the attached EE_Venue object |
@@ -61,31 +61,31 @@ discard block |
||
| 61 | 61 | // the post already contains the related EE_Venue object AND one of the following is TRUE: |
| 62 | 62 | // the requested Venue ID matches the post ID OR... |
| 63 | 63 | // there was no specific Venue ID requested |
| 64 | - if ( isset( $post->EE_Venue ) && ( $VNU_ID == $post->ID || ! $VNU_ID )) { |
|
| 64 | + if (isset($post->EE_Venue) && ($VNU_ID == $post->ID || ! $VNU_ID)) { |
|
| 65 | 65 | // use existing related EE_Venue object |
| 66 | - EEH_Venue_View::$_venue = $post->EE_Venue; |
|
| 67 | - } else if ( $VNU_ID ) { |
|
| 66 | + EEH_Venue_View::$_venue = $post->EE_Venue; |
|
| 67 | + } else if ($VNU_ID) { |
|
| 68 | 68 | // there WAS a specific Venue ID requested, but it's NOT the current post object |
| 69 | - EEH_Venue_View::$_venue = EEM_Venue::instance()->get_one_by_ID( $VNU_ID ); |
|
| 69 | + EEH_Venue_View::$_venue = EEM_Venue::instance()->get_one_by_ID($VNU_ID); |
|
| 70 | 70 | } else { |
| 71 | 71 | // no specific Venue ID requested, so use post ID to generate EE_Venue object |
| 72 | - EEH_Venue_View::$_venue = EEM_Venue::instance()->get_one_by_ID( $post->ID ); |
|
| 72 | + EEH_Venue_View::$_venue = EEM_Venue::instance()->get_one_by_ID($post->ID); |
|
| 73 | 73 | } |
| 74 | 74 | break; |
| 75 | 75 | |
| 76 | 76 | case 'espresso_events': |
| 77 | - if ( $look_in_event ) { |
|
| 77 | + if ($look_in_event) { |
|
| 78 | 78 | // grab the events related venues |
| 79 | 79 | $venues = EEH_Venue_View::get_event_venues(); |
| 80 | 80 | // make sure the result is an array |
| 81 | - $venues = is_array( $venues ) ? $venues : array(); |
|
| 81 | + $venues = is_array($venues) ? $venues : array(); |
|
| 82 | 82 | // do we have an ID for a specific venue? |
| 83 | - if ( $VNU_ID ) { |
|
| 83 | + if ($VNU_ID) { |
|
| 84 | 84 | // loop thru the related venues |
| 85 | - foreach( $venues as $venue ) { |
|
| 86 | - if ( $venue instanceof EE_Venue ) { |
|
| 85 | + foreach ($venues as $venue) { |
|
| 86 | + if ($venue instanceof EE_Venue) { |
|
| 87 | 87 | // until we find the venue we're looking for |
| 88 | - if ( $venue->ID() == $VNU_ID ) { |
|
| 88 | + if ($venue->ID() == $VNU_ID) { |
|
| 89 | 89 | EEH_Venue_View::$_venue = $venue; |
| 90 | 90 | break; |
| 91 | 91 | } |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | // then the global post is an events post and this function was called with no argument |
| 98 | 98 | } else { |
| 99 | 99 | // just grab the first related event venue |
| 100 | - EEH_Venue_View::$_venue = reset( $venues ); |
|
| 100 | + EEH_Venue_View::$_venue = reset($venues); |
|
| 101 | 101 | } |
| 102 | 102 | } |
| 103 | 103 | break; |
@@ -105,11 +105,11 @@ discard block |
||
| 105 | 105 | } |
| 106 | 106 | } |
| 107 | 107 | // now if we STILL do NOT have an EE_Venue model object, BUT we have a Venue ID... |
| 108 | - if ( ! EEH_Venue_View::$_venue instanceof EE_Venue && $VNU_ID ) { |
|
| 108 | + if ( ! EEH_Venue_View::$_venue instanceof EE_Venue && $VNU_ID) { |
|
| 109 | 109 | // sigh... pull it from the db |
| 110 | - EEH_Venue_View::$_venue = EEM_Venue::instance()->get_one_by_ID( $VNU_ID ); |
|
| 110 | + EEH_Venue_View::$_venue = EEM_Venue::instance()->get_one_by_ID($VNU_ID); |
|
| 111 | 111 | } |
| 112 | - return EEH_Venue_View::_get_venue( $privacy_check ); |
|
| 112 | + return EEH_Venue_View::_get_venue($privacy_check); |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | |
@@ -121,9 +121,9 @@ discard block |
||
| 121 | 121 | * regardless of access. |
| 122 | 122 | * @return EE_Venue |
| 123 | 123 | */ |
| 124 | - protected static function _get_venue( $privacy_check = true ) { |
|
| 124 | + protected static function _get_venue($privacy_check = true) { |
|
| 125 | 125 | // check for private venues. |
| 126 | - if ( EEH_Venue_View::$_venue instanceof EE_Venue && EEH_Venue_View::$_venue->status() == 'private' && $privacy_check && ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_venues', 'get_venues' ) ) { |
|
| 126 | + if (EEH_Venue_View::$_venue instanceof EE_Venue && EEH_Venue_View::$_venue->status() == 'private' && $privacy_check && ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_venues', 'get_venues')) { |
|
| 127 | 127 | return null; |
| 128 | 128 | } |
| 129 | 129 | return EEH_Venue_View::$_venue instanceof EE_Venue ? EEH_Venue_View::$_venue : null; |
@@ -139,8 +139,8 @@ discard block |
||
| 139 | 139 | */ |
| 140 | 140 | public static function get_event_venues() { |
| 141 | 141 | global $post; |
| 142 | - if ( $post->post_type == 'espresso_events' ) { |
|
| 143 | - if ( isset( $post->EE_Event ) && $post->EE_Event instanceof EE_Event ) { |
|
| 142 | + if ($post->post_type == 'espresso_events') { |
|
| 143 | + if (isset($post->EE_Event) && $post->EE_Event instanceof EE_Event) { |
|
| 144 | 144 | return $post->EE_Event->venues(); |
| 145 | 145 | } |
| 146 | 146 | } |
@@ -160,9 +160,9 @@ discard block |
||
| 160 | 160 | * |
| 161 | 161 | * @return bool|null |
| 162 | 162 | */ |
| 163 | - public static function is_venue_private( $VNU_ID = false ) { |
|
| 164 | - $venue = EEH_Venue_View::get_venue( $VNU_ID, true, true ); |
|
| 165 | - if ( ! $venue instanceof EE_Venue ) { |
|
| 163 | + public static function is_venue_private($VNU_ID = false) { |
|
| 164 | + $venue = EEH_Venue_View::get_venue($VNU_ID, true, true); |
|
| 165 | + if ( ! $venue instanceof EE_Venue) { |
|
| 166 | 166 | return null; |
| 167 | 167 | } |
| 168 | 168 | |
@@ -178,9 +178,9 @@ discard block |
||
| 178 | 178 | * @param int $VNU_ID |
| 179 | 179 | * @return string |
| 180 | 180 | */ |
| 181 | - public static function venue_description( $VNU_ID = 0 ) { |
|
| 182 | - $venue = EEH_Venue_View::get_venue( $VNU_ID ); |
|
| 183 | - if ( $venue instanceof EE_Venue ) { |
|
| 181 | + public static function venue_description($VNU_ID = 0) { |
|
| 182 | + $venue = EEH_Venue_View::get_venue($VNU_ID); |
|
| 183 | + if ($venue instanceof EE_Venue) { |
|
| 184 | 184 | return$venue->description(); |
| 185 | 185 | } |
| 186 | 186 | return ''; |
@@ -195,12 +195,12 @@ discard block |
||
| 195 | 195 | * @param int $VNU_ID |
| 196 | 196 | * @return string |
| 197 | 197 | */ |
| 198 | - public static function venue_excerpt( $VNU_ID = 0 ) { |
|
| 199 | - $venue = EEH_Venue_View::get_venue( $VNU_ID ); |
|
| 200 | - if ( $venue instanceof EE_Venue ) { |
|
| 198 | + public static function venue_excerpt($VNU_ID = 0) { |
|
| 199 | + $venue = EEH_Venue_View::get_venue($VNU_ID); |
|
| 200 | + if ($venue instanceof EE_Venue) { |
|
| 201 | 201 | $excerpt = $venue->excerpt() != NULL && $venue->excerpt() ? $venue->excerpt() : $venue->description(); |
| 202 | - $venue_link = ' ' . EEH_Venue_View::venue_details_link( $venue->ID(), __( 'more', 'event_espresso' ) . '…' ); |
|
| 203 | - return ! empty( $excerpt ) ? wp_trim_words( $excerpt, 25, '' ) . $venue_link : ''; |
|
| 202 | + $venue_link = ' '.EEH_Venue_View::venue_details_link($venue->ID(), __('more', 'event_espresso').'…'); |
|
| 203 | + return ! empty($excerpt) ? wp_trim_words($excerpt, 25, '').$venue_link : ''; |
|
| 204 | 204 | } |
| 205 | 205 | return ''; |
| 206 | 206 | } |
@@ -215,22 +215,22 @@ discard block |
||
| 215 | 215 | * @param bool $hide_uncategorized |
| 216 | 216 | * @return string |
| 217 | 217 | */ |
| 218 | - public static function venue_categories( $VNU_ID = 0, $hide_uncategorized = TRUE ) { |
|
| 218 | + public static function venue_categories($VNU_ID = 0, $hide_uncategorized = TRUE) { |
|
| 219 | 219 | $category_links = array(); |
| 220 | - $venue = EEH_Venue_View::get_venue( $VNU_ID ); |
|
| 221 | - if ( $venue instanceof EE_Venue ) { |
|
| 220 | + $venue = EEH_Venue_View::get_venue($VNU_ID); |
|
| 221 | + if ($venue instanceof EE_Venue) { |
|
| 222 | 222 | // get category terms |
| 223 | - if ( $venue_categories = get_the_terms( $venue->ID(), 'espresso_venue_categories' )) { |
|
| 223 | + if ($venue_categories = get_the_terms($venue->ID(), 'espresso_venue_categories')) { |
|
| 224 | 224 | // loop thru terms and create links |
| 225 | - foreach ( $venue_categories as $term ) { |
|
| 226 | - $url = get_term_link( $term, 'espresso_venue_categories' ); |
|
| 227 | - if ( ! is_wp_error( $url ) && (( $hide_uncategorized && strtolower( $term->name ) != __( 'uncategorized', 'event_espresso' )) || ! $hide_uncategorized )) { |
|
| 228 | - $category_links[] = '<a href="' . esc_url( $url ) . '" rel="tag">' . $term->name . '</a> '; |
|
| 225 | + foreach ($venue_categories as $term) { |
|
| 226 | + $url = get_term_link($term, 'espresso_venue_categories'); |
|
| 227 | + if ( ! is_wp_error($url) && (($hide_uncategorized && strtolower($term->name) != __('uncategorized', 'event_espresso')) || ! $hide_uncategorized)) { |
|
| 228 | + $category_links[] = '<a href="'.esc_url($url).'" rel="tag">'.$term->name.'</a> '; |
|
| 229 | 229 | } |
| 230 | 230 | } |
| 231 | 231 | } |
| 232 | 232 | } |
| 233 | - return implode( ', ', $category_links ); |
|
| 233 | + return implode(', ', $category_links); |
|
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | |
@@ -245,11 +245,11 @@ discard block |
||
| 245 | 245 | * @param bool $add_wrapper |
| 246 | 246 | * @return string |
| 247 | 247 | */ |
| 248 | - public static function venue_address( $type = 'multiline', $VNU_ID = 0, $use_schema = true, $add_wrapper = true ) { |
|
| 249 | - $venue = EEH_Venue_View::get_venue( $VNU_ID ); |
|
| 250 | - if ( $venue instanceof EE_Venue ) { |
|
| 251 | - EE_Registry::instance()->load_helper( 'Formatter' ); |
|
| 252 | - return EEH_Address::format( $venue, $type, $use_schema, $add_wrapper ); |
|
| 248 | + public static function venue_address($type = 'multiline', $VNU_ID = 0, $use_schema = true, $add_wrapper = true) { |
|
| 249 | + $venue = EEH_Venue_View::get_venue($VNU_ID); |
|
| 250 | + if ($venue instanceof EE_Venue) { |
|
| 251 | + EE_Registry::instance()->load_helper('Formatter'); |
|
| 252 | + return EEH_Address::format($venue, $type, $use_schema, $add_wrapper); |
|
| 253 | 253 | } |
| 254 | 254 | return ''; |
| 255 | 255 | } |
@@ -263,11 +263,11 @@ discard block |
||
| 263 | 263 | * @param int $VNU_ID |
| 264 | 264 | * @return bool|string |
| 265 | 265 | */ |
| 266 | - public static function venue_has_address( $VNU_ID = 0 ) { |
|
| 267 | - $venue = EEH_Venue_View::get_venue( $VNU_ID ); |
|
| 268 | - if ( $venue instanceof EE_Venue ) { |
|
| 269 | - EE_Registry::instance()->load_helper( 'Formatter' ); |
|
| 270 | - return EEH_Address::format( $venue, 'inline', FALSE, FALSE ); |
|
| 266 | + public static function venue_has_address($VNU_ID = 0) { |
|
| 267 | + $venue = EEH_Venue_View::get_venue($VNU_ID); |
|
| 268 | + if ($venue instanceof EE_Venue) { |
|
| 269 | + EE_Registry::instance()->load_helper('Formatter'); |
|
| 270 | + return EEH_Address::format($venue, 'inline', FALSE, FALSE); |
|
| 271 | 271 | } |
| 272 | 272 | return false; |
| 273 | 273 | } |
@@ -282,26 +282,26 @@ discard block |
||
| 282 | 282 | * @param int $VNU_ID |
| 283 | 283 | * @return string |
| 284 | 284 | */ |
| 285 | - public static function venue_name( $link_to = 'details', $VNU_ID = 0 ) { |
|
| 286 | - $venue = EEH_Venue_View::get_venue( $VNU_ID ); |
|
| 287 | - if ( $venue instanceof EE_Venue ) { |
|
| 288 | - EE_Registry::instance()->load_helper( 'Formatter' ); |
|
| 285 | + public static function venue_name($link_to = 'details', $VNU_ID = 0) { |
|
| 286 | + $venue = EEH_Venue_View::get_venue($VNU_ID); |
|
| 287 | + if ($venue instanceof EE_Venue) { |
|
| 288 | + EE_Registry::instance()->load_helper('Formatter'); |
|
| 289 | 289 | $venue_name = apply_filters( |
| 290 | 290 | 'FHEE__EEH_Venue__venue_name__append_private_venue_name', |
| 291 | 291 | EEH_Venue_View::is_venue_private() |
| 292 | - ? EEH_Venue_View::$_venue->name() . " " . __( '(Private)', 'event_espresso' ) |
|
| 292 | + ? EEH_Venue_View::$_venue->name()." ".__('(Private)', 'event_espresso') |
|
| 293 | 293 | : EEH_Venue_View::$_venue->name(), |
| 294 | 294 | EEH_Venue_View::$_venue |
| 295 | 295 | ); |
| 296 | - $venue_name = EEH_Schema::name( $venue_name ); |
|
| 297 | - switch( $link_to ) { |
|
| 296 | + $venue_name = EEH_Schema::name($venue_name); |
|
| 297 | + switch ($link_to) { |
|
| 298 | 298 | |
| 299 | 299 | case 'details' : |
| 300 | - return EEH_Venue_View::venue_details_link( $venue->ID(), $venue_name ); |
|
| 300 | + return EEH_Venue_View::venue_details_link($venue->ID(), $venue_name); |
|
| 301 | 301 | break; |
| 302 | 302 | |
| 303 | 303 | case 'website' : |
| 304 | - return EEH_Venue_View::venue_website_link( $venue->ID(), $venue_name ); |
|
| 304 | + return EEH_Venue_View::venue_website_link($venue->ID(), $venue_name); |
|
| 305 | 305 | break; |
| 306 | 306 | |
| 307 | 307 | default : |
@@ -321,10 +321,10 @@ discard block |
||
| 321 | 321 | * @param string $text |
| 322 | 322 | * @return string |
| 323 | 323 | */ |
| 324 | - public static function venue_details_link( $VNU_ID = 0, $text = '' ) { |
|
| 325 | - $venue = EEH_Venue_View::get_venue( $VNU_ID ); |
|
| 326 | - if ( $venue instanceof EE_Venue ) { |
|
| 327 | - return EEH_Schema::url( get_permalink( $venue->ID() ), $text ); |
|
| 324 | + public static function venue_details_link($VNU_ID = 0, $text = '') { |
|
| 325 | + $venue = EEH_Venue_View::get_venue($VNU_ID); |
|
| 326 | + if ($venue instanceof EE_Venue) { |
|
| 327 | + return EEH_Schema::url(get_permalink($venue->ID()), $text); |
|
| 328 | 328 | } |
| 329 | 329 | return ''; |
| 330 | 330 | } |
@@ -339,13 +339,13 @@ discard block |
||
| 339 | 339 | * @param string $text |
| 340 | 340 | * @return string |
| 341 | 341 | */ |
| 342 | - public static function venue_website_link( $VNU_ID = 0, $text = '' ) { |
|
| 343 | - $venue = EEH_Venue_View::get_venue( $VNU_ID ); |
|
| 344 | - if ( $venue instanceof EE_Venue ) { |
|
| 345 | - EE_Registry::instance()->load_helper( 'Formatter' ); |
|
| 342 | + public static function venue_website_link($VNU_ID = 0, $text = '') { |
|
| 343 | + $venue = EEH_Venue_View::get_venue($VNU_ID); |
|
| 344 | + if ($venue instanceof EE_Venue) { |
|
| 345 | + EE_Registry::instance()->load_helper('Formatter'); |
|
| 346 | 346 | $url = $venue->venue_url(); |
| 347 | - $text = ! empty( $text ) ? $text : $url; |
|
| 348 | - return ! empty( $url ) ? EEH_Schema::url( $url, $text ) : ''; |
|
| 347 | + $text = ! empty($text) ? $text : $url; |
|
| 348 | + return ! empty($url) ? EEH_Schema::url($url, $text) : ''; |
|
| 349 | 349 | } |
| 350 | 350 | return ''; |
| 351 | 351 | } |
@@ -359,11 +359,11 @@ discard block |
||
| 359 | 359 | * @param int $VNU_ID |
| 360 | 360 | * @return string |
| 361 | 361 | */ |
| 362 | - public static function venue_phone( $VNU_ID = 0) { |
|
| 363 | - $venue = EEH_Venue_View::get_venue( $VNU_ID ); |
|
| 364 | - if ( $venue instanceof EE_Venue ) { |
|
| 365 | - EE_Registry::instance()->load_helper( 'Formatter' ); |
|
| 366 | - return EEH_Schema::telephone( $venue->phone() ); |
|
| 362 | + public static function venue_phone($VNU_ID = 0) { |
|
| 363 | + $venue = EEH_Venue_View::get_venue($VNU_ID); |
|
| 364 | + if ($venue instanceof EE_Venue) { |
|
| 365 | + EE_Registry::instance()->load_helper('Formatter'); |
|
| 366 | + return EEH_Schema::telephone($venue->phone()); |
|
| 367 | 367 | } |
| 368 | 368 | return ''; |
| 369 | 369 | } |
@@ -379,51 +379,51 @@ discard block |
||
| 379 | 379 | * @param array $gmap map options |
| 380 | 380 | * @return string |
| 381 | 381 | */ |
| 382 | - public static function venue_gmap( $VNU_ID = 0, $map_ID = FALSE, $gmap = array() ) { |
|
| 382 | + public static function venue_gmap($VNU_ID = 0, $map_ID = FALSE, $gmap = array()) { |
|
| 383 | 383 | |
| 384 | - $venue = EEH_Venue_View::get_venue( $VNU_ID ); |
|
| 385 | - if ( $venue instanceof EE_Venue ) { |
|
| 384 | + $venue = EEH_Venue_View::get_venue($VNU_ID); |
|
| 385 | + if ($venue instanceof EE_Venue) { |
|
| 386 | 386 | // check for global espresso_events post and use it's ID if no map_ID is set |
| 387 | 387 | global $post; |
| 388 | - $map_ID = empty( $map_ID ) && $post->post_type == 'espresso_events' ? $post->ID : $map_ID; |
|
| 388 | + $map_ID = empty($map_ID) && $post->post_type == 'espresso_events' ? $post->ID : $map_ID; |
|
| 389 | 389 | // grab map settings |
| 390 | 390 | $map_cfg = EE_Registry::instance()->CFG->map_settings; |
| 391 | 391 | // are maps enabled ? |
| 392 | - if ( $map_cfg->use_google_maps && $venue->enable_for_gmap() ) { |
|
| 392 | + if ($map_cfg->use_google_maps && $venue->enable_for_gmap()) { |
|
| 393 | 393 | |
| 394 | - EE_Registry::instance()->load_helper( 'Maps' ); |
|
| 395 | - EE_Registry::instance()->load_helper( 'Formatter' ); |
|
| 394 | + EE_Registry::instance()->load_helper('Maps'); |
|
| 395 | + EE_Registry::instance()->load_helper('Formatter'); |
|
| 396 | 396 | |
| 397 | 397 | $details_page = is_single(); |
| 398 | 398 | $options = array(); |
| 399 | - $options['map_ID'] = $map_ID && $map_ID != $venue->ID() ? $map_ID . '-' . $venue->ID()/* . '-' . $static_map_id*/ : $venue->ID()/* . '-' . $static_map_id*/; |
|
| 399 | + $options['map_ID'] = $map_ID && $map_ID != $venue->ID() ? $map_ID.'-'.$venue->ID()/* . '-' . $static_map_id*/ : $venue->ID()/* . '-' . $static_map_id*/; |
|
| 400 | 400 | |
| 401 | - $options['location'] = EEH_Address::format( $venue, 'inline', FALSE, FALSE ); |
|
| 401 | + $options['location'] = EEH_Address::format($venue, 'inline', FALSE, FALSE); |
|
| 402 | 402 | |
| 403 | 403 | $options['ee_map_width'] = $details_page ? $map_cfg->event_details_map_width : $map_cfg->event_list_map_width; |
| 404 | - $options['ee_map_width'] = isset( $gmap['ee_map_width'] ) && ! empty( $gmap['ee_map_width'] ) ? $gmap['ee_map_width'] : $options['ee_map_width']; |
|
| 404 | + $options['ee_map_width'] = isset($gmap['ee_map_width']) && ! empty($gmap['ee_map_width']) ? $gmap['ee_map_width'] : $options['ee_map_width']; |
|
| 405 | 405 | |
| 406 | 406 | $options['ee_map_height'] = $details_page ? $map_cfg->event_details_map_height : $map_cfg->event_list_map_height; |
| 407 | - $options['ee_map_height'] = isset( $gmap['ee_map_height'] ) && ! empty( $gmap['ee_map_height'] ) ? $gmap['ee_map_height'] : $options['ee_map_height']; |
|
| 407 | + $options['ee_map_height'] = isset($gmap['ee_map_height']) && ! empty($gmap['ee_map_height']) ? $gmap['ee_map_height'] : $options['ee_map_height']; |
|
| 408 | 408 | |
| 409 | 409 | $options['ee_map_zoom'] = $details_page ? $map_cfg->event_details_map_zoom : $map_cfg->event_list_map_zoom; |
| 410 | - $options['ee_map_zoom'] = isset( $gmap['ee_map_zoom'] ) && ! empty( $gmap['ee_map_zoom'] ) ? $gmap['ee_map_zoom'] : $options['ee_map_zoom']; |
|
| 410 | + $options['ee_map_zoom'] = isset($gmap['ee_map_zoom']) && ! empty($gmap['ee_map_zoom']) ? $gmap['ee_map_zoom'] : $options['ee_map_zoom']; |
|
| 411 | 411 | |
| 412 | 412 | $options['ee_map_nav_display'] = $details_page ? $map_cfg->event_details_display_nav : $map_cfg->event_list_display_nav; |
| 413 | - $options['ee_map_nav_display'] = isset( $gmap['ee_map_nav_display'] ) && ! empty( $gmap['ee_map_nav_display'] ) ? 'true' : $options['ee_map_nav_display'];; |
|
| 413 | + $options['ee_map_nav_display'] = isset($gmap['ee_map_nav_display']) && ! empty($gmap['ee_map_nav_display']) ? 'true' : $options['ee_map_nav_display']; ; |
|
| 414 | 414 | |
| 415 | 415 | $options['ee_map_nav_size'] = $details_page ? $map_cfg->event_details_nav_size : $map_cfg->event_list_nav_size; |
| 416 | - $options['ee_map_nav_size'] = isset( $gmap['ee_map_nav_size'] ) && ! empty( $gmap['ee_map_nav_size'] )? $gmap['ee_map_nav_size'] : $options['ee_map_nav_size']; |
|
| 416 | + $options['ee_map_nav_size'] = isset($gmap['ee_map_nav_size']) && ! empty($gmap['ee_map_nav_size']) ? $gmap['ee_map_nav_size'] : $options['ee_map_nav_size']; |
|
| 417 | 417 | |
| 418 | 418 | $options['ee_map_type_control'] = $details_page ? $map_cfg->event_details_control_type : $map_cfg->event_list_control_type; |
| 419 | - $options['ee_map_type_control'] = isset( $gmap['ee_map_type_control'] ) && ! empty( $gmap['ee_map_type_control'] )? $gmap['ee_map_type_control'] : $options['ee_map_type_control']; |
|
| 419 | + $options['ee_map_type_control'] = isset($gmap['ee_map_type_control']) && ! empty($gmap['ee_map_type_control']) ? $gmap['ee_map_type_control'] : $options['ee_map_type_control']; |
|
| 420 | 420 | |
| 421 | 421 | $options['ee_map_align'] = $details_page ? $map_cfg->event_details_map_align : $map_cfg->event_list_map_align; |
| 422 | - $options['ee_map_align'] = isset( $gmap['ee_map_align'] ) && ! empty( $gmap['ee_map_align'] )? $gmap['ee_map_align'] : $options['ee_map_align']; |
|
| 422 | + $options['ee_map_align'] = isset($gmap['ee_map_align']) && ! empty($gmap['ee_map_align']) ? $gmap['ee_map_align'] : $options['ee_map_align']; |
|
| 423 | 423 | |
| 424 | - $options['ee_static_url'] = isset( $gmap['ee_static_url'] ) && ! empty( $gmap['ee_static_url'] ) ? (bool)absint( $gmap['ee_static_url'] ) : $venue->google_map_link(); |
|
| 424 | + $options['ee_static_url'] = isset($gmap['ee_static_url']) && ! empty($gmap['ee_static_url']) ? (bool) absint($gmap['ee_static_url']) : $venue->google_map_link(); |
|
| 425 | 425 | |
| 426 | - return EEH_Maps::google_map( $options ); |
|
| 426 | + return EEH_Maps::google_map($options); |
|
| 427 | 427 | |
| 428 | 428 | } |
| 429 | 429 | } |
@@ -438,7 +438,7 @@ discard block |
||
| 438 | 438 | * @param array $atts like EEH_Maps::google_map_link |
| 439 | 439 | * @return string |
| 440 | 440 | */ |
| 441 | - public static function espresso_google_static_map( EE_Venue $venue, $atts = array() ){ |
|
| 441 | + public static function espresso_google_static_map(EE_Venue $venue, $atts = array()) { |
|
| 442 | 442 | EE_Registry::instance()->load_helper('Maps'); |
| 443 | 443 | $state = $venue->state_obj(); |
| 444 | 444 | $country = $venue->country_obj(); |
@@ -470,23 +470,23 @@ discard block |
||
| 470 | 470 | * @param string $after |
| 471 | 471 | * @return string |
| 472 | 472 | */ |
| 473 | - public static function edit_venue_link( $VNU_ID = 0, $link = '', $before = '<p class="edit-venue-lnk small-txt">', $after = '</p>' ) { |
|
| 474 | - $venue = EEH_Venue_View::get_venue( $VNU_ID ); |
|
| 475 | - if ( $venue instanceof EE_Venue ) { |
|
| 473 | + public static function edit_venue_link($VNU_ID = 0, $link = '', $before = '<p class="edit-venue-lnk small-txt">', $after = '</p>') { |
|
| 474 | + $venue = EEH_Venue_View::get_venue($VNU_ID); |
|
| 475 | + if ($venue instanceof EE_Venue) { |
|
| 476 | 476 | // can the user edit this post ? |
| 477 | - if ( current_user_can( 'edit_post', $venue->ID() )) { |
|
| 477 | + if (current_user_can('edit_post', $venue->ID())) { |
|
| 478 | 478 | // set link text |
| 479 | - $link = ! empty( $link ) ? $link : __('edit this venue'); |
|
| 479 | + $link = ! empty($link) ? $link : __('edit this venue'); |
|
| 480 | 480 | // generate nonce |
| 481 | - $nonce = wp_create_nonce( 'edit_nonce' ); |
|
| 481 | + $nonce = wp_create_nonce('edit_nonce'); |
|
| 482 | 482 | // generate url to venue editor for this venue |
| 483 | - $url = add_query_arg( array( 'page' => 'espresso_venues', 'action' => 'edit', 'post' => $venue->ID(), 'edit_nonce' => $nonce ), admin_url( 'admin.php' ) ); |
|
| 483 | + $url = add_query_arg(array('page' => 'espresso_venues', 'action' => 'edit', 'post' => $venue->ID(), 'edit_nonce' => $nonce), admin_url('admin.php')); |
|
| 484 | 484 | // get edit CPT text |
| 485 | - $post_type_obj = get_post_type_object( 'espresso_venues' ); |
|
| 485 | + $post_type_obj = get_post_type_object('espresso_venues'); |
|
| 486 | 486 | // build final link html |
| 487 | - $link = '<a class="post-edit-link" href="' . $url . '" title="' . esc_attr( $post_type_obj->labels->edit_item ) . '">' . $link . '</a>'; |
|
| 487 | + $link = '<a class="post-edit-link" href="'.$url.'" title="'.esc_attr($post_type_obj->labels->edit_item).'">'.$link.'</a>'; |
|
| 488 | 488 | // put it all together |
| 489 | - return $before . apply_filters( 'edit_post_link', $link, $venue->ID() ) . $after; |
|
| 489 | + return $before.apply_filters('edit_post_link', $link, $venue->ID()).$after; |
|
| 490 | 490 | } |
| 491 | 491 | } |
| 492 | 492 | return ''; |
@@ -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 | * |