$notice) { $title = $notice->title; $key = $notice->key; $publishing_date = $notice->publishing_date; $auto_hide = $notice->auto_hide; $auto_hide_date = $notice->auto_hide_date; $is_right_sidebar = $notice->is_right_sidebar; $content = $notice->content; $status = $notice->status; $version = isset($notice->version) ? $notice->version : array(); $styles = isset($notice->styles) ? $notice->styles : ""; $current_time = time(); $publish_time = strtotime($publishing_date); $auto_hide_time = strtotime($auto_hide_date); if ( $status == "true" && $is_right_sidebar == "true" && $current_time > $publish_time && $current_time < $auto_hide_time && in_array('free', $version) ) { $html .= '
'; if ( !empty($styles) ) { $html .= ''; } } } } echo $html; } add_action("aiwa_right_side_notice", "aiwa_right_side_notice"); function aiwa_admin_notices(){ $notices = get_option('aiwa_notices'); $notices = json_decode($notices); $html = ""; if (!empty($notices)) { foreach ($notices as $key2 => $notice) { $title = isset($notice->title) ? sanitize_text_field($notice->title) : ""; $key = isset($notice->key) ? sanitize_text_field($notice->key) : ""; $publishing_date = isset($notice->publishing_date) ? sanitize_text_field($notice->publishing_date) : time(); $auto_hide = isset($notice->auto_hide) ? sanitize_text_field($notice->auto_hide) : "false"; $auto_hide_date = isset($notice->auto_hide_date) ? sanitize_text_field($notice->auto_hide_date) : time(); $is_right_sidebar = isset($notice->is_right_sidebar) ? sanitize_text_field($notice->is_right_sidebar) : "true"; $content = isset($notice->content) ? sanitize_text_field($notice->content) : ""; $status = isset($notice->status) ? sanitize_text_field($notice->status) : "false"; $alert_type = isset($notice->alert_type) ? sanitize_key($notice->alert_type) : "success"; $version = isset($notice->version) ? $notice->version : array(); $version = array_map('sanitize_key', $version); $styles = isset($notice->styles) ? sanitize_textarea_field($notice->styles) : ""; $current_time = time(); $publish_time = strtotime($publishing_date); $auto_hide_time = strtotime($auto_hide_date); $clicked_data = (array) get_option('aiwa_notices_clicked_data'); if ( $status == "true" && $is_right_sidebar == "false" && $current_time > $publish_time && $current_time < $auto_hide_time && !in_array($key, $clicked_data) && in_array('free', $version) ) { $html .= '