本文整理汇总了PHP中Preferences::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Preferences::get方法的具体用法?PHP Preferences::get怎么用?PHP Preferences::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Preferences
的用法示例。
在下文中一共展示了Preferences::get方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: function
Breadcrumbs::register('reports.index', function (Generator $breadcrumbs) {
$breadcrumbs->parent('home');
$breadcrumbs->push(trans('breadcrumbs.reports'), route('reports.index'));
});
Breadcrumbs::register('reports.year', function (Generator $breadcrumbs, Carbon $date, $shared) {
$breadcrumbs->parent('reports.index');
if ($shared) {
$title = trans('breadcrumbs.yearly_report_shared', ['date' => $date->year]);
} else {
$title = trans('breadcrumbs.yearly_report', ['date' => $date->year]);
}
$breadcrumbs->push($title, route('reports.year', [$date->year]));
});
Breadcrumbs::register('reports.month', function (Generator $breadcrumbs, Carbon $date, $shared) {
$breadcrumbs->parent('reports.year', $date, $shared);
$language = Preferences::get('language', 'en')->data;
$format = Config::get('firefly.month.' . $language);
if ($shared) {
$title = trans('breadcrumbs.monthly_report_shared', ['date' => $date->formatLocalized($format)]);
} else {
$title = trans('breadcrumbs.monthly_report', ['date' => $date->formatLocalized($format)]);
}
$breadcrumbs->push($title, route('reports.month', [$date->year, $date->month]));
});
// search
Breadcrumbs::register('search', function (Generator $breadcrumbs, $query) {
$breadcrumbs->parent('home');
$breadcrumbs->push(trans('breadcrumbs.searchResult', ['query' => e($query)]), route('search'));
});
// transactions
Breadcrumbs::register('transactions.index', function (Generator $breadcrumbs, $what) {
示例2: connectDatabase
<?php
error_reporting(E_ALL);
ini_set('display_errors', 'on');
require_once "libPreferences.php";
$pr = new Preferences();
$DBHost = $pr->get('DBHost');
$DBUser = $pr->get('DBUser');
$DBPass = $pr->get('DBPass');
$DBName = $pr->get('DBName');
$prefix = $pr->get('DBPrefix');
$db = connectDatabase($DBHost, $DBUser, $DBPass, $DBName);
$html = "";
for ($i = $_GET['start']; $i < $_GET['end']; $i++) {
$html .= "<h2>Precommit Info for TimeSlot {$i}</h2>\n<br />\n";
$html .= getPrecommitInfoInTimeSlotAsTable($db, $i, $DBName, $prefix);
}
echo $html;
function connectDatabase($DBHost, $DBUser, $DBPass, $DBName)
{
//new connection using mysqli
$db = new mysqli($DBHost, $DBUser, $DBPass, $DBName);
//connection successfull?
if ($db->connect_errno) {
die('Couldnt connect: ' . $db->connect_error);
}
return $db;
}
function queryDatabase($db, $query)
{
//submit query and store result
示例3: Preferences
<?php
/**
* Required on every site
*/
require_once 'php/libPreferences.php';
require_once 'php/libAuth.php';
$pr = new Preferences();
$DBHOST = $pr->get('DBHost');
$DBUSER = $pr->get('DBUser');
$DBPASS = $pr->get('DBPass');
$DBNAME = $pr->get('DBName');
$db = new mysqli($DBHOST, $DBUSER, $DBPASS, $DBNAME);
$auth = new Auth($db, 'login.php', 'omgNobodyB3tt3rGuessThisFuck1ngS3cr3tL33tKEY!$!');
if (isset($_GET['action']) && $_GET['action'] == 'logout') {
$auth->logout();
}
global $input, $prefix, $laneNumber, $cid;
if (isset($_POST['raw_data']) && isset($_POST['lane']) && isset($_POST['cid'])) {
$input = $_POST['raw_data'];
$prefix = $pr->get('DBPrefix');
$laneNumber = $_POST['lane'];
$cid = $_POST['cid'];
} else {
die;
}
$valuePairs = explode(";", $input);
$timestamp = time();
$db = new mysqli($DBHost, $DBUser, $DBPass, $DBName);
$query = "SELECT `TimeSlotID` FROM `" . $prefix . "timeslots` WHERE (`TimeSlotStart` < " . $timestamp . ") AND (`TimeSlotEnd`> " . $timestamp . ") LIMIT 1;";
if ($db->connect_errno) {
示例4: function
});
Breadcrumbs::register('categories.edit', function (BreadCrumbGenerator $breadcrumbs, Category $category) {
$breadcrumbs->parent('categories.show', $category);
$breadcrumbs->push(trans('firefly.edit_category', ['name' => e($category->name)]), route('categories.edit', [$category->id]));
});
Breadcrumbs::register('categories.delete', function (BreadCrumbGenerator $breadcrumbs, Category $category) {
$breadcrumbs->parent('categories.show', $category);
$breadcrumbs->push(trans('firefly.delete_category', ['name' => e($category->name)]), route('categories.delete', [$category->id]));
});
Breadcrumbs::register('categories.show', function (BreadCrumbGenerator $breadcrumbs, Category $category) {
$breadcrumbs->parent('categories.index');
$breadcrumbs->push(e($category->name), route('categories.show', [$category->id]));
});
Breadcrumbs::register('categories.show.date', function (BreadCrumbGenerator $breadcrumbs, Category $category, Carbon $date) {
// get current period preference.
$range = Preferences::get('viewRange', '1M')->data;
$breadcrumbs->parent('categories.index');
$breadcrumbs->push(e($category->name), route('categories.show', [$category->id]));
$breadcrumbs->push(Navigation::periodShow($date, $range), route('categories.show.date', [$category->id, $date->format('Y-m-d')]));
});
Breadcrumbs::register('categories.noCategory', function (BreadCrumbGenerator $breadcrumbs, $subTitle) {
$breadcrumbs->parent('categories.index');
$breadcrumbs->push($subTitle, route('categories.noCategory'));
});
// CSV:
Breadcrumbs::register('csv.index', function (BreadCrumbGenerator $breadcrumbs) {
$breadcrumbs->parent('home');
$breadcrumbs->push(trans('firefly.csv_index_title'), route('csv.index'));
});
Breadcrumbs::register('csv.column-roles', function (BreadCrumbGenerator $breadcrumbs) {
$breadcrumbs->parent('csv.index');
示例5: Preferences
<?php
/**
*
* Preferences:
*
*/
require_once "libPreferences.php";
$pr = new Preferences();
//Name of the Login Var, f. ex. $_POST['login']
@define('USER_LOGIN_VAR', 'user');
//Name of the Passw Var, f. ex. $_POST['password']
@define('USER_PASSW_VAR', 'pass');
//Name of the Table containing Auth-Data
@define('DB_USER_TABLE', $pr->get("DBPrefix") . $pr->get('DBTableStaffMembers'));
//Name of the Column containing the Username
@define('DB_USER_TABLE_LOGIN', 'user');
//Name of the Column containing the Password-Hash
@define('DB_USER_TABLE_PASSW', 'hash');
/**
*
* Code:
*
*/
/**
* Session-Wrapper für PHP
* @acess public
*/
class Session
{
/**
示例6: get
/**
* Récupère une Preference.
* Si default est renseigné et que la Preference n'existe pas c'est cette
* valeur qui est retournée.
*
* @static
* @access public
* @param string $name
* @param mixed $default
* @param integer $userId
* @return mixed integer, boolean, double, string or array
*/
public static function get($name, $default = false, $userId = 0)
{
$name = PreferencesByUser::getRealName($name, $userId);
return parent::get($name, $default);
}
示例7: parseMetadata
/**
* Parse the metadata and build the corresponding html code for each
* navigation level.
*
* @access protected
* @param array $metadata
* @return void
*/
protected function parseMetadata($metadata = false, $indexStack = array())
{
static $level = 1;
if (isset($this->_html[$level])) {
return;
}
$this->hasActiveItem[$level] = false;
$children = false;
if (!$this->renderer) {
$this->renderer = new NavigationRendererDefault();
}
if (!$metadata) {
$metadata = $this->metadata;
}
$ret[] = $this->renderer->open($level);
// Trade context
$tradeContext = Preferences::get('TradeContext');
foreach ($metadata as $index => $data) {
// formatte le tableau de l'élément avec les paramètres par défaut
// et met son état à actif ou inactif
if (isset($data['restrict_to']) && !call_user_func($this->authFunction, $data['restrict_to'], array('showErrorDialog' => false, 'redirect' => false))) {
continue;
}
$this->handleData($data, $level, $index, $indexStack);
if (isset($data['restrict_to'])) {
$pn = UrlTools::getPageNameFromURL($data['link']);
$this->authorizedProfiles[$pn] = $data['restrict_to'];
}
if (is_null($tradeContext) && isset($data['restrict_to_context']) || isset($data['restrict_to_context']) && array_intersect($data['restrict_to_context'], $tradeContext) == array()) {
continue;
}
$id = implode('_', $indexStack);
$id .= empty($id) ? $index : '_' . $index;
$ret[] = $this->renderer->render($level, $index, $data, $this->useCookie, $id);
if ($data['active'] && isset($data['children'])) {
$stack = $indexStack;
$stack[] = $index;
$children = $data['children'];
} else {
if ($data['active']) {
$this->activeTitle = $data['description'];
}
}
}
$ret[] = $this->renderer->close($level);
$this->_html[$level] = implode("\n", $ret);
if ($children) {
$level++;
$this->parseMetadata($children, $stack);
}
}