Completed
Push — beta ( da515e...b40428 )
by
unknown
06:35
created
src/Core.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -14,6 +14,9 @@
 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;
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -52,19 +52,19 @@  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
-        if (! isset($_GET['post']) || ! $this->hasTimeshifts($_GET['post'])) {
58
+        if ( ! isset($_GET['post']) || ! $this->hasTimeshifts($_GET['post'])) {
59 59
             return;
60 60
         }
61
-        add_action('add_meta_boxes', function () use ($cl) {
61
+        add_action('add_meta_boxes', function() use ($cl) {
62 62
             add_meta_box('krn-timeshift', __('Timeshift', 'kmm-timeshift'), [$cl, 'timeshift_metabox'], null, 'normal', 'core');
63 63
         });
64 64
     }
65 65
 
66 66
     public function timeshift_metabox() {
67
-        if (! isset($_GET['post'])) {
67
+        if ( ! isset($_GET['post'])) {
68 68
             return;
69 69
         }
70 70
         $prod_post = get_post($_GET['post']);
@@ -108,11 +108,11 @@  discard block
 block discarded – undo
108 108
     }
109 109
 
110 110
     public function inject_metadata_timeshift($value, $post_id, $key, $single) {
111
-        if (! isset($_GET['timeshift'])) {
111
+        if ( ! isset($_GET['timeshift'])) {
112 112
             return;
113 113
         }
114 114
         // Load timeshift
115
-        if (! $this->timeshift_cached_meta) {
115
+        if ( ! $this->timeshift_cached_meta) {
116 116
             $post_type = get_post_type($post_id);
117 117
             $table_name = $this->wpdb->prefix . 'timeshift_' . $post_type;
118 118
             $sql = "select * from $table_name where id=" . intval($_GET['timeshift']);
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
 
134 134
     public function inject_timeshift($p) {
135 135
         global $post;
136
-        if (! isset($_GET['timeshift'])) {
136
+        if ( ! isset($_GET['timeshift'])) {
137 137
             return;
138 138
         }
139 139
         // Load timeshift
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
         }
221 221
         unset($mdata['_edit_lock']);
222 222
 
223
-        $timeshift = (object) ['post' => $post, 'meta' => $mdata];
223
+        $timeshift = (object)['post' => $post, 'meta' => $mdata];
224 224
         $this->storeTimeshift($timeshift);
225 225
     }
226 226
 
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
         $table_name = $this->wpdb->prefix . 'timeshift_' . $prod_post->post_type;
234 234
         $sql = "select  count(1) as cnt from $table_name where post_id=" . $prod_post->ID;
235 235
         $maxrows = $this->wpdb->get_results($sql);
236
-        $allrows = (int) $maxrows[0]->{'cnt'};
236
+        $allrows = (int)$maxrows[0]->{'cnt'};
237 237
 
238 238
         // max. number of pages
239 239
         $max_page = ceil($allrows / $this->timeshift_posts_per_page);
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
     }
252 252
 
253 253
     public function get_next_rows($prod_post, $start = 0) {
254
-        if (! isset($prod_post)) {
254
+        if ( ! isset($prod_post)) {
255 255
             return;
256 256
         }
257 257
 
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
     }
264 264
 
265 265
     public function render_metabox_table($prod_post, $rows = []) {
266
-        if (! isset($prod_post)) {
266
+        if ( ! isset($prod_post)) {
267 267
             return;
268 268
         }
269 269
 
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
             }
304 304
 
305 305
             // some images dont have _edit_last field
306
-            if (! isset($timeshift->meta['_edit_last']) || is_null($timeshift->meta['_edit_last'])) {
306
+            if ( ! isset($timeshift->meta['_edit_last']) || is_null($timeshift->meta['_edit_last'])) {
307 307
                 $timeshift->meta['_edit_last'] = 0;
308 308
             }
309 309
 
Please login to merge, or discard this patch.