本文整理汇总了PHP中bootstrap函数的典型用法代码示例。如果您正苦于以下问题:PHP bootstrap函数的具体用法?PHP bootstrap怎么用?PHP bootstrap使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bootstrap函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: plugin
protected function plugin()
{
// functions used as part of constructor
Mock::wpPassthruFunction('untrailingslashit');
Mock::wpFunction('plugin_dir_path', array('args' => bootstrap()->get_framework_path() . '/woocommerce/class-sv-wc-plugin.php', 'return' => bootstrap()->get_framework_path() . '/woocommerce'));
Mock::wpFunction('is_admin', array('return' => true));
Mock::wpPassthruFunction('plugin_basename');
Mock::wpFunction('has_action', array('return' => true));
$args = array('mock', '7.7.7', 'woocommerce-mock', 'args' => array('dependencies' => 'json', 'function_dependencies' => 'ftp_ssl_connect'));
return $this->getMockBuilder('SV_WC_Plugin')->setConstructorArgs($args)->getMockForAbstractClass();
}
示例2: run_preflight
/**
* Perform preflight checks for Mercator
*
* Checks that we can actually run SSO, then attaches the relevant actions
* and filters to make it useful.
*/
function run_preflight()
{
if (!is_enabled()) {
return;
}
// Check for COOKIE_DOMAIN definition
//
// Note that this can't be an admin notice, as you'd never be able to log in
// to see it.
if (defined('COOKIE_DOMAIN')) {
status_header(500);
header('X-Mercator: COOKIE_DOMAIN');
wp_die('The constant <code>COOKIE_DOMAIN</code> is defined (probably in <code>wp-config.php</code>). Please remove or comment out that <code>define()</code> line.');
}
// E: There's no reason to become alarmed, and we hope you'll enjoy the
// rest of your flight.
//
// E: By the way, is there anyone on board who knows how to fly a plane?
bootstrap();
}
示例3: bootstrap
* @package Filter Search Community Edition
* @version v2.1 Final
*
*/
function bootstrap()
{
if (isset($_GET['act'])) {
include realpath(dirname(__FILE__) . '/../../../../') . '/config/config.inc.php';
include realpath(dirname(__FILE__) . '/../../../../') . '/init.php';
if (!class_exists('ProCoreApi', FALSE)) {
include realpath(dirname(__FILE__) . '/../../libraries/') . '/procore.api.php';
}
if (!class_exists('FilterSearch', FALSE)) {
include realpath(dirname(__FILE__) . '/../../modules/') . '/filtersearch/filtersearch.module.php';
}
$api = new ProCoreApi();
$filter = new FilterSearch(TRUE);
$page = isset($_GET['page']) ? $_GET['page'] : 1;
$perpage = isset($_GET['page']) ? $_GET['perpage'] : 10;
$orderby = isset($_GET['orderby']) ? $_GET['orderby'] : 'newest';
$orderway = isset($_GET['orderway']) ? $_GET['orderway'] : 'desc';
if ($_GET['act'] == 'filter') {
$output = $filter->performSearch($smarty, $page, $perpage, $orderby, $orderway);
} elseif ($_GET['act'] == 'tabs') {
$output = array('tabs' => $filter->sortByTabs($smarty));
}
return json_encode($output);
}
}
print bootstrap();
示例4: ariPageHeader
/**
* Set HTTP headers in preparation for a page response.
*
* TODO: Figure out caching
*/
function ariPageHeader()
{
bootstrap();
}
示例5: dirname
<?php
/**
* This file is part of the sfSearch package.
* (c) Carl Vondrick <carl.vondrick@symfony-project.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
require dirname(__FILE__) . '/../bootstrap/functional.php';
bootstrap('frontend');
$b = new xfTestBrowser();
$b->getAndCheck('search', 'search')->checkResponseElement('title', 'Search')->checkResponseElement('h2', 'Search', array('position' => 0))->checkResponseElement('form[method="get"]', true)->checkResponseElement('form label[for="search_query"]', 'Query')->checkResponseElement('form input[id="search_query"]', true)->checkResponseElement('form input[type="submit"]', true);
示例6: index
<?php
include "lib/_inc.php";
class CameraController extends Controller
{
public function index()
{
return $this->renderView("camera/index", array("page" => "camera", "streamUrl" => Storage::get("camera")->streamUrl));
}
}
bootstrap(CameraController::class);
示例7: exit
print "FATAL: You must be in group 'fossy' to update the FOSSology database.\n";
exit(1);
}
/* Initialize the program configuration variables */
$SysConf = array();
// fo system configuration variables
$PG_CONN = 0;
// Database connection
$Plugins = array();
/* defaults */
$Verbose = false;
$DatabaseName = "fossology";
$UpdateLiceneseRef = false;
$sysconfdir = '/usr/local/etc/fossology';
/* Set SYSCONFDIR and set global (for backward compatibility) */
$SysConf = bootstrap($sysconfdir);
// don't think we want all the other common libs
require_once "{$MODDIR}/lib/php/common.php";
/* Initialize global system configuration variables $SysConfig[] */
ConfigInit($SYSCONFDIR, $SysConf);
/* migration */
require_once "./dbmigrate_2.1-2.2.php";
print "Migrate data from 2.1 to 2.2 \n";
Migrate_21_22($Verbose);
exit(0);
/************************************************/
/****** From src/lib/php/bootstrap.php ********/
/** Included here so that fossinit can run from any directory **/
/**
* \brief Bootstrap the fossology php library.
* - Determine SYSCONFDIR
示例8: array
* Sample Output:
* $ ./regressiontest.php -w "http://bobg.fc.hp.com/trunk"
* Regression found: Baseline is regression/good//?mod=browse&upload=1&item=1, new content is regression/output_29370/?mod=browse&upload=1&item=1
* Total files checked: 3
* No regression in: 2
* Regression found in: 1
*/
// $DATAROOTDIR and $PROJECT come from Makefile
//require_once "$DATAROOTDIR/$PROJECT/lib/php/bootstrap.php";
require_once "/usr/local/share/fossology/lib/php/bootstrap.php";
$SysConf = array();
// fo system configuration variables
$PG_CONN = 0;
// Database connection
/* Set SYSCONFDIR and set global (for backward compatibility) */
$SysConf = bootstrap();
/* Initialize global system configuration variables $SysConfig[] */
ConfigInit($SYSCONFDIR, $SysConf);
/* Directories */
$GoodDir = "regression/good/";
$PostDir = "regression/post/";
$OutputDirTemplate = "regression/output_";
/* output dir is suffixed with pid */
$OutputDir = $OutputDirTemplate . posix_getpid();
/* -h webhost
*/
$Options = getopt("hw:");
if (array_key_exists('h', $Options)) {
Usage($argc, $argv);
exit(0);
}
示例9: add
<?php
include "lib/_inc.php";
use matuck\DelugeApi\Client\HTTPClient;
class TorrentController extends Controller
{
public function add()
{
$page = isset($_GET["page"]) ? intval($_GET["page"]) : 1;
$order = isset($_GET["order"]) ? $_GET["order"] : "date_added";
$search = isset($_GET["q"]) ? $_GET["q"] : null;
return $this->renderView("torrent/add", array("movies" => YTS::getMovies($page, 8, $order, "desc", $search), "page" => $page, "order" => $order, "search" => $search));
}
public function download()
{
$contents = Http::get($_GET["url"]);
$fileInfo = new SplFileInfo($_GET["fname"]);
// Add the torrent to deluge using the RPC api
$tconfig = Storage::get("torrents");
$client = new HTTPClient((array) $tconfig->deluge);
$client->core->add_torrent_file($tconfig->dropPath . "/" . $fileInfo->getFilename() . ".torrent", base64_encode($contents), null);
return $this->redirect("/?alert=" . urlencode("Torrent download started"));
}
public function dashboard()
{
return $this->renderView("torrent/dashboard");
}
}
bootstrap(TorrentController::class);
示例10: define
<?php
// $Id$
/**
* 脚本开始运行时间
*/
define('DIDA_START_TIME', microtime(true));
/**
* 工作目录
* 建议包含文件,使用绝对路径。
*/
define('DIDA_ROOT', getcwd());
require_once DIDA_ROOT . '/includes/bootstrap.inc';
// 程序初始化
bootstrap('full');
// 获取当前路径($_GET['q'])输出
$return = menu_get_item();
// 针对当前路径,所有模块输出完成,触发 hook_exit()
module_invoke_all('exit', 'full');
if (is_int($return)) {
switch ($return) {
case MENU_ACCESS_DENIED:
// 无权限访问
dd_get_access();
break;
case MENU_NOT_FOUND:
// 路径未定义
dd_get_not();
}
exit;
}
示例11: _getTorrents
<?php
include "lib/_inc.php";
use matuck\DelugeApi\Client\HTTPClient;
class DashboardController extends Controller
{
private function _getTorrents()
{
$tconfig = Storage::get("torrents");
$client = new HTTPClient((array) $tconfig->deluge);
return $client->core->get_torrents_status([], ["name", "total_size", "files", "progress"]);
}
public function index()
{
return $this->renderView("dashboard/index", array("volumes" => Storage::get("volumes"), "torrents" => $this->_getTorrents(), "page" => "dashboard", "alertEnabled" => isset($_GET["alert"]), "alertText" => isset($_GET["alert"]) ? urldecode($_GET["alert"]) : null));
}
}
bootstrap(DashboardController::class);
示例12: header
break;
case 'cli-server':
if (is_file($_SERVER['DOCUMENT_ROOT'] . $_SERVER['REQUEST_URI'])) {
return FALSE;
}
header('HTTP/1.0 500 Internal Server Error');
$_SERVER['SCRIPT_URL'] = substr($_SERVER['REQUEST_URI'], 0, strcspn($_SERVER['REQUEST_URI'], '?#'));
$_SERVER['SERVER_PROFILE'] = getenv('SERVER_PROFILE');
define('STDIN', fopen('php://stdin', 'rb'));
define('STDOUT', fopen('php://stdout', 'wb'));
define('STDERR', fopen('php://stderr', 'wb'));
break;
default:
header('HTTP/1.0 500 Internal Server Error');
}
ini_set('error_prepend_string', '<xmp>');
ini_set('error_append_string', '</xmp>');
ini_set('html_errors', 0);
// Bootstrap
if (!(include __DIR__ . DIRECTORY_SEPARATOR . 'lang.base.php')) {
trigger_error('[bootstrap] Cannot determine boot class path', E_USER_ERROR);
exit(0x3d);
}
// Set up class path
$paths = array();
$scan = explode(PATH_SEPARATOR . PATH_SEPARATOR, get_include_path());
foreach (explode(PATH_SEPARATOR, $scan[0]) as $path) {
$paths[] = '~' === $path[0] ? str_replace('~', $webroot, $path) : $path;
}
bootstrap(scanpath($paths, $webroot) . (isset($scan[1]) ? $scan[1] : ''));
exit(\xp\scriptlet\Runner::main(array($webroot, $configd, $_SERVER['SERVER_PROFILE'], $_SERVER['SCRIPT_URL'])));
示例13: ariPageHeader
/**
* Set HTTP headers in preparation for a page response.
*
* TODO: Figure out caching
*/
function ariPageHeader()
{
header('Content-type: text/html; charset=utf-8');
bootstrap();
}
示例14: header
case 'cli-server':
if (is_file($_SERVER['DOCUMENT_ROOT'] . $_SERVER['REQUEST_URI'])) {
return FALSE;
}
header('HTTP/1.0 500 Internal Server Error');
$_SERVER['SCRIPT_URL'] = substr($_SERVER['REQUEST_URI'], 0, strcspn($_SERVER['REQUEST_URI'], '?#'));
$_SERVER['SERVER_PROFILE'] = getenv('SERVER_PROFILE');
define('STDIN', fopen('php://stdin', 'rb'));
define('STDOUT', fopen('php://stdout', 'wb'));
define('STDERR', fopen('php://stderr', 'wb'));
break;
default:
header('HTTP/1.0 500 Internal Server Error');
}
ini_set('error_prepend_string', '<xmp>');
ini_set('error_append_string', '</xmp>');
ini_set('html_errors', 0);
// Bootstrap
if (!(include __DIR__ . DIRECTORY_SEPARATOR . 'lang.base.php')) {
trigger_error('[bootstrap] Cannot determine boot class path', E_USER_ERROR);
exit(0x3d);
}
// Set up class path
$paths = array();
list($use, $include) = explode(PATH_SEPARATOR . PATH_SEPARATOR, get_include_path());
foreach (explode(PATH_SEPARATOR, $use) as $path) {
$paths[] = '~' == $path[0] ? str_replace('~', $webroot, $path) : $path;
}
bootstrap(scanpath($paths, $webroot) . $include);
uses('xp.scriptlet.Runner');
exit(xp·scriptlet·Runner::main(array($webroot, $configd, $_SERVER['SERVER_PROFILE'], $_SERVER['SCRIPT_URL'])));
示例15: markdownfile
}
public function markdownfile($data, $file)
{
$parser = new \cebe\markdown\GithubMarkdown();
$parser->html5 = true;
$data["contents"] = $parser->parse(file_get_contents($file->getRealPath()));
return $this->renderView("file/text", $data);
}
public function excelFile($data, $file)
{
try {
$inputFileType = PHPExcel_IOFactory::identify($file->getRealPath());
$objReader = PHPExcel_IOFactory::createReader("Excel2007");
$objReader->setReadDataOnly(true);
$objPHPExcel = $objReader->load($file->getRealPath());
} catch (Exception $e) {
exit("Error loading file..");
}
$sheet = $objPHPExcel->getSheet(0);
$highestRow = $sheet->getHighestRow();
$highestColumn = $sheet->getHighestColumn();
$rows = [];
for ($row = 1; $row <= $highestRow; $row++) {
$rows[] = $sheet->rangeToArray('A' . $row . ':' . $highestColumn . $row, null, true, false)[0];
}
$data["rows"] = array("headers" => array_shift($rows), "data" => $rows);
return $this->renderView("file/table", $data);
}
}
bootstrap(FileController::class);