PluginProbe ʕ •ᴥ•ʔ
Yoast Duplicate Post / 4.6
Yoast Duplicate Post v4.6
trunk 0.3 0.4 0.5 0.6 0.6.1 1.0 1.1 1.1.1 1.1.2 2.0 2.0.1 2.0.2 2.1 2.1.1 2.2 2.3 2.4 2.4.1 2.5 2.6 3.0 3.0.1 3.0.2 3.0.3 3.1 3.1.1 3.1.2 3.2 3.2.1 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 4.0 4.0.1 4.0.2 4.1 4.1.1 4.1.2 4.2 4.3 4.4 4.5 4.6
duplicate-post / duplicate-post.php
duplicate-post Last commit date
compat 3 months ago css 3 months ago js 3 months ago src 3 months ago vendor 2 months ago admin-functions.php 3 months ago common-functions.php 3 months ago duplicate-post.php 2 months ago duplicate_post_yoast_icon-125x125.png 5 years ago gpl-2.0.txt 14 years ago options.php 3 months ago readme.txt 2 weeks ago
duplicate-post.php
109 lines
1 <?php
2 /**
3 * Duplicate Post plugin.
4 *
5 * @package Yoast\WP\Duplicate_Post
6 * @since 0.1
7 *
8 * @wordpress-plugin
9 * Plugin Name: Yoast Duplicate Post
10 * Plugin URI: https://yoast.com/wordpress/plugins/duplicate-post/
11 * Description: The go-to tool for cloning posts and pages, including the powerful Rewrite & Republish feature.
12 * Version: 4.6
13 * Author: Enrico Battocchi & Team Yoast
14 * Author URI: https://yoa.st/team-yoast-duplicate
15 * Text Domain: duplicate-post
16 * Requires at least: 6.8
17 * Requires PHP: 7.4
18 *
19 * Copyright 2020-2024 Yoast BV (email : info@yoast.com)
20 *
21 * This program is free software; you can redistribute it and/or modify
22 * it under the terms of the GNU General Public License as published by
23 * the Free Software Foundation; either version 2 of the License, or
24 * (at your option) any later version.
25 *
26 * This program is distributed in the hope that it will be useful,
27 * but WITHOUT ANY WARRANTY; without even the implied warranty of
28 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
29 * GNU General Public License for more details.
30 *
31 * You should have received a copy of the GNU General Public License
32 * along with this program; if not, write to the Free Software
33 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
34 */
35
36 use Yoast\WP\Duplicate_Post\Duplicate_Post;
37
38 if ( ! defined( 'ABSPATH' ) ) {
39 exit();
40 }
41
42 if ( ! defined( 'DUPLICATE_POST_FILE' ) ) {
43 define( 'DUPLICATE_POST_FILE', __FILE__ );
44 }
45
46 if ( ! defined( 'DUPLICATE_POST_PATH' ) ) {
47 define( 'DUPLICATE_POST_PATH', plugin_dir_path( __FILE__ ) );
48 }
49
50 define( 'DUPLICATE_POST_CURRENT_VERSION', '4.6' );
51
52 $duplicate_post_autoload_file = DUPLICATE_POST_PATH . 'vendor/autoload.php';
53
54 if ( is_readable( $duplicate_post_autoload_file ) ) {
55 require $duplicate_post_autoload_file;
56 }
57
58 if ( class_exists( Duplicate_Post::class ) ) {
59 // Initialize the main autoloaded class.
60 add_action( 'plugins_loaded', '__duplicate_post_main' );
61 }
62
63 /**
64 * Loads the Duplicate Post main class.
65 *
66 * {@internal Function name change would be BC-break.}
67 *
68 * @phpcs:disable PHPCompatibility.FunctionNameRestrictions.ReservedFunctionNames.FunctionDoubleUnderscore
69 * @phpcs:disable WordPress.NamingConventions.ValidFunctionName.FunctionDoubleUnderscore
70 * @phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound
71 *
72 * @return void
73 */
74 function __duplicate_post_main() {
75 new Duplicate_Post();
76 }
77 // phpcs:enable
78
79 add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), 'duplicate_post_plugin_actions', 10 );
80
81 /**
82 * Adds 'Settings' link to plugin entry in the Plugins list.
83 *
84 * @see 'plugin_action_links_$plugin_file'
85 *
86 * @param array<string, string> $actions An array of plugin action links.
87 * @return array<string, string>
88 */
89 function duplicate_post_plugin_actions( $actions ) {
90 $settings_action = [
91 'settings' => sprintf(
92 '<a href="%1$s" %2$s>%3$s</a>',
93 menu_page_url( 'duplicatepost', false ),
94 /* translators: Hidden accessibility text. */
95 'aria-label="' . __( 'Settings for Duplicate Post', 'duplicate-post' ) . '"',
96 esc_html__( 'Settings', 'duplicate-post' ),
97 ),
98 ];
99
100 $actions = ( $settings_action + $actions );
101 return $actions;
102 }
103
104 require_once DUPLICATE_POST_PATH . 'common-functions.php';
105
106 if ( is_admin() ) {
107 include_once DUPLICATE_POST_PATH . 'admin-functions.php';
108 }
109