@@ -38,7 +38,7 @@ |
||
| 38 | 38 | * @param string $sPluginFilePath The plugin file path. |
| 39 | 39 | * @param string $sPluginHookPrefix The plugin hook slug without underscore. This will be used to construct hook names. |
| 40 | 40 | * @param string $sSetUpHook The action hook name for the setUp callback. Default 'plugins_loaded'. |
| 41 | - * @param string $iPriority The priority. Set a lower number to get loader earlier. Default: `10`. |
|
| 41 | + * @param integer $iPriority The priority. Set a lower number to get loader earlier. Default: `10`. |
|
| 42 | 42 | */ |
| 43 | 43 | public function __construct( $sPluginFilePath, $sPluginHookPrefix='', $sSetUpHook='plugins_loaded', $iPriority=10 ) { |
| 44 | 44 | |
@@ -76,7 +76,7 @@ |
||
| 76 | 76 | register_deactivation_hook( $this->sFilePath, array( $this, 'replyToPluginDeactivation' ) ); |
| 77 | 77 | |
| 78 | 78 | // 8. Schedule to load plugin specific components. |
| 79 | - if ( ! $this->sSetUpHook || did_action( $this->sSetUpHook ) ) { |
|
| 79 | + if ( ! $this->sSetUpHook || did_action( $this->sSetUpHook ) ) { |
|
| 80 | 80 | $this->_replyToLoadPluginComponents(); |
| 81 | 81 | } else { |
| 82 | 82 | add_action( $this->sSetUpHook, array( $this, '_replyToLoadPluginComponents' ), $this->iPriority ); |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | * @param string $sSetUpHook The action hook name for the setUp callback. Default 'plugins_loaded'. |
| 123 | 123 | * @param string $iPriority The priority. Set a lower number to get loader earlier. Default: `10`. |
| 124 | 124 | */ |
| 125 | - public function __construct( $sPluginFilePath, $sPluginHookPrefix='', $sSetUpHook='plugins_loaded', $iPriority=10 ) { |
|
| 125 | + public function __construct( $sPluginFilePath, $sPluginHookPrefix = '', $sSetUpHook = 'plugins_loaded', $iPriority = 10 ) { |
|
| 126 | 126 | |
| 127 | 127 | // Check if it has been loaded. |
| 128 | 128 | if ( $this->_hasLoaded() ) { |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | register_deactivation_hook( $this->sFilePath, array( $this, 'replyToPluginDeactivation' ) ); |
| 159 | 159 | |
| 160 | 160 | // 8. Schedule to load plugin specific components. |
| 161 | - if ( ! $this->sSetUpHook || did_action( $this->sSetUpHook ) ) { |
|
| 161 | + if ( !$this->sSetUpHook || did_action( $this->sSetUpHook ) ) { |
|
| 162 | 162 | $this->_replyToLoadPluginComponents(); |
| 163 | 163 | } else { |
| 164 | 164 | add_action( $this->sSetUpHook, array( $this, '_replyToLoadPluginComponents' ), $this->iPriority ); |
@@ -200,14 +200,14 @@ discard block |
||
| 200 | 200 | protected function _registerClasses() { |
| 201 | 201 | |
| 202 | 202 | // This class should be used in the framework bootstrap so disabling the auto-load option for performance. |
| 203 | - if ( ! class_exists( 'AdminPageFramework_RegisterClasses', false ) ) { |
|
| 203 | + if ( !class_exists( 'AdminPageFramework_RegisterClasses', false ) ) { |
|
| 204 | 204 | return; |
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | // Register classes |
| 208 | 208 | new AdminPageFramework_RegisterClasses( |
| 209 | - $this->getScanningDirs(), // scanning directory paths |
|
| 210 | - array(), // autoloader options |
|
| 209 | + $this->getScanningDirs(), // scanning directory paths |
|
| 210 | + array(), // autoloader options |
|
| 211 | 211 | $this->getClasses() // pre-generated class list |
| 212 | 212 | ); |
| 213 | 213 | |
@@ -25,6 +25,7 @@ |
||
| 25 | 25 | |
| 26 | 26 | /** |
| 27 | 27 | * Sets up hooks and properties. |
| 28 | + * @param AdminPageFrameworkLoader_AdminPage $oFactory |
|
| 28 | 29 | */ |
| 29 | 30 | public function __construct( $oFactory, array $aPageArguments ) { |
| 30 | 31 | |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | public function __construct( $oFactory, array $aPageArguments ) { |
| 30 | 30 | |
| 31 | 31 | $this->oFactory = $oFactory; |
| 32 | - $this->sPageSlug = $aPageArguments['page_slug']; |
|
| 32 | + $this->sPageSlug = $aPageArguments[ 'page_slug' ]; |
|
| 33 | 33 | $this->_addPage( $aPageArguments ); |
| 34 | 34 | $this->construct( $oFactory ); |
| 35 | 35 | |
@@ -58,8 +58,8 @@ discard block |
||
| 58 | 58 | */ |
| 59 | 59 | public function replyToLoadResources( $oFactory ) { |
| 60 | 60 | |
| 61 | - $_sCSSPath = AdminPageFrameworkLoader_Registry::$sDirPath . '/asset/css/' . $this->sPageSlug . '.css'; |
|
| 62 | - if ( ! file_exists( $_sCSSPath ) ) { |
|
| 61 | + $_sCSSPath = AdminPageFrameworkLoader_Registry::$sDirPath.'/asset/css/'.$this->sPageSlug.'.css'; |
|
| 62 | + if ( !file_exists( $_sCSSPath ) ) { |
|
| 63 | 63 | return; |
| 64 | 64 | } |
| 65 | 65 | $this->oFactory->enqueueStyle( |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | public function start() { |
| 27 | 27 | |
| 28 | - if ( ! is_admin() ) { |
|
| 28 | + if ( !is_admin() ) { |
|
| 29 | 29 | return; |
| 30 | 30 | } |
| 31 | 31 | |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | |
| 48 | 48 | // When newly installed, the 'welcomed' value is not set. |
| 49 | 49 | $_oOption = AdminPageFrameworkLoader_Option::getInstance(); |
| 50 | - if ( ! $_oOption->get( 'welcomed' ) ) { |
|
| 50 | + if ( !$_oOption->get( 'welcomed' ) ) { |
|
| 51 | 51 | $this->_setInitialOptions( $_oOption, AdminPageFrameworkLoader_Registry::VERSION ); |
| 52 | 52 | $this->_goToWelcomePage(); // will exit |
| 53 | 53 | } |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | private function _goToWelcomePage() { |
| 74 | 74 | |
| 75 | 75 | $_sWelcomePageURL = apply_filters( |
| 76 | - AdminPageFrameworkLoader_Registry::HOOK_SLUG . '_filter_admin_welcome_redirect_url', |
|
| 76 | + AdminPageFrameworkLoader_Registry::HOOK_SLUG.'_filter_admin_welcome_redirect_url', |
|
| 77 | 77 | add_query_arg( |
| 78 | 78 | array( 'page' => AdminPageFrameworkLoader_Registry::$aAdminPages[ 'about' ] ), |
| 79 | 79 | admin_url( 'index.php' ) // Dashboard |
@@ -93,11 +93,11 @@ discard block |
||
| 93 | 93 | public function setUp() { |
| 94 | 94 | |
| 95 | 95 | $_oOption = AdminPageFrameworkLoader_Option::getInstance(); |
| 96 | - if ( ! $_oOption->get( 'enable_admin_pages' ) ) { |
|
| 96 | + if ( !$_oOption->get( 'enable_admin_pages' ) ) { |
|
| 97 | 97 | return; |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - $this->sPageSlug = AdminPageFrameworkLoader_Registry::$aAdminPages[ 'about' ]; |
|
| 100 | + $this->sPageSlug = AdminPageFrameworkLoader_Registry::$aAdminPages[ 'about' ]; |
|
| 101 | 101 | |
| 102 | 102 | // Root page |
| 103 | 103 | $this->setRootMenuPage( |
@@ -108,12 +108,12 @@ discard block |
||
| 108 | 108 | $this->addSubMenuItems( |
| 109 | 109 | array( |
| 110 | 110 | 'title' => AdminPageFrameworkLoader_Registry::SHORTNAME, |
| 111 | - 'page_slug' => AdminPageFrameworkLoader_Registry::$aAdminPages[ 'about' ], // page slug |
|
| 111 | + 'page_slug' => AdminPageFrameworkLoader_Registry::$aAdminPages[ 'about' ], // page slug |
|
| 112 | 112 | 'show_in_menu' => false, |
| 113 | 113 | 'style' => array( |
| 114 | - AdminPageFrameworkLoader_Registry::$sDirPath . '/asset/css/about.css', |
|
| 115 | - AdminPageFrameworkLoader_Registry::$sDirPath . '/asset/css/column.css', |
|
| 116 | - AdminPageFrameworkLoader_Registry::$sDirPath . '/asset/javascript/flip/jquery.m.flip.css', |
|
| 114 | + AdminPageFrameworkLoader_Registry::$sDirPath.'/asset/css/about.css', |
|
| 115 | + AdminPageFrameworkLoader_Registry::$sDirPath.'/asset/css/column.css', |
|
| 116 | + AdminPageFrameworkLoader_Registry::$sDirPath.'/asset/javascript/flip/jquery.m.flip.css', |
|
| 117 | 117 | version_compare( $GLOBALS[ 'wp_version' ], '3.8', '<' ) |
| 118 | 118 | ? ".about-wrap .introduction h2 { |
| 119 | 119 | padding: 1em; |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | }", |
| 128 | 128 | ), |
| 129 | 129 | 'script' => array( |
| 130 | - AdminPageFrameworkLoader_Registry::$sDirPath . '/asset/javascript/flip/jquery.m.flip.js', |
|
| 130 | + AdminPageFrameworkLoader_Registry::$sDirPath.'/asset/javascript/flip/jquery.m.flip.js', |
|
| 131 | 131 | "jQuery( document ).ready( function() { |
| 132 | 132 | jQuery( '.apf-badge-image' ).mflip(); |
| 133 | 133 | } );", |
@@ -138,8 +138,8 @@ discard block |
||
| 138 | 138 | $this->setPluginSettingsLinkLabel( '' ); // pass an empty string to disable it. |
| 139 | 139 | |
| 140 | 140 | // Hook |
| 141 | - add_action( "load_" . $this->oProp->sClassName, array( $this, 'replyToLoadClassPages' ) ); |
|
| 142 | - add_action( "load_" . AdminPageFrameworkLoader_Registry::$aAdminPages[ 'about' ], array( $this, 'replyToLoadPage' ) ); |
|
| 141 | + add_action( "load_".$this->oProp->sClassName, array( $this, 'replyToLoadClassPages' ) ); |
|
| 142 | + add_action( "load_".AdminPageFrameworkLoader_Registry::$aAdminPages[ 'about' ], array( $this, 'replyToLoadPage' ) ); |
|
| 143 | 143 | |
| 144 | 144 | } |
| 145 | 145 | |
@@ -165,14 +165,14 @@ discard block |
||
| 165 | 165 | |
| 166 | 166 | $_sPageSlug = AdminPageFrameworkLoader_Registry::$aAdminPages[ 'about' ]; |
| 167 | 167 | new AdminPageFrameworkLoader_AdminPageWelcome_Welcome( |
| 168 | - $this, // factory object |
|
| 169 | - $_sPageSlug, // page slug |
|
| 168 | + $this, // factory object |
|
| 169 | + $_sPageSlug, // page slug |
|
| 170 | 170 | array( |
| 171 | 171 | 'tab_slug' => 'welcome', |
| 172 | 172 | // 'title' => __( "What's New", 'admin-page-framework-loader' ), // ' |
| 173 | 173 | 'style' => array( |
| 174 | - AdminPageFrameworkLoader_Registry::$sDirPath . '/asset/css/admin.css', |
|
| 175 | - AdminPageFrameworkLoader_Registry::$sDirPath . '/asset/css/code.css', |
|
| 174 | + AdminPageFrameworkLoader_Registry::$sDirPath.'/asset/css/admin.css', |
|
| 175 | + AdminPageFrameworkLoader_Registry::$sDirPath.'/asset/css/code.css', |
|
| 176 | 176 | ), |
| 177 | 177 | ) |
| 178 | 178 | ); |
@@ -201,24 +201,24 @@ discard block |
||
| 201 | 201 | */ |
| 202 | 202 | public function replyToFilterContentTop( $sContent ) { |
| 203 | 203 | |
| 204 | - $_sVersion = '- ' . AdminPageFrameworkLoader_Registry::VERSION; |
|
| 205 | - $_sPluginName = AdminPageFrameworkLoader_Registry::SHORTNAME . ' ' . $_sVersion; |
|
| 204 | + $_sVersion = '- '.AdminPageFrameworkLoader_Registry::VERSION; |
|
| 205 | + $_sPluginName = AdminPageFrameworkLoader_Registry::SHORTNAME.' '.$_sVersion; |
|
| 206 | 206 | |
| 207 | 207 | $_sBadgeURL = esc_url( AdminPageFrameworkLoader_Registry::getPluginURL( 'asset/image/icon-128x128.png' ) ); |
| 208 | 208 | |
| 209 | 209 | $_aOutput = array(); |
| 210 | - $_aOutput[] = "<h1>" |
|
| 210 | + $_aOutput[ ] = "<h1>" |
|
| 211 | 211 | . sprintf( __( 'Welcome to %1$s', 'admin-page-framework-loader' ), $_sPluginName ) |
| 212 | 212 | . "</h1>"; |
| 213 | - $_aOutput[] = "<div class='about-text'>" |
|
| 213 | + $_aOutput[ ] = "<div class='about-text'>" |
|
| 214 | 214 | . sprintf( __( 'Thank you for updating to the latest version! %1$s is ready to make your plugin or theme development faster, more organized and better!', 'admin-page-framework-loader' ), $_sPluginName ) |
| 215 | 215 | . "</div>"; |
| 216 | - $_aOutput[] = '' |
|
| 216 | + $_aOutput[ ] = '' |
|
| 217 | 217 | . "<div class='apf-badge'>" |
| 218 | 218 | . "<div class='apf-badge-image m-flip'>" |
| 219 | 219 | . "<img src='{$_sBadgeURL}' />" |
| 220 | 220 | . "</div>" |
| 221 | - . "<span class='label'>" . sprintf( __( 'Version %1$s', 'admin-page-framework-loader' ), $_sVersion ) . "</span>" |
|
| 221 | + . "<span class='label'>".sprintf( __( 'Version %1$s', 'admin-page-framework-loader' ), $_sVersion )."</span>" |
|
| 222 | 222 | . "</div>"; |
| 223 | 223 | |
| 224 | 224 | return implode( PHP_EOL, $_aOutput ) |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | |
| 48 | 48 | // When newly installed, the 'welcomed' value is not set. |
| 49 | 49 | $_oOption = AdminPageFrameworkLoader_Option::getInstance(); |
| 50 | - if ( ! $_oOption->get( 'welcomed' ) ) { |
|
| 50 | + if ( ! $_oOption->get( 'welcomed' ) ) { |
|
| 51 | 51 | $this->_setInitialOptions( $_oOption, AdminPageFrameworkLoader_Registry::VERSION ); |
| 52 | 52 | $this->_goToWelcomePage(); // will exit |
| 53 | 53 | } |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - private function _goToWelcomePage() { |
|
| 73 | + private function _goToWelcomePage() { |
|
| 74 | 74 | |
| 75 | 75 | $_sWelcomePageURL = apply_filters( |
| 76 | 76 | AdminPageFrameworkLoader_Registry::HOOK_SLUG . '_filter_admin_welcome_redirect_url', |
@@ -18,12 +18,12 @@ discard block |
||
| 18 | 18 | */ |
| 19 | 19 | public function start() { |
| 20 | 20 | |
| 21 | - if ( ! $this->oProp->bIsAdmin ) { |
|
| 21 | + if ( !$this->oProp->bIsAdmin ) { |
|
| 22 | 22 | return; |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | // Allows the user to switch the menu visibility. |
| 26 | - if ( isset( $_GET['enable_apfl_admin_pages'] ) ) { |
|
| 26 | + if ( isset( $_GET[ 'enable_apfl_admin_pages' ] ) ) { |
|
| 27 | 27 | |
| 28 | 28 | // Update the options and reload the page |
| 29 | 29 | $_oOption = AdminPageFrameworkLoader_Option::getInstance( AdminPageFrameworkLoader_Registry::$aOptionKeys[ 'main' ] ); |
@@ -67,15 +67,15 @@ discard block |
||
| 67 | 67 | public function setUp() { |
| 68 | 68 | |
| 69 | 69 | $_aOptions = $this->oProp->aOptions; |
| 70 | - $_bAdminPageEnabled = ! is_array( $_aOptions ) // for the first time of loading, the option is not set and it is not an array. |
|
| 71 | - || ( isset( $_aOptions['enable_admin_pages'] ) && $_aOptions['enable_admin_pages'] ); |
|
| 70 | + $_bAdminPageEnabled = !is_array( $_aOptions ) // for the first time of loading, the option is not set and it is not an array. |
|
| 71 | + || ( isset( $_aOptions[ 'enable_admin_pages' ] ) && $_aOptions[ 'enable_admin_pages' ] ); |
|
| 72 | 72 | |
| 73 | 73 | // Set up pages |
| 74 | 74 | if ( $_bAdminPageEnabled ) { |
| 75 | 75 | |
| 76 | 76 | $this->setRootMenuPage( |
| 77 | - AdminPageFrameworkLoader_Registry::SHORTNAME, // menu slug |
|
| 78 | - AdminPageFrameworkLoader_Registry::$sDirPath . '/asset/image/wp-logo_16x16.png', // menu icon |
|
| 77 | + AdminPageFrameworkLoader_Registry::SHORTNAME, // menu slug |
|
| 78 | + AdminPageFrameworkLoader_Registry::$sDirPath.'/asset/image/wp-logo_16x16.png', // menu icon |
|
| 79 | 79 | 4 // menu position |
| 80 | 80 | ); |
| 81 | 81 | |
@@ -86,19 +86,19 @@ discard block |
||
| 86 | 86 | 'page_slug' => AdminPageFrameworkLoader_Registry::$aAdminPages[ 'tool' ], |
| 87 | 87 | 'title' => __( 'Tools', 'admin-page-framework-loader' ), |
| 88 | 88 | 'style' => array( |
| 89 | - AdminPageFrameworkLoader_Registry::$sDirPath . '/asset/css/code.css', |
|
| 90 | - AdminPageFrameworkLoader_Registry::$sDirPath . '/asset/css/admin.css' |
|
| 89 | + AdminPageFrameworkLoader_Registry::$sDirPath.'/asset/css/code.css', |
|
| 90 | + AdminPageFrameworkLoader_Registry::$sDirPath.'/asset/css/admin.css' |
|
| 91 | 91 | ), |
| 92 | 92 | ) |
| 93 | 93 | ); |
| 94 | 94 | new AdminPageFrameworkLoader_AdminPage_Addon( |
| 95 | 95 | $this, |
| 96 | 96 | array( |
| 97 | - 'page_slug' => AdminPageFrameworkLoader_Registry::$aAdminPages[ 'addon' ], // page slug |
|
| 97 | + 'page_slug' => AdminPageFrameworkLoader_Registry::$aAdminPages[ 'addon' ], // page slug |
|
| 98 | 98 | 'title' => __( 'Add Ons', 'admin-page-framework-loader' ), |
| 99 | 99 | 'style' => array( |
| 100 | - AdminPageFrameworkLoader_Registry::$sDirPath . '/asset/css/code.css', |
|
| 101 | - AdminPageFrameworkLoader_Registry::$sDirPath . '/asset/css/admin.css' |
|
| 100 | + AdminPageFrameworkLoader_Registry::$sDirPath.'/asset/css/code.css', |
|
| 101 | + AdminPageFrameworkLoader_Registry::$sDirPath.'/asset/css/admin.css' |
|
| 102 | 102 | ), |
| 103 | 103 | ) |
| 104 | 104 | ); |
@@ -109,13 +109,13 @@ discard block |
||
| 109 | 109 | 'title' => __( 'Help', 'admin-page-framework-loader' ), |
| 110 | 110 | 'order' => 1000, // to be the last menu item |
| 111 | 111 | 'style' => array( |
| 112 | - AdminPageFrameworkLoader_Registry::$sDirPath . '/asset/css/code.css', |
|
| 113 | - AdminPageFrameworkLoader_Registry::$sDirPath . '/asset/css/admin.css' |
|
| 112 | + AdminPageFrameworkLoader_Registry::$sDirPath.'/asset/css/code.css', |
|
| 113 | + AdminPageFrameworkLoader_Registry::$sDirPath.'/asset/css/admin.css' |
|
| 114 | 114 | ), |
| 115 | 115 | ) |
| 116 | 116 | ); |
| 117 | 117 | |
| 118 | - add_action( 'load_' . $this->oProp->sClassName, array( $this, 'replyToDoPageSettings' ) ); |
|
| 118 | + add_action( 'load_'.$this->oProp->sClassName, array( $this, 'replyToDoPageSettings' ) ); |
|
| 119 | 119 | |
| 120 | 120 | } |
| 121 | 121 | |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | */ |
| 129 | 129 | private function _addActionLinks( $_bAdminPageEnabled, $_aOptions ) { |
| 130 | 130 | |
| 131 | - if ( 'plugins.php' !== $this->oProp->sPageNow ) { |
|
| 131 | + if ( 'plugins.php' !== $this->oProp->sPageNow ) { |
|
| 132 | 132 | return; |
| 133 | 133 | } |
| 134 | 134 | |
@@ -152,24 +152,24 @@ discard block |
||
| 152 | 152 | * @return string |
| 153 | 153 | */ |
| 154 | 154 | private function _getAdminURLTools( $_bAdminPageEnabled ) { |
| 155 | - if ( ! $_bAdminPageEnabled ) { |
|
| 155 | + if ( !$_bAdminPageEnabled ) { |
|
| 156 | 156 | return; |
| 157 | 157 | } |
| 158 | - $_sLink = esc_url( |
|
| 158 | + $_sLink = esc_url( |
|
| 159 | 159 | add_query_arg( |
| 160 | 160 | array( |
| 161 | - 'page' => AdminPageFrameworkLoader_Registry::$aAdminPages['tool'], |
|
| 161 | + 'page' => AdminPageFrameworkLoader_Registry::$aAdminPages[ 'tool' ], |
|
| 162 | 162 | ), |
| 163 | 163 | admin_url( 'admin.php' ) |
| 164 | 164 | ) |
| 165 | 165 | ); |
| 166 | - return "<a href='{$_sLink}'>" . __( 'Tools', 'admin-page-framework-loader' ) . "</a>"; |
|
| 166 | + return "<a href='{$_sLink}'>".__( 'Tools', 'admin-page-framework-loader' )."</a>"; |
|
| 167 | 167 | } |
| 168 | 168 | /** |
| 169 | 169 | * Returns the Enable /Disable Admin Pages link. |
| 170 | 170 | */ |
| 171 | 171 | private function _getAdminPageSwitchLink( $bEnabled ) { |
| 172 | - $_sLink = esc_url( |
|
| 172 | + $_sLink = esc_url( |
|
| 173 | 173 | add_query_arg( |
| 174 | 174 | array( |
| 175 | 175 | 'enable_apfl_admin_pages' => $bEnabled ? 0 : 1, |
@@ -177,19 +177,19 @@ discard block |
||
| 177 | 177 | ) |
| 178 | 178 | ); |
| 179 | 179 | return $bEnabled |
| 180 | - ? "<a href='{$_sLink}'>" . __( 'Disable Admin Pages', 'admin-page-framework-loader' ) . "</a>" |
|
| 181 | - : "<a href='{$_sLink}'>" . __( 'Enable Admin Pages', 'admin-page-framework-loader' ) . "</a>"; |
|
| 180 | + ? "<a href='{$_sLink}'>".__( 'Disable Admin Pages', 'admin-page-framework-loader' )."</a>" |
|
| 181 | + : "<a href='{$_sLink}'>".__( 'Enable Admin Pages', 'admin-page-framework-loader' )."</a>"; |
|
| 182 | 182 | } |
| 183 | 183 | /** |
| 184 | 184 | * Returns the switch link of the demo pages. |
| 185 | 185 | */ |
| 186 | - private function _getDemoSwitcherLink( $_bAdminPageEnabled, $mOptions=array() ) { |
|
| 186 | + private function _getDemoSwitcherLink( $_bAdminPageEnabled, $mOptions = array() ) { |
|
| 187 | 187 | |
| 188 | - if ( ! $_bAdminPageEnabled ) { |
|
| 188 | + if ( !$_bAdminPageEnabled ) { |
|
| 189 | 189 | return ''; |
| 190 | 190 | } |
| 191 | - $_bEnabled = isset( $mOptions['enable_demo'] ) && $mOptions['enable_demo']; |
|
| 192 | - $_sLink = esc_url( |
|
| 191 | + $_bEnabled = isset( $mOptions[ 'enable_demo' ] ) && $mOptions[ 'enable_demo' ]; |
|
| 192 | + $_sLink = esc_url( |
|
| 193 | 193 | add_query_arg( |
| 194 | 194 | array( |
| 195 | 195 | 'enable_apfl_demo_pages' => $_bEnabled ? 0 : 1, |
@@ -197,8 +197,8 @@ discard block |
||
| 197 | 197 | ) |
| 198 | 198 | ); |
| 199 | 199 | return $_bEnabled |
| 200 | - ? "<a href='{$_sLink}'>" . __( 'Disable Demo', 'admin-page-framework-loader' ) . "</a>" |
|
| 201 | - : "<a href='{$_sLink}'><strong id='activate-demo-action-link' style='font-size: 1em;'>" . __( 'Enable Demo', 'admin-page-framework-loader' ) . "</strong></a>"; |
|
| 200 | + ? "<a href='{$_sLink}'>".__( 'Disable Demo', 'admin-page-framework-loader' )."</a>" |
|
| 201 | + : "<a href='{$_sLink}'><strong id='activate-demo-action-link' style='font-size: 1em;'>".__( 'Enable Demo', 'admin-page-framework-loader' )."</strong></a>"; |
|
| 202 | 202 | |
| 203 | 203 | } |
| 204 | 204 | |
@@ -214,14 +214,14 @@ discard block |
||
| 214 | 214 | |
| 215 | 215 | // Page meta boxes |
| 216 | 216 | new AdminPageFrameworkLoader_AdminPageMetaBox_Notification( |
| 217 | - null, // meta box id - passing null will make it auto generate |
|
| 217 | + null, // meta box id - passing null will make it auto generate |
|
| 218 | 218 | __( 'Notification', 'admin-page-framework-loader' ), // title |
| 219 | 219 | array( // page slugs |
| 220 | 220 | AdminPageFrameworkLoader_Registry::$aAdminPages[ 'tool' ], |
| 221 | 221 | AdminPageFrameworkLoader_Registry::$aAdminPages[ 'addon' ], |
| 222 | 222 | AdminPageFrameworkLoader_Registry::$aAdminPages[ 'help' ], |
| 223 | 223 | ), |
| 224 | - 'side', // context |
|
| 224 | + 'side', // context |
|
| 225 | 225 | 'default' // priority |
| 226 | 226 | ); |
| 227 | 227 | |
@@ -19,8 +19,8 @@ |
||
| 19 | 19 | public function replyToLoadPage( $oFactory ) { |
| 20 | 20 | |
| 21 | 21 | new AdminPageFrameworkLoader_AdminPage_Addon_Top( |
| 22 | - $oFactory, // factory object |
|
| 23 | - $this->sPageSlug, // page slug |
|
| 22 | + $oFactory, // factory object |
|
| 23 | + $this->sPageSlug, // page slug |
|
| 24 | 24 | array( // tab definition |
| 25 | 25 | 'tab_slug' => 'top', |
| 26 | 26 | 'title' => __( 'Add Ons', 'admin-page-framework-loader' ), |
@@ -21,8 +21,8 @@ |
||
| 21 | 21 | public function replyToDoTab( /* $oFactory */ ) { |
| 22 | 22 | |
| 23 | 23 | echo $this->_getReadmeContents( |
| 24 | - AdminPageFrameworkLoader_Registry::$sDirPath . '/asset/text/about.txt', |
|
| 25 | - '', // no TOC |
|
| 24 | + AdminPageFrameworkLoader_Registry::$sDirPath.'/asset/text/about.txt', |
|
| 25 | + '', // no TOC |
|
| 26 | 26 | array( 'Support' ) |
| 27 | 27 | ); |
| 28 | 28 | |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | $this->sTabSlug = $aSectionDefinition[ 'tab_slug' ]; |
| 48 | 48 | $this->sSectionID = $aSectionDefinition[ 'section_id' ]; |
| 49 | 49 | |
| 50 | - if ( ! $this->sSectionID ) { |
|
| 50 | + if ( !$this->sSectionID ) { |
|
| 51 | 51 | return; |
| 52 | 52 | } |
| 53 | 53 | $this->_addSection( $oFactory, $sPageSlug, $aSectionDefinition ); |
@@ -60,14 +60,14 @@ discard block |
||
| 60 | 60 | |
| 61 | 61 | add_action( |
| 62 | 62 | // 'validation_' . $this->sPageSlug . '_' . $this->sTabSlug, |
| 63 | - 'validation_' . $oFactory->oProp->sClassName . '_' . $this->sSectionID, |
|
| 63 | + 'validation_'.$oFactory->oProp->sClassName.'_'.$this->sSectionID, |
|
| 64 | 64 | array( $this, 'validate' ), |
| 65 | 65 | 10, |
| 66 | 66 | 4 |
| 67 | 67 | ); |
| 68 | 68 | |
| 69 | 69 | $oFactory->addSettingSections( |
| 70 | - $sPageSlug, // target page slug |
|
| 70 | + $sPageSlug, // target page slug |
|
| 71 | 71 | $aSectionDefinition |
| 72 | 72 | ); |
| 73 | 73 | |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | $_aErrors = array(); |
| 97 | 97 | |
| 98 | 98 | // An invalid value is found. Set a field error array and an admin notice and return the old values. |
| 99 | - if ( ! $_bVerified ) { |
|
| 99 | + if ( !$_bVerified ) { |
|
| 100 | 100 | $oFactory->setFieldErrors( $_aErrors ); |
| 101 | 101 | $oFactory->setSettingNotice( __( 'There was something wrong with your input.', 'admin-page-framework-loader' ) ); |
| 102 | 102 | return $aOldInput; |
@@ -28,11 +28,11 @@ discard block |
||
| 28 | 28 | * Stores the option values. |
| 29 | 29 | */ |
| 30 | 30 | public $aOptions = array( |
| 31 | - 'welcomed' => false, // if the welcome screen is displayed, this will be true. |
|
| 32 | - 'enable_admin_pages' => true, // whether or not to enable the admin pages of the loader plugin. |
|
| 31 | + 'welcomed' => false, // if the welcome screen is displayed, this will be true. |
|
| 32 | + 'enable_admin_pages' => true, // whether or not to enable the admin pages of the loader plugin. |
|
| 33 | 33 | 'enable_demo' => false, |
| 34 | - 'version_upgraded_from' => null, // the version number that the user has upgraded from |
|
| 35 | - 'version_saved' => null, // represents the option version. |
|
| 34 | + 'version_upgraded_from' => null, // the version number that the user has upgraded from |
|
| 35 | + 'version_saved' => null, // represents the option version. |
|
| 36 | 36 | ); |
| 37 | 37 | |
| 38 | 38 | /** |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | * |
| 53 | 53 | * @since 3.5.0 |
| 54 | 54 | */ |
| 55 | - static public function getInstance( $sOptionKey='' ) { |
|
| 55 | + static public function getInstance( $sOptionKey = '' ) { |
|
| 56 | 56 | |
| 57 | 57 | $sOptionKey = $sOptionKey |
| 58 | 58 | ? $sOptionKey |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | */ |
| 74 | 74 | public function __construct( $sOptionKey ) { |
| 75 | 75 | |
| 76 | - $this->bIsNetworkAdmin = is_network_admin(); // must be done first |
|
| 76 | + $this->bIsNetworkAdmin = is_network_admin(); // must be done first |
|
| 77 | 77 | $this->sOptionKey = $sOptionKey; |
| 78 | 78 | $this->aOptions = $this->_getFormattedOptions( $sOptionKey ); |
| 79 | 79 | |
@@ -98,8 +98,8 @@ discard block |
||
| 98 | 98 | */ |
| 99 | 99 | public function hasUpgraded() { |
| 100 | 100 | |
| 101 | - $_sOptionVersion = $this->get( 'version_saved' ); |
|
| 102 | - if ( ! $_sOptionVersion ) { |
|
| 101 | + $_sOptionVersion = $this->get( 'version_saved' ); |
|
| 102 | + if ( !$_sOptionVersion ) { |
|
| 103 | 103 | return false; |
| 104 | 104 | } |
| 105 | 105 | $_sOptionVersion = $this->_getVersionByDepth( $_sOptionVersion ); |
@@ -111,8 +111,8 @@ discard block |
||
| 111 | 111 | * Returns a stating part of version by the given depth. |
| 112 | 112 | * @since 3.5.0 |
| 113 | 113 | */ |
| 114 | - private function _getVersionByDepth( $sVersion, $iDepth=2 ) { |
|
| 115 | - if ( ! $iDepth ) { |
|
| 114 | + private function _getVersionByDepth( $sVersion, $iDepth = 2 ) { |
|
| 115 | + if ( !$iDepth ) { |
|
| 116 | 116 | return $sVersion; |
| 117 | 117 | } |
| 118 | 118 | $_aParts = explode( '.', $sVersion ); |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | /** |
| 124 | 124 | * Deletes the option from the database. |
| 125 | 125 | */ |
| 126 | - public function delete() { |
|
| 126 | + public function delete() { |
|
| 127 | 127 | return $this->bIsNetworkAdmin |
| 128 | 128 | ? delete_site_option( $this->sOptionKey ) |
| 129 | 129 | : delete_option( $this->sOptionKey ); |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | /** |
| 133 | 133 | * Saves the options. |
| 134 | 134 | */ |
| 135 | - public function save( $aOptions=null ) { |
|
| 135 | + public function save( $aOptions = null ) { |
|
| 136 | 136 | |
| 137 | 137 | $_aOptions = $aOptions ? $aOptions : $this->aOptions; |
| 138 | 138 | return $this->bIsNetworkAdmin |
@@ -151,15 +151,15 @@ discard block |
||
| 151 | 151 | */ |
| 152 | 152 | public function set( /* $asKeys, $mValue */ ) { |
| 153 | 153 | |
| 154 | - $_aParameters = func_get_args(); |
|
| 155 | - if ( ! isset( $_aParameters[ 0 ], $_aParameters[ 1 ] ) ) { |
|
| 154 | + $_aParameters = func_get_args(); |
|
| 155 | + if ( !isset( $_aParameters[ 0 ], $_aParameters[ 1 ] ) ) { |
|
| 156 | 156 | return; |
| 157 | 157 | } |
| 158 | 158 | $_asKeys = $_aParameters[ 0 ]; |
| 159 | 159 | $_mValue = $_aParameters[ 1 ]; |
| 160 | 160 | |
| 161 | 161 | // string, integer, float, boolean |
| 162 | - if ( ! is_array( $_asKeys ) ) { |
|
| 162 | + if ( !is_array( $_asKeys ) ) { |
|
| 163 | 163 | $this->aOptions[ $_asKeys ] = $_mValue; |
| 164 | 164 | return; |
| 165 | 165 | } |
@@ -174,8 +174,8 @@ discard block |
||
| 174 | 174 | */ |
| 175 | 175 | public function update( /* $asKeys, $mValue */ ) { |
| 176 | 176 | |
| 177 | - $_aParameters = func_get_args(); |
|
| 178 | - call_user_func_array( array( $this, 'set' ), $_aParameters ); |
|
| 177 | + $_aParameters = func_get_args(); |
|
| 178 | + call_user_func_array( array( $this, 'set' ), $_aParameters ); |
|
| 179 | 179 | $this->save(); |
| 180 | 180 | |
| 181 | 181 | } |
@@ -189,11 +189,11 @@ discard block |
||
| 189 | 189 | |
| 190 | 190 | $_mDefault = null; |
| 191 | 191 | $_aKeys = func_get_args(); |
| 192 | - if ( ! isset( $_aKeys[ 0 ] ) ) { |
|
| 192 | + if ( !isset( $_aKeys[ 0 ] ) ) { |
|
| 193 | 193 | return null; |
| 194 | 194 | } |
| 195 | 195 | if ( is_array( $_aKeys[ 0 ] ) ) { |
| 196 | - $_aKeys = $_aKeys[ 0 ]; |
|
| 196 | + $_aKeys = $_aKeys[ 0 ]; |
|
| 197 | 197 | $_mDefault = isset( $_aKeys[ 1 ] ) |
| 198 | 198 | ? $_aKeys[ 1 ] |
| 199 | 199 | : null; |
@@ -123,7 +123,7 @@ |
||
| 123 | 123 | /** |
| 124 | 124 | * Deletes the option from the database. |
| 125 | 125 | */ |
| 126 | - public function delete() { |
|
| 126 | + public function delete() { |
|
| 127 | 127 | return $this->bIsNetworkAdmin |
| 128 | 128 | ? delete_site_option( $this->sOptionKey ) |
| 129 | 129 | : delete_option( $this->sOptionKey ); |
@@ -20,5 +20,5 @@ |
||
| 20 | 20 | * @extends AdminPageFramework_Resource_post_meta_box |
| 21 | 21 | * @internal |
| 22 | 22 | */ |
| 23 | -class AdminPageFramework_Resource_user_meta extends AdminPageFramework_Resource_post_meta_box { |
|
| 23 | +class AdminPageFramework_Resource_user_meta extends AdminPageFramework_Resource_post_meta_box { |
|
| 24 | 24 | } |