SoundCloud Is Gold - Version 2.3

Version Description

  • Updated plugin to new Soundcloud API (Json only)
  • Small styling fix
  • Https support (thanks to hiddentao for the fix! https://wordpress.org/support/profile/randomaniac)
Download this release

Release Info

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

Code changes from version 2.2.2 to 2.3

readme.txt CHANGED
@@ -3,14 +3,14 @@ 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.9
7
- Stable tag: 2.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
 
11
  == Description ==
12
 
13
- ** Compatible with new WP 3.9 **
14
 
15
  **Now with soundcloud's official html5 player!**
16
 
@@ -50,6 +50,7 @@ Check out my [TM soundcloud profile](http://www.soundcloud.com/t-m), more [might
50
  * Implement Soundcloud Html5 player (beta).
51
  * Widget for showing latest and random track, favorites or sets for one user, multiple users or random users.
52
  * Follow WP developpers guidelines (enqueue scripts and styles just for the plugin, clean code, commented, secure and leave no trace when uninstall ).
 
53
 
54
  = Advantages against pasting embed code from soundcloud =
55
 
@@ -155,6 +156,14 @@ When updating to 2.0, if you're experiencing issues, deactivate and reactivate t
155
 
156
  == Changelog ==
157
 
 
 
 
 
 
 
 
 
158
  = 2.2.1 =
159
  * Fix bug with tinymce plugin that prevented user from using editot
160
  * Fixing bug mean that the delete and edit button on the soundcloud-is-gold image in the editor have been removed
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: 4.0.1
7
+ Stable tag: 2.3
8
 
9
  Browse through your soundcloud tracks, sets and favourites. Select and add tracks, sets or favourites to your posts. Live preview, easy.
10
 
11
  == Description ==
12
 
13
+ ** Compatible with new WP 4.0.1 **
14
 
15
  **Now with soundcloud's official html5 player!**
16
 
50
  * Implement Soundcloud Html5 player (beta).
51
  * Widget for showing latest and random track, favorites or sets for one user, multiple users or random users.
52
  * Follow WP developpers guidelines (enqueue scripts and styles just for the plugin, clean code, commented, secure and leave no trace when uninstall ).
53
+ * https support
54
 
55
  = Advantages against pasting embed code from soundcloud =
56
 
156
 
157
  == Changelog ==
158
 
159
+ = 2.3 =
160
+ * Updated plugin to new Soundcloud API (Json only)
161
+ * Small styling fix
162
+ * Https support (thanks to hiddentao for the fix! https://wordpress.org/support/profile/randomaniac)
163
+
164
+ = 2.2.2 =
165
+ * Bug fix and improvements
166
+
167
  = 2.2.1 =
168
  * Fix bug with tinymce plugin that prevented user from using editot
169
  * Fixing bug mean that the delete and edit button on the soundcloud-is-gold image in the editor have been removed
soundcloud-is-gold-css.css CHANGED
@@ -401,7 +401,7 @@
401
  #soundcloudIsGoldUsernameCarouselNav {
402
  text-align:center;
403
  padding-top:5px;
404
- background:#FFF;
405
  }
406
  #soundcloudIsGoldUsernameCarouselNav a {
407
  background: url(./images/pag.png) 0 0 no-repeat transparent;
@@ -733,13 +733,13 @@ select.soundcloudMMInput option{
733
  display:none;
734
  }
735
 
736
- /*** ERROR XML ***/
737
- .soundcloudMMXmlError{
738
  background:#EFEFEF;
739
  padding:2%;
740
  width:96%;
741
  }
742
- .soundcloudMMXmlError p{
743
  font-family: QuicksandBook,Verdana;
744
  font-size:130%;
745
  color:#333333;
401
  #soundcloudIsGoldUsernameCarouselNav {
402
  text-align:center;
403
  padding-top:5px;
404
+ background-color: transparent;
405
  }
406
  #soundcloudIsGoldUsernameCarouselNav a {
407
  background: url(./images/pag.png) 0 0 no-repeat transparent;
733
  display:none;
734
  }
735
 
736
+ /*** ERROR Json ***/
737
+ .soundcloudMMJsonError{
738
  background:#EFEFEF;
739
  padding:2%;
740
  width:96%;
741
  }
742
+ .soundcloudMMJsonError p{
743
  font-family: QuicksandBook,Verdana;
744
  font-size:130%;
745
  color:#333333;
soundcloud-is-gold-functions.php CHANGED
@@ -52,11 +52,11 @@ function get_soundcloudIsGoldUserNumber(){
52
  $options = get_option('soundcloud_is_gold_options');
53
  $soundcloudIsGoldActiveUser = isset($options['soundcloud_is_gold_active_user']) ? $options['soundcloud_is_gold_active_user'] : '';
54
 
55
- $soundcloudIsGoldApiCall = 'http://api.soundcloud.com/users/'.$soundcloudIsGoldActiveUser.'.xml?client_id=9rD2GrGrajkmkw5eYFDp2g';
56
  $soundcloudIsGoldApiResponse = get_soundcloud_is_gold_api_response($soundcloudIsGoldApiCall);
57
- $result['tracks'] = ($soundcloudIsGoldApiResponse['response']->{'track-count'} == 0) ? '0' : $soundcloudIsGoldApiResponse['response']->{'track-count'};
58
- $result['sets'] = ($soundcloudIsGoldApiResponse['response']->{'playlist-count'} == 0) ? '0' : $soundcloudIsGoldApiResponse['response']->{'playlist-count'};
59
- $result['favorites'] = ($soundcloudIsGoldApiResponse['response']->{'public-favorites-count'} == 0) ? '0' : $soundcloudIsGoldApiResponse['response']->{'public-favorites-count'};
60
  return $result;
61
  }
62
  function get_soundcloud_is_gold_username_interface($options, $soundcloudIsGoldUsers){
@@ -114,14 +114,14 @@ function get_soundcloud_is_gold_username_interface($options, $soundcloudIsGoldUs
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){
124
- $soundcouldMMId = (string)$soundcloudMMLatestTrack->id;
125
  }
126
  }
127
  return $soundcouldMMId;
@@ -137,27 +137,62 @@ function get_soundcloud_is_gold_multiple_tracks_id($soundcloudIsGoldUser, $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)
159
  **/
160
  function get_soundcloud_is_gold_api_response($soundcloudIsGoldApiCall){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
161
  //Set Error default message && default XML state
162
  $soundcloudIsGoldRespError = false;
163
  $soundcloudIsGoldResp = false;
@@ -331,9 +366,9 @@ function get_soundcloud_is_gold_user_tracks(){
331
 
332
  //API Call
333
  $soundcloudIsGoldSelectedFormat = isset($_REQUEST['selectFormat']) ? $_REQUEST['selectFormat'] : 'tracks';
334
- if($soundcloudIsGoldSelectedFormat == 'tracks') $soundcloudIsGoldApiCall = 'http://api.soundcloud.com/users/'.$soundcloudIsGoldActiveUser.'/tracks.xml?limit='.$soundcloudIsGoldTracksPerPage.'&offset='.$soundcloudIsGoldApiOffset.'&client_id=9rD2GrGrajkmkw5eYFDp2g';
335
- if($soundcloudIsGoldSelectedFormat == 'sets') $soundcloudIsGoldApiCall = 'http://api.soundcloud.com/users/'.$soundcloudIsGoldActiveUser.'/playlists.xml?limit='.$soundcloudIsGoldTracksPerPage.'&offset='.$soundcloudIsGoldApiOffset.'&client_id=9rD2GrGrajkmkw5eYFDp2g';
336
- if($soundcloudIsGoldSelectedFormat == 'favorites') $soundcloudIsGoldApiCall = 'http://api.soundcloud.com/users/'.$soundcloudIsGoldActiveUser.'/favorites.xml?limit='.$soundcloudIsGoldTracksPerPage.'&offset='.$soundcloudIsGoldApiOffset.'&client_id=9rD2GrGrajkmkw5eYFDp2g';
337
  $soundcloudIsGoldApiResponse = get_soundcloud_is_gold_api_response($soundcloudIsGoldApiCall);
338
 
339
  //Pagination and Actions
@@ -381,39 +416,39 @@ function get_soundcloud_is_gold_user_tracks(){
381
  if (isset($soundcloudIsGoldApiResponse['response']) && $soundcloudIsGoldApiResponse['response']) {
382
  foreach($soundcloudIsGoldApiResponse['response'] as $soundcloudIsGoldtrack): ?>
383
 
384
- <div class="media-item preloaded" id="media-item-<?php echo $soundcloudIsGoldtrack->id ?>">
385
- <a href="#" class="toggle describe-toggle-on soundcloud" id="show-<?php echo $soundcloudIsGoldtrack->id ?>">Show</a>
386
  <a href="#" class="toggle describe-toggle-off soundcloudMM">Hide</a>
387
- <div class="filename new"><span class="title soundcloudMMTitle" id="soundcloudMMTitle-<?php echo $soundcloudIsGoldtrack->id ?>"><?php echo $soundcloudIsGoldtrack->title ?></span></div>
388
  <table class="slidetoggle describe startclosed soundcloudMMWrapper soundcloudMMMainWrapper <?php echo $soundcloudIsGoldSelectedFormat ?>">
389
- <thead id="media-head-<?php echo $soundcloudIsGoldtrack->id ?>" class="media-item-info">
390
  <tr valign="top">
391
- <td id="thumbnail-head-<?php echo $soundcloudIsGoldtrack->id ?>" class="A1B1">
392
- <p><a href="<?php echo $soundcloudIsGoldtrack->{'permalink-url'}?>" title="Go to the Soundcloud page" target="_blank"><img id="soundcloudMMThumb-<?php echo $soundcloudIsGoldtrack->id ?>" style="margin-top: 3px;" alt="" src="<?php echo ($soundcloudIsGoldtrack->{'artwork-url'} != '') ? $soundcloudIsGoldtrack->{'artwork-url'} : SIG_PLUGIN_DIR."images/noThumbnail.gif" ?>" class="thumbnail"></a></p>
393
  </td>
394
  <td>
395
- <p><strong>Title:</strong> <?php echo $soundcloudIsGoldtrack->title ?></p>
396
- <p id="soundcloudMMId-<?php echo $soundcloudIsGoldtrack->id ?>" class="soundcloudMMId"><strong>id:</strong> <?php echo $soundcloudIsGoldtrack->id ?></p>
397
- <p><strong>Upload date:</strong> <?php echo $soundcloudIsGoldtrack->{'created-at'} ?></p>
398
- <p><strong>Duration:</strong> <span id="media-dims-<?php echo $soundcloudIsGoldtrack->id ?>"><?php echo $soundcloudIsGoldtrack->duration ?></span></p>
399
- <p><strong>Url:</strong> <a id="videoUrl-<?php echo $soundcloudIsGoldtrack->id ?>" href="<?php echo $soundcloudIsGoldtrack->{'permalink-url'} ?>" title="Go to the video page" target="_blank"><?php echo $soundcloudIsGoldtrack->{'permalink-url'}?></a></p>
400
  </td>
401
  <td>
402
  <tbody>
403
  <tr class="soundcloudMM_description">
404
  <th valign="top" class="label" scope="row"><label><span class="alignleft">Description</span><br class="clear"></label></th>
405
  <td class="field">
406
- <p class="text soundcloudMMDescription" id="soundcloudMMDescription-<?php echo $soundcloudIsGoldtrack->id ?>"><?php echo $soundcloudIsGoldtrack->description ?></p>
407
  </td>
408
  </tr>
409
  <tr class="soundcloudMM_settings">
410
  <th valign="top" class="label" scope="row"><label><span class="alignleft">Settings</span><br class="clear"></label></th>
411
  <td class="field">
412
- <input type="checkbox" <?php echo ($soundcloudIsGoldSettings[0]) ? 'checked="checked"' : '' ?> id="soundcloudMMAutoPlay-<?php echo $soundcloudIsGoldtrack->id ?>" class="text soundcloudMMAutoPlay">
413
  <label >Play Automaticly</label>
414
- <input type="checkbox" <?php echo ($soundcloudIsGoldSettings[1]) ? 'checked="checked"' : '' ?> id="soundcloudMMShowComments-<?php echo $soundcloudIsGoldtrack->id ?>" class="text soundcloudMMShowComments">
415
  <label >Show comments <small>(standard and artwork player)</small></label>
416
- <input type="checkbox" <?php echo ($soundcloudIsGoldSettings[2]) ? 'checked="checked"' : '' ?> id="soundcloudMMShowArtwork-<?php echo $soundcloudIsGoldtrack->id ?>" class="text soundcloudMMShowArtwork">
417
  <label >Show artwork <small>(html5 player)</small></label>
418
  <!-- <input type="text" class="soundcloudPlayercolor" value""/> -->
419
 
@@ -423,7 +458,7 @@ function get_soundcloud_is_gold_user_tracks(){
423
  <th valign="top" class="label" scope="row"><label><span class="alignleft">Player Type</span><br class="clear"></label></th>
424
  <td class="field">
425
  <?php foreach(get_soundcloud_is_gold_player_types() as $type) :?>
426
- <input type="radio" id="soundcloudMMMiniPlayer-<?php echo $soundcloudIsGoldtrack->id ?>" value="<?php echo $type ?>" name="soundcloudMMPlayerType-<?php echo $soundcloudIsGoldtrack->id ?>" class="text soundcloudMMPlayerType" <?php echo ($soundcloudIsGoldPlayerType === $type) ? 'checked="checked"' : '' ?>>
427
  <label><?php echo $type; if($type == 'Artwork') echo ' <small>(not available on free soundcloud account)</small>' ?></label>
428
  <?php endforeach; ?>
429
  </td>
@@ -433,7 +468,7 @@ function get_soundcloud_is_gold_user_tracks(){
433
  <td class="field">
434
  <ul id="soundcloudMMWidthSetting" class="subSettings texts soundcloudMMTabWidthSettings">
435
  <li>
436
- <input name="soundcloudMMWidthType-<?php echo $soundcloudIsGoldtrack->id ?>" <?php echo ($soundcloudIsGoldWidthSettings['type'] == "wp") ? 'checked="checked"' : ''; ?> id="soundcloudMMWpWidth-<?php echo $soundcloudIsGoldtrack->id ?>" value="wp" type="radio" class="soundcloudMMWpWidth soundcloudMMWidthType"/><label for="soundcloudMMWpWidth-<?php echo $soundcloudIsGoldtrack->id ?>">Media Width</label>
437
  <select class="soundcloudMMInput soundcloudMMWidth" name="soundcloud_is_gold_width_settings[wp]">
438
  <?php foreach(get_soundcloud_is_gold_wordpress_sizes() as $key => $soundcloudIsGoldMediaSize) : ?>
439
  <?php $soundcloudIsGoldMediaSelected = ($soundcloudIsGoldMediaSize[0] == $soundcloudIsGoldWidthSettings['wp']) ? 'selected="selected"' : ''; ?>
@@ -442,8 +477,8 @@ function get_soundcloud_is_gold_user_tracks(){
442
  </select>
443
  </li>
444
  <li>
445
- <input name="soundcloudMMWidthType-<?php echo $soundcloudIsGoldtrack->id ?>" <?php echo ($soundcloudIsGoldWidthSettings['type'] == "custom") ? 'checked="checked"' : ''; ?> id="soundcloudMMCustomWidth-<?php echo $soundcloudIsGoldtrack->id ?>" value="custom" type="radio" class="soundcloudMMCustomWidth soundcloudMMWidthType"/><label for="soundcloudMMCustomWidth-<?php echo $soundcloudIsGoldtrack->id ?>">Custom Width</label>
446
- <input name="soundcloudMMCustomSelectedWidth-<?php echo $soundcloudIsGoldtrack->id ?>" id="soundcloudMMCustomSelectedWidth-<?php echo $soundcloudIsGoldtrack->id ?>" class="soundcloudMMInput soundcloudMMWidth soundcloudMMCustomSelectedWidth" type="text" value="<?php echo $soundcloudIsGoldWidthSettings['custom'] ?>" />
447
  </li>
448
  </ul>
449
  </td>
@@ -451,23 +486,23 @@ function get_soundcloud_is_gold_user_tracks(){
451
  <tr class="soundcloudMM_color">
452
  <th valign="top" class="label" scope="row"><label><span class="alignleft">Colour</span><br class="clear"></label></th>
453
  <td class="field">
454
- <div class="soundcloudMMColorPickerContainer" id="soundcloudMMColorPickerContainer-<?php echo $soundcloudIsGoldtrack->id ?>">
455
- <input type="text" id="soundcloudMMColor-<?php echo $soundcloudIsGoldtrack->id ?>" class="soundcloudMMColor" name="soundcloudMMColor-<?php echo $soundcloudIsGoldtrack->id ?>" value="<?php echo $soundcloudIsGoldColor ?>" style="background-color:<?php echo $soundcloudIsGoldColor ?>"/><a href="#" class="soundcloudMMBt soundcloudMMBtSmall inline blue soundcloudMMRounder soundcloudMMResetColor">reset to default</a>
456
- <div id="soundcloudMMColorPicker-<?php echo $soundcloudIsGoldtrack->id ?>" class="shadow soundcloudMMColorPicker" ><div id="soundcloudMMColorPickerSelect-<?php echo $soundcloudIsGoldtrack->id ?>" class="soundcloudMMColorPickerSelect"></div><a id="soundcloudMMColorPickerClose-<?php echo $soundcloudIsGoldtrack->id ?>" class="blue soundcloudMMBt soundcloudMMColorPickerClose">done</a></div>
457
  </div>
458
  </td>
459
  </tr>
460
  <tr class="soundcloudMM_classes">
461
  <th valign="top" class="label" scope="row"><label><span class="alignleft">Extra classes</span><br class="clear"></label></th>
462
  <td class="field">
463
- <input type="text" class="text soundcloudMMClasses" id="soundcloudMMClasses-<?php echo $soundcloudIsGoldtrack->id ?>" value="<?php echo $soundcloudIsGoldClasses ?>">
464
  <p class="help">In case you need extra css classes (seperate with a space, no commas!)</p>
465
  </td>
466
  </tr>
467
  <tr class="soundcloudMM_player">
468
  <th valign="top" class="label" scope="row"><label><span class="alignleft">Preview</span><br class="clear"></label></th>
469
  <td>
470
- <p id="soundcloudMMEmbed-<?php echo $soundcloudIsGoldtrack->id ?>" class="field soundcloudMMEmbed" style="text-align:center">
471
  <!-- Soundcloud Preview here -->
472
  </p>
473
  <p class="soundcloudMMLoading soundcloudMMPreviewLoading" style="display:none"></p>
@@ -476,17 +511,17 @@ function get_soundcloud_is_gold_user_tracks(){
476
  <tr class="soundcloudMM_shortcode">
477
  <th valign="top" class="label" scope="row"><label><span class="alignleft">Shortcode</span><br class="clear"></label></th>
478
  <td class="field">
479
- <input id="soundcloudMMShortcode-<?php echo $soundcloudIsGoldtrack->id ?>" type="text" class="text soundcloudMMShortcode" value="[soundcloud <?php echo 'id='.$soundcloudIsGoldtrack->id ?>']">
480
  </td>
481
  </tr>
482
  <tr class="soundcloudMM_submit">
483
  <td></td>
484
  <td class="savesend">
485
- <a href="#" id="soundcloudMMInsert-<?php echo $soundcloudIsGoldtrack->id ?>" class="button soundcloudMMInsert">Insert Soundcloud Player</a>
486
 
487
  <!-- <input type="submit" value="Insert into Post" name="" class="button"> -->
488
- <!-- <input type="button" id="soundcloudMMAddToGallery-<?php echo $soundcloudIsGoldtrack->id ?>" value="Add to post's gallery" name="" class="button soundcloudMMAddToGallery">
489
- <a href="#" id="soundcloudMMFeat-<?php echo $soundcloudIsGoldtrack->id ?>" class="soundcloudMMFeat">Use as featured Soundcloud</a> -->
490
 
491
  </td>
492
  </tr>
@@ -498,10 +533,10 @@ function get_soundcloud_is_gold_user_tracks(){
498
  </div>
499
  <?php endforeach;
500
  }
501
- //Error getting XML
502
  else{
503
- if($soundcloudIsGoldApiResponse['error'] === false) $soundcloudIsGoldApiResponse['error'] = 'XML error';
504
- echo '<div class="soundcloudMMXmlError"><p>Oups! There\'s been a error while getting the tracks from soundcloud. Please reload the page.</p><p class="error">'.$soundcloudIsGoldApiResponse['error'].'</p></div>';
505
  }
506
  echo '<div id="colorpicker"></div>';
507
  echo '</div></form>';
@@ -613,15 +648,15 @@ function soundcloud_is_gold_player($id, $user, $autoPlay, $comments, $width, $cl
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
 
@@ -659,10 +694,10 @@ function soundcloud_is_gold_add_user(){
659
  if(!empty($_POST['username']) && !array_key_exists($_POST['username'], $options['soundcloud_is_gold_users'])){
660
  $newUsername = str_replace(" ", "-", trim($_POST['username']));
661
  //Get user info
662
- $userInfo = get_soundcloud_is_gold_api_response("http://api.soundcloud.com/users/".$newUsername.".xml?client_id=9rD2GrGrajkmkw5eYFDp2g");
663
- if(isset($userInfo) && isset($userInfo['response']->permalink)){
664
- $newUsername = (string)$userInfo['response']->permalink;
665
- $newUsernameImg = (string)$userInfo['response']->{'avatar-url'}[0];
666
 
667
  $return = '<li class="soundcloudIsGoldUserContainer" style="background-image:URL('.$newUsernameImg.')">';
668
  $return .= '<span class="soundcloudIsGoldRemoveUser" />&nbsp;</span>';
@@ -880,9 +915,9 @@ class Soundcloud_Is_Gold_Widget extends WP_Widget {
880
  </p>
881
  <!-- Main options -->
882
  <?php
883
- $autoplay = $instance['autoplay'] ? 'checked="checked"' : '';
884
- $comments = $instance['comments'] ? 'checked="checked"' : '';
885
- $artwork = $instance['artwork'] ? 'checked="checked"' : '';
886
  ?>
887
  <p>
888
  <label for=""><?php _e( 'Settings:' ); ?></label>
@@ -901,7 +936,7 @@ class Soundcloud_Is_Gold_Widget extends WP_Widget {
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>
52
  $options = get_option('soundcloud_is_gold_options');
53
  $soundcloudIsGoldActiveUser = isset($options['soundcloud_is_gold_active_user']) ? $options['soundcloud_is_gold_active_user'] : '';
54
 
55
+ $soundcloudIsGoldApiCall = 'http://api.soundcloud.com/users/'.$soundcloudIsGoldActiveUser.'.json?client_id=9rD2GrGrajkmkw5eYFDp2g';
56
  $soundcloudIsGoldApiResponse = get_soundcloud_is_gold_api_response($soundcloudIsGoldApiCall);
57
+ $result['tracks'] = ($soundcloudIsGoldApiResponse['response']['track_count'] == 0) ? '0' : $soundcloudIsGoldApiResponse['response']['track_count'];
58
+ $result['sets'] = ($soundcloudIsGoldApiResponse['response']['playlist_count'] == 0) ? '0' : $soundcloudIsGoldApiResponse['response']['playlist_count'];
59
+ $result['favorites'] = ($soundcloudIsGoldApiResponse['response']['public_favorites_count'] == 0) ? '0' : $soundcloudIsGoldApiResponse['response']['public_favorites_count'];
60
  return $result;
61
  }
62
  function get_soundcloud_is_gold_username_interface($options, $soundcloudIsGoldUsers){
114
  **/
115
  function get_soundcloud_is_gold_latest_track_id($soundcloudIsGoldUser, $format = "tracks"){
116
  $soundcouldMMId = "";
117
+ $soundcloudIsGoldApiCall = 'http://api.soundcloud.com/users/'.$soundcloudIsGoldUser.'/tracks.json?limit=1&client_id=9rD2GrGrajkmkw5eYFDp2g';
118
+ if($format == "sets") $soundcloudIsGoldApiCall = 'http://api.soundcloud.com/users/'.$soundcloudIsGoldUser.'/playlists.json?limit=1&client_id=9rD2GrGrajkmkw5eYFDp2g';
119
+ if($format == "favorites") $soundcloudIsGoldApiCall = 'http://api.soundcloud.com/users/'.$soundcloudIsGoldUser.'/favorites.json?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){
124
+ $soundcouldMMId = $soundcloudMMLatestTrack['id'];
125
  }
126
  }
127
  return $soundcouldMMId;
137
  if($random) $getNbr = 50;
138
  $soundcouldMMIds= array();
139
 
140
+ $soundcloudIsGoldApiCall = 'http://api.soundcloud.com/users/'.$soundcloudIsGoldUser.'/tracks.json?limit='.$getNbr.'&client_id=9rD2GrGrajkmkw5eYFDp2g';
141
+ if($format == 'sets') $soundcloudIsGoldApiCall = 'http://api.soundcloud.com/users/'.$soundcloudIsGoldUser.'/playlists.json?limit='.$getNbr.'&client_id=9rD2GrGrajkmkw5eYFDp2g';
142
+ if($format == 'favorites') $soundcloudIsGoldApiCall = 'http://api.soundcloud.com/users/'.$soundcloudIsGoldUser.'/favorites.json?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
+ * Get Soundcloud API Response (Json version)
157
  * $soundcloudIsGoldApiCall: API request (url)
158
  **/
159
  function get_soundcloud_is_gold_api_response($soundcloudIsGoldApiCall){
160
+ //Set Error default message && default Json state
161
+ $soundcloudIsGoldRespError = false;
162
+ //Check is cURL extension is loaded
163
+ if(extension_loaded("curl")){
164
+ // create a new cURL resource
165
+ $soundcloudIsGoldCURL = curl_init();
166
+ //Set cURL Options
167
+ curl_setopt($soundcloudIsGoldCURL, CURLOPT_USERAGENT, "user_agent : FOOBAR");
168
+ curl_setopt($soundcloudIsGoldCURL, CURLOPT_SSL_VERIFYPEER, false);// Disable SSL verification
169
+ curl_setopt($soundcloudIsGoldCURL, CURLOPT_RETURNTRANSFER, true);// Will return the response, if false it print the response
170
+ curl_setopt($soundcloudIsGoldCURL, CURLOPT_URL, $soundcloudIsGoldApiCall); // Set URL
171
+ // Execute Curl
172
+ $soundcloudIsGoldResponse = curl_exec($soundcloudIsGoldCURL);
173
+ //Check for cURL errors
174
+ if($soundcloudIsGoldResponse === false) $soundcloudIsGoldRespError = 'Curl error: ' . curl_error($soundcloudIsGoldCURL);
175
+ //No cURL Errors: Load the call and captured Json returned by the API
176
+ else {
177
+
178
+ }
179
+ // close cURL resource, and free up system resources
180
+ curl_close($soundcloudIsGoldCURL);
181
+
182
+ }
183
+ //No cURL: Try loading the Json directly
184
+ else $soundcloudIsGoldResponse = file_get_contents($soundcloudIsGoldApiCall);
185
+
186
+ //Add response and error to array
187
+ $soundCloudIsGoldResponseRawArray = json_decode($soundcloudIsGoldResponse, true);
188
+ $soundCloudIsGoldResponseArray = array('response' => $soundCloudIsGoldResponseRawArray, 'error' => $soundcloudIsGoldRespError);
189
+ return $soundCloudIsGoldResponseArray;
190
+ }
191
+ /**
192
+ * Get Soundcloud API Response (XML version)
193
+ * $soundcloudIsGoldApiCall: API request (url)
194
+ **/
195
+ function get_soundcloud_is_gold_api_response_xml($soundcloudIsGoldApiCall){
196
  //Set Error default message && default XML state
197
  $soundcloudIsGoldRespError = false;
198
  $soundcloudIsGoldResp = false;
366
 
367
  //API Call
368
  $soundcloudIsGoldSelectedFormat = isset($_REQUEST['selectFormat']) ? $_REQUEST['selectFormat'] : 'tracks';
369
+ if($soundcloudIsGoldSelectedFormat == 'tracks') $soundcloudIsGoldApiCall = 'http://api.soundcloud.com/users/'.$soundcloudIsGoldActiveUser.'/tracks.json?limit='.$soundcloudIsGoldTracksPerPage.'&offset='.$soundcloudIsGoldApiOffset.'&client_id=9rD2GrGrajkmkw5eYFDp2g';
370
+ if($soundcloudIsGoldSelectedFormat == 'sets') $soundcloudIsGoldApiCall = 'http://api.soundcloud.com/users/'.$soundcloudIsGoldActiveUser.'/playlists.json?limit='.$soundcloudIsGoldTracksPerPage.'&offset='.$soundcloudIsGoldApiOffset.'&client_id=9rD2GrGrajkmkw5eYFDp2g';
371
+ if($soundcloudIsGoldSelectedFormat == 'favorites') $soundcloudIsGoldApiCall = 'http://api.soundcloud.com/users/'.$soundcloudIsGoldActiveUser.'/favorites.json?limit='.$soundcloudIsGoldTracksPerPage.'&offset='.$soundcloudIsGoldApiOffset.'&client_id=9rD2GrGrajkmkw5eYFDp2g';
372
  $soundcloudIsGoldApiResponse = get_soundcloud_is_gold_api_response($soundcloudIsGoldApiCall);
373
 
374
  //Pagination and Actions
416
  if (isset($soundcloudIsGoldApiResponse['response']) && $soundcloudIsGoldApiResponse['response']) {
417
  foreach($soundcloudIsGoldApiResponse['response'] as $soundcloudIsGoldtrack): ?>
418
 
419
+ <div class="media-item preloaded" id="media-item-<?php echo $soundcloudIsGoldtrack['id'] ?>">
420
+ <a href="#" class="toggle describe-toggle-on soundcloud" id="show-<?php echo $soundcloudIsGoldtrack['id'] ?>">Show</a>
421
  <a href="#" class="toggle describe-toggle-off soundcloudMM">Hide</a>
422
+ <div class="filename new"><span class="title soundcloudMMTitle" id="soundcloudMMTitle-<?php echo $soundcloudIsGoldtrack['id'] ?>"><?php echo $soundcloudIsGoldtrack['title'] ?></span></div>
423
  <table class="slidetoggle describe startclosed soundcloudMMWrapper soundcloudMMMainWrapper <?php echo $soundcloudIsGoldSelectedFormat ?>">
424
+ <thead id="media-head-<?php echo $soundcloudIsGoldtrack['id'] ?>" class="media-item-info">
425
  <tr valign="top">
426
+ <td id="thumbnail-head-<?php echo $soundcloudIsGoldtrack['id'] ?>" class="A1B1">
427
+ <p><a href="<?php echo $soundcloudIsGoldtrack['permalink_url']?>" title="Go to the Soundcloud page" target="_blank"><img id="soundcloudMMThumb-<?php echo $soundcloudIsGoldtrack['id'] ?>" style="margin-top: 3px;" alt="" src="<?php echo ($soundcloudIsGoldtrack['artwork_url'] != '') ? $soundcloudIsGoldtrack['artwork_url'] : SIG_PLUGIN_DIR."images/noThumbnail.gif" ?>" class="thumbnail"></a></p>
428
  </td>
429
  <td>
430
+ <p><strong>Title:</strong> <?php echo $soundcloudIsGoldtrack['title'] ?></p>
431
+ <p id="soundcloudMMId-<?php echo $soundcloudIsGoldtrack['id'] ?>" class="soundcloudMMId"><strong>id:</strong> <?php echo $soundcloudIsGoldtrack['id'] ?></p>
432
+ <p><strong>Upload date:</strong> <?php echo $soundcloudIsGoldtrack['created_at'] ?></p>
433
+ <p><strong>Duration:</strong> <span id="media-dims-<?php echo $soundcloudIsGoldtrack['id'] ?>"><?php echo $soundcloudIsGoldtrack['duration'] ?></span></p>
434
+ <p><strong>Url:</strong> <a id="videoUrl-<?php echo $soundcloudIsGoldtrack['id'] ?>" href="<?php echo $soundcloudIsGoldtrack['permalink_url'] ?>" title="Go to the video page" target="_blank"><?php echo $soundcloudIsGoldtrack['permalink_url']?></a></p>
435
  </td>
436
  <td>
437
  <tbody>
438
  <tr class="soundcloudMM_description">
439
  <th valign="top" class="label" scope="row"><label><span class="alignleft">Description</span><br class="clear"></label></th>
440
  <td class="field">
441
+ <p class="text soundcloudMMDescription" id="soundcloudMMDescription-<?php echo $soundcloudIsGoldtrack['id'] ?>"><?php echo $soundcloudIsGoldtrack['description'] ?></p>
442
  </td>
443
  </tr>
444
  <tr class="soundcloudMM_settings">
445
  <th valign="top" class="label" scope="row"><label><span class="alignleft">Settings</span><br class="clear"></label></th>
446
  <td class="field">
447
+ <input type="checkbox" <?php echo (isset($soundcloudIsGoldSettings[0]) ? $soundcloudIsGoldSettings[0] : 0) ? 'checked="checked"' : '' ?> id="soundcloudMMAutoPlay-<?php echo $soundcloudIsGoldtrack['id'] ?>" class="text soundcloudMMAutoPlay">
448
  <label >Play Automaticly</label>
449
+ <input type="checkbox" <?php echo (isset($soundcloudIsGoldSettings[1]) ? $soundcloudIsGoldSettings[1] : 0) ? 'checked="checked"' : '' ?> id="soundcloudMMShowComments-<?php echo $soundcloudIsGoldtrack['id'] ?>" class="text soundcloudMMShowComments">
450
  <label >Show comments <small>(standard and artwork player)</small></label>
451
+ <input type="checkbox" <?php echo (isset($soundcloudIsGoldSettings[2]) ? $soundcloudIsGoldSettings[2] : 0) ? 'checked="checked"' : '' ?> id="soundcloudMMShowArtwork-<?php echo $soundcloudIsGoldtrack['id'] ?>" class="text soundcloudMMShowArtwork">
452
  <label >Show artwork <small>(html5 player)</small></label>
453
  <!-- <input type="text" class="soundcloudPlayercolor" value""/> -->
454
 
458
  <th valign="top" class="label" scope="row"><label><span class="alignleft">Player Type</span><br class="clear"></label></th>
459
  <td class="field">
460
  <?php foreach(get_soundcloud_is_gold_player_types() as $type) :?>
461
+ <input type="radio" id="soundcloudMMMiniPlayer-<?php echo $soundcloudIsGoldtrack['id'] ?>" value="<?php echo $type ?>" name="soundcloudMMPlayerType-<?php echo $soundcloudIsGoldtrack['id'] ?>" class="text soundcloudMMPlayerType" <?php echo ($soundcloudIsGoldPlayerType === $type) ? 'checked="checked"' : '' ?>>
462
  <label><?php echo $type; if($type == 'Artwork') echo ' <small>(not available on free soundcloud account)</small>' ?></label>
463
  <?php endforeach; ?>
464
  </td>
468
  <td class="field">
469
  <ul id="soundcloudMMWidthSetting" class="subSettings texts soundcloudMMTabWidthSettings">
470
  <li>
471
+ <input name="soundcloudMMWidthType-<?php echo $soundcloudIsGoldtrack['id'] ?>" <?php echo ($soundcloudIsGoldWidthSettings['type'] == "wp") ? 'checked="checked"' : ''; ?> id="soundcloudMMWpWidth-<?php echo $soundcloudIsGoldtrack['id'] ?>" value="wp" type="radio" class="soundcloudMMWpWidth soundcloudMMWidthType"/><label for="soundcloudMMWpWidth-<?php echo $soundcloudIsGoldtrack['id'] ?>">Media Width</label>
472
  <select class="soundcloudMMInput soundcloudMMWidth" name="soundcloud_is_gold_width_settings[wp]">
473
  <?php foreach(get_soundcloud_is_gold_wordpress_sizes() as $key => $soundcloudIsGoldMediaSize) : ?>
474
  <?php $soundcloudIsGoldMediaSelected = ($soundcloudIsGoldMediaSize[0] == $soundcloudIsGoldWidthSettings['wp']) ? 'selected="selected"' : ''; ?>
477
  </select>
478
  </li>
479
  <li>
480
+ <input name="soundcloudMMWidthType-<?php echo $soundcloudIsGoldtrack['id'] ?>" <?php echo ($soundcloudIsGoldWidthSettings['type'] == "custom") ? 'checked="checked"' : ''; ?> id="soundcloudMMCustomWidth-<?php echo $soundcloudIsGoldtrack['id'] ?>" value="custom" type="radio" class="soundcloudMMCustomWidth soundcloudMMWidthType"/><label for="soundcloudMMCustomWidth-<?php echo $soundcloudIsGoldtrack['id'] ?>">Custom Width</label>
481
+ <input name="soundcloudMMCustomSelectedWidth-<?php echo $soundcloudIsGoldtrack['id'] ?>" id="soundcloudMMCustomSelectedWidth-<?php echo $soundcloudIsGoldtrack['id'] ?>" class="soundcloudMMInput soundcloudMMWidth soundcloudMMCustomSelectedWidth" type="text" value="<?php echo $soundcloudIsGoldWidthSettings['custom'] ?>" />
482
  </li>
483
  </ul>
484
  </td>
486
  <tr class="soundcloudMM_color">
487
  <th valign="top" class="label" scope="row"><label><span class="alignleft">Colour</span><br class="clear"></label></th>
488
  <td class="field">
489
+ <div class="soundcloudMMColorPickerContainer" id="soundcloudMMColorPickerContainer-<?php echo $soundcloudIsGoldtrack['id'] ?>">
490
+ <input type="text" id="soundcloudMMColor-<?php echo $soundcloudIsGoldtrack['id'] ?>" class="soundcloudMMColor" name="soundcloudMMColor-<?php echo $soundcloudIsGoldtrack['id'] ?>" value="<?php echo $soundcloudIsGoldColor ?>" style="background-color:<?php echo $soundcloudIsGoldColor ?>"/><a href="#" class="soundcloudMMBt soundcloudMMBtSmall inline blue soundcloudMMRounder soundcloudMMResetColor">reset to default</a>
491
+ <div id="soundcloudMMColorPicker-<?php echo $soundcloudIsGoldtrack['id'] ?>" class="shadow soundcloudMMColorPicker" ><div id="soundcloudMMColorPickerSelect-<?php echo $soundcloudIsGoldtrack['id'] ?>" class="soundcloudMMColorPickerSelect"></div><a id="soundcloudMMColorPickerClose-<?php echo $soundcloudIsGoldtrack['id'] ?>" class="blue soundcloudMMBt soundcloudMMColorPickerClose">done</a></div>
492
  </div>
493
  </td>
494
  </tr>
495
  <tr class="soundcloudMM_classes">
496
  <th valign="top" class="label" scope="row"><label><span class="alignleft">Extra classes</span><br class="clear"></label></th>
497
  <td class="field">
498
+ <input type="text" class="text soundcloudMMClasses" id="soundcloudMMClasses-<?php echo $soundcloudIsGoldtrack['id'] ?>" value="<?php echo $soundcloudIsGoldClasses ?>">
499
  <p class="help">In case you need extra css classes (seperate with a space, no commas!)</p>
500
  </td>
501
  </tr>
502
  <tr class="soundcloudMM_player">
503
  <th valign="top" class="label" scope="row"><label><span class="alignleft">Preview</span><br class="clear"></label></th>
504
  <td>
505
+ <p id="soundcloudMMEmbed-<?php echo $soundcloudIsGoldtrack['id'] ?>" class="field soundcloudMMEmbed" style="text-align:center">
506
  <!-- Soundcloud Preview here -->
507
  </p>
508
  <p class="soundcloudMMLoading soundcloudMMPreviewLoading" style="display:none"></p>
511
  <tr class="soundcloudMM_shortcode">
512
  <th valign="top" class="label" scope="row"><label><span class="alignleft">Shortcode</span><br class="clear"></label></th>
513
  <td class="field">
514
+ <input id="soundcloudMMShortcode-<?php echo $soundcloudIsGoldtrack['id'] ?>" type="text" class="text soundcloudMMShortcode" value="[soundcloud <?php echo 'id='.$soundcloudIsGoldtrack['id'] ?>']">
515
  </td>
516
  </tr>
517
  <tr class="soundcloudMM_submit">
518
  <td></td>
519
  <td class="savesend">
520
+ <a href="#" id="soundcloudMMInsert-<?php echo $soundcloudIsGoldtrack['id'] ?>" class="button soundcloudMMInsert">Insert Soundcloud Player</a>
521
 
522
  <!-- <input type="submit" value="Insert into Post" name="" class="button"> -->
523
+ <!-- <input type="button" id="soundcloudMMAddToGallery-<?php echo $soundcloudIsGoldtrack['id'] ?>" value="Add to post's gallery" name="" class="button soundcloudMMAddToGallery">
524
+ <a href="#" id="soundcloudMMFeat-<?php echo $soundcloudIsGoldtrack['id'] ?>" class="soundcloudMMFeat">Use as featured Soundcloud</a> -->
525
 
526
  </td>
527
  </tr>
533
  </div>
534
  <?php endforeach;
535
  }
536
+ //Error getting json
537
  else{
538
+ if($soundcloudIsGoldApiResponse['error'] === false) $soundcloudIsGoldApiResponse['error'] = 'Json error';
539
+ echo '<div class="soundcloudMMJsonError"><p>Oups! There\'s been a error while getting the tracks from soundcloud. Please reload the page.</p><p class="error">'.$soundcloudIsGoldApiResponse['error'].'</p></div>';
540
  }
541
  echo '<div id="colorpicker"></div>';
542
  echo '</div></form>';
648
  //Flash Player
649
  if(!$html5Player){
650
  $player .= '<object height="'.esc_attr($height).'" width="'.esc_attr($width).'">';
651
+ $player .= '<param name="movie" value="'.$httpPrefix.'://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>';
652
  $player .= '<param name="allowscriptaccess" value="always"></param>';
653
  $player .= '<param name="wmode" value="transparent"></param>';
654
+ $player .= '<embed wmode="transparent" allowscriptaccess="always" height="'.esc_attr($height).'" src="'.$httpPrefix.'://player.soundcloud.com/player.swf?url='.$httpPrefix.'%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>';
655
  $player .= '</object>';
656
  }
657
  //Html5 Player
658
  else{
659
+ $player .= '<iframe width="'.esc_attr($width).'" height="'.esc_attr($height).'" scrolling="no" frameborder="no" src="'.$httpPrefix.'://w.soundcloud.com/player/?url='.$httpPrefix.'%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>';
660
  }
661
  $player .= '</div>';
662
 
694
  if(!empty($_POST['username']) && !array_key_exists($_POST['username'], $options['soundcloud_is_gold_users'])){
695
  $newUsername = str_replace(" ", "-", trim($_POST['username']));
696
  //Get user info
697
+ $userInfo = get_soundcloud_is_gold_api_response("http://api.soundcloud.com/users/".$newUsername.".json?client_id=9rD2GrGrajkmkw5eYFDp2g");
698
+ if(isset($userInfo) && isset($userInfo['response']['permalink'])){
699
+ $newUsername = $userInfo['response']['permalink'];
700
+ $newUsernameImg = $userInfo['response']['avatar_url'];
701
 
702
  $return = '<li class="soundcloudIsGoldUserContainer" style="background-image:URL('.$newUsernameImg.')">';
703
  $return .= '<span class="soundcloudIsGoldRemoveUser" />&nbsp;</span>';
915
  </p>
916
  <!-- Main options -->
917
  <?php
918
+ $autoplay = (isset($instance['autoplay']) && $instance['autoplay']) ? 'checked="checked"' : '';
919
+ $comments = (isset($instance['comments']) && $instance['comments']) ? 'checked="checked"' : '';
920
+ $artwork = (isset($instance['artwork']) && $instance['artwork']) ? 'checked="checked"' : '';
921
  ?>
922
  <p>
923
  <label for=""><?php _e( 'Settings:' ); ?></label>
936
  <br/>
937
  <select name="<?php echo $this->get_field_name('number'); ?>" id="<?php echo $this->get_field_id('number'); ?>" class="widefat">
938
  <?php
939
+ for($i=1; $i<=10; $i++) : ?>
940
  <option value="<?php echo $i ?>"<?php selected( $instance['number'], $i ); ?>><?php _e($i); ?></option>
941
  <?php endfor; ?>
942
  </select>
soundcloud-is-gold-js.js CHANGED
@@ -211,7 +211,7 @@ jQuery(document).ready(function($){
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';
211
  });
212
  //Color
213
  color = $('.soundcloudMMColor', parent).val();
214
+ user = $('#soundcloudIsGoldActiveUserContainer .soundcloudIsGoldUserContainer div p').text();
215
  //Format
216
  if($('.soundcloudMMWrapper').hasClass('sets')) format = 'sets';
217
  else format = 'tracks';
soundcloud-is-gold.php CHANGED
@@ -3,7 +3,7 @@
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.2
7
  Author: Thomas Michalak
8
  Author URI: http://www.mightymess.com/thomas-michalak
9
  License: GPL2 or Later
@@ -17,7 +17,12 @@ License: GPL2 or Later
17
  html5: h=166, w=100%
18
  */
19
 
20
- define ('SIG_PLUGIN_DIR', WP_PLUGIN_URL.'/'.str_replace(basename( __FILE__),"",plugin_basename(__FILE__)) );
 
 
 
 
 
21
  require_once('soundcloud-is-gold-functions.php');
22
 
23
  /** Get Plugin Version **/
@@ -96,7 +101,7 @@ function soundcloud_is_gold_add_defaults() {
96
  $soundcloudIsGoldDefaultUser = $soundcloudIsGoldDefaultUsers[array_rand($soundcloudIsGoldDefaultUsers, 1)][0];
97
  if(get_option('soundcloud_is_gold_user')){
98
  $soundcloudIsGoldDefaultUser = get_option('soundcloud_is_gold_user');
99
- $userInfo = get_soundcloud_is_gold_api_response("http://api.soundcloud.com/users/".$soundcloudIsGoldDefaultUser.".xml?client_id=9rD2GrGrajkmkw5eYFDp2g");
100
  $newUsername = (string)$userInfo['response']->permalink;
101
  $newUsernameImg = (string)$userInfo['response']->{'avatar-url'}[0];
102
  $soundcloudIsGoldDefaultUsers[$newUsername][0] = $newUsername;
@@ -151,11 +156,11 @@ function soundcloud_is_gold_options(){
151
  $soundcloudIsGoldClasses = isset($options['soundcloud_is_gold_classes']) ? $options['soundcloud_is_gold_classes'] : '';
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.']';
@@ -251,8 +256,8 @@ function soundcloud_is_gold_options(){
251
  </p>
252
  <p class="soundcloudMMLoading soundcloudMMPreviewLoading" style="display:none"></p>
253
  <?php else : ?>
254
- <!-- Error getting XML -->
255
- <div class="soundcloudMMXmlError"><p><?php echo $soundcloudIsGoldApiResponse['error'] ? $soundcloudIsGoldApiResponse['error'] : "Oups! There's been a error while getting the tracks from soundcloud. Please reload the page."?></p></div>
256
  <?php endif; ?>
257
  </li>
258
  </ul>
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.3
7
  Author: Thomas Michalak
8
  Author URI: http://www.mightymess.com/thomas-michalak
9
  License: GPL2 or Later
17
  html5: h=166, w=100%
18
  */
19
 
20
+ //define ('SIG_PLUGIN_DIR', WP_PLUGIN_URL.'/'.str_replace(basename( __FILE__),"",plugin_basename(__FILE__)) );
21
+ define( 'SIG_PLUGIN_DIR_HTTP', WP_PLUGIN_URL.'/'.str_replace(basename( __FILE__),"",plugin_basename(__FILE__)) );
22
+ define( 'SIG_PLUGIN_DIR', (is_ssl() ? str_replace('http:', 'https:', SIG_PLUGIN_DIR_HTTP) : SIG_PLUGIN_DIR_HTTP) );
23
+
24
+ $httpPrefix = (is_ssl() ? 'https' : 'http');
25
+
26
  require_once('soundcloud-is-gold-functions.php');
27
 
28
  /** Get Plugin Version **/
101
  $soundcloudIsGoldDefaultUser = $soundcloudIsGoldDefaultUsers[array_rand($soundcloudIsGoldDefaultUsers, 1)][0];
102
  if(get_option('soundcloud_is_gold_user')){
103
  $soundcloudIsGoldDefaultUser = get_option('soundcloud_is_gold_user');
104
+ $userInfo = get_soundcloud_is_gold_api_response("http://api.soundcloud.com/users/".$soundcloudIsGoldDefaultUser.".json?client_id=9rD2GrGrajkmkw5eYFDp2g");
105
  $newUsername = (string)$userInfo['response']->permalink;
106
  $newUsernameImg = (string)$userInfo['response']->{'avatar-url'}[0];
107
  $soundcloudIsGoldDefaultUsers[$newUsername][0] = $newUsername;
156
  $soundcloudIsGoldClasses = isset($options['soundcloud_is_gold_classes']) ? $options['soundcloud_is_gold_classes'] : '';
157
  $soundcloudIsGoldColor = isset($options['soundcloud_is_gold_color']) ? $options['soundcloud_is_gold_color'] : '';
158
 
159
+ $soundcloudIsGoldApiCall = 'http://api.soundcloud.com/users/'.$soundcloudIsGoldActiveUser.'/tracks.json?limit=1&client_id=9rD2GrGrajkmkw5eYFDp2g';
160
  $soundcloudIsGoldApiResponse = get_soundcloud_is_gold_api_response($soundcloudIsGoldApiCall);
161
  if(isset($soundcloudIsGoldApiResponse['response']) && $soundcloudIsGoldApiResponse['response']){
162
  foreach($soundcloudIsGoldApiResponse['response'] as $soundcloudMMLatestTrack){
163
+ $soundcouldMMId = (string)$soundcloudMMLatestTrack['id'];
164
  }
165
  }
166
  $soundcouldMMShortcode = '[soundcloud id='.$soundcouldMMId.']';
256
  </p>
257
  <p class="soundcloudMMLoading soundcloudMMPreviewLoading" style="display:none"></p>
258
  <?php else : ?>
259
+ <!-- Error getting Json -->
260
+ <div class="soundcloudMMJsonError"><p><?php echo $soundcloudIsGoldApiResponse['error'] ? $soundcloudIsGoldApiResponse['error'] : "Oups! There's been a error while getting the tracks from soundcloud. Please reload the page."?></p></div>
261
  <?php endif; ?>
262
  </li>
263
  </ul>