mirror of
https://ghproxy.net/https://github.com/elementor/wp2static.git
synced 2025-08-29 08:32:23 +08:00
improve typing in ViewRenderer
This commit is contained in:
parent
4ec7b22d67
commit
58d43185bb
2 changed files with 16 additions and 15 deletions
|
@ -25,7 +25,7 @@ parameters:
|
|||
count: 25
|
||||
- message: '#^In method "WP2Static\\\S+::\S+", you should not use the \$_(GET|POST) superglobal#'
|
||||
path: src/ViewRenderer.php
|
||||
count: 18
|
||||
count: 10
|
||||
- message: "#^Cannot access property \\$value on mixed\\.$#"
|
||||
path: views/options-page.php
|
||||
count: 4
|
||||
|
|
|
@ -151,12 +151,12 @@ class ViewRenderer {
|
|||
$paths = ProcessedSite::getPaths();
|
||||
|
||||
// Apply search
|
||||
if ( ! empty( $_GET['s'] ) ) {
|
||||
$s = $_GET['s'];
|
||||
$search_term = strval( filter_input( INPUT_GET, 's' ) );
|
||||
if ( $search_term !== '' ) {
|
||||
$paths = array_filter(
|
||||
$paths,
|
||||
function ( $path ) use ( $s ) {
|
||||
return stripos( $path, $s ) !== false;
|
||||
function ( $path ) use ( $search_term ) {
|
||||
return stripos( $path, $search_term ) !== false;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
@ -184,12 +184,12 @@ class ViewRenderer {
|
|||
$paths = StaticSite::getPaths();
|
||||
|
||||
// Apply search
|
||||
if ( ! empty( $_GET['s'] ) ) {
|
||||
$s = $_GET['s'];
|
||||
$search_term = strval( filter_input( INPUT_GET, 's' ) );
|
||||
if ( $search_term !== '' ) {
|
||||
$paths = array_filter(
|
||||
$paths,
|
||||
function ( $path ) use ( $s ) {
|
||||
return stripos( $path, $s ) !== false;
|
||||
function ( $path ) use ( $search_term ) {
|
||||
return stripos( $path, $search_term ) !== false;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
@ -214,17 +214,18 @@ class ViewRenderer {
|
|||
die( 'Forbidden' );
|
||||
}
|
||||
|
||||
$paths = isset( $_GET['deploy_namespace'] )
|
||||
? DeployCache::getPaths( $_GET['deploy_namespace'] )
|
||||
$deploy_namespace = strval( filter_input( INPUT_GET, 'deploy_namespace' ) );
|
||||
$paths = $deploy_namespace !== ''
|
||||
? DeployCache::getPaths( $deploy_namespace )
|
||||
: DeployCache::getPaths();
|
||||
|
||||
// Apply search
|
||||
if ( ! empty( $_GET['s'] ) ) {
|
||||
$s = $_GET['s'];
|
||||
$search_term = strval( filter_input( INPUT_GET, 's' ) );
|
||||
if ( $search_term !== '' ) {
|
||||
$paths = array_filter(
|
||||
$paths,
|
||||
function ( $path ) use ( $s ) {
|
||||
return stripos( $path, $s ) !== false;
|
||||
function ( $path ) use ( $search_term ) {
|
||||
return stripos( $path, $search_term ) !== false;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue