/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?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) { return false; } else { } } #### # Function to display our Widget #### function widget_getKernelVersion() { $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"); ?>
URL: affix.me