function test_get_social_icons_links()
 {
     $this->assertEmpty(PW_Functions::get_social_icons_links());
     $array_to_test = array(99 => new stdClass(), 'pw-test' => 'test', 'pw-two' => 'test2', 'hey-two' => 'test2', 'foo' => null, 0 => 123);
     $this->assertEquals(array('pw-two' => 'test2', 'pw-test' => 'test'), PW_Functions::get_social_icons_links($array_to_test), 'return only entries with keys starting with default: pw-');
     $this->assertEquals(array('hey-two' => 'test2'), PW_Functions::get_social_icons_links($array_to_test, 'hey'), 'return only entries with keys starting with some custom string');
     $this->assertEmpty(PW_Functions::get_social_icons_links($array_to_test, 'primoz'), 'test with the starting key that doesnt exist');
     $this->assertEmpty(PW_Functions::get_social_icons_links($array_to_test, 'foo'), 'empty values should not be included');
     $array_to_test['foo'] = 42;
     $this->assertEquals(array('foo' => 42), PW_Functions::get_social_icons_links($array_to_test, 'foo'), 'now the foo can be included');
 }
 /**
  * Front-end display of widget.
  */
 public function widget($args, $instance)
 {
     // Prepare data for mustache template
     $selected_user_id = intval($instance['selected_user_id']);
     $social_icons = array();
     if (is_callable('PW_Functions::get_social_icons_links')) {
         $icons = PW_Functions::get_social_icons_links(get_user_meta($selected_user_id));
         foreach ($icons as $service => $url) {
             $service_icon = substr($service, 3);
             array_push($social_icons, array('icon' => $service_icon, 'url' => $url[0]));
         }
     }
     // Mustache author-widget template rendering
     echo $this->mustache->render(apply_filters('pw/widget_author_view', 'widget-author'), array('args' => $args, 'author-avatar' => get_avatar($selected_user_id, 90), 'author-posts' => get_author_posts_url($selected_user_id), 'author-meta-name' => $args['before_title'] . get_the_author_meta('display_name', $selected_user_id) . $args['after_title'], 'author-meta-description' => wpautop(get_the_author_meta('description', $selected_user_id)), 'author-meta-user-url' => get_the_author_meta('user_url', $selected_user_id), 'social-icons' => intval(count($social_icons)), 'social-icons-list' => $social_icons));
 }