PageRenderTime 58ms CodeModel.GetById 21ms RepoModel.GetById 1ms app.codeStats 0ms

/wordpress/wp-content/plugins/podpress/podpress_admin_functions.php

https://github.com/bill742/verbalbrew
PHP | 1827 lines | 1470 code | 180 blank | 177 comment | 197 complexity | 5a32a37b6f22d792643183234526e853 MD5 | raw file
Possible License(s): BSD-3-Clause, GPL-3.0, AGPL-1.0, LGPL-2.1, GPL-2.0

Large files files are truncated, but you can click here to view the full file

  1. <?php
  2. /*
  3. License:
  4. ==============================================================================
  5. Copyright 2006 Dan Kuykendall (email : dan@kuykendall.org)
  6. This program is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 2 of the License, or
  9. (at your option) any later version.
  10. This program is distributed in the hope that it will be useful,
  11. but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. GNU General Public License for more details.
  14. You should have received a copy of the GNU General Public License
  15. along with this program; if not, write to the Free Software
  16. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-107 USA
  17. */
  18. function podPress_isAuthorized($needed = '##NOTSET##', $justChecking = false) {
  19. GLOBAL $user_level, $podPress;
  20. if($needed == '##NOTSET##') {
  21. $needed = $podPress->requiredadminrights;
  22. }
  23. if (function_exists('current_user_can')) {
  24. $result = current_user_can($needed);
  25. } else {
  26. $result = $user_level > 5;
  27. }
  28. if(!$justChecking && !$result) {
  29. die(__('Access Denied', 'podpress'));
  30. }
  31. return $result;
  32. }
  33. //this is crap
  34. function podPress_getCapName($cap) {
  35. return ucwords(str_replace('_', ' ', $cap));
  36. }
  37. function podPress_DirectoriesPreview($context) {
  38. echo ' <fieldset class="options">'."\n";
  39. echo ' <legend class="podpress_directorypreview_legend">'.__('Directory Preview', 'podpress').'</legend> <a href="javascript:void(null);" id="podpress_showhide_directory_preview" class="podpress_showhide_element" onclick="podpress_showhide_adv(\'podpress_DirectoryPreviewDisplay\', true, this.id);">[ '.__('Show', 'podpress').' ]</a>';
  40. echo ' <div id="podpress_DirectoryPreviewDisplay" style="display:none;">'."\n";
  41. echo ' <a href="javascript:void(null);" onclick="javascript: podPressShowDirectoryPreview(\'iTunes\');"><img src="'.podPress_url().'images/directoryPreview_iTunes_logo.png" border="0" alt="iTunes preview" /></a> &nbsp;';
  42. /// YAHOO! Podcast is shutdown since 2007 - see, http://en.wikipedia.org/wiki/Yahoo!_Podcasts
  43. //echo ' <a href="javascript:void(null);" onclick="javascript: podPressShowDirectoryPreview(\'Yahoo\');"><img src="'.podPress_url().'images/directoryPreview_yahoo_logo.png" border="0" alt="Yahoo preview" /></a> &nbsp;';
  44. echo ' <a href="javascript:void(null);" onclick="javascript: podPressShowDirectoryPreview(\'PodcastAlley\');"><img src="'.podPress_url().'images/directoryPreview_PCA_logo.png" border="0" alt="PodcastAlley preview" /></a>';
  45. echo ' <a href="javascript:void(null);" onclick="javascript: podPressShowDirectoryPreview(\'PodcastReady\');"><img src="'.podPress_url().'images/directoryPreview_PodcastReady_logo.png" border="0" alt="PodcastAlley preview" /></a>';
  46. echo ' <a href="javascript:void(null);" onclick="javascript: podPressShowDirectoryPreview(\'Blubrry\');"><img src="'.podPress_url().'images/directoryPreview_Blubrry_logo.jpg" border="0" alt="Blubrry preview" /></a>';
  47. echo ' '."\n";
  48. echo ' <div id="iTunesPreviewDisplay" style="border: 0;">'."\n";
  49. echo ' <div style="width: 100%; text-align: center;"><a href="http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewGenre?id=26" target="_new">Visit this directory</a> / <a href="https://phobos.apple.com/WebObjects/MZFinance.woa/wa/publishPodcast" target="_new">Submit to this directory</a></div>'."\n";
  50. echo ' <table width="100%" cellspacing="2" cellpadding="5" class="editform" style="background-color:#8CA9CB;">'."\n";
  51. echo ' <tr valign="top">'."\n";
  52. echo ' <td colspan="3">'."\n";
  53. echo ' <b><font size="+1"><span id="iTunesBlognamePreview"></span></font></b><br/>'."\n";
  54. echo ' </td>'."\n";
  55. echo ' </tr>'."\n";
  56. echo ' <tr valign="top">'."\n";
  57. echo ' <td width="1%">'."\n";
  58. echo ' <img id="iTunesPreviewImage" width="175" height="175" alt="Podcast Image" src=""/>'."\n";
  59. echo ' </td>'."\n";
  60. echo ' <td align="left">'."\n";
  61. echo ' <span id="itunesAuthorPreview" style="font-weight: bold;"></span><br/><br/>'."\n";
  62. echo ' <span style="font-size: small;">'."\n";
  63. echo ' Category: <span id="itunesCategoryPreview"></span><br/>'."\n";
  64. echo ' Language: <span id="iTunesRssLanguagePreview">English</span><br/>'."\n";
  65. echo ' Total: n episodes<br/><br/>'."\n";
  66. echo ' <img src="'.podPress_url().'images/directoryPreview_iTunes_subscribebutton.png" border="0" alt="iTunesSubscriptions" /> '."\n";
  67. echo ' </span>'."\n";
  68. echo ' </td>'."\n";
  69. echo ' <td rowspan="3" width="1%">'."\n";
  70. echo ' <img src="'.podPress_url().'images/directoryPreview_iTunes_seeallpodcasts.png" border="0" alt="iTunesSeeAllPodcasts" /> '."\n";
  71. echo ' <br/><br/>'."\n";
  72. echo ' <img src="'.podPress_url().'images/directoryPreview_iTunes_alsosubcribedto.png" border="0" alt="iTunesAlsoSubscribeTo" /> '."\n";
  73. echo ' </td>'."\n";
  74. echo ' </tr>'."\n";
  75. echo ' <tr valign="top">'."\n";
  76. echo ' <td colspan="2">'."\n";
  77. echo ' <b><font size="+1" color="#163B6A">Podcast Description</font></b><br/><br/>'."\n";
  78. echo ' <span id="itunesDescriptionPreview" style="font-size: small;"></span>'."\n";
  79. echo ' </td>'."\n";
  80. echo ' </tr>'."\n";
  81. echo ' <tr valign="top">'."\n";
  82. echo ' <td colspan="2" bgcolor="#8DAACC">'."\n";
  83. echo ' <table width="100%" bgcolor="#8DAACC">'."\n";
  84. echo ' <tr>'."\n";
  85. echo ' <td align="left">'."\n";
  86. echo ' <img src="'.podPress_url().'images/directoryPreview_iTunes_l_reviews.png" border="0" alt="iTunesReviews" /> '."\n";
  87. echo ' </td>'."\n";
  88. echo ' <td align="right">'."\n";
  89. echo ' <img src="'.podPress_url().'images/directoryPreview_iTunes_r_reviews.png" border="0" alt="iTunesReviews" /> '."\n";
  90. echo ' </td>'."\n";
  91. echo ' </tr>'."\n";
  92. echo ' </table>'."\n";
  93. echo ' </td>'."\n";
  94. echo ' </tr>'."\n";
  95. echo ' </table>'."\n";
  96. echo ' </div>'."\n";
  97. echo ' <div id="YahooPreviewDisplay" style="display: none;">'."\n";
  98. echo ' <div style="width: 100%; text-align: center;"><a href="http://podcasts.yahoo.com/" target="_new">Visit this directory</a> / <a href="http://podcasts.yahoo.com/publish" target="_new">Submit to this directory</a></div>'."\n";
  99. echo ' <div style="width: 100%; border: 1px solid grey;">'."\n";
  100. echo ' <table width="100%" border="0" cellspacing="0" cellpadding="0">'."\n";
  101. echo ' <tr valign="top">'."\n";
  102. echo ' <td colspan="3">'."\n";
  103. echo ' <b><font size="+1" color="#669900">Series Information: <span id="YahooBlognamePreview"></span></font></b><br/><br/>'."\n";
  104. echo ' </td>'."\n";
  105. echo ' </tr>'."\n";
  106. echo ' <tr valign="top">'."\n";
  107. echo ' <td width="1%" rowspan="2">'."\n";
  108. echo ' <img id="YahooPreviewImage" width="175" height="175" alt="Podcast Image" src=""/><br/><br/>'."\n";
  109. echo ' <img src="'.podPress_url().'images/directoryPreview_yahoo_buttons.png" border="0" alt="YahooButtons" /> '."\n";
  110. echo ' </td>'."\n";
  111. echo ' <td colspan="2">'."\n";
  112. echo ' <span id="YahooDescriptionPreview" style="font-size: small;"></span>'."\n";
  113. echo ' </td>'."\n";
  114. echo ' </tr>'."\n";
  115. echo ' <tr valign="top">'."\n";
  116. echo ' <td align="left">'."\n";
  117. echo ' <font size="+1" color="#669900">Details</font><br/>'."\n";
  118. echo ' Episodes: N<br/>'."\n";
  119. echo ' Web Site: <font color="#2597D6">'.get_option('siteurl').'</font><br/>'."\n";
  120. echo ' RSS: <span id="YahooFeedURLPreview" style="color: #2597D6;"></span><br/>'."\n";
  121. echo ' Author: <span id="YahooAuthorPreview"></span><br/>'."\n";
  122. echo ' Language: <span id="YahooRssLanguagePreview">English</span><br/>'."\n";
  123. echo ' Copyright: --<br/>'."\n";
  124. echo ' Published: whatever date<br/>'."\n";
  125. echo ' </td>'."\n";
  126. echo ' <td align="left">'."\n";
  127. echo ' <font size="+1" color="#669900">Ratings</font><br/>'."\n";
  128. echo ' Be the first to rate!<br/><br/>'."\n";
  129. echo ' <b>Rate it:</b><br/>'."\n";
  130. echo ' <img src="'.podPress_url().'images/directoryPreview_yahoo_stars.png" border="0" alt="YahooStars" /> '."\n";
  131. echo ' <br/><font color="#2597D6">Write a Review</font><br/>'."\n";
  132. echo ' </td>'."\n";
  133. echo ' </tr>'."\n";
  134. echo ' </table>'."\n";
  135. echo ' </div>'."\n";
  136. echo ' </div>'."\n";
  137. echo ' <div id="PodcastAlleyPreviewDisplay" style="display: none; border: 0;">'."\n";
  138. echo ' <div style="width: 100%; text-align: center;"><a href="http://www.podcastalley.com/" target="_new">Visit this directory</a> / <a href="http://www.podcastalley.com/add_a_podcast.php" target="_new">Submit to this directory</a></div>'."\n";
  139. echo ' <table width="100%" border="0" cellspacing="0" cellpadding="0" style="background-color:#FFFFFF;">'."\n";
  140. echo ' <tr valign="top">'."\n";
  141. echo ' <td width="5%">'."\n";
  142. echo ' <img src="'.podPress_url().'images/directoryPreview_PCA_left.png" border="0" alt="PCA Left" /> '."\n";
  143. echo ' </td>'."\n";
  144. echo ' <td width="90%">'."\n";
  145. echo ' <table width="100%" border="0" cellspacing="0" cellpadding="0" style="background-color:#F2F2F2;">'."\n";
  146. echo ' <tr valign="top">'."\n";
  147. echo ' <td class="podPress_statscell" valign="top" width="140">'."\n";
  148. echo ' <table class="podPress_statstable" width="100%" border="0" cellspacing="0" cellpadding="0">'."\n";
  149. echo ' <tr>'."\n";
  150. echo ' <td class="podPress_statshead">Podcast Stats</td>'."\n";
  151. echo ' </tr>'."\n";
  152. echo ' <tr>'."\n";
  153. echo ' <td class="podPress_linkscell">'."\n";
  154. echo ' <p><span class="podPress_captionstats">GENRE: </span> <span id="PCACategoryPreview"></span><br/>'."\n";
  155. echo ' <span class="podPress_captionstats">COMMENTS:</span> 0<br/>'."\n";
  156. echo ' <span class="podPress_captionstats">MONTHLY VOTES:</span> 0<br/>'."\n";
  157. echo ' <span class="podPress_captionstats">OVERALL VOTES:</span> 0<br/>'."\n";
  158. echo ' <span class="podPress_captionstats">MEMBER: </span>1/2000<br/>'."\n";
  159. echo ' <span class="podPress_captionstats">MONTHLY RANK:</span><br/>Not Yet Ranked<br/>'."\n";
  160. echo ' <br/><img src="'.podPress_url().'images/directoryPreview_PCA_buttons.png" border="0" alt="PCAButtons" /> '."\n";
  161. echo ' </td>'."\n";
  162. echo ' </tr>'."\n";
  163. echo ' </table>'."\n";
  164. echo ' </td>'."\n";
  165. echo ' <td class="podPress_desccell" valign="top">'."\n";
  166. echo ' <font size="3" color="#666666"><b><span id="PCABlognamePreview"></span></b></font><br/>'."\n";
  167. echo ' <span style="color: #666666;" id="PCADescriptionPreview"></span>'."\n";
  168. echo ' </td>'."\n";
  169. echo ' </tr>'."\n";
  170. echo ' </table>'."\n";
  171. echo ' </td>'."\n";
  172. echo ' <td width="5%">'."\n";
  173. echo ' <img src="'.podPress_url().'images/directoryPreview_PCA_right.png" border="0" alt="PCA Right" /> '."\n";
  174. echo ' </td>'."\n";
  175. echo ' </tr>'."\n";
  176. echo ' </table>'."\n";
  177. echo ' </div>'."\n";
  178. echo ' <div id="PodcastReadyPreviewDisplay" style="display: none;">'."\n";
  179. echo ' <div style="width: 100%; text-align: center;"><a href="http://www.podcastready.com/" target="_new">Visit this directory</a> / <a href="http://www.podcastready.com/channel.php?action=subscribe&feed" target="_new" id="PodcastReadyFeedURLPreview">Submit to this directory</a></div>'."\n";
  180. echo ' <table width="100%" border="0" cellspacing="0" cellpadding="0" style="background-color:#CDE4A9">'."\n";
  181. echo ' <tr valign="top">'."\n";
  182. echo ' <td width="200" align="center">'."\n";
  183. echo ' <br/><img id="PodcastReadyPreviewImage" width="175" height="175" alt="Podcast Image" src=""/><br/>'."\n";
  184. echo ' <img src="'.podPress_url().'images/directoryPreview_PodcastReady_buttons.png" border="0" alt="PodcastReadyButtons" /><br/>'."\n";
  185. echo ' </td>'."\n";
  186. echo ' <td>'."\n";
  187. echo ' <br/><b><font size="+1" color="#466B90">Detail for <span id="PodcastReadyBlognamePreview"></span></font></b><br/><br/>'."\n";
  188. echo ' <span id="PodcastReadyDescriptionPreview" style="font-size: small;"></span><br/>'."\n";
  189. echo ' <b>Filed Under:</b> <span id="PodcastReadyCategoryPreview" style="color: #466B90;"></span><br/>'."\n";
  190. echo ' <b>Media Type:</b> MP3<br/><br/>'."\n";
  191. echo ' <img src="'.podPress_url().'images/directoryPreview_PodcastReady_listeners.png" border="0" alt="PodcastReadyOtherPeople" /> '."\n";
  192. echo ' </td>'."\n";
  193. echo ' </tr>'."\n";
  194. echo ' </table>'."\n";
  195. echo ' </div>'."\n";
  196. echo ' <div id="BlubrryPreviewDisplay" style="display: none; border: 0;">'."\n";
  197. echo ' <div style="width: 100%; text-align: center; "><a href="http://www.blubrry.com" target="_new">Visit this community</a> / <a href="http://www.blubrry.com/accountsettings.php?page=addpodcast" target="_new">Join this community</a></div>'."\n";
  198. echo ' <table width="100%" style="background-color: #F2CCFF; color: #003366; font-size:14px; font-weight:bold;" border="0" cellpadding="2" cellspacing="0">'."\n";
  199. echo ' <tr>'."\n";
  200. echo ' <td style="font-size:16px; font-weight:bold;" id="BlubrryBlognamePreview">TITLE OF PODCAST HERE</td>'."\n";
  201. echo ' <td style="text-decoration:underline; text-align:right; font-weight:bold;">Visit Podcast Home Page</td>'."\n";
  202. echo ' </tr>'."\n";
  203. echo ' </table>'."\n";
  204. echo ' <table width="100%" style="background-color: #D2E9FF; color: #003366; font-size:12px;" border="0" cellpadding="2" cellspacing="0">'."\n";
  205. echo ' <tr>'."\n";
  206. echo ' <td valign="top" style="width:230px;">'."\n";
  207. echo ' <table width="220" border="0" cellspacing="0" cellpadding="0" style="padding-left: 6px; padding-top: 6px;">'."\n";
  208. echo ' <tr>'."\n";
  209. echo ' <td width="100" height="100" align="left" valign="top"><img id="BlubrryPreviewImage" width="90" height="90" alt="Podcast Image" src=""/></td>'."\n";
  210. echo ' <td width="120" valign="top"><div id="BlubrryAuthorPreview" style="font-weight: bold;">AUTHOR NAME</div>'."\n";
  211. echo ' <img src="'.podPress_url().'images/directoryPreview_Blubrry_buttons.png" width="64" height="52" /></td>'."\n";
  212. echo ' </tr>'."\n";
  213. echo ' <tr>'."\n";
  214. echo ' <td height="28" colspan="2" valign="top" style="font-size: 14px; font-weight: bold; text-decoration:underline;">Visit Podcast Home Page</td>'."\n";
  215. echo ' </tr>'."\n";
  216. echo ' <tr>'."\n";
  217. echo ' <td height="36" colspan="2" valign="top" style="font-size: 16px; font-weight: bold; color: black;">Current Episodes</td>'."\n";
  218. echo ' </tr>'."\n";
  219. echo ' <tr>'."\n";
  220. echo ' <td colspan="2"><div style="color:#9933D5; font-weight: bold; font-size: 14px;">Latest Podcast Post Title</div>'."\n";
  221. echo ' <div style="font-size: 12px;">The content of your post appears here. Wow your stuff looks good. Hey what if someone wants to listen, they can click on the button below.</div>'."\n";
  222. echo ' <img src="'.podPress_url().'images/directoryPreview_Blubrry_buttons_episode.png" />'."\n";
  223. echo ' </td>'."\n";
  224. echo ' </tr>'."\n";
  225. echo ' </table>'."\n";
  226. echo ' </td>'."\n";
  227. echo ' <td valign="top" style="padding-left: 10px; padding-top: 10px;">'."\n";
  228. echo ' <div style="font-size: 18px; font-weight: bold; padding-bottom: 10px;">Description</div>'."\n";
  229. echo ' <div style="font-size: 12px; padding-bottom: 5px;" id="BlubrryDescriptionPreview">DESCRIPTION OF PODCAST</div>'."\n";
  230. echo ' <div style="text-align:right; padding-bottom: 10px;"><img src="'.podPress_url().'images/directoryPreview_Blubrry_syndication.png" /></div>'."\n";
  231. echo ' <div style="font-size: 18px; font-weight: bold; padding-bottom: 10px;">Tags</div>'."\n";
  232. echo ' <div style="padding-bottom: 10px;">mightyseek podpress awesome wordpress plugin</div>'."\n";
  233. echo ' <div style="font-size: 18px; font-weight: bold; padding-bottom: 10px;">Friends</div>'."\n";
  234. echo ' <div style="background-image:url('.podPress_url().'images/directoryPreview_Blubrry_friends.jpg); background-repeat:no-repeat; background-position: top left; height:113px;">&nbsp;</div>'."\n";
  235. echo ' </td>'."\n";
  236. echo ' </tr>'."\n";
  237. echo ' </table>'."\n";
  238. echo ' </div>'."\n";
  239. echo ' </div><!-- End: podpress_DirectoryPreviewDisplay -->'."\n";
  240. echo '</fieldset>'."\n";
  241. }
  242. /* Utility Functions */
  243. function podPress_getCapList($roles = true, $kill_levels = true){
  244. global $wp_roles;
  245. // Get Role List
  246. foreach($wp_roles->role_objects as $key => $role) {
  247. foreach($role->capabilities as $cap => $grant) {
  248. $capnames[$cap] = $cap;
  249. }
  250. }
  251. if ($caplist = get_option('caplist')) {
  252. $capnames = array_unique(array_merge($caplist, $capnames));
  253. }
  254. $capnames = apply_filters('capabilities_list', $capnames);
  255. if(!is_array($capnames)) $capnames = array();
  256. $capnames = array_unique($capnames);
  257. sort($capnames);
  258. //Filter out the level_x caps, they're obsolete
  259. if($kill_levels) {
  260. $capnames = array_diff($capnames, array('level_0', 'level_1', 'level_2', 'level_3', 'level_4', 'level_5', 'level_6', 'level_7', 'level_8', 'level_9', 'level_10'));
  261. }
  262. //Filter out roles if required
  263. if (!$roles) {
  264. foreach ($wp_roles->get_names() as $role) {
  265. $key = array_search($role, $capnames);
  266. if ($key !== false && $key !== null) { //array_search() returns null if not found in 4.1
  267. unset($capnames[$key]);
  268. }
  269. }
  270. }
  271. return $capnames;
  272. }
  273. function podPress_maybe_create_table($table_name, $create_ddl) {
  274. GLOBAL $wpdb;
  275. foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) {
  276. if ($table == $table_name) {
  277. return true;
  278. }
  279. }
  280. //didn't find it try to create it.
  281. $q = $wpdb->query($create_ddl);
  282. // we cannot directly tell that whether this succeeded!
  283. foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) {
  284. if ($table == $table_name) {
  285. return true;
  286. }
  287. }
  288. return false;
  289. }
  290. function podPress_maybe_add_column($table_name, $column_name, $create_ddl) {
  291. GLOBAL $wpdb, $debug;
  292. foreach ( $wpdb->get_col("DESC $table_name", 0) as $column ) {
  293. if ( $debug ) { printf(__('checking %1$s == %2$s<br />', 'podpress'), $column, $column_name); }
  294. if ( $column == $column_name ) {
  295. return TRUE;
  296. }
  297. }
  298. // didn't find it try to create it.
  299. $q = $wpdb->query($create_ddl);
  300. // we cannot directly tell that whether this succeeded!
  301. foreach ( $wpdb->get_col("DESC $table_name", 0) as $column ) {
  302. if ( $column == $column_name ) {
  303. return TRUE;
  304. }
  305. }
  306. return FALSE;
  307. }
  308. function podPress_filetypes() {
  309. $options['audio_mp3'] = __('MP3 - Standard Audio (iPod Compliant)', 'podpress');
  310. $options['audio_m4a'] = __('M4A - Enhanced Audio (iPod Compliant)', 'podpress');
  311. $options['video_m4v'] = __('M4V - Video (iPod Compliant)', 'podpress');
  312. $options['audio_mp4'] = __('MP4 - Enhanced Audio (iPod Compliant)', 'podpress');
  313. $options['video_mp4'] = __('MP4 - Video (iPod Compliant)', 'podpress');
  314. $options['audio_ogg'] = __('OGG - Ogg Vorbis Audio', 'podpress');
  315. $options['video_ogv'] = __('OGV - Ogg Theora video', 'podpress');
  316. $options['audio_aa'] = __('AA - Audible Encoded (iPod Compliant)', 'podpress');
  317. $options['audio_m3u'] = __('M3U - Streaming Audio', 'podpress');
  318. $options['video_mov'] = __('MOV - Video (iPod Compliant)', 'podpress');
  319. $options['video_qt'] = __('QT - Video (iPod Compliant)', 'podpress');
  320. $options['video_avi'] = __('AVI - Video', 'podpress');
  321. $options['video_mpg'] = __('MPG - Video', 'podpress');
  322. $options['video_asf'] = __('ASF - Video', 'podpress');
  323. $options['video_wmv'] = __('WMV - Video', 'podpress');
  324. $options['audio_wma'] = __('WMA - Audio', 'podpress');
  325. $options['video_flv'] = __('FLV - Flash Video', 'podpress');
  326. $options['video_swf'] = __('SWF - Flash content', 'podpress');
  327. $options['ebook_pdf'] = __('PDF - eBook', 'podpress');
  328. $options['ebook_epub'] = __('EPUB - eBook', 'podpress');
  329. $options['misc_torrent'] = __('Torrent - P2P', 'podpress');
  330. return $options;
  331. }
  332. function podPress_mediaOptions() {
  333. $options = array();
  334. reset($options);
  335. $options = podPress_filetypes();
  336. $options['embed_youtube'] = __('YouTube - Video', 'podpress');
  337. $options['misc_other'] = __('??? - Other', 'podpress');
  338. foreach ($options as $key => $value) {
  339. echo '<option value="'.$key.'">'.$value.'</option>'."\n";
  340. }
  341. }
  342. function podPress_videoDimensionOptions($selected='320:240') {
  343. $dimensions = array();
  344. reset($dimensions);
  345. $dimensions_noimage = array();
  346. reset($dimensions_noimage);
  347. $dimensions['160:120'] = '160 x 120';
  348. $dimensions['320:240'] = '320 x 240';
  349. $dimensions['480:320'] = '480 x 320';
  350. $dimensions['640:480'] = '640 x 480';
  351. $dimensions['720:540'] = '720 x 540';
  352. $dimensions['450:252'] = '450 x 252 [16:9 - 1.78:1]';
  353. $dimensions['480:260'] = '480 x 260 [16:9 - 1.85:1]';
  354. $dimensions['720:405'] = '720 x 405 [16:9 - 1.78:1]';
  355. $dimensions['720:390'] = '720 x 390 [16:9 - 1.85:1]';
  356. echo '<optgroup label="'.__('Common Dimensions', 'podpress').'">'."\n";
  357. foreach ($dimensions as $key => $value) {
  358. if ($key == $selected) {
  359. $selected_str =' selected="selected"';
  360. } else {
  361. $selected_str ='';
  362. }
  363. echo '<option value="'.$key.'"'.$selected_str.'>'.$value.'</option>'."\n";
  364. }
  365. echo '</optgroup>'."\n";
  366. $dimensions_noimage['160:0'] = __('width: 160 px', 'podpress');
  367. $dimensions_noimage['320:0'] = __('width: 320 px', 'podpress');
  368. $dimensions_noimage['480:0'] = __('width: 480 px', 'podpress');
  369. $dimensions_noimage['640:0'] = __('width: 640 px', 'podpress');
  370. $dimensions_noimage['720:0'] = __('width: 720 px', 'podpress');
  371. echo '<optgroup label="'.__('player without preview image', 'podpress').'">'."\n";
  372. foreach ($dimensions_noimage as $key => $value) {
  373. if ($key == $selected) {
  374. $selected_str =' selected="selected"';
  375. } else {
  376. $selected_str ='';
  377. }
  378. echo '<option value="'.$key.'"'.$selected_str.'>'.$value.'</option>'."\n";
  379. }
  380. echo '</optgroup>'."\n";
  381. }
  382. function podPress_itunesLanguageArray() {
  383. // two-letter codes from the ISO 639-2 (http://www.loc.gov/standards/iso639-2/) languages list combined with the RSS language codes (http://www.rssboard.org/rss-language-codes#table)
  384. $langs = array();
  385. $langs['ab'] = 'Abkhazian';
  386. $langs['aa'] = 'Afar';
  387. $langs['af'] = 'Afrikaans';
  388. $langs['ak'] = 'Akan';
  389. $langs['sq'] = 'Albanian';
  390. $langs['am'] = 'Amharic';
  391. $langs['ar'] = 'Arabic';
  392. $langs['an'] = 'Aragonese';
  393. $langs['hy'] = 'Armenian';
  394. $langs['as'] = 'Assamese';
  395. $langs['av'] = 'Avaric';
  396. $langs['ae'] = 'Avestan';
  397. $langs['ay'] = 'Aymara';
  398. $langs['az'] = 'Azerbaijani';
  399. $langs['bm'] = 'Bambara';
  400. $langs['ba'] = 'Bashkir';
  401. $langs['eu'] = 'Basque';
  402. $langs['be'] = 'Belarusian';
  403. $langs['bn'] = 'Bengali';
  404. $langs['bh'] = 'Bihari languages';
  405. $langs['bi'] = 'Bislama';
  406. $langs['nb'] = htmlentities('Bokmĺl, Norwegian; Norwegian Bokmĺl');
  407. $langs['bs'] = 'Bosnian';
  408. $langs['br'] = 'Breton';
  409. $langs['bg'] = 'Bulgarian';
  410. $langs['my'] = 'Burmese';
  411. $langs['ca'] = 'Catalan; Valencian';
  412. $langs['km'] = 'Central Khmer';
  413. $langs['ch'] = 'Chamorro';
  414. $langs['ce'] = 'Chechen';
  415. $langs['ny'] = 'Chichewa; Chewa; Nyanja';
  416. $langs['zh'] = 'Chinese';
  417. $langs['zh-cn'] = 'Chinese (Simplified)';
  418. $langs['zh-tw'] = 'Chinese (Traditional)';
  419. $langs['cu'] = 'Church Slavic; Old Bulgarian;';
  420. $langs['cv'] = 'Chuvash';
  421. $langs['kw'] = 'Cornish';
  422. $langs['co'] = 'Corsican';
  423. $langs['cr'] = 'Cree';
  424. $langs['hr'] = 'Croatian';
  425. $langs['cs'] = 'Czech';
  426. $langs['da'] = 'Danish';
  427. $langs['dv'] = 'Divehi; Dhivehi; Maldivian';
  428. $langs['nl'] = 'Dutch; Flemish';
  429. $langs['nl-be'] = 'Dutch (Belgium)';
  430. $langs['nl-nl'] = 'Dutch (Netherlands)';
  431. $langs['dz'] = 'Dzongkha';
  432. $langs['en'] = 'English';
  433. $langs['en-au'] = 'English (Australia)';
  434. $langs['en-bz'] = 'English (Belize)';
  435. $langs['en-ca'] = 'English (Canada)';
  436. $langs['en-ie'] = 'English (Ireland)';
  437. $langs['en-jm'] = 'English (Jamaica)';
  438. $langs['en-nz'] = 'English (New Zealand)';
  439. $langs['en-ph'] = 'English (Phillipines)';
  440. $langs['en-za'] = 'English (South Africa)';
  441. $langs['en-tt'] = 'English (Trinidad)';
  442. $langs['en-gb'] = 'English (United Kingdom)';
  443. $langs['en-us'] = 'English (United States)';
  444. $langs['en-zw'] = 'English (Zimbabwe)';
  445. $langs['eo'] = 'Esperanto';
  446. $langs['et'] = 'Estonian';
  447. $langs['ee'] = 'Ewe';
  448. $langs['fo'] = 'Faroese';
  449. $langs['fj'] = 'Fijian';
  450. $langs['fi'] = 'Finnish';
  451. $langs['fr'] = 'French';
  452. $langs['fr-be'] = 'French (Belgium)';
  453. $langs['fr-ca'] = 'French (Canada)';
  454. $langs['fr-fr'] = 'French (France)';
  455. $langs['fr-lu'] = 'French (Luxembourg)';
  456. $langs['fr-mc'] = 'French (Monaco)';
  457. $langs['fr-ch'] = 'French (Switzerland)';
  458. $langs['ff'] = 'Fulah';
  459. $langs['gd'] = 'Gaelic; Scottish Gaelic';
  460. $langs['gl'] = 'Galician';
  461. $langs['lg'] = 'Ganda';
  462. $langs['ka'] = 'Georgian';
  463. $langs['de'] = 'German';
  464. $langs['de-at'] = 'German (Austria)';
  465. $langs['de-de'] = 'German (Germany)';
  466. $langs['de-li'] = 'German (Liechtenstein)';
  467. $langs['de-lu'] = 'German (Luxembourg)';
  468. $langs['de-ch'] = 'German (Switzerland)';
  469. $langs['el'] = 'Greek, Modern';
  470. $langs['gn'] = 'Guarani';
  471. $langs['gu'] = 'Gujarati';
  472. $langs['ht'] = 'Haitian; Haitian Creole';
  473. $langs['ha'] = 'Hausa';
  474. $langs['he'] = 'Hebrew';
  475. $langs['hz'] = 'Herero';
  476. $langs['hi'] = 'Hindi';
  477. $langs['ho'] = 'Hiri Motu';
  478. $langs['hu'] = 'Hungarian';
  479. $langs['is'] = 'Icelandic';
  480. $langs['io'] = 'Ido';
  481. $langs['ig'] = 'Igbo';
  482. $langs['id'] = 'Indonesian';
  483. $langs['ia'] = 'Interlingua';
  484. $langs['ie'] = 'Interlingue; Occidental';
  485. $langs['iu'] = 'Inuktitut';
  486. $langs['ik'] = 'Inupiaq';
  487. $langs['ga'] = 'Irish';
  488. $langs['it'] = 'Italian';
  489. $langs['it-it'] = 'Italian (Italy)';
  490. $langs['it-ch'] = 'Italian (Switzerland)';
  491. $langs['ja'] = 'Japanese';
  492. $langs['jv'] = 'Javanese';
  493. $langs['kl'] = 'Kalaallisut; Greenlandic';
  494. $langs['kn'] = 'Kannada';
  495. $langs['kr'] = 'Kanuri';
  496. $langs['ks'] = 'Kashmiri';
  497. $langs['kk'] = 'Kazakh';
  498. $langs['ki'] = 'Kikuyu; Gikuyu';
  499. $langs['rw'] = 'Kinyarwanda';
  500. $langs['ky'] = 'Kirghiz; Kyrgyz';
  501. $langs['kv'] = 'Komi';
  502. $langs['kg'] = 'Kongo';
  503. $langs['ko'] = 'Korean';
  504. $langs['kj'] = 'Kuanyama; Kwanyama';
  505. $langs['ku'] = 'Kurdish';
  506. $langs['lo'] = 'Lao';
  507. $langs['la'] = 'Latin';
  508. $langs['lv'] = 'Latvian';
  509. $langs['li'] = 'Limburgan; Limburger; Limburgish';
  510. $langs['ln'] = 'Lingala';
  511. $langs['lt'] = 'Lithuanian';
  512. $langs['lu'] = 'Luba-Katanga';
  513. $langs['lb'] = 'Luxembourgish; Letzeburgesch';
  514. $langs['mk'] = 'Macedonian';
  515. $langs['mg'] = 'Malagasy';
  516. $langs['ms'] = 'Malay';
  517. $langs['ml'] = 'Malayalam';
  518. $langs['mt'] = 'Maltese';
  519. $langs['gv'] = 'Manx';
  520. $langs['mi'] = 'Maori';
  521. $langs['mr'] = 'Marathi';
  522. $langs['mh'] = 'Marshallese';
  523. $langs['mn'] = 'Mongolian';
  524. $langs['na'] = 'Nauru';
  525. $langs['nv'] = 'Navajo; Navaho';
  526. $langs['nd'] = 'Ndebele, North; North Ndebele';
  527. $langs['nr'] = 'Ndebele, South; South Ndebele';
  528. $langs['ng'] = 'Ndonga';
  529. $langs['ne'] = 'Nepali';
  530. $langs['se'] = 'Northern Sami';
  531. $langs['no'] = 'Norwegian';
  532. $langs['nn'] = 'Norwegian Nynorsk; Nynorsk, Norwegian';
  533. $langs['oc'] = 'Occitan (post 1500)';
  534. $langs['oj'] = 'Ojibwa';
  535. $langs['or'] = 'Oriya';
  536. $langs['om'] = 'Oromo';
  537. $langs['os'] = 'Ossetian; Ossetic';
  538. $langs['pi'] = 'Pali';
  539. $langs['pa'] = 'Panjabi; Punjabi';
  540. $langs['fa'] = 'Persian';
  541. $langs['pl'] = 'Polish';
  542. $langs['pt'] = 'Portuguese';
  543. $langs['pt-br'] = 'Portuguese (Brazil)';
  544. $langs['pt-pt'] = 'Portuguese (Portugal)';
  545. $langs['ps'] = 'Pushto; Pashto';
  546. $langs['qu'] = 'Quechua';
  547. $langs['ro'] = 'Romanian; Moldavian; Moldovan';
  548. $langs['rm'] = 'Romansh';
  549. $langs['ro-mo'] = 'Romanian (Moldova)';
  550. $langs['ro-ro'] = 'Romanian (Romania)';
  551. $langs['rn'] = 'Rundi';
  552. $langs['ru'] = 'Russian';
  553. $langs['ru-mo'] = 'Russian (Moldova)';
  554. $langs['ru-ru'] = 'Russian (Russia)';
  555. $langs['sm'] = 'Samoan';
  556. $langs['sg'] = 'Sango';
  557. $langs['sa'] = 'Sanskrit';
  558. $langs['sc'] = 'Sardinian';
  559. $langs['sr'] = 'Serbian';
  560. $langs['sn'] = 'Shona';
  561. $langs['ii'] = 'Sichuan Yi; Nuosu';
  562. $langs['sd'] = 'Sindhi';
  563. $langs['si'] = 'Sinhala; Sinhalese';
  564. $langs['sk'] = 'Slovak';
  565. $langs['sl'] = 'Slovenian';
  566. $langs['so'] = 'Somali';
  567. $langs['st'] = 'Sotho, Southern';
  568. $langs['es'] = 'Spanish; Castilian';
  569. $langs['es-ar'] = 'Spanish (Argentina)';
  570. $langs['es-bo'] = 'Spanish (Bolivia)';
  571. $langs['es-cl'] = 'Spanish (Chile)';
  572. $langs['es-co'] = 'Spanish (Colombia)';
  573. $langs['es-cr'] = 'Spanish (Costa Rica)';
  574. $langs['es-do'] = 'Spanish (Dominican Republic)';
  575. $langs['es-ec'] = 'Spanish (Ecuador)';
  576. $langs['es-sv'] = 'Spanish (El Salvador)';
  577. $langs['es-gt'] = 'Spanish (Guatemala)';
  578. $langs['es-hn'] = 'Spanish (Honduras)';
  579. $langs['es-mx'] = 'Spanish (Mexico)';
  580. $langs['es-ni'] = 'Spanish (Nicaragua)';
  581. $langs['es-pa'] = 'Spanish (Panama)';
  582. $langs['es-py'] = 'Spanish (Paraguay)';
  583. $langs['es-pe'] = 'Spanish (Peru)';
  584. $langs['es-pr'] = 'Spanish (Puerto Rico)';
  585. $langs['es-es'] = 'Spanish (Spain)';
  586. $langs['es-uy'] = 'Spanish (Uruguay)';
  587. $langs['es-ve'] = 'Spanish (Venezuela)';
  588. $langs['su'] = 'Sundanese';
  589. $langs['sw'] = 'Swahili';
  590. $langs['ss'] = 'Swati';
  591. $langs['sv'] = 'Swedish';
  592. $langs['sv-fi'] = 'Swedish (Finland)';
  593. $langs['sv-se'] = 'Swedish (Sweden)';
  594. $langs['tl'] = 'Tagalog';
  595. $langs['ty'] = 'Tahitian';
  596. $langs['tg'] = 'Tajik';
  597. $langs['ta'] = 'Tamil';
  598. $langs['tt'] = 'Tatar';
  599. $langs['te'] = 'Telugu';
  600. $langs['th'] = 'Thai';
  601. $langs['bo'] = 'Tibetan';
  602. $langs['ti'] = 'Tigrinya';
  603. $langs['to'] = 'Tonga (Tonga Islands)';
  604. $langs['ts'] = 'Tsonga';
  605. $langs['tn'] = 'Tswana';
  606. $langs['tr'] = 'Turkish';
  607. $langs['tk'] = 'Turkmen';
  608. $langs['tw'] = 'Twi';
  609. $langs['ug'] = 'Uighur; Uyghur';
  610. $langs['uk'] = 'Ukrainian';
  611. $langs['ur'] = 'Urdu';
  612. $langs['uz'] = 'Uzbek';
  613. $langs['ve'] = 'Venda';
  614. $langs['vi'] = 'Vietnamese';
  615. $langs['vo'] = htmlentities('Volapük');
  616. $langs['wa'] = 'Walloon';
  617. $langs['cy'] = 'Welsh';
  618. $langs['fy'] = 'Western Frisian';
  619. $langs['wo'] = 'Wolof';
  620. $langs['xh'] = 'Xhosa';
  621. $langs['yi'] = 'Yiddish';
  622. $langs['yo'] = 'Yoruba';
  623. $langs['za'] = 'Zhuang; Chuang';
  624. $langs['zu'] = 'Zulu';
  625. return $langs;
  626. }
  627. function podPress_itunesLanguageOptions($current = 'en-us') {
  628. $langs = podPress_itunesLanguageArray();
  629. reset($langs);
  630. foreach ($langs as $key => $value) {
  631. echo '<option value="'.$key.'"';
  632. if($key == $current) {
  633. echo ' selected="selected"';
  634. }
  635. echo '>'.$value.' ['.$key.']</option>'."\n";
  636. }
  637. }
  638. function podPress_itunesCategoryOptions($current = '') {
  639. $cats = array();
  640. if ('' == trim($current) AND '##Global##' != $current) {
  641. $current = '[ nothing ]';
  642. }
  643. $cats[] = '[ '.__('nothing', 'podpress').' ]';
  644. $cats[] = 'Arts';
  645. $cats[] = 'Arts:Design';
  646. $cats[] = 'Arts:Fashion & Beauty';
  647. $cats[] = 'Arts:Food';
  648. $cats[] = 'Arts:Literature';
  649. $cats[] = 'Arts:Performing Arts';
  650. $cats[] = 'Arts:Visual Arts';
  651. $cats[] = 'Business';
  652. $cats[] = 'Business:Business News';
  653. $cats[] = 'Business:Careers';
  654. $cats[] = 'Business:Investing';
  655. $cats[] = 'Business:Management & Marketing';
  656. $cats[] = 'Business:Shopping';
  657. $cats[] = 'Comedy';
  658. $cats[] = 'Education';
  659. $cats[] = 'Education:Education Technology';
  660. $cats[] = 'Education:Higher Education';
  661. $cats[] = 'Education:K-12';
  662. $cats[] = 'Education:Language Courses';
  663. $cats[] = 'Education:Training';
  664. $cats[] = 'Games & Hobbies';
  665. $cats[] = 'Games & Hobbies:Automotive';
  666. $cats[] = 'Games & Hobbies:Aviation';
  667. $cats[] = 'Games & Hobbies:Hobbies';
  668. $cats[] = 'Games & Hobbies:Other Games';
  669. $cats[] = 'Games & Hobbies:Video Games';
  670. $cats[] = 'Government & Organizations';
  671. $cats[] = 'Government & Organizations:Local';
  672. $cats[] = 'Government & Organizations:National';
  673. $cats[] = 'Government & Organizations:Non-Profit';
  674. $cats[] = 'Government & Organizations:Regional';
  675. $cats[] = 'Health';
  676. $cats[] = 'Health:Alternative Health';
  677. $cats[] = 'Health:Fitness & Nutrition';
  678. $cats[] = 'Health:Self-Help';
  679. $cats[] = 'Health:Sexuality';
  680. $cats[] = 'Kids & Family';
  681. $cats[] = 'Music';
  682. $cats[] = 'News & Politics';
  683. $cats[] = 'Religion & Spirituality';
  684. $cats[] = 'Religion & Spirituality:Buddhism';
  685. $cats[] = 'Religion & Spirituality:Christianity';
  686. $cats[] = 'Religion & Spirituality:Hinduism';
  687. $cats[] = 'Religion & Spirituality:Islam';
  688. $cats[] = 'Religion & Spirituality:Judaism';
  689. $cats[] = 'Religion & Spirituality:Other';
  690. $cats[] = 'Religion & Spirituality:Spirituality';
  691. $cats[] = 'Science & Medicine';
  692. $cats[] = 'Science & Medicine:Medicine';
  693. $cats[] = 'Science & Medicine:Natural Sciences';
  694. $cats[] = 'Science & Medicine:Social Sciences';
  695. $cats[] = 'Society & Culture';
  696. $cats[] = 'Society & Culture:History';
  697. $cats[] = 'Society & Culture:Personal Journals';
  698. $cats[] = 'Society & Culture:Philosophy';
  699. $cats[] = 'Society & Culture:Places & Travel';
  700. $cats[] = 'Sports & Recreation';
  701. $cats[] = 'Sports & Recreation:Amateur';
  702. $cats[] = 'Sports & Recreation:College & High School';
  703. $cats[] = 'Sports & Recreation:Outdoor';
  704. $cats[] = 'Sports & Recreation:Professional';
  705. $cats[] = 'Technology';
  706. $cats[] = 'Technology:Gadgets';
  707. $cats[] = 'Technology:Tech News';
  708. $cats[] = 'Technology:Podcasting';
  709. $cats[] = 'Technology:Software How-To';
  710. $cats[] = 'TV & Film';
  711. reset($cats);
  712. $foundit = false;
  713. foreach ($cats as $value) {
  714. $value = str_replace('&', '&amp;', $value);
  715. echo '<option';
  716. if ( $value == $current OR ('[ nothing ]' === $current AND '[ '.__('nothing', 'podpress').' ]' === $value) ) {
  717. $foundit = true;
  718. echo ' selected="selected"';
  719. }
  720. if ( '[ '.__('nothing', 'podpress').' ]' === $value ) {
  721. echo ' value="[ nothing ]"';
  722. } else {
  723. echo ' value="'.attribute_escape($value).'"';
  724. }
  725. echo '>'.$value.'</option>'."\n";
  726. }
  727. if(!$foundit AND '##Global##' != $current) {
  728. $current = podPress_upgradeCategory($current);
  729. echo '<option selected="selected">'.$current.'</option>'."\n";
  730. }
  731. }
  732. function podPress_upgradeCategory($current) {
  733. $cats['Arts & Entertainment'] = 'Arts';
  734. $cats['Arts & Entertainment:Architecture'] = 'Arts:Design';
  735. $cats['Arts & Entertainment:Books'] = 'Arts:Literature';
  736. $cats['Arts & Entertainment:Design'] = 'Arts:Design';
  737. $cats['Arts & Entertainment:Entertainment'] = 'TV & Film';
  738. $cats['Arts & Entertainment:Games'] = 'Games & Hobbies:Video Games';
  739. $cats['Arts & Entertainment:Performing Arts'] = 'Arts:Performing Arts';
  740. $cats['Arts & Entertainment:Photography'] = 'Arts:Visual Arts';
  741. $cats['Arts & Entertainment:Poetry'] = 'Arts:Literature';
  742. $cats['Arts & Entertainment:Science Fiction'] = 'Arts:Literature';
  743. $cats['Audio Blogs'] = 'Society & Culture:Personal Journals';
  744. $cats['Business'] = 'Business';
  745. $cats['Business:Careers'] = 'Business:Careers';
  746. $cats['Business:Finance'] = 'Business:Business News';
  747. $cats['Business:Investing'] = 'Business:Investing';
  748. $cats['Business:Management'] = 'Business:Management & Marketing';
  749. $cats['Business:Marketing'] = 'Business:Management & Marketing';
  750. $cats['Comedy'] = 'Comedy';
  751. $cats['Education'] = 'Education';
  752. $cats['Education:Higher Education'] = 'Education:Higher Education';
  753. $cats['Education:K-12'] = 'Education:K-12';
  754. $cats['Family'] = 'Kids & Family';
  755. $cats['Food'] = 'Arts:Food';
  756. $cats['Health'] = 'Health';
  757. $cats['Health:Diet & Nutrition'] = 'Health:Fitness & Nutrition';
  758. $cats['Health:Fitness'] = 'Health:Fitness & Nutrition';
  759. $cats['Health:Relationships'] = 'Health:Sexuality';
  760. $cats['Health:Self-Help'] = 'Health:Self-Help';
  761. $cats['Health:Sexuality'] = 'Health:Sexuality';
  762. $cats['International'] = 'Government & Organizations:National';
  763. $cats['International:Australian'] = 'Government & Organizations:National';
  764. $cats['International:Belgian'] = 'Government & Organizations:National';
  765. $cats['International:Brazilian'] = 'Government & Organizations:National';
  766. $cats['International:Canadian'] = 'Government & Organizations:National';
  767. $cats['International:Chinese'] = 'Government & Organizations:National';
  768. $cats['International:Dutch'] = 'Government & Organizations:National';
  769. $cats['International:French'] = 'Government & Organizations:National';
  770. $cats['International:German'] = 'Government & Organizations:National';
  771. $cats['International:Hebrew'] = 'Government & Organizations:National';
  772. $cats['International:Italian'] = 'Government & Organizations:National';
  773. $cats['International:Japanese'] = 'Government & Organizations:National';
  774. $cats['International:Norwegian'] = 'Government & Organizations:National';
  775. $cats['International:Polish'] = 'Government & Organizations:National';
  776. $cats['International:Portuguese'] = 'Government & Organizations:National';
  777. $cats['International:Spanish'] = 'Government & Organizations:National';
  778. $cats['International:Swedish'] = 'Government & Organizations:National';
  779. $cats['Movies & Television'] = 'TV & Film';
  780. $cats['Music'] = 'Music';
  781. $cats['News'] = 'News & Politics';
  782. $cats['Politics'] = 'News & Politics';
  783. $cats['Public Radio'] = 'News & Politics';
  784. $cats['Religion & Spirituality'] = 'Religion & Spirituality';
  785. $cats['Religion & Spirituality:Buddhism'] = 'Religion & Spirituality:Buddhism';
  786. $cats['Religion & Spirituality:Christianity'] = 'Religion & Spirituality:Christianity';
  787. $cats['Religion & Spirituality:Islam'] = 'Religion & Spirituality:Islam';
  788. $cats['Religion & Spirituality:Judaism'] = 'Religion & Spirituality:Judaism';
  789. $cats['Religion & Spirituality:New Age'] = 'Religion & Spirituality:Spirituality';
  790. $cats['Religion & Spirituality:Philosophy'] = 'Religion & Spirituality:Philosophy';
  791. $cats['Religion & Spirituality:Spirituality'] = 'Religion & Spirituality:Spirituality';
  792. $cats['Science'] = 'Science & Medicine';
  793. $cats['Sports'] = 'Sports & Recreation';
  794. $cats['Talk Radio'] = 'News & Politics';
  795. $cats['Technology'] = 'Technology';
  796. $cats['Technology:IT News'] = 'Technology:Tech News';
  797. $cats['Technology:Computers'] = 'Technology:Tech News';
  798. $cats['Technology:Developers'] = 'Technology:Tech News';
  799. $cats['Technology:Gadgets'] = 'Technology:Gadgets';
  800. $cats['Technology:Information Technology'] = 'Technology:Tech News';
  801. $cats['Technology:News'] = 'Technology:Tech News';
  802. $cats['Technology:Operating Systems'] = 'Technology:Tech News';
  803. $cats['Technology:Podcasting'] = 'Technology:Podcasting';
  804. $cats['Technology:Smart Phones'] = 'Technology:Tech News';
  805. $cats['Technology:Text/Speech'] = 'Technology:Tech News';
  806. $cats['Transportation'] = 'Games & Hobbies:Automotive';
  807. $cats['Transportation:BBB'] = 'Games & Hobbies:Automotive';
  808. $cats['Transportation:BBB'] = 'Games & Hobbies:Automotive';
  809. $cats['Transportation:BBB'] = 'Sports & Recreation:Outdoor';
  810. $cats['Transportation:BBB'] = 'Games & Hobbies:Automotive';
  811. $cats['Travel'] = 'Society & Culture:Places & Travel';
  812. $current = str_replace('&amp;', '&', $current);
  813. if(isset($cats[$current])) {
  814. $result = $cats[$current];
  815. } else {
  816. $result = $current;
  817. }
  818. return str_replace('&', '&amp;', $result);
  819. }
  820. function podPress_itunesCategoryOptions2($current = '') {
  821. $cats = array();
  822. $cats['Arts &amp; Entertainment'] = 'Arts &amp; Entertainment';
  823. $cats['Arts &amp; Entertainment:Architecture'] = 'Arts &amp; Entertainment:Architecture';
  824. $cats['Arts &amp; Entertainment:Books'] = 'Arts &amp; Entertainment:Books';
  825. $cats['Arts &amp; Entertainment:Design'] = 'Arts &amp; Entertainment:Design';
  826. $cats['Arts &amp; Entertainment:Poetry'] = 'Arts &amp; Entertainment:Poetry';
  827. $cats['Arts &amp; Entertainment:Games'] = 'Arts &amp; Entertainment:Games';
  828. $cats['Arts &amp; Entertainment:Performing Arts'] = 'Arts &amp; Entertainment:Performing Arts';
  829. $cats['Arts &amp; Entertainment:Photography'] = 'Arts &amp; Entertainment:Photography';
  830. $cats['Arts &amp; Entertainment:Science Fiction'] = 'Arts &amp; Entertainment:Science Fiction';
  831. $cats['Audio Blogs'] = 'Audio Blogs';
  832. $cats['Business'] = 'Business';
  833. $cats['Business:Careers'] = 'Business:Careers';
  834. $cats['Business:Finance'] = 'Business:Finance';
  835. $cats['Business:Investing'] = 'Business:Investing';
  836. $cats['Business:Management'] = 'Business:Management';
  837. $cats['Business:Marketing'] = 'Business:Marketing';
  838. $cats['Comedy'] = 'Comedy';
  839. $cats['Education'] = 'Education';
  840. $cats['Education:K-12'] = 'Education:K-12';
  841. $cats['Education:Higher Education'] = 'Education:Higher Education';
  842. $cats['Family'] = 'Family';
  843. $cats['Food'] = 'Food';
  844. $cats['Health'] = 'Health';
  845. $cats['Health:Diet &amp; Nutrition'] = 'Health:Diet &amp; Nutrition';
  846. $cats['Health:Fitness'] = 'Health:Fitness';
  847. $cats['Health:Relationships'] = 'Health:Relationships';
  848. $cats['Health:Self-Help'] = 'Health:Self-Help';
  849. $cats['Health:Sexuality'] = 'Health:Sexuality';
  850. $cats['International'] = 'International';
  851. $cats['International:Australian'] = 'International:Australian';
  852. $cats['International:Belgian'] = 'International:Belgian';
  853. $cats['International:Brazilian'] = 'International:Brazilian';
  854. $cats['International:Canadian'] = 'International:Canadian';
  855. $cats['International:Chinese'] = 'International:Chinese';
  856. $cats['International:Dutch'] = 'International:Dutch';
  857. $cats['International:French'] = 'International:French';
  858. $cats['International:German'] = 'International:German';
  859. $cats['International:Hebrew'] = 'International:Hebrew';
  860. $cats['International:Italian'] = 'International:Italian';
  861. $cats['International:Japanese'] = 'International:Japanese';
  862. $cats['International:Norwegian'] = 'International:Norwegian';
  863. $cats['International:Polish'] = 'International:Polish';
  864. $cats['International:Portuguese'] = 'International:Portuguese';
  865. $cats['International:Spanish'] = 'International:Spanish';
  866. $cats['International:Swedish'] = 'International:Swedish';
  867. $cats['Movies &amp; Television'] = 'Movies &amp; Television';
  868. $cats['Music'] = 'Music';
  869. $cats['News'] = 'News';
  870. $cats['Politics'] = 'Politics';
  871. $cats['Public Radio'] = 'Public Radio';
  872. $cats['Religion &amp; Spirituality'] = 'Religion &amp; Spirituality';
  873. $cats['Religion &amp; Spirituality:Buddhism'] = 'Religion &amp; Spirituality:Buddhism';
  874. $cats['Religion &amp; Spirituality:Christianity'] = 'Religion &amp; Spirituality:Christianity';
  875. $cats['Religion &amp; Spirituality:Islam'] = 'Religion &amp; Spirituality:Islam';
  876. $cats['Religion &amp; Spirituality:Judaism'] = 'Religion &amp; Spirituality:Judaism';
  877. $cats['Religion &amp; Spirituality:New Age'] = 'Religion &amp; Spirituality:New Age';
  878. $cats['Religion &amp; Spirituality:Philosophy'] = 'Religion &amp; Spirituality:Philosophy';
  879. $cats['Religion &amp; Spirituality:Spirituality'] = 'Religion &amp; Spirituality:Spirituality';
  880. $cats['Science'] = 'Science';
  881. $cats['Sports'] = 'Sports';
  882. $cats['Talk Radio'] = 'Talk Radio';
  883. $cats['Technology'] = 'Technology';
  884. $cats['Technology:Computers'] = 'Technology:Computers';
  885. $cats['Technology:Developers'] = 'Technology:Developers';
  886. $cats['Technology:Gadgets'] = 'Technology:Gadgets';
  887. $cats['Technology:Information Technology'] = 'Technology:Information Technology';
  888. $cats['Technology:News'] = 'Technology:News';
  889. $cats['Technology:Operating Systems'] = 'Technology:Operating Systems';
  890. $cats['Technology:Podcasting'] = 'Technology:Podcasting';
  891. $cats['Technology:Smart Phones'] = 'Technology:Smart Phones';
  892. $cats['Technology:Text/Speech'] = 'Technology:Text/Speech';
  893. $cats['Travel'] = 'Travel';
  894. reset($cats);
  895. foreach ($cats as $key => $value) {
  896. echo '<option value="'.$key.'"';
  897. if($key == $current) {
  898. echo ' selected="selected"';
  899. }
  900. echo '>'.$value.'</option>'."\n";
  901. }
  902. }
  903. /**************************************************************/
  904. /* Functions for supporting the backend processor */
  905. /**************************************************************/
  906. function podPress_ResolveReDirects($uriFileName)
  907. {
  908. GLOBAL $podPress;
  909. $tries = 0;
  910. while($tries < 5) {
  911. $tries++;
  912. $aURL = parse_url($uriFileName);
  913. if($aURL['scheme'] != 'http') {
  914. return;
  915. }
  916. $sHost = $aURL['host'];
  917. $sFilepath = (isset($aURL['path']) ? $aURL['path'] : '/') . (isset($aURL['query']) ? '?' . $aURL['query'] : '');
  918. $nPort = isset($aURL['port']) ? $aURL['port'] : 80;
  919. $fpRemote = @fsockopen($sHost, $nPort, $errno, $errstr, 30);
  920. // Make sure the socket is open
  921. if(!$fpRemote) {
  922. return;
  923. }
  924. // Request headers
  925. $sHeaders = "HEAD " . $sFilepath . " HTTP/1.1\r\n";
  926. $sHeaders .= "Host: ". $sHost . "\r\n";
  927. $sHeaders .= "Connection: Close\r\n\r\n";
  928. // Sending headers
  929. fwrite($fpRemote, $sHeaders);
  930. // Getting back the content
  931. $sRemoteHeaders = '';
  932. while(!feof($fpRemote)) {
  933. $sRemoteHeaders .= fgets($fpRemote, 128);
  934. }
  935. // Closing the socket
  936. fclose($fpRemote);
  937. // parse headers
  938. $crlf = "\r\n";
  939. $headers = array();
  940. $lines = explode($crlf, $sRemoteHeaders);
  941. foreach($lines as $line) {
  942. if(($pos = strpos($line, ':')) !== false) {
  943. $headers[strtolower(trim(substr($line, 0, $pos)))] = trim(substr($line, $pos+1));
  944. }
  945. }
  946. // redirection?
  947. if(isset($headers['location'])) {
  948. $uriFileName = $headers['location'];
  949. } else {
  950. return $uriFileName;
  951. }
  952. }
  953. return $uriFileName;
  954. }
  955. /**
  956. * podPress_getID3tags - function to retrieve the ID3 data from a media file with the help of getID3() - gets called for duration, all ID3 tags and the cover art
  957. *
  958. * @package podPress
  959. * @since (unknown)
  960. *
  961. * @param string $mediafile - the URL of the media file
  962. * @param boolean $resolved - download only the header (TRUE) or more than that (FALSE)
  963. * @param boolean $limitDownload (optional) - file size in kb to limit the amount data which should be downloaded from a remote media file (used in podPress_getCoverArt())
  964. * @param boolean $deletetmpfile (optional) - if a tmp file should be deleted at the end of this function call (TRUE) or not (FALSE). In case this function gets called from the showid3tags() function this parameter is FALSE because there will be a second call for the cover art afterwads and the tmp file should be removed only after that call to avoid an unnecessary download.
  965. * @param boolean $tmp_download_exists (optional) - if there is a tmp file (e.g. after an download of a remote media file) then this is TRUE otherwise it is FALSE
  966. *
  967. * return array - an Array with the ID3 information or an Array which includes at least the key 'error'
  968. */
  969. function podPress_getID3tags($mediafile, $resolved = FALSE, $limitDownload = FALSE, $deletetmpfile = TRUE, $tmp_download_exists = FALSE) {
  970. GLOBAL $podPress;
  971. if($podPress->settings['enablePodangoIntegration']) {
  972. if(substr($mediafile, 0, strlen('Podango:')) == 'Podango:') {
  973. $fileNameParts = explode(':', $mediafile);
  974. $mediafile = 'http://download.podango.com/mediatracker/555/'.$fileNameParts[3].'/'.$fileNameParts[4];
  975. }
  976. }
  977. podPress_var_dump('podPress_getID3tags - before inclusion of the getID3 library');
  978. require_once(ABSPATH.PLUGINDIR.'/podpress/getid3/getid3.php');
  979. $getID3 = new getID3;
  980. if ($getID3 == false) {
  981. $fileinfo['error'] = __('Remote MP3 File could not be read. (error loading ID3 reader)', 'podpress');
  982. return $fileinfo;
  983. }
  984. podPress_var_dump('podPress_getID3tags - after inclusion of the getID3 library');
  985. if(!$resolved) {
  986. $systemFileName = $podPress->convertPodcastFileNameToSystemPath($mediafile);
  987. } else {
  988. $systemFileName = $mediafile;
  989. }
  990. podPress_var_dump('podPress_getID3tags - before a possible download of the media file');
  991. podPress_var_dump('podPress_getID3tags - ' . $systemFileName);
  992. if(file_exists($systemFileName)) {
  993. $uriFileName = $systemFileName;
  994. podPress_var_dump('podPress_getID3tags - local file exists: '.$uriFileName);
  995. } else {
  996. if(!$resolved) {
  997. $uriFileName = $podPress->convertPodcastFileNameToValidWebPath($mediafile);
  998. } else {
  999. $uriFileName = $mediafile;
  1000. }
  1001. $local_uploadURL = $podPress->uploadurl;
  1002. podPress_var_dump('podPress_getID3tags - local_uploadURL: '.$local_uploadURL);
  1003. podPress_var_dump('podPress_getID3tags - local_uploadpath: '.$podPress->uploadpath);
  1004. podPress_var_dump('podPress_getID3tags - tempfilesystempath: '.$podPress->tempfilesystempath);
  1005. podPress_var_dump('podPress_getID3tags - tempfileurlpath: '.$podPress->tempfileurlpath);
  1006. podPress_var_dump('podPress_getID3tags - uriFileName: '.$uriFileName);
  1007. if (FALSE !== $local_uploadURL AND FALSE !== strpos($uriFileName, $local_uploadURL)) { // then it is not a real remote file - it is only an URL to a local file
  1008. // get the absolute folder of the file from the URL
  1009. podPress_var_dump('podPress_getID3tags - it is a local file');
  1010. $uriFileName = $podPress->uploadpath.str_replace($local_uploadURL,'',$uriFileName);
  1011. //$uriFileName = str_replace('\\', '/',$uriFileName);
  1012. podPress_var_dump('podPress_getID3tags - new uriFileName: '.$uriFileName);
  1013. } else {
  1014. podPress_var_dump('podPress_getID3tags - go to podPress_downloadFile');
  1015. $uriFileName = podPress_downloadFile($uriFileName, false, $limitDownload);
  1016. $tmp_download_exists = TRUE;
  1017. }
  1018. }
  1019. podPress_var_dump('podPress_getID3tags - after a possible download of the media file');
  1020. $fileinfo = @$getID3->analyze( $uriFileName );
  1021. // if the first attempt to retrieve the ID3 data went wrong then try it again with a file name which is encoded to the system encoding
  1022. if ( isset($

Large files files are truncated, but you can click here to view the full file