|
13 | 13 | const NU_GLOBAL_ELEMENTS_PLUGIN_VER = "1.4.0"; |
14 | 14 | const NU_GLOBAL_ELEMENTS_PLUGIN_MANIFEST_URL = "https://its-digital-technology.github.io/global-elements-wordpress/manifest/info.json"; |
15 | 15 |
|
| 16 | + |
16 | 17 | /** |
17 | 18 | * Get options values for plugin |
18 | 19 | */ |
19 | 20 |
|
20 | 21 | $nu_global_elements_options = get_option( 'nu_global_elements_option_name' ); |
21 | 22 |
|
| 23 | + |
22 | 24 | /** |
23 | 25 | * Include global elements CSS, kernl UI and javascript from CDN on front end |
24 | 26 | */ |
| 27 | + |
25 | 28 | add_action('wp_head', function() { ?> |
26 | 29 | <link rel="stylesheet" href="https://global-packages.cdn.northeastern.edu/global-elements/dist/css/index.css"> |
27 | 30 | <script src="https://global-packages.cdn.northeastern.edu/global-elements/dist/js/index.umd.js"></script> |
28 | 31 | <script src="https://global-packages.cdn.northeastern.edu/kernl-ui/dist/js/index.umd.js" defer></script> |
29 | 32 | <?php }); |
30 | 33 |
|
| 34 | + |
31 | 35 | /** |
32 | 36 | * Include the global NU header, if it is not disabled in the options |
33 | 37 | * |
34 | 38 | * NOTE: There must be a wp_body_open() statement under the <body> tag, |
35 | 39 | * most likely in header.php of the theme. |
36 | 40 | */ |
37 | | -/* |
38 | | - if (!isset($nu_global_elements_options['disable_global_header'])) { |
39 | 41 |
|
40 | | - add_action('wp_body_open', function() use ($nu_global_elements_options) { |
41 | | - |
42 | | - // Determine whether to show the wordmark |
43 | | - $show_wordmark = isset($nu_global_elements_options['show_nu_wordmark']) && $nu_global_elements_options['show_nu_wordmark']; |
44 | | -
|
45 | | - // Create the x-data attribute dynamically |
46 | | - $x_data = sprintf( |
47 | | - 'x-data="NUGlobalElements.header({ wordmark: %s })"', |
48 | | - $show_wordmark ? 'true' : 'false' |
49 | | - ); |
50 | | -
|
51 | | - // Output the HTML structure |
52 | | - echo sprintf( |
53 | | - '<div %s x-init="init()" style="height: 48px; background-color: black"></div>', |
54 | | - $x_data |
55 | | - ); |
56 | | -
|
57 | | - }, 10); |
58 | | -} |
59 | | -*/ |
60 | 42 | if (!isset($nu_global_elements_options['disable_global_header'])) { |
61 | 43 |
|
62 | 44 | add_action('wp_body_open', function() use ($nu_global_elements_options) { |
|
88 | 70 | } |
89 | 71 |
|
90 | 72 |
|
91 | | - |
92 | 73 | /** |
93 | 74 | * Include the global NU footer, if it is not disabled in the options |
94 | 75 | */ |
| 76 | + |
95 | 77 | if (!isset($nu_global_elements_options['disable_global_footer'])) { |
96 | 78 | add_action('wp_footer', function() { |
97 | 79 | echo '<div x-data="NUGlobalElements.footer()" x-init="init()"></div>'; |
98 | 80 | }); |
99 | 81 | } |
100 | 82 |
|
| 83 | + |
101 | 84 | /** |
102 | 85 | * Include TrustArc, if it is not disabled in the options |
103 | 86 | */ |
| 87 | + |
104 | 88 | if (!isset($nu_global_elements_options['disable_trustarc'])){ |
105 | 89 |
|
106 | 90 | if (isset($nu_global_elements_options['disable_global_footer'])){ |
@@ -128,6 +112,7 @@ function nu_global_elements_admin($hook) { |
128 | 112 | wp_enqueue_style('nu-global-elements-admin', plugins_url('nu-global-elements-admin.css', __FILE__ )); |
129 | 113 | } |
130 | 114 |
|
| 115 | + |
131 | 116 | /** |
132 | 117 | * Create plugin settings/options menu item, page and fields |
133 | 118 | * |
@@ -355,7 +340,6 @@ function nu_global_elements_link( $links ) { |
355 | 340 | * Check for updates to this plugin and if available allow updating through WP admin plugin manager |
356 | 341 | */ |
357 | 342 |
|
358 | | - |
359 | 343 | if( ! class_exists( 'UpdateChecker' ) ) { |
360 | 344 |
|
361 | 345 | class UpdateChecker{ |
|
0 commit comments