1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
<?php

// Flickr Widget
function flickrWidget()
{
	$settings = get_option("widget_flickrwidget");

	$id = $settings['id'];
	$number = $settings['number'];

?>
<div id="flickr">
    <h3>Latest photos on flickr</h3>
	<script type="text/javascript" src="http://www.flickr.com/badge_code_v2.gne?count=<?php echo $number; ?>&amp;display=latest&amp;size=s&amp;layout=x&amp;source=user&amp;user=<?php echo $id; ?>"></script>        
</div>
<div class="clear"></div>

<?php
}

function flickrWidgetAdmin() {

	$settings = get_option("widget_flickrwidget");

	// check if anything's been sent
	if (isset($_POST['update_flickr'])) {
		$settings['id'] = strip_tags(stripslashes($_POST['flickr_id']));
		$settings['number'] = strip_tags(stripslashes($_POST['flickr_number']));

		update_option("widget_flickrwidget",$settings);
	}

	echo '<p>
			<label for="flickr_id">Flickr ID (<a href="http://www.idgettr.com">idGettr</a>):
			<input id="flickr_id" name="flickr_id" type="text" class="widefat" value="'.$settings['id'].'" /></label></p>';
	echo '<p>
			<label for="flickr_number">Number of photos:
			<input id="flickr_number" name="flickr_number" type="text" class="widefat" value="'.$settings['number'].'" /></label></p>';
	echo '<input type="hidden" id="update_flickr" name="update_flickr" value="1" />';

}

register_sidebar_widget('Flickr', 'flickrWidget');
register_widget_control('Flickr', 'flickrWidgetAdmin', 400, 200);


// Ad widget
function adsWidget()
{	
?>
<div id="ads">
	<?php if(get_option("ct_custom_ad1_url", "ct_custom_ad1_imgurl", "ct_custom_ad1_alt", $single = true) !="") { ?>
        <a href="<?php echo get_option("ct_custom_ad1_url", $single = true); ?>"><img class="smad" src="<?php echo get_option("ct_custom_ad1_imgurl", $single = true); ?>" height="125" width="125" alt="<?php echo get_option("ct_custom_ad1_alt", $single = true); ?>" /></a>
    <?php } else { ?>
        <a href="#"><img class="smad" src="<?php bloginfo('url'); ?>/wp-content/themes/paramount/images/125x125_ad.jpg" height="125" width="125" alt="125x125 ad" /></a>
    <?php } ?>
    <?php if(get_option("ct_custom_ad2_url", "ct_custom_ad2_imgurl", "ct_custom_ad2_alt", $single = true) !="") { ?>
        <a href="<?php echo get_option("ct_custom_ad2_url", $single = true); ?>"><img class="smad last" src="<?php echo get_option("ct_custom_ad2_imgurl", $single = true); ?>" height="125" width="125" alt="<?php echo get_option("ct_custom_ad2_alt", $single = true); ?>" /></a>
    <?php } else { ?>
        <a href="#"><img class="smad last" src="<?php bloginfo('url'); ?>/wp-content/themes/paramount/images/125x125_ad.jpg" height="125" width="125" alt="125x125 ad" /></a>
    <?php } ?>
    <?php if(get_option("ct_custom_ad3_url", "ct_custom_ad3_imgurl", "ct_custom_ad3_alt", $single = true) !="") { ?>
        <a href="<?php echo get_option("ct_custom_ad3_url", $single = true); ?>"><img class="smad" src="<?php echo get_option("ct_custom_ad3_imgurl", $single = true); ?>" height="125" width="125" alt="<?php echo get_option("ct_custom_ad3_alt", $single = true); ?>" /></a>
    <?php } else { ?>
        <a href="#"><img class="smad" src="<?php bloginfo('url'); ?>/wp-content/themes/paramount/images/125x125_ad.jpg" height="125" width="125" alt="125x125 ad" /></a>
    <?php } ?>
    <?php if(get_option("ct_custom_ad4_url", "ct_custom_ad4_imgurl", "ct_custom_ad4_alt", $single = true) !="") { ?>
        <a href="<?php echo get_option("ct_custom_ad4_url", $single = true); ?>"><img class="smad last" src="<?php echo get_option("ct_custom_ad4_imgurl", $single = true); ?>" height="125" width="125" alt="<?php echo get_option("ct_custom_ad4_alt", $single = true); ?>" /></a>
    <?php } else { ?>
        <a href="#"><img class="smad last" src="<?php bloginfo('url'); ?>/wp-content/themes/paramount/images/125x125_ad.jpg" height="125" width="125" alt="125x125 ad" /></a>
    <?php } ?>

        <div class="clear"></div>

    <?php if(get_option("ct_custom_advertise_url", $single = true) !="") { ?>
    	<p id="advertise"><a href="<?php echo get_post_meta($post->ID, "ct_custom_advertise_url", $single = true); ?>">Advertise Here</a></p>
    <?php } else { ?>
    	<p id="advertise"><a href="#">Advertise Here</a></p>
    <?php } ?>

</div>
<?php
}
register_sidebar_widget('Ads', 'adsWidget');

// Testimonial widget
function testimonialWidget()
{	
?>
<div id="testimonial">
	<?php if(get_option("ct_custom_testimonial_quote", "ct_custom_testimonial_person", "ct_custom_testimonial_company", $single = true) !="") { ?>
        <p id="quote">&ldquo; <?php echo get_option("ct_custom_testimonial_quote", $single = true); ?> &rdquo;</p>
        <p id="name"><strong><?php echo get_option("ct_custom_testimonial_person", $single = true); ?></strong>, <?php echo get_option("ct_custom_testimonial_company", $single = true); ?></p>
    <?php } else { ?>
        <p id="quote">&ldquo;Suspendisse placerat massa vitae lorem. Nullam tincidunt auctor neque. Phasellus ac metus in arcu congue aliquet. Fusce sed sapien. Duis aliquam, orci ut dapibus vehicula, nulla leo commodo tellus, non scelerisque mauris velit scelerisque nisi. Nunc fermentum felis non nunc. Nullam viverra. Mauris tristique, orci et aliquet imperdiet, nunc neque placerat mauris, gravida pretium mauris enim vitae ligula.&rdquo;</p>
        <p id="name"><strong>Edward Williams</strong>, Acme Widgets Co.</p> 
    <?php } ?> 
</div>
<?php
}
register_sidebar_widget('Testimonial', 'testimonialWidget');

// A Little About Me widget
function aboutWidget()
{	
?>
	<?php if(get_option("ct_custom_about_title", $single = true) !="") { ?>
        <h3><?php echo get_option("ct_custom_about_title", $single = true); ?></h3>
    <?php } else { ?>
        <h3>A Little About Me</h3>
    <?php } ?>

    <?php if(get_option("ct_custom_aboutimg_url", "ct_custom_aboutimg_alt", $single = true) !="") { ?>
        <img class="left" src="<?php echo get_option("ct_custom_aboutimg_url", $single = true); ?>" alt="<?php echo get_option("ct_custom_aboutimg_alt", $single = true); ?>" />
    <?php } else { ?>
        <img class="left" src="<?php bloginfo('url'); ?>/wp-content/themes/paramount/images/headshot.jpg" alt="Headshot" />
    <?php } ?>

    <?php if(get_option("ct_custom_about_text", "ct_custom_about_link",  $single = true) !="") { ?>
            <p><?php echo stripslashes(get_option("ct_custom_about_text", $single = true)); ?></p>
            <p class="readmore"><a href="<?php echo get_option("ct_custom_about_link", $single = true); ?>">Read More</a></p>
    <?php } else { ?>
        <p>Aliquam erat volutpat. Donec ac sapien et lectus venenatis suscipit. Proin commodo, massa et viverra molestie, augue sapien tincidunt ante, in laoreet libero ipsum id leo. Maecenas euismod viverra mi. Nulla scelerisque ultrices enim. Sed id neque in ante pellentesque volutpat.</p>
        <p class="readmore"><a href="<?php echo get_option("ct_custom_about_link", $single = true); ?>">Read More</a></p>
    <?php } ?> 
<?php
}
register_sidebar_widget('A Little About Me', 'aboutWidget');

?>