Niouzes

< Novembre 2017 >
Lu Ma Me Je Ve Sa Di
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30      

Citation

Attention

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.

2017-11-15 à 06:52:27

Table Of Contents

  1. FOUNDATION (functions) (01/04/2015)
  2. LSAction (class) (01/04/2015)
  3. LSAddress (class) (01/04/2015)
  4. LSAdministrativeArea (class) (01/04/2015)
  5. LSApplication (class) (14/10/2013)
  6. LSArray (class) (14/10/2013)
  7. LSArticle (class) (18/02/2014)
  8. LSAssertion (class) (14/10/2013)
  9. LSAudience (class) (18/02/2014)
  10. AUTOLOAD (function) (21/04/2014)
  11. LSAutoReference (class) (14/10/2013)
  12. LSBag (class) (14/10/2013)
  13. LSBBCodes (class) (10/06/2014)
  14. LSBrowser (class) (14/10/2013)
  15. LSCache (class) (14/10/2013)
  16. LSCalculator (class) (14/10/2013)
  17. LSCalendar (class) (14/10/2013)
  18. LSCameraSnapshot (class) (14/10/2013)
  19. LSCitation (class) (14/10/2013)
  20. LSClass (class) (14/10/2013)
  21. LSCode (class) ()
  22. Colors (functions) (15/11/2017)
  23. LSContactForm (class) (14/10/2013)
  24. LSContainer (class) (14/10/2013)
  25. LSContents (class) (14/10/2013)
  26. LSContentsAccounts (class) (14/10/2013)
  27. LSContentsArticles (class) (14/10/2013)
  28. LSContentsAtomicClock (class) (14/10/2013)
  29. LSContentsBusinessCoordinates (class) (14/10/2013)
  30. LSContentsBusinessOff (class) (14/10/2013)
  31. LSContentsBusinessOpeningHours (class) (14/10/2013)
  32. LSContentsBreadcrumb (class) (14/10/2013)
  33. LSContentsCalendar (class) (14/10/2013)
  34. LSContentsCatalogue (class) (14/10/2013)
  35. LSContentsCharter (class) (18/02/2014)
  36. LSContentsCitation (class) (14/10/2013)
  37. LSContentsClock (class) (14/10/2013)
  38. LSContentsComments (class) (14/10/2013)
  39. LSContentsCookieUsage (class) (14/10/2013)
  40. LSContentsCountdown (class) (14/10/2013)
  41. LSContentsDatetime (class) (14/10/2013)
  42. LSContentsHeartbeat (class) (14/10/2013)
  43. LSContentsIFrame (class) (14/10/2013)
  44. LSContentsImageGallery (class) (14/10/2013)
  45. LSContentsLanguageSwitchers (class) (14/10/2013)
  46. LSContentsLegal (class) (18/02/2014)
  47. LSContentsMicronews (class) (14/10/2013)
  48. LSContentsMyAccount (class) (14/10/2013)
  49. LSContentsPaymentOptions (class) (14/10/2013)
  50. LSContentsPinboard (class) (14/10/2013)
  51. LSContentsRememberPassword (class) (14/10/2013)
  52. LSContentsRSS (class) (14/10/2013)
  53. LSContentsSiteManager (class) (14/10/2013)
  54. LSContentsSitemap (class) (14/10/2013)
  55. LSContentsShare (class) (14/10/2013)
  56. LSContentsStopwatch (class) (14/10/2013)
  57. LSContentsTagCloud (class) (14/10/2013)
  58. LSContentsTodosOnPage (class) (14/10/2013)
  59. LSContentsW3C (class) (14/10/2013)
  60. LSContentsWeather (class) (14/10/2013)
  61. LSControl (class) (14/10/2013)
  62. LSCreativeWork (class) (18/02/2014)
  63. LSCursor (class) (09/03/2015)
  64. LSCustomer (class) (14/10/2013)
  65. LSDataEnvironment (class) (14/10/2013)
  66. Dates (functions) (01/04/2015)
  67. LSDate (class) (14/10/2013)
  68. LSDictionary (class) (14/10/2013)
  69. LSDom, LSDomNode and LSXPath (class) (30/04/2014)
  70. LSErrors and LSError (classes) (14/10/2013)
  71. LSException (class) (16/10/2013)
  72. LSExplorer (class) (14/10/2013)
  73. LSFieldset (class) (14/10/2013)
  74. LSFile (class) (14/10/2013)
  75. LSFileProperties (class) (14/10/2013)
  76. Files (functions) (01/04/2015)
  77. Finance (functions) (01/04/2015)
  78. LSFootnotes (class) (22/02/2014)
  79. LSForm (class) (09/06/2014)
  80. LSFunction (class) (14/10/2013)
  81. LSGeorama (class) (24/10/2013)
  82. LSGeoramaVar (class) (24/10/2013)
  83. LSGlossary (class) (09/03/2015)
  84. LSGroup (class) (14/10/2013)
  85. HTML (functions) (01/04/2015)
  86. LSHttp (class) (14/10/2013)
  87. HTTP (functions) (01/04/2015)
  88. LSImageGallery (class) (14/10/2013)
  89. Images (functions) (01/04/2015)
  90. LSInput (class) (26/04/2014)
  91. IP (functions) (01/04/2015)
  92. LSIslandAbstract (14/10/2013)
  93. LSIslandFormAbstract (class) (14/10/2013)
  94. LSLabel (class) (14/10/2013)
  95. LSLanguageSwitchers (class) (14/10/2013)
  96. LSLatin (class) (14/10/2013)
  97. LSLegalPerson (class) (14/10/2013)
  98. LSLinkedList (class) (14/10/2013)
  99. LSList (class) (14/10/2013)
  100. Mails (functions) (01/04/2015)
  101. LSMap (class) (14/10/2013)
  102. Math (functions) (01/04/2015)
  103. LSMicronews (class) (18/02/2014)
  104. Miscellaneous (functions) (01/04/2015)
  105. LSModuleAbstract (class) (14/10/2013)
  106. LSNaturalPerson (class) (14/10/2013)
  107. LSNewsArticle (class) (18/02/2014)
  108. LSNote (class) (14/10/2013)
  109. LSMotherNature (class) (16/10/2013)
  110. LSPage (class) (18/02/2014)
  111. LSParameter (class) (14/10/2013)
  112. LSPaymentOptions (class) (14/10/2013)
  113. LSPeopleAudience (class) (18/02/2014)
  114. LSPerson (class) (14/10/2013)
  115. LSPlace (class) (18/02/2014)
  116. LSProperty (class) (14/10/2013)
  117. LSPublication (class) (14/10/2013)
  118. LSRequirement (class) (14/10/2013)
  119. LSReturn (class) (24/10/2013)
  120. LSRisk (class) (14/10/2013)
  121. LSSentanaiAbstract (14/10/2013)
  122. LSServiceMessage (class) (14/10/2013)
  123. LSSession (class) (14/10/2013)
  124. LSSiteManager (class) (14/10/2013)
  125. LSSitemap (class) (14/10/2013)
  126. LSSockets (class) (14/10/2013)
  127. LSSoftwareApplication (class) (18/02/2014)
  128. LSSource (class) (14/10/2013)
  129. Strings (functions) (31/07/2016)
  130. LSSupplier (class) (14/10/2013)
  131. System (functions) (01/04/2015)
  132. LSTag (class) (21/04/2014)
  133. LSTagCloud (class) (14/10/2013)
  134. LSTechArticle (class) (18/02/2014)
  135. LSThing (class) (18/02/2014)
  136. LSTimeline (class) (14/10/2013)
  137. LSTimer (class) (16/10/2013)
  138. LSTracer (class) (09/03/2015)
  139. LSUnitTesting (class) (14/10/2013)
  140. URL (functions) (01/04/2015)
  141. LSUser (class) (09/03/2015)
  142. LSUserMgr (class) (14/10/2013)
  143. LSVaesoli (class) (09/06/2014)
  144. LSVersion (class) (14/10/2013)
  145. LSWebSite (class) (14/10/2013)
  146. LSWidget (class) (14/10/2013)
  147. LSWireTransferForm (class) (14/10/2013)
  148. LSXMLSitemap (class) (14/10/2013)
  149. XML (functions) (01/04/2015)

LSV.functions.php

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!.

File Properties

C:\websites\vaesoli.org\www\httpdocs/vaesoli/include/LSV.functions.phpC:\websites\vaesoli.org\www\httpdocs\vaesoli\include\LSV.functions.phpapplication/force-downloadC:\websites\vaesoli.org\www\httpdocs\vaesoli\include17805 bytes03/08/2013 23:27:5327/05/2014 13:31:5327/05/2014 13:31:53

Compliance

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                 *}
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 ... 

Manifest Constants

VAESOLI_PATH: Define the path where Vae Soli! is installed

VAESOLI_PLUGINS: Define the path where plugins are located

Sources required

LSFunctions.inc: Framework functions : ALL

UltraEdit Syntax files

  1. UltraEdit keywords of LSV.functions.php
  2. UltraEdit Syntax of LSV.functions.php

Function List (TOC)

  1. guid(): Returns a GUID (unique in time, unique in space)
  2. html_guid(): Returns a GUID (unique in time, unique in space) that fits HTML and XML specifications
  3. OnOff(): Returns 'On' or 'Off' based on $x
  4. Self(): Determines the name of the current script
  5. stripCRLF(): Eliminates CR and LF from $szText No assertion found for stripCRLF() (0 - 0)
  6. TrueFalse(): Returns 'True' or 'False' based on $x
  7. XSLOnXML(): Applies an XSLT stylesheet on a given XML
  8. YesNo(): Returns 'Yes' or 'No' based on $x

Functions of LSV.functions.php

guid(): Returns a GUID (unique in time, unique in space)

[ back to function list ]

Syntax

guid()

Parameters

None

Return

(string) GUID

Example Executed
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)
Unit Testing

1 assertions: 1 successful; 0 failed

See Also

html_guid()

html_guid(): Returns a GUID (unique in time, unique in space) that fits HTML and XML specifications

[ back to function list ]

Syntax

html_guid( $szPrefix )

Parameters
NameTypeDescription
$szPrefix string Prefix to add to the GUID. Optional. '' (blank) by default
Return

(string) GUID

Example Executed
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

Unit Testing

1 assertions: 1 successful; 0 failed

See Also

guid()

OnOff(): Returns 'On' or 'Off' based on $x

[ back to function list ]

Syntax

OnOff( $x )

Parameters
NameTypeDescription
$x mixed The value that drives the return
Return

(string) On or Off

Assertions

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

Unit Testing

11 assertions: 11 successful; 0 failed

See Also

YesNo(), TrueFalse()

Self(): Determines the name of the current script

[ back to function list ]

Syntax

Self( $bWithExtension )

Parameters
NameTypeDescription
$bWithExtension bool Optional extension setting. false by default.
Return

(string) The name of the current script

Example Executed
echo '<p>Current script: ',Self(),'</p>';
echo '<p>Current script: ',Self(true),'</p>';

Current script: guide

Current script: guide.php

Assertions

Self() === 'guide' successful

Self(true) === 'guide.php' successful

Unit Testing

2 assertions: 2 successful; 0 failed

stripCRLF(): Eliminates CR and LF from $szText

[ back to function list ]

Syntax

stripCRLF( $szText )

Parameters
NameTypeDescription
$szText string Text whose CR,LF must be eliminated
Return

(string) $szText without CR, LF (and CR+LF)

Example(s)
echo StripCRLF( $szText );
Unit Testing

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

[ back to function list ]

Syntax

TrueFalse( $x )

Parameters
NameTypeDescription
$x mixed The value that drives the return
Return

(string) True or False

Assertions

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

Unit Testing

11 assertions: 11 successful; 0 failed

See Also

OnOff(), YesNo()

XSLOnXML(): Applies an XSLT stylesheet on a given XML

[ back to function list ]

Syntax

XSLOnXML( $szXML,$szXSLFile,$aParams,$szMethod )

Parameters
NameTypeDescription
$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'
Parameters Warning

XSLOnXML() uses 4 parameters whereas the suggested limit is 3.

Return

(string) Result of $szXSLFile on $szXML

Example(s)
echo XSLOnXML( 'members.xml','members.xsl' );
Example Executed
$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

Unit Testing

1 assertions: 1 successful; 0 failed

YesNo(): Returns 'Yes' or 'No' based on $x

[ back to function list ]

Syntax

YesNo( $x )

Parameters
NameTypeDescription
$x mixed The value that drives the return
Return

(string) Yes or No

Assertions

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

Unit Testing

11 assertions: 7 successful; 4 failed

See Also

OnOff(), TrueFalse()

Suivant