示例#1
0
文件: Js.php 项目: nabble/ajde-core
 public function __construct()
 {
     $this->setType(Resource::TYPE_JAVASCRIPT);
     parent::__construct();
 }
示例#2
0
文件: Css.php 项目: nabble/ajde-core
 public function __construct()
 {
     $this->setType(Resource::TYPE_STYLESHEET);
     parent::__construct();
 }
示例#3
0
文件: Html.php 项目: nabble/ajde-core
 public function renderCompressedResources(array $types = array('*'))
 {
     // Reset compressors
     $this->_compressors = array();
     $linkCode = array(self::RESOURCE_POSITION_FIRST => '', self::RESOURCE_POSITION_DEFAULT => '', self::RESOURCE_POSITION_LAST => '');
     foreach ($this->getResources() as $resource) {
         /* @var $resource Ajde_Resource */
         if (current($types) == '*' || in_array($resource->getType(), $types)) {
             if ($resource instanceof Local && !$resource->hasNotEmpty('arguments')) {
                 if (!isset($this->_compressors[$resource->getType()])) {
                     $this->_compressors[$resource->getType()] = Compressor::fromType($resource->getType());
                 }
                 $compressor = $this->_compressors[$resource->getType()];
                 /* @var $compressor Ajde_Resource_Local_Compressor */
                 $compressor->addResource($resource);
             } else {
                 $linkCode[$resource->getPosition()] .= $resource->getLinkCode() . PHP_EOL;
             }
         }
     }
     foreach ($this->_compressors as $compressor) {
         $resource = $compressor->process();
         $linkCode[self::RESOURCE_POSITION_DEFAULT] .= $resource->getLinkCode() . PHP_EOL;
     }
     return $linkCode[self::RESOURCE_POSITION_FIRST] . $linkCode[self::RESOURCE_POSITION_DEFAULT] . $linkCode[self::RESOURCE_POSITION_LAST];
 }