本文整理汇总了PHP中Setup类的典型用法代码示例。如果您正苦于以下问题:PHP Setup类的具体用法?PHP Setup怎么用?PHP Setup使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Setup类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: run
public static function run()
{
spl_autoload_register(['Bootstrap', 'autoload']);
putenv('LANG=en_US.UTF-8');
setlocale(LC_CTYPE, 'en_US.UTF-8');
date_default_timezone_set(@date_default_timezone_get());
session_start();
$session = new Session($_SESSION);
$request = new Request($_REQUEST);
$setup = new Setup($request->query_boolean('refresh', false));
$context = new Context($session, $request, $setup);
if ($context->is_api_request()) {
(new Api($context))->apply();
} else {
if ($context->is_info_request()) {
$public_href = $setup->get('PUBLIC_HREF');
$x_head_tags = $context->get_x_head_html();
require __DIR__ . '/pages/info.php';
} else {
$public_href = $setup->get('PUBLIC_HREF');
$x_head_tags = $context->get_x_head_html();
$fallback_html = (new Fallback($context))->get_html();
require __DIR__ . '/pages/index.php';
}
}
}
开发者ID:arter97,项目名称:h5ai,代码行数:26,代码来源:class-bootstrap.php
示例2: __construct
public function __construct(Setup $setup)
{
$this->setup = $setup;
$this->storageMode = 'flat-file';
$metadata_file = $this->setup->dir . '/.metadata';
$update_metadata = false;
// Read exist metadata file if one exists
if (file_exists($metadata_file)) {
$json_metadata = json_decode(file_get_contents($metadata_file), true);
$this->setup->metadata = array_merge($this->setup->metadata, $json_metadata);
}
// Check if comment thread directory exists
if ($setup->mode !== 'api') {
if (file_exists(dirname($metadata_file)) and is_writable(dirname($metadata_file))) {
// Check whether the page and metadata URLs differ
if ($this->setup->metadata['title'] !== $setup->pageTitle) {
$this->setup->metadata['title'] = $setup->pageTitle;
$update_metadata = true;
}
// Check whether the page and metadata titles differ
if ($this->setup->metadata['url'] !== $setup->pageURL) {
$this->setup->metadata['url'] = $setup->pageURL;
$update_metadata = true;
}
// Update metadata if the data has changed
if ($update_metadata === true) {
if ($this->save_metadata($this->setup->metadata, $metadata_file) === false) {
exit($setup->escapeOutput('<b>HashOver</b>: Failed to create metadata file.', 'single'));
}
}
}
}
}
开发者ID:archcidburnziso,项目名称:hashover-next,代码行数:33,代码来源:readfiles.php
示例3: InterafceWithSiCDS
/**
* Given a valid servive URI and a valid string of JSON,
* this method communcates with the SiCDS and returns a
* list of all unique ID's
*
* @param string $uri
* @param string $json
* @return string
*/
public function InterafceWithSiCDS($uri, $json)
{
include_once Setup::Modules_Directory() . "/SiSW/ServiceWrapper.php";
$service = new \Swiftriver\Core\Modules\SiSW\ServiceWrapper($uri);
$jsonFromService = $service->MakePOSTRequest(array("data" => $json), 5);
return $jsonFromService;
}
开发者ID:surflightroy,项目名称:SwiftriverCore,代码行数:16,代码来源:ServiceInterface.php
示例4: __construct
private function __construct()
{
$settings = Setup::getSettings();
$config = \Doctrine\ORM\Tools\Setup::createXMLMetadataConfiguration([__DIR__ . '/../Mapper', 'Bh/Mapper'], $settings['DevMode']);
$conn = array('driver' => 'pdo_mysql', 'user' => $settings['DbUser'], 'password' => $settings['DbPass'], 'dbname' => $settings['DbName']);
self::$entityManager = \Doctrine\ORM\EntityManager::create($conn, $config);
}
开发者ID:uglybob,项目名称:bh.net,代码行数:7,代码来源:Mapper.php
示例5: setUp
protected function setUp()
{
include_once dirname(__FILE__) . "/../Setup.php";
$config = Setup::Configuration();
include_once $config["SwiftriverCoreDirectory"] . "/ObjectModel/Content.php";
include_once dirname(__FILE__) . "/../TextForUrlParser.php";
}
开发者ID:surflightroy,项目名称:SwiftriverCore,代码行数:7,代码来源:TextForUrlParserTest.php
示例6: saveConfig
/**
* If you made changes to config, you may call this to persist the changes
* back to disk
*/
protected function saveConfig()
{
if (!isset($this->config)) {
return;
}
Setup::save();
}
开发者ID:dabielkabuto,项目名称:eventum,代码行数:11,代码来源:class.abstract_workflow_backend.php
示例7: setUp
protected function setUp()
{
include_once dirname(__FILE__) . "/../../../Modules/TagTheNetInterface/Setup.php";
$config = Setup::Configuration();
include_once $config["SwiftriverCoreDirectory"] . "/ObjectModel/Content.php";
include_once $config["SwiftriverCoreDirectory"] . "/ObjectModel/Tag.php";
include_once dirname(__FILE__) . "/../../../Modules/TagTheNetInterface/ContentFromJSONParser.php";
}
开发者ID:jgosier,项目名称:ushahidi_swift,代码行数:8,代码来源:ContentFromJSONParserTest.php
示例8: __construct
/**
* @param \Saigon\Conpago\IDbConfig $dbConfig
* @param \Saigon\Conpago\IDoctrineConfig $doctrineConfig
*/
public function __construct(IDBConfig $dbConfig, IDoctrineConfig $doctrineConfig)
{
$this->dbConfig = $dbConfig;
$this->doctrineConfig = $doctrineConfig;
$paths = array($this->doctrineConfig->getModelPath());
$this->setDbParams();
$config = Setup::createAnnotationMetadataConfiguration($paths, $this->doctrineConfig->getDevMode());
$this->entityManager = EntityManager::create($this->dbParams, $config);
}
开发者ID:bartoszgolek,项目名称:PHPers,代码行数:13,代码来源:adaptacja-.php
示例9: maybe_self_deactivate
/**
* Check plugin requirements.
*
* @return bool True is fails requirements. False otherwise.
*/
public function maybe_self_deactivate()
{
if (false === Setup::meets_requirements()) {
add_action('admin_init', array('HM\\BackUpWordPress\\Setup', 'self_deactivate'));
add_action('admin_notices', array('HM\\BackUpWordPress\\Setup', 'display_admin_notices'));
return true;
}
return false;
}
开发者ID:alexanderpetrob89,项目名称:fei.edu,代码行数:14,代码来源:class-plugin.php
示例10: database
public function database(\Base $f3)
{
$this->response->data['SUBPART'] = 'settings_database.html';
$cfg = \Config::instance();
if ($f3->get('VERB') == 'POST' && $f3->exists('POST.active_db')) {
$type = $f3->get('POST.active_db');
$cfg->{'DB_' . $type} = $f3->get('POST.DB_' . $type);
$cfg->ACTIVE_DB = $type;
$cfg->save();
\Flash::instance()->addMessage('Config saved', 'success');
$setup = new \Setup();
$setup->install($type);
// logout
$f3->clear('SESSION.user_id');
}
$cfg->copyto('POST');
$f3->set('JIG_format', array('JSON', 'Serialized'));
}
开发者ID:kimkiogora,项目名称:mth3l3m3nt-framework,代码行数:18,代码来源:settings.php
示例11: __construct
public function __construct(Setup $setup)
{
$this->setup = $setup;
$this->storageMode = $setup->databaseType;
try {
if ($setup->databaseType === 'sqlite') {
$this->database = new PDO('sqlite:' . $setup->rootDirectory . '/pages/' . $setup->databaseName . '.sqlite');
} else {
$sql_connection = 'host=' . $setup->databaseHost . ';' . 'dbname=' . $setup->databaseName . ';' . 'charset=' . $setup->databaseCharset;
$this->database = new PDO($setup->databaseType . ':' . $sql_connection, $setup->databaseUser, $setup->databasePassword);
}
} catch (PDOException $error) {
exit($setup->escapeOutput($error->getMessage(), 'single'));
}
// Create comment tread table
$create = 'CREATE TABLE IF NOT EXISTS \'' . $setup->threadDirectory . '\' ' . '(id TEXT PRIMARY KEY,' . ' name TEXT,' . ' password TEXT,' . ' login_id TEXT,' . ' email TEXT,' . ' encryption TEXT,' . ' website TEXT,' . ' date TEXT,' . ' likes TEXT,' . ' dislikes TEXT,' . ' notifications TEXT,' . ' ipaddr TEXT,' . ' status TEXT,' . ' body TEXT)';
$this->database->exec($create);
}
开发者ID:archcidburnziso,项目名称:hashover-next,代码行数:18,代码来源:database.php
示例12: InterafceWithService
/**
* Given a valid servive URI and a valid string of text
* this service wraps the TagThe.Net taggin service
*
* @param string $uri
* @param string $json
* @return string
*/
public function InterafceWithService($uri, $text)
{
$config = Setup::Configuration();
require $config["SwiftriverModulesDirectory"] . "/SwiftriverServiceWrapper/ServiceWrapper.php";
$uri = str_replace("?view=json", "", $uri);
$uri = $uri . "?view=json&text=" . $text;
$service = new \Swiftriver\Core\Modules\SiSW\ServiceWrapper($uri);
$jsonFromService = $service->MakeGETRequest();
return $jsonFromService;
}
开发者ID:surflightroy,项目名称:SwiftriverCore,代码行数:18,代码来源:ServiceInterface.php
示例13: GetLogger
/**
* Get the shared instance for the logger
* @return \Log
*/
public static function GetLogger()
{
$log = new \Log("this message is ignored, however not supplying one throws an error :o/");
$logger = $log->singleton('file', Setup::Configuration()->CachingDirectory . "/log.log", ' ');
if (!self::Configuration()->EnableDebugLogging) {
$mask = \Log::UPTO(\PEAR_LOG_INFO);
$logger->setMask($mask);
}
return $logger;
}
开发者ID:ultimateprogramer,项目名称:Swiftriver,代码行数:14,代码来源:Setup.php
示例14: getConfig
/**
* Get database config.
* load it from setup, fall back to legacy config.php constants
*
* @return array
*/
public static function getConfig()
{
$setup = Setup::get();
if (isset($setup['database'])) {
$config = $setup['database']->toArray();
} else {
// legacy: import from constants
$config = array('driver' => APP_SQL_DBTYPE, 'hostname' => APP_SQL_DBHOST, 'database' => APP_SQL_DBNAME, 'username' => APP_SQL_DBUSER, 'password' => APP_SQL_DBPASS, 'port' => APP_SQL_DBPORT, 'table_prefix' => APP_TABLE_PREFIX);
// save it back. this will effectively do the migration
Setup::save(array('database' => $config));
}
return $config;
}
开发者ID:dabielkabuto,项目名称:eventum,代码行数:19,代码来源:class.db_helper.php
示例15: testParseToRequestJson
public function testParseToRequestJson()
{
include_once dirname(__FILE__) . "/../../../Setup.php";
include_once dirname(__FILE__) . "/../../../Modules/SiCDSInterface/Parser.php";
include_once dirname(__FILE__) . "/../../../Modules/SiCDSInterface/SiCDSPreProcessingStep.php";
include_once dirname(__FILE__) . "/../../../Modules/SiCDSInterface/ServiceInterface.php";
$item = new ObjectModel\Content();
$item->id = "testId";
$item->difs = array(new ObjectModel\DuplicationIdentificationFieldCollection("names", array(new ObjectModel\DuplicationIdentificationField("first", "homer"), new ObjectModel\DuplicationIdentificationField("second", "simpson"))));
$configuration = new MockConfiguration();
$SiCDS = new \Swiftriver\PreProcessingSteps\SiCDSPreProcessingStep();
$SiCDS->Process(array($item), $configuration, Setup::GetLogger());
}
开发者ID:Bridgeborn,项目名称:Swiftriver,代码行数:13,代码来源:SiCDSPreProcessingStepTests.php
示例16:
function &init()
{
static $instance;
if (!isset($instance)) {
require_once 'base_CLI.class.php';
if (base_CLI::runningFromCLI()) {
$interface = 'cli';
} else {
$interface = 'web';
}
$instance =& Setup::factory($interface);
}
return $instance;
}
开发者ID:BackupTheBerlios,项目名称:migueloo,代码行数:14,代码来源:setup.class.php
示例17: _notify
/**
* Notifies site administrators of the error condition
*
* @access private
* @param mixed $error_msg The error message
* @param string $script The script name where the error happened
* @param integer $line The line number where the error happened
*/
function _notify($error_msg = "unknown", $script = "unknown", $line = "unknown")
{
global $HTTP_SERVER_VARS;
$setup = Setup::load();
$notify_list = trim($setup['email_error']['addresses']);
if (empty($notify_list)) {
return false;
}
$notify_list = str_replace(';', ',', $notify_list);
$notify_list = explode(',', $notify_list);
$subject = APP_SITE_NAME . " - Error found! - " . date("m/d/Y H:i:s");
$msg = "Hello,\n\n";
$msg .= "An error was found at " . date("m/d/Y H:i:s") . " (" . time() . ") on line '" . $line . "' of script " . "'{$script}'.\n\n";
$msg .= "The error message passed to us was:\n\n";
if (is_array($error_msg) && count($error_msg) > 1) {
$msg .= "'" . $error_msg[0] . "'\n\n";
$msg .= "A more detailed error message follows:\n\n";
$msg .= "'" . $error_msg[1] . "'\n\n";
} else {
$msg .= "'{$error_msg}'\n\n";
}
@($msg .= "That happened on page '" . $HTTP_SERVER_VARS["PHP_SELF"] . "' from IP Address '" . getenv("REMOTE_ADDR") . "' coming from the page (referrer) '" . getenv("HTTP_REFERER") . "'.\n\n");
@($msg .= "The user agent given was '" . $HTTP_SERVER_VARS['HTTP_USER_AGENT'] . "'.\n\n");
$msg .= "Sincerely yours,\nAutomated Error_Handler Class";
// only try to include the backtrace if we are on PHP 4.3.0 or later
if (version_compare(phpversion(), "4.3.0", ">=")) {
$msg .= "\n\nA backtrace is available:\n\n";
ob_start();
$backtrace = debug_backtrace();
// remove the two entries related to the error handling stuff itself
array_shift($backtrace);
array_shift($backtrace);
// now we can print it out
print_r($backtrace);
$contents = ob_get_contents();
$msg .= $contents;
ob_end_clean();
}
// avoid triggering an email notification about a query that
// was bigger than max_allowed_packet (usually 16 megs on 3.23
// client libraries)
if (strlen($msg) > 16777216) {
return false;
}
foreach ($notify_list as $notify_email) {
$mail = new Mail_API();
$mail->setTextBody($msg);
$mail->send($setup['smtp']['from'], $notify_email, $subject);
}
}
开发者ID:juliogallardo1326,项目名称:proc,代码行数:58,代码来源:class.error_handler.php
示例18: acquire
/**
* Creates a lock file for the given name.
* Returns FALSE if lock couldn't be created (lock already exists)
*
* @param int $issue_id Issue Id what is being locked
* @param string $usr_id User Id who locked the issue
* @return bool
*/
public static function acquire($issue_id, $usr_id)
{
$setup = Setup::load();
$lock_ttl = $setup['issue_lock'];
$expires = time() + $lock_ttl;
if (self::isLocked($issue_id)) {
$info = self::getInfo($issue_id);
// allow lock, if locked by user himself
if ($info['usr_id'] != $usr_id) {
return false;
}
}
$lockfile = self::getLockFilename($issue_id);
$info = array('usr_id' => $usr_id, 'expires' => $expires);
$fp = fopen($lockfile, 'w');
flock($fp, LOCK_EX);
fwrite($fp, serialize($info));
flock($fp, LOCK_UN);
fclose($fp);
return true;
}
开发者ID:korusdipl,项目名称:eventum,代码行数:29,代码来源:class.issue_lock.php
示例19: logError
/**
* Logs the error condition to a specific file and if asked and possible
* queue error in mail queue for reporting.
*
* @param mixed $error_msg The error message
* @param string $script The script name where the error happened
* @param integer $line The line number where the error happened
* @param boolean $notify_error Whether error should be notified by email.
*/
public static function logError($error_msg = 'unknown', $script = 'unknown', $line = 0, $notify_error = true)
{
$msg =& self::_createErrorReport($error_msg, $script, $line);
if (is_resource(APP_ERROR_LOG)) {
fwrite(APP_ERROR_LOG, date('[D M d H:i:s Y] '));
fwrite(APP_ERROR_LOG, $msg);
} else {
file_put_contents(APP_ERROR_LOG, array(date('[D M d H:i:s Y] '), $msg), FILE_APPEND);
}
// if there's no database connection, then we cannot possibly queue up the error emails
$dbh = DB_Helper::getInstance();
if ($notify_error === false || !$dbh) {
return;
}
$setup = Setup::get();
if (isset($setup['email_error']['status']) && $setup['email_error']['status'] == 'enabled') {
$notify_list = trim($setup['email_error']['addresses']);
if (empty($notify_list)) {
return;
}
self::_notify($msg, $setup['smtp']['from'], $notify_list);
}
}
开发者ID:dabielkabuto,项目名称:eventum,代码行数:32,代码来源:class.error_handler.php
示例20: write_config
function write_config()
{
$setup = new Setup();
if ($setup->mysqlConfigExists()) {
return 'config already exist';
}
$mysql_data['host'] = $_POST['mysql_server'];
$mysql_data['user'] = $_POST['user_name'];
$mysql_data['passwd'] = $_POST['user_passwd'];
$mysql_data['db'] = $_POST['db'];
if (!$setup->mysqlConfigIsValid($mysql_data)) {
$mysql_admin['user'] = $_POST['admin_name'];
$mysql_admin['passwd'] = $_POST['admin_passwd'];
$setup->createUser($mysql_data, $mysql_admin);
}
if ($setup->mysqlConfigIsValid($mysql_data)) {
$setup->writeMysqlConfig($mysql_data);
} else {
return 'invalid config';
}
}
开发者ID:BackupTheBerlios,项目名称:infoschool-svn,代码行数:21,代码来源:write_mysql_config.php
注:本文中的Setup类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论