Initial commit

This commit is contained in:
Wruczek
2016-06-28 23:18:59 +02:00
parent e321e10551
commit e49c2c27ad
390 changed files with 22561 additions and 0 deletions

View File

@ -0,0 +1,47 @@
<?php
/**
*
* This file is part of phpFastCache.
*
* @license MIT License (MIT)
*
* For full copyright and license information, please see the docs/CREDITS.txt file.
*
* @author Khoa Bui (khoaofgod) <khoaofgod@gmail.com> http://www.phpfastcache.com
* @author Georges.L (Geolim4) <contact@geolim4.com>
*
*/
namespace phpFastCache\Util;
use phpFastCache\Exceptions\phpFastCacheCoreException;
/**
* Class Languages
* @author Khoa Bui (khoaofgod) <khoaofgod@gmail.com> http://www.phpfastcache.com
* @author Georges.L (Geolim4) <contact@geolim4.com>
*
*/
class Languages
{
public static function setEncoding($encoding = 'UTF-8', $language = null)
{
if ($language === null || !in_array($language, array('uni', 'Japanese', 'ja', 'English', 'en'), true)) {
$language = 'uni';
}
switch(strtoupper($encoding))
{
case 'UTF-8':
if(extension_loaded("mbstring")) {
mb_internal_encoding($encoding);
mb_http_output($encoding);
mb_http_input($encoding);
mb_language($language);
mb_regex_encoding($encoding);
} else {
throw new phpFastCacheCoreException("MB String need to be installed for Unicode Encoding");
}
break;
}
}
}

View File

@ -0,0 +1,43 @@
<?php
/*
* If Any problem with Autoload on other project
* Try to put this line on your config project
* define("PHPFASTCACHE_LEGACY",true);
* and just keep include phpFastCache/phpFastCache.php or Composer Autoloader
*/
use phpFastCache\CacheManager;
require_once __DIR__.'/../Core/DriverInterface.php';
require_once __DIR__.'/../Core/DriverAbstract.php';
require_once __DIR__.'/../Core/phpFastCache.php';
require_once __DIR__.'/../Core/phpFastCacheExtensions.php';
require_once __DIR__.'/../Exceptions/phpFastCacheCoreException.php';
require_once __DIR__.'/../Exceptions/phpFastCacheDriverException.php';
require_once __DIR__.'/../Drivers/files.php';
require_once __DIR__.'/../Drivers/memcache.php';
require_once __DIR__.'/../Drivers/memcached.php';
require_once __DIR__.'/../Drivers/mongodb.php';
require_once __DIR__.'/../Drivers/predis.php';
require_once __DIR__.'/../Drivers/redis.php';
require_once __DIR__.'/../Drivers/sqlite.php';
require_once __DIR__.'/../CacheManager.php';
require_once __DIR__.'/../phpFastCache.php';
/**
* __c() Short alias
* @param string $storage
* @param array $config
* @return mixed
*/
if (!function_exists("__c")) {
function __c($storage = 'auto', $config = array())
{
return CacheManager::getInstance($storage, $config);
}
}

View File

@ -0,0 +1,33 @@
<?php
namespace phpFastCache\Util;
define('PHP_OPEN_BASEDIR', @ini_get("open_basedir"));
class OpenBaseDir {
public static $stores = array();
public static function checkBaseDir($path) {
if(!is_null(PHP_OPEN_BASEDIR) && PHP_OPEN_BASEDIR != "") {
/*
* ONLY check ONE time if System Have Open Base Dir
* Else, always return TRUE for system without OPenBaseDir
*/
$index = md5($path);
if (!isset(self::$stores[$index])) {
// never check before, then check it 1 one time for the src dir only
$list = explode(":", PHP_OPEN_BASEDIR);
foreach ($list as $allowed_path) {
$tmp = explode($allowed_path, $path, 2);
if ($tmp[0] != $path) {
// echo "<br>".$tmp[0]." = ".$path." BY {$allowed_path}";
self::$stores[$index] = true;
return true;
}
}
self::$stores[$index] = false;
} else {
return self::$stores[$index];
}
return false;
}
return true;
}
}