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'); } }
/** * 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); } }
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; }
/** * 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 */ } }
/** * 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(); }); }
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'))); } }
function ga_dash_enqueue_scripts() { global $GADASH_Config; if ($GADASH_Config->options['ga_event_tracking'] and !wp_script_is('jquery')) { wp_enqueue_script('jquery'); } }
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'); }
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'); }
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'); }
/** * 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); }
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); } } }
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); }
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);
/** * 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); } } }
function motopressCEAddTools() { require_once 'includes/ce/Access.php'; $ceAccess = new MPCEAccess(); $motopressCELibrary = new MPCELibrary(); do_action_ref_array('mp_library', array(&$motopressCELibrary)); $postType = get_post_type(); $postTypes = get_option('motopress-ce-options'); if (!$postTypes) { $postTypes = array(); } if (in_array($postType, $postTypes) && post_type_supports($postType, 'editor') && $ceAccess->hasAccess()) { global $motopressCESettings; wp_localize_script('jquery', 'motopress', $motopressCESettings['motopress_localize']); wp_localize_script('jquery', 'motopressCE', array('postID' => get_the_ID(), 'nonces' => array('motopress_ce_get_wp_settings' => wp_create_nonce('wp_ajax_motopress_ce_get_wp_settings'), 'motopress_ce_render_content' => wp_create_nonce('wp_ajax_motopress_ce_render_content'), 'motopress_ce_remove_temporary_post' => wp_create_nonce('wp_ajax_motopress_ce_remove_temporary_post'), 'motopress_ce_get_library' => wp_create_nonce('wp_ajax_motopress_ce_get_library'), 'motopress_ce_render_shortcode' => wp_create_nonce('wp_ajax_motopress_ce_render_shortcode'), 'motopress_ce_get_attachment_thumbnail' => wp_create_nonce('wp_ajax_motopress_ce_get_attachment_thumbnail'), 'motopress_ce_colorpicker_update_palettes' => wp_create_nonce('wp_ajax_motopress_ce_colorpicker_update_palettes'), 'motopress_ce_render_youtube_bg' => wp_create_nonce('wp_ajax_motopress_ce_render_youtube_bg'), 'motopress_ce_render_video_bg' => wp_create_nonce('wp_ajax_motopress_ce_render_video_bg')))); add_action('admin_head', 'motopressCEAddCEBtn'); add_action('admin_footer', 'motopressCEHTML'); //admin_head motopressCECheckDomainMapping(); wp_register_style('mpce-style', plugin_dir_url(__FILE__) . 'includes/css/style.css', null, $motopressCESettings['plugin_version']); wp_enqueue_style('mpce-style'); wp_register_style('mpce', plugin_dir_url(__FILE__) . 'mp/ce/css/ce.css', null, $motopressCESettings['plugin_version']); wp_enqueue_style('mpce'); wp_register_script('mpce-knob', plugin_dir_url(__FILE__) . 'knob/jquery.knob.min.js', array(), $motopressCESettings['plugin_version']); wp_enqueue_script('mpce-knob'); if (get_user_meta(get_current_user_id(), 'rich_editing', true) === 'false' && !wp_script_is('editor')) { wp_enqueue_script('editor'); } wp_enqueue_script('wp-link'); } }
public function enqueueScripts() { foreach ($this->getScripts() as $script) { $script = is_array($script) ? $script : ['file' => $script]; if ($script['file'] = $this->getScriptPath($script['file'])) { $info = pathinfo($script['file']); $extension = !empty($info['extension']) ? $info['extension'] : (!empty($script['type']) ? $script['type'] : false); switch ($extension) { case 'css': $script = array_merge(array('dependencies' => array(), 'version' => '1.0.0', 'media' => 'all', 'enqueue' => true), $script, array('handle' => !empty($script['handle']) ? $script['handle'] : $info['filename'])); if (wp_style_is($script['handle'], 'registered')) { wp_deregister_style($script['handle']); } wp_register_style($script['handle'], $script['file'], $script['dependencies'], $script['version'], $script['media']); if ($script['enqueue']) { wp_enqueue_style($script['handle']); } break; default: $script = array_merge(array('dependencies' => array(), 'version' => '1.0.0', 'in_footer' => true, 'localize' => false, 'enqueue' => true), $script, array('handle' => !empty($script['handle']) ? $script['handle'] : $info['filename'])); if (wp_script_is($script['handle'], 'registered')) { wp_deregister_script($script['handle']); } wp_register_script($script['handle'], $script['file'], $script['dependencies'], $script['version'], $script['in_footer']); if ($script['localize']) { wp_localize_script($script['handle'], $script['localize']['name'], $script['localize']['data']); } if ($script['enqueue']) { wp_enqueue_script($script['handle']); } break; } } } }
/** * Enqueue scripts and styles. */ public static function enqueue($element = null) { global $groups_version; switch ($element) { case 'select': switch (self::$select) { case 'chosen': if (!wp_script_is('chosen')) { wp_enqueue_script('chosen', GROUPS_PLUGIN_URL . 'js/chosen/chosen.jquery.min.js', array('jquery'), $groups_version, false); } if (!wp_style_is('chosen')) { wp_enqueue_style('chosen', GROUPS_PLUGIN_URL . 'css/chosen/chosen.min.css', array(), $groups_version); } break; case 'selectize': if (!wp_script_is('selectize')) { wp_enqueue_script('selectize', GROUPS_PLUGIN_URL . 'js/selectize/selectize.min.js', array('jquery'), $groups_version, false); } if (!wp_style_is('selectize')) { wp_enqueue_style('selectize', GROUPS_PLUGIN_URL . 'css/selectize/selectize.bootstrap2.css', array(), $groups_version); } break; } break; } }
/** * Enqueue CSS stylesheet with theme styles for Infinite Scroll. */ function twentysixteen_infinite_scroll_enqueue_styles() { if (wp_script_is('the-neverending-homepage')) { wp_enqueue_style('infinity-twentysixteen', plugins_url('twentysixteen.css', __FILE__), array('the-neverending-homepage'), '20151102'); wp_style_add_data('infinity-twentysixteen', 'rtl', 'replace'); } }
/** * Prepares the JS code integration * * @since 0.0.3 * @change 0.0.4 * * @hook array publish_confirm_message */ public static function inject_js() { /* Check user role */ if (!current_user_can('publish_posts')) { return; } /* Filter published posts */ if (get_post()->post_status === 'publish') { return; } /* jQuery loaded? */ if (!wp_script_is('jquery', 'done')) { return; } /* Default message */ $default = 'Are you sure you want to publish this now?'; /* Custom message */ $msg = apply_filters('publish_confirm_message', $default); /* Message not changed? */ if ($msg === $default) { load_plugin_textdomain('publish_confirm', false, dirname(PUBLISH_CONFIRM_BASE) . '/lang/'); $msg = __($default, 'publish_confirm'); } /* Print javascript */ self::_print_js($msg); }
/** * Enqueue CSS stylesheet with theme styles for infinity. */ function twenty_ten_infinite_scroll_enqueue_styles() { if (wp_script_is('the-neverending-homepage')) { // Add theme specific styles. wp_enqueue_style('infinity-twentyten', plugins_url('twentyten.css', __FILE__), array('the-neverending-homepage'), '20121002'); } }
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->disable_progress_bar = version_compare(CRED_FE_VERSION, '1.3.6.2', '<='); if ($this->disable_progress_bar) { return; } //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')); //require_once WPTOOLSET_COMMON_PATH . "/utility/utils.php"; //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('media_settings' => self::get_image_sizes('thumbnail'), 'ajaxurl' => plugins_url("submit.php", __FILE__), 'delete_confirm_text' => __('Are you sure to delete this file ?', 'wp-cred'), 'delete_alert_text' => __('Generic Error in deleting file', 'wp-cred'), 'too_big_file_alert_text' => __('File is too big', 'wp-cred'), 'nonce' => wp_create_nonce('ajax_nonce'))); }
/** * Load script (css, js). * */ function load_woo_tab_slider_script() { wp_register_script('slick_slider_js', plugins_url('js/slick.min.js', __FILE__), array(), null, true); if (!wp_script_is('slick_slider_js')) { wp_enqueue_script('slick_slider_js'); } }
public static function liteSyntaxHighlightingAddButtons() { if (wp_script_is('quicktags')) { $options = get_option(self::SYNTAX_HIGHLIGHTING_OPTIONS); ?> <script type="text/javascript"> <?php // кнопки, формат добавления: // QTags.addButton( 'идентификатор' , 'название', '<открывающий тег>', '</закрывающий тег>', 'v', 'описание', позиция(число) ); if ($options['php']) { ?> QTags.addButton('php', 'PHP', '<pre class="php">', '</pre>', 'p', '', 999); <?php } if ($options['html']) { ?> QTags.addButton('html', 'HTML', '<pre class="html">', '</pre>', 'p', '', 999); <?php } if ($options['css']) { ?> QTags.addButton('css', 'CSS', '<pre class="css">', '</pre>', 'p', '', 999); <?php } if ($options['js']) { ?> QTags.addButton('js', 'JS', '<pre class="js">', '</pre>', 'p', '', 999); <?php } ?> </script> <?php } }
/** * Registers/enqueues the gallery settings admin js. */ function wp_enqueue_media() { if (!wp_script_is('jetpack-gallery-settings', 'registered')) { wp_register_script('jetpack-gallery-settings', plugins_url('gallery-settings.js', __FILE__), array('media-views'), '20121225'); } wp_enqueue_script('jetpack-gallery-settings'); }
function test_it_can_enqueue_script() { $this->script->slug = 'foo'; $this->script->register(); $this->script->enqueue(); $this->assertTrue(wp_script_is('foo', 'enqueued')); }
function TS_VCSC_Skillsets_Post_Files() { global $pagenow; $screen = TS_VCSC_GetCurrentPostType(); /*if (function_exists('get_current_screen')){ $current = get_current_screen(); $screen = $current->post_type; } else { global $typenow; if (empty($typenow) && !empty($_GET['post'])) { $post = get_post($_GET['post']); $typenow = $post->post_type; $screen = $typenow; } else if (empty($typenow) && !empty($_POST['post_ID'])) { $post = get_post($_POST['post_ID']); $typenow = $post->post_type; $screen = $typenow; } }*/ if ($screen == 'ts_skillsets') { if ($pagenow == 'post-new.php' || $pagenow == 'post.php') { if (!wp_script_is('jquery')) { wp_enqueue_script('jquery'); } wp_enqueue_style('ts-font-teammates'); } } }
public function _actionScriptsAndStyles() { if (!wp_script_is('views-shortcodes-gui-script')) { wp_enqueue_script('views-shortcodes-gui-script'); } if (!wp_script_is('jquery-ui-resizable')) { wp_enqueue_script('jquery-ui-resizable'); } if (!wp_style_is('views-admin-css')) { wp_enqueue_style('views-admin-css'); } if (!wp_script_is('views-codemirror-conf-script')) { wp_enqueue_script('views-codemirror-conf-script'); } if (!wp_style_is('toolset-meta-html-codemirror-css')) { wp_enqueue_style('toolset-meta-html-codemirror-css'); } if (!wp_script_is('views-embedded-script')) { wp_enqueue_script('views-embedded-script'); } if (!wp_script_is('views-utils-script')) { wp_enqueue_script('views-utils-script'); } wp_enqueue_style('toolset-user-editors-ressource-views-dialog', TOOLSET_COMMON_URL . '/user-editors/resource/views/dialog/dialog.css', array(), TOOLSET_COMMON_VERSION); }
/** * Styles & Scripts conditional loading * * @param * $hook */ public function load_styles_scripts() { $lang = get_bloginfo('language'); $lang = explode('-', $lang); $lang = $lang[0]; /* * 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 . 'common/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?autoload=%7B%22modules%22%3A%5B%7B%22name%22%3A%22visualization%22%2C%22version%22%3A%221%22%2C%22language%22%3A%22' . $lang . '%22%2C%22packages%22%3A%5B%22corechart%22%2C%20%22table%22%2C%20%22orgchart%22%2C%20%22geochart%22%5D%7D%5D%7D%27', array(), null); } wp_enqueue_script('gadwp-nprogress', GADWP_URL . 'common/nprogress/nprogress.js', array('jquery'), GADWP_CURRENT_VERSION); wp_enqueue_script('gadwp-frontend-item-reports', GADWP_URL . 'common/js/reports.js', array('gadwp-nprogress', 'googlejsapi', 'jquery', 'jquery-ui-dialog'), GADWP_CURRENT_VERSION); /* @formatter:off */ wp_localize_script('gadwp-frontend-item-reports', 'gadwpItemData', array('ajaxurl' => admin_url('admin-ajax.php'), 'security' => wp_create_nonce('gadwp_frontend_item_reports'), 'dateList' => array('today' => __("Today", 'google-analytics-dashboard-for-wp'), 'yesterday' => __("Yesterday", 'google-analytics-dashboard-for-wp'), '7daysAgo' => sprintf(__("Last %d Days", 'google-analytics-dashboard-for-wp'), 7), '14daysAgo' => sprintf(__("Last %d Days", 'google-analytics-dashboard-for-wp'), 14), '30daysAgo' => sprintf(__("Last %d Days", 'google-analytics-dashboard-for-wp'), 30), '90daysAgo' => sprintf(__("Last %d Days", 'google-analytics-dashboard-for-wp'), 90), '365daysAgo' => sprintf(_n("%s Year", "%s Years", 1, 'google-analytics-dashboard-for-wp'), __('One', 'google-analytics-dashboard-for-wp')), '1095daysAgo' => sprintf(_n("%s Year", "%s Years", 3, 'google-analytics-dashboard-for-wp'), __('Three', 'google-analytics-dashboard-for-wp'))), 'reportList' => array('uniquePageviews' => __("Unique Views", 'google-analytics-dashboard-for-wp'), 'users' => __("Users", 'google-analytics-dashboard-for-wp'), 'organicSearches' => __("Organic", 'google-analytics-dashboard-for-wp'), 'pageviews' => __("Page Views", 'google-analytics-dashboard-for-wp'), 'visitBounceRate' => __("Bounce Rate", 'google-analytics-dashboard-for-wp'), 'locations' => __("Location", 'google-analytics-dashboard-for-wp'), 'referrers' => __("Referrers", 'google-analytics-dashboard-for-wp'), 'searches' => __("Searches", 'google-analytics-dashboard-for-wp'), 'trafficdetails' => __("Traffic", 'google-analytics-dashboard-for-wp'), 'technologydetails' => __("Technology", 'google-analytics-dashboard-for-wp')), 'i18n' => array(__("A JavaScript Error is blocking plugin resources!", 'google-analytics-dashboard-for-wp'), __("Traffic Mediums", 'google-analytics-dashboard-for-wp'), __("Visitor Type", 'google-analytics-dashboard-for-wp'), __("Search Engines", 'google-analytics-dashboard-for-wp'), __("Social Networks", 'google-analytics-dashboard-for-wp'), __("Unique Views", 'google-analytics-dashboard-for-wp'), __("Users", 'google-analytics-dashboard-for-wp'), __("Page Views", 'google-analytics-dashboard-for-wp'), __("Bounce Rate", 'google-analytics-dashboard-for-wp'), __("Organic Search", 'google-analytics-dashboard-for-wp'), __("Pages/Session", 'google-analytics-dashboard-for-wp'), __("Invalid response, more details in JavaScript Console (F12).", 'google-analytics-dashboard-for-wp'), __("Not enough data collected", 'google-analytics-dashboard-for-wp'), __("This report is unavailable", 'google-analytics-dashboard-for-wp'), __("report generated by", 'google-analytics-dashboard-for-wp'), __("This plugin needs an authorization:", 'google-analytics-dashboard-for-wp') . ' <strong>' . __("authorize the plugin", 'google-analytics-dashboard-for-wp') . '</strong>!', __("Browser", 'google-analytics-dashboard-for-wp'), __("Operating System", 'google-analytics-dashboard-for-wp'), __("Screen Resolution", 'google-analytics-dashboard-for-wp'), __("Mobile Brand", 'google-analytics-dashboard-for-wp')), 'colorVariations' => GADWP_Tools::variations($this->gadwp->config->options['ga_dash_style']), 'region' => $region, 'language' => get_bloginfo('language'), 'filter' => $_SERVER["REQUEST_URI"], 'viewList' => false, 'scope' => 'front-item')); /* @formatter:on */ } }
/** * @ticket 28404 */ function test_wp_script_is_dep_enqueued() { wp_enqueue_script('jquery-ui-accordion'); $this->assertTrue(wp_script_is('jquery', 'enqueued')); $this->assertFalse(wp_script_is('underscore', 'enqueued')); unset($GLOBALS['wp_scripts']); }