Completed
Branch FET-10416-autoload-b4-bootstra... (42a01c)
by
unknown
13:17
created
core/db_models/fields/EE_Post_Content_Field.php 2 patches
Indentation   +115 added lines, -115 removed lines patch added patch discarded remove patch
@@ -7,133 +7,133 @@
 block discarded – undo
7 7
  */
8 8
 class EE_Post_Content_Field extends EE_Text_Field_Base
9 9
 {
10
-    static protected $_added_the_content_basic_filters = false;
10
+	static protected $_added_the_content_basic_filters = false;
11 11
 
12
-    /**
13
-     * @param string $table_column
14
-     * @param string $nicename
15
-     * @param bool   $nullable
16
-     * @param null   $default_value
17
-     */
18
-    public function __construct($table_column, $nicename, $nullable, $default_value = null)
19
-    {
20
-        parent::__construct($table_column, $nicename, $nullable, $default_value);
21
-        $this->setSchemaType('object');
22
-    }
12
+	/**
13
+	 * @param string $table_column
14
+	 * @param string $nicename
15
+	 * @param bool   $nullable
16
+	 * @param null   $default_value
17
+	 */
18
+	public function __construct($table_column, $nicename, $nullable, $default_value = null)
19
+	{
20
+		parent::__construct($table_column, $nicename, $nullable, $default_value);
21
+		$this->setSchemaType('object');
22
+	}
23 23
 
24 24
 
25
-    /**
26
-     * removes all tags which a WP Post wouldn't allow in its content normally
27
-     *
28
-     * @param string $value
29
-     * @return string
30
-     */
31
-    function prepare_for_set($value)
32
-    {
33
-        if (! current_user_can('unfiltered_html')) {
34
-            $value = wp_kses("$value", wp_kses_allowed_html('post'));
35
-        }
36
-        return parent::prepare_for_set($value);
37
-    }
25
+	/**
26
+	 * removes all tags which a WP Post wouldn't allow in its content normally
27
+	 *
28
+	 * @param string $value
29
+	 * @return string
30
+	 */
31
+	function prepare_for_set($value)
32
+	{
33
+		if (! current_user_can('unfiltered_html')) {
34
+			$value = wp_kses("$value", wp_kses_allowed_html('post'));
35
+		}
36
+		return parent::prepare_for_set($value);
37
+	}
38 38
 
39
-    function prepare_for_set_from_db($value_found_in_db_for_model_object)
40
-    {
41
-        return $value_found_in_db_for_model_object;
42
-    }
39
+	function prepare_for_set_from_db($value_found_in_db_for_model_object)
40
+	{
41
+		return $value_found_in_db_for_model_object;
42
+	}
43 43
 
44 44
 
45 45
 
46
-    /**
47
-     * Runs the content through `the_content`, or if prepares the content for placing in a form input
48
-     * @param string $value_on_field_to_be_outputted
49
-     * @param string   $schema possible values: 'form_input' or null (if null, will run through 'the_content')
50
-     * @return string
51
-     * @throws EE_Error when WP_DEBUG is on and recursive calling is detected
52
-     */
53
-    public function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null)
54
-    {
55
-        switch($schema){
56
-            case 'form_input':
57
-                return parent::prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema);
58
-            case 'the_content':
46
+	/**
47
+	 * Runs the content through `the_content`, or if prepares the content for placing in a form input
48
+	 * @param string $value_on_field_to_be_outputted
49
+	 * @param string   $schema possible values: 'form_input' or null (if null, will run through 'the_content')
50
+	 * @return string
51
+	 * @throws EE_Error when WP_DEBUG is on and recursive calling is detected
52
+	 */
53
+	public function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null)
54
+	{
55
+		switch($schema){
56
+			case 'form_input':
57
+				return parent::prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema);
58
+			case 'the_content':
59 59
 
60
-                if(doing_filter( 'the_content')){
61
-                    if( defined('WP_DEBUG') && WP_DEBUG){
62
-                        throw new EE_Error(
63
-                            sprintf(
64
-                                esc_html__('You have recursively called "%1$s" with %2$s set to %3$s which uses "%2$s" filter. You should use it with %2$s "%3$s" instead here.', 'event_espresso'),
65
-                                'EE_Post_Content_Field::prepare_for_pretty_echoing',
66
-                                '$schema',
67
-                                'the_content',
68
-                                'the_content_wp_core_only'
69
-                            )
70
-                        );
71
-                    } else {
72
-                        return $this->prepare_for_pretty_echoing($value_on_field_to_be_outputted, 'the_content_wp_core_only');
73
-                    }
74
-                }
75
-                return apply_filters(
76
-                    'the_content',
77
-                    parent::prepare_for_pretty_echoing(
78
-                        $value_on_field_to_be_outputted,
79
-                        $schema
80
-                    )
81
-                );
82
-            case 'the_content_wp_core_only':
83
-            default:
84
-                self::_ensure_filters_setup();
85
-                return apply_filters(
86
-                    'the_content_wp_core_only',
87
-                    parent::prepare_for_pretty_echoing(
88
-                        $value_on_field_to_be_outputted,
89
-                        $schema
90
-                    )
91
-                );
92
-        }
93
-    }
60
+				if(doing_filter( 'the_content')){
61
+					if( defined('WP_DEBUG') && WP_DEBUG){
62
+						throw new EE_Error(
63
+							sprintf(
64
+								esc_html__('You have recursively called "%1$s" with %2$s set to %3$s which uses "%2$s" filter. You should use it with %2$s "%3$s" instead here.', 'event_espresso'),
65
+								'EE_Post_Content_Field::prepare_for_pretty_echoing',
66
+								'$schema',
67
+								'the_content',
68
+								'the_content_wp_core_only'
69
+							)
70
+						);
71
+					} else {
72
+						return $this->prepare_for_pretty_echoing($value_on_field_to_be_outputted, 'the_content_wp_core_only');
73
+					}
74
+				}
75
+				return apply_filters(
76
+					'the_content',
77
+					parent::prepare_for_pretty_echoing(
78
+						$value_on_field_to_be_outputted,
79
+						$schema
80
+					)
81
+				);
82
+			case 'the_content_wp_core_only':
83
+			default:
84
+				self::_ensure_filters_setup();
85
+				return apply_filters(
86
+					'the_content_wp_core_only',
87
+					parent::prepare_for_pretty_echoing(
88
+						$value_on_field_to_be_outputted,
89
+						$schema
90
+					)
91
+				);
92
+		}
93
+	}
94 94
 
95 95
 
96 96
 
97
-    /**
98
-     * Verifies we've setup the standard WP core filters on  'the_content_wp_core_only' filter
99
-     */
100
-    protected static function _ensure_filters_setup()
101
-    {
102
-        if( !self::$_added_the_content_basic_filters){
103
-            add_filter('the_content_wp_core_only', array( $GLOBALS['wp_embed'], 'run_shortcode'), 8);
104
-            add_filter('the_content_wp_core_only', array( $GLOBALS['wp_embed'], 'autoembed'), 8);
105
-            add_filter('the_content_wp_core_only', 'wptexturize', 10);
106
-            add_filter('the_content_wp_core_only', 'wpautop', 10);
107
-            add_filter('the_content_wp_core_only', 'shortcode_unautop', 10);
108
-            add_filter('the_content_wp_core_only', 'prepend_attachment', 10);
109
-            if(function_exists('wp_make_content_images_responsive')) {
110
-                add_filter('the_content_wp_core_only', 'wp_make_content_images_responsive', 10);
111
-            }
112
-            add_filter('the_content_wp_core_only', 'do_shortcode', 11);
113
-            add_filter('the_content_wp_core_only', 'convert_smilies', 20);
114
-            self::$_added_the_content_basic_filters = true;
115
-        }
116
-    }
97
+	/**
98
+	 * Verifies we've setup the standard WP core filters on  'the_content_wp_core_only' filter
99
+	 */
100
+	protected static function _ensure_filters_setup()
101
+	{
102
+		if( !self::$_added_the_content_basic_filters){
103
+			add_filter('the_content_wp_core_only', array( $GLOBALS['wp_embed'], 'run_shortcode'), 8);
104
+			add_filter('the_content_wp_core_only', array( $GLOBALS['wp_embed'], 'autoembed'), 8);
105
+			add_filter('the_content_wp_core_only', 'wptexturize', 10);
106
+			add_filter('the_content_wp_core_only', 'wpautop', 10);
107
+			add_filter('the_content_wp_core_only', 'shortcode_unautop', 10);
108
+			add_filter('the_content_wp_core_only', 'prepend_attachment', 10);
109
+			if(function_exists('wp_make_content_images_responsive')) {
110
+				add_filter('the_content_wp_core_only', 'wp_make_content_images_responsive', 10);
111
+			}
112
+			add_filter('the_content_wp_core_only', 'do_shortcode', 11);
113
+			add_filter('the_content_wp_core_only', 'convert_smilies', 20);
114
+			self::$_added_the_content_basic_filters = true;
115
+		}
116
+	}
117 117
 
118 118
 
119 119
 
120
-    public function getSchemaProperties()
121
-    {
122
-        return array(
123
-            'raw' => array(
124
-                'description' =>  sprintf(
125
-                    __('%s - the content as it exists in the database.', 'event_espresso'),
126
-                    $this->get_nicename()
127
-                ),
128
-                'type' => 'string'
129
-            ),
130
-            'rendered' => array(
131
-                'description' =>  sprintf(
132
-                    __('%s - the content rendered for display.', 'event_espresso'),
133
-                    $this->get_nicename()
134
-                ),
135
-                'type' => 'string'
136
-            )
137
-        );
138
-    }
120
+	public function getSchemaProperties()
121
+	{
122
+		return array(
123
+			'raw' => array(
124
+				'description' =>  sprintf(
125
+					__('%s - the content as it exists in the database.', 'event_espresso'),
126
+					$this->get_nicename()
127
+				),
128
+				'type' => 'string'
129
+			),
130
+			'rendered' => array(
131
+				'description' =>  sprintf(
132
+					__('%s - the content rendered for display.', 'event_espresso'),
133
+					$this->get_nicename()
134
+				),
135
+				'type' => 'string'
136
+			)
137
+		);
138
+	}
139 139
 }
140 140
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
      */
31 31
     function prepare_for_set($value)
32 32
     {
33
-        if (! current_user_can('unfiltered_html')) {
33
+        if ( ! current_user_can('unfiltered_html')) {
34 34
             $value = wp_kses("$value", wp_kses_allowed_html('post'));
35 35
         }
36 36
         return parent::prepare_for_set($value);
@@ -52,13 +52,13 @@  discard block
 block discarded – undo
52 52
      */
53 53
     public function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null)
54 54
     {
55
-        switch($schema){
55
+        switch ($schema) {
56 56
             case 'form_input':
57 57
                 return parent::prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema);
58 58
             case 'the_content':
59 59
 
60
-                if(doing_filter( 'the_content')){
61
-                    if( defined('WP_DEBUG') && WP_DEBUG){
60
+                if (doing_filter('the_content')) {
61
+                    if (defined('WP_DEBUG') && WP_DEBUG) {
62 62
                         throw new EE_Error(
63 63
                             sprintf(
64 64
                                 esc_html__('You have recursively called "%1$s" with %2$s set to %3$s which uses "%2$s" filter. You should use it with %2$s "%3$s" instead here.', 'event_espresso'),
@@ -99,14 +99,14 @@  discard block
 block discarded – undo
99 99
      */
100 100
     protected static function _ensure_filters_setup()
101 101
     {
102
-        if( !self::$_added_the_content_basic_filters){
103
-            add_filter('the_content_wp_core_only', array( $GLOBALS['wp_embed'], 'run_shortcode'), 8);
104
-            add_filter('the_content_wp_core_only', array( $GLOBALS['wp_embed'], 'autoembed'), 8);
102
+        if ( ! self::$_added_the_content_basic_filters) {
103
+            add_filter('the_content_wp_core_only', array($GLOBALS['wp_embed'], 'run_shortcode'), 8);
104
+            add_filter('the_content_wp_core_only', array($GLOBALS['wp_embed'], 'autoembed'), 8);
105 105
             add_filter('the_content_wp_core_only', 'wptexturize', 10);
106 106
             add_filter('the_content_wp_core_only', 'wpautop', 10);
107 107
             add_filter('the_content_wp_core_only', 'shortcode_unautop', 10);
108 108
             add_filter('the_content_wp_core_only', 'prepend_attachment', 10);
109
-            if(function_exists('wp_make_content_images_responsive')) {
109
+            if (function_exists('wp_make_content_images_responsive')) {
110 110
                 add_filter('the_content_wp_core_only', 'wp_make_content_images_responsive', 10);
111 111
             }
112 112
             add_filter('the_content_wp_core_only', 'do_shortcode', 11);
Please login to merge, or discard this patch.
core/libraries/batch/JobHandlers/AttendeesReport.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -108,10 +108,10 @@
 block discarded – undo
108 108
 				}
109 109
 			}
110 110
 			$csv_data[] = apply_filters(
111
-			    'FHEE___EventEspresso_core_libraries_batch_JobHandlers_AttendeesReport__get_csv_data__row',
112
-                $csv_row,
113
-                $attendee_row
114
-            );
111
+				'FHEE___EventEspresso_core_libraries_batch_JobHandlers_AttendeesReport__get_csv_data__row',
112
+				$csv_row,
113
+				$attendee_row
114
+			);
115 115
 		}
116 116
 		return $csv_data;
117 117
 	}
Please login to merge, or discard this patch.
Spacing   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 use EventEspressoBatchRequest\Helpers\JobParameters;
19 19
 use EventEspressoBatchRequest\Helpers\JobStepResponse;
20 20
 
21
-if (!defined('EVENT_ESPRESSO_VERSION')) {
21
+if ( ! defined('EVENT_ESPRESSO_VERSION')) {
22 22
 	exit('No direct script access allowed');
23 23
 }
24 24
 
@@ -27,84 +27,84 @@  discard block
 block discarded – undo
27 27
 
28 28
 
29 29
 	public function create_job(JobParameters $job_parameters) {
30
-		if( ! \EE_Capabilities::instance()->current_user_can( 'ee_read_contacts', 'generating_report' ) ) {
30
+		if ( ! \EE_Capabilities::instance()->current_user_can('ee_read_contacts', 'generating_report')) {
31 31
 			throw new BatchRequestException(
32
-				__( 'You do not have permission to view contacts', 'event_espresso')
32
+				__('You do not have permission to view contacts', 'event_espresso')
33 33
 			);
34 34
 		}
35 35
 		$filepath = $this->create_file_from_job_with_name(
36 36
 			$job_parameters->job_id(),
37 37
 			__('contact-list-report.csv', 'event_espresso')
38 38
 		);
39
-		$job_parameters->add_extra_data( 'filepath', $filepath );
40
-		$job_parameters->set_job_size( $this->count_units_to_process() );
39
+		$job_parameters->add_extra_data('filepath', $filepath);
40
+		$job_parameters->set_job_size($this->count_units_to_process());
41 41
 		//we should also set the header columns
42
-		$csv_data_for_row = $this->get_csv_data( 0, 1 );
43
-		\EEH_Export::write_data_array_to_csv( $filepath, $csv_data_for_row, true );
42
+		$csv_data_for_row = $this->get_csv_data(0, 1);
43
+		\EEH_Export::write_data_array_to_csv($filepath, $csv_data_for_row, true);
44 44
 		//if we actually processed a row there, record it
45
-		if( $job_parameters->job_size() ) {
46
-			$job_parameters->mark_processed( 1 );
45
+		if ($job_parameters->job_size()) {
46
+			$job_parameters->mark_processed(1);
47 47
 		}
48 48
 		return new JobStepResponse(
49 49
 			$job_parameters,
50
-			__( 'Contacts report started successfully...', 'event_espresso' )
50
+			__('Contacts report started successfully...', 'event_espresso')
51 51
 		);
52 52
 	}
53 53
 
54 54
 
55 55
 	public function continue_job(JobParameters $job_parameters, $batch_size = 50) {
56
-		$csv_data = $this->get_csv_data( $job_parameters->units_processed(), $batch_size );
57
-		\EEH_Export::write_data_array_to_csv( $job_parameters->extra_datum( 'filepath' ), $csv_data, false );
58
-		$units_processed = count( $csv_data );
59
-		$job_parameters->mark_processed( $units_processed );
56
+		$csv_data = $this->get_csv_data($job_parameters->units_processed(), $batch_size);
57
+		\EEH_Export::write_data_array_to_csv($job_parameters->extra_datum('filepath'), $csv_data, false);
58
+		$units_processed = count($csv_data);
59
+		$job_parameters->mark_processed($units_processed);
60 60
 		$extra_response_data = array(
61 61
 			'file_url' => ''
62 62
 		);
63
-		if( $units_processed < $batch_size ) {
64
-			$job_parameters->set_status( JobParameters::status_complete );
65
-			$extra_response_data[ 'file_url' ] = $this->get_url_to_file( $job_parameters->extra_datum( 'filepath' ) );
63
+		if ($units_processed < $batch_size) {
64
+			$job_parameters->set_status(JobParameters::status_complete);
65
+			$extra_response_data['file_url'] = $this->get_url_to_file($job_parameters->extra_datum('filepath'));
66 66
 		}
67 67
 		return new JobStepResponse(
68 68
 				$job_parameters,
69 69
 				sprintf(
70
-					__( 'Wrote %1$s rows to report CSV file...', 'event_espresso' ),
71
-					count( $csv_data ) ),
70
+					__('Wrote %1$s rows to report CSV file...', 'event_espresso'),
71
+					count($csv_data) ),
72 72
 				$extra_response_data );
73 73
 	}
74 74
 
75 75
 
76 76
 	public function cleanup_job(JobParameters $job_parameters) {
77 77
 		$this->_file_helper->delete(
78
-			\EEH_File::remove_filename_from_filepath( $job_parameters->extra_datum( 'filepath' ) ),
78
+			\EEH_File::remove_filename_from_filepath($job_parameters->extra_datum('filepath')),
79 79
 			true,
80 80
 			'd'
81 81
 		);
82
-		return new JobStepResponse( $job_parameters, __( 'Cleaned up temporary file', 'event_espresso' ) );
82
+		return new JobStepResponse($job_parameters, __('Cleaned up temporary file', 'event_espresso'));
83 83
 	}
84 84
 
85 85
 	public function count_units_to_process() {
86
-		return \EEM_Attendee::instance()->count( array( 'caps' => \EEM_Base::caps_read_admin ));
86
+		return \EEM_Attendee::instance()->count(array('caps' => \EEM_Base::caps_read_admin));
87 87
 	}
88
-	public function get_csv_data( $offset, $limit ) {
88
+	public function get_csv_data($offset, $limit) {
89 89
 		$attendee_rows = \EEM_Attendee::instance()->get_all_wpdb_results( 
90 90
 			array( 
91
-				'limit' => array( $offset, $limit ),
92
-				'force_join' => array( 'State', 'Country' ),
91
+				'limit' => array($offset, $limit),
92
+				'force_join' => array('State', 'Country'),
93 93
 				'caps' => \EEM_Base::caps_read_admin
94 94
 			) 
95 95
 		);
96 96
 		$csv_data = array();
97
-		foreach( $attendee_rows as $attendee_row ){
97
+		foreach ($attendee_rows as $attendee_row) {
98 98
 			$csv_row = array();
99
-			foreach( \EEM_Attendee::instance()->field_settings() as $field_name => $field_obj ){
100
-				if( $field_name == 'STA_ID' ){
101
-					$state_name_field = \EEM_State::instance()->field_settings_for( 'STA_name' );
102
-					$csv_row[ __( 'State', 'event_espresso' ) ] = $attendee_row[ $state_name_field->get_qualified_column() ];
103
-				}elseif( $field_name == 'CNT_ISO' ){
104
-					$country_name_field = \EEM_Country::instance()->field_settings_for( 'CNT_name' );
105
-					$csv_row[ __( 'Country', 'event_espresso' ) ] = $attendee_row[ $country_name_field->get_qualified_column() ];
106
-				}else{
107
-					$csv_row[ $field_obj->get_nicename() ] = $attendee_row[ $field_obj->get_qualified_column() ];
99
+			foreach (\EEM_Attendee::instance()->field_settings() as $field_name => $field_obj) {
100
+				if ($field_name == 'STA_ID') {
101
+					$state_name_field = \EEM_State::instance()->field_settings_for('STA_name');
102
+					$csv_row[__('State', 'event_espresso')] = $attendee_row[$state_name_field->get_qualified_column()];
103
+				}elseif ($field_name == 'CNT_ISO') {
104
+					$country_name_field = \EEM_Country::instance()->field_settings_for('CNT_name');
105
+					$csv_row[__('Country', 'event_espresso')] = $attendee_row[$country_name_field->get_qualified_column()];
106
+				} else {
107
+					$csv_row[$field_obj->get_nicename()] = $attendee_row[$field_obj->get_qualified_column()];
108 108
 				}
109 109
 			}
110 110
 			$csv_data[] = apply_filters(
Please login to merge, or discard this patch.
core/libraries/batch/JobHandlers/RegistrationsReport.php 1 patch
Indentation   +414 added lines, -415 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 use EventEspressoBatchRequest\Helpers\JobStepResponse;
18 18
 
19 19
 if ( ! defined('EVENT_ESPRESSO_VERSION')) {
20
-    exit('No direct script access allowed');
20
+	exit('No direct script access allowed');
21 21
 }
22 22
 
23 23
 
@@ -25,443 +25,442 @@  discard block
 block discarded – undo
25 25
 class RegistrationsReport extends JobHandlerFile
26 26
 {
27 27
 
28
-    /**
29
-     * Performs any necessary setup for starting the job. This is also a good
30
-     * place to setup the $job_arguments which will be used for subsequent HTTP requests
31
-     * when continue_job will be called
32
-     *
33
-     * @param JobParameters $job_parameters
34
-     * @throws BatchRequestException
35
-     * @return JobStepResponse
36
-     */
37
-    public function create_job(JobParameters $job_parameters)
38
-    {
39
-        $event_id = intval($job_parameters->request_datum('EVT_ID', '0'));
40
-        if ( ! \EE_Capabilities::instance()->current_user_can('ee_read_registrations', 'generating_report')) {
41
-            throw new BatchRequestException(__('You do not have permission to view registrations', 'event_espresso'));
42
-        }
43
-        $filepath = $this->create_file_from_job_with_name($job_parameters->job_id(),
44
-            $this->get_filename($event_id));
45
-        $job_parameters->add_extra_data('filepath', $filepath);
46
-        if ($job_parameters->request_datum('use_filters', false)) {
47
-            $query_params = maybe_unserialize(stripslashes($job_parameters->request_datum('filters', array())));
48
-        } else {
49
-            $query_params = apply_filters('FHEE__EE_Export__report_registration_for_event', array(
50
-                array(
51
-                    'OR'                 => array(
52
-                        //don't include registrations from failed or abandoned transactions...
53
-                        'Transaction.STS_ID' => array(
54
-                            'NOT IN',
55
-                            array(
56
-                                \EEM_Transaction::failed_status_code,
57
-                                \EEM_Transaction::abandoned_status_code,
58
-                            ),
59
-                        ),
60
-                        //unless the registration is approved, in which case include it regardless of transaction status
61
-                        'STS_ID'             => \EEM_Registration::status_id_approved,
62
-                    ),
63
-                    'Ticket.TKT_deleted' => array('IN', array(true, false)),
64
-                ),
65
-                'order_by'   => array('Transaction.TXN_ID' => 'asc', 'REG_count' => 'asc'),
66
-                'force_join' => array('Transaction', 'Ticket', 'Attendee'),
67
-                'caps'       => \EEM_Base::caps_read_admin,
68
-            ), $event_id);
69
-            if ($event_id) {
70
-                $query_params[0]['EVT_ID'] = $event_id;
71
-            } else {
72
-                $query_params['force_join'][] = 'Event';
73
-            }
74
-        }
75
-        if ( ! isset($query_params['force_join'])) {
76
-            $query_params['force_join'] = array('Event', 'Transaction', 'Ticket', 'Attendee');
77
-        }
78
-        $job_parameters->add_extra_data('query_params', $query_params);
79
-        $question_labels = $this->_get_question_labels($query_params);
80
-        $job_parameters->add_extra_data('question_labels', $question_labels);
81
-        $job_parameters->set_job_size(
82
-            \EEM_Registration::instance()->count(
83
-                array_diff_key(
84
-                    $query_params,
85
-                    array_flip(
86
-                        array( 'limit' )
87
-                    )
88
-                )
89
-            )
90
-        );
91
-        //we should also set the header columns
92
-        $csv_data_for_row = $this->get_csv_data_for($event_id, 0, 1, $job_parameters->extra_datum('question_labels'),
93
-            $job_parameters->extra_datum('query_params'));
94
-        \EEH_Export::write_data_array_to_csv($filepath, $csv_data_for_row, true);
95
-        //if we actually processed a row there, record it
96
-        if ($job_parameters->job_size()) {
97
-            $job_parameters->mark_processed(1);
98
-        }
99
-        return new JobStepResponse($job_parameters,
100
-            __('Registrations report started successfully...', 'event_espresso'));
101
-    }
28
+	/**
29
+	 * Performs any necessary setup for starting the job. This is also a good
30
+	 * place to setup the $job_arguments which will be used for subsequent HTTP requests
31
+	 * when continue_job will be called
32
+	 *
33
+	 * @param JobParameters $job_parameters
34
+	 * @throws BatchRequestException
35
+	 * @return JobStepResponse
36
+	 */
37
+	public function create_job(JobParameters $job_parameters)
38
+	{
39
+		$event_id = intval($job_parameters->request_datum('EVT_ID', '0'));
40
+		if ( ! \EE_Capabilities::instance()->current_user_can('ee_read_registrations', 'generating_report')) {
41
+			throw new BatchRequestException(__('You do not have permission to view registrations', 'event_espresso'));
42
+		}
43
+		$filepath = $this->create_file_from_job_with_name($job_parameters->job_id(),
44
+			$this->get_filename($event_id));
45
+		$job_parameters->add_extra_data('filepath', $filepath);
46
+		if ($job_parameters->request_datum('use_filters', false)) {
47
+			$query_params = maybe_unserialize(stripslashes($job_parameters->request_datum('filters', array())));
48
+		} else {
49
+			$query_params = apply_filters('FHEE__EE_Export__report_registration_for_event', array(
50
+				array(
51
+					'OR'                 => array(
52
+						//don't include registrations from failed or abandoned transactions...
53
+						'Transaction.STS_ID' => array(
54
+							'NOT IN',
55
+							array(
56
+								\EEM_Transaction::failed_status_code,
57
+								\EEM_Transaction::abandoned_status_code,
58
+							),
59
+						),
60
+						//unless the registration is approved, in which case include it regardless of transaction status
61
+						'STS_ID'             => \EEM_Registration::status_id_approved,
62
+					),
63
+					'Ticket.TKT_deleted' => array('IN', array(true, false)),
64
+				),
65
+				'order_by'   => array('Transaction.TXN_ID' => 'asc', 'REG_count' => 'asc'),
66
+				'force_join' => array('Transaction', 'Ticket', 'Attendee'),
67
+				'caps'       => \EEM_Base::caps_read_admin,
68
+			), $event_id);
69
+			if ($event_id) {
70
+				$query_params[0]['EVT_ID'] = $event_id;
71
+			} else {
72
+				$query_params['force_join'][] = 'Event';
73
+			}
74
+		}
75
+		if ( ! isset($query_params['force_join'])) {
76
+			$query_params['force_join'] = array('Event', 'Transaction', 'Ticket', 'Attendee');
77
+		}
78
+		$job_parameters->add_extra_data('query_params', $query_params);
79
+		$question_labels = $this->_get_question_labels($query_params);
80
+		$job_parameters->add_extra_data('question_labels', $question_labels);
81
+		$job_parameters->set_job_size(
82
+			\EEM_Registration::instance()->count(
83
+				array_diff_key(
84
+					$query_params,
85
+					array_flip(
86
+						array( 'limit' )
87
+					)
88
+				)
89
+			)
90
+		);
91
+		//we should also set the header columns
92
+		$csv_data_for_row = $this->get_csv_data_for($event_id, 0, 1, $job_parameters->extra_datum('question_labels'),
93
+			$job_parameters->extra_datum('query_params'));
94
+		\EEH_Export::write_data_array_to_csv($filepath, $csv_data_for_row, true);
95
+		//if we actually processed a row there, record it
96
+		if ($job_parameters->job_size()) {
97
+			$job_parameters->mark_processed(1);
98
+		}
99
+		return new JobStepResponse($job_parameters,
100
+			__('Registrations report started successfully...', 'event_espresso'));
101
+	}
102 102
 
103 103
 
104 104
 
105
-    /**
106
-     * Gets the filename
107
-     * @return string
108
-     */
109
-    protected function get_filename()
110
-    {
111
-        return sprintf("event-espresso-registrations-%s.csv", str_replace(':', '-', current_time('mysql')));
112
-    }
105
+	/**
106
+	 * Gets the filename
107
+	 * @return string
108
+	 */
109
+	protected function get_filename()
110
+	{
111
+		return sprintf("event-espresso-registrations-%s.csv", str_replace(':', '-', current_time('mysql')));
112
+	}
113 113
 
114 114
 
115 115
 
116
-    /**
117
-     * Gets the questions which are to be used for this report, so they
118
-     * can be remembered for later
119
-     *
120
-     * @param array $registration_query_params
121
-     * @return array question admin labels to be used for this report
122
-     */
123
-    protected function _get_question_labels($registration_query_params)
124
-    {
125
-        $where = isset($registration_query_params[0]) ? $registration_query_params[0] : null;
126
-        $question_query_params = array();
127
-        if ($where !== null) {
128
-            $question_query_params = array(
129
-                $this->_change_registration_where_params_to_question_where_params($registration_query_params[0]),
130
-            );
131
-        }
132
-        $question_query_params[0]['QST_system'] = array('NOT_IN', array_keys(\EEM_Attendee::instance()->system_question_to_attendee_field_mapping()));
133
-        if(apply_filters('FHEE__EventEspressoBatchRequest__JobHandlers__RegistrationsReport___get_question_labels__only_include_answered_questions', false, $registration_query_params)) {
134
-            $question_query_params[0]['Answer.ANS_ID'] = array('IS_NOT_NULL');
135
-        }
136
-        $question_query_params['group_by'] = array( 'QST_ID' );
137
-        return array_unique( \EEM_Question::instance()->get_col( $question_query_params, 'QST_admin_label' ) );
138
-    }
116
+	/**
117
+	 * Gets the questions which are to be used for this report, so they
118
+	 * can be remembered for later
119
+	 *
120
+	 * @param array $registration_query_params
121
+	 * @return array question admin labels to be used for this report
122
+	 */
123
+	protected function _get_question_labels($registration_query_params)
124
+	{
125
+		$where = isset($registration_query_params[0]) ? $registration_query_params[0] : null;
126
+		$question_query_params = array();
127
+		if ($where !== null) {
128
+			$question_query_params = array(
129
+				$this->_change_registration_where_params_to_question_where_params($registration_query_params[0]),
130
+			);
131
+		}
132
+		$question_query_params[0]['QST_system'] = array('NOT_IN', array_keys(\EEM_Attendee::instance()->system_question_to_attendee_field_mapping()));
133
+		if(apply_filters('FHEE__EventEspressoBatchRequest__JobHandlers__RegistrationsReport___get_question_labels__only_include_answered_questions', false, $registration_query_params)) {
134
+			$question_query_params[0]['Answer.ANS_ID'] = array('IS_NOT_NULL');
135
+		}
136
+		$question_query_params['group_by'] = array( 'QST_ID' );
137
+		return array_unique( \EEM_Question::instance()->get_col( $question_query_params, 'QST_admin_label' ) );
138
+	}
139 139
 
140 140
 
141 141
 
142
-    /**
143
-     * Takes where params meant for registrations and changes them to work for questions
144
-     *
145
-     * @param array $reg_where_params
146
-     * @return array
147
-     */
148
-    protected function _change_registration_where_params_to_question_where_params($reg_where_params)
149
-    {
150
-        $question_where_params = array();
151
-        foreach ($reg_where_params as $key => $val) {
152
-            if (\EEM_Registration::instance()->is_logic_query_param_key($key)) {
153
-                $question_where_params[$key] = $this->_change_registration_where_params_to_question_where_params($val);
154
-            } else {
155
-                //it's a normal where condition
156
-                $question_where_params['Question_Group.Event.Registration.' . $key] = $val;
157
-            }
158
-        }
159
-        return $question_where_params;
160
-    }
142
+	/**
143
+	 * Takes where params meant for registrations and changes them to work for questions
144
+	 *
145
+	 * @param array $reg_where_params
146
+	 * @return array
147
+	 */
148
+	protected function _change_registration_where_params_to_question_where_params($reg_where_params)
149
+	{
150
+		$question_where_params = array();
151
+		foreach ($reg_where_params as $key => $val) {
152
+			if (\EEM_Registration::instance()->is_logic_query_param_key($key)) {
153
+				$question_where_params[$key] = $this->_change_registration_where_params_to_question_where_params($val);
154
+			} else {
155
+				//it's a normal where condition
156
+				$question_where_params['Question_Group.Event.Registration.' . $key] = $val;
157
+			}
158
+		}
159
+		return $question_where_params;
160
+	}
161 161
 
162 162
 
163 163
 
164
-    /**
165
-     * Performs another step of the job
166
-     *
167
-     * @param JobParameters $job_parameters
168
-     * @param int           $batch_size
169
-     * @return JobStepResponse
170
-     * @throws \EE_Error
171
-     */
172
-    public function continue_job(JobParameters $job_parameters, $batch_size = 50)
173
-    {
174
-        if( $job_parameters->units_processed() < $job_parameters->job_size() ) {
175
-            $csv_data = $this->get_csv_data_for($job_parameters->request_datum('EVT_ID', '0'),
176
-                $job_parameters->units_processed(), $batch_size, $job_parameters->extra_datum('question_labels'),
177
-                $job_parameters->extra_datum('query_params'));
178
-            \EEH_Export::write_data_array_to_csv($job_parameters->extra_datum('filepath'), $csv_data, false);
179
-            $units_processed = count($csv_data);
180
-        }else{
181
-            $units_processed = 0;
182
-        }
183
-        $job_parameters->mark_processed($units_processed);
184
-        $extra_response_data = array(
185
-            'file_url' => '',
186
-        );
187
-        if ($units_processed < $batch_size) {
188
-            $job_parameters->set_status(JobParameters::status_complete);
189
-            $extra_response_data['file_url'] = $this->get_url_to_file($job_parameters->extra_datum('filepath'));
190
-        }
164
+	/**
165
+	 * Performs another step of the job
166
+	 *
167
+	 * @param JobParameters $job_parameters
168
+	 * @param int           $batch_size
169
+	 * @return JobStepResponse
170
+	 * @throws \EE_Error
171
+	 */
172
+	public function continue_job(JobParameters $job_parameters, $batch_size = 50)
173
+	{
174
+		if( $job_parameters->units_processed() < $job_parameters->job_size() ) {
175
+			$csv_data = $this->get_csv_data_for($job_parameters->request_datum('EVT_ID', '0'),
176
+				$job_parameters->units_processed(), $batch_size, $job_parameters->extra_datum('question_labels'),
177
+				$job_parameters->extra_datum('query_params'));
178
+			\EEH_Export::write_data_array_to_csv($job_parameters->extra_datum('filepath'), $csv_data, false);
179
+			$units_processed = count($csv_data);
180
+		}else{
181
+			$units_processed = 0;
182
+		}
183
+		$job_parameters->mark_processed($units_processed);
184
+		$extra_response_data = array(
185
+			'file_url' => '',
186
+		);
187
+		if ($units_processed < $batch_size) {
188
+			$job_parameters->set_status(JobParameters::status_complete);
189
+			$extra_response_data['file_url'] = $this->get_url_to_file($job_parameters->extra_datum('filepath'));
190
+		}
191 191
 
192
-        return new JobStepResponse($job_parameters,
193
-            sprintf(__('Wrote %1$s rows to report CSV file...', 'event_espresso'), count($csv_data)),
194
-            $extra_response_data);
195
-    }
192
+		return new JobStepResponse($job_parameters,
193
+			sprintf(__('Wrote %1$s rows to report CSV file...', 'event_espresso'), count($csv_data)),
194
+			$extra_response_data);
195
+	}
196 196
 
197 197
 
198 198
 
199
-    /**
200
-     * Gets the csv data for a batch of registrations
201
-
202
-     *
199
+	/**
200
+	 * Gets the csv data for a batch of registrations
201
+	 *
203 202
 *@param int|null    $event_id
204
-     * @param int   $offset
205
-     * @param int   $limit
206
-     * @param array $question_labels the IDs for all the questions which were answered by someone in this selection
207
-     * @param array $query_params    for using where querying the model
208
-     * @return array top-level keys are numeric, next-level keys are column headers
209
-     */
210
-    function get_csv_data_for($event_id, $offset, $limit, $question_labels, $query_params)
211
-    {
212
-        $reg_fields_to_include = array(
213
-            'TXN_ID',
214
-            'ATT_ID',
215
-            'REG_ID',
216
-            'REG_date',
217
-            'REG_code',
218
-            'REG_count',
219
-            'REG_final_price',
220
-        );
221
-        $att_fields_to_include = array(
222
-            'ATT_fname',
223
-            'ATT_lname',
224
-            'ATT_email',
225
-            'ATT_address',
226
-            'ATT_address2',
227
-            'ATT_city',
228
-            'STA_ID',
229
-            'CNT_ISO',
230
-            'ATT_zip',
231
-            'ATT_phone',
232
-        );
233
-        $registrations_csv_ready_array = array();
234
-        $reg_model = \EE_Registry::instance()->load_model('Registration');
235
-        $query_params['limit'] = array($offset, $limit);
236
-        $registration_rows = $reg_model->get_all_wpdb_results($query_params);
237
-        $registration_ids = array();
238
-        foreach ($registration_rows as $reg_row) {
239
-            $registration_ids[] = intval($reg_row['Registration.REG_ID']);
240
-        }
241
-        foreach ($registration_rows as $reg_row) {
242
-            if (is_array($reg_row)) {
243
-                $reg_csv_array = array();
244
-                if ( ! $event_id) {
245
-                    //get the event's name and Id
246
-                    $reg_csv_array[__('Event', 'event_espresso')] = sprintf(__('%1$s (%2$s)', 'event_espresso'),
247
-                        \EEH_Export::prepare_value_from_db_for_display(\EEM_Event::instance(), 'EVT_name',
248
-                            $reg_row['Event_CPT.post_title']), $reg_row['Event_CPT.ID']);
249
-                }
250
-                $is_primary_reg = $reg_row['Registration.REG_count'] == '1' ? true : false;
251
-                /*@var $reg_row EE_Registration */
252
-                foreach ($reg_fields_to_include as $field_name) {
253
-                    $field = $reg_model->field_settings_for($field_name);
254
-                    if ($field_name == 'REG_final_price') {
255
-                        $value = \EEH_Export::prepare_value_from_db_for_display($reg_model, $field_name,
256
-                            $reg_row['Registration.REG_final_price'], 'localized_float');
257
-                    } elseif ($field_name == 'REG_count') {
258
-                        $value = sprintf(__('%s of %s', 'event_espresso'),
259
-                            \EEH_Export::prepare_value_from_db_for_display($reg_model, 'REG_count',
260
-                                $reg_row['Registration.REG_count']),
261
-                            \EEH_Export::prepare_value_from_db_for_display($reg_model, 'REG_group_size',
262
-                                $reg_row['Registration.REG_group_size']));
263
-                    } elseif ($field_name == 'REG_date') {
264
-                        $value = \EEH_Export::prepare_value_from_db_for_display($reg_model, $field_name,
265
-                            $reg_row['Registration.REG_date'], 'no_html');
266
-                    } else {
267
-                        $value = \EEH_Export::prepare_value_from_db_for_display($reg_model, $field_name,
268
-                            $reg_row[$field->get_qualified_column()]);
269
-                    }
270
-                    $reg_csv_array[\EEH_Export::get_column_name_for_field($field)] = $value;
271
-                    if ($field_name == 'REG_final_price') {
272
-                        //add a column named Currency after the final price
273
-                        $reg_csv_array[__("Currency", "event_espresso")] = \EE_Config::instance()->currency->code;
274
-                    }
275
-                }
276
-                //get pretty status
277
-                $stati = \EEM_Status::instance()->localized_status(array(
278
-                    $reg_row['Registration.STS_ID']     => __('unknown', 'event_espresso'),
279
-                    $reg_row['TransactionTable.STS_ID'] => __('unknown', 'event_espresso'),
280
-                ), false, 'sentence');
281
-                $reg_csv_array[__("Registration Status", 'event_espresso')] = $stati[$reg_row['Registration.STS_ID']];
282
-                //get pretty transaction status
283
-                $reg_csv_array[__("Transaction Status",
284
-                    'event_espresso')] = $stati[$reg_row['TransactionTable.STS_ID']];
285
-                $reg_csv_array[__('Transaction Amount Due', 'event_espresso')] = $is_primary_reg
286
-                    ? \EEH_Export::prepare_value_from_db_for_display(\EEM_Transaction::instance(), 'TXN_total',
287
-                        $reg_row['TransactionTable.TXN_total'], 'localized_float') : '0.00';
288
-                $reg_csv_array[__('Amount Paid', 'event_espresso')] = $is_primary_reg
289
-                    ? \EEH_Export::prepare_value_from_db_for_display(\EEM_Transaction::instance(), 'TXN_paid',
290
-                        $reg_row['TransactionTable.TXN_paid'], 'localized_float') : '0.00';
291
-                $payment_methods = array();
292
-                $gateway_txn_ids_etc = array();
293
-                $payment_times = array();
294
-                if ($is_primary_reg && $reg_row['TransactionTable.TXN_ID']) {
295
-                    $payments_info = \EEM_Payment::instance()->get_all_wpdb_results(array(
296
-                        array(
297
-                            'TXN_ID' => $reg_row['TransactionTable.TXN_ID'],
298
-                            'STS_ID' => \EEM_Payment::status_id_approved,
299
-                        ),
300
-                        'force_join' => array('Payment_Method'),
301
-                    ), ARRAY_A,
302
-                        'Payment_Method.PMD_admin_name as name, Payment.PAY_txn_id_chq_nmbr as gateway_txn_id, Payment.PAY_timestamp as payment_time');
303
-                    foreach ($payments_info as $payment_method_and_gateway_txn_id) {
304
-                        $payment_methods[] = isset($payment_method_and_gateway_txn_id['name'])
305
-                            ? $payment_method_and_gateway_txn_id['name'] : __('Unknown', 'event_espresso');
306
-                        $gateway_txn_ids_etc[] = isset($payment_method_and_gateway_txn_id['gateway_txn_id'])
307
-                            ? $payment_method_and_gateway_txn_id['gateway_txn_id'] : '';
308
-                        $payment_times[] = isset($payment_method_and_gateway_txn_id['payment_time'])
309
-                            ? $payment_method_and_gateway_txn_id['payment_time'] : '';
310
-                    }
311
-                }
312
-                $reg_csv_array[__('Payment Date(s)', 'event_espresso')] = implode(',', $payment_times);
313
-                $reg_csv_array[__('Payment Method(s)', 'event_espresso')] = implode(",", $payment_methods);
314
-                $reg_csv_array[__('Gateway Transaction ID(s)', 'event_espresso')] = implode(',', $gateway_txn_ids_etc);
315
-                //get whether or not the user has checked in
316
-                $reg_csv_array[__("Check-Ins",
317
-                    "event_espresso")] = $reg_model->count_related($reg_row['Registration.REG_ID'], 'Checkin');
318
-                //get ticket of registration and its price
319
-                $ticket_model = \EE_Registry::instance()->load_model('Ticket');
320
-                if ($reg_row['Ticket.TKT_ID']) {
321
-                    $ticket_name = \EEH_Export::prepare_value_from_db_for_display($ticket_model, 'TKT_name',
322
-                        $reg_row['Ticket.TKT_name']);
323
-                    $datetimes_strings = array();
324
-                    foreach (
325
-                        \EEM_Datetime::instance()->get_all_wpdb_results(array(
326
-                            array('Ticket.TKT_ID' => $reg_row['Ticket.TKT_ID']),
327
-                            'order_by'                 => array('DTT_EVT_start' => 'ASC'),
328
-                            'default_where_conditions' => 'none',
329
-                        )) as $datetime
330
-                    ) {
331
-                        $datetimes_strings[] = \EEH_Export::prepare_value_from_db_for_display(\EEM_Datetime::instance(),
332
-                            'DTT_EVT_start', $datetime['Datetime.DTT_EVT_start']);
333
-                    }
334
-                } else {
335
-                    $ticket_name = __('Unknown', 'event_espresso');
336
-                    $datetimes_strings = array(__('Unknown', 'event_espresso'));
337
-                }
338
-                $reg_csv_array[$ticket_model->field_settings_for('TKT_name')->get_nicename()] = $ticket_name;
339
-                $reg_csv_array[__("Datetimes of Ticket", "event_espresso")] = implode(", ", $datetimes_strings);
340
-                //get datetime(s) of registration
341
-                //add attendee columns
342
-                foreach ($att_fields_to_include as $att_field_name) {
343
-                    $field_obj = \EEM_Attendee::instance()->field_settings_for($att_field_name);
344
-                    if ($reg_row['Attendee_CPT.ID']) {
345
-                        if ($att_field_name == 'STA_ID') {
346
-                            $value = \EEM_State::instance()
347
-                                               ->get_var(array(array('STA_ID' => $reg_row['Attendee_Meta.STA_ID'])),
348
-                                                   'STA_name');
349
-                        } elseif ($att_field_name == 'CNT_ISO') {
350
-                            $value = \EEM_Country::instance()
351
-                                                 ->get_var(array(array('CNT_ISO' => $reg_row['Attendee_Meta.CNT_ISO'])),
352
-                                                     'CNT_name');
353
-                        } else {
354
-                            $value = \EEH_Export::prepare_value_from_db_for_display(\EEM_Attendee::instance(),
355
-                                $att_field_name, $reg_row[$field_obj->get_qualified_column()]);
356
-                        }
357
-                    } else {
358
-                        $value = '';
359
-                    }
360
-                    $reg_csv_array[\EEH_Export::get_column_name_for_field($field_obj)] = $value;
361
-                }
362
-                //make sure each registration has the same questions in the same order
363
-                foreach ($question_labels as $question_label) {
364
-                    if ( ! isset($reg_csv_array[$question_label])) {
365
-                        $reg_csv_array[$question_label] = null;
366
-                    }
367
-                }
368
-                $answers = \EEM_Answer::instance()->get_all_wpdb_results(array(
369
-                    array('REG_ID' => $reg_row['Registration.REG_ID']),
370
-                    'force_join' => array('Question'),
371
-                ));
372
-                //now fill out the questions THEY answered
373
-                foreach ($answers as $answer_row) {
374
-                    if ($answer_row['Question.QST_ID']) {
375
-                        $question_label = \EEH_Export::prepare_value_from_db_for_display(\EEM_Question::instance(),
376
-                            'QST_admin_label', $answer_row['Question.QST_admin_label']);
377
-                    } else {
378
-                        $question_label = sprintf(__('Question $s', 'event_espresso'), $answer_row['Answer.QST_ID']);
379
-                    }
380
-                    if (isset($answer_row['Question.QST_type'])
381
-                        && $answer_row['Question.QST_type'] == \EEM_Question::QST_type_state
382
-                    ) {
383
-                        $reg_csv_array[$question_label] = \EEM_State::instance()
384
-                                                                    ->get_state_name_by_ID($answer_row['Answer.ANS_value']);
385
-                    } else {
386
-                        //this isn't for html, so don't show html entities
387
-                        $reg_csv_array[$question_label] = html_entity_decode(\EEH_Export::prepare_value_from_db_for_display(\EEM_Answer::instance(),
388
-                            'ANS_value', $answer_row['Answer.ANS_value']));
389
-                    }
390
-                }
391
-                /**
392
-                 * Filter to change the contents of each row of the registrations report CSV file.
393
-                 *
394
-                 * This can be used to add or remote columns from the CSV file, or change their values.                 *
395
-                 * Note: it has this name because originally that's where this filter resided,
396
-                 * and we've left its name as-is for backward compatibility.
397
-                 * Note when using: all rows in the CSV should have the same columns.
398
-                 *
399
-                 * @param array $reg_csv_array keys are column-header names, and values are that columns' value
400
-                 *                             in this row
401
-                 * @param array $reg_row is the row from the database's wp_esp_registration table
402
-                 *
403
-                 */
404
-                $registrations_csv_ready_array[] = apply_filters(
405
-                    'FHEE__EE_Export__report_registrations__reg_csv_array',
406
-                    $reg_csv_array,
407
-                    $reg_row
408
-                );
409
-            }
410
-        }
411
-        //if we couldn't export anything, we want to at least show the column headers
412
-        if (empty($registrations_csv_ready_array)) {
413
-            $reg_csv_array = array();
414
-            $model_and_fields_to_include = array(
415
-                'Registration' => $reg_fields_to_include,
416
-                'Attendee'     => $att_fields_to_include,
417
-            );
418
-            foreach ($model_and_fields_to_include as $model_name => $field_list) {
419
-                $model = \EE_Registry::instance()->load_model($model_name);
420
-                foreach ($field_list as $field_name) {
421
-                    $field = $model->field_settings_for($field_name);
422
-                    $reg_csv_array[\EEH_Export::get_column_name_for_field($field)] = null;
423
-                }
424
-            }
425
-            $registrations_csv_ready_array[] = $reg_csv_array;
426
-        }
427
-        return $registrations_csv_ready_array;
428
-    }
203
+	 * @param int   $offset
204
+	 * @param int   $limit
205
+	 * @param array $question_labels the IDs for all the questions which were answered by someone in this selection
206
+	 * @param array $query_params    for using where querying the model
207
+	 * @return array top-level keys are numeric, next-level keys are column headers
208
+	 */
209
+	function get_csv_data_for($event_id, $offset, $limit, $question_labels, $query_params)
210
+	{
211
+		$reg_fields_to_include = array(
212
+			'TXN_ID',
213
+			'ATT_ID',
214
+			'REG_ID',
215
+			'REG_date',
216
+			'REG_code',
217
+			'REG_count',
218
+			'REG_final_price',
219
+		);
220
+		$att_fields_to_include = array(
221
+			'ATT_fname',
222
+			'ATT_lname',
223
+			'ATT_email',
224
+			'ATT_address',
225
+			'ATT_address2',
226
+			'ATT_city',
227
+			'STA_ID',
228
+			'CNT_ISO',
229
+			'ATT_zip',
230
+			'ATT_phone',
231
+		);
232
+		$registrations_csv_ready_array = array();
233
+		$reg_model = \EE_Registry::instance()->load_model('Registration');
234
+		$query_params['limit'] = array($offset, $limit);
235
+		$registration_rows = $reg_model->get_all_wpdb_results($query_params);
236
+		$registration_ids = array();
237
+		foreach ($registration_rows as $reg_row) {
238
+			$registration_ids[] = intval($reg_row['Registration.REG_ID']);
239
+		}
240
+		foreach ($registration_rows as $reg_row) {
241
+			if (is_array($reg_row)) {
242
+				$reg_csv_array = array();
243
+				if ( ! $event_id) {
244
+					//get the event's name and Id
245
+					$reg_csv_array[__('Event', 'event_espresso')] = sprintf(__('%1$s (%2$s)', 'event_espresso'),
246
+						\EEH_Export::prepare_value_from_db_for_display(\EEM_Event::instance(), 'EVT_name',
247
+							$reg_row['Event_CPT.post_title']), $reg_row['Event_CPT.ID']);
248
+				}
249
+				$is_primary_reg = $reg_row['Registration.REG_count'] == '1' ? true : false;
250
+				/*@var $reg_row EE_Registration */
251
+				foreach ($reg_fields_to_include as $field_name) {
252
+					$field = $reg_model->field_settings_for($field_name);
253
+					if ($field_name == 'REG_final_price') {
254
+						$value = \EEH_Export::prepare_value_from_db_for_display($reg_model, $field_name,
255
+							$reg_row['Registration.REG_final_price'], 'localized_float');
256
+					} elseif ($field_name == 'REG_count') {
257
+						$value = sprintf(__('%s of %s', 'event_espresso'),
258
+							\EEH_Export::prepare_value_from_db_for_display($reg_model, 'REG_count',
259
+								$reg_row['Registration.REG_count']),
260
+							\EEH_Export::prepare_value_from_db_for_display($reg_model, 'REG_group_size',
261
+								$reg_row['Registration.REG_group_size']));
262
+					} elseif ($field_name == 'REG_date') {
263
+						$value = \EEH_Export::prepare_value_from_db_for_display($reg_model, $field_name,
264
+							$reg_row['Registration.REG_date'], 'no_html');
265
+					} else {
266
+						$value = \EEH_Export::prepare_value_from_db_for_display($reg_model, $field_name,
267
+							$reg_row[$field->get_qualified_column()]);
268
+					}
269
+					$reg_csv_array[\EEH_Export::get_column_name_for_field($field)] = $value;
270
+					if ($field_name == 'REG_final_price') {
271
+						//add a column named Currency after the final price
272
+						$reg_csv_array[__("Currency", "event_espresso")] = \EE_Config::instance()->currency->code;
273
+					}
274
+				}
275
+				//get pretty status
276
+				$stati = \EEM_Status::instance()->localized_status(array(
277
+					$reg_row['Registration.STS_ID']     => __('unknown', 'event_espresso'),
278
+					$reg_row['TransactionTable.STS_ID'] => __('unknown', 'event_espresso'),
279
+				), false, 'sentence');
280
+				$reg_csv_array[__("Registration Status", 'event_espresso')] = $stati[$reg_row['Registration.STS_ID']];
281
+				//get pretty transaction status
282
+				$reg_csv_array[__("Transaction Status",
283
+					'event_espresso')] = $stati[$reg_row['TransactionTable.STS_ID']];
284
+				$reg_csv_array[__('Transaction Amount Due', 'event_espresso')] = $is_primary_reg
285
+					? \EEH_Export::prepare_value_from_db_for_display(\EEM_Transaction::instance(), 'TXN_total',
286
+						$reg_row['TransactionTable.TXN_total'], 'localized_float') : '0.00';
287
+				$reg_csv_array[__('Amount Paid', 'event_espresso')] = $is_primary_reg
288
+					? \EEH_Export::prepare_value_from_db_for_display(\EEM_Transaction::instance(), 'TXN_paid',
289
+						$reg_row['TransactionTable.TXN_paid'], 'localized_float') : '0.00';
290
+				$payment_methods = array();
291
+				$gateway_txn_ids_etc = array();
292
+				$payment_times = array();
293
+				if ($is_primary_reg && $reg_row['TransactionTable.TXN_ID']) {
294
+					$payments_info = \EEM_Payment::instance()->get_all_wpdb_results(array(
295
+						array(
296
+							'TXN_ID' => $reg_row['TransactionTable.TXN_ID'],
297
+							'STS_ID' => \EEM_Payment::status_id_approved,
298
+						),
299
+						'force_join' => array('Payment_Method'),
300
+					), ARRAY_A,
301
+						'Payment_Method.PMD_admin_name as name, Payment.PAY_txn_id_chq_nmbr as gateway_txn_id, Payment.PAY_timestamp as payment_time');
302
+					foreach ($payments_info as $payment_method_and_gateway_txn_id) {
303
+						$payment_methods[] = isset($payment_method_and_gateway_txn_id['name'])
304
+							? $payment_method_and_gateway_txn_id['name'] : __('Unknown', 'event_espresso');
305
+						$gateway_txn_ids_etc[] = isset($payment_method_and_gateway_txn_id['gateway_txn_id'])
306
+							? $payment_method_and_gateway_txn_id['gateway_txn_id'] : '';
307
+						$payment_times[] = isset($payment_method_and_gateway_txn_id['payment_time'])
308
+							? $payment_method_and_gateway_txn_id['payment_time'] : '';
309
+					}
310
+				}
311
+				$reg_csv_array[__('Payment Date(s)', 'event_espresso')] = implode(',', $payment_times);
312
+				$reg_csv_array[__('Payment Method(s)', 'event_espresso')] = implode(",", $payment_methods);
313
+				$reg_csv_array[__('Gateway Transaction ID(s)', 'event_espresso')] = implode(',', $gateway_txn_ids_etc);
314
+				//get whether or not the user has checked in
315
+				$reg_csv_array[__("Check-Ins",
316
+					"event_espresso")] = $reg_model->count_related($reg_row['Registration.REG_ID'], 'Checkin');
317
+				//get ticket of registration and its price
318
+				$ticket_model = \EE_Registry::instance()->load_model('Ticket');
319
+				if ($reg_row['Ticket.TKT_ID']) {
320
+					$ticket_name = \EEH_Export::prepare_value_from_db_for_display($ticket_model, 'TKT_name',
321
+						$reg_row['Ticket.TKT_name']);
322
+					$datetimes_strings = array();
323
+					foreach (
324
+						\EEM_Datetime::instance()->get_all_wpdb_results(array(
325
+							array('Ticket.TKT_ID' => $reg_row['Ticket.TKT_ID']),
326
+							'order_by'                 => array('DTT_EVT_start' => 'ASC'),
327
+							'default_where_conditions' => 'none',
328
+						)) as $datetime
329
+					) {
330
+						$datetimes_strings[] = \EEH_Export::prepare_value_from_db_for_display(\EEM_Datetime::instance(),
331
+							'DTT_EVT_start', $datetime['Datetime.DTT_EVT_start']);
332
+					}
333
+				} else {
334
+					$ticket_name = __('Unknown', 'event_espresso');
335
+					$datetimes_strings = array(__('Unknown', 'event_espresso'));
336
+				}
337
+				$reg_csv_array[$ticket_model->field_settings_for('TKT_name')->get_nicename()] = $ticket_name;
338
+				$reg_csv_array[__("Datetimes of Ticket", "event_espresso")] = implode(", ", $datetimes_strings);
339
+				//get datetime(s) of registration
340
+				//add attendee columns
341
+				foreach ($att_fields_to_include as $att_field_name) {
342
+					$field_obj = \EEM_Attendee::instance()->field_settings_for($att_field_name);
343
+					if ($reg_row['Attendee_CPT.ID']) {
344
+						if ($att_field_name == 'STA_ID') {
345
+							$value = \EEM_State::instance()
346
+											   ->get_var(array(array('STA_ID' => $reg_row['Attendee_Meta.STA_ID'])),
347
+												   'STA_name');
348
+						} elseif ($att_field_name == 'CNT_ISO') {
349
+							$value = \EEM_Country::instance()
350
+												 ->get_var(array(array('CNT_ISO' => $reg_row['Attendee_Meta.CNT_ISO'])),
351
+													 'CNT_name');
352
+						} else {
353
+							$value = \EEH_Export::prepare_value_from_db_for_display(\EEM_Attendee::instance(),
354
+								$att_field_name, $reg_row[$field_obj->get_qualified_column()]);
355
+						}
356
+					} else {
357
+						$value = '';
358
+					}
359
+					$reg_csv_array[\EEH_Export::get_column_name_for_field($field_obj)] = $value;
360
+				}
361
+				//make sure each registration has the same questions in the same order
362
+				foreach ($question_labels as $question_label) {
363
+					if ( ! isset($reg_csv_array[$question_label])) {
364
+						$reg_csv_array[$question_label] = null;
365
+					}
366
+				}
367
+				$answers = \EEM_Answer::instance()->get_all_wpdb_results(array(
368
+					array('REG_ID' => $reg_row['Registration.REG_ID']),
369
+					'force_join' => array('Question'),
370
+				));
371
+				//now fill out the questions THEY answered
372
+				foreach ($answers as $answer_row) {
373
+					if ($answer_row['Question.QST_ID']) {
374
+						$question_label = \EEH_Export::prepare_value_from_db_for_display(\EEM_Question::instance(),
375
+							'QST_admin_label', $answer_row['Question.QST_admin_label']);
376
+					} else {
377
+						$question_label = sprintf(__('Question $s', 'event_espresso'), $answer_row['Answer.QST_ID']);
378
+					}
379
+					if (isset($answer_row['Question.QST_type'])
380
+						&& $answer_row['Question.QST_type'] == \EEM_Question::QST_type_state
381
+					) {
382
+						$reg_csv_array[$question_label] = \EEM_State::instance()
383
+																	->get_state_name_by_ID($answer_row['Answer.ANS_value']);
384
+					} else {
385
+						//this isn't for html, so don't show html entities
386
+						$reg_csv_array[$question_label] = html_entity_decode(\EEH_Export::prepare_value_from_db_for_display(\EEM_Answer::instance(),
387
+							'ANS_value', $answer_row['Answer.ANS_value']));
388
+					}
389
+				}
390
+				/**
391
+				 * Filter to change the contents of each row of the registrations report CSV file.
392
+				 *
393
+				 * This can be used to add or remote columns from the CSV file, or change their values.                 *
394
+				 * Note: it has this name because originally that's where this filter resided,
395
+				 * and we've left its name as-is for backward compatibility.
396
+				 * Note when using: all rows in the CSV should have the same columns.
397
+				 *
398
+				 * @param array $reg_csv_array keys are column-header names, and values are that columns' value
399
+				 *                             in this row
400
+				 * @param array $reg_row is the row from the database's wp_esp_registration table
401
+				 *
402
+				 */
403
+				$registrations_csv_ready_array[] = apply_filters(
404
+					'FHEE__EE_Export__report_registrations__reg_csv_array',
405
+					$reg_csv_array,
406
+					$reg_row
407
+				);
408
+			}
409
+		}
410
+		//if we couldn't export anything, we want to at least show the column headers
411
+		if (empty($registrations_csv_ready_array)) {
412
+			$reg_csv_array = array();
413
+			$model_and_fields_to_include = array(
414
+				'Registration' => $reg_fields_to_include,
415
+				'Attendee'     => $att_fields_to_include,
416
+			);
417
+			foreach ($model_and_fields_to_include as $model_name => $field_list) {
418
+				$model = \EE_Registry::instance()->load_model($model_name);
419
+				foreach ($field_list as $field_name) {
420
+					$field = $model->field_settings_for($field_name);
421
+					$reg_csv_array[\EEH_Export::get_column_name_for_field($field)] = null;
422
+				}
423
+			}
424
+			$registrations_csv_ready_array[] = $reg_csv_array;
425
+		}
426
+		return $registrations_csv_ready_array;
427
+	}
429 428
 
430 429
 
431 430
 
432
-    /**
433
-     * Counts total unit to process
434
-     *
435
-     * @deprecated since 4.9.19
436
-     * @param int|array $event_id
437
-     * @return int
438
-     */
439
-    public function count_units_to_process($event_id)
440
-    {
441
-        //use the legacy filter
442
-        if ($event_id) {
443
-            $query_params[0]['EVT_ID'] = $event_id;
444
-        } else {
445
-            $query_params['force_join'][] = 'Event';
446
-        }
447
-        return \EEM_Registration::instance()->count($query_params);
448
-    }
431
+	/**
432
+	 * Counts total unit to process
433
+	 *
434
+	 * @deprecated since 4.9.19
435
+	 * @param int|array $event_id
436
+	 * @return int
437
+	 */
438
+	public function count_units_to_process($event_id)
439
+	{
440
+		//use the legacy filter
441
+		if ($event_id) {
442
+			$query_params[0]['EVT_ID'] = $event_id;
443
+		} else {
444
+			$query_params['force_join'][] = 'Event';
445
+		}
446
+		return \EEM_Registration::instance()->count($query_params);
447
+	}
449 448
 
450 449
 
451 450
 
452
-    /**
453
-     * Performs any clean-up logic when we know the job is completed.
454
-     * In this case, we delete the temporary file
455
-     *
456
-     * @param JobParameters $job_parameters
457
-     * @return boolean
458
-     */
459
-    public function cleanup_job(JobParameters $job_parameters)
460
-    {
461
-        $this->_file_helper->delete(\EEH_File::remove_filename_from_filepath($job_parameters->extra_datum('filepath')),
462
-            true, 'd');
463
-        return new JobStepResponse($job_parameters, __('Cleaned up temporary file', 'event_espresso'));
464
-    }
451
+	/**
452
+	 * Performs any clean-up logic when we know the job is completed.
453
+	 * In this case, we delete the temporary file
454
+	 *
455
+	 * @param JobParameters $job_parameters
456
+	 * @return boolean
457
+	 */
458
+	public function cleanup_job(JobParameters $job_parameters)
459
+	{
460
+		$this->_file_helper->delete(\EEH_File::remove_filename_from_filepath($job_parameters->extra_datum('filepath')),
461
+			true, 'd');
462
+		return new JobStepResponse($job_parameters, __('Cleaned up temporary file', 'event_espresso'));
463
+	}
465 464
 }
466 465
 
467 466
 
Please login to merge, or discard this patch.
admin/extend/general_settings/Extend_General_Settings_Admin_Page.core.php 2 patches
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 if ( ! defined('EVENT_ESPRESSO_VERSION')) {
3
-    exit('NO direct script access allowed');
3
+	exit('NO direct script access allowed');
4 4
 }
5 5
 
6 6
 /**
@@ -21,62 +21,62 @@  discard block
 block discarded – undo
21 21
 {
22 22
     
23 23
     
24
-    public function __construct($routing = true)
25
-    {
26
-        parent::__construct($routing);
27
-        define('GEN_SET_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'general_settings/templates/');
28
-    }
24
+	public function __construct($routing = true)
25
+	{
26
+		parent::__construct($routing);
27
+		define('GEN_SET_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'general_settings/templates/');
28
+	}
29 29
     
30 30
     
31
-    protected function _extend_page_config()
32
-    {
31
+	protected function _extend_page_config()
32
+	{
33 33
         
34
-        $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'general_settings';
34
+		$this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'general_settings';
35 35
         
36
-        //filters and action hooks here
37
-        add_action('AHEE__admin_option_settings__template__before', array($this, 'debug_logging_options'), 9);
38
-        add_filter('FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin',
39
-            array($this, 'update_debug_logging_options'), 10, 1);
36
+		//filters and action hooks here
37
+		add_action('AHEE__admin_option_settings__template__before', array($this, 'debug_logging_options'), 9);
38
+		add_filter('FHEE__General_Settings_Admin_Page___update_admin_option_settings__CFG_admin',
39
+			array($this, 'update_debug_logging_options'), 10, 1);
40 40
         
41
-    }
41
+	}
42 42
     
43 43
     
44 44
     
45
-    /*************        Logging Settings        *************/
45
+	/*************        Logging Settings        *************/
46 46
     
47
-    /**
48
-     * debug_logging_options
49
-     *
50
-     * @param array $template_args
51
-     *
52
-     * @return void
53
-     */
54
-    public function debug_logging_options($template_args = array())
55
-    {
56
-        $template_args['use_full_logging']   = EE_Registry::instance()->CFG->admin->use_full_logging;
57
-        $template_args['use_remote_logging'] = isset(EE_Registry::instance()->CFG->admin->use_remote_logging) ? absint(EE_Registry::instance()->CFG->admin->use_remote_logging) : false;
58
-        $template_args['remote_logging_url'] = isset(EE_Registry::instance()->CFG->admin->remote_logging_url) && ! empty(EE_Registry::instance()->CFG->admin->remote_logging_url) ? stripslashes(EE_Registry::instance()->CFG->admin->remote_logging_url) : '';
59
-        $template                            = GEN_SET_CAF_TEMPLATE_PATH . 'debug_log_settings.template.php';
60
-        EEH_Template::display_template($template, $template_args);
61
-    }
47
+	/**
48
+	 * debug_logging_options
49
+	 *
50
+	 * @param array $template_args
51
+	 *
52
+	 * @return void
53
+	 */
54
+	public function debug_logging_options($template_args = array())
55
+	{
56
+		$template_args['use_full_logging']   = EE_Registry::instance()->CFG->admin->use_full_logging;
57
+		$template_args['use_remote_logging'] = isset(EE_Registry::instance()->CFG->admin->use_remote_logging) ? absint(EE_Registry::instance()->CFG->admin->use_remote_logging) : false;
58
+		$template_args['remote_logging_url'] = isset(EE_Registry::instance()->CFG->admin->remote_logging_url) && ! empty(EE_Registry::instance()->CFG->admin->remote_logging_url) ? stripslashes(EE_Registry::instance()->CFG->admin->remote_logging_url) : '';
59
+		$template                            = GEN_SET_CAF_TEMPLATE_PATH . 'debug_log_settings.template.php';
60
+		EEH_Template::display_template($template, $template_args);
61
+	}
62 62
     
63 63
     
64
-    /**
65
-     * update_debug_logging_options
66
-     *
67
-     * @param array $admin_options
68
-     *
69
-     * @return array
70
-     */
71
-    public function update_debug_logging_options($admin_options = array())
72
-    {
73
-        $use_full_logging                = isset($this->_req_data['use_full_logging']) ? (bool)absint($this->_req_data['use_full_logging']) : $admin_options->use_full_logging;
74
-        $admin_options->use_full_logging = $use_full_logging;
75
-        $admin_options->use_remote_logging = isset($this->_req_data['use_remote_logging']) ? absint($this->_req_data['use_remote_logging']) : $admin_options->use_remote_logging;
76
-        $admin_options->remote_logging_url = isset($this->_req_data['remote_logging_url']) ? esc_url_raw($this->_req_data['remote_logging_url']) : $admin_options->remote_logging_url;
64
+	/**
65
+	 * update_debug_logging_options
66
+	 *
67
+	 * @param array $admin_options
68
+	 *
69
+	 * @return array
70
+	 */
71
+	public function update_debug_logging_options($admin_options = array())
72
+	{
73
+		$use_full_logging                = isset($this->_req_data['use_full_logging']) ? (bool)absint($this->_req_data['use_full_logging']) : $admin_options->use_full_logging;
74
+		$admin_options->use_full_logging = $use_full_logging;
75
+		$admin_options->use_remote_logging = isset($this->_req_data['use_remote_logging']) ? absint($this->_req_data['use_remote_logging']) : $admin_options->use_remote_logging;
76
+		$admin_options->remote_logging_url = isset($this->_req_data['remote_logging_url']) ? esc_url_raw($this->_req_data['remote_logging_url']) : $admin_options->remote_logging_url;
77 77
         
78
-        return $admin_options;
79
-    }
78
+		return $admin_options;
79
+	}
80 80
     
81 81
     
82 82
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -24,14 +24,14 @@  discard block
 block discarded – undo
24 24
     public function __construct($routing = true)
25 25
     {
26 26
         parent::__construct($routing);
27
-        define('GEN_SET_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND . 'general_settings/templates/');
27
+        define('GEN_SET_CAF_TEMPLATE_PATH', EE_CORE_CAF_ADMIN_EXTEND.'general_settings/templates/');
28 28
     }
29 29
     
30 30
     
31 31
     protected function _extend_page_config()
32 32
     {
33 33
         
34
-        $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND . 'general_settings';
34
+        $this->_admin_base_path = EE_CORE_CAF_ADMIN_EXTEND.'general_settings';
35 35
         
36 36
         //filters and action hooks here
37 37
         add_action('AHEE__admin_option_settings__template__before', array($this, 'debug_logging_options'), 9);
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
         $template_args['use_full_logging']   = EE_Registry::instance()->CFG->admin->use_full_logging;
57 57
         $template_args['use_remote_logging'] = isset(EE_Registry::instance()->CFG->admin->use_remote_logging) ? absint(EE_Registry::instance()->CFG->admin->use_remote_logging) : false;
58 58
         $template_args['remote_logging_url'] = isset(EE_Registry::instance()->CFG->admin->remote_logging_url) && ! empty(EE_Registry::instance()->CFG->admin->remote_logging_url) ? stripslashes(EE_Registry::instance()->CFG->admin->remote_logging_url) : '';
59
-        $template                            = GEN_SET_CAF_TEMPLATE_PATH . 'debug_log_settings.template.php';
59
+        $template                            = GEN_SET_CAF_TEMPLATE_PATH.'debug_log_settings.template.php';
60 60
         EEH_Template::display_template($template, $template_args);
61 61
     }
62 62
     
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
      */
71 71
     public function update_debug_logging_options($admin_options = array())
72 72
     {
73
-        $use_full_logging                = isset($this->_req_data['use_full_logging']) ? (bool)absint($this->_req_data['use_full_logging']) : $admin_options->use_full_logging;
73
+        $use_full_logging                = isset($this->_req_data['use_full_logging']) ? (bool) absint($this->_req_data['use_full_logging']) : $admin_options->use_full_logging;
74 74
         $admin_options->use_full_logging = $use_full_logging;
75 75
         $admin_options->use_remote_logging = isset($this->_req_data['use_remote_logging']) ? absint($this->_req_data['use_remote_logging']) : $admin_options->use_remote_logging;
76 76
         $admin_options->remote_logging_url = isset($this->_req_data['remote_logging_url']) ? esc_url_raw($this->_req_data['remote_logging_url']) : $admin_options->remote_logging_url;
Please login to merge, or discard this patch.
caffeinated/payment_methods/Aim/EEG_Aim.gateway.php 2 patches
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-if (!defined('EVENT_ESPRESSO_VERSION'))
3
+if ( ! defined('EVENT_ESPRESSO_VERSION'))
4 4
 	exit('No direct script access allowed');
5 5
 
6 6
 /**
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
  *
26 26
  * ------------------------------------------------------------------------
27 27
  */
28
-class EEG_Aim extends EE_Onsite_Gateway{
28
+class EEG_Aim extends EE_Onsite_Gateway {
29 29
 
30 30
 	const LIVE_URL    = 'https://secure2.authorize.net/gateway/transact.dll'; //Authnet URL
31 31
 
@@ -157,9 +157,9 @@  discard block
 block discarded – undo
157 157
 	 * @param EEG_Aim $gateway_object
158 158
 	 * @return string
159 159
 	 */
160
-	public function possibly_use_deprecated_aim_server( $url, EEG_Aim $gateway_object ) {
161
-		if(  $gateway_object->_server === 'authorize.net'
162
-			&& ! $gateway_object->_debug_mode ) {
160
+	public function possibly_use_deprecated_aim_server($url, EEG_Aim $gateway_object) {
161
+		if ($gateway_object->_server === 'authorize.net'
162
+			&& ! $gateway_object->_debug_mode) {
163 163
 			return 'https://secure.authorize.net/gateway/transact.dll';
164 164
 		} else {
165 165
 			return $url;
@@ -182,33 +182,33 @@  discard block
 block discarded – undo
182 182
 	 */
183 183
 
184 184
 	public function do_direct_payment($payment, $billing_info = null) {
185
-			add_filter( 'FHEE__EEG_Aim___get_server_url', array( $this, 'possibly_use_deprecated_aim_server' ), 10, 2 );
185
+			add_filter('FHEE__EEG_Aim___get_server_url', array($this, 'possibly_use_deprecated_aim_server'), 10, 2);
186 186
 			// Enable test mode if needed
187 187
 			//4007000000027  <-- test successful visa
188 188
 			//4222222222222  <-- test failure card number
189 189
 
190 190
 			$item_num = 1;
191 191
 			$transaction = $payment->transaction();
192
-			$order_description = $this->_format_order_description( $payment );
192
+			$order_description = $this->_format_order_description($payment);
193 193
 			$primary_registrant = $transaction->primary_registration();
194 194
 			//if we're are charging for the full amount, show the normal line items
195 195
 			//and the itemized total adds up properly
196
-			if( $this->_can_easily_itemize_transaction_for( $payment ) ){
196
+			if ($this->_can_easily_itemize_transaction_for($payment)) {
197 197
 				$total_line_item = $transaction->total_line_item();
198 198
 				foreach ($total_line_item->get_items() as $line_item) {
199
-					if( $line_item->quantity() == 0 ){
199
+					if ($line_item->quantity() == 0) {
200 200
 						continue;
201 201
 					}
202 202
 					$this->addLineItem(
203 203
 						$item_num++, 
204
-						$this->_format_line_item_name( $line_item, $payment ), 
205
-						$this->_format_line_item_desc( $line_item, $payment ), 
204
+						$this->_format_line_item_name($line_item, $payment), 
205
+						$this->_format_line_item_desc($line_item, $payment), 
206 206
 						$line_item->quantity(),
207 207
 						$line_item->unit_price(), 
208 208
 						'N');
209 209
 					$order_description .= $line_item->desc().', ';
210 210
 				}
211
-				foreach($total_line_item->tax_descendants() as $tax_line_item){
211
+				foreach ($total_line_item->tax_descendants() as $tax_line_item) {
212 212
 					$this->addLineItem($item_num++, $tax_line_item->name(), $tax_line_item->desc(), 1, $tax_line_item->total(), 'N');
213 213
 				}
214 214
 			}
@@ -219,18 +219,18 @@  discard block
 block discarded – undo
219 219
 			//start transaction
220 220
 			//if in debug mode, use authorize.net's sandbox id; otherwise use the Event Espresso partner id
221 221
 			$partner_id = $this->_debug_mode ? 'AAA100302' : 'AAA105363';
222
-			$this->setField( 'solution_id', $partner_id );
222
+			$this->setField('solution_id', $partner_id);
223 223
 			$this->setField('amount', $this->format_currency($payment->amount()));
224
-			$this->setField('description',substr(rtrim($order_description, ', '), 0, 255));
225
-			$this->_set_sensitive_billing_data( $billing_info );
224
+			$this->setField('description', substr(rtrim($order_description, ', '), 0, 255));
225
+			$this->_set_sensitive_billing_data($billing_info);
226 226
 			$this->setField('first_name', $billing_info['first_name']);
227 227
 			$this->setField('last_name', $billing_info['last_name']);
228 228
 			$this->setField('email', $billing_info['email']);
229 229
 			$this->setField('company', $billing_info['company']);
230 230
 			$this->setField('address', $billing_info['address'].' '.$billing_info['address2']);
231 231
 			$this->setField('city', $billing_info['city']);
232
-			$this->setField('state', $billing_info['state'] );
233
-			$this->setField('country', $billing_info['country'] );
232
+			$this->setField('state', $billing_info['state']);
233
+			$this->setField('country', $billing_info['country']);
234 234
 			$this->setField('zip', $billing_info['zip']);
235 235
 			$this->setField('fax', $billing_info['fax']);
236 236
 			$this->setField('cust_id', $primary_registrant->ID());
@@ -238,9 +238,9 @@  discard block
 block discarded – undo
238 238
 			//invoice_num would be nice to have it be unique per SPCO page-load, that way if users
239 239
 			//press back, they don't submit a duplicate. However, we may be keeping the user on teh same spco page
240 240
 			//in which case, we need to generate teh invoice num per request right here...
241
-			$this->setField('invoice_num', wp_generate_password(12,false));//$billing_info['_reg-page-billing-invoice-'.$this->_gateway_name]['value']);
241
+			$this->setField('invoice_num', wp_generate_password(12, false)); //$billing_info['_reg-page-billing-invoice-'.$this->_gateway_name]['value']);
242 242
 			//tell AIM that any duplicates sent in the next 5 minutes are to be ignored
243
-            $this->setField('duplicate_window', 5 * MINUTE_IN_SECONDS );
243
+            $this->setField('duplicate_window', 5 * MINUTE_IN_SECONDS);
244 244
 
245 245
 
246 246
 			if ($this->_test_transactions) {
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 			//Capture response
251 251
 			$this->type = "AUTH_CAPTURE";
252 252
 			$response = $this->_sendRequest($payment);
253
-			if (!empty($response)){
253
+			if ( ! empty($response)) {
254 254
 				if ($response->error_message) {
255 255
                     $payment->set_status($this->_pay_model->failed_status());
256 256
                     $payment->set_gateway_response($response->error_message);
@@ -258,7 +258,7 @@  discard block
 block discarded – undo
258 258
                     $payment_status = $response->approved ? $this->_pay_model->approved_status() : $this->_pay_model->declined_status();
259 259
                     $payment->set_status($payment_status);
260 260
                     //make sure we interpret the AMT as a float, not an international string (where periods are thousand separators)
261
-                    $payment->set_amount( (float) $response->amount );
261
+                    $payment->set_amount((float) $response->amount);
262 262
                     $payment->set_gateway_response(
263 263
                         sprintf(
264 264
                             esc_html__('%1$s (Reason Code: %2$s)', 'event_espresso'),
@@ -271,14 +271,14 @@  discard block
 block discarded – undo
271 271
                     } else {
272 272
                         $txn_id = $response->transaction_id;
273 273
                     }
274
-                    $payment->set_txn_id_chq_nmbr( $txn_id );
274
+                    $payment->set_txn_id_chq_nmbr($txn_id);
275 275
                 }
276 276
 				$payment->set_extra_accntng($primary_registrant->reg_code());
277
-				$payment->set_details(print_r($response,true));
277
+				$payment->set_details(print_r($response, true));
278 278
 			} else {
279 279
 				$payment->set_status($this->_pay_model->failed_status());
280 280
 				$payment->set_gateway_response(__("There was no response from Authorize.net", 'event_espresso'));
281
-				$payment->set_details(print_r($response,true));
281
+				$payment->set_details(print_r($response, true));
282 282
 			}
283 283
 		return $payment;
284 284
 	}
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 	 * what billing data gets sent
290 290
 	 * @param array $billing_info
291 291
 	 */
292
-	protected function _set_sensitive_billing_data( $billing_info ) {
292
+	protected function _set_sensitive_billing_data($billing_info) {
293 293
 		$this->setField('card_num', $billing_info['credit_card']);
294 294
 		$this->setField('exp_date', $billing_info['exp_month'].$billing_info['exp_year']);
295 295
 		$this->setField('card_code', $billing_info['cvv']);
@@ -347,23 +347,23 @@  discard block
 block discarded – undo
347 347
 		$this->_x_post_fields['tran_key'] = $this->_transaction_key;
348 348
 		$x_keys = array();
349 349
 		foreach ($this->_x_post_fields as $key => $value) {
350
-			$x_keys[] = "x_$key=" . urlencode($this->_get_unsupported_character_remover()->format($value));
350
+			$x_keys[] = "x_$key=".urlencode($this->_get_unsupported_character_remover()->format($value));
351 351
 		}
352 352
 		// Add line items
353 353
 		foreach ($this->_additional_line_items as $key => $value) {
354
-			$x_keys[] =  "x_line_item=" . urlencode($this->_get_unsupported_character_remover()->format($value));
354
+			$x_keys[] = "x_line_item=".urlencode($this->_get_unsupported_character_remover()->format($value));
355 355
 		}
356 356
 		$this->_log_clean_request($x_keys, $payment);
357 357
 		$post_url = $this->_get_server_url();
358 358
 		$curl_request = curl_init($post_url);
359
-        $post_body = implode("&",$x_keys);
359
+        $post_body = implode("&", $x_keys);
360 360
 		curl_setopt($curl_request, CURLOPT_POSTFIELDS, $post_body);
361 361
 		curl_setopt($curl_request, CURLOPT_HEADER, 0);
362 362
 		curl_setopt($curl_request, CURLOPT_TIMEOUT, 45);
363 363
 		curl_setopt($curl_request, CURLOPT_RETURNTRANSFER, 1);
364 364
 		curl_setopt($curl_request, CURLOPT_SSL_VERIFYHOST, 2);
365 365
 		if ($this->VERIFY_PEER) {
366
-			curl_setopt($curl_request, CURLOPT_CAINFO, dirname( __DIR__ ) . '/ssl/cert.pem');
366
+			curl_setopt($curl_request, CURLOPT_CAINFO, dirname(__DIR__).'/ssl/cert.pem');
367 367
 		} else {
368 368
 			curl_setopt($curl_request, CURLOPT_SSL_VERIFYPEER, false);
369 369
 		}
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
 		$response = curl_exec($curl_request);
376 376
 
377 377
 		curl_close($curl_request);
378
-		$response_obj =  new EE_AuthorizeNetAIM_Response($response);
378
+		$response_obj = new EE_AuthorizeNetAIM_Response($response);
379 379
 
380 380
 		return $this->_log_and_clean_response($response_obj, $payment);
381 381
 	}
@@ -384,18 +384,18 @@  discard block
 block discarded – undo
384 384
 	 * @param array $request_array
385 385
 	 * @param EEI_Payment $payment
386 386
 	 */
387
-	protected function _log_clean_request($request_array,$payment){
388
-		$keys_to_filter_out = array( 'x_card_num', 'x_card_code', 'x_exp_date' );
389
-		foreach($request_array as $index => $keyvaltogether ) {
390
-			foreach( $keys_to_filter_out as $key ) {
391
-				if( strpos( $keyvaltogether, $key ) === 0 ){
387
+	protected function _log_clean_request($request_array, $payment) {
388
+		$keys_to_filter_out = array('x_card_num', 'x_card_code', 'x_exp_date');
389
+		foreach ($request_array as $index => $keyvaltogether) {
390
+			foreach ($keys_to_filter_out as $key) {
391
+				if (strpos($keyvaltogether, $key) === 0) {
392 392
 					//found it at the first character
393 393
 					//so its one of them
394
-					unset( $request_array[ $index ] );
394
+					unset($request_array[$index]);
395 395
 				}
396 396
 			}
397 397
 		}
398
-		$this->log(array('AIM Request sent:'=>$request_array, 'Server URL' => $this->_get_server_url() ),$payment);
398
+		$this->log(array('AIM Request sent:'=>$request_array, 'Server URL' => $this->_get_server_url()), $payment);
399 399
 	}
400 400
 
401 401
 
@@ -407,9 +407,9 @@  discard block
 block discarded – undo
407 407
 	 * @param EE_Payment                  $payment
408 408
 	 * @return \EE_AuthorizeNetAIM_Response
409 409
 	 */
410
-	private function _log_and_clean_response($response_obj,$payment){
410
+	private function _log_and_clean_response($response_obj, $payment) {
411 411
 		$response_obj->account_number = '';
412
-		$this->log(array('AIM Response received:'=>(array)$response_obj),$payment);
412
+		$this->log(array('AIM Response received:'=>(array) $response_obj), $payment);
413 413
 		return $response_obj;
414 414
 	}
415 415
 
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
 			// Split Array
509 509
 			$this->response = $response;
510 510
 			if ($encap_char) {
511
-				$this->_response_array = explode($encap_char . $delimiter . $encap_char, substr($response, 1, -1));
511
+				$this->_response_array = explode($encap_char.$delimiter.$encap_char, substr($response, 1, -1));
512 512
 			} else {
513 513
 				$this->_response_array = explode($delimiter, $response);
514 514
 			}
@@ -591,7 +591,7 @@  discard block
 block discarded – undo
591 591
 
592 592
 }
593 593
 
594
-if ( ! class_exists( 'AuthorizeNetException' ) ) {
594
+if ( ! class_exists('AuthorizeNetException')) {
595 595
 	/**
596 596
 	 * Class AuthorizeNetException
597 597
 	 *
@@ -607,8 +607,8 @@  discard block
 block discarded – undo
607 607
 		 * @param Exception $previous [optional] The previous exception used for the exception chaining. Since 5.3.0
608 608
 		 * @since 5.1.0
609 609
 		 */
610
-		public function __construct( $message = "", $code = 0, Exception $previous = null ) {
611
-			parent::__construct( $message, $code, $previous );
610
+		public function __construct($message = "", $code = 0, Exception $previous = null) {
611
+			parent::__construct($message, $code, $previous);
612 612
 		}
613 613
 	}
614 614
 }
Please login to merge, or discard this patch.
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 			//in which case, we need to generate teh invoice num per request right here...
241 241
 			$this->setField('invoice_num', wp_generate_password(12,false));//$billing_info['_reg-page-billing-invoice-'.$this->_gateway_name]['value']);
242 242
 			//tell AIM that any duplicates sent in the next 5 minutes are to be ignored
243
-            $this->setField('duplicate_window', 5 * MINUTE_IN_SECONDS );
243
+			$this->setField('duplicate_window', 5 * MINUTE_IN_SECONDS );
244 244
 
245 245
 
246 246
 			if ($this->_test_transactions) {
@@ -252,27 +252,27 @@  discard block
 block discarded – undo
252 252
 			$response = $this->_sendRequest($payment);
253 253
 			if (!empty($response)){
254 254
 				if ($response->error_message) {
255
-                    $payment->set_status($this->_pay_model->failed_status());
256
-                    $payment->set_gateway_response($response->error_message);
257
-                } else {
258
-                    $payment_status = $response->approved ? $this->_pay_model->approved_status() : $this->_pay_model->declined_status();
259
-                    $payment->set_status($payment_status);
260
-                    //make sure we interpret the AMT as a float, not an international string (where periods are thousand separators)
261
-                    $payment->set_amount( (float) $response->amount );
262
-                    $payment->set_gateway_response(
263
-                        sprintf(
264
-                            esc_html__('%1$s (Reason Code: %2$s)', 'event_espresso'),
265
-                            $response->response_reason_text,
266
-                            $response->response_reason_code
267
-                        )
268
-                    );
269
-                    if ($this->_debug_mode) {
270
-                        $txn_id = $response->invoice_number;
271
-                    } else {
272
-                        $txn_id = $response->transaction_id;
273
-                    }
274
-                    $payment->set_txn_id_chq_nmbr( $txn_id );
275
-                }
255
+					$payment->set_status($this->_pay_model->failed_status());
256
+					$payment->set_gateway_response($response->error_message);
257
+				} else {
258
+					$payment_status = $response->approved ? $this->_pay_model->approved_status() : $this->_pay_model->declined_status();
259
+					$payment->set_status($payment_status);
260
+					//make sure we interpret the AMT as a float, not an international string (where periods are thousand separators)
261
+					$payment->set_amount( (float) $response->amount );
262
+					$payment->set_gateway_response(
263
+						sprintf(
264
+							esc_html__('%1$s (Reason Code: %2$s)', 'event_espresso'),
265
+							$response->response_reason_text,
266
+							$response->response_reason_code
267
+						)
268
+					);
269
+					if ($this->_debug_mode) {
270
+						$txn_id = $response->invoice_number;
271
+					} else {
272
+						$txn_id = $response->transaction_id;
273
+					}
274
+					$payment->set_txn_id_chq_nmbr( $txn_id );
275
+				}
276 276
 				$payment->set_extra_accntng($primary_registrant->reg_code());
277 277
 				$payment->set_details(print_r($response,true));
278 278
 			} else {
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
 		$this->_log_clean_request($x_keys, $payment);
357 357
 		$post_url = $this->_get_server_url();
358 358
 		$curl_request = curl_init($post_url);
359
-        $post_body = implode("&",$x_keys);
359
+		$post_body = implode("&",$x_keys);
360 360
 		curl_setopt($curl_request, CURLOPT_POSTFIELDS, $post_body);
361 361
 		curl_setopt($curl_request, CURLOPT_HEADER, 0);
362 362
 		curl_setopt($curl_request, CURLOPT_TIMEOUT, 45);
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
 	public $requested_amount;
490 490
 	public $balance_on_card;
491 491
 	public $response; // The response string from AuthorizeNet.
492
-    public $error_message;
492
+	public $error_message;
493 493
 	private $_response_array = array(); // An array with the split response.
494 494
 
495 495
 	/**
@@ -521,9 +521,9 @@  discard block
 block discarded – undo
521 521
 				$this->approved = false;
522 522
 				$this->error = true;
523 523
 				$this->error_message = sprintf(
524
-				    esc_html__('Unrecognized response from Authorize.net: %1$s', 'event_espresso'),
525
-                    esc_html($response)
526
-                );
524
+					esc_html__('Unrecognized response from Authorize.net: %1$s', 'event_espresso'),
525
+					esc_html($response)
526
+				);
527 527
 				return;
528 528
 			}
529 529
 
@@ -584,9 +584,9 @@  discard block
 block discarded – undo
584 584
 			$this->approved = false;
585 585
 			$this->error = true;
586 586
 			$this->error_message = esc_html__(
587
-			    'Error connecting to Authorize.net',
588
-                'event_espresso'
589
-            );
587
+				'Error connecting to Authorize.net',
588
+				'event_espresso'
589
+			);
590 590
 		}
591 591
 	}
592 592
 
Please login to merge, or discard this patch.
core/services/collections/LooseCollection.php 2 patches
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -4,7 +4,7 @@  discard block
 block discarded – undo
4 4
 use EventEspresso\core\exceptions\InvalidEntityException;
5 5
 
6 6
 if ( ! defined('EVENT_ESPRESSO_VERSION')) {
7
-    exit('No direct script access allowed');
7
+	exit('No direct script access allowed');
8 8
 }
9 9
 
10 10
 
@@ -22,40 +22,40 @@  discard block
 block discarded – undo
22 22
 
23 23
 
24 24
 
25
-    /**
26
-     * setCollectionInterface
27
-     *
28
-     * @access protected
29
-     * @param  string $collection_interface
30
-     */
31
-    protected function setCollectionInterface($collection_interface )
32
-    {
33
-        $this->collection_interface = '';
34
-    }
25
+	/**
26
+	 * setCollectionInterface
27
+	 *
28
+	 * @access protected
29
+	 * @param  string $collection_interface
30
+	 */
31
+	protected function setCollectionInterface($collection_interface )
32
+	{
33
+		$this->collection_interface = '';
34
+	}
35 35
 
36 36
 
37 37
 
38
-    /**
39
-     * add
40
-     * attaches an object to the Collection
41
-     * and sets any supplied data associated with the current iterator entry
42
-     * by calling EE_Object_Collection::set_identifier()
43
-     *
44
-     * @access public
45
-     * @param  mixed $object
46
-     * @param  mixed $identifier
47
-     * @return bool
48
-     * @throws InvalidEntityException
49
-     */
50
-    public function add($object, $identifier = null)
51
-    {
52
-        if (! is_object($object)) {
53
-            throw new InvalidEntityException($object, 'object');
54
-        }
55
-        $this->attach($object);
56
-        $this->setIdentifier($object, $identifier);
57
-        return $this->contains($object);
58
-    }
38
+	/**
39
+	 * add
40
+	 * attaches an object to the Collection
41
+	 * and sets any supplied data associated with the current iterator entry
42
+	 * by calling EE_Object_Collection::set_identifier()
43
+	 *
44
+	 * @access public
45
+	 * @param  mixed $object
46
+	 * @param  mixed $identifier
47
+	 * @return bool
48
+	 * @throws InvalidEntityException
49
+	 */
50
+	public function add($object, $identifier = null)
51
+	{
52
+		if (! is_object($object)) {
53
+			throw new InvalidEntityException($object, 'object');
54
+		}
55
+		$this->attach($object);
56
+		$this->setIdentifier($object, $identifier);
57
+		return $this->contains($object);
58
+	}
59 59
 
60 60
 
61 61
 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
      * @access protected
29 29
      * @param  string $collection_interface
30 30
      */
31
-    protected function setCollectionInterface($collection_interface )
31
+    protected function setCollectionInterface($collection_interface)
32 32
     {
33 33
         $this->collection_interface = '';
34 34
     }
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
      */
50 50
     public function add($object, $identifier = null)
51 51
     {
52
-        if (! is_object($object)) {
52
+        if ( ! is_object($object)) {
53 53
             throw new InvalidEntityException($object, 'object');
54 54
         }
55 55
         $this->attach($object);
Please login to merge, or discard this patch.
core/services/shortcodes/ShortcodesManager.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
                 'FHEE__EventEspresso_core_services_shortcodes_ShortcodesManager__registerShortcodes__shortcode_collection',
137 137
                 $this->getShortcodes()
138 138
             );
139
-            if (! $this->shortcodes instanceof CollectionInterface) {
139
+            if ( ! $this->shortcodes instanceof CollectionInterface) {
140 140
                 throw new InvalidEntityException(
141 141
                     $this->shortcodes,
142 142
                     'CollectionInterface',
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
             // cycle thru shortcode folders
167 167
             foreach ($this->shortcodes as $shortcode) {
168 168
                 /** @var ShortcodeInterface $shortcode */
169
-                if ( $shortcode instanceof EnqueueAssetsInterface) {
169
+                if ($shortcode instanceof EnqueueAssetsInterface) {
170 170
                     add_action('wp_enqueue_scripts', array($shortcode, 'registerScriptsAndStylesheets'), 10);
171 171
                     add_action('wp_enqueue_scripts', array($shortcode, 'enqueueStylesheets'), 11);
172 172
                 }
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
     public function parseContentForShortcodes($content)
226 226
     {
227 227
         $has_shortcode = false;
228
-        if(empty($this->shortcodes)){
228
+        if (empty($this->shortcodes)) {
229 229
             return $has_shortcode;
230 230
         }
231 231
         foreach ($this->shortcodes as $shortcode) {
Please login to merge, or discard this patch.
Indentation   +205 added lines, -205 removed lines patch added patch discarded remove patch
@@ -32,211 +32,211 @@
 block discarded – undo
32 32
 class ShortcodesManager
33 33
 {
34 34
 
35
-    /**
36
-     * @var LegacyShortcodesManager $legacy_shortcodes_manager
37
-     */
38
-    private $legacy_shortcodes_manager;
39
-
40
-    /**
41
-     * @var ShortcodeInterface[] $shortcodes
42
-     */
43
-    private $shortcodes;
44
-
45
-
46
-
47
-    /**
48
-     * ShortcodesManager constructor
49
-     *
50
-     * @param LegacyShortcodesManager $legacy_shortcodes_manager
51
-     */
52
-    public function __construct(LegacyShortcodesManager $legacy_shortcodes_manager) {
53
-        $this->legacy_shortcodes_manager = $legacy_shortcodes_manager;
54
-        // assemble a list of installed and active shortcodes
55
-        add_action(
56
-            'AHEE__EE_System__register_shortcodes_modules_and_widgets',
57
-            array($this, 'registerShortcodes'),
58
-            999
59
-        );
60
-        //  call add_shortcode() for all installed shortcodes
61
-        add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'addShortcodes'));
62
-        // check content for shortcodes the old way
63
-        add_action('parse_query', array($this->legacy_shortcodes_manager, 'initializeShortcodes'), 5);
64
-        // check content for shortcodes the NEW more efficient way
65
-        add_action('template_redirect', array($this, 'templateRedirect'), 999);
66
-    }
67
-
68
-
69
-
70
-    /**
71
-     * @return CollectionInterface|ShortcodeInterface[]
72
-     * @throws InvalidIdentifierException
73
-     * @throws InvalidInterfaceException
74
-     * @throws InvalidFilePathException
75
-     * @throws InvalidEntityException
76
-     * @throws InvalidDataTypeException
77
-     * @throws InvalidClassException
78
-     */
79
-    public function getShortcodes()
80
-    {
81
-        if ( ! $this->shortcodes instanceof CollectionInterface) {
82
-            $this->shortcodes = $this->loadShortcodesCollection();
83
-        }
84
-        return $this->shortcodes;
85
-    }
86
-
87
-
88
-
89
-    /**
90
-     * @return CollectionInterface|ShortcodeInterface[]
91
-     * @throws InvalidIdentifierException
92
-     * @throws InvalidInterfaceException
93
-     * @throws InvalidFilePathException
94
-     * @throws InvalidEntityException
95
-     * @throws InvalidDataTypeException
96
-     * @throws InvalidClassException
97
-     */
98
-    protected function loadShortcodesCollection()
99
-    {
100
-        $loader = new CollectionLoader(
101
-            new CollectionDetails(
102
-            // collection name
103
-                'shortcodes',
104
-                // collection interface
105
-                'EventEspresso\core\services\shortcodes\ShortcodeInterface',
106
-                // FQCNs for classes to add (all classes within that namespace will be loaded)
107
-                array('EventEspresso\core\domain\entities\shortcodes'),
108
-                // filepaths to classes to add
109
-                array(),
110
-                // file mask to use if parsing folder for files to add
111
-                '',
112
-                // what to use as identifier for collection entities
113
-                // using CLASS NAME prevents duplicates (works like a singleton)
114
-                CollectionDetails::ID_CLASS_NAME
115
-            )
116
-        );
117
-        return $loader->getCollection();
118
-    }
119
-
120
-
121
-
122
-    /**
123
-     * @return void
124
-     * @throws DomainException
125
-     * @throws InvalidInterfaceException
126
-     * @throws InvalidIdentifierException
127
-     * @throws InvalidFilePathException
128
-     * @throws InvalidEntityException
129
-     * @throws InvalidDataTypeException
130
-     * @throws InvalidClassException
131
-     */
132
-    public function registerShortcodes()
133
-    {
134
-        try {
135
-            $this->shortcodes = apply_filters(
136
-                'FHEE__EventEspresso_core_services_shortcodes_ShortcodesManager__registerShortcodes__shortcode_collection',
137
-                $this->getShortcodes()
138
-            );
139
-            if (! $this->shortcodes instanceof CollectionInterface) {
140
-                throw new InvalidEntityException(
141
-                    $this->shortcodes,
142
-                    'CollectionInterface',
143
-                    sprintf(
144
-                        esc_html__(
145
-                            'The "FHEE__EventEspresso_core_services_shortcodes_ShortcodesManager__registerShortcodes__shortcode_collection" filter must return a Collection of EspressoShortcode objects. "%1$s" was received instead.',
146
-                            'event_espresso'
147
-                        ),
148
-                        is_object($this->shortcodes) ? get_class($this->shortcodes) : gettype($this->shortcodes)
149
-                    )
150
-                );
151
-            }
152
-            $this->legacy_shortcodes_manager->registerShortcodes();
153
-        } catch (Exception $exception) {
154
-            new ExceptionStackTraceDisplay($exception);
155
-        }
156
-    }
157
-
158
-
159
-
160
-    /**
161
-     * @return void
162
-     */
163
-    public function addShortcodes()
164
-    {
165
-        try {
166
-            // cycle thru shortcode folders
167
-            foreach ($this->shortcodes as $shortcode) {
168
-                /** @var ShortcodeInterface $shortcode */
169
-                if ( $shortcode instanceof EnqueueAssetsInterface) {
170
-                    add_action('wp_enqueue_scripts', array($shortcode, 'registerScriptsAndStylesheets'), 10);
171
-                    add_action('wp_enqueue_scripts', array($shortcode, 'enqueueStylesheets'), 11);
172
-                }
173
-                // add_shortcode() if it has not already been added
174
-                if ( ! shortcode_exists($shortcode->getTag())) {
175
-                    add_shortcode($shortcode->getTag(), array($shortcode, 'processShortcodeCallback'));
176
-                }
177
-            }
178
-            $this->legacy_shortcodes_manager->addShortcodes();
179
-        } catch (Exception $exception) {
180
-            new ExceptionStackTraceDisplay($exception);
181
-        }
182
-    }
183
-
184
-
185
-
186
-    /**
187
-     * callback for the "template_redirect" hook point
188
-     * checks posts for EE shortcodes, and initializes them,
189
-     * then toggles filter switch that loads core default assets
190
-     *
191
-     * @return void
192
-     */
193
-    public function templateRedirect()
194
-    {
195
-        global $wp_query;
196
-        if (empty($wp_query->posts)) {
197
-            return;
198
-        }
199
-        $load_assets = false;
200
-        // array of posts displayed in current request
201
-        $posts = is_array($wp_query->posts) ? $wp_query->posts : array($wp_query->posts);
202
-        foreach ($posts as $post) {
203
-            // now check post content and excerpt for EE shortcodes
204
-            $load_assets = $this->parseContentForShortcodes($post->post_content)
205
-                ? true
206
-                : $load_assets;
207
-        }
208
-        if ($load_assets) {
209
-            $this->legacy_shortcodes_manager->registry()->REQ->set_espresso_page(true);
210
-            add_filter('FHEE_load_css', '__return_true');
211
-            add_filter('FHEE_load_js', '__return_true');
212
-        }
213
-    }
214
-
215
-
216
-
217
-    /**
218
-     * checks supplied content against list of shortcodes,
219
-     * then initializes any found shortcodes, and returns true.
220
-     * returns false if no shortcodes found.
221
-     *
222
-     * @param string $content
223
-     * @return bool
224
-     */
225
-    public function parseContentForShortcodes($content)
226
-    {
227
-        $has_shortcode = false;
228
-        if(empty($this->shortcodes)){
229
-            return $has_shortcode;
230
-        }
231
-        foreach ($this->shortcodes as $shortcode) {
232
-            /** @var ShortcodeInterface $shortcode */
233
-            if (has_shortcode($content, $shortcode->getTag())) {
234
-                $shortcode->initializeShortcode();
235
-                $has_shortcode = true;
236
-            }
237
-        }
238
-        return $has_shortcode;
239
-    }
35
+	/**
36
+	 * @var LegacyShortcodesManager $legacy_shortcodes_manager
37
+	 */
38
+	private $legacy_shortcodes_manager;
39
+
40
+	/**
41
+	 * @var ShortcodeInterface[] $shortcodes
42
+	 */
43
+	private $shortcodes;
44
+
45
+
46
+
47
+	/**
48
+	 * ShortcodesManager constructor
49
+	 *
50
+	 * @param LegacyShortcodesManager $legacy_shortcodes_manager
51
+	 */
52
+	public function __construct(LegacyShortcodesManager $legacy_shortcodes_manager) {
53
+		$this->legacy_shortcodes_manager = $legacy_shortcodes_manager;
54
+		// assemble a list of installed and active shortcodes
55
+		add_action(
56
+			'AHEE__EE_System__register_shortcodes_modules_and_widgets',
57
+			array($this, 'registerShortcodes'),
58
+			999
59
+		);
60
+		//  call add_shortcode() for all installed shortcodes
61
+		add_action('AHEE__EE_System__core_loaded_and_ready', array($this, 'addShortcodes'));
62
+		// check content for shortcodes the old way
63
+		add_action('parse_query', array($this->legacy_shortcodes_manager, 'initializeShortcodes'), 5);
64
+		// check content for shortcodes the NEW more efficient way
65
+		add_action('template_redirect', array($this, 'templateRedirect'), 999);
66
+	}
67
+
68
+
69
+
70
+	/**
71
+	 * @return CollectionInterface|ShortcodeInterface[]
72
+	 * @throws InvalidIdentifierException
73
+	 * @throws InvalidInterfaceException
74
+	 * @throws InvalidFilePathException
75
+	 * @throws InvalidEntityException
76
+	 * @throws InvalidDataTypeException
77
+	 * @throws InvalidClassException
78
+	 */
79
+	public function getShortcodes()
80
+	{
81
+		if ( ! $this->shortcodes instanceof CollectionInterface) {
82
+			$this->shortcodes = $this->loadShortcodesCollection();
83
+		}
84
+		return $this->shortcodes;
85
+	}
86
+
87
+
88
+
89
+	/**
90
+	 * @return CollectionInterface|ShortcodeInterface[]
91
+	 * @throws InvalidIdentifierException
92
+	 * @throws InvalidInterfaceException
93
+	 * @throws InvalidFilePathException
94
+	 * @throws InvalidEntityException
95
+	 * @throws InvalidDataTypeException
96
+	 * @throws InvalidClassException
97
+	 */
98
+	protected function loadShortcodesCollection()
99
+	{
100
+		$loader = new CollectionLoader(
101
+			new CollectionDetails(
102
+			// collection name
103
+				'shortcodes',
104
+				// collection interface
105
+				'EventEspresso\core\services\shortcodes\ShortcodeInterface',
106
+				// FQCNs for classes to add (all classes within that namespace will be loaded)
107
+				array('EventEspresso\core\domain\entities\shortcodes'),
108
+				// filepaths to classes to add
109
+				array(),
110
+				// file mask to use if parsing folder for files to add
111
+				'',
112
+				// what to use as identifier for collection entities
113
+				// using CLASS NAME prevents duplicates (works like a singleton)
114
+				CollectionDetails::ID_CLASS_NAME
115
+			)
116
+		);
117
+		return $loader->getCollection();
118
+	}
119
+
120
+
121
+
122
+	/**
123
+	 * @return void
124
+	 * @throws DomainException
125
+	 * @throws InvalidInterfaceException
126
+	 * @throws InvalidIdentifierException
127
+	 * @throws InvalidFilePathException
128
+	 * @throws InvalidEntityException
129
+	 * @throws InvalidDataTypeException
130
+	 * @throws InvalidClassException
131
+	 */
132
+	public function registerShortcodes()
133
+	{
134
+		try {
135
+			$this->shortcodes = apply_filters(
136
+				'FHEE__EventEspresso_core_services_shortcodes_ShortcodesManager__registerShortcodes__shortcode_collection',
137
+				$this->getShortcodes()
138
+			);
139
+			if (! $this->shortcodes instanceof CollectionInterface) {
140
+				throw new InvalidEntityException(
141
+					$this->shortcodes,
142
+					'CollectionInterface',
143
+					sprintf(
144
+						esc_html__(
145
+							'The "FHEE__EventEspresso_core_services_shortcodes_ShortcodesManager__registerShortcodes__shortcode_collection" filter must return a Collection of EspressoShortcode objects. "%1$s" was received instead.',
146
+							'event_espresso'
147
+						),
148
+						is_object($this->shortcodes) ? get_class($this->shortcodes) : gettype($this->shortcodes)
149
+					)
150
+				);
151
+			}
152
+			$this->legacy_shortcodes_manager->registerShortcodes();
153
+		} catch (Exception $exception) {
154
+			new ExceptionStackTraceDisplay($exception);
155
+		}
156
+	}
157
+
158
+
159
+
160
+	/**
161
+	 * @return void
162
+	 */
163
+	public function addShortcodes()
164
+	{
165
+		try {
166
+			// cycle thru shortcode folders
167
+			foreach ($this->shortcodes as $shortcode) {
168
+				/** @var ShortcodeInterface $shortcode */
169
+				if ( $shortcode instanceof EnqueueAssetsInterface) {
170
+					add_action('wp_enqueue_scripts', array($shortcode, 'registerScriptsAndStylesheets'), 10);
171
+					add_action('wp_enqueue_scripts', array($shortcode, 'enqueueStylesheets'), 11);
172
+				}
173
+				// add_shortcode() if it has not already been added
174
+				if ( ! shortcode_exists($shortcode->getTag())) {
175
+					add_shortcode($shortcode->getTag(), array($shortcode, 'processShortcodeCallback'));
176
+				}
177
+			}
178
+			$this->legacy_shortcodes_manager->addShortcodes();
179
+		} catch (Exception $exception) {
180
+			new ExceptionStackTraceDisplay($exception);
181
+		}
182
+	}
183
+
184
+
185
+
186
+	/**
187
+	 * callback for the "template_redirect" hook point
188
+	 * checks posts for EE shortcodes, and initializes them,
189
+	 * then toggles filter switch that loads core default assets
190
+	 *
191
+	 * @return void
192
+	 */
193
+	public function templateRedirect()
194
+	{
195
+		global $wp_query;
196
+		if (empty($wp_query->posts)) {
197
+			return;
198
+		}
199
+		$load_assets = false;
200
+		// array of posts displayed in current request
201
+		$posts = is_array($wp_query->posts) ? $wp_query->posts : array($wp_query->posts);
202
+		foreach ($posts as $post) {
203
+			// now check post content and excerpt for EE shortcodes
204
+			$load_assets = $this->parseContentForShortcodes($post->post_content)
205
+				? true
206
+				: $load_assets;
207
+		}
208
+		if ($load_assets) {
209
+			$this->legacy_shortcodes_manager->registry()->REQ->set_espresso_page(true);
210
+			add_filter('FHEE_load_css', '__return_true');
211
+			add_filter('FHEE_load_js', '__return_true');
212
+		}
213
+	}
214
+
215
+
216
+
217
+	/**
218
+	 * checks supplied content against list of shortcodes,
219
+	 * then initializes any found shortcodes, and returns true.
220
+	 * returns false if no shortcodes found.
221
+	 *
222
+	 * @param string $content
223
+	 * @return bool
224
+	 */
225
+	public function parseContentForShortcodes($content)
226
+	{
227
+		$has_shortcode = false;
228
+		if(empty($this->shortcodes)){
229
+			return $has_shortcode;
230
+		}
231
+		foreach ($this->shortcodes as $shortcode) {
232
+			/** @var ShortcodeInterface $shortcode */
233
+			if (has_shortcode($content, $shortcode->getTag())) {
234
+				$shortcode->initializeShortcode();
235
+				$has_shortcode = true;
236
+			}
237
+		}
238
+		return $has_shortcode;
239
+	}
240 240
 
241 241
 }
242 242
 // End of file ShortcodesManager.php
Please login to merge, or discard this patch.
caffeinated/core/libraries/shortcodes/EE_Question_Shortcodes.lib.php 1 patch
Indentation   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 if ( ! defined('EVENT_ESPRESSO_VERSION')) {
4
-    exit('NO direct script access allowed');
4
+	exit('NO direct script access allowed');
5 5
 }
6 6
 
7 7
 /**
@@ -36,82 +36,82 @@  discard block
 block discarded – undo
36 36
 {
37 37
     
38 38
     
39
-    /**
40
-     * _init_props
41
-     *
42
-     * @access protected
43
-     * @return void
44
-     */
45
-    protected function _init_props()
46
-    {
47
-        $this->label       = __('Attendee Shortcodes', 'event_espresso');
48
-        $this->description = __('All shortcodes specific to attendee related data', 'event_espresso');
49
-        $this->_shortcodes = array(
50
-            '[QUESTION]' => __('Will parse to a question.', 'event_espresso'),
51
-            '[ANSWER]'   => __('Will parse to the answer for a question', 'event_espresso')
52
-        );
53
-    }
39
+	/**
40
+	 * _init_props
41
+	 *
42
+	 * @access protected
43
+	 * @return void
44
+	 */
45
+	protected function _init_props()
46
+	{
47
+		$this->label       = __('Attendee Shortcodes', 'event_espresso');
48
+		$this->description = __('All shortcodes specific to attendee related data', 'event_espresso');
49
+		$this->_shortcodes = array(
50
+			'[QUESTION]' => __('Will parse to a question.', 'event_espresso'),
51
+			'[ANSWER]'   => __('Will parse to the answer for a question', 'event_espresso')
52
+		);
53
+	}
54 54
     
55 55
     
56
-    /**
57
-     * This method will give parsing instructions for each shortcode defined in the _shortcodes array.  Child methods
58
-     * will have to take care of handling.
59
-     *
60
-     * @access protected
61
-     *
62
-     * @param string $shortcode the shortcode to be parsed.
63
-     *
64
-     * @return string parsed shortcode
65
-     */
66
-    protected function _parser($shortcode)
67
-    {
56
+	/**
57
+	 * This method will give parsing instructions for each shortcode defined in the _shortcodes array.  Child methods
58
+	 * will have to take care of handling.
59
+	 *
60
+	 * @access protected
61
+	 *
62
+	 * @param string $shortcode the shortcode to be parsed.
63
+	 *
64
+	 * @return string parsed shortcode
65
+	 */
66
+	protected function _parser($shortcode)
67
+	{
68 68
         
69
-        if ( ! $this->_data instanceof EE_Answer || ! isset($this->_extra_data['data']) || ! $this->_extra_data['data'] instanceof EE_Messages_Addressee) {
70
-            return '';
71
-        }
69
+		if ( ! $this->_data instanceof EE_Answer || ! isset($this->_extra_data['data']) || ! $this->_extra_data['data'] instanceof EE_Messages_Addressee) {
70
+			return '';
71
+		}
72 72
         
73
-        switch ($shortcode) {
73
+		switch ($shortcode) {
74 74
             
75
-            case '[QUESTION]' :
76
-                $question = isset($this->_extra_data['data']->questions[$this->_data->ID()]) ? $this->_extra_data['data']->questions[$this->_data->ID()] : $this->_data->question();
77
-                if ( ! $question instanceof EE_Question) {
78
-                    return ''; //get out because we can't figure out what the question is.
79
-                }
75
+			case '[QUESTION]' :
76
+				$question = isset($this->_extra_data['data']->questions[$this->_data->ID()]) ? $this->_extra_data['data']->questions[$this->_data->ID()] : $this->_data->question();
77
+				if ( ! $question instanceof EE_Question) {
78
+					return ''; //get out because we can't figure out what the question is.
79
+				}
80 80
                 
81
-                return $question->get('QST_display_text');
82
-                break;
81
+				return $question->get('QST_display_text');
82
+				break;
83 83
             
84
-            case '[ANSWER]' :
85
-                //need to get the question to determine the type of question (some questions require translation of the answer).
86
-                $question = isset($this->_extra_data['data']->questions[$this->_data->ID()]) ? $this->_extra_data['data']->questions[$this->_data->ID()] : $this->_data->question();
87
-                if ( ! $question instanceof EE_Question) {
88
-                    return ''; //get out cause we can't figure out what the question type is!
89
-                }
84
+			case '[ANSWER]' :
85
+				//need to get the question to determine the type of question (some questions require translation of the answer).
86
+				$question = isset($this->_extra_data['data']->questions[$this->_data->ID()]) ? $this->_extra_data['data']->questions[$this->_data->ID()] : $this->_data->question();
87
+				if ( ! $question instanceof EE_Question) {
88
+					return ''; //get out cause we can't figure out what the question type is!
89
+				}
90 90
                 
91
-                //what we show for the answer depends on the question type!
92
-                switch ($question->get('QST_type')) {
91
+				//what we show for the answer depends on the question type!
92
+				switch ($question->get('QST_type')) {
93 93
                     
94
-                    case 'STATE' :
95
-                        $state  = EEM_State::instance()->get_one_by_ID($this->_data->get('ANS_value'));
96
-                        $answer = $state instanceof EE_State ? $state->name() : '';
97
-                        break;
94
+					case 'STATE' :
95
+						$state  = EEM_State::instance()->get_one_by_ID($this->_data->get('ANS_value'));
96
+						$answer = $state instanceof EE_State ? $state->name() : '';
97
+						break;
98 98
                     
99
-                    case 'COUNTRY' :
100
-                        $country = EEM_Country::instance()->get_one_by_ID($this->_data->get('ANS_value'));
101
-                        $answer  = $country instanceof EE_Country ? $country->name() : '';
102
-                        break;
99
+					case 'COUNTRY' :
100
+						$country = EEM_Country::instance()->get_one_by_ID($this->_data->get('ANS_value'));
101
+						$answer  = $country instanceof EE_Country ? $country->name() : '';
102
+						break;
103 103
                     
104
-                    default :
105
-                        $answer = $this->_data->get_pretty('ANS_value', 'no_wpautop');
106
-                        break;
107
-                }
104
+					default :
105
+						$answer = $this->_data->get_pretty('ANS_value', 'no_wpautop');
106
+						break;
107
+				}
108 108
                 
109
-                return $answer;
110
-                break;
109
+				return $answer;
110
+				break;
111 111
             
112
-        }
112
+		}
113 113
         
114
-        return '';
115
-    }
114
+		return '';
115
+	}
116 116
     
117 117
 } //end EE_Question_Shortcodes class
Please login to merge, or discard this patch.
admin_pages/maintenance/templates/ee_data_reset_and_delete.template.php 2 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@
 block discarded – undo
43 43
 <div class="padding">
44 44
 	<h4 class="espresso-header"><span class="dashicons dashicons-post-trash ee-icon-size-22"></span><?php esc_html_e('Permanently Delete ALL Event Espresso Data', 'event_espresso');?></h4>
45 45
     <p><?php esc_html_e(' This will delete data for Event Espresso 4, and all currently active add-ons. Event Espresso will then be deactivated. You may need to manually deactivate each add-on individually.',
46
-            'event_espresso');?></p>
46
+			'event_espresso');?></p>
47 47
 	<p><?php esc_html_e('If you know for certain that you will no longer be using Event Espresso and you wish to remove ALL traces of the plugin from your system, then perform the following steps.', 'event_espresso');?></p>
48 48
 	<p class="important-notice"><?php printf( esc_html__('Please note: %sThis is permanent and can NOT be undone.%s', 'event_espresso'), '<em>', '</em>' ); ?><br/></p>
49 49
 	<ol>
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -7,13 +7,13 @@  discard block
 block discarded – undo
7 7
 /** @var string $delete_db_url */
8 8
 ?>
9 9
 <h2>
10
-	<?php esc_html_e( 'Reset/Delete Data for Event Espresso', 'event_espresso' );?>
10
+	<?php esc_html_e('Reset/Delete Data for Event Espresso', 'event_espresso'); ?>
11 11
 </h2>
12 12
 <br />
13 13
 
14 14
 <div class="padding">
15
-	<h4 class="espresso-header"><span class="dashicons dashicons-update ee-icon-size-22"></span><?php esc_html_e('Reset Ticket and Datetime Reserved Counts', 'event_espresso');?></h4>
16
-	<p><?php esc_html_e('Use this to reset the counts for ticket and datetime reservations.', 'event_espresso');?></p>
15
+	<h4 class="espresso-header"><span class="dashicons dashicons-update ee-icon-size-22"></span><?php esc_html_e('Reset Ticket and Datetime Reserved Counts', 'event_espresso'); ?></h4>
16
+	<p><?php esc_html_e('Use this to reset the counts for ticket and datetime reservations.', 'event_espresso'); ?></p>
17 17
 	<div class="float-right"><?php echo $reset_reservations_button; ?></div>
18 18
 	<div class="clear"></div>
19 19
 </div>
@@ -22,8 +22,8 @@  discard block
 block discarded – undo
22 22
 
23 23
 <!-- reset DB url is here. Just need to make it look pretty and unhide it-->
24 24
 <div class="padding">
25
-	<h4 class="espresso-header"><span class="dashicons dashicons-update ee-icon-size-22"></span><?php esc_html_e('Reset Event Espresso Capabilities', 'event_espresso');?></h4>
26
-	<p><?php esc_html_e('Use this to reset the capabilities on WP roles to the defaults as defined via EE_Capabilities.  Note this reset does not REMOVE any existing capabilities, it just ensures that all the defaults are ADDED to the roles.', 'event_espresso');?></p>
25
+	<h4 class="espresso-header"><span class="dashicons dashicons-update ee-icon-size-22"></span><?php esc_html_e('Reset Event Espresso Capabilities', 'event_espresso'); ?></h4>
26
+	<p><?php esc_html_e('Use this to reset the capabilities on WP roles to the defaults as defined via EE_Capabilities.  Note this reset does not REMOVE any existing capabilities, it just ensures that all the defaults are ADDED to the roles.', 'event_espresso'); ?></p>
27 27
 	<div class="float-right"><?php echo $reset_capabilities_button; ?></div>
28 28
 	<div class="clear"></div>
29 29
 </div>
@@ -31,27 +31,27 @@  discard block
 block discarded – undo
31 31
 <br />
32 32
 
33 33
 <div class="padding">
34
-	<h4 class="espresso-header"><span class="dashicons dashicons-update ee-icon-size-22"></span><?php esc_html_e('Reset Event Espresso Data', 'event_espresso');?></h4>
35
-    <p><?php esc_html_e(' This will reset data for Event Espresso 4, and for all active add-ons. Inactive add-ons will not be affected.', 'event_espresso');?></p>
36
-    <p><?php esc_html_e('Your Event Espresso data will return to its default settings. The rest of your website will be unaffected.', 'event_espresso');?></p>
37
-	<div class="float-right"><a class="button button-primary" href="<?php echo $reset_db_url;?>"><?php esc_html_e('Reset Event Espresso Tables', 'event_espresso');?></a></div>
34
+	<h4 class="espresso-header"><span class="dashicons dashicons-update ee-icon-size-22"></span><?php esc_html_e('Reset Event Espresso Data', 'event_espresso'); ?></h4>
35
+    <p><?php esc_html_e(' This will reset data for Event Espresso 4, and for all active add-ons. Inactive add-ons will not be affected.', 'event_espresso'); ?></p>
36
+    <p><?php esc_html_e('Your Event Espresso data will return to its default settings. The rest of your website will be unaffected.', 'event_espresso'); ?></p>
37
+	<div class="float-right"><a class="button button-primary" href="<?php echo $reset_db_url; ?>"><?php esc_html_e('Reset Event Espresso Tables', 'event_espresso'); ?></a></div>
38 38
 	<div class="clear"></div>
39 39
 </div>
40 40
 <br />
41 41
 <br />
42 42
 
43 43
 <div class="padding">
44
-	<h4 class="espresso-header"><span class="dashicons dashicons-post-trash ee-icon-size-22"></span><?php esc_html_e('Permanently Delete ALL Event Espresso Data', 'event_espresso');?></h4>
44
+	<h4 class="espresso-header"><span class="dashicons dashicons-post-trash ee-icon-size-22"></span><?php esc_html_e('Permanently Delete ALL Event Espresso Data', 'event_espresso'); ?></h4>
45 45
     <p><?php esc_html_e(' This will delete data for Event Espresso 4, and all currently active add-ons. Event Espresso will then be deactivated. You may need to manually deactivate each add-on individually.',
46
-            'event_espresso');?></p>
47
-	<p><?php esc_html_e('If you know for certain that you will no longer be using Event Espresso and you wish to remove ALL traces of the plugin from your system, then perform the following steps.', 'event_espresso');?></p>
48
-	<p class="important-notice"><?php printf( esc_html__('Please note: %sThis is permanent and can NOT be undone.%s', 'event_espresso'), '<em>', '</em>' ); ?><br/></p>
46
+            'event_espresso'); ?></p>
47
+	<p><?php esc_html_e('If you know for certain that you will no longer be using Event Espresso and you wish to remove ALL traces of the plugin from your system, then perform the following steps.', 'event_espresso'); ?></p>
48
+	<p class="important-notice"><?php printf(esc_html__('Please note: %sThis is permanent and can NOT be undone.%s', 'event_espresso'), '<em>', '</em>'); ?><br/></p>
49 49
 	<ol>
50
-		<li><?php  printf( esc_html__('First, click the button below to permanently delete all Event Espresso tables, records, and options from your WordPress database . If you receive a "500 Internal Server Error" or a blank white screen, it means the server has timed out due to the large number of records being updated. This is not a cause for concern. Simply %1$srefresh the page%2$s and the Database Update will continue where it left off.', 'event_espresso'), '<strong>', '</strong>' );?></li>
51
-		<li><?php printf( esc_html__('Then, locate Event Espresso on the WordPress Plugins page, and click on %sDelete%s', 'event_espresso'), '<strong>', '</strong>' ); ?></li>
52
-        <li><?php printf( esc_html__('Once you are on the Delete Plugin page, click on %sYes, Delete these files and data%s', 'event_espresso'), '<strong>', '</strong>' ); ?></li>
50
+		<li><?php  printf(esc_html__('First, click the button below to permanently delete all Event Espresso tables, records, and options from your WordPress database . If you receive a "500 Internal Server Error" or a blank white screen, it means the server has timed out due to the large number of records being updated. This is not a cause for concern. Simply %1$srefresh the page%2$s and the Database Update will continue where it left off.', 'event_espresso'), '<strong>', '</strong>'); ?></li>
51
+		<li><?php printf(esc_html__('Then, locate Event Espresso on the WordPress Plugins page, and click on %sDelete%s', 'event_espresso'), '<strong>', '</strong>'); ?></li>
52
+        <li><?php printf(esc_html__('Once you are on the Delete Plugin page, click on %sYes, Delete these files and data%s', 'event_espresso'), '<strong>', '</strong>'); ?></li>
53 53
 	</ol>
54
-	<div class="float-right"><a href="<?php echo $delete_db_url; ?>" id="delete-all-data-btn" class="button-primary"><?php esc_html_e('Permanently Delete All Event Espresso Data', 'event_espresso');?></a></div>
54
+	<div class="float-right"><a href="<?php echo $delete_db_url; ?>" id="delete-all-data-btn" class="button-primary"><?php esc_html_e('Permanently Delete All Event Espresso Data', 'event_espresso'); ?></a></div>
55 55
 	<div class="clear"></div>
56 56
 </div>
57 57
 <br/>
Please login to merge, or discard this patch.