@@ -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 ) { |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | * @since 3.6.1 |
| 70 | 70 | * @return string The generate HTML output. |
| 71 | 71 | */ |
| 72 | - public function _replyToProcessShortcode_embed( $aAttributes, $sURL, $sShortcode='' ) { |
|
| 72 | + public function _replyToProcessShortcode_embed( $aAttributes, $sURL, $sShortcode = '' ) { |
|
| 73 | 73 | |
| 74 | 74 | $sURL = isset( $aAttributes[ 'src' ] ) ? $aAttributes[ 'src' ] : $sURL; |
| 75 | 75 | $_sHTML = wp_oembed_get( $sURL ); |
@@ -112,27 +112,27 @@ discard block |
||
| 112 | 112 | * array( 'Second Heading' => 'Another text', ), |
| 113 | 113 | * ) |
| 114 | 114 | */ |
| 115 | - public function getContentsByHeader( $sContents, $iHeaderNumber=2 ) { |
|
| 115 | + public function getContentsByHeader( $sContents, $iHeaderNumber = 2 ) { |
|
| 116 | 116 | |
| 117 | 117 | $_aContents = array(); |
| 118 | 118 | $_aSplitContents = preg_split( |
| 119 | 119 | // '/^[\s]*==[\s]*(.+?)[\s]*==/m', |
| 120 | - '/(<h[' . $iHeaderNumber . ']*[^>]*>.*?<\/h[' . $iHeaderNumber . ']>)/i', |
|
| 120 | + '/(<h['.$iHeaderNumber.']*[^>]*>.*?<\/h['.$iHeaderNumber.']>)/i', |
|
| 121 | 121 | $sContents, |
| 122 | 122 | -1, |
| 123 | - PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY |
|
| 123 | + PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY |
|
| 124 | 124 | ); |
| 125 | 125 | |
| 126 | - foreach( $_aSplitContents as $_iIndex => $_sSplitContent ) { |
|
| 127 | - if ( ! preg_match( '/<h[' . $iHeaderNumber . ']*[^>]*>(.*?)<\/h[' . $iHeaderNumber . ']>/i', $_sSplitContent , $_aMatches ) ) { |
|
| 126 | + foreach ( $_aSplitContents as $_iIndex => $_sSplitContent ) { |
|
| 127 | + if ( !preg_match( '/<h['.$iHeaderNumber.']*[^>]*>(.*?)<\/h['.$iHeaderNumber.']>/i', $_sSplitContent, $_aMatches ) ) { |
|
| 128 | 128 | continue; |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | - if ( ! isset( $_aMatches[ 1 ] ) ) { |
|
| 131 | + if ( !isset( $_aMatches[ 1 ] ) ) { |
|
| 132 | 132 | continue; |
| 133 | 133 | } |
| 134 | - if ( isset( $_aSplitContents[ $_iIndex + 1 ] ) ) { |
|
| 135 | - $_aContents[] = array( |
|
| 134 | + if ( isset( $_aSplitContents[ $_iIndex + 1 ] ) ) { |
|
| 135 | + $_aContents[ ] = array( |
|
| 136 | 136 | $_aMatches[ 1 ], |
| 137 | 137 | $_aSplitContents[ $_iIndex + 1 ], |
| 138 | 138 | ); |
@@ -131,7 +131,7 @@ |
||
| 131 | 131 | if ( ! isset( $_aMatches[ 1 ] ) ) { |
| 132 | 132 | continue; |
| 133 | 133 | } |
| 134 | - if ( isset( $_aSplitContents[ $_iIndex + 1 ] ) ) { |
|
| 134 | + if ( isset( $_aSplitContents[ $_iIndex + 1 ] ) ) { |
|
| 135 | 135 | $_aContents[] = array( |
| 136 | 136 | $_aMatches[ 1 ], |
| 137 | 137 | $_aSplitContents[ $_iIndex + 1 ], |
@@ -257,6 +257,7 @@ discard block |
||
| 257 | 257 | * Generates the framework zip data. |
| 258 | 258 | * |
| 259 | 259 | * @since 3.5.4 |
| 260 | + * @param string $sFrameworkDirPath |
|
| 260 | 261 | * @return string The binary zip data. |
| 261 | 262 | */ |
| 262 | 263 | private function _getDownloadFrameworkZipFile( $sFrameworkDirPath, $sDestinationPath ) { |
@@ -308,11 +309,7 @@ discard block |
||
| 308 | 309 | * |
| 309 | 310 | * @since 3.5.4 |
| 310 | 311 | * @remark string $sPath The path to check. It can be a directory or a file. |
| 311 | - * @param string $sPathInArchive The parsing directory path set to the archive. |
|
| 312 | - * The passed path for the archive has a trailing slash. It starts with a directory name. |
|
| 313 | - * e.g. |
|
| 314 | - * `utility/AdminPageFramework_WPReadmeParser/` |
|
| 315 | - * `factory/widget/model/` |
|
| 312 | + * @param string $sPath |
|
| 316 | 313 | * @return boolean |
| 317 | 314 | */ |
| 318 | 315 | private function _isAllowedArchivePath( $sPath ) { |
@@ -567,6 +564,7 @@ discard block |
||
| 567 | 564 | * Modifies the text domain in the given file contents. |
| 568 | 565 | * |
| 569 | 566 | * @since 3.5.4 |
| 567 | + * @param string $sFileContents |
|
| 570 | 568 | * @return string |
| 571 | 569 | */ |
| 572 | 570 | private function _modifyTextDomain( $sFileContents ) { |
@@ -585,6 +583,7 @@ discard block |
||
| 585 | 583 | * Retrieves the value from the $_POST array by the given field ID. |
| 586 | 584 | * |
| 587 | 585 | * @since 3.5.4 |
| 586 | + * @param string $sFieldID |
|
| 588 | 587 | * @return string |
| 589 | 588 | */ |
| 590 | 589 | private function _getFormSubmitValueByFieldIDAsString( $sFieldID ) { |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | $this->oFactory = $oFactory; |
| 31 | 31 | |
| 32 | 32 | add_action( |
| 33 | - 'export_name_' . $this->sPageSlug . '_' . $this->sTabSlug, |
|
| 33 | + 'export_name_'.$this->sPageSlug.'_'.$this->sTabSlug, |
|
| 34 | 34 | array( $this, 'replyToFilterFileName' ), |
| 35 | 35 | 10, |
| 36 | 36 | 5 |
@@ -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 | |
@@ -241,8 +241,8 @@ discard block |
||
| 241 | 241 | */ |
| 242 | 242 | public function replyToDownloadFramework( $aSavedData, $sSubmittedFieldID, $sSubmittedInputID, $oAdminPage ) { |
| 243 | 243 | |
| 244 | - $_sFrameworkDirPath = AdminPageFrameworkLoader_Registry::$sDirPath . '/library/apf'; |
|
| 245 | - if ( ! file_exists( $_sFrameworkDirPath ) ) { |
|
| 244 | + $_sFrameworkDirPath = AdminPageFrameworkLoader_Registry::$sDirPath.'/library/apf'; |
|
| 245 | + if ( !file_exists( $_sFrameworkDirPath ) ) { |
|
| 246 | 246 | return $aSavedData; |
| 247 | 247 | } |
| 248 | 248 | |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | $_sFrameworkDirPath, |
| 252 | 252 | $_sTempFile |
| 253 | 253 | ); |
| 254 | - header( "Content-Length: " . strlen( $_sData ) ); |
|
| 254 | + header( "Content-Length: ".strlen( $_sData ) ); |
|
| 255 | 255 | unlink( $_sTempFile ); |
| 256 | 256 | |
| 257 | 257 | return $_sData; |
@@ -269,9 +269,9 @@ discard block |
||
| 269 | 269 | $sFrameworkDirPath, |
| 270 | 270 | $sDestinationPath, |
| 271 | 271 | array( |
| 272 | - 'include_directory' => false, // wrap contents in a sub-directory |
|
| 272 | + 'include_directory' => false, // wrap contents in a sub-directory |
|
| 273 | 273 | 'additional_source_directories' => apply_filters( |
| 274 | - AdminPageFrameworkLoader_Registry::HOOK_SLUG . '_filter_generator_additional_source_directories', |
|
| 274 | + AdminPageFrameworkLoader_Registry::HOOK_SLUG.'_filter_generator_additional_source_directories', |
|
| 275 | 275 | array() // directory paths |
| 276 | 276 | ), |
| 277 | 277 | ), |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | ) |
| 283 | 283 | ); |
| 284 | 284 | $_bSucceed = $_oZip->compress(); |
| 285 | - if ( ! $_bSucceed ) { |
|
| 285 | + if ( !$_bSucceed ) { |
|
| 286 | 286 | return ''; |
| 287 | 287 | } |
| 288 | 288 | |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | |
| 304 | 304 | // Check if it belongs to selected components. |
| 305 | 305 | if ( false === $this->_isAllowedArchivePath( $sPathInArchive ) ) { |
| 306 | - return ''; // empty value will drop the entry |
|
| 306 | + return ''; // empty value will drop the entry |
|
| 307 | 307 | } |
| 308 | 308 | |
| 309 | 309 | return $sPathInArchive; |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | */ |
| 324 | 324 | private function _isAllowedArchivePath( $sPath ) { |
| 325 | 325 | |
| 326 | - foreach( $this->_getDisallowedArchiveDirectoryPaths() as $_sDisallowedPath ) { |
|
| 326 | + foreach ( $this->_getDisallowedArchiveDirectoryPaths() as $_sDisallowedPath ) { |
|
| 327 | 327 | $_bHasPrefix = $this->oFactory->oUtil->hasPrefix( |
| 328 | 328 | ltrim( $_sDisallowedPath, '/' ), // needle |
| 329 | 329 | ltrim( $sPath, '/' ) // haystack |
@@ -393,7 +393,7 @@ discard block |
||
| 393 | 393 | // List paths. |
| 394 | 394 | $_aAllComponentsPaths = array(); |
| 395 | 395 | $_aSelectedComponentsPaths = array(); |
| 396 | - foreach( $this->_aComponentPaths as $_sKey => $_aPaths ) { |
|
| 396 | + foreach ( $this->_aComponentPaths as $_sKey => $_aPaths ) { |
|
| 397 | 397 | |
| 398 | 398 | // Extract all component paths. |
| 399 | 399 | $_aAllComponentsPaths = array_merge( |
@@ -449,16 +449,16 @@ discard block |
||
| 449 | 449 | |
| 450 | 450 | // Check the file extension. |
| 451 | 451 | $_aAllowedExtensions = apply_filters( |
| 452 | - AdminPageFrameworkLoader_Registry::HOOK_SLUG . '_filter_generator_allowed_file_extensions', |
|
| 452 | + AdminPageFrameworkLoader_Registry::HOOK_SLUG.'_filter_generator_allowed_file_extensions', |
|
| 453 | 453 | array( 'php', 'css', 'js' ) |
| 454 | 454 | ); |
| 455 | - if ( ! in_array( pathinfo( $sPathInArchive, PATHINFO_EXTENSION ), $_aAllowedExtensions ) ) { |
|
| 455 | + if ( !in_array( pathinfo( $sPathInArchive, PATHINFO_EXTENSION ), $_aAllowedExtensions ) ) { |
|
| 456 | 456 | return $sFileContents; |
| 457 | 457 | } |
| 458 | 458 | |
| 459 | 459 | // Modify the file contents. |
| 460 | 460 | $sFileContents = apply_filters( |
| 461 | - AdminPageFrameworkLoader_Registry::HOOK_SLUG . '_filter_generator_file_contents', |
|
| 461 | + AdminPageFrameworkLoader_Registry::HOOK_SLUG.'_filter_generator_file_contents', |
|
| 462 | 462 | $sFileContents, |
| 463 | 463 | $sPathInArchive, |
| 464 | 464 | $this->oFactory->oUtil->getElement( |
@@ -520,13 +520,13 @@ discard block |
||
| 520 | 520 | $this->_getCheckedComponents() |
| 521 | 521 | ); |
| 522 | 522 | $_aInsert = array( |
| 523 | - 'Included Components: ' . implode( ', ', $_aCheckedComponents ), |
|
| 524 | - 'Generated on ' . date( 'Y-m-d' ), // today's date |
|
| 523 | + 'Included Components: '.implode( ', ', $_aCheckedComponents ), |
|
| 524 | + 'Generated on '.date( 'Y-m-d' ), // today's date |
|
| 525 | 525 | ); |
| 526 | 526 | |
| 527 | 527 | return preg_replace( |
| 528 | 528 | '#\*/#', // needle - matches '*/' |
| 529 | - implode( PHP_EOL . ' ', $_aInsert ) . ' \0', // replacement \0 is a back-reference to '*/' |
|
| 529 | + implode( PHP_EOL.' ', $_aInsert ).' \0', // replacement \0 is a back-reference to '*/' |
|
| 530 | 530 | $sFileContents, // subject |
| 531 | 531 | 1 // replace only the first occurrence |
| 532 | 532 | ); |
@@ -540,14 +540,14 @@ discard block |
||
| 540 | 540 | private function _modifyClassNameOfInclusionList( $sFileContents ) { |
| 541 | 541 | // Replace the array key names. |
| 542 | 542 | $sFileContents = preg_replace_callback( |
| 543 | - '/(["\'])(.+)\1(?=\s?+=>)/', // pattern ' |
|
| 544 | - array( $this, '_replyToModifyPathName' ), // callable |
|
| 543 | + '/(["\'])(.+)\1(?=\s?+=>)/', // pattern ' |
|
| 544 | + array( $this, '_replyToModifyPathName' ), // callable |
|
| 545 | 545 | $sFileContents // subject |
| 546 | 546 | ); |
| 547 | 547 | // Replace the registry class names. |
| 548 | 548 | return preg_replace_callback( |
| 549 | - '/(=>\s?+)(.+)(?=::)/', // pattern ' |
|
| 550 | - array( $this, '_replyToModifyPathName' ), // callable |
|
| 549 | + '/(=>\s?+)(.+)(?=::)/', // pattern ' |
|
| 550 | + array( $this, '_replyToModifyPathName' ), // callable |
|
| 551 | 551 | $sFileContents // subject |
| 552 | 552 | ); |
| 553 | 553 | } |
@@ -573,7 +573,7 @@ discard block |
||
| 573 | 573 | return strlen( $_sPrefix ) |
| 574 | 574 | ? str_replace( |
| 575 | 575 | 'AdminPageFramework', // search |
| 576 | - $_sPrefix . 'AdminPageFramework', // replace |
|
| 576 | + $_sPrefix.'AdminPageFramework', // replace |
|
| 577 | 577 | $sSubject // subject |
| 578 | 578 | ) |
| 579 | 579 | : $sSubject; |
@@ -606,7 +606,7 @@ discard block |
||
| 606 | 606 | */ |
| 607 | 607 | private function _getFormSubmitValueByFieldIDAsString( $sFieldID ) { |
| 608 | 608 | |
| 609 | - static $_aCaches=array(); |
|
| 609 | + static $_aCaches = array(); |
|
| 610 | 610 | $_aCaches[ $sFieldID ] = isset( $_aCaches[ $sFieldID ] ) |
| 611 | 611 | ? $_aCaches[ $sFieldID ] |
| 612 | 612 | : $this->oFactory->oUtil->getElement( |
@@ -642,9 +642,9 @@ discard block |
||
| 642 | 642 | 'public', |
| 643 | 643 | ), |
| 644 | 644 | 'Content-Description' => 'File Transfer', |
| 645 | - 'Content-type' => 'application/octet-stream', // 'application/zip' may work as well |
|
| 645 | + 'Content-type' => 'application/octet-stream', // 'application/zip' may work as well |
|
| 646 | 646 | 'Content-Transfer-Encoding' => 'binary', |
| 647 | - 'Content-Disposition' => 'attachment; filename="' . $sFileName .'";', |
|
| 647 | + 'Content-Disposition' => 'attachment; filename="'.$sFileName.'";', |
|
| 648 | 648 | // 'Content-Length' => strlen( $mData ), |
| 649 | 649 | ) + $aHeader; |
| 650 | 650 | |
@@ -682,10 +682,10 @@ discard block |
||
| 682 | 682 | |
| 683 | 683 | return $this->oFactory->oUtil->getAOrB( |
| 684 | 684 | $_sFileNameWOExtension, |
| 685 | - $_sFileNameWOExtension . '-admin-page-framework', |
|
| 685 | + $_sFileNameWOExtension.'-admin-page-framework', |
|
| 686 | 686 | 'admin-page-framework' |
| 687 | 687 | ) |
| 688 | - . '.' . AdminPageFramework_Registry::VERSION |
|
| 688 | + . '.'.AdminPageFramework_Registry::VERSION |
|
| 689 | 689 | . '.zip'; |
| 690 | 690 | |
| 691 | 691 | } |
@@ -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 | } |
@@ -148,8 +148,8 @@ discard block |
||
| 148 | 148 | : ''; |
| 149 | 149 | |
| 150 | 150 | return str_replace( |
| 151 | - 'AdminPageFramework', // search |
|
| 152 | - $_sPrefix . 'AdminPageFramework', // replace |
|
| 151 | + 'AdminPageFramework', // search |
|
| 152 | + $_sPrefix.'AdminPageFramework', // replace |
|
| 153 | 153 | $sCode // subject |
| 154 | 154 | ); |
| 155 | 155 | |
@@ -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 | } |
@@ -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. |
@@ -81,7 +81,8 @@ |
||
| 81 | 81 | // Only the pressed element will be stored in the array. |
| 82 | 82 | // The input tag: name="__import[submit][my_section_my_import_field_the_index]" value="Import Button" |
| 83 | 83 | // The array structure: array( 'my_section_my_import_field_the_index' => 'Import Button' ) |
| 84 | - foreach( $aSubmitElement as $sInputID => $v ) { // $aSubmitElement should have been set in the constructor. |
|
| 84 | + foreach( $aSubmitElement as $sInputID => $v ) { |
|
| 85 | +// $aSubmitElement should have been set in the constructor. |
|
| 85 | 86 | $this->sInputID = $sInputID; |
| 86 | 87 | |
| 87 | 88 | return $this->sInputID; |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | : 'add_filter'; |
| 37 | 37 | |
| 38 | 38 | $_sFunctionName( |
| 39 | - $this->sActionHookPrefix . $this->oFactory->oProp->sClassName, |
|
| 39 | + $this->sActionHookPrefix.$this->oFactory->oProp->sClassName, |
|
| 40 | 40 | array( $this, $this->sCallbackName ), |
| 41 | 41 | $this->iHookPriority, |
| 42 | 42 | $this->iCallbackParameters |
@@ -56,17 +56,17 @@ discard block |
||
| 56 | 56 | * @since 3.6.3 Moved from `AdminPageFramework_Validation`. |
| 57 | 57 | * @return array The intact stored options. |
| 58 | 58 | */ |
| 59 | - protected function _confirmSubmitButtonAction( $sPressedInputName, $sSectionID, $sType='reset' ) { |
|
| 59 | + protected function _confirmSubmitButtonAction( $sPressedInputName, $sSectionID, $sType = 'reset' ) { |
|
| 60 | 60 | |
| 61 | - switch( $sType ) { |
|
| 61 | + switch ( $sType ) { |
|
| 62 | 62 | default: |
| 63 | 63 | case 'reset': |
| 64 | 64 | $_sFieldErrorMessage = $this->oFactory->oMsg->get( 'reset_options' ); |
| 65 | - $_sTransientKey = 'apf_rc_' . md5( $sPressedInputName . get_current_user_id() ); |
|
| 65 | + $_sTransientKey = 'apf_rc_'.md5( $sPressedInputName.get_current_user_id() ); |
|
| 66 | 66 | break; |
| 67 | 67 | case 'email': |
| 68 | 68 | $_sFieldErrorMessage = $this->oFactory->oMsg->get( 'send_email' ); |
| 69 | - $_sTransientKey = 'apf_ec_' . md5( $sPressedInputName . get_current_user_id() ); |
|
| 69 | + $_sTransientKey = 'apf_ec_'.md5( $sPressedInputName.get_current_user_id() ); |
|
| 70 | 70 | break; |
| 71 | 71 | } |
| 72 | 72 | |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | $this->oFactory->setFieldErrors( $_aErrors ); |
| 89 | 89 | |
| 90 | 90 | // Set a flag that the confirmation is displayed |
| 91 | - $this->setTransient( $_sTransientKey, $sPressedInputName, 60*2 ); |
|
| 91 | + $this->setTransient( $_sTransientKey, $sPressedInputName, 60 * 2 ); |
|
| 92 | 92 | |
| 93 | 93 | // Set the admin notice |
| 94 | 94 | $this->oFactory->setSettingNotice( $this->oFactory->oMsg->get( 'confirm_perform_task' ), 'error confirmation' ); |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | */ |
| 36 | 36 | public function _replyToCallback( $aInputs, $aRawInputs, array $aSubmits, $aSubmitInformation, $oFactory ) { |
| 37 | 37 | $_sLinkURL = $this->_getPressedSubmitButtonData( $aSubmits, 'href' ); |
| 38 | - if ( ! $_sLinkURL ) { |
|
| 38 | + if ( !$_sLinkURL ) { |
|
| 39 | 39 | return; |
| 40 | 40 | } |
| 41 | 41 | $this->goToURL( $_sLinkURL ); |
@@ -31,14 +31,14 @@ |
||
| 31 | 31 | 'page_slug' => null, |
| 32 | 32 | 'tab_slug' => null, |
| 33 | 33 | 'title' => null, |
| 34 | - 'order' => 10, // (integer) |
|
| 35 | - 'show_in_page_tab' => true, // 3.6.0+ (boolean) |
|
| 36 | - 'parent_tab_slug' => null, // this needs to be set if the above show_in_page_tab is false so that the framework can mark the parent tab to be active when the hidden page is accessed. |
|
| 37 | - 'url' => null, // 3.5.0+ This allows the user set custom link. |
|
| 38 | - 'disabled' => null, // 3.5.10+ (boolean) If true, the link will be unlinked. |
|
| 39 | - 'attributes' => null, // 3.5.10+ (array) Applies to the navigation tab bar element. |
|
| 40 | - 'capability' => null, // 3.6.0+ (string) |
|
| 41 | - 'if' => true, // 3.6.0+ (boolean) |
|
| 34 | + 'order' => 10, // (integer) |
|
| 35 | + 'show_in_page_tab' => true, // 3.6.0+ (boolean) |
|
| 36 | + 'parent_tab_slug' => null, // this needs to be set if the above show_in_page_tab is false so that the framework can mark the parent tab to be active when the hidden page is accessed. |
|
| 37 | + 'url' => null, // 3.5.0+ This allows the user set custom link. |
|
| 38 | + 'disabled' => null, // 3.5.10+ (boolean) If true, the link will be unlinked. |
|
| 39 | + 'attributes' => null, // 3.5.10+ (array) Applies to the navigation tab bar element. |
|
| 40 | + 'capability' => null, // 3.6.0+ (string) |
|
| 41 | + 'if' => true, // 3.6.0+ (boolean) |
|
| 42 | 42 | ); |
| 43 | 43 | |
| 44 | 44 | /** |
@@ -51,7 +51,7 @@ |
||
| 51 | 51 | */ |
| 52 | 52 | public function get() { |
| 53 | 53 | |
| 54 | - // Apply filters to modify the in-page tab array. |
|
| 54 | + // Apply filters to modify the in-page tab array. |
|
| 55 | 55 | $_aInPageTabs = $this->addAndApplyFilter( |
| 56 | 56 | $this->oFactory, // caller object |
| 57 | 57 | "tabs_{$this->oFactory->oProp->sClassName}_{$this->sPageSlug}", // filter name |
@@ -53,14 +53,14 @@ |
||
| 53 | 53 | |
| 54 | 54 | // Apply filters to modify the in-page tab array. |
| 55 | 55 | $_aInPageTabs = $this->addAndApplyFilter( |
| 56 | - $this->oFactory, // caller object |
|
| 56 | + $this->oFactory, // caller object |
|
| 57 | 57 | "tabs_{$this->oFactory->oProp->sClassName}_{$this->sPageSlug}", // filter name |
| 58 | 58 | $this->aInPageTabs // filtering value |
| 59 | 59 | ); |
| 60 | 60 | |
| 61 | 61 | // Added items may be missing necessary keys so format them |
| 62 | - foreach( ( array ) $_aInPageTabs as $_sTabSlug => $_aInPageTab ) { |
|
| 63 | - if ( ! is_array( $_aInPageTab ) ) { |
|
| 62 | + foreach ( ( array ) $_aInPageTabs as $_sTabSlug => $_aInPageTab ) { |
|
| 63 | + if ( !is_array( $_aInPageTab ) ) { |
|
| 64 | 64 | continue; |
| 65 | 65 | } |
| 66 | 66 | $_oFormatter = new AdminPageFramework_Format_InPageTab( |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | ) |
| 65 | 65 | ); |
| 66 | 66 | |
| 67 | - if ( ! $this->_isEnabled( $_aTab ) ) { |
|
| 67 | + if ( !$this->_isEnabled( $_aTab ) ) { |
|
| 68 | 68 | return array(); |
| 69 | 69 | } |
| 70 | 70 | |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | : esc_url( |
| 79 | 79 | $this->getElement( |
| 80 | 80 | $_aTab, |
| 81 | - 'url', // if the 'url' argument is set, use it. Otherwise, use the below gnerated url. |
|
| 81 | + 'url', // if the 'url' argument is set, use it. Otherwise, use the below gnerated url. |
|
| 82 | 82 | $this->getQueryAdminURL( |
| 83 | 83 | array( |
| 84 | 84 | 'page' => $this->aArguments[ 'page_slug' ], |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | * @return boolean |
| 108 | 108 | */ |
| 109 | 109 | private function _isEnabled( $aTab ) { |
| 110 | - return ! in_array( |
|
| 110 | + return !in_array( |
|
| 111 | 111 | false, |
| 112 | 112 | array( |
| 113 | 113 | ( bool ) current_user_can( $aTab[ 'capability' ] ), // whether the user has the sufficient capability level |