[PLUGINS] ~maj Crayons
[lhc/web/www.git] / www / plugins / crayons / crayons.js_fonctions.php
index e427f9e..17c8e3e 100644 (file)
@@ -1,46 +1,48 @@
 <?php
 /**
- * Crayons 
- * plugin for spip 
+ * Crayons
+ * plugin for spip
  * (c) Fil, toggg 2006-2013
  * licence GPL
  *
  */
 
-if (!defined("_ECRIRE_INC_VERSION")) return;
+if (!defined('_ECRIRE_INC_VERSION')) {
+       return;
+}
 
 //
 // Les crayons ont leur propre copie du pack de Dean Edwards
 // pour compatibilite avec SPIP < [9717]
 //
-
 function pack_cQuery($chemin) {
+       if (!$chemin) {
+               return;
+       }
+
        $flux = spip_file_get_contents($chemin);
        $flux = str_replace('jQuery', 'cQuery', $flux);
        $flux = str_replace('cQuery.spip', 'jQuery.spip', $flux);
 
        // On ne compacte PAS deux fois (c'est inutile et en plus ca bugge)
        if (!strlen($flux)
-       // mode debug des crayons
-       OR _request('debug_crayons')
-       // le vieil auto_compress_js
-       OR ($GLOBALS['meta']['auto_compress_js'] == 'oui'
-       AND @file_exists(_DIR_RESTREINT.'inc/compacte_js.php'))
-       // ou l'espace prive
-       OR !function_exists('test_espace_prive')
-       OR test_espace_prive())
+               or _request('debug_crayons') // mode debug des crayons
+               or ($GLOBALS['meta']['auto_compress_js'] == 'oui'       // le vieil auto_compress_js
+               and @file_exists(_DIR_RESTREINT.'inc/compacte_js.php'))
+               or !function_exists('test_espace_prive')// ou l'espace prive
+               or test_espace_prive()) {
                return $flux;
+       }
 
        include_spip('lib/JavaScriptPacker/class.JavaScriptPacker');
        $packer = new JavaScriptPacker($flux, 0, true, false);
 
        // en cas d'echec (?) renvoyer l'original
-       if (strlen($t = $packer->pack()))
+       if (strlen($t = $packer->pack())) {
                return $t;
+       }
 
        // erreur
        spip_log('erreur de pack_js');
        return $flux;
 }
-
-?>