PluginProbe
Search & Replace Everything by WPCode – Find and Replace Media, Text, Links, and More / 1.0.0
Search & Replace Everything by WPCode – Find and Replace Media, Text, Links, and More v1.0.0
trunk 1.0.0 1.0.1 1.0.10 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9
search-replace-wpcode / includes / admin / admin-scripts.php

admin-scripts.php in Search & Replace Everything by WPCode – Find and Replace Media, Text, Links, and More 1.0.0, at includes/admin/admin-scripts.php

53 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Load scripts for the admin area.
4 *
5 * @package WPCode
6 */
7
8 if ( ! defined( 'ABSPATH' ) ) {
9 exit;
10 }
11
12 add_action( 'admin_enqueue_scripts', 'wsrw_admin_scripts' );
13
14 /**
15 * Load admin scripts here.
16 *
17 * @return void
18 */
19 function wsrw_admin_scripts() {
20
21 $current_screen = get_current_screen();
22
23 if ( ! isset( $current_screen->id ) || false === strpos( $current_screen->id, 'wsrw-search-replace' ) ) {
24 return;
25 }
26
27 $admin_asset_file = WSRW_PLUGIN_PATH . 'build/admin.asset.php';
28
29 if ( ! file_exists( $admin_asset_file ) ) {
30 return;
31 }
32
33 $asset = require $admin_asset_file;
34
35 wp_enqueue_style( 'wsrw-admin-css', WSRW_PLUGIN_URL . 'build/admin.css', null, $asset['version'] );
36
37 wp_enqueue_script( 'wsrw-admin-js', WSRW_PLUGIN_URL . 'build/admin.js', $asset['dependencies'], $asset['version'], true );
38
39 wp_localize_script(
40 'wsrw-admin-js',
41 'wsrwjs',
42 apply_filters(
43 'wsrw_admin_js_data',
44 array(
45 'nonce' => wp_create_nonce( 'wsrw_admin' ),
46 'yes' => esc_html__( 'Yes', 'search-replace-wpcode' ),
47 'no' => esc_html__( 'No', 'search-replace-wpcode' ),
48 'ok' => esc_html__( 'OK', 'search-replace-wpcode' ),
49 )
50 )
51 );
52 }
53