PluginProbe
Plugin Groups / trunk
Plugin Groups vtrunk
trunk 1.0.3 1.1.0 1.2.1 1.2.2 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.0.9 3.0.0
← All changes | classes/class-extras.php +21 -10 2.0.6trunk View file →
@@ -43,17 +43,28 @@
43 43 /**
44 44 * Enqueue our scripts and data for the bulk actions JS.
45 45 */
46 46 public function enqueue_script() {
47 + $manifest_path = PLGGRP_PATH . 'static/manifest.json';
48 + if ( ! file_exists( $manifest_path ) ) {
49 + return;
50 + }
47 51
48 - $asset = include PLGGRP_PATH . 'js/install.asset.php';
49 - wp_enqueue_script( 'plugin-groups-install', PLGGRP_URL . 'js/install.js', $asset['dependencies'], $asset['version'], true );
52 + $manifest = json_decode( file_get_contents( $manifest_path ), true );
53 + if ( ! isset( $manifest['src/extras.js'] ) ) {
54 + return;
55 + }
50 56
51 - $data = array(
52 - 'url' => rest_url( Plugin_Groups::$slug . '/add' ),
53 - 'nonce' => wp_create_nonce( 'wp_rest' ),
54 - );
55 - wp_add_inline_script( 'plugin-groups-install', 'var plgData = ' . wp_json_encode( $data ), 'before' );
57 + $js_path = PLGGRP_URL . 'static/' . $manifest['src/extras.js']['file'];
58 + wp_enqueue_script( 'plugin-groups-bulk', $js_path, [], PLGGRP_VERSION, true );
59 +
60 + $data = [
61 + 'groups' => $this->plugin_groups->get_groups(),
62 + 'url' => rest_url( Plugin_Groups::$slug . '/add' ),
63 + 'nonce' => wp_create_nonce( 'wp_rest' ),
64 + 'siteID' => get_current_blog_id(),
65 + ];
66 + wp_add_inline_script( 'plugin-groups-bulk', 'var plgData = ' . wp_json_encode( $data ), 'before' );
56 67 }
57 68
58 69 /**
59 70 * Add our actions to the bulk actions.
@@ -66,15 +77,15 @@
66 77 // @todo: Clean up to use the HMTL builder.
67 78 $groups = $this->plugin_groups->get_groups();
68 79 $last = array_pop( $actions );
69 80 $newaction = array();
70 - $newaction[] = '<select disabled=disabled data-plugin="' . $plugin['slug'] . '" style="width:120px;">';
81 + $newaction[] = '<select disabled=disabled data-plugin="' . esc_attr( $plugin['slug'] ) . '" style="width:120px;">';
71 82 $newaction[] = '<option value="_select">';
72 83 $newaction[] = __( 'Add to group', 'plugin-groups' );
73 84 $newaction[] = '</option>';
74 85 foreach ( $groups as $group ) {
75 - $newaction[] = '<option value="' . $group['id'] . '">';
76 - $newaction[] = $group['name'];
86 + $newaction[] = '<option value="' . esc_attr( $group['id'] ) . '">';
87 + $newaction[] = esc_html( $group['name'] );
77 88 $newaction[] = '</option>';
78 89 }
79 90 $newaction[] = '</select>';
80 91