function podPress_stop_statistics($action = 'stop')
{
    $podpress_config = podPress_get_option('podPress_config');
    $do_update = FALSE;
    $result = FALSE;
    if (TRUE === is_Array($podpress_config) and TRUE === isset($podpress_config['enableStats'])) {
        switch ($action) {
            case 'stop':
                $podpress_config['enableStats'] = FALSE;
                $do_update = TRUE;
                break;
            case 'start':
                $podpress_config['enableStats'] = TRUE;
                $do_update = TRUE;
                break;
        }
        if (TRUE === $do_update) {
            $result = podPress_update_option('podPress_config', $podpress_config);
        }
    }
    echo '{ "code": "' . $podpress_config . ' - ' . $result . '" , "result": "' . $action . '" }';
}
function podPress_remote_version_check()
{
    $current = PODPRESS_VERSION;
    $latestVersionCache = podPress_get_option('podPress_versionCheck');
    if ($latestVersionCache['cached'] + 86400 < time()) {
        $current = $latestVersionCache['version'];
    } elseif (class_exists(snoopy)) {
        $client = new Snoopy();
        $client->_fp_timeout = 10;
        if (@$client->fetch('http://www.mightyseek.com/podpress_downloads/versioncheck.php?url=' . get_option('siteurl') . '&current=' . PODPRESS_VERSION) === false) {
            return -1;
        } else {
            $remote = $client->results;
            if (!$remote || strlen($remote) > 8) {
                return -1;
            }
            $current = $remote;
        }
        delete_option('podPress_versionCheck');
        podPress_add_option('podPress_versionCheck', array('version' => $current, 'cached' => time()), 'Latest version available', 'yes');
    }
    if ($current > PODPRESS_VERSION) {
        return 1;
    } else {
        return 0;
    }
}
 function do_legacy_upgrades($current)
 {
     global $wpdb;
     while (TRUE == version_compare(PODPRESS_VERSION, $current, '>=') and TRUE == version_compare('8.8', $current, '>=')) {
         settype($current, 'string');
         switch ($current) {
             case '0':
                 $current = PODPRESS_VERSION;
                 break;
             case '1.4':
                 $posts_that_need_upgrades = array();
                 $posts = $wpdb->get_results("SELECT ID, post_content FROM " . $wpdb->posts);
                 if ($posts) {
                     foreach ($posts as $post) {
                         if (preg_match($this->podcasttag_regexp, $post->post_content, $matches)) {
                             $podcastTagFileName = $matches[1];
                         } else {
                             $podcastTagFileName = false;
                         }
                         if ($podcastTagFileName) {
                             $posts_that_need_upgrades[$post->ID] = $post->post_content;
                         }
                     }
                     reset($posts_that_need_upgrades);
                     foreach ($posts_that_need_upgrades as $key => $value) {
                         $wpdb->query("UPDATE " . $wpdb->posts . " SET post_content = '" . preg_replace($this->podcasttag_regexp, '', $value) . "' WHERE ID=" . $key);
                         if (preg_match($this->podcasttag_regexp, $content, $matches)) {
                             $podcastTagFileName = $matches[1];
                         } else {
                             $podcastTagFileName = false;
                         }
                         delete_post_meta($key, 'podPress_podcastStandardAudio');
                         add_post_meta($key, 'podPress_podcastStandardAudio', $podcastTagFileName, true);
                     }
                 }
                 break;
             case '3.8':
                 $this->settings['audioWebPath'] = get_option('podPress_audioWebPath');
                 $this->settings['audioFilePath'] = get_option('podPress_audioFilePath');
                 if ($this->settings['audioWebPath'] == '') {
                     add_option('podPress_mediaWebPath', $this->settings['audioWebPath'], "Web path to Podcast media files", true);
                     $this->settings['audioWebPath'] = $this->settings['audioWebPath'];
                     delete_option('podPress_audioWebPath');
                 }
                 if ($this->settings['audioFilePath'] == '') {
                     add_option('podPress_mediaFilePath', $this->settings['audioFilePath'], "File path to Podcast media files", true);
                     $this->settings['mediaFilePath'] = $this->settings['audioFilePath'];
                     delete_option('podPress_audioFilePath');
                 }
                 $posts = $wpdb->get_results("SELECT ID FROM " . $wpdb->prefix . "posts");
                 if ($posts) {
                     foreach ($posts as $post) {
                         $sql = "SELECT meta_key, meta_value\n\t\t\t\t\t\t\t\t        FROM " . $wpdb->prefix . "postmeta \n\t\t\t\t\t\t\t\t\tWHERE meta_key  IN(\n\t\t\t\t\t\t\t\t\t\t'podPress_podcastStandardAudio', \n\t\t\t\t\t\t\t\t\t\t'podPress_podcastStandardAudioSize',\n\t\t\t\t\t\t\t\t\t\t'podPress_podcastStandardAudioDuration',\n\t\t\t\t\t\t\t\t\t\t'podPress_podcastEnhancedAudio',\n\t\t\t\t\t\t\t\t\t\t'podPress_podcastEnhancedAudioSize',\n\t\t\t\t\t\t\t\t\t\t'podPress_podcastEnhancedAudioDuration',\n\t\t\t\t\t\t\t\t\t\t'podPress_podcastVideo',\n\t\t\t\t\t\t\t\t\t\t'podPress_podcastVideoSize',\n\t\t\t\t\t\t\t\t\t\t'podPress_podcastVideoDuration',\n\t\t\t\t\t\t\t\t\t\t'podPress_podcastVideoDimension',\n\t\t\t\t\t\t\t\t\t\t'podPress_webVideo',\n\t\t\t\t\t\t\t\t\t\t'podPress_webVideoSize',\n\t\t\t\t\t\t\t\t\t\t'podPress_webVideoDuration',\n\t\t\t\t\t\t\t\t\t\t'podPress_webVideoDimension',\n\t\t\t\t\t\t\t\t\t\t'podPress_podcastEbook',\n\t\t\t\t\t\t\t\t\t\t'podPress_podcastEbookSize',\n\t\t\t\t\t\t\t\t\t\t'itunes:duration',\n\t\t\t\t\t\t\t\t\t\t'enclosure'\n\t\t\t\t\t\t\t\t\t) AND post_id = " . $post->ID;
                         $metadata = $wpdb->get_results($sql);
                         if ($metadata) {
                             $posts2convert = array();
                             foreach ($metadata as $stat) {
                                 $posts2convert[$post->ID][$stat->meta_key] = $stat->meta_value;
                             }
                             $rssaddedyet = false;
                             $podPressMedia = array();
                             foreach ($posts2convert as $key => $val) {
                                 if (isset($val['enclosure'])) {
                                     $encParts = split("\n", $val['enclosure']);
                                     $data = $this->upgrade_convert39to40mediaFile(trim(htmlspecialchars($encParts[0])), trim(htmlspecialchars($encParts[1])));
                                     if (!$rssaddedyet) {
                                         $rssaddedyet = true;
                                         $data['rss'] = 'on';
                                     }
                                     $podPressMedia[] = $data;
                                 }
                                 if (isset($val['podPress_podcastStandardAudio'])) {
                                     $data = $this->upgrade_convert39to40mediaFile($val['podPress_podcastStandardAudio'], $val['podPress_podcastStandardAudioSize'], $val['podPress_podcastStandardAudioDuration']);
                                     if (!$rssaddedyet) {
                                         $rssaddedyet = true;
                                         $data['rss'] = 'on';
                                     }
                                     $podPressMedia[] = $data;
                                 }
                                 if (isset($val['podPress_podcastEnhancedAudio'])) {
                                     $data = $this->upgrade_convert39to40mediaFile($val['podPress_podcastEnhancedAudio'], $val['podPress_podcastEnhancedAudioSize'], $val['podPress_podcastEnhancedAudioDuration']);
                                     if (!$rssaddedyet) {
                                         $rssaddedyet = true;
                                         $data['rss'] = 'on';
                                     }
                                     $podPressMedia[] = $data;
                                 }
                                 if (isset($val['podPress_podcastVideo'])) {
                                     $data = $this->upgrade_convert39to40mediaFile($val['podPress_podcastVideo'], $val['podPress_podcastVideoSize'], $val['podPress_podcastVideoDuration'], $val['podPress_podcastVideoDimension']);
                                     if (!$rssaddedyet) {
                                         $rssaddedyet = true;
                                         $data['rss'] = 'on';
                                     }
                                     $podPressMedia[] = $data;
                                 }
                                 if (isset($val['podPress_webVideo'])) {
                                     $data = $this->upgrade_convert39to40mediaFile($val['podPress_webVideo'], $val['podPress_webVideoSize'], $val['podPress_webVideoDuration'], $val['podPress_webVideoDimension']);
                                     $podPressMedia[] = $data;
                                 }
                                 if (isset($val['podPress_podcastEbook'])) {
                                     $data = $this->upgrade_convert39to40mediaFile($val['podPress_podcastEbook'], $val['podPress_podcastEbookSize']);
                                     if (!$rssaddedyet) {
                                         $rssaddedyet = true;
                                         $data['rss'] = 'on';
                                     }
                                     $podPressMedia[] = $data;
                                 }
                             }
                             if (is_array($podPressMedia)) {
                                 delete_post_meta($post->ID, 'podPressMedia');
                                 podPress_add_post_meta($post->ID, 'podPressMedia', $podPressMedia, true);
                             }
                         }
                     }
                 }
                 $sql = "UPDATE " . $wpdb->prefix . "postmeta SET meta_key='enclosure_hold' WHERE meta_key='enclosure'";
                 $wpdb->query($sql);
                 break;
             case '4.2':
                 $playerOptions['bg'] = str_replace('0x', '#', get_option('podPress_player_bgcolor'));
                 delete_option('podPress_player_bgcolor');
                 $playerOptions['text'] = str_replace('0x', '#', get_option('podPress_player_textcolor'));
                 delete_option('podPress_player_textcolor');
                 $playerOptions['leftbg'] = str_replace('0x', '#', get_option('podPress_player_leftbgcolor'));
                 delete_option('podPress_player_leftbgcolor');
                 $playerOptions['lefticon'] = str_replace('0x', '#', get_option('podPress_player_lefticoncolor'));
                 delete_option('podPress_player_lefticoncolor');
                 $playerOptions['rightbg'] = str_replace('0x', '#', get_option('podPress_player_rightbgcolor'));
                 delete_option('podPress_player_rightbgcolor');
                 $playerOptions['rightbghover'] = str_replace('0x', '#', get_option('podPress_player_rightbghovercolor'));
                 delete_option('podPress_player_rightbghovercolor');
                 $playerOptions['righticon'] = str_replace('0x', '#', get_option('podPress_player_righticoncolor'));
                 delete_option('podPress_player_righticoncolor');
                 $playerOptions['righticonhover'] = str_replace('0x', '#', get_option('podPress_player_righticonhovercolor'));
                 delete_option('podPress_player_righticonhovercolor');
                 $playerOptions['slider'] = str_replace('0x', '#', get_option('podPress_player_slidercolor'));
                 delete_option('podPress_player_slidercolor');
                 $playerOptions['track'] = str_replace('0x', '#', get_option('podPress_player_trackcolor'));
                 delete_option('podPress_player_trackcolor');
                 $playerOptions['loader'] = str_replace('0x', '#', get_option('podPress_player_loadercolor'));
                 delete_option('podPress_player_loadercolor');
                 $playerOptions['border'] = str_replace('0x', '#', get_option('podPress_player_bordercolor'));
                 delete_option('podPress_player_bordercolor');
                 podPress_update_option('podPress_playerOptions', $playerOptions);
                 break;
             case '4.4':
                 if (!is_array($this->settings['iTunes'])) {
                     $this->settings['iTunes'] = array();
                 }
                 $x = stripslashes(get_option('itunesAdminName'));
                 delete_option('itunesAdminName');
                 if (!empty($x)) {
                     $this->settings['iTunes']['author'] = $x;
                 }
                 $this->settings['iTunes']['block'] = 'No';
                 $this->settings['iTunes']['category'] = array();
                 $cat1 = get_option('itunesCategory1');
                 $cat2 = get_option('itunesCategory2');
                 $cat3 = get_option('itunesCategory3');
                 if (!empty($cat1)) {
                     $this->settings['iTunes']['category'][] = $cat1;
                 }
                 if (!empty($cat2)) {
                     $this->settings['iTunes']['category'][] = $cat2;
                 }
                 if (!empty($cat3)) {
                     $this->settings['iTunes']['category'][] = $cat3;
                 }
                 $x = stripslashes(get_option('itunesImageBig'));
                 delete_option('itunesImageBig');
                 if (!empty($x)) {
                     $this->settings['iTunes']['image'] = $x;
                 }
                 $x = stripslashes(get_option('itunesDefaultExplicit'));
                 delete_option('itunesDefaultExplicit');
                 if (!empty($x)) {
                     $this->settings['iTunes']['explicit'] = $x;
                 }
                 $x = stripslashes(get_option('itunesFeedKeywords'));
                 delete_option('itunesFeedKeywords');
                 if (!empty($x)) {
                     $this->settings['iTunes']['keywords'] = $x;
                 }
                 $x = stripslashes(get_option('podcastdescription'));
                 delete_option('podcastdescription');
                 if (!empty($x)) {
                     $this->settings['iTunes']['summary'] = $x;
                 }
                 $x = stripslashes(get_option('itunesFeedID'));
                 delete_option('itunesFeedID');
                 if (!empty($x)) {
                     $this->settings['iTunes']['FeedID'] = $x;
                 }
                 delete_option('itunesUseKeyword');
                 delete_option('itunesFeedURL');
                 $x = stripslashes(get_option('itunesImageSmall'));
                 delete_option('itunesImageSmall');
                 if (!empty($x)) {
                     add_option('rss_image', $x);
                 }
                 $x = stripslashes(get_option('itunesTTL'));
                 delete_option('itunesTTL');
                 if (!empty($x)) {
                     add_option('rss_ttl', $x);
                 }
                 $x = stripslashes(get_option('downloadLinksInRSS'));
                 delete_option('downloadLinksInRSS');
                 if (!empty($x)) {
                     add_option('podPress_rss_showlinks', $x);
                 }
                 $x = stripslashes(get_option('channelCat'));
                 delete_option('channelCat');
                 if (!empty($x)) {
                     add_option('podPress_rss_category', $x);
                 }
                 delete_option('podPress_iTunes');
                 podPress_add_option('podPress_iTunes', $this->settings['iTunes']);
                 $x = podPress_get_option('podPress_playerOptions');
                 delete_option('podPress_playerOptions');
                 if (!empty($x)) {
                     podPress_add_option('podPress_playerSettings', $x);
                 }
                 $x = stripslashes(get_option('podPress_BeforeMore'));
                 delete_option('podPress_BeforeMore');
                 if (!empty($x)) {
                     add_option('podPress_contentBeforeMore', $x);
                 }
                 $sql = "SELECT media, \n\t\t\t\t\t\t               method, \n\t\t\t\t\t\t               COUNT(media) as cnt_total, \n\t\t\t\t\t\t               COUNT(CASE WHEN method = 'feed' THEN 1 END) as cnt_feed ,\n\t\t\t\t\t\t               COUNT(CASE WHEN method = 'web' THEN 1 END) as cnt_web ,\n\t\t\t\t\t\t               COUNT(CASE WHEN method = 'play' THEN 1 END) as cnt_play \n\t\t\t\t\t\t        FROM " . $wpdb->prefix . "podpress_stats \n\t\t\t\t\t\t        GROUP BY media \n\t\t\t\t\t\t        ORDER BY cnt_total DESC";
                 $stats = $wpdb->get_results($sql);
                 if ($stats) {
                     $i = 0;
                     foreach ($stats as $stat) {
                         ++$i;
                         $sqlI = "INSERT INTO " . $wpdb->prefix . "podpress_statcounts (media, total, feed, web, play) VALUES ('" . $stat->media . "', " . $stat->cnt_total . ", " . $stat->cnt_feed . ", " . $stat->cnt_web . ", " . $stat->cnt_play . ")";
                         $wpdb->query($sqlI);
                     }
                 }
                 break;
             case '4.5':
                 $x = stripslashes(get_option('channelCat'));
                 delete_option('channelCat');
                 if (!empty($x)) {
                     add_option('podPress_rss_category', $x);
                 }
                 break;
             case '5.3':
                 $posts = $wpdb->get_results("SELECT ID FROM " . $wpdb->prefix . "posts");
                 if ($posts) {
                     foreach ($posts as $post) {
                         $x['itunes:subtitle'] = get_post_meta($post->ID, 'itunes:subtitle', true);
                         delete_post_meta($post->ID, 'itunes:subtitle');
                         if (!isset($x['itunes:subtitle'])) {
                             unset($x['itunes:subtitle']);
                         }
                         $x['itunes:summary'] = get_post_meta($post->ID, 'itunes:summary', true);
                         delete_post_meta($post->ID, 'itunes:summary');
                         if (!isset($x['itunes:summary'])) {
                             unset($x['itunes:summary']);
                         }
                         $x['itunes:keywords'] = get_post_meta($post->ID, 'itunes:keywords', true);
                         delete_post_meta($post->ID, 'itunes:keywords');
                         if (!isset($x['itunes:keywords'])) {
                             unset($x['itunes:keywords']);
                         }
                         $x['itunes:author'] = get_post_meta($post->ID, 'itunes:author', true);
                         delete_post_meta($post->ID, 'itunes:author');
                         if (!isset($x['itunes:author'])) {
                             unset($x['itunes:author']);
                         }
                         $x['itunes:explicit'] = get_post_meta($post->ID, 'itunes:explicit', true);
                         delete_post_meta($post->ID, 'itunes:explicit');
                         if (!isset($x['itunes:explicit'])) {
                             unset($x['itunes:explicit']);
                         }
                         $x['itunes:block'] = get_post_meta($post->ID, 'itunes:block', true);
                         delete_post_meta($post->ID, 'itunes:block');
                         if (!isset($x['itunes:block'])) {
                             unset($x['itunes:block']);
                         }
                         if (!empty($x)) {
                             podPress_add_post_meta($post->ID, 'podPressPostSpecific', $x, true);
                         }
                     }
                 }
                 break;
             case '5.6':
                 $x = podPress_get_option('podPress_config');
                 $y = true;
                 if ($y) {
                     $newSettings = array();
                     $newSettings['enableStats'] = get_option('podPress_enableStats');
                     $newSettings['statMethod'] = get_option('podPress_statMethod');
                     $newSettings['statLogging'] = get_option('podPress_statLogging');
                     $newSettings['enablePodTracStats'] = get_option('podPress_enablePodTracStats');
                     $newSettings['enablePremiumContent'] = get_option('podPress_enablePremiumContent');
                     $newSettings['enableTorrentCasting'] = get_option('podPress_enableTorrentCasting');
                     $newSettings['mediaWebPath'] = get_option('podPress_mediaWebPath');
                     $newSettings['mediaFilePath'] = get_option('podPress_mediaFilePath');
                     $newSettings['contentBeforeMore'] = get_option('podPress_contentBeforeMore');
                     $newSettings['contentLocation'] = get_option('podPress_contentLocation');
                     $newSettings['contentImage'] = get_option('podPress_contentImage');
                     $newSettings['contentPlayer'] = get_option('podPress_contentPlayer');
                     $newSettings['contentDownload'] = get_option('podPress_contentDownload');
                     $newSettings['contentDownloadText'] = get_option('podPress_contentDownloadText');
                     $newSettings['contentDownloadStats'] = get_option('podPress_contentDownloadStats');
                     $newSettings['contentDuration'] = get_option('podPress_contentDuration');
                     $newSettings['rss_showlinks'] = get_option('podPress_rss_showlinks');
                     $newSettings['rss_category'] = get_option('podPress_rss_category');
                     $newSettings['enableFooter'] = get_option('podPress_enableFooter');
                     $newSettings['player'] = podPress_get_option('podPress_playerSettings');
                     $newSettings['iTunes'] = podPress_get_option('podPress_iTunes');
                     delete_option('podPress_config');
                     add_option('podPress_config', $newSettings, "podPress Configuration", true);
                 }
                 break;
             case '5.7':
                 // in the next release I will clean up old crap data that is still laying around
                 delete_option('podPress_enableStats');
                 delete_option('podPress_statMethod');
                 delete_option('podPress_statLogging');
                 delete_option('podPress_enablePodTracStats');
                 delete_option('podPress_enablePremiumContent');
                 delete_option('podPress_enableTorrentCasting');
                 delete_option('podPress_mediaWebPath');
                 delete_option('podPress_mediaFilePath');
                 delete_option('podPress_contentBeforeMore');
                 delete_option('podPress_contentLocation');
                 delete_option('podPress_contentImage');
                 delete_option('podPress_contentPlayer');
                 delete_option('podPress_contentDownload');
                 delete_option('podPress_contentDownloadText');
                 delete_option('podPress_contentDownloadStats');
                 delete_option('podPress_contentDuration');
                 delete_option('podPress_rss_showlinks');
                 delete_option('podPress_rss_category');
                 delete_option('podPress_enableFooter');
                 delete_option('podPress_iTunes');
                 delete_option('podPress_playerSettings');
                 delete_option('podPress_enableLogging');
                 delete_option('podPress_downloadLinksInRSS');
                 delete_option('podPress_categoryCasting');
                 delete_option('podPress_beforeMore');
                 $sql = "DELETE FROM " . $wpdb->prefix . "postmeta WHERE meta_key='podPressiTunesPostSpecific'";
                 $wpdb->query($sql);
                 break;
             case '6.3':
                 $x = podPress_get_option('podPress_config');
                 $x['iTunes']['category'][0] = podPress_upgradeCategory($x['iTunes']['category'][0]);
                 if (isset($x['iTunes']['category'][1])) {
                     $x['iTunes']['category'][1] = podPress_upgradeCategory($x['iTunes']['category'][1]);
                 }
                 if (isset($x['iTunes']['category'][2])) {
                     $x['iTunes']['category'][2] = podPress_upgradeCategory($x['iTunes']['category'][2]);
                 }
                 podPress_update_option('podPress_config', $x);
                 break;
             case '6.7':
                 $create_table = "ALTER TABLE " . $wpdb->prefix . "podpress_statcounts ADD COLUMN postID  int(11) NOT NULL DEFAULT 0 FIRST;";
                 podPress_maybe_add_column($wpdb->prefix . 'podpress_statcounts', 'postID', $create_table);
                 $sql = 'ALTER TABLE ' . $wpdb->prefix . 'podpress_statcounts ADD PRIMARY KEY (media(255),postID), DROP PRIMARY KEY;';
                 $wpdb->get_results($sql);
                 $create_table = "ALTER TABLE " . $wpdb->prefix . "podpress_stats ADD COLUMN postID  int(11) NOT NULL DEFAULT 0 AFTER id;";
                 podPress_maybe_add_column($wpdb->prefix . 'podpress_stats', 'postID', $create_table);
                 $mappings = array();
                 $sql = "SELECT * FROM " . $wpdb->prefix . "postmeta WHERE meta_key = 'podPressMedia' ORDER BY meta_id;";
                 $posts = $wpdb->get_results($sql);
                 if ($posts) {
                     foreach ($posts as $post) {
                         $mediaFiles = unserialize($post->meta_value);
                         if (is_array($mediaFiles)) {
                             foreach ($mediaFiles as $mediaFile) {
                                 if (!isset($mappings[$mediaFile['URI']])) {
                                     $filename = podPress_getFileName($mediaFile['URI']);
                                     $mappings[$filename] = $post->post_id;
                                 }
                             }
                         }
                     }
                     reset($mappings);
                     foreach ($mappings as $key => $val) {
                         $wpdb->query('UPDATE ' . $wpdb->prefix . "podpress_statcounts SET postID = '" . $val . "' WHERE media='" . $key . "'");
                         $wpdb->query('UPDATE ' . $wpdb->prefix . "podpress_stats SET postID = '" . $val . "' WHERE media='" . $key . "'");
                     }
                 }
             case '7.9':
                 $create_table = "ALTER TABLE " . $wpdb->prefix . "podpress_stats ADD COLUMN completed TINYINT(1) UNSIGNED DEFAULT 0;";
                 podPress_maybe_add_column($wpdb->prefix . 'podpress_stats', 'completed', $create_table);
                 break;
             case '8.3':
                 if ($this->settings['enablePodTracStats']) {
                     $this->settings['enable3rdPartyStats'] = 'PodTrac';
                 }
                 break;
             default:
                 // do nothing
                 break;
         }
         if (function_exists('wp_cache_flush')) {
             wp_cache_flush();
         }
         if (version_compare(PODPRESS_VERSION, $current, '>=')) {
             update_option('podPress_version', $current);
         }
         $current = $current + 0.1;
     }
 }
 function edit_category_form($input)
 {
     global $wp_version, $action;
     //~ echo "\n<pre>\n";
     //~ var_dump('in function edit_category_form');
     //~ var_dump($input);
     //~ var_dump($input->taxonomy);
     //~ var_dump($action);
     //~ var_dump($_GET['action']);
     //~ var_dump($wp_version);
     //~ echo "\n</pre>\n";
     if ('edit' == $_GET['action'] and TRUE == version_compare($wp_version, '2.7', '>=') or 'editedcat' == $action) {
         // show the following form only when an existing category is going to be edited.
         if (FALSE === isset($input->taxonomy) or TRUE === empty($input->taxonomy) or 'post_tag' !== $input->taxonomy and 'category' !== $input->taxonomy) {
             $taxonomy = 'misc';
             $taxonomy_str = __('Taxonomy', 'podpress');
         } else {
             $taxonomy = $input->taxonomy;
             switch ($taxonomy) {
                 case 'post_tag':
                     $taxonomy_str = __('Tag', 'podpress');
                     break;
                 case 'category':
                     $taxonomy_str = __('Category', 'podpress');
                     break;
             }
         }
         //~ printphpnotices_var_dump('print edit_'.$taxonomy.'_form');
         //~ printphpnotices_var_dump($input);
         $data = podPress_get_option('podPress_' . $taxonomy . '_' . $input->term_id);
         $blog_charset = get_bloginfo('charset');
         if (empty($data['podcastFeedURL'])) {
             if (TRUE == version_compare($wp_version, '2.9.3', '>')) {
                 // since WP 3.0 the cat_ID isreplaced by tag_ID
                 $data['podcastFeedURL'] = get_term_feed_link($input->term_id, $taxonomy);
             } elseif (TRUE == version_compare($wp_version, '2.9.3', '<=') and TRUE == version_compare($wp_version, '2.4', '>')) {
                 switch ($taxonomy) {
                     default:
                     case 'post_tag':
                         $data['podcastFeedURL'] = get_tag_feed_link($input->term_id);
                         break;
                     case 'category':
                         $data['podcastFeedURL'] = get_category_feed_link($input->term_id);
                         break;
                 }
             } else {
                 $data['podcastFeedURL'] = site_url() . '/?feed=rss2&cat=' . $input->term_id;
             }
         } else {
             $url_parts = parse_url($data['podcastFeedURL']);
             if (isset($url_parts['query'])) {
                 $output = '';
                 parse_str($url_parts['query'], $output);
                 if (TRUE === isset($output['cat']) and FALSE !== empty($output['cat'])) {
                     if (TRUE == version_compare($wp_version, '2.9.3', '>')) {
                         // since WP 3.0 the cat_ID isreplaced by tag_ID
                         $data['podcastFeedURL'] = get_term_feed_link($input->term_id, $taxonomy);
                     } elseif (TRUE == version_compare($wp_version, '2.9.3', '<=') and TRUE == version_compare($wp_version, '2.4', '>')) {
                         switch ($taxonomy) {
                             default:
                             case 'post_tag':
                                 $data['podcastFeedURL'] = get_tag_feed_link($input->term_id);
                                 break;
                             case 'category':
                                 $data['podcastFeedURL'] = get_category_feed_link($input->term_id);
                                 break;
                         }
                     } else {
                         $data['podcastFeedURL'] = site_url() . '/?feed=rss2&cat=' . $input->term_id;
                     }
                 }
             }
         }
         // some ids of category input fields have changed with WP 3.0
         $wp_version_parts = explode('.', $wp_version);
         if (is_array($wp_version_parts)) {
             $main_wp_version = $wp_version_parts[0];
         } else {
             $main_wp_version = 0;
         }
         echo '<div class="wrap">' . "\n";
         if (TRUE == version_compare($wp_version, '2.7', '>=')) {
             echo '<div id="podpress-icon" class="icon32"><br /></div>';
         }
         echo '	<h2>' . sprintf(__('podPress %1$s Casting', 'podpress'), $taxonomy_str) . '</h2>' . "\n";
         echo '	<label for="categoryCasting"><strong>' . sprintf(__('Enable %1$s Casting', 'podpress'), $taxonomy_str) . '</strong></label>  <a href="javascript:void(null);" onclick="javascript: podPressShowHideDiv(\'categoryCastingHelp\');">(?)</a>:';
         echo '	<input type="checkbox" name="categoryCasting" id="categoryCasting" ';
         if ($data['categoryCasting'] == 'true') {
             echo 'checked="checked"';
         }
         echo ' onclick="javascript: podPress_updateCategoryCasting(' . $main_wp_version . ', \'' . $taxonomy . '\');"/>' . "\n";
         echo '	<div id="categoryCastingHelp" style="display: none;">' . "\n";
         echo '		' . __('This feature is for cases in which you want to host more than one podcast in one blog or if you want to have different podcast feeds with different media files of certain file types per feed (e.g a feed which contains only .mp3 files).<br />Basically this feature gives you the opportunity to modify some of the feed elements and set them to other then as the general value from the Feed/iTunes Settings of podPress.<br/>For instance: If you organize your audio episodes in one category and the video episodes in a different category then you can modify the feed content describing values like the title or the description in the form below. This your category feeds will be more distinguishable from another.', 'podpress') . '<br />' . "\n";
         echo '	</div>' . "\n";
         echo '  <div class="wrap" id="iTunesSpecificSettings" style="display: none; border: 0;">' . "\n";
         podPress_DirectoriesPreview('edit_category_form');
         echo '		<fieldset class="options">' . "\n";
         echo '		<legend>' . sprintf(__('%1$s Feed Options', 'podpress'), $taxonomy_str) . '</legend>' . "\n";
         echo '		<h3>' . __('iTunes Settings', 'podpress') . '</h3>' . "\n";
         echo '		<table class="podpress_feed_gensettings">' . "\n";
         echo '			<tr>' . "\n";
         echo '				<th>';
         echo '					<label for="iTunesSubtitleChoice">' . __('iTunes:Subtitle', 'podpress') . '</label>' . "\n";
         echo '				</th>';
         echo '				<td colspan="2">';
         echo '					<select id="iTunesSubtitleChoice" name="iTunesSubtitleChoice" onchange="javascript: podPress_updateCategoryCasting(' . $main_wp_version . ', \'' . $taxonomy . '\');">' . "\n";
         echo '						<option value="Global" ';
         if ($data['iTunesSubtitleChoice'] != 'Custom') {
             echo 'selected="selected"';
         }
         echo '>' . __('Use Global', 'podpress') . '</option>' . "\n";
         echo '						<option value="Custom" ';
         if ($data['iTunesSubtitleChoice'] == 'Custom') {
             echo 'selected="selected"';
         }
         echo '>' . __('Insert custom value', 'podpress') . '</option>' . "\n";
         echo '					</select>' . "\n";
         echo '					<div id="iTunesSubtitleWrapper" style="display: none;">' . "\n";
         echo '						<textarea name="iTunesSubtitle" class="podpress_wide_text_field" rows="2" cols="40">' . stripslashes($data['iTunesSubtitle']) . '</textarea>' . "\n";
         echo '					</div>' . "\n";
         echo '					<div id="iTunesSubtitleHelp">' . "\n";
         echo '						' . __('A few words which describe the feed title a little bit more (max. 255 characters).', 'podpress') . ' ' . __('By default this is taken from the default iTunes:subtitle.', 'podpress') . "\n";
         echo '					</div>' . "\n";
         echo '				</td>' . "\n";
         echo '			</tr>' . "\n";
         echo '			<tr>' . "\n";
         echo '				<th>';
         echo '					<label for="iTunesSummaryChoice">' . __('iTunes:Summary', 'podpress') . '</label>' . "\n";
         echo '				</th>';
         echo '				<td colspan="2">';
         echo '					<select id="iTunesSummaryChoice" name="iTunesSummaryChoice" onchange="javascript: podPress_updateCategoryCasting(' . $main_wp_version . ', \'' . $taxonomy . '\');">' . "\n";
         echo '						<option value="Global" ';
         if ($data['iTunesSummaryChoice'] != 'Custom') {
             echo 'selected="selected"';
         }
         echo '>' . __('Use Global', 'podpress') . '</option>' . "\n";
         echo '						<option value="Custom" ';
         if ($data['iTunesSummaryChoice'] == 'Custom') {
             echo 'selected="selected"';
         }
         echo '>' . __('Insert custom value', 'podpress') . '</option>' . "\n";
         echo '					</select>' . "\n";
         echo '					<input type="hidden" id="global_iTunesSummary" value="' . attribute_escape(stripslashes($this->settings['iTunes']['summary'])) . '" />' . "\n";
         echo '					<div id="iTunesSummaryWrapper" style="display: none;">' . "\n";
         echo '						<textarea name="iTunesSummary" id="iTunesSummary" class="podpress_wide_text_field" rows="6" cols="40" onchange="javascript: podPress_updateCategoryCasting(' . $main_wp_version . ', \'' . $taxonomy . '\');">' . stripslashes($data['iTunesSummary']) . '</textarea>' . "\n";
         echo '					</div>' . "\n";
         echo '					<div id="iTunesSummaryHelp">' . "\n";
         echo '						' . __('The description of the podcast.', 'podpress') . ' ' . __('By default this is taken from the default iTunes:Summary or the default description.', 'podpress') . "\n";
         echo '					</div>' . "\n";
         echo '				</td>' . "\n";
         echo '			</tr>' . "\n";
         echo '			<tr>' . "\n";
         echo '				<th>';
         echo '					<label for="iTunesImageChoice">' . __('iTunes:Image', 'podpress') . '</label>' . "\n";
         echo '				</th>';
         echo '				<td colspan="2">';
         echo '					' . __('The iTunes image should be a square image with <a href="http://www.apple.com/itunes/podcasts/specs.html#image" target="_blank">at least 1400 x 1400 pixels</a> as Apple writes in "<a href="http://www.apple.com/itunes/podcasts/specs.html" target="_blank">Making a Podcast</a>" of their own Podcasting Resources. iTunes supports JPEG and PNG images (the file name extensions should ".jpg" or ".png").', 'podpress') . "\n";
         echo '					<br/>';
         echo '					<select id="iTunesImageChoice" name="iTunesImageChoice" onchange="javascript: podPress_updateCategoryCasting(' . $main_wp_version . ', \'' . $taxonomy . '\');">' . "\n";
         echo '						<option value="Global" ';
         if ($data['iTunesImageChoice'] != 'Custom') {
             echo 'selected="selected"';
         }
         echo '>' . __('Use Global', 'podpress') . '</option>' . "\n";
         echo '						<option value="Custom" ';
         if ($data['iTunesImageChoice'] == 'Custom') {
             echo 'selected="selected"';
         }
         echo '>' . __('Insert custom value', 'podpress') . '</option>' . "\n";
         echo '					</select>' . "\n";
         echo '					<div id="iTunesImageWrapper" style="display: none;">' . "\n";
         echo '						<br/>';
         echo '						<input id="iTunesImage" type="text" name="iTunesImage" value="' . $data['iTunesImage'] . '" class="podpress_wide_text_field" size="40" onchange="podPress_updateCategoryCasting(' . $main_wp_version . ', \'' . $taxonomy . '\');"/>' . "\n";
         echo '						<input id="global_iTunesImage" type="hidden" value="' . $this->settings['iTunes']['image'] . '"/>' . "\n";
         echo '					</div>' . "\n";
         echo '					<br/>';
         echo '					<img id="itunes_image_display" style="width:300px; height:300px;" alt="' . __('Podcast Image - Big (If you can not see an image then the URL is wrong.)', 'podpress') . '" src="" /><br />' . "\n";
         echo '					<em>' . __('(This image is only a preview which is limited to 300 x 300 pixels.) ', 'podpress') . '</em>';
         echo '				</td>' . "\n";
         echo '			</tr>' . "\n";
         echo '			<tr>' . "\n";
         echo '				<th>';
         echo '					<label for="iTunesAuthorChoice">' . __('iTunes:Author/Owner', 'podpress') . '</label>' . "\n";
         echo '				</th>';
         echo '				<td colspan="2">';
         echo '					<select id="iTunesAuthorChoice" name="iTunesAuthorChoice" onchange="javascript: podPress_updateCategoryCasting(' . $main_wp_version . ', \'' . $taxonomy . '\');">' . "\n";
         echo '						<option value="Global" ';
         if ($data['iTunesAuthorChoice'] != 'Custom') {
             echo 'selected="selected"';
         }
         echo '>' . __('Use Global', 'podpress') . ' (' . podPress_stringLimiter(ucfirst(stripslashes($this->settings['iTunes']['author'])), 40) . ')</option>' . "\n";
         echo '						<option value="Custom" ';
         if ($data['iTunesAuthorChoice'] == 'Custom') {
             echo 'selected="selected"';
         }
         echo '>' . __('Insert custom value', 'podpress') . '</option>' . "\n";
         echo '					</select>' . "\n";
         echo '					<div id="iTunesAuthorWrapper" style="display: none;">' . "\n";
         echo '						<input type="text" name="iTunesAuthor" class="podpress_wide_text_field" size="40" id="iTunesAuthor" value="' . attribute_escape(stripslashes($data['iTunesAuthor'])) . '" onchange="javascript: podPress_updateCategoryCasting(' . $main_wp_version . ', \'' . $taxonomy . '\');"/>';
         echo '						<input type="hidden" id="global_iTunesAuthor" value="' . attribute_escape(stripslashes($this->settings['iTunes']['author'])) . '" />' . "\n";
         echo '					</div>' . "\n";
         echo '					<div id="iTunesAuthorHelp">' . "\n";
         echo '						' . __('Used if this Author is different than the feeds author.', 'podpress') . "\n";
         echo '					</div>' . "\n";
         echo '				</td>' . "\n";
         echo '			<tr>' . "\n";
         echo '			</tr>' . "\n";
         echo '				<th>';
         echo '					<label for="iTunesAuthorEmailChoice">' . __('Owner E-mail address', 'podpress') . '</label>' . "\n";
         echo '				</th>';
         echo '				<td colspan="2">';
         echo '					<select id="iTunesAuthorEmailChoice" name="iTunesAuthorEmailChoice" onchange="javascript: podPress_updateCategoryCasting(' . $main_wp_version . ', \'' . $taxonomy . '\');">' . "\n";
         echo '						<option value="Global" ';
         if ($data['iTunesAuthorEmailChoice'] != 'Custom') {
             echo 'selected="selected"';
         }
         echo '>' . __('Use Global', 'podpress') . ' (' . podPress_stringLimiter(ucfirst(stripslashes(get_option('admin_email'))), 40) . ')</option>' . "\n";
         echo '						<option value="Custom" ';
         if ($data['iTunesAuthorEmailChoice'] == 'Custom') {
             echo 'selected="selected"';
         }
         echo '>' . __('Insert custom value', 'podpress') . '</option>' . "\n";
         echo '					</select>' . "\n";
         echo '					<div id="iTunesAuthorEmailWrapper" style="display: none;">' . "\n";
         echo '						<input type="text" name="iTunesAuthorEmail" class="podpress_wide_text_field" size="40" id="iTunesAuthorEmail" value="' . attribute_escape(stripslashes($data['iTunesAuthorEmail'])) . '" onchange="javascript: podPress_updateCategoryCasting(' . $main_wp_version . ', \'' . $taxonomy . '\');"/>';
         echo '						<input type="hidden" id="global_iTunesAuthorEmail" value="' . attribute_escape(stripslashes(get_option('admin_email'))) . '" />' . "\n";
         echo '					</div>' . "\n";
         echo '					<div id="iTunesAuthorEmailHelp">' . "\n";
         echo '						' . __('Used if the owner of this category is different than the feeds owner.', 'podpress') . "\n";
         echo '					</div>' . "\n";
         echo '				</td>' . "\n";
         echo '			</tr>' . "\n";
         echo '			<tr>' . "\n";
         echo '				<th>';
         echo '					<label for="iTunesKeywordsChoice">' . __('iTunes:Keywords', 'podpress') . '</label>' . "\n";
         echo '				</th>';
         echo '				<td colspan="2">';
         echo '					<select id="iTunesKeywordsChoice" name="iTunesKeywordsChoice" onchange="javascript: podPress_updateCategoryCasting(' . $main_wp_version . ', \'' . $taxonomy . '\');">' . "\n";
         echo '						<option value="Global" ';
         if ($data['iTunesKeywordsChoice'] != 'Custom') {
             echo 'selected="selected"';
         }
         echo '>' . __('Use Global', 'podpress') . ' (' . podPress_stringLimiter(stripslashes($this->settings['iTunes']['keywords']), 40) . ')</option>' . "\n";
         echo '						<option value="Custom" ';
         if ($data['iTunesKeywordsChoice'] == 'Custom') {
             echo 'selected="selected"';
         }
         echo '>' . __('Insert custom value', 'podpress') . '</option>' . "\n";
         echo '					</select>' . "\n";
         echo '					<div id="iTunesKeywordsWrapper">' . "\n";
         echo '						' . __('a list of max. 12 comma separated words', 'podpress') . '<br/><textarea name="iTunesKeywords" rows="4" cols="40">' . stripslashes($data['iTunesKeywords']) . '</textarea>' . "\n";
         echo '					</div>' . "\n";
         echo '					<div id="iTunesKeywordsHelp">' . "\n";
         echo '						' . __('Not visible in iTunes, but used for searches.', 'podpress') . "\n";
         echo '					</div>' . "\n";
         echo '				</td>' . "\n";
         echo '			</tr>' . "\n";
         echo '			<tr> ' . "\n";
         echo '				<th>';
         echo '					<label for="iTunesCategory_0">' . __('iTunes:Categories', 'podpress') . '</label>';
         echo '				</th>';
         echo '				<td colspan="2">';
         echo '					<select id="iTunesCategory_0" name="iTunesCategory[0]" onchange="podPress_updateCategoryCasting(' . $main_wp_version . ', \'' . $taxonomy . '\');">' . "\n";
         echo '						<optgroup label="' . __('Select Primary', 'podpress') . '">' . "\n";
         if ('' == trim($this->settings['iTunes']['category'][0])) {
             $current_global = '[ ' . __('nothing', 'podpress') . ' ]';
         } else {
             $current_global = $this->settings['iTunes']['category'][0];
         }
         echo '						<option value="##Global##" ';
         if ($data['iTunesCategory'][0] == '##Global##' || empty($data['iTunesCategory'][0])) {
             echo 'selected="selected"';
         }
         echo '>' . __('Use Global', 'podpress') . ' (' . $current_global . ')</option>' . "\n";
         if (empty($data['iTunesCategory'][0])) {
             podPress_itunesCategoryOptions('##Global##');
         } else {
             podPress_itunesCategoryOptions(stripslashes($data['iTunesCategory'][0]));
         }
         echo '						</optgroup>' . "\n";
         echo '					</select><br/>' . "\n";
         echo '					<input type="hidden" id="global_iTunesCategory" value="' . attribute_escape($this->settings['iTunes']['category'][0]) . '" />' . "\n";
         echo '					<select name="iTunesCategory[1]">' . "\n";
         echo '						<optgroup label="' . __('Select Second', 'podpress') . '">' . "\n";
         if ('' == trim($this->settings['iTunes']['category'][1])) {
             $current_global = '[ ' . __('nothing', 'podpress') . ' ]';
         } else {
             $current_global = $this->settings['iTunes']['category'][1];
         }
         echo '						<option value="##Global##" ';
         if ($data['iTunesCategory'][1] == '##Global##' || empty($data['iTunesCategory'][1])) {
             echo 'selected="selected"';
         }
         echo '>' . __('Use Global', 'podpress') . ' (' . $current_global . ')</option>' . "\n";
         if (empty($data['iTunesCategory'][1])) {
             podPress_itunesCategoryOptions('##Global##');
         } else {
             podPress_itunesCategoryOptions(stripslashes($data['iTunesCategory'][1]));
         }
         echo '						</optgroup>' . "\n";
         echo '					</select><br/>' . "\n";
         echo '					<select name="iTunesCategory[2]">' . "\n";
         echo '						<optgroup label="' . __('Select Third', 'podpress') . '">' . "\n";
         if ('' == trim($this->settings['iTunes']['category'][2])) {
             $current_global = '[ ' . __('nothing', 'podpress') . ' ]';
         } else {
             $current_global = $this->settings['iTunes']['category'][2];
         }
         echo '						<option value="##Global##" ';
         if ($data['iTunesCategory'][2] == '##Global##' || empty($data['iTunesCategory'][2])) {
             echo 'selected="selected"';
         }
         echo '>' . __('Use Global', 'podpress') . ' (' . $current_global . ')</option>' . "\n";
         if (empty($data['iTunesCategory'][2])) {
             podPress_itunesCategoryOptions('##Global##');
         } else {
             podPress_itunesCategoryOptions(stripslashes($data['iTunesCategory'][2]));
         }
         echo '						</optgroup>' . "\n";
         echo '					</select>' . "\n";
         echo '				</td>' . "\n";
         echo '			</tr>' . "\n";
         echo '			<tr>' . "\n";
         echo '				<th>';
         echo '					<label for="iTunesExplicit">' . __('iTunes:Explicit', 'podpress') . '</label>' . "\n";
         echo '				</th>';
         echo '				<td colspan="2">';
         echo '					<select id="iTunesExplicit" name="iTunesExplicit" onchange="javascript: podPress_updateCategoryCasting(' . $main_wp_version . ', \'' . $taxonomy . '\');">' . "\n";
         echo '						<option value="##Global##" ';
         if ($data['iTunesExplicit'] == '##Global##' || empty($data['iTunesExplicit'])) {
             echo 'selected="selected"';
         }
         echo '>' . __('Use Global', 'podpress') . ' (' . $this->settings['iTunes']['explicit'] . ')</option>' . "\n";
         echo '						<option value="No" ';
         if ($data['iTunesExplicit'] == 'No') {
             echo 'selected="selected"';
         }
         echo '>' . __('No', 'podpress') . '</option>' . "\n";
         echo '						<option value="Yes" ';
         if ($data['iTunesExplicit'] == 'Yes') {
             echo 'selected="selected"';
         }
         echo '>' . __('Yes', 'podpress') . '</option>' . "\n";
         echo '						<option value="Clean" ';
         if ($data['iTunesExplicit'] == 'Clean') {
             echo 'selected="selected"';
         }
         echo '>' . __('Clean', 'podpress') . '</option>' . "\n";
         echo '					</select>' . "\n";
         echo '					<div id="iTunesExplicitHelp">' . "\n";
         echo '					' . __('Setting to indicate (in iTunes) whether or not your podcast contains explicit language or adult content', 'podpress') . "\n";
         echo '					<br/>' . __('"No" (default) - no indicator will show up', 'podpress') . "\n";
         echo '					<br/>' . __('"Yes" - an "EXPLICIT" parental advisory graphic will appear next to your podcast artwork or name in iTunes', 'podpress') . "\n";
         echo '					<br/>' . __('"Clean" - means that you are sure that no explicit language or adult content is included any of the episodes, and a "CLEAN" graphic will appear', 'podpress') . "\n";
         echo '					<p>' . __('You have also the possibility to adjust this option for each post or page with at least one podcast episode (in the post/page editor).', 'podpress') . '</p>' . "\n";
         echo '					</div>' . "\n";
         echo '				</td>' . "\n";
         echo '			</tr>' . "\n";
         echo '			<tr>' . "\n";
         echo '				<th>';
         echo '					<label for="iTunesBlock">' . __('iTunes:Block', 'podpress') . '</label>' . "\n";
         echo '				</th>';
         echo '				<td colspan="2">';
         echo '					<select id="iTunesBlock" name="iTunesBlock" onchange="javascript: podPress_updateCategoryCasting(' . $main_wp_version . ', \'' . $taxonomy . '\');">' . "\n";
         echo '						<option value="##Global##" ';
         if ($data['iTunesBlock'] != '##Global##' || empty($data['itunesBlock'])) {
             echo 'selected="selected"';
         }
         echo '>' . __('Use Global', 'podpress') . ' (' . $this->settings['iTunes']['block'] . ')</option>' . "\n";
         echo '						<option value="No" ';
         if ($data['iTunesBlock'] == 'No') {
             echo 'selected="selected"';
         }
         echo '>' . __('No', 'podpress') . '</option>' . "\n";
         echo '						<option value="Yes" ';
         if ($data['iTunesBlock'] == 'Yes') {
             echo 'selected="selected"';
         }
         echo '>' . __('Yes', 'podpress') . '</option>' . "\n";
         echo '					</select>' . "\n";
         echo '					<div id="itunesBlockHelp">' . "\n";
         echo '					' . __('Use this if you are no longer creating a podcast and you want it removed from the iTunes Store.', 'podpress') . "\n";
         echo '					<br/>' . __('"No" (default) - the podcast appears in the iTunes Podcast directory', 'podpress') . "\n";
         echo '					<br/>' . __('"Yes" - prevent the entire podcast from appearing in the iTunes Podcast directory', 'podpress') . "\n";
         echo '					<p>' . __('You can also use such an option for each of your podcast episodes (in the post/page editor).', 'podpress') . '</p>' . "\n";
         echo '					</div>' . "\n";
         echo '				</td>' . "\n";
         echo '			</tr>' . "\n";
         echo '			<tr> ' . "\n";
         echo '				<th>';
         echo '					<label for="iTunesFeedID">' . __('iTunes:FeedID', 'podpress') . '</label>';
         echo '				</th>';
         echo '				<td colspan="2">';
         echo '					<input name="iTunesFeedID" id="iTunesFeedID" type="text" value="' . attribute_escape($data['iTunesFeedID']) . '" size="10" /> ' . __('(Only relevant for the podPress Feed Buttons widget)', 'podpress');
         echo '				</td>' . "\n";
         echo '			</tr>' . "\n";
         echo '			<tr> ' . "\n";
         echo '				<th>';
         echo '					<label for="iTunesNewFeedURL">' . __('iTunes:New-Feed-Url', 'podpress') . '</label>';
         echo '				</th>';
         echo '				<td>';
         echo '					<select name="iTunesNewFeedURL" id="iTunesNewFeedURL">' . "\n";
         echo '						<option value="##Global##" ';
         if ($data['iTunesNewFeedURL'] == '##Global##' || empty($data['iTunesNewFeedURL'])) {
             echo 'selected="selected"';
         }
         echo '>' . __('Use Global', 'podpress') . '</option>' . "\n";
         echo '						<option value="Disable" ';
         if ($data['iTunesNewFeedURL'] == 'Disable') {
             echo 'selected="selected"';
         }
         echo '>' . __('Disable', 'podpress') . '</option>' . "\n";
         echo '						<option value="Enable" ';
         if ($data['iTunesNewFeedURL'] == 'Enable') {
             echo 'selected="selected"';
         }
         echo '>' . __('Enable', 'podpress') . '</option>' . "\n";
         echo '					</select>' . "\n";
         echo '				</td>';
         echo '				<td>';
         echo '					' . __('If you want to change the URL of your podcast feed which you have used in the iTunes Store then change the "Podcast Feed URL" and set this option to "Enable" until the iTunes Store recognizes the new URL. This may take several days. "Enable" will add the <code>&lt;itunes:new-feed-url&gt;</code> tag to the RSS feeds and set the "Podcast Feed URL" as the new URL. For further information about "<a href="http://www.apple.com/itunes/podcasts/specs.html#changing" title="iTunes Podcasting Resources: Changing Your Feed URL" target="_blank">Changing Your Feed URL</a>" read on in the <a href="http://www.apple.com/itunes/podcasts/specs.html" target="_blank" title="iTunes Podcasting Resources: Making a Podcast">iTunes Podcasting Resources</a>.', 'podpress') . "\n";
         echo '					<p><label for="podcastFeedURL"><strong>' . __('the new Feed URL', 'podpress') . '</strong></label>';
         echo '					<br/>';
         echo '					<input type="text" id="podcastFeedURL" name="podcastFeedURL" class="podpress_wide_text_field" size="40" value="' . attribute_escape($data['podcastFeedURL']) . '" /><br />' . __('The URL of your Podcast Feed. If you want to register your podcast at the iTunes Store or if your podcast is already listed there then this input field should contain the same URL as in the iTunes Store settings. If you want change the URL at the iTunes Store then please read first the help text of the iTunes:New-Feed-Url option.', 'podpress');
         echo '					<br /><input type="button" value="' . __('Validate your Feed', 'podpress') . '" onclick="javascript: if(document.getElementById(\'podcastFeedURL\').value != \'\') { window.open(\'http://www.feedvalidator.org/check.cgi?url=\'+document.getElementById(\'podcastFeedURL\').value); }"/>' . "\n";
         echo '				</p></td>' . "\n";
         echo '			</tr>' . "\n";
         echo '		</table>' . "\n";
         echo '		<h3>' . __('General Feed Settings', 'podpress') . '</h3>' . "\n";
         echo '		<table class="podpress_feed_gensettings">' . "\n";
         echo '			<tr>' . "\n";
         echo '				<th>';
         echo '					<label for="blognameChoice">' . __('Podcast title / Feed title', 'podpress') . '</label>';
         echo '				</th>';
         echo '				<td colspan="2">';
         echo '					<select id="blognameChoice" name="blognameChoice" onchange="javascript: podPress_updateCategoryCasting(' . $main_wp_version . ', \'' . $taxonomy . '\');">' . "\n";
         echo '						<option value="Append" ';
         if ($data['blognameChoice'] == 'Append' || empty($data['blognameChoice'])) {
             echo 'selected="selected"';
         }
         echo '>' . sprintf(__('Use the Site Title and append the name of the %1$s', 'podpress'), $taxonomy_str) . '</option>' . "\n";
         echo '						<option value="Global" ';
         if ($data['blognameChoice'] == 'Global') {
             echo 'selected="selected"';
         }
         echo '>' . __('Use the Site Title', 'podpress') . '</option>' . "\n";
         echo '						<option value="CategoryName" ';
         if ($data['blognameChoice'] == 'CategoryName') {
             echo 'selected="selected"';
         }
         echo '>' . __('Use the name of the category', 'podpress') . '</option>' . "\n";
         echo '					</select>' . "\n";
         echo '					<input type="hidden" id="global_blogname" value="' . attribute_escape(stripslashes(get_option('blogname'))) . '" /></td>' . "\n";
         echo '				</td>' . "\n";
         echo '			</tr>' . "\n";
         echo '			<tr>' . "\n";
         echo '				<th>';
         echo '					<label for="blogdescriptionChoice">' . __('Description (Tagline)', 'podpress') . '</label>' . "\n";
         echo '				</th>';
         echo '				<td colspan="2">';
         echo '					<select id="blogdescriptionChoice" name="blogdescriptionChoice" onchange="javascript: podPress_updateCategoryCasting(' . $main_wp_version . ', \'' . $taxonomy . '\');">' . "\n";
         echo '						<option value="Global" ';
         if ($data['blogdescriptionChoice'] != 'CategoryDescription') {
             echo 'selected="selected"';
         }
         echo '>' . __('Use Global', 'podpress') . '</option>' . "\n";
         echo '						<option value="CategoryDescription" ';
         if ($data['blogdescriptionChoice'] == 'CategoryDescription') {
             echo 'selected="selected"';
         }
         echo '>' . sprintf(__('Use %1$s Description', 'podpress'), $taxonomy_str) . '</option>' . "\n";
         echo '					</select>' . "\n";
         echo '					<input type="hidden" id="global_blogdescription" value="' . attribute_escape(stripslashes(get_option('blogdescription'))) . '" />' . "\n";
         echo '				</td>' . "\n";
         echo '			</tr>' . "\n";
         echo '			<tr>' . "\n";
         echo '				<th>';
         echo '					<label for="rss_imageChoice">' . __('Blog/RSS Image (144 x 144 pixels)', 'podpress') . '</label>' . "\n";
         echo '				</th>';
         echo '				<td colspan="2">';
         echo '					<select id="rss_imageChoice" name="rss_imageChoice" onchange="javascript: podPress_updateCategoryCasting(' . $main_wp_version . ', \'' . $taxonomy . '\');">' . "\n";
         echo '						<option value="Global" ';
         if ($data['rss_imageChoice'] != 'Custom') {
             echo 'selected="selected"';
         }
         echo '>' . __('Use Global', 'podpress') . '</option>' . "\n";
         echo '						<option value="Custom" ';
         if ($data['rss_imageChoice'] == 'Custom') {
             echo 'selected="selected"';
         }
         echo '>' . __('Insert custom value', 'podpress') . '</option>' . "\n";
         echo '					</select>' . "\n";
         echo '					<div id="rss_imageWrapper" style="display: none;">' . "\n";
         echo '						<br/>';
         echo '						<input id="rss_image" type="text" name="rss_image" value="' . $data['rss_image'] . '" class="podpress_wide_text_field" size="40" onchange="javascript: podPress_updateCategoryCasting(' . $main_wp_version . ', \'' . $taxonomy . '\');"/>' . "\n";
         echo '						<input id="global_rss_image" type="hidden" value="' . get_option('rss_image') . '"/>' . "\n";
         echo '					</div>' . "\n";
         echo '					<br/>';
         echo '					<img id="rss_image_Display" style="width:144px; height:144px;" alt="' . __('Podcast Image - Small (If you can not see an image then the URL is wrong.)', 'podpress') . '" src="" />' . "\n";
         echo '				</td>' . "\n";
         echo '			</tr>' . "\n";
         echo '			<tr>' . "\n";
         echo '				<th>';
         echo '					<label for="rss_language">' . __('Language', 'podpress') . '</label>' . "\n";
         echo '				</th>';
         echo '				<td colspan="2">';
         $langs = podPress_itunesLanguageArray();
         echo '					<select id="rss_language" name="rss_language" onchange="javascript: podPress_updateCategoryCasting(' . $main_wp_version . ', \'' . $taxonomy . '\');">' . "\n";
         echo '						<optgroup label="' . __('Select Language', 'podpress') . '">' . "\n";
         echo '						<option value="##Global##" ';
         if ($data['rss_language'] == '##Global##' || empty($data['rss_language'])) {
             echo 'selected="selected"';
         }
         echo '>' . __('Use Global', 'podpress') . ' - ' . $langs[get_option('rss_language')] . ' [' . get_option('rss_language') . ']</option>' . "\n";
         podPress_itunesLanguageOptions($data['rss_language']);
         echo '						</optgroup>' . "\n";
         echo '					</select>' . "\n";
         echo '					<input type="hidden" id="global_rss_language" value="' . $langs[get_option('rss_language')] . '[' . attribute_escape(get_option('rss_language')) . ']" /></td>' . "\n";
         echo '				</td>' . "\n";
         echo '			</tr>' . "\n";
         echo '		</table>' . "\n";
         echo '		<h3>' . __('Further Feed Settings', 'podpress') . '</h3>' . "\n";
         echo '		<table class="podpress_feed_gensettings">' . "\n";
         echo '			<tr>' . "\n";
         echo '				<th>' . "\n";
         echo '					<label for="rss_copyrightChoice">' . __('Feed Copyright / license name', 'podpress') . '</label>' . "\n";
         echo '				</th>';
         echo '				<td colspan="2">';
         echo '					<select id="rss_copyrightChoice" name="rss_copyrightChoice" onchange="javascript: podPress_updateCategoryCasting(' . $main_wp_version . ', \'' . $taxonomy . '\');">' . "\n";
         echo '						<option value="Global" ';
         if ($data['rss_copyrightChoice'] != 'Custom') {
             echo 'selected="selected"';
         }
         echo '>' . __('Use Global', 'podpress') . ' (' . podPress_stringLimiter(ucfirst(stripslashes($this->settings['rss_copyright'])), 40) . ')</option>' . "\n";
         echo '						<option value="Custom" ';
         if ($data['rss_copyrightChoice'] == 'Custom') {
             echo 'selected="selected"';
         }
         echo '>' . __('Insert custom value', 'podpress') . '</option>' . "\n";
         echo '					</select>' . "\n";
         echo '					<div id="rss_copyrightWrapper" style="display: none;">' . "\n";
         echo '						<input type="text" name="rss_copyright" class="podpress_wide_text_field" size="40" id="rss_copyright" value="' . attribute_escape(stripslashes($data['rss_copyright'])) . '" onchange="javascript: podPress_updateCategoryCasting(' . $main_wp_version . ', \'' . $taxonomy . '\');"/>';
         echo '					</div>' . "\n";
         echo '					<input type="hidden" id="global_rss_copyright" value="' . attribute_escape(stripslashes($this->settings['rss_copyright'])) . '" />' . "\n";
         echo '					<div id="rss_copyrightHelp">' . "\n";
         echo '						' . __('Enter the copyright string or license name. For example: Copyright &#169 by Jon Doe, 2009 OR <a href="http://creativecommons.org/licenses/by-nc-sa/2.5/" target="_blank">CreativeCommons Attribution-Noncommercial-Share Alike 2.5</a>', 'podpress') . "\n";
         echo '						<p>' . "\n";
         echo '						' . __('Used if this copyright phrase should be different than the global copyright phrase.', 'podpress') . "\n";
         echo '						</p>' . "\n";
         echo '					</div>' . "\n";
         echo '				</td>' . "\n";
         echo '			</tr>' . "\n";
         echo '			<tr>' . "\n";
         echo '				<th>' . "\n";
         echo '					<label for="rss_license_urlChoice">' . __('URL to the full Copyright / license text', 'podpress') . '</label>' . "\n";
         echo '				</th>';
         echo '				<td colspan="2">';
         echo '					<select id="rss_license_urlChoice" name="rss_license_urlChoice" onchange="javascript: podPress_updateCategoryCasting(' . $main_wp_version . ', \'' . $taxonomy . '\');">' . "\n";
         echo '						<option value="Global" ';
         if ($data['rss_license_urlChoice'] != 'Custom') {
             echo 'selected="selected"';
         }
         echo '>' . __('Use Global', 'podpress') . ' (' . podPress_stringLimiter(ucfirst(stripslashes($this->settings['rss_license_url'])), 40) . ')</option>' . "\n";
         echo '						<option value="Custom" ';
         if ($data['rss_license_urlChoice'] == 'Custom') {
             echo 'selected="selected"';
         }
         echo '>' . __('Insert custom value', 'podpress') . '</option>' . "\n";
         echo '					</select>' . "\n";
         echo '					<div id="rss_license_urlWrapper" style="display: none;">' . "\n";
         echo '						<input name="rss_license_url" type="text" id="rss_license_url" class="podpress_wide_text_field" value="' . attribute_escape($data['rss_license_url']) . '" size="65%" />' . "\n";
         echo '					</div>' . "\n";
         echo '					<input type="hidden" id="global_rss_license_url" value="' . attribute_escape($this->settings['rss_license_url']) . '" />' . "\n";
         echo '					<div id="rss_license_urlHelp">' . "\n";
         echo '						' . __('If you use a special license like a <a href="http://creativecommons.org/licenses" target="_blank" title="Creative Commons">Creative Commons</a> License for your news feeds then enter the complete URL (e.g. <a href="http://creativecommons.org/licenses/by-nc-sa/2.5/" target="_blank">http://creativecommons.org/licenses/by-nc-sa/2.5/</a>) to the full text of this particular license here.', 'podpress') . "\n";
         echo '						<p>' . __('Used if this license URL should be different than the global license URL.', 'podpress') . '</p>' . "\n";
         echo '					</div>' . "\n";
         echo '				</td>' . "\n";
         echo '			</tr>' . "\n";
         echo '			<tr>' . "\n";
         $filetypes = podPress_filetypes();
         $selected_types = $data['FileTypes'];
         if (FALSE === is_array($data['FileTypes'])) {
             $selected_types = array();
         }
         echo '				<th>';
         echo '				' . __('inlude only files of this(these) type(s)', 'podpress');
         echo '				</th>' . "\n";
         echo '				<td>';
         echo '					<select id="filenameextensionfilter" name="FileTypes[]" size="5" multiple="multiple" style="height:15em;">' . "\n";
         echo '					<optgroup label="' . attribute_escape(__('Select file types', 'podpress')) . '">' . "\n";
         foreach ($filetypes as $key => $value) {
             if (TRUE == in_array($key, $selected_types)) {
                 $selected = ' selected="selected"';
             } else {
                 $selected = '';
             }
             if ($key !== 'audio_mp4') {
                 echo '						<option value="' . $key . '"' . $selected . '>' . $value . '</option>';
             }
         }
         echo '					</optgroup>' . "\n";
         echo '					</select>' . "\n";
         echo '				</td>' . "\n";
         echo '				<td>';
         echo '					' . __('You can select one or more media file types and limit by this choice the number of posts which will appear in the this Feed. For instance: if you select MP4 Video then this Feed will only contain posts (of this category) with MP4 files. If a post has also files of other types then only the files of the selected type will be attached in this feed. (This filter bypasses the "Included in:" selection.)', 'podpress') . '</p><p>' . __('Hold the key [SHIFT] or [CTRL] and use the left mouse button to select more than one value.<br />Hold [CTRL] and use the left mouse button to deselect values.', 'podpress');
         echo '				</td>' . "\n";
         echo '			</tr>' . "\n";
         echo '			<tr>' . "\n";
         echo '				<th>';
         echo '				<label for="show_only_podPress_podcasts">' . __('Include only posts with podPress attachments in this Feed', 'podpress') . '</label>' . "\n";
         echo '				</th>' . "\n";
         echo '				<td>';
         if (TRUE == isset($data['show_only_podPress_podcasts']) and FALSE === $data['show_only_podPress_podcasts']) {
             echo '					<input type="checkbox" name="show_only_podPress_podcasts" id="show_only_podPress_podcasts" value="yes" />' . "\n";
         } else {
             echo '					<input type="checkbox" name="show_only_podPress_podcasts" id="show_only_podPress_podcasts" value="yes" checked="checked" />' . "\n";
         }
         echo '				</td>' . "\n";
         echo '				<td>';
         echo '					' . __('works only while the File Type Filter is not in use', 'podpress');
         echo '				</td>' . "\n";
         echo '			</tr>' . "\n";
         echo '		</table>' . "\n";
         echo '		</fieldset>' . "\n";
         echo '	</div>' . "\n";
         echo '<script type="text/javascript">podPress_updateCategoryCasting(' . $main_wp_version . ', \'' . $taxonomy . '\'); </script>';
         echo '</div>' . "\n";
     }
 }
 function checkSettings()
 {
     global $wp_object_cache, $wp_rewrite, $wp_version;
     if (!is_array($this->settings)) {
         $this->settings = podPress_get_option('podPress_config');
         if (!is_array($this->settings)) {
             $this->settings = array();
         }
     }
     $this->settings['lastChecked'] = PODPRESS_VERSION;
     // Make sure some standard values are set.
     $x = get_option('rss_language');
     if (!$x || empty($x)) {
         add_option('rss_language', 'en');
     }
     $x = get_option('rss_image');
     if (!$x || empty($x)) {
         podPress_update_option('rss_image', podPress_url() . 'images/powered_by_podpress.jpg');
     }
     // ntm: these settings are for the theme compatibility check resp. message. It seems to me that this checker was not in place at least since 8.8.
     // I could not find the routine which searches through the theme files for the wp_head and get_header etc. calls. Until there is such a test, I will set these values to TRUE.
     //~ if($this->settings['compatibilityChecks']['themeTested'] !== true) {
     //~ $this->settings['compatibilityChecks']['themeTested'] = false;
     //~ }
     //~ if($this->settings['compatibilityChecks']['wp_head'] !== true) {
     //~ $this->settings['compatibilityChecks']['wp_head'] = false;
     //~ }
     //~ if($this->settings['compatibilityChecks']['wp_footer'] !== true) {
     //~ $this->settings['compatibilityChecks']['wp_footer'] = false;
     //~ }
     $this->settings['compatibilityChecks']['themeTested'] = TRUE;
     $this->settings['compatibilityChecks']['wp_head'] = TRUE;
     $this->settings['compatibilityChecks']['wp_footer'] = TRUE;
     if (!is_bool($this->settings['enableStats'])) {
         if ($this->settings['enableStats'] == 'true') {
             $this->settings['enableStats'] = true;
         } else {
             $this->settings['enableStats'] = false;
         }
     }
     // no dashboardwidget support for WP 2.5.x and WP 2.6.x
     if (TRUE == isset($this->settings['disabledashboardwidget']) and TRUE === $this->settings['disabledashboardwidget'] or TRUE == version_compare($wp_version, '2.5', '>=') and TRUE == version_compare($wp_version, '2.7', '<')) {
         $this->settings['disabledashboardwidget'] = TRUE;
     } else {
         $this->settings['disabledashboardwidget'] = FALSE;
     }
     if (!$this->settings['statMethod'] || empty($this->settings['statMethod']) || $this->settings['statMethod'] == 'htaccess') {
         $this->settings['statMethod'] = 'permalinks';
     }
     if (!$this->settings['statLogging'] || empty($this->settings['statLogging'])) {
         $this->settings['statLogging'] = 'Counts';
     }
     if (empty($this->settings['enable3rdPartyStats'])) {
         $this->settings['enable3rdPartyStats'] = 'No';
     }
     if (!is_bool($this->settings['enableBlubrryStats'])) {
         if ($this->settings['enableBlubrryStats'] == 'true') {
             $this->settings['enableBlubrryStats'] = true;
         } else {
             $this->settings['enableBlubrryStats'] = false;
         }
     }
     if (!$this->settings['rss_copyright'] || empty($this->settings['rss_copyright'])) {
         $this->settings['rss_copyright'] = __('Copyright', 'podpress') . ' &#xA9; ' . get_bloginfo('blogname') . ' ' . date('Y', time());
     }
     if (podPress_WPVersionCheck('2.0.0')) {
         if (!is_bool($this->settings['enablePremiumContent'])) {
             if ($this->settings['enablePremiumContent'] == 'true') {
                 $this->settings['enablePremiumContent'] = true;
             } else {
                 $this->settings['enablePremiumContent'] = false;
             }
         }
     } else {
         $this->settings['enablePremiumContent'] = false;
     }
     if (empty($this->settings['premiumMethod'])) {
         $this->settings['premiumMethod'] = 'Digest';
     }
     if (!defined('PODPRESS_PREMIUM_METHOD')) {
         define('PODPRESS_PREMIUM_METHOD', $this->settings['premiumMethod']);
     }
     if (!is_bool($this->settings['enableTorrentCasting'])) {
         if ($this->settings['enableTorrentCasting'] == 'true') {
             $this->settings['enableTorrentCasting'] = true;
         } else {
             $this->settings['enableTorrentCasting'] = false;
         }
     }
     if (empty($this->settings['podcastFeedURL'])) {
         if (podPress_WPVersionCheck('2.1')) {
             //~ $this->settings['podcastFeedURL'] = site_url().'/?feed=podcast';
             $this->settings['podcastFeedURL'] = get_feed_link('podcast');
         } else {
             $this->settings['podcastFeedURL'] = site_url() . '/?feed=rss2';
         }
     }
     if (FALSE == isset($this->settings['mediaWebPath']) or TRUE == empty($this->settings['mediaWebPath'])) {
         $this->settings['mediaWebPath'] = $this->uploadurl;
     }
     $this->checkLocalPathToMediaFiles();
     if (empty($this->settings['maxMediaFiles']) || $this->settings['maxMediaFiles'] < 1) {
         $this->settings['maxMediaFiles'] = 10;
     }
     if (!$this->settings['contentBeforeMore'] || empty($this->settings['contentBeforeMore'])) {
         $this->settings['contentBeforeMore'] = 'yes';
     }
     if (!$this->settings['contentLocation'] || empty($this->settings['contentLocation'])) {
         $this->settings['contentLocation'] = 'end';
     }
     if (!$this->settings['contentImage'] || empty($this->settings['contentImage'])) {
         $this->settings['contentImage'] = 'button';
     }
     if (!$this->settings['contentPlayer'] || empty($this->settings['contentPlayer'])) {
         $this->settings['contentPlayer'] = 'both';
     }
     if (!$this->settings['contentHidePlayerPlayNow'] || empty($this->settings['contentHidePlayerPlayNow'])) {
         $this->settings['contentHidePlayerPlayNow'] = 'enabled';
     }
     if (FALSE == isset($this->settings['videoPreviewImage']) or empty($this->settings['videoPreviewImage'])) {
         $this->settings['videoPreviewImage'] = PODPRESS_URL . '/images/vpreview_center.png';
     }
     if (!is_bool($this->settings['disableVideoPreview'])) {
         if ($this->settings['disableVideoPreview'] == 'true') {
             $this->settings['disableVideoPreview'] = true;
         } else {
             $this->settings['disableVideoPreview'] = false;
         }
     }
     if (!$this->settings['contentDownload'] || empty($this->settings['contentDownload'])) {
         $this->settings['contentDownload'] = 'enabled';
     }
     if (!$this->settings['contentDownloadText'] || empty($this->settings['contentDownloadText'])) {
         $this->settings['contentDownloadText'] = 'enabled';
     }
     if (!$this->settings['contentDownloadStats'] || empty($this->settings['contentDownloadStats'])) {
         $this->settings['contentDownloadStats'] = 'enabled';
     }
     if (!$this->settings['contentDuration'] || empty($this->settings['contentDuration'])) {
         $this->settings['contentDuration'] = 'enabled';
     }
     if (FALSE == isset($this->settings['contentfilesize']) or TRUE == empty($this->settings['contentfilesize'])) {
         $this->settings['contentfilesize'] = 'disabled';
     }
     if (FALSE == isset($this->settings['incontentandexcerpt'])) {
         $this->settings['incontentandexcerpt'] = 'in_content_and_excerpt';
     }
     if (!is_bool($this->settings['contentAutoDisplayPlayer'])) {
         if ($this->settings['contentAutoDisplayPlayer'] == 'false') {
             $this->settings['contentAutoDisplayPlayer'] = false;
         } else {
             $this->settings['contentAutoDisplayPlayer'] = true;
         }
     }
     if (FALSE == is_bool($this->settings['enableFooter'])) {
         $this->settings['enableFooter'] = false;
     }
     if (FALSE == isset($this->settings['mp3Player'])) {
         $this->settings['mp3Player'] = '1pixelout';
     }
     if ($this->settings['player']['bg'] == '') {
         $this->resetPlayerSettings();
     }
     if (empty($this->settings['iTunes']['summary'])) {
         $this->settings['iTunes']['summary'] = stripslashes(get_option('blogdescription'));
     } else {
         $this->settings['iTunes']['summary'] = stripslashes($this->settings['iTunes']['summary']);
     }
     $this->settings['iTunes']['keywords'] = stripslashes($this->settings['iTunes']['keywords']);
     $this->settings['iTunes']['subtitle'] = stripslashes($this->settings['iTunes']['subtitle']);
     $this->settings['iTunes']['author'] = stripslashes($this->settings['iTunes']['author']);
     $this->settings['iTunes']['FeedID'] = stripslashes($this->settings['iTunes']['FeedID']);
     $this->settings['iTunes']['FeedID'] = str_replace(' ', '', $this->settings['iTunes']['FeedID']);
     if (!empty($this->settings['iTunes']['FeedID']) && !is_numeric($this->settings['iTunes']['FeedID'])) {
         $this->settings['iTunes']['FeedID'] = settype($this->settings['iTunes']['FeedID'], 'double');
     }
     if (empty($this->settings['iTunes']['explicit'])) {
         $this->settings['iTunes']['explicit'] = 'No';
     }
     if (empty($this->settings['iTunes']['image'])) {
         $x = get_option('rss_image');
         if (FALSE !== $x && $x != podPress_url() . 'images/powered_by_podpress.jpg') {
             $this->settings['iTunes']['image'] = $x;
         } else {
             $this->settings['iTunes']['image'] = podPress_url() . 'images/powered_by_podpress_large.jpg';
         }
     }
     if (FALSE == isset($this->settings['iTunes']['new-feed-url']) or 'Enable' != $this->settings['iTunes']['new-feed-url'] and 'Disable' != $this->settings['iTunes']['new-feed-url']) {
         $this->settings['iTunes']['new-feed-url'] = 'Disable';
     }
     if (FALSE == isset($this->settings['iTunes']['block']) or 'Yes' != $this->settings['iTunes']['block'] and 'No' != $this->settings['iTunes']['block']) {
         $this->settings['iTunes']['block'] = 'No';
     }
     if (FALSE == isset($this->settings['rss_license_url'])) {
         $this->settings['rss_license_url'] = '';
     }
     // since 8.8.8: default settings for the fully customizable feeds
     if (FALSE == is_array($this->settings['podpress_feeds']) or empty($this->settings['podpress_feeds'])) {
         $email = get_option('admin_email');
         if (FALSE === $email) {
             $email = '';
         }
         $tagline = $this->settings['iTunes']['subtitle'];
         if (FALSE === $tagline) {
             $tagline = '';
         }
         $blog_charset = get_bloginfo('charset');
         $rss_language = get_option('rss_language');
         if (FALSE === $rss_language) {
             $rss_language = 'en';
         }
         $rss_image = get_option('rss_image');
         if (FALSE === $rss_image or TRUE == empty($rss_image)) {
             $rss_image = PODPRESS_URL . '/images/powered_by_podpress.jpg';
         }
         $ttl = get_option('rss_ttl');
         if (FALSE === $ttl or !empty($ttl) && $ttl < 1440) {
             $ttl = 1440;
         }
         //~ if ( defined('PODPRESS_TAKEOVER_OLD_SETTINGS') AND TRUE === constant('PODPRESS_TAKEOVER_OLD_SETTINGS') ) {
         if (FALSE == is_array($this->settings['iTunes']['category'])) {
             $itunescategory = array();
         }
         $this->settings['podpress_feeds'][0] = array('use' => TRUE, 'premium' => FALSE, 'name' => __('Podcast Feed', 'podpress'), 'slug' => 'podcast', 'feedtitle' => 'append', 'subtitle' => $tagline, 'itunes-newfeedurl' => 'Disable', 'descr' => $this->settings['iTunes']['summary'], 'itunes-category' => $itunescategory, 'rss_category' => $this->settings['rss_category'], 'itunes-keywords' => $this->settings['iTunes']['keywords'], 'itunes-author' => $this->settings['iTunes']['author'], 'email' => $email, 'itunes-image' => $this->settings['iTunes']['image'], 'rss_image' => $rss_image, 'copyright' => $this->settings['rss_copyright'], 'license_url' => $this->settings['rss_license_url'], 'language' => $rss_language, 'charset' => $blog_charset, 'FileTypes' => array(), 'inclCategories' => array(), 'show_only_podPress_podcasts' => TRUE, 'bypass_incl_selection' => FALSE, 'itunes-explicit' => $this->settings['iTunes']['explicit'], 'feedtype' => 'rss', 'ttl' => $ttl, 'itunes-feedid' => $this->settings['iTunes']['FeedID'], 'itunes-block' => $this->settings['iTunes']['block'], 'use_headerlink' => FALSE);
         $this->settings['podpress_feeds'][1] = array('use' => FALSE, 'premium' => FALSE, 'name' => __('Enhanced Podcast Feed', 'podpress'), 'slug' => 'enhancedpodcast', 'feedtitle' => 'append', 'subtitle' => $tagline, 'itunes-newfeedurl' => 'Disable', 'descr' => $this->settings['iTunes']['summary'], 'itunes-category' => $itunescategory, 'rss_category' => $this->settings['rss_category'], 'itunes-keywords' => $this->settings['iTunes']['keywords'], 'itunes-author' => $this->settings['iTunes']['author'], 'email' => $email, 'itunes-image' => $this->settings['iTunes']['image'], 'rss_image' => $rss_image, 'copyright' => $this->settings['rss_copyright'], 'license_url' => $this->settings['rss_license_url'], 'language' => $rss_language, 'charset' => $blog_charset, 'FileTypes' => array('audio_m4a', 'video_m4v'), 'inclCategories' => array(), 'show_only_podPress_podcasts' => TRUE, 'bypass_incl_selection' => FALSE, 'itunes-explicit' => $this->settings['iTunes']['explicit'], 'feedtype' => 'atom', 'ttl' => $ttl, 'itunes-feedid' => $this->settings['iTunes']['FeedID'], 'itunes-block' => $this->settings['iTunes']['block'], 'use_headerlink' => FALSE);
         $this->settings['podpress_feeds'][2] = array('use' => FALSE, 'premium' => FALSE, 'name' => __('Torrent Feed', 'podpress'), 'slug' => 'torrent', 'feedtitle' => 'append', 'subtitle' => $tagline, 'itunes-newfeedurl' => 'Disable', 'descr' => $this->settings['iTunes']['summary'], 'itunes-category' => $itunescategory, 'rss_category' => $this->settings['rss_category'], 'itunes-keywords' => $this->settings['iTunes']['keywords'], 'itunes-author' => $this->settings['iTunes']['author'], 'email' => $email, 'itunes-image' => $this->settings['iTunes']['image'], 'rss_image' => $rss_image, 'copyright' => $this->settings['rss_copyright'], 'license_url' => $this->settings['rss_license_url'], 'language' => $rss_language, 'charset' => $blog_charset, 'FileTypes' => array('torrent'), 'inclCategories' => array(), 'show_only_podPress_podcasts' => TRUE, 'bypass_incl_selection' => FALSE, 'itunes-explicit' => $this->settings['iTunes']['explicit'], 'feedtype' => 'atom', 'ttl' => $ttl, 'itunes-feedid' => $this->settings['iTunes']['FeedID'], 'itunes-block' => $this->settings['iTunes']['block'], 'use_headerlink' => FALSE);
         if (FALSE == defined('PODPRESS_DEACTIVATE_PREMIUM') or FALSE === constant('PODPRESS_DEACTIVATE_PREMIUM')) {
             $this->settings['podpress_feeds'][3] = array('use' => FALSE, 'premium' => TRUE, 'name' => __('Premium Feed', 'podpress'), 'slug' => 'premium', 'feedtitle' => 'append', 'subtitle' => $tagline, 'itunes-newfeedurl' => 'Disable', 'descr' => $this->settings['iTunes']['summary'], 'itunes-category' => $itunescategory, 'rss_category' => $this->settings['rss_category'], 'itunes-keywords' => $this->settings['iTunes']['keywords'], 'itunes-author' => $this->settings['iTunes']['author'], 'email' => $email, 'itunes-image' => $this->settings['iTunes']['image'], 'rss_image' => $rss_image, 'copyright' => $this->settings['rss_copyright'], 'license_url' => $this->settings['rss_license_url'], 'language' => $rss_language, 'charset' => $blog_charset, 'FileTypes' => array(), 'inclCategories' => array(), 'show_only_podPress_podcasts' => TRUE, 'bypass_incl_selection' => FALSE, 'itunes-explicit' => $this->settings['iTunes']['explicit'], 'feedtype' => 'rss', 'ttl' => $ttl, 'itunes-feedid' => $this->settings['iTunes']['FeedID'], 'itunes-block' => $this->settings['iTunes']['block'], 'use_headerlink' => FALSE);
         }
         //~ } else {
         //~ // in case it is a first time installation
         //~ $this->settings['podpress_feeds'][0] = array(
         //~ 'use' => TRUE,
         //~ 'premium' => FALSE,
         //~ 'name' => __('Podcast Feed', 'podpress'),
         //~ 'slug' => 'podcast',
         //~ 'feedtitle' => 'append',
         //~ 'subtitle' => '',
         //~ 'itunes-newfeedurl' => 'Disable',
         //~ 'descr' => '',
         //~ 'itunes-category' => Array(),
         //~ 'rss_category' => '',
         //~ 'itunes-keywords' => '',
         //~ 'itunes-author' => '',
         //~ 'email' => '',
         //~ 'itunes-image' => $this->settings['iTunes']['image'],
         //~ 'rss_image' => $rss_image,
         //~ 'copyright' => $this->settings['rss_copyright'],
         //~ 'license_url' => '',
         //~ 'language' => $rss_langauge,
         //~ 'charset' => $blog_charset,
         //~ 'FileTypes' => Array(),
         //~ 'itunes-explicit' => 'No',
         //~ 'feedtype' => 'rss',
         //~ 'ttl' => $ttl,
         //~ 'itunes-feedid' => '',
         //~ 'itunes-block' => 'No'
         //~ );
         //~ }
     }
     podPress_update_option('podPress_config', $this->settings);
     if (is_object($wp_rewrite) && is_array($wp_object_cache) && is_array($wp_object_cache['cache']) && is_array($wp_object_cache['cache']['options']) && is_array($wp_object_cache['cache']['options']['alloptions']) && is_array($wp_object_cache['cache']['options']['alloptions']['rewrite_rules']) && !strpos($wp_object_cache['cache']['options']['alloptions']['rewrite_rules'], 'playlist.xspf')) {
         $wp_rewrite->flush_rules();
     }
 }