@@ -23,6 +23,7 @@ |
||
| 23 | 23 | * Sets up internal properties. |
| 24 | 24 | * |
| 25 | 25 | * @since 3.2.0 |
| 26 | + * @param AdminPageFramework_Widget_Model $oCaller |
|
| 26 | 27 | * @return void |
| 27 | 28 | */ |
| 28 | 29 | public function __construct( $oCaller, $sWidgetTitle, array $aArguments=array() ) { |
@@ -25,21 +25,21 @@ discard block |
||
| 25 | 25 | * @since 3.2.0 |
| 26 | 26 | * @return void |
| 27 | 27 | */ |
| 28 | - public function __construct( $oCaller, $sWidgetTitle, array $aArguments=array() ) { |
|
| 28 | + public function __construct( $oCaller, $sWidgetTitle, array $aArguments=array() ) { |
|
| 29 | 29 | |
| 30 | 30 | $aArguments = $aArguments |
| 31 | 31 | + array( |
| 32 | 32 | 'classname' => 'admin_page_framework_widget', |
| 33 | 33 | 'description' => '', |
| 34 | 34 | ); |
| 35 | - parent::__construct( |
|
| 35 | + parent::__construct( |
|
| 36 | 36 | $oCaller->oProp->sClassName, // base id |
| 37 | 37 | $sWidgetTitle, // widget title |
| 38 | 38 | $aArguments // widget arguments |
| 39 | 39 | ); |
| 40 | 40 | $this->oCaller = $oCaller; |
| 41 | 41 | |
| 42 | - } |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | 44 | /** |
| 45 | 45 | * Displays the widget contents in the front end. |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | * whether the title should be visible or not depending on the content. |
| 50 | 50 | * @return void |
| 51 | 51 | */ |
| 52 | - public function widget( $aArguments, $aFormData ) { |
|
| 52 | + public function widget( $aArguments, $aFormData ) { |
|
| 53 | 53 | |
| 54 | 54 | echo $aArguments[ 'before_widget' ]; |
| 55 | 55 | |
@@ -72,9 +72,9 @@ discard block |
||
| 72 | 72 | |
| 73 | 73 | echo $_sContent; |
| 74 | 74 | |
| 75 | - echo $aArguments[ 'after_widget' ]; |
|
| 75 | + echo $aArguments[ 'after_widget' ]; |
|
| 76 | 76 | |
| 77 | - } |
|
| 77 | + } |
|
| 78 | 78 | /** |
| 79 | 79 | * Returns the widget title. |
| 80 | 80 | * |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | if ( ! $_sTitle ) { |
| 104 | 104 | return ''; |
| 105 | 105 | } |
| 106 | - return $aArguments['before_title'] |
|
| 106 | + return $aArguments['before_title'] |
|
| 107 | 107 | . $_sTitle |
| 108 | 108 | . $aArguments['after_title']; |
| 109 | 109 | |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | * @since 3.2.0 |
| 116 | 116 | * @return mixed The validated form data. The type should be an array but it is dealt by the framework user it will be unknown. |
| 117 | 117 | */ |
| 118 | - public function update( $aSubmittedFormData, $aSavedFormData ) { |
|
| 118 | + public function update( $aSubmittedFormData, $aSavedFormData ) { |
|
| 119 | 119 | |
| 120 | 120 | return $this->oCaller->oUtil->addAndApplyFilters( |
| 121 | 121 | $this->oCaller, |
@@ -128,14 +128,14 @@ discard block |
||
| 128 | 128 | $this->oCaller |
| 129 | 129 | ); |
| 130 | 130 | |
| 131 | - } |
|
| 131 | + } |
|
| 132 | 132 | |
| 133 | 133 | /** |
| 134 | 134 | * Constructs the widget form. |
| 135 | 135 | * |
| 136 | 136 | * @return void |
| 137 | 137 | */ |
| 138 | - public function form( $aFormData ) { |
|
| 138 | + public function form( $aFormData ) { |
|
| 139 | 139 | |
| 140 | 140 | // Trigger the load() method and load_{...} actions. The user sets up the form. |
| 141 | 141 | $this->oCaller->load( $this->oCaller ); |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | // $this->oCaller |
| 194 | 194 | // ); |
| 195 | 195 | |
| 196 | - } |
|
| 196 | + } |
|
| 197 | 197 | |
| 198 | 198 | /** |
| 199 | 199 | * |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | * @since 3.2.0 |
| 26 | 26 | * @return void |
| 27 | 27 | */ |
| 28 | - public function __construct( $oCaller, $sWidgetTitle, array $aArguments=array() ) { |
|
| 28 | + public function __construct( $oCaller, $sWidgetTitle, array $aArguments = array() ) { |
|
| 29 | 29 | |
| 30 | 30 | $aArguments = $aArguments |
| 31 | 31 | + array( |
@@ -34,17 +34,17 @@ discard block |
||
| 34 | 34 | ); |
| 35 | 35 | |
| 36 | 36 | parent::__construct( |
| 37 | - $oCaller->oProp->sClassName, // base id |
|
| 38 | - $sWidgetTitle, // widget title |
|
| 37 | + $oCaller->oProp->sClassName, // base id |
|
| 38 | + $sWidgetTitle, // widget title |
|
| 39 | 39 | $aArguments // widget arguments |
| 40 | 40 | ); |
| 41 | 41 | $this->oCaller = $oCaller; |
| 42 | 42 | |
| 43 | 43 | // Set up callbacks for field element outputs such as for name and it attributes. |
| 44 | 44 | $this->oCaller->oProp->aFormCallbacks = array( |
| 45 | - 'hfID' => array( $this, 'get_field_id' ), // defined in the WP_Widget class. |
|
| 46 | - 'hfTagID' => array( $this, 'get_field_id' ), // defined in the WP_Widget class. |
|
| 47 | - 'hfName' => array( $this, '_replyToGetFieldName' ), // defined in the WP_Widget class. |
|
| 45 | + 'hfID' => array( $this, 'get_field_id' ), // defined in the WP_Widget class. |
|
| 46 | + 'hfTagID' => array( $this, 'get_field_id' ), // defined in the WP_Widget class. |
|
| 47 | + 'hfName' => array( $this, '_replyToGetFieldName' ), // defined in the WP_Widget class. |
|
| 48 | 48 | 'hfInputName' => array( $this, '_replyToGetFieldInputName' ), |
| 49 | 49 | // 'hfClass' => array( $this, '_replyToAddClassSelector' ), |
| 50 | 50 | // 'hfNameFlat' => array( $this, '_replyToGetFlatFieldName' ), // @deprecated 3.6.0+ the same as the framework factory method. |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | |
| 69 | 69 | $this->oCaller->oUtil->addAndDoActions( |
| 70 | 70 | $this->oCaller, |
| 71 | - 'do_' . $this->oCaller->oProp->sClassName, |
|
| 71 | + 'do_'.$this->oCaller->oProp->sClassName, |
|
| 72 | 72 | $this->oCaller |
| 73 | 73 | ); |
| 74 | 74 | |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | */ |
| 100 | 100 | private function _getTitle( array $aArguments, array $aFormData ) { |
| 101 | 101 | |
| 102 | - if ( ! $this->oCaller->oProp->bShowWidgetTitle ) { |
|
| 102 | + if ( !$this->oCaller->oProp->bShowWidgetTitle ) { |
|
| 103 | 103 | return ''; |
| 104 | 104 | } |
| 105 | 105 | |
@@ -113,12 +113,12 @@ discard block |
||
| 113 | 113 | $aFormData, |
| 114 | 114 | $this->id_base |
| 115 | 115 | ); |
| 116 | - if ( ! $_sTitle ) { |
|
| 116 | + if ( !$_sTitle ) { |
|
| 117 | 117 | return ''; |
| 118 | 118 | } |
| 119 | - return $aArguments['before_title'] |
|
| 119 | + return $aArguments[ 'before_title' ] |
|
| 120 | 120 | . $_sTitle |
| 121 | - . $aArguments['after_title']; |
|
| 121 | + . $aArguments[ 'after_title' ]; |
|
| 122 | 122 | |
| 123 | 123 | } |
| 124 | 124 | |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | $this->oCaller, |
| 135 | 135 | "validation_{$this->oCaller->oProp->sClassName}", |
| 136 | 136 | call_user_func_array( |
| 137 | - array( $this->oCaller, 'validate' ), // triggers __call() |
|
| 137 | + array( $this->oCaller, 'validate' ), // triggers __call() |
|
| 138 | 138 | array( $aSubmittedFormData, $aSavedFormData, $this->oCaller ) // parameters |
| 139 | 139 | ), // 3.5.3+ |
| 140 | 140 | $aSavedFormData, |
@@ -179,8 +179,8 @@ discard block |
||
| 179 | 179 | $this->oCaller->oForm = new AdminPageFramework_Form_widget( |
| 180 | 180 | array( |
| 181 | 181 | 'register_if_action_already_done' => false, // do not register fields right away |
| 182 | - ) + $this->oCaller->oProp->aFormArguments, // form arguments |
|
| 183 | - $this->oCaller->oProp->aFormCallbacks, // callbacks |
|
| 182 | + ) + $this->oCaller->oProp->aFormArguments, // form arguments |
|
| 183 | + $this->oCaller->oProp->aFormCallbacks, // callbacks |
|
| 184 | 184 | $this->oCaller->oMsg |
| 185 | 185 | ); |
| 186 | 186 | |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | $this->oCaller->oUtil->addAndDoActions( |
| 199 | 199 | $this->oCaller, |
| 200 | 200 | array( |
| 201 | - 'load_' . $this->oCaller->oProp->sClassName, |
|
| 201 | + 'load_'.$this->oCaller->oProp->sClassName, |
|
| 202 | 202 | ), |
| 203 | 203 | $this->oCaller |
| 204 | 204 | ); |
@@ -217,12 +217,12 @@ discard block |
||
| 217 | 217 | $_aParams = func_get_args() + array( null, null, null ); |
| 218 | 218 | $aField = $_aParams[ 1 ]; |
| 219 | 219 | |
| 220 | - $_sSectionIndex = isset( $aField['section_id'], $aField['_section_index'] ) |
|
| 221 | - ? "[{$aField['_section_index']}]" |
|
| 220 | + $_sSectionIndex = isset( $aField[ 'section_id' ], $aField[ '_section_index' ] ) |
|
| 221 | + ? "[{$aField[ '_section_index' ]}]" |
|
| 222 | 222 | : ""; |
| 223 | 223 | $_sID = $this->oCaller->isSectionSet( $aField ) |
| 224 | - ? $aField['section_id'] . "]" . $_sSectionIndex . "[" . $aField[ 'field_id' ] |
|
| 225 | - : $aField['field_id']; |
|
| 224 | + ? $aField[ 'section_id' ]."]".$_sSectionIndex."[".$aField[ 'field_id' ] |
|
| 225 | + : $aField[ 'field_id' ]; |
|
| 226 | 226 | return $this->get_field_name( $_sID ); |
| 227 | 227 | |
| 228 | 228 | } |
@@ -241,15 +241,15 @@ discard block |
||
| 241 | 241 | $_sIndex = $this->oCaller->oUtil->getAOrB( |
| 242 | 242 | '0' !== $sIndex && empty( $sIndex ), |
| 243 | 243 | '', |
| 244 | - "[" . $sIndex . "]" |
|
| 244 | + "[".$sIndex."]" |
|
| 245 | 245 | ); |
| 246 | - $_sSectionIndex = isset( $aField['section_id'], $aField['_section_index'] ) |
|
| 247 | - ? "[{$aField['_section_index']}]" |
|
| 246 | + $_sSectionIndex = isset( $aField[ 'section_id' ], $aField[ '_section_index' ] ) |
|
| 247 | + ? "[{$aField[ '_section_index' ]}]" |
|
| 248 | 248 | : ""; |
| 249 | 249 | $_sID = $this->oCaller->isSectionSet( $aField ) |
| 250 | - ? $aField['section_id'] . "]" . $_sSectionIndex . "[" . $aField[ 'field_id' ] |
|
| 250 | + ? $aField[ 'section_id' ]."]".$_sSectionIndex."[".$aField[ 'field_id' ] |
|
| 251 | 251 | : $aField[ 'field_id' ]; |
| 252 | - return $this->get_field_name( $_sID ) . $_sIndex; |
|
| 252 | + return $this->get_field_name( $_sID ).$_sIndex; |
|
| 253 | 253 | |
| 254 | 254 | } |
| 255 | 255 | |
@@ -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 | |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | * @param string $sSetUpHook The action hook name for the setUp callback. Default 'plugins_loaded'. |
| 41 | 41 | * @param string $iPriority The priority. Set a lower number to get loader earlier. Default: `10`. |
| 42 | 42 | */ |
| 43 | - public function __construct( $sPluginFilePath, $sPluginHookPrefix='', $sSetUpHook='plugins_loaded', $iPriority=10 ) { |
|
| 43 | + public function __construct( $sPluginFilePath, $sPluginHookPrefix = '', $sSetUpHook = 'plugins_loaded', $iPriority = 10 ) { |
|
| 44 | 44 | |
| 45 | 45 | // Check if it has been loaded. |
| 46 | 46 | if ( $this->_hasLoaded() ) { |
@@ -76,7 +76,7 @@ discard block |
||
| 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 ); |
@@ -113,13 +113,13 @@ discard block |
||
| 113 | 113 | */ |
| 114 | 114 | protected function _registerClasses() { |
| 115 | 115 | |
| 116 | - if ( ! class_exists( 'AdminPageFramework_RegisterClasses' ) ) { |
|
| 116 | + if ( !class_exists( 'AdminPageFramework_RegisterClasses' ) ) { |
|
| 117 | 117 | return; |
| 118 | 118 | } |
| 119 | 119 | // Register classes |
| 120 | 120 | new AdminPageFramework_RegisterClasses( |
| 121 | - $this->getScanningDirs(), // scanning directory paths |
|
| 122 | - array(), // autoloader options |
|
| 121 | + $this->getScanningDirs(), // scanning directory paths |
|
| 122 | + array(), // autoloader options |
|
| 123 | 123 | $this->getClasses() // pre-generated class list |
| 124 | 124 | ); |
| 125 | 125 | |
@@ -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 ); |
@@ -134,6 +134,7 @@ discard block |
||
| 134 | 134 | * Returns a php warning if present. |
| 135 | 135 | * @since 3.5.3 |
| 136 | 136 | * @internal |
| 137 | + * @param string $sType |
|
| 137 | 138 | * @return string The warning. |
| 138 | 139 | */ |
| 139 | 140 | private function _getWarningByType( $sType ) { |
@@ -226,6 +227,7 @@ discard block |
||
| 226 | 227 | * if it returns non true (false), it stores the subject warning and returns the array holding the warnings. |
| 227 | 228 | * |
| 228 | 229 | * @since 3.4.6 |
| 230 | + * @param string $sFuncName |
|
| 229 | 231 | * @return array The warning array. |
| 230 | 232 | */ |
| 231 | 233 | private function _getWarningsByFunctionName( $sFuncName, $aSubjects ) { |
@@ -285,6 +287,7 @@ discard block |
||
| 285 | 287 | /** |
| 286 | 288 | * Deactivates the plugin. |
| 287 | 289 | * @since 3.4.6 |
| 290 | + * @param string $sPluginFilePath |
|
| 288 | 291 | */ |
| 289 | 292 | public function deactivatePlugin( $sPluginFilePath, $sMessage='', $bIsOnActivation=false ) { |
| 290 | 293 | |
@@ -278,7 +278,7 @@ |
||
| 278 | 278 | ? "<strong>" . $this->_sScriptName . "</strong>: " |
| 279 | 279 | : ''; |
| 280 | 280 | return $_sScripTitle |
| 281 | - . implode( '<br />', $_aWarnings ); |
|
| 281 | + . implode( '<br />', $_aWarnings ); |
|
| 282 | 282 | |
| 283 | 283 | } |
| 284 | 284 | |
@@ -76,12 +76,12 @@ discard block |
||
| 76 | 76 | * |
| 77 | 77 | * @since 3.4.6 |
| 78 | 78 | */ |
| 79 | - public function __construct( array $aRequirements=array(), $sScriptName='' ) { |
|
| 79 | + public function __construct( array $aRequirements = array(), $sScriptName = '' ) { |
|
| 80 | 80 | |
| 81 | 81 | // Avoid undefined index warnings. |
| 82 | 82 | $aRequirements = $aRequirements + $this->_aDefaultRequirements; |
| 83 | 83 | $aRequirements = array_filter( $aRequirements, 'is_array' ); |
| 84 | - foreach( array( 'php', 'mysql', 'wordpress' ) as $_iIndex => $_sName ) { |
|
| 84 | + foreach ( array( 'php', 'mysql', 'wordpress' ) as $_iIndex => $_sName ) { |
|
| 85 | 85 | if ( isset( $aRequirements[ $_sName ] ) ) { |
| 86 | 86 | $aRequirements[ $_sName ] = $aRequirements[ $_sName ] + $this->_aDefaultRequirements[ $_sName ]; |
| 87 | 87 | } |
@@ -105,9 +105,9 @@ discard block |
||
| 105 | 105 | $_aWarnings = array(); |
| 106 | 106 | |
| 107 | 107 | // PHP, WordPress, MySQL |
| 108 | - $_aWarnings[] = $this->_getWarningByType( 'php' ); |
|
| 109 | - $_aWarnings[] = $this->_getWarningByType( 'wordpress' ); |
|
| 110 | - $_aWarnings[] = $this->_getWarningByType( 'mysql' ); |
|
| 108 | + $_aWarnings[ ] = $this->_getWarningByType( 'php' ); |
|
| 109 | + $_aWarnings[ ] = $this->_getWarningByType( 'wordpress' ); |
|
| 110 | + $_aWarnings[ ] = $this->_getWarningByType( 'mysql' ); |
|
| 111 | 111 | |
| 112 | 112 | // Ensure necessary array elements. |
| 113 | 113 | $this->_aRequirements = $this->_aRequirements + array( |
@@ -120,10 +120,10 @@ discard block |
||
| 120 | 120 | // Check the rest. |
| 121 | 121 | $_aWarnings = array_merge( |
| 122 | 122 | $_aWarnings, |
| 123 | - $this->_checkFunctions( $this->_aRequirements['functions'] ), |
|
| 124 | - $this->_checkClasses( $this->_aRequirements['classes'] ), |
|
| 125 | - $this->_checkConstants( $this->_aRequirements['constants'] ), |
|
| 126 | - $this->_checkFiles( $this->_aRequirements['files'] ) |
|
| 123 | + $this->_checkFunctions( $this->_aRequirements[ 'functions' ] ), |
|
| 124 | + $this->_checkClasses( $this->_aRequirements[ 'classes' ] ), |
|
| 125 | + $this->_checkConstants( $this->_aRequirements[ 'constants' ] ), |
|
| 126 | + $this->_checkFiles( $this->_aRequirements[ 'files' ] ) |
|
| 127 | 127 | ); |
| 128 | 128 | |
| 129 | 129 | $this->aWarnings = array_filter( $_aWarnings ); // drop empty elements. |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | * @return string The warning. |
| 138 | 138 | */ |
| 139 | 139 | private function _getWarningByType( $sType ) { |
| 140 | - if ( ! isset( $this->_aRequirements[ $sType ][ 'version' ] ) ) { |
|
| 140 | + if ( !isset( $this->_aRequirements[ $sType ][ 'version' ] ) ) { |
|
| 141 | 141 | return ''; |
| 142 | 142 | } |
| 143 | 143 | if ( $this->_checkPHPVersion( $this->_aRequirements[ $sType ][ 'version' ] ) ) { |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | * @since 3.4.6 |
| 165 | 165 | */ |
| 166 | 166 | private function _checkWordPressVersion( $sWordPressVersion ) { |
| 167 | - return version_compare( $GLOBALS['wp_version'], $sWordPressVersion, ">=" ); |
|
| 167 | + return version_compare( $GLOBALS[ 'wp_version' ], $sWordPressVersion, ">=" ); |
|
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | /** |
@@ -230,9 +230,9 @@ discard block |
||
| 230 | 230 | */ |
| 231 | 231 | private function _getWarningsByFunctionName( $sFuncName, $aSubjects ) { |
| 232 | 232 | $_aWarnings = array(); |
| 233 | - foreach( $aSubjects as $_sSubject => $_sWarning ) { |
|
| 234 | - if ( ! call_user_func_array( $sFuncName, array( $_sSubject ) ) ) { |
|
| 235 | - $_aWarnings[] = sprintf( $_sWarning, $_sSubject ); |
|
| 233 | + foreach ( $aSubjects as $_sSubject => $_sWarning ) { |
|
| 234 | + if ( !call_user_func_array( $sFuncName, array( $_sSubject ) ) ) { |
|
| 235 | + $_aWarnings[ ] = sprintf( $_sWarning, $_sSubject ); |
|
| 236 | 236 | } |
| 237 | 237 | } |
| 238 | 238 | return $_aWarnings; |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | */ |
| 253 | 253 | public function _replyToPrintAdminNotices() { |
| 254 | 254 | |
| 255 | - $_aWarnings = array_unique( $this->aWarnings ); |
|
| 255 | + $_aWarnings = array_unique( $this->aWarnings ); |
|
| 256 | 256 | if ( empty( $_aWarnings ) ) { |
| 257 | 257 | return; |
| 258 | 258 | } |
@@ -270,12 +270,12 @@ discard block |
||
| 270 | 270 | */ |
| 271 | 271 | private function _getWarnings() { |
| 272 | 272 | |
| 273 | - $_aWarnings = array_unique( $this->aWarnings ); |
|
| 273 | + $_aWarnings = array_unique( $this->aWarnings ); |
|
| 274 | 274 | if ( empty( $_aWarnings ) ) { |
| 275 | 275 | return ''; |
| 276 | 276 | } |
| 277 | - $_sScripTitle = $this->_sScriptName |
|
| 278 | - ? "<strong>" . $this->_sScriptName . "</strong>: " |
|
| 277 | + $_sScripTitle = $this->_sScriptName |
|
| 278 | + ? "<strong>".$this->_sScriptName."</strong>: " |
|
| 279 | 279 | : ''; |
| 280 | 280 | return $_sScripTitle |
| 281 | 281 | . implode( '<br />', $_aWarnings ); |
@@ -286,12 +286,12 @@ discard block |
||
| 286 | 286 | * Deactivates the plugin. |
| 287 | 287 | * @since 3.4.6 |
| 288 | 288 | */ |
| 289 | - public function deactivatePlugin( $sPluginFilePath, $sMessage='', $bIsOnActivation=false ) { |
|
| 289 | + public function deactivatePlugin( $sPluginFilePath, $sMessage = '', $bIsOnActivation = false ) { |
|
| 290 | 290 | |
| 291 | 291 | add_action( 'admin_notices', array( $this, '_replyToPrintAdminNotices' ) ); |
| 292 | - $this->aWarnings[] = '<strong>' . $sMessage . '</strong>'; |
|
| 293 | - if ( ! function_exists( 'deactivate_plugins' ) ) { |
|
| 294 | - if ( ! @include( ABSPATH . '/wp-admin/includes/plugin.php' ) ) { |
|
| 292 | + $this->aWarnings[ ] = '<strong>'.$sMessage.'</strong>'; |
|
| 293 | + if ( !function_exists( 'deactivate_plugins' ) ) { |
|
| 294 | + if ( !@include( ABSPATH.'/wp-admin/includes/plugin.php' ) ) { |
|
| 295 | 295 | return; |
| 296 | 296 | } |
| 297 | 297 | } |
@@ -301,8 +301,8 @@ discard block |
||
| 301 | 301 | // Before that, we can display messages to the user. |
| 302 | 302 | if ( $bIsOnActivation ) { |
| 303 | 303 | |
| 304 | - $_sPluginListingPage = add_query_arg( array(), $GLOBALS['pagenow'] ); |
|
| 305 | - wp_die( $this->_getWarnings() . "<p><a href='$_sPluginListingPage'>Go back</a>.</p>" ); |
|
| 304 | + $_sPluginListingPage = add_query_arg( array(), $GLOBALS[ 'pagenow' ] ); |
|
| 305 | + wp_die( $this->_getWarnings()."<p><a href='$_sPluginListingPage'>Go back</a>.</p>" ); |
|
| 306 | 306 | |
| 307 | 307 | } |
| 308 | 308 | |
@@ -100,7 +100,7 @@ |
||
| 100 | 100 | * @since 3.4.6 |
| 101 | 101 | * @return integer The number of warnings. |
| 102 | 102 | */ |
| 103 | - public function check() { |
|
| 103 | + public function check() { |
|
| 104 | 104 | |
| 105 | 105 | $_aWarnings = array(); |
| 106 | 106 | |
@@ -81,7 +81,6 @@ discard block |
||
| 81 | 81 | * 'code_block' => ..., |
| 82 | 82 | * |
| 83 | 83 | * )` |
| 84 | - * @param array $aOptions The options array which determines the behaviour of the class. |
|
| 85 | 84 | * @since 3.5.0 |
| 86 | 85 | * @since 3.6.0 Made it accept string content to be passed to the first parameter. |
| 87 | 86 | */ |
@@ -156,6 +155,7 @@ discard block |
||
| 156 | 155 | * Returns the parsed text. |
| 157 | 156 | * @since 3.5.0 |
| 158 | 157 | * @internal |
| 158 | + * @param string $sContent |
|
| 159 | 159 | */ |
| 160 | 160 | private function _getParsedText( $sContent ) { |
| 161 | 161 | |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | * @since 3.5.0 |
| 86 | 86 | * @since 3.6.0 Made it accept string content to be passed to the first parameter. |
| 87 | 87 | */ |
| 88 | - public function __construct( $sFilePathOrContent='', array $aReplacements=array(), array $aCallbacks=array() ) { |
|
| 88 | + public function __construct( $sFilePathOrContent = '', array $aReplacements = array(), array $aCallbacks = array() ) { |
|
| 89 | 89 | |
| 90 | 90 | $this->sText = file_exists( $sFilePathOrContent ) |
| 91 | 91 | ? file_get_contents( $sFilePathOrContent ) |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | '/^[\s]*==[\s]*(.+?)[\s]*==/m', |
| 122 | 122 | $sText, |
| 123 | 123 | -1, |
| 124 | - PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY |
|
| 124 | + PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY |
|
| 125 | 125 | ); |
| 126 | 126 | return $_aSections; |
| 127 | 127 | } |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | * @since 3.5.0 |
| 133 | 133 | * @return string |
| 134 | 134 | */ |
| 135 | - public function get( $sSectionName='' ) { |
|
| 135 | + public function get( $sSectionName = '' ) { |
|
| 136 | 136 | return $sSectionName |
| 137 | 137 | ? $this->getSection( $sSectionName ) |
| 138 | 138 | : $this->_getParsedText( $this->sText ); |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | */ |
| 195 | 195 | public function _replyToReplaceCodeBlocks( $aMatches ) { |
| 196 | 196 | |
| 197 | - if ( ! isset( $aMatches[ 1 ] ) ) { |
|
| 197 | + if ( !isset( $aMatches[ 1 ] ) ) { |
|
| 198 | 198 | return $aMatches[ 0 ]; |
| 199 | 199 | } |
| 200 | 200 | |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | */ |
| 218 | 218 | public function getRawSection( $sSectionName ) { |
| 219 | 219 | |
| 220 | - $_iIndex = array_search( $sSectionName, $this->_aSections ); |
|
| 220 | + $_iIndex = array_search( $sSectionName, $this->_aSections ); |
|
| 221 | 221 | return false === $_iIndex |
| 222 | 222 | ? '' |
| 223 | 223 | : trim( $this->_aSections[ $_iIndex + 1 ] ); |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | // If <?php notation is missing, highlight_string() will not highlight the syntax so add it. |
| 238 | 238 | $_bHasPHPTag = "<?php" === substr( $sCode, 0, 5 ); |
| 239 | 239 | |
| 240 | - $sCode = $_bHasPHPTag ? $sCode : "<?php " . $sCode; |
|
| 240 | + $sCode = $_bHasPHPTag ? $sCode : "<?php ".$sCode; |
|
| 241 | 241 | |
| 242 | 242 | $sCode = str_replace( '"', "'", $sCode ); // highlight_string() crashes if double quotes are contained in the code. |
| 243 | 243 | $sCode = highlight_string( $sCode, true ); |
@@ -20,6 +20,8 @@ |
||
| 20 | 20 | /** |
| 21 | 21 | * |
| 22 | 22 | * @since 3.5.3 |
| 23 | + * @param string $sFilePath |
|
| 24 | + * @param string $sTOCTitle |
|
| 23 | 25 | */ |
| 24 | 26 | protected function _getReadmeContents( $sFilePath, $sTOCTitle, $asSections=array() ) { |
| 25 | 27 | |
@@ -46,7 +46,7 @@ |
||
| 46 | 46 | return $_oTOC->get(); |
| 47 | 47 | } |
| 48 | 48 | return '' |
| 49 | - . $_sContent; |
|
| 49 | + . $_sContent; |
|
| 50 | 50 | |
| 51 | 51 | } |
| 52 | 52 | |
@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | * |
| 22 | 22 | * @since 3.5.3 |
| 23 | 23 | */ |
| 24 | - protected function _getReadmeContents( $sFilePath, $sTOCTitle, $asSections=array() ) { |
|
| 24 | + protected function _getReadmeContents( $sFilePath, $sTOCTitle, $asSections = array() ) { |
|
| 25 | 25 | |
| 26 | 26 | $_oWPReadmeParser = new AdminPageFramework_WPReadmeParser( |
| 27 | 27 | $sFilePath, |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | ) |
| 35 | 35 | ); |
| 36 | 36 | $_sContent = ''; |
| 37 | - foreach( ( array ) $asSections as $_sSection ) { |
|
| 37 | + foreach ( ( array ) $asSections as $_sSection ) { |
|
| 38 | 38 | $_sContent .= $_oWPReadmeParser->getSection( $_sSection ); |
| 39 | 39 | } |
| 40 | 40 | if ( $sTOCTitle ) { |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | * @since 3.6.1 |
| 67 | 67 | * @return string The generate HTML output. |
| 68 | 68 | */ |
| 69 | - public function _replyToProcessShortcode_embed( $aAttributes, $sURL, $sShortcode='' ) { |
|
| 69 | + public function _replyToProcessShortcode_embed( $aAttributes, $sURL, $sShortcode = '' ) { |
|
| 70 | 70 | |
| 71 | 71 | $sURL = isset( $aAttributes[ 'src' ] ) ? $aAttributes[ 'src' ] : $sURL; |
| 72 | 72 | $_sHTML = wp_oembed_get( $sURL ); |
@@ -108,27 +108,27 @@ discard block |
||
| 108 | 108 | * array( 'Second Heading' => 'Another text', ), |
| 109 | 109 | * ) |
| 110 | 110 | */ |
| 111 | - public function getContentsByHeader( $sContents, $iHeaderNumber=2 ) { |
|
| 111 | + public function getContentsByHeader( $sContents, $iHeaderNumber = 2 ) { |
|
| 112 | 112 | |
| 113 | 113 | $_aContents = array(); |
| 114 | 114 | $_aSplitContents = preg_split( |
| 115 | 115 | // '/^[\s]*==[\s]*(.+?)[\s]*==/m', |
| 116 | - '/(<h[' . $iHeaderNumber . ']*[^>]*>.*?<\/h[' . $iHeaderNumber . ']>)/i', |
|
| 116 | + '/(<h['.$iHeaderNumber.']*[^>]*>.*?<\/h['.$iHeaderNumber.']>)/i', |
|
| 117 | 117 | $sContents, |
| 118 | 118 | -1, |
| 119 | - PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY |
|
| 119 | + PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY |
|
| 120 | 120 | ); |
| 121 | 121 | |
| 122 | - foreach( $_aSplitContents as $_iIndex => $_sSplitContent ) { |
|
| 123 | - if ( ! preg_match( '/<h[' . $iHeaderNumber . ']*[^>]*>(.*?)<\/h[' . $iHeaderNumber . ']>/i', $_sSplitContent , $_aMatches ) ) { |
|
| 122 | + foreach ( $_aSplitContents as $_iIndex => $_sSplitContent ) { |
|
| 123 | + if ( !preg_match( '/<h['.$iHeaderNumber.']*[^>]*>(.*?)<\/h['.$iHeaderNumber.']>/i', $_sSplitContent, $_aMatches ) ) { |
|
| 124 | 124 | continue; |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | - if ( ! isset( $_aMatches[ 1 ] ) ) { |
|
| 127 | + if ( !isset( $_aMatches[ 1 ] ) ) { |
|
| 128 | 128 | continue; |
| 129 | 129 | } |
| 130 | - if ( isset( $_aSplitContents[ $_iIndex + 1 ] ) ) { |
|
| 131 | - $_aContents[] = array( |
|
| 130 | + if ( isset( $_aSplitContents[ $_iIndex + 1 ] ) ) { |
|
| 131 | + $_aContents[ ] = array( |
|
| 132 | 132 | $_aMatches[ 1 ], |
| 133 | 133 | $_aSplitContents[ $_iIndex + 1 ] |
| 134 | 134 | ); |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | foreach( ( array ) $asSections as $_sSection ) { |
| 38 | 38 | $_sContent .= $_oWPReadmeParser->getSection( $_sSection ); |
| 39 | 39 | } |
| 40 | - if ( $sTOCTitle ) { |
|
| 40 | + if ( $sTOCTitle ) { |
|
| 41 | 41 | $_oTOC = new AdminPageFramework_TableOfContents( |
| 42 | 42 | $_sContent, |
| 43 | 43 | 4, |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | if ( ! isset( $_aMatches[ 1 ] ) ) { |
| 128 | 128 | continue; |
| 129 | 129 | } |
| 130 | - if ( isset( $_aSplitContents[ $_iIndex + 1 ] ) ) { |
|
| 130 | + if ( isset( $_aSplitContents[ $_iIndex + 1 ] ) ) { |
|
| 131 | 131 | $_aContents[] = array( |
| 132 | 132 | $_aMatches[ 1 ], |
| 133 | 133 | $_aSplitContents[ $_iIndex + 1 ] |
@@ -257,6 +257,7 @@ discard block |
||
| 257 | 257 | * Generates the framework zip data. |
| 258 | 258 | * |
| 259 | 259 | * @since 3.5.4 |
| 260 | + * @param string $sFrameworkDirPath |
|
| 260 | 261 | * @return string The binary zip data. |
| 261 | 262 | */ |
| 262 | 263 | private function _getDownloadFrameworkZipFile( $sFrameworkDirPath, $sDestinationPath ) { |
@@ -308,11 +309,7 @@ discard block |
||
| 308 | 309 | * |
| 309 | 310 | * @since 3.5.4 |
| 310 | 311 | * @remark string $sPath The path to check. It can be a directory or a file. |
| 311 | - * @param string $sPathInArchive The parsing directory path set to the archive. |
|
| 312 | - * The passed path for the archive has a trailing slash. It starts with a directory name. |
|
| 313 | - * e.g. |
|
| 314 | - * `utility/AdminPageFramework_WPReadmeParser/` |
|
| 315 | - * `factory/widget/model/` |
|
| 312 | + * @param string $sPath |
|
| 316 | 313 | * @return boolean |
| 317 | 314 | */ |
| 318 | 315 | private function _isAllowedArchivePath( $sPath ) { |
@@ -567,6 +564,7 @@ discard block |
||
| 567 | 564 | * Modifies the text domain in the given file contents. |
| 568 | 565 | * |
| 569 | 566 | * @since 3.5.4 |
| 567 | + * @param string $sFileContents |
|
| 570 | 568 | * @return string |
| 571 | 569 | */ |
| 572 | 570 | private function _modifyTextDomain( $sFileContents ) { |
@@ -585,6 +583,7 @@ discard block |
||
| 585 | 583 | * Retrieves the value from the $_POST array by the given field ID. |
| 586 | 584 | * |
| 587 | 585 | * @since 3.5.4 |
| 586 | + * @param string $sFieldID |
|
| 588 | 587 | * @return string |
| 589 | 588 | */ |
| 590 | 589 | private function _getFormSubmitValueByFieldIDAsString( $sFieldID ) { |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | $this->oFactory = $oFactory; |
| 31 | 31 | |
| 32 | 32 | add_action( |
| 33 | - 'export_name_' . $this->sPageSlug . '_' . $this->sTabSlug, |
|
| 33 | + 'export_name_'.$this->sPageSlug.'_'.$this->sTabSlug, |
|
| 34 | 34 | array( $this, 'replyToFilterFileName' ), |
| 35 | 35 | 10, |
| 36 | 36 | 5 |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | 'title' => __( 'Class Prefix', 'admin-page-framework-loader' ), |
| 77 | 77 | 'type' => 'text', |
| 78 | 78 | 'description' => __( 'Set alphanumeric characters for the class names.', 'admin-page-framework-loader' ) |
| 79 | - . ' ' . __( 'For example, if you set here <code>MyPluginName_</code>, you will need to extend the class named <code>MyClassName_AdminPageFramework</code> instead of <code>AdminPageFramework</code>.', 'admin-page-framework-loader' ) |
|
| 79 | + . ' '.__( 'For example, if you set here <code>MyPluginName_</code>, you will need to extend the class named <code>MyClassName_AdminPageFramework</code> instead of <code>AdminPageFramework</code>.', 'admin-page-framework-loader' ) |
|
| 80 | 80 | . ' e.g.<code>MyPluginName_</code>', |
| 81 | 81 | 'attributes' => array( |
| 82 | 82 | 'size' => 30, |
@@ -126,8 +126,8 @@ discard block |
||
| 126 | 126 | 'label_min_width' => 0, |
| 127 | 127 | 'order' => 100, |
| 128 | 128 | 'value' => __( 'Download', 'adimn-page-framework-demo' ), |
| 129 | - 'file_name' => 'admin-page-framework.zip', // the default file name. This will be modified by the filter. |
|
| 130 | - 'format' => 'text', // 'json', 'text', 'array' |
|
| 129 | + 'file_name' => 'admin-page-framework.zip', // the default file name. This will be modified by the filter. |
|
| 130 | + 'format' => 'text', // 'json', 'text', 'array' |
|
| 131 | 131 | 'description' => $oFactory->oUtil->getAOrB( |
| 132 | 132 | class_exists( 'ZipArchive' ), |
| 133 | 133 | __( 'Download the compiled framework files as a zip file.', 'admin-page-framework-loader' ), |
@@ -181,8 +181,8 @@ discard block |
||
| 181 | 181 | |
| 182 | 182 | // the class prefix must not contain white spaces and some other characters not supported in PHP class names. |
| 183 | 183 | preg_match( |
| 184 | - '/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/', // pattern - allowed characters for variables in PHP. |
|
| 185 | - $aInput[ 'class_prefix' ], // subject |
|
| 184 | + '/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/', // pattern - allowed characters for variables in PHP. |
|
| 185 | + $aInput[ 'class_prefix' ], // subject |
|
| 186 | 186 | $_aMatches |
| 187 | 187 | ); |
| 188 | 188 | if ( $aInput[ 'class_prefix' ] && empty( $_aMatches ) ) { |
@@ -190,13 +190,13 @@ discard block |
||
| 190 | 190 | $_bVerified = false; |
| 191 | 191 | } |
| 192 | 192 | |
| 193 | - if ( ! $aInput[ 'text_domain' ] ) { |
|
| 193 | + if ( !$aInput[ 'text_domain' ] ) { |
|
| 194 | 194 | $_aErrors[ 'text_domain' ] = __( 'The text domain cannot be empty.', 'admin-page-framework-loader' ); |
| 195 | 195 | $_bVerified = false; |
| 196 | 196 | } |
| 197 | 197 | |
| 198 | 198 | // An invalid value is found. Set a field error array and an admin notice and return the old values. |
| 199 | - if ( ! $_bVerified ) { |
|
| 199 | + if ( !$_bVerified ) { |
|
| 200 | 200 | $oAdminPage->setFieldErrors( $_aErrors ); |
| 201 | 201 | $oAdminPage->setSettingNotice( __( 'There was something wrong with your input.', 'admin-page-framework-loader' ) ); |
| 202 | 202 | return $aOldInput; |
@@ -238,8 +238,8 @@ discard block |
||
| 238 | 238 | */ |
| 239 | 239 | public function replyToDownloadFramework( $aSavedData, $sSubmittedFieldID, $sSubmittedInputID, $oAdminPage ) { |
| 240 | 240 | |
| 241 | - $_sFrameworkDirPath = AdminPageFrameworkLoader_Registry::$sDirPath . '/library/admin-page-framework'; |
|
| 242 | - if ( ! file_exists( $_sFrameworkDirPath ) ) { |
|
| 241 | + $_sFrameworkDirPath = AdminPageFrameworkLoader_Registry::$sDirPath.'/library/admin-page-framework'; |
|
| 242 | + if ( !file_exists( $_sFrameworkDirPath ) ) { |
|
| 243 | 243 | return $aSavedData; |
| 244 | 244 | } |
| 245 | 245 | |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | $_sFrameworkDirPath, |
| 249 | 249 | $_sTempFile |
| 250 | 250 | ); |
| 251 | - header( "Content-Length: " . strlen( $_sData ) ); |
|
| 251 | + header( "Content-Length: ".strlen( $_sData ) ); |
|
| 252 | 252 | unlink( $_sTempFile ); |
| 253 | 253 | return $_sData; |
| 254 | 254 | |
@@ -265,9 +265,9 @@ discard block |
||
| 265 | 265 | $sFrameworkDirPath, |
| 266 | 266 | $sDestinationPath, |
| 267 | 267 | array( |
| 268 | - 'include_directory' => false, // wrap contents in a sub-directory |
|
| 268 | + 'include_directory' => false, // wrap contents in a sub-directory |
|
| 269 | 269 | 'additional_source_directories' => apply_filters( |
| 270 | - AdminPageFrameworkLoader_Registry::HOOK_SLUG . '_filter_generator_additional_source_directories', |
|
| 270 | + AdminPageFrameworkLoader_Registry::HOOK_SLUG.'_filter_generator_additional_source_directories', |
|
| 271 | 271 | array() // directory paths |
| 272 | 272 | ), |
| 273 | 273 | ), |
@@ -278,7 +278,7 @@ discard block |
||
| 278 | 278 | ) |
| 279 | 279 | ); |
| 280 | 280 | $_bSucceed = $_oZip->compress(); |
| 281 | - if ( ! $_bSucceed ) { |
|
| 281 | + if ( !$_bSucceed ) { |
|
| 282 | 282 | return ''; |
| 283 | 283 | } |
| 284 | 284 | return file_get_contents( $sDestinationPath ); |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | |
| 299 | 299 | // Check if it belongs to selected components. |
| 300 | 300 | if ( false === $this->_isAllowedArchivePath( $sPathInArchive ) ) { |
| 301 | - return ''; // empty value will drop the entry |
|
| 301 | + return ''; // empty value will drop the entry |
|
| 302 | 302 | } |
| 303 | 303 | return $sPathInArchive; |
| 304 | 304 | |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | */ |
| 318 | 318 | private function _isAllowedArchivePath( $sPath ) { |
| 319 | 319 | |
| 320 | - foreach( $this->_getDisallowedArchiveDirectoryPaths() as $_sDisallowedPath ) { |
|
| 320 | + foreach ( $this->_getDisallowedArchiveDirectoryPaths() as $_sDisallowedPath ) { |
|
| 321 | 321 | $_bHasPrefix = $this->oFactory->oUtil->hasPrefix( |
| 322 | 322 | ltrim( $_sDisallowedPath, '/' ), // needle |
| 323 | 323 | ltrim( $sPath, '/' ) // haystack |
@@ -386,7 +386,7 @@ discard block |
||
| 386 | 386 | // List paths. |
| 387 | 387 | $_aAllComponentsPaths = array(); |
| 388 | 388 | $_aSelectedComponentsPaths = array(); |
| 389 | - foreach( $this->_aComponentPaths as $_sKey => $_aPaths ) { |
|
| 389 | + foreach ( $this->_aComponentPaths as $_sKey => $_aPaths ) { |
|
| 390 | 390 | |
| 391 | 391 | // Extract all component paths. |
| 392 | 392 | $_aAllComponentsPaths = array_merge( |
@@ -440,7 +440,7 @@ discard block |
||
| 440 | 440 | public function _replyToModifyFileContents( $sFileContents, $sPathInArchive ) { |
| 441 | 441 | |
| 442 | 442 | $sFileContents = apply_filters( |
| 443 | - AdminPageFrameworkLoader_Registry::HOOK_SLUG . '_filter_generator_file_contents', |
|
| 443 | + AdminPageFrameworkLoader_Registry::HOOK_SLUG.'_filter_generator_file_contents', |
|
| 444 | 444 | $sFileContents, |
| 445 | 445 | $sPathInArchive, |
| 446 | 446 | $this->oFactory->oUtil->getElement( |
@@ -454,7 +454,7 @@ discard block |
||
| 454 | 454 | ); |
| 455 | 455 | |
| 456 | 456 | // Check the file extension. |
| 457 | - if ( ! in_array( pathinfo( $sPathInArchive, PATHINFO_EXTENSION ), array( 'php', 'css', 'js' ) ) ) { |
|
| 457 | + if ( !in_array( pathinfo( $sPathInArchive, PATHINFO_EXTENSION ), array( 'php', 'css', 'js' ) ) ) { |
|
| 458 | 458 | return $sFileContents; |
| 459 | 459 | } |
| 460 | 460 | |
@@ -506,12 +506,12 @@ discard block |
||
| 506 | 506 | $this->_getCheckedComponents() |
| 507 | 507 | ); |
| 508 | 508 | $_aInsert = array( |
| 509 | - 'Included Components: ' . implode( ', ', $_aCheckedComponents ), |
|
| 510 | - 'Generated on ' . date( 'Y-m-d' ), // today's date |
|
| 509 | + 'Included Components: '.implode( ', ', $_aCheckedComponents ), |
|
| 510 | + 'Generated on '.date( 'Y-m-d' ), // today's date |
|
| 511 | 511 | ); |
| 512 | 512 | return preg_replace( |
| 513 | 513 | '#\*/#', // needle - matches '*/' |
| 514 | - implode( PHP_EOL . ' ', $_aInsert ) . ' \0', // replacement \0 is a back-reference to '*/' |
|
| 514 | + implode( PHP_EOL.' ', $_aInsert ).' \0', // replacement \0 is a back-reference to '*/' |
|
| 515 | 515 | $sFileContents, // subject |
| 516 | 516 | 1 // replace only the first occurrence |
| 517 | 517 | ); |
@@ -525,14 +525,14 @@ discard block |
||
| 525 | 525 | private function _modifyClassNameOfInclusionList( $sFileContents ) { |
| 526 | 526 | // Replace the array key names. |
| 527 | 527 | $sFileContents = preg_replace_callback( |
| 528 | - '/(["\'])(.+)\1(?=\s?+=>)/', // pattern ' |
|
| 529 | - array( $this, '_replyToModifyPathName' ), // callable |
|
| 528 | + '/(["\'])(.+)\1(?=\s?+=>)/', // pattern ' |
|
| 529 | + array( $this, '_replyToModifyPathName' ), // callable |
|
| 530 | 530 | $sFileContents // subject |
| 531 | 531 | ); |
| 532 | 532 | // Replace the registry class names. |
| 533 | 533 | return preg_replace_callback( |
| 534 | - '/(=>\s?+)(.+)(?=::)/', // pattern ' |
|
| 535 | - array( $this, '_replyToModifyPathName' ), // callable |
|
| 534 | + '/(=>\s?+)(.+)(?=::)/', // pattern ' |
|
| 535 | + array( $this, '_replyToModifyPathName' ), // callable |
|
| 536 | 536 | $sFileContents // subject |
| 537 | 537 | ); |
| 538 | 538 | } |
@@ -557,7 +557,7 @@ discard block |
||
| 557 | 557 | return strlen( $_sPrefix ) |
| 558 | 558 | ? str_replace( |
| 559 | 559 | 'AdminPageFramework', // search |
| 560 | - $_sPrefix . 'AdminPageFramework', // replace |
|
| 560 | + $_sPrefix.'AdminPageFramework', // replace |
|
| 561 | 561 | $sSubject // subject |
| 562 | 562 | ) |
| 563 | 563 | : $sSubject; |
@@ -589,7 +589,7 @@ discard block |
||
| 589 | 589 | */ |
| 590 | 590 | private function _getFormSubmitValueByFieldIDAsString( $sFieldID ) { |
| 591 | 591 | |
| 592 | - static $_aCaches=array(); |
|
| 592 | + static $_aCaches = array(); |
|
| 593 | 593 | $_aCaches[ $sFieldID ] = isset( $_aCaches[ $sFieldID ] ) |
| 594 | 594 | ? $_aCaches[ $sFieldID ] |
| 595 | 595 | : $this->oFactory->oUtil->getElement( |
@@ -623,9 +623,9 @@ discard block |
||
| 623 | 623 | 'public', |
| 624 | 624 | ), |
| 625 | 625 | 'Content-Description' => 'File Transfer', |
| 626 | - 'Content-type' => 'application/octet-stream', // 'application/zip' may work as well |
|
| 626 | + 'Content-type' => 'application/octet-stream', // 'application/zip' may work as well |
|
| 627 | 627 | 'Content-Transfer-Encoding' => 'binary', |
| 628 | - 'Content-Disposition' => 'attachment; filename="' . $sFileName .'";', |
|
| 628 | + 'Content-Disposition' => 'attachment; filename="'.$sFileName.'";', |
|
| 629 | 629 | // 'Content-Length' => strlen( $mData ), |
| 630 | 630 | ) + $aHeader; |
| 631 | 631 | |
@@ -662,10 +662,10 @@ discard block |
||
| 662 | 662 | $_sFileNameWOExtension = trim( $_sFileNameWOExtension ); |
| 663 | 663 | return $this->oFactory->oUtil->getAOrB( |
| 664 | 664 | $_sFileNameWOExtension, |
| 665 | - $_sFileNameWOExtension . '-admin-page-framework', |
|
| 665 | + $_sFileNameWOExtension.'-admin-page-framework', |
|
| 666 | 666 | 'admin-page-framework' |
| 667 | 667 | ) |
| 668 | - . '.' . AdminPageFramework_Registry::VERSION |
|
| 668 | + . '.'.AdminPageFramework_Registry::VERSION |
|
| 669 | 669 | . '.zip'; |
| 670 | 670 | |
| 671 | 671 | } |
@@ -168,7 +168,7 @@ |
||
| 168 | 168 | * ) |
| 169 | 169 | * </code> |
| 170 | 170 | */ |
| 171 | - public function replyToFilterFileName( $sFileName, $sFieldID, $sInputID, $vExportingData, $oAdminPage ) { |
|
| 171 | + public function replyToFilterFileName( $sFileName, $sFieldID, $sInputID, $vExportingData, $oAdminPage ) { |
|
| 172 | 172 | |
| 173 | 173 | return isset( |
| 174 | 174 | $_POST[ $this->oFactory->oProp->sOptionKey ][ $this->sSectionID ][ 'minified_script_name' ] |
@@ -139,6 +139,7 @@ |
||
| 139 | 139 | * Modifies the class names of the minified script. |
| 140 | 140 | * |
| 141 | 141 | * @since 3.4.6 |
| 142 | + * @param string $sCode |
|
| 142 | 143 | */ |
| 143 | 144 | private function _modifyClassNames( $sCode ) { |
| 144 | 145 | |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | 4 |
| 27 | 27 | ); |
| 28 | 28 | add_action( |
| 29 | - 'export_name_' . $this->sPageSlug . '_' . $this->sTabSlug, |
|
| 29 | + 'export_name_'.$this->sPageSlug.'_'.$this->sTabSlug, |
|
| 30 | 30 | array( $this, 'replyToFilterFileName' ), 10, 5 |
| 31 | 31 | ); |
| 32 | 32 | |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | 'title' => __( 'Class Prefix', 'admin-page-framework-loader' ), |
| 42 | 42 | 'type' => 'text', |
| 43 | 43 | 'description' => __( 'Set alphanumeric characters for the class names', 'admin-page-framework-loader' ) |
| 44 | - . ' ' . __( 'For example, if you set here <code>MyPluginName_</code>, you will need to extend the class named <code>MyClassName_AdminPageFramework</code> instead of <code>AdminPageFramework</code>.', 'admin-page-framework-loader' ) |
|
| 44 | + . ' '.__( 'For example, if you set here <code>MyPluginName_</code>, you will need to extend the class named <code>MyClassName_AdminPageFramework</code> instead of <code>AdminPageFramework</code>.', 'admin-page-framework-loader' ) |
|
| 45 | 45 | . ' e.g.<code>MyPluginName_</code>', |
| 46 | 46 | 'attributes' => array( |
| 47 | 47 | 'size' => 30, |
@@ -68,8 +68,8 @@ discard block |
||
| 68 | 68 | 'type' => 'export', |
| 69 | 69 | 'label_min_width' => 0, |
| 70 | 70 | 'value' => __( 'Download', 'adimn-page-framework-demo' ), |
| 71 | - 'file_name' => 'admin-page-framework.min.php', // the default file name. This will be modified by the filter. |
|
| 72 | - 'format' => 'text', // 'json', 'text', 'array' |
|
| 71 | + 'file_name' => 'admin-page-framework.min.php', // the default file name. This will be modified by the filter. |
|
| 72 | + 'format' => 'text', // 'json', 'text', 'array' |
|
| 73 | 73 | 'description' => __( 'Download the minified version.', 'admin-page-framework-loader' ), |
| 74 | 74 | ) |
| 75 | 75 | ); |
@@ -101,13 +101,13 @@ discard block |
||
| 101 | 101 | if ( $aInput[ 'class_prefix' ] && empty( $_aMatches ) ) { |
| 102 | 102 | |
| 103 | 103 | // $variable[ 'sectioni_id' ]['field_id'] |
| 104 | - $_aErrors['class_prefix'] = __( 'The prefix must consist of alphanumeric with underscores.', 'admin-page-framework-loader' ); |
|
| 104 | + $_aErrors[ 'class_prefix' ] = __( 'The prefix must consist of alphanumeric with underscores.', 'admin-page-framework-loader' ); |
|
| 105 | 105 | $_bVerified = false; |
| 106 | 106 | |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | /* 4. An invalid value is found. */ |
| 110 | - if ( ! $_bVerified ) { |
|
| 110 | + if ( !$_bVerified ) { |
|
| 111 | 111 | |
| 112 | 112 | /* 4-1. Set the error array for the input fields. */ |
| 113 | 113 | $oAdminPage->setFieldErrors( $_aErrors ); |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | */ |
| 129 | 129 | public function replyToDownloadMinifiedVersion( $aSavedData, $sSubmittedFieldID, $sSubmittedInputID, $oAdminPage ) { |
| 130 | 130 | |
| 131 | - $_sMinifiedVersionPath = AdminPageFrameworkLoader_Registry::$sDirPath . '/library/admin-page-framework.min.php'; |
|
| 131 | + $_sMinifiedVersionPath = AdminPageFrameworkLoader_Registry::$sDirPath.'/library/admin-page-framework.min.php'; |
|
| 132 | 132 | if ( file_exists( $_sMinifiedVersionPath ) ) { |
| 133 | 133 | return $this->_modifyClassNames( file_get_contents( $_sMinifiedVersionPath ) ); |
| 134 | 134 | } |
@@ -147,8 +147,8 @@ discard block |
||
| 147 | 147 | : ''; |
| 148 | 148 | |
| 149 | 149 | return str_replace( |
| 150 | - 'AdminPageFramework', // search |
|
| 151 | - $_sPrefix . 'AdminPageFramework', // replace |
|
| 150 | + 'AdminPageFramework', // search |
|
| 151 | + $_sPrefix.'AdminPageFramework', // replace |
|
| 152 | 152 | $sCode // subject |
| 153 | 153 | ); |
| 154 | 154 | |
@@ -168,7 +168,7 @@ |
||
| 168 | 168 | * ) |
| 169 | 169 | * </code> |
| 170 | 170 | */ |
| 171 | - public function replyToFilterFileName( $sFileName, $sFieldID, $sInputID, $vExportingData, $oAdminPage ) { |
|
| 171 | + public function replyToFilterFileName( $sFileName, $sFieldID, $sInputID, $vExportingData, $oAdminPage ) { |
|
| 172 | 172 | |
| 173 | 173 | return isset( |
| 174 | 174 | $_POST[ $this->oFactory->oProp->sOptionKey ][ $this->sSectionID ][ 'minified_script_name' ] |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | * @return void |
| 186 | 186 | */ |
| 187 | 187 | static public function setAdminNotice( $sMessage, $sClassAttribute='error' ) { |
| 188 | - if ( ! is_admin() ) { |
|
| 188 | + if ( ! is_admin() ) { |
|
| 189 | 189 | return; |
| 190 | 190 | } |
| 191 | 191 | self::$_aAdminNotices[] = array( |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | * @return void |
| 201 | 201 | */ |
| 202 | 202 | static public function _replyToSetAdminNotice() { |
| 203 | - foreach( self::$_aAdminNotices as $_aAdminNotice ) { |
|
| 203 | + foreach( self::$_aAdminNotices as $_aAdminNotice ) { |
|
| 204 | 204 | echo "<div class='" . esc_attr( $_aAdminNotice['class_attribute'] ) . " notice is-dismissible'>" |
| 205 | 205 | ."<p>" |
| 206 | 206 | . sprintf( |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | if ( defined( 'DOING_UNINSTALL' ) ) { return; } |
| 222 | 222 | |
| 223 | 223 | // Include the library file |
| 224 | -if ( ! class_exists( 'AdminPageFramework' ) ) { |
|
| 224 | +if ( ! class_exists( 'AdminPageFramework' ) ) { |
|
| 225 | 225 | // The development version is available in the repository cloned via GitHub. |
| 226 | 226 | $_sDevelopmentVersionPath = dirname( __FILE__ ) . '/development/admin-page-framework.php'; |
| 227 | 227 | $_bDebugMode = defined( 'WP_DEBUG' ) && WP_DEBUG; |
@@ -250,7 +250,8 @@ discard block |
||
| 250 | 250 | |
| 251 | 251 | // Include the framework loader plugin components. |
| 252 | 252 | include( AdminPageFrameworkLoader_Registry::$sDirPath . '/include/class/boot/AdminPageFrameworkLoader_Bootstrap.php' ); |
| 253 | -if ( class_exists( 'AdminPageFrameworkLoader_Bootstrap' ) ) { // for backward compatibility |
|
| 253 | +if ( class_exists( 'AdminPageFrameworkLoader_Bootstrap' ) ) { |
|
| 254 | +// for backward compatibility |
|
| 254 | 255 | new AdminPageFrameworkLoader_Bootstrap( |
| 255 | 256 | AdminPageFrameworkLoader_Registry::$sFilePath, |
| 256 | 257 | AdminPageFrameworkLoader_Registry::HOOK_SLUG // hook prefix |
@@ -16,15 +16,15 @@ discard block |
||
| 16 | 16 | */ |
| 17 | 17 | class AdminPageFrameworkLoader_Registry_Base { |
| 18 | 18 | |
| 19 | - const VERSION = '3.7.0'; // <--- DON'T FORGET TO CHANGE THIS AS WELL!! |
|
| 20 | - const NAME = 'Admin Page Framework - Loader'; // the name is not 'Admin Page Framework' because warning messages gets confusing. |
|
| 19 | + const VERSION = '3.7.0'; // <--- DON'T FORGET TO CHANGE THIS AS WELL!! |
|
| 20 | + const NAME = 'Admin Page Framework - Loader'; // the name is not 'Admin Page Framework' because warning messages gets confusing. |
|
| 21 | 21 | const SHORTNAME = 'Admin Page Framework'; // used for a menu title etc. |
| 22 | - const DESCRIPTION = 'Loads Admin Page Framework which facilitates WordPress plugin and theme development.'; |
|
| 23 | - const URI = 'http://en.michaeluno.jp/'; |
|
| 24 | - const AUTHOR = 'miunosoft (Michael Uno)'; |
|
| 25 | - const AUTHOR_URI = 'http://en.michaeluno.jp/'; |
|
| 26 | - const COPYRIGHT = 'Copyright (c) 2015, Michael Uno'; |
|
| 27 | - const LICENSE = 'GPL v2 or later'; |
|
| 22 | + const DESCRIPTION = 'Loads Admin Page Framework which facilitates WordPress plugin and theme development.'; |
|
| 23 | + const URI = 'http://en.michaeluno.jp/'; |
|
| 24 | + const AUTHOR = 'miunosoft (Michael Uno)'; |
|
| 25 | + const AUTHOR_URI = 'http://en.michaeluno.jp/'; |
|
| 26 | + const COPYRIGHT = 'Copyright (c) 2015, Michael Uno'; |
|
| 27 | + const LICENSE = 'GPL v2 or later'; |
|
| 28 | 28 | const CONTRIBUTORS = ''; |
| 29 | 29 | |
| 30 | 30 | } |
@@ -55,7 +55,7 @@ discard block |
||
| 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. |
@@ -70,12 +70,12 @@ discard block |
||
| 70 | 70 | * |
| 71 | 71 | * These will be accessed from the bootstrap script. |
| 72 | 72 | */ |
| 73 | - const TEXT_DOMAIN = 'admin-page-framework-loader'; |
|
| 74 | - const TEXT_DOMAIN_PATH = '/language'; |
|
| 73 | + const TEXT_DOMAIN = 'admin-page-framework-loader'; |
|
| 74 | + const TEXT_DOMAIN_PATH = '/language'; |
|
| 75 | 75 | |
| 76 | - // These properties will be defined in the setUp() method. |
|
| 77 | - static public $sFilePath = ''; |
|
| 78 | - static public $sDirPath = ''; |
|
| 76 | + // These properties will be defined in the setUp() method. |
|
| 77 | + static public $sFilePath = ''; |
|
| 78 | + static public $sDirPath = ''; |
|
| 79 | 79 | |
| 80 | 80 | /** |
| 81 | 81 | * Requirements. |
@@ -136,30 +136,30 @@ discard block |
||
| 136 | 136 | static public $aTaxonomies = array( |
| 137 | 137 | ); |
| 138 | 138 | |
| 139 | - /** |
|
| 140 | - * Sets up static properties. |
|
| 139 | + /** |
|
| 140 | + * Sets up static properties. |
|
| 141 | 141 | * @return void |
| 142 | - */ |
|
| 143 | - static public function setUp( $sPluginFilePath=null ) { |
|
| 142 | + */ |
|
| 143 | + static public function setUp( $sPluginFilePath=null ) { |
|
| 144 | 144 | |
| 145 | - self::$sFilePath = $sPluginFilePath ? $sPluginFilePath : __FILE__; |
|
| 146 | - self::$sDirPath = dirname( self::$sFilePath ); |
|
| 145 | + self::$sFilePath = $sPluginFilePath ? $sPluginFilePath : __FILE__; |
|
| 146 | + self::$sDirPath = dirname( self::$sFilePath ); |
|
| 147 | 147 | |
| 148 | - } |
|
| 148 | + } |
|
| 149 | 149 | |
| 150 | - /** |
|
| 151 | - * Returns the URL with the given relative path to the plugin path. |
|
| 152 | - * |
|
| 153 | - * <h3>Example</h3> |
|
| 150 | + /** |
|
| 151 | + * Returns the URL with the given relative path to the plugin path. |
|
| 152 | + * |
|
| 153 | + * <h3>Example</h3> |
|
| 154 | 154 | * <code> |
| 155 | 155 | * AdminPageFrameworkLoader_Registry::getPluginURL( 'asset/css/meta_box.css' ); |
| 156 | 156 | * </code> |
| 157 | 157 | * @since 3.5.0 |
| 158 | 158 | * @return string |
| 159 | - */ |
|
| 160 | - public static function getPluginURL( $sRelativePath='' ) { |
|
| 161 | - return plugins_url( $sRelativePath, self::$sFilePath ); |
|
| 162 | - } |
|
| 159 | + */ |
|
| 160 | + public static function getPluginURL( $sRelativePath='' ) { |
|
| 161 | + return plugins_url( $sRelativePath, self::$sFilePath ); |
|
| 162 | + } |
|
| 163 | 163 | |
| 164 | 164 | /** |
| 165 | 165 | * Returns the information of this class. |
@@ -16,16 +16,16 @@ discard block |
||
| 16 | 16 | */ |
| 17 | 17 | class AdminPageFrameworkLoader_Registry_Base { |
| 18 | 18 | |
| 19 | - const VERSION = '3.7.0'; // <--- DON'T FORGET TO CHANGE THIS AS WELL!! |
|
| 19 | + const VERSION = '3.7.0'; // <--- 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://en.michaeluno.jp/'; |
| 24 | 24 | const AUTHOR = 'miunosoft (Michael Uno)'; |
| 25 | 25 | const AUTHOR_URI = 'http://en.michaeluno.jp/'; |
| 26 | 26 | const COPYRIGHT = 'Copyright (c) 2015, Michael Uno'; |
| 27 | 27 | const LICENSE = 'GPL v2 or later'; |
| 28 | - const CONTRIBUTORS = ''; |
|
| 28 | + const CONTRIBUTORS = ''; |
|
| 29 | 29 | |
| 30 | 30 | } |
| 31 | 31 | /** |
@@ -55,14 +55,14 @@ discard block |
||
| 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 | /** |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | */ |
| 118 | 118 | static public $aAdminPages = array( |
| 119 | 119 | // key => 'page slug' |
| 120 | - 'about' => 'apfl_about', // the welcome page |
|
| 120 | + 'about' => 'apfl_about', // the welcome page |
|
| 121 | 121 | 'addon' => 'apfl_addons', |
| 122 | 122 | 'tool' => 'apfl_tools', |
| 123 | 123 | 'help' => 'apfl_contact', |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | * Sets up static properties. |
| 141 | 141 | * @return void |
| 142 | 142 | */ |
| 143 | - static public function setUp( $sPluginFilePath=null ) { |
|
| 143 | + static public function setUp( $sPluginFilePath = null ) { |
|
| 144 | 144 | |
| 145 | 145 | self::$sFilePath = $sPluginFilePath ? $sPluginFilePath : __FILE__; |
| 146 | 146 | self::$sDirPath = dirname( self::$sFilePath ); |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | * @since 3.5.0 |
| 158 | 158 | * @return string |
| 159 | 159 | */ |
| 160 | - public static function getPluginURL( $sRelativePath='' ) { |
|
| 160 | + public static function getPluginURL( $sRelativePath = '' ) { |
|
| 161 | 161 | return plugins_url( $sRelativePath, self::$sFilePath ); |
| 162 | 162 | } |
| 163 | 163 | |
@@ -184,13 +184,13 @@ discard block |
||
| 184 | 184 | * @since 3.5.0 |
| 185 | 185 | * @return void |
| 186 | 186 | */ |
| 187 | - static public function setAdminNotice( $sMessage, $sClassAttribute='error' ) { |
|
| 188 | - if ( ! is_admin() ) { |
|
| 187 | + static public function setAdminNotice( $sMessage, $sClassAttribute = 'error' ) { |
|
| 188 | + if ( !is_admin() ) { |
|
| 189 | 189 | return; |
| 190 | 190 | } |
| 191 | - self::$_aAdminNotices[] = array( |
|
| 191 | + self::$_aAdminNotices[ ] = array( |
|
| 192 | 192 | 'message' => $sMessage, |
| 193 | - 'class_attribute' => trim( $sClassAttribute ) . ' notice is-dismissible', |
|
| 193 | + 'class_attribute' => trim( $sClassAttribute ).' notice is-dismissible', |
|
| 194 | 194 | ); |
| 195 | 195 | add_action( 'admin_notices', array( __CLASS__, '_replyToSetAdminNotice' ) ); |
| 196 | 196 | } |
@@ -200,12 +200,12 @@ discard block |
||
| 200 | 200 | * @return void |
| 201 | 201 | */ |
| 202 | 202 | static public function _replyToSetAdminNotice() { |
| 203 | - foreach( self::$_aAdminNotices as $_aAdminNotice ) { |
|
| 204 | - echo "<div class='" . esc_attr( $_aAdminNotice['class_attribute'] ) . " notice is-dismissible'>" |
|
| 203 | + foreach ( self::$_aAdminNotices as $_aAdminNotice ) { |
|
| 204 | + echo "<div class='".esc_attr( $_aAdminNotice[ 'class_attribute' ] )." notice is-dismissible'>" |
|
| 205 | 205 | ."<p>" |
| 206 | 206 | . sprintf( |
| 207 | - '<strong>%1$s</strong>: ' . $_aAdminNotice['message'], |
|
| 208 | - self::NAME . ' ' . self::VERSION |
|
| 207 | + '<strong>%1$s</strong>: '.$_aAdminNotice[ 'message' ], |
|
| 208 | + self::NAME.' '.self::VERSION |
|
| 209 | 209 | ) |
| 210 | 210 | . "</p>" |
| 211 | 211 | . "</div>"; |
@@ -217,24 +217,24 @@ discard block |
||
| 217 | 217 | AdminPageFrameworkLoader_Registry::setUp( __FILE__ ); |
| 218 | 218 | |
| 219 | 219 | // Initial checks. - Do no load if accessed directly, not exiting because the 'uninstall.php' and inclusion list generator will load this file. |
| 220 | -if ( ! defined( 'ABSPATH' ) ) { return; } |
|
| 220 | +if ( !defined( 'ABSPATH' ) ) { return; } |
|
| 221 | 221 | if ( defined( 'DOING_UNINSTALL' ) ) { return; } |
| 222 | 222 | |
| 223 | 223 | // Include the library file |
| 224 | -if ( ! class_exists( 'AdminPageFramework' ) ) { |
|
| 224 | +if ( !class_exists( 'AdminPageFramework' ) ) { |
|
| 225 | 225 | // The development version is available in the repository cloned via GitHub. |
| 226 | - $_sDevelopmentVersionPath = dirname( __FILE__ ) . '/development/admin-page-framework.php'; |
|
| 226 | + $_sDevelopmentVersionPath = dirname( __FILE__ ).'/development/admin-page-framework.php'; |
|
| 227 | 227 | $_bDebugMode = defined( 'WP_DEBUG' ) && WP_DEBUG; |
| 228 | 228 | include( |
| 229 | 229 | $_bDebugMode && file_exists( $_sDevelopmentVersionPath ) |
| 230 | 230 | ? $_sDevelopmentVersionPath |
| 231 | - : dirname( __FILE__ ) . '/library/admin-page-framework/admin-page-framework.php' |
|
| 231 | + : dirname( __FILE__ ).'/library/admin-page-framework/admin-page-framework.php' |
|
| 232 | 232 | ); |
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | if ( |
| 236 | - ! class_exists( 'AdminPageFramework_Registry' ) |
|
| 237 | - || ! defined( 'AdminPageFramework_Registry::VERSION' ) // backward compatibility |
|
| 236 | + !class_exists( 'AdminPageFramework_Registry' ) |
|
| 237 | + || !defined( 'AdminPageFramework_Registry::VERSION' ) // backward compatibility |
|
| 238 | 238 | || version_compare( AdminPageFramework_Registry::VERSION, AdminPageFrameworkLoader_Registry::VERSION, '<' ) |
| 239 | 239 | ) { |
| 240 | 240 | AdminPageFrameworkLoader_Registry::setAdminNotice( |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | // Include the framework loader plugin components. |
| 252 | -include( AdminPageFrameworkLoader_Registry::$sDirPath . '/include/class/boot/AdminPageFrameworkLoader_Bootstrap.php' ); |
|
| 252 | +include( AdminPageFrameworkLoader_Registry::$sDirPath.'/include/class/boot/AdminPageFrameworkLoader_Bootstrap.php' ); |
|
| 253 | 253 | if ( class_exists( 'AdminPageFrameworkLoader_Bootstrap' ) ) { // for backward compatibility |
| 254 | 254 | new AdminPageFrameworkLoader_Bootstrap( |
| 255 | 255 | AdminPageFrameworkLoader_Registry::$sFilePath, |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | final class AdminPageFramework_Registry extends AdminPageFramework_Registry_Base { |
| 56 | 56 | |
| 57 | 57 | const TEXT_DOMAIN = 'admin-page-framework'; |
| 58 | - const TEXT_DOMAIN_PATH = '/language'; // not used at the moment |
|
| 58 | + const TEXT_DOMAIN_PATH = '/language'; // not used at the moment |
|
| 59 | 59 | |
| 60 | 60 | /** |
| 61 | 61 | * Indicates whether the framework is loaded from the minified version or not. |
@@ -98,12 +98,12 @@ discard block |
||
| 98 | 98 | * Sets up static properties. |
| 99 | 99 | * @return void |
| 100 | 100 | */ |
| 101 | - static public function setUp( $sFilePath=__FILE__ ) { |
|
| 101 | + static public function setUp( $sFilePath = __FILE__ ) { |
|
| 102 | 102 | |
| 103 | 103 | self::$sFilePath = $sFilePath; |
| 104 | 104 | self::$sDirPath = dirname( self::$sFilePath ); |
| 105 | 105 | self::$sFileURI = plugins_url( '', self::$sFilePath ); |
| 106 | - self::$sIncludeClassListPath = self::$sDirPath . '/admin-page-framework-include-class-list.php'; |
|
| 106 | + self::$sIncludeClassListPath = self::$sDirPath.'/admin-page-framework-include-class-list.php'; |
|
| 107 | 107 | self::$aClassFiles = self::_getClassFilePathList( self::$sIncludeClassListPath ); |
| 108 | 108 | self::$sAutoLoaderPath = isset( self::$aClassFiles[ 'AdminPageFramework_RegisterClasses' ] ) |
| 109 | 109 | ? self::$aClassFiles[ 'AdminPageFramework_RegisterClasses' ] |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | * @return array |
| 118 | 118 | */ |
| 119 | 119 | static private function _getClassFilePathList( $sInclusionClassListPath ) { |
| 120 | - $aClassFiles = array(); // this will be updated if the inclusion below is successful. |
|
| 120 | + $aClassFiles = array(); // this will be updated if the inclusion below is successful. |
|
| 121 | 121 | include( $sInclusionClassListPath ); |
| 122 | 122 | return $aClassFiles; |
| 123 | 123 | } |
@@ -130,8 +130,8 @@ discard block |
||
| 130 | 130 | */ |
| 131 | 131 | static public function getVersion() { |
| 132 | 132 | |
| 133 | - if ( ! isset( self::$sAutoLoaderPath ) ) { |
|
| 134 | - trigger_error( 'Admin Page Framework: ' . ' : ' . sprintf( __( 'The method is called too early. Perform <code>%2$s</code> earlier.', 'admin-page-framework' ), __METHOD__, 'setUp()' ), E_USER_WARNING ); |
|
| 133 | + if ( !isset( self::$sAutoLoaderPath ) ) { |
|
| 134 | + trigger_error( 'Admin Page Framework: '.' : '.sprintf( __( 'The method is called too early. Perform <code>%2$s</code> earlier.', 'admin-page-framework' ), __METHOD__, 'setUp()' ), E_USER_WARNING ); |
|
| 135 | 135 | return self::VERSION; |
| 136 | 136 | } |
| 137 | 137 | $_aMinifiedVesionSuffix = array( |
@@ -179,9 +179,9 @@ discard block |
||
| 179 | 179 | */ |
| 180 | 180 | final class AdminPageFramework_Bootstrap { |
| 181 | 181 | |
| 182 | - public function __construct( $sLibraryPath=__FILE__ ) { |
|
| 182 | + public function __construct( $sLibraryPath = __FILE__ ) { |
|
| 183 | 183 | |
| 184 | - if ( ! $this->_isLoadable() ) { |
|
| 184 | + if ( !$this->_isLoadable() ) { |
|
| 185 | 185 | return; |
| 186 | 186 | } |
| 187 | 187 | |