PluginProbe
GamiPress – Gamification plugin to reward points, badges & ranks in WordPress, now with AI / 8.0.5
GamiPress – Gamification plugin to reward points, badges & ranks in WordPress, now with AI v8.0.5
8.0.5 8.0.4 8.0.3 8.0.1 8.0.2 8.0.0 7.9.9.7 7.9.9.6 7.9.9.5 7.9.9.4 7.9.9.3 7.9.9.2 7.9.9.1 7.9.9 7.9.8 7.9.7 7.9.6 7.9.5 7.9.4 7.9.3 7.9.2 7.9.1 7.9.0 7.8.9 7.8.8 All 47 releases
← All changes | libraries/ct/includes/scripts.php +60 -0 7.9.9.4 → 8.0.5 View file →
@@ -1,0 +1,60 @@
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 +}