| 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 |
'close' => esc_html__( 'Close', 'search-replace-wpcode' ), |
| 50 |
'error_title' => esc_html__( 'Error', 'search-replace-wpcode' ), |
| 51 |
'please_wait' => esc_html__( 'Please Wait', 'search-replace-wpcode' ), |
| 52 |
'upgrade_to_pro' => esc_html__( 'Upgrade to Pro', 'search-replace-wpcode' ), |
| 53 |
'check_row_title' => esc_html__( 'Replacing individual items is a Pro feature', 'search-replace-wpcode' ), |
| 54 |
'check_row_content' => esc_html__( 'Upgrade to Search & Replace Everything Pro today and choose exactly which rows you want to replace from the results without having to do complex queries.', 'search-replace-wpcode' ), |
| 55 |
'check_row_url' => esc_url( wsrw_utm_url( 'https://wpcode.com/srlite/', 'search-preview', 'check-row' ) ), |
| 56 |
'row_info_title' => esc_html__( 'Full Row Info is a Pro Feature', 'search-replace-wpcode' ), |
| 57 |
'row_info_content' => esc_html__( 'Upgrade to Search & Replace Everything Pro today and view the full row information and easily trace back results to the original content without having to leave the admin.', 'search-replace-wpcode' ), |
| 58 |
'row_info_url' => esc_url( wsrw_utm_url( 'https://wpcode.com/srlite/', 'search-preview', 'row-info' ) ), |
| 59 |
'upgrade_bonus' => wpautop( |
| 60 |
wp_kses( |
| 61 |
__( '<strong>Bonus:</strong> Search & Replace Everything Lite users get <span>$30 off</span> regular price, automatically applied at checkout.', 'search-replace-wpcode' ), |
| 62 |
[ |
| 63 |
'strong' => [], |
| 64 |
'span' => [], |
| 65 |
] |
| 66 |
) |
| 67 |
), |
| 68 |
'lock_icon' => wsrw_get_icon( 'lock', '22', '28', '0 0 22 28' ), |
| 69 |
) |
| 70 |
) |
| 71 |
); |
| 72 |
} |
| 73 |
|