Dotclear

source: plugins/importExport/inc/class.dc.ieModule.php @ 3874:ab8368569446

Revision 3874:ab8368569446, 2.0 KB checked in by franck <carnet.franck.paul@…>, 7 years ago (diff)

short notation for array (array() → [])

Line 
1<?php
2/**
3 * @brief importExport, a plugin for Dotclear 2
4 *
5 * @package Dotclear
6 * @subpackage Plugins
7 *
8 * @copyright Olivier Meunier & Association Dotclear
9 * @copyright GPL-2.0-only
10 */
11
12if (!defined('DC_RC_PATH')) {return;}
13
14abstract class dcIeModule
15{
16    public $type;
17    public $id;
18    public $name;
19    public $description;
20
21    protected $import_url;
22    protected $export_url;
23    protected $core;
24
25    public function __construct($core)
26    {
27        $this->core = &$core;
28        $this->setInfo();
29
30        if (!in_array($this->type, ['import', 'export'])) {
31            throw new Exception(sprintf('Unknow type for module %s', get_class($this)));
32        }
33
34        if (!$this->name) {
35            $this->name = get_class($this);
36        }
37
38        $this->id  = get_class($this);
39        $this->url = sprintf('plugin.php?p=importExport&type=%s&module=%s', $this->type, $this->id);
40    }
41
42    public function init()
43    {
44    }
45
46    abstract protected function setInfo();
47
48    final public function getURL($escape = false)
49    {
50        return $escape ? html::escapeHTML($this->url) : $this->url;
51    }
52
53    abstract public function process($do);
54
55    abstract public function gui();
56
57    protected function progressBar($percent)
58    {
59        $percent = ceil($percent);
60        if ($percent > 100) {
61            $percent = 100;
62        }
63        return '<div class="ie-progress"><div style="width:' . $percent . '%">' . $percent . ' %</div></div>';
64    }
65
66    protected function autoSubmit()
67    {
68        return form::hidden(['autosubmit'], 1);
69    }
70
71    protected function congratMessage()
72    {
73        return
74        '<h3>' . __('Congratulation!') . '</h3>' .
75        '<p class="success">' . __('Your blog has been successfully imported. Welcome on Dotclear 2!') . '</p>' .
76        '<ul><li><strong><a href="' . $this->core->decode('admin.post') . '">' . __('Why don\'t you blog this now?') . '</a></strong></li>' .
77        '<li>' . __('or') . ' <a href="' . $this->core->decode('admin.home') . '">' . __('visit your dashboard') . '</a></li></ul>';
78    }
79}
Note: See TracBrowser for help on using the repository browser.

Sites map