C:\xampp\htdocs\landing\wp-content\updraft\plugins-old\duplicate-post\src\ui\class-link-builder.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<?php
/**
 * Duplicate Post link builder.
 *
 * @package Duplicate_Post
 */

namespace Yoast\WP\Duplicate_Post\UI;

/**
 * Class Link_Builder
 *
 * @package Yoast\WP\Duplicate_Post
 */
class Link_Builder {

    
/**
     * Builds URL for duplication action for the Rewrite & Republish feature.
     *
     * @param int|\WP_Post $post        The post object or ID.
     * @param string       $context     The context in which the URL will be used.
     *
     * @return string The URL for the link.
     */
    
public function build_rewrite_and_republish_link$post$context 'display' ) {
        return 
$this->build_link$post$context'duplicate_post_rewrite' );
    }

    
/**
     * Builds URL for the "Clone" action.
     *
     * @param int|\WP_Post $post        The post object or ID.
     * @param string       $context     The context in which the URL will be used.
     *
     * @return string The URL for the link.
     */
    
public function build_clone_link$post$context 'display' ) {
        return 
$this->build_link$post$context'duplicate_post_clone' );
    }

    
/**
     * Builds URL for the "Copy to a new draft" action.
     *
     * @param int|\WP_Post $post        The post object or ID.
     * @param string       $context     The context in which the URL will be used.
     *
     * @return string The URL for the link.
     */
    
public function build_new_draft_link$post$context 'display' ) {
        return 
$this->build_link$post$context'duplicate_post_new_draft' );
    }

    
/**
     * Builds URL for the "Check Changes" action.
     *
     * @param int|\WP_Post $post        The post object or ID.
     * @param string       $context     The context in which the URL will be used.
     *
     * @return string The URL for the link.
     */
    
public function build_check_link$post$context 'display' ) {
        return 
$this->build_link$post$context'duplicate_post_check_changes' );
    }

    
/**
     * Builds URL for duplication action.
     *
     * @param int|\WP_Post $post        The post object or ID.
     * @param string       $context     The context in which the URL will be used.
     * @param string       $action_name The action for the URL.
     *
     * @return string The URL for the link.
     */
    
public function build_link$post$context$action_name ) {
        
$post = \get_post$post );
        if ( ! 
$post instanceof \WP_Post ) {
            return 
'';
        }

        if ( 
'display' === $context ) {
            
$action '?action=' $action_name '&amp;post=' $post->ID;
        } else {
            
$action '?action=' $action_name '&post=' $post->ID;
        }

        return \
wp_nonce_url(
        
/**
         * Filter on the URL of the clone link
         *
         * @param string $url           The URL of the clone link.
         * @param int    $ID            The ID of the post
         * @param string $context       The context in which the URL is used.
         * @param string $action_name   The action name.
         *
         * @return string
         */
            
\apply_filters'duplicate_post_get_clone_post_link', \admin_url'admin.php' $action ), $post->ID$context$action_name ),
            
$action_name '_' $post->ID
        
);
    }
}
x

Windows NT KPTV 6.2 build 9200 (Windows Server 2012 Datacenter Edition) i586