/**
 * Returns the Project's Github URL.
 *
 * @param int|\WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
 *
 * @return string|bool The Project's Github URL, and empty string if empty, or false if we don't have a valid post.
 */
function get_project_github_url($post = 0)
{
    $post = get_post($post);
    if (empty($post)) {
        return false;
    }
    // This check is just a trick to allow some default data throughout the talk, not for production code!
    if (!function_exists(__NAMESPACE__ . '\\get_project_github_meta_key')) {
        return '#';
    }
    $github_url = get_post_meta($post->ID, get_project_github_meta_key(), true);
    if (empty($github_url)) {
        return '';
    }
    return $github_url;
}
/**
 * Save the Project Meta Fields
 *
 * @param int $post_id The ID of the post we're saving meta for.
 */
function save_project_meta($post_id)
{
    if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
        return;
    }
    if (get_projects_post_type_name() !== get_post_type($post_id)) {
        return;
    }
    if (!isset($_POST['fz_project_nonce']) || !wp_verify_nonce($_POST['fz_project_nonce'], 'fz_project_meta')) {
        return;
    }
    if (!current_user_can('edit_post', $post_id)) {
        return;
    }
    $meta_keys = array(get_project_tagline_meta_key(), get_project_github_meta_key(), get_project_lead_meta_key());
    foreach ($meta_keys as $meta_key) {
        if (!empty($_POST[$meta_key])) {
            update_post_meta($post_id, $meta_key, $_POST[$meta_key]);
        } else {
            delete_post_meta($post_id, $meta_key);
        }
    }
    $non_unique_meta_keys = array(get_project_team_members_meta_key());
    foreach ($non_unique_meta_keys as $meta_key) {
        delete_post_meta($post_id, $meta_key);
        if (!empty($_POST[$meta_key])) {
            foreach ($_POST[$meta_key] as $meta_value) {
                if (empty($meta_value)) {
                    continue;
                }
                add_post_meta($post_id, $meta_key, $meta_value, false);
            }
        }
    }
}