@@ -77,6 +77,8 @@ |
||
| 77 | 77 | } |
| 78 | 78 | /** |
| 79 | 79 | * @since 3.6.0 |
| 80 | + * @param boolean $abCollapsible |
|
| 81 | + * @param string $sTitle |
|
| 80 | 82 | * @return array |
| 81 | 83 | */ |
| 82 | 84 | private function _getArguments( $abCollapsible, $sTitle, array $aSection ) { |
@@ -23,12 +23,12 @@ discard block |
||
| 23 | 23 | * @since 3.6.0 Moved from `AdminPageFramework_FormDefinition`. |
| 24 | 24 | */ |
| 25 | 25 | static public $aStructure = array( |
| 26 | - 'title' => null, // (string) the section title will be assigned by default in the section formatting method. |
|
| 27 | - 'is_collapsed' => true, // (boolean) whether it is already collapsed or expanded |
|
| 28 | - 'toggle_all_button' => null, // (boolean|string|array) the position of where to display the toggle-all button that toggles the folding state of all collapsible sections. Accepts the following values. 'top-right', 'top-left', 'bottom-right', 'bottom-left'. If true is passed, the default 'top-right' will be used. To not to display, do not set any or pass `false` or `null`. |
|
| 29 | - 'collapse_others_on_expand' => true, // (boolean) whether the other collapsible sections should be folded when the section is unfolded. |
|
| 30 | - 'container' => 'sections', // (string) the container element that collapsible styling gets applied to. Either 'sections' or 'section' is accepted. |
|
| 31 | - 'type' => 'box', // 3.7.0+ (string) supported types 'box', 'button' Default: `box`. The `button` type is only supported when the `container` argument is `section`. |
|
| 26 | + 'title' => null, // (string) the section title will be assigned by default in the section formatting method. |
|
| 27 | + 'is_collapsed' => true, // (boolean) whether it is already collapsed or expanded |
|
| 28 | + 'toggle_all_button' => null, // (boolean|string|array) the position of where to display the toggle-all button that toggles the folding state of all collapsible sections. Accepts the following values. 'top-right', 'top-left', 'bottom-right', 'bottom-left'. If true is passed, the default 'top-right' will be used. To not to display, do not set any or pass `false` or `null`. |
|
| 29 | + 'collapse_others_on_expand' => true, // (boolean) whether the other collapsible sections should be folded when the section is unfolded. |
|
| 30 | + 'container' => 'sections', // (string) the container element that collapsible styling gets applied to. Either 'sections' or 'section' is accepted. |
|
| 31 | + 'type' => 'box', // 3.7.0+ (string) supported types 'box', 'button' Default: `box`. The `button` type is only supported when the `container` argument is `section`. |
|
| 32 | 32 | ); |
| 33 | 33 | |
| 34 | 34 | public $abCollapsible = false; |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | * @remark The framework will not pass this parameter when formatting a section definition array. |
| 42 | 42 | * It will be passed when the framework is rendering a form table to generate collapsible elements. |
| 43 | 43 | */ |
| 44 | - public $aSection = array(); |
|
| 44 | + public $aSection = array(); |
|
| 45 | 45 | |
| 46 | 46 | /** |
| 47 | 47 | * Sets up properties. |
@@ -84,14 +84,14 @@ discard block |
||
| 84 | 84 | |
| 85 | 85 | $_aCollapsible = $this->getAsArray( $this->abCollapsible ) + array( |
| 86 | 86 | 'title' => $sTitle, |
| 87 | - ) + self::$aStructure; |
|
| 87 | + ) + self::$aStructure; |
|
| 88 | 88 | |
| 89 | 89 | $_aCollapsible[ 'toggle_all_button' ] = implode( |
| 90 | 90 | ',', |
| 91 | 91 | $this->getAsArray( $_aCollapsible[ 'toggle_all_button' ] ) |
| 92 | 92 | ); |
| 93 | 93 | |
| 94 | - if ( ! empty( $aSection ) ) { |
|
| 94 | + if ( !empty( $aSection ) ) { |
|
| 95 | 95 | $_aCollapsible[ 'toggle_all_button' ] = $this->_getToggleAllButtonArgument( |
| 96 | 96 | $_aCollapsible[ 'toggle_all_button' ], |
| 97 | 97 | $aSection |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | */ |
| 116 | 116 | private function _getToggleAllButtonArgument( $sToggleAll, array $aSection ) { |
| 117 | 117 | |
| 118 | - if ( ! $aSection[ 'repeatable' ] ) { |
|
| 118 | + if ( !$aSection[ 'repeatable' ] ) { |
|
| 119 | 119 | return $sToggleAll; |
| 120 | 120 | } |
| 121 | 121 | |
@@ -125,13 +125,13 @@ discard block |
||
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | // Disable the toggle all button for middle sub-sections in repeatable sections. |
| 128 | - if ( ! $aSection[ '_is_first_index' ] && ! $aSection[ '_is_last_index' ] ) { |
|
| 128 | + if ( !$aSection[ '_is_first_index' ] && !$aSection[ '_is_last_index' ] ) { |
|
| 129 | 129 | return 0; |
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | $_aToggleAll = $this->getAOrB( |
| 133 | - true === $sToggleAll || 1 === $sToggleAll, // evaluate |
|
| 134 | - array( 'top-right', 'bottom-right' ), // if true |
|
| 133 | + true === $sToggleAll || 1 === $sToggleAll, // evaluate |
|
| 134 | + array( 'top-right', 'bottom-right' ), // if true |
|
| 135 | 135 | explode( ',', $sToggleAll ) // if false |
| 136 | 136 | ); |
| 137 | 137 | $_aToggleAll = $this->getAOrB( |
@@ -114,7 +114,7 @@ |
||
| 114 | 114 | */ |
| 115 | 115 | private function _getToggleAllButtonArgument( $sToggleAll, array $aSection ) { |
| 116 | 116 | |
| 117 | - if ( ! $aSection[ 'repeatable' ] ) { |
|
| 117 | + if ( ! $aSection[ 'repeatable' ] ) { |
|
| 118 | 118 | return $sToggleAll; |
| 119 | 119 | } |
| 120 | 120 | |
@@ -98,6 +98,7 @@ discard block |
||
| 98 | 98 | * @since DEVVER Moved from `AdminPageFramework_FormDefinition`. Changed the name from `formatFields()`. |
| 99 | 99 | * Added the `$aSectionsets` parameter. |
| 100 | 100 | * @retuen array |
| 101 | + * @param string $sCapability |
|
| 101 | 102 | */ |
| 102 | 103 | private function _getFieldsetsFormatted( array $aFieldsets, array $aSectionsets, $sCapability ) { |
| 103 | 104 | |
@@ -271,6 +272,7 @@ discard block |
||
| 271 | 272 | * |
| 272 | 273 | * @since 3.0.0 |
| 273 | 274 | * @since DEVVER Moved from `AdminPageFramework_FormDefinition`. Changed the name from `formatField()`. |
| 275 | + * @param integer $iCountOfElements |
|
| 274 | 276 | * @return array|void An array of formatted field definition array. If required keys are not set, nothing will be returned. |
| 275 | 277 | */ |
| 276 | 278 | private function _getFieldsetFormatted( $aFieldset, $aSectionsets, $sCapability, $iCountOfElements, $iSubSectionIndex, $bIsSectionRepeatable, $oCallerObject ) { |
@@ -104,10 +104,10 @@ discard block |
||
| 104 | 104 | private function _getFieldsetsFormatted( array $aFieldsets, array $aSectionsets, $sCapability ) { |
| 105 | 105 | |
| 106 | 106 | $_aNewFieldsets = array(); |
| 107 | - foreach( $aFieldsets as $_sSectionPath => $_aItems ) { |
|
| 107 | + foreach ( $aFieldsets as $_sSectionPath => $_aItems ) { |
|
| 108 | 108 | |
| 109 | 109 | // If the section is not set, skip. |
| 110 | - if ( ! isset( $aSectionsets[ $_sSectionPath ] ) ) { |
|
| 110 | + if ( !isset( $aSectionsets[ $_sSectionPath ] ) ) { |
|
| 111 | 111 | continue; |
| 112 | 112 | } |
| 113 | 113 | |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | $_aItems, |
| 117 | 117 | $this->getElement( // 3.6.0+ Get the section's capability |
| 118 | 118 | $aSectionsets, |
| 119 | - array( $_sSectionPath, 'capability', ), |
|
| 119 | + array( $_sSectionPath, 'capability',), |
|
| 120 | 120 | $sCapability |
| 121 | 121 | ), |
| 122 | 122 | $aSectionsets |
@@ -176,16 +176,16 @@ discard block |
||
| 176 | 176 | */ |
| 177 | 177 | private function _getNormalFieldsetsFormatted( $aItems, $sCapability, $aSectionsets, $_abSectionRepeatable ) { |
| 178 | 178 | |
| 179 | - $_aNewItems = array(); |
|
| 180 | - foreach( $aItems as $_sFieldID => $_aFieldset ) { |
|
| 179 | + $_aNewItems = array(); |
|
| 180 | + foreach ( $aItems as $_sFieldID => $_aFieldset ) { |
|
| 181 | 181 | |
| 182 | 182 | // Insert the formatted field definition array. The fields count is needed to set each order value. |
| 183 | - $_aFieldset = $this->_getFieldsetFormatted( |
|
| 183 | + $_aFieldset = $this->_getFieldsetFormatted( |
|
| 184 | 184 | $_aFieldset, |
| 185 | 185 | $aSectionsets, |
| 186 | 186 | $sCapability, |
| 187 | 187 | count( $_aNewItems ), // index of elements - zero based |
| 188 | - null, // sub-section index |
|
| 188 | + null, // sub-section index |
|
| 189 | 189 | $_abSectionRepeatable, |
| 190 | 190 | $this->oCallerForm |
| 191 | 191 | ); |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | * @return boolean |
| 205 | 205 | */ |
| 206 | 206 | private function _isSubSections( $aItems, $_abSectionRepeatable ) { |
| 207 | - if ( ! empty( $_abSectionRepeatable ) ) { |
|
| 207 | + if ( !empty( $_abSectionRepeatable ) ) { |
|
| 208 | 208 | return true; |
| 209 | 209 | } |
| 210 | 210 | return ( boolean ) count( $this->getIntegerKeyElements( $aItems ) ); |
@@ -215,9 +215,9 @@ discard block |
||
| 215 | 215 | private function _getSubSectionsFormatted( $aItems, $sCapability, $aSectionsets, $_abSectionRepeatable ) { |
| 216 | 216 | |
| 217 | 217 | $_aNewFieldset = array(); |
| 218 | - foreach( $this->numerizeElements( $aItems ) as $_iSubSectionIndex => $_aFieldsets ) { |
|
| 218 | + foreach ( $this->numerizeElements( $aItems ) as $_iSubSectionIndex => $_aFieldsets ) { |
|
| 219 | 219 | |
| 220 | - foreach( $_aFieldsets as $_aFieldset ) { |
|
| 220 | + foreach ( $_aFieldsets as $_aFieldset ) { |
|
| 221 | 221 | $_iCountElement = count( $this->getElementAsArray( $_aNewFieldset, $_iSubSectionIndex ) ); |
| 222 | 222 | $_aFieldset = $this->_getFieldsetFormatted( |
| 223 | 223 | $_aFieldset, |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | if ( empty( $_aFieldset ) ) { |
| 232 | 232 | continue; |
| 233 | 233 | } |
| 234 | - $_aNewFieldset[ $_iSubSectionIndex ][ $_aFieldset['field_id'] ] = $_aFieldset; |
|
| 234 | + $_aNewFieldset[ $_iSubSectionIndex ][ $_aFieldset[ 'field_id' ] ] = $_aFieldset; |
|
| 235 | 235 | } |
| 236 | 236 | uasort( $_aNewFieldset[ $_iSubSectionIndex ], array( $this, 'sortArrayByKey' ) ); |
| 237 | 237 | |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | } |
| 259 | 259 | |
| 260 | 260 | $_aSortedFields = array(); |
| 261 | - foreach( $aSectionsets as $_sSectionPath => $_aSecitonset ) { |
|
| 261 | + foreach ( $aSectionsets as $_sSectionPath => $_aSecitonset ) { |
|
| 262 | 262 | if ( isset( $aFieldsets[ $_sSectionPath ] ) ) { |
| 263 | 263 | $_aSortedFields[ $_sSectionPath ] = $aFieldsets[ $_sSectionPath ]; |
| 264 | 264 | } |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | private function _getFieldsetFormatted( $aFieldset, $aSectionsets, $sCapability, $iCountOfElements, $iSubSectionIndex, $bIsSectionRepeatable, $oCallerObject ) { |
| 278 | 278 | |
| 279 | 279 | // 3.8.0+ Dropped the check for $aFieldset[ 'type' ] to allow it to be omitted. |
| 280 | - if ( ! isset( $aFieldset[ 'field_id' ] ) ) { |
|
| 280 | + if ( !isset( $aFieldset[ 'field_id' ] ) ) { |
|
| 281 | 281 | return; |
| 282 | 282 | } |
| 283 | 283 | |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | foreach( $aFieldsets as $_sSectionPath => $_aItems ) { |
| 108 | 108 | |
| 109 | 109 | // If the section is not set, skip. |
| 110 | - if ( ! isset( $aSectionsets[ $_sSectionPath ] ) ) { |
|
| 110 | + if ( ! isset( $aSectionsets[ $_sSectionPath ] ) ) { |
|
| 111 | 111 | continue; |
| 112 | 112 | } |
| 113 | 113 | |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | } |
| 259 | 259 | |
| 260 | 260 | $_aSortedFields = array(); |
| 261 | - foreach( $aSectionsets as $_sSectionPath => $_aSecitonset ) { |
|
| 261 | + foreach( $aSectionsets as $_sSectionPath => $_aSecitonset ) { |
|
| 262 | 262 | if ( isset( $aFieldsets[ $_sSectionPath ] ) ) { |
| 263 | 263 | $_aSortedFields[ $_sSectionPath ] = $aFieldsets[ $_sSectionPath ]; |
| 264 | 264 | } |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | private function _getFieldsetFormatted( $aFieldset, $aSectionsets, $sCapability, $iCountOfElements, $iSubSectionIndex, $bIsSectionRepeatable, $oCallerObject ) { |
| 278 | 278 | |
| 279 | 279 | // 3.8.0+ Dropped the check for $aFieldset[ 'type' ] to allow it to be omitted. |
| 280 | - if ( ! isset( $aFieldset[ 'field_id' ] ) ) { |
|
| 280 | + if ( ! isset( $aFieldset[ 'field_id' ] ) ) { |
|
| 281 | 281 | return; |
| 282 | 282 | } |
| 283 | 283 | |
@@ -30,7 +30,6 @@ |
||
| 30 | 30 | * Returns the field container attribute array. |
| 31 | 31 | * |
| 32 | 32 | * @remark Formatting each sub-field should be performed prior to callign this method. |
| 33 | - * @param array $aField The (sub-)field definition array. This should have been formatted already. |
|
| 34 | 33 | * @return array The generated field container attribute array. |
| 35 | 34 | * @internal |
| 36 | 35 | * @since 3.5.3 |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | * |
| 26 | 26 | * @since 3.6.0 |
| 27 | 27 | */ |
| 28 | - public $sContext = 'field'; |
|
| 28 | + public $sContext = 'field'; |
|
| 29 | 29 | |
| 30 | 30 | /** |
| 31 | 31 | * Returns the field container attribute array. |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | protected function _getAttributes() { |
| 42 | 42 | |
| 43 | 43 | // 3.8.0+ Supports omitting the `type` argument. |
| 44 | - $_sFieldTypeSelector = $this->getAOrB( |
|
| 44 | + $_sFieldTypeSelector = $this->getAOrB( |
|
| 45 | 45 | $this->aArguments[ 'type' ], |
| 46 | 46 | " admin-page-framework-field-{$this->aArguments[ 'type' ]}", |
| 47 | 47 | '' |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | |
| 67 | 67 | return array( |
| 68 | 68 | 'id' => $this->aArguments[ '_field_container_id' ], |
| 69 | - 'data-type' => $this->aArguments[ 'type' ], // referred by the repeatable field JavaScript script. |
|
| 69 | + 'data-type' => $this->aArguments[ 'type' ], // referred by the repeatable field JavaScript script. |
|
| 70 | 70 | 'class' => "admin-page-framework-field{$_sFieldTypeSelector}{$_sNestedFieldSelector}{$_sMixedFieldSelector}{$_sChildFieldSelector}" |
| 71 | 71 | . $this->getAOrB( |
| 72 | 72 | $this->aArguments[ 'attributes' ][ 'disabled' ], |
@@ -60,6 +60,7 @@ |
||
| 60 | 60 | * |
| 61 | 61 | * @since 3.1.0 |
| 62 | 62 | * @since DEVVER Moved from `AdminPageFramework_Form_View___Fieldset`. |
| 63 | + * @param string $sHeadingMessage |
|
| 63 | 64 | * @return string The error string message. An empty value if not found. |
| 64 | 65 | */ |
| 65 | 66 | private function _getFieldError( $aErrors, $aSectionPath, $aFieldPath, $sHeadingMessage ) { |
@@ -65,7 +65,7 @@ |
||
| 65 | 65 | private function _getFieldError( $aErrors, $aSectionPath, $aFieldPath, $sHeadingMessage ) { |
| 66 | 66 | |
| 67 | 67 | // If this field has a section and the error element is set |
| 68 | - $_aErrorPath = array_merge( $aSectionPath, $aFieldPath ); |
|
| 68 | + $_aErrorPath = array_merge( $aSectionPath, $aFieldPath ); |
|
| 69 | 69 | if ( $this->_hasFieldError( $aErrors, $_aErrorPath ) ) { |
| 70 | 70 | return "<span class='field-error'>* " |
| 71 | 71 | . $sHeadingMessage |
@@ -176,6 +176,7 @@ discard block |
||
| 176 | 176 | * Returns the repeatable fields script. |
| 177 | 177 | * |
| 178 | 178 | * @since 2.1.3 |
| 179 | + * @param string $sFieldsContainerID |
|
| 179 | 180 | */ |
| 180 | 181 | protected function _getRepeaterFieldEnablerScript( $sFieldsContainerID, $iFieldCount, $aSettings ) { |
| 181 | 182 | |
@@ -222,6 +223,7 @@ discard block |
||
| 222 | 223 | * Returns the sortable fields script. |
| 223 | 224 | * |
| 224 | 225 | * @since 3.0.0 |
| 226 | + * @param string $sFieldsContainerID |
|
| 225 | 227 | */ |
| 226 | 228 | protected function _getSortableFieldEnablerScript( $sFieldsContainerID ) { |
| 227 | 229 | |
@@ -239,7 +239,7 @@ |
||
| 239 | 239 | |
| 240 | 240 | return "<div class='admin-page-framework-repeatable-field-buttons' {$_sSettingsAttributes} >" |
| 241 | 241 | . "<a class='repeatable-field-remove-button button-secondary repeatable-field-button button {$_sSmallButtonSelector}{$_sDashiconMinus}' href='#' title='{$_sRemove}' {$_sVisibility} data-id='{$sFieldsContainerID}'>" |
| 242 | - . '-' // ( $_bDashiconSupported ? '' : '-' ) |
|
| 242 | + . '-' // ( $_bDashiconSupported ? '' : '-' ) |
|
| 243 | 243 | . "</a>" |
| 244 | 244 | . "<a class='repeatable-field-add-button button-secondary repeatable-field-button button {$_sSmallButtonSelector}{$_sDashiconPlus}' href='#' title='{$_sAdd}' data-id='{$sFieldsContainerID}'>" |
| 245 | 245 | . '+' // ( $_bDashiconSupported ? '' : '+' ) |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | * @param object $oMsg An object storing the system messages. |
| 69 | 69 | * @param array $aCallbacks An array storing the form-field specific callbacks. |
| 70 | 70 | */ |
| 71 | - public function __construct( $aFieldset, $aOptions, $aErrors, &$aFieldTypeDefinitions, &$oMsg, array $aCallbacks=array() ) { |
|
| 71 | + public function __construct( $aFieldset, $aOptions, $aErrors, &$aFieldTypeDefinitions, &$oMsg, array $aCallbacks = array() ) { |
|
| 72 | 72 | |
| 73 | 73 | // Set up the properties that will be accessed later in the methods. |
| 74 | 74 | $this->aFieldset = $this->_getFormatted( $aFieldset, $aFieldTypeDefinitions ); |
@@ -77,13 +77,13 @@ discard block |
||
| 77 | 77 | $this->aErrors = $this->getAsArray( $aErrors ); |
| 78 | 78 | $this->oMsg = $oMsg; |
| 79 | 79 | $this->aCallbacks = $aCallbacks + array( |
| 80 | - 'hfID' => null, // the input id attribute |
|
| 81 | - 'hfTagID' => null, // the fieldset/field row container id attribute |
|
| 82 | - 'hfName' => null, // the input name attribute |
|
| 83 | - 'hfNameFlat' => null, // the flat input name attribute |
|
| 80 | + 'hfID' => null, // the input id attribute |
|
| 81 | + 'hfTagID' => null, // the fieldset/field row container id attribute |
|
| 82 | + 'hfName' => null, // the input name attribute |
|
| 83 | + 'hfNameFlat' => null, // the flat input name attribute |
|
| 84 | 84 | 'hfInputName' => null, |
| 85 | 85 | 'hfInputNameFlat' => null, |
| 86 | - 'hfClass' => null, // the class attribute |
|
| 86 | + 'hfClass' => null, // the class attribute |
|
| 87 | 87 | ); |
| 88 | 88 | |
| 89 | 89 | // 2. Load necessary JavaScript scripts. |
@@ -150,9 +150,9 @@ discard block |
||
| 150 | 150 | * @since 3.2.0 Added the `$sFieldsType` parameter. |
| 151 | 151 | * @internal |
| 152 | 152 | */ |
| 153 | - private function _loadScripts( $sStructureType='' ) { |
|
| 153 | + private function _loadScripts( $sStructureType = '' ) { |
|
| 154 | 154 | |
| 155 | - if ( 'widget' === $sStructureType && ! self::$_bIsLoadedJSScripts_Widget ) { |
|
| 155 | + if ( 'widget' === $sStructureType && !self::$_bIsLoadedJSScripts_Widget ) { |
|
| 156 | 156 | new AdminPageFramework_Form_View___Script_Widget; |
| 157 | 157 | self::$_bIsLoadedJSScripts_Widget = true; |
| 158 | 158 | } |
@@ -177,8 +177,8 @@ discard block |
||
| 177 | 177 | */ |
| 178 | 178 | protected function _getRepeaterFieldEnablerScript( $sFieldsContainerID, $iFieldCount, $aSettings ) { |
| 179 | 179 | |
| 180 | - $_sSmallButtons = '"' . $this->_getRepeatableButtonHTML( $sFieldsContainerID, ( array ) $aSettings, $iFieldCount, true ) . '"'; |
|
| 181 | - $_sNestedFieldsButtons = '"' . $this->_getRepeatableButtonHTML( $sFieldsContainerID, ( array ) $aSettings, $iFieldCount, false ) . '"'; |
|
| 180 | + $_sSmallButtons = '"'.$this->_getRepeatableButtonHTML( $sFieldsContainerID, ( array ) $aSettings, $iFieldCount, true ).'"'; |
|
| 181 | + $_sNestedFieldsButtons = '"'.$this->_getRepeatableButtonHTML( $sFieldsContainerID, ( array ) $aSettings, $iFieldCount, false ).'"'; |
|
| 182 | 182 | $_aJSArray = json_encode( $aSettings ); |
| 183 | 183 | $_sScript = <<<JAVASCRIPTS |
| 184 | 184 | jQuery( document ).ready( function() { |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | * @since 3.8.0 |
| 225 | 225 | * @return string |
| 226 | 226 | */ |
| 227 | - private function _getRepeatableButtonHTML( $sFieldsContainerID, array $aSettings, $iFieldCount, $bSmall=true ) { |
|
| 227 | + private function _getRepeatableButtonHTML( $sFieldsContainerID, array $aSettings, $iFieldCount, $bSmall = true ) { |
|
| 228 | 228 | |
| 229 | 229 | $_sAdd = $this->oMsg->get( 'add' ); |
| 230 | 230 | $_sRemove = $this->oMsg->get( 'remove' ); |
@@ -233,9 +233,9 @@ discard block |
||
| 233 | 233 | $_sSmallButtonSelector = $bSmall ? ' button-small' : ''; |
| 234 | 234 | |
| 235 | 235 | // Not using dash-icons at the moment. |
| 236 | - $_bDashiconSupported = false; // version_compare( $GLOBALS[ 'wp_version' ], '3.8', '>=' ); |
|
| 237 | - $_sDashiconPlus = ''; // $_bDashiconSupported ? 'dashicons dashicons-plus' : ''; |
|
| 238 | - $_sDashiconMinus = ''; // $_bDashiconSupported ? 'dashicons dashicons-minus' : ''; |
|
| 236 | + $_bDashiconSupported = false; // version_compare( $GLOBALS[ 'wp_version' ], '3.8', '>=' ); |
|
| 237 | + $_sDashiconPlus = ''; // $_bDashiconSupported ? 'dashicons dashicons-plus' : ''; |
|
| 238 | + $_sDashiconMinus = ''; // $_bDashiconSupported ? 'dashicons dashicons-minus' : ''; |
|
| 239 | 239 | |
| 240 | 240 | return "<div class='admin-page-framework-repeatable-field-buttons' {$_sSettingsAttributes} >" |
| 241 | 241 | . "<a class='repeatable-field-remove-button button-secondary repeatable-field-button button {$_sSmallButtonSelector}{$_sDashiconMinus}' href='#' title='{$_sRemove}' {$_sVisibility} data-id='{$sFieldsContainerID}'>" |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | self::$_bIsLoadedJSScripts_Widget = true; |
| 158 | 158 | } |
| 159 | 159 | |
| 160 | - if ( self::$_bIsLoadedJSScripts ) { |
|
| 160 | + if ( self::$_bIsLoadedJSScripts ) { |
|
| 161 | 161 | return; |
| 162 | 162 | } |
| 163 | 163 | self::$_bIsLoadedJSScripts = true; |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | * |
| 256 | 256 | * @since 3.0.0 |
| 257 | 257 | */ |
| 258 | - protected function _getSortableFieldEnablerScript( $sFieldsContainerID ) { |
|
| 258 | + protected function _getSortableFieldEnablerScript( $sFieldsContainerID ) { |
|
| 259 | 259 | |
| 260 | 260 | $_sScript = <<<JAVASCRIPTS |
| 261 | 261 | jQuery( document ).ready( function() { |
@@ -23,7 +23,6 @@ |
||
| 23 | 23 | * @internal |
| 24 | 24 | * @since 3.5.3 |
| 25 | 25 | * @since 3.6.0 Moved from `AdminPageFramework_FormDefinition`. |
| 26 | - * @param array $aFieldset a field definition array. |
|
| 27 | 26 | * @return boolean |
| 28 | 27 | */ |
| 29 | 28 | protected function _isSectionSet() { |
@@ -60,6 +60,7 @@ |
||
| 60 | 60 | /** |
| 61 | 61 | * Applies the subject string to the set callback filter function. |
| 62 | 62 | * @since 3.6.0 |
| 63 | + * @param string $sSubject |
|
| 63 | 64 | */ |
| 64 | 65 | protected function _getFiltered( $sSubject ) { |
| 65 | 66 | return is_callable( $this->hfCallback ) |
@@ -51,9 +51,9 @@ |
||
| 51 | 51 | $_sIndex = $this->getAOrB( |
| 52 | 52 | '0' !== $this->sIndex && empty( $this->sIndex ), |
| 53 | 53 | '', |
| 54 | - "[" . $this->sIndex . "]" |
|
| 54 | + "[".$this->sIndex."]" |
|
| 55 | 55 | ); |
| 56 | - return $this->_getFiltered( $this->_getFieldName() . $_sIndex ); |
|
| 56 | + return $this->_getFiltered( $this->_getFieldName().$_sIndex ); |
|
| 57 | 57 | |
| 58 | 58 | } |
| 59 | 59 | |
@@ -51,6 +51,7 @@ |
||
| 51 | 51 | /** |
| 52 | 52 | * Applies the subject string to the set callback filter function. |
| 53 | 53 | * @since 3.6.0 |
| 54 | + * @param string $sSubject |
|
| 54 | 55 | */ |
| 55 | 56 | protected function _getFiltered( $sSubject ) { |
| 56 | 57 | return is_callable( $this->hfCallback ) |
@@ -93,8 +93,8 @@ |
||
| 93 | 93 | |
| 94 | 94 | // Extract the first part as it does not have braces |
| 95 | 95 | $_sName = array_shift( $aParts ); |
| 96 | - foreach( $aParts as $_sPart ) { |
|
| 97 | - $_sName .= '[' . $_sPart . ']'; |
|
| 96 | + foreach ( $aParts as $_sPart ) { |
|
| 97 | + $_sName .= '['.$_sPart.']'; |
|
| 98 | 98 | } |
| 99 | 99 | return $_sName; |
| 100 | 100 | |
@@ -121,6 +121,8 @@ |
||
| 121 | 121 | } |
| 122 | 122 | /** |
| 123 | 123 | * @since DEVVER |
| 124 | + * @param string $sKey |
|
| 125 | + * @param string $sValue |
|
| 124 | 126 | * @return void |
| 125 | 127 | */ |
| 126 | 128 | public function addResource( $sKey, $sValue ) { |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | * @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. |
| 46 | 46 | * @return boolean True if a setting notice is set; otherwise, false. |
| 47 | 47 | */ |
| 48 | - public function hasSubmitNotice( $sType='' ) { |
|
| 48 | + public function hasSubmitNotice( $sType = '' ) { |
|
| 49 | 49 | return $this->oSubmitNotice->hasNotice( $sType ); |
| 50 | 50 | } |
| 51 | 51 | |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | * @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. |
| 72 | 72 | * @return void |
| 73 | 73 | */ |
| 74 | - public function setSubmitNotice( $sMessage, $sType='error', $asAttributes=array(), $bOverride=true ) { |
|
| 74 | + public function setSubmitNotice( $sMessage, $sType = 'error', $asAttributes = array(), $bOverride = true ) { |
|
| 75 | 75 | $this->oSubmitNotice->set( |
| 76 | 76 | $sMessage, |
| 77 | 77 | $sType, |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | |
| 99 | 99 | $this->aSectionsets[ $aSectionset[ 'section_id' ] ] = $aSectionset; |
| 100 | 100 | $this->aFieldsets[ $aSectionset[ 'section_id' ] ] = $this->getElement( |
| 101 | - $this->aFieldsets, // subject array |
|
| 101 | + $this->aFieldsets, // subject array |
|
| 102 | 102 | $aSectionset[ 'section_id' ], // key |
| 103 | 103 | array() // default |
| 104 | 104 | ); |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | */ |
| 114 | 114 | public function removeSection( $sSectionID ) { |
| 115 | 115 | |
| 116 | - if ( '_default' === $sSectionID ){ |
|
| 116 | + if ( '_default' === $sSectionID ) { |
|
| 117 | 117 | return; |
| 118 | 118 | } |
| 119 | 119 | unset( |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | * @return void |
| 144 | 144 | */ |
| 145 | 145 | public function addResource( $sKey, $sValue ) { |
| 146 | - self::$_aResources[ $sKey ][] = $sValue; |
|
| 146 | + self::$_aResources[ $sKey ][ ] = $sValue; |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | /** |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | public function addField( $asFieldset ) { |
| 167 | 167 | |
| 168 | 168 | // If it is a target section, update the property and return. |
| 169 | - if ( ! $this->_isFieldsetDefinition( $asFieldset ) ) { |
|
| 169 | + if ( !$this->_isFieldsetDefinition( $asFieldset ) ) { |
|
| 170 | 170 | $this->_asTargetSectionID = $this->_getTargetSectionID( $asFieldset ); |
| 171 | 171 | return $this->_asTargetSectionID; |
| 172 | 172 | } |
@@ -175,13 +175,13 @@ discard block |
||
| 175 | 175 | |
| 176 | 176 | // Set the target section ID |
| 177 | 177 | $this->_asTargetSectionID = $this->getElement( |
| 178 | - $_aFieldset, // subject array |
|
| 178 | + $_aFieldset, // subject array |
|
| 179 | 179 | 'section_id', // key |
| 180 | 180 | $this->_asTargetSectionID // default |
| 181 | 181 | ); |
| 182 | 182 | |
| 183 | 183 | // Required Keys - 3.8.0+ Now 'type' can be omitted. |
| 184 | - if ( ! isset( $_aFieldset[ 'field_id' ] ) ) { |
|
| 184 | + if ( !isset( $_aFieldset[ 'field_id' ] ) ) { |
|
| 185 | 185 | return null; |
| 186 | 186 | } |
| 187 | 187 | |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | */ |
| 285 | 285 | public function removeField( $sFieldID ) { |
| 286 | 286 | |
| 287 | - foreach( $this->aFieldsets as $_sSectionID => $_aSubSectionsOrFields ) { |
|
| 287 | + foreach ( $this->aFieldsets as $_sSectionID => $_aSubSectionsOrFields ) { |
|
| 288 | 288 | |
| 289 | 289 | if ( array_key_exists( $sFieldID, $_aSubSectionsOrFields ) ) { |
| 290 | 290 | unset( $this->aFieldsets[ $_sSectionID ][ $sFieldID ] ); |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | */ |
| 114 | 114 | public function removeSection( $sSectionID ) { |
| 115 | 115 | |
| 116 | - if ( '_default' === $sSectionID ){ |
|
| 116 | + if ( '_default' === $sSectionID ) { |
|
| 117 | 117 | return; |
| 118 | 118 | } |
| 119 | 119 | unset( |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | ); |
| 182 | 182 | |
| 183 | 183 | // Required Keys - 3.8.0+ Now 'type' can be omitted. |
| 184 | - if ( ! isset( $_aFieldset[ 'field_id' ] ) ) { |
|
| 184 | + if ( ! isset( $_aFieldset[ 'field_id' ] ) ) { |
|
| 185 | 185 | return null; |
| 186 | 186 | } |
| 187 | 187 | |