SoundCloud Is Gold - Version 1.0.2

Version Description

  • Fixed minor warnings
  • Made shortcode stronger/safer with shortcode_atts()
  • Set object mode to transparent until V1.1 is ready with new advance settings.
  • Made all shortcode attributes lowercase (autoPlay is now autoplay, playerType is now playertype). sorry about that but it's needed.
Download this release

Release Info

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

Code changes from version 1.0.1 to 1.0.2

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
5
  Requires at least: 3.2
6
  Tested up to: 3.2.1
7
- Stable tag: 1.0.1
8
 
9
  Browse through your soundcloud tracks from a tab in the post's 'upload media'. Select, add a track to your post. Live preview, easy.
10
 
@@ -53,19 +53,19 @@ This will use your default setting of with, classes, colors, autoplay, comments.
53
 
54
  If you wish to have more control here is an example:
55
 
56
- **[soundcloud id='10450254' comments='true' autoPlay='false' playerType='Standard' width='100%' color='#005bff']**
57
 
58
 
59
  = To Do List =
60
 
 
61
  * Possibility to add multiple users for thoses with multiple soundcloud account.
62
  * Possibility to set a different user in the 'Soundcloud is Gold tab' to add tracks from different people.
63
  * Add Soundcloud default Width to the options
64
  * Style sortcode in TinyMCE (editor) because it would be cool and neat;
65
  * Trigger live preview when changing Soundcloud user name
66
  * Live search while typing a name in the user name field. So if you're looking for someone it's kind of easier.
67
- * Pagination in tab (is it really needed?)
68
- * Change background color and comments color
69
 
70
 
71
  == Installation ==
@@ -92,7 +92,7 @@ Sometimes, I generaly keep a eye on my plugin's forums and website's comments. B
92
 
93
  == Upgrade Notice ==
94
 
95
- This is the first version
96
 
97
 
98
 
@@ -107,6 +107,12 @@ This is the first version
107
 
108
  == Changelog ==
109
 
 
 
 
 
 
 
110
  = 1.0.1 =
111
  * Fixed shortode using echo instead of return (silly I know). This caused the shortcode to be outputted at the top of the post instead of it's position in the post. Thanks raceyblood for spotting it.
112
 
4
  Tags: soundcloud, integrated, media, shortcode, browse, design, easy, simple, music, sound, js, live preview
5
  Requires at least: 3.2
6
  Tested up to: 3.2.1
7
+ Stable tag: 1.0.2
8
 
9
  Browse through your soundcloud tracks from a tab in the post's 'upload media'. Select, add a track to your post. Live preview, easy.
10
 
53
 
54
  If you wish to have more control here is an example:
55
 
56
+ **[soundcloud id='10450254' comments='true' autoplay='false' playertype='Standard' width='100%' color='#005bff']**
57
 
58
 
59
  = To Do List =
60
 
61
+ * V1.1: Advance Settings (change background color and comments color, playcounts, buy link, font, etc�)
62
  * Possibility to add multiple users for thoses with multiple soundcloud account.
63
  * Possibility to set a different user in the 'Soundcloud is Gold tab' to add tracks from different people.
64
  * Add Soundcloud default Width to the options
65
  * Style sortcode in TinyMCE (editor) because it would be cool and neat;
66
  * Trigger live preview when changing Soundcloud user name
67
  * Live search while typing a name in the user name field. So if you're looking for someone it's kind of easier.
68
+ * if no id is specified in the shortcode (e.g [soundcloud]), display the latest track.
 
69
 
70
 
71
  == Installation ==
92
 
93
  == Upgrade Notice ==
94
 
95
+ When upgrading from 1.0.1 and earlier: All shortcode attributes are now lowercase (autoPlay is now autoplay, playerType is now playertype). Sorry about that but it's needed, so if you have some custom ones in your posts you will have to change those manually.
96
 
97
 
98
 
107
 
108
  == Changelog ==
109
 
110
+ = 1.0.2 =
111
+ * Fixed minor warnings
112
+ * Made shortcode stronger/safer with shortcode_atts()
113
+ * Set object mode to transparent until V1.1 is ready with new advance settings.
114
+ * Made all shortcode attributes lowercase (autoPlay is now autoplay, playerType is now playertype). sorry about that but it's needed.
115
+
116
  = 1.0.1 =
117
  * Fixed shortode using echo instead of return (silly I know). This caused the shortcode to be outputted at the top of the post instead of it's position in the post. Thanks raceyblood for spotting it.
118
 
soundcloud-is-gold-functions.php CHANGED
@@ -20,7 +20,7 @@ add_action('admin_print_styles-media-upload-popup', 'soundcloud_is_gold_option_s
20
  function media_soundcloud_is_gold_process() {
21
  media_upload_header();
22
  // $soundcloudXML = PLUGIN_DIR.'tracks.xml';
23
- $soundcloudIsGoldXML = 'http://api.soundcloud.com/users/'.get_option(soundcloud_is_gold_user).'/tracks.xml?client_id=9rD2GrGrajkmkw5eYFDp2g';
24
  get_soundcloud_is_gold_user_tracks($soundcloudIsGoldXML, $_REQUEST['post_id']);
25
  //testMedia(TRUE);
26
  }
@@ -42,14 +42,14 @@ add_filter('media_buttons_context', 'plugin_media_button');
42
  /** Populate the new Soundcloud is Gold Tab **/
43
  function get_soundcloud_is_gold_user_tracks($soundcloudIsGoldApiCall, $post_id){
44
 
45
- $soundcloudIsGoldUser = get_option(soundcloud_is_gold_user);
46
- $soundcloudIsGoldSettings = get_option(soundcloud_is_gold_settings);
47
- $soundcloudIsGoldPlayerType = get_option(soundcloud_is_gold_playerType);
48
  $soundcloudIsGoldPlayerTypeDefault = empty($soundcloudIsGoldPlayerType) ? TRUE : FALSE;
49
- $soundcloudIsGoldWidthSettings = get_option(soundcloud_is_gold_width_settings);
50
  $soundcloudIsGoldWidth = get_soundcloud_is_gold_default_width($soundcloudIsGoldWidthSettings);
51
- $soundcloudIsGoldClasses = get_option(soundcloud_is_gold_classes);
52
- $soundcloudIsGoldColor = get_option(soundcloud_is_gold_color);
53
 
54
  //Sorting Menu
55
  echo '<form id="library-form" class="media-upload-form validate" action="" method="post" enctype="multipart/form-data"><div id="media-items" class="media-items-'.$post_id.'">';
@@ -214,21 +214,20 @@ function get_soundcloud_is_gold_user_tracks($soundcloudIsGoldApiCall, $post_id){
214
  /** **/
215
  /******************************************************/
216
  add_shortcode('soundcloud', 'soundcloud_is_gold_shortcode');
217
- function soundcloud_is_gold_shortcode($attr){
218
- //Ajax
219
- ?>
220
- <!--
221
- <div id="soundcloud-<?php echo $attr['id'] ?>" style="width:<?php echo $attr['width'] ?>" class="soundcloud">
222
- <script type="text/javascript">
223
- jQuery(document).ready(function(){
224
- loadSoundcloud(<?php //echo implode(',', $attr)?>);
225
- });
226
- </script>
227
- </div>
228
- -->
229
- <?php
230
- //no js
231
- return soundcloud_is_gold_player($attr['id'], $attr['autoPlay'], $attr['comments'], $attr['width'], $attr['classes'], $attr['type'], $attr['color']);
232
  }
233
 
234
 
@@ -251,14 +250,15 @@ function soundcloud_is_gold_player_preview(){
251
  /** The Player **/
252
  function soundcloud_is_gold_player($id, $autoPlay, $comments, $width, $classes, $playerTypes, $color){
253
 
254
-
255
- $soundcloudIsGoldSettings = get_option(soundcloud_is_gold_settings);
256
- if($autoPlay == NULL) $autoPlay = $soundcloudIsGoldSettings[0];
257
- if($comments == NULL) $comments = $soundcloudIsGoldSettings[1];
258
- if($width == NULL) $width = get_soundcloud_is_gold_default_width(get_option(soundcloud_is_gold_width_settings));
259
- if($classes == NULL) $classes = get_option(soundcloud_is_gold_classes);
260
- if($playerTypes == NULL) $playerTypes = get_option(soundcloud_is_gold_playerType);
261
- if($color == NULL) $color = get_option(soundcloud_is_gold_color);
 
262
  $color = str_replace('#', '', $color);
263
 
264
  switch($playerTypes){
@@ -280,8 +280,8 @@ function soundcloud_is_gold_player($id, $autoPlay, $comments, $width, $classes,
280
  $player .= '<object height="'.$height.'" width="'.$width.'">';
281
  $player .= '<param name="movie" value="http://player.soundcloud.com/player.swf?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F'.$id.'&amp;auto_play='.$autoPlay.'&amp;player_type='.$playerType.'&amp;show_comments='.$comments.'&amp;color='.$color.'"></param>';
282
  $player .= '<param name="allowscriptaccess" value="always"></param>';
283
- $player .= '<param name="wmode" value="window"></param>';
284
- $player .= '<embed wmode="window" allowscriptaccess="always" height="'.$height.'" src="http://player.soundcloud.com/player.swf?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%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>';
285
  $player .= '</object>';
286
  $player .= '</div>';
287
 
20
  function media_soundcloud_is_gold_process() {
21
  media_upload_header();
22
  // $soundcloudXML = PLUGIN_DIR.'tracks.xml';
23
+ $soundcloudIsGoldXML = 'http://api.soundcloud.com/users/'.get_option('soundcloud_is_gold_user').'/tracks.xml?client_id=9rD2GrGrajkmkw5eYFDp2g';
24
  get_soundcloud_is_gold_user_tracks($soundcloudIsGoldXML, $_REQUEST['post_id']);
25
  //testMedia(TRUE);
26
  }
42
  /** Populate the new Soundcloud is Gold Tab **/
43
  function get_soundcloud_is_gold_user_tracks($soundcloudIsGoldApiCall, $post_id){
44
 
45
+ $soundcloudIsGoldUser = get_option('soundcloud_is_gold_user');
46
+ $soundcloudIsGoldSettings = get_option('soundcloud_is_gold_settings');
47
+ $soundcloudIsGoldPlayerType = get_option('soundcloud_is_gold_playerType');
48
  $soundcloudIsGoldPlayerTypeDefault = empty($soundcloudIsGoldPlayerType) ? TRUE : FALSE;
49
+ $soundcloudIsGoldWidthSettings = get_option('soundcloud_is_gold_width_settings');
50
  $soundcloudIsGoldWidth = get_soundcloud_is_gold_default_width($soundcloudIsGoldWidthSettings);
51
+ $soundcloudIsGoldClasses = get_option('soundcloud_is_gold_classes');
52
+ $soundcloudIsGoldColor = get_option('soundcloud_is_gold_color');
53
 
54
  //Sorting Menu
55
  echo '<form id="library-form" class="media-upload-form validate" action="" method="post" enctype="multipart/form-data"><div id="media-items" class="media-items-'.$post_id.'">';
214
  /** **/
215
  /******************************************************/
216
  add_shortcode('soundcloud', 'soundcloud_is_gold_shortcode');
217
+ function soundcloud_is_gold_shortcode($atts){
218
+ $soundcloudIsGoldSettings = get_option('soundcloud_is_gold_settings');
219
+ //Only use lowercase as atts!
220
+ extract( shortcode_atts( array(
221
+ 'id' => '1',
222
+ 'autoplay' => ((!isset($soundcloudIsGoldSettings[0]) || $soundcloudIsGoldSettings[0] == '') ? 'false' : 'true'),
223
+ 'comments' => ((!isset($soundcloudIsGoldSettings[1]) || $soundcloudIsGoldSettings[1] == '') ? 'false' : 'true'),
224
+ 'width' => get_soundcloud_is_gold_default_width(get_option('soundcloud_is_gold_width_settings')),
225
+ 'classes' => get_option('soundcloud_is_gold_classes'),
226
+ 'playertype' => get_option('soundcloud_is_gold_playerType'),
227
+ 'color' => get_option('soundcloud_is_gold_color')
228
+ ), $atts )
229
+ );
230
+ return soundcloud_is_gold_player($id, $autoplay, $comments, $width, $classes, $playertype, $color);
 
231
  }
232
 
233
 
250
  /** The Player **/
251
  function soundcloud_is_gold_player($id, $autoPlay, $comments, $width, $classes, $playerTypes, $color){
252
 
253
+ //Default values: Needed when not called trough shortode (like in the ajax preview)
254
+ $soundcloudIsGoldSettings = get_option('soundcloud_is_gold_settings');
255
+ if(!isset($autoPlay)) $autoPlay = ((!isset($soundcloudIsGoldSettings[0]) || $soundcloudIsGoldSettings[0] == '') ? 'false' : 'true');
256
+ if(!isset($comments)) $comments = ((!isset($soundcloudIsGoldSettings[1]) || $soundcloudIsGoldSettings[1] == '') ? 'false' : 'true');
257
+ if(!isset($width)) $width = get_soundcloud_is_gold_default_width(get_option('soundcloud_is_gold_width_settings'));
258
+ if(!isset($classes)) $classes = get_option('soundcloud_is_gold_classes');
259
+ if(!isset($playerTypes)) $playerTypes = get_option('soundcloud_is_gold_playerType');
260
+ if(!isset($color)) $color = get_option('soundcloud_is_gold_color');
261
+
262
  $color = str_replace('#', '', $color);
263
 
264
  switch($playerTypes){
280
  $player .= '<object height="'.$height.'" width="'.$width.'">';
281
  $player .= '<param name="movie" value="http://player.soundcloud.com/player.swf?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F'.$id.'&amp;auto_play='.$autoPlay.'&amp;player_type='.$playerType.'&amp;show_comments='.$comments.'&amp;color='.$color.'"></param>';
282
  $player .= '<param name="allowscriptaccess" value="always"></param>';
283
+ $player .= '<param name="wmode" value="transparent"></param>';
284
+ $player .= '<embed wmode="transparent" allowscriptaccess="always" height="'.$height.'" src="http://player.soundcloud.com/player.swf?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%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>';
285
  $player .= '</object>';
286
  $player .= '</div>';
287
 
soundcloud-is-gold.php CHANGED
@@ -3,10 +3,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 from the 'soundcloud is gold' tab with the post's 'upload media' popup window. Select, set and add track 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), 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.
6
- Version: 1.0.1
7
  Author: Thomas Michalak at Mighty Mess
8
  Author URI: http://www.mightymess.com/thomas-michalak
9
- License: A "Slug" license name e.g. GPL2
10
  */
11
 
12
  /*
@@ -89,44 +89,44 @@ function get_soundcloud_is_gold_default_width($settings){
89
  return $settings[$settings['type']];
90
  }
91
  function get_soundcloud_is_gold_default_settings_for_js(){
92
- echo 'soundcloudIsGoldUser_default = "'.get_option(soundcloud_is_gold_user).'"; ';
93
- echo 'soundcloudIsGoldPlayerType_default = "'.get_option(soundcloud_is_gold_playerType).'"; ';
94
- $soundcloudIsGoldSettings = get_option(soundcloud_is_gold_settings);
95
- echo 'soundcloudIsGoldAutoPlay_default = '.(($soundcloudIsGoldSettings[0] == '') ? 'false' : 'true') .'; ';
96
- echo 'soundcloudIsGoldComments_default = '.(($soundcloudIsGoldSettings[1] == '') ? 'false' : 'true') .'; ';
97
- echo 'soundcloudIsGoldWidth_default = "'.get_soundcloud_is_gold_default_width(get_option(soundcloud_is_gold_width_settings)).'"; ';
98
- echo 'soundcloudIsGoldClasses_default = "'.get_option(soundcloud_is_gold_classes).'"; ';
99
- echo 'soundcloudIsGoldColor_default = "'.get_option(soundcloud_is_gold_color).'"; ';
100
  }
101
 
102
- add_option(soundcloud_is_gold_user, 't-m');
103
  $soundcloudIsGoldDefaultSettings = array(
104
  false,
105
  true
106
  );
107
- add_option(soundcloud_is_gold_settings, $soundcloudIsGoldDefaultSettings);
108
- add_option(soundcloud_is_gold_playerType, 'Standard');
109
  $soundcloudIsGoldWitdhDefaultSettings = array(
110
  "type" => "custom",
111
  "wp" => "medium",
112
  "custom" => "100%"
113
 
114
  );
115
- add_option(soundcloud_is_gold_width_settings, $soundcloudIsGoldWitdhDefaultSettings);
116
- add_option(soundcloud_is_gold_classes, '');
117
- add_option(soundcloud_is_gold_color, 'ff7700');
118
 
119
  //delete_option(soundcloud_is_gold_width_settings);
120
 
121
  /*** Options Output ***/
122
  function soundcloud_is_gold_options(){
123
- $soundcloudIsGoldUser = get_option(soundcloud_is_gold_user);
124
- $soundcloudIsGoldSettings = get_option(soundcloud_is_gold_settings);
125
- $soundcloudIsGoldPlayerType = get_option(soundcloud_is_gold_playerType);
126
  $soundcloudIsGoldPlayerTypeDefault = empty($soundcloudIsGoldPlayerType) ? TRUE : FALSE;
127
- $soundcloudIsGoldWidthSettings = get_option(soundcloud_is_gold_width_settings);
128
- $soundcloudIsGoldClasses = get_option(soundcloud_is_gold_classes);
129
- $soundcloudIsGoldColor = get_option(soundcloud_is_gold_color);
130
  $soundcouldMMapiCall = 'http://api.soundcloud.com/users/'.$soundcloudIsGoldUser.'/tracks.xml?limit=1&client_id=9rD2GrGrajkmkw5eYFDp2g';
131
  //$soundcouldMMapiCall = PLUGIN_DIR.'tracks.xml';
132
  $soundcouldMMresp = simplexml_load_file($soundcouldMMapiCall);
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 from the 'soundcloud is gold' tab with the post's 'upload media' popup window. Select, set and add track 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), 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.
6
+ Version: 1.0.2
7
  Author: Thomas Michalak at Mighty Mess
8
  Author URI: http://www.mightymess.com/thomas-michalak
9
+ License: GPL2 or Later
10
  */
11
 
12
  /*
89
  return $settings[$settings['type']];
90
  }
91
  function get_soundcloud_is_gold_default_settings_for_js(){
92
+ echo 'soundcloudIsGoldUser_default = "'.get_option('soundcloud_is_gold_user').'"; ';
93
+ echo 'soundcloudIsGoldPlayerType_default = "'.get_option('soundcloud_is_gold_playerType').'"; ';
94
+ $soundcloudIsGoldSettings = get_option('soundcloud_is_gold_settings');
95
+ echo 'soundcloudIsGoldAutoPlay_default = '.((!isset($soundcloudIsGoldSettings[0]) || $soundcloudIsGoldSettings[0] == '') ? 'false' : 'true') .'; ';
96
+ echo 'soundcloudIsGoldComments_default = '.((!isset($soundcloudIsGoldSettings[1]) || $soundcloudIsGoldSettings[1] == '') ? 'false' : 'true') .'; ';
97
+ echo 'soundcloudIsGoldWidth_default = "'.get_soundcloud_is_gold_default_width(get_option('soundcloud_is_gold_width_settings')).'"; ';
98
+ echo 'soundcloudIsGoldClasses_default = "'.get_option('soundcloud_is_gold_classes').'"; ';
99
+ echo 'soundcloudIsGoldColor_default = "'.get_option('soundcloud_is_gold_color').'"; ';
100
  }
101
 
102
+ add_option('soundcloud_is_gold_user', 't-m');
103
  $soundcloudIsGoldDefaultSettings = array(
104
  false,
105
  true
106
  );
107
+ add_option('soundcloud_is_gold_settings', $soundcloudIsGoldDefaultSettings);
108
+ add_option('soundcloud_is_gold_playerType', 'Standard');
109
  $soundcloudIsGoldWitdhDefaultSettings = array(
110
  "type" => "custom",
111
  "wp" => "medium",
112
  "custom" => "100%"
113
 
114
  );
115
+ add_option('soundcloud_is_gold_width_settings', $soundcloudIsGoldWitdhDefaultSettings);
116
+ add_option('soundcloud_is_gold_classes', '');
117
+ add_option('soundcloud_is_gold_color', 'ff7700');
118
 
119
  //delete_option(soundcloud_is_gold_width_settings);
120
 
121
  /*** Options Output ***/
122
  function soundcloud_is_gold_options(){
123
+ $soundcloudIsGoldUser = get_option('soundcloud_is_gold_user');
124
+ $soundcloudIsGoldSettings = get_option('soundcloud_is_gold_settings');
125
+ $soundcloudIsGoldPlayerType = get_option('soundcloud_is_gold_playerType');
126
  $soundcloudIsGoldPlayerTypeDefault = empty($soundcloudIsGoldPlayerType) ? TRUE : FALSE;
127
+ $soundcloudIsGoldWidthSettings = get_option('soundcloud_is_gold_width_settings');
128
+ $soundcloudIsGoldClasses = get_option('soundcloud_is_gold_classes');
129
+ $soundcloudIsGoldColor = get_option('soundcloud_is_gold_color');
130
  $soundcouldMMapiCall = 'http://api.soundcloud.com/users/'.$soundcloudIsGoldUser.'/tracks.xml?limit=1&client_id=9rD2GrGrajkmkw5eYFDp2g';
131
  //$soundcouldMMapiCall = PLUGIN_DIR.'tracks.xml';
132
  $soundcouldMMresp = simplexml_load_file($soundcouldMMapiCall);