本文整理汇总了PHP中AJXP_Controller::passProcessDataThrough方法的典型用法代码示例。如果您正苦于以下问题:PHP AJXP_Controller::passProcessDataThrough方法的具体用法?PHP AJXP_Controller::passProcessDataThrough怎么用?PHP AJXP_Controller::passProcessDataThrough使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AJXP_Controller
的用法示例。
在下文中一共展示了AJXP_Controller::passProcessDataThrough方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: switchAction
public function switchAction($action, $httpVars, $postProcessData)
{
if (!isset($this->actions[$action])) {
return false;
}
$repository = ConfService::getRepository();
if (!$repository->detectStreamWrapper(false)) {
return false;
}
$plugin = AJXP_PluginsService::findPlugin("access", $repository->getAccessType());
$streamData = $plugin->detectStreamWrapper(true);
$destStreamURL = $streamData["protocol"] . "://" . $repository->getId() . "/";
if ($action == "audio_proxy") {
$file = AJXP_Utils::decodeSecureMagic(base64_decode($httpVars["file"]));
$cType = "audio/" . array_pop(explode(".", $file));
$localName = basename($file);
header("Content-Type: " . $cType . "; name=\"" . $localName . "\"");
header("Content-Length: " . filesize($destStreamURL . $file));
$stream = fopen("php://output", "a");
call_user_func(array($streamData["classname"], "copyFileInStream"), $destStreamURL . $file, $stream);
fflush($stream);
fclose($stream);
$node = new AJXP_Node($destStreamURL . $file);
AJXP_Controller::applyHook("node.read", array($node));
//exit(1);
} else {
if ($action == "ls") {
if (!isset($httpVars["playlist"])) {
// This should not happen anyway, because of the applyCondition.
AJXP_Controller::passProcessDataThrough($postProcessData);
return;
}
// We transform the XML into XSPF
$xmlString = $postProcessData["ob_output"];
$xmlDoc = new DOMDocument();
$xmlDoc->loadXML($xmlString);
$xElement = $xmlDoc->documentElement;
header("Content-Type:application/xspf+xml;charset=UTF-8");
print '<?xml version="1.0" encoding="UTF-8"?>';
print '<playlist version="1" xmlns="http://xspf.org/ns/0/">';
print "<trackList>";
foreach ($xElement->childNodes as $child) {
$isFile = $child->getAttribute("is_file") == "true";
$label = $child->getAttribute("text");
$ar = explode(".", $label);
$ext = strtolower(end($ar));
if (!$isFile || $ext != "mp3") {
continue;
}
print "<track><location>" . AJXP_SERVER_ACCESS . "?secure_token=" . AuthService::getSecureToken() . "&get_action=audio_proxy&file=" . base64_encode($child->getAttribute("filename")) . "</location><title>" . $label . "</title></track>";
}
print "</trackList>";
AJXP_XMLWriter::close("playlist");
}
}
}
示例2: switchAction
public function switchAction($action, $httpVars, $postProcessData)
{
$repository = ConfService::getRepository();
if (!$repository->detectStreamWrapper(false)) {
return false;
}
if ($action == "audio_proxy") {
$selection = new UserSelection($repository, $httpVars);
$destStreamURL = $selection->currentBaseUrl();
$node = new AJXP_Node($destStreamURL . "/" . $selection->getUniqueFile());
// Backward compat
// May be a backward compatibility problem, try to base64decode the filepath
if (!file_exists($node->getUrl()) && strpos($httpVars["file"], "base64encoded:") === false) {
$file = AJXP_Utils::decodeSecureMagic(base64_decode($httpVars["file"]));
if (!file_exists($destStreamURL . $file)) {
throw new Exception("Cannot find file!");
} else {
$node = new AJXP_Node($destStreamURL . $file);
}
}
if (!is_readable($node->getUrl())) {
throw new Exception("Cannot find file!");
}
$fileUrl = $node->getUrl();
$localName = basename($fileUrl);
$cType = "audio/" . array_pop(explode(".", $localName));
$size = filesize($node->getUrl());
header("Content-Type: " . $cType . "; name=\"" . $localName . "\"");
header("Content-Length: " . $size);
$stream = fopen("php://output", "a");
AJXP_MetaStreamWrapper::copyFileInStream($fileUrl, $stream);
fflush($stream);
fclose($stream);
AJXP_Controller::applyHook("node.read", array($node));
$this->logInfo('Preview', 'Read content of ' . $node->getUrl(), array("files" => $node->getUrl()));
//exit(1);
} else {
if ($action == "ls") {
if (!isset($httpVars["playlist"])) {
// This should not happen anyway, because of the applyCondition.
AJXP_Controller::passProcessDataThrough($postProcessData);
return false;
}
// We transform the XML into XSPF
$xmlString = $postProcessData["ob_output"];
$xmlDoc = new DOMDocument();
$xmlDoc->loadXML($xmlString);
$xElement = $xmlDoc->documentElement;
header("Content-Type:application/xspf+xml;charset=UTF-8");
print '<?xml version="1.0" encoding="UTF-8"?>';
print '<playlist version="1" xmlns="http://xspf.org/ns/0/">';
print "<trackList>";
foreach ($xElement->childNodes as $child) {
$isFile = $child->getAttribute("is_file") == "true";
$label = $child->getAttribute("text");
$ar = explode(".", $label);
$ext = strtolower(end($ar));
if (!$isFile || $ext != "mp3") {
continue;
}
print "<track><location>" . AJXP_SERVER_ACCESS . "?secure_token=" . AuthService::getSecureToken() . "&get_action=audio_proxy&file=" . base64_encode($child->getAttribute("filename")) . "</location><title>" . $label . "</title></track>";
}
print "</trackList>";
AJXP_XMLWriter::close("playlist");
}
}
}