. ************************************************************************** */ if ( !class_exists( "ArtistDataPress_Plugin" ) ) { //Start Class class ArtistDataPress_Plugin { public static $instance; function __construct() { self::$instance = $this; // Runs when plugin is activated register_activation_hook( __FILE__, array( $this, 'create_options' ) ); // Queues the included stylesheet wp_register_style( 'slushman-adp', plugins_url( 'css/artistdatapress.css', __FILE__ ) ); wp_register_style( 'slushman-adp-layout-default', plugins_url( 'css/default.css', __FILE__ ) ); wp_enqueue_style( 'slushman-adp' ); // Adds the ArtistDataPress option menu to the Settings menu add_action( 'admin_menu', array( $this, 'add_menu' ) ); // Add "Settings" link to plugin page add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ) , array( $this, 'settings_link' ) ); // Register and define the settings add_action( 'admin_init', array( $this, 'register_settings' ) ); // Create shortcode [artistdatapress] add_shortcode( 'artistdatapress', array( $this, 'shortcode' ) ); // Include other files add_action( 'init', array( $this, 'file_includer' ) ); } // End of __construct() function create_options() { $options = array( 'slushman_adp_xml_url' => '', 'slushman_adp_adpage_url' => '', 'slushman_adp_max_shows' => '', 'slushman_adp_display_time' => '', 'slushman_adp_display_tickets' => '', 'slushman_adp_display_age' => '', 'slushman_adp_display_country' => '', 'slushman_adp_no_shows' => 'There are no shows currently scheduled.', 'slushman_adp_layout' => '', ); update_option( 'slushman_adp_options', $options ); } // End of create_options() // Options Page function add_menu() { add_options_page( 'ArtistDataPress Options', 'ArtistDataPress', 'manage_options', 'slushman-adp', array( $this, 'options_page' ) ); } // End of add_menu() function settings_link( $links ) { $slushman_adp_settings_link = sprintf( '%s', admin_url( 'options-general.php?page=slushman-adp' ), __( 'Settings' ) ); array_unshift( $links, $slushman_adp_settings_link ); return $links; } // End of settings_link() function options_page() { ?>

ArtistDataPress Options


The ArtistData XML feed URL can be found on your ArtistData account by going to Tools > Data Feeds.

'; } function display_section() { echo '

Choose what information you want displayed on your calendar.

'; } function time_section() { echo '

Choose how you want to format your times and dates.

'; } function styling_section() { echo '

Choose how you want the calendar to appear.

'; } // End of styling_section_fn() function xml_url_field() { $options = get_option( 'slushman_adp_options' ); ?> " /> " /> /> /> /> /> " /> /> message; } // End of libxml_get_errors foreach trigger_error( $error_message ); $error = array( 'Error', 'There seems to be a problem with your feed URL.' ); return $error; } // End of try / catch if ( $data != FALSE ) { $key = $data->show[0]->recordKey; if ( !empty( $key ) ) { return $data; } else { return FALSE; } // End of $key empty check } // End of $data check } else { $error = array( 'Error', 'Please enter a feed in the options page.' ); return $error; } // End of slushman_adp_xml_url empty check } // End of get_xml() /** * Display errors and notices * * * * @since 0.2 * * @param array $args Array of data * * @return mixed HTML formatted error message */ function display_errors_and_notices( $args ) { $notices = array( 'check_field' => sprintf( __( '

The %s field is either invalid or empty.

' ), $args['field'] ), 'already_used' => sprintf( __( '

This %s is already used by another user.

' ), $args['used'] ), 'not_set' => sprintf( __( '

The %s is not set.

' ), $args['unset'] ), 'fail' => sprintf( __( '

Could not %s the %s.

' ), $args['failure'], $args['failed'] ), 'success' => sprintf( __( '

%s %s successfully.

' ), $args['succeeded'], $args['successful'] ), 'attended' => sprintf( __( '

%s has already received credit for this seminar.

' ), $args['student_name'] ), 'enrolled' => sprintf( __( '

%s has been marked as enrolled.

' ), $args['student_name'] ), 'unregistered' => __( '

This student is not currently registered for the seminar course.

' ), 'errors' => sprintf( __( '

%s

' ), $args['error'] ), 'attendance' => sprintf( __( '

Attendance at %s for %s was added successfully.

' ), $args['event'], $args['student'] ), 'partial' => sprintf( __( '

%s updated, but %s did not.

' ), $args['updated'], $args['same'] ), ); $notice = $notices[$args['which']]; return $notice; } // End of display_errors_and_notices() // Create shortcode [artistdatapress] function shortcode( $atts ) { ob_start(); $options = get_option( 'slushman_adp_options' ); $layout_option = $options['slushman_adp_layout']; $layout = new Layout; $layout->get_layout( $layout_option ); $output = ob_get_contents(); ob_end_clean(); return $output; } // End of shortcode() /** * Include other files * * Includes all files containing functions outside the class. * * @since 0.37 */ function file_includer() { require( 'inc/layout.php' ); } // End of file_includer() } // End of ArtistDataPress_Plugin } // End of class check require_once( dirname( __FILE__ ) . '/inc/adp_widget.php' ); new ArtistDataPress_Plugin; ?>