From c5d945fba9a58b8b990fd556685941a61611c16b Mon Sep 17 00:00:00 2001
From: Stefan Kalscheuer
Date: Sun, 12 Nov 2017 11:33:23 +0100
Subject: [PATCH] Overhauled Widget class
---
includes/class-wpliveticker2-admin.php | 4 +-
includes/class-wpliveticker2-system.php | 1 -
includes/class-wpliveticker2-widget.php | 236 ++++++++++++++++++++++++
includes/class-wpliveticker2.php | 8 +-
includes/widget.php | 192 -------------------
wp-liveticker2.php | 13 +-
6 files changed, 250 insertions(+), 204 deletions(-)
create mode 100644 includes/class-wpliveticker2-widget.php
delete mode 100644 includes/widget.php
diff --git a/includes/class-wpliveticker2-admin.php b/includes/class-wpliveticker2-admin.php
index 2eb414c..aad9b88 100644
--- a/includes/class-wpliveticker2-admin.php
+++ b/includes/class-wpliveticker2-admin.php
@@ -25,8 +25,8 @@ class WPLiveticker2_Admin extends WPLiveticker2 {
$total_files = wp_count_posts( 'wplt2_tick' );
echo '';
- echo '' . $total_files->publish . ' | ';
- echo '' . __( 'Ticks', 'wplt2' ) . ' | ';
+ echo '' . esc_html( $total_files->publish ) . ' | ';
+ echo '' . esc_html__( 'Ticks', 'wplt2' ) . ' | ';
echo '
';
}
}
diff --git a/includes/class-wpliveticker2-system.php b/includes/class-wpliveticker2-system.php
index 7e429ec..e96fb31 100644
--- a/includes/class-wpliveticker2-system.php
+++ b/includes/class-wpliveticker2-system.php
@@ -12,7 +12,6 @@ defined( 'ABSPATH' ) || exit;
/**
* WP Liveticker 2 system configuration.
- *
*/
class WPLiveticker2_System extends WPLiveticker2 {
diff --git a/includes/class-wpliveticker2-widget.php b/includes/class-wpliveticker2-widget.php
new file mode 100644
index 0000000..191874d
--- /dev/null
+++ b/includes/class-wpliveticker2-widget.php
@@ -0,0 +1,236 @@
+
+
+
+
+
+
+
+ ' . esc_html__( 'show all', 'wplt2' ) . '...
';
+ }
+
+ echo $after_widget;
+ ?>
+
+
+
+
+
+ '',
+ 'category' => '',
+ 'count' => '',
+ 'link' => '',
+ 'highlight' => '0',
+ 'highlight_time' => '0',
+ 'ajax' => '0',
+ );
+ return array_merge( $default, $instance );
+ }
+}
diff --git a/includes/class-wpliveticker2.php b/includes/class-wpliveticker2.php
index 6d7abce..f5d5126 100644
--- a/includes/class-wpliveticker2.php
+++ b/includes/class-wpliveticker2.php
@@ -158,8 +158,8 @@ class WPLiveticker2 {
'taxonomy' => 'wplt2_ticker',
'field' => 'slug',
'terms' => $atts['ticker'],
- )
- )
+ ),
+ ),
);
$wp_query = new WP_Query( $args );
@@ -175,10 +175,10 @@ class WPLiveticker2 {
$output .= '';
// Show RSS feed link, if configured.
- if (1 === self::$_options['show_feed']) {
+ if ( 1 === self::$_options['show_feed'] ) {
$output .= '';
}
- }
+ }// End if().
return $output;
}
diff --git a/includes/widget.php b/includes/widget.php
deleted file mode 100644
index 3671a57..0000000
--- a/includes/widget.php
+++ /dev/null
@@ -1,192 +0,0 @@
-
-
-
-
-
-
-
- ' . __( 'show all', 'wplt2' ) . '...';
- }
-
- echo $after_widget;
- ?>
-
-
-
-
-
-