Completed
Push — master ( a848da...37f5b2 )
by Henry
05:28
created

VisualEditor::install()   A

Complexity

Conditions 4
Paths 4

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 10
c 0
b 0
f 0
cc 4
nc 4
nop 0
1
<?php
2
namespace Redaxscript\Modules\VisualEditor;
3
4
use Redaxscript\Head;
5
use Redaxscript\Module;
6
use Redaxscript\Modules;
7
8
/**
9
 * publish content with perfect style
10
 *
11
 * @since 4.3.0
12
 *
13
 * @package Redaxscript
14
 * @category Modules
15
 * @author Henry Ruhs
16
 */
17
18
class VisualEditor extends Module\Module
19
{
20
	/**
21
	 * array of the module
22
	 *
23
	 * @var array
24
	 */
25
26
	protected static $_moduleArray =
27
	[
28
		'name' => 'Visual Editor',
29
		'alias' => 'VisualEditor',
30
		'author' => 'Redaxmedia',
31
		'description' => 'Publish content with perfect style',
32
		'version' => '4.3.0'
33
	];
34
35
	/**
36
	 * renderStart
37
	 *
38
	 * @since 4.3.0
39
	 */
40
41
	public function renderStart() : void
42
	{
43
		/* link */
44
45
		$link = Head\Link::getInstance();
46
		$link
47
			->init()
48
			->appendFile('modules/VisualEditor/dist/styles/visual-editor.min.css');
49
50
		/* script */
51
52
		$script = Head\Script::getInstance();
53
		$script
54
			->init('foot')
55
			->appendFile(
56
			[
57
				'modules/VisualEditor/assets/scripts/init.js',
58
				'modules/VisualEditor/dist/scripts/visual-editor.min.js'
59
			]);
60
	}
61
62
	/**
63
	 * install the module
64
	 *
65
	 * @since 4.3.0
66
	 *
67
	 * @return bool
68
	 */
69
70
	public function install() : bool
71
	{
72
		$codeEditor = new Modules\CodeEditor\CodeEditor($this->_registry, $this->_request, $this->_language, $this->_config);
73
		$imageUpload = new Modules\ImageUpload\ImageUpload($this->_registry, $this->_request, $this->_language, $this->_config);
74
		$dialog = new Modules\Dialog\Dialog($this->_registry, $this->_request, $this->_language, $this->_config);
75
		return $codeEditor->uninstall() && $imageUpload->reinstall() && $dialog->reinstall() && parent::install();
76
	}
77
}
78