From 335030a9901ec0253439abbee8548163baa8af23 Mon Sep 17 00:00:00 2001 From: Brian Miyaji Date: Mon, 5 Oct 2015 12:26:45 +1100 Subject: [PATCH] Strip tags from post title in importers --- includes/admin/importers/class-sp-event-importer.php | 6 +++--- includes/admin/importers/class-sp-player-importer.php | 4 ++-- includes/admin/importers/class-sp-staff-importer.php | 4 ++-- includes/admin/importers/class-sp-team-importer.php | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/includes/admin/importers/class-sp-event-importer.php b/includes/admin/importers/class-sp-event-importer.php index fa1be89f..1f09298a 100644 --- a/includes/admin/importers/class-sp-event-importer.php +++ b/includes/admin/importers/class-sp-event-importer.php @@ -204,7 +204,7 @@ if ( class_exists( 'WP_Importer' ) ) { else: // Insert team - $team_id = wp_insert_post( array( 'post_type' => 'sp_team', 'post_status' => 'publish', 'post_title' => $team_name ) ); + $team_id = wp_insert_post( array( 'post_type' => 'sp_team', 'post_status' => 'publish', 'post_title' => wp_strip_all_tags( $team_name ) ) ); // Flag as import update_post_meta( $team_id, '_sp_import', 1 ); @@ -272,7 +272,7 @@ if ( class_exists( 'WP_Importer' ) ) { else: // Insert outcome - $outcome_id = wp_insert_post( array( 'post_type' => 'sp_outcome', 'post_status' => 'publish', 'post_title' => $outcome ) ); + $outcome_id = wp_insert_post( array( 'post_type' => 'sp_outcome', 'post_status' => 'publish', 'post_title' => wp_strip_all_tags( $outcome ) ) ); // Get outcome slug $post_data = get_post( $outcome_id, ARRAY_A ); @@ -351,7 +351,7 @@ if ( class_exists( 'WP_Importer' ) ) { else: // Insert player - $player_id = wp_insert_post( array( 'post_type' => 'sp_player', 'post_status' => 'publish', 'post_title' => $player_name ) ); + $player_id = wp_insert_post( array( 'post_type' => 'sp_player', 'post_status' => 'publish', 'post_title' => wp_strip_all_tags( $player_name ) ) ); // Flag as import update_post_meta( $player_id, '_sp_import', 1 ); diff --git a/includes/admin/importers/class-sp-player-importer.php b/includes/admin/importers/class-sp-player-importer.php index 862ae5a3..685cd0d2 100644 --- a/includes/admin/importers/class-sp-player-importer.php +++ b/includes/admin/importers/class-sp-player-importer.php @@ -71,7 +71,7 @@ if ( class_exists( 'WP_Importer' ) ) { continue; endif; - $args = array( 'post_type' => 'sp_player', 'post_status' => 'publish', 'post_title' => $name ); + $args = array( 'post_type' => 'sp_player', 'post_status' => 'publish', 'post_title' => wp_strip_all_tags( $name ) ); $id = wp_insert_post( $args ); @@ -105,7 +105,7 @@ if ( class_exists( 'WP_Importer' ) ) { endif; $team_id = $team_object->ID; else: - $team_id = wp_insert_post( array( 'post_type' => 'sp_team', 'post_status' => 'publish', 'post_title' => $team ) ); + $team_id = wp_insert_post( array( 'post_type' => 'sp_team', 'post_status' => 'publish', 'post_title' => wp_strip_all_tags( $team ) ) ); // Flag as import update_post_meta( $team_id, '_sp_import', 1 ); wp_set_object_terms( $team_id, $leagues, 'sp_league', false ); diff --git a/includes/admin/importers/class-sp-staff-importer.php b/includes/admin/importers/class-sp-staff-importer.php index 386aa313..5e5f53f7 100644 --- a/includes/admin/importers/class-sp-staff-importer.php +++ b/includes/admin/importers/class-sp-staff-importer.php @@ -70,7 +70,7 @@ if ( class_exists( 'WP_Importer' ) ) { continue; endif; - $args = array( 'post_type' => 'sp_staff', 'post_status' => 'publish', 'post_title' => $name ); + $args = array( 'post_type' => 'sp_staff', 'post_status' => 'publish', 'post_title' => wp_strip_all_tags( $name ) ); $id = wp_insert_post( $args ); @@ -101,7 +101,7 @@ if ( class_exists( 'WP_Importer' ) ) { endif; $team_id = $team_object->ID; else: - $team_id = wp_insert_post( array( 'post_type' => 'sp_team', 'post_status' => 'publish', 'post_title' => $team ) ); + $team_id = wp_insert_post( array( 'post_type' => 'sp_team', 'post_status' => 'publish', 'post_title' => wp_strip_all_tags( $team ) ) ); // Flag as import update_post_meta( $team_id, '_sp_import', 1 ); wp_set_object_terms( $team_id, $leagues, 'sp_league', false ); diff --git a/includes/admin/importers/class-sp-team-importer.php b/includes/admin/importers/class-sp-team-importer.php index 5100c3d6..e6d93d09 100644 --- a/includes/admin/importers/class-sp-team-importer.php +++ b/includes/admin/importers/class-sp-team-importer.php @@ -70,7 +70,7 @@ if ( class_exists( 'WP_Importer' ) ) { continue; endif; - $args = array( 'post_type' => 'sp_team', 'post_status' => 'publish', 'post_title' => $name ); + $args = array( 'post_type' => 'sp_team', 'post_status' => 'publish', 'post_title' => wp_strip_all_tags( $name ) ); $id = wp_insert_post( $args );