more quote identeiifers fixessss
[Pman.Core] / AssetTrait.php
index 2d4b900..5199ef2 100644 (file)
@@ -32,7 +32,9 @@ trait Pman_Core_AssetTrait {
                     $ar = array_merge($ar ,  glob($dir . '/'. $f));
                     continue;
                 }
-                
+                if (!preg_match('/\.js$/', $f)) {
+                    $f .= ".js";
+                }
                 $ar[] = $dir .'/'. $f;
             }
           
@@ -54,6 +56,9 @@ trait Pman_Core_AssetTrait {
         $mtime = 0;
         foreach($ar as $fn) {
             $f = basename($fn);
+            if (!preg_match('/\.js$/', $f) || $fn == '.js' || !file_exists($dir . '/' . $f)) { // only javascript files... (so XXX.Dialog.YYY*  works..)
+                continue;
+            }
             // got the 'module file..'
             $mtime = filemtime($dir . '/'. $f);
             $maxtime = max($mtime, $maxtime);
@@ -63,23 +68,17 @@ trait Pman_Core_AssetTrait {
         
         ksort($arfiles); // just sort by name so it's consistant for serialize..
         
-        $ui = posix_getpwuid(posix_geteuid());
-       
-        
-        $compiledir = session_save_path() . '/' .
-                $ui['name'] . '-' . $ff->project . '-' . $ff->version . '-jscompile';
-        
-        if (!file_exists($compiledir)) {
-            mkdir($compiledir,0700,true);
-        }
+        require_once 'Pman/Core/Asset.php';
+        $compiledir = Pman_Core_Asset::getCompileDir('js', '', true);
         
          
         
-        $lsort = create_function('$a,$b','return strlen($a) > strlen($b) ? 1 : -1;');
+        $lsort = function($a,$b) { return strlen($a) > strlen($b) ? 1 : -1; };
         usort($files, $lsort);
         
+        $ff = HTML_FlexyFramework::get();
         
-        if (!empty($this->bootLoader->isDev) && !empty($_REQUEST['isDev'])) {
+        if (!empty($ff->Pman['isDev']) && !empty($_REQUEST['isDev'])) {
             echo "<!-- Javascript compile turned off (isDev on) -->\n";
             $this->assetArrayToHtml($files,'js');
             return;
@@ -90,7 +89,8 @@ trait Pman_Core_AssetTrait {
         
         $output = date('Y-m-d-H-i-s-', $maxtime). $smod .'-'.md5(serialize($arfiles)) .'.js';
          
-         
+        
+        
         
         // where are we going to write all of this..
         // This has to be done via a 
@@ -212,13 +212,11 @@ trait Pman_Core_AssetTrait {
         
          
         //print_r($relfiles);
+      
+        require_once 'Pman/Core/Asset.php';
+        $compiledir = Pman_Core_Asset::getCompileDir('css', '', true);
         
-        $ui = posix_getpwuid(posix_geteuid());
-       
-        
-        $compiledir = session_save_path() . '/' .
-                $ui['name'] . '-' . $ff->project . '-'. $ff->version . '-csscompile';
-        
+         
         if (!file_exists($compiledir)) {
             mkdir($compiledir,0700,true);
         }
@@ -227,12 +225,18 @@ trait Pman_Core_AssetTrait {
         
         
         // yes sort... if includes are used - they have to be in the first file...
-        $lsort = create_function('$a,$b','return strlen($a) > strlen($b) ? 1 : -1;');
+        $lsort = function($a,$b ) {
+                return strlen($a) > strlen($b) ? 1 : -1;
+        };
         usort($files, $lsort);
         usort($relfiles,$lsort);
-        print_R($relfiles);
+       // print_R($relfiles);
+        
+        $ff = HTML_FlexyFramework::get();
         
-        if (!empty($this->bootLoader->isDev) && !empty($_REQUEST['isDev'])) {
+        // isDev set
+        
+        if ((!empty($ff->Pman['isDev']) || $_SERVER['HTTP_HOST'] == 'localhost' )&& !empty($_REQUEST['isDev'])) {
             echo "<!-- CSS compile turned off (isDev on) -->\n";
             $this->assetArrayToHtml($files,'css');
             return;
@@ -241,13 +245,13 @@ trait Pman_Core_AssetTrait {
         
         $smod = str_replace('/','.',$path);
         
-        $output = date('Y-m-d-H-i-s-', $maxtime). $smod .'-'.md5(serialize($arfiles)) .'.css';
+        $output = date('Y-m-d-H-i-s-', $maxtime). $smod .'-'.md5(serialize(array($this->baseURL, $arfiles))) .'.css';
          
-         $asset = $ff->project == 'Pman' ? '/Core/Asset/css/' : '/Asset/css/';
+        $asset = $ff->project == 'Pman' ? '/Core/Asset/css/' : '/Asset/css/';
         
         // where are we going to write all of this..
         // This has to be done via a 
-        if (!file_exists($compiledir.'/'.$output) || !filesize($compiledir.'/'.$output)) {
+        if ( !file_exists($compiledir.'/'.$output) || !filesize($compiledir.'/'.$output)) {
             
             //print_r($relfiles);