mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-02-06 15:14:58 +00:00
add method getFromWithTo()
This commit is contained in:
parent
762ccbb373
commit
a067cc9949
|
@ -38,23 +38,39 @@ class SeedDMS_ConversionMgr {
|
|||
*/
|
||||
protected $success;
|
||||
|
||||
public function __construct() {
|
||||
public function __construct() { /* {{{ */
|
||||
$this->services = array();
|
||||
$this->success = true;
|
||||
}
|
||||
} /* }}} */
|
||||
|
||||
public function addService($service) {
|
||||
public function addService($service) { /* {{{ */
|
||||
$service->setConversionMgr($this);
|
||||
$this->services[$service->from][$service->to][] = $service;
|
||||
return $service;
|
||||
}
|
||||
} /* }}} */
|
||||
|
||||
public function hasService($from, $to) {
|
||||
public function hasService($from, $to) { /* {{{ */
|
||||
if(!empty($this->services[$from][$to]))
|
||||
return true;
|
||||
else
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue
Block a user