Renamed Plugin and changed slug to stklcode-liveticker
Due to naming conflicts with the original wp-liveticker plugin this one is now renamed to a unique identifier.
This commit is contained in:
@ -1,10 +1,10 @@
|
||||
<?php
|
||||
/**
|
||||
* WP Liveticker 2: Plugin admin class.
|
||||
* Liveticker: Plugin admin class.
|
||||
*
|
||||
* This file contains the derived class for the plugin's administration features.
|
||||
*
|
||||
* @package WPLiveticker2
|
||||
* @package Liveticker
|
||||
*/
|
||||
|
||||
// Exit if accessed directly.
|
||||
@ -13,22 +13,20 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
}
|
||||
|
||||
/**
|
||||
* WP Liveticker 2 admin configuration.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* Liveticker admin configuration.
|
||||
*/
|
||||
class WPLiveticker2_Admin extends WPLiveticker2 {
|
||||
class SCLiveticker_Admin extends SCLiveticker {
|
||||
/**
|
||||
* Add to Right Now Widget
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function dashboard_right_now() {
|
||||
$total_files = wp_count_posts( 'wplt2_tick' );
|
||||
$total_files = wp_count_posts( 'scliveticker_tick' );
|
||||
|
||||
echo '<tr>';
|
||||
echo '<td class="first b b-tags"><a href="edit.php?post_type=wplt2_tick">' . esc_html( $total_files->publish ) . '</a></td>';
|
||||
echo '<td class="t tags"><a href="edit.php?post_type=wplt2_tick">' . esc_html__( 'Ticks', 'wplt2' ) . '</a></td>';
|
||||
echo '<td class="first b b-tags"><a href="edit.php?post_type=scliveticker_tick">' . esc_html( $total_files->publish ) . '</a></td>';
|
||||
echo '<td class="t tags"><a href="edit.php?post_type=scliveticker_tick">' . esc_html__( 'Ticks', 'stklcode-liveticker' ) . '</a></td>';
|
||||
echo '</tr>';
|
||||
}
|
||||
|
||||
@ -39,13 +37,13 @@ class WPLiveticker2_Admin extends WPLiveticker2 {
|
||||
*/
|
||||
public static function register_settings_page() {
|
||||
add_submenu_page(
|
||||
'edit.php?post_type=wplt2_tick',
|
||||
'Liveticker2 ' . __( 'Settings', 'wplt2' ),
|
||||
__( 'Settings', 'wplt2' ),
|
||||
'edit.php?post_type=scliveticker_tick',
|
||||
'Liveticker ' . __( 'Settings', 'stklcode-liveticker' ),
|
||||
__( 'Settings', 'stklcode-liveticker' ),
|
||||
'manage_options',
|
||||
'wplt2_settings',
|
||||
'scliveticker_settings',
|
||||
array(
|
||||
'WPLiveticker2_Admin',
|
||||
__CLASS__,
|
||||
'settings_page',
|
||||
)
|
||||
);
|
||||
@ -58,53 +56,53 @@ class WPLiveticker2_Admin extends WPLiveticker2 {
|
||||
*/
|
||||
public static function register_settings() {
|
||||
register_setting(
|
||||
'wplt2_settings',
|
||||
'wplt2',
|
||||
array( 'WPLiveticker2_Admin', 'validate_settings' )
|
||||
'scliveticker_settings',
|
||||
self::OPTION,
|
||||
array( __CLASS__, 'validate_settings' )
|
||||
);
|
||||
|
||||
// Form sections.
|
||||
add_settings_section(
|
||||
'wplt2_settings_general',
|
||||
__( 'General', 'wplt2' ),
|
||||
array( 'WPLiveticker2_Admin', 'settings_general_section' ),
|
||||
'wplt2-settings-page'
|
||||
'scliveticker_settings_general',
|
||||
__( 'General', 'stklcode-liveticker' ),
|
||||
array( __CLASS__, 'settings_general_section' ),
|
||||
'scliveticker-settings-page'
|
||||
);
|
||||
|
||||
// Form fields.
|
||||
add_settings_field(
|
||||
'enable_ajax',
|
||||
__( 'Use AJAX', 'wplt2' ),
|
||||
array( 'WPLiveticker2_Admin', 'settings_enable_ajax_field' ),
|
||||
'wplt2-settings-page',
|
||||
'wplt2_settings_general',
|
||||
__( 'Use AJAX', 'stklcode-liveticker' ),
|
||||
array( __CLASS__, 'settings_enable_ajax_field' ),
|
||||
'scliveticker-settings-page',
|
||||
'scliveticker_settings_general',
|
||||
array( 'label_for' => esc_attr( self::OPTION ) . '-enable-ajax' )
|
||||
);
|
||||
|
||||
add_settings_field(
|
||||
'poll_interval',
|
||||
__( 'AJAX poll interval', 'wplt2' ),
|
||||
array( 'WPLiveticker2_Admin', 'settings_poll_interval_field' ),
|
||||
'wplt2-settings-page',
|
||||
'wplt2_settings_general',
|
||||
__( 'AJAX poll interval', 'stklcode-liveticker' ),
|
||||
array( __CLASS__, 'settings_poll_interval_field' ),
|
||||
'scliveticker-settings-page',
|
||||
'scliveticker_settings_general',
|
||||
array( 'label_for' => esc_attr( self::OPTION ) . '-poll-interval' )
|
||||
);
|
||||
|
||||
add_settings_field(
|
||||
'enable_css',
|
||||
__( 'Default CSS Styles', 'wplt2' ),
|
||||
array( 'WPLiveticker2_Admin', 'settings_enable_css_field' ),
|
||||
'wplt2-settings-page',
|
||||
'wplt2_settings_general',
|
||||
__( 'Default CSS Styles', 'stklcode-liveticker' ),
|
||||
array( __CLASS__, 'settings_enable_css_field' ),
|
||||
'scliveticker-settings-page',
|
||||
'scliveticker_settings_general',
|
||||
array( 'label_for' => esc_attr( self::OPTION ) . '-enable-css' )
|
||||
);
|
||||
|
||||
add_settings_field(
|
||||
'show_feed',
|
||||
__( 'Show RSS feed', 'wplt2' ),
|
||||
array( 'WPLiveticker2_Admin', 'settings_show_feed_field' ),
|
||||
'wplt2-settings-page',
|
||||
'wplt2_settings_general',
|
||||
__( 'Show RSS feed', 'stklcode-liveticker' ),
|
||||
array( __CLASS__, 'settings_show_feed_field' ),
|
||||
'scliveticker-settings-page',
|
||||
'scliveticker_settings_general',
|
||||
array( 'label_for' => esc_attr( self::OPTION ) . '-show-feed' )
|
||||
);
|
||||
}
|
||||
@ -134,8 +132,8 @@ class WPLiveticker2_Admin extends WPLiveticker2 {
|
||||
$checked = self::$_options['enable_ajax'];
|
||||
|
||||
echo '<input id="' . esc_attr( self::OPTION ) . '-enable-ajax" type="checkbox" name="' . esc_attr( self::OPTION ) . '[enable_ajax]" value="1" ' . checked( $checked, 1, false ) . '> ';
|
||||
esc_html_e( 'Enable', 'wplt2' );
|
||||
echo '<p class="description">' . esc_html__( 'Disable this option to not use AJAX update. This means all liveticker widgets and shortcodes are only updated once on site load.', 'wplt2' ) . '</p>';
|
||||
esc_html_e( 'Enable', 'stklcode-liveticker' );
|
||||
echo '<p class="description">' . esc_html__( 'Disable this option to not use AJAX update. This means all liveticker widgets and shortcodes are only updated once on site load.', 'stklcode-liveticker' ) . '</p>';
|
||||
}
|
||||
|
||||
/**
|
||||
@ -147,8 +145,8 @@ class WPLiveticker2_Admin extends WPLiveticker2 {
|
||||
$poll_interval = self::$_options['poll_interval'];
|
||||
|
||||
echo '<input id="' . esc_attr( self::OPTION ) . '-poll-interval" type="number" name="' . esc_attr( self::OPTION ) . '[poll_interval]" value="' . esc_attr( $poll_interval ) . '"> ';
|
||||
esc_html_e( 'seconds', 'wplt2' );
|
||||
echo '<p class="description">' . esc_html__( 'Interval (in seconds) to update ticker if AJAX is enabled.', 'wplt2' ) . '</p>';
|
||||
esc_html_e( 'seconds', 'stklcode-liveticker' );
|
||||
echo '<p class="description">' . esc_html__( 'Interval (in seconds) to update ticker if AJAX is enabled.', 'stklcode-liveticker' ) . '</p>';
|
||||
}
|
||||
|
||||
|
||||
@ -161,8 +159,8 @@ class WPLiveticker2_Admin extends WPLiveticker2 {
|
||||
$checked = self::$_options['enable_css'];
|
||||
|
||||
echo '<input id="' . esc_attr( self::OPTION ) . '-enable-css" type="checkbox" name="' . esc_attr( self::OPTION ) . '[enable_css]" value="1" ' . checked( $checked, 1, false ) . ' /> ';
|
||||
esc_html_e( 'Enable', 'wplt2' );
|
||||
echo '<p class="description">' . esc_html__( 'Disable this option to remove the default styling CSS file.', 'wplt2' ) . '</p>';
|
||||
esc_html_e( 'Enable', 'stklcode-liveticker' );
|
||||
echo '<p class="description">' . esc_html__( 'Disable this option to remove the default styling CSS file.', 'stklcode-liveticker' ) . '</p>';
|
||||
}
|
||||
|
||||
/**
|
||||
@ -174,8 +172,8 @@ class WPLiveticker2_Admin extends WPLiveticker2 {
|
||||
$checked = self::$_options['show_feed'];
|
||||
|
||||
echo '<input id="' . esc_attr( self::OPTION ) . '-show-feed" type="checkbox" name="' . esc_attr( self::OPTION ) . '[show_feed]" value="1" ' . checked( $checked, 1, false ) . ' /> ';
|
||||
esc_html_e( 'Enable', 'wplt2' );
|
||||
echo '<p class="description">' . esc_html__( 'Can be overwritten in shortcode.', 'wplt2' ) . '</p>';
|
||||
esc_html_e( 'Enable', 'stklcode-liveticker' );
|
||||
echo '<p class="description">' . esc_html__( 'Can be overwritten in shortcode.', 'stklcode-liveticker' ) . '</p>';
|
||||
}
|
||||
|
||||
/**
|
||||
@ -184,7 +182,7 @@ class WPLiveticker2_Admin extends WPLiveticker2 {
|
||||
* @return void
|
||||
*/
|
||||
public static function settings_page() {
|
||||
include WPLT2_DIR . 'views/settings-page.php';
|
||||
include SCLIVETICKER_DIR . 'views/settings-page.php';
|
||||
}
|
||||
|
||||
/**
|
@ -1,10 +1,10 @@
|
||||
<?php
|
||||
/**
|
||||
* WP Liveticker 2: Plugin system class.
|
||||
* Liveticker: Plugin system class.
|
||||
*
|
||||
* This file contains the derived class for the plugin's system operations.
|
||||
*
|
||||
* @package WPLiveticker2
|
||||
* @package Liveticker
|
||||
*/
|
||||
|
||||
// Exit if accessed directly.
|
||||
@ -13,9 +13,9 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
}
|
||||
|
||||
/**
|
||||
* WP Liveticker 2 system configuration.
|
||||
* Liveticker system configuration.
|
||||
*/
|
||||
class WPLiveticker2_System extends WPLiveticker2 {
|
||||
class SCLiveticker_System extends SCLiveticker {
|
||||
|
||||
/**
|
||||
* Activation hook.
|
||||
@ -47,27 +47,27 @@ class WPLiveticker2_System extends WPLiveticker2 {
|
||||
*/
|
||||
public static function uninstall() {
|
||||
// Delete all ticks.
|
||||
$ticks = new WP_Query( array( 'post_type' => 'wplt2_tick' ) );
|
||||
$ticks = new WP_Query( array( 'post_type' => 'scliveticker_tick' ) );
|
||||
foreach ( $ticks->get_posts() as $tick ) {
|
||||
wp_delete_post( $tick->ID, true );
|
||||
}
|
||||
|
||||
// Temporarily register taxonomy to delete it.
|
||||
register_taxonomy( 'wplt2_ticker', array( 'wplt2_tick' ) );
|
||||
register_taxonomy( 'scliveticker_ticker', array( 'scliveticker_tick' ) );
|
||||
|
||||
// Delete tickers.
|
||||
$tickers = get_terms(
|
||||
array(
|
||||
'taxonomy' => 'wplt2_ticker',
|
||||
'taxonomy' => 'scliveticker_ticker',
|
||||
'hide_empty' => false,
|
||||
)
|
||||
);
|
||||
foreach ( $tickers as $ticker ) {
|
||||
wp_delete_term( $ticker->term_id, 'wplt2_ticker' );
|
||||
wp_delete_term( $ticker->term_id, 'scliveticker_ticker' );
|
||||
}
|
||||
|
||||
// Unregister taxonomy again.
|
||||
unregister_taxonomy( 'wplt2_ticker' );
|
||||
unregister_taxonomy( 'scliveticker_ticker' );
|
||||
|
||||
// Delete the option.
|
||||
delete_option( self::OPTION );
|
@ -1,10 +1,10 @@
|
||||
<?php
|
||||
/**
|
||||
* WP Liveticker 2: Widget class.
|
||||
* Liveticker: Widget class.
|
||||
*
|
||||
* This file contains the liveticker widget.
|
||||
*
|
||||
* @package WPLiveticker2
|
||||
* @package Liveticker
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
@ -12,12 +12,12 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Class WPLiveticker2_Widget.
|
||||
* Class SCLiveticker_Widget.
|
||||
*/
|
||||
class WPLiveticker2_Widget extends WP_Widget {
|
||||
class SCLiveticker_Widget extends WP_Widget {
|
||||
|
||||
/**
|
||||
* WPLiveticker2_Widget constructor.
|
||||
* SCLiveticker_Widget constructor.
|
||||
*/
|
||||
public function __construct() {
|
||||
parent::__construct( false, 'Liveticker' );
|
||||
@ -27,7 +27,7 @@ class WPLiveticker2_Widget extends WP_Widget {
|
||||
* Register the widget.
|
||||
*/
|
||||
public static function register() {
|
||||
register_widget( 'WPLiveticker2_Widget' );
|
||||
register_widget( __CLASS__ );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -40,21 +40,21 @@ class WPLiveticker2_Widget extends WP_Widget {
|
||||
* @return void
|
||||
*/
|
||||
public function widget( $args, $instance ) {
|
||||
// Notify WPLT2 class that widget is present.
|
||||
WPLiveticker2::mark_widget_present();
|
||||
// Notify scLiveticker class that widget is present.
|
||||
SCLiveticker::mark_widget_present();
|
||||
|
||||
$instance = self::fill_options_with_defaults( $instance );
|
||||
$before_widget = isset( $args['before_widget'] ) ? $args['before_widget'] : '';
|
||||
$after_widget = isset( $args['after_widget'] ) ? $args['after_widget'] : '';
|
||||
$before_title = isset( $args['before_title'] ) ? $args['before_title'] : '';
|
||||
$after_title = isset( $args['after_title'] ) ? $args['after_title'] : '';
|
||||
$title = apply_filters( 'wplt2_catlit', $instance['title'] );
|
||||
$category = apply_filters( 'wplt2_catlit', $instance['category'] );
|
||||
$count = apply_filters( 'wplt2_catlit', $instance['count'] );
|
||||
$link = apply_filters( 'wplt2_catlit', $instance['link'] );
|
||||
$highlight = apply_filters( 'wplt2_catlit', $instance['highlight'] );
|
||||
$highlight_time = apply_filters( 'wplt2_catlit', $instance['highlight_time'] );
|
||||
$ajax = apply_filters( 'wplt2_catlit', $instance['ajax'] );
|
||||
$title = apply_filters( 'scliveticker_catlit', $instance['title'] );
|
||||
$category = apply_filters( 'scliveticker_catlit', $instance['category'] );
|
||||
$count = apply_filters( 'scliveticker_catlit', $instance['count'] );
|
||||
$link = apply_filters( 'scliveticker_catlit', $instance['link'] );
|
||||
$highlight = apply_filters( 'scliveticker_catlit', $instance['highlight'] );
|
||||
$highlight_time = apply_filters( 'scliveticker_catlit', $instance['highlight_time'] );
|
||||
$ajax = apply_filters( 'scliveticker_catlit', $instance['ajax'] );
|
||||
?>
|
||||
|
||||
<?php
|
||||
@ -68,20 +68,20 @@ class WPLiveticker2_Widget extends WP_Widget {
|
||||
echo $before_title . esc_html( $title ) . $after_title;
|
||||
}
|
||||
|
||||
echo '<ul class="wplt2-widget';
|
||||
echo '<ul class="sclt-widget';
|
||||
if ( '1' === $ajax ) {
|
||||
echo ' wplt2-widget-ajax" '
|
||||
. 'data-wplt2-ticker="' . esc_attr( $category ) . '" '
|
||||
. 'data-wplt2-limit="' . esc_attr( $count ) . '" '
|
||||
. 'data-wplt2-last="' . esc_attr( time() );
|
||||
echo ' sclt-widget-ajax" '
|
||||
. 'data-sclt-ticker="' . esc_attr( $category ) . '" '
|
||||
. 'data-sclt-limit="' . esc_attr( $count ) . '" '
|
||||
. 'data-sclt-last="' . esc_attr( time() );
|
||||
}
|
||||
echo '">';
|
||||
|
||||
$args = array(
|
||||
'post_type' => 'wplt2_tick',
|
||||
'post_type' => 'scliveticker_tick',
|
||||
'tax_query' => array(
|
||||
array(
|
||||
'taxonomy' => 'wplt2_ticker',
|
||||
'taxonomy' => 'scliveticker_ticker',
|
||||
'field' => 'slug',
|
||||
'terms' => $category,
|
||||
),
|
||||
@ -93,7 +93,7 @@ class WPLiveticker2_Widget extends WP_Widget {
|
||||
while ( $wp_query->have_posts() && ( $count <= 0 || ++ $cnt < $count ) ) {
|
||||
$wp_query->the_post();
|
||||
// @codingStandardsIgnoreLine
|
||||
echo WPLiveticker2::tick_html_widget(
|
||||
echo SCLiveticker::tick_html_widget(
|
||||
esc_html( get_the_time( 'd.m.Y - H.i' ) ),
|
||||
get_the_title(),
|
||||
( '1' === $highlight && get_the_time( 'U' ) > ( time() - $highlight_time ) )
|
||||
@ -103,8 +103,8 @@ class WPLiveticker2_Widget extends WP_Widget {
|
||||
echo '</ul>';
|
||||
|
||||
if ( $link ) {
|
||||
echo '<p class="wplt2-widget-link">'
|
||||
. '<a href="' . esc_attr( $link ) . '">' . esc_html__( 'show all', 'wplt2' ) . '...</a>'
|
||||
echo '<p class="sclt-widget-link">'
|
||||
. '<a href="' . esc_attr( $link ) . '">' . esc_html__( 'show all', 'stklcode-liveticker' ) . '...</a>'
|
||||
. '</p>';
|
||||
}
|
||||
// @codingStandardsIgnoreLine
|
||||
@ -139,9 +139,9 @@ class WPLiveticker2_Widget extends WP_Widget {
|
||||
$highlight = isset( $instance['highlight'] ) ? esc_attr( $instance['highlight'] ) : '0';
|
||||
$highlight_time = isset( $instance['highlight_time'] ) ? esc_attr( $instance['highlight_time'] ) : '0';
|
||||
$ajax = isset( $instance['ajax'] ) ? esc_attr( $instance['ajax'] ) : '0';
|
||||
$categories = get_terms( 'wplt2_ticker', 'orderby=name&order=ASC' );
|
||||
$categories = get_terms( 'scliveticker_ticker', 'orderby=name&order=ASC' );
|
||||
|
||||
include WPLT2_DIR . 'views/widget-form.php';
|
||||
include SCLIVETICKER_DIR . 'views/widget-form.php';
|
||||
}
|
||||
|
||||
/**
|
@ -1,10 +1,10 @@
|
||||
<?php
|
||||
/**
|
||||
* WP Liveticker 2: Plugin main class.
|
||||
* Liveticker: Plugin main class.
|
||||
*
|
||||
* This file contains the plugin's base class.
|
||||
*
|
||||
* @package WPLiveticker2
|
||||
* @package Liveticker
|
||||
*/
|
||||
|
||||
// Exit if accessed directly.
|
||||
@ -13,9 +13,9 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||
}
|
||||
|
||||
/**
|
||||
* WP Liveticker 2.
|
||||
* Liveticker.
|
||||
*/
|
||||
class WPLiveticker2 {
|
||||
class SCLiveticker {
|
||||
/**
|
||||
* Options tag.
|
||||
*
|
||||
@ -28,7 +28,7 @@ class WPLiveticker2 {
|
||||
*
|
||||
* @var string OPTIONS
|
||||
*/
|
||||
const OPTION = 'wplt2';
|
||||
const OPTION = 'stklcode-liveticker';
|
||||
|
||||
/**
|
||||
* Plugin options.
|
||||
@ -72,34 +72,34 @@ class WPLiveticker2 {
|
||||
}
|
||||
|
||||
// Load Textdomain.
|
||||
load_plugin_textdomain( 'wplt2', false, dirname( plugin_basename( __FILE__ ) ) . '/lang/' );
|
||||
load_plugin_textdomain( 'stklcode-liveticker', false );
|
||||
|
||||
// Allow shortcodes in widgets.
|
||||
add_filter( 'widget_text', 'do_shortcode' );
|
||||
|
||||
// Add shortcode.
|
||||
add_shortcode( 'liveticker', array( 'WPLiveticker2', 'shortcode_ticker_show' ) );
|
||||
add_shortcode( 'liveticker', array( __CLASS__, 'shortcode_ticker_show' ) );
|
||||
|
||||
// Enqueue styles.
|
||||
add_action( 'wp_footer', array( 'WPLiveticker2', 'enqueue_styles' ) );
|
||||
add_action( 'wp_footer', array( __CLASS__, 'enqueue_styles' ) );
|
||||
|
||||
// Enqueue JavaScript.
|
||||
add_action( 'wp_footer', array( 'WPLiveticker2', 'enqueue_scripts' ) );
|
||||
add_action( 'wp_footer', array( __CLASS__, 'enqueue_scripts' ) );
|
||||
|
||||
// Add AJAX hook if configured.
|
||||
if ( 1 === self::$_options['enable_ajax'] ) {
|
||||
add_action( 'wp_ajax_wplt2_update-ticks', array( 'WPLiveticker2', 'ajax_update' ) );
|
||||
add_action( 'wp_ajax_nopriv_wplt2_update-ticks', array( 'WPLiveticker2', 'ajax_update' ) );
|
||||
add_action( 'wp_ajax_sclt_update-ticks', array( __CLASS__, 'ajax_update' ) );
|
||||
add_action( 'wp_ajax_nopriv_sclt_update-ticks', array( __CLASS__, 'ajax_update' ) );
|
||||
}
|
||||
|
||||
// Admin only actions.
|
||||
if ( is_admin() ) {
|
||||
// Add dashboard "right now" functionality.
|
||||
add_action( 'right_now_content_table_end', array( 'WPLiveticker2_Admin', 'dashboard_right_now' ) );
|
||||
add_action( 'right_now_content_table_end', array( 'SCLiveticker_Admin', 'dashboard_right_now' ) );
|
||||
|
||||
// Settings.
|
||||
add_action( 'admin_init', array( 'WPLiveticker2_Admin', 'register_settings' ) );
|
||||
add_action( 'admin_menu', array( 'WPLiveticker2_Admin', 'register_settings_page' ) );
|
||||
add_action( 'admin_init', array( 'SCLiveticker_Admin', 'register_settings' ) );
|
||||
add_action( 'admin_menu', array( 'SCLiveticker_Admin', 'register_settings_page' ) );
|
||||
}
|
||||
}
|
||||
|
||||
@ -113,20 +113,20 @@ class WPLiveticker2 {
|
||||
$labels = array(
|
||||
'name' => _x( 'Ticker', 'taxonomy general name' ),
|
||||
'singular_name' => _x( 'Ticker', 'taxonomy singular name' ),
|
||||
'search_items' => __( 'Search Tickers', 'wplt2' ),
|
||||
'all_items' => __( 'All Tickers', 'wplt2' ),
|
||||
'parent_item' => __( 'Parent Ticker', 'wplt2' ),
|
||||
'parent_item_colon' => __( 'Parent Ticker:', 'wplt2' ),
|
||||
'edit_item' => __( 'Edit Ticker', 'wplt2' ),
|
||||
'update_item' => __( 'Update Ticker', 'wplt2' ),
|
||||
'add_new_item' => __( 'Add New Ticker', 'wplt2' ),
|
||||
'new_item_name' => __( 'New Ticker', 'wplt2' ),
|
||||
'menu_name' => __( 'Ticker', 'wplt2' ),
|
||||
'search_items' => __( 'Search Tickers', 'stklcode-liveticker' ),
|
||||
'all_items' => __( 'All Tickers', 'stklcode-liveticker' ),
|
||||
'parent_item' => __( 'Parent Ticker', 'stklcode-liveticker' ),
|
||||
'parent_item_colon' => __( 'Parent Ticker:', 'stklcode-liveticker' ),
|
||||
'edit_item' => __( 'Edit Ticker', 'stklcode-liveticker' ),
|
||||
'update_item' => __( 'Update Ticker', 'stklcode-liveticker' ),
|
||||
'add_new_item' => __( 'Add New Ticker', 'stklcode-liveticker' ),
|
||||
'new_item_name' => __( 'New Ticker', 'stklcode-liveticker' ),
|
||||
'menu_name' => __( 'Ticker', 'stklcode-liveticker' ),
|
||||
);
|
||||
|
||||
register_taxonomy(
|
||||
'wplt2_ticker',
|
||||
array( 'wplt2_tick' ),
|
||||
'scliveticker_ticker',
|
||||
array( 'scliveticker_tick' ),
|
||||
array(
|
||||
'hierarchical' => true,
|
||||
'labels' => $labels,
|
||||
@ -139,19 +139,19 @@ class WPLiveticker2 {
|
||||
// Post type arguments.
|
||||
$args = array(
|
||||
'labels' => array(
|
||||
'name' => __( 'Ticks', 'wplt2' ),
|
||||
'singular_name' => __( 'Tick', 'wplt2' ),
|
||||
'add_new' => __( 'Add New', 'wplt2' ),
|
||||
'add_new_item' => __( 'Add New Tick', 'wplt2' ),
|
||||
'edit_item' => __( 'Edit Tick', 'wplt2' ),
|
||||
'new_item' => __( 'New Tick', 'wplt2' ),
|
||||
'all_items' => __( 'All Ticks', 'wplt2' ),
|
||||
'view_item' => __( 'View Tick', 'wplt2' ),
|
||||
'search_items' => __( 'Search Ticks', 'wplt2' ),
|
||||
'not_found' => __( 'No Ticks found', 'wplt2' ),
|
||||
'not_found_in_trash' => __( 'No Ticks found in Trash', 'wplt2' ),
|
||||
'name' => __( 'Ticks', 'stklcode-liveticker' ),
|
||||
'singular_name' => __( 'Tick', 'stklcode-liveticker' ),
|
||||
'add_new' => __( 'Add New', 'stklcode-liveticker' ),
|
||||
'add_new_item' => __( 'Add New Tick', 'stklcode-liveticker' ),
|
||||
'edit_item' => __( 'Edit Tick', 'stklcode-liveticker' ),
|
||||
'new_item' => __( 'New Tick', 'stklcode-liveticker' ),
|
||||
'all_items' => __( 'All Ticks', 'stklcode-liveticker' ),
|
||||
'view_item' => __( 'View Tick', 'stklcode-liveticker' ),
|
||||
'search_items' => __( 'Search Ticks', 'stklcode-liveticker' ),
|
||||
'not_found' => __( 'No Ticks found', 'stklcode-liveticker' ),
|
||||
'not_found_in_trash' => __( 'No Ticks found in Trash', 'stklcode-liveticker' ),
|
||||
'parent_item_colon' => '',
|
||||
'menu_name' => __( 'Liveticker', 'wplt2' ),
|
||||
'menu_name' => __( 'Liveticker', 'stklcode-liveticker' ),
|
||||
),
|
||||
'public' => false,
|
||||
'publicly_queryable' => true,
|
||||
@ -160,11 +160,11 @@ class WPLiveticker2 {
|
||||
'menu_icon' => 'dashicons-rss',
|
||||
'capability_type' => 'post',
|
||||
'supports' => array( 'title', 'editor', 'author' ),
|
||||
'taxonomies' => array( 'wplt2_ticker' ),
|
||||
'taxonomies' => array( 'scliveticker_ticker' ),
|
||||
'has_archive' => true,
|
||||
);
|
||||
|
||||
register_post_type( 'wplt2_tick', $args );
|
||||
register_post_type( 'scliveticker_tick', $args );
|
||||
}
|
||||
|
||||
/**
|
||||
@ -198,21 +198,21 @@ class WPLiveticker2 {
|
||||
$show_feed = 1 === self::$_options['show_feed'];
|
||||
}
|
||||
|
||||
$output = '<ul class="wplt2-ticker';
|
||||
$output = '<ul class="sclt-ticker';
|
||||
if ( 1 === self::$_options['enable_ajax'] ) {
|
||||
$output .= ' wplt2-ticker-ajax" '
|
||||
. 'data-wplt2-ticker="' . $ticker . '" '
|
||||
. 'data-wplt2-limit="' . $limit . '" '
|
||||
. 'data-wplt2-last="' . time();
|
||||
$output .= ' sclt-ticker-ajax" '
|
||||
. 'data-sclt-ticker="' . $ticker . '" '
|
||||
. 'data-sclt-limit="' . $limit . '" '
|
||||
. 'data-sclt-last="' . time();
|
||||
}
|
||||
$output .= '">';
|
||||
|
||||
$args = array(
|
||||
'post_type' => 'wplt2_tick',
|
||||
'post_type' => 'scliveticker_tick',
|
||||
'posts_per_page' => $limit,
|
||||
'tax_query' => array(
|
||||
array(
|
||||
'taxonomy' => 'wplt2_ticker',
|
||||
'taxonomy' => 'scliveticker_ticker',
|
||||
'field' => 'slug',
|
||||
'terms' => $ticker,
|
||||
),
|
||||
@ -230,11 +230,11 @@ class WPLiveticker2 {
|
||||
|
||||
// Show RSS feed link, if configured.
|
||||
if ( $show_feed ) {
|
||||
$feed_link = get_post_type_archive_feed_link( 'wplt2_tick' ) . '';
|
||||
$feed_link = get_post_type_archive_feed_link( 'scliveticker_tick' ) . '';
|
||||
if ( false === strpos( $feed_link, '&' ) ) {
|
||||
$feed_link .= '?wplt2_ticker=' . $ticker;
|
||||
$feed_link .= '?scliveticker_ticker=' . $ticker;
|
||||
} else {
|
||||
$feed_link .= '&wplt2_ticker=' . $ticker;
|
||||
$feed_link .= '&scliveticker_ticker=' . $ticker;
|
||||
}
|
||||
$output .= '<a href="' . esc_attr( $feed_link ) . '">Feed</a>';
|
||||
}
|
||||
@ -253,7 +253,7 @@ class WPLiveticker2 {
|
||||
if ( self::$shortcode_present || self::$widget_present ) {
|
||||
wp_enqueue_style(
|
||||
'wplt-css',
|
||||
WPLT2_BASE . 'styles/wp-liveticker2.min.css',
|
||||
SCLIVETICKER_BASE . 'styles/liveticker.min.css',
|
||||
'',
|
||||
self::VERSION, 'all'
|
||||
);
|
||||
@ -269,8 +269,8 @@ class WPLiveticker2 {
|
||||
// Only add if shortcode is present.
|
||||
if ( self::$shortcode_present || self::$widget_present ) {
|
||||
wp_enqueue_script(
|
||||
'wplt2-js',
|
||||
WPLT2_BASE . 'scripts/wp-liveticker2.min.js',
|
||||
'scliveticker-js',
|
||||
SCLIVETICKER_BASE . 'scripts/liveticker.min.js',
|
||||
array(),
|
||||
self::VERSION,
|
||||
true
|
||||
@ -278,11 +278,11 @@ class WPLiveticker2 {
|
||||
|
||||
// Add endpoint to script.
|
||||
wp_localize_script(
|
||||
'wplt2-js',
|
||||
'wplt2Ajax',
|
||||
'scliveticker-js',
|
||||
'sclivetickerAjax',
|
||||
array(
|
||||
'ajax_url' => admin_url( 'admin-ajax.php' ),
|
||||
'nonce' => wp_create_nonce( 'wplt2_update-ticks' ),
|
||||
'nonce' => wp_create_nonce( 'scliveticker_update-ticks' ),
|
||||
'poll_interval' => self::$_options['poll_interval'] * 1000,
|
||||
)
|
||||
);
|
||||
@ -296,7 +296,7 @@ class WPLiveticker2 {
|
||||
*/
|
||||
public static function ajax_update() {
|
||||
// Verify AJAX nonce.
|
||||
check_ajax_referer( 'wplt2_update-ticks' );
|
||||
check_ajax_referer( 'scliveticker_update-ticks' );
|
||||
|
||||
// Extract update requests.
|
||||
if ( isset( $_POST['update'] ) && is_array( $_POST['update'] ) ) { // Input var okay.
|
||||
@ -320,11 +320,11 @@ class WPLiveticker2 {
|
||||
|
||||
// Query new ticks from DB.
|
||||
$query_args = array(
|
||||
'post_type' => 'wplt2_tick',
|
||||
'post_type' => 'scliveticker_tick',
|
||||
'posts_per_page' => $limit,
|
||||
'tax_query' => array(
|
||||
array(
|
||||
'taxonomy' => 'wplt2_ticker',
|
||||
'taxonomy' => 'scliveticker_ticker',
|
||||
'field' => 'slug',
|
||||
'terms' => $slug,
|
||||
),
|
||||
@ -417,10 +417,10 @@ class WPLiveticker2 {
|
||||
* @return string HTML code of tick.
|
||||
*/
|
||||
private static function tick_html( $time, $title, $content, $is_widget = false ) {
|
||||
return '<li class="wplt2-tick">'
|
||||
. '<p><span class="wplt2-tick_time">' . esc_html( $time ) . '</span>'
|
||||
. '<span class="wplt2-tick-title">' . esc_html( $title ) . '</span></p>'
|
||||
. '<p class="wplt2-tick-content">' . $content . '</p></li>';
|
||||
return '<li class="sclt-tick">'
|
||||
. '<p><span class="sclt-tick_time">' . esc_html( $time ) . '</span>'
|
||||
. '<span class="sclt-tick-title">' . esc_html( $title ) . '</span></p>'
|
||||
. '<p class="sclt-tick-content">' . $content . '</p></li>';
|
||||
}
|
||||
|
||||
/**
|
||||
@ -435,11 +435,11 @@ class WPLiveticker2 {
|
||||
public static function tick_html_widget( $time, $title, $highlight ) {
|
||||
$out = '<li';
|
||||
if ( $highlight ) {
|
||||
$out .= ' class="wplt2-widget-new"';
|
||||
$out .= ' class="sclt-widget-new"';
|
||||
}
|
||||
return $out . '>'
|
||||
. '<span class="wplt2-widget-time">' . esc_html( $time ) . '</span>'
|
||||
. '<span class="wplt2-widget-title">' . $title . '</span>'
|
||||
. '<span class="sclt-widget-time">' . esc_html( $time ) . '</span>'
|
||||
. '<span class="sclt-widget-title">' . $title . '</span>'
|
||||
. '</li>';
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user