Completed
Branch FET/add-loco-translate-support (7d9689)
by
unknown
26:14 queued 18:13
created
reg_steps/attendee_information/auto_copy_attendee_info.template.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@
 block discarded – undo
1 1
 <p id="spco-auto-copy-attendee-pg" class="smaller-text lt-grey-text">
2 2
     <?php echo apply_filters(
3
-        'FHEE__registration_page_attendee_information__auto_copy_attendee_pg',
4
-        __(
5
-            'The above information will be used for any additional tickets/attendees.',
6
-            'event_espresso'
7
-        )
8
-    ); ?>
3
+		'FHEE__registration_page_attendee_information__auto_copy_attendee_pg',
4
+		__(
5
+			'The above information will be used for any additional tickets/attendees.',
6
+			'event_espresso'
7
+		)
8
+	); ?>
9 9
 </p>
10 10
\ No newline at end of file
Please login to merge, or discard this patch.
reg_steps/attendee_information/attendee_info_main.template.php 2 patches
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -5,16 +5,16 @@  discard block
 block discarded – undo
5 5
 ?>
6 6
 <p id="spco-attendee_information-pg" class="spco-steps-pg small-text drk-grey-text">
7 7
     <?php echo apply_filters(
8
-        'FHEE__registration_page_attendee_information__attendee_information_pg',
9
-        sprintf(
10
-            __(
11
-                'In order to process your registration, we ask you to provide the following information.%1$sPlease note that all fields marked with an asterisk (%2$s) are required.',
12
-                'event_espresso'
13
-            ),
14
-            '<br />',
15
-            '<span class="asterisk">*</span>'
16
-        )
17
-    ); ?>
8
+		'FHEE__registration_page_attendee_information__attendee_information_pg',
9
+		sprintf(
10
+			__(
11
+				'In order to process your registration, we ask you to provide the following information.%1$sPlease note that all fields marked with an asterisk (%2$s) are required.',
12
+				'event_espresso'
13
+			),
14
+			'<br />',
15
+			'<span class="asterisk">*</span>'
16
+		)
17
+	); ?>
18 18
 </p>
19 19
 
20 20
 <?php
@@ -23,10 +23,10 @@  discard block
 block discarded – undo
23 23
 $prev_ticket = 0;
24 24
 
25 25
 if (count($registrations) > 0) {
26
-    foreach ($registrations as $registration) {
27
-        if ($registration instanceof EE_Registration) {
28
-            $att_nmbr++;
29
-            ?>
26
+	foreach ($registrations as $registration) {
27
+		if ($registration instanceof EE_Registration) {
28
+			$att_nmbr++;
29
+			?>
30 30
 
31 31
             <div id="spco-attendee-panel-dv-<?php echo $registration->reg_url_link(); ?>"
32 32
                  class="spco-attendee-panel-dv spco-attendee-ticket-<?php echo $registration->ticket()->ID(); ?>">
@@ -46,19 +46,19 @@  discard block
 block discarded – undo
46 46
                                     <th scope="col" width=""><?php _e('Name and Description', 'event_espresso'); ?></th>
47 47
                                     <th scope="col" width="7.5%" class="jst-rght">
48 48
                                         <?php _e(
49
-                                            'Qty',
50
-                                            'event_espresso'
51
-                                        ); ?></th>
49
+											'Qty',
50
+											'event_espresso'
51
+										); ?></th>
52 52
                                     <th scope="col" width="17.5%" class="jst-rght">
53 53
                                         <?php _e(
54
-                                            'Price',
55
-                                            'event_espresso'
56
-                                        ); ?></th>
54
+											'Price',
55
+											'event_espresso'
56
+										); ?></th>
57 57
                                     <th scope="col" width="17.5%" class="jst-rght">
58 58
                                         <?php _e(
59
-                                            'Total',
60
-                                            'event_espresso'
61
-                                        ); ?></th>
59
+											'Total',
60
+											'event_espresso'
61
+										); ?></th>
62 62
                                 </tr>
63 63
                                 </thead>
64 64
                                 <tbody>
@@ -70,19 +70,19 @@  discard block
 block discarded – undo
70 70
                 <?php } ?>
71 71
 
72 72
                 <?php
73
-                // ATTENDEE QUESTIONS
74
-                $reg_form = EE_Template_Layout::get_subform_name($registration->reg_url_link());
75
-                echo ${$reg_form};
76
-                ?>
73
+				// ATTENDEE QUESTIONS
74
+				$reg_form = EE_Template_Layout::get_subform_name($registration->reg_url_link());
75
+				echo ${$reg_form};
76
+				?>
77 77
 
78 78
             </div>
79 79
             <?php
80
-            $prev_event = $registration->event()->ID();
81
-            $prev_ticket = $registration->ticket()->ID();
82
-        } // if ( $registration instanceof EE_Registration )
83
-    } // end foreach ( $registrations as $registration )
80
+			$prev_event = $registration->event()->ID();
81
+			$prev_ticket = $registration->ticket()->ID();
82
+		} // if ( $registration instanceof EE_Registration )
83
+	} // end foreach ( $registrations as $registration )
84 84
 
85
-    echo $default_hidden_inputs;
85
+	echo $default_hidden_inputs;
86 86
 } // end if ( count( $registrations ) > 0 )
87 87
 
88 88
 ?>
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
                     </h4>
38 38
                 <?php } ?>
39 39
                 <?php if ($registration->ticket()->ID() !== $prev_ticket) { ?>
40
-                    <?php if (! $revisit) { ?>
40
+                    <?php if ( ! $revisit) { ?>
41 41
                         <div class="spco-ticket-info-dv small-text">
42 42
                             <h5><?php _e('Details', 'event_espresso'); ?></h5>
43 43
                             <table>
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
                                 </tr>
63 63
                                 </thead>
64 64
                                 <tbody>
65
-                                <?php echo $ticket_line_item[ $registration->ticket()->ID() ]; ?>
65
+                                <?php echo $ticket_line_item[$registration->ticket()->ID()]; ?>
66 66
                                 </tbody>
67 67
                             </table>
68 68
                         </div>
Please login to merge, or discard this patch.
single_page_checkout/templates/registration_page_wrapper.template.php 2 patches
Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -1,90 +1,90 @@
 block discarded – undo
1 1
 <div id="ee-single-page-checkout-dv" class="">
2 2
     <?php
3
-    if (! $empty_cart) {
4
-        if (apply_filters('FHEE__registration_page_wrapper_template__display_time_limit', false)) { ?>
3
+	if (! $empty_cart) {
4
+		if (apply_filters('FHEE__registration_page_wrapper_template__display_time_limit', false)) { ?>
5 5
             <p id="spco-registration-time-limit-pg" class="spco-steps-pg ee-attention important-notice"
6 6
                style="display: none;">
7 7
                 <?php echo sprintf(
8
-                    apply_filters(
9
-                        'FHEE__registration_page_wrapper_template___time_limit',
10
-                        __('You have %1$s to complete your registration.', 'event_espresso')
11
-                    ),
12
-                    '<span id="spco-registration-time-limit-spn" class="spco-registration-time-limit-spn">' . $registration_time_limit . '</span>'
13
-                );
14
-                ?>
8
+					apply_filters(
9
+						'FHEE__registration_page_wrapper_template___time_limit',
10
+						__('You have %1$s to complete your registration.', 'event_espresso')
11
+					),
12
+					'<span id="spco-registration-time-limit-spn" class="spco-registration-time-limit-spn">' . $registration_time_limit . '</span>'
13
+				);
14
+				?>
15 15
                 <span id="spco-registration-expiration-spn" class="" style="display:none;"></span>
16 16
             </p>
17 17
         <?php }
18
-        if (! $revisit && apply_filters('FHEE__registration_page_wrapper_template__steps_display', true)) {
19
-            ?>
18
+		if (! $revisit && apply_filters('FHEE__registration_page_wrapper_template__steps_display', true)) {
19
+			?>
20 20
             <h2 id="spco-steps-big-hdr" class="spco-steps-big-hdr"><?php _e(' Steps', 'event_espresso'); ?></h2>
21 21
 
22 22
             <div id="spco-steps-display-dv">
23 23
                 <?php
24
-                $step_nmbr = 1;
25
-                $total_steps = count($reg_steps) - 1;
26
-                foreach ($reg_steps as $reg_step) {
27
-                    if ($reg_step instanceof EE_SPCO_Reg_Step && $reg_step->slug() != 'finalize_registration') {
28
-                        $slug = $reg_step->slug();
29
-                        $step_display_dv_class = $reg_step->is_current_step() ? 'active-step' : 'inactive-step';
30
-                        ?>
24
+				$step_nmbr = 1;
25
+				$total_steps = count($reg_steps) - 1;
26
+				foreach ($reg_steps as $reg_step) {
27
+					if ($reg_step instanceof EE_SPCO_Reg_Step && $reg_step->slug() != 'finalize_registration') {
28
+						$slug = $reg_step->slug();
29
+						$step_display_dv_class = $reg_step->is_current_step() ? 'active-step' : 'inactive-step';
30
+						?>
31 31
                         <div id="spco-step-<?php echo $slug; ?>-display-dv"
32 32
                              class="spco-step-display-dv <?php echo $step_display_dv_class; ?> steps-<?php echo $total_steps; ?>">
33 33
                             <h4 id="spco-step-<?php echo $slug; ?>-display-hdr" class="spco-steps-display-hdr">
34 34
                                 <span class="spco-step-big-nmbr"><?php echo $step_nmbr; ?></span>&nbsp;<span
35 35
                                     class="spco-step-name">
36 36
                                     <?php echo str_replace(
37
-                                        '&nbsp;',
38
-                                        '<br/>&nbsp;',
39
-                                        $reg_step->name()
40
-                                    ); ?></span>
37
+										'&nbsp;',
38
+										'<br/>&nbsp;',
39
+										$reg_step->name()
40
+									); ?></span>
41 41
                             </h4>
42 42
                         </div>
43 43
 
44 44
                         <?php
45
-                        if ($step_nmbr < $total_steps) { ?>
45
+						if ($step_nmbr < $total_steps) { ?>
46 46
                             <div class="spco-step-arrow-dv">&raquo;</div>
47 47
                             <?php
48
-                        }
49
-                        $step_nmbr++;
50
-                    }
51
-                }
52
-                ?>
48
+						}
49
+						$step_nmbr++;
50
+					}
51
+				}
52
+				?>
53 53
                 <div class="clear-float"></div>
54 54
             </div>
55 55
 
56 56
             <?php
57
-        }
57
+		}
58 58
 
59
-        do_action('AHEE__SPCO__before_registration_steps');
60
-        $step_nmbr = 1;
61
-        foreach ($reg_steps as $reg_step) {
62
-            if ($reg_step instanceof EE_SPCO_Reg_Step && $reg_step->slug() != 'finalize_registration') {
63
-                $slug = $reg_step->slug();
64
-                do_action('AHEE__' . $slug . '__reg_step_start', $reg_step);
65
-                // todo: deprecate hook AHEE__registration_page_attendee_information__start
66
-                ?>
59
+		do_action('AHEE__SPCO__before_registration_steps');
60
+		$step_nmbr = 1;
61
+		foreach ($reg_steps as $reg_step) {
62
+			if ($reg_step instanceof EE_SPCO_Reg_Step && $reg_step->slug() != 'finalize_registration') {
63
+				$slug = $reg_step->slug();
64
+				do_action('AHEE__' . $slug . '__reg_step_start', $reg_step);
65
+				// todo: deprecate hook AHEE__registration_page_attendee_information__start
66
+				?>
67 67
                 <div id="spco-<?php echo $slug; ?>-dv" class="spco-step-dv <?php echo $reg_step->div_class(); ?>">
68 68
                     <?php echo $reg_step->display_reg_form(); ?>
69 69
                     <?php do_action('AHEE__SPCO_after_reg_step_form', $slug, $next_step); ?>
70 70
                 </div>
71 71
                 <?php $step_nmbr++;
72
-            }
73
-        }
74
-        do_action('AHEE__SPCO__after_registration_steps');
75
-    } else {
76
-        ?>
72
+			}
73
+		}
74
+		do_action('AHEE__SPCO__after_registration_steps');
75
+	} else {
76
+		?>
77 77
         <h3 id="spco-empty-cart-hdr" class="spco-step-title-hdr">
78 78
             <?php esc_html_e(
79
-                'Nothing in your Event Queue',
80
-                'event_espresso'
81
-            ); ?></h3>
79
+				'Nothing in your Event Queue',
80
+				'event_espresso'
81
+			); ?></h3>
82 82
         <p><?php echo $empty_msg; ?></p>
83 83
         <?php echo $cookies_not_set_msg; ?>
84 84
         <?php
85
-    }
86
-    do_action('AHEE__SPCO__reg_form_footer');
87
-    ?>
85
+	}
86
+	do_action('AHEE__SPCO__reg_form_footer');
87
+	?>
88 88
 
89 89
 </div>
90 90
 
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <div id="ee-single-page-checkout-dv" class="">
2 2
     <?php
3
-    if (! $empty_cart) {
3
+    if ( ! $empty_cart) {
4 4
         if (apply_filters('FHEE__registration_page_wrapper_template__display_time_limit', false)) { ?>
5 5
             <p id="spco-registration-time-limit-pg" class="spco-steps-pg ee-attention important-notice"
6 6
                style="display: none;">
@@ -9,13 +9,13 @@  discard block
 block discarded – undo
9 9
                         'FHEE__registration_page_wrapper_template___time_limit',
10 10
                         __('You have %1$s to complete your registration.', 'event_espresso')
11 11
                     ),
12
-                    '<span id="spco-registration-time-limit-spn" class="spco-registration-time-limit-spn">' . $registration_time_limit . '</span>'
12
+                    '<span id="spco-registration-time-limit-spn" class="spco-registration-time-limit-spn">'.$registration_time_limit.'</span>'
13 13
                 );
14 14
                 ?>
15 15
                 <span id="spco-registration-expiration-spn" class="" style="display:none;"></span>
16 16
             </p>
17 17
         <?php }
18
-        if (! $revisit && apply_filters('FHEE__registration_page_wrapper_template__steps_display', true)) {
18
+        if ( ! $revisit && apply_filters('FHEE__registration_page_wrapper_template__steps_display', true)) {
19 19
             ?>
20 20
             <h2 id="spco-steps-big-hdr" class="spco-steps-big-hdr"><?php _e(' Steps', 'event_espresso'); ?></h2>
21 21
 
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
         foreach ($reg_steps as $reg_step) {
62 62
             if ($reg_step instanceof EE_SPCO_Reg_Step && $reg_step->slug() != 'finalize_registration') {
63 63
                 $slug = $reg_step->slug();
64
-                do_action('AHEE__' . $slug . '__reg_step_start', $reg_step);
64
+                do_action('AHEE__'.$slug.'__reg_step_start', $reg_step);
65 65
                 // todo: deprecate hook AHEE__registration_page_attendee_information__start
66 66
                 ?>
67 67
                 <div id="spco-<?php echo $slug; ?>-dv" class="spco-step-dv <?php echo $reg_step->div_class(); ?>">
Please login to merge, or discard this patch.
modules/invoice/EED_Invoice.module.php 2 patches
Indentation   +73 added lines, -73 removed lines patch added patch discarded remove patch
@@ -12,87 +12,87 @@
 block discarded – undo
12 12
 {
13 13
 
14 14
 
15
-    /**
16
-     * @return EED_Invoice
17
-     */
18
-    public static function instance()
19
-    {
20
-        return parent::get_instance(__CLASS__);
21
-    }
15
+	/**
16
+	 * @return EED_Invoice
17
+	 */
18
+	public static function instance()
19
+	{
20
+		return parent::get_instance(__CLASS__);
21
+	}
22 22
 
23 23
 
24
-    /**
25
-     *    set_hooks - for hooking into EE Core, other modules, etc
26
-     *
27
-     * @access    public
28
-     * @return    void
29
-     */
30
-    public static function set_hooks()
31
-    {
32
-        EE_Config::register_route('download_invoice', 'EED_Invoice', 'download_invoice');
33
-        EE_Config::register_route('launch_invoice', 'EED_Invoice', 'launch_invoice');
34
-    }
24
+	/**
25
+	 *    set_hooks - for hooking into EE Core, other modules, etc
26
+	 *
27
+	 * @access    public
28
+	 * @return    void
29
+	 */
30
+	public static function set_hooks()
31
+	{
32
+		EE_Config::register_route('download_invoice', 'EED_Invoice', 'download_invoice');
33
+		EE_Config::register_route('launch_invoice', 'EED_Invoice', 'launch_invoice');
34
+	}
35 35
 
36 36
 
37
-    /**
38
-     *    set_hooks_admin - for hooking into EE Admin Core, other modules, etc
39
-     *
40
-     * @access    public
41
-     * @return    void
42
-     */
43
-    public static function set_hooks_admin()
44
-    {
45
-    }
37
+	/**
38
+	 *    set_hooks_admin - for hooking into EE Admin Core, other modules, etc
39
+	 *
40
+	 * @access    public
41
+	 * @return    void
42
+	 */
43
+	public static function set_hooks_admin()
44
+	{
45
+	}
46 46
 
47 47
 
48
-    /**
49
-     *    run - initial module setup
50
-     *
51
-     * @access    public
52
-     * @return    void
53
-     */
54
-    public function run($WP)
55
-    {
56
-        if (is_readable(EE_MODULES . 'gateways/Invoice/lib/Invoice.class.php')) {
57
-            require_once(EE_MODULES . 'gateways/Invoice/lib/Invoice.class.php');
58
-        } else {
59
-            $msg = __('The Invoice.class.php file could not be loaded.', 'event_espresso');
60
-            EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
61
-        }
62
-    }
48
+	/**
49
+	 *    run - initial module setup
50
+	 *
51
+	 * @access    public
52
+	 * @return    void
53
+	 */
54
+	public function run($WP)
55
+	{
56
+		if (is_readable(EE_MODULES . 'gateways/Invoice/lib/Invoice.class.php')) {
57
+			require_once(EE_MODULES . 'gateways/Invoice/lib/Invoice.class.php');
58
+		} else {
59
+			$msg = __('The Invoice.class.php file could not be loaded.', 'event_espresso');
60
+			EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
61
+		}
62
+	}
63 63
 
64 64
 
65
-    /**
66
-     *    invoice_launch
67
-     *
68
-     * @access    public
69
-     * @return    void
70
-     */
71
-    public function launch_invoice()
72
-    {
73
-        $this->run(null);
74
-        if (EE_Registry::instance()->REQ->is_set('id')) {
75
-            $id = sanitize_key(EE_Registry::instance()->REQ->get('id'));
76
-            $invoice = new Invoice($id);
77
-            $invoice->send_invoice();
78
-        }
79
-    }
65
+	/**
66
+	 *    invoice_launch
67
+	 *
68
+	 * @access    public
69
+	 * @return    void
70
+	 */
71
+	public function launch_invoice()
72
+	{
73
+		$this->run(null);
74
+		if (EE_Registry::instance()->REQ->is_set('id')) {
75
+			$id = sanitize_key(EE_Registry::instance()->REQ->get('id'));
76
+			$invoice = new Invoice($id);
77
+			$invoice->send_invoice();
78
+		}
79
+	}
80 80
 
81 81
 
82
-    /**
83
-     *    download_invoice
84
-     *
85
-     * @access    public
86
-     * @return    void
87
-     */
88
-    public function download_invoice()
89
-    {
90
-        $this->run(null);
91
-        if (EE_Registry::instance()->REQ->is_set('id')) {
92
-            $id = sanitize_key(EE_Registry::instance()->REQ->get('id'));
93
-            $invoice = new Invoice($_REQUEST['id']);
94
-            // send invoice but force download
95
-            $invoice->send_invoice(true);
96
-        }
97
-    }
82
+	/**
83
+	 *    download_invoice
84
+	 *
85
+	 * @access    public
86
+	 * @return    void
87
+	 */
88
+	public function download_invoice()
89
+	{
90
+		$this->run(null);
91
+		if (EE_Registry::instance()->REQ->is_set('id')) {
92
+			$id = sanitize_key(EE_Registry::instance()->REQ->get('id'));
93
+			$invoice = new Invoice($_REQUEST['id']);
94
+			// send invoice but force download
95
+			$invoice->send_invoice(true);
96
+		}
97
+	}
98 98
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -53,8 +53,8 @@
 block discarded – undo
53 53
      */
54 54
     public function run($WP)
55 55
     {
56
-        if (is_readable(EE_MODULES . 'gateways/Invoice/lib/Invoice.class.php')) {
57
-            require_once(EE_MODULES . 'gateways/Invoice/lib/Invoice.class.php');
56
+        if (is_readable(EE_MODULES.'gateways/Invoice/lib/Invoice.class.php')) {
57
+            require_once(EE_MODULES.'gateways/Invoice/lib/Invoice.class.php');
58 58
         } else {
59 59
             $msg = __('The Invoice.class.php file could not be loaded.', 'event_espresso');
60 60
             EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__);
Please login to merge, or discard this patch.
modules/venues_archive/EED_Venues_Archive.module.php 2 patches
Indentation   +172 added lines, -172 removed lines patch added patch discarded remove patch
@@ -29,176 +29,176 @@
 block discarded – undo
29 29
 class EED_Venues_Archive extends EED_Module
30 30
 {
31 31
 
32
-    /**
33
-     * @return EED_Venues_Archive
34
-     */
35
-    public static function instance()
36
-    {
37
-        return parent::get_instance(__CLASS__);
38
-    }
39
-
40
-
41
-    /**
42
-     * set_hooks - for hooking into EE Core, other modules, etc
43
-     *
44
-     * @return void
45
-     * @throws InvalidArgumentException
46
-     * @throws InvalidDataTypeException
47
-     * @throws InvalidInterfaceException
48
-     */
49
-    public static function set_hooks()
50
-    {
51
-        /** @var EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions $custom_post_type_definitions */
52
-        $custom_post_type_definitions = LoaderFactory::getLoader()->getShared(
53
-            'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions'
54
-        );
55
-        $custom_post_types = $custom_post_type_definitions->getDefinitions();
56
-        EE_Config::register_route(
57
-            $custom_post_types['espresso_venues']['plural_slug'],
58
-            'Venues_Archive',
59
-            'run'
60
-        );
61
-    }
62
-
63
-    /**
64
-     *    set_hooks_admin - for hooking into EE Admin Core, other modules, etc
65
-     *
66
-     * @access    public
67
-     * @return    void
68
-     */
69
-    public static function set_hooks_admin()
70
-    {
71
-    }
72
-
73
-
74
-    /**
75
-     * run - initial module setup
76
-     *
77
-     * @access    public
78
-     * @param \WP $WP
79
-     */
80
-    public function run($WP)
81
-    {
82
-        // check what template is loaded
83
-        add_filter('template_include', array($this, 'template_include'), 999, 1);
84
-        add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10);
85
-    }
86
-
87
-
88
-    /**
89
-     * template_include
90
-     *
91
-     * @access public
92
-     * @param  string $template
93
-     * @return string
94
-     */
95
-    public function template_include($template)
96
-    {
97
-        // not a custom template?
98
-        if (EE_Registry::instance()->load_core('Front_Controller', array(), false, true)
99
-                                   ->get_selected_template() != 'archive-espresso_venues.php'
100
-        ) {
101
-            EEH_Template::load_espresso_theme_functions();
102
-            // then add extra event data via hooks
103
-            add_filter('the_title', array($this, 'the_title'), 100, 1);
104
-            // don't know if theme uses the_excerpt
105
-            add_filter('the_excerpt', array($this, 'venue_details'), 100);
106
-            // or the_content
107
-            add_filter('the_content', array($this, 'venue_details'), 100);
108
-            // don't display entry meta because the existing theme will take care of that
109
-            add_filter('FHEE__content_espresso_venues_details_template__display_entry_meta', '__return_false');
110
-        }
111
-        return $template;
112
-    }
113
-
114
-
115
-    /**
116
-     * the_title
117
-     *
118
-     * @access public
119
-     * @param  string $title
120
-     * @return string
121
-     */
122
-    public function the_title($title = '')
123
-    {
124
-        return $title;
125
-    }
126
-
127
-
128
-    /**
129
-     *    venue_details
130
-     *
131
-     * @access public
132
-     * @param  string $content
133
-     * @return string
134
-     */
135
-    public function venue_details($content)
136
-    {
137
-        global $post;
138
-        if ($post->post_type == 'espresso_venues'
139
-            && ! post_password_required()
140
-        ) {
141
-            // since the 'content-espresso_venues-details.php' template might be used directly from within a theme,
142
-            // it uses the_content() for displaying the $post->post_content
143
-            // so in order to load a template that uses the_content() from within a callback being used to filter the_content(),
144
-            // we need to first remove this callback from being applied to the_content() (otherwise it will recurse and blow up the interweb)
145
-            remove_filter('the_excerpt', array($this, 'venue_details'), 100);
146
-            remove_filter('the_content', array($this, 'venue_details'), 100);
147
-            // add filters we want
148
-            add_filter('the_content', array($this, 'venue_location'), 110);
149
-            add_filter('the_excerpt', array($this, 'venue_location'), 110);
150
-            // now load our template
151
-            $template = EEH_Template::locate_template('content-espresso_venues-details.php');
152
-            // now add our filter back in, plus some others
153
-            add_filter('the_excerpt', array($this, 'venue_details'), 100);
154
-            add_filter('the_content', array($this, 'venue_details'), 100);
155
-            // remove other filters we added so they won't get applied to the next post
156
-            remove_filter('the_content', array($this, 'venue_location'), 110);
157
-            remove_filter('the_excerpt', array($this, 'venue_location'), 110);
158
-            // we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt)
159
-        }
160
-        return ! empty($template) ? $template : $content;
161
-    }
162
-
163
-
164
-    /**
165
-     * venue_location
166
-     *
167
-     * @access public
168
-     * @param  string $content
169
-     * @return string
170
-     */
171
-    public function venue_location($content)
172
-    {
173
-        return $content . EEH_Template::locate_template('content-espresso_venues-location.php');
174
-    }
175
-
176
-
177
-    /**
178
-     *    wp_enqueue_scripts
179
-     *
180
-     * @access    public
181
-     * @return    void
182
-     */
183
-    public function wp_enqueue_scripts()
184
-    {
185
-        // get some style
186
-        if (apply_filters('FHEE_enable_default_espresso_css', true) && is_archive()) {
187
-            // first check theme folder
188
-            if (is_readable(get_stylesheet_directory() . $this->theme . DS . 'style.css')) {
189
-                wp_register_style(
190
-                    $this->theme,
191
-                    get_stylesheet_directory_uri() . $this->theme . DS . 'style.css',
192
-                    array('dashicons', 'espresso_default')
193
-                );
194
-            } elseif (is_readable(EE_TEMPLATES . $this->theme . DS . 'style.css')) {
195
-                wp_register_style(
196
-                    $this->theme,
197
-                    EE_TEMPLATES_URL . $this->theme . DS . 'style.css',
198
-                    array('dashicons', 'espresso_default')
199
-                );
200
-            }
201
-            wp_enqueue_style($this->theme);
202
-        }
203
-    }
32
+	/**
33
+	 * @return EED_Venues_Archive
34
+	 */
35
+	public static function instance()
36
+	{
37
+		return parent::get_instance(__CLASS__);
38
+	}
39
+
40
+
41
+	/**
42
+	 * set_hooks - for hooking into EE Core, other modules, etc
43
+	 *
44
+	 * @return void
45
+	 * @throws InvalidArgumentException
46
+	 * @throws InvalidDataTypeException
47
+	 * @throws InvalidInterfaceException
48
+	 */
49
+	public static function set_hooks()
50
+	{
51
+		/** @var EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions $custom_post_type_definitions */
52
+		$custom_post_type_definitions = LoaderFactory::getLoader()->getShared(
53
+			'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions'
54
+		);
55
+		$custom_post_types = $custom_post_type_definitions->getDefinitions();
56
+		EE_Config::register_route(
57
+			$custom_post_types['espresso_venues']['plural_slug'],
58
+			'Venues_Archive',
59
+			'run'
60
+		);
61
+	}
62
+
63
+	/**
64
+	 *    set_hooks_admin - for hooking into EE Admin Core, other modules, etc
65
+	 *
66
+	 * @access    public
67
+	 * @return    void
68
+	 */
69
+	public static function set_hooks_admin()
70
+	{
71
+	}
72
+
73
+
74
+	/**
75
+	 * run - initial module setup
76
+	 *
77
+	 * @access    public
78
+	 * @param \WP $WP
79
+	 */
80
+	public function run($WP)
81
+	{
82
+		// check what template is loaded
83
+		add_filter('template_include', array($this, 'template_include'), 999, 1);
84
+		add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10);
85
+	}
86
+
87
+
88
+	/**
89
+	 * template_include
90
+	 *
91
+	 * @access public
92
+	 * @param  string $template
93
+	 * @return string
94
+	 */
95
+	public function template_include($template)
96
+	{
97
+		// not a custom template?
98
+		if (EE_Registry::instance()->load_core('Front_Controller', array(), false, true)
99
+								   ->get_selected_template() != 'archive-espresso_venues.php'
100
+		) {
101
+			EEH_Template::load_espresso_theme_functions();
102
+			// then add extra event data via hooks
103
+			add_filter('the_title', array($this, 'the_title'), 100, 1);
104
+			// don't know if theme uses the_excerpt
105
+			add_filter('the_excerpt', array($this, 'venue_details'), 100);
106
+			// or the_content
107
+			add_filter('the_content', array($this, 'venue_details'), 100);
108
+			// don't display entry meta because the existing theme will take care of that
109
+			add_filter('FHEE__content_espresso_venues_details_template__display_entry_meta', '__return_false');
110
+		}
111
+		return $template;
112
+	}
113
+
114
+
115
+	/**
116
+	 * the_title
117
+	 *
118
+	 * @access public
119
+	 * @param  string $title
120
+	 * @return string
121
+	 */
122
+	public function the_title($title = '')
123
+	{
124
+		return $title;
125
+	}
126
+
127
+
128
+	/**
129
+	 *    venue_details
130
+	 *
131
+	 * @access public
132
+	 * @param  string $content
133
+	 * @return string
134
+	 */
135
+	public function venue_details($content)
136
+	{
137
+		global $post;
138
+		if ($post->post_type == 'espresso_venues'
139
+			&& ! post_password_required()
140
+		) {
141
+			// since the 'content-espresso_venues-details.php' template might be used directly from within a theme,
142
+			// it uses the_content() for displaying the $post->post_content
143
+			// so in order to load a template that uses the_content() from within a callback being used to filter the_content(),
144
+			// we need to first remove this callback from being applied to the_content() (otherwise it will recurse and blow up the interweb)
145
+			remove_filter('the_excerpt', array($this, 'venue_details'), 100);
146
+			remove_filter('the_content', array($this, 'venue_details'), 100);
147
+			// add filters we want
148
+			add_filter('the_content', array($this, 'venue_location'), 110);
149
+			add_filter('the_excerpt', array($this, 'venue_location'), 110);
150
+			// now load our template
151
+			$template = EEH_Template::locate_template('content-espresso_venues-details.php');
152
+			// now add our filter back in, plus some others
153
+			add_filter('the_excerpt', array($this, 'venue_details'), 100);
154
+			add_filter('the_content', array($this, 'venue_details'), 100);
155
+			// remove other filters we added so they won't get applied to the next post
156
+			remove_filter('the_content', array($this, 'venue_location'), 110);
157
+			remove_filter('the_excerpt', array($this, 'venue_location'), 110);
158
+			// we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt)
159
+		}
160
+		return ! empty($template) ? $template : $content;
161
+	}
162
+
163
+
164
+	/**
165
+	 * venue_location
166
+	 *
167
+	 * @access public
168
+	 * @param  string $content
169
+	 * @return string
170
+	 */
171
+	public function venue_location($content)
172
+	{
173
+		return $content . EEH_Template::locate_template('content-espresso_venues-location.php');
174
+	}
175
+
176
+
177
+	/**
178
+	 *    wp_enqueue_scripts
179
+	 *
180
+	 * @access    public
181
+	 * @return    void
182
+	 */
183
+	public function wp_enqueue_scripts()
184
+	{
185
+		// get some style
186
+		if (apply_filters('FHEE_enable_default_espresso_css', true) && is_archive()) {
187
+			// first check theme folder
188
+			if (is_readable(get_stylesheet_directory() . $this->theme . DS . 'style.css')) {
189
+				wp_register_style(
190
+					$this->theme,
191
+					get_stylesheet_directory_uri() . $this->theme . DS . 'style.css',
192
+					array('dashicons', 'espresso_default')
193
+				);
194
+			} elseif (is_readable(EE_TEMPLATES . $this->theme . DS . 'style.css')) {
195
+				wp_register_style(
196
+					$this->theme,
197
+					EE_TEMPLATES_URL . $this->theme . DS . 'style.css',
198
+					array('dashicons', 'espresso_default')
199
+				);
200
+			}
201
+			wp_enqueue_style($this->theme);
202
+		}
203
+	}
204 204
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
      */
171 171
     public function venue_location($content)
172 172
     {
173
-        return $content . EEH_Template::locate_template('content-espresso_venues-location.php');
173
+        return $content.EEH_Template::locate_template('content-espresso_venues-location.php');
174 174
     }
175 175
 
176 176
 
@@ -185,16 +185,16 @@  discard block
 block discarded – undo
185 185
         // get some style
186 186
         if (apply_filters('FHEE_enable_default_espresso_css', true) && is_archive()) {
187 187
             // first check theme folder
188
-            if (is_readable(get_stylesheet_directory() . $this->theme . DS . 'style.css')) {
188
+            if (is_readable(get_stylesheet_directory().$this->theme.DS.'style.css')) {
189 189
                 wp_register_style(
190 190
                     $this->theme,
191
-                    get_stylesheet_directory_uri() . $this->theme . DS . 'style.css',
191
+                    get_stylesheet_directory_uri().$this->theme.DS.'style.css',
192 192
                     array('dashicons', 'espresso_default')
193 193
                 );
194
-            } elseif (is_readable(EE_TEMPLATES . $this->theme . DS . 'style.css')) {
194
+            } elseif (is_readable(EE_TEMPLATES.$this->theme.DS.'style.css')) {
195 195
                 wp_register_style(
196 196
                     $this->theme,
197
-                    EE_TEMPLATES_URL . $this->theme . DS . 'style.css',
197
+                    EE_TEMPLATES_URL.$this->theme.DS.'style.css',
198 198
                     array('dashicons', 'espresso_default')
199 199
                 );
200 200
             }
Please login to merge, or discard this patch.
modules/bot_trap/EED_Bot_Trap.module.php 2 patches
Indentation   +311 added lines, -311 removed lines patch added patch discarded remove patch
@@ -15,340 +15,340 @@
 block discarded – undo
15 15
 {
16 16
 
17 17
 
18
-    /**
19
-     * @return EED_Bot_Trap|EED_Module
20
-     */
21
-    public static function instance()
22
-    {
23
-        return parent::get_instance(__CLASS__);
24
-    }
18
+	/**
19
+	 * @return EED_Bot_Trap|EED_Module
20
+	 */
21
+	public static function instance()
22
+	{
23
+		return parent::get_instance(__CLASS__);
24
+	}
25 25
 
26 26
 
27
-    /**
28
-     * set_hooks - for hooking into EE Core, other modules, etc
29
-     *
30
-     * @return void
31
-     */
32
-    public static function set_hooks()
33
-    {
34
-        if (apply_filters('FHEE__EED_Bot_Trap__set_hooks__use_bot_trap', true) &&
35
-            \EE_Registry::instance()->CFG->registration->use_bot_trap
36
-        ) {
37
-            \EED_Bot_Trap::set_trap();
38
-            // redirect bots to bogus success page
39
-            \EE_Config::register_route('ticket_selection_received', 'EED_Bot_Trap', 'display_bot_trap_success');
40
-        }
41
-    }
27
+	/**
28
+	 * set_hooks - for hooking into EE Core, other modules, etc
29
+	 *
30
+	 * @return void
31
+	 */
32
+	public static function set_hooks()
33
+	{
34
+		if (apply_filters('FHEE__EED_Bot_Trap__set_hooks__use_bot_trap', true) &&
35
+			\EE_Registry::instance()->CFG->registration->use_bot_trap
36
+		) {
37
+			\EED_Bot_Trap::set_trap();
38
+			// redirect bots to bogus success page
39
+			\EE_Config::register_route('ticket_selection_received', 'EED_Bot_Trap', 'display_bot_trap_success');
40
+		}
41
+	}
42 42
 
43 43
 
44
-    /**
45
-     * set_hooks_admin - for hooking into EE Admin Core, other modules, etc
46
-     *
47
-     * @return void
48
-     */
49
-    public static function set_trap()
50
-    {
51
-        define('EE_BOT_TRAP_BASE_URL', plugin_dir_url(__FILE__) . DS);
52
-        add_action(
53
-            'AHEE__ticket_selector_chart__template__after_ticket_selector',
54
-            array('EED_Bot_Trap', 'generate_bot_trap'),
55
-            10,
56
-            2
57
-        );
58
-        add_action(
59
-            'EED_Ticket_Selector__process_ticket_selections__before',
60
-            array('EED_Bot_Trap', 'process_bot_trap'),
61
-            1,
62
-            2
63
-        );
64
-    }
44
+	/**
45
+	 * set_hooks_admin - for hooking into EE Admin Core, other modules, etc
46
+	 *
47
+	 * @return void
48
+	 */
49
+	public static function set_trap()
50
+	{
51
+		define('EE_BOT_TRAP_BASE_URL', plugin_dir_url(__FILE__) . DS);
52
+		add_action(
53
+			'AHEE__ticket_selector_chart__template__after_ticket_selector',
54
+			array('EED_Bot_Trap', 'generate_bot_trap'),
55
+			10,
56
+			2
57
+		);
58
+		add_action(
59
+			'EED_Ticket_Selector__process_ticket_selections__before',
60
+			array('EED_Bot_Trap', 'process_bot_trap'),
61
+			1,
62
+			2
63
+		);
64
+	}
65 65
 
66 66
 
67
-    /**
68
-     * set_hooks_admin - for hooking into EE Admin Core, other modules, etc
69
-     *
70
-     * @return void
71
-     */
72
-    public static function set_hooks_admin()
73
-    {
74
-        if (defined('DOING_AJAX')
75
-            && DOING_AJAX
76
-            && apply_filters('FHEE__EED_Bot_Trap__set_hooks__use_bot_trap', true)
77
-            && \EE_Registry::instance()->CFG->registration->use_bot_trap
78
-        ) {
79
-            \EED_Bot_Trap::set_trap();
80
-        }
81
-        add_action(
82
-            'AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template',
83
-            array('EED_Bot_Trap', 'bot_trap_settings_form'),
84
-            5
85
-        );
86
-        add_filter(
87
-            'FHEE__Extend_Registration_Form_Admin_Page___update_reg_form_settings__CFG_registration',
88
-            array('EED_Bot_Trap', 'update_bot_trap_settings_form'),
89
-            10,
90
-            1
91
-        );
92
-    }
67
+	/**
68
+	 * set_hooks_admin - for hooking into EE Admin Core, other modules, etc
69
+	 *
70
+	 * @return void
71
+	 */
72
+	public static function set_hooks_admin()
73
+	{
74
+		if (defined('DOING_AJAX')
75
+			&& DOING_AJAX
76
+			&& apply_filters('FHEE__EED_Bot_Trap__set_hooks__use_bot_trap', true)
77
+			&& \EE_Registry::instance()->CFG->registration->use_bot_trap
78
+		) {
79
+			\EED_Bot_Trap::set_trap();
80
+		}
81
+		add_action(
82
+			'AHEE__Extend_Registration_Form_Admin_Page___reg_form_settings_template',
83
+			array('EED_Bot_Trap', 'bot_trap_settings_form'),
84
+			5
85
+		);
86
+		add_filter(
87
+			'FHEE__Extend_Registration_Form_Admin_Page___update_reg_form_settings__CFG_registration',
88
+			array('EED_Bot_Trap', 'update_bot_trap_settings_form'),
89
+			10,
90
+			1
91
+		);
92
+	}
93 93
 
94 94
 
95
-    /**
96
-     * run - initial module setup
97
-     *
98
-     * @param WP $WP
99
-     * @return void
100
-     */
101
-    public function run($WP)
102
-    {
103
-    }
95
+	/**
96
+	 * run - initial module setup
97
+	 *
98
+	 * @param WP $WP
99
+	 * @return void
100
+	 */
101
+	public function run($WP)
102
+	{
103
+	}
104 104
 
105 105
 
106
-    /**
107
-     * generate_bot_trap
108
-     *
109
-     * @return void
110
-     * @throws RuntimeException
111
-     */
112
-    public static function generate_bot_trap()
113
-    {
114
-        $do_not_enter = esc_html__('please do not enter anything in this input', 'event_espresso');
115
-        $time = microtime(true);
116
-        $html = '<div class="tkt-slctr-request-processor-dv" style="float:left; margin:0 0 0 -999em; height: 0;">';
117
-        $html .= '<label for="tkt-slctr-request-processor-email-' . $time . '">' . $do_not_enter . '</label>';
118
-        $html .= '<input type="email" id="tkt-slctr-request-processor-email-';
119
-        $html .= $time . '" name="tkt-slctr-request-processor-email" value=""/>';
120
-        $html .= '<input type="hidden" name="tkt-slctr-request-processor-token" value="';
121
-        if (EE_Registry::instance()->CFG->registration->use_encryption) {
122
-            EE_Registry::instance()->load_core('EE_Encryption');
123
-            $html .= EE_Encryption::instance()->encrypt($time);
124
-        } else {
125
-            $html .= $time;
126
-        }
127
-        $html .= '"/>';
128
-        $html .= '</div><!-- .tkt-slctr-request-processor-dv -->';
129
-        echo $html;
130
-    }
106
+	/**
107
+	 * generate_bot_trap
108
+	 *
109
+	 * @return void
110
+	 * @throws RuntimeException
111
+	 */
112
+	public static function generate_bot_trap()
113
+	{
114
+		$do_not_enter = esc_html__('please do not enter anything in this input', 'event_espresso');
115
+		$time = microtime(true);
116
+		$html = '<div class="tkt-slctr-request-processor-dv" style="float:left; margin:0 0 0 -999em; height: 0;">';
117
+		$html .= '<label for="tkt-slctr-request-processor-email-' . $time . '">' . $do_not_enter . '</label>';
118
+		$html .= '<input type="email" id="tkt-slctr-request-processor-email-';
119
+		$html .= $time . '" name="tkt-slctr-request-processor-email" value=""/>';
120
+		$html .= '<input type="hidden" name="tkt-slctr-request-processor-token" value="';
121
+		if (EE_Registry::instance()->CFG->registration->use_encryption) {
122
+			EE_Registry::instance()->load_core('EE_Encryption');
123
+			$html .= EE_Encryption::instance()->encrypt($time);
124
+		} else {
125
+			$html .= $time;
126
+		}
127
+		$html .= '"/>';
128
+		$html .= '</div><!-- .tkt-slctr-request-processor-dv -->';
129
+		echo $html;
130
+	}
131 131
 
132 132
 
133
-    /**
134
-     * process_bot_trap
135
-     *
136
-     * @param array|string $triggered_trap_callback Callback that will be executed for handling the
137
-     *                                              response if the bot trap is triggered.
138
-     *                                              It should receive one argument: a boolean indicating
139
-     *                                              whether the trap was triggered by suspicious timing or not.
140
-     * @throws RuntimeException
141
-     */
142
-    public static function process_bot_trap($triggered_trap_callback = array())
143
-    {
144
-        // what's your email address Mr. Bot ?
145
-        $empty_trap = isset($_REQUEST['tkt-slctr-request-processor-email'])
146
-                      && $_REQUEST['tkt-slctr-request-processor-email'] === '';
147
-        // get encrypted timestamp for when the form was originally displayed
148
-        $bot_trap_timestamp = isset($_REQUEST['tkt-slctr-request-processor-token'])
149
-            ? sanitize_text_field($_REQUEST['tkt-slctr-request-processor-token'])
150
-            : '';
151
-        // decrypt and convert to absolute  integer
152
-        if (EE_Registry::instance()->CFG->registration->use_encryption) {
153
-            EE_Registry::instance()->load_core('EE_Encryption');
154
-            $bot_trap_timestamp = absint(EE_Encryption::instance()->decrypt($bot_trap_timestamp));
155
-        } else {
156
-            $bot_trap_timestamp = absint($bot_trap_timestamp);
157
-        }
158
-        // ticket form submitted too impossibly fast ( after now ) or more than an hour later ???
159
-        $suspicious_timing = $bot_trap_timestamp > time() || $bot_trap_timestamp < (time() - HOUR_IN_SECONDS);
160
-        // are we human ?
161
-        if ($empty_trap && ! $suspicious_timing) {
162
-            do_action('AHEE__EED_Bot_Trap__process_bot_trap__trap_not_triggered');
163
-            return;
164
-        }
165
-        // check the given callback is valid first before executing
166
-        if (! is_callable($triggered_trap_callback)) {
167
-            // invalid callback so lets just sub in our default.
168
-            $triggered_trap_callback = array('EED_Bot_Trap', 'triggered_trap_response');
169
-        }
170
-        call_user_func($triggered_trap_callback, $suspicious_timing);
171
-    }
133
+	/**
134
+	 * process_bot_trap
135
+	 *
136
+	 * @param array|string $triggered_trap_callback Callback that will be executed for handling the
137
+	 *                                              response if the bot trap is triggered.
138
+	 *                                              It should receive one argument: a boolean indicating
139
+	 *                                              whether the trap was triggered by suspicious timing or not.
140
+	 * @throws RuntimeException
141
+	 */
142
+	public static function process_bot_trap($triggered_trap_callback = array())
143
+	{
144
+		// what's your email address Mr. Bot ?
145
+		$empty_trap = isset($_REQUEST['tkt-slctr-request-processor-email'])
146
+					  && $_REQUEST['tkt-slctr-request-processor-email'] === '';
147
+		// get encrypted timestamp for when the form was originally displayed
148
+		$bot_trap_timestamp = isset($_REQUEST['tkt-slctr-request-processor-token'])
149
+			? sanitize_text_field($_REQUEST['tkt-slctr-request-processor-token'])
150
+			: '';
151
+		// decrypt and convert to absolute  integer
152
+		if (EE_Registry::instance()->CFG->registration->use_encryption) {
153
+			EE_Registry::instance()->load_core('EE_Encryption');
154
+			$bot_trap_timestamp = absint(EE_Encryption::instance()->decrypt($bot_trap_timestamp));
155
+		} else {
156
+			$bot_trap_timestamp = absint($bot_trap_timestamp);
157
+		}
158
+		// ticket form submitted too impossibly fast ( after now ) or more than an hour later ???
159
+		$suspicious_timing = $bot_trap_timestamp > time() || $bot_trap_timestamp < (time() - HOUR_IN_SECONDS);
160
+		// are we human ?
161
+		if ($empty_trap && ! $suspicious_timing) {
162
+			do_action('AHEE__EED_Bot_Trap__process_bot_trap__trap_not_triggered');
163
+			return;
164
+		}
165
+		// check the given callback is valid first before executing
166
+		if (! is_callable($triggered_trap_callback)) {
167
+			// invalid callback so lets just sub in our default.
168
+			$triggered_trap_callback = array('EED_Bot_Trap', 'triggered_trap_response');
169
+		}
170
+		call_user_func($triggered_trap_callback, $suspicious_timing);
171
+	}
172 172
 
173 173
 
174
-    /**
175
-     * This is the default callback executed by EED_Bot_Trap::process_bot_trap that handles the response.
176
-     *
177
-     * @param bool $suspicious_timing If true, then the bot trap was triggered due to the suspicious timing test.
178
-     */
179
-    public static function triggered_trap_response($suspicious_timing)
180
-    {
181
-        // UH OH...
182
-        $redirect_url = add_query_arg(
183
-            array('ee' => 'ticket_selection_received'),
184
-            EE_Registry::instance()->CFG->core->reg_page_url()
185
-        );
186
-        if ($suspicious_timing) {
187
-            $redirect_url = add_query_arg(
188
-                array(
189
-                    'ee-notice' => urlencode(
190
-                        esc_html__(
191
-                            'We\'re sorry, but your ticket selections could not be processed due to a server timing error. Please hit the back button on your browser and try again.',
192
-                            'event_espresso'
193
-                        )
194
-                    ),
195
-                ),
196
-                $redirect_url
197
-            );
198
-        }
199
-        $redirect_url = apply_filters('FHEE__EED_Bot_Trap__process_bot_trap__redirect_url', $redirect_url);
200
-        // if AJAX, return the redirect URL
201
-        if (defined('DOING_AJAX') && DOING_AJAX) {
202
-            echo wp_json_encode(
203
-                array_merge(
204
-                    EE_Error::get_notices(false),
205
-                    array(
206
-                        'redirect_url' => $redirect_url,
207
-                    )
208
-                )
209
-            );
210
-            exit();
211
-        }
212
-        wp_safe_redirect($redirect_url);
213
-        exit();
214
-    }
174
+	/**
175
+	 * This is the default callback executed by EED_Bot_Trap::process_bot_trap that handles the response.
176
+	 *
177
+	 * @param bool $suspicious_timing If true, then the bot trap was triggered due to the suspicious timing test.
178
+	 */
179
+	public static function triggered_trap_response($suspicious_timing)
180
+	{
181
+		// UH OH...
182
+		$redirect_url = add_query_arg(
183
+			array('ee' => 'ticket_selection_received'),
184
+			EE_Registry::instance()->CFG->core->reg_page_url()
185
+		);
186
+		if ($suspicious_timing) {
187
+			$redirect_url = add_query_arg(
188
+				array(
189
+					'ee-notice' => urlencode(
190
+						esc_html__(
191
+							'We\'re sorry, but your ticket selections could not be processed due to a server timing error. Please hit the back button on your browser and try again.',
192
+							'event_espresso'
193
+						)
194
+					),
195
+				),
196
+				$redirect_url
197
+			);
198
+		}
199
+		$redirect_url = apply_filters('FHEE__EED_Bot_Trap__process_bot_trap__redirect_url', $redirect_url);
200
+		// if AJAX, return the redirect URL
201
+		if (defined('DOING_AJAX') && DOING_AJAX) {
202
+			echo wp_json_encode(
203
+				array_merge(
204
+					EE_Error::get_notices(false),
205
+					array(
206
+						'redirect_url' => $redirect_url,
207
+					)
208
+				)
209
+			);
210
+			exit();
211
+		}
212
+		wp_safe_redirect($redirect_url);
213
+		exit();
214
+	}
215 215
 
216 216
 
217
-    /**
218
-     * display_bot_trap_success
219
-     * shows a "success" screen to bots so that they (ie: the ppl managing them)
220
-     * think the form was submitted successfully
221
-     *
222
-     * @return void
223
-     */
224
-    public static function display_bot_trap_success()
225
-    {
226
-        add_filter('FHEE__EED_Single_Page_Checkout__run', '__return_false');
227
-        $bot_notice = esc_html__(
228
-            'Thank you so much. Your ticket selections have been received for consideration.',
229
-            'event_espresso'
230
-        );
231
-        $bot_notice = isset($_REQUEST['ee-notice']) && $_REQUEST['ee-notice'] !== ''
232
-            ? sanitize_text_field(stripslashes($_REQUEST['ee-notice']))
233
-            : $bot_notice;
234
-        EE_Registry::instance()->REQ->add_output(EEH_HTML::div($bot_notice, '', 'ee-attention'));
235
-    }
217
+	/**
218
+	 * display_bot_trap_success
219
+	 * shows a "success" screen to bots so that they (ie: the ppl managing them)
220
+	 * think the form was submitted successfully
221
+	 *
222
+	 * @return void
223
+	 */
224
+	public static function display_bot_trap_success()
225
+	{
226
+		add_filter('FHEE__EED_Single_Page_Checkout__run', '__return_false');
227
+		$bot_notice = esc_html__(
228
+			'Thank you so much. Your ticket selections have been received for consideration.',
229
+			'event_espresso'
230
+		);
231
+		$bot_notice = isset($_REQUEST['ee-notice']) && $_REQUEST['ee-notice'] !== ''
232
+			? sanitize_text_field(stripslashes($_REQUEST['ee-notice']))
233
+			: $bot_notice;
234
+		EE_Registry::instance()->REQ->add_output(EEH_HTML::div($bot_notice, '', 'ee-attention'));
235
+	}
236 236
 
237 237
 
238 238
 
239
-    /***********************************    ADMIN    **********************************/
239
+	/***********************************    ADMIN    **********************************/
240 240
 
241 241
 
242
-    /**
243
-     * bot_trap_settings_form
244
-     *
245
-     * @return void
246
-     * @throws EE_Error
247
-     */
248
-    public static function bot_trap_settings_form()
249
-    {
250
-        EED_Bot_Trap::_bot_trap_settings_form()->enqueue_js();
251
-        echo EED_Bot_Trap::_bot_trap_settings_form()->get_html();
252
-    }
242
+	/**
243
+	 * bot_trap_settings_form
244
+	 *
245
+	 * @return void
246
+	 * @throws EE_Error
247
+	 */
248
+	public static function bot_trap_settings_form()
249
+	{
250
+		EED_Bot_Trap::_bot_trap_settings_form()->enqueue_js();
251
+		echo EED_Bot_Trap::_bot_trap_settings_form()->get_html();
252
+	}
253 253
 
254 254
 
255
-    /**
256
-     * _bot_trap_settings_form
257
-     *
258
-     * @return EE_Form_Section_Proper
259
-     * @throws EE_Error
260
-     */
261
-    protected static function _bot_trap_settings_form()
262
-    {
263
-        return new EE_Form_Section_Proper(
264
-            array(
265
-                'name'            => 'bot_trap_settings',
266
-                'html_id'         => 'bot_trap_settings',
267
-                'layout_strategy' => new EE_Admin_Two_Column_Layout(),
268
-                'subsections'     => array(
269
-                    'bot_trap_hdr'   => new EE_Form_Section_HTML(
270
-                        EEH_HTML::h2(esc_html__('Bot Trap Settings', 'event_espresso'))
271
-                    ),
272
-                    'use_bot_trap'   => new EE_Yes_No_Input(
273
-                        array(
274
-                            'html_label_text' => esc_html__('Enable Bot Trap', 'event_espresso'),
275
-                            'html_help_text'  => esc_html__(
276
-                                'The Event Espresso Bot Trap will insert a fake input into your Ticket Selector forms that is hidden from regular site visitors, but visible to spam bots. Because the input asks for an email address, it is irresistible to spam bots who will of course enter text into it. Since regular site visitors can not see this input, any value detected during form submission means a bot has been detected, which will then be blocked from submitting the form.',
277
-                                'event_espresso'
278
-                            ),
279
-                            'default'         => EE_Registry::instance()->CFG->registration->use_bot_trap !== null
280
-                                ? EE_Registry::instance()->CFG->registration->use_bot_trap
281
-                                : true,
282
-                            'required'        => false,
283
-                        )
284
-                    ),
285
-                    'use_encryption' => new EE_Yes_No_Input(
286
-                        array(
287
-                            'html_label_text' => esc_html__('Encrypt Bot Trap Data', 'event_espresso'),
288
-                            'html_help_text'  => esc_html__(
289
-                                'One way to detect spam bots is by looking at how long it takes them to submit a form. They are often inhumanly fast, or will submit forms hours, days, or even weeks after the form was first scraped off the web. The Event Espresso Bot Trap will send a timestamp with the Ticket Selector form when it is submitted. By default, this timestamp is encrypted so that the spam bots can not change it, but encryption may cause issues on some servers due to configuration "conflicts". If you continuously get caught in the bot trap, then try setting this option to "No". This may increase the number of spam submissions you receive, but increases server compatibility.',
290
-                                'event_espresso'
291
-                            ),
292
-                            'default'         => EE_Registry::instance()->CFG->registration->use_encryption !== null
293
-                                ? EE_Registry::instance()->CFG->registration->use_encryption
294
-                                : true,
295
-                            'required'        => false,
296
-                        )
297
-                    ),
298
-                ),
299
-            )
300
-        );
301
-    }
255
+	/**
256
+	 * _bot_trap_settings_form
257
+	 *
258
+	 * @return EE_Form_Section_Proper
259
+	 * @throws EE_Error
260
+	 */
261
+	protected static function _bot_trap_settings_form()
262
+	{
263
+		return new EE_Form_Section_Proper(
264
+			array(
265
+				'name'            => 'bot_trap_settings',
266
+				'html_id'         => 'bot_trap_settings',
267
+				'layout_strategy' => new EE_Admin_Two_Column_Layout(),
268
+				'subsections'     => array(
269
+					'bot_trap_hdr'   => new EE_Form_Section_HTML(
270
+						EEH_HTML::h2(esc_html__('Bot Trap Settings', 'event_espresso'))
271
+					),
272
+					'use_bot_trap'   => new EE_Yes_No_Input(
273
+						array(
274
+							'html_label_text' => esc_html__('Enable Bot Trap', 'event_espresso'),
275
+							'html_help_text'  => esc_html__(
276
+								'The Event Espresso Bot Trap will insert a fake input into your Ticket Selector forms that is hidden from regular site visitors, but visible to spam bots. Because the input asks for an email address, it is irresistible to spam bots who will of course enter text into it. Since regular site visitors can not see this input, any value detected during form submission means a bot has been detected, which will then be blocked from submitting the form.',
277
+								'event_espresso'
278
+							),
279
+							'default'         => EE_Registry::instance()->CFG->registration->use_bot_trap !== null
280
+								? EE_Registry::instance()->CFG->registration->use_bot_trap
281
+								: true,
282
+							'required'        => false,
283
+						)
284
+					),
285
+					'use_encryption' => new EE_Yes_No_Input(
286
+						array(
287
+							'html_label_text' => esc_html__('Encrypt Bot Trap Data', 'event_espresso'),
288
+							'html_help_text'  => esc_html__(
289
+								'One way to detect spam bots is by looking at how long it takes them to submit a form. They are often inhumanly fast, or will submit forms hours, days, or even weeks after the form was first scraped off the web. The Event Espresso Bot Trap will send a timestamp with the Ticket Selector form when it is submitted. By default, this timestamp is encrypted so that the spam bots can not change it, but encryption may cause issues on some servers due to configuration "conflicts". If you continuously get caught in the bot trap, then try setting this option to "No". This may increase the number of spam submissions you receive, but increases server compatibility.',
290
+								'event_espresso'
291
+							),
292
+							'default'         => EE_Registry::instance()->CFG->registration->use_encryption !== null
293
+								? EE_Registry::instance()->CFG->registration->use_encryption
294
+								: true,
295
+							'required'        => false,
296
+						)
297
+					),
298
+				),
299
+			)
300
+		);
301
+	}
302 302
 
303 303
 
304
-    /**
305
-     * update_bot_trap_settings_form
306
-     *
307
-     * @param EE_Registration_Config $EE_Registration_Config
308
-     * @return EE_Registration_Config
309
-     * @throws ReflectionException
310
-     * @throws EE_Error
311
-     */
312
-    public static function update_bot_trap_settings_form(EE_Registration_Config $EE_Registration_Config)
313
-    {
314
-        try {
315
-            $bot_trap_settings_form = EED_Bot_Trap::_bot_trap_settings_form();
316
-            // if not displaying a form, then check for form submission
317
-            if ($bot_trap_settings_form->was_submitted()) {
318
-                // capture form data
319
-                $bot_trap_settings_form->receive_form_submission();
320
-                // validate form data
321
-                if ($bot_trap_settings_form->is_valid()) {
322
-                    // grab validated data from form
323
-                    $valid_data = $bot_trap_settings_form->valid_data();
324
-                    if (isset($valid_data['use_bot_trap'], $valid_data['use_encryption'])) {
325
-                        $EE_Registration_Config->use_bot_trap = $valid_data['use_bot_trap'];
326
-                        $EE_Registration_Config->use_encryption = $valid_data['use_encryption'];
327
-                    } else {
328
-                        EE_Error::add_error(
329
-                            esc_html__(
330
-                                'Invalid or missing Bot Trap settings. Please refresh the form and try again.',
331
-                                'event_espresso'
332
-                            ),
333
-                            __FILE__,
334
-                            __FUNCTION__,
335
-                            __LINE__
336
-                        );
337
-                    }
338
-                } else {
339
-                    if ($bot_trap_settings_form->submission_error_message() !== '') {
340
-                        EE_Error::add_error(
341
-                            $bot_trap_settings_form->submission_error_message(),
342
-                            __FILE__,
343
-                            __FUNCTION__,
344
-                            __LINE__
345
-                        );
346
-                    }
347
-                }
348
-            }
349
-        } catch (EE_Error $e) {
350
-            $e->get_error();
351
-        }
352
-        return $EE_Registration_Config;
353
-    }
304
+	/**
305
+	 * update_bot_trap_settings_form
306
+	 *
307
+	 * @param EE_Registration_Config $EE_Registration_Config
308
+	 * @return EE_Registration_Config
309
+	 * @throws ReflectionException
310
+	 * @throws EE_Error
311
+	 */
312
+	public static function update_bot_trap_settings_form(EE_Registration_Config $EE_Registration_Config)
313
+	{
314
+		try {
315
+			$bot_trap_settings_form = EED_Bot_Trap::_bot_trap_settings_form();
316
+			// if not displaying a form, then check for form submission
317
+			if ($bot_trap_settings_form->was_submitted()) {
318
+				// capture form data
319
+				$bot_trap_settings_form->receive_form_submission();
320
+				// validate form data
321
+				if ($bot_trap_settings_form->is_valid()) {
322
+					// grab validated data from form
323
+					$valid_data = $bot_trap_settings_form->valid_data();
324
+					if (isset($valid_data['use_bot_trap'], $valid_data['use_encryption'])) {
325
+						$EE_Registration_Config->use_bot_trap = $valid_data['use_bot_trap'];
326
+						$EE_Registration_Config->use_encryption = $valid_data['use_encryption'];
327
+					} else {
328
+						EE_Error::add_error(
329
+							esc_html__(
330
+								'Invalid or missing Bot Trap settings. Please refresh the form and try again.',
331
+								'event_espresso'
332
+							),
333
+							__FILE__,
334
+							__FUNCTION__,
335
+							__LINE__
336
+						);
337
+					}
338
+				} else {
339
+					if ($bot_trap_settings_form->submission_error_message() !== '') {
340
+						EE_Error::add_error(
341
+							$bot_trap_settings_form->submission_error_message(),
342
+							__FILE__,
343
+							__FUNCTION__,
344
+							__LINE__
345
+						);
346
+					}
347
+				}
348
+			}
349
+		} catch (EE_Error $e) {
350
+			$e->get_error();
351
+		}
352
+		return $EE_Registration_Config;
353
+	}
354 354
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
      */
49 49
     public static function set_trap()
50 50
     {
51
-        define('EE_BOT_TRAP_BASE_URL', plugin_dir_url(__FILE__) . DS);
51
+        define('EE_BOT_TRAP_BASE_URL', plugin_dir_url(__FILE__).DS);
52 52
         add_action(
53 53
             'AHEE__ticket_selector_chart__template__after_ticket_selector',
54 54
             array('EED_Bot_Trap', 'generate_bot_trap'),
@@ -114,9 +114,9 @@  discard block
 block discarded – undo
114 114
         $do_not_enter = esc_html__('please do not enter anything in this input', 'event_espresso');
115 115
         $time = microtime(true);
116 116
         $html = '<div class="tkt-slctr-request-processor-dv" style="float:left; margin:0 0 0 -999em; height: 0;">';
117
-        $html .= '<label for="tkt-slctr-request-processor-email-' . $time . '">' . $do_not_enter . '</label>';
117
+        $html .= '<label for="tkt-slctr-request-processor-email-'.$time.'">'.$do_not_enter.'</label>';
118 118
         $html .= '<input type="email" id="tkt-slctr-request-processor-email-';
119
-        $html .= $time . '" name="tkt-slctr-request-processor-email" value=""/>';
119
+        $html .= $time.'" name="tkt-slctr-request-processor-email" value=""/>';
120 120
         $html .= '<input type="hidden" name="tkt-slctr-request-processor-token" value="';
121 121
         if (EE_Registry::instance()->CFG->registration->use_encryption) {
122 122
             EE_Registry::instance()->load_core('EE_Encryption');
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
             return;
164 164
         }
165 165
         // check the given callback is valid first before executing
166
-        if (! is_callable($triggered_trap_callback)) {
166
+        if ( ! is_callable($triggered_trap_callback)) {
167 167
             // invalid callback so lets just sub in our default.
168 168
             $triggered_trap_callback = array('EED_Bot_Trap', 'triggered_trap_response');
169 169
         }
Please login to merge, or discard this patch.
modules/venue_single/EED_Venue_Single.module.php 2 patches
Indentation   +167 added lines, -167 removed lines patch added patch discarded remove patch
@@ -29,171 +29,171 @@
 block discarded – undo
29 29
 class EED_Venue_Single extends EED_Module
30 30
 {
31 31
 
32
-    /**
33
-     * @return EED_Venue_Single
34
-     */
35
-    public static function instance()
36
-    {
37
-        return parent::get_instance(__CLASS__);
38
-    }
39
-
40
-
41
-    /**
42
-     * set_hooks - for hooking into EE Core, other modules, etc
43
-     *
44
-     * @return void
45
-     * @throws InvalidArgumentException
46
-     * @throws InvalidDataTypeException
47
-     * @throws InvalidInterfaceException
48
-     */
49
-    public static function set_hooks()
50
-    {
51
-        /** @var EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions $custom_post_type_definitions */
52
-        $custom_post_type_definitions = LoaderFactory::getLoader()->getShared(
53
-            'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions'
54
-        );
55
-        $custom_post_types = $custom_post_type_definitions->getDefinitions();
56
-        EE_Config::register_route(
57
-            $custom_post_types['espresso_venues']['singular_slug'],
58
-            'Venue_Single',
59
-            'run'
60
-        );
61
-    }
62
-
63
-    /**
64
-     *    set_hooks_admin - for hooking into EE Admin Core, other modules, etc
65
-     *
66
-     * @access    public
67
-     * @return    void
68
-     */
69
-    public static function set_hooks_admin()
70
-    {
71
-    }
72
-
73
-
74
-    /**
75
-     * run - initial module setup
76
-     *
77
-     * @access    public
78
-     * @param \WP $WP
79
-     */
80
-    public function run($WP)
81
-    {
82
-        // check what template is loaded
83
-        add_filter('template_include', array($this, 'template_include'), 999, 1);
84
-        add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10);
85
-    }
86
-
87
-
88
-    /**
89
-     * template_include
90
-     *
91
-     * @access public
92
-     * @param  string $template
93
-     * @return string
94
-     */
95
-    public function template_include($template)
96
-    {
97
-        // not a custom template?
98
-        if (EE_Registry::instance()
99
-                       ->load_core('Front_Controller', array(), false, true)
100
-                       ->get_selected_template() != 'single-espresso_venues.php'
101
-        ) {
102
-            EEH_Template::load_espresso_theme_functions();
103
-            // then add extra event data via hooks
104
-            add_filter('the_title', array($this, 'the_title'), 100, 1);
105
-            add_filter('the_content', array($this, 'venue_details'), 100);
106
-            // don't display entry meta because the existing theme will take car of that
107
-            add_filter('FHEE__content_espresso_venues_details_template__display_entry_meta', '__return_false');
108
-        }
109
-        return $template;
110
-    }
111
-
112
-
113
-    /**
114
-     * the_title
115
-     *
116
-     * @access public
117
-     * @param  string $title
118
-     * @return string
119
-     */
120
-    public function the_title($title = '')
121
-    {
122
-        return $title;
123
-    }
124
-
125
-
126
-    /**
127
-     *    venue_details
128
-     *
129
-     * @access public
130
-     * @param  string $content
131
-     * @return string
132
-     */
133
-    public function venue_details($content)
134
-    {
135
-        global $post;
136
-        if ($post->post_type == 'espresso_venues'
137
-            && ! post_password_required()
138
-        ) {
139
-            // since the 'content-espresso_venues-details.php' template might be used directly from within a theme,
140
-            // it uses the_content() for displaying the $post->post_content
141
-            // so in order to load a template that uses the_content() from within a callback being used to filter the_content(),
142
-            // we need to first remove this callback from being applied to the_content() (otherwise it will recurse and blow up the interweb)
143
-            remove_filter('the_content', array($this, 'venue_details'), 100);
144
-            // add filters we want
145
-            add_filter('the_content', array($this, 'venue_location'), 110);
146
-            // now load our template
147
-            $template = EEH_Template::locate_template('content-espresso_venues-details.php');
148
-            // remove other filters we added so they won't get applied to the next post
149
-            remove_filter('the_content', array($this, 'venue_location'), 110);
150
-        }
151
-        // we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt)
152
-        return ! empty($template) ? $template : $content;
153
-    }
154
-
155
-
156
-    /**
157
-     * venue_location
158
-     *
159
-     * @access public
160
-     * @param  string $content
161
-     * @return string
162
-     */
163
-    public function venue_location($content)
164
-    {
165
-        return $content . EEH_Template::locate_template('content-espresso_venues-location.php');
166
-    }
167
-
168
-
169
-    /**
170
-     *    wp_enqueue_scripts
171
-     *
172
-     * @access public
173
-     * @return void
174
-     */
175
-    public function wp_enqueue_scripts()
176
-    {
177
-        // get some style
178
-        if (apply_filters('FHEE_enable_default_espresso_css', true) && is_single()) {
179
-            // first check theme folder
180
-            if (is_readable(get_stylesheet_directory() . $this->theme . DS . 'style.css')) {
181
-                wp_register_style(
182
-                    $this->theme,
183
-                    get_stylesheet_directory_uri() . $this->theme . DS . 'style.css',
184
-                    array('dashicons', 'espresso_default')
185
-                );
186
-            } elseif (is_readable(EE_TEMPLATES . $this->theme . DS . 'style.css')) {
187
-                wp_register_style(
188
-                    $this->theme,
189
-                    EE_TEMPLATES_URL . $this->theme . DS . 'style.css',
190
-                    array('dashicons', 'espresso_default')
191
-                );
192
-            }
193
-            wp_enqueue_style($this->theme);
194
-            if (EE_Registry::instance()->CFG->map_settings->use_google_maps) {
195
-                add_action('wp_enqueue_scripts', array('EEH_Maps', 'espresso_google_map_js'), 11);
196
-            }
197
-        }
198
-    }
32
+	/**
33
+	 * @return EED_Venue_Single
34
+	 */
35
+	public static function instance()
36
+	{
37
+		return parent::get_instance(__CLASS__);
38
+	}
39
+
40
+
41
+	/**
42
+	 * set_hooks - for hooking into EE Core, other modules, etc
43
+	 *
44
+	 * @return void
45
+	 * @throws InvalidArgumentException
46
+	 * @throws InvalidDataTypeException
47
+	 * @throws InvalidInterfaceException
48
+	 */
49
+	public static function set_hooks()
50
+	{
51
+		/** @var EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions $custom_post_type_definitions */
52
+		$custom_post_type_definitions = LoaderFactory::getLoader()->getShared(
53
+			'EventEspresso\core\domain\entities\custom_post_types\CustomPostTypeDefinitions'
54
+		);
55
+		$custom_post_types = $custom_post_type_definitions->getDefinitions();
56
+		EE_Config::register_route(
57
+			$custom_post_types['espresso_venues']['singular_slug'],
58
+			'Venue_Single',
59
+			'run'
60
+		);
61
+	}
62
+
63
+	/**
64
+	 *    set_hooks_admin - for hooking into EE Admin Core, other modules, etc
65
+	 *
66
+	 * @access    public
67
+	 * @return    void
68
+	 */
69
+	public static function set_hooks_admin()
70
+	{
71
+	}
72
+
73
+
74
+	/**
75
+	 * run - initial module setup
76
+	 *
77
+	 * @access    public
78
+	 * @param \WP $WP
79
+	 */
80
+	public function run($WP)
81
+	{
82
+		// check what template is loaded
83
+		add_filter('template_include', array($this, 'template_include'), 999, 1);
84
+		add_action('wp_enqueue_scripts', array($this, 'wp_enqueue_scripts'), 10);
85
+	}
86
+
87
+
88
+	/**
89
+	 * template_include
90
+	 *
91
+	 * @access public
92
+	 * @param  string $template
93
+	 * @return string
94
+	 */
95
+	public function template_include($template)
96
+	{
97
+		// not a custom template?
98
+		if (EE_Registry::instance()
99
+					   ->load_core('Front_Controller', array(), false, true)
100
+					   ->get_selected_template() != 'single-espresso_venues.php'
101
+		) {
102
+			EEH_Template::load_espresso_theme_functions();
103
+			// then add extra event data via hooks
104
+			add_filter('the_title', array($this, 'the_title'), 100, 1);
105
+			add_filter('the_content', array($this, 'venue_details'), 100);
106
+			// don't display entry meta because the existing theme will take car of that
107
+			add_filter('FHEE__content_espresso_venues_details_template__display_entry_meta', '__return_false');
108
+		}
109
+		return $template;
110
+	}
111
+
112
+
113
+	/**
114
+	 * the_title
115
+	 *
116
+	 * @access public
117
+	 * @param  string $title
118
+	 * @return string
119
+	 */
120
+	public function the_title($title = '')
121
+	{
122
+		return $title;
123
+	}
124
+
125
+
126
+	/**
127
+	 *    venue_details
128
+	 *
129
+	 * @access public
130
+	 * @param  string $content
131
+	 * @return string
132
+	 */
133
+	public function venue_details($content)
134
+	{
135
+		global $post;
136
+		if ($post->post_type == 'espresso_venues'
137
+			&& ! post_password_required()
138
+		) {
139
+			// since the 'content-espresso_venues-details.php' template might be used directly from within a theme,
140
+			// it uses the_content() for displaying the $post->post_content
141
+			// so in order to load a template that uses the_content() from within a callback being used to filter the_content(),
142
+			// we need to first remove this callback from being applied to the_content() (otherwise it will recurse and blow up the interweb)
143
+			remove_filter('the_content', array($this, 'venue_details'), 100);
144
+			// add filters we want
145
+			add_filter('the_content', array($this, 'venue_location'), 110);
146
+			// now load our template
147
+			$template = EEH_Template::locate_template('content-espresso_venues-details.php');
148
+			// remove other filters we added so they won't get applied to the next post
149
+			remove_filter('the_content', array($this, 'venue_location'), 110);
150
+		}
151
+		// we're not returning the $content directly because the template we are loading uses the_content (or the_excerpt)
152
+		return ! empty($template) ? $template : $content;
153
+	}
154
+
155
+
156
+	/**
157
+	 * venue_location
158
+	 *
159
+	 * @access public
160
+	 * @param  string $content
161
+	 * @return string
162
+	 */
163
+	public function venue_location($content)
164
+	{
165
+		return $content . EEH_Template::locate_template('content-espresso_venues-location.php');
166
+	}
167
+
168
+
169
+	/**
170
+	 *    wp_enqueue_scripts
171
+	 *
172
+	 * @access public
173
+	 * @return void
174
+	 */
175
+	public function wp_enqueue_scripts()
176
+	{
177
+		// get some style
178
+		if (apply_filters('FHEE_enable_default_espresso_css', true) && is_single()) {
179
+			// first check theme folder
180
+			if (is_readable(get_stylesheet_directory() . $this->theme . DS . 'style.css')) {
181
+				wp_register_style(
182
+					$this->theme,
183
+					get_stylesheet_directory_uri() . $this->theme . DS . 'style.css',
184
+					array('dashicons', 'espresso_default')
185
+				);
186
+			} elseif (is_readable(EE_TEMPLATES . $this->theme . DS . 'style.css')) {
187
+				wp_register_style(
188
+					$this->theme,
189
+					EE_TEMPLATES_URL . $this->theme . DS . 'style.css',
190
+					array('dashicons', 'espresso_default')
191
+				);
192
+			}
193
+			wp_enqueue_style($this->theme);
194
+			if (EE_Registry::instance()->CFG->map_settings->use_google_maps) {
195
+				add_action('wp_enqueue_scripts', array('EEH_Maps', 'espresso_google_map_js'), 11);
196
+			}
197
+		}
198
+	}
199 199
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
      */
163 163
     public function venue_location($content)
164 164
     {
165
-        return $content . EEH_Template::locate_template('content-espresso_venues-location.php');
165
+        return $content.EEH_Template::locate_template('content-espresso_venues-location.php');
166 166
     }
167 167
 
168 168
 
@@ -177,16 +177,16 @@  discard block
 block discarded – undo
177 177
         // get some style
178 178
         if (apply_filters('FHEE_enable_default_espresso_css', true) && is_single()) {
179 179
             // first check theme folder
180
-            if (is_readable(get_stylesheet_directory() . $this->theme . DS . 'style.css')) {
180
+            if (is_readable(get_stylesheet_directory().$this->theme.DS.'style.css')) {
181 181
                 wp_register_style(
182 182
                     $this->theme,
183
-                    get_stylesheet_directory_uri() . $this->theme . DS . 'style.css',
183
+                    get_stylesheet_directory_uri().$this->theme.DS.'style.css',
184 184
                     array('dashicons', 'espresso_default')
185 185
                 );
186
-            } elseif (is_readable(EE_TEMPLATES . $this->theme . DS . 'style.css')) {
186
+            } elseif (is_readable(EE_TEMPLATES.$this->theme.DS.'style.css')) {
187 187
                 wp_register_style(
188 188
                     $this->theme,
189
-                    EE_TEMPLATES_URL . $this->theme . DS . 'style.css',
189
+                    EE_TEMPLATES_URL.$this->theme.DS.'style.css',
190 190
                     array('dashicons', 'espresso_default')
191 191
                 );
192 192
             }
Please login to merge, or discard this patch.
modules/batch/EED_Batch.module.php 2 patches
Indentation   +310 added lines, -310 removed lines patch added patch discarded remove patch
@@ -23,336 +23,336 @@
 block discarded – undo
23 23
 class EED_Batch extends EED_Module
24 24
 {
25 25
 
26
-    /**
27
-     * Possibly value for $_REQUEST[ 'batch' ]. Indicates to run a job that
28
-     * processes data only
29
-     */
30
-    const batch_job = 'job';
31
-    /**
32
-     * Possibly value for $_REQUEST[ 'batch' ]. Indicates to run a job that
33
-     * produces a file for download
34
-     */
35
-    const batch_file_job = 'file';
36
-    /**
37
-     * Possibly value for $_REQUEST[ 'batch' ]. Indicates this request is NOT
38
-     * for a batch job. It's the same as not providing the $_REQUEST[ 'batch' ]
39
-     * at all
40
-     */
41
-    const batch_not_job = 'none';
26
+	/**
27
+	 * Possibly value for $_REQUEST[ 'batch' ]. Indicates to run a job that
28
+	 * processes data only
29
+	 */
30
+	const batch_job = 'job';
31
+	/**
32
+	 * Possibly value for $_REQUEST[ 'batch' ]. Indicates to run a job that
33
+	 * produces a file for download
34
+	 */
35
+	const batch_file_job = 'file';
36
+	/**
37
+	 * Possibly value for $_REQUEST[ 'batch' ]. Indicates this request is NOT
38
+	 * for a batch job. It's the same as not providing the $_REQUEST[ 'batch' ]
39
+	 * at all
40
+	 */
41
+	const batch_not_job = 'none';
42 42
 
43
-    /**
44
-     *
45
-     * @var string 'file', or 'job', or false to indicate its not a batch request at all
46
-     */
47
-    protected $_batch_request_type = null;
43
+	/**
44
+	 *
45
+	 * @var string 'file', or 'job', or false to indicate its not a batch request at all
46
+	 */
47
+	protected $_batch_request_type = null;
48 48
 
49
-    /**
50
-     * Because we want to use the response in both the localized JS and in the body
51
-     * we need to make this response available between method calls
52
-     *
53
-     * @var \EventEspressoBatchRequest\Helpers\JobStepResponse
54
-     */
55
-    protected $_job_step_response = null;
49
+	/**
50
+	 * Because we want to use the response in both the localized JS and in the body
51
+	 * we need to make this response available between method calls
52
+	 *
53
+	 * @var \EventEspressoBatchRequest\Helpers\JobStepResponse
54
+	 */
55
+	protected $_job_step_response = null;
56 56
 
57
-    /**
58
-     * Gets the batch instance
59
-     *
60
-     * @return EED_Batch
61
-     */
62
-    public static function instance()
63
-    {
64
-        return self::get_instance();
65
-    }
57
+	/**
58
+	 * Gets the batch instance
59
+	 *
60
+	 * @return EED_Batch
61
+	 */
62
+	public static function instance()
63
+	{
64
+		return self::get_instance();
65
+	}
66 66
 
67
-    /**
68
-     * Sets hooks to enable batch jobs on the frontend. Disabled by default
69
-     * because it's an attack vector and there are currently no implementations
70
-     */
71
-    public static function set_hooks()
72
-    {
73
-        // because this is a possibel attack vector, let's have this disabled until
74
-        // we at least have a real use for it on the frontend
75
-        if (apply_filters('FHEE__EED_Batch__set_hooks__enable_frontend_batch', false)) {
76
-            add_action('wp_enqueue_scripts', array(self::instance(), 'enqueue_scripts'));
77
-            add_filter('template_include', array(self::instance(), 'override_template'), 99);
78
-        }
79
-    }
67
+	/**
68
+	 * Sets hooks to enable batch jobs on the frontend. Disabled by default
69
+	 * because it's an attack vector and there are currently no implementations
70
+	 */
71
+	public static function set_hooks()
72
+	{
73
+		// because this is a possibel attack vector, let's have this disabled until
74
+		// we at least have a real use for it on the frontend
75
+		if (apply_filters('FHEE__EED_Batch__set_hooks__enable_frontend_batch', false)) {
76
+			add_action('wp_enqueue_scripts', array(self::instance(), 'enqueue_scripts'));
77
+			add_filter('template_include', array(self::instance(), 'override_template'), 99);
78
+		}
79
+	}
80 80
 
81
-    /**
82
-     * Initializes some hooks for the admin in order to run batch jobs
83
-     */
84
-    public static function set_hooks_admin()
85
-    {
86
-        add_action('admin_menu', array(self::instance(), 'register_admin_pages'));
87
-        add_action('admin_enqueue_scripts', array(self::instance(), 'enqueue_scripts'));
81
+	/**
82
+	 * Initializes some hooks for the admin in order to run batch jobs
83
+	 */
84
+	public static function set_hooks_admin()
85
+	{
86
+		add_action('admin_menu', array(self::instance(), 'register_admin_pages'));
87
+		add_action('admin_enqueue_scripts', array(self::instance(), 'enqueue_scripts'));
88 88
 
89
-        // ajax
90
-        add_action('wp_ajax_espresso_batch_continue', array(self::instance(), 'batch_continue'));
91
-        add_action('wp_ajax_espresso_batch_cleanup', array(self::instance(), 'batch_cleanup'));
92
-        add_action('wp_ajax_nopriv_espresso_batch_continue', array(self::instance(), 'batch_continue'));
93
-        add_action('wp_ajax_nopriv_espresso_batch_cleanup', array(self::instance(), 'batch_cleanup'));
94
-    }
89
+		// ajax
90
+		add_action('wp_ajax_espresso_batch_continue', array(self::instance(), 'batch_continue'));
91
+		add_action('wp_ajax_espresso_batch_cleanup', array(self::instance(), 'batch_cleanup'));
92
+		add_action('wp_ajax_nopriv_espresso_batch_continue', array(self::instance(), 'batch_continue'));
93
+		add_action('wp_ajax_nopriv_espresso_batch_cleanup', array(self::instance(), 'batch_cleanup'));
94
+	}
95 95
 
96
-    /**
97
-     * Enqueues batch scripts on the frontend or admin, and creates a job
98
-     */
99
-    public function enqueue_scripts()
100
-    {
101
-        if (isset($_REQUEST['espresso_batch'])
102
-            ||
103
-            (
104
-                isset($_REQUEST['page'])
105
-                && $_REQUEST['page'] == 'espresso_batch'
106
-            )
107
-        ) {
108
-            switch ($this->batch_request_type()) {
109
-                case self::batch_job:
110
-                    $this->enqueue_scripts_styles_batch_create();
111
-                    break;
112
-                case self::batch_file_job:
113
-                    $this->enqueue_scripts_styles_batch_file_create();
114
-                    break;
115
-            }
116
-        }
117
-    }
96
+	/**
97
+	 * Enqueues batch scripts on the frontend or admin, and creates a job
98
+	 */
99
+	public function enqueue_scripts()
100
+	{
101
+		if (isset($_REQUEST['espresso_batch'])
102
+			||
103
+			(
104
+				isset($_REQUEST['page'])
105
+				&& $_REQUEST['page'] == 'espresso_batch'
106
+			)
107
+		) {
108
+			switch ($this->batch_request_type()) {
109
+				case self::batch_job:
110
+					$this->enqueue_scripts_styles_batch_create();
111
+					break;
112
+				case self::batch_file_job:
113
+					$this->enqueue_scripts_styles_batch_file_create();
114
+					break;
115
+			}
116
+		}
117
+	}
118 118
 
119
-    /**
120
-     * Create a batch job, enqueues a script to run it, and localizes some data for it
121
-     */
122
-    public function enqueue_scripts_styles_batch_create()
123
-    {
124
-        $job_response = $this->_enqueue_batch_job_scripts_and_styles_and_start_job();
125
-        wp_enqueue_script(
126
-            'batch_runner_init',
127
-            BATCH_URL . 'assets/batch_runner_init.js',
128
-            array('batch_runner'),
129
-            EVENT_ESPRESSO_VERSION,
130
-            true
131
-        );
132
-        wp_localize_script('batch_runner_init', 'ee_job_response', $job_response->to_array());
133
-        wp_localize_script(
134
-            'batch_runner_init',
135
-            'ee_job_i18n',
136
-            array(
137
-                'return_url' => $_REQUEST['return_url'],
138
-            )
139
-        );
140
-    }
119
+	/**
120
+	 * Create a batch job, enqueues a script to run it, and localizes some data for it
121
+	 */
122
+	public function enqueue_scripts_styles_batch_create()
123
+	{
124
+		$job_response = $this->_enqueue_batch_job_scripts_and_styles_and_start_job();
125
+		wp_enqueue_script(
126
+			'batch_runner_init',
127
+			BATCH_URL . 'assets/batch_runner_init.js',
128
+			array('batch_runner'),
129
+			EVENT_ESPRESSO_VERSION,
130
+			true
131
+		);
132
+		wp_localize_script('batch_runner_init', 'ee_job_response', $job_response->to_array());
133
+		wp_localize_script(
134
+			'batch_runner_init',
135
+			'ee_job_i18n',
136
+			array(
137
+				'return_url' => $_REQUEST['return_url'],
138
+			)
139
+		);
140
+	}
141 141
 
142
-    /**
143
-     * Creates a batch job which will download a file, enqueues a script to run the job, and localizes some data for it
144
-     */
145
-    public function enqueue_scripts_styles_batch_file_create()
146
-    {
147
-        // creates a job based on the request variable
148
-        $job_response = $this->_enqueue_batch_job_scripts_and_styles_and_start_job();
149
-        wp_enqueue_script(
150
-            'batch_file_runner_init',
151
-            BATCH_URL . 'assets/batch_file_runner_init.js',
152
-            array('batch_runner'),
153
-            EVENT_ESPRESSO_VERSION,
154
-            true
155
-        );
156
-        wp_localize_script('batch_file_runner_init', 'ee_job_response', $job_response->to_array());
157
-        wp_localize_script(
158
-            'batch_file_runner_init',
159
-            'ee_job_i18n',
160
-            array(
161
-                'download_and_redirecting' => sprintf(
162
-                    __('File Generation complete. Downloading, and %1$sredirecting%2$s...', 'event_espresso'),
163
-                    '<a href="' . $_REQUEST['return_url'] . '">',
164
-                    '</a>'
165
-                ),
166
-                'return_url'               => $_REQUEST['return_url'],
167
-            )
168
-        );
169
-    }
142
+	/**
143
+	 * Creates a batch job which will download a file, enqueues a script to run the job, and localizes some data for it
144
+	 */
145
+	public function enqueue_scripts_styles_batch_file_create()
146
+	{
147
+		// creates a job based on the request variable
148
+		$job_response = $this->_enqueue_batch_job_scripts_and_styles_and_start_job();
149
+		wp_enqueue_script(
150
+			'batch_file_runner_init',
151
+			BATCH_URL . 'assets/batch_file_runner_init.js',
152
+			array('batch_runner'),
153
+			EVENT_ESPRESSO_VERSION,
154
+			true
155
+		);
156
+		wp_localize_script('batch_file_runner_init', 'ee_job_response', $job_response->to_array());
157
+		wp_localize_script(
158
+			'batch_file_runner_init',
159
+			'ee_job_i18n',
160
+			array(
161
+				'download_and_redirecting' => sprintf(
162
+					__('File Generation complete. Downloading, and %1$sredirecting%2$s...', 'event_espresso'),
163
+					'<a href="' . $_REQUEST['return_url'] . '">',
164
+					'</a>'
165
+				),
166
+				'return_url'               => $_REQUEST['return_url'],
167
+			)
168
+		);
169
+	}
170 170
 
171
-    /**
172
-     * Enqueues scripts and styles common to any batch job, and creates
173
-     * a job from the request data, and stores the response in the
174
-     * $this->_job_step_response property
175
-     *
176
-     * @return \EventEspressoBatchRequest\Helpers\JobStepResponse
177
-     */
178
-    protected function _enqueue_batch_job_scripts_and_styles_and_start_job()
179
-    {
180
-        wp_register_script(
181
-            'progress_bar',
182
-            EE_PLUGIN_DIR_URL . 'core/libraries/batch/Assets/progress_bar.js',
183
-            array('jquery')
184
-        );
185
-        wp_enqueue_style(
186
-            'progress_bar',
187
-            EE_PLUGIN_DIR_URL . 'core/libraries/batch/Assets/progress_bar.css',
188
-            array(),
189
-            EVENT_ESPRESSO_VERSION
190
-        );
191
-        wp_enqueue_script(
192
-            'batch_runner',
193
-            EE_PLUGIN_DIR_URL . 'core/libraries/batch/Assets/batch_runner.js',
194
-            array('progress_bar')
195
-        );
196
-        // just copy the bits of EE admin's eei18n that we need in the JS
197
-        wp_localize_script(
198
-            'batch_runner',
199
-            'eei18n',
200
-            array(
201
-                'ajax_url'      => WP_AJAX_URL,
202
-                'is_admin'      => (bool) is_admin(),
203
-                'error_message' => esc_html__('An error occurred and the job has been stopped.', 'event_espresso'),
204
-            )
205
-        );
206
-        $job_handler_classname = stripslashes($_GET['job_handler']);
207
-        $request_data = array_diff_key(
208
-            $_REQUEST,
209
-            array_flip(array('action', 'page', 'ee', 'batch'))
210
-        );
211
-        $batch_runner = new EventEspressoBatchRequest\BatchRequestProcessor();
212
-        // eg 'EventEspressoBatchRequest\JobHandlers\RegistrationsReport'
213
-        $job_response = $batch_runner->create_job($job_handler_classname, $request_data);
214
-        // remember the response for later. We need it to display the page body
215
-        $this->_job_step_response = $job_response;
216
-        return $job_response;
217
-    }
171
+	/**
172
+	 * Enqueues scripts and styles common to any batch job, and creates
173
+	 * a job from the request data, and stores the response in the
174
+	 * $this->_job_step_response property
175
+	 *
176
+	 * @return \EventEspressoBatchRequest\Helpers\JobStepResponse
177
+	 */
178
+	protected function _enqueue_batch_job_scripts_and_styles_and_start_job()
179
+	{
180
+		wp_register_script(
181
+			'progress_bar',
182
+			EE_PLUGIN_DIR_URL . 'core/libraries/batch/Assets/progress_bar.js',
183
+			array('jquery')
184
+		);
185
+		wp_enqueue_style(
186
+			'progress_bar',
187
+			EE_PLUGIN_DIR_URL . 'core/libraries/batch/Assets/progress_bar.css',
188
+			array(),
189
+			EVENT_ESPRESSO_VERSION
190
+		);
191
+		wp_enqueue_script(
192
+			'batch_runner',
193
+			EE_PLUGIN_DIR_URL . 'core/libraries/batch/Assets/batch_runner.js',
194
+			array('progress_bar')
195
+		);
196
+		// just copy the bits of EE admin's eei18n that we need in the JS
197
+		wp_localize_script(
198
+			'batch_runner',
199
+			'eei18n',
200
+			array(
201
+				'ajax_url'      => WP_AJAX_URL,
202
+				'is_admin'      => (bool) is_admin(),
203
+				'error_message' => esc_html__('An error occurred and the job has been stopped.', 'event_espresso'),
204
+			)
205
+		);
206
+		$job_handler_classname = stripslashes($_GET['job_handler']);
207
+		$request_data = array_diff_key(
208
+			$_REQUEST,
209
+			array_flip(array('action', 'page', 'ee', 'batch'))
210
+		);
211
+		$batch_runner = new EventEspressoBatchRequest\BatchRequestProcessor();
212
+		// eg 'EventEspressoBatchRequest\JobHandlers\RegistrationsReport'
213
+		$job_response = $batch_runner->create_job($job_handler_classname, $request_data);
214
+		// remember the response for later. We need it to display the page body
215
+		$this->_job_step_response = $job_response;
216
+		return $job_response;
217
+	}
218 218
 
219
-    /**
220
-     * If we are doing a frontend batch job, this makes it so WP shows our template's HTML
221
-     *
222
-     * @param string $template
223
-     * @return string
224
-     */
225
-    public function override_template($template)
226
-    {
227
-        if (isset($_REQUEST['espresso_batch']) && isset($_REQUEST['batch'])) {
228
-            return EE_MODULES . 'batch' . DS . 'templates' . DS . 'batch_frontend_wrapper.template.html';
229
-        }
230
-        return $template;
231
-    }
219
+	/**
220
+	 * If we are doing a frontend batch job, this makes it so WP shows our template's HTML
221
+	 *
222
+	 * @param string $template
223
+	 * @return string
224
+	 */
225
+	public function override_template($template)
226
+	{
227
+		if (isset($_REQUEST['espresso_batch']) && isset($_REQUEST['batch'])) {
228
+			return EE_MODULES . 'batch' . DS . 'templates' . DS . 'batch_frontend_wrapper.template.html';
229
+		}
230
+		return $template;
231
+	}
232 232
 
233
-    /**
234
-     * Adds an admin page which doesn't appear in the admin menu
235
-     */
236
-    public function register_admin_pages()
237
-    {
238
-        add_submenu_page(
239
-            '', // parent slug. we don't want this to actually appear in the menu
240
-            __('Batch Job', 'event_espresso'), // page title
241
-            'n/a', // menu title
242
-            'read', // we want this page to actually be accessible to anyone,
243
-            'espresso_batch', // menu slug
244
-            array(self::instance(), 'show_admin_page')
245
-        );
246
-    }
233
+	/**
234
+	 * Adds an admin page which doesn't appear in the admin menu
235
+	 */
236
+	public function register_admin_pages()
237
+	{
238
+		add_submenu_page(
239
+			'', // parent slug. we don't want this to actually appear in the menu
240
+			__('Batch Job', 'event_espresso'), // page title
241
+			'n/a', // menu title
242
+			'read', // we want this page to actually be accessible to anyone,
243
+			'espresso_batch', // menu slug
244
+			array(self::instance(), 'show_admin_page')
245
+		);
246
+	}
247 247
 
248
-    /**
249
-     * Renders the admin page, after most of the work was already done during enqueuing scripts
250
-     * of creating the job and localizing some data
251
-     */
252
-    public function show_admin_page()
253
-    {
254
-        echo EEH_Template::locate_template(
255
-            EE_MODULES . 'batch' . DS . 'templates' . DS . 'batch_wrapper.template.html',
256
-            array('batch_request_type' => $this->batch_request_type())
257
-        );
258
-    }
248
+	/**
249
+	 * Renders the admin page, after most of the work was already done during enqueuing scripts
250
+	 * of creating the job and localizing some data
251
+	 */
252
+	public function show_admin_page()
253
+	{
254
+		echo EEH_Template::locate_template(
255
+			EE_MODULES . 'batch' . DS . 'templates' . DS . 'batch_wrapper.template.html',
256
+			array('batch_request_type' => $this->batch_request_type())
257
+		);
258
+	}
259 259
 
260
-    /**
261
-     * Receives ajax calls for continuing a job
262
-     */
263
-    public function batch_continue()
264
-    {
265
-        $job_id = sanitize_text_field($_REQUEST['job_id']);
266
-        $batch_runner = new EventEspressoBatchRequest\BatchRequestProcessor();
267
-        $response_obj = $batch_runner->continue_job($job_id);
268
-        $this->_return_json($response_obj->to_array());
269
-    }
260
+	/**
261
+	 * Receives ajax calls for continuing a job
262
+	 */
263
+	public function batch_continue()
264
+	{
265
+		$job_id = sanitize_text_field($_REQUEST['job_id']);
266
+		$batch_runner = new EventEspressoBatchRequest\BatchRequestProcessor();
267
+		$response_obj = $batch_runner->continue_job($job_id);
268
+		$this->_return_json($response_obj->to_array());
269
+	}
270 270
 
271
-    /**
272
-     * Receives the ajax call to cleanup a job
273
-     *
274
-     * @return type
275
-     */
276
-    public function batch_cleanup()
277
-    {
278
-        $job_id = sanitize_text_field($_REQUEST['job_id']);
279
-        $batch_runner = new EventEspressoBatchRequest\BatchRequestProcessor();
280
-        $response_obj = $batch_runner->cleanup_job($job_id);
281
-        $this->_return_json($response_obj->to_array());
282
-    }
271
+	/**
272
+	 * Receives the ajax call to cleanup a job
273
+	 *
274
+	 * @return type
275
+	 */
276
+	public function batch_cleanup()
277
+	{
278
+		$job_id = sanitize_text_field($_REQUEST['job_id']);
279
+		$batch_runner = new EventEspressoBatchRequest\BatchRequestProcessor();
280
+		$response_obj = $batch_runner->cleanup_job($job_id);
281
+		$this->_return_json($response_obj->to_array());
282
+	}
283 283
 
284 284
 
285
-    /**
286
-     * Returns a json response
287
-     *
288
-     * @param array $data The data we want to send echo via in the JSON response's "data" element
289
-     *
290
-     * The returned json object is created from an array in the following format:
291
-     * array(
292
-     *    'notices' => '', // - contains any EE_Error formatted notices
293
-     *    'data' => array() //this can be any key/value pairs that a method returns for later json parsing by the js.
294
-     *    We're also going to include the template args with every package (so js can pick out any specific template
295
-     *    args that might be included in here)
296
-     *    'isEEajax' => true,//indicates this is a response from EE
297
-     * )
298
-     */
299
-    protected function _return_json($data)
300
-    {
301
-        $json = array(
302
-            'notices'  => EE_Error::get_notices(),
303
-            'data'     => $data,
304
-            'isEEajax' => true
305
-            // special flag so any ajax.Success methods in js can identify this return package as a EEajax package.
306
-        );
285
+	/**
286
+	 * Returns a json response
287
+	 *
288
+	 * @param array $data The data we want to send echo via in the JSON response's "data" element
289
+	 *
290
+	 * The returned json object is created from an array in the following format:
291
+	 * array(
292
+	 *    'notices' => '', // - contains any EE_Error formatted notices
293
+	 *    'data' => array() //this can be any key/value pairs that a method returns for later json parsing by the js.
294
+	 *    We're also going to include the template args with every package (so js can pick out any specific template
295
+	 *    args that might be included in here)
296
+	 *    'isEEajax' => true,//indicates this is a response from EE
297
+	 * )
298
+	 */
299
+	protected function _return_json($data)
300
+	{
301
+		$json = array(
302
+			'notices'  => EE_Error::get_notices(),
303
+			'data'     => $data,
304
+			'isEEajax' => true
305
+			// special flag so any ajax.Success methods in js can identify this return package as a EEajax package.
306
+		);
307 307
 
308 308
 
309
-        // make sure there are no php errors or headers_sent.  Then we can set correct json header.
310
-        if (null === error_get_last() || ! headers_sent()) {
311
-            header('Content-Type: application/json; charset=UTF-8');
312
-        }
313
-        echo wp_json_encode($json);
314
-        exit();
315
-    }
309
+		// make sure there are no php errors or headers_sent.  Then we can set correct json header.
310
+		if (null === error_get_last() || ! headers_sent()) {
311
+			header('Content-Type: application/json; charset=UTF-8');
312
+		}
313
+		echo wp_json_encode($json);
314
+		exit();
315
+	}
316 316
 
317
-    /**
318
-     * Gets the job step response which was done during the enqueuing of scripts
319
-     *
320
-     * @return \EventEspressoBatchRequest\Helpers\JobStepResponse
321
-     */
322
-    public function job_step_response()
323
-    {
324
-        return $this->_job_step_response;
325
-    }
317
+	/**
318
+	 * Gets the job step response which was done during the enqueuing of scripts
319
+	 *
320
+	 * @return \EventEspressoBatchRequest\Helpers\JobStepResponse
321
+	 */
322
+	public function job_step_response()
323
+	{
324
+		return $this->_job_step_response;
325
+	}
326 326
 
327
-    /**
328
-     * Gets the batch request type indicated in the $_REQUEST
329
-     *
330
-     * @return string: EED_Batch::batch_job, EED_Batch::batch_file_job, EED_Batch::batch_not_job
331
-     */
332
-    public function batch_request_type()
333
-    {
334
-        if ($this->_batch_request_type === null) {
335
-            if (isset($_GET['batch'])) {
336
-                if ($_GET['batch'] == self::batch_job) {
337
-                    $this->_batch_request_type = self::batch_job;
338
-                } elseif ($_GET['batch'] == self::batch_file_job) {
339
-                    $this->_batch_request_type = self::batch_file_job;
340
-                }
341
-            }
342
-            // if we didn't find that it was a batch request, indicate it wasn't
343
-            if ($this->_batch_request_type === null) {
344
-                $this->_batch_request_type = self::batch_not_job;
345
-            }
346
-        }
347
-        return $this->_batch_request_type;
348
-    }
327
+	/**
328
+	 * Gets the batch request type indicated in the $_REQUEST
329
+	 *
330
+	 * @return string: EED_Batch::batch_job, EED_Batch::batch_file_job, EED_Batch::batch_not_job
331
+	 */
332
+	public function batch_request_type()
333
+	{
334
+		if ($this->_batch_request_type === null) {
335
+			if (isset($_GET['batch'])) {
336
+				if ($_GET['batch'] == self::batch_job) {
337
+					$this->_batch_request_type = self::batch_job;
338
+				} elseif ($_GET['batch'] == self::batch_file_job) {
339
+					$this->_batch_request_type = self::batch_file_job;
340
+				}
341
+			}
342
+			// if we didn't find that it was a batch request, indicate it wasn't
343
+			if ($this->_batch_request_type === null) {
344
+				$this->_batch_request_type = self::batch_not_job;
345
+			}
346
+		}
347
+		return $this->_batch_request_type;
348
+	}
349 349
 
350
-    /**
351
-     * Unnecessary
352
-     *
353
-     * @param type $WP
354
-     */
355
-    public function run($WP)
356
-    {
357
-    }
350
+	/**
351
+	 * Unnecessary
352
+	 *
353
+	 * @param type $WP
354
+	 */
355
+	public function run($WP)
356
+	{
357
+	}
358 358
 }
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
         $job_response = $this->_enqueue_batch_job_scripts_and_styles_and_start_job();
125 125
         wp_enqueue_script(
126 126
             'batch_runner_init',
127
-            BATCH_URL . 'assets/batch_runner_init.js',
127
+            BATCH_URL.'assets/batch_runner_init.js',
128 128
             array('batch_runner'),
129 129
             EVENT_ESPRESSO_VERSION,
130 130
             true
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
         $job_response = $this->_enqueue_batch_job_scripts_and_styles_and_start_job();
149 149
         wp_enqueue_script(
150 150
             'batch_file_runner_init',
151
-            BATCH_URL . 'assets/batch_file_runner_init.js',
151
+            BATCH_URL.'assets/batch_file_runner_init.js',
152 152
             array('batch_runner'),
153 153
             EVENT_ESPRESSO_VERSION,
154 154
             true
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
             array(
161 161
                 'download_and_redirecting' => sprintf(
162 162
                     __('File Generation complete. Downloading, and %1$sredirecting%2$s...', 'event_espresso'),
163
-                    '<a href="' . $_REQUEST['return_url'] . '">',
163
+                    '<a href="'.$_REQUEST['return_url'].'">',
164 164
                     '</a>'
165 165
                 ),
166 166
                 'return_url'               => $_REQUEST['return_url'],
@@ -179,18 +179,18 @@  discard block
 block discarded – undo
179 179
     {
180 180
         wp_register_script(
181 181
             'progress_bar',
182
-            EE_PLUGIN_DIR_URL . 'core/libraries/batch/Assets/progress_bar.js',
182
+            EE_PLUGIN_DIR_URL.'core/libraries/batch/Assets/progress_bar.js',
183 183
             array('jquery')
184 184
         );
185 185
         wp_enqueue_style(
186 186
             'progress_bar',
187
-            EE_PLUGIN_DIR_URL . 'core/libraries/batch/Assets/progress_bar.css',
187
+            EE_PLUGIN_DIR_URL.'core/libraries/batch/Assets/progress_bar.css',
188 188
             array(),
189 189
             EVENT_ESPRESSO_VERSION
190 190
         );
191 191
         wp_enqueue_script(
192 192
             'batch_runner',
193
-            EE_PLUGIN_DIR_URL . 'core/libraries/batch/Assets/batch_runner.js',
193
+            EE_PLUGIN_DIR_URL.'core/libraries/batch/Assets/batch_runner.js',
194 194
             array('progress_bar')
195 195
         );
196 196
         // just copy the bits of EE admin's eei18n that we need in the JS
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
     public function override_template($template)
226 226
     {
227 227
         if (isset($_REQUEST['espresso_batch']) && isset($_REQUEST['batch'])) {
228
-            return EE_MODULES . 'batch' . DS . 'templates' . DS . 'batch_frontend_wrapper.template.html';
228
+            return EE_MODULES.'batch'.DS.'templates'.DS.'batch_frontend_wrapper.template.html';
229 229
         }
230 230
         return $template;
231 231
     }
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
     public function show_admin_page()
253 253
     {
254 254
         echo EEH_Template::locate_template(
255
-            EE_MODULES . 'batch' . DS . 'templates' . DS . 'batch_wrapper.template.html',
255
+            EE_MODULES.'batch'.DS.'templates'.DS.'batch_wrapper.template.html',
256 256
             array('batch_request_type' => $this->batch_request_type())
257 257
         );
258 258
     }
Please login to merge, or discard this patch.
modules/feeds/templates/espresso_venues_feed.template.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -10,11 +10,11 @@
 block discarded – undo
10 10
  * @ version        4+
11 11
  */
12 12
 ?>
13
-<p><?php _e('Organizer Name: ', 'event_espresso') . espresso_organization_name($VNU_ID); ?><br/>
14
-    <?php _e('Organizer Email: ', 'event_espresso') . espresso_organization_email($VNU_ID); ?><br/>
15
-    <?php _e('Venue Phone: ', 'event_espresso') . espresso_venue_phone($VNU_ID); ?></p>
16
-<p><?php _e('Categories: ', 'event_espresso') . espresso_venue_categories($VNU_ID); ?></p>
17
-<p><?php _e('Address: ', 'event_espresso') . espresso_venue_address($VNU_ID); ?></p>
18
-<p><?php _e('Website: ', 'event_espresso') . espresso_venue_website($VNU_ID); ?></p>
19
-<p><?php echo __('Description: ', 'event_espresso') . $venue_description; ?></p><br/>
13
+<p><?php _e('Organizer Name: ', 'event_espresso').espresso_organization_name($VNU_ID); ?><br/>
14
+    <?php _e('Organizer Email: ', 'event_espresso').espresso_organization_email($VNU_ID); ?><br/>
15
+    <?php _e('Venue Phone: ', 'event_espresso').espresso_venue_phone($VNU_ID); ?></p>
16
+<p><?php _e('Categories: ', 'event_espresso').espresso_venue_categories($VNU_ID); ?></p>
17
+<p><?php _e('Address: ', 'event_espresso').espresso_venue_address($VNU_ID); ?></p>
18
+<p><?php _e('Website: ', 'event_espresso').espresso_venue_website($VNU_ID); ?></p>
19
+<p><?php echo __('Description: ', 'event_espresso').$venue_description; ?></p><br/>
20 20
  
21 21
\ No newline at end of file
Please login to merge, or discard this patch.