* @copyright Lance Cleveland * @package wpCSL * @subpackage Notifications * */ class wpCSL_notifications__adpress { /** * Build a new notification object. * * @param type $params */ function __construct($params) { foreach ($params as $name => $value) { $this->$name = $value; } } /** * Add a notification to the notice stack * * @param type $level * @param type $content * @param type $link */ function add_notice($level = 1, $content, $link = null) { $this->notices[] = new wpCSL_notifications_notice__adpress( array( 'level' => $level, 'content' => $content, 'link' => $link ) ); } /** * Render the notices to the browser page. */ function display() { echo $this->get(); } /** * Return a formatted HTML string representing the notification. * * @param boolean $simple - set to true to see simplified unformatted notices. * @return string - the HTML or simple string output */ function get($simple=false) { // No need to do anything if there aren't any notices if (!isset($this->notices)) return; foreach ($this->notices as $notice) { $levels[$notice->level][] = $notice; } ksort($levels, SORT_NUMERIC); $difference = max(array_keys($levels)); $notice_output = ''; $actionMessage = __('needs attention',WPCSL__slplus__VERSION); foreach ($levels as $key => $value) { if (!$simple) { $color = round($difference); switch ($difference) { case 1: $notice_output .= "
%s %s: ',WPCSL__slplus__VERSION), $this->url, $this->name, $actionMessage ); $notice_output .= "