SoundCloud Is Gold - Version 1.0.5

Version Description

  • New Soundcloud official Html5 player! Woop Woop!
Download this release

Release Info

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

Code changes from version 1.0.4 to 1.0.5

readme.txt CHANGED
@@ -1,17 +1,19 @@
1
  === SoundCloud Is Gold ===
2
  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
5
  Requires at least: 3.2
6
  Tested up to: 3.2.1
7
- Stable tag: 1.0.4
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
 
11
  == Description ==
12
 
 
 
13
  **Soundcloud is Gold** integrates perfectly into wordpress. Browse through your soundcloud tracks from the 'Soundcloud is gold' tab in 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.
14
- You can set default settings in the option page, choose your defaut soundcloud player (Mini, Standard, Artwork), it's width, add extra classes for you CSS lovers, show comments, autoplay and your favorite color.
15
  You'll also be able to set players to different settings before adding to your post if you fancy a one off change.
16
 
17
  **Soundcloud is Gold** use a shortcode but the "Soundcloud is Gold" tab will write it for you dynamicly as you select parameters, and on top of this it will provide a nice live preview of your player so you know what does what. When done just press the 'insert soundcloud player' and it will added to your post just like when you're adding a photo or gallery.
@@ -25,7 +27,7 @@ Check out my [TM soundcloud profile](http://www.soundcloud.com/t-m), more [might
25
  * Integrates perfectly with wordpress media upload by using the same listing style that you get with the images (see screenshot).
26
  * See track's info directly in the tab (description, url, cover, etc...).
27
  * Set default settings from the option page (see screenshot):
28
- * Default player type (Mini, Standard, Artwork)
29
  * Width
30
  * Extra Classes for the div that wraps around the player
31
  * Auto Play
@@ -33,6 +35,7 @@ Check out my [TM soundcloud profile](http://www.soundcloud.com/t-m), more [might
33
  * Player's Colors
34
  * Use shortcode
35
  * Plugin construct shortode for you, no need to remember any syntax.
 
36
  * Follow WP developpers guidelines (enqueue scripts and styles just for the plugin, clean code, commented, secure and leave no trace when uninstall )
37
 
38
  = Advantages against pasting embed code from soundcloud =
@@ -56,7 +59,7 @@ That's just my opinion of course...
56
  * Trigger live preview when changing Soundcloud user name
57
  * Live search while typing a name in the user name field. So if you're looking for someone it's kind of easier.
58
  * Add 'activities' to a widget
59
- * Iphone fall back with default browser html5 player.
60
 
61
 
62
  == Installation ==
@@ -86,7 +89,7 @@ Remenber that even if a plugin is popular, most of the plugins are badly coded o
86
 
87
  = Can't play my tracks on my iphone, ipad or ipod? =
88
 
89
- Soundcloud doesn't currently give the possibility to developers to fall back to soundcloud html5 player if flash isn't installed or supported by the device. There are solutions but they are lengthy to implement and still not very user friendly. But as soon as it's possible it will be implemented.
90
 
91
  = How can I use the shortcode manually? =
92
 
@@ -126,6 +129,10 @@ When upgrading from 1.0.1 and earlier: All shortcode attributes are now lowercas
126
 
127
  == Changelog ==
128
 
 
 
 
 
129
  = 1.0.4 =
130
  * Faster loading of the tab (only load player's preview when click on 'show')
131
  * Pagination as people with more than 50 tracks couldn't access the rest of their tracks (25 tracks per page)
1
  === SoundCloud Is Gold ===
2
  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.2.1
7
+ Stable tag: 1.0.5
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
 
11
  == Description ==
12
 
13
+ **Now with soundcloud's official html5 player!**
14
+
15
  **Soundcloud is Gold** integrates perfectly into wordpress. Browse through your soundcloud tracks from the 'Soundcloud is gold' tab in 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.
16
+ You can set default settings in the option page, choose your defaut soundcloud player (Mini, Standard, Artwork, Html5), it's width, add extra classes for you CSS lovers, show comments, autoplay and your favorite color.
17
  You'll also be able to set players to different settings before adding to your post if you fancy a one off change.
18
 
19
  **Soundcloud is Gold** use a shortcode but the "Soundcloud is Gold" tab will write it for you dynamicly as you select parameters, and on top of this it will provide a nice live preview of your player so you know what does what. When done just press the 'insert soundcloud player' and it will added to your post just like when you're adding a photo or gallery.
27
  * Integrates perfectly with wordpress media upload by using the same listing style that you get with the images (see screenshot).
28
  * See track's info directly in the tab (description, url, cover, etc...).
29
  * Set default settings from the option page (see screenshot):
30
+ * Default player type (Mini, Standard, Artwork, Html5)
31
  * Width
32
  * Extra Classes for the div that wraps around the player
33
  * Auto Play
35
  * Player's Colors
36
  * Use shortcode
37
  * Plugin construct shortode for you, no need to remember any syntax.
38
+ * Implement Soundcloud Html5 player (beta)
39
  * Follow WP developpers guidelines (enqueue scripts and styles just for the plugin, clean code, commented, secure and leave no trace when uninstall )
40
 
41
  = Advantages against pasting embed code from soundcloud =
59
  * Trigger live preview when changing Soundcloud user name
60
  * Live search while typing a name in the user name field. So if you're looking for someone it's kind of easier.
61
  * Add 'activities' to a widget
62
+ * Fall Back for smartphone to html5 player when using flash player.
63
 
64
 
65
  == Installation ==
89
 
90
  = Can't play my tracks on my iphone, ipad or ipod? =
91
 
92
+ Soundcloud has just released a html5 player. It's currently in it's beta version, which means that there might be bugs. Soundcloud is gold give you the option to use the html5 player but it's either flash all flash or all html5 for now.
93
 
94
  = How can I use the shortcode manually? =
95
 
129
 
130
  == Changelog ==
131
 
132
+ = 1.0.5 =
133
+ * New Soundcloud official Html5 player! Woop Woop!
134
+
135
+
136
  = 1.0.4 =
137
  * Faster loading of the tab (only load player's preview when click on 'show')
138
  * Pagination as people with more than 50 tracks couldn't access the rest of their tracks (25 tracks per page)
soundcloud-is-gold-css.css CHANGED
@@ -43,7 +43,12 @@
43
  display:inline;
44
  margin:0 0 0 30px;
45
  }
46
-
 
 
 
 
 
47
  /****** WIDTH SETTINGS *******/
48
  #soundcloudMMWidthSetting{
49
 
@@ -222,6 +227,7 @@
222
  font-family: ChunkFiveRegular,Georgia;
223
  width: 100%;
224
  background:#333333;
 
225
  }
226
  #soundcloudMMTop #soundcloudMMLogo {
227
  display: block;
@@ -268,7 +274,15 @@
268
  margin-top: 10px;
269
  text-decoration:underline !important;
270
  }
271
-
 
 
 
 
 
 
 
 
272
  #soundcloudMMMain{
273
  float:left;
274
  width:100%;
43
  display:inline;
44
  margin:0 0 0 30px;
45
  }
46
+ .soundcloudMMWrapper .soundcloudMMExample{
47
+ font-size:62%;
48
+ font-style:italic;
49
+ color:#666;
50
+ display:inline;
51
+ }
52
  /****** WIDTH SETTINGS *******/
53
  #soundcloudMMWidthSetting{
54
 
227
  font-family: ChunkFiveRegular,Georgia;
228
  width: 100%;
229
  background:#333333;
230
+ position:relative;
231
  }
232
  #soundcloudMMTop #soundcloudMMLogo {
233
  display: block;
274
  margin-top: 10px;
275
  text-decoration:underline !important;
276
  }
277
+ #soundcloudMMTop #soundcloudMMVersion{
278
+ bottom: 0;
279
+ color: #333333;
280
+ font-family: Arial;
281
+ font-size: 80%;
282
+ font-weight: normal;
283
+ position: absolute;
284
+ right: 1%;
285
+ }
286
  #soundcloudMMMain{
287
  float:left;
288
  width:100%;
soundcloud-is-gold-functions.php CHANGED
@@ -5,7 +5,7 @@
5
  /*** ***/
6
  /*********************************************************************/
7
  function get_soundcloud_is_gold_player_types(){
8
- $m = array('Mini', 'Standard', 'Artwork');
9
  return $m;
10
  }
11
  function get_soundcloud_is_gold_wordpress_sizes(){
@@ -35,6 +35,7 @@ function get_soundcloud_is_gold_default_settings_for_js(){
35
  $soundcloudIsGoldSettings = get_option('soundcloud_is_gold_settings');
36
  echo 'soundcloudIsGoldAutoPlay_default = '.((!isset($soundcloudIsGoldSettings[0]) || $soundcloudIsGoldSettings[0] == '') ? 'false' : 'true') .'; ';
37
  echo 'soundcloudIsGoldComments_default = '.((!isset($soundcloudIsGoldSettings[1]) || $soundcloudIsGoldSettings[1] == '') ? 'false' : 'true') .'; ';
 
38
  echo 'soundcloudIsGoldWidth_default = "'.get_soundcloud_is_gold_default_width(get_option('soundcloud_is_gold_width_settings')).'"; ';
39
  echo 'soundcloudIsGoldClasses_default = "'.get_option('soundcloud_is_gold_classes').'"; ';
40
  echo 'soundcloudIsGoldColor_default = "'.get_option('soundcloud_is_gold_color').'"; ';
@@ -106,7 +107,7 @@ function soundcloud_is_gold_pagination($totalItems, $currentPage, $perPage, $pos
106
  }
107
  /*Add Soundcloud is Gold Plugin to TinyMce*/
108
  function soundcloud_is_gold_mce_plugin($plugin_array) {
109
- $plugin_array['soundcloudIsGold'] = PLUGIN_DIR.'tinymce-plugin/soundcloud-is-gold-editor_plugin.js';
110
  return $plugin_array;
111
  }
112
  function soundcloud_is_gold_mce_button( $buttons ) {
@@ -116,10 +117,17 @@ function soundcloud_is_gold_mce_button( $buttons ) {
116
  }
117
  function soundcloud_is_gold_mce_css($mce_css) {
118
  if (! empty($mce_css)) $mce_css .= ',';
119
- $mce_css .= PLUGIN_DIR.'/tinymce-plugin/soundcloud-is-gold-editor_plugin.css';
120
  return $mce_css;
121
  }
122
 
 
 
 
 
 
 
 
123
  /*********************************************************************/
124
  /*** ***/
125
  /*** SOUNDCLOUD MEDIA UPLOAD TAB ***/
@@ -152,7 +160,7 @@ add_action('media_upload_soundcloud_is_gold', 'soundcloud_is_gold_media_menu_han
152
  /*Add Soundcloud Button to Upload/Insert*/
153
  function plugin_media_button($context) {
154
  global $post_ID;
155
- $plugin_media_button = ' %s' . '<a id="add_soundcloud_is_gold" title="Insert Soundcloud Player" href="media-upload.php?post_id='.$post_ID.'&tab=soundcloud_is_gold&paged=1&TB_iframe=1&width=640&height=584" class="thickbox"><img alt="Insert Soundcloud Player" src="'.PLUGIN_DIR.'soundcloud-is-gold-icon.png"></a>';
156
  return sprintf($context, $plugin_media_button);
157
  }
158
  add_filter('media_buttons_context', 'plugin_media_button');
@@ -215,7 +223,7 @@ function get_soundcloud_is_gold_user_tracks(){
215
  <thead id="media-head-<?php echo $soundcloudIsGoldtrack->id ?>" class="media-item-info">
216
  <tr valign="top">
217
  <td id="thumbnail-head-<?php echo $soundcloudIsGoldtrack->id ?>" class="A1B1">
218
- <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'} : PLUGIN_DIR."/noThumbnail.gif" ?>" class="thumbnail"></a></p>
219
  </td>
220
  <td>
221
  <p><strong>Title:</strong> <?php echo $soundcloudIsGoldtrack->title ?></p>
@@ -238,7 +246,9 @@ function get_soundcloud_is_gold_user_tracks(){
238
  <input type="checkbox" <?php echo ($soundcloudIsGoldSettings[0]) ? 'checked="checked"' : '' ?> id="soundcloudMMAutoPlay-<?php echo $soundcloudIsGoldtrack->id ?>" class="text soundcloudMMAutoPlay">
239
  <label >Play Automaticly</label>
240
  <input type="checkbox" <?php echo ($soundcloudIsGoldSettings[1]) ? 'checked="checked"' : '' ?> id="soundcloudMMShowComments-<?php echo $soundcloudIsGoldtrack->id ?>" class="text soundcloudMMShowComments">
241
- <label >Show track's comments <small>(only for standard version)</small></label>
 
 
242
  <!-- <input type="text" class="soundcloudPlayercolor" value""/> -->
243
 
244
  </td>
@@ -348,13 +358,14 @@ function soundcloud_is_gold_shortcode($atts){
348
  'id' => '1',
349
  'autoplay' => ((!isset($soundcloudIsGoldSettings[0]) || $soundcloudIsGoldSettings[0] == '') ? 'false' : 'true'),
350
  'comments' => ((!isset($soundcloudIsGoldSettings[1]) || $soundcloudIsGoldSettings[1] == '') ? 'false' : 'true'),
 
351
  'width' => get_soundcloud_is_gold_default_width(get_option('soundcloud_is_gold_width_settings')),
352
  'classes' => get_option('soundcloud_is_gold_classes'),
353
  'playertype' => get_option('soundcloud_is_gold_playerType'),
354
  'color' => get_option('soundcloud_is_gold_color')
355
  ), $atts )
356
  );
357
- return soundcloud_is_gold_player($id, $autoplay, $comments, $width, $classes, $playertype, $color);
358
  }
359
 
360
 
@@ -369,22 +380,24 @@ function soundcloud_is_gold_shortcode($atts){
369
  /** Preview **/
370
  add_action('wp_ajax_soundcloud_is_gold_player_preview', 'soundcloud_is_gold_player_preview');
371
  function soundcloud_is_gold_player_preview(){
372
- if(isset($_POST['request'])) echo soundcloud_is_gold_player($_POST['ID'], $_POST['autoPlay'], $_POST['comments'], $_POST['width'], $_POST['classes'], $_POST['playerType'], $_POST['color']);
373
  die;
374
  }
375
 
376
 
377
  /** The Player **/
378
- function soundcloud_is_gold_player($id, $autoPlay, $comments, $width, $classes, $playerTypes, $color){
379
 
380
  //Default values: Needed when not called trough shortode (like in the ajax preview)
381
  $soundcloudIsGoldSettings = get_option('soundcloud_is_gold_settings');
382
  if(!isset($autoPlay)) $autoPlay = ((!isset($soundcloudIsGoldSettings[0]) || $soundcloudIsGoldSettings[0] == '') ? 'false' : 'true');
383
  if(!isset($comments)) $comments = ((!isset($soundcloudIsGoldSettings[1]) || $soundcloudIsGoldSettings[1] == '') ? 'false' : 'true');
 
384
  if(!isset($width)) $width = get_soundcloud_is_gold_default_width(get_option('soundcloud_is_gold_width_settings'));
385
  if(!isset($classes)) $classes = get_option('soundcloud_is_gold_classes');
386
  if(!isset($playerTypes)) $playerTypes = get_option('soundcloud_is_gold_playerType');
387
  if(!isset($color)) $color = get_option('soundcloud_is_gold_color');
 
388
 
389
  $color = str_replace('#', '', $color);
390
 
@@ -401,15 +414,27 @@ function soundcloud_is_gold_player($id, $autoPlay, $comments, $width, $classes,
401
  $playerType = 'tiny';
402
  $height = '18px';
403
  break;
 
 
 
 
404
  }
405
 
406
  $player = '<div class="soundcloudIsGold '.$classes.'" id="soundcloud-'.$id.'">';
407
- $player .= '<object height="'.$height.'" width="'.$width.'">';
408
- $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>';
409
- $player .= '<param name="allowscriptaccess" value="always"></param>';
410
- $player .= '<param name="wmode" value="transparent"></param>';
411
- $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>';
412
- $player .= '</object>';
 
 
 
 
 
 
 
 
413
  $player .= '</div>';
414
 
415
 
5
  /*** ***/
6
  /*********************************************************************/
7
  function get_soundcloud_is_gold_player_types(){
8
+ $m = array('Mini', 'Standard', 'Artwork', 'html5');
9
  return $m;
10
  }
11
  function get_soundcloud_is_gold_wordpress_sizes(){
35
  $soundcloudIsGoldSettings = get_option('soundcloud_is_gold_settings');
36
  echo 'soundcloudIsGoldAutoPlay_default = '.((!isset($soundcloudIsGoldSettings[0]) || $soundcloudIsGoldSettings[0] == '') ? 'false' : 'true') .'; ';
37
  echo 'soundcloudIsGoldComments_default = '.((!isset($soundcloudIsGoldSettings[1]) || $soundcloudIsGoldSettings[1] == '') ? 'false' : 'true') .'; ';
38
+ echo 'soundcloudIsGoldArtwork_default = '.((!isset($soundcloudIsGoldSettings[2]) || $soundcloudIsGoldSettings[2] == '') ? 'false' : 'true') .'; ';
39
  echo 'soundcloudIsGoldWidth_default = "'.get_soundcloud_is_gold_default_width(get_option('soundcloud_is_gold_width_settings')).'"; ';
40
  echo 'soundcloudIsGoldClasses_default = "'.get_option('soundcloud_is_gold_classes').'"; ';
41
  echo 'soundcloudIsGoldColor_default = "'.get_option('soundcloud_is_gold_color').'"; ';
107
  }
108
  /*Add Soundcloud is Gold Plugin to TinyMce*/
109
  function soundcloud_is_gold_mce_plugin($plugin_array) {
110
+ $plugin_array['soundcloudIsGold'] = SIG_PLUGIN_DIR.'tinymce-plugin/soundcloud-is-gold-editor_plugin.js';
111
  return $plugin_array;
112
  }
113
  function soundcloud_is_gold_mce_button( $buttons ) {
117
  }
118
  function soundcloud_is_gold_mce_css($mce_css) {
119
  if (! empty($mce_css)) $mce_css .= ',';
120
+ $mce_css .= SIG_PLUGIN_DIR.'/tinymce-plugin/soundcloud-is-gold-editor_plugin.css';
121
  return $mce_css;
122
  }
123
 
124
+ /* Debug */
125
+ if(!function_exists('printl')){
126
+ function printl($val){
127
+ printf("<pre>%s</pre>", print_r($val, true));
128
+ }
129
+ }
130
+
131
  /*********************************************************************/
132
  /*** ***/
133
  /*** SOUNDCLOUD MEDIA UPLOAD TAB ***/
160
  /*Add Soundcloud Button to Upload/Insert*/
161
  function plugin_media_button($context) {
162
  global $post_ID;
163
+ $plugin_media_button = ' %s' . '<a id="add_soundcloud_is_gold" title="Insert Soundcloud Player" href="media-upload.php?post_id='.$post_ID.'&tab=soundcloud_is_gold&paged=1&TB_iframe=1&width=640&height=584" class="thickbox"><img alt="Insert Soundcloud Player" src="'.SIG_PLUGIN_DIR.'soundcloud-is-gold-icon.png"></a>';
164
  return sprintf($context, $plugin_media_button);
165
  }
166
  add_filter('media_buttons_context', 'plugin_media_button');
223
  <thead id="media-head-<?php echo $soundcloudIsGoldtrack->id ?>" class="media-item-info">
224
  <tr valign="top">
225
  <td id="thumbnail-head-<?php echo $soundcloudIsGoldtrack->id ?>" class="A1B1">
226
+ <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."/noThumbnail.gif" ?>" class="thumbnail"></a></p>
227
  </td>
228
  <td>
229
  <p><strong>Title:</strong> <?php echo $soundcloudIsGoldtrack->title ?></p>
246
  <input type="checkbox" <?php echo ($soundcloudIsGoldSettings[0]) ? 'checked="checked"' : '' ?> id="soundcloudMMAutoPlay-<?php echo $soundcloudIsGoldtrack->id ?>" class="text soundcloudMMAutoPlay">
247
  <label >Play Automaticly</label>
248
  <input type="checkbox" <?php echo ($soundcloudIsGoldSettings[1]) ? 'checked="checked"' : '' ?> id="soundcloudMMShowComments-<?php echo $soundcloudIsGoldtrack->id ?>" class="text soundcloudMMShowComments">
249
+ <label >Show comments <small>(standard and artwork player)</small></label>
250
+ <input type="checkbox" <?php echo ($soundcloudIsGoldSettings[2]) ? 'checked="checked"' : '' ?> id="soundcloudMMShowArtwork-<?php echo $soundcloudIsGoldtrack->id ?>" class="text soundcloudMMShowArtwork">
251
+ <label >Show artwork <small>(html5 player)</small></label>
252
  <!-- <input type="text" class="soundcloudPlayercolor" value""/> -->
253
 
254
  </td>
358
  'id' => '1',
359
  'autoplay' => ((!isset($soundcloudIsGoldSettings[0]) || $soundcloudIsGoldSettings[0] == '') ? 'false' : 'true'),
360
  'comments' => ((!isset($soundcloudIsGoldSettings[1]) || $soundcloudIsGoldSettings[1] == '') ? 'false' : 'true'),
361
+ 'artwork' => ((!isset($soundcloudIsGoldSettings[2]) || $soundcloudIsGoldSettings[2] == '') ? 'false' : 'true'),
362
  'width' => get_soundcloud_is_gold_default_width(get_option('soundcloud_is_gold_width_settings')),
363
  'classes' => get_option('soundcloud_is_gold_classes'),
364
  'playertype' => get_option('soundcloud_is_gold_playerType'),
365
  'color' => get_option('soundcloud_is_gold_color')
366
  ), $atts )
367
  );
368
+ return soundcloud_is_gold_player($id, $autoplay, $comments, $width, $classes, $playertype, $color, $artwork);
369
  }
370
 
371
 
380
  /** Preview **/
381
  add_action('wp_ajax_soundcloud_is_gold_player_preview', 'soundcloud_is_gold_player_preview');
382
  function soundcloud_is_gold_player_preview(){
383
+ if(isset($_POST['request'])) echo soundcloud_is_gold_player($_POST['ID'], $_POST['autoPlay'], $_POST['comments'], $_POST['width'], $_POST['classes'], $_POST['playerType'], $_POST['color'], $_POST['artwork']);
384
  die;
385
  }
386
 
387
 
388
  /** The Player **/
389
+ function soundcloud_is_gold_player($id, $autoPlay, $comments, $width, $classes, $playerTypes, $color, $artwork){
390
 
391
  //Default values: Needed when not called trough shortode (like in the ajax preview)
392
  $soundcloudIsGoldSettings = get_option('soundcloud_is_gold_settings');
393
  if(!isset($autoPlay)) $autoPlay = ((!isset($soundcloudIsGoldSettings[0]) || $soundcloudIsGoldSettings[0] == '') ? 'false' : 'true');
394
  if(!isset($comments)) $comments = ((!isset($soundcloudIsGoldSettings[1]) || $soundcloudIsGoldSettings[1] == '') ? 'false' : 'true');
395
+ if(!isset($artwork)) $artwork = ((!isset($soundcloudIsGoldSettings[2]) || $soundcloudIsGoldSettings[2] == '') ? 'false' : 'true');
396
  if(!isset($width)) $width = get_soundcloud_is_gold_default_width(get_option('soundcloud_is_gold_width_settings'));
397
  if(!isset($classes)) $classes = get_option('soundcloud_is_gold_classes');
398
  if(!isset($playerTypes)) $playerTypes = get_option('soundcloud_is_gold_playerType');
399
  if(!isset($color)) $color = get_option('soundcloud_is_gold_color');
400
+ $html5Player = false;
401
 
402
  $color = str_replace('#', '', $color);
403
 
414
  $playerType = 'tiny';
415
  $height = '18px';
416
  break;
417
+ case 'html5':
418
+ $height = '166px';
419
+ $html5Player = true;
420
+ break;
421
  }
422
 
423
  $player = '<div class="soundcloudIsGold '.$classes.'" id="soundcloud-'.$id.'">';
424
+
425
+ //Flash Player
426
+ if(!$html5Player){
427
+ $player .= '<object height="'.$height.'" width="'.$width.'">';
428
+ $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>';
429
+ $player .= '<param name="allowscriptaccess" value="always"></param>';
430
+ $player .= '<param name="wmode" value="transparent"></param>';
431
+ $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>';
432
+ $player .= '</object>';
433
+ }
434
+ //Html5 Player
435
+ else{
436
+ $player .= '<iframe width="'.$width.'" height="'.$height.'" scrolling="no" frameborder="no" src="http://w.soundcloud.com/player/?url=http%3A%2F%2Fapi.soundcloud.com%2Ftracks%2F'.$id.'&amp;auto_play='.$autoPlay.'&amp;show_artwork='.$artwork.'&amp;color='.$color.'"></iframe>';
437
+ }
438
  $player .= '</div>';
439
 
440
 
soundcloud-is-gold-js.js CHANGED
@@ -47,6 +47,8 @@ jQuery(document).ready(function($){
47
  else autoPlay = true;
48
  if($('.soundcloudMMShowComments:checked', parent).val() == undefined) comments = false;
49
  else comments = true;
 
 
50
 
51
  //Set width
52
  if($(".soundcloudMMWpWidth", parent).is(":checked")) width = $('.soundcloudMMWidth option:selected', parent).val();
@@ -58,9 +60,9 @@ jQuery(document).ready(function($){
58
  });
59
  color = $('.soundcloudMMColor', parent).val();
60
  //Set Shortocode Attributes
61
- if(!parent.hasClass('soundcloudMMOptions')) shortcode(parent, autoPlay, comments, width, classes, playerType, color);
62
  //Refresh Preview if reuqested
63
- if(refresh) preview(parent, autoPlay, comments, width, classes, playerType, color);
64
 
65
  };
66
 
@@ -86,21 +88,23 @@ jQuery(document).ready(function($){
86
  /********************************************/
87
  /** SHORTCODE **/
88
  /********************************************/
89
- function shortcode(parent, autoPlay, comments, width, classes, playerType, color){
90
  var shortcode = "soundcloud id='"+getID($('.soundcloudMMId', parent))+"'";
91
  if(comments != soundcloudIsGoldComments_default) shortcode += " comments='"+comments+"'";
 
92
  if(playerType != soundcloudIsGoldPlayerType_default) shortcode += " playerType='"+playerType+"'";
93
  if(autoPlay != soundcloudIsGoldAutoPlay_default) shortcode += " autoPlay='"+autoPlay+"'";
94
  if(width != soundcloudIsGoldWidth_default) shortcode += " width='"+width+"'";
95
  if(classes != soundcloudIsGoldClasses_default) shortcode += " classes='"+classes+"'";
96
  if(color != soundcloudIsGoldColor_default) shortcode += " color='"+color+"'";
 
97
  $('.soundcloudMMShortcode', parent).val("["+shortcode+"]");
98
  }
99
 
100
  /********************************************/
101
  /** PREVIEW **/
102
  /********************************************/
103
- function preview(parent, autoPlay, comments, width, classes, playerType, color){
104
  //Animate transition
105
  switch(playerType){
106
  case 'Mini':
@@ -112,6 +116,9 @@ jQuery(document).ready(function($){
112
  case 'Artwork':
113
  newHeight = width;
114
  break;
 
 
 
115
  }
116
  //Tell user it's loading
117
  $('.soundcloudMMEmbed', parent).fadeOut('fast', function(){
@@ -130,6 +137,7 @@ jQuery(document).ready(function($){
130
  ID: getID($('.soundcloudMMId', parent)),
131
  comments: comments,
132
  autoPlay: autoPlay,
 
133
  width: width,
134
  classes: classes,
135
  playerType: playerType,
47
  else autoPlay = true;
48
  if($('.soundcloudMMShowComments:checked', parent).val() == undefined) comments = false;
49
  else comments = true;
50
+ if($('.soundcloudMMShowArtwork:checked', parent).val() == undefined) artwork = false;
51
+ else artwork = true;
52
 
53
  //Set width
54
  if($(".soundcloudMMWpWidth", parent).is(":checked")) width = $('.soundcloudMMWidth option:selected', parent).val();
60
  });
61
  color = $('.soundcloudMMColor', parent).val();
62
  //Set Shortocode Attributes
63
+ if(!parent.hasClass('soundcloudMMOptions')) shortcode(parent, autoPlay, comments, width, classes, playerType, color, artwork);
64
  //Refresh Preview if reuqested
65
+ if(refresh) preview(parent, autoPlay, comments, width, classes, playerType, color, artwork);
66
 
67
  };
68
 
88
  /********************************************/
89
  /** SHORTCODE **/
90
  /********************************************/
91
+ function shortcode(parent, autoPlay, comments, width, classes, playerType, color, artwork){
92
  var shortcode = "soundcloud id='"+getID($('.soundcloudMMId', parent))+"'";
93
  if(comments != soundcloudIsGoldComments_default) shortcode += " comments='"+comments+"'";
94
+ if(artwork != soundcloudIsGoldArtwork_default) shortcode += " artwork='"+artwork+"'";
95
  if(playerType != soundcloudIsGoldPlayerType_default) shortcode += " playerType='"+playerType+"'";
96
  if(autoPlay != soundcloudIsGoldAutoPlay_default) shortcode += " autoPlay='"+autoPlay+"'";
97
  if(width != soundcloudIsGoldWidth_default) shortcode += " width='"+width+"'";
98
  if(classes != soundcloudIsGoldClasses_default) shortcode += " classes='"+classes+"'";
99
  if(color != soundcloudIsGoldColor_default) shortcode += " color='"+color+"'";
100
+
101
  $('.soundcloudMMShortcode', parent).val("["+shortcode+"]");
102
  }
103
 
104
  /********************************************/
105
  /** PREVIEW **/
106
  /********************************************/
107
+ function preview(parent, autoPlay, comments, width, classes, playerType, color, artwork){
108
  //Animate transition
109
  switch(playerType){
110
  case 'Mini':
116
  case 'Artwork':
117
  newHeight = width;
118
  break;
119
+ case 'html5':
120
+ newHeight = '166px';
121
+ break;
122
  }
123
  //Tell user it's loading
124
  $('.soundcloudMMEmbed', parent).fadeOut('fast', function(){
137
  ID: getID($('.soundcloudMMId', parent)),
138
  comments: comments,
139
  autoPlay: autoPlay,
140
+ artwork: artwork,
141
  width: width,
142
  classes: classes,
143
  playerType: playerType,
soundcloud-is-gold.php CHANGED
@@ -2,8 +2,8 @@
2
  /*
3
  Plugin Name: Soundcloud is Gold
4
  Plugin URI: http://www.mightymess.com/soundcloud-is-gold-wordpress-plugin
5
- Description: <strong><a href="http://www.mightymess.com/soundcloud-is-gold-wordpress-plugin">Soundcloud is gold</a></strong> integrates perfectly into wordpress. Browse through your soundcloud tracks 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.4
7
  Author: Thomas Michalak at Mighty Mess
8
  Author URI: http://www.mightymess.com/thomas-michalak
9
  License: GPL2 or Later
@@ -14,19 +14,27 @@ License: GPL2 or Later
14
  mini: h = 18, w = 100%
15
  standard: h = 81, w = 100%
16
  artwork: h = 300, w = 300
 
17
  */
18
 
19
- define ('PLUGIN_DIR', WP_PLUGIN_URL.'/'.str_replace(basename( __FILE__),"",plugin_basename(__FILE__)) );
20
  require_once('soundcloud-is-gold-functions.php');
21
 
 
 
 
 
 
 
 
22
  /*** Plugin Init ***/
23
  add_action( 'admin_init', 'soundcloud_is_gold_admin_init' );
24
  function soundcloud_is_gold_admin_init() {
25
- wp_register_script('soundcloud-is-gold-js', PLUGIN_DIR.'soundcloud-is-gold-js.js', array('jquery', 'farbtastic'));
26
- wp_register_style('soundcloud-is-gold-css', PLUGIN_DIR.'soundcloud-is-gold-css.css');
27
- wp_register_style('ChunkFive', PLUGIN_DIR.'ChunkFive-fontfacekit/stylesheet.css');
28
- wp_register_style('Quicksand', PLUGIN_DIR.'Quicksand-fontfacekit/stylesheet.css');
29
- wp_register_style('soundcloud-is-gold-editor-css', PLUGIN_DIR.'tinymce-plugin/soundcloud-is-gold-editor_plugin.css');
30
  }
31
  //Plugin option scripts
32
  function soundcloud_is_gold_option_scripts() {
@@ -46,7 +54,7 @@ function soundcloud_is_gold_option_fonts() {
46
  /*** Add Admin Menu ***/
47
  add_action('admin_menu', 'soundcloud_is_gold_menu');
48
  function soundcloud_is_gold_menu() {
49
- $soundcloudIsGoldPage = add_menu_page('Soundcloud is Gold: Options', 'Soundcloud is Gold', 'activate_plugins', 'soundcloud-is-gold.php', 'soundcloud_is_gold_options', PLUGIN_DIR.'soundcloud-is-gold-icon.png');
50
  add_action( "admin_print_scripts-$soundcloudIsGoldPage", 'soundcloud_is_gold_option_scripts' ); // Add script
51
  add_action( "admin_print_styles-$soundcloudIsGoldPage", 'soundcloud_is_gold_option_styles' ); // Add Style
52
  add_action( "admin_print_styles-$soundcloudIsGoldPage", 'soundcloud_is_gold_option_fonts' ); // Add Fonts
@@ -72,7 +80,8 @@ add_option('soundcloud_is_gold_user', $soundcloudIsGoldDefaultUsers[array_rand($
72
 
73
  $soundcloudIsGoldDefaultSettings = array(
74
  false,
75
- true
 
76
  );
77
  add_option('soundcloud_is_gold_settings', $soundcloudIsGoldDefaultSettings);
78
  add_option('soundcloud_is_gold_playerType', 'Standard');
@@ -117,11 +126,12 @@ function soundcloud_is_gold_options(){
117
  <div class="soundcloudMMWrapper soundcloudMMOptions">
118
 
119
  <div id="soundcloudMMTop" class="darkGreyGradient">
120
- <a id="soundcloudMMLogo" class="orangeGradient" href="http://www.soundcloud.com" title="visit SoundCloud website"><img src="<?php echo PLUGIN_DIR ?>/soundcloud-logo-sc.png" width="107" height="71" alt="Soundcloud Logo"/></a>
121
  <a id="soundcloudMMHeader" class="mediumGreyGradient textShadow" href="http://www.mightymess.com/soundcloud-is-gold-wordpress-plugin" alt="Visit Mighty Mess for more cool stuff">
122
  <span class="soundcloudMMTitle">SoundCloud is gold <small>by Thomas Michalak</small></span>
123
  <span class="soundcloudMMUrl">www.mightymess.com/soundcloud-is-gold-wordpress-plugin</span>
124
  </a>
 
125
  </div>
126
 
127
  <div id="soundcloudMMMain" class="lightBlueGradient">
@@ -133,14 +143,15 @@ function soundcloud_is_gold_options(){
133
  <li class="soundcloudMMBox"><label>Default Settings</label>
134
  <ul class="subSettings checkboxes">
135
  <li><input type="checkbox" <?php echo (isset($soundcloudIsGoldSettings[0]) && $soundcloudIsGoldSettings[0]) ? 'checked="checked"' : ''?> name="soundcloud_is_gold_settings[0]" value="true" class="soundcloudMMAutoPlay" id="soundcloudMMAutoPlay"/><label for="soundcloudMMAutoPlay">Play Automatically</label></li>
136
- <li><input type="checkbox" <?php echo (isset($soundcloudIsGoldSettings[1]) && $soundcloudIsGoldSettings[1]) ? 'checked="checked"' : ''?> name="soundcloud_is_gold_settings[1]" value="true" class="soundcloudMMShowComments" id="soundcloudMMShowComments"/><label for="soundcloudMMShowComments">Show track's comments <small>(only for Default and Artwork versions)</small></label></li>
 
137
  </ul>
138
  </li>
139
  <li class="soundcloudMMBox"><label>Default Player Type</label>
140
  <ul class="subSettings radios">
141
  <?php
142
  foreach(get_soundcloud_is_gold_player_types() as $type) : ?>
143
- <li><input name="soundcloud_is_gold_playerType" id="<?php echo $type ?>" class="soundcloudMMPlayerType" type="radio" value="<?php echo $type ?>" <?php if($soundcloudIsGoldPlayerTypeDefault && $type == 'Standard') echo 'checked="checked"'; else echo ($soundcloudIsGoldPlayerType === $type) ? 'checked="checked"' : '' ?> /><label for="<?php echo $type ?>"><?php echo $type; if($type == 'Artwork') echo ' <small>(not available on free soundcloud account)</small>' ?></label></li>
144
  <?php endforeach; ?>
145
  </ul>
146
  </li>
2
  /*
3
  Plugin Name: Soundcloud is Gold
4
  Plugin URI: http://www.mightymess.com/soundcloud-is-gold-wordpress-plugin
5
+ Description: <strong><a href="http://www.mightymess.com/soundcloud-is-gold-wordpress-plugin">Soundcloud is gold</a></strong> integrates perfectly into wordpress. Browse through your soundcloud tracks 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, html5), its width, extra classes for you CSS lovers and your favorite colors. You'll still be able to set players to different settings before adding to your post if you fancy a one off change. Now with Html5 player!
6
+ Version: 1.0.5
7
  Author: Thomas Michalak at Mighty Mess
8
  Author URI: http://www.mightymess.com/thomas-michalak
9
  License: GPL2 or Later
14
  mini: h = 18, w = 100%
15
  standard: h = 81, w = 100%
16
  artwork: h = 300, w = 300
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 **/
24
+ function get_soundcloud_is_gold_version() {
25
+ $plugin_data = get_plugin_data( __FILE__ );
26
+ $plugin_version = $plugin_data['Version'];
27
+ return $plugin_version;
28
+ }
29
+
30
  /*** Plugin Init ***/
31
  add_action( 'admin_init', 'soundcloud_is_gold_admin_init' );
32
  function soundcloud_is_gold_admin_init() {
33
+ wp_register_script('soundcloud-is-gold-js', SIG_PLUGIN_DIR.'soundcloud-is-gold-js.js', array('jquery', 'farbtastic'));
34
+ wp_register_style('soundcloud-is-gold-css', SIG_PLUGIN_DIR.'soundcloud-is-gold-css.css');
35
+ wp_register_style('ChunkFive', SIG_PLUGIN_DIR.'ChunkFive-fontfacekit/stylesheet.css');
36
+ wp_register_style('Quicksand', SIG_PLUGIN_DIR.'Quicksand-fontfacekit/stylesheet.css');
37
+ wp_register_style('soundcloud-is-gold-editor-css', SIG_PLUGIN_DIR.'tinymce-plugin/soundcloud-is-gold-editor_plugin.css');
38
  }
39
  //Plugin option scripts
40
  function soundcloud_is_gold_option_scripts() {
54
  /*** Add Admin Menu ***/
55
  add_action('admin_menu', 'soundcloud_is_gold_menu');
56
  function soundcloud_is_gold_menu() {
57
+ $soundcloudIsGoldPage = add_menu_page('Soundcloud is Gold: Options', 'Soundcloud is Gold', 'activate_plugins', 'soundcloud-is-gold.php', 'soundcloud_is_gold_options', SIG_PLUGIN_DIR.'soundcloud-is-gold-icon.png');
58
  add_action( "admin_print_scripts-$soundcloudIsGoldPage", 'soundcloud_is_gold_option_scripts' ); // Add script
59
  add_action( "admin_print_styles-$soundcloudIsGoldPage", 'soundcloud_is_gold_option_styles' ); // Add Style
60
  add_action( "admin_print_styles-$soundcloudIsGoldPage", 'soundcloud_is_gold_option_fonts' ); // Add Fonts
80
 
81
  $soundcloudIsGoldDefaultSettings = array(
82
  false,
83
+ true,
84
+ true
85
  );
86
  add_option('soundcloud_is_gold_settings', $soundcloudIsGoldDefaultSettings);
87
  add_option('soundcloud_is_gold_playerType', 'Standard');
126
  <div class="soundcloudMMWrapper soundcloudMMOptions">
127
 
128
  <div id="soundcloudMMTop" class="darkGreyGradient">
129
+ <a id="soundcloudMMLogo" class="orangeGradient" href="http://www.soundcloud.com" title="visit SoundCloud website"><img src="<?php echo SIG_PLUGIN_DIR ?>/soundcloud-logo-sc.png" width="107" height="71" alt="Soundcloud Logo"/></a>
130
  <a id="soundcloudMMHeader" class="mediumGreyGradient textShadow" href="http://www.mightymess.com/soundcloud-is-gold-wordpress-plugin" alt="Visit Mighty Mess for more cool stuff">
131
  <span class="soundcloudMMTitle">SoundCloud is gold <small>by Thomas Michalak</small></span>
132
  <span class="soundcloudMMUrl">www.mightymess.com/soundcloud-is-gold-wordpress-plugin</span>
133
  </a>
134
+ <p id="soundcloudMMVersion">version <?php echo get_soundcloud_is_gold_version() ?></p>
135
  </div>
136
 
137
  <div id="soundcloudMMMain" class="lightBlueGradient">
143
  <li class="soundcloudMMBox"><label>Default Settings</label>
144
  <ul class="subSettings checkboxes">
145
  <li><input type="checkbox" <?php echo (isset($soundcloudIsGoldSettings[0]) && $soundcloudIsGoldSettings[0]) ? 'checked="checked"' : ''?> name="soundcloud_is_gold_settings[0]" value="true" class="soundcloudMMAutoPlay" id="soundcloudMMAutoPlay"/><label for="soundcloudMMAutoPlay">Play Automatically</label></li>
146
+ <li><input type="checkbox" <?php echo (isset($soundcloudIsGoldSettings[1]) && $soundcloudIsGoldSettings[1]) ? 'checked="checked"' : ''?> name="soundcloud_is_gold_settings[1]" value="true" class="soundcloudMMShowComments" id="soundcloudMMShowComments"/><label for="soundcloudMMShowComments">Show comments <small>(Standard and Artwork player)</small></label></li>
147
+ <li><input type="checkbox" <?php echo (isset($soundcloudIsGoldSettings[2]) && $soundcloudIsGoldSettings[2]) ? 'checked="checked"' : ''?> name="soundcloud_is_gold_settings[2]" value="true" class="soundcloudMMShowArtwork" id="soundcloudMMShowArtwork"/><label for="soundcloudMMShowArtwork">Show Artwork <small>(html5 player)</small></label></li>
148
  </ul>
149
  </li>
150
  <li class="soundcloudMMBox"><label>Default Player Type</label>
151
  <ul class="subSettings radios">
152
  <?php
153
  foreach(get_soundcloud_is_gold_player_types() as $type) : ?>
154
+ <li><input name="soundcloud_is_gold_playerType" id="<?php echo $type ?>" class="soundcloudMMPlayerType" type="radio" value="<?php echo $type ?>" <?php if($soundcloudIsGoldPlayerTypeDefault && $type == 'Standard') echo 'checked="checked"'; else echo ($soundcloudIsGoldPlayerType === $type) ? 'checked="checked"' : '' ?> /><label for="<?php echo $type ?>"><?php echo $type; if($type == 'Artwork') echo ' <small>(not available on free soundcloud account)</small>'; if($type == 'html5') echo ' <small>new! (beta)</small>' ?></label></li>
155
  <?php endforeach; ?>
156
  </ul>
157
  </li>