web/wp-content/themes/thematic/library/extensions/widgets.php
changeset 1 0d28b7c10758
equal deleted inserted replaced
0:0d9a58d2c515 1:0d28b7c10758
       
     1 <?php
       
     2 
       
     3 // Check for static widgets in widget-ready areas
       
     4 
       
     5 function is_sidebar_active( $index ){
       
     6   global $wp_registered_sidebars;
       
     7 
       
     8   $widgetcolums = wp_get_sidebars_widgets();
       
     9 		 
       
    10   if ($widgetcolums[$index]) return true;
       
    11   
       
    12 	return false;
       
    13 }
       
    14 
       
    15 // CSS markup before the widget
       
    16 function thematic_before_widget() {
       
    17 	$content = '<li id="%1$s" class="widgetcontainer %2$s">';
       
    18 	return apply_filters('thematic_before_widget', $content);
       
    19 }
       
    20 
       
    21 // CSS markup after the widget
       
    22 function thematic_after_widget() {
       
    23 	$content = '</li>';
       
    24 	return apply_filters('thematic_after_widget', $content);
       
    25 }
       
    26 
       
    27 // CSS markup before the widget title
       
    28 function thematic_before_title() {
       
    29 	$content = "<h3 class=\"widgettitle\">";
       
    30 	return apply_filters('thematic_before_title', $content);
       
    31 }
       
    32 
       
    33 // CSS markup after the widget title
       
    34 function thematic_after_title() {
       
    35 	$content = "</h3>\n";
       
    36 	return apply_filters('thematic_after_title', $content);
       
    37 }
       
    38 
       
    39 // Widget: Thematic Search
       
    40 function widget_thematic_search($args) {
       
    41 	extract($args);
       
    42 	if ( empty($title) )
       
    43 		$title = __('Search', 'thematic');
       
    44 ?>
       
    45 			<?php echo $before_widget ?>
       
    46 				<?php echo thematic_before_title() ?><label for="s"><?php echo $title ?></label><?php echo thematic_after_title();
       
    47 				get_search_form();
       
    48 			echo $after_widget;
       
    49 }
       
    50 
       
    51 // Widget: Thematic Meta
       
    52 function widget_thematic_meta($args) {
       
    53 	extract($args);
       
    54 	if ( empty($title) )
       
    55 		$title = __('Meta', 'thematic');
       
    56 ?>
       
    57 			<?php echo $before_widget ?>
       
    58 				<?php echo thematic_before_title() . $title . thematic_after_title(); ?>
       
    59 				<ul>
       
    60 					<?php wp_register() ?>
       
    61 					<li><?php wp_loginout() ?></li>
       
    62 					<?php wp_meta() ?>
       
    63 				</ul>
       
    64 			<?php echo $after_widget; ?>
       
    65 <?php
       
    66 }
       
    67 
       
    68 // Widget: Thematic RSS links
       
    69 function widget_thematic_rsslinks($args) {
       
    70 	extract($args);
       
    71 	$options = get_option('widget_thematic_rsslinks');
       
    72 	$title = empty($options['title']) ? __('RSS Links', 'thematic') : $options['title'];
       
    73 ?>
       
    74 		<?php echo $before_widget ?>
       
    75 			<?php echo thematic_before_title() . $title . thematic_after_title(); ?>
       
    76 			<ul>
       
    77 				<li><a href="<?php bloginfo('rss2_url') ?>" title="<?php echo wp_specialchars(get_bloginfo('name'), 1) ?> <?php _e('Posts RSS feed', 'thematic'); ?>" rel="alternate nofollow" type="application/rss+xml"><?php _e('All posts', 'thematic') ?></a></li>
       
    78 				<li><a href="<?php bloginfo('comments_rss2_url') ?>" title="<?php echo wp_specialchars(get_bloginfo('name'), 1) ?> <?php _e('Comments RSS feed', 'thematic'); ?>" rel="alternate nofollow" type="application/rss+xml"><?php _e('All comments', 'thematic') ?></a></li>
       
    79 			</ul>
       
    80 		<?php echo $after_widget ?>
       
    81 <?php
       
    82 }
       
    83 
       
    84 // Widget: RSS links; element controls for customizing text within Widget plugin
       
    85 function widget_thematic_rsslinks_control() {
       
    86 	$options = $newoptions = get_option('widget_thematic_rsslinks');
       
    87 	if ( $_POST["rsslinks-submit"] ) {
       
    88 		$newoptions['title'] = strip_tags(stripslashes($_POST["rsslinks-title"]));
       
    89 	}
       
    90 	if ( $options != $newoptions ) {
       
    91 		$options = $newoptions;
       
    92 		update_option('widget_thematic_rsslinks', $options);
       
    93 	}
       
    94 	$title = htmlspecialchars($options['title'], ENT_QUOTES);
       
    95 ?>
       
    96 			<p><label for="rsslinks-title"><?php _e('Title:'); ?> <input style="width: 250px;" id="rsslinks-title" name="rsslinks-title" type="text" value="<?php echo $title; ?>" /></label></p>
       
    97 			<input type="hidden" id="rsslinks-submit" name="rsslinks-submit" value="1" />
       
    98 <?php
       
    99 }
       
   100 
       
   101 ?>