PluginProbe
Simple Ticker / 1.03
Simple Ticker v1.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 / req / SimpleTickerWidgetItem.php

SimpleTickerWidgetItem.php in Simple Ticker 1.03, at req/SimpleTickerWidgetItem.php

76 lines 2.3 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 Copyright (c) 2016- Katsushi Kawamori (email : dodesyoswift312@gmail.com)
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; version 2 of the License.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22 /* ==================================================
23 * Widget
24 * @since 1.0
25 */
26 class SimpleTickerWidgetItem extends WP_Widget {
27
28 function __construct() {
29 parent::__construct(
30 'SimpleTickerWidgetItem', // Base ID
31 __( 'Ticker', 'simple-ticker' ), // Name
32 array( 'description' => __( 'Ticker from SimpleTicker.', 'simple-ticker'), ) // Args
33 );
34 }
35
36 function widget($args, $instance) {
37 extract($args);
38 $title = apply_filters('widget_title', $instance['title']);
39
40 if ($title) {
41 echo $before_widget;
42 echo $before_title . $title . $after_title;
43 include_once( SIMPLETICKER_PLUGIN_BASE_DIR . '/inc/SimpleTicker.php' );
44 $simpleticker = new SimpleTicker();
45 echo $simpleticker->read_tickers(NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
46 unset($simpleticker);
47 echo $after_widget;
48 }
49
50 }
51
52 function update($new_instance, $old_instance) {
53 $instance = $old_instance;
54 $instance['title'] = strip_tags($new_instance['title']);
55 return $instance;
56 }
57
58 function form($instance) {
59
60 if (isset($instance['title'])) {
61 $title = esc_attr($instance['title']);
62 } else {
63 $title = NULL;
64 }
65
66 ?>
67 <p>
68 <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title'); ?>:</label>
69 <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" />
70 </p>
71 <?php
72 }
73
74 }
75
76 ?>