@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | */ |
82 | 82 | public function _replyToRegisterMetaBoxes( $sPageHook='' ) { |
83 | 83 | foreach( $this->oProp->aPageSlugs as $_sKey => $_asPage ) { |
84 | - if ( is_string( $_asPage ) ) { |
|
84 | + if ( is_string( $_asPage ) ) { |
|
85 | 85 | $this->_registerMetaBox( $_asPage ); |
86 | 86 | continue; |
87 | 87 | } |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | */ |
99 | 99 | private function _registerMetaBoxes( $sPageSlug, $asPage ) { |
100 | 100 | foreach( $this->oUtil->getAsArray( $asPage ) as $_sTabSlug ) { |
101 | - if ( ! $this->oProp->isCurrentTab( $_sTabSlug ) ) { |
|
101 | + if ( ! $this->oProp->isCurrentTab( $_sTabSlug ) ) { |
|
102 | 102 | continue; |
103 | 103 | } |
104 | 104 | $this->_registerMetaBox( $sPageSlug ); |
@@ -256,7 +256,7 @@ |
||
256 | 256 | |
257 | 257 | } |
258 | 258 | |
259 | - /** |
|
259 | + /** |
|
260 | 260 | * Extracts meta box form fields options array from the given options array of an admin page. |
261 | 261 | * |
262 | 262 | * @since 3.5.6 |
@@ -45,11 +45,11 @@ discard block |
||
45 | 45 | public function _replyToSetUpValidationHooks( $oScreen ) { |
46 | 46 | |
47 | 47 | // Validation hooks |
48 | - foreach( $this->oProp->aPageSlugs as $_sIndexOrPageSlug => $_asTabArrayOrPageSlug ) { |
|
48 | + foreach ( $this->oProp->aPageSlugs as $_sIndexOrPageSlug => $_asTabArrayOrPageSlug ) { |
|
49 | 49 | |
50 | 50 | if ( is_scalar( $_asTabArrayOrPageSlug ) ) { |
51 | 51 | $_sPageSlug = $_asTabArrayOrPageSlug; |
52 | - add_filter( "validation_saved_options_without_dynamic_elements_{$_sPageSlug}", array( $this, '_replyToFilterPageOptionsWODynamicElements' ), 10, 2 ); // 3.4.1+ |
|
52 | + add_filter( "validation_saved_options_without_dynamic_elements_{$_sPageSlug}", array( $this, '_replyToFilterPageOptionsWODynamicElements' ), 10, 2 ); // 3.4.1+ |
|
53 | 53 | add_filter( "validation_{$_sPageSlug}", array( $this, '_replyToValidateOptions' ), 10, 4 ); |
54 | 54 | add_filter( "options_update_status_{$_sPageSlug}", array( $this, '_replyToModifyOptionsUpdateStatus' ) ); |
55 | 55 | continue; |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | // At this point, the array key is the page slug. It means the user specified the tab(s). |
59 | 59 | $_sPageSlug = $_sIndexOrPageSlug; |
60 | 60 | $_aTabs = $_asTabArrayOrPageSlug; |
61 | - foreach( $_aTabs as $_sTabSlug ) { |
|
61 | + foreach ( $_aTabs as $_sTabSlug ) { |
|
62 | 62 | add_filter( "validation_{$_sPageSlug}_{$_sTabSlug}", array( $this, '_replyToValidateOptions' ), 10, 4 ); |
63 | 63 | add_filter( "validation_saved_options_without_dynamic_elements_{$_sPageSlug}_{$_sTabSlug}", array( $this, '_replyToFilterPageOptionsWODynamicElements' ), 10, 2 ); // 3.4.1+ |
64 | 64 | add_filter( "options_update_status_{$_sPageSlug}_{$_sTabSlug}", array( $this, '_replyToModifyOptionsUpdateStatus' ) ); |
@@ -78,9 +78,9 @@ discard block |
||
78 | 78 | * @return void |
79 | 79 | * @callback action add_meta_boxes |
80 | 80 | */ |
81 | - public function _replyToRegisterMetaBoxes( $sPageHook='' ) { |
|
82 | - foreach( $this->oProp->aPageSlugs as $_sKey => $_asPage ) { |
|
83 | - if ( is_string( $_asPage ) ) { |
|
81 | + public function _replyToRegisterMetaBoxes( $sPageHook = '' ) { |
|
82 | + foreach ( $this->oProp->aPageSlugs as $_sKey => $_asPage ) { |
|
83 | + if ( is_string( $_asPage ) ) { |
|
84 | 84 | $this->_registerMetaBox( $_asPage ); |
85 | 85 | continue; |
86 | 86 | } |
@@ -96,8 +96,8 @@ discard block |
||
96 | 96 | * @return void |
97 | 97 | */ |
98 | 98 | private function _registerMetaBoxes( $sPageSlug, $asPage ) { |
99 | - foreach( $this->oUtil->getAsArray( $asPage ) as $_sTabSlug ) { |
|
100 | - if ( ! $this->oProp->isCurrentTab( $_sTabSlug ) ) { |
|
99 | + foreach ( $this->oUtil->getAsArray( $asPage ) as $_sTabSlug ) { |
|
100 | + if ( !$this->oProp->isCurrentTab( $_sTabSlug ) ) { |
|
101 | 101 | continue; |
102 | 102 | } |
103 | 103 | $this->_registerMetaBox( $sPageSlug ); |
@@ -114,12 +114,12 @@ discard block |
||
114 | 114 | */ |
115 | 115 | private function _registerMetaBox( $sPageSlug ) { |
116 | 116 | add_meta_box( |
117 | - $this->oProp->sMetaBoxID, // id |
|
118 | - $this->oProp->sTitle, // title |
|
117 | + $this->oProp->sMetaBoxID, // id |
|
118 | + $this->oProp->sTitle, // title |
|
119 | 119 | array( $this, '_replyToPrintMetaBoxContents' ), // callback |
120 | 120 | $this->oProp->_getScreenIDOfPage( $sPageSlug ), // screen ID |
121 | - $this->oProp->sContext, // context |
|
122 | - $this->oProp->sPriority, // priority |
|
121 | + $this->oProp->sContext, // context |
|
122 | + $this->oProp->sPriority, // priority |
|
123 | 123 | null // argument (deprecated) |
124 | 124 | ); |
125 | 125 | } |
@@ -167,17 +167,17 @@ discard block |
||
167 | 167 | |
168 | 168 | $_aNewMetaBoxInputs = $this->oForm->getSubmittedData( $_POST ); |
169 | 169 | $_aOldMetaBoxInputs = $this->oUtil->castArrayContents( |
170 | - $this->oForm->getDataStructureFromAddedFieldsets(), // model |
|
170 | + $this->oForm->getDataStructureFromAddedFieldsets(), // model |
|
171 | 171 | $aOldPageOptions // data source |
172 | 172 | ); |
173 | 173 | |
174 | 174 | // Apply filters - third party scripts will have access to the input. |
175 | 175 | $_aNewMetaBoxInputsRaw = $_aNewMetaBoxInputs; // copy one for validation errors. |
176 | 176 | $_aNewMetaBoxInputs = call_user_func_array( |
177 | - array( $this, 'validate' ), // triggers __call() |
|
177 | + array( $this, 'validate' ), // triggers __call() |
|
178 | 178 | array( $_aNewMetaBoxInputs, $_aOldMetaBoxInputs, $this, $aSubmitInfo ) |
179 | 179 | ); // 3.5.3+ |
180 | - $_aNewMetaBoxInputs = $this->oUtil->addAndApplyFilters( |
|
180 | + $_aNewMetaBoxInputs = $this->oUtil->addAndApplyFilters( |
|
181 | 181 | $this, |
182 | 182 | "validation_{$this->oProp->sClassName}", |
183 | 183 | $_aNewMetaBoxInputs, |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | */ |
216 | 216 | public function _replyToModifyOptionsUpdateStatus( $aStatus ) { |
217 | 217 | |
218 | - if ( ! $this->hasFieldError() ) { |
|
218 | + if ( !$this->hasFieldError() ) { |
|
219 | 219 | return $aStatus; |
220 | 220 | } |
221 | 221 | return array( |
@@ -245,12 +245,12 @@ discard block |
||
245 | 245 | |
246 | 246 | $_aPageOptions = $this->oUtil->addAndApplyFilter( |
247 | 247 | $this, // the caller factory object |
248 | - 'options_' . $this->oProp->sClassName, |
|
248 | + 'options_'.$this->oProp->sClassName, |
|
249 | 249 | $_aPageOptions |
250 | 250 | ); |
251 | 251 | |
252 | 252 | return $this->oUtil->castArrayContents( |
253 | - $this->oForm->getDataStructureFromAddedFieldsets(), // model |
|
253 | + $this->oForm->getDataStructureFromAddedFieldsets(), // model |
|
254 | 254 | $_aPageOptions // data source |
255 | 255 | ); |
256 | 256 | |
@@ -267,9 +267,9 @@ discard block |
||
267 | 267 | private function _getPageMetaBoxOptionsFromPageOptions( array $aPageOptions, array $aFieldsets ) { |
268 | 268 | |
269 | 269 | $_aOptions = array(); |
270 | - foreach( $aFieldsets as $_sSectionID => $_aFieldsets ) { |
|
271 | - if ( '_default' === $_sSectionID ) { |
|
272 | - foreach( $_aFieldsets as $_aField ) { |
|
270 | + foreach ( $aFieldsets as $_sSectionID => $_aFieldsets ) { |
|
271 | + if ( '_default' === $_sSectionID ) { |
|
272 | + foreach ( $_aFieldsets as $_aField ) { |
|
273 | 273 | if ( array_key_exists( $_aField[ 'field_id' ], $aPageOptions ) ) { |
274 | 274 | $_aOptions[ $_aField[ 'field_id' ] ] = $aPageOptions[ $_aField[ 'field_id' ] ]; |
275 | 275 | } |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | * @param string The text domain. Default: `admin-page-framework`. |
47 | 47 | * @return void |
48 | 48 | */ |
49 | - function __construct( $asTaxonomySlug, $sOptionKey='', $sCapability='manage_options', $sTextDomain='admin-page-framework' ) { |
|
49 | + function __construct( $asTaxonomySlug, $sOptionKey = '', $sCapability = 'manage_options', $sTextDomain = 'admin-page-framework' ) { |
|
50 | 50 | |
51 | 51 | if ( empty( $asTaxonomySlug ) ) { |
52 | 52 | return; |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | // Properties |
56 | 56 | $_sProprtyClassName = isset( $this->aSubClassNames[ 'oProp' ] ) |
57 | 57 | ? $this->aSubClassNames[ 'oProp' ] |
58 | - : 'AdminPageFramework_Property_' . $this->_sStructureType; |
|
58 | + : 'AdminPageFramework_Property_'.$this->_sStructureType; |
|
59 | 59 | $this->oProp = new $_sProprtyClassName( |
60 | 60 | $this, |
61 | 61 | get_class( $this ), |
@@ -47,7 +47,7 @@ |
||
47 | 47 | */ |
48 | 48 | function __construct( $asTaxonomySlug, $sOptionKey='', $sCapability='manage_options', $sTextDomain='admin-page-framework' ) { |
49 | 49 | |
50 | - if ( empty( $asTaxonomySlug ) ) { |
|
50 | + if ( empty( $asTaxonomySlug ) ) { |
|
51 | 51 | return; |
52 | 52 | } |
53 | 53 |
@@ -39,16 +39,16 @@ |
||
39 | 39 | * @since 3.7.4 Changed the default capability value to `read`. |
40 | 40 | * @todo Examine the appropriate default capability level. |
41 | 41 | */ |
42 | - public function __construct( $sCapability='read', $sTextDomain='admin-page-framework' ) { |
|
42 | + public function __construct( $sCapability = 'read', $sTextDomain = 'admin-page-framework' ) { |
|
43 | 43 | |
44 | 44 | $_sProprtyClassName = isset( $this->aSubClassNames[ 'oProp' ] ) |
45 | 45 | ? $this->aSubClassNames[ 'oProp' ] |
46 | - : 'AdminPageFramework_Property_' . $this->_sStructureType; |
|
46 | + : 'AdminPageFramework_Property_'.$this->_sStructureType; |
|
47 | 47 | $this->oProp = new $_sProprtyClassName( |
48 | - $this, // the caller object |
|
49 | - get_class( $this ), // the caller class name |
|
50 | - $sCapability, // the capability level |
|
51 | - $sTextDomain, // the text domain |
|
48 | + $this, // the caller object |
|
49 | + get_class( $this ), // the caller class name |
|
50 | + $sCapability, // the capability level |
|
51 | + $sTextDomain, // the text domain |
|
52 | 52 | $this->_sStructureType // the structure type |
53 | 53 | ); |
54 | 54 |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | /** |
22 | 22 | * Defines the field type slugs used for this field type. |
23 | 23 | */ |
24 | - public $aFieldTypeSlugs = array( 'media', ); |
|
24 | + public $aFieldTypeSlugs = array( 'media',); |
|
25 | 25 | |
26 | 26 | /** |
27 | 27 | * Defines the default key-values of this field type. |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | return |
54 | 54 | $this->_getScript_MediaUploader( |
55 | 55 | "admin_page_framework" |
56 | - ) . PHP_EOL |
|
56 | + ).PHP_EOL |
|
57 | 57 | . $this->_getScript_RegisterCallbacks(); |
58 | 58 | } |
59 | 59 | |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | $_sInsertFromURL = esc_js( $this->oMsg->get( 'insert_from_url' ) ); |
149 | 149 | |
150 | 150 | // If the WordPress version is 3.4.x or below |
151 | - if ( ! function_exists( 'wp_enqueue_media' ) ) { |
|
151 | + if ( !function_exists( 'wp_enqueue_media' ) ) { |
|
152 | 152 | return <<<JAVASCRIPTS |
153 | 153 | /** |
154 | 154 | * Bind/rebinds the thickbox script the given selector element. |
@@ -388,10 +388,10 @@ discard block |
||
388 | 388 | // Do not include the escaping character (backslash) in the heredoc variable declaration |
389 | 389 | // because the minifier script will parse it and the <<<JAVASCRIPTS and JAVASCRIPTS; parts are converted to double quotes (") |
390 | 390 | // which causes the PHP syntax error. |
391 | - $_sButtonHTML = '"' . $this->_getUploaderButtonHTML_Media( $sInputID, $aButtonAttributes, $bExternalSource ) . '"'; |
|
392 | - $_sRpeatable = $this->getAOrB( ! empty( $abRepeatable ), 'true', 'false' ); |
|
391 | + $_sButtonHTML = '"'.$this->_getUploaderButtonHTML_Media( $sInputID, $aButtonAttributes, $bExternalSource ).'"'; |
|
392 | + $_sRpeatable = $this->getAOrB( !empty( $abRepeatable ), 'true', 'false' ); |
|
393 | 393 | $_sExternalSource = $this->getAOrB( $bExternalSource, 'true', 'false' ); |
394 | - $_sScript = <<<JAVASCRIPTS |
|
394 | + $_sScript = <<<JAVASCRIPTS |
|
395 | 395 | if ( jQuery( 'a#select_media_{$sInputID}' ).length == 0 ) { |
396 | 396 | jQuery( 'input#{$sInputID}' ).after( $_sButtonHTML ); |
397 | 397 | } |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | . '/* <![CDATA[ */' |
405 | 405 | . $_sScript |
406 | 406 | . '/* ]]> */' |
407 | - . "</script>". PHP_EOL; |
|
407 | + . "</script>".PHP_EOL; |
|
408 | 408 | |
409 | 409 | } |
410 | 410 | /** |
@@ -414,19 +414,19 @@ discard block |
||
414 | 414 | */ |
415 | 415 | private function _getUploaderButtonHTML_Media( $sInputID, array $aButtonAttributes, $bExternalSource ) { |
416 | 416 | |
417 | - $_bIsLabelSet = isset( $aButtonAttributes['data-label'] ) && $aButtonAttributes['data-label']; |
|
417 | + $_bIsLabelSet = isset( $aButtonAttributes[ 'data-label' ] ) && $aButtonAttributes[ 'data-label' ]; |
|
418 | 418 | $_aAttributes = $this->_getFormattedUploadButtonAttributes_Media( |
419 | 419 | $sInputID, |
420 | 420 | $aButtonAttributes, |
421 | 421 | $_bIsLabelSet, |
422 | 422 | $bExternalSource |
423 | 423 | ); |
424 | - return "<a " . $this->getAttributes( $_aAttributes ) . ">" |
|
424 | + return "<a ".$this->getAttributes( $_aAttributes ).">" |
|
425 | 425 | . $this->getAOrB( |
426 | 426 | $_bIsLabelSet, |
427 | - $_aAttributes['data-label'], |
|
427 | + $_aAttributes[ 'data-label' ], |
|
428 | 428 | $this->getAOrB( |
429 | - strrpos( $_aAttributes['class'], 'dashicons' ), |
|
429 | + strrpos( $_aAttributes[ 'class' ], 'dashicons' ), |
|
430 | 430 | '', |
431 | 431 | $this->oMsg->get( 'select_file' ) |
432 | 432 | ) |
@@ -441,26 +441,26 @@ discard block |
||
441 | 441 | */ |
442 | 442 | private function _getFormattedUploadButtonAttributes_Media( $sInputID, array $aButtonAttributes, $_bIsLabelSet, $bExternalSource ) { |
443 | 443 | |
444 | - $_aAttributes = array( |
|
444 | + $_aAttributes = array( |
|
445 | 445 | 'id' => "select_media_{$sInputID}", |
446 | 446 | 'href' => '#', |
447 | - 'data-uploader_type' => ( string ) function_exists( 'wp_enqueue_media' ), // ? 1 : 0, |
|
448 | - 'data-enable_external_source' => ( string ) ( bool ) $bExternalSource, // ? 1 : 0, |
|
447 | + 'data-uploader_type' => ( string ) function_exists( 'wp_enqueue_media' ), // ? 1 : 0, |
|
448 | + 'data-enable_external_source' => ( string ) ( bool ) $bExternalSource, // ? 1 : 0, |
|
449 | 449 | ) |
450 | 450 | + $aButtonAttributes |
451 | 451 | + array( |
452 | 452 | 'title' => $_bIsLabelSet |
453 | - ? $aButtonAttributes['data-label'] |
|
453 | + ? $aButtonAttributes[ 'data-label' ] |
|
454 | 454 | : $this->oMsg->get( 'select_file' ), |
455 | 455 | 'data-label' => null, |
456 | 456 | ); |
457 | - $_aAttributes['class'] = $this->getClassAttribute( |
|
457 | + $_aAttributes[ 'class' ] = $this->getClassAttribute( |
|
458 | 458 | 'select_media button button-small ', |
459 | 459 | $this->getAOrB( |
460 | - trim( $aButtonAttributes['class'] ), |
|
461 | - $aButtonAttributes['class'], |
|
460 | + trim( $aButtonAttributes[ 'class' ] ), |
|
461 | + $aButtonAttributes[ 'class' ], |
|
462 | 462 | $this->getAOrB( |
463 | - ! $_bIsLabelSet && version_compare( $GLOBALS['wp_version'], '3.8', '>=' ), |
|
463 | + !$_bIsLabelSet && version_compare( $GLOBALS[ 'wp_version' ], '3.8', '>=' ), |
|
464 | 464 | 'dashicons dashicons-portfolio', |
465 | 465 | '' |
466 | 466 | ) |
@@ -190,7 +190,7 @@ |
||
190 | 190 | * @return void |
191 | 191 | */ |
192 | 192 | static public function setAdminNotice( $sMessage, $sClassAttribute='error' ) { |
193 | - if ( ! is_admin() ) { |
|
193 | + if ( ! is_admin() ) { |
|
194 | 194 | return; |
195 | 195 | } |
196 | 196 | self::$_aAdminNotices[] = array( |
@@ -16,9 +16,9 @@ discard block |
||
16 | 16 | */ |
17 | 17 | class AdminPageFrameworkLoader_Registry_Base { |
18 | 18 | |
19 | - const VERSION = '3.8.18'; // <--- DON'T FORGET TO CHANGE THIS AS WELL!! |
|
19 | + const VERSION = '3.8.18'; // <--- DON'T FORGET TO CHANGE THIS AS WELL!! |
|
20 | 20 | const NAME = 'Admin Page Framework - Loader'; // the name is not 'Admin Page Framework' because warning messages gets confusing. |
21 | - const SHORTNAME = 'Admin Page Framework'; // used for a menu title etc. |
|
21 | + const SHORTNAME = 'Admin Page Framework'; // used for a menu title etc. |
|
22 | 22 | const DESCRIPTION = 'Loads Admin Page Framework which facilitates WordPress plugin and theme development.'; |
23 | 23 | const URI = 'http://admin-page-framework.michaeluno.jp/'; |
24 | 24 | const AUTHOR = 'miunosoft (Michael Uno)'; |
@@ -55,14 +55,14 @@ discard block |
||
55 | 55 | * @remark This is also accessed from `uninstall.php` so do not remove. |
56 | 56 | * @remark Do not exceed 8 characters as a transient name allows 45 characters or less ( 40 for site transients ) so that md5 (32 characters) can be added. |
57 | 57 | */ |
58 | - const TRANSIENT_PREFIX = 'APFL_'; |
|
58 | + const TRANSIENT_PREFIX = 'APFL_'; |
|
59 | 59 | |
60 | 60 | /** |
61 | 61 | * The hook slug used for the prefix of action and filter hook names. |
62 | 62 | * |
63 | 63 | * @remark The ending underscore is not necessary. |
64 | 64 | */ |
65 | - const HOOK_SLUG = 'admin_page_framework_loader'; |
|
65 | + const HOOK_SLUG = 'admin_page_framework_loader'; |
|
66 | 66 | |
67 | 67 | /** |
68 | 68 | * The text domain slug and its path. |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | */ |
117 | 117 | static public $aAdminPages = array( |
118 | 118 | // key => 'page slug' |
119 | - 'about' => 'apfl_about', // the welcome page |
|
119 | + 'about' => 'apfl_about', // the welcome page |
|
120 | 120 | 'addon' => 'apfl_addons', |
121 | 121 | 'tool' => 'apfl_tools', |
122 | 122 | 'help' => 'apfl_contact', |
@@ -154,12 +154,12 @@ discard block |
||
154 | 154 | * @since 3.5.0 |
155 | 155 | * @return string |
156 | 156 | */ |
157 | - public static function getPluginURL( $sRelativePath='' ) { |
|
157 | + public static function getPluginURL( $sRelativePath = '' ) { |
|
158 | 158 | if ( isset( self::$_sPluginURLCache ) ) { |
159 | - return self::$_sPluginURLCache . $sRelativePath; |
|
159 | + return self::$_sPluginURLCache.$sRelativePath; |
|
160 | 160 | } |
161 | 161 | self::$_sPluginURLCache = trailingslashit( plugins_url( '', self::$sFilePath ) ); |
162 | - return self::$_sPluginURLCache . $sRelativePath; |
|
162 | + return self::$_sPluginURLCache.$sRelativePath; |
|
163 | 163 | } |
164 | 164 | /** |
165 | 165 | * @since 3.7.9 |
@@ -189,13 +189,13 @@ discard block |
||
189 | 189 | * @since 3.5.0 |
190 | 190 | * @return void |
191 | 191 | */ |
192 | - static public function setAdminNotice( $sMessage, $sClassAttribute='error' ) { |
|
193 | - if ( ! is_admin() ) { |
|
192 | + static public function setAdminNotice( $sMessage, $sClassAttribute = 'error' ) { |
|
193 | + if ( !is_admin() ) { |
|
194 | 194 | return; |
195 | 195 | } |
196 | - self::$_aAdminNotices[] = array( |
|
196 | + self::$_aAdminNotices[ ] = array( |
|
197 | 197 | 'message' => $sMessage, |
198 | - 'class_attribute' => trim( $sClassAttribute ) . ' notice is-dismissible', |
|
198 | + 'class_attribute' => trim( $sClassAttribute ).' notice is-dismissible', |
|
199 | 199 | ); |
200 | 200 | add_action( 'admin_notices', array( __CLASS__, '_replyToSetAdminNotice' ) ); |
201 | 201 | } |
@@ -205,12 +205,12 @@ discard block |
||
205 | 205 | * @return void |
206 | 206 | */ |
207 | 207 | static public function _replyToSetAdminNotice() { |
208 | - foreach( self::$_aAdminNotices as $_aAdminNotice ) { |
|
209 | - echo "<div class='" . esc_attr( $_aAdminNotice['class_attribute'] ) . " notice is-dismissible'>" |
|
208 | + foreach ( self::$_aAdminNotices as $_aAdminNotice ) { |
|
209 | + echo "<div class='".esc_attr( $_aAdminNotice[ 'class_attribute' ] )." notice is-dismissible'>" |
|
210 | 210 | ."<p>" |
211 | 211 | . sprintf( |
212 | - '<strong>%1$s</strong>: ' . $_aAdminNotice['message'], |
|
213 | - self::NAME . ' ' . self::VERSION |
|
212 | + '<strong>%1$s</strong>: '.$_aAdminNotice[ 'message' ], |
|
213 | + self::NAME.' '.self::VERSION |
|
214 | 214 | ) |
215 | 215 | . "</p>" |
216 | 216 | . "</div>"; |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | AdminPageFrameworkLoader_Registry::setUp( __FILE__ ); |
223 | 223 | |
224 | 224 | // Initial checks. - Do no load if accessed directly, not exiting because the 'uninstall.php' and inclusion list generator will load this file. |
225 | -if ( ! defined( 'ABSPATH' ) ) { |
|
225 | +if ( !defined( 'ABSPATH' ) ) { |
|
226 | 226 | return; |
227 | 227 | } |
228 | 228 | if ( defined( 'DOING_UNINSTALL' ) && DOING_UNINSTALL ) { |
@@ -234,8 +234,8 @@ discard block |
||
234 | 234 | |
235 | 235 | $_bFrameworkLoaded = class_exists( 'AdminPageFramework_Registry', false ); |
236 | 236 | if ( |
237 | - ! $_bFrameworkLoaded |
|
238 | - || ! defined( 'AdminPageFramework_Registry::VERSION' ) // backward compatibility |
|
237 | + !$_bFrameworkLoaded |
|
238 | + || !defined( 'AdminPageFramework_Registry::VERSION' ) // backward compatibility |
|
239 | 239 | || version_compare( AdminPageFramework_Registry::VERSION, AdminPageFrameworkLoader_Registry::VERSION, '<' ) |
240 | 240 | ) { |
241 | 241 | AdminPageFrameworkLoader_Registry::setAdminNotice( |
@@ -253,18 +253,18 @@ discard block |
||
253 | 253 | add_action( 'admin_init', 'AdminPageFrameworkLoader_Warning' ); |
254 | 254 | |
255 | 255 | // Include the library file - the development version will be available if you cloned the GitHub repository. |
256 | -$_sDevelopmentVersionPath = AdminPageFrameworkLoader_Registry::$sDirPath . '/development/admin-page-framework.php'; |
|
256 | +$_sDevelopmentVersionPath = AdminPageFrameworkLoader_Registry::$sDirPath.'/development/admin-page-framework.php'; |
|
257 | 257 | $_bDebugMode = defined( 'WP_DEBUG' ) && WP_DEBUG; |
258 | 258 | $_bLoadDevelopmentVersion = $_bDebugMode && file_exists( $_sDevelopmentVersionPath ); |
259 | 259 | include( |
260 | 260 | $_bLoadDevelopmentVersion |
261 | 261 | ? $_sDevelopmentVersionPath |
262 | - : AdminPageFrameworkLoader_Registry::$sDirPath . '/library/apf/admin-page-framework.php' |
|
262 | + : AdminPageFrameworkLoader_Registry::$sDirPath.'/library/apf/admin-page-framework.php' |
|
263 | 263 | ); |
264 | 264 | |
265 | 265 | // Include the framework loader plugin components. |
266 | 266 | include( AdminPageFramework_Registry::$aClassFiles[ 'AdminPageFramework_PluginBootstrap' ] ); |
267 | -include( AdminPageFrameworkLoader_Registry::$sDirPath . '/include/class/AdminPageFrameworkLoader_Bootstrap.php' ); |
|
267 | +include( AdminPageFrameworkLoader_Registry::$sDirPath.'/include/class/AdminPageFrameworkLoader_Bootstrap.php' ); |
|
268 | 268 | new AdminPageFrameworkLoader_Bootstrap( |
269 | 269 | AdminPageFrameworkLoader_Registry::$sFilePath, |
270 | 270 | AdminPageFrameworkLoader_Registry::HOOK_SLUG // hook prefix |
@@ -80,7 +80,7 @@ |
||
80 | 80 | */ |
81 | 81 | public function _replyToSetUpHooks( $oFactory ) { |
82 | 82 | |
83 | - foreach( $this->oProp->aTaxonomySlugs as $_sTaxonomySlug ) { |
|
83 | + foreach( $this->oProp->aTaxonomySlugs as $_sTaxonomySlug ) { |
|
84 | 84 | |
85 | 85 | // Validation callbacks need to be set regardless of whether the current page is edit-tags.php or not. |
86 | 86 | add_action( "created_{$_sTaxonomySlug}", array( $this, '_replyToValidateOptions' ), 10, 2 ); |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | |
27 | 27 | parent::__construct( $oProp ); |
28 | 28 | |
29 | - if ( ! $this->oProp->bIsAdmin ) { |
|
29 | + if ( !$this->oProp->bIsAdmin ) { |
|
30 | 30 | return; |
31 | 31 | } |
32 | 32 | |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | ); |
38 | 38 | |
39 | 39 | add_action( |
40 | - 'set_up_' . $this->oProp->sClassName, |
|
40 | + 'set_up_'.$this->oProp->sClassName, |
|
41 | 41 | array( $this, '_replyToSetUpHooks' ) |
42 | 42 | ); |
43 | 43 | |
@@ -58,11 +58,11 @@ discard block |
||
58 | 58 | return true; |
59 | 59 | } |
60 | 60 | |
61 | - if ( ! in_array( $this->oProp->sPageNow, array( 'edit-tags.php', 'term.php' ) ) ) { |
|
61 | + if ( !in_array( $this->oProp->sPageNow, array( 'edit-tags.php', 'term.php' ) ) ) { |
|
62 | 62 | return false; |
63 | 63 | } |
64 | 64 | |
65 | - if ( isset( $_GET[ 'taxonomy' ] ) && ! in_array( $_GET[ 'taxonomy' ], $this->oProp->aTaxonomySlugs ) ) { |
|
65 | + if ( isset( $_GET[ 'taxonomy' ] ) && !in_array( $_GET[ 'taxonomy' ], $this->oProp->aTaxonomySlugs ) ) { |
|
66 | 66 | return false; |
67 | 67 | } |
68 | 68 | |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | */ |
80 | 80 | public function _replyToSetUpHooks( $oFactory ) { |
81 | 81 | |
82 | - foreach( $this->oProp->aTaxonomySlugs as $_sTaxonomySlug ) { |
|
82 | + foreach ( $this->oProp->aTaxonomySlugs as $_sTaxonomySlug ) { |
|
83 | 83 | |
84 | 84 | // Validation callbacks need to be set regardless of whether the current page is edit-tags.php or not. |
85 | 85 | add_action( "created_{$_sTaxonomySlug}", array( $this, '_replyToValidateOptions' ), 10, 2 ); |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | * @param string The text domain of the caller script. |
105 | 105 | * @return void |
106 | 106 | */ |
107 | - public function __construct( $sPostType, $aArguments=array(), $sCallerPath=null, $sTextDomain='admin-page-framework' ) { |
|
107 | + public function __construct( $sPostType, $aArguments = array(), $sCallerPath = null, $sTextDomain = 'admin-page-framework' ) { |
|
108 | 108 | |
109 | 109 | if ( empty( $sPostType ) ) { |
110 | 110 | return; |
@@ -112,16 +112,16 @@ discard block |
||
112 | 112 | |
113 | 113 | $_sProprtyClassName = isset( $this->aSubClassNames[ 'oProp' ] ) |
114 | 114 | ? $this->aSubClassNames[ 'oProp' ] |
115 | - : 'AdminPageFramework_Property_' . $this->_sStructureType; |
|
115 | + : 'AdminPageFramework_Property_'.$this->_sStructureType; |
|
116 | 116 | $this->oProp = new $_sProprtyClassName( |
117 | 117 | $this, |
118 | 118 | $this->_getCallerScriptPath( $sCallerPath ), |
119 | - get_class( $this ), // class name |
|
120 | - 'publish_posts', // capability |
|
121 | - $sTextDomain, // text domain |
|
119 | + get_class( $this ), // class name |
|
120 | + 'publish_posts', // capability |
|
121 | + $sTextDomain, // text domain |
|
122 | 122 | $this->_sStructureType // structure type |
123 | 123 | ); |
124 | - $this->oProp->sPostType = AdminPageFramework_WPUtility::sanitizeSlug( $sPostType ); |
|
124 | + $this->oProp->sPostType = AdminPageFramework_WPUtility::sanitizeSlug( $sPostType ); |
|
125 | 125 | |
126 | 126 | // Post type argument array structure |
127 | 127 | // @see http://codex.wordpress.org/Function_Reference/register_post_type#Arguments |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | return $sCallerPath; |
145 | 145 | } |
146 | 146 | |
147 | - if ( ! is_admin() ) { |
|
147 | + if ( !is_admin() ) { |
|
148 | 148 | return null; |
149 | 149 | } |
150 | 150 | $_sPageNow = AdminPageFramework_Utility::getElement( $GLOBALS, 'pagenow' ); |
@@ -25,84 +25,83 @@ |
||
25 | 25 | protected $_sStructureType = 'post_type'; |
26 | 26 | |
27 | 27 | /** |
28 | - * The constructor of the class object. |
|
29 | - * |
|
30 | - * Registers necessary hooks and sets up internal properties. |
|
31 | - * |
|
32 | - * <h4>Example</h4> |
|
33 | - * <code>new APF_PostType( |
|
34 | - * 'apf_posts', // post type slug |
|
35 | - * array( |
|
36 | - * 'labels' => array( |
|
37 | - * 'name' => 'Demo', |
|
38 | - * 'all_items' => __( 'Sample Posts', 'admin-page-framework-demo' ), |
|
39 | - * 'singular_name' => 'Demo', |
|
40 | - * 'add_new' => __( 'Add New', 'admin-page-framework-demo' ), |
|
41 | - * 'add_new_item' => __( 'Add New APF Post', 'admin-page-framework-demo' ), |
|
42 | - * 'edit' => __( 'Edit', 'admin-page-framework-demo' ), |
|
43 | - * 'edit_item' => __( 'Edit APF Post', 'admin-page-framework-demo' ), |
|
44 | - * 'new_item' => __( 'New APF Post', 'admin-page-framework-demo' ), |
|
45 | - * 'view' => __( 'View', 'admin-page-framework-demo' ), |
|
46 | - * 'view_item' => __( 'View APF Post', 'admin-page-framework-demo' ), |
|
47 | - * 'search_items' => __( 'Search APF Post', 'admin-page-framework-demo' ), |
|
48 | - * 'not_found' => __( 'No APF Post found', 'admin-page-framework-demo' ), |
|
49 | - * 'not_found_in_trash' => __( 'No APF Post found in Trash', 'admin-page-framework-demo' ), |
|
50 | - * 'parent' => __( 'Parent APF Post', 'admin-page-framework-demo' ), |
|
51 | - * |
|
52 | - * // (framework specific) |
|
53 | - * 'plugin_action_link' => __( 'APF Posts', 'admin-page-framework-demo' ), // framework specific key. [3.7.3+] |
|
54 | - * ), |
|
55 | - * 'public' => true, |
|
56 | - * 'menu_position' => 110, |
|
57 | - * 'supports' => array( 'title' ), // e.g. array( 'title', 'editor', 'comments', 'thumbnail', 'excerpt' ), |
|
58 | - * 'taxonomies' => array( '' ), |
|
59 | - * 'has_archive' => true, |
|
60 | - * 'show_admin_column' => true, // [3.5+ core] this is for custom taxonomies to automatically add the column in the listing table. |
|
61 | - * 'menu_icon' => $this->oProp->bIsAdmin |
|
62 | - * ? ( |
|
63 | - * version_compare( $GLOBALS['wp_version'], '3.8', '>=' ) |
|
64 | - * ? 'dashicons-wordpress' |
|
65 | - * : plugins_url( 'asset/image/wp-logo_16x16.png', APFDEMO_FILE ) |
|
66 | - * ) |
|
67 | - * : null, // do not call the function in the front-end. |
|
68 | - * |
|
69 | - * // (framework specific) this sets the screen icon for the post type for WordPress v3.7.1 or below. |
|
70 | - * // a file path can be passed instead of a url, plugins_url( 'asset/image/wp-logo_32x32.png', APFDEMO_FILE ) |
|
71 | - * 'screen_icon' => dirname( APFDEMO_FILE ) . '/asset/image/wp-logo_32x32.png', |
|
72 | - * |
|
73 | - * // [3.5.10+] (framework specific) default: true |
|
74 | - * 'show_submenu_add_new' => true, |
|
75 | - * |
|
76 | - * // [3.7.4+] (framework specific) default: 10 |
|
77 | - * 'submenu_order_manage' => 20, |
|
78 | - * 'submenu_order_addnew' => 21, |
|
79 | - * |
|
80 | - * ) |
|
81 | - * );</code> |
|
82 | - * |
|
83 | - * <h4>Framework Specific Post Type Arguments</h4> |
|
84 | - * In addition to the post type argument structure defined by the WordPress core, there are arguments defined by the framework. |
|
85 | - * |
|
86 | - * - screen_icon - For WordPress 3.7.x or below, set an icon url or path for the 32x32 screen icon displayed in the post listing page. |
|
87 | - * - show_submenu_add_new - [3.5.10+] (boolean) Whether the sub-menu item of `Add New` should be displayed. |
|
88 | - * - submenu_order_manage - [3.7.4+] (numeric) The menu position of the `Manage` sub-menu item which gets automatically crated by the system when the admin ui is enabled. Default: `5` |
|
89 | - * - submenu_order_addnew - [3.7.4+] (numeric) The menu position of the `Manage` sub-menu item which gets automatically crated by the system when the admin ui is enabled. Default: `10` |
|
90 | - * |
|
91 | - * <h4>Framework Specific Post Type Label Arguments</h4> |
|
92 | - * - plugin_listing_table_title_cell_link' - [3.0.6+] Deprecated [3.7.3] use the `plugin_action_link` argument instead. |
|
93 | - * - plugin_action_link' - [3.7.3+] If the caller script is a plugin, this determines the label of the action link embedded in the plugin listing page (plugins.php). |
|
94 | - * To disable the action link, set an empty string `''`. |
|
95 | - |
|
96 | - * |
|
97 | - * @since 2.0.0 |
|
98 | - * @since 2.1.6 Added the $sTextDomain parameter. |
|
99 | - * @see http://codex.wordpress.org/Function_Reference/register_post_type#Arguments |
|
100 | - * @param string The post type slug. |
|
101 | - * @param array The <a href="http://codex.wordpress.org/Function_Reference/register_post_type#Arguments">argument array</a> passed to register_post_type(). |
|
102 | - * @param string The path of the caller script. This is used to retrieve the script information to insert it into the footer. If not set, the framework tries to detect it. |
|
103 | - * @param string The text domain of the caller script. |
|
104 | - * @return void |
|
105 | - */ |
|
28 | + * The constructor of the class object. |
|
29 | + * |
|
30 | + * Registers necessary hooks and sets up internal properties. |
|
31 | + * |
|
32 | + * <h4>Example</h4> |
|
33 | + * <code>new APF_PostType( |
|
34 | + * 'apf_posts', // post type slug |
|
35 | + * array( |
|
36 | + * 'labels' => array( |
|
37 | + * 'name' => 'Demo', |
|
38 | + * 'all_items' => __( 'Sample Posts', 'admin-page-framework-demo' ), |
|
39 | + * 'singular_name' => 'Demo', |
|
40 | + * 'add_new' => __( 'Add New', 'admin-page-framework-demo' ), |
|
41 | + * 'add_new_item' => __( 'Add New APF Post', 'admin-page-framework-demo' ), |
|
42 | + * 'edit' => __( 'Edit', 'admin-page-framework-demo' ), |
|
43 | + * 'edit_item' => __( 'Edit APF Post', 'admin-page-framework-demo' ), |
|
44 | + * 'new_item' => __( 'New APF Post', 'admin-page-framework-demo' ), |
|
45 | + * 'view' => __( 'View', 'admin-page-framework-demo' ), |
|
46 | + * 'view_item' => __( 'View APF Post', 'admin-page-framework-demo' ), |
|
47 | + * 'search_items' => __( 'Search APF Post', 'admin-page-framework-demo' ), |
|
48 | + * 'not_found' => __( 'No APF Post found', 'admin-page-framework-demo' ), |
|
49 | + * 'not_found_in_trash' => __( 'No APF Post found in Trash', 'admin-page-framework-demo' ), |
|
50 | + * 'parent' => __( 'Parent APF Post', 'admin-page-framework-demo' ), |
|
51 | + * |
|
52 | + * // (framework specific) |
|
53 | + * 'plugin_action_link' => __( 'APF Posts', 'admin-page-framework-demo' ), // framework specific key. [3.7.3+] |
|
54 | + * ), |
|
55 | + * 'public' => true, |
|
56 | + * 'menu_position' => 110, |
|
57 | + * 'supports' => array( 'title' ), // e.g. array( 'title', 'editor', 'comments', 'thumbnail', 'excerpt' ), |
|
58 | + * 'taxonomies' => array( '' ), |
|
59 | + * 'has_archive' => true, |
|
60 | + * 'show_admin_column' => true, // [3.5+ core] this is for custom taxonomies to automatically add the column in the listing table. |
|
61 | + * 'menu_icon' => $this->oProp->bIsAdmin |
|
62 | + * ? ( |
|
63 | + * version_compare( $GLOBALS['wp_version'], '3.8', '>=' ) |
|
64 | + * ? 'dashicons-wordpress' |
|
65 | + * : plugins_url( 'asset/image/wp-logo_16x16.png', APFDEMO_FILE ) |
|
66 | + * ) |
|
67 | + * : null, // do not call the function in the front-end. |
|
68 | + * |
|
69 | + * // (framework specific) this sets the screen icon for the post type for WordPress v3.7.1 or below. |
|
70 | + * // a file path can be passed instead of a url, plugins_url( 'asset/image/wp-logo_32x32.png', APFDEMO_FILE ) |
|
71 | + * 'screen_icon' => dirname( APFDEMO_FILE ) . '/asset/image/wp-logo_32x32.png', |
|
72 | + * |
|
73 | + * // [3.5.10+] (framework specific) default: true |
|
74 | + * 'show_submenu_add_new' => true, |
|
75 | + * |
|
76 | + * // [3.7.4+] (framework specific) default: 10 |
|
77 | + * 'submenu_order_manage' => 20, |
|
78 | + * 'submenu_order_addnew' => 21, |
|
79 | + * |
|
80 | + * ) |
|
81 | + * );</code> |
|
82 | + * |
|
83 | + * <h4>Framework Specific Post Type Arguments</h4> |
|
84 | + * In addition to the post type argument structure defined by the WordPress core, there are arguments defined by the framework. |
|
85 | + * |
|
86 | + * - screen_icon - For WordPress 3.7.x or below, set an icon url or path for the 32x32 screen icon displayed in the post listing page. |
|
87 | + * - show_submenu_add_new - [3.5.10+] (boolean) Whether the sub-menu item of `Add New` should be displayed. |
|
88 | + * - submenu_order_manage - [3.7.4+] (numeric) The menu position of the `Manage` sub-menu item which gets automatically crated by the system when the admin ui is enabled. Default: `5` |
|
89 | + * - submenu_order_addnew - [3.7.4+] (numeric) The menu position of the `Manage` sub-menu item which gets automatically crated by the system when the admin ui is enabled. Default: `10` |
|
90 | + * |
|
91 | + * <h4>Framework Specific Post Type Label Arguments</h4> |
|
92 | + * - plugin_listing_table_title_cell_link' - [3.0.6+] Deprecated [3.7.3] use the `plugin_action_link` argument instead. |
|
93 | + * - plugin_action_link' - [3.7.3+] If the caller script is a plugin, this determines the label of the action link embedded in the plugin listing page (plugins.php). |
|
94 | + * To disable the action link, set an empty string `''`. |
|
95 | + * |
|
96 | + * @since 2.0.0 |
|
97 | + * @since 2.1.6 Added the $sTextDomain parameter. |
|
98 | + * @see http://codex.wordpress.org/Function_Reference/register_post_type#Arguments |
|
99 | + * @param string The post type slug. |
|
100 | + * @param array The <a href="http://codex.wordpress.org/Function_Reference/register_post_type#Arguments">argument array</a> passed to register_post_type(). |
|
101 | + * @param string The path of the caller script. This is used to retrieve the script information to insert it into the footer. If not set, the framework tries to detect it. |
|
102 | + * @param string The text domain of the caller script. |
|
103 | + * @return void |
|
104 | + */ |
|
106 | 105 | public function __construct( $sPostType, $aArguments=array(), $sCallerPath=null, $sTextDomain='admin-page-framework' ) { |
107 | 106 | |
108 | 107 | if ( empty( $sPostType ) ) { |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | * @since 2.0.0 |
15 | 15 | * @package AdminPageFramework/Factory/PostType |
16 | 16 | */ |
17 | -abstract class AdminPageFramework_PostType extends AdminPageFramework_PostType_Controller { |
|
17 | +abstract class AdminPageFramework_PostType extends AdminPageFramework_PostType_Controller { |
|
18 | 18 | |
19 | 19 | /** |
20 | 20 | * Defines the class object structure type. |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | */ |
106 | 106 | public function __construct( $sPostType, $aArguments=array(), $sCallerPath=null, $sTextDomain='admin-page-framework' ) { |
107 | 107 | |
108 | - if ( empty( $sPostType ) ) { |
|
108 | + if ( empty( $sPostType ) ) { |
|
109 | 109 | return; |
110 | 110 | } |
111 | 111 |
@@ -84,12 +84,6 @@ discard block |
||
84 | 84 | * Returns the specified option value. |
85 | 85 | * |
86 | 86 | * @since 3.6.0 |
87 | - * @param string|array $sKey1|$aKeys The dimensional key or keys of an array of the element to extract its value. |
|
88 | - * If a string is set to the first parameter, the second parameter is also expected to be a string serving as a second dimensional key. |
|
89 | - * For example, there is a multi-dimensional array, `array( 'a' => array( 'b' => 'bbb' ) )` to extract the value of the 'b' element in the second depth, |
|
90 | - * set the parameter as follows. `get( 'a', 'b' )` or `get( array( 'a', 'b' ) );` |
|
91 | - * @param string|variant $sKey2|$vDefault The second dimensional key or the default value in case the value is not set. |
|
92 | - * @param string $sKey3 The third dimensional key and so on. |
|
93 | 87 | */ |
94 | 88 | public function get( /* $sKey1, $sKey2, $sKey3, ... OR $aKeys, $vDefault */ ) { |
95 | 89 | |
@@ -139,10 +133,6 @@ discard block |
||
139 | 133 | * |
140 | 134 | * @since 3.6.0 |
141 | 135 | * @return void |
142 | - * @param string|array $asKeys The key or keys of an array of the element to set its value. |
|
143 | - * If a string is passed, it specifies the element with the set key. If an array is passed, it specifies the element with the dimensional keys. |
|
144 | - * For example, `set( 'a', 'aaa' )` will set a value, `array( 'a' => 'aaa' )` and `set( array( 'a', 'b' ), 'bbb' )` will set `array( 'a' => array( 'b' => 'bbb' ) )`. |
|
145 | - * @param variant $mValue The value to be set. |
|
146 | 136 | */ |
147 | 137 | public function set( /* $asKeys, $mValue */ ) { |
148 | 138 | |
@@ -168,10 +158,6 @@ discard block |
||
168 | 158 | * Removes an element by dimensional keys. |
169 | 159 | * @since 3.6.0 |
170 | 160 | * @return void |
171 | - * @param string|array $asKeys The key or keys of an array of the element to set its value. |
|
172 | - * If a string is passed, it specifies the element with the set key. If an array is passed, it specifies the element with the dimensional keys. |
|
173 | - * For example, `delete( 'a' )` will unset an element of `a` in `array( 'a' => 'some value' )` so it becomes `array()`. |
|
174 | - * `delete( array( 'a', 'b' ) )` will unset the element of `b` in `array( 'a' => array( 'b' => 'bbb' ) )`. |
|
175 | 161 | */ |
176 | 162 | public function delete( /* $sKey1, $sKey2, $sKey3 ... OR $aKeys */ ) { |
177 | 163 |
@@ -51,14 +51,14 @@ discard block |
||
51 | 51 | * @since 3.6.0 |
52 | 52 | * @var array |
53 | 53 | */ |
54 | - public $aData = array(); |
|
54 | + public $aData = array(); |
|
55 | 55 | |
56 | 56 | /** |
57 | 57 | * Stores the default values. |
58 | 58 | * @since 3.6.0 |
59 | 59 | * @var array |
60 | 60 | */ |
61 | - public $aDefault = array(); |
|
61 | + public $aDefault = array(); |
|
62 | 62 | /**#@-*/ |
63 | 63 | |
64 | 64 | /** |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | $_aKeys = func_get_args() + array( null ); |
97 | 97 | |
98 | 98 | // If no key is specified, return the whole array. |
99 | - if ( ! isset( $_aKeys[ 0 ] ) ) { |
|
99 | + if ( !isset( $_aKeys[ 0 ] ) ) { |
|
100 | 100 | return $this->uniteArrays( |
101 | 101 | $this->aData, |
102 | 102 | $this->aDefault |
@@ -111,8 +111,8 @@ discard block |
||
111 | 111 | |
112 | 112 | // Now either the section ID or field ID is given. |
113 | 113 | return $this->getArrayValueByArrayKeys( |
114 | - $this->aData, // subject array |
|
115 | - $_aKeys, // dimensional keys |
|
114 | + $this->aData, // subject array |
|
115 | + $_aKeys, // dimensional keys |
|
116 | 116 | $this->_getDefaultValue( // default value |
117 | 117 | $_mDefault, |
118 | 118 | $_aKeys |
@@ -145,8 +145,8 @@ discard block |
||
145 | 145 | */ |
146 | 146 | public function set( /* $asKeys, $mValue */ ) { |
147 | 147 | |
148 | - $_aParameters = func_get_args(); |
|
149 | - if ( ! isset( $_aParameters[ 0 ], $_aParameters[ 1 ] ) ) { |
|
148 | + $_aParameters = func_get_args(); |
|
149 | + if ( !isset( $_aParameters[ 0 ], $_aParameters[ 1 ] ) ) { |
|
150 | 150 | return; |
151 | 151 | } |
152 | 152 | $_asKeys = $_aParameters[ 0 ]; |
@@ -174,8 +174,8 @@ discard block |
||
174 | 174 | */ |
175 | 175 | public function delete( /* $sKey1, $sKey2, $sKey3 ... OR $aKeys */ ) { |
176 | 176 | |
177 | - $_aParameters = func_get_args(); |
|
178 | - if ( ! isset( $_aParameters[ 0 ], $_aParameters[ 1 ] ) ) { |
|
177 | + $_aParameters = func_get_args(); |
|
178 | + if ( !isset( $_aParameters[ 0 ], $_aParameters[ 1 ] ) ) { |
|
179 | 179 | return; |
180 | 180 | } |
181 | 181 | $_asKeys = $_aParameters[ 0 ]; |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | * Sets up properties and performs registering classes. |
76 | 76 | * |
77 | 77 | * |
78 | - * @param array|string $asScanDirPath the target directory path to scan |
|
78 | + * @param array|string $asScanDirPaths the target directory path to scan |
|
79 | 79 | * @param array $aOptions The recursive settings. |
80 | 80 | * <ul> |
81 | 81 | * <li><code>is_recursive</code> - (boolean) determines whether the scan should be performed recursively.</li> |
@@ -217,6 +217,7 @@ discard block |
||
217 | 217 | /** |
218 | 218 | * The recursive version of the glob() function. |
219 | 219 | * @internal |
220 | + * @param string $sPathPatten |
|
220 | 221 | */ |
221 | 222 | protected function doRecursiveGlob( $sPathPatten, $nFlags=0, array $aExcludeDirs=array(), array $aExcludeDirNames=array() ) { |
222 | 223 |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | 'is_recursive' => true, |
67 | 67 | 'exclude_dir_paths' => array(), |
68 | 68 | 'exclude_dir_names' => array( 'asset', 'assets', 'css', 'js', 'image', 'images', 'license', 'document', 'documents' ), |
69 | - 'allowed_extensions' => array( 'php', ), // 'inc' |
|
69 | + 'allowed_extensions' => array( 'php',), // 'inc' |
|
70 | 70 | 'include_function' => 'include', |
71 | 71 | 'exclude_class_names' => array( /* 'SomeClass', 'SomeOtherClass' */ ), |
72 | 72 | ); |
@@ -105,10 +105,10 @@ discard block |
||
105 | 105 | * |
106 | 106 | * @remark The directory paths set for the 'exclude_dir_paths' option should use the system directory separator. |
107 | 107 | */ |
108 | - public function __construct( $asScanDirPaths, array $aOptions=array(), array $aClasses=array() ) { |
|
108 | + public function __construct( $asScanDirPaths, array $aOptions = array(), array $aClasses = array() ) { |
|
109 | 109 | |
110 | 110 | $_aOptions = $aOptions + self::$_aStructure_Options; |
111 | - $this->_aClasses = $aClasses + $this->_getClassArray( $asScanDirPaths, $_aOptions ); |
|
111 | + $this->_aClasses = $aClasses + $this->_getClassArray( $asScanDirPaths, $_aOptions ); |
|
112 | 112 | $this->_registerClasses( $_aOptions[ 'include_function' ] ); |
113 | 113 | |
114 | 114 | } |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | return array(); |
135 | 135 | } |
136 | 136 | $_aFilePaths = array(); |
137 | - foreach( ( array ) $asScanDirPaths as $_sClassDirPath ) { |
|
137 | + foreach ( ( array ) $asScanDirPaths as $_sClassDirPath ) { |
|
138 | 138 | if ( realpath( $_sClassDirPath ) ) { |
139 | 139 | $_aFilePaths = array_merge( $this->getFilePaths( $_sClassDirPath, $aSearchOptions ), $_aFilePaths ); |
140 | 140 | } |
@@ -142,11 +142,11 @@ discard block |
||
142 | 142 | |
143 | 143 | // Store classes in an array. |
144 | 144 | $_aClasses = array(); |
145 | - foreach( $_aFilePaths as $_sFilePath ) { |
|
145 | + foreach ( $_aFilePaths as $_sFilePath ) { |
|
146 | 146 | |
147 | 147 | // Class name without a file extension. |
148 | 148 | $_sClassNameWOExt = pathinfo( $_sFilePath, PATHINFO_FILENAME ); |
149 | - if ( in_array( $_sClassNameWOExt, $aSearchOptions['exclude_class_names'] ) ) { |
|
149 | + if ( in_array( $_sClassNameWOExt, $aSearchOptions[ 'exclude_class_names' ] ) ) { |
|
150 | 150 | continue; |
151 | 151 | } |
152 | 152 | $_aClasses[ $_sClassNameWOExt ] = $_sFilePath; |
@@ -176,26 +176,26 @@ discard block |
||
176 | 176 | */ |
177 | 177 | protected function getFilePaths( $sClassDirPath, array $aSearchOptions ) { |
178 | 178 | |
179 | - $sClassDirPath = rtrim( $sClassDirPath, '\\/' ) . DIRECTORY_SEPARATOR; // ensures the trailing (back/)slash exists. |
|
180 | - $_aAllowedExtensions = $aSearchOptions['allowed_extensions']; |
|
181 | - $_aExcludeDirPaths = ( array ) $aSearchOptions['exclude_dir_paths']; |
|
182 | - $_aExcludeDirNames = ( array ) $aSearchOptions['exclude_dir_names']; |
|
179 | + $sClassDirPath = rtrim( $sClassDirPath, '\\/' ).DIRECTORY_SEPARATOR; // ensures the trailing (back/)slash exists. |
|
180 | + $_aAllowedExtensions = $aSearchOptions[ 'allowed_extensions' ]; |
|
181 | + $_aExcludeDirPaths = ( array ) $aSearchOptions[ 'exclude_dir_paths' ]; |
|
182 | + $_aExcludeDirNames = ( array ) $aSearchOptions[ 'exclude_dir_names' ]; |
|
183 | 183 | $_bIsRecursive = $aSearchOptions[ 'is_recursive' ]; |
184 | 184 | |
185 | 185 | if ( defined( 'GLOB_BRACE' ) ) { // in some OSes this flag constant is not available. |
186 | 186 | $_aFilePaths = $_bIsRecursive |
187 | - ? $this->doRecursiveGlob( $sClassDirPath . '*.' . $this->_getGlobPatternExtensionPart( $_aAllowedExtensions ), GLOB_BRACE, $_aExcludeDirPaths, $_aExcludeDirNames ) |
|
188 | - : ( array ) glob( $sClassDirPath . '*.' . $this->_getGlobPatternExtensionPart( $_aAllowedExtensions ), GLOB_BRACE ); |
|
187 | + ? $this->doRecursiveGlob( $sClassDirPath.'*.'.$this->_getGlobPatternExtensionPart( $_aAllowedExtensions ), GLOB_BRACE, $_aExcludeDirPaths, $_aExcludeDirNames ) |
|
188 | + : ( array ) glob( $sClassDirPath.'*.'.$this->_getGlobPatternExtensionPart( $_aAllowedExtensions ), GLOB_BRACE ); |
|
189 | 189 | return array_filter( $_aFilePaths ); // drop non-value elements. |
190 | 190 | } |
191 | 191 | |
192 | 192 | // For the Solaris operation system. |
193 | 193 | $_aFilePaths = array(); |
194 | - foreach( $_aAllowedExtensions as $__sAllowedExtension ) { |
|
194 | + foreach ( $_aAllowedExtensions as $__sAllowedExtension ) { |
|
195 | 195 | |
196 | 196 | $__aFilePaths = $_bIsRecursive |
197 | - ? $this->doRecursiveGlob( $sClassDirPath . '*.' . $__sAllowedExtension, 0, $_aExcludeDirPaths, $_aExcludeDirNames ) |
|
198 | - : ( array ) glob( $sClassDirPath . '*.' . $__sAllowedExtension ); |
|
197 | + ? $this->doRecursiveGlob( $sClassDirPath.'*.'.$__sAllowedExtension, 0, $_aExcludeDirPaths, $_aExcludeDirNames ) |
|
198 | + : ( array ) glob( $sClassDirPath.'*.'.$__sAllowedExtension ); |
|
199 | 199 | |
200 | 200 | $_aFilePaths = array_merge( $__aFilePaths, $_aFilePaths ); |
201 | 201 | |
@@ -208,28 +208,28 @@ discard block |
||
208 | 208 | * Constructs the file pattern of the file extension part used for the glob() function with the given file extensions. |
209 | 209 | * @internal |
210 | 210 | */ |
211 | - protected function _getGlobPatternExtensionPart( array $aExtensions=array( 'php', 'inc' ) ) { |
|
211 | + protected function _getGlobPatternExtensionPart( array $aExtensions = array( 'php', 'inc' ) ) { |
|
212 | 212 | return empty( $aExtensions ) |
213 | 213 | ? '*' |
214 | - : '{' . implode( ',', $aExtensions ) . '}'; |
|
214 | + : '{'.implode( ',', $aExtensions ).'}'; |
|
215 | 215 | } |
216 | 216 | |
217 | 217 | /** |
218 | 218 | * The recursive version of the glob() function. |
219 | 219 | * @internal |
220 | 220 | */ |
221 | - protected function doRecursiveGlob( $sPathPatten, $nFlags=0, array $aExcludeDirs=array(), array $aExcludeDirNames=array() ) { |
|
221 | + protected function doRecursiveGlob( $sPathPatten, $nFlags = 0, array $aExcludeDirs = array(), array $aExcludeDirNames = array() ) { |
|
222 | 222 | |
223 | 223 | $_aFiles = glob( $sPathPatten, $nFlags ); |
224 | 224 | $_aFiles = is_array( $_aFiles ) ? $_aFiles : array(); // glob() can return false. |
225 | - $_aDirs = glob( dirname( $sPathPatten ) . DIRECTORY_SEPARATOR . '*', GLOB_ONLYDIR|GLOB_NOSORT ); |
|
225 | + $_aDirs = glob( dirname( $sPathPatten ).DIRECTORY_SEPARATOR.'*', GLOB_ONLYDIR | GLOB_NOSORT ); |
|
226 | 226 | $_aDirs = is_array( $_aDirs ) ? $_aDirs : array(); |
227 | 227 | foreach ( $_aDirs as $_sDirPath ) { |
228 | 228 | |
229 | 229 | if ( in_array( $_sDirPath, $aExcludeDirs ) ) { continue; } |
230 | 230 | if ( in_array( pathinfo( $_sDirPath, PATHINFO_DIRNAME ), $aExcludeDirNames ) ) { continue; } |
231 | 231 | |
232 | - $_aFiles = array_merge( $_aFiles, $this->doRecursiveGlob( $_sDirPath . DIRECTORY_SEPARATOR . basename( $sPathPatten ), $nFlags, $aExcludeDirs ) ); |
|
232 | + $_aFiles = array_merge( $_aFiles, $this->doRecursiveGlob( $_sDirPath.DIRECTORY_SEPARATOR.basename( $sPathPatten ), $nFlags, $aExcludeDirs ) ); |
|
233 | 233 | |
234 | 234 | } |
235 | 235 | return $_aFiles; |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | * @return void |
245 | 245 | */ |
246 | 246 | protected function _registerClasses( $sIncludeFunction ) { |
247 | - spl_autoload_register( array( $this, '_replyToAutoLoad_' . $sIncludeFunction ) ); |
|
247 | + spl_autoload_register( array( $this, '_replyToAutoLoad_'.$sIncludeFunction ) ); |
|
248 | 248 | } |
249 | 249 | /**#@+ |
250 | 250 | * Responds to the PHP auto-loader and includes the passed class based on the previously stored path associated with the class name in the constructor. |
@@ -252,25 +252,25 @@ discard block |
||
252 | 252 | * @return void |
253 | 253 | */ |
254 | 254 | public function _replyToAutoLoad_include( $sCalledUnknownClassName ) { |
255 | - if ( ! isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { |
|
255 | + if ( !isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { |
|
256 | 256 | return; |
257 | 257 | } |
258 | 258 | include( $this->_aClasses[ $sCalledUnknownClassName ] ); |
259 | 259 | } |
260 | 260 | public function _replyToAutoLoad_include_once( $sCalledUnknownClassName ) { |
261 | - if ( ! isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { |
|
261 | + if ( !isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { |
|
262 | 262 | return; |
263 | 263 | } |
264 | 264 | include_once( $this->_aClasses[ $sCalledUnknownClassName ] ); |
265 | 265 | } |
266 | 266 | public function _replyToAutoLoad_require( $sCalledUnknownClassName ) { |
267 | - if ( ! isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { |
|
267 | + if ( !isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { |
|
268 | 268 | return; |
269 | 269 | } |
270 | 270 | require( $this->_aClasses[ $sCalledUnknownClassName ] ); |
271 | 271 | } |
272 | 272 | public function _replyToAutoLoad_require_once( $sCalledUnknownClassName ) { |
273 | - if ( ! isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { |
|
273 | + if ( !isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { |
|
274 | 274 | return; |
275 | 275 | } |
276 | 276 | require_once( $this->_aClasses[ $sCalledUnknownClassName ] ); |
@@ -181,7 +181,8 @@ discard block |
||
181 | 181 | $_aExcludeDirNames = ( array ) $aSearchOptions['exclude_dir_names']; |
182 | 182 | $_bIsRecursive = $aSearchOptions[ 'is_recursive' ]; |
183 | 183 | |
184 | - if ( defined( 'GLOB_BRACE' ) ) { // in some OSes this flag constant is not available. |
|
184 | + if ( defined( 'GLOB_BRACE' ) ) { |
|
185 | +// in some OSes this flag constant is not available. |
|
185 | 186 | $_aFilePaths = $_bIsRecursive |
186 | 187 | ? $this->doRecursiveGlob( $sClassDirPath . '*.' . $this->_getGlobPatternExtensionPart( $_aAllowedExtensions ), GLOB_BRACE, $_aExcludeDirPaths, $_aExcludeDirNames ) |
187 | 188 | : ( array ) glob( $sClassDirPath . '*.' . $this->_getGlobPatternExtensionPart( $_aAllowedExtensions ), GLOB_BRACE ); |
@@ -250,26 +251,26 @@ discard block |
||
250 | 251 | * @internal |
251 | 252 | * @return void |
252 | 253 | */ |
253 | - public function _replyToAutoLoad_include( $sCalledUnknownClassName ) { |
|
254 | - if ( ! isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { |
|
254 | + public function _replyToAutoLoad_include( $sCalledUnknownClassName ) { |
|
255 | + if ( ! isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { |
|
255 | 256 | return; |
256 | 257 | } |
257 | 258 | include( $this->_aClasses[ $sCalledUnknownClassName ] ); |
258 | 259 | } |
259 | - public function _replyToAutoLoad_include_once( $sCalledUnknownClassName ) { |
|
260 | - if ( ! isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { |
|
260 | + public function _replyToAutoLoad_include_once( $sCalledUnknownClassName ) { |
|
261 | + if ( ! isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { |
|
261 | 262 | return; |
262 | 263 | } |
263 | 264 | include_once( $this->_aClasses[ $sCalledUnknownClassName ] ); |
264 | 265 | } |
265 | - public function _replyToAutoLoad_require( $sCalledUnknownClassName ) { |
|
266 | - if ( ! isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { |
|
266 | + public function _replyToAutoLoad_require( $sCalledUnknownClassName ) { |
|
267 | + if ( ! isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { |
|
267 | 268 | return; |
268 | 269 | } |
269 | 270 | require( $this->_aClasses[ $sCalledUnknownClassName ] ); |
270 | 271 | } |
271 | - public function _replyToAutoLoad_require_once( $sCalledUnknownClassName ) { |
|
272 | - if ( ! isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { |
|
272 | + public function _replyToAutoLoad_require_once( $sCalledUnknownClassName ) { |
|
273 | + if ( ! isset( $this->_aClasses[ $sCalledUnknownClassName ] ) ) { |
|
273 | 274 | return; |
274 | 275 | } |
275 | 276 | require_once( $this->_aClasses[ $sCalledUnknownClassName ] ); |