SHOW:
|
|
- or go back to the newest paste.
1 | <?php | |
2 | ||
3 | // Seso Frontpage Text Widget | |
4 | class widget_sesotext extends WP_Widget { | |
5 | function widget_sesotext() { | |
6 | /* Widget settings. */ | |
7 | $widget_ops = array( 'description' => __('Frontpage only widget with 3 text areas') ); | |
8 | ||
9 | /* Widget control settings. */ | |
10 | $control_ops = array( 'width' => 300, 'height' => 350, 'id_base' => 'sesotext' ); | |
11 | ||
12 | /* Create the widget. */ | |
13 | $this->WP_Widget( 'sesotext', __('Seso - Frontpage Text Widget'), $widget_ops, $control_ops ); | |
14 | } | |
15 | ||
16 | function widget($args, $instance) { | |
17 | extract($args); | |
18 | // Output | |
19 | echo '<li>'; | |
20 | $title = apply_filters('widget_title', $instance['title']); | |
21 | $text1 = $instance['text1']; | |
22 | $text2 = $instance['text2']; | |
23 | $text3 = $instance['text3']; | |
24 | echo '<h3>'.$title.'</h3>'; | |
25 | echo '<ul>'; | |
26 | echo '<li>'.$text1.'</li>'; | |
27 | echo '<li>'.$text2.'</li>'; | |
28 | echo '<li>'.$text3.'</li>'; | |
29 | echo '</ul>'; | |
30 | } | |
31 | function update( $new_instance, $old_instance ) { | |
32 | $instance = $old_instance; | |
33 | ||
34 | /* Strip tags (if needed) and update the widget settings. */ | |
35 | $instance['title'] = strip_tags( $new_instance['title'] ); | |
36 | $instance['text1'] = strip_tags( $new_instance['text1'] ); | |
37 | $instance['text2'] = strip_tags( $new_instance['text2'] ); | |
38 | $instance['text3'] = strip_tags( $new_instance['text3'] ); | |
39 | return $instance; | |
40 | } | |
41 | function form($instance) { | |
42 | $defaults = array( 'title' => 'Text Widget', 'text1' => '<p>Enter text here</p>', 'text2' => '<p>Enter text here</p>', 'text3' => '<p>Enter text here</p>' ); | |
43 | $instance = wp_parse_args( (array) $instance, $defaults ); ?> | |
44 | ||
45 | <p> | |
46 | <label for="<?php echo $this->get_field_id( 'title' ); ?>">Widget Title:</label> | |
47 | <input id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo $instance['title']; ?>" style="width:100%;" /> | |
48 | </p> | |
49 | ||
50 | <p> | |
51 | <label for="<?php echo $this->get_field_id( 'text1' ); ?>">Text Area 1:</label> | |
52 | <textarea id="<?php echo $this->get_field_id( 'text1' ); ?>" name="<?php echo $this->get_field_name( 'text1' ); ?>" style="width:100%;" rows="4"><?php echo $instance['text1']; ?></textarea> | |
53 | </p> | |
54 | ||
55 | <p> | |
56 | <label for="<?php echo $this->get_field_id( 'text2' ); ?>">Text Area 2:</label> | |
57 | <textarea id="<?php echo $this->get_field_id( 'text2' ); ?>" name="<?php echo $this->get_field_name( 'text2' ); ?>" style="width:100%;" rows="4"><?php echo $instance['text2']; ?></textarea> | |
58 | </p> | |
59 | ||
60 | <p> | |
61 | <label for="<?php echo $this->get_field_id( 'text3' ); ?>">Text Area 3:</label> | |
62 | <textarea id="<?php echo $this->get_field_id( 'text3' ); ?>" name="<?php echo $this->get_field_name( 'text3' ); ?>" style="width:100%;" rows="4"><?php echo $instance['text3']; ?></textarea> | |
63 | </p> | |
64 | <?php | |
65 | } | |
66 | } | |
67 | function widget_sesotext_init() | |
68 | { | |
69 | register_widget('widget_sesotext'); | |
70 | } | |
71 | add_action('widgets_init', 'widget_sesotext_init'); | |
72 | ||
73 | // Seso Footer Contact Form | |
74 | class widget_sesocontactform extends WP_Widget { | |
75 | function widget_sesocontactform() { | |
76 | /* Widget settings. */ | |
77 | $widget_ops = array( 'description' => __('Contact Us Form - Footer Only') ); | |
78 | ||
79 | /* Widget control settings. */ | |
80 | $control_ops = array( 'width' => 300, 'height' => 350, 'id_base' => 'sesocontactform' ); | |
81 | ||
82 | /* Create the widget. */ | |
83 | $this->WP_Widget( 'sesocontactform', __('Seso - Contact Us Form'), $widget_ops, $control_ops ); | |
84 | } | |
85 | ||
86 | function widget($args, $instance) { | |
87 | extract($args); | |
88 | // Output | |
89 | echo '<li>'; | |
90 | $title = apply_filters('widget_title', $instance['title']); | |
91 | $to = $instance['recipient']; | |
92 | $themePath = get_template_directory_uri(); | |
93 | echo '<h3>'.$title.'</h3>'; | |
94 | echo '<form id="footerContact" method="post" action="'.$themePath.'/inc/wpmail.php?to='.$to.'"> | |
95 | <p><input type="text" name="name" id="name" value="" class="textfield" size="22" tabindex="3" /><label class="textfield_label" for="name">Name *</label></p> | |
96 | ||
97 | <p><input type="text" name="email" id="email" value="" class="textfield" size="22" tabindex="4" /><label class="textfield_label" for="email">Email *</label></p> | |
98 | ||
99 | <p><textarea name="content" rows="20" cols="30" tabindex="5" class="textarea"></textarea></p> | |
100 | ||
101 | <p><input name="submit" class="footersubmit" id="footerbutton" tabindex="6" value="Submit" type="submit" /></p> | |
102 | </form>'; | |
103 | echo '</li>'; | |
104 | } | |
105 | function update( $new_instance, $old_instance ) { | |
106 | $instance = $old_instance; | |
107 | ||
108 | /* Strip tags (if needed) and update the widget settings. */ | |
109 | $instance['title'] = strip_tags( $new_instance['title'] ); | |
110 | $instance['recipient'] = strip_tags( $new_instance['recipient'] ); | |
111 | ||
112 | return $instance; | |
113 | } | |
114 | function form($instance) { | |
115 | $defaults = array( 'title' => 'Contact Us', 'recipient' => 'admin@admin.com' ); | |
116 | $instance = wp_parse_args( (array) $instance, $defaults ); ?> | |
117 | ||
118 | <p> | |
119 | <label for="<?php echo $this->get_field_id( 'title' ); ?>">Widget Title:</label> | |
120 | <input id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo $instance['title']; ?>" style="width:100%;" /> | |
121 | </p> | |
122 | ||
123 | <p> | |
124 | <label for="<?php echo $this->get_field_id( 'recipient' ); ?>">Recipient Email:</label> | |
125 | <input id="<?php echo $this->get_field_id( 'recipient' ); ?>" name="<?php echo $this->get_field_name( 'recipient' ); ?>" value="<?php echo $instance['recipient']; ?>" style="width:100%;" /> | |
126 | </p> | |
127 | <?php | |
128 | } | |
129 | } | |
130 | function widget_sesocontactform_init() | |
131 | { | |
132 | register_widget('widget_sesocontactform'); | |
133 | } | |
134 | add_action('widgets_init', 'widget_sesocontactform_init'); | |
135 | ||
136 | // Seso Recent Posts w/ Images | |
137 | class widget_sesorecent extends WP_Widget { | |
138 | function widget_sesorecent() { | |
139 | /* Widget settings. */ | |
140 | $widget_ops = array( 'description' => __('Display recent posts with images') ); | |
141 | ||
142 | /* Widget control settings. */ | |
143 | $control_ops = array( 'width' => 300, 'height' => 350, 'id_base' => 'sesorecent' ); | |
144 | ||
145 | /* Create the widget. */ | |
146 | $this->WP_Widget( 'sesorecent', __('Seso - Recent Posts'), $widget_ops, $control_ops ); | |
147 | } | |
148 | ||
149 | function widget($args, $instance) { | |
150 | //WPML | |
151 | global $sitepress; | |
152 | if($sitepress->get_current_language() == 'zh') { | |
153 | $get_the_time = get_the_time('F d, Y'); | |
154 | } | |
155 | else { | |
156 | $get_the_time = get_the_time('F d, Y'); | |
157 | } | |
158 | //\WPML | |
159 | extract($args); | |
160 | $title = apply_filters('widget_title', $instance['title']); | |
161 | $show = $instance['show']; | |
162 | global $post, $wpdb; | |
163 | $themePath = get_template_directory_uri(); | |
164 | $recent_posts = new WP_Query('showposts='.$show.''); | |
165 | if ($name == "Seso Front Page") { | |
166 | // Output Frontpage | |
167 | echo '<li id="portfolio">'; | |
168 | echo '<h3>'.$title.'</h3>'; | |
169 | echo '<ul>'; | |
170 | while ($recent_posts->have_posts()) : $recent_posts->the_post(); ?> | |
171 | <li> | |
172 | <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"> | |
173 | <?php if ( has_post_thumbnail() ) { | |
174 | $image_id = get_post_thumbnail_id(); | |
175 | $image_url = wp_get_attachment_image_src($image_id,'full'); $image_url = $image_url[0]; ?> | |
176 | <img src="<?php echo $themePath ?>/inc/timthumb.php?src=<?php echo $image_url; ?>&w=180&h=105&zc=1&q=95" alt="<?php the_title(); ?>" width="180" height="105" /> | |
177 | <?php } else { ?> | |
178 | <img src="<?php get_template_directory_uri(); ?>/images/portfolio-pic.png" alt="No Post Image for <?php the_title(); ?>" /> | |
179 | <?php } ?> | |
180 | </a> | |
181 | <p><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php echo ShortenTitle(get_the_title()); ?></a> | |
182 | <?php echo ShortenText(get_the_content()); ?></p> | |
183 | </li> | |
184 | <?php endwhile; | |
185 | echo '</ul>'; | |
186 | echo '</li>'; | |
187 | } else { | |
188 | // Output other | |
189 | echo '<li id="thumbwidget">'; | |
190 | echo '<h3>'.$title.'</h3>'; | |
191 | echo '<ul>'; | |
192 | while ($recent_posts->have_posts()) : $recent_posts->the_post(); ?> | |
193 | - | <span><?php the_time('F d, Y'); ?></span></p> |
193 | + | |
194 | <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"> | |
195 | <?php if ( has_post_thumbnail() ) { | |
196 | the_post_thumbnail('thumbnail'); | |
197 | } else { ?> | |
198 | <img src="<?php get_template_directory_uri(); ?>/images/small-pic.png" alt="No Post Image for <?php the_title(); ?>" /> | |
199 | <?php } ?> | |
200 | </a> | |
201 | <p><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php echo ShortenTitle(get_the_title()); ?></a><br /> | |
202 | <span><?php echo $get_the_time; ?></span></p> | |
203 | </li> | |
204 | <?php endwhile; | |
205 | echo '</ul>'; | |
206 | echo '</li>'; | |
207 | } | |
208 | } | |
209 | function update( $new_instance, $old_instance ) { | |
210 | $instance = $old_instance; | |
211 | ||
212 | /* Strip tags (if needed) and update the widget settings. */ | |
213 | $instance['title'] = strip_tags( $new_instance['title'] ); | |
214 | $instance['show'] = strip_tags( $new_instance['show'] ); | |
215 | ||
216 | return $instance; | |
217 | } | |
218 | function form($instance) { | |
219 | $defaults = array( 'title' => 'Recent Posts', 'show' => '4' ); | |
220 | $instance = wp_parse_args( (array) $instance, $defaults ); ?> | |
221 | ||
222 | <p> | |
223 | <label for="<?php echo $this->get_field_id( 'title' ); ?>">Widget Title:</label> | |
224 | <input id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo $instance['title']; ?>" style="width:100%;" /> | |
225 | </p> | |
226 | ||
227 | <p> | |
228 | <label for="<?php echo $this->get_field_id( 'name' ); ?>">Number of Posts:</label> | |
229 | <input id="<?php echo $this->get_field_id( 'name' ); ?>" name="<?php echo $this->get_field_name( 'show' ); ?>" value="<?php echo $instance['show']; ?>" style="width:100%;" /> | |
230 | </p> | |
231 | <?php | |
232 | } | |
233 | } | |
234 | function widget_sesorecent_init() | |
235 | { | |
236 | register_widget('widget_sesorecent'); | |
237 | } | |
238 | add_action('widgets_init', 'widget_sesorecent_init'); | |
239 | ||
240 | // Seso Popular Posts w/ Images | |
241 | class widget_sesopopular extends WP_Widget { | |
242 | function widget_sesopopular() { | |
243 | /* Widget settings. */ | |
244 | $widget_ops = array( 'description' => __('Display popular posts with images') ); | |
245 | ||
246 | /* Widget control settings. */ | |
247 | $control_ops = array( 'width' => 300, 'height' => 350, 'id_base' => 'sesopopular' ); | |
248 | ||
249 | /* Create the widget. */ | |
250 | $this->WP_Widget( 'sesopopular', __('Seso - Popular Posts'), $widget_ops, $control_ops ); | |
251 | } | |
252 | ||
253 | function widget($args, $instance) { | |
254 | //WPML | |
255 | global $sitepress; | |
256 | if($sitepress->get_current_language() == 'zh') { | |
257 | $get_the_time = get_the_time('F d, Y'); | |
258 | } | |
259 | else { | |
260 | $get_the_time = get_the_time('F d, Y'); | |
261 | } | |
262 | //\WPML | |
263 | extract($args); | |
264 | $title = apply_filters('widget_title', $instance['title']); | |
265 | $show = $instance['show']; | |
266 | global $post, $wpdb; | |
267 | $themePath = get_template_directory_uri(); | |
268 | $pop = new WP_Query(); | |
269 | $pop->query('showposts='.$show.'&orderby=comment_count'); | |
270 | if ($name == "Seso Front Page") { | |
271 | // Output Frontpage | |
272 | echo '<li id="portfolio">'; | |
273 | echo '<h3>'.$title.'</h3>'; | |
274 | echo '<ul>'; | |
275 | while ($pop->have_posts()) : $pop->the_post(); ?> | |
276 | <li> | |
277 | <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"> | |
278 | <?php if ( has_post_thumbnail() ) { | |
279 | $image_id = get_post_thumbnail_id(); | |
280 | $image_url = wp_get_attachment_image_src($image_id,'full'); $image_url = $image_url[0]; ?> | |
281 | <img src="<?php echo $themePath ?>/inc/timthumb.php?src=<?php echo $image_url; ?>&w=180&h=105&zc=1&q=95" alt="<?php the_title(); ?>" width="180" height="105" /> | |
282 | <?php } else { ?> | |
283 | <img src="<?php get_template_directory_uri(); ?>/images/portfolio-pic.png" alt="No Post Image for <?php the_title(); ?>" /> | |
284 | <?php } ?> | |
285 | </a> | |
286 | <p><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php echo ShortenTitle(get_the_title()); ?></a> | |
287 | <?php echo ShortenText(get_the_content()); ?></p> | |
288 | </li> | |
289 | - | <span><?php the_time('F d, Y'); ?></span></p> |
289 | + | |
290 | echo '</ul>'; | |
291 | echo '</li>'; | |
292 | } else { | |
293 | // Output other | |
294 | echo '<li id="thumbwidget">'; | |
295 | echo '<h3>'.$title.'</h3>'; | |
296 | echo '<ul>'; | |
297 | while ($pop->have_posts()) : $pop->the_post(); ?> | |
298 | <li> | |
299 | <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"> | |
300 | <?php if ( has_post_thumbnail() ) { | |
301 | the_post_thumbnail('thumbnail'); | |
302 | } else { ?> | |
303 | <img src="<?php get_template_directory_uri(); ?>/images/small-pic.png" alt="No Post Image for <?php the_title(); ?>" /> | |
304 | <?php } ?> | |
305 | </a> | |
306 | <p><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php echo ShortenTitle(get_the_title()); ?></a><br /> | |
307 | <span><?php echo $get_the_time; ?></span></p> | |
308 | </li> | |
309 | <?php endwhile; | |
310 | echo '</ul>'; | |
311 | echo '</li>'; | |
312 | } | |
313 | } | |
314 | function update( $new_instance, $old_instance ) { | |
315 | $instance = $old_instance; | |
316 | ||
317 | /* Strip tags (if needed) and update the widget settings. */ | |
318 | $instance['title'] = strip_tags( $new_instance['title'] ); | |
319 | $instance['show'] = strip_tags( $new_instance['show'] ); | |
320 | ||
321 | return $instance; | |
322 | } | |
323 | function form($instance) { | |
324 | $defaults = array( 'title' => 'Popular Posts', 'show' => '3' ); | |
325 | $instance = wp_parse_args( (array) $instance, $defaults ); ?> | |
326 | ||
327 | <p> | |
328 | <label for="<?php echo $this->get_field_id( 'title' ); ?>">Widget Title:</label> | |
329 | <input id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo $instance['title']; ?>" style="width:100%;" /> | |
330 | </p> | |
331 | ||
332 | <p> | |
333 | <label for="<?php echo $this->get_field_id( 'name' ); ?>">Number of Posts:</label> | |
334 | <input id="<?php echo $this->get_field_id( 'name' ); ?>" name="<?php echo $this->get_field_name( 'show' ); ?>" value="<?php echo $instance['show']; ?>" style="width:100%;" /> | |
335 | </p> | |
336 | <?php | |
337 | } | |
338 | } | |
339 | function widget_sesopopular_init() | |
340 | { | |
341 | register_widget('widget_sesopopular'); | |
342 | } | |
343 | add_action('widgets_init', 'widget_sesopopular_init'); | |
344 | ||
345 | // Seso Portfolio Widget | |
346 | class widget_sesoportfolio extends WP_Widget { | |
347 | function widget_sesoportfolio() { | |
348 | /* Widget settings. */ | |
349 | $widget_ops = array( 'description' => __('Display portfolio with images') ); | |
350 | ||
351 | /* Widget control settings. */ | |
352 | $control_ops = array( 'width' => 300, 'height' => 350, 'id_base' => 'sesoportfolio' ); | |
353 | ||
354 | /* Create the widget. */ | |
355 | $this->WP_Widget( 'sesoportfolio', __('Seso - Portfolio'), $widget_ops, $control_ops ); | |
356 | } | |
357 | ||
358 | function widget($args, $instance) { | |
359 | extract($args); | |
360 | $title = apply_filters('widget_title', $instance['title']); | |
361 | $show = $instance['show']; | |
362 | $portfolio = $instance['portfolio']; | |
363 | global $post, $wpdb; | |
364 | $themePath = get_template_directory_uri(); | |
365 | // Output Frontpage | |
366 | echo '<li id="portfolio">'; | |
367 | echo '<h3>'.$title.'</h3>'; | |
368 | echo '<ul>'; ?> | |
369 | <?php query_posts('post_type='.$portfolio.'&posts_per_page='.$show.''); ?> | |
370 | <?php if(have_posts()) : while(have_posts()) : the_post(); ?> | |
371 | <li> | |
372 | <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"> | |
373 | <?php if ( has_post_thumbnail() ) { | |
374 | $image_id = get_post_thumbnail_id(); | |
375 | $image_url = wp_get_attachment_image_src($image_id,'full'); $image_url = $image_url[0]; ?> | |
376 | <img src="<?php echo $themePath ?>/inc/timthumb.php?src=<?php echo $image_url; ?>&w=180&h=105&zc=1&q=95" alt="<?php the_title(); ?>" width="180" height="105" /> | |
377 | <?php } else { ?> | |
378 | <img src="<?php get_template_directory_uri(); ?>/images/portfolio-pic.png" alt="No Post Image for <?php the_title(); ?>" /> | |
379 | <?php } ?> | |
380 | </a> | |
381 | <p><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php echo ShortenTitle(get_the_title()); ?></a> | |
382 | <?php echo ShortenText(get_the_content()); ?></p> | |
383 | </li> | |
384 | <?php endwhile; else: ?> | |
385 | <?php endif; ?> | |
386 | <?php wp_reset_query(); | |
387 | echo '</ul>'; | |
388 | echo '</li>'; | |
389 | ||
390 | } | |
391 | function update( $new_instance, $old_instance ) { | |
392 | $instance = $old_instance; | |
393 | ||
394 | /* Strip tags (if needed) and update the widget settings. */ | |
395 | $instance['title'] = strip_tags( $new_instance['title'] ); | |
396 | $instance['show'] = strip_tags( $new_instance['show'] ); | |
397 | $instance['portfolio'] = strip_tags( $new_instance['portfolio'] ); | |
398 | return $instance; | |
399 | } | |
400 | function form($instance) { | |
401 | $defaults = array( 'title' => 'Portfolio', 'show' => '3' ); | |
402 | $instance = wp_parse_args( (array) $instance, $defaults ); ?> | |
403 | ||
404 | <p> | |
405 | <label for="<?php echo $this->get_field_id( 'title' ); ?>">Widget Title:</label> | |
406 | <input id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo $instance['title']; ?>" style="width:100%;" /> | |
407 | </p> | |
408 | <p> | |
409 | <label for="<?php echo $this->get_field_id( 'name' ); ?>">Which Portfolio? (custom post type name):</label> | |
410 | <input id="<?php echo $this->get_field_id( 'portfolio' ); ?>" name="<?php echo $this->get_field_name( 'portfolio' ); ?>" value="<?php echo $instance['portfolio']; ?>" style="width:100%;" /> | |
411 | </p> | |
412 | <p> | |
413 | <label for="<?php echo $this->get_field_id( 'name' ); ?>">Number of Portfolio (3 for frontpage):</label> | |
414 | <input id="<?php echo $this->get_field_id( 'name' ); ?>" name="<?php echo $this->get_field_name( 'show' ); ?>" value="<?php echo $instance['show']; ?>" style="width:100%;" /> | |
415 | </p> | |
416 | <?php | |
417 | } | |
418 | } | |
419 | function widget_sesoportfolio_init() | |
420 | { | |
421 | register_widget('widget_sesoportfolio'); | |
422 | } | |
423 | add_action('widgets_init', 'widget_sesoportfolio_init'); | |
424 | ||
425 | // Seso Twitter Widget | |
426 | class widget_sesotwitter extends WP_Widget { | |
427 | function widget_sesotwitter() { | |
428 | /* Widget settings. */ | |
429 | $widget_ops = array('description' => __('Display Your Tweets') ); | |
430 | ||
431 | /* Widget control settings. */ | |
432 | $control_ops = array( 'width' => 300, 'height' => 350, 'id_base' => 'sesotwitter' ); | |
433 | ||
434 | /* Create the widget. */ | |
435 | $this->WP_Widget( 'sesotwitter', __('Seso - Twitter'), $widget_ops, $control_ops ); | |
436 | } | |
437 | function widget($args, $instance) { | |
438 | extract($args); | |
439 | $title = apply_filters('widget_title', $instance['title']); | |
440 | $account = $instance['account']; | |
441 | $show = $instance['show']; | |
442 | $directory = get_bloginfo( template_url ); | |
443 | ||
444 | // Output | |
445 | echo $before_widget; | |
446 | echo '<h3>'.$title.'</h3>'; | |
447 | echo '<ul id="twitter_update_list"><li>Oops Twitter isnt working at the moment</li></ul>'; | |
448 | echo '<script type="text/javascript" src="http://twitter.com/javascripts/blogger.js"></script>'; | |
449 | echo '<script type="text/javascript" src="http://twitter.com/statuses/user_timeline/'.$account.'.json?callback=twitterCallback2&count='.$show.'"></script>'; | |
450 | echo $after_widget; | |
451 | } | |
452 | function update( $new_instance, $old_instance ) { | |
453 | $instance = $old_instance; | |
454 | ||
455 | $instance['title'] = strip_tags( $new_instance['title'] ); | |
456 | $instance['show'] = strip_tags( $new_instance['show'] ); | |
457 | $instance['account'] = strip_tags( $new_instance['account'] ); | |
458 | ||
459 | return $instance; | |
460 | } | |
461 | function form($instance) { | |
462 | $defaults = array( 'title' => 'Follow Us on Twitter', 'show' => '4', 'account' => 'anteksiler' ); | |
463 | $instance = wp_parse_args( (array) $instance, $defaults ); ?> | |
464 | ||
465 | <p> | |
466 | <label for="<?php echo $this->get_field_id( 'title' ); ?>">Widget Title:</label> | |
467 | <input id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo $instance['title']; ?>" style="width:100%;" /> | |
468 | </p> | |
469 | <p> | |
470 | <label for="<?php echo $this->get_field_id( 'account' ); ?>">Twitter Account:</label> | |
471 | <input id="<?php echo $this->get_field_id( 'account' ); ?>" name="<?php echo $this->get_field_name( 'account' ); ?>" value="<?php echo $instance['account']; ?>" style="width:100%;" /> | |
472 | </p> | |
473 | ||
474 | <p> | |
475 | <label for="<?php echo $this->get_field_id( 'show' ); ?>">Number of Tweets:</label> | |
476 | <input id="<?php echo $this->get_field_id( 'show' ); ?>" name="<?php echo $this->get_field_name( 'show' ); ?>" value="<?php echo $instance['show']; ?>" style="width:100%;" /> | |
477 | </p> | |
478 | <?php | |
479 | } | |
480 | } | |
481 | function widget_sesotwitter_init() | |
482 | { | |
483 | register_widget('widget_sesotwitter'); | |
484 | } | |
485 | add_action('widgets_init', 'widget_sesotwitter_init'); | |
486 | ||
487 | // Seso Video Widget | |
488 | ||
489 | class widget_sesovideo extends WP_Widget { | |
490 | ||
491 | function widget_sesovideo() { | |
492 | ||
493 | /* Widget settings. */ | |
494 | $widget_ops = array('description' => __('A widget that displays your YouTube or Vimeo Video.') ); | |
495 | ||
496 | /* Widget control settings. */ | |
497 | $control_ops = array( 'width' => 300, 'height' => 350, 'id_base' => 'sesovideo' ); | |
498 | ||
499 | /* Create the widget. */ | |
500 | $this->WP_Widget( 'sesovideo', __('Seso Video Widget'), $widget_ops, $control_ops ); | |
501 | } | |
502 | ||
503 | function widget( $args, $instance ) { | |
504 | extract( $args ); | |
505 | ||
506 | $title = apply_filters('widget_title', $instance['title'] ); | |
507 | $embed = $instance['embed']; | |
508 | $desc = $instance['desc']; | |
509 | ||
510 | // Output | |
511 | echo $before_widget; | |
512 | echo '<h3>'.$title.'</h3>'; | |
513 | ?> | |
514 | ||
515 | <div class="sesovideo"> | |
516 | <?php echo $embed ?> | |
517 | </div> | |
518 | <p class="sesovideodesc"><?php echo $desc ?></p> | |
519 | ||
520 | <?php | |
521 | echo $after_widget; | |
522 | } | |
523 | ||
524 | ||
525 | function update( $new_instance, $old_instance ) { | |
526 | $instance = $old_instance; | |
527 | ||
528 | $instance['title'] = strip_tags( $new_instance['title'] ); | |
529 | $instance['desc'] = stripslashes( $new_instance['desc']); | |
530 | $instance['embed'] = stripslashes( $new_instance['embed']); | |
531 | ||
532 | return $instance; | |
533 | } | |
534 | ||
535 | ||
536 | function form( $instance ) { | |
537 | ||
538 | ||
539 | $defaults = array( | |
540 | 'title' => 'Seso Video Widget', | |
541 | 'embed' => stripslashes( '<object width="290" height="180"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=16366948&server=vimeo.com&show_title=1&show_byline=1&show_portrait=1&color=00ADEF&fullscreen=1&autoplay=0&loop=0" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=16366948&server=vimeo.com&show_title=1&show_byline=1&show_portrait=1&color=00ADEF&fullscreen=1&autoplay=0&loop=0" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="290" height="180"></embed></object>'), | |
542 | 'desc' => 'Description of the video', | |
543 | ); | |
544 | $instance = wp_parse_args( (array) $instance, $defaults ); ?> | |
545 | ||
546 | <p> | |
547 | <label for="<?php echo $this->get_field_id( 'title' ); ?>">Title:</label> | |
548 | <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo $instance['title']; ?>" /> | |
549 | </p> | |
550 | <p> | |
551 | <label for="<?php echo $this->get_field_id( 'embed' ); ?>">Embed Code: (Width should be 290px max)</label> | |
552 | <textarea style="height:200px;" class="widefat" id="<?php echo $this->get_field_id( 'embed' ); ?>" name="<?php echo $this->get_field_name( 'embed' ); ?>"><?php echo stripslashes(htmlspecialchars(( $instance['embed'] ), ENT_QUOTES)); ?></textarea> | |
553 | </p> | |
554 | <p> | |
555 | <label for="<?php echo $this->get_field_id( 'desc' ); ?>">Description:</label> | |
556 | <input class="widefat" id="<?php echo $this->get_field_id( 'desc' ); ?>" name="<?php echo $this->get_field_name( 'desc' ); ?>" value="<?php echo stripslashes(htmlspecialchars(( $instance['desc'] ), ENT_QUOTES)); ?>" /> | |
557 | </p> | |
558 | ||
559 | <?php | |
560 | } | |
561 | } | |
562 | function widget_sesovideo_init() | |
563 | { | |
564 | register_widget('widget_sesovideo'); | |
565 | } | |
566 | add_action('widgets_init', 'widget_sesovideo_init'); | |
567 | ?> |