• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Yoast / duplicate-post / 14725616456

29 Apr 2025 07:21AM UTC coverage: 45.469% (-4.7%) from 50.122%
14725616456

push

github

web-flow
Merge pull request #402 from Yoast/feature/drop-php-7.2-7.3

Drop support for Php 7.2 and 7.3

1164 of 2560 relevant lines covered (45.47%)

1.61 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/duplicate-post.php
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.5
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.6
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.5' );
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 $actions An array of plugin action links.
87
 * @return array
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
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc