. ************************************************************************** To-Do List * Get time and date jquery previews working * http://core.trac.wordpress.org/browser/trunk/wp-admin/options-general.php - see add_js * Check out admin_notices: http://www.instantshift.com/2012/03/06/21-most-useful-wordpress-admin-page-hacks/ * Auto-blog a post the day of a show with the details of that show * Add support for feeds from Sonicbids and Reverbnation - any others? */ require_once( dirname( __FILE__ ) . '/inc/adp_widget.php' ); require_once( dirname( __FILE__ ) . '/inc/make_template.php' ); if ( !class_exists( "ArtistDataPress_Plugin" ) ) { //Start Class class ArtistDataPress_Plugin { public static $instance; const PLUGIN_NAME = 'ArtistDataPress'; const OPTS_NAME = 'slushman_adp_options'; const GENSETS_NAME = 'slushman_adp_general_settings'; const LAYSETS_NAME = 'slushman_adp_layout_settings'; const PLUGIN_SLUG = 'slushman-adp'; private $settings_tabs = array(); /** * Constructor */ function __construct() { self::$instance = $this; // Runs when plugin is activated register_activation_hook( __FILE__, array( $this, 'create_options' ) ); // 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' ) ); // Create shortcode [artistdatapress] add_shortcode( 'artistdatapress', array( $this, 'shortcode' ) ); // Register and define the settings add_action( 'admin_init', array( $this, 'gen_settings_reg' ) ); add_action( 'admin_init', array( $this, 'lay_settings_reg' ) ); // Enqueue stylesheets add_action( 'wp_enqueue_scripts', array( $this, 'add_styles' ) ); add_action( 'admin_enqueue_scripts', array( $this, 'add_styles' ) ); // Enqueue scripts // add_action( 'admin_enqueue_scripts', array( $this, 'example_js' ) ); // Register the widget if its selected add_action( 'widgets_init', array( $this, 'widgets_init' ) ); $this->gensets = (array) get_option( self::GENSETS_NAME ); $this->laysets = (array) get_option( self::LAYSETS_NAME ); $this->widgets = array( 'ArtistDataPress' ); } // __construct() /** * Creates the plugin settings * * Creates an array containing each setting and sets the default values to blank. * Then saves the array in the plugin option. * * @since 0.1 * * @uses get_option * @uses delete_option * @uses update_option */ function create_options() { if ( get_option( self::OPTS_NAME ) ) { $options = get_option( self::OPTS_NAME ); $general['XML_feed_URL'] = $options['slushman_adp_xml_url']; $general['profile_URL'] = $options['slushman_adp_adpage_url']; $general['how_many_shows'] = $options['slushman_adp_max_shows']; $general['no_shows_message'] = $options['slushman_adp_no_shows']; $general['show_name'] = $options['slushman_adp_display_name']; $general['show_time'] = $options['slushman_adp_display_time']; $general['ticket_price'] = $options['slushman_adp_display_tickets']; $general['age_limit'] = $options['slushman_adp_display_age']; $general['display_artist'] = $options['slushman_adp_display_artist']; $general['country'] = $options['slushman_adp_display_country']; $general['XML_feed_URL'] = $general['xml_url']; $general['profile_URL'] = $general['adpage_url']; $general['how_many_shows'] = $general['max_shows']; $general['no_shows_message'] = $general['no_shows_msg']; $general['show_name'] = $general['display_name']; $general['venue_stage'] = $general['display_stage']; $general['artist_name'] = $general['display_artist']; $general['ticket_price'] = $general['display_tickets']; $general['age_limit'] = $general['display_age']; $general['country'] = $general['display_country']; $general['show_time'] = $general['display_time']; $general['abbreviate_state'] = $general['abbreviate_country'] = $general['adp_time_format'] = $general['adp_date_format'] = ''; $layout['adp_layout'] = 'Classic'; delete_option( self::OPTS_NAME ); } else { $general['XML_feed_URL'] = $general['profile_URL'] = $general['how_many_shows'] = $general['show_name'] = $general['show_time'] = $general['show_description'] = $general['venue_phone'] = $general['ticket_price'] = $general['age_limit'] = $general['abbreviate_state'] = $general['abbreviate_country'] = $general['artist_name'] = $general['country'] = $general['venue_stage'] = ''; $general['adp_time_format'] = 'g:i a'; $general['adp_date_format'] = 'D n/d/Y'; $general['no_shows_message'] = 'There are no shows currently scheduled.'; $layout['adp_layout'] = 'Classic'; } // End of previous options check update_option( self::GENSETS_NAME, $general ); update_option( self::LAYSETS_NAME, $layout ); } // create_options() /* ========================================================================== Plugin Settings ========================================================================== */ /** * Adds the plugin settings page to the appropriate admin menu * * @since 0.1 * * @uses add_options_page */ function add_menu() { add_options_page( self::PLUGIN_NAME . 'Options', self::PLUGIN_NAME, 'manage_options', self::PLUGIN_SLUG, array( $this, 'settings_page' ) ); } // add_menu() /** * Adds a link to the plugin settings page to the plugin's listing on the plugin page * * @since 0.1 * * @uses admin_url */ function settings_link( $links ) { $settings_link = sprintf( '%s', admin_url( 'options-general.php?page=' . self::PLUGIN_SLUG ), __( 'Settings' ) ); array_unshift( $links, $settings_link ); return $links; } // settings_link() /** * Creates the settings page * * @since 0.1 * * @uses plugins_url * @uses settings_fields * @uses do_settings_sections * @uses submit_button */ function settings_page() { $tab = ( isset( $_GET['tab'] ) ? $_GET['tab'] : self::GENSETS_NAME ); ?>


Support and Improve ADP

Like this plugin? Want to help improve it? All donations will go towards improving ArtistDataPress, so donate $5, $10, or $20 now!

settings_tabs[self::GENSETS_NAME] = self::PLUGIN_NAME . 'Settings'; register_setting( self::GENSETS_NAME, self::GENSETS_NAME, array( $this, 'validate_options' ) ); $sections = array( 'URL', 'display', 'time_and_date' ); foreach ( $sections as $section ) { $secname = ( str_replace( '_', ' ', $section ) ); add_settings_section( 'slushman_adp_' . $section, 'ArtistDataPress ' . ucwords( $secname ) . ' Options', array( $this, $section . '_section' ), self::GENSETS_NAME ); } // End of $sections foreach $fields['URL'][0]['name'] = $fields['URL'][0]['args']['id'] = 'XML_feed_URL'; $fields['URL'][0]['args']['class'] = 'slushman_adp_text_field'; $fields['URL'][0]['args']['name'] = self::GENSETS_NAME . '[XML_feed_URL]'; $fields['URL'][0]['args']['type'] = 'url'; $fields['URL'][0]['args']['value'] = $this->gensets['XML_feed_URL']; $fields['URL'][1]['name'] = $fields['URL'][1]['args']['id'] = 'profile_URL'; $fields['URL'][1]['args']['class'] = 'slushman_adp_text_field'; $fields['URL'][1]['args']['name'] = self::GENSETS_NAME . '[profile_URL]'; $fields['URL'][1]['args']['type'] = 'url'; $fields['URL'][1]['args']['value'] = $this->gensets['profile_URL']; $fields['display'][0]['name'] = $fields['display'][0]['args']['id'] = 'how_many_shows'; $fields['display'][0]['args']['name'] = self::GENSETS_NAME . '[how_many_shows]'; $fields['display'][0]['args']['type'] = 'number'; $fields['display'][0]['args']['value'] = ( empty( $this->gensets['how_many_shows'] ) ? 'All' : $this->gensets['how_many_shows'] ); $checkboxes = array( 'age_limit', 'artist_name', 'abbreviate_state', 'country', 'abbreviate_country', 'show_description', 'show_name', 'show_time', 'ticket_price', 'venue_phone', 'venue_stage' ); $count = 1; foreach ( $checkboxes as $checkbox ) { $fields['display'][$count]['name'] = $fields['display'][$count]['args']['id'] = $checkbox; $fields['display'][$count]['args']['name'] = self::GENSETS_NAME . '[' . $checkbox . ']'; $fields['display'][$count]['args']['type'] = 'checkbox'; $fields['display'][$count]['args']['check'] = $this->gensets[$checkbox]; $count++; } // End of $checkboxes foreach $fields['display'][$count]['name'] = $fields['display'][$count]['args']['id'] = 'no_shows_message'; $fields['display'][$count]['args']['class'] = 'slushman_adp_text_field'; $fields['display'][$count]['args']['name'] = self::GENSETS_NAME . '[no_shows_message]'; $fields['display'][$count]['args']['type'] = 'text'; $fields['display'][$count]['args']['value'] = $this->gensets['no_shows_message']; foreach ( $fields as $section => $field ) { foreach ( $field as $data ) { extract( $data ); $plain = str_replace( '_', ' ', $name ); $fieldname = 'slushman_adp_' . $name . '_field'; switch ( $section ) { case ( 'URL' ) : $title = 'ArtistData ' . ucwords( $plain ); break; case ( 'display' ) : $title = 'Display ' . ucwords( $plain ) . '?'; break; case ( 'time_and_date' ) : $title = ucwords( $plain ) . ' Format'; break; } // End of $section switch add_settings_field( $fieldname, $title, array( $this, 'create_settings' ), self::GENSETS_NAME, 'slushman_adp_' . $section, $args ); } // End of $field foreach } // End of $fields foreach add_settings_field( 'slushman_adp_time_format_field', 'Time format:', array( $this, 'display_time_format_field' ), self::GENSETS_NAME, 'slushman_adp_time_and_date' ); add_settings_field( 'slushman_adp_date_format_field', 'Date format:', array( $this, 'display_date_format_field' ), self::GENSETS_NAME, 'slushman_adp_time_and_date' ); } // gen_settings_reg() /** * Registers the layout tab plugin option, settings, and sections * * Instead of writing the registration for each field, I used a foreach loop to write them all. * add_settings_field has an argument that can pass data to the callback, which I used to send the specifics * of each setting field to the callback that actually creates the setting field. * * @since 0.42 * * @uses register_setting * @uses add_settings_section * @uses add_settings_field */ function lay_settings_reg() { $this->settings_tabs[self::LAYSETS_NAME] = self::PLUGIN_NAME . ' Layouts'; register_setting( self::LAYSETS_NAME, self::LAYSETS_NAME ); add_settings_section( 'slushman_adp_layout', 'Choose the Layout', array( $this, 'layout_section' ), self::LAYSETS_NAME ); add_settings_field( 'slushman_adp_layout_field', 'Choose the layout for your events.', array( $this, 'layout_preference_field' ), self::LAYSETS_NAME, 'slushman_adp_layout' ); } // lay_settings_reg() /** * Creates the settings fields * * Accepts the $params from settings_reg() and creates a setting field * * @since 0.1 * * @params $params The data specific to this setting field, comes from settings_reg() * * @uses checkbox */ function create_settings( $params ) { $defaults = array( 'blank' => '', 'check' => '', 'class' => '', 'desc' => '', 'id' => '', 'label' => '', 'name' => '', 'selections' => '', 'size' => '', 'type' => '', 'value' => '' ); $args = wp_parse_args( $params, $defaults ); switch ( $args['type'] ) { case ( 'email' ) : case ( 'number' ) : case ( 'tel' ) : case ( 'url' ) : case ( 'text' ) : echo $this->make_text( $args ); break; case ( 'checkbox' ) : echo $this->make_checkbox( $args ); break; case ( 'textarea' ) : echo $this->make_textarea( $args ); break; case ( 'checkboxes' ) : echo $this->make_checkboxes( $args ); break; case ( 'radios' ) : echo $this->make_radios( $args ); break; case ( 'select' ) : echo $this->make_select( $args ); break; case ( 'file' ) : echo $this->make_file( $args ); break; case ( 'password' ) : echo $this->make_password( $args ); break; } // End of $inputtype switch } // create_settings_fn() // Settings Fields /** * Writes the HTML for the time_format field */ function display_time_format_field() { ?>
gensets['adp_time_format'] ); ?>
  • Examples...
  • =
gensets['adp_date_format'] ); ?>
  • Examples...
  • =
Please note: These settings do not apply to the iCal layout.
Please see the documentation on date and time formatting for additional formats.' ); ?>
The ArtistData XML feed URL can be found on your ArtistData account by going to Tools > Data Feeds.

'; } // urls_section() /** * Writes the header for the display section */ function display_section() { echo '

Choose what information you want displayed on your calendar.

'; } // display_section() /** * Writes the header for the time_and_date section */ function time_and_date_section() { echo '

Choose how you want to format your times and dates.

'; } // time_and_date_section() /** * Writes the header for the layout section */ function layout_section() { echo ''; } // layout_section() /** * Writes the HTML for the time_format field */ /* function example_js() { ?>

If want to customize your show template beyond the plugin options, please check out the documentation.

 



get_adp_layout( array( 'layout' => $choice, 'limit' => 3, 'source' => 'plugsets' ) ); ?>
'', 'layout' => $this->laysets['adp_layout'], 'maxshows' => '', 'source' => '' ); $params = wp_parse_args( $params, $defaults ); $count = 0; if ( $params['source'] == 'plugsets' ) { $showfeed = $this->get_example_data(); $maxshows = 3; $add = ''; } else { $url = ( empty( $instance['feed_url'] ) ? ( empty( $params['feedurl'] ) ? $adp->gensets['XML_feed_URL'] : $params['feedurl'] ) : $instance['feed_url'] ); $maxshows = ( empty( $instance['max_shows'] ) ? ( empty( $params['maxshows'] ) ? $adp->gensets['how_many_shows'] : $params['maxshows'] ) : $instance['max_shows'] ); $add = ( !empty( $instance ) ? 'w_' : '' ); $feed = $this->parse_xml( $url ); $showfeed = ( ( $feed[0] == 'Error' || !$feed ) ? '' : $feed ); } echo '
'; if ( empty( $feed->show[0] ) && $params['source'] != 'plugsets' ) { echo '
' . $adp->gensets['no_shows_message'] . '
'; } elseif ( $showfeed && is_array( $showfeed ) && $showfeed[0] == 'Error' ) { echo '
' . $showfeed[1] . '
'; } elseif ( $showfeed && !is_array( $showfeed ) ) { foreach ( $showfeed->show as $show ) { include( $this->get_adp_template( $params['layout'] ) ); ++$count; if ( $count == $maxshows ) { break; } // End of $maxshows check } // End of $showfeed foreach } // End of $showfeed empty check ?>
More shows
gensets['adp_date_format']; $time = $adp->gensets['adp_time_format']; $date_format = ( isset( $date ) && !empty( $date ) ? $date : get_option( 'date_format' ) ); $time_format = ( isset( $time ) && !empty( $time ) ? $time : get_option( 'time_format' ) ); $shows = new stdClass; $shows->show = array( new stdClass, new stdClass, new stdClass ); $shows->show[0]->recordKey = 'NTVD-CJ-3N67231831062008'; $shows->show[0]->name = 'The Vibe Dials CD Release'; $shows->show[0]->city = 'Nashville'; $shows->show[0]->venueName = 'Ryman Auditorium'; $shows->show[0]->venueNameExt = 'Mother Church'; $shows->show[0]->showType = 'Club/Casino/Arena Show'; $shows->show[0]->venueZip = '37219'; $shows->show[0]->venuePhone = '615-889-3060'; $shows->show[0]->venueAddress = '116 5th Ave North'; $shows->show[0]->ticketURI = 'http://thevibedials.com'; $shows->show[0]->description = 'You\'ve made it when you\'re playing the Ryman.'; $shows->show[0]->ageLimit = 'All Ages'; $shows->show[0]->venueURI = 'http://www.ryman.com/'; $shows->show[0]->ticketPrice = '$10'; $shows->show[0]->date = date( $date_format ); $shows->show[0]->timeSet = date( $time_format, time() ); $shows->show[0]->gmtDate = gmdate( $date_format ); $shows->show[0]->showtimeZone = 'America/Chicago'; $shows->show[0]->timeDoors = date( $time_format, time() ); $shows->show[0]->directLink = ''; $shows->show[0]->posterImage = ''; $shows->show[0]->lastUpdate = date( $time_format, time() ); $shows->show[0]->stateAbbreviation = 'TN'; $shows->show[0]->state = 'Tennessee'; $shows->show[0]->countryAbbreviation = 'US'; $shows->show[0]->country = 'United States'; $shows->show[0]->timeZone = 'America/Chicago'; $shows->show[0]->deposit = '$100'; $shows->show[0]->depositReceived = date( $date_format ); $shows->show[0]->otherArtists = new stdClass; $shows->show[0]->otherArtists->name = ''; $shows->show[0]->otherArtists->uri = ''; $shows->show[0]->otherArtists->timeSet = ''; $shows->show[0]->artistname = 'The Vibe Dials'; $shows->show[0]->artistKey = 'AR-8FAD4948ACC579CB'; $shows->show[1]->recordKey = 'NTVD-CJ-3N67231831062009'; $shows->show[1]->name = 'Bonnaroo Music Festival'; $shows->show[1]->city = 'Manchester'; $shows->show[1]->venueName = 'Bonnaroo Centeroo'; $shows->show[1]->venueNameExt = 'The Other Tent'; $shows->show[1]->showType = 'Festival / Fair'; $shows->show[1]->venueZip = '37355'; $shows->show[1]->venuePhone = '1-800Ð594-8499'; $shows->show[1]->venueAddress = 'New Bushy Branch Road'; $shows->show[1]->ticketURI = 'http://thevibedials.com'; $shows->show[1]->description = 'Bonnaroooooo!'; $shows->show[1]->ageLimit = 'All Ages'; $shows->show[1]->venueURI = 'http://www.bonnaroo.com/'; $shows->show[1]->ticketPrice = '$150'; $shows->show[1]->date = date( $date_format ); $shows->show[1]->timeSet = date( $time_format, time() ); $shows->show[1]->gmtDate = gmdate( $date_format ); $shows->show[1]->showtimeZone = 'America/Chicago'; $shows->show[1]->timeDoors = date( $time_format, time() ); $shows->show[1]->directLink = ''; $shows->show[1]->posterImage = ''; $shows->show[1]->lastUpdate = date( $time_format, time() ); $shows->show[1]->stateAbbreviation = 'TN'; $shows->show[1]->state = 'Tennessee'; $shows->show[1]->countryAbbreviation = 'US'; $shows->show[1]->country = 'United States'; $shows->show[1]->timeZone = 'America/Chicago'; $shows->show[1]->deposit = '$1000'; $shows->show[1]->depositReceived = date( $date_format ); $shows->show[1]->otherArtists = new stdClass; $shows->show[1]->otherArtists->name = ''; $shows->show[1]->otherArtists->uri = ''; $shows->show[1]->otherArtists->timeSet = ''; $shows->show[1]->artistname = 'The Vibe Dials'; $shows->show[1]->artistKey = 'AR-8FAD4948ACC579CB'; $shows->show[2]->recordKey = 'NTVD-CJ-3N67231831062010'; $shows->show[2]->name = 'South by SouthWest Music Festival'; $shows->show[2]->city = 'Austin'; $shows->show[2]->venueName = 'The White Horse'; $shows->show[2]->venueNameExt = 'Main'; $shows->show[2]->showType = 'Festival / Fair'; $shows->show[2]->venueZip = '78702'; $shows->show[2]->venuePhone = ''; $shows->show[2]->venueAddress = '500 Comal St'; $shows->show[2]->ticketURI = 'http://thevibedials.com'; $shows->show[2]->description = ''; $shows->show[2]->ageLimit = '21+'; $shows->show[2]->venueURI = 'http://www.sxsw.com/'; $shows->show[2]->ticketPrice = '$595'; $shows->show[2]->date = date( $date_format ); $shows->show[2]->timeSet = date( $time_format, time() ); $shows->show[2]->gmtDate = gmdate( $date_format ); $shows->show[2]->showtimeZone = 'America/Chicago'; $shows->show[2]->timeDoors = date( $time_format, time() ); $shows->show[2]->directLink = ''; $shows->show[2]->posterImage = ''; $shows->show[2]->lastUpdate = date( $time_format, time() ); $shows->show[2]->stateAbbreviation = 'TX'; $shows->show[2]->state = 'Texas'; $shows->show[2]->countryAbbreviation = 'US'; $shows->show[2]->country = 'United States'; $shows->show[2]->timeZone = 'America/Chicago'; $shows->show[2]->deposit = '$100'; $shows->show[2]->depositReceived = date( $date_format ); $shows->show[2]->otherArtists = new stdClass; $shows->show[2]->otherArtists->name = ''; $shows->show[2]->otherArtists->uri = ''; $shows->show[2]->otherArtists->timeSet = ''; $shows->show[2]->artistname = 'The Vibe Dials'; $shows->show[2]->artistKey = 'AR-8FAD4948ACC579CB'; return $shows; } // get_example_data() /** * Processes and outputs the raw ArtistData XML feed * * Gets the transient, if there isn't one already, fetches the XML feed * using wp_remote_get & wp_remote_retrieve_body then parses the XML * into an array using SimpleXML. * * The transient is saved for one hour. * * @since 0.6 * * @uses md5 * @uses get_transient * @uses wp_remote_get * @uses is_wp_error * @uses wp_remote_retrieve_body * @uses set_transient * @uses simplexml_load_string * * @return array $xml An array of data from the ArtistData XML */ function parse_xml( $url ) { $key = md5( $url ); if ( $url ) { $response = wp_remote_get( $url, array( 'timeout' => 15 ) ); if ( !is_wp_error( $response ) ) { $xml = wp_remote_retrieve_body( $response ); } // End of wp_error check } // End of $output && $url checks if ( $xml ) { $output = @simplexml_load_string( $xml ); } else { $output = array( 'Error', 'There seems to be a problem with your feed URL.' ); } // End of $xml check return $output; } // parse_xml() /** * Creates shortcode [artistdatapress] * * Shortcode atts: * maxshows how many shows to display * feedurl The feed URL to use * * @param array $atts The attrbiutes from the shortcode * * @uses get_option * @uses get_layout * * @return mixed $output Output of the buffer */ function shortcode( $atts ) { ob_start(); $defaults = array( 'maxshows' => '', 'feedurl' => '' ); $args = wp_parse_args( $atts, $defaults ); $this->get_adp_layout( $args ); $output = ob_get_contents(); ob_end_clean(); return $output; } // shortcode() /** * Registers widgets with WordPress * * @since 0.5 * * @uses register_widget */ function widgets_init() { foreach ( $this->widgets as $field ) { $widget = str_replace( ' ', '_', strtolower( $field ) ) . '_widget'; register_widget( $widget ); } // End of $fields foreach } // widgets_init() /* ========================================================================== Slushman Toolkit Functions ========================================================================== */ /** * Creates a single checkbox field based on the params * * @params are: * check - used in the checked function (example: the plugin's saved option) * class - used for the class attribute * id - used for the id and name attributes * label - the label to use in front of the field * name - if the name needs to be separated from ID, otherwise its the ID field * * @since 0.1 * * @param array $params An array of the data for the checkbox field * * @return mixed $output A properly formatted HTML checkbox with optional label and description */ function make_checkbox( $params ) { $defaults = array( 'class' => '', 'id' => '', 'label' => '', 'name' => $params['id'] ); $params = wp_parse_args( $params, $defaults ); //$checked = checked( $params['check'], 1, FALSE ); $output = sprintf( ' ', $params['name'], $params['id'], $params['class'], $params['label'] ); return $output; } // make_checkbox() /** * Creates a select menu based on the params * * @params are: * blank - false for none, true if you want a blank option, or enter text for the blank selector * class - used for the class attribute * desc - description used for the description span * id - used for the id and name attributes * label - the label to use in front of the field * name - the name of the field * value - used in the selected function * selections - an array of data to use as the selections in the menu * * @since 0.1 * * @param array $params An array of the data for the select menu * * @return mixed $output A properly formatted HTML select menu with optional label and description */ function make_select( $params ) { $defaults = array( 'class' => '', 'desc' => '', 'id' => '', 'label' => '', 'name' => $params['id'], 'value' => '' ); $params = wp_parse_args( $params, $defaults ); $output = ( !empty( $params['label'] ) ? sprintf( '', $params['id'], $params['label'] ) : '' ); $output .= sprintf( ''; $output .= ( !empty( $params['desc'] ) ? sprintf( '
%s', $params['desc'] ) : '' ); return $output; } // make_select() /** * Creates an input field based on the params * * Creates an input field based on the params * * @params are: * class - used for the class attribute * desc - description used for the description span * id - used for the id and name attributes * label - the label to use in front of the field * name - (optional), can be a separate value from ID * placeholder - The text that appears in th field before a value is entered. * type - detemines the particular type of input field to be created * value - used for the value attribute * * Inputtype options: * email - email address * text - standard text field (default) * tel - phone numbers * url - urls * * @since 0.1 * * @param array $params An array of the data for the text field * * @return mixed $output A properly formatted HTML input field with optional label and description */ function make_text( $params ) { $defaults = array( 'class' => '', 'desc' => '', 'id' => '', 'label' => '', 'name' => $params['id'], 'placeholder' => '', 'type' => 'text', 'value' => '' ); $params = wp_parse_args( $params, $defaults ); $value = ( $params['type'] == 'url' ? esc_url( $params['value'] ) : esc_attr( $params['value'] ) ); $output = ( !empty( $params['label'] ) ? sprintf( '', $params['id'], $params['label'] ) : '' ); $output .= sprintf( '', $params['type'], $params['id'], $params['name'], $value, $params['class'], $params['placeholder'] ); $output .= ( !empty( $params['desc'] ) ? sprintf( '
%s', $params['desc'] ) : '' ); return $output; } // make_text() /** * Display an array in a nice format * * @param array The array you wish to view */ public function print_array( $array ) { echo '
';
		  
		  print_r( $array );
		  
		  echo '
'; } // print_array() } // class } // class check $adp = new ArtistDataPress_Plugin; ?>