Skip to content

Commit 098fafd

Browse files
committed
Issues resolved
1 parent 152d7a1 commit 098fafd

9 files changed

+34
-20
lines changed

includes/Component/Icon/IconLabel.php

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace lloc\Msls\Component\Icon;
44

55
use lloc\Msls\Component\Icon;
6-
use lloc\Msls\MslsPlugin;
76

87
/**
98
* Class IconLabel

includes/ContentImport/ImportCoordinates.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class ImportCoordinates {
2626
public $dest_post_id;
2727

2828
/**
29-
* @var \WP_Post
29+
* @var ?\WP_Post
3030
*/
3131
public $source_post;
3232

includes/ContentImport/Importers/Map.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class Map extends MslsRegistryInstance {
1616
public function make( ImportCoordinates $import_coordinates ) {
1717
$importers = array_map(
1818
function ( $factory ) use ( $import_coordinates ) {
19-
/** @var ImportersFactory $factory */
19+
/** @var ImportersBaseFactory $factory */
2020
return $factory->make( $import_coordinates );
2121
},
2222
$this->factories()

includes/MslsAdmin.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,7 @@ public function get_options_page_link(): string {
8686
*/
8787
public function __call( $method, $args ) {
8888
$parts = explode( '_', $method, 2 );
89-
90-
if ( is_array( $parts ) && 'rewrite' === $parts[0] ) {
89+
if ( count( $parts ) > 0 && 'rewrite' === $parts[0] ) {
9190
$this->render_rewrite( $parts[1] );
9291
return;
9392
}

includes/MslsOptions.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ public function get_available_languages(): array {
370370
/**
371371
* The 'blog'-slug-problem :/
372372
*
373-
* @param string $url
373+
* @param mixed $url
374374
* @param MslsOptions $options
375375
*
376376
* @return string

includes/MslsOptionsTax.php

+17-7
Original file line numberDiff line numberDiff line change
@@ -33,23 +33,33 @@ public static function create( $id = 0 ): OptionsTaxInterface {
3333
switch ( $req ) {
3434
case 'category':
3535
$options = new MslsOptionsTaxTermCategory( $id );
36+
add_filter( 'msls_get_postlink', array( $options, 'check_base' ), 9, 2 );
3637
break;
3738
case 'post_tag':
3839
$options = new MslsOptionsTaxTerm( $id );
40+
add_filter( 'msls_get_postlink', array( $options, 'check_base' ), 9, 2 );
3941
break;
4042
default:
41-
$options = new MslsOptionsTax( $id );
43+
global $wp_rewrite;
44+
45+
$options = new MslsOptionsTax( $id );
46+
$options->with_front = ! empty( $wp_rewrite->extra_permastructs[ $options->get_tax_query() ]['with_front'] );
4247
}
4348

44-
if ( method_exists( $options, 'check_base' ) ) {
45-
add_filter( 'msls_get_postlink', array( $options, 'check_base' ), 9, 2 );
46-
} else {
47-
global $wp_rewrite;
49+
return $options;
50+
}
4851

49-
$options->with_front = ! empty( $wp_rewrite->extra_permastructs[ $options->get_tax_query() ]['with_front'] );
52+
/**
53+
* @param int $id
54+
*
55+
* @return string
56+
*/
57+
public function get_content_type( int $id ): string {
58+
if ( is_admin() ) {
59+
return msls_content_types()->acl_request();
5060
}
5161

52-
return $options;
62+
return ( is_category() ? 'category' : is_tag( $id ) ) ? 'post_tag' : '';
5363
}
5464

5565
/**

includes/MslsRequest.php

+11-6
Original file line numberDiff line numberDiff line change
@@ -17,29 +17,34 @@ public static function get_config( string $name ): array {
1717
return $config;
1818
}
1919

20-
public static function has_var( string $name, ?int $input_type = null ): bool {
20+
public static function has_var( string $var_name, ?int $input_type = null ): bool {
2121
if ( null === $input_type ) {
2222
try {
23-
list( $input_type, ) = self::get_config( $name );
23+
list( $input_type, ) = self::get_config( $var_name );
2424
} catch ( \InvalidArgumentException $e ) {
2525
return false;
2626
}
2727
}
2828

29-
return filter_has_var( $input_type, $name );
29+
return filter_has_var( $input_type, $var_name );
3030
}
3131

3232
/**
3333
* @return mixed
3434
*/
35-
public static function get_var( string $name, ?int $input_type = null ) {
35+
public static function get_var( string $var_name, ?int $input_type = null ) {
3636
try {
37-
list($type, $filter) = self::get_config( $name );
37+
list($type, $filter) = self::get_config( $var_name );
3838
} catch ( \InvalidArgumentException $e ) {
3939
return null;
4040
}
4141

42-
return filter_input( $input_type ?? $type, $name, $filter );
42+
$type = $input_type ?? $type;
43+
if ( in_array( $type, array( INPUT_POST, INPUT_GET, INPUT_COOKIE, INPUT_ENV, INPUT_SERVER ), true ) ) {
44+
return filter_input( $type, $var_name, $filter );
45+
}
46+
47+
return null;
4348
}
4449

4550
/**

includes/MslsSqlCacher.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* @example https://gist.githubusercontent.com/lloc/2c232cef3f910acf692f/raw/91e5fe9ada922a82a32b83eaabad1e2a2ee50338/MslsSqlCacher.php
99
*
1010
* @method mixed get_var( string $sql )
11-
* @method array get_results( string $sql )
11+
* @method mixed[] get_results( string $sql )
1212
* @method string prepare( string $sql, mixed $a, $b = '', $c = '' )
1313
* @method mixed query( string $sql )
1414
* @property string $posts

phpstan.neon.dist

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
parameters:
22
level: 6
33
inferPrivatePropertyTypeFromConstructor: true
4+
treatPhpDocTypesAsCertain: false
45
paths:
56
- MultisiteLanguageSwitcher.php
67
- includes

0 commit comments

Comments
 (0)