class-wpml-st-theme-plugin-localization-resources.php
1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
class WPML_ST_Theme_Plugin_Localization_Resources {
public function add_hooks() {
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
}
public function enqueue_scripts() {
wp_enqueue_script(
'wpml-theme-plugin-localization-scan',
WPML_ST_URL . '/res/js/theme-plugin-localization/theme-plugin-localization.js',
array( 'jquery-ui-dialog' ),
WPML_ST_VERSION
);
wp_enqueue_style(
'wpml-theme-plugin-localization-scan',
WPML_ST_URL . '/res/css/theme-plugin-localization.css',
array(),
WPML_ST_VERSION
);
wp_localize_script(
'wpml-theme-plugin-localization-scan',
'wpml_groups_to_scan',
get_option( WPML_ST_Themes_And_Plugins_Updates::WPML_ST_ITEMS_TO_SCAN, [] )
);
wp_localize_script(
'wpml-theme-plugin-localization-scan',
'wpml_active_plugins_themes',
$this->get_active_items()
);
}
private function get_active_items() {
$items = array();
foreach ( get_plugins() as $key => $plugin ) {
if ( is_plugin_active( $key ) ) {
$items['plugin'][] = $key;
}
}
$items['theme'][] = wp_get_theme()->get_template();
return $items;
}
}