Skip to content

Commit b62296b

Browse files
author
Md. Alimuzzaman Alim
committed
Fix for issue #219
convert trigger error to enhanced stateless notice.
1 parent a957247 commit b62296b

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

lib/classes/class-errors.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -206,14 +206,14 @@ public function admin_notices() {
206206
continue;
207207
}
208208

209-
$data = array(
210-
'title' => $notice['title'],
209+
$data = wp_parse_args($notice, array(
210+
'title' => '',
211211
'class' => 'notice',
212-
'message' => $notice['message'],
213-
'button' => $notice['button'],
214-
'key' => $notice['key'],
212+
'message' => '',
213+
'button' => '',
214+
'key' => '',
215215
'action_links' => $this->action_links[ 'notices' ],
216-
);
216+
));
217217

218218
include ud_get_stateless_media()->path( '/static/views/error-notice.php', 'dir' );
219219

lib/classes/class-settings.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,11 @@ public function refresh() {
127127
}
128128
if(is_string($old_const) && defined($old_const)){
129129
$value = constant($old_const);
130-
trigger_error(__(sprintf("`%s` constant is deprecated, please use `%s` instead.", $old_const, $new_const)), E_USER_WARNING);
130+
ud_get_stateless_media()->errors->add( array(
131+
'key' => $new_const,
132+
'title' => sprintf( __( "%s: Deprecated Notice (%s)", ud_get_stateless_media()->domain ), ud_get_stateless_media()->name, $new_const ),
133+
'message' => sprintf(__("`%s` constant is deprecated, please use `%s` instead.", ud_get_stateless_media()->domain), $old_const, $new_const),
134+
), 'notice' );
131135
$this->set( "sm.readonly.{$option}", "constant" );
132136
break;
133137
}

lib/classes/compatibility/ICompatibility.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,11 @@ public function init(){
105105
if(is_string($old_const) && defined($old_const)){
106106
$is_constant = true;
107107
$this->enabled = constant($old_const);
108-
trigger_error(__(sprintf("`%s` constant is deprecated, please use `%s` instead.", $old_const, $new_const)), E_USER_WARNING);
108+
ud_get_stateless_media()->errors->add( array(
109+
'key' => $this->id,
110+
'title' => sprintf( __( "%s: Deprecated Notice (%s)", ud_get_stateless_media()->domain ), ud_get_stateless_media()->name, $this->title ),
111+
'message' => sprintf(__("<i>%s</i> constant is deprecated, please use <i>%s</i> instead.", ud_get_stateless_media()->domain), $old_const, $new_const),
112+
), 'notice' );
109113
break;
110114
}
111115
}

0 commit comments

Comments
 (0)