-
Notifications
You must be signed in to change notification settings - Fork 0
/
classModuleFD.php
executable file
·74 lines (62 loc) · 1.73 KB
/
classModuleFD.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<?php
define('ACTIVE_MODULE_FD', 1);
class ModuleFD extends Module {
public $hooks = array();
public function addHooks( $hooks , $register = true){
$r = true;
foreach ($hooks as $hook) {
if( ! is_array($hook) ){
$hook = array($hook,0);
}
if($register){
$r = $r && $this->registerHook($hook[0]);
if( $hook[1] !== 0){
$id_hook = Hook::getIdByName($hook[0]);
$this->updatePosition($id_hook, 0, $hook[1]);
}
}
else{
$r = $r && $this->unregisterHook($hook[0]);
}
}
return $r;
}
public function validateData($data) {
return (!$data ) || empty($data) || !Validate::isGenericName($data);
}
public function validateDataArray($dataArray){
return true;
$result = true;
foreach ($dataArray as $data) {
$result = $result && $this->validateData($data);
}
return $result;
}
public function getLangPrefix($id = null){
global $cookie;
if(!$id){
$id = $cookie->id_lang;
}
$langs = Language::getLanguages();
$prefix = array();
foreach ($langs as $lang) {
$prefix[$lang['id_lang']] = $lang['iso_code'];
}
return $prefix[$id];
}
protected function getModuleConfigurationPageLink(){
$parsedUrl = parse_url($this->context->link->getAdminLink('AdminModules', false));
$urlParams = http_build_query([
'configure' => $this->name,
'tab_module' => $this->tab,
'module_name' => $this->name,
]);
if (!empty($parsedUrl['query'])) {
$parsedUrl['query'] .= "&$urlParams";
}
else{
$parsedUrl['query'] = $urlParams;
}
return http_build_url($parsedUrl);
}
}