本文整理汇总了PHP中Config::getSetting方法的典型用法代码示例。如果您正苦于以下问题:PHP Config::getSetting方法的具体用法?PHP Config::getSetting怎么用?PHP Config::getSetting使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Config
的用法示例。
在下文中一共展示了Config::getSetting方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setKey
/**
* Create cipher key.
*
* @return string
*/
public function setKey()
{
if (!$this->key) {
$this->key = md5(sha1(Config::getSetting('cipher_key')));
}
return $this->key;
}
示例2: connect
/**
* Connect to database.
*
* @return void
*/
public function connect()
{
try {
$this->dbh = new PDO(Config::getSetting('db_type') . ':unix_socket=/var/run/mysqld/mysqld.sock;dbname=' . Config::getSetting('db_name') . ';host=' . Config::getSetting('db_host'), Config::getSetting('db_user'), Config::getSetting('db_pass'));
$this->query("SET CHAR SET UTF8");
} catch (PDOException $e) {
echo 'Connection failed: ' . $e->getMessage();
}
}
示例3: sendMail
/**
* Parse template and send mail.
*
* @param string $to Send to this address.
*
* @return boolean
*/
public function sendMail($to, $subject, $from = null, $fromname = null)
{
$this->From = $from ? $from : Config::getSetting('mail_from');
$this->FromName = $fromname ? $fromname : Config::getSetting('mail_from_name');
$this->Subject = $subject;
$this->IsHTML(true);
$this->Body = $this->fetchTemplate();
$this->AddAddress($to);
return $this->Send();
}
示例4: __construct
/**
* Main Constructor
*
* @access public
* @return void
*/
public function __construct()
{
$this->setRichness(Config::getSetting('functionalRichness'));
if (\DynamicPageListHooks::isLikeIntersection()) {
$this->data['ordermethod'] = ['default' => 'categoryadd', 'values' => ['categoryadd', 'lastedit', 'none']];
$this->data['order'] = ['default' => 'descending', 'values' => ['ascending', 'descending']];
$this->data['mode'] = ['default' => 'unordered', 'values' => ['none', 'ordered', 'unordered']];
$this->data['userdateformat'] = ['default' => 'Y-m-d: '];
$this->data['allowcachedresults']['default'] = 'true';
}
}
示例5: saveData
/**
* Save data to cache.
*
* @param string $key Data to save as.
* @param mixed $value Data to save.
* @param boolean $db Cache to database.
*
* @return void
*/
public static function saveData($key, $value, $db = false)
{
$cache = Cache::getInstance();
$cache->data[$key] = $value;
if ($key != 'ModelCachingFields' && $db && Config::getSetting('cache_to_database', false, false) && Clockwork::isModuleLoaded('Data/Database')) {
$lifespan = $db === true ? 0 : $db;
if (($obj = Caching::create($key, '*`key`')) === false) {
$obj = new Caching();
}
$obj->set('key', $key)->set('value', serialize($value))->set('object', is_object($value) ? get_class($value) : '')->set('lifespan', $lifespan)->save();
}
}
示例6: send
/**
* Send message. Omit parameters to get defaults form Config.
*
* @param string $from From email address.
* @param string $fromname From name.
* @param string $bcc Send message BCC to this address.
*
* @return boolean
*/
public function send($from = null, $fromname = null, $bcc = null)
{
$this->mailer->From = $from ? $from : Config::getSetting('mail_from');
$this->mailer->FromName = $fromname ? $fromname : Config::getSetting('mail_from_name');
$this->mailer->Subject = $this->subject;
$this->mailer->IsHTML(true);
$this->mailer->Body = $this->message;
$this->mailer->AddAddress($this->to);
if ($bcc) {
$this->mailer->AddBCC($bcc);
}
return $this->mailer->Send();
}
示例7: getUser
/**
* Return logged in user
*
* @return object|boolean
*/
public static function getUser($check = true)
{
if ($check && self::isLoggedIn() || !$check) {
if (($user = Cache::loadData(static::$sessionKey)) === null) {
$class = static::$className;
if (($user = $class::create(sanitize($_SESSION[static::$sessionKey]), "*SHA1(MD5(CONCAT('" . Config::getSetting('salt') . "', id)))")) !== false) {
Cache::saveData(static::$sessionKey, $user);
} else {
unset($_SESSION[static::$sessionKey]);
redirect();
}
}
return $user;
} else {
return false;
}
}
示例8: get
/**
* Return a value.
*
* @param string $key Value to return.
* @param boolean $ret Set to true to return Date object instead of formatted date.
*
* @return mixed
*/
public function get($key, $ret = false)
{
if ($ret !== -1 && ($field = $this->getFields($key)) && preg_match('/(date)/i', $field['Type'])) {
if (isset($this->values[$key])) {
if (Config::getSetting('check_empty_date')) {
if ($field['Type'] == 'datetime' && $this->values[$key] == '0000-00-00 00:00:00' || $field['Type'] == 'date' && $this->values[$key] == '0000-00-00') {
return null;
}
}
if (Clockwork::isModuleLoaded('Date')) {
$date = new Date($this->values[$key]);
if ($ret) {
return $date;
} else {
return $date->format();
}
}
} else {
return null;
}
}
return isset($this->values[$key]) ? $this->values[$key] : null;
}
示例9: formatCategoryList
public function formatCategoryList($iStart, $iCount)
{
for ($i = $iStart; $i < $iStart + $iCount; $i++) {
$aArticles[] = $this->mArticles[$i]->mLink;
$aArticles_start_char[] = $this->mArticles[$i]->mStartChar;
$this->filteredCount = $this->filteredCount + 1;
}
if (count($aArticles) > Config::getSetting('categoryStyleListCutoff')) {
return "__NOTOC____NOEDITSECTION__" . \CategoryViewer::columnList($aArticles, $aArticles_start_char);
} elseif (count($aArticles) > 0) {
// for short lists of articles in categories.
return "__NOTOC____NOEDITSECTION__" . \CategoryViewer::shortList($aArticles, $aArticles_start_char);
}
return '';
}
示例10: getFileURL
function getFileURL()
{
if ($this->type == 'image') {
// we get the area instance
$url = SITE_WEB_DIRECTORY . MEDIA_BASE_DIRECTORY . '/' . $this->area_id . '/' . $this->filename;
} else {
if ($this->access == 'STREAMING') {
include_class('config');
$conf = new Config();
$streamingAudioServerURL = $conf->getSetting('streamingAudioServerURL');
$url = $streamingAudioServerURL . '/' . basename($this->protected_filename, Media::getExtension($this->protected_filename)) . 'pls';
} else {
$url = SITE_WEB_DIRECTORY . MEDIA_ORIGINALS_DIRECTORY . '/' . date('Ymd', strtotime($this->date_time)) . '/' . $this->filename_original;
}
}
return $url;
}
示例11: throwError
/**
* Throw an error and exit if needed
*
* @param string $error
* @param int $level (optional, default = self::ERROR_FATAL)
* @param int $traceLevel (optional, default = 0)
*
* @return void
*/
public static function throwError($error, $level = self::ERROR_FATAL, $traceLevel = 0)
{
if (!Config::getSetting('debug')) {
return false;
}
$errors = array(0 => 'FATAL CLOCKWORK ERROR', 1 => 'CLOCKWORK WARNING');
$trace = debug_backtrace();
$trace = $trace[$traceLevel];
if (isset($error[$level])) {
echo '<br /><b>' . $errors[$level] . ':</b> ' . $error . ' in <b>' . $trace['file'] . '</b> on line <b>' . $trace['line'] . '</b><br />';
} else {
self::throwError('Invalid error level', self::ERROR_WARNING, 1);
}
if ($level == self::ERROR_FATAL) {
exit;
}
}
示例12: path
/**
* Return [const]_[path|dir].
* @author Jelle van der Coelen
* @package Clockwork/Library/Path
*
* @param string $location Location to append to dir.
* @param string $const Constant to use.
* @param string $type Type of constant to use (path|dir).
*
* @return string
*/
function path($location = '', $const = 'root', $type = 'path')
{
return Config::getSetting($const . '_' . $type) . $location;
}
示例13: setupTwig
/**
* Setup Twig template engine
*
* @return void
*/
public function setupTwig()
{
Twig_Autoloader::register(true);
if (!is_dir($this->basedir . 'template/')) {
Clockwork::throwError('Template directory (' . $this->basedir . 'template/) does not exists');
}
$paths = [$this->basedir . 'template/', APP_DIR . 'template/'];
$plugins = Clockwork::getInstance()->loadedPlugins;
foreach ($plugins as $plugin) {
if (is_dir($plugin->dir() . 'template/')) {
$paths[] = $plugin->dir() . 'template/';
}
}
$loader = new Twig_Loader_Filesystem($paths);
$this->twig = new Twig_Environment($loader, array('cache' => Config::getSetting('twig_cache') ? appdir('template/cache/') : false));
$functions = get_defined_functions();
foreach ($functions['user'] as $function) {
if (strpos(strtolower($function), 'twig') === false) {
$this->twig->addFunction(new Twig_SimpleFunction($function, $function));
}
}
$this->twig->addFunction(new Twig_SimpleFunction('PluginLoader', [Clockwork::getInstance(), 'pluginLoader']));
}
示例14: join
/**
* Add a join.
*
* @param string $table Table name to join on
* @param string $on Where to join on.
* @param string $type Type of join
* @param boolean $prefix Prefix table with db_table_prefix from config.
* @param boolean $reset Clear all joins.
*
* @return self
*/
public function join($table, $on, $type = 'INNER', $prefix = true, $reset = false)
{
if ($reset) {
$this->join = array();
}
$this->join[] = $type . " JOIN " . ($prefix ? Config::getSetting('db_table_prefix') : '') . $table . " " . $this->alias($table) . " on " . $on;
return $this;
}
示例15: _namespace
/**
* Clean and test 'namespace' parameter.
*
* @access public
* @param string Option passed to parameter.
* @return boolean Success
*/
public function _namespace($option)
{
global $wgContLang;
$extraParams = explode('|', $option);
foreach ($extraParams as $parameter) {
$parameter = trim($parameter);
$namespaceId = $wgContLang->getNsIndex($parameter);
if ($namespaceId === false || is_array(Config::getSetting('allowedNamespaces')) && !in_array($parameter, Config::getSetting('allowedNamespaces'))) {
//Let the user know this namespace is not allowed or does not exist.
return false;
}
$data = $this->getParameter('namespace');
$data[] = $namespaceId;
$data = array_unique($data);
$this->setParameter('namespace', $data);
$this->setSelectionCriteriaFound(true);
}
return true;
}