Completed
Push — master ( 2d0401...d6967e )
by Henry
15:58 queued 06:03
created

CodeEditor::renderStart()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 24

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 24
rs 9.536
c 0
b 0
f 0
cc 2
nc 2
nop 0
1
<?php
2
namespace Redaxscript\Modules\CodeEditor;
3
4
use Redaxscript\Head;
5
use Redaxscript\Module;
6
7
/**
8
 * publish content with perfect code
9
 *
10
 * @since 2.6.0
11
 *
12
 * @package Redaxscript
13
 * @category Modules
14
 * @author Henry Ruhs
15
 */
16
17
class CodeEditor extends Module\Module
18
{
19
	/**
20
	 * array of the module
21
	 *
22
	 * @var array
23
	 */
24
25
	protected static $_moduleArray =
26
	[
27
		'name' => 'Code Editor',
28
		'alias' => 'CodeEditor',
29
		'author' => 'Redaxmedia',
30
		'description' => 'Publish content with perfect code',
31
		'version' => '4.3.0'
32
	];
33
34
	/**
35
	 * renderStart
36
	 *
37
	 * @since 3.0.0
38
	 */
39
40
	public function renderStart() : void
41
	{
42
		if ($this->_registry->get('loggedIn') === $this->_registry->get('token'))
43
		{
44
			/* link */
45
46
			$link = Head\Link::getInstance();
47
			$link
48
				->init()
49
				->appendFile('modules/CodeEditor/dist/styles/ace.min.css');
50
51
			/* script */
52
53
			$script = Head\Script::getInstance();
54
			$script
55
				->init('foot')
56
				->appendFile(
57
				[
58
					'https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.11/ace.js',
59
					'modules/CodeEditor/assets/scripts/init.js',
60
					'modules/CodeEditor/dist/scripts/ace.min.js'
61
				]);
62
		}
63
	}
64
}
65