Completed
Push — beta ( 56d793...fe329d )
by
unknown
05:03 queued 12s
created
kmm-timeshift.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 
16 16
 use KMM\Timeshift\Core;
17 17
 
18
-if (! function_exists('add_filter')) {
18
+if ( ! function_exists('add_filter')) {
19 19
     return;
20 20
 }
21 21
 
@@ -35,15 +35,15 @@  discard block
 block discarded – undo
35 35
 
36 36
     // If the class does not exist, and the vendor file is there
37 37
     // maybe the plugin was installed separately via Composer, let's try to load autoload
38
-    if (! $class_exists && $autoload_found) {
38
+    if ( ! $class_exists && $autoload_found) {
39 39
         @require_once __DIR__ . '/vendor/autoload.php';
40 40
     }
41 41
 
42
-    return $class_exists || ( $autoload_found && class_exists($class_name) );
42
+    return $class_exists || ($autoload_found && class_exists($class_name));
43 43
 }
44 44
 
45 45
 // Exit if classes are not available
46
-if (! ensure_class_loaded(__NAMESPACE__ . '\Core')) {
46
+if ( ! ensure_class_loaded(__NAMESPACE__ . '\Core')) {
47 47
     return;
48 48
 }
49 49
 
Please login to merge, or discard this patch.
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,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
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 
234 234
         // Don't save timeshift when the media was just uploaded, i.e. the post was just created
235 235
         if (count($mdata) > 2) {
236
-            $timeshift = (object) ['post' => $post, 'meta' => $mdata];
236
+            $timeshift = (object)['post' => $post, 'meta' => $mdata];
237 237
             $this->storeTimeshift($timeshift);
238 238
         }
239 239
     }
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
         $table_name = $this->wpdb->prefix . 'timeshift_' . $prod_post->post_type;
248 248
         $sql = "select  count(1) as cnt from $table_name where post_id=" . $prod_post->ID;
249 249
         $maxrows = $this->wpdb->get_results($sql);
250
-        $allrows = (int) $maxrows[0]->{'cnt'};
250
+        $allrows = (int)$maxrows[0]->{'cnt'};
251 251
 
252 252
         // max. number of pages
253 253
         $max_page = ceil($allrows / $this->timeshift_posts_per_page);
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
     }
266 266
 
267 267
     public function get_next_rows($prod_post, $start = 0) {
268
-        if (! isset($prod_post)) {
268
+        if ( ! isset($prod_post)) {
269 269
             return;
270 270
         }
271 271
 
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
     }
278 278
 
279 279
     public function render_metabox_table($prod_post, $rows = []) {
280
-        if (! isset($prod_post)) {
280
+        if ( ! isset($prod_post)) {
281 281
             return;
282 282
         }
283 283
 
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
             }
318 318
 
319 319
             // some images dont have _edit_last field
320
-            if (! isset($timeshift->meta['_edit_last']) || is_null($timeshift->meta['_edit_last'])) {
320
+            if ( ! isset($timeshift->meta['_edit_last']) || is_null($timeshift->meta['_edit_last'])) {
321 321
                 $timeshift->meta['_edit_last'] = 0;
322 322
             }
323 323
 
Please login to merge, or discard this patch.