Completed
Pull Request — master (#14)
by Beñat
07:49
created

Theme::acf()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 10
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
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\Theme;
13
14
/**
15
 * @author Beñat Espiña <[email protected]>
16
 */
17
abstract class Theme implements ThemeInterface
18
{
19
    public function __construct()
20
    {
21
        $this->classes();
22
        $this->xmlrpc();
23
24
        add_action('admin_head', [$this, 'adminHead']);
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...
25
26
        add_theme_support('post-thumbnails');
0 ignored issues
show
Unused Code introduced by
The call to the function add_theme_support() seems unnecessary as the function has no side-effects.
Loading history...
27
28
        add_filter('theme_page_templates', [$this, 'templates']);
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...
29
        add_filter('timber_context', [$this, 'context']);
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
    }
31
32
    public function context(array $context) : array
33
    {
34
        return $context;
35
    }
36
37
    private function xmlrpc() : void
38
    {
39
        $xmlrpc = !defined('XMLRPC_ENABLED') || XMLRPC_ENABLED === true
40
            ? '__return_true'
41
            : '__return_false';
42
43
        add_filter('xmlrpc_enabled', $xmlrpc);
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...
44
    }
45
46
    protected function adminHead() : void
47
    {
48
        $this->removeOrderFromPostAttributesBox();
49
    }
50
51
    public function removeOrderFromPostAttributesBox() : void
52
    {
53
        echo '<style>label[for="menu_order"], input[name="menu_order"] {display:none;}</style>';
54
    }
55
}
56