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

Procedural File: rtl.inc.php

Source Location: /rtl.inc.php



Classes:

EAbort
EAbort is the exception class for errors that should not display an error message.


Page Details:

This file is part of the VCL for PHP project

Copyright (c) 2004-2008 qadram software S.L. <support@qadram.com>

Checkout AUTHORS file for more information on the developers

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA










Abort [line 203]

void Abort( )

Throws a silent exception

Use Abort to escape from an execution path without reporting an error.

Abort raises a special "silent exception" (EAbort), which operates like any other exception, but does not display an error message to the end user. Abort redirects execution to the end of the last exception block.

  1.  <?php
  2.         function CheckOperation($Operation$ErrorEvent)
  3.         {
  4.             $Done false;
  5.             do
  6.             {
  7.                 try
  8.                 {
  9.                   $this->$Operation();
  10.                   $Done=true;
  11.                 }
  12.                 catch (EDatabaseError $e)
  13.                 {
  14.                     $Action=daFail;
  15.                     $Action=$this->callEvent($ErrorEventarray('Exception'=>$e'Action'=>$Action));
  16.                     if ($Action==daFailthrow $e;
  17.                     if ($Action==daAbortAbort();
  18.                 }
  19.  
  20.             }
  21.             while(!$Done);
  22.         }
  23.  ?>




Tags:

see:  EAbort


[ Top ]



assigned [line 147]

boolean assigned( object $var)

Check if an object is not null

This function is the Delphi for Windows equivalent for assigned, and in this case, it checks for a variable if assigned to null or not. Note that $var can contain anything, it doesn't check if it's an object or not.




Parameters

object   $var   Object to check
[ Top ]



boolToStr [line 45]

string boolToStr( boolean $value)

Converts PHP boolean into a JavaScript compatible boolean string

This function takes a PHP boolean value and echoes a valid javascript boolean value (true/false) to the output. You can use it when writting PHP code that generates Javascript code so you don't have to mess with boolean values

  1.  <?php
  2.  
  3.  echo boolToStr(($a==1));
  4.  
  5.  ?>




Parameters

boolean   $value   PHP boolean value to convert
[ Top ]



extractjscript [line 226]

array extractjscript( string $html)

Extracts the javascript code from an html document

This function is used to automatically extract all javascript code from an HTML chunk, the splitted code is returned in an array, in which the first item (key 0) is the javascript code and the second item (key 1) is the HTML code without the javascript.

  1.  <?php
  2.    $result=extractjscript($htmlwithjavascript);
  3.    $js=$result[0];
  4.    $html=$result[1];
  5.  ?>




Parameters

string   $html   HTML document to extract the javascript from
[ Top ]



htmlToText [line 105]

string htmlToText( string $text)

Converts HTML to plain text

This function takes HTML as input, including line breaks and entities, and returns the text in plain text form, by changing
to carriage returns and all entities to their corresponding character.

  1.  <?php
  2.  
  3.  echo htmlToText("this is HTML<br />Including &aacute;&eacute;&iacute;&oacute;&uacute; chars<br />");
  4.  // This will produce "this is HTML\nIncluding αινσϊ chars\n"
  5.  
  6.  ?>




Tags:



Parameters

string   $text   HTML to conver to plain text
[ Top ]



redirect [line 129]

void redirect( string $file)

Redirects the browser to a project file

Use this function to redirect to a script that is in the same project without worring about host or anything else, as the function calculates the right URI to redirect to.

  1.  <?php
  2.  
  3.  redirect("unit2.php");
  4.  
  5.  ?>




Tags:



Parameters

string   $file   File to redirect to
[ Top ]



safeunserialize [line 276]

mixed safeunserialize( string $input)

Unserializes and if it gets an error, uses __unserialize

This function first tries to unserialize the $input using the built-in PHP function, and if there is any error, it tries to unserialize using the DBCS safe function __unserialize to try get the value because it may be encoded as DBCS.




Tags:



Parameters

string   $input   String to unserialize
[ Top ]



textToHtml [line 72]

string textToHtml( string $text, [string $charset = null])

Converts plain text to html

This function takes plain text as input, including carriage returns and non html chars, and returns the text in HTML form, by changing carriage returns to
and all non html chars exchanged by their corresponding entity.

  1.  <?php
  2.  
  3.  echo textToHtml("this is plain-text\nIncluding αινσϊ chars\n");
  4.  // This will produce "this is plain-text<br>Incluiding &aacute;&eacute;&iacute;&oacute;&uacute; chars<br>"
  5.  
  6.  ?>




Tags:



Parameters

string   $text   Plain text to convert to HTML
string   $charset   Use if you want to specify the charset to use when converting
[ Top ]



__unserialize [line 257]

mixed __unserialize( string $sObject)

DBCS friendly unserialize, it modifies the length of all strings with the correct size

This function allows you to unserialize serialized objects/arrays/variables when working with DBCS (Double Byte Character Sets) because it fixes the length of strings to the real length before unserializing.

If not doing it this way, unserialize will throw an error due incorrect string lengths.




Tags:



Parameters

string   $sObject   String to unserialize
[ Top ]



Documentation generated on Sat, 13 Jun 2009 10:51:56 -0700 by phpDocumentor 1.4.1