Container
1 week ago
UI
1 week ago
ActionFilterLoader.php
1 week ago
DependencyAssets.php
1 week ago
IStandAloneAction.php
4 years ago
NullSitePress.php
1 week ago
DependencyAssets.php
42 lines
| 1 | <?php |
| 2 | |
| 3 | namespace WCML\StandAlone; |
| 4 | |
| 5 | use WCML\Utilities\AdminPages; |
| 6 | |
| 7 | class DependencyAssets { |
| 8 | |
| 9 | private $dependencyBaseUrl; |
| 10 | |
| 11 | public function __construct( $dependencyBaseUrl ) { |
| 12 | $this->dependencyBaseUrl = $dependencyBaseUrl; |
| 13 | } |
| 14 | |
| 15 | public function add_hooks() { |
| 16 | add_action( 'admin_enqueue_scripts', [ $this, 'enqueue' ] ); |
| 17 | } |
| 18 | |
| 19 | public function enqueue() { |
| 20 | wp_register_script( 'wpml-scripts', $this->dependencyBaseUrl . '/res/js/scripts.js', [], WCML_VERSION ); |
| 21 | wp_add_inline_script( 'wpml-scripts', "var icl_ajxloaderimg_src = '" . esc_url( $this->dependencyBaseUrl . '/res/img/ajax-loader.gif' ) . "';", 'before' ); |
| 22 | wp_register_style( 'wpml-styles', $this->dependencyBaseUrl . '/res/css/style.css', [], WCML_VERSION ); |
| 23 | wp_register_style( 'otgs-dialogs', $this->dependencyBaseUrl . '/res/css/otgs-dialogs.css', [ 'wp-jquery-ui-dialog' ], WCML_VERSION ); |
| 24 | wp_register_style( 'wpml-dialog', $this->dependencyBaseUrl . '/res/css/dialog.css', [ 'otgs-dialogs' ], WCML_VERSION ); |
| 25 | |
| 26 | if ( AdminPages::isMultiCurrency() || AdminPages::isTab( AdminPages::TAB_MULTILINGUAL_STANDALONE ) || AdminPages::isTab( AdminPages::TAB_MULTILINGUAL ) || AdminPages::isPage( 'wc-reports' ) ) { |
| 27 | wp_enqueue_script( 'wpml-scripts' ); |
| 28 | |
| 29 | wp_enqueue_style( 'wpml-styles' ); |
| 30 | wp_enqueue_style( 'wpml-dialog' ); |
| 31 | |
| 32 | wp_enqueue_style( \OTGS_Assets_Handles::SWITCHER ); |
| 33 | wp_enqueue_script( \OTGS_Assets_Handles::SWITCHER ); |
| 34 | wp_enqueue_style( \OTGS_Assets_Handles::POPOVER_TOOLTIP ); |
| 35 | wp_enqueue_script( \OTGS_Assets_Handles::POPOVER_TOOLTIP ); |
| 36 | |
| 37 | wp_enqueue_style( \OTGS_ASSETS_ICONS_STYLES ); |
| 38 | wp_enqueue_style( 'otgs-icons' ); |
| 39 | } |
| 40 | } |
| 41 | } |
| 42 |