Пример #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']);
     }
 }
Пример #2
0
 /**
  * Register MultiContentList scripts
  */
 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--multilist', $base_url . '/multilist/css/bebop-ui--multilist', ['bebop-ui']);
     // Register development JS
     if (defined('BEBOP_DEV_ENV_ENABLED') && BEBOP_DEV_ENV_ENABLED) {
         $js->register('bebop-ui--multilistView', $base_url . '/multilist/js/views/MultiList');
         $js->register('bebop-ui--multilist', $base_url . '/multilist/js/bebop-ui--multilist', ['jquery', 'jquery-ui-tabs', 'bebop-ui--multilistView']);
     } 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--multilist', $base_url . '/multilist/js/bebop-ui--multilist.min', ['jquery', 'jquery-ui-tabs']);
     }
 }
Пример #3
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--list', $base_url . '/list/css/bebop-ui--list', ['bebop-ui', 'bebop-ui--media']);
     // Register development JS
     if (defined('BEBOP_DEV_ENV_ENABLED') && BEBOP_DEV_ENV_ENABLED) {
         $js->register('bebop-ui--listView', $base_url . '/list/js/views/List');
         $js->register('bebop-ui--listItemView', $base_url . '/list/js/views/ListItemView');
         $js->register('bebop-ui--listItemModel', $base_url . '/list/js/models/ListItemModel');
         $js->register('bebop-ui--listCollection', $base_url . '/list/js/collections/ListCollection');
         $js->register('bebop-ui--list', $base_url . '/list/js/bebop-ui--list', ['jquery', 'jquery-ui-sortable', 'underscore', 'backbone', 'mustache', 'bebop-ui--media', 'bebop-ui--listView', 'bebop-ui--listItemView', 'bebop-ui--listItemModel', 'bebop-ui--listCollection']);
     } 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--list', $base_url . '/list/js/bebop-ui--list.min', ['jquery', 'jquery-ui-sortable', 'underscore', 'backbone', 'mustache', 'bebop-ui--media']);
     }
 }
Пример #4
0
 /**
  * Creates Bebop shortcode for usage inside content editor
  * 
  * @param  array   $attrs    Shortcode attributes
  * @param  string  $content  Shortcode content
  * @return void
  */
 public function __bebopShortcodes($attrs, $content = null)
 {
     if ($attrs) {
         if (array_key_exists('url', $attrs)) {
             return UrlManager::getInstance()->get($attrs['url']);
         }
         if (array_key_exists('path', $attrs)) {
             return PathManager::getInstance()->get($attrs['path']);
         }
     }
 }
Пример #5
0
 /**
  * Builds configuration item
  * 
  * @return object Current object
  */
 public function build()
 {
     UrlManager::getInstance()->set($this->getId(), $this->config->get('url'));
 }
 /**
  * Registers all scripts
  * 
  */
 protected function __registerScripts()
 {
     foreach ($this->register_list->getAll() as $script_id) {
         if ($this->scripts->hasKey($script_id)) {
             $base_url = $this->getBaseUrl();
             if (!$base_url) {
                 $this->setBaseUrl(UrlManager::getInstance()->get('theme'));
                 $base_url = $this->getBaseUrl();
             }
             $script_obj = $this->scripts->get($script_id);
             if ($base_url && !$script_obj->getBaseUrl()) {
                 $script_obj->setBaseUrl($base_url);
             }
             $script_obj->register();
         }
     }
     return $this;
 }