Things to do after a series of upgrade in wordpress


Warning: WP_Syntax::substituteToken(): Argument #1 ($match) must be passed by reference, value given in /home2/namranco/public_html/wp-content/plugins/wp-syntax/wp-syntax.php on line 383

Well.. just recently upgraded the whole wordpress from 2.8 to 2.8.3 ..
Hmm.. the changelog doesn’t tell much..
except some part of fixing for dynamic themes control…
( which is not applied to me… as being used to stay with this static custom theme ..)

However.. there are some other thing in plugin that might also need upgrading..
such as wp-syntax , wp-useronline..
this time.. in cPanel provided by the DataKL.com .. just worked fine..
via the Admin Dashboard of wordpress interface..
can just click upgrade automatically..
and if everything goes fine.. it will do all the necessary thing accordingly..
except some part.. due to customization or hard-coding thing might have to re-do again..

Hmm..
one of the thing that I really want to do after upgrading the wordpress plugin is..
to minify all the java script file all over again.. it reduce the ‘time to wait’ drastically ..

and also this type of message ..

Always remember the birthday of the girl..
and also ALL the anniversary  date that you had together ..

else you would started up.. the WW III

this one is particularly done with the customization of wp-syntax file with the following content in wp-sytax.php

function wp_syntax_highlight($match)
{
    global $wp_syntax_matches;

    $i = intval($match[1]);
    $match = $wp_syntax_matches[$i];

    $language = strtolower(trim($match[1]));
    $line = trim($match[2]);
    $escaped = trim($match[3]);
    $header = trim($match[4]);
    $code = wp_syntax_code_trim($match[5]);       /* added by .namran 9 august 2009 */
    /* $code = wp_syntax_code_trim($match[4]); */ /* original changed by .namran 9 august 2009 */

    if ($escaped == "true") $code = htmlspecialchars_decode($code);

    $geshi = new GeSHi($code, $language);
    $geshi->enable_keyword_links(false);
    do_action_ref_array('wp_syntax_init_geshi', array(&$geshi));

    $output = "\n
"; if($header) { $output .= "
" . $header . "
"; }

[ad#postad]
and ..

/* added by .namran for the header 9 august 2009 */
function wp_syntax_before_filter($content)
{
    return preg_replace_callback(
        "/\s*(.*)<\/pre>\s*/siU",
        "wp_syntax_substitute",
        $content
    );
}

and somemore is .. to edit the css file to reflect something like this.

/* -- Code Highlighting --*/
.wp_syntax { 
  color: #100;
  background-color: #f9f9f9;
  border: 1px solid silver;
  margin: 0 0 1.5em 0;
  overflow: auto;
}
 
/* IE FIX */
.wp_syntax { 
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: expression(this.scrollWidth > this.offsetWidth ? 15 : 0);
  _width:540px;
}
 
.wp_syntax table {
  border-collapse: collapse;
}
 
.wp_syntax .wp_syn_hdr {
	background-color:#def;
	color:#666;
	text-align:center;
	border-bottom:1px dotted silver;
}
 
.wp_syntax div, .wp_syntax td { 
  vertical-align: top;
  padding: 2px 4px;
}
 
.wp_syntax .line_numbers {
  text-align: right;
  background-color: #def;
  color: gray;
  overflow: visible;
}
 
/* potential overrides for other styles */
.wp_syntax pre {
  margin: 0;
  width: auto;
  float: none;
  clear: none;
  overflow: visible;
}
 
.right-me {
	text-align:right;
}

..that’s all for this one..
And now your wp-syntax plugin would then able to show the header with just ..

 

ok.. now for the Javascipt / css minify part...

Downloaded the Smart Optimizer from http://farhadi.ir/

then..extract the content.. put all the php script under a folder "jsmart"

changed the permission for jsmart/cache to be 777 ..
and all the php file as 755 ..

take a peek at the config.php in there..

mine just look something like this..

<?php
/*
 * SmartOptimizer Configuration File
 */
 
 
//base dir (a relative path to the base directory)
$settings['baseDir'] = '/home/namran/src/blog_namran_net/docroot/';
 
//Encoding of your js and css files. (utf-8 or iso-8859-1)
$settings['charSet'] = 'utf-8'; 
 
//Show error messages if any error occurs (true or false)
$settings['debug'] = false;
 
//use this to set gzip compression On or Off
$settings['gzip'] = true;

edited the jsmart/index.php to become as such..

if (!$settings['clientCache'] || !$settings['clientCacheCheck'] || !isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) || $_SERVER['HTTP_IF_MODIFIED_SINCE'] != $mtimestr) {
  if ($settings['clientCache'] && $settings['clientCacheCheck']) {
    /* changed by .namran for the far ahead expiry on js/css file */
    //header("Last-Modified: " . $mtimestr);
    //header("Cache-Control: must-revalidate");
       header("Expires: " . gmdate("D, d M Y H:i:s", $mtime + 604800) . " GMT");
       header("Cache-Control: max-age=604800, public, must-revalidate", true);
  } elseif ($settings['clientCache']) {
    headerNeverExpire();
  } else headerNoCache();

edited the .htaccess to become as such..

# BEGIN JS optimize

  RewriteEngine on
  RewriteRule ^(.*\.(js|css))$ jsmart/index.php?$1

# END JS optimize

and that's it.. all the javascript and css file should now has been minified and also with far ahead expiry..
cacheable by user..
The by using !YSlow Firebug plugin can check if the header hack
really working..

p/s : i will be out-of-KL for a week.. starting tomorrow morning..
dunno if the internet access is available on-the-go..

else.. expect no update for the next 1week.. ehhehehe 😎

References :
1. http://pravin.insanitybegins.com/
2. http://www.samaxes.com

Related Post

Leave a Reply

Your email address will not be published. Required fields are marked *