@@ -22,8 +22,8 @@ discard block |
||
| 22 | 22 | */ |
| 23 | 23 | public function __construct() { |
| 24 | 24 | parent::__construct( |
| 25 | - esc_html__( 'Ticket Selector', 'event_espresso' ), |
|
| 26 | - 'ticket_selector', |
|
| 25 | + esc_html__( 'Ticket Selector', 'event_espresso' ), |
|
| 26 | + 'ticket_selector', |
|
| 27 | 27 | esc_html__( 'Ticket Selector', 'event_espresso' ), |
| 28 | 28 | esc_html__( 'event', 'event_espresso' ) |
| 29 | 29 | ); |
@@ -32,13 +32,13 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | |
| 34 | 34 | /** |
| 35 | - * Adds an iframe embed code button to the Event editor. |
|
| 36 | - */ |
|
| 37 | - public function addEventEditorIframeEmbedButton() |
|
| 38 | - { |
|
| 39 | - // add button for iframe code to event editor. |
|
| 40 | - $this->addEventEditorIframeEmbedButtonFilter(); |
|
| 41 | - } |
|
| 35 | + * Adds an iframe embed code button to the Event editor. |
|
| 36 | + */ |
|
| 37 | + public function addEventEditorIframeEmbedButton() |
|
| 38 | + { |
|
| 39 | + // add button for iframe code to event editor. |
|
| 40 | + $this->addEventEditorIframeEmbedButtonFilter(); |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | 43 | |
| 44 | 44 | |
@@ -22,10 +22,10 @@ |
||
| 22 | 22 | */ |
| 23 | 23 | public function __construct() { |
| 24 | 24 | parent::__construct( |
| 25 | - esc_html__( 'Ticket Selector', 'event_espresso' ), |
|
| 25 | + esc_html__('Ticket Selector', 'event_espresso'), |
|
| 26 | 26 | 'ticket_selector', |
| 27 | - esc_html__( 'Ticket Selector', 'event_espresso' ), |
|
| 28 | - esc_html__( 'event', 'event_espresso' ) |
|
| 27 | + esc_html__('Ticket Selector', 'event_espresso'), |
|
| 28 | + esc_html__('event', 'event_espresso') |
|
| 29 | 29 | ); |
| 30 | 30 | } |
| 31 | 31 | |
@@ -22,15 +22,15 @@ discard block |
||
| 22 | 22 | */ |
| 23 | 23 | class EED_Ticket_Selector extends EED_Module { |
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * @var EventEspresso\modules\ticket_selector\DisplayTicketSelector $ticket_selector |
|
| 27 | - */ |
|
| 28 | - private static $ticket_selector; |
|
| 25 | + /** |
|
| 26 | + * @var EventEspresso\modules\ticket_selector\DisplayTicketSelector $ticket_selector |
|
| 27 | + */ |
|
| 28 | + private static $ticket_selector; |
|
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * @var EventEspresso\modules\ticket_selector\TicketSelectorIframeEmbedButton $iframe_embed_button |
|
| 32 | - */ |
|
| 33 | - private static $iframe_embed_button; |
|
| 30 | + /** |
|
| 31 | + * @var EventEspresso\modules\ticket_selector\TicketSelectorIframeEmbedButton $iframe_embed_button |
|
| 32 | + */ |
|
| 33 | + private static $iframe_embed_button; |
|
| 34 | 34 | |
| 35 | 35 | |
| 36 | 36 | |
@@ -51,16 +51,16 @@ discard block |
||
| 51 | 51 | |
| 52 | 52 | |
| 53 | 53 | |
| 54 | - /** |
|
| 55 | - * @return \EventEspresso\modules\ticket_selector\TicketSelectorIframeEmbedButton |
|
| 56 | - */ |
|
| 57 | - public static function getIframeEmbedButton() |
|
| 58 | - { |
|
| 59 | - if ( ! self::$iframe_embed_button instanceof TicketSelectorIframeEmbedButton) { |
|
| 60 | - self::$iframe_embed_button = new TicketSelectorIframeEmbedButton(); |
|
| 61 | - } |
|
| 62 | - return self::$iframe_embed_button; |
|
| 63 | - } |
|
| 54 | + /** |
|
| 55 | + * @return \EventEspresso\modules\ticket_selector\TicketSelectorIframeEmbedButton |
|
| 56 | + */ |
|
| 57 | + public static function getIframeEmbedButton() |
|
| 58 | + { |
|
| 59 | + if ( ! self::$iframe_embed_button instanceof TicketSelectorIframeEmbedButton) { |
|
| 60 | + self::$iframe_embed_button = new TicketSelectorIframeEmbedButton(); |
|
| 61 | + } |
|
| 62 | + return self::$iframe_embed_button; |
|
| 63 | + } |
|
| 64 | 64 | |
| 65 | 65 | |
| 66 | 66 | |
@@ -93,9 +93,9 @@ discard block |
||
| 93 | 93 | && \EE_Registry::instance()->REQ->get( 'action' ) === 'edit' |
| 94 | 94 | ) { |
| 95 | 95 | $iframe_embed_button = \EED_Ticket_Selector::getIframeEmbedButton(); |
| 96 | - $iframe_embed_button->addEventEditorIframeEmbedButton(); |
|
| 97 | - } |
|
| 98 | - } |
|
| 96 | + $iframe_embed_button->addEventEditorIframeEmbedButton(); |
|
| 97 | + } |
|
| 98 | + } |
|
| 99 | 99 | |
| 100 | 100 | |
| 101 | 101 | |
@@ -118,16 +118,16 @@ discard block |
||
| 118 | 118 | |
| 119 | 119 | |
| 120 | 120 | |
| 121 | - /** |
|
| 122 | - * @return \EventEspresso\modules\ticket_selector\DisplayTicketSelector |
|
| 123 | - */ |
|
| 124 | - public static function ticketSelector() |
|
| 125 | - { |
|
| 126 | - if ( ! EED_Ticket_Selector::$ticket_selector instanceof DisplayTicketSelector) { |
|
| 127 | - EED_Ticket_Selector::$ticket_selector = new DisplayTicketSelector(); |
|
| 128 | - } |
|
| 129 | - return EED_Ticket_Selector::$ticket_selector; |
|
| 130 | - } |
|
| 121 | + /** |
|
| 122 | + * @return \EventEspresso\modules\ticket_selector\DisplayTicketSelector |
|
| 123 | + */ |
|
| 124 | + public static function ticketSelector() |
|
| 125 | + { |
|
| 126 | + if ( ! EED_Ticket_Selector::$ticket_selector instanceof DisplayTicketSelector) { |
|
| 127 | + EED_Ticket_Selector::$ticket_selector = new DisplayTicketSelector(); |
|
| 128 | + } |
|
| 129 | + return EED_Ticket_Selector::$ticket_selector; |
|
| 130 | + } |
|
| 131 | 131 | |
| 132 | 132 | |
| 133 | 133 | /** |
@@ -155,15 +155,15 @@ discard block |
||
| 155 | 155 | |
| 156 | 156 | |
| 157 | 157 | |
| 158 | - /** |
|
| 159 | - * creates buttons for selecting number of attendees for an event |
|
| 160 | - * |
|
| 161 | - * @access public |
|
| 162 | - * @param WP_Post|int $event |
|
| 163 | - * @param bool $view_details |
|
| 164 | - * @return string |
|
| 165 | - * @throws \EE_Error |
|
| 166 | - */ |
|
| 158 | + /** |
|
| 159 | + * creates buttons for selecting number of attendees for an event |
|
| 160 | + * |
|
| 161 | + * @access public |
|
| 162 | + * @param WP_Post|int $event |
|
| 163 | + * @param bool $view_details |
|
| 164 | + * @return string |
|
| 165 | + * @throws \EE_Error |
|
| 166 | + */ |
|
| 167 | 167 | public static function display_ticket_selector( $event = NULL, $view_details = FALSE ) { |
| 168 | 168 | return EED_Ticket_Selector::ticketSelector()->display( $event, $view_details ); |
| 169 | 169 | } |
@@ -186,11 +186,11 @@ discard block |
||
| 186 | 186 | |
| 187 | 187 | |
| 188 | 188 | /** |
| 189 | - * load js |
|
| 190 | - * |
|
| 191 | - * @access public |
|
| 192 | - * @return void |
|
| 193 | - */ |
|
| 189 | + * load js |
|
| 190 | + * |
|
| 191 | + * @access public |
|
| 192 | + * @return void |
|
| 193 | + */ |
|
| 194 | 194 | public static function load_tckt_slctr_assets() { |
| 195 | 195 | if ( apply_filters( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE ) ) { |
| 196 | 196 | // add some style |
@@ -208,107 +208,107 @@ discard block |
||
| 208 | 208 | |
| 209 | 209 | |
| 210 | 210 | |
| 211 | - /** |
|
| 212 | - * @deprecated |
|
| 213 | - * @return string |
|
| 214 | - * @throws \EE_Error |
|
| 215 | - */ |
|
| 216 | - public static function display_view_details_btn() |
|
| 217 | - { |
|
| 218 | - // todo add doing_it_wrong() notice during next major version |
|
| 219 | - return EED_Ticket_Selector::ticketSelector()->displayViewDetailsButton(); |
|
| 220 | - } |
|
| 221 | - |
|
| 222 | - |
|
| 223 | - |
|
| 224 | - /** |
|
| 225 | - * @deprecated |
|
| 226 | - * @return string |
|
| 227 | - * @throws \EE_Error |
|
| 228 | - */ |
|
| 229 | - public static function display_ticket_selector_submit() |
|
| 230 | - { |
|
| 231 | - // todo add doing_it_wrong() notice during next major version |
|
| 232 | - return EED_Ticket_Selector::ticketSelector()->displaySubmitButton(); |
|
| 233 | - } |
|
| 234 | - |
|
| 235 | - |
|
| 236 | - |
|
| 237 | - /** |
|
| 238 | - * @deprecated |
|
| 239 | - * @param string $permalink_string |
|
| 240 | - * @param int $id |
|
| 241 | - * @param string $new_title |
|
| 242 | - * @param string $new_slug |
|
| 243 | - * @return string |
|
| 244 | - */ |
|
| 245 | - public static function iframe_code_button($permalink_string, $id, $new_title = '', $new_slug = '') |
|
| 246 | - { |
|
| 247 | - // todo add doing_it_wrong() notice during next major version |
|
| 248 | - if ( |
|
| 249 | - \EE_Registry::instance()->REQ->get('page') === 'espresso_events' |
|
| 250 | - && \EE_Registry::instance()->REQ->get('action') === 'edit' |
|
| 251 | - ) { |
|
| 252 | - $iframe_embed_button = \EED_Ticket_Selector::getIframeEmbedButton(); |
|
| 253 | - $iframe_embed_button->addEventEditorIframeEmbedButton(); |
|
| 254 | - } |
|
| 255 | - return ''; |
|
| 256 | - } |
|
| 257 | - |
|
| 258 | - |
|
| 259 | - |
|
| 260 | - /** |
|
| 261 | - * @deprecated |
|
| 262 | - * @param int $ID |
|
| 263 | - * @param string $external_url |
|
| 264 | - * @return string |
|
| 265 | - */ |
|
| 266 | - public static function ticket_selector_form_open($ID = 0, $external_url = '') |
|
| 267 | - { |
|
| 268 | - // todo add doing_it_wrong() notice during next major version |
|
| 269 | - return EED_Ticket_Selector::ticketSelector()->formOpen($ID, $external_url); |
|
| 270 | - } |
|
| 271 | - |
|
| 272 | - |
|
| 273 | - |
|
| 274 | - /** |
|
| 275 | - * @deprecated |
|
| 276 | - * @return string |
|
| 277 | - */ |
|
| 278 | - public static function ticket_selector_form_close() |
|
| 279 | - { |
|
| 280 | - // todo add doing_it_wrong() notice during next major version |
|
| 281 | - return EED_Ticket_Selector::ticketSelector()->formClose(); |
|
| 282 | - } |
|
| 283 | - |
|
| 284 | - |
|
| 285 | - |
|
| 286 | - /** |
|
| 287 | - * @deprecated |
|
| 288 | - * @return string |
|
| 289 | - */ |
|
| 290 | - public static function no_tkt_slctr_end_dv() |
|
| 291 | - { |
|
| 292 | - // todo add doing_it_wrong() notice during next major version |
|
| 293 | - return EED_Ticket_Selector::ticketSelector()->noTicketSelectorEndDiv(); |
|
| 294 | - } |
|
| 295 | - |
|
| 296 | - |
|
| 297 | - |
|
| 298 | - /** |
|
| 299 | - * @deprecated |
|
| 300 | - */ |
|
| 301 | - public static function load_tckt_slctr_assets_admin() |
|
| 302 | - { |
|
| 303 | - // todo add doing_it_wrong() notice during next major version |
|
| 304 | - if ( |
|
| 305 | - \EE_Registry::instance()->REQ->get( 'page' ) === 'espresso_events' |
|
| 306 | - && \EE_Registry::instance()->REQ->get( 'action' ) === 'edit' |
|
| 307 | - ) { |
|
| 308 | - $iframe_embed_button = \EED_Ticket_Selector::getIframeEmbedButton(); |
|
| 309 | - $iframe_embed_button->embedButtonAssets(); |
|
| 310 | - } |
|
| 311 | - } |
|
| 211 | + /** |
|
| 212 | + * @deprecated |
|
| 213 | + * @return string |
|
| 214 | + * @throws \EE_Error |
|
| 215 | + */ |
|
| 216 | + public static function display_view_details_btn() |
|
| 217 | + { |
|
| 218 | + // todo add doing_it_wrong() notice during next major version |
|
| 219 | + return EED_Ticket_Selector::ticketSelector()->displayViewDetailsButton(); |
|
| 220 | + } |
|
| 221 | + |
|
| 222 | + |
|
| 223 | + |
|
| 224 | + /** |
|
| 225 | + * @deprecated |
|
| 226 | + * @return string |
|
| 227 | + * @throws \EE_Error |
|
| 228 | + */ |
|
| 229 | + public static function display_ticket_selector_submit() |
|
| 230 | + { |
|
| 231 | + // todo add doing_it_wrong() notice during next major version |
|
| 232 | + return EED_Ticket_Selector::ticketSelector()->displaySubmitButton(); |
|
| 233 | + } |
|
| 234 | + |
|
| 235 | + |
|
| 236 | + |
|
| 237 | + /** |
|
| 238 | + * @deprecated |
|
| 239 | + * @param string $permalink_string |
|
| 240 | + * @param int $id |
|
| 241 | + * @param string $new_title |
|
| 242 | + * @param string $new_slug |
|
| 243 | + * @return string |
|
| 244 | + */ |
|
| 245 | + public static function iframe_code_button($permalink_string, $id, $new_title = '', $new_slug = '') |
|
| 246 | + { |
|
| 247 | + // todo add doing_it_wrong() notice during next major version |
|
| 248 | + if ( |
|
| 249 | + \EE_Registry::instance()->REQ->get('page') === 'espresso_events' |
|
| 250 | + && \EE_Registry::instance()->REQ->get('action') === 'edit' |
|
| 251 | + ) { |
|
| 252 | + $iframe_embed_button = \EED_Ticket_Selector::getIframeEmbedButton(); |
|
| 253 | + $iframe_embed_button->addEventEditorIframeEmbedButton(); |
|
| 254 | + } |
|
| 255 | + return ''; |
|
| 256 | + } |
|
| 257 | + |
|
| 258 | + |
|
| 259 | + |
|
| 260 | + /** |
|
| 261 | + * @deprecated |
|
| 262 | + * @param int $ID |
|
| 263 | + * @param string $external_url |
|
| 264 | + * @return string |
|
| 265 | + */ |
|
| 266 | + public static function ticket_selector_form_open($ID = 0, $external_url = '') |
|
| 267 | + { |
|
| 268 | + // todo add doing_it_wrong() notice during next major version |
|
| 269 | + return EED_Ticket_Selector::ticketSelector()->formOpen($ID, $external_url); |
|
| 270 | + } |
|
| 271 | + |
|
| 272 | + |
|
| 273 | + |
|
| 274 | + /** |
|
| 275 | + * @deprecated |
|
| 276 | + * @return string |
|
| 277 | + */ |
|
| 278 | + public static function ticket_selector_form_close() |
|
| 279 | + { |
|
| 280 | + // todo add doing_it_wrong() notice during next major version |
|
| 281 | + return EED_Ticket_Selector::ticketSelector()->formClose(); |
|
| 282 | + } |
|
| 283 | + |
|
| 284 | + |
|
| 285 | + |
|
| 286 | + /** |
|
| 287 | + * @deprecated |
|
| 288 | + * @return string |
|
| 289 | + */ |
|
| 290 | + public static function no_tkt_slctr_end_dv() |
|
| 291 | + { |
|
| 292 | + // todo add doing_it_wrong() notice during next major version |
|
| 293 | + return EED_Ticket_Selector::ticketSelector()->noTicketSelectorEndDiv(); |
|
| 294 | + } |
|
| 295 | + |
|
| 296 | + |
|
| 297 | + |
|
| 298 | + /** |
|
| 299 | + * @deprecated |
|
| 300 | + */ |
|
| 301 | + public static function load_tckt_slctr_assets_admin() |
|
| 302 | + { |
|
| 303 | + // todo add doing_it_wrong() notice during next major version |
|
| 304 | + if ( |
|
| 305 | + \EE_Registry::instance()->REQ->get( 'page' ) === 'espresso_events' |
|
| 306 | + && \EE_Registry::instance()->REQ->get( 'action' ) === 'edit' |
|
| 307 | + ) { |
|
| 308 | + $iframe_embed_button = \EED_Ticket_Selector::getIframeEmbedButton(); |
|
| 309 | + $iframe_embed_button->embedButtonAssets(); |
|
| 310 | + } |
|
| 311 | + } |
|
| 312 | 312 | |
| 313 | 313 | |
| 314 | 314 | } |
@@ -3,8 +3,8 @@ discard block |
||
| 3 | 3 | use EventEspresso\modules\ticket_selector\TicketSelectorIframe; |
| 4 | 4 | use EventEspresso\modules\ticket_selector\TicketSelectorIframeEmbedButton; |
| 5 | 5 | |
| 6 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
| 7 | - exit( 'No direct script access allowed' ); |
|
| 6 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
| 7 | + exit('No direct script access allowed'); |
|
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | |
@@ -38,15 +38,15 @@ discard block |
||
| 38 | 38 | * @return EED_Ticket_Selector |
| 39 | 39 | */ |
| 40 | 40 | public static function instance() { |
| 41 | - return parent::get_instance( __CLASS__ ); |
|
| 41 | + return parent::get_instance(__CLASS__); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | |
| 45 | 45 | |
| 46 | - protected function set_config(){ |
|
| 47 | - $this->set_config_section( 'template_settings' ); |
|
| 48 | - $this->set_config_class( 'EE_Ticket_Selector_Config' ); |
|
| 49 | - $this->set_config_name( 'EED_Ticket_Selector' ); |
|
| 46 | + protected function set_config() { |
|
| 47 | + $this->set_config_section('template_settings'); |
|
| 48 | + $this->set_config_class('EE_Ticket_Selector_Config'); |
|
| 49 | + $this->set_config_name('EED_Ticket_Selector'); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | |
@@ -72,11 +72,11 @@ discard block |
||
| 72 | 72 | */ |
| 73 | 73 | public static function set_hooks() { |
| 74 | 74 | // routing |
| 75 | - EE_Config::register_route( 'iframe', 'EED_Ticket_Selector', 'ticket_selector_iframe', 'ticket_selector' ); |
|
| 76 | - EE_Config::register_route( 'process_ticket_selections', 'EED_Ticket_Selector', 'process_ticket_selections' ); |
|
| 77 | - add_action( 'wp_loaded', array( 'EED_Ticket_Selector', 'set_definitions' ), 2 ); |
|
| 78 | - add_action( 'AHEE_event_details_header_bottom', array( 'EED_Ticket_Selector', 'display_ticket_selector' ), 10, 1 ); |
|
| 79 | - add_action( 'wp_enqueue_scripts', array( 'EED_Ticket_Selector', 'load_tckt_slctr_assets' ), 10 ); |
|
| 75 | + EE_Config::register_route('iframe', 'EED_Ticket_Selector', 'ticket_selector_iframe', 'ticket_selector'); |
|
| 76 | + EE_Config::register_route('process_ticket_selections', 'EED_Ticket_Selector', 'process_ticket_selections'); |
|
| 77 | + add_action('wp_loaded', array('EED_Ticket_Selector', 'set_definitions'), 2); |
|
| 78 | + add_action('AHEE_event_details_header_bottom', array('EED_Ticket_Selector', 'display_ticket_selector'), 10, 1); |
|
| 79 | + add_action('wp_enqueue_scripts', array('EED_Ticket_Selector', 'load_tckt_slctr_assets'), 10); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | |
@@ -89,8 +89,8 @@ discard block |
||
| 89 | 89 | */ |
| 90 | 90 | public static function set_hooks_admin() { |
| 91 | 91 | if ( |
| 92 | - \EE_Registry::instance()->REQ->get( 'page' ) === 'espresso_events' |
|
| 93 | - && \EE_Registry::instance()->REQ->get( 'action' ) === 'edit' |
|
| 92 | + \EE_Registry::instance()->REQ->get('page') === 'espresso_events' |
|
| 93 | + && \EE_Registry::instance()->REQ->get('action') === 'edit' |
|
| 94 | 94 | ) { |
| 95 | 95 | $iframe_embed_button = \EED_Ticket_Selector::getIframeEmbedButton(); |
| 96 | 96 | $iframe_embed_button->addEventEditorIframeEmbedButton(); |
@@ -106,12 +106,12 @@ discard block |
||
| 106 | 106 | * @return void |
| 107 | 107 | */ |
| 108 | 108 | public static function set_definitions() { |
| 109 | - define( 'TICKET_SELECTOR_ASSETS_URL', plugin_dir_url( __FILE__ ) . 'assets' . DS ); |
|
| 110 | - define( 'TICKET_SELECTOR_TEMPLATES_PATH', str_replace( '\\', DS, plugin_dir_path( __FILE__ )) . 'templates' . DS ); |
|
| 109 | + define('TICKET_SELECTOR_ASSETS_URL', plugin_dir_url(__FILE__).'assets'.DS); |
|
| 110 | + define('TICKET_SELECTOR_TEMPLATES_PATH', str_replace('\\', DS, plugin_dir_path(__FILE__)).'templates'.DS); |
|
| 111 | 111 | |
| 112 | 112 | //if config is not set, initialize |
| 113 | 113 | //If config is not set, set it. |
| 114 | - if ( ! isset( EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector ) ) { |
|
| 114 | + if ( ! isset(EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector)) { |
|
| 115 | 115 | EE_Registry::instance()->CFG->template_settings->EED_Ticket_Selector = new EE_Ticket_Selector_Config(); |
| 116 | 116 | } |
| 117 | 117 | } |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | * @param WP $WP |
| 138 | 138 | * @return void |
| 139 | 139 | */ |
| 140 | - public function run( $WP ) {} |
|
| 140 | + public function run($WP) {} |
|
| 141 | 141 | |
| 142 | 142 | |
| 143 | 143 | |
@@ -164,8 +164,8 @@ discard block |
||
| 164 | 164 | * @return string |
| 165 | 165 | * @throws \EE_Error |
| 166 | 166 | */ |
| 167 | - public static function display_ticket_selector( $event = NULL, $view_details = FALSE ) { |
|
| 168 | - return EED_Ticket_Selector::ticketSelector()->display( $event, $view_details ); |
|
| 167 | + public static function display_ticket_selector($event = NULL, $view_details = FALSE) { |
|
| 168 | + return EED_Ticket_Selector::ticketSelector()->display($event, $view_details); |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | |
@@ -192,9 +192,9 @@ discard block |
||
| 192 | 192 | * @return void |
| 193 | 193 | */ |
| 194 | 194 | public static function load_tckt_slctr_assets() { |
| 195 | - if ( apply_filters( 'FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE ) ) { |
|
| 195 | + if (apply_filters('FHEE__EED_Ticket_Selector__load_tckt_slctr_assets', FALSE)) { |
|
| 196 | 196 | // add some style |
| 197 | - wp_register_style('ticket_selector', TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.css'); |
|
| 197 | + wp_register_style('ticket_selector', TICKET_SELECTOR_ASSETS_URL.'ticket_selector.css'); |
|
| 198 | 198 | wp_enqueue_style('ticket_selector'); |
| 199 | 199 | // make it dance |
| 200 | 200 | // wp_register_script('ticket_selector', TICKET_SELECTOR_ASSETS_URL . 'ticket_selector.js', array('espresso_core'), '', TRUE); |
@@ -302,8 +302,8 @@ discard block |
||
| 302 | 302 | { |
| 303 | 303 | // todo add doing_it_wrong() notice during next major version |
| 304 | 304 | if ( |
| 305 | - \EE_Registry::instance()->REQ->get( 'page' ) === 'espresso_events' |
|
| 306 | - && \EE_Registry::instance()->REQ->get( 'action' ) === 'edit' |
|
| 305 | + \EE_Registry::instance()->REQ->get('page') === 'espresso_events' |
|
| 306 | + && \EE_Registry::instance()->REQ->get('action') === 'edit' |
|
| 307 | 307 | ) { |
| 308 | 308 | $iframe_embed_button = \EED_Ticket_Selector::getIframeEmbedButton(); |
| 309 | 309 | $iframe_embed_button->embedButtonAssets(); |
@@ -102,8 +102,8 @@ |
||
| 102 | 102 | // use_captcha ? |
| 103 | 103 | if ( |
| 104 | 104 | EE_Registry::instance()->CFG->registration->use_captcha |
| 105 | - && EE_Registry::instance()->REQ->get( 'step', '' ) !== '' |
|
| 106 | - && ! ( |
|
| 105 | + && EE_Registry::instance()->REQ->get( 'step', '' ) !== '' |
|
| 106 | + && ! ( |
|
| 107 | 107 | EE_Registry::instance()->REQ->get( 'step', '' ) === 'payment_options' |
| 108 | 108 | && (boolean) EE_Registry::instance()->REQ->get( 'revisit', false ) === true |
| 109 | 109 | ) |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | * @return EED_Recaptcha |
| 44 | 44 | */ |
| 45 | 45 | public static function instance() { |
| 46 | - return parent::get_instance( __CLASS__ ); |
|
| 46 | + return parent::get_instance(__CLASS__); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | |
@@ -59,32 +59,32 @@ discard block |
||
| 59 | 59 | if ( |
| 60 | 60 | EE_Registry::instance()->CFG->registration->use_captcha |
| 61 | 61 | && ! ( |
| 62 | - EE_Registry::instance()->REQ->get( 'step', '' ) === 'payment_options' |
|
| 63 | - && (boolean) EE_Registry::instance()->REQ->get( 'revisit', false ) === true |
|
| 62 | + EE_Registry::instance()->REQ->get('step', '') === 'payment_options' |
|
| 63 | + && (boolean) EE_Registry::instance()->REQ->get('revisit', false) === true |
|
| 64 | 64 | ) |
| 65 | 65 | ) { |
| 66 | 66 | EED_Recaptcha::set_definitions(); |
| 67 | 67 | EED_Recaptcha::enqueue_styles_and_scripts(); |
| 68 | - add_action( 'wp', array( 'EED_Recaptcha', 'set_late_hooks' ), 1, 0 ); |
|
| 68 | + add_action('wp', array('EED_Recaptcha', 'set_late_hooks'), 1, 0); |
|
| 69 | 69 | add_action( |
| 70 | 70 | 'AHEE__before_spco_whats_next_buttons', |
| 71 | - array( 'EED_Recaptcha', 'display_recaptcha' ), 10, 0 |
|
| 71 | + array('EED_Recaptcha', 'display_recaptcha'), 10, 0 |
|
| 72 | 72 | ); |
| 73 | 73 | add_filter( |
| 74 | 74 | 'FHEE__EED_Single_Page_Checkout__init___continue_reg', |
| 75 | - array( 'EED_Recaptcha', 'not_a_robot' ), 10 |
|
| 75 | + array('EED_Recaptcha', 'not_a_robot'), 10 |
|
| 76 | 76 | ); |
| 77 | 77 | add_filter( |
| 78 | 78 | 'FHEE__EE_SPCO_Reg_Step__set_completed___completed', |
| 79 | - array( 'EED_Recaptcha', 'not_a_robot' ), 10 |
|
| 79 | + array('EED_Recaptcha', 'not_a_robot'), 10 |
|
| 80 | 80 | ); |
| 81 | 81 | add_filter( |
| 82 | 82 | 'FHEE__EE_SPCO_JSON_Response___toString__JSON_response', |
| 83 | - array( 'EED_Recaptcha', 'recaptcha_response' ), 10, 1 |
|
| 83 | + array('EED_Recaptcha', 'recaptcha_response'), 10, 1 |
|
| 84 | 84 | ); |
| 85 | 85 | add_filter( |
| 86 | 86 | 'FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', |
| 87 | - array( 'EED_Recaptcha', 'bypass_recaptcha_for_spco_load_payment_method' ), 10, 1 |
|
| 87 | + array('EED_Recaptcha', 'bypass_recaptcha_for_spco_load_payment_method'), 10, 1 |
|
| 88 | 88 | ); |
| 89 | 89 | } |
| 90 | 90 | } |
@@ -102,20 +102,20 @@ discard block |
||
| 102 | 102 | // use_captcha ? |
| 103 | 103 | if ( |
| 104 | 104 | EE_Registry::instance()->CFG->registration->use_captcha |
| 105 | - && EE_Registry::instance()->REQ->get( 'step', '' ) !== '' |
|
| 105 | + && EE_Registry::instance()->REQ->get('step', '') !== '' |
|
| 106 | 106 | && ! ( |
| 107 | - EE_Registry::instance()->REQ->get( 'step', '' ) === 'payment_options' |
|
| 108 | - && (boolean) EE_Registry::instance()->REQ->get( 'revisit', false ) === true |
|
| 107 | + EE_Registry::instance()->REQ->get('step', '') === 'payment_options' |
|
| 108 | + && (boolean) EE_Registry::instance()->REQ->get('revisit', false) === true |
|
| 109 | 109 | ) |
| 110 | 110 | ) { |
| 111 | 111 | EED_Recaptcha::enqueue_styles_and_scripts(); |
| 112 | - add_filter( 'FHEE__EED_Single_Page_Checkout__init___continue_reg', array( 'EED_Recaptcha', 'not_a_robot' ), 10 ); |
|
| 113 | - add_filter( 'FHEE__EE_SPCO_Reg_Step__set_completed___completed', array( 'EED_Recaptcha', 'not_a_robot' ), 10 ); |
|
| 114 | - add_filter( 'FHEE__EE_SPCO_JSON_Response___toString__JSON_response', array( 'EED_Recaptcha', 'recaptcha_response' ), 10, 1 ); |
|
| 112 | + add_filter('FHEE__EED_Single_Page_Checkout__init___continue_reg', array('EED_Recaptcha', 'not_a_robot'), 10); |
|
| 113 | + add_filter('FHEE__EE_SPCO_Reg_Step__set_completed___completed', array('EED_Recaptcha', 'not_a_robot'), 10); |
|
| 114 | + add_filter('FHEE__EE_SPCO_JSON_Response___toString__JSON_response', array('EED_Recaptcha', 'recaptcha_response'), 10, 1); |
|
| 115 | 115 | } |
| 116 | 116 | // admin settings |
| 117 | - add_action( 'AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template', array( 'EED_Recaptcha', 'admin_settings' ), 10, 1 ); |
|
| 118 | - add_filter( 'FHEE__Extend_Registration_Form_Admin_Page___update_reg_form_settings__CFG_registration', array( 'EED_Recaptcha', 'update_admin_settings' ), 10, 1 ); |
|
| 117 | + add_action('AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template', array('EED_Recaptcha', 'admin_settings'), 10, 1); |
|
| 118 | + add_filter('FHEE__Extend_Registration_Form_Admin_Page___update_reg_form_settings__CFG_registration', array('EED_Recaptcha', 'update_admin_settings'), 10, 1); |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | |
@@ -127,11 +127,11 @@ discard block |
||
| 127 | 127 | * @return void |
| 128 | 128 | */ |
| 129 | 129 | public static function set_definitions() { |
| 130 | - if ( is_user_logged_in() ) { |
|
| 130 | + if (is_user_logged_in()) { |
|
| 131 | 131 | EED_Recaptcha::$_not_a_robot = true; |
| 132 | 132 | } |
| 133 | - define( 'RECAPTCHA_BASE_PATH', rtrim( str_replace( array( '\\', '/' ), DS, plugin_dir_path( __FILE__ )), DS ) . DS ); |
|
| 134 | - define( 'RECAPTCHA_BASE_URL', plugin_dir_url( __FILE__ )); |
|
| 133 | + define('RECAPTCHA_BASE_PATH', rtrim(str_replace(array('\\', '/'), DS, plugin_dir_path(__FILE__)), DS).DS); |
|
| 134 | + define('RECAPTCHA_BASE_URL', plugin_dir_url(__FILE__)); |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | public static function set_late_hooks() { |
| 146 | 146 | add_filter( |
| 147 | 147 | 'FHEE__Single_Page_Checkout__translate_js_strings__ajax_submit', |
| 148 | - array( 'EED_Recaptcha', 'not_a_robot' ) |
|
| 148 | + array('EED_Recaptcha', 'not_a_robot') |
|
| 149 | 149 | ); |
| 150 | 150 | } |
| 151 | 151 | |
@@ -158,11 +158,11 @@ discard block |
||
| 158 | 158 | * @return void |
| 159 | 159 | */ |
| 160 | 160 | public static function enqueue_styles_and_scripts() { |
| 161 | - wp_register_script( 'espresso_recaptcha', RECAPTCHA_BASE_URL . 'scripts' . DS . 'espresso_recaptcha.js', array( 'single_page_checkout' ), EVENT_ESPRESSO_VERSION, TRUE ); |
|
| 162 | - wp_register_script( 'google_recaptcha', 'https://www.google.com/recaptcha/api.js?hl=' . EE_Registry::instance()->CFG->registration->recaptcha_language, array( 'espresso_recaptcha' ), EVENT_ESPRESSO_VERSION, TRUE ); |
|
| 163 | - EE_Registry::$i18n_js_strings['no_SPCO_error'] = __( 'It appears the Single Page Checkout javascript was not loaded properly! Please refresh the page and try again or contact support.', 'event_espresso' ); |
|
| 164 | - EE_Registry::$i18n_js_strings['no_recaptcha_error'] = __( 'There appears to be a problem with the reCAPTCHA configuration! Please check the admin settings or contact support.', 'event_espresso' ); |
|
| 165 | - EE_Registry::$i18n_js_strings['recaptcha_fail'] = __( 'Please complete the anti-spam test before proceeding.', 'event_espresso' ); |
|
| 161 | + wp_register_script('espresso_recaptcha', RECAPTCHA_BASE_URL.'scripts'.DS.'espresso_recaptcha.js', array('single_page_checkout'), EVENT_ESPRESSO_VERSION, TRUE); |
|
| 162 | + wp_register_script('google_recaptcha', 'https://www.google.com/recaptcha/api.js?hl='.EE_Registry::instance()->CFG->registration->recaptcha_language, array('espresso_recaptcha'), EVENT_ESPRESSO_VERSION, TRUE); |
|
| 163 | + EE_Registry::$i18n_js_strings['no_SPCO_error'] = __('It appears the Single Page Checkout javascript was not loaded properly! Please refresh the page and try again or contact support.', 'event_espresso'); |
|
| 164 | + EE_Registry::$i18n_js_strings['no_recaptcha_error'] = __('There appears to be a problem with the reCAPTCHA configuration! Please check the admin settings or contact support.', 'event_espresso'); |
|
| 165 | + EE_Registry::$i18n_js_strings['recaptcha_fail'] = __('Please complete the anti-spam test before proceeding.', 'event_espresso'); |
|
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | * @access public |
| 174 | 174 | * @param \WP $WP |
| 175 | 175 | */ |
| 176 | - public function run( $WP ) { |
|
| 176 | + public function run($WP) { |
|
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | |
@@ -183,8 +183,7 @@ discard block |
||
| 183 | 183 | * @return boolean |
| 184 | 184 | */ |
| 185 | 185 | public static function not_a_robot() { |
| 186 | - $not_a_robot = is_bool( EED_Recaptcha::$_not_a_robot ) ? EED_Recaptcha::$_not_a_robot : |
|
| 187 | - EED_Recaptcha::recaptcha_passed(); |
|
| 186 | + $not_a_robot = is_bool(EED_Recaptcha::$_not_a_robot) ? EED_Recaptcha::$_not_a_robot : EED_Recaptcha::recaptcha_passed(); |
|
| 188 | 187 | return $not_a_robot; |
| 189 | 188 | } |
| 190 | 189 | |
@@ -200,22 +199,22 @@ discard block |
||
| 200 | 199 | */ |
| 201 | 200 | public static function display_recaptcha() { |
| 202 | 201 | // logged in means you have already passed a turing test of sorts |
| 203 | - if ( is_user_logged_in() ) { |
|
| 202 | + if (is_user_logged_in()) { |
|
| 204 | 203 | return; |
| 205 | 204 | } |
| 206 | 205 | // don't display if not using recaptcha or user is logged in |
| 207 | - if ( EE_Registry::instance()->CFG->registration->use_captcha ) { |
|
| 206 | + if (EE_Registry::instance()->CFG->registration->use_captcha) { |
|
| 208 | 207 | // only display if they have NOT passed the test yet |
| 209 | - if ( ! EED_Recaptcha::$_not_a_robot ) { |
|
| 208 | + if ( ! EED_Recaptcha::$_not_a_robot) { |
|
| 210 | 209 | EEH_Template::display_template( |
| 211 | - RECAPTCHA_BASE_PATH . DS . 'templates' . DS . 'recaptcha.template.php', |
|
| 210 | + RECAPTCHA_BASE_PATH.DS.'templates'.DS.'recaptcha.template.php', |
|
| 212 | 211 | array( |
| 213 | 212 | 'recaptcha_publickey' => EE_Registry::instance()->CFG->registration->recaptcha_publickey, |
| 214 | 213 | 'recaptcha_theme' => EE_Registry::instance()->CFG->registration->recaptcha_theme, |
| 215 | 214 | 'recaptcha_type' => EE_Registry::instance()->CFG->registration->recaptcha_type |
| 216 | 215 | ) |
| 217 | 216 | ); |
| 218 | - wp_enqueue_script( 'google_recaptcha' ); |
|
| 217 | + wp_enqueue_script('google_recaptcha'); |
|
| 219 | 218 | } |
| 220 | 219 | } |
| 221 | 220 | } |
@@ -246,17 +245,17 @@ discard block |
||
| 246 | 245 | */ |
| 247 | 246 | public static function recaptcha_passed() { |
| 248 | 247 | // logged in means you have already passed a turing test of sorts |
| 249 | - if ( is_user_logged_in() || EED_Recaptcha::_bypass_recaptcha() ) { |
|
| 248 | + if (is_user_logged_in() || EED_Recaptcha::_bypass_recaptcha()) { |
|
| 250 | 249 | return TRUE; |
| 251 | 250 | } |
| 252 | 251 | // was test already passed? |
| 253 | - $recaptcha_passed = EE_Registry::instance()->SSN->get_session_data( 'recaptcha_passed' ); |
|
| 254 | - $recaptcha_passed = filter_var( $recaptcha_passed, FILTER_VALIDATE_BOOLEAN ); |
|
| 252 | + $recaptcha_passed = EE_Registry::instance()->SSN->get_session_data('recaptcha_passed'); |
|
| 253 | + $recaptcha_passed = filter_var($recaptcha_passed, FILTER_VALIDATE_BOOLEAN); |
|
| 255 | 254 | // verify recaptcha |
| 256 | 255 | EED_Recaptcha::_get_recaptcha_response(); |
| 257 | - if ( ! $recaptcha_passed && EED_Recaptcha::$_recaptcha_response ) { |
|
| 256 | + if ( ! $recaptcha_passed && EED_Recaptcha::$_recaptcha_response) { |
|
| 258 | 257 | $recaptcha_passed = EED_Recaptcha::_process_recaptcha_response(); |
| 259 | - EE_Registry::instance()->SSN->set_session_data( array( 'recaptcha_passed' => $recaptcha_passed )); |
|
| 258 | + EE_Registry::instance()->SSN->set_session_data(array('recaptcha_passed' => $recaptcha_passed)); |
|
| 260 | 259 | EE_Registry::instance()->SSN->update(); |
| 261 | 260 | } |
| 262 | 261 | EED_Recaptcha::$_not_a_robot = $recaptcha_passed; |
@@ -272,8 +271,8 @@ discard block |
||
| 272 | 271 | * @param array $recaptcha_response |
| 273 | 272 | * @return boolean |
| 274 | 273 | */ |
| 275 | - public static function recaptcha_response( $recaptcha_response = array() ) { |
|
| 276 | - if ( EED_Recaptcha::_bypass_recaptcha() ) { |
|
| 274 | + public static function recaptcha_response($recaptcha_response = array()) { |
|
| 275 | + if (EED_Recaptcha::_bypass_recaptcha()) { |
|
| 277 | 276 | $recaptcha_response['bypass_recaptcha'] = TRUE; |
| 278 | 277 | $recaptcha_response['recaptcha_passed'] = TRUE; |
| 279 | 278 | } else { |
@@ -293,16 +292,16 @@ discard block |
||
| 293 | 292 | */ |
| 294 | 293 | private static function _bypass_recaptcha() { |
| 295 | 294 | // an array of key value pairs that must match exactly with the incoming request, in order to bypass recaptcha for the current request ONLY |
| 296 | - $bypass_request_params_array = apply_filters( 'FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', array() ); |
|
| 295 | + $bypass_request_params_array = apply_filters('FHEE__EED_Recaptcha___bypass_recaptcha__bypass_request_params_array', array()); |
|
| 297 | 296 | // does $bypass_request_params_array have any values ? |
| 298 | - if ( empty( $bypass_request_params_array )) { |
|
| 297 | + if (empty($bypass_request_params_array)) { |
|
| 299 | 298 | return FALSE; |
| 300 | 299 | } |
| 301 | 300 | // initially set bypass to TRUE |
| 302 | 301 | $bypass_recaptcha = TRUE; |
| 303 | - foreach ( $bypass_request_params_array as $key => $value ) { |
|
| 302 | + foreach ($bypass_request_params_array as $key => $value) { |
|
| 304 | 303 | // if $key is not found or value doesn't match exactly, then toggle bypass to FALSE, otherwise carry over it's value. This way, one missed setting results in no bypass |
| 305 | - $bypass_recaptcha = isset( $_REQUEST[ $key ] ) && $_REQUEST[ $key ] === $value ? $bypass_recaptcha : FALSE; |
|
| 304 | + $bypass_recaptcha = isset($_REQUEST[$key]) && $_REQUEST[$key] === $value ? $bypass_recaptcha : FALSE; |
|
| 306 | 305 | } |
| 307 | 306 | return $bypass_recaptcha; |
| 308 | 307 | } |
@@ -317,7 +316,7 @@ discard block |
||
| 317 | 316 | * @return boolean |
| 318 | 317 | */ |
| 319 | 318 | private static function _get_recaptcha_response() { |
| 320 | - EED_Recaptcha::$_recaptcha_response = EE_Registry::instance()->REQ->get( 'g-recaptcha-response', false ); |
|
| 319 | + EED_Recaptcha::$_recaptcha_response = EE_Registry::instance()->REQ->get('g-recaptcha-response', false); |
|
| 321 | 320 | } |
| 322 | 321 | |
| 323 | 322 | |
@@ -331,26 +330,26 @@ discard block |
||
| 331 | 330 | */ |
| 332 | 331 | private static function _process_recaptcha_response() { |
| 333 | 332 | // verify library is loaded |
| 334 | - if ( ! class_exists( '\\ReCaptcha\\ReCaptcha' )) { |
|
| 335 | - require_once( RECAPTCHA_BASE_PATH . DS . 'autoload.php' ); |
|
| 333 | + if ( ! class_exists('\\ReCaptcha\\ReCaptcha')) { |
|
| 334 | + require_once(RECAPTCHA_BASE_PATH.DS.'autoload.php'); |
|
| 336 | 335 | } |
| 337 | 336 | // The response from reCAPTCHA |
| 338 | 337 | EED_Recaptcha::_get_recaptcha_response(); |
| 339 | 338 | $recaptcha_response = EED_Recaptcha::$_recaptcha_response; |
| 340 | 339 | // Was there a reCAPTCHA response? |
| 341 | - if ( $recaptcha_response ) { |
|
| 340 | + if ($recaptcha_response) { |
|
| 342 | 341 | // if allow_url_fopen is Off, then set a different request method |
| 343 | - $request_method = ! ini_get( 'allow_url_fopen' ) ? new \ReCaptcha\RequestMethod\SocketPost() : null; |
|
| 342 | + $request_method = ! ini_get('allow_url_fopen') ? new \ReCaptcha\RequestMethod\SocketPost() : null; |
|
| 344 | 343 | $recaptcha = new \ReCaptcha\ReCaptcha( |
| 345 | 344 | EE_Registry::instance()->CFG->registration->recaptcha_privatekey, |
| 346 | 345 | $request_method |
| 347 | 346 | ); |
| 348 | 347 | $recaptcha_response = $recaptcha->verify( |
| 349 | 348 | EED_Recaptcha::$_recaptcha_response, |
| 350 | - $_SERVER[ 'REMOTE_ADDR' ] |
|
| 349 | + $_SERVER['REMOTE_ADDR'] |
|
| 351 | 350 | ); |
| 352 | 351 | } |
| 353 | - if ( $recaptcha_response instanceof \ReCaptcha\Response && $recaptcha_response->isSuccess() ) { |
|
| 352 | + if ($recaptcha_response instanceof \ReCaptcha\Response && $recaptcha_response->isSuccess()) { |
|
| 354 | 353 | return TRUE; |
| 355 | 354 | } |
| 356 | 355 | // sorry... it appears you can't don't know what soup or hamburgers are !!! |
@@ -394,12 +393,12 @@ discard block |
||
| 394 | 393 | 'subsections' => apply_filters( |
| 395 | 394 | 'FHEE__EED_Recaptcha___recaptcha_settings_form__form_subsections', |
| 396 | 395 | array( |
| 397 | - 'main_settings_hdr' => new EE_Form_Section_HTML( EEH_HTML::h2( __( 'reCAPTCHA Anti-spam Settings', 'event_espresso' ) . EEH_Template::get_help_tab_link( 'recaptcha_info' ))), |
|
| 396 | + 'main_settings_hdr' => new EE_Form_Section_HTML(EEH_HTML::h2(__('reCAPTCHA Anti-spam Settings', 'event_espresso').EEH_Template::get_help_tab_link('recaptcha_info'))), |
|
| 398 | 397 | 'main_settings' => EED_Recaptcha::_recaptcha_main_settings(), |
| 399 | - 'appearance_settings_hdr' => new EE_Form_Section_HTML( EEH_HTML::h2( __( 'reCAPTCHA Appearance', 'event_espresso' ) )), |
|
| 398 | + 'appearance_settings_hdr' => new EE_Form_Section_HTML(EEH_HTML::h2(__('reCAPTCHA Appearance', 'event_espresso'))), |
|
| 400 | 399 | 'appearance_settings' => EED_Recaptcha::_recaptcha_appearance_settings(), |
| 401 | 400 | // 'recaptcha_example' => new EE_Form_Section_HTML( EED_Recaptcha::display_recaptcha() ), |
| 402 | - 'required_fields_note' => new EE_Form_Section_HTML( EEH_HTML::p( __( 'All fields marked with a * are required fields', 'event_espresso' ), '', 'grey-text' )) |
|
| 401 | + 'required_fields_note' => new EE_Form_Section_HTML(EEH_HTML::p(__('All fields marked with a * are required fields', 'event_espresso'), '', 'grey-text')) |
|
| 403 | 402 | ) |
| 404 | 403 | ) |
| 405 | 404 | ) |
@@ -426,28 +425,28 @@ discard block |
||
| 426 | 425 | array( |
| 427 | 426 | 'use_captcha' => new EE_Yes_No_Input( |
| 428 | 427 | array( |
| 429 | - 'html_label_text' => __( 'Use reCAPTCHA', 'event_espresso' ), |
|
| 428 | + 'html_label_text' => __('Use reCAPTCHA', 'event_espresso'), |
|
| 430 | 429 | 'html_help_text' => sprintf( |
| 431 | - __( 'reCAPTCHA is a free service that protects your website from spam and abuse. It employs advanced risk analysis technology to separate humans from abusive actors. Sign up %1$shere%2$s to receive your Public and Private keys.', 'event_espresso' ), |
|
| 430 | + __('reCAPTCHA is a free service that protects your website from spam and abuse. It employs advanced risk analysis technology to separate humans from abusive actors. Sign up %1$shere%2$s to receive your Public and Private keys.', 'event_espresso'), |
|
| 432 | 431 | '<a href="https://www.google.com/recaptcha/intro/index.html">', |
| 433 | 432 | '</a>' |
| 434 | 433 | ), |
| 435 | - 'default' => isset( EE_Registry::instance()->CFG->registration->use_captcha ) ? EE_Registry::instance()->CFG->registration->use_captcha : FALSE, |
|
| 434 | + 'default' => isset(EE_Registry::instance()->CFG->registration->use_captcha) ? EE_Registry::instance()->CFG->registration->use_captcha : FALSE, |
|
| 436 | 435 | 'display_html_label_text' => FALSE |
| 437 | 436 | ) |
| 438 | 437 | ), |
| 439 | 438 | 'recaptcha_publickey' => new EE_Text_Input( |
| 440 | 439 | array( |
| 441 | - 'html_label_text' => __( 'Site Key', 'event_espresso' ), |
|
| 442 | - 'html_help_text' => __( 'The site key is used to display the widget on your site.', 'event_espresso' ), |
|
| 443 | - 'default' => isset( EE_Registry::instance()->CFG->registration->recaptcha_publickey ) ? stripslashes( EE_Registry::instance()->CFG->registration->recaptcha_publickey ) : '' |
|
| 440 | + 'html_label_text' => __('Site Key', 'event_espresso'), |
|
| 441 | + 'html_help_text' => __('The site key is used to display the widget on your site.', 'event_espresso'), |
|
| 442 | + 'default' => isset(EE_Registry::instance()->CFG->registration->recaptcha_publickey) ? stripslashes(EE_Registry::instance()->CFG->registration->recaptcha_publickey) : '' |
|
| 444 | 443 | ) |
| 445 | 444 | ), |
| 446 | 445 | 'recaptcha_privatekey' => new EE_Text_Input( |
| 447 | 446 | array( |
| 448 | - 'html_label_text' => __( 'Secret Key', 'event_espresso' ), |
|
| 449 | - 'html_help_text' => __( 'The secret key authorizes communication between your application backend and the reCAPTCHA server to verify the user\'s response. The secret key needs to be kept safe for security purposes.', 'event_espresso' ), |
|
| 450 | - 'default' => isset( EE_Registry::instance()->CFG->registration->recaptcha_privatekey ) ? stripslashes( EE_Registry::instance()->CFG->registration->recaptcha_privatekey ) : '' |
|
| 447 | + 'html_label_text' => __('Secret Key', 'event_espresso'), |
|
| 448 | + 'html_help_text' => __('The secret key authorizes communication between your application backend and the reCAPTCHA server to verify the user\'s response. The secret key needs to be kept safe for security purposes.', 'event_espresso'), |
|
| 449 | + 'default' => isset(EE_Registry::instance()->CFG->registration->recaptcha_privatekey) ? stripslashes(EE_Registry::instance()->CFG->registration->recaptcha_privatekey) : '' |
|
| 451 | 450 | ) |
| 452 | 451 | ) |
| 453 | 452 | ) |
@@ -479,81 +478,81 @@ discard block |
||
| 479 | 478 | array( |
| 480 | 479 | 'recaptcha_theme' => new EE_Radio_Button_Input( |
| 481 | 480 | array( |
| 482 | - 'light' => __( 'Light', 'event_espresso' ), |
|
| 483 | - 'dark' => __( 'Dark', 'event_espresso' ) |
|
| 481 | + 'light' => __('Light', 'event_espresso'), |
|
| 482 | + 'dark' => __('Dark', 'event_espresso') |
|
| 484 | 483 | ), |
| 485 | 484 | array( |
| 486 | - 'html_label_text' => __( 'Theme', 'event_espresso' ), |
|
| 487 | - 'html_help_text' => __( 'The color theme of the widget.', 'event_espresso' ), |
|
| 488 | - 'default' => isset( EE_Registry::instance()->CFG->registration->recaptcha_theme ) ? EE_Registry::instance()->CFG->registration->recaptcha_theme : 'light', |
|
| 485 | + 'html_label_text' => __('Theme', 'event_espresso'), |
|
| 486 | + 'html_help_text' => __('The color theme of the widget.', 'event_espresso'), |
|
| 487 | + 'default' => isset(EE_Registry::instance()->CFG->registration->recaptcha_theme) ? EE_Registry::instance()->CFG->registration->recaptcha_theme : 'light', |
|
| 489 | 488 | 'display_html_label_text' => FALSE |
| 490 | 489 | ) |
| 491 | 490 | ), |
| 492 | 491 | 'recaptcha_type' => new EE_Radio_Button_Input( |
| 493 | 492 | array( |
| 494 | - 'image' => __( 'Image', 'event_espresso' ), |
|
| 495 | - 'audio' => __( 'Audio', 'event_espresso' ) |
|
| 493 | + 'image' => __('Image', 'event_espresso'), |
|
| 494 | + 'audio' => __('Audio', 'event_espresso') |
|
| 496 | 495 | ), |
| 497 | 496 | array( |
| 498 | - 'html_label_text' => __( 'Type', 'event_espresso' ), |
|
| 499 | - 'html_help_text' => __( 'The type of CAPTCHA to serve.', 'event_espresso' ), |
|
| 500 | - 'default' => isset( EE_Registry::instance()->CFG->registration->recaptcha_type ) ? EE_Registry::instance()->CFG->registration->recaptcha_type : 'image', |
|
| 497 | + 'html_label_text' => __('Type', 'event_espresso'), |
|
| 498 | + 'html_help_text' => __('The type of CAPTCHA to serve.', 'event_espresso'), |
|
| 499 | + 'default' => isset(EE_Registry::instance()->CFG->registration->recaptcha_type) ? EE_Registry::instance()->CFG->registration->recaptcha_type : 'image', |
|
| 501 | 500 | 'display_html_label_text' =>FALSE |
| 502 | 501 | ) |
| 503 | 502 | ), |
| 504 | 503 | 'recaptcha_language' => new EE_Select_Input( |
| 505 | 504 | array( |
| 506 | - 'ar' => __( 'Arabic', 'event_espresso' ), |
|
| 507 | - 'bg' => __( 'Bulgarian', 'event_espresso' ), |
|
| 508 | - 'ca' => __( 'Catalan', 'event_espresso' ), |
|
| 509 | - 'zh-CN' => __( 'Chinese (Simplified)', 'event_espresso' ), |
|
| 510 | - 'zh-TW' => __( 'Chinese (Traditional) ', 'event_espresso' ), |
|
| 511 | - 'hr' => __( 'Croatian', 'event_espresso' ), |
|
| 512 | - 'cs' => __( 'Czech', 'event_espresso' ), |
|
| 513 | - 'da' => __( 'Danish', 'event_espresso' ), |
|
| 514 | - 'nl' => __( 'Dutch', 'event_espresso' ), |
|
| 515 | - 'en-GB' => __( 'English (UK)', 'event_espresso' ), |
|
| 516 | - 'en' => __( 'English (US)', 'event_espresso' ), |
|
| 517 | - 'fil' => __( 'Filipino', 'event_espresso' ), |
|
| 518 | - 'fi' => __( 'Finnish', 'event_espresso' ), |
|
| 519 | - 'fr' => __( 'French', 'event_espresso' ), |
|
| 520 | - 'fr-CA' => __( 'French (Canadian)', 'event_espresso' ), |
|
| 521 | - 'de' => __( 'German', 'event_espresso' ), |
|
| 522 | - 'de-AT' => __( 'German (Austria)', 'event_espresso' ), |
|
| 523 | - 'de-CH' => __( 'German (Switzerland)', 'event_espresso' ), |
|
| 524 | - 'el' => __( 'Greek', 'event_espresso' ), |
|
| 525 | - 'iw' => __( 'Hebrew', 'event_espresso' ), |
|
| 526 | - 'hi' => __( 'Hindi', 'event_espresso' ), |
|
| 527 | - 'hu' => __( 'Hungarian', 'event_espresso' ), |
|
| 528 | - 'id' => __( 'Indonesian', 'event_espresso' ), |
|
| 529 | - 'it' => __( 'Italian', 'event_espresso' ), |
|
| 530 | - 'ja' => __( 'Japanese', 'event_espresso' ), |
|
| 531 | - 'ko' => __( 'Korean', 'event_espresso' ), |
|
| 532 | - 'lv' => __( 'Latvian', 'event_espresso' ), |
|
| 533 | - 'lt' => __( 'Lithuanian', 'event_espresso' ), |
|
| 534 | - 'no' => __( 'Norwegian', 'event_espresso' ), |
|
| 535 | - 'fa' => __( 'Persian', 'event_espresso' ), |
|
| 536 | - 'pl' => __( 'Polish', 'event_espresso' ), |
|
| 537 | - 'pt' => __( 'Portuguese', 'event_espresso' ), |
|
| 538 | - 'pt-BR' => __( 'Portuguese (Brazil)', 'event_espresso' ), |
|
| 539 | - 'pt-PT' => __( 'Portuguese (Portugal)', 'event_espresso' ), |
|
| 540 | - 'ro' => __( 'Romanian', 'event_espresso' ), |
|
| 541 | - 'ru' => __( 'Russian', 'event_espresso' ), |
|
| 542 | - 'sr' => __( 'Serbian', 'event_espresso' ), |
|
| 543 | - 'sk' => __( 'Slovak', 'event_espresso' ), |
|
| 544 | - 'sl' => __( 'Slovenian', 'event_espresso' ), |
|
| 545 | - 'es' => __( 'Spanish', 'event_espresso' ), |
|
| 546 | - 'es-419' => __( 'Spanish (Latin America)', 'event_espresso' ), |
|
| 547 | - 'sv' => __( 'Swedish', 'event_espresso' ), |
|
| 548 | - 'th' => __( 'Thai', 'event_espresso' ), |
|
| 549 | - 'tr' => __( 'Turkish', 'event_espresso' ), |
|
| 550 | - 'uk' => __( 'Ukrainian', 'event_espresso' ), |
|
| 551 | - 'vi' => __( 'Vietnamese', 'event_espresso') |
|
| 505 | + 'ar' => __('Arabic', 'event_espresso'), |
|
| 506 | + 'bg' => __('Bulgarian', 'event_espresso'), |
|
| 507 | + 'ca' => __('Catalan', 'event_espresso'), |
|
| 508 | + 'zh-CN' => __('Chinese (Simplified)', 'event_espresso'), |
|
| 509 | + 'zh-TW' => __('Chinese (Traditional) ', 'event_espresso'), |
|
| 510 | + 'hr' => __('Croatian', 'event_espresso'), |
|
| 511 | + 'cs' => __('Czech', 'event_espresso'), |
|
| 512 | + 'da' => __('Danish', 'event_espresso'), |
|
| 513 | + 'nl' => __('Dutch', 'event_espresso'), |
|
| 514 | + 'en-GB' => __('English (UK)', 'event_espresso'), |
|
| 515 | + 'en' => __('English (US)', 'event_espresso'), |
|
| 516 | + 'fil' => __('Filipino', 'event_espresso'), |
|
| 517 | + 'fi' => __('Finnish', 'event_espresso'), |
|
| 518 | + 'fr' => __('French', 'event_espresso'), |
|
| 519 | + 'fr-CA' => __('French (Canadian)', 'event_espresso'), |
|
| 520 | + 'de' => __('German', 'event_espresso'), |
|
| 521 | + 'de-AT' => __('German (Austria)', 'event_espresso'), |
|
| 522 | + 'de-CH' => __('German (Switzerland)', 'event_espresso'), |
|
| 523 | + 'el' => __('Greek', 'event_espresso'), |
|
| 524 | + 'iw' => __('Hebrew', 'event_espresso'), |
|
| 525 | + 'hi' => __('Hindi', 'event_espresso'), |
|
| 526 | + 'hu' => __('Hungarian', 'event_espresso'), |
|
| 527 | + 'id' => __('Indonesian', 'event_espresso'), |
|
| 528 | + 'it' => __('Italian', 'event_espresso'), |
|
| 529 | + 'ja' => __('Japanese', 'event_espresso'), |
|
| 530 | + 'ko' => __('Korean', 'event_espresso'), |
|
| 531 | + 'lv' => __('Latvian', 'event_espresso'), |
|
| 532 | + 'lt' => __('Lithuanian', 'event_espresso'), |
|
| 533 | + 'no' => __('Norwegian', 'event_espresso'), |
|
| 534 | + 'fa' => __('Persian', 'event_espresso'), |
|
| 535 | + 'pl' => __('Polish', 'event_espresso'), |
|
| 536 | + 'pt' => __('Portuguese', 'event_espresso'), |
|
| 537 | + 'pt-BR' => __('Portuguese (Brazil)', 'event_espresso'), |
|
| 538 | + 'pt-PT' => __('Portuguese (Portugal)', 'event_espresso'), |
|
| 539 | + 'ro' => __('Romanian', 'event_espresso'), |
|
| 540 | + 'ru' => __('Russian', 'event_espresso'), |
|
| 541 | + 'sr' => __('Serbian', 'event_espresso'), |
|
| 542 | + 'sk' => __('Slovak', 'event_espresso'), |
|
| 543 | + 'sl' => __('Slovenian', 'event_espresso'), |
|
| 544 | + 'es' => __('Spanish', 'event_espresso'), |
|
| 545 | + 'es-419' => __('Spanish (Latin America)', 'event_espresso'), |
|
| 546 | + 'sv' => __('Swedish', 'event_espresso'), |
|
| 547 | + 'th' => __('Thai', 'event_espresso'), |
|
| 548 | + 'tr' => __('Turkish', 'event_espresso'), |
|
| 549 | + 'uk' => __('Ukrainian', 'event_espresso'), |
|
| 550 | + 'vi' => __('Vietnamese', 'event_espresso') |
|
| 552 | 551 | ), |
| 553 | 552 | array( |
| 554 | - 'html_label_text' => __( 'Language', 'event_espresso' ), |
|
| 555 | - 'html_help_text' => __( 'Forces the widget to render in a specific language.', 'event_espresso' ), |
|
| 556 | - 'default' => isset( EE_Registry::instance()->CFG->registration->recaptcha_language ) ? EE_Registry::instance()->CFG->registration->recaptcha_language : 'en' |
|
| 553 | + 'html_label_text' => __('Language', 'event_espresso'), |
|
| 554 | + 'html_help_text' => __('Forces the widget to render in a specific language.', 'event_espresso'), |
|
| 555 | + 'default' => isset(EE_Registry::instance()->CFG->registration->recaptcha_language) ? EE_Registry::instance()->CFG->registration->recaptcha_language : 'en' |
|
| 557 | 556 | ) |
| 558 | 557 | ) |
| 559 | 558 | ) |
@@ -601,25 +600,25 @@ discard block |
||
| 601 | 600 | * @param EE_Registration_Config $EE_Registration_Config |
| 602 | 601 | * @return array |
| 603 | 602 | */ |
| 604 | - public static function update_admin_settings( EE_Registration_Config $EE_Registration_Config ) { |
|
| 603 | + public static function update_admin_settings(EE_Registration_Config $EE_Registration_Config) { |
|
| 605 | 604 | try { |
| 606 | 605 | $recaptcha_settings_form = EED_Recaptcha::_recaptcha_settings_form(); |
| 607 | 606 | // if not displaying a form, then check for form submission |
| 608 | - if ( $recaptcha_settings_form->was_submitted() ) { |
|
| 607 | + if ($recaptcha_settings_form->was_submitted()) { |
|
| 609 | 608 | // capture form data |
| 610 | 609 | $recaptcha_settings_form->receive_form_submission(); |
| 611 | 610 | // validate form data |
| 612 | - if ( $recaptcha_settings_form->is_valid() ) { |
|
| 611 | + if ($recaptcha_settings_form->is_valid()) { |
|
| 613 | 612 | // grab validated data from form |
| 614 | 613 | $valid_data = $recaptcha_settings_form->valid_data(); |
| 615 | 614 | // user proofing recaptcha: If Use reCAPTCHA is set to yes but we dont' have site or secret keys then set Use reCAPTCHA to FALSE and give error message. |
| 616 | 615 | if ( |
| 617 | - apply_filters( 'FHEE__Extend_Registration_Form_Admin_Page__check_for_recaptcha_keys', TRUE, $EE_Registration_Config ) |
|
| 616 | + apply_filters('FHEE__Extend_Registration_Form_Admin_Page__check_for_recaptcha_keys', TRUE, $EE_Registration_Config) |
|
| 618 | 617 | && $valid_data['main_settings']['use_captcha'] |
| 619 | - && ( ! $EE_Registration_Config->use_captcha && ( empty( $valid_data['main_settings']['recaptcha_publickey'] ) || empty( $valid_data['main_settings']['recaptcha_privatekey'] ))) |
|
| 618 | + && ( ! $EE_Registration_Config->use_captcha && (empty($valid_data['main_settings']['recaptcha_publickey']) || empty($valid_data['main_settings']['recaptcha_privatekey']))) |
|
| 620 | 619 | ) { |
| 621 | 620 | $valid_data['main_settings']['use_captcha'] = FALSE; |
| 622 | - EE_Error::add_error( __('The use reCAPTCHA setting has been reset to "no". In order to enable the reCAPTCHA service, you must enter a Site Key and Secret Key.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 621 | + EE_Error::add_error(__('The use reCAPTCHA setting has been reset to "no". In order to enable the reCAPTCHA service, you must enter a Site Key and Secret Key.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
| 623 | 622 | } |
| 624 | 623 | $EE_Registration_Config->use_captcha = $valid_data['main_settings']['use_captcha']; |
| 625 | 624 | $EE_Registration_Config->recaptcha_publickey = $valid_data['main_settings']['recaptcha_publickey']; |
@@ -628,12 +627,12 @@ discard block |
||
| 628 | 627 | $EE_Registration_Config->recaptcha_theme = $valid_data['appearance_settings']['recaptcha_theme']; |
| 629 | 628 | $EE_Registration_Config->recaptcha_language = $valid_data['appearance_settings']['recaptcha_language']; |
| 630 | 629 | } else { |
| 631 | - if ( $recaptcha_settings_form->submission_error_message() != '' ) { |
|
| 632 | - EE_Error::add_error( $recaptcha_settings_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 630 | + if ($recaptcha_settings_form->submission_error_message() != '') { |
|
| 631 | + EE_Error::add_error($recaptcha_settings_form->submission_error_message(), __FILE__, __FUNCTION__, __LINE__); |
|
| 633 | 632 | } |
| 634 | 633 | } |
| 635 | 634 | } |
| 636 | - } catch( EE_Error $e ) { |
|
| 635 | + } catch (EE_Error $e) { |
|
| 637 | 636 | $e->get_error(); |
| 638 | 637 | } |
| 639 | 638 | |
@@ -15,30 +15,30 @@ discard block |
||
| 15 | 15 | abstract class IframeEmbedButton { |
| 16 | 16 | |
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * @var string $iframe_name |
|
| 20 | - */ |
|
| 21 | - private $iframe_name; |
|
| 18 | + /** |
|
| 19 | + * @var string $iframe_name |
|
| 20 | + */ |
|
| 21 | + private $iframe_name; |
|
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * @var string $route_name |
|
| 25 | - */ |
|
| 26 | - private $route_name; |
|
| 23 | + /** |
|
| 24 | + * @var string $route_name |
|
| 25 | + */ |
|
| 26 | + private $route_name; |
|
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * @var string $title |
|
| 30 | - */ |
|
| 31 | - private $title; |
|
| 28 | + /** |
|
| 29 | + * @var string $title |
|
| 30 | + */ |
|
| 31 | + private $title; |
|
| 32 | 32 | |
| 33 | - /** |
|
| 34 | - * @var string $slug |
|
| 35 | - */ |
|
| 36 | - private $slug; |
|
| 33 | + /** |
|
| 34 | + * @var string $slug |
|
| 35 | + */ |
|
| 36 | + private $slug; |
|
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * @var boolean $append_filterable_content |
|
| 40 | - */ |
|
| 41 | - private $append_filterable_content; |
|
| 38 | + /** |
|
| 39 | + * @var boolean $append_filterable_content |
|
| 40 | + */ |
|
| 41 | + private $append_filterable_content; |
|
| 42 | 42 | |
| 43 | 43 | |
| 44 | 44 | |
@@ -60,65 +60,65 @@ discard block |
||
| 60 | 60 | |
| 61 | 61 | |
| 62 | 62 | /** |
| 63 | - * Adds an iframe embed code button to the Event editor. |
|
| 64 | - */ |
|
| 65 | - public function addEventEditorIframeEmbedButtonFilter() |
|
| 66 | - { |
|
| 67 | - // add button for iframe code to event editor. |
|
| 68 | - add_filter( |
|
| 69 | - 'get_sample_permalink_html', |
|
| 70 | - array($this, 'appendIframeEmbedButtonToSamplePermalinkHtml'), |
|
| 71 | - 10, |
|
| 72 | - 2 |
|
| 73 | - ); |
|
| 74 | - add_action( |
|
| 75 | - 'admin_enqueue_scripts', |
|
| 76 | - array($this, 'embedButtonAssets'), |
|
| 77 | - 10 |
|
| 78 | - ); |
|
| 79 | - } |
|
| 80 | - |
|
| 81 | - |
|
| 82 | - |
|
| 83 | - /** |
|
| 84 | - * @param $permalink_string |
|
| 85 | - * @param $id |
|
| 86 | - * @return string |
|
| 87 | - */ |
|
| 88 | - public function appendIframeEmbedButtonToSamplePermalinkHtml( $permalink_string, $id ) { |
|
| 89 | - return $this->eventEditorIframeEmbedButton( |
|
| 90 | - $permalink_string, |
|
| 91 | - $id |
|
| 92 | - ); |
|
| 93 | - } |
|
| 94 | - |
|
| 95 | - |
|
| 96 | - |
|
| 97 | - /** |
|
| 98 | - * iframe embed code button to the Event editor. |
|
| 99 | - * |
|
| 100 | - * @param string $permalink_string |
|
| 101 | - * @param int $id |
|
| 102 | - * @return string |
|
| 103 | - */ |
|
| 104 | - public function eventEditorIframeEmbedButton( |
|
| 105 | - $permalink_string, |
|
| 106 | - $id |
|
| 107 | - ) { |
|
| 108 | - //make sure this is ONLY when editing and the event id has been set. |
|
| 109 | - if ( ! empty($id)) { |
|
| 110 | - $post = get_post($id); |
|
| 111 | - //if NOT event then let's get out. |
|
| 112 | - if ($post->post_type !== 'espresso_events') { |
|
| 113 | - return $permalink_string; |
|
| 114 | - } |
|
| 115 | - $permalink_string .= $this->embedButtonHtml( |
|
| 116 | - array($this->slug => $id), |
|
| 117 | - 'button-small' |
|
| 118 | - ); |
|
| 119 | - } |
|
| 120 | - return $permalink_string; |
|
| 121 | - } |
|
| 63 | + * Adds an iframe embed code button to the Event editor. |
|
| 64 | + */ |
|
| 65 | + public function addEventEditorIframeEmbedButtonFilter() |
|
| 66 | + { |
|
| 67 | + // add button for iframe code to event editor. |
|
| 68 | + add_filter( |
|
| 69 | + 'get_sample_permalink_html', |
|
| 70 | + array($this, 'appendIframeEmbedButtonToSamplePermalinkHtml'), |
|
| 71 | + 10, |
|
| 72 | + 2 |
|
| 73 | + ); |
|
| 74 | + add_action( |
|
| 75 | + 'admin_enqueue_scripts', |
|
| 76 | + array($this, 'embedButtonAssets'), |
|
| 77 | + 10 |
|
| 78 | + ); |
|
| 79 | + } |
|
| 80 | + |
|
| 81 | + |
|
| 82 | + |
|
| 83 | + /** |
|
| 84 | + * @param $permalink_string |
|
| 85 | + * @param $id |
|
| 86 | + * @return string |
|
| 87 | + */ |
|
| 88 | + public function appendIframeEmbedButtonToSamplePermalinkHtml( $permalink_string, $id ) { |
|
| 89 | + return $this->eventEditorIframeEmbedButton( |
|
| 90 | + $permalink_string, |
|
| 91 | + $id |
|
| 92 | + ); |
|
| 93 | + } |
|
| 94 | + |
|
| 95 | + |
|
| 96 | + |
|
| 97 | + /** |
|
| 98 | + * iframe embed code button to the Event editor. |
|
| 99 | + * |
|
| 100 | + * @param string $permalink_string |
|
| 101 | + * @param int $id |
|
| 102 | + * @return string |
|
| 103 | + */ |
|
| 104 | + public function eventEditorIframeEmbedButton( |
|
| 105 | + $permalink_string, |
|
| 106 | + $id |
|
| 107 | + ) { |
|
| 108 | + //make sure this is ONLY when editing and the event id has been set. |
|
| 109 | + if ( ! empty($id)) { |
|
| 110 | + $post = get_post($id); |
|
| 111 | + //if NOT event then let's get out. |
|
| 112 | + if ($post->post_type !== 'espresso_events') { |
|
| 113 | + return $permalink_string; |
|
| 114 | + } |
|
| 115 | + $permalink_string .= $this->embedButtonHtml( |
|
| 116 | + array($this->slug => $id), |
|
| 117 | + 'button-small' |
|
| 118 | + ); |
|
| 119 | + } |
|
| 120 | + return $permalink_string; |
|
| 121 | + } |
|
| 122 | 122 | |
| 123 | 123 | |
| 124 | 124 | /** |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | * @param string $action name of the WP do_action() to hook into |
| 128 | 128 | */ |
| 129 | 129 | public function addActionIframeEmbedButton($action) { |
| 130 | - // add button for iframe code to event editor. |
|
| 130 | + // add button for iframe code to event editor. |
|
| 131 | 131 | add_action( |
| 132 | 132 | $action, |
| 133 | 133 | array($this, 'addActionIframeEmbedButtonCallback'), |
@@ -137,13 +137,13 @@ discard block |
||
| 137 | 137 | |
| 138 | 138 | |
| 139 | 139 | |
| 140 | - /** |
|
| 141 | - * @return void |
|
| 142 | - */ |
|
| 143 | - public function addActionIframeEmbedButtonCallback() |
|
| 144 | - { |
|
| 145 | - echo $this->embedButtonHtml(); |
|
| 146 | - } |
|
| 140 | + /** |
|
| 141 | + * @return void |
|
| 142 | + */ |
|
| 143 | + public function addActionIframeEmbedButtonCallback() |
|
| 144 | + { |
|
| 145 | + echo $this->embedButtonHtml(); |
|
| 146 | + } |
|
| 147 | 147 | |
| 148 | 148 | |
| 149 | 149 | |
@@ -155,8 +155,8 @@ discard block |
||
| 155 | 155 | * else if false, will add to the beginning of the content |
| 156 | 156 | */ |
| 157 | 157 | public function addFilterIframeEmbedButton($filter, $append = true) { |
| 158 | - $this->append_filterable_content = $append; |
|
| 159 | - // add button for iframe code to event editor. |
|
| 158 | + $this->append_filterable_content = $append; |
|
| 159 | + // add button for iframe code to event editor. |
|
| 160 | 160 | add_filter( |
| 161 | 161 | $filter, |
| 162 | 162 | array($this, 'addFilterIframeEmbedButtonCallback'), |
@@ -166,24 +166,24 @@ discard block |
||
| 166 | 166 | |
| 167 | 167 | |
| 168 | 168 | |
| 169 | - /** |
|
| 170 | - * @param array|string $filterable_content |
|
| 171 | - * @return array|string |
|
| 172 | - */ |
|
| 173 | - public function addFilterIframeEmbedButtonCallback($filterable_content) |
|
| 174 | - { |
|
| 175 | - $embedButtonHtml = $this->embedButtonHtml(); |
|
| 176 | - if (is_array($filterable_content)) { |
|
| 177 | - $filterable_content = $this->append_filterable_content |
|
| 178 | - ? $filterable_content + array($this->route_name => $embedButtonHtml) |
|
| 179 | - : array($this->route_name => $embedButtonHtml) + $filterable_content; |
|
| 180 | - } else { |
|
| 181 | - $filterable_content = $this->append_filterable_content |
|
| 182 | - ? $filterable_content . $embedButtonHtml |
|
| 183 | - : $embedButtonHtml . $filterable_content; |
|
| 184 | - } |
|
| 185 | - return $filterable_content; |
|
| 186 | - } |
|
| 169 | + /** |
|
| 170 | + * @param array|string $filterable_content |
|
| 171 | + * @return array|string |
|
| 172 | + */ |
|
| 173 | + public function addFilterIframeEmbedButtonCallback($filterable_content) |
|
| 174 | + { |
|
| 175 | + $embedButtonHtml = $this->embedButtonHtml(); |
|
| 176 | + if (is_array($filterable_content)) { |
|
| 177 | + $filterable_content = $this->append_filterable_content |
|
| 178 | + ? $filterable_content + array($this->route_name => $embedButtonHtml) |
|
| 179 | + : array($this->route_name => $embedButtonHtml) + $filterable_content; |
|
| 180 | + } else { |
|
| 181 | + $filterable_content = $this->append_filterable_content |
|
| 182 | + ? $filterable_content . $embedButtonHtml |
|
| 183 | + : $embedButtonHtml . $filterable_content; |
|
| 184 | + } |
|
| 185 | + return $filterable_content; |
|
| 186 | + } |
|
| 187 | 187 | |
| 188 | 188 | /** |
| 189 | 189 | * iframe_embed_html |
@@ -193,11 +193,11 @@ discard block |
||
| 193 | 193 | * @return string |
| 194 | 194 | */ |
| 195 | 195 | public function embedButtonHtml($query_args = array(), $button_class = '' ) { |
| 196 | - $query_args = array($this->route_name => 'iframe') + $query_args; |
|
| 197 | - $query_args = (array) apply_filters( |
|
| 198 | - 'FHEE__EventEspresso_core_libraries_iframe_display_IframeEmbedButton__embedButtonHtml__query_args', |
|
| 199 | - $query_args |
|
| 200 | - ); |
|
| 196 | + $query_args = array($this->route_name => 'iframe') + $query_args; |
|
| 197 | + $query_args = (array) apply_filters( |
|
| 198 | + 'FHEE__EventEspresso_core_libraries_iframe_display_IframeEmbedButton__embedButtonHtml__query_args', |
|
| 199 | + $query_args |
|
| 200 | + ); |
|
| 201 | 201 | // add this route to our localized vars |
| 202 | 202 | $iframe_module_routes = isset( \EE_Registry::$i18n_js_strings['iframe_module_routes'] ) |
| 203 | 203 | ? \EE_Registry::$i18n_js_strings['iframe_module_routes'] |
@@ -208,11 +208,11 @@ discard block |
||
| 208 | 208 | '#', |
| 209 | 209 | sprintf( esc_html__( 'Embed %1$s', 'event_espresso' ), $this->iframe_name ), |
| 210 | 210 | sprintf( |
| 211 | - esc_html__( |
|
| 211 | + esc_html__( |
|
| 212 | 212 | 'click here to generate code for embedding %1$s iframe into another site.', |
| 213 | 213 | 'event_espresso' |
| 214 | 214 | ), |
| 215 | - \EEH_Inflector::add_indefinite_article($this->iframe_name) |
|
| 215 | + \EEH_Inflector::add_indefinite_article($this->iframe_name) |
|
| 216 | 216 | ), |
| 217 | 217 | "{$this->route_name}-iframe-embed-trigger-js", |
| 218 | 218 | 'iframe-embed-trigger-js button ' . $button_class, |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | ) |
| 230 | 230 | ); |
| 231 | 231 | $iframe_embed_html .= \EEH_HTML::divx(); |
| 232 | - return $iframe_embed_html; |
|
| 232 | + return $iframe_embed_html; |
|
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | |
@@ -238,51 +238,51 @@ discard block |
||
| 238 | 238 | * enqueue iframe button js |
| 239 | 239 | */ |
| 240 | 240 | public function embedButtonAssets() { |
| 241 | - \EE_Registry::$i18n_js_strings['iframe_embed_title'] = esc_html__( |
|
| 242 | - 'copy and paste the following into any other site\'s content to display this event:', |
|
| 243 | - 'event_espresso' |
|
| 244 | - ); |
|
| 245 | - \EE_Registry::$i18n_js_strings['iframe_embed_close_msg'] = esc_html__( |
|
| 246 | - 'click anywhere outside of this window to close it.', |
|
| 247 | - 'event_espresso' |
|
| 248 | - ); |
|
| 249 | - wp_register_script( |
|
| 250 | - 'iframe_embed_button', |
|
| 251 | - plugin_dir_url( __FILE__ ) . 'iframe-embed-button.js', |
|
| 252 | - array( 'ee-dialog' ), |
|
| 253 | - EVENT_ESPRESSO_VERSION, |
|
| 254 | - true |
|
| 255 | - ); |
|
| 256 | - wp_enqueue_script( 'iframe_embed_button' ); |
|
| 241 | + \EE_Registry::$i18n_js_strings['iframe_embed_title'] = esc_html__( |
|
| 242 | + 'copy and paste the following into any other site\'s content to display this event:', |
|
| 243 | + 'event_espresso' |
|
| 244 | + ); |
|
| 245 | + \EE_Registry::$i18n_js_strings['iframe_embed_close_msg'] = esc_html__( |
|
| 246 | + 'click anywhere outside of this window to close it.', |
|
| 247 | + 'event_espresso' |
|
| 248 | + ); |
|
| 249 | + wp_register_script( |
|
| 250 | + 'iframe_embed_button', |
|
| 251 | + plugin_dir_url( __FILE__ ) . 'iframe-embed-button.js', |
|
| 252 | + array( 'ee-dialog' ), |
|
| 253 | + EVENT_ESPRESSO_VERSION, |
|
| 254 | + true |
|
| 255 | + ); |
|
| 256 | + wp_enqueue_script( 'iframe_embed_button' ); |
|
| 257 | 257 | } |
| 258 | 258 | |
| 259 | 259 | |
| 260 | 260 | |
| 261 | - /** |
|
| 262 | - * generates embed button sections for admin pages |
|
| 263 | - * |
|
| 264 | - * @param array $embed_buttons |
|
| 265 | - * @return string |
|
| 266 | - */ |
|
| 267 | - public function addIframeEmbedButtonsSection(array $embed_buttons) |
|
| 268 | - { |
|
| 269 | - $embed_buttons = (array)apply_filters( |
|
| 270 | - 'FHEE__EventEspresso_core_libraries_iframe_display_IframeEmbedButton__addIframeEmbedButtonsSection__embed_buttons', |
|
| 271 | - $embed_buttons |
|
| 272 | - ); |
|
| 273 | - // add button for iframe code to event editor. |
|
| 274 | - $html = \EEH_HTML::br(2); |
|
| 275 | - $html .= \EEH_HTML::h3(esc_html__('iFrame Embed Code', 'event_espresso')); |
|
| 276 | - $html .= \EEH_HTML::p( |
|
| 277 | - esc_html__( |
|
| 278 | - 'Click the following button(s) to generate iframe HTML that will allow you to embed your event content within the content of other websites.', |
|
| 279 | - 'event_espresso' |
|
| 280 | - ) |
|
| 281 | - ); |
|
| 282 | - $html .= ' ' . implode(' ', $embed_buttons) . ' '; |
|
| 283 | - $html .= \EEH_HTML::br(2); |
|
| 284 | - return $html; |
|
| 285 | - } |
|
| 261 | + /** |
|
| 262 | + * generates embed button sections for admin pages |
|
| 263 | + * |
|
| 264 | + * @param array $embed_buttons |
|
| 265 | + * @return string |
|
| 266 | + */ |
|
| 267 | + public function addIframeEmbedButtonsSection(array $embed_buttons) |
|
| 268 | + { |
|
| 269 | + $embed_buttons = (array)apply_filters( |
|
| 270 | + 'FHEE__EventEspresso_core_libraries_iframe_display_IframeEmbedButton__addIframeEmbedButtonsSection__embed_buttons', |
|
| 271 | + $embed_buttons |
|
| 272 | + ); |
|
| 273 | + // add button for iframe code to event editor. |
|
| 274 | + $html = \EEH_HTML::br(2); |
|
| 275 | + $html .= \EEH_HTML::h3(esc_html__('iFrame Embed Code', 'event_espresso')); |
|
| 276 | + $html .= \EEH_HTML::p( |
|
| 277 | + esc_html__( |
|
| 278 | + 'Click the following button(s) to generate iframe HTML that will allow you to embed your event content within the content of other websites.', |
|
| 279 | + 'event_espresso' |
|
| 280 | + ) |
|
| 281 | + ); |
|
| 282 | + $html .= ' ' . implode(' ', $embed_buttons) . ' '; |
|
| 283 | + $html .= \EEH_HTML::br(2); |
|
| 284 | + return $html; |
|
| 285 | + } |
|
| 286 | 286 | |
| 287 | 287 | |
| 288 | 288 | } |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | namespace EventEspresso\core\libraries\iframe_display; |
| 3 | 3 | |
| 4 | -defined( 'ABSPATH' ) || exit; |
|
| 4 | +defined('ABSPATH') || exit; |
|
| 5 | 5 | |
| 6 | 6 | |
| 7 | 7 | |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | * @param $id |
| 86 | 86 | * @return string |
| 87 | 87 | */ |
| 88 | - public function appendIframeEmbedButtonToSamplePermalinkHtml( $permalink_string, $id ) { |
|
| 88 | + public function appendIframeEmbedButtonToSamplePermalinkHtml($permalink_string, $id) { |
|
| 89 | 89 | return $this->eventEditorIframeEmbedButton( |
| 90 | 90 | $permalink_string, |
| 91 | 91 | $id |
@@ -179,8 +179,8 @@ discard block |
||
| 179 | 179 | : array($this->route_name => $embedButtonHtml) + $filterable_content; |
| 180 | 180 | } else { |
| 181 | 181 | $filterable_content = $this->append_filterable_content |
| 182 | - ? $filterable_content . $embedButtonHtml |
|
| 183 | - : $embedButtonHtml . $filterable_content; |
|
| 182 | + ? $filterable_content.$embedButtonHtml |
|
| 183 | + : $embedButtonHtml.$filterable_content; |
|
| 184 | 184 | } |
| 185 | 185 | return $filterable_content; |
| 186 | 186 | } |
@@ -192,21 +192,21 @@ discard block |
||
| 192 | 192 | * @param string $button_class |
| 193 | 193 | * @return string |
| 194 | 194 | */ |
| 195 | - public function embedButtonHtml($query_args = array(), $button_class = '' ) { |
|
| 195 | + public function embedButtonHtml($query_args = array(), $button_class = '') { |
|
| 196 | 196 | $query_args = array($this->route_name => 'iframe') + $query_args; |
| 197 | 197 | $query_args = (array) apply_filters( |
| 198 | 198 | 'FHEE__EventEspresso_core_libraries_iframe_display_IframeEmbedButton__embedButtonHtml__query_args', |
| 199 | 199 | $query_args |
| 200 | 200 | ); |
| 201 | 201 | // add this route to our localized vars |
| 202 | - $iframe_module_routes = isset( \EE_Registry::$i18n_js_strings['iframe_module_routes'] ) |
|
| 202 | + $iframe_module_routes = isset(\EE_Registry::$i18n_js_strings['iframe_module_routes']) |
|
| 203 | 203 | ? \EE_Registry::$i18n_js_strings['iframe_module_routes'] |
| 204 | 204 | : array(); |
| 205 | - $iframe_module_routes[ $this->route_name ] = $this->route_name; |
|
| 205 | + $iframe_module_routes[$this->route_name] = $this->route_name; |
|
| 206 | 206 | \EE_Registry::$i18n_js_strings['iframe_module_routes'] = $iframe_module_routes; |
| 207 | 207 | $iframe_embed_html = \EEH_HTML::link( |
| 208 | 208 | '#', |
| 209 | - sprintf( esc_html__( 'Embed %1$s', 'event_espresso' ), $this->iframe_name ), |
|
| 209 | + sprintf(esc_html__('Embed %1$s', 'event_espresso'), $this->iframe_name), |
|
| 210 | 210 | sprintf( |
| 211 | 211 | esc_html__( |
| 212 | 212 | 'click here to generate code for embedding %1$s iframe into another site.', |
@@ -215,14 +215,14 @@ discard block |
||
| 215 | 215 | \EEH_Inflector::add_indefinite_article($this->iframe_name) |
| 216 | 216 | ), |
| 217 | 217 | "{$this->route_name}-iframe-embed-trigger-js", |
| 218 | - 'iframe-embed-trigger-js button ' . $button_class, |
|
| 218 | + 'iframe-embed-trigger-js button '.$button_class, |
|
| 219 | 219 | '', |
| 220 | - ' data-iframe_embed_button="#' . $this->route_name . '-iframe-js" tabindex="-1"' |
|
| 220 | + ' data-iframe_embed_button="#'.$this->route_name.'-iframe-js" tabindex="-1"' |
|
| 221 | 221 | ); |
| 222 | - $iframe_embed_html .= \EEH_HTML::div( '', "{$this->route_name}-iframe-js", 'iframe-embed-wrapper-js', 'display:none;' ); |
|
| 222 | + $iframe_embed_html .= \EEH_HTML::div('', "{$this->route_name}-iframe-js", 'iframe-embed-wrapper-js', 'display:none;'); |
|
| 223 | 223 | $iframe_embed_html .= esc_html( |
| 224 | 224 | \EEH_HTML::div( |
| 225 | - '<iframe src="' . add_query_arg( $query_args, site_url() ) . '" width="100%" height="100%"></iframe>', |
|
| 225 | + '<iframe src="'.add_query_arg($query_args, site_url()).'" width="100%" height="100%"></iframe>', |
|
| 226 | 226 | '', |
| 227 | 227 | '', |
| 228 | 228 | 'width:100%; height: 500px;' |
@@ -248,12 +248,12 @@ discard block |
||
| 248 | 248 | ); |
| 249 | 249 | wp_register_script( |
| 250 | 250 | 'iframe_embed_button', |
| 251 | - plugin_dir_url( __FILE__ ) . 'iframe-embed-button.js', |
|
| 252 | - array( 'ee-dialog' ), |
|
| 251 | + plugin_dir_url(__FILE__).'iframe-embed-button.js', |
|
| 252 | + array('ee-dialog'), |
|
| 253 | 253 | EVENT_ESPRESSO_VERSION, |
| 254 | 254 | true |
| 255 | 255 | ); |
| 256 | - wp_enqueue_script( 'iframe_embed_button' ); |
|
| 256 | + wp_enqueue_script('iframe_embed_button'); |
|
| 257 | 257 | } |
| 258 | 258 | |
| 259 | 259 | |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | */ |
| 267 | 267 | public function addIframeEmbedButtonsSection(array $embed_buttons) |
| 268 | 268 | { |
| 269 | - $embed_buttons = (array)apply_filters( |
|
| 269 | + $embed_buttons = (array) apply_filters( |
|
| 270 | 270 | 'FHEE__EventEspresso_core_libraries_iframe_display_IframeEmbedButton__addIframeEmbedButtonsSection__embed_buttons', |
| 271 | 271 | $embed_buttons |
| 272 | 272 | ); |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | 'event_espresso' |
| 280 | 280 | ) |
| 281 | 281 | ); |
| 282 | - $html .= ' ' . implode(' ', $embed_buttons) . ' '; |
|
| 282 | + $html .= ' '.implode(' ', $embed_buttons).' '; |
|
| 283 | 283 | $html .= \EEH_HTML::br(2); |
| 284 | 284 | return $html; |
| 285 | 285 | } |
@@ -30,16 +30,16 @@ |
||
| 30 | 30 | |
| 31 | 31 | |
| 32 | 32 | |
| 33 | - /** |
|
| 34 | - * Adds an iframe embed code button to the Event editor. |
|
| 35 | - * return string |
|
| 36 | - */ |
|
| 37 | - public function addEventListIframeEmbedButtonSection() |
|
| 38 | - { |
|
| 39 | - return $this->addIframeEmbedButtonsSection( |
|
| 40 | - array( 'event_list' => $this->embedButtonHtml() ) |
|
| 41 | - ); |
|
| 42 | - } |
|
| 33 | + /** |
|
| 34 | + * Adds an iframe embed code button to the Event editor. |
|
| 35 | + * return string |
|
| 36 | + */ |
|
| 37 | + public function addEventListIframeEmbedButtonSection() |
|
| 38 | + { |
|
| 39 | + return $this->addIframeEmbedButtonsSection( |
|
| 40 | + array( 'event_list' => $this->embedButtonHtml() ) |
|
| 41 | + ); |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | 44 | |
| 45 | 45 | |
@@ -20,10 +20,10 @@ discard block |
||
| 20 | 20 | */ |
| 21 | 21 | public function __construct() { |
| 22 | 22 | parent::__construct( |
| 23 | - esc_html__( 'Event List', 'event_espresso' ), |
|
| 24 | - esc_html__( 'event_list', 'event_espresso' ), |
|
| 25 | - esc_html__( 'Event', 'event_espresso' ), |
|
| 26 | - esc_html__( 'event', 'event_espresso' ) |
|
| 23 | + esc_html__('Event List', 'event_espresso'), |
|
| 24 | + esc_html__('event_list', 'event_espresso'), |
|
| 25 | + esc_html__('Event', 'event_espresso'), |
|
| 26 | + esc_html__('event', 'event_espresso') |
|
| 27 | 27 | ); |
| 28 | 28 | } |
| 29 | 29 | |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | public function addEventListIframeEmbedButtonSection() |
| 38 | 38 | { |
| 39 | 39 | return $this->addIframeEmbedButtonsSection( |
| 40 | - array( 'event_list' => $this->embedButtonHtml() ) |
|
| 40 | + array('event_list' => $this->embedButtonHtml()) |
|
| 41 | 41 | ); |
| 42 | 42 | } |
| 43 | 43 | |
@@ -2,7 +2,7 @@ discard block |
||
| 2 | 2 | namespace EventEspresso\core\libraries\iframe_display; |
| 3 | 3 | |
| 4 | 4 | if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
| 5 | - exit('No direct script access allowed'); |
|
| 5 | + exit('No direct script access allowed'); |
|
| 6 | 6 | } |
| 7 | 7 | |
| 8 | 8 | |
@@ -18,278 +18,278 @@ discard block |
||
| 18 | 18 | class Iframe |
| 19 | 19 | { |
| 20 | 20 | |
| 21 | - /* |
|
| 21 | + /* |
|
| 22 | 22 | * HTML for notices and ajax gif |
| 23 | 23 | * @var string $title |
| 24 | 24 | */ |
| 25 | - protected $title = ''; |
|
| 25 | + protected $title = ''; |
|
| 26 | 26 | |
| 27 | - /* |
|
| 27 | + /* |
|
| 28 | 28 | * HTML for the content being displayed |
| 29 | 29 | * @var string $content |
| 30 | 30 | */ |
| 31 | - protected $content = ''; |
|
| 31 | + protected $content = ''; |
|
| 32 | 32 | |
| 33 | - /* |
|
| 33 | + /* |
|
| 34 | 34 | * whether or not to call wp_head() and wp_footer() |
| 35 | 35 | * @var boolean $enqueue_wp_assets |
| 36 | 36 | */ |
| 37 | - protected $enqueue_wp_assets = false; |
|
| 37 | + protected $enqueue_wp_assets = false; |
|
| 38 | 38 | |
| 39 | - /* |
|
| 39 | + /* |
|
| 40 | 40 | * an array of CSS URLs |
| 41 | 41 | * @var array $css |
| 42 | 42 | */ |
| 43 | - protected $css = array(); |
|
| 43 | + protected $css = array(); |
|
| 44 | 44 | |
| 45 | - /* |
|
| 45 | + /* |
|
| 46 | 46 | * an array of JS URLs to be set in the HTML header. |
| 47 | 47 | * @var array $header_js |
| 48 | 48 | */ |
| 49 | - protected $header_js = array(); |
|
| 49 | + protected $header_js = array(); |
|
| 50 | 50 | |
| 51 | - /* |
|
| 51 | + /* |
|
| 52 | 52 | * an array of JS URLs to be displayed before the HTML </body> tag |
| 53 | 53 | * @var array $footer_js |
| 54 | 54 | */ |
| 55 | - protected $footer_js = array(); |
|
| 55 | + protected $footer_js = array(); |
|
| 56 | 56 | |
| 57 | - /* |
|
| 57 | + /* |
|
| 58 | 58 | * an array of JSON vars to be set in the HTML header. |
| 59 | 59 | * @var array $localized_vars |
| 60 | 60 | */ |
| 61 | - protected $localized_vars = array(); |
|
| 62 | - |
|
| 63 | - |
|
| 64 | - |
|
| 65 | - /** |
|
| 66 | - * Iframe constructor |
|
| 67 | - * |
|
| 68 | - * @param string $title |
|
| 69 | - * @param string $content |
|
| 70 | - * @throws \EE_Error |
|
| 71 | - */ |
|
| 72 | - public function __construct($title, $content) |
|
| 73 | - { |
|
| 74 | - global $wp_version; |
|
| 75 | - if ( ! defined('EE_IFRAME_DIR_URL')) { |
|
| 76 | - define('EE_IFRAME_DIR_URL', plugin_dir_url(__FILE__)); |
|
| 77 | - } |
|
| 78 | - $this->setContent($content); |
|
| 79 | - $this->setTitle($title); |
|
| 80 | - $this->addStylesheets( |
|
| 81 | - apply_filters( |
|
| 82 | - 'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__construct__default_css', |
|
| 83 | - array( |
|
| 84 | - 'dashicons' => includes_url('css/dashicons.min.css?ver=' . $wp_version), |
|
| 85 | - 'espresso_default' => EE_GLOBAL_ASSETS_URL |
|
| 86 | - . 'css/espresso_default.css?ver=' |
|
| 87 | - . EVENT_ESPRESSO_VERSION, |
|
| 88 | - ) |
|
| 89 | - ) |
|
| 90 | - ); |
|
| 91 | - $this->addScripts( |
|
| 92 | - apply_filters( |
|
| 93 | - 'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__construct__default_js', |
|
| 94 | - array( |
|
| 95 | - 'jquery' => includes_url('js/jquery/jquery.js?ver=' . $wp_version), |
|
| 96 | - 'espresso_core' => EE_GLOBAL_ASSETS_URL |
|
| 97 | - . 'scripts/espresso_core.js?ver=' |
|
| 98 | - . EVENT_ESPRESSO_VERSION, |
|
| 99 | - ) |
|
| 100 | - ) |
|
| 101 | - ); |
|
| 102 | - } |
|
| 103 | - |
|
| 104 | - |
|
| 105 | - |
|
| 106 | - /** |
|
| 107 | - * @param string $title |
|
| 108 | - * @throws \EE_Error |
|
| 109 | - */ |
|
| 110 | - public function setTitle($title) |
|
| 111 | - { |
|
| 112 | - if (empty($title)) { |
|
| 113 | - throw new \EE_Error( |
|
| 114 | - esc_html__('You must provide a page title in order to create an iframe.', 'event_espresso') |
|
| 115 | - ); |
|
| 116 | - } |
|
| 117 | - $this->title = $title; |
|
| 118 | - } |
|
| 119 | - |
|
| 120 | - |
|
| 121 | - |
|
| 122 | - /** |
|
| 123 | - * @param string $content |
|
| 124 | - * @throws \EE_Error |
|
| 125 | - */ |
|
| 126 | - public function setContent($content) |
|
| 127 | - { |
|
| 128 | - if (empty($content)) { |
|
| 129 | - throw new \EE_Error( |
|
| 130 | - esc_html__('You must provide content in order to create an iframe.', 'event_espresso') |
|
| 131 | - ); |
|
| 132 | - } |
|
| 133 | - $this->content = $content; |
|
| 134 | - } |
|
| 135 | - |
|
| 136 | - |
|
| 137 | - |
|
| 138 | - /** |
|
| 139 | - * @param boolean $enqueue_wp_assets |
|
| 140 | - */ |
|
| 141 | - public function setEnqueueWpAssets($enqueue_wp_assets) |
|
| 142 | - { |
|
| 143 | - $this->enqueue_wp_assets = filter_var($enqueue_wp_assets, FILTER_VALIDATE_BOOLEAN); |
|
| 144 | - } |
|
| 145 | - |
|
| 146 | - |
|
| 147 | - |
|
| 148 | - /** |
|
| 149 | - * @param array $stylesheets |
|
| 150 | - * @throws \EE_Error |
|
| 151 | - */ |
|
| 152 | - public function addStylesheets(array $stylesheets) |
|
| 153 | - { |
|
| 154 | - if (empty($stylesheets)) { |
|
| 155 | - throw new \EE_Error( |
|
| 156 | - esc_html__('A non-empty array of URLs, is required to add a CSS stylesheet to an iframe.', 'event_espresso') |
|
| 157 | - ); |
|
| 158 | - } |
|
| 159 | - foreach ($stylesheets as $handle => $stylesheet) { |
|
| 160 | - $this->css[$handle] = $stylesheet; |
|
| 161 | - } |
|
| 162 | - } |
|
| 163 | - |
|
| 164 | - |
|
| 165 | - |
|
| 166 | - /** |
|
| 167 | - * @param array $scripts |
|
| 168 | - * @param bool $add_to_header |
|
| 169 | - * @throws \EE_Error |
|
| 170 | - */ |
|
| 171 | - public function addScripts(array $scripts, $add_to_header = false) |
|
| 172 | - { |
|
| 173 | - if (empty($scripts)) { |
|
| 174 | - throw new \EE_Error( |
|
| 175 | - esc_html__('A non-empty array of URLs, is required to add Javascript to an iframe.', 'event_espresso') |
|
| 176 | - ); |
|
| 177 | - } |
|
| 178 | - foreach ($scripts as $handle => $script) { |
|
| 179 | - if ($add_to_header) { |
|
| 180 | - $this->header_js[$handle] = $script; |
|
| 181 | - } else { |
|
| 182 | - $this->footer_js[$handle] = $script; |
|
| 183 | - } |
|
| 184 | - } |
|
| 185 | - } |
|
| 186 | - |
|
| 187 | - |
|
| 188 | - |
|
| 189 | - /** |
|
| 190 | - * @param array $vars |
|
| 191 | - * @param string $var_name |
|
| 192 | - * @throws \EE_Error |
|
| 193 | - */ |
|
| 194 | - public function addLocalizedVars(array $vars, $var_name = 'eei18n') |
|
| 195 | - { |
|
| 196 | - if (empty($vars)) { |
|
| 197 | - throw new \EE_Error( |
|
| 198 | - esc_html__('A non-empty array of vars, is required to add localized Javascript vars to an iframe.', |
|
| 199 | - 'event_espresso') |
|
| 200 | - ); |
|
| 201 | - } |
|
| 202 | - foreach ($vars as $handle => $var) { |
|
| 203 | - if ($var_name === 'eei18n') { |
|
| 204 | - \EE_Registry::$i18n_js_strings[$handle] = $var; |
|
| 205 | - } else { |
|
| 206 | - if ( ! isset($this->localized_vars[$var_name])) { |
|
| 207 | - $this->localized_vars[$var_name] = array(); |
|
| 208 | - } |
|
| 209 | - $this->localized_vars[$var_name][$handle] = $var; |
|
| 210 | - } |
|
| 211 | - } |
|
| 212 | - } |
|
| 213 | - |
|
| 214 | - |
|
| 215 | - |
|
| 216 | - /** |
|
| 217 | - * @return void |
|
| 218 | - */ |
|
| 219 | - public function display() |
|
| 220 | - { |
|
| 221 | - echo $this->getTemplate(); |
|
| 222 | - exit; |
|
| 223 | - } |
|
| 224 | - |
|
| 225 | - |
|
| 226 | - |
|
| 227 | - /** |
|
| 228 | - * @return string |
|
| 229 | - */ |
|
| 230 | - public function getTemplate() |
|
| 231 | - { |
|
| 232 | - return \EEH_Template::display_template( |
|
| 233 | - __DIR__ . '\iframe_wrapper.template.php', |
|
| 234 | - array( |
|
| 235 | - 'title' => apply_filters( |
|
| 236 | - 'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__title', |
|
| 237 | - $this->title |
|
| 238 | - ), |
|
| 239 | - 'content' => apply_filters( |
|
| 240 | - 'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__content', |
|
| 241 | - $this->content |
|
| 242 | - ), |
|
| 243 | - 'enqueue_wp_assets' => apply_filters( |
|
| 244 | - 'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__enqueue_wp_assets', |
|
| 245 | - $this->enqueue_wp_assets |
|
| 246 | - ), |
|
| 247 | - 'css' => (array)apply_filters( |
|
| 248 | - 'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__css_urls', |
|
| 249 | - $this->css |
|
| 250 | - ), |
|
| 251 | - 'header_js' => (array)apply_filters( |
|
| 252 | - 'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__header_js_urls', |
|
| 253 | - $this->header_js |
|
| 254 | - ), |
|
| 255 | - 'footer_js' => (array)apply_filters( |
|
| 256 | - 'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__footer_js_urls', |
|
| 257 | - $this->footer_js |
|
| 258 | - ), |
|
| 259 | - 'eei18n' => apply_filters( |
|
| 260 | - 'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__eei18n_js_strings', |
|
| 261 | - \EE_Registry::localize_i18n_js_strings() . $this->localizeJsonVars() |
|
| 262 | - ), |
|
| 263 | - 'notices' => \EEH_Template::display_template( |
|
| 264 | - EE_TEMPLATES . 'espresso-ajax-notices.template.php', |
|
| 265 | - array(), |
|
| 266 | - true |
|
| 267 | - ), |
|
| 268 | - ), |
|
| 269 | - true |
|
| 270 | - ); |
|
| 271 | - } |
|
| 272 | - |
|
| 273 | - |
|
| 274 | - |
|
| 275 | - /** |
|
| 276 | - * localizeJsonVars |
|
| 277 | - * |
|
| 278 | - * @return string |
|
| 279 | - */ |
|
| 280 | - public function localizeJsonVars() |
|
| 281 | - { |
|
| 282 | - $JSON = ''; |
|
| 283 | - foreach ( (array) $this->localized_vars as $var_name => $vars) { |
|
| 284 | - foreach ( (array) $vars as $key => $value) { |
|
| 285 | - $this->localized_vars[ $var_name ] = $this->encodeJsonVars( $value ); |
|
| 286 | - } |
|
| 287 | - $JSON .= "/* <![CDATA[ */ var {$var_name} = "; |
|
| 288 | - $JSON .= wp_json_encode( $this->localized_vars[ $var_name ] ); |
|
| 289 | - $JSON .= '; /* ]]> */'; |
|
| 290 | - } |
|
| 291 | - return $JSON; |
|
| 292 | - } |
|
| 61 | + protected $localized_vars = array(); |
|
| 62 | + |
|
| 63 | + |
|
| 64 | + |
|
| 65 | + /** |
|
| 66 | + * Iframe constructor |
|
| 67 | + * |
|
| 68 | + * @param string $title |
|
| 69 | + * @param string $content |
|
| 70 | + * @throws \EE_Error |
|
| 71 | + */ |
|
| 72 | + public function __construct($title, $content) |
|
| 73 | + { |
|
| 74 | + global $wp_version; |
|
| 75 | + if ( ! defined('EE_IFRAME_DIR_URL')) { |
|
| 76 | + define('EE_IFRAME_DIR_URL', plugin_dir_url(__FILE__)); |
|
| 77 | + } |
|
| 78 | + $this->setContent($content); |
|
| 79 | + $this->setTitle($title); |
|
| 80 | + $this->addStylesheets( |
|
| 81 | + apply_filters( |
|
| 82 | + 'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__construct__default_css', |
|
| 83 | + array( |
|
| 84 | + 'dashicons' => includes_url('css/dashicons.min.css?ver=' . $wp_version), |
|
| 85 | + 'espresso_default' => EE_GLOBAL_ASSETS_URL |
|
| 86 | + . 'css/espresso_default.css?ver=' |
|
| 87 | + . EVENT_ESPRESSO_VERSION, |
|
| 88 | + ) |
|
| 89 | + ) |
|
| 90 | + ); |
|
| 91 | + $this->addScripts( |
|
| 92 | + apply_filters( |
|
| 93 | + 'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__construct__default_js', |
|
| 94 | + array( |
|
| 95 | + 'jquery' => includes_url('js/jquery/jquery.js?ver=' . $wp_version), |
|
| 96 | + 'espresso_core' => EE_GLOBAL_ASSETS_URL |
|
| 97 | + . 'scripts/espresso_core.js?ver=' |
|
| 98 | + . EVENT_ESPRESSO_VERSION, |
|
| 99 | + ) |
|
| 100 | + ) |
|
| 101 | + ); |
|
| 102 | + } |
|
| 103 | + |
|
| 104 | + |
|
| 105 | + |
|
| 106 | + /** |
|
| 107 | + * @param string $title |
|
| 108 | + * @throws \EE_Error |
|
| 109 | + */ |
|
| 110 | + public function setTitle($title) |
|
| 111 | + { |
|
| 112 | + if (empty($title)) { |
|
| 113 | + throw new \EE_Error( |
|
| 114 | + esc_html__('You must provide a page title in order to create an iframe.', 'event_espresso') |
|
| 115 | + ); |
|
| 116 | + } |
|
| 117 | + $this->title = $title; |
|
| 118 | + } |
|
| 119 | + |
|
| 120 | + |
|
| 121 | + |
|
| 122 | + /** |
|
| 123 | + * @param string $content |
|
| 124 | + * @throws \EE_Error |
|
| 125 | + */ |
|
| 126 | + public function setContent($content) |
|
| 127 | + { |
|
| 128 | + if (empty($content)) { |
|
| 129 | + throw new \EE_Error( |
|
| 130 | + esc_html__('You must provide content in order to create an iframe.', 'event_espresso') |
|
| 131 | + ); |
|
| 132 | + } |
|
| 133 | + $this->content = $content; |
|
| 134 | + } |
|
| 135 | + |
|
| 136 | + |
|
| 137 | + |
|
| 138 | + /** |
|
| 139 | + * @param boolean $enqueue_wp_assets |
|
| 140 | + */ |
|
| 141 | + public function setEnqueueWpAssets($enqueue_wp_assets) |
|
| 142 | + { |
|
| 143 | + $this->enqueue_wp_assets = filter_var($enqueue_wp_assets, FILTER_VALIDATE_BOOLEAN); |
|
| 144 | + } |
|
| 145 | + |
|
| 146 | + |
|
| 147 | + |
|
| 148 | + /** |
|
| 149 | + * @param array $stylesheets |
|
| 150 | + * @throws \EE_Error |
|
| 151 | + */ |
|
| 152 | + public function addStylesheets(array $stylesheets) |
|
| 153 | + { |
|
| 154 | + if (empty($stylesheets)) { |
|
| 155 | + throw new \EE_Error( |
|
| 156 | + esc_html__('A non-empty array of URLs, is required to add a CSS stylesheet to an iframe.', 'event_espresso') |
|
| 157 | + ); |
|
| 158 | + } |
|
| 159 | + foreach ($stylesheets as $handle => $stylesheet) { |
|
| 160 | + $this->css[$handle] = $stylesheet; |
|
| 161 | + } |
|
| 162 | + } |
|
| 163 | + |
|
| 164 | + |
|
| 165 | + |
|
| 166 | + /** |
|
| 167 | + * @param array $scripts |
|
| 168 | + * @param bool $add_to_header |
|
| 169 | + * @throws \EE_Error |
|
| 170 | + */ |
|
| 171 | + public function addScripts(array $scripts, $add_to_header = false) |
|
| 172 | + { |
|
| 173 | + if (empty($scripts)) { |
|
| 174 | + throw new \EE_Error( |
|
| 175 | + esc_html__('A non-empty array of URLs, is required to add Javascript to an iframe.', 'event_espresso') |
|
| 176 | + ); |
|
| 177 | + } |
|
| 178 | + foreach ($scripts as $handle => $script) { |
|
| 179 | + if ($add_to_header) { |
|
| 180 | + $this->header_js[$handle] = $script; |
|
| 181 | + } else { |
|
| 182 | + $this->footer_js[$handle] = $script; |
|
| 183 | + } |
|
| 184 | + } |
|
| 185 | + } |
|
| 186 | + |
|
| 187 | + |
|
| 188 | + |
|
| 189 | + /** |
|
| 190 | + * @param array $vars |
|
| 191 | + * @param string $var_name |
|
| 192 | + * @throws \EE_Error |
|
| 193 | + */ |
|
| 194 | + public function addLocalizedVars(array $vars, $var_name = 'eei18n') |
|
| 195 | + { |
|
| 196 | + if (empty($vars)) { |
|
| 197 | + throw new \EE_Error( |
|
| 198 | + esc_html__('A non-empty array of vars, is required to add localized Javascript vars to an iframe.', |
|
| 199 | + 'event_espresso') |
|
| 200 | + ); |
|
| 201 | + } |
|
| 202 | + foreach ($vars as $handle => $var) { |
|
| 203 | + if ($var_name === 'eei18n') { |
|
| 204 | + \EE_Registry::$i18n_js_strings[$handle] = $var; |
|
| 205 | + } else { |
|
| 206 | + if ( ! isset($this->localized_vars[$var_name])) { |
|
| 207 | + $this->localized_vars[$var_name] = array(); |
|
| 208 | + } |
|
| 209 | + $this->localized_vars[$var_name][$handle] = $var; |
|
| 210 | + } |
|
| 211 | + } |
|
| 212 | + } |
|
| 213 | + |
|
| 214 | + |
|
| 215 | + |
|
| 216 | + /** |
|
| 217 | + * @return void |
|
| 218 | + */ |
|
| 219 | + public function display() |
|
| 220 | + { |
|
| 221 | + echo $this->getTemplate(); |
|
| 222 | + exit; |
|
| 223 | + } |
|
| 224 | + |
|
| 225 | + |
|
| 226 | + |
|
| 227 | + /** |
|
| 228 | + * @return string |
|
| 229 | + */ |
|
| 230 | + public function getTemplate() |
|
| 231 | + { |
|
| 232 | + return \EEH_Template::display_template( |
|
| 233 | + __DIR__ . '\iframe_wrapper.template.php', |
|
| 234 | + array( |
|
| 235 | + 'title' => apply_filters( |
|
| 236 | + 'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__title', |
|
| 237 | + $this->title |
|
| 238 | + ), |
|
| 239 | + 'content' => apply_filters( |
|
| 240 | + 'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__content', |
|
| 241 | + $this->content |
|
| 242 | + ), |
|
| 243 | + 'enqueue_wp_assets' => apply_filters( |
|
| 244 | + 'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__enqueue_wp_assets', |
|
| 245 | + $this->enqueue_wp_assets |
|
| 246 | + ), |
|
| 247 | + 'css' => (array)apply_filters( |
|
| 248 | + 'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__css_urls', |
|
| 249 | + $this->css |
|
| 250 | + ), |
|
| 251 | + 'header_js' => (array)apply_filters( |
|
| 252 | + 'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__header_js_urls', |
|
| 253 | + $this->header_js |
|
| 254 | + ), |
|
| 255 | + 'footer_js' => (array)apply_filters( |
|
| 256 | + 'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__footer_js_urls', |
|
| 257 | + $this->footer_js |
|
| 258 | + ), |
|
| 259 | + 'eei18n' => apply_filters( |
|
| 260 | + 'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__eei18n_js_strings', |
|
| 261 | + \EE_Registry::localize_i18n_js_strings() . $this->localizeJsonVars() |
|
| 262 | + ), |
|
| 263 | + 'notices' => \EEH_Template::display_template( |
|
| 264 | + EE_TEMPLATES . 'espresso-ajax-notices.template.php', |
|
| 265 | + array(), |
|
| 266 | + true |
|
| 267 | + ), |
|
| 268 | + ), |
|
| 269 | + true |
|
| 270 | + ); |
|
| 271 | + } |
|
| 272 | + |
|
| 273 | + |
|
| 274 | + |
|
| 275 | + /** |
|
| 276 | + * localizeJsonVars |
|
| 277 | + * |
|
| 278 | + * @return string |
|
| 279 | + */ |
|
| 280 | + public function localizeJsonVars() |
|
| 281 | + { |
|
| 282 | + $JSON = ''; |
|
| 283 | + foreach ( (array) $this->localized_vars as $var_name => $vars) { |
|
| 284 | + foreach ( (array) $vars as $key => $value) { |
|
| 285 | + $this->localized_vars[ $var_name ] = $this->encodeJsonVars( $value ); |
|
| 286 | + } |
|
| 287 | + $JSON .= "/* <![CDATA[ */ var {$var_name} = "; |
|
| 288 | + $JSON .= wp_json_encode( $this->localized_vars[ $var_name ] ); |
|
| 289 | + $JSON .= '; /* ]]> */'; |
|
| 290 | + } |
|
| 291 | + return $JSON; |
|
| 292 | + } |
|
| 293 | 293 | |
| 294 | 294 | |
| 295 | 295 | |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | apply_filters( |
| 82 | 82 | 'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__construct__default_css', |
| 83 | 83 | array( |
| 84 | - 'dashicons' => includes_url('css/dashicons.min.css?ver=' . $wp_version), |
|
| 84 | + 'dashicons' => includes_url('css/dashicons.min.css?ver='.$wp_version), |
|
| 85 | 85 | 'espresso_default' => EE_GLOBAL_ASSETS_URL |
| 86 | 86 | . 'css/espresso_default.css?ver=' |
| 87 | 87 | . EVENT_ESPRESSO_VERSION, |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | apply_filters( |
| 93 | 93 | 'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__construct__default_js', |
| 94 | 94 | array( |
| 95 | - 'jquery' => includes_url('js/jquery/jquery.js?ver=' . $wp_version), |
|
| 95 | + 'jquery' => includes_url('js/jquery/jquery.js?ver='.$wp_version), |
|
| 96 | 96 | 'espresso_core' => EE_GLOBAL_ASSETS_URL |
| 97 | 97 | . 'scripts/espresso_core.js?ver=' |
| 98 | 98 | . EVENT_ESPRESSO_VERSION, |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | public function getTemplate() |
| 231 | 231 | { |
| 232 | 232 | return \EEH_Template::display_template( |
| 233 | - __DIR__ . '\iframe_wrapper.template.php', |
|
| 233 | + __DIR__.'\iframe_wrapper.template.php', |
|
| 234 | 234 | array( |
| 235 | 235 | 'title' => apply_filters( |
| 236 | 236 | 'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__title', |
@@ -244,24 +244,24 @@ discard block |
||
| 244 | 244 | 'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__enqueue_wp_assets', |
| 245 | 245 | $this->enqueue_wp_assets |
| 246 | 246 | ), |
| 247 | - 'css' => (array)apply_filters( |
|
| 247 | + 'css' => (array) apply_filters( |
|
| 248 | 248 | 'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__css_urls', |
| 249 | 249 | $this->css |
| 250 | 250 | ), |
| 251 | - 'header_js' => (array)apply_filters( |
|
| 251 | + 'header_js' => (array) apply_filters( |
|
| 252 | 252 | 'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__header_js_urls', |
| 253 | 253 | $this->header_js |
| 254 | 254 | ), |
| 255 | - 'footer_js' => (array)apply_filters( |
|
| 255 | + 'footer_js' => (array) apply_filters( |
|
| 256 | 256 | 'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__footer_js_urls', |
| 257 | 257 | $this->footer_js |
| 258 | 258 | ), |
| 259 | 259 | 'eei18n' => apply_filters( |
| 260 | 260 | 'FHEE___EventEspresso_core_libraries_iframe_display_Iframe__getTemplate__eei18n_js_strings', |
| 261 | - \EE_Registry::localize_i18n_js_strings() . $this->localizeJsonVars() |
|
| 261 | + \EE_Registry::localize_i18n_js_strings().$this->localizeJsonVars() |
|
| 262 | 262 | ), |
| 263 | 263 | 'notices' => \EEH_Template::display_template( |
| 264 | - EE_TEMPLATES . 'espresso-ajax-notices.template.php', |
|
| 264 | + EE_TEMPLATES.'espresso-ajax-notices.template.php', |
|
| 265 | 265 | array(), |
| 266 | 266 | true |
| 267 | 267 | ), |
@@ -280,12 +280,12 @@ discard block |
||
| 280 | 280 | public function localizeJsonVars() |
| 281 | 281 | { |
| 282 | 282 | $JSON = ''; |
| 283 | - foreach ( (array) $this->localized_vars as $var_name => $vars) { |
|
| 284 | - foreach ( (array) $vars as $key => $value) { |
|
| 285 | - $this->localized_vars[ $var_name ] = $this->encodeJsonVars( $value ); |
|
| 283 | + foreach ((array) $this->localized_vars as $var_name => $vars) { |
|
| 284 | + foreach ((array) $vars as $key => $value) { |
|
| 285 | + $this->localized_vars[$var_name] = $this->encodeJsonVars($value); |
|
| 286 | 286 | } |
| 287 | 287 | $JSON .= "/* <![CDATA[ */ var {$var_name} = "; |
| 288 | - $JSON .= wp_json_encode( $this->localized_vars[ $var_name ] ); |
|
| 288 | + $JSON .= wp_json_encode($this->localized_vars[$var_name]); |
|
| 289 | 289 | $JSON .= '; /* ]]> */'; |
| 290 | 290 | } |
| 291 | 291 | return $JSON; |
@@ -297,15 +297,15 @@ discard block |
||
| 297 | 297 | * @param bool|int|float|string|array $var |
| 298 | 298 | * @return array |
| 299 | 299 | */ |
| 300 | - public function encodeJsonVars( $var ) { |
|
| 301 | - if ( is_array( $var ) ) { |
|
| 300 | + public function encodeJsonVars($var) { |
|
| 301 | + if (is_array($var)) { |
|
| 302 | 302 | $localized_vars = array(); |
| 303 | - foreach( (array) $var as $key => $value ) { |
|
| 304 | - $localized_vars[ $key ] = $this->encodeJsonVars( $value ); |
|
| 303 | + foreach ((array) $var as $key => $value) { |
|
| 304 | + $localized_vars[$key] = $this->encodeJsonVars($value); |
|
| 305 | 305 | } |
| 306 | 306 | return $localized_vars; |
| 307 | - } else if ( is_scalar( $var ) ) { |
|
| 308 | - return html_entity_decode( (string) $var, ENT_QUOTES, 'UTF-8' ); |
|
| 307 | + } else if (is_scalar($var)) { |
|
| 308 | + return html_entity_decode((string) $var, ENT_QUOTES, 'UTF-8'); |
|
| 309 | 309 | } |
| 310 | 310 | return null; |
| 311 | 311 | } |