'bg-green-100 text-green-700',
'pending' => 'bg-yellow-100 text-yellow-700',
'paused' => 'bg-gray-100 text-gray-600',
'expired' => 'bg-red-100 text-red-600',
// log levels
'info' => 'bg-teal-50 text-teal-700',
'warning' => 'bg-yellow-100 text-yellow-700',
'error' => 'bg-red-100 text-red-600',
'critical' => 'bg-red-200 text-red-800',
'debug' => 'bg-purple-50 text-purple-700',
);
public static function buildBadge( $status ) {
$status_class = self::STATUS_BADGE[ strtolower( $status ) ] ?? 'bg-gray-100 text-gray-600';
return '' . esc_html( ucfirst( $status ) ) . '';
}
/* ── Notices ────────────────────────────────────────────── */
public static function successNotice( string $message, string $id = 'adfuz-success-notice' ): string {
if ( empty( $message ) ) {
return '';
}
return sprintf(
'
%s
',
esc_attr( $id ),
esc_html( $message ),
esc_attr( $id )
);
}
public static function errorNotice( array $errors, string $id = 'adfuz-error-notice' ): string {
if ( empty( $errors ) ) {
return '';
}
$message = implode( ' ', $errors );
return sprintf(
'
%s
',
esc_attr( $id ),
esc_html( $message ),
esc_attr( $id )
);
}
// src/Helpers/Common.php
public static function svg_icon_allowed_html(): array {
$common_attrs = array(
'class' => true,
'id' => true,
'style' => true,
'fill' => true,
'stroke' => true,
'stroke-width' => true,
'stroke-linecap' => true,
'stroke-linejoin' => true,
'stroke-dasharray' => true,
'stroke-dashoffset' => true,
'd' => true,
'points' => true,
'x' => true,
'y' => true,
'x1' => true,
'y1' => true,
'x2' => true,
'y2' => true,
'cx' => true,
'cy' => true,
'r' => true,
'rx' => true,
'ry' => true,
'width' => true,
'height' => true,
'transform' => true,
'opacity' => true,
);
return array(
'svg' => array_merge(
$common_attrs,
array(
'xmlns' => true,
'viewbox' => true,
'fill' => true,
'aria-hidden' => true,
'role' => true,
'focusable' => true,
)
),
'path' => $common_attrs,
'circle' => $common_attrs,
'ellipse' => $common_attrs,
'rect' => $common_attrs,
'line' => $common_attrs,
'polyline' => $common_attrs,
'polygon' => $common_attrs,
'g' => $common_attrs,
'defs' => $common_attrs,
'use' => array_merge(
$common_attrs,
array(
'href' => true,
'xlink:href' => true,
)
),
'symbol' => array_merge( $common_attrs, array( 'viewBox' => true ) ),
'title' => array( 'id' => true ),
'desc' => array(),
);
}
public static function floating_icons() {
return array(
'expanded_icon' => apply_filters( 'adfuz/floating_sidebar/expanded_icon', 'dashicons-no-alt' ),
'expanded_label' => apply_filters( 'adfuz/floating_sidebar/expanded_label', '' ),
'collapsed_icon' => apply_filters( 'adfuz/floating_sidebar/collapsed_icon', 'dashicons-editor-help' ),
'collapsed_label' => apply_filters( 'adfuz/floating_sidebar/collapsed_label', 'Help' ),
'collapsed_color' => apply_filters( 'adfuz/floating_sidebar/collapsed_color', '#4CAF50' ),
);
}
}