示例#1
12
function setCommonConfig(Config &$config, $serverName = null)
{
    // Config that can be carried over to any server
    if (empty($serverName) && isset($_SERVER["SERVER_NAME"])) {
        $serverName = $_SERVER["SERVER_NAME"];
    }
    // clientAndServer configs are readable via javascript.
    if ($serverName == 'localhost' || $serverName == 'test') {
        $serverConfigAdd = array('imagecachesPath' => BASE_PATH . 'images/cache/', 'isDevMode' => false, 'logSql' => false);
        $clientAndServerConfigAdd = array('baseUrl' => 'http://localhost/skully-project/', 'publicDir' => 'public/');
    } else {
        $serverConfigAdd = array('imagecachesPath' => BASE_PATH . 'images/cache/', 'isDevMode' => false, 'logSql' => false);
        $clientAndServerConfigAdd = array('baseUrl' => 'http://onlinesite.com/', 'publicDir' => 'public/');
    }
    $config_r = array_merge(array('freeze' => true, 'namespace' => 'App', 'caching' => 2, 'maintenance' => false, 'maintenanceIp' => '139.195.146.93', 'notFoundPath' => 'home/notFound', 'maintenancePath' => 'home/maintenance', "dateFormatDb" => "Y-m-d H:i:s", 'dateFormat' => 'd M Y', 'longDateTimeFormat' => 'M j, Y h:i A', 'shortDateTimeFormat' => 'd/m H:i', 'longDateFormat' => 'M j, Y', 'shortDateFormat' => 'd/m', 'adminLongDateTimeFormat' => 'd/m/Y H:i', 'adminLongDateFormat' => 'd/m/Y', 'urlRules' => array('' => 'home/index', 'admin' => 'admin/home/index', 'admin/index' => 'admin/home/index', 'admin/loginProcess' => 'admin/admins/loginProcess', 'admin/login' => 'admin/admins/login'), 'language' => 'en', 'languages' => array('en' => array('value' => 'english', 'code' => 'en')), 'smtpPort' => '465', 'smtpHost' => 'smtp.google.com', 'smtpPassword' => 'password', 'smtpUsername' => '*****@*****.**', 'senderEmail' => '*****@*****.**', 'senderName' => 'SenderName', 'replyToEmail' => '*****@*****.**', 'replyToName' => 'yoursite.com Contact', 'smtpSecurity' => 'ssl', 'basePath' => BASE_PATH, 'globalSalt' => 'hakunamatata', 'ruckusingConfig' => array('migrations_dir' => array('default' => BASE_PATH . 'migrations'), 'db_dir' => BASE_PATH . 'db', 'log_dir' => BASE_PATH . 'logs' . DIRECTORY_SEPARATOR . 'migrations', 'ruckusing_base' => RUCKUSING_BASE)), $serverConfigAdd);
    $clientAndServerConfig = array_merge(array('theme' => 'default', 'formDateFormat' => 'M d, yy', 'serverFormDateFormat' => "%b %e, %Y", 'formTimeFormat' => 'hh:mm TT', 'serverFormDateTimeFormat' => "%b %e, %Y %I:%M %p"), $clientAndServerConfigAdd);
    $config_r = array_merge($config_r, $clientAndServerConfig);
    $config->setProtectedFromArray($config_r);
    $clientConfig = array();
    $clientConfig = array_merge($clientConfig, $clientAndServerConfig);
    $config->setPublicFromArray($clientConfig);
}
 public static function getByQueue($queue)
 {
     $config = Config::getConfig();
     $queueHandlerClass = $config->getParam('queue_handler');
     $queueHandler = $queueHandlerClass::getInstance();
     return $queueHandler->dequeue($queue);
 }
示例#3
6
 public static function loadClass($_class)
 {
     $_class = ltrim($_class, "\\");
     $_file_path = \App\Config\Config::getBasePath() . "/" . str_replace("\\", "/", $_class);
     $_file_path .= ".php";
     return include $_file_path;
 }
示例#4
5
<?php

use app\config\Config;
// Initialize the app
require_once '../../app/init.php';
// Include the pusher library
require_once '../../lib/pusher/Pusher.php';
// Gather the pusher key, secret and application ID
$authKey = Config::getValue('pusher', 'auth_key', '');
$secret = Config::getValue('pusher', 'secret', '');
$appId = Config::getValue('pusher', 'app_id', '0');
// Create a pusher instance with the proper key, secret and application ID
$pusher = new Pusher($authKey, $secret, $appId);
// Authenticate the request
echo $pusher->socket_auth($_POST['channel_name'], $_POST['socket_id']);
示例#5
4
 function __setupApp($serverName = null)
 {
     if (empty($serverName) && defined($_SERVER["SERVER_NAME"])) {
         $serverName = $_SERVER["SERVER_NAME"];
     }
     $config = new Config();
     $config->setProtected('basePath', BASE_PATH);
     setCommonConfig($config, $serverName);
     if (function_exists('setUniqueConfig')) {
         setUniqueConfig($config, $serverName);
     }
     return new \App\Application($config);
 }
示例#6
0
 protected function runCommandPrompt()
 {
     $command = new Command();
     $command->option('p')->aka('path')->file()->default($this->config->get('defaultFilePath'))->describedAs(sprintf('Result csv file path (%s is default)', $this->config->get('defaultFilePath')));
     $command->option('n')->aka('name')->default($this->config->get('defaultFileName'))->describedAs(sprintf('Result csv file name (%s is default)', $this->config->get('defaultFileName')));
     $command->option('y')->aka('year')->boolean()->default(false)->describedAs('Generate salary days for all current year (default for the reminder of current year)');
     $command->option('s')->aka('startDate')->default(null)->describedAs('start year and month in format (Y-m)');
     $command->option('e')->aka('endDate')->default(null)->describedAs('end year and month in format (Y-m)');
     return $command;
 }
示例#7
0
 /**
  * Method parses requested url and returns an array with Module name and Action name.
  *
  * @param $server
  * @return array
  * @throws \Exception
  */
 public function parseUrl($server)
 {
     $path = parse_url($server['REQUEST_URI'], PHP_URL_PATH);
     $routeConfig = $this->routeConfig->getConfig('route', ROOT . self::ROUTE_CONFIG);
     if (array_key_exists($path, $routeConfig)) {
         return $routeConfig[$path];
     } else {
         throw new \Exception('BAD REQUEST.');
     }
 }
 protected function setUp()
 {
     $config = new Config();
     $config->setProtected('basePath', BASE_PATH);
     setCommonConfig($config);
     setUniqueConfig($config);
     $dbConfig = $config->getProtected('dbConfig');
     if ($dbConfig['type'] == 'mysql') {
         Application::setupRedBean("mysql:host={$dbConfig['host']};dbname={$dbConfig['dbname']};port={$dbConfig['port']}", $dbConfig['user'], $dbConfig['password'], $config->getProtected('isDevMode'));
     } elseif ($dbConfig['type'] == 'sqlite') {
         Application::setupRedBean("sqlite:{$dbConfig['dbname']}", $dbConfig['user'], $dbConfig['password'], $config->getProtected('isDevMode'));
     }
     R::freeze(false);
     R::nuke();
     R::freeze($this->frozen);
     $this->app = __setupApp();
     /** $http Mock Http object. */
     $http = $this->getMock('Skully\\Core\\Http');
     $http->expects($this->any())->method('redirect')->will($this->returnCallback('stubRedirect'));
     $this->app->setHttp($http);
 }
示例#9
0
 /**
  * for singleton design pattern on View object
  * also there is some flexibility over changing views direction
  * with passing your custom direction to self::make as third parameter
  *
  * @param null $baseDir
  * @return null
  */
 public static function getInstance($baseDir = null)
 {
     if (self::$view == null) {
         $finder = new \Wp\View\Finder();
         if ($baseDir) {
             $finder->viewsDirection = $baseDir;
         }
         self::$view = new View($finder);
         self::$view->bladeCache = \App\Config\Config::bladeCache();
     } else {
         return self::$view;
     }
 }
示例#10
0
 /**
  * Method returns an array with instances of requested arguments.
  *
  * @param \ReflectionParameter[] $params
  * @return array
  */
 private function resolveArguments(array $params)
 {
     $result = ['realType' => '', 'args' => ''];
     if ($params) {
         foreach ($params as $param) {
             if ($param->getClass() == null) {
                 $config = $this->config->getConfig('virtualType', ROOT . self::DI_CONFIG);
                 $realType = $param->name;
                 $result['realType'] = $config[$realType];
                 foreach ($config['arguments'] as $argument) {
                     $result['args'][] = $this->create($argument);
                 }
             } elseif ($param->getClass()->isInterface()) {
                 $config = $this->config->getConfig('preference', ROOT . self::DI_CONFIG);
                 $className = $this->getPreference($config, $param->getClass()->name);
                 $result['args'][] = $this->get($className);
             } else {
                 $className = $param->getClass()->name;
                 $result['args'][] = $this->get($className);
             }
         }
     }
     return $result;
 }
示例#11
0
 /**
  * Connect to the database, with the credentials provided in the configuration file.
  */
 public static function connect()
 {
     // Retrieve the database data from the configuration
     $host = Config::getValue('database', 'host', 'localhost');
     $port = Config::getValue('database', 'port', 3306);
     $dbname = Config::getValue('database', 'database', '');
     $user = Config::getValue('database', 'username', 'root');
     $password = Config::getValue('database', 'password', '');
     // Connect to the database using PDO, store the instance globally
     try {
         static::$db = new PDO('mysql:host=' . $host . ';port=' . $port . ';dbname=' . $dbname, $user, $password);
     } catch (Exception $e) {
         throw new Exception('An error occurred while connecting to the database!');
     }
 }
示例#12
0
 /**
  * Hash data.
  *
  * @param string $data Data to hash.
  * @param string $algorithm [Optional] The algorithm to use, null to use the default algorithm specified in the config.
  * @param string $salt [Optional] The salt to use, null to use the default salt specified in the config.
  *
  * @return string The hashed data.
  */
 public static function hash($data, $algorithm = null, $salt = null)
 {
     // If the $algo param is not set, get the default value from the config set_file
     if ($algorithm == null) {
         $algorithm = Config::getValue('hash', 'algorithm');
     }
     // If the $salt param was not set, get the default value from the config set_file
     if ($salt == null) {
         $salt = Config::getValue('hash', 'salt');
     }
     // Hash the data
     $context = hash_init($algorithm, HASH_HMAC, $salt);
     hash_update($context, $data);
     // Return the hashed data
     return hash_final($context);
 }
 private function download($url)
 {
     $emageDir = Config::getConfig()->getParam('images_dir');
     $path_parts = pathinfo($url);
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_POST, 0);
     curl_setopt($ch, CURLOPT_URL, $url);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($ch, CURLOPT_FAILONERROR, 1);
     $result = curl_exec($ch);
     if ($result) {
         $extension = self::getExtensionByMimeType(curl_getinfo($ch, CURLINFO_CONTENT_TYPE));
         $saveFile = fopen($emageDir . '/' . $path_parts['filename'] . '(' . uniqid() . ')' . '.' . $extension, 'w');
         fwrite($saveFile, $result);
         fclose($saveFile);
     }
     curl_close($ch);
     return $result ? true : false;
 }
示例#14
0
<?php

use App\Config\Config;
use App\Tools\Gravatar;
use App\Tools\Request;
session_start();
include_once "/vendor/autoload.php";
$myid = $_SESSION['me']->id;
$chatlist = Request::perform("chatlist/{$myid}");
$userlist = Request::perform("userlist");
$config = Config::getConfig("kinder");
if (empty($chatlist)) {
    echo "vous n'avez pas encore de conversations";
    die;
}
$old = $chatlist[0]->kinder;
?>
<div id="ex1" style="display:none;">
   <p id="nameadd" style="text-align: center;font-size: 18px; "></p>
    <input type="hidden" name="idadd" id="idadd" value=""/>

    <button id="addToConv" class="btn btn-primary btn-sm m-t-10 send-button" >Ajouter a la conversation</button>
</div>



<div id="chat-section">
    <ul class="tab-nav tn-justified" role="tablist">
        <li role="presentation" class="active"><a href="#chan" role="tab" data-toggle="tab">Channels</a></li>
        <li role="presentation"><a href="#annuaire" role="tab" data-toggle="tab">Annuaire</a></li>
    </ul>
    /**
     * Print the top of the error page
     * @param string $page_title Page title to use
     */
    private static function printPageTop($page_title)
    {
        $site_path = '';
        if (Config::isConfigLoaded()) {
            $site_path = Config::getValue('general', 'site_path', $site_path);
        }
        // TODO: Make sure the correct stylesheet is being used
        ?>
        <html>
        <head>
            <title>Carbon CMS - <?php 
        echo $page_title;
        ?>
</title>
            <style>
                * {
                    margin: 0;
                    padding: 0;
                }

                body {
                    padding: 15px;
                    background: #EEEEEE;
                    color: #000;
                    font-family: Arial, Helvetica, sans-serif;
                    font-size: 14px;
                }

                hr {
                    margin: 8px 0;
                    border: none;
                    border-top: 1px solid #ccc;
                }

                h1 {
                    margin: 16px -8px 8px -8px;
                    padding: 6px 6px 5px 8px;
                    background: #EEE;
                    font-family: Arial, Helvetica, sans-serif;
                    font-size: 16px;
                    font-weight: normal;
                    border-top: 1px solid #ccc;
                    border-bottom: 1px solid #ccc;
                }

                h1:first-child {
                    margin: -8px -8px 8px -8px;
                    padding: 6px 6px 5px 8px;
                    border-top: none;
                    -moz-border-radius-topleft: 5px;
                    -webkit-border-top-left-radius: 5px;
                    border-top-left-radius: 5px;
                    -moz-border-radius-topright: 5px;
                    -webkit-border-top-right-radius: 5px;
                    border-top-right-radius: 5px;
                }

                h2 {
                    margin-bottom: 3px;
                    padding-bottom: 3px;
                    color: #666;
                    font-family: Arial, Helvetica, sans-serif;
                    font-size: 16px;
                    border-bottom: 1px dotted #666;
                }

                #page-wrap {
                    width: 100%;
                    background: none;
                }

                #page-wrap #page {
                    margin-bottom: 15px;
                    padding: 8px;
                    background: #fff;
                    border: 1px solid #ccc;
                    -moz-border-radius: 5px;
                    -webkit-border-radius: 5px;
                    border-radius: 5px;
                }

                #page-wrap #page ul li {
                    margin-left: 20px;
                }

                #page-wrap #page td:first-child {
                    color: #666;
                    padding-right: 10px;
                }

                #page-wrap #page table tr td  {
                    font-size: 14px;
                }

                #page-wrap #page #trace div.step {
                    width: auto;
                    margin-bottom: 20px;
                }

                #page-wrap #page #trace div.step:last-child {
                    margin-bottom: 0;
                }

                #page-wrap #page #trace div.step table tr td  {
                    width: 100%;
                }

                #page-wrap #page #trace div.step table tr td:first-child  {
                    width: 80px;
                    padding-right: 10px;
                    vertical-align: top;
                }

                #page-wrap #page .function {
                    white-space: pre-wrap;
                    white-space: -moz-pre-wrap;
                    white-space: -o-pre-wrap;
                    word-wrap: break-word;
                }

                #page-wrap #page .file {
                    margin-bottom: 6px;
                    color: #666;
                    white-space: pre-wrap;
                    white-space: -moz-pre-wrap;
                    white-space: -o-pre-wrap;
                    word-wrap: break-word;
                }

                #page-wrap #page #trace div.step p.file span.line {
                    color: #000;
                    font-style: normal;
                }

                #page-wrap #page #code {
                    width: auto;
                    max-height: 300px;
                    padding: 0;
                    background: #fff;
                    font-size: 12px;
                    border: 1px solid #ccc;
                    -moz-border-radius: 5px;
                    -webkit-border-radius: 5px;
                    border-radius: 5px;
                    overflow: auto;
                    min-width: 100px;
                }

                #page-wrap #page #code .lines {
                    min-width: 18px;
                    margin-right: 8px;
                    padding: 6px 8px 6px 6px;
                    float: left;
                    background: #eee;
                    text-align: right;
                    border-right: 1px solid #ccc;
                    -moz-border-radius-topleft: 5px;
                    -webkit-border-top-left-radius: 5px;
                    border-top-left-radius: 5px;
                    -moz-border-radius-bottom-left: 5px;
                    -webkit-border-bottom-left-radius: 5px;
                    border-bottom-left-radius: 5px;
                }

                #page-wrap #page #code .code {
                    padding: 6px 0 6px 6px;
                    white-space: nowrap;
                }

                #footer-wrap {
                    width: auto;
                    height: 15px;
                    margin: 10px 0;
                    padding: 0;
                    color: #bbb;
                    font-size: 12px;
                    text-shadow: 0 1px 0 #FFF;
                }

                #footer-wrap a{
                    color: #bbb;
                    text-decoration: none;
                }

                #footer-wrap a:hover{
                    color: #bbb;
                    text-decoration: underline;
                }

                #footer-wrap div.footer-left {
                    float: left;
                }

                #footer-wrap div.footer-right {
                    float: right;
                }            </style>
        </head>
        <body>
            <div id="page-wrap">
        <?php 
    }
示例#16
0
 /**
  * Adiciona um link para arquivos JavaScripts
  * @param type $src 
  */
 public function addScriptLink($src)
 {
     $link = new HTMLScript(Config::baseScripts() . $src);
     $this->head->appendChild($link);
 }
示例#17
0
<?php

require_once "Lib/Autoloader.php";
require_once "Config/Config.php";
use App\Lib\Autoloader;
use App\Config\Config;
use App\Controllers\Dispatcher;
Autoloader::autoloadRegister();
Config::setBasePath(dirname(realpath(__FILE__)) . "/..");
Config::setStorageFileName('/App/example.csv');
require_once "Config/Routing.php";
Dispatcher::run();
示例#18
0
 /**
  * mainly handle the dependency on \App\Config\Config and also
  * lets the class to be more testable on direction
  * in this style we can change the direction to any other place
  */
 public function __construct()
 {
     if (!isset($this->viewsDirection)) {
         $this->viewsDirection = \App\Config\Config::view();
     }
 }
示例#19
0
 public static function getConnect()
 {
     $dbConfig = \App\Config\Config::getConfig()->getParam('db');
     return self::$db ? self::$db : (self::$db = self::setConnect($dbConfig));
 }
示例#20
0
 /**
  * generates cropped image link
  *
  * @param $url
  * @return string
  */
 public static function show($url)
 {
     $name = AFile::get_file_name_with_its_url($url);
     return \App\Config\Config::theme() . "/core/app/helpers/Crop/croped/croped-" . $name;
 }
示例#21
0
 public function __construct()
 {
     $this->person_collection = array();
     $this->storage_file = \App\Config\Config::getBasePath() . \App\Config\Config::getStorageFileName();
 }
示例#22
0
<?php

use app\config\Config;
use app\template\PageFooterBuilder;
use app\template\PageHeaderBuilder;
// Initialize the app
require_once 'app/init.php';
// Set the site's path
$site_root = Config::getValue('general', 'site_url', '');
?>
<!DOCTYPE>
<html>
<head>

    <!-- Title -->
    <title>Hoe zwaar is de taart? &middot; Mohicanen NJO 2016</title>

    <!-- Meta -->
    <meta charset="UTF-8">
    <meta name="description" content="<?php 
echo APP_NAME;
?>
 by Tim Vis&eacute;e">
    <meta name="keywords" content="<?php 
echo APP_NAME;
?>
,Pie,Guesser">
    <meta name="author" content="Tim Vis&eacute;e">
    <link rel="copyright" href="about.php">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="theme-color" content="#0067B2">
示例#23
0
 public static function useBlogApi(array $ids)
 {
     $posts = BlogApi::grabPosts(Config::apiPath(), ['ids' => serialize($ids), 'userPass' => Config::apiPass()]);
     return $posts;
 }
 /**
  * Get the language files directory.
  *
  * @return Directory The directory.
  */
 public static function getLanguageDirectory()
 {
     return new Directory(CARBON_SITE_ROOT, Config::getValue('app', 'language.directory', '/language'));
 }
示例#25
0
<?php

require_once __DIR__ . '/vendor/autoload.php';
use App\Application, App\config\Config, App\config\reader\PhpConfigReader;
try {
    $configReader = new PhpConfigReader(__DIR__ . '/config/main.php');
    $config = new Config($configReader);
    if (!$config->validate()) {
        throw new \Exception($config->getErrorMessage());
    }
    Application::getInstance($config)->run();
} catch (\Exception $e) {
    echo "ERROR\n";
    echo $e->getMessage() . "\n";
}
示例#26
0
 /**
  * @dataProvider _testValidateConfigDataProvider
  */
 public function testValidateConfig($config, $result)
 {
     $reader = $this->getReaderMock($config);
     $config = new Config($reader);
     $this->assertEquals($result, $config->validate());
 }
 /**
  * Get the database table name of the guesses.
  *
  * @return string The database table name.
  */
 public static function getDatabaseTableName()
 {
     return Config::getValue('database', 'table_prefix', '') . static::DB_TABLE_NAME;
 }
示例#28
0
<?php

/** This file is part of KCFinder project
 *
 *      @desc Base configuration file
 *   @package KCFinder
 *   @version 2.52-dev
 *    @author Pavel Tzonkov <*****@*****.**>
 * @copyright 2010, 2011 KCFinder Project
 *   @license http://www.opensource.org/licenses/gpl-2.0.php GPLv2
 *   @license http://www.opensource.org/licenses/lgpl-2.1.php LGPLv2
 *      @link http://kcfinder.sunhater.com
 */
// IMPORTANT!!! Do not remove uncommented settings in this file even if
// you are using session configuration.
// See http://kcfinder.sunhater.com/install for setting descriptions
// === START ===
define("BASE_PATH", realpath(dirname(__FILE__)) . '/../../../../../../../../');
$session_id = session_id();
session_start();
mb_internal_encoding("UTF-8");
require_once BASE_PATH . '/vendor/autoload.php';
use App\Config\Config;
require_once BASE_PATH . '/globals.php';
require_once BASE_PATH . '/config/config.common.php';
require_once BASE_PATH . '/config/config.unique.php';
$config = new Config();
// === END ===
$_CONFIG = array('disabled' => false, 'theme' => "oxygen", 'uploadURL' => $config->getProtected("kcFinderUploadPath"), 'uploadDir' => "", 'types' => array('files' => "", 'flash' => "swf", 'images' => "*img", 'file' => "", 'media' => "swf flv avi mpg mpeg qt mov wmv asf rm", 'image' => "*img"), 'imageDriversPriority' => "imagick gmagick gd", 'jpegQuality' => 90, 'thumbsDir' => ".thumbs", 'maxImageWidth' => 0, 'maxImageHeight' => 0, 'thumbWidth' => 100, 'thumbHeight' => 100, 'watermark' => "", 'denyZipDownload' => false, 'denyUpdateCheck' => false, 'denyExtensionRename' => false, 'dirPerms' => 0755, 'filePerms' => 0644, 'access' => array('files' => array('upload' => true, 'delete' => true, 'copy' => true, 'move' => true, 'rename' => true), 'dirs' => array('create' => true, 'delete' => true, 'rename' => true)), 'deniedExts' => "exe com msi bat php phps phtml php3 php4 cgi pl", 'filenameChangeChars' => array(), 'dirnameChangeChars' => array(), 'mime_magic' => "", 'cookieDomain' => "", 'cookiePath' => "", 'cookiePrefix' => 'KCFINDER_', '_check4htaccess' => true, '_sessionVar' => &$_SESSION['KCFINDER']);
示例#29
0
use carbon\core\autoloader\Autoloader;
Autoloader::addLoader(new AppLoader());
// Load the configuration
use app\config\Config;
Config::load();
// Set up the error handler
use carbon\core\ErrorHandler;
ErrorHandler::init(true, true, Config::getValue('app', 'debug'));
// Connect to the database
use app\database\Database;
Database::connect();
// Set up the cookie manager
use carbon\core\cookie\CookieManager;
CookieManager::setCookieDomain(Config::getValue('cookie', 'domain', ''));
CookieManager::setCookiePath(Config::getValue('cookie', 'path', '/'));
CookieManager::setCookiePrefix(Config::getValue('cookie', 'prefix', ''));
// Set up the language manager
use app\language\LanguageManager;
LanguageManager::init(true, Registry::getValue('language.default.tag')->getValue());
$languageTag = LanguageManager::getCookieLanguageTag();
if ($languageTag !== null) {
    LanguageManager::setCurrentLanguageTag($languageTag);
}
// Setup a simplified language function
/**
 * Get a language value for the current preferred language.
 *
 * @param string $section Value section.
 * @param string $key Value key.
 * @param string|null $default The default value, or null.
 *
示例#30
-8
 private function __construct()
 {
     $this->username = Config::get('mysql/username');
     $this->password = Config::get('mysql/password');
     $this->dsn = 'mysql:host=' . Config::get('mysql/host') . ';dbname=' . Config::get('mysql/database');
     array(\PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION);
     try {
         $this->database = new \PDO($this->dsn, $this->username, $this->password);
     } catch (\PDOException $ex) {
         $this->errors = $ex;
     }
 }