本文整理汇总了PHP中Zend_Controller_Request_Http::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Controller_Request_Http::get方法的具体用法?PHP Zend_Controller_Request_Http::get怎么用?PHP Zend_Controller_Request_Http::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Controller_Request_Http
的用法示例。
在下文中一共展示了Zend_Controller_Request_Http::get方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onAfterInitController
public function onAfterInitController($event)
{
//this extension should only run if no explicit model is given via request parameter "m"
$request = new Zend_Controller_Request_Http();
if ($request->get("m")) {
return;
}
$config = $this->_privateConfig->toArray();
$efApp = Erfurt_App::getInstance();
// disable model box if config value is true and modelmanangement isn't allowed
if ($config['modelsHide'] && !$efApp->getAc()->isActionAllowed($config['modelsExclusiveRight'])) {
$registry = OntoWiki_Module_Registry::getInstance();
$registry->disableModule('modellist', 'main.sidewindow');
}
//only do this once (so if the model is changed later, this plugin will not prevent it)
if ($config['setOnce'] && isset($_SESSION['defaultModelHasBeenSet']) && $_SESSION['defaultModelHasBeenSet']) {
return;
}
$_SESSION['defaultModelHasBeenSet'] = true;
require_once 'OntoWiki/Module/Registry.php';
$owApp = OntoWiki::getInstance();
$efStore = $efApp->getStore();
$availableModels = $efStore->getAvailableModels();
if (array_key_exists('modelUri', $config) && array_key_exists($config['modelUri'], $availableModels)) {
$modelUri = $config['modelUri'];
} elseif (count($availableModels) === 1) {
$modelUri = current(array_keys($availableModels));
} else {
$modelUri = false;
}
// set default model if it could be determined
if ($modelUri && !$efApp->getAc()->isActionAllowed($config['modelsExclusiveRight'])) {
if (!($owApp->selectedModel && $modelUri == $owApp->selectedModel->getModelUri())) {
$owApp->selectedModel = $efStore->getModel($modelUri);
return;
}
if ($config['setSelectedResource']) {
$owApp->selectedResource = $modelUri;
}
}
}
示例2: testGetIsAlias
public function testGetIsAlias()
{
$this->assertEquals('val1', $this->_request->get('var1'));
}
示例3: sendPackage
/**
* @see AM_Handler_Export_Storage_Interface::sendPackage()
* @throws AM_Handler_Export_Storage_Exception
*/
public function sendPackage()
{
$sFilePath = $this->_buildPackagePath() . DIRECTORY_SEPARATOR . $this->getPackage()->getPackageName();
$sFileName = $this->getPackage()->getPackageDownloadName();
if (!file_exists($sFilePath)) {
throw new AM_Handler_Export_Storage_Exception(sprintf('File "%s" not found', $sFilePath));
}
$oResponse = new Zend_Controller_Response_Http();
$oResponse->setHttpResponseCode(200);
$oRequest = new Zend_Controller_Request_Http();
$iFileSize = filesize($sFilePath);
$sFileMtime = @gmdate("D, d M Y H:i:s", @filemtime($sFilePath)) . " GMT";
$rFile = @fopen($sFilePath, 'rb');
$sRange = $oRequest->get('HTTP_RANGE');
//Trying to resume download according to the HTTP_RANGE header
if (preg_match('/bytes=(\\d+)-(\\d*)/i', $sRange, $matches)) {
$sRange = $matches[1];
} else {
$sRange = false;
}
if ($sRange) {
fseek($rFile, $sRange);
$oResponse->setHttpResponseCode(206);
$oResponse->setHeader('Content-Range', sprintf('bytes %d-%d/%d', $sRange, $iFileSize - 1, $iFileSize));
}
$oResponse->setHeader('Content-Disposition', 'attachment; filename=' . $sFileName)->setHeader('Content-Length', $iFileSize - $sRange)->setHeader('Content-Type', 'application/octet-stream')->setHeader('Accept-Ranges', 'bytes')->setHeader('Last-Modified', $sFileMtime);
while (!feof($rFile)) {
$sBuffer = fread($rFile, 2048);
$oResponse->appendBody($sBuffer);
}
fclose($rFile);
$oResponse->sendResponse();
}