@@ -36,12 +36,12 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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]; |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | $updateCols = []; |
| 149 | 149 | $updateVals = []; |
| 150 | 150 | foreach ($finalFields as $key => $value) { |
| 151 | - $updateCols[] = "`" . $key . "`" . ' = ' . $assoc_db[$key]['printf']; |
|
| 151 | + $updateCols[] = "`" . $key . "`" . ' = ' . $assoc_db[$key]['printf']; |
|
| 152 | 152 | $updateVals[] = $value; |
| 153 | 153 | } |
| 154 | 154 | $updateVals[] = $postId; |
@@ -190,7 +190,7 @@ discard block |
||
| 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']); |