summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Crute <mcrute@gmail.com>2012-04-19 13:43:47 -0400
committerMike Crute <mcrute@gmail.com>2012-04-19 13:43:47 -0400
commitb6cf43baab010d181601bb6aaae62dbab646203d (patch)
treeb37ac3641a35dafd1fd5a16e3fc13152b31c561b
downloadwordpress_plugins-master.tar.bz2
wordpress_plugins-master.tar.xz
wordpress_plugins-master.zip
Initial importHEADmaster
-rw-r--r--reader_shared.php68
-rw-r--r--weighted_categories.php35
2 files changed, 103 insertions, 0 deletions
diff --git a/reader_shared.php b/reader_shared.php
new file mode 100644
index 0000000..f3be003
--- /dev/null
+++ b/reader_shared.php
@@ -0,0 +1,68 @@
1<?php
2/*
3 Plugin Name: Google Reader Shared
4 Plugin URI: http://mike.crute.org/
5 Description: A sidebar add-in for Google Reader shared items.
6 Version: 1.0
7 Author: Mike Crute
8 Author URI: http://mike.crute.org/
9*/
10
11// Format the plugin page
12if (is_plugin_page()) {
13 if (isset($_POST['update_reader'])) {
14 update_option('GoogleReader_FeedURL', $_POST['url']);
15 update_option('GoogleReader_NumDisplay', $_POST['numdisp']);
16 update_option('GoogleReader_CSSClass', $_POST['cssclass']);
17 echo('<div class="updated"><p>Options changes saved.</p></div>');
18}
19?>
20 <div class="wrap">
21 <h2>Google Reader Shared Items Options</h2>
22
23 <form method="post">
24 <fieldset class="options">
25 <p><strong>Google Reader</strong></p>
26
27 <label for="url">Feed URL:</label>
28 <input name="url" type="text" id="url" value="<?php echo get_option('GoogleReader_FeedURL'); ?>" />
29
30 <label for="numdisp">Number to Display (max is 20):</label>
31 <input name="numdisp" type="text" id="numdisp" value="<?php echo get_option('GoogleReader_NumDisplay'); ?>" />
32
33 <label for="cssclass">CSS Class:</label>
34 <input name="cssclass" type="text" id="cssclass" value="<?php echo get_option('GoogleReader_CSSClass'); ?>" />
35 </fieldset>
36
37 <p><div class="submit"><input type="submit" name="update_reader" value="Save Settings" style="font-weight:bold;" /></div></p>
38 </form>
39 </div>
40<?php
41}
42
43else {
44 function readerShared() {
45 $feedurl = trim(get_option('GoogleReader_FeedURL'));
46 $display = trim(get_option('GoogleReader_NumDisplay'));
47 $class = trim(get_option('GoogleReader_CSSClass'));
48
49 printf('<ul%s>', ($class != '') ? " class=\"$class\"" : '');
50 $feed = simplexml_load_file($feedurl);
51 $loopcount = 0;
52
53 foreach ($feed->entry as $item) {
54 if ($loopcount < $display) {
55 printf('<li><a href="%s" rel="nofollow">%s - %s</a></li>',$item->link[1]['href'],$item->title,$item->source->title);
56 $loopcount++;
57 }
58 }
59 echo('</ul>');
60 }
61}
62
63function readerShared_Menu() {
64 add_options_page('Google Reader Shared Options', 'Google Reader', 9, basename(__FILE__));
65}
66
67add_action('admin_menu', 'readerShared_Menu');
68?> \ No newline at end of file
diff --git a/weighted_categories.php b/weighted_categories.php
new file mode 100644
index 0000000..d391472
--- /dev/null
+++ b/weighted_categories.php
@@ -0,0 +1,35 @@
1<?php
2/*
3Plugin Name: Weighted Categories
4Plugin URI: http://mike.crute.org/blog/
5Description: Template tag to display a weighted list of category links.
6Version: 2.1
7Author: Mike Crute (copied from Matt Kingston)
8Author URI: http://mike.crute.org (original author http://hitormiss.org)
9*/
10function weighted_categories($smallest=10, $largest=40, $unit='pt')
11{
12 // get the categories and build an array from them
13 $cats = get_categories('type=post');
14
15 foreach ($cats as $cat)
16 {
17 $catname = $cat->cat_name;
18 $counts[$catname] = $cat->category_count;
19 $catlinks[$catname] = $cat->category_nicename;
20 }
21
22 // calculate the font sizes but always fall back to a safe value
23 $spread = (max($counts) - min($counts)) <= 0 ? max($counts) - min($counts) : 1;
24 $fontspread = ($largest - $smallest) <= 0 ? $largest - $smallest : 1;
25 $fontstep = $spread / $fontspread;
26
27 // print the links out
28 foreach ($counts as $catname => $count)
29 {
30 $catlink = $catlinks[$catname];
31 $fontsize = ($smallest + ($count/$fontstep)) . $unit;
32 echo("<a href='$catlink' title='$count entries' style='font-size: $fontsize;'>$catname</a>\n");
33 }
34}
35?> \ No newline at end of file