LezWatch.TV News and Information - Version 1.2.3

Version Description

Download this release

Release Info

Developer Ipstenu
Plugin Icon 128x128 LezWatch.TV News and Information
Version 1.2.3
Comparing to
See all releases

Code changes from version 1.2.2 to 1.2.3

lezwatchtv-main.php CHANGED
@@ -3,12 +3,12 @@
3
  * Plugin Name: LezWatch.TV News & Information
4
  * Plugin URI: https://lezwatchtv.com/about/resources/
5
  * Description: Display information on queer female and trans representation on TV. Brought to you by LezWatch.TV.
6
- * Version: 1.2.2
7
  * Author: LezWatch.TV
8
  * Author URI: https://lezwatchtv.com/
9
  * License: GPLv2 (or Later)
10
  *
11
- * Copyright 2017-2021 LezWatch.TV (email: webmaster@lezwatchtv.com)
12
  *
13
  * This file is part of LezWatch.TV News & Information, a plugin for WordPress.
14
  *
@@ -115,12 +115,12 @@ class LezWatchTV {
115
  */
116
  public static function shortcode( $atts ) {
117
  $attributes = shortcode_atts(
118
- [
119
  'data' => 'of-the-day',
120
  'date' => 'today',
121
  'stat' => 'all',
122
  'otd' => 'character',
123
- ],
124
  $atts
125
  );
126
 
@@ -192,7 +192,7 @@ class LezWatchTV {
192
  $response = wp_remote_retrieve_body( $request );
193
  $response = json_decode( $response, true );
194
  // translators: %s is the amount of time since a queer death (1 day, 2 days, 1 month, etc)
195
- $return = '<p>' . sprintf( __( 'It has been %s since the last queer female death on television', 'lezwatchtv' ), '<strong>' . human_time_diff( $response['died'], current_time( 'timestamp' ) ) . '</strong> ' );
196
  $return .= ': <a href="' . $response['url'] . '">' . $response['name'] . '</a> - ' . gmdate( 'F j, Y', $response['died'] ) . '</p>';
197
  }
198
 
@@ -263,10 +263,10 @@ class LezWatchTV {
263
  if ( 'today' !== $this_day ) {
264
  $month = substr( $this_day, 0, 2 );
265
  $day = substr( $this_day, 3, 2 );
266
- $this_day = ( true === checkdate( $month, $day, date( 'Y' ) ) ) ? $this_day : 'today';
267
  }
268
 
269
- $echo_day = ( 'today' === $this_day ) ? time() : strtotime( date( 'Y' ) . '-' . $this_day );
270
  $json_day = ( 'today' === $this_day ) ? '' : $this_day . '/';
271
  $request = wp_remote_get( self::$apiurl . '/on-this-day/' . $json_day );
272
 
@@ -373,7 +373,7 @@ class LezWatchTV {
373
  public function this_year( $year = false ) {
374
 
375
  // If the year isn't valid, we default to this year
376
- $year = ( ! $year || ! preg_match( '/^[0-9]{4}$/', $year ) ) ? date( 'Y' ) : $year;
377
 
378
  // Get the data
379
  $request = wp_remote_get( self::$apiurl . '/what-happened/' . $year );
3
  * Plugin Name: LezWatch.TV News & Information
4
  * Plugin URI: https://lezwatchtv.com/about/resources/
5
  * Description: Display information on queer female and trans representation on TV. Brought to you by LezWatch.TV.
6
+ * Version: 1.2.3
7
  * Author: LezWatch.TV
8
  * Author URI: https://lezwatchtv.com/
9
  * License: GPLv2 (or Later)
10
  *
11
+ * Copyright 2017-2022 LezWatch.TV (email: webmaster@lezwatchtv.com)
12
  *
13
  * This file is part of LezWatch.TV News & Information, a plugin for WordPress.
14
  *
115
  */
116
  public static function shortcode( $atts ) {
117
  $attributes = shortcode_atts(
118
+ array(
119
  'data' => 'of-the-day',
120
  'date' => 'today',
121
  'stat' => 'all',
122
  'otd' => 'character',
123
+ ),
124
  $atts
125
  );
126
 
192
  $response = wp_remote_retrieve_body( $request );
193
  $response = json_decode( $response, true );
194
  // translators: %s is the amount of time since a queer death (1 day, 2 days, 1 month, etc)
195
+ $return = '<p>' . sprintf( __( 'It has been %s since the last queer female, non-binary, or transgender death on television', 'lezwatchtv' ), '<strong>' . human_time_diff( $response['died'], current_time( 'timestamp' ) ) . '</strong> ' );
196
  $return .= ': <a href="' . $response['url'] . '">' . $response['name'] . '</a> - ' . gmdate( 'F j, Y', $response['died'] ) . '</p>';
197
  }
198
 
263
  if ( 'today' !== $this_day ) {
264
  $month = substr( $this_day, 0, 2 );
265
  $day = substr( $this_day, 3, 2 );
266
+ $this_day = ( true === checkdate( $month, $day, gmdate( 'Y' ) ) ) ? $this_day : 'today';
267
  }
268
 
269
+ $echo_day = ( 'today' === $this_day ) ? time() : strtotime( gmdate( 'Y' ) . '-' . $this_day );
270
  $json_day = ( 'today' === $this_day ) ? '' : $this_day . '/';
271
  $request = wp_remote_get( self::$apiurl . '/on-this-day/' . $json_day );
272
 
373
  public function this_year( $year = false ) {
374
 
375
  // If the year isn't valid, we default to this year
376
+ $year = ( ! $year || ! preg_match( '/^[0-9]{4}$/', $year ) ) ? gmdate( 'Y' ) : $year;
377
 
378
  // Get the data
379
  $request = wp_remote_get( self::$apiurl . '/what-happened/' . $year );
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: Ipstenu, liljimmi
3
  Tags: television, queer, lesbian, tv, block
4
  Requires at least: 4.8
5
- Tested up to: 5.7
6
- Stable tag: 1.2.2
7
  License: GPLv2 (or Later)
8
 
9
  Display information on queer female, transgender, and non-binary representation on TV. Brought to you by LezWatch.TV.
2
  Contributors: Ipstenu, liljimmi
3
  Tags: television, queer, lesbian, tv, block
4
  Requires at least: 4.8
5
+ Tested up to: 6.1
6
+ Stable tag: 1.2.3
7
  License: GPLv2 (or Later)
8
 
9
  Display information on queer female, transgender, and non-binary representation on TV. Brought to you by LezWatch.TV.
widgets/last-death.php CHANGED
@@ -45,15 +45,15 @@ class LezWatchTV_Last_Death_Widget extends WP_Widget {
45
 
46
  $instance = wp_parse_args( (array) $instance, $this->defaults );
47
 
48
- echo $args['before_widget'];
49
 
50
  if ( ! empty( $instance['title'] ) ) {
51
- echo $args['before_title'] . apply_filters( 'widget_title', $instance['title'] ) . $args['after_title'];
52
  }
53
 
54
  echo wp_kses_post( LezWatchTV::last_death() );
55
 
56
- echo $args['after_widget'];
57
  }
58
 
59
  /**
45
 
46
  $instance = wp_parse_args( (array) $instance, $this->defaults );
47
 
48
+ echo wp_kses_post( $args['before_widget'] );
49
 
50
  if ( ! empty( $instance['title'] ) ) {
51
+ echo wp_kses_post( $args['before_title'] . apply_filters( 'widget_title', $instance['title'] ) . $args['after_title'] );
52
  }
53
 
54
  echo wp_kses_post( LezWatchTV::last_death() );
55
 
56
+ echo wp_kses_post( $args['after_widget'] );
57
  }
58
 
59
  /**
widgets/of-the-day.php CHANGED
@@ -48,17 +48,17 @@ class LezWatchTV_Of_The_Day_Widget extends WP_Widget {
48
 
49
  $instance = wp_parse_args( (array) $instance, $this->defaults );
50
 
51
- echo $args['before_widget'];
52
 
53
  if ( ! empty( $instance['title'] ) ) {
54
- echo $args['before_title'] . apply_filters( 'widget_title', $instance['title'] ) . $args['after_title'];
55
  }
56
 
57
  $type = ( ! empty( $instance['type'] ) ) ? $instance['type'] : 'character';
58
 
59
- echo '<center>' . LezWatchTV::of_the_day( $type ) . '</center>';
60
 
61
- echo $args['after_widget'];
62
  }
63
 
64
  /**
48
 
49
  $instance = wp_parse_args( (array) $instance, $this->defaults );
50
 
51
+ echo wp_kses_post( $args['before_widget'] );
52
 
53
  if ( ! empty( $instance['title'] ) ) {
54
+ echo wp_kses_post( $args['before_title'] . apply_filters( 'widget_title', $instance['title'] ) . $args['after_title'] );
55
  }
56
 
57
  $type = ( ! empty( $instance['type'] ) ) ? $instance['type'] : 'character';
58
 
59
+ echo '<center>' . wp_kses_post( LezWatchTV::of_the_day( $type ) ) . '</center>';
60
 
61
+ echo wp_kses_post( $args['after_widget'] );
62
  }
63
 
64
  /**
widgets/on-this-day.php CHANGED
@@ -46,17 +46,17 @@ class LezWatchTV_On_This_Day_Widget extends WP_Widget {
46
 
47
  $instance = wp_parse_args( (array) $instance, $this->defaults );
48
 
49
- echo $args['before_widget'];
50
 
51
  if ( ! empty( $instance['title'] ) ) {
52
- echo $args['before_title'] . apply_filters( 'widget_title', $instance['title'] ) . $args['after_title'];
53
  }
54
 
55
- $date = ( ! empty( $instance['date'] ) ) ? $instance['date'] : 'today' ;
56
 
57
- echo LezWatchTV::died_on_this_day( $date );
58
 
59
- echo $args['after_widget'];
60
  }
61
 
62
  /**
@@ -72,7 +72,7 @@ class LezWatchTV_On_This_Day_Widget extends WP_Widget {
72
  $new_instance['date'] = substr( $new_instance['date'], 0, 5 );
73
  $month = substr( $new_instance['date'], 0, 2 );
74
  $day = substr( $new_instance['date'], 3, 2 );
75
- if ( checkdate( $month, $day, date( 'Y' ) ) === false ) {
76
  $new_instance['date'] = '';
77
  }
78
  $new_instance['date'] = wp_strip_all_tags( $new_instance['date'] );
46
 
47
  $instance = wp_parse_args( (array) $instance, $this->defaults );
48
 
49
+ echo wp_kses_post( $args['before_widget'] );
50
 
51
  if ( ! empty( $instance['title'] ) ) {
52
+ echo wp_kses_post( $args['before_title'] . apply_filters( 'widget_title', $instance['title'] ) . $args['after_title'] );
53
  }
54
 
55
+ $date = ( ! empty( $instance['date'] ) ) ? $instance['date'] : 'today';
56
 
57
+ echo wp_kses_post( LezWatchTV::died_on_this_day( $date ) );
58
 
59
+ echo wp_kses_post( $args['after_widget'] );
60
  }
61
 
62
  /**
72
  $new_instance['date'] = substr( $new_instance['date'], 0, 5 );
73
  $month = substr( $new_instance['date'], 0, 2 );
74
  $day = substr( $new_instance['date'], 3, 2 );
75
+ if ( checkdate( $month, $day, gmdate( 'Y' ) ) === false ) {
76
  $new_instance['date'] = '';
77
  }
78
  $new_instance['date'] = wp_strip_all_tags( $new_instance['date'] );
widgets/statistics.php CHANGED
@@ -46,17 +46,17 @@ class LezWatchTV_Statistics_Widget extends WP_Widget {
46
 
47
  $instance = wp_parse_args( (array) $instance, $this->defaults );
48
 
49
- echo $args['before_widget'];
50
 
51
  if ( ! empty( $instance['title'] ) ) {
52
- echo $args['before_title'] . apply_filters( 'widget_title', $instance['title'] ) . $args['after_title'];
53
  }
54
 
55
- $type = ( ! empty( $instance['type'] ) )? $instance['type'] : 'all' ;
56
 
57
- echo LezWatchTV::statistics( $type );
58
 
59
- echo $args['after_widget'];
60
  }
61
 
62
  /**
@@ -91,7 +91,7 @@ class LezWatchTV_Statistics_Widget extends WP_Widget {
91
  <p>
92
  <label for="<?php echo esc_attr( $this->get_field_id( 'type' ) ); ?>"><?php esc_html_e( 'Type', 'lezwatchtv' ); ?>: </label>
93
 
94
- <select id="<?php echo $this->get_field_id( 'type' ); ?>" name="<?php echo $this->get_field_name( 'type' ); ?>" class="widefat" style="width:100%;">
95
  <option value="" selected>All</option>
96
  <?php
97
  foreach ( $stat_types as $type ) {
46
 
47
  $instance = wp_parse_args( (array) $instance, $this->defaults );
48
 
49
+ echo wp_kses_post( $args['before_widget'] );
50
 
51
  if ( ! empty( $instance['title'] ) ) {
52
+ echo wp_kses_post( $args['before_title'] . apply_filters( 'widget_title', $instance['title'] ) . $args['after_title'] );
53
  }
54
 
55
+ $type = ( ! empty( $instance['type'] ) ) ? $instance['type'] : 'all';
56
 
57
+ echo wp_kses_post( LezWatchTV::statistics( $type ) );
58
 
59
+ echo wp_kses_post( $args['after_widget'] );
60
  }
61
 
62
  /**
91
  <p>
92
  <label for="<?php echo esc_attr( $this->get_field_id( 'type' ) ); ?>"><?php esc_html_e( 'Type', 'lezwatchtv' ); ?>: </label>
93
 
94
+ <select id="<?php echo esc_attr( $this->get_field_id( 'type' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'type' ) ); ?>" class="widefat" style="width:100%;">
95
  <option value="" selected>All</option>
96
  <?php
97
  foreach ( $stat_types as $type ) {
widgets/this-year.php CHANGED
@@ -21,7 +21,7 @@ class LezWatchTV_This_Year_Widget extends WP_Widget {
21
 
22
  $this->defaults = array(
23
  'title' => __( 'In This Year', 'lezwatchtv' ),
24
- 'year' => date( 'Y' ),
25
  );
26
 
27
  $widget_ops = array(
@@ -44,20 +44,19 @@ class LezWatchTV_This_Year_Widget extends WP_Widget {
44
  */
45
  public function widget( $args, $instance ) {
46
 
47
- extract( $args );
48
  $instance = wp_parse_args( (array) $instance, $this->defaults );
49
 
50
- echo $args['before_widget'];
51
 
52
  if ( ! empty( $instance['title'] ) ) {
53
- echo $args['before_title'] . apply_filters( 'widget_title', $instance['title'] ) . $args['after_title'];
54
  }
55
 
56
- $year = ( ! empty( $instance['year'] ) )? $instance['year'] : date( 'Y' ) ;
57
 
58
- echo LezWatchTV::this_year( $year );
59
 
60
- echo $args['after_widget'];
61
  }
62
 
63
  /**
@@ -69,7 +68,7 @@ class LezWatchTV_This_Year_Widget extends WP_Widget {
69
  */
70
  public function update( $new_instance, $old_instance ) {
71
  $new_instance['title'] = wp_strip_all_tags( $new_instance['title'] );
72
- $new_instance['year'] = ( preg_match( '/^[0-9]{4}$/', $new_instance['year'] ) ) ? $new_instance['year'] : date( 'Y' );
73
  return $new_instance;
74
  }
75
 
@@ -92,10 +91,10 @@ class LezWatchTV_This_Year_Widget extends WP_Widget {
92
  </p>
93
  <p>
94
  <label for="<?php echo esc_attr( $this->get_field_id( 'date' ) ); ?>"><?php esc_html_e( 'Year', 'lezwatchtv' ); ?>: </label>
95
- <select id="<?php echo $this->get_field_id( 'year' ); ?>" name="<?php echo $this->get_field_name( 'year' ); ?>" class="widefat" style="width:100%;">
96
  <?php
97
- for ( $year = $response['first']; $year <= date( 'Y' ); ++$year ) {
98
- echo '<option ' . selected( $instance['year'], $year ) . ' value="' . $year . '">' . $year . '</option>';
99
  }
100
  ?>
101
  </select>
21
 
22
  $this->defaults = array(
23
  'title' => __( 'In This Year', 'lezwatchtv' ),
24
+ 'year' => gmdate( 'Y' ),
25
  );
26
 
27
  $widget_ops = array(
44
  */
45
  public function widget( $args, $instance ) {
46
 
 
47
  $instance = wp_parse_args( (array) $instance, $this->defaults );
48
 
49
+ echo wp_kses_post( $args['before_widget'] );
50
 
51
  if ( ! empty( $instance['title'] ) ) {
52
+ echo wp_kses_post( $args['before_title'] . apply_filters( 'widget_title', $instance['title'] ) . $args['after_title'] );
53
  }
54
 
55
+ $year = ( ! empty( $instance['year'] ) ) ? $instance['year'] : gmdate( 'Y' );
56
 
57
+ echo wp_kses_post( LezWatchTV::this_year( $year ) );
58
 
59
+ echo wp_kses_post( $args['after_widget'] );
60
  }
61
 
62
  /**
68
  */
69
  public function update( $new_instance, $old_instance ) {
70
  $new_instance['title'] = wp_strip_all_tags( $new_instance['title'] );
71
+ $new_instance['year'] = ( preg_match( '/^[0-9]{4}$/', $new_instance['year'] ) ) ? $new_instance['year'] : gmdate( 'Y' );
72
  return $new_instance;
73
  }
74
 
91
  </p>
92
  <p>
93
  <label for="<?php echo esc_attr( $this->get_field_id( 'date' ) ); ?>"><?php esc_html_e( 'Year', 'lezwatchtv' ); ?>: </label>
94
+ <select id="<?php echo esc_attr( $this->get_field_id( 'year' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'year' ) ); ?>" class="widefat" style="width:100%;">
95
  <?php
96
+ for ( $year = $response['first']; $year <= gmdate( 'Y' ); ++$year ) {
97
+ echo '<option ' . selected( $instance['year'], $year ) . ' value="' . esc_attr( $year ) . '">' . esc_attr( $year ) . '</option>';
98
  }
99
  ?>
100
  </select>