Completed
Push — beta ( d0c35f...fdc0e9 )
by
unknown
10:38
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   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -56,27 +56,27 @@  discard block
 block discarded – undo
56 56
     public function add_metabox()
57 57
     {
58 58
         $cl = $this;
59
-        if (! $this->timeshiftVisible()) {
59
+        if ( ! $this->timeshiftVisible()) {
60 60
             return;
61 61
         }
62
-        if (! isset($_GET['post']) || ! $this->hasTimeshifts($_GET['post'])) {
62
+        if ( ! isset($_GET['post']) || ! $this->hasTimeshifts($_GET['post'])) {
63 63
             return;
64 64
         }
65
-        add_action('add_meta_boxes', function () use ($cl) {
65
+        add_action('add_meta_boxes', function() use ($cl) {
66 66
             add_meta_box('krn-timeshift', __('Timeshift', 'kmm-timeshift'), [$cl, 'timeshift_metabox'], null, 'normal', 'core');
67 67
         });
68 68
     }
69 69
 
70 70
     public function timeshift_metabox()
71 71
     {
72
-        if (! isset($_GET['post'])) {
72
+        if ( ! isset($_GET['post'])) {
73 73
             return;
74 74
         }
75 75
         $prod_post = get_post($_GET['post']);
76 76
 
77 77
         $start = 0;
78 78
         $timeshift_page = 1;
79
-        if(isset($_GET['timeshift_page'])) {
79
+        if (isset($_GET['timeshift_page'])) {
80 80
             $start = ($_GET['timeshift_page'] - 1) * $this->timeshift_posts_per_page;
81 81
             $timeshift_page = $_GET['timeshift_page'];
82 82
         }
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
         $timeshift_table = $this->render_metabox_table($prod_post, $rows);
92 92
         echo $timeshift_table;
93 93
 
94
-        if(isset($_GET['action']) && $_GET['action'] == $this->pagination_ajax_action) {
94
+        if (isset($_GET['action']) && $_GET['action'] == $this->pagination_ajax_action) {
95 95
             wp_die();
96 96
         }
97 97
     }
@@ -117,11 +117,11 @@  discard block
 block discarded – undo
117 117
 
118 118
     public function inject_metadata_timeshift($value, $post_id, $key, $single)
119 119
     {
120
-        if (! isset($_GET['timeshift'])) {
120
+        if ( ! isset($_GET['timeshift'])) {
121 121
             return;
122 122
         }
123 123
         // Load timeshift
124
-        if (! $this->timeshift_cached_meta) {
124
+        if ( ! $this->timeshift_cached_meta) {
125 125
             $post_type = get_post_type($post_id);
126 126
             $table_name = $this->wpdb->prefix . 'timeshift_' . $post_type;
127 127
             $sql = "select * from $table_name where id=" . intval($_GET['timeshift']);
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
     public function inject_timeshift($p)
144 144
     {
145 145
         global $post;
146
-        if (! isset($_GET['timeshift'])) {
146
+        if ( ! isset($_GET['timeshift'])) {
147 147
             return;
148 148
         }
149 149
         // Load timeshift
@@ -177,7 +177,7 @@  discard block
 block discarded – undo
177 177
 
178 178
     public function enqueue_scripts()
179 179
     {
180
-        wp_enqueue_script('krn-timeshift-pagination-ajax', plugin_dir_url( __FILE__ ) . '../assets/js/pagination-ajax.js', ['jquery']);
180
+        wp_enqueue_script('krn-timeshift-pagination-ajax', plugin_dir_url(__FILE__) . '../assets/js/pagination-ajax.js', ['jquery']);
181 181
         wp_localize_script('krn-timeshift-pagination-ajax', 'krn_timeshift', array(
182 182
             'action' => $this->pagination_ajax_action,
183 183
             'post' => isset($_GET['post']) ? $_GET['post'] : false,
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
         }
238 238
         unset($mdata['_edit_lock']);
239 239
 
240
-        $timeshift = (object) ['post' => $post, 'meta' => $mdata];
240
+        $timeshift = (object)['post' => $post, 'meta' => $mdata];
241 241
         $this->storeTimeshift($timeshift);
242 242
     }
243 243
 
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 
271 271
     public function get_next_rows($prod_post, $start = 0)
272 272
     {
273
-        if (! isset($prod_post)) {
273
+        if ( ! isset($prod_post)) {
274 274
             return;
275 275
         }
276 276
 
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 
284 284
     public function render_metabox_table($prod_post, $rows = [])
285 285
     {
286
-        if (! isset($prod_post)) {
286
+        if ( ! isset($prod_post)) {
287 287
             return;
288 288
         }
289 289
 
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
         $sql_last_editor = 'select meta_value from ' . $table_postmeta . ' where post_id=' . $prod_post->ID . " AND meta_key='_edit_last'";
293 293
         $last_editor = $this->wpdb->get_var($sql_last_editor);
294 294
 
295
-        $output =  '<table class="widefat fixed">';
295
+        $output = '<table class="widefat fixed">';
296 296
         $output .= '<thead>';
297 297
         $output .= '<tr>';
298 298
         $output .= '<th width=30></th>';
@@ -323,21 +323,21 @@  discard block
 block discarded – undo
323 323
             }
324 324
 
325 325
             // some images dont have _edit_last field
326
-            if (! isset($timeshift->meta['_edit_last']) || is_null($timeshift->meta['_edit_last'])) {
326
+            if ( ! isset($timeshift->meta['_edit_last']) || is_null($timeshift->meta['_edit_last'])) {
327 327
                 $timeshift->meta['_edit_last'] = 0;
328 328
             }
329 329
 
330
-            $output .=  '<tr ' . $style . '>';
331
-            $output .=  '<td>' . get_avatar($timeshift->meta['_edit_last'][0], 30) . '</td>';
332
-            $output .=  '<td>' . $timeshift->post->post_title . '</td>';
333
-            $output .=  '<td>' . $timeshift->post->post_modified . '</td>';
334
-            $output .=  '<td>' . get_the_author_meta('display_name', $timeshift->meta['_edit_last'][0]) . '</td>';
335
-            $output .=  '<td><a href="post.php?post=' . $_GET['post'] . "&action=edit&timeshift=" . $rev->id . '"><span class="dashicons dashicons-backup"></span></a></td>';
336
-            $output .=  '</tr>';
330
+            $output .= '<tr ' . $style . '>';
331
+            $output .= '<td>' . get_avatar($timeshift->meta['_edit_last'][0], 30) . '</td>';
332
+            $output .= '<td>' . $timeshift->post->post_title . '</td>';
333
+            $output .= '<td>' . $timeshift->post->post_modified . '</td>';
334
+            $output .= '<td>' . get_the_author_meta('display_name', $timeshift->meta['_edit_last'][0]) . '</td>';
335
+            $output .= '<td><a href="post.php?post=' . $_GET['post'] . "&action=edit&timeshift=" . $rev->id . '"><span class="dashicons dashicons-backup"></span></a></td>';
336
+            $output .= '</tr>';
337 337
         }
338 338
 
339
-        $output .=  '</tbody>';
340
-        $output .=  '</table>';
339
+        $output .= '</tbody>';
340
+        $output .= '</table>';
341 341
 
342 342
         return $output;
343 343
     }
Please login to merge, or discard this patch.