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.     *
  23.     * @static
  24.     */
  25.     function getLines($strFile = null$strContent = null)
  26.     {
  27.         if ($strContent !== null{
  28.             $arLines HTML_Template_PHPLIB_Helper::splitLines($strContent);
  29.         else if ($strFile !== null{
  30.             $arLines file($strFileFILE_IGNORE_NEW_LINES);
  31.         }
  32.  
  33.         return $arLines;
  34.     }//function getLines($strFile = null, $strContent = null)
  35.  
  36.  
  37.  
  38.     /**
  39.     * Splits the content into single lines and returns
  40.     *  the array.
  41.     * Similar to file(), but works directly on the content
  42.     *  instead of the file name.
  43.     *
  44.     * @param string $strContent File content to be split into lines
  45.     *
  46.     * @return array Array of line strings without trailing newlines
  47.     *
  48.     * @static
  49.     */
  50.     function splitLines($strContent)
  51.     {
  52.         return explode(
  53.             "\n"str_replace(array("\r\n""\r")"\n"$strContent)
  54.         );
  55.     }//function splitLines($strContent)
  56.  
  57. }//class HTML_Template_PHPLIB_Helper
  58.  
  59. ?>

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