/** * Enqueues scripts. */ public function __enqueue_scripts() { $wp_enqueue_util = WP_Enqueue_Util::get_instance(); $wp_pinterest = WP_Pinterest::get_instance(); $handle = $wp_pinterest->get_slug() . '-scripts'; $relative_path = __DIR__ . '/../site/js/'; $filename = 'bundle.min.js'; $filename_debug = 'bundle.concat.js'; $dependencies = array(); $version = $wp_pinterest->get_version(); $options = new WP_Enqueue_Options($handle, $relative_path, $filename, $filename_debug, $dependencies, $version, true); $localization_name = 'wp_pinterest'; $options->set_localization($localization_name, $this->get_data()); $wp_enqueue_util->enqueue_script($options); }
/** * Enqueues scripts. */ public function __enqueue_scripts() { $wp_ahalogy = WP_Ahalogy::get_instance(); $handle = $wp_ahalogy->get_slug() . '-script'; $relative_path = __DIR__ . '/../site/js/'; $filename = 'bundle.min.js'; $filename_debug = 'bundle.concat.js'; $dependencies = array(); $client_id = apply_filters('wp_ahalogy_client_id', ''); if (empty($client_id)) { return; } $data = array('options' => array('clientId' => $client_id)); $options = new WP_Enqueue_Options($handle, $relative_path, $filename, $filename_debug, $dependencies, $wp_ahalogy->get_version()); $options->set_localization($wp_ahalogy->get_localization_handle(), $data); WP_Enqueue_Util::get_instance()->enqueue_script($options); }
/** * Enqueues bundled scripts. */ private function enqueue_bundled_scripts() { $wp_enqueue_util = WP_Enqueue_Util::get_instance(); $wp_recipe = WP_Recipe::get_instance(); $handle = $wp_recipe->get_slug() . '-scripts'; $relative_path = __DIR__ . '/../site/js/'; $filename = 'bundle.min.js'; $filename_debug = 'bundle.concat.js'; $dependencies = array(); $version = $wp_recipe->get_version(); $styles = array($wp_enqueue_util->get_source_to_enqueue(__DIR__ . '/../site/css/', 'wp-recipe-print.min.css', 'wp-recipe-print.css')); $styles = apply_filters('wp_recipe_enqueue_print_styles', $styles); $data = array('print' => array('styles' => $styles)); $options = new WP_Enqueue_Options($handle, $relative_path, $filename, $filename_debug, $dependencies, $version, true); $localization_name = WP_Recipe_Util::get_instance()->get_id($wp_recipe->get_slug()); $options->set_localization($localization_name, $data); $wp_enqueue_util->enqueue_script($options); }
/** * Enqueues scripts. */ public function __enqueue_scripts() { $wp_enqueue_util = WP_Enqueue_Util::get_instance(); $wp_google_analytics = WP_Google_Analytics::get_instance(); $handle = $wp_google_analytics->get_slug() . '-scripts'; $relative_path = __DIR__ . '/../site/js/'; $filename = 'bundle.min.js'; $filename_debug = 'bundle.concat.js'; $dependencies = array(); $version = $wp_google_analytics->get_version(); $tracking_id = apply_filters('wp_google_analytics_tracking_id', ''); if (empty($tracking_id)) { return; } $data = array('options' => array('trackingId' => $tracking_id)); $options = new WP_Enqueue_Options($handle, $relative_path, $filename, $filename_debug, $dependencies, $version); $options->set_localization($wp_google_analytics->get_localization_handle(), $data); $wp_enqueue_util->enqueue_script($options); }
/** * Enqueues bundled scripts. */ private function enqueue_bundled_scripts() { $wp_enqueue_util = WP_Enqueue_Util::get_instance(); $wp_recipe = WP_Recipe::get_instance(); $wp_recipe_ingredients = WP_Recipe_Ingredients::get_instance(); $wp_recipe_ingredients_group = WP_Recipe_Ingredients_Group::get_instance(); $handle = $wp_recipe->get_slug() . '-admin-script'; $relative_path = __DIR__ . '/../admin/js/'; $filename = 'bundle.min.js'; $filename_debug = 'bundle.concat.js'; $dependencies = array('underscore'); $group_keys = $wp_recipe_ingredients_group->get_keys(); $new_group = array($group_keys['group'] => ''); $data = array('ingredient' => array('classes' => $wp_recipe_ingredients->get_classes(), 'group' => array('classes' => $wp_recipe_ingredients_group->get_classes(), 'keys' => $group_keys, 'markup' => $wp_recipe_ingredients_group->generate_admin_markup($new_group)), 'id' => WP_Recipe_Util::get_instance()->get_id($wp_recipe_ingredients->get_slug()), 'markup' => $wp_recipe_ingredients->generate_admin_markup())); $options = new WP_Enqueue_Options($handle, $relative_path, $filename, $filename_debug, $dependencies, $wp_recipe->get_version(), true); $localization_name = WP_Recipe_Util::get_instance()->get_id($wp_recipe->get_slug()); $options->set_localization($localization_name, $data); $wp_enqueue_util->enqueue_script($options); }
/** * A convenience function for enqueuing styles. * * Will automatically enqueue compiled or minified source, depending on debug configuration. * * @param WP_Enqueue_Options $options Options to enqueue styles with. */ public function enqueue_style(WP_Enqueue_Options $options) { if (!$options->have_required_properties()) { trigger_error('Trying to enqueue style, but required properties are missing.'); return; } // Required options. $handle = $options->get_handle(); $relative_path = $options->get_relative_path(); $filename = $options->get_filename(); // Optional options. $filename_debug = $options->get_filename_debug(); $dependencies = $options->get_dependencies(); $version = $options->get_version(); $media = $options->get_media(); $source = $this->get_source_to_enqueue($relative_path, $filename, $filename_debug); wp_enqueue_style($handle, $source, $dependencies, $version, $media); }
/** * Registers widget scripts. */ public function register_widget_scripts() { $wp_mailchimp_subscribe = WP_MailChimp_Subscribe::get_instance(); $localization_handle = $wp_mailchimp_subscribe->get_localization_handle(); $domain = $wp_mailchimp_subscribe->get_slug(); $handle = $this->slug . '-script'; $relative_path = __DIR__ . '/../../site/js/'; $filename = 'bundle.min.js'; $filename_debug = 'bundle.concat.js'; $dependencies = array('jquery', 'underscore'); $data = array('options' => array('default_error_message' => __('Hrm... Something\'s not working right. Please try again later or let us know something is wrong.', $domain), 'default_success_message' => __('Almost finished... We need to confirm your email address. To complete the subscription process, please click the link in the email we just sent you.', $domain))); $options = new WP_Enqueue_Options($handle, $relative_path, $filename, $filename_debug, $dependencies, $this->version, true); $options->set_localization($localization_handle, $data); $this->wp_enqueue_util->enqueue_script($options); }