コード例 #1
0
ファイル: CoreUtils.php プロジェクト: ponydevs/MLPVC-RR
 /**
  * Analyzes a file path and creates the filder structure necessary to sucessfully store it
  *
  * @param string $path Path to analyze
  *
  * @return bool Whether the folder was sucessfully created
  */
 static function createUploadFolder(string $path) : bool
 {
     $DS = RegExp::escapeBackslashes('\\/');
     $folder = preg_replace(new RegExp("^(.*[{$DS}])[^{$DS}]+\$"), '$1', preg_replace(new RegExp('$DS'), '\\', $path));
     return !is_dir($folder) ? mkdir($folder, 0777, true) : true;
 }
コード例 #2
0
ファイル: RegExpTest.php プロジェクト: ponydevs/MLPVC-RR
 function testEscapeBackslashes()
 {
     $result = RegExp::escapeBackslashes('\\');
     self::assertEquals('\\\\', $result);
 }