本文整理汇总了PHP中AppConfig::get方法的典型用法代码示例。如果您正苦于以下问题:PHP AppConfig::get方法的具体用法?PHP AppConfig::get怎么用?PHP AppConfig::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AppConfig
的用法示例。
在下文中一共展示了AppConfig::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: app_controller
function app_controller()
{
global $session, $route, $mysqli;
$result = false;
include "Modules/app/AppConfig_model.php";
$appconfig = new AppConfig($mysqli);
if ($route->format == 'html') {
if ($route->action == "" && $session['write']) {
$result = view("Modules/app/client.php", array());
}
}
if ($route->format == 'json') {
if ($route->action == "setconfig" && $session['write']) {
$result = $appconfig->set($session['userid'], get('data'));
}
if ($route->action == "getconfig" && $session['read']) {
$result = $appconfig->get($session['userid']);
}
if ($route->action == "dataremote") {
$id = (int) get("id");
$start = (double) get("start");
$end = (double) get("end");
$interval = (int) get("interval");
$result = json_decode(file_get_contents("http://emoncms.org/feed/data.json?id={$id}&start={$start}&end={$end}&interval={$interval}&skipmissing=0&limitinterval=0"));
}
if ($route->action == "valueremote") {
$id = (int) get("id");
$result = (double) json_decode(file_get_contents("http://emoncms.org/feed/value.json?id={$id}"));
}
}
return array('content' => $result, 'fullwidth' => true);
}
示例2: get_config_data
public static function get_config_data()
{
if (!($config = AppConfig::get()->first())) {
return [];
}
return $config->forAPI();
}
示例3: getDB
public static function getDB()
{
if (is_null(self::$db)) {
self::$db = self::getMongo()->{AppConfig::get("db.mongodb.name")};
}
return self::$db;
}
示例4: getMySql
/**
* @return \Doctrine\ORM\EntityManager
*/
public static function getMySql()
{
if (is_null(self::$mysql)) {
$paths = array('src/Main/Entity');
$config = \Doctrine\ORM\Tools\Setup::createAnnotationMetadataConfiguration($paths, true);
self::$mysql = \Doctrine\ORM\EntityManager::create(array('driver' => 'pdo_mysql', 'user' => AppConfig::get("db.mysql.host"), 'password' => AppConfig::get("db.mysql.password"), 'dbname' => AppConfig::get("db.mysql.name"), 'charset' => 'utf8', 'driverOptions' => array(1002 => 'SET NAMES utf8')), $config);
}
return self::$mysql;
}
示例5: load
public static function load($objectType, $asSingelton = FALSE, $params = '')
{
$factoryClass = AppConfig::get('factory_settings', 'template');
if (!class_exists($factoryClass)) {
throw new \Exception("Could not find class {$factoryClass} for Factory Option: {$objectType}");
}
$classExtends = class_parents($factoryClass);
$classInterfaces = class_implements($factoryClass);
if (class_exists($factoryClass) && in_array($objectType, $classExtends) && in_array($objectType . 'Interface', $classInterfaces)) {
if ($asSingelton) {
return $factoryClass::singleton($params);
} else {
return new $factoryClass($params);
}
} else {
throw new \Exception('Invalid Factory Option for: ' . $objectType);
}
}
示例6: getIndex
public function getIndex($slug = '', $link_id = 0)
{
$debug = '';
$bmStart = microtime(true);
$perpage = intval(AppConfig::get('articles_per_page', 50));
$branch_prefixes = explode(',', AppConfig::get('branch_prefixes'));
$virtualPerpage = intval(AppConfig::get('virtual_per_page', 20));
$page = Page::where('slug', '=', $slug)->cacheTags('pages')->remember(1440)->first();
//$page = Page::where('slug', '=', Str::slug($slug))->first();
if (count($page) > 0) {
if ($filter_return = $this->authFilter($page->level)) {
return $filter_return;
}
if ($page->redirect) {
if (substr($page->redirect, 0, 1) == '{') {
$redir_arr = json_decode($page->redirect, true);
foreach ($redir_arr as $rlvl => $rslug) {
if (strpos($this->auth_lvl, $rlvl) !== false) {
return Redirect::to($rslug);
}
}
if (isset($redir_arr['def'])) {
return Redirect::to($redir_arr['def']);
}
} else {
return Redirect::to($page->redirect);
}
}
// get parameters from URL
$page->category = Input::has('category') ? Input::get('category') : ($page->default_category ? $page->default_category : false);
$page->section = Input::has('section') ? Input::get('section') : false;
$page->keywordInput = $page->ddkeycol ? Input::get('keyword') : '';
$page_vars = new stdClass();
// separate slug into branch and section, if applicable
$branch = $slug;
if ($page->link_slug) {
$branch = $page->link_slug;
}
$els = explode('/', $branch);
if (in_array($els[0], $branch_prefixes) && count($els) > 1) {
$branch = $els[0];
if (!$page->section) {
$page->section = $els[1];
}
}
$dta = normal::getTypes();
// get list of categories, if there is a "ddlist"
$categories = false;
$normalized = false;
if ($page->ddlist) {
$fld = $page->ddlist;
$catq = Link::where('branch', '=', $branch);
if ($page->section) {
$catq->where('section', '=', $page->section);
}
if ($dtp = array_search($fld, $dta)) {
$catq->join('data', 'data.rec_id', '=', 'links.id')->where('data.table_name', '=', 'links')->where('data.type', '=', $dtp)->whereNull('data.deleted_at');
$fld = 'data_body';
$normalized = true;
}
$category_model = $catq->groupBy($fld)->whereRaw('trim(`' . $fld . '`) != ""')->cacheTags('links')->remember(1440)->get(array($fld));
$categories = array('' => 'All');
foreach ($category_model as $category_item) {
$categories[$category_item->{$fld}] = $category_item->{$fld};
}
}
$links = false;
$columns = false;
// get list of links, specified by branch, section, category, state, and/or keyword
if ($page->linkdef || $link_id && $page->detaildef) {
// get column layout
$columns = Listcolumns::where('def', '=', $link_id ? $page->detaildef : $page->linkdef)->cacheTags('links')->remember(1440)->orderBy('listorder')->get();
$perlinkpage = intval(AppConfig::get('links_per_page', 50));
$query = new Link();
if ($link_id) {
$query = $query->where('id', '=', $link_id);
} else {
if ($page->section) {
$query = $query->where('section', '=', $page->section);
}
if ($page->category) {
if ($normalized) {
$query = $query->join('data AS d', 'd.rec_id', '=', 'links.id')->where('d.table_name', '=', 'links')->where('d.type', '=', $dtp)->whereNull('d.deleted_at');
}
$query = $query->where(isset($fld) ? $fld : ($page->section ? 'category' : 'section'), '=', $page->category);
}
if ($page->state) {
$query = $query->where('state', '=', $page->state);
}
if ($page->keywordInput) {
if ($page->keywordInput == "by_date") {
$query = $query->join('data AS d', 'd.rec_id', '=', 'links.id')->where('d.table_name', '=', 'links')->where('d.type', '=', 7)->whereNull('d.deleted_at');
$month = Input::get('themonth');
$year = Input::get('theyear');
$pfx = $year . '-' . $month;
$start_date = $pfx . '-01';
$end_date = $pfx . '-' . cal_days_in_month(CAL_GREGORIAN, $month, $year);
$query = $query->whereRaw('d.`data_body` BETWEEN ? AND ?', array($start_date, $end_date));
unset($page->keywordInput);
$page_vars->month = $month;
//.........这里部分代码省略.........
示例7: AppConfig
<?php
require_once 'app_config.php';
$_config = new AppConfig();
echo $_config->get('OPERATION_MODE') . "<br>";
echo $_config->get('MYSQL_DEFAULT', 'MYSQL_DEFAULT_DSN');
示例8: password_crypt
/**
* User password hash function.
*
* This function use Bcrypt, see http://en.wikipedia.org/wiki/Bcrypt.
*
* @param $password
* The password to hash.
*
* @return
* A printable crypt() scheme.
* see http://en.wikipedia.org/wiki/Crypt_(C)#Blowfish-based_scheme
*/
public static function password_crypt($password)
{
$cost = AppConfig::get('security.bcrypt_cost', 14);
// default is 14, better safe than sorry.
return password_hash($password, PASSWORD_BCRYPT, array('cost' => $cost));
}
示例9: json_encode
moment.locale(window.lang);
// bootstrap-datetimepicker
$('.datepickerize').datetimepicker({
pickTime: false,
language: window.lang,
weekStart: 1,
format: <?php
echo json_encode(strftime2momentjs(AppConfig::get('l10n.strftime_date_format')));
?>
});
$('.datetimepickerize').datetimepicker({
pickTime: true,
language: window.lang,
weekStart: 1,
format: <?php
echo json_encode(strftime2momentjs(AppConfig::get('l10n.strftime_datetime_format')));
?>
});
});
</script>
</head>
<body>
<?php
$view->render('header');
?>
<div class="container">
<section id="content">
<?php
$view->render('messages');
示例10: install
public function install(AppConfig $app, $db_params)
{
logMessage(L_USER, sprintf("Copying application files to %s", $app->get('BASE_DIR')));
logMessage(L_USER, sprintf("current working dir is %s", getcwd()));
if (!OsUtils::rsync('package/app/', $app->get('BASE_DIR'), "--exclude web/content")) {
return "Failed to copy application files to target directory";
}
if ($app->get('DB1_CREATE_NEW_DB')) {
if (!OsUtils::rsync("package/app/web/content", $app->get('WEB_DIR'))) {
return "Failed to copy default content into /opt/kaltura/web";
}
}
$os_name = OsUtils::getOsName();
$architecture = OsUtils::getSystemArchitecture();
logMessage(L_USER, "Copying binaries for {$os_name} {$architecture}");
if (!OsUtils::fullCopy("package/bin/{$os_name}/{$architecture}", $app->get('BIN_DIR'))) {
return "Failed to copy binaries for {$os_name} {$architecture}";
}
logMessage(L_USER, "Creating the uninstaller");
if (!OsUtils::fullCopy('installer/uninstall.php', $app->get('BASE_DIR') . "/uninstaller/")) {
return "Failed to create the uninstaller";
}
//create uninstaller.ini with minimal definitions
$app->saveUninstallerConfig();
//OsUtils::logDir definition
OsUtils::$logDir = $app->get('LOG_DIR');
// if vmware installation copy configurator folders
if ($app->get('KALTURA_PREINSTALLED')) {
mkdir($app->get('BASE_DIR') . '/installer', 0777, true);
if (!OsUtils::rsync('installer/', $app->get('BASE_DIR') . '/installer')) {
return "Failed to copy installer files to target directory";
}
if (!OsUtils::fullCopy('configurator/', $app->get('BASE_DIR') . '/installer')) {
return "Failed to copy configurator files to target directory";
}
if (!OsUtils::fullCopy('configure.php', $app->get('BASE_DIR') . "/installer/")) {
return "Failed to copy configure.php file to targer directory";
}
}
logMessage(L_USER, "Replacing configuration tokens in files");
foreach ($this->install_config['token_files'] as $file) {
$replace_file = $app->replaceTokensInString($file);
if (!$app->replaceTokensInFile($replace_file)) {
return "Failed to replace tokens in {$replace_file}";
}
}
$this->changeDirsAndFilesPermissions($app);
if (!$app->get('DB1_CREATE_NEW_DB') && DatabaseUtils::dbExists($db_params, $app->get('DB1_NAME')) === true) {
logMessage(L_USER, sprintf("Skipping '%s' database creation", $app->get('DB1_NAME')));
} else {
$sql_files = parse_ini_file($app->get('BASE_DIR') . APP_SQL_DIR . 'create_kaltura_db.ini', true);
logMessage(L_USER, sprintf("Creating and initializing '%s' database", $app->get('DB1_NAME')));
if (!DatabaseUtils::createDb($db_params, $app->get('DB1_NAME'))) {
return "Failed to create '" . $app->get('DB1_NAME') . "' database";
}
foreach ($sql_files['kaltura']['sql'] as $sql) {
$sql_file = $app->get('BASE_DIR') . APP_SQL_DIR . $sql;
if (!DatabaseUtils::runScript($sql_file, $db_params, $app->get('DB1_NAME'))) {
return "Failed running database script {$sql_file}";
}
}
}
if (!$app->get('DB1_CREATE_NEW_DB') && DatabaseUtils::dbExists($db_params, $app->get('SPHINX_DB_NAME')) === true) {
logMessage(L_USER, sprintf("Skipping '%s' database creation", $app->get('SPHINX_DB_NAME')));
} else {
logMessage(L_USER, sprintf("Creating and initializing '%s' database", $app->get('SPHINX_DB_NAME')));
if (!DatabaseUtils::createDb($db_params, $app->get('SPHINX_DB_NAME'))) {
return "Failed to create '" . $app->get('SPHINX_DB_NAME') . "' database";
}
foreach ($sql_files[$app->get('SPHINX_DB_NAME')]['sql'] as $sql) {
$sql_file = $app->get('BASE_DIR') . APP_SQL_DIR . $sql;
if (!DatabaseUtils::runScript($sql_file, $db_params, $app->get('SPHINX_DB_NAME'))) {
return "Failed running database script {$sql_file}";
}
}
}
if (!$app->get('DB1_CREATE_NEW_DB') && DatabaseUtils::dbExists($db_params, $app->get('DWH_DATABASE_NAME')) === true) {
logMessage(L_USER, sprintf("Skipping '%s' database creation", $app->get('DWH_DATABASE_NAME')));
} else {
logMessage(L_USER, "Creating data warehouse");
if (!OsUtils::execute(sprintf("%s/setup/dwh_setup.sh -h %s -P %s -u %s -p %s -d %s ", $app->get('DWH_DIR'), $app->get('DB1_HOST'), $app->get('DB1_PORT'), $app->get('DWH_USER'), $app->get('DWH_PASS'), $app->get('DWH_DIR')))) {
return "Failed running data warehouse initialization script";
}
}
logMessage(L_USER, "Creating Dynamic Enums");
if (OsUtils::execute(sprintf("%s %s/deployment/base/scripts/installPlugins.php", $app->get('PHP_BIN'), $app->get('APP_DIR')))) {
logMessage(L_INFO, "Dynamic Enums created");
} else {
return "Failed to create dynamic enums";
}
logMessage(L_USER, "Create query cache triggers");
if (OsUtils::execute(sprintf("%s %s/deployment/base/scripts/createQueryCacheTriggers.php", $app->get('PHP_BIN'), $app->get('APP_DIR')))) {
logMessage(L_INFO, "sphinx Query Cache Triggers created");
} else {
return "Failed to create QueryCacheTriggers";
}
logMessage(L_USER, "Populate sphinx tables");
if (OsUtils::execute(sprintf("%s %s/deployment/base/scripts/populateSphinxEntries.php", $app->get('PHP_BIN'), $app->get('APP_DIR')))) {
logMessage(L_INFO, "sphinx entries log created");
} else {
//.........这里部分代码省略.........
示例11: s_to_date
/**
* Parse a string to DateTime.
*
* @param $s
* A string in the configured date format.
*
* @return
* A DateTime object or null on failure.
*/
function s_to_date($s)
{
$ret = null;
$fmt = AppConfig::get('l10n.strftime_date_format');
$parsed = strptime($s, $fmt);
if ($parsed) {
$t = mktime($parsed['tm_hour'], $parsed['tm_min'], $parsed['tm_sec'], $parsed['tm_mon'] + 1, $parsed['tm_mday'], $parsed['tm_year'] + 1900);
$ret = new DateTime();
$ret->setTimestamp($t);
}
return $ret;
}
示例12: array
// load Composer stuff
require_once PROJECTDIR . '/vendor/autoload.php';
// initialize no2 framework.
require_once PROJECTDIR . '/no2/no2.inc.php';
// get the config stuff
require_once APPDIR . '/config.class.php';
AppConfig::parse(PROJECTDIR . '/config/config.yml', array('{{APPDIR}}' => APPDIR, '{{PROJECTDIR}}' => PROJECTDIR, '{{WEBDIR}}' => WEBDIR));
// load the application's models.
require_once APPDIR . '/models/user.class.php';
// load the application's helpers.
require_once APPDIR . '/help.inc.php';
// set the timezone
date_default_timezone_set(AppConfig::get('l10n.default_timezone'));
// set the locale
setlocale(LC_ALL, AppConfig::get('l10n.default_locale'));
// start the logger
if (!No2_Logger::setup(AppConfig::get('logger'))) {
error_log('unable to setup Logger');
}
// connect to the database.
No2_SQLQuery::setup(AppConfig::get('database'));
// try our best to hide the fact that we still use PHP in the 21th century.
if (function_exists('header_remove')) {
header_remove('X-Powered-By');
// PHP 5.3+
} else {
@ini_set('expose_php', 'off');
}
// start the session
session_set_cookie_params(0, dirname($_SERVER['SCRIPT_NAME']));
session_start() or die('session_start()');
示例13: uniqid
if (is_file(FILE_INSTALL_SEQ_ID)) {
$install_seq = @file_get_contents(FILE_INSTALL_SEQ_ID);
$app->set('INSTALLATION_SEQUENCE_UID', $install_seq);
} else {
$install_seq = uniqid("ISEQID");
// unique id per a set of installations
$app->set('INSTALLATION_SEQUENCE_UID', $install_seq);
file_put_contents(FILE_INSTALL_SEQ_ID, $install_seq);
}
// read package version
$version = parse_ini_file('package/version.ini');
logMessage(L_INFO, "Installing Kaltura " . $version['type'] . ' ' . $version['number']);
$app->set('KALTURA_VERSION', 'Kaltura ' . $version['type'] . ' ' . $version['number']);
$app->set('KALTURA_PREINSTALLED', $version['preinstalled']);
$app->set('KALTURA_VERSION_TYPE', $version['type']);
if (strcasecmp($app->get('KALTURA_VERSION_TYPE'), K_TM_TYPE) !== 0) {
$hello_message = "Thank you for installing Media Management based on Kaltura";
$report_message = "If you wish, please provide your email address so that we can offer you future assistance (leave empty to pass)";
$report_error_message = "Email must be in a valid email format";
$report_validator = InputValidator::createEmailValidator(true);
$fail_action = "For assistance, please contact us at https://github.com/Akvelon2014/Media-Management-based-on-Kaltura/issues";
} else {
$hello_message = "Thank you for installing Media Management based on Kaltura";
$report_message = "Please provide the name of your company or organization";
$report_error_message = "Name cannot be empty";
$report_validator = InputValidator::createNonEmptyValidator();
$fail_action = "For assistance, please contact us at https://github.com/Akvelon2014/Media-Management-based-on-Kaltura/issues";
}
// start user interaction
@system('clear');
logMessage(L_USER, $hello_message);
示例14: use_sexy_urls
/**
* Helper function to know if we need to generate / guess sexy URLs. This
* method will query the application's config.
*
* @return
* TRUE if sexy URLs option is used, FALSE otherwise.
*/
protected function use_sexy_urls()
{
return AppConfig::get('routing.rewrite', false);
}
示例15: dirname
* - $router
* - $controller
* - $view
*
* @author
* Alexandre Perrin <alexandre.perrin@netoxygen.ch>
*/
include dirname(__FILE__) . '/../bootstrap.inc.php';
/*
* CORS setup, needed if we provide API calls that could be requested by other
* web applications through scripting.
*
* see https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS
*/
if (AppConfig::get('security.cors.enabled', false)) {
$continue = cross_origin_resource_sharing(AppConfig::get('security.cors.allowed-origins', []), AppConfig::get('security.cors.allow-credentials', false));
if (!$continue) {
die;
}
unset($continue);
}
/*
* get a router to handle and generate URLs.
*/
require_once APPDIR . '/router.class.php';
$router = new AppRouter();
$router->decode_url($_SERVER['REQUEST_URI']);
/*
* Find the controller that registered for the requested URI. Note that here
* $_REQUEST['controller'] stand for an alias and not a controller class, hence
* the need of the router's logic.