@@ -15,7 +15,7 @@ discard block |
||
| 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 |
||
| 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 | |
@@ -15,6 +15,9 @@ |
||
| 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; |
@@ -53,13 +53,13 @@ discard block |
||
| 53 | 53 | public function add_metabox() |
| 54 | 54 | { |
| 55 | 55 | $cl = $this; |
| 56 | - if (! $this->timeshiftVisible()) { |
|
| 56 | + if ( ! $this->timeshiftVisible()) { |
|
| 57 | 57 | return; |
| 58 | 58 | } |
| 59 | - if (! isset($_GET['post']) || ! $this->hasTimeshifts($_GET['post'])) { |
|
| 59 | + if ( ! isset($_GET['post']) || ! $this->hasTimeshifts($_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 | } |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | public function timeshift_metabox() |
| 68 | 68 | { |
| 69 | 69 | global $post; |
| 70 | - if (! isset($_GET['post'])) { |
|
| 70 | + if ( ! isset($_GET['post'])) { |
|
| 71 | 71 | return; |
| 72 | 72 | } |
| 73 | 73 | $prod_post = get_post($_GET['post']); |
@@ -134,11 +134,11 @@ discard block |
||
| 134 | 134 | |
| 135 | 135 | public function inject_metadata_timeshift($value, $post_id, $key, $single) |
| 136 | 136 | { |
| 137 | - if (! isset($_GET['timeshift'])) { |
|
| 137 | + if ( ! isset($_GET['timeshift'])) { |
|
| 138 | 138 | return; |
| 139 | 139 | } |
| 140 | 140 | //Load timeshift |
| 141 | - if (! $this->timeshift_cached_meta) { |
|
| 141 | + if ( ! $this->timeshift_cached_meta) { |
|
| 142 | 142 | $post_type = get_post_type($post_id); |
| 143 | 143 | $table_name = $this->wpdb->prefix . 'timeshift_' . $post_type; |
| 144 | 144 | $sql = "select * from $table_name where id=" . intval($_GET['timeshift']); |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | public function inject_timeshift($p) |
| 162 | 162 | { |
| 163 | 163 | global $post; |
| 164 | - if (! isset($_GET['timeshift'])) { |
|
| 164 | + if ( ! isset($_GET['timeshift'])) { |
|
| 165 | 165 | return; |
| 166 | 166 | } |
| 167 | 167 | //Load timeshift |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | { |
| 179 | 179 | add_action('edit_form_top', [$this, 'inject_timeshift'], 1, 1); |
| 180 | 180 | add_action('pre_post_update', [$this, 'pre_post_update'], 2, 1); |
| 181 | - add_action('admin_notices', function () { |
|
| 181 | + add_action('admin_notices', function() { |
|
| 182 | 182 | if (isset($_GET['timeshift']) && $_GET['timeshift']) { |
| 183 | 183 | echo '<div class="notice notice-warning is-dismissible"> |
| 184 | 184 | <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> |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | } |
| 235 | 235 | unset($mdata['_edit_lock']); |
| 236 | 236 | |
| 237 | - $timeshift = (object) ['post' => $post, 'meta' => $mdata]; |
|
| 237 | + $timeshift = (object)['post' => $post, 'meta' => $mdata]; |
|
| 238 | 238 | $this->storeTimeshift($timeshift); |
| 239 | 239 | } |
| 240 | 240 | } |