本文整理汇总了PHP中Api::getHttpLang方法的典型用法代码示例。如果您正苦于以下问题:PHP Api::getHttpLang方法的具体用法?PHP Api::getHttpLang怎么用?PHP Api::getHttpLang使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Api
的用法示例。
在下文中一共展示了Api::getHttpLang方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* @param string $lang the language code of the Wikisource like 'en' or 'fr'
* @param string $domainName
* @param ClientInterface $client
*/
public function __construct($lang = '', $domainName = '', ClientInterface $client = null)
{
if ($lang == '') {
$lang = Api::getHttpLang();
}
$this->lang = $lang;
if ($domainName != '') {
$this->domainName = $domainName;
} elseif ($this->lang == 'www' || $this->lang == '') {
$this->domainName = 'wikisource.org';
$this->lang = '';
} elseif ($this->lang == 'wl' || $this->lang == 'wikilivres') {
$this->domainName = 'wikilivres.ca';
$this->lang = '';
} else {
$this->domainName = $this->lang . '.wikisource.org';
}
if ($client === null) {
$client = static::createClient(ToolLogger::get(__CLASS__));
}
$this->client = $client;
}
示例2:
<?php
include 'header.php';
?>
<form method="get" action="book.php" role="form" class="form-horizontal">
<fieldset>
<legend>Export a file</legend>
<div class="form-group">
<label for="lang" class="col-lg-2 control-label">Language code</label>
<div class="col-lg-10">
<input name="lang" id="lang" type="text" size="3" maxlength="20" required="required"
value="<?php
echo Api::getHttpLang();
?>
" class="form-control input-mini"/>
<span class="help-block">Language code of Wikisource domain, like en or fr</span>
</div>
</div>
<div class="form-group">
<label for="page" class="col-lg-2 control-label">Title of the page</label>
<div class="col-lg-10">
<input name="page" id="page" type="text" size="30" required="required" class="form-control"
value="<?php
echo $title;
?>
"/>
<span class="help-block">Name of the mainpage of the book in Wikisource</span>
</div>
</div>