public function setPath($dir) { if (is_dir($dir)) { $this->_dir = path_correct($dir, true); } return $this; }
function wasp_mkdir($path, $mode = 0755) { $path = path_correct($path); if (!empty($path) && is_string($path) && !is_dir($path)) { if (!mkdir($path, $mode, true)) { wasp_error('Can not create directory: ' . $path, 500); } @chmod($path, $mode); } }
foreach ($path_array as $path_value) { if ($path_value != "." && $path_value != "..") { $path_tmp = $path_tmp . "/" . $path_value; if (file_exists($path_tmp) === false) { @ftp_mkdir($conn_id, ftp_path_correct($path_tmp)); } } } ftp_close($conn_id); } return $path_tmp . "/" . $file_name; } if ($text) { //tmp is saved $arr = explode("/", path_correct($path)); if ($arr[0] !== path_correct($_SESSION['root_admin_dir']) && $arr[0] !== path_correct(path_tmp())) { $path_parts = pathinfo(tmp_path_create($path)); $path_tmp_ver = $path_parts['dirname'] . "/" . $path_parts['filename']; $ext = $path_parts['extension']; $path_tmp = $path_tmp_ver . "_version1." . $ext; //******************************** if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { //rename last 5 versions for ($i = 4; $i > 0; $i--) { $path_tmp_ver_i = $path_tmp_ver . "_version" . $i . "." . $ext; if (file_exists($path_tmp_ver_i)) { @rename($path_tmp_ver_i, $path_tmp_ver . "_version" . ($i + 1) . "." . $ext); } } $handle = @fopen($path_tmp, "w"); } else {
/** * Добавление JS скрипта * * @param string $js_filename * @param bool $head - в заголовке <HEAD> или перед </BODY> * @return Theme */ public function useThemeJs($js_filename, $head = true) { $js_file_path = path_correct($this->getThemePath() . DIR_SEP . 'js' . DIR_SEP . $js_filename); if (is_file($js_file_path)) { $position = $head === false ? 'body' : 'head'; if (!is_array($this->_js_list[$position])) { $this->_js_list[$position] = []; } $this->_js_list[$position][] = $js_filename; } return $this; }