\OgreAlert\Settings::get('message_text_color'), 'background_color' => \OgreAlert\Settings::get('message_background_color'), 'transition_duration' => intval(\OgreAlert\Settings::get('message_transition_duration')), 'transition_animation' => \OgreAlert\Settings::get('message_transition_animation'), ]); } static function display_alerts() { if (!\OgreAlert\Alert::has_active()) return; self::load_template('loop-start'); foreach (\OgreAlert\Alert::get_active() as $id) { self::load_template('alert', \OgreAlert\Priority::get($id), true, ['id' => $id]); } self::load_template('loop-end'); } static function body_class($classes) { if (is_admin() || !\OgreAlert\Alert::has_active()) return $classes; $classes[] = 'has-alert'; foreach (\OgreAlert\Alert::get_active() as $id) { $classes[] = sprintf('has-alert-%d', $id); } return $classes; } static function shortcode($atts) { $atts = shortcode_atts([], $atts, 'ogrealert'); ob_start(); do_action('display_alerts'); return ob_get_clean(); } private static function load_template($filename, $filepart = '', $echo = true, $vars = []) { $path = \OgreAlert\Settings::get('path') . 'templates/' . $filename . '-' . $filepart . '.php'; if (!file_exists($path)) { $path = \OgreAlert\Settings::get('path') . 'templates/' . $filename . '.php'; if (!file_exists($path)) { if ($echo) { echo ''; return false; } else { return ''; } } } ob_start(); extract($vars); include($path); $html = ob_get_contents(); ob_end_clean(); if ($echo) { echo $html; return true; } else { return $html; } } } \OgreAlert\Display::load();