/** * Validates the submitted form data. * * @since 3 */ public function validate($aInput, $aOldInput, $oAdminPage, $aSubmitInfo) { $_bVerified = true; $_aErrors = array(); // Sanitize the custom preview slug. $aInput['preview_post_type_slug'] = AmazonAutoLinks_Utility::sanitizeCharsForURLQueryKey(AmazonAutoLinks_Utility::getTrancatedString($aInput['preview_post_type_slug'], 20, '')); // An invalid value is found. Set a field error array and an admin notice and return the old values. if (!$_bVerified) { $oAdminPage->setFieldErrors($_aErrors); $oAdminPage->setSettingNotice(__('There was something wrong with your input.', 'amazon-auto-links')); return $aOldInput; } return $aInput; }
/** * Validates the submitted form data. * * @since 3 */ public function validate($aInput, $aOldInput, $oAdminPage, $aSubmitInfo) { $_bVerified = true; $_aErrors = array(); // Sanitize the query key. $aInput['cloak'] = AmazonAutoLinks_Utility::sanitizeCharsForURLQueryKey($aInput['cloak']); // An invalid value is found. Set a field error array and an admin notice and return the old values. if (!$_bVerified) { $oAdminPage->setFieldErrors($_aErrors); $oAdminPage->setSettingNotice(__('There was something wrong with your input.', 'amazon-auto-links')); return $aOldInput; } return $aInput; }