Version 4.7.8
This commit is contained in:
1 parent
7b7404e741
commit
fd22d99e69
688 files changed
+19814
-10890
No files matched your search
@@ -91,6 +91,12 @@ class _Follow extends \IPS\Patterns\ActiveRecord
|
||||
$name = $followed->name;
|
||||
$url = $followed->url();
|
||||
}
|
||||
else if( $this->area == 'club' AND $this->app == 'core')
|
||||
{
|
||||
$followed = \IPS\Member\Club::load( $this->rel_id );
|
||||
$name = $followed->name;
|
||||
$url = $followed->url();
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach( \IPS\Application::load( $this->app )->extensions( 'core', 'ContentRouter' ) as $key => $router )
|
||||
@@ -171,4 +177,41 @@ class _Follow extends \IPS\Patterns\ActiveRecord
|
||||
'followUrl' => (string) $url,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @var array[<string><string>] Special follow classes
|
||||
*/
|
||||
public static $specialFollowClasses = [
|
||||
'core' => [
|
||||
'member' => \IPS\Member::class,
|
||||
'club' => \IPS\Member\Club::class,
|
||||
],
|
||||
];
|
||||
|
||||
/**
|
||||
* Get the class to follow
|
||||
*
|
||||
* @param string $app Application key
|
||||
* @param string $area Area
|
||||
* @return string
|
||||
* @throws \InvalidArgumentException
|
||||
*/
|
||||
public static function getClassToFollow(string $app, string $area): string
|
||||
{
|
||||
if( isset( static::$specialFollowClasses[$app][$area] ) )
|
||||
{
|
||||
$classToFollow = static::$specialFollowClasses[$app][$area];
|
||||
}
|
||||
else
|
||||
{
|
||||
$classToFollow = 'IPS\\' . $app . '\\' . mb_ucfirst( $area );
|
||||
if( !class_exists( $classToFollow) or !array_key_exists( $app, \IPS\Application::applications() ) )
|
||||
{
|
||||
throw new \InvalidArgumentException;
|
||||
}
|
||||
}
|
||||
return $classToFollow;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user