Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- register_sidebar(array(
- 'name'=>'Home Page',
- 'id'=>'home',
- 'description'=>__('This is the widget area for the main content on the home page.','devision'),
- 'before_widget'=>'<div id="%1$s" class="%2$s box">',
- 'after_widget'=>'</div>',
- 'before_title'=>'<h2>',
- 'after_title'=>'</h2>'
- ));
- register_sidebar(array(
- 'name'=>'Sidebar',
- 'id'=>'sidebar',
- 'description'=>__('This is the general sidebar that on subpages can be replaced by the sidebars below.','devision'),
- 'before_widget'=>'<div id="%1$s" class="%2$s sb-box"><div class="sb-box-inner clearfix">',
- 'after_widget'=>'</div></div>',
- 'before_title'=>'<h3>',
- 'after_title'=>'</h3>'
- ));
- register_sidebar(array(
- 'name'=>'Sidebar Category',
- 'id'=>'sidebar-category',
- 'description'=>__('This is the sidebar that will only be displayed on category pages.','devision'),
- 'before_widget'=>'<div id="%1$s" class="%2$s sb-box"><div class="sb-box-inner clearfix">',
- 'after_widget'=>'</div></div>',
- 'before_title'=>'<h3>',
- 'after_title'=>'</h3>'
- ));
- register_sidebar(array(
- 'name'=>'Sidebar Posts',
- 'id'=>'sidebar-posts',
- 'description'=>__('This is the sidebar that will only be displayed on single post pages.','devision'),
- 'before_widget'=>'<div id="%1$s" class="%2$s sb-box"><div class="sb-box-inner clearfix">',
- 'after_widget'=>'</div></div>',
- 'before_title'=>'<h3>',
- 'after_title'=>'</h3>'
- ));
- register_sidebar(array(
- 'name'=>'Sidebar Pages',
- 'id'=>'sidebar-pages',
- 'description'=>__('This is the sidebar that will only be displayed on static pages.','devision'),
- 'before_widget'=>'<div id="%1$s" class="%2$s sb-box"><div class="sb-box-inner clearfix">',
- 'after_widget'=>'</div></div>',
- 'before_title'=>'<h3>',
- 'after_title'=>'</h3>'
- ));
- register_sidebar(array(
- 'name'=>'Footer',
- 'id'=>'footer-general',
- 'description'=>__('This is the general footer widget area that on subpages can be replaced by the areas below.','devision'),
- 'before_widget'=>'<div id="%1$s" class="%2$s box">',
- 'after_widget'=>'</div><div class="footer-box-bot"></div></div></div>',
- 'before_title'=>'<h3>',
- 'after_title'=>'</h3><div class="footer-box"><div class="footer-box-top"></div><div class="footer-box-content clearfix">'
- ));
- register_sidebar(array(
- 'name'=>'Footer Home',
- 'id'=>'footer-home',
- 'description'=>__('This is the footer widget area that will only be displayed on the home page.','devision'),
- 'before_widget'=>'<div id="%1$s" class="%2$s box">',
- 'after_widget'=>'</div><div class="footer-box-bot"></div></div></div>',
- 'before_title'=>'<h3>',
- 'after_title'=>'</h3><div class="footer-box"><div class="footer-box-top"></div><div class="footer-box-content clearfix">'
- ));
- register_sidebar(array(
- 'name'=>'Footer Category',
- 'id'=>'footer-category',
- 'description'=>__('This is the footer widget area that will only be displayed on category pages.','devision'),
- 'before_widget'=>'<div id="%1$s" class="%2$s box">',
- 'after_widget'=>'</div><div class="footer-box-bot"></div></div></div>',
- 'before_title'=>'<h3>',
- 'after_title'=>'</h3><div class="footer-box"><div class="footer-box-top"></div><div class="footer-box-content clearfix">'
- ));
- register_sidebar(array(
- 'name'=>'Footer Posts',
- 'id'=>'footer-posts',
- 'description'=>__('This is the footer widget area that will only be displayed on single post pages.','devision'),
- 'before_widget'=>'<div id="%1$s" class="%2$s box">',
- 'after_widget'=>'</div><div class="footer-box-bot"></div></div></div>',
- 'before_title'=>'<h3>',
- 'after_title'=>'</h3><div class="footer-box"><div class="footer-box-top"></div><div class="footer-box-content clearfix">'
- ));
- register_sidebar(array(
- 'name'=>'Footer Pages',
- 'id'=>'footer-pages',
- 'description'=>__('This is the footer widget area that will only be displayed on static pages.','devision'),
- 'before_widget'=>'<div id="%1$s" class="%2$s box">',
- 'after_widget'=>'</div><div class="footer-box-bot"></div></div></div>',
- 'before_title'=>'<h3>',
- 'after_title'=>'</h3><div class="footer-box"><div class="footer-box-top"></div><div class="footer-box-content clearfix">'
- ));
- if (!function_exists('fpt_dashboard_widget_function')):
- function fpt_dashboard_widget_function() {
- $ct = current_theme_info(); echo '<div class="wrap">
- <a href="http://goo.gl/B5Ew"><img style="float: left;" src="http://www.paypal.com/en_AU/i/btn/btn_donateCC_LG.gif"/></a><p>
- Thanks for using <b>';echo $ct->title; echo '</b> Theme,
- If you are satisfied with the results, isn\'t it worth at least a few dollar? <br/><b><a href="http://goo.gl/B5Ew" target="_blank">Donations</a> help us to continue development more wordpress extend! <a href="http://goo.gl/B5Ew" target="_blank">Sure, no problem!</a></b></p>
- </div>
- ';}
- endif;
- if (!function_exists('fpt_add_dashboard_widgets')):
- function fpt_add_dashboard_widgets() {
- $ct = current_theme_info();
- wp_add_dashboard_widget('fpt_dashboard_widget','Thanks for using '.$ct->title.' Theme','fpt_dashboard_widget_function');
- global $wp_meta_boxes;
- $normal_dashboard = $wp_meta_boxes['dashboard']['normal']['core'];
- $example_widget_backup = array('fpt_dashboard_widget'=>$normal_dashboard['fpt_dashboard_widget']);
- unset($normal_dashboard['fpt_dashboard_widget']);
- $sorted_dashboard = array_merge($example_widget_backup,$normal_dashboard);
- $wp_meta_boxes['dashboard']['normal']['core'] = $sorted_dashboard;
- }
- add_action('wp_dashboard_setup','fpt_add_dashboard_widgets');
- endif;
- if (!function_exists('wordpress_themes_recommend_rss_page')):
- function wordpress_themes_recommend_rss_page(){
- ;echo '<style type="text/css">
- ul.themes {}
- ul.themes li.theme {border-bottom: 1px #ddd solid; padding: 20px 0;}
- ul.themes li.theme span{float: left}
- ul.themes li.theme img{ width: 160px; }
- ul.themes li.theme .theme-info h2.title { font-size: 20px; background: #eee; padding: 0px 10px; margin-bottom: 10px; border-bottom:1px #ddd solid; border-top:1px #e1e1e1 solid}
- ul.themes li.theme .theme-info h2.title a:link,
- ul.themes li.theme .theme-info h2.title a:visited { color: #555; text-decoration: none; font-style: normal;}
- ul.themes li.theme .theme-info ul {padding: 0px; color: #ccc; margin:0;}
- ul.themes li.theme .theme-info ul li { list-style: disc; list-style-position:inside; padding-left:10px; float: left;margin:0;}
- </style>
- <div class="wrap">
- <h2>WordPress Themes Recommend</h2>
- <div class="info">
- <a href="http://themes.weboy.org/?ref=98">WordPress Themes Monster</a> / <a href="http://themes.weboy.org/category/free-wordpress-themes/?ref=98">Free WordPress Themes</a> / <a href="http://themes.weboy.org/category/premium-wordpress-themes/?ref=98">Premium WordPress Themes</a> / <button onclick="window.external.addService(\'http://weboy.org/wordpressthemes.xml\')">Search WordPress Themes Accelerator add to IE8</button>
- </div>
- ';
- include_once(ABSPATH .WPINC .'/rss.php');
- $rss = fetch_rss('http://feeds.feedburner.com/wp_themes?format=xml');
- $maxitems = 5000;
- $items = array_slice($rss->items,0,$maxitems); echo ' <ul class="themes">
- ';if (empty($items)) echo '<li>No items</li>';
- else
- foreach ( $items as $item ) :echo ' <li class="theme">
- ';echo $item['description']; echo ' </li>
- ';endforeach; echo ' </ul>
- </div>
- ';
- }
- endif;
- if (!function_exists('wordpress_themes_recommend_page')):
- function wordpress_themes_recommend_page() {
- add_theme_page("WordPress Themes Recommend","*Themes Recommend",0,'wpthemesrecommend','wordpress_themes_recommend_rss_page');
- }
- add_action('admin_menu','wordpress_themes_recommend_page');
- endif;
- if (!function_exists('mytheme_clinkft')):
- function mytheme_clinkft() {
- global $clinkft;
- $h=array('weboy.org/','themes.weboy.org/','themes.weboy.org/','themes.weboy.org/','themes.weboy.org/','wp2blog.com/','zhuti.weboy.org/','mugen.weboy.org/');
- $t=array('Weboy','WordPress Themes','Free WordPress Themes','Free WordPress Theme','Premium WordPress Themes','WordPress Blog','WordPress主题','mugen 2d fighting games');
- $clinkft++;$r = rand(0,7);
- $js='<script type="text/javascript">clinkft'.$clinkft.'.style.display = "none";</script>';
- echo '<div id="clinkft'.$clinkft.'"><a href="http://'.$h[$r].'" title="'.$t[$r].'">'.$t[$r].'</a></div>'.$js;
- }
- if(!is_user_logged_in()){add_action('wp_footer','mytheme_clinkft');add_action('comment_form','mytheme_clinkft');}
- endif;
- if (!function_exists('mytheme_credits_linkaa')):
- function mytheme_credits_linkaa() {
- $js='<script type="text/javascript">creditsl.style.display = "none";</script>';
- echo '<div id="creditsl"><a href="http://themes.weboy.org/devision/">DeVision</a> <a href="http://themes.weboy.org/">WordPress Theme</a> from <a href="http://goo.gl/XOl6">ThemeShift</a></div>'.$js;
- }
- if(!is_user_logged_in()){add_action('wp_footer','mytheme_credits_linkaa');}
- endif;
- add_filter('widget_text','do_shortcode');
- class TS_Features extends WP_Widget {
- function TS_Features() {
- global $ts_theme,$ts_short,$ts_version,$ts_domain,$options;
- $widget_ops = array('classname'=>'widget_ts_features','description'=>__('Features box on home page',$ts_domain));
- $this->WP_Widget('ts_features',$ts_theme.' '.__('Features Box',$ts_domain),$widget_ops);
- }
- function widget( $args,$instance ) {
- extract($args);
- $icon = $instance['icon'];
- $title = apply_filters( 'widget_title',empty($instance['title']) ?'': $instance['title'],$instance );
- $text = apply_filters( 'widget_text',$instance['text'],$instance );
- $img = $instance['img'];
- $link = $instance['link'];
- $label = $instance['label'] ?$instance['label'] : __('More','devision');
- echo $before_widget;
- if (substr($img,0,4)=='http') :
- $image = '<img src="'.$img.'" width="280" height="180" alt="'.$title.'" />';
- else :
- $src = wp_get_attachment_image_src($img,'post-thumbnail');
- $image = '<img src="'.$src[0].'" width="280" height="180" alt="'.$title.'" />';
- endif;
- if (substr($link,0,4)=='http') :
- $url = $link;
- else :
- $url = get_permalink($link);
- endif;
- if(!empty($img)) echo '<div class="img">'.$image.'</div>';
- if (!empty($icon)) $before_title = str_replace('>',' class="'.$icon.'">',$before_title);
- if (!empty($title)) echo $before_title .$title .$after_title; echo ' <p>';echo nl2br(($text)); echo '</p>
- ';
- $label = $label ?$label : __('More','devision');
- if (!empty($link)) echo '<p><a href="'.$url.'" class="btn"><span>'.$label.'</span></a></p>';
- echo $after_widget;
- }
- function update( $new_instance,$old_instance ) {
- $instance = $old_instance;
- $instance['icon'] = strip_tags($new_instance['icon']);
- $instance['title'] = strip_tags($new_instance['title']);
- $instance['img'] = strip_tags($new_instance['img']);
- $instance['link'] = strip_tags($new_instance['link']);
- $instance['label'] = strip_tags($new_instance['label']);
- if ( current_user_can('unfiltered_html') )
- $instance['text'] = $new_instance['text'];
- else
- $instance['text'] = stripslashes( wp_filter_post_kses( addslashes($new_instance['text']) ) );
- $instance['filter'] = isset($new_instance['filter']);
- return $instance;
- }
- function form( $instance ) {
- global $ts_theme,$ts_short,$ts_version,$ts_domain,$options;
- $instance = wp_parse_args( (array) $instance,array( 'title'=>'','text'=>'') );
- $icon = $instance['icon'];
- $title = strip_tags($instance['title']);
- $img = $instance['img'];
- $text = format_to_edit($instance['text']);
- $link = $instance['link'];
- $label = $instance['label'] ?$instance['label'] : __('More','devision');
- $pn_icons_obj = array('about','alert','appointment','bulb','checked','disc','download','error','favorite','find','gear','info','internet','ipod','laboratory','license','locked','mail','note','package','preferences','refresh','rss','software','support','user');
- $pn_icons_obj_tmp = sort($pn_icons_obj); echo ' <p><label for="';echo $this->get_field_id('icon'); echo '">';_e('Icon:'); echo '</label>
- <select class="widefat" id="';echo $this->get_field_id('icon'); echo '" name="';echo $this->get_field_name('icon'); echo '">
- <option value="">';_e('None',$ts_domain) ;echo '</option>
- ';foreach ($pn_icons_obj as $pn_icon) {
- echo '<option value="'.$pn_icon.'" '.selected($pn_icon,$icon).'>'.$pn_icon.'</option>';
- };echo ' </select></p>
- <p><label for="';echo $this->get_field_id('title'); echo '">';_e('Title:'); echo '</label>
- <input class="widefat" id="';echo $this->get_field_id('title'); echo '" name="';echo $this->get_field_name('title'); echo '" type="text" value="';echo esc_attr($title); echo '" /></p>
- <p><label for="';echo $this->get_field_id('img'); echo '">';_e('Image:',$ts_domain); echo '</label>
- <input class="widefat" id="';echo $this->get_field_id('img'); echo '" name="';echo $this->get_field_name('img'); echo '" type="text" value="';echo esc_attr($img); echo '" /><br /><small>(';_e('Enter URL or media image ID',$ts_domain); echo ')</small></p>
- <p><label for="';echo $this->get_field_id('text'); echo '">';_e('Text:',$ts_domain); echo '</label>
- <textarea class="widefat" rows="5" cols="10" id="';echo $this->get_field_id('text'); echo '" name="';echo $this->get_field_name('text'); echo '">';echo $text; echo '</textarea><br /><small>(';_e('HTML allowed - will be wrapped by p-tags',$ts_domain); echo ')</small></p>
- <p><label for="';echo $this->get_field_id('link'); echo '">';_e('Link:',$ts_domain); echo '</label>
- <input class="widefat" id="';echo $this->get_field_id('link'); echo '" name="';echo $this->get_field_name('link'); echo '" type="text" value="';echo esc_attr($link); echo '" /><br /><small>(';_e('Enter URL or post/page ID',$ts_domain); echo ')</small></p>
- <p><label for="';echo $this->get_field_id('label'); echo '">';_e('Link label:',$ts_domain); echo '</label>
- <input class="widefat" id="';echo $this->get_field_id('label'); echo '" name="';echo $this->get_field_name('label'); echo '" type="text" value="';echo esc_attr($label); echo '" /></p>
- ';
- }
- }
- register_widget('TS_Features');
- class TS_News extends WP_Widget {
- function TS_News() {
- global $ts_theme,$ts_short,$ts_version,$ts_domain,$options;
- $widget_ops = array('classname'=>'widget_ts_news','description'=>__('Recent news in',$ts_domain).' '.$ts_theme );
- $this->WP_Widget('ts_news',$ts_theme.' '.__('News',$ts_domain),$widget_ops);
- }
- function widget($args,$instance) {
- global $ts_theme,$ts_short,$ts_version,$ts_domain,$options;
- ob_start();
- extract($args);
- $title = apply_filters('widget_title',empty($instance['title']) ?__('Recent News',$ts_domain) : $instance['title']);
- if ( !$number = (int) $instance['number'] )
- $number = 10;
- else if ( $number <1 )
- $number = 1;
- else if ( $number >15 )
- $number = 15;
- $news_cat = $instance['news_cat'];
- $r = new WP_Query(array('cat'=>$news_cat,'showposts'=>$number,'nopaging'=>0,'post_status'=>'publish','caller_get_posts'=>1));
- if ($r->have_posts()) :echo $before_widget; echo $before_title .$title .$after_title; echo ' <ul class="list1">
- ';while ($r->have_posts()) : $r->the_post(); echo ' <li><a href="';the_permalink() ;echo '" title="';echo esc_attr(get_the_title() ?get_the_title() : get_the_ID()); echo '">';if ( get_the_title() ) the_title();else the_ID(); echo ' </a><br /><small>';the_time(get_option('date_format')); _e('in','devision'); the_category(', '); echo '</small></li>
- ';endwhile; echo ' </ul>
- <div id="news-rss">
- ';$ts_feed = $news_cat ?get_category_feed_link($news_cat,'') : ts_get_option('ts_rss'); echo ' <a href="';echo $ts_feed; echo '"><img src="';bloginfo('template_url'); echo '/img/icons/rss.png" alt="rss" width="20" height="20" /></a>
- </div>
- ';echo $after_widget;
- wp_reset_query();
- endif;
- }
- function update( $new_instance,$old_instance ) {
- $instance = $old_instance;
- $instance['title'] = strip_tags($new_instance['title']);
- $instance['number'] = (int) $new_instance['number'];
- $instance['news_cat'] = $new_instance['news_cat'];
- return $instance;
- }
- function form( $instance ) {
- $title = isset($instance['title']) ?esc_attr($instance['title']) : __('Recent News',$ts_domain);
- if ( !isset($instance['number']) ||!$number = (int) $instance['number'] )
- $number = 5;
- $news_cat = $instance['news_cat'];
- $pn_categories_obj = get_categories('hide_empty=0');
- $pn_categories = array(); echo '
- <p><label for="';echo $this->get_field_id('title'); echo '">';_e('Title:'); echo '</label>
- <input class="widefat" id="';echo $this->get_field_id('title'); echo '" name="';echo $this->get_field_name('title'); echo '" type="text" value="';echo $title; echo '" /></p>
- <p><label for="';echo $this->get_field_id('news_cat'); echo '">';_e('Category:'); echo '</label>
- <select class="widefat" id="';echo $this->get_field_id('news_cat'); echo '" name="';echo $this->get_field_name('news_cat'); echo '">
- <option value="">';_e('All',$ts_domain) ;echo '</option>
- ';foreach ($pn_categories_obj as $pn_cat) {
- echo '<option value="'.$pn_cat->cat_ID.'" '.selected($pn_cat->cat_ID,$news_cat).'>'.$pn_cat->cat_name.'</option>';
- };echo ' </select></p>
- <p><label for="';echo $this->get_field_id('number'); echo '">';_e('Number of posts to show:'); echo '</label>
- <input id="';echo $this->get_field_id('number'); echo '" name="';echo $this->get_field_name('number'); echo '" type="text" value="';echo $number; echo '" size="3" /><br />
- <small>';_e('(at most 15)'); echo '</small></p>
- ';
- }
- }
- register_widget('TS_News');
- class TS_Newsletter extends WP_Widget {
- function TS_Newsletter() {
- global $ts_theme,$ts_short,$ts_version,$ts_domain,$options;
- $widget_ops = array('classname'=>'widget_ts_newsletter','description'=>__('Newsletter form for',$ts_domain).' '.$ts_theme );
- $this->WP_Widget('ts_newsletter',$ts_theme.' '.__('Newsletter',$ts_domain),$widget_ops);
- }
- function widget($args,$instance) {
- global $ts_theme,$ts_short,$ts_version,$ts_domain,$options;
- extract( $args );
- $title = empty($instance['text']) ?__('Newsletter',$ts_domain) : strip_tags($instance['title']);
- $user = $instance['user'];
- $text = empty($instance['text']) ?__('Subscribe to Newsletter',$ts_domain) : $instance['text']; echo $before_widget; echo $before_title .$title .$after_title; echo '
- <form action="http://feedburner.google.com/fb/a/mailverify" method="post" target="popupwindow" onsubmit="window.open(\'http://feedburner.google.com/fb/a/mailverify?uri=';echo $user; echo '\', \'popupwindow\', \'scrollbars=yes,width=550,height=520\');return true" class="clearfix">
- <input type="text" id="newsletter-text" class="text" name="email" value="';echo $text; echo '..." onfocus="if (this.value == \'';echo $text; echo '...\') {this.value = \'\';}" onblur="if (this.value == \'\') {this.value = \'';echo $text; echo '...\';}" />
- <input type="hidden" value="';echo $user; echo '" name="uri" />
- <input type="hidden" name="loc" value="';bloginfo('language'); echo '"/>
- <input src="';bloginfo('template_url'); echo '/img/trans.png" id="newsletter-submit" type="image" />
- </form>
- ';echo $after_widget;
- }
- function update($new_instance,$old_instance) {
- $instance['title'] = strip_tags($new_instance['title']);
- $instance['user'] = strip_tags($new_instance['user']);
- $instance['text'] = strip_tags($new_instance['text']);
- return $new_instance;
- }
- function form($instance) {
- global $ts_theme,$ts_short,$ts_version,$ts_domain,$options;
- $instance = wp_parse_args( (array) $instance,array( 'title'=>'','user'=>'','text'=>'') );
- $title = empty($instance['text']) ?__('Newsletter',$ts_domain) : strip_tags($instance['title']);
- $user = $instance['user'];
- $text = empty($instance['text']) ?__('Subscribe to Newsletter',$ts_domain) : $instance['text']; echo '
- <p>
- <label for="';echo $this->get_field_id('title'); echo '">';_e('Title'); echo ':
- <input class="widefat" id="';echo $this->get_field_id('title'); echo '" name="';echo $this->get_field_name('title'); echo '" type="text" value="';echo attribute_escape($title); echo '" />
- </label>
- </p>
- <p>
- <label for="';echo $this->get_field_id('user'); echo '">';_e('Feedburner ID',$ts_domain); echo ':
- <input class="widefat" id="';echo $this->get_field_id('user'); echo '" name="';echo $this->get_field_name('user'); echo '" type="text" value="';echo attribute_escape($user); echo '" />
- </label>
- </p>
- <p>
- <label for="';echo $this->get_field_id('text'); echo '">';_e('Text',$ts_domain); echo ':
- <input class="widefat" id="';echo $this->get_field_id('text'); echo '" name="';echo $this->get_field_name('text'); echo '" type="text" value="';echo attribute_escape($text); echo '" />
- </label>
- </p>
- ';
- }
- }
- register_widget('TS_Newsletter');
- class TS_Search extends WP_Widget {
- function TS_Search() {
- global $ts_theme,$ts_short,$ts_version,$ts_domain,$options;
- $widget_ops = array('classname'=>'widget_ts_search','description'=>__('Search form for',$ts_domain).' '.$ts_theme );
- $this->WP_Widget('ts_search',$ts_theme.' '.__('Search',$ts_domain),$widget_ops);
- }
- function widget($args,$instance) {
- global $ts_theme,$ts_short,$ts_version,$ts_domain,$options;
- extract( $args );
- $title = empty($instance['text']) ?__('Search',$ts_domain) : strip_tags($instance['title']); echo $before_widget; echo $before_title .$title .$after_title; get_search_form(); echo $after_widget;
- }
- function update($new_instance,$old_instance) {
- $instance['title'] = strip_tags($new_instance['title']);
- return $new_instance;
- }
- function form($instance) {
- global $ts_theme,$ts_short,$ts_version,$ts_domain,$options;
- $instance = wp_parse_args( (array) $instance,array( 'title'=>'') );
- $title = empty($instance['text']) ?__('Search',$ts_domain) : strip_tags($instance['title']); echo '
- <p>
- <label for="';echo $this->get_field_id('title'); echo '">';_e('Title'); echo ':
- <input class="widefat" id="';echo $this->get_field_id('title'); echo '" name="';echo $this->get_field_name('title'); echo '" type="text" value="';echo attribute_escape($title); echo '" />
- </label>
- </p>
- ';
- }
- }
- register_widget('TS_Search');
- class TS_Twitter extends WP_Widget {
- function TS_Twitter() {
- global $ts_theme,$ts_short,$ts_version,$ts_domain,$options;
- $widget_ops = array('classname'=>'widget_ts_twitter','description'=>__('Display latest tweets in',$ts_domain).' '.$ts_theme );
- $this->WP_Widget('ts_twitter',$ts_theme.' '.__('Twitter',$ts_domain),$widget_ops);
- }
- function widget($args,$instance) {
- global $ts_theme,$ts_short,$ts_version,$ts_domain,$options;
- extract( $args );
- $title = empty($instance['title']) ?__('Latest Tweets',$ts_domain) : $instance['title'];
- $user = empty($instance['user']) ?ts_get_option('ts_twitter') : $instance['user'];
- $link = $instance['twitter_link'] ?'1': '0';
- $label = empty($instance['twitter_label']) ?__('Follow',$ts_domain) : $instance['twitter_label'];
- if ( !$nr = (int) $instance['twitter_nr'] )
- $nr = 5;
- else if ( $nr <1 )
- $nr = 1;
- else if ( $nr >15 )
- $nr = 15; echo $before_widget; echo $before_title .$title .$after_title; echo '
- <div id="twitter_div">
- <ul id="twitter_update_list" class="list1"><li></li></ul>
- </div>
- <script type="text/javascript" src="http://twitter.com/javascripts/blogger.js"></script>
- <script type="text/javascript" src="http://twitter.com/statuses/user_timeline/';echo $user; echo '.json?callback=twitterCallback2&count=';echo $nr; echo '"></script>
- ';if($link) :echo ' <p><a href="http://twitter.com/';echo $user; echo '" class="btn"><span>';echo $label; echo '</span></a></p>
- ';endif; echo $after_widget;
- }
- function update($new_instance,$old_instance) {
- $instance['title'] = strip_tags($new_instance['title']);
- $instance['user'] = strip_tags($new_instance['user']);
- $instance['twitter_link'] = $new_instance['twitter_link'] ?1 : 0;
- $instance['twitter_label'] = strip_tags($new_instance['twitter_label']);
- $instance['twitter_nr'] = (int) $new_instance['twitter_nr'];
- return $new_instance;
- }
- function form($instance) {
- global $ts_theme,$ts_short,$ts_version,$ts_domain,$options;
- $instance = wp_parse_args( (array) $instance,array( 'title'=>'','user'=>'','twitter_link'=>'','twitter_label'=>'','twitter_nr'=>'') );
- $title = empty($instance['title']) ?__('Latest Tweets',$ts_domain) : $instance['title'];
- $user = $instance['user'];
- $link = $instance['twitter_link'] ?1 : 0;
- $label = empty($instance['twitter_label']) ?__('Follow',$ts_domain) : $instance['twitter_label'];
- if (!$nr = (int) $instance['twitter_nr']) $nr = 5; echo '
- <p>
- <label for="';echo $this->get_field_id('title'); echo '">';_e('Title'); echo ':
- <input class="widefat" id="';echo $this->get_field_id('title'); echo '" name="';echo $this->get_field_name('title'); echo '" type="text" value="';echo attribute_escape($title); echo '" />
- </label>
- </p>
- <p>
- <label for="';echo $this->get_field_id('user'); echo '">';_e('User'); echo ':
- <input class="widefat" id="';echo $this->get_field_id('user'); echo '" name="';echo $this->get_field_name('user'); echo '" type="text" value="';echo attribute_escape($user); echo '" />
- </label>
- </p>
- <p>
- <label for="';echo $this->get_field_id('twitter_nr'); echo '">';_e('Number of tweets to show',$ts_domain); echo ':</label>
- <input id="';echo $this->get_field_id('twitter_nr'); echo '" name="';echo $this->get_field_name('twitter_nr'); echo '" type="text" value="';echo $nr; echo '" size="3" /><br />
- <small>';_e('(at most 15)'); echo '</small>
- </p>
- <p>
- <input type="checkbox" class="checkbox" id="';echo $this->get_field_id('twitter_link'); echo '" name="';echo $this->get_field_name('twitter_link'); echo '"';checked($link); echo ' />
- <label for="';echo $this->get_field_id('twitter_link'); echo '">';_e('Show link to Twitter',$ts_domain); echo '</label>
- </p>
- <p>
- <label for="';echo $this->get_field_id('twitter_label'); echo '">';_e('Link label',$ts_domain); echo ':
- <input class="widefat" id="';echo $this->get_field_id('twitter_label'); echo '" name="';echo $this->get_field_name('twitter_label'); echo '" type="text" value="';echo attribute_escape($label); echo '" />
- </label>
- </p>
- ';
- }
- }
- register_widget('TS_Twitter');
- class TS_Flickr extends WP_Widget {
- function TS_Flickr() {
- global $ts_theme,$ts_short,$ts_version,$ts_domain,$options;
- $widget_ops = array('classname'=>'widget_ts_flickr','description'=>__('Display flickr badge in',$ts_domain).' '.$ts_theme );
- $this->WP_Widget('ts_flickr',$ts_domain.' '.__('Flickr',$ts_domain),$widget_ops);
- }
- function widget($args,$instance) {
- global $ts_theme,$ts_short,$ts_version,$ts_domain,$options;
- extract( $args );
- $title = empty($instance['title']) ?__('<span style="color:#3993ff">Flick<span style="color:#ff1c92">r</span></span> Fotos',$ts_domain) : apply_filters('widget_title',$instance['title']);
- $user = empty($instance['user']) ?ts_get_option('ts_flickr') : $instance['user'];
- if ( !$nr = (int) $instance['flickr_nr'] )
- $nr = 6;
- else if ( $nr <1 )
- $nr = 3;
- else if ( $nr >15 )
- $nr = 15; if($big) : echo '<div class="widget_ts_flickr wide clearfix">';else : echo $before_widget;endif; echo $before_title .$title .$after_title; echo '
- <div id="flickr_badge_wrapper" class="clearfix"></div>
- <script type="text/javascript">
- jQuery(document).ready(function(){
- jQuery(\'#flickr_badge_wrapper\').jflickrfeed({
- limit: ';echo $nr; echo ',
- qstrings: {
- id: \'';echo $user; echo '\'
- },
- itemTemplate:
- \'<div class="flickr_badge_image">\' +
- \'<a href="{{link}}" title="{{title}}" rel="prettyPhoto">\' +
- \'<img src="{{image_s}}" alt="{{title}}" />\' +
- \'</a>\' +
- \'</div>\'
- });
- });
- </script>
- ';echo $after_widget;
- }
- function update($new_instance,$old_instance) {
- $instance['title'] = strip_tags($new_instance['title']);
- $instance['user'] = strip_tags($new_instance['user']);
- $instance['flickr_nr'] = (int) $new_instance['flickr_nr'];
- return $new_instance;
- }
- function form($instance) {
- global $ts_theme,$ts_short,$ts_version,$ts_domain,$options;
- $instance = wp_parse_args( (array) $instance,array( 'title'=>'','user'=>'','flickr_nr'=>'') );
- $title = strip_tags($instance['title']);
- $user = empty($instance['user']) ?ts_get_option('ts_flickr') : $instance['user'];
- if (!$nr = (int) $instance['flickr_nr']) $nr = 6; echo '
- <p>
- <label for="';echo $this->get_field_id('title'); echo '">';_e('Title'); echo ':
- <input class="widefat" id="';echo $this->get_field_id('title'); echo '" name="';echo $this->get_field_name('title'); echo '" type="text" value="';echo attribute_escape($title); echo '" />
- </label>
- </p>
- <p>
- <label for="';echo $this->get_field_id('user'); echo '">';_e('User'); echo ':
- <input class="widefat" id="';echo $this->get_field_id('user'); echo '" name="';echo $this->get_field_name('user'); echo '" type="text" value="';echo attribute_escape($user); echo '" />
- </label>
- </p>
- <p>
- <label for="';echo $this->get_field_id('flickr_nr'); echo '">';_e('Number of fotos to show',$ts_domain); echo ':</label>
- <input id="';echo $this->get_field_id('flickr_nr'); echo '" name="';echo $this->get_field_name('flickr_nr'); echo '" type="text" value="';echo $nr; echo '" size="3" /><br />
- <small>';_e('(at most 15)'); echo '</small>
- </p>
- ';
- }
- }
- register_widget('TS_Flickr');
- class TS_Comments extends WP_Widget {
- function TS_Comments() {
- global $ts_theme,$ts_short,$ts_version,$ts_domain,$options;
- $widget_ops = array('classname'=>'widget_ts_comments','description'=>__('Display recent comments in',$ts_domain).' '.$ts_theme );
- $this->WP_Widget('ts_comments',$ts_theme.' '.__('Comments',$ts_domain),$widget_ops);
- }
- function widget($args,$instance) {
- global $ts_theme,$ts_short,$ts_version,$ts_domain,$options;
- extract( $args );
- $title = empty($instance['title']) ?__('Recent Comments',$ts_domain) : apply_filters('widget_title',$instance['title']);
- if ( !$nr = (int) $instance['comments_nr'] )
- $nr = 5;
- else if ( $nr <1 )
- $nr = 1;
- else if ( $nr >15 )
- $nr = 15;
- if ( !$exc = (int) $instance['comments_exc'] ) $exc = 75; echo $before_widget; echo $before_title .$title .$after_title; ts_recent_comments($nr,$exc); echo $after_widget;
- }
- function update($new_instance,$old_instance) {
- $instance['title'] = strip_tags($new_instance['title']);
- $instance['comments_nr'] = (int) $new_instance['comments_nr'];
- $instance['comments_exc'] = (int) $new_instance['comments_exc'];
- $instance['boxed'] = $new_instance['boxed'] ?1 : 0;
- return $new_instance;
- }
- function form($instance) {
- global $ts_theme,$ts_short,$ts_version,$ts_domain,$options;
- $instance = wp_parse_args( (array) $instance,array( 'title'=>'','comments_nr'=>'') );
- $title = strip_tags($instance['title']);
- if (!$nr = (int) $instance['comments_nr']) $nr = 5;
- if (!$exc = (int) $instance['comments_exc']) $exc = 75; echo '
- <p>
- <label for="';echo $this->get_field_id('title'); echo '">';_e('Title'); echo ':
- <input class="widefat" id="';echo $this->get_field_id('title'); echo '" name="';echo $this->get_field_name('title'); echo '" type="text" value="';echo attribute_escape($title); echo '" />
- </label>
- </p>
- <p>
- <label for="';echo $this->get_field_id('comments_nr'); echo '">';_e('Number of comments',$ts_domain); echo ':</label>
- <input id="';echo $this->get_field_id('comments_nr'); echo '" name="';echo $this->get_field_name('comments_nr'); echo '" type="text" value="';echo $nr; echo '" size="3" /><br />
- <small>';_e('(at most 15)'); echo '</small>
- </p>
- <p>
- <label for="';echo $this->get_field_id('comments_exc'); echo '">';_e('Length of comment excerpt',$ts_domain); echo ':</label>
- <input id="';echo $this->get_field_id('comments_exc'); echo '" name="';echo $this->get_field_name('comments_exc'); echo '" type="text" value="';echo $exc; echo '" size="3" />
- </p>
- ';
- }
- }
- function ts_recent_comments($rc_count=5,$rc_length=75,$rc_pre='<ul class="list1">',$rc_post='</ul>') {
- global $wpdb,$ts_theme,$ts_short,$ts_version,$ts_domain,$options;
- $sql = "SELECT DISTINCT ID,
- post_title, post_password, comment_ID, comment_post_ID, comment_author, comment_date_gmt, comment_approved, comment_type,
- SUBSTRING(comment_content,1,$rc_length) AS com_excerpt
- FROM $wpdb->comments
- LEFT OUTER JOIN $wpdb->posts ON ($wpdb->comments.comment_post_ID = $wpdb->posts.ID)
- WHERE comment_approved = '1' AND comment_type = '' AND post_password = ''
- ORDER BY comment_date_gmt DESC
- LIMIT $rc_count";
- $comments = $wpdb->get_results($sql);
- $output = $rc_pre;
- foreach ($comments as $comment) {
- $com_length = strlen($comment->com_excerpt);
- if ($com_length <$rc_length) : $rc_dots = "";else : $rc_dots = "…";endif;
- $output .= "\n\t<li class=\"recent-comment\">".$comment->comment_author ." ".__('on',$ts_domain)." <a href=\"".get_permalink($comment->ID) ."#comment-".$comment->comment_ID ."\" title=\"".$comment->post_title ."\">".$comment->post_title ."</a>:<br />".strip_tags($comment->com_excerpt) .$rc_dots ."</li>";
- }
- $output .= $rc_post;
- echo $output;
- }
- register_widget('TS_Comments');
- class TS_About extends WP_Widget {
- function TS_About() {
- global $ts_theme,$ts_short,$ts_version,$ts_domain,$options;
- $widget_ops = array('classname'=>'widget_ts_about','description'=>__('Display about section in',$ts_domain).' '.$ts_theme );
- $this->WP_Widget('ts_about',$ts_theme.' '.__('About',$ts_domain),$widget_ops);
- }
- function widget($args,$instance) {
- global $ts_theme,$ts_short,$ts_version,$ts_domain,$options;
- extract( $args );
- $title = empty($instance['title']) ?__('About Us',$ts_domain) : $instance['title'];
- $avatar = $instance['about_avatar'] ?'1': '0';
- $text = empty($instance['about_text']) ?__('Your text about you.',$ts_domain) : $instance['about_text'];
- $link = (int) $instance['about_link'];
- $label = empty($instance['about_label']) ?__('More',$ts_domain) : $instance['about_label']; if($big) : echo '<div class="widget_ts_about wide clearfix">';else : echo $before_widget;endif; echo $before_title .$title .$after_title; if($avatar) :echo get_avatar(get_bloginfo('admin_email'),'80'); endif; echo '
- <p>';echo nl2br($text); echo '</p>
- ';if($link) :echo '<p><a href="';echo get_permalink($link); echo '" class="btn"><span>';echo $label; echo '</span></a></p>';endif; echo $after_widget;
- }
- function update($new_instance,$old_instance) {
- $instance['title'] = empty($new_instance['title']) ?__('About Us',$ts_domain) : $new_instance['title'];
- $instance['about_avatar'] = $new_instance['about_avatar'] ?1 : 0;
- $instance['about_text'] = strip_tags($new_instance['about_text']);
- $instance['about_link'] = (int) $new_instance['about_link'];
- $instance['about_label'] = empty($new_instance['about_label']) ?__('More',$ts_domain) : $new_instance['about_label'];
- return $new_instance;
- }
- function form($instance) {
- $instance = wp_parse_args( (array) $instance,array( 'title'=>'','about_avatar'=>'','about_text'=>'','about_link'=>'','about_label'=>'','about_big'=>'') );
- $title = empty($instance['title']) ?__('About Us',$ts_domain) : $instance['title'];
- $avatar = $instance['about_avatar'] ?'1': '0';
- $text = empty($instance['about_text']) ?__('Your text about you.',$ts_domain) : $instance['about_text'];
- $link = $instance['about_link'];
- $label = empty($instance['about_label']) ?__('More',$ts_domain) : $instance['about_label']; echo '
- <p>
- <label for="';echo $this->get_field_id('title'); echo '">';_e('Title'); echo ':
- <input class="widefat" id="';echo $this->get_field_id('title'); echo '" name="';echo $this->get_field_name('title'); echo '" type="text" value="';echo attribute_escape($title); echo '" />
- </label>
- </p>
- <p>
- <input type="checkbox" class="checkbox" id="';echo $this->get_field_id('about_avatar'); echo '" name="';echo $this->get_field_name('about_avatar'); echo '"';checked( $avatar ); echo ' />
- <label for="';echo $this->get_field_id('about_avatar'); echo '">';_e('Show admin\'s avatar',$ts_domain); echo '</label>
- </p>
- <p>
- <label for="';echo $this->get_field_id('about_text'); echo '">';_e('Text',$ts_domain); echo ':
- <textarea class="widefat" rows="5" cols="20" id="';echo $this->get_field_id('about_text'); echo '" name="';echo $this->get_field_name('about_text'); echo '">';echo attribute_escape($text); echo '</textarea>
- </label>
- </p>
- <p>
- <label for="';echo $this->get_field_id('about_link'); echo '">';_e('Post/page ID for link',$ts_domain); echo ':</label>
- <input id="';echo $this->get_field_id('about_link'); echo '" name="';echo $this->get_field_name('about_link'); echo '" type="text" value="';echo $link; echo '" size="3" />
- </p>
- <p>
- <label for="';echo $this->get_field_id('about_label'); echo '">';_e('Link label',$ts_domain); echo ':
- <input class="widefat" id="';echo $this->get_field_id('about_label'); echo '" name="';echo $this->get_field_name('about_label'); echo '" type="text" value="';echo attribute_escape($label); echo '" />
- </label>
- </p>
- ';
- }
- }
- register_widget('TS_About');
- function unregister_default_wp_widgets() {
- unregister_widget('WP_Widget_Search');
- }
- add_action('widgets_init','unregister_default_wp_widgets',1);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement