Converted array() to []
This commit is contained in:
@@ -14,23 +14,23 @@ class Display {
|
||||
public static function load() {
|
||||
if (is_admin()) return;
|
||||
|
||||
add_action('wp', array(__CLASS__, 'init'));
|
||||
add_action('wp', [__CLASS__, 'init']);
|
||||
}
|
||||
|
||||
static function init() {
|
||||
if (!\OgreAlert\Alert::has_active()) return;
|
||||
|
||||
add_action('wp_enqueue_scripts', array(__CLASS__, 'enqueue_scripts'));
|
||||
add_action('wp_enqueue_scripts', [__CLASS__, 'enqueue_scripts']);
|
||||
|
||||
$position = \OgreAlert\Settings::get('message_position');
|
||||
switch ($position) {
|
||||
case 'top':
|
||||
case 'bottom':
|
||||
case 'footer':
|
||||
add_action('wp_footer', array(__CLASS__, 'display_alerts'));
|
||||
add_action('wp_footer', [__CLASS__, 'display_alerts']);
|
||||
break;
|
||||
case 'custom':
|
||||
add_action('display_alerts', array(__CLASS__, 'display_alerts'));
|
||||
add_action('display_alerts', [__CLASS__, 'display_alerts']);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -38,14 +38,14 @@ class Display {
|
||||
}
|
||||
|
||||
static function enqueue_scripts() {
|
||||
wp_enqueue_style('ogrealert', \OgreAlert\Settings::get('dir') . 'assets/sass/style.css', array(), \OgreAlert\Settings::get('version'), 'all');
|
||||
wp_enqueue_script('ogrealert', \OgreAlert\Settings::get('dir') . 'assets/js/frontend.js', array('jquery'), \OgreAlert\Settings::get('version'), true);
|
||||
wp_localize_script('ogrealert', 'ogrealert', array(
|
||||
wp_enqueue_style('ogrealert', \OgreAlert\Settings::get('dir') . 'assets/sass/style.css', [], \OgreAlert\Settings::get('version'), 'all');
|
||||
wp_enqueue_script('ogrealert', \OgreAlert\Settings::get('dir') . 'assets/js/frontend.js', ['jquery'], \OgreAlert\Settings::get('version'), true);
|
||||
wp_localize_script('ogrealert', 'ogrealert', [
|
||||
'text_color' => \OgreAlert\Settings::get('message_text_color'),
|
||||
'background_color' => \OgreAlert\Settings::get('message_background_color'),
|
||||
'transition_duration' => intval(\OgreAlert\Settings::get('message_transition_duration')),
|
||||
'transition_animation' => \OgreAlert\Settings::get('message_transition_animation'),
|
||||
));
|
||||
]);
|
||||
}
|
||||
|
||||
static function display_alerts() {
|
||||
@@ -53,7 +53,7 @@ class Display {
|
||||
|
||||
self::load_template('loop-start');
|
||||
foreach (\OgreAlert\Alert::get_active() as $id) {
|
||||
self::load_template('alert', \OgreAlert\Priority::get($id), true, array('id' => $id));
|
||||
self::load_template('alert', \OgreAlert\Priority::get($id), true, ['id' => $id]);
|
||||
}
|
||||
self::load_template('loop-end');
|
||||
}
|
||||
@@ -69,7 +69,7 @@ class Display {
|
||||
return $classes;
|
||||
}
|
||||
|
||||
private static function load_template($filename, $filepart = '', $echo = true, $vars = array()) {
|
||||
private static function load_template($filename, $filepart = '', $echo = true, $vars = []) {
|
||||
$path = \OgreAlert\Settings::get('path') . 'templates/' . $filename . '-' . $filepart . '.php';
|
||||
if (!file_exists($path)) {
|
||||
$path = \OgreAlert\Settings::get('path') . 'templates/' . $filename . '.php';
|
||||
|
||||
Reference in New Issue
Block a user