Use TONY_SPORTSPRESS_ENHANCEMENTS_DIR constant in requires; localize JS strings

- Replace repeated plugin_dir_path(__FILE__) calls with the already-defined
  TONY_SPORTSPRESS_ENHANCEMENTS_DIR constant
- Localize 'Open ICS Feed' and 'Open Feed URL' JS strings in sp-url-builder.php
  via wp_json_encode() so they pass through the translation system

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-06 08:41:07 -05:00
parent 7fc040d87a
commit 69faa9a17e
2 changed files with 18 additions and 17 deletions

View File

@@ -160,6 +160,8 @@ function tse_sp_url_builder_render_script() {
}
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 format = root.querySelector('#tse-url-builder-format');
var output = root.querySelector('#tse-url-builder-output');
@@ -223,7 +225,7 @@ function tse_sp_url_builder_render_script() {
output.value = url.toString();
openLink.href = url.toString();
openLink.textContent = selectedFeedType === 'ics' ? 'Open ICS Feed' : 'Open Feed URL';
openLink.textContent = selectedFeedType === 'ics' ? labelOpenIcs : labelOpenCsv;
}
syncColumnGroups();

View File

@@ -33,21 +33,20 @@ if ( ! defined( 'TONY_SPORTSPRESS_ENHANCEMENTS_PLUGIN_BASENAME' ) ) {
define( 'TONY_SPORTSPRESS_ENHANCEMENTS_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
}
// Include other files here
require_once plugin_dir_path(__FILE__) . 'includes/sp-github-updater.php';
require_once plugin_dir_path(__FILE__) . 'includes/sp-officials-manager-role.php';
require_once plugin_dir_path(__FILE__) . 'includes/open-graph-tags.php';
require_once plugin_dir_path(__FILE__) . 'includes/featured-image-generator.php';
require_once plugin_dir_path(__FILE__) . 'includes/sp-event-permalink.php';
require_once plugin_dir_path(__FILE__) . 'includes/sp-event-export.php';
require_once plugin_dir_path(__FILE__) . 'includes/sp-event-csv.php';
require_once plugin_dir_path(__FILE__) . 'includes/sp-event-admin-week-filter.php';
require_once plugin_dir_path(__FILE__) . 'includes/sp-event-quick-edit-officials.php';
require_once plugin_dir_path(__FILE__) . 'includes/sp-event-team-ordering.php';
require_once plugin_dir_path(__FILE__) . 'includes/sp-printable-calendars.php';
require_once plugin_dir_path(__FILE__) . 'includes/sp-url-builder.php';
require_once plugin_dir_path(__FILE__) . 'includes/sp-webhooks.php';
require_once plugin_dir_path(__FILE__) . 'includes/sp-schedule-exporter.php';
require_once plugin_dir_path(__FILE__) . 'includes/sp-venue-meta.php';
require_once TONY_SPORTSPRESS_ENHANCEMENTS_DIR . 'includes/sp-github-updater.php';
require_once TONY_SPORTSPRESS_ENHANCEMENTS_DIR . 'includes/sp-officials-manager-role.php';
require_once TONY_SPORTSPRESS_ENHANCEMENTS_DIR . 'includes/open-graph-tags.php';
require_once TONY_SPORTSPRESS_ENHANCEMENTS_DIR . 'includes/featured-image-generator.php';
require_once TONY_SPORTSPRESS_ENHANCEMENTS_DIR . 'includes/sp-event-permalink.php';
require_once TONY_SPORTSPRESS_ENHANCEMENTS_DIR . 'includes/sp-event-export.php';
require_once TONY_SPORTSPRESS_ENHANCEMENTS_DIR . 'includes/sp-event-csv.php';
require_once TONY_SPORTSPRESS_ENHANCEMENTS_DIR . 'includes/sp-event-admin-week-filter.php';
require_once TONY_SPORTSPRESS_ENHANCEMENTS_DIR . 'includes/sp-event-quick-edit-officials.php';
require_once TONY_SPORTSPRESS_ENHANCEMENTS_DIR . 'includes/sp-event-team-ordering.php';
require_once TONY_SPORTSPRESS_ENHANCEMENTS_DIR . 'includes/sp-printable-calendars.php';
require_once TONY_SPORTSPRESS_ENHANCEMENTS_DIR . 'includes/sp-url-builder.php';
require_once TONY_SPORTSPRESS_ENHANCEMENTS_DIR . 'includes/sp-webhooks.php';
require_once TONY_SPORTSPRESS_ENHANCEMENTS_DIR . 'includes/sp-schedule-exporter.php';
require_once TONY_SPORTSPRESS_ENHANCEMENTS_DIR . 'includes/sp-venue-meta.php';
register_activation_hook( __FILE__, 'tony_sportspress_sync_officials_manager_roles' );