本文整理汇总了PHP中ConfigHelper::Get方法的典型用法代码示例。如果您正苦于以下问题:PHP ConfigHelper::Get方法的具体用法?PHP ConfigHelper::Get怎么用?PHP ConfigHelper::Get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConfigHelper
的用法示例。
在下文中一共展示了ConfigHelper::Get方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: SetLanguage
protected function SetLanguage($aLanguages)
{
if (ConfigHelper::Get('/languages/switch') == 'host') {
$sLanguage = substr($_SERVER['SERVER_NAME'], 0, 2);
if (array_key_exists($sLanguage, $aLanguages) && substr($_SERVER['SERVER_NAME'], 2, 1) == '.') {
$this->sLanguage = $sLanguage;
} else {
$this->sLanguage = 'en';
}
} else {
// check for request to change language
// if not present check for cookie specifiying language
// finally fall back to english
if (isset($_GET['lang']) && array_key_exists($_GET['lang'], $aLanguages)) {
$this->sLanguage = $_GET['lang'];
setcookie('lang', $this->sLanguage, time() + 60 * 60 * 24 * 365, '/');
header('Location: /');
exit;
} elseif (isset($_COOKIE['lang']) && array_key_exists($_COOKIE['lang'], $aLanguages)) {
$this->sLanguage = $_COOKIE['lang'];
} else {
$this->sLanguage = 'en';
}
}
}
示例2: tla_ads
function tla_ads()
{
// Number of seconds before connection to XML times out
// (This can be left the way it is)
$CONNECTION_TIMEOUT = 10;
// Local file to store XML
// This file MUST be writable by web server
// You should create a blank file and CHMOD it to 666
$LOCAL_XML_FILENAME = ConfigHelper::Get('/cache/tla/dir') . ConfigHelper::Get('/cache/tla/file');
if (!file_exists($LOCAL_XML_FILENAME)) {
die("Script error: {$LOCAL_XML_FILENAME} does not exist. Please create a blank file named {$LOCAL_XML_FILENAME}.");
}
if (!is_writable($LOCAL_XML_FILENAME)) {
die("Script error: {$LOCAL_XML_FILENAME} is not writable. Please set write permissions on {$LOCAL_XML_FILENAME}.");
}
if (filemtime($LOCAL_XML_FILENAME) < time() - 3600 || filesize($LOCAL_XML_FILENAME) < 20) {
$request_uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : "";
$user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : "";
tla_updateLocalXML("http://www.text-link-ads.com/xml.php?inventory_key=Z73AUCI0OTG7DAHAYCKP&referer=" . urlencode($request_uri) . "&user_agent=" . urlencode($user_agent), $LOCAL_XML_FILENAME, $CONNECTION_TIMEOUT);
}
$xml = tla_getLocalXML($LOCAL_XML_FILENAME);
$arr_xml = tla_decodeXML($xml);
if (is_array($arr_xml)) {
echo "\n<ul id=\"text-links\">\n";
for ($i = 0; $i < count($arr_xml['URL']); $i++) {
if (isset($arr_xml['PostID'][$i]) && $arr_xml['PostID'][$i] > 0) {
continue;
}
echo "<li>" . $arr_xml['BeforeText'][$i] . " <a href=\"" . $arr_xml['URL'][$i] . "\">" . $arr_xml['Text'][$i] . "</a> " . $arr_xml['AfterText'][$i] . "</li>\n";
}
echo "</ul>";
}
}
示例3: GetMenuUrl
public function GetMenuUrl($sAppRoot, $sSection)
{
if ($sSection != 'home') {
if (ConfigHelper::Get('/urls/rewritten')) {
return $sAppRoot . "section/{$sSection}";
} else {
return $sAppRoot . "?view={$sSection}";
}
}
return $sAppRoot;
}
示例4: TemplateFunctions
if (!$bUploadError) {
// get ZIP folder and MD5 has to store in hidden form fields
// these are used if the form is resubmitted (options changed) to prevent the
// need to re-upload the ZIP file
$oTemplate->Set('zipFolder', $oCssSpriteGen->GetZipFolder());
$oTemplate->Set('zipFolderHash', $oCssSpriteGen->GetZipFolderHash());
}
// if no form or upload errors then get parameters for sprite image
if (!$bFormError && !$bUploadError) {
$oCssSpriteGen->CreateSprite($sFolderMD5);
$oTemplate->Set('filename', $oCssSpriteGen->GetSpriteFilename());
$oTemplate->Set('hash', $oCssSpriteGen->GetSpriteHash());
$oTemplate->Set('css', $oCssSpriteGen->GetCss());
$oTemplate->Set('validImages', $oCssSpriteGen->ValidImages());
} else {
$oTemplate->Set('validImages', false);
}
// pass error flags to template
$oTemplate->Set('formError', $bFormError);
$oTemplate->Set('uploadError', $bUploadError);
}
// get all errors
$aFormErrors = $oCssSpriteGen->GetAllErrors();
// pass data to template
$oTemplate->Set('title', $oTranslations->Get('page.title.home'));
$oTemplate->Set('maxFileSize', (int) ConfigHelper::Get('/upload/max_file_size'));
$oTemplate->Set('imageTypes', TemplateFunctions::ConvertArrayToMulti($oCssSpriteGen->GetImageTypes()));
$oTemplate->Set('formPosted', $bFormPosted);
$oTemplate->Set('formErrors', $aFormErrors);
$oTemplate->Set('useApi', !empty($_GET['use-api']));
$oTemplate->Set('functions', new TemplateFunctions($bFormPosted, $aFormErrors));
示例5: WriteImage
protected function WriteImage($oImage, $sExtension, $sFilename)
{
if ($this->sImageLibrary == 'imagick') {
try {
// check if we want to resample image to lower number of colours (to reduce file size)
if (in_array($sExtension, array('gif', 'png')) && $this->aFormValues['image-num-colours'] != 'true-colour') {
$oImage->quantizeImage($this->aFormValues['image-num-colours'], Imagick::COLORSPACE_RGB, 0, false, false);
}
// if we're creating a JEPG set image quality - 0% - 100%
if (in_array($sExtension, array('jpg', 'jpeg'))) {
$oImage->setCompression(Imagick::COMPRESSION_JPEG);
$oImage->SetCompressionQuality($this->aFormValues['image-quality']);
}
// write out image to file
$oImage->writeImage($sFilename);
} catch (ImagickException $e) {
error_log($e->getMessage());
}
} else {
// check if we want to resample image to lower number of colours (to reduce file size)
if (in_array($sExtension, array('gif', 'png')) && $this->aFormValues['image-num-colours'] != 'true-colour') {
imagetruecolortopalette($oImage, true, $this->aFormValues['image-num-colours']);
}
switch ($sExtension) {
case 'jpg':
case 'jpeg':
// GD takes quality setting in main creation function
imagejpeg($oImage, $sFilename, $this->aFormValues['image-quality']);
break;
case 'gif':
// force colour palette to 256 colours if saving sprite image as GIF
// this will happen anyway (as GIFs can't be more than 256 colours)
// but the quality will be better if pre-forcing
if ($this->bTransparent && ($this->aFormValues['image-num-colours'] == -1 || $this->aFormValues['image-num-colours'] > 256)) {
imagetruecolortopalette($oImage, true, 256);
}
imagegif($oImage, $sFilename);
break;
case 'png':
imagepng($oImage, $sFilename);
break;
}
}
// if using a PNG and option selected further compress sprite image using OptiPNG
// this can result in more than 50% saving in file size with little loss in quality
if ($sExtension == 'png' && !empty($this->aFormValues['use-optipng']) && ConfigHelper::Get('/binaries/optipng')) {
// this probably won't work with PHP safe mode enabled
// no real alternative - you'll have to enable to use
shell_exec(ConfigHelper::Get('/binaries/optipng') . " {$sFilename}");
}
}
示例6: Template
$oTemplate->Set('basename', $sBasename);
echo $oTemplate->Display();
exit;
}
$sUploadDir = ConfigHelper::GetAbsolutePath($sBasename . ConfigHelper::Get('/cache/upload_dir'));
$sSpriteDir = ConfigHelper::GetAbsolutePath($sBasename . ConfigHelper::Get('/cache/sprite_dir'));
$sTranslationsCacheDir = ConfigHelper::GetAbsolutePath($sBasename . ConfigHelper::Get('/cache/translations_dir'));
$sCssCacheDir = ConfigHelper::GetAbsolutePath($sBasename . ConfigHelper::Get('/cache/css_archive'));
$sJsCacheDir = ConfigHelper::GetAbsolutePath($sBasename . ConfigHelper::Get('/cache/js_archive'));
ConfigHelper::CreateDir($sUploadDir);
ConfigHelper::CreateDir($sSpriteDir);
ConfigHelper::CreateDir($sTranslationsCacheDir);
ConfigHelper::CreateDir($sCssCacheDir);
ConfigHelper::CreateDir($sJsCacheDir);
// This section is present for Project Fondue use only and can be safely removed */
if (ConfigHelper::Get('/cache/tla/dir')) {
$sTextLinkAdsDir = ConfigHelper::GetAbsolutePath($sBasename . ConfigHelper::Get('/cache/tla/dir'));
ConfigHelper::CreateDir($sTextLinkAdsDir);
ConfigHelper::CreateFile($sTextLinkAdsDir . '/' . ConfigHelper::Get('/cache/tla/file'));
}
// End section //
if (!is_writeable($sUploadDir) || !is_writeable($sSpriteDir) || !is_writeable($sTranslationsCacheDir) || !is_writeable($sCssCacheDir) || !is_writeable($sJsCacheDir)) {
$oTemplate = new Template('setup-permissions-error.php');
$oTemplate->Set('uploadDir', $sUploadDir);
$oTemplate->Set('spriteDir', $sSpriteDir);
$oTemplate->Set('translationsCacheDir', $sTranslationsCacheDir);
$oTemplate->Set('cssCacheDir', $sCssCacheDir);
$oTemplate->Set('jsCacheDir', $sJsCacheDir);
echo $oTemplate->Display();
exit;
}
示例7: GetZipFolderHash
public function GetZipFolderHash()
{
return md5($this->sZipFolder . ConfigHelper::Get('/checksum'));
}
示例8: array
<?php
require_once '../includes/config.inc.php';
require_once '../includes/combine.inc.php';
$aConfig = array('file_type' => 'text/javascript', 'cache_length' => 31356000, 'create_archive' => true, 'archive_folder' => ConfigHelper::Get('/cache/js_archive'), 'jsmin_compress' => ConfigHelper::Get('/jsmin/compress'), 'jsmin_comments' => ConfigHelper::Get('/jsmin/comments'), 'files' => array('js/yahoo.js', 'js/dom.js', 'js/event.js', 'js/tool.js'));
$oCombine = new Combine($aConfig);
echo $oCombine->Get();
示例9: array
<?php
require_once '../includes/config.inc.php';
require_once '../includes/combine.inc.php';
$aConfig = array('file_type' => 'text/css', 'cache_length' => 31356000, 'create_archive' => true, 'archive_folder' => ConfigHelper::Get('/cache/css_archive'), 'files' => array('css/reset.css', 'css/default.css'));
$oCombine = new Combine($aConfig);
echo $oCombine->Get();
示例10: pathinfo
<?php
// check parameters haven't been modified, checksum is used to prevent people guessing the URL to saved images
if (isset($_GET['file']) && preg_match("/^csg-[a-f0-9]+\\.(gif|png|jpg)\$/", $_GET['file']) && isset($_GET['hash']) && md5($_GET['file'] . ConfigHelper::Get('/checksum')) == $_GET['hash']) {
$sFilename = ConfigHelper::Get('/cache/sprite_dir') . $_GET['file'];
// file may not exist as folder is cleaned up every 30 mins
if (file_exists($sFilename)) {
$aFileParts = pathinfo($sFilename);
// set headers correctly so the user is prompted to download the generated image
header("Content-type: image/{$aFileParts['extension']}");
header("Content-Disposition: attachment; filename=\"{$aFileParts['basename']}\"");
// output the generate image
readfile($sFilename);
} else {
die('Sprite image no longer exists. Please re-upload your images through the tool.');
}
} else {
die('Invalid parameters specified');
}