raise required PHP version to 5.6

This commit is contained in:
2020-04-09 14:26:20 +02:00
parent ca5c81356b
commit 4463fa7f1f
9 changed files with 62 additions and 53 deletions

View File

@ -4,9 +4,11 @@
*
* This file contains the derived class for the plugin's administration features.
*
* @package Liveticker
* @package SCLiveticker
*/
namespace SCLiveticker;
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
@ -15,7 +17,7 @@ if ( ! defined( 'ABSPATH' ) ) {
/**
* Liveticker admin configuration.
*/
class SCLiveticker_Admin extends SCLiveticker {
class Admin extends SCLiveticker {
/**
* Add to Right Now Widget
*

View File

@ -4,14 +4,19 @@
*
* This file contains the plugin's base class.
*
* @package Liveticker
* @package SCLiveticker
*/
namespace SCLiveticker;
use WP_Query;
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Liveticker.
*/
@ -92,11 +97,11 @@ class SCLiveticker {
// Admin only actions.
if ( is_admin() ) {
// Add dashboard "right now" functionality.
add_action( 'right_now_content_table_end', array( 'SCLiveticker_Admin', 'dashboard_right_now' ) );
add_action( 'right_now_content_table_end', array( 'SCLiveticker\\Admin', 'dashboard_right_now' ) );
// Settings.
add_action( 'admin_init', array( 'SCLiveticker_Admin', 'register_settings' ) );
add_action( 'admin_menu', array( 'SCLiveticker_Admin', 'register_settings_page' ) );
add_action( 'admin_init', array( 'SCLiveticker\\Admin', 'register_settings' ) );
add_action( 'admin_menu', array( 'SCLiveticker\\Admin', 'register_settings_page' ) );
}
}
@ -457,19 +462,7 @@ class SCLiveticker {
* @since 1.1
*/
private static function block_present() {
// We are in WP 5.x environment and blocks are generally present.
if ( function_exists( 'has_blocks' ) && has_blocks() ) {
/*
* The slightly faster call to has_block( 'scliveticker/ticker' ) produces an "undefined function" error for
* no good reason. Iteration over pased blocks however works fine.
*/
foreach ( parse_blocks( get_post()->post_content ) as $b ) {
if ( 'scliveticker/ticker' === $b['blockName'] ) {
return true;
}
}
}
return false;
return function_exists( 'has_block' ) && // We are in WP 5.x environment.
has_block( 'scliveticker/ticker' ); // Specific block is present.
}
}

View File

@ -4,9 +4,13 @@
*
* This file contains the derived class for the plugin's system operations.
*
* @package Liveticker
* @package SCLiveticker
*/
namespace SCLiveticker;
use WP_Query;
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
@ -15,7 +19,7 @@ if ( ! defined( 'ABSPATH' ) ) {
/**
* Liveticker system configuration.
*/
class SCLiveticker_System extends SCLiveticker {
class System extends SCLiveticker {
/**
* Activation hook.

View File

@ -4,17 +4,22 @@
*
* This file contains the liveticker widget.
*
* @package Liveticker
* @package SCLiveticker
*/
namespace SCLiveticker;
use WP_Query;
use WP_Widget;
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Class SCLiveticker_Widget.
* Class Widget.
*/
class SCLiveticker_Widget extends WP_Widget {
class Widget extends WP_Widget {
/**
* SCLiveticker_Widget constructor.