update code style to WPCS v3.0
This commit is contained in:
parent
a1a3117141
commit
61ba951f0b
2
.github/workflows/test.yml
vendored
2
.github/workflows/test.yml
vendored
@ -39,7 +39,7 @@ jobs:
|
|||||||
- name: Setup PHP
|
- name: Setup PHP
|
||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
with:
|
with:
|
||||||
php-version: '8.0'
|
php-version: '8.2'
|
||||||
tools: composer
|
tools: composer
|
||||||
- name: Setup Node
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
|
@ -21,14 +21,14 @@
|
|||||||
"composer/installers": "~1.12"
|
"composer/installers": "~1.12"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"dealerdirect/phpcodesniffer-composer-installer": "^v0.7",
|
"dealerdirect/phpcodesniffer-composer-installer": "^v1.0",
|
||||||
"matthiasmullie/minify": "^1.3",
|
"matthiasmullie/minify": "^1.3",
|
||||||
"phpcompatibility/phpcompatibility-wp": "^2.1",
|
"phpcompatibility/phpcompatibility-wp": "^2.1",
|
||||||
"phpunit/phpunit": "^5|^6|^7|^8|^9",
|
"phpunit/phpunit": "^5|^6|^7|^8|^9",
|
||||||
"slowprog/composer-copy-file": "~0.3",
|
"slowprog/composer-copy-file": "~0.3",
|
||||||
"squizlabs/php_codesniffer": "^3.7",
|
"squizlabs/php_codesniffer": "^3.7",
|
||||||
"wp-coding-standards/wpcs": "^2.3",
|
"wp-coding-standards/wpcs": "^3.0",
|
||||||
"yoast/phpunit-polyfills": "^1.0"
|
"yoast/phpunit-polyfills": "^2.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"post-install-cmd": [
|
"post-install-cmd": [
|
||||||
|
@ -97,13 +97,14 @@ class Widget extends WP_Widget {
|
|||||||
$cnt = 0;
|
$cnt = 0;
|
||||||
while ( $wp_query->have_posts() && ( $count <= 0 || ++$cnt < $count ) ) {
|
while ( $wp_query->have_posts() && ( $count <= 0 || ++$cnt < $count ) ) {
|
||||||
$wp_query->the_post();
|
$wp_query->the_post();
|
||||||
// @codingStandardsIgnoreLine
|
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
|
||||||
echo SCLiveticker::tick_html_widget(
|
echo SCLiveticker::tick_html_widget(
|
||||||
esc_html( get_the_time( 'd.m.Y - H:i' ) ),
|
esc_html( get_the_time( 'd.m.Y - H:i' ) ),
|
||||||
get_the_title(),
|
get_the_title(),
|
||||||
( '1' === $highlight && get_the_time( 'U' ) > ( time() - $highlight_time ) ),
|
( '1' === $highlight && get_the_time( 'U' ) > ( time() - $highlight_time ) ),
|
||||||
get_the_ID()
|
get_the_ID()
|
||||||
);
|
);
|
||||||
|
// phpcs:enable
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '</ul>';
|
echo '</ul>';
|
||||||
|
@ -64,11 +64,11 @@ spl_autoload_register( 'scliveticker_autoload' );
|
|||||||
/**
|
/**
|
||||||
* Autoloader for Liveticker classes.
|
* Autoloader for Liveticker classes.
|
||||||
*
|
*
|
||||||
* @param string $class Name of the class to load.
|
* @param string $class_name Name of the class to load.
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function scliveticker_autoload( $class ) {
|
function scliveticker_autoload( $class_name ) {
|
||||||
$plugin_classes = array(
|
$plugin_classes = array(
|
||||||
'SCLiveticker\\SCLiveticker',
|
'SCLiveticker\\SCLiveticker',
|
||||||
'SCLiveticker\\Admin',
|
'SCLiveticker\\Admin',
|
||||||
@ -76,11 +76,11 @@ function scliveticker_autoload( $class ) {
|
|||||||
'SCLiveticker\\System',
|
'SCLiveticker\\System',
|
||||||
'SCLiveticker\\Widget',
|
'SCLiveticker\\Widget',
|
||||||
);
|
);
|
||||||
if ( in_array( $class, $plugin_classes, true ) ) {
|
if ( in_array( $class_name, $plugin_classes, true ) ) {
|
||||||
require_once sprintf(
|
require_once sprintf(
|
||||||
'%s/includes/class-%s.php',
|
'%s/includes/class-%s.php',
|
||||||
SCLIVETICKER_DIR,
|
SCLIVETICKER_DIR,
|
||||||
strtolower( str_replace( '_', '-', substr( $class, 13 ) ) )
|
strtolower( str_replace( '_', '-', substr( $class_name, 13 ) ) )
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user