Dec 12th 2007 11:16 pm

Grand Opening, Google Syntax Highlighter Fix

The blog is up and running and with the first post comes some interesting info on setting up syntax highlighting. So, I finally got the google syntax highlighter working with my wordpress install HOORAY.

Google Syntax Highlighter for WordPress
http://wordpress.org/extend/plugins/google-syntax-highlighter/

doing some pretty simple testing i tracked down the footer wasn’t adding it’s code to wordpress. So i looked at how other people had hooked the footer event and then just did that.

Something has changed with wordpress since Peter Ryan last updated his wordpress plugin, so i fixed it. Seems that the footer load event changed or the one he was using was deprecated? I haven’t the slightest idea since today was the first day i’ve seen wordpress code, nor do i really care now that it’s working.
Original Code: google_syntax_highlighter.php

add_action('wp_footer','insert_footer');

Working Code: google_syntax_highlighter.php

add_action('get_footer','insert_footer');


The good stuff has arrived.

Private Function DetermineRenderClientScript() As Boolean
  If Not Me._renderClientScriptValid Then
    Me._renderClientScript = False
    If Me.EnableSortingAndPagingCallbacks AndAlso Me.Page.Request.Browser.SupportsCallback Then
      Dim browser As HttpBrowserCapabilities = Me.Page.Request.Browser
      Dim flag As Boolean = (browser.EcmaScriptVersion.Major > 0)
      Dim flag2 As Boolean = (browser.W3CDomVersion.Major > 0)
      Dim flag3 As Boolean = Not StringUtil.EqualsIgnoreCase(browser.Item("tagwriter"), GetType(Html32TextWriter).FullName)
      Me._renderClientScript = ((flag AndAlso flag2) AndAlso flag3)
    End If
    Me._renderClientScriptValid = True
  End If
  Return Me._renderClientScript
End Function

this is testing the code markup

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Quisque sed felis. Aliquam sit amet felis. Mauris semper, velit semper laoreet dictum, quam diam dictum urna, nec placerat elit nisl in quam. Etiam augue pede, molestie eget, rhoncus at, convallis ut, eros. Aliquam pharetra. Nulla in tellus eget odio sagittis blandit. Maecenas at nisl. Nullam lorem mi, eleifend a, fringilla vel, semper at, ligula. Mauris eu wisi. Ut ante dui, aliquet nec, congue non, accumsan sit amet, lectus. Mauris et mauris. Duis sed massa id mauris pretium venenatis. Suspendisse cursus velit vel ligula. Mauris elit. Donec neque. Phasellus nec sapien quis pede facilisis suscipit. Aenean quis risus sit amet eros volutpat ullamcorper. Ut a mi. Etiam nulla. Mauris interdum.

1 Comment »

One Response to “Grand Opening, Google Syntax Highlighter Fix”

  1. Darko Bunic on 25 Jul 2008 at 7:45 am #

    Yes, Google Syntax Highlighter plugin is very nice. I use it on my site http://www.redips.net to highlight PHP/HTML/CSS code. I also made some plugin improvements to minimize load of unused JavaScript brushes. To load some brushes, just describe them in posts custom fields.
    Thank you!

Trackback URI | Comments RSS

Leave a Reply

| ScrollTo using the ajax control toolkit animation framework »