-
Notifications
You must be signed in to change notification settings - Fork 453
/
excluded.php
69 lines (58 loc) · 2.15 KB
/
excluded.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
<?php
namespace Concrete\Controller\SinglePage\Dashboard\System\Seo;
use Concrete\Core\Page\Controller\DashboardPageController;
use Config;
use Loader;
use URLify;
class Excluded extends DashboardPageController
{
public function save()
{
$token = $this->app['token'];
$config = $this->app['config'];
$security = $this->app['helper/security'];
if ($token->validate('excluded_words_save')) {
$words = $security->sanitizeString($this->post('SEO_EXCLUDE_WORDS'));
$config->save('concrete.seo.exclude_words', $words);
$this->redirect('/dashboard/system/seo/excluded', 'saved');
} else {
$this->error->add('Invalid token.');
$this->view();
}
}
public function reset()
{
$this->app['config']->save("concrete.seo.exclude_words", implode(', ', URLify::$remove_list));
$this->redirect('/dashboard/system/seo/excluded', 'reset_complete');
}
public function view($message = false)
{
$this->set('app', $this->app);
$config = $this->app['config'];
if ($message) {
switch ($message) {
case 'reset_complete':
$this->set('message', t('Reserved words reset.'));
break;
case 'saved':
$this->set('success', t('Reserved words updated.'));
break;
}
}
$this->set('SEO_EXCLUDE_WORDS_ORIGINAL_ARRAY', Urlify::$remove_list);
$excludeSeoWords = $config->get('concrete.seo.exclude_words');
if (is_string($excludeSeoWords)) {
if (strlen($excludeSeoWords)) {
$remove_list = explode(',', $excludeSeoWords);
$remove_list = array_map('trim', $remove_list);
$remove_list = array_filter($remove_list, 'strlen');
} else {
$remove_list = array();
}
} else {
$remove_list = Urlify::$remove_list;
}
$this->set('SEO_EXCLUDE_WORDS_ARRAY', $remove_list);
$this->set('SEO_EXCLUDE_WORDS', Config::get('concrete.seo.exclude_words'));
}
}