Automatic_Upgrader_Skin::feedback()
最后更新于:2021-11-25 19:10:42
Automatic_Upgrader_Skin::feedback( string|array|GC_Error$data, mixed$args)Stores a message about the upgrade.
参数
- $data
-
(string|array|GC_Error) (Required) Message data.
- $args
-
(mixed) (Optional) text replacements.
源文件
文件: gc-admin/includes/class-automatic-upgrader-skin.php
public function feedback( $data, ...$args ) {
if ( is_gc_error( $data ) ) {
$string = $data->get_error_message();
} elseif ( is_array( $data ) ) {
return;
} else {
$string = $data;
}
if ( ! empty( $this->upgrader->strings[ $string ] ) ) {
$string = $this->upgrader->strings[ $string ];
}
if ( strpos( $string, '%' ) !== false ) {
if ( ! empty( $args ) ) {
$string = vsprintf( $string, $args );
}
}
$string = trim( $string );
// Only allow basic HTML in the messages, as it'll be used in emails/logs rather than direct browser output.
$string = gc_kses(
$string,
array(
'a' => array(
'href' => true,
),
'br' => true,
'em' => true,
'strong' => true,
)
);
if ( empty( $string ) ) {
return;
}
$this->messages[] = $string;
}