Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

115 lines (94 sloc) 4.724 kb
Plugin Name: Songkick Concerts and Festivals
Plugin URI:
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 "" has the id "123". The same goes for metro areas or venues: "" and "" both have the id "123".
Author: Sabrina Leandro
Author URI:
License: GPL3
Copyright 2012 Sabrina Leandro (
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
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, see <>.
// For debugging:
// error_reporting(E_ALL);
// if ( !defined('WP_DEBUG') )
// define('WP_DEBUG', true);
// if ( !defined('WP_DEBUG_LOG') )
// define('WP_DEBUG_LOG', true); // Tells WordPress to log everything to the /wp-content/debug.log file
// if ( !defined('SAVEQUERIES') )
// define('SAVEQUERIES', true);
// End for debugging
// Don't display errors
@ini_set('display_errors', 0);
if ( !defined('WP_DEBUG_DISPLAY') )
define('WP_DEBUG_DISPLAY', false);
defined('ABSPATH') or die("Cannot access pages directly.");
defined("DS") or define("DS", DIRECTORY_SEPARATOR);
if (!class_exists('WP_Http'))
include_once(ABSPATH . WPINC . '/class-http.php');
define('SONGKICK_OPTIONS', 'songkick-concerts');
define('SONGKICK_TEXT_DOMAIN', 'songkick-concerts-and-festivals');
define('SONGKICK_I18N_ENCODING', 'UTF-8');
define('SONGKICK_CACHE', 'songkick-concerts-cache');
define('SONGKICK_REFRESH_CACHE', 60 * 60);
require_once dirname(__FILE__) . '/songkick_presentable_events.php';
require_once dirname(__FILE__) . '/songkick_settings.php';
require_once dirname(__FILE__) . '/songkick_widget.php';
* Global Initialization of the Songkick Plugin
function songkick_plugin_init() {
// Load Plugin Text Domain for i18n
load_plugin_textdomain(SONGKICK_TEXT_DOMAIN, false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
add_action('init', 'songkick_plugin_init');
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);
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 {
$options = $default_options;
if (!isset($options['show_pagination'])) $options['show_pagination'] = false;
if ($options['show_pagination'] && isset($_GET['skp']))
$options['page'] = $_GET['skp'];
$sk = new SongkickPresentableEvents($options);
$str = '<div class="songkick-events">';
$str .= $sk->to_html();
$str .= '</div>';
return $str;
} catch (Exception $e) {
$msg = 'Error on ' . get_bloginfo('wpurl') . ' while trying to display Songkick Concerts plugin: ' . $e->getMessage();
error_log($msg, 0);
return '';
add_action('admin_menu', 'songkick_admin_menu');
function songkick_admin_menu() {
add_options_page('Songkick Concerts and Festivals', 'Songkick', 'administrator', 'songkick-concerts-and-festivals', 'songkick_admin_settings');
add_shortcode("songkick_concerts_and_festivals", "songkick_concerts_and_festivals_shortcode_handler");
Jump to Line
Something went wrong with that request. Please try again.