PluginProbe
پارسی دیت – Parsi Date / 6.3
پارسی دیت – Parsi Date v6.3
6.3 6.2.1 6.2 6.1 5.1.6 5.1.7 5.1.8 5.1.8.2 6.0 trunk 1.0 1.1 1.2 1.3 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 2.0.0-alpha 2.1 2.1.1 2.1.2 2.1.3 2.1.5 All 49 releases
wp-parsidate / inc / Admin / AdminAssets.php
AdminAssets.php
61 lines 2.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace WPParsidate\Admin;
4
5 defined( 'ABSPATH' ) || exit;
6
7 use WPParsidate\Helper\{Assets, Nonce};
8
9 class AdminAssets {
10 public function __construct() {
11 add_action( 'admin_enqueue_scripts', array( $this, 'enqueueScripts' ) );
12 }
13
14 public function enqueueScripts(): void {
15 $pluginVersion = Assets::getVersion();
16 $debugName = WP_PARSI_DEBUG_MODE ? '' : '.min';
17
18 wp_enqueue_script( WP_PARSI_KEY_SLUG . '-plugin-admin',
19 Assets::url( 'js-admin/plugin-admin' . $debugName . '.js' ), [], $pluginVersion, [ 'in_footer' => true ] );
20
21 wp_localize_script( WP_PARSI_KEY_SLUG . '-plugin-admin', WP_PARSI_KEY_CAP . 'Admin',
22 array(
23 'ajaxUrl' => admin_url( 'admin-ajax.php' ),
24 'ajaxNonce' => Nonce::create(),
25 ) );
26
27 if ( ! AdminPages::isSettingPage() ) {
28 return;
29 }
30
31 //wp_enqueue_media();
32 //wp_enqueue_style( 'wp-color-picker' );
33 //wp_enqueue_script( 'wp-color-picker' );
34
35 wp_enqueue_style( WP_PARSI_KEY_SLUG . '-plugin',
36 Assets::url( 'css-admin/plugin' . $debugName . '.css' ), false, $pluginVersion );
37
38 wp_enqueue_script( WP_PARSI_KEY_SLUG . '-plugin',
39 Assets::url( 'js-admin/plugin' . $debugName . '.js' ),
40 [
41 'jquery',
42 'jquery-ui-sortable',
43 ], $pluginVersion, [ 'in_footer' => true ] );
44
45 wp_localize_script( WP_PARSI_KEY_SLUG . '-plugin', WP_PARSI_KEY_CAP,
46 array(
47 'ajaxUrl' => admin_url( 'admin-ajax.php' ),
48 'ajaxNonce' => Nonce::create(),
49 'pageRefreshedAfter' => apply_filters( 'wp_parsidate_settings_page_refreshed_after', 0 ),
50 'pageRefreshUrl' => apply_filters( 'wp_parsidate_settings_page_refresh_url', null ),
51 'removeText' => esc_html__( 'Remove', 'wp-parsidate' ),
52 'dtuConfirmDelete' => esc_html__( 'Are you sure you want to delete this item(s)?', 'wp-parsidate' ),
53 'copyText' => esc_html__( 'Click to copy this text.', 'wp-parsidate' ),
54 ) );
55 }
56
57 public static function imageUrl( $path ): string {
58 return WP_PARSI_URL . 'assets/images/' . $path;
59 }
60 }
61