本文整理汇总了PHP中app\Config类的典型用法代码示例。如果您正苦于以下问题:PHP Config类的具体用法?PHP Config怎么用?PHP Config使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Config类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _conexion
private function _conexion()
{
//$entorno = new Entorno();
//self::$config = $this->config_load($entorno->getEntorno().'app_config');
$configApp = new Config();
$this->config = $configApp->getBaseDatos();
if (empty($this->config['driver'])) {
die('Por favor, establece un controlador de base de datos valido ' . $this->config['driver']);
}
$driver = strtoupper($this->config['driver']);
switch ($driver) {
case 'MYSQL':
$this->_dbHost = $this->config['host'];
$this->_dbbd = $this->config['nombre'];
$this->_dbusuario = $this->config['usuario'];
$this->_dbclave = $this->config['clave'];
$this->pdo = new PDO('mysql:host=' . $this->_dbHost . '; dbname=' . $this->_dbbd, $this->_dbusuario, $this->_dbclave);
$this->pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$this->pdo->exec("SET CHARACTER SET utf8");
$this->_cnx = $this->pdo;
break;
default:
die('Base de datos no soporta: ' . $this->config['driver']);
}
}
示例2: sendEmail
public function sendEmail($template, $data = [], $to, $toName, $subject, $cc = null, $bcc = null, $replyTo = null)
{
$result = false;
try {
$config = new Config();
$messageHeader = ['from' => $config->getValueByKey('address_sender_mail'), 'fromName' => $config->getValueByKey('display_name_send_mail'), 'to' => $to, 'toName' => $toName, 'cc' => $cc, 'bcc' => $bcc, 'replyTo' => $replyTo, 'subject' => $subject];
\Mail::send($template, $data, function ($message) use($messageHeader) {
$message->from($messageHeader['from'], $messageHeader['fromName']);
$message->to($messageHeader['to'], $messageHeader['toName']);
if (!is_null($messageHeader['cc'])) {
$message->cc($messageHeader['cc']);
}
if (!is_null($messageHeader['bcc'])) {
$message->bcc($messageHeader['bcc']);
}
if (!is_null($messageHeader['replyTo'])) {
$message->replyTo($messageHeader['replyTo']);
}
$message->subject($messageHeader['subject']);
});
$result = true;
} catch (Exception $e) {
$result = ['success' => false, 'message' => $e->getMessage()];
}
return \Response::json($result);
}
示例3: run
public function run(Request $request, Response $response, array $args)
{
$db = new Db();
$db->install();
$config = new Config();
return new RedirectResponse($config->baseUrl());
}
示例4: run
public function run()
{
$config = new Config();
$this->write("Upgrading " . $config->siteTitle() . " . . . ");
$db = new Db();
$db->install();
$this->write("Upgrade complete");
}
示例5: getToken
private function getToken($credencial)
{
$config = new Config();
$dominio = $config->getGeneral();
$token = '';
$token = (new Builder())->setIssuer($dominio['dominio'])->setAudience($dominio['dominio'])->setId('jajwt', true)->setIssuedAt(time())->setNotBefore(time() + 60)->setExpiration(time() + 3600)->set('sub', 1)->set('user', $credencial->usuario)->set('roles', $credencial->rol)->getToken();
// Retrieves the generated token
return (string) $token;
}
示例6: save
public function save(Request $request, Response $response, array $args)
{
$_POST = array_filter($_POST, 'trim');
$metadata = array('id' => filter_input(INPUT_POST, 'id', FILTER_SANITIZE_NUMBER_INT), 'title' => filter_input(INPUT_POST, 'title'), 'description' => filter_input(INPUT_POST, 'description'), 'date' => filter_input(INPUT_POST, 'date'), 'date_granularity' => filter_input(INPUT_POST, 'date_granularity', FILTER_SANITIZE_NUMBER_INT), 'edit_group' => filter_input(INPUT_POST, 'edit_group', FILTER_SANITIZE_NUMBER_INT), 'read_group' => filter_input(INPUT_POST, 'read_group', FILTER_SANITIZE_NUMBER_INT));
$tags = filter_input(INPUT_POST, 'tags');
$item = new Item(null, $this->user);
$item->save($metadata, $tags, $_FILES['file']['tmp_name'], filter_input(INPUT_POST, 'file_contents'));
$config = new Config();
return new RedirectResponse($config->baseUrl() . '/' . $item->getId());
}
示例7: __construct
public function __construct($db_name, $db_user = 'root', $db_pass = 'root', $db_host = 'localhost')
{
$config = new Config();
if ($config != null) {
$this->db_name = $config->get("db_name");
$this->db_user = $config->get("db_user");
$this->db_pass = $config->get("db_pass");
$this->db_host = $config->get("db_host");
}
}
示例8: getFilesystem
/**
* Get the filesystem manager.
*
* @return MountManager
* @throws \Exception
*/
public static function getFilesystem()
{
$config = new Config();
$manager = new MountManager();
foreach ($config->filesystems() as $name => $fsConfig) {
$adapterName = '\\League\\Flysystem\\Adapter\\' . self::camelcase($fsConfig['type']);
$adapter = new $adapterName($fsConfig['root']);
$fs = new Filesystem($adapter);
$manager->mountFilesystem($name, $fs);
}
return $manager;
}
示例9: called
public function called()
{
$config = new Config();
$title = new \Dreamcoil\Codebowl\Title();
$auth = new \Dreamcoil\Auth();
$title->set($config->get('title'));
$title->append('Home');
$layout = new \Dreamcoil\Layout('Bubo', array('title' => $title->get(), 'time' => time()));
echo "We're going to miss you Dreamcoil v1<hr>";
\Models\UserModel::getData();
$auth->set(array('Name' => 'Florian'));
if ($auth->check()) {
echo '<br>Welcome!</br>';
}
}
示例10: getStatsAction
public function getStatsAction()
{
$config = Config::get("kayako");
$db = new \PDO("mysql:dbname=" . $config["database"] . ";host=" . $config["host"], $config["username"], $config["password"]);
$sql = "\n SELECT ticketstatusid, ticketstatustitle, ownerstaffid, ownerstaffname, count(*) as cnt FROM `swtickets`\n WHERE departmentid in (3,4)\n GROUP BY ticketstatusid, ownerstaffid, ownerstaffname\n ";
$stats = array("status" => array("total" => 0), "user" => array("total" => 0));
foreach ($db->query($sql) as $row) {
$stats['status']["total"] += $row["cnt"];
if (!isset($stats['status'][$row["ticketstatustitle"]])) {
$stats['status'][$row["ticketstatustitle"]] = 0;
}
$stats['status'][$row["ticketstatustitle"]] += $row["cnt"];
if (!isset($stats['user'][$row["ownerstaffname"]])) {
$stats['user'][$row["ownerstaffname"]] = array("total" => 0);
}
$stats['user'][$row["ownerstaffname"]]["total"] += $row["cnt"];
if (!isset($stats['user'][$row["ownerstaffname"]][$row["ticketstatustitle"]])) {
$stats['user'][$row["ownerstaffname"]][$row["ticketstatustitle"]] = 0;
}
$stats['user'][$row["ownerstaffname"]][$row["ticketstatustitle"]] += $row["cnt"];
}
if (isset($stats['user'][''])) {
$stats['user']['Unassigned'] = $stats['user'][''];
unset($stats['user']['']);
}
header('Content-type: application/json');
echo json_encode($stats);
}
示例11: login
/**
* @author: lmkhang (skype)
* @date: 2016-01-15
* Action: Admin login
*/
public function login(Request $request)
{
//check islogged
if ($this->isLoggedAdmin()) {
//set Flash Message
$this->setFlash('message', 'Logged!');
return Redirect::intended('/adminntw')->with('message', 'Logged!');
}
$post = $request->all();
$info = $this->trim_all($post['login']);
//Setup validation
$validator = Validator::make($info, ['account' => 'required|min:5|max:100', 'password' => 'required|min:5|max:50']);
//Checking
if ($validator->fails()) {
// The given data did not pass validation
//set Flash Message
$this->setFlash('message', 'Errors!');
return redirect()->back();
}
$salt = \App\Config::where(['prefix' => 'admin', 'name' => 'salt', 'del_flg' => 1])->get()[0]['value'];
$pwd = $this->encryptString($info['password'], $salt);
$admin_get = new \App\Admin();
$admin = $admin_get->checkAccount($info['account'], $pwd);
//set Session
if (!$admin) {
//set Flash Message
$this->setFlash('message', 'This account is not available!');
return redirect()->back()->with('message', 'This account is not available!');
}
//set Session
$this->setLogSession($admin->toArray());
//set Flash Message
$this->setFlash('message', 'Login successfully!');
return Redirect::intended('/adminntw')->with('message', 'Login successfully!');
}
示例12: handle
public function handle($request, Closure $next)
{
$today = Carbon::now('Asia/Manila');
$report_date = Config::find(1);
// Send a report if today is not set to our config table
if ($report_date->report_date->day != $today->day || $report_date->report_date->month != $today->month || $report_date->report_date->year != $today->year) {
$report_date->report_date = $today;
$report_date->save();
$deadline_names = [];
$i = new \App\Info();
foreach (\App\Info::all() as $info) {
$deadline = $i->isDeadLineToday($info->dead_line);
if ($deadline == 'deadline' && $info->claim_status != 'approved') {
$deadline_names[$info->name] = $info;
}
}
$data = array('data' => $deadline_names);
\Log::info('Sending mail....');
\Mail::send('email.email', $data, function ($message) {
$message->from('ovejera.jimpaulo@gmail.com', 'GIBX Internal System');
$date = \Carbon\Carbon::today('Asia/Manila')->format('d/m/Y');
$recipients = ['f360.jovejera@gmail.com', 'ddcruz@gibco.guevent.com', 'fvgazzingan@f360.guevent.com', 'foalcazar@f360.guevent.com', 'mlsantos@gibco.guevent.com', 'llcustodio@gibco.guevent.com', 'echavarria@guevent.com', 'ethel_chavarria@yahoo.com', 'paodelro@gmail.com', 'psdelrosario@gibco.guevent.com', 'domcruzged.am@gmail.com', 'ag@guevent.com'];
$message->to($recipients)->subject('GIBX Claims System Daily Report ' . $date);
});
// TODO: Send an email for reporting here...
}
return $next($request);
}
示例13: createFromApi
public static function createFromApi($placeId, $apiData)
{
$photo = self::create(['place_id' => $placeId, 'photo_reference' => $apiData->photo_reference, 'width' => $apiData->width, 'height' => $apiData->height]);
$response = \App\Api\Place::getPhoto($apiData->photo_reference);
file_put_contents(\Config::get('place.photo_path') . $photo->id . '.jpg', $response->getResultPhoto());
unset($response);
}
示例14: getRole
public static function getRole($role_id)
{
//TODO let's not call the DB here.
//return self::find($role_id);
$roles = (array) \Config::get('mycustomvars.roles');
return array_search($role_id, $roles);
}
示例15: __construct
public function __construct()
{
$adapter = Config::get('database.engine');
$this->created_at = date('Y-m-d H:i:s');
$this->update = (object) array();
$this->setAdapter(DatabaseAdapterFactory::create($adapter));
}