| @@ 132-143 (lines=12) @@ | ||
| 129 | /** |
|
| 130 | * @param string $key |
|
| 131 | */ |
|
| 132 | public function mark_read( $key ) { |
|
| 133 | if ( ! isset( $this->messages[ $key ] ) ) { |
|
| 134 | return; |
|
| 135 | } |
|
| 136 | ||
| 137 | if ( ! isset( $this->messages[ $key ]['read'] ) ) { |
|
| 138 | $this->messages[ $key ]['read'] = array(); |
|
| 139 | } |
|
| 140 | $this->messages[ $key ]['read'][ get_current_user_id() ] = time(); |
|
| 141 | ||
| 142 | $this->update_list(); |
|
| 143 | } |
|
| 144 | ||
| 145 | /** |
|
| 146 | * @param string $key |
|
| @@ 161-177 (lines=17) @@ | ||
| 158 | /** |
|
| 159 | * @param string $key |
|
| 160 | */ |
|
| 161 | public function dismiss( $key ) { |
|
| 162 | if ( $key === 'all' ) { |
|
| 163 | $this->dismiss_all(); |
|
| 164 | return; |
|
| 165 | } |
|
| 166 | ||
| 167 | if ( ! isset( $this->messages[ $key ] ) ) { |
|
| 168 | return; |
|
| 169 | } |
|
| 170 | ||
| 171 | if ( ! isset( $this->messages[ $key ]['dismissed'] ) ) { |
|
| 172 | $this->messages[ $key ]['dismissed'] = array(); |
|
| 173 | } |
|
| 174 | $this->messages[ $key ]['dismissed'][ get_current_user_id() ] = time(); |
|
| 175 | ||
| 176 | $this->update_list(); |
|
| 177 | } |
|
| 178 | ||
| 179 | /** |
|
| 180 | * @since 4.06 |
|