Beispiel #1
0
 /**
  * Register common scripts for UI plugins
  * 
  * @return void
  */
 public function registerScripts()
 {
     $base_url = UrlManager::getInstance()->get('_bebop/static/ui');
     $css = Css::getInstance()->getHook('back');
     $js = Js::getInstance()->getHook('back');
     //////////////////
     // Register CSS //
     //////////////////
     // VENDOR
     $css->register('jquery.select2', $base_url . '/core/css/vendor/select2.min');
     // CORE
     $css->register('bebop-ui', $base_url . '/core/css/bebop-ui', ['jquery.select2']);
     /////////////////
     // Register JS //
     /////////////////
     // VENDOR
     $js->register('jquery.debounce', $base_url . '/core/js/vendor/jquery.ba-throttle-debounce.min', ['jquery']);
     $js->register('jquery.select2', $base_url . '/core/js/vendor/select2.full.min');
     // Development JS
     if (defined('BEBOP_DEV_ENV_ENABLED') && BEBOP_DEV_ENV_ENABLED) {
         // VENDOR
         $js->register('mustache', $base_url . '/core/js/vendor/mustache');
         // CORE
         $js->register('bebop-ui', $base_url . '/core/js/bebop-ui', ['underscore', 'jquery', 'jquery-ui-datepicker', 'jquery.debounce', 'jquery.select2']);
     } else {
         // VENDOR
         // Mustache is optimized separately
         // so that other components can load it only if needed
         $js->register('mustache', $base_url . '/core/js/vendor/mustache.min');
         // CORE
         // The following dependencies should never be concatenated and minified
         // These are used by other WordPress features and plugins
         $js->register('bebop-ui', $base_url . '/core/js/bebop-ui.min', ['underscore', 'jquery', 'jquery-ui-datepicker', 'jquery.select2']);
     }
 }
Beispiel #2
0
 /**
  * Registers stylesheets and scripts
  * 
  * @return void
  */
 public function registerScripts()
 {
     $base_url = UrlManager::getInstance()->get('_bebop/static/ui');
     $css = Css::getInstance()->getHook('back');
     $js = Js::getInstance()->getHook('back');
     // Register CSS
     $css->register('bebop-ui--media', $base_url . '/media/css/bebop-ui--media', ['bebop-ui']);
     // Register development JS
     if (defined('BEBOP_DEV_ENV_ENABLED') && BEBOP_DEV_ENV_ENABLED) {
         $js->register('bebop-ui--mediaView', $base_url . '/media/js/views/Media');
         $js->register('bebop-ui--media', $base_url . '/media/js/bebop-ui--media', ['jquery', 'jquery-ui-sortable', 'underscore', 'backbone', 'bebop-ui', 'mustache', 'bebop-ui--mediaView']);
     } else {
         // The following dependencies should never be concatenated and minified
         // Some are use by other WordPress features and plugins
         // and other are register by Bebop UI
         $js->register('bebop-ui--media', $base_url . '/media/js/bebop-ui--media.min', ['jquery', 'jquery-ui-sortable', 'underscore', 'backbone', 'bebop-ui', 'mustache']);
     }
 }
 /**
  * Register all CSS and JS
  *
  * @return void
  */
 public function __registerScripts()
 {
     $config = Config::getInstance();
     // Register JS
     $js = Js::getInstance();
     $js_dependencies = ['jquery', 'backbone', 'underscore'];
     // Check if development environment is enabled and get correct file name to load
     $main_js_name = $config->get('dev_env_enabled') ? 'bebop-media.js' : 'bebop-media.min.js';
     $js->getHook('back')->register('bebop-media', $config->get('plugin_base_url') . 'assets/js/' . $main_js_name, $js_dependencies)->enqueue('bebop-media');
     // Register CSS
     $css = Css::getInstance();
     $css->getHook('back')->register('bebop-media', $config->get('plugin_base_url') . 'assets/css/bebop-media.css')->enqueue('bebop-media');
 }
 /**
  * Enqueues scripts that MultiContentList needs
  * 
  */
 public function enqueueScripts()
 {
     Css::getInstance()->getHook('back')->enqueue('bebop-ui--multilist');
     Js::getInstance()->getHook('back')->enqueue('bebop-ui--multilist');
 }
Beispiel #5
0
 /**
  * Enqueues stylesheets and scripts
  * 
  * @return void
  */
 public function enqueueScripts()
 {
     global $wp_version;
     if (version_compare($wp_version, '4.0', '>=')) {
         wp_enqueue_media();
     } elseif (version_compare($wp_version, '3.5', '>=')) {
         // Enqueue media scripts ONLY if needed
         add_action('admin_enqueue_scripts', function () {
             if (!did_action('wp_enqueue_media')) {
                 wp_enqueue_media();
             }
         });
     } else {
         // Handle WordPress lower than 3.5
     }
     Css::getInstance()->getHook('back')->enqueue('bebop-ui--list');
     Js::getInstance()->getHook('back')->enqueue('bebop-ui--list');
 }
Beispiel #6
0
 /**
  * Returns the Scripts manager instance
  * or the target registration hook
  */
 public static function CSS($hook_id = null)
 {
     $scripts = Css::getInstance();
     return $hook_id ? $scripts->getHook($hook_id) : $scripts;
 }