本文整理汇总了PHP中build函数的典型用法代码示例。如果您正苦于以下问题:PHP build函数的具体用法?PHP build怎么用?PHP build使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了build函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: homepage
function homepage($lang)
{
global $sitename, $siteshot;
$page_contents = build('content', $lang, 'homepage');
$besocial = $sharebar = false;
$ilike = true;
$tweetit = true;
$plusone = true;
$linkedin = true;
$pinit = true;
if ($tweetit or $pinit) {
$description = translate('description', $lang);
if ($tweetit) {
$tweet_text = $description ? $description : $sitename;
$tweetit = $tweet_text ? compact('tweet_text') : true;
}
if ($pinit) {
$pinit_text = $description ? $description : $sitename;
$pinit_image = $siteshot;
$pinit = $pinit_text && $pinit_image ? compact('pinit_text', 'pinit_image') : false;
}
}
list($besocial, $sharebar) = socialize($lang, compact('ilike', 'tweetit', 'plusone', 'linkedin', 'pinit'));
$content = view('anypage', false, compact('page_contents', 'besocial'));
head('title', $sitename);
$languages = 'homepage';
$contact = true;
$banner = build('banner', $lang, compact('languages', 'contact'));
$languages = false;
$contact = false;
$footer = build('footer', $lang, compact('languages', 'contact'));
$output = layout('standard', compact('sharebar', 'banner', 'footer', 'content'));
return $output;
}
示例2: __construct
public function __construct($authKeys = array())
{
$opts = array("headers" => array("User-Agent" => "twitter-wrapi"), "query" => array("stringify_ids" => "true"), 'auth' => 'oauth');
$handler = HandlerStack::create();
$handler->push(new Oauth1($authKeys));
function build(&$obj, $prefix, $apiList)
{
$path = $prefix;
if ($prefix !== '') {
$path .= '/';
}
foreach ($apiList as $name) {
$json = file_get_contents(__DIR__ . '/api/' . $path . $name . '.json');
$endpoint = json_decode($json, true);
$pre = $prefix === '' ? $name : $prefix . '.' . $name;
foreach ($endpoint as $sub => $ep) {
$obj[$pre . '.' . $sub] = $ep;
}
}
}
$all = [];
build($all, '', ['statuses', 'media', 'direct_messages', 'search', 'friendships', 'friends', 'followers', 'account', 'blocks', 'users', 'favorites', 'lists', 'saved_searches', 'geo', 'trends', 'application', 'help']);
build($all, 'users', ['suggestions']);
build($all, 'lists', ['members', 'subscribers']);
parent::__construct('https://api.twitter.com/1.1/', $all, $opts, ['handler' => $handler]);
}
示例3: threadall
function threadall($lang)
{
global $system_languages, $with_toolbar;
if (!user_has_role('writer')) {
return run('error/unauthorized', $lang);
}
$slang = false;
if (isset($_GET['slang'])) {
$slang = $_GET['slang'];
} else {
$slang = $lang;
}
if (!in_array($slang, $system_languages)) {
return run('error/notfound', $lang);
}
$site_title = translate('title', $lang);
$site_abstract = translate('description', $lang);
$site_cloud = translate('keywords', $lang);
head('title', translate('threadall:title', $slang));
head('description', false);
head('keywords', false);
head('robots', 'noindex, nofollow');
$edit = user_has_role('writer') ? url('threadedit', $_SESSION['user']['locale']) . '?' . 'clang=' . $lang : false;
$banner = build('banner', $lang, $with_toolbar ? false : compact('edit'));
$scroll = true;
$toolbar = $with_toolbar ? build('toolbar', $lang, compact('edit', 'scroll')) : false;
$threadlist = build('threadlist', $lang, false, false, $slang);
$content = view('threadall', $slang, compact('site_title', 'site_abstract', 'site_cloud', 'threadlist'));
$output = layout('viewing', compact('toolbar', 'banner', 'content'));
return $output;
}
示例4: build
function build($directory)
{
$menu = "";
$pages = "";
foreach (glob("{$directory}/*", GLOB_MARK) as $f) {
$find = array(".html", ".md", ".php", " ");
$replace = array("", "", "", "-");
$spaces = array("_", "-");
$nice_name = str_replace($find, $replace, basename($f));
$cap_name = ucwords(strtolower(str_replace($spaces, " ", $nice_name)));
if (substr($f, -1) === '/') {
$content = build($f);
$pages .= $content[1];
$menu .= "<li>\n\t\t\t\t\t<span data-menu='submenu'><i class='fa fa-plus-circle'></i> <span>{$cap_name}</span></span>\n\t\t\t\t\t<ul>";
$menu .= $content[0];
$menu .= "</ul></li>";
} else {
if ($cap_name != "Main") {
$pages .= "<section class='doc' data-doc='{$nice_name}'>";
$menu .= "<li data-show='{$nice_name}'> {$cap_name}</li>";
if (end(explode('.', basename($f))) == "md") {
$Parsedown = new Parsedown();
$pages .= $Parsedown->text(file_get_contents($f));
} else {
$pages .= file_get_contents($f);
}
$pages .= "</section>";
}
}
}
return [$menu, $pages];
}
示例5: adminuser
function adminuser($lang, $arglist = false)
{
if (!user_has_role('administrator')) {
return run('error/unauthorized', $lang);
}
$user_id = false;
if (is_array($arglist)) {
if (isset($arglist[0])) {
$user_id = $arglist[0];
}
}
if (!$user_id) {
return run('error/notfound', $lang);
}
$user_id = user_id($user_id);
if (!$user_id) {
return run('error/notfound', $lang);
}
$useredit = build('useredit', $lang, $user_id);
if ($useredit === false) {
return redirect('admin', $lang);
}
head('title', translate('admin:title', $lang));
head('description', false);
head('keywords', false);
head('robots', 'noindex, nofollow');
$admin = true;
$banner = build('banner', $lang, compact('admin'));
$content = view('adminuser', $lang, compact('useredit'));
$output = layout('standard', compact('banner', 'content'));
return $output;
}
示例6: user
function user($lang, $arglist = false)
{
global $login_verified, $base_url;
$login = build('login', $lang);
if ($login === true) {
$r = !empty($arglist['r']) ? $arglist['r'] : false;
if ($login_verified and array_intersect($login_verified, user_profile('role'))) {
$user = $_SESSION['user'];
unset($_SESSION['user']);
if (empty($_SERVER['HTTPS']) or $_SERVER['HTTPS'] == 'off') {
return run('error/unauthorized', $lang);
}
$_SESSION['unverified_user'] = $user;
$next_page = url('sslverifyclient');
if ($r) {
$next_page .= '?r=' . $r;
}
} else {
$next_page = $r ? $r : url('home', $lang);
}
return reload($base_url . $next_page);
}
$banner = build('banner', $lang);
$content = view('user', $lang, compact('login'));
head('title', translate('user:title', $lang));
head('description', false);
head('keywords', false);
head('robots', 'noindex, nofollow');
$output = layout('standard', compact('banner', 'content'));
return $output;
}
示例7: threadsummary
function threadsummary($lang, $thread)
{
global $system_languages, $with_toolbar;
if (!user_has_role('writer')) {
return run('error/unauthorized', $lang);
}
$slang = false;
if (isset($_GET['slang'])) {
$slang = $_GET['slang'];
} else {
$slang = $lang;
}
if (!in_array($slang, $system_languages)) {
return run('error/notfound', $lang);
}
$thread_id = thread_id($thread);
if (!$thread_id) {
return run('error/notfound', $lang);
}
$r = thread_get($lang, $thread_id);
if (!$r) {
return run('error/notfound', $lang);
}
extract($r);
/* thread_name thread_title thread_type thread_abstract thread_cloud thread_image thread_visits thread_nosearch thread_nocloud thread_nocomment thread_nomorecomment thread_novote thread_nomorevote thread_created thread_modified */
$thread_search = !$thread_nosearch;
$thread_tag = !$thread_nocloud;
$thread_comment = !$thread_nocomment;
$thread_morecomment = !$thread_nomorecomment;
$thread_vote = !$thread_novote;
$thread_morevote = !$thread_nomorevote;
$thread_contents = array();
$r = thread_get_contents($lang, $thread_id, false);
if ($r) {
$thread_url = url('thread', $lang) . '/' . $thread_id;
foreach ($r as $c) {
extract($c);
/* node_id node_name node_title node_number node_ignored */
$node_url = $thread_url . '/' . $node_id . '?' . 'slang=' . $slang;
$thread_contents[] = compact('node_id', 'node_title', 'node_url', 'node_ignored');
}
}
$headline_text = translate('threadall:title', $slang);
$headline_url = url('thread', $lang) . '?' . 'slang=' . $slang;
$headline = compact('headline_text', 'headline_url');
$title = view('headline', false, $headline);
$sidebar = view('sidebar', false, compact('title'));
head('title', $thread_title ? $thread_title : $thread_id);
head('description', $thread_abstract);
head('keywords', $thread_cloud);
head('robots', 'noindex, nofollow');
$edit = user_has_role('writer') ? url('threadedit', $_SESSION['user']['locale']) . '/' . $thread_id . '?' . 'clang=' . $lang : false;
$banner = build('banner', $lang, $with_toolbar ? compact('headline') : compact('headline', 'edit'));
$scroll = true;
$toolbar = $with_toolbar ? build('toolbar', $lang, compact('edit', 'scroll')) : false;
$content = view('threadsummary', $slang, compact('thread_id', 'thread_title', 'thread_abstract', 'thread_cloud', 'thread_image', 'thread_visits', 'thread_search', 'thread_tag', 'thread_comment', 'thread_morecomment', 'thread_vote', 'thread_morevote', 'thread_ilike', 'thread_tweet', 'thread_plusone', 'thread_linkedin', 'thread_pinit', 'thread_created', 'thread_modified', 'thread_contents'));
$output = layout('viewing', compact('toolbar', 'banner', 'content', 'sidebar'));
return $output;
}
示例8: init
private static function init()
{
load_functions();
if (!build()) {
die('build directories error');
}
safe();
}
示例9: build
function build($tree, &$seqs)
{
if (gettype($tree) == 'array') {
$tree[0] = build($tree[0], $seqs);
$tree[1] = build($tree[1], $seqs);
} else {
$tree = strtoupper(array_shift($seqs));
}
return $tree;
}
示例10: paymentaccepted
/**
*
* @copyright 2010-2012 izend.org
* @version 3
* @link http://www.izend.org
*/
function paymentaccepted($lang, $amount, $currency, $context)
{
head('title', translate('payment_accepted:title', $lang));
head('robots', 'noindex, nofollow');
$contact = true;
$banner = build('banner', $lang, compact('contact'));
$content = view('paymentaccepted', $lang, compact('amount', 'currency'));
$output = layout('standard', compact('banner', 'content'));
return $output;
}
示例11: main
function main()
{
$arr = build();
r(isset($arr["A"]));
r(isset($arr["AX"]));
r(isset($arr["B"]["A"]));
r(isset($arr["X"]["A"]));
r(isset($arr["B"]["X"]));
r(isset($arr["X"]["X"]));
r(isset($arr["X"]["X"]["X"]));
}
示例12: unauthorized
/**
*
* @copyright 2010-2012 izend.org
* @version 2
* @link http://www.izend.org
*/
function unauthorized($lang)
{
head('title', translate('http_unauthorized:title', $lang));
head('robots', 'noindex, nofollow');
$contact = $account = true;
$banner = build('banner', $lang, compact('contact', 'account'));
$contact_page = url('contact', $lang);
$content = view('error/unauthorized', $lang, compact('contact_page'));
$output = layout('standard', compact('banner', 'content'));
header('HTTP/1.1 401 Unauthorized');
return $output;
}
示例13: serviceunavailable
/**
*
* @copyright 2010-2012 izend.org
* @version 1
* @link http://www.izend.org
*/
function serviceunavailable($lang, $arglist)
{
head('title', translate('http_service_unavailable:title', $lang));
head('robots', 'noindex, nofollow');
$contact = false;
$banner = build('banner', $lang, compact('contact'));
list($closing_time, $opening_time) = $arglist;
$content = view('error/serviceunavailable', $lang, compact('closing_time', 'opening_time'));
$output = layout('standard', compact('banner', 'content'));
header('HTTP/1.1 503 Service Unavailable');
return $output;
}
示例14: badrequest
/**
*
* @copyright 2010-2012 izend.org
* @version 1
* @link http://www.izend.org
*/
function badrequest($lang)
{
head('title', translate('http_bad_request:title', $lang));
head('robots', 'noindex, nofollow');
$contact = true;
$banner = build('banner', $lang, compact('contact'));
$contact_page = url('contact', $lang);
$content = view('error/badrequest', $lang, compact('contact_page'));
$output = layout('standard', compact('banner', 'content'));
header('HTTP/1.1 400 Bad Request');
return $output;
}
示例15: internalerror
/**
*
* @copyright 2010-2012 izend.org
* @version 1
* @link http://www.izend.org
*/
function internalerror($lang)
{
head('title', translate('http_internal_error:title', $lang));
head('robots', 'noindex, nofollow');
$contact = true;
$banner = build('banner', $lang, compact('contact'));
$contact_page = url('contact', $lang);
$content = view('error/internalerror', $lang, compact('contact_page'));
$output = layout('standard', compact('banner', 'content'));
header('HTTP/1.1 500 Internal Error');
return $output;
}