Completed
Branch dev (65e704)
by
unknown
06:13
created
admin-page-framework-loader.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -16,9 +16,9 @@  discard block
 block discarded – undo
16 16
  */
17 17
 class AdminPageFrameworkLoader_Registry_Base {
18 18
 
19
-    const VERSION        = '3.8.3b01';    // <--- DON'T FORGET TO CHANGE THIS AS WELL!!
19
+    const VERSION        = '3.8.3b01'; // <--- DON'T FORGET TO CHANGE THIS AS WELL!!
20 20
     const NAME           = 'Admin Page Framework - Loader'; // the name is not 'Admin Page Framework' because warning messages gets confusing.
21
-    const SHORTNAME      = 'Admin Page Framework';  // used for a menu title etc.
21
+    const SHORTNAME      = 'Admin Page Framework'; // used for a menu title etc.
22 22
     const DESCRIPTION    = 'Loads Admin Page Framework which facilitates WordPress plugin and theme development.';
23 23
     const URI            = 'http://admin-page-framework.michaeluno.jp/';
24 24
     const AUTHOR         = 'miunosoft (Michael Uno)';
@@ -55,14 +55,14 @@  discard block
 block discarded – undo
55 55
      * @remark      This is also accessed from `uninstall.php` so do not remove.
56 56
      * @remark      Do not exceed 8 characters as a transient name allows 45 characters or less ( 40 for site transients ) so that md5 (32 characters) can be added.
57 57
      */
58
-    const TRANSIENT_PREFIX         = 'APFL_';
58
+    const TRANSIENT_PREFIX = 'APFL_';
59 59
 
60 60
     /**
61 61
      * The hook slug used for the prefix of action and filter hook names.
62 62
      * 
63 63
      * @remark      The ending underscore is not necessary.
64 64
      */
65
-    const HOOK_SLUG                = 'admin_page_framework_loader';
65
+    const HOOK_SLUG = 'admin_page_framework_loader';
66 66
 
67 67
     /**
68 68
      * The text domain slug and its path.
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
      */
117 117
     static public $aAdminPages = array(
118 118
         // key => 'page slug'
119
-        'about'     => 'apfl_about',        // the welcome page
119
+        'about'     => 'apfl_about', // the welcome page
120 120
         'addon'     => 'apfl_addons',
121 121
         'tool'      => 'apfl_tools',
122 122
         'help'      => 'apfl_contact',
@@ -154,12 +154,12 @@  discard block
 block discarded – undo
154 154
      * @since       3.5.0
155 155
      * @return      string
156 156
      */
157
-    public static function getPluginURL( $sRelativePath='' ) {
157
+    public static function getPluginURL( $sRelativePath = '' ) {
158 158
         if ( isset( self::$_sPluginURLCache ) ) {
159
-            return self::$_sPluginURLCache . $sRelativePath;
159
+            return self::$_sPluginURLCache.$sRelativePath;
160 160
         }
161 161
         self::$_sPluginURLCache = trailingslashit( plugins_url( '', self::$sFilePath ) );
162
-        return self::$_sPluginURLCache . $sRelativePath;
162
+        return self::$_sPluginURLCache.$sRelativePath;
163 163
     }
164 164
         /**
165 165
          * @since       3.7.9
@@ -189,13 +189,13 @@  discard block
 block discarded – undo
189 189
      * @since       3.5.0
190 190
      * @return      void
191 191
      */ 
192
-    static public function setAdminNotice( $sMessage, $sClassAttribute='error' ) {
193
-        if ( ! is_admin() ) {  
192
+    static public function setAdminNotice( $sMessage, $sClassAttribute = 'error' ) {
193
+        if ( !is_admin() ) {  
194 194
             return; 
195 195
         }
196
-        self::$_aAdminNotices[] = array(
196
+        self::$_aAdminNotices[ ] = array(
197 197
             'message'           => $sMessage,
198
-            'class_attribute'   => trim( $sClassAttribute ) . ' notice is-dismissible',
198
+            'class_attribute'   => trim( $sClassAttribute ).' notice is-dismissible',
199 199
         );
200 200
         add_action( 'admin_notices', array( __CLASS__, '_replyToSetAdminNotice' ) );
201 201
     }
@@ -205,12 +205,12 @@  discard block
 block discarded – undo
205 205
          * @return      void
206 206
          */
207 207
         static public function _replyToSetAdminNotice() {
208
-            foreach( self::$_aAdminNotices as $_aAdminNotice ) {
209
-                echo "<div class='" . esc_attr( $_aAdminNotice['class_attribute'] ) . " notice is-dismissible'>"
208
+            foreach ( self::$_aAdminNotices as $_aAdminNotice ) {
209
+                echo "<div class='".esc_attr( $_aAdminNotice[ 'class_attribute' ] )." notice is-dismissible'>"
210 210
                         ."<p>"
211 211
                             . sprintf(
212
-                                '<strong>%1$s</strong>: ' . $_aAdminNotice['message'],
213
-                                self::NAME . ' ' . self::VERSION
212
+                                '<strong>%1$s</strong>: '.$_aAdminNotice[ 'message' ],
213
+                                self::NAME.' '.self::VERSION
214 214
                             )
215 215
                         . "</p>"
216 216
                     . "</div>";
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
 AdminPageFrameworkLoader_Registry::setUp( __FILE__ );
223 223
 
224 224
 // Initial checks. - Do no load if accessed directly, not exiting because the 'uninstall.php' and inclusion list generator will load this file.
225
-if ( ! defined( 'ABSPATH' ) ) {
225
+if ( !defined( 'ABSPATH' ) ) {
226 226
     return;
227 227
 }
228 228
 if ( defined( 'DOING_UNINSTALL' ) ) {
@@ -234,8 +234,8 @@  discard block
 block discarded – undo
234 234
 
235 235
     $_bFrameworkLoaded = class_exists( 'AdminPageFramework_Registry', false );
236 236
     if (
237
-        ! $_bFrameworkLoaded
238
-        || ! defined( 'AdminPageFramework_Registry::VERSION' ) // backward compatibility
237
+        !$_bFrameworkLoaded
238
+        || !defined( 'AdminPageFramework_Registry::VERSION' ) // backward compatibility
239 239
         || version_compare( AdminPageFramework_Registry::VERSION, AdminPageFrameworkLoader_Registry::VERSION, '<' )
240 240
     ) {
241 241
         AdminPageFrameworkLoader_Registry::setAdminNotice(
@@ -253,18 +253,18 @@  discard block
 block discarded – undo
253 253
 add_action( 'admin_init', 'AdminPageFrameworkLoader_Warning' );
254 254
 
255 255
 // Include the library file - the development version will be available if you cloned the GitHub repository.
256
-$_sDevelopmentVersionPath = AdminPageFrameworkLoader_Registry::$sDirPath . '/development/admin-page-framework.php';
256
+$_sDevelopmentVersionPath = AdminPageFrameworkLoader_Registry::$sDirPath.'/development/admin-page-framework.php';
257 257
 $_bDebugMode              = defined( 'WP_DEBUG' ) && WP_DEBUG;
258 258
 $_bLoadDevelopmentVersion = $_bDebugMode && file_exists( $_sDevelopmentVersionPath );
259 259
 include(
260 260
     $_bLoadDevelopmentVersion
261 261
         ? $_sDevelopmentVersionPath
262
-        : AdminPageFrameworkLoader_Registry::$sDirPath . '/library/apf/admin-page-framework.php'
262
+        : AdminPageFrameworkLoader_Registry::$sDirPath.'/library/apf/admin-page-framework.php'
263 263
 );
264 264
 
265 265
 // Include the framework loader plugin components.
266 266
 include( AdminPageFramework_Registry::$aClassFiles[ 'AdminPageFramework_PluginBootstrap' ] );
267
-include( AdminPageFrameworkLoader_Registry::$sDirPath . '/include/class/AdminPageFrameworkLoader_Bootstrap.php' );
267
+include( AdminPageFrameworkLoader_Registry::$sDirPath.'/include/class/AdminPageFrameworkLoader_Bootstrap.php' );
268 268
 new AdminPageFrameworkLoader_Bootstrap(
269 269
     AdminPageFrameworkLoader_Registry::$sFilePath,
270 270
     AdminPageFrameworkLoader_Registry::HOOK_SLUG    // hook prefix
Please login to merge, or discard this patch.
admin_page/_model/delegate/AdminPageFramework_Model_Menu__RegisterMenu.php 2 patches
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
      * 
29 29
      * @internal
30 30
      */
31
-    public function __construct( $oFactory, $sActionHook='admin_menu' ) {
31
+    public function __construct( $oFactory, $sActionHook = 'admin_menu' ) {
32 32
         
33 33
         $this->oFactory = $oFactory;
34 34
         
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
     public function _replyToRegisterRootMenu() {
77 77
         
78 78
         // If the root menu label is not set but the slug is set, 
79
-        if ( ! $this->oFactory->oProp->aRootMenu[ 'fCreateRoot' ] ) {
79
+        if ( !$this->oFactory->oProp->aRootMenu[ 'fCreateRoot' ] ) {
80 80
             return;
81 81
         }
82 82
         $this->_registerRootMenuPage();
@@ -93,12 +93,12 @@  discard block
 block discarded – undo
93 93
         private function _registerRootMenuPage() {
94 94
 
95 95
             $this->oFactory->oProp->aRootMenu[ '_page_hook' ] = add_menu_page(  
96
-                $this->oFactory->oProp->sClassName,                 // Page title - will be invisible anyway
97
-                $this->oFactory->oProp->aRootMenu[ 'sTitle' ],      // Menu title - should be the root page title.
98
-                $this->oFactory->oProp->sCapability,                // Capability - access right
99
-                $this->oFactory->oProp->aRootMenu[ 'sPageSlug' ],   // Menu ID 
100
-                '',                                       // Callback function for the page content output - the root page will be removed so no need to register a function.
101
-                $this->oFactory->oProp->aRootMenu[ 'sIcon16x16' ],  // icon path
96
+                $this->oFactory->oProp->sClassName, // Page title - will be invisible anyway
97
+                $this->oFactory->oProp->aRootMenu[ 'sTitle' ], // Menu title - should be the root page title.
98
+                $this->oFactory->oProp->sCapability, // Capability - access right
99
+                $this->oFactory->oProp->aRootMenu[ 'sPageSlug' ], // Menu ID 
100
+                '', // Callback function for the page content output - the root page will be removed so no need to register a function.
101
+                $this->oFactory->oProp->aRootMenu[ 'sIcon16x16' ], // icon path
102 102
                 $this->getElement( 
103 103
                     $this->oFactory->oProp->aRootMenu, 
104 104
                     'iPosition', 
@@ -120,8 +120,8 @@  discard block
 block discarded – undo
120 120
         
121 121
         // Let external scripts add sub-menu pages.
122 122
         $_aPages = $this->addAndApplyFilter( 
123
-            $this->oFactory,    // caller object
124
-            "pages_{$this->oFactory->oProp->sClassName}",   // filter
123
+            $this->oFactory, // caller object
124
+            "pages_{$this->oFactory->oProp->sClassName}", // filter
125 125
             $this->oFactory->oProp->aPages  // arguments
126 126
         );
127 127
         
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
         // Format the `$aPages` property and register the pages.
132 132
         $_iParsedIndex    = 0;
133 133
         $_aFormattedPages = array();
134
-        foreach( $_aPages as $_aSubMenuItem ) {
134
+        foreach ( $_aPages as $_aSubMenuItem ) {
135 135
             
136 136
             // needs to be sanitized because there are hook filters applied to this array.
137 137
             $_oFormatter = new AdminPageFramework_Format_SubMenuItem( 
@@ -166,8 +166,8 @@  discard block
 block discarded – undo
166 166
          */
167 167
         private function _getDefaultPageSlug( array $aPages ) {
168 168
 
169
-            foreach( $aPages as $_aPage ) {
170
-                if ( ! isset( $_aPage[ 'page_slug' ] ) ) { 
169
+            foreach ( $aPages as $_aPage ) {
170
+                if ( !isset( $_aPage[ 'page_slug' ] ) ) { 
171 171
                     continue; 
172 172
                 }
173 173
                 return $_aPage[ 'page_slug' ];                
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
          */ 
190 190
         private function _registerSubMenuItem( array $aArgs ) {
191 191
 
192
-            if ( ! current_user_can( $aArgs[ 'capability' ] ) ) {
192
+            if ( !current_user_can( $aArgs[ 'capability' ] ) ) {
193 193
                 return '';
194 194
             }
195 195
                                     
@@ -254,16 +254,16 @@  discard block
 block discarded – undo
254 254
              */
255 255
             private function _addPageSubmenuItem( $sRootPageSlug, $sMenuSlug, $sPageSlug, $sPageTitle, $sMenuTitle, $sCapability, $bShowInMenu, $nOrder ) {
256 256
                 
257
-                if ( ! $sPageSlug ) {
257
+                if ( !$sPageSlug ) {
258 258
                     return '';
259 259
                 }
260 260
                 
261 261
                 $_sPageHook = add_submenu_page( 
262
-                    $sRootPageSlug,         // the root (parent) page slug
263
-                    $sPageTitle,            // page title
264
-                    $sMenuTitle,            // menu title
265
-                    $sCapability,           // capability
266
-                    $sPageSlug,             // menu slug
262
+                    $sRootPageSlug, // the root (parent) page slug
263
+                    $sPageTitle, // page title
264
+                    $sMenuTitle, // menu title
265
+                    $sCapability, // capability
266
+                    $sPageSlug, // menu slug
267 267
                     array( $this->oFactory, '_replyToRenderPage' )  // callback 3.7.10+
268 268
                 );     
269 269
                 
@@ -283,14 +283,14 @@  discard block
 block discarded – undo
283 283
                 $_aRemovedMenuItem = $this->_removePageSubmenuItem( $_nSubMenuPageIndex, $sMenuSlug, $sPageSlug, $sMenuTitle );
284 284
                 
285 285
                 // If the visibility option is `false`, remove the one just added from the sub-menu global array
286
-                if ( ! $bShowInMenu && ! $this->_isCurrentPage( $sPageSlug ) ) {
286
+                if ( !$bShowInMenu && !$this->_isCurrentPage( $sPageSlug ) ) {
287 287
                     return $_sPageHook;
288 288
                 }                
289 289
                 
290 290
                 // Set the order index in the element of the `submenu` global array.
291 291
                 $this->_setSubMenuPageByIndex( 
292
-                    $nOrder,                // user-set order
293
-                    $_aRemovedMenuItem,     // will be reassign with a new index
292
+                    $nOrder, // user-set order
293
+                    $_aRemovedMenuItem, // will be reassign with a new index
294 294
                     $sMenuSlug
295 295
                 );
296 296
 
@@ -329,7 +329,7 @@  discard block
 block discarded – undo
329 329
                      */
330 330
                     add_action( 
331 331
                         'current_screen', 
332
-                        array( $this->oFactory, "load_pre_" . $sPageSlug ), 
332
+                        array( $this->oFactory, "load_pre_".$sPageSlug ), 
333 333
                         20 
334 334
                     );
335 335
                     
@@ -338,15 +338,15 @@  discard block
 block discarded – undo
338 338
                      * Set a low priority because the user may add in-page tabs in their callback method of this action hook.
339 339
                      * @since       3.6.3
340 340
                      */
341
-                    add_action( "load_" . $sPageSlug, array( $this->oFactory, '_replyToFinalizeInPageTabs' ), 9999 );
341
+                    add_action( "load_".$sPageSlug, array( $this->oFactory, '_replyToFinalizeInPageTabs' ), 9999 );
342 342
                     
343 343
                     // 3.6.3+
344
-                    add_action( "load_after_" . $sPageSlug, array( $this->oFactory, '_replyToEnqueuePageAssets' ) );
345
-                    add_action( "load_after_" . $sPageSlug, array( $this->oFactory, '_replyToEnablePageMetaBoxes' ) );  // 3.7.10+
344
+                    add_action( "load_after_".$sPageSlug, array( $this->oFactory, '_replyToEnqueuePageAssets' ) );
345
+                    add_action( "load_after_".$sPageSlug, array( $this->oFactory, '_replyToEnablePageMetaBoxes' ) ); // 3.7.10+
346 346
                           
347 347
                     $this->oFactory->oProp->aPageHooks[ $sPageSlug ] = $this->getAOrB(
348 348
                         is_network_admin(),
349
-                        $sPageHook . '-network',
349
+                        $sPageHook.'-network',
350 350
                         $sPageHook
351 351
                     );                          
352 352
 
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
 
364 364
                     $_nNewIndex = $this->getUnusedNumericIndex( 
365 365
                         $this->getElementAsArray( $GLOBALS, array( 'submenu', $sMenuSlug ) ), // subject array to parser
366
-                        $nOrder,    // a desired menu position
366
+                        $nOrder, // a desired menu position
367 367
                         5           // offset 
368 368
                     );
369 369
 
@@ -377,9 +377,9 @@  discard block
 block discarded – undo
377 377
                  */
378 378
                 private function _getSubMenuPageIndex( $sMenuSlug, $sMenuTitle, $sPageTitle, $sPageSlug ) {
379 379
                     
380
-                    foreach( $this->getElementAsArray( $GLOBALS, array( 'submenu', $sMenuSlug ) ) as $_iIndex => $_aSubMenu ) {
380
+                    foreach ( $this->getElementAsArray( $GLOBALS, array( 'submenu', $sMenuSlug ) ) as $_iIndex => $_aSubMenu ) {
381 381
                       
382
-                        if ( ! isset( $_aSubMenu[ 3 ] ) ) { 
382
+                        if ( !isset( $_aSubMenu[ 3 ] ) ) { 
383 383
                             continue; 
384 384
                         }
385 385
                                                
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
                  * @since       3.1.1       Moved from `AdminPageFramework_Menu`. Chagned the return type.
412 412
                  * @return      array       removed menu item.
413 413
                  */
414
-                private function _removePageSubmenuItem( $nSubMenuPageIndex, $sMenuSlug, $sPageSlug, $sMenuTitle ){
414
+                private function _removePageSubmenuItem( $nSubMenuPageIndex, $sMenuSlug, $sPageSlug, $sMenuTitle ) {
415 415
  
416 416
                     $_aRemovedMenuItem = $this->_removePageSubMenuItemByIndex( 
417 417
                         $nSubMenuPageIndex,
@@ -484,7 +484,7 @@  discard block
 block discarded – undo
484 484
              */
485 485
             private function _addLinkSubmenuItem( $sMenuSlug, $sTitle, $sCapability, $sHref, $bShowInMenu, $nOrder ) {
486 486
                 
487
-                if ( ! $bShowInMenu ) {
487
+                if ( !$bShowInMenu ) {
488 488
                     return;
489 489
                 }
490 490
     
@@ -499,9 +499,9 @@  discard block
 block discarded – undo
499 499
                     5   // offset
500 500
                 );
501 501
                 $_aSubMenuItems[ $_nIndex ] = array(
502
-                    $sTitle,        // 0
503
-                    $sCapability,   // 1
504
-                    $sHref,         // 2   
502
+                    $sTitle, // 0
503
+                    $sCapability, // 1
504
+                    $sHref, // 2   
505 505
                 );
506 506
                 $GLOBALS[ 'submenu' ][ $sMenuSlug ] = $_aSubMenuItems;                
507 507
                 
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
     public function _replyToRemoveRootMenuPage() {      
521 521
         
522 522
         // After adding the sub menus, if the root menu is created, remove the page that is automatically created when registering the root menu.
523
-        if ( ! $this->oFactory->oProp->aRootMenu[ 'fCreateRoot' ] ) {
523
+        if ( !$this->oFactory->oProp->aRootMenu[ 'fCreateRoot' ] ) {
524 524
             return;
525 525
         }
526 526
         remove_submenu_page( 
Please login to merge, or discard this patch.
Braces   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
         private function _getDefaultPageSlug( array $aPages ) {
168 168
 
169 169
             foreach( $aPages as $_aPage ) {
170
-                if ( ! isset( $_aPage[ 'page_slug' ] ) ) { 
170
+                if ( ! isset( $_aPage[ 'page_slug' ] ) ) {
171 171
                     continue; 
172 172
                 }
173 173
                 return $_aPage[ 'page_slug' ];                
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
                     
380 380
                     foreach( $this->getElementAsArray( $GLOBALS, array( 'submenu', $sMenuSlug ) ) as $_iIndex => $_aSubMenu ) {
381 381
                       
382
-                        if ( ! isset( $_aSubMenu[ 3 ] ) ) { 
382
+                        if ( ! isset( $_aSubMenu[ 3 ] ) ) {
383 383
                             continue; 
384 384
                         }
385 385
                                                
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
                             $sPageTitle,
395 395
                             $sPageSlug,
396 396
                         );
397
-                        if ( $_aA !== $_aB ) { 
397
+                        if ( $_aA !== $_aB ) {
398 398
                             continue;
399 399
                         }
400 400
                         return $_iIndex;
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
                  * @since       3.1.1       Moved from `AdminPageFramework_Menu`. Chagned the return type.
412 412
                  * @return      array       removed menu item.
413 413
                  */
414
-                private function _removePageSubmenuItem( $nSubMenuPageIndex, $sMenuSlug, $sPageSlug, $sMenuTitle ){
414
+                private function _removePageSubmenuItem( $nSubMenuPageIndex, $sMenuSlug, $sPageSlug, $sMenuTitle ) {
415 415
  
416 416
                     $_aRemovedMenuItem = $this->_removePageSubMenuItemByIndex( 
417 417
                         $nSubMenuPageIndex,
@@ -517,7 +517,7 @@  discard block
 block discarded – undo
517 517
      * @callback    action      admin_menu
518 518
      * @internal
519 519
      */    
520
-    public function _replyToRemoveRootMenuPage() {      
520
+    public function _replyToRemoveRootMenuPage() {
521 521
         
522 522
         // After adding the sub menus, if the root menu is created, remove the page that is automatically created when registering the root menu.
523 523
         if ( ! $this->oFactory->oProp->aRootMenu[ 'fCreateRoot' ] ) {
Please login to merge, or discard this patch.
development/factory/admin_page/AdminPageFramework_Controller_Menu.php 2 patches
Indentation   +60 added lines, -60 removed lines patch added patch discarded remove patch
@@ -173,52 +173,52 @@  discard block
 block discarded – undo
173 173
     }
174 174
     
175 175
     /**
176
-    * Adds the given sub-menu item on the left sidebar menu of the administration panel.
177
-    * 
178
-    * It supports pages and links. Each of them has the specific array structure.
179
-    * 
180
-    * <h4>Example</h4>
181
-    * <code>
182
-    * $this->addSubMenuItem(
183
-    *       array(
184
-    *           'title'         => 'Read Me',
185
-    *           'menu_title'    => 'About'
186
-    *           'page_slug'     => 'my_plugin_readme',
187
-    *       )
188
-    * );
189
-    * </code>
190
-    * 
191
-    * @since        2.0.0
192
-    * @since        3.0.0       Changed the scope to public.
193
-    * @remark       The sub menu page slug should be unique because add_submenu_page() can add one callback per page slug.
194
-    * @param        array       a sub-menu array. It can be a page or a link. The array structures are as follows:
195
-    * <h4>Sub-menu Page Array</h4>
196
-    * <ul>
197
-    *   <li>**title** - (string) the page title of the page.</li>
198
-    *   <li>**page_slug** - (string) the page slug of the page. Non-alphabetical characters should not be used including dots(.) and hyphens(-).</li>
199
-    *   <li>**screen_icon** - (optional, string) either the ID selector name from the following list or the icon URL. The size of the icon should be 32 by 32 in pixel. This is for WordPress 3.7.x or below.
200
-    *       <pre>edit, post, index, media, upload, link-manager, link, link-category, edit-pages, page, edit-comments, themes, plugins, users, profile, user-edit, tools, admin, options-general, ms-admin, generic</pre>
201
-    *       <p>( Notes: the `generic` icon is available WordPress version 3.5 or above.)</p> 
202
-    *   </li>
203
-    *   <li>**capability** - (optional, string) the access level to the created admin pages defined <a href="http://codex.wordpress.org/Roles_and_Capabilities">here</a>. If not set, the overall capability assigned in the class constructor, which is `manage_options` by default, will be used.</li>
204
-    *   <li>**order** - (optional, integer) the order number of the page. The lager the number is, the lower the position it is placed in the menu.</li>
205
-    *   <li>**show_page_heading_tab** - (optional, boolean) if this is set to false, the page title won't be displayed in the page heading tab. Default: `true`.</li>
206
-    *   <li>**show_in_menu** - (optional) If this is set to false, the page title won't be displayed in the sidebar menu while the page is still accessible. Default: true.</li>
207
-    *   <li>**page_title** - (optional) [3.3.0+] When the page title differs from the menu title, use this argument.</li>
208
-    *   <li>**menu_title** - (optional) [3.3.0+] When the menu title differs from the menu title, use this argument.</li>
209
-    * </ul>
210
-    * <h4>Sub-menu Link Array</h4>
211
-    * <ul>
212
-    *   <li>**title** - (string) the link title.</li>
213
-    *   <li>**href** - (string) the URL of the target link.</li>
214
-    *   <li>**capability** - (optional, string) the access level to show the item, defined <a href="http://codex.wordpress.org/Roles_and_Capabilities">here</a>. If not set, the overall capability assigned in the class constructor, which is `manage_options` by default, will be used.</li>
215
-    *   <li>**order** - (optional, integer) the order number of the page. The lager the number is, the lower the position it is placed in the menu.</li>
216
-    *   <li>**show_page_heading_tab** - (optional, boolean) if this is set to false, the page title won't be displayed in the page heading tab. Default: `true`.</li>
217
-    *   <li>**show_in_menu** - (optional) If this is set to false, the page title won't be displayed in the sidebar menu while the page is still accessible. Default: true.</li>
218
-    * </ul>
219
-    * @access       public
220
-    * @return       void
221
-    */    
176
+     * Adds the given sub-menu item on the left sidebar menu of the administration panel.
177
+     * 
178
+     * It supports pages and links. Each of them has the specific array structure.
179
+     * 
180
+     * <h4>Example</h4>
181
+     * <code>
182
+     * $this->addSubMenuItem(
183
+     *       array(
184
+     *           'title'         => 'Read Me',
185
+     *           'menu_title'    => 'About'
186
+     *           'page_slug'     => 'my_plugin_readme',
187
+     *       )
188
+     * );
189
+     * </code>
190
+     * 
191
+     * @since        2.0.0
192
+     * @since        3.0.0       Changed the scope to public.
193
+     * @remark       The sub menu page slug should be unique because add_submenu_page() can add one callback per page slug.
194
+     * @param        array       a sub-menu array. It can be a page or a link. The array structures are as follows:
195
+     * <h4>Sub-menu Page Array</h4>
196
+     * <ul>
197
+     *   <li>**title** - (string) the page title of the page.</li>
198
+     *   <li>**page_slug** - (string) the page slug of the page. Non-alphabetical characters should not be used including dots(.) and hyphens(-).</li>
199
+     *   <li>**screen_icon** - (optional, string) either the ID selector name from the following list or the icon URL. The size of the icon should be 32 by 32 in pixel. This is for WordPress 3.7.x or below.
200
+     *       <pre>edit, post, index, media, upload, link-manager, link, link-category, edit-pages, page, edit-comments, themes, plugins, users, profile, user-edit, tools, admin, options-general, ms-admin, generic</pre>
201
+     *       <p>( Notes: the `generic` icon is available WordPress version 3.5 or above.)</p> 
202
+     *   </li>
203
+     *   <li>**capability** - (optional, string) the access level to the created admin pages defined <a href="http://codex.wordpress.org/Roles_and_Capabilities">here</a>. If not set, the overall capability assigned in the class constructor, which is `manage_options` by default, will be used.</li>
204
+     *   <li>**order** - (optional, integer) the order number of the page. The lager the number is, the lower the position it is placed in the menu.</li>
205
+     *   <li>**show_page_heading_tab** - (optional, boolean) if this is set to false, the page title won't be displayed in the page heading tab. Default: `true`.</li>
206
+     *   <li>**show_in_menu** - (optional) If this is set to false, the page title won't be displayed in the sidebar menu while the page is still accessible. Default: true.</li>
207
+     *   <li>**page_title** - (optional) [3.3.0+] When the page title differs from the menu title, use this argument.</li>
208
+     *   <li>**menu_title** - (optional) [3.3.0+] When the menu title differs from the menu title, use this argument.</li>
209
+     * </ul>
210
+     * <h4>Sub-menu Link Array</h4>
211
+     * <ul>
212
+     *   <li>**title** - (string) the link title.</li>
213
+     *   <li>**href** - (string) the URL of the target link.</li>
214
+     *   <li>**capability** - (optional, string) the access level to show the item, defined <a href="http://codex.wordpress.org/Roles_and_Capabilities">here</a>. If not set, the overall capability assigned in the class constructor, which is `manage_options` by default, will be used.</li>
215
+     *   <li>**order** - (optional, integer) the order number of the page. The lager the number is, the lower the position it is placed in the menu.</li>
216
+     *   <li>**show_page_heading_tab** - (optional, boolean) if this is set to false, the page title won't be displayed in the page heading tab. Default: `true`.</li>
217
+     *   <li>**show_in_menu** - (optional) If this is set to false, the page title won't be displayed in the sidebar menu while the page is still accessible. Default: true.</li>
218
+     * </ul>
219
+     * @access       public
220
+     * @return       void
221
+     */    
222 222
     public function addSubMenuItem( array $aSubMenuItem ) {
223 223
         if ( isset( $aSubMenuItem[ 'href' ] ) ) {
224 224
             $this->addSubMenuLink( $aSubMenuItem );
@@ -228,20 +228,20 @@  discard block
 block discarded – undo
228 228
     }
229 229
 
230 230
     /**
231
-    * Adds the given link into the menu on the left sidebar of the administration panel.
232
-    * 
233
-    * @since        2.0.0
234
-    * @since        3.0.0       Changed the scope to public from protected.
235
-    * @since        3.5.0       Changed the scope to public as it was still protected.
236
-    * @param        string      the menu title.
237
-    * @param        string      the URL linked to the menu.
238
-    * @param        string      (optional) the <a href="http://codex.wordpress.org/Roles_and_Capabilities" target="_blank">access level</a>.
239
-    * @param        string      (optional) the order number. The larger it is, the lower the position it gets.
240
-    * @param        string      (optional) if set to false, the menu title will not be listed in the tab navigation menu at the top of the page.
241
-    * @access       public
242
-    * @return       void
243
-    * @internal
244
-    */    
231
+     * Adds the given link into the menu on the left sidebar of the administration panel.
232
+     * 
233
+     * @since        2.0.0
234
+     * @since        3.0.0       Changed the scope to public from protected.
235
+     * @since        3.5.0       Changed the scope to public as it was still protected.
236
+     * @param        string      the menu title.
237
+     * @param        string      the URL linked to the menu.
238
+     * @param        string      (optional) the <a href="http://codex.wordpress.org/Roles_and_Capabilities" target="_blank">access level</a>.
239
+     * @param        string      (optional) the order number. The larger it is, the lower the position it gets.
240
+     * @param        string      (optional) if set to false, the menu title will not be listed in the tab navigation menu at the top of the page.
241
+     * @access       public
242
+     * @return       void
243
+     * @internal
244
+     */    
245 245
     public function addSubMenuLink( array $aSubMenuLink ) {
246 246
         
247 247
         // If required keys are not set, return.
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
      * @param       string      (optional) the position number that is passed to the <var>$position</var> parameter of the <a href="http://codex.wordpress.org/Function_Reference/add_menu_page">add_menu_page()</a> function.
77 77
      * @return      void
78 78
      */
79
-    public function setRootMenuPage( $sRootMenuLabel, $sIcon16x16=null, $iMenuPosition=null ) {
79
+    public function setRootMenuPage( $sRootMenuLabel, $sIcon16x16 = null, $iMenuPosition = null ) {
80 80
 
81 81
         $sRootMenuLabel = trim( $sRootMenuLabel );
82 82
         $_sSlug         = $this->_isBuiltInMenuItem( $sRootMenuLabel ); // if true, this method returns the slug
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
      * @access       public
167 167
      * @return       void
168 168
      */     
169
-    public function addSubMenuItems( $aSubMenuItem1, $aSubMenuItem2=null, $_and_more=null ) {
169
+    public function addSubMenuItems( $aSubMenuItem1, $aSubMenuItem2 = null, $_and_more = null ) {
170 170
         foreach ( func_get_args() as $_aSubMenuItem ) {
171 171
             $this->addSubMenuItem( $_aSubMenuItem );     
172 172
         }
@@ -245,16 +245,16 @@  discard block
 block discarded – undo
245 245
     public function addSubMenuLink( array $aSubMenuLink ) {
246 246
         
247 247
         // If required keys are not set, return.
248
-        if ( ! isset( $aSubMenuLink['href'], $aSubMenuLink['title'] ) ) { 
248
+        if ( !isset( $aSubMenuLink[ 'href' ], $aSubMenuLink[ 'title' ] ) ) { 
249 249
             return; 
250 250
         }
251 251
         
252 252
         // If the set URL is not valid, return.
253
-        if ( ! filter_var( $aSubMenuLink['href'], FILTER_VALIDATE_URL ) ) { 
253
+        if ( !filter_var( $aSubMenuLink[ 'href' ], FILTER_VALIDATE_URL ) ) { 
254 254
             return; 
255 255
         }
256 256
 
257
-        $_oFormatter   = new AdminPageFramework_Format_SubMenuLink( 
257
+        $_oFormatter = new AdminPageFramework_Format_SubMenuLink( 
258 258
             $aSubMenuLink, 
259 259
             $this,
260 260
             count( $this->oProp->aPages ) + 1
@@ -344,11 +344,11 @@  discard block
 block discarded – undo
344 344
      */ 
345 345
     public function addSubMenuPage( array $aSubMenuPage ) {
346 346
 
347
-        if ( ! isset( $aSubMenuPage[ 'page_slug' ] ) ) { 
347
+        if ( !isset( $aSubMenuPage[ 'page_slug' ] ) ) { 
348 348
             return; 
349 349
         }
350 350
             
351
-        $_oFormatter   = new AdminPageFramework_Format_SubMenuPage( 
351
+        $_oFormatter = new AdminPageFramework_Format_SubMenuPage( 
352 352
             $aSubMenuPage,
353 353
             $this,
354 354
             count( $this->oProp->aPages ) + 1
Please login to merge, or discard this patch.