Permalink
Browse files

Allowing to select a black powered by Songkick logo

  • Loading branch information...
1 parent b009a8b commit 3d9a7f1c930243e6f3cea54850edd62cf817313f Sabrina Leandro committed Oct 16, 2010
Showing with 40 additions and 12 deletions.
  1. +2 −2 readme.txt
  2. BIN songkick-logo-black.png
  3. BIN songkick-logo.png
  4. +38 −10 songkick_concerts.php
View
@@ -8,6 +8,6 @@ This plugin adds a widget to display upcoming events for a Songkick user on your
== Installation ==
-1. Upload "songkick_concerts" folder to the "/wp-content/plugins/" directory
+1. Upload "songkick_concerts" to the "/wp-content/plugins/" directory
1. Activate the plugin through the "Plugins" menu
-1. Add the widget to a sidebar, and configure the options. You'll need an API key. Apply for one here: http://www.songkick.com/developer
+1. Add the widget to a sidebar, and set your username and API key. Apply for a key here: http://www.songkick.com/developer
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
@@ -2,11 +2,29 @@
/*
Plugin Name: Songkick Concerts
-Version: 0.1
Plugin URI: http://github.com/saleandro/songkick-wp-plugin
-Description: Show your upcoming concerts based on your Songkick profile!
+Description: Widget to show your upcoming concerts based on your Songkick profile.
+Version: 0.2
Author: Sabrina Leandro
Author URI: http://github.com/saleandro
+
+*/
+
+/*
+ Copyright 2010 Sabrina Leandro (saleandro@yahoo.com)
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License, version 2, as
+ published by the Free Software Foundation.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
if (!class_exists('WP_Http'))
@@ -90,6 +108,7 @@ function songkick_widget($args) {
$hide_if_empty = $options['hide_if_empty'];
$title = ($options['title']) ? $options['title'] : $title;
$profile_title = _("See all concerts");
+ $logo = $options['logo'];
$sk = new SongkickUserEvents($apikey, $username);
$sk->get_events();
@@ -122,7 +141,7 @@ function songkick_widget($args) {
echo "<p style='margin-top: 10px; margin-bottom: 0px; text-align: right'><a href='http://www.songkick.com/users/$username/'>";
echo _($profile_title)."</a></p>";
echo "<a style='margin: 0px' href='http://www.songkick.com/'>";
- echo "<img style='margin: 0px' src='".site_url('/wp-content/plugins/songkick_concerts/songkick-logo.png')."' title='"._($powered_by_songkick)."' alt='"._($powered_by_songkick)."' /></a>";
+ echo "<img style='margin: 0px' src='".site_url('/wp-content/plugins/songkick_concerts/'.$logo)."' title='"._($powered_by_songkick)."' alt='"._($powered_by_songkick)."' /></a>";
echo $after_widget;
}
@@ -133,6 +152,7 @@ function songkick_widget_ctrl() {
'title' => '',
'username' => '',
'apikey' => '',
+ 'logo' => 'songkick-logo.png',
'hide_if_empty' => false,
);
}
@@ -142,25 +162,33 @@ function songkick_widget_ctrl() {
$options['username'] = strip_tags(stripslashes($_POST['songkick_username']));
$options['apikey'] = strip_tags(stripslashes($_POST['songkick_apikey']));
$options['hide_if_empty'] = ($_POST['songkick_hide_if_empty'] === 'on');
+ $options['logo'] = strip_tags(stripslashes($_POST['songkick_logo']));
update_option(SONGKICK_OPTIONS, $options);
}
$title = htmlspecialchars($options['title'], ENT_QUOTES);
$username = htmlspecialchars($options['username'], ENT_QUOTES);
$apikey = htmlspecialchars($options['apikey'], ENT_QUOTES);
$hide_if_empty = ($options['hide_if_empty']) ? 'checked="checked"' : '';
+ $songkick_logo = htmlspecialchars($options['logo'], ENT_QUOTES);
- echo '<p><label for="songkick_title">' . __('Title:');
+ echo '<p><label for="songkick_title">' . __('Title:') . '</label>';
echo ' <br><input class="widefat" id="songkick_title" name="songkick_title" type="text" value="'.$title.'" />';
- echo '</label></p>';
- echo '<p><label for="songkick_username">' . __('Username:');
+ echo '</p>';
+ echo '<p><label for="songkick_username">' . __('Username:') . '</label>';
echo ' <br><input class="widefat" id="songkick_username" name="songkick_username" type="text" value="'.$username.'" />';
- echo '</label></p>';
- echo '<p><label for="songkick_apikey">' . __('Songkick API Key:');
+ echo '</p>';
+ echo '<p><label for="songkick_apikey">' . __('Songkick API Key:') . '</label>';
echo ' <br><input class="widefat" id="songkick_apikey" name="songkick_apikey" type="text" value="'.$apikey.'" />';
- echo '</label></p>';
+ echo '</p>';
+ echo '<p><label for="songkick_logo">' . __('Songkick logo') . '</label>';
+ echo ' <select id="songkick_logo" name="songkick_logo">';
+ echo ' <option value="songkick-logo.png" '.(($songkick_logo == 'songkick-logo.png') ? ' selected' : '').'>' . __('white background') . '</option>';
+ echo ' <option value="songkick-logo-black.png" '.(($songkick_logo == 'songkick-logo-black.png') ? ' selected' : '').'>' . __('black background') . '</option>';
+ echo ' </select>';
+ echo '</p>';
echo '<p><label for="songkick_hide_if_empty">';
- echo ' <input id="songkick_hide_if_empty" name="songkick_hide_if_empty" type="checkbox"'.$hide_if_empty.' /> ';
+ echo ' <input id="songkick_hide_if_empty" name="songkick_hide_if_empty" type="checkbox" '.$hide_if_empty.' /> ';
echo __('Hide if there are no events?');
echo '</label></p>';
echo '<input type="hidden" name="songkick_submit" value="submit" />';

0 comments on commit 3d9a7f1

Please sign in to comment.