|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Loads the demo components. |
|
4
|
|
|
* |
|
5
|
|
|
* @package Admin Page Framework Loader |
|
6
|
|
|
* @copyright Copyright (c) 2014, Michael Uno |
|
7
|
|
|
* @author Michael Uno |
|
8
|
|
|
* @authorurl http://michaeluno.jp |
|
9
|
|
|
* @since 3.5.0 |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
/** |
|
13
|
|
|
* |
|
14
|
|
|
* |
|
15
|
|
|
* @action do admin_page_framework_loader_action_before_loading_demo |
|
16
|
|
|
* @action do admin_page_framework_loader_action_after_loading_demo |
|
17
|
|
|
*/ |
|
18
|
|
|
class AdminPageFrameworkLoader_Demo { |
|
|
|
|
|
|
19
|
|
|
|
|
20
|
|
|
public function __construct() { |
|
21
|
|
|
|
|
22
|
|
|
if ( ! $this->_shouldLoadDemo() ) { |
|
23
|
|
|
return; |
|
24
|
|
|
} |
|
25
|
|
|
|
|
26
|
|
|
// Backward compatibility. |
|
27
|
|
|
define( 'APFDEMO_FILE', AdminPageFrameworkLoader_Registry::$sFilePath ); |
|
28
|
|
|
define( 'APFDEMO_DIRNAME', AdminPageFrameworkLoader_Registry::$sDirPath ); |
|
29
|
|
|
|
|
30
|
|
|
do_action( 'admin_page_framework_loader_action_before_loading_demo' ); |
|
31
|
|
|
|
|
32
|
|
|
// Include example components. |
|
33
|
|
|
include( AdminPageFrameworkLoader_Registry::$sDirPath . '/example/admin-page-framework-demo-bootstrap.php' ); |
|
34
|
|
|
|
|
35
|
|
|
do_action( 'admin_page_framework_loader_action_after_loading_demo' ); |
|
36
|
|
|
|
|
37
|
|
|
} |
|
38
|
|
|
/** |
|
39
|
|
|
* @since 3.7.4 |
|
40
|
|
|
* @return boolean |
|
41
|
|
|
*/ |
|
42
|
|
|
private function _shouldLoadDemo() { |
|
43
|
|
|
|
|
44
|
|
|
if ( AdminPageFrameworkLoader_Utility::isSilentMode() ) { |
|
45
|
|
|
return false; |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
// Check if the demo is enabled. |
|
49
|
|
|
$_oOption = AdminPageFrameworkLoader_Option::getInstance(); |
|
50
|
|
|
if ( ! $_oOption->get( 'enable_demo' ) ) { |
|
51
|
|
|
$this->_setPointerToolTips(); |
|
52
|
|
|
return false; |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
return true; |
|
56
|
|
|
|
|
57
|
|
|
} |
|
58
|
|
|
|
|
59
|
|
|
private function _setPointerToolTips() { |
|
60
|
|
|
|
|
61
|
|
|
|
|
62
|
|
|
new AdminPageFramework_PointerToolTip( |
|
63
|
|
|
array( |
|
64
|
|
|
// screen ids |
|
65
|
|
|
'plugins', |
|
66
|
|
|
|
|
67
|
|
|
// page slugs below |
|
68
|
|
|
'apfl_addons', |
|
69
|
|
|
), |
|
70
|
|
|
'apf_demo_pointer_tool_box_activate_demo', // unique id for the pointer tool box |
|
71
|
|
|
array( // pointer data |
|
72
|
|
|
'target' => array( |
|
73
|
|
|
'#activate-demo-action-link', |
|
74
|
|
|
'#button-activate-demo', // multiple targets can be set with an array |
|
75
|
|
|
), |
|
76
|
|
|
'options' => array( |
|
77
|
|
|
'content' => sprintf( '<h3> %1$s </h3> <p> %2$s </p>', |
|
78
|
|
|
AdminPageFrameworkLoader_Registry::NAME, |
|
79
|
|
|
__( 'Check out the functionality of Admin Page Framework by enabling the demo.','admin-page-framework-loader' ) |
|
80
|
|
|
), |
|
81
|
|
|
'position' => array( 'edge' => 'left', 'align' => 'middle' ) |
|
82
|
|
|
) |
|
83
|
|
|
) |
|
84
|
|
|
); |
|
85
|
|
|
|
|
86
|
|
|
|
|
87
|
|
|
} |
|
88
|
|
|
|
|
89
|
|
|
} |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.