adp = new ArtistDataPress_plugin(); } // End of __construct() /** * Example data to use if XML feed is empty * * @since 0.4 * * @return Object $shows Returns a $shows Object formatted the same as the ArtistData XML feed */ function get_example_data() { $shows = 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->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->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->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; } // End of get_example_data() /* ========================================================================== Layout Section Functions ========================================================================== */ /** * Returns a formatted span containing the age limit * * If the age limit is not empty, the formatted span is returned, otherwise, it returns an HTML space * * @since 0.4 * * @params array $params Includes data: css, $show Object * * @return mixed $return Formatted age/tix line */ function get_age( $css, $show ) { return ( !empty( $show->ageLimit ) ? 'Age Limit: ' . $show->ageLimit . '' : ' ' ); } // End of get_age() /** * Returns a formatted span containing the artist's name * * If the the artist name is not empty, the formatted span is return, otherwise, it returns an HTML space * * @since 0.4 * * @params array $params Includes data: css, $show Object * * @return mixed $return Formatted artist line */ function get_artist( $css, $show ) { return ( !empty( $show->artistname ) ? '' . $show->artistname . '' : ' ' ); } // End of get_artist() /** * Formats the date according to the user's preference * * Gets the options, the gets the user's preference for the date format. Grabs the show's date * and formats it according to the user's preference * * @since 0.4 * * @uses get_option * * @params string $showdate The date of the show * * @return string $return Formatted date */ function get_date( $showdate ) { extract( get_option( 'slushman_adp_general_settings' ) ); $date_format = ( isset( $adp_date_format ) && !empty( $adp_date_format ) ? $adp_date_format : get_option( 'date_format' ) ); return date_i18n( $date_format, strtotime( $showdate ) ); } // End of get_date() /** * Returns a formatted span containing the show description * * If the the show description is not empty, the formatted span is return, otherwise, it returns an HTML space * * @since 0.5 * * @params array $params Includes data: css, $show Object * * @return mixed $return Formatted name line */ function get_description( $css, $show ) { return ( !empty( $show->description ) ? '' . $show->description . '' : ' ' ); } // End of get_description() /** * Takes show data and converts into the ISO format * * ISO date format for rich snippets support * * @since 0.4 * * @uses DateTime() * @uses DateTimeZone() * * @params array $params Includes data: $show Object * * @return string $return Formatted time and date */ function get_iso( $show ) { if ( empty( $show->showtimeZone ) ) { $return = ''; } elseif ( $show->showtimeZone != 'System/Localtime' && !empty( $show->showtimeZone ) ) { $convert = date_create( $show->date . ' ' . $show->timeSet, timezone_open( $show->showtimeZone ) ); $return = date_format( $convert, DATE_ATOM ); } else { // get diff between GMT time and show time $atom = $show->date . 'T' . substr( $show->timeSet, 0, 12 ); $difftemp = strtotime( $show->gmtDate ) - strtotime( $atom ); $hours = $difftemp / 60 / 60; $hour = $hours < 9 ? '0' . $hours : $hours; $diff = $hour . ':00'; $porm = $diff > 0 ? '-' : '+'; $return = $show->date . 'T' . substr( $show->timeSet, 0, 12 ) . $porm . $diff; } // End of time zone check return $return; } // End of get_iso() /** * Formats the location line * * If the state equals "No state", then the location line is just the city and country. If the show * country option is checked, then the line becomes city, state abbreviation, country abbreviation. * Otherwise, the line is city, state abbreviation. * * @since 0.4 * * @uses get_option * * @params array $params Includes data: css, $show Object * * @return mixed $return Formatted location line */ function get_location( $css, $show, $instance = '' ) { extract( get_option( 'slushman_adp_general_settings' ) ); $widget = ( !empty( $instance ) && $instance['country'] == 1 && $show->country != '' ? ', ' . $show->country . '' : '' ); $shortcode = ( $country && $show->country != '' ? ', ' . $show->country . '' : '' ); $elstate = ( !empty( $instance ) ? $show->stateAbbreviation : $show->state ); $docity = ( $show->city != '' ? '' . $show->city . '' : '' ); $dostate = ( $elstate != 'No State' || $elstate != '' ? ', ' . $elstate . '' : '' ); $docountry = ( $instance ? $widget : $shortcode ); $loc = $docity . $dostate . $docountry; // Make the city & state a Google Map link, else just show city & state if ( $show->venueAddress != '' && $elstate == 'No State' ) { $return = '' . $loc . ' - map'; } elseif ( $show->venueAddress != '' && $elstate != 'No State' ) { $return = '' . $loc . ' - map'; } else { $return = '' . $loc . ''; } // End of if ( !empty( $show->venueAddress ) ) return $return; // For later: /* '; */ } // End of get_location() /** * Returns a formatted span containing the venue phone * * If the the venue phone is not empty, the formatted span is return, otherwise, it returns an HTML space * * @since 0.5 * * @params array $params Includes data: css, $show Object * * @return mixed $return Formatted venue phone line */ function get_phone( $css, $show ) { return ( !empty( $show->venuePhone ) ? 'Venue Phone: ' . $show->venuePhone . '' : ' ' ); } // End of get_phone() /** * Returns the appropriate separator * * @since 0.4 * * @params array $params Includes data: $which, $option1, $option2 = '', $data1 = '', $data2 = '' * * @return string $return Either ' at ' or blank */ function get_separator( $params ) { if ( $params[0] == 'at' && $params[1] && $params[2] != '' ) { $return = ' at '; } elseif ( $params[0] == 'at2' && $params[1] && $params[2] != '' && $params[3] && $params[4] != '' ) { $return = ' at '; } elseif ( $params[0] == 'dash' && $params[1] && $params[2] != '' && $params[3] && $params[4] != '' ) { $return = ' - '; } elseif ( $params[0] == 'onthe' && $params[1] && $params[2] != '' && $params[3] && $params[4] != '' ) { $return = ' on the '; } elseif ( $params[0] == 'vbar' && $params[1] && $params[2] != '' && $params[3] && $params[4] != '' ) { $return = '  |  '; } else { $return = ''; } // End of separator checks return $return; } // End of get_separator() /** * Returns a formatted span containing the show name * * If the the show name is not empty, the formatted span is return, otherwise, it returns an HTML space * * @since 0.4 * * @params array $params Includes data: css, $show Object * * @return mixed $return Formatted name line */ function get_show_name( $css, $show ) { return ( !empty( $show->name ) ? '' . $show->name . '' : ' ' ); } // End of get_show_name() /** * Returns a formatted span containing the venue stage name * * If the the venue stage is not empty, the formatted span is return, otherwise, it returns an HTML space * * @since 0.4 * * @params array $params Includes the data: css, $show Object * * @return string $return Formatted venue span */ function get_stage( $css, $show ) { return ( $show->venueNameExt != '' ? ' on the ' . $show->venueNameExt . ' stage' : '' ); } // End of get_stage() /** * Formats the time according to the user's preference * * Gets the options, the gets the user's preference for the time format. Grabs the show's time * and formats it according to the user's preference * * @since 0.4 * * @uses get_option * * @params array $params Date includes: css, $show Object * * @return string $return Formatted time */ function get_time( $css, $show ) { $format = ( isset( $adp_time_format ) ? $adp_time_format : get_option( 'time_format' ) ); return ( !empty( $format ) ? '' . date_i18n( $format, strtotime( $show->timeSet ) ) . '' : '' ); } // End of get_time() /** * Returns a formatted spane containing the ticket pricing * * If the ticket URL is not empty, the ticket price becomes a link to that URL, otherwise it just shows the ticket price. * If the ticket price is blank, an HTML space is returned. * * @since 0.4 * * @params array $params Includes data: css, $show Object * * @return mixed $return Formatted age/tix line */ function get_tix( $css, $show, $instance = '' ) { if ( $show->ticketURI != '' && !empty( $show->ticketPrice ) ) { $return = 'Tickets: ' . $show->ticketPrice . ''; } elseif ( $show->ticketPrice != '' ) { $return = 'Tickets: ' . $show->ticketPrice . ''; } else { $return = ' '; } // End of ticket and ticketurl return $return; } // End of get_tix() /** * Formats the venue line * * If the venueURL is not empty, the name of the venue becomes a link to the venue's site, otherwise * just the venue name is displayed. * * @since 0.4 * * @params array $params Includes data: css, $show Object * * @return mixed $return Formatted venue line */ function get_venue( $css, $show, $widget = '' ) { if ( $show->venueURI != '' || $widget == 'yes' && $show->venueURI != '' ) { $return = '' . $show->venueName . ''; } elseif( $show->venueURI == '' || $widget == 'yes' && $show->venueURI == '' ) { $return = '' . $show->venueName . ''; } else { $return = ''; } // End of $venueurl check return $return; } // End of get_venue() } // End of Layout class } // End of class_exists check ?>