| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* JCH Optimize - Performs several front-end optimizations for fast downloads |
| 5 |
* |
| 6 |
* @package jchoptimize/wordpress-platform |
| 7 |
* @author Samuel Marshall <samuel@jch-optimize.net> |
| 8 |
* @copyright Copyright (c) 2021 Samuel Marshall / JCH Optimize |
| 9 |
* @license GNU/GPLv3, or later. See LICENSE file |
| 10 |
* |
| 11 |
* If LICENSE file missing, see <http://www.gnu.org/licenses/>. |
| 12 |
*/ |
| 13 |
|
| 14 |
namespace JchOptimize\WordPress\View; |
| 15 |
|
| 16 |
use JchOptimize\Core\Mvc\View; |
| 17 |
|
| 18 |
use function wp_add_inline_style; |
| 19 |
use function wp_enqueue_script; |
| 20 |
use function wp_enqueue_style; |
| 21 |
use function wp_register_script; |
| 22 |
use function wp_register_style; |
| 23 |
|
| 24 |
use const JCH_PLUGIN_URL; |
| 25 |
use const JCH_VERSION; |
| 26 |
|
| 27 |
class ConfigurationsHtml extends View |
| 28 |
{ |
| 29 |
public function loadResources(): void |
| 30 |
{ |
| 31 |
wp_register_style( |
| 32 |
'jch-multiselect', |
| 33 |
JCH_PLUGIN_URL . 'media/core/css/multiselect.css', |
| 34 |
[], |
| 35 |
JCH_VERSION |
| 36 |
); |
| 37 |
wp_register_style( |
| 38 |
'jch-wp-multiselect', |
| 39 |
JCH_PLUGIN_URL . 'media/css/wp-multiselect.css', |
| 40 |
['jch-multiselect'], |
| 41 |
JCH_VERSION |
| 42 |
); |
| 43 |
wp_register_style( |
| 44 |
'jch-choices', |
| 45 |
JCH_PLUGIN_URL . 'media/choices.js/styles/choices.css', |
| 46 |
[], |
| 47 |
JCH_VERSION |
| 48 |
); |
| 49 |
|
| 50 |
wp_enqueue_style('jch-multiselect'); |
| 51 |
wp_enqueue_style('jch-wp-multiselect'); |
| 52 |
wp_enqueue_style('jch-choices'); |
| 53 |
|
| 54 |
wp_register_script('jch-tab-state', JCH_PLUGIN_URL . 'media/js/tabs-state.js', [ |
| 55 |
'jquery', |
| 56 |
'jch-bootstrap' |
| 57 |
], JCH_VERSION, ['in_footer' => false]); |
| 58 |
wp_register_script( |
| 59 |
'jch-sticky-overlap-observer', |
| 60 |
JCH_PLUGIN_URL . 'media/js/sticky-overlap-observer.js', |
| 61 |
[], |
| 62 |
JCH_VERSION, |
| 63 |
); |
| 64 |
wp_register_script('jch-multiselect', JCH_PLUGIN_URL . 'media/core/js/multiselect.js', [ |
| 65 |
'jquery', |
| 66 |
'jch-admin-utility', |
| 67 |
'jch-platform-wordpress' |
| 68 |
],JCH_VERSION, ['in_footer' => false]); |
| 69 |
wp_register_script( |
| 70 |
'jch-choices', |
| 71 |
JCH_PLUGIN_URL . 'media/choices.js/scripts/choices.min.js', |
| 72 |
[], |
| 73 |
JCH_VERSION, |
| 74 |
['in_footer' => false] |
| 75 |
); |
| 76 |
|
| 77 |
wp_enqueue_script('jch-tab-state'); |
| 78 |
wp_enqueue_script('jch-sticky-overlap-observer'); |
| 79 |
wp_enqueue_script('jch-multiselect'); |
| 80 |
wp_enqueue_script('jch-choices'); |
| 81 |
|
| 82 |
if (JCH_PRO) { |
| 83 |
wp_register_script( |
| 84 |
'jch-page-cache-form-control', |
| 85 |
JCH_PLUGIN_URL . 'media/js/pagecache-form-control.js', |
| 86 |
['jquery'], |
| 87 |
JCH_VERSION, |
| 88 |
['in_footer' => true] |
| 89 |
); |
| 90 |
|
| 91 |
wp_enqueue_script('jch-page-cache-form-control'); |
| 92 |
} |
| 93 |
|
| 94 |
wp_add_inline_style('jch-wordpress', '*{overflow-anchor: none}'); |
| 95 |
} |
| 96 |
} |
| 97 |
|