Skip to content

Commit 605e702

Browse files
Merge pull request #977 from Codeinwp/bugfix/976
Compatible with PHP 8.2
2 parents 2a36832 + bac0e7d commit 605e702

File tree

4 files changed

+5
-8
lines changed

4 files changed

+5
-8
lines changed

classes/Visualizer/Module.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ private function _getCSV( $rows, $filename, $enclose ) {
270270

271271
$bom = chr( 0xEF ) . chr( 0xBB ) . chr( 0xBF );
272272
// phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged
273-
$fp = @tmpfile();
273+
$fp = function_exists( 'tmpfile' ) ? @tmpfile() : null;
274274
if ( null === $fp ) {
275275
$fp = fopen( wp_tempnam(), 'w+' );
276276
}

classes/Visualizer/Module/Admin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -883,7 +883,7 @@ private function getQuery() {
883883
$this->getDisplayFilters( $query_args );
884884

885885
// Added by Ash/Upwork
886-
$filterByMeta = filter_input( INPUT_GET, 's', FILTER_SANITIZE_STRING );
886+
$filterByMeta = ! empty( $_GET['s'] ) ? sanitize_text_field( wp_unslash( $_GET['s'] ) ) : null; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
887887
if ( $filterByMeta ) {
888888
$query = array(
889889
'key' => Visualizer_Plugin::CF_SETTINGS,

classes/Visualizer/Render/Library.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -216,10 +216,7 @@ private function getDisplayForm() {
216216
*/
217217
private function _renderLibrary() {
218218
// Added by Ash/Upwork
219-
$filterBy = null;
220-
if ( isset( $_GET['s'] ) && strlen( $_GET['s'] ) > 0 ) {
221-
$filterBy = filter_input( INPUT_GET, 's', FILTER_SANITIZE_STRING );
222-
}
219+
$filterBy = ! empty( $_GET['s'] ) ? sanitize_text_field( wp_unslash( $_GET['s'] ) ) : null; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
223220
// Added by Ash/Upwork
224221
echo $this->custom_css;
225222
echo '<div id="visualizer-types" class="visualizer-clearfix">';

classes/Visualizer/Source/Csv.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ class Visualizer_Source_Csv extends Visualizer_Source {
4747
* @access public
4848
* @param string $filename The path to the file.
4949
*/
50-
public function __construct( $filename = null ) {
51-
$this->_filename = trim( $filename );
50+
public function __construct( $filename = '' ) {
51+
$this->_filename = trim( (string) $filename );
5252
}
5353

5454
/**

0 commit comments

Comments
 (0)