verbalbrew /wordpress/wp-content/plugins/podpress/podpress_theme.php

Language PHP Lines 285
MD5 Hash 87a373ffbdfcdb49f1b6603b7bcf6709
Repository https://github.com/bill742/verbalbrew.git View Raw File
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
<?php
/*
License:
 ==============================================================================

    Copyright 2006  Dan Kuykendall  (email : dan@kuykendall.org)

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-107  USA
*/

if (!function_exists('podPress_webContent')) {
	function podPress_webContent($podPressTemplateData) {
		GLOBAL $podPress, $post;
		$divider = ' | ';
		$podPressPlayBlockScripts = '';
		$podPressContentAll = '';
		
		if ( TRUE === defined('PODPRESS_SHOW_SECTION_MARKERS') AND TRUE === constant('PODPRESS_SHOW_SECTION_MARKERS') ) {
			$podpress_section_begin = "<!-- Begin: podPress -->\n";
			$podpress_section_end = "\n<!-- End: podPress -->\n";
			$podpress_downloadlinks_section_begin = "<!-- Begin:  podPress download link line -->\n";
			$podpress_downloadlinks_section_end = "\n<!-- End:  podPress download link line -->\n";
		} else {
			$podpress_section_begin = '';
			$podpress_section_end = '';
			$podpress_downloadlinks_section_begin = '';
			$podpress_downloadlinks_section_end = '';
		}		

		if ( TRUE == isset($podPress->settings['do_not_use_the_target_attribute']) AND TRUE === $podPress->settings['do_not_use_the_target_attribute'] ) {
			$target_attribute = '';
		} else {
			$target_attribute = ' target="new"';
		}

		foreach ($podPressTemplateData['files'] as $key=>$val) {
			$podPressContent = '';
			$podPressDownloadlinks = '';
			$GLOBALS['podPressPlayer']++;
			if(empty($val['dimensionW'])) {
				$val['dimensionW'] = "''";
			}
			if(empty($val['dimensionH'])) {
				$val['dimensionH'] = "''";
			}
			$dividerNeeded = false;
			
			$podPressEpisodeTitle = stripslashes(htmlspecialchars_decode(__($val['title'], 'podpress'))); // if the title is not given by the author then it will be a defaultTitle (see podPress_defaultTitles)

			if($val['enablePlayer']) {
				if($podPressContent != '') {			
					$podPressContent .= "<br />\n";
				}
				if ( $podPress->settings['contentAutoDisplayPlayer'] ) {
					$style = ' style="display:block;" ';
					$style_wrap_1pixelout = ' display:block;';
				} else {
					$style = ' style="display:none;" ';
					$style_wrap_1pixelout = ' display:none;';
				}
				if ( 'audio_mp3' == $val['type'] AND TRUE == isset($podPress->settings['player']['listenWrapper']) AND TRUE == $podPress->settings['player']['listenWrapper'] AND FALSE == $podPress->settings['enablePodangoIntegration'] AND TRUE == isset($podPress->settings['mp3Player']) AND '1pixelout' == $podPress->settings['mp3Player'] ) {
					$podPressContent .= "\n".'<div class="podpress_listenwrapper_container" id="podpress_lwc_'.$GLOBALS['podPressPlayer'].'" style="background-image:url('.PODPRESS_URL.'/images/listen_wrapper.gif);'.$style_wrap_1pixelout.'"><div class="podpress_mp3_borderleft"></div><div class="podpress_1pixelout_container"><div id="podPressPlayerSpace_'.$GLOBALS['podPressPlayer'].'"><!-- podPress --></div></div></div>'."\n";
				} elseif ( 'audio_mp3' == $val['type'] AND (False == isset($podPress->settings['player']['listenWrapper']) OR FALSE == $podPress->settings['player']['listenWrapper']) AND FALSE == $podPress->settings['enablePodangoIntegration'] AND TRUE == isset($podPress->settings['mp3Player']) AND '1pixelout' == $podPress->settings['mp3Player'] ) {
					$podPressContent .= "\n".'<div class="podpress_playerspace podpress_playerspace_'.$val['type'].' podpress_mp3player"'.$style.'><div id="podPressPlayerSpace_'.$GLOBALS['podPressPlayer'].'"><!-- podPress --></div></div>'."\n";
				} else {
					$podPressContent .= "\n".'<div class="podpress_playerspace podpress_playerspace_'.$val['type'].'"><div id="podPressPlayerSpace_'.$GLOBALS['podPressPlayer'].'"'.$style.'><!-- podPress --></div></div>'."\n";
				}
			}
			$podPressDownloadlinks .= $podpress_downloadlinks_section_begin.'<div class="podPress_downloadlinks podPress_downloadlinks_'.$val['type'].'">';
			
			if(isset($val['image'])) {
				if($val['enableDownload'] && !empty($val['URI'])) {
					if ( 0 === strpos($val['type'], 'embed_') ) {
						$podPressDownloadlinks .= '<a href="'.$val['URI'].'"'.$target_attribute.' title="'.attribute_escape(sprintf(__('Direct Link to %1$s', 'podpress'), $podPressEpisodeTitle)).'" class="podpress_downloadimglink podpress_downloadimglink_'.$val['type'].'">';
					} else {
						$podPressDownloadlinks .= '<a href="'.$val['URI'].'"'.$target_attribute.' title="'.attribute_escape(sprintf(__('Download: %1$s', 'podpress'), $podPressEpisodeTitle)).'" class="podpress_downloadimglink podpress_downloadimglink_'.$val['type'].'">';
					}
				}
				$podPressDownloadlinks .= '<img src="'.podPress_url().'images/'.$val['image'].'" class="podPress_imgicon podpress_imgicon_'.$val['type'].'" alt="" />';
				if($val['enableDownload'] && !empty($val['URI'])) {
					$podPressDownloadlinks .= '</a>';
				}
				if(!$podPressTemplateData['showDownloadText'] == 'enabled') {
					$val['enableDownload'] = false;
				}
			}
			
			// ntm: this is not in use unless the option at the podPress general settings page will uncommented
			if(TRUE == isset($val['enableTorrentDownload']) AND TRUE === $val['enableTorrentDownload']) {
				$podPressDownloadlinks .= '<a href="'.$val['URI_torrent'].'"'.$target_attribute.' title="'.attribute_escape(sprintf(__('Download: %1$s - .torrent file', 'podpress'), $podPressEpisodeTitle)).'">';
				if(strstr($val['image'], '_button')) {
					$torrentimg = 'misc_torrent_button.png';
				} else {
					$torrentimg = 'misc_torrent_icon.png';
				}
				$podPressDownloadlinks .= '<img src="'.podPress_url().'images/'.$torrentimg.'" class="podPress_imgicon" alt="" />';
				$podPressDownloadlinks .= '</a>';
			}

			$podPressDownloadlinks .= ' ';
			$podPressDownloadlinks .= '<span class="podpress_mediafile_title podpress_mediafile_title_'.$val['type'].'">'.$podPressEpisodeTitle.'</span>';

			if ( isset($podPressTemplateData['showDuration']) AND 'disabled' != $podPressTemplateData['showDuration'] AND FALSE == empty($val['duration'])) {
				if ( empty($podPressTemplateData['showDuration']) OR 'enabled' == $podPressTemplateData['showDuration'] ) {
					$podPressTemplateData['showDuration'] = 'colon';
				}
				if ( isset($podPress->settings['contentDurationdivider']) ) {
					$podPressDownloadlinks .= ' <span class="podpress_mediafile_dursize podpress_mediafile_dursize_'.$val['type'].'">[ '.$podPress->millisecondstostring($podPress->strtomilliseconds($val['duration']), 'h:m:s:ms', $podPress->settings['contentDurationdivider']);
				} else {
					$podPressDownloadlinks .= ' <span class="podpress_mediafile_dursize podpress_mediafile_dursize_'.$val['type'].'">[ '.$podPress->millisecondstostring($podPress->strtomilliseconds($val['duration']), 'h:m:s:ms');
				}
				$durationfilesizeseparator = ' | ';
			} else {
				$durationfilesizeseparator = ' <span class="podpress_mediafile_dursize podpress_mediafile_dursize_'.$val['type'].'">[ ';
			}
			
			if ( 'enabled' == $podPressTemplateData['showfilesize'] AND FALSE == empty($val['size']) AND FALSE === stristr($val['type'], 'embed_') ) {
				$size_mb = round(($val['size']/1048576), 2);
				if ( 0.01 > $size_mb ) {
					$size_mb = 0.01;
				}
				$podPressDownloadlinks .= $durationfilesizeseparator.$size_mb.' '.__('MB', 'podpress').' ]</span>';
			} else {
				if ( ' <span class="podpress_mediafile_dursize podpress_mediafile_dursize_'.$val['type'].'">[ ' != $durationfilesizeseparator) {
					$podPressDownloadlinks .= ' ]</span>';
				}
			}
			
			if($val['enablePlayer'] || $val['enablePopup'] || $val['enableDownload'] || !$val['authorized']) {
				$podPressDownloadlinks .= ' ';
			}

			if(!$val['authorized']) {
				$podPressDownloadlinks .= ' <a href="'.get_option('siteurl').'/wp-login.php" class="podpress_protected_link">'.__('(Protected Content)', 'podpress').'</a><br/>'."\n";
			} else {
				if($val['enablePlayer']) {
					if ($dividerNeeded) {
						$hideplayerplaynow_divider = $divider;
					} else {
						$hideplayerplaynow_divider = '';
					}
					
					if ( (TRUE == isset($val['enableTorrentDownload']) AND TRUE == $val['enableTorrentDownload']) OR (TRUE == isset($val['enableTorrentDownload']) AND 'on' == $val['disablePreview']) ) {
						$previewVal = 'nopreview';
					} else {
						$previewVal = 'false';
					}
					
					if ($val['enablePlaylink']) {
						if ($podPress->settings['contentAutoDisplayPlayer']) {
							$podPressDownloadlinks .= '<a href="#podPressPlayerSpace_'.$GLOBALS['podPressPlayer'].'" class="podpress_playlink podpress_playlink_'.$val['type'].'" onclick="javascript:podPressShowHidePlayer(\''.$GLOBALS['podPressPlayer'].'\', \''.js_escape($val['URI_Player']).'\', '.strval(intval($val['dimensionW'])).', '.strval(intval($val['dimensionH'])).', \''.$previewVal.'\', \''.$val['previewImage'].'\', \''.js_escape($val['title']).'\', \''.js_escape($val['artist']).'\'); return false;"><span id="podPressPlayerSpace_'.$GLOBALS['podPressPlayer'].'_PlayLink" class="podPress_playerspace_playlink">'.$hideplayerplaynow_divider.__('Play Now', 'podpress').'</span></a>';
						} else {
							$podPressDownloadlinks .= '<a href="#podPressPlayerSpace_'.$GLOBALS['podPressPlayer'].'" class="podpress_playlink podpress_playlink_'.$val['type'].'" onclick="javascript:podPressShowHidePlayer(\''.$GLOBALS['podPressPlayer'].'\', \''.js_escape($val['URI_Player']).'\', '.strval(intval($val['dimensionW'])).', '.strval(intval($val['dimensionH'])).', \'force\', \''.$val['previewImage'].'\', \''.js_escape($val['title']).'\', \''.js_escape($val['artist']).'\'); return false;"><span id="podPressPlayerSpace_'.$GLOBALS['podPressPlayer'].'_PlayLink" class="podPress_playerspace_playlink">'.$hideplayerplaynow_divider.__('Play Now', 'podpress').'</span></a>';
						}
						$dividerNeeded = true;
					} else {
						$podPressDownloadlinks .= '<span id="podPressPlayerSpace_'.$GLOBALS['podPressPlayer'].'_PlayLink" style="display:none">'.$hideplayerplaynow_divider.__('Play Now', 'podpress').'</span>';
						$dividerNeeded = false;
					}
					$podPressDownloadlinks .= '<input type="hidden" id="podPressPlayerSpace_'.$GLOBALS['podPressPlayer'].'_OrigURL" value="'.attribute_escape($podPress->convertPodcastFileNameToValidWebPath($val['URI_orig'])).'" />';
					
					if ($podPress->settings['contentAutoDisplayPlayer']) {
						$podPressPlayBlockScripts .= 'podPressShowHidePlayer(\''.$GLOBALS['podPressPlayer'].'\', \''.js_escape($val['URI_Player']).'\', '.strval(intval($val['dimensionW'])).', '.strval(intval($val['dimensionH'])).', \''.$previewVal.'\', \''.js_escape($val['previewImage']).'\', \''.js_escape($val['title']).'\', \''.js_escape($val['artist']).'\');';
					}
				}

				if ( $val['enablePopup'] AND FALSE === strpos($val['type'], 'ebook_') ) {
					if($dividerNeeded) {
						$podPressDownloadlinks .= $divider;
					}
					$podPressDownloadlinks .= '<a href="#podPressPlayerSpace_'.$GLOBALS['podPressPlayer'].'" class="podpress_playinpopup podpress_playinpopup_'.$val['type'].'" onclick="javascript:podPressPopupPlayer(\''.$GLOBALS['podPressPlayer'].'\', \''.js_escape($val['URI_Player']).'\', '.strval(intval($val['dimensionW'])).', '.strval(intval($val['dimensionH'])).', \''.js_escape(get_bloginfo('name')).'\', \''.$post->ID.'\', \''.js_escape($val['title']).'\', \''.js_escape($val['artist']).'\'); return false;">'.__('Play in Popup', 'podpress').'</a>';
					$dividerNeeded = true;
				}

				if($val['enableDownload'] && $podPressTemplateData['showDownloadText'] == 'enabled') {
					if($dividerNeeded) {
						$podPressDownloadlinks .= $divider;
					}
					if ( 0 === strpos($val['type'], 'embed_') ) {
						$podPressDownloadlinks .= '<a href="'.$val['URI'].'"'.$target_attribute.' class="podpress_downloadlink podpress_downloadlink_'.$val['type'].'">'.__('Direct Link', 'podpress').'</a>';
						$val['stats'] = false;
					} else {
						$podPressDownloadlinks .= '<a href="'.$val['URI'].'"'.$target_attribute.' class="podpress_downloadlink podpress_downloadlink_'.$val['type'].'">'.__('Download', 'podpress').'</a>';
						if($val['stats'] && $podPressTemplateData['showDownloadStats'] == 'enabled') {
							$podPressDownloadlinks .= ' ('.$val['stats']['total'].')';
							$val['stats'] = false;
						}
					}
					$dividerNeeded = true;
				}

				if($val['stats'] && $podPressTemplateData['showDownloadStats'] == 'enabled') {
					if($dividerNeeded) {
						$podPressDownloadlinks .= $divider;
					}
					$podPressDownloadlinks .= ' <span class="podpress_downloadnr podpress_downloadnr_'.$val['type'].'">'.__('Downloads', 'podpress').' '.$val['stats']['total'].'</span>';
					$dividerNeeded = true;
				}

			}
			
			$podPressDownloadlinks .= '</div>'.$podpress_downloadlinks_section_end;
			$podPressContentAll .= $podPressContent.apply_filters('podpress_downloadlinks', $podPressDownloadlinks);
		}
		if ($podPress->settings['contentAutoDisplayPlayer']) {
			if ( TRUE === defined('PODPRESS_ADD_CDATA_SECTION_TO_POSTSCRIPT') AND TRUE === constant('PODPRESS_ADD_CDATA_SECTION_TO_POSTSCRIPT') ) {
				$cdata_section_begin = '/* <![CDATA[ */ ';
				$cdata_section_end = ' /* ]]> */';
			} else {
				$cdata_section_begin = '';
				$cdata_section_end = '';
			}
			$podPressPlayBlockScripts = apply_filters('podpress_post_scriptblock', '<script type="text/javascript">' . $cdata_section_begin . $podPressPlayBlockScripts . $cdata_section_end . '</script>');
		}
		
		return apply_filters('podpress_post_content', $podpress_section_begin.'<div class="podPress_content podPress_content_'.$val['type'].'">'.$podPressContentAll.'</div>'."\n".$podPressPlayBlockScripts.$podpress_section_end);
	}
}

if (!function_exists('podPress_defaultTitles')) {
	function podPress_defaultTitles($filetype) {
		switch($filetype) {
			case 'audio_mp3':
			case 'audio_ogg':
				return __('Standard Podcast', 'podpress');
				break;
			case 'audio_m4a':
			case 'audio_mp4':
				return __('Enhanced Podcast', 'podpress');
				break;
			case 'audio_m3u':
				return __('Streaming Audio', 'podpress');
				break;
			case 'video_m4v':
				return __('Podcast Video', 'podpress');
				break;
			case 'video_mp4':
			case 'video_mov':
			case 'video_qt':
				return __('Podcast Video', 'podpress');
				break;
			case 'video_ogv':
			case 'video_avi':
			case 'video_mpg':
			case 'video_asf':
			case 'video_wmv':
				return __('Online Video', 'podpress');
				break;
			case 'audio_wma':
				return __('Online Audio', 'podpress');
				break;
			case 'video_swf':
				return __('Flash Content', 'podpress');
				break;
			case 'video_flv':
				return __('Flash Video', 'podpress');
				break;
			case 'embed_youtube':
				return  __('YouTube', 'podpress');
				break;
			case 'ebook_pdf':
			case 'ebook_epub':
				return  __('eBook', 'podpress');
				break;
			case 'misc_torrent':
				return __('Torrent File', 'podpress');
			case 'misc_other':
			default:
				return  __('Other Media', 'podpress');
		}
	}
}
?>
Back to Top