Passed
Push — master ( 31f474...7d7341 )
by Kiran
10:27 queued 05:04
created
includes/class-wpinv-api.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  * @since    1.0.19
7 7
  */
8 8
 
9
-defined( 'ABSPATH' ) || exit;
9
+defined('ABSPATH') || exit;
10 10
 
11 11
 /**
12 12
  * The main API class
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
         $this->invoice_counts = new GetPaid_REST_Report_Invoice_Counts_Controller();
97 97
 
98 98
         // Fires after loading the rest api.
99
-        do_action( 'getpaid_rest_api_loaded', $this );
99
+        do_action('getpaid_rest_api_loaded', $this);
100 100
     }
101 101
 
102 102
 }
Please login to merge, or discard this patch.
includes/api/class-getpaid-rest-report-invoice-counts-controller.php 2 patches
Indentation   +98 added lines, -98 removed lines patch added patch discarded remove patch
@@ -18,102 +18,102 @@
 block discarded – undo
18 18
  */
19 19
 class GetPaid_REST_Report_Invoice_Counts_Controller extends GetPaid_REST_Reports_Controller {
20 20
 
21
-	/**
22
-	 * Route base.
23
-	 *
24
-	 * @var string
25
-	 */
26
-	protected $rest_base = 'reports/invoices/counts';
27
-
28
-	/**
29
-	 * Prepare a report object for serialization.
30
-	 *
31
-	 * @param  stdClass        $report Report data.
32
-	 * @param  WP_REST_Request $request Request object.
33
-	 * @return WP_REST_Response $response Response data.
34
-	 */
35
-	public function prepare_item_for_response( $report, $request ) {
36
-
37
-		$data    = (array) $report;
38
-		$context = ! empty( $request['context'] ) ? $request['context'] : 'view';
39
-		$data    = $this->add_additional_fields_to_object( $data, $request );
40
-		$data    = $this->filter_response_by_context( $data, $context );
41
-
42
-		// Wrap the data in a response object.
43
-		$response = rest_ensure_response( $data );
44
-
45
-		$response->add_links(
46
-			array(
47
-				'about' => array(
48
-					'href' => rest_url( sprintf( '%s/reports', $this->namespace ) ),
49
-				),
50
-			)
51
-		);
52
-
53
-		return apply_filters( 'getpaid_rest_prepare_report_invoices_count', $response, $report, $request );
54
-	}
55
-
56
-	/**
57
-	 * Get reports list.
58
-	 *
59
-	 * @since 2.0.0
60
-	 * @return array
61
-	 */
62
-	protected function get_reports() {
63
-
64
-		$counts = wp_count_posts( 'wpi_invoice' );
65
-		$data   = array();
66
-
67
-		foreach ( wpinv_get_invoice_statuses() as $slug => $name ) {
68
-
69
-			if ( ! isset( $counts->$slug ) ) {
70
-				continue;
71
-			}
72
-
73
-			$data[] = array(
74
-				'slug'  => $slug,
75
-				'name'  => $name,
76
-				'count' => (int) $counts->$slug,
77
-			);
78
-
79
-		}
80
-
81
-		return $data;
82
-
83
-	}
84
-
85
-	/**
86
-	 * Get the Report's schema, conforming to JSON Schema.
87
-	 *
88
-	 * @return array
89
-	 */
90
-	public function get_item_schema() {
91
-		$schema = array(
92
-			'$schema'    => 'http://json-schema.org/draft-04/schema#',
93
-			'title'      => 'report_invoice_counts',
94
-			'type'       => 'object',
95
-			'properties' => array(
96
-				'slug'  => array(
97
-					'description' => __( 'An alphanumeric identifier for the resource.', 'invoicing' ),
98
-					'type'        => 'string',
99
-					'context'     => array( 'view' ),
100
-					'readonly'    => true,
101
-				),
102
-				'name'  => array(
103
-					'description' => __( 'Invoice status name.', 'invoicing' ),
104
-					'type'        => 'string',
105
-					'context'     => array( 'view' ),
106
-					'readonly'    => true,
107
-				),
108
-				'count' => array(
109
-					'description' => __( 'Number of invoices.', 'invoicing' ),
110
-					'type'        => 'string',
111
-					'context'     => array( 'view' ),
112
-					'readonly'    => true,
113
-				),
114
-			),
115
-		);
116
-
117
-		return $this->add_additional_fields_schema( $schema );
118
-	}
21
+    /**
22
+     * Route base.
23
+     *
24
+     * @var string
25
+     */
26
+    protected $rest_base = 'reports/invoices/counts';
27
+
28
+    /**
29
+     * Prepare a report object for serialization.
30
+     *
31
+     * @param  stdClass        $report Report data.
32
+     * @param  WP_REST_Request $request Request object.
33
+     * @return WP_REST_Response $response Response data.
34
+     */
35
+    public function prepare_item_for_response( $report, $request ) {
36
+
37
+        $data    = (array) $report;
38
+        $context = ! empty( $request['context'] ) ? $request['context'] : 'view';
39
+        $data    = $this->add_additional_fields_to_object( $data, $request );
40
+        $data    = $this->filter_response_by_context( $data, $context );
41
+
42
+        // Wrap the data in a response object.
43
+        $response = rest_ensure_response( $data );
44
+
45
+        $response->add_links(
46
+            array(
47
+                'about' => array(
48
+                    'href' => rest_url( sprintf( '%s/reports', $this->namespace ) ),
49
+                ),
50
+            )
51
+        );
52
+
53
+        return apply_filters( 'getpaid_rest_prepare_report_invoices_count', $response, $report, $request );
54
+    }
55
+
56
+    /**
57
+     * Get reports list.
58
+     *
59
+     * @since 2.0.0
60
+     * @return array
61
+     */
62
+    protected function get_reports() {
63
+
64
+        $counts = wp_count_posts( 'wpi_invoice' );
65
+        $data   = array();
66
+
67
+        foreach ( wpinv_get_invoice_statuses() as $slug => $name ) {
68
+
69
+            if ( ! isset( $counts->$slug ) ) {
70
+                continue;
71
+            }
72
+
73
+            $data[] = array(
74
+                'slug'  => $slug,
75
+                'name'  => $name,
76
+                'count' => (int) $counts->$slug,
77
+            );
78
+
79
+        }
80
+
81
+        return $data;
82
+
83
+    }
84
+
85
+    /**
86
+     * Get the Report's schema, conforming to JSON Schema.
87
+     *
88
+     * @return array
89
+     */
90
+    public function get_item_schema() {
91
+        $schema = array(
92
+            '$schema'    => 'http://json-schema.org/draft-04/schema#',
93
+            'title'      => 'report_invoice_counts',
94
+            'type'       => 'object',
95
+            'properties' => array(
96
+                'slug'  => array(
97
+                    'description' => __( 'An alphanumeric identifier for the resource.', 'invoicing' ),
98
+                    'type'        => 'string',
99
+                    'context'     => array( 'view' ),
100
+                    'readonly'    => true,
101
+                ),
102
+                'name'  => array(
103
+                    'description' => __( 'Invoice status name.', 'invoicing' ),
104
+                    'type'        => 'string',
105
+                    'context'     => array( 'view' ),
106
+                    'readonly'    => true,
107
+                ),
108
+                'count' => array(
109
+                    'description' => __( 'Number of invoices.', 'invoicing' ),
110
+                    'type'        => 'string',
111
+                    'context'     => array( 'view' ),
112
+                    'readonly'    => true,
113
+                ),
114
+            ),
115
+        );
116
+
117
+        return $this->add_additional_fields_schema( $schema );
118
+    }
119 119
 }
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  * @since   2.0.0
10 10
  */
11 11
 
12
-defined( 'ABSPATH' ) || exit;
12
+defined('ABSPATH') || exit;
13 13
 
14 14
 /**
15 15
  * GetPaid REST invoice counts controller class.
@@ -32,25 +32,25 @@  discard block
 block discarded – undo
32 32
 	 * @param  WP_REST_Request $request Request object.
33 33
 	 * @return WP_REST_Response $response Response data.
34 34
 	 */
35
-	public function prepare_item_for_response( $report, $request ) {
35
+	public function prepare_item_for_response($report, $request) {
36 36
 
37 37
 		$data    = (array) $report;
38
-		$context = ! empty( $request['context'] ) ? $request['context'] : 'view';
39
-		$data    = $this->add_additional_fields_to_object( $data, $request );
40
-		$data    = $this->filter_response_by_context( $data, $context );
38
+		$context = !empty($request['context']) ? $request['context'] : 'view';
39
+		$data    = $this->add_additional_fields_to_object($data, $request);
40
+		$data    = $this->filter_response_by_context($data, $context);
41 41
 
42 42
 		// Wrap the data in a response object.
43
-		$response = rest_ensure_response( $data );
43
+		$response = rest_ensure_response($data);
44 44
 
45 45
 		$response->add_links(
46 46
 			array(
47 47
 				'about' => array(
48
-					'href' => rest_url( sprintf( '%s/reports', $this->namespace ) ),
48
+					'href' => rest_url(sprintf('%s/reports', $this->namespace)),
49 49
 				),
50 50
 			)
51 51
 		);
52 52
 
53
-		return apply_filters( 'getpaid_rest_prepare_report_invoices_count', $response, $report, $request );
53
+		return apply_filters('getpaid_rest_prepare_report_invoices_count', $response, $report, $request);
54 54
 	}
55 55
 
56 56
 	/**
@@ -61,12 +61,12 @@  discard block
 block discarded – undo
61 61
 	 */
62 62
 	protected function get_reports() {
63 63
 
64
-		$counts = wp_count_posts( 'wpi_invoice' );
64
+		$counts = wp_count_posts('wpi_invoice');
65 65
 		$data   = array();
66 66
 
67
-		foreach ( wpinv_get_invoice_statuses() as $slug => $name ) {
67
+		foreach (wpinv_get_invoice_statuses() as $slug => $name) {
68 68
 
69
-			if ( ! isset( $counts->$slug ) ) {
69
+			if (!isset($counts->$slug)) {
70 70
 				continue;
71 71
 			}
72 72
 
@@ -94,26 +94,26 @@  discard block
 block discarded – undo
94 94
 			'type'       => 'object',
95 95
 			'properties' => array(
96 96
 				'slug'  => array(
97
-					'description' => __( 'An alphanumeric identifier for the resource.', 'invoicing' ),
97
+					'description' => __('An alphanumeric identifier for the resource.', 'invoicing'),
98 98
 					'type'        => 'string',
99
-					'context'     => array( 'view' ),
99
+					'context'     => array('view'),
100 100
 					'readonly'    => true,
101 101
 				),
102 102
 				'name'  => array(
103
-					'description' => __( 'Invoice status name.', 'invoicing' ),
103
+					'description' => __('Invoice status name.', 'invoicing'),
104 104
 					'type'        => 'string',
105
-					'context'     => array( 'view' ),
105
+					'context'     => array('view'),
106 106
 					'readonly'    => true,
107 107
 				),
108 108
 				'count' => array(
109
-					'description' => __( 'Number of invoices.', 'invoicing' ),
109
+					'description' => __('Number of invoices.', 'invoicing'),
110 110
 					'type'        => 'string',
111
-					'context'     => array( 'view' ),
111
+					'context'     => array('view'),
112 112
 					'readonly'    => true,
113 113
 				),
114 114
 			),
115 115
 		);
116 116
 
117
-		return $this->add_additional_fields_schema( $schema );
117
+		return $this->add_additional_fields_schema($schema);
118 118
 	}
119 119
 }
Please login to merge, or discard this patch.
includes/data/vat-number-regexes.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
6 6
  * @package Invoicing/data
7 7
  */
8 8
 
9
-defined( 'ABSPATH' ) || exit;
9
+defined('ABSPATH') || exit;
10 10
 
11 11
 return array(
12 12
 
Please login to merge, or discard this patch.
vendor/composer/installers/src/Composer/Installers/Installer.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
     {
166 166
         $installPath = $this->getPackageBasePath($package);
167 167
         $io = $this->io;
168
-        $outputStatus = function () use ($io, $installPath) {
168
+        $outputStatus = function() use ($io, $installPath) {
169 169
             $io->write(sprintf('Deleting %s - %s', $installPath, !file_exists($installPath) ? '<comment>deleted</comment>' : '<error>not deleted</error>'));
170 170
         };
171 171
 
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
             $pattern = $locations ? '(' . implode('|', $locations) . ')' : false;
236 236
         }
237 237
 
238
-        return $pattern ? : '(\w+)';
238
+        return $pattern ?: '(\w+)';
239 239
     }
240 240
 
241 241
     /**
Please login to merge, or discard this patch.
vendor/composer/installers/src/Composer/Installers/CakePHPInstaller.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
     public function getLocations()
37 37
     {
38 38
         if ($this->matchesCakeVersion('>=', '3.0.0')) {
39
-            $this->locations['plugin'] =  $this->composer->getConfig()->get('vendor-dir') . '/{$vendor}/{$name}/';
39
+            $this->locations['plugin'] = $this->composer->getConfig()->get('vendor-dir') . '/{$vendor}/{$name}/';
40 40
         }
41 41
         return $this->locations;
42 42
     }
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
     protected function matchesCakeVersion($matcher, $version)
52 52
     {
53 53
         $repositoryManager = $this->composer->getRepositoryManager();
54
-        if (! $repositoryManager) {
54
+        if (!$repositoryManager) {
55 55
             return false;
56 56
         }
57 57
 
Please login to merge, or discard this patch.
vendor/composer/installers/src/Composer/Installers/OxidInstaller.php 1 patch
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
 
6 6
 class OxidInstaller extends BaseInstaller
7 7
 {
8
-	const VENDOR_PATTERN = '/^modules\/(?P<vendor>.+)\/.+/';
8
+    const VENDOR_PATTERN = '/^modules\/(?P<vendor>.+)\/.+/';
9 9
 
10 10
     protected $locations = array(
11 11
         'module'    => 'modules/{$name}/',
@@ -13,47 +13,47 @@  discard block
 block discarded – undo
13 13
         'out'    => 'out/{$name}/',
14 14
     );
15 15
 
16
-	/**
17
-	 * getInstallPath
18
-	 *
19
-	 * @param PackageInterface $package
20
-	 * @param string $frameworkType
21
-	 * @return string
22
-	 */
23
-	public function getInstallPath(PackageInterface $package, $frameworkType = '')
24
-	{
25
-		$installPath = parent::getInstallPath($package, $frameworkType);
26
-		$type = $this->package->getType();
27
-		if ($type === 'oxid-module') {
28
-			$this->prepareVendorDirectory($installPath);
29
-		}
30
-		return $installPath;
31
-	}
16
+    /**
17
+     * getInstallPath
18
+     *
19
+     * @param PackageInterface $package
20
+     * @param string $frameworkType
21
+     * @return string
22
+     */
23
+    public function getInstallPath(PackageInterface $package, $frameworkType = '')
24
+    {
25
+        $installPath = parent::getInstallPath($package, $frameworkType);
26
+        $type = $this->package->getType();
27
+        if ($type === 'oxid-module') {
28
+            $this->prepareVendorDirectory($installPath);
29
+        }
30
+        return $installPath;
31
+    }
32 32
 
33
-	/**
34
-	 * prepareVendorDirectory
35
-	 *
36
-	 * Makes sure there is a vendormetadata.php file inside
37
-	 * the vendor folder if there is a vendor folder.
38
-	 *
39
-	 * @param string $installPath
40
-	 * @return void
41
-	 */
42
-	protected function prepareVendorDirectory($installPath)
43
-	{
44
-		$matches = '';
45
-		$hasVendorDirectory = preg_match(self::VENDOR_PATTERN, $installPath, $matches);
46
-		if (!$hasVendorDirectory) {
47
-			return;
48
-		}
33
+    /**
34
+     * prepareVendorDirectory
35
+     *
36
+     * Makes sure there is a vendormetadata.php file inside
37
+     * the vendor folder if there is a vendor folder.
38
+     *
39
+     * @param string $installPath
40
+     * @return void
41
+     */
42
+    protected function prepareVendorDirectory($installPath)
43
+    {
44
+        $matches = '';
45
+        $hasVendorDirectory = preg_match(self::VENDOR_PATTERN, $installPath, $matches);
46
+        if (!$hasVendorDirectory) {
47
+            return;
48
+        }
49 49
 
50
-		$vendorDirectory = $matches['vendor'];
51
-		$vendorPath = getcwd() . '/modules/' . $vendorDirectory;
52
-		if (!file_exists($vendorPath)) {
53
-			mkdir($vendorPath, 0755, true);
54
-		}
50
+        $vendorDirectory = $matches['vendor'];
51
+        $vendorPath = getcwd() . '/modules/' . $vendorDirectory;
52
+        if (!file_exists($vendorPath)) {
53
+            mkdir($vendorPath, 0755, true);
54
+        }
55 55
 
56
-		$vendorMetaDataPath = $vendorPath . '/vendormetadata.php';
57
-		touch($vendorMetaDataPath);
58
-	}
56
+        $vendorMetaDataPath = $vendorPath . '/vendormetadata.php';
57
+        touch($vendorMetaDataPath);
58
+    }
59 59
 }
Please login to merge, or discard this patch.
templates/frontend-head.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@
 block discarded – undo
7 7
  * @version 1.0.19
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12 12
 ?>
13 13
 
Please login to merge, or discard this patch.
includes/payments/class-getpaid-payment-exception.php 2 patches
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -14,51 +14,51 @@
 block discarded – undo
14 14
  */
15 15
 class GetPaid_Payment_Exception extends Exception {
16 16
 
17
-	/**
18
-	 * Sanitized error code.
19
-	 *
20
-	 * @var string
21
-	 */
22
-	protected $error_code;
17
+    /**
18
+     * Sanitized error code.
19
+     *
20
+     * @var string
21
+     */
22
+    protected $error_code;
23 23
 
24
-	/**
25
-	 * Error extra data.
26
-	 *
27
-	 * @var array
28
-	 */
29
-	protected $error_data;
24
+    /**
25
+     * Error extra data.
26
+     *
27
+     * @var array
28
+     */
29
+    protected $error_data;
30 30
 
31
-	/**
32
-	 * Setup exception.
33
-	 *
34
-	 * @param string $code             Machine-readable error code, e.g `getpaid-discount-error`.
35
-	 * @param string $message          User-friendly translated error message, e.g. 'Discount is invalid'.
36
-	 * @param int    $http_status_code Proper HTTP status code to respond with, e.g. 400.
37
-	 * @param array  $data             Extra error data.
38
-	 */
39
-	public function __construct( $code, $message, $http_status_code = 400, $data = array() ) {
40
-		$this->error_code = $code;
41
-		$this->error_data = array_merge( array( 'status' => $http_status_code ), $data );
31
+    /**
32
+     * Setup exception.
33
+     *
34
+     * @param string $code             Machine-readable error code, e.g `getpaid-discount-error`.
35
+     * @param string $message          User-friendly translated error message, e.g. 'Discount is invalid'.
36
+     * @param int    $http_status_code Proper HTTP status code to respond with, e.g. 400.
37
+     * @param array  $data             Extra error data.
38
+     */
39
+    public function __construct( $code, $message, $http_status_code = 400, $data = array() ) {
40
+        $this->error_code = $code;
41
+        $this->error_data = array_merge( array( 'status' => $http_status_code ), $data );
42 42
 
43
-		parent::__construct( $message, $http_status_code );
44
-	}
43
+        parent::__construct( $message, $http_status_code );
44
+    }
45 45
 
46
-	/**
47
-	 * Returns the error code.
48
-	 *
49
-	 * @return string
50
-	 */
51
-	public function getErrorCode() {
52
-		return $this->error_code;
53
-	}
46
+    /**
47
+     * Returns the error code.
48
+     *
49
+     * @return string
50
+     */
51
+    public function getErrorCode() {
52
+        return $this->error_code;
53
+    }
54 54
 
55
-	/**
56
-	 * Returns error data.
57
-	 *
58
-	 * @return array
59
-	 */
60
-	public function getErrorData() {
61
-		return $this->error_data;
62
-	}
55
+    /**
56
+     * Returns error data.
57
+     *
58
+     * @return array
59
+     */
60
+    public function getErrorData() {
61
+        return $this->error_data;
62
+    }
63 63
 
64 64
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  * @since   2.2.2
8 8
  */
9 9
 
10
-defined( 'ABSPATH' ) || exit;
10
+defined('ABSPATH') || exit;
11 11
 
12 12
 /**
13 13
  * Payment exception class.
@@ -36,11 +36,11 @@  discard block
 block discarded – undo
36 36
 	 * @param int    $http_status_code Proper HTTP status code to respond with, e.g. 400.
37 37
 	 * @param array  $data             Extra error data.
38 38
 	 */
39
-	public function __construct( $code, $message, $http_status_code = 400, $data = array() ) {
39
+	public function __construct($code, $message, $http_status_code = 400, $data = array()) {
40 40
 		$this->error_code = $code;
41
-		$this->error_data = array_merge( array( 'status' => $http_status_code ), $data );
41
+		$this->error_data = array_merge(array('status' => $http_status_code), $data);
42 42
 
43
-		parent::__construct( $message, $http_status_code );
43
+		parent::__construct($message, $http_status_code);
44 44
 	}
45 45
 
46 46
 	/**
Please login to merge, or discard this patch.
includes/admin/meta-boxes/class-getpaid-meta-box-payment-form.php 2 patches
Indentation   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  */
8 8
 
9 9
 if ( ! defined( 'ABSPATH' ) ) {
10
-	exit; // Exit if accessed directly
10
+    exit; // Exit if accessed directly
11 11
 }
12 12
 
13 13
 /**
@@ -16,10 +16,10 @@  discard block
 block discarded – undo
16 16
 class GetPaid_Meta_Box_Payment_Form {
17 17
 
18 18
     /**
19
-	 * Output the metabox.
20
-	 *
21
-	 * @param WP_Post $post
22
-	 */
19
+     * Output the metabox.
20
+     *
21
+     * @param WP_Post $post
22
+     */
23 23
     public static function output( $post ) {
24 24
         ?>
25 25
         <style>
@@ -102,11 +102,11 @@  discard block
 block discarded – undo
102 102
     }
103 103
 
104 104
     /**
105
-	 * Save meta box data.
106
-	 *
107
-	 * @param int $post_id
108
-	 */
109
-	public static function save( $post_id ) {
105
+     * Save meta box data.
106
+     *
107
+     * @param int $post_id
108
+     */
109
+    public static function save( $post_id ) {
110 110
 
111 111
         // Prepare the form.
112 112
         $form = new GetPaid_Payment_Form( $post_id );
@@ -137,11 +137,11 @@  discard block
 block discarded – undo
137 137
     }
138 138
 
139 139
     /**
140
-	 * Converts an array fo form items to objects.
141
-	 *
142
-	 * @param array $items
143
-	 */
144
-	public static function item_to_objects( $items ) {
140
+     * Converts an array fo form items to objects.
141
+     *
142
+     * @param array $items
143
+     */
144
+    public static function item_to_objects( $items ) {
145 145
 
146 146
         $objects = array();
147 147
 
Please login to merge, or discard this patch.
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  *
7 7
  */
8 8
 
9
-if ( ! defined( 'ABSPATH' ) ) {
9
+if (!defined('ABSPATH')) {
10 10
 	exit; // Exit if accessed directly
11 11
 }
12 12
 
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 	 *
21 21
 	 * @param WP_Post $post
22 22
 	 */
23
-    public static function output( $post ) {
23
+    public static function output($post) {
24 24
         ?>
25 25
         <style>
26 26
             .wpinv-form-builder-edit-field-wrapper label.d-block > span:first-child{
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
                 <div class="col-sm-4">
34 34
 
35 35
                     <!-- Builder tabs -->
36
-                    <button class="button button-primary" v-if="active_tab!='new_item'" @click.prevent="active_tab='new_item'"><?php esc_html_e( 'Go Back', 'invoicing' ); ?></button>
36
+                    <button class="button button-primary" v-if="active_tab!='new_item'" @click.prevent="active_tab='new_item'"><?php esc_html_e('Go Back', 'invoicing'); ?></button>
37 37
 
38 38
                     <!-- Builder tab content -->
39 39
                     <div class="mt-4">
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
                         <!-- Available builder elements -->
42 42
                         <div class="wpinv-form-builder-tab-pane" v-if="active_tab=='new_item'">
43 43
                             <div class="wpinv-form-builder-add-field-types">
44
-                                <small class='form-text text-muted'><?php esc_html_e( 'Add an element by dragging it to the payment form.', 'invoicing' ); ?></small>
44
+                                <small class='form-text text-muted'><?php esc_html_e('Add an element by dragging it to the payment form.', 'invoicing'); ?></small>
45 45
                                 <draggable class="section mt-2" style="display: flex; flex-flow: wrap; justify-content: space-between;" v-model="elements" :group="{ name: 'fields', pull: 'clone', put: false }" :sort="false" :clone="addDraggedField" tag="ul" filter=".wpinv-undraggable">
46 46
                                     <li v-for="element in elements" class= "wpinv-payment-form-left-fields-field" @click.prevent="addField(element)" :class="{ 'd-none': element.defaults.premade }">
47 47
                                         <button class="button btn text-dark">
@@ -56,18 +56,18 @@  discard block
 block discarded – undo
56 56
                         <!-- Edit an element -->
57 57
                         <div class="wpinv-form-builder-tab-pane" v-if="active_tab=='edit_item'" style="font-size: 14px;">
58 58
                             <div class="wpinv-form-builder-edit-field-wrapper">
59
-                                <?php do_action( 'wpinv_payment_form_edit_element_template', 'active_form_element', $post ); ?>
60
-                                <?php do_action( 'getpaid_payment_form_edit_element_template', $post ); ?>
59
+                                <?php do_action('wpinv_payment_form_edit_element_template', 'active_form_element', $post); ?>
60
+                                <?php do_action('getpaid_payment_form_edit_element_template', $post); ?>
61 61
                                 <div class='form-group mb-3'>
62
-                                    <label :for="active_form_element.id + '_grid_width'"><?php esc_html_e( 'Width', 'invoicing' ); ?></label>
62
+                                    <label :for="active_form_element.id + '_grid_width'"><?php esc_html_e('Width', 'invoicing'); ?></label>
63 63
                                     <select class='form-control custom-select' :id="active_form_element.id + '_grid_width'" v-model='gridWidth'>
64
-                                        <option value='full'><?php esc_html_e( 'Full Width', 'invoicing' ); ?></option>
65
-                                        <option value='half'><?php esc_html_e( 'Half Width', 'invoicing' ); ?></option>
66
-                                        <option value='third'><?php esc_html_e( '1/3 Width', 'invoicing' ); ?></option>
64
+                                        <option value='full'><?php esc_html_e('Full Width', 'invoicing'); ?></option>
65
+                                        <option value='half'><?php esc_html_e('Half Width', 'invoicing'); ?></option>
66
+                                        <option value='third'><?php esc_html_e('1/3 Width', 'invoicing'); ?></option>
67 67
                                     </select>
68 68
                                 </div>
69 69
                                 <div>
70
-                                    <button type="button" class="button button-link button-link-delete" @click.prevent="removeField(active_form_element)" v-show="! active_form_element.premade"><?php esc_html_e( 'Delete Element', 'invoicing' ); ?></button>
70
+                                    <button type="button" class="button button-link button-link-delete" @click.prevent="removeField(active_form_element)" v-show="! active_form_element.premade"><?php esc_html_e('Delete Element', 'invoicing'); ?></button>
71 71
                                 </div>
72 72
                             </div>
73 73
                         </div>
@@ -76,15 +76,15 @@  discard block
 block discarded – undo
76 76
 
77 77
                 </div>
78 78
                 <div class="col-sm-8 border-left">
79
-                    <small class='form-text text-muted' v-if='form_elements.length'><?php esc_html_e( 'Click on any element to edit or delete it.', 'invoicing' ); ?></small>
80
-                    <p class='form-text text-muted' v-if='! form_elements.length'><?php esc_html_e( 'This form is empty. Add new elements by dragging them from the right.', 'invoicing' ); ?></p>
79
+                    <small class='form-text text-muted' v-if='form_elements.length'><?php esc_html_e('Click on any element to edit or delete it.', 'invoicing'); ?></small>
80
+                    <p class='form-text text-muted' v-if='! form_elements.length'><?php esc_html_e('This form is empty. Add new elements by dragging them from the right.', 'invoicing'); ?></p>
81 81
 
82 82
                     <div class="container-fluid">
83 83
                         <draggable class="section row" v-model="form_elements" @add="highlightLastDroppedField" group="fields" tag="div" style="min-height: 100%; font-size: 14px;">
84 84
                             <div v-for="form_element in form_elements" class="wpinv-form-builder-element-preview" :class="[{ active: active_form_element==form_element &&  active_tab=='edit_item' }, form_element.type, grid_class( form_element ) ]" @click="active_tab = 'edit_item'; active_form_element = form_element">
85 85
                                 <div class="wpinv-form-builder-element-preview-inner">
86 86
                                     <div class="wpinv-payment-form-field-preview-overlay"></div>
87
-                                    <?php do_action( 'wpinv_payment_form_render_element_template', 'form_element', $post ); ?>
87
+                                    <?php do_action('wpinv_payment_form_render_element_template', 'form_element', $post); ?>
88 88
                                 </div>
89 89
                             </div>
90 90
                         </draggable>
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
         </script>
104 104
         <?php
105 105
 
106
-        wp_nonce_field( 'getpaid_meta_nonce', 'getpaid_meta_nonce' );
106
+        wp_nonce_field('getpaid_meta_nonce', 'getpaid_meta_nonce');
107 107
     }
108 108
 
109 109
     /**
@@ -111,33 +111,33 @@  discard block
 block discarded – undo
111 111
 	 *
112 112
 	 * @param int $post_id
113 113
 	 */
114
-	public static function save( $post_id ) {
114
+	public static function save($post_id) {
115 115
 
116 116
         // Prepare the form.
117
-        $form = new GetPaid_Payment_Form( $post_id );
117
+        $form = new GetPaid_Payment_Form($post_id);
118 118
 
119 119
         // Fetch form items.
120
-        $form_items = json_decode( wp_unslash( $_POST['wpinv_form_items'] ), true );
120
+        $form_items = json_decode(wp_unslash($_POST['wpinv_form_items']), true);
121 121
 
122 122
         // Ensure that we have an array...
123
-        if ( empty( $form_items ) ) {
123
+        if (empty($form_items)) {
124 124
             $form_items = array();
125 125
         }
126 126
 
127 127
         // Add it to the form.
128
-        $form->set_items( self::item_to_objects( wp_kses_post_deep( $form_items ) ) );
128
+        $form->set_items(self::item_to_objects(wp_kses_post_deep($form_items)));
129 129
 
130 130
         // Save form elements.
131
-        $form_elements = json_decode( wp_unslash( $_POST['wpinv_form_elements'] ), true );
132
-        if ( empty( $form_elements ) ) {
131
+        $form_elements = json_decode(wp_unslash($_POST['wpinv_form_elements']), true);
132
+        if (empty($form_elements)) {
133 133
             $form_elements = array();
134 134
         }
135 135
 
136
-        $form->set_elements( wp_kses_post_deep( $form_elements ) );
136
+        $form->set_elements(wp_kses_post_deep($form_elements));
137 137
 
138 138
         // Persist data to the datastore.
139 139
         $form->save();
140
-        do_action( 'getpaid_payment_form_metabox_save', $post_id, $form );
140
+        do_action('getpaid_payment_form_metabox_save', $post_id, $form);
141 141
 
142 142
     }
143 143
 
@@ -146,14 +146,14 @@  discard block
 block discarded – undo
146 146
 	 *
147 147
 	 * @param array $items
148 148
 	 */
149
-	public static function item_to_objects( $items ) {
149
+	public static function item_to_objects($items) {
150 150
 
151 151
         $objects = array();
152 152
 
153
-        foreach ( $items as $item ) {
154
-            $_item = new GetPaid_Form_Item( $item['id'] );
155
-            $_item->set_allow_quantities( (bool) $item['allow_quantities'] );
156
-            $_item->set_is_required( (bool) $item['required'] );
153
+        foreach ($items as $item) {
154
+            $_item = new GetPaid_Form_Item($item['id']);
155
+            $_item->set_allow_quantities((bool) $item['allow_quantities']);
156
+            $_item->set_is_required((bool) $item['required']);
157 157
             $objects[] = $_item;
158 158
         }
159 159
 
Please login to merge, or discard this patch.