function widget($args, $instance) { extract($args, EXTR_SKIP); echo $before_widget; $title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']); if (!empty($title)) { echo $before_title . $title . $after_title; } // WIDGET CODE GOES HERE //initialize request for top downloads on MMS $mca = new mca(); $local_data = new LocalData(); if ($local_data->loc_new_singles == 1) { $songs = $local_data->get_data('loc_song', 'new_single'); $mca->endpoint = 'songs'; $mca->params = $songs . '/20'; $result = $mca->request(); $new_singles = $result->songs; if (count($new_singles) > 0) { foreach ($new_singles as $singles) { $smart_rbt_keyword = ''; $globe_rbt_keyword = ''; $sun_rbt_keyword = ''; $rbt = $local_data->get_all_data('loc_song', 'id', $singles->id); if (count($rbt) > 0) { $smart_rbt_keyword = $rbt[0]['smart_rbt_keyword']; $globe_rbt_keyword = $rbt[0]['globe_rbt_keyword']; $sun_rbt_keyword = $rbt[0]['sun_rbt_keyword']; } ?> <div class="listing-contents"> <div class="list-titles"> <h3><?php echo $singles->title; ?> </h3> <h4><?php echo $singles->artist_name; ?> </h4> </div> <div class="list-options"> <a class="ajax cboxElement listen iframe" href="<?php echo CONFIG_SITE_URL; ?> popups/player.php?play_file=<?php echo urlencode($singles->preview); ?> &artist_image=<?php echo urlencode(str_replace('.', '|', $singles->artist_image)); ?> &song_title=<?php echo urlencode($singles->title); ?> &artist_name=<?php echo urlencode($singles->artist_name); ?> "></a> <a title="Download MP3" target="_blank" href="<?php echo $mca->buy_url . $mca->clean_url($singles->artist_name, true) . '/' . $singles->id . '/' . $mca->clean_url($singles->title) . '.html'; ?> " class="download"></a> <a class="ajax cboxElement ringback-dl iframe" href="<?php echo CONFIG_SITE_URL; ?> popups/rbt.php?&artist_image=<?php echo urlencode(str_replace('.', '|', $singles->artist_image)); ?> &song_title=<?php echo urlencode($singles->title); ?> &artist_name=<?php echo urlencode($singles->artist_name); ?> &rbt_globe=<?php echo $globe_rbt_keyword; ?> &rbt_smart=<?php echo $smart_rbt_keyword; ?> &rbt_sun=<?php echo $sun_rbt_keyword; ?> "></a> </div> <div class="clear"></div> </div> <?php } } } else { $mca->endpoint = 'newsingles'; //limit response data to 20 records $mca->params = '20'; $result = $mca->request(); $new_singles = $result->new_singles; if (count($new_singles) > 0) { foreach ($new_singles as $singles) { $smart_rbt_keyword = ''; $globe_rbt_keyword = ''; $sun_rbt_keyword = ''; $rbt = $local_data->get_all_data('loc_song', 'id', $singles->id); if (count($rbt) > 0) { $smart_rbt_keyword = $rbt[0]['smart_rbt_keyword']; $globe_rbt_keyword = $rbt[0]['globe_rbt_keyword']; $sun_rbt_keyword = $rbt[0]['sun_rbt_keyword']; } ?> <div class="listing-contents"> <div class="list-titles"> <h3><?php echo $singles->song_title; ?> </h3> <h4><?php echo $singles->artist_name; ?> </h4> </div> <div class="list-options"> <a class="ajax cboxElement listen iframe" href="<?php echo CONFIG_SITE_URL; ?> popups/player.php?play_file=<?php echo urlencode($singles->preview); ?> &artist_image=<?php echo urlencode(str_replace('.', '|', $singles->artist_image)); ?> &song_title=<?php echo urlencode($singles->song_title); ?> &artist_name=<?php echo urlencode($singles->artist_name); ?> "></a> <a title="Download MP3" target="_blank" href="<?php echo $mca->buy_url . $mca->clean_url($singles->artist_name, true) . '/' . $singles->song_id . '/' . $mca->clean_url($singles->song_title) . '.html'; ?> " class="download"></a> <a class="ajax cboxElement ringback-dl iframe" href="<?php echo CONFIG_SITE_URL; ?> popups/rbt.php?&artist_image=<?php echo urlencode(str_replace('.', '|', $singles->artist_image)); ?> &song_title=<?php echo urlencode($singles->title); ?> &artist_name=<?php echo urlencode($singles->artist_name); ?> &rbt_globe=<?php echo $globe_rbt_keyword; ?> &rbt_smart=<?php echo $smart_rbt_keyword; ?> &rbt_sun=<?php echo $sun_rbt_keyword; ?> "></a> </div> <div class="clear"></div> </div> <?php } } } echo $after_widget; }
function widget($args, $instance) { extract($args, EXTR_SKIP); echo $before_widget; $title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']); if (!empty($title)) { echo $before_title . $title . $after_title; } // WIDGET CODE GOES HERE //initialize request for top downloads on MMS $mca = new mca(); $local_data = new LocalData(); if ($local_data->loc_top_downloads == 1) { $songs = $local_data->get_data('loc_song', 'top_download'); $mca->endpoint = 'songs'; $mca->params = $songs . '/20'; $result = $mca->request(); $top_downloads = $result->songs; if (count($top_downloads) > 0) { foreach ($top_downloads as $downloads) { ?> <div class="listing-contents"> <div class="list-titles"> <h3><?php echo $downloads->title; ?> </h3> <h4><?php echo $downloads->artist_name; ?> </h4> </div> <div class="list-options"> <a class="ajax cboxElement listen iframe" href="<?php echo CONFIG_SITE_URL; ?> popups/player.php?play_file=<?php echo urlencode($downloads->preview); ?> &artist_image=<?php echo urlencode(str_replace('.', '|', $downloads->artist_image)); ?> &song_title=<?php echo urlencode($downloads->song_title); ?> &artist_name=<?php echo urlencode($downloads->artist_name); ?> "></a> <a href="<?php echo $mca->buy_url . $mca->clean_url($downloads->artist_name, true) . '/' . $downloads->id . '/' . $mca->clean_url($downloads->title) . '.html'; ?> " class="download" target="_blank"></a> </div> <div class="clear"></div> </div> <?php } } } else { $mca->endpoint = 'topdownloads'; //limit response data to 10 records $mca->params = '10'; $result = $mca->request(); $top_downloads = $result->topdownloads; if (count($top_downloads) > 0) { foreach ($top_downloads as $downloads) { ?> <div class="listing-contents"> <div class="list-titles"> <h3><?php echo $downloads->song_title; ?> </h3> <h4><?php echo $downloads->artist_name; ?> </h4> </div> <div class="list-options"> <a class="ajax cboxElement listen iframe" href="<?php echo CONFIG_SITE_URL; ?> popups/player.php?play_file=<?php echo urlencode($downloads->preview); ?> &artist_image=<?php echo urlencode(str_replace('.', '|', $downloads->artist_image)); ?> &song_title=<?php echo urlencode($downloads->song_title); ?> &artist_name=<?php echo urlencode($downloads->artist_name); ?> "></a> <a href="<?php echo $mca->buy_url . $mca->clean_url($downloads->artist_name, true) . '/' . $downloads->song_id . '/' . $mca->clean_url($downloads->song_title) . '.html'; ?> " class="download" target="_blank"></a> </div> <div class="clear"></div> </div> <?php } } } echo $after_widget; }