PageRenderTime 60ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 1ms

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

https://bitbucket.org/sergiohzlz/reportaprod
PHP | 1371 lines | 1144 code | 140 blank | 87 comment | 119 complexity | 3c267e30013d3e15087d254efc732b40 MD5 | raw file
Possible License(s): GPL-2.0, GPL-3.0, AGPL-1.0, LGPL-2.1

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['misc_torrent'] = __('Torrent - P2P', 'podpress');
  329. return $options;
  330. }
  331. function podPress_mediaOptions() {
  332. $options = array();
  333. reset($options);
  334. $options = podPress_filetypes();
  335. $options['embed_youtube'] = __('YouTube - Video', 'podpress');
  336. $options['misc_other'] = __('??? - Other', 'podpress');
  337. foreach ($options as $key => $value) {
  338. echo '<option value="'.$key.'">'.$value.'</option>'."\n";
  339. }
  340. }
  341. function podPress_videoDimensionOptions($selected='320:240') {
  342. $dimensions = array();
  343. reset($dimensions);
  344. $dimensions_noimage = array();
  345. reset($dimensions_noimage);
  346. $dimensions['160:120'] = '160 x 120';
  347. $dimensions['320:240'] = '320 x 240';
  348. $dimensions['480:320'] = '480 x 320';
  349. $dimensions['640:480'] = '640 x 480';
  350. $dimensions['720:540'] = '720 x 540';
  351. $dimensions['450:252'] = '450 x 252 [16:9 - 1.78:1]';
  352. $dimensions['480:260'] = '480 x 260 [16:9 - 1.85:1]';
  353. $dimensions['720:405'] = '720 x 405 [16:9 - 1.78:1]';
  354. $dimensions['720:390'] = '720 x 390 [16:9 - 1.85:1]';
  355. echo '<optgroup label="'.__('Common Dimensions', 'podpress').'">'."\n";
  356. foreach ($dimensions as $key => $value) {
  357. if ($key == $selected) {
  358. $selected_str =' selected="selected"';
  359. } else {
  360. $selected_str ='';
  361. }
  362. echo '<option value="'.$key.'"'.$selected_str.'>'.$value.'</option>'."\n";
  363. }
  364. echo '</optgroup>'."\n";
  365. $dimensions_noimage['160:0'] = __('width: 160 px', 'podpress');
  366. $dimensions_noimage['320:0'] = __('width: 320 px', 'podpress');
  367. $dimensions_noimage['480:0'] = __('width: 480 px', 'podpress');
  368. $dimensions_noimage['640:0'] = __('width: 640 px', 'podpress');
  369. $dimensions_noimage['720:0'] = __('width: 720 px', 'podpress');
  370. echo '<optgroup label="'.__('player without preview image', 'podpress').'">'."\n";
  371. foreach ($dimensions_noimage as $key => $value) {
  372. if ($key == $selected) {
  373. $selected_str =' selected="selected"';
  374. } else {
  375. $selected_str ='';
  376. }
  377. echo '<option value="'.$key.'"'.$selected_str.'>'.$value.'</option>'."\n";
  378. }
  379. echo '</optgroup>'."\n";
  380. }
  381. function podPress_itunesLanguageArray() {
  382. $langs = array();
  383. $langs['af'] = 'Afrikaans';
  384. $langs['sq'] = 'Albanian';
  385. $langs['eu'] = 'Basque';
  386. $langs['be'] = 'Belarusian';
  387. $langs['bg'] = 'Bulgarian';
  388. $langs['ca'] = 'Catalan';
  389. $langs['zh-cn'] = 'Chinese (Simplified)';
  390. $langs['zh-tw'] = 'Chinese (Traditional)';
  391. $langs['hr'] = 'Croatian';
  392. $langs['cs'] = 'Czech';
  393. $langs['da'] = 'Danish';
  394. $langs['nl'] = 'Dutch';
  395. $langs['nl-be'] = 'Dutch (Belgium)';
  396. $langs['nl-nl'] = 'Dutch (Netherlands)';
  397. $langs['en'] = 'English';
  398. $langs['en-au'] = 'English (Australia)';
  399. $langs['en-bz'] = 'English (Belize)';
  400. $langs['en-ca'] = 'English (Canada)';
  401. $langs['en-ie'] = 'English (Ireland)';
  402. $langs['en-jm'] = 'English (Jamaica)';
  403. $langs['en-nz'] = 'English (New Zealand)';
  404. $langs['en-ph'] = 'English (Phillipines)';
  405. $langs['en-za'] = 'English (South Africa)';
  406. $langs['en-tt'] = 'English (Trinidad)';
  407. $langs['en-gb'] = 'English (United Kingdom)';
  408. $langs['en-us'] = 'English (United States)';
  409. $langs['en-zw'] = 'English (Zimbabwe)';
  410. $langs['et'] = 'Estonian';
  411. $langs['fo'] = 'Faeroese';
  412. $langs['fi'] = 'Finnish';
  413. $langs['fr'] = 'French';
  414. $langs['fr-be'] = 'French (Belgium)';
  415. $langs['fr-ca'] = 'French (Canada)';
  416. $langs['fr-fr'] = 'French (France)';
  417. $langs['fr-lu'] = 'French (Luxembourg)';
  418. $langs['fr-mc'] = 'French (Monaco)';
  419. $langs['fr-ch'] = 'French (Switzerland)';
  420. $langs['gl'] = 'Galician';
  421. $langs['gd'] = 'Gaelic';
  422. $langs['de'] = 'German';
  423. $langs['de-at'] = 'German (Austria)';
  424. $langs['de-de'] = 'German (Germany)';
  425. $langs['de-li'] = 'German (Liechtenstein)';
  426. $langs['de-lu'] = 'German (Luxembourg)';
  427. $langs['de-ch'] = 'German (Switzerland)';
  428. $langs['el'] = 'Greek';
  429. $langs['haw'] = 'Hawaiian';
  430. $langs['hu'] = 'Hungarian';
  431. $langs['is'] = 'Icelandic';
  432. $langs['in'] = 'Indonesian';
  433. $langs['ga'] = 'Irish';
  434. $langs['it'] = 'Italian';
  435. $langs['it-it'] = 'Italian (Italy)';
  436. $langs['it-ch'] = 'Italian (Switzerland)';
  437. $langs['ja'] = 'Japanese';
  438. $langs['ko'] = 'Korean';
  439. $langs['mk'] = 'Macedonian';
  440. $langs['no'] = 'Norwegian';
  441. $langs['pl'] = 'Polish';
  442. $langs['pt'] = 'Portuguese';
  443. $langs['pt-br'] = 'Portuguese (Brazil)';
  444. $langs['pt-pt'] = 'Portuguese (Portugal)';
  445. $langs['ro'] = 'Romanian';
  446. $langs['ro-mo'] = 'Romanian (Moldova)';
  447. $langs['ro-ro'] = 'Romanian (Romania)';
  448. $langs['ru'] = 'Russian';
  449. $langs['ru-mo'] = 'Russian (Moldova)';
  450. $langs['ru-ru'] = 'Russian (Russia)';
  451. $langs['sr'] = 'Serbian';
  452. $langs['sk'] = 'Slovak';
  453. $langs['sl'] = 'Slovenian';
  454. $langs['es'] = 'Spanish';
  455. $langs['es-ar'] = 'Spanish (Argentina)';
  456. $langs['es-bo'] = 'Spanish (Bolivia)';
  457. $langs['es-cl'] = 'Spanish (Chile)';
  458. $langs['es-co'] = 'Spanish (Colombia)';
  459. $langs['es-cr'] = 'Spanish (Costa Rica)';
  460. $langs['es-do'] = 'Spanish (Dominican Republic)';
  461. $langs['es-ec'] = 'Spanish (Ecuador)';
  462. $langs['es-sv'] = 'Spanish (El Salvador)';
  463. $langs['es-gt'] = 'Spanish (Guatemala)';
  464. $langs['es-hn'] = 'Spanish (Honduras)';
  465. $langs['es-mx'] = 'Spanish (Mexico)';
  466. $langs['es-ni'] = 'Spanish (Nicaragua)';
  467. $langs['es-pa'] = 'Spanish (Panama)';
  468. $langs['es-py'] = 'Spanish (Paraguay)';
  469. $langs['es-pe'] = 'Spanish (Peru)';
  470. $langs['es-pr'] = 'Spanish (Puerto Rico)';
  471. $langs['es-es'] = 'Spanish (Spain)';
  472. $langs['es-uy'] = 'Spanish (Uruguay)';
  473. $langs['es-ve'] = 'Spanish (Venezuela)';
  474. $langs['sv'] = 'Swedish';
  475. $langs['sv-fi'] = 'Swedish (Finland)';
  476. $langs['sv-se'] = 'Swedish (Sweden)';
  477. $langs['tr'] = 'Turkish';
  478. $langs['uk'] = 'Ukranian';
  479. return $langs;
  480. }
  481. function podPress_itunesLanguageOptions($current = 'en-us') {
  482. $langs = podPress_itunesLanguageArray();
  483. reset($langs);
  484. foreach ($langs as $key => $value) {
  485. echo '<option value="'.$key.'"';
  486. if($key == $current) {
  487. echo ' selected="selected"';
  488. }
  489. echo '>'.$value.' ['.$key.']</option>'."\n";
  490. }
  491. }
  492. function podPress_itunesCategoryOptions($current = '') {
  493. $cats = array();
  494. if ('' == trim($current) AND '##Global##' != $current) {
  495. $current='[ '.__('nothing', 'podpress').' ]';
  496. }
  497. $cats[] = '[ '.__('nothing', 'podpress').' ]';
  498. $cats[] = 'Arts';
  499. $cats[] = 'Arts:Design';
  500. $cats[] = 'Arts:Fashion & Beauty';
  501. $cats[] = 'Arts:Food';
  502. $cats[] = 'Arts:Literature';
  503. $cats[] = 'Arts:Performing Arts';
  504. $cats[] = 'Arts:Visual Arts';
  505. $cats[] = 'Business';
  506. $cats[] = 'Business:Business News';
  507. $cats[] = 'Business:Careers';
  508. $cats[] = 'Business:Investing';
  509. $cats[] = 'Business:Management & Marketing';
  510. $cats[] = 'Business:Shopping';
  511. $cats[] = 'Comedy';
  512. $cats[] = 'Education';
  513. $cats[] = 'Education:Education Technology';
  514. $cats[] = 'Education:Higher Education';
  515. $cats[] = 'Education:K-12';
  516. $cats[] = 'Education:Language Courses';
  517. $cats[] = 'Education:Training';
  518. $cats[] = 'Games & Hobbies';
  519. $cats[] = 'Games & Hobbies:Automotive';
  520. $cats[] = 'Games & Hobbies:Aviation';
  521. $cats[] = 'Games & Hobbies:Hobbies';
  522. $cats[] = 'Games & Hobbies:Other Games';
  523. $cats[] = 'Games & Hobbies:Video Games';
  524. $cats[] = 'Government & Organizations';
  525. $cats[] = 'Government & Organizations:Local';
  526. $cats[] = 'Government & Organizations:National';
  527. $cats[] = 'Government & Organizations:Non-Profit';
  528. $cats[] = 'Government & Organizations:Regional';
  529. $cats[] = 'Health';
  530. $cats[] = 'Health:Alternative Health';
  531. $cats[] = 'Health:Fitness & Nutrition';
  532. $cats[] = 'Health:Self-Help';
  533. $cats[] = 'Health:Sexuality';
  534. $cats[] = 'Kids & Family';
  535. $cats[] = 'Music';
  536. $cats[] = 'News & Politics';
  537. $cats[] = 'Religion & Spirituality';
  538. $cats[] = 'Religion & Spirituality:Buddhism';
  539. $cats[] = 'Religion & Spirituality:Christianity';
  540. $cats[] = 'Religion & Spirituality:Hinduism';
  541. $cats[] = 'Religion & Spirituality:Islam';
  542. $cats[] = 'Religion & Spirituality:Judaism';
  543. $cats[] = 'Religion & Spirituality:Other';
  544. $cats[] = 'Religion & Spirituality:Spirituality';
  545. $cats[] = 'Science & Medicine';
  546. $cats[] = 'Science & Medicine:Medicine';
  547. $cats[] = 'Science & Medicine:Natural Sciences';
  548. $cats[] = 'Science & Medicine:Social Sciences';
  549. $cats[] = 'Society & Culture';
  550. $cats[] = 'Society & Culture:History';
  551. $cats[] = 'Society & Culture:Personal Journals';
  552. $cats[] = 'Society & Culture:Philosophy';
  553. $cats[] = 'Society & Culture:Places & Travel';
  554. $cats[] = 'Sports & Recreation';
  555. $cats[] = 'Sports & Recreation:Amateur';
  556. $cats[] = 'Sports & Recreation:College & High School';
  557. $cats[] = 'Sports & Recreation:Outdoor';
  558. $cats[] = 'Sports & Recreation:Professional';
  559. $cats[] = 'Technology';
  560. $cats[] = 'Technology:Gadgets';
  561. $cats[] = 'Technology:Tech News';
  562. $cats[] = 'Technology:Podcasting';
  563. $cats[] = 'Technology:Software How-To';
  564. $cats[] = 'TV & Film';
  565. reset($cats);
  566. $foundit = false;
  567. foreach ($cats as $value) {
  568. $value = str_replace('&', '&amp;', $value);
  569. echo '<option';
  570. if($value == $current) {
  571. $foundit = true;
  572. echo ' selected="selected"';
  573. }
  574. //~ if ( '[ '.__('nothing', 'podpress').' ]' === $value ) {
  575. //~ echo ' value="nothing"';
  576. //~ }
  577. echo ' value="'.attribute_escape($value).'"';
  578. echo '>'.$value.'</option>'."\n";
  579. }
  580. if(!$foundit AND '##Global##' != $current) {
  581. $current = podPress_upgradeCategory($current);
  582. echo '<option selected="selected">'.$current.'</option>'."\n";
  583. }
  584. }
  585. function podPress_upgradeCategory($current) {
  586. $cats['Arts & Entertainment'] = 'Arts';
  587. $cats['Arts & Entertainment:Architecture'] = 'Arts:Design';
  588. $cats['Arts & Entertainment:Books'] = 'Arts:Literature';
  589. $cats['Arts & Entertainment:Design'] = 'Arts:Design';
  590. $cats['Arts & Entertainment:Entertainment'] = 'TV & Film';
  591. $cats['Arts & Entertainment:Games'] = 'Games & Hobbies:Video Games';
  592. $cats['Arts & Entertainment:Performing Arts'] = 'Arts:Performing Arts';
  593. $cats['Arts & Entertainment:Photography'] = 'Arts:Visual Arts';
  594. $cats['Arts & Entertainment:Poetry'] = 'Arts:Literature';
  595. $cats['Arts & Entertainment:Science Fiction'] = 'Arts:Literature';
  596. $cats['Audio Blogs'] = 'Society & Culture:Personal Journals';
  597. $cats['Business'] = 'Business';
  598. $cats['Business:Careers'] = 'Business:Careers';
  599. $cats['Business:Finance'] = 'Business:Business News';
  600. $cats['Business:Investing'] = 'Business:Investing';
  601. $cats['Business:Management'] = 'Business:Management & Marketing';
  602. $cats['Business:Marketing'] = 'Business:Management & Marketing';
  603. $cats['Comedy'] = 'Comedy';
  604. $cats['Education'] = 'Education';
  605. $cats['Education:Higher Education'] = 'Education:Higher Education';
  606. $cats['Education:K-12'] = 'Education:K-12';
  607. $cats['Family'] = 'Kids & Family';
  608. $cats['Food'] = 'Arts:Food';
  609. $cats['Health'] = 'Health';
  610. $cats['Health:Diet & Nutrition'] = 'Health:Fitness & Nutrition';
  611. $cats['Health:Fitness'] = 'Health:Fitness & Nutrition';
  612. $cats['Health:Relationships'] = 'Health:Sexuality';
  613. $cats['Health:Self-Help'] = 'Health:Self-Help';
  614. $cats['Health:Sexuality'] = 'Health:Sexuality';
  615. $cats['International'] = 'Government & Organizations:National';
  616. $cats['International:Australian'] = 'Government & Organizations:National';
  617. $cats['International:Belgian'] = 'Government & Organizations:National';
  618. $cats['International:Brazilian'] = 'Government & Organizations:National';
  619. $cats['International:Canadian'] = 'Government & Organizations:National';
  620. $cats['International:Chinese'] = 'Government & Organizations:National';
  621. $cats['International:Dutch'] = 'Government & Organizations:National';
  622. $cats['International:French'] = 'Government & Organizations:National';
  623. $cats['International:German'] = 'Government & Organizations:National';
  624. $cats['International:Hebrew'] = 'Government & Organizations:National';
  625. $cats['International:Italian'] = 'Government & Organizations:National';
  626. $cats['International:Japanese'] = 'Government & Organizations:National';
  627. $cats['International:Norwegian'] = 'Government & Organizations:National';
  628. $cats['International:Polish'] = 'Government & Organizations:National';
  629. $cats['International:Portuguese'] = 'Government & Organizations:National';
  630. $cats['International:Spanish'] = 'Government & Organizations:National';
  631. $cats['International:Swedish'] = 'Government & Organizations:National';
  632. $cats['Movies & Television'] = 'TV & Film';
  633. $cats['Music'] = 'Music';
  634. $cats['News'] = 'News & Politics';
  635. $cats['Politics'] = 'News & Politics';
  636. $cats['Public Radio'] = 'News & Politics';
  637. $cats['Religion & Spirituality'] = 'Religion & Spirituality';
  638. $cats['Religion & Spirituality:Buddhism'] = 'Religion & Spirituality:Buddhism';
  639. $cats['Religion & Spirituality:Christianity'] = 'Religion & Spirituality:Christianity';
  640. $cats['Religion & Spirituality:Islam'] = 'Religion & Spirituality:Islam';
  641. $cats['Religion & Spirituality:Judaism'] = 'Religion & Spirituality:Judaism';
  642. $cats['Religion & Spirituality:New Age'] = 'Religion & Spirituality:Spirituality';
  643. $cats['Religion & Spirituality:Philosophy'] = 'Religion & Spirituality:Philosophy';
  644. $cats['Religion & Spirituality:Spirituality'] = 'Religion & Spirituality:Spirituality';
  645. $cats['Science'] = 'Science & Medicine';
  646. $cats['Sports'] = 'Sports & Recreation';
  647. $cats['Talk Radio'] = 'News & Politics';
  648. $cats['Technology'] = 'Technology';
  649. $cats['Technology:IT News'] = 'Technology:Tech News';
  650. $cats['Technology:Computers'] = 'Technology:Tech News';
  651. $cats['Technology:Developers'] = 'Technology:Tech News';
  652. $cats['Technology:Gadgets'] = 'Technology:Gadgets';
  653. $cats['Technology:Information Technology'] = 'Technology:Tech News';
  654. $cats['Technology:News'] = 'Technology:Tech News';
  655. $cats['Technology:Operating Systems'] = 'Technology:Tech News';
  656. $cats['Technology:Podcasting'] = 'Technology:Podcasting';
  657. $cats['Technology:Smart Phones'] = 'Technology:Tech News';
  658. $cats['Technology:Text/Speech'] = 'Technology:Tech News';
  659. $cats['Transportation'] = 'Games & Hobbies:Automotive';
  660. $cats['Transportation:BBB'] = 'Games & Hobbies:Automotive';
  661. $cats['Transportation:BBB'] = 'Games & Hobbies:Automotive';
  662. $cats['Transportation:BBB'] = 'Sports & Recreation:Outdoor';
  663. $cats['Transportation:BBB'] = 'Games & Hobbies:Automotive';
  664. $cats['Travel'] = 'Society & Culture:Places & Travel';
  665. $current = str_replace('&amp;', '&', $current);
  666. if(isset($cats[$current])) {
  667. $result = $cats[$current];
  668. } else {
  669. $result = $current;
  670. }
  671. return str_replace('&', '&amp;', $result);
  672. }
  673. function podPress_itunesCategoryOptions2($current = '') {
  674. $cats = array();
  675. $cats['Arts &amp; Entertainment'] = 'Arts &amp; Entertainment';
  676. $cats['Arts &amp; Entertainment:Architecture'] = 'Arts &amp; Entertainment:Architecture';
  677. $cats['Arts &amp; Entertainment:Books'] = 'Arts &amp; Entertainment:Books';
  678. $cats['Arts &amp; Entertainment:Design'] = 'Arts &amp; Entertainment:Design';
  679. $cats['Arts &amp; Entertainment:Poetry'] = 'Arts &amp; Entertainment:Poetry';
  680. $cats['Arts &amp; Entertainment:Games'] = 'Arts &amp; Entertainment:Games';
  681. $cats['Arts &amp; Entertainment:Performing Arts'] = 'Arts &amp; Entertainment:Performing Arts';
  682. $cats['Arts &amp; Entertainment:Photography'] = 'Arts &amp; Entertainment:Photography';
  683. $cats['Arts &amp; Entertainment:Science Fiction'] = 'Arts &amp; Entertainment:Science Fiction';
  684. $cats['Audio Blogs'] = 'Audio Blogs';
  685. $cats['Business'] = 'Business';
  686. $cats['Business:Careers'] = 'Business:Careers';
  687. $cats['Business:Finance'] = 'Business:Finance';
  688. $cats['Business:Investing'] = 'Business:Investing';
  689. $cats['Business:Management'] = 'Business:Management';
  690. $cats['Business:Marketing'] = 'Business:Marketing';
  691. $cats['Comedy'] = 'Comedy';
  692. $cats['Education'] = 'Education';
  693. $cats['Education:K-12'] = 'Education:K-12';
  694. $cats['Education:Higher Education'] = 'Education:Higher Education';
  695. $cats['Family'] = 'Family';
  696. $cats['Food'] = 'Food';
  697. $cats['Health'] = 'Health';
  698. $cats['Health:Diet &amp; Nutrition'] = 'Health:Diet &amp; Nutrition';
  699. $cats['Health:Fitness'] = 'Health:Fitness';
  700. $cats['Health:Relationships'] = 'Health:Relationships';
  701. $cats['Health:Self-Help'] = 'Health:Self-Help';
  702. $cats['Health:Sexuality'] = 'Health:Sexuality';
  703. $cats['International'] = 'International';
  704. $cats['International:Australian'] = 'International:Australian';
  705. $cats['International:Belgian'] = 'International:Belgian';
  706. $cats['International:Brazilian'] = 'International:Brazilian';
  707. $cats['International:Canadian'] = 'International:Canadian';
  708. $cats['International:Chinese'] = 'International:Chinese';
  709. $cats['International:Dutch'] = 'International:Dutch';
  710. $cats['International:French'] = 'International:French';
  711. $cats['International:German'] = 'International:German';
  712. $cats['International:Hebrew'] = 'International:Hebrew';
  713. $cats['International:Italian'] = 'International:Italian';
  714. $cats['International:Japanese'] = 'International:Japanese';
  715. $cats['International:Norwegian'] = 'International:Norwegian';
  716. $cats['International:Polish'] = 'International:Polish';
  717. $cats['International:Portuguese'] = 'International:Portuguese';
  718. $cats['International:Spanish'] = 'International:Spanish';
  719. $cats['International:Swedish'] = 'International:Swedish';
  720. $cats['Movies &amp; Television'] = 'Movies &amp; Television';
  721. $cats['Music'] = 'Music';
  722. $cats['News'] = 'News';
  723. $cats['Politics'] = 'Politics';
  724. $cats['Public Radio'] = 'Public Radio';
  725. $cats['Religion &amp; Spirituality'] = 'Religion &amp; Spirituality';
  726. $cats['Religion &amp; Spirituality:Buddhism'] = 'Religion &amp; Spirituality:Buddhism';
  727. $cats['Religion &amp; Spirituality:Christianity'] = 'Religion &amp; Spirituality:Christianity';
  728. $cats['Religion &amp; Spirituality:Islam'] = 'Religion &amp; Spirituality:Islam';
  729. $cats['Religion &amp; Spirituality:Judaism'] = 'Religion &amp; Spirituality:Judaism';
  730. $cats['Religion &amp; Spirituality:New Age'] = 'Religion &amp; Spirituality:New Age';
  731. $cats['Religion &amp; Spirituality:Philosophy'] = 'Religion &amp; Spirituality:Philosophy';
  732. $cats['Religion &amp; Spirituality:Spirituality'] = 'Religion &amp; Spirituality:Spirituality';
  733. $cats['Science'] = 'Science';
  734. $cats['Sports'] = 'Sports';
  735. $cats['Talk Radio'] = 'Talk Radio';
  736. $cats['Technology'] = 'Technology';
  737. $cats['Technology:Computers'] = 'Technology:Computers';
  738. $cats['Technology:Developers'] = 'Technology:Developers';
  739. $cats['Technology:Gadgets'] = 'Technology:Gadgets';
  740. $cats['Technology:Information Technology'] = 'Technology:Information Technology';
  741. $cats['Technology:News'] = 'Technology:News';
  742. $cats['Technology:Operating Systems'] = 'Technology:Operating Systems';
  743. $cats['Technology:Podcasting'] = 'Technology:Podcasting';
  744. $cats['Technology:Smart Phones'] = 'Technology:Smart Phones';
  745. $cats['Technology:Text/Speech'] = 'Technology:Text/Speech';
  746. $cats['Travel'] = 'Travel';
  747. reset($cats);
  748. foreach ($cats as $key => $value) {
  749. echo '<option value="'.$key.'"';
  750. if($key == $current) {
  751. echo ' selected="selected"';
  752. }
  753. echo '>'.$value.'</option>'."\n";
  754. }
  755. }
  756. /**************************************************************/
  757. /* Functions for supporting the backend processor */
  758. /**************************************************************/
  759. function podPress_ResolveReDirects($uriFileName)
  760. {
  761. GLOBAL $podPress;
  762. $tries = 0;
  763. while($tries < 5) {
  764. $tries++;
  765. $aURL = parse_url($uriFileName);
  766. if($aURL['scheme'] != 'http') {
  767. return;
  768. }
  769. $sHost = $aURL['host'];
  770. $sFilepath = (isset($aURL['path']) ? $aURL['path'] : '/') . (isset($aURL['query']) ? '?' . $aURL['query'] : '');
  771. $nPort = isset($aURL['port']) ? $aURL['port'] : 80;
  772. $fpRemote = @fsockopen($sHost, $nPort, $errno, $errstr, 30);
  773. // Make sure the socket is open
  774. if(!$fpRemote) {
  775. return;
  776. }
  777. // Request headers
  778. $sHeaders = "HEAD " . $sFilepath . " HTTP/1.1\r\n";
  779. $sHeaders .= "Host: ". $sHost . "\r\n";
  780. $sHeaders .= "Connection: Close\r\n\r\n";
  781. // Sending headers
  782. fwrite($fpRemote, $sHeaders);
  783. // Getting back the content
  784. $sRemoteHeaders = '';
  785. while(!feof($fpRemote)) {
  786. $sRemoteHeaders .= fgets($fpRemote, 128);
  787. }
  788. // Closing the socket
  789. fclose($fpRemote);
  790. // parse headers
  791. $crlf = "\r\n";
  792. $headers = array();
  793. $lines = explode($crlf, $sRemoteHeaders);
  794. foreach($lines as $line) {
  795. if(($pos = strpos($line, ':')) !== false) {
  796. $headers[strtolower(trim(substr($line, 0, $pos)))] = trim(substr($line, $pos+1));
  797. }
  798. }
  799. // redirection?
  800. if(isset($headers['location'])) {
  801. $uriFileName = $headers['location'];
  802. } else {
  803. return $uriFileName;
  804. }
  805. }
  806. return $uriFileName;
  807. }
  808. function podPress_getID3tags($mediafile, $resolved = false, $limitDownload = false) {
  809. GLOBAL $podPress;
  810. $tmp_download_exists = FALSE;
  811. if($podPress->settings['enablePodangoIntegration']) {
  812. if(substr($mediafile, 0, strlen('Podango:')) == 'Podango:') {
  813. $fileNameParts = explode(':', $mediafile);
  814. $mediafile = 'http://download.podango.com/mediatracker/555/'.$fileNameParts[3].'/'.$fileNameParts[4];
  815. }
  816. }
  817. podPress_var_dump('podPress_getID3tags - before inclusion of the getID3 library');
  818. require_once(ABSPATH.PLUGINDIR.'/podpress/getid3/getid3.php');
  819. $getID3 = new getID3;
  820. if($getID3 == false) {
  821. return __('Remote MP3 File could not be read. (error loading ID3 reader)', 'podpress');
  822. }
  823. podPress_var_dump('podPress_getID3tags - after inclusion of the getID3 library');
  824. if(!$resolved) {
  825. $systemFileName = $podPress->convertPodcastFileNameToSystemPath($mediafile);
  826. } else {
  827. $systemFileName = $mediafile;
  828. }
  829. podPress_var_dump('podPress_getID3tags - before a possible download of the media file');
  830. if(file_exists($systemFileName)) {
  831. $uriFileName = $systemFileName;
  832. } else {
  833. if(!$resolved) {
  834. $uriFileName = $podPress->convertPodcastFileNameToValidWebPath($mediafile);
  835. } else {
  836. $uriFileName = $mediafile;
  837. }
  838. $local_uploadURL = $podPress->uploadURL;
  839. podPress_var_dump('podPress_getID3tags - local_uploadURL: '.$local_uploadURL);
  840. podPress_var_dump('podPress_getID3tags - local_uploadPath: '.$podPress->uploadPath);
  841. podPress_var_dump('podPress_getID3tags - tempFileSystemPath: '.$podPress->tempFileSystemPath);
  842. podPress_var_dump('podPress_getID3tags - tempFileURLPath: '.$podPress->tempFileURLPath);
  843. podPress_var_dump('podPress_getID3tags - uriFileName: '.$uriFileName);
  844. 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
  845. // get the absolute folder of the file from the URL
  846. podPress_var_dump('podPress_getID3tags - it is a local file');
  847. $uriFileName = $podPress->uploadPath.str_replace($local_uploadURL,'',$uriFileName);
  848. $uriFileName = str_replace('\\', '/',$uriFileName);
  849. podPress_var_dump('podPress_getID3tags - new uriFileName: '.$uriFileName);
  850. } else {
  851. podPress_var_dump('podPress_getID3tags - go to podPress_downloadFile');
  852. $uriFileName = podPress_downloadFile($uriFileName, false, $limitDownload);
  853. $tmp_download_exists = TRUE;
  854. }
  855. }
  856. podPress_var_dump('podPress_getID3tags - after a possible download of the media file');
  857. $fileinfo = @$getID3->analyze($uriFileName);
  858. podPress_var_dump('podPress_getID3tags - after getID3->analyze');
  859. getid3_lib::CopyTagsToComments($fileinfo);
  860. podPress_var_dump('podPress_getID3tags - after getid3_lib::CopyTagsToComments');
  861. if (TRUE === $tmp_download_exists) { // if the file has been downloaded to a local folder then delete the tempfile
  862. if ('' != $fileinfo['filenamepath']) { // take the folder and file from getID3 if possible
  863. $unlink_result = @unlink($fileinfo['filenamepath']);
  864. // If tempnam is available then tempnam creates a tempfile which has no media file extension like .mp3. But getID3 needs these extensions.
  865. // That is why tempnam (in podPress_downloadFile) is only used to get a the tmp file name and path. If the tempnam has been used then
  866. // then there are 2 files the tmp file and the tmp file with a media file name extension. The latter was removed in the step before and the next step is
  867. // to remove the tmp file which was created by tempnam in podPress_downloadFile.
  868. $ext = end(explode('.', $fileinfo['filenamepath']));
  869. if (FALSE === empty($ext)) {
  870. $tempnam_file = substr($fileinfo['filenamepath'], 0, (strlen($fileinfo['filenamepath'])-strlen($ext)-1));
  871. $unlink_result = @unlink($tempnam_file);
  872. }
  873. } else {
  874. $unlink_result = @unlink($uriFileName);
  875. $ext = end(explode('.', $uriFileName));
  876. if (FALSE === empty($ext)) {
  877. $tempnam_file = substr($uriFileName, 0, (strlen($uriFileName)-strlen($ext)-1));
  878. $unlink_result = @unlink($tempnam_file);
  879. }
  880. }
  881. }
  882. podPress_var_dump('podPress_getID3tags - the end');
  883. return $fileinfo;
  884. }
  885. function podPress_showID3tags($mediafile) {
  886. if (FALSE !== strpos($mediafile, 'http://www.youtube')) {
  887. return '';
  888. }
  889. podPress_var_dump('start of the ID3 tag retrieval');
  890. $fileinfo = podPress_getID3tags($mediafile, false);
  891. podPress_var_dump('end of the ID3 tag retrieval');
  892. if(!is_array($fileinfo) OR FALSE == isset($fileinfo['comments']) ) {
  893. return '<div class="updated message">'.__('The file has probably no information like artist, genre, album, etc.', 'podpress').'<br /><pre class="podpress_id3tags_error">'.var_export($fileinfo, true).'</pre></div>';
  894. }
  895. if(isset($_GET['keynum'])) {
  896. $randID = $_GET['keynum'];
  897. } else {
  898. mt_srand(crc32(microtime()));
  899. $randID = mt_rand(1, 9999);
  900. }
  901. $result .= '<table class="the-list-x widefat podpress_id3tag_details_table">'."\n";
  902. $result .= ' <tr class="alternate">'."\n";
  903. $result .= ' <th>'.__('Artist', 'podpress').'</th><td><span id="podPressMedia_'.$randID.'_tagArtist">'.(!empty($fileinfo['comments']['artist'][0]) ? htmlentities($fileinfo['comments']['artist'][0]) : '&nbsp;').'</span></td>'."\n";
  904. $result .= ' </tr>'."\n";
  905. $result .= ' <tr>'."\n";
  906. $result .= ' <th>'.__('Album', 'podpress').'</th><td><span id="podPressMedia_'.$randID.'_tagAlbum">'.(!empty($fileinfo['comments']['album'][0]) ? htmlentities($fileinfo['comments']['album'][0]) : '&nbsp;').'</span></td>'."\n";
  907. $result .= ' </tr>'."\n";
  908. $result .= ' <tr class="alternate">'."\n";
  909. $result .= ' <th>'.__('Title', 'podpress').'</th><td><span id="podPressMedia_'.$randID.'_tagTitle">'.(!empty($fileinfo['comments']['title'][0]) ? htmlentities($fileinfo['comments']['title'][0]) : '&nbsp;').'</span></td>'."\n";
  910. $result .= ' </tr>'."\n";
  911. $result .= ' <tr>'."\n";
  912. $result .= ' <th>'.__('Description', 'podpress').'</th><td><span id="podPressMedia_'.$randID.'_tagDescription">'.(!empty($fileinfo['comments']['comment'][0]) ? htmlentities($fileinfo['comments']['comment'][0]) : '&nbsp;').'</span></td>'."\n";
  913. $result .= ' </tr>'."\n";
  914. $result .= ' <tr class="alternate">'."\n";
  915. $result .= ' <th>'.__('Genre', 'podpress').'</th><td><span id="podPressMedia_'.$randID.'_tagGenre">'.(!empty($fileinfo['comments']['genre'][0]) ? htmlentities($fileinfo['comments']['genre'][0]) : '&nbsp;').'</span></td>'."\n";
  916. $result .= ' </tr>'."\n";
  917. $result .= ' <tr>'."\n";
  918. $result .= ' <th>'.__('Length', 'podpress').'</th><td><span id="podPressMedia_'.$randID.'_tagLength">'.(!empty($fileinfo['playtime_string']) ? $fileinfo['playtime_string'] : '&nbsp;').'</span></td>'."\n";
  919. $result .= ' </tr>'."\n";
  920. $result .= ' <tr class="alternate">'."\n";
  921. $result .= ' <th>'.__('Cover Art', 'podpress').'</th><td><span id="podPressMedia_'.$randID.'_tagCoverArt"><img src="'.podPress_url().'podpress_backend.php?action=id3image&filename='.urlencode($mediafile).'" alt="."/></span></td>'."\n";
  922. $result .= ' </tr>'."\n";
  923. //~ $result .= ' <tr>'."\n";
  924. //~ $result .= ' <td colspan="2"><a href="#" onclick="podPressID3ToPost(\''.$randID.'\'); return false;">'.__('Copy contents to post details', 'podpress').'</a></td>'."\n";
  925. //~ $result .= ' </tr>'."\n";
  926. $result .= '</table>'."\n";
  927. return $result;
  928. }
  929. function podPress_getCoverArt($mediafile) {
  930. $fileinfo = podPress_getID3tags($mediafile, false, 500000);
  931. if(isset($fileinfo['id3v2']['APIC'][0])) {
  932. $ref = $fileinfo['id3v2']['APIC'][0];
  933. } elseif(isset($fileinfo['id3v2']['PIC'][0])) {
  934. $ref = $fileinfo['id3v2']['PIC'][0];
  935. } else {
  936. $ref['image_mime'] = 'image/jpeg';
  937. $ref['datalength'] = @filesize('images/powered_by_podpress.png');
  938. $ref['data'] = @file_get_contents('images/powered_by_podpress.png');
  939. }
  940. header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); // some day in the past
  941. header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
  942. header('Content-type: '.$ref['image_mime']);
  943. // header('Content-Disposition: attachment; filename="coverart.png"');
  944. header("Content-Length: ".$ref['datalength']);
  945. set_time_limit(0);
  946. echo $ref['data'];
  947. }
  948. function podPress_getDuration($mediafile)
  949. {
  950. GLOBAL $podPress;
  951. if($podPress->settings['enablePodangoIntegration']) {
  952. if(substr($mediafile, 0, strlen('Podango:')) == 'Podango:') {
  953. $fileNameParts = explode(':', $mediafile);
  954. $mediafile = 'http://download.podango.com/mediatracker/555/'.$fileNameParts[3].'/'.$fileNameParts[4];
  955. }
  956. }
  957. $id3formats = array('mp3', 'ogg', 'avi', 'mov', '.qt', 'mp4', 'm4v', 'm4a', 'wma', 'wmv', 'mpg', 'peg', 'flv', 'swf');
  958. if(in_array(strtolower(substr($mediafile, -3, 3)), $id3formats)) {
  959. podPress_var_dump('start of the duration retrieval');
  960. $systemFileName = $podPress->convertPodcastFileNameToSystemPath($mediafile);
  961. if(file_exists($systemFileName)) {
  962. $uriFileName = $systemFileName;
  963. } else {
  964. $systemFileName = $

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