@@ -92,7 +92,6 @@ discard block |
||
92 | 92 | * 'code_block' => ..., |
93 | 93 | * |
94 | 94 | * )</code> |
95 | - * @param array $aOptions The options array which determines the behaviour of the class. |
|
96 | 95 | * @since 3.5.0 |
97 | 96 | * @since 3.6.0 Made it accept string content to be passed to the first parameter. |
98 | 97 | */ |
@@ -167,6 +166,7 @@ discard block |
||
167 | 166 | * Returns the parsed text. |
168 | 167 | * @since 3.5.0 |
169 | 168 | * @internal |
169 | + * @param string $sContent |
|
170 | 170 | */ |
171 | 171 | private function _getParsedText( $sContent ) { |
172 | 172 |
@@ -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 ); |
@@ -194,6 +194,7 @@ discard block |
||
194 | 194 | * Returns a php warning if present. |
195 | 195 | * @since 3.5.3 |
196 | 196 | * @internal |
197 | + * @param string $sType |
|
197 | 198 | * @return string The warning. |
198 | 199 | */ |
199 | 200 | private function _getWarningByType( $sType ) { |
@@ -293,6 +294,7 @@ discard block |
||
293 | 294 | * if it returns non true (false), it stores the subject warning and returns the array holding the warnings. |
294 | 295 | * |
295 | 296 | * @since 3.4.6 |
297 | + * @param string $sFuncName |
|
296 | 298 | * @return array The warning array. |
297 | 299 | * @internal |
298 | 300 | */ |
@@ -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( preg_replace( '/[\/\\\\]wp-content$/', '', rtrim( WP_CONTENT_DIR, '/\\' ) ) . '/wp-admin/includes/plugin.php' ) ) { |
|
367 | + $this->aWarnings[ ] = '<strong>'.$sMessage.'</strong>'; |
|
368 | + if ( !function_exists( 'deactivate_plugins' ) ) { |
|
369 | + if ( !@include( preg_replace( '/[\/\\\\]wp-content$/', '', rtrim( WP_CONTENT_DIR, '/\\' ) ).'/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 |
@@ -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 | ); |
@@ -127,7 +127,7 @@ |
||
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 ] |
@@ -259,6 +259,7 @@ discard block |
||
259 | 259 | * Generates the framework zip data. |
260 | 260 | * |
261 | 261 | * @since 3.5.4 |
262 | + * @param string $sFrameworkDirPath |
|
262 | 263 | * @return string The binary zip data. |
263 | 264 | */ |
264 | 265 | private function _getDownloadFrameworkZipFile( $sFrameworkDirPath, $sDestinationPath ) { |
@@ -310,11 +311,7 @@ discard block |
||
310 | 311 | * |
311 | 312 | * @since 3.5.4 |
312 | 313 | * @remark string $sPath The path to check. It can be a directory or a file. |
313 | - * @param string $sPathInArchive The parsing directory path set to the archive. |
|
314 | - * The passed path for the archive has a trailing slash. It starts with a directory name. |
|
315 | - * e.g. |
|
316 | - * `utility/AdminPageFramework_WPReadmeParser/` |
|
317 | - * `factory/widget/model/` |
|
314 | + * @param string $sPath |
|
318 | 315 | * @return boolean |
319 | 316 | */ |
320 | 317 | private function _isAllowedArchivePath( $sPath ) { |
@@ -578,6 +575,7 @@ discard block |
||
578 | 575 | * Modifies the text domain in the given file contents. |
579 | 576 | * |
580 | 577 | * @since 3.5.4 |
578 | + * @param string $sFileContents |
|
581 | 579 | * @return string |
582 | 580 | */ |
583 | 581 | private function _modifyTextDomain( $sFileContents ) { |
@@ -596,6 +594,7 @@ discard block |
||
596 | 594 | * Retrieves the value from the $_POST array by the given field ID. |
597 | 595 | * |
598 | 596 | * @since 3.5.4 |
597 | + * @param string $sFieldID |
|
599 | 598 | * @return string |
600 | 599 | */ |
601 | 600 | 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 |
@@ -127,8 +127,8 @@ discard block |
||
127 | 127 | 'label_min_width' => 0, |
128 | 128 | 'order' => 100, |
129 | 129 | 'value' => __( 'Download', 'adimn-page-framework-demo' ), |
130 | - 'file_name' => 'admin-page-framework.zip', // the default file name. This will be modified by the filter. |
|
131 | - 'format' => 'text', // 'json', 'text', 'array' |
|
130 | + 'file_name' => 'admin-page-framework.zip', // the default file name. This will be modified by the filter. |
|
131 | + 'format' => 'text', // 'json', 'text', 'array' |
|
132 | 132 | 'description' => $oFactory->oUtil->getAOrB( |
133 | 133 | class_exists( 'ZipArchive' ), |
134 | 134 | __( 'Download the compiled framework files as a zip file.', 'admin-page-framework-loader' ), |
@@ -183,8 +183,8 @@ discard block |
||
183 | 183 | |
184 | 184 | // the class prefix must not contain white spaces and some other characters not supported in PHP class names. |
185 | 185 | preg_match( |
186 | - '/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/', // pattern - allowed characters for variables in PHP. |
|
187 | - $aInput[ 'class_prefix' ], // subject |
|
186 | + '/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/', // pattern - allowed characters for variables in PHP. |
|
187 | + $aInput[ 'class_prefix' ], // subject |
|
188 | 188 | $_aMatches |
189 | 189 | ); |
190 | 190 | if ( $aInput[ 'class_prefix' ] && empty( $_aMatches ) ) { |
@@ -192,13 +192,13 @@ discard block |
||
192 | 192 | $_bVerified = false; |
193 | 193 | } |
194 | 194 | |
195 | - if ( ! $aInput[ 'text_domain' ] ) { |
|
195 | + if ( !$aInput[ 'text_domain' ] ) { |
|
196 | 196 | $_aErrors[ $this->sSectionID ][ 'text_domain' ] = __( 'The text domain cannot be empty.', 'admin-page-framework-loader' ); |
197 | 197 | $_bVerified = false; |
198 | 198 | } |
199 | 199 | |
200 | 200 | // An invalid value is found. Set a field error array and an admin notice and return the old values. |
201 | - if ( ! $_bVerified ) { |
|
201 | + if ( !$_bVerified ) { |
|
202 | 202 | $oAdminPage->setFieldErrors( $_aErrors ); |
203 | 203 | $oAdminPage->setSettingNotice( __( 'There was something wrong with your input.', 'admin-page-framework-loader' ) ); |
204 | 204 | return $aOldInput; |
@@ -240,8 +240,8 @@ discard block |
||
240 | 240 | */ |
241 | 241 | public function replyToDownloadFramework( $aSavedData, $sSubmittedFieldID, $sSubmittedInputID, $oAdminPage ) { |
242 | 242 | |
243 | - $_sFrameworkDirPath = AdminPageFrameworkLoader_Registry::$sDirPath . '/library/apf'; |
|
244 | - if ( ! file_exists( $_sFrameworkDirPath ) ) { |
|
243 | + $_sFrameworkDirPath = AdminPageFrameworkLoader_Registry::$sDirPath.'/library/apf'; |
|
244 | + if ( !file_exists( $_sFrameworkDirPath ) ) { |
|
245 | 245 | return $aSavedData; |
246 | 246 | } |
247 | 247 | |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | $_sFrameworkDirPath, |
251 | 251 | $_sTempFile |
252 | 252 | ); |
253 | - header( "Content-Length: " . strlen( $_sData ) ); |
|
253 | + header( "Content-Length: ".strlen( $_sData ) ); |
|
254 | 254 | unlink( $_sTempFile ); |
255 | 255 | return $_sData; |
256 | 256 | |
@@ -267,9 +267,9 @@ discard block |
||
267 | 267 | $sFrameworkDirPath, |
268 | 268 | $sDestinationPath, |
269 | 269 | array( |
270 | - 'include_directory' => false, // wrap contents in a sub-directory |
|
270 | + 'include_directory' => false, // wrap contents in a sub-directory |
|
271 | 271 | 'additional_source_directories' => apply_filters( |
272 | - AdminPageFrameworkLoader_Registry::HOOK_SLUG . '_filter_generator_additional_source_directories', |
|
272 | + AdminPageFrameworkLoader_Registry::HOOK_SLUG.'_filter_generator_additional_source_directories', |
|
273 | 273 | array() // directory paths |
274 | 274 | ), |
275 | 275 | ), |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | ) |
281 | 281 | ); |
282 | 282 | $_bSucceed = $_oZip->compress(); |
283 | - if ( ! $_bSucceed ) { |
|
283 | + if ( !$_bSucceed ) { |
|
284 | 284 | return ''; |
285 | 285 | } |
286 | 286 | return file_get_contents( $sDestinationPath ); |
@@ -300,7 +300,7 @@ discard block |
||
300 | 300 | |
301 | 301 | // Check if it belongs to selected components. |
302 | 302 | if ( false === $this->_isAllowedArchivePath( $sPathInArchive ) ) { |
303 | - return ''; // empty value will drop the entry |
|
303 | + return ''; // empty value will drop the entry |
|
304 | 304 | } |
305 | 305 | return $sPathInArchive; |
306 | 306 | |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | */ |
320 | 320 | private function _isAllowedArchivePath( $sPath ) { |
321 | 321 | |
322 | - foreach( $this->_getDisallowedArchiveDirectoryPaths() as $_sDisallowedPath ) { |
|
322 | + foreach ( $this->_getDisallowedArchiveDirectoryPaths() as $_sDisallowedPath ) { |
|
323 | 323 | $_bHasPrefix = $this->oFactory->oUtil->hasPrefix( |
324 | 324 | ltrim( $_sDisallowedPath, '/' ), // needle |
325 | 325 | ltrim( $sPath, '/' ) // haystack |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | // List paths. |
393 | 393 | $_aAllComponentsPaths = array(); |
394 | 394 | $_aSelectedComponentsPaths = array(); |
395 | - foreach( $this->_aComponentPaths as $_sKey => $_aPaths ) { |
|
395 | + foreach ( $this->_aComponentPaths as $_sKey => $_aPaths ) { |
|
396 | 396 | |
397 | 397 | // Extract all component paths. |
398 | 398 | $_aAllComponentsPaths = array_merge( |
@@ -447,16 +447,16 @@ discard block |
||
447 | 447 | |
448 | 448 | // Check the file extension. |
449 | 449 | $_aAllowedExtensions = apply_filters( |
450 | - AdminPageFrameworkLoader_Registry::HOOK_SLUG . '_filter_generator_allowed_file_extensions', |
|
450 | + AdminPageFrameworkLoader_Registry::HOOK_SLUG.'_filter_generator_allowed_file_extensions', |
|
451 | 451 | array( 'php', 'css', 'js' ) |
452 | 452 | ); |
453 | - if ( ! in_array( pathinfo( $sPathInArchive, PATHINFO_EXTENSION ), $_aAllowedExtensions ) ) { |
|
453 | + if ( !in_array( pathinfo( $sPathInArchive, PATHINFO_EXTENSION ), $_aAllowedExtensions ) ) { |
|
454 | 454 | return $sFileContents; |
455 | 455 | } |
456 | 456 | |
457 | 457 | // Modify the file contents. |
458 | 458 | $sFileContents = apply_filters( |
459 | - AdminPageFrameworkLoader_Registry::HOOK_SLUG . '_filter_generator_file_contents', |
|
459 | + AdminPageFrameworkLoader_Registry::HOOK_SLUG.'_filter_generator_file_contents', |
|
460 | 460 | $sFileContents, |
461 | 461 | $sPathInArchive, |
462 | 462 | $this->oFactory->oUtil->getElement( |
@@ -517,12 +517,12 @@ discard block |
||
517 | 517 | $this->_getCheckedComponents() |
518 | 518 | ); |
519 | 519 | $_aInsert = array( |
520 | - 'Included Components: ' . implode( ', ', $_aCheckedComponents ), |
|
521 | - 'Generated on ' . date( 'Y-m-d' ), // today's date |
|
520 | + 'Included Components: '.implode( ', ', $_aCheckedComponents ), |
|
521 | + 'Generated on '.date( 'Y-m-d' ), // today's date |
|
522 | 522 | ); |
523 | 523 | return preg_replace( |
524 | 524 | '#\*/#', // needle - matches '*/' |
525 | - implode( PHP_EOL . ' ', $_aInsert ) . ' \0', // replacement \0 is a back-reference to '*/' |
|
525 | + implode( PHP_EOL.' ', $_aInsert ).' \0', // replacement \0 is a back-reference to '*/' |
|
526 | 526 | $sFileContents, // subject |
527 | 527 | 1 // replace only the first occurrence |
528 | 528 | ); |
@@ -536,14 +536,14 @@ discard block |
||
536 | 536 | private function _modifyClassNameOfInclusionList( $sFileContents ) { |
537 | 537 | // Replace the array key names. |
538 | 538 | $sFileContents = preg_replace_callback( |
539 | - '/(["\'])(.+)\1(?=\s?+=>)/', // pattern ' |
|
540 | - array( $this, '_replyToModifyPathName' ), // callable |
|
539 | + '/(["\'])(.+)\1(?=\s?+=>)/', // pattern ' |
|
540 | + array( $this, '_replyToModifyPathName' ), // callable |
|
541 | 541 | $sFileContents // subject |
542 | 542 | ); |
543 | 543 | // Replace the registry class names. |
544 | 544 | return preg_replace_callback( |
545 | - '/(=>\s?+)(.+)(?=::)/', // pattern ' |
|
546 | - array( $this, '_replyToModifyPathName' ), // callable |
|
545 | + '/(=>\s?+)(.+)(?=::)/', // pattern ' |
|
546 | + array( $this, '_replyToModifyPathName' ), // callable |
|
547 | 547 | $sFileContents // subject |
548 | 548 | ); |
549 | 549 | } |
@@ -568,7 +568,7 @@ discard block |
||
568 | 568 | return strlen( $_sPrefix ) |
569 | 569 | ? str_replace( |
570 | 570 | 'AdminPageFramework', // search |
571 | - $_sPrefix . 'AdminPageFramework', // replace |
|
571 | + $_sPrefix.'AdminPageFramework', // replace |
|
572 | 572 | $sSubject // subject |
573 | 573 | ) |
574 | 574 | : $sSubject; |
@@ -600,7 +600,7 @@ discard block |
||
600 | 600 | */ |
601 | 601 | private function _getFormSubmitValueByFieldIDAsString( $sFieldID ) { |
602 | 602 | |
603 | - static $_aCaches=array(); |
|
603 | + static $_aCaches = array(); |
|
604 | 604 | $_aCaches[ $sFieldID ] = isset( $_aCaches[ $sFieldID ] ) |
605 | 605 | ? $_aCaches[ $sFieldID ] |
606 | 606 | : $this->oFactory->oUtil->getElement( |
@@ -634,9 +634,9 @@ discard block |
||
634 | 634 | 'public', |
635 | 635 | ), |
636 | 636 | 'Content-Description' => 'File Transfer', |
637 | - 'Content-type' => 'application/octet-stream', // 'application/zip' may work as well |
|
637 | + 'Content-type' => 'application/octet-stream', // 'application/zip' may work as well |
|
638 | 638 | 'Content-Transfer-Encoding' => 'binary', |
639 | - 'Content-Disposition' => 'attachment; filename="' . $sFileName .'";', |
|
639 | + 'Content-Disposition' => 'attachment; filename="'.$sFileName.'";', |
|
640 | 640 | // 'Content-Length' => strlen( $mData ), |
641 | 641 | ) + $aHeader; |
642 | 642 | |
@@ -673,10 +673,10 @@ discard block |
||
673 | 673 | $_sFileNameWOExtension = trim( $_sFileNameWOExtension ); |
674 | 674 | return $this->oFactory->oUtil->getAOrB( |
675 | 675 | $_sFileNameWOExtension, |
676 | - $_sFileNameWOExtension . '-admin-page-framework', |
|
676 | + $_sFileNameWOExtension.'-admin-page-framework', |
|
677 | 677 | 'admin-page-framework' |
678 | 678 | ) |
679 | - . '.' . AdminPageFramework_Registry::VERSION |
|
679 | + . '.'.AdminPageFramework_Registry::VERSION |
|
680 | 680 | . '.zip'; |
681 | 681 | |
682 | 682 | } |
@@ -55,10 +55,10 @@ discard block |
||
55 | 55 | * @since 3.8.0 |
56 | 56 | * @internal |
57 | 57 | */ |
58 | - protected function _setOptionArray( $iTermID=null, $_deprecated=null ) { |
|
58 | + protected function _setOptionArray( $iTermID = null, $_deprecated = null ) { |
|
59 | 59 | $this->oForm->aSavedData = $this->oUtil->addAndApplyFilter( |
60 | 60 | $this, // the caller factory object |
61 | - 'options_' . $this->oProp->sClassName, |
|
61 | + 'options_'.$this->oProp->sClassName, |
|
62 | 62 | $this->_getSavedTermMetas( $iTermID, $this->oForm->aFieldsets ) |
63 | 63 | // @todo maybe pass the term id because the user will not know whihch form data is |
64 | 64 | ); |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | */ |
91 | 91 | public function _replyToValidateOptions( $iTermID ) { |
92 | 92 | |
93 | - if ( ! $this->_shouldProceedValidation() ) { |
|
93 | + if ( !$this->_shouldProceedValidation() ) { |
|
94 | 94 | return; |
95 | 95 | } |
96 | 96 | |
@@ -98,19 +98,19 @@ discard block |
||
98 | 98 | $_aSubmittedFormData = $this->oForm->getSubmittedData( $_POST ); |
99 | 99 | $_aSubmittedFormData = $this->oUtil->addAndApplyFilters( |
100 | 100 | $this, |
101 | - 'validation_' . $this->oProp->sClassName, |
|
101 | + 'validation_'.$this->oProp->sClassName, |
|
102 | 102 | call_user_func_array( // 1st param |
103 | 103 | array( $this, 'validate' ), // triggers __call() |
104 | 104 | array( $_aSubmittedFormData, $_aSavedFormData, $this ) |
105 | 105 | ), // 3.5.10+ |
106 | - $_aSavedFormData, // 2nd param |
|
106 | + $_aSavedFormData, // 2nd param |
|
107 | 107 | $this // 3rd param |
108 | 108 | ); |
109 | 109 | |
110 | 110 | // @todo Update term metas |
111 | 111 | $this->oForm->updateMetaDataByType( |
112 | - $iTermID, // object id |
|
113 | - $_aSubmittedFormData, // user submit form data |
|
112 | + $iTermID, // object id |
|
113 | + $_aSubmittedFormData, // user submit form data |
|
114 | 114 | $this->oForm->dropRepeatableElements( $_aSavedFormData ), // Drop repeatable section elements from the saved meta array. |
115 | 115 | $this->oForm->sStructureType // fields type |
116 | 116 | ); |
@@ -36,7 +36,7 @@ |
||
36 | 36 | * @return string the flat input name attribute |
37 | 37 | */ |
38 | 38 | public function _replyToGetFlatInputName( /* $sFlatNameAttribute, $aField, $sKey, $sSectionIndex */ ) { |
39 | - $_aParams = func_get_args() + array( null, null, null ); |
|
39 | + $_aParams = func_get_args() + array( null, null, null ); |
|
40 | 40 | return $_aParams[ 0 ]; |
41 | 41 | } |
42 | 42 |
@@ -20,6 +20,6 @@ |
||
20 | 20 | /** |
21 | 21 | * The callback function name or the callable object to retrieve meta data. |
22 | 22 | */ |
23 | - protected $osCallable = 'get_term_meta'; |
|
23 | + protected $osCallable = 'get_term_meta'; |
|
24 | 24 | |
25 | 25 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | '' // default value |
54 | 54 | ); |
55 | 55 | |
56 | - if ( ! $this->canUserView( $this->sCapability ) ) { |
|
56 | + if ( !$this->canUserView( $this->sCapability ) ) { |
|
57 | 57 | return ''; |
58 | 58 | } |
59 | 59 | |
@@ -81,10 +81,10 @@ discard block |
||
81 | 81 | ); |
82 | 82 | |
83 | 83 | $_sAddNewTerm = $bEditTerm ? '' : ' add-new-term'; |
84 | - $_sClassSelectors = 'admin-page-framework-form-table-term_meta' . $_sAddNewTerm; |
|
84 | + $_sClassSelectors = 'admin-page-framework-form-table-term_meta'.$_sAddNewTerm; |
|
85 | 85 | return '<tr class="admin-page-framework-form-table-outer-row-term_meta">' |
86 | 86 | . '<td colspan=2>' |
87 | - . '<table class="' . $_sClassSelectors . '">' |
|
87 | + . '<table class="'.$_sClassSelectors.'">' |
|
88 | 88 | . '<tbody>' |
89 | 89 | . '<tr>' |
90 | 90 | . '<td>' |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | /** |
23 | 23 | * Sets up hooks and properties. |
24 | 24 | */ |
25 | - public function __construct( $oProp, $oMsg=null ) { |
|
25 | + public function __construct( $oProp, $oMsg = null ) { |
|
26 | 26 | |
27 | 27 | parent::__construct( $oProp, $oMsg ); |
28 | 28 | |
@@ -30,13 +30,13 @@ discard block |
||
30 | 30 | |
31 | 31 | // This filter for non-network-admin action links is added in the parent constructor. |
32 | 32 | remove_filter( |
33 | - 'plugin_action_links_' . plugin_basename( $this->oProp->aScriptInfo['sPath'] ), |
|
33 | + 'plugin_action_links_'.plugin_basename( $this->oProp->aScriptInfo[ 'sPath' ] ), |
|
34 | 34 | array( $this, '_replyToAddSettingsLinkInPluginListingPage' ), |
35 | 35 | 20 |
36 | 36 | ); |
37 | 37 | // Add the action link filter for the multi-site network admin. |
38 | 38 | add_filter( |
39 | - 'network_admin_plugin_action_links_' . plugin_basename( $this->oProp->aScriptInfo['sPath'] ), |
|
39 | + 'network_admin_plugin_action_links_'.plugin_basename( $this->oProp->aScriptInfo[ 'sPath' ] ), |
|
40 | 40 | array( $this, '_replyToAddSettingsLinkInPluginListingPage' ) |
41 | 41 | ); |
42 | 42 |