@@ -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; |
@@ -46,10 +46,10 @@ discard block |
||
| 46 | 46 | public function add_metabox() |
| 47 | 47 | { |
| 48 | 48 | $cl = $this; |
| 49 | - if (! isset($_GET['post']) || ! $this->hasTimeshifts($_GET['post'])) { |
|
| 49 | + if ( ! isset($_GET['post']) || ! $this->hasTimeshifts($_GET['post'])) { |
|
| 50 | 50 | return; |
| 51 | 51 | } |
| 52 | - add_action('add_meta_boxes', function () use ($cl) { |
|
| 52 | + add_action('add_meta_boxes', function() use ($cl) { |
|
| 53 | 53 | add_meta_box('krn-timeshift', __('Timeshift', 'kmm-timeshift'), [$cl, 'timeshift_metabox'], null, 'normal', 'core'); |
| 54 | 54 | }); |
| 55 | 55 | } |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | public function timeshift_metabox() |
| 58 | 58 | { |
| 59 | 59 | global $post; |
| 60 | - if (! isset($_GET['post'])) { |
|
| 60 | + if ( ! isset($_GET['post'])) { |
|
| 61 | 61 | return; |
| 62 | 62 | } |
| 63 | 63 | $table_name = $this->wpdb->prefix . 'timeshift_' . $post->post_type; |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | echo '<tr>'; |
| 70 | 70 | echo '<th width="40%" id="columnname" class="manage-column column-columnname" scope="col">' . __('Title', 'kmm-timeshift') . '</th>'; |
| 71 | 71 | echo '<th width="30%" id="columnname" class="manage-column column-columnname" scope="col">' . __('Snapshot Date', 'kmm-timeshift') . '</th>'; |
| 72 | - echo '<th width="10%" id="columnname" class="manage-column column-columnname" scope="col">' . __('Author', 'kmm-timeshift') . '</th>'; |
|
| 72 | + echo '<th width="10%" id="columnname" class="manage-column column-columnname" scope="col">' . __('Author', 'kmm-timeshift') . '</th>'; |
|
| 73 | 73 | echo '<th width="10%" id="columnname" class="manage-column column-columnname" scope="col">' . __('Actions', 'kmm-timeshift') . '</th>'; |
| 74 | 74 | echo '</tr>'; |
| 75 | 75 | echo ' </thead>'; |
@@ -108,11 +108,11 @@ discard block |
||
| 108 | 108 | |
| 109 | 109 | public function inject_metadata_timeshift($value, $post_id, $key, $single) |
| 110 | 110 | { |
| 111 | - if (! isset($_GET['timeshift'])) { |
|
| 111 | + if ( ! isset($_GET['timeshift'])) { |
|
| 112 | 112 | return; |
| 113 | 113 | } |
| 114 | 114 | //Load timeshift |
| 115 | - if (! $this->timeshift_cached_meta) { |
|
| 115 | + if ( ! $this->timeshift_cached_meta) { |
|
| 116 | 116 | $post_type = get_post_type($post_id); |
| 117 | 117 | $table_name = $this->wpdb->prefix . 'timeshift_' . $post_type; |
| 118 | 118 | $sql = "select * from $table_name where id=" . intval($_GET['timeshift']); |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | public function inject_timeshift($p) |
| 131 | 131 | { |
| 132 | 132 | global $post; |
| 133 | - if (! isset($_GET['timeshift'])) { |
|
| 133 | + if ( ! isset($_GET['timeshift'])) { |
|
| 134 | 134 | return; |
| 135 | 135 | } |
| 136 | 136 | //Load timeshift |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | { |
| 148 | 148 | add_action('edit_form_top', [$this, 'inject_timeshift'], 1, 1); |
| 149 | 149 | add_action('pre_post_update', [$this, 'pre_post_update'], 2, 1); |
| 150 | - add_action('admin_notices', function () { |
|
| 150 | + add_action('admin_notices', function() { |
|
| 151 | 151 | if (isset($_GET['timeshift']) && $_GET['timeshift']) { |
| 152 | 152 | echo '<div class="notice notice-warning is-dismissible"> |
| 153 | 153 | <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> |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | $mdata = get_metadata('post', $post_ID); |
| 196 | 196 | $post = get_post($post_ID); |
| 197 | 197 | |
| 198 | - $timeshift = (object) ['post' => $post, 'meta' => $mdata]; |
|
| 198 | + $timeshift = (object)['post' => $post, 'meta' => $mdata]; |
|
| 199 | 199 | $this->storeTimeshift($timeshift); |
| 200 | 200 | } |
| 201 | 201 | } |
@@ -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 | |