@@ -68,7 +68,7 @@ |
||
68 | 68 | return "{$_aField['field_id']}{$_sKey}"; |
69 | 69 | } |
70 | 70 | |
71 | - /** |
|
71 | + /** |
|
72 | 72 | * Adds input fields |
73 | 73 | * |
74 | 74 | * @internal |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | '', |
48 | 48 | "[{$_sKey}]" |
49 | 49 | ); |
50 | - return $_aField['field_id'] . $_sKey; |
|
50 | + return $_aField[ 'field_id' ].$_sKey; |
|
51 | 51 | |
52 | 52 | } |
53 | 53 | /** |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | '', |
66 | 66 | "|{$_sKey}" |
67 | 67 | ); |
68 | - return "{$_aField['field_id']}{$_sKey}"; |
|
68 | + return "{$_aField[ 'field_id' ]}{$_sKey}"; |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | /** |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | $_aOutput = array(); |
116 | 116 | |
117 | 117 | // Set nonce. |
118 | - $_aOutput[] = wp_nonce_field( |
|
118 | + $_aOutput[ ] = wp_nonce_field( |
|
119 | 119 | $this->oProp->sClassHash, |
120 | 120 | $this->oProp->sClassHash, |
121 | 121 | true, |
@@ -126,17 +126,17 @@ discard block |
||
126 | 126 | $this->_setOptionArray( $iTermID, $this->oProp->sOptionKey ); |
127 | 127 | |
128 | 128 | // Get the field outputs |
129 | - $_aOutput[] = $this->oForm->get( $bRenderTableRow ); |
|
129 | + $_aOutput[ ] = $this->oForm->get( $bRenderTableRow ); |
|
130 | 130 | |
131 | 131 | // Filter the output |
132 | 132 | $_sOutput = $this->oUtil->addAndApplyFilters( |
133 | 133 | $this, |
134 | - 'content_' . $this->oProp->sClassName, |
|
134 | + 'content_'.$this->oProp->sClassName, |
|
135 | 135 | $this->content( implode( PHP_EOL, $_aOutput ) ) |
136 | 136 | ); |
137 | 137 | |
138 | 138 | // Do action |
139 | - $this->oUtil->addAndDoActions( $this, 'do_' . $this->oProp->sClassName, $this ); |
|
139 | + $this->oUtil->addAndDoActions( $this, 'do_'.$this->oProp->sClassName, $this ); |
|
140 | 140 | |
141 | 141 | return $_sOutput; |
142 | 142 |
@@ -19,22 +19,22 @@ |
||
19 | 19 | abstract class AdminPageFramework_Widget_Controller extends AdminPageFramework_Widget_View { |
20 | 20 | |
21 | 21 | /** |
22 | - * The method for necessary set-ups. |
|
23 | - * |
|
24 | - * <h4>Example</h4> |
|
25 | - * <code> |
|
26 | - * public function setUp() { |
|
27 | - * $this->setArguments( |
|
28 | - * array( |
|
29 | - * 'description' => __( 'This is a sample widget with built-in field types created by Admin Page Framework.', 'admin-page-framework-demo' ), |
|
30 | - * ) |
|
31 | - * ); |
|
32 | - * } |
|
33 | - * </code> |
|
34 | - * |
|
35 | - * @abstract |
|
36 | - * @since 3.2.0 |
|
37 | - */ |
|
22 | + * The method for necessary set-ups. |
|
23 | + * |
|
24 | + * <h4>Example</h4> |
|
25 | + * <code> |
|
26 | + * public function setUp() { |
|
27 | + * $this->setArguments( |
|
28 | + * array( |
|
29 | + * 'description' => __( 'This is a sample widget with built-in field types created by Admin Page Framework.', 'admin-page-framework-demo' ), |
|
30 | + * ) |
|
31 | + * ); |
|
32 | + * } |
|
33 | + * </code> |
|
34 | + * |
|
35 | + * @abstract |
|
36 | + * @since 3.2.0 |
|
37 | + */ |
|
38 | 38 | public function setUp() {} |
39 | 39 | |
40 | 40 | /** |
@@ -131,7 +131,7 @@ |
||
131 | 131 | * @see https://codex.wordpress.org/Function_Reference/wp_register_sidebar_widget |
132 | 132 | * @return void |
133 | 133 | */ |
134 | - protected function setArguments( array $aArguments=array() ) { |
|
134 | + protected function setArguments( array $aArguments = array() ) { |
|
135 | 135 | $this->oProp->aWidgetArguments = $aArguments; |
136 | 136 | } |
137 | 137 |
@@ -36,9 +36,9 @@ discard block |
||
36 | 36 | |
37 | 37 | if ( $this->oProp->bIsAdmin ) { |
38 | 38 | add_filter( |
39 | - 'validation_' . $this->oProp->sClassName, |
|
39 | + 'validation_'.$this->oProp->sClassName, |
|
40 | 40 | array( $this, '_replyToSortInputs' ), |
41 | - 1, // set a high priority |
|
41 | + 1, // set a high priority |
|
42 | 42 | 3 // number of parameters |
43 | 43 | ); |
44 | 44 | } |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | */ |
109 | 109 | public function _replyToRegisterWidget() { |
110 | 110 | |
111 | - if ( ! is_object( $GLOBALS[ 'wp_widget_factory' ] ) ) { |
|
111 | + if ( !is_object( $GLOBALS[ 'wp_widget_factory' ] ) ) { |
|
112 | 112 | return; |
113 | 113 | } |
114 | 114 |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | * @param integer $iDepth The header number to parse. |
38 | 38 | * @param string $sTitle The heading title which appears at the beginning of the output. |
39 | 39 | */ |
40 | - public function __construct( $sHTML, $iDepth=4, $sTitle='' ) { |
|
40 | + public function __construct( $sHTML, $iDepth = 4, $sTitle = '' ) { |
|
41 | 41 | |
42 | 42 | $this->sTitle = $sTitle; |
43 | 43 | $this->sHTML = $sHTML; |
@@ -75,26 +75,26 @@ discard block |
||
75 | 75 | */ |
76 | 76 | public function getTOC() { |
77 | 77 | |
78 | - $iDepth = $this->iDepth; |
|
78 | + $iDepth = $this->iDepth; |
|
79 | 79 | |
80 | 80 | // get the headings down to the specified depth |
81 | 81 | $this->sHTML = preg_replace_callback( |
82 | - '/<h[2-' . $iDepth . ']*[^>]*>.*?<\/h[2-' . $iDepth . ']>/i', |
|
82 | + '/<h[2-'.$iDepth.']*[^>]*>.*?<\/h[2-'.$iDepth.']>/i', |
|
83 | 83 | array( $this, '_replyToInsertNamedElement' ), |
84 | 84 | $this->sHTML |
85 | 85 | ); |
86 | 86 | |
87 | 87 | $_aOutput = array(); |
88 | - foreach( $this->_aMatches as $_iIndex => $_sMatch ) { |
|
88 | + foreach ( $this->_aMatches as $_iIndex => $_sMatch ) { |
|
89 | 89 | $_sMatch = strip_tags( $_sMatch, '<h1><h2><h3><h4><h5><h6><h7><h8>' ); |
90 | - $_sMatch = preg_replace( '/<h([1-' . $iDepth . '])>/', '<li class="toc$1"><a href="#toc_' . $_iIndex . '">', $_sMatch ); |
|
91 | - $_sMatch = preg_replace( '/<\/h[1-' . $iDepth . ']>/', '</a></li>', $_sMatch ); |
|
92 | - $_aOutput[] = $_sMatch; |
|
90 | + $_sMatch = preg_replace( '/<h([1-'.$iDepth.'])>/', '<li class="toc$1"><a href="#toc_'.$_iIndex.'">', $_sMatch ); |
|
91 | + $_sMatch = preg_replace( '/<\/h[1-'.$iDepth.']>/', '</a></li>', $_sMatch ); |
|
92 | + $_aOutput[ ] = $_sMatch; |
|
93 | 93 | } |
94 | 94 | |
95 | 95 | // plug the results into appropriate HTML tags |
96 | 96 | $this->sTitle = $this->sTitle |
97 | - ? '<p class="toc-title">' . $this->sTitle . '</p>' |
|
97 | + ? '<p class="toc-title">'.$this->sTitle.'</p>' |
|
98 | 98 | : ''; |
99 | 99 | return '<div class="toc">' |
100 | 100 | . $this->sTitle |
@@ -111,8 +111,8 @@ discard block |
||
111 | 111 | public function _replyToInsertNamedElement( $aMatches ) { |
112 | 112 | static $_icount = -1; |
113 | 113 | $_icount++; |
114 | - $this->_aMatches[] = $aMatches[ 0 ]; |
|
115 | - return "<span class='toc_header_link' id='toc_{$_icount}'></span>" . PHP_EOL |
|
114 | + $this->_aMatches[ ] = $aMatches[ 0 ]; |
|
115 | + return "<span class='toc_header_link' id='toc_{$_icount}'></span>".PHP_EOL |
|
116 | 116 | . $aMatches[ 0 ]; |
117 | 117 | } |
118 | 118 | /**#@-*/ |
@@ -349,7 +349,7 @@ |
||
349 | 349 | ? "<strong>" . $this->_sScriptName . "</strong>: " |
350 | 350 | : ''; |
351 | 351 | return $_sScripTitle |
352 | - . implode( '<br />', $_aWarnings ); |
|
352 | + . implode( '<br />', $_aWarnings ); |
|
353 | 353 | |
354 | 354 | } |
355 | 355 |
@@ -135,12 +135,12 @@ discard block |
||
135 | 135 | * </ul> |
136 | 136 | * @param string $sScriptName The script name. |
137 | 137 | */ |
138 | - public function __construct( array $aRequirements=array(), $sScriptName='' ) { |
|
138 | + public function __construct( array $aRequirements = array(), $sScriptName = '' ) { |
|
139 | 139 | |
140 | 140 | // Avoid undefined index warnings. |
141 | 141 | $aRequirements = $aRequirements + $this->_aDefaultRequirements; |
142 | 142 | $aRequirements = array_filter( $aRequirements, 'is_array' ); |
143 | - foreach( array( 'php', 'mysql', 'wordpress' ) as $_iIndex => $_sName ) { |
|
143 | + foreach ( array( 'php', 'mysql', 'wordpress' ) as $_iIndex => $_sName ) { |
|
144 | 144 | if ( isset( $aRequirements[ $_sName ] ) ) { |
145 | 145 | $aRequirements[ $_sName ] = $aRequirements[ $_sName ] + $this->_aDefaultRequirements[ $_sName ]; |
146 | 146 | } |
@@ -165,9 +165,9 @@ discard block |
||
165 | 165 | $_aWarnings = array(); |
166 | 166 | |
167 | 167 | // PHP, WordPress, MySQL |
168 | - $_aWarnings[] = $this->_getWarningByType( 'php' ); |
|
169 | - $_aWarnings[] = $this->_getWarningByType( 'wordpress' ); |
|
170 | - $_aWarnings[] = $this->_getWarningByType( 'mysql' ); |
|
168 | + $_aWarnings[ ] = $this->_getWarningByType( 'php' ); |
|
169 | + $_aWarnings[ ] = $this->_getWarningByType( 'wordpress' ); |
|
170 | + $_aWarnings[ ] = $this->_getWarningByType( 'mysql' ); |
|
171 | 171 | |
172 | 172 | // Ensure necessary array elements. |
173 | 173 | $this->_aRequirements = $this->_aRequirements + array( |
@@ -180,10 +180,10 @@ discard block |
||
180 | 180 | // Check the rest. |
181 | 181 | $_aWarnings = array_merge( |
182 | 182 | $_aWarnings, |
183 | - $this->_checkFunctions( $this->_aRequirements['functions'] ), |
|
184 | - $this->_checkClasses( $this->_aRequirements['classes'] ), |
|
185 | - $this->_checkConstants( $this->_aRequirements['constants'] ), |
|
186 | - $this->_checkFiles( $this->_aRequirements['files'] ) |
|
183 | + $this->_checkFunctions( $this->_aRequirements[ 'functions' ] ), |
|
184 | + $this->_checkClasses( $this->_aRequirements[ 'classes' ] ), |
|
185 | + $this->_checkConstants( $this->_aRequirements[ 'constants' ] ), |
|
186 | + $this->_checkFiles( $this->_aRequirements[ 'files' ] ) |
|
187 | 187 | ); |
188 | 188 | |
189 | 189 | $this->aWarnings = array_filter( $_aWarnings ); // drop empty elements. |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | * @return string The warning. |
198 | 198 | */ |
199 | 199 | private function _getWarningByType( $sType ) { |
200 | - if ( ! isset( $this->_aRequirements[ $sType ][ 'version' ] ) ) { |
|
200 | + if ( !isset( $this->_aRequirements[ $sType ][ 'version' ] ) ) { |
|
201 | 201 | return ''; |
202 | 202 | } |
203 | 203 | if ( $this->_checkPHPVersion( $this->_aRequirements[ $sType ][ 'version' ] ) ) { |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | * @internal |
227 | 227 | */ |
228 | 228 | private function _checkWordPressVersion( $sWordPressVersion ) { |
229 | - return version_compare( $GLOBALS['wp_version'], $sWordPressVersion, ">=" ); |
|
229 | + return version_compare( $GLOBALS[ 'wp_version' ], $sWordPressVersion, ">=" ); |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | /** |
@@ -298,9 +298,9 @@ discard block |
||
298 | 298 | */ |
299 | 299 | private function _getWarningsByFunctionName( $sFuncName, $aSubjects ) { |
300 | 300 | $_aWarnings = array(); |
301 | - foreach( $aSubjects as $_sSubject => $_sWarning ) { |
|
302 | - if ( ! call_user_func_array( $sFuncName, array( $_sSubject ) ) ) { |
|
303 | - $_aWarnings[] = sprintf( $_sWarning, $_sSubject ); |
|
301 | + foreach ( $aSubjects as $_sSubject => $_sWarning ) { |
|
302 | + if ( !call_user_func_array( $sFuncName, array( $_sSubject ) ) ) { |
|
303 | + $_aWarnings[ ] = sprintf( $_sWarning, $_sSubject ); |
|
304 | 304 | } |
305 | 305 | } |
306 | 306 | return $_aWarnings; |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | */ |
323 | 323 | public function _replyToPrintAdminNotices() { |
324 | 324 | |
325 | - $_aWarnings = array_unique( $this->aWarnings ); |
|
325 | + $_aWarnings = array_unique( $this->aWarnings ); |
|
326 | 326 | if ( empty( $_aWarnings ) ) { |
327 | 327 | return; |
328 | 328 | } |
@@ -341,12 +341,12 @@ discard block |
||
341 | 341 | */ |
342 | 342 | private function _getWarnings() { |
343 | 343 | |
344 | - $_aWarnings = array_unique( $this->aWarnings ); |
|
344 | + $_aWarnings = array_unique( $this->aWarnings ); |
|
345 | 345 | if ( empty( $_aWarnings ) ) { |
346 | 346 | return ''; |
347 | 347 | } |
348 | - $_sScripTitle = $this->_sScriptName |
|
349 | - ? "<strong>" . $this->_sScriptName . "</strong>: " |
|
348 | + $_sScripTitle = $this->_sScriptName |
|
349 | + ? "<strong>".$this->_sScriptName."</strong>: " |
|
350 | 350 | : ''; |
351 | 351 | return $_sScripTitle |
352 | 352 | . implode( '<br />', $_aWarnings ); |
@@ -361,12 +361,12 @@ discard block |
||
361 | 361 | * @param boolean $bIsOnActivation Whether it is called upon plugin activation hook. |
362 | 362 | * @return void |
363 | 363 | */ |
364 | - public function deactivatePlugin( $sPluginFilePath, $sMessage='', $bIsOnActivation=false ) { |
|
364 | + public function deactivatePlugin( $sPluginFilePath, $sMessage = '', $bIsOnActivation = false ) { |
|
365 | 365 | |
366 | 366 | add_action( 'admin_notices', array( $this, '_replyToPrintAdminNotices' ) ); |
367 | - $this->aWarnings[] = '<strong>' . $sMessage . '</strong>'; |
|
368 | - if ( ! function_exists( 'deactivate_plugins' ) ) { |
|
369 | - if ( ! @include( ABSPATH . 'wp-admin/includes/plugin.php' ) ) { |
|
367 | + $this->aWarnings[ ] = '<strong>'.$sMessage.'</strong>'; |
|
368 | + if ( !function_exists( 'deactivate_plugins' ) ) { |
|
369 | + if ( !@include( ABSPATH.'wp-admin/includes/plugin.php' ) ) { |
|
370 | 370 | return; |
371 | 371 | } |
372 | 372 | } |
@@ -376,8 +376,8 @@ discard block |
||
376 | 376 | // Before that, we can display messages to the user. |
377 | 377 | if ( $bIsOnActivation ) { |
378 | 378 | |
379 | - $_sPluginListingPage = add_query_arg( array(), $GLOBALS['pagenow'] ); |
|
380 | - wp_die( $this->_getWarnings() . "<p><a href='$_sPluginListingPage'>Go back</a>.</p>" ); |
|
379 | + $_sPluginListingPage = add_query_arg( array(), $GLOBALS[ 'pagenow' ] ); |
|
380 | + wp_die( $this->_getWarnings()."<p><a href='$_sPluginListingPage'>Go back</a>.</p>" ); |
|
381 | 381 | |
382 | 382 | } |
383 | 383 |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | * @since 3.5.0 |
97 | 97 | * @since 3.6.0 Made it accept string content to be passed to the first parameter. |
98 | 98 | */ |
99 | - public function __construct( $sFilePathOrContent='', array $aReplacements=array(), array $aCallbacks=array() ) { |
|
99 | + public function __construct( $sFilePathOrContent = '', array $aReplacements = array(), array $aCallbacks = array() ) { |
|
100 | 100 | |
101 | 101 | $this->sText = file_exists( $sFilePathOrContent ) |
102 | 102 | ? file_get_contents( $sFilePathOrContent ) |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | '/^[\s]*==[\s]*(.+?)[\s]*==/m', |
133 | 133 | $sText, |
134 | 134 | -1, |
135 | - PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY |
|
135 | + PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY |
|
136 | 136 | ); |
137 | 137 | return $_aSections; |
138 | 138 | } |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | * @since 3.5.0 |
144 | 144 | * @return string |
145 | 145 | */ |
146 | - public function get( $sSectionName='' ) { |
|
146 | + public function get( $sSectionName = '' ) { |
|
147 | 147 | return $sSectionName |
148 | 148 | ? $this->getSection( $sSectionName ) |
149 | 149 | : $this->_getParsedText( $this->sText ); |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | */ |
206 | 206 | public function _replyToReplaceCodeBlocks( $aMatches ) { |
207 | 207 | |
208 | - if ( ! isset( $aMatches[ 1 ] ) ) { |
|
208 | + if ( !isset( $aMatches[ 1 ] ) ) { |
|
209 | 209 | return $aMatches[ 0 ]; |
210 | 210 | } |
211 | 211 | |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | */ |
229 | 229 | public function getRawSection( $sSectionName ) { |
230 | 230 | |
231 | - $_iIndex = array_search( $sSectionName, $this->_aSections ); |
|
231 | + $_iIndex = array_search( $sSectionName, $this->_aSections ); |
|
232 | 232 | return false === $_iIndex |
233 | 233 | ? '' |
234 | 234 | : trim( $this->_aSections[ $_iIndex + 1 ] ); |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | // If <?php notation is missing, highlight_string() will not highlight the syntax so add it. |
249 | 249 | $_bHasPHPTag = "<?php" === substr( $sCode, 0, 5 ); |
250 | 250 | |
251 | - $sCode = $_bHasPHPTag ? $sCode : "<?php " . $sCode; |
|
251 | + $sCode = $_bHasPHPTag ? $sCode : "<?php ".$sCode; |
|
252 | 252 | |
253 | 253 | $sCode = str_replace( '"', "'", $sCode ); // highlight_string() crashes if double quotes are contained in the code. |
254 | 254 | $sCode = highlight_string( $sCode, true ); |
@@ -213,7 +213,7 @@ |
||
213 | 213 | get_current_user_id(), |
214 | 214 | 'dismissed_wp_pointers', |
215 | 215 | true |
216 | - ) |
|
216 | + ) |
|
217 | 217 | ); |
218 | 218 | $_aValidPointers = array(); |
219 | 219 |
@@ -111,18 +111,18 @@ discard block |
||
111 | 111 | */ |
112 | 112 | private function _setHooks( $aScreenIDs ) { |
113 | 113 | |
114 | - foreach( $aScreenIDs as $_sScreenID ) { |
|
115 | - if ( ! $_sScreenID ) { |
|
114 | + foreach ( $aScreenIDs as $_sScreenID ) { |
|
115 | + if ( !$_sScreenID ) { |
|
116 | 116 | continue; |
117 | 117 | } |
118 | 118 | add_filter( |
119 | - get_class( $this ) . '-' . $_sScreenID, |
|
119 | + get_class( $this ).'-'.$_sScreenID, |
|
120 | 120 | array( $this, '_replyToSetPointer' ) |
121 | 121 | ); |
122 | 122 | |
123 | 123 | } |
124 | 124 | |
125 | - if ( ! $this->_hasBeenCalled() ) { |
|
125 | + if ( !$this->_hasBeenCalled() ) { |
|
126 | 126 | return; |
127 | 127 | } |
128 | 128 | |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | |
170 | 170 | $_aPointers = $this->_getValidPointers( $this->_getPointers() ); |
171 | 171 | |
172 | - if ( empty( $_aPointers ) || ! is_array( $_aPointers ) ) { |
|
172 | + if ( empty( $_aPointers ) || !is_array( $_aPointers ) ) { |
|
173 | 173 | return; |
174 | 174 | } |
175 | 175 | |
@@ -189,10 +189,10 @@ discard block |
||
189 | 189 | $_oScreen = get_current_screen(); |
190 | 190 | $_sScreenID = $_oScreen->id; |
191 | 191 | if ( in_array( $_sScreenID, $this->aScreenIDs ) ) { |
192 | - return apply_filters( get_class( $this ) . '-' . $_sScreenID, array() ); |
|
192 | + return apply_filters( get_class( $this ).'-'.$_sScreenID, array() ); |
|
193 | 193 | } |
194 | 194 | if ( isset( $_GET[ 'page' ] ) ) { // sanitization unnecessary |
195 | - return apply_filters( get_class( $this ) . '-' . $this->getHTTPQueryGET( 'page' ), array() ); |
|
195 | + return apply_filters( get_class( $this ).'-'.$this->getHTTPQueryGET( 'page' ), array() ); |
|
196 | 196 | } |
197 | 197 | return array(); |
198 | 198 | |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | private function _getValidPointers( $_aPointers ) { |
207 | 207 | |
208 | 208 | // Get dismissed pointers |
209 | - $_aDismissed = explode( |
|
209 | + $_aDismissed = explode( |
|
210 | 210 | ',', |
211 | 211 | ( string ) get_user_meta( |
212 | 212 | get_current_user_id(), |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | $_aPointer[ 'pointer_id' ] = $_iPointerID; |
235 | 235 | |
236 | 236 | // Add the pointer to $_aValidPointers array |
237 | - $_aValidPointers[] = $_aPointer; |
|
237 | + $_aValidPointers[ ] = $_aPointer; |
|
238 | 238 | |
239 | 239 | } |
240 | 240 | return $_aValidPointers; |
@@ -310,9 +310,9 @@ discard block |
||
310 | 310 | * @return string |
311 | 311 | * @internal |
312 | 312 | */ |
313 | - public function _getInternalScript( $aPointers=array() ) { |
|
313 | + public function _getInternalScript( $aPointers = array() ) { |
|
314 | 314 | |
315 | - $_aJSArray = json_encode( $aPointers ); |
|
315 | + $_aJSArray = json_encode( $aPointers ); |
|
316 | 316 | |
317 | 317 | /** |
318 | 318 | * Checks check-boxes in siblings. |
@@ -191,7 +191,8 @@ |
||
191 | 191 | if ( in_array( $_sScreenID, $this->aScreenIDs ) ) { |
192 | 192 | return apply_filters( get_class( $this ) . '-' . $_sScreenID, array() ); |
193 | 193 | } |
194 | - if ( isset( $_GET[ 'page' ] ) ) { // sanitization unnecessary |
|
194 | + if ( isset( $_GET[ 'page' ] ) ) { |
|
195 | +// sanitization unnecessary |
|
195 | 196 | return apply_filters( get_class( $this ) . '-' . $this->getHTTPQueryGET( 'page' ), array() ); |
196 | 197 | } |
197 | 198 | return array(); |
@@ -260,7 +260,7 @@ |
||
260 | 260 | in_array( |
261 | 261 | substr( $_sIterationItem, strrpos( $_sIterationItem, '/' ) + 1 ), |
262 | 262 | array( '.', '..' ) |
263 | - ) |
|
263 | + ) |
|
264 | 264 | ) { |
265 | 265 | return; |
266 | 266 | } |
@@ -55,8 +55,8 @@ discard block |
||
55 | 55 | * |
56 | 56 | * @since 3.6.0 |
57 | 57 | */ |
58 | - public $aOptions = array( |
|
59 | - 'include_directory' => false, // (boolean) whether the contents should be put inside a root directory. |
|
58 | + public $aOptions = array( |
|
59 | + 'include_directory' => false, // (boolean) whether the contents should be put inside a root directory. |
|
60 | 60 | 'additional_source_directories' => array(), |
61 | 61 | // 'ignoring_file_extensions' => array(), // not implemented yet. |
62 | 62 | ); |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | * @param array|boolean $abOptions |
71 | 71 | * @param callable $aCallbacks |
72 | 72 | */ |
73 | - public function __construct( $sSource, $sDestination, $abOptions=false, array $aCallbacks=array() ) { |
|
73 | + public function __construct( $sSource, $sDestination, $abOptions = false, array $aCallbacks = array() ) { |
|
74 | 74 | |
75 | 75 | $this->sSource = $sSource; |
76 | 76 | $this->sDestination = $sDestination; |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | public function compress() { |
104 | 104 | |
105 | 105 | // Check whether it is possible to perform the task. |
106 | - if ( ! $this->isFeasible( $this->sSource ) ) { |
|
106 | + if ( !$this->isFeasible( $this->sSource ) ) { |
|
107 | 107 | return false; |
108 | 108 | } |
109 | 109 | |
@@ -113,19 +113,19 @@ discard block |
||
113 | 113 | } |
114 | 114 | |
115 | 115 | $_oZip = new ZipArchive(); |
116 | - if ( ! $_oZip->open( $this->sDestination, ZIPARCHIVE::CREATE ) ) { |
|
116 | + if ( !$_oZip->open( $this->sDestination, ZIPARCHIVE::CREATE ) ) { |
|
117 | 117 | return false; |
118 | 118 | } |
119 | 119 | |
120 | 120 | $this->sSource = $this->_getSanitizedSourcePath( $this->sSource ); |
121 | 121 | // $this->sSource = str_replace( '\\', '/', realpath( $this->sSource ) ); |
122 | 122 | |
123 | - $_aMethods = array( |
|
123 | + $_aMethods = array( |
|
124 | 124 | 'unknown' => '_replyToReturnFalse', |
125 | 125 | 'directory' => '_replyToCompressDirectory', |
126 | 126 | 'file' => '_replyToCompressFile', |
127 | 127 | ); |
128 | - $_sMethodName = $_aMethods[ $this->_getSourceType( $this->sSource ) ]; |
|
128 | + $_sMethodName = $_aMethods[ $this->_getSourceType( $this->sSource ) ]; |
|
129 | 129 | return call_user_func_array( |
130 | 130 | array( $this, $_sMethodName ), |
131 | 131 | array( |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | * @return boolean True on success, false otherwise. |
154 | 154 | * @internal |
155 | 155 | */ |
156 | - public function _replyToCompressDirectory( ZipArchive $oZip, $sSourceDirPath, array $aCallbacks=array(), $bIncludeDir=false, array $aAdditionalSourceDirs=array() ) { |
|
156 | + public function _replyToCompressDirectory( ZipArchive $oZip, $sSourceDirPath, array $aCallbacks = array(), $bIncludeDir = false, array $aAdditionalSourceDirs = array() ) { |
|
157 | 157 | |
158 | 158 | $_sArchiveRootDirName = ''; |
159 | 159 | |
@@ -184,11 +184,11 @@ discard block |
||
184 | 184 | * @return void |
185 | 185 | * @internal |
186 | 186 | */ |
187 | - private function _addArchiveItems( $oZip, $aSourceDirPaths, $aCallbacks, $sRootDirName='' ) { |
|
187 | + private function _addArchiveItems( $oZip, $aSourceDirPaths, $aCallbacks, $sRootDirName = '' ) { |
|
188 | 188 | |
189 | - $sRootDirName = $sRootDirName ? rtrim( $sRootDirName, '/' ) . '/' : ''; |
|
189 | + $sRootDirName = $sRootDirName ? rtrim( $sRootDirName, '/' ).'/' : ''; |
|
190 | 190 | |
191 | - foreach( $aSourceDirPaths as $_isIndexOrRelativeDirPath => $_sSourceDirPath ) { |
|
191 | + foreach ( $aSourceDirPaths as $_isIndexOrRelativeDirPath => $_sSourceDirPath ) { |
|
192 | 192 | |
193 | 193 | $_sSourceDirPath = $this->_getSanitizedSourcePath( $_sSourceDirPath ); |
194 | 194 | $_sInsideDirPrefix = is_integer( $_isIndexOrRelativeDirPath ) |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | : $_isIndexOrRelativeDirPath; |
197 | 197 | |
198 | 198 | // Add a directory inside the compressing directory. |
199 | - if( $_sInsideDirPrefix ) { |
|
199 | + if ( $_sInsideDirPrefix ) { |
|
200 | 200 | $this->_addRelativeDir( |
201 | 201 | $oZip, |
202 | 202 | $_sInsideDirPrefix, |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | $_sSourceDirPath, |
215 | 215 | $_sIterationItem, |
216 | 216 | $aCallbacks, |
217 | - $sRootDirName . $_sInsideDirPrefix |
|
217 | + $sRootDirName.$_sInsideDirPrefix |
|
218 | 218 | ); |
219 | 219 | } |
220 | 220 | } |
@@ -229,8 +229,8 @@ discard block |
||
229 | 229 | $sRelativeDirPath = str_replace( '\\', '/', $sRelativeDirPath ); |
230 | 230 | $_aPathPartsParse = array_filter( explode( '/', $sRelativeDirPath ) ); |
231 | 231 | $_aDirPath = array(); |
232 | - foreach( $_aPathPartsParse as $_sDirName ) { |
|
233 | - $_aDirPath[] = $_sDirName; |
|
232 | + foreach ( $_aPathPartsParse as $_sDirName ) { |
|
233 | + $_aDirPath[ ] = $_sDirName; |
|
234 | 234 | $this->_addEmptyDir( |
235 | 235 | $oZip, |
236 | 236 | implode( '/', $_aDirPath ), |
@@ -250,10 +250,10 @@ discard block |
||
250 | 250 | * @return void |
251 | 251 | * @internal |
252 | 252 | */ |
253 | - private function _addArchiveItem( ZipArchive $oZip, $sSource, $_sIterationItem, array $aCallbacks, $sInsidePathPrefix='' ) { |
|
253 | + private function _addArchiveItem( ZipArchive $oZip, $sSource, $_sIterationItem, array $aCallbacks, $sInsidePathPrefix = '' ) { |
|
254 | 254 | |
255 | 255 | $_sIterationItem = str_replace( '\\', '/', $_sIterationItem ); |
256 | - $sInsidePathPrefix = rtrim( $sInsidePathPrefix, '/' ) . '/'; // add a trailing slash |
|
256 | + $sInsidePathPrefix = rtrim( $sInsidePathPrefix, '/' ).'/'; // add a trailing slash |
|
257 | 257 | |
258 | 258 | // Ignore "." and ".." folders |
259 | 259 | if ( |
@@ -271,18 +271,18 @@ discard block |
||
271 | 271 | if ( true === is_dir( $_sIterationItem ) ) { |
272 | 272 | $this->_addEmptyDir( |
273 | 273 | $oZip, |
274 | - $sInsidePathPrefix . str_replace( |
|
275 | - $sSource . '/', |
|
274 | + $sInsidePathPrefix.str_replace( |
|
275 | + $sSource.'/', |
|
276 | 276 | '', |
277 | - $_sIterationItem . '/' |
|
277 | + $_sIterationItem.'/' |
|
278 | 278 | ), |
279 | 279 | $aCallbacks[ 'directory_name' ] |
280 | 280 | ); |
281 | 281 | } else if ( true === is_file( $_sIterationItem ) ) { |
282 | 282 | $this->_addFromString( |
283 | 283 | $oZip, |
284 | - $sInsidePathPrefix . str_replace( |
|
285 | - $sSource . '/', |
|
284 | + $sInsidePathPrefix.str_replace( |
|
285 | + $sSource.'/', |
|
286 | 286 | '', |
287 | 287 | $_sIterationItem |
288 | 288 | ), |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | * @return boolean True on success, false otherwise. |
313 | 313 | * @internal |
314 | 314 | */ |
315 | - public function _replyToCompressFile( ZipArchive $oZip, $sSourceFilePath, $aCallbacks=null ) { |
|
315 | + public function _replyToCompressFile( ZipArchive $oZip, $sSourceFilePath, $aCallbacks = null ) { |
|
316 | 316 | $this->_addFromString( |
317 | 317 | $oZip, |
318 | 318 | basename( $sSourceFilePath ), |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | * @internal |
346 | 346 | */ |
347 | 347 | private function isFeasible( $sSource ) { |
348 | - if ( ! extension_loaded( 'zip' ) ) { |
|
348 | + if ( !extension_loaded( 'zip' ) ) { |
|
349 | 349 | return false; |
350 | 350 | } |
351 | 351 | return file_exists( $sSource ); |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | */ |
372 | 372 | private function _addEmptyDir( ZipArchive $oZip, $sInsidePath, $oCallable ) { |
373 | 373 | $sInsidePath = $this->_getFilteredArchivePath( $sInsidePath, $oCallable ); |
374 | - if ( ! strlen( $sInsidePath ) ) { |
|
374 | + if ( !strlen( $sInsidePath ) ) { |
|
375 | 375 | return; |
376 | 376 | } |
377 | 377 | $oZip->addEmptyDir( ltrim( $sInsidePath, '/' ) ); |
@@ -384,10 +384,10 @@ discard block |
||
384 | 384 | * @return void |
385 | 385 | * @internal |
386 | 386 | */ |
387 | - private function _addFromString( ZipArchive $oZip, $sInsidePath, $sSourceContents='', array $aCallbacks=array() ) { |
|
387 | + private function _addFromString( ZipArchive $oZip, $sInsidePath, $sSourceContents = '', array $aCallbacks = array() ) { |
|
388 | 388 | |
389 | 389 | $sInsidePath = $this->_getFilteredArchivePath( $sInsidePath, $aCallbacks[ 'file_name' ] ); |
390 | - if ( ! strlen( $sInsidePath ) ) { |
|
390 | + if ( !strlen( $sInsidePath ) ) { |
|
391 | 391 | return; |
392 | 392 | } |
393 | 393 | $oZip->addFromString( |
@@ -196,7 +196,6 @@ |
||
196 | 196 | * For common hooks throughout the other factory components, see [Base Factory](./package-AdminPageFramework.Common.Factory.html). |
197 | 197 | * |
198 | 198 | * <h3>Factory Specific Hooks</h3> |
199 | - |
|
200 | 199 | * <h4> Action Hooks</h4> |
201 | 200 | * <ul> |
202 | 201 | * <li>**load_{page slug}** – [2.1.0+] triggered when the framework's page is loaded before the header gets sent. This will not be triggered in the admin pages that are not registered by the framework. The first parameter: class object [3.1.2+].</li> |