Commit 3e9b4e4d authored by Sigrid Suski's avatar Sigrid Suski

use error instead of txt

parent 542f01dd
......@@ -145,7 +145,7 @@ class File
return $this->_filename;
}
else {
throw new Exception( Framework::Txt( 'CANNOT_UPLOAD_FILE_TO', str_replace( C::ROOT, null, $destination ) ) );
throw new Exception( Framework::Error( 'CANNOT_UPLOAD_FILE_TO', str_replace( C::ROOT, null, $destination ) ) );
}
}
}
......
<?php
/**
* @package: Sobi Framework
*
* @author
* Name: Sigrid Suski & Radek Suski, Sigsiu.NET GmbH
* Email: sobi[at]sigsiu.net
* Url: https://www.Sigsiu.NET
* @copyright Copyright (C) 2006 - 2016 Sigsiu.NET GmbH (https://www.sigsiu.net). All rights reserved.
*
* @copyright Copyright (C) 2006 - 2020 Sigsiu.NET GmbH (https://www.sigsiu.net). All rights reserved.
* @license GNU/LGPL Version 3
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 3
* as published by the Free Software Foundation, and under the additional terms according section 7 of GPL v3.
* See http://www.gnu.org/licenses/lgpl.html and https://www.sigsiu.net/licenses.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
* @created Thu, Dec 1, 2016 12:02:59
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* @created Thu, Dec 1, 2016 by Radek Suski
* @modified 02 June 2020 by Sigrid Suski
*/
namespace Sobi\FileSystem;
......@@ -24,10 +28,13 @@ use Sobi\C;
use Sobi\Framework;
use Sobi\Error\Exception;
/**
* Class FileSystem
* @package Sobi\FileSystem
*/
abstract class FileSystem
{
/**
**
* @param string $file
*
* @return bool
......@@ -38,11 +45,10 @@ abstract class FileSystem
}
/**
* *
* @param string $file
* @param bool $safe
*
* @return bool
* @return string|string[]
*/
public static function Clean( $file, $safe = false )
{
......@@ -63,10 +69,9 @@ abstract class FileSystem
}
/**
* *
* @param string $file
*
* @return bool
* @return mixed|string
*/
public static function GetExt( $file )
{
......@@ -76,10 +81,9 @@ abstract class FileSystem
}
/**
* *
* @param string $file
*
* @return bool
* @return mixed|string
*/
public static function GetFileName( $file )
{
......@@ -89,11 +93,11 @@ abstract class FileSystem
}
/**
* *
* @param string $source
* @param string $destination
*
* @return bool
* @return mixed
* @throws Exception
*/
public static function Copy( $source, $destination )
{
......@@ -126,11 +130,10 @@ abstract class FileSystem
}
/**
* *
* @param string $file
*
* @return bool|void
* @throws Exception
* @return bool
*/
public static function Delete( $file )
{
......@@ -140,7 +143,7 @@ abstract class FileSystem
throw new Exception( Framework::Txt( 'Fatal error. Trying to delete not allowed path "%s"', $file ) );
}
return \Jfolder::delete( $file );
\Jfolder::delete( $file );
}
else {
return \Jfile::delete( $file );
......@@ -170,6 +173,11 @@ abstract class FileSystem
return file_get_contents( $file );
}
/**
* @param $path
*
* @return string|string[]
*/
public static function FixPath( $path )
{
$sep = explode( '://', $path );
......@@ -181,6 +189,11 @@ abstract class FileSystem
return str_replace( C::DS . C::DS, C::DS, str_replace( C::DS . C::DS, C::DS, str_replace( '\\', '/', $path ) ) );
}
/**
* @param $url
*
* @return string|string[]
*/
public static function FixUrl( $url )
{
$sep = explode( '://', $url );
......@@ -197,8 +210,8 @@ abstract class FileSystem
* @param string $buffer
* @param bool $append
*
* @throws Exception
* @return bool
* @throws Exception
*/
public static function Write( $file, &$buffer, $append = false )
{
......@@ -220,6 +233,7 @@ abstract class FileSystem
* @param string $destination
*
* @return bool
* @throws Exception
*/
public static function Upload( $name, $destination )
{
......@@ -266,19 +280,15 @@ abstract class FileSystem
}
/**
* *
* @param string $path
*
* @return bool
* @param $path
*/
public static function Rmdir( $path )
{
return \JFolder::delete( $path );
\JFolder::delete( $path );
}
/**
* *
* @param string $path
* @param $path
*
* @return bool
*/
......@@ -288,8 +298,7 @@ abstract class FileSystem
}
/**
* *
* @param string $path
* @param $path
*
* @return bool
*/
......@@ -299,10 +308,9 @@ abstract class FileSystem
}
/**
* *
* @param string $path
* @param $path
*
* @return bool
* @return false|int
*/
public static function Owner( $path )
{
......@@ -310,9 +318,8 @@ abstract class FileSystem
}
/**
* *
* @param string $source
* @param string $destination
* @param $source
* @param $destination
*
* @return bool
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment