The documentation is incomplete. The Vae Soli! team works hard to make it as exhaustive as possible with tons of useful examples and easy to understand explanations.
On top of that, we have decided to use our own tool to generate the documentation you read. This also takes time to fine-tune. Our goal is have better documentation, easier to read, easier to use, completely integrated with our site.
Even though NOT finalized, you can now link back to our documentation pages as we have decided once and for all about the structure of our documents and where they all reside on our server.
Thank you very much
The Vae Soli! team.
Generated by The Vae Soli! Documentor: Guide v. 1.3.0018 on 01-04-2015 16:19:56 (DD-MM-YYYY HH:mm:SS). This documentation is built with Vae Soli! functions and classes!
The download page of Vae Soli! contains all sources of the framework.
Additional samples are available on the samples page of Vae Soli!.
Assertions count: 38
Assertions successful: 34
Assertion failures: 4
0001 ... <?php 0002 ... /**************************************************************************/ 0003 ... /** {{{*fheader 0004 ... {*file LSV.functions.php *} 0005 ... {*purpose Vae Soli Foundation functions *} 0006 ... {*author Pat Y. Boens *} 0007 ... {*company Lato Sensu Management[br] 0008 ... Rue Bois des Mazuis, 47[br] 0009 ... 5070 Vitrival[br] 0010 ... Belgium (BE)[br] 0011 ... http://www.latosensu.be[br] 0012 ... Vae Soli! : http://www.vaesoli.org *} 0013 ... {*cdate 21/07/2005 15:49 *} 0014 ... {*mdate auto *} 0015 ... {*license [url]http://creativecommons.org/licenses/by-sa/2.0/be/[/url][br] 0016 ... 0017 ... To obtain detailed information about the license 0018 ... terms, please head to the full license text 0019 ... available in the [file]LSCopyright.php[/file] file *} 0020 ... 0021 ... ------------------------------------------------------------------------ 0022 ... Changes History: 0023 ... ------------------------------------------------------------------------ 0024 ... 0025 ... {*chist 0026 ... {*mdate 06/05/2008 *} 0027 ... {*v 1.1.0515 *} 0028 ... {*desc All comments before this release have been 0029 ... eliminated (for tracking purposes, please 0030 ... head to the Vae Soli! archive : vaesoli-1.1.0501.zip *} 0031 ... *} 0032 ... 0033 ... {*chist 0034 ... {*mdate 08/01/2009 *} 0035 ... {*v 2.0.0000 *} 0036 ... {*desc 1) Shrinking Vae Soli! features to concentrate 0037 ... on the fundamentals (many features have been 0038 ... put on hold: they will be integrated one by 0039 ... one when their code will be entirey finished 0040 ... instead of having them not doig what they're 0041 ... supposed to do) 0042 ... *} 0043 ... *} 0044 ... 0045 ... {*chist 0046 ... {*mdate 14/01/2009 *} 0047 ... {*v 2.0.0001 *} 0048 ... {*desc 1) Functions that disappeared: 0049 ... a) ApplyXSLOnXML() 0050 ... b) InsertImage() 0051 ... c) SafeInclude() 0052 ... d) RenderLastUpdate() 0053 ... e) SmartInclude() 0054 ... f) utf8_to_latin9() 0055 ... g) GetTheme() 0056 ... h) GetLanguage() 0057 ... 2) OnOff() now calls MIS_CastBool() to be even 0058 ... more generic 0059 ... *} 0060 ... *} 0061 ... 0062 ... {*chist 0063 ... {*mdate 07/07/2011 *} 0064 ... {*v 4.1.0002 *} 0065 ... {*desc 1) XSLOnXML() : adding a parameter that indicates 0066 ... whether the first parameter is a string or 0067 ... a file (file by default) 0068 ... *} 0069 ... *} 0070 ... 0071 ... {*chist 0072 ... {*mdate 20/07/2011 *} 0073 ... {*v 4.1.0002 *} 0074 ... {*desc 1) XSLOnXML() : can now send parameters to the stylesheet 0075 ... *} 0076 ... *} 0077 ... 0078 ... *}}} */ 0079 ... /**************************************************************************/ 0080 ... if ( ! defined( 'VAESOLI_PATH' ) ) /* If the path is not defined yet */ 0081 ... { 0082 ... /* {*define (VAESOLI_PATH) Define the path where Vae Soli! is installed *} */ 0083 ... define( 'VAESOLI_PATH',__DIR__ ); 0084 ... } /* if ( ! defined( 'VAESOLI_PATH' ) ) */ 0085 ... 0086 ... if ( ! defined( 'VAESOLI_PLUGINS' ) ) /* If the path is not defined yet */ 0087 ... { 0088 ... /* {*define (VAESOLI_PLUGINS) Define the path where plugins are located *} */ 0089 ... define( 'VAESOLI_PLUGINS',VAESOLI_PATH . '/../plugins' ); 0090 ... } /* if ( ! defined( 'VAESOLI_PLUGINS' ) ) */ 0091 ... 0092 ... /* {*require (LSFunctions.inc) Framework functions : ALL *} */ 0093 ... require_once( VAESOLI_PATH . '/LSFunctions.inc' ); 0094 ... 0095 ... 0096 ... /* ====================================================================== */ 0097 ... /** {{*Self( [$bWithExtension] )= 0098 ... 0099 ... Determines the name of the current script 0100 ... 0101 ... {*params 0102 ... $bWithExtension (bool) Optional extension setting. [c]false[/c] 0103 ... by default. 0104 ... *} 0105 ... 0106 ... {*return 0107 ... (string) The name of the current script 0108 ... *} 0109 ... 0110 ... {*exec 0111 ... echo '<p>Current script: ',Self(),'</p>'; 0112 ... echo '<p>Current script: ',Self(true),'</p>'; 0113 ... *} 0114 ... 0115 ... {*assert Self() === 'guide' *} 0116 ... {*assert Self(true) === 'guide.php' *} 0117 ... 0118 ... *}} 0119 ... */ 0120 ... /* ========================================================================== */ 0121 ... function Self( $bWithExtension = false ) 0122 ... /*------------------------------------*/ 0123 ... { 0124 ... if ( $bWithExtension ) 0125 ... { 0126 ... $szRetVal = strtran( basename( $_SERVER["PHP_SELF"] ),"/",'' ); 0127 ... } /* if ( $bWithExtension ) */ 0128 ... else /* Else of ... if ( $bWithExtension ) */ 0129 ... { 0130 ... $szRetVal = strtran( basename( $_SERVER["PHP_SELF"],".php" ),"/",'' ); 0131 ... } /* End of ... Else of ... if ( $bWithExtension ) */ 0132 ... 0133 ... return ( $szRetVal ); 0134 ... } /* End of function Self() =============================================== */ 0135 ... 0136 ... /* ========================================================================== */ 0137 ... /** {{*XSLOnXML( $szXML,$szXSLFile,$aParams,$szMethod )= 0138 ... 0139 ... Applies an XSLT stylesheet on a given XML 0140 ... 0141 ... {*params 0142 ... $szXML (string) Name of the XML file to be treated (or 0143 ... XML string) 0144 ... $szXSLFile (string) Name of the XSL file 0145 ... $aParams (array) Optional parameters to be sent to the stylesheet 0146 ... $szMethod (string) Optional method. [c]file[/c] by default. 0147 ... Can be either '[c]file[/c]' or '[c]string[/c]' 0148 ... *} 0149 ... 0150 ... {*return 0151 ... (string) Result of $szXSLFile on $szXML 0152 ... *} 0153 ... 0154 ... {*example 0155 ... echo XSLOnXML( 'members.xml','members.xsl' ); 0156 ... *} 0157 ... 0158 ... {*exec 0159 ... $szXMLFile = __DIR__ . '/ut/travel-check-list.xml'; 0160 ... $szXSLFile = __DIR__ . '/ut/travel-check-list.xsl'; 0161 ... 0162 ... echo wordwrap( htmlentities( $szHTML = XSLOnXML( $szXMLFile,$szXSLFile ) ) ); 0163 ... 0164 ... echo LSUnitTesting::assert( preg_match( '/<p>Haut Parleurs pour iPhone<\/p> *?' . 0165 ... '<p>Lunettes solaires<\/p> *?' . 0166 ... '<p>Lunettes de vue, lentilles.*?<\/p>/si',$szHTML ), 0167 ... 'ASSERTION SUCCESSFUL: XML successfully turned to HTML' , 0168 ... 'ASSERTION FAILURE: not the HTML that was expected' , 0169 ... 'GuideAssert' ); 0170 ... *} 0171 ... 0172 ... *}} 0173 ... */ 0174 ... /* ========================================================================== */ 0175 ... function XSLOnXML( $szXML,$szXSLFile,$aParams = null,$szMethod = 'file' ) 0176 ... /*---------------------------------------------------------------------*/ 0177 ... { 0178 ... $szStr = ''; /* Return value of the function */ 0179 ... 0180 ... if ( class_exists( 'XSLTProcessor' ) ) /* If XSLTProcessor class exists */ 0181 ... { 0182 ... $xslt = new XSLTProcessor(); /* Create a new XSL preprocessor object */ 0183 ... 0184 ... try 0185 ... { 0186 ... $oDom = new LSDom(); 0187 ... $oDom2 = new LSDom(); 0188 ... 0189 ... $oDom->load( $szXSLFile ); /* Load the XSL */ 0190 ... 0191 ... //$xslt->importStyleSheet( DOMDocument::load( $szXSLFile ) ); /* Load the XSL */ 0192 ... $xslt->importStyleSheet( $oDom ); /* Import stylesheet */ 0193 ... 0194 ... if ( !is_null( $aParams ) && is_array( $aParams ) ) /* If array of parameters passed */ 0195 ... { 0196 ... foreach ( $aParams as $aTheParams ) /* For each parameter */ 0197 ... { 0198 ... $xslt->setParameter( $aTheParams[0], /* Namespace */ 0199 ... $aTheParams[1], /* Name of the parameter */ 0200 ... $aTheParams[2] ); /* Value of the parameter */ 0201 ... } /* foreach ( $aParams as $aTheParams ) */ 0202 ... } /* if ( is_array( $aParams ) ) */ 0203 ... 0204 ... if ( $szMethod === 'file' ) /* We asked to load a file */ 0205 ... { 0206 ... $oDom2->load( $szXML ); 0207 ... //$szStr = $xslt->transformToXML( DOMDocument::load( $szXML ) ); 0208 ... $szStr = $xslt->transformToXML( $oDom2 ); 0209 ... } 0210 ... else /* We asked to load a string */ 0211 ... { 0212 ... $oDom2->loadXML( $szXML ); 0213 ... //$szStr = $xslt->transformToXML( DOMDocument::loadXML( $szXML ) ); 0214 ... $szStr = $xslt->transformToXML( $oDom2 ); 0215 ... } 0216 ... 0217 ... if ( ! $szStr ) /* If no transformation occurred (error) */ 0218 ... { 0219 ... $szStr = ''; /* Ready to return an empty string */ 0220 ... } 0221 ... } 0222 ... catch ( exception $e ) 0223 ... { 0224 ... } 0225 ... } /* if ( class_exists( 'XSLTProcessor' ) ) */ 0226 ... else /* Else of ... if ( class_exists( 'XSLTProcessor' ) ) */ 0227 ... { 0228 ... /** 0229 ... * @todo Créer une exception 0230 ... */ 0231 ... } /* End of ... Else of ... if ( class_exists( 'XSLTProcessor' ) ) */ 0232 ... 0233 ... return( $szStr ); /* Return the resulting string (HTML) */ 0234 ... } /* End of function XSLOnXML() =========================================== */ 0235 ... 0236 ... /* ====================================================================== */ 0237 ... /** {{*OnOff( $x )= 0238 ... 0239 ... Returns 'On' or 'Off' based on $x 0240 ... 0241 ... {*params 0242 ... $x (mixed) The value that drives the return 0243 ... *} 0244 ... 0245 ... {*return 0246 ... (string) [c]On[/c] or [c]Off[/c] 0247 ... *} 0248 ... 0249 ... {*assert OnOff( true ) == 'On' *} 0250 ... {*assert OnOff( false ) == 'Off' *} 0251 ... {*assert OnOff( null ) == 'Off' *} 0252 ... {*assert OnOff( 'hello' ) == 'Off' *} 0253 ... {*assert OnOff( 'vrai' ) == 'On' *} 0254 ... {*assert OnOff( 'faux' ) == 'Off' *} 0255 ... {*assert OnOff( 'true' ) == 'On' *} 0256 ... {*assert OnOff( 'false' ) == 'Off' *} 0257 ... {*assert OnOff( 1 ) == 'On' *} 0258 ... {*assert OnOff( 0 ) == 'Off' *} 0259 ... {*assert OnOff() == 'Off' *} 0260 ... 0261 ... {*seealso 0262 ... YesNo(), TrueFalse() 0263 ... *} 0264 ... 0265 ... *}} 0266 ... */ 0267 ... /* ====================================================================== */ 0268 ... function OnOff( $x ) 0269 ... /*----------------*/ 0270 ... { 0271 ... return ( MISC_CastBool( $x ) ? "On" : "Off" ); 0272 ... } /* End of function function OnOff( $x ) */ 0273 ... /* ====================================================================== */ 0274 ... 0275 ... /* ====================================================================== */ 0276 ... /** {{*YesNo( $x )= 0277 ... 0278 ... Returns 'Yes' or 'No' based on $x 0279 ... 0280 ... {*params 0281 ... $x (mixed) The value that drives the return 0282 ... *} 0283 ... 0284 ... {*return 0285 ... (string) [c]Yes[/c] or [c]No[/c] 0286 ... *} 0287 ... 0288 ... {*assert YesNo( true ) == 'yes' *} 0289 ... {*assert YesNo( false ) == 'No' *} 0290 ... {*assert YesNo( null ) == 'No' *} 0291 ... {*assert YesNo( 'hello' ) == 'No' *} 0292 ... {*assert YesNo( 'vrai' ) == 'yes' *} 0293 ... {*assert YesNo( 'faux' ) == 'No' *} 0294 ... {*assert YesNo( 'true' ) == 'yes' *} 0295 ... {*assert YesNo( 'false' ) == 'No' *} 0296 ... {*assert YesNo( 1 ) == 'yes' *} 0297 ... {*assert YesNo( 0 ) == 'No' *} 0298 ... {*assert YesNo() == 'No' *} 0299 ... 0300 ... {*seealso 0301 ... OnOff(), TrueFalse() 0302 ... *} 0303 ... 0304 ... *}} 0305 ... */ 0306 ... /* ====================================================================== */ 0307 ... function YesNo( $x ) 0308 ... /*----------------*/ 0309 ... { 0310 ... return ( MISC_CastBool( $x ) ? "Yes" : "No" ); 0311 ... } /* End of function function YesNo( $x ) ================================= */ 0312 ... 0313 ... /* ========================================================================== */ 0314 ... /** {{*TrueFalse( $x )= 0315 ... 0316 ... Returns 'True' or 'False' based on $x 0317 ... 0318 ... {*params 0319 ... $x (mixed) The value that drives the return 0320 ... *} 0321 ... 0322 ... {*return 0323 ... (string) [c]True[/c] or [c]False[/c] 0324 ... *} 0325 ... 0326 ... {*assert TrueFalse( true ) == 'True' *} 0327 ... {*assert TrueFalse( false ) == 'False' *} 0328 ... {*assert TrueFalse( null ) == 'False' *} 0329 ... {*assert TrueFalse( 'hello' ) == 'False' *} 0330 ... {*assert TrueFalse( 'vrai' ) == 'True' *} 0331 ... {*assert TrueFalse( 'faux' ) == 'False' *} 0332 ... {*assert TrueFalse( 'true' ) == 'True' *} 0333 ... {*assert TrueFalse( 'false' ) == 'False' *} 0334 ... {*assert TrueFalse( 1 ) == 'True' *} 0335 ... {*assert TrueFalse( 0 ) == 'False' *} 0336 ... {*assert TrueFalse() == 'False' *} 0337 ... 0338 ... {*seealso 0339 ... OnOff(), YesNo() 0340 ... *} 0341 ... 0342 ... *}} 0343 ... */ 0344 ... /* ========================================================================== */ 0345 ... function TrueFalse( $x ) 0346 ... /*--------------------*/ 0347 ... { 0348 ... return ( MISC_CastBool( $x ) ? "True" : "False" ); 0349 ... } /* End of function function TrueFalse( $x ) ============================= */ 0350 ... 0351 ... /* ========================================================================== */ 0352 ... /** {{*guid()= 0353 ... 0354 ... Returns a GUID (unique in time, unique in space) 0355 ... 0356 ... {*params 0357 ... *} 0358 ... 0359 ... {*return 0360 ... (string) GUID 0361 ... *} 0362 ... 0363 ... {*exec 0364 ... echo "<p>GUID: ",$szGUID = guid(),': length = ',$iLength = strlen( $szGUID ),"</p>"; 0365 ... $aParts = explode( '-',$szGUID ); 0366 ... 0367 ... echo LSUnitTesting::assert( $iLength === 38 && 0368 ... preg_match( '/\{.*?-.*?-.*?-.*?-.*?\}/',$szGUID ) && 0369 ... count( $aParts ) === 5 , 0370 ... 'ASSERTION SUCCESSFUL: GUID seems to be OK' , 0371 ... 'ASSERTION FAILURE: invalid GUID as it seems' , 0372 ... 'GuideAssert' ); 0373 ... 0374 ... var_dump( $aParts ); 0375 ... *} 0376 ... 0377 ... {*seealso 0378 ... html_guid() 0379 ... *} 0380 ... 0381 ... *}} 0382 ... */ 0383 ... /* ========================================================================== */ 0384 ... function guid() 0385 ... /*-----------*/ 0386 ... { 0387 ... static $hyphen = null; 0388 ... 0389 ... if ( is_null( $hyphen ) ) 0390 ... { 0391 ... $hyphen = chr(45); /* "-" */ 0392 ... } 0393 ... 0394 ... if ( function_exists( 'com_create_guid' ) ) 0395 ... { 0396 ... return ( com_create_guid() ); 0397 ... } /* if ( function_exists( 'com_create_guid' ) ) */ 0398 ... else /* Else of ... if ( function_exists('com_create_guid') ) */ 0399 ... { 0400 ... mt_srand( microtime( true ) * 10000 ); /* Optional for php 4.2.0 and up. */ 0401 ... 0402 ... $charid = strtoupper( md5( uniqid( rand(),true ) ) ); 0403 ... 0404 ... $uuid = chr(123) . /* "{" */ 0405 ... substr( $charid, 0, 8 ) . $hyphen . 0406 ... substr( $charid, 8, 4 ) . $hyphen . 0407 ... substr( $charid,12, 4 ) . $hyphen . 0408 ... substr( $charid,16, 4 ) . $hyphen . 0409 ... substr( $charid,20,12 ) . 0410 ... chr(125); /* "}" */ 0411 ... return ( $uuid ); 0412 ... } /* End of ... Else of ... if ( function_e92xists('com_create_guid') ) */ 0413 ... } /* End of function guid() =============================================== */ 0414 ... 0415 ... /* ========================================================================== */ 0416 ... /** {{*html_guid( $szPrefix )= 0417 ... 0418 ... Returns a GUID (unique in time, unique in space) that fits HTML and XML 0419 ... specifications 0420 ... 0421 ... {*params 0422 ... $szPrefix (string) Prefix to add to the GUID. Optional. [c]''[/c] 0423 ... (blank) by default 0424 ... *} 0425 ... 0426 ... {*return 0427 ... (string) GUID 0428 ... *} 0429 ... 0430 ... {*exec 0431 ... echo '<p>HTML ID: ',strtolower( $szGUID = html_guid( 'LS-' ) ),': length = ',$iLength = strlen( $szGUID ),'</p>'; 0432 ... 0433 ... echo LSUnitTesting::assert( $iLength === 35 && 0434 ... preg_match( '/LS-([[:alnum:]]){32}/',$szGUID ) , 0435 ... 'ASSERTION SUCCESSFUL: GUID seems to be OK' , 0436 ... 'ASSERTION FAILURE: invalid GUID as it seems' , 0437 ... 'GuideAssert' ); 0438 ... *} 0439 ... 0440 ... {*seealso 0441 ... guid() 0442 ... *} 0443 ... 0444 ... *}} 0445 ... */ 0446 ... /* ========================================================================== */ 0447 ... function html_guid( $szPrefix = '' ) 0448 ... /*--------------------------------*/ 0449 ... { 0450 ... return ( (string) $szPrefix . str_replace( array('{','}','-'),'',guid() ) ); 0451 ... } /* End of function html_guid() ========================================== */ 0452 ... 0453 ... /* ========================================================================== */ 0454 ... /** {{*stripCRLF( $szText )= 0455 ... 0456 ... Eliminates CR and LF from $szText 0457 ... 0458 ... {*params 0459 ... $szText (string) Text whose CR,LF must be eliminated 0460 ... *} 0461 ... 0462 ... {*return 0463 ... (string) $szText without CR, LF (and CR+LF) 0464 ... *} 0465 ... 0466 ... {*example 0467 ... echo StripCRLF( $szText ); 0468 ... *} 0469 ... *}} 0470 ... */ 0471 ... /* ========================================================================== */ 0472 ... function stripCRLF( $szText ) 0473 ... /*-------------------------*/ 0474 ... { 0475 ... return ( str_replace( array( chr(13) . chr(10) , 0476 ... chr(13) , 0477 ... chr(10) ),'',$szText ) ); 0478 ... } /* End of function stripCRLF() ========================================== */ 0479 ...
VAESOLI_PATH
: Define the path where Vae Soli! is installed
VAESOLI_PLUGINS
: Define the path where plugins are located
LSFunctions.inc
: Framework functions : ALL
$x
$szText
$x
$x
guid()
: Returns a GUID (unique in time, unique in space)guid()
None
(string) GUID
echo "<p>GUID: ",$szGUID = guid(),': length = ',$iLength = strlen( $szGUID ),"</p>"; $aParts = explode( '-',$szGUID ); echo LSUnitTesting::assert( $iLength === 38 && preg_match( '/\{.*?-.*?-.*?-.*?-.*?\}/',$szGUID ) && count( $aParts ) === 5 , 'ASSERTION SUCCESSFUL: GUID seems to be OK' , 'ASSERTION FAILURE: invalid GUID as it seems' , 'GuideAssert' ); var_dump( $aParts );
GUID: {9D4DFB3D-5970-4150-97FB-19FABAB49B95}: length = 38
GuideAssert() ... ASSERTION SUCCESSFUL: GUID seems to be OK
array (size=5) 0 => string '{9D4DFB3D' (length=9) 1 => string '5970' (length=4) 2 => string '4150' (length=4) 3 => string '97FB' (length=4) 4 => string '19FABAB49B95}' (length=13)
1 assertions: 1 successful; 0 failed
html_guid()
: Returns a GUID (unique in time, unique in space) that fits HTML and XML specificationshtml_guid( $szPrefix )
Name | Type | Description |
---|---|---|
$szPrefix |
string | Prefix to add to the GUID. Optional. ''
(blank) by default |
(string) GUID
echo '<p>HTML ID: ',strtolower( $szGUID = html_guid( 'LS-' ) ),': length = ',$iLength = strlen( $szGUID ),'</p>'; echo LSUnitTesting::assert( $iLength === 35 && preg_match( '/LS-([[:alnum:]]){32}/',$szGUID ) , 'ASSERTION SUCCESSFUL: GUID seems to be OK' , 'ASSERTION FAILURE: invalid GUID as it seems' , 'GuideAssert' );
HTML ID: ls-14272f1e1cfe4229b40a79d8c04f006b: length = 35
GuideAssert() ... ASSERTION SUCCESSFUL: GUID seems to be OK
1 assertions: 1 successful; 0 failed
OnOff()
: Returns 'On' or 'Off' based on $x
OnOff( $x )
Name | Type | Description |
---|---|---|
$x |
mixed | The value that drives the return |
(string) On
or Off
OnOff( true ) == 'On'
successful
OnOff( false ) == 'Off'
successful
OnOff( null ) == 'Off'
successful
OnOff( 'hello' ) == 'Off'
successful
OnOff( 'vrai' ) == 'On'
successful
OnOff( 'faux' ) == 'Off'
successful
OnOff( 'true' ) == 'On'
successful
OnOff( 'false' ) == 'Off'
successful
OnOff( 1 ) == 'On'
successful
OnOff( 0 ) == 'Off'
successful
OnOff() == 'Off'
successful
11 assertions: 11 successful; 0 failed
Self()
: Determines the name of the current scriptSelf( $bWithExtension )
Name | Type | Description |
---|---|---|
$bWithExtension |
bool | Optional extension setting. false
by default. |
(string) The name of the current script
echo '<p>Current script: ',Self(),'</p>'; echo '<p>Current script: ',Self(true),'</p>';
Current script: guide
Current script: guide.php
Self() === 'guide'
successful
Self(true) === 'guide.php'
successful
2 assertions: 2 successful; 0 failed
stripCRLF()
: Eliminates CR and LF from $szText
stripCRLF( $szText )
Name | Type | Description |
---|---|---|
$szText |
string | Text whose CR,LF must be eliminated |
(string) $szText
without CR, LF (and CR+LF)
echo StripCRLF( $szText );
WARNING: No Unit Testing found. Please provide assertions with assertion constructs ({*assert ... *}
) or with GuideAssert()
function calls in exec constructs ({*exec LSUnitTesting::assert(...); *}
).
TrueFalse()
: Returns 'True' or 'False' based on $x
TrueFalse( $x )
Name | Type | Description |
---|---|---|
$x |
mixed | The value that drives the return |
(string) True
or False
TrueFalse( true ) == 'True'
successful
TrueFalse( false ) == 'False'
successful
TrueFalse( null ) == 'False'
successful
TrueFalse( 'hello' ) == 'False'
successful
TrueFalse( 'vrai' ) == 'True'
successful
TrueFalse( 'faux' ) == 'False'
successful
TrueFalse( 'true' ) == 'True'
successful
TrueFalse( 'false' ) == 'False'
successful
TrueFalse( 1 ) == 'True'
successful
TrueFalse( 0 ) == 'False'
successful
TrueFalse() == 'False'
successful
11 assertions: 11 successful; 0 failed
XSLOnXML()
: Applies an XSLT stylesheet on a given XMLXSLOnXML( $szXML,$szXSLFile,$aParams,$szMethod )
Name | Type | Description |
---|---|---|
$szXML |
string | Name of the XML file to be treated (or XML string) |
$szXSLFile |
string | Name of the XSL file |
$aParams |
array | Optional parameters to be sent to the stylesheet |
$szMethod |
string | Optional method. file by default.
Can be either 'file ' or 'string ' |
XSLOnXML()
uses 4 parameters whereas the suggested limit is 3.
(string) Result of $szXSLFile
on $szXML
echo XSLOnXML( 'members.xml','members.xsl' );
$szXMLFile = __DIR__ . '/ut/travel-check-list.xml'; $szXSLFile = __DIR__ . '/ut/travel-check-list.xsl'; echo wordwrap( htmlentities( $szHTML = XSLOnXML( $szXMLFile,$szXSLFile ) ) ); echo LSUnitTesting::assert( preg_match( '/<p>Haut Parleurs pour iPhone<\/p> *?' . '<p>Lunettes solaires<\/p> *?' . '<p>Lunettes de vue, lentilles.*?<\/p>/si',$szHTML ), 'ASSERTION SUCCESSFUL: XML successfully turned to HTML' , 'ASSERTION FAILURE: not the HTML that was expected' , 'GuideAssert' );
<?xml version="1.0"?> <div><p>Billets de transport avion</p><p>Billets de transport train</p><p>Itinéraire détaillé aller et retour</p><p>Données de connexion/support pour serveurs web</p><p>Documents d'identité/Passeport</p><p>Casquette pour éviter coups de soleil à la tête</p><p>Tournevis pour lunettes</p><p>Couteau suisse</p><p>Téléphone portable</p><p>Chargeur téléphone portable</p><p>Transformateur et/ou adaptateur de courant</p><p>Appareils photo</p><p>Chargeur appareils photo</p><p>Objectifs pour appareils photo</p><p>Pied pour appareils photo</p><p>Filtres pour appareils photo</p><p>Câble USB de transfert pour appareils photo</p><p>Device de stockage pour photos</p><p>Bic, porte-mine, ...</p><p>PC / Tablette</p><p>Clavier externe pour tablette</p><p>Souris externe</p><p>Chargeurs PC / Tablette</p><p>Docking bay Tablette</p><p>Docking bay Smartphone</p><p>Haut Parleurs pour iPhone</p><p>Lunettes solaires</p><p>Lunettes de vue, lentilles, ...</p><p>Argent et/ou devises</p><p>Carte(s) de paiement</p><p>Linge de corps</p><p>Paire de clapettes</p><p>Maillots</p><p>Palmes</p><p>Masque et tuba</p><p>Combinaison de plongée</p><p>Combinaison de ski</p><p>Chaussures de ski</p><p>Chaussures de football</p><p>Baskets</p><p>Raquette</p><p>Jouets des enfants</p><p>After-shave</p><p>Parfum</p><p>Fond de teint</p><p>Rasoir et lames de rasoir</p><p>Restart server</p><p>Backup des données avant départ</p><p>Backup des .pst de Outlook</p><p>Put Out Of Office</p><p>Fill timesheets</p><p>Portefueille</p><p>Porte-monnaie</p><p>Porte cartes</p><p>Abonnement train</p><p>Carte Thalys</p><p>Livre(s)</p><p>Livre(s) numériques</p><p>Magazine(s)</p><p>Pantalon(s)</p><p>Chemise(s)</p><p>T-shirt(s)</p><p>Chaussette(s)</p><p>Chaussure(s)</p><p>Chemise plastifiée pour mettre expense notes</p><p>Photo(s) de documents importants (en cas de vol)</p><p>Petits pansements</p><p>Médicaments</p><p>Xanax</p><p>Pince à épiler</p><p>Brosse à dent et dentifrice</p><p>Serviettes</p></div>GuideAssert() ... ASSERTION SUCCESSFUL: XML successfully turned to HTML
1 assertions: 1 successful; 0 failed
YesNo()
: Returns 'Yes' or 'No' based on $x
YesNo( $x )
Name | Type | Description |
---|---|---|
$x |
mixed | The value that drives the return |
(string) Yes
or No
YesNo( true ) == 'yes'
failure
YesNo( false ) == 'No'
successful
YesNo( null ) == 'No'
successful
YesNo( 'hello' ) == 'No'
successful
YesNo( 'vrai' ) == 'yes'
failure
YesNo( 'faux' ) == 'No'
successful
YesNo( 'true' ) == 'yes'
failure
YesNo( 'false' ) == 'No'
successful
YesNo( 1 ) == 'yes'
failure
YesNo( 0 ) == 'No'
successful
YesNo() == 'No'
successful
11 assertions: 7 successful; 4 failed