GravityView  1.19.4
The best, easiest way to display Gravity Forms entries on your website.
Public Member Functions | Data Fields | Private Member Functions | Private Attributes
StandalonePHPEnkoder Class Reference

Public Member Functions

 __construct ()
 
 enkode ($content, $text=NULL)
 Enkode. More...
 
 enkodeAllEmails ($text)
 Enkode all emails. More...
 
 enkodeMailto ($email, $text, $subject="", $title="")
 Enkode a mailto: link. More...
 
 enkodeMailtos ($text)
 Enkode mailto: links. More...
 
 enkodePlaintextEmails ($text)
 Enkode plaintext emails. More...
 

Data Fields

 $enkode_class = 'enkoded-mailto'
 
 $enkode_msg = 'email hidden; JavaScript is required'
 
 $max_length = 1024
 
 $max_passes = 20
 

Private Member Functions

 enkBuildJS ($kode, $text=NULL)
 Build JavaScript. More...
 
 enkEmailToLink ($matches)
 Enkode a single mailto: link. More...
 
 enkEncNum ($s)
 Num encoding (adapted) More...
 
 enkEncReverse ($s)
 Encodings. More...
 
 enkEncSwap ($s)
 Swap encoding. More...
 
 enkExtractLinktext ($text)
 Extract link text. More...
 
 enkodePass ($kode, $enc, $dec)
 Encode a single pass. More...
 
 enkPlaintextLink ($matches)
 Enkode a single plaintext link. More...
 

Private Attributes

 $email_regex
 
 $enk_dec_num
 
 $enk_dec_reverse
 
 $enk_dec_swap
 
 $enkoder_uses = 0
 
 $enkodings
 
 $link_text
 
 $mailto_email
 
 $min_length = 269
 
 $ptext_email
 

Detailed Description

Definition at line 61 of file StandalonePHPEnkoder.php.

Constructor & Destructor Documentation

__construct ( )

Definition at line 77 of file StandalonePHPEnkoder.php.

Member Function Documentation

enkBuildJS (   $kode,
  $text = NULL 
)
private

Build JavaScript.

Generates the Javascript recursive evaluator, which is 269 characters of boilerplate code.

Unfortunately, <noscript> can't be used arbitrarily in XHTML. A that we immediately overwrite, serves as an ad hoc <noscript> tag.

Definition at line 254 of file StandalonePHPEnkoder.php.

References $name.

Referenced by enkode().

enkEmailToLink (   $matches)
private

Enkode a single mailto: link.

Definition at line 148 of file StandalonePHPEnkoder.php.

References enkodeMailto().

enkEncNum (   $s)
private

Num encoding (adapted)

Definition at line 299 of file StandalonePHPEnkoder.php.

References $i.

enkEncReverse (   $s)
private

Encodings.

Each encoding should consist of a function and a Javascript string; the function performs some scrambling of a string, and the Javascript unscrambles that string (assuming that it's stored in a variable kode). The listed enkodings are those used in the Hivelogic Enkoder.

THe JS strings are defined as class variables $enk_dec_reverse, $enk_dec_num and $enk_dec_swap. Reverse encoding

Definition at line 292 of file StandalonePHPEnkoder.php.

enkEncSwap (   $s)
private

Swap encoding.

Definition at line 314 of file StandalonePHPEnkoder.php.

References $i.

enkExtractLinktext (   $text)
private

Extract link text.

Definition at line 138 of file StandalonePHPEnkoder.php.

Referenced by enkPlaintextLink().

enkode (   $content,
  $text = NULL 
)

Enkode.

Encodes a string to be view-time written by obfuscated Javascript. The max passes parameter is a tight bound on the number of encodings perormed. The max length paramater is a loose bound on the length of the generated Javascript. Setting it to 0 will use a single pass of enkEncNum.

The function works by selecting encodings at random from the array enkodings, applying them to the given string, and then producing Javascript to decode. The Javascript works by recursive evaluation, which should be nasty enough to stop anything but the most determined spambots.

The text parameter, if set, overrides the user-settable option enk_msg. This is the message overwritten by the JavaScript; if a browser doesn't support JavaScript, this message will be shown to the user.

Definition at line 197 of file StandalonePHPEnkoder.php.

References $content, $max_length, $max_passes, enkBuildJS(), and enkodePass().

Referenced by enkodeMailto(), and enkPlaintextLink().

enkodeAllEmails (   $text)

Enkode all emails.

Encodes all mailto: and plaintext links into JavaScript obscured text.

Definition at line 128 of file StandalonePHPEnkoder.php.

References enkodeMailtos(), and enkodePlaintextEmails().

enkodeMailto (   $email,
  $text,
  $subject = "",
  $title = "" 
)

Enkode a mailto: link.

Definition at line 163 of file StandalonePHPEnkoder.php.

References $content, $title, and enkode().

Referenced by enkEmailToLink().

enkodeMailtos (   $text)

Enkode mailto: links.

Encodes all mailto: links into JavaScript obscured text.

Definition at line 119 of file StandalonePHPEnkoder.php.

Referenced by enkodeAllEmails().

enkodePass (   $kode,
  $enc,
  $dec 
)
private

Encode a single pass.

$enc is a function pointer and $dec is the Javascript.

Definition at line 233 of file StandalonePHPEnkoder.php.

Referenced by enkode().

enkodePlaintextEmails (   $text)

Enkode plaintext emails.

Encodes all plaintext e-mails into a JavaScript-obscured mailto; the text of the mailto: is the e-mail address itself.

Definition at line 110 of file StandalonePHPEnkoder.php.

Referenced by enkodeAllEmails().

enkPlaintextLink (   $matches)
private

Enkode a single plaintext link.

Definition at line 155 of file StandalonePHPEnkoder.php.

References enkExtractLinktext(), and enkode().

Field Documentation

$email_regex
private

Definition at line 68 of file StandalonePHPEnkoder.php.

$enk_dec_num
private

Definition at line 73 of file StandalonePHPEnkoder.php.

$enk_dec_reverse
private

Definition at line 72 of file StandalonePHPEnkoder.php.

$enk_dec_swap
private

Definition at line 74 of file StandalonePHPEnkoder.php.

$enkode_class = 'enkoded-mailto'

Definition at line 63 of file StandalonePHPEnkoder.php.

$enkode_msg = 'email hidden; JavaScript is required'

Definition at line 62 of file StandalonePHPEnkoder.php.

$enkoder_uses = 0
private

Definition at line 67 of file StandalonePHPEnkoder.php.

$enkodings
private

Definition at line 75 of file StandalonePHPEnkoder.php.

$link_text
private

Definition at line 71 of file StandalonePHPEnkoder.php.

$mailto_email
private

Definition at line 70 of file StandalonePHPEnkoder.php.

$max_length = 1024

Definition at line 65 of file StandalonePHPEnkoder.php.

Referenced by enkode().

$max_passes = 20

Definition at line 64 of file StandalonePHPEnkoder.php.

Referenced by enkode().

$min_length = 269
private

Definition at line 66 of file StandalonePHPEnkoder.php.

$ptext_email
private

Definition at line 69 of file StandalonePHPEnkoder.php.


The documentation for this class was generated from the following file: