new pisilinux web sites

This commit is contained in:
Erkan IŞIK
2026-07-01 16:44:17 +03:00
commit b58488b586
21740 changed files with 2066209 additions and 0 deletions
@@ -0,0 +1,29 @@
<?php namespace ZN\Compression;
/**
* ZN PHP Web Framework
*
* "Simplicity is the ultimate sophistication." ~ Da Vinci
*
* @package ZN
* @license MIT [http://opensource.org/licenses/MIT]
* @author Ozan UYKUN [ozan@znframework.com]
*/
/**
* Default Configuration
*
* Enabled when the configuration file can not be accessed.
*/
class CompressionDefaultConfiguration
{
/*
|--------------------------------------------------------------------------
| Compression
|--------------------------------------------------------------------------
|
| Includes default settings for the compress.
|
*/
public $driver = 'gz';
}
@@ -0,0 +1,61 @@
<?php namespace ZN\Compression;
/**
* ZN PHP Web Framework
*
* "Simplicity is the ultimate sophistication." ~ Da Vinci
*
* @package ZN
* @license MIT [http://opensource.org/licenses/MIT]
* @author Ozan UYKUN [ozan@znframework.com]
*/
abstract class DriverMappingAbstract
{
/**
* Extract data
*
* @param string $source
* @param string $target = NULL
* @param string $password = NULL
*
* @return bool
*/
abstract public function extract($source, $target, $password);
/**
* Write data to file
*
* @param string $file
* @param string $data
*
* @return bool
*/
abstract public function write($file, $data);
/**
* Read file
*
* @param string $file
*
* @return bool
*/
abstract public function read($file);
/**
* Force do
*
* @param string $data
*
* @return string
*/
abstract public function do($data);
/**
* Force undo
*
* @param string $data
*
* @return string
*/
abstract public function undo($data);
}
@@ -0,0 +1,116 @@
<?php namespace ZN\Compression\Drivers;
/**
* ZN PHP Web Framework
*
* "Simplicity is the ultimate sophistication." ~ Da Vinci
*
* @package ZN
* @license MIT [http://opensource.org/licenses/MIT]
* @author Ozan UYKUN [ozan@znframework.com]
*/
use ZN\Support;
use ZN\Compression\Exception\FileNotFoundException;
use ZN\Compression\DriverMappingAbstract;
class BzDriver extends DriverMappingAbstract
{
/**
* Magic constructor
*
* Checking if your driver is supported.
*
* @param void
*
* @return void
*/
public function __construct()
{
Support::func('bzopen', 'BZ');
}
/**
* Extract data
*
* @param string $source
* @param string $target = NULL
* @param string $password = NULL
*
* @return bool
*/
public function extract($source, $target, $password)
{
return false;
}
/**
* Write data to file
*
* @param string $file
* @param string $data
*
* @return bool
*/
public function write($file, $data)
{
$open = bzopen($file, 'w');
if( empty($open) )
{
throw new FileNotFoundException(NULL, $file); // @codeCoverageIgnore
}
$return = bzwrite($open, $data, strlen($data));
bzclose($open);
return $return;
}
/**
* Read file
*
* @param string $file
*
* @return bool
*/
public function read($file)
{
$open = bzopen($file, 'r');
if( empty($open) )
{
throw new FileNotFoundException(NULL, $file);
}
$return = bzread($open, 8096);
bzclose($open);
return $return;
}
/**
* Force do
*
* @param string $data
*
* @return string
*/
public function do($data)
{
return bzcompress($data);
}
/**
* Force undo
*
* @param string $data
*
* @return string
*/
public function undo($data)
{
return bzdecompress($data);
}
}
@@ -0,0 +1,116 @@
<?php namespace ZN\Compression\Drivers;
/**
* ZN PHP Web Framework
*
* "Simplicity is the ultimate sophistication." ~ Da Vinci
*
* @package ZN
* @license MIT [http://opensource.org/licenses/MIT]
* @author Ozan UYKUN [ozan@znframework.com]
*/
use ZN\Support;
use ZN\Compression\Exception\FileNotFoundException;
use ZN\Compression\DriverMappingAbstract;
class GzDriver extends DriverMappingAbstract
{
/**
* Magic constructor
*
* Checking if your driver is supported.
*
* @param void
*
* @return void
*/
public function __construct()
{
Support::func('gzopen', 'GZ');
}
/**
* Extract data
*
* @param string $source
* @param string $target = NULL
* @param string $password = NULL
*
* @return bool
*/
public function extract($source, $target, $password)
{
return false;
}
/**
* Write data to file
*
* @param string $file
* @param string $data
*
* @return bool
*/
public function write($file, $data)
{
$open = gzopen($file, 'w');
if( empty($open) )
{
throw new FileNotFoundException(NULL, $file); // @codeCoverageIgnore
}
$return = gzwrite($open, $data, strlen($data));
gzclose($open);
return $return;
}
/**
* Read file
*
* @param string $file
*
* @return bool
*/
public function read($file)
{
$open = gzopen($file, 'r');
if( empty($open) )
{
throw new FileNotFoundException(NULL, $file);
}
$return = gzread($open, 8096);
gzclose($open);
return $return;
}
/**
* Force do
*
* @param string $data
*
* @return string
*/
public function do($data)
{
return gzcompress($data);
}
/**
* Force undo
*
* @param string $data
*
* @return string
*/
public function undo($data)
{
return gzuncompress($data);
}
}
@@ -0,0 +1,100 @@
<?php namespace ZN\Compression\Drivers;
/**
* ZN PHP Web Framework
*
* "Simplicity is the ultimate sophistication." ~ Da Vinci
*
* @package ZN
* @license MIT [http://opensource.org/licenses/MIT]
* @author Ozan UYKUN [ozan@znframework.com]
*/
use ZN\Support;
use ZN\Compression\DriverMappingAbstract;
/**
* @codeCoverageIgnore
*/
class LzfDriver extends DriverMappingAbstract
{
/**
* Magic constructor
*
* Checking if your driver is supported.
*
* @param void
*
* @return void
*/
public function __construct()
{
Support::func('lzf_compress', 'LZF');
}
/**
* Extract data
*
* @param string $source
* @param string $target = NULL
* @param string $password = NULL
*
* @return bool
*/
public function extract($source, $target, $password)
{
return false;
}
/**
* Write data to file
*
* @param string $file
* @param string $data
*
* @return bool
*/
public function write($file, $data)
{
$data = $this->do($data);
return file_put_contents($file, $data);
}
/**
* Read file
*
* @param string $file
*
* @return bool
*/
public function read($file)
{
$content = file_get_contents($file);
return $this->undo($content);
}
/**
* Force do
*
* @param string $data
*
* @return string
*/
public function do($data)
{
return lzf_compress($data);
}
/**
* Force undo
*
* @param string $data
*
* @return string
*/
public function undo($data)
{
return lzf_decompress($data);
}
}
@@ -0,0 +1,111 @@
<?php namespace ZN\Compression\Drivers;
/**
* ZN PHP Web Framework
*
* "Simplicity is the ultimate sophistication." ~ Da Vinci
*
* @package ZN
* @license MIT [http://opensource.org/licenses/MIT]
* @author Ozan UYKUN [ozan@znframework.com]
*/
use ZN\Base;
use ZN\Support;
use ZN\Singleton;
use ZN\Compression\DriverMappingAbstract;
/**
* @codeCoverageIgnore
*/
class RarDriver extends DriverMappingAbstract
{
/**
* Magic constructor
*
* Checking if your driver is supported.
*
* @param void
*
* @return void
*/
public function __construct()
{
Support::func('rar_open', 'RAR');
}
/**
* Extract data
*
* @param string $source
* @param string $target = NULL
* @param string $password = NULL
*
* @return bool
*/
public function extract($source, $target, $password)
{
$rarFile = rar_open(Base::suffix($source, '.rar'), $password);
$list = rar_list($rarFile);
if( ! empty($list) ) foreach( $list as $file )
{
$entry = rar_entry_get($rarFile, $file);
$entry->extract($target);
}
else
{
return false;
}
rar_close($rarFile);
}
/**
* Write data to file
*
* @param string $file
* @param string $data
*
* @return bool
*/
public function write($file, $data)
{
return Singleton::class('ZN\Compression\Drivers\GzDriver')->write($file, $data);
}
/**
* Read file
*
* @param string $file
*
* @return bool
*/
public function read($file)
{
return Singleton::class('ZN\Compression\Drivers\GzDriver')->read($file);
}
/**
* Force do
*
* @param string $data
*
* @return string
*/
public function do($data)
{
return Singleton::class('ZN\Compression\Drivers\GzDriver')->do($data);
}
/**
* Force undo
*
* @param string $data
*
* @return string
*/
public function undo($data)
{
return Singleton::class('ZN\Compression\Drivers\GzDriver')->undo($data);
}
}
@@ -0,0 +1,95 @@
<?php namespace ZN\Compression\Drivers;
/**
* ZN PHP Web Framework
*
* "Simplicity is the ultimate sophistication." ~ Da Vinci
*
* @package ZN
* @license MIT [http://opensource.org/licenses/MIT]
* @author Ozan UYKUN [ozan@znframework.com]
*/
use ZN\Support;
use ZN\Singleton;
use ZN\Filesystem;
use ZN\Compression\DriverMappingAbstract;
class ZipDriver extends DriverMappingAbstract
{
/**
* Magic constructor
*
* Checking if your driver is supported.
*
* @param void
*
* @return void
*/
public function __construct()
{
Support::library('ZipArchive', 'ZIP Archive');
}
/**
* Extract data
*
* @param string $source
* @param string $target = NULL
* @param string $password = NULL
*
* @return bool
*/
public function extract($source, $target, $password = NULL)
{
return Filesystem\Forge::zipExtract($source, $target);
}
/**
* Write data to file
*
* @param string $file
* @param string $data
*
* @return bool
*/
public function write($file, $data)
{
return Singleton::class('ZN\Compression\Drivers\GzDriver')->write($file, $data);
}
/**
* Read file
*
* @param string $file
*
* @return bool
*/
public function read($file)
{
return Singleton::class('ZN\Compression\Drivers\GzDriver')->read($file);
}
/**
* Force do
*
* @param string $data
*
* @return string
*/
public function do($data)
{
return Singleton::class('ZN\Compression\Drivers\GzDriver')->do($data);
}
/**
* Force undo
*
* @param string $data
*
* @return string
*/
public function undo($data)
{
return Singleton::class('ZN\Compression\Drivers\GzDriver')->undo($data);
}
}
@@ -0,0 +1,97 @@
<?php namespace ZN\Compression\Drivers;
/**
* ZN PHP Web Framework
*
* "Simplicity is the ultimate sophistication." ~ Da Vinci
*
* @package ZN
* @license MIT [http://opensource.org/licenses/MIT]
* @author Ozan UYKUN [ozan@znframework.com]
*/
use ZN\Support;
use ZN\Compression\DriverMappingAbstract;
class ZlibDriver extends DriverMappingAbstract
{
/**
* Magic constructor
*
* Checking if your driver is supported.
*
* @param void
*
* @return void
*/
public function __construct()
{
Support::func('zlib_encode', 'ZLIB');
}
/**
* Extract data
*
* @param string $source
* @param string $target = NULL
* @param string $password = NULL
*
* @return bool
*/
public function extract($source, $target, $password)
{
return false;
}
/**
* Write data to file
*
* @param string $file
* @param string $data
*
* @return bool
*/
public function write($file, $data)
{
$data = $this->do($data);
return file_put_contents($file, $data);
}
/**
* Read file
*
* @param string $file
*
* @return bool
*/
public function read($file)
{
$content = file_get_contents($file);
return $this->undo($content);
}
/**
* Force do
*
* @param string $data
*
* @return string
*/
public function do($data)
{
return zlib_encode($data, ZLIB_ENCODING_GZIP);
}
/**
* Force undo
*
* @param string $data
*
* @return string
*/
public function undo($data)
{
return zlib_decode($data);
}
}
@@ -0,0 +1,22 @@
<?php namespace ZN\Compression\Exception;
/**
* ZN PHP Web Framework
*
* "Simplicity is the ultimate sophistication." ~ Da Vinci
*
* @package ZN
* @license MIT [http://opensource.org/licenses/MIT]
* @author Ozan UYKUN [ozan@znframework.com]
*/
use ZN\Exception;
class FileNotFoundException extends Exception
{
const lang =
[
'en' => '`%` file was not found!',
'tr' => '`%` dosyasi bulunamadi!'
];
}
+98
View File
@@ -0,0 +1,98 @@
<?php namespace ZN\Compression;
/**
* ZN PHP Web Framework
*
* "Simplicity is the ultimate sophistication." ~ Da Vinci
*
* @package ZN
* @license MIT [http://opensource.org/licenses/MIT]
* @author Ozan UYKUN [ozan@znframework.com]
*/
use ZN\Ability\Driver;
class Force implements ForceInterface
{
use Driver;
/**
* Driver
*
* @param array driver
*/
const driver =
[
'options' => ['gz', 'bz', 'lzf', 'rar', 'zip', 'zlib'],
'namespace' => 'ZN\Compression\Drivers',
'default' => 'ZN\Compression\CompressionDefaultConfiguration',
'config' => 'Storage:compression'
];
/**
* Extract data
*
* @param string $source
* @param string $target = NULL
* @param string $password = NULL
*
* @return bool
*/
public function extract(string $source, ?string $target = NULL, ?string $password = NULL) : bool
{
if( ! is_file($source) )
{
throw new Exception\FileNotFoundException(NULL, $source);
}
return $this->driver->extract($source, $target, $password);
}
/**
* Write data to file
*
* @param string $file
* @param string $data
*
* @return bool
*/
public function write(string $file, string $data) : bool
{
return $this->driver->write($file, $data);
}
/**
* Read file
*
* @param string $file
*
* @return bool
*/
public function read(string $file) : string
{
return $this->driver->read($file);
}
/**
* Force do
*
* @param string $data
*
* @return string
*/
public function do(string $data) : string
{
return $this->driver->do($data);
}
/**
* Force undo
*
* @param string $data
*
* @return string
*/
public function undo(string $data) : string
{
return $this->driver->undo($data);
}
}
@@ -0,0 +1,61 @@
<?php namespace ZN\Compression;
/**
* ZN PHP Web Framework
*
* "Simplicity is the ultimate sophistication." ~ Da Vinci
*
* @package ZN
* @license MIT [http://opensource.org/licenses/MIT]
* @author Ozan UYKUN [ozan@znframework.com]
*/
interface ForceInterface
{
/**
* Extract data
*
* @param string $source
* @param string $target = NULL
* @param string $password = NULL
*
* @return bool
*/
public function extract(string $source, ?string $target = NULL, ?string $password = NULL) : bool;
/**
* Write data to file
*
* @param string $file
* @param string $data
*
* @return bool
*/
public function write(string $file, string $data) : bool;
/**
* Read file
*
* @param string $file
*
* @return bool
*/
public function read(string $file) : string;
/**
* Force do
*
* @param string $data
*
* @return string
*/
public function do(string $data) : string;
/**
* Force undo
*
* @param string $data
*
* @return string
*/
public function undo(string $data) : string;
}