Revision: 39358
Updated Code
at January 26, 2011 20:36 by Affix
Updated Code
<?php /* Plugin Name: Stable Linux Kernel Version Widget Plugin URI: http://affix.me/ Description: Grab the latest linux kernel version from kernel.org in a very hacky way Author: Keiran Smith Version: 1.0.0 Author URI: http://affix.me/ */ #### # Function to Split a String between strings #### function split_tag($haystack,$start,$end) { if (strpos($haystack,$start) === false || strpos($haystack,$end) === false) { return false; } else { $start_position = strpos($haystack,$start)+strlen($start); $end_position = strpos($haystack,$end); return substr($haystack,$start_position,$end_position-$start_position); } } #### # Function to display our Widget #### function widget_getKernelVersion() { $page = file_get_contents("http://kernel.org"); $version = split_tag($page, "http://www.kernel.org/pub/linux/kernel/v2.6/linux-", ".tar.bz2"); echo "<h2 class=\"widgettitle\">Current Stable Kernel</h2>"; echo "<div align=\"center\"><h2><a href=\"http://www.kernel.org/pub/linux/kernel/v2.6/linux-$version.tar.bz2\">$version</a></h2></div>"; } #### # Function to initialize our widget #### function kernelWidget_init() { register_sidebar_widget(__('Kernel Version'), 'widget_getKernelVersion'); } add_action("plugins_loaded", "kernelWidget_init"); ?>
Revision: 39357
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at January 16, 2011 20:55 by Affix
Initial Code
<?php /* Plugin Name: Stable Linux Kernel Version Widget Plugin URI: http://affix.me/ Description: Grab the latest linux kernel version from kernel.org in a very hacky way Author: Keiran Smith Version: 1.0.0 Author URI: http://affix.me/ */ #### # Function to Split a String between strings #### function split_tag($haystack,$start,$end) { if (strpos($haystack,$start) === false || strpos($haystack,$end) === false) { return false; } else { $start_position = strpos($haystack,$start)+strlen($start); $end_position = strpos($haystack,$end); return substr($haystack,$start_position,$end_position-$start_position); } } #### # Function to display our Widget #### function widget_getKernelVersion() { $page = file_get_contents("http://kernel.org"); $version = split_tag($page, "http://www.kernel.org/pub/linux/kernel/v2.6/linux-", ".tar.bz2"); echo "<h4 class=\"sidebar-title\">Current Stable Kernel</h4>"; echo "<div align=\"center\"><h2><a href=\"http://www.kernel.org/pub/linux/kernel/v2.6/linux-$version.tar.bz2\">$version</a></h2></div>"; } #### # Function to initialize our widget #### function kernelWidget_init() { register_sidebar_widget(__('Kernel Version'), 'widget_getKernelVersion'); } add_action("plugins_loaded", "kernelWidget_init"); ?>
Initial URL
affix.me
Initial Description
Initial Title
Wordpress Linux Kernel Version
Initial Tags
wordpress
Initial Language
PHP