SoundCloud Is Gold - Version 2.2

Version Description

Widget Update! Display latest and random track, favorites or sets for one user, multiple users or random users. Perfect for labels, collectives, festivals and schizophrenic artists.

Download this release

Release Info

Developer realTM
Plugin Icon wp plugin SoundCloud Is Gold
Version 2.2
Comparing to
See all releases

Code changes from version 2.1 to 2.2

readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: Thomas Michalak
3
  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.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,7 +12,7 @@ Browse through your soundcloud tracks, sets and favourites. Select and add track
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.
@@ -46,7 +46,7 @@ Check out my [TM soundcloud profile](http://www.soundcloud.com/t-m), more [might
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 =
@@ -104,7 +104,7 @@ Soundcloud has just released a html5 player. It's currently in it's beta version
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
@@ -127,6 +127,10 @@ Sometimes, I generally keep a eye on my plugin's forums and website's comments.
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
 
@@ -146,6 +150,12 @@ When updating to 2.0, if you're experiencing issues, deactivate and reactivate t
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
3
  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.4.1
7
+ Stable tag: 2.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
 
13
  **Now with soundcloud's official html5 player!**
14
 
15
+ **New Widget to display latest and random track, favorites or sets for one user, multiple users or random users.**
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.
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 latest and random track, favorites or sets for one user, multiple users or random users.
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 =
104
 
105
  = How can I use the shortcode manually? =
106
 
107
+ If for some reason you wish to use the shortcode manually, like for embeding someone else tracks, you can use:
108
 
109
  **[soundcloud id='10450254']**
110
  or
127
 
128
  == Upgrade Notice ==
129
 
130
+ = 2.2 =
131
+ Widget Update! Display latest and random track, favorites or sets for one user, multiple users or random users.
132
+ Perfect for labels, collectives, festivals and schizophrenic artists.
133
+
134
  = 2.1 =
135
  New widget to display a user's latest track. New "user" argument for the shortcode to display user's latest track.
136
 
150
 
151
  == Changelog ==
152
 
153
+ = 2.2.1 =
154
+ * Security Update, all users must update. Thanks to Samuel Wood for his help.
155
+
156
+ = 2.2 =
157
+ * Widget Update! Display latest and random track, favorites or sets for one user, multiple users or random users.
158
+
159
  = 2.1 =
160
  * Widget to display a user's latest track in the sidebar
161
  * New "user" argument for the shortcode to show latest track of an user
soundcloud-is-gold-functions.php CHANGED
@@ -112,9 +112,12 @@ function get_soundcloud_is_gold_username_interface($options, $soundcloudIsGoldUs
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){
@@ -124,6 +127,32 @@ function get_soundcloud_is_gold_latest_track_id($soundcloudIsGoldUser){
124
  return $soundcouldMMId;
125
  }
126
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
127
  /**
128
  * Get Soundcloud API Response
129
  * $soundcloudIsGoldApiCall: API request (url)
@@ -216,6 +245,25 @@ function soundcloud_is_gold_mce_css($mce_css) {
216
  return $mce_css;
217
  }
218
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
219
  /* Debug */
220
  if(!function_exists('printl')){
221
  function printl($val){
@@ -505,6 +553,12 @@ function soundcloud_is_gold_shortcode($atts){
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'] : '';
@@ -521,17 +575,19 @@ function soundcloud_is_gold_player($id, $user, $autoPlay, $comments, $width, $cl
521
  if(!isset($playerTypes)) $playerTypes = $soundcloudIsGoldPlayerType;
522
  if(!isset($color)) $color = $soundcloudIsGoldColor;
523
  if(!isset($format)) $format = 'tracks';
524
- elseif($format == 'sets' || $format == 'set') $format = 'playlists';
525
  $html5Player = false;
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':
@@ -552,20 +608,20 @@ function soundcloud_is_gold_player($id, $user, $autoPlay, $comments, $width, $cl
552
  break;
553
  }
554
 
555
- $player = '<div class="soundcloudIsGold '.$classes.' '.$user.'" id="soundcloud-'.$id.'">';
556
 
557
  //Flash Player
558
  if(!$html5Player){
559
- $player .= '<object height="'.$height.'" width="'.$width.'">';
560
- $player .= '<param name="movie" value="http://player.soundcloud.com/player.swf?url=http%3A%2F%2Fapi.soundcloud.com%2F'.$format.'%2F'.$id.'&amp;auto_play='.$autoPlay.'&amp;player_type='.$playerType.'&amp;show_comments='.$comments.'&amp;color='.$color.'"></param>';
561
  $player .= '<param name="allowscriptaccess" value="always"></param>';
562
  $player .= '<param name="wmode" value="transparent"></param>';
563
- $player .= '<embed wmode="transparent" allowscriptaccess="always" height="'.$height.'" src="http://player.soundcloud.com/player.swf?url=http%3A%2F%2Fapi.soundcloud.com%2F'.$format.'%2F'.$id.'&amp;auto_play='.$autoPlay.'&amp;player_type='.$playerType.'&amp;show_comments='.$comments.'&amp;color='.$color.'" type="application/x-shockwave-flash" width="'.$width.'"></embed>';
564
  $player .= '</object>';
565
  }
566
  //Html5 Player
567
  else{
568
- $player .= '<iframe width="'.$width.'" height="'.$height.'" scrolling="no" frameborder="no" src="http://w.soundcloud.com/player/?url=http%3A%2F%2Fapi.soundcloud.com%2F'.$format.'%2F'.$id.'&amp;auto_play='.$autoPlay.'&amp;show_artwork='.$artwork.'&amp;color='.$color.'"></iframe>';
569
  }
570
  $player .= '</div>';
571
 
@@ -690,7 +746,7 @@ class Soundcloud_Is_Gold_Widget extends WP_Widget {
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
 
@@ -715,10 +771,48 @@ class Soundcloud_Is_Gold_Widget extends WP_Widget {
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
 
@@ -736,6 +830,9 @@ class Soundcloud_Is_Gold_Widget extends WP_Widget {
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'] );
@@ -777,6 +874,8 @@ class Soundcloud_Is_Gold_Widget extends WP_Widget {
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 -->
@@ -787,6 +886,26 @@ class Soundcloud_Is_Gold_Widget extends WP_Widget {
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/>
112
  * Get User's Latest track
113
  * $soundcloudIsGoldApiCall: API request (url)
114
  **/
115
+ function get_soundcloud_is_gold_latest_track_id($soundcloudIsGoldUser, $format = "tracks"){
116
  $soundcouldMMId = "";
117
  $soundcloudIsGoldApiCall = 'http://api.soundcloud.com/users/'.$soundcloudIsGoldUser.'/tracks.xml?limit=1&client_id=9rD2GrGrajkmkw5eYFDp2g';
118
+ if($format == "sets") $soundcloudIsGoldApiCall = 'http://api.soundcloud.com/users/'.$soundcloudIsGoldUser.'/playlists.xml?limit=1&client_id=9rD2GrGrajkmkw5eYFDp2g';
119
+ if($format == "favorites") $soundcloudIsGoldApiCall = 'http://api.soundcloud.com/users/'.$soundcloudIsGoldUser.'/favorites.xml?limit=1&client_id=9rD2GrGrajkmkw5eYFDp2g';
120
+
121
  $soundcloudIsGoldApiResponse = get_soundcloud_is_gold_api_response($soundcloudIsGoldApiCall);
122
  if(isset($soundcloudIsGoldApiResponse['response']) && $soundcloudIsGoldApiResponse['response']){
123
  foreach($soundcloudIsGoldApiResponse['response'] as $soundcloudMMLatestTrack){
127
  return $soundcouldMMId;
128
  }
129
 
130
+ /**
131
+ * Get User's Latest track
132
+ * $soundcloudIsGoldApiCall: API request (url)
133
+ **/
134
+ function get_soundcloud_is_gold_multiple_tracks_id($soundcloudIsGoldUser, $nbr = 1, $random = false, $format){
135
+ //Get all tracks if random
136
+ $getNbr = $nbr;
137
+ if($random) $getNbr = 50;
138
+ $soundcouldMMIds= array();
139
+
140
+ $soundcloudIsGoldApiCall = 'http://api.soundcloud.com/users/'.$soundcloudIsGoldUser.'/tracks.xml?limit='.$getNbr.'&client_id=9rD2GrGrajkmkw5eYFDp2g';
141
+ if($format == 'sets') $soundcloudIsGoldApiCall = 'http://api.soundcloud.com/users/'.$soundcloudIsGoldUser.'/playlists.xml?limit='.$getNbr.'&client_id=9rD2GrGrajkmkw5eYFDp2g';
142
+ if($format == 'favorites') $soundcloudIsGoldApiCall = 'http://api.soundcloud.com/users/'.$soundcloudIsGoldUser.'/favorites.xml?limit='.$getNbr.'&client_id=9rD2GrGrajkmkw5eYFDp2g';
143
+
144
+
145
+ $soundcloudIsGoldApiResponse = get_soundcloud_is_gold_api_response($soundcloudIsGoldApiCall);
146
+
147
+ if(isset($soundcloudIsGoldApiResponse['response']) && $soundcloudIsGoldApiResponse['response']){
148
+ foreach($soundcloudIsGoldApiResponse['response'] as $soundcloudMMLatestTrack){
149
+ $soundcouldMMIds[] .= (string)$soundcloudMMLatestTrack->id;
150
+ }
151
+ }
152
+ if($random) return array_random($soundcouldMMIds, $nbr);
153
+ return $soundcouldMMIds;
154
+ }
155
+
156
  /**
157
  * Get Soundcloud API Response
158
  * $soundcloudIsGoldApiCall: API request (url)
245
  return $mce_css;
246
  }
247
 
248
+ /* Random Values from Array */
249
+ function array_random($arr, $num = 1) {
250
+ shuffle($arr);
251
+ //check if requested number is bigger than array length
252
+ if(count($arr) < $num){
253
+ $tempArray = $arr;
254
+ $repeat = ceil($num/count($arr));
255
+ for($i=0; $i<$repeat; $i++){
256
+ $arr = array_merge($arr, $tempArray);
257
+ }
258
+ }
259
+ $r = array();
260
+ for ($i = 0; $i < $num; $i++) {
261
+ $r[] = $arr[$i];
262
+ }
263
+ // return $num == 1 ? $r[0] : $r;
264
+ return $r;
265
+ }
266
+
267
  /* Debug */
268
  if(!function_exists('printl')){
269
  function printl($val){
553
 
554
  /** The Player **/
555
  function soundcloud_is_gold_player($id, $user, $autoPlay, $comments, $width, $classes, $playerTypes, $color, $artwork, $format){
556
+ //XSS Protection on data coming from fields
557
+ //$xssProtection = "/^[A-Za-z0-9 \,]{2,15}$/";
558
+ //if (!preg_match($xssProtection, $width)) $width == NULL;
559
+ //if (!preg_match($xssProtection, $classes)) $classes == NULL;
560
+
561
+
562
  $options = get_option('soundcloud_is_gold_options');
563
  $soundcloudIsGoldSettings = isset($options['soundcloud_is_gold_settings']) ? $options['soundcloud_is_gold_settings'] : '';
564
  $soundcloudIsGoldPlayerType = isset($options['soundcloud_is_gold_playerType']) ? $options['soundcloud_is_gold_playerType'] : '';
575
  if(!isset($playerTypes)) $playerTypes = $soundcloudIsGoldPlayerType;
576
  if(!isset($color)) $color = $soundcloudIsGoldColor;
577
  if(!isset($format)) $format = 'tracks';
578
+ if($format == 'sets' || $format == 'set') $format = 'playlists';
579
  $html5Player = false;
580
 
581
  $color = str_replace('#', '', $color);
582
 
583
  //In case of requesting latest track
584
  if(isset($user) && $user != "null"){
585
+ $returnedId = get_soundcloud_is_gold_latest_track_id($user, $format);
586
  if($returnedId != "") $id = $returnedId;
587
  }
588
 
589
+ if($format == 'favorites') $format = "tracks"; //Reset Favorites to tracks as soundcloud treats them as tracks.
590
+
591
  //Player types sizes
592
  switch($playerTypes){
593
  case 'Standard':
608
  break;
609
  }
610
 
611
+ $player = '<div class="soundcloudIsGold '.esc_attr($classes).'" id="soundcloud-'.esc_attr($id).'">';
612
 
613
  //Flash Player
614
  if(!$html5Player){
615
+ $player .= '<object height="'.esc_attr($height).'" width="'.esc_attr($width).'">';
616
+ $player .= '<param name="movie" value="http://player.soundcloud.com/player.swf?url=http%3A%2F%2Fapi.soundcloud.com%2F'.esc_attr($format).'%2F'.$id.'&amp;auto_play='.esc_attr($autoPlay).'&amp;player_type='.esc_attr($playerType).'&amp;show_comments='.esc_attr($comments).'&amp;color='.esc_attr($color).'"></param>';
617
  $player .= '<param name="allowscriptaccess" value="always"></param>';
618
  $player .= '<param name="wmode" value="transparent"></param>';
619
+ $player .= '<embed wmode="transparent" allowscriptaccess="always" height="'.esc_attr($height).'" src="http://player.soundcloud.com/player.swf?url=http%3A%2F%2Fapi.soundcloud.com%2F'.esc_attr($format).'%2F'.esc_attr($id).'&amp;auto_play='.esc_attr($autoPlay).'&amp;player_type='.esc_attr($playerType).'&amp;show_comments='.esc_attr($comments).'&amp;color='.esc_attr($color).'" type="application/x-shockwave-flash" width="'.esc_attr($width).'"></embed>';
620
  $player .= '</object>';
621
  }
622
  //Html5 Player
623
  else{
624
+ $player .= '<iframe width="'.esc_attr($width).'" height="'.esc_attr($height).'" scrolling="no" frameborder="no" src="http://w.soundcloud.com/player/?url=http%3A%2F%2Fapi.soundcloud.com%2F'.esc_attr($format).'%2F'.esc_attr($id).'&amp;auto_play='.esc_attr($autoPlay).'&amp;show_artwork='.esc_attr($artwork).'&amp;color='.esc_attr($color).'"></iframe>';
625
  }
626
  $player .= '</div>';
627
 
746
  parent::__construct(
747
  'soundcloud_is_gold_widget', // Base ID
748
  'Soundcloud is Gold', // Name
749
+ array( 'description' => __( 'Show your Latest Tracks, Favorites or Sets for one or multiple users. If you\'re crasy go random for everything!', 'text_domain' ), ) // Args
750
  );
751
  }
752
 
771
  $wp = $instance['wp'];
772
  $custom = $instance['custom'];
773
  $width = ($widthType == 'wp') ? $wp : $custom;
774
+ $behavior = $instance['behavior'];
775
+ $number = $instance['number'];
776
+ $format = $instance['format'];
777
+
778
+ //Random User
779
+ if($user == "randomUser") {
780
+ $options = get_option('soundcloud_is_gold_options');
781
+ $soundcloudIsGoldUsers = isset($options['soundcloud_is_gold_users']) ? array_random($options['soundcloud_is_gold_users'], 1) : '';
782
+ //printl($soundcloudIsGoldUsers[0][0]);
783
+ if(isset($soundcloudIsGoldUsers)) $user = $soundcloudIsGoldUsers[0][0];
784
+ }
785
 
786
  echo $before_widget;
787
  if ( ! empty( $title ) ) echo $before_title . $title . $after_title;
788
+
789
+ //Random User per Track
790
+ if($user == "randomUsers") {
791
+ $options = get_option('soundcloud_is_gold_options');
792
+ if(isset($options['soundcloud_is_gold_users'])){
793
+ //Never select more tracks than there is users.
794
+ $number = (count($options['soundcloud_is_gold_users']) <= $number) ? count($options['soundcloud_is_gold_users']) : $number;
795
+ $soundcloudIsGoldUsers = array_random($options['soundcloud_is_gold_users'], $number);
796
+ }
797
+ if(isset($soundcloudIsGoldUsers)){
798
+ foreach($soundcloudIsGoldUsers as $userKey=>$user){
799
+ if($userKey == 1) $autoplay = false;
800
+ foreach(get_soundcloud_is_gold_multiple_tracks_id($user[0], 1, ($behavior == "latest") ? FALSE : TRUE, $format) as $key=>$ids){
801
+ if($format == "favorites") $format = "tracks"; //Soundcloud treats Favorites as Tracks for the player.
802
+ echo soundcloud_is_gold_player($ids, NULL, $autoplay, $comments, $width, $classes, $playertype, NULL, $artwork, $format);
803
+ }
804
+ }
805
+ }
806
+ }
807
+ //One User
808
+ else{
809
+ foreach(get_soundcloud_is_gold_multiple_tracks_id($user, $number, ($behavior == "latest") ? FALSE : TRUE, $format) as $key=>$ids){
810
+ if($key == 1) $autoplay = false;
811
+ if($format == "favorites") $format = "tracks"; //Soundcloud treats Favorites as Tracks for the player.
812
+ echo soundcloud_is_gold_player($ids, NULL, $autoplay, $comments, $width, $classes, $playertype, NULL, $artwork, $format);
813
+ }
814
+ }
815
+
816
  echo $after_widget;
817
  }
818
 
830
  $instance = array();
831
  $instance['title'] = strip_tags( $new_instance['title'] );
832
  $instance['user'] = strip_tags( $new_instance['user'] );
833
+ $instance['format'] = strip_tags( $new_instance['format'] );
834
+ $instance['behavior'] = strip_tags( $new_instance['behavior'] );
835
+ $instance['number'] = strip_tags( $new_instance['number'] );
836
  $instance['playertype'] = strip_tags( $new_instance['playertype'] );
837
  $instance['autoplay'] = strip_tags( $new_instance['autoplay'] );
838
  $instance['comments'] = strip_tags( $new_instance['comments'] );
874
  foreach($options['soundcloud_is_gold_users'] as $user) : ?>
875
  <option value="<?php echo $user[0] ?>"<?php selected( $instance['user'], $user[0] ); ?>><?php _e($user[0]); ?></option>
876
  <?php endforeach; ?>
877
+ <option value="randomUser"<?php selected( $instance['user'], "randomUser" ); ?>><?php _e("Pick a Random User"); ?></option>
878
+ <option value="randomUsers"<?php selected( $instance['user'], "randomUsers" ); ?>><?php _e("Pick a Random User per Track"); ?></option>
879
  </select>
880
  </p>
881
  <!-- Main options -->
886
  ?>
887
  <p>
888
  <label for=""><?php _e( 'Settings:' ); ?></label>
889
+ <select name="<?php echo $this->get_field_name('format'); ?>" id="<?php echo $this->get_field_id('format'); ?>" class="widefat">
890
+ <option value="tracks"<?php selected( $instance['format'], "tracks" ); ?>><?php _e("tracks"); ?></option>
891
+ <option value="favorites"<?php selected( $instance['format'], "favorites" ); ?>><?php _e("favorites"); ?></option>
892
+ <option value="sets"<?php selected( $instance['format'], "sets" ); ?>><?php _e("sets"); ?></option>
893
+ </select>
894
+ <br/>
895
+ <br/>
896
+ <select name="<?php echo $this->get_field_name('behavior'); ?>" id="<?php echo $this->get_field_id('behavior'); ?>" class="widefat">
897
+ <option value="latest"<?php selected( $instance['behavior'], "latest" ); ?>><?php _e("Latest"); ?></option>
898
+ <option value="random"<?php selected( $instance['behavior'], "random" ); ?>><?php _e("Random"); ?></option>
899
+ </select>
900
+ <br/>
901
+ <br/>
902
+ <select name="<?php echo $this->get_field_name('number'); ?>" id="<?php echo $this->get_field_id('number'); ?>" class="widefat">
903
+ <?php
904
+ for($i=1; $i<=5; $i++) : ?>
905
+ <option value="<?php echo $i ?>"<?php selected( $instance['number'], $i ); ?>><?php _e($i); ?></option>
906
+ <?php endfor; ?>
907
+ </select>
908
+ <br/>
909
  <br/>
910
  <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>
911
  <br/>
soundcloud-is-gold.php CHANGED
@@ -3,8 +3,8 @@
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
10
  */
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.2
7
+ Author: Thomas Michalak
8
  Author URI: http://www.mightymess.com/thomas-michalak
9
  License: GPL2 or Later
10
  */