public function widget($args, $instance) { extract($args); echo $before_widget; $title = apply_filters('widget_title', str_replace('%NAME%', $instance['name'], $instance['title'])); if (!empty($title)) { echo $before_title . $title . $after_title; } $char = WoW_Armory_Character_DAL::fetch_character($instance['region'], $instance['locale'], $instance['realm'], $instance['name']); if (!is_wp_error($char)) { $view = new WoW_Armory_Character_View($char); echo $view->display_character($instance); } else { // Show the error message. echo $char->get_error_message(); } echo $after_widget; }
public function shortcode($atts, $content = null) { $options = shortcode_atts(array('name' => '', 'realm' => '', 'region' => 'EU', 'show_portrait' => 1, 'show_title' => 1, 'show_talents' => 1, 'show_items' => 1, 'show_profs' => self::STYLE_PROF_BADGES | self::STYLE_PROF_SECONDARY, 'show_achievs' => self::STYLE_ACHIEV_BAR | self::STYLE_ACHIEV_LIST, 'show_feed' => self::STYLE_FEED_ITEMS | self::STYLE_FEED_ACHIEVEMENTS | self::STYLE_FEED_ICONS, 'locale' => 'en_GB'), $atts); $char = WoW_Armory_Character_DAL::fetch_character($options['region'], $options['locale'], $options['realm'], $options['name']); if (!is_wp_error($char)) { $view = new WoW_Armory_Character_View($char); return $view->display_character($options); } else { // Show the error message. return $char->get_error_message(); } }