本文整理汇总了PHP中setup函数的典型用法代码示例。如果您正苦于以下问题:PHP setup函数的具体用法?PHP setup怎么用?PHP setup使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setup函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: main
function main()
{
if ($_SERVER['argc'] <= 1 || false === is_dir($_SERVER['argv'][1])) {
echo usage();
exit(-1);
} else {
setup();
init($_SERVER['argv'][1]);
}
}
示例2: test_setup
/**
* Test load method.
*/
public function test_setup()
{
// Setup
\WP_Mock::expectActionAdded('init', 'TenUp\\WP_Documentor_Tools\\Core\\i18n');
\WP_Mock::expectActionAdded('init', 'TenUp\\WP_Documentor_Tools\\Core\\init');
\WP_Mock::expectAction('wpd_tools_loaded');
// Act
setup();
// Verify
$this->assertConditionsMet();
}
示例3: test_setup
/**
* Test setup method.
*/
public function test_setup()
{
// Setup
\WP_Mock::expectActionAdded('after_setup_theme', 'TenUp\\WP_Documenter\\Core\\i18n');
\WP_Mock::expectActionAdded('wp_head', 'TenUp\\WP_Documenter\\Core\\header_meta');
\WP_Mock::expectActionAdded('wp_enqueue_scripts', 'TenUp\\WP_Documenter\\Core\\scripts');
\WP_Mock::expectActionAdded('wp_enqueue_scripts', 'TenUp\\WP_Documenter\\Core\\styles');
// Act
setup();
// Verify
$this->assertConditionsMet();
}
示例4: melbourneit_register
function melbourneit_register($account, $domain)
{
require_once $path . "melbourneit.setup.php";
// GET THE DOMAIN DETAILS
$subject = "New Melbourneit Domain Registration ({$domain_name})";
// Determine the correct tld and get the email body...
$mbit = new MELBOURNEIT_MAIL();
$tld = strtolower(determine_domain_tld($domain_name));
// co.uk
if ($tld == "co.uk") {
$email = $mbit->mail_co_uk($account, $domain);
if (MELBOURNIT_MODE == "TEST") {
define('EMAIL_TO', 'nsiappstest@InternetNamesWW.com');
} elseif (MELBOURNIT_MODE == "LIVE") {
define('EMAIL_TO', 'nsiapps@prod.InternetNamesWW.com');
} elseif (MELBOURNIT_MODE == "OTHER") {
define('EMAIL_TO', MELBOURNIT_OTHER);
} else {
define('EMAIL_TO', setup("email"));
}
} elseif ($tld == "com" || $tld == "net" || $tld == "org") {
$email = $mbit->mail_c_n_o($account, $domain);
if (MELBOURNIT_MODE == "TEST") {
define('EMAIL_TO', 'nsiappstest@InternetNamesWW.com');
} elseif (MELBOURNIT_MODE == "LIVE") {
define('EMAIL_TO', 'nsiapps@prod.InternetNamesWW.com');
} elseif (MELBOURNIT_MODE == "OTHER") {
define('EMAIL_TO', MELBOURNIT_OTHER);
} else {
define('EMAIL_TO', setup("email"));
}
} elseif ($tld == "info" || $tld == "biz") {
$email = $mbit->mail_info_biz($account, $domain);
if (MELBOURNIT_MODE == "TEST") {
define('EMAIL_TO', 'nsiappstest@InternetNamesWW.com');
} elseif (MELBOURNIT_MODE == "LIVE") {
define('EMAIL_TO', 'nsiapps@prod.InternetNamesWW.com');
} elseif (MELBOURNIT_MODE == "OTHER") {
define('EMAIL_TO', MELBOURNIT_OTHER);
} else {
define('EMAIL_TO', setup("email"));
}
} elseif ($tld == "name") {
$email = $mbit->mail_name($account, $domain);
if (MELBOURNIT_MODE == "TEST") {
define('EMAIL_TO', 'newtldapps@prod.internetnamesww.com');
} elseif (MELBOURNIT_MODE == "LIVE") {
define('EMAIL_TO', 'newtldappstest@internetnamesww.com');
} elseif (MELBOURNIT_MODE == "OTHER") {
define('EMAIL_TO', MELBOURNIT_OTHER);
} else {
define('EMAIL_TO', setup("email"));
}
} elseif ($tld == "us") {
$email = $mbit->mail_us($account, $domain);
if (MELBOURNIT_MODE == "TEST") {
define('EMAIL_TO', 'nsiappstest@InternetNamesWW.com');
} elseif (MELBOURNIT_MODE == "LIVE") {
define('EMAIL_TO', 'nsiapps@prod.InternetNamesWW.com');
} elseif (MELBOURNIT_MODE == "OTHER") {
define('EMAIL_TO', MELBOURNIT_OTHER);
} else {
define('EMAIL_TO', setup("email"));
}
} else {
if ($DEBUG) {
echo "<BR>The melbourneit registrar module does not support '{$tld}' type domains!<BR>";
}
return FALSE;
}
// Now, send the mail..
mail(EMAIL_TO, $subject, $email, $headers);
// Display debug info
if ($DEBUG) {
echo "<pre> {$email} </pre>";
}
return TRUE;
}
示例5: main
function main()
{
global $stage;
setup();
if ($stage == 2) {
boot_vm();
}
}
示例6: throw_the_bum_out
throw_the_bum_out(NULL, "Evicted(" . __LINE__ . "): invalid record " . $recID, true);
}
if ($_POST["sessions"] == 0) {
delete_log($db, $state);
} else {
update_log($db, $state);
}
return true;
}
//Main State Gate: (the while (1==1) allows a loop back through the switch using a 'break 1')
while (1 == 1) {
switch ($_STATE->status) {
case STATE::INIT:
$_STATE->title_singular = $_SESSION["_EXTENSION"]["title_singular"];
$_STATE->title_plural = $_SESSION["_EXTENSION"]["title_plural"];
setup($_DB, $_STATE);
// $_STATE->msgGreet = "Enter the ".$_STATE->title_singular." data";
$_STATE->msgGreet = "Add or change info: click on the lefthand column";
$_STATE->EC_status = "";
//no line selected
STATE_new_status($_STATE, FILL_CELLS);
break 2;
case FILL_CELLS:
//fill cells (if edit, starts with Sessions)
if (isset($_GET["getdesc"])) {
//asking for the description of a cell
cell_desc($_DB, $_STATE);
break 2;
}
if (isset($_GET["reset"])) {
log_list($_DB, $_STATE);
示例7: main
function main()
{
global $stage;
setup();
if ($stage == 2) {
resume_vm();
}
}
示例8: function
// $view = $app->view();
$app->configureMode('development', function () use($app, $config) {
$app->config(array('debug' => true));
$connection_name = 'testing';
include '../app/app.php';
});
$app->configureMode('production', function () use($app, $config) {
$app->config(array('debug' => false));
$connection_name = 'default';
include '../app/app.php';
});
$app->get('/', function () use($app, $config) {
if ($config['maintenance']) {
$app->render('home/maintenance.php', array());
} else {
$app->render('home/index.php', array());
}
});
$app->get('/setup', function () use($app, $config) {
include '../app/functions.setup.php';
setup($config);
});
$app->notFound(function () use($app) {
$app->render('404.html');
});
$app->error(function (\Exception $e) use($app) {
$app->log->error($e->getFile() . ' on ' . $e->getLine() . ' ' . ' because : ' . $e->getMessage());
$app->response->headers->set('Content-Type', 'text/html');
$app->render('500.html');
});
$app->run();
示例9: report
if (!defined('EXTENDED') || EXTENDED !== 0 && EXTENDED !== 1) {
report('EXTENDED should be defined to 0 or 1', true);
}
if (!defined('MODE') || MODE != 'SPLIT' && MODE != 'AGGREGATE') {
report('MODE should be \'SPLIT\' or \'AGGREGATE\'', true);
exit(1);
}
if (!defined('AC') || AC !== 0 && AC !== 1) {
report('AC should be defined to 0 or 1', true);
exit(1);
}
if (MODE == 'SPLIT' && count($systemid) != IDCOUNT) {
report('In SPLIT mode, define IDCOUNT systemid mappings', true);
exit(1);
}
$socket = setup();
loop($socket);
socket_close($socket);
/*
* class for connection maintenance
*/
class Connection
{
public $socket;
public $buf = '';
public $lastkeepalive = 0;
public $last_read;
public function __construct($socket)
{
$this->socket = $socket;
$this->last_read = time();
示例10: session_start
<?php
session_start();
require_once __DIR__ . '/../functions/gamefunctions.php';
setup($_SESSION["user_id"], $_POST["city"]);
示例11: setup
<?php
require_once 'subtask/connect.inc.php';
require_once 'subtask/readymade_functions.inc.php';
function setup($field)
{
if (isset($_REQUEST[$field]) && !empty($_REQUEST[$field])) {
return true;
} else {
return false;
}
}
if (setup('zeit_event')) {
$event = mysqli_real_escape_string($connect, htmlentities($_REQUEST['zeit_event']));
if ($_SESSION['id'] == NULL) {
//user is trying to fraud with the system
echo json_encode(array('status' => 'false', 'error' => 'Attacked'));
return;
}
//checking if id already exists in events table
$myquery = sprintf("SELECT id,%s FROM %s WHERE id='%s'", $event, $table_event, $_SESSION['id']);
if ($resQuery = mysqli_query($connect, $myquery)) {
// echo 'Query2</ br>';
mysqli_data_seek($resQuery, 0);
if ($myValue = mysqli_fetch_row($resQuery)) {
echo json_encode(array('status' => 'true', 'reg' => $myValue[1]));
return;
} else {
//Id doesnt exist
echo json_encode(array('status' => 'false', 'error' => 'Login First'));
return;
示例12: json_encode
echo json_encode($det_array);
// echo json_encode(array('status'=>'false','error'=>'S Query Error'));
// return;
}
} else {
// echo 'A8';
echo json_encode(array('status' => 'false', 'error' => 'no such event exists'));
return;
}
} else {
// echo 'A9';
echo json_encode(array('status' => 'false', 'error' => 'Query Failure'));
return;
}
} else {
if (setup('team-member')) {
//getting the event details for submission
$min = 0;
$max = 0;
$event = mysqli_real_escape_string($connect, htmlentities($_REQUEST['zeit_event']));
$myquery = sprintf("SELECT team_size_min,team_size_max FROM %s WHERE event='%s'", $table_event_detail, $event);
// echo 'A10';
if ($resQuery = mysqli_query($connect, $myquery)) {
// echo 'Query2</ br>';
// echo 'A11';
mysqli_data_seek($resQuery, 0);
if ($myValue = mysqli_fetch_row($resQuery)) {
// echo 'A12';
//setting up min and max team members limit
$min = $myValue[0];
$max = $myValue[1];
示例13: get_filter_data
}
}
}
function get_filter_data($expected, $redis)
{
if (USE_IGBINARY) {
foreach ($expected as $sm => $countries) {
$result = igbinary_unserialize($redis->get($sm));
}
} else {
foreach ($expected as $sm => $countries) {
$result = json_decode($redis->get($sm), true);
}
}
}
$redis = setup();
//$redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_NONE);
//$redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_PHP);
$redis->setOption(Redis::OPT_SERIALIZER, Redis::SERIALIZER_IGBINARY);
$filename = 'data-' . SM_COUNT . '-' . COUNTRY_COUNT . '.json';
on_the_fly($redis);
exit;
if (GEN_DATA_ON_FLY) {
$data = generate_data();
$json_str = json_encode($data);
file_put_contents($filename, $json_str);
} else {
$json_str = file_get_contents($filename);
$data = json_decode($json_str, true);
}
$start_write_time = microtime(true);
示例14: htmlspecialchars
// redirect
if (isset($_GET["url"])) {
$cloak = new \Anax\Cloak\CCloak($app->form, $app->pdo);
$url = htmlspecialchars($_GET["url"]);
$results = $cloak->goToUrl($url);
}
// add routes
$app->router->add('', function () use($app) {
$title = 'Skapa redirect';
// Create the CCloak service
$cloak = new \Anax\Cloak\CCloak($app->form, $app->pdo);
// Setup if not already done
$status = $cloak->isSetup();
if ($status = false) {
$cloak->setup();
}
// check if set url
if (!isset($_GET["url"])) {
$linkContent = $cloak->addCloakedLink();
$content = $linkContent['form'];
$content .= $linkContent['text'];
$content .= '<a href="redirect.php/setup">Setup plugin</a>';
$app->views->add('default/page', ['content' => $content, 'title' => $title]);
}
});
$app->router->add('setup', function () use($app) {
$cloak = new \Anax\Cloak\CCloak($app->form, $app->pdo);
$cloak - setup();
});
$app->router->handle();
$app->theme->render();
示例15: assert_equals
assert_equals("/your regex/", $smoothie->filter);
});
should("accept --filter", function () {
$smoothie = new Smoothie(array("--filter", "your regex"));
assert_equals("/your regex/", $smoothie->filter);
});
should("add slashes if missing", function () {
$smoothie = new Smoothie(array("-n", "your regex"));
assert_equals("/your regex/", $smoothie->filter);
});
should("not add slahes if already there", function () {
$smoothie = new Smoothie(array("-n", "/your regex/"));
assert_equals("/your regex/", $smoothie->filter);
});
should("return true if no filter was set", function () {
$smoothie = new Smoothie();
assert_true($smoothie->passes_filter("my awesome test"));
});
context("tests with passes_filter()", function () {
setup(function () {
transient()->smoothie = new Smoothie(array("-n", "/my awesome test/"));
});
should("return true if filter was set and passes", function () {
assert_true(transient()->smoothie->passes_filter("this is my awesome test that is awesome"));
});
should("return false if filter was set and does not pass", function () {
assert_false(transient()->smoothie->passes_filter("blah"));
});
});
});
});