@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | /** |
24 | 24 | * Defines the field type slugs used for this field type. |
25 | 25 | */ |
26 | - public $aFieldTypeSlugs = array( 'text', 'password', 'date', 'datetime', 'datetime-local', 'email', 'month', 'search', 'tel', 'url', 'week', ); |
|
26 | + public $aFieldTypeSlugs = array( 'text', 'password', 'date', 'datetime', 'datetime-local', 'email', 'month', 'search', 'tel', 'url', 'week',); |
|
27 | 27 | |
28 | 28 | /** |
29 | 29 | * Defines the default key-values of this field type. |
@@ -68,8 +68,8 @@ discard block |
||
68 | 68 | protected function getField( $aField ) { |
69 | 69 | |
70 | 70 | $_aOutput = array(); |
71 | - foreach( ( array ) $aField[ 'label' ] as $_sKey => $_sLabel ) { |
|
72 | - $_aOutput[] = $this->_getFieldOutputByLabel( |
|
71 | + foreach ( ( array ) $aField[ 'label' ] as $_sKey => $_sLabel ) { |
|
72 | + $_aOutput[ ] = $this->_getFieldOutputByLabel( |
|
73 | 73 | $_sKey, |
74 | 74 | $_sLabel, |
75 | 75 | $aField |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | } |
78 | 78 | |
79 | 79 | // the repeatable field buttons will be replaced with this element. |
80 | - $_aOutput[] = "<div class='repeatable-field-buttons'></div>"; |
|
80 | + $_aOutput[ ] = "<div class='repeatable-field-buttons'></div>"; |
|
81 | 81 | return implode( '', $_aOutput ); |
82 | 82 | |
83 | 83 | } |
@@ -96,27 +96,27 @@ discard block |
||
96 | 96 | $aField[ 'value' ] = $this->getElementByLabel( $aField[ 'value' ], $sKey, $_bIsArray ); |
97 | 97 | $_aInputAttributes = $_bIsArray |
98 | 98 | ? array( |
99 | - 'name' => $aField[ 'attributes' ][ 'name' ] . "[{$sKey}]", |
|
100 | - 'id' => $aField[ 'attributes' ][ 'id' ] . "_{$sKey}", |
|
99 | + 'name' => $aField[ 'attributes' ][ 'name' ]."[{$sKey}]", |
|
100 | + 'id' => $aField[ 'attributes' ][ 'id' ]."_{$sKey}", |
|
101 | 101 | 'value' => $aField[ 'value' ], |
102 | 102 | ) |
103 | 103 | + $aField[ 'attributes' ] |
104 | 104 | : $aField[ 'attributes' ]; |
105 | - $_aOutput = array( |
|
106 | - $this->getElementByLabel( $aField['before_label'], $sKey, $_bIsArray ), |
|
105 | + $_aOutput = array( |
|
106 | + $this->getElementByLabel( $aField[ 'before_label' ], $sKey, $_bIsArray ), |
|
107 | 107 | "<div class='admin-page-framework-input-label-container {$_sClassSelector}'>", |
108 | - "<label for='" . $_aInputAttributes[ 'id' ] . "'>", |
|
109 | - $this->getElementByLabel( $aField['before_input'], $sKey, $_bIsArray ), |
|
108 | + "<label for='".$_aInputAttributes[ 'id' ]."'>", |
|
109 | + $this->getElementByLabel( $aField[ 'before_input' ], $sKey, $_bIsArray ), |
|
110 | 110 | $_sLabel |
111 | - ? "<span class='admin-page-framework-input-label-string' style='min-width:" . $this->sanitizeLength( $aField['label_min_width'] ) . ";'>" |
|
111 | + ? "<span class='admin-page-framework-input-label-string' style='min-width:".$this->sanitizeLength( $aField[ 'label_min_width' ] ).";'>" |
|
112 | 112 | . $_sLabel |
113 | 113 | . "</span>" |
114 | 114 | : '', |
115 | - "<input " . $this->getAttributes( $_aInputAttributes ) . " />", |
|
116 | - $this->getElementByLabel( $aField['after_input'], $sKey, $_bIsArray ), |
|
115 | + "<input ".$this->getAttributes( $_aInputAttributes )." />", |
|
116 | + $this->getElementByLabel( $aField[ 'after_input' ], $sKey, $_bIsArray ), |
|
117 | 117 | "</label>", |
118 | 118 | "</div>", |
119 | - $this->getElementByLabel( $aField['after_label'], $sKey, $_bIsArray ), |
|
119 | + $this->getElementByLabel( $aField[ 'after_label' ], $sKey, $_bIsArray ), |
|
120 | 120 | ); |
121 | 121 | return implode( '', $_aOutput ); |
122 | 122 |
@@ -43,7 +43,7 @@ |
||
43 | 43 | * @since 2.1.5 |
44 | 44 | * @since 3.3.1 Changed from `_replyToGetStyles()`. |
45 | 45 | */ |
46 | - protected function getStyles() { |
|
46 | + protected function getStyles() { |
|
47 | 47 | return <<<CSSRULES |
48 | 48 | /* Text Field Type */ |
49 | 49 | .admin-page-framework-field.admin-page-framework-field-text > .admin-page-framework-input-label-container { |
@@ -429,8 +429,8 @@ discard block |
||
429 | 429 | protected function getField( $aField ) { |
430 | 430 | |
431 | 431 | $_aOutput = array(); |
432 | - foreach( ( array ) $aField[ 'label' ] as $_sKey => $_sLabel ) { |
|
433 | - $_aOutput[] = $this->_getFieldOutputByLabel( |
|
432 | + foreach ( ( array ) $aField[ 'label' ] as $_sKey => $_sLabel ) { |
|
433 | + $_aOutput[ ] = $this->_getFieldOutputByLabel( |
|
434 | 434 | $_sKey, |
435 | 435 | $_sLabel, |
436 | 436 | $aField |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | } |
439 | 439 | |
440 | 440 | // the repeatable field buttons will be replaced with this element. |
441 | - $_aOutput[] = "<div class='repeatable-field-buttons'></div>"; |
|
441 | + $_aOutput[ ] = "<div class='repeatable-field-buttons'></div>"; |
|
442 | 442 | return implode( '', $_aOutput ); |
443 | 443 | |
444 | 444 | } |
@@ -457,27 +457,27 @@ discard block |
||
457 | 457 | $aField[ 'rich' ] = $this->getElementByLabel( $aField[ 'rich' ], $sKey, $_bIsArray ); |
458 | 458 | $aField[ 'attributes' ] = $_bIsArray |
459 | 459 | ? array( |
460 | - 'name' => $aField[ 'attributes' ][ 'name' ] . "[{$sKey}]", |
|
461 | - 'id' => $aField[ 'attributes' ][ 'id' ] . "_{$sKey}", |
|
460 | + 'name' => $aField[ 'attributes' ][ 'name' ]."[{$sKey}]", |
|
461 | + 'id' => $aField[ 'attributes' ][ 'id' ]."_{$sKey}", |
|
462 | 462 | 'value' => $aField[ 'value' ], |
463 | 463 | ) |
464 | 464 | + $aField[ 'attributes' ] |
465 | 465 | : $aField[ 'attributes' ]; |
466 | - $_aOutput = array( |
|
467 | - $this->getElementByLabel( $aField['before_label'], $sKey, $_bIsArray ), |
|
466 | + $_aOutput = array( |
|
467 | + $this->getElementByLabel( $aField[ 'before_label' ], $sKey, $_bIsArray ), |
|
468 | 468 | "<div class='admin-page-framework-input-label-container {$_sClassSelector}'>", |
469 | - "<label for='" . $aField[ 'attributes' ][ 'id' ] . "'>", |
|
470 | - $this->getElementByLabel( $aField['before_input'], $sKey, $_bIsArray ), |
|
469 | + "<label for='".$aField[ 'attributes' ][ 'id' ]."'>", |
|
470 | + $this->getElementByLabel( $aField[ 'before_input' ], $sKey, $_bIsArray ), |
|
471 | 471 | $_sLabel |
472 | - ? "<span class='admin-page-framework-input-label-string' style='min-width:" . $this->sanitizeLength( $aField['label_min_width'] ) . ";'>" |
|
472 | + ? "<span class='admin-page-framework-input-label-string' style='min-width:".$this->sanitizeLength( $aField[ 'label_min_width' ] ).";'>" |
|
473 | 473 | . $_sLabel |
474 | 474 | . "</span>" |
475 | 475 | : '', |
476 | 476 | $this->_getEditor( $aField ), |
477 | - $this->getElementByLabel( $aField['after_input'], $sKey, $_bIsArray ), |
|
477 | + $this->getElementByLabel( $aField[ 'after_input' ], $sKey, $_bIsArray ), |
|
478 | 478 | "</label>", |
479 | 479 | "</div>", |
480 | - $this->getElementByLabel( $aField['after_label'], $sKey, $_bIsArray ), |
|
480 | + $this->getElementByLabel( $aField[ 'after_label' ], $sKey, $_bIsArray ), |
|
481 | 481 | ); |
482 | 482 | return implode( '', $_aOutput ); |
483 | 483 | |
@@ -490,31 +490,31 @@ discard block |
||
490 | 490 | */ |
491 | 491 | private function _getEditor( $aField ) { |
492 | 492 | |
493 | - unset( $aField['attributes']['value'] ); |
|
493 | + unset( $aField[ 'attributes' ][ 'value' ] ); |
|
494 | 494 | |
495 | 495 | // For no TinyMCE |
496 | - if ( empty( $aField['rich'] ) || ! $this->isTinyMCESupported() ) { |
|
497 | - return "<textarea " . $this->getAttributes( $aField['attributes'] ) . " >" // this method is defined in the base class |
|
498 | - . esc_textarea( $aField['value'] ) |
|
496 | + if ( empty( $aField[ 'rich' ] ) || !$this->isTinyMCESupported() ) { |
|
497 | + return "<textarea ".$this->getAttributes( $aField[ 'attributes' ] )." >" // this method is defined in the base class |
|
498 | + . esc_textarea( $aField[ 'value' ] ) |
|
499 | 499 | . "</textarea>"; |
500 | 500 | } |
501 | 501 | |
502 | 502 | // Rich editor |
503 | 503 | ob_start(); |
504 | 504 | wp_editor( |
505 | - $aField['value'], |
|
506 | - $aField['attributes']['id'], |
|
505 | + $aField[ 'value' ], |
|
506 | + $aField[ 'attributes' ][ 'id' ], |
|
507 | 507 | $this->uniteArrays( |
508 | - ( array ) $aField['rich'], |
|
508 | + ( array ) $aField[ 'rich' ], |
|
509 | 509 | array( |
510 | 510 | 'wpautop' => true, // use wpautop? |
511 | 511 | 'media_buttons' => true, // show insert/upload button(s) |
512 | - 'textarea_name' => $aField['attributes']['name'], |
|
513 | - 'textarea_rows' => $aField['attributes']['rows'], |
|
512 | + 'textarea_name' => $aField[ 'attributes' ][ 'name' ], |
|
513 | + 'textarea_rows' => $aField[ 'attributes' ][ 'rows' ], |
|
514 | 514 | 'tabindex' => '', |
515 | 515 | 'tabfocus_elements' => ':prev,:next', // the previous and next element ID to move the focus to when pressing the Tab key in TinyMCE |
516 | 516 | 'editor_css' => '', // intended for extra styles for both visual and Text editors buttons, needs to include the <style> tags, can use "scoped". |
517 | - 'editor_class' => $aField['attributes']['class'], // add extra class(es) to the editor textarea |
|
517 | + 'editor_class' => $aField[ 'attributes' ][ 'class' ], // add extra class(es) to the editor textarea |
|
518 | 518 | 'teeny' => false, // output the minimal editor config used in Press This |
519 | 519 | 'dfw' => false, // replace the default fullscreen with DFW (needs specific DOM elements and css) |
520 | 520 | 'tinymce' => true, // load TinyMCE, can be used to pass settings directly to TinyMCE using an array() |
@@ -526,7 +526,7 @@ discard block |
||
526 | 526 | ob_end_clean(); |
527 | 527 | |
528 | 528 | return $_sContent |
529 | - . $this->_getScriptForRichEditor( $aField['attributes']['id'] ); |
|
529 | + . $this->_getScriptForRichEditor( $aField[ 'attributes' ][ 'id' ] ); |
|
530 | 530 | |
531 | 531 | } |
532 | 532 |
@@ -63,15 +63,15 @@ discard block |
||
63 | 63 | * - use_desc_for_title (boolean|int) default is 1 - Whether to use the category description as the title attribute. side note: the framework enables this by default. |
64 | 64 | * @param integer $iCurrentObjectID |
65 | 65 | */ |
66 | - function start_el( &$sOutput, $oTerm, $iDepth=0, $aArgs=array(), $iCurrentObjectID=0 ) { |
|
66 | + function start_el( &$sOutput, $oTerm, $iDepth = 0, $aArgs = array(), $iCurrentObjectID = 0 ) { |
|
67 | 67 | |
68 | 68 | $aArgs = $aArgs + array( |
69 | 69 | '_name_prefix' => null, |
70 | 70 | '_input_id_prefix' => null, |
71 | 71 | '_attributes' => array(), |
72 | 72 | '_selected_items' => array(), |
73 | - 'taxonomy' => null, // parsed by the core function to perform the database query. |
|
74 | - 'disabled' => null, // not sure what this was for |
|
73 | + 'taxonomy' => null, // parsed by the core function to perform the database query. |
|
74 | + 'disabled' => null, // not sure what this was for |
|
75 | 75 | ); |
76 | 76 | |
77 | 77 | // Local variables |
@@ -79,22 +79,22 @@ discard block |
||
79 | 79 | $_sTaxonomySlug = empty( $aArgs[ 'taxonomy' ] ) |
80 | 80 | ? 'category' |
81 | 81 | : $aArgs[ 'taxonomy' ]; |
82 | - $_sID = "{$aArgs['_input_id_prefix']}_{$_sTaxonomySlug}_{$_iID}"; |
|
82 | + $_sID = "{$aArgs[ '_input_id_prefix' ]}_{$_sTaxonomySlug}_{$_iID}"; |
|
83 | 83 | |
84 | 84 | // Post count |
85 | - $_sPostCount = $aArgs['show_post_count'] |
|
86 | - ? " <span class='font-lighter'>(" . $oTerm->count . ")</span>" |
|
85 | + $_sPostCount = $aArgs[ 'show_post_count' ] |
|
86 | + ? " <span class='font-lighter'>(".$oTerm->count.")</span>" |
|
87 | 87 | : ''; |
88 | 88 | |
89 | 89 | // Attributes |
90 | 90 | $_aInputAttributes = isset( $_aInputAttributes[ $_iID ] ) |
91 | - ? $_aInputAttributes[ $_iID ] + $aArgs['_attributes'] |
|
92 | - : $aArgs['_attributes']; |
|
91 | + ? $_aInputAttributes[ $_iID ] + $aArgs[ '_attributes' ] |
|
92 | + : $aArgs[ '_attributes' ]; |
|
93 | 93 | $_aInputAttributes = array( |
94 | 94 | 'id' => $_sID, |
95 | 95 | 'value' => 1, // must be 1 because the index of zero exists so the index value cannot be assigned here. |
96 | 96 | 'type' => 'checkbox', |
97 | - 'name' => "{$aArgs['_name_prefix']}[{$_iID}]", |
|
97 | + 'name' => "{$aArgs[ '_name_prefix' ]}[{$_iID}]", |
|
98 | 98 | 'checked' => in_array( $_iID, ( array ) $aArgs[ '_selected_items' ] ) |
99 | 99 | ? 'checked' |
100 | 100 | : null, |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | + array( |
103 | 103 | 'class' => null, |
104 | 104 | ); |
105 | - $_aInputAttributes['class'] .= ' apf_checkbox'; |
|
105 | + $_aInputAttributes[ 'class' ] .= ' apf_checkbox'; |
|
106 | 106 | |
107 | 107 | $_aLiTagAttributes = array( |
108 | 108 | 'id' => "list-{$_sID}", |
@@ -112,10 +112,10 @@ discard block |
||
112 | 112 | |
113 | 113 | // Output - the variable is by reference so the modification takes effect |
114 | 114 | $sOutput .= "\n" |
115 | - . "<li " . AdminPageFramework_WPUtility::getAttributes( $_aLiTagAttributes ) . ">" |
|
115 | + . "<li ".AdminPageFramework_WPUtility::getAttributes( $_aLiTagAttributes ).">" |
|
116 | 116 | . "<label for='{$_sID}' class='taxonomy-checklist-label'>" |
117 | - . "<input value='0' type='hidden' name='" . $_aInputAttributes[ 'name' ] . "' class='apf_checkbox' />" |
|
118 | - . "<input " . AdminPageFramework_WPUtility::getAttributes( $_aInputAttributes ) . " />" |
|
117 | + . "<input value='0' type='hidden' name='".$_aInputAttributes[ 'name' ]."' class='apf_checkbox' />" |
|
118 | + . "<input ".AdminPageFramework_WPUtility::getAttributes( $_aInputAttributes )." />" |
|
119 | 119 | . esc_html( apply_filters( 'the_category', $oTerm->name ) ) |
120 | 120 | . $_sPostCount |
121 | 121 | . "</label>"; |
@@ -32,14 +32,14 @@ discard block |
||
32 | 32 | * @param string $sType If empty, the method will check if a message exists in all types. Otherwise, it checks the existence of a message of the specified type. |
33 | 33 | * @return boolean True if a setting notice is set; otherwise, false. |
34 | 34 | */ |
35 | - public function hasNotice( $sType='' ) { |
|
35 | + public function hasNotice( $sType = '' ) { |
|
36 | 36 | |
37 | - if ( ! $sType ) { |
|
37 | + if ( !$sType ) { |
|
38 | 38 | return ( bool ) count( self::$_aNotices ); |
39 | 39 | } |
40 | 40 | |
41 | 41 | // Check if there is a message of the type. |
42 | - foreach( self::$_aNotices as $_aNotice ) { |
|
42 | + foreach ( self::$_aNotices as $_aNotice ) { |
|
43 | 43 | $_sClassAttribute = $this->getElement( |
44 | 44 | $_aNotice, |
45 | 45 | array( |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | * @param boolean $bOverride (optional) If true, only one message will be shown in the next page load. false: do not override when there is a message of the same id. true: override the previous one. |
79 | 79 | * @return void |
80 | 80 | */ |
81 | - public function set( $sMessage, $sType='error', $asAttributes=array(), $bOverride=true ) { |
|
81 | + public function set( $sMessage, $sType = 'error', $asAttributes = array(), $bOverride = true ) { |
|
82 | 82 | |
83 | 83 | // If the array is empty, shecule the task of saving the array at shutdown. |
84 | 84 | if ( empty( self::$_aNotices ) ) { |
@@ -88,19 +88,19 @@ discard block |
||
88 | 88 | $_sID = md5( trim( $sMessage ) ); |
89 | 89 | |
90 | 90 | // If the override is false and a message is already set, do not add. |
91 | - if ( ! $bOverride && isset( self::$_aNotices[ $_sID ] ) ) { |
|
91 | + if ( !$bOverride && isset( self::$_aNotices[ $_sID ] ) ) { |
|
92 | 92 | return; |
93 | 93 | } |
94 | 94 | |
95 | 95 | $_aAttributes = $this->getAsArray( $asAttributes ); |
96 | - if ( is_string( $asAttributes ) && ! empty( $asAttributes ) ) { |
|
96 | + if ( is_string( $asAttributes ) && !empty( $asAttributes ) ) { |
|
97 | 97 | $_aAttributes[ 'id' ] = $asAttributes; |
98 | 98 | } |
99 | 99 | self::$_aNotices[ $_sID ] = array( |
100 | 100 | 'sMessage' => $sMessage, |
101 | 101 | 'aAttributes' => $_aAttributes + array( |
102 | 102 | 'class' => $sType, |
103 | - 'id' => 'form_submit_notice_' . $_sID, |
|
103 | + 'id' => 'form_submit_notice_'.$_sID, |
|
104 | 104 | ), |
105 | 105 | ); |
106 | 106 | |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | return; |
121 | 121 | } |
122 | 122 | $this->setTransient( |
123 | - 'apf_notices_' . get_current_user_id(), |
|
123 | + 'apf_notices_'.get_current_user_id(), |
|
124 | 124 | self::$_aNotices |
125 | 125 | ); |
126 | 126 | } |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | $this->deleteTransient( "apf_notices_{$_iUserID}" ); |
143 | 143 | |
144 | 144 | // By setting false to the 'settings-notice' key, it's possible to disable the notifications set with the framework. |
145 | - if ( isset( $_GET[ 'settings-notice' ] ) && ! $_GET[ 'settings-notice' ] ) { |
|
145 | + if ( isset( $_GET[ 'settings-notice' ] ) && !$_GET[ 'settings-notice' ] ) { |
|
146 | 146 | return; |
147 | 147 | } |
148 | 148 |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | * @return void |
117 | 117 | */ |
118 | 118 | public function _replyToSaveNotices() { |
119 | - if ( empty( self::$_aNotices ) ) { |
|
119 | + if ( empty( self::$_aNotices ) ) { |
|
120 | 120 | return; |
121 | 121 | } |
122 | 122 | $this->setTransient( |
@@ -136,13 +136,13 @@ discard block |
||
136 | 136 | |
137 | 137 | $_iUserID = get_current_user_id(); |
138 | 138 | $_aNotices = $this->getTransient( "apf_notices_{$_iUserID}" ); |
139 | - if ( false === $_aNotices ) { |
|
139 | + if ( false === $_aNotices ) { |
|
140 | 140 | return; |
141 | 141 | } |
142 | 142 | $this->deleteTransient( "apf_notices_{$_iUserID}" ); |
143 | 143 | |
144 | 144 | // By setting false to the 'settings-notice' key, it's possible to disable the notifications set with the framework. |
145 | - if ( isset( $_GET[ 'settings-notice' ] ) && ! $_GET[ 'settings-notice' ] ) { |
|
145 | + if ( isset( $_GET[ 'settings-notice' ] ) && ! $_GET[ 'settings-notice' ] ) { |
|
146 | 146 | return; |
147 | 147 | } |
148 | 148 |
@@ -21,12 +21,12 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @since 3.6.0 |
23 | 23 | */ |
24 | - public $aData = array(); |
|
24 | + public $aData = array(); |
|
25 | 25 | |
26 | 26 | /** |
27 | 27 | * Stores the defaulte values. |
28 | 28 | */ |
29 | - public $aDefault = array(); |
|
29 | + public $aDefault = array(); |
|
30 | 30 | |
31 | 31 | /** |
32 | 32 | * Sets up properties. |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | $_aKeys = func_get_args() + array( null ); |
55 | 55 | |
56 | 56 | // If no key is specified, return the whole array. |
57 | - if ( ! isset( $_aKeys[ 0 ] ) ) { |
|
57 | + if ( !isset( $_aKeys[ 0 ] ) ) { |
|
58 | 58 | return $this->uniteArrays( |
59 | 59 | $this->aData, |
60 | 60 | $this->aDefault |
@@ -69,8 +69,8 @@ discard block |
||
69 | 69 | |
70 | 70 | // Now either the section ID or field ID is given. |
71 | 71 | return $this->getArrayValueByArrayKeys( |
72 | - $this->aData, // subject array |
|
73 | - $_aKeys, // dimensional keys |
|
72 | + $this->aData, // subject array |
|
73 | + $_aKeys, // dimensional keys |
|
74 | 74 | $this->getDefaultValue( // default value |
75 | 75 | $_mDefault, |
76 | 76 | $_aKeys |
@@ -98,8 +98,8 @@ discard block |
||
98 | 98 | */ |
99 | 99 | public function set( /* $asKeys, $mValue */ ) { |
100 | 100 | |
101 | - $_aParameters = func_get_args(); |
|
102 | - if ( ! isset( $_aParameters[ 0 ], $_aParameters[ 1 ] ) ) { |
|
101 | + $_aParameters = func_get_args(); |
|
102 | + if ( !isset( $_aParameters[ 0 ], $_aParameters[ 1 ] ) ) { |
|
103 | 103 | return; |
104 | 104 | } |
105 | 105 | $_asKeys = $_aParameters[ 0 ]; |
@@ -123,8 +123,8 @@ discard block |
||
123 | 123 | */ |
124 | 124 | public function delete( /* $sKey1, $sKey2, $sKey3 ... OR $aKeys */ ) { |
125 | 125 | |
126 | - $_aParameters = func_get_args(); |
|
127 | - if ( ! isset( $_aParameters[ 0 ], $_aParameters[ 1 ] ) ) { |
|
126 | + $_aParameters = func_get_args(); |
|
127 | + if ( !isset( $_aParameters[ 0 ], $_aParameters[ 1 ] ) ) { |
|
128 | 128 | return; |
129 | 129 | } |
130 | 130 | $_asKeys = $_aParameters[ 0 ]; |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | * @remark An alias of the dumpArray() method. |
27 | 27 | * @since 3.2.0 |
28 | 28 | */ |
29 | - static public function dump( $asArray, $sFilePath=null ) { |
|
29 | + static public function dump( $asArray, $sFilePath = null ) { |
|
30 | 30 | echo self::get( $asArray, $sFilePath ); |
31 | 31 | } |
32 | 32 | /** |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | * @since unknown |
38 | 38 | * @deprecated 3.2.0 |
39 | 39 | */ |
40 | - static public function dumpArray( $asArray, $sFilePath=null ) { |
|
40 | + static public function dumpArray( $asArray, $sFilePath = null ) { |
|
41 | 41 | self::dump( $asArray, $sFilePath ); |
42 | 42 | } |
43 | 43 | |
@@ -49,12 +49,12 @@ discard block |
||
49 | 49 | * @remark An alias of getArray() method. |
50 | 50 | * @since 3.2.0 |
51 | 51 | */ |
52 | - static public function get( $asArray, $sFilePath=null, $bEscape=true ) { |
|
52 | + static public function get( $asArray, $sFilePath = null, $bEscape = true ) { |
|
53 | 53 | |
54 | 54 | if ( $sFilePath ) self::log( $asArray, $sFilePath ); |
55 | 55 | |
56 | 56 | return $bEscape |
57 | - ? "<pre class='dump-array'>" . htmlspecialchars( self::getAsString( $asArray ) ) . "</pre>" // esc_html() has a bug that breaks with complex HTML code. |
|
57 | + ? "<pre class='dump-array'>".htmlspecialchars( self::getAsString( $asArray ) )."</pre>" // esc_html() has a bug that breaks with complex HTML code. |
|
58 | 58 | : self::getAsString( $asArray ); // non-escape is used for exporting data into file. |
59 | 59 | |
60 | 60 | } |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | * @since 3.0.0 Changed the $bEncloseInTag parameter to bEscape. |
68 | 68 | * @deprecated` 3.2.0 |
69 | 69 | */ |
70 | - static public function getArray( $asArray, $sFilePath=null, $bEscape=true ) { |
|
70 | + static public function getArray( $asArray, $sFilePath = null, $bEscape = true ) { |
|
71 | 71 | return self::get( $asArray, $sFilePath, $bEscape ); |
72 | 72 | } |
73 | 73 | |
@@ -83,18 +83,18 @@ discard block |
||
83 | 83 | * @param string $sFilePath The log file path. |
84 | 84 | * @return void |
85 | 85 | **/ |
86 | - static public function log( $mValue, $sFilePath=null ) { |
|
86 | + static public function log( $mValue, $sFilePath = null ) { |
|
87 | 87 | |
88 | 88 | static $_fPreviousTimeStamp = 0; |
89 | 89 | |
90 | 90 | $_oCallerInfo = debug_backtrace(); |
91 | 91 | $_sCallerFunction = self::getElement( |
92 | - $_oCallerInfo, // subject array |
|
92 | + $_oCallerInfo, // subject array |
|
93 | 93 | array( 1, 'function' ), // key |
94 | 94 | '' // default |
95 | 95 | ); |
96 | - $_sCallerClass = self::getElement( |
|
97 | - $_oCallerInfo, // subject array |
|
96 | + $_sCallerClass = self::getElement( |
|
97 | + $_oCallerInfo, // subject array |
|
98 | 98 | array( 1, 'class' ), // key |
99 | 99 | '' // default |
100 | 100 | ); |
@@ -104,10 +104,10 @@ discard block |
||
104 | 104 | self::_getLogFilePath( $sFilePath, $_sCallerClass ), |
105 | 105 | self::_getLogHeadingLine( |
106 | 106 | $_fCurrentTimeStamp, |
107 | - round( $_fCurrentTimeStamp - $_fPreviousTimeStamp, 3 ), // elapsed time |
|
107 | + round( $_fCurrentTimeStamp - $_fPreviousTimeStamp, 3 ), // elapsed time |
|
108 | 108 | $_sCallerClass, |
109 | 109 | $_sCallerFunction |
110 | - ) . PHP_EOL |
|
110 | + ).PHP_EOL |
|
111 | 111 | . self::_getLogContents( $mValue ), |
112 | 112 | FILE_APPEND |
113 | 113 | ); |
@@ -127,9 +127,9 @@ discard block |
||
127 | 127 | return $sFilePath; |
128 | 128 | } |
129 | 129 | if ( true === $sFilePath ) { |
130 | - return WP_CONTENT_DIR . DIRECTORY_SEPARATOR . get_class() . '_' . date( "Ymd" ) . '.log'; |
|
130 | + return WP_CONTENT_DIR.DIRECTORY_SEPARATOR.get_class().'_'.date( "Ymd" ).'.log'; |
|
131 | 131 | } |
132 | - return WP_CONTENT_DIR . DIRECTORY_SEPARATOR . get_class() . '_' . $sCallerClass . '_' . date( "Ymd" ) . '.log'; |
|
132 | + return WP_CONTENT_DIR.DIRECTORY_SEPARATOR.get_class().'_'.$sCallerClass.'_'.date( "Ymd" ).'.log'; |
|
133 | 133 | |
134 | 134 | } |
135 | 135 | /** |
@@ -144,10 +144,10 @@ discard block |
||
144 | 144 | $_iLengths = self::_getValueLength( $mValue, $_sType ); |
145 | 145 | return '(' |
146 | 146 | . $_sType |
147 | - . ( null !== $_iLengths ? ', length: ' . $_iLengths : '' ) |
|
147 | + . ( null !== $_iLengths ? ', length: '.$_iLengths : '' ) |
|
148 | 148 | . ') ' |
149 | 149 | . self::getAsString( $mValue ) |
150 | - . PHP_EOL . PHP_EOL; |
|
150 | + . PHP_EOL.PHP_EOL; |
|
151 | 151 | |
152 | 152 | } |
153 | 153 | /** |
@@ -188,11 +188,11 @@ discard block |
||
188 | 188 | $_nMicroseconds = str_pad( round( ( $_nNow - floor( $_nNow ) ) * 10000 ), 4, '0' ); |
189 | 189 | |
190 | 190 | $_aOutput = array( |
191 | - date( "Y/m/d H:i:s", $_nNow ) . '.' . $_nMicroseconds, |
|
191 | + date( "Y/m/d H:i:s", $_nNow ).'.'.$_nMicroseconds, |
|
192 | 192 | self::_getFormattedElapsedTime( $nElapsed ), |
193 | 193 | $_iPageLoadID, |
194 | 194 | AdminPageFramework_Registry::getVersion(), |
195 | - $sCallerClass . '::' . $sCallerFunction, |
|
195 | + $sCallerClass.'::'.$sCallerFunction, |
|
196 | 196 | current_filter(), |
197 | 197 | self::getCurrentURL(), |
198 | 198 | ); |
@@ -210,22 +210,22 @@ discard block |
||
210 | 210 | $_aElapsedParts = explode( ".", ( string ) $nElapsed ); |
211 | 211 | $_sElapsedFloat = str_pad( |
212 | 212 | self::getElement( |
213 | - $_aElapsedParts, // subject array |
|
213 | + $_aElapsedParts, // subject array |
|
214 | 214 | 1, // key |
215 | 215 | 0 // default |
216 | 216 | ), |
217 | 217 | 3, |
218 | 218 | '0' |
219 | 219 | ); |
220 | - $_sElapsed = self::getElement( |
|
221 | - $_aElapsedParts, // subject array |
|
222 | - 0, // key |
|
220 | + $_sElapsed = self::getElement( |
|
221 | + $_aElapsedParts, // subject array |
|
222 | + 0, // key |
|
223 | 223 | 0 // default |
224 | 224 | ); |
225 | - $_sElapsed = strlen( $_sElapsed ) > 1 |
|
226 | - ? '+' . substr( $_sElapsed, -1, 2 ) |
|
227 | - : ' ' . $_sElapsed; |
|
228 | - return $_sElapsed . '.' . $_sElapsedFloat; |
|
225 | + $_sElapsed = strlen( $_sElapsed ) > 1 |
|
226 | + ? '+'.substr( $_sElapsed, -1, 2 ) |
|
227 | + : ' '.$_sElapsed; |
|
228 | + return $_sElapsed.'.'.$_sElapsedFloat; |
|
229 | 229 | |
230 | 230 | } |
231 | 231 | /** |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | * @since 3.0.3 Changed the default log location and file name. |
236 | 236 | * @deprecated 3.1.0 Use the `log()` method instead. |
237 | 237 | */ |
238 | - static public function logArray( $asArray, $sFilePath=null ) { |
|
238 | + static public function logArray( $asArray, $sFilePath = null ) { |
|
239 | 239 | self::log( $asArray, $sFilePath ); |
240 | 240 | } |
241 | 241 | |
@@ -265,13 +265,13 @@ discard block |
||
265 | 265 | * |
266 | 266 | * @since 3.4.4 |
267 | 267 | */ |
268 | - static public function getSliceByDepth( array $aSubject, $iDepth=0 ) { |
|
268 | + static public function getSliceByDepth( array $aSubject, $iDepth = 0 ) { |
|
269 | 269 | |
270 | 270 | foreach ( $aSubject as $_sKey => $_vValue ) { |
271 | 271 | if ( is_object( $_vValue ) ) { |
272 | 272 | $aSubject[ $_sKey ] = method_exists( $_vValue, '__toString' ) |
273 | 273 | ? ( string ) $_vValue // cast string |
274 | - : get_object_vars( $_vValue ); // convert it to array. |
|
274 | + : get_object_vars( $_vValue ); // convert it to array. |
|
275 | 275 | } |
276 | 276 | if ( is_array( $_vValue ) ) { |
277 | 277 | $_iDepth = $iDepth; |
@@ -51,7 +51,9 @@ |
||
51 | 51 | */ |
52 | 52 | static public function get( $asArray, $sFilePath=null, $bEscape=true ) { |
53 | 53 | |
54 | - if ( $sFilePath ) self::log( $asArray, $sFilePath ); |
|
54 | + if ( $sFilePath ) { |
|
55 | + self::log( $asArray, $sFilePath ); |
|
56 | + } |
|
55 | 57 | |
56 | 58 | return $bEscape |
57 | 59 | ? "<pre class='dump-array'>" . htmlspecialchars( self::getAsString( $asArray ) ) . "</pre>" // esc_html() has a bug that breaks with complex HTML code. |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | |
39 | 39 | private $_iLevel; |
40 | 40 | |
41 | - public function __construct( $iLevel=null ) { |
|
41 | + public function __construct( $iLevel = null ) { |
|
42 | 42 | $this->_iLevel = null !== $iLevel |
43 | 43 | ? $iLeevl |
44 | 44 | : error_reporting(); |
@@ -57,11 +57,11 @@ discard block |
||
57 | 57 | private function _getIncluded() { |
58 | 58 | |
59 | 59 | $_aIncluded = array(); |
60 | - foreach( $this->_aLevels as $_iLevel => $iLevelText ) { |
|
60 | + foreach ( $this->_aLevels as $_iLevel => $iLevelText ) { |
|
61 | 61 | |
62 | 62 | // This is where we check if a level was used or not |
63 | 63 | if ( $this->_iLevel & $_iLevel ) { |
64 | - $_aIncluded[] = $_iLevel; |
|
64 | + $_aIncluded[ ] = $_iLevel; |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | } |
@@ -75,16 +75,16 @@ discard block |
||
75 | 75 | $_aValues = array(); |
76 | 76 | |
77 | 77 | if ( count( $aIncluded ) > $_iAll / 2 ) { |
78 | - $_aValues[] = 'E_ALL'; |
|
79 | - foreach( $this->_aLevels as $_iLevel => $iLevelText ) { |
|
80 | - if ( ! in_array( $_iLevel, $aIncluded ) ) { |
|
81 | - $_aValues[] = $iLevelText; |
|
78 | + $_aValues[ ] = 'E_ALL'; |
|
79 | + foreach ( $this->_aLevels as $_iLevel => $iLevelText ) { |
|
80 | + if ( !in_array( $_iLevel, $aIncluded ) ) { |
|
81 | + $_aValues[ ] = $iLevelText; |
|
82 | 82 | } |
83 | 83 | } |
84 | 84 | return implode( ' & ~', $_aValues ); |
85 | 85 | } |
86 | - foreach( $aIncluded as $_iLevel ) { |
|
87 | - $_aValues[] = $this->_aLevels[ $_iLevel ]; |
|
86 | + foreach ( $aIncluded as $_iLevel ) { |
|
87 | + $_aValues[ ] = $this->_aLevels[ $_iLevel ]; |
|
88 | 88 | } |
89 | 89 | return implode( ' | ', $_aValues ); |
90 | 90 |
@@ -32,16 +32,16 @@ discard block |
||
32 | 32 | * @since 3.5.3 Moved from `AdminPageFramework_Utility_Array`. |
33 | 33 | * @deprecated 3.5.3 Use `getElement()`. |
34 | 34 | */ |
35 | - public static function getCorrespondingArrayValue( $vSubject, $sKey, $sDefault='', $bBlankToDefault=false ) { |
|
35 | + public static function getCorrespondingArrayValue( $vSubject, $sKey, $sDefault = '', $bBlankToDefault = false ) { |
|
36 | 36 | |
37 | 37 | // If $vSubject is null, |
38 | - if ( ! isset( $vSubject ) ) { return $sDefault; } |
|
38 | + if ( !isset( $vSubject ) ) { return $sDefault; } |
|
39 | 39 | |
40 | 40 | // If the $bBlankToDefault flag is set and the subject value is a blank string, return the default value. |
41 | 41 | if ( $bBlankToDefault && $vSubject == '' ) { return $sDefault; } |
42 | 42 | |
43 | 43 | // If $vSubject is not an array, |
44 | - if ( ! is_array( $vSubject ) ) { return ( string ) $vSubject; } // consider it as string. |
|
44 | + if ( !is_array( $vSubject ) ) { return ( string ) $vSubject; } // consider it as string. |
|
45 | 45 | |
46 | 46 | // Consider $vSubject as array. |
47 | 47 | if ( isset( $vSubject[ $sKey ] ) ) { return $vSubject[ $sKey ]; } |
@@ -86,9 +86,9 @@ discard block |
||
86 | 86 | * @since 3.5.3 Moved from `AdminPageFramework_FieldType_Base`. |
87 | 87 | * @deprecated 3.5.3 Use the `getElement()` method. |
88 | 88 | */ |
89 | - protected function getFieldElementByKey( $asElement, $sKey, $asDefault='' ) { |
|
89 | + protected function getFieldElementByKey( $asElement, $sKey, $asDefault = '' ) { |
|
90 | 90 | |
91 | - if ( ! is_array( $asElement ) || ! isset( $sKey ) ) { return $asElement; } |
|
91 | + if ( !is_array( $asElement ) || !isset( $sKey ) ) { return $asElement; } |
|
92 | 92 | |
93 | 93 | $aElements = &$asElement; // it is an array |
94 | 94 | return isset( $aElements[ $sKey ] ) |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | */ |
108 | 108 | static public function shiftTillTrue( array $aArray ) { |
109 | 109 | |
110 | - foreach( $aArray as &$vElem ) { |
|
110 | + foreach ( $aArray as &$vElem ) { |
|
111 | 111 | |
112 | 112 | if ( $vElem ) { break; } |
113 | 113 | unset( $vElem ); |
@@ -139,15 +139,15 @@ discard block |
||
139 | 139 | */ |
140 | 140 | static public function getAttributes( array $aAttributes ) { |
141 | 141 | |
142 | - $_sQuoteCharactor ="'"; |
|
142 | + $_sQuoteCharactor = "'"; |
|
143 | 143 | $_aOutput = array(); |
144 | - foreach( $aAttributes as $sAttribute => $sProperty ) { |
|
144 | + foreach ( $aAttributes as $sAttribute => $sProperty ) { |
|
145 | 145 | |
146 | 146 | // Must be resolved as a string. |
147 | 147 | if ( in_array( gettype( $sProperty ), array( 'array', 'object' ) ) ) { |
148 | 148 | continue; |
149 | 149 | } |
150 | - $_aOutput[] = "{$sAttribute}={$_sQuoteCharactor}{$sProperty}{$_sQuoteCharactor}"; |
|
150 | + $_aOutput[ ] = "{$sAttribute}={$_sQuoteCharactor}{$sProperty}{$_sQuoteCharactor}"; |
|
151 | 151 | |
152 | 152 | } |
153 | 153 | return implode( ' ', $_aOutput ); |
@@ -32,7 +32,7 @@ |
||
32 | 32 | * @since 3.5.3 Moved from `AdminPageFramework_Utility_Array`. |
33 | 33 | * @deprecated 3.5.3 Use `getElement()`. |
34 | 34 | */ |
35 | - public static function getCorrespondingArrayValue( $vSubject, $sKey, $sDefault='', $bBlankToDefault=false ) { |
|
35 | + public static function getCorrespondingArrayValue( $vSubject, $sKey, $sDefault='', $bBlankToDefault=false ) { |
|
36 | 36 | |
37 | 37 | // If $vSubject is null, |
38 | 38 | if ( ! isset( $vSubject ) ) { return $sDefault; } |
@@ -28,10 +28,10 @@ discard block |
||
28 | 28 | * @param integer $iLines The number of lines to read. |
29 | 29 | * @return string |
30 | 30 | */ |
31 | - static public function getFileTailContents( $asPath=array(), $iLines=1 ) { |
|
31 | + static public function getFileTailContents( $asPath = array(), $iLines = 1 ) { |
|
32 | 32 | |
33 | - $_sPath = self::_getFirstItem( $asPath ); |
|
34 | - if ( ! @is_readable( $_sPath ) ) { |
|
33 | + $_sPath = self::_getFirstItem( $asPath ); |
|
34 | + if ( !@is_readable( $_sPath ) ) { |
|
35 | 35 | return ''; |
36 | 36 | } |
37 | 37 | return trim( |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | * @since 3.4.6 |
62 | 62 | * @return string |
63 | 63 | */ |
64 | - static public function sanitizeFileName( $sFileName, $sReplacement='_' ) { |
|
64 | + static public function sanitizeFileName( $sFileName, $sReplacement = '_' ) { |
|
65 | 65 | |
66 | 66 | // Remove anything which isn't a word, white space, number |
67 | 67 | // or any of the following characters -_~,;:[](). |