Completed
Push — beta ( fe329d...34edd0 )
by
unknown
10:21 queued 11s
created
src/Core.php 2 patches
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -14,6 +14,9 @@  discard block
 block discarded – undo
14 14
     private $last_author = false;
15 15
     private $timeshift_cached_meta;
16 16
 
17
+    /**
18
+     * @param string $i18n
19
+     */
17 20
     public function __construct($i18n) {
18 21
         global $wpdb;
19 22
         $this->i18n = $i18n;
@@ -200,6 +203,9 @@  discard block
 block discarded – undo
200 203
         $this->wpdb->query($query);
201 204
     }
202 205
 
206
+    /**
207
+     * @param integer $postID
208
+     */
203 209
     private function updateTimeshiftVersion($postID, $mdata): int {
204 210
         $verToSave = 0;
205 211
         if (is_array($mdata) && isset($mdata['_timeshift_version'][0]) &&
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 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
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
         if (is_array($mdata) && isset($mdata['_timeshift_version'][0]) &&
206 206
         is_numeric($mdata['_timeshift_version'][0])) {
207 207
             // Increment version for post's meta
208
-            $verToSave = (int) $mdata['_timeshift_version'][0] + 1;
208
+            $verToSave = (int)$mdata['_timeshift_version'][0] + 1;
209 209
         }
210 210
         update_post_meta($postID, '_timeshift_version', $verToSave);
211 211
         if ($verToSave > 1) {
@@ -253,7 +253,7 @@  discard block
 block discarded – undo
253 253
         // Don't save timeshift when the media was just uploaded, i.e. the post was just created
254 254
         if (count($mdata) > 2) {
255 255
             $mdata['_timeshift_version'][0] = $timeshiftVer;
256
-            $timeshift = (object) ['post' => $post, 'meta' => $mdata];
256
+            $timeshift = (object)['post' => $post, 'meta' => $mdata];
257 257
             $this->storeTimeshift($timeshift);
258 258
         }
259 259
     }
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
         $table_name = $this->wpdb->prefix . 'timeshift_' . $prod_post->post_type;
268 268
         $sql = "select  count(1) as cnt from $table_name where post_id=" . $prod_post->ID;
269 269
         $maxrows = $this->wpdb->get_results($sql);
270
-        $allrows = (int) $maxrows[0]->{'cnt'};
270
+        $allrows = (int)$maxrows[0]->{'cnt'};
271 271
 
272 272
         // max. number of pages
273 273
         $max_page = ceil($allrows / $this->timeshift_posts_per_page);
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
     }
286 286
 
287 287
     public function get_next_rows($prod_post, $start = 0) {
288
-        if (! isset($prod_post)) {
288
+        if ( ! isset($prod_post)) {
289 289
             return;
290 290
         }
291 291
 
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
     }
298 298
 
299 299
     public function render_metabox_table($prod_post, $rows = []) {
300
-        if (! isset($prod_post)) {
300
+        if ( ! isset($prod_post)) {
301 301
             return;
302 302
         }
303 303
 
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
             }
338 338
 
339 339
             // some images dont have _edit_last field
340
-            if (! isset($timeshift->meta['_edit_last']) || is_null($timeshift->meta['_edit_last'])) {
340
+            if ( ! isset($timeshift->meta['_edit_last']) || is_null($timeshift->meta['_edit_last'])) {
341 341
                 $timeshift->meta['_edit_last'] = 0;
342 342
             }
343 343
 
Please login to merge, or discard this patch.