improves on filesystem class
This commit is contained in:
parent
ffc238a98a
commit
e162c03392
@ -687,12 +687,19 @@ div.plugin-links > span.separator {
|
||||
margin-left: 200px;
|
||||
border-radius: 2px;
|
||||
padding: 1px 20px;
|
||||
border: 0;
|
||||
box-shadow: inset 0 0 5px rgba(0,0,0,.05);
|
||||
text-shadow: 0 -1px 0 rgba(0,0,0,.1);
|
||||
border: 1px solid rgba(0,0,0,.06);
|
||||
line-height: 28px;
|
||||
min-height: 30px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#jsformplugin button[type=submit].left {
|
||||
margin: 0 5px 0 0;
|
||||
border-radius: 2px;
|
||||
padding: 1px 20px;
|
||||
border: 1px solid rgba(0,0,0,.06);
|
||||
line-height: 28px;
|
||||
min-height: 30px;
|
||||
font-size: 1rem;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
@ -704,7 +711,11 @@ div.plugin-links > span.separator {
|
||||
#jsformplugin button[type=submit].small {
|
||||
font-size: 0.9em;
|
||||
min-height: 20px;
|
||||
background: #E6E6E6;
|
||||
background: #f5f5f5;
|
||||
}
|
||||
|
||||
#jsformplugin button[type=submit].small:hover {
|
||||
background: #f2f2f2;
|
||||
}
|
||||
|
||||
#jsformplugin > div > label,
|
||||
|
@ -269,6 +269,7 @@ define('HTML_PATH_ADMIN_THEME_CSS', HTML_PATH_ADMIN_THEME.'css/');
|
||||
define('HTML_PATH_ADMIN_THEME_IMG', HTML_PATH_ADMIN_THEME.'img/');
|
||||
define('HTML_PATH_CORE_JS', HTML_PATH_ROOT.'bl-kernel/js/');
|
||||
define('HTML_PATH_CORE_CSS', HTML_PATH_ROOT.'bl-kernel/css/');
|
||||
define('HTML_PATH_CONTENT', HTML_PATH_ROOT.'bl-content/');
|
||||
define('HTML_PATH_UPLOADS', HTML_PATH_ROOT.'bl-content/uploads/');
|
||||
define('HTML_PATH_UPLOADS_PROFILES', HTML_PATH_UPLOADS.'profiles/');
|
||||
define('HTML_PATH_UPLOADS_THUMBNAILS', HTML_PATH_UPLOADS.'thumbnails/');
|
||||
@ -318,6 +319,8 @@ define('DOMAIN_THEME_IMG', DOMAIN.HTML_PATH_THEME_IMG);
|
||||
define('DOMAIN_UPLOADS', DOMAIN.HTML_PATH_UPLOADS);
|
||||
define('DOMAIN_UPLOADS_PROFILES', DOMAIN.HTML_PATH_UPLOADS_PROFILES);
|
||||
define('DOMAIN_UPLOADS_THUMBNAILS', DOMAIN.HTML_PATH_UPLOADS_THUMBNAILS);
|
||||
define('DOMAIN_PLUGINS', DOMAIN.HTML_PATH_PLUGINS);
|
||||
define('DOMAIN_CONTENT', DOMAIN.HTML_PATH_CONTENT);
|
||||
|
||||
define('DOMAIN_ADMIN', DOMAIN_BASE.ADMIN_URI_FILTER);
|
||||
|
||||
|
@ -28,7 +28,7 @@ class Date {
|
||||
// Returns a new DateTime instance or FALSE on failure.
|
||||
$Date = DateTime::createFromFormat($currentFormat, $date);
|
||||
|
||||
if($Date!==false) {
|
||||
if ($Date!==false) {
|
||||
return $Date->format($outputFormat);
|
||||
}
|
||||
|
||||
|
@ -22,11 +22,11 @@ class Filesystem {
|
||||
{
|
||||
$files = glob($path.$regex.'.'.$extension);
|
||||
|
||||
if(empty($files)) {
|
||||
if (empty($files)) {
|
||||
return array();
|
||||
}
|
||||
|
||||
if($sortByDate) {
|
||||
if ($sortByDate) {
|
||||
usort($files, create_function('$a,$b', 'return filemtime($b) - filemtime($a);'));
|
||||
}
|
||||
|
||||
@ -64,26 +64,43 @@ class Filesystem {
|
||||
return file_exists($path);
|
||||
}
|
||||
|
||||
// Copy recursive a directory to another
|
||||
// If the destination directory not exists is created
|
||||
// $source = /home/diego/example or /home/diego/example/
|
||||
// $destination = /home/diego/newplace or /home/diego/newplace/
|
||||
public static function copyRecursive($source, $destination)
|
||||
{
|
||||
$source = rtrim($source, DS);
|
||||
$destination = rtrim($destination, DS);
|
||||
|
||||
// Check $source directory if exists
|
||||
if (!self::directoryExists($source)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$destination = rtrim($destination, '/');
|
||||
// Check $destionation directory if exists
|
||||
if (!self::directoryExists($destination)) {
|
||||
// Create the $destination directory
|
||||
if (!mkdir($destination, 0755, true)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
foreach($iterator = new RecursiveIteratorIterator(
|
||||
foreach ($iterator = new RecursiveIteratorIterator(
|
||||
new RecursiveDirectoryIterator($source, RecursiveDirectoryIterator::SKIP_DOTS),
|
||||
RecursiveIteratorIterator::SELF_FIRST) as $item) {
|
||||
if($item->isDir()) {
|
||||
if ($item->isDir()) {
|
||||
@mkdir($destination.DS.$iterator->getSubPathName());
|
||||
} else {
|
||||
copy($item, $destination.DS.$iterator->getSubPathName());
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Delete a file or directory recursive
|
||||
// The directory is delete
|
||||
public static function deleteRecursive($source)
|
||||
{
|
||||
if (!self::directoryExists($source)) {
|
||||
@ -103,9 +120,16 @@ class Filesystem {
|
||||
return rmdir($source);
|
||||
}
|
||||
|
||||
// Compress a file or directory
|
||||
// $source = /home/diego/example
|
||||
// $destionation = /tmp/example.zip
|
||||
public static function zip($source, $destination)
|
||||
{
|
||||
if (!extension_loaded('zip') || !file_exists($source)) {
|
||||
if (!extension_loaded('zip')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!file_exists($source)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -134,4 +158,25 @@ class Filesystem {
|
||||
return $zip->close();
|
||||
}
|
||||
|
||||
// Uncompress a zip file
|
||||
// $source = /home/diego/example.zip
|
||||
// $destionation = /home/diego/content
|
||||
public static function unzip($source, $destination)
|
||||
{
|
||||
if (!extension_loaded('zip')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!file_exists($source)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$zip = new ZipArchive();
|
||||
if (!$zip->open($source)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$zip->extractTo($destination);
|
||||
return $zip->close();
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "API",
|
||||
"description": "Schnittstelle, für den Datenaustausch mit Bludit über das HTTP-Protokoll. Informationen zur Verwendung des Plugins unter <a href=\"https://docs.bludit.com/en/api/introduction\">API Introduction</a>."
|
||||
},
|
||||
"api-token": "API-Token",
|
||||
"amount-of-pages": "Anzahl Seiten",
|
||||
"this-is-the-maximum-of-pages-to-return-when-you-call-to": "Maximum der Seiten bei einem Aufruf /api/pages.",
|
||||
"this-token-is-for-read-only-and-is-regenerated-every-time-you-install-the-plugin": "Der Token kann für Leserechte verwendet werden. Er wird bei bei einer Neuinstallation des Plugins erneuert."
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "API",
|
||||
"description": "Schnittstelle, für den Datenaustausch mit Bludit über das HTTP-Protokoll. Informationen zur Verwendung des Plugins unter <a href=\"https://docs.bludit.com/en/api/introduction\">API Introduction</a>."
|
||||
},
|
||||
"api-token": "API-Token",
|
||||
"amount-of-pages": "Anzahl Seiten",
|
||||
"this-is-the-maximum-of-pages-to-return-when-you-call-to": "Maximum der Seiten bei einem Aufruf /api/pages.",
|
||||
"this-token-is-for-read-only-and-is-regenerated-every-time-you-install-the-plugin": "Der Token kann für Leserechte verwendet werden. Er wird bei bei einer Neuinstallation des Plugins erneuert."
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "API",
|
||||
"description": "Interfaz para interactuar con Bludit mediante el protocolo HTTP. <br>Leer más sobre este plugin en <a href=\"https://docs.bludit.com/en/api/introduction\">API introducción</a>."
|
||||
},
|
||||
"api-token": "API Token",
|
||||
"amount-of-pages": "Cantidad de paginas",
|
||||
"this-is-the-maximum-of-pages-to-return-when-you-call-to": "Este es el máximo de páginas a devolver cuando llame a /api/pages.",
|
||||
"this-token-is-for-read-only-and-is-regenerated-every-time-you-install-the-plugin": "Este token es para sólo lectura y se regenera cada vez que se instala el plugin."
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "API",
|
||||
"description": "Interface pour interagir avec Bludit en utilisant le protocole HTTP. <br>En savoir plus sur ce plugin, en lisant <a href=\"https://docs.bludit.com/en/api/introduction\">l’introduction sur l’API</a>."
|
||||
},
|
||||
"api-token": "Jeton de l’API",
|
||||
"amount-of-pages": "Nombre de pages",
|
||||
"this-is-the-maximum-of-pages-to-return-when-you-call-to": "C’est le nombre maximal de pages à renvoyer lorsque vous appelez l’api par pages.",
|
||||
"this-token-is-for-read-only-and-is-regenerated-every-time-you-install-the-plugin": "Ce jeton est en lecture seule et est régénéré à chaque fois que vous installez le plugin."
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "API",
|
||||
"description": "Интерфейс для взаимодействия с Bludit по HTTP-протоколу. <br> Узнать больше про этот плагин <a href=\"https://docs.bludit.com/en/api/introduction\">API Introduction</a>."
|
||||
},
|
||||
"api-token": "API Tтокен",
|
||||
"amount-of-pages": "Количество страниц",
|
||||
"this-is-the-maximum-of-pages-to-return-when-you-call-to": "Максимальное количество возвращаемых страниц при обращении к /api/pages",
|
||||
"this-token-is-for-read-only-and-is-regenerated-every-time-you-install-the-plugin": "Данные токен используется только для чтения, он обновляется при каждой переустановке плагина"
|
||||
}
|
Loading…
Reference in New Issue
Block a user