Changeset 2959728
- Timestamp:
- 08/29/2023 08:18:52 AM (2 years ago)
- Location:
- album-cover-finder/trunk
- Files:
-
- 4 edited
-
albumcoverfinder.php (modified) (4 diffs)
-
js/admin.js (modified) (4 diffs)
-
readme.md (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
album-cover-finder/trunk/albumcoverfinder.php
r2380550 r2959728 4 4 Plugin URI: http://labs.urre.me/albumcoverfinder/ 5 5 Description: A simple plugin for finding album cover art via the LastFM API. You can set attachment, featured image and insert cover in post editor 6 Version: 0. 6.06 Version: 0.7.0 7 7 Author: Urban Sanden 8 8 Author URI: http://urre.me … … 13 13 */ 14 14 15 /* Copyright 202 0Urban Sanden (email: [email protected])15 /* Copyright 2023 Urban Sanden (email: [email protected]) 16 16 17 17 This program is free software; you can redistribute it and/or modify … … 46 46 add_action( 'init', array( $this, 'add_search_boxes' ) ); 47 47 48 add_action('admin_menu', array($this, 'add_menu')); 49 add_action('admin_init', array($this, 'register_settings')); 50 51 } 52 53 public function add_menu() { 54 add_menu_page( 55 'Album Cover Finder Settings', 56 'Album Cover Finder', 57 'manage_options', 58 'album-cover-finder-settings', 59 array($this, 'settings_page') 60 ); 61 } 62 63 public function register_settings() { 64 register_setting('album-cover-finder-settings-group', 'album_cover_finder_api_key'); 65 } 66 67 public function settings_page() { 68 ?> 69 <div class="wrap"> 70 <h1>Album Cover Finder Settings</h1> 71 <form method="post" action="options.php"> 72 <?php settings_fields('album-cover-finder-settings-group'); ?> 73 <?php do_settings_sections('album-cover-finder-settings-group'); ?> 74 <table class="form-table"> 75 <tr valign="top"> 76 <th scope="row">Last.fm API Key</th> 77 <td><input type="text" name="album_cover_finder_api_key" value="<?php echo esc_attr(get_option('album_cover_finder_api_key')); ?>" /></td> 78 </tr> 79 </table> 80 <?php submit_button(); ?> 81 </form> 82 </div> 83 <?php 84 } 85 86 public function get_api_key() { 87 return get_option('album_cover_finder_api_key'); 48 88 } 49 89 … … 88 128 'savenow' => __('Save post to change/remove featured image', 'albumcoverfinder'), 89 129 'ajax_url' => admin_url( 'admin-ajax.php' ), 90 'uploadurl' => admin_url('media-upload.php') 130 'uploadurl' => admin_url('media-upload.php'), 131 'last_fm_api_key' => __($this->get_api_key(), 'albumcoverfinder') 91 132 ); 92 133 93 # Localize script 134 # Localize scriptget_api_key 94 135 wp_localize_script('albumcoverfinder-admin-script', 'AlbumCoverFinderParams', $js_data); 95 136 -
album-cover-finder/trunk/js/admin.js
r2380550 r2959728 102 102 $('.countattachments').text(parseInt(att_count)+1+' '+AlbumCoverFinderParams.files); 103 103 104 console.log(img_url);105 106 104 // Ajax request, set post post thumbnail 107 105 $.post( … … 180 178 var encoded_artist = encodeURIComponent(artist), 181 179 encoded_album = encodeURIComponent(album), 182 lastfm_api_url = 'https://ws.audioscrobbler.com/2.0/?method=album.getinfo&api_key= 853b3e9d9f565707e7edd6f878c3d587&artist='+encoded_artist+'&album='+encoded_album+'&format=json',180 lastfm_api_url = 'https://ws.audioscrobbler.com/2.0/?method=album.getinfo&api_key='+AlbumCoverFinderParams.last_fm_api_key+'&artist='+encoded_artist+'&album='+encoded_album+'&format=json', 183 181 html = ''; 184 182 … … 206 204 $('#findalbum').val(AlbumCoverFinderParams.search); 207 205 $('.clear').attr("disabled", false); 208 206 $('#query_album + p').hide(); 209 207 } else { 210 208 html += '<p>'+AlbumCoverFinderParams.nofound+'</p>'; … … 219 217 $('#cover img').eq(2).remove(); 220 218 $('#findalbum').val(AlbumCoverFinderParams.search); 219 221 220 }, 222 221 error : function(e,d,f){ 222 $('#wait').hide(); 223 $('#query_album').after('<p>Nothing was found</p>'); 223 224 224 225 }, -
album-cover-finder/trunk/readme.md
r961744 r2959728 21 21 2. Activate the plugin 22 22 23 ## Add your Last.fm API key 24 25 To use the plugin you now need to use your own [Last.fm API Key](https://www.last.fm/api/authentication). Visit the plugin settings page and add it there. 26 27  28 29 23 30 ## Uninstall 24 31 1. Deactivate plugin -
album-cover-finder/trunk/readme.txt
r2380550 r2959728 4 4 Tags: music, albums, covers, album covers, artist, sleeves 5 5 Requires at least: 3.0 6 Tested up to: 5.5.17 Stable tag: 0. 6.06 Tested up to: 6.3.0 7 Stable tag: 0.7.0 8 8 9 9 Search for album covers, and use image as featured image, attachment or in post editor. … … 42 42 == Changelog == 43 43 44 = 0.7.0 = 45 The plugin now has a settings page where you can use your own Last.fm API Key. Fixed a thing where the spinner didn't get removed when no results where found. 46 44 47 = 0.6.0 = 45 48 The plugin now works in WordPress 5.5.1
Note: See TracChangeset
for help on using the changeset viewer.