PluginProbe
Vimeography: Vimeo Video Gallery WordPress Plugin / 2.2
Vimeography: Vimeo Video Gallery WordPress Plugin v2.2
2.4.9 2.4.8 trunk 0.5.1 0.5.2 0.5.3 0.5.4 0.5.5 0.5.6 0.5.7 0.6 0.6.1 0.6.2 0.6.3 0.6.4 0.6.5 0.6.6 0.6.7 0.6.8 0.6.8.1 0.6.9 0.6.9.1 0.6.9.2 0.7 0.8 All 103 releases
vimeography / lib / admin / scripts.php

scripts.php in Vimeography: Vimeo Video Gallery WordPress Plugin 2.2, at lib/admin/scripts.php

117 lines 3.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 // Exit if accessed directly
4 if (!defined('ABSPATH')) {
5 exit();
6 }
7
8 class Vimeography_Admin_Scripts
9 {
10 public function __construct()
11 {
12 add_action('admin_enqueue_scripts', array($this, 'add_scripts'), 10, 1);
13 }
14
15 /**
16 * Load the common admin scripts across the Vimeography plugin.
17 *
18 * @param string $hook slug of the current admin page
19 */
20 public function add_scripts($hook)
21 {
22 if (
23 strpos($hook, 'vimeography') !== false &&
24 strpos($hook, 'vimeography-stats') == false
25 ) {
26 wp_register_style(
27 'vimeography-bootstrap',
28 VIMEOGRAPHY_URL . 'lib/admin/assets/css/bootstrap.min.css'
29 );
30 wp_register_style(
31 'vimeography-admin',
32 VIMEOGRAPHY_URL . 'lib/admin/assets/css/admin.css'
33 );
34
35 wp_register_script(
36 'vimeography-bootstrap',
37 VIMEOGRAPHY_URL . 'lib/admin/assets/js/bootstrap.min.js'
38 );
39
40 switch ($hook) {
41 case 'vimeography_page_vimeography-new-gallery':
42 wp_register_script(
43 'fullpage',
44 'https://cdnjs.cloudflare.com/ajax/libs/fullPage.js/2.9.2/jquery.fullPage.min.js',
45 array('jquery')
46 );
47 wp_register_script(
48 'select2',
49 'https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/js/select2.min.js',
50 array('jquery')
51 );
52 wp_register_style(
53 'fullpage',
54 'https://cdnjs.cloudflare.com/ajax/libs/fullPage.js/2.9.2/jquery.fullPage.min.css'
55 );
56 wp_register_style(
57 'select2',
58 'https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/css/select2.min.css'
59 );
60 wp_enqueue_script('fullpage');
61 wp_enqueue_style('fullpage');
62 wp_enqueue_script('select2');
63 wp_enqueue_style('select2');
64 break;
65 case "toplevel_page_vimeography-edit-galleries":
66 if (defined('VIMEOGRAPHY_DEV') && VIMEOGRAPHY_DEV) {
67 wp_enqueue_script(
68 'vimeography_admin_react',
69 'https://localhost:8024/index.js',
70 [],
71 "1.0",
72 true
73 );
74 } else {
75 $manifest = VIMEOGRAPHY_PATH . 'lib/admin/app/dist/manifest.json';
76 $manifest = file_get_contents($manifest);
77 $manifest = (array) json_decode($manifest);
78
79 $script_url =
80 VIMEOGRAPHY_URL . 'lib/admin/app/dist/' . $manifest['index.js'];
81 wp_enqueue_script(
82 'vimeography_admin_react',
83 $script_url,
84 [],
85 "1.0",
86 true
87 );
88 }
89
90 wp_localize_script(
91 "vimeography_admin_react",
92 "vimeographyThemeNonce",
93 wp_create_nonce("vimeography-theme-action")
94 );
95
96 wp_localize_script(
97 'vimeography_admin_react',
98 'vimeographyApiSettings',
99 array(
100 'root' => esc_url_raw(rest_url()),
101 'nonce' => wp_create_nonce('wp_rest')
102 )
103 );
104
105 break;
106 default:
107 wp_enqueue_style('vimeography-bootstrap');
108 wp_enqueue_script('vimeography-bootstrap');
109 break;
110 }
111
112 wp_enqueue_style('vimeography-admin');
113 wp_enqueue_script('vimeography-admin');
114 }
115 }
116 }
117