Skip to content

Instantly share code, notes, and snippets.

@cooperaj
Created October 11, 2012 11:04
Show Gist options
  • Save cooperaj/3871656 to your computer and use it in GitHub Desktop.
Save cooperaj/3871656 to your computer and use it in GitHub Desktop.
Gnarly view code. Any Ideas
<?php if ($options['show_feed']) : ?>
<div class="armory_section armory_feed">
<h4><?php _e('Recent Activity', 'wow_armory_character'); ?></h4>
<ul class="armory_feed_list">
<?php $feed_icons = ($options['show_feed'] & WoW_Armory_Character_Plugin::STYLE_FEED_ICONS) === WoW_Armory_Character_Plugin::STYLE_FEED_ICONS;
$feed_achiev = ($options['show_feed'] & WoW_Armory_Character_Plugin::STYLE_FEED_ACHIEVEMENTS) === WoW_Armory_Character_Plugin::STYLE_FEED_ACHIEVEMENTS;
$feed_criteria = ($options['show_feed'] & WoW_Armory_Character_Plugin::STYLE_FEED_CRITERIA) === WoW_Armory_Character_Plugin::STYLE_FEED_CRITERIA;
$feed_loot = ($options['show_feed'] & WoW_Armory_Character_Plugin::STYLE_FEED_ITEMS) === WoW_Armory_Character_Plugin::STYLE_FEED_ITEMS;
$feed_items = $character->get_activity_feed_items(5); // return a max of 5 of each type.
for ($i = 0; $i < (count($feed_items) < 5 ? count($feed_items) : 5); $i++) : // and only print five or less
switch ($feed_items[$i]->type)
{
case WoW_Armory_Character_FeedItem::ITEM_ACHIEVEMENT :
if ($feed_achiev) : ?>
<li>
<?php if ($feed_icons) : ?>
<img class="armory_feed_icon achievement" src="<?php echo $this->get_feed_icon_url($feed_items[$i]->get_item_icon()) ?>" />
<?php endif; ?>
<p><?php printf(__('Earned the Achievement %s for %d points.', 'wow_armory_character'),
sprintf('<a href="%s">%s</a>', $this->get_achievement_url($feed_items[$i]->get_item_url_component(), 1, 1),
$feed_items[$i]->get_item_title()),
$feed_items[$i]->get_item_related()); ?> <span class="timeago">x hours ago.</span></p>
</li>
<?php endif;
break;
case WoW_Armory_Character_FeedItem::ITEM_CRITERIA :
if ($feed_criteria) :?>
<li>
<?php if ($feed_icons) : ?>
<img class="armory_feed_icon criteria" src="" />
<?php endif; ?>
<p>Completed step x of achievement x. x hours ago.</p>
</li>
<?php endif;
break;
case WoW_Armory_Character_FeedItem::ITEM_LOOT :
if ($feed_loot) :?>
<li>
<?php if ($feed_icons) : ?>
<img class="armory_feed_icon loot" src="<?php echo $this->get_feed_icon_url($feed_items[$i]->get_item_icon()) ?>" />
<?php endif; ?>
<p>Obtained x. x hours ago.</p>
</li>
<?php endif;
break;
}
endfor; ?>
</ul>
</div>
<?php endif; ?>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment