@@ -14,6 +14,9 @@ |
||
| 14 | 14 | private $plugin_dir; |
| 15 | 15 | private $timeshift_cached_meta; |
| 16 | 16 | |
| 17 | + /** |
|
| 18 | + * @param string $i18n |
|
| 19 | + */ |
|
| 17 | 20 | public function __construct($i18n) |
| 18 | 21 | { |
| 19 | 22 | global $wpdb; |
@@ -45,10 +45,10 @@ discard block |
||
| 45 | 45 | public function add_metabox() |
| 46 | 46 | { |
| 47 | 47 | $cl = $this; |
| 48 | - if (! isset($_GET['post']) || ! $this->hasTimeshifts($_GET['post'])) { |
|
| 48 | + if ( ! isset($_GET['post']) || ! $this->hasTimeshifts($_GET['post'])) { |
|
| 49 | 49 | return; |
| 50 | 50 | } |
| 51 | - add_action('add_meta_boxes', function () use ($cl) { |
|
| 51 | + add_action('add_meta_boxes', function() use ($cl) { |
|
| 52 | 52 | add_meta_box('krn-timeshift', __('Timeshift', 'kmm-timeshift'), [$cl, 'timeshift_metabox'], null, 'normal', 'core'); |
| 53 | 53 | }); |
| 54 | 54 | } |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | public function timeshift_metabox() |
| 57 | 57 | { |
| 58 | 58 | global $post; |
| 59 | - if (! isset($_GET['post'])) { |
|
| 59 | + if ( ! isset($_GET['post'])) { |
|
| 60 | 60 | return; |
| 61 | 61 | } |
| 62 | 62 | $prod_post = get_post($_GET['post']); |
@@ -123,11 +123,11 @@ discard block |
||
| 123 | 123 | |
| 124 | 124 | public function inject_metadata_timeshift($value, $post_id, $key, $single) |
| 125 | 125 | { |
| 126 | - if (! isset($_GET['timeshift'])) { |
|
| 126 | + if ( ! isset($_GET['timeshift'])) { |
|
| 127 | 127 | return; |
| 128 | 128 | } |
| 129 | 129 | //Load timeshift |
| 130 | - if (! $this->timeshift_cached_meta) { |
|
| 130 | + if ( ! $this->timeshift_cached_meta) { |
|
| 131 | 131 | $post_type = get_post_type($post_id); |
| 132 | 132 | $table_name = $this->wpdb->prefix . 'timeshift_' . $post_type; |
| 133 | 133 | $sql = "select * from $table_name where id=" . intval($_GET['timeshift']); |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | public function inject_timeshift($p) |
| 151 | 151 | { |
| 152 | 152 | global $post; |
| 153 | - if (! isset($_GET['timeshift'])) { |
|
| 153 | + if ( ! isset($_GET['timeshift'])) { |
|
| 154 | 154 | return; |
| 155 | 155 | } |
| 156 | 156 | //Load timeshift |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | { |
| 168 | 168 | add_action('edit_form_top', [$this, 'inject_timeshift'], 1, 1); |
| 169 | 169 | add_action('pre_post_update', [$this, 'pre_post_update'], 2, 1); |
| 170 | - add_action('admin_notices', function () { |
|
| 170 | + add_action('admin_notices', function() { |
|
| 171 | 171 | if (isset($_GET['timeshift']) && $_GET['timeshift']) { |
| 172 | 172 | echo '<div class="notice notice-warning is-dismissible"> |
| 173 | 173 | <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> |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | $mdata['_edit_last'][0] = $this->last_author; |
| 222 | 222 | unset($mdata['_edit_lock']); |
| 223 | 223 | |
| 224 | - $timeshift = (object) ['post' => $post, 'meta' => $mdata]; |
|
| 224 | + $timeshift = (object)['post' => $post, 'meta' => $mdata]; |
|
| 225 | 225 | $this->storeTimeshift($timeshift); |
| 226 | 226 | } |
| 227 | 227 | } |
@@ -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 | |