本文整理汇总了PHP中wp_script_is函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_script_is函数的具体用法?PHP wp_script_is怎么用?PHP wp_script_is使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wp_script_is函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: twitget_jquery_include
function twitget_jquery_include()
{
if (!wp_script_is('jquery')) {
wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js');
wp_enqueue_script('jquery');
}
}
示例2: enqueue_scripts
/**
* Register the stylesheets for the public-facing side of the site.
*
* @since 1.0.0
*/
public function enqueue_scripts()
{
global $post, $product;
if (is_object($post) && class_exists('WooCommerce')) {
$is_product_type_variable = 'false';
if (function_exists('wc_get_product')) {
$product = wc_get_product($post);
if ($product) {
if ($product->is_type('variable') && is_single()) {
$is_product_type_variable = 'true';
}
}
}
$attach_id = isset($_SESSION['attach_id']) && !empty($_SESSION['attach_id']) ? $_SESSION['attach_id'] : '';
if (!empty($attach_id)) {
$total_word = get_post_meta($attach_id, 'total_word', true);
} else {
$total_word = '';
}
if (!empty($attach_id)) {
$total_character = get_post_meta($attach_id, 'total_character', true);
} else {
$total_character = '';
}
wp_enqueue_script($this->plugin_name, plugin_dir_url(__FILE__) . 'js/woocommerce-price-per-word-public.js', array('jquery'), $this->version, false);
if (wp_script_is($this->plugin_name)) {
wp_localize_script($this->plugin_name, 'woocommerce_price_per_word_params', apply_filters('woocommerce_price_per_word_params', array('ajax_url' => admin_url('admin-ajax.php'), 'woocommerce_price_per_word_params_nonce' => wp_create_nonce("woocommerce_price_per_word_params_nonce"), 'total_word' => $total_word, 'total_character' => $total_character, 'is_product_type_variable' => $is_product_type_variable, 'woocommerce_currency_symbol_js' => get_woocommerce_currency_symbol(), 'woocommerce_price_num_decimals' => wc_get_price_decimals(), 'aewcppw_word_character' => $this->wppw_get_product_type(), 'aewcppw_allow_users_to_enter_qty' => $this->aewcppw_allow_users_to_enter_qty())));
}
wp_enqueue_script($this->plugin_name . '-bn', plugin_dir_url(__FILE__) . 'js/woocommerce-price-per-word-bn.js', array('jquery'), $this->version, false);
}
}
开发者ID:angelleye,项目名称:woocommerce-price-per-word,代码行数:36,代码来源:class-woocommerce-price-per-word-public.php
示例3: TS_VCSC_ComposerColumnAdditions
function TS_VCSC_ComposerColumnAdditions($output, $atts, $content = '')
{
global $VISUAL_COMPOSER_EXTENSIONS;
ob_start();
extract(shortcode_atts(array('animation_factor' => '0.33', 'animation_scroll' => 'false', 'animation_view' => '', 'animation_speed' => 2000), $atts));
if ($VISUAL_COMPOSER_EXTENSIONS->TS_VCSC_LoadFrontEndWaypoints == "true" && $animation_view != "") {
if (wp_script_is('waypoints', $list = 'registered')) {
wp_enqueue_script('waypoints');
} else {
wp_enqueue_script('ts-extend-waypoints');
}
}
if ($VISUAL_COMPOSER_EXTENSIONS->TS_VCSC_LoadFrontEndForcable == "false" && $animation_view != "") {
wp_enqueue_style('ts-extend-animations');
wp_enqueue_style('ts-visual-composer-extend-front');
wp_enqueue_script('ts-visual-composer-extend-front');
}
if ($animation_view != '') {
$animation_css = "ts-viewport-css-" . $animation_view;
echo '<div class="ts-viewport-column ts-viewport-animation" data-scrollup = "' . $animation_scroll . '" data-factor="' . $animation_factor . '" data-viewport="' . $animation_css . '" data-speed="' . $animation_speed . '"></div>';
} else {
echo '';
}
$myvariable = ob_get_clean();
return $myvariable;
}
示例4: load_styles_scripts
/**
* Styles & Scripts conditional loading
*
* @param
* $hook
*/
public function load_styles_scripts()
{
/*
* GADWP main stylesheet
*/
wp_enqueue_style('ga_dash-front', GADWP_URL . 'front/css/item-reports.css', null, GADWP_CURRENT_VERSION);
/*
* Item reports Styles & Scripts
*/
if (GADWP_Tools::check_roles($this->gadwp->config->options['ga_dash_access_front']) && $this->gadwp->config->options['frontend_item_reports']) {
wp_enqueue_style('gadwp-nprogress', GADWP_URL . 'tools/nprogress/nprogress.css', null, GADWP_CURRENT_VERSION);
wp_enqueue_style('gadwp_frontend_item_reports', GADWP_URL . 'front/css/item-reports.css', null, GADWP_CURRENT_VERSION);
$country_codes = GADWP_Tools::get_countrycodes();
if ($this->gadwp->config->options['ga_target_geomap'] && isset($country_codes[$this->gadwp->config->options['ga_target_geomap']])) {
$region = $this->gadwp->config->options['ga_target_geomap'];
} else {
$region = false;
}
wp_enqueue_style("wp-jquery-ui-dialog");
if (!wp_script_is('googlejsapi')) {
wp_register_script('googlejsapi', 'https://www.google.com/jsapi');
}
wp_enqueue_script('gadwp-nprogress', GADWP_URL . 'tools/nprogress/nprogress.js', array('jquery'), GADWP_CURRENT_VERSION);
wp_enqueue_script('gadwp_frontend_item_reports', plugins_url('js/item-reports.js', __FILE__), array('gadwp-nprogress', 'googlejsapi', 'jquery', 'jquery-ui-dialog'), GADWP_CURRENT_VERSION);
/* @formatter:off */
wp_localize_script('gadwp_frontend_item_reports', 'gadwp_item_data', array('ajaxurl' => admin_url('admin-ajax.php'), 'security' => wp_create_nonce('gadwp_frontend_item_reports'), 'dateList' => array('today' => __("Today", 'ga-dash'), 'yesterday' => __("Yesterday", 'ga-dash'), '7daysAgo' => __("Last 7 Days", 'ga-dash'), '30daysAgo' => __("Last 30 Days", 'ga-dash'), '90daysAgo' => __("Last 90 Days", 'ga-dash')), 'reportList' => array('uniquePageviews' => __("Unique Views", 'ga-dash'), 'users' => __("Users", 'ga-dash'), 'organicSearches' => __("Organic", 'ga-dash'), 'pageviews' => __("Page Views", 'ga-dash'), 'visitBounceRate' => __("Bounce Rate", 'ga-dash'), 'locations' => __("Location", 'ga-dash'), 'referrers' => __("Referrers", 'ga-dash'), 'searches' => __("Searches", 'ga-dash'), 'trafficdetails' => __("Traffic Details", 'ga-dash')), 'i18n' => array(__("A JavaScript Error is blocking plugin resources!", 'ga-dash'), __("Traffic Mediums", 'ga-dash'), __("Visitor Type", 'ga-dash'), __("Social Networks", 'ga-dash'), __("Search Engines", 'ga-dash'), __("Unique Views", 'ga-dash'), __("Users", 'ga-dash'), __("Page Views", 'ga-dash'), __("Bounce Rate", 'ga-dash'), __("Organic Search", 'ga-dash'), __("Pages/Session", 'ga-dash'), __("Invalid response, more details in JavaScript Console (F12).", 'ga-dash'), __("Not enough data collected", 'ga-dash'), __("This report is unavailable", 'ga-dash'), __("report generated by", 'ga-dash')), 'colorVariations' => GADWP_Tools::variations($this->gadwp->config->options['ga_dash_style']), 'region' => $region));
/* @formatter:on */
}
}
示例5: __construct
/**
* FieldGroup constructor.
*
* @param string $id
* @param string $title
* @param array $locations
* @param array $fields
* @param array $options
*/
public function __construct($id, $title, array $locations, array $fields, array $options = [])
{
$this->id = $id;
$this->title = $title;
$this->locations = $locations;
$this->options = $options;
// Add fields to the Group.
foreach ($fields as $field) {
$this->addField($field);
}
// Check for valid visibility constraint.
$showWhen = $this->options('show_when');
if (isset($showWhen) && !is_callable($showWhen)) {
$type = is_object($showWhen) ? get_class($showWhen) : gettype($showWhen);
throw new \InvalidArgumentException(sprintf('Option [show_when] is expected to be callable, %s given.', $type));
}
// Enqueue scripts and styles.
add_action('admin_enqueue_scripts', function () {
if (wp_script_is('giant-fields', 'enqueued')) {
return;
}
$dir = dirname(dirname(dirname(__FILE__)));
// Enqueue CSS.
wp_register_style('giant-fields', plugin_dir_url($dir) . 'public/css/fields.css', array(), null);
wp_enqueue_style('giant-fields');
// Enqueue JS.
wp_register_script('giant-fields', plugin_dir_url($dir) . 'public/js/fields.js', array('jquery'), null, null);
wp_enqueue_script('giant-fields');
// Enqueue all scripts, styles, settings, and templates necessary to use
// WP's media JavaScript APIs.
wp_enqueue_media();
});
}
示例6: init
public function init()
{
wp_register_script('wpt-field-credfile', WPTOOLSET_FORMS_RELPATH . '/js/credfile.js', array('wptoolset-forms'), WPTOOLSET_FORMS_VERSION, true);
wp_enqueue_script('wpt-field-credfile');
$this->enable_progress_bar = true;
if ($this->enable_progress_bar) {
//Add settings switch in order to use AJAX JQUERY UPLOAD or not
$scriptpath = WPTOOLSET_FORMS_RELPATH . '/js/jquery_upload/';
$stylepath = WPTOOLSET_FORMS_RELPATH . '/js/jquery_upload/';
wp_enqueue_style('progress_bar-style', $stylepath . 'progress_bar.css');
if (!wp_script_is('jquery')) {
wp_enqueue_script('jquery', $scriptpath . 'jquery.min.js', array(), '', false);
}
wp_enqueue_script('jquery-ui-script', $scriptpath . 'jquery-ui.min.js', array('jquery'), '', true);
wp_enqueue_script('jquery-ui-widget-script', $scriptpath . 'jquery.ui.widget.js', array('jquery'), '', true);
//wp_enqueue_script('jtmpl-script', $scriptpath . 'tmpl.min.js', array('jquery'), '', true);
wp_enqueue_script('load-image-all-script', $scriptpath . 'load-image.all.min.js', array('jquery'), '', true);
//wp_enqueue_script('canvas-to-blob-script', $scriptpath . 'canvas-to-blob.min.js', array('jquery'), '', true);
//wp_enqueue_script('jquery-blueimp-gallery-script', $scriptpath . 'jquery.blueimp-gallery.min.js', array('jquery'), '', true);
wp_enqueue_script('jquery-iframe-transport-script', $scriptpath . 'jquery.iframe-transport.js', array('jquery'), '', true);
wp_enqueue_script('jquery-fileupload-script', $scriptpath . 'jquery.fileupload.js', array('jquery'), '', true);
wp_enqueue_script('jquery-fileupload-process-script', $scriptpath . 'jquery.fileupload-process.js', array('jquery'), '', true);
wp_enqueue_script('jquery-fileupload-image-script', $scriptpath . 'jquery.fileupload-image.js', array('jquery'), '', true);
wp_enqueue_script('jquery-fileupload-audio-script', $scriptpath . 'jquery.fileupload-audio.js', array('jquery'), '', true);
wp_enqueue_script('jquery-fileupload-video-script', $scriptpath . 'jquery.fileupload-video.js', array('jquery'), '', true);
wp_enqueue_script('jquery-fileupload-validate-script', $scriptpath . 'jquery.fileupload-validate.js', array('jquery'), '', true);
wp_enqueue_script('jquery-fileupload-ui-script', $scriptpath . 'jquery.fileupload-ui.js', array('jquery'), '', true);
wp_enqueue_script('jquery-fileupload-jquery-ui-script', $scriptpath . 'jquery.fileupload-jquery-ui.js', array('jquery'), '', true);
wp_enqueue_script('my_ajax_file_uploader', $scriptpath . 'file_upload.js', array('jquery'));
//wp_localize_script('my_ajax_file_uploader_thing', 'settings', array('ajaxurl' => admin_url('admin-ajax.php'), 'nonce' => wp_create_nonce('uploader_nonce')));
wp_localize_script('my_ajax_file_uploader', 'settings', array('ajaxurl' => plugins_url("submit.php", __FILE__), 'nonce' => wp_create_nonce('ajax_nonce')));
}
}
示例7: ga_dash_enqueue_scripts
function ga_dash_enqueue_scripts()
{
global $GADASH_Config;
if ($GADASH_Config->options['ga_event_tracking'] and !wp_script_is('jquery')) {
wp_enqueue_script('jquery');
}
}
示例8: sc_add_javascripts
function sc_add_javascripts()
{
if (!wp_script_is('social_connect', 'registered')) {
wp_register_script('social_connect', SOCIAL_CONNECT_PLUGIN_URL . '/media/js/connect.js', array('jquery', 'jquery-ui-core', 'jquery-ui-dialog'));
}
wp_enqueue_script('social_connect');
}
示例9: mantra_admin_scripts
function mantra_admin_scripts()
{
// The farbtastic color selector already included in WP
wp_enqueue_script("farbtastic");
wp_enqueue_style('farbtastic');
//Jquery accordion and slider libraries alreay included in WP
wp_enqueue_script('jquery-ui-accordion');
wp_enqueue_script('jquery-ui-slider');
wp_enqueue_script('jquery-ui-tooltip');
// For backwards compatibility where Mantra is installed on older versions of WP where the ui accordion and slider are not included
if (!wp_script_is('jquery-ui-accordion', $list = 'registered')) {
wp_register_script('cryout_accordion', get_template_directory_uri() . '/admin/js/accordion-slider.js', array('jquery'));
wp_enqueue_script('cryout_accordion');
}
// For the WP uploader
if (function_exists('wp_enqueue_media')) {
wp_enqueue_media();
} else {
wp_enqueue_script('media-upload');
wp_enqueue_script('thickbox');
wp_enqueue_style('thickbox');
}
// The js used in the admin
wp_register_script('cryout-admin-js', get_template_directory_uri() . '/admin/js/admin.js');
wp_enqueue_script('cryout-admin-js');
}
示例10: addScripts
function addScripts()
{
// Register JavaScript.
wp_register_script('DOPTS_SwfJS', plugins_url('libraries/js/swfobject.js', __FILE__), array('jquery'), false, true);
wp_register_script('DOPTS_UploadifyJS', plugins_url('libraries/js/jquery.uploadify.min.js', __FILE__), array('jquery'), false, true);
wp_register_script('DOPTS_JcropJS', plugins_url('libraries/js/jquery.Jcrop.min.js', __FILE__), array('jquery'), false, true);
wp_register_script('DOPTS_ColorPickerJS', plugins_url('libraries/js/colorpicker.js', __FILE__), array('jquery'), false, true);
wp_register_script('DOPTS_DOPImageLoaderJS', plugins_url('libraries/js/jquery.dop.ImageLoader.min.js', __FILE__), array('jquery'), false, true);
wp_register_script('DOPTS_DOPTSJS', plugins_url('assets/js/dopts-backend.js', __FILE__), array('jquery'), false, true);
// Enqueue JavaScript.
if (!wp_script_is('jquery', 'queue')) {
wp_enqueue_script('jquery');
}
if (!wp_script_is('jquery-ui-sortable', 'queue')) {
wp_enqueue_script('jquery-ui-sortable');
}
wp_enqueue_script('media-upload');
if (!wp_script_is('thickbox', 'queue')) {
wp_enqueue_script('thickbox');
}
wp_enqueue_script('my-upload');
wp_enqueue_script('DOPTS_SwfJS');
wp_enqueue_script('DOPTS_UploadifyJS');
wp_enqueue_script('DOPTS_JcropJS');
wp_enqueue_script('DOPTS_ColorPickerJS');
wp_enqueue_script('DOPTS_DOPImageLoaderJS');
wp_enqueue_script('DOPTS_DOPTSJS');
}
示例11: wp_media_categories_enqueue_admin_scripts
/**
* Enqueue admin scripts and styles
*/
function wp_media_categories_enqueue_admin_scripts()
{
global $pagenow;
// Asset management
$url = wp_media_categories_get_plugin_url();
$ver = wp_media_categories_get_asset_version();
// Media editor
if (wp_script_is('media-editor') && ('upload.php' == $pagenow || 'post.php' == $pagenow || 'post-new.php' == $pagenow)) {
// Dropdown
$attachment_terms = wp_dropdown_categories(array('taxonomy' => 'media_category', 'hide_empty' => false, 'hierarchical' => true, 'orderby' => 'name', 'show_count' => true, 'walker' => new WP_Media_Categories_Media_Grid_Walker(), 'value' => 'id', 'echo' => false));
// No select
$attachment_terms = preg_replace(array('/<select([^>]*)>/', '/<\\/select>/'), '', $attachment_terms);
// Add an attachment_terms for No category
$no_categories = __('No categories', 'wp-media-categories');
$all_categories = __('All categories', 'wp-media-categories');
$no_category_term = ' ,{"term_id":"' . 'no_category' . '","term_name":"' . $no_categories . '"}';
$attachment_terms = $no_category_term . substr($attachment_terms, 1);
echo '<script type="text/javascript">';
echo '/* <![CDATA[ */';
echo 'var wp_media_categories_taxonomies = {"' . 'media_category' . '":';
echo '{"list_title":"' . html_entity_decode($all_categories, ENT_QUOTES, 'UTF-8') . '",';
echo '"term_list":[' . substr($attachment_terms, 2) . ']}};';
echo '/* ]]> */';
echo '</script>';
// Script
wp_enqueue_script('wp-media-categories-media-views', $url . '/assets/js/media-views.js', array('media-views'), $ver, true);
}
// Styling
wp_enqueue_style('wp-media-categories-styling', $url . '/assets/css/admin.css', array(), $ver);
}
示例12: bpsPro_Wizard_deny_all
function bpsPro_Wizard_deny_all()
{
if (isset($_POST['Submit-Setup-Wizard-Preinstallation']) || isset($_POST['Submit-Setup-Wizard']) || isset($_POST['Submit-Net-JTC']) || isset($_POST['Submit-Net-LSM']) || isset($_POST['Submit-Wizard-GDMW']) || isset($_POST['Submit-Wizard-cURL-Options'])) {
return;
}
if (is_admin() && wp_script_is('bps-accordion', $list = 'queue') && current_user_can('manage_options')) {
$Apache_Mod_options = get_option('bulletproof_security_options_apache_modules');
if ($Apache_Mod_options['bps_apache_mod_ifmodule'] == 'Yes') {
$denyall_content = "# BPS mod_authz_core IfModule BC\n<IfModule mod_authz_core.c>\nRequire ip " . bpsPro_get_real_ip_address_wizard() . "\n</IfModule>\n\n<IfModule !mod_authz_core.c>\n<IfModule mod_access_compat.c>\n<FilesMatch \"(.*)\$\">\nOrder Allow,Deny\nAllow from " . bpsPro_get_real_ip_address_wizard() . "\n</FilesMatch>\n</IfModule>\n</IfModule>";
} else {
$denyall_content = "# BPS mod_access_compat\n<FilesMatch \"(.*)\$\">\nOrder Allow,Deny\nAllow from " . bpsPro_get_real_ip_address_wizard() . "\n</FilesMatch>";
}
$create_denyall_htaccess_file = WP_PLUGIN_DIR . '/bulletproof-security/admin/wizard/.htaccess';
$check_string = @file_get_contents($create_denyall_htaccess_file);
if (!file_exists($create_denyall_htaccess_file)) {
$handle = fopen($create_denyall_htaccess_file, 'w+b');
fwrite($handle, $denyall_content);
fclose($handle);
}
if (file_exists($create_denyall_htaccess_file) && !strpos($check_string, bpsPro_get_real_ip_address_wizard())) {
$handle = fopen($create_denyall_htaccess_file, 'w+b');
fwrite($handle, $denyall_content);
fclose($handle);
}
}
}
示例13: styles_and_scripts
function styles_and_scripts()
{
wp_enqueue_style('notes-admin-bar-rest', $this->wpcom_static_url('/wp-content/mu-plugins/notes/admin-bar-rest.css'), array(), JETPACK_NOTES__CACHE_BUSTER);
wp_enqueue_style('noticons', $this->wpcom_static_url('/i/noticons/noticons.css'), array(), JETPACK_NOTES__CACHE_BUSTER);
$this->print_js();
// attempt to use core or plugin libraries if registered
if (wp_script_is('mustache', 'registered')) {
if (!wp_script_is('mustache', 'queue')) {
wp_enqueue_script('mustache');
}
} else {
wp_enqueue_script('mustache', $this->wpcom_static_url('/wp-content/js/mustache.js'), null, JETPACK_NOTES__CACHE_BUSTER);
}
if (wp_script_is('underscore', 'registered')) {
if (!wp_script_is('underscore', 'queue')) {
wp_enqueue_script('underscore');
}
} else {
wp_enqueue_script('underscore', $this->wpcom_static_url('/wp-content/js/underscore.js'), null, JETPACK_NOTES__CACHE_BUSTER);
}
if (wp_script_is('backbone', 'registered')) {
if (!wp_script_is('backbone', 'queue')) {
wp_enqueue_script('backbone');
}
} else {
wp_enqueue_script('backbone', $this->wpcom_static_url('/wp-content/js/backbone.js'), array('jquery', 'underscore'), JETPACK_NOTES__CACHE_BUSTER);
}
wp_enqueue_script('notes-postmessage', $this->wpcom_static_url('/wp-content/js/postmessage.js'), array(), JETPACK_NOTES__CACHE_BUSTER);
wp_enqueue_script('notes-rest-common', $this->wpcom_static_url('/wp-content/mu-plugins/notes/notes-rest-common.js'), array('backbone', 'mustache', 'jquery.spin'), JETPACK_NOTES__CACHE_BUSTER);
wp_enqueue_script('notes-admin-bar-rest', $this->wpcom_static_url('/wp-content/mu-plugins/notes/admin-bar-rest.js'), array('jquery', 'underscore', 'backbone', 'jquery.spin'), JETPACK_NOTES__CACHE_BUSTER);
}
示例14: __construct
public function __construct()
{
include_once 'gam-event-manager-cpt.php';
include_once 'gam-event-manager-settings.php';
include_once 'gam-event-manager-writepanels.php';
include_once 'gam-event-manager-setup.php';
$this->settings_page = new GAM_Event_Manager_Settings();
add_action('admin_menu', array($this, 'admin_menu'), 12);
add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts'));
}
/**
* admin_enqueue_scripts function.
*
* @access public
* @return void
*/
public function admin_enqueue_scripts()
{
global $wp_scripts;
$screen = get_current_screen();
//main frontend, bootstrap & bootstrap calendar style
wp_register_style('bootstrap-main-css', EVENT_MANAGER_PLUGIN_URL . '/assets/js/bootstrap/css/bootstrap.min.css');
wp_register_style('bootstrap-datetime-picker-css', EVENT_MANAGER_PLUGIN_URL . '/assets/js/bootstrap-datetime-picker/bootstrap-datetimepicker.min.css');
if (!wp_style_is('bootstrap.min.css', 'enqueued')) {
wp_enqueue_style('bootstrap-main-css');
}
if (!wp_script_is('bootstrap-datetimepicker.min.css', 'enqueued')) {
wp_enqueue_style('bootstrap-datetime-picker-css');
}
wp_enqueue_style('event_manager_admin_css', EVENT_MANAGER_PLUGIN_URL . '/assets/css/backend.css');
//bootstrap, moment and bootstrap calendar js
wp_register_script('bootstrap-main-js', EVENT_MANAGER_PLUGIN_URL . '/assets/js/bootstrap/js/bootstrap.min.js', array('jquery'), EVENT_MANAGER_VERSION, true);
wp_register_script('moment', EVENT_MANAGER_PLUGIN_URL . '/assets/js/bootstrap-datetime-picker/moment-with-locales.min.js', array('bootstrap-main-js'), EVENT_MANAGER_VERSION, true);
wp_register_script('bootstrap-datetime-picker-js', EVENT_MANAGER_PLUGIN_URL . '/assets/js/bootstrap-datetime-picker/bootstrap-datetimepicker.min.js', array('moment'), EVENT_MANAGER_VERSION, true);
示例15: oa_social_login_add_javascripts
/**
* Include the Social Library
*/
function oa_social_login_add_javascripts()
{
//Read the plugin settings.
$settings = get_option('oa_social_login_settings');
//Without the subdomain we can't include the libary.
if (!empty($settings['api_subdomain'])) {
//Forge library path.
$oneall_js_library = (oa_social_login_https_on() ? 'https' : 'http') . '://' . $settings['api_subdomain'] . '.api.oneall.com/socialize/library.js';
// Synchronous JavaScript: This is the default to stay compatible with existing installations.
if (empty($settings['asynchronous_javascript'])) {
//Make sure the library has not yet been included.
if (!wp_script_is('oa_social_library', 'registered')) {
//Include in header, without having the version appended
wp_register_script('oa_social_library', $oneall_js_library, array(), null, false);
}
wp_print_scripts('oa_social_library');
} else {
//JavaScript Method Reference: http://docs.oneall.com/api/javascript/library/methods/
$output = array();
$output[] = '';
$output[] = " <!-- OneAll.com / Social Login for WordPress / v" . constant('OA_SOCIAL_LOGIN_VERSION') . " -->";
$output[] = '<script type="text/javascript">';
$output[] = " (function() {";
$output[] = " var oa = document.createElement('script'); oa.type = 'text/javascript';";
$output[] = " oa.async = true; oa.src = '" . $oneall_js_library . "';";
$output[] = " var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(oa, s);";
$output[] = " })();";
$output[] = "</script>";
$output[] = '';
//Display
echo implode("\n", $output);
}
}
}