本文整理汇总了PHP中eZSys::createShellArgument方法的典型用法代码示例。如果您正苦于以下问题:PHP eZSys::createShellArgument方法的具体用法?PHP eZSys::createShellArgument怎么用?PHP eZSys::createShellArgument使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZSys
的用法示例。
在下文中一共展示了eZSys::createShellArgument方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: convert
function convert($manager, $sourceMimeData, &$destinationMimeData, $filters = false)
{
$argumentList = array();
$executable = $this->Executable;
if (eZSys::osType() == 'win32' and $this->ExecutableWin32) {
$executable = $this->ExecutableWin32;
} else {
if (eZSys::osType() == 'mac' and $this->ExecutableMac) {
$executable = $this->ExecutableMac;
} else {
if (eZSys::osType() == 'unix' and $this->ExecutableUnix) {
$executable = $this->ExecutableUnix;
}
}
}
if ($this->Path) {
$executable = $this->Path . eZSys::fileSeparator() . $executable;
}
if (eZSys::osType() == 'win32') {
$executable = "\"{$executable}\"";
}
$argumentList[] = $executable;
if ($this->PreParameters) {
$argumentList[] = $this->PreParameters;
}
$frameRangeParameters = $this->FrameRangeParameters;
if ($frameRangeParameters && isset($frameRangeParameters[$sourceMimeData['name']])) {
$sourceMimeData['url'] .= $frameRangeParameters[$sourceMimeData['name']];
}
$argumentList[] = eZSys::escapeShellArgument($sourceMimeData['url']);
$qualityParameters = $this->QualityParameters;
if ($qualityParameters and isset($qualityParameters[$destinationMimeData['name']])) {
$qualityParameter = $qualityParameters[$destinationMimeData['name']];
$outputQuality = $manager->qualityValue($destinationMimeData['name']);
if ($outputQuality) {
$qualityArgument = eZSys::createShellArgument($qualityParameter, array('%1' => $outputQuality));
$argumentList[] = $qualityArgument;
}
}
if ($filters !== false) {
foreach ($filters as $filterData) {
$argumentList[] = $this->textForFilter($filterData);
}
}
$destinationURL = $destinationMimeData['url'];
if ($this->UseTypeTag) {
$destinationURL = $this->tagForMIMEType($destinationMimeData) . $this->UseTypeTag . $destinationURL;
}
$argumentList[] = eZSys::escapeShellArgument($destinationURL);
if ($this->PostParameters) {
$argumentList[] = $this->PostParameters;
}
$systemString = implode(' ', $argumentList);
system($systemString, $returnCode);
if ($returnCode == 0) {
if (!file_exists($destinationMimeData['url'])) {
eZDebug::writeError('Unknown destination file: ' . $destinationMimeData['url'] . " when executing '{$systemString}'", 'eZImageShellHandler(' . $this->HandlerName . ')');
return false;
}
$this->changeFilePermissions($destinationMimeData['url']);
return true;
} else {
eZDebug::writeWarning("Failed executing: {$systemString}, Error code: {$returnCode}", __METHOD__);
return false;
}
}
示例2: convertFilterToText
static function convertFilterToText($filterDefinition, $filterData)
{
$replaceList = array();
if ($filterData['data']) {
$counter = 1;
foreach ($filterData['data'] as $data) {
$replaceList['%' . $counter] = $data;
++$counter;
}
}
$argumentText = $filterDefinition['text'];
$text = eZSys::createShellArgument($argumentText, $replaceList);
return $text;
}
示例3: convert
function convert($manager, $sourceMimeData, &$destinationMimeData, $filters = false)
{
$argumentList = array();
$executable = $this->Executable;
if (eZSys::osType() == 'win32' and $this->ExecutableWin32) {
$executable = $this->ExecutableWin32;
} else {
if (eZSys::osType() == 'mac' and $this->ExecutableMac) {
$executable = $this->ExecutableMac;
} else {
if (eZSys::osType() == 'unix' and $this->ExecutableUnix) {
$executable = $this->ExecutableUnix;
}
}
}
if ($this->Path) {
$executable = $this->Path . eZSys::fileSeparator() . $executable;
}
if (eZSys::osType() == 'win32') {
$executable = "\"{$executable}\"";
}
$argumentList[] = $executable;
if ($this->PreParameters) {
$argumentList[] = $this->PreParameters;
}
$frameRangeParameters = $this->FrameRangeParameters;
if ($frameRangeParameters && isset($frameRangeParameters[$sourceMimeData['name']])) {
$sourceMimeData['url'] .= $frameRangeParameters[$sourceMimeData['name']];
}
// Issue EZP-21357:
// ImageMagick has it's own meta-characters support, hence:
// $ convert 'File*.jpg'' ...
// Still expand File*.jpg as the shell would do, however, this is only true for the file's basename part and not
// for the whole path.
$argumentList[] = eZSys::escapeShellArgument($sourceMimeData['dirpath'] . DIRECTORY_SEPARATOR . addcslashes($sourceMimeData['filename'], '~*?[]{}<>'));
$qualityParameters = $this->QualityParameters;
if ($qualityParameters and isset($qualityParameters[$destinationMimeData['name']])) {
$qualityParameter = $qualityParameters[$destinationMimeData['name']];
$outputQuality = $manager->qualityValue($destinationMimeData['name']);
if ($outputQuality) {
$qualityArgument = eZSys::createShellArgument($qualityParameter, array('%1' => $outputQuality));
$argumentList[] = $qualityArgument;
}
}
if ($filters !== false) {
foreach ($filters as $filterData) {
$argumentList[] = $this->textForFilter($filterData);
}
}
$destinationURL = $destinationMimeData['url'];
if ($this->UseTypeTag) {
$destinationURL = $this->tagForMIMEType($destinationMimeData) . $this->UseTypeTag . $destinationURL;
}
$argumentList[] = eZSys::escapeShellArgument($destinationURL);
if ($this->PostParameters) {
$argumentList[] = $this->PostParameters;
}
$systemString = implode(' ', $argumentList);
system($systemString, $returnCode);
if ($returnCode == 0) {
if (!file_exists($destinationMimeData['url'])) {
eZDebug::writeError('Unknown destination file: ' . $destinationMimeData['url'] . " when executing '{$systemString}'", 'eZImageShellHandler(' . $this->HandlerName . ')');
return false;
}
$this->changeFilePermissions($destinationMimeData['url']);
return true;
} else {
eZDebug::writeWarning("Failed executing: {$systemString}, Error code: {$returnCode}", __METHOD__);
return false;
}
}