Duplicate Post - Version 4.1.2

Version Description

(2021-03-23) =

Enhancements:

  • Allows plugins such as ACF to add fields to the "Compare changes" screen for Rewrite & Republish.

Bugfixes:

  • Fixes a bug where the "Compare changes" screen for the Rewrite & Republish feature displayed a broken layout in WordPress 5.7.
  • Fixes a bug where a post type enabled by filter couldn't be copied.
  • Fixes a bug where the "Show links in" settings were reset to the default value on version upgrade.
Download this release

Release Info

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

Code changes from version 4.1.1 to 4.1.2

duplicate-post-admin.php CHANGED
@@ -165,8 +165,10 @@ function duplicate_post_plugin_upgrade() {
165
  update_site_option( 'duplicate_post_show_notice', 1 );
166
  }
167
 
168
- // Migrate the 'Show links in' options to the new array-based structure.
169
- duplicate_post_migrate_show_links_in_options( $show_links_in_defaults );
 
 
170
 
171
  delete_site_option( 'duplicate_post_version' );
172
  update_option( 'duplicate_post_version', duplicate_post_get_current_version() );
165
  update_site_option( 'duplicate_post_show_notice', 1 );
166
  }
167
 
168
+ if ( version_compare( $installed_version, '4.0.0' ) < 0 ) {
169
+ // Migrate the 'Show links in' options to the new array-based structure.
170
+ duplicate_post_migrate_show_links_in_options( $show_links_in_defaults );
171
+ }
172
 
173
  delete_site_option( 'duplicate_post_version' );
174
  update_option( 'duplicate_post_version', duplicate_post_get_current_version() );
duplicate-post-common.php CHANGED
@@ -21,6 +21,8 @@ function duplicate_post_is_post_type_enabled( $post_type ) {
21
  if ( ! is_array( $duplicate_post_types_enabled ) ) {
22
  $duplicate_post_types_enabled = array( $duplicate_post_types_enabled );
23
  }
 
 
24
  return in_array( $post_type, $duplicate_post_types_enabled, true );
25
  }
26
 
21
  if ( ! is_array( $duplicate_post_types_enabled ) ) {
22
  $duplicate_post_types_enabled = array( $duplicate_post_types_enabled );
23
  }
24
+ /** This filter is documented in src/class-permissions-helper.php */
25
+ $duplicate_post_types_enabled = apply_filters( 'duplicate_post_enabled_post_types', $duplicate_post_types_enabled );
26
  return in_array( $post_type, $duplicate_post_types_enabled, true );
27
  }
28
 
duplicate-post.php CHANGED
@@ -3,7 +3,7 @@
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.1
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.1.1' );
46
 
47
  $duplicate_post_autoload_file = __DIR__ . '/vendor/autoload.php';
48
 
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.2
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.2' );
46
 
47
  $duplicate_post_autoload_file = __DIR__ . '/vendor/autoload.php';
48
 
js/dist/{duplicate-post-edit-411.js → duplicate-post-edit-412.js} RENAMED
File without changes
js/dist/{duplicate-post-elementor-411.js → duplicate-post-elementor-412.js} RENAMED
File without changes
js/dist/{duplicate-post-options-411.js → duplicate-post-options-412.js} RENAMED
File without changes
js/dist/{duplicate-post-quick-edit-411.js → duplicate-post-quick-edit-412.js} RENAMED
File without changes
js/dist/{duplicate-post-strings-411.js → duplicate-post-strings-412.js} RENAMED
File without changes
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: yoast, lopo
3
  Donate link: https://yoast.com/wordpress/plugins/duplicate-post/
4
  Tags: duplicate post, copy, clone
5
  Requires at least: 5.6
6
- Tested up to: 5.7
7
- Stable tag: 4.1.1
8
  Requires PHP: 5.6.20
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -151,6 +151,18 @@ New features and customization, WP 3.0 compatibility: you should upgrade if you
151
 
152
  == Changelog ==
153
 
 
 
 
 
 
 
 
 
 
 
 
 
154
  = 4.1.1 (2021-01-27) =
155
 
156
  Bugfixes:
@@ -378,5 +390,5 @@ Enhancements:
378
 
379
  If you find this useful and if you want to contribute, there are two ways:
380
 
381
- 1. Submit your bug reports, suggestions and requests for features on GitHub;
382
  2. If you want to translate it to your language (there are just a few lines of text), you can use the [translation project](https://translate.wordpress.org/projects/wp-plugins/duplicate-post);
3
  Donate link: https://yoast.com/wordpress/plugins/duplicate-post/
4
  Tags: duplicate post, copy, clone
5
  Requires at least: 5.6
6
+ Tested up to: 5.8
7
+ Stable tag: 4.1.2
8
  Requires PHP: 5.6.20
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
151
 
152
  == Changelog ==
153
 
154
+ = 4.1.2 (2021-03-23) =
155
+
156
+ Enhancements:
157
+
158
+ * Allows plugins such as ACF to add fields to the "Compare changes" screen for Rewrite & Republish.
159
+
160
+ Bugfixes:
161
+
162
+ * Fixes a bug where the "Compare changes" screen for the Rewrite & Republish feature displayed a broken layout in WordPress 5.7.
163
+ * Fixes a bug where a post type enabled by filter couldn't be copied.
164
+ * Fixes a bug where the "Show links in" settings were reset to the default value on version upgrade.
165
+
166
  = 4.1.1 (2021-01-27) =
167
 
168
  Bugfixes:
390
 
391
  If you find this useful and if you want to contribute, there are two ways:
392
 
393
+ 1. Submit your bug reports, suggestions and requests for features on [GitHub](https://github.com/Yoast/duplicate-post);
394
  2. If you want to translate it to your language (there are just a few lines of text), you can use the [translation project](https://translate.wordpress.org/projects/wp-plugins/duplicate-post);
src/handlers/class-check-changes-handler.php CHANGED
@@ -23,6 +23,20 @@ class Check_Changes_Handler {
23
  */
24
  protected $permissions_helper;
25
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  /**
27
  * Initializes the class.
28
  *
@@ -47,6 +61,8 @@ class Check_Changes_Handler {
47
  * @return void
48
  */
49
  public function check_changes_action_handler() {
 
 
50
  if ( ! ( isset( $_GET['post'] ) || isset( $_POST['post'] ) || // Input var okay.
51
  ( isset( $_REQUEST['action'] ) && 'duplicate_post_check_changes' === $_REQUEST['action'] ) ) ) { // Input var okay.
52
  \wp_die(
@@ -59,9 +75,9 @@ class Check_Changes_Handler {
59
 
60
  \check_admin_referer( 'duplicate_post_check_changes_' . $id ); // Input var okay.
61
 
62
- $post = \get_post( $id );
63
 
64
- if ( ! $post ) {
65
  \wp_die(
66
  \esc_html(
67
  \sprintf(
@@ -74,9 +90,9 @@ class Check_Changes_Handler {
74
  return;
75
  }
76
 
77
- $original = Utils::get_original( $post );
78
 
79
- if ( ! $original ) {
80
  \wp_die(
81
  \esc_html(
82
  \__( 'Changes overview failed, could not find original post.', 'duplicate-post' )
@@ -84,7 +100,7 @@ class Check_Changes_Handler {
84
  );
85
  return;
86
  }
87
- $post_edit_link = \get_edit_post_link( $post->ID );
88
 
89
  $this->require_wordpress_header();
90
  ?>
@@ -94,7 +110,7 @@ class Check_Changes_Handler {
94
  echo \sprintf(
95
  /* translators: %s: original item link (to view or edit) or title. */
96
  \esc_html__( 'Compare changes of duplicated post with the original (&#8220;%s&#8221;)', 'duplicate-post' ),
97
- Utils::get_edit_or_view_link( $original ) // phpcs:ignore WordPress.Security.EscapeOutput
98
  );
99
  ?>
100
  </h1>
@@ -108,18 +124,42 @@ class Check_Changes_Handler {
108
  <div class="diff">
109
  <?php
110
  $fields = [
111
- \__( 'Title', 'default' ) => 'post_title',
112
- \__( 'Content', 'default' ) => 'post_content',
113
- \__( 'Excerpt', 'default' ) => 'post_excerpt',
114
  ];
115
 
116
- foreach ( $fields as $name => $field ) {
117
- $diff = \wp_text_diff( $original->$field, $post->$field );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
118
 
119
  if ( ! $diff && 'post_title' === $field ) {
120
  // It's a better user experience to still show the Title, even if it didn't change.
121
  $diff = '<table class="diff"><colgroup><col class="content diffsplit left"><col class="content diffsplit middle"><col class="content diffsplit right"></colgroup><tbody><tr>';
122
- $diff .= '<td>' . \esc_html( $original->post_title ) . '</td><td></td><td>' . \esc_html( $post->post_title ) . '</td>';
123
  $diff .= '</tr></tbody>';
124
  $diff .= '</table>';
125
  }
@@ -150,6 +190,10 @@ class Check_Changes_Handler {
150
  * @return void
151
  */
152
  public function require_wordpress_header() {
 
 
 
 
153
  require_once ABSPATH . 'wp-admin/admin-header.php';
154
  }
155
 
23
  */
24
  protected $permissions_helper;
25
 
26
+ /**
27
+ * Holds the current post object.
28
+ *
29
+ * @var \WP_Post
30
+ */
31
+ private $post;
32
+
33
+ /**
34
+ * Holds the original post object.
35
+ *
36
+ * @var \WP_Post
37
+ */
38
+ private $original;
39
+
40
  /**
41
  * Initializes the class.
42
  *
61
  * @return void
62
  */
63
  public function check_changes_action_handler() {
64
+ global $wp_version;
65
+
66
  if ( ! ( isset( $_GET['post'] ) || isset( $_POST['post'] ) || // Input var okay.
67
  ( isset( $_REQUEST['action'] ) && 'duplicate_post_check_changes' === $_REQUEST['action'] ) ) ) { // Input var okay.
68
  \wp_die(
75
 
76
  \check_admin_referer( 'duplicate_post_check_changes_' . $id ); // Input var okay.
77
 
78
+ $this->post = \get_post( $id );
79
 
80
+ if ( ! $this->post ) {
81
  \wp_die(
82
  \esc_html(
83
  \sprintf(
90
  return;
91
  }
92
 
93
+ $this->original = Utils::get_original( $this->post );
94
 
95
+ if ( ! $this->original ) {
96
  \wp_die(
97
  \esc_html(
98
  \__( 'Changes overview failed, could not find original post.', 'duplicate-post' )
100
  );
101
  return;
102
  }
103
+ $post_edit_link = \get_edit_post_link( $this->post->ID );
104
 
105
  $this->require_wordpress_header();
106
  ?>
110
  echo \sprintf(
111
  /* translators: %s: original item link (to view or edit) or title. */
112
  \esc_html__( 'Compare changes of duplicated post with the original (&#8220;%s&#8221;)', 'duplicate-post' ),
113
+ Utils::get_edit_or_view_link( $this->original ) // phpcs:ignore WordPress.Security.EscapeOutput
114
  );
115
  ?>
116
  </h1>
124
  <div class="diff">
125
  <?php
126
  $fields = [
127
+ 'post_title' => \__( 'Title', 'default' ),
128
+ 'post_content' => \__( 'Content', 'default' ),
129
+ 'post_excerpt' => \__( 'Excerpt', 'default' ),
130
  ];
131
 
132
+ $args = array(
133
+ 'show_split_view' => true,
134
+ 'title_left' => __( 'Removed', 'default' ),
135
+ 'title_right' => __( 'Added', 'default' ),
136
+ );
137
+
138
+ if ( \version_compare( $wp_version, '5.7' ) < 0 ) {
139
+ unset( $args['title_left'] );
140
+ unset( $args['title_right'] );
141
+ }
142
+
143
+ $post_array = \get_post( $this->post, \ARRAY_A );
144
+ /** This filter is documented in wp-admin/includes/revision.php */
145
+ // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reason: we want to use a WP filter from the revision feature.
146
+ $fields = \apply_filters( '_wp_post_revision_fields', $fields, $post_array );
147
+
148
+ foreach ( $fields as $field => $name ) {
149
+ /** This filter is documented in wp-admin/includes/revision.php */
150
+ // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reason: we want to use a WP filter from the revision feature.
151
+ $content_from = apply_filters( "_wp_post_revision_field_{$field}", $this->original->$field, $field, $this->original, 'from' );
152
+
153
+ /** This filter is documented in wp-admin/includes/revision.php */
154
+ // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound -- Reason: we want to use a WP filter from the revision feature.
155
+ $content_to = \apply_filters( "_wp_post_revision_field_{$field}", $this->post->$field, $field, $this->post, 'to' );
156
+
157
+ $diff = \wp_text_diff( $content_from, $content_to, $args );
158
 
159
  if ( ! $diff && 'post_title' === $field ) {
160
  // It's a better user experience to still show the Title, even if it didn't change.
161
  $diff = '<table class="diff"><colgroup><col class="content diffsplit left"><col class="content diffsplit middle"><col class="content diffsplit right"></colgroup><tbody><tr>';
162
+ $diff .= '<td>' . \esc_html( $this->original->post_title ) . '</td><td></td><td>' . \esc_html( $this->post->post_title ) . '</td>';
163
  $diff .= '</tr></tbody>';
164
  $diff .= '</table>';
165
  }
190
  * @return void
191
  */
192
  public function require_wordpress_header() {
193
+ global $post;
194
+ \set_current_screen( 'revision' );
195
+ // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited -- The revision screen expects $post to be set.
196
+ $post = $this->post;
197
  require_once ABSPATH . 'wp-admin/admin-header.php';
198
  }
199
 
vendor/autoload.php CHANGED
@@ -4,4 +4,4 @@
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
- return ComposerAutoloaderInitedd91d310f2404dbd0a4f0e790496f5c::getLoader();
4
 
5
  require_once __DIR__ . '/composer/autoload_real.php';
6
 
7
+ return ComposerAutoloaderInitb771dd36b1819b8209dfac03b31cc9ed::getLoader();
vendor/composer/ClassLoader.php CHANGED
@@ -37,11 +37,13 @@ namespace Composer\Autoload;
37
  *
38
  * @author Fabien Potencier <fabien@symfony.com>
39
  * @author Jordi Boggiano <j.boggiano@seld.be>
40
- * @see http://www.php-fig.org/psr/psr-0/
41
- * @see http://www.php-fig.org/psr/psr-4/
42
  */
43
  class ClassLoader
44
  {
 
 
45
  // PSR-4
46
  private $prefixLengthsPsr4 = array();
47
  private $prefixDirsPsr4 = array();
@@ -57,6 +59,13 @@ class ClassLoader
57
  private $missingClasses = array();
58
  private $apcuPrefix;
59
 
 
 
 
 
 
 
 
60
  public function getPrefixes()
61
  {
62
  if (!empty($this->prefixesPsr0)) {
@@ -300,6 +309,17 @@ class ClassLoader
300
  public function register($prepend = false)
301
  {
302
  spl_autoload_register(array($this, 'loadClass'), true, $prepend);
 
 
 
 
 
 
 
 
 
 
 
303
  }
304
 
305
  /**
@@ -308,6 +328,10 @@ class ClassLoader
308
  public function unregister()
309
  {
310
  spl_autoload_unregister(array($this, 'loadClass'));
 
 
 
 
311
  }
312
 
313
  /**
@@ -367,6 +391,16 @@ class ClassLoader
367
  return $file;
368
  }
369
 
 
 
 
 
 
 
 
 
 
 
370
  private function findFileWithExtension($class, $ext)
371
  {
372
  // PSR-4 lookup
37
  *
38
  * @author Fabien Potencier <fabien@symfony.com>
39
  * @author Jordi Boggiano <j.boggiano@seld.be>
40
+ * @see https://www.php-fig.org/psr/psr-0/
41
+ * @see https://www.php-fig.org/psr/psr-4/
42
  */
43
  class ClassLoader
44
  {
45
+ private $vendorDir;
46
+
47
  // PSR-4
48
  private $prefixLengthsPsr4 = array();
49
  private $prefixDirsPsr4 = array();
59
  private $missingClasses = array();
60
  private $apcuPrefix;
61
 
62
+ private static $registeredLoaders = array();
63
+
64
+ public function __construct($vendorDir = null)
65
+ {
66
+ $this->vendorDir = $vendorDir;
67
+ }
68
+
69
  public function getPrefixes()
70
  {
71
  if (!empty($this->prefixesPsr0)) {
309
  public function register($prepend = false)
310
  {
311
  spl_autoload_register(array($this, 'loadClass'), true, $prepend);
312
+
313
+ if (null === $this->vendorDir) {
314
+ return;
315
+ }
316
+
317
+ if ($prepend) {
318
+ self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
319
+ } else {
320
+ unset(self::$registeredLoaders[$this->vendorDir]);
321
+ self::$registeredLoaders[$this->vendorDir] = $this;
322
+ }
323
  }
324
 
325
  /**
328
  public function unregister()
329
  {
330
  spl_autoload_unregister(array($this, 'loadClass'));
331
+
332
+ if (null !== $this->vendorDir) {
333
+ unset(self::$registeredLoaders[$this->vendorDir]);
334
+ }
335
  }
336
 
337
  /**
391
  return $file;
392
  }
393
 
394
+ /**
395
+ * Returns the currently registered loaders indexed by their corresponding vendor directories.
396
+ *
397
+ * @return self[]
398
+ */
399
+ public static function getRegisteredLoaders()
400
+ {
401
+ return self::$registeredLoaders;
402
+ }
403
+
404
  private function findFileWithExtension($class, $ext)
405
  {
406
  // PSR-4 lookup
vendor/composer/InstalledVersions.php ADDED
@@ -0,0 +1,283 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+ namespace Composer;
14
+
15
+ use Composer\Autoload\ClassLoader;
16
+ use Composer\Semver\VersionParser;
17
+
18
+
19
+
20
+
21
+
22
+
23
+ class InstalledVersions
24
+ {
25
+ private static $installed = array (
26
+ 'root' =>
27
+ array (
28
+ 'pretty_version' => 'dev-master',
29
+ 'version' => 'dev-master',
30
+ 'aliases' =>
31
+ array (
32
+ ),
33
+ 'reference' => '4b6a2ad764ef5fdaa8cb40081a3f00f437163d9e',
34
+ 'name' => '__root__',
35
+ ),
36
+ 'versions' =>
37
+ array (
38
+ '__root__' =>
39
+ array (
40
+ 'pretty_version' => 'dev-master',
41
+ 'version' => 'dev-master',
42
+ 'aliases' =>
43
+ array (
44
+ ),
45
+ 'reference' => '4b6a2ad764ef5fdaa8cb40081a3f00f437163d9e',
46
+ ),
47
+ ),
48
+ );
49
+ private static $canGetVendors;
50
+ private static $installedByVendor = array();
51
+
52
+
53
+
54
+
55
+
56
+
57
+
58
+ public static function getInstalledPackages()
59
+ {
60
+ $packages = array();
61
+ foreach (self::getInstalled() as $installed) {
62
+ $packages[] = array_keys($installed['versions']);
63
+ }
64
+
65
+
66
+ if (1 === \count($packages)) {
67
+ return $packages[0];
68
+ }
69
+
70
+ return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));
71
+ }
72
+
73
+
74
+
75
+
76
+
77
+
78
+
79
+
80
+
81
+ public static function isInstalled($packageName)
82
+ {
83
+ foreach (self::getInstalled() as $installed) {
84
+ if (isset($installed['versions'][$packageName])) {
85
+ return true;
86
+ }
87
+ }
88
+
89
+ return false;
90
+ }
91
+
92
+
93
+
94
+
95
+
96
+
97
+
98
+
99
+
100
+
101
+
102
+
103
+
104
+
105
+ public static function satisfies(VersionParser $parser, $packageName, $constraint)
106
+ {
107
+ $constraint = $parser->parseConstraints($constraint);
108
+ $provided = $parser->parseConstraints(self::getVersionRanges($packageName));
109
+
110
+ return $provided->matches($constraint);
111
+ }
112
+
113
+
114
+
115
+
116
+
117
+
118
+
119
+
120
+
121
+
122
+ public static function getVersionRanges($packageName)
123
+ {
124
+ foreach (self::getInstalled() as $installed) {
125
+ if (!isset($installed['versions'][$packageName])) {
126
+ continue;
127
+ }
128
+
129
+ $ranges = array();
130
+ if (isset($installed['versions'][$packageName]['pretty_version'])) {
131
+ $ranges[] = $installed['versions'][$packageName]['pretty_version'];
132
+ }
133
+ if (array_key_exists('aliases', $installed['versions'][$packageName])) {
134
+ $ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
135
+ }
136
+ if (array_key_exists('replaced', $installed['versions'][$packageName])) {
137
+ $ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
138
+ }
139
+ if (array_key_exists('provided', $installed['versions'][$packageName])) {
140
+ $ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
141
+ }
142
+
143
+ return implode(' || ', $ranges);
144
+ }
145
+
146
+ throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
147
+ }
148
+
149
+
150
+
151
+
152
+
153
+ public static function getVersion($packageName)
154
+ {
155
+ foreach (self::getInstalled() as $installed) {
156
+ if (!isset($installed['versions'][$packageName])) {
157
+ continue;
158
+ }
159
+
160
+ if (!isset($installed['versions'][$packageName]['version'])) {
161
+ return null;
162
+ }
163
+
164
+ return $installed['versions'][$packageName]['version'];
165
+ }
166
+
167
+ throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
168
+ }
169
+
170
+
171
+
172
+
173
+
174
+ public static function getPrettyVersion($packageName)
175
+ {
176
+ foreach (self::getInstalled() as $installed) {
177
+ if (!isset($installed['versions'][$packageName])) {
178
+ continue;
179
+ }
180
+
181
+ if (!isset($installed['versions'][$packageName]['pretty_version'])) {
182
+ return null;
183
+ }
184
+
185
+ return $installed['versions'][$packageName]['pretty_version'];
186
+ }
187
+
188
+ throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
189
+ }
190
+
191
+
192
+
193
+
194
+
195
+ public static function getReference($packageName)
196
+ {
197
+ foreach (self::getInstalled() as $installed) {
198
+ if (!isset($installed['versions'][$packageName])) {
199
+ continue;
200
+ }
201
+
202
+ if (!isset($installed['versions'][$packageName]['reference'])) {
203
+ return null;
204
+ }
205
+
206
+ return $installed['versions'][$packageName]['reference'];
207
+ }
208
+
209
+ throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
210
+ }
211
+
212
+
213
+
214
+
215
+
216
+ public static function getRootPackage()
217
+ {
218
+ $installed = self::getInstalled();
219
+
220
+ return $installed[0]['root'];
221
+ }
222
+
223
+
224
+
225
+
226
+
227
+
228
+
229
+ public static function getRawData()
230
+ {
231
+ return self::$installed;
232
+ }
233
+
234
+
235
+
236
+
237
+
238
+
239
+
240
+
241
+
242
+
243
+
244
+
245
+
246
+
247
+
248
+
249
+
250
+
251
+
252
+ public static function reload($data)
253
+ {
254
+ self::$installed = $data;
255
+ self::$installedByVendor = array();
256
+ }
257
+
258
+
259
+
260
+
261
+ private static function getInstalled()
262
+ {
263
+ if (null === self::$canGetVendors) {
264
+ self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
265
+ }
266
+
267
+ $installed = array();
268
+
269
+ if (self::$canGetVendors) {
270
+ foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
271
+ if (isset(self::$installedByVendor[$vendorDir])) {
272
+ $installed[] = self::$installedByVendor[$vendorDir];
273
+ } elseif (is_file($vendorDir.'/composer/installed.php')) {
274
+ $installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php';
275
+ }
276
+ }
277
+ }
278
+
279
+ $installed[] = self::$installed;
280
+
281
+ return $installed;
282
+ }
283
+ }
vendor/composer/autoload_classmap.php CHANGED
@@ -6,6 +6,7 @@ $vendorDir = dirname(dirname(__FILE__));
6
  $baseDir = dirname($vendorDir);
7
 
8
  return array(
 
9
  'Yoast\\WP\\Duplicate_Post\\Admin\\Options' => $baseDir . '/src/admin/class-options.php',
10
  'Yoast\\WP\\Duplicate_Post\\Admin\\Options_Form_Generator' => $baseDir . '/src/admin/class-options-form-generator.php',
11
  'Yoast\\WP\\Duplicate_Post\\Admin\\Options_Inputs' => $baseDir . '/src/admin/class-options-inputs.php',
6
  $baseDir = dirname($vendorDir);
7
 
8
  return array(
9
+ 'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
10
  'Yoast\\WP\\Duplicate_Post\\Admin\\Options' => $baseDir . '/src/admin/class-options.php',
11
  'Yoast\\WP\\Duplicate_Post\\Admin\\Options_Form_Generator' => $baseDir . '/src/admin/class-options-form-generator.php',
12
  'Yoast\\WP\\Duplicate_Post\\Admin\\Options_Inputs' => $baseDir . '/src/admin/class-options-inputs.php',
vendor/composer/autoload_real.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
- class ComposerAutoloaderInitedd91d310f2404dbd0a4f0e790496f5c
6
  {
7
  private static $loader;
8
 
@@ -22,32 +22,23 @@ class ComposerAutoloaderInitedd91d310f2404dbd0a4f0e790496f5c
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) {
37
- $loader->set($namespace, $path);
38
- }
39
-
40
- $map = require __DIR__ . '/autoload_psr4.php';
41
- foreach ($map as $namespace => $path) {
42
- $loader->setPsr4($namespace, $path);
43
- }
44
-
45
  $classMap = require __DIR__ . '/autoload_classmap.php';
46
  if ($classMap) {
47
  $loader->addClassMap($classMap);
48
  }
49
  }
50
 
 
51
  $loader->register(true);
52
 
53
  return $loader;
2
 
3
  // autoload_real.php @generated by Composer
4
 
5
+ class ComposerAutoloaderInitb771dd36b1819b8209dfac03b31cc9ed
6
  {
7
  private static $loader;
8
 
22
  return self::$loader;
23
  }
24
 
25
+ spl_autoload_register(array('ComposerAutoloaderInitb771dd36b1819b8209dfac03b31cc9ed', 'loadClassLoader'), true, true);
26
+ self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
27
+ spl_autoload_unregister(array('ComposerAutoloaderInitb771dd36b1819b8209dfac03b31cc9ed', '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 __DIR__ . '/autoload_static.php';
32
 
33
+ call_user_func(\Composer\Autoload\ComposerStaticInitb771dd36b1819b8209dfac03b31cc9ed::getInitializer($loader));
34
  } else {
 
 
 
 
 
 
 
 
 
 
35
  $classMap = require __DIR__ . '/autoload_classmap.php';
36
  if ($classMap) {
37
  $loader->addClassMap($classMap);
38
  }
39
  }
40
 
41
+ $loader->setClassMapAuthoritative(true);
42
  $loader->register(true);
43
 
44
  return $loader;
vendor/composer/autoload_static.php CHANGED
@@ -4,9 +4,10 @@
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',
11
  'Yoast\\WP\\Duplicate_Post\\Admin\\Options_Form_Generator' => __DIR__ . '/../..' . '/src/admin/class-options-form-generator.php',
12
  'Yoast\\WP\\Duplicate_Post\\Admin\\Options_Inputs' => __DIR__ . '/../..' . '/src/admin/class-options-inputs.php',
@@ -44,7 +45,7 @@ class ComposerStaticInitedd91d310f2404dbd0a4f0e790496f5c
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
  }
4
 
5
  namespace Composer\Autoload;
6
 
7
+ class ComposerStaticInitb771dd36b1819b8209dfac03b31cc9ed
8
  {
9
  public static $classMap = array (
10
+ 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
11
  'Yoast\\WP\\Duplicate_Post\\Admin\\Options' => __DIR__ . '/../..' . '/src/admin/class-options.php',
12
  'Yoast\\WP\\Duplicate_Post\\Admin\\Options_Form_Generator' => __DIR__ . '/../..' . '/src/admin/class-options-form-generator.php',
13
  'Yoast\\WP\\Duplicate_Post\\Admin\\Options_Inputs' => __DIR__ . '/../..' . '/src/admin/class-options-inputs.php',
45
  public static function getInitializer(ClassLoader $loader)
46
  {
47
  return \Closure::bind(function () use ($loader) {
48
+ $loader->classMap = ComposerStaticInitb771dd36b1819b8209dfac03b31cc9ed::$classMap;
49
 
50
  }, null, ClassLoader::class);
51
  }
vendor/composer/installed.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php return array (
2
+ 'root' =>
3
+ array (
4
+ 'pretty_version' => 'dev-master',
5
+ 'version' => 'dev-master',
6
+ 'aliases' =>
7
+ array (
8
+ ),
9
+ 'reference' => '4b6a2ad764ef5fdaa8cb40081a3f00f437163d9e',
10
+ 'name' => '__root__',
11
+ ),
12
+ 'versions' =>
13
+ array (
14
+ '__root__' =>
15
+ array (
16
+ 'pretty_version' => 'dev-master',
17
+ 'version' => 'dev-master',
18
+ 'aliases' =>
19
+ array (
20
+ ),
21
+ 'reference' => '4b6a2ad764ef5fdaa8cb40081a3f00f437163d9e',
22
+ ),
23
+ ),
24
+ );