15 Commits

Author SHA1 Message Date
9d1934a6d7 prepare release of v1.2.2
All checks were successful
continuous-integration/drone/push Build is passing
2024-03-02 11:14:15 +01:00
167433a80b ci: update actions, use Node v20, add PHP 8.3 2024-03-02 11:03:35 +01:00
8cb71df6fe deps: update dev-dependencies 2024-03-02 11:02:08 +01:00
b9491a4260 ci: update Drone CI pipeline
All checks were successful
continuous-integration/drone/push Build is passing
2023-11-09 18:25:01 +01:00
deedcf4a87 update deprecated get_terms() syntax
Some checks reported errors
continuous-integration/drone/push Build was killed
The old-style syntax was deprecated in WP 4.5. We already require 4.7,
so there is no need to keep the deprecated parameter style.
2023-11-09 18:24:33 +01:00
3f8c9acdc0 add more output sanitization 2023-11-09 18:24:24 +01:00
61ba951f0b update code style to WPCS v3.0 2023-11-09 18:19:42 +01:00
a1a3117141 ci: test against WP 6.4
Some checks failed
continuous-integration/drone/push Build is failing
2023-11-09 18:11:03 +01:00
4311494e4a declare compatibility with WP 6.2
All checks were successful
continuous-integration/drone/push Build is passing
2023-05-01 18:21:01 +02:00
30ad3e9408 dev-dependency updates 2023-05-01 18:19:08 +02:00
2262eba822 declare compatibility with WP 6.1
All checks were successful
continuous-integration/drone/push Build is passing
2022-11-03 17:36:11 +01:00
1f32adbd72 test: use stub method set_up() in unit tests
All checks were successful
continuous-integration/drone/push Build is passing
2022-11-03 17:34:40 +01:00
8c9f98e80b update dev-dependencies
All checks were successful
continuous-integration/drone/push Build is passing
2022-11-03 17:12:42 +01:00
01cb47315a declare compatibility with WP 6.0
All checks were successful
continuous-integration/drone/push Build is passing
2022-05-28 19:00:01 +02:00
5a1320c365 add testbed for WP 5.9 and PHP 8.0, update actions
All checks were successful
continuous-integration/drone/push Build is passing
2022-05-14 18:26:01 +02:00
12 changed files with 65 additions and 40 deletions

View File

@ -8,17 +8,17 @@ steps:
commands: commands:
- composer install --ignore-platform-req=php - composer install --ignore-platform-req=php
- name: lint-php - name: lint-php
image: php:7.4 image: php:8.2
commands: commands:
- ./vendor/bin/phpcs - ./vendor/bin/phpcs
depends_on: depends_on:
- composer-install - composer-install
- name: node-install - name: node-install
image: node:16 image: node:18
commands: commands:
- npm install - npm install
- name: lint-assets - name: lint-assets
image: node:16 image: node:20
commands: commands:
- npx eslint scripts/block.js - npx eslint scripts/block.js
- npx eslint scripts/liveticker.js - npx eslint scripts/liveticker.js

View File

@ -6,13 +6,19 @@ jobs:
strategy: strategy:
matrix: matrix:
include: include:
- php: '7.4' - php: '8.3'
wordpress: '5.8' wordpress: '6.4'
- php: '8.2'
wordpress: '6.3'
- php: '8.1'
wordpress: '6.1'
- php: '8.0'
wordpress: '5.9'
- php: '5.6' - php: '5.6'
wordpress: '4.7' wordpress: '4.7'
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v4
- name: Setup PHP - name: Setup PHP
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
@ -31,16 +37,16 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v4
- name: Setup PHP - name: Setup PHP
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: '7.4' php-version: '8.2'
tools: composer tools: composer
- name: Setup Node - name: Setup Node
uses: actions/setup-node@v2 uses: actions/setup-node@v3
with: with:
node-version: '14' node-version: '20'
- name: Install - name: Install
run: | run: |
composer install --no-interaction composer install --no-interaction
@ -55,7 +61,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v4
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Analyze with SonarCloud - name: Analyze with SonarCloud

View File

@ -9,11 +9,11 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v4
- name: Setup PHP - name: Setup PHP
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:
php-version: '7.4' php-version: '8.0'
tools: composer tools: composer
- name: Install - name: Install
run: composer install --no-interaction run: composer install --no-interaction

View File

@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v4
- name: Setup PHP - name: Setup PHP
uses: shivammathur/setup-php@v2 uses: shivammathur/setup-php@v2
with: with:

View File

@ -9,9 +9,9 @@
* Contributors: Stefan Kalscheuer * Contributors: Stefan Kalscheuer
* Tags: liveticker, feed, rss * Tags: liveticker, feed, rss
* Requires at least: 4.7 * Requires at least: 4.7
* Tested up to: 5.9 * Tested up to: 6.4
* Requires PHP: 5.6 * Requires PHP: 5.6
* Stable tag: 1.2.1 * Stable tag: 1.2.2
* License: GPLv2 or later * License: GPLv2 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.html * License URI: http://www.gnu.org/licenses/gpl-2.0.html
@ -80,6 +80,12 @@ caching time of 12 hours obviously makes no sense.
## Changelog ## Changelog
### 1.2.2 - 2023-03-02
* Update use of deprecated WP core functions
* Extend output sanitization
* Tested with WP 6.4
### 1.2.1 - 2022-02-01 ### 1.2.1 - 2022-02-01
* Fix issue with limit in Gutenberg block. * Fix issue with limit in Gutenberg block.

View File

@ -1,6 +1,6 @@
{ {
"name": "stklcode/stklcode-liveticker", "name": "stklcode/stklcode-liveticker",
"version": "1.2.1", "version": "1.2.2",
"description": "A simple Liveticker for Wordpress.", "description": "A simple Liveticker for Wordpress.",
"keywords": [ "keywords": [
"wordpress", "wordpress",
@ -21,14 +21,14 @@
"composer/installers": "~1.12" "composer/installers": "~1.12"
}, },
"require-dev": { "require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.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", "phpunit/phpunit": "^5|^6|^7|^8|^9",
"slowprog/composer-copy-file": "~0.3", "slowprog/composer-copy-file": "~0.3",
"squizlabs/php_codesniffer": "^3.6", "squizlabs/php_codesniffer": "^3.9",
"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": [
@ -65,5 +65,11 @@
"minifyjs scripts/block.js > scripts/block.min.js", "minifyjs scripts/block.js > scripts/block.min.js",
"minifyjs scripts/liveticker.js > scripts/liveticker.min.js" "minifyjs scripts/liveticker.js > scripts/liveticker.min.js"
] ]
},
"config": {
"allow-plugins": {
"composer/installers": true,
"dealerdirect/phpcodesniffer-composer-installer": true
}
} }
} }

View File

@ -26,7 +26,7 @@ class SCLiveticker {
* *
* @var string OPTIONS * @var string OPTIONS
*/ */
const VERSION = '1.2.1'; const VERSION = '1.2.2';
/** /**
* Options tag. * Options tag.

View File

@ -95,15 +95,16 @@ class Widget extends WP_Widget {
$wp_query = new WP_Query( $args ); $wp_query = new WP_Query( $args );
$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>';
@ -145,7 +146,13 @@ class Widget extends WP_Widget {
$highlight = isset( $instance['highlight'] ) ? esc_attr( $instance['highlight'] ) : '0'; $highlight = isset( $instance['highlight'] ) ? esc_attr( $instance['highlight'] ) : '0';
$highlight_time = isset( $instance['highlight_time'] ) ? esc_attr( $instance['highlight_time'] ) : '0'; $highlight_time = isset( $instance['highlight_time'] ) ? esc_attr( $instance['highlight_time'] ) : '0';
$ajax = isset( $instance['ajax'] ) ? esc_attr( $instance['ajax'] ) : '0'; $ajax = isset( $instance['ajax'] ) ? esc_attr( $instance['ajax'] ) : '0';
$categories = get_terms( 'scliveticker_ticker', 'orderby=name&order=ASC' ); $categories = get_terms(
array(
'taxonomy' => 'scliveticker_ticker',
'orderby' => 'name',
'order' => 'ASC',
)
);
include SCLIVETICKER_DIR . 'views/widget-form.php'; include SCLIVETICKER_DIR . 'views/widget-form.php';
} }

View File

@ -1,13 +1,13 @@
{ {
"name": "stklcode-liveticker", "name": "stklcode-liveticker",
"version": "1.2.1", "version": "1.2.2",
"description": "A simple Liveticker for Wordpress.", "description": "A simple Liveticker for Wordpress.",
"author": "Stefan Kalscheuer", "author": "Stefan Kalscheuer",
"license": "GPL-2.0+", "license": "GPL-2.0+",
"devDependencies": { "devDependencies": {
"@wordpress/eslint-plugin": "^9", "@wordpress/eslint-plugin": "^17",
"@wordpress/stylelint-config": "^19", "@wordpress/stylelint-config": "^21",
"eslint": "^7", "eslint": "^8",
"stylelint": "^13" "stylelint": "^14"
} }
} }

View File

@ -9,7 +9,7 @@
* @wordpress-plugin * @wordpress-plugin
* Plugin Name: Liveticker (by stklcode) * Plugin Name: Liveticker (by stklcode)
* Description: A simple Liveticker for WordPress. * Description: A simple Liveticker for WordPress.
* Version: 1.2.1 * Version: 1.2.2
* Author: Stefan Kalscheuer * Author: Stefan Kalscheuer
* Author URI: https://www.stklcode.de * Author URI: https://www.stklcode.de
* Text Domain: stklcode-liveticker * Text Domain: stklcode-liveticker
@ -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 ) ) )
); );
} }
} }

View File

@ -24,8 +24,8 @@ class Test_API extends WP_UnitTestCase {
* *
* @return void * @return void
*/ */
public function setUp() { public function set_up() {
parent::setUp(); parent::set_up();
global $wp_rest_server; global $wp_rest_server;
$wp_rest_server = new WP_REST_Server(); $wp_rest_server = new WP_REST_Server();
do_action( 'rest_api_init' ); do_action( 'rest_api_init' );

View File

@ -54,10 +54,10 @@ if ( ! defined( 'ABSPATH' ) ) {
<?php esc_html_e( 'all', 'stklcode-liveticker' ); ?> <?php esc_html_e( 'all', 'stklcode-liveticker' ); ?>
</option> </option>
<?php <?php
for ( $i = 1; $i <= 10; $i ++ ) { for ( $i = 1; $i <= 10; $i++ ) {
printf( printf(
'<option value="%d"%s>%d</option>', '<option value="%d"%s>%d</option>',
$i, intval( $i ),
( $i === $count ) ? ' selected' : '', ( $i === $count ) ? ' selected' : '',
intval( $i ) intval( $i )
); );