mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-13 21:21:27 +00:00
add method getFromWithTo()
This commit is contained in:
parent
762ccbb373
commit
a067cc9949
|
@ -38,23 +38,39 @@ class SeedDMS_ConversionMgr {
|
||||||
*/
|
*/
|
||||||
protected $success;
|
protected $success;
|
||||||
|
|
||||||
public function __construct() {
|
public function __construct() { /* {{{ */
|
||||||
$this->services = array();
|
$this->services = array();
|
||||||
$this->success = true;
|
$this->success = true;
|
||||||
}
|
} /* }}} */
|
||||||
|
|
||||||
public function addService($service) {
|
public function addService($service) { /* {{{ */
|
||||||
$service->setConversionMgr($this);
|
$service->setConversionMgr($this);
|
||||||
$this->services[$service->from][$service->to][] = $service;
|
$this->services[$service->from][$service->to][] = $service;
|
||||||
return $service;
|
return $service;
|
||||||
}
|
} /* }}} */
|
||||||
|
|
||||||
public function hasService($from, $to) {
|
public function hasService($from, $to) { /* {{{ */
|
||||||
if(!empty($this->services[$from][$to]))
|
if(!empty($this->services[$from][$to]))
|
||||||
return true;
|
return true;
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
}
|
} /* }}} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the list of mimetypes which can be converted
|
||||||
|
* into the given mimetype
|
||||||
|
*
|
||||||
|
* @param string $askto mimetype to be converted into
|
||||||
|
* @return array list of from mimetypes
|
||||||
|
*/
|
||||||
|
public function getFromWithTo($askto) { /* {{{ */
|
||||||
|
$fromret = [];
|
||||||
|
foreach($this->services as $from=>$toservices)
|
||||||
|
foreach($toservices as $to=>$service)
|
||||||
|
if($to == $askto)
|
||||||
|
$fromret[] = $from;
|
||||||
|
return $fromret;
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the service that would be tried first for converting
|
* Return the service that would be tried first for converting
|
||||||
|
|
Loading…
Reference in New Issue
Block a user