Advertisement
Guest User

widgets seso

a guest
Oct 19th, 2012
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 22.73 KB | None | 0 0
  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. extract($args);
  151. $title = apply_filters('widget_title', $instance['title']);
  152. $show = $instance['show'];
  153. global $post, $wpdb;
  154. $themePath = get_template_directory_uri();
  155. $recent_posts = new WP_Query('showposts='.$show.'');
  156. if ($name == "Seso Front Page") {
  157. // Output Frontpage
  158. echo '<li id="portfolio">';
  159. echo '<h3>'.$title.'</h3>';
  160. echo '<ul>';
  161. while ($recent_posts->have_posts()) : $recent_posts->the_post(); ?>
  162. <li>
  163. <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>">
  164. <?php if ( has_post_thumbnail() ) {
  165. $image_id = get_post_thumbnail_id();
  166. $image_url = wp_get_attachment_image_src($image_id,'full'); $image_url = $image_url[0]; ?>
  167. <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" />
  168. <?php } else { ?>
  169. <img src="<?php get_template_directory_uri(); ?>/images/portfolio-pic.png" alt="No Post Image for <?php the_title(); ?>" />
  170. <?php } ?>
  171. </a>
  172. <p><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php echo ShortenTitle(get_the_title()); ?></a>
  173. <?php echo ShortenText(get_the_content()); ?></p>
  174. </li>
  175. <?php endwhile;
  176. echo '</ul>';
  177. echo '</li>';
  178. } else {
  179. // Output other
  180. echo '<li id="thumbwidget">';
  181. echo '<h3>'.$title.'</h3>';
  182. echo '<ul>';
  183. while ($recent_posts->have_posts()) : $recent_posts->the_post(); ?>
  184. <li>
  185. <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>">
  186. <?php if ( has_post_thumbnail() ) {
  187. the_post_thumbnail('thumbnail');
  188. } else { ?>
  189. <img src="<?php get_template_directory_uri(); ?>/images/small-pic.png" alt="No Post Image for <?php the_title(); ?>" />
  190. <?php } ?>
  191. </a>
  192. <p><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php echo ShortenTitle(get_the_title()); ?></a><br />
  193. <span><?php the_time('F d, Y'); ?></span></p>
  194. </li>
  195. <?php endwhile;
  196. echo '</ul>';
  197. echo '</li>';
  198. }
  199. }
  200. function update( $new_instance, $old_instance ) {
  201. $instance = $old_instance;
  202.  
  203. /* Strip tags (if needed) and update the widget settings. */
  204. $instance['title'] = strip_tags( $new_instance['title'] );
  205. $instance['show'] = strip_tags( $new_instance['show'] );
  206.  
  207. return $instance;
  208. }
  209. function form($instance) {
  210. $defaults = array( 'title' => 'Recent Posts', 'show' => '4' );
  211. $instance = wp_parse_args( (array) $instance, $defaults ); ?>
  212.  
  213. <p>
  214. <label for="<?php echo $this->get_field_id( 'title' ); ?>">Widget Title:</label>
  215. <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%;" />
  216. </p>
  217.  
  218. <p>
  219. <label for="<?php echo $this->get_field_id( 'name' ); ?>">Number of Posts:</label>
  220. <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%;" />
  221. </p>
  222. <?php
  223. }
  224. }
  225. function widget_sesorecent_init()
  226. {
  227. register_widget('widget_sesorecent');
  228. }
  229. add_action('widgets_init', 'widget_sesorecent_init');
  230.  
  231. // Seso Popular Posts w/ Images
  232. class widget_sesopopular extends WP_Widget {
  233. function widget_sesopopular() {
  234. /* Widget settings. */
  235. $widget_ops = array( 'description' => __('Display popular posts with images') );
  236.  
  237. /* Widget control settings. */
  238. $control_ops = array( 'width' => 300, 'height' => 350, 'id_base' => 'sesopopular' );
  239.  
  240. /* Create the widget. */
  241. $this->WP_Widget( 'sesopopular', __('Seso - Popular Posts'), $widget_ops, $control_ops );
  242. }
  243.  
  244. function widget($args, $instance) {
  245. extract($args);
  246. $title = apply_filters('widget_title', $instance['title']);
  247. $show = $instance['show'];
  248. global $post, $wpdb;
  249. $themePath = get_template_directory_uri();
  250. $pop = new WP_Query();
  251. $pop->query('showposts='.$show.'&orderby=comment_count');
  252. if ($name == "Seso Front Page") {
  253. // Output Frontpage
  254. echo '<li id="portfolio">';
  255. echo '<h3>'.$title.'</h3>';
  256. echo '<ul>';
  257. while ($pop->have_posts()) : $pop->the_post(); ?>
  258. <li>
  259. <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>">
  260. <?php if ( has_post_thumbnail() ) {
  261. $image_id = get_post_thumbnail_id();
  262. $image_url = wp_get_attachment_image_src($image_id,'full'); $image_url = $image_url[0]; ?>
  263. <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" />
  264. <?php } else { ?>
  265. <img src="<?php get_template_directory_uri(); ?>/images/portfolio-pic.png" alt="No Post Image for <?php the_title(); ?>" />
  266. <?php } ?>
  267. </a>
  268. <p><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php echo ShortenTitle(get_the_title()); ?></a>
  269. <?php echo ShortenText(get_the_content()); ?></p>
  270. </li>
  271. <?php endwhile;
  272. echo '</ul>';
  273. echo '</li>';
  274. } else {
  275. // Output other
  276. echo '<li id="thumbwidget">';
  277. echo '<h3>'.$title.'</h3>';
  278. echo '<ul>';
  279. while ($pop->have_posts()) : $pop->the_post(); ?>
  280. <li>
  281. <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>">
  282. <?php if ( has_post_thumbnail() ) {
  283. the_post_thumbnail('thumbnail');
  284. } else { ?>
  285. <img src="<?php get_template_directory_uri(); ?>/images/small-pic.png" alt="No Post Image for <?php the_title(); ?>" />
  286. <?php } ?>
  287. </a>
  288. <p><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php echo ShortenTitle(get_the_title()); ?></a><br />
  289. <span><?php the_time('F d, Y'); ?></span></p>
  290. </li>
  291. <?php endwhile;
  292. echo '</ul>';
  293. echo '</li>';
  294. }
  295. }
  296. function update( $new_instance, $old_instance ) {
  297. $instance = $old_instance;
  298.  
  299. /* Strip tags (if needed) and update the widget settings. */
  300. $instance['title'] = strip_tags( $new_instance['title'] );
  301. $instance['show'] = strip_tags( $new_instance['show'] );
  302.  
  303. return $instance;
  304. }
  305. function form($instance) {
  306. $defaults = array( 'title' => 'Popular Posts', 'show' => '3' );
  307. $instance = wp_parse_args( (array) $instance, $defaults ); ?>
  308.  
  309. <p>
  310. <label for="<?php echo $this->get_field_id( 'title' ); ?>">Widget Title:</label>
  311. <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%;" />
  312. </p>
  313.  
  314. <p>
  315. <label for="<?php echo $this->get_field_id( 'name' ); ?>">Number of Posts:</label>
  316. <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%;" />
  317. </p>
  318. <?php
  319. }
  320. }
  321. function widget_sesopopular_init()
  322. {
  323. register_widget('widget_sesopopular');
  324. }
  325. add_action('widgets_init', 'widget_sesopopular_init');
  326.  
  327. // Seso Portfolio Widget
  328. class widget_sesoportfolio extends WP_Widget {
  329. function widget_sesoportfolio() {
  330. /* Widget settings. */
  331. $widget_ops = array( 'description' => __('Display portfolio with images') );
  332.  
  333. /* Widget control settings. */
  334. $control_ops = array( 'width' => 300, 'height' => 350, 'id_base' => 'sesoportfolio' );
  335.  
  336. /* Create the widget. */
  337. $this->WP_Widget( 'sesoportfolio', __('Seso - Portfolio'), $widget_ops, $control_ops );
  338. }
  339.  
  340. function widget($args, $instance) {
  341. extract($args);
  342. $title = apply_filters('widget_title', $instance['title']);
  343. $show = $instance['show'];
  344. $portfolio = $instance['portfolio'];
  345. global $post, $wpdb;
  346. $themePath = get_template_directory_uri();
  347. // Output Frontpage
  348. echo '<li id="portfolio">';
  349. echo '<h3>'.$title.'</h3>';
  350. echo '<ul>'; ?>
  351. <?php query_posts('post_type='.$portfolio.'&posts_per_page='.$show.''); ?>
  352. <?php if(have_posts()) : while(have_posts()) : the_post(); ?>
  353. <li>
  354. <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>">
  355. <?php if ( has_post_thumbnail() ) {
  356. $image_id = get_post_thumbnail_id();
  357. $image_url = wp_get_attachment_image_src($image_id,'full'); $image_url = $image_url[0]; ?>
  358. <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" />
  359. <?php } else { ?>
  360. <img src="<?php get_template_directory_uri(); ?>/images/portfolio-pic.png" alt="No Post Image for <?php the_title(); ?>" />
  361. <?php } ?>
  362. </a>
  363. <p><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php echo ShortenTitle(get_the_title()); ?></a>
  364. <?php echo ShortenText(get_the_content()); ?></p>
  365. </li>
  366. <?php endwhile; else: ?>
  367. <?php endif; ?>
  368. <?php wp_reset_query();
  369. echo '</ul>';
  370. echo '</li>';
  371.  
  372. }
  373. function update( $new_instance, $old_instance ) {
  374. $instance = $old_instance;
  375.  
  376. /* Strip tags (if needed) and update the widget settings. */
  377. $instance['title'] = strip_tags( $new_instance['title'] );
  378. $instance['show'] = strip_tags( $new_instance['show'] );
  379. $instance['portfolio'] = strip_tags( $new_instance['portfolio'] );
  380. return $instance;
  381. }
  382. function form($instance) {
  383. $defaults = array( 'title' => 'Portfolio', 'show' => '3' );
  384. $instance = wp_parse_args( (array) $instance, $defaults ); ?>
  385.  
  386. <p>
  387. <label for="<?php echo $this->get_field_id( 'title' ); ?>">Widget Title:</label>
  388. <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%;" />
  389. </p>
  390. <p>
  391. <label for="<?php echo $this->get_field_id( 'name' ); ?>">Which Portfolio? (custom post type name):</label>
  392. <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%;" />
  393. </p>
  394. <p>
  395. <label for="<?php echo $this->get_field_id( 'name' ); ?>">Number of Portfolio (3 for frontpage):</label>
  396. <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%;" />
  397. </p>
  398. <?php
  399. }
  400. }
  401. function widget_sesoportfolio_init()
  402. {
  403. register_widget('widget_sesoportfolio');
  404. }
  405. add_action('widgets_init', 'widget_sesoportfolio_init');
  406.  
  407. // Seso Twitter Widget
  408. class widget_sesotwitter extends WP_Widget {
  409. function widget_sesotwitter() {
  410. /* Widget settings. */
  411. $widget_ops = array('description' => __('Display Your Tweets') );
  412.  
  413. /* Widget control settings. */
  414. $control_ops = array( 'width' => 300, 'height' => 350, 'id_base' => 'sesotwitter' );
  415.  
  416. /* Create the widget. */
  417. $this->WP_Widget( 'sesotwitter', __('Seso - Twitter'), $widget_ops, $control_ops );
  418. }
  419. function widget($args, $instance) {
  420. extract($args);
  421. $title = apply_filters('widget_title', $instance['title']);
  422. $account = $instance['account'];
  423. $show = $instance['show'];
  424. $directory = get_bloginfo( template_url );
  425.  
  426. // Output
  427. echo $before_widget;
  428. echo '<h3>'.$title.'</h3>';
  429. echo '<ul id="twitter_update_list"><li>Oops Twitter isnt working at the moment</li></ul>';
  430. echo '<script type="text/javascript" src="http://twitter.com/javascripts/blogger.js"></script>';
  431. echo '<script type="text/javascript" src="http://twitter.com/statuses/user_timeline/'.$account.'.json?callback=twitterCallback2&amp;count='.$show.'"></script>';
  432. echo $after_widget;
  433. }
  434. function update( $new_instance, $old_instance ) {
  435. $instance = $old_instance;
  436.  
  437. $instance['title'] = strip_tags( $new_instance['title'] );
  438. $instance['show'] = strip_tags( $new_instance['show'] );
  439. $instance['account'] = strip_tags( $new_instance['account'] );
  440.  
  441. return $instance;
  442. }
  443. function form($instance) {
  444. $defaults = array( 'title' => 'Follow Us on Twitter', 'show' => '4', 'account' => 'anteksiler' );
  445. $instance = wp_parse_args( (array) $instance, $defaults ); ?>
  446.  
  447. <p>
  448. <label for="<?php echo $this->get_field_id( 'title' ); ?>">Widget Title:</label>
  449. <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%;" />
  450. </p>
  451. <p>
  452. <label for="<?php echo $this->get_field_id( 'account' ); ?>">Twitter Account:</label>
  453. <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%;" />
  454. </p>
  455.  
  456. <p>
  457. <label for="<?php echo $this->get_field_id( 'show' ); ?>">Number of Tweets:</label>
  458. <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%;" />
  459. </p>
  460. <?php
  461. }
  462. }
  463. function widget_sesotwitter_init()
  464. {
  465. register_widget('widget_sesotwitter');
  466. }
  467. add_action('widgets_init', 'widget_sesotwitter_init');
  468.  
  469. // Seso Video Widget
  470.  
  471. class widget_sesovideo extends WP_Widget {
  472.  
  473. function widget_sesovideo() {
  474.  
  475. /* Widget settings. */
  476. $widget_ops = array('description' => __('A widget that displays your YouTube or Vimeo Video.') );
  477.  
  478. /* Widget control settings. */
  479. $control_ops = array( 'width' => 300, 'height' => 350, 'id_base' => 'sesovideo' );
  480.  
  481. /* Create the widget. */
  482. $this->WP_Widget( 'sesovideo', __('Seso Video Widget'), $widget_ops, $control_ops );
  483. }
  484.  
  485. function widget( $args, $instance ) {
  486. extract( $args );
  487.  
  488. $title = apply_filters('widget_title', $instance['title'] );
  489. $embed = $instance['embed'];
  490. $desc = $instance['desc'];
  491.  
  492. // Output
  493. echo $before_widget;
  494. echo '<h3>'.$title.'</h3>';
  495. ?>
  496.  
  497. <div class="sesovideo">
  498. <?php echo $embed ?>
  499. </div>
  500. <p class="sesovideodesc"><?php echo $desc ?></p>
  501.  
  502. <?php
  503. echo $after_widget;
  504. }
  505.  
  506.  
  507. function update( $new_instance, $old_instance ) {
  508. $instance = $old_instance;
  509.  
  510. $instance['title'] = strip_tags( $new_instance['title'] );
  511. $instance['desc'] = stripslashes( $new_instance['desc']);
  512. $instance['embed'] = stripslashes( $new_instance['embed']);
  513.  
  514. return $instance;
  515. }
  516.  
  517.  
  518. function form( $instance ) {
  519.  
  520.  
  521. $defaults = array(
  522. 'title' => 'Seso Video Widget',
  523. '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&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=1&amp;color=00ADEF&amp;fullscreen=1&amp;autoplay=0&amp;loop=0" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=16366948&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=1&amp;color=00ADEF&amp;fullscreen=1&amp;autoplay=0&amp;loop=0" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="290" height="180"></embed></object>'),
  524. 'desc' => 'Description of the video',
  525. );
  526. $instance = wp_parse_args( (array) $instance, $defaults ); ?>
  527.  
  528. <p>
  529. <label for="<?php echo $this->get_field_id( 'title' ); ?>">Title:</label>
  530. <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo $instance['title']; ?>" />
  531. </p>
  532. <p>
  533. <label for="<?php echo $this->get_field_id( 'embed' ); ?>">Embed Code: (Width should be 290px max)</label>
  534. <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>
  535. </p>
  536. <p>
  537. <label for="<?php echo $this->get_field_id( 'desc' ); ?>">Description:</label>
  538. <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)); ?>" />
  539. </p>
  540.  
  541. <?php
  542. }
  543. }
  544. function widget_sesovideo_init()
  545. {
  546. register_widget('widget_sesovideo');
  547. }
  548. add_action('widgets_init', 'widget_sesovideo_init');
  549. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement