Automatic Update.
Author: Jonathan Foucher
Author URI: http://www.jfoucher.marinetechs.com
This plugin supports Automatic Update : http://wiki.wordpress.org/AutomaticUpdate
Update: http://www.jfoucher.marinetechs.com/plugin-update.php?p=53
Copyright (c) 2004
Released under the GPL license
http://www.gnu.org/licenses/gpl.txt
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/************************************
** TO TAKE ADVANTAGE OF UPDATE **
** DETECTION, PLEASE CONSIDER **
** MAKING THE FOLLOWING ADDITION **
** TO YOUR WORDPRESS INSTALL **
** **
*************************************
OPEN FOR EDITING : wp-admin/plugins.php
FIND
if ( preg_match("|Version:(.*)|i", $plugin_data, $version) )
$version = $version1?;
else
$version ='';
ADD THE FOLLOWING CODE AFTERWARDS
// BEGIN PLUGIN UPDATE ADD-ON
if ( preg_match("|Update:(.*)|i", $plugin_data, $update) )
{
$update = $update[1];
$update = trim($update);
if ($u = @file("$update")) {
$u = implode('',$u);
$u = trim($u);
$v = trim($version);
if($u != $v){
$updatelink = '';
$updatelink .= 'Update Available: (';
$updatelink .= $u;
$updatelink .= ')';
$description[1] .= '
';
$description[1] .= $updatelink;
}
else
{
$updatelink = '';
}
}
else{
$updatelink = '';
}
}
else
{ $update ='';}
//END PLUGIN UPDATE ADD-ON
*/
if (isset($_REQUEST["newstyle"])){
$style=$_REQUEST["newstyle"];
$url=$_REQUEST["orig_url"];
if(!headers_sent()){
setcookie("StyleSheetChooser",$style);
header("location:".$url);
}
}
function read_comment($style){
//global $styles;
//if (!$style || $style='') $style=$styles[0];
if ($fp=@fopen($style.".css","r")){
while($remote_read = fread($fp, 4096)) {
if (ereg("Comment:([^\n]*)",$remote_read,$regs)){
$line = $regs[1];
}
}
$comment=trim($line);
return $comment;
}else{
return;
}
}
function style_link($import=true) {
global $_COOKIE;
global $styles;
$default_style=$styles[0];
$links='';
if ($_COOKIE["StyleSheetChooser"]!=''){
for ($i=0;$i