Login::logo()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 18

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 18
rs 9.6666
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
/*
4
 * This file is part of the WPFoundation library.
5
 *
6
 * Copyright (c) 2015-present LIN3S <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace LIN3S\WPFoundation\Configuration\Login;
13
14
/**
15
 * Base class that offers some method to customize easily WordPress login page.
16
 *
17
 * @author Jon Torrado <[email protected]>
18
 * @author Beñat Espiña <[email protected]>
19
 */
20
abstract class Login implements LoginInterface
21
{
22
    /**
23
     * Constructor.
24
     */
25
    public function __construct()
26
    {
27
        add_filter('login_errors', [$this, 'errors']);
0 ignored issues
show
Unused Code introduced by
The call to the function add_filter() seems unnecessary as the function has no side-effects.
Loading history...
28
        add_action('login_enqueue_scripts', [$this, 'logo']);
0 ignored issues
show
Unused Code introduced by
The call to the function add_action() seems unnecessary as the function has no side-effects.
Loading history...
29
        add_filter('login_message', [$this, 'message']);
0 ignored issues
show
Unused Code introduced by
The call to the function add_filter() seems unnecessary as the function has no side-effects.
Loading history...
30
        add_filter('login_headertitle', [$this, 'title']);
0 ignored issues
show
Unused Code introduced by
The call to the function add_filter() seems unnecessary as the function has no side-effects.
Loading history...
31
        add_filter('login_headerurl', [$this, 'url']);
0 ignored issues
show
Unused Code introduced by
The call to the function add_filter() seems unnecessary as the function has no side-effects.
Loading history...
32
    }
33
34
    /**
35
     * {@inheritdoc}
36
     */
37
    public function errors()
38
    {
39
    }
40
41
    /**
42
     * {@inheritdoc}
43
     */
44
    public function logo()
45
    {
46
        $logoPath = $this->logoPath();
47
48
        echo <<<EOL
49
<style type="text/css">
50
    #login h1 a, .login h1 a {
51
        background-image: url($logoPath);
52
        background-position: center;
53
        margin: 0 auto;
54
        width: 100px;
55
    };
56
    #loginform {
57
        margin-top: 0;
58
    }
59
</style>
60
EOL;
61
    }
62
63
    /**
64
     * {@inheritdoc}
65
     */
66
    public function message()
67
    {
68
    }
69
70
    /**
71
     * {@inheritdoc}
72
     */
73
    public function title()
74
    {
75
        return get_bloginfo();
76
    }
77
78
    /**
79
     * {@inheritdoc}
80
     */
81
    public function url()
82
    {
83
        return home_url();
84
    }
85
}
86