Exemplo n.º 1
0
 /**
 * Class constructor
 *
 * @param string File path location
 * @return void
 */
 public function __construct($file_path)
 {
     $arr = explode('/', $file_path);
     $file_name = end($arr);
     $file_path = APPLICATION . $file_path . '.php';
     $prefix = $arr[0];
     if (!file_exists($file_path)) {
         Library_error::_500('<b>Error:</b> No <b>' . $file_name . '</b> file in ' . $arr[0] . ' folder.');
     }
     $class = ucwords($prefix) . '_' . $file_name;
     include_once $file_path;
     if (!class_exists($class)) {
         Library_error::_500('<b>Error:</b> No class <b>' . $class . '</b> exists in file ' . $file_name . '.');
     }
     $this->class_inctance = new $class();
 }
Exemplo n.º 2
0
Arquivo: apc.php Projeto: erxn/siemas
 * Panada APC API.
 *
 * @package	Panada
 * @subpackage	Library
 * @author	Iskandar Soesman
 * @since	Version 0.2
 *
 * Install APC on Ubuntu: aptitude install libpcre3-dev;
 * pecl install apc
 */
/**
 * ID: Pastikan ekstensi APC telah terinstall
 * EN: Makesure APC extension is enabled
 */
if (!extension_loaded('apc')) {
    Library_error::_500('APC extension that required by Library_apc is not available.');
}
class Library_apc
{
    public function __construct()
    {
    }
    public function __call($name, $arguments)
    {
        return call_user_func_array($name, $arguments);
    }
    public static function __callStatic($name, $arguments)
    {
        return call_user_func_array($name, $arguments);
    }
}
Exemplo n.º 3
0
defined('THISPATH') or die('Can\'t access directly!');
/**
 * Panada MongoDB API.
 *
 * @package	Panada
 * @subpackage	Library
 * @author	Iskandar Soesman
 * @since	Version 0.2
 */
/**
 * ID: Pastikan ektensi Mongo telah terinstall
 * EN: Makesure Memcache extension is enabled
 */
if (!extension_loaded('mongo')) {
    Library_error::_500('Mongo extension that required by Library_mongodb is not available.');
}
class Library_mongodb extends Mongo
{
    public $database;
    public function __construct($connection = 'default')
    {
        $this->config = new Library_config();
        $this->database = $this->config->mongodb->{$connection}->database;
        $host = $this->config->mongodb->{$connection}->host;
        /**
         * EN: This is the mongodb connection option. Eg: array('replicaSet' => true, 'connect' => false)
         */
        $connection_options = array();
        parent::__construct($host, $connection_options);
    }
Exemplo n.º 4
0
Arquivo: gear.php Projeto: erxn/siemas
 public function output($file_path, $data = array())
 {
     $file_path = APPLICATION . 'view/' . $file_path;
     if (!file_exists($view_file = $file_path . '.php')) {
         Library_error::_500('<b>Error:</b> No <b>' . $view_file . '</b> file in view folder.');
     }
     if (!empty($data)) {
         $this->view = $data;
     }
     if (!empty($this->view)) {
         extract($this->view, EXTR_SKIP);
     }
     include_once $view_file;
 }
Exemplo n.º 5
0
Arquivo: rest.php Projeto: erxn/siemas
defined('THISPATH') or die('Can\'t access directly!');
/**
 * Panada Restful class.
 *
 * @package	Panada
 * @subpackage	Library
 * @author	Iskandar Soesman
 * @since	Version 0.1
 */
/**
 * ID: Pastikan ektensi Curl telah terinstall
 * EN: Makesure Curl extension is enabled
 */
if (!function_exists('curl_init')) {
    Library_error::_500('cUrl extension that required by Library_rest is not available.');
}
class Library_rest
{
    public $request_method;
    public $request_data = array();
    public $set_request_headers = array();
    public $response_status;
    public $response_output_header = false;
    public $timeout = 30;
    public function get_request()
    {
        $this->request_method = strtoupper($_SERVER['REQUEST_METHOD']);
        switch ($this->request_method) {
            case 'GET':
                $this->request_data = $_GET;
Exemplo n.º 6
0
defined('THISPATH') or die('Can\'t access directly!');
/**
 * Panada Memcached API.
 *
 * @package	Panada
 * @subpackage	Library
 * @author	Iskandar Soesman
 * @since	Version 0.1
 */
/**
 * ID: Pastikan ektensi Memcache telah terinstall
 * EN: Makesure Memcache extension is enabled
 */
if (!extension_loaded('memcache')) {
    Library_error::_500('Memcache extension that required by Library_memcached is not available.');
}
class Library_memcached extends Memcache
{
    /**
     * EN: Load configuration from config file.
     * @return void
     */
    public function __construct()
    {
        $this->config = new Library_config();
        foreach ($this->config->memcached_host as $host) {
            $this->addServer($host, $this->config->memcached_port);
        }
        /**
         * EN: If you need compression Threshold, you can uncomment this