@@ -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 ); |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | $aSubmits, |
38 | 38 | 'is_reset' |
39 | 39 | ); |
40 | - if ( ! $_bIsReset ) { |
|
40 | + if ( !$_bIsReset ) { |
|
41 | 41 | return; |
42 | 42 | } |
43 | 43 | |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | ); |
48 | 48 | |
49 | 49 | // Go to the catch clause. |
50 | - $_oException = new Exception( 'aReturn' ); // the property name to return from the catch clasue. |
|
50 | + $_oException = new Exception( 'aReturn' ); // the property name to return from the catch clasue. |
|
51 | 51 | $_oException->aReturn = $this->_confirmSubmitButtonAction( |
52 | 52 | $this->getElement( $aSubmitInformation, 'input_name' ), |
53 | 53 | $this->getElement( $aSubmitInformation, 'section_id' ), |
@@ -468,7 +468,6 @@ discard block |
||
468 | 468 | * |
469 | 469 | * @since 2.0.0 |
470 | 470 | * @since 3.0.0 The second parameter was changed to a tab slug. Moved from the settings class. |
471 | - |
|
472 | 471 | * @param array $aOptions the options array. Note that the options array structure are very similar to the aFields array. |
473 | 472 | * However, it does not have the `_default` section key. |
474 | 473 | * @param string $sPageSlug the page slug to check |
@@ -508,7 +507,7 @@ discard block |
||
508 | 507 | */ |
509 | 508 | private function _setOtherTabOptions( array &$_aStoredOptionsNotOfTheTab, array $aOptions, array $_aSubSectionsOrFields, $_sSectionID ) { |
510 | 509 | |
511 | - // At this point, the passed element belongs to the other tabs since the section of the given tab is skipped. |
|
510 | + // At this point, the passed element belongs to the other tabs since the section of the given tab is skipped. |
|
512 | 511 | foreach ( $_aSubSectionsOrFields as $_isSubSectionIndexOrFieldID => $_aSubSectionOrField ) { |
513 | 512 | |
514 | 513 | // If it's a sub section |
@@ -59,10 +59,10 @@ discard block |
||
59 | 59 | * @since 3.0.0 |
60 | 60 | */ |
61 | 61 | public function isPageAdded( $sPageSlug ) { |
62 | - foreach( $this->aSections as $_sSectionID => $_aSection ) { |
|
62 | + foreach ( $this->aSections as $_sSectionID => $_aSection ) { |
|
63 | 63 | if ( |
64 | - isset( $_aSection['page_slug'] ) |
|
65 | - && $sPageSlug == $_aSection['page_slug'] |
|
64 | + isset( $_aSection[ 'page_slug' ] ) |
|
65 | + && $sPageSlug == $_aSection[ 'page_slug' ] |
|
66 | 66 | ) { |
67 | 67 | return true; |
68 | 68 | } |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | * |
76 | 76 | * @since 3.0.0 |
77 | 77 | */ |
78 | - public function getFieldsByPageSlug( $sPageSlug, $sTabSlug='' ) { |
|
78 | + public function getFieldsByPageSlug( $sPageSlug, $sTabSlug = '' ) { |
|
79 | 79 | return $this->castArrayContents( |
80 | 80 | $this->getSectionsByPageSlug( $sPageSlug, $sTabSlug ), |
81 | 81 | $this->aFields |
@@ -86,14 +86,14 @@ discard block |
||
86 | 86 | * Returns the registered sections that belong to the given page by slug. |
87 | 87 | * @since 3.0.0. |
88 | 88 | */ |
89 | - public function getSectionsByPageSlug( $sPageSlug, $sTabSlug='' ) { |
|
89 | + public function getSectionsByPageSlug( $sPageSlug, $sTabSlug = '' ) { |
|
90 | 90 | |
91 | 91 | $_aSections = array(); |
92 | - foreach( $this->aSections as $_sSecitonID => $_aSection ) { |
|
93 | - if ( $sTabSlug && $_aSection['tab_slug'] != $sTabSlug ) { |
|
92 | + foreach ( $this->aSections as $_sSecitonID => $_aSection ) { |
|
93 | + if ( $sTabSlug && $_aSection[ 'tab_slug' ] != $sTabSlug ) { |
|
94 | 94 | continue; |
95 | 95 | } |
96 | - if ( $_aSection['page_slug'] != $sPageSlug ) { |
|
96 | + if ( $_aSection[ 'page_slug' ] != $sPageSlug ) { |
|
97 | 97 | continue; |
98 | 98 | } |
99 | 99 | $_aSections[ $_sSecitonID ] = $_aSection; |
@@ -113,8 +113,8 @@ discard block |
||
113 | 113 | * @internal |
114 | 114 | */ |
115 | 115 | public function getPageSlugBySectionID( $sSectionID ) { |
116 | - return isset( $this->aSections[ $sSectionID ]['page_slug'] ) |
|
117 | - ? $this->aSections[ $sSectionID ]['page_slug'] |
|
116 | + return isset( $this->aSections[ $sSectionID ][ 'page_slug' ] ) |
|
117 | + ? $this->aSections[ $sSectionID ][ 'page_slug' ] |
|
118 | 118 | : null; |
119 | 119 | } |
120 | 120 | |
@@ -230,16 +230,16 @@ discard block |
||
230 | 230 | |
231 | 231 | $_aField = parent::formatField( $aField, $sFieldsType, $sCapability, $iCountOfElements, $iSectionIndex, $bIsSectionRepeatable, $oCallerObject ); |
232 | 232 | |
233 | - if ( ! $_aField ) { |
|
233 | + if ( !$_aField ) { |
|
234 | 234 | return; |
235 | 235 | } |
236 | - $_aField['option_key'] = $this->sOptionKey; |
|
237 | - $_aField['class_name'] = $this->sClassName; |
|
238 | - $_aField['page_slug'] = $this->getElement( $this->aSections, array( $_aField['section_id'], 'page_slug' ), null ); |
|
239 | - $_aField['tab_slug'] = $this->getElement( $this->aSections, array( $_aField['section_id'], 'tab_slug' ), null ); |
|
236 | + $_aField[ 'option_key' ] = $this->sOptionKey; |
|
237 | + $_aField[ 'class_name' ] = $this->sClassName; |
|
238 | + $_aField[ 'page_slug' ] = $this->getElement( $this->aSections, array( $_aField[ 'section_id' ], 'page_slug' ), null ); |
|
239 | + $_aField[ 'tab_slug' ] = $this->getElement( $this->aSections, array( $_aField[ 'section_id' ], 'tab_slug' ), null ); |
|
240 | 240 | |
241 | 241 | // used for the contextual help pane. |
242 | - $_aField['section_title'] = $this->getElement( $this->aSections, array( $_aField['section_id'], 'title' ), null ); |
|
242 | + $_aField[ 'section_title' ] = $this->getElement( $this->aSections, array( $_aField[ 'section_id' ], 'title' ), null ); |
|
243 | 243 | return $_aField; |
244 | 244 | |
245 | 245 | } |
@@ -256,19 +256,19 @@ discard block |
||
256 | 256 | */ |
257 | 257 | protected function getConditionedSection( array $aSection ) { |
258 | 258 | |
259 | - if ( ! current_user_can( $aSection['capability'] ) ) { |
|
259 | + if ( !current_user_can( $aSection[ 'capability' ] ) ) { |
|
260 | 260 | return array(); |
261 | 261 | } |
262 | - if ( ! $aSection['if'] ) { |
|
262 | + if ( !$aSection[ 'if' ] ) { |
|
263 | 263 | return array(); |
264 | 264 | } |
265 | - if ( ! $aSection['page_slug'] ) { |
|
265 | + if ( !$aSection[ 'page_slug' ] ) { |
|
266 | 266 | return array(); |
267 | 267 | } |
268 | - if ( 'options.php' != $this->getPageNow() && $this->sCurrentPageSlug != $aSection['page_slug'] ) { |
|
268 | + if ( 'options.php' != $this->getPageNow() && $this->sCurrentPageSlug != $aSection[ 'page_slug' ] ) { |
|
269 | 269 | return array(); |
270 | 270 | } |
271 | - if ( ! $this->_isSectionOfCurrentTab( $aSection, $this->sCurrentPageSlug, $this->sCurrentTabSlug ) ) { |
|
271 | + if ( !$this->_isSectionOfCurrentTab( $aSection, $this->sCurrentPageSlug, $this->sCurrentTabSlug ) ) { |
|
272 | 272 | return array(); |
273 | 273 | } |
274 | 274 | return $aSection; |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | private function _isSectionOfCurrentTab( array $aSection, $sCurrentPageSlug, $sCurrentTabSlug ) { |
286 | 286 | |
287 | 287 | // Make sure if it's in the loading page. |
288 | - if ( $aSection['page_slug'] != $sCurrentPageSlug ) { |
|
288 | + if ( $aSection[ 'page_slug' ] != $sCurrentPageSlug ) { |
|
289 | 289 | return false; |
290 | 290 | } |
291 | 291 | |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | // } |
297 | 297 | |
298 | 298 | // If the checking tab slug and the current loading tab slug is the same, it should be registered. |
299 | - return ( $aSection['tab_slug'] == $sCurrentTabSlug ); |
|
299 | + return ( $aSection[ 'tab_slug' ] == $sCurrentTabSlug ); |
|
300 | 300 | |
301 | 301 | } |
302 | 302 | |
@@ -330,16 +330,16 @@ discard block |
||
330 | 330 | public function getPageOnlyOptions( $aOptions, $sPageSlug ) { |
331 | 331 | |
332 | 332 | $_aStoredOptionsOfThePage = array(); |
333 | - foreach( $this->aFields as $_sSectionID => $_aSubSectionsOrFields ) { |
|
333 | + foreach ( $this->aFields as $_sSectionID => $_aSubSectionsOrFields ) { |
|
334 | 334 | |
335 | 335 | // Check the section |
336 | - if ( ! $this->_isThisSectionSetToThisPage( $_sSectionID, $sPageSlug ) ) { |
|
336 | + if ( !$this->_isThisSectionSetToThisPage( $_sSectionID, $sPageSlug ) ) { |
|
337 | 337 | continue; |
338 | 338 | } |
339 | 339 | |
340 | 340 | // At this point, the element belongs the given page slug as the section is of the given page slug's. |
341 | 341 | $this->_setPageOnlyOptions( |
342 | - $_aStoredOptionsOfThePage, // by reference - gets updated in the method. |
|
342 | + $_aStoredOptionsOfThePage, // by reference - gets updated in the method. |
|
343 | 343 | $aOptions, |
344 | 344 | $_aSubSectionsOrFields, |
345 | 345 | $sPageSlug, |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | * @internal |
359 | 359 | */ |
360 | 360 | private function _setPageOnlyOptions( array &$_aStoredOptionsOfThePage, array $aOptions, array $_aSubSectionsOrFields, $sPageSlug, $_sSectionID ) { |
361 | - foreach( $_aSubSectionsOrFields as $_sFieldID => $_aField ) { |
|
361 | + foreach ( $_aSubSectionsOrFields as $_sFieldID => $_aField ) { |
|
362 | 362 | |
363 | 363 | // If it's a sub-section array, |
364 | 364 | if ( $this->isNumericInteger( $_sFieldID ) ) { |
@@ -372,20 +372,20 @@ discard block |
||
372 | 372 | |
373 | 373 | // @todo Examine whether this check can be removed |
374 | 374 | // as the section that hods this field is already checked above outside this loop. |
375 | - if ( $sPageSlug !== $_aField['page_slug'] ) { |
|
375 | + if ( $sPageSlug !== $_aField[ 'page_slug' ] ) { |
|
376 | 376 | continue; |
377 | 377 | } |
378 | 378 | |
379 | - if ( '_default' !== $_aField['section_id'] ) { |
|
380 | - if ( array_key_exists( $_aField['section_id'], $aOptions ) ) { |
|
381 | - $_aStoredOptionsOfThePage[ $_aField['section_id'] ] = $aOptions[ $_aField['section_id'] ]; |
|
379 | + if ( '_default' !== $_aField[ 'section_id' ] ) { |
|
380 | + if ( array_key_exists( $_aField[ 'section_id' ], $aOptions ) ) { |
|
381 | + $_aStoredOptionsOfThePage[ $_aField[ 'section_id' ] ] = $aOptions[ $_aField[ 'section_id' ] ]; |
|
382 | 382 | } |
383 | 383 | continue; |
384 | 384 | } |
385 | 385 | |
386 | 386 | // It does not have a section so set the field id as its key. |
387 | - if ( array_key_exists( $_aField['field_id'], $aOptions ) ) { |
|
388 | - $_aStoredOptionsOfThePage[ $_aField['field_id'] ] = $aOptions[ $_aField['field_id'] ]; |
|
387 | + if ( array_key_exists( $_aField[ 'field_id' ], $aOptions ) ) { |
|
388 | + $_aStoredOptionsOfThePage[ $_aField[ 'field_id' ] ] = $aOptions[ $_aField[ 'field_id' ] ]; |
|
389 | 389 | } |
390 | 390 | |
391 | 391 | } |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | public function getOtherPageOptions( $aOptions, $sPageSlug ) { |
404 | 404 | |
405 | 405 | $_aStoredOptionsNotOfThePage = array(); |
406 | - foreach( $this->aFields as $_sSectionID => $_aSubSectionsOrFields ) { |
|
406 | + foreach ( $this->aFields as $_sSectionID => $_aSubSectionsOrFields ) { |
|
407 | 407 | |
408 | 408 | // Check the section |
409 | 409 | if ( $this->_isThisSectionSetToThisPage( $_sSectionID, $sPageSlug ) ) { |
@@ -431,7 +431,7 @@ discard block |
||
431 | 431 | * @internal |
432 | 432 | */ |
433 | 433 | private function _setOtherPageOptions( array &$_aStoredOptionsNotOfThePage, array $aOptions, array $_aSubSectionsOrFields, $sPageSlug ) { |
434 | - foreach( $_aSubSectionsOrFields as $_sFieldID => $_aField ) { |
|
434 | + foreach ( $_aSubSectionsOrFields as $_sFieldID => $_aField ) { |
|
435 | 435 | |
436 | 436 | // It's a sub-section array. |
437 | 437 | if ( $this->isNumericInteger( $_sFieldID ) ) { |
@@ -440,20 +440,20 @@ discard block |
||
440 | 440 | |
441 | 441 | // @todo Examine whether this check can be removed |
442 | 442 | // as the section that hods this field is already checked above outside the loop. |
443 | - if ( $sPageSlug === $_aField['page_slug'] ) { |
|
443 | + if ( $sPageSlug === $_aField[ 'page_slug' ] ) { |
|
444 | 444 | continue; |
445 | 445 | } |
446 | 446 | |
447 | 447 | // If a section is set, |
448 | - if ( '_default' !== $_aField['section_id'] ) { |
|
449 | - if ( array_key_exists( $_aField['section_id'], $aOptions ) ) { |
|
450 | - $_aStoredOptionsNotOfThePage[ $_aField['section_id'] ] = $aOptions[ $_aField['section_id'] ]; |
|
448 | + if ( '_default' !== $_aField[ 'section_id' ] ) { |
|
449 | + if ( array_key_exists( $_aField[ 'section_id' ], $aOptions ) ) { |
|
450 | + $_aStoredOptionsNotOfThePage[ $_aField[ 'section_id' ] ] = $aOptions[ $_aField[ 'section_id' ] ]; |
|
451 | 451 | } |
452 | 452 | continue; |
453 | 453 | } |
454 | 454 | // It does not have a section |
455 | - if ( array_key_exists( $_aField['field_id'], $aOptions ) ) { |
|
456 | - $_aStoredOptionsNotOfThePage[ $_aField['field_id'] ] = $aOptions[ $_aField['field_id'] ]; |
|
455 | + if ( array_key_exists( $_aField[ 'field_id' ], $aOptions ) ) { |
|
456 | + $_aStoredOptionsNotOfThePage[ $_aField[ 'field_id' ] ] = $aOptions[ $_aField[ 'field_id' ] ]; |
|
457 | 457 | } |
458 | 458 | |
459 | 459 | } |
@@ -479,7 +479,7 @@ discard block |
||
479 | 479 | public function getOtherTabOptions( $aOptions, $sPageSlug, $sTabSlug ) { |
480 | 480 | |
481 | 481 | $_aStoredOptionsNotOfTheTab = array(); |
482 | - foreach( $this->aFields as $_sSectionID => $_aSubSectionsOrFields ) { |
|
482 | + foreach ( $this->aFields as $_sSectionID => $_aSubSectionsOrFields ) { |
|
483 | 483 | |
484 | 484 | // If the section is of the given page and the given tab, skip. |
485 | 485 | if ( $this->_isThisSectionSetToThisTab( $_sSectionID, $sPageSlug, $sTabSlug ) ) { |
@@ -509,7 +509,7 @@ discard block |
||
509 | 509 | private function _setOtherTabOptions( array &$_aStoredOptionsNotOfTheTab, array $aOptions, array $_aSubSectionsOrFields, $_sSectionID ) { |
510 | 510 | |
511 | 511 | // At this point, the passed element belongs to the other tabs since the section of the given tab is skipped. |
512 | - foreach ( $_aSubSectionsOrFields as $_isSubSectionIndexOrFieldID => $_aSubSectionOrField ) { |
|
512 | + foreach ( $_aSubSectionsOrFields as $_isSubSectionIndexOrFieldID => $_aSubSectionOrField ) { |
|
513 | 513 | |
514 | 514 | // If it's a sub section |
515 | 515 | if ( $this->isNumericInteger( $_isSubSectionIndexOrFieldID ) ) { |
@@ -526,15 +526,15 @@ discard block |
||
526 | 526 | $_aField = $_aSubSectionOrField; |
527 | 527 | |
528 | 528 | // If a section is set, |
529 | - if ( $_aField['section_id'] !== '_default' ) { |
|
530 | - if ( array_key_exists( $_aField['section_id'], $aOptions ) ) { |
|
531 | - $_aStoredOptionsNotOfTheTab[ $_aField['section_id'] ] = $aOptions[ $_aField['section_id'] ]; |
|
529 | + if ( $_aField[ 'section_id' ] !== '_default' ) { |
|
530 | + if ( array_key_exists( $_aField[ 'section_id' ], $aOptions ) ) { |
|
531 | + $_aStoredOptionsNotOfTheTab[ $_aField[ 'section_id' ] ] = $aOptions[ $_aField[ 'section_id' ] ]; |
|
532 | 532 | } |
533 | 533 | continue; |
534 | 534 | } |
535 | 535 | // So it's a field |
536 | - if ( array_key_exists( $_aField['field_id'], $aOptions ) ) { |
|
537 | - $_aStoredOptionsNotOfTheTab[ $_aField['field_id'] ] = $aOptions[ $_aField['field_id'] ]; |
|
536 | + if ( array_key_exists( $_aField[ 'field_id' ], $aOptions ) ) { |
|
537 | + $_aStoredOptionsNotOfTheTab[ $_aField[ 'field_id' ] ] = $aOptions[ $_aField[ 'field_id' ] ]; |
|
538 | 538 | } |
539 | 539 | |
540 | 540 | } |
@@ -547,7 +547,7 @@ discard block |
||
547 | 547 | * so that the externally injected options will be respected. |
548 | 548 | * @since 3.0.0 |
549 | 549 | */ |
550 | - public function getTabOptions( $aOptions, $sPageSlug, $sTabSlug='' ) { |
|
550 | + public function getTabOptions( $aOptions, $sPageSlug, $sTabSlug = '' ) { |
|
551 | 551 | $_aOtherTabOptions = $this->getOtherTabOptions( $aOptions, $sPageSlug, $sTabSlug ); |
552 | 552 | return $this->invertCastArrayContents( $aOptions, $_aOtherTabOptions ); |
553 | 553 | } |
@@ -561,17 +561,17 @@ discard block |
||
561 | 561 | * @since 3.0.0 |
562 | 562 | * @return array |
563 | 563 | */ |
564 | - public function getTabOnlyOptions( array $aOptions, $sPageSlug, $sTabSlug='' ) { |
|
564 | + public function getTabOnlyOptions( array $aOptions, $sPageSlug, $sTabSlug = '' ) { |
|
565 | 565 | |
566 | 566 | $_aStoredOptionsOfTheTab = array(); |
567 | - if ( ! $sTabSlug ) { |
|
567 | + if ( !$sTabSlug ) { |
|
568 | 568 | return $_aStoredOptionsOfTheTab; |
569 | 569 | } |
570 | 570 | |
571 | - foreach( $this->aFields as $_sSectionID => $_aSubSectionsOrFields ) { |
|
571 | + foreach ( $this->aFields as $_sSectionID => $_aSubSectionsOrFields ) { |
|
572 | 572 | |
573 | 573 | // Check the section |
574 | - if ( ! $this->_isThisSectionSetToThisTab( $_sSectionID, $sPageSlug, $sTabSlug ) ) { |
|
574 | + if ( !$this->_isThisSectionSetToThisTab( $_sSectionID, $sPageSlug, $sTabSlug ) ) { |
|
575 | 575 | continue; |
576 | 576 | } |
577 | 577 | |
@@ -596,7 +596,7 @@ discard block |
||
596 | 596 | */ |
597 | 597 | private function _setTabOnlyOptions( array &$_aStoredOptionsOfTheTab, array $aOptions, array $_aSubSectionsOrFields, $_sSectionID ) { |
598 | 598 | |
599 | - foreach( $_aSubSectionsOrFields as $_sFieldID => $_aField ) { |
|
599 | + foreach ( $_aSubSectionsOrFields as $_sFieldID => $_aField ) { |
|
600 | 600 | |
601 | 601 | // if it's a sub-section array. |
602 | 602 | if ( $this->isNumericInteger( $_sFieldID ) ) { |
@@ -607,16 +607,16 @@ discard block |
||
607 | 607 | } |
608 | 608 | |
609 | 609 | // if a section is set, |
610 | - if ( '_default' !== $_aField['section_id'] ) { |
|
611 | - if ( array_key_exists( $_aField['section_id'], $aOptions ) ) { |
|
612 | - $_aStoredOptionsOfTheTab[ $_aField['section_id'] ] = $aOptions[ $_aField['section_id'] ]; |
|
610 | + if ( '_default' !== $_aField[ 'section_id' ] ) { |
|
611 | + if ( array_key_exists( $_aField[ 'section_id' ], $aOptions ) ) { |
|
612 | + $_aStoredOptionsOfTheTab[ $_aField[ 'section_id' ] ] = $aOptions[ $_aField[ 'section_id' ] ]; |
|
613 | 613 | } |
614 | 614 | continue; |
615 | 615 | } |
616 | 616 | |
617 | 617 | // It does not have a section so set the field id as its key. |
618 | - if ( array_key_exists( $_aField['field_id'], $aOptions ) ) { |
|
619 | - $_aStoredOptionsOfTheTab[ $_aField['field_id'] ] = $aOptions[ $_aField['field_id'] ]; |
|
618 | + if ( array_key_exists( $_aField[ 'field_id' ], $aOptions ) ) { |
|
619 | + $_aStoredOptionsOfTheTab[ $_aField[ 'field_id' ] ] = $aOptions[ $_aField[ 'field_id' ] ]; |
|
620 | 620 | continue; |
621 | 621 | } |
622 | 622 | |
@@ -633,11 +633,11 @@ discard block |
||
633 | 633 | */ |
634 | 634 | private function _isThisSectionSetToThisPage( $_sSectionID, $sPageSlug ) { |
635 | 635 | |
636 | - if ( ! isset( $this->aSections[ $_sSectionID ]['page_slug'] ) ) { |
|
636 | + if ( !isset( $this->aSections[ $_sSectionID ][ 'page_slug' ] ) ) { |
|
637 | 637 | return false; |
638 | 638 | } |
639 | 639 | return ( |
640 | - $sPageSlug === $this->aSections[ $_sSectionID ]['page_slug'] |
|
640 | + $sPageSlug === $this->aSections[ $_sSectionID ][ 'page_slug' ] |
|
641 | 641 | ); |
642 | 642 | } |
643 | 643 | |
@@ -650,14 +650,14 @@ discard block |
||
650 | 650 | */ |
651 | 651 | private function _isThisSectionSetToThisTab( $_sSectionID, $sPageSlug, $sTabSlug ) { |
652 | 652 | |
653 | - if ( ! $this->_isThisSectionSetToThisPage( $_sSectionID, $sPageSlug ) ) { |
|
653 | + if ( !$this->_isThisSectionSetToThisPage( $_sSectionID, $sPageSlug ) ) { |
|
654 | 654 | return false; |
655 | 655 | } |
656 | - if ( ! isset( $this->aSections[ $_sSectionID ]['tab_slug'] ) ) { |
|
656 | + if ( !isset( $this->aSections[ $_sSectionID ][ 'tab_slug' ] ) ) { |
|
657 | 657 | return false; |
658 | 658 | } |
659 | 659 | return ( |
660 | - $sTabSlug === $this->aSections[ $_sSectionID ]['tab_slug'] |
|
660 | + $sTabSlug === $this->aSections[ $_sSectionID ][ 'tab_slug' ] |
|
661 | 661 | ); |
662 | 662 | |
663 | 663 | } |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | * |
76 | 76 | * @since 3.0.0 |
77 | 77 | */ |
78 | - public function getFieldsByPageSlug( $sPageSlug, $sTabSlug='' ) { |
|
78 | + public function getFieldsByPageSlug( $sPageSlug, $sTabSlug='' ) { |
|
79 | 79 | return $this->castArrayContents( |
80 | 80 | $this->getSectionsByPageSlug( $sPageSlug, $sTabSlug ), |
81 | 81 | $this->aFields |
@@ -89,11 +89,11 @@ discard block |
||
89 | 89 | public function getSectionsByPageSlug( $sPageSlug, $sTabSlug='' ) { |
90 | 90 | |
91 | 91 | $_aSections = array(); |
92 | - foreach( $this->aSections as $_sSecitonID => $_aSection ) { |
|
93 | - if ( $sTabSlug && $_aSection['tab_slug'] != $sTabSlug ) { |
|
92 | + foreach( $this->aSections as $_sSecitonID => $_aSection ) { |
|
93 | + if ( $sTabSlug && $_aSection['tab_slug'] != $sTabSlug ) { |
|
94 | 94 | continue; |
95 | 95 | } |
96 | - if ( $_aSection['page_slug'] != $sPageSlug ) { |
|
96 | + if ( $_aSection['page_slug'] != $sPageSlug ) { |
|
97 | 97 | continue; |
98 | 98 | } |
99 | 99 | $_aSections[ $_sSecitonID ] = $_aSection; |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | |
231 | 231 | $_aField = parent::formatField( $aField, $sFieldsType, $sCapability, $iCountOfElements, $iSectionIndex, $bIsSectionRepeatable, $oCallerObject ); |
232 | 232 | |
233 | - if ( ! $_aField ) { |
|
233 | + if ( ! $_aField ) { |
|
234 | 234 | return; |
235 | 235 | } |
236 | 236 | $_aField['option_key'] = $this->sOptionKey; |
@@ -259,16 +259,16 @@ discard block |
||
259 | 259 | if ( ! current_user_can( $aSection['capability'] ) ) { |
260 | 260 | return array(); |
261 | 261 | } |
262 | - if ( ! $aSection['if'] ) { |
|
262 | + if ( ! $aSection['if'] ) { |
|
263 | 263 | return array(); |
264 | 264 | } |
265 | - if ( ! $aSection['page_slug'] ) { |
|
265 | + if ( ! $aSection['page_slug'] ) { |
|
266 | 266 | return array(); |
267 | 267 | } |
268 | - if ( 'options.php' != $this->getPageNow() && $this->sCurrentPageSlug != $aSection['page_slug'] ) { |
|
268 | + if ( 'options.php' != $this->getPageNow() && $this->sCurrentPageSlug != $aSection['page_slug'] ) { |
|
269 | 269 | return array(); |
270 | 270 | } |
271 | - if ( ! $this->_isSectionOfCurrentTab( $aSection, $this->sCurrentPageSlug, $this->sCurrentTabSlug ) ) { |
|
271 | + if ( ! $this->_isSectionOfCurrentTab( $aSection, $this->sCurrentPageSlug, $this->sCurrentTabSlug ) ) { |
|
272 | 272 | return array(); |
273 | 273 | } |
274 | 274 | return $aSection; |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | private function _isSectionOfCurrentTab( array $aSection, $sCurrentPageSlug, $sCurrentTabSlug ) { |
286 | 286 | |
287 | 287 | // Make sure if it's in the loading page. |
288 | - if ( $aSection['page_slug'] != $sCurrentPageSlug ) { |
|
288 | + if ( $aSection['page_slug'] != $sCurrentPageSlug ) { |
|
289 | 289 | return false; |
290 | 290 | } |
291 | 291 | |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | |
373 | 373 | // @todo Examine whether this check can be removed |
374 | 374 | // as the section that hods this field is already checked above outside this loop. |
375 | - if ( $sPageSlug !== $_aField['page_slug'] ) { |
|
375 | + if ( $sPageSlug !== $_aField['page_slug'] ) { |
|
376 | 376 | continue; |
377 | 377 | } |
378 | 378 | |
@@ -440,7 +440,7 @@ discard block |
||
440 | 440 | |
441 | 441 | // @todo Examine whether this check can be removed |
442 | 442 | // as the section that hods this field is already checked above outside the loop. |
443 | - if ( $sPageSlug === $_aField['page_slug'] ) { |
|
443 | + if ( $sPageSlug === $_aField['page_slug'] ) { |
|
444 | 444 | continue; |
445 | 445 | } |
446 | 446 | |
@@ -547,7 +547,7 @@ discard block |
||
547 | 547 | * so that the externally injected options will be respected. |
548 | 548 | * @since 3.0.0 |
549 | 549 | */ |
550 | - public function getTabOptions( $aOptions, $sPageSlug, $sTabSlug='' ) { |
|
550 | + public function getTabOptions( $aOptions, $sPageSlug, $sTabSlug='' ) { |
|
551 | 551 | $_aOtherTabOptions = $this->getOtherTabOptions( $aOptions, $sPageSlug, $sTabSlug ); |
552 | 552 | return $this->invertCastArrayContents( $aOptions, $_aOtherTabOptions ); |
553 | 553 | } |
@@ -564,7 +564,7 @@ discard block |
||
564 | 564 | public function getTabOnlyOptions( array $aOptions, $sPageSlug, $sTabSlug='' ) { |
565 | 565 | |
566 | 566 | $_aStoredOptionsOfTheTab = array(); |
567 | - if ( ! $sTabSlug ) { |
|
567 | + if ( ! $sTabSlug ) { |
|
568 | 568 | return $_aStoredOptionsOfTheTab; |
569 | 569 | } |
570 | 570 |
@@ -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 |
@@ -24,12 +24,12 @@ discard block |
||
24 | 24 | * @static |
25 | 25 | */ |
26 | 26 | static public $aStructure = array( |
27 | - 'src' => null, // (required, string) the source url or path |
|
27 | + 'src' => null, // (required, string) the source url or path |
|
28 | 28 | 'handle_id' => null, |
29 | 29 | 'dependencies' => array(), |
30 | - 'version' => false, // although the type should be string, the wp_enqueue_...() functions want false as the default value. |
|
31 | - 'translation' => array(), // only for scripts |
|
32 | - 'in_footer' => false, // only for scripts |
|
30 | + 'version' => false, // although the type should be string, the wp_enqueue_...() functions want false as the default value. |
|
31 | + 'translation' => array(), // only for scripts |
|
32 | + 'in_footer' => false, // only for scripts |
|
33 | 33 | // 'attributes' => null, // (optional, array) [3.3.0+] attributes array. `array( 'data-id' => '...' )` |
34 | 34 | ); |
35 | 35 | |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | $_aParameters = func_get_args() + array( |
43 | 43 | $this->asSubject, |
44 | 44 | ); |
45 | - $this->asSubject = $_aParameters[ 0 ]; |
|
45 | + $this->asSubject = $_aParameters[ 0 ]; |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |
@@ -24,11 +24,11 @@ discard block |
||
24 | 24 | * @static |
25 | 25 | */ |
26 | 26 | static public $aStructure = array( |
27 | - 'src' => null, // (required, string) the source url or path |
|
28 | - 'handle_id' => null, // (optional, string) The handle ID of the stylesheet |
|
29 | - 'dependencies' => null, // (optional, array) The dependency array. |
|
30 | - 'version' => null, // (optional, string) The stylesheet version number. |
|
31 | - 'media' => null, // (optional, string) the description of the field which is inserted into the after the input field tag. |
|
27 | + 'src' => null, // (required, string) the source url or path |
|
28 | + 'handle_id' => null, // (optional, string) The handle ID of the stylesheet |
|
29 | + 'dependencies' => null, // (optional, array) The dependency array. |
|
30 | + 'version' => null, // (optional, string) The stylesheet version number. |
|
31 | + 'media' => null, // (optional, string) the description of the field which is inserted into the after the input field tag. |
|
32 | 32 | // 'attributes' => null, // (optional, array) [3.3.0+] attributes array. `array( 'data-id' => '...' )` |
33 | 33 | ); |
34 | 34 | |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | $_aParameters = func_get_args() + array( |
42 | 42 | $this->asSubject, |
43 | 43 | ); |
44 | - $this->asSubject = $_aParameters[ 0 ]; |
|
44 | + $this->asSubject = $_aParameters[ 0 ]; |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | /** |
@@ -19,7 +19,6 @@ |
||
19 | 19 | |
20 | 20 | /** |
21 | 21 | * Represents the structure of the sub-field definition array. |
22 | - |
|
23 | 22 | */ |
24 | 23 | static public $aStructure = array( |
25 | 24 | ); |