本文整理汇总了PHP中Site::getConfig方法的典型用法代码示例。如果您正苦于以下问题:PHP Site::getConfig方法的具体用法?PHP Site::getConfig怎么用?PHP Site::getConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Site
的用法示例。
在下文中一共展示了Site::getConfig方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getDefaultFrom
public static function getDefaultFrom()
{
if (empty(static::$defaultFrom)) {
static::$defaultFrom = 'hello@' . Site::getConfig('primary_hostname');
}
return static::$defaultFrom;
}
示例2: getName
public function getName()
{
if ($parentHostname = \Site::getConfig('parent_hostname')) {
return static::$handle . ' (' . $parentHostname . ')';
} else {
return false;
}
}
示例3: createComponentPage
/**
* Constructs a Page that will render a given component class
*/
public static function createComponentPage($class)
{
$config = Site::getConfig();
$component = self::getInstance($class);
$page = new HTMLPage(Site::Site());
$page->component = $component;
return $page;
}
示例4: __classLoaded
static function __classLoaded()
{
if (empty(static::$siteName)) {
static::$siteName = Site::getConfig('label');
}
if (empty(static::$siteAbbr)) {
static::$siteAbbr = preg_replace('/[^A-Z]/', '', static::$siteName);
}
}
示例5: testPoweredByHeader
public function testPoweredByHeader()
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, sprintf('http://%s/api/test-api-status/v1', \Site::getConfig('primary_hostname')));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 1);
$response = curl_exec($ch);
$header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
$header = substr($response, 0, $header_size);
$this->assertRegExp('/^X-Powered-By:\\s*' . preg_quote(ApiRequestHandler::$poweredByHeader) . '\\s*$/m', $header);
}
示例6: __classLoaded
public static function __classLoaded()
{
parent::__classLoaded();
// generate cookie name
if (!static::$cookieName) {
static::$cookieName = 's_' . Site::getConfig('handle');
}
// auto-detect cookie domain by trimming leading www. from current hostname
if (!static::$cookieDomain) {
static::$cookieDomain = preg_replace('/^www\\.([^.]+\\.[^.]+)$/i', '$1', $_SERVER['HTTP_HOST']);
}
}
示例7: handleRequest
public static function handleRequest()
{
if (extension_loaded('newrelic')) {
newrelic_disable_autorum();
}
// retrieve authentication attempt
if ($GLOBALS['Session']->hasAccountLevel('Developer')) {
$User = $GLOBALS['Session']->Person;
} else {
$authEngine = new \Sabre\HTTP\BasicAuth();
$authEngine->setRealm('Develop ' . \Site::$title);
$authUserPass = $authEngine->getUserPass();
// try to get user
$userClass = \User::$defaultClass;
$User = $userClass::getByLogin($authUserPass[0], $authUserPass[1]);
// send auth request if login is inadiquate
if (!$User || !$User->hasAccountLevel('Developer')) {
$authEngine->requireLogin();
die("You must login using a " . \Site::getConfig('primary_hostname') . " account with Developer access\n");
}
}
// store login to session
if (isset($GLOBALS['Session'])) {
$GLOBALS['Session'] = $GLOBALS['Session']->changeClass('UserSession', array('PersonID' => $User->ID));
}
// detect base path
$basePath = array_slice(\Site::$requestPath, 0, count(\Site::$resolvedPath));
// switch to JSON response mode
if (static::peekPath() == 'json') {
$basePath[] = static::$responseMode = static::shiftPath();
}
// handle /develop request
if ($_SERVER['REQUEST_METHOD'] == 'GET' && static::getResponseMode() == 'html' && !static::peekPath()) {
\RequestHandler::respond('app/ext', array('App' => \Sencha_App::getByName('EmergenceEditor'), 'mode' => 'production', 'title' => 'EmergenceEditor'));
}
// initial and configure SabreDAV
$server = new \Sabre\DAV\Server(new RootCollection());
$server->setBaseUri('/' . join('/', $basePath));
// The lock manager is reponsible for making sure users don't overwrite each others changes. Change 'data' to a different
// directory, if you're storing your data somewhere else.
# $lockBackend = new Sabre_DAV_Locks_Backend_FS('/tmp/dav-lock');
# $lockPlugin = new Sabre_DAV_Locks_Plugin($lockBackend);
# $server->addPlugin($lockPlugin);
// filter temporary files
$server->addPlugin(new \Sabre\DAV\TemporaryFileFilterPlugin('/tmp/dav-tmp'));
// ?mount support
$server->addPlugin(new \Sabre\DAV\Mount\Plugin());
// emergence :)
$server->addPlugin(new \Emergence\DAV\ServerPlugin());
// All we need to do now, is to fire up the server
$server->exec();
}
示例8: Dwoo_Plugin_versioned_url
function Dwoo_Plugin_versioned_url(Dwoo_Core $dwoo, $path, $source = 'site-root', $includeHost = false)
{
$trimmedPath = ltrim($path, '/');
if ($source == 'site-root') {
$url = Site::getVersionedRootUrl($trimmedPath);
if ($includeHost) {
$url = (Site::getConfig('ssl') ? 'https' : 'http') . '://' . Site::getConfig('primary_hostname') . $url;
}
return $url;
} else {
return $path;
}
}
示例9:
<?php
use Emergence\Database\PostgresConnection;
if (!PostgresConnection::hasDefaultInstance() && ($postgresConfig = Site::getConfig('postgres'))) {
PostgresConnection::setDefaultInstance($postgresConfig);
}
示例10:
<?php
use Emergence\Database\MysqlConnection;
if (!MysqlConnection::hasDefaultInstance() && ($mysqlConfig = Site::getConfig('mysql'))) {
MysqlConnection::setDefaultInstance($mysqlConfig);
}
示例11: resolveCollectionFromParent
public static function resolveCollectionFromParent($path)
{
if (!Site::getConfig('parent_hostname')) {
return false;
}
$fp = fopen('php://memory', 'w+');
$ch = curl_init(static::buildUrl($path));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, $fp);
$responseText = curl_exec($ch);
$responseStatus = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$responseType = curl_getinfo($ch, CURLINFO_CONTENT_TYPE);
if ($responseText === false || curl_errno($ch)) {
throw new Exception('Failed to query parent site for collection: ' . curl_error($ch));
}
if ($responseStatus != 300 || $responseType != 'application/vnd.emergence.tree+json') {
return false;
}
return json_decode($responseText, true);
}
示例12: getMysqli
public static function getMysqli()
{
if (!isset(self::$_mysqli)) {
$config = array_merge(array('host' => 'localhost', 'port' => 3306), Site::getConfig('mysql'));
// connect to mysql database
self::$_mysqli = @new mysqli($config['host'], $config['username'], $config['password'], $config['database'], $config['port'], $config['socket']);
self::$_mysqli->set_charset('utf8');
// check for failure or connection error
if (mysqli_connect_error()) {
self::handleError('connect');
}
// set timezone to match PHP
self::nonQuery('SET time_zone = "%s"', self::escape(date('P')));
}
return self::$_mysqli;
}
示例13: getDefaultFrom
public static function getDefaultFrom()
{
return Mailer::$defaultFrom ? Mailer::$defaultFrom : \Site::getConfig('label') . ' <support@' . \Site::getConfig('primary_hostname') . '>';
}
示例14: getKeyPrefix
public static function getKeyPrefix()
{
return Site::getConfig('handle') . ':';
}
示例15: exec
<?php
$GLOBALS['Session']->requireAccountLevel('Developer');
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$templateDir = Emergence\Dwoo\Engine::$pathCompile . '/' . Site::getConfig('handle');
exec("find {$templateDir} -name \"*.d*.php\" -type f -delete");
die('Templates cleared');
}
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Clear Templates Cache</title>
<style>
* {
font-size: xx-large;
text-align: center;
}
input {
cursor: pointer;
margin: 1em;
}
</style>
</head>
<body>
<form method="POST">
<input type="submit" value="Clear Templates Cache">
</form>
</body>