Permalink
Browse files

Fixing up warnings

  • Loading branch information...
Sabrina Leandro
Sabrina Leandro committed Jun 30, 2012
1 parent 5d17d2e commit 770b085ee8c8fb56b36efcb330cb7c4bc6fe0412
Showing with 24 additions and 17 deletions.
  1. +4 −1 readme.txt
  2. +9 −5 songkick_concerts_and_festivals.php
  3. +7 −8 songkick_presentable_events.php
  4. +4 −3 songkick_widget.php
View
@@ -3,7 +3,7 @@ Contributors: saleandro, coox
Tags: songkick, concerts, events, festivals, widget
Requires at least: 2.8.2, PHP 5 or higher
Tested up to: 3.4
-Stable tag: 0.9.4
+Stable tag: 0.9.4.1
This plugin lets you display events for a Songkick user, artist, venue, or metro area on your WordPress blog, as a widget or shortcode.
@@ -133,3 +133,6 @@ See Songkick’s admin settings for details.
* Reimplementation of the Widget class. Allows for multilple Widget instances.
* Remove requirement for an API key for *non-commercial* websites.
+
+= 0.9.4.1 =
+* Fixing up and removing warnings
@@ -6,7 +6,7 @@
Description: Plugin to show concerts based on your Songkick profile. It can display upcoming events for a user, an artist, venue, or metro area/location.
It can also display past events for users and artists. For a user, simply put your username in the admin interface. For an artist, you should use the artist's Songkick id, as shown in the url for your artist page.
For example, the url "http://www.songkick.com/artists/123-your-name" has the id "123". The same goes for metro areas or venues: "http://www.songkick.com/venues/123-venue-name" and "http://www.songkick.com/metro_areas/123-city-name" both have the id "123".
-Version: 0.9.4
+Version: 0.9.4.1
Author: Sabrina Leandro
Author URI: http://github.com/saleandro
License: GPL3
@@ -66,10 +66,14 @@ function songkick_concerts_and_festivals_shortcode_handler($options = null) {
try {
wp_enqueue_style('songkick_concerts', '/wp-content/plugins/songkick-concerts-and-festivals/songkick_concerts.css') ;
- $default_options = get_option(SONGKICK_OPTIONS);
- $default_options['logo'] = $default_options['shortcode_logo'];
- $default_options['date_color'] = $default_options['shortcode_date_color'];
- $default_options['number_of_events'] = $default_options['shortcode_number_of_events'];
+ $default_options = get_option(SONGKICK_OPTIONS);
+ if ($default_options) {
+ $default_options['logo'] = $default_options['shortcode_logo'];
+ $default_options['date_color'] = $default_options['shortcode_date_color'];
+ $default_options['number_of_events'] = $default_options['shortcode_number_of_events'];
+ } else {
+ $default_options = array();
+ }
if (is_array($options)) {
$options = array_merge($default_options, $options);
} else {
@@ -9,19 +9,18 @@
class SongkickPresentableEvents {
function SongkickPresentableEvents($options) {
- if ($options['username']) { // legacy
+ if (isset($options['username']) && $options['username']) { // legacy
$songkick_id = $options['username'];
$songkick_id_type = 'user';
} else {
$songkick_id = $options['songkick_id'];
$songkick_id_type = $options['songkick_id_type'];
}
- $apikey = $options['apikey'];
- $attendance = $options['attendance'];
- if (!isset($options['gigography'])) $options['gigography'] = false;
- $gigography = $options['gigography'];
+ $apikey = (isset($options['apikey'])) ? $options['apikey'] : null;
+ $attendance = (isset($options['attendance'])) ? $options['attendance'] : false;
+ $gigography = (isset($options['gigography'])) ? $options['gigography'] : false;
- $this->number_of_events = is_numeric($options['number_of_events']) ? $options['number_of_events'] : 10;
+ $this->number_of_events = (isset($options['number_of_events']) && is_numeric($options['number_of_events'])) ? $options['number_of_events'] : 10;
if (!isset($options['show_pagination'])) $options['show_pagination'] = false;
$this->show_pagination = $options['show_pagination'];
if (!isset($options['page'])) $options['page'] = 1;
@@ -50,8 +49,8 @@ function SongkickPresentableEvents($options) {
$results = $this->songkick_events->get_events($this->page, $this->number_of_events);
$this->events = $results['events'];
$this->total = $results['total'];
- $this->date_color = $options['date_color'];
- $this->logo = $options['logo'];
+ $this->date_color = isset($options['date_color']) ? $options['date_color'] : null;
+ $this->logo = isset($options['logo']) ? $options['logo'] : null;
$this->no_calendar_style = false;
if (isset($options['no_calendar_style'])) {
$this->no_calendar_style = $options['no_calendar_style'];
View
@@ -84,8 +84,8 @@ function form($instance) {
if (empty($this->widget['fields'])) return false;
$key = 'widget-' . $this->widget['id'];
- if (current_user_can('manage_options') && isset($_POST[$key])) {
- $this->update($instance, $_POST[$key][$_POST['widget_number']]);
+ if (current_user_can('manage_options') && isset($_POST[$key]) && isset($_POST[$key][$_POST['widget_number']])) {
+ $this->update($_POST[$key][$_POST['widget_number']], $instance);
}
foreach ($this->widget['fields'] as $field) {
@@ -171,7 +171,8 @@ function widget($args, $instance) {
$this->widget['number'] = $this->number;
$default_options = get_option(SONGKICK_OPTIONS);
- $instance = array_merge($default_options, $instance);
+ if ($default_options)
+ $instance = array_merge($default_options, $instance);
if (!$instance['songkick_id'] or $instance['songkick_id'] == '')
$instance['songkick_id'] = $default_options['songkick_id'];
if (!$instance['songkick_id_type'] or $instance['songkick_id_type'] == '')

0 comments on commit 770b085

Please sign in to comment.