Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

- - - - -

GeSHi - Generic Syntax Highlighter

timer syntax

  • Please log in to reply
7 replies to this topic

#1 Guest_Jordan_*

Guest_Jordan_*
  • Guest

Posted 05 October 2007 - 06:29 AM

It has been installed for some time but an announcement has never been made. You have have noticed the new drop-down combo box in the upper right hand corner when posting. This will allow you to highlight your code with the GeSHi Syntax Highligher.

Info:

GeSHi started as an idea to create a generic syntax highlighter for the <acronym>phpBB</acronym> forum system, but has been generalised to this project. GeSHi aims to be a simple but powerful highlighting class, with the following goals:
  • Support for a wide range of popular languages
  • Easy to add a new language for highlighting
  • Highly customisable output formats
GeSHi aims to do this all as quickly as possible. Many customisable features of GeSHi facilitate speed increases, and you can easily find a balance between the amount of highlighting done and the speed in which it is done.

GeSHi supports PHP5 and Windows, and has even been used to highlight code on ASP pages. Numerous blogs, wikis and forums use GeSHi, including Dokuwiki, Mambo, phpBB and WikkaWiki.

Examples:

Option Explicit

Private Sub Form_Load()
CurrentProcess = "Delta Force, V1.5.0.5" 'BHD

CreateButton 0, "option 1", 10, 20, &HFFFFFFFF, &HFF00FF00, &HFFFF0000
CreateButton 1, "option 2", 10, 40, &HFFFFFFFF, &HFF00FF00, &HFFFF0000
CreateButton 2, "option 3", 10, 60, &HFFFFFFFF, &HFF00FF00, &HFFFF0000
CreateButton 3, "option 4", 10, 80, &HFFFFFFFF, &HFF00FF00, &HFFFF0000
End Sub

Private Sub Form_Unload(Cancel As Integer)
ClearAll 'erase all text when your done
End Sub

Private Sub tmrMenu_Timer()
Dim c As Integer

If (FindWindow(vbNullString, CurrentProcess) <> 0) Then 'if the game is running
lblStatus.Caption = "Code injected!. Enjoy!"

If (GetKeyPress(vbKeyNumpad0)) Then
If (showOptions = False) Then
showOptions = True
Else
showOptions = False
ClearAll
End If
End If

UpdateControls

'if not drawing anything exit and dont check for activated options.
If (showOptions = False) Then Exit Sub

'checking for activated options:
For c = 0 To UBound(button)
If (button(c).selected = True) Then
Select Case c
Case 0
'MsgBox "Option 1 Activated!"
Case 1
'MsgBox "Option 2 Activated!"
Case 2
'MsgBox "Option 3 Activated!"
Case 3
'MsgBox "Option 4 Activated!"
End Select
Else
Select Case c
Case 0
'MsgBox "Option 1 Deactivated!"
Case 1
'MsgBox "Option 2 Deactivated!"
Case 2
'MsgBox "Option 3 Deactivated!"
Case 3
'MsgBox "Option 4 Deactivated!"
End Select

End If
Next c
Else 'game not running
lblStatus.Caption = "Waiting for Dfbhd.exe..."
End If
End Sub


function  WriteMemory(offset : Cardinal; value : Integer; size : SmallInt) : Cardinal;
function ReadText(offset : Cardinal) : String;
function ReadMemory(offset : Cardinal; size : SmallInt) : Cardinal;
function WriteByteString(offset : Cardinal; value : String) : Cardinal;
procedure WriteText(offset : Cardinal; text : String);
procedure SendKeyChar(keyCode : Integer);
procedure Hyperlink(windowHandle : HWND; url : String);
procedure ReadWriteMemory(source : Cardinal; destination : Cardinal; size : SmallInt);


package helloworld;

import javax.swing.*;

public class MySecondApp extends JFrame {

public MySecondApp(){
setSize(150,60);
setLocation(20,20);
JLabel myLabel = new JLabel("Hello World!");
add(myLabel);
setVisible(true);
}
public static void main(String[] args) {
new MySecondApp();
}

}


<?php
$count=0;
require("includes/functions_common.php");
$result=$vwardb->query_first("SELECT accessgroupid FROM vwar".$n."_member WHERE memberid = '".$GPC['vwarid']."'");
$accessgroupid=$result["accessgroupid"];

if($send)
{
while(list($key,$val)=each($GPC['access']))
{
$vwardb->query("UPDATE vwar".$n."_accessgroup SET ".$key." = '".$val."' WHERE accessgroupid = '".$accessgroupid."'");
}
?>
<tr bgcolor="#D0D0E0">
<td align="center"><font face="verdana,tahoma,arial" size="2"><b>Done, the rights have been restored! <u>Delete</u> 'checkaccess.php'!</b></font></td>
</tr>
<?php

} else {

?>
<tr bgcolor="#D0D0E0">
<td colSpan="3"><br>
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td vAlign="top"><font face="verdana,tahoma,arial" size="3"><b>»  </b></font></td>
<td><font face="verdana,tahoma,arial" size="2"><b>Restore rights:</b><br>(1 = access enabled / 0 = access denied)</font></td>
</tr>
</table><br>
</td>
</tr>
<?php

$result = $vwardb->query("SELECT * FROM vwar".$n."_accessgroup WHERE accessgroupid='$accessgroupid'");
$row = $vwardb->fetch_array($result);
$numfields = $vwardb->num_fields($result);
for($i=0;$i<$numfields;$i++) {
$settingname = $vwardb->field_name($result,$i);
$$settingname = $row[$settingname];
if($settingname != "accessgroupname" && $settingname != "accessgroupid" && $$settingname != 1)
{
echo "<tr bgcolor=\"#F0C060\">\n";
echo " <td><font face=\"verdana,tahoma,arial\" size=\"2\" width=\"33%\"><b>".$settingname.":</b></font></td>\n";
echo " <td><font face=\"verdana,tahoma,arial\" size=\"2\" width=\"33%\"><b>Current Value:</b> ".$$settingname."</font></td>\n";
echo " <td><font face=\"verdana,tahoma,arial\" size=\"2\" width=\"33%\">Set to 1: <input type=\"checkbox\" name=\"access[$settingname]\" value=\"1\"></font></td>\n";
echo "</tr>";
$count++;
} else {
echo "<tr bgcolor=\"#D0D0E0\">\n";
echo " <td colSpan=\"3\"><font face=\"verdana,tahoma,arial\" size=\"2\"><b>".$settingname.":</b> ".$$settingname."</font></td>\n";
echo "</tr>";
}
}
$vwardb->free_result($result);

if($count > 0)
{
?>
<tr bgcolor="#D0D0E0">
<td align="center" colSpan="3"><input type="submit" name="send" value="Change Settings"></td>
</tr>
<?php
} else {
?>
<tr bgcolor="#D0D0E0">
<td align="center"><font face="verdana,tahoma,arial" size="2"><b>You have full access, no need to change anything!</b></font></td>
</tr>
<?php
}

}
?>


SELECT * FROM FrrstTable ft
INNER JOIN SecondTable st ON st.FirstTable_ID = ft.ID



Special Thanks!

Special thanks goes out to SideWinder who figured out how to modify and add the drop-down combo box to vBulletin.
  • 0

#2 TcM

TcM

    CC Mentor

  • VIP Member
  • PipPipPipPipPipPipPipPip
  • 7563 posts

Posted 07 October 2007 - 08:43 AM

Yes it is cool, I already used it once or twice in the VB forum, its cool.
  • 0

#3 Guest_NeedHelp_*

Guest_NeedHelp_*
  • Guest

Posted 09 October 2007 - 05:13 PM

looks like it messes up code a bit:


$accessgroupid=$result["accessgroupid"];

From the PHP example above.
  • 0

#4 goodyboo

goodyboo

    CC Lurker

  • Just Joined
  • Pip
  • 2 posts

Posted 02 June 2008 - 09:28 AM

Geshi is great that it allows you to format great many kinds of source code including java, php, C#, C++. I have always looked for a source code formatter for java2html, php2html, cpp2html, csharp2html, vb2html and i think geshi answers all my needs. Many thanks to Geshi developers.
  • 0

#5 goodyboo

goodyboo

    CC Lurker

  • Just Joined
  • Pip
  • 2 posts

Posted 02 June 2008 - 09:29 AM

You can see it on action at Syntax Highlighter

It allows you to format your source code and get html version.
  • 0

#6 whoiga

whoiga

    CC Newcomer

  • Just Joined
  • PipPip
  • 15 posts

Posted 01 August 2008 - 10:08 PM

Sorry Jordan, but when posting I've never ever seen this combo box you speak of for easily using GeSHi. Is it only available in certain forum themes? I'm using the GK theme.

I'm very familiar with GeSHi though and happy to see it available on these forums. For now I'll just have to manually use [noparse]

[/noparse].

Edit: Now I see it on the Beyond theme, but it doesn't work (when I click on it, nothing happens). It's still absent from the GK theme as far as I can tell, though.
  • 0

#7 Guest_Jordan_*

Guest_Jordan_*
  • Guest

Posted 02 August 2008 - 05:50 AM

When vBulletin released 3.7.0 they changed their JavaScript which caused problems with the GeSHi quick drop-down menu, thus it was removed. The only way to use it is to type it manually.
  • 0

#8 whoiga

whoiga

    CC Newcomer

  • Just Joined
  • PipPip
  • 15 posts

Posted 02 August 2008 - 12:28 PM

I see. No problem. 8) Thanks for letting me know.
  • 0





Also tagged with one or more of these keywords: timer, syntax

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download