Skip to content

Commit

Permalink
More replacing strip_tags
Browse files Browse the repository at this point in the history
  • Loading branch information
joedolson committed Jan 6, 2025
1 parent fae742b commit e2c2291
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions src/my-calendar-categories.php
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ function mc_update_cat( $category ) {
$where = array(
'category_id' => $category_id,
);
$cat_name = strip_tags( $category['category_name'] );
$cat_name = wp_strip_all_tags( $category['category_name'] );
$term_exists = term_exists( $cat_name, 'mc-event-category' );
if ( ! $term_exists ) {
$term = wp_insert_term( $cat_name, 'mc-event-category' );
Expand Down Expand Up @@ -354,7 +354,7 @@ function mc_create_category( $category ) {
return false;
}
$formats = array( '%s', '%s', '%s', '%d', '%d' );
$cat_name = strip_tags( $category['category_name'] );
$cat_name = wp_strip_all_tags( $category['category_name'] );
$term_exists = term_exists( $cat_name, 'mc-event-category' );
if ( ! $term_exists ) {
$term = wp_insert_term( $cat_name, 'mc-event-category' );
Expand Down Expand Up @@ -481,7 +481,7 @@ function mc_edit_category_form( $view = 'edit', $cat_id = false ) {
$color = '';
$icon = '';
}
$color = strip_tags( $color );
$color = wp_strip_all_tags( $color );
if ( ! empty( $cur_cat ) && is_object( $cur_cat ) ) {
$cat_name = stripslashes( $cur_cat->category_name );
} else {
Expand Down Expand Up @@ -1112,7 +1112,7 @@ function mc_category_select( $data = false, $option = true, $multiple = false, $
$selected = ( null === $data ) ? '' : ' checked="checked"';
}
}
$category_name = strip_tags( stripslashes( trim( $cat->category_name ) ) );
$category_name = wp_strip_all_tags( stripslashes( trim( $cat->category_name ) ) );
$category_name = ( '' === $category_name ) ? '(' . __( 'Untitled category', 'my-calendar' ) . ')' : $category_name;
if ( $multiple ) {
$icon = '<span style="display:inline-block;max-width:1em;margin-left:6px;vertical-align:middle;">' . mc_category_icon( $cat ) . '</span>';
Expand Down
2 changes: 1 addition & 1 deletion src/my-calendar-group-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -903,7 +903,7 @@ function mc_list_groups() {
}
}
echo wp_kses_post( $spam_label );
echo '<span id="event_' . esc_attr( $event->event_id ) . '">' . esc_html( strip_tags( wp_unslash( $title ) ) ) . '</span>';
echo '<span id="event_' . esc_attr( $event->event_id ) . '">' . esc_html( wp_strip_all_tags( wp_unslash( $title ) ) ) . '</span>';
if ( $can_edit && $edit_link ) {
echo '</a>';
}
Expand Down
10 changes: 5 additions & 5 deletions src/my-calendar-output.php
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ function mc_draw_event_header( $data, $type, $template ) {
$hlevel = apply_filters( 'mc_heading_level_table', $hlevel, $type, $time, $template );
// Set up .summary - required once per page for structured data. Should only be added in cases where heading & anchor are removed.
if ( 'single' === $type ) {
$title = ( ! is_singular( 'mc-events' ) ) ? " <h2 class='event-title summary'>$image<div>$event_title</div></h2>\n" : ' <span class="summary screen-reader-text">' . strip_tags( $event_title ) . '</span>';
$title = ( ! is_singular( 'mc-events' ) ) ? " <h2 class='event-title summary'>$image<div>$event_title</div></h2>\n" : ' <span class="summary screen-reader-text">' . wp_strip_all_tags( $event_title ) . '</span>';
} elseif ( 'list' !== $type || ( 'list' === $type && 'true' === mc_get_option( 'list_link_titles' ) ) ) {
/**
* Filter event title inside event heading.
Expand All @@ -500,7 +500,7 @@ function mc_draw_event_header( $data, $type, $template ) {
} else {
$title = '';
}
$header .= ( false === stripos( $title, 'summary' ) ) ? ' <span class="summary screen-reader-text">' . strip_tags( $event_title ) . '</span>' : $title;
$header .= ( false === stripos( $title, 'summary' ) ) ? ' <span class="summary screen-reader-text">' . wp_strip_all_tags( $event_title ) . '</span>' : $title;

return '<header>' . $header . '</header>';
}
Expand Down Expand Up @@ -1277,7 +1277,7 @@ function mc_event_filter( $title ) {
$template = mc_get_option( 'event_title_template', '' );
$template = ( '' !== $template ) ? stripslashes( $template ) : '{title} / {date}';

return esc_html( strip_tags( stripslashes( mc_draw_template( $array, $template ) ) ) );
return esc_html( wp_strip_all_tags( stripslashes( mc_draw_template( $array, $template ) ) ) );
} else {
return $title;
}
Expand Down Expand Up @@ -1786,7 +1786,7 @@ function my_calendar( $args ) {
$show_weekends = ( 'true' === $params['weekends'] ) ? true : false;
$id = $params['id'];
$main_class = ( '' !== $id ) ? $id : 'all';
$cid = ( isset( $_GET['cid'] ) ) ? esc_attr( strip_tags( $_GET['cid'] ) ) : $main_class;
$cid = ( isset( $_GET['cid'] ) ) ? esc_attr( wp_strip_all_tags( $_GET['cid'] ) ) : $main_class;
$lang = ( $switched ) ? ' lang="' . esc_attr( $switched ) . '"' : '';
$body_classes = array(
'mc-main',
Expand Down Expand Up @@ -2760,7 +2760,7 @@ function my_calendar_locations_list( $show = 'list', $datatype = 'id', $group =
}
foreach ( $qsa as $name => $argument ) {
if ( 'loc' !== $name && 'ltype' !== $name ) {
$output .= "\n" . '<input type="hidden" name="' . esc_attr( strip_tags( $name ) ) . '" value="' . esc_attr( strip_tags( $argument ) ) . '" />';
$output .= "\n" . '<input type="hidden" name="' . esc_attr( wp_strip_all_tags( $name ) ) . '" value="' . esc_attr( wp_strip_all_tags( $argument ) ) . '" />';
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/my-calendar-templating.php
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,7 @@ function mc_key_exists( $key ) {
*/
function mc_create_template( $template, $post = array() ) {
$key = md5( $template );
$description = strip_tags( $post['mc_template_key'] );
$description = wp_strip_all_tags( $post['mc_template_key'] );
update_option( "mc_template_desc_$key", $description );
update_option( "mc_ctemplate_$key", $template );

Expand Down Expand Up @@ -699,7 +699,7 @@ function mc_admin_template_description( $key ) {
}

if ( ! mc_is_core_template( $key ) ) {
$return = strip_tags( stripslashes( get_option( "mc_template_desc_$key" ) ) );
$return = wp_strip_all_tags( stripslashes( get_option( "mc_template_desc_$key" ) ) );
}

return wpautop( $return );
Expand Down

0 comments on commit e2c2291

Please sign in to comment.