function powerpressadmin_edit_googleplay($FeedSettings, $General, $FeedAttribs = array())
{
    $feed_slug = $FeedAttribs['feed_slug'];
    $cat_ID = $FeedAttribs['category_id'];
    // Set default settings (if not set)
    if (empty($FeedSettings['googleplay_url'])) {
        $FeedSettings['googleplay_url'] = '';
    }
    if (empty($FeedSettings['googleplay_email'])) {
        $FeedSettings['googleplay_email'] = '';
    }
    if (empty($FeedSettings['googleplay_author'])) {
        $FeedSettings['googleplay_author'] = '';
    }
    if (empty($FeedSettings['googleplay_description'])) {
        $FeedSettings['googleplay_description'] = '';
    }
    if (empty($FeedSettings['googleplay_explicit'])) {
        $FeedSettings['googleplay_explicit'] = '';
    }
    if (empty($FeedSettings['googleplay_cat'])) {
        $FeedSettings['googleplay_cat'] = '';
    }
    $gp_feed_url = '';
    switch ($FeedAttribs['type']) {
        case 'ttid':
        case 'category':
            $gp_feed_url = get_category_feed_link($cat_ID);
            break;
        case 'channel':
            $gp_feed_url = get_feed_link($feed_slug);
            break;
        case 'post_type':
            $gp_feed_url = get_post_type_archive_feed_link($FeedAttribs['post_type'], $feed_slug);
            break;
        case 'general':
        default:
            $gp_feed_url = get_feed_link('podcast');
    }
    ?>
	<h3><?php 
    echo __('Google Play Settings', 'powerpress');
    ?>
 <?php 
    echo powerpressadmin_new();
    ?>
</h3>
<table class="form-table">
<tr valign="top">
<th scope="row"><?php 
    echo __('Google Play Listing URL', 'powerpress');
    ?>
</th> 
<td>
<input type="text" style="width: 80%;" name="Feed[googleplay_url]" value="<?php 
    echo esc_attr($FeedSettings['googleplay_url']);
    ?>
" maxlength="255" />
<p><?php 
    echo __('Your listing URL will be issued to you from Google Play Music.', 'powerpress');
    ?>
</p>
<!-- <p><?php 
    echo sprintf(__('e.g. %s', 'powerpress'), 'http://itunes.apple.com/podcast/title-of-podcast/id<strong>000000000</strong>');
    ?>
</p> -->

<p><?php 
    echo sprintf(__('Click the following link to %s.', 'powerpress'), '<a href="http://create.blubrry.com/manual/podcast-promotion/publish-podcast-google-play-music-podcast-portal/?podcast-feed=' . urlencode($gp_feed_url) . '" target="_blank">' . __('Publish a Podcast on Google Play Music', 'powerpress') . '</a>');
    ?>
 </p>
 <p>
<?php 
    echo __('Recommended feed to submit to Google Play Music: ', 'powerpress');
    echo esc_html($gp_feed_url);
    ?>
</p>
</td>
</tr>
<tr valign="top">
<th scope="row">
<?php 
    echo __('Google Play Email', 'powerpress');
    ?>
 
<span class="powerpress-required"><?php 
    echo __('Required', 'powerpress');
    ?>
</span>
</th>
<td>
<input type="text" name="Feed[googleplay_email]" class="bpp_input_med" value="<?php 
    echo esc_attr($FeedSettings['googleplay_email']);
    ?>
" maxlength="255" />
<div>(<?php 
    echo __('Google will email this address when your podcast is accepted into the Google Play Music Podcast Directory.', 'powerpress');
    ?>
)</div>
</td>
</tr>
<tr valign="top">
<th scope="row">
<?php 
    echo __('Google Play Author', 'powerpress');
    ?>
 
</th>
<td>
<input type="text" name="Feed[googleplay_author]" class="bpp_input_med" value="<?php 
    echo esc_attr($FeedSettings['googleplay_author']);
    ?>
" maxlength="255" />
<div>(<?php 
    echo __('iTunes Author will be used if left blank', 'powerpress');
    ?>
)</div>
</td>
</tr>
<tr valign="top">
<th scope="row">
<?php 
    echo __('Google Play Description', 'powerpress');
    ?>
 
</th>
<td>
<p style="margin-top: 5px;"><?php 
    echo __('Your description cannot exceed 4,000 characters in length.', 'powerpress');
    ?>
</p>
<textarea name="Feed[googleplay_description]" rows="5" style="width:80%;" ><?php 
    echo esc_textarea($FeedSettings['googleplay_description']);
    ?>
</textarea>
<div>(<?php 
    echo __('iTunes Summary will be used if left blank', 'powerpress');
    ?>
)</div>
</td>
</tr>
<tr valign="top">
<th scope="row">
<?php 
    echo __('Google Play Explicit', 'powerpress');
    ?>
 
</th>
<td>
<select name="Feed[googleplay_explicit]" class="bpp_input_med">
<?php 
    $explicit = array(0 => __('No - display nothing', 'powerpress'), 1 => __('Yes - explicit content', 'powerpress'));
    while (list($value, $desc) = each($explicit)) {
        echo "\t<option value=\"{$value}\"" . ($FeedSettings['googleplay_explicit'] == $value ? ' selected' : '') . ">{$desc}</option>\n";
    }
    ?>
</select>
</td>
</tr>
<tr valign="top">
<th scope="row">
<?php 
    echo __('Google Play Category', 'powerpress');
    ?>
<span class="powerpress-required"><?php 
    echo __('Required', 'powerpress');
    ?>
</span>
</th>
<td>
<select name="Feed[googleplay_cat]" class="bpp_input_med">
<?php 
    $MoreCategories = false;
    $Categories = powerpress_googleplay_categories();
    echo '<option value="">' . __('Select Category', 'powerpress') . '</option>';
    while (list($value, $desc) = each($Categories)) {
        echo "\t<option value=\"{$value}\"" . ($FeedSettings['googleplay_cat'] == $value ? ' selected' : '') . ">" . htmlspecialchars($desc) . "</option>\n";
    }
    ?>
</select>
</td>
</tr>

</table>
	<?php 
}
function powerpress_rss2_head()
{
    global $powerpress_feed;
    if (!powerpress_is_podcast_feed()) {
        return;
    }
    // Not a feed we manage
    $feed_slug = get_query_var('feed');
    $cat_ID = get_query_var('cat');
    $Feed = get_option('powerpress_feed');
    // Get the main feed settings
    if (!empty($powerpress_feed['category'])) {
        $CustomFeed = get_option('powerpress_cat_feed_' . $powerpress_feed['category']);
        // Get the custom podcast feed settings saved in the database
        if ($CustomFeed) {
            $Feed = powerpress_merge_empty_feed_settings($CustomFeed, $Feed);
        }
    } else {
        if (!empty($powerpress_feed['term_taxonomy_id'])) {
            $CustomFeed = get_option('powerpress_taxonomy_' . $powerpress_feed['term_taxonomy_id']);
            // Get the taxonomy podcast settings saved in the database
            if ($CustomFeed) {
                $Feed = powerpress_merge_empty_feed_settings($CustomFeed, $Feed);
            }
        } else {
            if (powerpress_is_custom_podcast_feed()) {
                $CustomFeed = get_option('powerpress_feed_' . $feed_slug);
                // Get the custom podcast feed settings saved in the database
                $Feed = powerpress_merge_empty_feed_settings($CustomFeed, $Feed, $feed_slug == 'podcast');
            }
        }
    }
    if (!isset($Feed['url']) || trim($Feed['url']) == '') {
        if (is_category()) {
            $Feed['url'] = get_category_link($cat_ID);
        } else {
            $Feed['url'] = get_bloginfo('url');
        }
    }
    $General = get_option('powerpress_general');
    // We made it this far, lets write stuff to the feed!
    echo '<!-- podcast_generator="Blubrry PowerPress/' . POWERPRESS_VERSION . '" ';
    if (isset($General['advanced_mode_2']) && empty($General['advanced_mode_2'])) {
        echo 'mode="simple" ';
    } else {
        echo 'mode="advanced" ';
    }
    if (defined('POWERPRESS_DEBUG')) {
        if (!empty($powerpress_feed['category'])) {
            echo 'category="' . $powerpress_feed['category'] . '" ';
        }
        if (!empty($powerpress_feed['term_taxonomy_id'])) {
            echo 'ttid="' . $powerpress_feed['term_taxonomy_id'] . '" ';
        }
        if (!empty($powerpress_feed['post_type'])) {
            echo 'posttype="' . $powerpress_feed['post_type'] . '" ';
        }
        if (!empty($powerpress_feed['feed-slug'])) {
            echo 'feedslug="' . $powerpress_feed['feed-slug'] . '" ';
        }
    }
    echo '-->' . PHP_EOL;
    // add the itunes:new-feed-url tag to feed
    if (powerpress_is_custom_podcast_feed()) {
        if (!empty($Feed['itunes_new_feed_url'])) {
            $Feed['itunes_new_feed_url'] = str_replace('&amp;', '&', $Feed['itunes_new_feed_url']);
            echo "\t<itunes:new-feed-url>" . htmlspecialchars(trim($Feed['itunes_new_feed_url'])) . '</itunes:new-feed-url>' . PHP_EOL;
        }
    } else {
        if (!empty($Feed['itunes_new_feed_url']) && ($feed_slug == 'feed' || $feed_slug == 'rss2')) {
            $Feed['itunes_new_feed_url'] = str_replace('&amp;', '&', $Feed['itunes_new_feed_url']);
            echo "\t<itunes:new-feed-url>" . htmlspecialchars(trim($Feed['itunes_new_feed_url'])) . '</itunes:new-feed-url>' . PHP_EOL;
        }
    }
    if (!empty($Feed['itunes_summary'])) {
        echo "\t" . '<itunes:summary>' . powerpress_format_itunes_value($Feed['itunes_summary'], 'summary') . '</itunes:summary>' . PHP_EOL;
    } else {
        echo "\t" . '<itunes:summary>' . powerpress_format_itunes_value(get_bloginfo('description'), 'summary') . '</itunes:summary>' . PHP_EOL;
    }
    if (!empty($powerpress_feed['itunes_talent_name'])) {
        echo "\t<itunes:author>" . esc_html($powerpress_feed['itunes_talent_name']) . '</itunes:author>' . PHP_EOL;
    }
    if (!empty($powerpress_feed['explicit'])) {
        echo "\t" . '<itunes:explicit>' . $powerpress_feed['explicit'] . '</itunes:explicit>' . PHP_EOL;
    }
    if (!empty($Feed['itunes_block'])) {
        echo "\t<itunes:block>yes</itunes:block>" . PHP_EOL;
    }
    if (!empty($Feed['itunes_complete'])) {
        echo "\t<itunes:complete>yes</itunes:complete>" . PHP_EOL;
    }
    if (!empty($Feed['itunes_image'])) {
        echo "\t" . '<itunes:image href="' . esc_html(str_replace(' ', '+', $Feed['itunes_image']), 'double') . '" />' . PHP_EOL;
    } else {
        echo "\t" . '<itunes:image href="' . powerpress_get_root_url() . 'itunes_default.jpg" />' . PHP_EOL;
    }
    if (!empty($Feed['email'])) {
        echo "\t" . '<itunes:owner>' . PHP_EOL;
        echo "\t\t" . '<itunes:name>' . esc_html($powerpress_feed['itunes_talent_name']) . '</itunes:name>' . PHP_EOL;
        echo "\t\t" . '<itunes:email>' . esc_html($Feed['email']) . '</itunes:email>' . PHP_EOL;
        echo "\t" . '</itunes:owner>' . PHP_EOL;
        echo "\t" . '<managingEditor>' . esc_html($Feed['email'] . ' (' . $powerpress_feed['itunes_talent_name'] . ')') . '</managingEditor>' . PHP_EOL;
    }
    if (!empty($Feed['copyright'])) {
        // In case the user entered the copyright html version or the copyright UTF-8 or ASCII symbol or just (c)
        $Feed['copyright'] = str_replace(array('&copy;', '(c)', '(C)', chr(194) . chr(169), chr(169)), '&#xA9;', $Feed['copyright']);
        echo "\t" . '<copyright>' . esc_html($Feed['copyright']) . '</copyright>' . PHP_EOL;
    }
    if (!empty($Feed['itunes_subtitle'])) {
        echo "\t" . '<itunes:subtitle>' . powerpress_format_itunes_value($Feed['itunes_subtitle'], 'subtitle') . '</itunes:subtitle>' . PHP_EOL;
    } else {
        echo "\t" . '<itunes:subtitle>' . powerpress_format_itunes_value(get_bloginfo('description'), 'subtitle') . '</itunes:subtitle>' . PHP_EOL;
    }
    $podcast_title_safe = '';
    if (version_compare($GLOBALS['wp_version'], 4.4, '<')) {
        $podcast_title_safe .= get_bloginfo_rss('name');
    }
    $podcast_title_safe .= get_wp_title_rss();
    if (!empty($Feed['rss2_image']) || !empty($Feed['itunes_image'])) {
        if (!empty($Feed['rss2_image'])) {
            // If the RSS image is set, use it, otherwise use the iTunes image...
            $rss_image = $Feed['rss2_image'];
        } else {
            $rss_image = $Feed['itunes_image'];
        }
        echo "\t" . '<image>' . PHP_EOL;
        echo "\t\t" . '<title>' . $podcast_title_safe . '</title>' . PHP_EOL;
        echo "\t\t" . '<url>' . esc_html(str_replace(' ', '+', $rss_image)) . '</url>' . PHP_EOL;
        echo "\t\t" . '<link>' . $Feed['url'] . '</link>' . PHP_EOL;
        echo "\t" . '</image>' . PHP_EOL;
    } else {
        echo "\t" . '<image>' . PHP_EOL;
        echo "\t\t" . '<title>' . $podcast_title_safe . '</title>' . PHP_EOL;
        echo "\t\t" . '<url>' . powerpress_get_root_url() . 'rss_default.jpg</url>' . PHP_EOL;
        echo "\t\t" . '<link>' . $Feed['url'] . '</link>' . PHP_EOL;
        echo "\t" . '</image>' . PHP_EOL;
    }
    // Handle iTunes categories
    $Categories = powerpress_itunes_categories();
    $Cat1 = false;
    $Cat2 = false;
    $Cat3 = false;
    if (!empty($Feed['itunes_cat_1'])) {
        list($Cat1, $SubCat1) = explode('-', $Feed['itunes_cat_1']);
    }
    if (!empty($Feed['itunes_cat_2'])) {
        list($Cat2, $SubCat2) = explode('-', $Feed['itunes_cat_2']);
    }
    if (!empty($Feed['itunes_cat_3'])) {
        list($Cat3, $SubCat3) = explode('-', $Feed['itunes_cat_3']);
    }
    if ($Cat1) {
        $CatDesc = $Categories[$Cat1 . '-00'];
        $SubCatDesc = $Categories[$Cat1 . '-' . $SubCat1];
        if ($Cat1 != $Cat2 && $SubCat1 == '00') {
            echo "\t" . '<itunes:category text="' . esc_html($CatDesc) . '" />' . PHP_EOL;
        } else {
            echo "\t" . '<itunes:category text="' . esc_html($CatDesc) . '">' . PHP_EOL;
            if ($SubCat1 != '00') {
                echo "\t\t" . '<itunes:category text="' . esc_html($SubCatDesc) . '" />' . PHP_EOL;
            }
            // End this category set
            if ($Cat1 != $Cat2) {
                echo "\t" . '</itunes:category>' . PHP_EOL;
            }
        }
    }
    if ($Cat2) {
        $CatDesc = $Categories[$Cat2 . '-00'];
        $SubCatDesc = $Categories[$Cat2 . '-' . $SubCat2];
        // It's a continuation of the last category...
        if ($Cat1 == $Cat2) {
            if ($SubCat2 != '00') {
                echo "\t\t" . '<itunes:category text="' . esc_html($SubCatDesc) . '" />' . PHP_EOL;
            }
            // End this category set
            if ($Cat2 != $Cat3) {
                echo "\t" . '</itunes:category>' . PHP_EOL;
            }
        } else {
            if ($Cat2 != $Cat3 && $SubCat2 == '00') {
                echo "\t" . '<itunes:category text="' . esc_html($CatDesc) . '" />' . PHP_EOL;
            } else {
                if ($Cat1 != $Cat2) {
                    // Start a new category set
                    echo "\t" . '<itunes:category text="' . esc_html($CatDesc) . '">' . PHP_EOL;
                }
                if ($SubCat2 != '00') {
                    echo "\t\t" . '<itunes:category text="' . esc_html($SubCatDesc) . '" />' . PHP_EOL;
                }
                if ($Cat2 != $Cat3) {
                    // End this category set
                    echo "\t" . '</itunes:category>' . PHP_EOL;
                }
            }
        }
    }
    if ($Cat3) {
        $CatDesc = $Categories[$Cat3 . '-00'];
        $SubCatDesc = $Categories[$Cat3 . '-' . $SubCat3];
        // It's a continuation of the last category...
        if ($Cat2 == $Cat3) {
            if ($SubCat3 != '00') {
                echo "\t\t" . '<itunes:category text="' . esc_html($SubCatDesc) . '" />' . PHP_EOL;
            }
            // End this category set
            echo "\t" . '</itunes:category>' . PHP_EOL;
        } else {
            if ($Cat2 != $Cat3 && $SubCat3 == '00') {
                echo "\t" . '<itunes:category text="' . esc_html($CatDesc) . '" />' . PHP_EOL;
            } else {
                if ($Cat2 != $Cat3) {
                    // Start a new category set
                    echo "\t" . '<itunes:category text="' . esc_html($CatDesc) . '">' . PHP_EOL;
                }
                if ($SubCat3 != '00') {
                    echo "\t\t" . '<itunes:category text="' . esc_html($SubCatDesc) . '" />' . PHP_EOL;
                }
                // End this category set
                echo "\t" . '</itunes:category>' . PHP_EOL;
            }
        }
    }
    // End Handle iTunes categories
    if (!empty($Feed['googleplay_email'])) {
        echo "\t" . '<googleplay:email>' . esc_html($Feed['googleplay_email']) . '</googleplay:email>' . PHP_EOL;
    }
    if (!empty($Feed['googleplay_description'])) {
        echo "\t" . '<googleplay:description>' . esc_html($Feed['googleplay_description']) . '</googleplay:description>' . PHP_EOL;
    }
    if (!empty($Feed['googleplay_explicit'])) {
        echo "\t" . '<googleplay:explicit>Yes</googleplay:explicit>' . PHP_EOL;
    }
    // google_play_cat // google_play_explicit
    if (!empty($Feed['googleplay_cat'])) {
        $play_cats = powerpress_googleplay_categories();
        if (!empty($play_cats[$Feed['googleplay_cat']])) {
            echo "\t" . '<googleplay:category text="' . esc_html($play_cats[$Feed['googleplay_cat']]) . '" />' . PHP_EOL;
        }
    }
    if (!empty($Feed['googleplay_image'])) {
        echo "\t" . '<googleplay:image href="' . esc_html(str_replace(' ', '+', $Feed['googleplay_image']), 'double') . '" />' . PHP_EOL;
    }
    // RawVoice RSS Tags
    if (!defined('POWERPRESS_RAWVOICE_RSS') || POWERPRESS_RAWVOICE_RSS != false) {
        if (!empty($Feed['parental_rating'])) {
            echo "\t<rawvoice:rating>" . $Feed['parental_rating'] . "</rawvoice:rating>" . PHP_EOL;
        }
        if (!empty($Feed['location'])) {
            echo "\t<rawvoice:location>" . htmlspecialchars($Feed['location']) . "</rawvoice:location>" . PHP_EOL;
        }
        if (!empty($Feed['frequency'])) {
            echo "\t<rawvoice:frequency>" . htmlspecialchars($Feed['frequency']) . "</rawvoice:frequency>" . PHP_EOL;
        }
        if (!empty($Feed['donate_link']) && !empty($Feed['donate_url'])) {
            echo "\t<rawvoice:donate href=\"" . htmlspecialchars($Feed['donate_url']) . "\">" . htmlspecialchars(empty($Feed['donate_label']) ? '' : $Feed['donate_label']) . "</rawvoice:donate>" . PHP_EOL;
        }
    }
}