本文整理汇总了PHP中app\Config类的典型用法代码示例。如果您正苦于以下问题:PHP Config类的具体用法?PHP Config怎么用?PHP Config使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Config类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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']);
}
}
开发者ID:alejandrososa,项目名称:angularja,代码行数:25,代码来源:modelo.php
示例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);
}
开发者ID:phantsang,项目名称:1u0U39rjwJO4Vmnt99uk9j6,代码行数:26,代码来源:Common.php
示例3: run
public function run(Request $request, Response $response, array $args)
{
$db = new Db();
$db->install();
$config = new Config();
return new RedirectResponse($config->baseUrl());
}
开发者ID:samwilson,项目名称:swidau,代码行数:7,代码来源:InstallController.php
示例4: run
public function run()
{
$config = new Config();
$this->write("Upgrading " . $config->siteTitle() . " . . . ");
$db = new Db();
$db->install();
$this->write("Upgrade complete");
}
开发者ID:samwilson,项目名称:swidau,代码行数:8,代码来源:UpgradeCommand.php
示例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;
}
开发者ID:alejandrososa,项目名称:angularja,代码行数:9,代码来源:JaUsuarios.php
示例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());
}
开发者ID:samwilson,项目名称:swidau,代码行数:10,代码来源:ItemController.php
示例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");
}
}
开发者ID:stormtrooper42,项目名称:stirl,代码行数:10,代码来源:Database.php
示例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;
}
开发者ID:samwilson,项目名称:swidau,代码行数:18,代码来源:App.php
示例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>';
}
}
开发者ID:dreamcoil,项目名称:dreamcoil,代码行数:15,代码来源:ExampleClass.php
示例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);
}
开发者ID:TomCan,项目名称:dashboard,代码行数:28,代码来源:kayakoController.php
示例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!');
}
开发者ID:lmkhang,项目名称:mcntw,代码行数:40,代码来源:Admin.php
示例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('[email protected]', 'GIBX Internal System');
$date = \Carbon\Carbon::today('Asia/Manila')->format('d/m/Y');
$recipients = ['[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]', '[email protected]'];
$message->to($recipients)->subject('GIBX Claims System Daily Report ' . $date);
});
// TODO: Send an email for reporting here...
}
return $next($request);
}
开发者ID:neutt22,项目名称:claims-system,代码行数:28,代码来源:SendReportForToday.php
示例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);
}
开发者ID:majchrosoft,项目名称:bars-in-cracow,代码行数:7,代码来源:Photo.php
示例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);
}
开发者ID:jtoshmat,项目名称:laravel,代码行数:7,代码来源:Role.php
示例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));
}
开发者ID:adrielov,项目名称:Chalenge-SOFTBOX,代码行数:7,代码来源:Model.php
示例16: __construct
/**
* Подключение шаблонизатора Twig
*/
public function __construct()
{
$config = \App\Config::instance();
$templates_dir = $config->data['templates']['dir'];
$loader = new \Twig_Loader_Filesystem($templates_dir);
$this->twig = new \Twig_Environment($loader);
}
开发者ID:KnyazkovAlexey,项目名称:php2_homework_Knyazkov,代码行数:10,代码来源:View.php
示例17: setMetadata
/**
* setMetadata for common pages
*/
private function setMetadata($prefix = '')
{
// metadata
$site_title = Config::findByKey('site_title')->first()->value;
if ($prefix != '') {
$site_title = $prefix . ' - ' . $site_title;
}
$meta_description = Config::findByKey('meta_description')->first()->value;
$meta_keywords = Config::findByKey('meta_keywords')->first()->value;
SEOMeta::setTitle($site_title);
SEOMeta::setDescription($meta_description);
SEOMeta::addKeyword([$meta_keywords]);
OpenGraph::setTitle($site_title);
OpenGraph::setDescription($meta_description);
OpenGraph::setUrl(url());
OpenGraph::addProperty('type', 'website');
OpenGraph::addProperty('site_name', 'Kết Nối Mới');
OpenGraph::addImage(url() . '/frontend/images/fb_share_1.jpg');
OpenGraph::addImage(url() . '/frontend/images/fb_share_2.jpg');
OpenGraph::addImage(url() . '/frontend/images/fb_share_3.jpg');
OpenGraph::addImage(url() . '/frontend/images/fb_share_4.jpg');
OpenGraph::addImage(url() . '/frontend/images/fb_share_5.jpg');
OpenGraph::addImage(url() . '/frontend/images/fb_share_6.jpg');
OpenGraph::addImage(url() . '/frontend/images/fb_share_7.jpg');
// end metadata
}
开发者ID:phantsang,项目名称:KPh0f834yaAzxwRam833wiFL6,代码行数:29,代码来源:PagesController.php
示例18: store
public function store(Request $request)
{
$userPlayers = new UserPlayers();
//$team->where('team_name', $request->team_name)->first()->contract_id;
$playerContractId = Contracts::where('player_id', $request->player_id)->select('contract_id')->first()->contract_id;
$playerClubId = Contracts::where('player_id', $request->player_id)->select('club_id')->first()->club_id;
$countPlayers = $userPlayers->join('fantasy_contracts', 'fantasy_user_players.id', '=', 'fantasy_contracts.player_id')->join('fantasy_club', 'fantasy_contracts.club_id', '=', 'fantasy_club.club_id')->where('user_id', $request->user()->id)->where('fantasy_club.club_id', $playerClubId)->count();
$config = Config::select()->first();
if ($userPlayers->where('user_id', $request->user()->id)->where('id', $playerContractId)->first()) {
$error = "havePlayer";
} elseif (!($countPlayers < $config->same_team_player)) {
$error = "playerLimit";
} elseif ($request->user()->credits - Players::where('player_id', $request->player_id)->select('price')->first()->price <= 0) {
$error = "noCredits";
} else {
User::where('id', $request->user()->id)->update(['credits' => $request->user()->credits - Players::where('player_id', $request->player_id)->select('price')->first()->price]);
$userPlayers->team_id = $request->user()->team->team_id;
$userPlayers->user_id = $request->user()->id;
$userPlayers->id = $playerContractId;
$userPlayers->save();
return redirect()->back();
}
//return new RedirectResponse(url('add_player_in_team'));
return redirect()->back()->with('error', trans('front/site.' . $error));
}
开发者ID:elvinas21,项目名称:BasketballFantasyLeague,代码行数:25,代码来源:AddPlayerInTeamController.php
示例19: getJSONLD
public function getJSONLD()
{
return '{
"@context": "http://schema.org",
"@type": "NewsArticle",
"mainEntityOfPage":{
"@type":"WebPage",
"@id":"' . $this->getLink($this->categories()->first()->key) . '"
},
"headline": "' . $this->name . '",
"image": {
"@type": "ImageObject",
"url": "' . url() . Image::url($this->getFirstAttachment(), 748, 388, array('crop')) . '",
"height": "748",
"width": "388"
},
"datePublished": "' . $this->created_at->toW3CString() . '",
"dateModified": "' . $this->updated_at->toW3CString() . '",
"author": {
"@type": "Person",
"name": "' . $this->created_by . '"
},
"publisher": {
"@type": "Organization",
"name": "' . Config::findByKey('site_name')->first()->value . '",
"logo": {
"@type": "ImageObject",
"url": "' . url() . '/frontend/images/logo.png",
"width": "90",
"height": "21"
}
},
"description": "' . $this->summary . '"
}';
}
开发者ID:phantsang,项目名称:8csfOIjOaJSlDG2Y3x992O,代码行数:35,代码来源:Article.php
示例20: getReset
public function getReset()
{
$config = Config::getConfig();
if (Auth::check()) {
return view('auth.reset', compact('config'));
}
return Redirect::route('getLogin');
}
开发者ID:borghan,项目名称:Laravel_Blog,代码行数:8,代码来源:PasswordController.php
注:本文中的app\Config类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论