PluginProbe
Simple Ticker / 3.03
Simple Ticker v3.03
trunk 1.0 1.01 1.02 1.03 1.04 1.05 1.06 1.07 2.00 2.01 2.02 2.03 2.04 2.05 2.06 2.07 2.08 2.09 2.10 2.11 3.00 3.01 3.02 3.03 All 33 releases
simple-ticker / lib / class-simpletickerwidgetitem.php

class-simpletickerwidgetitem.php in Simple Ticker 3.03, at lib/class-simpletickerwidgetitem.php

113 lines 3.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Simple Ticker
4 *
5 * @package SimpleTicker
6 * @subpackage SimpleTicker Widget
7 /*
8 Copyright (c) 2016- Katsushi Kawamori (email : dodesyoswift312@gmail.com)
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; version 2 of the License.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */
22
23 add_action(
24 'widgets_init',
25 function() {
26 register_widget( 'SimpleTickerWidgetItem' );
27 }
28 );
29
30 /** ==================================================
31 * Widget
32 *
33 * @since 1.00
34 */
35 class SimpleTickerWidgetItem extends WP_Widget {
36
37 /** ==================================================
38 * Construct
39 *
40 * @since 1.00
41 */
42 public function __construct() {
43 parent::__construct(
44 'SimpleTickerWidgetItem', /* Base ID */
45 __( 'Ticker', 'simple-ticker' ), /* Name */
46 array( 'description' => __( 'Ticker from SimpleTicker.', 'simple-ticker' ) ) /* Args */
47 );
48 }
49
50 /** ==================================================
51 * Widget
52 *
53 * @param array $args args.
54 * @param array $instance instance.
55 * @since 1.00
56 */
57 public function widget( $args, $instance ) {
58
59 $before_widget = $args['before_widget'];
60 $before_title = $args['before_title'];
61 $after_title = $args['after_title'];
62 $after_widget = $args['after_widget'];
63
64 $title = apply_filters( 'widget_title', $instance['title'] );
65
66 if ( $title ) {
67 echo wp_kses_post( $before_widget );
68 echo wp_kses_post( $before_title . esc_html( $title ) . $after_title );
69 echo wp_kses_post( apply_filters( 'smptck_read_tickers', null, null, null, null, null, null, null, null, null, null, null, null, null, null ) );
70 echo wp_kses_post( $after_widget );
71 }
72
73 }
74
75 /** ==================================================
76 * Update
77 *
78 * @param array $new_instance new_instance.
79 * @param array $old_instance old_instance.
80 * @since 1.00
81 */
82 public function update( $new_instance, $old_instance ) {
83 $instance = $old_instance;
84 $instance['title'] = wp_strip_all_tags( $new_instance['title'] );
85 return $instance;
86 }
87
88 /** ==================================================
89 * Form
90 *
91 * @param array $instance instance.
92 * @since 1.00
93 */
94 public function form( $instance ) {
95
96 if ( isset( $instance['title'] ) ) {
97 $title = $instance['title'];
98 } else {
99 $title = null;
100 }
101
102 ?>
103 <p>
104 <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e( 'Title' ); ?>:</label>
105 <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />
106 </p>
107 <?php
108 }
109
110 }
111
112
113