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

Source for file Helper.php

Documentation is available at Helper.php

  1. <?php
  2.  
  3. /**
  4. * Helper methods for the HTML_Template_PHPLIB tool
  5. *
  6. @category HTML
  7. @package  HTML_Template_PHPLIB
  8. @author   Christian Weiske <cweiske@php.net>
  9. @license  http://www.gnu.org/copyleft/lesser.html LGPL License 2.1
  10. @link     http://pear.php.net/package/HTML_Template_PHPLIB
  11. */
  12. {
  13.  
  14.     /**
  15.     * Returns an array with all lines of the text.
  16.     * Extracts it from the file or the text
  17.     *
  18.     * @param string $strFile    File name
  19.     * @param string $strContent Template code
  20.     *
  21.     * @return array Array with text lines, without trailing newlines,
  22.     *                 false when both are null
  23.     *
  24.     * @static
  25.     */
  26.     function getLines($strFile = null$strContent = null)
  27.     {
  28.         if ($strContent !== null{
  29.             $arLines HTML_Template_PHPLIB_Helper::splitLines($strContent);
  30.         else if ($strFile !== null{
  31.             $arLines file($strFileFILE_IGNORE_NEW_LINES);
  32.         else {
  33.             //all null?
  34.             return false;
  35.         }
  36.  
  37.         return $arLines;
  38.     }//function getLines($strFile = null, $strContent = null)
  39.  
  40.  
  41.  
  42.     /**
  43.     * Splits the content into single lines and returns
  44.     *  the array.
  45.     * Similar to file(), but works directly on the content
  46.     *  instead of the file name.
  47.     *
  48.     * @param string $strContent File content to be split into lines
  49.     *
  50.     * @return array Array of line strings without trailing newlines
  51.     *
  52.     * @static
  53.     */
  54.     function splitLines($strContent)
  55.     {
  56.         return explode(
  57.             "\n"str_replace(array("\r\n""\r")"\n"$strContent)
  58.         );
  59.     }//function splitLines($strContent)
  60.  
  61. }//class HTML_Template_PHPLIB_Helper
  62.  
  63. ?>

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