C:\xampp\htdocs\landing\wp-content\plugins\duplicate-post\src\ui\class-asset-manager.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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
<?php
/**
 * Duplicate Post class to manage assets.
 *
 * @package Duplicate_Post
 */

namespace Yoast\WP\Duplicate_Post\UI;

use 
Yoast\WP\Duplicate_Post\Utils;

/**
 * Represents the Duplicate Post Asset Manager class.
 */
class Asset_Manager {

    
/**
     * Adds hooks to integrate with WordPress.
     *
     * @return void
     */
    
public function register_hooks() {
        \
add_action'init', [ $this'register_styles' ] );
        \
add_action'init', [ $this'register_scripts' ] );
    }

    
/**
     * Registers the styles.
     *
     * @return void
     */
    
public function register_styles() {
        \
wp_register_style'duplicate-post', \plugins_url'/css/duplicate-post.css'DUPLICATE_POST_FILE ), [], DUPLICATE_POST_CURRENT_VERSION );
        \
wp_register_style'duplicate-post-options', \plugins_url'/css/duplicate-post-options.css'DUPLICATE_POST_FILE ), [], DUPLICATE_POST_CURRENT_VERSION );
    }

    
/**
     * Registers the scripts.
     *
     * @return void
     */
    
public function register_scripts() {
        
$flattened_version Utils::flatten_versionDUPLICATE_POST_CURRENT_VERSION );

        \
wp_register_script(
            
'duplicate_post_edit_script',
            \
plugins_url( \sprintf'js/dist/duplicate-post-edit-%s.js'$flattened_version ), DUPLICATE_POST_FILE ),
            [
                
'wp-components',
                
'wp-element',
                
'wp-i18n',
            ],
            
DUPLICATE_POST_CURRENT_VERSION,
            
true
        
);

        \
wp_register_script(
            
'duplicate_post_strings',
            \
plugins_url( \sprintf'js/dist/duplicate-post-strings-%s.js'$flattened_version ), DUPLICATE_POST_FILE ),
            [
                
'wp-components',
                
'wp-element',
                
'wp-i18n',
            ],
            
DUPLICATE_POST_CURRENT_VERSION,
            
true
        
);

        \
wp_register_script(
            
'duplicate_post_quick_edit_script',
            \
plugins_url( \sprintf'js/dist/duplicate-post-quick-edit-%s.js'$flattened_version ), DUPLICATE_POST_FILE ),
            [ 
'jquery' ],
            
DUPLICATE_POST_CURRENT_VERSION,
            
true
        
);

        \
wp_register_script(
            
'duplicate_post_options_script',
            \
plugins_url( \sprintf'js/dist/duplicate-post-options-%s.js'$flattened_version ), DUPLICATE_POST_FILE ),
            [ 
'jquery' ],
            
DUPLICATE_POST_CURRENT_VERSION,
            
true
        
);
    }

    
/**
     * Enqueues the styles.
     *
     * @return void
     */
    
public function enqueue_styles() {
        \
wp_enqueue_style'duplicate-post' );
    }

    
/**
     * Enqueues the styles for the options page.
     *
     * @return void
     */
    
public function enqueue_options_styles() {
        \
wp_enqueue_style'duplicate-post-options' );
    }

    
/**
     * Enqueues the script for the Block editor and passes object via localization.
     *
     * @param array $object The object to pass to the script.
     *
     * @return void
     */
    
public function enqueue_edit_script$object = [] ) {
        
$handle 'duplicate_post_edit_script';
        \
wp_enqueue_script$handle );
        \
wp_add_inline_script(
            
$handle,
            
'let duplicatePostNotices = {};',
            
'before'
        
);
        \
wp_localize_script(
            
$handle,
            
'duplicatePost',
            
$object
        
);
    }

    
/**
     * Enqueues the script for the Javascript strings and passes object via localization.
     *
     * @param array $object The object to pass to the script.
     *
     * @return void
     */
    
public function enqueue_strings_script$object = [] ) {
        
$handle 'duplicate_post_strings';
        \
wp_enqueue_script$handle );
        \
wp_localize_script(
            
$handle,
            
'duplicatePostStrings',
            
$object
        
);
    }

    
/**
     * Enqueues the script for the Quick Edit.
     *
     * @return void
     */
    
public function enqueue_quick_edit_script() {
        \
wp_enqueue_script'duplicate_post_quick_edit_script' );
    }

    
/**
     * Enqueues the script for the Options page.
     *
     * @return void
     */
    
public function enqueue_options_script() {
        \
wp_enqueue_script'duplicate_post_options_script' );
    }

    
/**
     * Enqueues the script for the Elementor plugin.
     *
     * @param array $object The object to pass to the script.
     *
     * @return void
     */
    
public function enqueue_elementor_script$object = [] ) {
        
$flattened_version Utils::flatten_versionDUPLICATE_POST_CURRENT_VERSION );
        
$handle            'duplicate_post_elementor_script';

        \
wp_register_script(
            
$handle,
            \
plugins_url( \sprintf'js/dist/duplicate-post-elementor-%s.js'$flattened_version ), DUPLICATE_POST_FILE ),
            [ 
'jquery' ],
            
DUPLICATE_POST_CURRENT_VERSION,
            
true
        
);
        \
wp_enqueue_script$handle );
        \
wp_localize_script(
            
$handle,
            
'duplicatePost',
            
$object
        
);
    }
}
x

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