Passed
Push — beta ( 7ba27d...b42ade )
by
unknown
10:48 queued 23s
created
kmm-flattable.php 2 patches
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 use KMM\Flattable\Core;
17 17
 
18 18
 if ( ! function_exists( 'add_filter' ) ) {
19
-	return;
19
+    return;
20 20
 }
21 21
 
22 22
 
@@ -29,21 +29,21 @@  discard block
 block discarded – undo
29 29
  */
30 30
 function ensure_class_loaded( $class_name ) {
31 31
 
32
-	$class_exists   = class_exists( $class_name );
33
-	$autoload_found = file_exists( __DIR__ . '/vendor/autoload.php' );
32
+    $class_exists   = class_exists( $class_name );
33
+    $autoload_found = file_exists( __DIR__ . '/vendor/autoload.php' );
34 34
 
35
-	// If the class does not exist, and the vendor file is there
36
-	// maybe the plugin was installed separately via Composer, let's try to load autoload
37
-	if ( ! $class_exists && $autoload_found ) {
38
-		@require_once __DIR__ . '/vendor/autoload.php';
39
-	}
35
+    // If the class does not exist, and the vendor file is there
36
+    // maybe the plugin was installed separately via Composer, let's try to load autoload
37
+    if ( ! $class_exists && $autoload_found ) {
38
+        @require_once __DIR__ . '/vendor/autoload.php';
39
+    }
40 40
 
41
-	return $class_exists || ( $autoload_found && class_exists( $class_name ) );
41
+    return $class_exists || ( $autoload_found && class_exists( $class_name ) );
42 42
 }
43 43
 
44 44
 // Exit if classes are not available
45 45
 if ( ! ensure_class_loaded( __NAMESPACE__ . '\Core' ) ) {
46
-	return;
46
+    return;
47 47
 }
48 48
 
49 49
 add_action( 'plugins_loaded', __NAMESPACE__ . '\main' );
@@ -53,17 +53,17 @@  discard block
 block discarded – undo
53 53
  * @wp-hook plugins_loaded
54 54
  */
55 55
 function main() {
56
-	new Core();
56
+    new Core();
57 57
 
58
-	if ( is_admin() ) {
59
-		// Backend
58
+    if ( is_admin() ) {
59
+        // Backend
60 60
 
61
-		// TODO: register your backend-code here...
61
+        // TODO: register your backend-code here...
62 62
 
63
-	} else {
64
-		// Frontend
63
+    } else {
64
+        // Frontend
65 65
 
66
-		// TODO: register frontend-code here...
67
-	}
66
+        // TODO: register frontend-code here...
67
+    }
68 68
 
69 69
 }
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 
16 16
 use KMM\Flattable\Core;
17 17
 
18
-if ( ! function_exists( 'add_filter' ) ) {
18
+if ( ! function_exists('add_filter')) {
19 19
 	return;
20 20
 }
21 21
 
@@ -27,26 +27,26 @@  discard block
 block discarded – undo
27 27
  *
28 28
  * @return bool
29 29
  */
30
-function ensure_class_loaded( $class_name ) {
30
+function ensure_class_loaded($class_name) {
31 31
 
32
-	$class_exists   = class_exists( $class_name );
33
-	$autoload_found = file_exists( __DIR__ . '/vendor/autoload.php' );
32
+	$class_exists   = class_exists($class_name);
33
+	$autoload_found = file_exists(__DIR__ . '/vendor/autoload.php');
34 34
 
35 35
 	// If the class does not exist, and the vendor file is there
36 36
 	// maybe the plugin was installed separately via Composer, let's try to load autoload
37
-	if ( ! $class_exists && $autoload_found ) {
37
+	if ( ! $class_exists && $autoload_found) {
38 38
 		@require_once __DIR__ . '/vendor/autoload.php';
39 39
 	}
40 40
 
41
-	return $class_exists || ( $autoload_found && class_exists( $class_name ) );
41
+	return $class_exists || ($autoload_found && class_exists($class_name));
42 42
 }
43 43
 
44 44
 // Exit if classes are not available
45
-if ( ! ensure_class_loaded( __NAMESPACE__ . '\Core' ) ) {
45
+if ( ! ensure_class_loaded(__NAMESPACE__ . '\Core')) {
46 46
 	return;
47 47
 }
48 48
 
49
-add_action( 'plugins_loaded', __NAMESPACE__ . '\main' );
49
+add_action('plugins_loaded', __NAMESPACE__ . '\main');
50 50
 
51 51
 
52 52
 /**
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 function main() {
56 56
 	new Core();
57 57
 
58
-	if ( is_admin() ) {
58
+	if (is_admin()) {
59 59
 		// Backend
60 60
 
61 61
 		// TODO: register your backend-code here...
Please login to merge, or discard this patch.
src/Core.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -36,12 +36,12 @@  discard block
 block discarded – undo
36 36
         * class-wp-rest-attachments-controller.php calls the action with $attachment as array, and also calls parent::update_item(),
37 37
         *  -> parent class is class-wp-rest-posts-controller.php, that also calls the action, but with $attachment as type WP_Post
38 38
         */
39
-        if (! $postObj instanceof \WP_Post) {
39
+        if ( ! $postObj instanceof \WP_Post) {
40 40
             return;
41 41
         }
42 42
         $_POST['post_type'] = $postObj->post_type;
43 43
         // save all the data in an anonymous function
44
-        $trigger_func = function ($response, $handler, $request) use ($postObj, $update) {
44
+        $trigger_func = function($response, $handler, $request) use ($postObj, $update) {
45 45
             // call the internal save_post after all postmeta is written
46 46
             $this->save_post($postObj->ID, $postObj, $update);
47 47
 
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 
77 77
     public function save_post($postId, $postObject, $update, $state = false) {
78 78
         $postType = false;
79
-        if (! $postObject) {
79
+        if ( ! $postObject) {
80 80
             //postObject not set, check if $_POST has post_type
81 81
             if (isset($_POST['post_type'])) {
82 82
                 $postType = $_POST['post_type'];
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
             $postType = $postObject->post_type;
87 87
         }
88 88
         //Neither $postObject nor $_POST[post_type] set return here.
89
-        if (! $postType) {
89
+        if ( ! $postType) {
90 90
             return;
91 91
         }
92 92
 
@@ -121,11 +121,11 @@  discard block
 block discarded – undo
121 121
                 $checkRow = $this->wpdb->get_row("select post_id from $table_name where post_id=" . $postId);
122 122
                 //if we have already a published record, update it
123 123
                 $update = true;
124
-                if (! $checkRow) {
124
+                if ( ! $checkRow) {
125 125
                     $update = false;
126 126
                 }
127 127
 
128
-                if (! $update) {
128
+                if ( ! $update) {
129 129
                     //INSERT
130 130
                     $updateCols = ['post_type', 'post_id'];
131 131
                     $updateVals = ["'" . $postType . "'", $postId];
@@ -190,7 +190,7 @@  discard block
 block discarded – undo
190 190
                 WHERE table_name = '$table_name' AND column_name = '" . $column['column'] . "'");
191 191
 
192 192
             if (empty($row)) {
193
-                if ((! defined('WP_DEBUG') || ! WP_DEBUG) || defined('KRN_IS_TESTING')) {
193
+                if (( ! defined('WP_DEBUG') || ! WP_DEBUG) || defined('KRN_IS_TESTING')) {
194 194
                     $this->wpdb->suppress_errors(true);
195 195
                 }
196 196
                 $this->wpdb->query("ALTER TABLE $table_name ADD `" . $column['column'] . '` ' . $column['type']);
Please login to merge, or discard this patch.