Completed
Push — beta ( ae7b58...fdd17a )
by
unknown
07:33
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
@@ -15,6 +15,9 @@
 block discarded – undo
15 15
     private $last_author = false;
16 16
     private $timeshift_cached_meta;
17 17
 
18
+    /**
19
+     * @param string $i18n
20
+     */
18 21
     public function __construct($i18n)
19 22
     {
20 23
         global $wpdb;
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -55,13 +55,13 @@  discard block
 block discarded – undo
55 55
     public function add_metabox()
56 56
     {
57 57
         $cl = $this;
58
-        if (! $this->timeshiftVisible()) {
58
+        if ( ! $this->timeshiftVisible()) {
59 59
             return;
60 60
         }
61
-        if (! isset($_GET['post']) || ! $this->hasTimeshifts($_GET['post'])) {
61
+        if ( ! isset($_GET['post']) || ! $this->hasTimeshifts($_GET['post'])) {
62 62
             return;
63 63
         }
64
-        add_action('add_meta_boxes', function () use ($cl) {
64
+        add_action('add_meta_boxes', function() use ($cl) {
65 65
             add_meta_box('krn-timeshift', __('Timeshift', 'kmm-timeshift'), [$cl, 'timeshift_metabox'], null, 'normal', 'core');
66 66
         });
67 67
     }
@@ -69,11 +69,11 @@  discard block
 block discarded – undo
69 69
     public function timeshift_metabox()
70 70
     {
71 71
         global $post;
72
-        if (! isset($_GET['post'])) {
72
+        if ( ! isset($_GET['post'])) {
73 73
             return;
74 74
         }
75 75
 
76
-        if (! isset($_GET['timeshift_paged'])) {
76
+        if ( ! isset($_GET['timeshift_paged'])) {
77 77
             $_GET['timeshift_paged'] = 1;
78 78
         }
79 79
         $start = ($_GET['timeshift_paged'] - 1) * 10;
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
             if (isset($_GET['timeshift']) && $_GET['timeshift'] == $rev->id) {
130 130
                 $style = 'style="font-style:italic;background-color: lightblue;"';
131 131
             }
132
-            if (! isset($timeshift->meta['_edit_last']) || is_null($timeshift->meta['_edit_last'])) {
132
+            if ( ! isset($timeshift->meta['_edit_last']) || is_null($timeshift->meta['_edit_last'])) {
133 133
                 $timeshift->meta['_edit_last'] = 0; // some images dont have _edit_last field
134 134
             }
135 135
             echo '<tr ' . $style . '>';
@@ -165,11 +165,11 @@  discard block
 block discarded – undo
165 165
 
166 166
     public function inject_metadata_timeshift($value, $post_id, $key, $single)
167 167
     {
168
-        if (! isset($_GET['timeshift'])) {
168
+        if ( ! isset($_GET['timeshift'])) {
169 169
             return;
170 170
         }
171 171
         //Load timeshift
172
-        if (! $this->timeshift_cached_meta) {
172
+        if ( ! $this->timeshift_cached_meta) {
173 173
             $post_type = get_post_type($post_id);
174 174
             $table_name = $this->wpdb->prefix . 'timeshift_' . $post_type;
175 175
             $sql = "select * from $table_name where id=" . intval($_GET['timeshift']);
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
     public function inject_timeshift($p)
192 192
     {
193 193
         global $post;
194
-        if (! isset($_GET['timeshift'])) {
194
+        if ( ! isset($_GET['timeshift'])) {
195 195
             return;
196 196
         }
197 197
         //Load timeshift
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
     {
209 209
         add_action('edit_form_top', [$this, 'inject_timeshift'], 1, 1);
210 210
         add_action('pre_post_update', [$this, 'pre_post_update'], 2, 1);
211
-        add_action('admin_notices', function () {
211
+        add_action('admin_notices', function() {
212 212
             if (isset($_GET['timeshift']) && $_GET['timeshift']) {
213 213
                 echo '<div class="notice notice-warning is-dismissible">
214 214
                          <p style="font-weight: 800; color: red">' . __('You are editing a historical version! if you save or publish, this will replace the current live one', 'kmm-timeshift') . '</p>
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
         }
271 271
         unset($mdata['_edit_lock']);
272 272
 
273
-        $timeshift = (object) ['post' => $post, 'meta' => $mdata];
273
+        $timeshift = (object)['post' => $post, 'meta' => $mdata];
274 274
         $this->storeTimeshift($timeshift);
275 275
     }
276 276
 }
Please login to merge, or discard this patch.