/** * @param WP_Post $post The post object or ID. * @param string $type The meta to retrieve. Defaults to all. * Possible values are: * - profile * - plugins * - themes * * @return mixed The required meta if available, * false if the post does not exist. */ public static function get_talent_meta(WP_Post $post, $type = 'all') { switch ($type) { case 'profile': $collector = new Profile_Collector($post); return $collector->get_data(); break; case 'badges': $collector = new Profile_Collector($post); return $collector->get_data()['badges']; break; case 'plugins': $collector = new Plugin_Collector($post); return $collector->get_data(); break; case 'themes': $collector = new Theme_Collector($post); return $collector->get_data(); break; case 'score': $collector = new Score_Collector($post); return $collector->get_data(); break; case 'forums': $collector = new Forums_Collector($post); return $collector->get_data(); break; case 'wordpresstv': $collector = new WordPressTv_Collector($post); return $collector->get_data(); break; case 'contributions': $collector = new Contribution_Collector($post); return $collector->get_data(); break; case 'social': return self::get_social_links($post); break; case 'dawnpatrol': if (!($profile = esc_url(get_post_meta($post->ID, 'dawnpatrol', true)))) { return false; } return array('profile' => $profile, 'video' => esc_url(get_post_meta($post->ID, 'dawnpatrol-video', true))); case 'map': return self::get_map_data($post); break; case 'location': $location = get_post_meta($post->ID, 'location', true); if (is_string($location)) { return array('name' => $location); } return $location; break; default: // Return all meta $theme_collector = new Theme_Collector($post); $plugin_collector = new Plugin_Collector($post); $profile_collector = new Profile_Collector($post); $contribution_collector = new Contribution_Collector($post); $codex_collector = new Codex_Collector($post); $changeset_collector = new Changeset_Collector($post); $score_collector = new Score_Collector($post); $forums_collector = new Forums_Collector($post); $wordpresstv_collector = new WordPressTv_Collector($post); return array('score' => $score_collector->get_data(), 'social' => self::get_social_links($post), 'dawnpatrol' => self::get_talent_meta($post, 'dawnpatrol'), 'profile' => $profile_collector->get_data(), 'map' => self::get_map_data($post), 'plugins' => $plugin_collector->get_data(), 'themes' => $theme_collector->get_data(), 'contributions' => $contribution_collector->get_data(), 'codex_count' => $codex_collector->get_data(), 'changeset_count' => $changeset_collector->get_data(), 'forums' => $forums_collector->get_data(), 'wordpresstv' => $wordpresstv_collector->get_data()); break; } }