@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | use EventEspresso\core\services\database\TableAnalysis; |
3 | -if (!defined('EVENT_ESPRESSO_VERSION') ){ |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
4 | 4 | exit('NO direct script access allowed'); |
5 | 5 | } |
6 | 6 | /** |
@@ -27,15 +27,15 @@ discard block |
||
27 | 27 | */ |
28 | 28 | public function __construct() { |
29 | 29 | //define some page related constants |
30 | - define( 'EE_PAYMENTS_PG_SLUG', 'espresso_payment_settings' ); |
|
31 | - define( 'EE_PAYMENTS_ADMIN_URL', admin_url( 'admin.php?page=' . EE_PAYMENTS_PG_SLUG )); |
|
32 | - define( 'EE_PAYMENTS_ADMIN', EE_ADMIN_PAGES . 'payments' . DS ); |
|
33 | - define( 'EE_PAYMENTS_TEMPLATE_PATH', EE_PAYMENTS_ADMIN . 'templates' . DS ); |
|
34 | - define( 'EE_PAYMENTS_ASSETS_URL', EE_ADMIN_PAGES_URL . 'payments/assets/' ); |
|
35 | - $this->_table_analysis = EE_Registry::instance()->create( 'TableAnalysis', array(), true ); |
|
30 | + define('EE_PAYMENTS_PG_SLUG', 'espresso_payment_settings'); |
|
31 | + define('EE_PAYMENTS_ADMIN_URL', admin_url('admin.php?page='.EE_PAYMENTS_PG_SLUG)); |
|
32 | + define('EE_PAYMENTS_ADMIN', EE_ADMIN_PAGES.'payments'.DS); |
|
33 | + define('EE_PAYMENTS_TEMPLATE_PATH', EE_PAYMENTS_ADMIN.'templates'.DS); |
|
34 | + define('EE_PAYMENTS_ASSETS_URL', EE_ADMIN_PAGES_URL.'payments/assets/'); |
|
35 | + $this->_table_analysis = EE_Registry::instance()->create('TableAnalysis', array(), true); |
|
36 | 36 | //check that there are active gateways on all admin page loads. but dont do it just yet |
37 | 37 | // echo "constructing payments admin page";die; |
38 | - add_action('admin_notices',array($this,'check_payment_gateway_setup')); |
|
38 | + add_action('admin_notices', array($this, 'check_payment_gateway_setup')); |
|
39 | 39 | parent::__construct(); |
40 | 40 | } |
41 | 41 | |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | 'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY, |
59 | 59 | 'parent_slug' => 'espresso_events', |
60 | 60 | 'menu_slug' => EE_PAYMENTS_PG_SLUG, |
61 | - 'menu_label' => __( 'Payment Methods', 'event_espresso' ), |
|
61 | + 'menu_label' => __('Payment Methods', 'event_espresso'), |
|
62 | 62 | 'capability' => 'ee_manage_gateways', |
63 | 63 | 'admin_init_page' => $this, |
64 | 64 | ) |
@@ -72,25 +72,25 @@ discard block |
||
72 | 72 | * |
73 | 73 | * @throws \EE_Error |
74 | 74 | */ |
75 | - public function check_payment_gateway_setup(){ |
|
75 | + public function check_payment_gateway_setup() { |
|
76 | 76 | //ONLY do this check if models can query |
77 | 77 | //and avoid a bug where when we nuke EE4's data that this causes a fatal error |
78 | 78 | //because the tables are deleted just before this request runs. see https://events.codebasehq.com/projects/event-espresso/tickets/7539 |
79 | 79 | if ( |
80 | 80 | ! EE_Maintenance_Mode::instance()->models_can_query() |
81 | - || ! $this->_get_table_analysis()->tableExists( EEM_Payment_Method::instance()->table() ) |
|
81 | + || ! $this->_get_table_analysis()->tableExists(EEM_Payment_Method::instance()->table()) |
|
82 | 82 | ) { |
83 | 83 | return; |
84 | 84 | } |
85 | 85 | |
86 | 86 | |
87 | 87 | // ensure Payment_Method model is loaded |
88 | - EE_Registry::instance()->load_model( 'Payment_Method' ); |
|
89 | - $actives = EEM_Payment_Method::instance()->count_active( EEM_Payment_Method::scope_cart ); |
|
90 | - if( $actives < 1 ){ |
|
88 | + EE_Registry::instance()->load_model('Payment_Method'); |
|
89 | + $actives = EEM_Payment_Method::instance()->count_active(EEM_Payment_Method::scope_cart); |
|
90 | + if ($actives < 1) { |
|
91 | 91 | $url = EE_Admin_Page::add_query_args_and_nonce(array(), EE_PAYMENTS_ADMIN_URL); |
92 | 92 | echo '<div class="error"> |
93 | - <p>'. sprintf(__("There are no Active Payment Methods setup for Event Espresso. Please %s activate at least one.%s", "event_espresso"),"<a href='$url'>","</a>").'</p> |
|
93 | + <p>'. sprintf(__("There are no Active Payment Methods setup for Event Espresso. Please %s activate at least one.%s", "event_espresso"), "<a href='$url'>", "</a>").'</p> |
|
94 | 94 | </div>'; |
95 | 95 | } |
96 | 96 | } |
@@ -101,13 +101,13 @@ discard block |
||
101 | 101 | * @throws \EE_Error |
102 | 102 | */ |
103 | 103 | protected function _get_table_analysis() { |
104 | - if( $this->_table_analysis instanceof TableAnalysis ) { |
|
104 | + if ($this->_table_analysis instanceof TableAnalysis) { |
|
105 | 105 | return $this->_table_analysis; |
106 | 106 | } else { |
107 | 107 | throw new \EE_Error( |
108 | 108 | sprintf( |
109 | - __( 'Table analysis class on class %1$s is not set properly.', 'event_espresso'), |
|
110 | - get_class( $this ) |
|
109 | + __('Table analysis class on class %1$s is not set properly.', 'event_espresso'), |
|
110 | + get_class($this) |
|
111 | 111 | ) |
112 | 112 | ); |
113 | 113 | } |
@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | use EventEspresso\core\services\database\TableAnalysis; |
3 | 3 | |
4 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
5 | - exit( 'No direct script access allowed' ); |
|
4 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
5 | + exit('No direct script access allowed'); |
|
6 | 6 | } |
7 | 7 | /** |
8 | 8 | * the purpose of this file is to simply contain any action/filter hook callbacks etc for specific aspects of EE |
@@ -11,10 +11,10 @@ discard block |
||
11 | 11 | */ |
12 | 12 | |
13 | 13 | // defined some new constants related to caffeinated folder |
14 | -define( 'EE_CAF_URL', EE_PLUGIN_DIR_URL . 'caffeinated/' ); |
|
15 | -define( 'EE_CAF_CORE', EE_CAFF_PATH . 'core' . DS ); |
|
16 | -define( 'EE_CAF_LIBRARIES', EE_CAF_CORE . 'libraries' . DS ); |
|
17 | -define( 'EE_CAF_PAYMENT_METHODS', EE_CAFF_PATH . 'payment_methods' . DS ); |
|
14 | +define('EE_CAF_URL', EE_PLUGIN_DIR_URL.'caffeinated/'); |
|
15 | +define('EE_CAF_CORE', EE_CAFF_PATH.'core'.DS); |
|
16 | +define('EE_CAF_LIBRARIES', EE_CAF_CORE.'libraries'.DS); |
|
17 | +define('EE_CAF_PAYMENT_METHODS', EE_CAFF_PATH.'payment_methods'.DS); |
|
18 | 18 | |
19 | 19 | |
20 | 20 | |
@@ -35,31 +35,31 @@ discard block |
||
35 | 35 | /** |
36 | 36 | * EE_Brewing_Regular constructor. |
37 | 37 | */ |
38 | - public function __construct( TableAnalysis $table_analysis ) { |
|
38 | + public function __construct(TableAnalysis $table_analysis) { |
|
39 | 39 | $this->_table_analysis = $table_analysis; |
40 | - if ( defined( 'EE_CAFF_PATH' ) ) { |
|
40 | + if (defined('EE_CAFF_PATH')) { |
|
41 | 41 | // activation |
42 | - add_action( 'AHEE__EEH_Activation__initialize_db_content', array( $this, 'initialize_caf_db_content' ) ); |
|
42 | + add_action('AHEE__EEH_Activation__initialize_db_content', array($this, 'initialize_caf_db_content')); |
|
43 | 43 | // load caff init |
44 | - add_action( 'AHEE__EE_System__set_hooks_for_core', array( $this, 'caffeinated_init' ) ); |
|
44 | + add_action('AHEE__EE_System__set_hooks_for_core', array($this, 'caffeinated_init')); |
|
45 | 45 | // remove the "powered by" credit link from receipts and invoices |
46 | - add_filter( 'FHEE_EE_Html_messenger__add_powered_by_credit_link_to_receipt_and_invoice', '__return_false' ); |
|
46 | + add_filter('FHEE_EE_Html_messenger__add_powered_by_credit_link_to_receipt_and_invoice', '__return_false'); |
|
47 | 47 | // add caffeinated modules |
48 | 48 | add_filter( |
49 | 49 | 'FHEE__EE_Config__register_modules__modules_to_register', |
50 | - array( $this, 'caffeinated_modules_to_register' ) |
|
50 | + array($this, 'caffeinated_modules_to_register') |
|
51 | 51 | ); |
52 | 52 | // load caff scripts |
53 | - add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_caffeinated_scripts' ), 10 ); |
|
54 | - add_filter( 'FHEE__EE_Registry__load_helper__helper_paths', array( $this, 'caf_helper_paths' ), 10 ); |
|
53 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_caffeinated_scripts'), 10); |
|
54 | + add_filter('FHEE__EE_Registry__load_helper__helper_paths', array($this, 'caf_helper_paths'), 10); |
|
55 | 55 | add_filter( |
56 | 56 | 'FHEE__EE_Payment_Method_Manager__register_payment_methods__payment_methods_to_register', |
57 | - array( $this, 'caf_payment_methods' ) |
|
57 | + array($this, 'caf_payment_methods') |
|
58 | 58 | ); |
59 | 59 | // caffeinated constructed |
60 | - do_action( 'AHEE__EE_Brewing_Regular__construct__complete' ); |
|
60 | + do_action('AHEE__EE_Brewing_Regular__construct__complete'); |
|
61 | 61 | //seeing how this is caf, which isn't put on WordPress.org, we can have affiliate links without a disclaimer |
62 | - add_filter( 'FHEE__ee_show_affiliate_links', '__return_false' ); |
|
62 | + add_filter('FHEE__ee_show_affiliate_links', '__return_false'); |
|
63 | 63 | } |
64 | 64 | } |
65 | 65 | |
@@ -71,8 +71,8 @@ discard block |
||
71 | 71 | * @param array $paths original helper paths array |
72 | 72 | * @return array new array of paths |
73 | 73 | */ |
74 | - public function caf_helper_paths( $paths ) { |
|
75 | - $paths[] = EE_CAF_CORE . 'helpers' . DS; |
|
74 | + public function caf_helper_paths($paths) { |
|
75 | + $paths[] = EE_CAF_CORE.'helpers'.DS; |
|
76 | 76 | return $paths; |
77 | 77 | } |
78 | 78 | |
@@ -89,21 +89,21 @@ discard block |
||
89 | 89 | * |
90 | 90 | * @global wpdb $wpdb |
91 | 91 | */ |
92 | - public function initialize_caf_db_content(){ |
|
92 | + public function initialize_caf_db_content() { |
|
93 | 93 | global $wpdb; |
94 | 94 | //use same method of getting creator id as the version introducing the change |
95 | - $default_creator_id = apply_filters('FHEE__EE_DMS_Core_4_5_0__get_default_creator_id',get_current_user_id()); |
|
95 | + $default_creator_id = apply_filters('FHEE__EE_DMS_Core_4_5_0__get_default_creator_id', get_current_user_id()); |
|
96 | 96 | $price_type_table = $wpdb->prefix."esp_price_type"; |
97 | 97 | $price_table = $wpdb->prefix."esp_price"; |
98 | - if ( $this->_get_table_analysis()->tableExists( $price_type_table ) ) { |
|
98 | + if ($this->_get_table_analysis()->tableExists($price_type_table)) { |
|
99 | 99 | |
100 | - $SQL = 'SELECT COUNT(PRT_ID) FROM ' . $price_type_table . ' WHERE PBT_ID=4';//include trashed price types |
|
101 | - $tax_price_type_count = $wpdb->get_var( $SQL ); |
|
102 | - if ( $tax_price_type_count <= 1 ) { |
|
100 | + $SQL = 'SELECT COUNT(PRT_ID) FROM '.$price_type_table.' WHERE PBT_ID=4'; //include trashed price types |
|
101 | + $tax_price_type_count = $wpdb->get_var($SQL); |
|
102 | + if ($tax_price_type_count <= 1) { |
|
103 | 103 | $wpdb->insert( |
104 | 104 | $price_type_table, |
105 | 105 | array( |
106 | - 'PRT_name' => __( "Regional Tax", "event_espresso" ), |
|
106 | + 'PRT_name' => __("Regional Tax", "event_espresso"), |
|
107 | 107 | 'PBT_ID' => 4, |
108 | 108 | 'PRT_is_percent' => true, |
109 | 109 | 'PRT_order' => 60, |
@@ -111,11 +111,11 @@ discard block |
||
111 | 111 | 'PRT_wp_user' => $default_creator_id, |
112 | 112 | ), |
113 | 113 | array( |
114 | - '%s',//PRT_name |
|
115 | - '%d',//PBT_id |
|
116 | - '%d',//PRT_is_percent |
|
117 | - '%d',//PRT_order |
|
118 | - '%d',//PRT_deleted |
|
114 | + '%s', //PRT_name |
|
115 | + '%d', //PBT_id |
|
116 | + '%d', //PRT_is_percent |
|
117 | + '%d', //PRT_order |
|
118 | + '%d', //PRT_deleted |
|
119 | 119 | '%d', //PRT_wp_user |
120 | 120 | ) |
121 | 121 | ); |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | $result = $wpdb->insert( |
124 | 124 | $price_type_table, |
125 | 125 | array( |
126 | - 'PRT_name' => __( "Federal Tax", "event_espresso" ), |
|
126 | + 'PRT_name' => __("Federal Tax", "event_espresso"), |
|
127 | 127 | 'PBT_ID' => 4, |
128 | 128 | 'PRT_is_percent' => true, |
129 | 129 | 'PRT_order' => 70, |
@@ -131,21 +131,21 @@ discard block |
||
131 | 131 | 'PRT_wp_user' => $default_creator_id, |
132 | 132 | ), |
133 | 133 | array( |
134 | - '%s',//PRT_name |
|
135 | - '%d',//PBT_id |
|
136 | - '%d',//PRT_is_percent |
|
137 | - '%d',//PRT_order |
|
138 | - '%d',//PRT_deleted |
|
134 | + '%s', //PRT_name |
|
135 | + '%d', //PBT_id |
|
136 | + '%d', //PRT_is_percent |
|
137 | + '%d', //PRT_order |
|
138 | + '%d', //PRT_deleted |
|
139 | 139 | '%d' //PRT_wp_user |
140 | 140 | ) |
141 | 141 | ); |
142 | - if ( $result ) { |
|
142 | + if ($result) { |
|
143 | 143 | $wpdb->insert( |
144 | 144 | $price_table, |
145 | 145 | array( |
146 | 146 | 'PRT_ID' => $wpdb->insert_id, |
147 | 147 | 'PRC_amount' => 15.00, |
148 | - 'PRC_name' => __( "Sales Tax", "event_espresso" ), |
|
148 | + 'PRC_name' => __("Sales Tax", "event_espresso"), |
|
149 | 149 | 'PRC_desc' => '', |
150 | 150 | 'PRC_is_default' => true, |
151 | 151 | 'PRC_overrides' => null, |
@@ -155,15 +155,15 @@ discard block |
||
155 | 155 | 'PRC_wp_user' => $default_creator_id, |
156 | 156 | ), |
157 | 157 | array( |
158 | - '%d',//PRT_id |
|
159 | - '%f',//PRC_amount |
|
160 | - '%s',//PRC_name |
|
161 | - '%s',//PRC_desc |
|
162 | - '%d',//PRC_is_default |
|
163 | - '%d',//PRC_overrides |
|
164 | - '%d',//PRC_deleted |
|
165 | - '%d',//PRC_order |
|
166 | - '%d',//PRC_parent |
|
158 | + '%d', //PRT_id |
|
159 | + '%f', //PRC_amount |
|
160 | + '%s', //PRC_name |
|
161 | + '%s', //PRC_desc |
|
162 | + '%d', //PRC_is_default |
|
163 | + '%d', //PRC_overrides |
|
164 | + '%d', //PRC_deleted |
|
165 | + '%d', //PRC_order |
|
166 | + '%d', //PRC_parent |
|
167 | 167 | '%d' //PRC_wp_user |
168 | 168 | ) |
169 | 169 | ); |
@@ -181,11 +181,11 @@ discard block |
||
181 | 181 | * @param array $modules_to_register |
182 | 182 | * @return array |
183 | 183 | */ |
184 | - public function caffeinated_modules_to_register( $modules_to_register = array() ) { |
|
185 | - if ( is_readable( EE_CAFF_PATH . 'modules' ) ) { |
|
186 | - $caffeinated_modules_to_register = glob( EE_CAFF_PATH . 'modules' . DS . '*', GLOB_ONLYDIR ); |
|
187 | - if ( is_array( $caffeinated_modules_to_register ) && ! empty( $caffeinated_modules_to_register ) ) { |
|
188 | - $modules_to_register = array_merge( $modules_to_register, $caffeinated_modules_to_register ); |
|
184 | + public function caffeinated_modules_to_register($modules_to_register = array()) { |
|
185 | + if (is_readable(EE_CAFF_PATH.'modules')) { |
|
186 | + $caffeinated_modules_to_register = glob(EE_CAFF_PATH.'modules'.DS.'*', GLOB_ONLYDIR); |
|
187 | + if (is_array($caffeinated_modules_to_register) && ! empty($caffeinated_modules_to_register)) { |
|
188 | + $modules_to_register = array_merge($modules_to_register, $caffeinated_modules_to_register); |
|
189 | 189 | } |
190 | 190 | } |
191 | 191 | return $modules_to_register; |
@@ -195,12 +195,12 @@ discard block |
||
195 | 195 | |
196 | 196 | public function caffeinated_init() { |
197 | 197 | // EE_Register_CPTs hooks |
198 | - add_filter( 'FHEE__EE_Register_CPTs__get_taxonomies__taxonomies', array( $this, 'filter_taxonomies' ), 10 ); |
|
199 | - add_filter( 'FHEE__EE_Register_CPTs__get_CPTs__cpts', array( $this, 'filter_cpts' ), 10 ); |
|
200 | - add_filter( 'FHEE__EE_Admin__get_extra_nav_menu_pages_items', array( $this, 'nav_metabox_items' ), 10 ); |
|
201 | - EE_Registry::instance()->load_file( EE_CAFF_PATH, 'EE_Caf_Messages', 'class', array(), false ); |
|
198 | + add_filter('FHEE__EE_Register_CPTs__get_taxonomies__taxonomies', array($this, 'filter_taxonomies'), 10); |
|
199 | + add_filter('FHEE__EE_Register_CPTs__get_CPTs__cpts', array($this, 'filter_cpts'), 10); |
|
200 | + add_filter('FHEE__EE_Admin__get_extra_nav_menu_pages_items', array($this, 'nav_metabox_items'), 10); |
|
201 | + EE_Registry::instance()->load_file(EE_CAFF_PATH, 'EE_Caf_Messages', 'class', array(), false); |
|
202 | 202 | // caffeinated_init__complete hook |
203 | - do_action( 'AHEE__EE_Brewing_Regular__caffeinated_init__complete' ); |
|
203 | + do_action('AHEE__EE_Brewing_Regular__caffeinated_init__complete'); |
|
204 | 204 | } |
205 | 205 | |
206 | 206 | |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | * @param array $taxonomy_array |
218 | 218 | * @return array |
219 | 219 | */ |
220 | - public function filter_taxonomies( array $taxonomy_array ) { |
|
220 | + public function filter_taxonomies(array $taxonomy_array) { |
|
221 | 221 | $taxonomy_array['espresso_venue_categories']['args']['show_in_nav_menus'] = true; |
222 | 222 | return $taxonomy_array; |
223 | 223 | } |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | * @param array $cpt_array |
229 | 229 | * @return mixed |
230 | 230 | */ |
231 | - public function filter_cpts( array $cpt_array ) { |
|
231 | + public function filter_cpts(array $cpt_array) { |
|
232 | 232 | $cpt_array['espresso_venues']['args']['show_in_nav_menus'] = true; |
233 | 233 | return $cpt_array; |
234 | 234 | } |
@@ -239,11 +239,11 @@ discard block |
||
239 | 239 | * @param array $menuitems |
240 | 240 | * @return array |
241 | 241 | */ |
242 | - public function nav_metabox_items( array $menuitems ) { |
|
242 | + public function nav_metabox_items(array $menuitems) { |
|
243 | 243 | $menuitems[] = array( |
244 | - 'title' => __( 'Venue List', 'event_espresso' ), |
|
245 | - 'url' => get_post_type_archive_link( 'espresso_venues' ), |
|
246 | - 'description' => __( 'Archive page for all venues.', 'event_espresso' ), |
|
244 | + 'title' => __('Venue List', 'event_espresso'), |
|
245 | + 'url' => get_post_type_archive_link('espresso_venues'), |
|
246 | + 'description' => __('Archive page for all venues.', 'event_espresso'), |
|
247 | 247 | ); |
248 | 248 | return $menuitems; |
249 | 249 | } |
@@ -256,9 +256,9 @@ discard block |
||
256 | 256 | * @param array $payment_method_paths |
257 | 257 | * @return array values are folder paths to payment method folders |
258 | 258 | */ |
259 | - public function caf_payment_methods( $payment_method_paths ) { |
|
260 | - $caf_payment_methods_paths = glob( EE_CAF_PAYMENT_METHODS . '*', GLOB_ONLYDIR ); |
|
261 | - $payment_method_paths = array_merge( $payment_method_paths, $caf_payment_methods_paths ); |
|
259 | + public function caf_payment_methods($payment_method_paths) { |
|
260 | + $caf_payment_methods_paths = glob(EE_CAF_PAYMENT_METHODS.'*', GLOB_ONLYDIR); |
|
261 | + $payment_method_paths = array_merge($payment_method_paths, $caf_payment_methods_paths); |
|
262 | 262 | return $payment_method_paths; |
263 | 263 | } |
264 | 264 | /** |
@@ -267,18 +267,18 @@ discard block |
||
267 | 267 | * @throws \EE_Error |
268 | 268 | */ |
269 | 269 | protected function _get_table_analysis() { |
270 | - if( $this->_table_analysis instanceof TableAnalysis ) { |
|
270 | + if ($this->_table_analysis instanceof TableAnalysis) { |
|
271 | 271 | return $this->_table_analysis; |
272 | 272 | } else { |
273 | 273 | throw new \EE_Error( |
274 | 274 | sprintf( |
275 | - __( 'Table analysis class on class %1$s is not set properly.', 'event_espresso'), |
|
276 | - get_class( $this ) |
|
275 | + __('Table analysis class on class %1$s is not set properly.', 'event_espresso'), |
|
276 | + get_class($this) |
|
277 | 277 | ) |
278 | 278 | ); |
279 | 279 | } |
280 | 280 | } |
281 | 281 | } |
282 | 282 | $brewing = new EE_Brewing_Regular( |
283 | - EE_Registry::instance()->create( 'TableAnalysis', array(), true ) |
|
283 | + EE_Registry::instance()->create('TableAnalysis', array(), true) |
|
284 | 284 | ); |
@@ -43,23 +43,23 @@ discard block |
||
43 | 43 | '4.9.12', |
44 | 44 | '5.0.0' |
45 | 45 | ); |
46 | - if ( $this->registration = EE_Registry::instance()->load_model( 'Registration' )->get_registration_for_reg_url_link( $url_link)) { |
|
46 | + if ($this->registration = EE_Registry::instance()->load_model('Registration')->get_registration_for_reg_url_link($url_link)) { |
|
47 | 47 | $this->transaction = $this->registration->transaction(); |
48 | 48 | |
49 | - $payment_settings = EE_Config::instance()->gateway->payment_settings;//get_user_meta(EE_Registry::instance()->CFG->wp_user, 'payment_settings', TRUE); |
|
50 | - $this->invoice_payment_method = EEM_Payment_Method::instance()->get_one_of_type( 'Invoice' ); |
|
49 | + $payment_settings = EE_Config::instance()->gateway->payment_settings; //get_user_meta(EE_Registry::instance()->CFG->wp_user, 'payment_settings', TRUE); |
|
50 | + $this->invoice_payment_method = EEM_Payment_Method::instance()->get_one_of_type('Invoice'); |
|
51 | 51 | } else { |
52 | - EE_Error::add_error( __( 'Your request appears to be missing some required data, and no information for your transaction could be retrieved.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
52 | + EE_Error::add_error(__('Your request appears to be missing some required data, and no information for your transaction could be retrieved.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | } |
56 | 56 | |
57 | - public function send_invoice( $download = FALSE ) { |
|
57 | + public function send_invoice($download = FALSE) { |
|
58 | 58 | $template_args = array(); |
59 | 59 | $EE = EE_Registry::instance(); |
60 | 60 | |
61 | 61 | //allow the request to override the default theme defined in the invoice settings |
62 | - $theme_requested = ( isset( $_REQUEST['theme'] ) && $_REQUEST['theme'] > 0 && $_REQUEST['theme'] < 8 ) ? absint( $_REQUEST['theme'] ) : null; |
|
62 | + $theme_requested = (isset($_REQUEST['theme']) && $_REQUEST['theme'] > 0 && $_REQUEST['theme'] < 8) ? absint($_REQUEST['theme']) : null; |
|
63 | 63 | $themes = array( |
64 | 64 | 1 => "simple.css", |
65 | 65 | 2 => "bauhaus.css", |
@@ -70,26 +70,26 @@ discard block |
||
70 | 70 | 7 => "union.css" |
71 | 71 | ); |
72 | 72 | //Get the CSS file |
73 | - if( isset( $themes[ $theme_requested ] ) ) { |
|
74 | - $template_args['invoice_css'] = $themes[ $theme_requested ]; |
|
75 | - }else{ |
|
76 | - $template_args['invoice_css'] = $this->invoice_payment_method->get_extra_meta( 'legacy_invoice_css', TRUE, 'simple.css' ); |
|
73 | + if (isset($themes[$theme_requested])) { |
|
74 | + $template_args['invoice_css'] = $themes[$theme_requested]; |
|
75 | + } else { |
|
76 | + $template_args['invoice_css'] = $this->invoice_payment_method->get_extra_meta('legacy_invoice_css', TRUE, 'simple.css'); |
|
77 | 77 | } |
78 | 78 | |
79 | - if (is_dir(EVENT_ESPRESSO_GATEWAY_DIR . '/invoice')) { |
|
80 | - $template_args['base_url'] = EVENT_ESPRESSO_GATEWAY_URL . 'Invoice/lib/templates/'; |
|
79 | + if (is_dir(EVENT_ESPRESSO_GATEWAY_DIR.'/invoice')) { |
|
80 | + $template_args['base_url'] = EVENT_ESPRESSO_GATEWAY_URL.'Invoice/lib/templates/'; |
|
81 | 81 | } else { |
82 | - $template_args['base_url'] = EE_GATEWAYS . '/Invoice/lib/templates/'; |
|
82 | + $template_args['base_url'] = EE_GATEWAYS.'/Invoice/lib/templates/'; |
|
83 | 83 | } |
84 | 84 | $primary_attendee = $this->transaction->primary_registration()->attendee(); |
85 | 85 | |
86 | - $template_args['organization'] = $EE->CFG->organization->get_pretty( 'name' ); |
|
87 | - $template_args['street'] = empty( $EE->CFG->organization->address_2 ) ? $EE->CFG->organization->get_pretty( 'address_1' ) : $EE->CFG->organization->get_pretty( 'address_1' ) . '<br>' . $EE->CFG->organization->get_pretty( 'address_2' ); |
|
88 | - $template_args['city'] = $EE->CFG->organization->get_pretty( 'city' ); |
|
89 | - $template_args['state'] = EE_Registry::instance()->load_model( 'State' )->get_one_by_ID( $EE->CFG->organization->STA_ID ); |
|
90 | - $template_args['country'] = EE_Registry::instance()->load_model( 'Country' )->get_one_by_ID( $EE->CFG->organization->CNT_ISO ); |
|
91 | - $template_args['zip'] = $EE->CFG->organization->get_pretty( 'zip' ); |
|
92 | - $template_args['email'] = $EE->CFG->organization->get_pretty( 'email' ); |
|
86 | + $template_args['organization'] = $EE->CFG->organization->get_pretty('name'); |
|
87 | + $template_args['street'] = empty($EE->CFG->organization->address_2) ? $EE->CFG->organization->get_pretty('address_1') : $EE->CFG->organization->get_pretty('address_1').'<br>'.$EE->CFG->organization->get_pretty('address_2'); |
|
88 | + $template_args['city'] = $EE->CFG->organization->get_pretty('city'); |
|
89 | + $template_args['state'] = EE_Registry::instance()->load_model('State')->get_one_by_ID($EE->CFG->organization->STA_ID); |
|
90 | + $template_args['country'] = EE_Registry::instance()->load_model('Country')->get_one_by_ID($EE->CFG->organization->CNT_ISO); |
|
91 | + $template_args['zip'] = $EE->CFG->organization->get_pretty('zip'); |
|
92 | + $template_args['email'] = $EE->CFG->organization->get_pretty('email'); |
|
93 | 93 | |
94 | 94 | $template_args['registration_code'] = $this->registration->reg_code(); |
95 | 95 | $template_args['registration_date'] = $this->registration->date(); |
@@ -98,9 +98,9 @@ discard block |
||
98 | 98 | $template_args['attendee_address2'] = $primary_attendee->address2(); |
99 | 99 | $template_args['attendee_city'] = $primary_attendee->city(); |
100 | 100 | $attendee_state = $primary_attendee->state_obj(); |
101 | - if($attendee_state){ |
|
101 | + if ($attendee_state) { |
|
102 | 102 | $attendee_state_name = $attendee_state->name(); |
103 | - }else{ |
|
103 | + } else { |
|
104 | 104 | $attendee_state_name = ''; |
105 | 105 | } |
106 | 106 | $template_args['attendee_state'] = $attendee_state_name; |
@@ -124,9 +124,9 @@ discard block |
||
124 | 124 | if ($template_args['amount_pd'] != $template_args['total_cost']) { |
125 | 125 | //$template_args['net_total'] = $this->espressoInvoiceTotals( __('SubTotal', 'event_espresso'), $this->transaction->total());//$this->session_data['cart']['REG']['sub_total']); |
126 | 126 | $tax_items = $this->transaction->tax_items(); |
127 | - if(!empty($tax_items) ){ |
|
127 | + if ( ! empty($tax_items)) { |
|
128 | 128 | foreach ($tax_items as $tax) { |
129 | - $template_args['net_total'] .= $this->espressoInvoiceTotals( $tax->name(), $tax->total()); |
|
129 | + $template_args['net_total'] .= $this->espressoInvoiceTotals($tax->name(), $tax->total()); |
|
130 | 130 | } |
131 | 131 | } |
132 | 132 | |
@@ -136,30 +136,30 @@ discard block |
||
136 | 136 | } else { |
137 | 137 | $text = __('Extra', 'event_espresso'); |
138 | 138 | } |
139 | - $template_args['discount'] = $this->espressoInvoiceTotals( $text, $difference ); |
|
139 | + $template_args['discount'] = $this->espressoInvoiceTotals($text, $difference); |
|
140 | 140 | } |
141 | 141 | |
142 | 142 | $template_args['currency_symbol'] = $EE->CFG->currency->sign; |
143 | - $template_args['template_payment_instructions'] = wpautop(stripslashes_deep(html_entity_decode($this->invoice_payment_method->get_extra_meta( 'pdf_instructions', TRUE ), ENT_QUOTES))); |
|
144 | - $template_args['shameless_plug'] = apply_filters( 'FHEE_Invoice__send_invoice__shameless_plug',true ); |
|
145 | - if(isset($_GET['receipt'])){ |
|
143 | + $template_args['template_payment_instructions'] = wpautop(stripslashes_deep(html_entity_decode($this->invoice_payment_method->get_extra_meta('pdf_instructions', TRUE), ENT_QUOTES))); |
|
144 | + $template_args['shameless_plug'] = apply_filters('FHEE_Invoice__send_invoice__shameless_plug', true); |
|
145 | + if (isset($_GET['receipt'])) { |
|
146 | 146 | //receipt-specific stuff |
147 | 147 | $events_for_txn = EEM_Event::instance()->get_all(array(array('Registration.TXN_ID'=>$this->transaction->ID()))); |
148 | 148 | $ticket_line_items_per_event = array(); |
149 | 149 | $registrations_per_line_item = array(); |
150 | 150 | $venues_for_events = array(); |
151 | - foreach($events_for_txn as $event_id => $event){ |
|
152 | - $line_items_for_this_event = EEM_Line_Item::instance()->get_all(array(array('Ticket.Datetime.EVT_ID'=>$event_id,'TXN_ID'=>$this->transaction->ID()))); |
|
151 | + foreach ($events_for_txn as $event_id => $event) { |
|
152 | + $line_items_for_this_event = EEM_Line_Item::instance()->get_all(array(array('Ticket.Datetime.EVT_ID'=>$event_id, 'TXN_ID'=>$this->transaction->ID()))); |
|
153 | 153 | $ticket_line_items_per_event[$event_id] = $line_items_for_this_event; |
154 | - foreach($line_items_for_this_event as $line_item_id => $line_item){ |
|
154 | + foreach ($line_items_for_this_event as $line_item_id => $line_item) { |
|
155 | 155 | $ticket = $line_item->ticket(); |
156 | - $registrations_for_this_ticket = EEM_Registration::instance()->get_all(array(array('TKT_ID'=>$ticket->ID(),'TXN_ID'=>$this->transaction->ID()))); |
|
156 | + $registrations_for_this_ticket = EEM_Registration::instance()->get_all(array(array('TKT_ID'=>$ticket->ID(), 'TXN_ID'=>$this->transaction->ID()))); |
|
157 | 157 | $registrations_per_line_item[$line_item_id] = $registrations_for_this_ticket; |
158 | 158 | } |
159 | 159 | $venues_for_events = array_merge($venues_for_events, $event->venues()); |
160 | 160 | } |
161 | - $tax_total_line_item = EEM_Line_Item::instance()->get_one(array(array('TXN_ID'=>$this->transaction->ID(),'LIN_type'=> EEM_Line_Item::type_tax_sub_total))); |
|
162 | - $questions_to_skip = array(EEM_Attendee::system_question_fname,EEM_Attendee::system_question_lname, EEM_Attendee::system_question_email); |
|
161 | + $tax_total_line_item = EEM_Line_Item::instance()->get_one(array(array('TXN_ID'=>$this->transaction->ID(), 'LIN_type'=> EEM_Line_Item::type_tax_sub_total))); |
|
162 | + $questions_to_skip = array(EEM_Attendee::system_question_fname, EEM_Attendee::system_question_lname, EEM_Attendee::system_question_email); |
|
163 | 163 | |
164 | 164 | |
165 | 165 | $template_args['events_for_txn'] = $events_for_txn; |
@@ -170,53 +170,53 @@ discard block |
||
170 | 170 | $template_args['questions_to_skip'] = $questions_to_skip; |
171 | 171 | // d($template_args); |
172 | 172 | $template_args['download_link'] = $this->registration->receipt_url('download'); |
173 | - }else{ |
|
173 | + } else { |
|
174 | 174 | //it's just an invoice we're accessing |
175 | 175 | $template_args['download_link'] = $this->registration->invoice_url('download'); |
176 | 176 | } |
177 | 177 | |
178 | 178 | //Get the HTML as an object |
179 | 179 | $templates_relative_path = 'modules/gateways/Invoice/lib/templates/'; |
180 | - $template_header = EEH_Template::locate_template( $templates_relative_path . 'invoice_header.template.php', $template_args, TRUE, TRUE ); |
|
181 | - if(isset($_GET['receipt'])){ |
|
182 | - $template_body = EEH_Template::locate_template( $templates_relative_path . 'receipt_body.template.php', $template_args, TRUE, TRUE ); |
|
183 | - }else{ |
|
184 | - $template_body = EEH_Template::locate_template( $templates_relative_path . 'invoice_body.template.php', $template_args, TRUE, TRUE ); |
|
180 | + $template_header = EEH_Template::locate_template($templates_relative_path.'invoice_header.template.php', $template_args, TRUE, TRUE); |
|
181 | + if (isset($_GET['receipt'])) { |
|
182 | + $template_body = EEH_Template::locate_template($templates_relative_path.'receipt_body.template.php', $template_args, TRUE, TRUE); |
|
183 | + } else { |
|
184 | + $template_body = EEH_Template::locate_template($templates_relative_path.'invoice_body.template.php', $template_args, TRUE, TRUE); |
|
185 | 185 | } |
186 | 186 | |
187 | 187 | |
188 | - $template_footer = EEH_Template::locate_template( $templates_relative_path . 'invoice_footer.template.php', $template_args, TRUE, TRUE ); |
|
188 | + $template_footer = EEH_Template::locate_template($templates_relative_path.'invoice_footer.template.php', $template_args, TRUE, TRUE); |
|
189 | 189 | |
190 | - $copies = ! empty( $_REQUEST['copies'] ) ? $_REQUEST['copies'] : 1; |
|
190 | + $copies = ! empty($_REQUEST['copies']) ? $_REQUEST['copies'] : 1; |
|
191 | 191 | |
192 | 192 | $content = $this->espresso_replace_invoice_shortcodes($template_header); |
193 | - for( $x = 1; $x <= $copies; $x++ ) { |
|
193 | + for ($x = 1; $x <= $copies; $x++) { |
|
194 | 194 | $content .= $this->espresso_replace_invoice_shortcodes($template_body); |
195 | 195 | } |
196 | 196 | $content .= $this->espresso_replace_invoice_shortcodes($template_footer); |
197 | 197 | |
198 | 198 | //Check if debugging or mobile is set |
199 | - if (!empty($_REQUEST['html'])) { |
|
199 | + if ( ! empty($_REQUEST['html'])) { |
|
200 | 200 | echo $content; |
201 | 201 | exit(0); |
202 | 202 | } |
203 | - $invoice_name = $template_args['organization'] . ' ' . __('Invoice #', 'event_espresso') . $template_args['registration_code'] . __(' for ', 'event_espresso') . $template_args['name']; |
|
204 | - $invoice_name = str_replace( ' ', '_', $invoice_name ); |
|
203 | + $invoice_name = $template_args['organization'].' '.__('Invoice #', 'event_espresso').$template_args['registration_code'].__(' for ', 'event_espresso').$template_args['name']; |
|
204 | + $invoice_name = str_replace(' ', '_', $invoice_name); |
|
205 | 205 | //Create the PDF |
206 | - if(array_key_exists('html',$_GET)){ |
|
206 | + if (array_key_exists('html', $_GET)) { |
|
207 | 207 | echo $content; |
208 | - }else{ |
|
208 | + } else { |
|
209 | 209 | //only load dompdf if nobody else has yet... |
210 | - if( ! defined('DOMPDF_DIR')){ |
|
210 | + if ( ! defined('DOMPDF_DIR')) { |
|
211 | 211 | define('DOMPDF_ENABLE_REMOTE', TRUE); |
212 | 212 | define('DOMPDF_ENABLE_JAVASCRIPT', FALSE); |
213 | 213 | define('DOMPDF_ENABLE_CSS_FLOAT', TRUE); |
214 | - require_once(EE_THIRD_PARTY . 'dompdf/dompdf_config.inc.php'); |
|
214 | + require_once(EE_THIRD_PARTY.'dompdf/dompdf_config.inc.php'); |
|
215 | 215 | } |
216 | 216 | $dompdf = new DOMPDF(); |
217 | 217 | $dompdf->load_html($content); |
218 | 218 | $dompdf->render(); |
219 | - $dompdf->stream($invoice_name . ".pdf", array( 'Attachment' => $download )); |
|
219 | + $dompdf->stream($invoice_name.".pdf", array('Attachment' => $download)); |
|
220 | 220 | } |
221 | 221 | exit(0); |
222 | 222 | } |
@@ -226,12 +226,12 @@ discard block |
||
226 | 226 | * @param EE_Line_Item $line_item |
227 | 227 | * @return boolean |
228 | 228 | */ |
229 | - function check_if_any_line_items_have_a_description(EE_Line_Item $line_item){ |
|
230 | - if($line_item->desc()){ |
|
229 | + function check_if_any_line_items_have_a_description(EE_Line_Item $line_item) { |
|
230 | + if ($line_item->desc()) { |
|
231 | 231 | return true; |
232 | - }else{ |
|
233 | - foreach($line_item->children() as $child_line_item){ |
|
234 | - if($this->check_if_any_line_items_have_a_description($child_line_item)){ |
|
232 | + } else { |
|
233 | + foreach ($line_item->children() as $child_line_item) { |
|
234 | + if ($this->check_if_any_line_items_have_a_description($child_line_item)) { |
|
235 | 235 | return true; |
236 | 236 | } |
237 | 237 | } |
@@ -241,14 +241,14 @@ discard block |
||
241 | 241 | } |
242 | 242 | |
243 | 243 | //Perform the shortcode replacement |
244 | - function espresso_replace_invoice_shortcodes( $content ) { |
|
244 | + function espresso_replace_invoice_shortcodes($content) { |
|
245 | 245 | |
246 | 246 | $EE = EE_Registry::instance(); |
247 | 247 | //Create the logo |
248 | - $invoice_logo_url = $this->invoice_payment_method->get_extra_meta('pdf_logo_image', TRUE, $EE->CFG->organization->logo_url ); |
|
249 | - if (!empty($invoice_logo_url)) { |
|
248 | + $invoice_logo_url = $this->invoice_payment_method->get_extra_meta('pdf_logo_image', TRUE, $EE->CFG->organization->logo_url); |
|
249 | + if ( ! empty($invoice_logo_url)) { |
|
250 | 250 | $image_size = getimagesize($invoice_logo_url); |
251 | - $invoice_logo_image = '<img class="logo screen" src="' . $invoice_logo_url . '" ' . $image_size[3] . ' alt="logo" /> '; |
|
251 | + $invoice_logo_image = '<img class="logo screen" src="'.$invoice_logo_url.'" '.$image_size[3].' alt="logo" /> '; |
|
252 | 252 | } else { |
253 | 253 | $invoice_logo_image = ''; |
254 | 254 | } |
@@ -270,28 +270,28 @@ discard block |
||
270 | 270 | "[instructions]", |
271 | 271 | ); |
272 | 272 | $primary_attendee = $this->transaction->primary_registration()->attendee(); |
273 | - $org_state = EE_Registry::instance()->load_model( 'State' )->get_one_by_ID( $EE->CFG->organization->STA_ID ); |
|
274 | - if($org_state){ |
|
273 | + $org_state = EE_Registry::instance()->load_model('State')->get_one_by_ID($EE->CFG->organization->STA_ID); |
|
274 | + if ($org_state) { |
|
275 | 275 | $org_state_name = $org_state->name(); |
276 | - }else{ |
|
276 | + } else { |
|
277 | 277 | $org_state_name = ''; |
278 | 278 | } |
279 | 279 | $ReplaceValues = array( |
280 | - $EE->CFG->organization->get_pretty( 'name' ), |
|
280 | + $EE->CFG->organization->get_pretty('name'), |
|
281 | 281 | $this->registration->reg_code(), |
282 | 282 | $this->transaction->ID(), |
283 | 283 | $primary_attendee->full_name(), |
284 | - (is_dir(EVENT_ESPRESSO_GATEWAY_DIR . '/invoice')) ? EVENT_ESPRESSO_GATEWAY_URL . 'Invoice/lib/templates/' : EE_GATEWAYS_URL . 'Invoice/lib/templates/', |
|
285 | - $this->registration->invoice_url(),//home_url() . '/?download_invoice=true&id=' . $this->registration->reg_url_link(), |
|
284 | + (is_dir(EVENT_ESPRESSO_GATEWAY_DIR.'/invoice')) ? EVENT_ESPRESSO_GATEWAY_URL.'Invoice/lib/templates/' : EE_GATEWAYS_URL.'Invoice/lib/templates/', |
|
285 | + $this->registration->invoice_url(), //home_url() . '/?download_invoice=true&id=' . $this->registration->reg_url_link(), |
|
286 | 286 | $invoice_logo_image, |
287 | - empty( $EE->CFG->organization->address_2 ) ? $EE->CFG->organization->get_pretty( 'address_1' ) : $EE->CFG->organization->get_pretty( 'address_1' ) . '<br>' . $EE->CFG->organization->get_pretty( 'address_2' ), |
|
288 | - $EE->CFG->organization->get_pretty( 'city' ), |
|
287 | + empty($EE->CFG->organization->address_2) ? $EE->CFG->organization->get_pretty('address_1') : $EE->CFG->organization->get_pretty('address_1').'<br>'.$EE->CFG->organization->get_pretty('address_2'), |
|
288 | + $EE->CFG->organization->get_pretty('city'), |
|
289 | 289 | $org_state_name, |
290 | - $EE->CFG->organization->get_pretty( 'zip' ), |
|
291 | - $EE->CFG->organization->get_pretty( 'email' ), |
|
290 | + $EE->CFG->organization->get_pretty('zip'), |
|
291 | + $EE->CFG->organization->get_pretty('email'), |
|
292 | 292 | $EE->CFG->organization->vat, |
293 | - $this->registration->get_i18n_datetime( 'REG_date', get_option( 'date_format' ) ), |
|
294 | - $this->invoice_payment_method->get_extra_meta( 'pdf_instructions', TRUE ), |
|
293 | + $this->registration->get_i18n_datetime('REG_date', get_option('date_format')), |
|
294 | + $this->invoice_payment_method->get_extra_meta('pdf_instructions', TRUE), |
|
295 | 295 | ); |
296 | 296 | |
297 | 297 | return str_replace($SearchValues, $ReplaceValues, $content); |
@@ -314,12 +314,12 @@ discard block |
||
314 | 314 | if ($total_cost < 0) { |
315 | 315 | $total_cost = (-1) * $total_cost; |
316 | 316 | } |
317 | - $find = array( ' ' ); |
|
318 | - $replace = array( '-' ); |
|
319 | - $row_id = strtolower( str_replace( $find, $replace, $text )); |
|
317 | + $find = array(' '); |
|
318 | + $replace = array('-'); |
|
319 | + $row_id = strtolower(str_replace($find, $replace, $text)); |
|
320 | 320 | $html .= '<tr id="'.$row_id.'-tr"><td colspan="4"> </td>'; |
321 | - $html .= '<td class="item_r">' . $text . '</td>'; |
|
322 | - $html .= '<td class="item_r">' . $total_cost . '</td>'; |
|
321 | + $html .= '<td class="item_r">'.$text.'</td>'; |
|
322 | + $html .= '<td class="item_r">'.$total_cost.'</td>'; |
|
323 | 323 | $html .= '</tr>'; |
324 | 324 | return $html; |
325 | 325 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
3 | - exit( 'No direct script access allowed' ); |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | + exit('No direct script access allowed'); |
|
4 | 4 | } |
5 | 5 | |
6 | 6 | |
@@ -75,11 +75,11 @@ discard block |
||
75 | 75 | * @param \EE_Request $request |
76 | 76 | * @param \EE_Response $response |
77 | 77 | */ |
78 | - protected function __construct( EE_Request $request, EE_Response $response ) { |
|
78 | + protected function __construct(EE_Request $request, EE_Response $response) { |
|
79 | 79 | $this->_request = $request; |
80 | 80 | $this->_response = $response; |
81 | - add_action( 'EE_Load_Espresso_Core__handle_request__initialize_core_loading', array( $this, 'initialize' ) ); |
|
82 | - do_action( 'EE_Dependency_Map____construct' ); |
|
81 | + add_action('EE_Load_Espresso_Core__handle_request__initialize_core_loading', array($this, 'initialize')); |
|
82 | + do_action('EE_Dependency_Map____construct'); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | |
@@ -101,10 +101,10 @@ discard block |
||
101 | 101 | * @param \EE_Response $response |
102 | 102 | * @return \EE_Dependency_Map instance |
103 | 103 | */ |
104 | - public static function instance( EE_Request $request = null, EE_Response $response = null ) { |
|
104 | + public static function instance(EE_Request $request = null, EE_Response $response = null) { |
|
105 | 105 | // check if class object is instantiated, and instantiated properly |
106 | - if ( ! self::$_instance instanceof EE_Dependency_Map ) { |
|
107 | - self::$_instance = new EE_Dependency_Map( $request, $response ); |
|
106 | + if ( ! self::$_instance instanceof EE_Dependency_Map) { |
|
107 | + self::$_instance = new EE_Dependency_Map($request, $response); |
|
108 | 108 | } |
109 | 109 | return self::$_instance; |
110 | 110 | } |
@@ -116,16 +116,16 @@ discard block |
||
116 | 116 | * @param array $dependencies |
117 | 117 | * @return boolean |
118 | 118 | */ |
119 | - public static function register_dependencies( $class, $dependencies ) { |
|
120 | - if ( ! isset( self::$_instance->_dependency_map[ $class ] ) ) { |
|
119 | + public static function register_dependencies($class, $dependencies) { |
|
120 | + if ( ! isset(self::$_instance->_dependency_map[$class])) { |
|
121 | 121 | // we need to make sure that any aliases used when registering a dependency |
122 | 122 | // get resolved to the correct class name |
123 | - foreach ( (array) $dependencies as $dependency => $load_source ) { |
|
124 | - $alias = self::$_instance->get_alias( $dependency ); |
|
125 | - unset( $dependencies[ $dependency ] ); |
|
126 | - $dependencies[ $alias ] = $load_source; |
|
123 | + foreach ((array) $dependencies as $dependency => $load_source) { |
|
124 | + $alias = self::$_instance->get_alias($dependency); |
|
125 | + unset($dependencies[$dependency]); |
|
126 | + $dependencies[$alias] = $load_source; |
|
127 | 127 | } |
128 | - self::$_instance->_dependency_map[ $class ] = (array) $dependencies; |
|
128 | + self::$_instance->_dependency_map[$class] = (array) $dependencies; |
|
129 | 129 | return true; |
130 | 130 | } |
131 | 131 | return false; |
@@ -139,19 +139,19 @@ discard block |
||
139 | 139 | * @return bool |
140 | 140 | * @throws \EE_Error |
141 | 141 | */ |
142 | - public static function register_class_loader( $class_name, $loader = 'load_core' ) { |
|
142 | + public static function register_class_loader($class_name, $loader = 'load_core') { |
|
143 | 143 | // check that loader method starts with "load_" and exists in EE_Registry |
144 | - if ( strpos( $loader, 'load_' ) !== 0 || ! method_exists( 'EE_Registry', $loader ) ) { |
|
144 | + if (strpos($loader, 'load_') !== 0 || ! method_exists('EE_Registry', $loader)) { |
|
145 | 145 | throw new EE_Error( |
146 | 146 | sprintf( |
147 | - __( '"%1$s" is not a valid loader method on EE_Registry.', 'event_espresso' ), |
|
147 | + __('"%1$s" is not a valid loader method on EE_Registry.', 'event_espresso'), |
|
148 | 148 | $loader |
149 | 149 | ) |
150 | 150 | ); |
151 | 151 | } |
152 | - $class_name = self::$_instance->get_alias( $class_name ); |
|
153 | - if ( ! isset( self::$_instance->_class_loaders[ $class_name ] ) ) { |
|
154 | - self::$_instance->_class_loaders[ $class_name ] = $loader; |
|
152 | + $class_name = self::$_instance->get_alias($class_name); |
|
153 | + if ( ! isset(self::$_instance->_class_loaders[$class_name])) { |
|
154 | + self::$_instance->_class_loaders[$class_name] = $loader; |
|
155 | 155 | return true; |
156 | 156 | } |
157 | 157 | return false; |
@@ -174,8 +174,8 @@ discard block |
||
174 | 174 | * @param string $class_name |
175 | 175 | * @return boolean |
176 | 176 | */ |
177 | - public function has( $class_name = '' ) { |
|
178 | - return isset( $this->_dependency_map[ $class_name ] ) ? true : false; |
|
177 | + public function has($class_name = '') { |
|
178 | + return isset($this->_dependency_map[$class_name]) ? true : false; |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | |
@@ -187,9 +187,9 @@ discard block |
||
187 | 187 | * @param string $dependency |
188 | 188 | * @return bool |
189 | 189 | */ |
190 | - public function has_dependency_for_class( $class_name = '', $dependency = '' ) { |
|
191 | - $dependency = $this->get_alias( $dependency ); |
|
192 | - return isset( $this->_dependency_map[ $class_name ], $this->_dependency_map[ $class_name ][ $dependency ] ) |
|
190 | + public function has_dependency_for_class($class_name = '', $dependency = '') { |
|
191 | + $dependency = $this->get_alias($dependency); |
|
192 | + return isset($this->_dependency_map[$class_name], $this->_dependency_map[$class_name][$dependency]) |
|
193 | 193 | ? true |
194 | 194 | : false; |
195 | 195 | } |
@@ -203,10 +203,10 @@ discard block |
||
203 | 203 | * @param string $dependency |
204 | 204 | * @return int |
205 | 205 | */ |
206 | - public function loading_strategy_for_class_dependency( $class_name = '', $dependency = '' ) { |
|
207 | - $dependency = $this->get_alias( $dependency ); |
|
208 | - return $this->has_dependency_for_class( $class_name, $dependency ) |
|
209 | - ? $this->_dependency_map[ $class_name ][ $dependency ] |
|
206 | + public function loading_strategy_for_class_dependency($class_name = '', $dependency = '') { |
|
207 | + $dependency = $this->get_alias($dependency); |
|
208 | + return $this->has_dependency_for_class($class_name, $dependency) |
|
209 | + ? $this->_dependency_map[$class_name][$dependency] |
|
210 | 210 | : EE_Dependency_Map::not_registered; |
211 | 211 | } |
212 | 212 | |
@@ -216,9 +216,9 @@ discard block |
||
216 | 216 | * @param string $class_name |
217 | 217 | * @return string | Closure |
218 | 218 | */ |
219 | - public function class_loader( $class_name ) { |
|
220 | - $class_name = $this->get_alias( $class_name ); |
|
221 | - return isset( $this->_class_loaders[ $class_name ] ) ? $this->_class_loaders[ $class_name ] : ''; |
|
219 | + public function class_loader($class_name) { |
|
220 | + $class_name = $this->get_alias($class_name); |
|
221 | + return isset($this->_class_loaders[$class_name]) ? $this->_class_loaders[$class_name] : ''; |
|
222 | 222 | } |
223 | 223 | |
224 | 224 | |
@@ -238,8 +238,8 @@ discard block |
||
238 | 238 | * @param string $class_name |
239 | 239 | * @param string $alias |
240 | 240 | */ |
241 | - public function add_alias( $class_name, $alias ) { |
|
242 | - $this->_aliases[ $class_name ] = $alias; |
|
241 | + public function add_alias($class_name, $alias) { |
|
242 | + $this->_aliases[$class_name] = $alias; |
|
243 | 243 | } |
244 | 244 | |
245 | 245 | |
@@ -250,8 +250,8 @@ discard block |
||
250 | 250 | * @param string $class_name |
251 | 251 | * @return boolean |
252 | 252 | */ |
253 | - public function has_alias( $class_name = '' ) { |
|
254 | - return isset( $this->_aliases[ $class_name ] ) ? true : false; |
|
253 | + public function has_alias($class_name = '') { |
|
254 | + return isset($this->_aliases[$class_name]) ? true : false; |
|
255 | 255 | } |
256 | 256 | |
257 | 257 | |
@@ -271,9 +271,9 @@ discard block |
||
271 | 271 | * @param string $class_name |
272 | 272 | * @return string |
273 | 273 | */ |
274 | - public function get_alias( $class_name = '' ) { |
|
275 | - return $this->has_alias( $class_name ) |
|
276 | - ? $this->get_alias( $this->_aliases[ $class_name ] ) |
|
274 | + public function get_alias($class_name = '') { |
|
275 | + return $this->has_alias($class_name) |
|
276 | + ? $this->get_alias($this->_aliases[$class_name]) |
|
277 | 277 | : $class_name; |
278 | 278 | } |
279 | 279 | |
@@ -489,17 +489,17 @@ discard block |
||
489 | 489 | 'EE_Messages_Data_Handler_Collection' => 'load_lib', |
490 | 490 | 'EE_Message_Template_Group_Collection' => 'load_lib', |
491 | 491 | 'EE_Messages_Generator' => function() { |
492 | - return EE_Registry::instance()->load_lib( 'Messages_Generator', array(), false, false ); |
|
492 | + return EE_Registry::instance()->load_lib('Messages_Generator', array(), false, false); |
|
493 | 493 | }, |
494 | - 'EE_Messages_Template_Defaults' => function( $arguments = array() ) { |
|
495 | - return EE_Registry::instance()->load_lib( 'Messages_Template_Defaults', $arguments, false, false ); |
|
494 | + 'EE_Messages_Template_Defaults' => function($arguments = array()) { |
|
495 | + return EE_Registry::instance()->load_lib('Messages_Template_Defaults', $arguments, false, false); |
|
496 | 496 | }, |
497 | 497 | //load_model |
498 | 498 | 'EEM_Message_Template_Group' => 'load_model', |
499 | 499 | 'EEM_Message_Template' => 'load_model', |
500 | 500 | //load_helper |
501 | 501 | 'EEH_Parse_Shortcodes' => function() { |
502 | - if ( EE_Registry::instance()->load_helper( 'Parse_Shortcodes' ) ) { |
|
502 | + if (EE_Registry::instance()->load_helper('Parse_Shortcodes')) { |
|
503 | 503 | return new EEH_Parse_Shortcodes(); |
504 | 504 | } |
505 | 505 | return null; |
@@ -9,10 +9,10 @@ |
||
9 | 9 | class EE_CPT_Strategy extends EE_Base { |
10 | 10 | |
11 | 11 | /** |
12 | - * EE_CPT_Strategy Object |
|
13 | - * @private _instance |
|
14 | - * @private protected |
|
15 | - */ |
|
12 | + * EE_CPT_Strategy Object |
|
13 | + * @private _instance |
|
14 | + * @private protected |
|
15 | + */ |
|
16 | 16 | private static $_instance; |
17 | 17 | |
18 | 18 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
3 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
4 | 4 | exit('NO direct script access allowed'); |
5 | 5 | |
6 | 6 | /** |
@@ -55,38 +55,38 @@ discard block |
||
55 | 55 | '[EVENT_NAME]' => __("This also can be used for the name of the event", 'event_espresso'), |
56 | 56 | '[EVENT_PHONE]' => __('The phone number for the event (usually an info number)', 'event_espresso'), |
57 | 57 | '[EVENT_DESCRIPTION]' => __('The description of the event', 'event_espresso'), |
58 | - '[EVENT_EXCERPT]' => __( 'This gets parsed to the value for the excerpt field in the event or blank if there is no excerpt.', 'event_espresso' ), |
|
58 | + '[EVENT_EXCERPT]' => __('This gets parsed to the value for the excerpt field in the event or blank if there is no excerpt.', 'event_espresso'), |
|
59 | 59 | '[EVENT_LINK]' => __('A link associated with the event', 'event_espresso'), |
60 | 60 | '[EVENT_URL]' => __('A link to the event set up on the host site.', 'event_espresso'), |
61 | 61 | '[VIRTUAL_URL]' => __('What was used for the "URL of Event" field in the Venue settings', 'event_espresso'), |
62 | 62 | '[VIRTUAL_PHONE]' => __('An alternate phone number for the event. Typically used as a "call-in" number', 'event_espresso'), |
63 | 63 | '[EVENT_IMAGE]' => __('This will parse to the Feature image for the event.', 'event_espresso'), |
64 | 64 | '[EVENT_IMAGE_*]' => sprintf( |
65 | - __( 'This will parse to the Feature image for the event, %1$ssize%2$s can be set to determine the size of the image loaded by the shortcode. The %1$swidth%2$s and/or %1$sheight%2$s can also be set to determine the width and height of the image when output. By default the shortcode will load the %1$sthumbnail%2$s image size.', 'event_espresso' ), |
|
65 | + __('This will parse to the Feature image for the event, %1$ssize%2$s can be set to determine the size of the image loaded by the shortcode. The %1$swidth%2$s and/or %1$sheight%2$s can also be set to determine the width and height of the image when output. By default the shortcode will load the %1$sthumbnail%2$s image size.', 'event_espresso'), |
|
66 | 66 | '<code>', |
67 | 67 | '</code>' |
68 | 68 | ), |
69 | 69 | '[EVENT_TOTAL_AVAILABLE_SPACES_*]' => sprintf( |
70 | - __( 'This will parse to the total available spaces for an event. Calculating total spaces is approximate because it is dependent on the complexity of limits on your event. There are two methods of calculation (which can be indicated by the %1$smethod%2$s param on the shortcode). %1$scurrent%2$s which will do a more accurate calculation of total available spaces based on current sales, and %1$sfull%2$s which will be the maximum total available spaces that is on the event in optimal conditions. The shortcode will default to current.', 'event_espresso' ), |
|
70 | + __('This will parse to the total available spaces for an event. Calculating total spaces is approximate because it is dependent on the complexity of limits on your event. There are two methods of calculation (which can be indicated by the %1$smethod%2$s param on the shortcode). %1$scurrent%2$s which will do a more accurate calculation of total available spaces based on current sales, and %1$sfull%2$s which will be the maximum total available spaces that is on the event in optimal conditions. The shortcode will default to current.', 'event_espresso'), |
|
71 | 71 | '<code>', |
72 | 72 | '</code>' |
73 | 73 | ), |
74 | - '[EVENT_TOTAL_SPOTS_TAKEN]' => __( 'This shortcode will parse to the output the total approved registrations for this event', 'event_espresso' ), |
|
74 | + '[EVENT_TOTAL_SPOTS_TAKEN]' => __('This shortcode will parse to the output the total approved registrations for this event', 'event_espresso'), |
|
75 | 75 | '[EVENT_FACEBOOK_URL]' => __('This will return the Facebook URL for the event if you have it set via custom field in your event, otherwise it will use the Facebook URL set in "Your Organization Settings". To set the facebook url in your event, add a custom field with the key as <code>event_facebook</code> and the value as your facebook url.', 'event_espresso'), |
76 | 76 | '[EVENT_TWITTER_URL]' => __('This will return the Twitter URL for the event if you have it set via custom field in your event, otherwise it will use the Twitter URL set in "Your Organization Settings". To set the facebook url in your event, add a custom field with the key as <code>event_twitter</code> and the value as your facebook url', 'event_espresso'), |
77 | 77 | '[EVENT_META_*]' => __('This is a special dynamic shortcode. After the "*", add the exact name for your custom field, if there is a value set for that custom field within the event then it will be output in place of this shortcode.', 'event_espresso'), |
78 | - '[REGISTRATION_LIST_TABLE_FOR_EVENT_URL]' => __( 'This parses to the url for the registration list table filtered by registrations for this event.', 'event_espresso' ), |
|
78 | + '[REGISTRATION_LIST_TABLE_FOR_EVENT_URL]' => __('This parses to the url for the registration list table filtered by registrations for this event.', 'event_espresso'), |
|
79 | 79 | ); |
80 | 80 | } |
81 | 81 | |
82 | 82 | |
83 | - protected function _parser( $shortcode ) { |
|
83 | + protected function _parser($shortcode) { |
|
84 | 84 | |
85 | 85 | |
86 | 86 | $this->_event = $this->_data instanceof EE_Event ? $this->_data : null; |
87 | 87 | |
88 | 88 | //if no event, then let's see if there is a reg_obj. If there IS, then we'll try and grab the event from the reg_obj instead. |
89 | - if ( empty( $this->_event ) ) { |
|
89 | + if (empty($this->_event)) { |
|
90 | 90 | $aee = $this->_data instanceof EE_Messages_Addressee ? $this->_data : NULL; |
91 | 91 | $aee = $this->_extra_data instanceof EE_Messages_Addressee ? $this->_extra_data : $aee; |
92 | 92 | |
@@ -95,10 +95,10 @@ discard block |
||
95 | 95 | |
96 | 96 | |
97 | 97 | //If there is no event objecdt by now then get out. |
98 | - if ( ! $this->_event instanceof EE_Event ) |
|
98 | + if ( ! $this->_event instanceof EE_Event) |
|
99 | 99 | return ''; |
100 | 100 | |
101 | - switch ( $shortcode ) { |
|
101 | + switch ($shortcode) { |
|
102 | 102 | |
103 | 103 | case '[EVENT_ID]' : |
104 | 104 | return $this->_event->ID(); |
@@ -131,41 +131,41 @@ discard block |
||
131 | 131 | |
132 | 132 | case '[VIRTUAL_URL]' : |
133 | 133 | $venue = $this->_event->get_first_related('Venue'); |
134 | - if ( empty( $venue ) ) |
|
134 | + if (empty($venue)) |
|
135 | 135 | return ''; |
136 | 136 | return $venue->get('VNU_virtual_url'); |
137 | 137 | |
138 | 138 | case '[VIRTUAL_PHONE]' : |
139 | 139 | $venue = $this->_event->get_first_related('Venue'); |
140 | - if ( empty( $venue ) ) |
|
140 | + if (empty($venue)) |
|
141 | 141 | return ''; |
142 | 142 | return $venue->get('VNU_virtual_phone'); |
143 | 143 | break; |
144 | 144 | |
145 | 145 | case '[EVENT_IMAGE]' : |
146 | - $image = $this->_event->feature_image_url(array(600,300) ); |
|
146 | + $image = $this->_event->feature_image_url(array(600, 300)); |
|
147 | 147 | // @todo: eventually we should make this an attribute shortcode so that em can send along what size they want returned. |
148 | - return ! empty( $image ) ? '<img src="' . $image . '" alt="' . sprintf( esc_attr__( '%s Feature Image', 'event_espresso'), $this->_event->get('EVT_name') ) . '" />' : ''; |
|
148 | + return ! empty($image) ? '<img src="'.$image.'" alt="'.sprintf(esc_attr__('%s Feature Image', 'event_espresso'), $this->_event->get('EVT_name')).'" />' : ''; |
|
149 | 149 | break; |
150 | 150 | |
151 | 151 | case '[EVENT_FACEBOOK_URL]' : |
152 | - $facebook_url = $this->_event->get_post_meta('event_facebook', true ); |
|
153 | - return empty( $facebook_url ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'facebook' ) : $facebook_url; |
|
152 | + $facebook_url = $this->_event->get_post_meta('event_facebook', true); |
|
153 | + return empty($facebook_url) ? EE_Registry::instance()->CFG->organization->get_pretty('facebook') : $facebook_url; |
|
154 | 154 | break; |
155 | 155 | |
156 | 156 | case '[EVENT_TWITTER_URL]' : |
157 | 157 | $twitter_url = $this->_event->get_post_meta('event_twitter', true); |
158 | - return empty( $twitter_url ) ? EE_Registry::instance()->CFG->organization->get_pretty( 'twitter' ) : $twitter_url; |
|
158 | + return empty($twitter_url) ? EE_Registry::instance()->CFG->organization->get_pretty('twitter') : $twitter_url; |
|
159 | 159 | break; |
160 | 160 | |
161 | 161 | case '[EVENT_AUTHOR_EMAIL]' : |
162 | 162 | $author_id = $this->_event->get('EVT_wp_user'); |
163 | - $user_data = get_userdata( (int) $author_id ); |
|
163 | + $user_data = get_userdata((int) $author_id); |
|
164 | 164 | return $user_data->user_email; |
165 | 165 | break; |
166 | 166 | |
167 | 167 | case '[EVENT_TOTAL_SPOTS_TAKEN]' : |
168 | - return EEM_Registration::instance()->count( array( array( 'EVT_ID' => $this->_event->ID(), 'STS_ID' => EEM_Registration::status_id_approved ) ), 'REG_ID', true ); |
|
168 | + return EEM_Registration::instance()->count(array(array('EVT_ID' => $this->_event->ID(), 'STS_ID' => EEM_Registration::status_id_approved)), 'REG_ID', true); |
|
169 | 169 | break; |
170 | 170 | |
171 | 171 | case '[REGISTRATION_LIST_TABLE_FOR_EVENT_URL]' : |
@@ -175,49 +175,49 @@ discard block |
||
175 | 175 | 'page' => 'espresso_registrations', |
176 | 176 | 'action' => 'default' |
177 | 177 | ), |
178 | - admin_url( 'admin.php' ), |
|
178 | + admin_url('admin.php'), |
|
179 | 179 | true |
180 | 180 | ); |
181 | 181 | break; |
182 | 182 | } |
183 | 183 | |
184 | - if ( strpos( $shortcode, '[EVENT_META_*' ) !== false ) { |
|
185 | - $shortcode = str_replace( '[EVENT_META_*', '', $shortcode ); |
|
186 | - $shortcode = trim( str_replace( ']', '', $shortcode ) ); |
|
184 | + if (strpos($shortcode, '[EVENT_META_*') !== false) { |
|
185 | + $shortcode = str_replace('[EVENT_META_*', '', $shortcode); |
|
186 | + $shortcode = trim(str_replace(']', '', $shortcode)); |
|
187 | 187 | |
188 | 188 | //pull the meta value from the event post |
189 | - $event_meta = $this->_event->get_post_meta( $shortcode, true ); |
|
189 | + $event_meta = $this->_event->get_post_meta($shortcode, true); |
|
190 | 190 | |
191 | - return ! empty( $event_meta ) ? $this->_event->get_post_meta( $shortcode, true ) : ''; |
|
191 | + return ! empty($event_meta) ? $this->_event->get_post_meta($shortcode, true) : ''; |
|
192 | 192 | |
193 | 193 | } |
194 | 194 | |
195 | - if ( strpos( $shortcode, '[EVENT_TOTAL_AVAILABLE_SPACES_*' ) !== false ) { |
|
196 | - $attrs = $this->_get_shortcode_attrs( $shortcode ); |
|
197 | - $method = empty( $attrs['method'] ) ? 'current' : $attrs['method']; |
|
195 | + if (strpos($shortcode, '[EVENT_TOTAL_AVAILABLE_SPACES_*') !== false) { |
|
196 | + $attrs = $this->_get_shortcode_attrs($shortcode); |
|
197 | + $method = empty($attrs['method']) ? 'current' : $attrs['method']; |
|
198 | 198 | $method = $method === 'current'; |
199 | 199 | $available = $this->_event->total_available_spaces($method); |
200 | 200 | return $available === EE_INF ? '∞' : $available; |
201 | 201 | } |
202 | 202 | |
203 | - if ( strpos( $shortcode, '[EVENT_IMAGE_*' ) !== false ) { |
|
204 | - $attrs = $this->_get_shortcode_attrs( $shortcode ); |
|
205 | - $width = empty( $attrs['width'] ) ? '' : ' width="' . $attrs['width'] . '"'; |
|
206 | - $height = empty( $attrs['height'] ) ? '' : ' height="'. $attrs['height'] .'"'; |
|
203 | + if (strpos($shortcode, '[EVENT_IMAGE_*') !== false) { |
|
204 | + $attrs = $this->_get_shortcode_attrs($shortcode); |
|
205 | + $width = empty($attrs['width']) ? '' : ' width="'.$attrs['width'].'"'; |
|
206 | + $height = empty($attrs['height']) ? '' : ' height="'.$attrs['height'].'"'; |
|
207 | 207 | |
208 | 208 | //Size may be set to a string such as 'tumbnail' or "width, height" eg - '200,200' |
209 | - if ( ! empty( $attrs['size'] ) ) { |
|
210 | - $size = explode( ',', $attrs['size'] ); |
|
211 | - if ( count($size) === 1 ) { |
|
209 | + if ( ! empty($attrs['size'])) { |
|
210 | + $size = explode(',', $attrs['size']); |
|
211 | + if (count($size) === 1) { |
|
212 | 212 | $size = $size[0]; |
213 | 213 | } |
214 | 214 | } else { |
215 | 215 | $size = 'thumbnail'; |
216 | 216 | } |
217 | 217 | |
218 | - $image = $this->_event->feature_image_url( $size ); |
|
218 | + $image = $this->_event->feature_image_url($size); |
|
219 | 219 | |
220 | - return ! empty( $image ) ? '<img src="' . $image . '" alt="' . sprintf( esc_attr__( '%s Feature Image', 'event_espresso'), $this->_event->get('EVT_name') ) . '"' . $width . $height . '/>' : ''; |
|
220 | + return ! empty($image) ? '<img src="'.$image.'" alt="'.sprintf(esc_attr__('%s Feature Image', 'event_espresso'), $this->_event->get('EVT_name')).'"'.$width.$height.'/>' : ''; |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | return ''; |
@@ -230,10 +230,10 @@ discard block |
||
230 | 230 | * @param boolean $full_link if TRUE (default) we return the html for the name of the event linked to the event. Otherwise we just return the url of the event. |
231 | 231 | * @return string |
232 | 232 | */ |
233 | - private function _get_event_link( $event, $full_link = TRUE ) { |
|
233 | + private function _get_event_link($event, $full_link = TRUE) { |
|
234 | 234 | $url = get_permalink($event->ID()); |
235 | 235 | |
236 | - return $full_link ? '<a href="' . $url . '">' . $event->get('EVT_name') . '</a>' : $url; |
|
236 | + return $full_link ? '<a href="'.$url.'">'.$event->get('EVT_name').'</a>' : $url; |
|
237 | 237 | } |
238 | 238 | |
239 | 239 |
@@ -28,7 +28,7 @@ |
||
28 | 28 | * @ return void |
29 | 29 | */ |
30 | 30 | public function __get($a) { return FALSE; } |
31 | - public function __set($a,$b) { return FALSE; } |
|
31 | + public function __set($a, $b) { return FALSE; } |
|
32 | 32 | public function __isset($a) { return FALSE; } |
33 | 33 | public function __unset($a) { return FALSE; } |
34 | 34 | public function __clone() { return FALSE; } |
@@ -5,25 +5,25 @@ |
||
5 | 5 | <table id="txn-admin-transaction-attendees-table" class="admin-primary-mbox-tbl"> |
6 | 6 | <thead> |
7 | 7 | <tr> |
8 | - <th class="jst-left"><?php _e( '#', 'event_espresso' );?></th> |
|
9 | - <th class="jst-left"><?php _e( 'Event Name and Ticket', 'event_espresso' );?></th> |
|
10 | - <th class="jst-left"><?php _e( 'Registrant', 'event_espresso' );?></th> |
|
11 | - <th class="jst-left"><?php _e( 'Ticket Price', 'event_espresso' );?></th> |
|
12 | - <th class="jst-left"><?php _e( 'Email', 'event_espresso' );?></th> |
|
13 | - <th class="jst-left"><?php _e( 'Address', 'event_espresso' );?></th> |
|
8 | + <th class="jst-left"><?php _e('#', 'event_espresso'); ?></th> |
|
9 | + <th class="jst-left"><?php _e('Event Name and Ticket', 'event_espresso'); ?></th> |
|
10 | + <th class="jst-left"><?php _e('Registrant', 'event_espresso'); ?></th> |
|
11 | + <th class="jst-left"><?php _e('Ticket Price', 'event_espresso'); ?></th> |
|
12 | + <th class="jst-left"><?php _e('Email', 'event_espresso'); ?></th> |
|
13 | + <th class="jst-left"><?php _e('Address', 'event_espresso'); ?></th> |
|
14 | 14 | </tr> |
15 | 15 | </thead> |
16 | 16 | <tbody> |
17 | - <?php if ( isset( $event_attendees ) && is_array( $event_attendees )) : ?> |
|
18 | - <?php foreach ( $event_attendees as $registration => $attendee ) : ?> |
|
17 | + <?php if (isset($event_attendees) && is_array($event_attendees)) : ?> |
|
18 | + <?php foreach ($event_attendees as $registration => $attendee) : ?> |
|
19 | 19 | <tr class="ee-status-strip reg-status-<?php echo $attendee['STS_ID']; ?>" style="display: table-row;"> |
20 | - <td class="jst-left"><?php echo $attendee['att_num'];?></td> |
|
21 | - <td class="jst-left"><?php echo $attendee['event_ticket_name'];?></td> |
|
20 | + <td class="jst-left"><?php echo $attendee['att_num']; ?></td> |
|
21 | + <td class="jst-left"><?php echo $attendee['event_ticket_name']; ?></td> |
|
22 | 22 | <td class="jst-left"> |
23 | 23 | <?php |
24 | - $att_link = EE_Admin_Page::add_query_args_and_nonce( array( 'action'=>'view_registration', '_REG_ID'=>$registration), REG_ADMIN_URL ); |
|
24 | + $att_link = EE_Admin_Page::add_query_args_and_nonce(array('action'=>'view_registration', '_REG_ID'=>$registration), REG_ADMIN_URL); |
|
25 | 25 | ?> |
26 | - <a href="<?php echo $att_link; ?>" title="<?php _e( 'View details for this registrant', 'event_espresso' );?>"> |
|
26 | + <a href="<?php echo $att_link; ?>" title="<?php _e('View details for this registrant', 'event_espresso'); ?>"> |
|
27 | 27 | <?php echo $attendee['attendee']?> |
28 | 28 | </a> |
29 | 29 | </td> |
@@ -24,10 +24,10 @@ discard block |
||
24 | 24 | * @param string $table_name |
25 | 25 | * @return string $tableName, having ensured it has the wpdb prefix on the front |
26 | 26 | */ |
27 | - public function ensureTableNameHasPrefix( $table_name ) |
|
27 | + public function ensureTableNameHasPrefix($table_name) |
|
28 | 28 | { |
29 | 29 | global $wpdb; |
30 | - return strpos( $table_name, $wpdb->base_prefix ) === 0 ? $table_name : $wpdb->prefix . $table_name; |
|
30 | + return strpos($table_name, $wpdb->base_prefix) === 0 ? $table_name : $wpdb->prefix.$table_name; |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | |
@@ -39,13 +39,13 @@ discard block |
||
39 | 39 | * @param string $table_name |
40 | 40 | * @return bool |
41 | 41 | */ |
42 | - public function tableIsEmpty( $table_name ) |
|
42 | + public function tableIsEmpty($table_name) |
|
43 | 43 | { |
44 | 44 | global $wpdb; |
45 | - $table_name = $this->ensureTableNameHasPrefix( $table_name ); |
|
46 | - if ( $this->tableExists( $table_name ) ) { |
|
47 | - $count = $wpdb->get_var( "SELECT COUNT(*) FROM $table_name" ); |
|
48 | - return absint( $count ) === 0 ? true : false; |
|
45 | + $table_name = $this->ensureTableNameHasPrefix($table_name); |
|
46 | + if ($this->tableExists($table_name)) { |
|
47 | + $count = $wpdb->get_var("SELECT COUNT(*) FROM $table_name"); |
|
48 | + return absint($count) === 0 ? true : false; |
|
49 | 49 | } |
50 | 50 | return false; |
51 | 51 | } |
@@ -60,24 +60,24 @@ discard block |
||
60 | 60 | * @param $table_name |
61 | 61 | * @return bool |
62 | 62 | */ |
63 | - public function tableExists( $table_name ) |
|
63 | + public function tableExists($table_name) |
|
64 | 64 | { |
65 | 65 | global $wpdb, $EZSQL_ERROR; |
66 | - $table_name = $this->ensureTableNameHasPrefix( $table_name ); |
|
66 | + $table_name = $this->ensureTableNameHasPrefix($table_name); |
|
67 | 67 | //ignore if this causes an sql error |
68 | 68 | $old_error = $wpdb->last_error; |
69 | 69 | $old_suppress_errors = $wpdb->suppress_errors(); |
70 | - $old_show_errors_value = $wpdb->show_errors( FALSE ); |
|
70 | + $old_show_errors_value = $wpdb->show_errors(FALSE); |
|
71 | 71 | $ezsql_error_cache = $EZSQL_ERROR; |
72 | - $wpdb->get_results( "SELECT * from $table_name LIMIT 1"); |
|
73 | - $wpdb->show_errors( $old_show_errors_value ); |
|
74 | - $wpdb->suppress_errors( $old_suppress_errors ); |
|
72 | + $wpdb->get_results("SELECT * from $table_name LIMIT 1"); |
|
73 | + $wpdb->show_errors($old_show_errors_value); |
|
74 | + $wpdb->suppress_errors($old_suppress_errors); |
|
75 | 75 | $new_error = $wpdb->last_error; |
76 | 76 | $wpdb->last_error = $old_error; |
77 | 77 | $EZSQL_ERROR = $ezsql_error_cache; |
78 | 78 | //if there was a table doesn't exist error |
79 | - if( ! empty( $new_error ) ) { |
|
80 | - if( |
|
79 | + if ( ! empty($new_error)) { |
|
80 | + if ( |
|
81 | 81 | in_array( |
82 | 82 | \EEH_Activation::last_wpdb_error_code(), |
83 | 83 | array( |
@@ -87,14 +87,14 @@ discard block |
||
87 | 87 | ) |
88 | 88 | ) |
89 | 89 | || |
90 | - preg_match( '~^Table .* doesn\'t exist~', $new_error ) //in case not using mysql and error codes aren't reliable, just check for this error string |
|
90 | + preg_match('~^Table .* doesn\'t exist~', $new_error) //in case not using mysql and error codes aren't reliable, just check for this error string |
|
91 | 91 | ) { |
92 | 92 | return false; |
93 | 93 | } else { |
94 | 94 | //log this because that's weird. Just use the normal PHP error log |
95 | 95 | error_log( |
96 | 96 | sprintf( |
97 | - __( 'Event Espresso error detected when checking if table existed: %1$s (it wasn\'t just that the table didn\'t exist either)', 'event_espresso' ), |
|
97 | + __('Event Espresso error detected when checking if table existed: %1$s (it wasn\'t just that the table didn\'t exist either)', 'event_espresso'), |
|
98 | 98 | $new_error |
99 | 99 | ) |
100 | 100 | ); |