@@ -13,20 +13,20 @@ |
||
13 | 13 | interface CapCheckInterface |
14 | 14 | { |
15 | 15 | |
16 | - /** |
|
17 | - * @return string |
|
18 | - */ |
|
19 | - public function capability(); |
|
16 | + /** |
|
17 | + * @return string |
|
18 | + */ |
|
19 | + public function capability(); |
|
20 | 20 | |
21 | - /** |
|
22 | - * @return string |
|
23 | - */ |
|
24 | - public function context(); |
|
21 | + /** |
|
22 | + * @return string |
|
23 | + */ |
|
24 | + public function context(); |
|
25 | 25 | |
26 | - /** |
|
27 | - * @return int|string |
|
28 | - */ |
|
29 | - public function ID(); |
|
26 | + /** |
|
27 | + * @return int|string |
|
28 | + */ |
|
29 | + public function ID(); |
|
30 | 30 | |
31 | 31 | } |
32 | 32 | // End of file CapCheckInterface.php |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | use EventEspresso\core\services\commands\CommandRequiresCapCheckInterface; |
9 | 9 | |
10 | 10 | if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
11 | - exit('No direct script access allowed'); |
|
11 | + exit('No direct script access allowed'); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | |
@@ -24,142 +24,142 @@ discard block |
||
24 | 24 | class CreateRegistrationCommand extends Command implements CommandRequiresCapCheckInterface |
25 | 25 | { |
26 | 26 | |
27 | - /** |
|
28 | - * @var \EE_Transaction $transaction |
|
29 | - */ |
|
30 | - private $transaction; |
|
31 | - |
|
32 | - /** |
|
33 | - * @var \EE_Ticket $ticket |
|
34 | - */ |
|
35 | - private $ticket; |
|
36 | - |
|
37 | - /** |
|
38 | - * @var \EE_Line_Item $ticket_line_item |
|
39 | - */ |
|
40 | - private $ticket_line_item; |
|
41 | - |
|
42 | - /** |
|
43 | - * @var int $reg_count |
|
44 | - */ |
|
45 | - private $reg_count = 1; |
|
46 | - |
|
47 | - /** |
|
48 | - * @var int $reg_group_size |
|
49 | - */ |
|
50 | - private $reg_group_size = 0; |
|
51 | - |
|
52 | - /** |
|
53 | - * @var \EE_Registration $registration |
|
54 | - */ |
|
55 | - protected $registration; |
|
56 | - |
|
57 | - |
|
58 | - |
|
59 | - /** |
|
60 | - * CreateRegistrationCommand constructor. |
|
61 | - * |
|
62 | - * @param \EE_Transaction $transaction |
|
63 | - * @param \EE_Line_Item $ticket_line_item |
|
64 | - * @param int $reg_count |
|
65 | - * @param int $reg_group_size |
|
66 | - */ |
|
67 | - public function __construct( |
|
68 | - \EE_Transaction $transaction, |
|
69 | - \EE_Line_Item $ticket_line_item, |
|
70 | - $reg_count = 1, |
|
71 | - $reg_group_size = 0 |
|
72 | - ) { |
|
73 | - // grab the related ticket object for this line_item |
|
74 | - $this->ticket = $ticket_line_item->ticket(); |
|
75 | - if ( ! $this->ticket instanceof \EE_Ticket) { |
|
76 | - throw new InvalidEntityException( |
|
77 | - is_object($this->ticket) ? get_class($this->ticket) : gettype($this->ticket), |
|
78 | - 'EE_Ticket', |
|
79 | - sprintf( |
|
80 | - __("Line item %s did not contain a valid ticket", "event_espresso"), |
|
81 | - $ticket_line_item->ID() |
|
82 | - ) |
|
83 | - ); |
|
84 | - } |
|
85 | - $this->transaction = $transaction; |
|
86 | - $this->ticket_line_item = $ticket_line_item; |
|
87 | - $this->reg_count = absint($reg_count); |
|
88 | - $this->reg_group_size = absint($reg_group_size); |
|
89 | - } |
|
90 | - |
|
91 | - |
|
92 | - |
|
93 | - /** |
|
94 | - * @return \EventEspresso\core\domain\services\capabilities\CapCheckInterface |
|
95 | - */ |
|
96 | - public function getCapCheck() |
|
97 | - { |
|
98 | - if ( ! $this->cap_check instanceof CapCheckInterface) { |
|
99 | - return new CapCheck('ee_edit_registrations', 'create_new_registration'); |
|
100 | - } |
|
101 | - return $this->cap_check; |
|
102 | - } |
|
103 | - |
|
104 | - |
|
105 | - |
|
106 | - /** |
|
107 | - * @return \EE_Transaction |
|
108 | - */ |
|
109 | - public function transaction() |
|
110 | - { |
|
111 | - return $this->transaction; |
|
112 | - } |
|
113 | - |
|
114 | - |
|
115 | - |
|
116 | - /** |
|
117 | - * @return \EE_Ticket |
|
118 | - */ |
|
119 | - public function ticket() |
|
120 | - { |
|
121 | - return $this->ticket; |
|
122 | - } |
|
123 | - |
|
124 | - |
|
125 | - |
|
126 | - /** |
|
127 | - * @return \EE_Line_Item |
|
128 | - */ |
|
129 | - public function ticketLineItem() |
|
130 | - { |
|
131 | - return $this->ticket_line_item; |
|
132 | - } |
|
133 | - |
|
134 | - |
|
135 | - |
|
136 | - /** |
|
137 | - * @return int |
|
138 | - */ |
|
139 | - public function regCount() |
|
140 | - { |
|
141 | - return $this->reg_count; |
|
142 | - } |
|
143 | - |
|
144 | - |
|
145 | - |
|
146 | - /** |
|
147 | - * @return int |
|
148 | - */ |
|
149 | - public function regGroupSize() |
|
150 | - { |
|
151 | - return $this->reg_group_size; |
|
152 | - } |
|
153 | - |
|
154 | - |
|
155 | - |
|
156 | - /** |
|
157 | - * @return \EE_Registration |
|
158 | - */ |
|
159 | - public function registration() |
|
160 | - { |
|
161 | - return $this->registration; |
|
162 | - } |
|
27 | + /** |
|
28 | + * @var \EE_Transaction $transaction |
|
29 | + */ |
|
30 | + private $transaction; |
|
31 | + |
|
32 | + /** |
|
33 | + * @var \EE_Ticket $ticket |
|
34 | + */ |
|
35 | + private $ticket; |
|
36 | + |
|
37 | + /** |
|
38 | + * @var \EE_Line_Item $ticket_line_item |
|
39 | + */ |
|
40 | + private $ticket_line_item; |
|
41 | + |
|
42 | + /** |
|
43 | + * @var int $reg_count |
|
44 | + */ |
|
45 | + private $reg_count = 1; |
|
46 | + |
|
47 | + /** |
|
48 | + * @var int $reg_group_size |
|
49 | + */ |
|
50 | + private $reg_group_size = 0; |
|
51 | + |
|
52 | + /** |
|
53 | + * @var \EE_Registration $registration |
|
54 | + */ |
|
55 | + protected $registration; |
|
56 | + |
|
57 | + |
|
58 | + |
|
59 | + /** |
|
60 | + * CreateRegistrationCommand constructor. |
|
61 | + * |
|
62 | + * @param \EE_Transaction $transaction |
|
63 | + * @param \EE_Line_Item $ticket_line_item |
|
64 | + * @param int $reg_count |
|
65 | + * @param int $reg_group_size |
|
66 | + */ |
|
67 | + public function __construct( |
|
68 | + \EE_Transaction $transaction, |
|
69 | + \EE_Line_Item $ticket_line_item, |
|
70 | + $reg_count = 1, |
|
71 | + $reg_group_size = 0 |
|
72 | + ) { |
|
73 | + // grab the related ticket object for this line_item |
|
74 | + $this->ticket = $ticket_line_item->ticket(); |
|
75 | + if ( ! $this->ticket instanceof \EE_Ticket) { |
|
76 | + throw new InvalidEntityException( |
|
77 | + is_object($this->ticket) ? get_class($this->ticket) : gettype($this->ticket), |
|
78 | + 'EE_Ticket', |
|
79 | + sprintf( |
|
80 | + __("Line item %s did not contain a valid ticket", "event_espresso"), |
|
81 | + $ticket_line_item->ID() |
|
82 | + ) |
|
83 | + ); |
|
84 | + } |
|
85 | + $this->transaction = $transaction; |
|
86 | + $this->ticket_line_item = $ticket_line_item; |
|
87 | + $this->reg_count = absint($reg_count); |
|
88 | + $this->reg_group_size = absint($reg_group_size); |
|
89 | + } |
|
90 | + |
|
91 | + |
|
92 | + |
|
93 | + /** |
|
94 | + * @return \EventEspresso\core\domain\services\capabilities\CapCheckInterface |
|
95 | + */ |
|
96 | + public function getCapCheck() |
|
97 | + { |
|
98 | + if ( ! $this->cap_check instanceof CapCheckInterface) { |
|
99 | + return new CapCheck('ee_edit_registrations', 'create_new_registration'); |
|
100 | + } |
|
101 | + return $this->cap_check; |
|
102 | + } |
|
103 | + |
|
104 | + |
|
105 | + |
|
106 | + /** |
|
107 | + * @return \EE_Transaction |
|
108 | + */ |
|
109 | + public function transaction() |
|
110 | + { |
|
111 | + return $this->transaction; |
|
112 | + } |
|
113 | + |
|
114 | + |
|
115 | + |
|
116 | + /** |
|
117 | + * @return \EE_Ticket |
|
118 | + */ |
|
119 | + public function ticket() |
|
120 | + { |
|
121 | + return $this->ticket; |
|
122 | + } |
|
123 | + |
|
124 | + |
|
125 | + |
|
126 | + /** |
|
127 | + * @return \EE_Line_Item |
|
128 | + */ |
|
129 | + public function ticketLineItem() |
|
130 | + { |
|
131 | + return $this->ticket_line_item; |
|
132 | + } |
|
133 | + |
|
134 | + |
|
135 | + |
|
136 | + /** |
|
137 | + * @return int |
|
138 | + */ |
|
139 | + public function regCount() |
|
140 | + { |
|
141 | + return $this->reg_count; |
|
142 | + } |
|
143 | + |
|
144 | + |
|
145 | + |
|
146 | + /** |
|
147 | + * @return int |
|
148 | + */ |
|
149 | + public function regGroupSize() |
|
150 | + { |
|
151 | + return $this->reg_group_size; |
|
152 | + } |
|
153 | + |
|
154 | + |
|
155 | + |
|
156 | + /** |
|
157 | + * @return \EE_Registration |
|
158 | + */ |
|
159 | + public function registration() |
|
160 | + { |
|
161 | + return $this->registration; |
|
162 | + } |
|
163 | 163 | |
164 | 164 | |
165 | 165 |
@@ -486,7 +486,7 @@ discard block |
||
486 | 486 | * process_ticket_selections |
487 | 487 | * |
488 | 488 | * @access public |
489 | - * @return array|boolean |
|
489 | + * @return boolean|null |
|
490 | 490 | */ |
491 | 491 | public function process_ticket_selections() { |
492 | 492 | do_action( 'EED_Ticket_Selector__process_ticket_selections__before' ); |
@@ -631,7 +631,7 @@ discard block |
||
631 | 631 | * validate_post_data |
632 | 632 | * |
633 | 633 | * @access private |
634 | - * @return array or FALSE |
|
634 | + * @return string or FALSE |
|
635 | 635 | */ |
636 | 636 | private static function _validate_post_data() { |
637 | 637 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -748,7 +748,7 @@ discard block |
||
748 | 748 | * @access private |
749 | 749 | * @param EE_Ticket $ticket |
750 | 750 | * @param int $qty |
751 | - * @return TRUE on success, FALSE on fail |
|
751 | + * @return boolean on success, FALSE on fail |
|
752 | 752 | */ |
753 | 753 | private static function _add_ticket_to_cart( EE_Ticket $ticket = NULL, $qty = 1 ) { |
754 | 754 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -35,11 +35,11 @@ discard block |
||
35 | 35 | protected static $_event = NULL; |
36 | 36 | |
37 | 37 | /** |
38 | - * array of datetimes and the spaces available for them |
|
39 | - * |
|
40 | - * @access private |
|
41 | - * @var array |
|
42 | - */ |
|
38 | + * array of datetimes and the spaces available for them |
|
39 | + * |
|
40 | + * @access private |
|
41 | + * @var array |
|
42 | + */ |
|
43 | 43 | private static $_available_spaces = array(); |
44 | 44 | |
45 | 45 | |
@@ -208,8 +208,8 @@ discard block |
||
208 | 208 | return $permalink_string; |
209 | 209 | } |
210 | 210 | $permalink_string .= '<a id="js-ticket-selector-embed-trigger" class="button button-small" href="#" tabindex="-1">' |
211 | - . __( 'Embed', 'event_espresso' ) |
|
212 | - . '</a> '; |
|
211 | + . __( 'Embed', 'event_espresso' ) |
|
212 | + . '</a> '; |
|
213 | 213 | $ticket_selector_url = add_query_arg( array( 'ticket_selector' => 'iframe', 'event' => $id ), site_url() ); |
214 | 214 | $iframe_string = esc_html( |
215 | 215 | '<iframe src="' . $ticket_selector_url . '" width="100%" height="100%"></iframe>' |
@@ -489,7 +489,7 @@ discard block |
||
489 | 489 | * @return array|boolean |
490 | 490 | */ |
491 | 491 | public function process_ticket_selections() { |
492 | - do_action( 'EED_Ticket_Selector__process_ticket_selections__before' ); |
|
492 | + do_action( 'EED_Ticket_Selector__process_ticket_selections__before' ); |
|
493 | 493 | // check nonce |
494 | 494 | if ( ! is_admin() && ( ! EE_Registry::instance()->REQ->is_set( 'process_ticket_selections_nonce' ) || ! wp_verify_nonce( EE_Registry::instance()->REQ->get( 'process_ticket_selections_nonce' ), 'process_ticket_selections' ))) { |
495 | 495 | EE_Error::add_error( |
@@ -883,11 +883,11 @@ discard block |
||
883 | 883 | |
884 | 884 | |
885 | 885 | /** |
886 | - * load js |
|
887 | - * |
|
888 | - * @access public |
|
889 | - * @return void |
|
890 | - */ |
|
886 | + * load js |
|
887 | + * |
|
888 | + * @access public |
|
889 | + * @return void |
|
890 | + */ |
|
891 | 891 | public static function load_tckt_slctr_assets() { |
892 | 892 | // add some style |
893 | 893 | if ( apply_filters( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE ) ) { |
@@ -57,15 +57,15 @@ discard block |
||
57 | 57 | * @return EED_Ticket_Selector |
58 | 58 | */ |
59 | 59 | public static function instance() { |
60 | - return parent::get_instance( __CLASS__ ); |
|
60 | + return parent::get_instance(__CLASS__); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | |
64 | 64 | |
65 | - protected function set_config(){ |
|
66 | - $this->set_config_section( 'template_settings' ); |
|
67 | - $this->set_config_class( 'EE_Ticket_Selector_Config' ); |
|
68 | - $this->set_config_name( 'EED_Ticket_Selector' ); |
|
65 | + protected function set_config() { |
|
66 | + $this->set_config_section('template_settings'); |
|
67 | + $this->set_config_class('EE_Ticket_Selector_Config'); |
|
68 | + $this->set_config_name('EED_Ticket_Selector'); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | |
@@ -80,14 +80,14 @@ discard block |
||
80 | 80 | */ |
81 | 81 | public static function set_hooks() { |
82 | 82 | // routing |
83 | - EE_Config::register_route( 'iframe', 'EED_Ticket_Selector', 'ticket_selector_iframe', 'ticket_selector' ); |
|
84 | - EE_Config::register_route( 'process_ticket_selections', 'EED_Ticket_Selector', 'process_ticket_selections' ); |
|
85 | - add_action( 'wp_loaded', array( 'EED_Ticket_Selector', 'set_definitions' ), 2 ); |
|
83 | + EE_Config::register_route('iframe', 'EED_Ticket_Selector', 'ticket_selector_iframe', 'ticket_selector'); |
|
84 | + EE_Config::register_route('process_ticket_selections', 'EED_Ticket_Selector', 'process_ticket_selections'); |
|
85 | + add_action('wp_loaded', array('EED_Ticket_Selector', 'set_definitions'), 2); |
|
86 | 86 | //add_action( 'AHEE_event_details_before_post', array( 'EED_Ticket_Selector', 'ticket_selector_form_open' ), 10, 1 ); |
87 | - add_action( 'AHEE_event_details_header_bottom', array( 'EED_Ticket_Selector', 'display_ticket_selector' ), 10, 1 ); |
|
87 | + add_action('AHEE_event_details_header_bottom', array('EED_Ticket_Selector', 'display_ticket_selector'), 10, 1); |
|
88 | 88 | //add_action( 'AHEE__ticket_selector_chart__template__after_ticket_selector', array( 'EED_Ticket_Selector', 'display_ticket_selector_submit' ), 10, 1 ); |
89 | 89 | //add_action( 'AHEE_event_details_after_post', array( 'EED_Ticket_Selector', 'ticket_selector_form_close' ), 10 ); |
90 | - add_action( 'wp_enqueue_scripts', array( 'EED_Ticket_Selector', 'load_tckt_slctr_assets' ), 10 ); |
|
90 | + add_action('wp_enqueue_scripts', array('EED_Ticket_Selector', 'load_tckt_slctr_assets'), 10); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | |
@@ -99,10 +99,10 @@ discard block |
||
99 | 99 | * @return void |
100 | 100 | */ |
101 | 101 | public static function set_hooks_admin() { |
102 | - add_action( 'wp_loaded', array( 'EED_Ticket_Selector', 'set_definitions' ), 2 ); |
|
102 | + add_action('wp_loaded', array('EED_Ticket_Selector', 'set_definitions'), 2); |
|
103 | 103 | //add button for iframe code to event editor. |
104 | - add_filter( 'get_sample_permalink_html', array( 'EED_Ticket_Selector', 'iframe_code_button' ), 10, 4 ); |
|
105 | - add_action( 'admin_enqueue_scripts', array( 'EED_Ticket_Selector', 'load_tckt_slctr_assets_admin' ), 10 ); |
|
104 | + add_filter('get_sample_permalink_html', array('EED_Ticket_Selector', 'iframe_code_button'), 10, 4); |
|
105 | + add_action('admin_enqueue_scripts', array('EED_Ticket_Selector', 'load_tckt_slctr_assets_admin'), 10); |
|
106 | 106 | } |
107 | 107 | |
108 | 108 | |
@@ -114,15 +114,15 @@ discard block |
||
114 | 114 | * @return void |
115 | 115 | */ |
116 | 116 | public static function set_definitions() { |
117 | - define( 'TICKET_SELECTOR_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS ); |
|
118 | - define( 'TICKET_SELECTOR_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS ); |
|
117 | + define('TICKET_SELECTOR_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS); |
|
118 | + define('TICKET_SELECTOR_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS); |
|
119 | 119 | |
120 | 120 | //if config is not set, initialize |
121 | 121 | //If config is not set, set it. |
122 | - if ( ! isset( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector ) ) { |
|
122 | + if ( ! isset(EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector)) { |
|
123 | 123 | EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector = new EE_Ticket_Selector_Config(); |
124 | 124 | } |
125 | - EE_Registry::$i18n_js_strings[ 'ts_embed_iframe_title' ] = __( 'Copy and Paste the following:', 'event_espresso' ); |
|
125 | + EE_Registry::$i18n_js_strings['ts_embed_iframe_title'] = __('Copy and Paste the following:', 'event_espresso'); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | * @param object $WP |
134 | 134 | * @return void |
135 | 135 | */ |
136 | - public function run( $WP ) {} |
|
136 | + public function run($WP) {} |
|
137 | 137 | |
138 | 138 | |
139 | 139 | /** |
@@ -145,23 +145,23 @@ discard block |
||
145 | 145 | public function ticket_selector_iframe() { |
146 | 146 | self::$_in_iframe = true; |
147 | 147 | /** @type EEM_Event $EEM_Event */ |
148 | - $EEM_Event = EE_Registry::instance()->load_model( 'Event' ); |
|
148 | + $EEM_Event = EE_Registry::instance()->load_model('Event'); |
|
149 | 149 | $event = $EEM_Event->get_one_by_ID( |
150 | - EE_Registry::instance()->REQ->get( 'event', 0 ) |
|
150 | + EE_Registry::instance()->REQ->get('event', 0) |
|
151 | 151 | ); |
152 | - EE_Registry::instance()->REQ->set_espresso_page( true ); |
|
153 | - $template_args['ticket_selector'] = EED_Ticket_Selector::display_ticket_selector( $event ); |
|
152 | + EE_Registry::instance()->REQ->set_espresso_page(true); |
|
153 | + $template_args['ticket_selector'] = EED_Ticket_Selector::display_ticket_selector($event); |
|
154 | 154 | $template_args['css'] = apply_filters( |
155 | 155 | 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__css', |
156 | 156 | array( |
157 | - TICKET_SELECTOR_ASSETS_URL . 'ticket_selector_embed.css?ver=' . EVENT_ESPRESSO_VERSION, |
|
158 | - TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css?ver=' . EVENT_ESPRESSO_VERSION, |
|
159 | - includes_url( 'css/dashicons.min.css?ver=' . $GLOBALS['wp_version'] ), |
|
160 | - EE_GLOBAL_ASSETS_URL . 'css/espresso_default.css?ver=' . EVENT_ESPRESSO_VERSION |
|
157 | + TICKET_SELECTOR_ASSETS_URL.'ticket_selector_embed.css?ver='.EVENT_ESPRESSO_VERSION, |
|
158 | + TICKET_SELECTOR_ASSETS_URL.'ticket_selector.css?ver='.EVENT_ESPRESSO_VERSION, |
|
159 | + includes_url('css/dashicons.min.css?ver='.$GLOBALS['wp_version']), |
|
160 | + EE_GLOBAL_ASSETS_URL.'css/espresso_default.css?ver='.EVENT_ESPRESSO_VERSION |
|
161 | 161 | ) |
162 | 162 | ); |
163 | - EE_Registry::$i18n_js_strings[ 'ticket_selector_iframe' ] = true; |
|
164 | - EE_Registry::$i18n_js_strings[ 'EEDTicketSelectorMsg' ] = __( 'Please choose at least one ticket before continuing.', 'event_espresso' ); |
|
163 | + EE_Registry::$i18n_js_strings['ticket_selector_iframe'] = true; |
|
164 | + EE_Registry::$i18n_js_strings['EEDTicketSelectorMsg'] = __('Please choose at least one ticket before continuing.', 'event_espresso'); |
|
165 | 165 | $template_args['eei18n'] = apply_filters( |
166 | 166 | 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__eei18n_js_strings', |
167 | 167 | EE_Registry::localize_i18n_js_strings() |
@@ -169,18 +169,18 @@ discard block |
||
169 | 169 | $template_args['js'] = apply_filters( |
170 | 170 | 'FHEE__EED_Ticket_Selector__ticket_selector_iframe__js', |
171 | 171 | array( |
172 | - includes_url( 'js/jquery/jquery.js?ver=' . $GLOBALS['wp_version'] ), |
|
173 | - EE_GLOBAL_ASSETS_URL . 'scripts/espresso_core.js?ver=' . EVENT_ESPRESSO_VERSION, |
|
174 | - TICKET_SELECTOR_ASSETS_URL . 'ticket_selector_iframe_embed.js?ver=' . EVENT_ESPRESSO_VERSION |
|
172 | + includes_url('js/jquery/jquery.js?ver='.$GLOBALS['wp_version']), |
|
173 | + EE_GLOBAL_ASSETS_URL.'scripts/espresso_core.js?ver='.EVENT_ESPRESSO_VERSION, |
|
174 | + TICKET_SELECTOR_ASSETS_URL.'ticket_selector_iframe_embed.js?ver='.EVENT_ESPRESSO_VERSION |
|
175 | 175 | ) |
176 | 176 | ); |
177 | - $template_args[ 'notices' ] = EEH_Template::display_template( |
|
178 | - EE_TEMPLATES . 'espresso-ajax-notices.template.php', |
|
177 | + $template_args['notices'] = EEH_Template::display_template( |
|
178 | + EE_TEMPLATES.'espresso-ajax-notices.template.php', |
|
179 | 179 | array(), |
180 | 180 | true |
181 | 181 | ); |
182 | 182 | EEH_Template::display_template( |
183 | - TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_selector_chart_iframe.template.php', |
|
183 | + TICKET_SELECTOR_TEMPLATES_PATH.'ticket_selector_chart_iframe.template.php', |
|
184 | 184 | $template_args |
185 | 185 | ); |
186 | 186 | exit; |
@@ -199,25 +199,25 @@ discard block |
||
199 | 199 | * |
200 | 200 | * @return string The new html string for the permalink area. |
201 | 201 | */ |
202 | - public static function iframe_code_button( $permalink_string, $id, $new_title, $new_slug ) { |
|
202 | + public static function iframe_code_button($permalink_string, $id, $new_title, $new_slug) { |
|
203 | 203 | //make sure this is ONLY when editing and the event id has been set. |
204 | - if ( ! empty( $id ) ) { |
|
205 | - $post = get_post( $id ); |
|
204 | + if ( ! empty($id)) { |
|
205 | + $post = get_post($id); |
|
206 | 206 | //if NOT event then let's get out. |
207 | - if ( $post->post_type !== 'espresso_events' ) { |
|
207 | + if ($post->post_type !== 'espresso_events') { |
|
208 | 208 | return $permalink_string; |
209 | 209 | } |
210 | 210 | $permalink_string .= '<a id="js-ticket-selector-embed-trigger" class="button button-small" href="#" tabindex="-1">' |
211 | - . __( 'Embed', 'event_espresso' ) |
|
211 | + . __('Embed', 'event_espresso') |
|
212 | 212 | . '</a> '; |
213 | - $ticket_selector_url = add_query_arg( array( 'ticket_selector' => 'iframe', 'event' => $id ), site_url() ); |
|
213 | + $ticket_selector_url = add_query_arg(array('ticket_selector' => 'iframe', 'event' => $id), site_url()); |
|
214 | 214 | $iframe_string = esc_html( |
215 | - '<iframe src="' . $ticket_selector_url . '" width="100%" height="100%"></iframe>' |
|
215 | + '<iframe src="'.$ticket_selector_url.'" width="100%" height="100%"></iframe>' |
|
216 | 216 | ); |
217 | 217 | $permalink_string .= ' |
218 | 218 | <div id="js-ts-iframe" style="display:none"> |
219 | 219 | <div style="width:100%; height: 500px;"> |
220 | - ' . $iframe_string . ' |
|
220 | + ' . $iframe_string.' |
|
221 | 221 | </div> |
222 | 222 | </div>'; |
223 | 223 | } |
@@ -236,22 +236,22 @@ discard block |
||
236 | 236 | * @param mixed $event |
237 | 237 | * @return bool |
238 | 238 | */ |
239 | - protected static function set_event( $event = null ) { |
|
240 | - if( $event === null ) { |
|
239 | + protected static function set_event($event = null) { |
|
240 | + if ($event === null) { |
|
241 | 241 | global $post; |
242 | 242 | $event = $post; |
243 | 243 | } |
244 | - if ( $event instanceof EE_Event ) { |
|
244 | + if ($event instanceof EE_Event) { |
|
245 | 245 | self::$_event = $event; |
246 | - } else if ( $event instanceof WP_Post && isset( $event->EE_Event ) && $event->EE_Event instanceof EE_Event ) { |
|
246 | + } else if ($event instanceof WP_Post && isset($event->EE_Event) && $event->EE_Event instanceof EE_Event) { |
|
247 | 247 | self::$_event = $event->EE_Event; |
248 | - } else if ( $event instanceof WP_Post && $event->post_type == 'espresso_events' ) { |
|
249 | - $event->EE_Event = EEM_Event::instance()->instantiate_class_from_post_object( $event ); |
|
248 | + } else if ($event instanceof WP_Post && $event->post_type == 'espresso_events') { |
|
249 | + $event->EE_Event = EEM_Event::instance()->instantiate_class_from_post_object($event); |
|
250 | 250 | self::$_event = $event->EE_Event; |
251 | 251 | } else { |
252 | - $user_msg = __( 'No Event object or an invalid Event object was supplied.', 'event_espresso' ); |
|
253 | - $dev_msg = $user_msg . __( 'In order to generate a ticket selector, please ensure you are passing either an EE_Event object or a WP_Post object of the post type "espresso_event" to the EE_Ticket_Selector class constructor.', 'event_espresso' ); |
|
254 | - EE_Error::add_error( $user_msg . '||' . $dev_msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
252 | + $user_msg = __('No Event object or an invalid Event object was supplied.', 'event_espresso'); |
|
253 | + $dev_msg = $user_msg.__('In order to generate a ticket selector, please ensure you are passing either an EE_Event object or a WP_Post object of the post type "espresso_event" to the EE_Ticket_Selector class constructor.', 'event_espresso'); |
|
254 | + EE_Error::add_error($user_msg.'||'.$dev_msg, __FILE__, __FUNCTION__, __LINE__); |
|
255 | 255 | return false; |
256 | 256 | } |
257 | 257 | return true; |
@@ -270,11 +270,11 @@ discard block |
||
270 | 270 | * @param bool $view_details |
271 | 271 | * @return string |
272 | 272 | */ |
273 | - public static function display_ticket_selector( $event = NULL, $view_details = FALSE ) { |
|
273 | + public static function display_ticket_selector($event = NULL, $view_details = FALSE) { |
|
274 | 274 | // reset filter for displaying submit button |
275 | - remove_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' ); |
|
275 | + remove_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
276 | 276 | // poke and prod incoming event till it tells us what it is |
277 | - if ( ! EED_Ticket_Selector::set_event( $event )) { |
|
277 | + if ( ! EED_Ticket_Selector::set_event($event)) { |
|
278 | 278 | return false; |
279 | 279 | } |
280 | 280 | $event_post = self::$_event instanceof EE_Event ? self::$_event->ID() : $event; |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | && ( |
286 | 286 | ! self::$_event->display_ticket_selector() |
287 | 287 | || $view_details |
288 | - || post_password_required( $event_post ) |
|
288 | + || post_password_required($event_post) |
|
289 | 289 | || ( |
290 | 290 | $_event_active_status != EE_Datetime::active |
291 | 291 | && $_event_active_status != EE_Datetime::upcoming |
@@ -303,68 +303,68 @@ discard block |
||
303 | 303 | $template_args = array(); |
304 | 304 | $template_args['event_status'] = $_event_active_status; |
305 | 305 | |
306 | - $template_args['date_format'] = apply_filters( 'FHEE__EED_Ticket_Selector__display_ticket_selector__date_format', get_option( 'date_format' ) ); |
|
307 | - $template_args['time_format'] = apply_filters( 'FHEE__EED_Ticket_Selector__display_ticket_selector__time_format', get_option( 'time_format' ) ); |
|
306 | + $template_args['date_format'] = apply_filters('FHEE__EED_Ticket_Selector__display_ticket_selector__date_format', get_option('date_format')); |
|
307 | + $template_args['time_format'] = apply_filters('FHEE__EED_Ticket_Selector__display_ticket_selector__time_format', get_option('time_format')); |
|
308 | 308 | |
309 | 309 | $template_args['EVT_ID'] = self::$_event->ID(); |
310 | 310 | $template_args['event'] = self::$_event; |
311 | 311 | |
312 | 312 | // is the event expired ? |
313 | 313 | $template_args['event_is_expired'] = self::$_event->is_expired(); |
314 | - if ( $template_args['event_is_expired'] ) { |
|
315 | - return '<div class="ee-event-expired-notice"><span class="important-notice">' . __( 'We\'re sorry, but all tickets sales have ended because the event is expired.', 'event_espresso' ) . '</span></div>'; |
|
314 | + if ($template_args['event_is_expired']) { |
|
315 | + return '<div class="ee-event-expired-notice"><span class="important-notice">'.__('We\'re sorry, but all tickets sales have ended because the event is expired.', 'event_espresso').'</span></div>'; |
|
316 | 316 | } |
317 | 317 | |
318 | 318 | $ticket_query_args = array( |
319 | - array( 'Datetime.EVT_ID' => self::$_event->ID() ), |
|
320 | - 'order_by' => array( 'TKT_order' => 'ASC', 'TKT_required' => 'DESC', 'TKT_start_date' => 'ASC', 'TKT_end_date' => 'ASC' , 'Datetime.DTT_EVT_start' => 'DESC' ) |
|
319 | + array('Datetime.EVT_ID' => self::$_event->ID()), |
|
320 | + 'order_by' => array('TKT_order' => 'ASC', 'TKT_required' => 'DESC', 'TKT_start_date' => 'ASC', 'TKT_end_date' => 'ASC', 'Datetime.DTT_EVT_start' => 'DESC') |
|
321 | 321 | ); |
322 | 322 | |
323 | - if ( ! EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets ) { |
|
323 | + if ( ! EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector->show_expired_tickets) { |
|
324 | 324 | //use the correct applicable time query depending on what version of core is being run. |
325 | - $current_time = method_exists( 'EEM_Datetime', 'current_time_for_query' ) ? time() : current_time('timestamp'); |
|
326 | - $ticket_query_args[0]['TKT_end_date'] = array( '>', $current_time ); |
|
325 | + $current_time = method_exists('EEM_Datetime', 'current_time_for_query') ? time() : current_time('timestamp'); |
|
326 | + $ticket_query_args[0]['TKT_end_date'] = array('>', $current_time); |
|
327 | 327 | } |
328 | 328 | |
329 | 329 | // get all tickets for this event ordered by the datetime |
330 | - $template_args['tickets'] = EEM_Ticket::instance()->get_all( $ticket_query_args ); |
|
330 | + $template_args['tickets'] = EEM_Ticket::instance()->get_all($ticket_query_args); |
|
331 | 331 | |
332 | - if ( count( $template_args['tickets'] ) < 1 ) { |
|
333 | - return '<div class="ee-event-expired-notice"><span class="important-notice">' . __( 'We\'re sorry, but all ticket sales have ended.', 'event_espresso' ) . '</span></div>'; |
|
332 | + if (count($template_args['tickets']) < 1) { |
|
333 | + return '<div class="ee-event-expired-notice"><span class="important-notice">'.__('We\'re sorry, but all ticket sales have ended.', 'event_espresso').'</span></div>'; |
|
334 | 334 | } |
335 | 335 | |
336 | 336 | // filter the maximum qty that can appear in the Ticket Selector qty dropdowns |
337 | - $template_args['max_atndz'] = apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector__max_tickets', self::$_event->additional_limit() ); |
|
338 | - if ( $template_args['max_atndz'] < 1 ) { |
|
339 | - $sales_closed_msg = __( 'We\'re sorry, but ticket sales have been closed at this time. Please check back again later.', 'event_espresso' ); |
|
340 | - if ( current_user_can( 'edit_post', self::$_event->ID() )) { |
|
341 | - $sales_closed_msg .= sprintf( |
|
342 | - __( '%sNote to Event Admin:%sThe "Maximum number of tickets allowed per order for this event" in the Event Registration Options has been set to "0". This effectively turns off ticket sales. %s(click to edit this event)%s', 'event_espresso' ), |
|
337 | + $template_args['max_atndz'] = apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector__max_tickets', self::$_event->additional_limit()); |
|
338 | + if ($template_args['max_atndz'] < 1) { |
|
339 | + $sales_closed_msg = __('We\'re sorry, but ticket sales have been closed at this time. Please check back again later.', 'event_espresso'); |
|
340 | + if (current_user_can('edit_post', self::$_event->ID())) { |
|
341 | + $sales_closed_msg .= sprintf( |
|
342 | + __('%sNote to Event Admin:%sThe "Maximum number of tickets allowed per order for this event" in the Event Registration Options has been set to "0". This effectively turns off ticket sales. %s(click to edit this event)%s', 'event_espresso'), |
|
343 | 343 | '<div class="ee-attention" style="text-align: left;"><b>', |
344 | 344 | '</b><br />', |
345 | - $link = '<span class="edit-link"><a class="post-edit-link" href="' . get_edit_post_link( self::$_event->ID() ) . '">', |
|
345 | + $link = '<span class="edit-link"><a class="post-edit-link" href="'.get_edit_post_link(self::$_event->ID()).'">', |
|
346 | 346 | '</a></span></div>' |
347 | 347 | ); |
348 | 348 | } |
349 | - return '<p><span class="important-notice">' . $sales_closed_msg . '</span></p>'; |
|
349 | + return '<p><span class="important-notice">'.$sales_closed_msg.'</span></p>'; |
|
350 | 350 | } |
351 | 351 | |
352 | - $templates['ticket_selector'] = TICKET_SELECTOR_TEMPLATES_PATH . 'ticket_selector_chart.template.php'; |
|
353 | - $templates['ticket_selector'] = apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector__template_path', $templates['ticket_selector'], self::$_event ); |
|
352 | + $templates['ticket_selector'] = TICKET_SELECTOR_TEMPLATES_PATH.'ticket_selector_chart.template.php'; |
|
353 | + $templates['ticket_selector'] = apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector__template_path', $templates['ticket_selector'], self::$_event); |
|
354 | 354 | |
355 | 355 | // redirecting to another site for registration ?? |
356 | 356 | $external_url = self::$_event->external_url() !== NULL || self::$_event->external_url() !== '' ? self::$_event->external_url() : FALSE; |
357 | 357 | // set up the form (but not for the admin) |
358 | - $ticket_selector = ! is_admin() ? EED_Ticket_Selector::ticket_selector_form_open( self::$_event->ID(), $external_url ) : ''; |
|
358 | + $ticket_selector = ! is_admin() ? EED_Ticket_Selector::ticket_selector_form_open(self::$_event->ID(), $external_url) : ''; |
|
359 | 359 | // if not redirecting to another site for registration |
360 | - if ( ! $external_url ) { |
|
360 | + if ( ! $external_url) { |
|
361 | 361 | // then display the ticket selector |
362 | - $ticket_selector .= EEH_Template::locate_template( $templates['ticket_selector'], $template_args ); |
|
362 | + $ticket_selector .= EEH_Template::locate_template($templates['ticket_selector'], $template_args); |
|
363 | 363 | } else { |
364 | 364 | // if not we still need to trigger the display of the submit button |
365 | - add_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' ); |
|
365 | + add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
366 | 366 | //display notice to admin that registration is external |
367 | - $ticket_selector .= ! is_admin() ? '' : __( 'Registration is at an external URL for this event.', 'event_espresso' ); |
|
367 | + $ticket_selector .= ! is_admin() ? '' : __('Registration is at an external URL for this event.', 'event_espresso'); |
|
368 | 368 | } |
369 | 369 | // submit button and form close tag |
370 | 370 | $ticket_selector .= ! is_admin() ? EED_Ticket_Selector::display_ticket_selector_submit() : ''; |
@@ -384,25 +384,25 @@ discard block |
||
384 | 384 | * @param string $external_url |
385 | 385 | * @return string |
386 | 386 | */ |
387 | - public static function ticket_selector_form_open( $ID = 0, $external_url = '' ) { |
|
387 | + public static function ticket_selector_form_open($ID = 0, $external_url = '') { |
|
388 | 388 | // if redirecting, we don't need any anything else |
389 | - if ( $external_url ) { |
|
390 | - $html = '<form method="GET" action="' . EEH_URL::refactor_url( $external_url ) . '">'; |
|
391 | - $query_args = EEH_URL::get_query_string( $external_url ); |
|
392 | - foreach ( $query_args as $query_arg => $value ) { |
|
393 | - $html .= '<input type="hidden" name="' . $query_arg . '" value="' . $value . '">'; |
|
389 | + if ($external_url) { |
|
390 | + $html = '<form method="GET" action="'.EEH_URL::refactor_url($external_url).'">'; |
|
391 | + $query_args = EEH_URL::get_query_string($external_url); |
|
392 | + foreach ($query_args as $query_arg => $value) { |
|
393 | + $html .= '<input type="hidden" name="'.$query_arg.'" value="'.$value.'">'; |
|
394 | 394 | } |
395 | 395 | return $html; |
396 | 396 | } |
397 | - $checkout_url = EEH_Event_View::event_link_url( $ID ); |
|
398 | - if ( ! $checkout_url ) { |
|
399 | - EE_Error::add_error( __('The URL for the Event Details page could not be retrieved.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
397 | + $checkout_url = EEH_Event_View::event_link_url($ID); |
|
398 | + if ( ! $checkout_url) { |
|
399 | + EE_Error::add_error(__('The URL for the Event Details page could not be retrieved.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
400 | 400 | } |
401 | 401 | $extra_params = self::$_in_iframe ? ' target="_blank"' : ''; |
402 | - $html = '<form method="POST" action="' . $checkout_url . '"' . $extra_params . '>'; |
|
403 | - $html .= wp_nonce_field( 'process_ticket_selections', 'process_ticket_selections_nonce', TRUE, FALSE ); |
|
402 | + $html = '<form method="POST" action="'.$checkout_url.'"'.$extra_params.'>'; |
|
403 | + $html .= wp_nonce_field('process_ticket_selections', 'process_ticket_selections_nonce', TRUE, FALSE); |
|
404 | 404 | $html .= '<input type="hidden" name="ee" value="process_ticket_selections">'; |
405 | - $html = apply_filters( 'FHEE__EE_Ticket_Selector__ticket_selector_form_open__html', $html, self::$_event ); |
|
405 | + $html = apply_filters('FHEE__EE_Ticket_Selector__ticket_selector_form_open__html', $html, self::$_event); |
|
406 | 406 | return $html; |
407 | 407 | } |
408 | 408 | |
@@ -417,28 +417,28 @@ discard block |
||
417 | 417 | * @return string |
418 | 418 | */ |
419 | 419 | public static function display_ticket_selector_submit() { |
420 | - if ( ! is_admin() ) { |
|
421 | - if ( apply_filters( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', FALSE ) ) { |
|
420 | + if ( ! is_admin()) { |
|
421 | + if (apply_filters('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', FALSE)) { |
|
422 | 422 | $btn_text = apply_filters( |
423 | 423 | 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit__btn_text', |
424 | - __('Register Now', 'event_espresso' ), |
|
424 | + __('Register Now', 'event_espresso'), |
|
425 | 425 | self::$_event |
426 | 426 | ); |
427 | 427 | $external_url = self::$_event->external_url(); |
428 | - $html = '<input id="ticket-selector-submit-'. self::$_event->ID() .'-btn"'; |
|
428 | + $html = '<input id="ticket-selector-submit-'.self::$_event->ID().'-btn"'; |
|
429 | 429 | $html .= ' class="ticket-selector-submit-btn '; |
430 | - $html .= empty( $external_url ) ? 'ticket-selector-submit-ajax"' : '"'; |
|
431 | - $html .= ' type="submit" value="' . $btn_text . '" />'; |
|
432 | - $html .= apply_filters( 'FHEE__EE_Ticket_Selector__after_ticket_selector_submit', '', self::$_event ); |
|
430 | + $html .= empty($external_url) ? 'ticket-selector-submit-ajax"' : '"'; |
|
431 | + $html .= ' type="submit" value="'.$btn_text.'" />'; |
|
432 | + $html .= apply_filters('FHEE__EE_Ticket_Selector__after_ticket_selector_submit', '', self::$_event); |
|
433 | 433 | $html .= '<div class="clear"><br/></div></form>'; |
434 | 434 | return $html; |
435 | - } else if ( is_archive() ) { |
|
436 | - return EED_Ticket_Selector::ticket_selector_form_close() . EED_Ticket_Selector::display_view_details_btn(); |
|
435 | + } else if (is_archive()) { |
|
436 | + return EED_Ticket_Selector::ticket_selector_form_close().EED_Ticket_Selector::display_view_details_btn(); |
|
437 | 437 | } else { |
438 | 438 | $html = apply_filters( |
439 | 439 | 'FHEE__EE_Ticket_Selector__no_ticket_selector_submit', |
440 | 440 | sprintf( |
441 | - __( '%1$sSold Out%2$s', 'event_espresso' ), |
|
441 | + __('%1$sSold Out%2$s', 'event_espresso'), |
|
442 | 442 | '<h2 class="no-ticket-selector-h2 pink-text">', |
443 | 443 | '</h2>' |
444 | 444 | ), |
@@ -477,13 +477,13 @@ discard block |
||
477 | 477 | * @return string |
478 | 478 | */ |
479 | 479 | public static function display_view_details_btn() { |
480 | - if ( ! self::$_event->get_permalink() ) { |
|
481 | - EE_Error::add_error( __('The URL for the Event Details page could not be retrieved.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
480 | + if ( ! self::$_event->get_permalink()) { |
|
481 | + EE_Error::add_error(__('The URL for the Event Details page could not be retrieved.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
482 | 482 | } |
483 | - $view_details_btn = '<form method="POST" action="' . self::$_event->get_permalink() . '">'; |
|
484 | - $btn_text = apply_filters( 'FHEE__EE_Ticket_Selector__display_view_details_btn__btn_text', __( 'View Details', 'event_espresso' ), self::$_event ); |
|
485 | - $view_details_btn .= '<input id="ticket-selector-submit-'. self::$_event->ID() .'-btn" class="ticket-selector-submit-btn view-details-btn" type="submit" value="' . $btn_text . '" />'; |
|
486 | - $view_details_btn .= apply_filters( 'FHEE__EE_Ticket_Selector__after_view_details_btn', '', self::$_event ); |
|
483 | + $view_details_btn = '<form method="POST" action="'.self::$_event->get_permalink().'">'; |
|
484 | + $btn_text = apply_filters('FHEE__EE_Ticket_Selector__display_view_details_btn__btn_text', __('View Details', 'event_espresso'), self::$_event); |
|
485 | + $view_details_btn .= '<input id="ticket-selector-submit-'.self::$_event->ID().'-btn" class="ticket-selector-submit-btn view-details-btn" type="submit" value="'.$btn_text.'" />'; |
|
486 | + $view_details_btn .= apply_filters('FHEE__EE_Ticket_Selector__after_view_details_btn', '', self::$_event); |
|
487 | 487 | $view_details_btn .= '<div class="clear"><br/></div>'; |
488 | 488 | $view_details_btn .= '</form>'; |
489 | 489 | return $view_details_btn; |
@@ -501,11 +501,11 @@ discard block |
||
501 | 501 | * @return array|boolean |
502 | 502 | */ |
503 | 503 | public function process_ticket_selections() { |
504 | - do_action( 'EED_Ticket_Selector__process_ticket_selections__before' ); |
|
504 | + do_action('EED_Ticket_Selector__process_ticket_selections__before'); |
|
505 | 505 | // check nonce |
506 | - if ( ! is_admin() && ( ! EE_Registry::instance()->REQ->is_set( 'process_ticket_selections_nonce' ) || ! wp_verify_nonce( EE_Registry::instance()->REQ->get( 'process_ticket_selections_nonce' ), 'process_ticket_selections' ))) { |
|
506 | + if ( ! is_admin() && ( ! EE_Registry::instance()->REQ->is_set('process_ticket_selections_nonce') || ! wp_verify_nonce(EE_Registry::instance()->REQ->get('process_ticket_selections_nonce'), 'process_ticket_selections'))) { |
|
507 | 507 | EE_Error::add_error( |
508 | - sprintf( __( 'We\'re sorry but your request failed to pass a security check.%sPlease click the back button on your browser and try again.', 'event_espresso' ), '<br/>' ), |
|
508 | + sprintf(__('We\'re sorry but your request failed to pass a security check.%sPlease click the back button on your browser and try again.', 'event_espresso'), '<br/>'), |
|
509 | 509 | __FILE__, __FUNCTION__, __LINE__ |
510 | 510 | ); |
511 | 511 | return FALSE; |
@@ -519,16 +519,16 @@ discard block |
||
519 | 519 | |
520 | 520 | //we should really only have 1 registration in the works now (ie, no MER) so clear any previous items in the cart. |
521 | 521 | // When MER happens this will probably need to be tweaked, possibly wrapped in a conditional checking for some constant defined in MER etc. |
522 | - EE_Registry::instance()->load_core( 'Session' ); |
|
522 | + EE_Registry::instance()->load_core('Session'); |
|
523 | 523 | // unless otherwise requested, clear the session |
524 | - if ( apply_filters( 'FHEE__EE_Ticket_Selector__process_ticket_selections__clear_session', TRUE )) { |
|
525 | - EE_Registry::instance()->SSN->clear_session( __CLASS__, __FUNCTION__ ); |
|
524 | + if (apply_filters('FHEE__EE_Ticket_Selector__process_ticket_selections__clear_session', TRUE)) { |
|
525 | + EE_Registry::instance()->SSN->clear_session(__CLASS__, __FUNCTION__); |
|
526 | 526 | } |
527 | 527 | //d( EE_Registry::instance()->SSN ); |
528 | 528 | |
529 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
529 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
530 | 530 | // do we have an event id? |
531 | - if ( EE_Registry::instance()->REQ->is_set( 'tkt-slctr-event-id' ) ) { |
|
531 | + if (EE_Registry::instance()->REQ->is_set('tkt-slctr-event-id')) { |
|
532 | 532 | // validate/sanitize data |
533 | 533 | $valid = self::_validate_post_data(); |
534 | 534 | |
@@ -538,41 +538,41 @@ discard block |
||
538 | 538 | //EEH_Debug_Tools::printr( $valid[ 'max_atndz' ], 'max_atndz', __FILE__, __LINE__ ); |
539 | 539 | |
540 | 540 | //check total tickets ordered vs max number of attendees that can register |
541 | - if ( $valid['total_tickets'] > $valid['max_atndz'] ) { |
|
541 | + if ($valid['total_tickets'] > $valid['max_atndz']) { |
|
542 | 542 | |
543 | 543 | // ordering too many tickets !!! |
544 | 544 | $total_tickets_string = _n('You have attempted to purchase %s ticket.', 'You have attempted to purchase %s tickets.', $valid['total_tickets'], 'event_espresso'); |
545 | - $limit_error_1 = sprintf( $total_tickets_string, $valid['total_tickets'] ); |
|
545 | + $limit_error_1 = sprintf($total_tickets_string, $valid['total_tickets']); |
|
546 | 546 | // dev only message |
547 | 547 | $max_atndz_string = _n('The registration limit for this event is %s ticket per registration, therefore the total number of tickets you may purchase at a time can not exceed %s.', 'The registration limit for this event is %s tickets per registration, therefore the total number of tickets you may purchase at a time can not exceed %s.', $valid['max_atndz'], 'event_espresso'); |
548 | - $limit_error_2 = sprintf( $max_atndz_string, $valid['max_atndz'], $valid['max_atndz'] ); |
|
549 | - EE_Error::add_error( $limit_error_1 . '<br/>' . $limit_error_2, __FILE__, __FUNCTION__, __LINE__ ); |
|
548 | + $limit_error_2 = sprintf($max_atndz_string, $valid['max_atndz'], $valid['max_atndz']); |
|
549 | + EE_Error::add_error($limit_error_1.'<br/>'.$limit_error_2, __FILE__, __FUNCTION__, __LINE__); |
|
550 | 550 | } else { |
551 | 551 | |
552 | 552 | // all data appears to be valid |
553 | 553 | $tckts_slctd = FALSE; |
554 | 554 | $success = TRUE; |
555 | 555 | // load cart |
556 | - EE_Registry::instance()->load_core( 'Cart' ); |
|
556 | + EE_Registry::instance()->load_core('Cart'); |
|
557 | 557 | |
558 | 558 | // cycle thru the number of data rows sent from the event listing |
559 | - for ( $x = 0; $x < $valid['rows']; $x++ ) { |
|
559 | + for ($x = 0; $x < $valid['rows']; $x++) { |
|
560 | 560 | // does this row actually contain a ticket quantity? |
561 | - if ( isset( $valid['qty'][$x] ) && $valid['qty'][$x] > 0 ) { |
|
561 | + if (isset($valid['qty'][$x]) && $valid['qty'][$x] > 0) { |
|
562 | 562 | // YES we have a ticket quantity |
563 | 563 | $tckts_slctd = TRUE; |
564 | 564 | // d( $valid['ticket_obj'][$x] ); |
565 | - if ( $valid['ticket_obj'][$x] instanceof EE_Ticket ) { |
|
565 | + if ($valid['ticket_obj'][$x] instanceof EE_Ticket) { |
|
566 | 566 | // then add ticket to cart |
567 | - $ticket_added = self::_add_ticket_to_cart( $valid['ticket_obj'][$x], $valid['qty'][$x] ); |
|
567 | + $ticket_added = self::_add_ticket_to_cart($valid['ticket_obj'][$x], $valid['qty'][$x]); |
|
568 | 568 | $success = ! $ticket_added ? FALSE : $success; |
569 | - if ( EE_Error::has_error() ) { |
|
569 | + if (EE_Error::has_error()) { |
|
570 | 570 | break; |
571 | 571 | } |
572 | 572 | } else { |
573 | 573 | // nothing added to cart retrieved |
574 | 574 | EE_Error::add_error( |
575 | - sprintf( __( 'A valid ticket could not be retrieved for the event.%sPlease click the back button on your browser and try again.', 'event_espresso' ), '<br/>' ), |
|
575 | + sprintf(__('A valid ticket could not be retrieved for the event.%sPlease click the back button on your browser and try again.', 'event_espresso'), '<br/>'), |
|
576 | 576 | __FILE__, __FUNCTION__, __LINE__ |
577 | 577 | ); |
578 | 578 | } |
@@ -581,45 +581,45 @@ discard block |
||
581 | 581 | //d( EE_Registry::instance()->CART ); |
582 | 582 | //die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< KILL REDIRECT HERE BEFORE CART UPDATE |
583 | 583 | |
584 | - if ( $tckts_slctd ) { |
|
585 | - if ( $success ) { |
|
586 | - do_action( 'FHEE__EE_Ticket_Selector__process_ticket_selections__before_redirecting_to_checkout', EE_Registry::instance()->CART, $this ); |
|
584 | + if ($tckts_slctd) { |
|
585 | + if ($success) { |
|
586 | + do_action('FHEE__EE_Ticket_Selector__process_ticket_selections__before_redirecting_to_checkout', EE_Registry::instance()->CART, $this); |
|
587 | 587 | EE_Registry::instance()->CART->recalculate_all_cart_totals(); |
588 | - EE_Registry::instance()->CART->save_cart( FALSE ); |
|
588 | + EE_Registry::instance()->CART->save_cart(FALSE); |
|
589 | 589 | EE_Registry::instance()->SSN->update(); |
590 | 590 | //d( EE_Registry::instance()->CART ); |
591 | 591 | //die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< OR HERE TO KILL REDIRECT AFTER CART UPDATE |
592 | 592 | // just return TRUE for registrations being made from admin |
593 | - if ( is_admin() ) { |
|
593 | + if (is_admin()) { |
|
594 | 594 | return TRUE; |
595 | 595 | } |
596 | - wp_safe_redirect( apply_filters( 'FHEE__EE_Ticket_Selector__process_ticket_selections__success_redirect_url', EE_Registry::instance()->CFG->core->reg_page_url() )); |
|
596 | + wp_safe_redirect(apply_filters('FHEE__EE_Ticket_Selector__process_ticket_selections__success_redirect_url', EE_Registry::instance()->CFG->core->reg_page_url())); |
|
597 | 597 | exit(); |
598 | 598 | |
599 | 599 | } else { |
600 | - if ( ! EE_Error::has_error() ) { |
|
600 | + if ( ! EE_Error::has_error()) { |
|
601 | 601 | // nothing added to cart |
602 | - EE_Error::add_attention( __( 'No tickets were added for the event', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
602 | + EE_Error::add_attention(__('No tickets were added for the event', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
603 | 603 | } |
604 | 604 | } |
605 | 605 | |
606 | 606 | } else { |
607 | 607 | // no ticket quantities were selected |
608 | - EE_Error::add_error( __( 'You need to select a ticket quantity before you can proceed.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
608 | + EE_Error::add_error(__('You need to select a ticket quantity before you can proceed.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
609 | 609 | } |
610 | 610 | } |
611 | 611 | //die(); // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< KILL BEFORE REDIRECT |
612 | 612 | // at this point, just return if registration is being made from admin |
613 | - if ( is_admin() ) { |
|
613 | + if (is_admin()) { |
|
614 | 614 | return FALSE; |
615 | 615 | } |
616 | - if ( $valid['return_url'] ) { |
|
617 | - EE_Error::get_notices( FALSE, TRUE ); |
|
618 | - wp_safe_redirect( $valid['return_url'] ); |
|
616 | + if ($valid['return_url']) { |
|
617 | + EE_Error::get_notices(FALSE, TRUE); |
|
618 | + wp_safe_redirect($valid['return_url']); |
|
619 | 619 | exit(); |
620 | - } elseif ( isset( $event_to_add['id'] )) { |
|
621 | - EE_Error::get_notices( FALSE, TRUE ); |
|
622 | - wp_safe_redirect( get_permalink( $event_to_add['id'] )); |
|
620 | + } elseif (isset($event_to_add['id'])) { |
|
621 | + EE_Error::get_notices(FALSE, TRUE); |
|
622 | + wp_safe_redirect(get_permalink($event_to_add['id'])); |
|
623 | 623 | exit(); |
624 | 624 | } else { |
625 | 625 | echo EE_Error::get_notices(); |
@@ -628,7 +628,7 @@ discard block |
||
628 | 628 | } else { |
629 | 629 | // $_POST['tkt-slctr-event-id'] was not set ?!?!?!? |
630 | 630 | EE_Error::add_error( |
631 | - sprintf( __( 'An event id was not provided or was not received.%sPlease click the back button on your browser and try again.', 'event_espresso' ), '<br/>' ), |
|
631 | + sprintf(__('An event id was not provided or was not received.%sPlease click the back button on your browser and try again.', 'event_espresso'), '<br/>'), |
|
632 | 632 | __FILE__, __FUNCTION__, __LINE__ |
633 | 633 | ); |
634 | 634 | } |
@@ -646,18 +646,18 @@ discard block |
||
646 | 646 | * @return array or FALSE |
647 | 647 | */ |
648 | 648 | private static function _validate_post_data() { |
649 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
649 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
650 | 650 | |
651 | 651 | // start with an empty array() |
652 | 652 | $valid_data = array(); |
653 | 653 | // d( $_POST ); |
654 | 654 | //if event id is valid |
655 | - $id = absint( EE_Registry::instance()->REQ->get( 'tkt-slctr-event-id' )); |
|
656 | - if ( $id ) { |
|
655 | + $id = absint(EE_Registry::instance()->REQ->get('tkt-slctr-event-id')); |
|
656 | + if ($id) { |
|
657 | 657 | // grab valid id |
658 | 658 | $valid_data['id'] = $id; |
659 | 659 | // grab and sanitize return-url |
660 | - $valid_data['return_url'] = esc_url_raw( EE_Registry::instance()->REQ->get( 'tkt-slctr-return-url-' . $id )); |
|
660 | + $valid_data['return_url'] = esc_url_raw(EE_Registry::instance()->REQ->get('tkt-slctr-return-url-'.$id)); |
|
661 | 661 | // array of other form names |
662 | 662 | $inputs_to_clean = array( |
663 | 663 | 'event_id' => 'tkt-slctr-event-id', |
@@ -670,22 +670,22 @@ discard block |
||
670 | 670 | // let's track the total number of tickets ordered.' |
671 | 671 | $valid_data['total_tickets'] = 0; |
672 | 672 | // cycle through $inputs_to_clean array |
673 | - foreach ( $inputs_to_clean as $what => $input_to_clean ) { |
|
673 | + foreach ($inputs_to_clean as $what => $input_to_clean) { |
|
674 | 674 | // check for POST data |
675 | - if ( EE_Registry::instance()->REQ->is_set( $input_to_clean . $id )) { |
|
675 | + if (EE_Registry::instance()->REQ->is_set($input_to_clean.$id)) { |
|
676 | 676 | // grab value |
677 | - $input_value = EE_Registry::instance()->REQ->get( $input_to_clean . $id ); |
|
677 | + $input_value = EE_Registry::instance()->REQ->get($input_to_clean.$id); |
|
678 | 678 | switch ($what) { |
679 | 679 | |
680 | 680 | // integers |
681 | 681 | case 'event_id': |
682 | - $valid_data[$what] = absint( $input_value ); |
|
682 | + $valid_data[$what] = absint($input_value); |
|
683 | 683 | // get event via the event id we put in the form |
684 | - $valid_data['event'] = EE_Registry::instance()->load_model( 'Event' )->get_one_by_ID( $valid_data['event_id'] ); |
|
684 | + $valid_data['event'] = EE_Registry::instance()->load_model('Event')->get_one_by_ID($valid_data['event_id']); |
|
685 | 685 | break; |
686 | 686 | case 'rows': |
687 | 687 | case 'max_atndz': |
688 | - $valid_data[$what] = absint( $input_value ); |
|
688 | + $valid_data[$what] = absint($input_value); |
|
689 | 689 | break; |
690 | 690 | |
691 | 691 | // arrays of integers |
@@ -693,27 +693,27 @@ discard block |
||
693 | 693 | // d( $input_value ); |
694 | 694 | $row_qty = $input_value; |
695 | 695 | // if qty is coming from a radio button input, then we need to assemble an array of rows |
696 | - if( ! is_array( $row_qty )) { |
|
696 | + if ( ! is_array($row_qty)) { |
|
697 | 697 | // get number of rows |
698 | - $rows = EE_Registry::instance()->REQ->is_set( 'tkt-slctr-rows-' . $id ) ? absint( EE_Registry::instance()->REQ->get( 'tkt-slctr-rows-' . $id )) : 1; |
|
698 | + $rows = EE_Registry::instance()->REQ->is_set('tkt-slctr-rows-'.$id) ? absint(EE_Registry::instance()->REQ->get('tkt-slctr-rows-'.$id)) : 1; |
|
699 | 699 | // d( $rows ); |
700 | 700 | // explode ints by the dash |
701 | - $row_qty = explode( '-', $row_qty ); |
|
702 | - $row = isset( $row_qty[0] ) ? ( absint( $row_qty[0] )) : 1; |
|
703 | - $qty = isset( $row_qty[1] ) ? absint( $row_qty[1] ) : 0; |
|
704 | - $row_qty = array( $row => $qty ); |
|
701 | + $row_qty = explode('-', $row_qty); |
|
702 | + $row = isset($row_qty[0]) ? (absint($row_qty[0])) : 1; |
|
703 | + $qty = isset($row_qty[1]) ? absint($row_qty[1]) : 0; |
|
704 | + $row_qty = array($row => $qty); |
|
705 | 705 | // d( $row_qty ); |
706 | - for( $x = 1; $x <= $rows; $x++ ) { |
|
707 | - if ( ! isset( $row_qty[$x] )) { |
|
706 | + for ($x = 1; $x <= $rows; $x++) { |
|
707 | + if ( ! isset($row_qty[$x])) { |
|
708 | 708 | $row_qty[$x] = 0; |
709 | 709 | } |
710 | 710 | } |
711 | 711 | } |
712 | - ksort( $row_qty ); |
|
712 | + ksort($row_qty); |
|
713 | 713 | // d( $row_qty ); |
714 | 714 | // cycle thru values |
715 | - foreach ( $row_qty as $qty ) { |
|
716 | - $qty = absint( $qty ); |
|
715 | + foreach ($row_qty as $qty) { |
|
716 | + $qty = absint($qty); |
|
717 | 717 | // sanitize as integers |
718 | 718 | $valid_data[$what][] = $qty; |
719 | 719 | $valid_data['total_tickets'] += $qty; |
@@ -724,19 +724,19 @@ discard block |
||
724 | 724 | case 'ticket_id': |
725 | 725 | $value_array = array(); |
726 | 726 | // cycle thru values |
727 | - foreach ( $input_value as $key=>$value ) { |
|
727 | + foreach ($input_value as $key=>$value) { |
|
728 | 728 | // allow only numbers, letters, spaces, commas and dashes |
729 | - $value_array[ $key ] = wp_strip_all_tags( $value ); |
|
729 | + $value_array[$key] = wp_strip_all_tags($value); |
|
730 | 730 | // get ticket via the ticket id we put in the form |
731 | - $ticket_obj = EE_Registry::instance()->load_model( 'Ticket' )->get_one_by_ID( $value ); |
|
732 | - $valid_data['ticket_obj'][ $key ] = $ticket_obj; |
|
731 | + $ticket_obj = EE_Registry::instance()->load_model('Ticket')->get_one_by_ID($value); |
|
732 | + $valid_data['ticket_obj'][$key] = $ticket_obj; |
|
733 | 733 | } |
734 | - $valid_data[ $what ] = $value_array; |
|
734 | + $valid_data[$what] = $value_array; |
|
735 | 735 | break; |
736 | 736 | |
737 | 737 | case 'return_url' : |
738 | 738 | // grab and sanitize return-url |
739 | - $valid_data[$what] = esc_url_raw( $input_value ); |
|
739 | + $valid_data[$what] = esc_url_raw($input_value); |
|
740 | 740 | break; |
741 | 741 | |
742 | 742 | } // end switch $what |
@@ -744,7 +744,7 @@ discard block |
||
744 | 744 | } // end foreach $inputs_to_clean |
745 | 745 | |
746 | 746 | } else { |
747 | - EE_Error::add_error( __('The event id provided was not valid.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
747 | + EE_Error::add_error(__('The event id provided was not valid.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
748 | 748 | return FALSE; |
749 | 749 | } |
750 | 750 | |
@@ -762,28 +762,28 @@ discard block |
||
762 | 762 | * @param int $qty |
763 | 763 | * @return TRUE on success, FALSE on fail |
764 | 764 | */ |
765 | - private static function _add_ticket_to_cart( EE_Ticket $ticket = NULL, $qty = 1 ) { |
|
766 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
765 | + private static function _add_ticket_to_cart(EE_Ticket $ticket = NULL, $qty = 1) { |
|
766 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
767 | 767 | // get the number of spaces left for this datetime ticket |
768 | - $available_spaces = self::_ticket_datetime_availability( $ticket ); |
|
768 | + $available_spaces = self::_ticket_datetime_availability($ticket); |
|
769 | 769 | // compare available spaces against the number of tickets being purchased |
770 | - if ( $available_spaces >= $qty ) { |
|
770 | + if ($available_spaces >= $qty) { |
|
771 | 771 | // allow addons to prevent a ticket from being added to cart |
772 | - if ( ! apply_filters( 'FHEE__EE_Ticket_Selector___add_ticket_to_cart__allow_add_to_cart', true, $ticket, $qty, $available_spaces ) ) { |
|
772 | + if ( ! apply_filters('FHEE__EE_Ticket_Selector___add_ticket_to_cart__allow_add_to_cart', true, $ticket, $qty, $available_spaces)) { |
|
773 | 773 | return false; |
774 | 774 | } |
775 | 775 | // add event to cart |
776 | - if( EE_Registry::instance()->CART->add_ticket_to_cart( $ticket, $qty )) { |
|
777 | - self::_recalculate_ticket_datetime_availability( $ticket, $qty ); |
|
776 | + if (EE_Registry::instance()->CART->add_ticket_to_cart($ticket, $qty)) { |
|
777 | + self::_recalculate_ticket_datetime_availability($ticket, $qty); |
|
778 | 778 | return true; |
779 | 779 | } else { |
780 | 780 | return false; |
781 | 781 | } |
782 | 782 | } else { |
783 | 783 | // tickets can not be purchased but let's find the exact number left for the last ticket selected PRIOR to subtracting tickets |
784 | - $available_spaces = self::_ticket_datetime_availability( $ticket, true ); |
|
784 | + $available_spaces = self::_ticket_datetime_availability($ticket, true); |
|
785 | 785 | // greedy greedy greedy eh? |
786 | - if ( $available_spaces > 0 ) { |
|
786 | + if ($available_spaces > 0) { |
|
787 | 787 | // add error messaging - we're using the _n function that will generate the appropriate singular or plural message based on the number of $available_spaces |
788 | 788 | EE_Error::add_error( |
789 | 789 | sprintf( |
@@ -799,7 +799,7 @@ discard block |
||
799 | 799 | __FILE__, __FUNCTION__, __LINE__ |
800 | 800 | ); |
801 | 801 | } else { |
802 | - EE_Error::add_error( __('We\'re sorry, but there are no available spaces left for this event at this particular date and time.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
802 | + EE_Error::add_error(__('We\'re sorry, but there are no available spaces left for this event at this particular date and time.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
803 | 803 | } |
804 | 804 | return false; |
805 | 805 | } |
@@ -817,22 +817,22 @@ discard block |
||
817 | 817 | * @param bool $get_original_ticket_spaces |
818 | 818 | * @return int |
819 | 819 | */ |
820 | - private static function _ticket_datetime_availability( EE_Ticket $ticket, $get_original_ticket_spaces = FALSE ) { |
|
820 | + private static function _ticket_datetime_availability(EE_Ticket $ticket, $get_original_ticket_spaces = FALSE) { |
|
821 | 821 | // if the $_available_spaces array has not been set up yet... |
822 | - if ( ! isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) { |
|
823 | - self::_set_initial_ticket_datetime_availability( $ticket ); |
|
822 | + if ( ! isset(self::$_available_spaces['tickets'][$ticket->ID()])) { |
|
823 | + self::_set_initial_ticket_datetime_availability($ticket); |
|
824 | 824 | } |
825 | 825 | $available_spaces = $ticket->qty() - $ticket->sold(); |
826 | - if ( isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) { |
|
826 | + if (isset(self::$_available_spaces['tickets'][$ticket->ID()])) { |
|
827 | 827 | // loop thru tickets, which will ALSO include individual ticket records AND a total |
828 | - foreach ( self::$_available_spaces['tickets'][ $ticket->ID() ] as $DTD_ID => $spaces ) { |
|
828 | + foreach (self::$_available_spaces['tickets'][$ticket->ID()] as $DTD_ID => $spaces) { |
|
829 | 829 | // if we want the original datetime availability BEFORE we started subtracting tickets ? |
830 | - if ( $get_original_ticket_spaces ) { |
|
830 | + if ($get_original_ticket_spaces) { |
|
831 | 831 | // then grab the available spaces from the "tickets" array and compare with the above to get the lowest number |
832 | - $available_spaces = min( $available_spaces, self::$_available_spaces['tickets'][ $ticket->ID() ][ $DTD_ID ] ); |
|
832 | + $available_spaces = min($available_spaces, self::$_available_spaces['tickets'][$ticket->ID()][$DTD_ID]); |
|
833 | 833 | } else { |
834 | 834 | // we want the updated ticket availability as stored in the "datetimes" array |
835 | - $available_spaces = min( $available_spaces, self::$_available_spaces['datetimes'][ $DTD_ID ] ); |
|
835 | + $available_spaces = min($available_spaces, self::$_available_spaces['datetimes'][$DTD_ID]); |
|
836 | 836 | } |
837 | 837 | } |
838 | 838 | } |
@@ -848,23 +848,23 @@ discard block |
||
848 | 848 | * @param EE_Ticket $ticket |
849 | 849 | * @return int |
850 | 850 | */ |
851 | - private static function _set_initial_ticket_datetime_availability( EE_Ticket $ticket ) { |
|
851 | + private static function _set_initial_ticket_datetime_availability(EE_Ticket $ticket) { |
|
852 | 852 | // first, get all of the datetimes that are available to this ticket |
853 | 853 | $datetimes = $ticket->get_many_related( |
854 | 854 | 'Datetime', |
855 | - array( array( 'DTT_EVT_end' => array( '>=', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_end' ) ) ), 'order_by' => array( 'DTT_EVT_start' => 'ASC' )) |
|
855 | + array(array('DTT_EVT_end' => array('>=', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_end'))), 'order_by' => array('DTT_EVT_start' => 'ASC')) |
|
856 | 856 | ); |
857 | - if ( ! empty( $datetimes )) { |
|
857 | + if ( ! empty($datetimes)) { |
|
858 | 858 | // now loop thru all of the datetimes |
859 | - foreach ( $datetimes as $datetime ) { |
|
860 | - if ( $datetime instanceof EE_Datetime ) { |
|
859 | + foreach ($datetimes as $datetime) { |
|
860 | + if ($datetime instanceof EE_Datetime) { |
|
861 | 861 | // the number of spaces available for the datetime without considering individual ticket quantities |
862 | 862 | $spaces_remaining = $datetime->spaces_remaining(); |
863 | 863 | // save the total available spaces ( the lesser of the ticket qty minus the number of tickets sold or the datetime spaces remaining) to this ticket using the datetime ID as the key |
864 | - self::$_available_spaces['tickets'][ $ticket->ID() ][ $datetime->ID() ] = min(( $ticket->qty() - $ticket->sold() ), $spaces_remaining ); |
|
864 | + self::$_available_spaces['tickets'][$ticket->ID()][$datetime->ID()] = min(($ticket->qty() - $ticket->sold()), $spaces_remaining); |
|
865 | 865 | // if the remaining spaces for this datetime is already set, then compare that against the datetime spaces remaining, and take the lowest number, |
866 | 866 | // else just take the datetime spaces remaining, and assign to the datetimes array |
867 | - self::$_available_spaces['datetimes'][ $datetime->ID() ] = isset( self::$_available_spaces['datetimes'][ $datetime->ID() ] ) ? min( self::$_available_spaces['datetimes'][ $datetime->ID() ], $spaces_remaining ) : $spaces_remaining; |
|
867 | + self::$_available_spaces['datetimes'][$datetime->ID()] = isset(self::$_available_spaces['datetimes'][$datetime->ID()]) ? min(self::$_available_spaces['datetimes'][$datetime->ID()], $spaces_remaining) : $spaces_remaining; |
|
868 | 868 | } |
869 | 869 | } |
870 | 870 | } |
@@ -880,12 +880,12 @@ discard block |
||
880 | 880 | * @param int $qty |
881 | 881 | * @return int |
882 | 882 | */ |
883 | - private static function _recalculate_ticket_datetime_availability( EE_Ticket $ticket, $qty = 0 ) { |
|
884 | - if ( isset( self::$_available_spaces['tickets'][ $ticket->ID() ] )) { |
|
883 | + private static function _recalculate_ticket_datetime_availability(EE_Ticket $ticket, $qty = 0) { |
|
884 | + if (isset(self::$_available_spaces['tickets'][$ticket->ID()])) { |
|
885 | 885 | // loop thru tickets, which will ALSO include individual ticket records AND a total |
886 | - foreach ( self::$_available_spaces['tickets'][ $ticket->ID() ] as $DTD_ID => $spaces ) { |
|
886 | + foreach (self::$_available_spaces['tickets'][$ticket->ID()] as $DTD_ID => $spaces) { |
|
887 | 887 | // subtract the qty of selected tickets from each datetime's available spaces this ticket has access to, |
888 | - self::$_available_spaces['datetimes'][ $DTD_ID ] = self::$_available_spaces['datetimes'][ $DTD_ID ] - $qty; |
|
888 | + self::$_available_spaces['datetimes'][$DTD_ID] = self::$_available_spaces['datetimes'][$DTD_ID] - $qty; |
|
889 | 889 | } |
890 | 890 | } |
891 | 891 | } |
@@ -902,8 +902,8 @@ discard block |
||
902 | 902 | */ |
903 | 903 | public static function load_tckt_slctr_assets() { |
904 | 904 | // add some style |
905 | - if ( apply_filters( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE ) ) { |
|
906 | - wp_register_style('ticket_selector', TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css'); |
|
905 | + if (apply_filters('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE)) { |
|
906 | + wp_register_style('ticket_selector', TICKET_SELECTOR_ASSETS_URL.'ticket_selector.css'); |
|
907 | 907 | wp_enqueue_style('ticket_selector'); |
908 | 908 | // make it dance |
909 | 909 | // wp_register_script('ticket_selector', TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.js', array('espresso_core'), '', TRUE); |
@@ -917,9 +917,9 @@ discard block |
||
917 | 917 | |
918 | 918 | public static function load_tckt_slctr_assets_admin() { |
919 | 919 | //iframe button js on admin event editor page |
920 | - if ( EE_Registry::instance()->REQ->get('page') == 'espresso_events' && EE_Registry::instance()->REQ->get('action') == 'edit' ) { |
|
921 | - wp_register_script( 'ticket_selector_embed', TICKET_SELECTOR_ASSETS_URL . 'ticket-selector-embed.js', array( 'ee-dialog' ), EVENT_ESPRESSO_VERSION, true ); |
|
922 | - wp_enqueue_script( 'ticket_selector_embed' ); |
|
920 | + if (EE_Registry::instance()->REQ->get('page') == 'espresso_events' && EE_Registry::instance()->REQ->get('action') == 'edit') { |
|
921 | + wp_register_script('ticket_selector_embed', TICKET_SELECTOR_ASSETS_URL.'ticket-selector-embed.js', array('ee-dialog'), EVENT_ESPRESSO_VERSION, true); |
|
922 | + wp_enqueue_script('ticket_selector_embed'); |
|
923 | 923 | } |
924 | 924 | } |
925 | 925 |
@@ -30,11 +30,11 @@ discard block |
||
30 | 30 | * @return void |
31 | 31 | */ |
32 | 32 | public static function set_hooks() { |
33 | - if ( |
|
33 | + if ( |
|
34 | 34 | apply_filters( 'FHEE__EED_Bot_Trap__set_hooks__use_bot_trap', true ) && |
35 | 35 | \EE_Registry::instance()->CFG->registration->use_bot_trap |
36 | 36 | ) { |
37 | - \EED_Bot_Trap::set_trap(); |
|
37 | + \EED_Bot_Trap::set_trap(); |
|
38 | 38 | // redirect bots to bogus success page |
39 | 39 | \EE_Config::register_route( 'ticket_selection_received', 'EED_Bot_Trap', 'display_bot_trap_success' ); |
40 | 40 | } |
@@ -49,18 +49,18 @@ discard block |
||
49 | 49 | * @return void |
50 | 50 | */ |
51 | 51 | public static function set_trap() { |
52 | - define('EE_BOT_TRAP_BASE_URL', plugin_dir_url(__FILE__) . DS); |
|
53 | - add_action( |
|
54 | - 'AHEE__ticket_selector_chart__template__after_ticket_selector', |
|
55 | - array('EED_Bot_Trap', 'generate_bot_trap'), |
|
56 | - 10, 2 |
|
57 | - ); |
|
58 | - add_action( |
|
59 | - 'EED_Ticket_Selector__process_ticket_selections__before', |
|
60 | - array('EED_Bot_Trap', 'process_bot_trap'), |
|
61 | - 1, 2 |
|
62 | - ); |
|
63 | - } |
|
52 | + define('EE_BOT_TRAP_BASE_URL', plugin_dir_url(__FILE__) . DS); |
|
53 | + add_action( |
|
54 | + 'AHEE__ticket_selector_chart__template__after_ticket_selector', |
|
55 | + array('EED_Bot_Trap', 'generate_bot_trap'), |
|
56 | + 10, 2 |
|
57 | + ); |
|
58 | + add_action( |
|
59 | + 'EED_Ticket_Selector__process_ticket_selections__before', |
|
60 | + array('EED_Bot_Trap', 'process_bot_trap'), |
|
61 | + 1, 2 |
|
62 | + ); |
|
63 | + } |
|
64 | 64 | |
65 | 65 | |
66 | 66 | |
@@ -71,15 +71,15 @@ discard block |
||
71 | 71 | * @return void |
72 | 72 | */ |
73 | 73 | public static function set_hooks_admin() { |
74 | - if ( |
|
75 | - defined('DOING_AJAX') |
|
76 | - && DOING_AJAX |
|
77 | - && apply_filters('FHEE__EED_Bot_Trap__set_hooks__use_bot_trap', true) |
|
78 | - && \EE_Registry::instance()->CFG->registration->use_bot_trap |
|
79 | - ) { |
|
80 | - \EED_Bot_Trap::set_trap(); |
|
81 | - } |
|
82 | - add_action( |
|
74 | + if ( |
|
75 | + defined('DOING_AJAX') |
|
76 | + && DOING_AJAX |
|
77 | + && apply_filters('FHEE__EED_Bot_Trap__set_hooks__use_bot_trap', true) |
|
78 | + && \EE_Registry::instance()->CFG->registration->use_bot_trap |
|
79 | + ) { |
|
80 | + \EED_Bot_Trap::set_trap(); |
|
81 | + } |
|
82 | + add_action( |
|
83 | 83 | 'AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template', |
84 | 84 | array( 'EED_Bot_Trap', 'bot_trap_settings_form' ), |
85 | 85 | 10 |
@@ -129,23 +129,23 @@ discard block |
||
129 | 129 | |
130 | 130 | |
131 | 131 | /** |
132 | - * process_bot_trap |
|
133 | - * |
|
134 | - * @param array|string $triggered_trap_callback Callback that will be executed for handling the |
|
135 | - * response if the bot trap is triggered. |
|
136 | - * It should receive one argument: a boolean indicating |
|
137 | - * whether the trap was triggered by suspicious timing or not. |
|
132 | + * process_bot_trap |
|
133 | + * |
|
134 | + * @param array|string $triggered_trap_callback Callback that will be executed for handling the |
|
135 | + * response if the bot trap is triggered. |
|
136 | + * It should receive one argument: a boolean indicating |
|
137 | + * whether the trap was triggered by suspicious timing or not. |
|
138 | 138 | */ |
139 | 139 | public static function process_bot_trap( $triggered_trap_callback = array() ) { |
140 | - // what's your email address Mr. Bot ? |
|
140 | + // what's your email address Mr. Bot ? |
|
141 | 141 | $empty_trap = isset( $_REQUEST[ 'tkt-slctr-request-processor-email' ] ) |
142 | - && $_REQUEST[ 'tkt-slctr-request-processor-email' ] === '' |
|
143 | - ? true |
|
144 | - : false; |
|
142 | + && $_REQUEST[ 'tkt-slctr-request-processor-email' ] === '' |
|
143 | + ? true |
|
144 | + : false; |
|
145 | 145 | // get encrypted timestamp for when the form was originally displayed |
146 | 146 | $bot_trap_timestamp = isset( $_REQUEST[ 'tkt-slctr-request-processor-token' ] ) |
147 | - ? sanitize_text_field( $_REQUEST[ 'tkt-slctr-request-processor-token' ] ) |
|
148 | - : ''; |
|
147 | + ? sanitize_text_field( $_REQUEST[ 'tkt-slctr-request-processor-token' ] ) |
|
148 | + : ''; |
|
149 | 149 | // decrypt and convert to absolute integer |
150 | 150 | if ( EE_Registry::instance()->CFG->registration->use_encryption ) { |
151 | 151 | EE_Registry::instance()->load_core( 'EE_Encryption' ); |
@@ -155,17 +155,17 @@ discard block |
||
155 | 155 | } |
156 | 156 | // ticket form submitted too impossibly fast ( after now ) or more than an hour later ??? |
157 | 157 | $suspicious_timing = $bot_trap_timestamp > time() || $bot_trap_timestamp < ( time() - HOUR_IN_SECONDS ) |
158 | - ? true |
|
159 | - : false; |
|
158 | + ? true |
|
159 | + : false; |
|
160 | 160 | // are we human ? |
161 | 161 | if ( $empty_trap && ! $suspicious_timing ) { |
162 | - do_action('AHEE__EED_Bot_Trap__process_bot_trap__trap_not_triggered'); |
|
162 | + do_action('AHEE__EED_Bot_Trap__process_bot_trap__trap_not_triggered'); |
|
163 | 163 | return; |
164 | 164 | } |
165 | 165 | // check the given callback is valid first before executing |
166 | 166 | if ( ! is_callable($triggered_trap_callback ) ) { |
167 | 167 | // invalid callback so lets just sub in our default. |
168 | - $triggered_trap_callback = array( 'EED_Bot_Trap', 'triggered_trap_response' ); |
|
168 | + $triggered_trap_callback = array( 'EED_Bot_Trap', 'triggered_trap_response' ); |
|
169 | 169 | } |
170 | 170 | call_user_func_array($triggered_trap_callback, array( $suspicious_timing ) ); |
171 | 171 | } |
@@ -191,21 +191,21 @@ discard block |
||
191 | 191 | ); |
192 | 192 | } |
193 | 193 | $redirect_url = apply_filters('FHEE__EED_Bot_Trap__process_bot_trap__redirect_url', $redirect_url); |
194 | - // if AJAX, return the redirect URL |
|
195 | - if (defined('DOING_AJAX') && DOING_AJAX) { |
|
196 | - echo json_encode( |
|
197 | - array_merge( |
|
198 | - \EE_Error::get_notices(false), |
|
199 | - array( |
|
200 | - 'redirect_url' => $redirect_url |
|
201 | - ) |
|
202 | - ) |
|
203 | - ); |
|
204 | - exit(); |
|
205 | - } |
|
206 | - wp_safe_redirect($redirect_url); |
|
207 | - exit(); |
|
208 | - } |
|
194 | + // if AJAX, return the redirect URL |
|
195 | + if (defined('DOING_AJAX') && DOING_AJAX) { |
|
196 | + echo json_encode( |
|
197 | + array_merge( |
|
198 | + \EE_Error::get_notices(false), |
|
199 | + array( |
|
200 | + 'redirect_url' => $redirect_url |
|
201 | + ) |
|
202 | + ) |
|
203 | + ); |
|
204 | + exit(); |
|
205 | + } |
|
206 | + wp_safe_redirect($redirect_url); |
|
207 | + exit(); |
|
208 | + } |
|
209 | 209 | |
210 | 210 | |
211 | 211 | |
@@ -236,9 +236,9 @@ discard block |
||
236 | 236 | * @return void |
237 | 237 | */ |
238 | 238 | public static function bot_trap_settings_form() { |
239 | - EED_Bot_Trap::_bot_trap_settings_form()->enqueue_js(); |
|
240 | - echo EED_Bot_Trap::_bot_trap_settings_form()->get_html(); |
|
241 | - } |
|
239 | + EED_Bot_Trap::_bot_trap_settings_form()->enqueue_js(); |
|
240 | + echo EED_Bot_Trap::_bot_trap_settings_form()->get_html(); |
|
241 | + } |
|
242 | 242 | |
243 | 243 | |
244 | 244 |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | * @return EED_Bot_Trap |
19 | 19 | */ |
20 | 20 | public static function instance() { |
21 | - return parent::get_instance( __CLASS__ ); |
|
21 | + return parent::get_instance(__CLASS__); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | |
@@ -31,12 +31,12 @@ discard block |
||
31 | 31 | */ |
32 | 32 | public static function set_hooks() { |
33 | 33 | if ( |
34 | - apply_filters( 'FHEE__EED_Bot_Trap__set_hooks__use_bot_trap', true ) && |
|
34 | + apply_filters('FHEE__EED_Bot_Trap__set_hooks__use_bot_trap', true) && |
|
35 | 35 | \EE_Registry::instance()->CFG->registration->use_bot_trap |
36 | 36 | ) { |
37 | 37 | \EED_Bot_Trap::set_trap(); |
38 | 38 | // redirect bots to bogus success page |
39 | - \EE_Config::register_route( 'ticket_selection_received', 'EED_Bot_Trap', 'display_bot_trap_success' ); |
|
39 | + \EE_Config::register_route('ticket_selection_received', 'EED_Bot_Trap', 'display_bot_trap_success'); |
|
40 | 40 | } |
41 | 41 | } |
42 | 42 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | * @return void |
50 | 50 | */ |
51 | 51 | public static function set_trap() { |
52 | - define('EE_BOT_TRAP_BASE_URL', plugin_dir_url(__FILE__) . DS); |
|
52 | + define('EE_BOT_TRAP_BASE_URL', plugin_dir_url(__FILE__).DS); |
|
53 | 53 | add_action( |
54 | 54 | 'AHEE__ticket_selector_chart__template__after_ticket_selector', |
55 | 55 | array('EED_Bot_Trap', 'generate_bot_trap'), |
@@ -81,12 +81,12 @@ discard block |
||
81 | 81 | } |
82 | 82 | add_action( |
83 | 83 | 'AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template', |
84 | - array( 'EED_Bot_Trap', 'bot_trap_settings_form' ), |
|
84 | + array('EED_Bot_Trap', 'bot_trap_settings_form'), |
|
85 | 85 | 10 |
86 | 86 | ); |
87 | 87 | add_filter( |
88 | 88 | 'FHEE__Extend_Registration_Form_Admin_Page___update_reg_form_settings__CFG_registration', |
89 | - array( 'EED_Bot_Trap', 'update_bot_trap_settings_form' ), |
|
89 | + array('EED_Bot_Trap', 'update_bot_trap_settings_form'), |
|
90 | 90 | 10, 1 |
91 | 91 | ); |
92 | 92 | } |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | * @param WP $WP |
101 | 101 | * @return void |
102 | 102 | */ |
103 | - public function run( $WP ) {} |
|
103 | + public function run($WP) {} |
|
104 | 104 | |
105 | 105 | |
106 | 106 | |
@@ -111,14 +111,14 @@ discard block |
||
111 | 111 | * @return void |
112 | 112 | */ |
113 | 113 | public static function generate_bot_trap() { |
114 | - $do_not_enter = esc_html__( 'please do not enter anything in this input', 'event_espresso' ); |
|
114 | + $do_not_enter = esc_html__('please do not enter anything in this input', 'event_espresso'); |
|
115 | 115 | $html = '<div id="tkt-slctr-request-processor-dv" style="float:left; margin-left:-999em;">'; |
116 | - $html .= '<label for="tkt-slctr-request-processor-email">' . $do_not_enter . '</label>'; |
|
116 | + $html .= '<label for="tkt-slctr-request-processor-email">'.$do_not_enter.'</label>'; |
|
117 | 117 | $html .= '<input type="email" name="tkt-slctr-request-processor-email" value=""/>'; |
118 | 118 | $html .= '<input type="hidden" name="tkt-slctr-request-processor-token" value="'; |
119 | - if ( EE_Registry::instance()->CFG->registration->use_encryption ) { |
|
120 | - EE_Registry::instance()->load_core( 'EE_Encryption' ); |
|
121 | - $html .= EE_Encryption::instance()->encrypt( time() ); |
|
119 | + if (EE_Registry::instance()->CFG->registration->use_encryption) { |
|
120 | + EE_Registry::instance()->load_core('EE_Encryption'); |
|
121 | + $html .= EE_Encryption::instance()->encrypt(time()); |
|
122 | 122 | } else { |
123 | 123 | $html .= time(); |
124 | 124 | } |
@@ -136,38 +136,38 @@ discard block |
||
136 | 136 | * It should receive one argument: a boolean indicating |
137 | 137 | * whether the trap was triggered by suspicious timing or not. |
138 | 138 | */ |
139 | - public static function process_bot_trap( $triggered_trap_callback = array() ) { |
|
139 | + public static function process_bot_trap($triggered_trap_callback = array()) { |
|
140 | 140 | // what's your email address Mr. Bot ? |
141 | - $empty_trap = isset( $_REQUEST[ 'tkt-slctr-request-processor-email' ] ) |
|
142 | - && $_REQUEST[ 'tkt-slctr-request-processor-email' ] === '' |
|
141 | + $empty_trap = isset($_REQUEST['tkt-slctr-request-processor-email']) |
|
142 | + && $_REQUEST['tkt-slctr-request-processor-email'] === '' |
|
143 | 143 | ? true |
144 | 144 | : false; |
145 | 145 | // get encrypted timestamp for when the form was originally displayed |
146 | - $bot_trap_timestamp = isset( $_REQUEST[ 'tkt-slctr-request-processor-token' ] ) |
|
147 | - ? sanitize_text_field( $_REQUEST[ 'tkt-slctr-request-processor-token' ] ) |
|
146 | + $bot_trap_timestamp = isset($_REQUEST['tkt-slctr-request-processor-token']) |
|
147 | + ? sanitize_text_field($_REQUEST['tkt-slctr-request-processor-token']) |
|
148 | 148 | : ''; |
149 | 149 | // decrypt and convert to absolute integer |
150 | - if ( EE_Registry::instance()->CFG->registration->use_encryption ) { |
|
151 | - EE_Registry::instance()->load_core( 'EE_Encryption' ); |
|
152 | - $bot_trap_timestamp = absint( EE_Encryption::instance()->decrypt( $bot_trap_timestamp ) ); |
|
150 | + if (EE_Registry::instance()->CFG->registration->use_encryption) { |
|
151 | + EE_Registry::instance()->load_core('EE_Encryption'); |
|
152 | + $bot_trap_timestamp = absint(EE_Encryption::instance()->decrypt($bot_trap_timestamp)); |
|
153 | 153 | } else { |
154 | - $bot_trap_timestamp = absint( $bot_trap_timestamp ); |
|
154 | + $bot_trap_timestamp = absint($bot_trap_timestamp); |
|
155 | 155 | } |
156 | 156 | // ticket form submitted too impossibly fast ( after now ) or more than an hour later ??? |
157 | - $suspicious_timing = $bot_trap_timestamp > time() || $bot_trap_timestamp < ( time() - HOUR_IN_SECONDS ) |
|
157 | + $suspicious_timing = $bot_trap_timestamp > time() || $bot_trap_timestamp < (time() - HOUR_IN_SECONDS) |
|
158 | 158 | ? true |
159 | 159 | : false; |
160 | 160 | // are we human ? |
161 | - if ( $empty_trap && ! $suspicious_timing ) { |
|
161 | + if ($empty_trap && ! $suspicious_timing) { |
|
162 | 162 | do_action('AHEE__EED_Bot_Trap__process_bot_trap__trap_not_triggered'); |
163 | 163 | return; |
164 | 164 | } |
165 | 165 | // check the given callback is valid first before executing |
166 | - if ( ! is_callable($triggered_trap_callback ) ) { |
|
166 | + if ( ! is_callable($triggered_trap_callback)) { |
|
167 | 167 | // invalid callback so lets just sub in our default. |
168 | - $triggered_trap_callback = array( 'EED_Bot_Trap', 'triggered_trap_response' ); |
|
168 | + $triggered_trap_callback = array('EED_Bot_Trap', 'triggered_trap_response'); |
|
169 | 169 | } |
170 | - call_user_func_array($triggered_trap_callback, array( $suspicious_timing ) ); |
|
170 | + call_user_func_array($triggered_trap_callback, array($suspicious_timing)); |
|
171 | 171 | } |
172 | 172 | |
173 | 173 | |
@@ -178,15 +178,15 @@ discard block |
||
178 | 178 | * |
179 | 179 | * @param bool $suspicious_timing If true, then the bot trap was triggered due to the suspicious timing test. |
180 | 180 | */ |
181 | - public static function triggered_trap_response( $suspicious_timing ) { |
|
181 | + public static function triggered_trap_response($suspicious_timing) { |
|
182 | 182 | // UH OH... |
183 | 183 | $redirect_url = add_query_arg( |
184 | - array( 'ee' => 'ticket_selection_received' ), |
|
184 | + array('ee' => 'ticket_selection_received'), |
|
185 | 185 | EE_Registry::instance()->CFG->core->reg_page_url() |
186 | 186 | ); |
187 | - if ( $suspicious_timing ) { |
|
187 | + if ($suspicious_timing) { |
|
188 | 188 | $redirect_url = add_query_arg( |
189 | - array( 'ee-notice' => urlencode( esc_html__( 'We\'re sorry, but your ticket selections could not be processed due to a server timing error. Please hit the back button on your browser and try again.', 'event_espresso' ) ) ), |
|
189 | + array('ee-notice' => urlencode(esc_html__('We\'re sorry, but your ticket selections could not be processed due to a server timing error. Please hit the back button on your browser and try again.', 'event_espresso'))), |
|
190 | 190 | $redirect_url |
191 | 191 | ); |
192 | 192 | } |
@@ -217,10 +217,10 @@ discard block |
||
217 | 217 | * @return void |
218 | 218 | */ |
219 | 219 | public static function display_bot_trap_success() { |
220 | - add_filter( 'FHEE__EED_Single_Page_Checkout__run', '__return_false' ); |
|
221 | - $bot_notice = esc_html__( 'Thank you so much. Your ticket selections have been received for consideration.', 'event_espresso' ); |
|
222 | - $bot_notice = isset( $_REQUEST[ 'ee-notice' ] ) && $_REQUEST[ 'ee-notice' ] !== '' ? sanitize_text_field( stripslashes( $_REQUEST[ 'ee-notice' ] ) ) : $bot_notice; |
|
223 | - EE_Registry::instance()->REQ->add_output( EEH_HTML::div( $bot_notice, '', 'ee-attention' ) ); |
|
220 | + add_filter('FHEE__EED_Single_Page_Checkout__run', '__return_false'); |
|
221 | + $bot_notice = esc_html__('Thank you so much. Your ticket selections have been received for consideration.', 'event_espresso'); |
|
222 | + $bot_notice = isset($_REQUEST['ee-notice']) && $_REQUEST['ee-notice'] !== '' ? sanitize_text_field(stripslashes($_REQUEST['ee-notice'])) : $bot_notice; |
|
223 | + EE_Registry::instance()->REQ->add_output(EEH_HTML::div($bot_notice, '', 'ee-attention')); |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | |
@@ -255,20 +255,20 @@ discard block |
||
255 | 255 | 'html_id' => 'bot_trap_settings', |
256 | 256 | 'layout_strategy' => new EE_Admin_Two_Column_Layout(), |
257 | 257 | 'subsections' => array( |
258 | - 'bot_trap_hdr' => new EE_Form_Section_HTML( EEH_HTML::h2( esc_html__( 'Bot Trap Settings', 'event_espresso' ) ) ), |
|
258 | + 'bot_trap_hdr' => new EE_Form_Section_HTML(EEH_HTML::h2(esc_html__('Bot Trap Settings', 'event_espresso'))), |
|
259 | 259 | 'use_bot_trap' => new EE_Yes_No_Input( |
260 | 260 | array( |
261 | - 'html_label_text' => esc_html__( 'Enable Bot Trap', 'event_espresso' ), |
|
262 | - 'html_help_text' => esc_html__( 'The Event Espresso Bot Trap will insert a fake input into your Ticket Selector forms that is hidden from regular site visitors, but visible to spam bots. Because the input asks for an email address, it is irresistible to spam bots who will of course enter text into it. Since regular site visitors can not see this input, any value detected during form submission means a bot has been detected, which will then be blocked from submitting the form.', 'event_espresso' ), |
|
263 | - 'default' => isset( EE_Registry::instance()->CFG->registration->use_bot_trap ) ? EE_Registry::instance()->CFG->registration->use_bot_trap : true, |
|
261 | + 'html_label_text' => esc_html__('Enable Bot Trap', 'event_espresso'), |
|
262 | + 'html_help_text' => esc_html__('The Event Espresso Bot Trap will insert a fake input into your Ticket Selector forms that is hidden from regular site visitors, but visible to spam bots. Because the input asks for an email address, it is irresistible to spam bots who will of course enter text into it. Since regular site visitors can not see this input, any value detected during form submission means a bot has been detected, which will then be blocked from submitting the form.', 'event_espresso'), |
|
263 | + 'default' => isset(EE_Registry::instance()->CFG->registration->use_bot_trap) ? EE_Registry::instance()->CFG->registration->use_bot_trap : true, |
|
264 | 264 | 'required' => false |
265 | 265 | ) |
266 | 266 | ), |
267 | 267 | 'use_encryption' => new EE_Yes_No_Input( |
268 | 268 | array( |
269 | - 'html_label_text' => esc_html__( 'Encrypt Bot Trap Data', 'event_espresso' ), |
|
270 | - 'html_help_text' => esc_html__( 'One way to detect spam bots is by looking at how long it takes them to submit a form. They are often inhumanly fast, or will submit forms hours, days, or even weeks after the form was first scraped off the web. The Event Espresso Bot Trap will send a timestamp with the Ticket Selector form when it is submitted. By default, this timestamp is encrypted so that the spam bots can not change it, but encryption may cause issues on some servers due to configuration "conflicts". If you continuously get caught in the bot trap, then try setting this option to "No". This may increase the number of spam submissions you receive, but increases server compatibility.', 'event_espresso' ), |
|
271 | - 'default' => isset( EE_Registry::instance()->CFG->registration->use_encryption ) ? EE_Registry::instance()->CFG->registration->use_encryption : true, |
|
269 | + 'html_label_text' => esc_html__('Encrypt Bot Trap Data', 'event_espresso'), |
|
270 | + 'html_help_text' => esc_html__('One way to detect spam bots is by looking at how long it takes them to submit a form. They are often inhumanly fast, or will submit forms hours, days, or even weeks after the form was first scraped off the web. The Event Espresso Bot Trap will send a timestamp with the Ticket Selector form when it is submitted. By default, this timestamp is encrypted so that the spam bots can not change it, but encryption may cause issues on some servers due to configuration "conflicts". If you continuously get caught in the bot trap, then try setting this option to "No". This may increase the number of spam submissions you receive, but increases server compatibility.', 'event_espresso'), |
|
271 | + 'default' => isset(EE_Registry::instance()->CFG->registration->use_encryption) ? EE_Registry::instance()->CFG->registration->use_encryption : true, |
|
272 | 272 | 'required' => false |
273 | 273 | ) |
274 | 274 | ), |
@@ -286,30 +286,30 @@ discard block |
||
286 | 286 | * @param \EE_Registration_Config $EE_Registration_Config |
287 | 287 | * @return \EE_Registration_Config |
288 | 288 | */ |
289 | - public static function update_bot_trap_settings_form( EE_Registration_Config $EE_Registration_Config ) { |
|
289 | + public static function update_bot_trap_settings_form(EE_Registration_Config $EE_Registration_Config) { |
|
290 | 290 | try { |
291 | 291 | $bot_trap_settings_form = EED_Bot_Trap::_bot_trap_settings_form(); |
292 | 292 | // if not displaying a form, then check for form submission |
293 | - if ( $bot_trap_settings_form->was_submitted() ) { |
|
293 | + if ($bot_trap_settings_form->was_submitted()) { |
|
294 | 294 | // capture form data |
295 | 295 | $bot_trap_settings_form->receive_form_submission(); |
296 | 296 | // validate form data |
297 | - if ( $bot_trap_settings_form->is_valid() ) { |
|
297 | + if ($bot_trap_settings_form->is_valid()) { |
|
298 | 298 | // grab validated data from form |
299 | 299 | $valid_data = $bot_trap_settings_form->valid_data(); |
300 | - if ( isset( $valid_data[ 'use_bot_trap' ], $valid_data[ 'use_encryption' ] ) ) { |
|
301 | - $EE_Registration_Config->use_bot_trap = $valid_data[ 'use_bot_trap' ]; |
|
302 | - $EE_Registration_Config->use_encryption = $valid_data[ 'use_encryption' ]; |
|
300 | + if (isset($valid_data['use_bot_trap'], $valid_data['use_encryption'])) { |
|
301 | + $EE_Registration_Config->use_bot_trap = $valid_data['use_bot_trap']; |
|
302 | + $EE_Registration_Config->use_encryption = $valid_data['use_encryption']; |
|
303 | 303 | } else { |
304 | - EE_Error::add_error( esc_html__( 'Invalid or missing Bot Trap settings. Please refresh the form and try again.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
304 | + EE_Error::add_error(esc_html__('Invalid or missing Bot Trap settings. Please refresh the form and try again.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
305 | 305 | } |
306 | 306 | } else { |
307 | - if ( $bot_trap_settings_form->submission_error_message() != '' ) { |
|
308 | - EE_Error::add_error( $bot_trap_settings_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__ ); |
|
307 | + if ($bot_trap_settings_form->submission_error_message() != '') { |
|
308 | + EE_Error::add_error($bot_trap_settings_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__); |
|
309 | 309 | } |
310 | 310 | } |
311 | 311 | } |
312 | - } catch ( EE_Error $e ) { |
|
312 | + } catch (EE_Error $e) { |
|
313 | 313 | $e->get_error(); |
314 | 314 | } |
315 | 315 | return $EE_Registration_Config; |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | |
5 | 5 | /** |
@@ -68,12 +68,12 @@ discard block |
||
68 | 68 | * @param bool $routing indicate whether we want to just load the object and handle routing or just load the object. |
69 | 69 | * @access public |
70 | 70 | */ |
71 | - public function __construct( $routing = TRUE ) { |
|
72 | - require_once( EE_MODELS . 'EEM_Question.model.php' ); |
|
73 | - require_once( EE_MODELS . 'EEM_Question_Group.model.php' ); |
|
74 | - $this->_question_model= EEM_Question::instance(); |
|
75 | - $this->_question_group_model=EEM_Question_Group::instance(); |
|
76 | - parent::__construct( $routing ); |
|
71 | + public function __construct($routing = TRUE) { |
|
72 | + require_once(EE_MODELS.'EEM_Question.model.php'); |
|
73 | + require_once(EE_MODELS.'EEM_Question_Group.model.php'); |
|
74 | + $this->_question_model = EEM_Question::instance(); |
|
75 | + $this->_question_group_model = EEM_Question_Group::instance(); |
|
76 | + parent::__construct($routing); |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | *_set_page_routes |
110 | 110 | */ |
111 | 111 | protected function _set_page_routes() { |
112 | - $qst_id = ! empty( $this->_req_data['QST_ID'] ) ? $this->_req_data['QST_ID'] : 0; |
|
112 | + $qst_id = ! empty($this->_req_data['QST_ID']) ? $this->_req_data['QST_ID'] : 0; |
|
113 | 113 | $this->_page_routes = array( |
114 | 114 | 'default' => array( |
115 | 115 | 'func' => '_questions_overview_list_table', |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | |
131 | 131 | 'update_question' => array( |
132 | 132 | 'func' => '_insert_or_update_question', |
133 | - 'args' => array('new_question' => FALSE ), |
|
133 | + 'args' => array('new_question' => FALSE), |
|
134 | 134 | 'capability' => 'ee_edit_question', |
135 | 135 | 'obj_id' => $qst_id, |
136 | 136 | 'noheader' => TRUE, |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | 'filename' => 'registration_form_questions_overview_views_bulk_actions_search' |
166 | 166 | ) |
167 | 167 | ), |
168 | - 'help_tour' => array( 'Registration_Form_Questions_Overview_Help_Tour'), |
|
168 | + 'help_tour' => array('Registration_Form_Questions_Overview_Help_Tour'), |
|
169 | 169 | 'require_nonce' => FALSE, |
170 | 170 | 'qtips' => array( |
171 | 171 | 'EE_Registration_Form_Tips' |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | 'filename' => 'registration_form_question_groups' |
185 | 185 | ), |
186 | 186 | ), |
187 | - 'help_tour' => array( 'Registration_Form_Question_Groups_Help_Tour'), |
|
187 | + 'help_tour' => array('Registration_Form_Question_Groups_Help_Tour'), |
|
188 | 188 | 'require_nonce' => FALSE |
189 | 189 | ), |
190 | 190 | |
@@ -193,16 +193,16 @@ discard block |
||
193 | 193 | 'label' => esc_html__('Edit Question', 'event_espresso'), |
194 | 194 | 'order' => 15, |
195 | 195 | 'persistent' => FALSE, |
196 | - 'url' => isset($this->_req_data['question_id']) ? add_query_arg(array('question_id' => $this->_req_data['question_id'] ), $this->_current_page_view_url ) : $this->_admin_base_url |
|
196 | + 'url' => isset($this->_req_data['question_id']) ? add_query_arg(array('question_id' => $this->_req_data['question_id']), $this->_current_page_view_url) : $this->_admin_base_url |
|
197 | 197 | ), |
198 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box' ) ), |
|
198 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
199 | 199 | 'help_tabs' => array( |
200 | 200 | 'registration_form_edit_question_group_help_tab' => array( |
201 | 201 | 'title' => esc_html__('Edit Question', 'event_espresso'), |
202 | 202 | 'filename' => 'registration_form_edit_question' |
203 | 203 | ), |
204 | 204 | ), |
205 | - 'help_tour' => array( 'Registration_Form_Edit_Question_Help_Tour'), |
|
205 | + 'help_tour' => array('Registration_Form_Edit_Question_Help_Tour'), |
|
206 | 206 | 'require_nonce' => FALSE |
207 | 207 | ), |
208 | 208 | ); |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | //none of the below group are currently used for Event Categories |
231 | 231 | protected function _add_feature_pointers() {} |
232 | 232 | public function load_scripts_styles() { |
233 | - wp_register_style( 'espresso_registration', REGISTRATION_FORM_ASSETS_URL . 'espresso_registration_form_admin.css', array(), EVENT_ESPRESSO_VERSION ); |
|
233 | + wp_register_style('espresso_registration', REGISTRATION_FORM_ASSETS_URL.'espresso_registration_form_admin.css', array(), EVENT_ESPRESSO_VERSION); |
|
234 | 234 | wp_enqueue_style('espresso_registration'); |
235 | 235 | } |
236 | 236 | public function admin_init() {} |
@@ -246,20 +246,20 @@ discard block |
||
246 | 246 | |
247 | 247 | public function load_scripts_styles_add_question() { |
248 | 248 | $this->load_scripts_styles_forms(); |
249 | - wp_register_script( 'espresso_registration_form_single', REGISTRATION_FORM_ASSETS_URL . 'espresso_registration_form_admin.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
250 | - wp_enqueue_script( 'espresso_registration_form_single' ); |
|
249 | + wp_register_script('espresso_registration_form_single', REGISTRATION_FORM_ASSETS_URL.'espresso_registration_form_admin.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, TRUE); |
|
250 | + wp_enqueue_script('espresso_registration_form_single'); |
|
251 | 251 | } |
252 | 252 | public function load_scripts_styles_edit_question() { |
253 | 253 | $this->load_scripts_styles_forms(); |
254 | - wp_register_script( 'espresso_registration_form_single', REGISTRATION_FORM_ASSETS_URL . 'espresso_registration_form_admin.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
255 | - wp_enqueue_script( 'espresso_registration_form_single' ); |
|
254 | + wp_register_script('espresso_registration_form_single', REGISTRATION_FORM_ASSETS_URL.'espresso_registration_form_admin.js', array('jquery-ui-sortable'), EVENT_ESPRESSO_VERSION, TRUE); |
|
255 | + wp_enqueue_script('espresso_registration_form_single'); |
|
256 | 256 | } |
257 | 257 | |
258 | 258 | |
259 | 259 | |
260 | 260 | |
261 | 261 | public function recaptcha_info_help_tab() { |
262 | - $template = REGISTRATION_FORM_TEMPLATE_PATH . 'recaptcha_info_help_tab.template.php'; |
|
262 | + $template = REGISTRATION_FORM_TEMPLATE_PATH.'recaptcha_info_help_tab.template.php'; |
|
263 | 263 | EEH_Template::display_template($template, array()); |
264 | 264 | } |
265 | 265 | |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | ) |
292 | 292 | ); |
293 | 293 | |
294 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_questions', 'espresso_registration_form_trash_questions' ) ) { |
|
294 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_questions', 'espresso_registration_form_trash_questions')) { |
|
295 | 295 | $this->_views['trash'] = array( |
296 | 296 | 'slug' => 'trash', |
297 | 297 | 'label' => esc_html__('Trash', 'event_espresso'), |
@@ -309,9 +309,9 @@ discard block |
||
309 | 309 | */ |
310 | 310 | protected function _questions_groups_preview() { |
311 | 311 | $this->_admin_page_title = esc_html__('Question Groups (Preview)', 'event_espresso'); |
312 | - $this->_template_args['preview_img'] = '<img src="' . REGISTRATION_FORM_ASSETS_URL . 'caf_reg_form_preview.jpg" alt="' . esc_attr__( 'Preview Question Groups Overview List Table screenshot', 'event_espresso' ) . '" />'; |
|
313 | - $this->_template_args['preview_text'] = '<strong>'.esc_html__( 'Question Groups is a feature that is only available in the Caffeinated version of Event Espresso. With the Question Groups feature you are able to: create new question groups, edit existing question groups, and also create and edit new questions and add them to question groups.', 'event_espresso' ).'</strong>'; |
|
314 | - $this->display_admin_caf_preview_page( 'question_groups_tab' ); |
|
312 | + $this->_template_args['preview_img'] = '<img src="'.REGISTRATION_FORM_ASSETS_URL.'caf_reg_form_preview.jpg" alt="'.esc_attr__('Preview Question Groups Overview List Table screenshot', 'event_espresso').'" />'; |
|
313 | + $this->_template_args['preview_text'] = '<strong>'.esc_html__('Question Groups is a feature that is only available in the Caffeinated version of Event Espresso. With the Question Groups feature you are able to: create new question groups, edit existing question groups, and also create and edit new questions and add them to question groups.', 'event_espresso').'</strong>'; |
|
314 | + $this->display_admin_caf_preview_page('question_groups_tab'); |
|
315 | 315 | } |
316 | 316 | |
317 | 317 | |
@@ -322,58 +322,58 @@ discard block |
||
322 | 322 | * @param \EEM_Base $model |
323 | 323 | * @return array where each key is the name of a model's field/db column, and each value is its value. |
324 | 324 | */ |
325 | - protected function _set_column_values_for(EEM_Base $model){ |
|
326 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
327 | - $set_column_values=array(); |
|
325 | + protected function _set_column_values_for(EEM_Base $model) { |
|
326 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
327 | + $set_column_values = array(); |
|
328 | 328 | |
329 | 329 | //some initial checks for proper values. |
330 | 330 | //if QST_admin_only, then no matter what QST_required is we disable. |
331 | - if ( !empty( $this->_req_data['QST_admin_only'] ) ) { |
|
331 | + if ( ! empty($this->_req_data['QST_admin_only'])) { |
|
332 | 332 | $this->_req_data['QST_required'] = 0; |
333 | 333 | } |
334 | - foreach($model->field_settings() as $fieldName=>$settings){ |
|
334 | + foreach ($model->field_settings() as $fieldName=>$settings) { |
|
335 | 335 | // basically if QSG_identifier is empty or not set |
336 | - if ( $fieldName === 'QSG_identifier' && ( isset( $this->_req_data['QSG_identifier'] ) && empty( $this->_req_data['QSG_identifier'] ) )) { |
|
337 | - $QSG_name = isset( $this->_req_data['QSG_name'] ) ? $this->_req_data['QSG_name'] : '' ; |
|
338 | - $set_column_values[$fieldName] = sanitize_title($QSG_name ) . '-' . uniqid( '', true ); |
|
336 | + if ($fieldName === 'QSG_identifier' && (isset($this->_req_data['QSG_identifier']) && empty($this->_req_data['QSG_identifier']))) { |
|
337 | + $QSG_name = isset($this->_req_data['QSG_name']) ? $this->_req_data['QSG_name'] : ''; |
|
338 | + $set_column_values[$fieldName] = sanitize_title($QSG_name).'-'.uniqid('', true); |
|
339 | 339 | // dd($set_column_values); |
340 | 340 | } |
341 | 341 | //if the admin label is blank, use a slug version of the question text |
342 | - else if ( $fieldName === 'QST_admin_label' && ( isset( $this->_req_data['QST_admin_label'] ) && empty( $this->_req_data['QST_admin_label'] ) )) { |
|
343 | - $QST_text = isset( $this->_req_data['QST_display_text'] ) ? $this->_req_data['QST_display_text'] : '' ; |
|
344 | - $set_column_values[$fieldName] = sanitize_title(wp_trim_words($QST_text,10)); |
|
342 | + else if ($fieldName === 'QST_admin_label' && (isset($this->_req_data['QST_admin_label']) && empty($this->_req_data['QST_admin_label']))) { |
|
343 | + $QST_text = isset($this->_req_data['QST_display_text']) ? $this->_req_data['QST_display_text'] : ''; |
|
344 | + $set_column_values[$fieldName] = sanitize_title(wp_trim_words($QST_text, 10)); |
|
345 | 345 | } |
346 | 346 | |
347 | 347 | |
348 | - else if ( $fieldName === 'QST_admin_only' && ( !isset( $this->_req_data['QST_admin_only'] ) ) ) { |
|
348 | + else if ($fieldName === 'QST_admin_only' && ( ! isset($this->_req_data['QST_admin_only']))) { |
|
349 | 349 | $set_column_values[$fieldName] = 0; |
350 | 350 | } |
351 | 351 | |
352 | - else if ( $fieldName === 'QST_max' ) { |
|
352 | + else if ($fieldName === 'QST_max') { |
|
353 | 353 | $qst_system = EEM_Question::instance()->get_var( |
354 | 354 | array( |
355 | 355 | array( |
356 | - 'QST_ID' => isset( $this->_req_data[ 'QST_ID' ] ) ? $this->_req_data[ 'QST_ID' ] : 0 |
|
356 | + 'QST_ID' => isset($this->_req_data['QST_ID']) ? $this->_req_data['QST_ID'] : 0 |
|
357 | 357 | ) |
358 | 358 | ), |
359 | 359 | 'QST_system' ); |
360 | - $max_max = EEM_Question::instance()->absolute_max_for_system_question( $qst_system ); |
|
361 | - if( empty( $this->_req_data[ 'QST_max' ] ) || |
|
362 | - $this->_req_data[ 'QST_max' ] > $max_max ) { |
|
363 | - $set_column_values[ $fieldName ] = $max_max; |
|
360 | + $max_max = EEM_Question::instance()->absolute_max_for_system_question($qst_system); |
|
361 | + if (empty($this->_req_data['QST_max']) || |
|
362 | + $this->_req_data['QST_max'] > $max_max) { |
|
363 | + $set_column_values[$fieldName] = $max_max; |
|
364 | 364 | } |
365 | 365 | } |
366 | 366 | |
367 | 367 | |
368 | 368 | //only add a property to the array if it's not null (otherwise the model should just use the default value) |
369 | - if( |
|
370 | - ! isset( $set_column_values[ $fieldName ] ) && |
|
371 | - isset($this->_req_data[$fieldName] ) ){ |
|
372 | - $set_column_values[$fieldName]=$this->_req_data[$fieldName]; |
|
369 | + if ( |
|
370 | + ! isset($set_column_values[$fieldName]) && |
|
371 | + isset($this->_req_data[$fieldName]) ) { |
|
372 | + $set_column_values[$fieldName] = $this->_req_data[$fieldName]; |
|
373 | 373 | } |
374 | 374 | |
375 | 375 | } |
376 | - return $set_column_values;//validation fo this data to be performed by the model before insertion. |
|
376 | + return $set_column_values; //validation fo this data to be performed by the model before insertion. |
|
377 | 377 | } |
378 | 378 | |
379 | 379 | |
@@ -392,39 +392,39 @@ discard block |
||
392 | 392 | * _edit_question |
393 | 393 | */ |
394 | 394 | protected function _edit_question() { |
395 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
396 | - $ID=isset( $this->_req_data['QST_ID'] ) && ! empty( $this->_req_data['QST_ID'] ) ? absint( $this->_req_data['QST_ID'] ) : FALSE; |
|
395 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
396 | + $ID = isset($this->_req_data['QST_ID']) && ! empty($this->_req_data['QST_ID']) ? absint($this->_req_data['QST_ID']) : FALSE; |
|
397 | 397 | |
398 | - switch( $this->_req_action ) { |
|
398 | + switch ($this->_req_action) { |
|
399 | 399 | case 'add_question' : |
400 | - $this->_admin_page_title = esc_html__( 'Add Question', 'event_espresso' ); |
|
400 | + $this->_admin_page_title = esc_html__('Add Question', 'event_espresso'); |
|
401 | 401 | break; |
402 | 402 | case 'edit_question' : |
403 | - $this->_admin_page_title = esc_html__( 'Edit Question', 'event_espresso' ); |
|
403 | + $this->_admin_page_title = esc_html__('Edit Question', 'event_espresso'); |
|
404 | 404 | break; |
405 | 405 | default : |
406 | - $this->_admin_page_title = ucwords( str_replace( '_', ' ', $this->_req_action )); |
|
406 | + $this->_admin_page_title = ucwords(str_replace('_', ' ', $this->_req_action)); |
|
407 | 407 | } |
408 | 408 | |
409 | 409 | // add PRC_ID to title if editing |
410 | - $this->_admin_page_title = $ID ? $this->_admin_page_title . ' # ' . $ID : $this->_admin_page_title; |
|
411 | - if($ID){ |
|
412 | - $question=$this->_question_model->get_one_by_ID($ID); |
|
413 | - $additional_hidden_fields=array('QST_ID'=>array('type'=>'hidden','value'=>$ID)); |
|
410 | + $this->_admin_page_title = $ID ? $this->_admin_page_title.' # '.$ID : $this->_admin_page_title; |
|
411 | + if ($ID) { |
|
412 | + $question = $this->_question_model->get_one_by_ID($ID); |
|
413 | + $additional_hidden_fields = array('QST_ID'=>array('type'=>'hidden', 'value'=>$ID)); |
|
414 | 414 | $this->_set_add_edit_form_tags('update_question', $additional_hidden_fields); |
415 | - }else{ |
|
416 | - $question= EE_Question::new_instance(); |
|
415 | + } else { |
|
416 | + $question = EE_Question::new_instance(); |
|
417 | 417 | $question->set_order_to_latest(); |
418 | 418 | $this->_set_add_edit_form_tags('insert_question'); |
419 | 419 | } |
420 | - $question_types = $question->has_answers() ? $this->_question_model->question_types_in_same_category( $question->type() ) : $this->_question_model->allowed_question_types(); |
|
421 | - $this->_template_args['QST_ID']=$ID; |
|
422 | - $this->_template_args['question']=$question; |
|
423 | - $this->_template_args['question_types']= $question_types; |
|
424 | - $this->_template_args['max_max'] = EEM_Question::instance()->absolute_max_for_system_question( $question->system_ID() ); |
|
420 | + $question_types = $question->has_answers() ? $this->_question_model->question_types_in_same_category($question->type()) : $this->_question_model->allowed_question_types(); |
|
421 | + $this->_template_args['QST_ID'] = $ID; |
|
422 | + $this->_template_args['question'] = $question; |
|
423 | + $this->_template_args['question_types'] = $question_types; |
|
424 | + $this->_template_args['max_max'] = EEM_Question::instance()->absolute_max_for_system_question($question->system_ID()); |
|
425 | 425 | $this->_template_args['question_type_descriptions'] = $this->_get_question_type_descriptions(); |
426 | - $this->_set_publish_post_box_vars( 'id', $ID ); |
|
427 | - $this->_template_args['admin_page_content'] = EEH_Template::display_template( REGISTRATION_FORM_TEMPLATE_PATH . 'questions_main_meta_box.template.php', $this->_template_args, TRUE ); |
|
426 | + $this->_set_publish_post_box_vars('id', $ID); |
|
427 | + $this->_template_args['admin_page_content'] = EEH_Template::display_template(REGISTRATION_FORM_TEMPLATE_PATH.'questions_main_meta_box.template.php', $this->_template_args, TRUE); |
|
428 | 428 | |
429 | 429 | // the details template wrapper |
430 | 430 | $this->display_admin_page_with_sidebar(); |
@@ -439,18 +439,18 @@ discard block |
||
439 | 439 | EE_Registry::instance()->load_helper('HTML'); |
440 | 440 | $descriptions = ''; |
441 | 441 | $question_type_descriptions = EEM_Question::instance()->question_descriptions(); |
442 | - foreach ( $question_type_descriptions as $type => $question_type_description ) { |
|
443 | - if ( $type == 'HTML_TEXTAREA' ) { |
|
442 | + foreach ($question_type_descriptions as $type => $question_type_description) { |
|
443 | + if ($type == 'HTML_TEXTAREA') { |
|
444 | 444 | $html = new EE_Simple_HTML_Validation_Strategy(); |
445 | 445 | $question_type_description .= sprintf( |
446 | - esc_html__( '%1$s(allowed tags: %2$s)', 'event_espresso' ), |
|
446 | + esc_html__('%1$s(allowed tags: %2$s)', 'event_espresso'), |
|
447 | 447 | '<br/>', |
448 | 448 | $html->get_list_of_allowed_tags() |
449 | 449 | ); |
450 | 450 | } |
451 | 451 | $descriptions .= EEH_HTML::p( |
452 | 452 | $question_type_description, |
453 | - 'question_type_description-' . $type, |
|
453 | + 'question_type_description-'.$type, |
|
454 | 454 | 'question_type_description description', |
455 | 455 | 'display:none;' |
456 | 456 | ); |
@@ -464,58 +464,58 @@ discard block |
||
464 | 464 | * @param bool|true $new_question |
465 | 465 | * @throws \EE_Error |
466 | 466 | */ |
467 | - protected function _insert_or_update_question( $new_question = TRUE) { |
|
468 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
469 | - $set_column_values=$this->_set_column_values_for($this->_question_model); |
|
470 | - if($new_question){ |
|
471 | - $ID=$this->_question_model->insert($set_column_values); |
|
467 | + protected function _insert_or_update_question($new_question = TRUE) { |
|
468 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
469 | + $set_column_values = $this->_set_column_values_for($this->_question_model); |
|
470 | + if ($new_question) { |
|
471 | + $ID = $this->_question_model->insert($set_column_values); |
|
472 | 472 | $success = $ID ? true : false; |
473 | 473 | $action_desc = 'added'; |
474 | - }else{ |
|
475 | - $ID=absint($this->_req_data['QST_ID']); |
|
476 | - $pk=$this->_question_model->primary_key_name(); |
|
477 | - $wheres=array($pk=>$ID); |
|
474 | + } else { |
|
475 | + $ID = absint($this->_req_data['QST_ID']); |
|
476 | + $pk = $this->_question_model->primary_key_name(); |
|
477 | + $wheres = array($pk=>$ID); |
|
478 | 478 | unset($set_column_values[$pk]); |
479 | - $success= $this->_question_model->update($set_column_values,array($wheres)); |
|
480 | - $action_desc='updated'; |
|
479 | + $success = $this->_question_model->update($set_column_values, array($wheres)); |
|
480 | + $action_desc = 'updated'; |
|
481 | 481 | } |
482 | 482 | |
483 | - if ($ID){ |
|
483 | + if ($ID) { |
|
484 | 484 | //save the related options |
485 | 485 | //trash removed options, save old ones |
486 | 486 | //get list of all options |
487 | 487 | /** @type EE_Question $question */ |
488 | - $question=$this->_question_model->get_one_by_ID($ID); |
|
489 | - $options=$question->options(); |
|
490 | - if(! empty($options)){ |
|
491 | - foreach($options as $option_ID=>$option){ |
|
492 | - $option_req_index=$this->_get_option_req_data_index($option_ID); |
|
493 | - if($option_req_index!==FALSE){ |
|
488 | + $question = $this->_question_model->get_one_by_ID($ID); |
|
489 | + $options = $question->options(); |
|
490 | + if ( ! empty($options)) { |
|
491 | + foreach ($options as $option_ID=>$option) { |
|
492 | + $option_req_index = $this->_get_option_req_data_index($option_ID); |
|
493 | + if ($option_req_index !== FALSE) { |
|
494 | 494 | $option->save($this->_req_data['question_options'][$option_req_index]); |
495 | - }else{ |
|
495 | + } else { |
|
496 | 496 | //not found, remove it |
497 | 497 | $option->delete(); |
498 | 498 | } |
499 | 499 | } |
500 | 500 | } |
501 | 501 | //save new related options |
502 | - foreach($this->_req_data['question_options'] as $index=>$option_req_data){ |
|
503 | - if( empty($option_req_data['QSO_ID'] ) && ( ( isset( $option_req_data['QSO_value'] ) && $option_req_data['QSO_value'] !== '' ) || ! empty( $option_req_data['QSO_desc'] ) ) ) {//no ID! save it! |
|
504 | - if( ! isset( $option_req_data['QSO_value'] ) || $option_req_data['QSO_value'] === '' ){ |
|
505 | - $option_req_data['QSO_value']=$option_req_data['QSO_desc']; |
|
502 | + foreach ($this->_req_data['question_options'] as $index=>$option_req_data) { |
|
503 | + if (empty($option_req_data['QSO_ID']) && ((isset($option_req_data['QSO_value']) && $option_req_data['QSO_value'] !== '') || ! empty($option_req_data['QSO_desc']))) {//no ID! save it! |
|
504 | + if ( ! isset($option_req_data['QSO_value']) || $option_req_data['QSO_value'] === '') { |
|
505 | + $option_req_data['QSO_value'] = $option_req_data['QSO_desc']; |
|
506 | 506 | } |
507 | - $new_option=EE_Question_Option::new_instance( array( 'QSO_value' => $option_req_data['QSO_value'], 'QSO_desc' => $option_req_data['QSO_desc'], 'QSO_order' => $option_req_data['QSO_order'], 'QST_ID' => $question->ID())); |
|
507 | + $new_option = EE_Question_Option::new_instance(array('QSO_value' => $option_req_data['QSO_value'], 'QSO_desc' => $option_req_data['QSO_desc'], 'QSO_order' => $option_req_data['QSO_order'], 'QST_ID' => $question->ID())); |
|
508 | 508 | $new_option->save(); |
509 | 509 | } |
510 | 510 | } |
511 | 511 | } |
512 | - $query_args = array( 'action' => 'edit_question', 'QST_ID' => $ID ); |
|
513 | - if ( $success !== FALSE ) { |
|
514 | - $msg = $new_question ? sprintf( esc_html__('The %s has been created', 'event_espresso'), $this->_question_model->item_name() ) : sprintf( esc_html__('The %s has been updated', 'event_espresso' ), $this->_question_model->item_name() ); |
|
515 | - EE_Error::add_success( $msg ); |
|
512 | + $query_args = array('action' => 'edit_question', 'QST_ID' => $ID); |
|
513 | + if ($success !== FALSE) { |
|
514 | + $msg = $new_question ? sprintf(esc_html__('The %s has been created', 'event_espresso'), $this->_question_model->item_name()) : sprintf(esc_html__('The %s has been updated', 'event_espresso'), $this->_question_model->item_name()); |
|
515 | + EE_Error::add_success($msg); |
|
516 | 516 | } |
517 | 517 | |
518 | - $this->_redirect_after_action( FALSE, '', $action_desc, $query_args, TRUE); |
|
518 | + $this->_redirect_after_action(FALSE, '', $action_desc, $query_args, TRUE); |
|
519 | 519 | } |
520 | 520 | |
521 | 521 | |
@@ -528,10 +528,10 @@ discard block |
||
528 | 528 | * @param int $ID of the question option to find |
529 | 529 | * @return int index in question_options array if successful, FALSE if unsuccessful |
530 | 530 | */ |
531 | - protected function _get_option_req_data_index($ID){ |
|
532 | - $req_data_for_question_options=$this->_req_data['question_options']; |
|
533 | - foreach($req_data_for_question_options as $num=>$option_data){ |
|
534 | - if( array_key_exists('QSO_ID',$option_data) && (int)$option_data['QSO_ID'] === $ID ){ |
|
531 | + protected function _get_option_req_data_index($ID) { |
|
532 | + $req_data_for_question_options = $this->_req_data['question_options']; |
|
533 | + foreach ($req_data_for_question_options as $num=>$option_data) { |
|
534 | + if (array_key_exists('QSO_ID', $option_data) && (int) $option_data['QSO_ID'] === $ID) { |
|
535 | 535 | return $num; |
536 | 536 | } |
537 | 537 | } |
@@ -553,25 +553,25 @@ discard block |
||
553 | 553 | * @param int $current_page |
554 | 554 | * @return array lik EEM_Base::get_all's $query_params parameter |
555 | 555 | */ |
556 | - protected function get_query_params($model, $per_page=10,$current_page=10){ |
|
556 | + protected function get_query_params($model, $per_page = 10, $current_page = 10) { |
|
557 | 557 | $query_params = array(); |
558 | - $offset=($current_page-1)*$per_page; |
|
559 | - $query_params['limit']=array($offset,$per_page); |
|
560 | - $order = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC'; |
|
558 | + $offset = ($current_page - 1) * $per_page; |
|
559 | + $query_params['limit'] = array($offset, $per_page); |
|
560 | + $order = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC'; |
|
561 | 561 | $orderby_field = $model instanceof EEM_Question ? 'QST_ID' : 'QSG_order'; |
562 | 562 | $field_to_order_by = empty($this->_req_data['orderby']) ? $orderby_field : $this->_req_data['orderby']; |
563 | - $query_params['order_by']=array( $field_to_order_by => $order ); |
|
564 | - $search_string = array_key_exists('s',$this->_req_data) ? $this->_req_data['s'] : null; |
|
565 | - if(! empty($search_string)){ |
|
566 | - if($model instanceof EEM_Question_Group){ |
|
567 | - $query_params[0]=array( |
|
563 | + $query_params['order_by'] = array($field_to_order_by => $order); |
|
564 | + $search_string = array_key_exists('s', $this->_req_data) ? $this->_req_data['s'] : null; |
|
565 | + if ( ! empty($search_string)) { |
|
566 | + if ($model instanceof EEM_Question_Group) { |
|
567 | + $query_params[0] = array( |
|
568 | 568 | 'OR'=>array( |
569 | - 'QSG_name'=>array('LIKE',"%$search_string%"), |
|
570 | - 'QSG_desc'=>array('LIKE',"%$search_string%")) |
|
569 | + 'QSG_name'=>array('LIKE', "%$search_string%"), |
|
570 | + 'QSG_desc'=>array('LIKE', "%$search_string%")) |
|
571 | 571 | ); |
572 | - }else{ |
|
573 | - $query_params[0]=array( |
|
574 | - 'QST_display_text'=>array('LIKE',"%$search_string%") |
|
572 | + } else { |
|
573 | + $query_params[0] = array( |
|
574 | + 'QST_display_text'=>array('LIKE', "%$search_string%") |
|
575 | 575 | ); |
576 | 576 | } |
577 | 577 | } |
@@ -619,13 +619,13 @@ discard block |
||
619 | 619 | * @param bool|false $count |
620 | 620 | * @return \EE_Soft_Delete_Base_Class[]|int |
621 | 621 | */ |
622 | - public function get_questions( $per_page=10, $current_page = 1, $count = FALSE ) { |
|
622 | + public function get_questions($per_page = 10, $current_page = 1, $count = FALSE) { |
|
623 | 623 | $QST = EEM_Question::instance(); |
624 | 624 | $query_params = $this->get_query_params($QST, $per_page, $current_page); |
625 | - if ($count){ |
|
626 | - $where = isset( $query_params[0] ) ? array( $query_params[0] ) : array(); |
|
625 | + if ($count) { |
|
626 | + $where = isset($query_params[0]) ? array($query_params[0]) : array(); |
|
627 | 627 | $results = $QST->count($where); |
628 | - }else{ |
|
628 | + } else { |
|
629 | 629 | $results = $QST->get_all($query_params); |
630 | 630 | } |
631 | 631 | return $results; |
@@ -640,10 +640,10 @@ discard block |
||
640 | 640 | * @param bool|false $count |
641 | 641 | * @return \EE_Soft_Delete_Base_Class[]|int |
642 | 642 | */ |
643 | - public function get_trashed_questions( $per_page, $current_page = 1, $count = FALSE ) { |
|
644 | - $query_params =$this->get_query_params( EEM_Question::instance(), $per_page, $current_page); |
|
645 | - $where = isset( $query_params[0] ) ? array($query_params[0]) : array(); |
|
646 | - $questions =$count ? EEM_Question::instance()->count_deleted($where) : EEM_Question::instance()->get_all_deleted($query_params); |
|
643 | + public function get_trashed_questions($per_page, $current_page = 1, $count = FALSE) { |
|
644 | + $query_params = $this->get_query_params(EEM_Question::instance(), $per_page, $current_page); |
|
645 | + $where = isset($query_params[0]) ? array($query_params[0]) : array(); |
|
646 | + $questions = $count ? EEM_Question::instance()->count_deleted($where) : EEM_Question::instance()->get_all_deleted($query_params); |
|
647 | 647 | return $questions; |
648 | 648 | } |
649 | 649 | |
@@ -655,12 +655,12 @@ discard block |
||
655 | 655 | * @param bool|false $count |
656 | 656 | * @return \EE_Soft_Delete_Base_Class[] |
657 | 657 | */ |
658 | - public function get_question_groups( $per_page, $current_page = 1, $count = FALSE ) { |
|
658 | + public function get_question_groups($per_page, $current_page = 1, $count = FALSE) { |
|
659 | 659 | /** @type EEM_Question_Group $questionGroupModel */ |
660 | 660 | $questionGroupModel = EEM_Question_Group::instance(); |
661 | 661 | //note: this a subclass of EEM_Soft_Delete_Base, so this is actually only getting non-trashed items |
662 | 662 | return $questionGroupModel->get_all( |
663 | - $this->get_query_params( $questionGroupModel, $per_page, $current_page ) |
|
663 | + $this->get_query_params($questionGroupModel, $per_page, $current_page) |
|
664 | 664 | ); |
665 | 665 | } |
666 | 666 |
@@ -96,9 +96,9 @@ discard block |
||
96 | 96 | } |
97 | 97 | |
98 | 98 | $ticket_details_css_id = apply_filters( |
99 | - 'FHEE__ticket_selector_chart_template__ticket_details_css_id', |
|
100 | - "tckt-slctr-tkt-details-{$EVT_ID}-{$TKT_ID}" |
|
101 | - ); |
|
99 | + 'FHEE__ticket_selector_chart_template__ticket_details_css_id', |
|
100 | + "tckt-slctr-tkt-details-{$EVT_ID}-{$TKT_ID}" |
|
101 | + ); |
|
102 | 102 | ?> |
103 | 103 | <tr class="tckt-slctr-tbl-tr <?php echo $status_class . ' ' . espresso_get_object_css_class( $ticket ); ?>"> |
104 | 104 | <?php |
@@ -469,13 +469,13 @@ discard block |
||
469 | 469 | <th scope="col" class="ee-ticket-selector-ticket-qty-th cntr"> |
470 | 470 | <?php |
471 | 471 | /** |
472 | - * Filters the text printed for the header of the quantity column in the ticket selector table |
|
473 | - * |
|
474 | - * @since 4.7.2 |
|
475 | - * |
|
476 | - * @param string 'Qty*' The translatable text to display in the table header for the Quantity of tickets |
|
477 | - * @param int $EVT_ID The Event ID |
|
478 | - */ |
|
472 | + * Filters the text printed for the header of the quantity column in the ticket selector table |
|
473 | + * |
|
474 | + * @since 4.7.2 |
|
475 | + * |
|
476 | + * @param string 'Qty*' The translatable text to display in the table header for the Quantity of tickets |
|
477 | + * @param int $EVT_ID The Event ID |
|
478 | + */ |
|
479 | 479 | echo esc_html( apply_filters( 'FHEE__ticket_selector_chart_template__table_header_qty', __( 'Qty*', 'event_espresso' ), $EVT_ID ) ); |
480 | 480 | ?> |
481 | 481 | </th> |
@@ -8,34 +8,34 @@ discard block |
||
8 | 8 | |
9 | 9 | $row = 1; |
10 | 10 | $max = 1; |
11 | -$ticket_count = count( $tickets ); |
|
11 | +$ticket_count = count($tickets); |
|
12 | 12 | |
13 | -if ( ! $ticket_count ) { |
|
13 | +if ( ! $ticket_count) { |
|
14 | 14 | return; |
15 | 15 | } |
16 | 16 | |
17 | 17 | $required_ticket_sold_out = FALSE; |
18 | -$template_settings = isset ( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector ) |
|
18 | +$template_settings = isset (EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector) |
|
19 | 19 | ? EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector |
20 | 20 | : new EE_Ticket_Selector_Config(); |
21 | 21 | |
22 | 22 | ob_start(); |
23 | 23 | |
24 | -foreach ( $tickets as $TKT_ID => $ticket ) { |
|
25 | - if ( $ticket instanceof EE_Ticket ) { |
|
26 | - $max = min( $ticket->max(), $max_atndz ); |
|
24 | +foreach ($tickets as $TKT_ID => $ticket) { |
|
25 | + if ($ticket instanceof EE_Ticket) { |
|
26 | + $max = min($ticket->max(), $max_atndz); |
|
27 | 27 | $min = 0; |
28 | 28 | $remaining = $ticket->remaining(); |
29 | - if ( $ticket->is_on_sale() && $ticket->is_remaining() ) { |
|
29 | + if ($ticket->is_on_sale() && $ticket->is_remaining()) { |
|
30 | 30 | // offer the number of $tickets_remaining or $max_atndz, whichever is smaller |
31 | - $max = min( $remaining, $max ); |
|
31 | + $max = min($remaining, $max); |
|
32 | 32 | // but... we also want to restrict the number of tickets by the ticket max setting, |
33 | 33 | // however, the max still can't be higher than what was just set above |
34 | - $max = $ticket->max() > 0 ? min( $ticket->max(), $max ) : $max; |
|
34 | + $max = $ticket->max() > 0 ? min($ticket->max(), $max) : $max; |
|
35 | 35 | // and we also want to restrict the minimum number of tickets by the ticket min setting |
36 | 36 | $min = $ticket->min() > 0 ? $ticket->min() : 0; |
37 | 37 | // and if the ticket is required, then make sure that min qty is at least 1 |
38 | - $min = $ticket->required() ? max( $min, 1 ) : $min; |
|
38 | + $min = $ticket->required() ? max($min, 1) : $min; |
|
39 | 39 | } else { |
40 | 40 | // set flag if ticket is required (flag is set to start date so that future tickets are not blocked) |
41 | 41 | $required_ticket_sold_out = $ticket->required() && ! $remaining ? $ticket->start_date() : $required_ticket_sold_out; |
@@ -44,41 +44,41 @@ discard block |
||
44 | 44 | $ticket_price = $ticket->get_ticket_total_with_taxes(); |
45 | 45 | $ticket_bundle = FALSE; |
46 | 46 | // for ticket bundles, set min and max qty the same |
47 | - if ( $ticket->min() != 0 && $ticket->min() == $ticket->max() ) { |
|
47 | + if ($ticket->min() != 0 && $ticket->min() == $ticket->max()) { |
|
48 | 48 | $ticket_price = $ticket_price * $ticket->min(); |
49 | 49 | $ticket_bundle = TRUE; |
50 | 50 | } |
51 | - $ticket_price = apply_filters( 'FHEE__ticket_selector_chart_template__ticket_price', $ticket_price, $ticket ); |
|
51 | + $ticket_price = apply_filters('FHEE__ticket_selector_chart_template__ticket_price', $ticket_price, $ticket); |
|
52 | 52 | // if a previous required ticket with the same sale start date is sold out, then mark this ticket as sold out as well. |
53 | 53 | // tickets that go on sale at a later date than the required ticket will NOT be affected |
54 | 54 | $tkt_status = $required_ticket_sold_out !== FALSE && $required_ticket_sold_out === $ticket->start_date() ? EE_Ticket::sold_out : $ticket->ticket_status(); |
55 | 55 | $tkt_status = $event_status === EE_Datetime::sold_out ? EE_Ticket::sold_out : $tkt_status; |
56 | 56 | // check ticket status |
57 | - switch ( $tkt_status ) { |
|
57 | + switch ($tkt_status) { |
|
58 | 58 | // sold_out |
59 | 59 | case EE_Ticket::sold_out : |
60 | - $ticket_status = '<span class="ticket-sales-sold-out">' . $ticket->ticket_status( TRUE ) . '</span>'; |
|
60 | + $ticket_status = '<span class="ticket-sales-sold-out">'.$ticket->ticket_status(TRUE).'</span>'; |
|
61 | 61 | $status_class = 'ticket-sales-sold-out lt-grey-text'; |
62 | 62 | break; |
63 | 63 | // expired |
64 | 64 | case EE_Ticket::expired : |
65 | - $ticket_status = '<span class="ticket-sales-expired">' . $ticket->ticket_status( TRUE ) . '</span>'; |
|
65 | + $ticket_status = '<span class="ticket-sales-expired">'.$ticket->ticket_status(TRUE).'</span>'; |
|
66 | 66 | $status_class = 'ticket-sales-expired lt-grey-text'; |
67 | 67 | break; |
68 | 68 | // archived |
69 | 69 | case EE_Ticket::archived : |
70 | - $ticket_status = '<span class="archived-ticket">' . $ticket->ticket_status( TRUE ) . '</span>'; |
|
70 | + $ticket_status = '<span class="archived-ticket">'.$ticket->ticket_status(TRUE).'</span>'; |
|
71 | 71 | $status_class = 'archived-ticket hidden'; |
72 | 72 | break; |
73 | 73 | // pending |
74 | 74 | case EE_Ticket::pending : |
75 | - $ticket_status = '<span class="ticket-pending">' . $ticket->ticket_status( TRUE ) . '</span>'; |
|
75 | + $ticket_status = '<span class="ticket-pending">'.$ticket->ticket_status(TRUE).'</span>'; |
|
76 | 76 | $status_class = 'ticket-pending'; |
77 | 77 | break; |
78 | 78 | // onsale |
79 | 79 | case EE_Ticket::onsale : |
80 | 80 | default : |
81 | - $ticket_status = '<span class="ticket-on-sale">' . $ticket->ticket_status( TRUE ) . '</span>'; |
|
81 | + $ticket_status = '<span class="ticket-on-sale">'.$ticket->ticket_status(TRUE).'</span>'; |
|
82 | 82 | $status_class = 'ticket-on-sale'; |
83 | 83 | break; |
84 | 84 | } |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | "tckt-slctr-tkt-details-{$EVT_ID}-{$TKT_ID}" |
119 | 119 | ); |
120 | 120 | ?> |
121 | - <tr class="tckt-slctr-tbl-tr <?php echo $status_class . ' ' . espresso_get_object_css_class( $ticket ); ?>"> |
|
121 | + <tr class="tckt-slctr-tbl-tr <?php echo $status_class.' '.espresso_get_object_css_class($ticket); ?>"> |
|
122 | 122 | <?php |
123 | 123 | /** |
124 | 124 | * Allow plugins to hook in and abort the generation and display of the contents of this |
@@ -130,24 +130,24 @@ discard block |
||
130 | 130 | * |
131 | 131 | * @var string|bool |
132 | 132 | */ |
133 | - if ( false !== ( $new_row_cells_content = apply_filters( 'FHEE__ticket_selector_chart_template__do_ticket_inside_row', false, $ticket, $max, $min, $required_ticket_sold_out, $ticket_price, $ticket_bundle, $ticket_status, $status_class ) ) ) { |
|
133 | + if (false !== ($new_row_cells_content = apply_filters('FHEE__ticket_selector_chart_template__do_ticket_inside_row', false, $ticket, $max, $min, $required_ticket_sold_out, $ticket_price, $ticket_bundle, $ticket_status, $status_class))) { |
|
134 | 134 | echo $new_row_cells_content; |
135 | 135 | echo '</tr>'; |
136 | 136 | continue; |
137 | 137 | } |
138 | 138 | ?> |
139 | 139 | <td class="tckt-slctr-tbl-td-name"> |
140 | - <b><?php echo $ticket->get_pretty('TKT_name');?></b> |
|
141 | - <?php if ( $template_settings->show_ticket_details ) : ?> |
|
142 | - <a id="display-<?php echo $ticket_details_css_id; ?>" class="display-tckt-slctr-tkt-details display-the-hidden lt-grey-text smaller-text hide-if-no-js" rel="<?php echo $ticket_details_css_id; ?>" title="<?php echo esc_attr( apply_filters( 'FHEE__ticket_selector_chart_template__show_ticket_details_link_title', __( 'click to show additional ticket details', 'event_espresso' )) ); ?>"> |
|
143 | - <?php echo sprintf( __( 'show%1$sdetails%1$s+', 'event_espresso' ), ' ' ); ?> |
|
140 | + <b><?php echo $ticket->get_pretty('TKT_name'); ?></b> |
|
141 | + <?php if ($template_settings->show_ticket_details) : ?> |
|
142 | + <a id="display-<?php echo $ticket_details_css_id; ?>" class="display-tckt-slctr-tkt-details display-the-hidden lt-grey-text smaller-text hide-if-no-js" rel="<?php echo $ticket_details_css_id; ?>" title="<?php echo esc_attr(apply_filters('FHEE__ticket_selector_chart_template__show_ticket_details_link_title', __('click to show additional ticket details', 'event_espresso'))); ?>"> |
|
143 | + <?php echo sprintf(__('show%1$sdetails%1$s+', 'event_espresso'), ' '); ?> |
|
144 | 144 | </a> |
145 | - <a id="hide-<?php echo $ticket_details_css_id; ?>" class="hide-tckt-slctr-tkt-details hide-the-displayed lt-grey-text smaller-text hide-if-no-js" rel="<?php echo $ticket_details_css_id; ?>" title="<?php echo esc_attr( apply_filters( 'FHEE__ticket_selector_chart_template__hide_ticket_details_link_title', __( 'click to hide additional ticket details', 'event_espresso' )) ); ?>" style="display:none;"> |
|
146 | - <?php echo sprintf( __( 'hide%1$sdetails%1$s-', 'event_espresso' ), ' ' ); ?> |
|
145 | + <a id="hide-<?php echo $ticket_details_css_id; ?>" class="hide-tckt-slctr-tkt-details hide-the-displayed lt-grey-text smaller-text hide-if-no-js" rel="<?php echo $ticket_details_css_id; ?>" title="<?php echo esc_attr(apply_filters('FHEE__ticket_selector_chart_template__hide_ticket_details_link_title', __('click to hide additional ticket details', 'event_espresso'))); ?>" style="display:none;"> |
|
146 | + <?php echo sprintf(__('hide%1$sdetails%1$s-', 'event_espresso'), ' '); ?> |
|
147 | 147 | </a> |
148 | 148 | <?php endif; //end show details check ?> |
149 | - <?php if ( $ticket->required() ) { ?> |
|
150 | - <p class="ticket-required-pg"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_required_message', __( 'This ticket is required and must be purchased.', 'event_espresso' )); ?></p> |
|
149 | + <?php if ($ticket->required()) { ?> |
|
150 | + <p class="ticket-required-pg"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_required_message', __('This ticket is required and must be purchased.', 'event_espresso')); ?></p> |
|
151 | 151 | <?php } ?> |
152 | 152 | <?php |
153 | 153 | // echo '<br/><b>$max_atndz : ' . $max_atndz . '</b>'; |
@@ -161,63 +161,63 @@ discard block |
||
161 | 161 | // echo '<br/><b> $ticket->required() : ' . $ticket->uses() . '</b>'; |
162 | 162 | ?> |
163 | 163 | </td> |
164 | - <?php if ( apply_filters( 'FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE )) { ?> |
|
165 | - <td class="tckt-slctr-tbl-td-price jst-rght"><?php echo EEH_Template::format_currency( $ticket_price ); ?> <span class="smaller-text no-bold"><?php |
|
166 | - if ( $ticket_bundle ) { |
|
167 | - echo apply_filters( 'FHEE__ticket_selector_chart_template__per_ticket_bundle_text', __( ' / bundle', 'event_espresso' )); |
|
164 | + <?php if (apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE)) { ?> |
|
165 | + <td class="tckt-slctr-tbl-td-price jst-rght"><?php echo EEH_Template::format_currency($ticket_price); ?> <span class="smaller-text no-bold"><?php |
|
166 | + if ($ticket_bundle) { |
|
167 | + echo apply_filters('FHEE__ticket_selector_chart_template__per_ticket_bundle_text', __(' / bundle', 'event_espresso')); |
|
168 | 168 | } else { |
169 | - echo apply_filters( 'FHEE__ticket_selector_chart_template__per_ticket_text', __( '', 'event_espresso' )); |
|
169 | + echo apply_filters('FHEE__ticket_selector_chart_template__per_ticket_text', __('', 'event_espresso')); |
|
170 | 170 | }?></span> </td> |
171 | 171 | <?php } ?> |
172 | 172 | <td class="tckt-slctr-tbl-td-qty cntr"> |
173 | 173 | <?php |
174 | 174 | $hidden_input_qty = $max_atndz > 1 ? TRUE : FALSE; |
175 | 175 | // sold out or other status ? |
176 | - if ( $tkt_status == EE_Ticket::sold_out || $remaining == 0 ) { |
|
176 | + if ($tkt_status == EE_Ticket::sold_out || $remaining == 0) { |
|
177 | 177 | ?> |
178 | - <span class="sold-out"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_sold_out_msg', __( 'Sold Out', 'event_espresso' ));?></span> |
|
178 | + <span class="sold-out"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_sold_out_msg', __('Sold Out', 'event_espresso')); ?></span> |
|
179 | 179 | <?php |
180 | - } else if ( $tkt_status == EE_Ticket::expired || $tkt_status == EE_Ticket::archived ) { |
|
180 | + } else if ($tkt_status == EE_Ticket::expired || $tkt_status == EE_Ticket::archived) { |
|
181 | 181 | echo $ticket_status; |
182 | - } else if ( $tkt_status == EE_Ticket::pending ) { |
|
182 | + } else if ($tkt_status == EE_Ticket::pending) { |
|
183 | 183 | ?> |
184 | 184 | <div class="ticket-pending-pg"> |
185 | - <span class="ticket-pending"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_goes_on_sale_msg', __( 'Goes On Sale', 'event_espresso' )); ?></span><br/> |
|
186 | - <span class="small-text"><?php echo $ticket->get_i18n_datetime( 'TKT_start_date', apply_filters( 'FHEE__EED_Ticket_Selector__display_goes_on_sale__date_format', $date_format ) ); ?></span> |
|
185 | + <span class="ticket-pending"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_goes_on_sale_msg', __('Goes On Sale', 'event_espresso')); ?></span><br/> |
|
186 | + <span class="small-text"><?php echo $ticket->get_i18n_datetime('TKT_start_date', apply_filters('FHEE__EED_Ticket_Selector__display_goes_on_sale__date_format', $date_format)); ?></span> |
|
187 | 187 | </div> |
188 | 188 | <?php |
189 | 189 | // min qty purchasable is less than tickets available |
190 | - } else if ( $ticket->min() > $remaining ) { |
|
190 | + } else if ($ticket->min() > $remaining) { |
|
191 | 191 | ?> |
192 | 192 | <div class="archived-ticket-pg"> |
193 | - <span class="archived-ticket small-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_not_available_msg', __( 'Not Available', 'event_espresso' )); ?></span><br/> |
|
193 | + <span class="archived-ticket small-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_not_available_msg', __('Not Available', 'event_espresso')); ?></span><br/> |
|
194 | 194 | </div> |
195 | 195 | <?php |
196 | 196 | // if only one attendee is allowed to register at a time |
197 | - } else if ( $max_atndz == 1 ) { |
|
197 | + } else if ($max_atndz == 1) { |
|
198 | 198 | // display submit button since we have tickets available |
199 | - add_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' ); |
|
199 | + add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
200 | 200 | ?> |
201 | - <input type="radio" name="tkt-slctr-qty-<?php echo $EVT_ID; ?>" id="ticket-selector-tbl-qty-slct-<?php echo $EVT_ID . '-' . $row; ?>" class="ticket-selector-tbl-qty-slct" value="<?php echo $row . '-'; ?>1" <?php echo $row == 1 ? ' checked="checked"' : ''; ?> title=""/> |
|
201 | + <input type="radio" name="tkt-slctr-qty-<?php echo $EVT_ID; ?>" id="ticket-selector-tbl-qty-slct-<?php echo $EVT_ID.'-'.$row; ?>" class="ticket-selector-tbl-qty-slct" value="<?php echo $row.'-'; ?>1" <?php echo $row == 1 ? ' checked="checked"' : ''; ?> title=""/> |
|
202 | 202 | <?php |
203 | 203 | $hidden_input_qty = FALSE; |
204 | 204 | |
205 | - } else if ( $max_atndz == 0 ) { |
|
206 | - echo '<span class="sold-out">' . apply_filters( 'FHEE__ticket_selector_chart_template__ticket_closed_msg', __( 'Closed', 'event_espresso' )) . '</span>'; |
|
207 | - } elseif ( $max > 0 ) { |
|
205 | + } else if ($max_atndz == 0) { |
|
206 | + echo '<span class="sold-out">'.apply_filters('FHEE__ticket_selector_chart_template__ticket_closed_msg', __('Closed', 'event_espresso')).'</span>'; |
|
207 | + } elseif ($max > 0) { |
|
208 | 208 | // display submit button since we have tickets available |
209 | - add_filter( 'FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true' ); |
|
209 | + add_filter('FHEE__EE_Ticket_Selector__display_ticket_selector_submit', '__return_true'); |
|
210 | 210 | |
211 | 211 | ?> |
212 | - <select name="tkt-slctr-qty-<?php echo $EVT_ID; ?>[]" id="ticket-selector-tbl-qty-slct-<?php echo $EVT_ID . '-' . $row; ?>" class="ticket-selector-tbl-qty-slct" title=""> |
|
212 | + <select name="tkt-slctr-qty-<?php echo $EVT_ID; ?>[]" id="ticket-selector-tbl-qty-slct-<?php echo $EVT_ID.'-'.$row; ?>" class="ticket-selector-tbl-qty-slct" title=""> |
|
213 | 213 | <?php |
214 | 214 | // this ensures that non-required tickets with non-zero MIN QTYs don't HAVE to be purchased |
215 | - if ( ! $ticket->required() && $min !== 0 ) { |
|
215 | + if ( ! $ticket->required() && $min !== 0) { |
|
216 | 216 | ?> |
217 | 217 | <option value="0"> 0 </option> |
218 | 218 | <?php } |
219 | 219 | // offer ticket quantities from the min to the max |
220 | - for ( $i = $min; $i <= $max; $i++) { |
|
220 | + for ($i = $min; $i <= $max; $i++) { |
|
221 | 221 | ?> |
222 | 222 | <option value="<?php echo $i; ?>"> <?php echo $i; ?> </option> |
223 | 223 | <?php } ?> |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | |
228 | 228 | } |
229 | 229 | // depending on group reg we need to change the format for qty |
230 | - if ( $hidden_input_qty ) { |
|
230 | + if ($hidden_input_qty) { |
|
231 | 231 | ?> |
232 | 232 | <input type="hidden" name="tkt-slctr-qty-<?php echo $EVT_ID; ?>[]" value="0" /> |
233 | 233 | <?php |
@@ -237,33 +237,33 @@ discard block |
||
237 | 237 | |
238 | 238 | </td> |
239 | 239 | </tr> |
240 | - <?php if ( $template_settings->show_ticket_details ) : ?> |
|
241 | - <tr class="tckt-slctr-tkt-details-tr <?php echo espresso_get_object_css_class( $ticket, '', 'details' );?>"> |
|
240 | + <?php if ($template_settings->show_ticket_details) : ?> |
|
241 | + <tr class="tckt-slctr-tkt-details-tr <?php echo espresso_get_object_css_class($ticket, '', 'details'); ?>"> |
|
242 | 242 | <td class="tckt-slctr-tkt-details-td" colspan="3" > |
243 | 243 | <div id="<?php echo $ticket_details_css_id; ?>-dv" class="tckt-slctr-tkt-details-dv" style="display: none;"> |
244 | 244 | |
245 | 245 | <section class="tckt-slctr-tkt-details-sctn"> |
246 | - <h3><?php _e( 'Details', 'event_espresso' ); ?></h3> |
|
246 | + <h3><?php _e('Details', 'event_espresso'); ?></h3> |
|
247 | 247 | <p><?php echo $ticket->description(); ?></p> |
248 | 248 | |
249 | - <?php if ( $ticket_price != 0 && apply_filters( 'FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE )) { ?> |
|
249 | + <?php if ($ticket_price != 0 && apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE)) { ?> |
|
250 | 250 | <section class="tckt-slctr-tkt-price-sctn"> |
251 | - <h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_price_breakdown_heading', __( 'Price', 'event_espresso' )); ?></h5> |
|
251 | + <h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_price_breakdown_heading', __('Price', 'event_espresso')); ?></h5> |
|
252 | 252 | <div class="tckt-slctr-tkt-details-tbl-wrap-dv"> |
253 | 253 | <table class="tckt-slctr-tkt-details-tbl"> |
254 | 254 | <thead> |
255 | 255 | <tr> |
256 | - <th class="ee-third-width"><span class="small-text"><?php _e( 'Name', 'event_espresso' ); ?></span></th> |
|
257 | - <th class="jst-cntr"><span class="small-text"><?php _e( 'Description', 'event_espresso' ); ?></span></th> |
|
258 | - <th class="ee-fourth-width jst-rght"><span class="small-text"><?php _e( 'Amount', 'event_espresso' ); ?></span></th> |
|
256 | + <th class="ee-third-width"><span class="small-text"><?php _e('Name', 'event_espresso'); ?></span></th> |
|
257 | + <th class="jst-cntr"><span class="small-text"><?php _e('Description', 'event_espresso'); ?></span></th> |
|
258 | + <th class="ee-fourth-width jst-rght"><span class="small-text"><?php _e('Amount', 'event_espresso'); ?></span></th> |
|
259 | 259 | </tr> |
260 | 260 | </thead> |
261 | 261 | <tbody> |
262 | - <?php if ( $ticket->base_price() instanceof EE_Price ) { ?> |
|
262 | + <?php if ($ticket->base_price() instanceof EE_Price) { ?> |
|
263 | 263 | <tr> |
264 | - <td data-th="<?php _e( 'Name', 'event_espresso' ); ?>" class="small-text"><b><?php echo $ticket->base_price()->name(); ?></b></td> |
|
265 | - <td data-th="<?php _e( 'Description', 'event_espresso' ); ?>" class="small-text"><?php echo $ticket->base_price()->desc(); ?></td> |
|
266 | - <td data-th="<?php _e( 'Amount', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo $ticket->base_price()->pretty_price(); ?></td> |
|
264 | + <td data-th="<?php _e('Name', 'event_espresso'); ?>" class="small-text"><b><?php echo $ticket->base_price()->name(); ?></b></td> |
|
265 | + <td data-th="<?php _e('Description', 'event_espresso'); ?>" class="small-text"><?php echo $ticket->base_price()->desc(); ?></td> |
|
266 | + <td data-th="<?php _e('Amount', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo $ticket->base_price()->pretty_price(); ?></td> |
|
267 | 267 | </tr> |
268 | 268 | <?php |
269 | 269 | $running_total = $ticket->base_price()->amount(); |
@@ -271,44 +271,44 @@ discard block |
||
271 | 271 | $running_total = 0; |
272 | 272 | } |
273 | 273 | // now add price modifiers |
274 | - foreach ( $ticket->price_modifiers() as $price_mod ) { ?> |
|
274 | + foreach ($ticket->price_modifiers() as $price_mod) { ?> |
|
275 | 275 | <tr> |
276 | - <td data-th="<?php _e( 'Name', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo $price_mod->name(); ?></td> |
|
277 | - <?php if ( $price_mod->is_percent() ) { ?> |
|
278 | - <td data-th="<?php _e( 'Description', 'event_espresso' ); ?>" class="small-text"><?php echo $price_mod->desc(); ?> <?php echo $price_mod->amount(); ?>%</td> |
|
276 | + <td data-th="<?php _e('Name', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo $price_mod->name(); ?></td> |
|
277 | + <?php if ($price_mod->is_percent()) { ?> |
|
278 | + <td data-th="<?php _e('Description', 'event_espresso'); ?>" class="small-text"><?php echo $price_mod->desc(); ?> <?php echo $price_mod->amount(); ?>%</td> |
|
279 | 279 | <?php |
280 | - $new_sub_total = $running_total * ( $price_mod->amount() / 100 ); |
|
280 | + $new_sub_total = $running_total * ($price_mod->amount() / 100); |
|
281 | 281 | $new_sub_total = $price_mod->is_discount() ? $new_sub_total * -1 : $new_sub_total; |
282 | 282 | ?> |
283 | 283 | <?php } else { ?> |
284 | 284 | <?php $new_sub_total = $price_mod->is_discount() ? $price_mod->amount() * -1 : $price_mod->amount(); ?> |
285 | - <td data-th="<?php _e( 'Description', 'event_espresso' ); ?>" class="small-text"><?php echo $price_mod->desc(); ?></td> |
|
285 | + <td data-th="<?php _e('Description', 'event_espresso'); ?>" class="small-text"><?php echo $price_mod->desc(); ?></td> |
|
286 | 286 | <?php $new_sub_total = $price_mod->is_discount() ? $price_mod->amount() * -1 : $price_mod->amount(); ?> |
287 | 287 | <?php } ?> |
288 | - <td data-th="<?php _e( 'Amount', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo EEH_Template::format_currency( $new_sub_total ); ?></td> |
|
288 | + <td data-th="<?php _e('Amount', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo EEH_Template::format_currency($new_sub_total); ?></td> |
|
289 | 289 | <?php $running_total += $new_sub_total; ?> |
290 | 290 | </tr> |
291 | 291 | <?php } ?> |
292 | - <?php if ( $ticket->taxable() ) { ?> |
|
292 | + <?php if ($ticket->taxable()) { ?> |
|
293 | 293 | <?php //$ticket_subtotal =$ticket->get_ticket_subtotal(); ?> |
294 | 294 | <tr> |
295 | - <td colspan="2" class="jst-rght small-text sbttl"><b><?php _e( 'subtotal', 'event_espresso' ); ?></b></td> |
|
296 | - <td data-th="<?php _e( 'subtotal', 'event_espresso' ); ?>" class="jst-rght small-text"><b><?php echo EEH_Template::format_currency( $running_total ); ?></b></td> |
|
295 | + <td colspan="2" class="jst-rght small-text sbttl"><b><?php _e('subtotal', 'event_espresso'); ?></b></td> |
|
296 | + <td data-th="<?php _e('subtotal', 'event_espresso'); ?>" class="jst-rght small-text"><b><?php echo EEH_Template::format_currency($running_total); ?></b></td> |
|
297 | 297 | </tr> |
298 | 298 | |
299 | - <?php foreach ( $ticket->get_ticket_taxes_for_admin() as $tax ) { ?> |
|
299 | + <?php foreach ($ticket->get_ticket_taxes_for_admin() as $tax) { ?> |
|
300 | 300 | <tr> |
301 | - <td data-th="<?php _e( 'Name', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo $tax->name(); ?></td> |
|
302 | - <td data-th="<?php _e( 'Description', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo $tax->amount(); ?>%</td> |
|
303 | - <?php $tax_amount = $running_total * ( $tax->amount() / 100 ); ?> |
|
304 | - <td data-th="<?php _e( 'Amount', 'event_espresso' ); ?>" class="jst-rght small-text"><?php echo EEH_Template::format_currency( $tax_amount ); ?></td> |
|
301 | + <td data-th="<?php _e('Name', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo $tax->name(); ?></td> |
|
302 | + <td data-th="<?php _e('Description', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo $tax->amount(); ?>%</td> |
|
303 | + <?php $tax_amount = $running_total * ($tax->amount() / 100); ?> |
|
304 | + <td data-th="<?php _e('Amount', 'event_espresso'); ?>" class="jst-rght small-text"><?php echo EEH_Template::format_currency($tax_amount); ?></td> |
|
305 | 305 | <?php $running_total += $tax_amount; ?> |
306 | 306 | </tr> |
307 | 307 | <?php } ?> |
308 | 308 | <?php } ?> |
309 | 309 | <tr> |
310 | - <td colspan="2" class="jst-rght small-text ttl-lbl-td"><b><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_total_price', __( 'Total', 'event_espresso' )); ?></b></td> |
|
311 | - <td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_total_price', __( 'Total', 'event_espresso' )); ?>" class="jst-rght small-text"><b><?php echo EEH_Template::format_currency( $running_total ); ?></b></td> |
|
310 | + <td colspan="2" class="jst-rght small-text ttl-lbl-td"><b><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_total_price', __('Total', 'event_espresso')); ?></b></td> |
|
311 | + <td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_total_price', __('Total', 'event_espresso')); ?>" class="jst-rght small-text"><b><?php echo EEH_Template::format_currency($running_total); ?></b></td> |
|
312 | 312 | </tr> |
313 | 313 | </tbody> |
314 | 314 | </table> |
@@ -318,106 +318,106 @@ discard block |
||
318 | 318 | <?php } ?> |
319 | 319 | |
320 | 320 | <section class="tckt-slctr-tkt-sale-dates-sctn"> |
321 | - <h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_sales_date_heading', __( 'Sale Dates', 'event_espresso' )); ?></h5> |
|
322 | - <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_dates_available_message', __( 'The dates when this option is available for purchase.', 'event_espresso' )); ?></span><br/> |
|
323 | - <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_goes_on_sale', __( 'Goes On Sale:', 'event_espresso' )); ?></span><span class="dashicons dashicons-calendar"></span><?php echo $ticket->get_i18n_datetime( 'TKT_start_date', $date_format) . ' '; ?><span class="dashicons dashicons-clock"></span><?php echo $ticket->get_i18n_datetime( 'TKT_start_date', $time_format ) ; ?><br/> |
|
324 | - <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_sales_end', __( 'Sales End:', 'event_espresso' )); ?></span><span class="dashicons dashicons-calendar"></span><?php echo $ticket->get_i18n_datetime( 'TKT_end_date', $date_format ) . ' '; ?><span class="dashicons dashicons-clock"></span><?php echo $ticket->get_i18n_datetime( 'TKT_end_date', $time_format ) ; ?><br/> |
|
321 | + <h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_sales_date_heading', __('Sale Dates', 'event_espresso')); ?></h5> |
|
322 | + <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_dates_available_message', __('The dates when this option is available for purchase.', 'event_espresso')); ?></span><br/> |
|
323 | + <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_goes_on_sale', __('Goes On Sale:', 'event_espresso')); ?></span><span class="dashicons dashicons-calendar"></span><?php echo $ticket->get_i18n_datetime('TKT_start_date', $date_format).' '; ?><span class="dashicons dashicons-clock"></span><?php echo $ticket->get_i18n_datetime('TKT_start_date', $time_format); ?><br/> |
|
324 | + <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_sales_end', __('Sales End:', 'event_espresso')); ?></span><span class="dashicons dashicons-calendar"></span><?php echo $ticket->get_i18n_datetime('TKT_end_date', $date_format).' '; ?><span class="dashicons dashicons-clock"></span><?php echo $ticket->get_i18n_datetime('TKT_end_date', $time_format); ?><br/> |
|
325 | 325 | </section> |
326 | 326 | <br/> |
327 | 327 | |
328 | - <?php do_action( 'AHEE__ticket_selector_chart_template__after_ticket_date', $ticket ); ?> |
|
328 | + <?php do_action('AHEE__ticket_selector_chart_template__after_ticket_date', $ticket); ?> |
|
329 | 329 | |
330 | - <?php if ( $ticket->min() &&$ticket->max() ) { ?> |
|
330 | + <?php if ($ticket->min() && $ticket->max()) { ?> |
|
331 | 331 | <section class="tckt-slctr-tkt-quantities-sctn"> |
332 | - <h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_heading', __( 'Purchasable Quantities', 'event_espresso' )); ?></h5> |
|
333 | - <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_message', __( 'The number of tickets that can be purchased per transaction (if available).', 'event_espresso' )); ?></span><br/> |
|
334 | - <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty', __( 'Minimum Qty:', 'event_espresso' )); ?></span><?php echo $ticket->min() > 0 ? $ticket->min() : 0; ?> |
|
335 | - <?php if ( $ticket->min() > $remaining ) { ?> <span class="important-notice small-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty_message', __( 'The Minimum Quantity purchasable for this ticket exceeds the number of spaces remaining', 'event_espresso' )); ?></span><?php } ?><br/> |
|
332 | + <h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_heading', __('Purchasable Quantities', 'event_espresso')); ?></h5> |
|
333 | + <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_message', __('The number of tickets that can be purchased per transaction (if available).', 'event_espresso')); ?></span><br/> |
|
334 | + <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty', __('Minimum Qty:', 'event_espresso')); ?></span><?php echo $ticket->min() > 0 ? $ticket->min() : 0; ?> |
|
335 | + <?php if ($ticket->min() > $remaining) { ?> <span class="important-notice small-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_min_qty_message', __('The Minimum Quantity purchasable for this ticket exceeds the number of spaces remaining', 'event_espresso')); ?></span><?php } ?><br/> |
|
336 | 336 | <?php //$max = min( $max, $max_atndz );?> |
337 | - <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_max_qty', __( 'Maximum Qty:', 'event_espresso' )); ?></span><?php echo $ticket->max() === EE_INF ? __( 'no limit', 'event_espresso' ) : max( $ticket->max(), 1 ); ?><br/> |
|
337 | + <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_purchasable_quantities_max_qty', __('Maximum Qty:', 'event_espresso')); ?></span><?php echo $ticket->max() === EE_INF ? __('no limit', 'event_espresso') : max($ticket->max(), 1); ?><br/> |
|
338 | 338 | </section> |
339 | 339 | <br/> |
340 | 340 | <?php } ?> |
341 | 341 | |
342 | - <?php if ( $ticket->uses() !== EE_INF && ( ! defined( 'EE_DECAF' ) || EE_DECAF !== TRUE )) { ?> |
|
342 | + <?php if ($ticket->uses() !== EE_INF && ( ! defined('EE_DECAF') || EE_DECAF !== TRUE)) { ?> |
|
343 | 343 | <section class="tckt-slctr-tkt-uses-sctn"> |
344 | - <h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_date_ticket_uses_heading', __( 'Event Date Ticket Uses', 'event_espresso' )); ?></h5> |
|
344 | + <h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_date_ticket_uses_heading', __('Event Date Ticket Uses', 'event_espresso')); ?></h5> |
|
345 | 345 | <span class="drk-grey-text small-text no-bold"> - <?php |
346 | 346 | echo apply_filters( |
347 | 347 | 'FHEE__ticket_selector_chart_template__ticket_details_event_date_ticket_uses_message', |
348 | 348 | sprintf( |
349 | - __( 'The number of separate event datetimes (see table below) that this ticket can be used to gain admittance to.%1$s%2$sAdmission is always one person per ticket.%3$s', 'event_espresso' ), |
|
349 | + __('The number of separate event datetimes (see table below) that this ticket can be used to gain admittance to.%1$s%2$sAdmission is always one person per ticket.%3$s', 'event_espresso'), |
|
350 | 350 | '<br/>', |
351 | 351 | '<strong>', |
352 | 352 | '</strong>' |
353 | 353 | ) |
354 | 354 | ); |
355 | 355 | ?></span><br/> |
356 | - <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_date_number_datetimes', __( '# Datetimes:', 'event_espresso' )); ?></span><?php echo $ticket->uses();?><br/> |
|
356 | + <span class="ticket-details-label-spn drk-grey-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_date_number_datetimes', __('# Datetimes:', 'event_espresso')); ?></span><?php echo $ticket->uses(); ?><br/> |
|
357 | 357 | </section> |
358 | 358 | <?php } ?> |
359 | 359 | |
360 | 360 | <?php |
361 | - $datetimes = $ticket->datetimes_ordered( $event_is_expired, FALSE ); |
|
361 | + $datetimes = $ticket->datetimes_ordered($event_is_expired, FALSE); |
|
362 | 362 | $chart_column_width = $template_settings->show_ticket_sale_columns ? ' ee-fourth-width' : ' ee-half-width'; |
363 | - if ( ! empty( $datetimes )) { ?> |
|
363 | + if ( ! empty($datetimes)) { ?> |
|
364 | 364 | <section class="tckt-slctr-tkt-datetimes-sctn"> |
365 | - <h5><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_heading', __( 'Access', 'event_espresso' )); ?></h5> |
|
366 | - <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_message', __( 'This option allows access to the following dates and times.', 'event_espresso' )); ?></span> |
|
365 | + <h5><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_heading', __('Access', 'event_espresso')); ?></h5> |
|
366 | + <span class="drk-grey-text small-text no-bold"> - <?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_message', __('This option allows access to the following dates and times.', 'event_espresso')); ?></span> |
|
367 | 367 | <div class="tckt-slctr-tkt-details-tbl-wrap-dv"> |
368 | 368 | <table class="tckt-slctr-tkt-details-tbl"> |
369 | 369 | <thead> |
370 | 370 | <tr> |
371 | 371 | <th class="tckt-slctr-tkt-details-date-th"> |
372 | - <span class="dashicons dashicons-calendar"></span><span class="small-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', __( 'Date ', 'event_espresso' )); ?></span> |
|
372 | + <span class="dashicons dashicons-calendar"></span><span class="small-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', __('Date ', 'event_espresso')); ?></span> |
|
373 | 373 | </th> |
374 | 374 | <th class="tckt-slctr-tkt-details-time-th <?php echo $chart_column_width; ?>"> |
375 | - <span class="dashicons dashicons-clock"></span><span class="small-text"><?php _e( 'Time ', 'event_espresso' ); ?></span> |
|
375 | + <span class="dashicons dashicons-clock"></span><span class="small-text"><?php _e('Time ', 'event_espresso'); ?></span> |
|
376 | 376 | </th> |
377 | - <?php if ( $template_settings->show_ticket_sale_columns ) : ?> |
|
377 | + <?php if ($template_settings->show_ticket_sale_columns) : ?> |
|
378 | 378 | <th class="tckt-slctr-tkt-details-this-ticket-sold-th ee-fourth-width cntr"> |
379 | - <span class="smaller-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', sprintf( __( 'Sold', 'event_espresso' ), '<br/>' )); ?></span> |
|
379 | + <span class="smaller-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', sprintf(__('Sold', 'event_espresso'), '<br/>')); ?></span> |
|
380 | 380 | </th> |
381 | 381 | <th class="tckt-slctr-tkt-details-this-ticket-left-th ee-fourth-width cntr"> |
382 | - <span class="smaller-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', sprintf( __( 'Remaining', 'event_espresso' ), '<br/>' )); ?></span> |
|
382 | + <span class="smaller-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', sprintf(__('Remaining', 'event_espresso'), '<br/>')); ?></span> |
|
383 | 383 | </th> |
384 | 384 | <th class="tckt-slctr-tkt-details-total-tickets-sold-th ee-fourth-width cntr"> |
385 | - <span class="smaller-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', sprintf( __( 'Total%sSold', 'event_espresso' ), '<br/>' )); ?></span> |
|
385 | + <span class="smaller-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', sprintf(__('Total%sSold', 'event_espresso'), '<br/>')); ?></span> |
|
386 | 386 | </th> |
387 | 387 | <th class="tckt-slctr-tkt-details-total-tickets-left-th ee-fourth-width cntr"> |
388 | - <span class="smaller-text"><?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', sprintf( __( 'Total Spaces%sLeft', 'event_espresso' ), '<br/>' )); ?></span> |
|
388 | + <span class="smaller-text"><?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', sprintf(__('Total Spaces%sLeft', 'event_espresso'), '<br/>')); ?></span> |
|
389 | 389 | </th> |
390 | 390 | <?php endif; //end $template_settings->show_ticket_sale_columns conditional ?> |
391 | 391 | </tr> |
392 | 392 | </thead> |
393 | 393 | <tbody> |
394 | 394 | <?php |
395 | - foreach ( $datetimes as $datetime ) { |
|
396 | - if ( $datetime instanceof EE_Datetime ) { |
|
395 | + foreach ($datetimes as $datetime) { |
|
396 | + if ($datetime instanceof EE_Datetime) { |
|
397 | 397 | ?> |
398 | 398 | |
399 | 399 | <tr> |
400 | - <td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', __( 'Event Date ', 'event_espresso' )); ?>" class="small-text"> |
|
400 | + <td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_event_date', __('Event Date ', 'event_espresso')); ?>" class="small-text"> |
|
401 | 401 | <?php $datetime_name = $datetime->name(); ?> |
402 | - <?php echo ! empty( $datetime_name ) ? '<b>' . $datetime_name . '</b><br/>' : ''; ?> |
|
403 | - <?php echo $datetime->date_range( $date_format, __( ' to ', 'event_espresso' )); ?> |
|
402 | + <?php echo ! empty($datetime_name) ? '<b>'.$datetime_name.'</b><br/>' : ''; ?> |
|
403 | + <?php echo $datetime->date_range($date_format, __(' to ', 'event_espresso')); ?> |
|
404 | 404 | </td> |
405 | - <td data-th="<?php _e( 'Time ', 'event_espresso' ); ?>" class="cntr small-text"> |
|
406 | - <?php echo $datetime->time_range( $time_format, __( ' to ', 'event_espresso' )); ?> |
|
405 | + <td data-th="<?php _e('Time ', 'event_espresso'); ?>" class="cntr small-text"> |
|
406 | + <?php echo $datetime->time_range($time_format, __(' to ', 'event_espresso')); ?> |
|
407 | 407 | </td> |
408 | - <?php if ( $template_settings->show_ticket_sale_columns ) : ?> |
|
409 | - <td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', __( 'Sold', 'event_espresso' )); ?>" class="cntr small-text"> |
|
408 | + <?php if ($template_settings->show_ticket_sale_columns) : ?> |
|
409 | + <td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_sold', __('Sold', 'event_espresso')); ?>" class="cntr small-text"> |
|
410 | 410 | <?php echo $ticket->sold(); ?> |
411 | 411 | </td> |
412 | - <td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', __( 'Remaining', 'event_espresso' )); ?>" class="cntr small-text"> |
|
413 | - <?php echo $ticket->qty() === EE_INF ? '<span class="smaller-text">' . __( 'unlimited ', 'event_espresso' ) . '</span>' : $ticket->qty() - $ticket->sold(); ?> |
|
412 | + <td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_this_ticket_left', __('Remaining', 'event_espresso')); ?>" class="cntr small-text"> |
|
413 | + <?php echo $ticket->qty() === EE_INF ? '<span class="smaller-text">'.__('unlimited ', 'event_espresso').'</span>' : $ticket->qty() - $ticket->sold(); ?> |
|
414 | 414 | </td> |
415 | - <td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', __( 'Total Sold', 'event_espresso' )); ?>" class="cntr small-text"> |
|
415 | + <td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_sold', __('Total Sold', 'event_espresso')); ?>" class="cntr small-text"> |
|
416 | 416 | <?php echo $datetime->sold(); ?> |
417 | 417 | </td> |
418 | - <?php $tkts_left = $datetime->sold_out() ? '<span class="sold-out smaller-text">' . __( 'Sold Out', 'event_espresso' ) . '</span>' : $datetime->spaces_remaining(); ?> |
|
419 | - <td data-th="<?php echo apply_filters( 'FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', __( 'Total Spaces Left', 'event_espresso' )); ?>" class="cntr small-text"> |
|
420 | - <?php echo $tkts_left === EE_INF ? '<span class="smaller-text">' . __( 'unlimited ', 'event_espresso' ) . '</span>' : $tkts_left; ?> |
|
418 | + <?php $tkts_left = $datetime->sold_out() ? '<span class="sold-out smaller-text">'.__('Sold Out', 'event_espresso').'</span>' : $datetime->spaces_remaining(); ?> |
|
419 | + <td data-th="<?php echo apply_filters('FHEE__ticket_selector_chart_template__ticket_details_event_access_table_total_ticket_left', __('Total Spaces Left', 'event_espresso')); ?>" class="cntr small-text"> |
|
420 | + <?php echo $tkts_left === EE_INF ? '<span class="smaller-text">'.__('unlimited ', 'event_espresso').'</span>' : $tkts_left; ?> |
|
421 | 421 | </td> |
422 | 422 | <?php endif; //end $template_settings->show_ticket_sale_columns conditional ?> |
423 | 423 | </tr> |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | </div> |
436 | 436 | </td> |
437 | 437 | </tr> |
438 | - <?php endif; //end template_settings->show_ticket_details check?> |
|
438 | + <?php endif; //end template_settings->show_ticket_details check?> |
|
439 | 439 | <?php |
440 | 440 | $row++; |
441 | 441 | } |
@@ -444,32 +444,32 @@ discard block |
||
444 | 444 | $ticket_row_html = ob_get_clean(); |
445 | 445 | // if there is only ONE ticket with a max qty of ONE, and it is free... then not much need for the ticket selector |
446 | 446 | $hide_ticket_selector = $ticket_count == 1 && $max == 1 && $ticket->is_free() ? true : false; |
447 | -$hide_ticket_selector = apply_filters( 'FHEE__ticket_selector_chart_template__hide_ticket_selector', $hide_ticket_selector, $EVT_ID ); |
|
447 | +$hide_ticket_selector = apply_filters('FHEE__ticket_selector_chart_template__hide_ticket_selector', $hide_ticket_selector, $EVT_ID); |
|
448 | 448 | //EEH_Debug_Tools::printr( $ticket_count, '$ticket_count', __FILE__, __LINE__ ); |
449 | 449 | //EEH_Debug_Tools::printr( $max, '$max', __FILE__, __LINE__ ); |
450 | 450 | //EEH_Debug_Tools::printr( $hide_ticket_selector, '$hide_ticket_selector', __FILE__, __LINE__ ); |
451 | 451 | //EEH_Debug_Tools::printr( $table_style, '$table_style', __FILE__, __LINE__ ); |
452 | 452 | remove_filter( |
453 | 453 | 'FHEE__EE_Ticket_Selector__after_ticket_selector_submit', |
454 | - array( 'EED_Ticket_Selector', 'no_tkt_slctr_end_dv' ) |
|
454 | + array('EED_Ticket_Selector', 'no_tkt_slctr_end_dv') |
|
455 | 455 | ); |
456 | 456 | remove_filter( |
457 | 457 | 'FHEE__EE_Ticket_Selector__after_view_details_btn', |
458 | - array( 'EED_Ticket_Selector', 'no_tkt_slctr_end_dv' ) |
|
458 | + array('EED_Ticket_Selector', 'no_tkt_slctr_end_dv') |
|
459 | 459 | ); |
460 | -if ( ! $hide_ticket_selector ) { |
|
460 | +if ( ! $hide_ticket_selector) { |
|
461 | 461 | ?> |
462 | 462 | <div id="tkt-slctr-tbl-wrap-dv-<?php echo $EVT_ID; ?>" class="tkt-slctr-tbl-wrap-dv"> |
463 | 463 | |
464 | - <?php do_action( 'AHEE__ticket_selector_chart__template__before_ticket_selector', $event ); ?> |
|
464 | + <?php do_action('AHEE__ticket_selector_chart__template__before_ticket_selector', $event); ?> |
|
465 | 465 | |
466 | 466 | <table id="tkt-slctr-tbl-<?php echo $EVT_ID; ?>" class="tkt-slctr-tbl"> |
467 | 467 | <thead> |
468 | 468 | <tr> |
469 | 469 | <th scope="col" class="ee-ticket-selector-ticket-details-th"> |
470 | - <?php echo esc_html( apply_filters( 'FHEE__ticket_selector_chart_template__table_header_available_tickets', '', $EVT_ID ) ); ?> |
|
470 | + <?php echo esc_html(apply_filters('FHEE__ticket_selector_chart_template__table_header_available_tickets', '', $EVT_ID)); ?> |
|
471 | 471 | </th> |
472 | - <?php if ( apply_filters( 'FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE )) { ?> |
|
472 | + <?php if (apply_filters('FHEE__ticket_selector_chart_template__display_ticket_price_details', TRUE)) { ?> |
|
473 | 473 | <th scope="col" class="ee-ticket-selector-ticket-price-th cntr"> |
474 | 474 | <?php |
475 | 475 | /** |
@@ -480,7 +480,7 @@ discard block |
||
480 | 480 | * @param string 'Price' The translatable text to display in the table header for price |
481 | 481 | * @param int $EVT_ID The Event ID |
482 | 482 | */ |
483 | - echo esc_html( apply_filters( 'FHEE__ticket_selector_chart_template__table_header_price', __( 'Price', 'event_espresso' ), $EVT_ID ) ); |
|
483 | + echo esc_html(apply_filters('FHEE__ticket_selector_chart_template__table_header_price', __('Price', 'event_espresso'), $EVT_ID)); |
|
484 | 484 | ?> |
485 | 485 | </th> |
486 | 486 | <?php } ?> |
@@ -494,24 +494,24 @@ discard block |
||
494 | 494 | * @param string 'Qty*' The translatable text to display in the table header for the Quantity of tickets |
495 | 495 | * @param int $EVT_ID The Event ID |
496 | 496 | */ |
497 | - echo esc_html( apply_filters( 'FHEE__ticket_selector_chart_template__table_header_qty', __( 'Qty*', 'event_espresso' ), $EVT_ID ) ); |
|
497 | + echo esc_html(apply_filters('FHEE__ticket_selector_chart_template__table_header_qty', __('Qty*', 'event_espresso'), $EVT_ID)); |
|
498 | 498 | ?> |
499 | 499 | </th> |
500 | 500 | </tr> |
501 | 501 | </thead> |
502 | 502 | <tbody> |
503 | - <?php echo $ticket_row_html;?> |
|
503 | + <?php echo $ticket_row_html; ?> |
|
504 | 504 | </tbody> |
505 | 505 | </table> |
506 | 506 | |
507 | 507 | <input type="hidden" name="noheader" value="true" /> |
508 | - <input type="hidden" name="tkt-slctr-return-url-<?php echo $EVT_ID ?>" value="<?php echo EEH_URL::filter_input_server_url();?>" /> |
|
508 | + <input type="hidden" name="tkt-slctr-return-url-<?php echo $EVT_ID ?>" value="<?php echo EEH_URL::filter_input_server_url(); ?>" /> |
|
509 | 509 | <input type="hidden" name="tkt-slctr-rows-<?php echo $EVT_ID; ?>" value="<?php echo $row - 1; ?>" /> |
510 | 510 | <input type="hidden" name="tkt-slctr-max-atndz-<?php echo $EVT_ID; ?>" value="<?php echo $max_atndz; ?>" /> |
511 | 511 | <input type="hidden" name="tkt-slctr-event-id" value="<?php echo $EVT_ID; ?>" /> |
512 | 512 | |
513 | 513 | <?php |
514 | -if ( $max_atndz > 0 && ! $hide_ticket_selector ) { |
|
514 | +if ($max_atndz > 0 && ! $hide_ticket_selector) { |
|
515 | 515 | echo apply_filters( |
516 | 516 | 'FHEE__ticket_selector_chart_template__maximum_tickets_purchased_footnote', |
517 | 517 | '' |
@@ -519,10 +519,10 @@ discard block |
||
519 | 519 | } |
520 | 520 | ?> |
521 | 521 | |
522 | - <?php do_action( 'AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event ); ?> |
|
522 | + <?php do_action('AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event); ?> |
|
523 | 523 | |
524 | 524 | </div> |
525 | -<?php } else if ( isset( $TKT_ID ) ) { ?> |
|
525 | +<?php } else if (isset($TKT_ID)) { ?> |
|
526 | 526 | <input type="hidden" name="tkt-slctr-qty-<?php echo $EVT_ID; ?>[]" value="1"/> |
527 | 527 | <input type="hidden" name="tkt-slctr-ticket-id-<?php echo $EVT_ID; ?>[]" value="<?php echo $TKT_ID; ?>"/> |
528 | 528 | <input type="hidden" name="noheader" value="true"/> |
@@ -531,27 +531,27 @@ discard block |
||
531 | 531 | <input type="hidden" name="tkt-slctr-max-atndz-<?php echo $EVT_ID; ?>" value="<?php echo $max_atndz; ?>"/> |
532 | 532 | <input type="hidden" name="tkt-slctr-event-id" value="<?php echo $EVT_ID; ?>"/> |
533 | 533 | <?php |
534 | - if ( $ticket instanceof EE_Ticket ) { |
|
535 | - do_action( 'AHEE__ticket_selector_chart__template__before_ticket_selector', $event ); |
|
534 | + if ($ticket instanceof EE_Ticket) { |
|
535 | + do_action('AHEE__ticket_selector_chart__template__before_ticket_selector', $event); |
|
536 | 536 | $ticket_description = $ticket->description(); |
537 | 537 | ?> |
538 | 538 | <div id="no-tkt-slctr-ticket-dv-<?php echo $EVT_ID; ?>" class="no-tkt-slctr-ticket-dv"> |
539 | 539 | <div class="no-tkt-slctr-ticket-content-dv"> |
540 | 540 | <h5><?php echo $ticket->name(); ?></h5> |
541 | - <?php if ( ! empty( $ticket_description ) ) { ?> |
|
541 | + <?php if ( ! empty($ticket_description)) { ?> |
|
542 | 542 | <p><?php echo $ticket_description; ?></p> |
543 | 543 | <?php } ?> |
544 | 544 | </div> |
545 | 545 | <?php |
546 | 546 | add_filter( |
547 | 547 | 'FHEE__EE_Ticket_Selector__after_ticket_selector_submit', |
548 | - array( 'EED_Ticket_Selector', 'no_tkt_slctr_end_dv' ) |
|
548 | + array('EED_Ticket_Selector', 'no_tkt_slctr_end_dv') |
|
549 | 549 | ); |
550 | 550 | add_filter( |
551 | 551 | 'FHEE__EE_Ticket_Selector__after_view_details_btn', |
552 | - array( 'EED_Ticket_Selector', 'no_tkt_slctr_end_dv' ) |
|
552 | + array('EED_Ticket_Selector', 'no_tkt_slctr_end_dv') |
|
553 | 553 | ); |
554 | - do_action( 'AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event ); |
|
554 | + do_action('AHEE__ticket_selector_chart__template__after_ticket_selector', $EVT_ID, $event); |
|
555 | 555 | } |
556 | 556 | } |
557 | 557 | ?> |
@@ -1,36 +1,36 @@ |
||
1 | 1 | |
2 | 2 | <h4 id="reg-page-totals-hdr" class=""> |
3 | - <span class="drk-grey-text"><?php _e('Registrations:', 'event_espresso'); ?></span> <?php echo $reg_count;?> |
|
3 | + <span class="drk-grey-text"><?php _e('Registrations:', 'event_espresso'); ?></span> <?php echo $reg_count; ?> |
|
4 | 4 | </h4> |
5 | 5 | |
6 | 6 | <div class="spco-payment-info-dv"> |
7 | 7 | <table id="spco-payment-info-table"> |
8 | 8 | <thead> |
9 | 9 | <tr> |
10 | - <th scope="col" width=""><?php _e('Name and Description', 'event_espresso');?></th> |
|
11 | - <th scope="col" width="15%" class="jst-cntr"><?php _e('Price', 'event_espresso');?></th> |
|
12 | - <th scope="col" width="5%" class="jst-cntr"><?php _e( 'Qty', 'event_espresso' ); ?></th> |
|
13 | - <th scope="col" width="15%" class="jst-cntr"><?php _e('Total', 'event_espresso');?></th> |
|
14 | - <?php do_action( 'AHEE__registration_page_payment_options__payment_info_table_thead_row_end' ); ?> |
|
10 | + <th scope="col" width=""><?php _e('Name and Description', 'event_espresso'); ?></th> |
|
11 | + <th scope="col" width="15%" class="jst-cntr"><?php _e('Price', 'event_espresso'); ?></th> |
|
12 | + <th scope="col" width="5%" class="jst-cntr"><?php _e('Qty', 'event_espresso'); ?></th> |
|
13 | + <th scope="col" width="15%" class="jst-cntr"><?php _e('Total', 'event_espresso'); ?></th> |
|
14 | + <?php do_action('AHEE__registration_page_payment_options__payment_info_table_thead_row_end'); ?> |
|
15 | 15 | </tr> |
16 | 16 | </thead> |
17 | 17 | <tbody> |
18 | - <?php echo $transaction_details;?> |
|
19 | - <?php do_action( 'AHEE__registration_page_payment_options__payment_info_table_tbody_end' ); ?> |
|
18 | + <?php echo $transaction_details; ?> |
|
19 | + <?php do_action('AHEE__registration_page_payment_options__payment_info_table_tbody_end'); ?> |
|
20 | 20 | </tbody> |
21 | 21 | </table> |
22 | 22 | </div> |
23 | 23 | <div class="clear-float"> </div> |
24 | 24 | |
25 | - <?php echo $before_payment_options; ?> |
|
25 | + <?php echo $before_payment_options; ?> |
|
26 | 26 | |
27 | 27 | <div id="methods-of-payment"> |
28 | 28 | <?php echo $payment_options; ?> |
29 | 29 | </div> |
30 | 30 | <!-- end #methods-of-payment --> |
31 | 31 | |
32 | - <?php echo $after_payment_options; ?> |
|
32 | + <?php echo $after_payment_options; ?> |
|
33 | 33 | |
34 | - <?php echo $default_hidden_inputs; ?> |
|
35 | - <?php echo $extra_hidden_inputs; ?> |
|
34 | + <?php echo $default_hidden_inputs; ?> |
|
35 | + <?php echo $extra_hidden_inputs; ?> |
|
36 | 36 |
@@ -1229,11 +1229,11 @@ |
||
1229 | 1229 | protected function _category_list_table() { |
1230 | 1230 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
1231 | 1231 | $this->_admin_page_title .= ' ' . $this->get_action_link_or_button( |
1232 | - 'add_category', |
|
1233 | - 'add_category', |
|
1234 | - array(), |
|
1235 | - 'add-new-h2' |
|
1236 | - ); |
|
1232 | + 'add_category', |
|
1233 | + 'add_category', |
|
1234 | + array(), |
|
1235 | + 'add-new-h2' |
|
1236 | + ); |
|
1237 | 1237 | $this->_search_btn_label = __('Venue Categories', 'event_espresso'); |
1238 | 1238 | $this->display_admin_list_table_page_with_sidebar(); |
1239 | 1239 | } |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | |
5 | 5 | /** |
@@ -62,10 +62,10 @@ discard block |
||
62 | 62 | |
63 | 63 | |
64 | 64 | protected function _init_page_props() { |
65 | - require_once( EE_MODELS . 'EEM_Venue.model.php' ); |
|
65 | + require_once(EE_MODELS.'EEM_Venue.model.php'); |
|
66 | 66 | $this->page_slug = EE_VENUES_PG_SLUG; |
67 | 67 | $this->_admin_base_url = EE_VENUES_ADMIN_URL; |
68 | - $this->_admin_base_path = EE_ADMIN_PAGES . 'venues'; |
|
68 | + $this->_admin_base_path = EE_ADMIN_PAGES.'venues'; |
|
69 | 69 | $this->page_label = __('Event Venues', 'event_espresso'); |
70 | 70 | $this->_cpt_model_names = array( |
71 | 71 | 'create_new' => 'EEM_Venue', |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | 'edit' => __('Update Venue', 'event_espresso'), |
109 | 109 | 'add_category' => __('Save New Category', 'event_espresso'), |
110 | 110 | 'edit_category' => __('Update Category', 'event_espresso'), |
111 | - 'google_map_settings' => __( 'Update Settings', 'event_espresso' ) |
|
111 | + 'google_map_settings' => __('Update Settings', 'event_espresso') |
|
112 | 112 | ) |
113 | 113 | ); |
114 | 114 | } |
@@ -123,8 +123,8 @@ discard block |
||
123 | 123 | //load field generator helper |
124 | 124 | |
125 | 125 | //is there a vnu_id in the request? |
126 | - $vnu_id = ! empty( $this->_req_data['VNU_ID'] ) && ! is_array( $this->_req_data['VNU_ID'] ) ? $this->_req_data['VNU_ID'] : 0; |
|
127 | - $vnu_id = ! empty( $this->_req_data['post'] ) ? $this->_req_data['post'] : $vnu_id; |
|
126 | + $vnu_id = ! empty($this->_req_data['VNU_ID']) && ! is_array($this->_req_data['VNU_ID']) ? $this->_req_data['VNU_ID'] : 0; |
|
127 | + $vnu_id = ! empty($this->_req_data['post']) ? $this->_req_data['post'] : $vnu_id; |
|
128 | 128 | |
129 | 129 | $this->_page_routes = array( |
130 | 130 | 'default' => array( |
@@ -142,27 +142,27 @@ discard block |
||
142 | 142 | ), |
143 | 143 | 'trash_venue' => array( |
144 | 144 | 'func' => '_trash_or_restore_venue', |
145 | - 'args' => array( 'venue_status' => 'trash' ), |
|
145 | + 'args' => array('venue_status' => 'trash'), |
|
146 | 146 | 'noheader' => TRUE, |
147 | 147 | 'capability' => 'ee_delete_venue', |
148 | 148 | 'obj_id' => $vnu_id |
149 | 149 | ), |
150 | 150 | 'trash_venues' => array( |
151 | 151 | 'func' => '_trash_or_restore_venues', |
152 | - 'args' => array( 'venue_status' => 'trash' ), |
|
152 | + 'args' => array('venue_status' => 'trash'), |
|
153 | 153 | 'noheader' => TRUE, |
154 | 154 | 'capability' => 'ee_delete_venues' |
155 | 155 | ), |
156 | 156 | 'restore_venue' => array( |
157 | 157 | 'func' => '_trash_or_restore_venue', |
158 | - 'args' => array( 'venue_status' => 'draft' ), |
|
158 | + 'args' => array('venue_status' => 'draft'), |
|
159 | 159 | 'noheader' => TRUE, |
160 | 160 | 'capability' => 'ee_delete_venue', |
161 | 161 | 'obj_id' => $vnu_id |
162 | 162 | ), |
163 | 163 | 'restore_venues' => array( |
164 | 164 | 'func' => '_trash_or_restore_venues', |
165 | - 'args' => array( 'venue_status' => 'draft' ), |
|
165 | + 'args' => array('venue_status' => 'draft'), |
|
166 | 166 | 'noheader' => TRUE, |
167 | 167 | 'capability' => 'ee_delete_venues' |
168 | 168 | ), |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | 'filename' => 'venues_overview_views_bulk_actions_search' |
265 | 265 | ) |
266 | 266 | ), |
267 | - 'help_tour' => array( 'Venues_Overview_Help_Tour' ), |
|
267 | + 'help_tour' => array('Venues_Overview_Help_Tour'), |
|
268 | 268 | 'metaboxes' => array('_espresso_news_post_box', '_espresso_links_post_box'), |
269 | 269 | 'require_nonce' => FALSE |
270 | 270 | ), |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | 'filename' => 'venues_editor_other' |
301 | 301 | ) |
302 | 302 | ), |
303 | - 'help_tour' => array( 'Venues_Add_Venue_Help_Tour' ), |
|
303 | + 'help_tour' => array('Venues_Add_Venue_Help_Tour'), |
|
304 | 304 | 'metaboxes' => array('_venue_editor_metaboxes'), |
305 | 305 | 'require_nonce' => FALSE |
306 | 306 | ), |
@@ -309,7 +309,7 @@ discard block |
||
309 | 309 | 'label' => __('Edit Venue', 'event_espresso'), |
310 | 310 | 'order' => 5, |
311 | 311 | 'persistent' => FALSE, |
312 | - 'url' => isset($this->_req_data['post']) ? add_query_arg(array('post' => $this->_req_data['post'] ), $this->_current_page_view_url ) : $this->_admin_base_url |
|
312 | + 'url' => isset($this->_req_data['post']) ? add_query_arg(array('post' => $this->_req_data['post']), $this->_current_page_view_url) : $this->_admin_base_url |
|
313 | 313 | ), |
314 | 314 | 'help_tabs' => array( |
315 | 315 | 'venues_editor_help_tab' => array( |
@@ -343,17 +343,17 @@ discard block |
||
343 | 343 | ), |
344 | 344 | 'google_map_settings' => array( |
345 | 345 | 'nav' => array( |
346 | - 'label' => esc_html__('Google Maps', 'event_espresso' ), |
|
346 | + 'label' => esc_html__('Google Maps', 'event_espresso'), |
|
347 | 347 | 'order' => 40 |
348 | 348 | ), |
349 | - 'metaboxes' => array_merge( $this->_default_espresso_metaboxes, array('_publish_post_box' ) ), |
|
349 | + 'metaboxes' => array_merge($this->_default_espresso_metaboxes, array('_publish_post_box')), |
|
350 | 350 | 'help_tabs' => array( |
351 | 351 | 'general_settings_google_maps_help_tab' => array( |
352 | 352 | 'title' => __('Google Maps', 'event_espresso'), |
353 | 353 | 'filename' => 'general_settings_google_maps' |
354 | 354 | ) |
355 | 355 | ), |
356 | - 'help_tour' => array( 'Google_Maps_Help_Tour' ), |
|
356 | + 'help_tour' => array('Google_Maps_Help_Tour'), |
|
357 | 357 | 'require_nonce' => FALSE |
358 | 358 | ), |
359 | 359 | //venue category stuff |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | 'filename' => 'venues_add_category' |
370 | 370 | ) |
371 | 371 | ), |
372 | - 'help_tour' => array( 'Venues_Add_Category_Help_Tour' ), |
|
372 | + 'help_tour' => array('Venues_Add_Category_Help_Tour'), |
|
373 | 373 | 'require_nonce' => FALSE |
374 | 374 | ), |
375 | 375 | 'edit_category' => array( |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | 'label' => __('Edit Category', 'event_espresso'), |
378 | 378 | 'order' => 15, |
379 | 379 | 'persistent' => FALSE, |
380 | - 'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg(array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID'] ), $this->_current_page_view_url ) : $this->_admin_base_url |
|
380 | + 'url' => isset($this->_req_data['EVT_CAT_ID']) ? add_query_arg(array('EVT_CAT_ID' => $this->_req_data['EVT_CAT_ID']), $this->_current_page_view_url) : $this->_admin_base_url |
|
381 | 381 | ), |
382 | 382 | 'metaboxes' => array('_publish_post_box'), |
383 | 383 | 'help_tabs' => array( |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | 'filename' => 'venues_categories_other' |
414 | 414 | ) |
415 | 415 | ), |
416 | - 'help_tour' => array( 'Venues_Categories_Help_Tour' ), |
|
416 | + 'help_tour' => array('Venues_Categories_Help_Tour'), |
|
417 | 417 | 'metaboxes' => $this->_default_espresso_metaboxes, |
418 | 418 | 'require_nonce' => FALSE |
419 | 419 | ) |
@@ -470,7 +470,7 @@ discard block |
||
470 | 470 | |
471 | 471 | |
472 | 472 | public function load_scripts_styles() { |
473 | - wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL . 'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION ); |
|
473 | + wp_register_style('ee-cat-admin', EVENTS_ASSETS_URL.'ee-cat-admin.css', array(), EVENT_ESPRESSO_VERSION); |
|
474 | 474 | wp_enqueue_style('ee-cat-admin'); |
475 | 475 | } |
476 | 476 | |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | public function load_scripts_styles_edit() { |
494 | 494 | //styles |
495 | 495 | wp_enqueue_style('espresso-ui-theme'); |
496 | - wp_register_style( 'espresso_venues', EE_VENUES_ASSETS_URL . 'ee-venues-admin.css', array(), EVENT_ESPRESSO_VERSION ); |
|
496 | + wp_register_style('espresso_venues', EE_VENUES_ASSETS_URL.'ee-venues-admin.css', array(), EVENT_ESPRESSO_VERSION); |
|
497 | 497 | wp_enqueue_style('espresso_venues'); |
498 | 498 | } |
499 | 499 | |
@@ -512,13 +512,13 @@ discard block |
||
512 | 512 | ) |
513 | 513 | ); |
514 | 514 | |
515 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_venues', 'espresso_venues_trash_venues' ) ) { |
|
515 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_venues', 'espresso_venues_trash_venues')) { |
|
516 | 516 | $this->_views['all']['bulk_action'] = array( |
517 | 517 | 'trash_venues' => __('Move to Trash', 'event_espresso') |
518 | 518 | ); |
519 | 519 | $this->_views['trash'] = array( |
520 | 520 | 'slug' => 'trash', |
521 | - 'label' => __( 'Trash', 'event_espresso' ), |
|
521 | + 'label' => __('Trash', 'event_espresso'), |
|
522 | 522 | 'count' => 0, |
523 | 523 | 'bulk_action' => array( |
524 | 524 | 'restore_venues' => __('Restore from Trash', 'event_espresso'), |
@@ -551,9 +551,9 @@ discard block |
||
551 | 551 | |
552 | 552 | |
553 | 553 | protected function _overview_list_table() { |
554 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
555 | - $this->_template_args['after_list_table'] = EEH_Template::get_button_or_link( get_post_type_archive_link('espresso_venues'), __("View Venue Archive Page", "event_espresso"), 'button' ); |
|
556 | - $this->_admin_page_title .= ' ' . $this->get_action_link_or_button('create_new', 'add', array(), 'add-new-h2'); |
|
554 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
555 | + $this->_template_args['after_list_table'] = EEH_Template::get_button_or_link(get_post_type_archive_link('espresso_venues'), __("View Venue Archive Page", "event_espresso"), 'button'); |
|
556 | + $this->_admin_page_title .= ' '.$this->get_action_link_or_button('create_new', 'add', array(), 'add-new-h2'); |
|
557 | 557 | $this->_search_btn_label = __('Venues', 'event_espresso'); |
558 | 558 | $this->display_admin_list_table_page_with_sidebar(); |
559 | 559 | } |
@@ -566,8 +566,8 @@ discard block |
||
566 | 566 | 'vnu_url' => $this->_cpt_model_obj->venue_url(), |
567 | 567 | 'vnu_phone' => $this->_cpt_model_obj->phone() |
568 | 568 | ); |
569 | - $template = EE_VENUES_TEMPLATE_PATH . 'venue_publish_box_extras.template.php'; |
|
570 | - EEH_Template::display_template( $template, $extra_rows ); |
|
569 | + $template = EE_VENUES_TEMPLATE_PATH.'venue_publish_box_extras.template.php'; |
|
570 | + EEH_Template::display_template($template, $extra_rows); |
|
571 | 571 | } |
572 | 572 | |
573 | 573 | |
@@ -583,31 +583,31 @@ discard block |
||
583 | 583 | $default_map_settings->use_google_maps = TRUE; |
584 | 584 | $default_map_settings->google_map_api_key = ''; |
585 | 585 | // for event details pages (reg page) |
586 | - $default_map_settings->event_details_map_width = 585; // ee_map_width_single |
|
587 | - $default_map_settings->event_details_map_height = 362; // ee_map_height_single |
|
588 | - $default_map_settings->event_details_map_zoom = 14; // ee_map_zoom_single |
|
589 | - $default_map_settings->event_details_display_nav = TRUE; // ee_map_nav_display_single |
|
590 | - $default_map_settings->event_details_nav_size = FALSE; // ee_map_nav_size_single |
|
591 | - $default_map_settings->event_details_control_type = 'default'; // ee_map_type_control_single |
|
592 | - $default_map_settings->event_details_map_align = 'center'; // ee_map_align_single |
|
586 | + $default_map_settings->event_details_map_width = 585; // ee_map_width_single |
|
587 | + $default_map_settings->event_details_map_height = 362; // ee_map_height_single |
|
588 | + $default_map_settings->event_details_map_zoom = 14; // ee_map_zoom_single |
|
589 | + $default_map_settings->event_details_display_nav = TRUE; // ee_map_nav_display_single |
|
590 | + $default_map_settings->event_details_nav_size = FALSE; // ee_map_nav_size_single |
|
591 | + $default_map_settings->event_details_control_type = 'default'; // ee_map_type_control_single |
|
592 | + $default_map_settings->event_details_map_align = 'center'; // ee_map_align_single |
|
593 | 593 | // for event list pages |
594 | - $default_map_settings->event_list_map_width = 300; // ee_map_width |
|
595 | - $default_map_settings->event_list_map_height = 185; // ee_map_height |
|
596 | - $default_map_settings->event_list_map_zoom = 12; // ee_map_zoom |
|
597 | - $default_map_settings->event_list_display_nav = FALSE; // ee_map_nav_display |
|
598 | - $default_map_settings->event_list_nav_size = TRUE; // ee_map_nav_size |
|
599 | - $default_map_settings->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
600 | - $default_map_settings->event_list_map_align = 'center'; // ee_map_align |
|
594 | + $default_map_settings->event_list_map_width = 300; // ee_map_width |
|
595 | + $default_map_settings->event_list_map_height = 185; // ee_map_height |
|
596 | + $default_map_settings->event_list_map_zoom = 12; // ee_map_zoom |
|
597 | + $default_map_settings->event_list_display_nav = FALSE; // ee_map_nav_display |
|
598 | + $default_map_settings->event_list_nav_size = TRUE; // ee_map_nav_size |
|
599 | + $default_map_settings->event_list_control_type = 'dropdown'; // ee_map_type_control |
|
600 | + $default_map_settings->event_list_map_align = 'center'; // ee_map_align |
|
601 | 601 | |
602 | 602 | $this->_template_args['map_settings'] = |
603 | - isset( EE_Registry::instance()->CFG->map_settings ) && ! empty( EE_Registry::instance()->CFG->map_settings ) |
|
604 | - ? (object)array_merge( (array)$default_map_settings, (array)EE_Registry::instance()->CFG->map_settings ) |
|
603 | + isset(EE_Registry::instance()->CFG->map_settings) && ! empty(EE_Registry::instance()->CFG->map_settings) |
|
604 | + ? (object) array_merge((array) $default_map_settings, (array) EE_Registry::instance()->CFG->map_settings) |
|
605 | 605 | : $default_map_settings; |
606 | 606 | |
607 | - $this->_set_add_edit_form_tags( 'update_google_map_settings' ); |
|
608 | - $this->_set_publish_post_box_vars( NULL, FALSE, FALSE, NULL, FALSE ); |
|
607 | + $this->_set_add_edit_form_tags('update_google_map_settings'); |
|
608 | + $this->_set_publish_post_box_vars(NULL, FALSE, FALSE, NULL, FALSE); |
|
609 | 609 | $this->_template_args['admin_page_content'] = EEH_Template::display_template( |
610 | - EE_VENUES_TEMPLATE_PATH . 'google_map.template.php', |
|
610 | + EE_VENUES_TEMPLATE_PATH.'google_map.template.php', |
|
611 | 611 | $this->_template_args, |
612 | 612 | true |
613 | 613 | ); |
@@ -617,83 +617,83 @@ discard block |
||
617 | 617 | protected function _update_google_map_settings() { |
618 | 618 | |
619 | 619 | EE_Registry::instance()->CFG->map_settings->use_google_maps = |
620 | - isset( $this->_req_data['use_google_maps'] ) |
|
621 | - ? absint( $this->_req_data['use_google_maps'] ) |
|
620 | + isset($this->_req_data['use_google_maps']) |
|
621 | + ? absint($this->_req_data['use_google_maps']) |
|
622 | 622 | : EE_Registry::instance()->CFG->map_settings->use_google_maps; |
623 | 623 | |
624 | 624 | EE_Registry::instance()->CFG->map_settings->google_map_api_key = |
625 | - isset( $this->_req_data['google_map_api_key'] ) |
|
626 | - ? sanitize_text_field( $this->_req_data['google_map_api_key'] ) |
|
625 | + isset($this->_req_data['google_map_api_key']) |
|
626 | + ? sanitize_text_field($this->_req_data['google_map_api_key']) |
|
627 | 627 | : EE_Registry::instance()->CFG->map_settings->google_map_api_key; |
628 | 628 | |
629 | 629 | EE_Registry::instance()->CFG->map_settings->event_details_map_width = |
630 | - isset( $this->_req_data['event_details_map_width'] ) |
|
631 | - ? absint( $this->_req_data['event_details_map_width'] ) |
|
630 | + isset($this->_req_data['event_details_map_width']) |
|
631 | + ? absint($this->_req_data['event_details_map_width']) |
|
632 | 632 | : EE_Registry::instance()->CFG->map_settings->event_details_map_width; |
633 | 633 | |
634 | 634 | EE_Registry::instance()->CFG->map_settings->event_details_map_height = |
635 | - isset( $this->_req_data['event_details_map_height'] ) |
|
636 | - ? absint( $this->_req_data['event_details_map_height'] ) |
|
635 | + isset($this->_req_data['event_details_map_height']) |
|
636 | + ? absint($this->_req_data['event_details_map_height']) |
|
637 | 637 | : EE_Registry::instance()->CFG->map_settings->event_details_map_height; |
638 | 638 | |
639 | 639 | EE_Registry::instance()->CFG->map_settings->event_details_map_zoom = |
640 | - isset( $this->_req_data['event_details_map_zoom'] ) |
|
641 | - ? absint( $this->_req_data['event_details_map_zoom'] ) |
|
640 | + isset($this->_req_data['event_details_map_zoom']) |
|
641 | + ? absint($this->_req_data['event_details_map_zoom']) |
|
642 | 642 | : EE_Registry::instance()->CFG->map_settings->event_details_map_zoom; |
643 | 643 | |
644 | 644 | EE_Registry::instance()->CFG->map_settings->event_details_display_nav = |
645 | - isset( $this->_req_data['event_details_display_nav'] ) |
|
646 | - ? absint( $this->_req_data['event_details_display_nav'] ) |
|
645 | + isset($this->_req_data['event_details_display_nav']) |
|
646 | + ? absint($this->_req_data['event_details_display_nav']) |
|
647 | 647 | : EE_Registry::instance()->CFG->map_settings->event_details_display_nav; |
648 | 648 | |
649 | 649 | EE_Registry::instance()->CFG->map_settings->event_details_nav_size = |
650 | - isset( $this->_req_data['event_details_nav_size'] ) |
|
651 | - ? absint( $this->_req_data['event_details_nav_size'] ) |
|
650 | + isset($this->_req_data['event_details_nav_size']) |
|
651 | + ? absint($this->_req_data['event_details_nav_size']) |
|
652 | 652 | : EE_Registry::instance()->CFG->map_settings->event_details_nav_size; |
653 | 653 | |
654 | 654 | EE_Registry::instance()->CFG->map_settings->event_details_control_type = |
655 | - isset( $this->_req_data['event_details_control_type'] ) |
|
656 | - ? sanitize_text_field( $this->_req_data['event_details_control_type'] ) |
|
655 | + isset($this->_req_data['event_details_control_type']) |
|
656 | + ? sanitize_text_field($this->_req_data['event_details_control_type']) |
|
657 | 657 | : EE_Registry::instance()->CFG->map_settings->event_details_control_type; |
658 | 658 | |
659 | 659 | EE_Registry::instance()->CFG->map_settings->event_details_map_align = |
660 | - isset( $this->_req_data['event_details_map_align'] ) |
|
661 | - ? sanitize_text_field( $this->_req_data['event_details_map_align'] ) |
|
660 | + isset($this->_req_data['event_details_map_align']) |
|
661 | + ? sanitize_text_field($this->_req_data['event_details_map_align']) |
|
662 | 662 | : EE_Registry::instance()->CFG->map_settings->event_details_map_align; |
663 | 663 | |
664 | 664 | EE_Registry::instance()->CFG->map_settings->event_list_map_width = |
665 | - isset( $this->_req_data['event_list_map_width'] ) |
|
666 | - ? absint( $this->_req_data['event_list_map_width'] ) |
|
665 | + isset($this->_req_data['event_list_map_width']) |
|
666 | + ? absint($this->_req_data['event_list_map_width']) |
|
667 | 667 | : EE_Registry::instance()->CFG->map_settings->event_list_map_width; |
668 | 668 | |
669 | 669 | EE_Registry::instance()->CFG->map_settings->event_list_map_height = |
670 | - isset( $this->_req_data['event_list_map_height'] ) |
|
671 | - ? absint( $this->_req_data['event_list_map_height'] ) |
|
670 | + isset($this->_req_data['event_list_map_height']) |
|
671 | + ? absint($this->_req_data['event_list_map_height']) |
|
672 | 672 | : EE_Registry::instance()->CFG->map_settings->event_list_map_height; |
673 | 673 | |
674 | 674 | EE_Registry::instance()->CFG->map_settings->event_list_map_zoom = |
675 | - isset( $this->_req_data['event_list_map_zoom'] ) |
|
676 | - ? absint( $this->_req_data['event_list_map_zoom'] ) |
|
675 | + isset($this->_req_data['event_list_map_zoom']) |
|
676 | + ? absint($this->_req_data['event_list_map_zoom']) |
|
677 | 677 | : EE_Registry::instance()->CFG->map_settings->event_list_map_zoom; |
678 | 678 | |
679 | 679 | EE_Registry::instance()->CFG->map_settings->event_list_display_nav = |
680 | - isset( $this->_req_data['event_list_display_nav'] ) |
|
681 | - ? absint( $this->_req_data['event_list_display_nav'] ) |
|
680 | + isset($this->_req_data['event_list_display_nav']) |
|
681 | + ? absint($this->_req_data['event_list_display_nav']) |
|
682 | 682 | : EE_Registry::instance()->CFG->map_settings->event_list_display_nav; |
683 | 683 | |
684 | 684 | EE_Registry::instance()->CFG->map_settings->event_list_nav_size = |
685 | - isset( $this->_req_data['event_list_nav_size'] ) |
|
686 | - ? absint( $this->_req_data['event_list_nav_size'] ) |
|
685 | + isset($this->_req_data['event_list_nav_size']) |
|
686 | + ? absint($this->_req_data['event_list_nav_size']) |
|
687 | 687 | : EE_Registry::instance()->CFG->map_settings->event_list_nav_size; |
688 | 688 | |
689 | 689 | EE_Registry::instance()->CFG->map_settings->event_list_control_type = |
690 | - isset( $this->_req_data['event_list_control_type'] ) |
|
691 | - ? sanitize_text_field( $this->_req_data['event_list_control_type'] ) |
|
690 | + isset($this->_req_data['event_list_control_type']) |
|
691 | + ? sanitize_text_field($this->_req_data['event_list_control_type']) |
|
692 | 692 | : EE_Registry::instance()->CFG->map_settings->event_list_control_type; |
693 | 693 | |
694 | 694 | EE_Registry::instance()->CFG->map_settings->event_list_map_align = |
695 | - isset( $this->_req_data['event_list_map_align'] ) |
|
696 | - ? sanitize_text_field( $this->_req_data['event_list_map_align'] ) |
|
695 | + isset($this->_req_data['event_list_map_align']) |
|
696 | + ? sanitize_text_field($this->_req_data['event_list_map_align']) |
|
697 | 697 | : EE_Registry::instance()->CFG->map_settings->event_list_map_align; |
698 | 698 | |
699 | 699 | EE_Registry::instance()->CFG->map_settings = apply_filters( |
@@ -707,7 +707,7 @@ discard block |
||
707 | 707 | EE_Registry::instance()->CFG->map_settings, |
708 | 708 | __FILE__, __FUNCTION__, __LINE__ |
709 | 709 | ); |
710 | - $this->_redirect_after_action( $success, $what, 'updated', array( 'action' => 'google_map_settings' ) ); |
|
710 | + $this->_redirect_after_action($success, $what, 'updated', array('action' => 'google_map_settings')); |
|
711 | 711 | |
712 | 712 | } |
713 | 713 | |
@@ -716,9 +716,9 @@ discard block |
||
716 | 716 | protected function _venue_editor_metaboxes() { |
717 | 717 | $this->verify_cpt_object(); |
718 | 718 | |
719 | - add_meta_box( 'espresso_venue_address_options', __('Physical Location', 'event_espresso'), array( $this, 'venue_address_metabox'), $this->page_slug, 'side', 'default' ); |
|
720 | - add_meta_box( 'espresso_venue_gmap_options', __('Google Map', 'event_espresso'), array( $this, 'venue_gmap_metabox'), $this->page_slug, 'side', 'default' ); |
|
721 | - add_meta_box( 'espresso_venue_virtual_loc_options', __('Virtual Location', 'event_espresso'), array( $this, 'venue_virtual_loc_metabox'), $this->page_slug, 'side', 'default' ); |
|
719 | + add_meta_box('espresso_venue_address_options', __('Physical Location', 'event_espresso'), array($this, 'venue_address_metabox'), $this->page_slug, 'side', 'default'); |
|
720 | + add_meta_box('espresso_venue_gmap_options', __('Google Map', 'event_espresso'), array($this, 'venue_gmap_metabox'), $this->page_slug, 'side', 'default'); |
|
721 | + add_meta_box('espresso_venue_virtual_loc_options', __('Virtual Location', 'event_espresso'), array($this, 'venue_virtual_loc_metabox'), $this->page_slug, 'side', 'default'); |
|
722 | 722 | |
723 | 723 | } |
724 | 724 | |
@@ -726,23 +726,23 @@ discard block |
||
726 | 726 | |
727 | 727 | public function venue_gmap_metabox() { |
728 | 728 | $template_args = array( |
729 | - 'vnu_enable_for_gmap' => EEH_Form_Fields::select_input('vnu_enable_for_gmap', $this->get_yes_no_values(), $this->_cpt_model_obj->enable_for_gmap() ), |
|
729 | + 'vnu_enable_for_gmap' => EEH_Form_Fields::select_input('vnu_enable_for_gmap', $this->get_yes_no_values(), $this->_cpt_model_obj->enable_for_gmap()), |
|
730 | 730 | 'vnu_google_map_link' => $this->_cpt_model_obj->google_map_link(), |
731 | 731 | ); |
732 | - $template = EE_VENUES_TEMPLATE_PATH . 'venue_gmap_metabox_content.template.php'; |
|
733 | - EEH_Template::display_template( $template, $template_args ); |
|
732 | + $template = EE_VENUES_TEMPLATE_PATH.'venue_gmap_metabox_content.template.php'; |
|
733 | + EEH_Template::display_template($template, $template_args); |
|
734 | 734 | } |
735 | 735 | |
736 | 736 | |
737 | 737 | |
738 | 738 | public function venue_address_metabox() { |
739 | 739 | |
740 | - $template_args['_venue'] =$this->_cpt_model_obj; |
|
740 | + $template_args['_venue'] = $this->_cpt_model_obj; |
|
741 | 741 | |
742 | 742 | $template_args['states_dropdown'] = EEH_Form_Fields::generate_form_input( |
743 | 743 | $QFI = new EE_Question_Form_Input( |
744 | - EE_Question::new_instance( array( 'QST_display_text' => 'State', 'QST_system' => 'state' )), |
|
745 | - EE_Answer::new_instance( array( 'ANS_value'=> $this->_cpt_model_obj->state_ID() )), |
|
744 | + EE_Question::new_instance(array('QST_display_text' => 'State', 'QST_system' => 'state')), |
|
745 | + EE_Answer::new_instance(array('ANS_value'=> $this->_cpt_model_obj->state_ID())), |
|
746 | 746 | array( |
747 | 747 | 'input_name' => 'sta_id', |
748 | 748 | 'input_id' => 'sta_id', |
@@ -754,8 +754,8 @@ discard block |
||
754 | 754 | ); |
755 | 755 | $template_args['countries_dropdown'] = EEH_Form_Fields::generate_form_input( |
756 | 756 | $QFI = new EE_Question_Form_Input( |
757 | - EE_Question::new_instance( array( 'QST_display_text' => 'Country', 'QST_system' => 'country' )), |
|
758 | - EE_Answer::new_instance( array( 'ANS_value'=> $this->_cpt_model_obj->country_ID() )), |
|
757 | + EE_Question::new_instance(array('QST_display_text' => 'Country', 'QST_system' => 'country')), |
|
758 | + EE_Answer::new_instance(array('ANS_value'=> $this->_cpt_model_obj->country_ID())), |
|
759 | 759 | array( |
760 | 760 | 'input_name' => 'cnt_iso', |
761 | 761 | 'input_id' => 'cnt_iso', |
@@ -766,8 +766,8 @@ discard block |
||
766 | 766 | ) |
767 | 767 | ); |
768 | 768 | |
769 | - $template = EE_VENUES_TEMPLATE_PATH . 'venue_address_metabox_content.template.php'; |
|
770 | - EEH_Template::display_template( $template, $template_args ); |
|
769 | + $template = EE_VENUES_TEMPLATE_PATH.'venue_address_metabox_content.template.php'; |
|
770 | + EEH_Template::display_template($template, $template_args); |
|
771 | 771 | } |
772 | 772 | |
773 | 773 | |
@@ -779,8 +779,8 @@ discard block |
||
779 | 779 | $template_args = array( |
780 | 780 | '_venue' => $this->_cpt_model_obj |
781 | 781 | ); |
782 | - $template = EE_VENUES_TEMPLATE_PATH . 'venue_virtual_location_metabox_content.template.php'; |
|
783 | - EEH_Template::display_template( $template, $template_args ); |
|
782 | + $template = EE_VENUES_TEMPLATE_PATH.'venue_virtual_location_metabox_content.template.php'; |
|
783 | + EEH_Template::display_template($template, $template_args); |
|
784 | 784 | } |
785 | 785 | |
786 | 786 | |
@@ -803,52 +803,52 @@ discard block |
||
803 | 803 | * @param object $post Post object (with "blessed" WP properties) |
804 | 804 | * @return void |
805 | 805 | */ |
806 | - protected function _insert_update_cpt_item( $post_id, $post ) { |
|
806 | + protected function _insert_update_cpt_item($post_id, $post) { |
|
807 | 807 | |
808 | - if ( $post instanceof WP_Post && $post->post_type !== 'espresso_venues' ) { |
|
809 | - return;// get out we're not processing the saving of venues. |
|
808 | + if ($post instanceof WP_Post && $post->post_type !== 'espresso_venues') { |
|
809 | + return; // get out we're not processing the saving of venues. |
|
810 | 810 | } |
811 | 811 | |
812 | - $wheres = array( $this->_venue_model->primary_key_name() => $post_id ); |
|
812 | + $wheres = array($this->_venue_model->primary_key_name() => $post_id); |
|
813 | 813 | |
814 | 814 | $venue_values = array( |
815 | - 'VNU_address' => !empty( $this->_req_data['vnu_address'] ) ? $this->_req_data['vnu_address'] : NULL, |
|
816 | - 'VNU_address2' => !empty( $this->_req_data['vnu_address2'] ) ? $this->_req_data['vnu_address2'] : NULL, |
|
817 | - 'VNU_city' => !empty( $this->_req_data['vnu_city'] ) ? $this->_req_data['vnu_city'] : NULL, |
|
818 | - 'STA_ID' => !empty( $this->_req_data['sta_id'] ) ? $this->_req_data['sta_id'] : NULL, |
|
819 | - 'CNT_ISO' => !empty( $this->_req_data['cnt_iso'] ) ? $this->_req_data['cnt_iso'] : NULL, |
|
820 | - 'VNU_zip' => !empty( $this->_req_data['vnu_zip'] ) ? $this->_req_data['vnu_zip'] : NULL, |
|
821 | - 'VNU_phone' => !empty( $this->_req_data['vnu_phone'] ) ? $this->_req_data['vnu_phone'] : NULL, |
|
822 | - 'VNU_capacity' => !empty( $this->_req_data['vnu_capacity'] ) ? str_replace( ',', '', $this->_req_data['vnu_capacity'] ) : EE_INF, |
|
823 | - 'VNU_url' => !empty( $this->_req_data['vnu_url'] ) ? $this->_req_data['vnu_url'] : NULL, |
|
824 | - 'VNU_virtual_phone' => !empty( $this->_req_data['vnu_virtual_phone'] ) ? $this->_req_data['vnu_virtual_phone'] : NULL, |
|
825 | - 'VNU_virtual_url' => !empty( $this->_req_data['vnu_virtual_url'] ) ? $this->_req_data['vnu_virtual_url'] : NULL, |
|
826 | - 'VNU_enable_for_gmap' => !empty( $this->_req_data['vnu_enable_for_gmap'] ) ? TRUE : FALSE, |
|
827 | - 'VNU_google_map_link' => !empty( $this->_req_data['vnu_google_map_link'] ) ? $this->_req_data['vnu_google_map_link'] : NULL |
|
815 | + 'VNU_address' => ! empty($this->_req_data['vnu_address']) ? $this->_req_data['vnu_address'] : NULL, |
|
816 | + 'VNU_address2' => ! empty($this->_req_data['vnu_address2']) ? $this->_req_data['vnu_address2'] : NULL, |
|
817 | + 'VNU_city' => ! empty($this->_req_data['vnu_city']) ? $this->_req_data['vnu_city'] : NULL, |
|
818 | + 'STA_ID' => ! empty($this->_req_data['sta_id']) ? $this->_req_data['sta_id'] : NULL, |
|
819 | + 'CNT_ISO' => ! empty($this->_req_data['cnt_iso']) ? $this->_req_data['cnt_iso'] : NULL, |
|
820 | + 'VNU_zip' => ! empty($this->_req_data['vnu_zip']) ? $this->_req_data['vnu_zip'] : NULL, |
|
821 | + 'VNU_phone' => ! empty($this->_req_data['vnu_phone']) ? $this->_req_data['vnu_phone'] : NULL, |
|
822 | + 'VNU_capacity' => ! empty($this->_req_data['vnu_capacity']) ? str_replace(',', '', $this->_req_data['vnu_capacity']) : EE_INF, |
|
823 | + 'VNU_url' => ! empty($this->_req_data['vnu_url']) ? $this->_req_data['vnu_url'] : NULL, |
|
824 | + 'VNU_virtual_phone' => ! empty($this->_req_data['vnu_virtual_phone']) ? $this->_req_data['vnu_virtual_phone'] : NULL, |
|
825 | + 'VNU_virtual_url' => ! empty($this->_req_data['vnu_virtual_url']) ? $this->_req_data['vnu_virtual_url'] : NULL, |
|
826 | + 'VNU_enable_for_gmap' => ! empty($this->_req_data['vnu_enable_for_gmap']) ? TRUE : FALSE, |
|
827 | + 'VNU_google_map_link' => ! empty($this->_req_data['vnu_google_map_link']) ? $this->_req_data['vnu_google_map_link'] : NULL |
|
828 | 828 | ); |
829 | 829 | |
830 | 830 | //update venue |
831 | - $success = $this->_venue_model->update( $venue_values, array( $wheres ) ); |
|
831 | + $success = $this->_venue_model->update($venue_values, array($wheres)); |
|
832 | 832 | |
833 | 833 | //get venue_object for other metaboxes that might be added via the filter... though it would seem to make sense to just use $this->_venue_model->get_one_by_ID( $post_id ).. i have to setup where conditions to override the filters in the model that filter out autodraft and inherit statuses so we GET the inherit id! |
834 | - $get_one_where = array( $this->_venue_model->primary_key_name() => $post_id, 'status' => $post->post_status ); |
|
835 | - $venue = $this->_venue_model->get_one( array( $get_one_where ) ); |
|
834 | + $get_one_where = array($this->_venue_model->primary_key_name() => $post_id, 'status' => $post->post_status); |
|
835 | + $venue = $this->_venue_model->get_one(array($get_one_where)); |
|
836 | 836 | |
837 | 837 | //notice we've applied a filter for venue metabox callbacks but we don't actually have any default venue metaboxes in use. So this is just here for addons to more easily hook into venue saves. |
838 | - $venue_update_callbacks = apply_filters( 'FHEE__Venues_Admin_Page___insert_update_cpt_item__venue_update_callbacks', array() ); |
|
838 | + $venue_update_callbacks = apply_filters('FHEE__Venues_Admin_Page___insert_update_cpt_item__venue_update_callbacks', array()); |
|
839 | 839 | |
840 | 840 | $att_success = TRUE; |
841 | 841 | |
842 | - foreach ( $venue_update_callbacks as $v_callback ) { |
|
843 | - $_succ = call_user_func_array( $v_callback, array( $venue, $this->_req_data ) ); |
|
844 | - $att_success = !$att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message |
|
842 | + foreach ($venue_update_callbacks as $v_callback) { |
|
843 | + $_succ = call_user_func_array($v_callback, array($venue, $this->_req_data)); |
|
844 | + $att_success = ! $att_success ? $att_success : $_succ; //if ANY of these updates fail then we want the appropriate global error message |
|
845 | 845 | } |
846 | 846 | |
847 | 847 | //any errors? |
848 | - if ( $success && !$att_success ) { |
|
849 | - EE_Error::add_error( __('Venue Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
850 | - } else if ( $success === FALSE ) { |
|
851 | - EE_Error::add_error( __('Venue Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
848 | + if ($success && ! $att_success) { |
|
849 | + EE_Error::add_error(__('Venue Details saved successfully but something went wrong with saving attachments.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
850 | + } else if ($success === FALSE) { |
|
851 | + EE_Error::add_error(__('Venue Details did not save successfully.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
852 | 852 | } |
853 | 853 | } |
854 | 854 | |
@@ -856,9 +856,9 @@ discard block |
||
856 | 856 | |
857 | 857 | |
858 | 858 | |
859 | - public function trash_cpt_item( $post_id ) { |
|
859 | + public function trash_cpt_item($post_id) { |
|
860 | 860 | $this->_req_data['VNU_ID'] = $post_id; |
861 | - $this->_trash_or_restore_venue( 'trash', FALSE ); |
|
861 | + $this->_trash_or_restore_venue('trash', FALSE); |
|
862 | 862 | } |
863 | 863 | |
864 | 864 | |
@@ -866,18 +866,18 @@ discard block |
||
866 | 866 | |
867 | 867 | |
868 | 868 | |
869 | - public function restore_cpt_item( $post_id ) { |
|
869 | + public function restore_cpt_item($post_id) { |
|
870 | 870 | $this->_req_data['VNU_ID'] = $post_id; |
871 | - $this->_trash_or_restore_venue( 'draft', FALSE ); |
|
871 | + $this->_trash_or_restore_venue('draft', FALSE); |
|
872 | 872 | } |
873 | 873 | |
874 | 874 | |
875 | 875 | |
876 | 876 | |
877 | 877 | |
878 | - public function delete_cpt_item( $post_id ) { |
|
878 | + public function delete_cpt_item($post_id) { |
|
879 | 879 | $this->_req_data['VNU_ID'] = $post_id; |
880 | - $this->_delete_venue( FALSE ); |
|
880 | + $this->_delete_venue(FALSE); |
|
881 | 881 | } |
882 | 882 | |
883 | 883 | |
@@ -892,15 +892,15 @@ discard block |
||
892 | 892 | |
893 | 893 | |
894 | 894 | |
895 | - protected function _trash_or_restore_venue( $venue_status = 'trash', $redirect_after = TRUE ) { |
|
896 | - $VNU_ID = isset( $this->_req_data['VNU_ID'] ) ? absint( $this->_req_data['VNU_ID'] ) : FALSE; |
|
895 | + protected function _trash_or_restore_venue($venue_status = 'trash', $redirect_after = TRUE) { |
|
896 | + $VNU_ID = isset($this->_req_data['VNU_ID']) ? absint($this->_req_data['VNU_ID']) : FALSE; |
|
897 | 897 | |
898 | 898 | //loop thru venues |
899 | - if ( $VNU_ID ) { |
|
899 | + if ($VNU_ID) { |
|
900 | 900 | //clean status |
901 | - $venue_status = sanitize_key( $venue_status ); |
|
901 | + $venue_status = sanitize_key($venue_status); |
|
902 | 902 | // grab status |
903 | - if (!empty($venue_status)) { |
|
903 | + if ( ! empty($venue_status)) { |
|
904 | 904 | $success = $this->_change_venue_status($VNU_ID, $venue_status); |
905 | 905 | } else { |
906 | 906 | $success = FALSE; |
@@ -914,7 +914,7 @@ discard block |
||
914 | 914 | } |
915 | 915 | $action = $venue_status == 'trash' ? 'moved to the trash' : 'restored from the trash'; |
916 | 916 | |
917 | - if ( $redirect_after ) |
|
917 | + if ($redirect_after) |
|
918 | 918 | $this->_redirect_after_action($success, 'Venue', $action, array('action' => 'default')); |
919 | 919 | |
920 | 920 | } |
@@ -923,11 +923,11 @@ discard block |
||
923 | 923 | |
924 | 924 | |
925 | 925 | |
926 | - protected function _trash_or_restore_venues( $venue_status = 'trash' ) { |
|
926 | + protected function _trash_or_restore_venues($venue_status = 'trash') { |
|
927 | 927 | // clean status |
928 | 928 | $venue_status = sanitize_key($venue_status); |
929 | 929 | // grab status |
930 | - if (!empty($venue_status)) { |
|
930 | + if ( ! empty($venue_status)) { |
|
931 | 931 | $success = TRUE; |
932 | 932 | //determine the event id and set to array. |
933 | 933 | $VNU_IDs = isset($this->_req_data['venue_id']) ? (array) $this->_req_data['venue_id'] : array(); |
@@ -967,20 +967,20 @@ discard block |
||
967 | 967 | * @param string $venue_status |
968 | 968 | * @return void |
969 | 969 | */ |
970 | - private function _change_venue_status( $VNU_ID = 0, $venue_status = '' ) { |
|
970 | + private function _change_venue_status($VNU_ID = 0, $venue_status = '') { |
|
971 | 971 | // grab venue id |
972 | - if (! $VNU_ID) { |
|
972 | + if ( ! $VNU_ID) { |
|
973 | 973 | $msg = __('An error occurred. No Venue ID or an invalid Venue ID was received.', 'event_espresso'); |
974 | 974 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
975 | 975 | return FALSE; |
976 | 976 | } |
977 | 977 | |
978 | - $this->_cpt_model_obj = EEM_Venue::instance()->get_one_by_ID( $VNU_ID ); |
|
978 | + $this->_cpt_model_obj = EEM_Venue::instance()->get_one_by_ID($VNU_ID); |
|
979 | 979 | |
980 | 980 | // clean status |
981 | 981 | $venue_status = sanitize_key($venue_status); |
982 | 982 | // grab status |
983 | - if ( ! $venue_status ) { |
|
983 | + if ( ! $venue_status) { |
|
984 | 984 | $msg = __('An error occurred. No Venue Status or an invalid Venue Status was received.', 'event_espresso'); |
985 | 985 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
986 | 986 | return FALSE; |
@@ -1001,7 +1001,7 @@ discard block |
||
1001 | 1001 | $hook = FALSE; |
1002 | 1002 | } |
1003 | 1003 | //use class to change status |
1004 | - $this->_cpt_model_obj->set_status( $venue_status ); |
|
1004 | + $this->_cpt_model_obj->set_status($venue_status); |
|
1005 | 1005 | $success = $this->_cpt_model_obj->save(); |
1006 | 1006 | |
1007 | 1007 | if ($success === FALSE) { |
@@ -1020,21 +1020,21 @@ discard block |
||
1020 | 1020 | * @param bool $redirect_after |
1021 | 1021 | * @return void |
1022 | 1022 | */ |
1023 | - protected function _delete_venue( $redirect_after = true ) { |
|
1023 | + protected function _delete_venue($redirect_after = true) { |
|
1024 | 1024 | //determine the venue id and set to array. |
1025 | 1025 | $VNU_ID = isset($this->_req_data['VNU_ID']) ? absint($this->_req_data['VNU_ID']) : NULL; |
1026 | - $VNU_ID = isset( $this->_req_data['post'] ) ? absint( $this->_req_data['post'] ) : $VNU_ID; |
|
1026 | + $VNU_ID = isset($this->_req_data['post']) ? absint($this->_req_data['post']) : $VNU_ID; |
|
1027 | 1027 | |
1028 | 1028 | |
1029 | 1029 | // loop thru venues |
1030 | 1030 | if ($VNU_ID) { |
1031 | - $success = $this->_delete_or_trash_venue( $VNU_ID ); |
|
1031 | + $success = $this->_delete_or_trash_venue($VNU_ID); |
|
1032 | 1032 | } else { |
1033 | 1033 | $success = FALSE; |
1034 | 1034 | $msg = __('An error occurred. An venue could not be deleted because a valid venue ID was not not supplied.', 'event_espresso'); |
1035 | 1035 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1036 | 1036 | } |
1037 | - if ( $redirect_after ) |
|
1037 | + if ($redirect_after) |
|
1038 | 1038 | $this->_redirect_after_action($success, 'Venue', 'deleted', array('action' => 'default')); |
1039 | 1039 | } |
1040 | 1040 | |
@@ -1066,7 +1066,7 @@ discard block |
||
1066 | 1066 | //todo: put in parent |
1067 | 1067 | private function _delete_or_trash_venue($VNU_ID = FALSE) { |
1068 | 1068 | // grab event id |
1069 | - if (!$VNU_ID = absint($VNU_ID)) { |
|
1069 | + if ( ! $VNU_ID = absint($VNU_ID)) { |
|
1070 | 1070 | $msg = __('An error occurred. No Venue ID or an invalid Venue ID was received.', 'event_espresso'); |
1071 | 1071 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1072 | 1072 | return FALSE; |
@@ -1086,7 +1086,7 @@ discard block |
||
1086 | 1086 | EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
1087 | 1087 | return FALSE; |
1088 | 1088 | } |
1089 | - do_action( 'AHEE__Venues_Admin_Page___delete_or_trash_venue__after_venue_deleted' ); |
|
1089 | + do_action('AHEE__Venues_Admin_Page___delete_or_trash_venue__after_venue_deleted'); |
|
1090 | 1090 | return TRUE; |
1091 | 1091 | } |
1092 | 1092 | |
@@ -1097,11 +1097,11 @@ discard block |
||
1097 | 1097 | /* QUERIES */ |
1098 | 1098 | |
1099 | 1099 | |
1100 | - public function get_venues( $per_page = 10, $count = FALSE ) { |
|
1100 | + public function get_venues($per_page = 10, $count = FALSE) { |
|
1101 | 1101 | |
1102 | - $_orderby = !empty( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : ''; |
|
1102 | + $_orderby = ! empty($this->_req_data['orderby']) ? $this->_req_data['orderby'] : ''; |
|
1103 | 1103 | |
1104 | - switch ( $_orderby ) { |
|
1104 | + switch ($_orderby) { |
|
1105 | 1105 | case 'id': |
1106 | 1106 | $orderby = 'VNU_ID'; |
1107 | 1107 | break; |
@@ -1119,43 +1119,43 @@ discard block |
||
1119 | 1119 | } |
1120 | 1120 | |
1121 | 1121 | |
1122 | - $sort = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC'; |
|
1122 | + $sort = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC'; |
|
1123 | 1123 | |
1124 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
1125 | - $per_page = isset( $per_page ) && !empty( $per_page ) ? $per_page : 10; |
|
1126 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
1124 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
1125 | + $per_page = isset($per_page) && ! empty($per_page) ? $per_page : 10; |
|
1126 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
1127 | 1127 | |
1128 | 1128 | |
1129 | - $offset = ($current_page-1)*$per_page; |
|
1129 | + $offset = ($current_page - 1) * $per_page; |
|
1130 | 1130 | $limit = array($offset, $per_page); |
1131 | 1131 | |
1132 | - $category = isset( $this->_req_data['category'] ) && $this->_req_data['category'] > 0 ? $this->_req_data['category'] : NULL; |
|
1132 | + $category = isset($this->_req_data['category']) && $this->_req_data['category'] > 0 ? $this->_req_data['category'] : NULL; |
|
1133 | 1133 | $where = array(); |
1134 | 1134 | |
1135 | 1135 | //only set initial status if it is in the incoming request. Otherwise the "all" view display's all statuses. |
1136 | - if ( isset( $this->_req_data['status'] ) && $this->_req_data['status'] != 'all' ) { |
|
1136 | + if (isset($this->_req_data['status']) && $this->_req_data['status'] != 'all') { |
|
1137 | 1137 | $where['status'] = $this->_req_data['status']; |
1138 | 1138 | } |
1139 | 1139 | |
1140 | - if ( isset( $this->_req_data['venue_status'] ) ) { |
|
1140 | + if (isset($this->_req_data['venue_status'])) { |
|
1141 | 1141 | $where['status'] = $this->_req_data['venue_status']; |
1142 | 1142 | } |
1143 | 1143 | |
1144 | 1144 | |
1145 | - if ( $category ) { |
|
1145 | + if ($category) { |
|
1146 | 1146 | $where['Term_Taxonomy.taxonomy'] = 'espresso_venue_categories'; |
1147 | 1147 | $where['Term_Taxonomy.term_id'] = $category; |
1148 | 1148 | } |
1149 | 1149 | |
1150 | 1150 | |
1151 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_others_venues', 'get_venues' ) ) { |
|
1152 | - $where['VNU_wp_user'] = get_current_user_id(); |
|
1151 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_others_venues', 'get_venues')) { |
|
1152 | + $where['VNU_wp_user'] = get_current_user_id(); |
|
1153 | 1153 | } else { |
1154 | - if ( ! EE_Registry::instance()->CAP->current_user_can( 'ee_read_private_venues', 'get_venues' ) ) { |
|
1154 | + if ( ! EE_Registry::instance()->CAP->current_user_can('ee_read_private_venues', 'get_venues')) { |
|
1155 | 1155 | $where['OR'] = array( |
1156 | - 'status*restrict_private' => array( '!=', 'private' ), |
|
1156 | + 'status*restrict_private' => array('!=', 'private'), |
|
1157 | 1157 | 'AND' => array( |
1158 | - 'status*inclusive' => array( '=', 'private' ), |
|
1158 | + 'status*inclusive' => array('=', 'private'), |
|
1159 | 1159 | 'VNU_wp_user' => get_current_user_id() |
1160 | 1160 | ) |
1161 | 1161 | ); |
@@ -1165,30 +1165,30 @@ discard block |
||
1165 | 1165 | |
1166 | 1166 | |
1167 | 1167 | |
1168 | - if ( isset( $this->_req_data['s'] ) ) { |
|
1169 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
1168 | + if (isset($this->_req_data['s'])) { |
|
1169 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
1170 | 1170 | $where['OR'] = array( |
1171 | - 'VNU_name' => array('LIKE',$sstr ), |
|
1172 | - 'VNU_desc' => array('LIKE',$sstr ), |
|
1173 | - 'VNU_short_desc' => array( 'LIKE',$sstr ), |
|
1174 | - 'VNU_address' => array( 'LIKE', $sstr ), |
|
1175 | - 'VNU_address2' => array( 'LIKE', $sstr ), |
|
1176 | - 'VNU_city' => array( 'LIKE', $sstr ), |
|
1177 | - 'VNU_zip' => array( 'LIKE', $sstr ), |
|
1178 | - 'VNU_phone' => array( 'LIKE', $sstr ), |
|
1179 | - 'VNU_url' => array( 'LIKE', $sstr ), |
|
1180 | - 'VNU_virtual_phone' => array( 'LIKE', $sstr ), |
|
1181 | - 'VNU_virtual_url' => array( 'LIKE', $sstr ), |
|
1182 | - 'VNU_google_map_link' => array( 'LIKE', $sstr ), |
|
1183 | - 'Event.EVT_name' => array('LIKE', $sstr ), |
|
1184 | - 'Event.EVT_desc' => array('LIKE', $sstr ), |
|
1185 | - 'Event.EVT_phone' => array('LIKE', $sstr ), |
|
1186 | - 'Event.EVT_external_URL' => array('LIKE', $sstr ), |
|
1171 | + 'VNU_name' => array('LIKE', $sstr), |
|
1172 | + 'VNU_desc' => array('LIKE', $sstr), |
|
1173 | + 'VNU_short_desc' => array('LIKE', $sstr), |
|
1174 | + 'VNU_address' => array('LIKE', $sstr), |
|
1175 | + 'VNU_address2' => array('LIKE', $sstr), |
|
1176 | + 'VNU_city' => array('LIKE', $sstr), |
|
1177 | + 'VNU_zip' => array('LIKE', $sstr), |
|
1178 | + 'VNU_phone' => array('LIKE', $sstr), |
|
1179 | + 'VNU_url' => array('LIKE', $sstr), |
|
1180 | + 'VNU_virtual_phone' => array('LIKE', $sstr), |
|
1181 | + 'VNU_virtual_url' => array('LIKE', $sstr), |
|
1182 | + 'VNU_google_map_link' => array('LIKE', $sstr), |
|
1183 | + 'Event.EVT_name' => array('LIKE', $sstr), |
|
1184 | + 'Event.EVT_desc' => array('LIKE', $sstr), |
|
1185 | + 'Event.EVT_phone' => array('LIKE', $sstr), |
|
1186 | + 'Event.EVT_external_URL' => array('LIKE', $sstr), |
|
1187 | 1187 | ); |
1188 | 1188 | } |
1189 | 1189 | |
1190 | 1190 | |
1191 | - $venues = $count ? $this->_venue_model->count( array($where), 'VNU_ID' ) : $this->_venue_model->get_all( array( $where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $sort ) ); |
|
1191 | + $venues = $count ? $this->_venue_model->count(array($where), 'VNU_ID') : $this->_venue_model->get_all(array($where, 'limit' => $limit, 'order_by' => $orderby, 'order' => $sort)); |
|
1192 | 1192 | |
1193 | 1193 | return $venues; |
1194 | 1194 | |
@@ -1206,22 +1206,22 @@ discard block |
||
1206 | 1206 | * @return void |
1207 | 1207 | */ |
1208 | 1208 | private function _set_category_object() { |
1209 | - if ( isset( $this->_category->id ) && !empty( $this->_category->id ) ) |
|
1209 | + if (isset($this->_category->id) && ! empty($this->_category->id)) |
|
1210 | 1210 | return; //already have the category object so get out. |
1211 | 1211 | |
1212 | 1212 | //set default category object |
1213 | 1213 | $this->_set_empty_category_object(); |
1214 | 1214 | |
1215 | 1215 | //only set if we've got an id |
1216 | - if ( !isset($this->_req_data['VEN_CAT_ID'] ) ) { |
|
1216 | + if ( ! isset($this->_req_data['VEN_CAT_ID'])) { |
|
1217 | 1217 | return; |
1218 | 1218 | } |
1219 | 1219 | |
1220 | 1220 | $category_id = absint($this->_req_data['VEN_CAT_ID']); |
1221 | - $term = get_term( $category_id, 'espresso_venue_categories' ); |
|
1221 | + $term = get_term($category_id, 'espresso_venue_categories'); |
|
1222 | 1222 | |
1223 | 1223 | |
1224 | - if ( !empty( $term ) ) { |
|
1224 | + if ( ! empty($term)) { |
|
1225 | 1225 | $this->_category->category_name = $term->name; |
1226 | 1226 | $this->_category->category_identifier = $term->slug; |
1227 | 1227 | $this->_category->category_desc = $term->description; |
@@ -1235,15 +1235,15 @@ discard block |
||
1235 | 1235 | |
1236 | 1236 | private function _set_empty_category_object() { |
1237 | 1237 | $this->_category = new stdClass(); |
1238 | - $this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc = ''; |
|
1238 | + $this->_category->category_name = $this->_category->category_identifier = $this->_category->category_desc = ''; |
|
1239 | 1239 | $this->_category->id = $this->_category->parent = 0; |
1240 | 1240 | } |
1241 | 1241 | |
1242 | 1242 | |
1243 | 1243 | |
1244 | 1244 | protected function _category_list_table() { |
1245 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1246 | - $this->_admin_page_title .= ' ' . $this->get_action_link_or_button( |
|
1245 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1246 | + $this->_admin_page_title .= ' '.$this->get_action_link_or_button( |
|
1247 | 1247 | 'add_category', |
1248 | 1248 | 'add_category', |
1249 | 1249 | array(), |
@@ -1263,13 +1263,13 @@ discard block |
||
1263 | 1263 | $this->_set_add_edit_form_tags($route); |
1264 | 1264 | |
1265 | 1265 | $this->_set_category_object(); |
1266 | - $id = !empty($this->_category->id) ? $this->_category->id : ''; |
|
1266 | + $id = ! empty($this->_category->id) ? $this->_category->id : ''; |
|
1267 | 1267 | |
1268 | 1268 | $delete_action = 'delete_category'; |
1269 | 1269 | |
1270 | - $redirect = EE_Admin_Page::add_query_args_and_nonce( array( 'action' => 'category_list' ), $this->_admin_base_url ); |
|
1270 | + $redirect = EE_Admin_Page::add_query_args_and_nonce(array('action' => 'category_list'), $this->_admin_base_url); |
|
1271 | 1271 | |
1272 | - $this->_set_publish_post_box_vars( 'VEN_CAT_ID', $id, $delete_action, $redirect ); |
|
1272 | + $this->_set_publish_post_box_vars('VEN_CAT_ID', $id, $delete_action, $redirect); |
|
1273 | 1273 | |
1274 | 1274 | //take care of contents |
1275 | 1275 | $this->_template_args['admin_page_content'] = $this->_category_details_content(); |
@@ -1283,25 +1283,25 @@ discard block |
||
1283 | 1283 | 'type' => 'wp_editor', |
1284 | 1284 | 'value' => EEH_Formatter::admin_format_content($this->_category->category_desc), |
1285 | 1285 | 'class' => 'my_editor_custom', |
1286 | - 'wpeditor_args' => array( 'media_buttons' => FALSE ) |
|
1286 | + 'wpeditor_args' => array('media_buttons' => FALSE) |
|
1287 | 1287 | ); |
1288 | - $_wp_editor = $this->_generate_admin_form_fields( $editor_args, 'array' ); |
|
1288 | + $_wp_editor = $this->_generate_admin_form_fields($editor_args, 'array'); |
|
1289 | 1289 | |
1290 | - $all_terms = get_terms( array('espresso_venue_categories' ), array( 'hide_empty' => 0, 'exclude' => array( $this->_category->id ) ) ); |
|
1290 | + $all_terms = get_terms(array('espresso_venue_categories'), array('hide_empty' => 0, 'exclude' => array($this->_category->id))); |
|
1291 | 1291 | |
1292 | 1292 | //setup category select for term parents. |
1293 | 1293 | $category_select_values[] = array( |
1294 | 1294 | 'text' => __('No Parent', 'event_espresso'), |
1295 | 1295 | 'id' => 0 |
1296 | 1296 | ); |
1297 | - foreach ( $all_terms as $term ) { |
|
1297 | + foreach ($all_terms as $term) { |
|
1298 | 1298 | $category_select_values[] = array( |
1299 | 1299 | 'text' => $term->name, |
1300 | 1300 | 'id' => $term->term_id |
1301 | 1301 | ); |
1302 | 1302 | } |
1303 | 1303 | |
1304 | - $category_select = EEH_Form_Fields::select_input( 'category_parent', $category_select_values, $this->_category->parent ); |
|
1304 | + $category_select = EEH_Form_Fields::select_input('category_parent', $category_select_values, $this->_category->parent); |
|
1305 | 1305 | $template_args = array( |
1306 | 1306 | 'category' => $this->_category, |
1307 | 1307 | 'category_select' => $category_select, |
@@ -1310,15 +1310,15 @@ discard block |
||
1310 | 1310 | 'disable' => '', |
1311 | 1311 | 'disabled_message' =>FALSE |
1312 | 1312 | ); |
1313 | - $template = EVENTS_TEMPLATE_PATH . 'event_category_details.template.php'; |
|
1314 | - return EEH_Template::display_template($template, $template_args, TRUE ); |
|
1313 | + $template = EVENTS_TEMPLATE_PATH.'event_category_details.template.php'; |
|
1314 | + return EEH_Template::display_template($template, $template_args, TRUE); |
|
1315 | 1315 | } |
1316 | 1316 | |
1317 | 1317 | |
1318 | 1318 | protected function _delete_categories() { |
1319 | - $cat_ids = isset( $this->_req_data['VEN_CAT_ID'] ) ? (array) $this->_req_data['VEN_CAT_ID'] : (array) $this->_req_data['category_id']; |
|
1319 | + $cat_ids = isset($this->_req_data['VEN_CAT_ID']) ? (array) $this->_req_data['VEN_CAT_ID'] : (array) $this->_req_data['category_id']; |
|
1320 | 1320 | |
1321 | - foreach ( $cat_ids as $cat_id ) { |
|
1321 | + foreach ($cat_ids as $cat_id) { |
|
1322 | 1322 | $this->_delete_category($cat_id); |
1323 | 1323 | } |
1324 | 1324 | |
@@ -1326,7 +1326,7 @@ discard block |
||
1326 | 1326 | $query_args = array( |
1327 | 1327 | 'action' => 'category_list' |
1328 | 1328 | ); |
1329 | - $this->_redirect_after_action(0,'','',$query_args); |
|
1329 | + $this->_redirect_after_action(0, '', '', $query_args); |
|
1330 | 1330 | |
1331 | 1331 | } |
1332 | 1332 | |
@@ -1335,58 +1335,58 @@ discard block |
||
1335 | 1335 | |
1336 | 1336 | |
1337 | 1337 | protected function _delete_category($cat_id) { |
1338 | - $cat_id = absint( $cat_id ); |
|
1339 | - wp_delete_term( $cat_id, 'espresso_venue_categories' ); |
|
1338 | + $cat_id = absint($cat_id); |
|
1339 | + wp_delete_term($cat_id, 'espresso_venue_categories'); |
|
1340 | 1340 | } |
1341 | 1341 | |
1342 | 1342 | |
1343 | 1343 | |
1344 | 1344 | protected function _insert_or_update_category($new_category) { |
1345 | 1345 | |
1346 | - $cat_id = $new_category ? $this->_insert_category() : $this->_insert_category( TRUE ); |
|
1346 | + $cat_id = $new_category ? $this->_insert_category() : $this->_insert_category(TRUE); |
|
1347 | 1347 | $success = 0; //we already have a success message so lets not send another. |
1348 | - if ( $cat_id ) { |
|
1348 | + if ($cat_id) { |
|
1349 | 1349 | $query_args = array( |
1350 | 1350 | 'action' => 'edit_category', |
1351 | 1351 | 'VEN_CAT_ID' => $cat_id |
1352 | 1352 | ); |
1353 | 1353 | } else { |
1354 | - $query_args = array( 'action' => 'add_category' ); |
|
1354 | + $query_args = array('action' => 'add_category'); |
|
1355 | 1355 | } |
1356 | - $this->_redirect_after_action( $success, '','', $query_args, TRUE ); |
|
1356 | + $this->_redirect_after_action($success, '', '', $query_args, TRUE); |
|
1357 | 1357 | |
1358 | 1358 | } |
1359 | 1359 | |
1360 | 1360 | |
1361 | 1361 | |
1362 | - private function _insert_category( $update = FALSE ) { |
|
1362 | + private function _insert_category($update = FALSE) { |
|
1363 | 1363 | $cat_id = $update ? $this->_req_data['VEN_CAT_ID'] : ''; |
1364 | - $category_name= isset( $this->_req_data['category_name'] ) ? $this->_req_data['category_name'] : ''; |
|
1365 | - $category_desc= isset( $this->_req_data['category_desc'] ) ? $this->_req_data['category_desc'] : ''; |
|
1366 | - $category_parent = isset( $this->_req_data['category_parent'] ) ? $this->_req_data['category_parent'] : 0; |
|
1364 | + $category_name = isset($this->_req_data['category_name']) ? $this->_req_data['category_name'] : ''; |
|
1365 | + $category_desc = isset($this->_req_data['category_desc']) ? $this->_req_data['category_desc'] : ''; |
|
1366 | + $category_parent = isset($this->_req_data['category_parent']) ? $this->_req_data['category_parent'] : 0; |
|
1367 | 1367 | |
1368 | - if ( empty( $category_name ) ) { |
|
1369 | - $msg = __( 'You must add a name for the category.', 'event_espresso' ); |
|
1370 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1368 | + if (empty($category_name)) { |
|
1369 | + $msg = __('You must add a name for the category.', 'event_espresso'); |
|
1370 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1371 | 1371 | return false; |
1372 | 1372 | } |
1373 | 1373 | |
1374 | 1374 | |
1375 | - $term_args=array( |
|
1375 | + $term_args = array( |
|
1376 | 1376 | 'name'=>$category_name, |
1377 | 1377 | 'description'=>$category_desc, |
1378 | 1378 | 'parent'=>$category_parent |
1379 | 1379 | ); |
1380 | 1380 | |
1381 | - $insert_ids = $update ? wp_update_term( $cat_id, 'espresso_venue_categories', $term_args ) :wp_insert_term( $category_name, 'espresso_venue_categories', $term_args ); |
|
1381 | + $insert_ids = $update ? wp_update_term($cat_id, 'espresso_venue_categories', $term_args) : wp_insert_term($category_name, 'espresso_venue_categories', $term_args); |
|
1382 | 1382 | |
1383 | - if ( !is_array( $insert_ids ) ) { |
|
1384 | - $msg = __( 'An error occurred and the category has not been saved to the database.', 'event_espresso' ); |
|
1385 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
1383 | + if ( ! is_array($insert_ids)) { |
|
1384 | + $msg = __('An error occurred and the category has not been saved to the database.', 'event_espresso'); |
|
1385 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
1386 | 1386 | } else { |
1387 | 1387 | $cat_id = $insert_ids['term_id']; |
1388 | - $msg = sprintf ( __('The category %s was successfully created', 'event_espresso'), $category_name ); |
|
1389 | - EE_Error::add_success( $msg ); |
|
1388 | + $msg = sprintf(__('The category %s was successfully created', 'event_espresso'), $category_name); |
|
1389 | + EE_Error::add_success($msg); |
|
1390 | 1390 | } |
1391 | 1391 | |
1392 | 1392 | return $cat_id; |
@@ -1406,11 +1406,11 @@ discard block |
||
1406 | 1406 | 'category_ids' => $this->_req_data['VEN_CAT_ID'] |
1407 | 1407 | ); |
1408 | 1408 | |
1409 | - $this->_req_data = array_merge( $this->_req_data, $new_request_args ); |
|
1409 | + $this->_req_data = array_merge($this->_req_data, $new_request_args); |
|
1410 | 1410 | |
1411 | - if ( is_readable( EE_CLASSES . 'EE_Export.class.php') ) { |
|
1412 | - require_once( EE_CLASSES . 'EE_Export.class.php'); |
|
1413 | - $EE_Export = EE_Export::instance( $this->_req_data ); |
|
1411 | + if (is_readable(EE_CLASSES.'EE_Export.class.php')) { |
|
1412 | + require_once(EE_CLASSES.'EE_Export.class.php'); |
|
1413 | + $EE_Export = EE_Export::instance($this->_req_data); |
|
1414 | 1414 | $EE_Export->export(); |
1415 | 1415 | } |
1416 | 1416 | |
@@ -1422,7 +1422,7 @@ discard block |
||
1422 | 1422 | |
1423 | 1423 | protected function _import_categories() { |
1424 | 1424 | |
1425 | - require_once(EE_CLASSES . 'EE_Import.class.php'); |
|
1425 | + require_once(EE_CLASSES.'EE_Import.class.php'); |
|
1426 | 1426 | EE_Import::instance()->import(); |
1427 | 1427 | |
1428 | 1428 | } |
@@ -1430,29 +1430,29 @@ discard block |
||
1430 | 1430 | |
1431 | 1431 | |
1432 | 1432 | |
1433 | - public function get_categories( $per_page = 10, $current_page = 1, $count = FALSE ) { |
|
1433 | + public function get_categories($per_page = 10, $current_page = 1, $count = FALSE) { |
|
1434 | 1434 | |
1435 | 1435 | //testing term stuff |
1436 | - $orderby = isset( $this->_req_data['orderby'] ) ? $this->_req_data['orderby'] : 'Term.term_id'; |
|
1437 | - $order = isset( $this->_req_data['order'] ) ? $this->_req_data['order'] : 'DESC'; |
|
1438 | - $limit = ($current_page-1)*$per_page; |
|
1439 | - $where = array( 'taxonomy' => 'espresso_venue_categories' ); |
|
1440 | - if ( isset( $this->_req_data['s'] ) ) { |
|
1441 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
1436 | + $orderby = isset($this->_req_data['orderby']) ? $this->_req_data['orderby'] : 'Term.term_id'; |
|
1437 | + $order = isset($this->_req_data['order']) ? $this->_req_data['order'] : 'DESC'; |
|
1438 | + $limit = ($current_page - 1) * $per_page; |
|
1439 | + $where = array('taxonomy' => 'espresso_venue_categories'); |
|
1440 | + if (isset($this->_req_data['s'])) { |
|
1441 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
1442 | 1442 | $where['OR'] = array( |
1443 | - 'Term.name' => array( 'LIKE', $sstr), |
|
1444 | - 'description' => array( 'LIKE', $sstr ) |
|
1443 | + 'Term.name' => array('LIKE', $sstr), |
|
1444 | + 'description' => array('LIKE', $sstr) |
|
1445 | 1445 | ); |
1446 | 1446 | } |
1447 | 1447 | |
1448 | 1448 | $query_params = array( |
1449 | 1449 | $where, |
1450 | - 'order_by' => array( $orderby => $order ), |
|
1451 | - 'limit' => $limit . ',' . $per_page, |
|
1450 | + 'order_by' => array($orderby => $order), |
|
1451 | + 'limit' => $limit.','.$per_page, |
|
1452 | 1452 | 'force_join' => array('Term') |
1453 | 1453 | ); |
1454 | 1454 | |
1455 | - $categories = $count ? EEM_Term_Taxonomy::instance()->count( $query_params, 'term_id' ) :EEM_Term_Taxonomy::instance()->get_all( $query_params ); |
|
1455 | + $categories = $count ? EEM_Term_Taxonomy::instance()->count($query_params, 'term_id') : EEM_Term_Taxonomy::instance()->get_all($query_params); |
|
1456 | 1456 | |
1457 | 1457 | return $categories; |
1458 | 1458 | } |
@@ -78,9 +78,9 @@ discard block |
||
78 | 78 | |
79 | 79 | /** |
80 | 80 | * an array for storing request actions and their corresponding methods |
81 | - * @access private |
|
82 | - * @return void |
|
83 | - */ |
|
81 | + * @access private |
|
82 | + * @return void |
|
83 | + */ |
|
84 | 84 | protected function _set_page_routes() { |
85 | 85 | $prc_id = ! empty( $this->_req_data['PRC_ID'] ) && ! is_array( $this->_req_data['PRC_ID'] ) ? $this->_req_data['PRC_ID'] : 0; |
86 | 86 | $prt_id = ! empty( $this->_req_data['PRT_ID'] ) && ! is_array( $this->_req_data['PRT_ID'] ) ? $this->_req_data['PRT_ID'] : 0; |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | 'order' => 10 |
201 | 201 | ), |
202 | 202 | 'list_table' => 'Prices_List_Table', |
203 | - 'help_tabs' => array( |
|
203 | + 'help_tabs' => array( |
|
204 | 204 | 'pricing_default_pricing_help_tab' => array( |
205 | 205 | 'title' => __('Default Pricing', 'event_espresso'), |
206 | 206 | 'filename' => 'pricing_default_pricing' |
@@ -223,13 +223,13 @@ discard block |
||
223 | 223 | 'order' => 20, |
224 | 224 | 'persistent' => FALSE |
225 | 225 | ), |
226 | - 'help_tabs' => array( |
|
226 | + 'help_tabs' => array( |
|
227 | 227 | 'add_new_default_price_help_tab' => array( |
228 | 228 | 'title' => __('Add New Default Price', 'event_espresso'), |
229 | 229 | 'filename' => 'pricing_add_new_default_price' |
230 | 230 | ) |
231 | 231 | ), |
232 | - 'help_tour' => array('Pricing_Add_New_Default_Price_Help_Tour'), |
|
232 | + 'help_tour' => array('Pricing_Add_New_Default_Price_Help_Tour'), |
|
233 | 233 | 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes' ), |
234 | 234 | 'require_nonce' => FALSE |
235 | 235 | ), |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | 'persistent' => FALSE |
242 | 242 | ), |
243 | 243 | 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes' ), |
244 | - 'help_tabs' => array( |
|
244 | + 'help_tabs' => array( |
|
245 | 245 | 'edit_default_price_help_tab' => array( |
246 | 246 | 'title' => __('Edit Default Price', 'event_espresso'), |
247 | 247 | 'filename' => 'pricing_edit_default_price' |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | 'order' => 30 |
257 | 257 | ), |
258 | 258 | 'list_table' => 'Price_Types_List_Table', |
259 | - 'help_tabs' => array( |
|
259 | + 'help_tabs' => array( |
|
260 | 260 | 'pricing_price_types_help_tab' => array( |
261 | 261 | 'title' => __('Price Types', 'event_espresso'), |
262 | 262 | 'filename' => 'pricing_price_types' |
@@ -280,13 +280,13 @@ discard block |
||
280 | 280 | 'order' => 40, |
281 | 281 | 'persistent' => FALSE |
282 | 282 | ), |
283 | - 'help_tabs' => array( |
|
283 | + 'help_tabs' => array( |
|
284 | 284 | 'add_new_price_type_help_tab' => array( |
285 | 285 | 'title' => __('Add New Price Type', 'event_espresso'), |
286 | 286 | 'filename' => 'pricing_add_new_price_type' |
287 | 287 | ) |
288 | 288 | ), |
289 | - 'help_tour' => array( 'Pricing_Add_New_Price_Type_Help_Tour' ), |
|
289 | + 'help_tour' => array( 'Pricing_Add_New_Price_Type_Help_Tour' ), |
|
290 | 290 | 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes' ), |
291 | 291 | 'require_nonce' => FALSE |
292 | 292 | ), |
@@ -296,13 +296,13 @@ discard block |
||
296 | 296 | 'order' => 40, |
297 | 297 | 'persistent' => FALSE |
298 | 298 | ), |
299 | - 'help_tabs' => array( |
|
299 | + 'help_tabs' => array( |
|
300 | 300 | 'edit_price_type_help_tab' => array( |
301 | 301 | 'title' => __('Edit Price Type', 'event_espresso'), |
302 | 302 | 'filename' => 'pricing_edit_price_type' |
303 | 303 | ) |
304 | 304 | ), |
305 | - 'help_tour' => array( 'Pricing_Edit_Price_Type_Help_Tour' ), |
|
305 | + 'help_tour' => array( 'Pricing_Edit_Price_Type_Help_Tour' ), |
|
306 | 306 | 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes' ), |
307 | 307 | |
308 | 308 | 'require_nonce' => FALSE |
@@ -433,16 +433,16 @@ discard block |
||
433 | 433 | |
434 | 434 | /** |
435 | 435 | * generates HTML for main Prices Admin page |
436 | - * @access protected |
|
437 | - * @return void |
|
438 | - */ |
|
436 | + * @access protected |
|
437 | + * @return void |
|
438 | + */ |
|
439 | 439 | protected function _price_overview_list_table() { |
440 | 440 | $this->_admin_page_title .= ' ' . $this->get_action_link_or_button( |
441 | - 'add_new_price', |
|
442 | - 'add', |
|
443 | - array(), |
|
444 | - 'add-new-h2' |
|
445 | - ); |
|
441 | + 'add_new_price', |
|
442 | + 'add', |
|
443 | + array(), |
|
444 | + 'add-new-h2' |
|
445 | + ); |
|
446 | 446 | $this->admin_page_title .= $this->_learn_more_about_pricing_link(); |
447 | 447 | $this->_search_btn_label = __('Default Prices', 'event_espresso'); |
448 | 448 | $this->display_admin_list_table_page_with_no_sidebar(); |
@@ -454,13 +454,13 @@ discard block |
||
454 | 454 | |
455 | 455 | |
456 | 456 | /** |
457 | - * retrieve data for Prices List table |
|
458 | - * @access public |
|
459 | - * @param int $per_page how many prices displayed per page |
|
460 | - * @param boolean $count return the count or objects |
|
461 | - * @param boolean $trashed whether the current view is of the trash can - eww yuck! |
|
462 | - * @return mixed (int|array) int = count || array of price objects |
|
463 | - */ |
|
457 | + * retrieve data for Prices List table |
|
458 | + * @access public |
|
459 | + * @param int $per_page how many prices displayed per page |
|
460 | + * @param boolean $count return the count or objects |
|
461 | + * @param boolean $trashed whether the current view is of the trash can - eww yuck! |
|
462 | + * @return mixed (int|array) int = count || array of price objects |
|
463 | + */ |
|
464 | 464 | public function get_prices_overview_data( $per_page = 10, $count = FALSE, $trashed = FALSE ) { |
465 | 465 | |
466 | 466 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -530,9 +530,9 @@ discard block |
||
530 | 530 | |
531 | 531 | /** |
532 | 532 | * _price_details |
533 | - * @access protected |
|
534 | - * @return void |
|
535 | - */ |
|
533 | + * @access protected |
|
534 | + * @return void |
|
535 | + */ |
|
536 | 536 | protected function _edit_price_details() { |
537 | 537 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
538 | 538 | // grab price ID |
@@ -592,9 +592,9 @@ discard block |
||
592 | 592 | |
593 | 593 | /** |
594 | 594 | * declare price details page metaboxes |
595 | - * @access protected |
|
596 | - * @return void |
|
597 | - */ |
|
595 | + * @access protected |
|
596 | + * @return void |
|
597 | + */ |
|
598 | 598 | protected function _price_details_meta_boxes() { |
599 | 599 | add_meta_box( 'edit-price-details-mbox', __( 'Default Price Details', 'event_espresso' ), array( $this, '_edit_price_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
600 | 600 | } |
@@ -606,9 +606,9 @@ discard block |
||
606 | 606 | |
607 | 607 | /** |
608 | 608 | * _edit_price_details_meta_box |
609 | - * @access public |
|
610 | - * @return void |
|
611 | - */ |
|
609 | + * @access public |
|
610 | + * @return void |
|
611 | + */ |
|
612 | 612 | public function _edit_price_details_meta_box() { |
613 | 613 | echo EEH_Template::display_template( PRICING_TEMPLATE_PATH . 'pricing_details_main_meta_box.template.php', $this->_template_args, TRUE ); |
614 | 614 | } |
@@ -619,9 +619,9 @@ discard block |
||
619 | 619 | |
620 | 620 | /** |
621 | 621 | * set_price_column_values |
622 | - * @access protected |
|
623 | - * @return array |
|
624 | - */ |
|
622 | + * @access protected |
|
623 | + * @return array |
|
624 | + */ |
|
625 | 625 | protected function set_price_column_values() { |
626 | 626 | |
627 | 627 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -648,10 +648,10 @@ discard block |
||
648 | 648 | |
649 | 649 | /** |
650 | 650 | * insert_or_update_price |
651 | - * @param boolean $insert - whether to insert or update |
|
652 | - * @access protected |
|
653 | - * @return void |
|
654 | - */ |
|
651 | + * @param boolean $insert - whether to insert or update |
|
652 | + * @access protected |
|
653 | + * @return void |
|
654 | + */ |
|
655 | 655 | protected function _insert_or_update_price( $insert = FALSE ) { |
656 | 656 | |
657 | 657 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
@@ -724,10 +724,10 @@ discard block |
||
724 | 724 | |
725 | 725 | /** |
726 | 726 | * _trash_or_restore_price |
727 | - * @param boolean $trash - whether to move item to trash (TRUE) or restore it (FALSE) |
|
728 | - * @access protected |
|
729 | - * @return void |
|
730 | - */ |
|
727 | + * @param boolean $trash - whether to move item to trash (TRUE) or restore it (FALSE) |
|
728 | + * @access protected |
|
729 | + * @return void |
|
730 | + */ |
|
731 | 731 | protected function _trash_or_restore_price( $trash = TRUE ) { |
732 | 732 | |
733 | 733 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
@@ -807,9 +807,9 @@ discard block |
||
807 | 807 | |
808 | 808 | /** |
809 | 809 | * _delete_price |
810 | - * @access protected |
|
811 | - * @return void |
|
812 | - */ |
|
810 | + * @access protected |
|
811 | + * @return void |
|
812 | + */ |
|
813 | 813 | protected function _delete_price() { |
814 | 814 | |
815 | 815 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
@@ -886,16 +886,16 @@ discard block |
||
886 | 886 | |
887 | 887 | /** |
888 | 888 | * generates HTML for main Prices Admin page |
889 | - * @access protected |
|
890 | - * @return void |
|
891 | - */ |
|
889 | + * @access protected |
|
890 | + * @return void |
|
891 | + */ |
|
892 | 892 | protected function _price_types_overview_list_table() { |
893 | 893 | $this->_admin_page_title .= ' ' . $this->get_action_link_or_button( |
894 | - 'add_new_price_type', |
|
895 | - 'add_type', |
|
896 | - array(), |
|
897 | - 'add-new-h2' |
|
898 | - ); |
|
894 | + 'add_new_price_type', |
|
895 | + 'add_type', |
|
896 | + array(), |
|
897 | + 'add-new-h2' |
|
898 | + ); |
|
899 | 899 | $this->admin_page_title .= $this->_learn_more_about_pricing_link(); |
900 | 900 | $this->_search_btn_label = __('Price Types', 'event_espresso'); |
901 | 901 | $this->display_admin_list_table_page_with_no_sidebar(); |
@@ -907,13 +907,13 @@ discard block |
||
907 | 907 | |
908 | 908 | |
909 | 909 | /** |
910 | - * retrieve data for Price Types List table |
|
911 | - * @access public |
|
912 | - * @param int $per_page how many prices displayed per page |
|
913 | - * @param boolean $count return the count or objects |
|
914 | - * @param boolean $trashed whether the current view is of the trash can - eww yuck! |
|
915 | - * @return mixed (int|array) int = count || array of price objects |
|
916 | - */ |
|
910 | + * retrieve data for Price Types List table |
|
911 | + * @access public |
|
912 | + * @param int $per_page how many prices displayed per page |
|
913 | + * @param boolean $count return the count or objects |
|
914 | + * @param boolean $trashed whether the current view is of the trash can - eww yuck! |
|
915 | + * @return mixed (int|array) int = count || array of price objects |
|
916 | + */ |
|
917 | 917 | public function get_price_types_overview_data( $per_page = 10, $count = FALSE, $trashed = FALSE ) { |
918 | 918 | |
919 | 919 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -968,9 +968,9 @@ discard block |
||
968 | 968 | |
969 | 969 | /** |
970 | 970 | * _edit_price_type_details |
971 | - * @access protected |
|
972 | - * @return void |
|
973 | - */ |
|
971 | + * @access protected |
|
972 | + * @return void |
|
973 | + */ |
|
974 | 974 | protected function _edit_price_type_details() { |
975 | 975 | |
976 | 976 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -1025,9 +1025,9 @@ discard block |
||
1025 | 1025 | |
1026 | 1026 | /** |
1027 | 1027 | * declare price type details page metaboxes |
1028 | - * @access protected |
|
1029 | - * @return void |
|
1030 | - */ |
|
1028 | + * @access protected |
|
1029 | + * @return void |
|
1030 | + */ |
|
1031 | 1031 | protected function _price_type_details_meta_boxes() { |
1032 | 1032 | add_meta_box( 'edit-price-details-mbox', __( 'Price Type Details', 'event_espresso' ), array( $this, '_edit_price_type_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
1033 | 1033 | } |
@@ -1038,9 +1038,9 @@ discard block |
||
1038 | 1038 | |
1039 | 1039 | /** |
1040 | 1040 | * _edit_price_type_details_meta_box |
1041 | - * @access public |
|
1042 | - * @return void |
|
1043 | - */ |
|
1041 | + * @access public |
|
1042 | + * @return void |
|
1043 | + */ |
|
1044 | 1044 | public function _edit_price_type_details_meta_box() { |
1045 | 1045 | echo EEH_Template::display_template( PRICING_TEMPLATE_PATH . 'pricing_type_details_main_meta_box.template.php', $this->_template_args, TRUE ); |
1046 | 1046 | } |
@@ -1050,9 +1050,9 @@ discard block |
||
1050 | 1050 | |
1051 | 1051 | /** |
1052 | 1052 | * set_price_type_column_values |
1053 | - * @access protected |
|
1054 | - * @return void |
|
1055 | - */ |
|
1053 | + * @access protected |
|
1054 | + * @return void |
|
1055 | + */ |
|
1056 | 1056 | protected function set_price_type_column_values() { |
1057 | 1057 | |
1058 | 1058 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
@@ -1100,10 +1100,10 @@ discard block |
||
1100 | 1100 | |
1101 | 1101 | /** |
1102 | 1102 | * _insert_or_update_price_type |
1103 | - * @param boolean $new_price_type - whether to insert or update |
|
1104 | - * @access protected |
|
1105 | - * @return void |
|
1106 | - */ |
|
1103 | + * @param boolean $new_price_type - whether to insert or update |
|
1104 | + * @access protected |
|
1105 | + * @return void |
|
1106 | + */ |
|
1107 | 1107 | protected function _insert_or_update_price_type( $new_price_type = FALSE ) { |
1108 | 1108 | |
1109 | 1109 | // echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
@@ -1144,10 +1144,10 @@ discard block |
||
1144 | 1144 | |
1145 | 1145 | /** |
1146 | 1146 | * _trash_or_restore_price_type |
1147 | - * @param boolean $trash - whether to move item to trash (TRUE) or restore it (FALSE) |
|
1148 | - * @access protected |
|
1149 | - * @return void |
|
1150 | - */ |
|
1147 | + * @param boolean $trash - whether to move item to trash (TRUE) or restore it (FALSE) |
|
1148 | + * @access protected |
|
1149 | + * @return void |
|
1150 | + */ |
|
1151 | 1151 | protected function _trash_or_restore_price_type( $trash = TRUE ) { |
1152 | 1152 | |
1153 | 1153 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
@@ -1201,9 +1201,9 @@ discard block |
||
1201 | 1201 | |
1202 | 1202 | /** |
1203 | 1203 | * _delete_price_type |
1204 | - * @access protected |
|
1205 | - * @return void |
|
1206 | - */ |
|
1204 | + * @access protected |
|
1205 | + * @return void |
|
1206 | + */ |
|
1207 | 1207 | protected function _delete_price_type() { |
1208 | 1208 | |
1209 | 1209 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
@@ -1240,9 +1240,9 @@ discard block |
||
1240 | 1240 | |
1241 | 1241 | /** |
1242 | 1242 | * _learn_more_about_pricing_link |
1243 | - * @access protected |
|
1244 | - * @return string |
|
1245 | - */ |
|
1243 | + * @access protected |
|
1244 | + * @return string |
|
1245 | + */ |
|
1246 | 1246 | protected function _learn_more_about_pricing_link() { |
1247 | 1247 | return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >' . __('learn more about how pricing works', 'event_espresso') . '</a>'; |
1248 | 1248 | } |
@@ -31,8 +31,8 @@ discard block |
||
31 | 31 | * @param bool $routing |
32 | 32 | * @return Pricing_Admin_Page |
33 | 33 | */ |
34 | - public function __construct( $routing = TRUE ) { |
|
35 | - parent::__construct( $routing ); |
|
34 | + public function __construct($routing = TRUE) { |
|
35 | + parent::__construct($routing); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | |
50 | 50 | |
51 | 51 | protected function _ajax_hooks() { |
52 | - add_action('wp_ajax_espresso_update_prices_order', array( $this, 'update_price_order' )); |
|
52 | + add_action('wp_ajax_espresso_update_prices_order', array($this, 'update_price_order')); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | |
@@ -82,8 +82,8 @@ discard block |
||
82 | 82 | * @return void |
83 | 83 | */ |
84 | 84 | protected function _set_page_routes() { |
85 | - $prc_id = ! empty( $this->_req_data['PRC_ID'] ) && ! is_array( $this->_req_data['PRC_ID'] ) ? $this->_req_data['PRC_ID'] : 0; |
|
86 | - $prt_id = ! empty( $this->_req_data['PRT_ID'] ) && ! is_array( $this->_req_data['PRT_ID'] ) ? $this->_req_data['PRT_ID'] : 0; |
|
85 | + $prc_id = ! empty($this->_req_data['PRC_ID']) && ! is_array($this->_req_data['PRC_ID']) ? $this->_req_data['PRC_ID'] : 0; |
|
86 | + $prt_id = ! empty($this->_req_data['PRT_ID']) && ! is_array($this->_req_data['PRT_ID']) ? $this->_req_data['PRT_ID'] : 0; |
|
87 | 87 | $this->_page_routes = array( |
88 | 88 | 'default' => array( |
89 | 89 | 'func' => '_price_overview_list_table', |
@@ -91,38 +91,38 @@ discard block |
||
91 | 91 | ), |
92 | 92 | 'add_new_price' => array( |
93 | 93 | 'func' => '_edit_price_details', |
94 | - 'args' => array( 'new_price' => TRUE ), |
|
94 | + 'args' => array('new_price' => TRUE), |
|
95 | 95 | 'capability' => 'ee_edit_default_prices' |
96 | 96 | ), |
97 | 97 | 'edit_price' => array( |
98 | 98 | 'func' => '_edit_price_details', |
99 | - 'args' => array( 'new_price' => FALSE ), |
|
99 | + 'args' => array('new_price' => FALSE), |
|
100 | 100 | 'capability' => 'ee_edit_default_price', |
101 | 101 | 'obj_id' => $prc_id |
102 | 102 | ), |
103 | 103 | 'insert_price' => array( |
104 | 104 | 'func' => '_insert_or_update_price', |
105 | - 'args' => array( 'new_price' => TRUE ), |
|
105 | + 'args' => array('new_price' => TRUE), |
|
106 | 106 | 'noheader' => TRUE, |
107 | 107 | 'capability' => 'ee_edit_default_prices', |
108 | 108 | ), |
109 | 109 | 'update_price' => array( |
110 | 110 | 'func' => '_insert_or_update_price', |
111 | - 'args' => array( 'new_price' => FALSE ), |
|
111 | + 'args' => array('new_price' => FALSE), |
|
112 | 112 | 'noheader' => TRUE, |
113 | 113 | 'capability' => 'ee_edit_default_price', |
114 | 114 | 'obj_id' => $prc_id |
115 | 115 | ), |
116 | 116 | 'trash_price' => array( |
117 | 117 | 'func' => '_trash_or_restore_price', |
118 | - 'args' => array( 'trash' => TRUE ), |
|
118 | + 'args' => array('trash' => TRUE), |
|
119 | 119 | 'noheader' => TRUE, |
120 | 120 | 'capability' => 'ee_delete_default_price', |
121 | 121 | 'obj_id' => $prc_id |
122 | 122 | ), |
123 | 123 | 'restore_price' => array( |
124 | 124 | 'func' => '_trash_or_restore_price', |
125 | - 'args' => array( 'trash' => FALSE ), |
|
125 | + 'args' => array('trash' => FALSE), |
|
126 | 126 | 'noheader' => TRUE, |
127 | 127 | 'capability' => 'ee_delete_default_price', |
128 | 128 | 'obj_id' => $prc_id |
@@ -154,27 +154,27 @@ discard block |
||
154 | 154 | ), |
155 | 155 | 'insert_price_type' => array( |
156 | 156 | 'func' => '_insert_or_update_price_type', |
157 | - 'args' => array( 'new_price_type' => TRUE ), |
|
157 | + 'args' => array('new_price_type' => TRUE), |
|
158 | 158 | 'noheader' => TRUE, |
159 | 159 | 'capability' => 'ee_edit_default_price_types' |
160 | 160 | ), |
161 | 161 | 'update_price_type' => array( |
162 | 162 | 'func' => '_insert_or_update_price_type', |
163 | - 'args' => array( 'new_price_type' => FALSE ), |
|
163 | + 'args' => array('new_price_type' => FALSE), |
|
164 | 164 | 'noheader' => TRUE, |
165 | 165 | 'capability' => 'ee_edit_default_price_type', |
166 | 166 | 'obj_id' => $prt_id |
167 | 167 | ), |
168 | 168 | 'trash_price_type' => array( |
169 | 169 | 'func' => '_trash_or_restore_price_type', |
170 | - 'args' => array( 'trash' => TRUE ), |
|
170 | + 'args' => array('trash' => TRUE), |
|
171 | 171 | 'noheader' => TRUE, |
172 | 172 | 'capability' => 'ee_delete_default_price_type', |
173 | 173 | 'obj_id' => $prt_id |
174 | 174 | ), |
175 | 175 | 'restore_price_type' => array( |
176 | 176 | 'func' => '_trash_or_restore_price_type', |
177 | - 'args' => array( 'trash' => FALSE ), |
|
177 | + 'args' => array('trash' => FALSE), |
|
178 | 178 | 'noheader' => TRUE, |
179 | 179 | 'capability' => 'ee_delete_default_price_type', |
180 | 180 | 'obj_id' => $prt_id |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | 'filename' => 'pricing_default_pricing_views_bulk_actions_search' |
215 | 215 | ) |
216 | 216 | ), |
217 | - 'help_tour' => array( 'Pricing_Default_Prices_Help_Tour'), |
|
217 | + 'help_tour' => array('Pricing_Default_Prices_Help_Tour'), |
|
218 | 218 | 'require_nonce' => FALSE |
219 | 219 | ), |
220 | 220 | 'add_new_price' => array( |
@@ -230,24 +230,24 @@ discard block |
||
230 | 230 | ) |
231 | 231 | ), |
232 | 232 | 'help_tour' => array('Pricing_Add_New_Default_Price_Help_Tour'), |
233 | - 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes' ), |
|
233 | + 'metaboxes' => array('_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes'), |
|
234 | 234 | 'require_nonce' => FALSE |
235 | 235 | ), |
236 | 236 | 'edit_price' => array( |
237 | 237 | 'nav' => array( |
238 | 238 | 'label' => __('Edit Default Price', 'event_espresso'), |
239 | 239 | 'order' => 20, |
240 | - 'url' => isset($this->_req_data['id']) ? add_query_arg(array('id' => $this->_req_data['id'] ), $this->_current_page_view_url ) : $this->_admin_base_url, |
|
240 | + 'url' => isset($this->_req_data['id']) ? add_query_arg(array('id' => $this->_req_data['id']), $this->_current_page_view_url) : $this->_admin_base_url, |
|
241 | 241 | 'persistent' => FALSE |
242 | 242 | ), |
243 | - 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes' ), |
|
243 | + 'metaboxes' => array('_publish_post_box', '_espresso_news_post_box', '_price_details_meta_boxes'), |
|
244 | 244 | 'help_tabs' => array( |
245 | 245 | 'edit_default_price_help_tab' => array( |
246 | 246 | 'title' => __('Edit Default Price', 'event_espresso'), |
247 | 247 | 'filename' => 'pricing_edit_default_price' |
248 | 248 | ) |
249 | 249 | ), |
250 | - 'help_tour' => array( 'Pricing_Edit_Default_Price_Help_Tour' ), |
|
250 | + 'help_tour' => array('Pricing_Edit_Default_Price_Help_Tour'), |
|
251 | 251 | 'require_nonce' => FALSE |
252 | 252 | ), |
253 | 253 | 'price_types' => array( |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | 'filename' => 'pricing_price_types_views_bulk_actions_search' |
271 | 271 | ), |
272 | 272 | ), |
273 | - 'help_tour' => array( 'Pricing_Price_Types_Default_Help_Tour' ), |
|
273 | + 'help_tour' => array('Pricing_Price_Types_Default_Help_Tour'), |
|
274 | 274 | 'metaboxes' => array('_espresso_news_post_box', '_espresso_links_post_box'), |
275 | 275 | 'require_nonce' => FALSE |
276 | 276 | ), |
@@ -286,8 +286,8 @@ discard block |
||
286 | 286 | 'filename' => 'pricing_add_new_price_type' |
287 | 287 | ) |
288 | 288 | ), |
289 | - 'help_tour' => array( 'Pricing_Add_New_Price_Type_Help_Tour' ), |
|
290 | - 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes' ), |
|
289 | + 'help_tour' => array('Pricing_Add_New_Price_Type_Help_Tour'), |
|
290 | + 'metaboxes' => array('_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes'), |
|
291 | 291 | 'require_nonce' => FALSE |
292 | 292 | ), |
293 | 293 | 'edit_price_type' => array( |
@@ -302,8 +302,8 @@ discard block |
||
302 | 302 | 'filename' => 'pricing_edit_price_type' |
303 | 303 | ) |
304 | 304 | ), |
305 | - 'help_tour' => array( 'Pricing_Edit_Price_Type_Help_Tour' ), |
|
306 | - 'metaboxes' => array( '_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes' ), |
|
305 | + 'help_tour' => array('Pricing_Edit_Price_Type_Help_Tour'), |
|
306 | + 'metaboxes' => array('_publish_post_box', '_espresso_news_post_box', '_price_type_details_meta_boxes'), |
|
307 | 307 | |
308 | 308 | 'require_nonce' => FALSE |
309 | 309 | ) |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | public function load_scripts_styles() { |
341 | 341 | //styles |
342 | 342 | wp_enqueue_style('espresso-ui-theme'); |
343 | - wp_register_style( 'espresso_PRICING', PRICING_ASSETS_URL . 'espresso_pricing_admin.css', array(), EVENT_ESPRESSO_VERSION ); |
|
343 | + wp_register_style('espresso_PRICING', PRICING_ASSETS_URL.'espresso_pricing_admin.css', array(), EVENT_ESPRESSO_VERSION); |
|
344 | 344 | wp_enqueue_style('espresso_PRICING'); |
345 | 345 | |
346 | 346 | //scripts |
@@ -350,8 +350,8 @@ discard block |
||
350 | 350 | //wp_enqueue_script('jquery-ui-dialog'); |
351 | 351 | //wp_enqueue_script('jquery-ui-draggable'); |
352 | 352 | //wp_enqueue_script('jquery-ui-datepicker'); |
353 | - wp_register_script( 'espresso_PRICING', PRICING_ASSETS_URL . 'espresso_pricing_admin.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE ); |
|
354 | - wp_enqueue_script( 'espresso_PRICING' ); |
|
353 | + wp_register_script('espresso_PRICING', PRICING_ASSETS_URL.'espresso_pricing_admin.js', array('jquery'), EVENT_ESPRESSO_VERSION, TRUE); |
|
354 | + wp_enqueue_script('espresso_PRICING'); |
|
355 | 355 | } |
356 | 356 | |
357 | 357 | |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | |
360 | 360 | |
361 | 361 | public function load_scripts_styles_default() { |
362 | - wp_enqueue_script( 'espresso_ajax_table_sorting' ); |
|
362 | + wp_enqueue_script('espresso_ajax_table_sorting'); |
|
363 | 363 | } |
364 | 364 | |
365 | 365 | |
@@ -387,7 +387,7 @@ discard block |
||
387 | 387 | ) |
388 | 388 | ); |
389 | 389 | |
390 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_default_prices', 'pricing_trash_price' ) ) { |
|
390 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_prices', 'pricing_trash_price')) { |
|
391 | 391 | $this->_views['trashed'] = array( |
392 | 392 | 'slug' => 'trashed', |
393 | 393 | 'label' => __('Trash', 'event_espresso'), |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | ) |
418 | 418 | ); |
419 | 419 | |
420 | - if ( EE_Registry::instance()->CAP->current_user_can( 'ee_delete_default_price_types', 'pricing_trash_price_type' ) ) { |
|
420 | + if (EE_Registry::instance()->CAP->current_user_can('ee_delete_default_price_types', 'pricing_trash_price_type')) { |
|
421 | 421 | $this->_views['trashed'] = array( |
422 | 422 | 'slug' => 'trashed', |
423 | 423 | 'label' => __('Trash', 'event_espresso'), |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | * @return void |
438 | 438 | */ |
439 | 439 | protected function _price_overview_list_table() { |
440 | - $this->_admin_page_title .= ' ' . $this->get_action_link_or_button( |
|
440 | + $this->_admin_page_title .= ' '.$this->get_action_link_or_button( |
|
441 | 441 | 'add_new_price', |
442 | 442 | 'add', |
443 | 443 | array(), |
@@ -461,18 +461,18 @@ discard block |
||
461 | 461 | * @param boolean $trashed whether the current view is of the trash can - eww yuck! |
462 | 462 | * @return mixed (int|array) int = count || array of price objects |
463 | 463 | */ |
464 | - public function get_prices_overview_data( $per_page = 10, $count = FALSE, $trashed = FALSE ) { |
|
464 | + public function get_prices_overview_data($per_page = 10, $count = FALSE, $trashed = FALSE) { |
|
465 | 465 | |
466 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
466 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
467 | 467 | // start with an empty array |
468 | 468 | $event_pricing = array(); |
469 | 469 | |
470 | - require_once( PRICING_ADMIN . 'Prices_List_Table.class.php' ); |
|
471 | - require_once(EE_MODELS . 'EEM_Price.model.php'); |
|
470 | + require_once(PRICING_ADMIN.'Prices_List_Table.class.php'); |
|
471 | + require_once(EE_MODELS.'EEM_Price.model.php'); |
|
472 | 472 | //$PRC = EEM_Price::instance(); |
473 | 473 | |
474 | 474 | $this->_req_data['orderby'] = empty($this->_req_data['orderby']) ? '' : $this->_req_data['orderby']; |
475 | - $order = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC'; |
|
475 | + $order = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC'; |
|
476 | 476 | |
477 | 477 | switch ($this->_req_data['orderby']) { |
478 | 478 | case 'name': |
@@ -485,27 +485,27 @@ discard block |
||
485 | 485 | $orderby = array('PRC_amount'=>$order); |
486 | 486 | break; |
487 | 487 | default: |
488 | - $orderby = array( 'PRC_order'=>$order, 'Price_Type.PRT_order'=>$order, 'PRC_ID'=>$order); |
|
488 | + $orderby = array('PRC_order'=>$order, 'Price_Type.PRT_order'=>$order, 'PRC_ID'=>$order); |
|
489 | 489 | } |
490 | 490 | |
491 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
492 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
491 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
492 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
493 | 493 | |
494 | 494 | $_where = array( |
495 | 495 | 'PRC_is_default' => 1, |
496 | 496 | 'PRC_deleted' => $trashed |
497 | 497 | ); |
498 | 498 | |
499 | - $offset = ($current_page-1)*$per_page; |
|
500 | - $limit = array( $offset, $per_page ); |
|
499 | + $offset = ($current_page - 1) * $per_page; |
|
500 | + $limit = array($offset, $per_page); |
|
501 | 501 | |
502 | - if ( isset( $this->_req_data['s'] ) ) { |
|
503 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
502 | + if (isset($this->_req_data['s'])) { |
|
503 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
504 | 504 | $_where['OR'] = array( |
505 | - 'PRC_name' => array('LIKE',$sstr ), |
|
506 | - 'PRC_desc' => array('LIKE',$sstr ), |
|
507 | - 'PRC_amount' => array( 'LIKE',$sstr ), |
|
508 | - 'Price_Type.PRT_name' => array( 'LIKE', $sstr ) |
|
505 | + 'PRC_name' => array('LIKE', $sstr), |
|
506 | + 'PRC_desc' => array('LIKE', $sstr), |
|
507 | + 'PRC_amount' => array('LIKE', $sstr), |
|
508 | + 'Price_Type.PRT_name' => array('LIKE', $sstr) |
|
509 | 509 | ); |
510 | 510 | } |
511 | 511 | |
@@ -516,9 +516,9 @@ discard block |
||
516 | 516 | 'group_by'=>'PRC_ID' |
517 | 517 | ); |
518 | 518 | |
519 | - if($count){ |
|
520 | - return $trashed ? EEM_Price::instance()->count( array( $_where ) ) : EEM_Price::instance()->count_deleted_and_undeleted(array($_where)); |
|
521 | - }else{ |
|
519 | + if ($count) { |
|
520 | + return $trashed ? EEM_Price::instance()->count(array($_where)) : EEM_Price::instance()->count_deleted_and_undeleted(array($_where)); |
|
521 | + } else { |
|
522 | 522 | return EEM_Price::instance()->get_all_deleted_and_undeleted($query_params); |
523 | 523 | } |
524 | 524 | } |
@@ -534,49 +534,49 @@ discard block |
||
534 | 534 | * @return void |
535 | 535 | */ |
536 | 536 | protected function _edit_price_details() { |
537 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
537 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
538 | 538 | // grab price ID |
539 | - $PRC_ID = isset( $this->_req_data['id'] ) && ! empty( $this->_req_data['id'] ) ? absint( $this->_req_data['id'] ) : FALSE; |
|
539 | + $PRC_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id']) ? absint($this->_req_data['id']) : FALSE; |
|
540 | 540 | // change page title based on request action |
541 | - switch( $this->_req_action ) { |
|
541 | + switch ($this->_req_action) { |
|
542 | 542 | case 'add_new_price' : |
543 | - $this->_admin_page_title = esc_html__( 'Add New Price', 'event_espresso' ); |
|
543 | + $this->_admin_page_title = esc_html__('Add New Price', 'event_espresso'); |
|
544 | 544 | break; |
545 | 545 | case 'edit_price' : |
546 | - $this->_admin_page_title = esc_html__( 'Edit Price', 'event_espresso' ); |
|
546 | + $this->_admin_page_title = esc_html__('Edit Price', 'event_espresso'); |
|
547 | 547 | break; |
548 | 548 | default : |
549 | - $this->_admin_page_title = ucwords( str_replace( '_', ' ', $this->_req_action )); |
|
549 | + $this->_admin_page_title = ucwords(str_replace('_', ' ', $this->_req_action)); |
|
550 | 550 | } |
551 | 551 | // add PRC_ID to title if editing |
552 | - $this->_admin_page_title = $PRC_ID ? $this->_admin_page_title . ' # ' . $PRC_ID : $this->_admin_page_title; |
|
552 | + $this->_admin_page_title = $PRC_ID ? $this->_admin_page_title.' # '.$PRC_ID : $this->_admin_page_title; |
|
553 | 553 | |
554 | 554 | // get prices |
555 | - require_once(EE_MODELS . 'EEM_Price.model.php'); |
|
555 | + require_once(EE_MODELS.'EEM_Price.model.php'); |
|
556 | 556 | $PRC = EEM_Price::instance(); |
557 | 557 | |
558 | - if ( $PRC_ID ) { |
|
559 | - $price = $PRC->get_one_by_ID( $PRC_ID ); |
|
558 | + if ($PRC_ID) { |
|
559 | + $price = $PRC->get_one_by_ID($PRC_ID); |
|
560 | 560 | $additional_hidden_fields = array( |
561 | - 'PRC_ID' => array( 'type' => 'hidden', 'value' => $PRC_ID ) |
|
561 | + 'PRC_ID' => array('type' => 'hidden', 'value' => $PRC_ID) |
|
562 | 562 | ); |
563 | - $this->_set_add_edit_form_tags( 'update_price', $additional_hidden_fields ); |
|
563 | + $this->_set_add_edit_form_tags('update_price', $additional_hidden_fields); |
|
564 | 564 | } else { |
565 | 565 | $price = $PRC->get_new_price(); |
566 | - $this->_set_add_edit_form_tags( 'insert_price' ); |
|
566 | + $this->_set_add_edit_form_tags('insert_price'); |
|
567 | 567 | } |
568 | 568 | |
569 | 569 | $this->_template_args['PRC_ID'] = $PRC_ID; |
570 | 570 | $this->_template_args['price'] = $price; |
571 | 571 | |
572 | 572 | // get price types |
573 | - require_once(EE_MODELS . 'EEM_Price_Type.model.php'); |
|
573 | + require_once(EE_MODELS.'EEM_Price_Type.model.php'); |
|
574 | 574 | $PRT = EEM_Price_Type::instance(); |
575 | - $price_types = $PRT->get_all( array( array('PBT_ID' => array('!=', 1 ) ) ) ); |
|
575 | + $price_types = $PRT->get_all(array(array('PBT_ID' => array('!=', 1)))); |
|
576 | 576 | $price_type_names = array(); |
577 | 577 | if (empty($price_types)) { |
578 | - $msg = __( 'You have no price types defined. Please add a price type before adding a price.', 'event_espresso' ); |
|
579 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
578 | + $msg = __('You have no price types defined. Please add a price type before adding a price.', 'event_espresso'); |
|
579 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
580 | 580 | exit(); |
581 | 581 | } else { |
582 | 582 | foreach ($price_types as $type) { |
@@ -589,7 +589,7 @@ discard block |
||
589 | 589 | $this->_template_args['price_types'] = $price_type_names; |
590 | 590 | $this->_template_args['learn_more_about_pricing_link'] = $this->_learn_more_about_pricing_link(); |
591 | 591 | |
592 | - $this->_set_publish_post_box_vars( 'id', $PRC_ID ); |
|
592 | + $this->_set_publish_post_box_vars('id', $PRC_ID); |
|
593 | 593 | // the details template wrapper |
594 | 594 | $this->display_admin_page_with_sidebar(); |
595 | 595 | } |
@@ -605,7 +605,7 @@ discard block |
||
605 | 605 | * @return void |
606 | 606 | */ |
607 | 607 | protected function _price_details_meta_boxes() { |
608 | - add_meta_box( 'edit-price-details-mbox', __( 'Default Price Details', 'event_espresso' ), array( $this, '_edit_price_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
|
608 | + add_meta_box('edit-price-details-mbox', __('Default Price Details', 'event_espresso'), array($this, '_edit_price_details_meta_box'), $this->wp_page_slug, 'normal', 'high'); |
|
609 | 609 | } |
610 | 610 | |
611 | 611 | |
@@ -619,7 +619,7 @@ discard block |
||
619 | 619 | * @return void |
620 | 620 | */ |
621 | 621 | public function _edit_price_details_meta_box() { |
622 | - echo EEH_Template::display_template( PRICING_TEMPLATE_PATH . 'pricing_details_main_meta_box.template.php', $this->_template_args, TRUE ); |
|
622 | + echo EEH_Template::display_template(PRICING_TEMPLATE_PATH.'pricing_details_main_meta_box.template.php', $this->_template_args, TRUE); |
|
623 | 623 | } |
624 | 624 | |
625 | 625 | |
@@ -633,7 +633,7 @@ discard block |
||
633 | 633 | */ |
634 | 634 | protected function set_price_column_values() { |
635 | 635 | |
636 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
636 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
637 | 637 | |
638 | 638 | $set_column_values = array( |
639 | 639 | 'PRT_ID' => absint($this->_req_data['PRT_ID']), |
@@ -661,12 +661,12 @@ discard block |
||
661 | 661 | * @access protected |
662 | 662 | * @return void |
663 | 663 | */ |
664 | - protected function _insert_or_update_price( $insert = FALSE ) { |
|
664 | + protected function _insert_or_update_price($insert = FALSE) { |
|
665 | 665 | |
666 | 666 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
667 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
667 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
668 | 668 | |
669 | - require_once(EE_MODELS . 'EEM_Price.model.php'); |
|
669 | + require_once(EE_MODELS.'EEM_Price.model.php'); |
|
670 | 670 | $PRC = EEM_Price::instance(); |
671 | 671 | |
672 | 672 | // why be so pessimistic ??? : ( |
@@ -674,14 +674,14 @@ discard block |
||
674 | 674 | |
675 | 675 | $set_column_values = $this->set_price_column_values(); |
676 | 676 | // is this a new Price ? |
677 | - if ( $insert ) { |
|
677 | + if ($insert) { |
|
678 | 678 | // run the insert |
679 | - if ( $PRC_ID = $PRC->insert( $set_column_values )) { |
|
679 | + if ($PRC_ID = $PRC->insert($set_column_values)) { |
|
680 | 680 | //make sure this new price modifier is attached to the ticket but ONLY if it is not a tax type |
681 | 681 | $PR = EEM_price::instance()->get_one_by_ID($PRC_ID); |
682 | - if ( $PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax ) { |
|
682 | + if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) { |
|
683 | 683 | $ticket = EEM_Ticket::instance()->get_one_by_ID(1); |
684 | - $ticket->_add_relation_to( $PR, 'Price' ); |
|
684 | + $ticket->_add_relation_to($PR, 'Price'); |
|
685 | 685 | $ticket->save(); |
686 | 686 | } |
687 | 687 | $success = 1; |
@@ -691,29 +691,29 @@ discard block |
||
691 | 691 | } |
692 | 692 | $action_desc = 'created'; |
693 | 693 | } else { |
694 | - $PRC_ID = absint( $this->_req_data['PRC_ID'] ); |
|
694 | + $PRC_ID = absint($this->_req_data['PRC_ID']); |
|
695 | 695 | // run the update |
696 | - $where_cols_n_values = array( 'PRC_ID' => $PRC_ID ); |
|
697 | - if ( $PRC->update( $set_column_values, array($where_cols_n_values))) { |
|
696 | + $where_cols_n_values = array('PRC_ID' => $PRC_ID); |
|
697 | + if ($PRC->update($set_column_values, array($where_cols_n_values))) { |
|
698 | 698 | $success = 1; |
699 | 699 | } |
700 | 700 | |
701 | 701 | $PR = EEM_Price::instance()->get_one_by_ID($PRC_ID); |
702 | - if ( $PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax ) { |
|
702 | + if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) { |
|
703 | 703 | |
704 | 704 | //if this is $PRC_ID == 1, then we need to update the default ticket attached to this price so the TKT_price value is updated. |
705 | - if ( $PRC_ID === 1 ) { |
|
705 | + if ($PRC_ID === 1) { |
|
706 | 706 | $ticket = $PR->get_first_related('Ticket'); |
707 | - if ( $ticket ) { |
|
708 | - $ticket->set('TKT_price', $PR->get('PRC_amount') ); |
|
709 | - $ticket->set('TKT_name', $PR->get('PRC_name') ); |
|
707 | + if ($ticket) { |
|
708 | + $ticket->set('TKT_price', $PR->get('PRC_amount')); |
|
709 | + $ticket->set('TKT_name', $PR->get('PRC_name')); |
|
710 | 710 | $ticket->set('TKT_description', $PR->get('PRC_desc')); |
711 | 711 | $ticket->save(); |
712 | 712 | } |
713 | 713 | } else { |
714 | 714 | //we make sure this price is attached to base ticket. but ONLY if its not a tax ticket type. |
715 | 715 | $ticket = EEM_Ticket::instance()->get_one_by_ID(1); |
716 | - $ticket->_add_relation_to( $PRC_ID, 'Price' ); |
|
716 | + $ticket->_add_relation_to($PRC_ID, 'Price'); |
|
717 | 717 | $ticket->save(); |
718 | 718 | } |
719 | 719 | } |
@@ -721,9 +721,9 @@ discard block |
||
721 | 721 | $action_desc = 'updated'; |
722 | 722 | } |
723 | 723 | |
724 | - $query_args = array( 'action' => 'edit_price', 'id' => $PRC_ID ); |
|
724 | + $query_args = array('action' => 'edit_price', 'id' => $PRC_ID); |
|
725 | 725 | |
726 | - $this->_redirect_after_action( $success, 'Prices', $action_desc, $query_args ); |
|
726 | + $this->_redirect_after_action($success, 'Prices', $action_desc, $query_args); |
|
727 | 727 | |
728 | 728 | } |
729 | 729 | |
@@ -737,12 +737,12 @@ discard block |
||
737 | 737 | * @access protected |
738 | 738 | * @return void |
739 | 739 | */ |
740 | - protected function _trash_or_restore_price( $trash = TRUE ) { |
|
740 | + protected function _trash_or_restore_price($trash = TRUE) { |
|
741 | 741 | |
742 | 742 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
743 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
743 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
744 | 744 | |
745 | - require_once(EE_MODELS . 'EEM_Price.model.php'); |
|
745 | + require_once(EE_MODELS.'EEM_Price.model.php'); |
|
746 | 746 | $PRC = EEM_Price::instance(); |
747 | 747 | |
748 | 748 | $success = 1; |
@@ -751,18 +751,18 @@ discard block |
||
751 | 751 | //get base ticket for updating |
752 | 752 | $ticket = EEM_Ticket::instance()->get_one_by_ID(1); |
753 | 753 | //Checkboxes |
754 | - if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
754 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
755 | 755 | // if array has more than one element than success message should be plural |
756 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
756 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
757 | 757 | // cycle thru checkboxes |
758 | - while (list( $PRC_ID, $value ) = each($this->_req_data['checkbox'])) { |
|
759 | - if ( ! $PRC->update_by_ID(array('PRC_deleted' => $PRC_deleted), absint($PRC_ID) ) ) { |
|
758 | + while (list($PRC_ID, $value) = each($this->_req_data['checkbox'])) { |
|
759 | + if ( ! $PRC->update_by_ID(array('PRC_deleted' => $PRC_deleted), absint($PRC_ID))) { |
|
760 | 760 | $success = 0; |
761 | 761 | } else { |
762 | 762 | $PR = EEM_Price::instance()->get_one_by_ID($PRC_ID); |
763 | - if ( $PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax ) { |
|
763 | + if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) { |
|
764 | 764 | //if trashing then remove relations to base default ticket. If restoring then add back to base default ticket |
765 | - if ( $PRC_deleted ) { |
|
765 | + if ($PRC_deleted) { |
|
766 | 766 | $ticket->_remove_relation_to($PRC_ID, 'Price'); |
767 | 767 | } else { |
768 | 768 | $ticket->_add_relation_to($PRC_ID, 'Price'); |
@@ -774,14 +774,14 @@ discard block |
||
774 | 774 | |
775 | 775 | } else { |
776 | 776 | // grab single id and delete |
777 | - $PRC_ID = isset( $this->_req_data['id'] ) ? absint($this->_req_data['id']) : 0; |
|
778 | - if ( empty( $PRC_ID ) || ! $PRC->update_by_ID(array('PRC_deleted' => $PRC_deleted), $PRC_ID) ) { |
|
777 | + $PRC_ID = isset($this->_req_data['id']) ? absint($this->_req_data['id']) : 0; |
|
778 | + if (empty($PRC_ID) || ! $PRC->update_by_ID(array('PRC_deleted' => $PRC_deleted), $PRC_ID)) { |
|
779 | 779 | $success = 0; |
780 | 780 | } else { |
781 | 781 | $PR = EEM_Price::instance()->get_one_by_ID($PRC_ID); |
782 | - if ( $PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax ) { |
|
782 | + if ($PR->type_obj()->base_type() !== EEM_Price_Type::base_type_tax) { |
|
783 | 783 | //if trashing then remove relations to base default ticket. If restoring then add back to base default ticket |
784 | - if ( $PRC_deleted ) { |
|
784 | + if ($PRC_deleted) { |
|
785 | 785 | $ticket->_remove_relation_to($PRC_ID, 'Price'); |
786 | 786 | } else { |
787 | 787 | $ticket->_add_relation_to($PRC_ID, 'Price'); |
@@ -795,17 +795,17 @@ discard block |
||
795 | 795 | 'action' => 'default' |
796 | 796 | ); |
797 | 797 | |
798 | - if ( $success ) { |
|
799 | - if ( $trash ) { |
|
798 | + if ($success) { |
|
799 | + if ($trash) { |
|
800 | 800 | $msg = $success == 2 ? __('The Prices have been trashed.', 'event_espresso') : __('The Price has been trashed.', 'event_espresso'); |
801 | 801 | } else { |
802 | 802 | $msg = $success == 2 ? __('The Prices have been restored.', 'event_espresso') : __('The Price has been restored.', 'event_espresso'); |
803 | 803 | } |
804 | 804 | |
805 | - EE_Error::add_success( $msg ); |
|
805 | + EE_Error::add_success($msg); |
|
806 | 806 | } |
807 | 807 | |
808 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
808 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
809 | 809 | |
810 | 810 | } |
811 | 811 | |
@@ -822,19 +822,19 @@ discard block |
||
822 | 822 | protected function _delete_price() { |
823 | 823 | |
824 | 824 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
825 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
825 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
826 | 826 | |
827 | - require_once(EE_MODELS . 'EEM_Price.model.php'); |
|
827 | + require_once(EE_MODELS.'EEM_Price.model.php'); |
|
828 | 828 | $PRC = EEM_Price::instance(); |
829 | 829 | |
830 | 830 | $success = 1; |
831 | 831 | //Checkboxes |
832 | - if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
832 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
833 | 833 | // if array has more than one element than success message should be plural |
834 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
834 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
835 | 835 | // cycle thru bulk action checkboxes |
836 | - while (list( $PRC_ID, $value ) = each($this->_req_data['checkbox'])) { |
|
837 | - if (!$PRC->delete_permanently_by_ID(absint($PRC_ID))) { |
|
836 | + while (list($PRC_ID, $value) = each($this->_req_data['checkbox'])) { |
|
837 | + if ( ! $PRC->delete_permanently_by_ID(absint($PRC_ID))) { |
|
838 | 838 | $success = 0; |
839 | 839 | } |
840 | 840 | } |
@@ -848,7 +848,7 @@ discard block |
||
848 | 848 | |
849 | 849 | } |
850 | 850 | |
851 | - $this->_redirect_after_action( $success, 'Prices', 'deleted', array() ); |
|
851 | + $this->_redirect_after_action($success, 'Prices', 'deleted', array()); |
|
852 | 852 | |
853 | 853 | } |
854 | 854 | |
@@ -856,16 +856,16 @@ discard block |
||
856 | 856 | |
857 | 857 | |
858 | 858 | public function update_price_order() { |
859 | - $success = __( 'Price order was updated successfully.', 'event_espresso' ); |
|
859 | + $success = __('Price order was updated successfully.', 'event_espresso'); |
|
860 | 860 | |
861 | 861 | // grab our row IDs |
862 | - $row_ids = isset( $this->_req_data['row_ids'] ) && ! empty( $this->_req_data['row_ids'] ) ? explode( ',', rtrim( $this->_req_data['row_ids'], ',' )) : FALSE; |
|
862 | + $row_ids = isset($this->_req_data['row_ids']) && ! empty($this->_req_data['row_ids']) ? explode(',', rtrim($this->_req_data['row_ids'], ',')) : FALSE; |
|
863 | 863 | |
864 | - if ( is_array( $row_ids )) { |
|
865 | - for ( $i = 0; $i < count( $row_ids ); $i++ ) { |
|
864 | + if (is_array($row_ids)) { |
|
865 | + for ($i = 0; $i < count($row_ids); $i++) { |
|
866 | 866 | //Update the prices when re-ordering |
867 | 867 | $id = absint($row_ids[$i]); |
868 | - if ( EEM_Price::instance()->update ( array( 'PRC_order' => $i+1 ), array(array( 'PRC_ID' => $id ) )) === FALSE ) { |
|
868 | + if (EEM_Price::instance()->update(array('PRC_order' => $i + 1), array(array('PRC_ID' => $id))) === FALSE) { |
|
869 | 869 | $success = FALSE; |
870 | 870 | } |
871 | 871 | } |
@@ -873,9 +873,9 @@ discard block |
||
873 | 873 | $success = FALSE; |
874 | 874 | } |
875 | 875 | |
876 | - $errors = ! $success ? __( 'An error occurred. The price order was not updated.', 'event_espresso' ) : FALSE; |
|
876 | + $errors = ! $success ? __('An error occurred. The price order was not updated.', 'event_espresso') : FALSE; |
|
877 | 877 | |
878 | - echo json_encode( array( 'return_data' => FALSE, 'success' => $success, 'errors' => $errors )); |
|
878 | + echo json_encode(array('return_data' => FALSE, 'success' => $success, 'errors' => $errors)); |
|
879 | 879 | die(); |
880 | 880 | } |
881 | 881 | |
@@ -899,7 +899,7 @@ discard block |
||
899 | 899 | * @return void |
900 | 900 | */ |
901 | 901 | protected function _price_types_overview_list_table() { |
902 | - $this->_admin_page_title .= ' ' . $this->get_action_link_or_button( |
|
902 | + $this->_admin_page_title .= ' '.$this->get_action_link_or_button( |
|
903 | 903 | 'add_new_price_type', |
904 | 904 | 'add_type', |
905 | 905 | array(), |
@@ -923,46 +923,46 @@ discard block |
||
923 | 923 | * @param boolean $trashed whether the current view is of the trash can - eww yuck! |
924 | 924 | * @return mixed (int|array) int = count || array of price objects |
925 | 925 | */ |
926 | - public function get_price_types_overview_data( $per_page = 10, $count = FALSE, $trashed = FALSE ) { |
|
926 | + public function get_price_types_overview_data($per_page = 10, $count = FALSE, $trashed = FALSE) { |
|
927 | 927 | |
928 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
928 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
929 | 929 | // start with an empty array |
930 | 930 | |
931 | - require_once( PRICING_ADMIN . 'Price_Types_List_Table.class.php' ); |
|
932 | - require_once( EE_MODELS . 'EEM_Price_Type.model.php' ); |
|
931 | + require_once(PRICING_ADMIN.'Price_Types_List_Table.class.php'); |
|
932 | + require_once(EE_MODELS.'EEM_Price_Type.model.php'); |
|
933 | 933 | |
934 | 934 | $this->_req_data['orderby'] = empty($this->_req_data['orderby']) ? '' : $this->_req_data['orderby']; |
935 | - $order = ( isset( $this->_req_data['order'] ) && ! empty( $this->_req_data['order'] )) ? $this->_req_data['order'] : 'ASC'; |
|
935 | + $order = (isset($this->_req_data['order']) && ! empty($this->_req_data['order'])) ? $this->_req_data['order'] : 'ASC'; |
|
936 | 936 | switch ($this->_req_data['orderby']) { |
937 | 937 | case 'name': |
938 | - $orderby = array( 'PRT_name' => $order); |
|
938 | + $orderby = array('PRT_name' => $order); |
|
939 | 939 | break; |
940 | 940 | default: |
941 | - $orderby = array( 'PRT_order' => $order); |
|
941 | + $orderby = array('PRT_order' => $order); |
|
942 | 942 | } |
943 | 943 | |
944 | 944 | |
945 | - $current_page = isset( $this->_req_data['paged'] ) && !empty( $this->_req_data['paged'] ) ? $this->_req_data['paged'] : 1; |
|
946 | - $per_page = isset( $this->_req_data['perpage'] ) && !empty( $this->_req_data['perpage'] ) ? $this->_req_data['perpage'] : $per_page; |
|
945 | + $current_page = isset($this->_req_data['paged']) && ! empty($this->_req_data['paged']) ? $this->_req_data['paged'] : 1; |
|
946 | + $per_page = isset($this->_req_data['perpage']) && ! empty($this->_req_data['perpage']) ? $this->_req_data['perpage'] : $per_page; |
|
947 | 947 | |
948 | - $offset = ($current_page-1)*$per_page; |
|
949 | - $limit = array( $offset, $per_page ); |
|
948 | + $offset = ($current_page - 1) * $per_page; |
|
949 | + $limit = array($offset, $per_page); |
|
950 | 950 | |
951 | - $_where = array('PRT_deleted'=>$trashed, 'PBT_ID' => array('!=', 1 ) ); |
|
951 | + $_where = array('PRT_deleted'=>$trashed, 'PBT_ID' => array('!=', 1)); |
|
952 | 952 | |
953 | - if ( isset( $this->_req_data['s'] ) ) { |
|
954 | - $sstr = '%' . $this->_req_data['s'] . '%'; |
|
953 | + if (isset($this->_req_data['s'])) { |
|
954 | + $sstr = '%'.$this->_req_data['s'].'%'; |
|
955 | 955 | $_where['OR'] = array( |
956 | - 'PRT_name' => array( 'LIKE', $sstr ) |
|
956 | + 'PRT_name' => array('LIKE', $sstr) |
|
957 | 957 | ); |
958 | 958 | } |
959 | 959 | $query_params = array( |
960 | 960 | $_where, |
961 | 961 | 'order_by'=>$orderby, |
962 | 962 | 'limit'=>$limit); |
963 | - if($count){ |
|
963 | + if ($count) { |
|
964 | 964 | return EEM_Price_Type::instance()->count_deleted_and_undeleted($query_params); |
965 | - }else{ |
|
965 | + } else { |
|
966 | 966 | return EEM_Price_Type::instance()->get_all_deleted_and_undeleted($query_params); |
967 | 967 | } |
968 | 968 | |
@@ -982,34 +982,34 @@ discard block |
||
982 | 982 | */ |
983 | 983 | protected function _edit_price_type_details() { |
984 | 984 | |
985 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
985 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
986 | 986 | |
987 | 987 | |
988 | 988 | // grab price type ID |
989 | - $PRT_ID = isset( $this->_req_data['id'] ) && ! empty( $this->_req_data['id'] ) ? absint( $this->_req_data['id'] ) : FALSE; |
|
989 | + $PRT_ID = isset($this->_req_data['id']) && ! empty($this->_req_data['id']) ? absint($this->_req_data['id']) : FALSE; |
|
990 | 990 | // change page title based on request action |
991 | - switch( $this->_req_action ) { |
|
991 | + switch ($this->_req_action) { |
|
992 | 992 | case 'add_new_price_type' : |
993 | - $this->_admin_page_title = esc_html__( 'Add New Price Type', 'event_espresso' ); |
|
993 | + $this->_admin_page_title = esc_html__('Add New Price Type', 'event_espresso'); |
|
994 | 994 | break; |
995 | 995 | case 'edit_price_type' : |
996 | - $this->_admin_page_title = esc_html__( 'Edit Price Type', 'event_espresso' ); |
|
996 | + $this->_admin_page_title = esc_html__('Edit Price Type', 'event_espresso'); |
|
997 | 997 | break; |
998 | 998 | default : |
999 | - $this->_admin_page_title = ucwords( str_replace( '_', ' ', $this->_req_action )); |
|
999 | + $this->_admin_page_title = ucwords(str_replace('_', ' ', $this->_req_action)); |
|
1000 | 1000 | } |
1001 | 1001 | // add PRT_ID to title if editing |
1002 | - $this->_admin_page_title = $PRT_ID ? $this->_admin_page_title . ' # ' . $PRT_ID : $this->_admin_page_title; |
|
1002 | + $this->_admin_page_title = $PRT_ID ? $this->_admin_page_title.' # '.$PRT_ID : $this->_admin_page_title; |
|
1003 | 1003 | |
1004 | 1004 | // require_once(EE_MODELS . 'EEM_Price_Type.model.php'); |
1005 | 1005 | |
1006 | - if ( $PRT_ID ) { |
|
1007 | - $price_type = EEM_Price_Type::instance()->get_one_by_ID( $PRT_ID ); |
|
1008 | - $additional_hidden_fields = array( 'PRT_ID' => array( 'type' => 'hidden', 'value' => $PRT_ID )); |
|
1009 | - $this->_set_add_edit_form_tags( 'update_price_type', $additional_hidden_fields ); |
|
1006 | + if ($PRT_ID) { |
|
1007 | + $price_type = EEM_Price_Type::instance()->get_one_by_ID($PRT_ID); |
|
1008 | + $additional_hidden_fields = array('PRT_ID' => array('type' => 'hidden', 'value' => $PRT_ID)); |
|
1009 | + $this->_set_add_edit_form_tags('update_price_type', $additional_hidden_fields); |
|
1010 | 1010 | } else { |
1011 | 1011 | $price_type = EEM_Price_Type::instance()->get_new_price_type(); |
1012 | - $this->_set_add_edit_form_tags( 'insert_price_type' ); |
|
1012 | + $this->_set_add_edit_form_tags('insert_price_type'); |
|
1013 | 1013 | } |
1014 | 1014 | |
1015 | 1015 | $this->_template_args['PRT_ID'] = $PRT_ID; |
@@ -1018,19 +1018,19 @@ discard block |
||
1018 | 1018 | |
1019 | 1019 | $base_types = EEM_Price_Type::instance()->get_base_types(); |
1020 | 1020 | $select_values = array(); |
1021 | - foreach ( $base_types as $ref => $text ) { |
|
1022 | - if ( $ref == EEM_Price_Type::base_type_base_price ) { |
|
1021 | + foreach ($base_types as $ref => $text) { |
|
1022 | + if ($ref == EEM_Price_Type::base_type_base_price) { |
|
1023 | 1023 | //do not allow creation of base_type_base_prices because that's a system only base type. |
1024 | 1024 | continue; |
1025 | 1025 | } |
1026 | - $values[] = array( 'id' => $ref, 'text' => $text ); |
|
1026 | + $values[] = array('id' => $ref, 'text' => $text); |
|
1027 | 1027 | } |
1028 | 1028 | |
1029 | 1029 | |
1030 | 1030 | $this->_template_args['base_type_select'] = EEH_Form_Fields::select_input('base_type', $values, $price_type->base_type(), 'id="price-type-base-type-slct"'); |
1031 | 1031 | $this->_template_args['learn_more_about_pricing_link'] = $this->_learn_more_about_pricing_link(); |
1032 | - $redirect_URL = add_query_arg( array( 'action' => 'price_types'), $this->_admin_base_url ); |
|
1033 | - $this->_set_publish_post_box_vars( 'id', $PRT_ID, FALSE, $redirect_URL ); |
|
1032 | + $redirect_URL = add_query_arg(array('action' => 'price_types'), $this->_admin_base_url); |
|
1033 | + $this->_set_publish_post_box_vars('id', $PRT_ID, FALSE, $redirect_URL); |
|
1034 | 1034 | // the details template wrapper |
1035 | 1035 | $this->display_admin_page_with_sidebar(); |
1036 | 1036 | |
@@ -1047,7 +1047,7 @@ discard block |
||
1047 | 1047 | * @return void |
1048 | 1048 | */ |
1049 | 1049 | protected function _price_type_details_meta_boxes() { |
1050 | - add_meta_box( 'edit-price-details-mbox', __( 'Price Type Details', 'event_espresso' ), array( $this, '_edit_price_type_details_meta_box' ), $this->wp_page_slug, 'normal', 'high' ); |
|
1050 | + add_meta_box('edit-price-details-mbox', __('Price Type Details', 'event_espresso'), array($this, '_edit_price_type_details_meta_box'), $this->wp_page_slug, 'normal', 'high'); |
|
1051 | 1051 | } |
1052 | 1052 | |
1053 | 1053 | |
@@ -1060,7 +1060,7 @@ discard block |
||
1060 | 1060 | * @return void |
1061 | 1061 | */ |
1062 | 1062 | public function _edit_price_type_details_meta_box() { |
1063 | - echo EEH_Template::display_template( PRICING_TEMPLATE_PATH . 'pricing_type_details_main_meta_box.template.php', $this->_template_args, TRUE ); |
|
1063 | + echo EEH_Template::display_template(PRICING_TEMPLATE_PATH.'pricing_type_details_main_meta_box.template.php', $this->_template_args, TRUE); |
|
1064 | 1064 | } |
1065 | 1065 | |
1066 | 1066 | |
@@ -1073,9 +1073,9 @@ discard block |
||
1073 | 1073 | */ |
1074 | 1074 | protected function set_price_type_column_values() { |
1075 | 1075 | |
1076 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1076 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1077 | 1077 | |
1078 | - $base_type = !empty( $this->_req_data['base_type'] ) ? $this->_req_data['base_type'] : EEM_Price_Type::base_type_base_price; |
|
1078 | + $base_type = ! empty($this->_req_data['base_type']) ? $this->_req_data['base_type'] : EEM_Price_Type::base_type_base_price; |
|
1079 | 1079 | |
1080 | 1080 | switch ($base_type) { |
1081 | 1081 | |
@@ -1122,12 +1122,12 @@ discard block |
||
1122 | 1122 | * @access protected |
1123 | 1123 | * @return void |
1124 | 1124 | */ |
1125 | - protected function _insert_or_update_price_type( $new_price_type = FALSE ) { |
|
1125 | + protected function _insert_or_update_price_type($new_price_type = FALSE) { |
|
1126 | 1126 | |
1127 | 1127 | // echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
1128 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1128 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1129 | 1129 | |
1130 | - require_once(EE_MODELS . 'EEM_Price_Type.model.php'); |
|
1130 | + require_once(EE_MODELS.'EEM_Price_Type.model.php'); |
|
1131 | 1131 | $PRT = EEM_Price_Type::instance(); |
1132 | 1132 | |
1133 | 1133 | // why be so pessimistic ??? : ( |
@@ -1135,24 +1135,24 @@ discard block |
||
1135 | 1135 | |
1136 | 1136 | $set_column_values = $this->set_price_type_column_values(); |
1137 | 1137 | // is this a new Price ? |
1138 | - if ( $new_price_type ) { |
|
1138 | + if ($new_price_type) { |
|
1139 | 1139 | // run the insert |
1140 | - if ( $PRT_ID = $PRT->insert( $set_column_values )) { |
|
1140 | + if ($PRT_ID = $PRT->insert($set_column_values)) { |
|
1141 | 1141 | $success = 1; |
1142 | 1142 | } |
1143 | 1143 | $action_desc = 'created'; |
1144 | 1144 | } else { |
1145 | 1145 | $PRT_ID = absint($this->_req_data['PRT_ID']); |
1146 | 1146 | // run the update |
1147 | - $where_cols_n_values = array('PRT_ID' => $PRT_ID ); |
|
1148 | - if ( $PRT->update( $set_column_values, array( $where_cols_n_values ))) { |
|
1147 | + $where_cols_n_values = array('PRT_ID' => $PRT_ID); |
|
1148 | + if ($PRT->update($set_column_values, array($where_cols_n_values))) { |
|
1149 | 1149 | $success = 1; |
1150 | 1150 | } |
1151 | 1151 | $action_desc = 'updated'; |
1152 | 1152 | } |
1153 | 1153 | |
1154 | - $query_args = array( 'action'=> 'edit_price_type', 'id' => $PRT_ID ); |
|
1155 | - $this->_redirect_after_action( $success, 'Price Type', $action_desc, $query_args ); |
|
1154 | + $query_args = array('action'=> 'edit_price_type', 'id' => $PRT_ID); |
|
1155 | + $this->_redirect_after_action($success, 'Price Type', $action_desc, $query_args); |
|
1156 | 1156 | |
1157 | 1157 | } |
1158 | 1158 | |
@@ -1166,49 +1166,49 @@ discard block |
||
1166 | 1166 | * @access protected |
1167 | 1167 | * @return void |
1168 | 1168 | */ |
1169 | - protected function _trash_or_restore_price_type( $trash = TRUE ) { |
|
1169 | + protected function _trash_or_restore_price_type($trash = TRUE) { |
|
1170 | 1170 | |
1171 | 1171 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
1172 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1172 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1173 | 1173 | |
1174 | - require_once(EE_MODELS . 'EEM_Price_Type.model.php'); |
|
1174 | + require_once(EE_MODELS.'EEM_Price_Type.model.php'); |
|
1175 | 1175 | $PRT = EEM_Price_Type::instance(); |
1176 | 1176 | |
1177 | 1177 | $success = 1; |
1178 | 1178 | $PRT_deleted = $trash ? TRUE : FALSE; |
1179 | 1179 | //Checkboxes |
1180 | - if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
1180 | + if ( ! empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { |
|
1181 | 1181 | // if array has more than one element than success message should be plural |
1182 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
1183 | - $what = count( $this->_req_data['checkbox'] ) > 1 ? 'Price Types' : 'Price Type'; |
|
1182 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
1183 | + $what = count($this->_req_data['checkbox']) > 1 ? 'Price Types' : 'Price Type'; |
|
1184 | 1184 | // cycle thru checkboxes |
1185 | - while (list( $PRT_ID, $value ) = each($this->_req_data['checkbox'])) { |
|
1186 | - if ( ! $PRT->update_by_ID(array('PRT_deleted' => $PRT_deleted), $PRT_ID ) ) { |
|
1185 | + while (list($PRT_ID, $value) = each($this->_req_data['checkbox'])) { |
|
1186 | + if ( ! $PRT->update_by_ID(array('PRT_deleted' => $PRT_deleted), $PRT_ID)) { |
|
1187 | 1187 | $success = 0; |
1188 | 1188 | } |
1189 | 1189 | } |
1190 | 1190 | |
1191 | 1191 | } else { |
1192 | 1192 | // grab single id and delete |
1193 | - $PRT_ID = isset( $this->_req_data['id'] ) ? absint($this->_req_data['id']) : 0; |
|
1194 | - if ( empty( $PRT_ID ) || ! $PRT->update_by_ID(array('PRT_deleted' => $PRT_deleted), $PRT_ID )) { |
|
1193 | + $PRT_ID = isset($this->_req_data['id']) ? absint($this->_req_data['id']) : 0; |
|
1194 | + if (empty($PRT_ID) || ! $PRT->update_by_ID(array('PRT_deleted' => $PRT_deleted), $PRT_ID)) { |
|
1195 | 1195 | $success = 0; |
1196 | 1196 | } |
1197 | 1197 | $what = 'Price Type'; |
1198 | 1198 | |
1199 | 1199 | } |
1200 | 1200 | |
1201 | - $query_args = array( 'action' => 'price_types' ); |
|
1202 | - if ( $success ) { |
|
1203 | - if ( $trash ) { |
|
1201 | + $query_args = array('action' => 'price_types'); |
|
1202 | + if ($success) { |
|
1203 | + if ($trash) { |
|
1204 | 1204 | $msg = $success > 1 ? __('The Price Types have been trashed.', 'event_espresso') : __('The Price Type has been trashed.', 'event_espresso'); |
1205 | 1205 | } else { |
1206 | 1206 | $msg = $success > 1 ? __('The Price Types have been restored.', 'event_espresso') : __('The Price Type has been restored.', 'event_espresso'); |
1207 | 1207 | } |
1208 | - EE_Error::add_success( $msg ); |
|
1208 | + EE_Error::add_success($msg); |
|
1209 | 1209 | } |
1210 | 1210 | |
1211 | - $this->_redirect_after_action( FALSE, '', '', $query_args, TRUE ); |
|
1211 | + $this->_redirect_after_action(FALSE, '', '', $query_args, TRUE); |
|
1212 | 1212 | |
1213 | 1213 | } |
1214 | 1214 | |
@@ -1225,19 +1225,19 @@ discard block |
||
1225 | 1225 | protected function _delete_price_type() { |
1226 | 1226 | |
1227 | 1227 | //echo '<h3>'. __CLASS__ . '->' . __FUNCTION__ . ' <br /><span style="font-size:10px;font-weight:normal;">' . __FILE__ . '<br />line no: ' . __LINE__ . '</span></h3>'; |
1228 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
1228 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
1229 | 1229 | |
1230 | 1230 | $PRT = EEM_Price_Type::instance(); |
1231 | 1231 | |
1232 | 1232 | $success = 1; |
1233 | 1233 | //Checkboxes |
1234 | - if (!empty($this->_req_data['checkbox'])) { |
|
1234 | + if ( ! empty($this->_req_data['checkbox'])) { |
|
1235 | 1235 | // if array has more than one element than success message should be plural |
1236 | - $success = count( $this->_req_data['checkbox'] ) > 1 ? 2 : 1; |
|
1236 | + $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; |
|
1237 | 1237 | $what = $PRT->item_name($success); |
1238 | 1238 | // cycle thru bulk action checkboxes |
1239 | - while (list( $PRT_ID, $value ) = each($this->_req_data['checkbox'])) { |
|
1240 | - if (!$PRT->delete_permanently_by_ID($PRT_ID) ) { |
|
1239 | + while (list($PRT_ID, $value) = each($this->_req_data['checkbox'])) { |
|
1240 | + if ( ! $PRT->delete_permanently_by_ID($PRT_ID)) { |
|
1241 | 1241 | $success = 0; |
1242 | 1242 | } |
1243 | 1243 | } |
@@ -1245,8 +1245,8 @@ discard block |
||
1245 | 1245 | } |
1246 | 1246 | |
1247 | 1247 | |
1248 | - $query_args = array( 'action'=> 'price_types' ); |
|
1249 | - $this->_redirect_after_action( $success, $what, 'deleted', $query_args ); |
|
1248 | + $query_args = array('action'=> 'price_types'); |
|
1249 | + $this->_redirect_after_action($success, $what, 'deleted', $query_args); |
|
1250 | 1250 | |
1251 | 1251 | } |
1252 | 1252 | |
@@ -1262,7 +1262,7 @@ discard block |
||
1262 | 1262 | * @return string |
1263 | 1263 | */ |
1264 | 1264 | protected function _learn_more_about_pricing_link() { |
1265 | - return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >' . __('learn more about how pricing works', 'event_espresso') . '</a>'; |
|
1265 | + return '<a class="hidden" style="margin:0 20px; cursor:pointer; font-size:12px;" >'.__('learn more about how pricing works', 'event_espresso').'</a>'; |
|
1266 | 1266 | } |
1267 | 1267 | |
1268 | 1268 |