本文整理汇总了PHP中PO::set_headers方法的典型用法代码示例。如果您正苦于以下问题:PHP PO::set_headers方法的具体用法?PHP PO::set_headers怎么用?PHP PO::set_headers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PO
的用法示例。
在下文中一共展示了PO::set_headers方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
/**
* Update with the provided data.
*
* @since 1.0.0
*
* @param array $data The data to update with.
* @param bool $replace Optional Replace all headers/entries/metadata with those provided?
*/
public function update($data, $replace = false)
{
// Update headers if present
if (isset($data['headers'])) {
if ($replace) {
// empty all headers
$this->po->headers = array();
}
$this->po->set_headers($data['headers']);
}
// Update entries if present
if (isset($data['entries'])) {
if ($replace) {
// empty all entries
$this->po->entries = array();
}
foreach ($data['entries'] as $entry) {
$this->po->add_entry($entry);
}
}
// Update metadata if present
if (isset($data['metadata'])) {
if ($replace) {
// Delete all properties other than headers or entries
foreach (get_object_vars($this->po) as $prop => $value) {
if ($prop !== 'headers' && $prop !== 'entries') {
unset($this->po->{$prop});
}
}
}
foreach ($data['metadata'] as $prop => $value) {
$this->po->{$prop} = $value;
}
}
}
示例2: GetLanguage
/**
* Configura a linguagem padr�o
*/
private function GetLanguage()
{
$mysql = new MysqlConsulta($this->cfg);
$this->language['language_default'] = $mysql->getLanguagefromCOUNTRY($this->cfg['ID_COUNTRY']);
//--> en,pt-br,ja,it
$this->language['language'] = $mysql->ListLanguages($this->language['language_default']);
if (isset($this->perfil->user_language)) {
$this->language['language_default'] = $this->perfil->user_language;
$this->language['language'] = $mysql->ListLanguages($this->perfil->user_language);
}
if (isset($_GET['q'])) {
$query = getLanguageURL($_GET['q']);
if ($query[1]) {
$this->language['language_default'] = $query[1];
$this->language['language'] = $mysql->ListLanguages($query[1]);
}
$_GET['q'] = $query[0];
}
if ($this->language['language']->language != language_default()->language) {
$this->language['translate'] = $mysql->getTranslate($this->language['language']->language);
if (!$this->language['translate']) {
$po = loadPO($this->language['language']->language);
if ($po == false) {
//@todo mensagem de errooooo
$message = _t("File not found a standard language for this request.");
setMessage($message, 'error');
}
insertTranslation($po);
} else {
$po = new PO();
$po->set_headers($this->language['translate']->headers);
$po->merge_with($this->language['translate']);
//@todo = verificar esta requisições de texto, se a função de tradução não irá cumprir o mesmo papel
}
$this->language['translate'] = $po;
}
}