mirror of
https://github.com/humhub/humhub.git
synced 2025-01-18 22:58:06 +01:00
cleanup module classes
This commit is contained in:
parent
a5362298de
commit
662e0b56b1
@ -11,6 +11,7 @@ namespace humhub\components;
|
||||
use Yii;
|
||||
use humhub\models\ModuleEnabled;
|
||||
use yii\base\Exception;
|
||||
use yii\helpers\Json;
|
||||
|
||||
/**
|
||||
* Base Class for Modules / Extensions
|
||||
@ -21,15 +22,13 @@ class Module extends \yii\base\Module
|
||||
{
|
||||
|
||||
/**
|
||||
* @var Array the loaded module.json info file
|
||||
* @var array the loaded module.json info file
|
||||
*/
|
||||
private $_moduleInfo = null;
|
||||
|
||||
/**
|
||||
* The path for module resources (images, javascripts)
|
||||
* @var string The path for module resources (images, javascripts)
|
||||
* Also module related assets like README.md and module_image.png should be placed here.
|
||||
*
|
||||
* @var type
|
||||
*/
|
||||
public $resourcesPath = 'assets';
|
||||
|
||||
@ -59,7 +58,7 @@ class Module extends \yii\base\Module
|
||||
if ($info['name']) {
|
||||
return $info['name'];
|
||||
}
|
||||
return $this->getId();
|
||||
return $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -115,8 +114,8 @@ class Module extends \yii\base\Module
|
||||
* Returns the url of an asset file and publishes all module assets if
|
||||
* the file is not published yet.
|
||||
*
|
||||
* @param type $relativePath relative file path e.g. /module_image.jpg
|
||||
* @return type
|
||||
* @param string $relativePath relative file path e.g. /module_image.jpg
|
||||
* @return string
|
||||
*/
|
||||
public function getPublishedUrl($relativePath)
|
||||
{
|
||||
@ -135,8 +134,8 @@ class Module extends \yii\base\Module
|
||||
|
||||
/**
|
||||
* Checks if a specific asset file has already been published
|
||||
* @param type $relativePath
|
||||
* @return type
|
||||
* @param string $relativePath
|
||||
* @return string
|
||||
*/
|
||||
private function isPublished($relativePath)
|
||||
{
|
||||
@ -149,7 +148,7 @@ class Module extends \yii\base\Module
|
||||
/**
|
||||
* Get Assets Url
|
||||
*
|
||||
* @return String Image Url
|
||||
* @return string Image Url
|
||||
*/
|
||||
public function getAssetsUrl()
|
||||
{
|
||||
@ -160,7 +159,7 @@ class Module extends \yii\base\Module
|
||||
|
||||
/**
|
||||
* Publishes the basePath/resourcesPath (assets) module directory if existing.
|
||||
* @return type
|
||||
* @return array
|
||||
*/
|
||||
public function publishAssets()
|
||||
{
|
||||
@ -171,7 +170,7 @@ class Module extends \yii\base\Module
|
||||
|
||||
/**
|
||||
* Determines whether or not this module has an asset directory.
|
||||
* @return type
|
||||
* @return boolean
|
||||
*/
|
||||
private function hasAssets()
|
||||
{
|
||||
@ -271,10 +270,10 @@ class Module extends \yii\base\Module
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads module.json which contains basic module informations and
|
||||
* Reads module.json which contains basic module information and
|
||||
* returns it as array
|
||||
*
|
||||
* @return Array module.json content
|
||||
* @return array module.json content
|
||||
*/
|
||||
protected function getModuleInfo()
|
||||
{
|
||||
@ -283,7 +282,7 @@ class Module extends \yii\base\Module
|
||||
}
|
||||
|
||||
$moduleJson = file_get_contents($this->getBasePath() . DIRECTORY_SEPARATOR . 'module.json');
|
||||
return \yii\helpers\Json::decode($moduleJson);
|
||||
return Json::decode($moduleJson);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -10,7 +10,6 @@ namespace humhub\modules\content\components;
|
||||
|
||||
use Yii;
|
||||
use humhub\components\Module;
|
||||
use humhub\modules\content\components\ContentContainerActiveRecord;
|
||||
|
||||
/**
|
||||
* Base Module with ContentContainer support.
|
||||
@ -48,7 +47,7 @@ class ContentContainerModule extends Module
|
||||
* Checks whether the module is enabled the given content container class.
|
||||
*
|
||||
* @param string $class the class of content container
|
||||
* @return bollean
|
||||
* @return boolean
|
||||
*/
|
||||
public function hasContentContainerType($class)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user