-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdisplay_errors.php
More file actions
63 lines (53 loc) · 1.62 KB
/
display_errors.php
File metadata and controls
63 lines (53 loc) · 1.62 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
/**
* Plugin display_errors
*
* @package PLX
* @version 1.1
* @date 09/11/23
* @author gc-nomade
**/
class display_errors extends plxPlugin {
private $active; // etat actif/non actif
public function __construct($default_lang) {
# appel du constructeur de la classe plxPlugin (obligatoire)
parent::__construct($default_lang);
# limite l'acces a l'ecran de configuration du plugin
$this->setConfigProfil(PROFIL_ADMIN);
$this->active=$this->getParam("active");
# Declaration d'un hook (existant ou nouveau)
$this->addHook('AdminPrepend','AdminPrepend');
$this->addHook('Index','Index');
$this->addHook('displayErrors','displayErrors');
}
public function OnDeactivate() {
# code à executer à la désactivation du plugin
$this->setParam('active','0','numeric');
$this->saveParams();
}
# Affichage backend
public function AdminPrepend(){
$this->displayErrors();
if($this->getParam('active') == '0') $this->aInfos['title'] = $this->getLang('L_NO').$this->getLang('L_ACTIVE').$this->aInfos['title'];
}
# Affichage frontend
public function Index(){
$this->displayErrors();
}
# tente de mettre à jour la configuration PHP
public function displayErrors(){
if($this->getParam('active') == '1') {
try {
ini_set('display_errors',1);
ini_set('display_startup_errors',1);
error_reporting(E_ALL);
}
catch (Exception $e) {
echo $e->getMessage();
$this->setParam('active','0',numeric);
$this->saveParams();
echo 'Plugin turned OFF ! Plugin ETEINT !';
}
}
}
}