/** * Main WebMan Amplifier Instance * * Please load it only one time. * * Insures that only one instance of WebMan Amplifier exists in memory * at any one time. * Also prevents needing to define globals all over the place. * * @since 1.0 * @version 1.0.9.15 * @access public * * @return The one true WebMan Amplifier */ public static function instance() { //Store the instance locally to avoid private static replication static $instance = null; //Only run these methods if they haven't been ran previously if (null === $instance) { $instance = new WM_Amplifier(); $instance->setup_actions(); $instance->setup_features(); } //Always return the instance return $instance; }
/** * Register (and include) styles and scripts * * @since 1.0 * @version 1.3.5 * * @access public */ public function assets() { // Helper variables $icon_font_url = WM_Amplifier::fix_ssl_urls(esc_url_raw(apply_filters('wmhook_metabox_' . 'iconfont_url', get_option('wmamp-icon-font')))); $icon_font_posts = apply_filters('wmhook_metabox_' . 'iconfont_admin_screen_addon', array('edit-wm_modules')); // Processing // Register // Styles wp_register_style('wm-metabox-styles', WMAMP_ASSETS_URL . 'css/metabox.css', false, WMAMP_VERSION, 'screen'); wp_register_style('wm-metabox-styles-rtl', WMAMP_ASSETS_URL . 'css/rtl-metabox.css', false, WMAMP_VERSION, 'screen'); if ($icon_font_url) { wp_register_style('wm-fonticons', $icon_font_url, false, WMAMP_VERSION, 'screen'); } // Scripts wp_register_script('wm-metabox-scripts', WMAMP_ASSETS_URL . 'js/metabox.js', array('jquery', 'jquery-ui-tabs', 'jquery-ui-slider'), WMAMP_VERSION, true); // Allow hooking for deregistering do_action('wmhook_metabox_' . 'assets_registered'); // Enqueue (only on admin edit pages) if ($this->is_edit_page()) { // Styles wp_enqueue_style('wp-color-picker'); wp_enqueue_style('wm-metabox-styles'); if (is_rtl()) { wp_enqueue_style('wm-metabox-styles-rtl'); } // Scripts wp_enqueue_script('media-upload'); wp_enqueue_media(); wp_enqueue_script('jquery-ui-core'); wp_enqueue_script('jquery-ui-tabs'); wp_enqueue_script('jquery-ui-slider'); wp_enqueue_script('wp-color-picker'); // AJAX wp_localize_script('jquery', 'wmGalleryPreviewNonce', wp_create_nonce('wm-gallery-preview-refresh')); } // Load icon font CSS also on Content Module posts table if ($this->is_edit_page($icon_font_posts) && $icon_font_url) { wp_enqueue_style('wm-fonticons'); } // Allow hooking for dequeuing do_action('wmhook_metabox_' . 'assets_enqueued'); }
/** * Register styles and scripts * * @since 1.0 * @version 1.3.15 * * @access public */ public static function assets_register() { // Helper variables $icon_font_url = WM_Amplifier::fix_ssl_urls(esc_url_raw(apply_filters('wmhook_metabox_' . 'iconfont_url', get_option('wmamp-icon-font')))); $rtl = is_rtl() ? '.rtl' : ''; $vc_backend_dependencies = defined('WPB_VC_VERSION') && version_compare(WPB_VC_VERSION, '4.9', '<') ? array('wpb_js_composer_js_atts', 'wpb_js_composer_js_custom_views') : array('vc-backend-min-js'); // Processing // Styles wp_register_style('wm-radio', WMAMP_ASSETS_URL . 'css/input-wm-radio.css', array(), WMAMP_VERSION, 'screen'); wp_register_style('wm-shortcodes-bb-addon', WMAMP_ASSETS_URL . 'css/shortcodes-bb-addons.css', array(), WMAMP_VERSION, 'screen'); wp_register_style('wm-shortcodes-vc-addon', WMAMP_ASSETS_URL . 'css/shortcodes-vc-addons.css', array(), WMAMP_VERSION, 'screen'); if ($icon_font_url) { wp_register_style('wm-fonticons', $icon_font_url, array(), WMAMP_VERSION, 'screen'); } // Scripts wp_register_script('wm-shortcodes-accordion', WMAMP_ASSETS_URL . 'js/shortcode-accordion.js', array('jquery'), WMAMP_VERSION, true); wp_register_script('wm-shortcodes-parallax', WMAMP_ASSETS_URL . 'js/shortcode-parallax.js', array('jquery', 'jquery-parallax'), WMAMP_VERSION, true); wp_register_script('wm-shortcodes-posts-isotope', WMAMP_ASSETS_URL . 'js/shortcode-posts-isotope.js', array('jquery', 'imagesloaded'), WMAMP_VERSION, true); wp_register_script('wm-shortcodes-posts-masonry', WMAMP_ASSETS_URL . 'js/shortcode-posts-masonry.js', array('jquery', 'imagesloaded'), WMAMP_VERSION, true); wp_register_script('wm-shortcodes-posts-owlcarousel', WMAMP_ASSETS_URL . 'js/shortcode-posts-owlcarousel.js', array('jquery', 'imagesloaded'), WMAMP_VERSION, true); wp_register_script('wm-shortcodes-posts-slick', WMAMP_ASSETS_URL . 'js/shortcode-posts-slick.js', array('jquery', 'imagesloaded'), WMAMP_VERSION, true); wp_register_script('wm-shortcodes-slideshow-owlcarousel', WMAMP_ASSETS_URL . 'js/shortcode-slideshow-owlcarousel.js', array('jquery'), WMAMP_VERSION, true); wp_register_script('wm-shortcodes-tabs', WMAMP_ASSETS_URL . 'js/shortcode-tabs.js', array('jquery'), WMAMP_VERSION, true); wp_register_script('wm-shortcodes-vc-addon', WMAMP_ASSETS_URL . 'js/shortcodes-vc-addons.js', (array) $vc_backend_dependencies, WMAMP_VERSION, true); // 3rd party scripts wp_register_script('isotope', WMAMP_ASSETS_URL . 'js/plugins/isotope.pkgd.min.js', array(), WMAMP_VERSION, true); wp_register_script('jquery-lwtCountdown', WMAMP_ASSETS_URL . 'js/plugins/jquery.lwtCountdown.min.js', array('jquery'), WMAMP_VERSION, true); wp_register_script('jquery-owlcarousel', WMAMP_ASSETS_URL . 'js/plugins/owl.carousel' . $rtl . '.min.js', array('jquery'), WMAMP_VERSION, true); wp_register_script('jquery-parallax', WMAMP_ASSETS_URL . 'js/plugins/jquery.parallax.min.js', array('jquery'), WMAMP_VERSION, true); wp_register_script('slick', WMAMP_ASSETS_URL . 'js/plugins/slick.min.js', array('jquery'), WMAMP_VERSION, true); // Allow hooking for deregistering do_action('wmhook_shortcode_' . 'assets_registered'); }
/** * The main function responsible for returning the plugin instance * to functions everywhere. * * Use this function like you would a global variable, except without * needing to declare the global. * * Example: <?php $wmamp = wm_amplifier(); ?> * * @since 1.0 * @version 1.2.2 * * @return WebMan Amplifier instance */ function wma_amplifier() { // Output return WM_Amplifier::instance(); }
/** * Scripts and styles * * @since 1.0 * @version 1.3.5 * * @access public */ public function assets() { // Helper variables global $current_screen; $icon_font_url = WM_Amplifier::fix_ssl_urls(esc_url_raw(apply_filters('wmhook_metabox_' . 'iconfont_url', get_option('wmamp-icon-font')))); // Processing // Register // Styles wp_register_style('wm-metabox-styles', WMAMP_ASSETS_URL . 'css/metabox.css', false, WMAMP_VERSION, 'screen'); wp_register_style('wm-metabox-styles-rtl', WMAMP_ASSETS_URL . 'css/rtl-metabox.css', false, WMAMP_VERSION, 'screen'); if ($icon_font_url) { wp_register_style('wm-fonticons', $icon_font_url, false, WMAMP_VERSION, 'screen'); } // Scripts wp_register_script('wm-metabox-scripts', WMAMP_ASSETS_URL . 'js/metabox.js', array('jquery', 'jquery-ui-tabs', 'jquery-ui-slider'), WMAMP_VERSION, true); // Allow hooking for deregistering do_action('wmhook_icons_' . 'assets_registered'); // Enqueue (only on admin page) if ('appearance_page_icon-font' == $current_screen->id) { // Styles wp_enqueue_style('wm-fonticons'); wp_enqueue_style('wm-metabox-styles'); if (is_rtl()) { wp_enqueue_style('wm-metabox-styles-rtl'); } // Scripts wp_enqueue_script('media-upload'); wp_enqueue_media(); wp_enqueue_script('wm-metabox-scripts'); } // Allow hooking for dequeuing do_action('wmhook_icons_' . 'assets_enqueued'); }