|
|
|
@ -122,43 +122,45 @@ class ActivityManager implements IManager { |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param array $types |
|
|
|
* @param string $filter |
|
|
|
* @param string $method |
|
|
|
* @return array |
|
|
|
*/ |
|
|
|
function filterNotificationTypes($types, $filter) { |
|
|
|
if (!$this->isFilterValid($filter)) { |
|
|
|
return $types; |
|
|
|
} |
|
|
|
|
|
|
|
function getDefaultTypes($method) { |
|
|
|
$defaultTypes = array(); |
|
|
|
foreach($this->extensions as $extension) { |
|
|
|
$c = $extension(); |
|
|
|
if ($c instanceof IExtension) { |
|
|
|
$result = $c->filterNotificationTypes($types, $filter); |
|
|
|
if (is_array($result)) { |
|
|
|
$types = $result; |
|
|
|
$types = $c->getDefaultTypes($method); |
|
|
|
if (is_array($types)) { |
|
|
|
$defaultTypes = array_merge($types, $defaultTypes); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return $types; |
|
|
|
return $defaultTypes; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param string $method |
|
|
|
* @return array |
|
|
|
* @param string $type |
|
|
|
* @return string |
|
|
|
*/ |
|
|
|
function getDefaultTypes($method) { |
|
|
|
$defaultTypes = array(); |
|
|
|
function getTypeIcon($type) { |
|
|
|
if (isset($this->typeIcons[$type])) { |
|
|
|
return $this->typeIcons[$type]; |
|
|
|
} |
|
|
|
|
|
|
|
foreach($this->extensions as $extension) { |
|
|
|
$c = $extension(); |
|
|
|
if ($c instanceof IExtension) { |
|
|
|
$types = $c->getDefaultTypes($method); |
|
|
|
if (is_array($types)) { |
|
|
|
$defaultTypes = array_merge($types, $defaultTypes); |
|
|
|
$icon = $c->getTypeIcon($type); |
|
|
|
if (is_string($icon)) { |
|
|
|
$this->typeIcons[$type] = $icon; |
|
|
|
return $icon; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return $defaultTypes; |
|
|
|
|
|
|
|
$this->typeIcons[$type] = ''; |
|
|
|
return ''; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
@ -213,30 +215,6 @@ class ActivityManager implements IManager { |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param string $type |
|
|
|
* @return string |
|
|
|
*/ |
|
|
|
function getTypeIcon($type) { |
|
|
|
if (isset($this->typeIcons[$type])) { |
|
|
|
return $this->typeIcons[$type]; |
|
|
|
} |
|
|
|
|
|
|
|
foreach($this->extensions as $extension) { |
|
|
|
$c = $extension(); |
|
|
|
if ($c instanceof IExtension) { |
|
|
|
$icon = $c->getTypeIcon($type); |
|
|
|
if (is_string($icon)) { |
|
|
|
$this->typeIcons[$type] = $icon; |
|
|
|
return $icon; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
$this->typeIcons[$type] = ''; |
|
|
|
return ''; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param array $activity |
|
|
|
* @return integer|false |
|
|
|
@ -300,6 +278,28 @@ class ActivityManager implements IManager { |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param array $types |
|
|
|
* @param string $filter |
|
|
|
* @return array |
|
|
|
*/ |
|
|
|
function filterNotificationTypes($types, $filter) { |
|
|
|
if (!$this->isFilterValid($filter)) { |
|
|
|
return $types; |
|
|
|
} |
|
|
|
|
|
|
|
foreach($this->extensions as $extension) { |
|
|
|
$c = $extension(); |
|
|
|
if ($c instanceof IExtension) { |
|
|
|
$result = $c->filterNotificationTypes($types, $filter); |
|
|
|
if (is_array($result)) { |
|
|
|
$types = $result; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return $types; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @param string $filter |
|
|
|
* @return array |
|
|
|
|