HTML_Crypt
[ class tree: HTML_Crypt ] [ index: HTML_Crypt ] [ all elements ]

Class: HTML_Crypt

Source Location: /HTML_Crypt-1.3.1/HTML/Crypt.php

Class Overview


HTML_Crypt


Author(s):

Version:

  • $Revision: 1.6 $

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 45]
HTML_Crypt

HTML_Crypt provides methods to encrypt text, which can be later be decrypted using JavaScript on the client side

This is very useful to prevent spam robots collecting email addresses from your site, included is a method to add mailto links to the text being generated.

The "encryption" function is basically works like ROT13, with the difference that the $offset setting replaces the 13. It is also limited to ASCII characters between 32 and 127 (included). Other characters will not be encrypted.

a basic example to encrypt an email address $c = new HTML_Crypt('yourname@emailaddress.com', 8); $c->addMailTo(); $c->output();



[ Top ]


Class Variables

$apreg =

[line 100]

a preg expression for an <a href=mailto: ... tag
  • Access: public

Type:   string


[ Top ]

$cryptString =  ''

[line 75]

The text encrypted - without any js
  • See: cyrptText
  • Access: public

Type:   string


[ Top ]

$emailpreg =

[line 108]

a preg expression for an email
  • Access: public

Type:   string


[ Top ]

$offset =

[line 84]

The number to offset the text by
  • Access: public

Type:   int


[ Top ]

$script =  ''

[line 65]

The full javascript to be sent to the browser

Type:   string


[ Top ]

$text =  ''

[line 56]

The unencrypted text

Type:   string


[ Top ]

$useJS =

[line 92]

Whether or not to use JS for encryption or simple html
  • Access: public

Type:   int


[ Top ]



Method Detail

HTML_Crypt (Constructor)   [line 121]

HTML_Crypt HTML_Crypt( [string $text = ''], [int $offset = 3], [boolean $JS = true])

Constructor
  • Access: public

Parameters:

string   $text   —  The text to encrypt
int   $offset   —  The offset used to encrypt/decrypt
boolean   $JS   —  If javascript shall be used on the client side

[ Top ]

addMailTo   [line 154]

void addMailTo( )

Turns the text into a mailto link (make sure the text only contains an email)
  • Access: public

[ Top ]

getOutput   [line 257]

string getOutput( )

Returns the encrypted text.
  • Return: Encrypted text

[ Top ]

getScript   [line 203]

string getScript( )

Returns the script html source including the function to decrypt it.
  • Return: The javascript generated
  • Access: public

[ Top ]

obEnd   [line 276]

void obEnd( )


[ Top ]

obStart   [line 271]

void obStart( )


[ Top ]

output   [line 244]

void output( )

Outputs the full JS to the browser
  • Access: public

[ Top ]

setText   [line 140]

void setText( string $text)

Set name of the current realm
  • Access: public

Parameters:

string   $text   —  The text to be encrypted

[ Top ]


Documentation generated on Mon, 11 Mar 2019 14:48:56 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.