SoundCloud Is Gold - Version 1.0.4

Version Description

  • Faster loading of the tab (only load player's preview when click on 'show')
  • Pagination as people with more than 50 tracks couldn't access the rest of their tracks (25 tracks per page)
  • Styled shortcode in tinymce editor with delete and edit buttons
Download this release

Release Info

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

Code changes from version 1.0.3.2 to 1.0.4

noThumbnail.gif ADDED
Binary file
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://www.mightymess.com/soundcloud-is-gold-wordpress-plugin
4
  Tags: soundcloud, integrated, media, shortcode, browse, design, easy, simple, music, sound, js, live preview
5
  Requires at least: 3.2
6
  Tested up to: 3.2.1
7
- Stable tag: 1.0.3.2
8
 
9
  Browse through your soundcloud tracks from a tab in the post's 'upload media'. Select, add a track to your post. Live preview, easy.
10
 
@@ -45,7 +45,7 @@ That's just my opinion of course...
45
 
46
  = To Do List =
47
 
48
- * V1.1: Advance Settings (change background color and comments color, playcounts, buy link, font, wmode, etc)
49
  * Add Widget
50
  * if no id is specified in the shortcode (e.g [soundcloud]), display the latest track.
51
  * Posibility to access and add 'favorites' to post (thanks Bernd for the idea).
@@ -69,7 +69,7 @@ Just follow the usual procedure. Log on to your wordpress, go to plugin -> add n
69
 
70
  = I can't see my tracks? =
71
 
72
- * Have you entered your real username? Your username is what you see in your soundcloud url when you click your name in soundcloud or view public profile (e.g http://soundcloud.com/anna-chocola).
73
  * Bare in mind is that all tracks that are set as private on soundcloud won't appear.
74
  * Have you got other soundcloud plugin installed? That generally happen as you've been 'shopping around', disable them or even delete them and this if it works.
75
 
@@ -126,8 +126,12 @@ When upgrading from 1.0.1 and earlier: All shortcode attributes are now lowercas
126
 
127
  == Changelog ==
128
 
129
- = 1.0.3.2 =
 
 
 
130
 
 
131
  * Emergency fix linked to soundcloud server been attacked (DDoS): Added user-agent header to request.
132
 
133
  = 1.0.3 and 1.0.3.1 =
4
  Tags: soundcloud, integrated, media, shortcode, browse, design, easy, simple, music, sound, js, live preview
5
  Requires at least: 3.2
6
  Tested up to: 3.2.1
7
+ Stable tag: 1.0.4
8
 
9
  Browse through your soundcloud tracks from a tab in the post's 'upload media'. Select, add a track to your post. Live preview, easy.
10
 
45
 
46
  = To Do List =
47
 
48
+ * V1.1: Advance Settings (change background color and comments color, playcounts, buy link, font, wmode, etc, show/hide styled shortcode, number of tracks per page)
49
  * Add Widget
50
  * if no id is specified in the shortcode (e.g [soundcloud]), display the latest track.
51
  * Posibility to access and add 'favorites' to post (thanks Bernd for the idea).
69
 
70
  = I can't see my tracks? =
71
 
72
+ * Have you entered your real username? Your username is what you see in your soundcloud url when you click your name in soundcloud or view public profile (e.g http://soundcloud.com/anna-chocola ).
73
  * Bare in mind is that all tracks that are set as private on soundcloud won't appear.
74
  * Have you got other soundcloud plugin installed? That generally happen as you've been 'shopping around', disable them or even delete them and this if it works.
75
 
126
 
127
  == Changelog ==
128
 
129
+ = 1.0.4 =
130
+ * Faster loading of the tab (only load player's preview when click on 'show')
131
+ * Pagination as people with more than 50 tracks couldn't access the rest of their tracks (25 tracks per page)
132
+ * Styled shortcode in tinymce editor with delete and edit buttons
133
 
134
+ = 1.0.3.2 =
135
  * Emergency fix linked to soundcloud server been attacked (DDoS): Added user-agent header to request.
136
 
137
  = 1.0.3 and 1.0.3.1 =
soundcloud-is-gold-css.css CHANGED
@@ -420,6 +420,12 @@ select.soundcloudMMInput option{
420
 
421
 
422
  /******************** TAB *****************/
 
 
 
 
 
 
423
  .soundcloudMMColorPicker .soundcloudMMColorPickerClose{
424
  display: block;
425
  padding: 6% 2%;
420
 
421
 
422
  /******************** TAB *****************/
423
+ #soundcloudMMPagination{
424
+ margin:1em;
425
+ }
426
+ #soundcloudMMPagination .pagination-links a{
427
+ margin-right:5px;
428
+ }
429
  .soundcloudMMColorPicker .soundcloudMMColorPickerClose{
430
  display: block;
431
  padding: 6% 2%;
soundcloud-is-gold-functions.php CHANGED
@@ -1,4 +1,125 @@
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  /*********************************************************************/
3
  /*** ***/
4
  /*** SOUNDCLOUD MEDIA UPLOAD TAB ***/
@@ -19,10 +140,7 @@ add_action('admin_print_styles-media-upload-popup', 'soundcloud_is_gold_option_s
19
  /* Soundcloud is Gold Tab (Iframe) content*/
20
  function media_soundcloud_is_gold_process() {
21
  media_upload_header();
22
- // $soundcloudXML = PLUGIN_DIR.'tracks.xml';
23
- $soundcloudIsGoldApiCall = 'http://api.soundcloud.com/users/'.get_option('soundcloud_is_gold_user').'/tracks.xml?client_id=9rD2GrGrajkmkw5eYFDp2g';
24
- get_soundcloud_is_gold_user_tracks($soundcloudIsGoldApiCall, $_REQUEST['post_id']);
25
- //testMedia(TRUE);
26
  }
27
  /* load Iframe in the tab page */
28
  function soundcloud_is_gold_media_menu_handle() {
@@ -34,14 +152,22 @@ add_action('media_upload_soundcloud_is_gold', 'soundcloud_is_gold_media_menu_han
34
  /*Add Soundcloud Button to Upload/Insert*/
35
  function plugin_media_button($context) {
36
  global $post_ID;
37
- $plugin_media_button = ' %s' . '<a id="add_soundcloud_is_gold" title="Insert Soundcloud Player" href="media-upload.php?post_id='.$post_ID.'&tab=soundcloud_is_gold&TB_iframe=1&width=640&height=584" class="thickbox"><img alt="Insert Soundcloud Player" src="'.PLUGIN_DIR.'soundcloud-is-gold-icon.png"></a>';
38
  return sprintf($context, $plugin_media_button);
39
  }
40
  add_filter('media_buttons_context', 'plugin_media_button');
41
 
42
  /** Populate the new Soundcloud is Gold Tab **/
43
- function get_soundcloud_is_gold_user_tracks($soundcloudIsGoldApiCall, $post_id){
44
 
 
 
 
 
 
 
 
 
45
  $soundcloudIsGoldUser = get_option('soundcloud_is_gold_user');
46
  $soundcloudIsGoldSettings = get_option('soundcloud_is_gold_settings');
47
  $soundcloudIsGoldPlayerType = get_option('soundcloud_is_gold_playerType');
@@ -51,6 +177,9 @@ function get_soundcloud_is_gold_user_tracks($soundcloudIsGoldApiCall, $post_id){
51
  $soundcloudIsGoldClasses = get_option('soundcloud_is_gold_classes');
52
  $soundcloudIsGoldColor = get_option('soundcloud_is_gold_color');
53
 
 
 
 
54
  //Sorting Menu
55
  echo '<form id="library-form" class="media-upload-form validate" action="" method="post" enctype="multipart/form-data"><div id="media-items" class="media-items-'.$post_id.'">';
56
  ?>
@@ -74,34 +203,9 @@ function get_soundcloud_is_gold_user_tracks($soundcloudIsGoldApiCall, $post_id){
74
  </script>
75
 
76
  <?php
77
- //Set Error default message && default XML state
78
- $soundcloudIsGoldRespError = false;
79
- $soundcloudIsGoldResp = false;
80
- //Check is cURL extension is loaded
81
- if(extension_loaded("curl")){
82
- // create a new cURL resource
83
- $soundcloudIsGoldCURL = curl_init();
84
- //Set cURL Options
85
- curl_setopt($soundcloudIsGoldCURL, CURLOPT_URL, $soundcloudIsGoldApiCall);
86
- curl_setopt($soundcloudIsGoldCURL, CURLOPT_RETURNTRANSFER, true);//return a string
87
- curl_setopt($soundcloudIsGoldCURL, CURLOPT_USERAGENT, "user_agent : FOOBAR");
88
- // Get XML as a string
89
- $soundcloudIsGoldXmlString = curl_exec($soundcloudIsGoldCURL);
90
- //Check for cURL errors
91
- if($soundcloudIsGoldXmlString === false) $soundcloudIsGoldRespError = 'Curl error: ' . curl_error($soundcloudIsGoldCURL);
92
- //No cURL Errors: Load the call and captured xml returned by the API
93
- else $soundcloudIsGoldResp = simplexml_load_string($soundcloudIsGoldXmlString);
94
- // close cURL resource, and free up system resources
95
- curl_close($soundcloudIsGoldCURL);
96
- }
97
- //No cURL: Try loading the XML directly with simple_xml_load_file
98
- else $soundcloudIsGoldResp = simplexml_load_file($soundcloudIsGoldApiCall);
99
-
100
- //printl($resp);
101
- //echo htmlentities($soundcloudIsGoldResp->asXML());
102
- // Check to see if the response was loaded, else print an error
103
- if ($soundcloudIsGoldResp) {
104
- foreach($soundcloudIsGoldResp as $soundcloudIsGoldtrack): ?>
105
 
106
  <div class="media-item preloaded" id="media-item-<?php echo $soundcloudIsGoldtrack->id ?>">
107
  <a href="#" class="toggle describe-toggle-on soundcloud" id="show-<?php echo $soundcloudIsGoldtrack->id ?>">Show</a>
@@ -111,7 +215,7 @@ function get_soundcloud_is_gold_user_tracks($soundcloudIsGoldApiCall, $post_id){
111
  <thead id="media-head-<?php echo $soundcloudIsGoldtrack->id ?>" class="media-item-info">
112
  <tr valign="top">
113
  <td id="thumbnail-head-<?php echo $soundcloudIsGoldtrack->id ?>" class="A1B1">
114
- <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'} ?>" class="thumbnail"></a></p>
115
  </td>
116
  <td>
117
  <p><strong>Title:</strong> <?php echo $soundcloudIsGoldtrack->title ?></p>
@@ -220,8 +324,8 @@ function get_soundcloud_is_gold_user_tracks($soundcloudIsGoldApiCall, $post_id){
220
  }
221
  //Error getting XML
222
  else{
223
- if($soundcloudIsGoldRespError === false) $soundcloudIsGoldRespError = 'XML error';
224
- echo '<div class="soundcloudMMXmlError"><p>Oups! There\'s been a error while getting the tracks from soundcloud. Please reload the page.</p><p class="error">'.$soundcloudIsGoldRespError.'</p></div>';
225
  }
226
  echo '<div id="colorpicker"></div>';
227
  echo '</div></form>';
1
  <?php
2
+ /*********************************************************************/
3
+ /*** ***/
4
+ /*** SOUNDCLOUD UTILITIES ***/
5
+ /*** ***/
6
+ /*********************************************************************/
7
+ function get_soundcloud_is_gold_player_types(){
8
+ $m = array('Mini', 'Standard', 'Artwork');
9
+ return $m;
10
+ }
11
+ function get_soundcloud_is_gold_wordpress_sizes(){
12
+ $px = "px";
13
+ $soundcloudIsGoldWordpressSizes = array(
14
+ "thumbnail" => array(
15
+ get_option( 'thumbnail_size_w' ).$px,
16
+ get_option( 'thumbnail_size_h' ).$px
17
+ ),
18
+ "medium" => array(
19
+ get_option( 'medium_size_w' ).$px,
20
+ get_option( 'medium_size_w' ).$px
21
+ ),
22
+ "large" => array(
23
+ get_option( 'large_size_w' ).$px,
24
+ get_option( 'large_size_w' ).$px
25
+ )
26
+ );
27
+ return $soundcloudIsGoldWordpressSizes;
28
+ }
29
+ function get_soundcloud_is_gold_default_width($settings){
30
+ return $settings[$settings['type']];
31
+ }
32
+ function get_soundcloud_is_gold_default_settings_for_js(){
33
+ echo 'soundcloudIsGoldUser_default = "'.get_option('soundcloud_is_gold_user').'"; ';
34
+ echo 'soundcloudIsGoldPlayerType_default = "'.get_option('soundcloud_is_gold_playerType').'"; ';
35
+ $soundcloudIsGoldSettings = get_option('soundcloud_is_gold_settings');
36
+ echo 'soundcloudIsGoldAutoPlay_default = '.((!isset($soundcloudIsGoldSettings[0]) || $soundcloudIsGoldSettings[0] == '') ? 'false' : 'true') .'; ';
37
+ echo 'soundcloudIsGoldComments_default = '.((!isset($soundcloudIsGoldSettings[1]) || $soundcloudIsGoldSettings[1] == '') ? 'false' : 'true') .'; ';
38
+ echo 'soundcloudIsGoldWidth_default = "'.get_soundcloud_is_gold_default_width(get_option('soundcloud_is_gold_width_settings')).'"; ';
39
+ echo 'soundcloudIsGoldClasses_default = "'.get_option('soundcloud_is_gold_classes').'"; ';
40
+ echo 'soundcloudIsGoldColor_default = "'.get_option('soundcloud_is_gold_color').'"; ';
41
+ }
42
+ function get_soundcloudIsGoldUserTrackNumber(){
43
+ $soundcloudIsGoldApiCall = 'http://api.soundcloud.com/users/'.get_option('soundcloud_is_gold_user').'.xml?client_id=9rD2GrGrajkmkw5eYFDp2g';
44
+ $soundcloudIsGoldApiResponse = get_soundcloud_is_gold_api_response($soundcloudIsGoldApiCall);
45
+ return $soundcloudIsGoldApiResponse['response']->{'track-count'};
46
+ }
47
+ function get_soundcloud_is_gold_api_response($soundcloudIsGoldApiCall){
48
+ //Set Error default message && default XML state
49
+ $soundcloudIsGoldRespError = false;
50
+ $soundcloudIsGoldResp = false;
51
+ //Check is cURL extension is loaded
52
+ if(extension_loaded("curl")){
53
+ // create a new cURL resource
54
+ $soundcloudIsGoldCURL = curl_init();
55
+ //Set cURL Options
56
+ curl_setopt($soundcloudIsGoldCURL, CURLOPT_URL, $soundcloudIsGoldApiCall);
57
+ curl_setopt($soundcloudIsGoldCURL, CURLOPT_RETURNTRANSFER, true);//return a string
58
+ curl_setopt($soundcloudIsGoldCURL, CURLOPT_USERAGENT, "user_agent : FOOBAR");
59
+ // Get XML as a string
60
+ $soundcloudIsGoldXmlString = curl_exec($soundcloudIsGoldCURL);
61
+ //Check for cURL errors
62
+ if($soundcloudIsGoldXmlString === false) $soundcloudIsGoldRespError = 'Curl error: ' . curl_error($soundcloudIsGoldCURL);
63
+ //No cURL Errors: Load the call and captured xml returned by the API
64
+ else $soundcloudIsGoldResp = simplexml_load_string($soundcloudIsGoldXmlString);
65
+ // close cURL resource, and free up system resources
66
+ curl_close($soundcloudIsGoldCURL);
67
+ }
68
+ //No cURL: Try loading the XML directly with simple_xml_load_file
69
+ else $soundcloudIsGoldResp = simplexml_load_file($soundcloudIsGoldApiCall);
70
+
71
+ //Add response and error to array
72
+ $soundCloudIsGoldResponseArray = array('response' => $soundcloudIsGoldResp, 'error' => $soundcloudIsGoldRespError);
73
+ return $soundCloudIsGoldResponseArray;
74
+ }
75
+ /*Pagination
76
+ soundcloud_is_gold_pagination($totalItems, $currentPage, $perPage)
77
+ */
78
+ function soundcloud_is_gold_pagination($totalItems, $currentPage, $perPage, $post_ID){
79
+
80
+ // The items on the current page.
81
+ $offset = ($currentPage - 1) * $perPage;
82
+ $firstItem = $offset + 1;
83
+ $lastItem = $offset + $perPage < $totalItems ? $offset + $perPage : $totalItems;
84
+
85
+ // Some useful variables for making links.
86
+ $firstPage = 1;
87
+ $lastPage = ceil($totalItems / $perPage);
88
+ $prevPage = $currentPage - 1 > 0 ? $currentPage - 1 : 1;
89
+ $nextPage = $currentPage + 1 > $lastPage ? $lastPage : $currentPage + 1;
90
+
91
+ $disableFirst = ($currentPage == $firstPage) ? ' disabled' : '';
92
+ $disableLast = ($currentPage == $lastPage) ? ' disabled' : '';
93
+
94
+ $output = '<div id="soundcloudMMPagination">';
95
+ $output .= '<div class="tablenav">';
96
+ $output .= '<div class="tablenav-pages"><span class="displaying-num">'.$totalItems.' tracks</span>';
97
+ $output .= '<span class="pagination-links"><a href="?post_id='.$post_ID.'&tab=soundcloud_is_gold&paged='.$firstPage.'&TB_iframe=1&width=640&height=584" title="Go to the first page" class="first-page'.$disableFirst.'">&laquo;</a>';
98
+ $output .= '<a href="?post_id='.$post_ID.'&tab=soundcloud_is_gold&paged='.$prevPage.'&TB_iframe=1&width=640&height=584" title="Go to the previous page" class="prev-page'.$disableFirst.'">&lsaquo;</a>';
99
+ $output .= '<span class="paging-input">page '.$currentPage.' of <span class="total-pages">'.$lastPage.'</span></span>';
100
+ $output .= '<a href="?post_id='.$post_ID.'&tab=soundcloud_is_gold&paged='.$nextPage.'&TB_iframe=1&width=640&height=584" title="Go to the next page" class="next-page'.$disableLast.'">&rsaquo;</a>';
101
+ $output .= '<a href="?post_id='.$post_ID.'&tab=soundcloud_is_gold&paged='.$lastPage.'&TB_iframe=1&width=640&height=584" title="Go to the last page" class="last-page'.$disableLast.'">&raquo;</a></span></div>';
102
+ $output .= '</div>';
103
+ $output .= '</div>';
104
+
105
+ return $output;
106
+ }
107
+ /*Add Soundcloud is Gold Plugin to TinyMce*/
108
+ function soundcloud_is_gold_mce_plugin($plugin_array) {
109
+ $plugin_array['soundcloudIsGold'] = PLUGIN_DIR.'tinymce-plugin/soundcloud-is-gold-editor_plugin.js';
110
+ return $plugin_array;
111
+ }
112
+ function soundcloud_is_gold_mce_button( $buttons ) {
113
+ // add a separation before our button, here our button's id is "mygallery_button"
114
+ array_push( $buttons, '|', 'soundcloudisgoldbtns' );
115
+ return $buttons;
116
+ }
117
+ function soundcloud_is_gold_mce_css($mce_css) {
118
+ if (! empty($mce_css)) $mce_css .= ',';
119
+ $mce_css .= PLUGIN_DIR.'/tinymce-plugin/soundcloud-is-gold-editor_plugin.css';
120
+ return $mce_css;
121
+ }
122
+
123
  /*********************************************************************/
124
  /*** ***/
125
  /*** SOUNDCLOUD MEDIA UPLOAD TAB ***/
140
  /* Soundcloud is Gold Tab (Iframe) content*/
141
  function media_soundcloud_is_gold_process() {
142
  media_upload_header();
143
+ get_soundcloud_is_gold_user_tracks();
 
 
 
144
  }
145
  /* load Iframe in the tab page */
146
  function soundcloud_is_gold_media_menu_handle() {
152
  /*Add Soundcloud Button to Upload/Insert*/
153
  function plugin_media_button($context) {
154
  global $post_ID;
155
+ $plugin_media_button = ' %s' . '<a id="add_soundcloud_is_gold" title="Insert Soundcloud Player" href="media-upload.php?post_id='.$post_ID.'&tab=soundcloud_is_gold&paged=1&TB_iframe=1&width=640&height=584" class="thickbox"><img alt="Insert Soundcloud Player" src="'.PLUGIN_DIR.'soundcloud-is-gold-icon.png"></a>';
156
  return sprintf($context, $plugin_media_button);
157
  }
158
  add_filter('media_buttons_context', 'plugin_media_button');
159
 
160
  /** Populate the new Soundcloud is Gold Tab **/
161
+ function get_soundcloud_is_gold_user_tracks(){
162
 
163
+ $soundcloudIsGoldPage = isset($_REQUEST['paged']) ? $_REQUEST['paged'] : '1';
164
+ $post_id = $_REQUEST['post_id'];
165
+ $soundcloudIsGoldTracksPerPage = 25;
166
+ $soundcloudIsGoldApiOffset = $soundcloudIsGoldTracksPerPage*($soundcloudIsGoldPage-1);
167
+ $soundcloudIsGoldPagination = soundcloud_is_gold_pagination(get_soundcloudIsGoldUserTrackNumber(), $soundcloudIsGoldPage, $soundcloudIsGoldTracksPerPage, $post_id);
168
+
169
+ $soundcloudIsGoldApiCall = 'http://api.soundcloud.com/users/'.get_option('soundcloud_is_gold_user').'/tracks.xml?limit='.$soundcloudIsGoldTracksPerPage.'&offset='.$soundcloudIsGoldApiOffset.'&client_id=9rD2GrGrajkmkw5eYFDp2g';
170
+
171
  $soundcloudIsGoldUser = get_option('soundcloud_is_gold_user');
172
  $soundcloudIsGoldSettings = get_option('soundcloud_is_gold_settings');
173
  $soundcloudIsGoldPlayerType = get_option('soundcloud_is_gold_playerType');
177
  $soundcloudIsGoldClasses = get_option('soundcloud_is_gold_classes');
178
  $soundcloudIsGoldColor = get_option('soundcloud_is_gold_color');
179
 
180
+ //Pagination
181
+ echo (isset($soundcloudIsGoldPagination)) ? $soundcloudIsGoldPagination : '';
182
+
183
  //Sorting Menu
184
  echo '<form id="library-form" class="media-upload-form validate" action="" method="post" enctype="multipart/form-data"><div id="media-items" class="media-items-'.$post_id.'">';
185
  ?>
203
  </script>
204
 
205
  <?php
206
+ $soundcloudIsGoldApiResponse = get_soundcloud_is_gold_api_response($soundcloudIsGoldApiCall);
207
+ if (isset($soundcloudIsGoldApiResponse['response']) && $soundcloudIsGoldApiResponse['response']) {
208
+ foreach($soundcloudIsGoldApiResponse['response'] as $soundcloudIsGoldtrack): ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
209
 
210
  <div class="media-item preloaded" id="media-item-<?php echo $soundcloudIsGoldtrack->id ?>">
211
  <a href="#" class="toggle describe-toggle-on soundcloud" id="show-<?php echo $soundcloudIsGoldtrack->id ?>">Show</a>
215
  <thead id="media-head-<?php echo $soundcloudIsGoldtrack->id ?>" class="media-item-info">
216
  <tr valign="top">
217
  <td id="thumbnail-head-<?php echo $soundcloudIsGoldtrack->id ?>" class="A1B1">
218
+ <p><a href="<?php echo $soundcloudIsGoldtrack->{'permalink-url'}?>" title="Go to the Soundcloud page" target="_blank"><img id="soundcloudMMThumb-<?php echo $soundcloudIsGoldtrack->id ?>" style="margin-top: 3px;" alt="" src="<?php echo ($soundcloudIsGoldtrack->{'artwork-url'} != '') ? $soundcloudIsGoldtrack->{'artwork-url'} : PLUGIN_DIR."/noThumbnail.gif" ?>" class="thumbnail"></a></p>
219
  </td>
220
  <td>
221
  <p><strong>Title:</strong> <?php echo $soundcloudIsGoldtrack->title ?></p>
324
  }
325
  //Error getting XML
326
  else{
327
+ if($soundcloudIsGoldApiResponse['error'] === false) $soundcloudIsGoldApiResponse['error'] = 'XML error';
328
+ echo '<div class="soundcloudMMXmlError"><p>Oups! There\'s been a error while getting the tracks from soundcloud. Please reload the page.</p><p class="error">'.$soundcloudIsGoldApiResponse['error'].'</p></div>';
329
  }
330
  echo '<div id="colorpicker"></div>';
331
  echo '</div></form>';
soundcloud-is-gold-js.js CHANGED
@@ -18,11 +18,9 @@ jQuery(document).ready(function($){
18
  /******************************************/
19
  /** SOUNDCLOUD **/
20
  /******************************************/
21
- //Update Video Preview and Shortcode
22
  $('.soundcloudMMWrapper').each(function(){
23
  var mySelf = $(this);
24
- //First Time
25
- updateMe(mySelf, true);
26
  //On changing settings
27
  $('input[type=checkbox], input[type=radio], .soundcloudMMWPSelectedWidth, .soundcloudMMColorPickerClose', this).click(function(){
28
  updateMe(mySelf, true);
@@ -30,9 +28,18 @@ jQuery(document).ready(function($){
30
  $('.soundcloudMMCustomSelectedWidth, .soundcloudMMClasses', this).focusout(function(){
31
  updateMe(mySelf, true);
32
  });
 
33
  initColorPicker(mySelf);
 
 
 
 
 
 
34
  });
35
 
 
 
36
 
37
  function updateMe(parent, refresh){
38
  //Collect Settings
@@ -68,9 +75,10 @@ jQuery(document).ready(function($){
68
  //Insert Content at the end of the editor content
69
  //parent.tinyMCE.activeEditor.setContent(parent.tinyMCE.activeEditor.getContent() + sh);
70
 
71
- //Insert Content where the cursor is in the editor
72
- parent.tinyMCE.activeEditor.execCommand('mceInsertContent', false, sh);
73
-
 
74
  //Close window
75
  parent.jQuery("#TB_closeWindowButton").click();
76
  }
18
  /******************************************/
19
  /** SOUNDCLOUD **/
20
  /******************************************/
21
+ //Attach Events for Player Preview and Shortcode
22
  $('.soundcloudMMWrapper').each(function(){
23
  var mySelf = $(this);
 
 
24
  //On changing settings
25
  $('input[type=checkbox], input[type=radio], .soundcloudMMWPSelectedWidth, .soundcloudMMColorPickerClose', this).click(function(){
26
  updateMe(mySelf, true);
28
  $('.soundcloudMMCustomSelectedWidth, .soundcloudMMClasses', this).focusout(function(){
29
  updateMe(mySelf, true);
30
  });
31
+ //Initialize color Picker
32
  initColorPicker(mySelf);
33
+ //(Tab View) Event: Load First Time preview when show clicked
34
+ if(!mySelf.hasClass('soundcloudMMOptions')){
35
+ $(".describe-toggle-on", mySelf.parent()).click(function(){
36
+ updateMe(mySelf, true);
37
+ });
38
+ }
39
  });
40
 
41
+ //First Time On Option Page
42
+ if($(".soundcloudMMOptions").length) updateMe($(this), true);
43
 
44
  function updateMe(parent, refresh){
45
  //Collect Settings
75
  //Insert Content at the end of the editor content
76
  //parent.tinyMCE.activeEditor.setContent(parent.tinyMCE.activeEditor.getContent() + sh);
77
 
78
+ //Insert Content where the cursor is in the editor (plus refresh)
79
+ parent.tinyMCE.activeEditor.execCommand('mceInsertRawHTML', false, sh);
80
+ //Insert Content where the cursor is in the editor (no refresh)
81
+ //parent.tinyMCE.activeEditor.execCommand('mceInsertContent', false, sh);
82
  //Close window
83
  parent.jQuery("#TB_closeWindowButton").click();
84
  }
soundcloud-is-gold.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Soundcloud is Gold
4
  Plugin URI: http://www.mightymess.com/soundcloud-is-gold-wordpress-plugin
5
  Description: <strong><a href="http://www.mightymess.com/soundcloud-is-gold-wordpress-plugin">Soundcloud is gold</a></strong> integrates perfectly into wordpress. Browse through your soundcloud tracks from the 'soundcloud is gold' tab with the post's 'upload media' popup window. Select, set and add track to your post using the soundcloud player. Live Preview, easy, smart and straightforward. You can set default settings in the option page, choose your defaut soundcloud player (Mini, Standard, Artwork), its width, extra classes for you CSS lovers and your favorite colors. You'll still be able to set players to different settings before adding to your post if you fancy a one off change.
6
- Version: 1.0.3.2
7
  Author: Thomas Michalak at Mighty Mess
8
  Author URI: http://www.mightymess.com/thomas-michalak
9
  License: GPL2 or Later
@@ -26,6 +26,7 @@ function soundcloud_is_gold_admin_init() {
26
  wp_register_style('soundcloud-is-gold-css', PLUGIN_DIR.'soundcloud-is-gold-css.css');
27
  wp_register_style('ChunkFive', PLUGIN_DIR.'ChunkFive-fontfacekit/stylesheet.css');
28
  wp_register_style('Quicksand', PLUGIN_DIR.'Quicksand-fontfacekit/stylesheet.css');
 
29
  }
30
  //Plugin option scripts
31
  function soundcloud_is_gold_option_scripts() {
@@ -50,7 +51,6 @@ function soundcloud_is_gold_menu() {
50
  add_action( "admin_print_styles-$soundcloudIsGoldPage", 'soundcloud_is_gold_option_styles' ); // Add Style
51
  add_action( "admin_print_styles-$soundcloudIsGoldPage", 'soundcloud_is_gold_option_fonts' ); // Add Fonts
52
  }
53
-
54
  /*** Link to Settings from the plugin Page ***/
55
  function soundcloud_is_gold_settings_link($links) {
56
  $settings_link = '<a href="admin.php?page=soundcloud-is-gold.php">Settings</a>';
@@ -60,46 +60,16 @@ function soundcloud_is_gold_settings_link($links) {
60
  $plugin = plugin_basename(__FILE__);
61
  add_filter("plugin_action_links_$plugin", 'soundcloud_is_gold_settings_link', 10, 2 );
62
 
63
- /*** Options and Utilities***/
64
- function get_soundcloud_is_gold_player_types(){
65
- $m = array('Mini', 'Standard', 'Artwork');
66
- return $m;
67
- }
68
 
69
- function get_soundcloud_is_gold_wordpress_sizes(){
70
- $px = "px";
71
- $soundcloudIsGoldWordpressSizes = array(
72
- "thumbnail" => array(
73
- get_option( 'thumbnail_size_w' ).$px,
74
- get_option( 'thumbnail_size_h' ).$px
75
- ),
76
- "medium" => array(
77
- get_option( 'medium_size_w' ).$px,
78
- get_option( 'medium_size_w' ).$px
79
- ),
80
- "large" => array(
81
- get_option( 'large_size_w' ).$px,
82
- get_option( 'large_size_w' ).$px
83
- )
84
- );
85
- return $soundcloudIsGoldWordpressSizes;
86
- }
87
 
88
- function get_soundcloud_is_gold_default_width($settings){
89
- return $settings[$settings['type']];
90
- }
91
- function get_soundcloud_is_gold_default_settings_for_js(){
92
- echo 'soundcloudIsGoldUser_default = "'.get_option('soundcloud_is_gold_user').'"; ';
93
- echo 'soundcloudIsGoldPlayerType_default = "'.get_option('soundcloud_is_gold_playerType').'"; ';
94
- $soundcloudIsGoldSettings = get_option('soundcloud_is_gold_settings');
95
- echo 'soundcloudIsGoldAutoPlay_default = '.((!isset($soundcloudIsGoldSettings[0]) || $soundcloudIsGoldSettings[0] == '') ? 'false' : 'true') .'; ';
96
- echo 'soundcloudIsGoldComments_default = '.((!isset($soundcloudIsGoldSettings[1]) || $soundcloudIsGoldSettings[1] == '') ? 'false' : 'true') .'; ';
97
- echo 'soundcloudIsGoldWidth_default = "'.get_soundcloud_is_gold_default_width(get_option('soundcloud_is_gold_width_settings')).'"; ';
98
- echo 'soundcloudIsGoldClasses_default = "'.get_option('soundcloud_is_gold_classes').'"; ';
99
- echo 'soundcloudIsGoldColor_default = "'.get_option('soundcloud_is_gold_color').'"; ';
100
- }
101
 
102
- add_option('soundcloud_is_gold_user', 't-m');
103
  $soundcloudIsGoldDefaultSettings = array(
104
  false,
105
  true
@@ -129,38 +99,14 @@ function soundcloud_is_gold_options(){
129
  $soundcloudIsGoldColor = get_option('soundcloud_is_gold_color');
130
  $soundcloudIsGoldApiCall = 'http://api.soundcloud.com/users/'.$soundcloudIsGoldUser.'/tracks.xml?limit=1&client_id=9rD2GrGrajkmkw5eYFDp2g';
131
 
132
- //Set Error default message && default XML state
133
-
134
- $soundcloudIsGoldRespError = false;
135
- $soundcloudIsGoldResp = false;
136
- //Check is cURL extension is loaded
137
- if(extension_loaded("curl")){
138
- // create a new cURL resource
139
- $soundcloudIsGoldCURL = curl_init();
140
- //Set cURL Options
141
- curl_setopt($soundcloudIsGoldCURL, CURLOPT_URL, $soundcloudIsGoldApiCall);
142
- curl_setopt($soundcloudIsGoldCURL, CURLOPT_RETURNTRANSFER, true);//return a string
143
- curl_setopt($soundcloudIsGoldCURL, CURLOPT_USERAGENT, "user_agent : FOOBAR");
144
- // Get XML as a string
145
- $soundcloudIsGoldXmlString = curl_exec($soundcloudIsGoldCURL);
146
- //Check for cURL errors
147
- if($soundcloudIsGoldXmlString === false) $soundcloudIsGoldRespError = 'Curl error: ' . curl_error($soundcloudIsGoldCURL);
148
- //No cURL Errors: Load the call and captured xml returned by the API
149
- else $soundcloudIsGoldResp = simplexml_load_string($soundcloudIsGoldXmlString);
150
- // close cURL resource, and free up system resources
151
- curl_close($soundcloudIsGoldCURL);
152
- }
153
- //No cURL: Try loading the XML directly with simple_xml_load_file
154
- else $soundcloudIsGoldResp = simplexml_load_file($soundcloudIsGoldApiCall);
155
-
156
- //$soundcouldMMapiCall = PLUGIN_DIR.'tracks.xml';
157
- //$soundcloudIsGoldResp = simplexml_load_file($soundcloudIsGoldApiCall);
158
- if($soundcloudIsGoldResp){
159
- foreach($soundcloudIsGoldResp as $soundcloudMMLatestTrack){
160
  $soundcouldMMId = (string)$soundcloudMMLatestTrack->id;
161
  $soundcouldMMShortcode = '[soundcloud id='.$soundcouldMMId.']';
162
  }
163
  }
 
164
  ?>
165
 
166
  <script type="text/javascript">
@@ -233,14 +179,14 @@ function soundcloud_is_gold_options(){
233
  </ul>
234
  </li>
235
  <li class="soundcloudMMBox"><label>Live Preview <small>(your latest track)</small></label>
236
- <?php if($soundcloudIsGoldResp) :?>
237
  <p class="soundcloudMMEmbed soundcloudMMEmbedOptions" style="text-align:center;">
238
  <!-- Soundcloud Preview here -->
239
  </p>
240
  <p class="soundcloudMMLoading" style="display:none"></p>
241
  <?php else : ?>
242
  <!-- Error getting XML -->
243
- <div class="soundcloudMMXmlError"><p>Oups! There's been a error while getting the tracks from soundcloud. Please reload the page.</p></div>
244
  <?php endif; ?>
245
  </li>
246
  </ul>
3
  Plugin Name: Soundcloud is Gold
4
  Plugin URI: http://www.mightymess.com/soundcloud-is-gold-wordpress-plugin
5
  Description: <strong><a href="http://www.mightymess.com/soundcloud-is-gold-wordpress-plugin">Soundcloud is gold</a></strong> integrates perfectly into wordpress. Browse through your soundcloud tracks from the 'soundcloud is gold' tab with the post's 'upload media' popup window. Select, set and add track to your post using the soundcloud player. Live Preview, easy, smart and straightforward. You can set default settings in the option page, choose your defaut soundcloud player (Mini, Standard, Artwork), its width, extra classes for you CSS lovers and your favorite colors. You'll still be able to set players to different settings before adding to your post if you fancy a one off change.
6
+ Version: 1.0.4
7
  Author: Thomas Michalak at Mighty Mess
8
  Author URI: http://www.mightymess.com/thomas-michalak
9
  License: GPL2 or Later
26
  wp_register_style('soundcloud-is-gold-css', PLUGIN_DIR.'soundcloud-is-gold-css.css');
27
  wp_register_style('ChunkFive', PLUGIN_DIR.'ChunkFive-fontfacekit/stylesheet.css');
28
  wp_register_style('Quicksand', PLUGIN_DIR.'Quicksand-fontfacekit/stylesheet.css');
29
+ wp_register_style('soundcloud-is-gold-editor-css', PLUGIN_DIR.'tinymce-plugin/soundcloud-is-gold-editor_plugin.css');
30
  }
31
  //Plugin option scripts
32
  function soundcloud_is_gold_option_scripts() {
51
  add_action( "admin_print_styles-$soundcloudIsGoldPage", 'soundcloud_is_gold_option_styles' ); // Add Style
52
  add_action( "admin_print_styles-$soundcloudIsGoldPage", 'soundcloud_is_gold_option_fonts' ); // Add Fonts
53
  }
 
54
  /*** Link to Settings from the plugin Page ***/
55
  function soundcloud_is_gold_settings_link($links) {
56
  $settings_link = '<a href="admin.php?page=soundcloud-is-gold.php">Settings</a>';
60
  $plugin = plugin_basename(__FILE__);
61
  add_filter("plugin_action_links_$plugin", 'soundcloud_is_gold_settings_link', 10, 2 );
62
 
63
+ /*** Add tint Mce Soundcloud is Gold Plugin ***/
64
+ add_filter("mce_external_plugins", 'soundcloud_is_gold_mce_plugin');
65
+ //add_filter( 'mce_buttons', 'soundcloud_is_gold_mce_button' );
66
+ add_filter('mce_css', 'soundcloud_is_gold_mce_css');
 
67
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
 
69
+ /*** Options and Utilities***/
70
+ $soundcloudIsGoldDefaultUsers = array('t-m', 'anna-chocola');
71
+ add_option('soundcloud_is_gold_user', $soundcloudIsGoldDefaultUsers[array_rand($soundcloudIsGoldDefaultUsers, 1)]);
 
 
 
 
 
 
 
 
 
 
72
 
 
73
  $soundcloudIsGoldDefaultSettings = array(
74
  false,
75
  true
99
  $soundcloudIsGoldColor = get_option('soundcloud_is_gold_color');
100
  $soundcloudIsGoldApiCall = 'http://api.soundcloud.com/users/'.$soundcloudIsGoldUser.'/tracks.xml?limit=1&client_id=9rD2GrGrajkmkw5eYFDp2g';
101
 
102
+ $soundcloudIsGoldApiResponse = get_soundcloud_is_gold_api_response($soundcloudIsGoldApiCall);
103
+ if(isset($soundcloudIsGoldApiResponse['response']) && $soundcloudIsGoldApiResponse['response']){
104
+ foreach($soundcloudIsGoldApiResponse['response'] as $soundcloudMMLatestTrack){
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
105
  $soundcouldMMId = (string)$soundcloudMMLatestTrack->id;
106
  $soundcouldMMShortcode = '[soundcloud id='.$soundcouldMMId.']';
107
  }
108
  }
109
+
110
  ?>
111
 
112
  <script type="text/javascript">
179
  </ul>
180
  </li>
181
  <li class="soundcloudMMBox"><label>Live Preview <small>(your latest track)</small></label>
182
+ <?php if($soundcloudIsGoldApiResponse['response']) :?>
183
  <p class="soundcloudMMEmbed soundcloudMMEmbedOptions" style="text-align:center;">
184
  <!-- Soundcloud Preview here -->
185
  </p>
186
  <p class="soundcloudMMLoading" style="display:none"></p>
187
  <?php else : ?>
188
  <!-- Error getting XML -->
189
+ <div class="soundcloudMMXmlError"><p><?php echo $soundcloudIsGoldApiResponse['error'] ? $soundcloudIsGoldApiResponse['error'] : "Oups! There's been a error while getting the tracks from soundcloud. Please reload the page."?></p></div>
190
  <?php endif; ?>
191
  </li>
192
  </ul>
tinymce-plugin/img/delete.png ADDED
Binary file
tinymce-plugin/img/edit.png ADDED
Binary file
tinymce-plugin/img/t.gif ADDED
Binary file
tinymce-plugin/soundcloud-is-gold-editor_plugin.css ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ img.soundcloudIsGold{
2
+ background: url("../soundcloud-logo-sc.png") no-repeat scroll center center #DAE8F6;
3
+ border: 1px solid #7B9DA2;
4
+ height: 100px;
5
+ width: 99%;
6
+ box-shadow:0 0 5px #666;
7
+ -moz-box-shadow:0 0 5px #666;
8
+ -webkit-box-shadow: 0 0 5px #666;
9
+ }
tinymce-plugin/soundcloud-is-gold-editor_plugin.js ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ (function() {
3
+ tinymce.create('tinymce.plugins.soundcloudIsGold', {
4
+
5
+ init : function(ed, url) {
6
+ var t = this;
7
+
8
+ t.url = url;
9
+ t._createButtons();
10
+
11
+ // Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('...');
12
+ ed.addCommand('soundcloud_Is_Gold', function() {
13
+ var el = ed.selection.getNode(), post_id, vp = tinymce.DOM.getViewPort(),
14
+ H = vp.h - 80, W = ( 640 < vp.w ) ? 640 : vp.w;
15
+
16
+ if ( el.nodeName != 'IMG' ) return;
17
+ if ( ed.dom.getAttrib(el, 'class').indexOf('soundcloudIsGold') == -1 ) return;
18
+
19
+ post_id = tinymce.DOM.get('post_ID').value;
20
+ tb_show('', tinymce.documentBaseURL + '/media-upload.php?post_id='+post_id+'&tab=soundcloud_is_gold&TB_iframe=true&width='+W+'&height='+H);
21
+
22
+ tinymce.DOM.setStyle( ['TB_overlay','TB_window','TB_load'], 'z-index', '999999' );
23
+ });
24
+
25
+
26
+ ed.onMouseDown.add(function(ed, e) {
27
+ if ( e.target.nodeName == 'IMG' && ed.dom.hasClass(e.target, 'soundcloudIsGold') )
28
+ t._showButtons(t, e.target, 'soundcloudisgoldbtns');
29
+ });
30
+
31
+ //Replace Shortcode with Styled img or whatever
32
+ ed.onBeforeSetContent.add(function(ed, o) {
33
+ o.content = t._do_soundcloudIsGold(o.content);
34
+ });
35
+ //Put Back the shortcode when saving
36
+ ed.onPostProcess.add(function(ed, o) {
37
+ if (o.get)
38
+ o.content = t._get_soundcloudIsGold(o.content);
39
+ });
40
+ },
41
+
42
+ _showButtons : function(that, n, id) {
43
+ var ed = tinyMCE.activeEditor, p1, p2, vp, DOM = tinymce.DOM, X, Y;
44
+
45
+ vp = ed.dom.getViewPort(ed.getWin());
46
+ p1 = DOM.getPos(ed.getContentAreaContainer());
47
+ p2 = ed.dom.getPos(n);
48
+
49
+ X = Math.max(p2.x - vp.x, 0) + p1.x;
50
+ Y = Math.max(p2.y - vp.y, 0) + p1.y;
51
+
52
+ DOM.setStyles(id, {
53
+ 'top' : Y+5+'px',
54
+ 'left' : X+5+'px',
55
+ 'display' : 'block',
56
+ 'position' : 'absolute'
57
+ });
58
+
59
+ if ( this.mceTout )
60
+ clearTimeout(this.mceTout);
61
+
62
+ this.mceTout = setTimeout( function(){that._hideButtons();}, 5000 );
63
+ },
64
+
65
+ _hideButtons : function() {
66
+ if ( !this.mceTout )
67
+ return;
68
+
69
+ if ( document.getElementById('soundcloudisgold_edit_shortcode') )
70
+ tinymce.DOM.hide('soundcloudisgold_edit_shortcode');
71
+
72
+ if ( document.getElementById('soundcloudisgoldbtns') )
73
+ tinymce.DOM.hide('soundcloudisgoldbtns');
74
+
75
+ clearTimeout(this.mceTout);
76
+ this.mceTout = 0;
77
+ },
78
+
79
+ //Replace Shortcode with Styled img or whatever
80
+ _do_soundcloudIsGold : function(co) {
81
+ return co.replace(/\[soundcloud([^\]]*)\]/g, function(a,b){
82
+ return '<img src="../wp-content/plugins/soundcloud-is-gold/tinymce-plugin/img/t.gif" class="soundcloudIsGold mceItem" title="soundcloud'+tinymce.DOM.encode(b)+'" />';
83
+ });
84
+ },
85
+
86
+ //Put Back the shortcode when saving
87
+ _get_soundcloudIsGold : function(co) {
88
+
89
+ function getAttr(s, n) {
90
+ n = new RegExp(n + '=\"([^\"]+)\"', 'g').exec(s);
91
+ return n ? tinymce.DOM.decode(n[1]) : '';
92
+ };
93
+
94
+ return co.replace(/(?:<p[^>]*>)*(<img[^>]+>)(?:<\/p>)*/g, function(a,im) {
95
+ var cls = getAttr(im, 'class');
96
+
97
+ if ( cls.indexOf('soundcloud') != -1 )
98
+ return '<p>['+tinymce.trim(getAttr(im, 'title'))+']</p>';
99
+
100
+ return a;
101
+ });
102
+ },
103
+
104
+
105
+ _createButtons : function() {
106
+ var t = this, ed = tinyMCE.activeEditor, DOM = tinymce.DOM, soundcloudIGold_editButton, soundcloudIGold_dellButton;
107
+
108
+ DOM.remove('soundcloudisgoldbtns');
109
+
110
+ DOM.add(document.body, 'div', {
111
+ id : 'soundcloudisgoldbtns',
112
+ style : 'display:none;'
113
+ });
114
+
115
+ //Create Edit Button: Keep wp_editgallery as id to herite style for gallery edit button
116
+ soundcloudIGold_editButton = DOM.add('soundcloudisgoldbtns', 'img', {
117
+ src : '../wp-content/plugins/soundcloud-is-gold/tinymce-plugin/img/edit.png',
118
+ id : 'wp_editgallery',
119
+ width : '24',
120
+ height : '24',
121
+ title : 'Replace or edit Player'
122
+ });
123
+
124
+ tinymce.dom.Event.add(soundcloudIGold_editButton, 'mousedown', function(e) {
125
+ var ed = tinyMCE.activeEditor;
126
+ ed.windowManager.bookmark = ed.selection.getBookmark('simple');
127
+ ed.execCommand("soundcloud_Is_Gold");
128
+ });
129
+
130
+ //Create Delite Button: Keep wp_editgallery as id to herite style for gallery edit button
131
+ soundcloudIGold_dellButton = DOM.add('soundcloudisgoldbtns', 'img', {
132
+ src : '../wp-content/plugins/soundcloud-is-gold/tinymce-plugin/img/delete.png',
133
+ id : 'wp_delgallery',
134
+ width : '24',
135
+ height : '24',
136
+ title : 'Remove Player'
137
+ });
138
+
139
+ tinymce.dom.Event.add(soundcloudIGold_dellButton, 'mousedown', function(e) {
140
+ var ed = tinyMCE.activeEditor, el = ed.selection.getNode();
141
+
142
+ if ( el.nodeName == 'IMG' && ed.dom.hasClass(el, 'soundcloudIsGold') ) {
143
+ ed.dom.remove(el);
144
+ t._hideButtons();
145
+ ed.execCommand('mceRepaint');
146
+ return false;
147
+ }
148
+ });
149
+ },
150
+
151
+ getInfo : function() {
152
+ return {
153
+ longname : 'Soundcloud is Gold Shortcode Settings',
154
+ author : 'TM',
155
+ authorurl : 'http://www.mightymess.com',
156
+ infourl : '',
157
+ version : "1.0"
158
+ };
159
+ }
160
+ });
161
+
162
+ tinymce.PluginManager.add('soundcloudIsGold', tinymce.plugins.soundcloudIsGold);
163
+ })();