本文整理汇总了PHP中CopixI18N::getCharset方法的典型用法代码示例。如果您正苦于以下问题:PHP CopixI18N::getCharset方法的具体用法?PHP CopixI18N::getCharset怎么用?PHP CopixI18N::getCharset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CopixI18N
的用法示例。
在下文中一共展示了CopixI18N::getCharset方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _copix_utf8_decode
/**
* Décode uniquement si nous sommes en mode différent de UTF8
*
* @param string $pString Chaine à décoder
* @return string
*/
function _copix_utf8_decode($pString)
{
if (CopixI18N::getCharset() != 'UTF-8') {
return utf8_decode($pString);
}
return $pString;
}
示例2: __construct
/**
* Constructeur
* @param CopixDBProfile $pProfil le profil de connexion à utiliser pour se connecter à la base de donées.
*/
public function __construct($pProfil)
{
parent::__construct($pProfil);
$parts['charset'] = $this->_convertCharset(isset($parts['charset']) ? $parts['charset'] : CopixI18N::getCharset());
$this->doQuery('SET CHARACTER SET ' . $parts['charset']);
}
示例3: _processResult
/**
* Réalise les derniers traitements (généralement d'affichage ou de redirection).
*
* En fonction du code retour de l'action CopixActionReturn::CONST, Copix réalise
* un certain nombre de traitements pour terminer la requête en cours.
*
* @param CopixActionReturn $pToProcess Ce qui a été retourné par CopixActionGroup::process ()
* @see CopixActionGroup
*/
protected function _processResult($toProcess)
{
$config = CopixConfig::instance();
//appel les plugins de post-processing.
foreach (CopixPluginRegistry::getRegistered() as $name => $plugin) {
$plugin->afterProcess($toProcess);
}
//Analyse du résultat du process
switch ($toProcess->code) {
case CopixActionReturn::ERROR:
//erreur
header("Content-Type: text/html");
$tpl = new CopixTpl();
if (($assignedTitlePage = $tpl->getAssigned('TITLE_PAGE')) !== null) {
$tpl->assign('TITLE_PAGE', '[' . _i18n('copix:common.messages.error') . ']' . $assignedTitlePage);
} else {
$tpl->assign('TITLE_PAGE', '[' . _i18n('copix:common.messages.error') . ']');
}
$this->_processStandard($tpl);
$tpl->assign('HTML_HEAD', '<$HTML_HEAD />');
$tpl->assign('MAIN', $toProcess->data);
$content = $tpl->fetch('|error.tpl');
CopixContext::clear();
$this->_beforeDisplay($content);
echo $content;
break;
case CopixActionReturn::DISPLAY:
$charset = CopixI18N::getCharset();
header("Content-Type: text/html;charset=" . $charset);
$this->_processStandard($toProcess->data);
//appel de la méthode de préparation de la page standard.
$toProcess->data->assign('HTML_HEAD', '<$HTML_HEAD />');
//Par ex, bandeaux de pub, menus dynamiques, ... (propres aux projets.)
CopixContext::clear();
$content = $toProcess->data->fetch($config->mainTemplate);
$this->_beforeDisplay($content);
echo $content;
break;
case CopixActionReturn::DISPLAY_IN:
$charset = CopixI18N::getCharset();
header("Content-Type: text/html;charset=" . $charset);
$this->_processStandard($toProcess->data);
//appel de la méthode de préparation de la page standard.
$toProcess->data->assign('HTML_HEAD', '<$HTML_HEAD />');
//Par ex, bandeaux de pub, menus dynamiques, ... (propres aux projets.)
$content = $toProcess->data->fetch($toProcess->more);
$this->_beforeDisplay($content);
echo $content;
break;
case CopixActionReturn::FILE:
case CopixActionReturn::CONTENT:
$contentDisposition = 'inline';
$contentTransfertEnconding = 'binary';
$contentType = null;
$fileNameOnly = null;
if ($toProcess->code == CopixActionReturn::FILE) {
$fileName = $toProcess->data;
$fileNameOnly = explode('/', str_replace('\\', '/', $fileName));
$fileNameOnly = $fileNameOnly[count($fileNameOnly) - 1];
}
if (is_array($toProcess->more)) {
if (isset($toProcess->more['content-disposition'])) {
$contentDisposition = $toProcess->more['content-disposition'];
}
if (isset($toProcess->more['filename'])) {
$fileNameOnly = $toProcess->more['filename'];
}
if (isset($toProcess->more['content-type'])) {
$contentType = $toProcess->more['content-type'];
}
if (isset($toProcess->more['content-transfer-encoding'])) {
$contentTransfertEnconding = $toProcess->more['content-transfer-encoding'];
}
} elseif (strlen(trim($toProcess->more))) {
$contentType = $toProcess->more;
}
if ($contentType === null) {
$contentType = CopixMIMETypes::getFromFileName($fileNameOnly);
}
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: protected", false);
header("Content-Type: " . $contentType);
header("Content-Disposition: " . $contentDisposition . "; filename=\"" . $fileNameOnly . "\";");
header("Content-Transfer-Encoding: " . $contentTransfertEnconding);
header("Content-Length: " . ($toProcess->code == CopixActionReturn::FILE ? filesize($fileName) : strlen($toProcess->data)));
if ($toProcess->code == CopixActionReturn::FILE) {
readfile($fileName);
} else {
echo $toProcess->data;
//.........这里部分代码省略.........