From aa8cf9094bad69160c19cd502ae313167847b6d4 Mon Sep 17 00:00:00 2001 From: jcvignoli Date: Sat, 5 Oct 2024 17:34:14 -0500 Subject: [PATCH] renamed to 4.2 --- dist/CHANGELOG.md | 2 +- dist/README.txt | 2 +- .../frontend/popups/class-popup-person.php | 91 +++++++++++-------- dist/lumiere-movies.php | 2 +- src/CHANGELOG.md | 2 +- src/README.txt | 2 +- .../frontend/popups/class-popup-person.php | 91 +++++++++++-------- src/lumiere-movies.php | 2 +- 8 files changed, 116 insertions(+), 78 deletions(-) diff --git a/dist/CHANGELOG.md b/dist/CHANGELOG.md index cc617efc..09aaf6ee 100644 --- a/dist/CHANGELOG.md +++ b/dist/CHANGELOG.md @@ -1,6 +1,6 @@ **Changelog** -v.4.1.9 +v.4.2 * [technical] Compatible 6.7 (load_plugin_textdomain() is loaded in add_action('init') in class Core) * [technical] Better sanitization according to new WordPress rules * [bug] Fixed biography, wasn't available (moving to imdbGraphQLPHP, IMDbPHP is not maintained anymore) diff --git a/dist/README.txt b/dist/README.txt index 87109e4b..e04dcc70 100644 --- a/dist/README.txt +++ b/dist/README.txt @@ -3,7 +3,7 @@ Contributors: psykonevro Tags: cinema, film, imdb, movie, actor Requires at least: 5.6 Tested up to: 6.7 -Stable tag: 4.1.9 +Stable tag: 4.2 Requires PHP: 8.0 License: GPLv3 License URI: https://www.gnu.org/licenses/gpl-3.0.en.html diff --git a/dist/class/frontend/popups/class-popup-person.php b/dist/class/frontend/popups/class-popup-person.php index ac457e7d..11f10304 100644 --- a/dist/class/frontend/popups/class-popup-person.php +++ b/dist/class/frontend/popups/class-popup-person.php @@ -171,6 +171,7 @@ public function lumiere_popup_person_layout( string $template ): string { 'strong' => [], 'div' => [ 'align' => [], + 'rel' => [], 'class' => [], ], 'i' => [], @@ -196,6 +197,7 @@ public function lumiere_popup_person_layout( string $template ): string { 'strong' => [], 'div' => [ 'align' => [], + 'rel' => [], 'class' => [], ], 'i' => [], @@ -214,7 +216,25 @@ public function lumiere_popup_person_layout( string $template ): string { wp_verify_nonce( $nonce_url ) > 0 && isset( $_GET['info'] ) && $_GET['info'] === 'bio' ) { - $this->display_bio(); + echo wp_kses( + $this->display_bio(), + [ + 'span' => [ 'class' => [] ], + 'div' => [ + 'align' => [], + 'class' => [], + 'id' => [], + ], + 'a' => [ + 'href' => [], + 'rel' => [], + 'class' => [], + ], + 'font' => [ 'size' => [] ], + 'strong' => [], + 'i' => [], + ] + ); } // ------------------------------------------------------------------------------ misc part @@ -312,28 +332,28 @@ private function display_full_filmo(): string { /** * Display biography */ - private function display_bio(): void { + private function display_bio(): string { $biomovie = $this->person->pubmovies(); $nbtotalbiomovie = count( $biomovie ); + $output = ''; if ( $nbtotalbiomovie !== 0 ) { - echo "\n\t\t\t\t\t\t\t" . ' '; - echo "\n" . '
'; - echo "\n\t" . '' . esc_html( _n( 'Biographical movie', 'Biographical movies', $nbtotalbiomovie, 'lumiere-movies' ) ) . ''; + $output .= "\n\t\t\t\t\t\t\t" . ' '; + $output .= "\n" . '
'; + $output .= "\n\t" . '' . esc_html( _n( 'Biographical movie', 'Biographical movies', $nbtotalbiomovie, 'lumiere-movies' ) ) . ''; for ( $i = 0; $i < $nbtotalbiomovie; ++$i ) { - echo "" . esc_html( $biomovie[ $i ]['title'] ) . ''; + $output .= "" . esc_html( $biomovie[ $i ]['title'] ) . ''; if ( isset( $biomovie[ $i ]['year'] ) && $biomovie[ $i ]['year'] > 0 ) { - echo ' (' . intval( $biomovie[ $i ]['year'] ) . ') '; + $output .= ' (' . intval( $biomovie[ $i ]['year'] ) . ') '; } } - echo '
'; - + $output .= '
'; } ############## Portrayed in @@ -343,20 +363,20 @@ private function display_bio(): void { if ( $nbtotalportrayedmovie !== 0 ) { - echo "\n\t\t\t\t\t\t\t" . ' '; - echo "\n" . '
'; - echo "\n\t" . '' . esc_html__( 'Portrayed in', 'lumiere-movies' ) . ''; + $output .= "\n\t\t\t\t\t\t\t" . ' '; + $output .= "\n" . '
'; + $output .= "\n\t" . '' . esc_html__( 'Portrayed in', 'lumiere-movies' ) . ''; for ( $i = 0; $i < $nbtotalportrayedmovie; ++$i ) { - echo "" . esc_html( $portrayedmovie[ $i ]['name'] ) . ''; + $output .= "" . esc_html( $portrayedmovie[ $i ]['name'] ) . ''; if ( isset( $portrayedmovie[ $i ]['year'] ) && strlen( $portrayedmovie[ $i ]['year'] ) !== 0 ) { - echo ' (' . intval( $portrayedmovie[ $i ]['year'] ) . ') '; + $output .= ' (' . intval( $portrayedmovie[ $i ]['year'] ) . ') '; } } - echo '
'; + $output .= '
'; } @@ -367,29 +387,29 @@ private function display_bio(): void { if ( $nbtotalinterviews !== 0 ) { - echo "\n\t\t\t\t\t\t\t" . ' '; - echo "\n" . '
'; - echo "\n\t" . '' . esc_html( _n( 'Interview', 'Interviews', $nbtotalinterviews, 'lumiere-movies' ) ) . ''; + $output .= "\n\t\t\t\t\t\t\t" . ' '; + $output .= "\n" . '
'; + $output .= "\n\t" . '' . esc_html( _n( 'Interview', 'Interviews', $nbtotalinterviews, 'lumiere-movies' ) ) . ''; for ( $i = 0; $i < $nbtotalinterviews; $i++ ) { - echo esc_html( $interviews[ $i ]['name'] ) . ' '; + $output .= esc_html( $interviews[ $i ]['name'] ) . ' '; if ( isset( $interviews[ $i ]['full'] ) && strlen( $interviews[ $i ]['full'] ) !== 0 ) { - echo ' (' . intval( $interviews[ $i ]['full'] ) . ') '; + $output .= ' (' . intval( $interviews[ $i ]['full'] ) . ') '; } if ( isset( $interviews[ $i ]['details'] ) && strlen( $interviews[ $i ]['details'] ) !== 0 ) { - echo esc_html( $interviews[ $i ]['details'] ); + $output .= esc_html( $interviews[ $i ]['details'] ); } if ( $i < $nbtotalinterviews - 1 ) { - echo ', '; + $output .= ', '; } } - echo '
'; + $output .= '
'; } @@ -401,51 +421,50 @@ private function display_bio(): void { if ( $nbtotalpubprints !== 0 ) { - echo "\n\t\t\t\t\t\t\t" . ' '; - echo "\n" . '
'; - echo "\n\t" . '' + $output .= "\n\t\t\t\t\t\t\t" . ' '; + $output .= "\n" . '
'; + $output .= "\n\t" . '' . esc_html( _n( 'Print ads', 'Printed ads', $nbtotalpubprints, 'lumiere-movies' ) ) . ''; for ( $i = 0; $i < $nbtotalpubprints; $i++ ) { // Display a "show more" after XX results if ( $i === $nblimitpubprints ) { - echo "\n\t" . ' (' + $output .= "\n\t" . ' (' . esc_html__( 'see all', 'lumiere-movies' ) . ') ' . "\n\t" . ''; } if ( isset( $pubprints[ $i ]['author'][0] ) && strlen( $pubprints[ $i ]['author'][0] ) !== 0 ) { - echo "\n\t\t" . esc_html( $pubprints[ $i ]['author'][0] ); + $output .= "\n\t\t" . esc_html( $pubprints[ $i ]['author'][0] ); } if ( isset( $pubprints[ $i ]['title'] ) && strlen( $pubprints[ $i ]['title'] ) !== 0 ) { - echo ' ' . esc_html( $pubprints[ $i ]['title'] ) . ' '; + $output .= ' ' . esc_html( $pubprints[ $i ]['title'] ) . ' '; } if ( isset( $pubprints[ $i ]['year'] ) && strlen( $pubprints[ $i ]['year'] ) !== 0 ) { - echo '(' . intval( $pubprints[ $i ]['year'] ) . ')'; + $output .= '(' . intval( $pubprints[ $i ]['year'] ) . ')'; } if ( isset( $pubprints[ $i ]['details'] ) && strlen( $pubprints[ $i ]['details'] ) !== 0 ) { - echo esc_html( $pubprints[ $i ]['details'] ) . ' '; + $output .= esc_html( $pubprints[ $i ]['details'] ) . ' '; } if ( $i < ( $nbtotalpubprints - 1 ) ) { - echo ', '; + $output .= ', '; } if ( $i === ( $nbtotalpubprints - 1 ) ) { - echo "\n\t" . ''; + $output .= "\n\t" . ''; } - } - echo "\n" . '
'; + $output .= "\n" . '
'; } - + return $output; } /** diff --git a/dist/lumiere-movies.php b/dist/lumiere-movies.php index c45346cb..5f66dacc 100644 --- a/dist/lumiere-movies.php +++ b/dist/lumiere-movies.php @@ -11,7 +11,7 @@ * Plugin Name: Lumière Movies * Plugin URI: https://wordpress.org/plugins/lumiere-movies/ * Description: Add informative popups about movies with information extracted from the IMDb. Display data related to movies in a widget and inside your post. - * Version: 4.1.9 + * Version: 4.2 * Requires at least: 5.6 * Requires PHP: 8.0 * Author: psykonevro diff --git a/src/CHANGELOG.md b/src/CHANGELOG.md index cc617efc..09aaf6ee 100644 --- a/src/CHANGELOG.md +++ b/src/CHANGELOG.md @@ -1,6 +1,6 @@ **Changelog** -v.4.1.9 +v.4.2 * [technical] Compatible 6.7 (load_plugin_textdomain() is loaded in add_action('init') in class Core) * [technical] Better sanitization according to new WordPress rules * [bug] Fixed biography, wasn't available (moving to imdbGraphQLPHP, IMDbPHP is not maintained anymore) diff --git a/src/README.txt b/src/README.txt index 87109e4b..e04dcc70 100644 --- a/src/README.txt +++ b/src/README.txt @@ -3,7 +3,7 @@ Contributors: psykonevro Tags: cinema, film, imdb, movie, actor Requires at least: 5.6 Tested up to: 6.7 -Stable tag: 4.1.9 +Stable tag: 4.2 Requires PHP: 8.0 License: GPLv3 License URI: https://www.gnu.org/licenses/gpl-3.0.en.html diff --git a/src/class/frontend/popups/class-popup-person.php b/src/class/frontend/popups/class-popup-person.php index ac457e7d..11f10304 100644 --- a/src/class/frontend/popups/class-popup-person.php +++ b/src/class/frontend/popups/class-popup-person.php @@ -171,6 +171,7 @@ public function lumiere_popup_person_layout( string $template ): string { 'strong' => [], 'div' => [ 'align' => [], + 'rel' => [], 'class' => [], ], 'i' => [], @@ -196,6 +197,7 @@ public function lumiere_popup_person_layout( string $template ): string { 'strong' => [], 'div' => [ 'align' => [], + 'rel' => [], 'class' => [], ], 'i' => [], @@ -214,7 +216,25 @@ public function lumiere_popup_person_layout( string $template ): string { wp_verify_nonce( $nonce_url ) > 0 && isset( $_GET['info'] ) && $_GET['info'] === 'bio' ) { - $this->display_bio(); + echo wp_kses( + $this->display_bio(), + [ + 'span' => [ 'class' => [] ], + 'div' => [ + 'align' => [], + 'class' => [], + 'id' => [], + ], + 'a' => [ + 'href' => [], + 'rel' => [], + 'class' => [], + ], + 'font' => [ 'size' => [] ], + 'strong' => [], + 'i' => [], + ] + ); } // ------------------------------------------------------------------------------ misc part @@ -312,28 +332,28 @@ private function display_full_filmo(): string { /** * Display biography */ - private function display_bio(): void { + private function display_bio(): string { $biomovie = $this->person->pubmovies(); $nbtotalbiomovie = count( $biomovie ); + $output = ''; if ( $nbtotalbiomovie !== 0 ) { - echo "\n\t\t\t\t\t\t\t" . ' '; - echo "\n" . '
'; - echo "\n\t" . '' . esc_html( _n( 'Biographical movie', 'Biographical movies', $nbtotalbiomovie, 'lumiere-movies' ) ) . ''; + $output .= "\n\t\t\t\t\t\t\t" . ' '; + $output .= "\n" . '
'; + $output .= "\n\t" . '' . esc_html( _n( 'Biographical movie', 'Biographical movies', $nbtotalbiomovie, 'lumiere-movies' ) ) . ''; for ( $i = 0; $i < $nbtotalbiomovie; ++$i ) { - echo "" . esc_html( $biomovie[ $i ]['title'] ) . ''; + $output .= "" . esc_html( $biomovie[ $i ]['title'] ) . ''; if ( isset( $biomovie[ $i ]['year'] ) && $biomovie[ $i ]['year'] > 0 ) { - echo ' (' . intval( $biomovie[ $i ]['year'] ) . ') '; + $output .= ' (' . intval( $biomovie[ $i ]['year'] ) . ') '; } } - echo '
'; - + $output .= '
'; } ############## Portrayed in @@ -343,20 +363,20 @@ private function display_bio(): void { if ( $nbtotalportrayedmovie !== 0 ) { - echo "\n\t\t\t\t\t\t\t" . ' '; - echo "\n" . '
'; - echo "\n\t" . '' . esc_html__( 'Portrayed in', 'lumiere-movies' ) . ''; + $output .= "\n\t\t\t\t\t\t\t" . ' '; + $output .= "\n" . '
'; + $output .= "\n\t" . '' . esc_html__( 'Portrayed in', 'lumiere-movies' ) . ''; for ( $i = 0; $i < $nbtotalportrayedmovie; ++$i ) { - echo "" . esc_html( $portrayedmovie[ $i ]['name'] ) . ''; + $output .= "" . esc_html( $portrayedmovie[ $i ]['name'] ) . ''; if ( isset( $portrayedmovie[ $i ]['year'] ) && strlen( $portrayedmovie[ $i ]['year'] ) !== 0 ) { - echo ' (' . intval( $portrayedmovie[ $i ]['year'] ) . ') '; + $output .= ' (' . intval( $portrayedmovie[ $i ]['year'] ) . ') '; } } - echo '
'; + $output .= '
'; } @@ -367,29 +387,29 @@ private function display_bio(): void { if ( $nbtotalinterviews !== 0 ) { - echo "\n\t\t\t\t\t\t\t" . ' '; - echo "\n" . '
'; - echo "\n\t" . '' . esc_html( _n( 'Interview', 'Interviews', $nbtotalinterviews, 'lumiere-movies' ) ) . ''; + $output .= "\n\t\t\t\t\t\t\t" . ' '; + $output .= "\n" . '
'; + $output .= "\n\t" . '' . esc_html( _n( 'Interview', 'Interviews', $nbtotalinterviews, 'lumiere-movies' ) ) . ''; for ( $i = 0; $i < $nbtotalinterviews; $i++ ) { - echo esc_html( $interviews[ $i ]['name'] ) . ' '; + $output .= esc_html( $interviews[ $i ]['name'] ) . ' '; if ( isset( $interviews[ $i ]['full'] ) && strlen( $interviews[ $i ]['full'] ) !== 0 ) { - echo ' (' . intval( $interviews[ $i ]['full'] ) . ') '; + $output .= ' (' . intval( $interviews[ $i ]['full'] ) . ') '; } if ( isset( $interviews[ $i ]['details'] ) && strlen( $interviews[ $i ]['details'] ) !== 0 ) { - echo esc_html( $interviews[ $i ]['details'] ); + $output .= esc_html( $interviews[ $i ]['details'] ); } if ( $i < $nbtotalinterviews - 1 ) { - echo ', '; + $output .= ', '; } } - echo '
'; + $output .= '
'; } @@ -401,51 +421,50 @@ private function display_bio(): void { if ( $nbtotalpubprints !== 0 ) { - echo "\n\t\t\t\t\t\t\t" . ' '; - echo "\n" . '
'; - echo "\n\t" . '' + $output .= "\n\t\t\t\t\t\t\t" . ' '; + $output .= "\n" . '
'; + $output .= "\n\t" . '' . esc_html( _n( 'Print ads', 'Printed ads', $nbtotalpubprints, 'lumiere-movies' ) ) . ''; for ( $i = 0; $i < $nbtotalpubprints; $i++ ) { // Display a "show more" after XX results if ( $i === $nblimitpubprints ) { - echo "\n\t" . ' (' + $output .= "\n\t" . ' (' . esc_html__( 'see all', 'lumiere-movies' ) . ') ' . "\n\t" . ''; } if ( isset( $pubprints[ $i ]['author'][0] ) && strlen( $pubprints[ $i ]['author'][0] ) !== 0 ) { - echo "\n\t\t" . esc_html( $pubprints[ $i ]['author'][0] ); + $output .= "\n\t\t" . esc_html( $pubprints[ $i ]['author'][0] ); } if ( isset( $pubprints[ $i ]['title'] ) && strlen( $pubprints[ $i ]['title'] ) !== 0 ) { - echo ' ' . esc_html( $pubprints[ $i ]['title'] ) . ' '; + $output .= ' ' . esc_html( $pubprints[ $i ]['title'] ) . ' '; } if ( isset( $pubprints[ $i ]['year'] ) && strlen( $pubprints[ $i ]['year'] ) !== 0 ) { - echo '(' . intval( $pubprints[ $i ]['year'] ) . ')'; + $output .= '(' . intval( $pubprints[ $i ]['year'] ) . ')'; } if ( isset( $pubprints[ $i ]['details'] ) && strlen( $pubprints[ $i ]['details'] ) !== 0 ) { - echo esc_html( $pubprints[ $i ]['details'] ) . ' '; + $output .= esc_html( $pubprints[ $i ]['details'] ) . ' '; } if ( $i < ( $nbtotalpubprints - 1 ) ) { - echo ', '; + $output .= ', '; } if ( $i === ( $nbtotalpubprints - 1 ) ) { - echo "\n\t" . ''; + $output .= "\n\t" . ''; } - } - echo "\n" . '
'; + $output .= "\n" . '
'; } - + return $output; } /** diff --git a/src/lumiere-movies.php b/src/lumiere-movies.php index c45346cb..5f66dacc 100644 --- a/src/lumiere-movies.php +++ b/src/lumiere-movies.php @@ -11,7 +11,7 @@ * Plugin Name: Lumière Movies * Plugin URI: https://wordpress.org/plugins/lumiere-movies/ * Description: Add informative popups about movies with information extracted from the IMDb. Display data related to movies in a widget and inside your post. - * Version: 4.1.9 + * Version: 4.2 * Requires at least: 5.6 * Requires PHP: 8.0 * Author: psykonevro