| 1 | <?php |
||
| 17 | class AdminPageFramework_Form___FieldError extends AdminPageFramework_WPUtility { |
||
|
2 ignored issues
–
show
|
|||
| 18 | |||
| 19 | /** |
||
| 20 | * Stores field errors. |
||
| 21 | * |
||
| 22 | * At the script termination, these will be saved as a transient in the database. |
||
| 23 | */ |
||
| 24 | static private $_aErrors = array(); |
||
|
1 ignored issue
–
show
|
|||
| 25 | |||
| 26 | public $sCallerID; |
||
| 27 | |||
| 28 | /** |
||
| 29 | * Sets up properties. |
||
| 30 | */ |
||
| 31 | public function __construct( $sCallerID ) { |
||
| 36 | |||
| 37 | /** |
||
| 38 | * Checks if a field error exists for the caller (factory class). |
||
| 39 | * |
||
| 40 | * @return boolean Whether or not a field error exists. |
||
| 41 | * @since DEVVER |
||
| 42 | */ |
||
| 43 | public function hasError() { |
||
| 46 | |||
| 47 | /** |
||
| 48 | * Sets the given message to be displayed in the next page load. |
||
| 49 | * |
||
| 50 | * This is used to inform users about the submitted input data, such as "Updated successfully." or "Problem occurred." etc. |
||
| 51 | * and normally used in validation callback methods. |
||
| 52 | * |
||
| 53 | * <h4>Example</h4> |
||
| 54 | * ` |
||
| 55 | * if ( ! $bVerified ) { |
||
| 56 | * $this->setFieldErrors( $aErrors ); |
||
| 57 | * $this->setSettingNotice( 'There was an error in your input.' ); |
||
| 58 | * return $aOldPageOptions; |
||
| 59 | * } |
||
| 60 | * ` |
||
| 61 | * @since DEVVER |
||
| 62 | * @access public |
||
| 63 | * @param string $sMessage the text message to be displayed. |
||
| 64 | * @param string $sType (optional) the type of the message, either "error" or "updated" is used. |
||
| 65 | * @param array $asAttributes (optional) the tag attribute array applied to the message container HTML element. If a string is given, it is used as the ID attribute value. |
||
| 66 | * @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. |
||
| 67 | * @return void |
||
| 68 | */ |
||
| 69 | public function set( $aErrors ) { |
||
| 84 | /** |
||
| 85 | * Saves the field error array into the transient (database options row). |
||
| 86 | * |
||
| 87 | * @since 3.0.4 |
||
| 88 | * @since DEVVER Moved from `AdminPageFramework_Factory_Model`. |
||
| 89 | * @internal |
||
| 90 | * @callback action shutdown |
||
| 91 | * @return void |
||
| 92 | */ |
||
| 93 | public function _replyToSaveFieldErrors() { |
||
| 103 | |||
| 104 | /** |
||
| 105 | * Returns the saved field errors. |
||
| 106 | * |
||
| 107 | * Retrieves the settings error array set by the user in the validation callback. |
||
| 108 | * |
||
| 109 | * @since DEVVER |
||
| 110 | * @param boolean $bDelete whether or not the transient should be deleted after retrieving it. |
||
| 111 | * @return array |
||
| 112 | */ |
||
| 113 | public function get() { |
||
| 131 | |||
| 132 | /** |
||
| 133 | * Deletes the field errors from the database. |
||
| 134 | * @since DEVVER |
||
| 135 | */ |
||
| 136 | public function delete() { |
||
| 139 | /** |
||
| 140 | * Deletes the field errors transient. |
||
| 141 | * |
||
| 142 | * @since 3.0.4 |
||
| 143 | * @callback action shutdown |
||
| 144 | * @since DEVVER Moved from `AdminPageFramework_Factory_Model`. |
||
| 145 | * @internal |
||
| 146 | */ |
||
| 147 | public function _replyToDeleteFieldErrors() { |
||
| 150 | |||
| 151 | } |
||
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.