Example #1
0
 /**
  *     *
  * @param string $source
  * @param string $destination
  * @return bool
  */
 public static function copy($source, $destination)
 {
     $destination = Sobi::FixPath(str_replace('\\', '/', $destination));
     $path = explode('/', str_replace(array(SOBI_ROOT, str_replace('\\', '/', SOBI_ROOT)), null, $destination));
     $part = SOBI_ROOT;
     $i = count($path);
     // yeah I know ... shame on me :(
     while (!@$path[$i]) {
         unset($path[$i--]);
     }
     array_pop($path);
     if (!is_string($path) && count($path)) {
         foreach ($path as $dir) {
             $part .= "/{$dir}";
             if ($dir && !file_exists($part)) {
                 self::mkdir($part);
             }
         }
     }
     if (!is_dir($source)) {
         return Jfile::copy(self::clean($source), self::clean($destination));
     } else {
         return Jfolder::copy(self::clean($source), self::clean($destination));
     }
 }