@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | /** |
| 52 | 52 | * Defines the field type slugs used for this field type. |
| 53 | 53 | */ |
| 54 | - public $aFieldTypeSlugs = array( 'export', ); |
|
| 54 | + public $aFieldTypeSlugs = array( 'export',); |
|
| 55 | 55 | |
| 56 | 56 | /** |
| 57 | 57 | * Defines the default key-values of this field type. |
@@ -59,9 +59,9 @@ discard block |
||
| 59 | 59 | * @remark $_aDefaultKeys holds shared default key-values defined in the base class. |
| 60 | 60 | */ |
| 61 | 61 | protected $aDefaultKeys = array( |
| 62 | - 'data' => null, // ( array|string|object ) This is for the export field type. Do not set a value here. |
|
| 63 | - 'format' => 'json', // ( string ) for the export field type. Do not set a default value here. Currently array, json, and text are supported. |
|
| 64 | - 'file_name' => null, // ( string ) for the export field type. Do not set a default value here. |
|
| 62 | + 'data' => null, // ( array|string|object ) This is for the export field type. Do not set a value here. |
|
| 63 | + 'format' => 'json', // ( string ) for the export field type. Do not set a default value here. Currently array, json, and text are supported. |
|
| 64 | + 'file_name' => null, // ( string ) for the export field type. Do not set a default value here. |
|
| 65 | 65 | 'attributes' => array( |
| 66 | 66 | 'class' => 'button button-primary', |
| 67 | 67 | ), |
@@ -106,14 +106,14 @@ discard block |
||
| 106 | 106 | protected function getField( $aField ) { |
| 107 | 107 | |
| 108 | 108 | /* Set the transient data to export - If the value is not an array and the export data is set. */ |
| 109 | - if ( isset( $aField['data'] ) ) { |
|
| 110 | - $this->setTransient( md5( "{$aField['class_name']}_{$aField['input_id']}" ), $aField['data'], 60*2 ); // 2 minutes. |
|
| 109 | + if ( isset( $aField[ 'data' ] ) ) { |
|
| 110 | + $this->setTransient( md5( "{$aField[ 'class_name' ]}_{$aField[ 'input_id' ]}" ), $aField[ 'data' ], 60 * 2 ); // 2 minutes. |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | /* Set some required values */ |
| 114 | - $aField['attributes']['name'] = "__export[submit][{$aField['input_id']}]"; |
|
| 115 | - $aField['file_name'] = $aField['file_name'] ? $aField['file_name'] : $this->_generateExportFileName( $aField['option_key'] ? $aField['option_key'] : $aField['class_name'], $aField['format'] ); |
|
| 116 | - $aField['label'] = $aField['label'] ? $aField['label'] : $this->oMsg->get( 'export' ); |
|
| 114 | + $aField[ 'attributes' ][ 'name' ] = "__export[submit][{$aField[ 'input_id' ]}]"; |
|
| 115 | + $aField[ 'file_name' ] = $aField[ 'file_name' ] ? $aField[ 'file_name' ] : $this->_generateExportFileName( $aField[ 'option_key' ] ? $aField[ 'option_key' ] : $aField[ 'class_name' ], $aField[ 'format' ] ); |
|
| 116 | + $aField[ 'label' ] = $aField[ 'label' ] ? $aField[ 'label' ] : $this->oMsg->get( 'export' ); |
|
| 117 | 117 | |
| 118 | 118 | return parent::getField( $aField ); |
| 119 | 119 | |
@@ -129,42 +129,42 @@ discard block |
||
| 129 | 129 | |
| 130 | 130 | $_aAttributes = array( 'type' => 'hidden' ); |
| 131 | 131 | return |
| 132 | - "<input " . $this->getAttributes( |
|
| 132 | + "<input ".$this->getAttributes( |
|
| 133 | 133 | array( |
| 134 | - 'name' => "__export[{$aField['input_id']}][input_id]", |
|
| 135 | - 'value' => $aField['input_id'], |
|
| 134 | + 'name' => "__export[{$aField[ 'input_id' ]}][input_id]", |
|
| 135 | + 'value' => $aField[ 'input_id' ], |
|
| 136 | 136 | ) + $_aAttributes |
| 137 | - ) . "/>" |
|
| 138 | - . "<input " . $this->getAttributes( |
|
| 137 | + )."/>" |
|
| 138 | + . "<input ".$this->getAttributes( |
|
| 139 | 139 | array( |
| 140 | - 'name' => "__export[{$aField['input_id']}][field_id]", |
|
| 141 | - 'value' => $aField['field_id'], |
|
| 140 | + 'name' => "__export[{$aField[ 'input_id' ]}][field_id]", |
|
| 141 | + 'value' => $aField[ 'field_id' ], |
|
| 142 | 142 | ) + $_aAttributes |
| 143 | - ) . "/>" |
|
| 144 | - . "<input " . $this->getAttributes( |
|
| 143 | + )."/>" |
|
| 144 | + . "<input ".$this->getAttributes( |
|
| 145 | 145 | array( |
| 146 | - 'name' => "__export[{$aField['input_id']}][section_id]", |
|
| 147 | - 'value' => isset( $aField['section_id'] ) && $aField['section_id'] != '_default' ? $aField['section_id'] : '', |
|
| 146 | + 'name' => "__export[{$aField[ 'input_id' ]}][section_id]", |
|
| 147 | + 'value' => isset( $aField[ 'section_id' ] ) && $aField[ 'section_id' ] != '_default' ? $aField[ 'section_id' ] : '', |
|
| 148 | 148 | ) + $_aAttributes |
| 149 | - ) . "/>" |
|
| 150 | - . "<input " . $this->getAttributes( |
|
| 149 | + )."/>" |
|
| 150 | + . "<input ".$this->getAttributes( |
|
| 151 | 151 | array( |
| 152 | - 'name' => "__export[{$aField['input_id']}][file_name]", |
|
| 153 | - 'value' => $aField['file_name'], |
|
| 152 | + 'name' => "__export[{$aField[ 'input_id' ]}][file_name]", |
|
| 153 | + 'value' => $aField[ 'file_name' ], |
|
| 154 | 154 | ) + $_aAttributes |
| 155 | - ) . "/>" |
|
| 156 | - . "<input " . $this->getAttributes( |
|
| 155 | + )."/>" |
|
| 156 | + . "<input ".$this->getAttributes( |
|
| 157 | 157 | array( |
| 158 | - 'name' => "__export[{$aField['input_id']}][format]", |
|
| 159 | - 'value' => $aField['format'], |
|
| 158 | + 'name' => "__export[{$aField[ 'input_id' ]}][format]", |
|
| 159 | + 'value' => $aField[ 'format' ], |
|
| 160 | 160 | ) + $_aAttributes |
| 161 | - ) . "/>" |
|
| 162 | - . "<input " . $this->getAttributes( |
|
| 161 | + )."/>" |
|
| 162 | + . "<input ".$this->getAttributes( |
|
| 163 | 163 | array( |
| 164 | - 'name' => "__export[{$aField['input_id']}][transient]", |
|
| 165 | - 'value' => isset( $aField['data'] ), |
|
| 164 | + 'name' => "__export[{$aField[ 'input_id' ]}][transient]", |
|
| 165 | + 'value' => isset( $aField[ 'data' ] ), |
|
| 166 | 166 | ) + $_aAttributes |
| 167 | - ) . "/>" |
|
| 167 | + )."/>" |
|
| 168 | 168 | ; |
| 169 | 169 | } |
| 170 | 170 | |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | * @since 2.1.5 Moved from the AdminPageFramework_FormField class. |
| 179 | 179 | * @internal |
| 180 | 180 | */ |
| 181 | - private function _generateExportFileName( $sOptionKey, $sExportFormat='json' ) { |
|
| 181 | + private function _generateExportFileName( $sOptionKey, $sExportFormat = 'json' ) { |
|
| 182 | 182 | |
| 183 | 183 | switch ( trim( strtolower( $sExportFormat ) ) ) { |
| 184 | 184 | case 'text': // for plain text. |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | break; |
| 194 | 194 | } |
| 195 | 195 | |
| 196 | - return $sOptionKey . '_' . date("Ymd") . '.' . $sExt; |
|
| 196 | + return $sOptionKey.'_'.date( "Ymd" ).'.'.$sExt; |
|
| 197 | 197 | |
| 198 | 198 | } |
| 199 | 199 | |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | /** |
| 103 | 103 | * Defines the field type slugs used for this field type. |
| 104 | 104 | */ |
| 105 | - public $aFieldTypeSlugs = array( 'select', ); |
|
| 105 | + public $aFieldTypeSlugs = array( 'select',); |
|
| 106 | 106 | |
| 107 | 107 | /** |
| 108 | 108 | * Defines the default key-values of this field type. |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | 'select' => array( |
| 115 | 115 | 'size' => 1, |
| 116 | 116 | 'autofocusNew' => null, |
| 117 | - 'multiple' => null, // set 'multiple' for multiple selections. If 'is_multiple' is set, it takes the precedence. |
|
| 117 | + 'multiple' => null, // set 'multiple' for multiple selections. If 'is_multiple' is set, it takes the precedence. |
|
| 118 | 118 | 'required' => null, |
| 119 | 119 | ), |
| 120 | 120 | 'optgroup' => array(), |
@@ -154,12 +154,12 @@ discard block |
||
| 154 | 154 | protected function getField( $aField ) { |
| 155 | 155 | |
| 156 | 156 | $_oSelectInput = new AdminPageFramework_Input_select( $aField[ 'attributes' ] ); |
| 157 | - if ( $aField[ 'is_multiple' ] ) { |
|
| 157 | + if ( $aField[ 'is_multiple' ] ) { |
|
| 158 | 158 | $_oSelectInput->setAttribute( array( 'select', 'multiple' ), 'multiple' ); |
| 159 | 159 | } |
| 160 | 160 | return |
| 161 | 161 | $aField[ 'before_label' ] |
| 162 | - . "<div " . $this->getLabelContainerAttributes( $aField, 'admin-page-framework-input-label-container admin-page-framework-select-label' ) . ">" |
|
| 162 | + . "<div ".$this->getLabelContainerAttributes( $aField, 'admin-page-framework-input-label-container admin-page-framework-select-label' ).">" |
|
| 163 | 163 | . "<label for='{$aField[ 'input_id' ]}'>" |
| 164 | 164 | . $aField[ 'before_input' ] |
| 165 | 165 | . $_oSelectInput->get( $aField[ 'label' ] ) |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | /** |
| 58 | 58 | * Defines the field type slugs used for this field type. |
| 59 | 59 | */ |
| 60 | - public $aFieldTypeSlugs = array( 'media', ); |
|
| 60 | + public $aFieldTypeSlugs = array( 'media',); |
|
| 61 | 61 | |
| 62 | 62 | /** |
| 63 | 63 | * Defines the default key-values of this field type. |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | return |
| 92 | 92 | $this->_getScript_MediaUploader( |
| 93 | 93 | "admin_page_framework" |
| 94 | - ) . PHP_EOL |
|
| 94 | + ).PHP_EOL |
|
| 95 | 95 | . $this->_getScript_RegisterCallbacks(); |
| 96 | 96 | } |
| 97 | 97 | |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | $_sInsertFromURL = esc_js( $this->oMsg->get( 'insert_from_url' ) ); |
| 160 | 160 | |
| 161 | 161 | // If the WordPress version is 3.4.x or below |
| 162 | - if ( ! function_exists( 'wp_enqueue_media' ) ) { |
|
| 162 | + if ( !function_exists( 'wp_enqueue_media' ) ) { |
|
| 163 | 163 | return <<<JAVASCRIPTS |
| 164 | 164 | /** |
| 165 | 165 | * Bind/rebinds the thickbox script the given selector element. |
@@ -400,10 +400,10 @@ discard block |
||
| 400 | 400 | // Do not include the escaping character (backslash) in the heredoc variable declaration |
| 401 | 401 | // because the minifier script will parse it and the <<<JAVASCRIPTS and JAVASCRIPTS; parts are converted to double quotes (") |
| 402 | 402 | // which causes the PHP syntax error. |
| 403 | - $_sButtonHTML = '"' . $this->_getUploaderButtonHTML_Media( $sInputID, $aButtonAttributes, $bExternalSource ) . '"'; |
|
| 404 | - $_sRpeatable = $this->getAOrB( ! empty( $abRepeatable ), 'true', 'false' ); |
|
| 403 | + $_sButtonHTML = '"'.$this->_getUploaderButtonHTML_Media( $sInputID, $aButtonAttributes, $bExternalSource ).'"'; |
|
| 404 | + $_sRpeatable = $this->getAOrB( !empty( $abRepeatable ), 'true', 'false' ); |
|
| 405 | 405 | $_sExternalSource = $this->getAOrB( $bExternalSource, 'true', 'false' ); |
| 406 | - $_sScript = <<<JAVASCRIPTS |
|
| 406 | + $_sScript = <<<JAVASCRIPTS |
|
| 407 | 407 | if ( jQuery( 'a#select_media_{$sInputID}' ).length == 0 ) { |
| 408 | 408 | jQuery( 'input#{$sInputID}' ).after( $_sButtonHTML ); |
| 409 | 409 | } |
@@ -416,7 +416,7 @@ discard block |
||
| 416 | 416 | . '/* <![CDATA[ */' |
| 417 | 417 | . $_sScript |
| 418 | 418 | . '/* ]]> */' |
| 419 | - . "</script>". PHP_EOL; |
|
| 419 | + . "</script>".PHP_EOL; |
|
| 420 | 420 | |
| 421 | 421 | } |
| 422 | 422 | /** |
@@ -427,19 +427,19 @@ discard block |
||
| 427 | 427 | */ |
| 428 | 428 | private function _getUploaderButtonHTML_Media( $sInputID, array $aButtonAttributes, $bExternalSource ) { |
| 429 | 429 | |
| 430 | - $_bIsLabelSet = isset( $aButtonAttributes['data-label'] ) && $aButtonAttributes['data-label']; |
|
| 430 | + $_bIsLabelSet = isset( $aButtonAttributes[ 'data-label' ] ) && $aButtonAttributes[ 'data-label' ]; |
|
| 431 | 431 | $_aAttributes = $this->_getFormattedUploadButtonAttributes_Media( |
| 432 | 432 | $sInputID, |
| 433 | 433 | $aButtonAttributes, |
| 434 | 434 | $_bIsLabelSet, |
| 435 | 435 | $bExternalSource |
| 436 | 436 | ); |
| 437 | - return "<a " . $this->getAttributes( $_aAttributes ) . ">" |
|
| 437 | + return "<a ".$this->getAttributes( $_aAttributes ).">" |
|
| 438 | 438 | . $this->getAOrB( |
| 439 | 439 | $_bIsLabelSet, |
| 440 | - $_aAttributes['data-label'], |
|
| 440 | + $_aAttributes[ 'data-label' ], |
|
| 441 | 441 | $this->getAOrB( |
| 442 | - strrpos( $_aAttributes['class'], 'dashicons' ), |
|
| 442 | + strrpos( $_aAttributes[ 'class' ], 'dashicons' ), |
|
| 443 | 443 | '', |
| 444 | 444 | $this->oMsg->get( 'select_file' ) |
| 445 | 445 | ) |
@@ -455,26 +455,26 @@ discard block |
||
| 455 | 455 | */ |
| 456 | 456 | private function _getFormattedUploadButtonAttributes_Media( $sInputID, array $aButtonAttributes, $_bIsLabelSet, $bExternalSource ) { |
| 457 | 457 | |
| 458 | - $_aAttributes = array( |
|
| 458 | + $_aAttributes = array( |
|
| 459 | 459 | 'id' => "select_media_{$sInputID}", |
| 460 | 460 | 'href' => '#', |
| 461 | - 'data-uploader_type' => ( string ) function_exists( 'wp_enqueue_media' ), // ? 1 : 0, |
|
| 462 | - 'data-enable_external_source' => ( string ) ( bool ) $bExternalSource, // ? 1 : 0, |
|
| 461 | + 'data-uploader_type' => ( string ) function_exists( 'wp_enqueue_media' ), // ? 1 : 0, |
|
| 462 | + 'data-enable_external_source' => ( string ) ( bool ) $bExternalSource, // ? 1 : 0, |
|
| 463 | 463 | ) |
| 464 | 464 | + $aButtonAttributes |
| 465 | 465 | + array( |
| 466 | 466 | 'title' => $_bIsLabelSet |
| 467 | - ? $aButtonAttributes['data-label'] |
|
| 467 | + ? $aButtonAttributes[ 'data-label' ] |
|
| 468 | 468 | : $this->oMsg->get( 'select_file' ), |
| 469 | 469 | 'data-label' => null, |
| 470 | 470 | ); |
| 471 | - $_aAttributes['class'] = $this->getClassAttribute( |
|
| 471 | + $_aAttributes[ 'class' ] = $this->getClassAttribute( |
|
| 472 | 472 | 'select_media button button-small ', |
| 473 | 473 | $this->getAOrB( |
| 474 | - trim( $aButtonAttributes['class'] ), |
|
| 475 | - $aButtonAttributes['class'], |
|
| 474 | + trim( $aButtonAttributes[ 'class' ] ), |
|
| 475 | + $aButtonAttributes[ 'class' ], |
|
| 476 | 476 | $this->getAOrB( |
| 477 | - ! $_bIsLabelSet && version_compare( $GLOBALS['wp_version'], '3.8', '>=' ), |
|
| 477 | + !$_bIsLabelSet && version_compare( $GLOBALS[ 'wp_version' ], '3.8', '>=' ), |
|
| 478 | 478 | 'dashicons dashicons-portfolio', |
| 479 | 479 | '' |
| 480 | 480 | ) |
@@ -66,16 +66,16 @@ discard block |
||
| 66 | 66 | */ |
| 67 | 67 | protected function getField( $aField ) { |
| 68 | 68 | |
| 69 | - $_oCallerForm = $aField[ '_caller_object' ]; |
|
| 69 | + $_oCallerForm = $aField[ '_caller_object' ]; |
|
| 70 | 70 | |
| 71 | 71 | $_aInlineMixedOutput = array(); |
| 72 | - foreach( $this->getAsArray( $aField[ 'content' ] ) as $_aChildFieldset ) { |
|
| 72 | + foreach ( $this->getAsArray( $aField[ 'content' ] ) as $_aChildFieldset ) { |
|
| 73 | 73 | |
| 74 | 74 | if ( is_scalar( $_aChildFieldset ) ) { |
| 75 | 75 | continue; |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - if ( ! $this->isNormalPlacement( $_aChildFieldset ) ) { |
|
| 78 | + if ( !$this->isNormalPlacement( $_aChildFieldset ) ) { |
|
| 79 | 79 | continue; |
| 80 | 80 | } |
| 81 | 81 | |
@@ -91,12 +91,12 @@ discard block |
||
| 91 | 91 | $_oFieldset = new AdminPageFramework_Form_View___Fieldset( |
| 92 | 92 | $_aChildFieldset, |
| 93 | 93 | $_oCallerForm->aSavedData, |
| 94 | - $_oCallerForm->getFieldErrors(), // @todo Generate field errors. $this->aErrors, |
|
| 94 | + $_oCallerForm->getFieldErrors(), // @todo Generate field errors. $this->aErrors, |
|
| 95 | 95 | $_oCallerForm->aFieldTypeDefinitions, |
| 96 | 96 | $_oCallerForm->oMsg, |
| 97 | 97 | $_oCallerForm->aCallbacks // field output element callables. |
| 98 | 98 | ); |
| 99 | - $_aInlineMixedOutput[] = $_oFieldset->get(); // field output |
|
| 99 | + $_aInlineMixedOutput[ ] = $_oFieldset->get(); // field output |
|
| 100 | 100 | |
| 101 | 101 | |
| 102 | 102 | } |
@@ -66,7 +66,7 @@ |
||
| 66 | 66 | . ( $aField[ 'label' ] |
| 67 | 67 | ? "<span " . $this->getLabelContainerAttributes( $aField, 'admin-page-framework-input-label-string' ) . ">" |
| 68 | 68 | . $aField[ 'label' ] |
| 69 | - . "</span>" |
|
| 69 | + . "</span>" |
|
| 70 | 70 | : "" |
| 71 | 71 | ) |
| 72 | 72 | . "<input " . $this->getAttributes( $aField[ 'attributes' ] ) . " />" |
@@ -59,21 +59,21 @@ |
||
| 59 | 59 | protected function getField( $aField ) { |
| 60 | 60 | |
| 61 | 61 | return |
| 62 | - $aField['before_label'] |
|
| 62 | + $aField[ 'before_label' ] |
|
| 63 | 63 | . "<div class='admin-page-framework-input-label-container'>" |
| 64 | 64 | . "<label for='{$aField[ 'input_id' ]}'>" |
| 65 | 65 | . $aField[ 'before_input' ] |
| 66 | 66 | . ( $aField[ 'label' ] |
| 67 | - ? "<span " . $this->getLabelContainerAttributes( $aField, 'admin-page-framework-input-label-string' ) . ">" |
|
| 67 | + ? "<span ".$this->getLabelContainerAttributes( $aField, 'admin-page-framework-input-label-string' ).">" |
|
| 68 | 68 | . $aField[ 'label' ] |
| 69 | 69 | . "</span>" |
| 70 | 70 | : "" |
| 71 | 71 | ) |
| 72 | - . "<input " . $this->getAttributes( $aField[ 'attributes' ] ) . " />" |
|
| 73 | - . $aField['after_input'] |
|
| 72 | + . "<input ".$this->getAttributes( $aField[ 'attributes' ] )." />" |
|
| 73 | + . $aField[ 'after_input' ] |
|
| 74 | 74 | . "</label>" |
| 75 | 75 | . "</div>" |
| 76 | - . $aField['after_label']; |
|
| 76 | + . $aField[ 'after_label' ]; |
|
| 77 | 77 | |
| 78 | 78 | } |
| 79 | 79 | |
@@ -43,7 +43,7 @@ |
||
| 43 | 43 | call_user_func_array( |
| 44 | 44 | $aFieldTypeDefinition[ 'hfFieldSetTypeSetter' ], |
| 45 | 45 | array( $sStructureType ) |
| 46 | - ); |
|
| 46 | + ); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | if ( is_callable( $aFieldTypeDefinition[ 'hfFieldLoader' ] ) ) { |
@@ -63,9 +63,9 @@ discard block |
||
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | $_aSectionsets = $this->_getSectionsetsFormatted( |
| 66 | - array(), // section-sets array to modify - new formatted items will be stored here |
|
| 67 | - $this->aSectionsets, // parsing section-sets |
|
| 68 | - array(), // section path - empty for root |
|
| 66 | + array(), // section-sets array to modify - new formatted items will be stored here |
|
| 67 | + $this->aSectionsets, // parsing section-sets |
|
| 68 | + array(), // section path - empty for root |
|
| 69 | 69 | $this->sCapability // capability |
| 70 | 70 | ); |
| 71 | 71 | |
@@ -82,10 +82,10 @@ discard block |
||
| 82 | 82 | */ |
| 83 | 83 | private function _getSectionsetsFormatted( $_aNewSectionsets, $aSectionsetsToParse, $aSectionPath, $sCapability ) { |
| 84 | 84 | |
| 85 | - foreach( $aSectionsetsToParse as $_sSectionPath => $_aSectionset ) { |
|
| 85 | + foreach ( $aSectionsetsToParse as $_sSectionPath => $_aSectionset ) { |
|
| 86 | 86 | |
| 87 | 87 | // The '_default' section can be empty so do not check `if ( empty( $_aSectionset ) )` here. |
| 88 | - if ( ! is_array( $_aSectionset ) ) { |
|
| 88 | + if ( !is_array( $_aSectionset ) ) { |
|
| 89 | 89 | continue; |
| 90 | 90 | } |
| 91 | 91 | |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | |
| 117 | 117 | // 3.7.0+ For nested sections |
| 118 | 118 | $_aNewSectionsets = $this->_getNestedSections( |
| 119 | - $_aNewSectionsets, // sectionset array to modify |
|
| 119 | + $_aNewSectionsets, // sectionset array to modify |
|
| 120 | 120 | $_aSectionset, |
| 121 | 121 | $_aSectionPath, // section path |
| 122 | 122 | $_aSectionset[ 'capability' ] |
@@ -133,15 +133,15 @@ discard block |
||
| 133 | 133 | */ |
| 134 | 134 | private function _getNestedSections( $aSectionsetsToEdit, $aSectionset, $aSectionPath, $sCapability ) { |
| 135 | 135 | |
| 136 | - if ( ! $this->_hasNestedSections( $aSectionset ) ) { |
|
| 136 | + if ( !$this->_hasNestedSections( $aSectionset ) ) { |
|
| 137 | 137 | return $aSectionsetsToEdit; |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | // Recursive call |
| 141 | 141 | return $this->_getSectionsetsFormatted( |
| 142 | - $aSectionsetsToEdit, // section-sets array to modify - new formatted items will be stored here |
|
| 143 | - $aSectionset[ 'content' ], // parsing section-sets |
|
| 144 | - $aSectionPath, // section path - empty for root |
|
| 142 | + $aSectionsetsToEdit, // section-sets array to modify - new formatted items will be stored here |
|
| 143 | + $aSectionset[ 'content' ], // parsing section-sets |
|
| 144 | + $aSectionPath, // section path - empty for root |
|
| 145 | 145 | $sCapability // capability |
| 146 | 146 | ); |
| 147 | 147 | |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | private function _hasNestedSections( $aSectionset ) { |
| 155 | 155 | |
| 156 | 156 | $aSectionset = $aSectionset + array( 'content' => null ); |
| 157 | - if ( ! is_array( $aSectionset[ 'content' ] ) ) { |
|
| 157 | + if ( !is_array( $aSectionset[ 'content' ] ) ) { |
|
| 158 | 158 | return false; |
| 159 | 159 | } |
| 160 | 160 | $_aContents = $aSectionset[ 'content' ]; |
@@ -28,38 +28,38 @@ discard block |
||
| 28 | 28 | static public $aStructure = array( |
| 29 | 29 | |
| 30 | 30 | // Required Keys |
| 31 | - 'field_id' => null, // (string) |
|
| 32 | - 'section_id' => null, // (string) |
|
| 31 | + 'field_id' => null, // (string) |
|
| 32 | + 'section_id' => null, // (string) |
|
| 33 | 33 | |
| 34 | 34 | // Optional Keys |
| 35 | - 'type' => null, // (string) (3.8.0+ Became okay to omit.) |
|
| 36 | - 'section_title' => null, // This will be assigned automatically in the formatting method. |
|
| 37 | - 'page_slug' => null, // This will be assigned automatically in the formatting method. |
|
| 38 | - 'tab_slug' => null, // This will be assigned automatically in the formatting method. |
|
| 39 | - 'option_key' => null, // This will be assigned automatically in the formatting method. |
|
| 40 | - 'class_name' => null, // Stores the instantiated class name. Used by the export field type. Also a third party custom field type uses it. |
|
| 35 | + 'type' => null, // (string) (3.8.0+ Became okay to omit.) |
|
| 36 | + 'section_title' => null, // This will be assigned automatically in the formatting method. |
|
| 37 | + 'page_slug' => null, // This will be assigned automatically in the formatting method. |
|
| 38 | + 'tab_slug' => null, // This will be assigned automatically in the formatting method. |
|
| 39 | + 'option_key' => null, // This will be assigned automatically in the formatting method. |
|
| 40 | + 'class_name' => null, // Stores the instantiated class name. Used by the export field type. Also a third party custom field type uses it. |
|
| 41 | 41 | 'capability' => null, |
| 42 | 42 | 'title' => null, |
| 43 | 43 | 'tip' => null, |
| 44 | 44 | 'description' => null, |
| 45 | - 'error_message' => null, // error message for the field |
|
| 45 | + 'error_message' => null, // error message for the field |
|
| 46 | 46 | 'before_label' => null, |
| 47 | 47 | 'after_label' => null, |
| 48 | 48 | 'if' => true, |
| 49 | - 'order' => null, // do not set the default number here for this key. |
|
| 49 | + 'order' => null, // do not set the default number here for this key. |
|
| 50 | 50 | 'default' => null, |
| 51 | 51 | 'value' => null, |
| 52 | - 'help' => null, // 2.1.0 |
|
| 53 | - 'help_aside' => null, // 2.1.0 |
|
| 54 | - 'repeatable' => null, // 2.1.3 |
|
| 55 | - 'sortable' => null, // 2.1.3 |
|
| 56 | - 'show_title_column' => true, // 3.0.0 |
|
| 57 | - 'hidden' => null, // 3.0.0 |
|
| 52 | + 'help' => null, // 2.1.0 |
|
| 53 | + 'help_aside' => null, // 2.1.0 |
|
| 54 | + 'repeatable' => null, // 2.1.3 |
|
| 55 | + 'sortable' => null, // 2.1.3 |
|
| 56 | + 'show_title_column' => true, // 3.0.0 |
|
| 57 | + 'hidden' => null, // 3.0.0 |
|
| 58 | 58 | |
| 59 | - 'placement' => 'normal', // 3.8.0 (string) accepts either 'section_title', 'field_title', or 'normal' |
|
| 59 | + 'placement' => 'normal', // 3.8.0 (string) accepts either 'section_title', 'field_title', or 'normal' |
|
| 60 | 60 | |
| 61 | 61 | // @todo Examine why an array is not set but null here for the attributes argument. |
| 62 | - 'attributes' => null, // 3.0.0 - the array represents the attributes of input tag |
|
| 62 | + 'attributes' => null, // 3.0.0 - the array represents the attributes of input tag |
|
| 63 | 63 | 'class' => array( // 3.3.1 |
| 64 | 64 | 'fieldrow' => array(), |
| 65 | 65 | 'fieldset' => array(), |
@@ -67,29 +67,29 @@ discard block |
||
| 67 | 67 | 'field' => array(), |
| 68 | 68 | ), |
| 69 | 69 | |
| 70 | - 'save' => true, // 3.6.0 |
|
| 71 | - 'content' => null, // 3.6.1 - (string) An overriding field-set output. |
|
| 70 | + 'save' => true, // 3.6.0 |
|
| 71 | + 'content' => null, // 3.6.1 - (string) An overriding field-set output. |
|
| 72 | 72 | |
| 73 | - 'show_debug_info' => null, // 3.8.8+ (boolean) whether to show debug information such as field definition tool-tips. This value is inherited from the section definition argument of the same name. Not setting a value here as it is determined with another calculated value. |
|
| 73 | + 'show_debug_info' => null, // 3.8.8+ (boolean) whether to show debug information such as field definition tool-tips. This value is inherited from the section definition argument of the same name. Not setting a value here as it is determined with another calculated value. |
|
| 74 | 74 | |
| 75 | 75 | // Internal Keys |
| 76 | - '_fields_type' => null, // @deprecated 3.7.0, 3.0.0 - an internal key that indicates the fields type such as page, meta box for pages, meta box for posts, or taxonomy. |
|
| 77 | - '_structure_type' => null, // 3.7.0 |
|
| 78 | - '_caller_object' => null, // 3.4.0 (object) stores the object of the caller class. The object is referenced when creating nested fields. |
|
| 79 | - |
|
| 80 | - '_section_path' => '', // 3.7.0 (string) Stores the section path that indicates the structural address of the nested section. e.g. my_section|nested_one |
|
| 81 | - '_section_path_array' => '', // 3.7.0 (array) An array version of the above section path. |
|
| 82 | - '_nested_depth' => 0, // 3.4.0 (integer) stores the level of the nesting depth. This is mostly used for debugging by checking if the field is a nested field or not. |
|
| 83 | - '_subsection_index' => null, // 3.7.0 Passed to the `field_definition_{...}` filter hook callbacks. |
|
| 84 | - '_section_repeatable' => false, // @deprecated |
|
| 85 | - '_is_section_repeatable' => false, // 3.8.0 (boolean) Whether the belonging section is repeatable or not. |
|
| 86 | - |
|
| 87 | - '_field_path' => '', // 3.7.0 (string) Stores the field path that indicates the structural location of the field. This is relative to the belonging section. |
|
| 76 | + '_fields_type' => null, // @deprecated 3.7.0, 3.0.0 - an internal key that indicates the fields type such as page, meta box for pages, meta box for posts, or taxonomy. |
|
| 77 | + '_structure_type' => null, // 3.7.0 |
|
| 78 | + '_caller_object' => null, // 3.4.0 (object) stores the object of the caller class. The object is referenced when creating nested fields. |
|
| 79 | + |
|
| 80 | + '_section_path' => '', // 3.7.0 (string) Stores the section path that indicates the structural address of the nested section. e.g. my_section|nested_one |
|
| 81 | + '_section_path_array' => '', // 3.7.0 (array) An array version of the above section path. |
|
| 82 | + '_nested_depth' => 0, // 3.4.0 (integer) stores the level of the nesting depth. This is mostly used for debugging by checking if the field is a nested field or not. |
|
| 83 | + '_subsection_index' => null, // 3.7.0 Passed to the `field_definition_{...}` filter hook callbacks. |
|
| 84 | + '_section_repeatable' => false, // @deprecated |
|
| 85 | + '_is_section_repeatable' => false, // 3.8.0 (boolean) Whether the belonging section is repeatable or not. |
|
| 86 | + |
|
| 87 | + '_field_path' => '', // 3.7.0 (string) Stores the field path that indicates the structural location of the field. This is relative to the belonging section. |
|
| 88 | 88 | '_field_path_array' => array(), // 3.7.0 (array) An array version of the above field path. |
| 89 | - '_parent_field_path' => '', // 3.8.0 (string) |
|
| 89 | + '_parent_field_path' => '', // 3.8.0 (string) |
|
| 90 | 90 | '_parent_field_path_array' => array(), // 3.8.0 (array) |
| 91 | 91 | |
| 92 | - '_is_title_embedded' => false, // 3.8.0 (boolean) whether the field title is in the fieldset element, not in the table th element. This becomes `true` for `section_title` fields and fields with the `placement` argument with the value of `section_title` or `field_title`. |
|
| 92 | + '_is_title_embedded' => false, // 3.8.0 (boolean) whether the field title is in the fieldset element, not in the table th element. This becomes `true` for `section_title` fields and fields with the `placement` argument with the value of `section_title` or `field_title`. |
|
| 93 | 93 | |
| 94 | 94 | ); |
| 95 | 95 | |
@@ -166,14 +166,14 @@ discard block |
||
| 166 | 166 | array( |
| 167 | 167 | '_fields_type' => $this->sStructureType, // @deprecated 3.7.0 backward-compatibility |
| 168 | 168 | '_structure_type' => $this->sStructureType, |
| 169 | - '_caller_object' => $this->oCallerObject, // 3.4.1+ Stores the caller form object. |
|
| 170 | - '_subsection_index' => $this->iSubSectionIndex, // 3.7.0+ |
|
| 169 | + '_caller_object' => $this->oCallerObject, // 3.4.1+ Stores the caller form object. |
|
| 170 | + '_subsection_index' => $this->iSubSectionIndex, // 3.7.0+ |
|
| 171 | 171 | ) |
| 172 | 172 | + $this->aFieldset, |
| 173 | 173 | array( |
| 174 | 174 | 'capability' => $this->sCapability, |
| 175 | 175 | 'section_id' => '_default', |
| 176 | - '_section_repeatable' => $this->bIsSectionRepeatable, // @deprecated 3.8.0 This was not used. |
|
| 176 | + '_section_repeatable' => $this->bIsSectionRepeatable, // @deprecated 3.8.0 This was not used. |
|
| 177 | 177 | '_is_section_repeatable' => $this->bIsSectionRepeatable, |
| 178 | 178 | ) |
| 179 | 179 | + self::$aStructure |
@@ -294,12 +294,12 @@ discard block |
||
| 294 | 294 | |
| 295 | 295 | ); |
| 296 | 296 | |
| 297 | - foreach( $aNestedFieldsets as $_isIndex => &$_aNestedFieldset ) { |
|
| 297 | + foreach ( $aNestedFieldsets as $_isIndex => &$_aNestedFieldset ) { |
|
| 298 | 298 | |
| 299 | 299 | // The inline-mixed type has a string element. |
| 300 | 300 | if ( is_scalar( $_aNestedFieldset ) ) { |
| 301 | 301 | $_aNestedFieldset = array( |
| 302 | - 'field_id' => $aParentFieldset[ 'field_id' ] . '_' . uniqid(), |
|
| 302 | + 'field_id' => $aParentFieldset[ 'field_id' ].'_'.uniqid(), |
|
| 303 | 303 | 'content' => $_aNestedFieldset, |
| 304 | 304 | ); |
| 305 | 305 | } |
@@ -34,47 +34,47 @@ discard block |
||
| 34 | 34 | // Optional |
| 35 | 35 | 'page_slug' => null, |
| 36 | 36 | 'tab_slug' => null, |
| 37 | - 'section_tab_slug' => null, // 3.0.0+ |
|
| 37 | + 'section_tab_slug' => null, // 3.0.0+ |
|
| 38 | 38 | 'title' => null, |
| 39 | 39 | 'description' => null, |
| 40 | 40 | 'capability' => null, |
| 41 | 41 | 'if' => true, |
| 42 | - 'order' => null, // do not set the default number here because incremented numbers will be added when registering the sections. |
|
| 42 | + 'order' => null, // do not set the default number here because incremented numbers will be added when registering the sections. |
|
| 43 | 43 | 'help' => null, |
| 44 | 44 | 'help_aside' => null, |
| 45 | - 'repeatable' => false, // (boolean|array) 3.0.0+ |
|
| 46 | - 'sortable' => false, // (boolean|array) 3.6.0+ |
|
| 45 | + 'repeatable' => false, // (boolean|array) 3.0.0+ |
|
| 46 | + 'sortable' => false, // (boolean|array) 3.6.0+ |
|
| 47 | 47 | 'attributes' => array( // 3.3.1+ |
| 48 | - 'class' => null, // set null to avoid undefined index warnings. |
|
| 49 | - 'style' => null, // set null to avoid undefined index warnings. |
|
| 48 | + 'class' => null, // set null to avoid undefined index warnings. |
|
| 49 | + 'style' => null, // set null to avoid undefined index warnings. |
|
| 50 | 50 | 'tab' => array(), |
| 51 | 51 | ), |
| 52 | 52 | 'class' => array( // 3.3.1+ |
| 53 | 53 | 'tab' => array(), |
| 54 | 54 | ), |
| 55 | - 'hidden' => false, // 3.3.1+ |
|
| 56 | - 'collapsible' => false, // 3.4.0+ (boolean|array) For the array structure see the $aStructure_CollapsibleArguments property. |
|
| 57 | - 'save' => true, // 3.6.0+ |
|
| 55 | + 'hidden' => false, // 3.3.1+ |
|
| 56 | + 'collapsible' => false, // 3.4.0+ (boolean|array) For the array structure see the $aStructure_CollapsibleArguments property. |
|
| 57 | + 'save' => true, // 3.6.0+ |
|
| 58 | 58 | |
| 59 | - 'content' => null, // 3.6.1+ (string) An overriding section-set output. |
|
| 59 | + 'content' => null, // 3.6.1+ (string) An overriding section-set output. |
|
| 60 | 60 | |
| 61 | - 'tip' => null, // 3.7.0 (string) Tool tip HTML strings. |
|
| 61 | + 'tip' => null, // 3.7.0 (string) Tool tip HTML strings. |
|
| 62 | 62 | |
| 63 | 63 | // Internal |
| 64 | - '_fields_type' => null, // @deprecated 3.7.0+ Use the `_structure_type` instead. 3.0.0+ - same as the one of the field definition array. Used to insert debug info at the bottom of sections. |
|
| 65 | - '_structure_type' => null, // 3.7.0+ |
|
| 66 | - '_is_first_index' => false, // 3.4.0+ (boolean) indicates whether it is the first item of the sub-sections (for repeatable sections). |
|
| 67 | - '_is_last_index' => false, // 3.4.0+ (boolean) indicates whether it is the last item of the sub-sections (for repeatable sections). |
|
| 64 | + '_fields_type' => null, // @deprecated 3.7.0+ Use the `_structure_type` instead. 3.0.0+ - same as the one of the field definition array. Used to insert debug info at the bottom of sections. |
|
| 65 | + '_structure_type' => null, // 3.7.0+ |
|
| 66 | + '_is_first_index' => false, // 3.4.0+ (boolean) indicates whether it is the first item of the sub-sections (for repeatable sections). |
|
| 67 | + '_is_last_index' => false, // 3.4.0+ (boolean) indicates whether it is the last item of the sub-sections (for repeatable sections). |
|
| 68 | 68 | |
| 69 | - '_section_path' => '', // 3.7.0+ (string) e.g. my_section|nested_section |
|
| 70 | - '_section_path_array' => '', // 3.7.0+ (array) an array version of the above section_path argument. Numerically indexed. |
|
| 71 | - '_nested_depth' => 0, // 3.7.0+ (integer) the nested level of the section |
|
| 69 | + '_section_path' => '', // 3.7.0+ (string) e.g. my_section|nested_section |
|
| 70 | + '_section_path_array' => '', // 3.7.0+ (array) an array version of the above section_path argument. Numerically indexed. |
|
| 71 | + '_nested_depth' => 0, // 3.7.0+ (integer) the nested level of the section |
|
| 72 | 72 | |
| 73 | 73 | // 3.6.0+ - (object) the caller framework factory object. This allows the framework to access the factory property when rendering the section. |
| 74 | 74 | // 3.7.0+ It no longer stores a factory object but a form object. |
| 75 | 75 | '_caller_object' => null, |
| 76 | 76 | |
| 77 | - 'show_debug_info' => null, // 3.8.8+ (boolean) Whether to display debug information. Inherits the page/in-page-tab setting (actually the factory property value of `$bShowDebugInfo` which gets updated by the page/tab setting). |
|
| 77 | + 'show_debug_info' => null, // 3.8.8+ (boolean) Whether to display debug information. Inherits the page/in-page-tab setting (actually the factory property value of `$bShowDebugInfo` which gets updated by the page/tab setting). |
|
| 78 | 78 | |
| 79 | 79 | ); |
| 80 | 80 | |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | |
| 94 | 94 | public $oCaller = null; |
| 95 | 95 | |
| 96 | - public $bShowDebugInfo = true; // 3.8.8+ |
|
| 96 | + public $bShowDebugInfo = true; // 3.8.8+ |
|
| 97 | 97 | |
| 98 | 98 | /** |
| 99 | 99 | * Sets up properties. |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | $this->sCapability, |
| 108 | 108 | $this->iCountOfElements, |
| 109 | 109 | $this->oCaller, |
| 110 | - $this->bShowDebugInfo, // 3.8.8+ |
|
| 110 | + $this->bShowDebugInfo, // 3.8.8+ |
|
| 111 | 111 | ); |
| 112 | 112 | $this->aSectionset = $_aParameters[ 0 ]; |
| 113 | 113 | $this->sSectionPath = $_aParameters[ 1 ]; |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | $this->sCapability = $_aParameters[ 3 ]; |
| 116 | 116 | $this->iCountOfElements = $_aParameters[ 4 ]; |
| 117 | 117 | $this->oCaller = $_aParameters[ 5 ]; |
| 118 | - $this->bShowDebugInfo = $_aParameters[ 6 ]; // 3.8.8+ |
|
| 118 | + $this->bShowDebugInfo = $_aParameters[ 6 ]; // 3.8.8+ |
|
| 119 | 119 | |
| 120 | 120 | } |
| 121 | 121 | |
@@ -130,16 +130,16 @@ discard block |
||
| 130 | 130 | $_aSectionPath = explode( '|', $this->sSectionPath ); |
| 131 | 131 | $_aSectionset = $this->uniteArrays( |
| 132 | 132 | array( |
| 133 | - '_fields_type' => $this->sStructureType, // @deprecated 3.7.0+ |
|
| 134 | - '_structure_type' => $this->sStructureType, // 3.7.0+ |
|
| 135 | - '_section_path' => $this->sSectionPath, // 3.7.0+ |
|
| 133 | + '_fields_type' => $this->sStructureType, // @deprecated 3.7.0+ |
|
| 134 | + '_structure_type' => $this->sStructureType, // 3.7.0+ |
|
| 135 | + '_section_path' => $this->sSectionPath, // 3.7.0+ |
|
| 136 | 136 | '_section_path_array' => $_aSectionPath, |
| 137 | - '_nested_depth' => count( $_aSectionPath ) - 1, // 3.7.0+ - zero base |
|
| 137 | + '_nested_depth' => count( $_aSectionPath ) - 1, // 3.7.0+ - zero base |
|
| 138 | 138 | ) |
| 139 | 139 | + $this->aSectionset |
| 140 | 140 | + array( |
| 141 | 141 | 'capability' => $this->sCapability, |
| 142 | - 'show_debug_info' => $this->bShowDebugInfo, // 3.8.8+ |
|
| 142 | + 'show_debug_info' => $this->bShowDebugInfo, // 3.8.8+ |
|
| 143 | 143 | ), |
| 144 | 144 | self::$aStructure |
| 145 | 145 | ); |