@@ -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 ) { |
@@ -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' ] |
@@ -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' ), |
@@ -182,8 +182,8 @@ discard block |
||
| 182 | 182 | |
| 183 | 183 | // the class prefix must not contain white spaces and some other characters not supported in PHP class names. |
| 184 | 184 | preg_match( |
| 185 | - '/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/', // pattern - allowed characters for variables in PHP. |
|
| 186 | - $aInput[ 'class_prefix' ], // subject |
|
| 185 | + '/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/', // pattern - allowed characters for variables in PHP. |
|
| 186 | + $aInput[ 'class_prefix' ], // subject |
|
| 187 | 187 | $_aMatches |
| 188 | 188 | ); |
| 189 | 189 | if ( $aInput[ 'class_prefix' ] && empty( $_aMatches ) ) { |
@@ -191,13 +191,13 @@ discard block |
||
| 191 | 191 | $_bVerified = false; |
| 192 | 192 | } |
| 193 | 193 | |
| 194 | - if ( ! $aInput[ 'text_domain' ] ) { |
|
| 194 | + if ( !$aInput[ 'text_domain' ] ) { |
|
| 195 | 195 | $_aErrors[ $this->sSectionID ][ 'text_domain' ] = __( 'The text domain cannot be empty.', 'admin-page-framework-loader' ); |
| 196 | 196 | $_bVerified = false; |
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | // An invalid value is found. Set a field error array and an admin notice and return the old values. |
| 200 | - if ( ! $_bVerified ) { |
|
| 200 | + if ( !$_bVerified ) { |
|
| 201 | 201 | $oAdminPage->setFieldErrors( $_aErrors ); |
| 202 | 202 | $oAdminPage->setSettingNotice( __( 'There was something wrong with your input.', 'admin-page-framework-loader' ) ); |
| 203 | 203 | return $aOldInput; |
@@ -239,8 +239,8 @@ discard block |
||
| 239 | 239 | */ |
| 240 | 240 | public function replyToDownloadFramework( $aSavedData, $sSubmittedFieldID, $sSubmittedInputID, $oAdminPage ) { |
| 241 | 241 | |
| 242 | - $_sFrameworkDirPath = AdminPageFrameworkLoader_Registry::$sDirPath . '/library/apf'; |
|
| 243 | - if ( ! file_exists( $_sFrameworkDirPath ) ) { |
|
| 242 | + $_sFrameworkDirPath = AdminPageFrameworkLoader_Registry::$sDirPath.'/library/apf'; |
|
| 243 | + if ( !file_exists( $_sFrameworkDirPath ) ) { |
|
| 244 | 244 | return $aSavedData; |
| 245 | 245 | } |
| 246 | 246 | |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | $_sFrameworkDirPath, |
| 250 | 250 | $_sTempFile |
| 251 | 251 | ); |
| 252 | - header( "Content-Length: " . strlen( $_sData ) ); |
|
| 252 | + header( "Content-Length: ".strlen( $_sData ) ); |
|
| 253 | 253 | unlink( $_sTempFile ); |
| 254 | 254 | return $_sData; |
| 255 | 255 | |
@@ -266,9 +266,9 @@ discard block |
||
| 266 | 266 | $sFrameworkDirPath, |
| 267 | 267 | $sDestinationPath, |
| 268 | 268 | array( |
| 269 | - 'include_directory' => false, // wrap contents in a sub-directory |
|
| 269 | + 'include_directory' => false, // wrap contents in a sub-directory |
|
| 270 | 270 | 'additional_source_directories' => apply_filters( |
| 271 | - AdminPageFrameworkLoader_Registry::HOOK_SLUG . '_filter_generator_additional_source_directories', |
|
| 271 | + AdminPageFrameworkLoader_Registry::HOOK_SLUG.'_filter_generator_additional_source_directories', |
|
| 272 | 272 | array() // directory paths |
| 273 | 273 | ), |
| 274 | 274 | ), |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | ) |
| 280 | 280 | ); |
| 281 | 281 | $_bSucceed = $_oZip->compress(); |
| 282 | - if ( ! $_bSucceed ) { |
|
| 282 | + if ( !$_bSucceed ) { |
|
| 283 | 283 | return ''; |
| 284 | 284 | } |
| 285 | 285 | return file_get_contents( $sDestinationPath ); |
@@ -299,7 +299,7 @@ discard block |
||
| 299 | 299 | |
| 300 | 300 | // Check if it belongs to selected components. |
| 301 | 301 | if ( false === $this->_isAllowedArchivePath( $sPathInArchive ) ) { |
| 302 | - return ''; // empty value will drop the entry |
|
| 302 | + return ''; // empty value will drop the entry |
|
| 303 | 303 | } |
| 304 | 304 | return $sPathInArchive; |
| 305 | 305 | |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | */ |
| 319 | 319 | private function _isAllowedArchivePath( $sPath ) { |
| 320 | 320 | |
| 321 | - foreach( $this->_getDisallowedArchiveDirectoryPaths() as $_sDisallowedPath ) { |
|
| 321 | + foreach ( $this->_getDisallowedArchiveDirectoryPaths() as $_sDisallowedPath ) { |
|
| 322 | 322 | $_bHasPrefix = $this->oFactory->oUtil->hasPrefix( |
| 323 | 323 | ltrim( $_sDisallowedPath, '/' ), // needle |
| 324 | 324 | ltrim( $sPath, '/' ) // haystack |
@@ -387,7 +387,7 @@ discard block |
||
| 387 | 387 | // List paths. |
| 388 | 388 | $_aAllComponentsPaths = array(); |
| 389 | 389 | $_aSelectedComponentsPaths = array(); |
| 390 | - foreach( $this->_aComponentPaths as $_sKey => $_aPaths ) { |
|
| 390 | + foreach ( $this->_aComponentPaths as $_sKey => $_aPaths ) { |
|
| 391 | 391 | |
| 392 | 392 | // Extract all component paths. |
| 393 | 393 | $_aAllComponentsPaths = array_merge( |
@@ -442,16 +442,16 @@ discard block |
||
| 442 | 442 | |
| 443 | 443 | // Check the file extension. |
| 444 | 444 | $_aAllowedExtensions = apply_filters( |
| 445 | - AdminPageFrameworkLoader_Registry::HOOK_SLUG . '_filter_generator_allowed_file_extensions', |
|
| 445 | + AdminPageFrameworkLoader_Registry::HOOK_SLUG.'_filter_generator_allowed_file_extensions', |
|
| 446 | 446 | array( 'php', 'css', 'js' ) |
| 447 | 447 | ); |
| 448 | - if ( ! in_array( pathinfo( $sPathInArchive, PATHINFO_EXTENSION ), $_aAllowedExtensions ) ) { |
|
| 448 | + if ( !in_array( pathinfo( $sPathInArchive, PATHINFO_EXTENSION ), $_aAllowedExtensions ) ) { |
|
| 449 | 449 | return $sFileContents; |
| 450 | 450 | } |
| 451 | 451 | |
| 452 | 452 | // Modify the file contents. |
| 453 | 453 | $sFileContents = apply_filters( |
| 454 | - AdminPageFrameworkLoader_Registry::HOOK_SLUG . '_filter_generator_file_contents', |
|
| 454 | + AdminPageFrameworkLoader_Registry::HOOK_SLUG.'_filter_generator_file_contents', |
|
| 455 | 455 | $sFileContents, |
| 456 | 456 | $sPathInArchive, |
| 457 | 457 | $this->oFactory->oUtil->getElement( |
@@ -512,12 +512,12 @@ discard block |
||
| 512 | 512 | $this->_getCheckedComponents() |
| 513 | 513 | ); |
| 514 | 514 | $_aInsert = array( |
| 515 | - 'Included Components: ' . implode( ', ', $_aCheckedComponents ), |
|
| 516 | - 'Generated on ' . date( 'Y-m-d' ), // today's date |
|
| 515 | + 'Included Components: '.implode( ', ', $_aCheckedComponents ), |
|
| 516 | + 'Generated on '.date( 'Y-m-d' ), // today's date |
|
| 517 | 517 | ); |
| 518 | 518 | return preg_replace( |
| 519 | 519 | '#\*/#', // needle - matches '*/' |
| 520 | - implode( PHP_EOL . ' ', $_aInsert ) . ' \0', // replacement \0 is a back-reference to '*/' |
|
| 520 | + implode( PHP_EOL.' ', $_aInsert ).' \0', // replacement \0 is a back-reference to '*/' |
|
| 521 | 521 | $sFileContents, // subject |
| 522 | 522 | 1 // replace only the first occurrence |
| 523 | 523 | ); |
@@ -531,14 +531,14 @@ discard block |
||
| 531 | 531 | private function _modifyClassNameOfInclusionList( $sFileContents ) { |
| 532 | 532 | // Replace the array key names. |
| 533 | 533 | $sFileContents = preg_replace_callback( |
| 534 | - '/(["\'])(.+)\1(?=\s?+=>)/', // pattern ' |
|
| 535 | - array( $this, '_replyToModifyPathName' ), // callable |
|
| 534 | + '/(["\'])(.+)\1(?=\s?+=>)/', // pattern ' |
|
| 535 | + array( $this, '_replyToModifyPathName' ), // callable |
|
| 536 | 536 | $sFileContents // subject |
| 537 | 537 | ); |
| 538 | 538 | // Replace the registry class names. |
| 539 | 539 | return preg_replace_callback( |
| 540 | - '/(=>\s?+)(.+)(?=::)/', // pattern ' |
|
| 541 | - array( $this, '_replyToModifyPathName' ), // callable |
|
| 540 | + '/(=>\s?+)(.+)(?=::)/', // pattern ' |
|
| 541 | + array( $this, '_replyToModifyPathName' ), // callable |
|
| 542 | 542 | $sFileContents // subject |
| 543 | 543 | ); |
| 544 | 544 | } |
@@ -563,7 +563,7 @@ discard block |
||
| 563 | 563 | return strlen( $_sPrefix ) |
| 564 | 564 | ? str_replace( |
| 565 | 565 | 'AdminPageFramework', // search |
| 566 | - $_sPrefix . 'AdminPageFramework', // replace |
|
| 566 | + $_sPrefix.'AdminPageFramework', // replace |
|
| 567 | 567 | $sSubject // subject |
| 568 | 568 | ) |
| 569 | 569 | : $sSubject; |
@@ -595,7 +595,7 @@ discard block |
||
| 595 | 595 | */ |
| 596 | 596 | private function _getFormSubmitValueByFieldIDAsString( $sFieldID ) { |
| 597 | 597 | |
| 598 | - static $_aCaches=array(); |
|
| 598 | + static $_aCaches = array(); |
|
| 599 | 599 | $_aCaches[ $sFieldID ] = isset( $_aCaches[ $sFieldID ] ) |
| 600 | 600 | ? $_aCaches[ $sFieldID ] |
| 601 | 601 | : $this->oFactory->oUtil->getElement( |
@@ -629,9 +629,9 @@ discard block |
||
| 629 | 629 | 'public', |
| 630 | 630 | ), |
| 631 | 631 | 'Content-Description' => 'File Transfer', |
| 632 | - 'Content-type' => 'application/octet-stream', // 'application/zip' may work as well |
|
| 632 | + 'Content-type' => 'application/octet-stream', // 'application/zip' may work as well |
|
| 633 | 633 | 'Content-Transfer-Encoding' => 'binary', |
| 634 | - 'Content-Disposition' => 'attachment; filename="' . $sFileName .'";', |
|
| 634 | + 'Content-Disposition' => 'attachment; filename="'.$sFileName.'";', |
|
| 635 | 635 | // 'Content-Length' => strlen( $mData ), |
| 636 | 636 | ) + $aHeader; |
| 637 | 637 | |
@@ -668,10 +668,10 @@ discard block |
||
| 668 | 668 | $_sFileNameWOExtension = trim( $_sFileNameWOExtension ); |
| 669 | 669 | return $this->oFactory->oUtil->getAOrB( |
| 670 | 670 | $_sFileNameWOExtension, |
| 671 | - $_sFileNameWOExtension . '-admin-page-framework', |
|
| 671 | + $_sFileNameWOExtension.'-admin-page-framework', |
|
| 672 | 672 | 'admin-page-framework' |
| 673 | 673 | ) |
| 674 | - . '.' . AdminPageFramework_Registry::VERSION |
|
| 674 | + . '.'.AdminPageFramework_Registry::VERSION |
|
| 675 | 675 | . '.zip'; |
| 676 | 676 | |
| 677 | 677 | } |
@@ -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' ] |
@@ -219,24 +219,24 @@ discard block |
||
| 219 | 219 | } |
| 220 | 220 | |
| 221 | 221 | /** |
| 222 | - * Adds the given link(s) into the description cell of the plugin listing table. |
|
| 223 | - * |
|
| 224 | - * <h4>Example</h4> |
|
| 225 | - * <code>$this->addLinkToPluginDescription( |
|
| 226 | - * "<a href='http://www.google.com'>Google</a>", |
|
| 227 | - * "<a href='http://www.yahoo.com'>Yahoo!</a>" |
|
| 228 | - * );</code> |
|
| 229 | - * |
|
| 230 | - * @since 2.0.0 |
|
| 231 | - * @since 3.0.0 Changed the scope to public from protected. |
|
| 232 | - * @since 3.3.1 Moved from `AdminPageFramework`. |
|
| 233 | - * @remark Accepts variadic parameters; the number of accepted parameters are not limited to three. |
|
| 234 | - * @param string the tagged HTML link text. |
|
| 235 | - * @param string (optional) another tagged HTML link text. |
|
| 236 | - * @param string (optional) add more as many as want by adding items to the next parameters. |
|
| 237 | - * @access public |
|
| 238 | - * @return void |
|
| 239 | - */ |
|
| 222 | + * Adds the given link(s) into the description cell of the plugin listing table. |
|
| 223 | + * |
|
| 224 | + * <h4>Example</h4> |
|
| 225 | + * <code>$this->addLinkToPluginDescription( |
|
| 226 | + * "<a href='http://www.google.com'>Google</a>", |
|
| 227 | + * "<a href='http://www.yahoo.com'>Yahoo!</a>" |
|
| 228 | + * );</code> |
|
| 229 | + * |
|
| 230 | + * @since 2.0.0 |
|
| 231 | + * @since 3.0.0 Changed the scope to public from protected. |
|
| 232 | + * @since 3.3.1 Moved from `AdminPageFramework`. |
|
| 233 | + * @remark Accepts variadic parameters; the number of accepted parameters are not limited to three. |
|
| 234 | + * @param string the tagged HTML link text. |
|
| 235 | + * @param string (optional) another tagged HTML link text. |
|
| 236 | + * @param string (optional) add more as many as want by adding items to the next parameters. |
|
| 237 | + * @access public |
|
| 238 | + * @return void |
|
| 239 | + */ |
|
| 240 | 240 | public function addLinkToPluginDescription( $sTaggedLinkHTML1, $sTaggedLinkHTML2=null, $_and_more=null ) { |
| 241 | 241 | if ( method_exists( $this->oLink, '_addLinkToPluginDescription' ) ) { |
| 242 | 242 | $this->oLink->_addLinkToPluginDescription( func_get_args() ); |
@@ -244,23 +244,23 @@ discard block |
||
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | /** |
| 247 | - * Adds the given link(s) into the title cell of the plugin listing table. |
|
| 248 | - * |
|
| 249 | - * <h4>Example</h4> |
|
| 250 | - * <code>$this->addLinkToPluginTitle( |
|
| 251 | - * "<a href='http://www.wordpress.org'>WordPress</a>" |
|
| 252 | - * );</code> |
|
| 253 | - * |
|
| 254 | - * @since 2.0.0 |
|
| 255 | - * @since 3.0.0 Changed the scope to public from protected. |
|
| 256 | - * @since 3.3.1 Moved from `AdminPageFramework`. |
|
| 257 | - * @remark Accepts variadic parameters; the number of accepted parameters are not limited to three. |
|
| 258 | - * @param string the tagged HTML link text. |
|
| 259 | - * @param string (optional) another tagged HTML link text. |
|
| 260 | - * @param string (optional) add more as many as want by adding items to the next parameters. |
|
| 261 | - * @access public |
|
| 262 | - * @return void |
|
| 263 | - */ |
|
| 247 | + * Adds the given link(s) into the title cell of the plugin listing table. |
|
| 248 | + * |
|
| 249 | + * <h4>Example</h4> |
|
| 250 | + * <code>$this->addLinkToPluginTitle( |
|
| 251 | + * "<a href='http://www.wordpress.org'>WordPress</a>" |
|
| 252 | + * );</code> |
|
| 253 | + * |
|
| 254 | + * @since 2.0.0 |
|
| 255 | + * @since 3.0.0 Changed the scope to public from protected. |
|
| 256 | + * @since 3.3.1 Moved from `AdminPageFramework`. |
|
| 257 | + * @remark Accepts variadic parameters; the number of accepted parameters are not limited to three. |
|
| 258 | + * @param string the tagged HTML link text. |
|
| 259 | + * @param string (optional) another tagged HTML link text. |
|
| 260 | + * @param string (optional) add more as many as want by adding items to the next parameters. |
|
| 261 | + * @access public |
|
| 262 | + * @return void |
|
| 263 | + */ |
|
| 264 | 264 | public function addLinkToPluginTitle( $sTaggedLinkHTML1, $sTaggedLinkHTML2=null, $_and_more=null ) { |
| 265 | 265 | if ( method_exists( $this->oLink, '_addLinkToPluginTitle' ) ) { |
| 266 | 266 | $this->oLink->_addLinkToPluginTitle( func_get_args() ); |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | * @param array $aCustomArgs (optional) The argument array for more advanced parameters. |
| 108 | 108 | * @return array The array holing the queued items. |
| 109 | 109 | */ |
| 110 | - public function enqueueStyles( $aSRCs, $sPageSlug='', $sTabSlug='', $aCustomArgs=array() ) { |
|
| 110 | + public function enqueueStyles( $aSRCs, $sPageSlug = '', $sTabSlug = '', $aCustomArgs = array() ) { |
|
| 111 | 111 | if ( method_exists( $this->oResource, '_enqueueStyles' ) ) { |
| 112 | 112 | return $this->oResource->_enqueueStyles( $aSRCs, $sPageSlug, $sTabSlug, $aCustomArgs ); |
| 113 | 113 | } |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | * </ul> |
| 145 | 145 | * @return string The style handle ID. If the passed url is not a valid url string, an empty string will be returned. |
| 146 | 146 | */ |
| 147 | - public function enqueueStyle( $sSRC, $sPageSlug='', $sTabSlug='', $aCustomArgs=array() ) { |
|
| 147 | + public function enqueueStyle( $sSRC, $sPageSlug = '', $sTabSlug = '', $aCustomArgs = array() ) { |
|
| 148 | 148 | if ( method_exists( $this->oResource, '_enqueueStyle' ) ) { |
| 149 | 149 | return $this->oResource->_enqueueStyle( $sSRC, $sPageSlug, $sTabSlug, $aCustomArgs ); |
| 150 | 150 | } |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | * @param array (optional) The argument array for more advanced parameters. |
| 172 | 172 | * @return array The array holding the queued items. |
| 173 | 173 | */ |
| 174 | - public function enqueueScripts( $aSRCs, $sPageSlug='', $sTabSlug='', $aCustomArgs=array() ) { |
|
| 174 | + public function enqueueScripts( $aSRCs, $sPageSlug = '', $sTabSlug = '', $aCustomArgs = array() ) { |
|
| 175 | 175 | if ( method_exists( $this->oResource, '_enqueueScripts' ) ) { |
| 176 | 176 | return $this->oResource->_enqueueScripts( $aSRCs, $sPageSlug, $sTabSlug, $aCustomArgs ); |
| 177 | 177 | } |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | * </ul> |
| 213 | 213 | * @return string The script handle ID. If the passed url is not a valid url string, an empty string will be returned. |
| 214 | 214 | */ |
| 215 | - public function enqueueScript( $sSRC, $sPageSlug='', $sTabSlug='', $aCustomArgs=array() ) { |
|
| 215 | + public function enqueueScript( $sSRC, $sPageSlug = '', $sTabSlug = '', $aCustomArgs = array() ) { |
|
| 216 | 216 | if ( method_exists( $this->oResource, '_enqueueScript' ) ) { |
| 217 | 217 | return $this->oResource->_enqueueScript( $sSRC, $sPageSlug, $sTabSlug, $aCustomArgs ); |
| 218 | 218 | } |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | * @access public |
| 238 | 238 | * @return void |
| 239 | 239 | */ |
| 240 | - public function addLinkToPluginDescription( $sTaggedLinkHTML1, $sTaggedLinkHTML2=null, $_and_more=null ) { |
|
| 240 | + public function addLinkToPluginDescription( $sTaggedLinkHTML1, $sTaggedLinkHTML2 = null, $_and_more = null ) { |
|
| 241 | 241 | if ( method_exists( $this->oLink, '_addLinkToPluginDescription' ) ) { |
| 242 | 242 | $this->oLink->_addLinkToPluginDescription( func_get_args() ); |
| 243 | 243 | } |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | * @access public |
| 262 | 262 | * @return void |
| 263 | 263 | */ |
| 264 | - public function addLinkToPluginTitle( $sTaggedLinkHTML1, $sTaggedLinkHTML2=null, $_and_more=null ) { |
|
| 264 | + public function addLinkToPluginTitle( $sTaggedLinkHTML1, $sTaggedLinkHTML2 = null, $_and_more = null ) { |
|
| 265 | 265 | if ( method_exists( $this->oLink, '_addLinkToPluginTitle' ) ) { |
| 266 | 266 | $this->oLink->_addLinkToPluginTitle( func_get_args() ); |
| 267 | 267 | } |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | * @param string (optional) The class selector used in the message HTML element. 'error' and 'updated' are prepared by WordPress but it's not limited to them and can pass a custom name. Default: 'error'. |
| 318 | 318 | * @param string (optional) The ID of the message. If not set, the hash of the message will be used. |
| 319 | 319 | */ |
| 320 | - public function setAdminNotice( $sMessage, $sClassSelector='error', $sID='' ) { |
|
| 320 | + public function setAdminNotice( $sMessage, $sClassSelector = 'error', $sID = '' ) { |
|
| 321 | 321 | |
| 322 | 322 | $sID = $sID ? $sID : md5( $sMessage ); |
| 323 | 323 | |
@@ -354,9 +354,9 @@ discard block |
||
| 354 | 354 | * @param boolean If true, the passed key(s) will be appended to the property; otherwise, it will override the property. |
| 355 | 355 | * @return void |
| 356 | 356 | */ |
| 357 | - public function setDisallowedQueryKeys( $asQueryKeys, $bAppend=true ) { |
|
| 357 | + public function setDisallowedQueryKeys( $asQueryKeys, $bAppend = true ) { |
|
| 358 | 358 | |
| 359 | - if ( ! $bAppend ) { |
|
| 359 | + if ( !$bAppend ) { |
|
| 360 | 360 | $this->oProp->aDisallowedQueryKeys = ( array ) $asQueryKeys; |
| 361 | 361 | return; |
| 362 | 362 | } |
@@ -399,7 +399,7 @@ discard block |
||
| 399 | 399 | * @param mixed $vDefault the default value that will be returned if nothing is stored. |
| 400 | 400 | * @return mixed If the field ID is not specified |
| 401 | 401 | */ |
| 402 | - static public function getOption( $sOptionKey, $asKey=null, $vDefault=null ) { |
|
| 402 | + static public function getOption( $sOptionKey, $asKey = null, $vDefault = null ) { |
|
| 403 | 403 | return AdminPageFramework_WPUtility::getOption( $sOptionKey, $asKey, $vDefault ); |
| 404 | 404 | } |
| 405 | 405 | |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | * </ul> |
| 213 | 213 | * @return string The script handle ID. If the passed url is not a valid url string, an empty string will be returned. |
| 214 | 214 | */ |
| 215 | - public function enqueueScript( $sSRC, $sPageSlug='', $sTabSlug='', $aCustomArgs=array() ) { |
|
| 215 | + public function enqueueScript( $sSRC, $sPageSlug='', $sTabSlug='', $aCustomArgs=array() ) { |
|
| 216 | 216 | if ( method_exists( $this->oResource, '_enqueueScript' ) ) { |
| 217 | 217 | return $this->oResource->_enqueueScript( $sSRC, $sPageSlug, $sTabSlug, $aCustomArgs ); |
| 218 | 218 | } |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | * @access public |
| 262 | 262 | * @return void |
| 263 | 263 | */ |
| 264 | - public function addLinkToPluginTitle( $sTaggedLinkHTML1, $sTaggedLinkHTML2=null, $_and_more=null ) { |
|
| 264 | + public function addLinkToPluginTitle( $sTaggedLinkHTML1, $sTaggedLinkHTML2=null, $_and_more=null ) { |
|
| 265 | 265 | if ( method_exists( $this->oLink, '_addLinkToPluginTitle' ) ) { |
| 266 | 266 | $this->oLink->_addLinkToPluginTitle( func_get_args() ); |
| 267 | 267 | } |
@@ -224,6 +224,7 @@ discard block |
||
| 224 | 224 | * @param string the tagged HTML link text. |
| 225 | 225 | * @param string (optional) another tagged HTML link text. |
| 226 | 226 | * @param string (optional) add more as many as want by adding items to the next parameters. |
| 227 | + * @param string $sTaggedLinkHTML1 |
|
| 227 | 228 | * @access public |
| 228 | 229 | * @return void |
| 229 | 230 | */ |
@@ -249,6 +250,9 @@ discard block |
||
| 249 | 250 | * @param string the tagged HTML link text. |
| 250 | 251 | * @param string (optional) another tagged HTML link text. |
| 251 | 252 | * @param string (optional) add more as many as want by adding items to the next parameters. |
| 253 | + * @param null|string $sTaggedLinkHTML1 |
|
| 254 | + * @param string $sTaggedLinkHTML2 |
|
| 255 | + * @param string $_and_more |
|
| 252 | 256 | * @access public |
| 253 | 257 | * @return void |
| 254 | 258 | */ |
@@ -268,6 +272,7 @@ discard block |
||
| 268 | 272 | * |
| 269 | 273 | * @since 3.1.0 |
| 270 | 274 | * @since 3.3.1 Moved from `AdminPageFramework`. |
| 275 | + * @param string $sLabel |
|
| 271 | 276 | */ |
| 272 | 277 | public function setPluginSettingsLinkLabel( $sLabel ) { |
| 273 | 278 | $this->oProp->sLabelPluginSettingsLink = $sLabel; |
@@ -70,14 +70,14 @@ discard block |
||
| 70 | 70 | * @since 3.3.0 |
| 71 | 71 | * @since 3.3.1 Moved from `AdminPageFramework_Setting_Base`. |
| 72 | 72 | */ |
| 73 | - public function __construct( $sOptionKey=null, $sCallerPath=null, $sCapability='manage_options', $sTextDomain='admin-page-framework' ) { |
|
| 73 | + public function __construct( $sOptionKey = null, $sCallerPath = null, $sCapability = 'manage_options', $sTextDomain = 'admin-page-framework' ) { |
|
| 74 | 74 | |
| 75 | 75 | parent::__construct( $sOptionKey, $sCallerPath, $sCapability, $sTextDomain ); |
| 76 | 76 | |
| 77 | 77 | if ( $this->oProp->bIsAdminAjax ) { |
| 78 | 78 | return; |
| 79 | 79 | } |
| 80 | - if ( ! $this->oProp->bIsAdmin ) { |
|
| 80 | + if ( !$this->oProp->bIsAdmin ) { |
|
| 81 | 81 | return; |
| 82 | 82 | } |
| 83 | 83 | |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | 'section_title' => null, |
| 128 | 128 | 'section_id' => null, |
| 129 | 129 | ); |
| 130 | - if ( ! $aFieldset[ 'help' ] ) { |
|
| 130 | + if ( !$aFieldset[ 'help' ] ) { |
|
| 131 | 131 | return; |
| 132 | 132 | } |
| 133 | 133 | |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | 'help_tab_id' => $_sRootSectionID, |
| 146 | 146 | 'help_tab_content' => "<span class='contextual-help-tab-title'>" |
| 147 | 147 | . $aFieldset[ 'title' ] |
| 148 | - . "</span> - " . PHP_EOL |
|
| 148 | + . "</span> - ".PHP_EOL |
|
| 149 | 149 | . $aFieldset[ 'help' ], |
| 150 | 150 | 'help_tab_sidebar_content' => $aFieldset[ 'help_aside' ] |
| 151 | 151 | ? $aFieldset[ 'help_aside' ] |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | public function _registerHelpPaneItemsOfFormSections( $aSectionsets ) { |
| 180 | 180 | // @todo Test if help pane item gets displayed |
| 181 | 181 | |
| 182 | - foreach( $aSectionsets as $_aSectionset ) { |
|
| 182 | + foreach ( $aSectionsets as $_aSectionset ) { |
|
| 183 | 183 | // @todo check capability and conditions |
| 184 | 184 | $_aSectionset = $_aSectionset + array( |
| 185 | 185 | 'help' => null, |
@@ -213,13 +213,13 @@ discard block |
||
| 213 | 213 | */ |
| 214 | 214 | public function _replyToDetermineSectionsetVisibility( $bVisible, $aSectionset ) { |
| 215 | 215 | |
| 216 | - if ( ! current_user_can( $aSectionset[ 'capability' ] ) ) { |
|
| 216 | + if ( !current_user_can( $aSectionset[ 'capability' ] ) ) { |
|
| 217 | 217 | return false; |
| 218 | 218 | } |
| 219 | - if ( ! $aSectionset[ 'if' ] ) { |
|
| 219 | + if ( !$aSectionset[ 'if' ] ) { |
|
| 220 | 220 | return false; |
| 221 | 221 | } |
| 222 | - if ( ! $this->_isSectionOfCurrentPage( $aSectionset ) ) { |
|
| 222 | + if ( !$this->_isSectionOfCurrentPage( $aSectionset ) ) { |
|
| 223 | 223 | return false; |
| 224 | 224 | } |
| 225 | 225 | return $bVisible; |
@@ -237,15 +237,15 @@ discard block |
||
| 237 | 237 | private function _isSectionOfCurrentPage( array $aSectionset ) { |
| 238 | 238 | |
| 239 | 239 | // Make sure the value type is string so that when the page_slug is not set, it won't match. |
| 240 | - $_sCurrentPageSlug = ( string ) $this->oProp->getCurrentPageSlug(); |
|
| 240 | + $_sCurrentPageSlug = ( string ) $this->oProp->getCurrentPageSlug(); |
|
| 241 | 241 | |
| 242 | 242 | // Make sure if it's in the loading page. |
| 243 | - if ( $aSectionset[ 'page_slug' ] !== $_sCurrentPageSlug ) { |
|
| 243 | + if ( $aSectionset[ 'page_slug' ] !== $_sCurrentPageSlug ) { |
|
| 244 | 244 | return false; |
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | // If no tag is specified, the user wants to display the section regardless of the tab. |
| 248 | - if ( ! $aSectionset[ 'tab_slug' ] ) { |
|
| 248 | + if ( !$aSectionset[ 'tab_slug' ] ) { |
|
| 249 | 249 | return true; |
| 250 | 250 | } |
| 251 | 251 | |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | */ |
| 262 | 262 | public function _replyToDetermineFieldsetVisibility( $bVisible, $aFieldset ) { |
| 263 | 263 | |
| 264 | - $_sCurrentPageSlug = $this->oProp->getCurrentPageSlug(); |
|
| 264 | + $_sCurrentPageSlug = $this->oProp->getCurrentPageSlug(); |
|
| 265 | 265 | |
| 266 | 266 | // If the specified field does not exist, do nothing. |
| 267 | 267 | if ( $aFieldset[ 'page_slug' ] !== $_sCurrentPageSlug ) { |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | array( $_sSectionPath, 'page_slug' ), |
| 292 | 292 | null |
| 293 | 293 | ); |
| 294 | - $aFieldset[ 'tab_slug' ] = $this->oUtil->getElement( |
|
| 294 | + $aFieldset[ 'tab_slug' ] = $this->oUtil->getElement( |
|
| 295 | 295 | $aSectionsets, |
| 296 | 296 | array( $_sSectionPath, 'tab_slug' ), |
| 297 | 297 | null |
@@ -302,11 +302,11 @@ discard block |
||
| 302 | 302 | $aSectionsets, |
| 303 | 303 | $_sSectionPath |
| 304 | 304 | ); |
| 305 | - $aFieldset[ 'section_title' ] = $this->oUtil->getElement( |
|
| 305 | + $aFieldset[ 'section_title' ] = $this->oUtil->getElement( |
|
| 306 | 306 | $_aSectionset, |
| 307 | 307 | 'title' |
| 308 | 308 | ); |
| 309 | - $aFieldset[ 'capability' ] = $aFieldset[ 'capability' ] |
|
| 309 | + $aFieldset[ 'capability' ] = $aFieldset[ 'capability' ] |
|
| 310 | 310 | ? $aFieldset[ 'capability' ] |
| 311 | 311 | : $this->_replyToGetCapabilityForForm( |
| 312 | 312 | $this->oUtil->getElement( $_aSectionset, 'capability' ), |
@@ -355,13 +355,13 @@ discard block |
||
| 355 | 355 | |
| 356 | 356 | // Find the capability of the parent section if nested. |
| 357 | 357 | if ( 0 < $aSectionset[ '_nested_depth' ] ) { |
| 358 | - $_aSectionPath = $aSectionset[ '_section_path_array' ]; |
|
| 358 | + $_aSectionPath = $aSectionset[ '_section_path_array' ]; |
|
| 359 | 359 | array_pop( $_aSectionPath ); // remove the last element |
| 360 | 360 | $_sParentCapability = $this->oUtil->getElement( |
| 361 | 361 | $this->oForm->aSectionsets, |
| 362 | 362 | array_merge( $_aSectionPath, array( 'capability' ) ) |
| 363 | 363 | ); |
| 364 | - if( $_sParentCapability ) { |
|
| 364 | + if ( $_sParentCapability ) { |
|
| 365 | 365 | return $_sParentCapability; |
| 366 | 366 | } |
| 367 | 367 | } |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | * @return void |
| 177 | 177 | * @since DEVVER |
| 178 | 178 | */ |
| 179 | - public function _registerHelpPaneItemsOfFormSections( $aSectionsets ) { |
|
| 179 | + public function _registerHelpPaneItemsOfFormSections( $aSectionsets ) { |
|
| 180 | 180 | // @todo Test if help pane item gets displayed |
| 181 | 181 | |
| 182 | 182 | foreach( $aSectionsets as $_aSectionset ) { |
@@ -216,10 +216,10 @@ discard block |
||
| 216 | 216 | if ( ! current_user_can( $aSectionset[ 'capability' ] ) ) { |
| 217 | 217 | return false; |
| 218 | 218 | } |
| 219 | - if ( ! $aSectionset[ 'if' ] ) { |
|
| 219 | + if ( ! $aSectionset[ 'if' ] ) { |
|
| 220 | 220 | return false; |
| 221 | 221 | } |
| 222 | - if ( ! $this->_isSectionOfCurrentPage( $aSectionset ) ) { |
|
| 222 | + if ( ! $this->_isSectionOfCurrentPage( $aSectionset ) ) { |
|
| 223 | 223 | return false; |
| 224 | 224 | } |
| 225 | 225 | return $bVisible; |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | $_sCurrentPageSlug = ( string ) $this->oProp->getCurrentPageSlug(); |
| 241 | 241 | |
| 242 | 242 | // Make sure if it's in the loading page. |
| 243 | - if ( $aSectionset[ 'page_slug' ] !== $_sCurrentPageSlug ) { |
|
| 243 | + if ( $aSectionset[ 'page_slug' ] !== $_sCurrentPageSlug ) { |
|
| 244 | 244 | return false; |
| 245 | 245 | } |
| 246 | 246 | |
@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | $_sCurrentPageSlug = $this->oProp->getCurrentPageSlug(); |
| 265 | 265 | |
| 266 | 266 | // If the specified field does not exist, do nothing. |
| 267 | - if ( $aFieldset[ 'page_slug' ] !== $_sCurrentPageSlug ) { |
|
| 267 | + if ( $aFieldset[ 'page_slug' ] !== $_sCurrentPageSlug ) { |
|
| 268 | 268 | return false; |
| 269 | 269 | } |
| 270 | 270 | return parent::_replyToDetermineFieldsetVisibility( $bVisible, $aFieldset ); |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | */ |
| 278 | 278 | public function _replyToFormatFieldsetDefinition( $aFieldset, $aSectionsets ) { |
| 279 | 279 | |
| 280 | - if ( empty( $aFieldset ) ) { |
|
| 280 | + if ( empty( $aFieldset ) ) { |
|
| 281 | 281 | return $aFieldset; |
| 282 | 282 | } |
| 283 | 283 | |
@@ -37,13 +37,13 @@ discard block |
||
| 37 | 37 | */ |
| 38 | 38 | public function _replyToFinalizeInPageTabs() { |
| 39 | 39 | |
| 40 | - if ( ! $this->oProp->isPageAdded() ) { |
|
| 40 | + if ( !$this->oProp->isPageAdded() ) { |
|
| 41 | 41 | return; |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - foreach( $this->oProp->aPages as $_sPageSlug => $_aPage ) { |
|
| 44 | + foreach ( $this->oProp->aPages as $_sPageSlug => $_aPage ) { |
|
| 45 | 45 | |
| 46 | - if ( ! isset( $this->oProp->aInPageTabs[ $_sPageSlug ] ) ) { |
|
| 46 | + if ( !isset( $this->oProp->aInPageTabs[ $_sPageSlug ] ) ) { |
|
| 47 | 47 | continue; |
| 48 | 48 | } |
| 49 | 49 | |
@@ -80,8 +80,8 @@ discard block |
||
| 80 | 80 | * @since 3.6.0 |
| 81 | 81 | */ |
| 82 | 82 | private function _getDefaultInPageTab( $sPageSlug, $aInPageTabs ) { |
| 83 | - foreach( $aInPageTabs as $_aInPageTab ) { |
|
| 84 | - if ( ! isset( $_aInPageTab[ 'tab_slug' ] ) ) { |
|
| 83 | + foreach ( $aInPageTabs as $_aInPageTab ) { |
|
| 84 | + if ( !isset( $_aInPageTab[ 'tab_slug' ] ) ) { |
|
| 85 | 85 | continue; |
| 86 | 86 | } |
| 87 | 87 | // Regardless of whether it's a hidden tab, it is stored as the default in-page tab. |
@@ -37,13 +37,13 @@ discard block |
||
| 37 | 37 | */ |
| 38 | 38 | public function _replyToFinalizeInPageTabs() { |
| 39 | 39 | |
| 40 | - if ( ! $this->oProp->isPageAdded() ) { |
|
| 40 | + if ( ! $this->oProp->isPageAdded() ) { |
|
| 41 | 41 | return; |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | foreach( $this->oProp->aPages as $_sPageSlug => $_aPage ) { |
| 45 | 45 | |
| 46 | - if ( ! isset( $this->oProp->aInPageTabs[ $_sPageSlug ] ) ) { |
|
| 46 | + if ( ! isset( $this->oProp->aInPageTabs[ $_sPageSlug ] ) ) { |
|
| 47 | 47 | continue; |
| 48 | 48 | } |
| 49 | 49 | |
@@ -80,8 +80,8 @@ discard block |
||
| 80 | 80 | * @since 3.6.0 |
| 81 | 81 | */ |
| 82 | 82 | private function _getDefaultInPageTab( $sPageSlug, $aInPageTabs ) { |
| 83 | - foreach( $aInPageTabs as $_aInPageTab ) { |
|
| 84 | - if ( ! isset( $_aInPageTab[ 'tab_slug' ] ) ) { |
|
| 83 | + foreach( $aInPageTabs as $_aInPageTab ) { |
|
| 84 | + if ( ! isset( $_aInPageTab[ 'tab_slug' ] ) ) { |
|
| 85 | 85 | continue; |
| 86 | 86 | } |
| 87 | 87 | // Regardless of whether it's a hidden tab, it is stored as the default in-page tab. |
@@ -28,19 +28,19 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | public function _replyToGetSectionName( /* $sAttribute, $aSectionset */ ) { |
| 30 | 30 | |
| 31 | - $_aParams = func_get_args() + array( null, null, ); |
|
| 31 | + $_aParams = func_get_args() + array( null, null,); |
|
| 32 | 32 | $sNameAttribute = $_aParams[ 0 ]; |
| 33 | 33 | $aSectionset = $_aParams[ 1 ]; |
| 34 | 34 | |
| 35 | 35 | $_aSectionPath = $aSectionset[ '_section_path_array' ]; |
| 36 | 36 | |
| 37 | 37 | $_aDimensionalKeys = array( $this->oProp->sOptionKey ); |
| 38 | - foreach( $_aSectionPath as $_sDimension ) { |
|
| 39 | - $_aDimensionalKeys[] = '[' . $_sDimension . ']'; |
|
| 38 | + foreach ( $_aSectionPath as $_sDimension ) { |
|
| 39 | + $_aDimensionalKeys[ ] = '['.$_sDimension.']'; |
|
| 40 | 40 | } |
| 41 | 41 | // $_aDimensionalKeys[] = '[' . $aSectionset[ 'section_id' ] . ']'; |
| 42 | 42 | if ( isset( $aSectionset[ '_index' ] ) ) { |
| 43 | - $_aDimensionalKeys[] = '[' . $aSectionset[ '_index' ] . ']'; |
|
| 43 | + $_aDimensionalKeys[ ] = '['.$aSectionset[ '_index' ].']'; |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | return implode( '', $_aDimensionalKeys ); |
@@ -53,23 +53,23 @@ discard block |
||
| 53 | 53 | */ |
| 54 | 54 | public function _replyToGetFieldNameAttribute( /* $sAttribute, $aFieldset */ ) { |
| 55 | 55 | |
| 56 | - $_aParams = func_get_args() + array( null, null, ); |
|
| 56 | + $_aParams = func_get_args() + array( null, null,); |
|
| 57 | 57 | $sNameAttribute = $_aParams[ 0 ]; |
| 58 | 58 | $aFieldset = $_aParams[ 1 ]; |
| 59 | 59 | |
| 60 | 60 | $_aDimensionalKeys = array( $aFieldset[ 'option_key' ] ); |
| 61 | 61 | if ( $this->isSectionSet( $aFieldset ) ) { |
| 62 | - $_aSectionPath = $aFieldset[ '_section_path_array' ]; |
|
| 63 | - foreach( $_aSectionPath as $_sDimension ) { |
|
| 64 | - $_aDimensionalKeys[] = '[' . $_sDimension . ']'; |
|
| 62 | + $_aSectionPath = $aFieldset[ '_section_path_array' ]; |
|
| 63 | + foreach ( $_aSectionPath as $_sDimension ) { |
|
| 64 | + $_aDimensionalKeys[ ] = '['.$_sDimension.']'; |
|
| 65 | 65 | } |
| 66 | 66 | // $_aDimensionalKeys[] = '[' . $aFieldset[ 'section_id' ] . ']'; |
| 67 | 67 | if ( isset( $aFieldset[ '_section_index' ] ) ) { |
| 68 | - $_aDimensionalKeys[] = '[' . $aFieldset[ '_section_index' ] . ']'; |
|
| 68 | + $_aDimensionalKeys[ ] = '['.$aFieldset[ '_section_index' ].']'; |
|
| 69 | 69 | } |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - $_aDimensionalKeys[] = '[' . $aFieldset[ 'field_id' ] . ']'; |
|
| 72 | + $_aDimensionalKeys[ ] = '['.$aFieldset[ 'field_id' ].']'; |
|
| 73 | 73 | |
| 74 | 74 | return implode( '', $_aDimensionalKeys ); |
| 75 | 75 | |
@@ -81,20 +81,20 @@ discard block |
||
| 81 | 81 | */ |
| 82 | 82 | public function _replyToGetFlatFieldName( /* $sAttribute, $aFieldset */ ) { |
| 83 | 83 | |
| 84 | - $_aParams = func_get_args() + array( null, null, ); |
|
| 84 | + $_aParams = func_get_args() + array( null, null,); |
|
| 85 | 85 | $sNameAttribute = $_aParams[ 0 ]; |
| 86 | 86 | $aFieldset = $_aParams[ 1 ]; |
| 87 | 87 | |
| 88 | 88 | $_aDimensionalKeys = array( $aFieldset[ 'option_key' ] ); |
| 89 | 89 | if ( $this->isSectionSet( $aFieldset ) ) { |
| 90 | - foreach( $aFieldset[ '_section_path_array' ] as $_sDimension ) { |
|
| 91 | - $_aDimensionalKeys[] = $_sDimension; // $aFieldset[ 'section_id' ]; |
|
| 90 | + foreach ( $aFieldset[ '_section_path_array' ] as $_sDimension ) { |
|
| 91 | + $_aDimensionalKeys[ ] = $_sDimension; // $aFieldset[ 'section_id' ]; |
|
| 92 | 92 | } |
| 93 | 93 | if ( isset( $aFieldset[ '_section_index' ] ) ) { |
| 94 | - $_aDimensionalKeys[] = $aFieldset[ '_section_index' ]; |
|
| 94 | + $_aDimensionalKeys[ ] = $aFieldset[ '_section_index' ]; |
|
| 95 | 95 | } |
| 96 | 96 | } |
| 97 | - $_aDimensionalKeys[] = $aFieldset[ 'field_id' ]; |
|
| 97 | + $_aDimensionalKeys[ ] = $aFieldset[ 'field_id' ]; |
|
| 98 | 98 | return implode( '|', $_aDimensionalKeys ); |
| 99 | 99 | |
| 100 | 100 | } |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | "[{$sKey}]" |
| 118 | 118 | ); |
| 119 | 119 | |
| 120 | - return $this->_replyToGetFieldNameAttribute( '', $aField ) . $sKey; |
|
| 120 | + return $this->_replyToGetFieldNameAttribute( '', $aField ).$sKey; |
|
| 121 | 121 | |
| 122 | 122 | } |
| 123 | 123 | /** |
@@ -135,10 +135,10 @@ discard block |
||
| 135 | 135 | $_sKey = $this->oUtil->getAOrB( |
| 136 | 136 | '0' !== $_sKey && empty( $_sKey ), |
| 137 | 137 | '', |
| 138 | - "|" . $_sKey |
|
| 138 | + "|".$_sKey |
|
| 139 | 139 | ); |
| 140 | 140 | |
| 141 | - return $this->_replyToGetFlatFieldName( '', $aField ) . $_sKey; |
|
| 141 | + return $this->_replyToGetFlatFieldName( '', $aField ).$_sKey; |
|
| 142 | 142 | |
| 143 | 143 | } |
| 144 | 144 | |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | public function __construct( array $aPostElement ) { |
| 36 | 36 | |
| 37 | 37 | $this->aPost = $aPostElement; |
| 38 | - $this->sInputID = $this->getInputID( $aPostElement['submit'] ); // the submit element must be set by the field type. |
|
| 38 | + $this->sInputID = $this->getInputID( $aPostElement[ 'submit' ] ); // the submit element must be set by the field type. |
|
| 39 | 39 | |
| 40 | 40 | } |
| 41 | 41 | |
@@ -47,10 +47,10 @@ discard block |
||
| 47 | 47 | * @since 2.0.0 |
| 48 | 48 | * @since 3.4.0 Changed the name from `getElement()`. |
| 49 | 49 | */ |
| 50 | - protected function getSubmitValueByType( $aElement, $sInputID, $sElementKey='format' ) { |
|
| 50 | + protected function getSubmitValueByType( $aElement, $sInputID, $sElementKey = 'format' ) { |
|
| 51 | 51 | |
| 52 | 52 | return $this->getElement( |
| 53 | - $aElement, // subject array |
|
| 53 | + $aElement, // subject array |
|
| 54 | 54 | array( $sInputID, $sElementKey ), // dimensional keys |
| 55 | 55 | null // default |
| 56 | 56 | ); |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | // Only the pressed element will be stored in the array. |
| 81 | 81 | // The input tag: name="__import[submit][my_section_my_import_field_the_index]" value="Import Button" |
| 82 | 82 | // The array structure: array( 'my_section_my_import_field_the_index' => 'Import Button' ) |
| 83 | - foreach( $aSubmitElement as $sInputID => $v ) { // $aSubmitElement should have been set in the constructor. |
|
| 83 | + foreach ( $aSubmitElement as $sInputID => $v ) { // $aSubmitElement should have been set in the constructor. |
|
| 84 | 84 | $this->sInputID = $sInputID; |
| 85 | 85 | return $this->sInputID; |
| 86 | 86 | } |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | * |
| 63 | 63 | * @since 2.1.5 |
| 64 | 64 | */ |
| 65 | - public function getSiblingValue( $sKey ) { |
|
| 65 | + public function getSiblingValue( $sKey ) { |
|
| 66 | 66 | return $this->getSubmitValueByType( $this->aPost, $this->sInputID, $sKey ); |
| 67 | 67 | } |
| 68 | 68 | |
@@ -80,7 +80,8 @@ discard block |
||
| 80 | 80 | // Only the pressed element will be stored in the array. |
| 81 | 81 | // The input tag: name="__import[submit][my_section_my_import_field_the_index]" value="Import Button" |
| 82 | 82 | // The array structure: array( 'my_section_my_import_field_the_index' => 'Import Button' ) |
| 83 | - foreach( $aSubmitElement as $sInputID => $v ) { // $aSubmitElement should have been set in the constructor. |
|
| 83 | + foreach( $aSubmitElement as $sInputID => $v ) { |
|
| 84 | +// $aSubmitElement should have been set in the constructor. |
|
| 84 | 85 | $this->sInputID = $sInputID; |
| 85 | 86 | return $this->sInputID; |
| 86 | 87 | } |
@@ -1,11 +1,11 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Admin Page Framework |
|
| 4 | - * |
|
| 5 | - * http://en.michaeluno.jp/admin-page-framework/ |
|
| 6 | - * Copyright (c) 2013-2016 Michael Uno; Licensed MIT |
|
| 7 | - * |
|
| 8 | - */ |
|
| 3 | + * Admin Page Framework |
|
| 4 | + * |
|
| 5 | + * http://en.michaeluno.jp/admin-page-framework/ |
|
| 6 | + * Copyright (c) 2013-2016 Michael Uno; Licensed MIT |
|
| 7 | + * |
|
| 8 | + */ |
|
| 9 | 9 | |
| 10 | 10 | /** |
| 11 | 11 | * Provides an abstract base class to create meta boxes in generic admin pages created by the framework. |
@@ -94,9 +94,9 @@ discard block |
||
| 94 | 94 | * @since 2.0.0 |
| 95 | 95 | * @since 3.5.4 Added the `$aHeader` parameter. Deprecated the `$sFileName` parameter as it is included in the $aHeader definition. |
| 96 | 96 | */ |
| 97 | - public function doExport( $vData, $sFormatType=null, array $aHeader=array() ) { |
|
| 97 | + public function doExport( $vData, $sFormatType = null, array $aHeader = array() ) { |
|
| 98 | 98 | |
| 99 | - $sFormatType = isset( $sFormatType ) |
|
| 99 | + $sFormatType = isset( $sFormatType ) |
|
| 100 | 100 | ? $sFormatType |
| 101 | 101 | : $this->sFormatType; |
| 102 | 102 | |
@@ -122,9 +122,9 @@ discard block |
||
| 122 | 122 | * @since 3.5.4 |
| 123 | 123 | * @return void |
| 124 | 124 | */ |
| 125 | - private function _outputHTTPHeader( array $aHeader, $sKey='' ) { |
|
| 125 | + private function _outputHTTPHeader( array $aHeader, $sKey = '' ) { |
|
| 126 | 126 | |
| 127 | - foreach( $aHeader as $_sKey => $_asValue ) { |
|
| 127 | + foreach ( $aHeader as $_sKey => $_asValue ) { |
|
| 128 | 128 | |
| 129 | 129 | // Nested items. Set the key to overrider array keys. |
| 130 | 130 | if ( is_array( $_asValue ) ) { |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | return; |
| 165 | 165 | case 'json': // for json. |
| 166 | 166 | echo json_encode( ( array ) $vData ); |
| 167 | - return ; |
|
| 167 | + return; |
|
| 168 | 168 | case 'array': // for serialized PHP array. |
| 169 | 169 | default: // for anything else, |
| 170 | 170 | echo serialize( ( array ) $vData ); |