This repository has been archived by the owner on Jan 1, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathimp_blocktos.php
110 lines (88 loc) · 2.88 KB
/
imp_blocktos.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<?php
/**
@author: Krystian Podemski, impSolutions.pl
@release: 07.2013
@version: 1.0.0
@desc: Do not let index your Terms of Service by Google
**/
if (!defined('_PS_VERSION_'))
exit;
class imp_blocktos extends Module
{
public function __construct()
{
$this->name = 'imp_blocktos';
if (version_compare(_PS_VERSION_, '1.4', '>'))
$this->tab = 'front_office_features';
else
$this->tab = 'impSolutions';
$this->version = '1.0.0';
if (version_compare(_PS_VERSION_, '1.4', '>'))
$this->author = 'impSolutions.pl';
parent::__construct();
$this->displayName = $this->l('No Index Terms of Service');
$this->description = $this->l('Do not let index your Terms of Service by Google');
}
public function install()
{
if (!parent::install()
OR !$this->registerHook('header')
OR !Configuration::updateValue('BLOCKTOS_CMS', '1')
)
return false;
return true;
}
public function uninstall()
{
if (!Configuration::deleteByName('BLOCKTOS_CMS')
OR !parent::uninstall())
return false;
return true;
}
public function hookHeader()
{
global $smarty;
$cms = Tools::getValue('id_cms', 0);
if($cms && $cms > 0)
{
if($cms == Configuration::get('BLOCKTOS_CMS'))
{
$smarty->assign('nobots', true);
}
}
}
public function getContent()
{
$this->_html = '';
if(Tools::isSubmit('submitSettings'))
{
foreach($_POST as $key => $value)
{
Configuration::updateValue($key,$value);
}
$this->_html .= $this->displayConfirmation($this->l('Success'));
}
$this->_html .= '<h2>'.$this->displayName.'</h2>';
$this->_html .= '<form action="'.Tools::safeOutput($_SERVER['REQUEST_URI']).'" method="post">';
$this->_html .= '<fieldset>';
$this->_html .= '<legend><img src="'.$this->_path.'logo.gif" alt="" title="" />'.$this->l('Settings').'</legend>';
#page
$cms_pages = CMS::listCms();
$this->_html .= '<label>'.$this->l('CMS page that you want to block').'</label><div class="margin-form">';
$this->_html .= '<select name="BLOCKTOS_CMS">';
foreach($cms_pages as $page):
$selected = Configuration::get('BLOCKTOS_CMS') == $page['id_cms'] ? 'selected="selected"' : '';
$this->_html .= '<option value="'.$page['id_cms'].'" '.$selected.'>'.$page['meta_title'].'</option>';
endforeach;
$this->_html .= '</select></div>';
$this->_html .= '<div class="margin-form">';
$this->_html .= '<input type="submit" value="'.$this->l('Save').'" name="submitSettings" class="button">';
$this->_html .= '</div>';
$this->_html .= '</fieldset>';
$this->_html .= '</form>';
$this->_html .= '<div style="width: 351px; margin: 20px auto">';
$this->_html .= '<a href="http://www.facebook.com/impSolutionsPL" title="" target="_blank"><img alt="" src="'.$this->_path.'impsolutions.png" /></a>';
$this->_html .= '</div>';
return $this->_html;
}
}