/**
  * Attribute getter method
  * 
  * @return the actionURL of the component
  */
 function get_actionURL_attr()
 {
     $link = '';
     $cat = $this->data[0];
     if ($this->layout == 'L1') {
         $link = wiziapp_buildCategoryLink($cat->cat_ID);
     } elseif ($this->layout == 'L2') {
         $link = wiziapp_buildLinksByCategoryLink($cat->term_id);
     }
     return $link;
 }
/**
* Will echo the li item for the categories of the current post
* No categories - no output
*/
function wiziapp_get_categories_nav()
{
    global $post;
    $categories = get_the_category($post->ID);
    //    $max_to_show = 2;
    $count = count($categories);
    $html = '';
    if ($categories) {
        if ($count == 1 && $categories[0]->cat_name == 'Uncategorized') {
            // Do nothing, if the only category we have is uncategorized, we will not show anything
        } else {
            if ($count > 1) {
                $link = wiziapp_buildPostCategoriesLink($post->ID);
                $cat_names = $count . ' ' . __('Categories', 'wiziapp');
            } else {
                $link = wiziapp_buildCategoryLink($categories[0]->cat_ID);
                $cat_names = wiziapp_makeShortString($categories[0]->cat_name, 13);
            }
            $cat_names = '<span class="names">: ' . $cat_names . '</span>';
            $html .= '<li class="categories"><a id="wizapp_cats_footer_link" class="wiziapp_footer_links" href="' . $link . '">';
            $html .= '<div class="title-bar"></div><span class="title">' . __('Categories', 'wiziapp') . '</span>';
            /**$names = array();
               for($c=0; $c < $count && $c < $max_to_show; ++$c){
                       $names[] = "{$categories[$c]->cat_name}";
               }
               
               $cat_names = implode(', ', $names);
               $cat_names = wiziapp_makeShortString($cat_names, 25);
               if ( strpos($cat_names, '...') === FALSE ){
                   if ( $count > $max_to_show ){
                       $cat_names .= '...';
                   }
               }   */
            $html .= $cat_names . '</a></li>';
        }
    }
    echo $html;
}
function wiziapp_getCategoriesLinks($post_id)
{
    $navLinks = array();
    foreach (get_the_category($post_id) as $category) {
        $navLinks[] = array("link" => array("text" => wiziapp_formatComponentText($category->cat_name), "image" => "", "link" => wiziapp_buildCategoryLink($category->cat_ID)));
    }
    $nav = array("navigation" => array("links" => $navLinks), 'class' => 'categories_nav_css');
    return wiziapp_specialComponent("navigation", $nav);
}