function onAfterRender() { $isDebug=false; $css=$this->param('css'); $javascript=$this->param('javascript'); if(!$css&&!$javascript){ return true; } // Only render for the front site $app =& JFactory::getApplication(); if($app->getName() != 'site') { return true; } $document =& JFactory::getDocument(); $doctype = $document->getType(); // Only render for HTML output if ( $doctype != 'html' ) { return; } //excludeComponents $excludeComponents=$this->param('excludeComponents'); if(isset($excludeComponents)&&$excludeComponents){ $components=@explode(',',$excludeComponents); $option=JRequest::getVar('option'); if(isset($option)&&in_array($option,$components)){ return true; } } //gzip checking $isGZ=$this->param('gzip'); if($isGZ){ $encoding = JResponse::_clientEncoding(); if (!$encoding){ $isGZ=false; } if (!extension_loaded('zlib') || ini_get('zlib.output_compression')) { $isGZ=false; } } $body = JResponse::getBody(); $isok=true; $compressor=new jsCssCompressor(); $baseUrl=JURI::base(true).'/'; if($javascript){ $scriptRegex="/<script [^>]+(\/>|><\/script>)/i"; $jsRegex="/([^\"\'=]+\.(js))[\"\']/i"; preg_match_all($scriptRegex, $body, $matches); $scripts=@implode('',$matches[0]); preg_match_all($jsRegex,$scripts,$matches); $scriptFiles= array(); foreach($matches[1] as $script){ if(isInternal($script)){ //if $baseurl=='/'; may need specail handle $parts=@explode( JURI::base(),$script); if(count($parts)>1&&endwith($parts[1],'.js')){ $script=JPATH_ROOT.DS.$parts[1]; $script=replaceSperator($script); $scriptFiles[]=$script; }else if(endwith($script,'.js')){ $script=$_SERVER['DOCUMENT_ROOT'].DS.$script; $script=replaceSperator($script); if(file_exists($script)){ $scriptFiles[]=$script; }else{ $script=JPATH_ROOT.DS.$script; $script=replaceSperator($script); if(file_exists($script)){ $scriptFiles[]=$script; } } } } } $scriptFiles=array_unique($scriptFiles); $customOrder=$this->param('customOrder'); $jqueryNoConflict=$this->param('jqueryNoConflict'); $jquery=$this->param('jquery'); $exclude=$this->param('excludeJs'); $excludeJs=array(); if(isset($exclude)&&$exclude){ $excludeJs=@explode(',',$exclude); } $predefinedExcludeJs=array('xajax.js','script.js','tiny_mce.js','com_community/assets/toolbar.js'); $excludeJs=@array_merge($excludeJs,$predefinedExcludeJs); $mappedScripts=array(); foreach($scriptFiles as $sf){ $file=strrchr($sf,DS); if(isset($file)){ $file=substr($file,1); $mappedScripts[trim($file)]=$sf; } } $firstScripts=explode(',',$customOrder); $orderedScripts=array(); foreach($firstScripts as $fs){ $fs=trim($fs); if(array_key_exists($fs,$mappedScripts)){ $orderedScripts[]=$mappedScripts[$fs]; } } //append all js, ignore customorded files foreach($scriptFiles as $sf){ if(!in_array($sf,$orderedScripts)){ $orderedScripts[]=$sf; } } if(isset($jquery)&&isset($mappedScripts[$jquery])){
Vous vous apprêtez à déplacer <b><?php echo $fileName; ?> </b>, dans quel répertoire souhaitez-vous le placer ? </p> <form method='POST' enctype="multipart/form-data"> <?php echo $formList; ?> <label> Existant : <select name="select"> <?php foreach ($dirs as $dirPath) { echo '<option value="' . htmlentities($dirPath) . '">' . fileName($dirPath) . '</option>'; } ?> </select> </label> <input type="submit" value="Déplacer"/> </form> <form method='POST' enctype="multipart/form-data"> <?php echo $formList; ?> <label> Nouveau : <input type="text" name="new" /> </label> <input type="submit" value="Déplacer"/> </form>
function getMethod($args) { $base = fileName(PACKAGEDIR, str_replace('.', '/', $args->methodName)); return array('body' => $this->trimContents($base)); }
function generateClass($package, $class, $language = 'PHP') { $languageClass = 'PHOS_' . $language; $language = new $languageClass(); //make sure class exists $classDir = fileName(PACKAGEDIR, $package, CLASSDIR, $class); if (!file_exists($classDir)) { throw new Exception("{$classDir} does not appear to exist"); } $definition = array('extend' => false, 'implement' => false, 'mixin' => false); foreach ($definition as $dname => $val) { $dfile = fileName($classDir, $dname); if (file_exists($dfile)) { $definition[$dname] = array_map('trim', explode(',', trim(file_get_contents($dfile)))); } } //get the properties, based on type build constructor $properties = loadProperties($classDir); //get the methods $methods = loadMethods($classDir); //start the file $file = $language->startClass($class, $definition); if ($definition['mixin']) { //load mixin methods and properties foreach ($definition['mixin'] as $module) { $moduleDir = fileName(PACKAGEDIR, $package, MODULEDIR, $module); $properties = array_merge($properties, loadProperties($moduleDir)); $methods = array_merge($methods, loadMethods($moduleDir)); } } //build the construct method based on the private propeties $constructor = ''; foreach ($properties as $property) { $file .= $language->addProperty($property); $constructor .= $language->selfAssign($property, $language->newObject($property->type, $property->default)); } $file .= "\n"; $methods[$language->constructorName] = (object) array('name' => $language->constructorName, 'scope' => 'public', 'args' => '()', 'body' => $constructor); foreach ($methods as $method) { $file .= $language->method($method); } //write file file_put_contents(fileName(GENERATEDIR, "class.{$class}.php"), $file . '}'); }
} else { $fileIds = array(); if (isset($_GET["grouped"])) { if (isset($_POST['selection'])) { foreach ($_POST['selection'] as $md5) { $fileIds[] = $md5; } } else { throw new Exception("No selection provided."); } } else { $fileIds[] = $_GET['md5']; } $fileName = ""; foreach ($fileIds as $md5) { $fileName .= fileName(getPathForMD5Chain(DOWNLOADS_DIR, $md5)) . ' + '; } $fileName = substr($fileName, 0, strlen($fileName) - 3); $title = TITLE . " - Supprimer " . $fileName; $formList = ""; foreach ($fileIds as $md5) { $formList .= '<input type="hidden" name="ids[]" value="' . $md5 . '"/>'; } $formList .= '<input type="hidden" name="confirmed"/>'; $formList .= '<input type="hidden" name="referer" value="' . $_SERVER['HTTP_REFERER'] . '"/>'; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> <html> <head> <title><?php
var schematicId = <?php id(); ?> ; var noRedirect = <?php noRedirect(); ?> ; if (!noRedirect) { window.location.href = './?noRedirect=true&downloadId=' + schematicId; } } </script> <img src="../images/icons/download-2.png" /> <p>You are downloading <b><?php fileName(); ?> </b> which was uploaded by <b><?php author(); ?> </b> using <a href="../">Mordritch's Javascript Redstone Simulator</a>.</p> <p>If the download does not start automatically, click <a href="./?downloadId=<?php id(); ?> ">here</a>.</p> <p>You can also view/edit the schematic online <a href="../#<?php id(); ?> ">here</a> from inside your web browser.</p> </div> <?php
function getMD5ChainForPath($filePath, $originPath) { $filePath = realpath($filePath); $originPath = realpath($originPath); if (strpos($filePath, $originPath) === false) { debug_print_backtrace(); die("Les chemins ne correspondent pas : <i>" . $filePath . "</i> n'a pas l'origine <i>" . $originPath . "</i>"); } if ($filePath == $originPath) { return ""; } else { $dirPath = dirname($filePath); $file = fileName($filePath); $md5Chain = getMD5ChainForPath($dirPath, $originPath); $md5Parts = explode("-", $md5Chain); array_push($md5Parts, md5($file)); $md5Parts = array_filter($md5Parts, "notNull"); return count($md5Parts) > 1 ? implode("-", $md5Parts) : array_pop($md5Parts); } }