| 1 | <?php |
||
| 17 | class AdminPageFramework_Form___SubmitNotice extends AdminPageFramework_WPUtility { |
||
|
1 ignored issue
–
show
|
|||
| 18 | |||
| 19 | /** |
||
| 20 | * Stores form submit notifications. |
||
| 21 | * |
||
| 22 | * At the script termination, these will be saved as a transient in the database. |
||
| 23 | */ |
||
| 24 | static private $_aNotices = array(); |
||
| 25 | |||
| 26 | /** |
||
| 27 | * Checks if a submit notice has been set. |
||
| 28 | * |
||
| 29 | * This is used in the internal validation callback method to decide whether the system error or update notice should be added or not. |
||
| 30 | * If this method yields true, the framework discards the system message and displays the user set notification message. |
||
| 31 | * |
||
| 32 | * @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. |
||
| 33 | * @return boolean True if a setting notice is set; otherwise, false. |
||
| 34 | */ |
||
| 35 | public function hasNotice( $sType='' ) { |
||
| 58 | |||
| 59 | /** |
||
| 60 | * Sets the given message to be displayed in the next page load. |
||
| 61 | * |
||
| 62 | * This is used to inform users about the submitted input data, such as "Updated successfully." or "Problem occurred." etc. |
||
| 63 | * and normally used in validation callback methods. |
||
| 64 | * |
||
| 65 | * <h4>Example</h4> |
||
| 66 | * ` |
||
| 67 | * if ( ! $bVerified ) { |
||
| 68 | * $this->setFieldErrors( $aErrors ); |
||
| 69 | * $this->setSettingNotice( 'There was an error in your input.' ); |
||
| 70 | * return $aOldPageOptions; |
||
| 71 | * } |
||
| 72 | * ` |
||
| 73 | * @since DEVVER |
||
| 74 | * @access public |
||
| 75 | * @param string $sMessage the text message to be displayed. |
||
| 76 | * @param string $sType (optional) the type of the message, either "error" or "updated" is used. |
||
| 77 | * @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. |
||
| 78 | * @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. |
||
| 79 | * @return void |
||
| 80 | */ |
||
| 81 | public function set( $sMessage, $sType='error', $asAttributes=array(), $bOverride=true ) { |
||
| 114 | /** |
||
| 115 | * Saves the notification array set via the setSettingNotice() method. |
||
| 116 | * |
||
| 117 | * @since 3.0.4 |
||
| 118 | * @sine DEVVER Moved from `AdminPageFramework_Factory_Model`. |
||
| 119 | * @internal |
||
| 120 | * @callback action shutdown |
||
| 121 | * @return void |
||
| 122 | */ |
||
| 123 | public function _replyToSaveNotices() { |
||
| 132 | |||
| 133 | /** |
||
| 134 | * Outputs the stored submit notices in the database. |
||
| 135 | * @return void |
||
| 136 | */ |
||
| 137 | public function render() { |
||
| 157 | /** |
||
| 158 | * Displays settings notices. |
||
| 159 | * @since 3.5.3 |
||
| 160 | * @since DEVVER Moved from `AdminPageFramework_Factory_View`. Renamed from `_printSettingNotices()`. |
||
| 161 | * @internal |
||
| 162 | * @return void |
||
| 163 | */ |
||
| 164 | private function _printNotices( $aNotices ) { |
||
| 183 | |||
| 184 | } |
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.