本文整理汇总了PHP中sfRequest::setRequestFormat方法的典型用法代码示例。如果您正苦于以下问题:PHP sfRequest::setRequestFormat方法的具体用法?PHP sfRequest::setRequestFormat怎么用?PHP sfRequest::setRequestFormat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sfRequest
的用法示例。
在下文中一共展示了sfRequest::setRequestFormat方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* Executes action
*
* @param sfRequest $request A request object
*/
public function execute($request)
{
$request->setRequestFormat('xml');
$this->date = QubitOai::getDate();
$this->path = $this->request->getUriPrefix() . $this->request->getPathInfo();
$this->attributes = $this->request->getGetParameters();
$this->attributesKeys = array_keys($this->attributes);
$this->requestAttributes = '';
foreach ($this->attributesKeys as $key) {
$this->requestAttributes .= ' ' . $key . '="' . $this->attributes[$key] . '"';
}
$this->sets = array();
foreach (QubitInformationObject::getCollections() as $el) {
$this->sets[] = new sfIsadPlugin($el);
}
}
示例2: execute
/**
* Executes action
*
* @param sfRequest $request A request object
*/
public function execute($request)
{
$request->setRequestFormat('xml');
$this->date = QubitOai::getDate();
$this->path = $this->request->getUriPrefix() . $this->request->getPathInfo();
$this->attributes = $this->request->getGetParameters();
$this->attributesKeys = array_keys($this->attributes);
$this->requestAttributes = '';
foreach ($this->attributesKeys as $key) {
$this->requestAttributes .= ' ' . $key . '="' . $this->attributes[$key] . '"';
}
$this->sets = array();
foreach (QubitInformationObject::getCollections() as $el) {
$this->sets[] = new sfIsadPlugin($el);
}
if (isset($this->request->verb)) {
switch ($this->request->verb) {
case 'Identify':
$this->verb = 'identify';
break;
case 'ListMetadataFormats':
$this->verb = 'listMetadataFormats';
break;
case 'ListSets':
$this->verb = 'listSets';
break;
case 'ListRecords':
$this->verb = 'listRecords';
break;
case 'ListIdentifiers':
$this->verb = 'listIdentifiers';
break;
case 'GetRecord':
$this->verb = 'getRecord';
break;
default:
$this->verb = 'badVerb';
}
} else {
$this->verb = 'badVerb';
}
}
示例3: execute
/**
* Executes action
*
* @param sfRequest $request A request object
*/
public function execute($request)
{
// only respond to OAI requests if the feature has been enabled
if (sfConfig::get('app_oai_oai_enabled') == 0) {
// the following displays a GUI response, should we return a
// '503 - Service unavailable' HTTP response (without specifying
// a 'Retry-After' parameter instead?
$this->forward('admin', 'oaiDisabled');
}
$request->setRequestFormat('xml');
/* print_r($this->oaiErrorArray);
//Check for null and duplicate parameters
if(QubitOai::hasDuplicateOrNullParameters())
{
$request->setParameter('errorCode', 'badArgument');
$request->setParameter('errorMsg', $this->oaiErrorArray{'badArgument'});
$this->forward('oai', 'error');
}*/
$this->date = QubitOai::getDate();
$this->path = $this->request->getUriPrefix() . $this->request->getPathInfo();
$this->attributes = $this->request->getGetParameters();
$this->attributesKeys = array_keys($this->attributes);
$this->requestAttributes = '';
foreach ($this->attributesKeys as $key) {
$this->requestAttributes .= ' ' . $key . '="' . $this->attributes[$key] . '"';
}
$this->sets = array();
foreach (QubitInformationObject::getCollections() as $el) {
$this->sets[] = new sfIsadPlugin($el);
}
/**
* Validate that verb is valid
*/
if (isset($this->request->verb)) {
if (!in_array($this->request->verb, $this->oaiVerbArr)) {
$request->setParameter('errorCode', 'badVerb');
$request->setParameter('errorMsg', 'Value of the verb argument is not a legal OAI-PMH verb, the verb argument is missing, or the verb argument is repeated.');
$this->forward('oai', 'error');
}
/**
* Validate that attributes are valid
*/
$allowedKeys = sfConfig::get('mod_oai_' . $this->request->verb . 'Allowed');
$mandatoryKeys = sfConfig::get('mod_oai_' . $this->request->verb . 'Mandatory');
if (!QubitOai::checkBadArgument($this->attributesKeys, $allowedKeys, $mandatoryKeys)) {
$request->setParameter('errorCode', 'badArgument');
$request->setParameter('errorMsg', 'The request includes illegal arguments, is missing required arguments, includes a repeated argument, or values for arguments have an illegal syntax.');
$this->forward('oai', 'error');
}
// For now, if there is a metadataPrefix requested other than oai_dc, fail the request
$metadataPrefix = $this->request->metadataPrefix;
if ($metadataPrefix != '' and $metadataPrefix != 'oai_dc') {
$request->setParameter('errorCode', 'badVerb');
$request->setParameter('errorMsg', 'The metadata format identified by the value given for the metadataPrefix argument is not supported by the item or by the repository.');
$this->forward('oai', 'error');
}
switch ($this->request->verb) {
case 'Identify':
$this->verb = 'identify';
break;
case 'ListMetadataFormats':
$this->verb = 'listMetadataFormats';
break;
case 'ListSets':
$this->verb = 'listSets';
break;
case 'ListRecords':
$this->verb = 'listRecords';
break;
case 'ListIdentifiers':
$this->verb = 'listIdentifiers';
break;
case 'GetRecord':
$this->verb = 'getRecord';
break;
default:
$this->verb = 'badVerb';
}
} else {
$this->verb = 'badVerb';
}
}