-
Notifications
You must be signed in to change notification settings - Fork 0
/
controller.php
46 lines (36 loc) · 1.01 KB
/
controller.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
namespace Concrete\Package\CommonMarkdown;
use BlockType;
use Package;
class Controller extends Package
{
protected $pkgHandle = 'common_markdown';
protected $appVersionRequired = '5.7.5';
protected $pkgVersion = '1.0.3';
public function getPackageName()
{
return t('Common Markdown');
}
public function getPackageDescription()
{
return t('Markdown editor that supports the CommonMark spec.');
}
public function on_start()
{
require $this->getPackagePath() . '/vendor/autoload.php';
}
public function install()
{
if (version_compare(PHP_VERSION, '5.4', '<')) {
throw new Exception(t("You need PHP 5.4 or higher to run this add-on."));
}
$pkg = parent::install();
$this->installBlockTypes($pkg);
}
public function installBlockTypes($pkg)
{
if (!BlockType::getByHandle('common_markdown')) {
BlockType::installBlockType('common_markdown', $pkg);
}
}
}