Duplicate Post - Version 4.1

Version Description

(2021-01-27) =

Enhancements:

  • Improves compatibility between Elementor and the Rewrite and Republish feature.

Bugfixes:

  • Fixes a bug where Rewrite & Republish notices would be shown for regular copies.
  • Fixes a bug where the original post of a Rewrite & Republish copy was listed in the Yoast SEO Premium link suggestions.

Other:

  • Disables the plugin for WooCommerce products and introduces filter for enabled post types.
Download this release

Release Info

Developer lopo
Plugin Icon 128x128 Duplicate Post
Version 4.1
Comparing to
See all releases

Code changes from version 4.0.2 to 4.1

duplicate-post-admin.php CHANGED
@@ -161,7 +161,7 @@ function duplicate_post_plugin_upgrade() {
161
  update_option( 'duplicate_post_blacklist', implode( ',', $meta_blacklist ) );
162
 
163
  delete_option( 'duplicate_post_show_notice' );
164
- if ( version_compare( $installed_version, '4.0.0' ) < 0 ) {
165
  update_site_option( 'duplicate_post_show_notice', 1 );
166
  }
167
 
@@ -222,10 +222,10 @@ function duplicate_post_show_update_notice() {
222
  __( "What's new in Yoast Duplicate Post version %s:", 'duplicate-post' ),
223
  DUPLICATE_POST_CURRENT_VERSION
224
  ) . '</strong> ';
225
- $message .= __( 'Meet the Rewrite & Republish feature! It makes it easy as ABC to update a post/page without taking it offline or having to take extra steps!', 'duplicate-post' )
226
  . ' ';
227
 
228
- $message .= '<a href="https://yoa.st/duplicate-post-4-0">'
229
  . sprintf(
230
  /* translators: %s: Yoast Duplicate Post version. */
231
  __( 'Read more about what’s new in Yoast Duplicate Post %s!', 'duplicate-post' ),
@@ -354,6 +354,8 @@ function duplicate_post_copy_post_meta_info( $new_id, $post ) {
354
  }
355
  $meta_blacklist[] = '_edit_lock'; // Edit lock.
356
  $meta_blacklist[] = '_edit_last'; // Edit lock.
 
 
357
  if ( intval( get_option( 'duplicate_post_copytemplate' ) ) === 0 ) {
358
  $meta_blacklist[] = '_wp_page_template';
359
  }
@@ -805,7 +807,7 @@ function duplicate_post_newsletter_signup_form() {
805
  <div class="response" id="mce-error-response" style="display:none"></div>
806
  <div class="response" id="mce-success-response" style="display:none"></div>
807
  </div> <!-- real people should not fill this in and expect good things - do not remove this or risk form bot signups-->
808
- <div style="position: absolute; left: -5000px;" aria-hidden="true"><input type="text" name="b_ffa93edfe21752c921f860358_972f1c9122" tabindex="-1" value=""></div>
809
  </div>
810
  </form>
811
  </div>
161
  update_option( 'duplicate_post_blacklist', implode( ',', $meta_blacklist ) );
162
 
163
  delete_option( 'duplicate_post_show_notice' );
164
+ if ( version_compare( $installed_version, '4.1.0' ) < 0 ) {
165
  update_site_option( 'duplicate_post_show_notice', 1 );
166
  }
167
 
222
  __( "What's new in Yoast Duplicate Post version %s:", 'duplicate-post' ),
223
  DUPLICATE_POST_CURRENT_VERSION
224
  ) . '</strong> ';
225
+ $message .= __( 'Now also available in Elementor: the powerful Rewrite & Republish feature. Updating your content has never been easier!', 'duplicate-post' )
226
  . ' ';
227
 
228
+ $message .= '<a href="https://yoa.st/duplicate-post-4-1">'
229
  . sprintf(
230
  /* translators: %s: Yoast Duplicate Post version. */
231
  __( 'Read more about what’s new in Yoast Duplicate Post %s!', 'duplicate-post' ),
354
  }
355
  $meta_blacklist[] = '_edit_lock'; // Edit lock.
356
  $meta_blacklist[] = '_edit_last'; // Edit lock.
357
+ $meta_blacklist[] = '_dp_is_rewrite_republish_copy';
358
+ $meta_blacklist[] = '_dp_has_rewrite_republish_copy';
359
  if ( intval( get_option( 'duplicate_post_copytemplate' ) ) === 0 ) {
360
  $meta_blacklist[] = '_wp_page_template';
361
  }
807
  <div class="response" id="mce-error-response" style="display:none"></div>
808
  <div class="response" id="mce-success-response" style="display:none"></div>
809
  </div> <!-- real people should not fill this in and expect good things - do not remove this or risk form bot signups-->
810
+ <div class="screen-reader-text" aria-hidden="true"><input type="text" name="b_ffa93edfe21752c921f860358_972f1c9122" tabindex="-1" value=""></div>
811
  </div>
812
  </form>
813
  </div>
duplicate-post.php CHANGED
@@ -2,8 +2,8 @@
2
  /**
3
  * Plugin Name: Yoast Duplicate Post
4
  * Plugin URI: https://yoast.com/wordpress/plugins/duplicate-post/
5
- * Description: The go-to tool for cloning post and pages, including easy Rewrite & Republish feature.
6
- * Version: 4.0.2
7
  * Author: Enrico Battocchi & Team Yoast
8
  * Author URI: https://yoast.com
9
  * Text Domain: duplicate-post
@@ -42,7 +42,7 @@ if ( ! defined( 'DUPLICATE_POST_PATH' ) ) {
42
  define( 'DUPLICATE_POST_PATH', plugin_dir_path( __FILE__ ) );
43
  }
44
 
45
- define( 'DUPLICATE_POST_CURRENT_VERSION', '4.0.2' );
46
 
47
  $duplicate_post_autoload_file = __DIR__ . '/vendor/autoload.php';
48
 
2
  /**
3
  * Plugin Name: Yoast Duplicate Post
4
  * Plugin URI: https://yoast.com/wordpress/plugins/duplicate-post/
5
+ * Description: The go-to tool for cloning posts and pages, including the powerful Rewrite & Republish feature.
6
+ * Version: 4.1
7
  * Author: Enrico Battocchi & Team Yoast
8
  * Author URI: https://yoast.com
9
  * Text Domain: duplicate-post
42
  define( 'DUPLICATE_POST_PATH', plugin_dir_path( __FILE__ ) );
43
  }
44
 
45
+ define( 'DUPLICATE_POST_CURRENT_VERSION', '4.1' );
46
 
47
  $duplicate_post_autoload_file = __DIR__ . '/vendor/autoload.php';
48
 
js/dist/{duplicate-post-edit-402.js → duplicate-post-edit-410.js} RENAMED
File without changes
js/dist/duplicate-post-elementor-410.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=11)}({11:function(e,t,n){"use strict";var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}();function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(){var e=function(e){function t(){return o(this,t),i(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments))}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,$e.modules.hookUI.After),r(t,[{key:"getCommand",value:function(){return"document/save/save"}},{key:"getConditions",value:function(e){return"publish"===e.status}},{key:"getId",value:function(){return"redirect-after-republish"}},{key:"apply",value:function(e){"publish"===e.status&&duplicatePost.originalEditURL&&window.location.assign(duplicatePost.originalEditURL)}}]),t}();$e.hooks.registerUIAfter(new e)}jQuery(window).on("elementor:init",(function(){window.elementor.on("panel:init",(function(){u(),"0"!==duplicatePost.rewriting&&elementor.getPanelView().footer.currentView.removeSubMenuItem("saver-options",{name:"save-template"})}))}))}});
js/dist/{duplicate-post-options-402.js → duplicate-post-options-410.js} RENAMED
File without changes
js/dist/{duplicate-post-quick-edit-402.js → duplicate-post-quick-edit-410.js} RENAMED
File without changes
js/dist/{duplicate-post-strings-402.js → duplicate-post-strings-410.js} RENAMED
File without changes
readme.txt CHANGED
@@ -4,12 +4,12 @@ Donate link: https://yoast.com/wordpress/plugins/duplicate-post/
4
  Tags: duplicate post, copy, clone
5
  Requires at least: 5.5
6
  Tested up to: 5.6
7
- Stable tag: 4.0.2
8
  Requires PHP: 5.6.20
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
12
- Copy posts of any type with a click!
13
 
14
  == Description ==
15
 
@@ -58,7 +58,7 @@ If it still doesn't work, maybe there is some kind of conflict with other plugin
58
 
59
  From version 3.0 the plugin's translations are managed by the WordPress.org platform and the plugin is shipped without language files, so first of all update translations under Dashboard->Updates.
60
 
61
- If Duplicate Post is still in English, or if there are some untraslated strings, you can help traslating to your language [here](https://translate.wordpress.org/projects/wp-plugins/duplicate-post): you only need a WordPress.org account.
62
 
63
  == Screenshots ==
64
 
@@ -151,6 +151,21 @@ New features and customization, WP 3.0 compatibility: you should upgrade if you
151
 
152
  == Changelog ==
153
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
154
  = 4.0.2 (2021-01-14) =
155
 
156
  Bugfixes:
4
  Tags: duplicate post, copy, clone
5
  Requires at least: 5.5
6
  Tested up to: 5.6
7
+ Stable tag: 4.1
8
  Requires PHP: 5.6.20
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
12
+ The go-to tool for cloning posts and pages, including the powerful Rewrite & Republish feature.
13
 
14
  == Description ==
15
 
58
 
59
  From version 3.0 the plugin's translations are managed by the WordPress.org platform and the plugin is shipped without language files, so first of all update translations under Dashboard->Updates.
60
 
61
+ If Duplicate Post is still in English, or if there are some untranslated strings, you can [help translating to your language](https://translate.wordpress.org/projects/wp-plugins/duplicate-post): you only need a WordPress.org account.
62
 
63
  == Screenshots ==
64
 
151
 
152
  == Changelog ==
153
 
154
+ = 4.1 (2021-01-27) =
155
+
156
+ Enhancements:
157
+
158
+ * Improves compatibility between Elementor and the Rewrite and Republish feature.
159
+
160
+ Bugfixes:
161
+
162
+ * Fixes a bug where Rewrite & Republish notices would be shown for regular copies.
163
+ * Fixes a bug where the original post of a Rewrite & Republish copy was listed in the Yoast SEO Premium link suggestions.
164
+
165
+ Other:
166
+
167
+ * Disables the plugin for WooCommerce products and introduces filter for enabled post types.
168
+
169
  = 4.0.2 (2021-01-14) =
170
 
171
  Bugfixes:
src/admin/class-options-form-generator.php CHANGED
@@ -223,12 +223,12 @@ class Options_Form_Generator {
223
  * @return string The generated post types list.
224
  */
225
  public function generate_post_types_list() {
226
- $post_types = \get_post_types( [ 'show_ui' => true ], 'objects' );
227
- $output = '';
 
228
 
229
  foreach ( $post_types as $post_type_object ) {
230
- if ( $post_type_object->name === 'attachment'
231
- || $post_type_object->name === 'wp_block' ) {
232
  continue;
233
  }
234
 
@@ -303,4 +303,22 @@ class Options_Form_Generator {
303
  }
304
  return \in_array( $post_type, $duplicate_post_types_enabled, true );
305
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
306
  }
223
  * @return string The generated post types list.
224
  */
225
  public function generate_post_types_list() {
226
+ $post_types = \get_post_types( [ 'show_ui' => true ], 'objects' );
227
+ $hidden_post_types = $this->get_hidden_post_types();
228
+ $output = '';
229
 
230
  foreach ( $post_types as $post_type_object ) {
231
+ if ( \in_array( $post_type_object->name, $hidden_post_types, true ) ) {
 
232
  continue;
233
  }
234
 
303
  }
304
  return \in_array( $post_type, $duplicate_post_types_enabled, true );
305
  }
306
+
307
+ /**
308
+ * Generates a list of post types that should be hidden from the options page.
309
+ *
310
+ * @return array The array of names of the post types to hide.
311
+ */
312
+ public function get_hidden_post_types() {
313
+ $hidden_post_types = [
314
+ 'attachment',
315
+ 'wp_block',
316
+ ];
317
+
318
+ if ( Utils::is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
319
+ $hidden_post_types[] = 'product';
320
+ }
321
+
322
+ return $hidden_post_types;
323
+ }
324
  }
src/class-permissions-helper.php CHANGED
@@ -19,12 +19,23 @@ class Permissions_Helper {
19
  * @return array The array of post types.
20
  */
21
  public function get_enabled_post_types() {
22
- $duplicate_post_types_enabled = \get_option( 'duplicate_post_types_enabled', [ 'post', 'page' ] );
23
- if ( ! \is_array( $duplicate_post_types_enabled ) ) {
24
- $duplicate_post_types_enabled = [ $duplicate_post_types_enabled ];
25
  }
26
 
27
- return $duplicate_post_types_enabled;
 
 
 
 
 
 
 
 
 
 
 
28
  }
29
 
30
  /**
@@ -217,8 +228,7 @@ class Permissions_Helper {
217
  public function should_rewrite_and_republish_be_allowed( \WP_Post $post ) {
218
  return $post->post_status === 'publish'
219
  && ! $this->is_rewrite_and_republish_copy( $post )
220
- && ! $this->has_rewrite_and_republish_copy( $post )
221
- && ! $this->is_elementor_active();
222
  }
223
 
224
  /**
@@ -271,26 +281,4 @@ class Permissions_Helper {
271
 
272
  return false;
273
  }
274
-
275
- /**
276
- * Determines if the Elementor plugin is active.
277
- *
278
- * We can't use is_plugin_active because this must be working on front end too.
279
- *
280
- * @return bool Whether the Elementor plugin is currently active.
281
- */
282
- public function is_elementor_active() {
283
- $plugin = 'elementor/elementor.php';
284
-
285
- if ( \in_array( $plugin, (array) \get_option( 'active_plugins', [] ), true ) ) {
286
- return true;
287
- }
288
-
289
- if ( ! \is_multisite() ) {
290
- return false;
291
- }
292
-
293
- $plugins = \get_site_option( 'active_sitewide_plugins' );
294
- return isset( $plugins[ $plugin ] );
295
- }
296
  }
19
  * @return array The array of post types.
20
  */
21
  public function get_enabled_post_types() {
22
+ $enabled_post_types = \get_option( 'duplicate_post_types_enabled', [ 'post', 'page' ] );
23
+ if ( ! \is_array( $enabled_post_types ) ) {
24
+ $enabled_post_types = [ $enabled_post_types ];
25
  }
26
 
27
+ if ( Utils::is_plugin_active( 'woocommerce/woocommerce.php' ) ) {
28
+ $enabled_post_types = \array_diff( $enabled_post_types, [ 'product' ] );
29
+ }
30
+
31
+ /**
32
+ * Filters the list of post types for which the plugin is enabled.
33
+ *
34
+ * @param array $enabled_post_types The array of post type names for which the plugin is enabled.
35
+ *
36
+ * @return array The filtered array of post types names.
37
+ */
38
+ return \apply_filters( 'duplicate_post_enabled_post_types', $enabled_post_types );
39
  }
40
 
41
  /**
228
  public function should_rewrite_and_republish_be_allowed( \WP_Post $post ) {
229
  return $post->post_status === 'publish'
230
  && ! $this->is_rewrite_and_republish_copy( $post )
231
+ && ! $this->has_rewrite_and_republish_copy( $post );
 
232
  }
233
 
234
  /**
281
 
282
  return false;
283
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
284
  }
src/class-post-duplicator.php CHANGED
@@ -243,11 +243,7 @@ class Post_Duplicator {
243
  if ( ! \is_array( $meta_excludelist ) ) {
244
  $meta_excludelist = [];
245
  }
246
- $meta_excludelist[] = '_edit_lock'; // Edit lock.
247
- $meta_excludelist[] = '_edit_last'; // Edit lock.
248
- $meta_excludelist[] = '_dp_original';
249
- $meta_excludelist[] = '_dp_is_rewrite_republish_copy';
250
- $meta_excludelist[] = '_dp_has_rewrite_republish_copy';
251
  if ( ! $options['copy_template'] ) {
252
  $meta_excludelist[] = '_wp_page_template';
253
  }
243
  if ( ! \is_array( $meta_excludelist ) ) {
244
  $meta_excludelist = [];
245
  }
246
+ $meta_excludelist = \array_merge( $meta_excludelist, Utils::get_default_filtered_meta_names() );
 
 
 
 
247
  if ( ! $options['copy_template'] ) {
248
  $meta_excludelist[] = '_wp_page_template';
249
  }
src/class-post-republisher.php CHANGED
@@ -106,6 +106,10 @@ class Post_Republisher {
106
  * @return array An array of slashed, sanitized, and processed attachment post data.
107
  */
108
  public function change_post_copy_status( $data, $postarr ) {
 
 
 
 
109
  $post = \get_post( $postarr['ID'] );
110
 
111
  if ( ! $post || ! $this->permissions_helper->is_rewrite_and_republish_copy( $post ) ) {
@@ -216,7 +220,11 @@ class Post_Republisher {
216
 
217
  \check_admin_referer( 'dp-republish', 'dpnonce' );
218
 
219
- $this->delete_copy( $copy_id, $post_id );
 
 
 
 
220
  }
221
  }
222
 
@@ -226,7 +234,7 @@ class Post_Republisher {
226
  * @return bool Whether the request is the Classic Editor POST request.
227
  */
228
  public function is_classic_editor_post_request() {
229
- if ( $this->is_rest_request() ) {
230
  return false;
231
  }
232
 
@@ -245,12 +253,12 @@ class Post_Republisher {
245
  /**
246
  * Republishes the post by overwriting the original post.
247
  *
248
- * @param \WP_Post $post The Rewrite & Republish copy.
249
- * @param \WP_Post $original_post The original post.
250
  *
251
  * @return void
252
  */
253
- public function republish( \WP_Post $post, $original_post ) {
254
  // Remove WordPress default filter so a new revision is not created on republish.
255
  \remove_action( 'post_updated', 'wp_save_post_revision', 10 );
256
 
@@ -261,6 +269,9 @@ class Post_Republisher {
261
  // Republish the post.
262
  $this->republish_post_elements( $post, $original_post );
263
 
 
 
 
264
  // Re-enable the creation of a new revision.
265
  \add_action( 'post_updated', 'wp_save_post_revision', 10, 1 );
266
  }
@@ -353,12 +364,7 @@ class Post_Republisher {
353
  $original_post_id = Utils::get_original_post_id( $post->ID );
354
 
355
  $copy_meta_options = [
356
- 'meta_excludelist' => [
357
- '_edit_lock',
358
- '_edit_last',
359
- '_dp_original',
360
- '_dp_is_rewrite_republish_copy',
361
- ],
362
  'use_filters' => false,
363
  'copy_thumbnail' => true,
364
  'copy_template' => true,
106
  * @return array An array of slashed, sanitized, and processed attachment post data.
107
  */
108
  public function change_post_copy_status( $data, $postarr ) {
109
+ if ( ! \array_key_exists( 'ID', $postarr ) || empty( $postarr['ID'] ) ) {
110
+ return $data;
111
+ }
112
+
113
  $post = \get_post( $postarr['ID'] );
114
 
115
  if ( ! $post || ! $this->permissions_helper->is_rewrite_and_republish_copy( $post ) ) {
220
 
221
  \check_admin_referer( 'dp-republish', 'dpnonce' );
222
 
223
+ if ( \intval( \get_post_meta( $copy_id, '_dp_has_been_republished', true ) ) === 1 ) {
224
+ $this->delete_copy( $copy_id, $post_id );
225
+ } else {
226
+ \wp_die( \esc_html__( 'An error occurred while deleting the Rewrite & Republish copy.', 'duplicate-post' ) );
227
+ }
228
  }
229
  }
230
 
234
  * @return bool Whether the request is the Classic Editor POST request.
235
  */
236
  public function is_classic_editor_post_request() {
237
+ if ( $this->is_rest_request() || \wp_doing_ajax() ) {
238
  return false;
239
  }
240
 
253
  /**
254
  * Republishes the post by overwriting the original post.
255
  *
256
+ * @param WP_Post $post The Rewrite & Republish copy.
257
+ * @param WP_Post $original_post The original post.
258
  *
259
  * @return void
260
  */
261
+ public function republish( WP_Post $post, WP_Post $original_post ) {
262
  // Remove WordPress default filter so a new revision is not created on republish.
263
  \remove_action( 'post_updated', 'wp_save_post_revision', 10 );
264
 
269
  // Republish the post.
270
  $this->republish_post_elements( $post, $original_post );
271
 
272
+ // Mark the copy as already published.
273
+ \update_post_meta( $post->ID, '_dp_has_been_republished', '1' );
274
+
275
  // Re-enable the creation of a new revision.
276
  \add_action( 'post_updated', 'wp_save_post_revision', 10, 1 );
277
  }
364
  $original_post_id = Utils::get_original_post_id( $post->ID );
365
 
366
  $copy_meta_options = [
367
+ 'meta_excludelist' => Utils::get_default_filtered_meta_names(),
 
 
 
 
 
368
  'use_filters' => false,
369
  'copy_thumbnail' => true,
370
  'copy_template' => true,
src/class-utils.php CHANGED
@@ -172,6 +172,23 @@ class Utils {
172
  return $wp_roles->get_names();
173
  }
174
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
175
  /**
176
  * Gets a Duplicate Post option from the database.
177
  *
@@ -193,4 +210,26 @@ class Utils {
193
 
194
  return $option[ $key ];
195
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
196
  }
172
  return $wp_roles->get_names();
173
  }
174
 
175
+ /**
176
+ * Gets the default meta field names to be filtered out.
177
+ *
178
+ * @return array The names of the meta fields to filter out by default.
179
+ */
180
+ public static function get_default_filtered_meta_names() {
181
+ return [
182
+ '_edit_lock',
183
+ '_edit_last',
184
+ '_dp_original',
185
+ '_dp_is_rewrite_republish_copy',
186
+ '_dp_has_rewrite_republish_copy',
187
+ '_dp_has_been_republished',
188
+ '_dp_creation_date_gmt',
189
+ ];
190
+ }
191
+
192
  /**
193
  * Gets a Duplicate Post option from the database.
194
  *
210
 
211
  return $option[ $key ];
212
  }
213
+
214
+ /**
215
+ * Determines if a plugin is active.
216
+ *
217
+ * We can't use is_plugin_active because this must work on the frontend too.
218
+ *
219
+ * @param string $plugin Path to the plugin file relative to the plugins directory.
220
+ *
221
+ * @return bool Whether a plugin is currently active.
222
+ */
223
+ public static function is_plugin_active( $plugin ) {
224
+ if ( \in_array( $plugin, (array) \get_option( 'active_plugins', [] ), true ) ) {
225
+ return true;
226
+ }
227
+
228
+ if ( ! \is_multisite() ) {
229
+ return false;
230
+ }
231
+
232
+ $plugins = \get_site_option( 'active_sitewide_plugins' );
233
+ return isset( $plugins[ $plugin ] );
234
+ }
235
  }
src/ui/class-asset-manager.php CHANGED
@@ -157,4 +157,30 @@ class Asset_Manager {
157
  public function enqueue_options_script() {
158
  \wp_enqueue_script( 'duplicate_post_options_script' );
159
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
160
  }
157
  public function enqueue_options_script() {
158
  \wp_enqueue_script( 'duplicate_post_options_script' );
159
  }
160
+
161
+ /**
162
+ * Enqueues the script for the Elementor plugin.
163
+ *
164
+ * @param array $object The object to pass to the script.
165
+ *
166
+ * @return void
167
+ */
168
+ public function enqueue_elementor_script( $object = [] ) {
169
+ $flattened_version = Utils::flatten_version( DUPLICATE_POST_CURRENT_VERSION );
170
+ $handle = 'duplicate_post_elementor_script';
171
+
172
+ \wp_register_script(
173
+ $handle,
174
+ \plugins_url( \sprintf( 'js/dist/duplicate-post-elementor-%s.js', $flattened_version ), DUPLICATE_POST_FILE ),
175
+ [ 'jquery' ],
176
+ DUPLICATE_POST_CURRENT_VERSION,
177
+ true
178
+ );
179
+ \wp_enqueue_script( $handle );
180
+ \wp_localize_script(
181
+ $handle,
182
+ 'duplicatePost',
183
+ $object
184
+ );
185
+ }
186
  }
src/ui/class-block-editor.php CHANGED
@@ -56,8 +56,44 @@ class Block_Editor {
56
  * @return void
57
  */
58
  public function register_hooks() {
 
 
59
  \add_action( 'admin_enqueue_scripts', [ $this, 'should_previously_used_keyword_assessment_run' ], 9 );
60
  \add_action( 'enqueue_block_editor_assets', [ $this, 'enqueue_block_editor_scripts' ] );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
61
  }
62
 
63
  /**
@@ -94,19 +130,10 @@ class Block_Editor {
94
  return;
95
  }
96
 
97
- $is_rewrite_and_republish_copy = $this->permissions_helper->is_rewrite_and_republish_copy( $post );
98
-
99
- $edit_js_object = [
100
- 'newDraftLink' => $this->get_new_draft_permalink(),
101
- 'rewriteAndRepublishLink' => $this->get_rewrite_republish_permalink(),
102
- 'showLinks' => Utils::get_option( 'duplicate_post_show_link' ),
103
- 'showLinksIn' => Utils::get_option( 'duplicate_post_show_link_in' ),
104
- 'rewriting' => $is_rewrite_and_republish_copy ? 1 : 0,
105
- 'originalEditURL' => $this->get_original_post_edit_url(),
106
- ];
107
  $this->asset_manager->enqueue_edit_script( $edit_js_object );
108
 
109
- if ( $is_rewrite_and_republish_copy ) {
110
  $string_js_object = [
111
  'checkLink' => $this->get_check_permalink(),
112
  ];
@@ -142,7 +169,6 @@ class Block_Editor {
142
  || $this->permissions_helper->is_rewrite_and_republish_copy( $post )
143
  || $this->permissions_helper->has_rewrite_and_republish_copy( $post )
144
  || ! $this->permissions_helper->should_links_be_displayed( $post )
145
- || $this->permissions_helper->is_elementor_active()
146
  ) {
147
  return '';
148
  }
@@ -192,4 +218,58 @@ class Block_Editor {
192
  \admin_url( 'post.php?action=edit&post=' . $original_post_id )
193
  );
194
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
195
  }
56
  * @return void
57
  */
58
  public function register_hooks() {
59
+ \add_action( 'elementor/editor/after_enqueue_styles', [ $this, 'hide_elementor_post_status' ] );
60
+ \add_action( 'elementor/editor/before_enqueue_scripts', [ $this, 'enqueue_elementor_script' ], 9 );
61
  \add_action( 'admin_enqueue_scripts', [ $this, 'should_previously_used_keyword_assessment_run' ], 9 );
62
  \add_action( 'enqueue_block_editor_assets', [ $this, 'enqueue_block_editor_scripts' ] );
63
+ \add_filter( 'wpseo_link_suggestions_indexables', [ $this, 'remove_original_from_wpseo_link_suggestions' ], 10, 3 );
64
+ }
65
+
66
+ /**
67
+ * Enqueues the necessary Elementor script for the current post.
68
+ *
69
+ * @return void
70
+ */
71
+ public function enqueue_elementor_script() {
72
+ $post = \get_post();
73
+
74
+ if ( ! $post instanceof WP_Post ) {
75
+ return;
76
+ }
77
+
78
+ $edit_js_object = $this->generate_js_object( $post );
79
+ $this->asset_manager->enqueue_elementor_script( $edit_js_object );
80
+ }
81
+
82
+ /**
83
+ * Hides the post status control if we're working on a Rewrite and Republish post.
84
+ *
85
+ * @return void
86
+ */
87
+ public function hide_elementor_post_status() {
88
+ $post = \get_post();
89
+
90
+ if ( ! $post instanceof WP_Post || ! $this->permissions_helper->is_rewrite_and_republish_copy( $post ) ) {
91
+ return;
92
+ }
93
+ \wp_add_inline_style(
94
+ 'elementor-editor',
95
+ '.elementor-control-post_status { display: none !important; }'
96
+ );
97
  }
98
 
99
  /**
130
  return;
131
  }
132
 
133
+ $edit_js_object = $this->generate_js_object( $post );
 
 
 
 
 
 
 
 
 
134
  $this->asset_manager->enqueue_edit_script( $edit_js_object );
135
 
136
+ if ( $this->permissions_helper->is_rewrite_and_republish_copy( $post ) ) {
137
  $string_js_object = [
138
  'checkLink' => $this->get_check_permalink(),
139
  ];
169
  || $this->permissions_helper->is_rewrite_and_republish_copy( $post )
170
  || $this->permissions_helper->has_rewrite_and_republish_copy( $post )
171
  || ! $this->permissions_helper->should_links_be_displayed( $post )
 
172
  ) {
173
  return '';
174
  }
218
  \admin_url( 'post.php?action=edit&post=' . $original_post_id )
219
  );
220
  }
221
+
222
+ /**
223
+ * Generates an array of data to be passed as a localization object to JavaScript.
224
+ *
225
+ * @param WP_Post $post The current post object.
226
+ *
227
+ * @return array The data to pass to JavaScript.
228
+ */
229
+ protected function generate_js_object( WP_Post $post ) {
230
+ $is_rewrite_and_republish_copy = $this->permissions_helper->is_rewrite_and_republish_copy( $post );
231
+
232
+ return [
233
+ 'newDraftLink' => $this->get_new_draft_permalink(),
234
+ 'rewriteAndRepublishLink' => $this->get_rewrite_republish_permalink(),
235
+ 'showLinks' => Utils::get_option( 'duplicate_post_show_link' ),
236
+ 'showLinksIn' => Utils::get_option( 'duplicate_post_show_link_in' ),
237
+ 'rewriting' => $is_rewrite_and_republish_copy ? 1 : 0,
238
+ 'originalEditURL' => $this->get_original_post_edit_url(),
239
+ ];
240
+ }
241
+
242
+ /**
243
+ * Filters the Yoast SEO Premium link suggestions.
244
+ *
245
+ * Removes the original post from the Yoast SEO Premium link suggestions
246
+ * displayed on the Rewrite & Republish copy.
247
+ *
248
+ * @param array $suggestions An array of suggestion indexables that can be filtered.
249
+ * @param int $object_id The object id for the current indexable.
250
+ * @param string $object_type The object type for the current indexable.
251
+ *
252
+ * @return array The filtered array of suggestion indexables.
253
+ */
254
+ public function remove_original_from_wpseo_link_suggestions( $suggestions, $object_id, $object_type ) {
255
+ if ( $object_type !== 'post' ) {
256
+ return $suggestions;
257
+ }
258
+
259
+ // WordPress get_post already checks if the passed ID is valid and returns null if it's not.
260
+ $post = \get_post( $object_id );
261
+
262
+ if ( ! $post instanceof WP_Post || ! $this->permissions_helper->is_rewrite_and_republish_copy( $post ) ) {
263
+ return $suggestions;
264
+ }
265
+
266
+ $original_post_id = Utils::get_original_post_id( $post->ID );
267
+
268
+ return \array_filter(
269
+ $suggestions,
270
+ function( $suggestion ) use ( $original_post_id ) {
271
+ return $suggestion->object_id !== $original_post_id;
272
+ }
273
+ );
274
+ }
275
  }
src/ui/class-bulk-actions.php CHANGED
@@ -76,8 +76,7 @@ class Bulk_Actions {
76
  }
77
 
78
  if ( ! $is_draft_or_trash
79
- && \intval( Utils::get_option( 'duplicate_post_show_link', 'rewrite_republish' ) ) === 1
80
- && ! $this->permissions_helper->is_elementor_active() ) {
81
  $bulk_actions['duplicate_post_bulk_rewrite_republish'] = \esc_html__( 'Rewrite & Republish', 'duplicate-post' );
82
  }
83
 
76
  }
77
 
78
  if ( ! $is_draft_or_trash
79
+ && \intval( Utils::get_option( 'duplicate_post_show_link', 'rewrite_republish' ) ) === 1 ) {
 
80
  $bulk_actions['duplicate_post_bulk_rewrite_republish'] = \esc_html__( 'Rewrite & Republish', 'duplicate-post' );
81
  }
82
 
src/ui/class-post-list.php DELETED
@@ -1,151 +0,0 @@
1
- <?php
2
- /**
3
- * Duplicate Post class to manage the post list.
4
- *
5
- * @package Duplicate_Post
6
- */
7
-
8
- namespace Yoast\WP\Duplicate_Post\UI;
9
-
10
- use Yoast\WP\Duplicate_Post\Permissions_Helper;
11
-
12
- /**
13
- * Represents the Post_List class.
14
- */
15
- class Post_List {
16
-
17
- /**
18
- * Holds the permissions helper.
19
- *
20
- * @var Permissions_Helper
21
- */
22
- protected $permissions_helper;
23
-
24
- /**
25
- * Holds the array of copy IDs.
26
- *
27
- * @var array
28
- */
29
- protected $copy_ids = [];
30
-
31
- /**
32
- * Initializes the class.
33
- *
34
- * @param Permissions_Helper $permissions_helper The Permissions helper object.
35
- */
36
- public function __construct( Permissions_Helper $permissions_helper ) {
37
- $this->permissions_helper = $permissions_helper;
38
- }
39
-
40
- /**
41
- * Adds hooks to integrate with WordPress.
42
- *
43
- * @return void
44
- */
45
- public function register_hooks() {
46
- \add_filter( 'parse_query', [ $this, 'filter_rewrite_and_republish_copies' ] );
47
- \add_filter( 'wp_count_posts', [ $this, 'filter_rewrite_and_republish_counts' ], 10, 2 );
48
- }
49
-
50
- /**
51
- * Filters out Rewrite & Republish copies from the post list when Elementor is active.
52
- *
53
- * @param \WP_Query $query The current WordPress query.
54
- *
55
- * @return \WP_Query The updated post WordPress query.
56
- */
57
- public function filter_rewrite_and_republish_copies( $query ) {
58
- if ( ! $this->should_filter() || ( $query instanceof \WP_Query === false ) ) {
59
- return $query;
60
- }
61
-
62
- $post_not_in = $query->get( 'post__not_in', [] );
63
- $post_not_in = array_merge( $post_not_in, \array_keys( $this->get_copy_ids( $query->get( 'post_type' ) ) ) );
64
-
65
- $query->set( 'post__not_in', $post_not_in );
66
-
67
- return $query;
68
- }
69
-
70
- /**
71
- * Filters out the Rewrite and Republish posts from the post counts.
72
- *
73
- * @param object $counts The current post counts.
74
- * @param string $post_type The post type.
75
- *
76
- * @return object The updated post counts.
77
- */
78
- public function filter_rewrite_and_republish_counts( $counts, $post_type ) {
79
- if ( ! $this->should_filter() ) {
80
- return $counts;
81
- }
82
-
83
- $copies = $this->get_copy_ids( $post_type );
84
-
85
- foreach ( $copies as $item ) {
86
- $status = $item->post_status;
87
- if ( \property_exists( $counts, $status ) ) {
88
- $counts->$status--;
89
- }
90
- }
91
-
92
- return $counts;
93
- }
94
-
95
- /**
96
- * Queries the database to get the IDs of all Rewrite and Republish copies.
97
- *
98
- * @param string $post_type The post type to fetch the copy IDs for.
99
- *
100
- * @return array The IDs of the copies.
101
- */
102
- protected function get_copy_ids( $post_type ) {
103
- global $wpdb;
104
-
105
- if ( empty( $post_type ) ) {
106
- return [];
107
- }
108
-
109
- if ( \array_key_exists( $post_type, $this->copy_ids ) ) {
110
- return $this->copy_ids[ $post_type ];
111
- }
112
-
113
- $this->copy_ids[ $post_type ] = [];
114
-
115
- $results = $wpdb->get_results(
116
- $wpdb->prepare(
117
- 'SELECT post_id, post_status FROM ' . $wpdb->postmeta . ' AS pm ' .
118
- 'JOIN ' . $wpdb->posts . ' AS p ON pm.post_id = p.ID ' .
119
- 'WHERE meta_key = %s AND post_type = %s',
120
- '_dp_is_rewrite_republish_copy',
121
- $post_type
122
- ),
123
- OBJECT_K
124
- );
125
-
126
- if ( \is_array( $results ) ) {
127
- $this->copy_ids[ $post_type ] = $results;
128
- }
129
-
130
- return $this->copy_ids[ $post_type ];
131
- }
132
-
133
- /**
134
- * Determines whether the filter should be applied.
135
- *
136
- * @return bool Whether the filter should be applied.
137
- */
138
- protected function should_filter() {
139
- if ( ! \is_admin() || ! \function_exists( '\get_current_screen' ) ) {
140
- return false;
141
- }
142
-
143
- $current_screen = \get_current_screen();
144
-
145
- if ( \is_null( $current_screen ) ) {
146
- return false;
147
- }
148
-
149
- return ( $current_screen->base === 'edit' && $this->permissions_helper->is_elementor_active() );
150
- }
151
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
src/ui/class-user-interface.php CHANGED
@@ -77,13 +77,6 @@ class User_Interface {
77
  */
78
  protected $column;
79
 
80
- /**
81
- * Post_List object.
82
- *
83
- * @var Post_List
84
- */
85
- protected $post_list;
86
-
87
  /**
88
  * Holds the object to create the action link to duplicate.
89
  *
@@ -115,7 +108,6 @@ class User_Interface {
115
  $this->column = new Column( $this->permissions_helper, $this->asset_manager );
116
  $this->metabox = new Metabox( $this->permissions_helper );
117
  $this->post_states = new Post_States( $this->permissions_helper );
118
- $this->post_list = new Post_List( $this->permissions_helper );
119
  $this->classic_editor = new Classic_Editor( $this->link_builder, $this->permissions_helper, $this->asset_manager );
120
  $this->row_actions = new Row_Actions( $this->link_builder, $this->permissions_helper );
121
 
@@ -125,7 +117,6 @@ class User_Interface {
125
  $this->column->register_hooks();
126
  $this->metabox->register_hooks();
127
  $this->post_states->register_hooks();
128
- $this->post_list->register_hooks();
129
  $this->classic_editor->register_hooks();
130
  $this->row_actions->register_hooks();
131
  }
77
  */
78
  protected $column;
79
 
 
 
 
 
 
 
 
80
  /**
81
  * Holds the object to create the action link to duplicate.
82
  *
108
  $this->column = new Column( $this->permissions_helper, $this->asset_manager );
109
  $this->metabox = new Metabox( $this->permissions_helper );
110
  $this->post_states = new Post_States( $this->permissions_helper );
 
111
  $this->classic_editor = new Classic_Editor( $this->link_builder, $this->permissions_helper, $this->asset_manager );
112
  $this->row_actions = new Row_Actions( $this->link_builder, $this->permissions_helper );
113
 
117
  $this->column->register_hooks();
118
  $this->metabox->register_hooks();
119
  $this->post_states->register_hooks();
 
120
  $this->classic_editor->register_hooks();
121
  $this->row_actions->register_hooks();
122
  }
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
- return ComposerAutoloaderInitbac46342df44ff7c7344b8e79f379de2::getLoader();
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInitedd91d310f2404dbd0a4f0e790496f5c::getLoader();
vendor/composer/InstalledVersions.php DELETED
@@ -1,281 +0,0 @@
1
- <?php
2
-
3
- namespace Composer;
4
-
5
- use Composer\Semver\VersionParser;
6
-
7
-
8
-
9
-
10
-
11
-
12
- class InstalledVersions
13
- {
14
- private static $installed = array (
15
- 'root' =>
16
- array (
17
- 'pretty_version' => 'dev-develop',
18
- 'version' => 'dev-develop',
19
- 'aliases' =>
20
- array (
21
- ),
22
- 'reference' => 'cb31584080dcfbce345ce9164a6d80beaf277ef8',
23
- 'name' => '__root__',
24
- ),
25
- 'versions' =>
26
- array (
27
- '__root__' =>
28
- array (
29
- 'pretty_version' => 'dev-develop',
30
- 'version' => 'dev-develop',
31
- 'aliases' =>
32
- array (
33
- ),
34
- 'reference' => 'cb31584080dcfbce345ce9164a6d80beaf277ef8',
35
- ),
36
- 'automattic/vipwpcs' =>
37
- array (
38
- 'pretty_version' => '2.2.0',
39
- 'version' => '2.2.0.0',
40
- 'aliases' =>
41
- array (
42
- ),
43
- 'reference' => '4d0612461232b313d06321f1501c3989bd6aecf9',
44
- ),
45
- 'dealerdirect/phpcodesniffer-composer-installer' =>
46
- array (
47
- 'pretty_version' => 'v0.7.0',
48
- 'version' => '0.7.0.0',
49
- 'aliases' =>
50
- array (
51
- ),
52
- 'reference' => 'e8d808670b8f882188368faaf1144448c169c0b7',
53
- ),
54
- 'phpcompatibility/php-compatibility' =>
55
- array (
56
- 'pretty_version' => '9.3.5',
57
- 'version' => '9.3.5.0',
58
- 'aliases' =>
59
- array (
60
- ),
61
- 'reference' => '9fb324479acf6f39452e0655d2429cc0d3914243',
62
- ),
63
- 'phpcompatibility/phpcompatibility-paragonie' =>
64
- array (
65
- 'pretty_version' => '1.3.0',
66
- 'version' => '1.3.0.0',
67
- 'aliases' =>
68
- array (
69
- ),
70
- 'reference' => 'b862bc32f7e860d0b164b199bd995e690b4b191c',
71
- ),
72
- 'phpcompatibility/phpcompatibility-wp' =>
73
- array (
74
- 'pretty_version' => '2.1.0',
75
- 'version' => '2.1.0.0',
76
- 'aliases' =>
77
- array (
78
- ),
79
- 'reference' => '41bef18ba688af638b7310666db28e1ea9158b2f',
80
- ),
81
- 'sirbrillig/phpcs-variable-analysis' =>
82
- array (
83
- 'pretty_version' => 'v2.9.0',
84
- 'version' => '2.9.0.0',
85
- 'aliases' =>
86
- array (
87
- ),
88
- 'reference' => 'ff54d4ec7f2bd152d526fdabfeff639aa9b8be01',
89
- ),
90
- 'squizlabs/php_codesniffer' =>
91
- array (
92
- 'pretty_version' => '3.5.8',
93
- 'version' => '3.5.8.0',
94
- 'aliases' =>
95
- array (
96
- ),
97
- 'reference' => '9d583721a7157ee997f235f327de038e7ea6dac4',
98
- ),
99
- 'wp-coding-standards/wpcs' =>
100
- array (
101
- 'pretty_version' => '2.3.0',
102
- 'version' => '2.3.0.0',
103
- 'aliases' =>
104
- array (
105
- ),
106
- 'reference' => '7da1894633f168fe244afc6de00d141f27517b62',
107
- ),
108
- ),
109
- );
110
-
111
-
112
-
113
-
114
-
115
-
116
-
117
- public static function getInstalledPackages()
118
- {
119
- return array_keys(self::$installed['versions']);
120
- }
121
-
122
-
123
-
124
-
125
-
126
-
127
-
128
-
129
-
130
- public static function isInstalled($packageName)
131
- {
132
- return isset(self::$installed['versions'][$packageName]);
133
- }
134
-
135
-
136
-
137
-
138
-
139
-
140
-
141
-
142
-
143
-
144
-
145
-
146
-
147
-
148
- public static function satisfies(VersionParser $parser, $packageName, $constraint)
149
- {
150
- $constraint = $parser->parseConstraints($constraint);
151
- $provided = $parser->parseConstraints(self::getVersionRanges($packageName));
152
-
153
- return $provided->matches($constraint);
154
- }
155
-
156
-
157
-
158
-
159
-
160
-
161
-
162
-
163
-
164
-
165
- public static function getVersionRanges($packageName)
166
- {
167
- if (!isset(self::$installed['versions'][$packageName])) {
168
- throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
169
- }
170
-
171
- $ranges = array();
172
- if (isset(self::$installed['versions'][$packageName]['pretty_version'])) {
173
- $ranges[] = self::$installed['versions'][$packageName]['pretty_version'];
174
- }
175
- if (array_key_exists('aliases', self::$installed['versions'][$packageName])) {
176
- $ranges = array_merge($ranges, self::$installed['versions'][$packageName]['aliases']);
177
- }
178
- if (array_key_exists('replaced', self::$installed['versions'][$packageName])) {
179
- $ranges = array_merge($ranges, self::$installed['versions'][$packageName]['replaced']);
180
- }
181
- if (array_key_exists('provided', self::$installed['versions'][$packageName])) {
182
- $ranges = array_merge($ranges, self::$installed['versions'][$packageName]['provided']);
183
- }
184
-
185
- return implode(' || ', $ranges);
186
- }
187
-
188
-
189
-
190
-
191
-
192
- public static function getVersion($packageName)
193
- {
194
- if (!isset(self::$installed['versions'][$packageName])) {
195
- throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
196
- }
197
-
198
- if (!isset(self::$installed['versions'][$packageName]['version'])) {
199
- return null;
200
- }
201
-
202
- return self::$installed['versions'][$packageName]['version'];
203
- }
204
-
205
-
206
-
207
-
208
-
209
- public static function getPrettyVersion($packageName)
210
- {
211
- if (!isset(self::$installed['versions'][$packageName])) {
212
- throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
213
- }
214
-
215
- if (!isset(self::$installed['versions'][$packageName]['pretty_version'])) {
216
- return null;
217
- }
218
-
219
- return self::$installed['versions'][$packageName]['pretty_version'];
220
- }
221
-
222
-
223
-
224
-
225
-
226
- public static function getReference($packageName)
227
- {
228
- if (!isset(self::$installed['versions'][$packageName])) {
229
- throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
230
- }
231
-
232
- if (!isset(self::$installed['versions'][$packageName]['reference'])) {
233
- return null;
234
- }
235
-
236
- return self::$installed['versions'][$packageName]['reference'];
237
- }
238
-
239
-
240
-
241
-
242
-
243
- public static function getRootPackage()
244
- {
245
- return self::$installed['root'];
246
- }
247
-
248
-
249
-
250
-
251
-
252
-
253
-
254
- public static function getRawData()
255
- {
256
- return self::$installed;
257
- }
258
-
259
-
260
-
261
-
262
-
263
-
264
-
265
-
266
-
267
-
268
-
269
-
270
-
271
-
272
-
273
-
274
-
275
-
276
-
277
- public static function reload($data)
278
- {
279
- self::$installed = $data;
280
- }
281
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/composer/autoload_classmap.php CHANGED
@@ -28,7 +28,6 @@ return array(
28
  'Yoast\\WP\\Duplicate_Post\\UI\\Column' => $baseDir . '/src/ui/class-column.php',
29
  'Yoast\\WP\\Duplicate_Post\\UI\\Link_Builder' => $baseDir . '/src/ui/class-link-builder.php',
30
  'Yoast\\WP\\Duplicate_Post\\UI\\Metabox' => $baseDir . '/src/ui/class-metabox.php',
31
- 'Yoast\\WP\\Duplicate_Post\\UI\\Post_List' => $baseDir . '/src/ui/class-post-list.php',
32
  'Yoast\\WP\\Duplicate_Post\\UI\\Post_States' => $baseDir . '/src/ui/class-post-states.php',
33
  'Yoast\\WP\\Duplicate_Post\\UI\\Row_Actions' => $baseDir . '/src/ui/class-row-actions.php',
34
  'Yoast\\WP\\Duplicate_Post\\UI\\User_Interface' => $baseDir . '/src/ui/class-user-interface.php',
28
  'Yoast\\WP\\Duplicate_Post\\UI\\Column' => $baseDir . '/src/ui/class-column.php',
29
  'Yoast\\WP\\Duplicate_Post\\UI\\Link_Builder' => $baseDir . '/src/ui/class-link-builder.php',
30
  'Yoast\\WP\\Duplicate_Post\\UI\\Metabox' => $baseDir . '/src/ui/class-metabox.php',
 
31
  'Yoast\\WP\\Duplicate_Post\\UI\\Post_States' => $baseDir . '/src/ui/class-post-states.php',
32
  'Yoast\\WP\\Duplicate_Post\\UI\\Row_Actions' => $baseDir . '/src/ui/class-row-actions.php',
33
  'Yoast\\WP\\Duplicate_Post\\UI\\User_Interface' => $baseDir . '/src/ui/class-user-interface.php',
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInitbac46342df44ff7c7344b8e79f379de2
6
  {
7
  private static $loader;
8
 
@@ -22,15 +22,15 @@ class ComposerAutoloaderInitbac46342df44ff7c7344b8e79f379de2
22
  return self::$loader;
23
  }
24
 
25
- spl_autoload_register(array('ComposerAutoloaderInitbac46342df44ff7c7344b8e79f379de2', 'loadClassLoader'), true, true);
26
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
27
- spl_autoload_unregister(array('ComposerAutoloaderInitbac46342df44ff7c7344b8e79f379de2', 'loadClassLoader'));
28
 
29
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
30
  if ($useStaticLoader) {
31
  require_once __DIR__ . '/autoload_static.php';
32
 
33
- call_user_func(\Composer\Autoload\ComposerStaticInitbac46342df44ff7c7344b8e79f379de2::getInitializer($loader));
34
  } else {
35
  $map = require __DIR__ . '/autoload_namespaces.php';
36
  foreach ($map as $namespace => $path) {
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInitedd91d310f2404dbd0a4f0e790496f5c
6
  {
7
  private static $loader;
8
 
22
  return self::$loader;
23
  }
24
 
25
+ spl_autoload_register(array('ComposerAutoloaderInitedd91d310f2404dbd0a4f0e790496f5c', 'loadClassLoader'), true, true);
26
  self::$loader = $loader = new \Composer\Autoload\ClassLoader();
27
+ spl_autoload_unregister(array('ComposerAutoloaderInitedd91d310f2404dbd0a4f0e790496f5c', 'loadClassLoader'));
28
 
29
  $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
30
  if ($useStaticLoader) {
31
  require_once __DIR__ . '/autoload_static.php';
32
 
33
+ call_user_func(\Composer\Autoload\ComposerStaticInitedd91d310f2404dbd0a4f0e790496f5c::getInitializer($loader));
34
  } else {
35
  $map = require __DIR__ . '/autoload_namespaces.php';
36
  foreach ($map as $namespace => $path) {
vendor/composer/autoload_static.php CHANGED
@@ -4,7 +4,7 @@
4
 
5
  namespace Composer\Autoload;
6
 
7
- class ComposerStaticInitbac46342df44ff7c7344b8e79f379de2
8
  {
9
  public static $classMap = array (
10
  'Yoast\\WP\\Duplicate_Post\\Admin\\Options' => __DIR__ . '/../..' . '/src/admin/class-options.php',
@@ -29,7 +29,6 @@ class ComposerStaticInitbac46342df44ff7c7344b8e79f379de2
29
  'Yoast\\WP\\Duplicate_Post\\UI\\Column' => __DIR__ . '/../..' . '/src/ui/class-column.php',
30
  'Yoast\\WP\\Duplicate_Post\\UI\\Link_Builder' => __DIR__ . '/../..' . '/src/ui/class-link-builder.php',
31
  'Yoast\\WP\\Duplicate_Post\\UI\\Metabox' => __DIR__ . '/../..' . '/src/ui/class-metabox.php',
32
- 'Yoast\\WP\\Duplicate_Post\\UI\\Post_List' => __DIR__ . '/../..' . '/src/ui/class-post-list.php',
33
  'Yoast\\WP\\Duplicate_Post\\UI\\Post_States' => __DIR__ . '/../..' . '/src/ui/class-post-states.php',
34
  'Yoast\\WP\\Duplicate_Post\\UI\\Row_Actions' => __DIR__ . '/../..' . '/src/ui/class-row-actions.php',
35
  'Yoast\\WP\\Duplicate_Post\\UI\\User_Interface' => __DIR__ . '/../..' . '/src/ui/class-user-interface.php',
@@ -45,7 +44,7 @@ class ComposerStaticInitbac46342df44ff7c7344b8e79f379de2
45
  public static function getInitializer(ClassLoader $loader)
46
  {
47
  return \Closure::bind(function () use ($loader) {
48
- $loader->classMap = ComposerStaticInitbac46342df44ff7c7344b8e79f379de2::$classMap;
49
 
50
  }, null, ClassLoader::class);
51
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInitedd91d310f2404dbd0a4f0e790496f5c
8
  {
9
  public static $classMap = array (
10
  'Yoast\\WP\\Duplicate_Post\\Admin\\Options' => __DIR__ . '/../..' . '/src/admin/class-options.php',
29
  'Yoast\\WP\\Duplicate_Post\\UI\\Column' => __DIR__ . '/../..' . '/src/ui/class-column.php',
30
  'Yoast\\WP\\Duplicate_Post\\UI\\Link_Builder' => __DIR__ . '/../..' . '/src/ui/class-link-builder.php',
31
  'Yoast\\WP\\Duplicate_Post\\UI\\Metabox' => __DIR__ . '/../..' . '/src/ui/class-metabox.php',
 
32
  'Yoast\\WP\\Duplicate_Post\\UI\\Post_States' => __DIR__ . '/../..' . '/src/ui/class-post-states.php',
33
  'Yoast\\WP\\Duplicate_Post\\UI\\Row_Actions' => __DIR__ . '/../..' . '/src/ui/class-row-actions.php',
34
  'Yoast\\WP\\Duplicate_Post\\UI\\User_Interface' => __DIR__ . '/../..' . '/src/ui/class-user-interface.php',
44
  public static function getInitializer(ClassLoader $loader)
45
  {
46
  return \Closure::bind(function () use ($loader) {
47
+ $loader->classMap = ComposerStaticInitedd91d310f2404dbd0a4f0e790496f5c::$classMap;
48
 
49
  }, null, ClassLoader::class);
50
  }
vendor/composer/installed.php DELETED
@@ -1,96 +0,0 @@
1
- <?php return array (
2
- 'root' =>
3
- array (
4
- 'pretty_version' => 'dev-develop',
5
- 'version' => 'dev-develop',
6
- 'aliases' =>
7
- array (
8
- ),
9
- 'reference' => 'cb31584080dcfbce345ce9164a6d80beaf277ef8',
10
- 'name' => '__root__',
11
- ),
12
- 'versions' =>
13
- array (
14
- '__root__' =>
15
- array (
16
- 'pretty_version' => 'dev-develop',
17
- 'version' => 'dev-develop',
18
- 'aliases' =>
19
- array (
20
- ),
21
- 'reference' => 'cb31584080dcfbce345ce9164a6d80beaf277ef8',
22
- ),
23
- 'automattic/vipwpcs' =>
24
- array (
25
- 'pretty_version' => '2.2.0',
26
- 'version' => '2.2.0.0',
27
- 'aliases' =>
28
- array (
29
- ),
30
- 'reference' => '4d0612461232b313d06321f1501c3989bd6aecf9',
31
- ),
32
- 'dealerdirect/phpcodesniffer-composer-installer' =>
33
- array (
34
- 'pretty_version' => 'v0.7.0',
35
- 'version' => '0.7.0.0',
36
- 'aliases' =>
37
- array (
38
- ),
39
- 'reference' => 'e8d808670b8f882188368faaf1144448c169c0b7',
40
- ),
41
- 'phpcompatibility/php-compatibility' =>
42
- array (
43
- 'pretty_version' => '9.3.5',
44
- 'version' => '9.3.5.0',
45
- 'aliases' =>
46
- array (
47
- ),
48
- 'reference' => '9fb324479acf6f39452e0655d2429cc0d3914243',
49
- ),
50
- 'phpcompatibility/phpcompatibility-paragonie' =>
51
- array (
52
- 'pretty_version' => '1.3.0',
53
- 'version' => '1.3.0.0',
54
- 'aliases' =>
55
- array (
56
- ),
57
- 'reference' => 'b862bc32f7e860d0b164b199bd995e690b4b191c',
58
- ),
59
- 'phpcompatibility/phpcompatibility-wp' =>
60
- array (
61
- 'pretty_version' => '2.1.0',
62
- 'version' => '2.1.0.0',
63
- 'aliases' =>
64
- array (
65
- ),
66
- 'reference' => '41bef18ba688af638b7310666db28e1ea9158b2f',
67
- ),
68
- 'sirbrillig/phpcs-variable-analysis' =>
69
- array (
70
- 'pretty_version' => 'v2.9.0',
71
- 'version' => '2.9.0.0',
72
- 'aliases' =>
73
- array (
74
- ),
75
- 'reference' => 'ff54d4ec7f2bd152d526fdabfeff639aa9b8be01',
76
- ),
77
- 'squizlabs/php_codesniffer' =>
78
- array (
79
- 'pretty_version' => '3.5.8',
80
- 'version' => '3.5.8.0',
81
- 'aliases' =>
82
- array (
83
- ),
84
- 'reference' => '9d583721a7157ee997f235f327de038e7ea6dac4',
85
- ),
86
- 'wp-coding-standards/wpcs' =>
87
- array (
88
- 'pretty_version' => '2.3.0',
89
- 'version' => '2.3.0.0',
90
- 'aliases' =>
91
- array (
92
- ),
93
- 'reference' => '7da1894633f168fe244afc6de00d141f27517b62',
94
- ),
95
- ),
96
- );