Completed
Push — beta ( 5a71d2...f64331 )
by
unknown
08:27
created
src/Core.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -52,20 +52,20 @@  discard block
 block discarded – undo
52 52
 
53 53
     public function add_metabox() {
54 54
         $cl = $this;
55
-        if (! $this->timeshiftVisible()) {
55
+        if ( ! $this->timeshiftVisible()) {
56 56
             return;
57 57
         }
58 58
         // Keep adding the metabox even if no timeshifts available, i.e. will render timeshift box with only live version
59
-        if (! isset($_GET['post'])) {
59
+        if ( ! isset($_GET['post'])) {
60 60
             return;
61 61
         }
62
-        add_action('add_meta_boxes', function () use ($cl) {
62
+        add_action('add_meta_boxes', function() use ($cl) {
63 63
             add_meta_box('krn-timeshift', __('Timeshift', 'kmm-timeshift'), [$cl, 'timeshift_metabox'], null, 'normal', 'core');
64 64
         });
65 65
     }
66 66
 
67 67
     public function timeshift_metabox() {
68
-        if (! isset($_GET['post'])) {
68
+        if ( ! isset($_GET['post'])) {
69 69
             return;
70 70
         }
71 71
         $prod_post = get_post($_GET['post']);
@@ -109,11 +109,11 @@  discard block
 block discarded – undo
109 109
     }
110 110
 
111 111
     public function inject_metadata_timeshift($value, $post_id, $key, $single) {
112
-        if (! isset($_GET['timeshift'])) {
112
+        if ( ! isset($_GET['timeshift'])) {
113 113
             return;
114 114
         }
115 115
         // Load timeshift
116
-        if (! $this->timeshift_cached_meta) {
116
+        if ( ! $this->timeshift_cached_meta) {
117 117
             $post_type = get_post_type($post_id);
118 118
             $table_name = $this->wpdb->prefix . 'timeshift_' . $post_type;
119 119
             $sql = "select * from $table_name where id=" . intval($_GET['timeshift']);
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
 
135 135
     public function inject_timeshift($p) {
136 136
         global $post;
137
-        if (! isset($_GET['timeshift'])) {
137
+        if ( ! isset($_GET['timeshift'])) {
138 138
             return;
139 139
         }
140 140
         // Load timeshift
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
         if (is_array($mdata) && isset($mdata['_timeshift_version'][0]) &&
207 207
         is_numeric($mdata['_timeshift_version'][0])) {
208 208
             // Increment version for post's meta
209
-            $verToSave = (int) $mdata['_timeshift_version'][0] + 1;
209
+            $verToSave = (int)$mdata['_timeshift_version'][0] + 1;
210 210
         }
211 211
         update_post_meta($postID, '_timeshift_version', $verToSave);
212 212
         if ($verToSave > 1) {
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
         $timeshiftVer = $this->updateTimeshiftVersion($post_ID, $mdata);
243 243
         $mdata['_timeshift_version'][0] = $timeshiftVer;
244 244
         $mdata['KRN_MODE'] = 'DELETE';
245
-        $timeshift = (object) ['post' => $post, 'meta' => $mdata];
245
+        $timeshift = (object)['post' => $post, 'meta' => $mdata];
246 246
         $this->storeTimeshift($timeshift);
247 247
     }
248 248
 
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
         if ($recordTimeshift) {
297 297
             $mdata['_timeshift_version'][0] = $timeshiftVer;
298 298
             $mdata['save_initiator'] = $prevSaveInit;
299
-            $timeshift = (object) ['post' => $post, 'meta' => $mdata];
299
+            $timeshift = (object)['post' => $post, 'meta' => $mdata];
300 300
             $this->storeTimeshift($timeshift);
301 301
         }
302 302
     }
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
         $table_name = $this->wpdb->prefix . 'timeshift_' . $prod_post->post_type;
311 311
         $sql = "select  count(1) as cnt from $table_name where post_id=" . $prod_post->ID;
312 312
         $maxrows = $this->wpdb->get_results($sql);
313
-        $allrows = (int) $maxrows[0]->{'cnt'};
313
+        $allrows = (int)$maxrows[0]->{'cnt'};
314 314
 
315 315
         // max. number of pages
316 316
         $max_page = ceil($allrows / $this->timeshift_posts_per_page);
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
     }
329 329
 
330 330
     public function get_next_rows($prod_post, $start = 0) {
331
-        if (! isset($prod_post)) {
331
+        if ( ! isset($prod_post)) {
332 332
             return;
333 333
         }
334 334
 
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
     }
341 341
 
342 342
     public function render_metabox_table($prod_post, $rows = []) {
343
-        if (! isset($prod_post)) {
343
+        if ( ! isset($prod_post)) {
344 344
             return;
345 345
         }
346 346
 
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
             }
390 390
 
391 391
             // some images don't have _edit_last field
392
-            if (! isset($timeshift->meta['_edit_last']) || is_null($timeshift->meta['_edit_last'])) {
392
+            if ( ! isset($timeshift->meta['_edit_last']) || is_null($timeshift->meta['_edit_last'])) {
393 393
                 $timeshift->meta['_edit_last'] = 0;
394 394
             }
395 395
 
Please login to merge, or discard this patch.