| @@ -65,11 +65,10 @@ | ||
| 65 | 65 | |
| 66 | 66 | /** |
| 67 | 67 | * Class constructor |
| 68 | 68 | * |
| 69 | - * @param ?object $item Alert data. | |
| 70 | - * @param Plugin $plugin Instance of plugin object. | |
| 71 | - * | |
| 69 | + * @param object $item Alert data. | |
| 70 | + * @param Plugin $plugin Instance of plugin object. | |
| 72 | 71 | * @return void |
| 73 | 72 | */ |
| 74 | 73 | public function __construct( $item, $plugin ) { |
| 75 | 74 | $this->plugin = $plugin; |
| @@ -125,26 +124,8 @@ | ||
| 125 | 124 | return $post_id; |
| 126 | 125 | } |
| 127 | 126 | |
| 128 | 127 | /** |
| 129 | - * Permanently delete the underlying alert post. | |
| 130 | - * | |
| 131 | - * @return bool True if the post was deleted, false otherwise. | |
| 132 | - */ | |
| 133 | - public function delete() { | |
| 134 | - if ( empty( $this->ID ) ) { | |
| 135 | - return false; | |
| 136 | - } | |
| 137 | - | |
| 138 | - $post = get_post( $this->ID ); | |
| 139 | - if ( ! ( $post instanceof \WP_Post ) || Alerts::POST_TYPE !== $post->post_type ) { | |
| 140 | - return false; | |
| 141 | - } | |
| 142 | - | |
| 143 | - return (bool) wp_delete_post( $this->ID, true ); | |
| 144 | - } | |
| 145 | - | |
| 146 | - /** | |
| 147 | 128 | * Process settings form data |
| 148 | 129 | * |
| 149 | 130 | * @todo Confirm if the function is necessary, it's currently unreference |
| 150 | 131 | * anywhere else in the plugin. |
| @@ -204,9 +185,9 @@ | ||
| 204 | 185 | |
| 205 | 186 | /** |
| 206 | 187 | * Determine the title of the alert. |
| 207 | 188 | * |
| 208 | - * @todo enhance human readability | |
| 189 | + * @todo enhance human readibility | |
| 209 | 190 | * @return string The title of the alert |
| 210 | 191 | */ |
| 211 | 192 | public function get_title() { |
| 212 | 193 | |
| @@ -225,9 +206,9 @@ | ||
| 225 | 206 | return $title; |
| 226 | 207 | } |
| 227 | 208 | |
| 228 | 209 | /** |
| 229 | - * Retrieve current alert type object | |
| 210 | + * Retreive current alert type object | |
| 230 | 211 | * |
| 231 | 212 | * @return Alert_Type |
| 232 | 213 | */ |
| 233 | 214 | public function get_alert_type_obj() { |
| @@ -316,18 +297,18 @@ | ||
| 316 | 297 | * |
| 317 | 298 | * Using that ID, it fetches that Alert post's meta, then |
| 318 | 299 | * returns the value of the requested setting (ie., "post meta" field). |
| 319 | 300 | * |
| 320 | - * @param object $record The Record object. | |
| 321 | - * @param string $alert_slug The slug of the Alert Type. | |
| 322 | - * @param string $setting The requested meta value of the Alert. | |
| 323 | - * @param mixed $default_value The default value if no value is found. | |
| 301 | + * @see Alert_Type_Highlight::post_class() for an example. | |
| 324 | 302 | * |
| 325 | - * @see Alert_Type_Highlight::post_class() for an example. | |
| 303 | + * @param object $record The Record object. | |
| 304 | + * @param string $alert_slug The slug of the Alert Type. | |
| 305 | + * @param string $setting The requested meta value of the Alert. | |
| 306 | + * @param mixed $default The default value if no value is found. | |
| 326 | 307 | * |
| 327 | 308 | * @return mixed |
| 328 | 309 | */ |
| 329 | - public function get_single_alert_setting_from_record( $record, $alert_slug, $setting, $default_value = false ) { | |
| 310 | + public function get_single_alert_setting_from_record( $record, $alert_slug, $setting, $default = false ) { | |
| 330 | 311 | if ( ! is_object( $record ) || ! is_string( $alert_slug ) || ! is_string( $setting ) ) { |
| 331 | 312 | return false; |
| 332 | 313 | } |
| 333 | 314 | $record = new Record( $record ); |
| @@ -359,8 +340,8 @@ | ||
| 359 | 340 | } |
| 360 | 341 | |
| 361 | 342 | $alert = $this->plugin->alerts->get_alert( $post_id ); |
| 362 | 343 | |
| 363 | - $value = ! empty( $alert->alert_meta[ $setting ] ) ? $alert->alert_meta[ $setting ] : $default_value; | |
| 344 | + $value = ! empty( $alert->alert_meta[ $setting ] ) ? $alert->alert_meta[ $setting ] : $default; | |
| 364 | 345 | return $value; |
| 365 | 346 | } |
| 366 | 347 | } |