ConfigSecurity   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 35
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A activate() 0 3 1
A deactivate() 0 3 1
1
<?php
2
3
/*
4
 * Copyright (c) 2017 Salah Alkhwlani <[email protected]>
5
 *
6
 * For the full copyright and license information, please view
7
 * the LICENSE file that was distributed with this source code.
8
 */
9
10
namespace Yemenifree\WpSecurity\Modules;
11
12
use Yemenifree\WpSecurity\Interfaces\Activable;
13
use Yemenifree\WpSecurity\Traits\HasEditFileMode;
14
15
class ConfigSecurity implements Activable
16
{
17
    use HasEditFileMode;
18
19
    protected $content = '
20
// ADD vai wp-security plugin
21
// Disallow editing of PHP files - plugins & theme files - from dashboard.
22
define(\'DISALLOW_FILE_EDIT\', true);
23
//define(\'DISALLOW_FILE_MODS\', true);
24
define( \'DISALLOW_UNFILTERED_HTML\', true );
25
// ADD vai wp-security plugin
26
';
27
28
    /**
29
     * ConfigSecurity constructor.
30
     */
31
    public function __construct()
32
    {
33
        $this->setPath(ABSPATH)->setFilename('wp-config.php')->setStartPointForPatch('<?php')->setContentPatch($this->content);
0 ignored issues
show
Bug introduced by
The constant Yemenifree\WpSecurity\Modules\ABSPATH was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
34
    }
35
36
    /**
37
     * {@inheritdoc}
38
     */
39
    public function activate()
40
    {
41
        $this->addPatchContentToFile();
42
    }
43
44
    /**
45
     * {@inheritdoc}
46
     */
47
    public function deactivate()
48
    {
49
        $this->removePatchContentFromFile();
50
    }
51
}
52