@@ -41,12 +41,12 @@ discard block |
||
| 41 | 41 | * class-wp-rest-attachments-controller.php calls the action with $attachment as array, and also calls parent::update_item(), |
| 42 | 42 | * -> parent class is class-wp-rest-posts-controller.php, that also calls the action, but with $attachment as type WP_Post |
| 43 | 43 | */ |
| 44 | - if (! $postObj instanceof \WP_Post) { |
|
| 44 | + if ( ! $postObj instanceof \WP_Post) { |
|
| 45 | 45 | return; |
| 46 | 46 | } |
| 47 | 47 | $_POST['post_type'] = $postObj->post_type; |
| 48 | 48 | // save all the data in an anonymous function |
| 49 | - $trigger_func = function ($response, $handler, $request) use ($postObj, $update) { |
|
| 49 | + $trigger_func = function($response, $handler, $request) use ($postObj, $update) { |
|
| 50 | 50 | // call the internal save_post after all postmeta is written |
| 51 | 51 | $this->save_post($postObj->ID, $postObj, $update); |
| 52 | 52 | |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | public function save_post($postId, $postObject, $update, $state = false) |
| 80 | 80 | { |
| 81 | 81 | $postType = false; |
| 82 | - if (! $postObject) { |
|
| 82 | + if ( ! $postObject) { |
|
| 83 | 83 | //postObject not set, check if $_POST has post_type |
| 84 | 84 | if (isset($_POST['post_type'])) { |
| 85 | 85 | $postType = $_POST['post_type']; |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | $postType = $postObject->post_type; |
| 90 | 90 | } |
| 91 | 91 | //Neither $postObject nor $_POST[post_type] set return here. |
| 92 | - if (! $postType) { |
|
| 92 | + if ( ! $postType) { |
|
| 93 | 93 | return; |
| 94 | 94 | } |
| 95 | 95 | |
@@ -120,11 +120,11 @@ discard block |
||
| 120 | 120 | $checkRow = $this->wpdb->get_row("select post_id from $table_name where post_id=" . $postId); |
| 121 | 121 | //if we have already a published record, update it |
| 122 | 122 | $update = true; |
| 123 | - if (! $checkRow) { |
|
| 123 | + if ( ! $checkRow) { |
|
| 124 | 124 | $update = false; |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | - if (! $update) { |
|
| 127 | + if ( ! $update) { |
|
| 128 | 128 | //INSERT |
| 129 | 129 | $updateCols = ['post_type', 'post_id']; |
| 130 | 130 | $updateVals = ["'" . $postType . "'", $postId]; |