Version Description
New widget to display a user's latest track. New "user" argument for the shortcode to display user's latest track.
Download this release
Release Info
Developer | realTM |
Plugin | SoundCloud Is Gold |
Version | 2.1 |
Comparing to | |
See all releases |
Code changes from version 2.0 to 2.1
- readme.txt +22 -10
- soundcloud-is-gold-functions.php +194 -4
- soundcloud-is-gold-js.js +6 -4
- soundcloud-is-gold.php +12 -9
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: http://www.mightymess.com/soundcloud-is-gold-wordpress-plugin
|
|
4 |
Tags: soundcloud, integrated, media, shortcode, browse, design, easy, simple, music, sound, js, live preview, flash, html5
|
5 |
Requires at least: 3.2
|
6 |
Tested up to: 3.3.1
|
7 |
-
Stable tag: 2.
|
8 |
|
9 |
Browse through your soundcloud tracks, sets and favourites. Select and add tracks, sets or favourites to your posts. Live preview, easy.
|
10 |
|
@@ -12,6 +12,8 @@ Browse through your soundcloud tracks, sets and favourites. Select and add track
|
|
12 |
|
13 |
**Now with soundcloud's official html5 player!**
|
14 |
|
|
|
|
|
15 |
**Soundcloud is Gold** integrates perfectly into wordpress. Browse through your soundcloud tracks, sets and favorites from the 'Soundcloud is gold' tab in the post's 'upload media' popup window. Select, set and add track, sets, favorites to your post using the soundcloud player. Live Preview, easy, smart and straightforward.
|
16 |
You can set default settings in the option page, choose your defaut soundcloud player (Mini, Standard, Artwork, Html5), it's width, add extra classes for you CSS lovers, show comments, autoplay and your favorite color.
|
17 |
You'll also be able to set players to different settings before adding to your post if you fancy a one off change.
|
@@ -20,10 +22,12 @@ You'll also be able to set players to different settings before adding to your p
|
|
20 |
|
21 |
**Soundcloud is Gold** use a shortcode but the "Soundcloud is Gold" tab will write it for you dynamicly as you select parameters, and on top of this it will provide a nice live preview of your player so you know what does what. When done just press the 'insert soundcloud player' and it will added to your post just like when you're adding a photo or gallery.
|
22 |
|
23 |
-
|
24 |
|
25 |
Latest developments updates on twitter: [#soundcloudisgold](https://twitter.com/#!/search/realtime/%23soundcloudisgold) or follow me on [twitter](http://twitter.com/#!/mighty_mess)
|
26 |
|
|
|
|
|
27 |
= Features =
|
28 |
|
29 |
* Browse through your soundcloud tracks, sets and favorites from a tab in the media upload window (see screenshot), no need to go back and forth between soundcloud and your website.
|
@@ -42,6 +46,7 @@ Latest developments updates on twitter: [#soundcloudisgold](https://twitter.com/
|
|
42 |
* Plugin construct shortode for you, no need to remember any syntax.
|
43 |
* Style sortcode for neat layout in your editor.
|
44 |
* Implement Soundcloud Html5 player (beta).
|
|
|
45 |
* Follow WP developpers guidelines (enqueue scripts and styles just for the plugin, clean code, commented, secure and leave no trace when uninstall ).
|
46 |
|
47 |
= Advantages against pasting embed code from soundcloud =
|
@@ -54,12 +59,10 @@ That's just my opinion of course...
|
|
54 |
|
55 |
= To Do List =
|
56 |
|
57 |
-
* v2.
|
58 |
-
* V2.
|
59 |
-
* v2.
|
60 |
-
* v2.
|
61 |
-
* v2.1: other soundcloud shortcode conflict fix (jetpack)
|
62 |
-
* Add Widget
|
63 |
* Add Soundcloud default Width to the options
|
64 |
* Trigger live preview when changing Soundcloud user name
|
65 |
* Live search while typing a name in the user name field. So if you're looking for someone it's kind of easier.
|
@@ -101,10 +104,12 @@ Soundcloud has just released a html5 player. It's currently in it's beta version
|
|
101 |
|
102 |
= How can I use the shortcode manually? =
|
103 |
|
104 |
-
If for some reason you wish to use the shortcode manually, like for
|
105 |
|
106 |
**[soundcloud id='10450254']**
|
107 |
-
|
|
|
|
|
108 |
This will use your default setting of with, classes, colors, autoplay, comments. (Replace *10450254* with the track id you want to show)
|
109 |
|
110 |
If you wish to have more control here is an example:
|
@@ -122,6 +127,9 @@ Sometimes, I generally keep a eye on my plugin's forums and website's comments.
|
|
122 |
|
123 |
== Upgrade Notice ==
|
124 |
|
|
|
|
|
|
|
125 |
= 2.0 =
|
126 |
When updating to 2.0, if you're experiencing issues, deactivate and reactivate the plugin from the plugin page. This is due to switching to the Settings API. Sorry for the inconvenient.
|
127 |
|
@@ -138,6 +146,10 @@ When updating to 2.0, if you're experiencing issues, deactivate and reactivate t
|
|
138 |
|
139 |
== Changelog ==
|
140 |
|
|
|
|
|
|
|
|
|
141 |
= 2.0 =
|
142 |
* Save multiple users, very useful for labels, collectives or artists with many projects.
|
143 |
* favourites browsing fix.
|
4 |
Tags: soundcloud, integrated, media, shortcode, browse, design, easy, simple, music, sound, js, live preview, flash, html5
|
5 |
Requires at least: 3.2
|
6 |
Tested up to: 3.3.1
|
7 |
+
Stable tag: 2.1
|
8 |
|
9 |
Browse through your soundcloud tracks, sets and favourites. Select and add tracks, sets or favourites to your posts. Live preview, easy.
|
10 |
|
12 |
|
13 |
**Now with soundcloud's official html5 player!**
|
14 |
|
15 |
+
**New Widget to display latest track**
|
16 |
+
|
17 |
**Soundcloud is Gold** integrates perfectly into wordpress. Browse through your soundcloud tracks, sets and favorites from the 'Soundcloud is gold' tab in the post's 'upload media' popup window. Select, set and add track, sets, favorites to your post using the soundcloud player. Live Preview, easy, smart and straightforward.
|
18 |
You can set default settings in the option page, choose your defaut soundcloud player (Mini, Standard, Artwork, Html5), it's width, add extra classes for you CSS lovers, show comments, autoplay and your favorite color.
|
19 |
You'll also be able to set players to different settings before adding to your post if you fancy a one off change.
|
22 |
|
23 |
**Soundcloud is Gold** use a shortcode but the "Soundcloud is Gold" tab will write it for you dynamicly as you select parameters, and on top of this it will provide a nice live preview of your player so you know what does what. When done just press the 'insert soundcloud player' and it will added to your post just like when you're adding a photo or gallery.
|
24 |
|
25 |
+
If you love it please rate it! If you use it and want to help, [donations are always welcomed](http://www.mightymess.com/soundcloud-is-gold-wordpress-plugin) or you could like, tweet or spread the love on your blog ;)
|
26 |
|
27 |
Latest developments updates on twitter: [#soundcloudisgold](https://twitter.com/#!/search/realtime/%23soundcloudisgold) or follow me on [twitter](http://twitter.com/#!/mighty_mess)
|
28 |
|
29 |
+
Check out my [TM soundcloud profile](http://www.soundcloud.com/t-m), more [mighty mess](http://www.mightymess.com).
|
30 |
+
|
31 |
= Features =
|
32 |
|
33 |
* Browse through your soundcloud tracks, sets and favorites from a tab in the media upload window (see screenshot), no need to go back and forth between soundcloud and your website.
|
46 |
* Plugin construct shortode for you, no need to remember any syntax.
|
47 |
* Style sortcode for neat layout in your editor.
|
48 |
* Implement Soundcloud Html5 player (beta).
|
49 |
+
* Widget for showing your latest track in the sidebar.
|
50 |
* Follow WP developpers guidelines (enqueue scripts and styles just for the plugin, clean code, commented, secure and leave no trace when uninstall ).
|
51 |
|
52 |
= Advantages against pasting embed code from soundcloud =
|
59 |
|
60 |
= To Do List =
|
61 |
|
62 |
+
* v2.2: new UI.
|
63 |
+
* V2.2: Advance Settings (change background color and comments color, playcounts, buy link, font, wmode, etc, show/hide styled shortcode, number of tracks per page)
|
64 |
+
* v2.2: url attribute for shortcode: easier for people using the shortcode manually.
|
65 |
+
* v2.2: other soundcloud shortcode conflict fix (jetpack)
|
|
|
|
|
66 |
* Add Soundcloud default Width to the options
|
67 |
* Trigger live preview when changing Soundcloud user name
|
68 |
* Live search while typing a name in the user name field. So if you're looking for someone it's kind of easier.
|
104 |
|
105 |
= How can I use the shortcode manually? =
|
106 |
|
107 |
+
If for some reason you wish to use the shortcode manually, like for a special template with the do_shortcode() function:
|
108 |
|
109 |
**[soundcloud id='10450254']**
|
110 |
+
or
|
111 |
+
**[soundcloud user='t-m']** to always display the latest track
|
112 |
+
|
113 |
This will use your default setting of with, classes, colors, autoplay, comments. (Replace *10450254* with the track id you want to show)
|
114 |
|
115 |
If you wish to have more control here is an example:
|
127 |
|
128 |
== Upgrade Notice ==
|
129 |
|
130 |
+
= 2.1 =
|
131 |
+
New widget to display a user's latest track. New "user" argument for the shortcode to display user's latest track.
|
132 |
+
|
133 |
= 2.0 =
|
134 |
When updating to 2.0, if you're experiencing issues, deactivate and reactivate the plugin from the plugin page. This is due to switching to the Settings API. Sorry for the inconvenient.
|
135 |
|
146 |
|
147 |
== Changelog ==
|
148 |
|
149 |
+
= 2.1 =
|
150 |
+
* Widget to display a user's latest track in the sidebar
|
151 |
+
* New "user" argument for the shortcode to show latest track of an user
|
152 |
+
|
153 |
= 2.0 =
|
154 |
* Save multiple users, very useful for labels, collectives or artists with many projects.
|
155 |
* favourites browsing fix.
|
soundcloud-is-gold-functions.php
CHANGED
@@ -108,6 +108,26 @@ function get_soundcloud_is_gold_username_interface($options, $soundcloudIsGoldUs
|
|
108 |
<?php
|
109 |
}
|
110 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
111 |
function get_soundcloud_is_gold_api_response($soundcloudIsGoldApiCall){
|
112 |
//Set Error default message && default XML state
|
113 |
$soundcloudIsGoldRespError = false;
|
@@ -460,6 +480,7 @@ function soundcloud_is_gold_shortcode($atts){
|
|
460 |
//Only use lowercase as atts!
|
461 |
extract( shortcode_atts( array(
|
462 |
'id' => '1',
|
|
|
463 |
'autoplay' => ((!isset($soundcloudIsGoldSettings[0]) || $soundcloudIsGoldSettings[0] == '') ? 'false' : 'true'),
|
464 |
'comments' => ((!isset($soundcloudIsGoldSettings[1]) || $soundcloudIsGoldSettings[1] == '') ? 'false' : 'true'),
|
465 |
'artwork' => ((!isset($soundcloudIsGoldSettings[2]) || $soundcloudIsGoldSettings[2] == '') ? 'false' : 'true'),
|
@@ -470,7 +491,7 @@ function soundcloud_is_gold_shortcode($atts){
|
|
470 |
'format' => 'tracks'
|
471 |
), $atts )
|
472 |
);
|
473 |
-
return soundcloud_is_gold_player($id, $autoplay, $comments, $width, $classes, $playertype, $color, $artwork, $format);
|
474 |
}
|
475 |
|
476 |
|
@@ -483,7 +504,7 @@ function soundcloud_is_gold_shortcode($atts){
|
|
483 |
|
484 |
|
485 |
/** The Player **/
|
486 |
-
function soundcloud_is_gold_player($id, $autoPlay, $comments, $width, $classes, $playerTypes, $color, $artwork, $format){
|
487 |
$options = get_option('soundcloud_is_gold_options');
|
488 |
$soundcloudIsGoldSettings = isset($options['soundcloud_is_gold_settings']) ? $options['soundcloud_is_gold_settings'] : '';
|
489 |
$soundcloudIsGoldPlayerType = isset($options['soundcloud_is_gold_playerType']) ? $options['soundcloud_is_gold_playerType'] : '';
|
@@ -505,6 +526,13 @@ function soundcloud_is_gold_player($id, $autoPlay, $comments, $width, $classes,
|
|
505 |
|
506 |
$color = str_replace('#', '', $color);
|
507 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
508 |
switch($playerTypes){
|
509 |
case 'Standard':
|
510 |
$height = ($format == 'tracks') ? '81px' : '165px';
|
@@ -524,7 +552,7 @@ function soundcloud_is_gold_player($id, $autoPlay, $comments, $width, $classes,
|
|
524 |
break;
|
525 |
}
|
526 |
|
527 |
-
$player = '<div class="soundcloudIsGold '.$classes.'" id="soundcloud-'.$id.'">';
|
528 |
|
529 |
//Flash Player
|
530 |
if(!$html5Player){
|
@@ -554,7 +582,7 @@ function soundcloud_is_gold_player($id, $autoPlay, $comments, $width, $classes,
|
|
554 |
/** Preview **/
|
555 |
add_action('wp_ajax_soundcloud_is_gold_player_preview', 'soundcloud_is_gold_player_preview');
|
556 |
function soundcloud_is_gold_player_preview(){
|
557 |
-
if(isset($_POST['request'])) echo soundcloud_is_gold_player($_POST['ID'], $_POST['autoPlay'], $_POST['comments'], $_POST['width'], $_POST['classes'], $_POST['playerType'], $_POST['color'], $_POST['artwork'], $_POST['format']);
|
558 |
die;
|
559 |
}
|
560 |
/** viewer Ajax **/
|
@@ -645,4 +673,166 @@ function soundcloud_is_gold_delete_user(){
|
|
645 |
echo $message;
|
646 |
die;
|
647 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
648 |
?>
|
108 |
<?php
|
109 |
}
|
110 |
|
111 |
+
/**
|
112 |
+
* Get User's Latest track
|
113 |
+
* $soundcloudIsGoldApiCall: API request (url)
|
114 |
+
**/
|
115 |
+
function get_soundcloud_is_gold_latest_track_id($soundcloudIsGoldUser){
|
116 |
+
$soundcouldMMId = "";
|
117 |
+
$soundcloudIsGoldApiCall = 'http://api.soundcloud.com/users/'.$soundcloudIsGoldUser.'/tracks.xml?limit=1&client_id=9rD2GrGrajkmkw5eYFDp2g';
|
118 |
+
$soundcloudIsGoldApiResponse = get_soundcloud_is_gold_api_response($soundcloudIsGoldApiCall);
|
119 |
+
if(isset($soundcloudIsGoldApiResponse['response']) && $soundcloudIsGoldApiResponse['response']){
|
120 |
+
foreach($soundcloudIsGoldApiResponse['response'] as $soundcloudMMLatestTrack){
|
121 |
+
$soundcouldMMId = (string)$soundcloudMMLatestTrack->id;
|
122 |
+
}
|
123 |
+
}
|
124 |
+
return $soundcouldMMId;
|
125 |
+
}
|
126 |
+
|
127 |
+
/**
|
128 |
+
* Get Soundcloud API Response
|
129 |
+
* $soundcloudIsGoldApiCall: API request (url)
|
130 |
+
**/
|
131 |
function get_soundcloud_is_gold_api_response($soundcloudIsGoldApiCall){
|
132 |
//Set Error default message && default XML state
|
133 |
$soundcloudIsGoldRespError = false;
|
480 |
//Only use lowercase as atts!
|
481 |
extract( shortcode_atts( array(
|
482 |
'id' => '1',
|
483 |
+
'user' => 'null',
|
484 |
'autoplay' => ((!isset($soundcloudIsGoldSettings[0]) || $soundcloudIsGoldSettings[0] == '') ? 'false' : 'true'),
|
485 |
'comments' => ((!isset($soundcloudIsGoldSettings[1]) || $soundcloudIsGoldSettings[1] == '') ? 'false' : 'true'),
|
486 |
'artwork' => ((!isset($soundcloudIsGoldSettings[2]) || $soundcloudIsGoldSettings[2] == '') ? 'false' : 'true'),
|
491 |
'format' => 'tracks'
|
492 |
), $atts )
|
493 |
);
|
494 |
+
return soundcloud_is_gold_player($id, $user, $autoplay, $comments, $width, $classes, $playertype, $color, $artwork, $format);
|
495 |
}
|
496 |
|
497 |
|
504 |
|
505 |
|
506 |
/** The Player **/
|
507 |
+
function soundcloud_is_gold_player($id, $user, $autoPlay, $comments, $width, $classes, $playerTypes, $color, $artwork, $format){
|
508 |
$options = get_option('soundcloud_is_gold_options');
|
509 |
$soundcloudIsGoldSettings = isset($options['soundcloud_is_gold_settings']) ? $options['soundcloud_is_gold_settings'] : '';
|
510 |
$soundcloudIsGoldPlayerType = isset($options['soundcloud_is_gold_playerType']) ? $options['soundcloud_is_gold_playerType'] : '';
|
526 |
|
527 |
$color = str_replace('#', '', $color);
|
528 |
|
529 |
+
//In case of requesting latest track
|
530 |
+
if(isset($user) && $user != "null"){
|
531 |
+
$returnedId = get_soundcloud_is_gold_latest_track_id($user);
|
532 |
+
if($returnedId != "") $id = $returnedId;
|
533 |
+
}
|
534 |
+
|
535 |
+
//Player types sizes
|
536 |
switch($playerTypes){
|
537 |
case 'Standard':
|
538 |
$height = ($format == 'tracks') ? '81px' : '165px';
|
552 |
break;
|
553 |
}
|
554 |
|
555 |
+
$player = '<div class="soundcloudIsGold '.$classes.' '.$user.'" id="soundcloud-'.$id.'">';
|
556 |
|
557 |
//Flash Player
|
558 |
if(!$html5Player){
|
582 |
/** Preview **/
|
583 |
add_action('wp_ajax_soundcloud_is_gold_player_preview', 'soundcloud_is_gold_player_preview');
|
584 |
function soundcloud_is_gold_player_preview(){
|
585 |
+
if(isset($_POST['request'])) echo soundcloud_is_gold_player($_POST['ID'], $_POST['user'], $_POST['autoPlay'], $_POST['comments'], $_POST['width'], $_POST['classes'], $_POST['playerType'], $_POST['color'], $_POST['artwork'], $_POST['format']);
|
586 |
die;
|
587 |
}
|
588 |
/** viewer Ajax **/
|
673 |
echo $message;
|
674 |
die;
|
675 |
}
|
676 |
+
|
677 |
+
/*******************************************/
|
678 |
+
/** **/
|
679 |
+
/** WIDGET **/
|
680 |
+
/** **/
|
681 |
+
/*******************************************/
|
682 |
+
// register Soundcloud_Is_Gold_Widget
|
683 |
+
add_action( 'widgets_init', create_function( '', 'register_widget( "soundcloud_is_gold_widget" );' ) );
|
684 |
+
class Soundcloud_Is_Gold_Widget extends WP_Widget {
|
685 |
+
|
686 |
+
/**
|
687 |
+
* Register widget with WordPress.
|
688 |
+
*/
|
689 |
+
public function __construct() {
|
690 |
+
parent::__construct(
|
691 |
+
'soundcloud_is_gold_widget', // Base ID
|
692 |
+
'Soundcloud is Gold', // Name
|
693 |
+
array( 'description' => __( 'Show your Latest Track', 'text_domain' ), ) // Args
|
694 |
+
);
|
695 |
+
}
|
696 |
+
|
697 |
+
/**
|
698 |
+
* Front-end display of widget.
|
699 |
+
*
|
700 |
+
* @see WP_Widget::widget()
|
701 |
+
*
|
702 |
+
* @param array $args Widget arguments.
|
703 |
+
* @param array $instance Saved values from database.
|
704 |
+
*/
|
705 |
+
public function widget( $args, $instance ) {
|
706 |
+
extract( $args );
|
707 |
+
$title = apply_filters( 'widget_title', $instance['title'] );
|
708 |
+
$user = $instance['user'];
|
709 |
+
$playertype = $instance['playertype'];
|
710 |
+
$autoplay = $instance['autoplay'] ? 'true' : 'false';
|
711 |
+
$comments = $instance['comments'] ? 'true' : 'false';
|
712 |
+
$artwork = $instance['artwork'] ? 'true' : 'false';
|
713 |
+
$classes = $instance['classes'];
|
714 |
+
$widthType = $instance['type'];
|
715 |
+
$wp = $instance['wp'];
|
716 |
+
$custom = $instance['custom'];
|
717 |
+
$width = ($widthType == 'wp') ? $wp : $custom;
|
718 |
+
|
719 |
+
echo $before_widget;
|
720 |
+
if ( ! empty( $title ) ) echo $before_title . $title . $after_title;
|
721 |
+
echo soundcloud_is_gold_player(NULL, $user, $autoplay, $comments, $width, $classes, $playertype, NULL, $artwork, NULL);
|
722 |
+
echo $after_widget;
|
723 |
+
}
|
724 |
+
|
725 |
+
/**
|
726 |
+
* Sanitize widget form values as they are saved.
|
727 |
+
*
|
728 |
+
* @see WP_Widget::update()
|
729 |
+
*
|
730 |
+
* @param array $new_instance Values just sent to be saved.
|
731 |
+
* @param array $old_instance Previously saved values from database.
|
732 |
+
*
|
733 |
+
* @return array Updated safe values to be saved.
|
734 |
+
*/
|
735 |
+
public function update( $new_instance, $old_instance ) {
|
736 |
+
$instance = array();
|
737 |
+
$instance['title'] = strip_tags( $new_instance['title'] );
|
738 |
+
$instance['user'] = strip_tags( $new_instance['user'] );
|
739 |
+
$instance['playertype'] = strip_tags( $new_instance['playertype'] );
|
740 |
+
$instance['autoplay'] = strip_tags( $new_instance['autoplay'] );
|
741 |
+
$instance['comments'] = strip_tags( $new_instance['comments'] );
|
742 |
+
$instance['artwork'] = strip_tags( $new_instance['artwork'] );
|
743 |
+
$instance['classes'] = strip_tags( $new_instance['classes'] );
|
744 |
+
$instance['type'] = strip_tags( $new_instance['type'] );
|
745 |
+
$instance['wp'] = strip_tags( $new_instance['wp'] );
|
746 |
+
$instance['custom'] = strip_tags( $new_instance['custom'] );
|
747 |
+
|
748 |
+
return $instance;
|
749 |
+
}
|
750 |
+
|
751 |
+
/**
|
752 |
+
* Back-end widget form.
|
753 |
+
*
|
754 |
+
* @see WP_Widget::form()
|
755 |
+
*
|
756 |
+
* @param array $instance Previously saved values from database.
|
757 |
+
*/
|
758 |
+
public function form( $instance ) {
|
759 |
+
if ( isset( $instance[ 'title' ] ) ) {
|
760 |
+
$title = $instance[ 'title' ];
|
761 |
+
}
|
762 |
+
else {
|
763 |
+
$title = __( 'Latest', 'text_domain' );
|
764 |
+
}
|
765 |
+
?>
|
766 |
+
<!-- Title -->
|
767 |
+
<p>
|
768 |
+
<label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?></label>
|
769 |
+
<input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />
|
770 |
+
</p>
|
771 |
+
<!-- Users -->
|
772 |
+
<p>
|
773 |
+
<label for="<?php echo $this->get_field_id('user'); ?>"><?php _e( 'Username:' ); ?></label>
|
774 |
+
<select name="<?php echo $this->get_field_name('user'); ?>" id="<?php echo $this->get_field_id('user'); ?>" class="widefat">
|
775 |
+
<?php
|
776 |
+
$options = get_option('soundcloud_is_gold_options');
|
777 |
+
foreach($options['soundcloud_is_gold_users'] as $user) : ?>
|
778 |
+
<option value="<?php echo $user[0] ?>"<?php selected( $instance['user'], $user[0] ); ?>><?php _e($user[0]); ?></option>
|
779 |
+
<?php endforeach; ?>
|
780 |
+
</select>
|
781 |
+
</p>
|
782 |
+
<!-- Main options -->
|
783 |
+
<?php
|
784 |
+
$autoplay = $instance['autoplay'] ? 'checked="checked"' : '';
|
785 |
+
$comments = $instance['comments'] ? 'checked="checked"' : '';
|
786 |
+
$artwork = $instance['artwork'] ? 'checked="checked"' : '';
|
787 |
+
?>
|
788 |
+
<p>
|
789 |
+
<label for=""><?php _e( 'Settings:' ); ?></label>
|
790 |
+
<br/>
|
791 |
+
<input class="checkbox" type="checkbox" <?php echo $autoplay; ?> id="<?php echo $this->get_field_id('autoplay'); ?>" name="<?php echo $this->get_field_name('autoplay'); ?>" /> <label for="<?php echo $this->get_field_id('autoplay'); ?>"><?php _e('Play Automatically'); ?></label>
|
792 |
+
<br/>
|
793 |
+
<input class="checkbox" type="checkbox" <?php echo $comments; ?> id="<?php echo $this->get_field_id('comments'); ?>" name="<?php echo $this->get_field_name('comments'); ?>" /> <label for="<?php echo $this->get_field_id('comments'); ?>"><?php _e('Show comments <small>(Standard and Artwork player)</small>'); ?></label>
|
794 |
+
<br/>
|
795 |
+
<input class="checkbox" type="checkbox" <?php echo $artwork; ?> id="<?php echo $this->get_field_id('artwork'); ?>" name="<?php echo $this->get_field_name('artwork'); ?>" /> <label for="<?php echo $this->get_field_id('artwork'); ?>"><?php _e('Show Artwork <small>(html5 player)</small>'); ?></label>
|
796 |
+
</p>
|
797 |
+
<!-- Player -->
|
798 |
+
<p>
|
799 |
+
<label for="<?php echo $this->get_field_id('playertype'); ?>"><?php _e( 'Player Type:' ); ?></label>
|
800 |
+
<select name="<?php echo $this->get_field_name('playertype'); ?>" id="<?php echo $this->get_field_id('playertype'); ?>" class="widefat">
|
801 |
+
<?php
|
802 |
+
$playertypes = array("Mini", "Standard", "Artwork", "html5");
|
803 |
+
foreach($playertypes as $playertype) : ?>
|
804 |
+
<option value="<?php echo $playertype ?>"<?php selected( $instance['playertype'], $playertype ); ?>><?php _e($playertype); ?></option>
|
805 |
+
<?php endforeach; ?>
|
806 |
+
</select>
|
807 |
+
</p>
|
808 |
+
<!-- Width -->
|
809 |
+
<?php
|
810 |
+
|
811 |
+
?>
|
812 |
+
<p>
|
813 |
+
<label for=""><?php _e( 'Width:' ); ?></label>
|
814 |
+
<p>
|
815 |
+
<input type="radio" <?php checked( $instance['type'], "wp" ); ?> value="wp" id="wp" name="<?php echo $this->get_field_name('type'); ?>" /><label for="wp">Media Width</label>
|
816 |
+
<br/>
|
817 |
+
<select name="<?php echo $this->get_field_name('wp'); ?>" id="<?php echo $this->get_field_id('wp'); ?>" class="widefat">
|
818 |
+
<?php foreach(get_soundcloud_is_gold_wordpress_sizes() as $key => $soundcloudIsGoldMediaSize) : ?>
|
819 |
+
<option value="<?php echo $soundcloudIsGoldMediaSize[0]?>" <?php selected( $instance['wp'], $soundcloudIsGoldMediaSize[0] ); ?>><?php _e($key.': '.$soundcloudIsGoldMediaSize[0]); ?></option>
|
820 |
+
<?php endforeach; ?>
|
821 |
+
</select>
|
822 |
+
</p>
|
823 |
+
<p>
|
824 |
+
<input type="radio" <?php checked( $instance['type'], "custom" ); ?> value="custom" id="custom" name="<?php echo $this->get_field_name('type'); ?>" /><label for="custom">Custom Width</label>
|
825 |
+
<br/>
|
826 |
+
<input type="text" value="<?php echo $instance['custom'] ? $instance['custom'] : "100%" ?>" id="<?php echo $this->get_field_id('custom'); ?>" name="<?php echo $this->get_field_name('custom'); ?>"/>
|
827 |
+
</p>
|
828 |
+
</p>
|
829 |
+
<!-- Classes -->
|
830 |
+
<p>
|
831 |
+
<label for="<?php echo $this->get_field_id('classes'); ?>"><?php _e( 'Classes <small>(no commas)</small>:' ); ?></label>
|
832 |
+
<input type="text" value="<?php echo $instance['classes'] ?>" id="<?php echo $this->get_field_id('classes'); ?>" name="<?php echo $this->get_field_name('classes'); ?>"/>
|
833 |
+
</p>
|
834 |
+
<?php
|
835 |
+
}
|
836 |
+
|
837 |
+
} // class Foo_Widget
|
838 |
?>
|
soundcloud-is-gold-js.js
CHANGED
@@ -211,13 +211,14 @@ jQuery(document).ready(function($){
|
|
211 |
});
|
212 |
//Color
|
213 |
color = $('.soundcloudMMColor', parent).val();
|
|
|
214 |
//Format
|
215 |
if($('.soundcloudMMWrapper').hasClass('sets')) format = 'sets';
|
216 |
else format = 'tracks';
|
217 |
//Set Shortocode Attributes
|
218 |
if(!parent.hasClass('soundcloudMMOptions')) shortcode(parent, autoPlay, comments, width, classes, playerType, color, artwork, format);
|
219 |
-
//Refresh Preview if
|
220 |
-
if(refresh) preview(parent, autoPlay, comments, width, classes, playerType, color, artwork, format);
|
221 |
|
222 |
};
|
223 |
|
@@ -260,7 +261,7 @@ jQuery(document).ready(function($){
|
|
260 |
/********************************************/
|
261 |
/** PREVIEW **/
|
262 |
/********************************************/
|
263 |
-
function preview(parent, autoPlay, comments, width, classes, playerType, color, artwork, format){
|
264 |
//Animate transition
|
265 |
switch(playerType){
|
266 |
case 'Mini':
|
@@ -284,7 +285,8 @@ jQuery(document).ready(function($){
|
|
284 |
action: 'soundcloud_is_gold_player_preview',
|
285 |
request: 'getSoundcloudIsGoldPlayerPreview',
|
286 |
ID: getID($('.soundcloudMMId', parent)),
|
287 |
-
|
|
|
288 |
autoPlay: autoPlay,
|
289 |
artwork: artwork,
|
290 |
width: width,
|
211 |
});
|
212 |
//Color
|
213 |
color = $('.soundcloudMMColor', parent).val();
|
214 |
+
user = $('.soundcloudIsGoldUserContainer div p').text();
|
215 |
//Format
|
216 |
if($('.soundcloudMMWrapper').hasClass('sets')) format = 'sets';
|
217 |
else format = 'tracks';
|
218 |
//Set Shortocode Attributes
|
219 |
if(!parent.hasClass('soundcloudMMOptions')) shortcode(parent, autoPlay, comments, width, classes, playerType, color, artwork, format);
|
220 |
+
//Refresh Preview if requested
|
221 |
+
if(refresh) preview(parent, user, autoPlay, comments, width, classes, playerType, color, artwork, format);
|
222 |
|
223 |
};
|
224 |
|
261 |
/********************************************/
|
262 |
/** PREVIEW **/
|
263 |
/********************************************/
|
264 |
+
function preview(parent, user, autoPlay, comments, width, classes, playerType, color, artwork, format){
|
265 |
//Animate transition
|
266 |
switch(playerType){
|
267 |
case 'Mini':
|
285 |
action: 'soundcloud_is_gold_player_preview',
|
286 |
request: 'getSoundcloudIsGoldPlayerPreview',
|
287 |
ID: getID($('.soundcloudMMId', parent)),
|
288 |
+
user: user,
|
289 |
+
comments: comments,
|
290 |
autoPlay: autoPlay,
|
291 |
artwork: artwork,
|
292 |
width: width,
|
soundcloud-is-gold.php
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
/*
|
3 |
Plugin Name: Soundcloud is Gold
|
4 |
Plugin URI: http://www.mightymess.com/soundcloud-is-gold-wordpress-plugin
|
5 |
-
Description: <strong><a href="http://www.mightymess.com/soundcloud-is-gold-wordpress-plugin">Soundcloud is gold</a></strong> integrates perfectly into wordpress. Browse through your soundcloud tracks, sets and favorites from the 'soundcloud is gold' tab with the post's 'upload media' popup window. Select, set and add track, sets or favorites to your post using the soundcloud player. Live Preview, easy, smart and straightforward. You can set default settings in the option page, choose your defaut soundcloud player (Mini, Standard, Artwork, html5), its width, extra classes for you CSS lovers and your favorite colors. You'll still be able to set players to different settings before adding to your post if you fancy a one off change. Now with Html5 player!
|
6 |
-
Version: 2.
|
7 |
Author: Thomas Michalak at Mighty Mess
|
8 |
Author URI: http://www.mightymess.com/thomas-michalak
|
9 |
License: GPL2 or Later
|
@@ -88,7 +88,11 @@ function soundcloud_is_gold_add_defaults() {
|
|
88 |
$tmp = get_option('soundcloud_is_gold_options');
|
89 |
//First Time install or upgrade from version previous to 1.0.7
|
90 |
if(empty($tmp)) {
|
91 |
-
$soundcloudIsGoldDefaultUsers = array(
|
|
|
|
|
|
|
|
|
92 |
$soundcloudIsGoldDefaultUser = $soundcloudIsGoldDefaultUsers[array_rand($soundcloudIsGoldDefaultUsers, 1)][0];
|
93 |
if(get_option('soundcloud_is_gold_user')){
|
94 |
$soundcloudIsGoldDefaultUser = get_option('soundcloud_is_gold_user');
|
@@ -148,15 +152,14 @@ function soundcloud_is_gold_options(){
|
|
148 |
$soundcloudIsGoldColor = isset($options['soundcloud_is_gold_color']) ? $options['soundcloud_is_gold_color'] : '';
|
149 |
|
150 |
$soundcloudIsGoldApiCall = 'http://api.soundcloud.com/users/'.$soundcloudIsGoldActiveUser.'/tracks.xml?limit=1&client_id=9rD2GrGrajkmkw5eYFDp2g';
|
151 |
-
|
152 |
$soundcloudIsGoldApiResponse = get_soundcloud_is_gold_api_response($soundcloudIsGoldApiCall);
|
153 |
if(isset($soundcloudIsGoldApiResponse['response']) && $soundcloudIsGoldApiResponse['response']){
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
}
|
158 |
}
|
159 |
-
|
|
|
160 |
?>
|
161 |
|
162 |
<script type="text/javascript">
|
2 |
/*
|
3 |
Plugin Name: Soundcloud is Gold
|
4 |
Plugin URI: http://www.mightymess.com/soundcloud-is-gold-wordpress-plugin
|
5 |
+
Description: <strong><a href="http://www.mightymess.com/soundcloud-is-gold-wordpress-plugin">Soundcloud is gold</a></strong> integrates perfectly into wordpress. Browse through your soundcloud tracks, sets and favorites from the 'soundcloud is gold' tab with the post's 'upload media' popup window. Select, set and add track, sets or favorites to your post using the soundcloud player. Live Preview, easy, smart and straightforward. You can set default settings in the option page, choose your defaut soundcloud player (Mini, Standard, Artwork, html5), its width, extra classes for you CSS lovers and your favorite colors. You'll still be able to set players to different settings before adding to your post if you fancy a one off change. Now with Html5 player and Widget!
|
6 |
+
Version: 2.1
|
7 |
Author: Thomas Michalak at Mighty Mess
|
8 |
Author URI: http://www.mightymess.com/thomas-michalak
|
9 |
License: GPL2 or Later
|
88 |
$tmp = get_option('soundcloud_is_gold_options');
|
89 |
//First Time install or upgrade from version previous to 1.0.7
|
90 |
if(empty($tmp)) {
|
91 |
+
$soundcloudIsGoldDefaultUsers = array(
|
92 |
+
'anna-chocola' => array('anna-chocola', 'http://i1.sndcdn.com/avatars-000009470567-spqine-large.jpg?4387aef'),
|
93 |
+
't-m' => array('t-m', 'http://i1.sndcdn.com/avatars-000002680779-fkvvpj-large.jpg?4387aef'),
|
94 |
+
'my-disco-nap' => array('my-disco-nap', 'http://i1.sndcdn.com/avatars-000012680897-foqv41-large.jpg?b9f92e9')
|
95 |
+
);
|
96 |
$soundcloudIsGoldDefaultUser = $soundcloudIsGoldDefaultUsers[array_rand($soundcloudIsGoldDefaultUsers, 1)][0];
|
97 |
if(get_option('soundcloud_is_gold_user')){
|
98 |
$soundcloudIsGoldDefaultUser = get_option('soundcloud_is_gold_user');
|
152 |
$soundcloudIsGoldColor = isset($options['soundcloud_is_gold_color']) ? $options['soundcloud_is_gold_color'] : '';
|
153 |
|
154 |
$soundcloudIsGoldApiCall = 'http://api.soundcloud.com/users/'.$soundcloudIsGoldActiveUser.'/tracks.xml?limit=1&client_id=9rD2GrGrajkmkw5eYFDp2g';
|
|
|
155 |
$soundcloudIsGoldApiResponse = get_soundcloud_is_gold_api_response($soundcloudIsGoldApiCall);
|
156 |
if(isset($soundcloudIsGoldApiResponse['response']) && $soundcloudIsGoldApiResponse['response']){
|
157 |
+
foreach($soundcloudIsGoldApiResponse['response'] as $soundcloudMMLatestTrack){
|
158 |
+
$soundcouldMMId = (string)$soundcloudMMLatestTrack->id;
|
159 |
+
}
|
|
|
160 |
}
|
161 |
+
$soundcouldMMShortcode = '[soundcloud id='.$soundcouldMMId.']';
|
162 |
+
|
163 |
?>
|
164 |
|
165 |
<script type="text/javascript">
|