Completed
Branch dev (5b2722)
by
unknown
05:49 queued 10s
created
vendor/squizlabs/php_codesniffer/tests/Core/IsCamelCapsTest.php 1 patch
Indentation   +114 added lines, -114 removed lines patch added patch discarded remove patch
@@ -16,120 +16,120 @@
 block discarded – undo
16 16
 {
17 17
 
18 18
 
19
-    /**
20
-     * Test valid public function/method names.
21
-     *
22
-     * @return void
23
-     */
24
-    public function testValidNotClassFormatPublic()
25
-    {
26
-        $this->assertTrue(Common::isCamelCaps('thisIsCamelCaps', false, true, true));
27
-        $this->assertTrue(Common::isCamelCaps('thisISCamelCaps', false, true, false));
28
-
29
-    }//end testValidNotClassFormatPublic()
30
-
31
-
32
-    /**
33
-     * Test invalid public function/method names.
34
-     *
35
-     * @return void
36
-     */
37
-    public function testInvalidNotClassFormatPublic()
38
-    {
39
-        $this->assertFalse(Common::isCamelCaps('_thisIsCamelCaps', false, true, true));
40
-        $this->assertFalse(Common::isCamelCaps('thisISCamelCaps', false, true, true));
41
-        $this->assertFalse(Common::isCamelCaps('ThisIsCamelCaps', false, true, true));
42
-
43
-        $this->assertFalse(Common::isCamelCaps('3thisIsCamelCaps', false, true, true));
44
-        $this->assertFalse(Common::isCamelCaps('*thisIsCamelCaps', false, true, true));
45
-        $this->assertFalse(Common::isCamelCaps('-thisIsCamelCaps', false, true, true));
46
-
47
-        $this->assertFalse(Common::isCamelCaps('this*IsCamelCaps', false, true, true));
48
-        $this->assertFalse(Common::isCamelCaps('this-IsCamelCaps', false, true, true));
49
-        $this->assertFalse(Common::isCamelCaps('this_IsCamelCaps', false, true, true));
50
-        $this->assertFalse(Common::isCamelCaps('this_is_camel_caps', false, true, true));
51
-
52
-    }//end testInvalidNotClassFormatPublic()
53
-
54
-
55
-    /**
56
-     * Test valid private method names.
57
-     *
58
-     * @return void
59
-     */
60
-    public function testValidNotClassFormatPrivate()
61
-    {
62
-        $this->assertTrue(Common::isCamelCaps('_thisIsCamelCaps', false, false, true));
63
-        $this->assertTrue(Common::isCamelCaps('_thisISCamelCaps', false, false, false));
64
-        $this->assertTrue(Common::isCamelCaps('_i18N', false, false, true));
65
-        $this->assertTrue(Common::isCamelCaps('_i18n', false, false, true));
66
-
67
-    }//end testValidNotClassFormatPrivate()
68
-
69
-
70
-    /**
71
-     * Test invalid private method names.
72
-     *
73
-     * @return void
74
-     */
75
-    public function testInvalidNotClassFormatPrivate()
76
-    {
77
-        $this->assertFalse(Common::isCamelCaps('thisIsCamelCaps', false, false, true));
78
-        $this->assertFalse(Common::isCamelCaps('_thisISCamelCaps', false, false, true));
79
-        $this->assertFalse(Common::isCamelCaps('_ThisIsCamelCaps', false, false, true));
80
-        $this->assertFalse(Common::isCamelCaps('__thisIsCamelCaps', false, false, true));
81
-        $this->assertFalse(Common::isCamelCaps('__thisISCamelCaps', false, false, false));
82
-
83
-        $this->assertFalse(Common::isCamelCaps('3thisIsCamelCaps', false, false, true));
84
-        $this->assertFalse(Common::isCamelCaps('*thisIsCamelCaps', false, false, true));
85
-        $this->assertFalse(Common::isCamelCaps('-thisIsCamelCaps', false, false, true));
86
-        $this->assertFalse(Common::isCamelCaps('_this_is_camel_caps', false, false, true));
87
-
88
-    }//end testInvalidNotClassFormatPrivate()
89
-
90
-
91
-    /**
92
-     * Test valid class names.
93
-     *
94
-     * @return void
95
-     */
96
-    public function testValidClassFormatPublic()
97
-    {
98
-        $this->assertTrue(Common::isCamelCaps('ThisIsCamelCaps', true, true, true));
99
-        $this->assertTrue(Common::isCamelCaps('ThisISCamelCaps', true, true, false));
100
-        $this->assertTrue(Common::isCamelCaps('This3IsCamelCaps', true, true, false));
101
-
102
-    }//end testValidClassFormatPublic()
103
-
104
-
105
-    /**
106
-     * Test invalid class names.
107
-     *
108
-     * @return void
109
-     */
110
-    public function testInvalidClassFormat()
111
-    {
112
-        $this->assertFalse(Common::isCamelCaps('thisIsCamelCaps', true));
113
-        $this->assertFalse(Common::isCamelCaps('This-IsCamelCaps', true));
114
-        $this->assertFalse(Common::isCamelCaps('This_Is_Camel_Caps', true));
115
-
116
-    }//end testInvalidClassFormat()
117
-
118
-
119
-    /**
120
-     * Test invalid class names with the private flag set.
121
-     *
122
-     * Note that the private flag is ignored if the class format
123
-     * flag is set, so these names are all invalid.
124
-     *
125
-     * @return void
126
-     */
127
-    public function testInvalidClassFormatPrivate()
128
-    {
129
-        $this->assertFalse(Common::isCamelCaps('_ThisIsCamelCaps', true, true));
130
-        $this->assertFalse(Common::isCamelCaps('_ThisIsCamelCaps', true, false));
131
-
132
-    }//end testInvalidClassFormatPrivate()
19
+	/**
20
+	 * Test valid public function/method names.
21
+	 *
22
+	 * @return void
23
+	 */
24
+	public function testValidNotClassFormatPublic()
25
+	{
26
+		$this->assertTrue(Common::isCamelCaps('thisIsCamelCaps', false, true, true));
27
+		$this->assertTrue(Common::isCamelCaps('thisISCamelCaps', false, true, false));
28
+
29
+	}//end testValidNotClassFormatPublic()
30
+
31
+
32
+	/**
33
+	 * Test invalid public function/method names.
34
+	 *
35
+	 * @return void
36
+	 */
37
+	public function testInvalidNotClassFormatPublic()
38
+	{
39
+		$this->assertFalse(Common::isCamelCaps('_thisIsCamelCaps', false, true, true));
40
+		$this->assertFalse(Common::isCamelCaps('thisISCamelCaps', false, true, true));
41
+		$this->assertFalse(Common::isCamelCaps('ThisIsCamelCaps', false, true, true));
42
+
43
+		$this->assertFalse(Common::isCamelCaps('3thisIsCamelCaps', false, true, true));
44
+		$this->assertFalse(Common::isCamelCaps('*thisIsCamelCaps', false, true, true));
45
+		$this->assertFalse(Common::isCamelCaps('-thisIsCamelCaps', false, true, true));
46
+
47
+		$this->assertFalse(Common::isCamelCaps('this*IsCamelCaps', false, true, true));
48
+		$this->assertFalse(Common::isCamelCaps('this-IsCamelCaps', false, true, true));
49
+		$this->assertFalse(Common::isCamelCaps('this_IsCamelCaps', false, true, true));
50
+		$this->assertFalse(Common::isCamelCaps('this_is_camel_caps', false, true, true));
51
+
52
+	}//end testInvalidNotClassFormatPublic()
53
+
54
+
55
+	/**
56
+	 * Test valid private method names.
57
+	 *
58
+	 * @return void
59
+	 */
60
+	public function testValidNotClassFormatPrivate()
61
+	{
62
+		$this->assertTrue(Common::isCamelCaps('_thisIsCamelCaps', false, false, true));
63
+		$this->assertTrue(Common::isCamelCaps('_thisISCamelCaps', false, false, false));
64
+		$this->assertTrue(Common::isCamelCaps('_i18N', false, false, true));
65
+		$this->assertTrue(Common::isCamelCaps('_i18n', false, false, true));
66
+
67
+	}//end testValidNotClassFormatPrivate()
68
+
69
+
70
+	/**
71
+	 * Test invalid private method names.
72
+	 *
73
+	 * @return void
74
+	 */
75
+	public function testInvalidNotClassFormatPrivate()
76
+	{
77
+		$this->assertFalse(Common::isCamelCaps('thisIsCamelCaps', false, false, true));
78
+		$this->assertFalse(Common::isCamelCaps('_thisISCamelCaps', false, false, true));
79
+		$this->assertFalse(Common::isCamelCaps('_ThisIsCamelCaps', false, false, true));
80
+		$this->assertFalse(Common::isCamelCaps('__thisIsCamelCaps', false, false, true));
81
+		$this->assertFalse(Common::isCamelCaps('__thisISCamelCaps', false, false, false));
82
+
83
+		$this->assertFalse(Common::isCamelCaps('3thisIsCamelCaps', false, false, true));
84
+		$this->assertFalse(Common::isCamelCaps('*thisIsCamelCaps', false, false, true));
85
+		$this->assertFalse(Common::isCamelCaps('-thisIsCamelCaps', false, false, true));
86
+		$this->assertFalse(Common::isCamelCaps('_this_is_camel_caps', false, false, true));
87
+
88
+	}//end testInvalidNotClassFormatPrivate()
89
+
90
+
91
+	/**
92
+	 * Test valid class names.
93
+	 *
94
+	 * @return void
95
+	 */
96
+	public function testValidClassFormatPublic()
97
+	{
98
+		$this->assertTrue(Common::isCamelCaps('ThisIsCamelCaps', true, true, true));
99
+		$this->assertTrue(Common::isCamelCaps('ThisISCamelCaps', true, true, false));
100
+		$this->assertTrue(Common::isCamelCaps('This3IsCamelCaps', true, true, false));
101
+
102
+	}//end testValidClassFormatPublic()
103
+
104
+
105
+	/**
106
+	 * Test invalid class names.
107
+	 *
108
+	 * @return void
109
+	 */
110
+	public function testInvalidClassFormat()
111
+	{
112
+		$this->assertFalse(Common::isCamelCaps('thisIsCamelCaps', true));
113
+		$this->assertFalse(Common::isCamelCaps('This-IsCamelCaps', true));
114
+		$this->assertFalse(Common::isCamelCaps('This_Is_Camel_Caps', true));
115
+
116
+	}//end testInvalidClassFormat()
117
+
118
+
119
+	/**
120
+	 * Test invalid class names with the private flag set.
121
+	 *
122
+	 * Note that the private flag is ignored if the class format
123
+	 * flag is set, so these names are all invalid.
124
+	 *
125
+	 * @return void
126
+	 */
127
+	public function testInvalidClassFormatPrivate()
128
+	{
129
+		$this->assertFalse(Common::isCamelCaps('_ThisIsCamelCaps', true, true));
130
+		$this->assertFalse(Common::isCamelCaps('_ThisIsCamelCaps', true, false));
131
+
132
+	}//end testInvalidClassFormatPrivate()
133 133
 
134 134
 
135 135
 }//end class
Please login to merge, or discard this patch.
vendor/squizlabs/php_codesniffer/tests/TestSuite.php 2 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -16,20 +16,20 @@
 block discarded – undo
16 16
 {
17 17
 
18 18
 
19
-    /**
20
-     * Runs the tests and collects their result in a TestResult.
21
-     *
22
-     * @param \PHPUnit\Framework\TestResult $result A test result.
23
-     *
24
-     * @return \PHPUnit\Framework\TestResult
25
-     */
26
-    public function run(TestResult $result=null)
27
-    {
28
-        $result = parent::run($result);
29
-        printPHPCodeSnifferTestOutput();
30
-        return $result;
31
-
32
-    }//end run()
19
+	/**
20
+	 * Runs the tests and collects their result in a TestResult.
21
+	 *
22
+	 * @param \PHPUnit\Framework\TestResult $result A test result.
23
+	 *
24
+	 * @return \PHPUnit\Framework\TestResult
25
+	 */
26
+	public function run(TestResult $result=null)
27
+	{
28
+		$result = parent::run($result);
29
+		printPHPCodeSnifferTestOutput();
30
+		return $result;
31
+
32
+	}//end run()
33 33
 
34 34
 
35 35
 }//end class
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
      *
24 24
      * @return \PHPUnit\Framework\TestResult
25 25
      */
26
-    public function run(TestResult $result=null)
26
+    public function run(TestResult $result = null)
27 27
     {
28 28
         $result = parent::run($result);
29 29
         printPHPCodeSnifferTestOutput();
Please login to merge, or discard this patch.
wp-coding-standards/wpcs/WordPress/Sniffs/PHP/StrictComparisonsSniff.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -46,11 +46,11 @@
 block discarded – undo
46 46
 	 *
47 47
 	 * @return void
48 48
 	 */
49
-	public function process_token( $stackPtr ) {
49
+	public function process_token($stackPtr) {
50 50
 
51
-		if ( ! $this->has_whitelist_comment( 'loose comparison', $stackPtr ) ) {
52
-			$error = 'Found: ' . $this->tokens[ $stackPtr ]['content'] . '. Use strict comparisons (=== or !==).';
53
-			$this->phpcsFile->addWarning( $error, $stackPtr, 'LooseComparison' );
51
+		if ( ! $this->has_whitelist_comment('loose comparison', $stackPtr)) {
52
+			$error = 'Found: '.$this->tokens[$stackPtr]['content'].'. Use strict comparisons (=== or !==).';
53
+			$this->phpcsFile->addWarning($error, $stackPtr, 'LooseComparison');
54 54
 		}
55 55
 
56 56
 	}
Please login to merge, or discard this patch.
wp-coding-standards/wpcs/WordPress/AbstractFunctionParameterSniff.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -45,13 +45,13 @@  discard block
 block discarded – undo
45 45
 	 * @return array
46 46
 	 */
47 47
 	public function getGroups() {
48
-		if ( empty( $this->target_functions ) ) {
48
+		if (empty($this->target_functions)) {
49 49
 			return array();
50 50
 		}
51 51
 
52 52
 		return array(
53 53
 			$this->group_name => array(
54
-				'functions' => array_keys( $this->target_functions ),
54
+				'functions' => array_keys($this->target_functions),
55 55
 			),
56 56
 		);
57 57
 	}
@@ -66,14 +66,14 @@  discard block
 block discarded – undo
66 66
 	 * @return int|void Integer stack pointer to skip forward or void to continue
67 67
 	 *                  normal file processing.
68 68
 	 */
69
-	public function process_matched_token( $stackPtr, $group_name, $matched_content ) {
69
+	public function process_matched_token($stackPtr, $group_name, $matched_content) {
70 70
 
71
-		$parameters = $this->get_function_call_parameters( $stackPtr );
71
+		$parameters = $this->get_function_call_parameters($stackPtr);
72 72
 
73
-		if ( empty( $parameters ) ) {
74
-			return $this->process_no_parameters( $stackPtr, $group_name, $matched_content );
73
+		if (empty($parameters)) {
74
+			return $this->process_no_parameters($stackPtr, $group_name, $matched_content);
75 75
 		} else {
76
-			return $this->process_parameters( $stackPtr, $group_name, $matched_content, $parameters );
76
+			return $this->process_parameters($stackPtr, $group_name, $matched_content, $parameters);
77 77
 		}
78 78
 	}
79 79
 
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
 	 * @return int|void Integer stack pointer to skip forward or void to continue
91 91
 	 *                  normal file processing.
92 92
 	 */
93
-	abstract public function process_parameters( $stackPtr, $group_name, $matched_content, $parameters );
93
+	abstract public function process_parameters($stackPtr, $group_name, $matched_content, $parameters);
94 94
 
95 95
 	/**
96 96
 	 * Process the function if no parameters were found.
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
 	 * @return int|void Integer stack pointer to skip forward or void to continue
106 106
 	 *                  normal file processing.
107 107
 	 */
108
-	public function process_no_parameters( $stackPtr, $group_name, $matched_content ) {
108
+	public function process_no_parameters($stackPtr, $group_name, $matched_content) {
109 109
 		return;
110 110
 	}
111 111
 
Please login to merge, or discard this patch.
core/services/assets/AssetRegistrationException.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -16,24 +16,24 @@
 block discarded – undo
16 16
  */
17 17
 class AssetRegistrationException extends RuntimeException
18 18
 {
19
-    /**
20
-     * @param                $script_handle
21
-     * @param string         $message
22
-     * @param int            $code
23
-     * @param Exception|null $previous
24
-     */
25
-    public function __construct($script_handle, $message = '', $code = 0, Exception $previous = null)
26
-    {
27
-        if (empty($message)) {
28
-            $message = sprintf(
29
-                esc_html_x(
30
-                    'The "%1$s" script could not be registered with WordPress core.',
31
-                    'The "script-handle" script could not be registered with WordPress core.',
32
-                    'event_espresso'
33
-                ),
34
-                $script_handle
35
-            );
36
-        }
37
-        parent::__construct($message, $code, $previous);
38
-    }
19
+	/**
20
+	 * @param                $script_handle
21
+	 * @param string         $message
22
+	 * @param int            $code
23
+	 * @param Exception|null $previous
24
+	 */
25
+	public function __construct($script_handle, $message = '', $code = 0, Exception $previous = null)
26
+	{
27
+		if (empty($message)) {
28
+			$message = sprintf(
29
+				esc_html_x(
30
+					'The "%1$s" script could not be registered with WordPress core.',
31
+					'The "script-handle" script could not be registered with WordPress core.',
32
+					'event_espresso'
33
+				),
34
+				$script_handle
35
+			);
36
+		}
37
+		parent::__construct($message, $code, $previous);
38
+	}
39 39
 }
40 40
\ No newline at end of file
Please login to merge, or discard this patch.
core/domain/services/admin/privacy/export/ExportTransaction.php 1 patch
Indentation   +96 added lines, -96 removed lines patch added patch discarded remove patch
@@ -15,106 +15,106 @@
 block discarded – undo
15 15
  */
16 16
 class ExportTransaction implements PersonalDataExporterInterface
17 17
 {
18
-    /**
19
-     * @var EEM_Transaction $transaction_model
20
-     */
21
-    protected $transaction_model;
18
+	/**
19
+	 * @var EEM_Transaction $transaction_model
20
+	 */
21
+	protected $transaction_model;
22 22
 
23
-    /**
24
-     * ExportTransaction constructor.
25
-     *
26
-     * @param $transaction_model
27
-     */
28
-    public function __construct(EEM_Transaction $transaction_model)
29
-    {
30
-        $this->transaction_model = $transaction_model;
31
-    }
23
+	/**
24
+	 * ExportTransaction constructor.
25
+	 *
26
+	 * @param $transaction_model
27
+	 */
28
+	public function __construct(EEM_Transaction $transaction_model)
29
+	{
30
+		$this->transaction_model = $transaction_model;
31
+	}
32 32
 
33 33
 
34
-    /**
35
-     * Returns data for export.
36
-     *
37
-     * @param string    $email_address ,
38
-     * @param int       $page          starts at 1, not 0
39
-     * @return array {
40
-     * @type array      $data          {
41
-     * @type array {
42
-     * @type string     $group_id      (not translated, same for all exports)
43
-     * @type string     $group_label   (translated string)
44
-     * @type string|int $item_id
45
-     * @type array      $data          {
46
-     * @type array {
47
-     * @type string     $name          what's shown in the left-column of the export row
48
-     * @type string     $value         what's showin the right-column of the export row
49
-     *                                 }
50
-     *                                 }
51
-     *                                 }
52
-     *                                 }
53
-     *                                 }
54
-     */
55
-    public function export($email_address, $page = 1)
56
-    {
57
-        $page_size = 10;
58
-        $transactions = $this->transaction_model->get_all(
59
-            array(
60
-                array(
61
-                    'Registration.Attendee.ATT_email' => $email_address,
62
-                ),
63
-                'limit' => array(
64
-                    ($page - 1) * $page_size,
65
-                    $page_size,
66
-                ),
67
-            )
68
-        );
69
-        $export_fields = array_intersect_key(
70
-            EEM_Transaction::instance()->field_settings(),
71
-            array_flip(
72
-                array(
73
-                    'TXN_timestamp',
74
-                    'TXN_total',
75
-                    'TXN_paid',
76
-                    'TXN_session_data',
77
-                )
78
-            )
79
-        );
80
-        $export_items = array();
81
-        $found_something = false;
82
-        foreach ($transactions as $transaction) {
83
-            $found_something = true;
84
-            $data = array();
85
-            foreach ($export_fields as $field_name => $field_obj) {
86
-                if ($field_name === 'TXN_session_data') {
87
-                    $value = $transaction->get_pretty($field_name, 'print_r');
88
-                } else {
89
-                    $value = $transaction->get_pretty($field_name);
90
-                }
91
-                $data[] = array(
92
-                    'name'  => $field_obj->get_nicename(),
93
-                    'value' => $value,
94
-                );
95
-            }
96
-            $export_items[] = array(
97
-                'group_id'    => 'transactions',
98
-                'group_label' => esc_html__('Transactions', 'event_espresso'),
99
-                'item_id'     => $transaction->ID(),
100
-                'data'        => $data,
101
-            );
102
-        }
103
-        return array(
104
-            'data' => $export_items,
105
-            'done' => ! $found_something,
106
-        );
107
-    }
34
+	/**
35
+	 * Returns data for export.
36
+	 *
37
+	 * @param string    $email_address ,
38
+	 * @param int       $page          starts at 1, not 0
39
+	 * @return array {
40
+	 * @type array      $data          {
41
+	 * @type array {
42
+	 * @type string     $group_id      (not translated, same for all exports)
43
+	 * @type string     $group_label   (translated string)
44
+	 * @type string|int $item_id
45
+	 * @type array      $data          {
46
+	 * @type array {
47
+	 * @type string     $name          what's shown in the left-column of the export row
48
+	 * @type string     $value         what's showin the right-column of the export row
49
+	 *                                 }
50
+	 *                                 }
51
+	 *                                 }
52
+	 *                                 }
53
+	 *                                 }
54
+	 */
55
+	public function export($email_address, $page = 1)
56
+	{
57
+		$page_size = 10;
58
+		$transactions = $this->transaction_model->get_all(
59
+			array(
60
+				array(
61
+					'Registration.Attendee.ATT_email' => $email_address,
62
+				),
63
+				'limit' => array(
64
+					($page - 1) * $page_size,
65
+					$page_size,
66
+				),
67
+			)
68
+		);
69
+		$export_fields = array_intersect_key(
70
+			EEM_Transaction::instance()->field_settings(),
71
+			array_flip(
72
+				array(
73
+					'TXN_timestamp',
74
+					'TXN_total',
75
+					'TXN_paid',
76
+					'TXN_session_data',
77
+				)
78
+			)
79
+		);
80
+		$export_items = array();
81
+		$found_something = false;
82
+		foreach ($transactions as $transaction) {
83
+			$found_something = true;
84
+			$data = array();
85
+			foreach ($export_fields as $field_name => $field_obj) {
86
+				if ($field_name === 'TXN_session_data') {
87
+					$value = $transaction->get_pretty($field_name, 'print_r');
88
+				} else {
89
+					$value = $transaction->get_pretty($field_name);
90
+				}
91
+				$data[] = array(
92
+					'name'  => $field_obj->get_nicename(),
93
+					'value' => $value,
94
+				);
95
+			}
96
+			$export_items[] = array(
97
+				'group_id'    => 'transactions',
98
+				'group_label' => esc_html__('Transactions', 'event_espresso'),
99
+				'item_id'     => $transaction->ID(),
100
+				'data'        => $data,
101
+			);
102
+		}
103
+		return array(
104
+			'data' => $export_items,
105
+			'done' => ! $found_something,
106
+		);
107
+	}
108 108
 
109
-    /**
110
-     * Gets the Translated name of this exporter
111
-     *
112
-     * @return string
113
-     */
114
-    public function name()
115
-    {
116
-        return esc_html__('Event Espresso Transaction Exporter', 'event_espresso');
117
-    }
109
+	/**
110
+	 * Gets the Translated name of this exporter
111
+	 *
112
+	 * @return string
113
+	 */
114
+	public function name()
115
+	{
116
+		return esc_html__('Event Espresso Transaction Exporter', 'event_espresso');
117
+	}
118 118
 }
119 119
 // End of file ExportTransaction.php
120 120
 // Location: EventEspresso\core\domain\services\admin\privacy\export/ExportTransaction.php
Please login to merge, or discard this patch.
core/domain/services/admin/privacy/export/ExportAttendee.php 2 patches
Indentation   +104 added lines, -104 removed lines patch added patch discarded remove patch
@@ -15,116 +15,116 @@
 block discarded – undo
15 15
  */
16 16
 class ExportAttendee implements PersonalDataExporterInterface
17 17
 {
18
-    /**
19
-     * @var EEM_Attendee
20
-     */
21
-    protected $attendee_model;
18
+	/**
19
+	 * @var EEM_Attendee
20
+	 */
21
+	protected $attendee_model;
22 22
 
23
-    /**
24
-     * ExportAttendee constructor.
25
-     *
26
-     * @param EEM_Attendee $attendee_model
27
-     */
28
-    public function __construct(EEM_Attendee $attendee_model)
29
-    {
30
-        $this->attendee_model = $attendee_model;
31
-    }
23
+	/**
24
+	 * ExportAttendee constructor.
25
+	 *
26
+	 * @param EEM_Attendee $attendee_model
27
+	 */
28
+	public function __construct(EEM_Attendee $attendee_model)
29
+	{
30
+		$this->attendee_model = $attendee_model;
31
+	}
32 32
 
33 33
 
34
-    /**
35
-     * Returns data for export.
36
-     *
37
-     * @param string    $email_address ,
38
-     * @param int       $page          starts at 1, not 0
39
-     * @return array {
40
-     * @type array      $data          {
41
-     * @type array {
42
-     * @type string     $group_id      (not translated, same for all exports)
43
-     * @type string     $group_label   (translated string)
44
-     * @type string|int $item_id
45
-     * @type array      $data          {
46
-     * @type array {
47
-     * @type string     $name          what's shown in the left-column of the export row
48
-     * @type string     $value         what's showin the right-column of the export row
49
-     *                                 }
50
-     *                                 }
51
-     *                                 }
52
-     *                                 }
53
-     *                                 }
54
-     */
55
-    public function export($email_address, $page = 1)
56
-    {
57
-        $attendees = $this->attendee_model->get_all(
58
-            array(
59
-                array(
60
-                    'ATT_email' => $email_address,
61
-                ),
62
-            )
63
-        );
34
+	/**
35
+	 * Returns data for export.
36
+	 *
37
+	 * @param string    $email_address ,
38
+	 * @param int       $page          starts at 1, not 0
39
+	 * @return array {
40
+	 * @type array      $data          {
41
+	 * @type array {
42
+	 * @type string     $group_id      (not translated, same for all exports)
43
+	 * @type string     $group_label   (translated string)
44
+	 * @type string|int $item_id
45
+	 * @type array      $data          {
46
+	 * @type array {
47
+	 * @type string     $name          what's shown in the left-column of the export row
48
+	 * @type string     $value         what's showin the right-column of the export row
49
+	 *                                 }
50
+	 *                                 }
51
+	 *                                 }
52
+	 *                                 }
53
+	 *                                 }
54
+	 */
55
+	public function export($email_address, $page = 1)
56
+	{
57
+		$attendees = $this->attendee_model->get_all(
58
+			array(
59
+				array(
60
+					'ATT_email' => $email_address,
61
+				),
62
+			)
63
+		);
64 64
 
65
-        if (empty($attendees)) {
66
-            return array(
67
-                'data' => array(),
68
-                'done' => true,
69
-            );
70
-        }
65
+		if (empty($attendees)) {
66
+			return array(
67
+				'data' => array(),
68
+				'done' => true,
69
+			);
70
+		}
71 71
 
72
-        $export_items = array();
73
-        foreach ($attendees as $attendee) {
74
-            $export_fields = array_intersect_key(
75
-                $this->attendee_model->field_settings(),
76
-                array_flip(
77
-                    array(
78
-                        'ATT_fname',
79
-                        'ATT_lname',
80
-                        'ATT_email',
81
-                        'ATT_address1',
82
-                        'ATT_address2',
83
-                        'ATT_city',
84
-                        'STA_ID',
85
-                        'CNT_ISO',
86
-                        'ATT_zip',
87
-                        'ATT_phone',
88
-                    )
89
-                )
90
-            );
91
-            $data = array();
92
-            foreach ($export_fields as $field_name => $field_obj) {
93
-                if ($field_name === 'STA_ID') {
94
-                    $value = $attendee->state_name();
95
-                } elseif ($field_name == 'CNT_ISO') {
96
-                    $value = $attendee->country_name();
97
-                } else {
98
-                    $value = $attendee->get_pretty($field_name);
99
-                }
100
-                $data[] = array(
101
-                    'name'  => $field_obj->get_nicename(),
102
-                    'value' => $value,
103
-                );
104
-            }
105
-            $export_items[] =
106
-                array(
107
-                    'group_id'    => 'att-' . $attendee->ID(),
108
-                    'group_label' => esc_html__('Contact Profiles', 'event_espresso'),
109
-                    'item_id'     => $attendee->ID(),
110
-                    'data'        => $data,
111
-                );
112
-        }
113
-        return array(
114
-            'data' => $export_items,
115
-            'done' => true,
116
-        );
117
-    }
72
+		$export_items = array();
73
+		foreach ($attendees as $attendee) {
74
+			$export_fields = array_intersect_key(
75
+				$this->attendee_model->field_settings(),
76
+				array_flip(
77
+					array(
78
+						'ATT_fname',
79
+						'ATT_lname',
80
+						'ATT_email',
81
+						'ATT_address1',
82
+						'ATT_address2',
83
+						'ATT_city',
84
+						'STA_ID',
85
+						'CNT_ISO',
86
+						'ATT_zip',
87
+						'ATT_phone',
88
+					)
89
+				)
90
+			);
91
+			$data = array();
92
+			foreach ($export_fields as $field_name => $field_obj) {
93
+				if ($field_name === 'STA_ID') {
94
+					$value = $attendee->state_name();
95
+				} elseif ($field_name == 'CNT_ISO') {
96
+					$value = $attendee->country_name();
97
+				} else {
98
+					$value = $attendee->get_pretty($field_name);
99
+				}
100
+				$data[] = array(
101
+					'name'  => $field_obj->get_nicename(),
102
+					'value' => $value,
103
+				);
104
+			}
105
+			$export_items[] =
106
+				array(
107
+					'group_id'    => 'att-' . $attendee->ID(),
108
+					'group_label' => esc_html__('Contact Profiles', 'event_espresso'),
109
+					'item_id'     => $attendee->ID(),
110
+					'data'        => $data,
111
+				);
112
+		}
113
+		return array(
114
+			'data' => $export_items,
115
+			'done' => true,
116
+		);
117
+	}
118 118
 
119
-    /**
120
-     * Gets the Translated name of this exporter
121
-     *
122
-     * @return string
123
-     */
124
-    public function name()
125
-    {
126
-        return esc_html__('Event Espresso Attendee Data Exporter', 'event_espresso');
127
-    }
119
+	/**
120
+	 * Gets the Translated name of this exporter
121
+	 *
122
+	 * @return string
123
+	 */
124
+	public function name()
125
+	{
126
+		return esc_html__('Event Espresso Attendee Data Exporter', 'event_espresso');
127
+	}
128 128
 }
129 129
 // End of file ExportAttendee.php
130 130
 // Location: EventEspresso\core\domain\services\admin\privacy\export/ExportAttendee.php
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -104,7 +104,7 @@
 block discarded – undo
104 104
             }
105 105
             $export_items[] =
106 106
                 array(
107
-                    'group_id'    => 'att-' . $attendee->ID(),
107
+                    'group_id'    => 'att-'.$attendee->ID(),
108 108
                     'group_label' => esc_html__('Contact Profiles', 'event_espresso'),
109 109
                     'item_id'     => $attendee->ID(),
110 110
                     'data'        => $data,
Please login to merge, or discard this patch.
core/domain/services/admin/privacy/export/ExportRegistration.php 1 patch
Indentation   +122 added lines, -122 removed lines patch added patch discarded remove patch
@@ -18,133 +18,133 @@
 block discarded – undo
18 18
  */
19 19
 class ExportRegistration implements PersonalDataExporterInterface
20 20
 {
21
-    /**
22
-     * @var EEM_Registration
23
-     */
24
-    protected $registration_model;
21
+	/**
22
+	 * @var EEM_Registration
23
+	 */
24
+	protected $registration_model;
25 25
 
26
-    /**
27
-     * ExportRegistration constructor.
28
-     *
29
-     * @param EEM_Registration $registration_model
30
-     */
31
-    public function __construct(EEM_Registration $registration_model)
32
-    {
33
-        $this->registration_model = $registration_model;
34
-    }
26
+	/**
27
+	 * ExportRegistration constructor.
28
+	 *
29
+	 * @param EEM_Registration $registration_model
30
+	 */
31
+	public function __construct(EEM_Registration $registration_model)
32
+	{
33
+		$this->registration_model = $registration_model;
34
+	}
35 35
 
36 36
 
37
-    /**
38
-     * Returns data for export.
39
-     *
40
-     * @param string    $email_address ,
41
-     * @param int       $page          starts at 1, not 0
42
-     * @return array {
43
-     * @type array      $data          {
44
-     * @type array {
45
-     * @type string     $group_id      (not translated, same for all exports)
46
-     * @type string     $group_label   (translated string)
47
-     * @type string|int $item_id
48
-     * @type array      $data          {
49
-     * @type array {
50
-     * @type string     $name          what's shown in the left-column of the export row
51
-     * @type string     $value         what's showin the right-column of the export row
52
-     *                                 }
53
-     *                                 }
54
-     *                                 }
55
-     *                                 }
56
-     *                                 }
57
-     */
58
-    public function export($email_address, $page = 1)
59
-    {
60
-        $page_size = 10;
61
-        $registrations = $this->registration_model->get_all(
62
-            array(
63
-                array(
64
-                    'Attendee.ATT_email' => $email_address,
65
-                ),
66
-                'limit' => array(
67
-                    ($page - 1) * $page_size,
68
-                    $page_size,
69
-                ),
70
-            )
71
-        );
72
-        $export_fields = array_intersect_key(
73
-            $this->registration_model->field_settings(),
74
-            array_flip(
75
-                array(
76
-                    'REG_code',
77
-                    'REG_date',
78
-                    'REG_final_price',
79
-                    'REG_paid',
80
-                    'REG_url_link',
81
-                    'REG_count',
82
-                    'REG_group_size',
83
-                    'REG_att_is_going',
84
-                )
85
-            )
86
-        );
87
-        $export_items = array();
88
-        $found_something = false;
89
-        foreach ($registrations as $registration) {
90
-            /**
91
-             * @var $registration EE_Registration
92
-             */
93
-            $found_something = true;
94
-            $data = array();
95
-            foreach ($export_fields as $field_name => $field_obj) {
96
-                $data[] = array(
97
-                    'name'  => $field_obj->get_nicename(),
98
-                    'value' => $registration->get_pretty($field_name),
99
-                );
100
-            }
101
-            $answers = $registration->answers(
102
-                array(
103
-                    'force_join' => array(
104
-                        'Question',
105
-                    ),
106
-                )
107
-            );
108
-            foreach ($answers as $answer) {
109
-                $data[] = array(
110
-                    'name'  => $answer->question()->display_text(),
111
-                    'value' => $answer->pretty_value(),
112
-                );
113
-            }
114
-            $ticket = $registration->ticket();
115
-            if ($ticket instanceof EE_Ticket) {
116
-                $data[] = array(
117
-                    'name'  => esc_html__('Ticket', 'event_espresso'),
118
-                    'value' => $ticket->name_and_info(),
119
-                );
120
-                $data[] = array(
121
-                    'name'  => esc_html__('Event', 'event_espresso'),
122
-                    'value' => $ticket->get_event_name(),
123
-                );
124
-            }
37
+	/**
38
+	 * Returns data for export.
39
+	 *
40
+	 * @param string    $email_address ,
41
+	 * @param int       $page          starts at 1, not 0
42
+	 * @return array {
43
+	 * @type array      $data          {
44
+	 * @type array {
45
+	 * @type string     $group_id      (not translated, same for all exports)
46
+	 * @type string     $group_label   (translated string)
47
+	 * @type string|int $item_id
48
+	 * @type array      $data          {
49
+	 * @type array {
50
+	 * @type string     $name          what's shown in the left-column of the export row
51
+	 * @type string     $value         what's showin the right-column of the export row
52
+	 *                                 }
53
+	 *                                 }
54
+	 *                                 }
55
+	 *                                 }
56
+	 *                                 }
57
+	 */
58
+	public function export($email_address, $page = 1)
59
+	{
60
+		$page_size = 10;
61
+		$registrations = $this->registration_model->get_all(
62
+			array(
63
+				array(
64
+					'Attendee.ATT_email' => $email_address,
65
+				),
66
+				'limit' => array(
67
+					($page - 1) * $page_size,
68
+					$page_size,
69
+				),
70
+			)
71
+		);
72
+		$export_fields = array_intersect_key(
73
+			$this->registration_model->field_settings(),
74
+			array_flip(
75
+				array(
76
+					'REG_code',
77
+					'REG_date',
78
+					'REG_final_price',
79
+					'REG_paid',
80
+					'REG_url_link',
81
+					'REG_count',
82
+					'REG_group_size',
83
+					'REG_att_is_going',
84
+				)
85
+			)
86
+		);
87
+		$export_items = array();
88
+		$found_something = false;
89
+		foreach ($registrations as $registration) {
90
+			/**
91
+			 * @var $registration EE_Registration
92
+			 */
93
+			$found_something = true;
94
+			$data = array();
95
+			foreach ($export_fields as $field_name => $field_obj) {
96
+				$data[] = array(
97
+					'name'  => $field_obj->get_nicename(),
98
+					'value' => $registration->get_pretty($field_name),
99
+				);
100
+			}
101
+			$answers = $registration->answers(
102
+				array(
103
+					'force_join' => array(
104
+						'Question',
105
+					),
106
+				)
107
+			);
108
+			foreach ($answers as $answer) {
109
+				$data[] = array(
110
+					'name'  => $answer->question()->display_text(),
111
+					'value' => $answer->pretty_value(),
112
+				);
113
+			}
114
+			$ticket = $registration->ticket();
115
+			if ($ticket instanceof EE_Ticket) {
116
+				$data[] = array(
117
+					'name'  => esc_html__('Ticket', 'event_espresso'),
118
+					'value' => $ticket->name_and_info(),
119
+				);
120
+				$data[] = array(
121
+					'name'  => esc_html__('Event', 'event_espresso'),
122
+					'value' => $ticket->get_event_name(),
123
+				);
124
+			}
125 125
 
126
-            $export_items[] = array(
127
-                'group_id'    => 'registration',
128
-                'group_label' => esc_html__('Event Registrations', 'event_espresso'),
129
-                'item_id'     => $registration->ID(),
130
-                'data'        => $data,
131
-            );
132
-        }
133
-        return array(
134
-            'data' => $export_items,
135
-            'done' => ! $found_something,
136
-        );
137
-    }
126
+			$export_items[] = array(
127
+				'group_id'    => 'registration',
128
+				'group_label' => esc_html__('Event Registrations', 'event_espresso'),
129
+				'item_id'     => $registration->ID(),
130
+				'data'        => $data,
131
+			);
132
+		}
133
+		return array(
134
+			'data' => $export_items,
135
+			'done' => ! $found_something,
136
+		);
137
+	}
138 138
 
139
-    /**
140
-     * Gets the Translated name of this exporter
141
-     *
142
-     * @return string
143
-     */
144
-    public function name()
145
-    {
146
-        return esc_html__('Event Espresso Registration Data Exporter', 'event_espresso');
147
-    }
139
+	/**
140
+	 * Gets the Translated name of this exporter
141
+	 *
142
+	 * @return string
143
+	 */
144
+	public function name()
145
+	{
146
+		return esc_html__('Event Espresso Registration Data Exporter', 'event_espresso');
147
+	}
148 148
 }
149 149
 // End of file ExportRegistration.php
150 150
 // Location: EventEspresso\core\domain\services\admin\privacy\export/ExportRegistration.php
Please login to merge, or discard this patch.
modules/single_page_checkout/inc/EE_SPCO_JSON_Response.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
             $JSON_response['success'] = $this->success();
123 123
         }
124 124
         // but if NO notices are set... at least set the "success" as a key so that the JS knows everything worked
125
-        if (! isset($JSON_response['attention']) && ! isset($JSON_response['errors']) && ! isset($JSON_response['success'])) {
125
+        if ( ! isset($JSON_response['attention']) && ! isset($JSON_response['errors']) && ! isset($JSON_response['success'])) {
126 126
             $JSON_response['success'] = null;
127 127
         }
128 128
         // set redirect_url, IF it exists
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
         // and finally, add return_data array to main JSON response array, IF it contains anything
163 163
         // why did we add some of the above properties to the return data array?
164 164
         // because it is easier and cleaner in the Javascript to deal with this way
165
-        if (! empty($return_data)) {
165
+        if ( ! empty($return_data)) {
166 166
             $JSON_response['return_data'] = $return_data;
167 167
         }
168 168
         // filter final array
Please login to merge, or discard this patch.
Indentation   +399 added lines, -399 removed lines patch added patch discarded remove patch
@@ -14,403 +14,403 @@
 block discarded – undo
14 14
  */
15 15
 class EE_SPCO_JSON_Response
16 16
 {
17
-    /**
18
-     * @var string
19
-     */
20
-    protected $_errors = '';
21
-
22
-    /**
23
-     * @var string
24
-     */
25
-    protected $_unexpected_errors = '';
26
-
27
-    /**
28
-     * @var string
29
-     */
30
-    protected $_attention = '';
31
-
32
-    /**
33
-     * @var string
34
-     */
35
-    protected $_success = '';
36
-
37
-    /**
38
-     * @var string
39
-     */
40
-    protected $_plz_select_method_of_payment = '';
41
-
42
-    /**
43
-     * @var string
44
-     */
45
-    protected $_redirect_url = '';
46
-
47
-    /**
48
-     * @var string
49
-     */
50
-    protected $_registration_time_limit = '';
51
-
52
-    /**
53
-     * @var string
54
-     */
55
-    protected $_redirect_form = '';
56
-
57
-    /**
58
-     * @var string
59
-     */
60
-    protected $_reg_step_html = '';
61
-
62
-    /**
63
-     * @var string
64
-     */
65
-    protected $_method_of_payment = '';
66
-
67
-    /**
68
-     * @var float
69
-     */
70
-    protected $_payment_amount;
71
-
72
-    /**
73
-     * @var array
74
-     */
75
-    protected $_return_data = array();
76
-
77
-
78
-    /**
79
-     * @var array
80
-     */
81
-    protected $_validation_rules = array();
82
-
83
-
84
-    /**
85
-     *    class constructor
86
-     */
87
-    public function __construct()
88
-    {
89
-    }
90
-
91
-
92
-    /**
93
-     *    __toString
94
-     *
95
-     *        allows you to simply echo or print an EE_SPCO_JSON_Response object to produce a  JSON encoded string
96
-     *        ie: $json_response = new EE_SPCO_JSON_Response();
97
-     *        echo $json_response;
98
-     *
99
-     * @access    public
100
-     * @return    string
101
-     */
102
-    public function __toString()
103
-    {
104
-        $JSON_response = array();
105
-        // grab notices
106
-        $notices = EE_Error::get_notices(false);
107
-        $this->set_attention(isset($notices['attention']) ? $notices['attention'] : '');
108
-        $this->set_errors(isset($notices['errors']) ? $notices['errors'] : '');
109
-        $this->set_success(isset($notices['success']) ? $notices['success'] : '');
110
-        // add notices to JSON response, but only if they exist
111
-        if ($this->attention()) {
112
-            $JSON_response['attention'] = $this->attention();
113
-        }
114
-        if ($this->errors()) {
115
-            $JSON_response['errors'] = $this->errors();
116
-        }
117
-        if ($this->unexpected_errors()) {
118
-            $JSON_response['unexpected_errors'] = $this->unexpected_errors();
119
-        }
120
-        if ($this->success()) {
121
-            $JSON_response['success'] = $this->success();
122
-        }
123
-        // but if NO notices are set... at least set the "success" as a key so that the JS knows everything worked
124
-        if (! isset($JSON_response['attention']) && ! isset($JSON_response['errors']) && ! isset($JSON_response['success'])) {
125
-            $JSON_response['success'] = null;
126
-        }
127
-        // set redirect_url, IF it exists
128
-        if ($this->redirect_url()) {
129
-            $JSON_response['redirect_url'] = $this->redirect_url();
130
-        }
131
-        // set registration_time_limit, IF it exists
132
-        if ($this->registration_time_limit()) {
133
-            $JSON_response['registration_time_limit'] = $this->registration_time_limit();
134
-        }
135
-        // set payment_amount, IF it exists
136
-        if ($this->payment_amount() !== null) {
137
-            $JSON_response['payment_amount'] = $this->payment_amount();
138
-        }
139
-        // grab generic return data
140
-        $return_data = $this->return_data();
141
-        // add billing form validation rules
142
-        if ($this->validation_rules()) {
143
-            $return_data['validation_rules'] = $this->validation_rules();
144
-        }
145
-        // set reg_step_html, IF it exists
146
-        if ($this->reg_step_html()) {
147
-            $return_data['reg_step_html'] = $this->reg_step_html();
148
-        }
149
-        // set method of payment, IF it exists
150
-        if ($this->method_of_payment()) {
151
-            $return_data['method_of_payment'] = $this->method_of_payment();
152
-        }
153
-        // set "plz_select_method_of_payment" message, IF it exists
154
-        if ($this->plz_select_method_of_payment()) {
155
-            $return_data['plz_select_method_of_payment'] = $this->plz_select_method_of_payment();
156
-        }
157
-        // set redirect_form, IF it exists
158
-        if ($this->redirect_form()) {
159
-            $return_data['redirect_form'] = $this->redirect_form();
160
-        }
161
-        // and finally, add return_data array to main JSON response array, IF it contains anything
162
-        // why did we add some of the above properties to the return data array?
163
-        // because it is easier and cleaner in the Javascript to deal with this way
164
-        if (! empty($return_data)) {
165
-            $JSON_response['return_data'] = $return_data;
166
-        }
167
-        // filter final array
168
-        $JSON_response = apply_filters('FHEE__EE_SPCO_JSON_Response___toString__JSON_response', $JSON_response);
169
-        // return encoded array
170
-        return (string) wp_json_encode($JSON_response);
171
-    }
172
-
173
-
174
-    /**
175
-     * @param string $attention
176
-     */
177
-    public function set_attention($attention)
178
-    {
179
-        $this->_attention = $attention;
180
-    }
181
-
182
-
183
-    /**
184
-     * @return string
185
-     */
186
-    public function attention()
187
-    {
188
-        return $this->_attention;
189
-    }
190
-
191
-
192
-    /**
193
-     * @param string $errors
194
-     */
195
-    public function set_errors($errors)
196
-    {
197
-        $this->_errors = $errors;
198
-    }
199
-
200
-
201
-    /**
202
-     * @return string
203
-     */
204
-    public function errors()
205
-    {
206
-        return $this->_errors;
207
-    }
208
-
209
-
210
-    /**
211
-     * @return string
212
-     */
213
-    public function unexpected_errors()
214
-    {
215
-        return $this->_unexpected_errors;
216
-    }
217
-
218
-
219
-    /**
220
-     * @param string $unexpected_errors
221
-     */
222
-    public function set_unexpected_errors($unexpected_errors)
223
-    {
224
-        $this->_unexpected_errors = $unexpected_errors;
225
-    }
226
-
227
-
228
-    /**
229
-     * @param string $success
230
-     */
231
-    public function set_success($success)
232
-    {
233
-        $this->_success = $success;
234
-    }
235
-
236
-
237
-    /**
238
-     * @return string
239
-     */
240
-    public function success()
241
-    {
242
-        return $this->_success;
243
-    }
244
-
245
-
246
-    /**
247
-     * @param string $method_of_payment
248
-     */
249
-    public function set_method_of_payment($method_of_payment)
250
-    {
251
-        $this->_method_of_payment = $method_of_payment;
252
-    }
253
-
254
-
255
-    /**
256
-     * @return string
257
-     */
258
-    public function method_of_payment()
259
-    {
260
-        return $this->_method_of_payment;
261
-    }
262
-
263
-
264
-    /**
265
-     * @return float
266
-     */
267
-    public function payment_amount()
268
-    {
269
-        return $this->_payment_amount;
270
-    }
271
-
272
-
273
-    /**
274
-     * @param float $payment_amount
275
-     * @throws EE_Error
276
-     */
277
-    public function set_payment_amount($payment_amount)
278
-    {
279
-        $this->_payment_amount = (float) $payment_amount;
280
-    }
281
-
282
-
283
-    /**
284
-     * @param string $next_step_html
285
-     */
286
-    public function set_reg_step_html($next_step_html)
287
-    {
288
-        $this->_reg_step_html = $next_step_html;
289
-    }
290
-
291
-
292
-    /**
293
-     * @return string
294
-     */
295
-    public function reg_step_html()
296
-    {
297
-        return $this->_reg_step_html;
298
-    }
299
-
300
-
301
-    /**
302
-     * @param string $redirect_form
303
-     */
304
-    public function set_redirect_form($redirect_form)
305
-    {
306
-        $this->_redirect_form = $redirect_form;
307
-    }
308
-
309
-
310
-    /**
311
-     * @return string
312
-     */
313
-    public function redirect_form()
314
-    {
315
-        return ! empty($this->_redirect_form) ? $this->_redirect_form : false;
316
-    }
317
-
318
-
319
-    /**
320
-     * @param string $plz_select_method_of_payment
321
-     */
322
-    public function set_plz_select_method_of_payment($plz_select_method_of_payment)
323
-    {
324
-        $this->_plz_select_method_of_payment = $plz_select_method_of_payment;
325
-    }
326
-
327
-
328
-    /**
329
-     * @return string
330
-     */
331
-    public function plz_select_method_of_payment()
332
-    {
333
-        return $this->_plz_select_method_of_payment;
334
-    }
335
-
336
-
337
-    /**
338
-     * @param string $redirect_url
339
-     */
340
-    public function set_redirect_url($redirect_url)
341
-    {
342
-        $this->_redirect_url = $redirect_url;
343
-    }
344
-
345
-
346
-    /**
347
-     * @return string
348
-     */
349
-    public function redirect_url()
350
-    {
351
-        return $this->_redirect_url;
352
-    }
353
-
354
-
355
-    /**
356
-     * @return string
357
-     */
358
-    public function registration_time_limit()
359
-    {
360
-        return $this->_registration_time_limit;
361
-    }
362
-
363
-
364
-    /**
365
-     * @param string $registration_time_limit
366
-     */
367
-    public function set_registration_time_limit($registration_time_limit)
368
-    {
369
-        $this->_registration_time_limit = $registration_time_limit;
370
-    }
371
-
372
-
373
-    /**
374
-     * @param array $return_data
375
-     */
376
-    public function set_return_data($return_data)
377
-    {
378
-        $this->_return_data = array_merge($this->_return_data, $return_data);
379
-    }
380
-
381
-
382
-    /**
383
-     * @return array
384
-     */
385
-    public function return_data()
386
-    {
387
-        return $this->_return_data;
388
-    }
389
-
390
-
391
-    /**
392
-     * @param array $validation_rules
393
-     */
394
-    public function add_validation_rules(array $validation_rules = array())
395
-    {
396
-        if (is_array($validation_rules) && ! empty($validation_rules)) {
397
-            $this->_validation_rules = array_merge($this->_validation_rules, $validation_rules);
398
-        }
399
-    }
400
-
401
-
402
-    /**
403
-     * @return array | bool
404
-     */
405
-    public function validation_rules()
406
-    {
407
-        return ! empty($this->_validation_rules) ? $this->_validation_rules : false;
408
-    }
409
-
410
-
411
-    public function echoAndExit()
412
-    {
413
-        echo $this; // already escaped
414
-        exit();
415
-    }
17
+	/**
18
+	 * @var string
19
+	 */
20
+	protected $_errors = '';
21
+
22
+	/**
23
+	 * @var string
24
+	 */
25
+	protected $_unexpected_errors = '';
26
+
27
+	/**
28
+	 * @var string
29
+	 */
30
+	protected $_attention = '';
31
+
32
+	/**
33
+	 * @var string
34
+	 */
35
+	protected $_success = '';
36
+
37
+	/**
38
+	 * @var string
39
+	 */
40
+	protected $_plz_select_method_of_payment = '';
41
+
42
+	/**
43
+	 * @var string
44
+	 */
45
+	protected $_redirect_url = '';
46
+
47
+	/**
48
+	 * @var string
49
+	 */
50
+	protected $_registration_time_limit = '';
51
+
52
+	/**
53
+	 * @var string
54
+	 */
55
+	protected $_redirect_form = '';
56
+
57
+	/**
58
+	 * @var string
59
+	 */
60
+	protected $_reg_step_html = '';
61
+
62
+	/**
63
+	 * @var string
64
+	 */
65
+	protected $_method_of_payment = '';
66
+
67
+	/**
68
+	 * @var float
69
+	 */
70
+	protected $_payment_amount;
71
+
72
+	/**
73
+	 * @var array
74
+	 */
75
+	protected $_return_data = array();
76
+
77
+
78
+	/**
79
+	 * @var array
80
+	 */
81
+	protected $_validation_rules = array();
82
+
83
+
84
+	/**
85
+	 *    class constructor
86
+	 */
87
+	public function __construct()
88
+	{
89
+	}
90
+
91
+
92
+	/**
93
+	 *    __toString
94
+	 *
95
+	 *        allows you to simply echo or print an EE_SPCO_JSON_Response object to produce a  JSON encoded string
96
+	 *        ie: $json_response = new EE_SPCO_JSON_Response();
97
+	 *        echo $json_response;
98
+	 *
99
+	 * @access    public
100
+	 * @return    string
101
+	 */
102
+	public function __toString()
103
+	{
104
+		$JSON_response = array();
105
+		// grab notices
106
+		$notices = EE_Error::get_notices(false);
107
+		$this->set_attention(isset($notices['attention']) ? $notices['attention'] : '');
108
+		$this->set_errors(isset($notices['errors']) ? $notices['errors'] : '');
109
+		$this->set_success(isset($notices['success']) ? $notices['success'] : '');
110
+		// add notices to JSON response, but only if they exist
111
+		if ($this->attention()) {
112
+			$JSON_response['attention'] = $this->attention();
113
+		}
114
+		if ($this->errors()) {
115
+			$JSON_response['errors'] = $this->errors();
116
+		}
117
+		if ($this->unexpected_errors()) {
118
+			$JSON_response['unexpected_errors'] = $this->unexpected_errors();
119
+		}
120
+		if ($this->success()) {
121
+			$JSON_response['success'] = $this->success();
122
+		}
123
+		// but if NO notices are set... at least set the "success" as a key so that the JS knows everything worked
124
+		if (! isset($JSON_response['attention']) && ! isset($JSON_response['errors']) && ! isset($JSON_response['success'])) {
125
+			$JSON_response['success'] = null;
126
+		}
127
+		// set redirect_url, IF it exists
128
+		if ($this->redirect_url()) {
129
+			$JSON_response['redirect_url'] = $this->redirect_url();
130
+		}
131
+		// set registration_time_limit, IF it exists
132
+		if ($this->registration_time_limit()) {
133
+			$JSON_response['registration_time_limit'] = $this->registration_time_limit();
134
+		}
135
+		// set payment_amount, IF it exists
136
+		if ($this->payment_amount() !== null) {
137
+			$JSON_response['payment_amount'] = $this->payment_amount();
138
+		}
139
+		// grab generic return data
140
+		$return_data = $this->return_data();
141
+		// add billing form validation rules
142
+		if ($this->validation_rules()) {
143
+			$return_data['validation_rules'] = $this->validation_rules();
144
+		}
145
+		// set reg_step_html, IF it exists
146
+		if ($this->reg_step_html()) {
147
+			$return_data['reg_step_html'] = $this->reg_step_html();
148
+		}
149
+		// set method of payment, IF it exists
150
+		if ($this->method_of_payment()) {
151
+			$return_data['method_of_payment'] = $this->method_of_payment();
152
+		}
153
+		// set "plz_select_method_of_payment" message, IF it exists
154
+		if ($this->plz_select_method_of_payment()) {
155
+			$return_data['plz_select_method_of_payment'] = $this->plz_select_method_of_payment();
156
+		}
157
+		// set redirect_form, IF it exists
158
+		if ($this->redirect_form()) {
159
+			$return_data['redirect_form'] = $this->redirect_form();
160
+		}
161
+		// and finally, add return_data array to main JSON response array, IF it contains anything
162
+		// why did we add some of the above properties to the return data array?
163
+		// because it is easier and cleaner in the Javascript to deal with this way
164
+		if (! empty($return_data)) {
165
+			$JSON_response['return_data'] = $return_data;
166
+		}
167
+		// filter final array
168
+		$JSON_response = apply_filters('FHEE__EE_SPCO_JSON_Response___toString__JSON_response', $JSON_response);
169
+		// return encoded array
170
+		return (string) wp_json_encode($JSON_response);
171
+	}
172
+
173
+
174
+	/**
175
+	 * @param string $attention
176
+	 */
177
+	public function set_attention($attention)
178
+	{
179
+		$this->_attention = $attention;
180
+	}
181
+
182
+
183
+	/**
184
+	 * @return string
185
+	 */
186
+	public function attention()
187
+	{
188
+		return $this->_attention;
189
+	}
190
+
191
+
192
+	/**
193
+	 * @param string $errors
194
+	 */
195
+	public function set_errors($errors)
196
+	{
197
+		$this->_errors = $errors;
198
+	}
199
+
200
+
201
+	/**
202
+	 * @return string
203
+	 */
204
+	public function errors()
205
+	{
206
+		return $this->_errors;
207
+	}
208
+
209
+
210
+	/**
211
+	 * @return string
212
+	 */
213
+	public function unexpected_errors()
214
+	{
215
+		return $this->_unexpected_errors;
216
+	}
217
+
218
+
219
+	/**
220
+	 * @param string $unexpected_errors
221
+	 */
222
+	public function set_unexpected_errors($unexpected_errors)
223
+	{
224
+		$this->_unexpected_errors = $unexpected_errors;
225
+	}
226
+
227
+
228
+	/**
229
+	 * @param string $success
230
+	 */
231
+	public function set_success($success)
232
+	{
233
+		$this->_success = $success;
234
+	}
235
+
236
+
237
+	/**
238
+	 * @return string
239
+	 */
240
+	public function success()
241
+	{
242
+		return $this->_success;
243
+	}
244
+
245
+
246
+	/**
247
+	 * @param string $method_of_payment
248
+	 */
249
+	public function set_method_of_payment($method_of_payment)
250
+	{
251
+		$this->_method_of_payment = $method_of_payment;
252
+	}
253
+
254
+
255
+	/**
256
+	 * @return string
257
+	 */
258
+	public function method_of_payment()
259
+	{
260
+		return $this->_method_of_payment;
261
+	}
262
+
263
+
264
+	/**
265
+	 * @return float
266
+	 */
267
+	public function payment_amount()
268
+	{
269
+		return $this->_payment_amount;
270
+	}
271
+
272
+
273
+	/**
274
+	 * @param float $payment_amount
275
+	 * @throws EE_Error
276
+	 */
277
+	public function set_payment_amount($payment_amount)
278
+	{
279
+		$this->_payment_amount = (float) $payment_amount;
280
+	}
281
+
282
+
283
+	/**
284
+	 * @param string $next_step_html
285
+	 */
286
+	public function set_reg_step_html($next_step_html)
287
+	{
288
+		$this->_reg_step_html = $next_step_html;
289
+	}
290
+
291
+
292
+	/**
293
+	 * @return string
294
+	 */
295
+	public function reg_step_html()
296
+	{
297
+		return $this->_reg_step_html;
298
+	}
299
+
300
+
301
+	/**
302
+	 * @param string $redirect_form
303
+	 */
304
+	public function set_redirect_form($redirect_form)
305
+	{
306
+		$this->_redirect_form = $redirect_form;
307
+	}
308
+
309
+
310
+	/**
311
+	 * @return string
312
+	 */
313
+	public function redirect_form()
314
+	{
315
+		return ! empty($this->_redirect_form) ? $this->_redirect_form : false;
316
+	}
317
+
318
+
319
+	/**
320
+	 * @param string $plz_select_method_of_payment
321
+	 */
322
+	public function set_plz_select_method_of_payment($plz_select_method_of_payment)
323
+	{
324
+		$this->_plz_select_method_of_payment = $plz_select_method_of_payment;
325
+	}
326
+
327
+
328
+	/**
329
+	 * @return string
330
+	 */
331
+	public function plz_select_method_of_payment()
332
+	{
333
+		return $this->_plz_select_method_of_payment;
334
+	}
335
+
336
+
337
+	/**
338
+	 * @param string $redirect_url
339
+	 */
340
+	public function set_redirect_url($redirect_url)
341
+	{
342
+		$this->_redirect_url = $redirect_url;
343
+	}
344
+
345
+
346
+	/**
347
+	 * @return string
348
+	 */
349
+	public function redirect_url()
350
+	{
351
+		return $this->_redirect_url;
352
+	}
353
+
354
+
355
+	/**
356
+	 * @return string
357
+	 */
358
+	public function registration_time_limit()
359
+	{
360
+		return $this->_registration_time_limit;
361
+	}
362
+
363
+
364
+	/**
365
+	 * @param string $registration_time_limit
366
+	 */
367
+	public function set_registration_time_limit($registration_time_limit)
368
+	{
369
+		$this->_registration_time_limit = $registration_time_limit;
370
+	}
371
+
372
+
373
+	/**
374
+	 * @param array $return_data
375
+	 */
376
+	public function set_return_data($return_data)
377
+	{
378
+		$this->_return_data = array_merge($this->_return_data, $return_data);
379
+	}
380
+
381
+
382
+	/**
383
+	 * @return array
384
+	 */
385
+	public function return_data()
386
+	{
387
+		return $this->_return_data;
388
+	}
389
+
390
+
391
+	/**
392
+	 * @param array $validation_rules
393
+	 */
394
+	public function add_validation_rules(array $validation_rules = array())
395
+	{
396
+		if (is_array($validation_rules) && ! empty($validation_rules)) {
397
+			$this->_validation_rules = array_merge($this->_validation_rules, $validation_rules);
398
+		}
399
+	}
400
+
401
+
402
+	/**
403
+	 * @return array | bool
404
+	 */
405
+	public function validation_rules()
406
+	{
407
+		return ! empty($this->_validation_rules) ? $this->_validation_rules : false;
408
+	}
409
+
410
+
411
+	public function echoAndExit()
412
+	{
413
+		echo $this; // already escaped
414
+		exit();
415
+	}
416 416
 }
Please login to merge, or discard this patch.