4 Commits
dev ... v0.1.11

Author SHA1 Message Date
f38ceccdb3 Bump version to 0.1.11
Some checks failed
Release Plugin Zip / release (push) Has been cancelled
2026-04-24 14:39:23 -05:00
94b51c3959 Refine SportsPress webhook schedule templates 2026-04-24 14:38:38 -05:00
8f1a819a2d Fix stale plugin update notice
Some checks failed
Release Plugin Zip / release (push) Has been cancelled
2026-04-11 12:29:47 -05:00
5a5bf5acdb Bump version to 0.1.10
Some checks failed
Release Plugin Zip / release (push) Has been cancelled
2026-04-08 07:23:37 -05:00
10 changed files with 1779 additions and 536 deletions

View File

@@ -1,224 +1,207 @@
<?php <?php
/** /*
* SP Event featured-image generator. Plugin Name: SP Event Image Generator
* Description: Auto-generates featured images for SP Events by combining team colors and logos.
* Auto-generates bisected team-color images for SP Events. Version: 1.0
* Author: Your Name
* @package Tonys_Sportspress_Enhancements */
*/
function generate_bisected_image($color1, $color2, $logo1_path, $logo2_path) {
$width = 1200;
$height = 628;
$x_margin = 0.1 * ($width / 2); // 10% of half the width
$y_margin = 0.1 * $height; // 10% of the height
$image = imagecreatetruecolor($width, $height);
// Allocate colors
$rgb1 = sscanf($color1, "#%02x%02x%02x");
$rgb2 = sscanf($color2, "#%02x%02x%02x");
$color1_alloc = imagecolorallocate($image, $rgb1[0], $rgb1[1], $rgb1[2]);
$color2_alloc = imagecolorallocate($image, $rgb2[0], $rgb2[1], $rgb2[2]);
// Fill halves with a 15-degree angled bisection
$points1 = [
0, 0,
0, $height,
$width*.40, $height,
$width*.60, 0,
];
$points2 = [
$width, 0,
$width, $height,
$width*.40, $height,
$width*.60, 0,
];
imagefilledpolygon($image, $points1, $color1_alloc);
imagefilledpolygon($image, $points2, $color2_alloc);
// Add logos with resizing and positioning if paths are not empty
if (!empty($logo1_path)) {
$logo1 = imagecreatefrompng($logo1_path);
$logo1_width = imagesx($logo1);
$logo1_height = imagesy($logo1);
// Calculate max dimensions for logo 1
$max_width = ($width / 2) - (2 * $x_margin);
$max_height = $height - (2 * $y_margin);
// Resize logo 1
$new_logo1_width = $logo1_width;
$new_logo1_height = $logo1_height;
if ($logo1_width > $max_width || $logo1_height > $max_height) {
$aspect_ratio1 = $logo1_width / $logo1_height;
if ($logo1_width / $max_width > $logo1_height / $max_height) {
$new_logo1_width = $max_width;
$new_logo1_height = $max_width / $aspect_ratio1;
} else {
$new_logo1_height = $max_height;
$new_logo1_width = $max_height * $aspect_ratio1;
}
}
// Center logo 1
$logo1_x = (int) ($width / 4) - ($new_logo1_width / 2);
$logo1_y = (int) ($height / 2) - ($new_logo1_height / 2);
imagecopyresampled($image, $logo1, $logo1_x, $logo1_y, 0, 0, $new_logo1_width, $new_logo1_height, $logo1_width, $logo1_height);
imagedestroy($logo1);
}
if (!empty($logo2_path)) {
$logo2 = imagecreatefrompng($logo2_path);
$logo2_width = imagesx($logo2);
$logo2_height = imagesy($logo2);
// Calculate max dimensions for logo 2
$max_width = ($width / 2) - (2 * $x_margin);
$max_height = $height - (2 * $y_margin);
// Resize logo 2
$new_logo2_width = $logo2_width;
$new_logo2_height = $logo2_height;
if ($logo2_width > $max_width || $logo2_height > $max_height) {
$aspect_ratio2 = $logo2_width / $logo2_height;
if ($logo2_width / $max_width > $logo2_height / $max_height) {
$new_logo2_width = $max_width;
$new_logo2_height = $max_width / $aspect_ratio2;
} else {
$new_logo2_height = $max_height;
$new_logo2_width = $max_height * $aspect_ratio2;
}
}
// Center logo 2
$logo2_x = (int) (3 * $width / 4) - ($new_logo2_width / 2);
$logo2_y = (int) ($height / 2) - ($new_logo2_height / 2);
imagecopyresampled($image, $logo2, $logo2_x, $logo2_y, 0, 0, $new_logo2_width, $new_logo2_height, $logo2_width, $logo2_height);
imagedestroy($logo2);
}
// Start output buffering to capture the image data
ob_start();
imagepng($image); // Output the image as PNG
$image_data = ob_get_clean(); // Get the image data from the buffer
// Clean up memory
imagedestroy($image);
return $image_data;
if ( ! defined( 'ABSPATH' ) ) {
exit;
} }
/** function add_image_generator_endpoint() {
* Register the head-to-head rewrite endpoint. add_rewrite_endpoint('head-to-head', EP_ROOT, true);
*
* @return void
*/
function tony_sportspress_add_image_generator_endpoint() {
add_rewrite_endpoint( 'head-to-head', EP_ROOT, true );
} }
add_action( 'init', 'tony_sportspress_add_image_generator_endpoint' ); add_action('init', 'add_image_generator_endpoint');
/** function handle_image_request() {
* Serve the generated matchup image on template_redirect. if (!isset($_GET['post'])) return;
*
* @return void
*/
function tony_sportspress_handle_image_request() {
if ( ! isset( $_GET['post'] ) ) {
return;
}
$post_id = absint( $_GET['post'] ); $post_id = $_GET['post'];
if ( $post_id <= 0 ) { $post = get_post($post_id);
return;
}
$post = get_post( $post_id ); // Verify post type
if ( ! $post || $post->post_type !== 'sp_event' ) { if (!$post && $post->post_type !== 'sp_event') return;
return;
}
$team_ids = get_post_meta( $post_id, 'sp_team', false ); // Get associated teams from post meta
if ( count( $team_ids ) < 2 ) { $team_ids = get_post_meta($post_id, 'sp_team', false); // false to get an array of values
return;
}
$team1_id = (int) $team_ids[0]; // Ensure we have exactly two teams
$team2_id = (int) $team_ids[1]; if (count($team_ids) < 2) return;
$team1 = get_post( $team1_id ); $team1_id = $team_ids[0];
$team2 = get_post( $team2_id ); $team2_id = $team_ids[1];
if ( ! $team1 || ! $team2 ) { $team1 = get_post($team1_id);
return; $team2 = get_post($team2_id);
} $team1_postmodified = strtotime($team1->post_modified);
$team2_postmodified = strtotime($team2->post_modified);
$team1_modified = strtotime( $team1->post_modified ); $cache_key = "team_image_{$team1_id}_{$team1_postmodified}-{$team2_id}_{$team2_postmodified}";
$team2_modified = strtotime( $team2->post_modified ); $cached_image_path = get_transient($cache_key);
$cache_key = "team_image_{$team1_id}_{$team1_modified}-{$team2_id}_{$team2_modified}";
$cached_path = get_transient( $cache_key ); if ($cached_image_path && file_exists($cached_image_path)) {
if ( $cached_path && file_exists( $cached_path ) ) { serve_image($cached_image_path);
tony_sportspress_serve_image( $cached_path );
exit; exit;
} }
$default_color = '#FFFFFF'; // Get team colors and logos
$team1_colors = get_post_meta( $team1_id, 'sp_colors', true ); $team1_colors = get_post_meta($team1_id, 'sp_colors', true);
$team2_colors = get_post_meta( $team2_id, 'sp_colors', true ); $team2_colors = get_post_meta($team2_id, 'sp_colors', true);
$team1_color = ! empty( $team1_colors['primary'] ) ? $team1_colors['primary'] : $default_color;
$team2_color = ! empty( $team2_colors['primary'] ) ? $team2_colors['primary'] : $default_color;
// Validate hex colors. $default_color = '#FFFFFF'; // Default color (black)
if ( ! preg_match( '/^#[a-fA-F0-9]{6}$/', $team1_color ) ) { $team1_color = !empty($team1_colors['primary']) ? $team1_colors['primary'] : $default_color;
$team1_color = $default_color; $team2_color = !empty($team2_colors['primary']) ? $team2_colors['primary'] : $default_color;
}
if ( ! preg_match( '/^#[a-fA-F0-9]{6}$/', $team2_color ) ) { // Security check for hex color
$team2_color = $default_color; $team1_color = preg_match('/^#[a-fA-F0-9]{6}$/', $team1_color) ? $team1_color : '#FFFFFF';
$team2_color = preg_match('/^#[a-fA-F0-9]{6}$/', $team2_color) ? $team2_color : '#FFFFFF';
$team1_logo_url = get_the_post_thumbnail_url($team1_id, 'full');
$team2_logo_url = get_the_post_thumbnail_url($team2_id, 'full');
// Check if both team colors are default and both logos are empty
if (($team1_color === $default_color && empty($team1_logo_url)) && ($team2_color === $default_color && empty($team2_logo_url))) {
return; // Do nothing if both teams have no valid color or logo
} }
$team1_logo_url = get_the_post_thumbnail_url( $team1_id, 'full' ); $team1_logo_thumbnail_id = get_post_thumbnail_id($team1_id, 'full');
$team2_logo_url = get_the_post_thumbnail_url( $team2_id, 'full' ); $team2_logo_thumbnail_id = get_post_thumbnail_id($team2_id, 'full');
$team1_logo = get_attached_file($team1_logo_thumbnail_id);
$team2_logo = get_attached_file($team2_logo_thumbnail_id);
// Skip if both teams have no distinguishable color or logo. // Generate the image if no valid cache exists
if ( $team1_color === $default_color && empty( $team1_logo_url ) $image_data = generate_bisected_image($team1_color, $team2_color, $team1_logo, $team2_logo);
&& $team2_color === $default_color && empty( $team2_logo_url ) ) { $image_path = save_image_to_cache($image_data, $cache_key);
return; set_transient($cache_key, $image_path, DAY_IN_SECONDS * 30); // Cache for 30 days
}
$team1_logo = get_attached_file( get_post_thumbnail_id( $team1_id ) ); serve_image($image_path);
$team2_logo = get_attached_file( get_post_thumbnail_id( $team2_id ) );
$image_data = tony_sportspress_generate_bisected_image( $team1_color, $team2_color, $team1_logo, $team2_logo );
$image_path = tony_sportspress_save_image_to_cache( $image_data, $cache_key );
set_transient( $cache_key, $image_path, DAY_IN_SECONDS * 30 );
tony_sportspress_serve_image( $image_path );
exit; exit;
} }
add_action( 'template_redirect', 'tony_sportspress_handle_image_request' ); add_action('template_redirect', 'handle_image_request');
/** function serve_image($image_path) {
* Send a cached PNG image file to the browser. header('Content-Type: image/png');
* if (file_exists($image_path)) {
* @param string $image_path Absolute path to the image file.
* @return void
*/
function tony_sportspress_serve_image( $image_path ) {
header( 'Content-Type: image/png' );
if ( file_exists( $image_path ) ) {
status_header( 200 ); status_header( 200 );
} else { } else {
status_header( 404 ); status_header( 404 );
exit( 'Image not found.' ); die("Image not found.");
} }
while ( ob_get_level() ) { // Clear all output buffering to prevent any extra output
while (ob_get_level()) {
ob_end_clean(); ob_end_clean();
} }
readfile($image_path);
readfile( $image_path ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_readfile
} }
/** function save_image_to_cache($image_data, $cache_key) {
* Write raw image data to the uploads directory and return the file path.
*
* @param string $image_data Raw PNG data.
* @param string $cache_key Cache key used as the filename stem.
* @return string
*/
function tony_sportspress_save_image_to_cache( $image_data, $cache_key ) {
$upload_dir = wp_get_upload_dir(); $upload_dir = wp_get_upload_dir();
$file_path = $upload_dir['path'] . '/' . $cache_key . '.png'; $file_path = $upload_dir['path'] . '/' . $cache_key . '.png';
file_put_contents( $file_path, $image_data ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_file_put_contents // Assuming $image_data is raw image data
file_put_contents($file_path, $image_data);
return $file_path; return $file_path;
} }
/**
* Generate a bisected two-color PNG with optional team logos.
*
* @param string $color1 Hex color for the left half (e.g. #FF0000).
* @param string $color2 Hex color for the right half.
* @param string $logo1_path Absolute path to team 1 PNG logo (or empty).
* @param string $logo2_path Absolute path to team 2 PNG logo (or empty).
* @return string Raw PNG image data.
*/
function tony_sportspress_generate_bisected_image( $color1, $color2, $logo1_path, $logo2_path ) {
$width = 1200;
$height = 628;
$x_margin = 0.1 * ( $width / 2 );
$y_margin = 0.1 * $height;
$image = imagecreatetruecolor( $width, $height );
$rgb1 = sscanf( $color1, '#%02x%02x%02x' );
$rgb2 = sscanf( $color2, '#%02x%02x%02x' );
$color1_alloc = imagecolorallocate( $image, $rgb1[0], $rgb1[1], $rgb1[2] );
$color2_alloc = imagecolorallocate( $image, $rgb2[0], $rgb2[1], $rgb2[2] );
// Left trapezoid.
imagefilledpolygon(
$image,
array( 0, 0, 0, $height, $width * 0.40, $height, $width * 0.60, 0 ),
$color1_alloc
);
// Right trapezoid.
imagefilledpolygon(
$image,
array( $width, 0, $width, $height, $width * 0.40, $height, $width * 0.60, 0 ),
$color2_alloc
);
$max_logo_width = ( $width / 2 ) - ( 2 * $x_margin );
$max_logo_height = $height - ( 2 * $y_margin );
foreach ( array(
array( 'path' => $logo1_path, 'center_x' => $width / 4 ),
array( 'path' => $logo2_path, 'center_x' => 3 * $width / 4 ),
) as $logo ) {
if ( empty( $logo['path'] ) ) {
continue;
}
$src = imagecreatefrompng( $logo['path'] );
if ( ! $src ) {
continue;
}
$src_w = imagesx( $src );
$src_h = imagesy( $src );
$dst_w = $src_w;
$dst_h = $src_h;
if ( $src_w > $max_logo_width || $src_h > $max_logo_height ) {
$ratio = $src_w / $src_h;
if ( $src_w / $max_logo_width > $src_h / $max_logo_height ) {
$dst_w = $max_logo_width;
$dst_h = $max_logo_width / $ratio;
} else {
$dst_h = $max_logo_height;
$dst_w = $max_logo_height * $ratio;
}
}
$dst_x = (int) ( $logo['center_x'] - $dst_w / 2 );
$dst_y = (int) ( $height / 2 - $dst_h / 2 );
imagecopyresampled( $image, $src, $dst_x, $dst_y, 0, 0, (int) $dst_w, (int) $dst_h, $src_w, $src_h );
imagedestroy( $src );
}
ob_start();
imagepng( $image );
$image_data = (string) ob_get_clean();
imagedestroy( $image );
return $image_data;
}

View File

@@ -1,24 +1,13 @@
<?php <?php
/** /*
* Open Graph tags with SportsPress integration. Plugin Name: Custom Open Graph Tags with SportsPress Integration
* Description: Adds custom Open Graph tags to posts based on their type, specifically handling sp_event post types with methods from the SportsPress SP_Event class.
* Adds custom Open Graph meta tags to sp_event single pages. Version: 1.0
* Author: Your Name
* @package Tonys_Sportspress_Enhancements */
*/
if ( ! defined( 'ABSPATH' ) ) { add_action('wp_head', 'custom_open_graph_tags_with_sportspress_integration');
exit;
}
add_action( 'wp_head', 'custom_open_graph_tags_with_sportspress_integration' );
/**
* Return the head-to-head matchup image URL for an event.
*
* @param int|WP_Post $post Post ID or object.
* @return string
*/
function asc_sp_event_matchup_image_url( $post ) { function asc_sp_event_matchup_image_url( $post ) {
if ( is_numeric( $post ) ) { if ( is_numeric( $post ) ) {
$post = get_post( $post ); $post = get_post( $post );
@@ -31,17 +20,11 @@ function asc_sp_event_matchup_image_url( $post ) {
return get_site_url() . '/head-to-head?post=' . $post->ID; return get_site_url() . '/head-to-head?post=' . $post->ID;
} }
/**
* Generate a display title for an sp_event using team short names.
*
* @param int|WP_Post $post Post ID or object.
* @return string
*/
function asc_generate_sp_event_title( $post ) { function asc_generate_sp_event_title( $post ) {
// See https://github.com/ThemeBoy/SportsPress/blob/770fa8c6654d7d6648791e877709c2428677635b/includes/admin/post-types/class-sp-admin-cpt-event.php#L99C40-L99C55
if ( is_numeric( $post ) ) { if ( is_numeric( $post ) ) {
$post = get_post( $post ); $post = get_post( $post );
} }
if ( ! $post || $post->post_type !== 'sp_event' ) { if ( ! $post || $post->post_type !== 'sp_event' ) {
return get_the_title(); return get_the_title();
} }
@@ -70,150 +53,147 @@ function asc_generate_sp_event_title( $post ) {
return implode( $delimiter, $team_names ); return implode( $delimiter, $team_names );
} }
/**
* Format a short date string for an event.
*
* @param int|WP_Post $post Post ID or object.
* @param bool $withTime Whether to include the time.
* @return string
*/
function asc_generate_short_date( $post, $withTime = true ) { function asc_generate_short_date( $post, $withTime = true ) {
$formatted_date = get_the_date( 'D n/j/y', $post ); $formatted_date = get_the_date('D n/j/y', $post);
if ( ! $withTime ) { if (!$withTime){
return $formatted_date; return $formatted_date;
} }
if ( get_the_date( 'i', $post ) === '00' ) { if ( get_the_date('i', $post) == "00") {
$formatted_time = get_the_date( 'gA', $post ); $formatted_time = get_the_date('gA', $post);
} else { } else {
$formatted_time = get_the_date( 'g:iA', $post ); $formatted_time = get_the_date('g:iA', $post);
} }
return $formatted_date . " " . $formatted_time ;
return $formatted_date . ' ' . $formatted_time;
} }
/**
* Output Open Graph meta tags for sp_event single pages.
*
* @return void
*/
function custom_open_graph_tags_with_sportspress_integration() { function custom_open_graph_tags_with_sportspress_integration() {
if ( ! is_single() ) { if (is_single()) {
return;
}
global $post; global $post;
if ($post->post_type === 'sp_event') {
// Instantiate SP_Event object
$event = new SP_Event($post->ID);
if ( ! $post || $post->post_type !== 'sp_event' ) { // Fetch details using SP_Event methods
return; $publish_date = get_the_date('F j, Y', $post);
} $venue_terms = get_the_terms($post->ID, 'sp_venue');
$venue_name = $venue_terms ? $venue_terms[0]->name : 'Venue TBD';
$event = new SP_Event( $post->ID ); $results = $event->results(); // Using SP_Event method
$venue_terms = get_the_terms( $post->ID, 'sp_venue' ); $title = asc_generate_sp_event_title($post);
$venue_name = ( $venue_terms && ! is_wp_error( $venue_terms ) ) ? $venue_terms[0]->name : 'Venue TBD';
$title = asc_generate_sp_event_title( $post );
$sp_status = get_post_meta( $post->ID, 'sp_status', true ); $sp_status = get_post_meta( $post->ID, 'sp_status', true );
$status = $event->status(); $status = $event->status(); // Using SP_Event method
$publish_date_and_time = get_the_date( 'F j, Y g:i A', $post ); $publish_date_and_time = get_the_date('F j, Y g:i A', $post);
$description = "{$publish_date_and_time} at {$venue_name}."; $description = "{$publish_date_and_time} at {$venue_name}.";
if ( in_array( $sp_status, array( 'postponed', 'cancelled', 'tbd' ), true ) ) { if ( 'postponed' == $sp_status || 'cancelled' == $sp_status || 'tbd' == $sp_status) {
$label = strtoupper( $sp_status ); $description = strtoupper($sp_status) . "" . $description;
$description = "{$label}{$description}"; $title = strtoupper($sp_status) . "" . $title . "" . asc_generate_short_date($post) . "" . $venue_name;
$title = "{$label}{$title}" . asc_generate_short_date( $post ) . "{$venue_name}"; }
} elseif ( 'future' === $status ) {
$title = $title . ' — ' . asc_generate_short_date( $post ) . ' — ' . $venue_name; if ( 'future' == $status ) {
} elseif ( 'results' === $status ) { $description = $description;
$title = $title . "" . asc_generate_short_date($post) . "" . $venue_name;
}
if ( 'results' == $status ) { // checks if there is a final score
// Get event result data
$data = $event->results(); $data = $event->results();
// First row is column labels; remove it. // The first row should be column labels
$labels = $data[0];
// Remove the first row to leave us with the actual data
unset( $data[0] ); unset( $data[0] );
$data = array_filter( $data ); $data = array_filter( $data );
if ( ! empty( $data ) ) { if ( empty( $data ) ) {
if ( get_option( 'sportspress_event_reverse_teams', 'no' ) === 'yes' ) { return false;
}
// Initialize
$i = 0;
$result_string = '';
$title_string = '';
// Reverse teams order if the option "Events > Teams > Order > Reverse order" is enabled.
$reverse_teams = get_option( 'sportspress_event_reverse_teams', 'no' ) === 'yes' ? true : false;
if ( $reverse_teams ) {
$data = array_reverse( $data, true ); $data = array_reverse( $data, true );
} }
$teams_result_array = array(); $teams_result_array = [];
foreach ( $data as $team_id => $result ) { foreach ( $data as $team_id => $result ) :
$outcomes = array();
$result_outcome = sp_array_value( $result, 'outcome' ); $result_outcome = sp_array_value( $result, 'outcome' );
$the_outcome = null; if ( ! is_array( $result_outcome ) ) :
$outcomes = array( '&mdash;' );
if ( is_array( $result_outcome ) ) { else :
foreach ( $result_outcome as $outcome_slug ) { foreach ( $result_outcome as $outcome ) :
$found = get_page_by_path( $outcome_slug, OBJECT, 'sp_outcome' ); $the_outcome = get_page_by_path( $outcome, OBJECT, 'sp_outcome' );
if ( is_object( $found ) ) { if ( is_object( $the_outcome ) ) :
$the_outcome = $found; $outcomes[] = $the_outcome->post_title;
break; endif;
} endforeach;
} endif;
}
unset( $result['outcome'] ); unset( $result['outcome'] );
$outcome_title = $the_outcome ? $the_outcome->post_title : ''; $team_name = sp_team_short_name( $team_id );
$outcome_abbreviation = ''; $team_abbreviation = sp_team_abbreviation( $team_id );
if ( $the_outcome ) {
$outcome_abbreviation = get_post_meta( $the_outcome->ID, 'sp_abbreviation', true ); $outcome_abbreviation = get_post_meta( $the_outcome->ID, 'sp_abbreviation', true );
if ( ! $outcome_abbreviation ) { if ( ! $outcome_abbreviation ) {
$outcome_abbreviation = sp_substr( $the_outcome->post_title, 0, 1 ); $outcome_abbreviation = sp_substr( $the_outcome->post_title, 0, 1 );
} }
}
$teams_result_array[] = array( array_push($teams_result_array, [
'result' => $result, "result" => $result,
'outcome' => $outcome_title, "outcome" => $the_outcome->post_title,
'outcome_abbreviation' => $outcome_abbreviation, "outcome_abbreviation" => $outcome_abbreviation,
'team_name' => sp_team_short_name( $team_id ), "team_name" => $team_name,
'team_abbreviation' => sp_team_abbreviation( $team_id ), "team_abbreviation" => $team_abbreviation
]
); );
} $i++;
endforeach;
$publish_date = asc_generate_short_date($post, false);
if ( count( $teams_result_array ) >= 2 ) { $special_result_suffix_abbreviation = '';
$special_abbreviation = ''; $special_result_suffix= '';
$special_label = '';
foreach ( $teams_result_array as $team ) { foreach ( $teams_result_array as $team ) {
$abbr = strtoupper( $team['outcome_abbreviation'] ); $outcome_abbreviation = strtoupper( $team['outcome_abbreviation'] ); // Normalize case
if ( 'TF-W' === $abbr ) { if ( $outcome_abbreviation === 'TF-W' ) {
$special_abbreviation = 'TF-W'; $special_result_suffix_abbreviation = 'TF-W';
$special_label = 'Technical Forfeit Win'; $special_result_suffix = 'Technical Forfeit Win';
break; break;
} elseif ( 'TF-L' === $abbr ) { } elseif ( $outcome_abbreviation === 'TF-L' ) {
$special_abbreviation = 'TF'; $special_result_suffix_abbreviation = 'TF';
$special_label = 'Technical Forfeit'; $special_result_suffix = 'Technical Forfeit';
break; break;
} elseif ( 'F-W' === $abbr || 'F-L' === $abbr ) { } elseif ( $outcome_abbreviation === 'F-W' || $outcome_abbreviation === 'F-L' ) {
$special_abbreviation = 'Forfeit'; $special_result_suffix_abbreviation = 'Forfeit';
$special_label = 'Forfeit'; $special_result_suffix = 'Forfeit';
break; break;
} }
} }
$short_date = asc_generate_short_date( $post, false ); $title = "{$teams_result_array[0]['team_name']} {$teams_result_array[0]['result']['r']}-{$teams_result_array[1]['result']['r']} {$teams_result_array[1]['team_name']}{$publish_date}" . ($special_result_suffix ? "({$special_result_suffix_abbreviation})" : "");
$t0 = $teams_result_array[0]; $description .= " " . "{$teams_result_array[0]['team_name']} ({$teams_result_array[0]['outcome']}), {$teams_result_array[1]['team_name']} ({$teams_result_array[1]['outcome']})." ;
$t1 = $teams_result_array[1];
$score = isset( $t0['result']['r'] ) && isset( $t1['result']['r'] )
? "{$t0['result']['r']}-{$t1['result']['r']}"
: '';
$suffix = $special_label ? " ({$special_abbreviation})" : '';
$title = "{$t0['team_name']} {$score} {$t1['team_name']}{$short_date}{$suffix}";
$description .= " {$t0['team_name']} ({$t0['outcome']}), {$t1['team_name']} ({$t1['outcome']}).";
} }
} $description .= " " . $post->post_content;
}
$description .= ' ' . $post->post_content;
$image = asc_sp_event_matchup_image_url( $post ); $image = asc_sp_event_matchup_image_url( $post );
echo '<meta property="og:type" content="article" />' . "\n"; echo '<meta property="og:type" content="article" />' . "\n";
echo '<meta property="og:image" content="' . esc_url( $image ) . '" />' . "\n"; echo '<meta property="og:image" content="'. $image . '" />' . "\n";
echo '<meta property="og:title" content="' . esc_attr( $title ) . '" />' . "\n"; echo '<meta property="og:title" content="' . $title . '" />' . "\n";
echo '<meta property="og:description" content="' . esc_attr( $description ) . '" />' . "\n"; echo '<meta property="og:description" content="' . $description . '" />' . "\n";
echo '<meta property="og:url" content="' . esc_url( get_permalink() ) . '" />' . "\n"; echo '<meta property="og:url" content="' . get_permalink() . '" />' . "\n";
}
}
} }
?>

View File

@@ -184,9 +184,9 @@ function tse_sp_event_export_normalize_request_args( $source = null ) {
'team_id' => isset( $team_ids[0] ) ? $team_ids[0] : 0, 'team_id' => isset( $team_ids[0] ) ? $team_ids[0] : 0,
'team_ids' => $team_ids, 'team_ids' => $team_ids,
'season_id' => isset( $season_ids[0] ) ? $season_ids[0] : 0, 'season_id' => isset( $season_ids[0] ) ? $season_ids[0] : 0,
'season_ids' => $season_ids, 'season_ids'=> $season_ids,
'league_id' => isset( $league_ids[0] ) ? $league_ids[0] : 0, 'league_id' => isset( $league_ids[0] ) ? $league_ids[0] : 0,
'league_ids' => $league_ids, 'league_ids'=> $league_ids,
'field_id' => isset( $field_ids[0] ) ? $field_ids[0] : 0, 'field_id' => isset( $field_ids[0] ) ? $field_ids[0] : 0,
'field_ids' => $field_ids, 'field_ids' => $field_ids,
'format' => $format, 'format' => $format,

View File

@@ -1,19 +1,16 @@
<?php <?php
/** /*
* Custom permalink structure for sp_event post type. Plugin Name: Custom Event Permalinks
* Description: Adds a custom permalink structure for the sp_event post type.
* @package Tonys_Sportspress_Enhancements Version: 1.0
*/ Author: Your Name
*/
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
exit; exit; // Exit if accessed directly
} }
/** // Register custom rewrite rules
* Register custom rewrite rules for sp_event.
*
* @return void
*/
function custom_event_rewrite_rules() { function custom_event_rewrite_rules() {
add_rewrite_rule( add_rewrite_rule(
'(?:event|game)/.*?[/]?([0-9]+)[/]?$', '(?:event|game)/.*?[/]?([0-9]+)[/]?$',
@@ -21,73 +18,64 @@ function custom_event_rewrite_rules() {
'top' 'top'
); );
} }
add_action( 'init', 'custom_event_rewrite_rules' ); add_action('init', 'custom_event_rewrite_rules');
/** // Customize the permalink structure
* Customize the permalink structure for sp_event posts. function custom_event_permalink($permalink, $post) {
* if ($post->post_type !== 'sp_event') {
* @param string $permalink Existing permalink.
* @param WP_Post $post Post object.
* @return string
*/
function custom_event_permalink( $permalink, $post ) {
if ( $post->post_type !== 'sp_event' ) {
return $permalink; return $permalink;
} }
$teams = get_post_meta( $post->ID, 'sp_team', false ); $event = new SP_Event($post->ID);
$format = get_post_meta( $post->ID, 'sp_format', true ); $teams = get_post_meta($post->ID,'sp_team', false);
sort( $teams ); $format = get_post_meta($post->ID,'sp_format', true);
$seasons = get_the_terms( $post->ID, 'sp_season', true ); sort($teams);
$seasons = get_the_terms($post->ID, 'sp_season', true );
if ( $seasons ) { if ($seasons) {
$seasons_slug = implode( $seasons_slug = implode(
'-', "-",
array_map( function( $season ) { return $season->slug; }, $seasons ) array_map(function($season){return $season->slug;},$seasons),
); );
} else { } else {
$seasons_slug = 'no-season'; $seasons_slug = "no-season";
} };
$team_1 = isset( $teams[0] ) ? get_post( $teams[0] ) : null; // Get the teams associated with the event
$team_2 = isset( $teams[1] ) ? get_post( $teams[1] ) : null; $team_1 = get_post($teams[0]);
$team_2 = get_post($teams[1]);
switch ( $format ) { switch ($format) {
case 'league': case 'league':
$format_string = 'game';
break;
case 'tournament': case 'tournament':
$format_string = 'game'; $format_string = 'game';
break; break;
case 'friendly':
$format_string = 'event';
break;
default: default:
$format_string = 'event'; $format_string = 'event';
break; break;
} }
if ( $team_1 && $team_2 ) { if ($team_1 && $team_2) {
$permalink = home_url( $format_string . '/' . $seasons_slug . '/' . $team_1->post_name . '-' . $team_2->post_name . '/' . $post->ID ); $permalink = home_url($format_string ."/". $seasons_slug . '/' . $team_1->post_name . '-' . $team_2->post_name . '/' . $post->ID);
} }
return $permalink; return $permalink;
} }
add_filter( 'post_type_link', 'custom_event_permalink', 10, 2 ); add_filter('post_type_link', 'custom_event_permalink', 10, 2);
/** // Flush rewrite rules on activation and deactivation
* Flush rewrite rules on activation.
*
* @return void
*/
function custom_event_rewrite_flush() { function custom_event_rewrite_flush() {
custom_event_rewrite_rules(); custom_event_rewrite_rules();
flush_rewrite_rules(); flush_rewrite_rules();
} }
register_activation_hook( __FILE__, 'custom_event_rewrite_flush' ); register_activation_hook(__FILE__, 'custom_event_rewrite_flush');
register_deactivation_hook( __FILE__, 'flush_rewrite_rules' ); register_deactivation_hook(__FILE__, 'flush_rewrite_rules');
/** // Modify the front-end single event query to allow scheduled events to resolve.
* Allow scheduled events to resolve on the frontend.
*
* @param WP_Query $query Current query.
* @return void
*/
function custom_event_parse_request( $query ) { function custom_event_parse_request( $query ) {
if ( ! $query instanceof WP_Query ) { if ( ! $query instanceof WP_Query ) {
return; return;
@@ -110,4 +98,4 @@ function custom_event_parse_request( $query ) {
$query->set( 'p', $post_id ); $query->set( 'p', $post_id );
$query->set( 'post_status', array( 'publish', 'future' ) ); $query->set( 'post_status', array( 'publish', 'future' ) );
} }
add_action( 'pre_get_posts', 'custom_event_parse_request' ); add_action('pre_get_posts', 'custom_event_parse_request');

View File

@@ -83,11 +83,7 @@ if ( ! class_exists( 'Tony_Sportspress_GitHub_Updater' ) ) {
$remote_version = $this->normalize_version( $release['version'] ); $remote_version = $this->normalize_version( $release['version'] );
$current_version = $this->normalize_version( TONY_SPORTSPRESS_ENHANCEMENTS_VERSION ); $current_version = $this->normalize_version( TONY_SPORTSPRESS_ENHANCEMENTS_VERSION );
if ( version_compare( $remote_version, $current_version, '<=' ) ) { $plugin_data = (object) array(
return $transient;
}
$transient->response[ $this->plugin_basename ] = (object) array(
'id' => $release['url'], 'id' => $release['url'],
'slug' => $this->plugin_slug, 'slug' => $this->plugin_slug,
'plugin' => $this->plugin_basename, 'plugin' => $this->plugin_basename,
@@ -102,6 +98,16 @@ if ( ! class_exists( 'Tony_Sportspress_GitHub_Updater' ) ) {
'translations' => array(), 'translations' => array(),
); );
if ( version_compare( $remote_version, $current_version, '<=' ) ) {
unset( $transient->response[ $this->plugin_basename ] );
$transient->no_update[ $this->plugin_basename ] = $plugin_data;
return $transient;
}
unset( $transient->no_update[ $this->plugin_basename ] );
$transient->response[ $this->plugin_basename ] = $plugin_data;
return $transient; return $transient;
} }

View File

@@ -160,8 +160,6 @@ function tse_sp_url_builder_render_script() {
} }
var baseUrl = <?php echo wp_json_encode( $base_url ); ?>; var baseUrl = <?php echo wp_json_encode( $base_url ); ?>;
var labelOpenIcs = <?php echo wp_json_encode( __( 'Open ICS Feed', 'tonys-sportspress-enhancements' ) ); ?>;
var labelOpenCsv = <?php echo wp_json_encode( __( 'Open Feed URL', 'tonys-sportspress-enhancements' ) ); ?>;
var feedType = root.querySelector('#tse-url-builder-feed-type'); var feedType = root.querySelector('#tse-url-builder-feed-type');
var format = root.querySelector('#tse-url-builder-format'); var format = root.querySelector('#tse-url-builder-format');
var output = root.querySelector('#tse-url-builder-output'); var output = root.querySelector('#tse-url-builder-output');
@@ -225,7 +223,7 @@ function tse_sp_url_builder_render_script() {
output.value = url.toString(); output.value = url.toString();
openLink.href = url.toString(); openLink.href = url.toString();
openLink.textContent = selectedFeedType === 'ics' ? labelOpenIcs : labelOpenCsv; openLink.textContent = selectedFeedType === 'ics' ? 'Open ICS Feed' : 'Open Feed URL';
} }
syncColumnGroups(); syncColumnGroups();

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,7 @@
{ {
"name": "tonys-sportspress-enhancements", "name": "tonys-sportspress-enhancements",
"version": "0.1.5", "version": "0.1.11",
"main": "Gruntfile.js", "main": "Gruntfile.js",
"author": "YOUR NAME HERE", "author": "YOUR NAME HERE",
"scripts" : { "scripts" : {

View File

@@ -39,6 +39,331 @@ class Test_SP_Webhooks extends WP_UnitTestCase {
$this->assertStringContainsString( '"id":55', $rendered ); $this->assertStringContainsString( '"id":55', $rendered );
} }
/**
* Venue aliases and split schedule fields should render from the context.
*/
public function test_render_template_supports_field_alias_and_schedule_parts() {
$webhooks = Tony_Sportspress_Webhooks::instance();
$template = 'Field={{ event.field.short_name }} Venue={{ event.venue.abbreviation }} Time={{ event.scheduled.time }} {{ event.scheduled.timezone }}';
$context = array(
'event' => array(
'field' => array(
'short_name' => 'North',
),
'venue' => array(
'abbreviation' => 'NF',
),
'scheduled' => array(
'time' => '7:30 PM',
'timezone' => 'CDT',
),
),
);
$rendered = $webhooks->render_template( $template, $context );
$this->assertSame( 'Field=North Venue=NF Time=7:30 PM CDT', $rendered );
}
/**
* Event context should expose home and away team aliases.
*/
public function test_render_template_supports_event_team_aliases() {
$webhooks = Tony_Sportspress_Webhooks::instance();
$template = 'Home={{ event.home_team.name }} Away={{ event.away_team.name }}';
$context = array(
'event' => array(
'home_team' => array(
'name' => 'Home Team',
),
'away_team' => array(
'name' => 'Away Team',
),
),
);
$rendered = $webhooks->render_template( $template, $context );
$this->assertSame( 'Home=Home Team Away=Away Team', $rendered );
}
/**
* Event context should expose the current SportsPress schedule status.
*/
public function test_render_template_supports_event_status_alias() {
$webhooks = Tony_Sportspress_Webhooks::instance();
$template = 'Status={{ event.status }}';
$context = array(
'event' => array(
'status' => 'Postponed',
),
);
$rendered = $webhooks->render_template( $template, $context );
$this->assertSame( 'Status=Postponed', $rendered );
}
/**
* Date filter should accept PHP date format strings for schedule values.
*/
public function test_render_template_supports_date_filter() {
$webhooks = Tony_Sportspress_Webhooks::instance();
$template = 'Time={{ event.scheduled.timestamp|date("g:i A") }} ISO={{ event.scheduled.local_iso|date("m/d g:i A") }}';
$context = array(
'event' => array(
'scheduled' => array(
'timestamp' => 1714005000,
'local_iso' => '2024-04-24T19:30:00-05:00',
),
),
);
$rendered = $webhooks->render_template( $template, $context );
$this->assertSame( 'Time=7:30 PM ISO=04/24 7:30 PM', $rendered );
}
/**
* Change notifications should expose before and after venue/time values.
*/
public function test_render_template_supports_before_after_venue_and_time() {
$webhooks = Tony_Sportspress_Webhooks::instance();
$template = 'Venue {{ changes.previous.venue.name }} -> {{ changes.current.venue.name }} Time {{ changes.previous.time }} -> {{ changes.current.time }}';
$context = array(
'changes' => array(
'previous' => array(
'time' => '6:00 PM',
'venue' => array(
'name' => 'North Field',
),
),
'current' => array(
'time' => '7:30 PM',
'venue' => array(
'name' => 'South Field',
),
),
),
);
$rendered = $webhooks->render_template( $template, $context );
$this->assertSame( 'Venue North Field -> South Field Time 6:00 PM -> 7:30 PM', $rendered );
}
/**
* Change notifications should expose before and after home/away team values.
*/
public function test_render_template_supports_before_after_teams() {
$webhooks = Tony_Sportspress_Webhooks::instance();
$template = 'Home {{ changes.previous.home_team.name }} -> {{ changes.current.home_team.name }} Away {{ changes.previous.away_team.name }} -> {{ changes.current.away_team.name }}';
$context = array(
'changes' => array(
'previous' => array(
'home_team' => array(
'name' => 'Old Home',
),
'away_team' => array(
'name' => 'Old Away',
),
),
'current' => array(
'home_team' => array(
'name' => 'New Home',
),
'away_team' => array(
'name' => 'New Away',
),
),
),
);
$rendered = $webhooks->render_template( $template, $context );
$this->assertSame( 'Home Old Home -> New Home Away Old Away -> New Away', $rendered );
}
/**
* Change notifications should expose before and after status values.
*/
public function test_render_template_supports_before_after_status() {
$webhooks = Tony_Sportspress_Webhooks::instance();
$template = 'Status {{ changes.previous.status }} -> {{ changes.current.status }}';
$context = array(
'changes' => array(
'previous' => array(
'status' => 'On time',
),
'current' => array(
'status' => 'Postponed',
),
),
);
$rendered = $webhooks->render_template( $template, $context );
$this->assertSame( 'Status On time -> Postponed', $rendered );
}
/**
* Schedule snapshots should treat status changes as meaningful changes.
*/
public function test_schedule_snapshot_signature_changes_when_status_changes() {
$webhooks = Tony_Sportspress_Webhooks::instance();
$method = new ReflectionMethod( $webhooks, 'schedule_snapshots_match' );
$method->setAccessible( true );
$left = array(
'local_iso' => '2026-05-02T10:30:00-05:00',
'gmt_iso' => '2026-05-02T15:30:00+00:00',
'status' => 'On time',
'venue' => array(
'name' => 'Winnemac Park',
),
'teams' => array(
array( 'name' => 'Hawks' ),
array( 'name' => 'Electrons' ),
),
);
$right = $left;
$right['status'] = 'Canceled';
$this->assertFalse( $method->invoke( $webhooks, $left, $right ) );
}
/**
* Status snapshots should expose a display label and keep the raw SportsPress key.
*/
public function test_build_change_snapshot_normalizes_status_label_and_slug() {
$webhooks = Tony_Sportspress_Webhooks::instance();
$method = new ReflectionMethod( $webhooks, 'build_change_snapshot' );
$method->setAccessible( true );
$snapshot = $method->invoke( $webhooks, array(), array(), array(), 'cancelled' );
$this->assertSame( 'Canceled', $snapshot['status'] );
$this->assertSame( 'cancelled', $snapshot['sp_status'] );
}
/**
* Conditionals should support simple comparisons and else branches.
*/
public function test_render_template_supports_conditionals() {
$webhooks = Tony_Sportspress_Webhooks::instance();
$template = "{% if changes.previous.time != changes.current.time %}Time changed: {{ changes.previous.time }} -> {{ changes.current.time }}\n{% endif %}{% if changes.previous.field.name == changes.current.field.name %}Field unchanged{% else %}Field changed: {{ changes.previous.field.name }} -> {{ changes.current.field.name }}{% endif %}";
$context = array(
'changes' => array(
'previous' => array(
'time' => '6:00 PM',
'field' => array(
'name' => 'North Field',
),
),
'current' => array(
'time' => '7:30 PM',
'field' => array(
'name' => 'South Field',
),
),
),
);
$rendered = $webhooks->render_template( $template, $context );
$this->assertSame( "Time changed: 6:00 PM -> 7:30 PM\nField changed: North Field -> South Field", $rendered );
}
/**
* Truthy conditionals should render when the referenced value exists.
*/
public function test_render_template_supports_truthy_conditionals() {
$webhooks = Tony_Sportspress_Webhooks::instance();
$template = '{% if changes.current.home_team.name %}Home: {{ changes.current.home_team.name }}{% endif %}';
$context = array(
'changes' => array(
'current' => array(
'home_team' => array(
'name' => 'Home Team',
),
),
),
);
$rendered = $webhooks->render_template( $template, $context );
$this->assertSame( 'Home: Home Team', $rendered );
}
/**
* Team change conditionals should stay false when only schedule fields changed.
*/
public function test_team_conditionals_do_not_fire_for_schedule_only_changes() {
$webhooks = Tony_Sportspress_Webhooks::instance();
$template = '{% if changes.previous.away_team.name != changes.current.away_team.name %}Away changed{% else %}Away unchanged{% endif %}';
$context = array(
'changes' => array(
'previous' => array(
'time' => '6:00 PM',
'away_team' => array(
'name' => 'Away Team',
),
),
'current' => array(
'time' => '7:30 PM',
'away_team' => array(
'name' => 'Away Team',
),
),
),
);
$rendered = $webhooks->render_template( $template, $context );
$this->assertSame( 'Away unchanged', $rendered );
}
/**
* Conditionals should support simple or expressions with else branches.
*/
public function test_render_template_supports_or_conditionals() {
$webhooks = Tony_Sportspress_Webhooks::instance();
$template = '{% if event.status == "Postponed" or event.status == "Canceled" %}Delayed{% else %}Normal{% endif %}';
$context = array(
'event' => array(
'status' => 'Canceled',
),
);
$rendered = $webhooks->render_template( $template, $context );
$this->assertSame( 'Delayed', $rendered );
}
/**
* Test webhook AJAX should honor the submitted row index.
*/
public function test_get_submitted_test_webhook_row_uses_matching_index() {
$webhooks = Tony_Sportspress_Webhooks::instance();
$method = new ReflectionMethod( $webhooks, 'get_submitted_test_webhook_row' );
$method->setAccessible( true );
$result = $method->invoke(
$webhooks,
array(
'2' => array(
'name' => 'Second Row',
),
),
array(
'2' => '123',
)
);
$this->assertSame( 'Second Row', $result['row']['name'] );
$this->assertSame( 123, $result['event_id'] );
}
/** /**
* Sanitization should keep only complete provider-specific webhook rows. * Sanitization should keep only complete provider-specific webhook rows.
*/ */

View File

@@ -8,13 +8,13 @@
* Text Domain: tonys-sportspress-enhancements * Text Domain: tonys-sportspress-enhancements
* Domain Path: /languages * Domain Path: /languages
* Update URI: https://github.com/anthonyscorrea/tonys-sportspress-enhancements * Update URI: https://github.com/anthonyscorrea/tonys-sportspress-enhancements
* Version: 0.1.9 * Version: 0.1.11
* *
* @package Tonys_Sportspress_Enhancements * @package Tonys_Sportspress_Enhancements
*/ */
if ( ! defined( 'TONY_SPORTSPRESS_ENHANCEMENTS_VERSION' ) ) { if ( ! defined( 'TONY_SPORTSPRESS_ENHANCEMENTS_VERSION' ) ) {
define( 'TONY_SPORTSPRESS_ENHANCEMENTS_VERSION', '0.1.9' ); define( 'TONY_SPORTSPRESS_ENHANCEMENTS_VERSION', '0.1.11' );
} }
if ( ! defined( 'TONY_SPORTSPRESS_ENHANCEMENTS_FILE' ) ) { if ( ! defined( 'TONY_SPORTSPRESS_ENHANCEMENTS_FILE' ) ) {
@@ -33,20 +33,21 @@ if ( ! defined( 'TONY_SPORTSPRESS_ENHANCEMENTS_PLUGIN_BASENAME' ) ) {
define( 'TONY_SPORTSPRESS_ENHANCEMENTS_PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); define( 'TONY_SPORTSPRESS_ENHANCEMENTS_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
} }
require_once TONY_SPORTSPRESS_ENHANCEMENTS_DIR . 'includes/sp-github-updater.php'; // Include other files here
require_once TONY_SPORTSPRESS_ENHANCEMENTS_DIR . 'includes/sp-officials-manager-role.php'; require_once plugin_dir_path(__FILE__) . 'includes/sp-github-updater.php';
require_once TONY_SPORTSPRESS_ENHANCEMENTS_DIR . 'includes/open-graph-tags.php'; require_once plugin_dir_path(__FILE__) . 'includes/sp-officials-manager-role.php';
require_once TONY_SPORTSPRESS_ENHANCEMENTS_DIR . 'includes/featured-image-generator.php'; require_once plugin_dir_path(__FILE__) . 'includes/open-graph-tags.php';
require_once TONY_SPORTSPRESS_ENHANCEMENTS_DIR . 'includes/sp-event-permalink.php'; require_once plugin_dir_path(__FILE__) . 'includes/featured-image-generator.php';
require_once TONY_SPORTSPRESS_ENHANCEMENTS_DIR . 'includes/sp-event-export.php'; require_once plugin_dir_path(__FILE__) . 'includes/sp-event-permalink.php';
require_once TONY_SPORTSPRESS_ENHANCEMENTS_DIR . 'includes/sp-event-csv.php'; require_once plugin_dir_path(__FILE__) . 'includes/sp-event-export.php';
require_once TONY_SPORTSPRESS_ENHANCEMENTS_DIR . 'includes/sp-event-admin-week-filter.php'; require_once plugin_dir_path(__FILE__) . 'includes/sp-event-csv.php';
require_once TONY_SPORTSPRESS_ENHANCEMENTS_DIR . 'includes/sp-event-quick-edit-officials.php'; require_once plugin_dir_path(__FILE__) . 'includes/sp-event-admin-week-filter.php';
require_once TONY_SPORTSPRESS_ENHANCEMENTS_DIR . 'includes/sp-event-team-ordering.php'; require_once plugin_dir_path(__FILE__) . 'includes/sp-event-quick-edit-officials.php';
require_once TONY_SPORTSPRESS_ENHANCEMENTS_DIR . 'includes/sp-printable-calendars.php'; require_once plugin_dir_path(__FILE__) . 'includes/sp-event-team-ordering.php';
require_once TONY_SPORTSPRESS_ENHANCEMENTS_DIR . 'includes/sp-url-builder.php'; require_once plugin_dir_path(__FILE__) . 'includes/sp-printable-calendars.php';
require_once TONY_SPORTSPRESS_ENHANCEMENTS_DIR . 'includes/sp-webhooks.php'; require_once plugin_dir_path(__FILE__) . 'includes/sp-url-builder.php';
require_once TONY_SPORTSPRESS_ENHANCEMENTS_DIR . 'includes/sp-schedule-exporter.php'; require_once plugin_dir_path(__FILE__) . 'includes/sp-webhooks.php';
require_once TONY_SPORTSPRESS_ENHANCEMENTS_DIR . 'includes/sp-venue-meta.php'; require_once plugin_dir_path(__FILE__) . 'includes/sp-schedule-exporter.php';
require_once plugin_dir_path(__FILE__) . 'includes/sp-venue-meta.php';
register_activation_hook( __FILE__, 'tony_sportspress_sync_officials_manager_roles' ); register_activation_hook( __FILE__, 'tony_sportspress_sync_officials_manager_roles' );