public static function moveToFolder($file, $folder = "") { //---------------------------------------------------------- $path = FileFolder::getPathFromFile($file) . $folder; //---------------------------------------------------------- $name = FileFolder::getFileName($file, false); //---------------------------------------------------------- FileFolder::createFolderStructure($path); //---------------------------------------------------------- $arr = explode("/", $file); //---------------------------------------------------------- $newFile = $path . $name; //---------------------------------------------------------- rename($file, $newFile); //---------------------------------------------------------- return $newFile; }
public function getFiles($css, $srcPath) { $srcName = FileFolder::getFileName($srcPath); $newFolder = FileFolder::getPathFromFile($this->fileCss) . $srcName . "/"; //--------------------------------------------------------- $origSrcFolder = FileFolder::getPathFromFile($srcPath); //--------------------------------------------------------- preg_match_all('/(url\\(\\"|url\\(\'|url\\(|src=\')(.*?)(\\)|\'|\\")/s', $css, $files); //--------------------------------------------------------- foreach ($files[2] as $file_key => $origFilePath) { $fileAbPath = NULL; $newAbPath = NULL; $origFilePath = Compile::getBetweenQuot($origFilePath); //----------------------------------------------------- if (strpos($origFilePath, "../") !== false) { $goBack = explode("../", $origFilePath); $goBackAmt = sizeof($goBack); $srcFolderArr = explode("/", $origSrcFolder); $fileLocationArr = array_slice($srcFolderArr, 0, -$goBackAmt); $srcFolder = implode($fileLocationArr, "/") . "/"; $filePath = end($goBack); } else { $srcFolder = $origSrcFolder; $filePath = $origFilePath; if (strpos($filePath, "http://") !== false) { $fileAbPath = $filePath; $filePath = FileFolder::getFileName($filePath, false); $newFilePath = $newFolder . $filePath; } } //----------------------------------------------------- $filePath = FileFolder::getFileName($filePath, false, true); //----------------------------------------------------- if (is_null($fileAbPath)) { $fileAbPath = $srcFolder . $filePath; } if (is_null($newAbPath)) { $newAbPath = $newFolder . $filePath; } //----------------------------------------------------- $newFilePath = $srcName . "/" . $filePath; //----------------------------------------------------- if (file_exists(Import::uber_src_path() . $fileAbPath)) { $fileAbPath = Import::uber_src_path() . $fileAbPath; } //----------------------------------------------------- if ($fileContent = file_get_contents($fileAbPath)) { if (!file_get_contents($newAbPath)) { $css = str_replace($origFilePath, $newFilePath, $css); FileFolder::file_put_contents($newAbPath, $fileContent); FileFolder::file_put_contents(Compile::$unminifiedPath . $this->cleanURL($fileAbPath), $fileContent); } } } return $css; }
public function init($obj) { //---------------------------------------------------------- //init var //---------------------------------------------------------- $chk = array("bool" => true, 'result' => array(), "func" => "init"); //---------------------------------------------------------- if (!is_null($obj)) { if (isset($obj['zip'])) { $getFile = GetTable::go("files", array("id" => $obj['zip'])); //------------------------------------------------------ if (!$getFile['bool']) { return $getFile; } if (sizeof($getFile['result']) > 0) { //-------------------------------------------------- $projectName = $obj['project_name']; $hash = $getFile['result'][0]['hash']; $dir_relative = GlobalMas::$filesPath_relative . $hash . "/"; $dir = GlobalMas::$filesPath_absolute . $hash . "/"; $zip_path = $dir . $getFile['result'][0]['name']; $savePath = dirname($zip_path) . "/compile/" . $projectName . "/"; //----------------------------------------------------- Archive::extract($zip_path, $this->extractTo = dirname($zip_path) . "/" . FileFolder::getFileName($zip_path)); //----------------------------------------------------- //if (isset($obj['take_file_name']) && $obj['take_file_name'] == "true") $projectName = FileFolder::getFileName($zip_path); //----------------------------------------------------- $url = GenFun::get_full_url(dirname($zip_path) . "/" . rawurlencode(FileFolder::getFileName($zip_path)) . "/"); //----------------------------------------------------- $bool = $this->htmlExist_CHK($this->extractTo); } } else { if (isset($obj['url']) || is_string($obj)) { $url = isset($obj['url']) ? $obj['url'] : $obj; $bool = $this->htmlExist_CHK($url_local = GenFun::get_local_url($url)); //------------------------------------------------------ $output = CurlUtil::go(array("url" => $url)); $projectName = $this->getTitle($output); //------------------------------------------------------ if (is_null($projectName)) { $projectName = date("YmdHis"); $hash = alphaID(strtotime($projectName)); $projectName = "untitled_" . $projectName; } //------------------------------------------------------ $savePath_relative = $hash . "/" . "compile/" . $projectName . "/"; $savePath = GlobalMas::$filesPath_absolute . $savePath_relative; /*if (isset($obj['take_file_name']) && $obj['take_file_name'] == "true")*/ $useTitle = true; } else { $chk = array(); $chk['bool'] = false; $chk['error'] = true; $chk['message'] = $this->notifications_CFG(["message" => "Url could not be obtained!!!"]); die(json_encode($chk)); } } //--------------------------------------------------------- $compiler = $this->compile_CFG($url, $projectName, $savePath); //--------------------------------------------------------- if (!is_null($compiler->error)) { return $compiler->error; } //--------------------------------------------------------- //$chk['bool'] = true; // $chk['compiler'] = $compiler; $notifications = $compiler->compilerGlobal->notifications; //--------------------------------------------------------- /*if (sizeof($notifications) > 0) { $chk = $this->deleteFile($getFile['result'][0]['id'], true); $chk['message'] = $this->notifications_CFG($notifications); $chk['bool'] = false; $chk['error'] = true; return $chk; }*/ //--------------------------------------------------------- $new_zip_path = Archive::zipDir($compiler->compilePath); //--------------------------------------------------------- $prop = array(); $prop['hash'] = "{hash}"; $prop['url'] = $url; $prop['name'] = $projectName; $prop['dir'] = $savePath_relative; $prop["filesize"] = FileFolder::getFileSize($new_zip_path); if (isset($obj['zip'])) { $prop['files_id'] = $obj['zip']; } //--------------------------------------------------------- $chk = InsertINTO::go("compiles", $prop); //--------------------------------------------------------- $chk['download_link'] = GenFun::get_full_url(Import::$uber_src_path . "server/werm/services/Download.php") . "?url=" . GenFun::get_full_url($new_zip_path); $chk["filesize"] = $prop["filesize"]; $chk["url"] = $url; //--------------------------------------------------------- //$chk['project_location'] = GenFun::get_full_url($compiler->compilePath); } return $chk; }
public function parse_match_post() { //----------------------------------------------------- if (!empty($this->match[1]) || $this->match[1] != "") { $this->src_path_markup = $this->match[1]; $this->src_path = $this->match[2]; /*if (is_null($this->link_compile_file)) { krumo($this->save_path); $this->save_path_relative = Compiler::cleanURL($this->src_path, ""); $this->save_path = $this->compilePath.$this->save_path_relative; krumo($this->save_path); }*/ } //----------------------------------------------------- if (is_null($this->save_path)) { if (!is_null($this->content)) { if (!file_exists($this->src_path) && !CurlUtil::is_url_exist($this->src_path)) { $this->markup_CFG(); $this->inline = true; $this->save_path_relative = $this->savePath_CFG() . "inline_" . $this->index . "." . $this->saveas_ext; $this->save_path = $this->compilePath . $this->save_path_relative; } else { $path = is_null($this->save_dir) ? Compiler::cleanURL(FileFolder::getFileName($this->src_path, true, true)) : $this->save_dir . FileFolder::getFileName($this->src_path, true); $path = $this->removeModified($path); $this->save_path_relative = $path . "." . $this->saveas_ext; $this->save_path = $this->compilePath . $this->save_path_relative; //krumo(basename($this->save_path)); } } } //----------------------------------------------------- /*if (!is_null($this->replacePath) && !is_null($this->save_path)) { foreach ($this->replacePath as $key => $value) { $this->save_path_relative = str_replace($key, $value, $this->save_path_relative); $this->save_path = str_replace($key, $value, $this->save_path); } }*/ //----------------------------------------------------- /*if (!is_null($this->str_replace_silent)) { foreach ($this->str_replace_silent as $key => $value) { $txt = str_replace($key, $value, $txt); } }*/ //----------------------------------------------------- //if ($this->compileType == "seperate") { //} //----------------------------------------------------- if (!is_null($this->content)) { $prop = array("src_content" => $this->content, "compilerGlobal" => $this->compilerGlobal, "forceDownload" => $this->forceDownload, "src_content_type" => $this->codeType, "src_dir" => !is_null($this->src_path) ? dirname($this->src_path) . "/" : $this->src_path, "src_save_dir" => !is_null($this->save_path_relative) ? dirname($this->save_path_relative) . "/" : $this->save_path_relative, "compilePath" => $this->compilePath); //krumo($this->content); //--------------------------------------------- $this->images = new Compile_Images($prop); //--------------------------------------------- SetPublicProp::go($this->images, $this->imagesProp); //--------------------------------------------- SetPublicProp::go($this->images, $this->filesObj, false); //--------------------------------------------- $this->images->init(); $this->content_updated = $this->images->src_content_updated; if ($this->removeInline && !is_null($this->output_updated)) { $replaceWith = $this->onRemoveMatch_CHK("code"); $this->output_updated = str_replace($this->match[0], $replaceWith, $this->output_updated); } } //----------------------------------------------------- }
public static function getCompile_id() { $compile_id = FileFolder::getFileName($_SERVER["SCRIPT_FILENAME"]); //--------------------------------------------------------- if (isset($_GET['pageID'])) { $compile_id = $_GET['pageID']; } //--------------------------------------------------------- return $compile_id; }
<?php require_once "Import.php"; include Import::$uber_src_path . FileFolder::getFileName(__FILE__, false);
//Global.loggedIN = 1; Trace.externalCall = false; TweenEngine.activate(TweenLite); obj = new Nav({ initComplete:nav_complete }); } //------------------------------------------------------------------------------------- function nav_complete(e) { e.targetClass.start(); //$("#content").css({top:e.targetClass.height + 20, "margin-left":-(e.targetClass.nav_1.width/2)}); if (window['start'] != undefined) start(); } </script> <?php $folder = FileFolder::getFileName(basename($_SERVER["SCRIPT_FILENAME"])); if ($folder == "index") { $folder = "home"; } Import::current("global/js/{$folder}/{$folder}.php", ["notExistException" => false]); ?> <!--===============================================================--> <?php Import::css("index.scss", ["wUber" => false]); Import::css("{$folder}.scss", ["wUber" => false, "notExistException" => false]); ?> <!--===============================================================--> <?php Import::js("client/Respond-master/respond.js"); if (file_exists("ProjectGlobalJS.php")) { include "ProjectGlobalJS.php";
public static function newPath_CFG($file) { return GlobalMas::$filesPath_absolute . "import/" . FileFolder::getFileName($file, true, true); }
public function getAllContent($arr, $type, $minify) { $txt = ""; $import = ""; foreach ($arr as $value) { $content = $this->getFileContent($type, $value, $minify); //--------------------------------------------------------- if ($this->isPropSet($this->code[$type], "type", "seperate")) { $file = $value['file']; $file = str_replace(array(Import::uber_src_path(), Import::getImportPath()), "", $file); //----------------------------------------------------- $path = $this->isPropSet($this->code[$type], "path", NULL) ? FileFolder::getFileName($file, true, true) : $this->code[$type]['path'] . FileFolder::getFileName($file, true); $file = $path . ($type == "tmpl" ? "_tmpl.html" : ".{$type}"); if (!is_null($value['file']) && is_null($value['ex']) && $this->isPropSet($this->code[$type], "type", "seperate")) { //$import .= $this->getExtLink($file).PHP_EOL; /*krumo($this->code[$type]); krumo($file); krumo($type); krumo($value);*/ //krumo($value); //krumo($file); FileFolder::file_put_contents($this->path . $file, $content); } } /*else if (!is_null($value['ex']) && $this->isPropSet($this->code[$type], "forceDownload", NULL)) { $txt .= $this->getExtLink($value['file']).PHP_EOL; //$this->import .= $value['ex']; }*/ $txt .= $content; } if ($this->code[$type]["createImportFile"]) { $import_path = NULL; //----------------------------------------------------- if (is_array($this->code[$type]["createImportFile"]) && isset($this->code[$type]["createImportFile"])) { if (isset($this->code[$type]["createImportFile"]["path"])) { $import_path = $this->code[$type]["createImportFile"]["path"]; } } //----------------------------------------------------- $import_path = $this->path . (is_null($import_path) ? $this->compiler->compile_id . "_" . $type . "_import.php" : $import_path); FileFolder::file_put_contents($import_path, $import); } /*else { $this->import .= $import; }*/ return $txt; }