예제 #1
0
파일: Assets.php 프로젝트: eok8177/shopCMS
 /**
  * @param $namespace
  * @return $this
  */
 private function _set_namespace($namespace)
 {
     $this->_namespaces_list = isset($this->_namespaces_list) ? $this->_namespaces_list : [];
     if (empty($namespace)) {
         $namespace = self::$namespace = 'app';
     }
     if (array_key_exists($namespace, $this->_namespaces_list)) {
         self::$scripts = $this->_namespaces_list[$namespace][self::SCRIPTS];
         self::$styles = $this->_namespaces_list[$namespace][self::STYLES];
     } else {
         $this->_namespaces_list[$namespace] = [self::STYLES => [], self::SCRIPTS => []];
         self::$priority[$namespace] = [self::STYLES => 0, self::SCRIPTS => 0];
         self::$scripts = [];
         self::$styles = [];
     }
     return $this;
 }
예제 #2
0
파일: baz.php 프로젝트: arrounded/assets
<?php

echo Assets::styles('global');
?>

<?php 
echo Assets::scripts('global');
예제 #3
0
 /**
  * Adds a file to be the CSS queue to be rendered out.
  *
  * @access public
  * @static
  *
  * @param mixed  $style The style(s) to be added
  * @param string $media The type of media the stylesheet styles.
  * @param bool	 $prepend If true, the file(s) will be added to the beginning of the style array
  *
  * @return void
  */
 public static function add_css($style = null, $media = 'screen', $prepend = FALSE)
 {
     if (empty($style)) {
         return;
     }
     //Debugging issues with media being set to 1 on module_js
     if ($media == '1') {
         $media = 'screen';
     }
     $style_array = array();
     // Add a string
     if (is_string($style)) {
         $style_array[] = array('file' => $style, 'media' => $media);
     } else {
         if (is_array($style) && count($style)) {
             foreach ($style as $s) {
                 $style_array[] = array('file' => $s, 'media' => $media);
             }
         }
     }
     if ($prepend) {
         self::$styles = array_merge($style_array, self::$styles);
     } else {
         self::$styles = array_merge(self::$styles, $style_array);
     }
 }