@@ -32,9 +32,9 @@ discard block |
||
| 32 | 32 | * @param string $sStructureType The type of object. Currently 'post_meta_box' or 'user_meta' is accepted. |
| 33 | 33 | * @return void |
| 34 | 34 | */ |
| 35 | - public function updateMetaDataByType( $iObjectID, array $aInput, array $aSavedMeta, $sStructureType='post_meta_box' ) { |
|
| 35 | + public function updateMetaDataByType( $iObjectID, array $aInput, array $aSavedMeta, $sStructureType = 'post_meta_box' ) { |
|
| 36 | 36 | |
| 37 | - if ( ! $iObjectID ) { |
|
| 37 | + if ( !$iObjectID ) { |
|
| 38 | 38 | return; |
| 39 | 39 | } |
| 40 | 40 | |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | 'user_meta' => 'update_user_meta', |
| 44 | 44 | 'term_meta' => 'update_term_meta', |
| 45 | 45 | ); |
| 46 | - if ( ! in_array( $sStructureType, array_keys( $_aFunctionNameMapByFieldsType ) ) ) { |
|
| 46 | + if ( !in_array( $sStructureType, array_keys( $_aFunctionNameMapByFieldsType ) ) ) { |
|
| 47 | 47 | return; |
| 48 | 48 | } |
| 49 | 49 | $_sFunctionName = $this->getElement( $_aFunctionNameMapByFieldsType, $sStructureType ); |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | $_vSavedValue = $this->getElement( |
| 82 | 82 | $aSavedMeta, // subject |
| 83 | - $_sSectionOrFieldID, // dimensional keys |
|
| 83 | + $_sSectionOrFieldID, // dimensional keys |
|
| 84 | 84 | null // default value |
| 85 | 85 | ); |
| 86 | 86 | |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | */ |
| 75 | 75 | private function _updateMetaDatumByFunctionName( $iObjectID, $_vValue, array $aSavedMeta, $_sSectionOrFieldID, $_sFunctionName ) { |
| 76 | 76 | |
| 77 | - if ( is_null( $_vValue ) ) { |
|
| 77 | + if ( is_null( $_vValue ) ) { |
|
| 78 | 78 | return; |
| 79 | 79 | } |
| 80 | 80 | |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | |
| 87 | 87 | // PHP can compare even array contents with the == operator. See http://www.php.net/manual/en/language.operators.array.php |
| 88 | 88 | // if the input value and the saved meta value are the same, no need to update it. |
| 89 | - if ( $_vValue == $_vSavedValue ) { |
|
| 89 | + if ( $_vValue == $_vSavedValue ) { |
|
| 90 | 90 | return; |
| 91 | 91 | } |
| 92 | 92 | |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | // For form sections, a dummy key is set |
| 59 | 59 | if ( '__dummy_option_key' === $_aDimensionalKeys[ 0 ] ) { |
| 60 | - array_shift( $_aDimensionalKeys ); |
|
| 60 | + array_shift( $_aDimensionalKeys ); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | // The first element is the option key for the `admin_page` field type and section or field dimensional keys follow. |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | // If the first element is a string, it is a inline mixed field definition. |
| 132 | - return is_array( self::getElement( $aFieldset[ 'content' ], 0 ) ); |
|
| 132 | + return is_array( self::getElement( $aFieldset[ 'content' ], 0 ) ); |
|
| 133 | 133 | |
| 134 | 134 | } |
| 135 | 135 | |
@@ -43,15 +43,15 @@ discard block |
||
| 43 | 43 | * For the `admin_page` fields type, an option key is prepended. |
| 44 | 44 | * For `page_meta_box`, no prepended element and it starts with the section or field ID. |
| 45 | 45 | */ |
| 46 | - static public function getInputsUnset( array $aInputs, $sFieldsType, $iSkipDepth=0 ) { |
|
| 46 | + static public function getInputsUnset( array $aInputs, $sFieldsType, $iSkipDepth = 0 ) { |
|
| 47 | 47 | |
| 48 | - $_sUnsetKey = '__unset_' . $sFieldsType; |
|
| 49 | - if ( ! isset( $_POST[ $_sUnsetKey ] ) ) { |
|
| 48 | + $_sUnsetKey = '__unset_'.$sFieldsType; |
|
| 49 | + if ( !isset( $_POST[ $_sUnsetKey ] ) ) { |
|
| 50 | 50 | return $aInputs; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | $_aUnsetElements = array_unique( $_POST[ $_sUnsetKey ] ); |
| 54 | - foreach( $_aUnsetElements as $_sFlatInputName ) { |
|
| 54 | + foreach ( $_aUnsetElements as $_sFlatInputName ) { |
|
| 55 | 55 | |
| 56 | 56 | $_aDimensionalKeys = explode( '|', $_sFlatInputName ); |
| 57 | 57 | |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | // The first element is the option key for the `admin_page` field type and section or field dimensional keys follow. |
| 64 | - for ( $_i = 0; $_i < $iSkipDepth; $_i++) { |
|
| 64 | + for ( $_i = 0; $_i < $iSkipDepth; $_i++ ) { |
|
| 65 | 65 | unset( $_aDimensionalKeys[ $_i ] ); |
| 66 | 66 | } |
| 67 | 67 | |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | */ |
| 119 | 119 | static public function hasNestedFields( $aFieldset ) { |
| 120 | 120 | |
| 121 | - if ( ! self::hasFieldDefinitionsInContent( $aFieldset ) ) { |
|
| 121 | + if ( !self::hasFieldDefinitionsInContent( $aFieldset ) ) { |
|
| 122 | 122 | return false; |
| 123 | 123 | } |
| 124 | 124 | // At this point, the `content` argument contains either the definition of nested fields or inline-mixed fields. |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | */ |
| 141 | 141 | static public function hasFieldDefinitionsInContent( $aFieldset ) { |
| 142 | 142 | |
| 143 | - if ( ! isset( $aFieldset[ 'content' ] ) ) { |
|
| 143 | + if ( !isset( $aFieldset[ 'content' ] ) ) { |
|
| 144 | 144 | return false; |
| 145 | 145 | } |
| 146 | 146 | if ( empty( $aFieldset[ 'content' ] ) ) { |
@@ -175,10 +175,10 @@ discard block |
||
| 175 | 175 | * @since 3.8.13 |
| 176 | 176 | */ |
| 177 | 177 | static public function isDynamicField( $aField ) { |
| 178 | - if ( ! empty( $aField[ 'repeatable' ] ) ) { |
|
| 178 | + if ( !empty( $aField[ 'repeatable' ] ) ) { |
|
| 179 | 179 | return true; |
| 180 | 180 | } |
| 181 | - if ( ! empty( $aField[ 'sortable' ] ) ) { |
|
| 181 | + if ( !empty( $aField[ 'sortable' ] ) ) { |
|
| 182 | 182 | return true; |
| 183 | 183 | } |
| 184 | 184 | return false; |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | if ( empty( $sString ) ) { |
| 208 | 208 | return $sString; |
| 209 | 209 | } |
| 210 | - return $sString . '|'; |
|
| 210 | + return $sString.'|'; |
|
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | /** |
@@ -223,17 +223,17 @@ discard block |
||
| 223 | 223 | */ |
| 224 | 224 | static public function getFieldsetReformattedBySubFieldIndex( $aFieldset, $iSubFieldIndex, $bHasSubFields, $aParentFieldset ) { |
| 225 | 225 | |
| 226 | - $_oCallerForm = $aFieldset[ '_caller_object' ]; |
|
| 226 | + $_oCallerForm = $aFieldset[ '_caller_object' ]; |
|
| 227 | 227 | |
| 228 | 228 | // Add sub-field index to the parent field path for repeated nested items. |
| 229 | - $aFieldset[ '_parent_field_path' ] = self::getAOrB( |
|
| 229 | + $aFieldset[ '_parent_field_path' ] = self::getAOrB( |
|
| 230 | 230 | $bHasSubFields, |
| 231 | - $aFieldset[ '_parent_field_path' ] . '|' . $iSubFieldIndex, |
|
| 231 | + $aFieldset[ '_parent_field_path' ].'|'.$iSubFieldIndex, |
|
| 232 | 232 | $aFieldset[ '_parent_field_path' ] |
| 233 | 233 | ); |
| 234 | - $aFieldset[ '_parent_tag_id' ] = self::getAOrB( |
|
| 234 | + $aFieldset[ '_parent_tag_id' ] = self::getAOrB( |
|
| 235 | 235 | $bHasSubFields, |
| 236 | - $aParentFieldset[ 'tag_id' ] . '__' . $iSubFieldIndex, |
|
| 236 | + $aParentFieldset[ 'tag_id' ].'__'.$iSubFieldIndex, |
|
| 237 | 237 | $aParentFieldset[ 'tag_id' ] |
| 238 | 238 | ); |
| 239 | 239 | |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | $aFieldset, |
| 243 | 243 | $aFieldset[ '_structure_type' ], |
| 244 | 244 | $aFieldset[ 'capability' ], |
| 245 | - ( integer ) $iSubFieldIndex + 1, // 1-based count (not index) |
|
| 245 | + ( integer ) $iSubFieldIndex + 1, // 1-based count (not index) |
|
| 246 | 246 | $aFieldset[ '_subsection_index' ], |
| 247 | 247 | $aFieldset[ '_is_section_repeatable' ], |
| 248 | 248 | $aFieldset[ '_caller_object' ] |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | |
| 252 | 252 | $_oFieldsetOutputFormatter = new AdminPageFramework_Form_Model___Format_FieldsetOutput( |
| 253 | 253 | $aFieldset, |
| 254 | - $aFieldset[ '_section_index' ], // `_section_index` is defined in the ...FieldsetOutput class. Since this is a nested item, it should be already set. |
|
| 254 | + $aFieldset[ '_section_index' ], // `_section_index` is defined in the ...FieldsetOutput class. Since this is a nested item, it should be already set. |
|
| 255 | 255 | $_oCallerForm->aFieldTypeDefinitions |
| 256 | 256 | ); |
| 257 | 257 | return $_oFieldsetOutputFormatter->get(); |
@@ -288,12 +288,12 @@ discard block |
||
| 288 | 288 | if ( empty( $aArguments ) ) { |
| 289 | 289 | return ''; |
| 290 | 290 | } |
| 291 | - if ( self::hasBeenCalled( 'disabled_repeatable_elements_modal_' . $sBoxElementID ) ) { |
|
| 291 | + if ( self::hasBeenCalled( 'disabled_repeatable_elements_modal_'.$sBoxElementID ) ) { |
|
| 292 | 292 | return ''; |
| 293 | 293 | } |
| 294 | 294 | add_thickbox(); // to display a message to the user. |
| 295 | 295 | return "<div id='{$sBoxElementID}' style='display:none'>" |
| 296 | - . "<p>" . $aArguments[ 'message' ] . "</p>" |
|
| 296 | + . "<p>".$aArguments[ 'message' ]."</p>" |
|
| 297 | 297 | . "</div>"; |
| 298 | 298 | |
| 299 | 299 | } |
@@ -75,13 +75,13 @@ discard block |
||
| 75 | 75 | |
| 76 | 76 | $_sPropertyClassName = isset( $this->aSubClassNames[ 'oProp' ] ) |
| 77 | 77 | ? $this->aSubClassNames[ 'oProp' ] |
| 78 | - : 'AdminPageFramework_Property_' . $this->_sStructureType; |
|
| 78 | + : 'AdminPageFramework_Property_'.$this->_sStructureType; |
|
| 79 | 79 | $this->oProp = new $_sPropertyClassName( |
| 80 | - $this, // caller object |
|
| 81 | - null, // the caller script path |
|
| 82 | - $sThisClassName, // class name |
|
| 83 | - $sCapability, // capability |
|
| 84 | - $sTextDomain, // text domain |
|
| 80 | + $this, // caller object |
|
| 81 | + null, // the caller script path |
|
| 82 | + $sThisClassName, // class name |
|
| 83 | + $sCapability, // capability |
|
| 84 | + $sTextDomain, // text domain |
|
| 85 | 85 | $this->_sStructureType // fields type |
| 86 | 86 | ); |
| 87 | 87 | |
@@ -103,22 +103,22 @@ discard block |
||
| 103 | 103 | * @since 3.8.17 |
| 104 | 104 | */ |
| 105 | 105 | private function ___getConstructorParametersUsedForThisClassName( $sClassName ) { |
| 106 | - if ( ! isset( $GLOBALS[ 'wp_widget_factory' ] ) ) { |
|
| 106 | + if ( !isset( $GLOBALS[ 'wp_widget_factory' ] ) ) { |
|
| 107 | 107 | return array(); |
| 108 | 108 | } |
| 109 | - if ( ! is_object( $GLOBALS[ 'wp_widget_factory' ] ) ) { |
|
| 109 | + if ( !is_object( $GLOBALS[ 'wp_widget_factory' ] ) ) { |
|
| 110 | 110 | return array(); |
| 111 | 111 | } |
| 112 | - if ( ! isset( $GLOBALS[ 'wp_widget_factory' ]->widgets[ $sClassName ] ) ) { |
|
| 112 | + if ( !isset( $GLOBALS[ 'wp_widget_factory' ]->widgets[ $sClassName ] ) ) { |
|
| 113 | 113 | return array(); |
| 114 | 114 | } |
| 115 | 115 | // At this point, the widget of the given name is already registered. |
| 116 | 116 | $_oWPWidget = $GLOBALS[ 'wp_widget_factory' ]->widgets[ $sClassName ]; |
| 117 | 117 | return array( |
| 118 | - $_oWPWidget->oCaller->oProp->sWidgetTitle, // 1. widget title, |
|
| 119 | - $_oWPWidget->oCaller->oProp->aWidgetArguments, // 2. widget arguments |
|
| 120 | - $_oWPWidget->oCaller->oProp->sCapability, // 3. capability |
|
| 121 | - $_oWPWidget->oCaller->oProp->sTextDomain, // 4. text domain |
|
| 118 | + $_oWPWidget->oCaller->oProp->sWidgetTitle, // 1. widget title, |
|
| 119 | + $_oWPWidget->oCaller->oProp->aWidgetArguments, // 2. widget arguments |
|
| 120 | + $_oWPWidget->oCaller->oProp->sCapability, // 3. capability |
|
| 121 | + $_oWPWidget->oCaller->oProp->sTextDomain, // 4. text domain |
|
| 122 | 122 | ); |
| 123 | 123 | } |
| 124 | 124 | |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | * @since 3.2.0 |
| 27 | 27 | * @return void |
| 28 | 28 | */ |
| 29 | - public function __construct( $oCaller, $sWidgetTitle, array $aArguments=array() ) { |
|
| 29 | + public function __construct( $oCaller, $sWidgetTitle, array $aArguments=array() ) { |
|
| 30 | 30 | |
| 31 | 31 | $aArguments = $aArguments |
| 32 | 32 | + array( |
@@ -34,14 +34,14 @@ discard block |
||
| 34 | 34 | 'description' => '', |
| 35 | 35 | ); |
| 36 | 36 | |
| 37 | - parent::__construct( |
|
| 37 | + parent::__construct( |
|
| 38 | 38 | $oCaller->oProp->sClassName, // base id |
| 39 | 39 | $sWidgetTitle, // widget title |
| 40 | 40 | $aArguments // widget arguments |
| 41 | 41 | ); |
| 42 | 42 | $this->oCaller = $oCaller; |
| 43 | 43 | |
| 44 | - } |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | 46 | /** |
| 47 | 47 | * Displays the widget contents in the front end. |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | * whether the title should be visible or not depending on the content. |
| 52 | 52 | * @return void |
| 53 | 53 | */ |
| 54 | - public function widget( $aArguments, $aFormData ) { |
|
| 54 | + public function widget( $aArguments, $aFormData ) { |
|
| 55 | 55 | |
| 56 | 56 | echo $aArguments[ 'before_widget' ]; |
| 57 | 57 | |
@@ -74,9 +74,9 @@ discard block |
||
| 74 | 74 | |
| 75 | 75 | echo $_sContent; |
| 76 | 76 | |
| 77 | - echo $aArguments[ 'after_widget' ]; |
|
| 77 | + echo $aArguments[ 'after_widget' ]; |
|
| 78 | 78 | |
| 79 | - } |
|
| 79 | + } |
|
| 80 | 80 | /** |
| 81 | 81 | * Returns the widget title. |
| 82 | 82 | * |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | if ( ! $_sTitle ) { |
| 106 | 106 | return ''; |
| 107 | 107 | } |
| 108 | - return $aArguments['before_title'] |
|
| 108 | + return $aArguments['before_title'] |
|
| 109 | 109 | . $_sTitle |
| 110 | 110 | . $aArguments['after_title']; |
| 111 | 111 | |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | * @since 3.2.0 |
| 118 | 118 | * @return mixed The validated form data. The type should be an array but it is dealt by the framework user it will be unknown. |
| 119 | 119 | */ |
| 120 | - public function update( $aSubmittedFormData, $aSavedFormData ) { |
|
| 120 | + public function update( $aSubmittedFormData, $aSavedFormData ) { |
|
| 121 | 121 | |
| 122 | 122 | $aSubmittedFormData = $this->oCaller->oUtil->addAndApplyFilters( |
| 123 | 123 | $this->oCaller, |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | ); |
| 132 | 132 | return $this->oCaller->oForm->getInputsUnset( $aSubmittedFormData, $this->oCaller->oForm->sStructureType ); // 3.8.17+ |
| 133 | 133 | |
| 134 | - } |
|
| 134 | + } |
|
| 135 | 135 | |
| 136 | 136 | /** |
| 137 | 137 | * Constructs the widget form with the given saved form data. |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | * |
| 143 | 143 | * @return void |
| 144 | 144 | */ |
| 145 | - public function form( $aSavedFormData ) { |
|
| 145 | + public function form( $aSavedFormData ) { |
|
| 146 | 146 | |
| 147 | 147 | $this->oCaller->oForm->aCallbacks = $this->_getFormCallbacks() + $this->oCaller->oForm->aCallbacks; |
| 148 | 148 | |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | $this->oCaller->oForm->aSectionsets = $_aSectionsets; |
| 182 | 182 | $this->oCaller->oForm->aFieldsets = $_aFieldsets; |
| 183 | 183 | |
| 184 | - } |
|
| 184 | + } |
|
| 185 | 185 | /** |
| 186 | 186 | * Calls the load() method of the caller factory object. |
| 187 | 187 | * |
@@ -256,7 +256,7 @@ |
||
| 256 | 256 | |
| 257 | 257 | } |
| 258 | 258 | |
| 259 | - /** |
|
| 259 | + /** |
|
| 260 | 260 | * Extracts meta box form fields options array from the given options array of an admin page. |
| 261 | 261 | * |
| 262 | 262 | * @since 3.5.6 |
@@ -45,11 +45,11 @@ discard block |
||
| 45 | 45 | public function _replyToSetUpValidationHooks( $oScreen ) { |
| 46 | 46 | |
| 47 | 47 | // Validation hooks |
| 48 | - foreach( $this->oProp->aPageSlugs as $_sIndexOrPageSlug => $_asTabArrayOrPageSlug ) { |
|
| 48 | + foreach ( $this->oProp->aPageSlugs as $_sIndexOrPageSlug => $_asTabArrayOrPageSlug ) { |
|
| 49 | 49 | |
| 50 | 50 | if ( is_scalar( $_asTabArrayOrPageSlug ) ) { |
| 51 | 51 | $_sPageSlug = $_asTabArrayOrPageSlug; |
| 52 | - add_filter( "validation_saved_options_without_dynamic_elements_{$_sPageSlug}", array( $this, '_replyToFilterPageOptionsWODynamicElements' ), 10, 2 ); // 3.4.1+ |
|
| 52 | + add_filter( "validation_saved_options_without_dynamic_elements_{$_sPageSlug}", array( $this, '_replyToFilterPageOptionsWODynamicElements' ), 10, 2 ); // 3.4.1+ |
|
| 53 | 53 | add_filter( "validation_{$_sPageSlug}", array( $this, '_replyToValidateOptions' ), 10, 4 ); |
| 54 | 54 | add_filter( "options_update_status_{$_sPageSlug}", array( $this, '_replyToModifyOptionsUpdateStatus' ) ); |
| 55 | 55 | continue; |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | // At this point, the array key is the page slug. It means the user specified the tab(s). |
| 59 | 59 | $_sPageSlug = $_sIndexOrPageSlug; |
| 60 | 60 | $_aTabs = $_asTabArrayOrPageSlug; |
| 61 | - foreach( $_aTabs as $_sTabSlug ) { |
|
| 61 | + foreach ( $_aTabs as $_sTabSlug ) { |
|
| 62 | 62 | add_filter( "validation_{$_sPageSlug}_{$_sTabSlug}", array( $this, '_replyToValidateOptions' ), 10, 4 ); |
| 63 | 63 | add_filter( "validation_saved_options_without_dynamic_elements_{$_sPageSlug}_{$_sTabSlug}", array( $this, '_replyToFilterPageOptionsWODynamicElements' ), 10, 2 ); // 3.4.1+ |
| 64 | 64 | add_filter( "options_update_status_{$_sPageSlug}_{$_sTabSlug}", array( $this, '_replyToModifyOptionsUpdateStatus' ) ); |
@@ -78,9 +78,9 @@ discard block |
||
| 78 | 78 | * @return void |
| 79 | 79 | * @callback action add_meta_boxes |
| 80 | 80 | */ |
| 81 | - public function _replyToRegisterMetaBoxes( $sPageHook='' ) { |
|
| 82 | - foreach( $this->oProp->aPageSlugs as $_sKey => $_asPage ) { |
|
| 83 | - if ( is_string( $_asPage ) ) { |
|
| 81 | + public function _replyToRegisterMetaBoxes( $sPageHook = '' ) { |
|
| 82 | + foreach ( $this->oProp->aPageSlugs as $_sKey => $_asPage ) { |
|
| 83 | + if ( is_string( $_asPage ) ) { |
|
| 84 | 84 | $this->_registerMetaBox( $_asPage ); |
| 85 | 85 | continue; |
| 86 | 86 | } |
@@ -96,8 +96,8 @@ discard block |
||
| 96 | 96 | * @return void |
| 97 | 97 | */ |
| 98 | 98 | private function _registerMetaBoxes( $sPageSlug, $asPage ) { |
| 99 | - foreach( $this->oUtil->getAsArray( $asPage ) as $_sTabSlug ) { |
|
| 100 | - if ( ! $this->oProp->isCurrentTab( $_sTabSlug ) ) { |
|
| 99 | + foreach ( $this->oUtil->getAsArray( $asPage ) as $_sTabSlug ) { |
|
| 100 | + if ( !$this->oProp->isCurrentTab( $_sTabSlug ) ) { |
|
| 101 | 101 | continue; |
| 102 | 102 | } |
| 103 | 103 | $this->_registerMetaBox( $sPageSlug ); |
@@ -114,12 +114,12 @@ discard block |
||
| 114 | 114 | */ |
| 115 | 115 | private function _registerMetaBox( $sPageSlug ) { |
| 116 | 116 | add_meta_box( |
| 117 | - $this->oProp->sMetaBoxID, // id |
|
| 118 | - $this->oProp->sTitle, // title |
|
| 117 | + $this->oProp->sMetaBoxID, // id |
|
| 118 | + $this->oProp->sTitle, // title |
|
| 119 | 119 | array( $this, '_replyToPrintMetaBoxContents' ), // callback |
| 120 | 120 | $this->oProp->_getScreenIDOfPage( $sPageSlug ), // screen ID |
| 121 | - $this->oProp->sContext, // context |
|
| 122 | - $this->oProp->sPriority, // priority |
|
| 121 | + $this->oProp->sContext, // context |
|
| 122 | + $this->oProp->sPriority, // priority |
|
| 123 | 123 | null // argument (deprecated) |
| 124 | 124 | ); |
| 125 | 125 | } |
@@ -167,17 +167,17 @@ discard block |
||
| 167 | 167 | |
| 168 | 168 | $_aNewMetaBoxInputs = $this->oForm->getSubmittedData( $_POST ); |
| 169 | 169 | $_aOldMetaBoxInputs = $this->oUtil->castArrayContents( |
| 170 | - $this->oForm->getDataStructureFromAddedFieldsets(), // model |
|
| 170 | + $this->oForm->getDataStructureFromAddedFieldsets(), // model |
|
| 171 | 171 | $aOldPageOptions // data source |
| 172 | 172 | ); |
| 173 | 173 | |
| 174 | 174 | // Apply filters - third party scripts will have access to the input. |
| 175 | 175 | $_aNewMetaBoxInputsRaw = $_aNewMetaBoxInputs; // copy one for validation errors. |
| 176 | 176 | $_aNewMetaBoxInputs = call_user_func_array( |
| 177 | - array( $this, 'validate' ), // triggers __call() |
|
| 177 | + array( $this, 'validate' ), // triggers __call() |
|
| 178 | 178 | array( $_aNewMetaBoxInputs, $_aOldMetaBoxInputs, $this, $aSubmitInfo ) |
| 179 | 179 | ); // 3.5.3+ |
| 180 | - $_aNewMetaBoxInputs = $this->oUtil->addAndApplyFilters( |
|
| 180 | + $_aNewMetaBoxInputs = $this->oUtil->addAndApplyFilters( |
|
| 181 | 181 | $this, |
| 182 | 182 | "validation_{$this->oProp->sClassName}", |
| 183 | 183 | $_aNewMetaBoxInputs, |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | */ |
| 216 | 216 | public function _replyToModifyOptionsUpdateStatus( $aStatus ) { |
| 217 | 217 | |
| 218 | - if ( ! $this->hasFieldError() ) { |
|
| 218 | + if ( !$this->hasFieldError() ) { |
|
| 219 | 219 | return $aStatus; |
| 220 | 220 | } |
| 221 | 221 | return array( |
@@ -245,12 +245,12 @@ discard block |
||
| 245 | 245 | |
| 246 | 246 | $_aPageOptions = $this->oUtil->addAndApplyFilter( |
| 247 | 247 | $this, // the caller factory object |
| 248 | - 'options_' . $this->oProp->sClassName, |
|
| 248 | + 'options_'.$this->oProp->sClassName, |
|
| 249 | 249 | $_aPageOptions |
| 250 | 250 | ); |
| 251 | 251 | |
| 252 | 252 | return $this->oUtil->castArrayContents( |
| 253 | - $this->oForm->getDataStructureFromAddedFieldsets(), // model |
|
| 253 | + $this->oForm->getDataStructureFromAddedFieldsets(), // model |
|
| 254 | 254 | $_aPageOptions // data source |
| 255 | 255 | ); |
| 256 | 256 | |
@@ -267,9 +267,9 @@ discard block |
||
| 267 | 267 | private function _getPageMetaBoxOptionsFromPageOptions( array $aPageOptions, array $aFieldsets ) { |
| 268 | 268 | |
| 269 | 269 | $_aOptions = array(); |
| 270 | - foreach( $aFieldsets as $_sSectionID => $_aFieldsets ) { |
|
| 271 | - if ( '_default' === $_sSectionID ) { |
|
| 272 | - foreach( $_aFieldsets as $_aField ) { |
|
| 270 | + foreach ( $aFieldsets as $_sSectionID => $_aFieldsets ) { |
|
| 271 | + if ( '_default' === $_sSectionID ) { |
|
| 272 | + foreach ( $_aFieldsets as $_aField ) { |
|
| 273 | 273 | if ( array_key_exists( $_aField[ 'field_id' ], $aPageOptions ) ) { |
| 274 | 274 | $_aOptions[ $_aField[ 'field_id' ] ] = $aPageOptions[ $_aField[ 'field_id' ] ]; |
| 275 | 275 | } |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | $this->oFactory |
| 89 | 89 | ), |
| 90 | 90 | 'aStoredTabDataWODynamicElements' => array(), |
| 91 | - 'aEmbeddedDataWODynamicElements' => array(), // stores page meta box field options. This will be updated inside the validation methods. |
|
| 91 | + 'aEmbeddedDataWODynamicElements' => array(), // stores page meta box field options. This will be updated inside the validation methods. |
|
| 92 | 92 | 'aSubmitInformation' => $aSubmitInformation, // 3.5.0+ |
| 93 | 93 | ); |
| 94 | 94 | |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | call_user_func_array( |
| 104 | 104 | array( $this->oFactory, 'validate' ), // triggers __call() |
| 105 | 105 | array( $_aData[ 'aInput' ], $_aData[ 'aStoredData' ], $this->oFactory, $_aData[ 'aSubmitInformation' ] ) |
| 106 | - ), // 3.5.3+ |
|
| 106 | + ), // 3.5.3+ |
|
| 107 | 107 | $_aData[ 'aStoredData' ], |
| 108 | 108 | $_aData[ 'aSubmitInformation' ] // 3.5.0+ |
| 109 | 109 | ); |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | |
| 116 | 116 | // If everything fine, return the filtered input data. |
| 117 | 117 | $this->_bHasFieldErrors = $this->oFactory->hasFieldError(); |
| 118 | - if ( ! $this->_bHasFieldErrors ) { |
|
| 118 | + if ( !$this->_bHasFieldErrors ) { |
|
| 119 | 119 | return $_aInput; |
| 120 | 120 | } |
| 121 | 121 | |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | ); |
| 130 | 130 | |
| 131 | 131 | // Go to the catch clause. |
| 132 | - $_oException = new Exception( 'aReturn' ); // the property name to return from the catch clause. |
|
| 132 | + $_oException = new Exception( 'aReturn' ); // the property name to return from the catch clause. |
|
| 133 | 133 | $_oException->aReturn = $_aInput; |
| 134 | 134 | throw $_oException; |
| 135 | 135 | |
@@ -153,22 +153,22 @@ discard block |
||
| 153 | 153 | */ |
| 154 | 154 | private function _validateEachField( array $aData, array $aInputsToParse ) { |
| 155 | 155 | |
| 156 | - foreach( $aInputsToParse as $_sID => $_aSectionOrFields ) { // $_sID is either a section id or a field id |
|
| 156 | + foreach ( $aInputsToParse as $_sID => $_aSectionOrFields ) { // $_sID is either a section id or a field id |
|
| 157 | 157 | |
| 158 | 158 | // For each section |
| 159 | 159 | if ( $this->oFactory->oForm->isSection( $_sID ) ) { |
| 160 | 160 | |
| 161 | 161 | // If the parsing item does not belong to the current page, do not call the validation callback method. |
| 162 | - if ( ! $this->_isValidSection( $_sID, $aData[ 'sPageSlug' ], $aData[ 'sTabSlug' ] ) ) { |
|
| 162 | + if ( !$this->_isValidSection( $_sID, $aData[ 'sPageSlug' ], $aData[ 'sTabSlug' ] ) ) { |
|
| 163 | 163 | continue; |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | // Call the validation callback method. |
| 167 | - foreach( $_aSectionOrFields as $_sFieldID => $_aFields ) { // For fields |
|
| 167 | + foreach ( $_aSectionOrFields as $_sFieldID => $_aFields ) { // For fields |
|
| 168 | 168 | $aData[ 'aInput' ][ $_sID ][ $_sFieldID ] = $this->_getValidatedData( |
| 169 | 169 | "validation_{$this->oFactory->oProp->sClassName}_{$_sID}_{$_sFieldID}", |
| 170 | 170 | $aData[ 'aInput' ][ $_sID ][ $_sFieldID ], |
| 171 | - $this->getElement( $aData, array( 'aStoredData', $_sID, $_sFieldID ), null ), // isset( $aData[ 'aStoredData' ][ $_sID ][ $_sFieldID ] ) ? $aData[ 'aStoredData' ][ $_sID ][ $_sFieldID ] : null, |
|
| 171 | + $this->getElement( $aData, array( 'aStoredData', $_sID, $_sFieldID ), null ), // isset( $aData[ 'aStoredData' ][ $_sID ][ $_sFieldID ] ) ? $aData[ 'aStoredData' ][ $_sID ][ $_sFieldID ] : null, |
|
| 172 | 172 | $aData[ 'aSubmitInformation' ] // 3.5.0+ |
| 173 | 173 | ); |
| 174 | 174 | } |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | $aData[ 'aInput' ][ $_sID ] = $this->_getValidatedData( |
| 190 | 190 | "validation_{$this->oFactory->oProp->sClassName}_{$_sID}", |
| 191 | 191 | $_aSectionInput, |
| 192 | - $this->getElement( $aData, array( 'aStoredData', $_sID ), null ), // isset( $aData[ 'aStoredData' ][ $_sID ] ) ? $aData[ 'aStoredData' ][ $_sID ] : null, |
|
| 192 | + $this->getElement( $aData, array( 'aStoredData', $_sID ), null ), // isset( $aData[ 'aStoredData' ][ $_sID ] ) ? $aData[ 'aStoredData' ][ $_sID ] : null, |
|
| 193 | 193 | $aData[ 'aSubmitInformation' ] |
| 194 | 194 | ); |
| 195 | 195 | |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | // Check if the parsing item (the default section) belongs to the current page; if not, do not call the validation callback method. |
| 201 | - if ( ! $this->_isValidSection( '_default', $aData[ 'sPageSlug' ], $aData[ 'sTabSlug' ] ) ) { |
|
| 201 | + if ( !$this->_isValidSection( '_default', $aData[ 'sPageSlug' ], $aData[ 'sTabSlug' ] ) ) { |
|
| 202 | 202 | continue; |
| 203 | 203 | } |
| 204 | 204 | |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | $aData[ 'aInput' ][ $_sID ] = $this->_getValidatedData( |
| 207 | 207 | "validation_{$this->oFactory->oProp->sClassName}_{$_sID}", |
| 208 | 208 | $aData[ 'aInput' ][ $_sID ], |
| 209 | - $this->getElement( $aData, array( 'aStoredData', $_sID ), null ), // isset( $aData[ 'aStoredData' ][ $_sID ] ) ? $aData[ 'aStoredData' ][ $_sID ] : null, |
|
| 209 | + $this->getElement( $aData, array( 'aStoredData', $_sID ), null ), // isset( $aData[ 'aStoredData' ][ $_sID ] ) ? $aData[ 'aStoredData' ][ $_sID ] : null, |
|
| 210 | 210 | $aData[ 'aSubmitInformation' ] |
| 211 | 211 | ); |
| 212 | 212 | |
@@ -248,22 +248,22 @@ discard block |
||
| 248 | 248 | */ |
| 249 | 249 | private function _validateTabFields( array $aData ) { |
| 250 | 250 | |
| 251 | - if ( ! $aData[ 'sTabSlug' ] || ! $aData[ 'sPageSlug' ] ) { |
|
| 251 | + if ( !$aData[ 'sTabSlug' ] || !$aData[ 'sPageSlug' ] ) { |
|
| 252 | 252 | return $aData; |
| 253 | 253 | } |
| 254 | 254 | |
| 255 | - $aData[ 'aStoredTabData' ] = $this->oFactory->oForm->getTabOptions( |
|
| 255 | + $aData[ 'aStoredTabData' ] = $this->oFactory->oForm->getTabOptions( |
|
| 256 | 256 | $aData[ 'aStoredData' ], |
| 257 | 257 | $aData[ 'sPageSlug' ], |
| 258 | 258 | $aData[ 'sTabSlug' ] |
| 259 | 259 | ); // respects page meta box fields |
| 260 | - $aData[ 'aStoredTabData' ] = $this->addAndApplyFilter( |
|
| 260 | + $aData[ 'aStoredTabData' ] = $this->addAndApplyFilter( |
|
| 261 | 261 | $this->oFactory, |
| 262 | 262 | "validation_saved_options_{$aData[ 'sPageSlug' ]}_{$aData[ 'sTabSlug' ]}", |
| 263 | 263 | $aData[ 'aStoredTabData' ], |
| 264 | 264 | $this->oFactory |
| 265 | 265 | ); |
| 266 | - $_aOtherTabOptions = $this->oFactory->oForm->getOtherTabOptions( |
|
| 266 | + $_aOtherTabOptions = $this->oFactory->oForm->getOtherTabOptions( |
|
| 267 | 267 | $aData[ 'aStoredData' ], |
| 268 | 268 | $aData[ 'sPageSlug' ], |
| 269 | 269 | $aData[ 'sTabSlug' ] |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | */ |
| 318 | 318 | private function _validatePageFields( array $aData ) { |
| 319 | 319 | |
| 320 | - if ( ! $aData[ 'sPageSlug' ] ) { |
|
| 320 | + if ( !$aData[ 'sPageSlug' ] ) { |
|
| 321 | 321 | return $aData[ 'aInput' ]; |
| 322 | 322 | } |
| 323 | 323 | |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | $_aPageOptionsWODynamicElements = $this->addAndApplyFilter( |
| 330 | 330 | $this->oFactory, |
| 331 | 331 | "validation_saved_options_without_dynamic_elements_{$aData[ 'sPageSlug' ]}", |
| 332 | - $this->oFactory->oForm->getPageOptions( $aData[ 'aStoredDataWODynamicElements' ], $aData[ 'sPageSlug' ] ), // united with the in-page tab specific data in order to override the page-specific dynamic elements. |
|
| 332 | + $this->oFactory->oForm->getPageOptions( $aData[ 'aStoredDataWODynamicElements' ], $aData[ 'sPageSlug' ] ), // united with the in-page tab specific data in order to override the page-specific dynamic elements. |
|
| 333 | 333 | $this->oFactory |
| 334 | 334 | ); |
| 335 | 335 | |
@@ -342,15 +342,15 @@ discard block |
||
| 342 | 342 | // Validate the input data. |
| 343 | 343 | $aData[ 'aInput' ] = $this->_getValidatedData( |
| 344 | 344 | "validation_{$aData[ 'sPageSlug' ]}", |
| 345 | - $aData[ 'aInput' ], // new values |
|
| 346 | - $_aPageOptions, // stored page options |
|
| 345 | + $aData[ 'aInput' ], // new values |
|
| 346 | + $_aPageOptions, // stored page options |
|
| 347 | 347 | $aData[ 'aSubmitInformation' ] // submit information 3.5.0+ |
| 348 | 348 | ); |
| 349 | 349 | |
| 350 | 350 | // If it's in a tab-page, drop the elements which belong to the tab so that arrayed-options will not be merged such as multiple select options. |
| 351 | - $_aPageOptions = $aData[ 'sTabSlug' ] && ! empty( $aData[ 'aStoredTabData' ] ) |
|
| 351 | + $_aPageOptions = $aData[ 'sTabSlug' ] && !empty( $aData[ 'aStoredTabData' ] ) |
|
| 352 | 352 | ? $this->invertCastArrayContents( $_aPageOptions, $aData[ 'aStoredTabData' ] ) |
| 353 | - : ( ! $aData[ 'sTabSlug' ] // if the tab is not specified, do not merge the input array with the page options as the input array already includes the page options. This is for dynamic elements(repeatable sections). |
|
| 353 | + : ( !$aData[ 'sTabSlug' ] // if the tab is not specified, do not merge the input array with the page options as the input array already includes the page options. This is for dynamic elements(repeatable sections). |
|
| 354 | 354 | ? array() |
| 355 | 355 | : $_aPageOptions |
| 356 | 356 | ); |
@@ -405,13 +405,13 @@ discard block |
||
| 405 | 405 | * @param array $aStoredData The stored option. |
| 406 | 406 | * @param array $aSubmitInfo [3.5.0+] The form submit information such as the field ID of the pressed submit field. |
| 407 | 407 | */ |
| 408 | - private function _getValidatedData( $sFilterName, $aInputs, $aStoredData, $aSubmitInfo=array() ) { |
|
| 408 | + private function _getValidatedData( $sFilterName, $aInputs, $aStoredData, $aSubmitInfo = array() ) { |
|
| 409 | 409 | return $this->addAndApplyFilter( |
| 410 | - $this->oFactory, // caller |
|
| 411 | - $sFilterName, // hook name |
|
| 412 | - $aInputs, // 1st argument |
|
| 413 | - $aStoredData, // 2nd argument |
|
| 414 | - $this->oFactory, // 3rd argument |
|
| 410 | + $this->oFactory, // caller |
|
| 411 | + $sFilterName, // hook name |
|
| 412 | + $aInputs, // 1st argument |
|
| 413 | + $aStoredData, // 2nd argument |
|
| 414 | + $this->oFactory, // 3rd argument |
|
| 415 | 415 | $aSubmitInfo // 4th argument 3.5.0+ |
| 416 | 416 | ); |
| 417 | 417 | } |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | $this->oFactory = $oFactory; |
| 30 | 30 | |
| 31 | 31 | add_filter( |
| 32 | - "validation_pre_" . $this->oFactory->oProp->sClassName, |
|
| 32 | + "validation_pre_".$this->oFactory->oProp->sClassName, |
|
| 33 | 33 | array( $this, '_replyToValidateUserFormInputs' ), |
| 34 | 34 | 10, |
| 35 | 35 | 4 |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | $_sSubmitSectionID = $this->_getPressedSubmitButtonData( $_aSubmits, 'section_id' ); |
| 61 | 61 | |
| 62 | 62 | // Submit Information - [3.5.0+] this will be passed to validation callback methods. |
| 63 | - $_aSubmitsInformation = array( |
|
| 63 | + $_aSubmitsInformation = array( |
|
| 64 | 64 | 'page_slug' => $_sPageSlug, |
| 65 | 65 | 'tab_slug' => $_sTabSlug, |
| 66 | 66 | 'input_id' => $this->_getPressedSubmitButtonData( $_aSubmits, 'input_id' ), |
@@ -80,11 +80,11 @@ discard block |
||
| 80 | 80 | 'AdminPageFramework_Model__FormSubmission__Validator__Export', |
| 81 | 81 | 'AdminPageFramework_Model__FormSubmission__Validator__Reset', |
| 82 | 82 | 'AdminPageFramework_Model__FormSubmission__Validator__ResetConfirm', // 3.7.6+ Moved to after validation from before validation |
| 83 | - 'AdminPageFramework_Model__FormSubmission__Validator__ContactForm', // 3.7.6+ Moved to after validation from before validation |
|
| 83 | + 'AdminPageFramework_Model__FormSubmission__Validator__ContactForm', // 3.7.6+ Moved to after validation from before validation |
|
| 84 | 84 | 'AdminPageFramework_Model__FormSubmission__Validator__ContactFormConfirm', |
| 85 | 85 | |
| 86 | 86 | ); |
| 87 | - foreach( $_aClassNames as $_sClassName ) { |
|
| 87 | + foreach ( $_aClassNames as $_sClassName ) { |
|
| 88 | 88 | new $_sClassName( $this->oFactory ); |
| 89 | 89 | } |
| 90 | 90 | |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | |
| 94 | 94 | $this->addAndDoActions( |
| 95 | 95 | $this->oFactory, |
| 96 | - 'try_validation_before_' . $this->oFactory->oProp->sClassName, |
|
| 96 | + 'try_validation_before_'.$this->oFactory->oProp->sClassName, |
|
| 97 | 97 | $aInputs, |
| 98 | 98 | $aRawInputs, |
| 99 | 99 | $_aSubmits, |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | |
| 113 | 113 | $this->addAndDoActions( |
| 114 | 114 | $this->oFactory, |
| 115 | - 'try_validation_after_' . $this->oFactory->oProp->sClassName, |
|
| 115 | + 'try_validation_after_'.$this->oFactory->oProp->sClassName, |
|
| 116 | 116 | $aInputs, |
| 117 | 117 | $aRawInputs, |
| 118 | 118 | $_aSubmits, |