SoundCloud Is Gold - Version 2.5

Version Description

  • You can now change playlists' height!
  • Mini player is back!! You can now Force the player height to show the Mini Player.
  • When adding a user, if you put the whole url, the plugin will work out your username.
  • Update how users are created for first time install so it's using user id and not username.
  • The plugin is translation ready!! To celebrate I've translated it in French (Should be approved soon).
  • Updated the disclaimer message for people with no tracks/playlists.
  • Minors text changes for labels and instructions.
  • Removed survey from the plugin admin panel. Thanks everyone!
  • Screenshots were removed from the actual plugin, so that's a smaller plugin for.
Download this release

Release Info

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

Code changes from version 2.4.3 to 2.5

readme.txt CHANGED
@@ -1,61 +1,68 @@
1
  === SoundCloud Is Gold ===
2
- Contributors: https://wordpress.org/support/users/realtm/
3
- Donate link: http://www.mightymess.com/soundcloud-is-gold-wordpress-plugin
4
- Tags: soundcloud, simple, shortcode, music, sound
5
  Requires at least: 3.2
6
  Tested up to: 4.9.4
7
- Stable tag: 2.4.3
8
 
9
- Browse through your soundcloud tracks, playlists and favorites. Add tracks, playlists and favorites to your posts. Live preview, easy to use.
10
 
11
  == Description ==
12
 
13
- **Thank you to everyone who took the time to respond to the survey! I will take some time to review it and prioritise updates, again, thanks a lot you guys are awesome!**
14
 
15
- **New Widget to display latest and random track, favorites or sets for one user, multiple users or random users.**
16
 
17
- **Soundcloud is Gold** integrates perfectly into wordpress. Browse through your soundcloud tracks, playlists and favorites from the 'Soundcloud is gold' tab in the post's 'upload media' popup window. Select, set and add track, playlists, favorites to your post using the soundcloud player. Live Preview, easy, smart and straightforward.
18
- You can set default settings in the option page, choose your defaut soundcloud player style, it's width, add extra classes for you CSS lovers, show comments, autoplay and set your favorite color.
19
- You'll also be able to set players to different settings before adding to your post if you fancy a one off change.
20
 
21
- **Save multiple users, very useful for labels, collectives or artists with many projects.**
22
 
23
- **Soundcloud is Gold** use a shortcode but the "Soundcloud is Gold" tab will write it for you dynamically as you select parameters, and on top of this it will provide a nice live preview of your player so you know what does what. When done just press the 'insert soundcloud player' and it will added to your post just like when you're adding a photo or gallery.
 
24
 
25
- If you love it please rate it! If you use it and want to help, [donations are always welcomed](http://www.mightymess.com/soundcloud-is-gold-wordpress-plugin) or you could like, tweet or spread the love on your blog ;)
26
 
27
- Latest developments updates on twitter: [#soundcloudisgold](https://twitter.com/#!/search/realtime/%23soundcloudisgold) or follow me on [twitter](http://twitter.com/#!/mighty_mess)
 
28
 
29
- Check out my [TM soundcloud profile](http://www.soundcloud.com/t-m), more [mighty mess](http://www.mightymess.com).
30
 
31
- = Features =
32
 
33
- * Browse through your soundcloud tracks, sets and favorites from a tab in the media upload window (see screenshot), no need to go back and forth between soundcloud and your website.
34
- * Save multiple users, very useful for labels, collectives or artists with many projects
35
- * Live Preview in the Tab, see what does what instantly (see screenshot).
36
- * Integrates perfectly with wordpress media upload by using the same listing style that you get with the images (see screenshot).
37
- * See track's info directly in the tab (description, url, cover, etc...).
38
- * Set default settings from the option page (see screenshot):
 
 
39
  * Default player type (Standard, Artwork, Visual)
40
  * Width
41
  * Extra Classes for the div that wraps around the player
42
  * Auto Play
43
  * Show/Hide Comments
44
- * Player's Colors
45
- * Use shortcode
46
- * Plugin construct shortode for you, no need to remember any syntax.
47
- * Styled sortcode for neat layout in your editor.
48
  * Implement Soundcloud Html5 player.
49
- * Widget for showing latest and random track, favorites or sets for one user, multiple users or random users.
50
  * Follow WP developpers guidelines (enqueue scripts and styles just for the plugin, clean code, commented, secure and leave no trace when uninstall ).
51
  * https support
52
 
53
- = Advantages against pasting embed code from soundcloud =
54
 
55
- * By changing the main settings in the options, all players on your site using the default settings will change. If green isn't trendy anymore and black is the new white, it won't be a problem and you keep your street credibility safe.
56
- * If Soundcloud update their player or release a even cooler new player that let you scratch your track while streaming to google+, I will most defenetly update the plugin to use those new features.
 
 
 
57
 
58
- That's just my opinion of course...
 
 
 
 
 
 
59
 
60
 
61
  == RoadMap ==
@@ -81,7 +88,8 @@ That's just my opinion of course...
81
 
82
  == Installation ==
83
 
84
- Just follow the usual procedure. Log on to your wordpress, go to plugin -> add new -> search 'Soundcloud is Gold' -> click install
 
85
 
86
 
87
 
@@ -138,16 +146,27 @@ Sometimes, I generally keep a eye on my plugin's forums and website's comments.
138
 
139
  == Screenshots ==
140
 
141
- 1. screenshot-1.png
142
- 2. screenshot-2.png
143
- 3. screenshot-3.png
144
- 4. screenshot-4.png
145
- 4. screenshot-5.png
146
- 4. screenshot-6.png
147
 
148
 
149
  == Changelog ==
150
 
 
 
 
 
 
 
 
 
 
 
 
151
  = 2.4.3 =
152
  * Fixed apostrophe bug in the shortcode when trying to insert
153
 
1
  === SoundCloud Is Gold ===
2
+ Contributors: realtm
3
+ Donate link: https://www.paypal.com/donate/?token=BWzoCeVKupkWFJQ7nIA-0il0ndBxJOConYsL8hEYVgQHTMPaKM6bjYu0GqHO7aE2j0px_m
4
+ Tags: soundcloud, simple, shortcode, music, sound, podcasts, widget
5
  Requires at least: 3.2
6
  Tested up to: 4.9.4
7
+ Stable tag: 2.5
8
 
9
+ Browse and insert Soundcloud tracks, playlists and favourites to your posts. Live preview and customise your player to fit your website's design.
10
 
11
  == Description ==
12
 
13
+ Browse and insert your or someone else tracks, playlists and favourites to your posts using SoundCloud's official player. The live preview makes it easy to see how customising your player will fit perfectly with your website’s design.
14
 
15
+ It’s smart, secure and just works.
16
 
17
+ You can set a default style for all players but if needed, you will be able to tweak the styling for one particular player. Soundcloud is Gold is currently helping 10,000 music lovers getting their work out there!
 
 
18
 
19
+  
20
 
21
+ >All you need from a Soundcloud Plugin - Easy to install and to set up, good looking in both widget and full-width style.
22
+ >⭐️⭐️⭐️⭐️⭐️ - @goamazinghostel - [read full review](https://wordpress.org/support/topic/all-you-need-from-a-soundcloud-plugin/)
23
 
24
+  
25
 
26
+ >Works Perfectly. This plugin made adding Soundcloud a trivial effort.
27
+ >⭐️⭐️⭐️⭐️⭐️ - @fssbob - [read full review](https://wordpress.org/support/topic/works-perfectly-1037/)
28
 
29
+  
30
 
31
+ == Top Features ==
32
 
33
+ * **Browse** through your or someone lese soundcloud tracks, sets and favourites from a tab in the media upload window, no need to go back and forth between Soundcloud and your website.
34
+ * **Save multiple users**, very useful for labels, collectives or artists with many projects
35
+ * **Live Preview** let you see what does what instantly.
36
+ * **Integrates perfectly** with wordpress media upload by using the same listing style that you get with the images.
37
+ * **Plugin construct the shortode for you**, no need to remember any crasy syntax (but you can still use the shortcode manually if needed).
38
+ * **Widget** for showing the latest or random tracks, favourites or sets for one user, multiple users or random users.
39
+ * **Track's info** displayed directly in the tab (description, url, cover, etc...).
40
+ * Default settings from the option page (see screenshot):
41
  * Default player type (Standard, Artwork, Visual)
42
  * Width
43
  * Extra Classes for the div that wraps around the player
44
  * Auto Play
45
  * Show/Hide Comments
46
+ * Player's Colours
47
+ * Styled sortcode in editor for neat layout.
 
 
48
  * Implement Soundcloud Html5 player.
 
49
  * Follow WP developpers guidelines (enqueue scripts and styles just for the plugin, clean code, commented, secure and leave no trace when uninstall ).
50
  * https support
51
 
 
52
 
53
+ = Advantages against pasting embed code from soundcloud and other plugins =
54
+
55
+ * By changing the main settings in the options, all players on your site using the default settings will change. If green isn't trendy anymore and purple is the new orange, it won't be a problem and you will keep your street credibility.
56
+ * If Soundcloud update their player or release an even cooler new player that let you scratch your track while streaming to snapchat, I will most defenetly update the plugin to use those new features.
57
+ * **Soundcloud is Gold** use a shortcode but the "Soundcloud is Gold" tab will write it for you dynamically 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.
58
 
59
+
60
+
61
+ == Keep it alive! ==
62
+
63
+ If you love it please rate it! If you use it and want to help, [donations are always welcomed](http://www.mightymess.com/soundcloud-is-gold-wordpress-plugin) or you could like, tweet or spread the love on your blog ;)
64
+
65
+ Latest developments updates on twitter: [#soundcloudisgold](https://twitter.com/#!/search/realtime/%23soundcloudisgold) or follow me on [twitter](http://twitter.com/#!/mighty_mess)
66
 
67
 
68
  == RoadMap ==
88
 
89
  == Installation ==
90
 
91
+ Just follow the usual procedure. Log on to your wordpress, go to plugin 👉 Add New 👉 search 'Soundcloud is Gold' 👉 click install.
92
+
93
 
94
 
95
 
146
 
147
  == Screenshots ==
148
 
149
+ 1. Main options
150
+ 2. Color Customisation
151
+ 3. Editor view
152
+ 4. Adding a Track
153
+ 4. Adding a Playlist
154
+ 4. Widget Options
155
 
156
 
157
  == Changelog ==
158
 
159
+ = 2.5 =
160
+ * 🤟 You can now change playlists' height!
161
+ * 🤟 Mini player is back!! You can now Force the player height to show the Mini Player.
162
+ * 🤟 When adding a user, if you put the whole url, the plugin will work out your username.
163
+ * 🤖 Update how users are created for first time install so it's using user id and not username.
164
+ * 🇫🇷 The plugin is translation ready!! To celebrate I've translated it in French (Should be approved soon).
165
+ * ✍🏻 Updated the disclaimer message for people with no tracks/playlists.
166
+ * ✍🏻 Minors text changes for labels and instructions.
167
+ * 💥 Removed survey from the plugin admin panel. Thanks everyone!
168
+ * 💥 Screenshots were removed from the actual plugin, so that's a smaller plugin for.
169
+
170
  = 2.4.3 =
171
  * Fixed apostrophe bug in the shortcode when trying to insert
172
 
screenshot-1.png DELETED
Binary file
screenshot-2.png DELETED
Binary file
screenshot-3.png DELETED
Binary file
screenshot-4.png DELETED
Binary file
screenshot-5.png DELETED
Binary file
screenshot-6.png DELETED
Binary file
soundcloud-is-gold-advance.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ function soundcloud_is_gold_advance_options() {
3
+
4
+ //Output Options Header
5
+ soundcloud_options_header();
6
+ ?>
7
+
8
+ <form method="post" action="options.php" id="soundcloudMMMainForm" name="soundcloudMMMainForm" class="">
9
+ <p class="hidden soundcloudMMId" id="soundcloudMMId-<?php echo $soundcouldMMId ?>"><?php echo $soundcouldMMId ?></p>
10
+ <?php settings_fields('soundcloud_is_gold_options'); ?>
11
+ <ul id="soundcloudMMSettings">
12
+ <!-- Color and Classes -->
13
+ <li class="soundcloudMMBox"><label class="optionLabel">Soundcloud</label>
14
+ <ul class="subSettings texts">
15
+ <li class="clear">
16
+ <label>Your API key</label>
17
+ <input class="soundcloudMMInput soundcloudMMClasses" type="text" name="soundcloud_is_gold_options[soundcloud_is_gold_classes]" value="<" />
18
+ </li>
19
+ </ul>
20
+ </li>
21
+ </ul>
22
+ </form>
23
+
24
+ <?php
25
+ //Output Options Footer
26
+ soundcloud_options_footer();
27
+ }
28
+ ?>
soundcloud-is-gold-css.css CHANGED
@@ -505,6 +505,7 @@ select.soundcloudMMInput option{
505
  .subSettings{
506
  display: inline;
507
  margin: 0 0 0 0;
 
508
  font-size:80%;
509
  }
510
  .subSettings li{
505
  .subSettings{
506
  display: inline;
507
  margin: 0 0 0 0;
508
+ padding-bottom: 10px;
509
  font-size:80%;
510
  }
511
  .subSettings li{
soundcloud-is-gold-dev.php DELETED
@@ -1,3 +0,0 @@
1
- <?php
2
- ?>
3
- <p> Enter your own API key </p>
 
 
 
soundcloud-is-gold-functions.php CHANGED
@@ -42,8 +42,10 @@ function get_soundcloud_is_gold_default_settings_for_js(){
42
  echo 'soundcloudIsGoldComments_default = '.((!isset($soundcloudIsGoldSettings[1]) || $soundcloudIsGoldSettings[1] == '') ? 'false' : 'true') .'; ';
43
  echo 'soundcloudIsGoldArtwork_default = '.((!isset($soundcloudIsGoldSettings[2]) || $soundcloudIsGoldSettings[2] == '') ? 'false' : 'true') .'; ';
44
  echo 'soundcloudIsGoldVisual_default = '.((!isset($soundcloudIsGoldSettings[3]) || $soundcloudIsGoldSettings[3] == '') ? 'false' : 'true') .'; ';
 
45
  echo 'soundcloudIsGoldWidth_default = "'.get_soundcloud_is_gold_default_width($soundcloudIsGoldWidthSettings).'"; ';
46
  echo 'soundcloudIsGoldHeight_default = '.((!isset($soundcloudIsGoldHeightSettings['square']) || $soundcloudIsGoldSettings['square'] == '') ? 'true' : 'false') .'; ';
 
47
  echo 'soundcloudIsGoldClasses_default = "'.$soundcloudIsGoldClasses.'"; ';
48
  echo 'soundcloudIsGoldColor_default = "'.$soundcloudIsGoldColor.'"; ';
49
  }
@@ -80,12 +82,12 @@ function get_soundcloud_is_gold_username_interface($options, $soundcloudIsGoldUs
80
  <ul id="soundcloudIsGoldAddUserContainer">
81
  <li class="soundcloudMMLoading" style="display:none">&nbsp;</li>
82
  <li id="soundcloudIsGoldUserError" class="orangeGradient soundcloudMMRounder">
83
- <p>error message</p>
84
- <a href="#" class="soundcloudMMBt soundcloudMMBtSmall blue soundcloudMMRounder ">close</a>
85
  </li>
86
  <li>
87
  <input type="text" name="soundcloudIsGoldNewUser" id="soundcloudIsGoldNewUser"/>
88
- <a id="soundcloudIsGoldAddUser" href="#" class="soundcloudMMBt blue soundcloudMMRounder soundcloudMMBtSmall" />Add Username</a>
89
  </li>
90
  </ul>
91
  <!-- All inactive Users -->
@@ -256,7 +258,7 @@ function get_soundcloud_is_gold_api_response($soundcloudIsGoldApiCall){
256
  else $soundcloudIsGoldResponse = file_get_contents($soundcloudIsGoldApiCall);
257
 
258
  //Check for empty response as it mean the User could have blocked the API
259
- if(empty($soundCloudIsGoldResponseRawArray) || empty($soundcloudIsGoldRespError)) $soundcloudIsGoldRespError = "This artist's label might be blocking access to the artist's tracks from outside Soundcloud.com and only allow embedding from Soundcloud.com. </br></br> <strong>If you are the artist, please do get in touch on the <a href='https://wordpress.org/support/plugin/soundcloud-is-gold'>forum</a> to help me fix this issue</strong>";
260
 
261
  //Add response and error to array
262
  $soundCloudIsGoldResponseRawArray = json_decode($soundcloudIsGoldResponse, true);
@@ -314,11 +316,11 @@ function soundcloud_is_gold_pagination($format, $totalItems, $currentPage, $perP
314
  $disableFirst = ($currentPage == $firstPage) ? ' disabled' : '';
315
  $disableLast = ($currentPage == $lastPage) ? ' disabled' : '';
316
 
317
- $output = '<div class="tablenav-pages"><span class="displaying-num">'.$totalItems.' tracks</span>';
318
  $output .= '<span class="pagination-links">';
319
  $output .= '<a href="?post_id='.$post_ID.'&tab=soundcloud_is_gold&selectFormat='.$format.'&paged='.$firstPage.'&TB_iframe=1&width=640&height=584" title="Go to the first page" class="first-page'.$disableFirst.'">&laquo;</a>';
320
  $output .= '<a href="?post_id='.$post_ID.'&tab=soundcloud_is_gold&selectFormat='.$format.'&paged='.$prevPage.'&TB_iframe=1&width=640&height=584" title="Go to the previous page" class="prev-page'.$disableFirst.'">&lsaquo;</a>';
321
- $output .= '<span class="paging-input">page '.$currentPage.' of <span class="total-pages">'.$lastPage.'</span></span>';
322
  $output .= '<a href="?post_id='.$post_ID.'&tab=soundcloud_is_gold&selectFormat='.$format.'&paged='.$nextPage.'&TB_iframe=1&width=640&height=584" title="Go to the next page" class="next-page'.$disableLast.'">&rsaquo;</a>';
323
  $output .= '<a href="?post_id='.$post_ID.'&tab=soundcloud_is_gold&selectFormat='.$format.'&paged='.$lastPage.'&TB_iframe=1&width=640&height=584" title="Go to the last page" class="last-page'.$disableLast.'">&raquo;</a>';
324
  $output .= '</span></div>';
@@ -457,7 +459,7 @@ function get_soundcloud_is_gold_user_tracks(){
457
 
458
  //Usernames
459
  echo '<div class="soundcloudMMWrapper">';
460
- echo '<div id="soundcloudMMUsernameHeader"><img src="'.$soundcloudIsGoldUsers[$soundcloudIsGoldActiveUser][2].'" width="50" height="50"/><span>'.$soundcloudIsGoldUsers[$soundcloudIsGoldActiveUser][1].'</span> <a href="#" id="soundcloudMMShowUsernames">show users options</a><a href="#" id="soundcloudMMHideUsernames" class="hidden">hide users options</a></div>';
461
  echo '<div id="soundcloudMMUsermameTab">';
462
  get_soundcloud_is_gold_username_interface($options, $soundcloudIsGoldUsers);
463
  echo '</div></div>';
@@ -514,8 +516,8 @@ function get_soundcloud_is_gold_user_tracks(){
514
  foreach($soundcloudIsGoldApiResponse['response'] as $soundcloudIsGoldtrack): ?>
515
 
516
  <div class="media-item preloaded" id="media-item-<?php echo $soundcloudIsGoldtrack['id'] ?>">
517
- <a href="#" class="toggle describe-toggle-on soundcloudMM" id="show-<?php echo $soundcloudIsGoldtrack['id'] ?>">Show</a>
518
- <a href="#" class="toggle describe-toggle-off soundcloudMM">Hide</a>
519
  <div class="filename new"><span class="title soundcloudMMTitle" id="soundcloudMMTitle-<?php echo $soundcloudIsGoldtrack['id'] ?>"><?php echo $soundcloudIsGoldtrack['title'] ?></span></div>
520
  <table class="slidetoggle describe startclosed soundcloudMMWrapper soundcloudMMMainWrapper <?php echo $soundcloudIsGoldSelectedFormat ?>">
521
  <thead id="media-head-<?php echo $soundcloudIsGoldtrack['id'] ?>" class="media-item-info">
@@ -524,41 +526,41 @@ function get_soundcloud_is_gold_user_tracks(){
524
  <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>
525
  </td>
526
  <td>
527
- <p><strong>Title:</strong> <?php echo $soundcloudIsGoldtrack['title'] ?></p>
528
- <p id="soundcloudMMId-<?php echo $soundcloudIsGoldtrack['id'] ?>" class="soundcloudMMId"><strong>id:</strong> <?php echo $soundcloudIsGoldtrack['id'] ?></p>
529
- <p><strong>Upload date:</strong> <?php echo $soundcloudIsGoldtrack['created_at'] ?></p>
530
- <p><strong>Duration:</strong> <span id="media-dims-<?php echo $soundcloudIsGoldtrack['id'] ?>"><?php echo round(($soundcloudIsGoldtrack['duration']/1000)/60, 2, PHP_ROUND_HALF_DOWN) ?></span></p>
531
- <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>
532
  </td>
533
  <td>
534
  <tbody>
535
  <tr class="soundcloudMM_description">
536
- <th valign="top" class="label" scope="row"><label><span class="alignleft">Description</span><br class="clear"></label></th>
537
  <td class="field">
538
  <p class="text soundcloudMMDescription" id="soundcloudMMDescription-<?php echo $soundcloudIsGoldtrack['id'] ?>"><?php echo $soundcloudIsGoldtrack['description'] ?></p>
539
  </td>
540
  </tr>
541
  <tr class="soundcloudMM_settings">
542
- <th valign="top" class="label" scope="row"><label><span class="alignleft">Settings</span><br class="clear"></label></th>
543
  <td class="field">
544
  <input type="checkbox" <?php echo (isset($soundcloudIsGoldSettings[0]) ? $soundcloudIsGoldSettings[0] : 0) ? 'checked="checked"' : '' ?> id="soundcloudMMAutoPlay-<?php echo $soundcloudIsGoldtrack['id'] ?>" class="text soundcloudMMAutoPlay">
545
- <label >Play Automaticly</label>
546
  <input type="checkbox" <?php echo (isset($soundcloudIsGoldSettings[1]) ? $soundcloudIsGoldSettings[1] : 0) ? 'checked="checked"' : '' ?> id="soundcloudMMShowComments-<?php echo $soundcloudIsGoldtrack['id'] ?>" class="text soundcloudMMShowComments">
547
- <label >Show comments</label>
548
  <input type="checkbox" <?php echo (isset($soundcloudIsGoldSettings[2]) ? $soundcloudIsGoldSettings[2] : 0) ? 'checked="checked"' : '' ?> id="soundcloudMMShowArtwork-<?php echo $soundcloudIsGoldtrack['id'] ?>" class="text soundcloudMMShowArtwork">
549
- <label >Show artwork</label>
550
  <input type="checkbox" <?php echo (isset($soundcloudIsGoldSettings[3]) ? $soundcloudIsGoldSettings[3] : 0) ? 'checked="checked"' : '' ?> id="soundcloudMMShowVisual-<?php echo $soundcloudIsGoldtrack['id'] ?>" class="text soundcloudMMShowVisual">
551
- <label >Full Visual <small>(use soundcloud colors)</small></label>
552
- <!-- <input type="text" class="soundcloudPlayercolor" value""/> -->
553
-
554
  </td>
555
  </tr>
556
  <tr class="soundcloudMM_size">
557
- <th valign="top" class="label" scope="row"><label><span class="alignleft">Width</span><br class="clear"></label></th>
558
  <td class="field">
559
  <ul id="soundcloudMMWidthSetting" class="subSettings texts soundcloudMMTabWidthSettings">
560
  <li>
561
- <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>
562
  <select class="soundcloudMMInput soundcloudMMWidth" name="soundcloud_is_gold_width_settings[wp]">
563
  <?php foreach(get_soundcloud_is_gold_wordpress_sizes() as $key => $soundcloudIsGoldMediaSize) : ?>
564
  <?php $soundcloudIsGoldMediaSelected = ($soundcloudIsGoldMediaSize[0] == $soundcloudIsGoldWidthSettings['wp']) ? 'selected="selected"' : ''; ?>
@@ -567,33 +569,45 @@ function get_soundcloud_is_gold_user_tracks(){
567
  </select>
568
  </li>
569
  <li>
570
- <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>
571
  <input name="soundcloudMMCustomSelectedWidth-<?php echo $soundcloudIsGoldtrack['id'] ?>" id="soundcloudMMCustomSelectedWidth-<?php echo $soundcloudIsGoldtrack['id'] ?>" class="soundcloudMMInput soundcloudMMWidth soundcloudMMCustomSelectedWidth" type="text" value="<?php echo $soundcloudIsGoldWidthSettings['custom'] ?>" />
572
  </li>
573
- <li>
574
- <input type="checkbox" <?php echo (isset($soundcloudIsGoldHeightSettings['square']) && $soundcloudIsGoldHeightSettings['square']) ? 'checked="checked"' : ''?> name="soundcloud_is_gold_options[soundcloud_is_gold_height_settings][square]" value="true" class="soundcloudMMSquareHeight" id="soundcloudMMSquareHeight"/><label for="soundcloudMMSquareHeight">Force Visual Square</label>
575
- </li>
576
- </ul>
 
 
 
 
 
 
 
 
 
 
 
 
577
  </td>
578
  </tr>
579
  <tr class="soundcloudMM_color">
580
- <th valign="top" class="label" scope="row"><label><span class="alignleft">Colour</span><br class="clear"></label></th>
581
  <td class="field">
582
  <div class="soundcloudMMColorPickerContainer" id="soundcloudMMColorPickerContainer-<?php echo $soundcloudIsGoldtrack['id'] ?>">
583
- <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>
584
- <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>
585
  </div>
586
  </td>
587
  </tr>
588
  <tr class="soundcloudMM_classes">
589
- <th valign="top" class="label" scope="row"><label><span class="alignleft">Extra CSS classes</span><br class="clear"></label></th>
590
  <td class="field">
591
  <input type="text" class="text soundcloudMMClasses" id="soundcloudMMClasses-<?php echo $soundcloudIsGoldtrack['id'] ?>" value="<?php echo $soundcloudIsGoldClasses ?>">
592
- <p class="help">In case you need extra css classes (seperate with a space, no commas!)</p>
593
  </td>
594
  </tr>
595
  <tr class="soundcloudMM_player">
596
- <th valign="top" class="label" scope="row"><label><span class="alignleft">Preview</span><br class="clear"></label></th>
597
  <td>
598
  <p id="soundcloudMMEmbed-<?php echo $soundcloudIsGoldtrack['id'] ?>" class="field soundcloudMMEmbed" style="text-align:center">
599
  <!-- Soundcloud Preview here -->
@@ -602,7 +616,7 @@ function get_soundcloud_is_gold_user_tracks(){
602
  </td>
603
  </tr>
604
  <tr class="soundcloudMM_shortcode">
605
- <th valign="top" class="label" scope="row"><label><span class="alignleft">Shortcode</span><br class="clear"></label></th>
606
  <td class="field">
607
  <input id="soundcloudMMShortcode-<?php echo $soundcloudIsGoldtrack['id'] ?>" type="text" class="text soundcloudMMShortcode" value="[soundcloud <?php echo "id='".$soundcloudIsGoldtrack['id'] ?>']">
608
  </td>
@@ -610,7 +624,7 @@ function get_soundcloud_is_gold_user_tracks(){
610
  <tr class="soundcloudMM_submit">
611
  <td></td>
612
  <td class="savesend">
613
- <a href="#" id="soundcloudMMInsert-<?php echo $soundcloudIsGoldtrack['id'] ?>" class="button soundcloudMMInsert">Insert Soundcloud Player</a>
614
 
615
  <!-- <input type="submit" value="Insert into Post" name="" class="button"> -->
616
  <!-- <input type="button" id="soundcloudMMAddToGallery-<?php echo $soundcloudIsGoldtrack['id'] ?>" value="Add to post's gallery" name="" class="button soundcloudMMAddToGallery">
@@ -629,7 +643,7 @@ function get_soundcloud_is_gold_user_tracks(){
629
  //Error getting json
630
  else{
631
  if($soundcloudIsGoldApiResponse['error'] === false) $soundcloudIsGoldApiResponse['error'] = 'Json error';
632
- 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>';
633
  }
634
  echo '<div id="colorpicker"></div>';
635
  echo '</div></form>';
@@ -657,7 +671,7 @@ function soundcloud_is_gold_shortcode($atts){
657
  $soundcloudIsGoldClasses = isset($options['soundcloud_is_gold_classes']) ? $options['soundcloud_is_gold_classes'] : '';
658
  $soundcloudIsGoldColor = isset($options['soundcloud_is_gold_color']) ? $options['soundcloud_is_gold_color'] : '';
659
 
660
- //Only use lowercase as atts!
661
  extract( shortcode_atts( array(
662
  'id' => '1',
663
  'user' => 'null',
@@ -665,14 +679,17 @@ function soundcloud_is_gold_shortcode($atts){
665
  'comments' => ((!isset($soundcloudIsGoldSettings[1]) || $soundcloudIsGoldSettings[1] == '') ? 'false' : 'true'),
666
  'artwork' => ((!isset($soundcloudIsGoldSettings[2]) || $soundcloudIsGoldSettings[2] == '') ? 'false' : 'true'),
667
  'visual' => ((!isset($soundcloudIsGoldSettings[3]) || $soundcloudIsGoldSettings[3] == '') ? 'false' : 'true'),
 
668
  'width' => get_soundcloud_is_gold_default_width($soundcloudIsGoldWidthSettings),
669
  'height' => ((!isset($soundcloudIsGoldHeightSettings['square']) || $soundcloudIsGoldHeightSettings['square'] == '') ? 'false' : 'true'),
670
- 'classes' => $soundcloudIsGoldClasses,
 
671
  'color' => $soundcloudIsGoldColor,
672
  'format' => 'tracks'
673
  ), $atts )
674
  );
675
- return soundcloud_is_gold_player($id, $user, $autoplay, $comments, $width, $height, $classes, $color, $artwork, $visual, $format);
 
676
  }
677
 
678
 
@@ -684,7 +701,7 @@ function soundcloud_is_gold_shortcode($atts){
684
 
685
 
686
  /** The Player **/
687
- function soundcloud_is_gold_player($id, $user, $autoPlay, $comments, $width, $height, $classes, $color, $artwork, $visual, $format){
688
 
689
  $options = get_option('soundcloud_is_gold_options');
690
 
@@ -699,8 +716,10 @@ function soundcloud_is_gold_player($id, $user, $autoPlay, $comments, $width, $he
699
  if(!isset($comments)) $comments = ((!isset($soundcloudIsGoldSettings[1]) || $soundcloudIsGoldSettings[1] == '') ? 'false' : 'true');
700
  if(!isset($artwork)) $artwork = ((!isset($soundcloudIsGoldSettings[2]) || $soundcloudIsGoldSettings[2] == '') ? 'false' : 'true');
701
  if(!isset($visual)) $visual = ((!isset($soundcloudIsGoldSettings[3]) || $soundcloudIsGoldSettings[3] == '') ? 'false' : 'true');
702
- if(!isset($width)) $width = get_soundcloud_is_gold_default_width($soundcloudIsGoldWidthSettings);
 
703
  if(!isset($height)) $height = ((!isset($soundcloudIsGoldHeightSettings['square']) || $soundcloudIsGoldHeightSettings['square'] == '') ? 'false' : 'true');
 
704
  if(!isset($classes)) $classes = $soundcloudIsGoldClasses;
705
  if(!isset($color)) $color = $soundcloudIsGoldColor;
706
  if(!isset($format)) $format = 'tracks';
@@ -721,11 +740,23 @@ function soundcloud_is_gold_player($id, $user, $autoPlay, $comments, $width, $he
721
  //Reset Favorites to tracks as soundcloud treats them as tracks.
722
  if($format == 'favorites') $format = "tracks";
723
 
724
- //Height Logic
 
725
  if($height == 'true' && $visual == 'true') $height = '450px';
726
- else $height = ($format == 'tracks') ? '166px' : '450px';
 
 
 
 
 
 
 
 
727
 
728
 
 
 
 
729
  //Html5 Player
730
  $player = '<div class="soundcloudIsGold '.esc_attr($classes).'" id="soundcloud-'.esc_attr($id).'">';
731
  $player .= '<iframe width="'.esc_attr($width).'" height="'.esc_attr($height).'" scrolling="no" frameborder="no" src="https://w.soundcloud.com/player/?url=https%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).'&amp;visual='.esc_attr($visual).'&amp;show_comments='.esc_attr($comments).'"></iframe>';
@@ -764,7 +795,7 @@ function no_more_XSS($data){
764
  /** Preview **/
765
  add_action('wp_ajax_soundcloud_is_gold_player_preview', 'soundcloud_is_gold_player_preview');
766
  function soundcloud_is_gold_player_preview(){
767
- if(isset($_POST['request'])) echo soundcloud_is_gold_player(no_more_XSS($_POST['ID']), no_more_XSS($_POST['user']), no_more_XSS($_POST['autoPlay']), no_more_XSS($_POST['comments']), no_more_XSS($_POST['width']), no_more_XSS($_POST['height']), no_more_XSS($_POST['classes']), no_more_XSS($_POST['color']), no_more_XSS($_POST['artwork']), no_more_XSS($_POST['visual']), no_more_XSS($_POST['format']));
768
  die;
769
  }
770
  /** viewer Ajax **/
@@ -790,6 +821,8 @@ function soundcloud_is_gold_add_user(){
790
  $options = get_option('soundcloud_is_gold_options');
791
  //Replace spaces with hyphen in case users enter their name without it
792
  $newUsername = str_replace(" ", "-", trim($_POST['username']));
 
 
793
  //Get user info
794
  $userInfo = soundcloud_is_gold_user_info($newUsername);
795
  //Check that plugin's options are in place and that we've got $userinfo
@@ -867,239 +900,70 @@ function soundcloud_is_gold_delete_user(){
867
  die;
868
  }
869
 
870
- /*******************************************/
871
- /** **/
872
- /** WIDGET **/
873
- /** **/
874
- /*******************************************/
875
- // register Soundcloud_Is_Gold_Widget
876
- add_action( 'widgets_init', create_function( '', 'register_widget( "soundcloud_is_gold_widget" );' ) );
877
- class Soundcloud_Is_Gold_Widget extends WP_Widget {
878
-
879
- /**
880
- * Register widget with WordPress.
881
- */
882
- public function __construct() {
883
- parent::__construct(
884
- 'soundcloud_is_gold_widget', // Base ID
885
- 'Soundcloud is Gold', // Name
886
- array( 'description' => __( 'Show your Latest Tracks, Favorites or Playlists for one or multiple users. If you\'re crasy go random for everything!', 'text_domain' ), ) // Args
887
- );
888
- }
889
-
890
- /**
891
- * Front-end display of widget.
892
- *
893
- * @see WP_Widget::widget()
894
- *
895
- * @param array $args Widget arguments.
896
- * @param array $instance Saved values from database.
897
- */
898
- public function widget( $args, $instance ) {
899
- extract( $args );
900
- $title = apply_filters( 'widget_title', $instance['title'] );
901
- $user = $instance['user'];
902
- $autoplay = $instance['autoplay'] ? 'true' : 'false';
903
- $comments = $instance['comments'] ? 'true' : 'false';
904
- $artwork = $instance['artwork'] ? 'true' : 'false';
905
- $visual = $instance['visual'] ? 'true' : 'false';
906
- $classes = $instance['classes'];
907
- $widthType = $instance['type'];
908
- $wp = $instance['wp'];
909
- $custom = $instance['custom'];
910
- $width = ($widthType == 'wp') ? $wp : $custom;
911
- $height = $instance['square'] ? 'true' : 'false';
912
- $behavior = $instance['behavior'];
913
- $number = $instance['number'];
914
- $format = $instance['format'];
915
-
916
- //Fix for people updating from 2.3.3 when widgets settings were using "sets" for "playlists"
917
- if($format == 'sets' || $format == 'set') $format = 'playlists';
918
-
919
- //Random User
920
- if($user == "randomUser") {
921
- $options = get_option('soundcloud_is_gold_options');
922
- //Fix bug when updating to 2.4.2 where API requests can only use user id
923
- $options = soundcloud_is_gold_update_users($options);
924
- //Pick Random User
925
- $soundcloudIsGoldUsers = isset($options['soundcloud_is_gold_users']) ? array_random($options['soundcloud_is_gold_users'], 1) : '';
926
- //printl($soundcloudIsGoldUsers[0][0]);
927
- if(isset($soundcloudIsGoldUsers)) $user = $soundcloudIsGoldUsers[0][0];
928
- }
929
-
930
- echo $before_widget;
931
- if ( ! empty( $title ) ) echo $before_title . $title . $after_title;
932
-
933
- //Random User per Track
934
- if($user == "randomUsers") {
935
- $options = get_option('soundcloud_is_gold_options');
936
- //Fix bug when updating to 2.4.2 where API requests can only use user id
937
- $options = soundcloud_is_gold_update_users($options);
938
- //Set Random User per Track
939
- if(isset($options['soundcloud_is_gold_users'])){
940
- //Never select more tracks than there is users.
941
- $number = (count($options['soundcloud_is_gold_users']) <= $number) ? count($options['soundcloud_is_gold_users']) : $number;
942
- $soundcloudIsGoldUsers = array_random($options['soundcloud_is_gold_users'], $number);
943
- }
944
- if(isset($soundcloudIsGoldUsers)){
945
- foreach($soundcloudIsGoldUsers as $userKey=>$user){
946
- if($userKey == 1) $autoplay = false;
947
- foreach(get_soundcloud_is_gold_multiple_tracks_id($user[0], 1, ($behavior == "latest") ? FALSE : TRUE, $format) as $key=>$ids){
948
- if($format == "favorites") $format = "tracks"; //Soundcloud treats Favorites as Tracks for the player.
949
- echo soundcloud_is_gold_player($ids, NULL, $autoplay, $comments, $width, $height, $classes, NULL, $artwork, $visual, $format);
950
- }
951
- }
952
- }
953
- }
954
- //One User
955
- else{
956
- foreach(get_soundcloud_is_gold_multiple_tracks_id($user, $number, ($behavior == "latest") ? FALSE : TRUE, $format) as $key=>$ids){
957
- if($key == 1) $autoplay = false;
958
- if($format == "favorites") $format = "tracks"; //Soundcloud treats Favorites as Tracks for the player.
959
- echo soundcloud_is_gold_player($ids, NULL, $autoplay, $comments, $width, $height, $classes, NULL, $artwork, $visual, $format);
960
- }
961
- }
962
 
963
- echo $after_widget;
964
- }
965
-
966
- /**
967
- * Sanitize widget form values as they are saved.
968
- *
969
- * @see WP_Widget::update()
970
- *
971
- * @param array $new_instance Values just sent to be saved.
972
- * @param array $old_instance Previously saved values from database.
973
- *
974
- * @return array Updated safe values to be saved.
975
- */
976
- public function update( $new_instance, $old_instance ) {
977
- $instance = array();
978
- $instance['title'] = strip_tags( $new_instance['title'] );
979
- $instance['user'] = strip_tags( $new_instance['user'] );
980
- $instance['format'] = strip_tags( $new_instance['format'] );
981
- $instance['behavior'] = strip_tags( $new_instance['behavior'] );
982
- $instance['number'] = strip_tags( $new_instance['number'] );
983
- $instance['autoplay'] = strip_tags( $new_instance['autoplay'] );
984
- $instance['comments'] = strip_tags( $new_instance['comments'] );
985
- $instance['artwork'] = strip_tags( $new_instance['artwork'] );
986
- $instance['visual'] = strip_tags( $new_instance['visual'] );
987
- $instance['classes'] = strip_tags( $new_instance['classes'] );
988
- $instance['type'] = strip_tags( $new_instance['type'] );
989
- $instance['wp'] = strip_tags( $new_instance['wp'] );
990
- $instance['custom'] = strip_tags( $new_instance['custom'] );
991
- $instance['square'] = strip_tags( $new_instance['square'] );
992
-
993
- return $instance;
994
- }
995
 
996
- /**
997
- * Back-end widget form.
998
- *
999
- * @see WP_Widget::form()
1000
- *
1001
- * @param array $instance Previously saved values from database.
1002
- */
1003
- public function form( $instance ) {
1004
- if ( isset( $instance[ 'title' ] ) ) {
1005
- $title = $instance[ 'title' ];
1006
- }
1007
- else {
1008
- $title = __( 'Latest', 'text_domain' );
1009
- }
1010
- //Get Plugin Options
1011
- $options = get_option('soundcloud_is_gold_options');
1012
- //Fix bug when updating to 2.4.2 where API requests can only use user id
1013
- $options = soundcloud_is_gold_update_users($options);
1014
- ?>
1015
- <!-- Title -->
1016
- <p>
1017
- <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?></label>
1018
- <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />
1019
- </p>
1020
- <!-- Users -->
1021
- <p>
1022
- <label for="<?php echo $this->get_field_id('user'); ?>"><?php _e( 'Username:' ); ?></label>
1023
- <select name="<?php echo $this->get_field_name('user'); ?>" id="<?php echo $this->get_field_id('user'); ?>" class="widefat">
1024
- <?php
1025
- foreach($options['soundcloud_is_gold_users'] as $user) : ?>
1026
- <option value="<?php echo $user[0] ?>"<?php selected( $instance['user'], $user[0] ); ?>><?php _e($user[1]); ?></option>
1027
- <?php endforeach; ?>
1028
- <option value="randomUser"<?php selected( $instance['user'], "randomUser" ); ?>><?php _e("Pick a Random User"); ?></option>
1029
- <option value="randomUsers"<?php selected( $instance['user'], "randomUsers" ); ?>><?php _e("Pick a Random User per Track"); ?></option>
1030
- </select>
1031
- </p>
1032
- <!-- Main options -->
1033
- <?php
1034
- $autoplay = (isset($instance['autoplay']) && $instance['autoplay']) ? 'checked="checked"' : '';
1035
- $comments = (isset($instance['comments']) && $instance['comments']) ? 'checked="checked"' : '';
1036
- $artwork = (isset($instance['artwork']) && $instance['artwork']) ? 'checked="checked"' : '';
1037
- $visual = (isset($instance['visual']) && $instance['visual']) ? 'checked="checked"' : '';
1038
- ?>
1039
- <p>
1040
- <label for=""><?php _e( 'Settings:' ); ?></label>
1041
- <select name="<?php echo $this->get_field_name('format'); ?>" id="<?php echo $this->get_field_id('format'); ?>" class="widefat">
1042
- <option value="tracks"<?php selected( $instance['format'], "tracks" ); ?>><?php _e("tracks"); ?></option>
1043
- <option value="favorites"<?php selected( $instance['format'], "favorites" ); ?>><?php _e("favorites"); ?></option>
1044
- <option value="playlists"<?php selected( $instance['format'], "playlists" ); ?>><?php _e("playlists"); ?></option>
1045
- </select>
1046
- <br/>
1047
- <br/>
1048
- <select name="<?php echo $this->get_field_name('behavior'); ?>" id="<?php echo $this->get_field_id('behavior'); ?>" class="widefat">
1049
- <option value="latest"<?php selected( $instance['behavior'], "latest" ); ?>><?php _e("Latest"); ?></option>
1050
- <option value="random"<?php selected( $instance['behavior'], "random" ); ?>><?php _e("Random"); ?></option>
1051
- </select>
1052
- <br/>
1053
- <br/>
1054
- <select name="<?php echo $this->get_field_name('number'); ?>" id="<?php echo $this->get_field_id('number'); ?>" class="widefat">
1055
- <?php
1056
- for($i=1; $i<=10; $i++) : ?>
1057
- <option value="<?php echo $i ?>"<?php selected( $instance['number'], $i ); ?>><?php _e($i); ?></option>
1058
- <?php endfor; ?>
1059
- </select>
1060
- <br/>
1061
- <br/>
1062
- <input class="checkbox" type="checkbox" <?php echo $autoplay; ?> id="<?php echo $this->get_field_id('autoplay'); ?>" name="<?php echo $this->get_field_name('autoplay'); ?>" /> <label for="<?php echo $this->get_field_id('autoplay'); ?>"><?php _e('Play Automatically'); ?></label>
1063
- <br/>
1064
- <input class="checkbox" type="checkbox" <?php echo $comments; ?> id="<?php echo $this->get_field_id('comments'); ?>" name="<?php echo $this->get_field_name('comments'); ?>" /> <label for="<?php echo $this->get_field_id('comments'); ?>"><?php _e('Show comments'); ?></label>
1065
- <br/>
1066
- <input class="checkbox" type="checkbox" <?php echo $artwork; ?> id="<?php echo $this->get_field_id('artwork'); ?>" name="<?php echo $this->get_field_name('artwork'); ?>" /> <label for="<?php echo $this->get_field_id('artwork'); ?>"><?php _e('Show Artwork'); ?></label>
1067
- <br/>
1068
- <input class="checkbox" type="checkbox" <?php echo $visual; ?> id="<?php echo $this->get_field_id('visual'); ?>" name="<?php echo $this->get_field_name('visual'); ?>" /> <label for="<?php echo $this->get_field_id('visual'); ?>"><?php _e('Full Visual <small>(use soundcloud colors)</small>'); ?></label>
1069
- </p>
1070
- <!-- Width -->
1071
- <?php
1072
-
1073
- ?>
1074
- <p>
1075
- <label for=""><?php _e( 'Width:' ); ?></label>
1076
- <p>
1077
- <input type="radio" <?php checked( $instance['type'], "wp" ); ?> value="wp" id="wp" name="<?php echo $this->get_field_name('type'); ?>" /><label for="wp">Media Width</label>
1078
- <br/>
1079
- <select name="<?php echo $this->get_field_name('wp'); ?>" id="<?php echo $this->get_field_id('wp'); ?>" class="widefat">
1080
- <?php foreach(get_soundcloud_is_gold_wordpress_sizes() as $key => $soundcloudIsGoldMediaSize) : ?>
1081
- <option value="<?php echo $soundcloudIsGoldMediaSize[0]?>" <?php selected( $instance['wp'], $soundcloudIsGoldMediaSize[0] ); ?>><?php _e($key.': '.$soundcloudIsGoldMediaSize[0]); ?></option>
1082
- <?php endforeach; ?>
1083
- </select>
1084
- </p>
1085
- <p>
1086
- <input type="radio" <?php checked( $instance['type'], "custom" ); ?> value="custom" id="custom" name="<?php echo $this->get_field_name('type'); ?>" /><label for="custom">Custom Width</label>
1087
- <br/>
1088
- <input type="text" value="<?php echo $instance['custom'] ? $instance['custom'] : "100%" ?>" id="<?php echo $this->get_field_id('custom'); ?>" name="<?php echo $this->get_field_name('custom'); ?>"/>
1089
- </p>
1090
- <p>
1091
- <br/>
1092
- <?php $square = (isset($instance['square']) && $instance['square']) ? 'checked="checked"' : ''; ?>
1093
- <input class="checkbox" type="checkbox" <?php echo $square; ?> id="<?php echo $this->get_field_id('square'); ?>" name="<?php echo $this->get_field_name('square'); ?>" /> <label for="<?php echo $this->get_field_id('square'); ?>"><?php _e('Force Visual Square'); ?></label>
1094
- </p>
1095
- </p>
1096
- <!-- Classes -->
1097
- <p>
1098
- <label for="<?php echo $this->get_field_id('classes'); ?>"><?php _e( 'CSS Classes <small>(no commas)</small>:' ); ?></label>
1099
- <input type="text" value="<?php echo $instance['classes'] ?>" id="<?php echo $this->get_field_id('classes'); ?>" name="<?php echo $this->get_field_name('classes'); ?>"/>
1100
- </p>
1101
- <?php
1102
- }
1103
 
1104
- } // class Foo_Widget
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1105
  ?>
42
  echo 'soundcloudIsGoldComments_default = '.((!isset($soundcloudIsGoldSettings[1]) || $soundcloudIsGoldSettings[1] == '') ? 'false' : 'true') .'; ';
43
  echo 'soundcloudIsGoldArtwork_default = '.((!isset($soundcloudIsGoldSettings[2]) || $soundcloudIsGoldSettings[2] == '') ? 'false' : 'true') .'; ';
44
  echo 'soundcloudIsGoldVisual_default = '.((!isset($soundcloudIsGoldSettings[3]) || $soundcloudIsGoldSettings[3] == '') ? 'false' : 'true') .'; ';
45
+ echo 'soundcloudIsGoldMini_default = '.((!isset($soundcloudIsGoldSettings[4]) || $soundcloudIsGoldSettings[4] == '') ? 'false' : 'true') .'; ';
46
  echo 'soundcloudIsGoldWidth_default = "'.get_soundcloud_is_gold_default_width($soundcloudIsGoldWidthSettings).'"; ';
47
  echo 'soundcloudIsGoldHeight_default = '.((!isset($soundcloudIsGoldHeightSettings['square']) || $soundcloudIsGoldSettings['square'] == '') ? 'true' : 'false') .'; ';
48
+ echo 'soundcloudIsGoldPlaylistHeight_default = "'.((!isset($soundcloudIsGoldHeightSettings['playlist']) || $soundcloudIsGoldHeightSettings['playlist'] == '') ? '' : $soundcloudIsGoldHeightSettings['playlist']) .'"; ';
49
  echo 'soundcloudIsGoldClasses_default = "'.$soundcloudIsGoldClasses.'"; ';
50
  echo 'soundcloudIsGoldColor_default = "'.$soundcloudIsGoldColor.'"; ';
51
  }
82
  <ul id="soundcloudIsGoldAddUserContainer">
83
  <li class="soundcloudMMLoading" style="display:none">&nbsp;</li>
84
  <li id="soundcloudIsGoldUserError" class="orangeGradient soundcloudMMRounder">
85
+ <p><?php _e('error message', 'soundcloud-is-gold') ?></p>
86
+ <a href="#" class="soundcloudMMBt soundcloudMMBtSmall blue soundcloudMMRounder "><?php _e('close', 'soundcloud-is-gold') ?></a>
87
  </li>
88
  <li>
89
  <input type="text" name="soundcloudIsGoldNewUser" id="soundcloudIsGoldNewUser"/>
90
+ <a id="soundcloudIsGoldAddUser" href="#" class="soundcloudMMBt blue soundcloudMMRounder soundcloudMMBtSmall" /><?php _e('Add Username', 'soundcloud-is-gold') ?></a>
91
  </li>
92
  </ul>
93
  <!-- All inactive Users -->
258
  else $soundcloudIsGoldResponse = file_get_contents($soundcloudIsGoldApiCall);
259
 
260
  //Check for empty response as it mean the User could have blocked the API
261
+ if(empty($soundCloudIsGoldResponseRawArray) || empty($soundcloudIsGoldRespError)) $soundcloudIsGoldRespError = __("<h2>Nothing was found</h2><small><strong>Disclaimer:</strong> This artist's label might be blocking access to the artist's tracks from outside Soundcloud.com and only allow embedding from Soundcloud.com. </br><strong>If you are the artist, please do get in touch on the <a href='https://wordpress.org/support/plugin/soundcloud-is-gold'>forum</a> to help me fix this issue</strong></small>", 'soundcloud-is-gold');
262
 
263
  //Add response and error to array
264
  $soundCloudIsGoldResponseRawArray = json_decode($soundcloudIsGoldResponse, true);
316
  $disableFirst = ($currentPage == $firstPage) ? ' disabled' : '';
317
  $disableLast = ($currentPage == $lastPage) ? ' disabled' : '';
318
 
319
+ $output = '<div class="tablenav-pages"><span class="displaying-num">'.$totalItems.' '.__('tracks', 'soundcloud-is-gold').'</span>';
320
  $output .= '<span class="pagination-links">';
321
  $output .= '<a href="?post_id='.$post_ID.'&tab=soundcloud_is_gold&selectFormat='.$format.'&paged='.$firstPage.'&TB_iframe=1&width=640&height=584" title="Go to the first page" class="first-page'.$disableFirst.'">&laquo;</a>';
322
  $output .= '<a href="?post_id='.$post_ID.'&tab=soundcloud_is_gold&selectFormat='.$format.'&paged='.$prevPage.'&TB_iframe=1&width=640&height=584" title="Go to the previous page" class="prev-page'.$disableFirst.'">&lsaquo;</a>';
323
+ $output .= '<span class="paging-input">'.__('page', 'soundcloud-is-gold') .' '.$currentPage.' '. __('of', 'soundcloud-is-gold').' <span class="total-pages">'.$lastPage.'</span></span>';
324
  $output .= '<a href="?post_id='.$post_ID.'&tab=soundcloud_is_gold&selectFormat='.$format.'&paged='.$nextPage.'&TB_iframe=1&width=640&height=584" title="Go to the next page" class="next-page'.$disableLast.'">&rsaquo;</a>';
325
  $output .= '<a href="?post_id='.$post_ID.'&tab=soundcloud_is_gold&selectFormat='.$format.'&paged='.$lastPage.'&TB_iframe=1&width=640&height=584" title="Go to the last page" class="last-page'.$disableLast.'">&raquo;</a>';
326
  $output .= '</span></div>';
459
 
460
  //Usernames
461
  echo '<div class="soundcloudMMWrapper">';
462
+ echo '<div id="soundcloudMMUsernameHeader"><img src="'.$soundcloudIsGoldUsers[$soundcloudIsGoldActiveUser][2].'" width="50" height="50"/><span>'.$soundcloudIsGoldUsers[$soundcloudIsGoldActiveUser][1].'</span> <a href="#" id="soundcloudMMShowUsernames">'.__('show users options', 'soundcloud-is-gold').'</a><a href="#" id="soundcloudMMHideUsernames" class="hidden">'.__('hide users options', 'soundcloud-is-gold').'</a></div>';
463
  echo '<div id="soundcloudMMUsermameTab">';
464
  get_soundcloud_is_gold_username_interface($options, $soundcloudIsGoldUsers);
465
  echo '</div></div>';
516
  foreach($soundcloudIsGoldApiResponse['response'] as $soundcloudIsGoldtrack): ?>
517
 
518
  <div class="media-item preloaded" id="media-item-<?php echo $soundcloudIsGoldtrack['id'] ?>">
519
+ <a href="#" class="toggle describe-toggle-on soundcloudMM" id="show-<?php echo $soundcloudIsGoldtrack['id'] ?>"><?php _e('Show') ?></a>
520
+ <a href="#" class="toggle describe-toggle-off soundcloudMM"><?php _e('Hide') ?></a>
521
  <div class="filename new"><span class="title soundcloudMMTitle" id="soundcloudMMTitle-<?php echo $soundcloudIsGoldtrack['id'] ?>"><?php echo $soundcloudIsGoldtrack['title'] ?></span></div>
522
  <table class="slidetoggle describe startclosed soundcloudMMWrapper soundcloudMMMainWrapper <?php echo $soundcloudIsGoldSelectedFormat ?>">
523
  <thead id="media-head-<?php echo $soundcloudIsGoldtrack['id'] ?>" class="media-item-info">
526
  <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>
527
  </td>
528
  <td>
529
+ <p><strong><?php _e('Title:', 'soundcloud-is-gold') ?></strong> <?php echo $soundcloudIsGoldtrack['title'] ?></p>
530
+ <p id="soundcloudMMId-<?php echo $soundcloudIsGoldtrack['id'] ?>" class="soundcloudMMId"><strong><?php _e('id:', 'soundcloud-is-gold') ?></strong> <?php echo $soundcloudIsGoldtrack['id'] ?></p>
531
+ <p><strong><?php _e('Upload date:', 'soundcloud-is-gold') ?></strong> <?php echo $soundcloudIsGoldtrack['created_at'] ?></p>
532
+ <p><strong><?php _e('Duration:', 'soundcloud-is-gold') ?></strong> <span id="media-dims-<?php echo $soundcloudIsGoldtrack['id'] ?>"><?php echo round(($soundcloudIsGoldtrack['duration']/1000)/60, 2, PHP_ROUND_HALF_DOWN) ?></span></p>
533
+ <p><strong><?php _e('Url:', 'soundcloud-is-gold') ?></strong> <a id="videoUrl-<?php echo $soundcloudIsGoldtrack['id'] ?>" href="<?php echo $soundcloudIsGoldtrack['permalink_url'] ?>" title="<?php _e('Go to the video page', 'soundcloud-is-gold') ?>" target="_blank"><?php echo $soundcloudIsGoldtrack['permalink_url']?></a></p>
534
  </td>
535
  <td>
536
  <tbody>
537
  <tr class="soundcloudMM_description">
538
+ <th valign="top" class="label" scope="row"><label><span class="alignleft"><?php _e('Description', 'soundcloud-is-gold') ?></span><br class="clear"></label></th>
539
  <td class="field">
540
  <p class="text soundcloudMMDescription" id="soundcloudMMDescription-<?php echo $soundcloudIsGoldtrack['id'] ?>"><?php echo $soundcloudIsGoldtrack['description'] ?></p>
541
  </td>
542
  </tr>
543
  <tr class="soundcloudMM_settings">
544
+ <th valign="top" class="label" scope="row"><label><span class="alignleft"><?php _e('Settings', 'soundcloud-is-gold') ?></span><br class="clear"></label></th>
545
  <td class="field">
546
  <input type="checkbox" <?php echo (isset($soundcloudIsGoldSettings[0]) ? $soundcloudIsGoldSettings[0] : 0) ? 'checked="checked"' : '' ?> id="soundcloudMMAutoPlay-<?php echo $soundcloudIsGoldtrack['id'] ?>" class="text soundcloudMMAutoPlay">
547
+ <label ><?php _e('Play Automaticly', 'soundcloud-is-gold') ?></label>
548
  <input type="checkbox" <?php echo (isset($soundcloudIsGoldSettings[1]) ? $soundcloudIsGoldSettings[1] : 0) ? 'checked="checked"' : '' ?> id="soundcloudMMShowComments-<?php echo $soundcloudIsGoldtrack['id'] ?>" class="text soundcloudMMShowComments">
549
+ <label ><?php _e('Show comments', 'soundcloud-is-gold') ?></label>
550
  <input type="checkbox" <?php echo (isset($soundcloudIsGoldSettings[2]) ? $soundcloudIsGoldSettings[2] : 0) ? 'checked="checked"' : '' ?> id="soundcloudMMShowArtwork-<?php echo $soundcloudIsGoldtrack['id'] ?>" class="text soundcloudMMShowArtwork">
551
+ <label ><?php _e('Show artwork', 'soundcloud-is-gold') ?></label>
552
  <input type="checkbox" <?php echo (isset($soundcloudIsGoldSettings[3]) ? $soundcloudIsGoldSettings[3] : 0) ? 'checked="checked"' : '' ?> id="soundcloudMMShowVisual-<?php echo $soundcloudIsGoldtrack['id'] ?>" class="text soundcloudMMShowVisual">
553
+ <label ><?php _e('Full Visual', 'soundcloud-is-gold') ?> <small>(<?php _e('use soundcloud colors', 'soundcloud-is-gold') ?>)</small></label>
554
+ <input type="checkbox" <?php echo (isset($soundcloudIsGoldSettings[4]) ? $soundcloudIsGoldSettings[4] : 0) ? 'checked="checked"' : '' ?> id="soundcloudMMSForceMini-<?php echo $soundcloudIsGoldtrack['id'] ?>" class="text soundcloudMMSForceMini">
555
+ <label ><?php _e('Force Mini Player', 'soundcloud-is-gold') ?><small>(<?php _e('Artwork and comments won\'t show', 'soundcloud-is-gold') ?>)</small></label>
556
  </td>
557
  </tr>
558
  <tr class="soundcloudMM_size">
559
+ <th valign="top" class="label" scope="row"><label><span class="alignleft"><?php _e('Width', 'soundcloud-is-gold') ?></span><br class="clear"></label></th>
560
  <td class="field">
561
  <ul id="soundcloudMMWidthSetting" class="subSettings texts soundcloudMMTabWidthSettings">
562
  <li>
563
+ <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'] ?>"><?php _e('Media Width', 'soundcloud-is-gold') ?></label>
564
  <select class="soundcloudMMInput soundcloudMMWidth" name="soundcloud_is_gold_width_settings[wp]">
565
  <?php foreach(get_soundcloud_is_gold_wordpress_sizes() as $key => $soundcloudIsGoldMediaSize) : ?>
566
  <?php $soundcloudIsGoldMediaSelected = ($soundcloudIsGoldMediaSize[0] == $soundcloudIsGoldWidthSettings['wp']) ? 'selected="selected"' : ''; ?>
569
  </select>
570
  </li>
571
  <li>
572
+ <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'] ?>"><?php _e('Custom Width', 'soundcloud-is-gold') ?></label>
573
  <input name="soundcloudMMCustomSelectedWidth-<?php echo $soundcloudIsGoldtrack['id'] ?>" id="soundcloudMMCustomSelectedWidth-<?php echo $soundcloudIsGoldtrack['id'] ?>" class="soundcloudMMInput soundcloudMMWidth soundcloudMMCustomSelectedWidth" type="text" value="<?php echo $soundcloudIsGoldWidthSettings['custom'] ?>" />
574
  </li>
575
+ </ul>
576
+ </td>
577
+ </tr>
578
+ <tr class="soundcloudMM_size">
579
+ <th valign="top" class="label" scope="row"><label><span class="alignleft"><?php _e('Height', 'soundcloud-is-gold') ?></span><br class="clear"></label></th>
580
+ <td class="field">
581
+ <ul id="soundcloudMMHeightSetting" class="subSettings texts soundcloudMMTabWidthSettings">
582
+ <li>
583
+ <label><?php _e('Playlist Height', 'soundcloud-is-gold') ?> <small>(<?php _e('leave empty for default, can\'t be less than 300px', 'soundcloud-is-gold') ?>)</small></label>
584
+ <input id="soundcloudMMPlaylistHeight" class="soundcloudMMInput soundcloudMMWidth soundcloudMMPlaylistHeight" type="text" name="soundcloud_is_gold_options[soundcloud_is_gold_height_settings][playlist]" value="<?php echo (isset($soundcloudIsGoldHeightSettings['playlist'])) ? $soundcloudIsGoldHeightSettings['playlist'] : ''?>" />
585
+ </li>
586
+ <li>
587
+ <input type="checkbox" <?php echo (isset($soundcloudIsGoldHeightSettings['square']) && $soundcloudIsGoldHeightSettings['square']) ? 'checked="checked"' : ''?> name="soundcloud_is_gold_options[soundcloud_is_gold_height_settings][square]" value="true" class="soundcloudMMSquareHeight" id="soundcloudMMSquareHeight"/>
588
+ <label for="soundcloudMMSquareHeight"><?php _e('Force Square Player', 'soundcloud-is-gold') ?> <small>(<?php _e('Visual', 'soundcloud-is-gold') ?>)</small></label>
589
+ </li>
590
+ </ul>
591
  </td>
592
  </tr>
593
  <tr class="soundcloudMM_color">
594
+ <th valign="top" class="label" scope="row"><label><span class="alignleft"><?php _e('Colour', 'soundcloud-is-gold') ?></span><br class="clear"></label></th>
595
  <td class="field">
596
  <div class="soundcloudMMColorPickerContainer" id="soundcloudMMColorPickerContainer-<?php echo $soundcloudIsGoldtrack['id'] ?>">
597
+ <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"><?php _e('reset to default', 'soundcloud-is-gold') ?></a>
598
+ <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"><?php _e('done', 'soundcloud-is-gold') ?></a></div>
599
  </div>
600
  </td>
601
  </tr>
602
  <tr class="soundcloudMM_classes">
603
+ <th valign="top" class="label" scope="row"><label><span class="alignleft"><?php _e('Extra CSS classes', 'soundcloud-is-gold') ?></span><br class="clear"></label></th>
604
  <td class="field">
605
  <input type="text" class="text soundcloudMMClasses" id="soundcloudMMClasses-<?php echo $soundcloudIsGoldtrack['id'] ?>" value="<?php echo $soundcloudIsGoldClasses ?>">
606
+ <p class="help"><?php _e('In case you need extra css classes (seperate with a space, no commas!)', 'soundcloud-is-gold') ?></p>
607
  </td>
608
  </tr>
609
  <tr class="soundcloudMM_player">
610
+ <th valign="top" class="label" scope="row"><label><span class="alignleft"><?php _e('Preview', 'soundcloud-is-gold') ?></span><br class="clear"></label></th>
611
  <td>
612
  <p id="soundcloudMMEmbed-<?php echo $soundcloudIsGoldtrack['id'] ?>" class="field soundcloudMMEmbed" style="text-align:center">
613
  <!-- Soundcloud Preview here -->
616
  </td>
617
  </tr>
618
  <tr class="soundcloudMM_shortcode">
619
+ <th valign="top" class="label" scope="row"><label><span class="alignleft"><?php _e('Shortcode', 'soundcloud-is-gold') ?></span><br class="clear"></label></th>
620
  <td class="field">
621
  <input id="soundcloudMMShortcode-<?php echo $soundcloudIsGoldtrack['id'] ?>" type="text" class="text soundcloudMMShortcode" value="[soundcloud <?php echo "id='".$soundcloudIsGoldtrack['id'] ?>']">
622
  </td>
624
  <tr class="soundcloudMM_submit">
625
  <td></td>
626
  <td class="savesend">
627
+ <a href="#" id="soundcloudMMInsert-<?php echo $soundcloudIsGoldtrack['id'] ?>" class="button soundcloudMMInsert"><?php _e('Insert Soundcloud Player', 'soundcloud-is-gold') ?></a>
628
 
629
  <!-- <input type="submit" value="Insert into Post" name="" class="button"> -->
630
  <!-- <input type="button" id="soundcloudMMAddToGallery-<?php echo $soundcloudIsGoldtrack['id'] ?>" value="Add to post's gallery" name="" class="button soundcloudMMAddToGallery">
643
  //Error getting json
644
  else{
645
  if($soundcloudIsGoldApiResponse['error'] === false) $soundcloudIsGoldApiResponse['error'] = 'Json error';
646
+ echo '<div class="soundcloudMMJsonError">'.$soundcloudIsGoldApiResponse['error'].'</div>';
647
  }
648
  echo '<div id="colorpicker"></div>';
649
  echo '</div></form>';
671
  $soundcloudIsGoldClasses = isset($options['soundcloud_is_gold_classes']) ? $options['soundcloud_is_gold_classes'] : '';
672
  $soundcloudIsGoldColor = isset($options['soundcloud_is_gold_color']) ? $options['soundcloud_is_gold_color'] : '';
673
 
674
+ //Only use lowercase as atts!
675
  extract( shortcode_atts( array(
676
  'id' => '1',
677
  'user' => 'null',
679
  'comments' => ((!isset($soundcloudIsGoldSettings[1]) || $soundcloudIsGoldSettings[1] == '') ? 'false' : 'true'),
680
  'artwork' => ((!isset($soundcloudIsGoldSettings[2]) || $soundcloudIsGoldSettings[2] == '') ? 'false' : 'true'),
681
  'visual' => ((!isset($soundcloudIsGoldSettings[3]) || $soundcloudIsGoldSettings[3] == '') ? 'false' : 'true'),
682
+ 'mini' => ((!isset($soundcloudIsGoldSettings[4]) || $soundcloudIsGoldSettings[4] == '') ? 'false' : 'true'),
683
  'width' => get_soundcloud_is_gold_default_width($soundcloudIsGoldWidthSettings),
684
  'height' => ((!isset($soundcloudIsGoldHeightSettings['square']) || $soundcloudIsGoldHeightSettings['square'] == '') ? 'false' : 'true'),
685
+ 'playlistheight' => ((!isset($soundcloudIsGoldHeightSettings['playlist']) || $soundcloudIsGoldHeightSettings['playlist'] == '') ? '' : $soundcloudIsGoldHeightSettings['playlist']),
686
+ 'classes' => $soundcloudIsGoldClasses,
687
  'color' => $soundcloudIsGoldColor,
688
  'format' => 'tracks'
689
  ), $atts )
690
  );
691
+
692
+ return soundcloud_is_gold_player($id, $user, $autoplay, $comments, $width, $height, $playlistheight, $classes, $color, $artwork, $visual, $mini, $format);
693
  }
694
 
695
 
701
 
702
 
703
  /** The Player **/
704
+ function soundcloud_is_gold_player($id, $user, $autoPlay, $comments, $width, $height, $playlistHeight, $classes, $color, $artwork, $visual, $mini, $format){
705
 
706
  $options = get_option('soundcloud_is_gold_options');
707
 
716
  if(!isset($comments)) $comments = ((!isset($soundcloudIsGoldSettings[1]) || $soundcloudIsGoldSettings[1] == '') ? 'false' : 'true');
717
  if(!isset($artwork)) $artwork = ((!isset($soundcloudIsGoldSettings[2]) || $soundcloudIsGoldSettings[2] == '') ? 'false' : 'true');
718
  if(!isset($visual)) $visual = ((!isset($soundcloudIsGoldSettings[3]) || $soundcloudIsGoldSettings[3] == '') ? 'false' : 'true');
719
+ if(!isset($mini)) $mini = ((!isset($soundcloudIsGoldSettings[4]) || $soundcloudIsGoldSettings[4] == '') ? 'false' : 'true');
720
+ if(!isset($width)) $width = get_soundcloud_is_gold_default_width($soundcloudIsGoldWidthSettings);
721
  if(!isset($height)) $height = ((!isset($soundcloudIsGoldHeightSettings['square']) || $soundcloudIsGoldHeightSettings['square'] == '') ? 'false' : 'true');
722
+ if(!isset($playlistHeight)) $playlistHeight = ((!isset($soundcloudIsGoldHeightSettings['playlist']) || $soundcloudIsGoldHeightSettings['playlist'] == '') ? '' : $soundcloudIsGoldHeightSettings['playlist']);
723
  if(!isset($classes)) $classes = $soundcloudIsGoldClasses;
724
  if(!isset($color)) $color = $soundcloudIsGoldColor;
725
  if(!isset($format)) $format = 'tracks';
740
  //Reset Favorites to tracks as soundcloud treats them as tracks.
741
  if($format == 'favorites') $format = "tracks";
742
 
743
+
744
+ //Height Logic (Include force square)
745
  if($height == 'true' && $visual == 'true') $height = '450px';
746
+ else{
747
+ if($format == 'tracks') $height = '166px';
748
+ else{
749
+ //Default height
750
+ if ($playlistHeight == "" ) $height = '450px';
751
+ //Custom height
752
+ else $height = trim($playlistHeight);
753
+ }
754
+ }
755
 
756
 
757
+ //Force Mini Player (only for tracks)
758
+ if($mini == 'true' && $format == 'tracks') $height = '20px';
759
+
760
  //Html5 Player
761
  $player = '<div class="soundcloudIsGold '.esc_attr($classes).'" id="soundcloud-'.esc_attr($id).'">';
762
  $player .= '<iframe width="'.esc_attr($width).'" height="'.esc_attr($height).'" scrolling="no" frameborder="no" src="https://w.soundcloud.com/player/?url=https%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).'&amp;visual='.esc_attr($visual).'&amp;show_comments='.esc_attr($comments).'"></iframe>';
795
  /** Preview **/
796
  add_action('wp_ajax_soundcloud_is_gold_player_preview', 'soundcloud_is_gold_player_preview');
797
  function soundcloud_is_gold_player_preview(){
798
+ if(isset($_POST['request'])) echo soundcloud_is_gold_player(no_more_XSS($_POST['ID']), no_more_XSS($_POST['user']), no_more_XSS($_POST['autoPlay']), no_more_XSS($_POST['comments']), no_more_XSS($_POST['width']), no_more_XSS($_POST['height']), no_more_XSS($_POST['playlistHeight']), no_more_XSS($_POST['classes']), no_more_XSS($_POST['color']), no_more_XSS($_POST['artwork']), no_more_XSS($_POST['visual']), no_more_XSS($_POST['mini']), no_more_XSS($_POST['format']));
799
  die;
800
  }
801
  /** viewer Ajax **/
821
  $options = get_option('soundcloud_is_gold_options');
822
  //Replace spaces with hyphen in case users enter their name without it
823
  $newUsername = str_replace(" ", "-", trim($_POST['username']));
824
+ //Trim the soundcloud url in case the user enters the full url
825
+ $newUsername = str_replace("https://soundcloud.com/", "", $newUsername);
826
  //Get user info
827
  $userInfo = soundcloud_is_gold_user_info($newUsername);
828
  //Check that plugin's options are in place and that we've got $userinfo
900
  die;
901
  }
902
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
903
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
904
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
905
 
906
+ /********************************/
907
+ /* */
908
+ /* Templating */
909
+ /* */
910
+ /********************************/
911
+
912
+ function soundcloud_options_header(){ ?>
913
+ <script type="text/javascript">
914
+ //Set default Soundcloud Is Gold Settings
915
+ <?php get_soundcloud_is_gold_default_settings_for_js(); ?>
916
+ </script>
917
+
918
+
919
+ <!-- XXS test -->
920
+ <!-- <form method="POST" action="
921
+ http://localhost/~thomas/Others/dev/wp-admin/admin-ajax.php?action=get_soundcloud_player" />
922
+ <input type="text" name="id" value='"></param></object><img src=xonerror=alert(1) />' />
923
+ <input type="text" name="format" value="1">
924
+ <input type="submit" name="submit" />
925
+ </form> -->
926
+
927
+ <div class="soundcloudMMWrapper soundcloudMMOptions soundcloudMMMainWrapper">
928
+ <!-- Survey -->
929
+ <!-- a href="/" id="soundcloudMMSurvey" class="button-primary" target="_blank" >Help me make a better plugin by taking this super short survey ></a -->
930
+ <!-- Header -->
931
+ <div id="soundcloudMMTop">
932
+ <div class="leftPart">
933
+ <img id="soundcloudMMPowered" width="104" height="32" src="https://developers.soundcloud.com/assets/powered_by_black-4339b4c3c9cf88da9bfb15a16c4f6914.png">
934
+ <h1>SoundCloud is gold <small>v<?php echo get_soundcloud_is_gold_version($options) ?></small></h1>
935
+ <p><?php _e('This is your main options page. You can set a default styling for your site and link to your soundcloud accounts.', 'soundcloud-is-gold') ?></p>
936
+ </div>
937
+ <div class="rightPart">
938
+ <ul id="soundcloudMMExtras" class="">
939
+ <li><a href="https://wordpress.org/support/plugin/soundcloud-is-gold" target="_blank" title="Soundcloud is Gold Forum" class="soundcloudMMBt button-primary"><?php _e('Problems? Support Forum', 'soundcloud-is-gold') ?></a></li>
940
+ <li>
941
+ <form class="soundcloudMMBtForm" action="https://www.paypal.com/cgi-bin/webscr" method="post">
942
+ <input type="hidden" name="cmd" value="_s-xclick">
943
+ <input type="hidden" name="hosted_button_id" value="9VGA6PYQWETGY">
944
+ <input type="submit" name="submit" value="<?php _e('Keep this plugin alive with a donation', 'soundcloud-is-gold') ?>" class="soundcloudMMBt button-primary" alt="PayPal - The safer, easier way to pay online.">
945
+ <img alt="" border="0" src="https://www.paypalobjects.com/en_GB/i/scr/pixel.gif" width="1" height="1">
946
+ </form>
947
+ </li>
948
+ </ul>
949
+ </div>
950
+ </div>
951
+ <!-- Main -->
952
+ <div id="soundcloudMMMain" class="">
953
+ <?php
954
+ //Soundcloud doesn't allow for asking new API keys, so on hold until then
955
+ //$active_options_page = $_GET['page'];
956
+ ?>
957
+ <!-- <h2 class="nav-tab-wrapper">
958
+ <a href="admin.php?page=soundcloud-is-gold/soundcloud-is-gold.php" class="nav-tab <?php echo $active_options_page == 'soundcloud-is-gold/soundcloud-is-gold.php' ? 'nav-tab-active' : ''; ?>">Main Options</a>
959
+ <a href="admin.php?page=soundcloud_is_gold_advance_options" class="nav-tab <?php echo $active_options_page == 'soundcloud_is_gold_advance_options' ? 'nav-tab-active' : ''; ?>">Advance Options</a>
960
+ </h2> -->
961
+ <?php }
962
+
963
+
964
+ function soundcloud_options_footer(){ ?>
965
+ </div> <!-- Closing #soundcloudMMMain -->
966
+ <p id="disclaimer"><?php _e('SoundCloud and SoundCloud Logo are trademarks of SoundCloud Ltd.', 'soundcloud-is-gold') ?></p>
967
+ </div> <!-- Closing #soundcloudMMWrapper -->
968
+ <?php }
969
  ?>
soundcloud-is-gold-js.js CHANGED
@@ -176,7 +176,7 @@ jQuery(document).ready(function($){
176
  $('input[type=checkbox], input[type=radio], .soundcloudMMWPSelectedWidth, .soundcloudMMColorPickerClose', this).click(function(){
177
  updateMe(mySelf, true);
178
  });
179
- $('.soundcloudMMCustomSelectedWidth, .soundcloudMMClasses', this).focusout(function(){
180
  updateMe(mySelf, true);
181
  });
182
  //Initialize color Picker
@@ -203,12 +203,16 @@ jQuery(document).ready(function($){
203
  else artwork = true;
204
  if($('.soundcloudMMShowVisual:checked', parent).val() == undefined) visual = false;
205
  else visual = true;
 
 
206
  //Set width
207
  if($(".soundcloudMMWpWidth", parent).is(":checked")) width = $('.soundcloudMMWidth option:selected', parent).val();
208
  if($(".soundcloudMMCustomWidth", parent).is(":checked")) width = $('input.soundcloudMMWidth', parent).val();
209
  //Set height
210
  if($('.soundcloudMMSquareHeight:checked', parent).val() == undefined) height = false;
211
  else height = true;
 
 
212
  //Class
213
  classes = $('.soundcloudMMClasses', parent).val();
214
  //Color
@@ -217,10 +221,11 @@ jQuery(document).ready(function($){
217
  //Format
218
  if($('.soundcloudMMWrapper').hasClass('playlists')) format = 'playlists';
219
  else format = 'tracks';
 
220
  //Set Shortocode Attributes
221
- if(!parent.hasClass('soundcloudMMOptions')) shortcode(parent, autoPlay, comments, width, height, classes, color, artwork, visual, format);
222
  //Refresh Preview if requested
223
- if(refresh) preview(parent, user, autoPlay, comments, width, height, classes, color, artwork, visual, format);
224
 
225
  };
226
 
@@ -247,14 +252,16 @@ jQuery(document).ready(function($){
247
  /********************************************/
248
  /** SHORTCODE **/
249
  /********************************************/
250
- function shortcode(parent, autoPlay, comments, width, height, classes, color, artwork, visual, format){
251
  var shortcode = "soundcloud id='"+getID($('.soundcloudMMId', parent))+"'";
252
  if(comments != soundcloudIsGoldComments_default) shortcode += " comments='"+comments+"'";
253
  if(artwork != soundcloudIsGoldArtwork_default) shortcode += " artwork='"+artwork+"'";
254
  if(visual != soundcloudIsGoldVisual_default) shortcode += " visual='"+visual+"'";
 
255
  if(autoPlay != soundcloudIsGoldAutoPlay_default) shortcode += " autoPlay='"+autoPlay+"'";
256
  if(width != soundcloudIsGoldWidth_default) shortcode += " width='"+width+"'";
257
  if(height != soundcloudIsGoldHeight_default) shortcode += " height='"+height+"'";
 
258
  if(classes != soundcloudIsGoldClasses_default) shortcode += " classes='"+classes+"'";
259
  if(color != soundcloudIsGoldColor_default) shortcode += " color='"+color+"'";
260
  if(format != 'tracks') shortcode += " format='playlist'";
@@ -266,12 +273,14 @@ jQuery(document).ready(function($){
266
  /********************************************/
267
  /** PREVIEW **/
268
  /********************************************/
269
- function preview(parent, user, autoPlay, comments, width, height, classes, color, artwork, visual, format){
270
  //Animate transition
271
  //Set Height
272
  newHeight = '450';
 
273
  if(format == 'tracks') newHeight = '166';
274
  if(visual == 'true' && height == 'true') newHeight = '450';
 
275
 
276
  //Set request
277
  var myData = {
@@ -283,8 +292,10 @@ jQuery(document).ready(function($){
283
  autoPlay: autoPlay,
284
  artwork: artwork,
285
  visual: visual,
 
286
  width: width,
287
  height: height,
 
288
  classes: classes,
289
  color: color,
290
  format: format
176
  $('input[type=checkbox], input[type=radio], .soundcloudMMWPSelectedWidth, .soundcloudMMColorPickerClose', this).click(function(){
177
  updateMe(mySelf, true);
178
  });
179
+ $('.soundcloudMMCustomSelectedWidth, .soundcloudMMPlaylistHeight, .soundcloudMMClasses', this).focusout(function(){
180
  updateMe(mySelf, true);
181
  });
182
  //Initialize color Picker
203
  else artwork = true;
204
  if($('.soundcloudMMShowVisual:checked', parent).val() == undefined) visual = false;
205
  else visual = true;
206
+ if($('.soundcloudMMSForceMini:checked', parent).val() == undefined) mini = false;
207
+ else mini = true;
208
  //Set width
209
  if($(".soundcloudMMWpWidth", parent).is(":checked")) width = $('.soundcloudMMWidth option:selected', parent).val();
210
  if($(".soundcloudMMCustomWidth", parent).is(":checked")) width = $('input.soundcloudMMWidth', parent).val();
211
  //Set height
212
  if($('.soundcloudMMSquareHeight:checked', parent).val() == undefined) height = false;
213
  else height = true;
214
+ //Set playlist height
215
+ playlistHeight = $('.soundcloudMMPlaylistHeight', parent).val();
216
  //Class
217
  classes = $('.soundcloudMMClasses', parent).val();
218
  //Color
221
  //Format
222
  if($('.soundcloudMMWrapper').hasClass('playlists')) format = 'playlists';
223
  else format = 'tracks';
224
+
225
  //Set Shortocode Attributes
226
+ if(!parent.hasClass('soundcloudMMOptions')) shortcode(parent, autoPlay, comments, width, height, playlistHeight, classes, color, artwork, visual, mini, format);
227
  //Refresh Preview if requested
228
+ if(refresh) preview(parent, user, autoPlay, comments, width, height, playlistHeight, classes, color, artwork, visual, mini, format);
229
 
230
  };
231
 
252
  /********************************************/
253
  /** SHORTCODE **/
254
  /********************************************/
255
+ function shortcode(parent, autoPlay, comments, width, height, playlistHeight, classes, color, artwork, visual, mini, format){
256
  var shortcode = "soundcloud id='"+getID($('.soundcloudMMId', parent))+"'";
257
  if(comments != soundcloudIsGoldComments_default) shortcode += " comments='"+comments+"'";
258
  if(artwork != soundcloudIsGoldArtwork_default) shortcode += " artwork='"+artwork+"'";
259
  if(visual != soundcloudIsGoldVisual_default) shortcode += " visual='"+visual+"'";
260
+ if(mini != soundcloudIsGoldMini_default) shortcode += " mini='"+mini+"'";
261
  if(autoPlay != soundcloudIsGoldAutoPlay_default) shortcode += " autoPlay='"+autoPlay+"'";
262
  if(width != soundcloudIsGoldWidth_default) shortcode += " width='"+width+"'";
263
  if(height != soundcloudIsGoldHeight_default) shortcode += " height='"+height+"'";
264
+ if(playlistHeight != soundcloudIsGoldPlaylistHeight_default) shortcode += " playlistHeight='"+playlistHeight+"'";
265
  if(classes != soundcloudIsGoldClasses_default) shortcode += " classes='"+classes+"'";
266
  if(color != soundcloudIsGoldColor_default) shortcode += " color='"+color+"'";
267
  if(format != 'tracks') shortcode += " format='playlist'";
273
  /********************************************/
274
  /** PREVIEW **/
275
  /********************************************/
276
+ function preview(parent, user, autoPlay, comments, width, height, playlistHeight, classes, color, artwork, visual, mini, format){
277
  //Animate transition
278
  //Set Height
279
  newHeight = '450';
280
+ if(playlistHeight != '' && format == 'playlist') newHeight = playlistHeight;
281
  if(format == 'tracks') newHeight = '166';
282
  if(visual == 'true' && height == 'true') newHeight = '450';
283
+ if(format == 'tracks' && mini == 'true') newHeight = '20';
284
 
285
  //Set request
286
  var myData = {
292
  autoPlay: autoPlay,
293
  artwork: artwork,
294
  visual: visual,
295
+ mini: mini,
296
  width: width,
297
  height: height,
298
+ playlistHeight: playlistHeight,
299
  classes: classes,
300
  color: color,
301
  format: format
soundcloud-is-gold-widget.php ADDED
@@ -0,0 +1,254 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /*******************************************/
4
+ /** **/
5
+ /** WIDGET **/
6
+ /** **/
7
+ /*******************************************/
8
+ // register Soundcloud_Is_Gold_Widget
9
+ add_action( 'widgets_init', create_function( '', 'register_widget( "soundcloud_is_gold_widget" );' ) );
10
+ class Soundcloud_Is_Gold_Widget extends WP_Widget {
11
+
12
+ /**
13
+ * Register widget with WordPress.
14
+ */
15
+ public function __construct() {
16
+ parent::__construct(
17
+ 'soundcloud_is_gold_widget', // Base ID
18
+ 'Soundcloud is Gold', // Name
19
+ array( 'description' => __( 'Show your Latest Tracks, Favorites or Playlists for one or multiple users. If you\'re crasy go random for everything!', 'soundcloud-is-gold' ), ) // Args
20
+ );
21
+ }
22
+
23
+ /**
24
+ * Front-end display of widget.
25
+ *
26
+ * @see WP_Widget::widget()
27
+ *
28
+ * @param array $args Widget arguments.
29
+ * @param array $instance Saved values from database.
30
+ */
31
+ public function widget( $args, $instance ) {
32
+ extract( $args );
33
+ $title = apply_filters( 'widget_title', $instance['title'] );
34
+ $user = $instance['user'];
35
+ $autoplay = $instance['autoplay'] ? 'true' : 'false';
36
+ $comments = $instance['comments'] ? 'true' : 'false';
37
+ $artwork = $instance['artwork'] ? 'true' : 'false';
38
+ $visual = $instance['visual'] ? 'true' : 'false';
39
+ $mini = $instance['mini'] ? 'true' : 'false';
40
+ $classes = $instance['classes'];
41
+ $widthType = $instance['type'];
42
+ $wp = $instance['wp'];
43
+ $custom = $instance['custom'];
44
+ $width = ($widthType == 'wp') ? $wp : $custom;
45
+ $height = $instance['square'] ? 'true' : 'false';
46
+ $playlistHeight = $instance['playlistHeight'];
47
+ $behavior = $instance['behavior'];
48
+ $number = $instance['number'];
49
+ $format = $instance['format'];
50
+
51
+ //Fix for people updating from 2.3.3 when widgets settings were using "sets" for "playlists"
52
+ if($format == 'sets' || $format == 'set') $format = 'playlists';
53
+
54
+ //Random User
55
+ if($user == "randomUser") {
56
+ $options = get_option('soundcloud_is_gold_options');
57
+ //Fix bug when updating to 2.4.2 where API requests can only use user id
58
+ $options = soundcloud_is_gold_update_users($options);
59
+ //Pick Random User
60
+ $soundcloudIsGoldUsers = isset($options['soundcloud_is_gold_users']) ? array_random($options['soundcloud_is_gold_users'], 1) : '';
61
+ //printl($soundcloudIsGoldUsers[0][0]);
62
+ if(isset($soundcloudIsGoldUsers)) $user = $soundcloudIsGoldUsers[0][0];
63
+ }
64
+
65
+ echo $before_widget;
66
+ if ( ! empty( $title ) ) echo $before_title . $title . $after_title;
67
+
68
+ //Random User per Track
69
+ if($user == "randomUsers") {
70
+ $options = get_option('soundcloud_is_gold_options');
71
+ //Fix bug when updating to 2.4.2 where API requests can only use user id
72
+ $options = soundcloud_is_gold_update_users($options);
73
+ //Set Random User per Track
74
+ if(isset($options['soundcloud_is_gold_users'])){
75
+ //Never select more tracks than there is users.
76
+ $number = (count($options['soundcloud_is_gold_users']) <= $number) ? count($options['soundcloud_is_gold_users']) : $number;
77
+ $soundcloudIsGoldUsers = array_random($options['soundcloud_is_gold_users'], $number);
78
+ }
79
+ if(isset($soundcloudIsGoldUsers)){
80
+ foreach($soundcloudIsGoldUsers as $userKey=>$user){
81
+ if($userKey == 1) $autoplay = false;
82
+ foreach(get_soundcloud_is_gold_multiple_tracks_id($user[0], 1, ($behavior == "latest") ? FALSE : TRUE, $format) as $key=>$ids){
83
+ if($format == "favorites") $format = "tracks"; //Soundcloud treats Favorites as Tracks for the player.
84
+ echo soundcloud_is_gold_player($ids, NULL, $autoplay, $comments, $width, $height, $playlistHeight, $classes, NULL, $artwork, $visual, $mini, $format);
85
+ }
86
+ }
87
+ }
88
+ }
89
+ //One User
90
+ else{
91
+ foreach(get_soundcloud_is_gold_multiple_tracks_id($user, $number, ($behavior == "latest") ? FALSE : TRUE, $format) as $key=>$ids){
92
+ if($key == 1) $autoplay = false;
93
+ if($format == "favorites") $format = "tracks"; //Soundcloud treats Favorites as Tracks for the player.
94
+ echo soundcloud_is_gold_player($ids, NULL, $autoplay, $comments, $width, $height, $playlistHeight, $classes, NULL, $artwork, $visual, $mini, $format);
95
+ }
96
+ }
97
+
98
+ echo $after_widget;
99
+ }
100
+
101
+ /**
102
+ * Sanitize widget form values as they are saved.
103
+ *
104
+ * @see WP_Widget::update()
105
+ *
106
+ * @param array $new_instance Values just sent to be saved.
107
+ * @param array $old_instance Previously saved values from database.
108
+ *
109
+ * @return array Updated safe values to be saved.
110
+ */
111
+ public function update( $new_instance, $old_instance ) {
112
+ $instance = array();
113
+ $instance['title'] = strip_tags( $new_instance['title'] );
114
+ $instance['user'] = strip_tags( $new_instance['user'] );
115
+ $instance['format'] = strip_tags( $new_instance['format'] );
116
+ $instance['behavior'] = strip_tags( $new_instance['behavior'] );
117
+ $instance['number'] = strip_tags( $new_instance['number'] );
118
+ $instance['autoplay'] = strip_tags( $new_instance['autoplay'] );
119
+ $instance['comments'] = strip_tags( $new_instance['comments'] );
120
+ $instance['artwork'] = strip_tags( $new_instance['artwork'] );
121
+ $instance['visual'] = strip_tags( $new_instance['visual'] );
122
+ $instance['mini'] = strip_tags( $new_instance['mini'] );
123
+ $instance['classes'] = strip_tags( $new_instance['classes'] );
124
+ $instance['type'] = strip_tags( $new_instance['type'] );
125
+ $instance['wp'] = strip_tags( $new_instance['wp'] );
126
+ $instance['custom'] = strip_tags( $new_instance['custom'] );
127
+ $instance['square'] = strip_tags( $new_instance['square'] );
128
+ $instance['playlistHeight'] = strip_tags( $new_instance['playlistHeight'] );
129
+
130
+ return $instance;
131
+ }
132
+
133
+ /**
134
+ * Back-end widget form.
135
+ *
136
+ * @see WP_Widget::form()
137
+ *
138
+ * @param array $instance Previously saved values from database.
139
+ */
140
+ public function form( $instance ) {
141
+ if ( isset( $instance[ 'title' ] ) ) {
142
+ $title = $instance[ 'title' ];
143
+ }
144
+ else {
145
+ $title = __( 'Latest', 'soundcloud-is-gold' );
146
+ }
147
+ //Get Plugin Options
148
+ $options = get_option('soundcloud_is_gold_options');
149
+ //Fix bug when updating to 2.4.2 where API requests can only use user id
150
+ $options = soundcloud_is_gold_update_users($options);
151
+ ?>
152
+ <!-- Title -->
153
+ <p>
154
+ <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'soundcloud-is-gold'); ?></label>
155
+ <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />
156
+ </p>
157
+ <!-- Users -->
158
+ <p>
159
+ <label for="<?php echo $this->get_field_id('user'); ?>"><?php _e( 'Username:', 'soundcloud-is-gold' ); ?></label>
160
+ <select name="<?php echo $this->get_field_name('user'); ?>" id="<?php echo $this->get_field_id('user'); ?>" class="widefat">
161
+ <?php
162
+ foreach($options['soundcloud_is_gold_users'] as $user) : ?>
163
+ <option value="<?php echo $user[0] ?>"<?php selected( $instance['user'], $user[0] ); ?>><?php _e($user[1]); ?></option>
164
+ <?php endforeach; ?>
165
+ <option value="randomUser"<?php selected( $instance['user'], "randomUser" ); ?>><?php _e("Pick a Random User", 'soundcloud-is-gold'); ?></option>
166
+ <option value="randomUsers"<?php selected( $instance['user'], "randomUsers" ); ?>><?php _e("Pick a Random User per Track", 'soundcloud-is-gold'); ?></option>
167
+ </select>
168
+ </p>
169
+ <!-- Main options -->
170
+ <?php
171
+ $autoplay = (isset($instance['autoplay']) && $instance['autoplay']) ? 'checked="checked"' : '';
172
+ $comments = (isset($instance['comments']) && $instance['comments']) ? 'checked="checked"' : '';
173
+ $artwork = (isset($instance['artwork']) && $instance['artwork']) ? 'checked="checked"' : '';
174
+ $visual = (isset($instance['visual']) && $instance['visual']) ? 'checked="checked"' : '';
175
+ $mini = (isset($instance['mini']) && $instance['mini']) ? 'checked="checked"' : '';
176
+ ?>
177
+ <p>
178
+ <label for=""><?php _e( 'Settings:', 'soundcloud-is-gold' ); ?></label>
179
+ <select name="<?php echo $this->get_field_name('format'); ?>" id="<?php echo $this->get_field_id('format'); ?>" class="widefat">
180
+ <option value="tracks"<?php selected( $instance['format'], "tracks" ); ?>><?php _e("tracks", 'soundcloud-is-gold'); ?></option>
181
+ <option value="favorites"<?php selected( $instance['format'], "favorites" ); ?>><?php _e("favorites", 'soundcloud-is-gold'); ?></option>
182
+ <option value="playlists"<?php selected( $instance['format'], "playlists" ); ?>><?php _e("playlists", 'soundcloud-is-gold'); ?></option>
183
+ </select>
184
+ <br/>
185
+ <br/>
186
+ <select name="<?php echo $this->get_field_name('behavior'); ?>" id="<?php echo $this->get_field_id('behavior'); ?>" class="widefat">
187
+ <option value="latest"<?php selected( $instance['behavior'], "latest" ); ?>><?php _e("Latest", 'soundcloud-is-gold'); ?></option>
188
+ <option value="random"<?php selected( $instance['behavior'], "random" ); ?>><?php _e("Random", 'soundcloud-is-gold'); ?></option>
189
+ </select>
190
+ <br/>
191
+ <br/>
192
+ <select name="<?php echo $this->get_field_name('number'); ?>" id="<?php echo $this->get_field_id('number'); ?>" class="widefat">
193
+ <?php
194
+ for($i=1; $i<=10; $i++) : ?>
195
+ <option value="<?php echo $i ?>"<?php selected( $instance['number'], $i ); ?>><?php _e($i); ?></option>
196
+ <?php endfor; ?>
197
+ </select>
198
+ <br/>
199
+ <br/>
200
+ <input class="checkbox" type="checkbox" <?php echo $autoplay; ?> id="<?php echo $this->get_field_id('autoplay'); ?>" name="<?php echo $this->get_field_name('autoplay'); ?>" /> <label for="<?php echo $this->get_field_id('autoplay'); ?>"><?php _e('Play Automatically', 'soundcloud-is-gold'); ?></label>
201
+ <br/>
202
+ <input class="checkbox" type="checkbox" <?php echo $comments; ?> id="<?php echo $this->get_field_id('comments'); ?>" name="<?php echo $this->get_field_name('comments'); ?>" /> <label for="<?php echo $this->get_field_id('comments'); ?>"><?php _e('Show comments', 'soundcloud-is-gold'); ?></label>
203
+ <br/>
204
+ <input class="checkbox" type="checkbox" <?php echo $artwork; ?> id="<?php echo $this->get_field_id('artwork'); ?>" name="<?php echo $this->get_field_name('artwork'); ?>" /> <label for="<?php echo $this->get_field_id('artwork'); ?>"><?php _e('Show Artwork', 'soundcloud-is-gold', 'soundcloud-is-gold'); ?></label>
205
+ <br/>
206
+ <input class="checkbox" type="checkbox" <?php echo $visual; ?> id="<?php echo $this->get_field_id('visual'); ?>" name="<?php echo $this->get_field_name('visual'); ?>" /> <label for="<?php echo $this->get_field_id('visual'); ?>"><?php _e('Full Visual <small>(use soundcloud colors)</small>', 'soundcloud-is-gold'); ?></label>
207
+ <br/>
208
+ <input class="checkbox" type="checkbox" <?php echo $mini; ?> id="<?php echo $this->get_field_id('mini'); ?>" name="<?php echo $this->get_field_name('mini'); ?>" /> <label for="<?php echo $this->get_field_id('mini'); ?>"><?php _e('Force Mini Player <small>(Artwork and comments won\'t show)</small>', 'soundcloud-is-gold'); ?></label>
209
+ </p>
210
+ <!-- Width -->
211
+ <?php
212
+
213
+ ?>
214
+ </br>
215
+ <p>
216
+ <label for=""><?php _e( 'Width:', 'soundcloud-is-gold' ); ?></label>
217
+ <p>
218
+ <input type="radio" <?php checked( $instance['type'], "wp" ); ?> value="wp" id="wp" name="<?php echo $this->get_field_name('type'); ?>" /><label for="wp"><?php _e('Media Width', 'soundcloud-is-gold') ?></label>
219
+ <br/>
220
+ <select name="<?php echo $this->get_field_name('wp'); ?>" id="<?php echo $this->get_field_id('wp'); ?>" class="widefat">
221
+ <?php foreach(get_soundcloud_is_gold_wordpress_sizes() as $key => $soundcloudIsGoldMediaSize) : ?>
222
+ <option value="<?php echo $soundcloudIsGoldMediaSize[0]?>" <?php selected( $instance['wp'], $soundcloudIsGoldMediaSize[0] ); ?>><?php _e($key.': '.$soundcloudIsGoldMediaSize[0]); ?></option>
223
+ <?php endforeach; ?>
224
+ </select>
225
+ </p>
226
+ <p>
227
+ <input type="radio" <?php checked( $instance['type'], "custom" ); ?> value="custom" id="custom" name="<?php echo $this->get_field_name('type'); ?>" /><label for="custom"><?php _e('Custom Width', 'soundcloud-is-gold') ?></label>
228
+ <br/>
229
+ <input type="text" value="<?php echo $instance['custom'] ? $instance['custom'] : "100%" ?>" id="<?php echo $this->get_field_id('custom'); ?>" name="<?php echo $this->get_field_name('custom'); ?>"/>
230
+ </p>
231
+ </p>
232
+ </br>
233
+ <p>
234
+ <label for=""><?php _e( 'Height:', 'soundcloud-is-gold' ); ?></label>
235
+ <p>
236
+ <label for="<?php echo $this->get_field_id('playlistHeight'); ?>"><?php _e('Playlist Height <small>(leave empty for default, can\'t be less than 300px)</small>', 'soundcloud-is-gold'); ?></label>
237
+ <input type="text" value="<?php echo $instance['playlistHeight'] ? $instance['playlistHeight'] : "" ?>" id="<?php echo $this->get_field_id('playlistHeight'); ?>" name="<?php echo $this->get_field_name('playlistHeight'); ?>"/>
238
+ </p>
239
+ <p>
240
+ <?php $square = (isset($instance['square']) && $instance['square']) ? 'checked="checked"' : ''; ?>
241
+ <input class="checkbox" type="checkbox" <?php echo $square; ?> id="<?php echo $this->get_field_id('square'); ?>" name="<?php echo $this->get_field_name('square'); ?>" /> <label for="<?php echo $this->get_field_id('square'); ?>"><?php _e('Force Square Player <small>(Visual)</small>', 'soundcloud-is-gold'); ?></label>
242
+ </p>
243
+ </p>
244
+ </br>
245
+ <!-- Classes -->
246
+ <p>
247
+ <label for="<?php echo $this->get_field_id('classes'); ?>"><?php _e( 'CSS Classes <small>(no commas)</small>:', 'soundcloud-is-gold' ); ?></label>
248
+ <input type="text" value="<?php echo $instance['classes'] ?>" id="<?php echo $this->get_field_id('classes'); ?>" name="<?php echo $this->get_field_name('classes'); ?>"/>
249
+ </p>
250
+ <?php
251
+ }
252
+
253
+ } // class Foo_Widget
254
+ ?>
soundcloud-is-gold.php CHANGED
@@ -3,10 +3,11 @@
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. Select, set and add track, playlists 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 (Standard, Artwork, Visual), its width, extra Css 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: 2.4.3
7
  Author: Thomas Michalak
8
  Author URI: http://www.mightymess.com/thomas-michalak
9
  License: GPL2 or Later
 
10
  */
11
 
12
  /*
@@ -26,6 +27,8 @@ define ('CLIENT_ID', '9UhNtlbTIh7V6YHJm9wwHgjCwd7t1xOk');
26
 
27
  require_once('soundcloud-is-gold-notice.php');
28
  require_once('soundcloud-is-gold-functions.php');
 
 
29
 
30
  /** Get Plugin Version **/
31
  function get_soundcloud_is_gold_version() {
@@ -41,9 +44,8 @@ function soundcloud_is_gold_admin_init() {
41
  wp_register_script('soundcloud-is-gold-js', SIG_PLUGIN_DIR.'soundcloud-is-gold-js.js', array('jquery', 'farbtastic'));
42
  wp_register_script('carouFredSel', SIG_PLUGIN_DIR.'includes/jquery.carouFredSel-5.5.0-packed.js', array('jquery'));
43
  wp_register_style('soundcloud-is-gold-css', SIG_PLUGIN_DIR.'soundcloud-is-gold-css.css');
44
- //wp_register_style('ChunkFive', SIG_PLUGIN_DIR.'includes/ChunkFive-fontfacekit/stylesheet.css');
45
- //wp_register_style('Quicksand', SIG_PLUGIN_DIR.'includes/Quicksand-fontfacekit/stylesheet.css');
46
  wp_register_style('soundcloud-is-gold-editor-css', SIG_PLUGIN_DIR.'tinymce-plugin/soundcloud-is-gold-editor_plugin.css');
 
47
  }
48
  //Plugin option scripts
49
  function soundcloud_is_gold_option_scripts() {
@@ -69,12 +71,14 @@ function soundcloud_is_gold_menu() {
69
  add_action( "admin_print_scripts-$soundcloudIsGoldPage", 'soundcloud_is_gold_option_scripts' ); // Add script
70
  add_action( "admin_print_styles-$soundcloudIsGoldPage", 'soundcloud_is_gold_option_styles' ); // Add Style
71
  //add_action( "admin_print_styles-$soundcloudIsGoldPage", 'soundcloud_is_gold_option_fonts' ); // Add Fonts
72
- //Development
73
- /*$soundcloudIsGoldDevPage = add_submenu_page( __FILE__, 'Soundcloud is Gold: Dev', 'Development Options', 'activate_plugins', 'soundcloud_is_gold_dev_options', soundcloud_is_gold_dev_options );
74
- add_action( "admin_print_scripts-$soundcloudIsGoldDevPage", 'soundcloud_is_gold_option_scripts' ); // Add script
75
- add_action( "admin_print_styles-$soundcloudIsGoldDevPage", 'soundcloud_is_gold_option_styles' ); // Add Style
76
- add_action( "admin_print_styles-$soundcloudIsGoldDevPage", 'soundcloud_is_gold_option_fonts' ); // Add Fonts
 
77
  */
 
78
  }
79
 
80
  /*** Link to Settings from the plugin Page ***/
@@ -102,9 +106,9 @@ function soundcloud_is_gold_add_defaults() {
102
  if(empty($tmpOptions)) {
103
  //Set default Users and Pick a random user to be active
104
  $soundcloudIsGoldDefaultUsers = array(
105
- 'anna-chocola' => array('anna-chocola', 'https://i1.sndcdn.com/avatars-000009470567-spqine-large.jpg?4387aef'),
106
- 't-m' => array('t-m', 'https://i1.sndcdn.com/avatars-000002680779-fkvvpj-large.jpg?4387aef'),
107
- 'my-disco-nap' => array('my-disco-nap', 'https://i1.sndcdn.com/avatars-000012680897-foqv41-large.jpg?b9f92e9')
108
  );
109
  $soundcloudIsGoldDefaultUser = $soundcloudIsGoldDefaultUsers[array_rand($soundcloudIsGoldDefaultUsers, 1)][0];
110
  //Set Default Settings
@@ -185,71 +189,35 @@ function soundcloud_is_gold_options(){
185
  }
186
  $soundcouldMMShortcode = '[soundcloud id='.$soundcouldMMId.']';
187
 
 
 
188
  ?>
189
-
190
- <script type="text/javascript">
191
- //Set default Soundcloud Is Gold Settings
192
- <?php get_soundcloud_is_gold_default_settings_for_js(); ?>
193
- </script>
194
-
195
-
196
- <!-- XXS test -->
197
- <!-- <form method="POST" action="
198
- http://localhost/~thomas/Others/dev/wp-admin/admin-ajax.php?action=get_soundcloud_player" />
199
- <input type="text" name="id" value='"></param></object><img src=xonerror=alert(1) />' />
200
- <input type="text" name="format" value="1">
201
- <input type="submit" name="submit" />
202
- </form> -->
203
-
204
- <div class="soundcloudMMWrapper soundcloudMMOptions soundcloudMMMainWrapper">
205
- <!-- Survey -->
206
- <a href="https://mightymess.typeform.com/to/Bg82kF" id="soundcloudMMSurvey" class="button-primary" target="_blank" >Help me make a better plugin by taking this super short survey ></a>
207
- <!-- Header -->
208
- <div id="soundcloudMMTop">
209
- <div class="leftPart">
210
- <img id="soundcloudMMPowered" width="104" height="32" src="https://developers.soundcloud.com/assets/powered_by_black-4339b4c3c9cf88da9bfb15a16c4f6914.png">
211
- <h1>SoundCloud is gold <small>v<?php echo get_soundcloud_is_gold_version($options) ?></small></h1>
212
- <p>This is your main options page. You can set a default styling for your site and link to your soundcloud accounts.</p>
213
- </div>
214
- <div class="rightPart">
215
- <ul id="soundcloudMMExtras" class="">
216
- <li><a href="https://wordpress.org/tags/soundcloud-is-gold?forum_id=10" title="Soundcloud is Gold Forum" class="soundcloudMMBt button-primary">Support Forum</a></li>
217
- <li>
218
- <form class="soundcloudMMBtForm" action="https://www.paypal.com/cgi-bin/webscr" method="post">
219
- <input type="hidden" name="cmd" value="_s-xclick">
220
- <input type="hidden" name="hosted_button_id" value="9VGA6PYQWETGY">
221
- <input type="submit" name="submit" value="Please help with a donation" class="soundcloudMMBt button-primary" alt="PayPal - The safer, easier way to pay online.">
222
- <img alt="" border="0" src="https://www.paypalobjects.com/en_GB/i/scr/pixel.gif" width="1" height="1">
223
- </form>
224
- </li>
225
- </ul>
226
- </div>
227
- </div>
228
- <!-- Main -->
229
- <div id="soundcloudMMMain" class="">
230
  <form method="post" action="options.php" id="soundcloudMMMainForm" name="soundcloudMMMainForm" class="">
231
  <p class="hidden soundcloudMMId" id="soundcloudMMId-<?php echo $soundcouldMMId ?>"><?php echo $soundcouldMMId ?></p>
232
  <?php settings_fields('soundcloud_is_gold_options'); ?>
233
  <ul id="soundcloudMMSettings">
234
  <!-- Username -->
235
- <li class="soundcloudMMBox"><label class="optionLabel">User Name</label>
236
  <?php get_soundcloud_is_gold_username_interface($options, $soundcloudIsGoldUsers) ?>
237
  </li>
238
  <!-- Default Settings -->
239
  <li class="soundcloudMMBox">
240
- <label class="optionLabel">Default Settings</label>
241
  <ul class="subSettings checkboxes">
242
- <li><input type="checkbox" <?php echo (isset($soundcloudIsGoldSettings[0]) && $soundcloudIsGoldSettings[0]) ? 'checked="checked"' : ''?> name="soundcloud_is_gold_options[soundcloud_is_gold_settings][0]" value="true" class="soundcloudMMAutoPlay" id="soundcloudMMAutoPlay"/><label for="soundcloudMMAutoPlay">Play Automatically</label></li>
243
- <li><input type="checkbox" <?php echo (isset($soundcloudIsGoldSettings[1]) && $soundcloudIsGoldSettings[1]) ? 'checked="checked"' : ''?> name="soundcloud_is_gold_options[soundcloud_is_gold_settings][1]" value="true" class="soundcloudMMShowComments" id="soundcloudMMShowComments"/><label for="soundcloudMMShowComments">Show comments</label></li>
244
- <li><input type="checkbox" <?php echo (isset($soundcloudIsGoldSettings[2]) && $soundcloudIsGoldSettings[2]) ? 'checked="checked"' : ''?> name="soundcloud_is_gold_options[soundcloud_is_gold_settings][2]" value="true" class="soundcloudMMShowArtwork" id="soundcloudMMShowArtwork"/><label for="soundcloudMMShowArtwork">Show Artwork</label></li>
245
- <li><input type="checkbox" <?php echo (isset($soundcloudIsGoldSettings[3]) && $soundcloudIsGoldSettings[3]) ? 'checked="checked"' : ''?> name="soundcloud_is_gold_options[soundcloud_is_gold_settings][3]" value="true" class="soundcloudMMShowVisual" id="soundcloudMMShowVisual"/><label for="soundcloudMMShowVisual">Full Visual <small>(use soundcloud colors)</small></label></li>
246
- </ul>
 
 
 
247
  </li>
248
  <!-- Sizes -->
249
- <li class="soundcloudMMBox"><label class="optionLabel">Default Size</label>
250
  <ul id="soundcloudMMWidthSetting" class="subSettings texts">
251
  <li>
252
- <input name="soundcloud_is_gold_options[soundcloud_is_gold_width_settings][type]" <?php echo ($soundcloudIsGoldWidthSettings['type'] == "wp") ? 'checked="checked"' : ''; ?> id="soundcloudMMWpWidth" value="wp" type="radio" class="soundcloudMMWpWidth soundcloudMMWidthType radio"/><label for="soundcloudMMWpWidth">Media Width</label>
253
  <select class="soundcloudMMInput soundcloudMMWidth" name="soundcloud_is_gold_options[soundcloud_is_gold_width_settings][wp]">
254
  <?php foreach(get_soundcloud_is_gold_wordpress_sizes() as $key => $soundcloudIsGoldMediaSize) : ?>
255
  <?php
@@ -261,31 +229,37 @@ http://localhost/~thomas/Others/dev/wp-admin/admin-ajax.php?action=get_soundclou
261
  </select>
262
  </li>
263
  <li>
264
- <input name="soundcloud_is_gold_options[soundcloud_is_gold_width_settings][type]" <?php echo ($soundcloudIsGoldWidthSettings['type'] == "custom") ? 'checked="checked"' : ''; ?> id="soundcloudMMCustomWidth" value="custom" type="radio" class="soundcloudMMCustomWidth soundcloudMMWidthType radio"/><label for="soundcloudMMCustomWidth">Custom Width</label>
265
  <input name="soundcloud_is_gold_options[soundcloud_is_gold_width_settings][custom]" id="soundcloudMMCustomSelectedWidth" class="soundcloudMMInput soundcloudMMWidth soundcloudMMCustomSelectedWidth" type="text" name="soundcloud_is_gold_options[soundcloudMMCustomSelectedWidth]" value="<?php echo $soundcloudIsGoldWidthSettings['custom'] ?>" />
266
  </li>
267
- <li>
268
- <input type="checkbox" <?php echo (isset($soundcloudIsGoldHeightSettings['square']) && $soundcloudIsGoldHeightSettings['square']) ? 'checked="checked"' : ''?> name="soundcloud_is_gold_options[soundcloud_is_gold_height_settings][square]" value="true" class="soundcloudMMSquareHeight" id="soundcloudMMSquareHeight"/><label for="soundcloudMMSquareHeight">Force Visual Square</label>
269
- </li>
270
  </ul>
 
 
 
 
 
 
 
 
 
271
  </li>
272
  <!-- Color and Classes -->
273
- <li class="soundcloudMMBox"><label class="optionLabel">Extras</label>
274
  <ul class="subSettings texts">
275
  <li>
276
- <label>Color</label>
277
  <div class="soundcloudMMColorPickerContainer" id="soundcloudMMColorPickerContainer">
278
- <input type="text" class="soundcloudMMInput soundcloudMMColor" id="soundcloudMMColor" name="soundcloud_is_gold_options[soundcloud_is_gold_color]" value="<?php echo $soundcloudIsGoldColor ?>" style="background-color:<?php echo $soundcloudIsGoldColor ?>"/><a href="#" class="soundcloudMMBt soundcloudMMBtSmall inline blue soundcloudMMRounder soundcloudMMResetColor">reset to default</a>
279
- <div id="soundcloudMMColorPicker" class="shadow soundcloudMMColorPicker"><div id="soundcloudMMColorPickerSelect" class="soundcloudMMColorPickerSelect"></div><a id="soundcloudMMColorPickerClose" class="blue soundcloudMMBt soundcloudMMColorPickerClose">done</a></div>
280
  </div>
281
  </li>
282
  <li class="clear">
283
- <label>CSS Classes <small>(no commas)</small></label><input class="soundcloudMMInput soundcloudMMClasses" type="text" name="soundcloud_is_gold_options[soundcloud_is_gold_classes]" value="<?php echo $soundcloudIsGoldClasses ?>" />
284
  </li>
285
  </ul>
286
  </li>
287
  <!-- Preview -->
288
- <li class="soundcloudMMBox"><label class="optionLabel previewLabel">Live Preview <small>(your latest track)</small></label>
289
  <?php if($soundcloudIsGoldApiResponse['response']) :?>
290
  <p class="soundcloudMMEmbed soundcloudMMEmbedOptions" style="text-align:center;">
291
  <!-- Soundcloud Preview here -->
@@ -293,18 +267,18 @@ http://localhost/~thomas/Others/dev/wp-admin/admin-ajax.php?action=get_soundclou
293
  <p class="soundcloudMMLoading soundcloudMMPreviewLoading" style="display:none"></p>
294
  <?php else : ?>
295
  <!-- Error getting Json -->
296
- <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>
297
  <?php endif; ?>
298
  </li>
299
  </ul>
300
  <!-- Submit -->
301
  <p id="soundcloudMMSubmit"><input type="submit" name="Submit" value="<?php _e('Save Your SoundCloud Settings') ?>" class="soundcloudMMButton-primary button-primary"/></p>
302
  </form>
303
- </div>
304
- <p id="disclaimer">SoundCloud and SoundCloud Logo are trademarks of SoundCloud Ltd.</p>
305
- </div>
306
 
307
  <?php
 
 
 
308
  }
309
 
310
 
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. Select, set and add track, playlists 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 (Standard, Artwork, Visual), its width, extra Css 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: 2.5
7
  Author: Thomas Michalak
8
  Author URI: http://www.mightymess.com/thomas-michalak
9
  License: GPL2 or Later
10
+ Text Domain: soundcloud-is-gold
11
  */
12
 
13
  /*
27
 
28
  require_once('soundcloud-is-gold-notice.php');
29
  require_once('soundcloud-is-gold-functions.php');
30
+ require_once('soundcloud-is-gold-widget.php');
31
+ //require_once('soundcloud-is-gold-advance.php');
32
 
33
  /** Get Plugin Version **/
34
  function get_soundcloud_is_gold_version() {
44
  wp_register_script('soundcloud-is-gold-js', SIG_PLUGIN_DIR.'soundcloud-is-gold-js.js', array('jquery', 'farbtastic'));
45
  wp_register_script('carouFredSel', SIG_PLUGIN_DIR.'includes/jquery.carouFredSel-5.5.0-packed.js', array('jquery'));
46
  wp_register_style('soundcloud-is-gold-css', SIG_PLUGIN_DIR.'soundcloud-is-gold-css.css');
 
 
47
  wp_register_style('soundcloud-is-gold-editor-css', SIG_PLUGIN_DIR.'tinymce-plugin/soundcloud-is-gold-editor_plugin.css');
48
+ load_plugin_textdomain( 'soundcloud-is-gold' );
49
  }
50
  //Plugin option scripts
51
  function soundcloud_is_gold_option_scripts() {
71
  add_action( "admin_print_scripts-$soundcloudIsGoldPage", 'soundcloud_is_gold_option_scripts' ); // Add script
72
  add_action( "admin_print_styles-$soundcloudIsGoldPage", 'soundcloud_is_gold_option_styles' ); // Add Style
73
  //add_action( "admin_print_styles-$soundcloudIsGoldPage", 'soundcloud_is_gold_option_fonts' ); // Add Fonts
74
+
75
+ //Advance
76
+ /*$soundcloudIsGoldAdvancePage = add_submenu_page( __FILE__, 'Soundcloud is Gold: Advance', 'Advance Options', 'activate_plugins', 'soundcloud_is_gold_advance_options', soundcloud_is_gold_advance_options );
77
+ add_action( "admin_print_scripts-$soundcloudIsGoldAdvancePage", 'soundcloud_is_gold_option_scripts' ); // Add script
78
+ add_action( "admin_print_styles-$soundcloudIsGoldAdvancePage", 'soundcloud_is_gold_option_styles' ); // Add Style
79
+ add_action( "admin_print_styles-$soundcloudIsGoldAdvancePage", 'soundcloud_is_gold_option_fonts' ); // Add Fonts
80
  */
81
+
82
  }
83
 
84
  /*** Link to Settings from the plugin Page ***/
106
  if(empty($tmpOptions)) {
107
  //Set default Users and Pick a random user to be active
108
  $soundcloudIsGoldDefaultUsers = array(
109
+ '2708382' => array('2708382', 'anna-chocola', 'https://i1.sndcdn.com/avatars-000009470567-spqine-large.jpg?4387aef'),
110
+ '150596' => array('150596', 't-m', 'https://i1.sndcdn.com/avatars-000002680779-fkvvpj-large.jpg?4387aef'),
111
+ '3140049' => array('3140049', 'my-disco-nap', 'https://i1.sndcdn.com/avatars-000012680897-foqv41-large.jpg?b9f92e9')
112
  );
113
  $soundcloudIsGoldDefaultUser = $soundcloudIsGoldDefaultUsers[array_rand($soundcloudIsGoldDefaultUsers, 1)][0];
114
  //Set Default Settings
189
  }
190
  $soundcouldMMShortcode = '[soundcloud id='.$soundcouldMMId.']';
191
 
192
+ //Output Options header
193
+ soundcloud_options_header();
194
  ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
195
  <form method="post" action="options.php" id="soundcloudMMMainForm" name="soundcloudMMMainForm" class="">
196
  <p class="hidden soundcloudMMId" id="soundcloudMMId-<?php echo $soundcouldMMId ?>"><?php echo $soundcouldMMId ?></p>
197
  <?php settings_fields('soundcloud_is_gold_options'); ?>
198
  <ul id="soundcloudMMSettings">
199
  <!-- Username -->
200
+ <li class="soundcloudMMBox"><label class="optionLabel"><?php _e('User Name', 'soundcloud-is-gold') ?></label>
201
  <?php get_soundcloud_is_gold_username_interface($options, $soundcloudIsGoldUsers) ?>
202
  </li>
203
  <!-- Default Settings -->
204
  <li class="soundcloudMMBox">
205
+ <label class="optionLabel"><?php _e('Default Settings', 'soundcloud-is-gold') ?></label>
206
  <ul class="subSettings checkboxes">
207
+ <li><input type="checkbox" <?php echo (isset($soundcloudIsGoldSettings[0]) && $soundcloudIsGoldSettings[0]) ? 'checked="checked"' : ''?> name="soundcloud_is_gold_options[soundcloud_is_gold_settings][0]" value="true" class="soundcloudMMAutoPlay" id="soundcloudMMAutoPlay"/><label for="soundcloudMMAutoPlay"><?php _e('Play Automatically', 'soundcloud-is-gold') ?></label></li>
208
+ <li><input type="checkbox" <?php echo (isset($soundcloudIsGoldSettings[1]) && $soundcloudIsGoldSettings[1]) ? 'checked="checked"' : ''?> name="soundcloud_is_gold_options[soundcloud_is_gold_settings][1]" value="true" class="soundcloudMMShowComments" id="soundcloudMMShowComments"/><label for="soundcloudMMShowComments"><?php _e('Show comments', 'soundcloud-is-gold') ?></label></li>
209
+ <li><input type="checkbox" <?php echo (isset($soundcloudIsGoldSettings[2]) && $soundcloudIsGoldSettings[2]) ? 'checked="checked"' : ''?> name="soundcloud_is_gold_options[soundcloud_is_gold_settings][2]" value="true" class="soundcloudMMShowArtwork" id="soundcloudMMShowArtwork"/><label for="soundcloudMMShowArtwork"><?php _e('Show Artwork', 'soundcloud-is-gold') ?></label></li>
210
+ </ul>
211
+ <ul class="subSettings checkboxes">
212
+ <li><input type="checkbox" <?php echo (isset($soundcloudIsGoldSettings[3]) && $soundcloudIsGoldSettings[3]) ? 'checked="checked"' : ''?> name="soundcloud_is_gold_options[soundcloud_is_gold_settings][3]" value="true" class="soundcloudMMShowVisual" id="soundcloudMMShowVisual"/><label for="soundcloudMMShowVisual"><?php _e('Full Visual', 'soundcloud-is-gold') ?><small>(<?php _e('use soundcloud colors', 'soundcloud-is-gold') ?>)</small></label></li>
213
+ <li><input type="checkbox" <?php echo (isset($soundcloudIsGoldSettings[4]) && $soundcloudIsGoldSettings[4]) ? 'checked="checked"' : ''?> name="soundcloud_is_gold_options[soundcloud_is_gold_settings][4]" value="true" class="soundcloudMMSForceMini" id="soundcloudMMSForceMini"/><label for="soundcloudMMSForceMini"><?php _e('Force mini player', 'soundcloud-is-gold') ?><small>(<?php _e('Artwork and comments won\'t show', 'soundcloud-is-gold') ?>)</small></label></li>
214
+ </ul>
215
  </li>
216
  <!-- Sizes -->
217
+ <li class="soundcloudMMBox"><label class="optionLabel"><?php _e('Default Sizes', 'soundcloud-is-gold') ?></label>
218
  <ul id="soundcloudMMWidthSetting" class="subSettings texts">
219
  <li>
220
+ <input name="soundcloud_is_gold_options[soundcloud_is_gold_width_settings][type]" <?php echo ($soundcloudIsGoldWidthSettings['type'] == "wp") ? 'checked="checked"' : ''; ?> id="soundcloudMMWpWidth" value="wp" type="radio" class="soundcloudMMWpWidth soundcloudMMWidthType radio"/><label for="soundcloudMMWpWidth"><?php _e('Media Width', 'soundcloud-is-gold') ?></label>
221
  <select class="soundcloudMMInput soundcloudMMWidth" name="soundcloud_is_gold_options[soundcloud_is_gold_width_settings][wp]">
222
  <?php foreach(get_soundcloud_is_gold_wordpress_sizes() as $key => $soundcloudIsGoldMediaSize) : ?>
223
  <?php
229
  </select>
230
  </li>
231
  <li>
232
+ <input name="soundcloud_is_gold_options[soundcloud_is_gold_width_settings][type]" <?php echo ($soundcloudIsGoldWidthSettings['type'] == "custom") ? 'checked="checked"' : ''; ?> id="soundcloudMMCustomWidth" value="custom" type="radio" class="soundcloudMMCustomWidth soundcloudMMWidthType radio"/><label for="soundcloudMMCustomWidth"><?php _e('Custom Width', 'soundcloud-is-gold') ?></label>
233
  <input name="soundcloud_is_gold_options[soundcloud_is_gold_width_settings][custom]" id="soundcloudMMCustomSelectedWidth" class="soundcloudMMInput soundcloudMMWidth soundcloudMMCustomSelectedWidth" type="text" name="soundcloud_is_gold_options[soundcloudMMCustomSelectedWidth]" value="<?php echo $soundcloudIsGoldWidthSettings['custom'] ?>" />
234
  </li>
 
 
 
235
  </ul>
236
+ <ul class="subSettings texts">
237
+ <li>
238
+ <label><?php _e('Playlist Height', 'soundcloud-is-gold') ?><small>(<?php _e('leave empty for default, can\'t be less than 300px', 'soundcloud-is-gold') ?></small></label>
239
+ <input id="soundcloudMMPlaylistHeight" class="soundcloudMMInput soundcloudMMWidth soundcloudMMPlaylistHeight" type="text" name="soundcloud_is_gold_options[soundcloud_is_gold_height_settings][playlist]" value="<?php echo (isset($soundcloudIsGoldHeightSettings['playlist'])) ? $soundcloudIsGoldHeightSettings['playlist'] : ''?>" />
240
+ </li>
241
+ <li>
242
+ <input type="checkbox" <?php echo (isset($soundcloudIsGoldHeightSettings['square']) && $soundcloudIsGoldHeightSettings['square']) ? 'checked="checked"' : ''?> name="soundcloud_is_gold_options[soundcloud_is_gold_height_settings][square]" value="true" class="soundcloudMMSquareHeight" id="soundcloudMMSquareHeight"/><label for="soundcloudMMSquareHeight"><?php _e('Force Square Player', 'soundcloud-is-gold') ?><small>(<?php _e('Visual', 'soundcloud-is-gold') ?>)</small></label>
243
+ </li>
244
+ </ul>
245
  </li>
246
  <!-- Color and Classes -->
247
+ <li class="soundcloudMMBox"><label class="optionLabel"><?php _e('Extras', 'soundcloud-is-gold') ?></label>
248
  <ul class="subSettings texts">
249
  <li>
250
+ <label><?php _e('Color', 'soundcloud-is-gold') ?></label>
251
  <div class="soundcloudMMColorPickerContainer" id="soundcloudMMColorPickerContainer">
252
+ <input type="text" class="soundcloudMMInput soundcloudMMColor" id="soundcloudMMColor" name="soundcloud_is_gold_options[soundcloud_is_gold_color]" value="<?php echo $soundcloudIsGoldColor ?>" style="background-color:<?php echo $soundcloudIsGoldColor ?>"/><a href="#" class="soundcloudMMBt soundcloudMMBtSmall inline blue soundcloudMMRounder soundcloudMMResetColor"><?php _e('reset to default', 'soundcloud-is-gold') ?></a>
253
+ <div id="soundcloudMMColorPicker" class="shadow soundcloudMMColorPicker"><div id="soundcloudMMColorPickerSelect" class="soundcloudMMColorPickerSelect"></div><a id="soundcloudMMColorPickerClose" class="blue soundcloudMMBt soundcloudMMColorPickerClose"><?php _e('done', 'soundcloud-is-gold') ?></a></div>
254
  </div>
255
  </li>
256
  <li class="clear">
257
+ <label><?php _e('CSS Classes', 'soundcloud-is-gold') ?><small>(<?php _e('no commas', 'soundcloud-is-gold') ?>)</small></label><input class="soundcloudMMInput soundcloudMMClasses" type="text" name="soundcloud_is_gold_options[soundcloud_is_gold_classes]" value="<?php echo $soundcloudIsGoldClasses ?>" />
258
  </li>
259
  </ul>
260
  </li>
261
  <!-- Preview -->
262
+ <li class="soundcloudMMBox"><label class="optionLabel previewLabel"><?php _e('Live Preview', 'soundcloud-is-gold') ?><small>(<?php _e('your latest track', 'soundcloud-is-gold') ?>)</small></label>
263
  <?php if($soundcloudIsGoldApiResponse['response']) :?>
264
  <p class="soundcloudMMEmbed soundcloudMMEmbedOptions" style="text-align:center;">
265
  <!-- Soundcloud Preview here -->
267
  <p class="soundcloudMMLoading soundcloudMMPreviewLoading" style="display:none"></p>
268
  <?php else : ?>
269
  <!-- Error getting Json -->
270
+ <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.', 'soundcloud-is-gold')"?></p></div>
271
  <?php endif; ?>
272
  </li>
273
  </ul>
274
  <!-- Submit -->
275
  <p id="soundcloudMMSubmit"><input type="submit" name="Submit" value="<?php _e('Save Your SoundCloud Settings') ?>" class="soundcloudMMButton-primary button-primary"/></p>
276
  </form>
 
 
 
277
 
278
  <?php
279
+
280
+ //Output Options Footer
281
+ soundcloud_options_footer();
282
  }
283
 
284