| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  | /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  |  * One of the abstract class of the plugin admin page class. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  *  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  |  * @package      Admin Page Framework Loader | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  |  * @copyright    Copyright (c) 2014-2015, Michael Uno | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  |  * @author       Michael Uno | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  |  * @authorurl    http://michaeluno.jp | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  |  * @since        3.5.0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  |  */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  | class AdminPageFrameworkLoader_NetworkAdmin extends AdminPageFramework_NetworkAdmin { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  |      | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  |      * User constructor. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  |      *  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  |      * @since       3.5.0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  |     public function start() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  |    | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  |         if ( ! $this->oProp->bIsAdmin ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  |             return; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  |         if ( ! is_network_admin() ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  |             return; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |            | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  |         // Enable / disable the demo pages | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |         if ( isset( $_GET['enable_apfl_demo_pages'] ) ) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |              | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |             // Update the options and reload the page | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |             $_oOption = AdminPageFrameworkLoader_Option::getInstance( AdminPageFrameworkLoader_Registry::$aOptionKeys['main'] ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |             $_oOption->update( 'enable_demo', $_GET['enable_apfl_demo_pages'] ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |              | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |             $this->setSettingNotice(  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |                 __( 'Enabled demo!', 'admin-page-framework-loader' ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |                 'updated'  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |             ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |             $this->oUtil->goToLocalURL(  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |                 remove_query_arg( 'enable_apfl_demo_pages' ), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |                 array( 'AdminPageFrameworkLoader_Utility', 'replyToShowRedirectError' ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |             ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |               | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |    | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |      * Sets up admin pages. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |      *  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |      * @since       3.5.0 | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |     public function setUp() { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |          | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |         // Action Links (plugin.php) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  |         $this->addLinkToPluginTitle( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  |             $this->_getDemoSwitcherLink( $this->oProp->aOptions ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  |         $this->addLinkToPluginDescription( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  |             "<a href='https://wordpress.org/support/plugin/admin-page-framework' target='_blank'>" . __( 'Support', 'admin-page-framework-loader' ) . "</a>" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  |         ); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  |          | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  |            | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  |         /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  |          * Returns the switch link of the demo pages. | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 67 |  |  |          */ | 
            
                                                                        
                            
            
                                    
            
            
                | 68 |  |  |         private function _getDemoSwitcherLink( $mOptions=array() ) { | 
            
                                                                        
                            
            
                                    
            
            
                | 69 |  |  |              | 
            
                                                                        
                            
            
                                    
            
            
                | 70 |  |  |             $_bEnabled  = isset( $mOptions['enable_demo'] ) && $mOptions['enable_demo']; | 
            
                                                                        
                            
            
                                    
            
            
                | 71 |  |  |             $_sLink    = esc_url(  | 
            
                                                                        
                            
            
                                    
            
            
                | 72 |  |  |                 add_query_arg(  | 
            
                                                                        
                            
            
                                    
            
            
                | 73 |  |  |                     array(  | 
            
                                                                        
                            
            
                                    
            
            
                | 74 |  |  |                         'enable_apfl_demo_pages' => $_bEnabled ? 0 : 1, | 
            
                                                                        
                            
            
                                    
            
            
                | 75 |  |  |                     ) | 
            
                                                                        
                            
            
                                    
            
            
                | 76 |  |  |                 ) | 
            
                                                                        
                            
            
                                    
            
            
                | 77 |  |  |             );         | 
            
                                                                        
                            
            
                                    
            
            
                | 78 |  |  |             return $_bEnabled | 
            
                                                                        
                            
            
                                    
            
            
                | 79 |  |  |                 ? "<a href='{$_sLink}'>" . __( 'Disable Demo', 'admin-page-framework-loader' ) . "</a>" | 
            
                                                                        
                            
            
                                    
            
            
                | 80 |  |  |                 : "<a href='{$_sLink}'><strong style='font-size: 1em;'>" . __( 'Enable Demo', 'admin-page-framework-loader' ) . "</strong></a>"; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 |  |  |              | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 |  |  |         }             | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 |  |  |  | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 84 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 85 |  |  |  |