PluginProbe
AutomatorWP – No-Code Workflow Automation, Integration & Webhooks Plugin, now with AI / 6.0.2
AutomatorWP – No-Code Workflow Automation, Integration & Webhooks Plugin, now with AI v6.0.2
6.0.2 6.0.1 6.0.0 5.8.6 5.8.5 5.8.4 5.8.3 5.8.2 5.8.1 5.8.0 5.7.9.2 5.7.9.1 5.7.8 5.7.9 5.7.6 5.7.7 5.7.5 5.7.4 5.7.3 5.7.2 5.7.1 trunk 5.6.0 5.6.1 5.6.2 All 33 releases
automatorwp / libraries / ct / includes / scripts.php

scripts.php in AutomatorWP – No-Code Workflow Automation, Integration & Webhooks Plugin, now with AI 6.0.2, at libraries/ct/includes/scripts.php

60 lines 1.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * CT Scripts
4 *
5 * @since 1.0.0
6 */
7 // Exit if accessed directly
8 defined( 'ABSPATH' ) || exit;
9
10 /**
11 * Register admin scripts
12 *
13 * @since 1.0.0
14 * @return void
15 */
16 function ct_admin_register_scripts() {
17
18 // Scripts
19 wp_register_script( 'ct-js', CT_URL . 'assets/js/ct.js', array( 'jquery' ), CT_VER, true );
20 }
21 add_action( 'admin_init', 'ct_admin_register_scripts' );
22
23 /**
24 * Enqueue admin scripts
25 *
26 * @since 1.0.0
27 *
28 * @param string $hook
29 *
30 * @return void
31 */
32 function ct_admin_enqueue_scripts( $hook ) {
33
34 // Localize admin script
35 wp_localize_script( 'ct-js', 'ct_admin', array(
36 'ajaxurl' => esc_url( admin_url( 'admin-ajax.php', 'relative' ) ),
37 'nonce' => ct_get_admin_nonce(),
38 ) );
39
40 // Scripts
41 wp_enqueue_script( 'ct-js' );
42
43 }
44 add_action( 'admin_enqueue_scripts', 'ct_admin_enqueue_scripts' );
45
46 /**
47 * Setup a global nonce for all admin scripts
48 *
49 * @since 1.0.0
50 *
51 * @return string
52 */
53 function ct_get_admin_nonce() {
54
55 if( ! defined( 'CT_ADMIN_NONCE' ) )
56 define( 'CT_ADMIN_NONCE', wp_create_nonce( 'ct_admin' ) );
57
58 return CT_ADMIN_NONCE;
59
60 }