Beispiel #1
0
     echo '</article>';
     break;
 case 'Modern-Blog':
     print_item_size(find_xml_value($item_xml, 'size'), 'mbtm');
     print_blog_modern_item($item_xml);
     echo '</article>';
     break;
 case 'Sidebar':
     print_item_size(find_xml_value($item_xml, 'size'), 'mbtm');
     print_sidebar_item($item_xml);
     echo '</article>';
     break;
 case 'Pastors':
     print_item_size(find_xml_value($item_xml, 'size'), 'pastors fadeIn cp_load mbtm');
     if (class_exists('cp_album_class')) {
         $cp_album_class = new cp_album_class();
         $cp_album_class->print_pastor_item_item($item_xml);
     }
     echo '</article>';
     break;
 case 'News':
     print_item_size(find_xml_value($item_xml, 'size'), 'mbtm latest-news-cp');
     print_news_item($item_xml);
     echo '</article>';
     break;
 case 'Our-Team':
     print_item_size(find_xml_value($item_xml, 'size'), 'fadeIn cp_load mbtm our-team-cp');
     if (class_exists('cp_team_class')) {
         $cp_team_class = new cp_team_class();
         $cp_team_class->print_team_item($item_xml);
     }
    function widget($args, $instance)
    {
        extract($args, EXTR_SKIP);
        $title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']);
        $wid_class = empty($instance['wid_class']) ? ' ' : apply_filters('widget_title', $instance['wid_class']);
        $album_select_feature = isset($instance['album_select_feature']) ? esc_attr($instance['album_select_feature']) : '';
        $album_select = isset($instance['album_select']) ? esc_attr($instance['album_select']) : '';
        $number_of_tracks = isset($instance['number_of_tracks']) ? esc_attr($instance['number_of_tracks']) : '';
        echo $before_widget;
        // WIDGET display CODE Start
        wp_reset_query();
        //Empty Check for Album Category
        $category_term = '';
        if (!empty($album_select)) {
            $category_term = get_term_by('id', $album_select, 'album-category');
            if (!empty($category_term)) {
                $album_select = $category_term->slug;
            } else {
                $album_select = '';
            }
        }
        //start leftside
        echo '<div class="left-box">';
        if ($album_select_feature != '786512') {
            $album_id = $album_select_feature;
            //Fetch All Tracks
            $track_name_xml = get_post_meta($album_id, 'track_name_xml', true);
            $track_url_xml = get_post_meta($album_id, 'track_url_xml', true);
            $track_des_xml = get_post_meta($album_id, 'track_des_xml', true);
            $track_down_xml = get_post_meta($album_id, 'track_down_xml', true);
            $cp_album_class = new cp_album_class();
            //Get elements by documentElement
            $track_name_array = $cp_album_class->get_album_all_tracks($track_name_xml);
            $track_url_array = $cp_album_class->get_album_all_tracks($track_url_xml);
            $track_lyrics_array = $cp_album_class->get_album_all_tracks($track_des_xml);
            $track_download_array = $cp_album_class->get_album_all_tracks($track_down_xml);
            ?>
				<div class="video-box"><?php 
            echo get_the_post_thumbnail($album_select_feature, array(1170, 350));
            ?>
					<ul>
						<li><a href="<?php 
            echo get_permalink($album_select_feature);
            ?>
"><strong class="tite"><?php 
            echo get_the_title($album_select_feature);
            ?>
</strong> <strong class="time"><?php 
            echo get_the_date(get_option('date_format'));
            ?>
</strong></a></li>
						<li class="headphone-icon"><span class="font-aw"><i class="icon-music"></i></span><?php 
            echo $track_name_array->length;
            ?>
 <?php 
            _e('Songs', 'crunchpress');
            ?>
</li>
					</ul>
				</div>
			  <?php 
            //Arguments for loop
            query_posts(array('posts_per_page' => $number_of_tracks, 'album-category' => $album_select, 'post_type' => 'albums', 'post_status' => 'publish', 'order' => 'DESC', 'post__not_in' => array($album_select_feature)));
        } else {
            query_posts(array('posts_per_page' => $number_of_tracks, 'album-category' => $album_select, 'post_type' => 'albums', 'post_status' => 'publish', 'order' => 'DESC'));
        }
        echo '<ul class="play-list">';
        $counter_one = 0;
        while (have_posts()) {
            the_post();
            global $post;
            $album_id = $post->ID;
            //Fetch All Tracks
            $track_name_xml = get_post_meta($album_id, 'track_name_xml', true);
            $track_url_xml = get_post_meta($album_id, 'track_url_xml', true);
            $track_des_xml = get_post_meta($album_id, 'track_des_xml', true);
            $track_down_xml = get_post_meta($album_id, 'track_down_xml', true);
            //Get elements by documentElement
            $cp_album_class = new cp_album_class();
            //Get elements by documentElement
            $track_name_array = $cp_album_class->get_album_all_tracks($track_name_xml);
            $track_url_array = $cp_album_class->get_album_all_tracks($track_url_xml);
            $track_lyrics_array = $cp_album_class->get_album_all_tracks($track_des_xml);
            $track_download_array = $cp_album_class->get_album_all_tracks($track_down_xml);
            if ($counter_one % 2 == 0) {
                ?>
					<li class="even">
						<div class="frame"><a href="<?php 
                echo get_permalink();
                ?>
"><?php 
                echo get_the_post_thumbnail($post->ID, array(60, 60));
                ?>
</a></div>
						<div class="text-box-1">
						  <ul>
							<li>
								<a href="<?php 
                echo get_permalink();
                ?>
">
									<h4 class="tite"><?php 
                echo get_the_title();
                ?>
</h4>
									
								</a>
							</li>
							<li class="headphone-icon"><span class="font-aw"><i class="icon-calendar-empty"></i></span><strong class="time"><?php 
                echo __('Release Date', 'crunchpress');
                ?>
   -  <?php 
                echo get_the_date(get_option('date_format'));
                ?>
</strong></li>
							<li class="headphone-icon"><strong class="time"><span class="font-aw"><i class="icon-music"></i></span><?php 
                echo $track_name_array->length;
                ?>
 <?php 
                _e('Songs', 'crunchpress');
                ?>
</strong>
							</li>
						  </ul>
						</div>
					</li>
					<?php 
            } else {
                ?>
					<li class="odd">
						<div class="frame"><a href="<?php 
                echo get_permalink();
                ?>
"><?php 
                echo get_the_post_thumbnail($post->ID, array(60, 60));
                ?>
</a></div>
						<div class="text-box-1">
						  <ul>
							<li>
								<a href="<?php 
                echo get_permalink();
                ?>
">
									<h4 class="tite"><?php 
                echo get_the_title();
                ?>
</h4>
									
								</a>
							</li>
							<li class="headphone-icon"><span class="font-aw"><i class="icon-calendar-empty"></i></span><strong class="time"><?php 
                echo __('Release Date', 'crunchpress');
                ?>
   -  <?php 
                echo get_the_date(get_option('date_format'));
                ?>
</strong></li>
							<li class="headphone-icon"><strong class="time"><span class="font-aw"><i class="icon-music"></i></span><?php 
                echo $track_name_array->length;
                ?>
 <?php 
                _e('Songs', 'crunchpress');
                ?>
</strong>
							</li>
						  </ul>
						</div>
					</li>
					<?php 
            }
            $counter_one++;
            ?>
				<?php 
        }
        ?>
			</ul>
        </div>
		  <?php 
        echo $after_widget;
    }
    function widget($args, $instance)
    {
        extract($args, EXTR_SKIP);
        $title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']);
        $wid_class = empty($instance['wid_class']) ? ' ' : apply_filters('widget_title', $instance['wid_class']);
        $album_select = isset($instance['album_select']) ? esc_attr($instance['album_select']) : '';
        $number_of_tracks = isset($instance['number_of_tracks']) ? esc_attr($instance['number_of_tracks']) : '';
        $cp_track_des = isset($instance['cp_track_des']) ? esc_attr($instance['cp_track_des']) : '';
        echo $before_widget;
        // WIDGET display CODE Start
        if (!empty($title)) {
            //echo $before_title;
            //echo '<div class="heading-bar"><a href="#"><i class="icon-reply pull-left"></i></a><strong class="h-title">';
            //echo $title;
            //echo '</strong></div>';
            //echo $after_title;
            global $wpdb, $post;
        }
        wp_reset_query();
        //JPlayer Scripts
        wp_register_script('cp-jplayer', CP_PATH_URL . '/frontend/js/jquery.jplayer.min.js', false, '1.0', true);
        wp_enqueue_script('cp-jplayer');
        wp_register_script('cp-jplayer-playlist', CP_PATH_URL . '/frontend/js/jplayer.playlist.min.js', false, '1.0', true);
        wp_enqueue_script('cp-jplayer-playlist');
        $cp_album_class = new cp_album_class();
        ?>
		<div class="jp_cp_default">
			<?php 
        //Fetching All Tracks from Database
        $track_name_xml = get_post_meta($album_select, 'track_name_xml', true);
        $track_url_xml = get_post_meta($album_select, 'track_url_xml', true);
        $track_des_xml = get_post_meta($album_select, 'track_des_xml', true);
        $track_down_xml = get_post_meta($album_select, 'track_down_xml', true);
        //Empty Variables
        //$album_download = '';
        $children = '';
        $children_title = '';
        //Track Name
        if ($track_name_xml != '') {
            $ingre_xml = new DOMDocument();
            $ingre_xml->recover = TRUE;
            $ingre_xml->loadXML($track_name_xml);
            $children_name = $ingre_xml->documentElement->childNodes;
        }
        //Track URL
        if ($track_url_xml != '') {
            $ingre_title_xml = new DOMDocument();
            $ingre_title_xml->recover = TRUE;
            $ingre_title_xml->loadXML($track_url_xml);
            $children_title = $ingre_title_xml->documentElement->childNodes;
        }
        //Track Description
        if ($track_des_xml != '') {
            $ingre_des_xml = new DOMDocument();
            $ingre_des_xml->recover = TRUE;
            $ingre_des_xml->loadXML($track_des_xml);
            $children_des = $ingre_des_xml->documentElement->childNodes;
        }
        //Track Download Fetch
        if ($track_down_xml != '') {
            $ingre_down_xml = new DOMDocument();
            $ingre_down_xml->recover = TRUE;
            $ingre_down_xml->loadXML($track_down_xml);
            $children_down = $ingre_down_xml->documentElement->childNodes;
        }
        ?>
		<script>
			jQuery(document).ready(function($) {
				new jPlayerPlaylist({
					jPlayer: "#jquery_jplayer_<?php 
        echo 'radio_' . $album_select;
        ?>
",
					cssSelectorAncestor: "#jp_container_<?php 
        echo 'radio_' . $album_select;
        ?>
"
				}, [                       
					<?php 
        //Combine Loop
        if ($track_name_xml != '' || $track_url_xml != '') {
            $counter_aa = 0;
            $nofields = $ingre_xml->documentElement->childNodes->length;
            if ($number_of_tracks > $nofields) {
                $number_of_tracks = $nofields;
            }
            for ($i = 0; $i < $number_of_tracks; $i++) {
                echo '{';
                $img_url_aa = 'http://www.jplayer.org/video/poster/Big_Buck_Bunny_Trailer_480x270.png';
                echo 'title:"' . $children_name->item($i)->nodeValue . '",';
                echo 'artist:"' . $children_name->item($i)->nodeValue . '",';
                echo 'mp3:"' . $children_title->item($i)->nodeValue . '",';
                echo 'poster:"' . $img_url_aa . '"';
                echo '},';
            }
        }
        ?>
				], {
					playlistOptions: {
						enableRemoveControls: true,
						autoPlay: true
					},
					swfPath: "<?php 
        echo CP_PATH_URL;
        ?>
/frontend/js/Jplayer.swf",
					supplied: "mp3",
					wmode: "window"
				});
			});                                                     
		</script>
			<div class="play-box">
				<div class="frame"><?php 
        echo get_the_post_thumbnail($album_select, array(60, 60));
        ?>
</div>
				<div class="text">
					<strong class="title"><?php 
        echo get_the_title($album_select);
        ?>
</strong>
					<strong class="name"><span><?php 
        _e('By', 'crunchpress');
        ?>
</span> <?php 
        the_author();
        ?>
</strong>					
					<div class="btn-row">
						<?php 
        $cp_album_class = new cp_album_class();
        echo $cp_album_class->getPostLikeLink($album_select);
        ?>
						<div class="btns-row">
							<a href="<?php 
        echo get_permalink($album_select);
        ?>
" class="btn-download"><?php 
        _e('Download', 'crunchpress');
        ?>
<i class="icon-plus-sign"></i></a>						
							<a id="playlist-active" class="btn-playlist"><?php 
        _e('Playlist', 'crunchpress');
        ?>
<i class="icon-plus-sign"></i></a>
						</div>
					</div>
				</div>
				
			</div>
			<div id="jquery_jplayer_<?php 
        echo 'radio_' . $album_select;
        ?>
" class="jp-jplayer"></div>
            <div id="jp_container_<?php 
        echo 'radio_' . $album_select;
        ?>
" class="jp-audio">
              <div class="jp-type-playlist">
                <div class="jp-gui jp-interface">
                  <ul class="jp-controls">
                    <li><a href="javascript:;" class="jp-previous" tabindex="1"><?php 
        _e('previous', 'crunchpress');
        ?>
</a></li>
                    <li><a href="javascript:;" class="jp-play" tabindex="1"><?php 
        _e('play', 'crunchpress');
        ?>
</a></li>
                    <li><a href="javascript:;" class="jp-pause" tabindex="1"><?php 
        _e('pause', 'crunchpress');
        ?>
</a></li>
                    <li><a href="javascript:;" class="jp-next" tabindex="1"><?php 
        _e('next', 'crunchpress');
        ?>
</a></li>
                    <li><a href="javascript:;" class="jp-stop" tabindex="1"><?php 
        _e('stop', 'crunchpress');
        ?>
</a></li>
                    <li><a href="javascript:;" class="jp-mute" tabindex="1" title="mute"><?php 
        _e('mute', 'crunchpress');
        ?>
</a></li>
                    <li><a href="javascript:;" class="jp-unmute" tabindex="1" title="unmute"><?php 
        _e('unmute', 'crunchpress');
        ?>
</a></li>
                    <li><a href="javascript:;" class="jp-volume-max" tabindex="1" title="max volume"><?php 
        _e('max volume', 'crunchpress');
        ?>
</a></li>
                  </ul>
                  <div class="jp-progress">
                    <div class="jp-seek-bar">
                      <div class="jp-play-bar"></div>
                    </div>
                  </div>
                  <div class="jp-volume-bar">
                    <div class="jp-volume-bar-value"></div>
                  </div>
                  <div class="jp-current-time"></div>
                  <div class="jp-duration"></div>
                </div>
                <div class="jp-playlist">
                  <ul>
                    <li></li>
                  </ul>
                </div>
              </div>
            </div>
			<!--Render Bottom HTML Start-->
			<?php 
        if ($cp_track_des != '') {
            echo html_entity_decode($cp_track_des);
        }
        ?>
			<!--Render Bottom HTML End-->
		</div>
	<?php 
        wp_reset_query();
        wp_reset_postdata();
        echo $after_widget;
    }