|
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 ) { |
|
|
|
|
|
|
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 . ' ‹ ' . $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
|
|
|
|
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.