Completed
Branch master (fd853c)
by
unknown
04:08 queued 02:12
created

AdminPageFramework_View_Page   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 71
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
dl 0
loc 71
rs 10
c 0
b 0
f 0
wmc 6
lcom 1
cbo 4

5 Methods

Rating   Name   Duplication   Size   Complexity  
A _replyToSetAdminPageTitleForTab() 0 10 2
A _replyToEnablePageMetaBoxes() 0 3 1
A _replyToEnqueuePageAssets() 0 3 1
A _replyToRenderPage() 0 7 1
A _renderPage() 0 4 1
1
<?php
2
/**
3
 * Admin Page Framework
4
 *
5
 * http://admin-page-framework.michaeluno.jp/
6
 * Copyright (c) 2013-2020, Michael Uno; Licensed MIT
7
 *
8
 */
9
10
/**
11
 * Provides methods to manipulate menu items.
12
 *
13
 * @abstract
14
 * @since           3.3.1       Moved most methods from `AdminPageFramework_Page`.
15
 * @since           3.6.3       Changed the name from `AdminPageFramework_Page_View`.
16
 * @extends         AdminPageFramework_Model_Page
17
 * @package         AdminPageFramework/Factory/AdminPage/View
18
 * @internal
19
 */
20
abstract class AdminPageFramework_View_Page extends AdminPageFramework_Model_Page {
21
22
    /**
23
     * Called only when the tab is loaded.
24
     * @param string $sAdminTitle
25
     * @param string $sTitle
26
     * @callback add_filter admin_title
27
     * @return string
28
     * @since   3.8.23
29
     */
30
    public function _replyToSetAdminPageTitleForTab( $sAdminTitle, $sTitle ) {
0 ignored issues
show
Unused Code introduced by
The parameter $sTitle is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
31
        $_sTabTitle = $this->oUtil->getElement(
32
                $this->oProp->aInPageTabs,
33
                array( $this->oProp->getCurrentPageSlug(), $this->oProp->getCurrentTabSlug(), 'title' )
34
            );
35
        if ( ! $_sTabTitle ) {
36
            return $sAdminTitle;
37
        }
38
        return $_sTabTitle . ' &lsaquo; ' . $sAdminTitle;
39
    }
40
41
    /**
42
     * Load resources of page meta boxes.
43
     * @callback    action      load_after_{page slug}
44
     * @since       3.7.10
45
     */
46
    public function _replyToEnablePageMetaBoxes() {
47
        new AdminPageFramework_View__PageMetaboxEnabler( $this );
48
    }
49
50
    /**
51
     * Enqueues assets set with the `style` and `script` arguments.
52
     *
53
     * @callback    action      load_after_{page slug}
54
     * @since       3.6.3
55
     * @internal
56
     * @return      void
57
     */
58
    public function _replyToEnqueuePageAssets() {
59
        new AdminPageFramework_View__Resource( $this );
60
    }
61
62
    /**
63
     * @since       3.7.10
64
     * @callback    function        add_submenu_page
65
     * @return      void
66
     */
67
    public function _replyToRenderPage() {
68
        $_sPageSlug = $this->oProp->getCurrentPageSlug();
69
        $this->_renderPage(
70
            $_sPageSlug,
71
            $this->oProp->getCurrentTabSlug( $_sPageSlug )
72
        );
73
    }
74
75
    /**
76
     * Renders the admin page.
77
     *
78
     * @remark      This is not intended for the users to use.
79
     * @since       2.0.0
80
     * @since       3.3.1       Moved from `AdminPageFramework_Page`.
81
     * @access      protected
82
     * @return      void
83
     * @internal
84
     */
85
    protected function _renderPage( $sPageSlug, $sTabSlug=null ) {
86
        $_oPageRenderer = new AdminPageFramework_View__PageRenderer( $this, $sPageSlug, $sTabSlug );
87
        $_oPageRenderer->render();
88
    }
89
90
}
91