1 <?php
2 /**
3 * Admin Page Framework
4 *
5 * Provides plugin and theme developers with simpler means of creating option pages, custom post types, ant meta boxes.
6 *
7 * @author Michael Uno <michael@michaeluno.jp>
8 * @copyright 2013-2014 (c) Michael Uno
9 * @license MIT <http://opensource.org/licenses/MIT>
10 * @see http://wordpress.org/plugins/admin-page-framework/
11 * @see https://github.com/michaeluno/admin-page-framework
12 * @link http://en.michaeluno.jp/admin-page-framework
13 * @package AdminPageFramework
14 * @remarks To use the framework, 1. Extend the class 2. Override the setUp() method. 3. Use the hook functions.
15 * @remarks Requirements: WordPress 3.3 or above, PHP 5.2.4 or above.
16 * @remarks The documentation employs the <a href="http://en.wikipedia.org/wiki/PHPDoc">PHPDOc(DocBlock)</a> syntax.
17 * @version 3.1.4b02
18 */
19 if ( ! class_exists( 'AdminPageFramework_Registry_Base' ) ) :
20 abstract class AdminPageFramework_Registry_Base {
21
22 const Version = '3.1.4b02'; // <--- DON'T FORGET TO CHANGE THIS AS WELL!!
23 const Name = 'Admin Page Framework';
24 const Description = 'Provides plugin and theme developers with simpler means of creating option pages, custom post types, ant meta boxes.';
25 const URI = 'http://en.michaeluno.jp/admin-page-framework';
26 const Author = 'Michael Uno';
27 const AuthorURI = 'http://en.michaeluno.jp/';
28 const Copyright = 'Copyright (c) 2013-2014, Michael Uno';
29 const License = 'MIT <http://opensource.org/licenses/MIT>';
30 const Contributors = '';
31
32 }
33 endif;
34 if ( ! class_exists( 'AdminPageFramework_Registry' ) ) :
35 /**
36 * Defines the framework common information.
37 *
38 * @since 3.1.3
39 */
40 final class AdminPageFramework_Registry extends AdminPageFramework_Registry_Base {
41
42 const TextDomain = 'admin-page-framework';
43 const TextDomainPath = './language';
44
45 /**
46 * Indicates whether the framework is loaded from the minified version or not.
47 *
48 * @remark The value will be reassign by the bootstrap script.
49 */
50 static public $bIsMinifiedVersion = true;
51
52 /**
53 * Stores the autoloader class file path.
54 */
55 static public $sAutoLoaderPath;
56
57 // These properties will be defined in the setUp() method.
58 static public $sFilePath = '';
59 static public $sDirPath = '';
60 static public $sFileURI = '';
61
62 /**
63 * Sets up static properties.
64 */
65 static function setUp( $sFilePath=null ) {
66
67 self::$sFilePath = $sFilePath ? $sFilePath : __FILE__;
68 self::$sDirPath = dirname( self::$sFilePath );
69 self::$sFileURI = plugins_url( '', self::$sFilePath );
70 self::$sAutoLoaderPath = self::$sDirPath . '/utility/AdminPageFramework_RegisterClasses.php';
71 self::$bIsMinifiedVersion = ! file_exists( self::$sAutoLoaderPath );
72
73 }
74
75 }
76 endif;
77
78 if ( ! class_exists( 'AdminPageFramework_Bootstrap' ) ) :
79 /**
80 * Loads the Admin Page Framework library.
81 *
82 * @copyright 2013-2014 (c) Michael Uno
83 * @license MIT <http://opensource.org/licenses/MIT>
84 * @see http://wordpress.org/plugins/admin-page-framework/
85 * @see https://github.com/michaeluno/admin-page-framework
86 * @link http://en.michaeluno.jp/admin-page-framework
87 * @since 3.0.0
88 * @package AdminPageFramework
89 * @subpackage Utility
90 * @internal
91 */
92 final class AdminPageFramework_Bootstrap {
93
94 function __construct( $sLibraryPath ) {
95
96 // The minifier script will include this file ( but it does not include WordPress ) to use the reflection class to extract the docblock
97 if ( ! defined( 'ABSPATH' ) ) {
98 return;
99 }
100
101 // If the autoloader class exists, it means the framework has been loaded somewhere else.
102 if ( class_exists( 'AdminPageFramework_RegisterClasses' ) ) {
103 return;
104 }
105
106 // Sets up registry properties.
107 AdminPageFramework_Registry::setUp( $sLibraryPath );
108
109 // Load the classes. For the minified version, the autoloader class should not be located in the utility folder.
110 if ( ! AdminPageFramework_Registry::$bIsMinifiedVersion ) {
111 include( AdminPageFramework_Registry::$sAutoLoaderPath );
112 include( AdminPageFramework_Registry::$sDirPath . '/admin-page-framework-include-class-list.php' );
113 new AdminPageFramework_RegisterClasses(
114 isset( $aClassFiles ) ? '' : AdminPageFramework_Registry::$sDirPath, // scanning directory
115 array(), // search options
116 isset( $aClassFiles ) ? $aClassFiles : array() // default class list array
117 );
118 }
119
120 }
121
122 }
123 new AdminPageFramework_Bootstrap( __FILE__ ); // do it now
124 endif;