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

Source for file Text.php

Documentation is available at Text.php

  1. <?php
  2. /* vim: set expandtab tabstop=4 shiftwidth=4: */
  3. // +----------------------------------------------------------------------+
  4. // | PHP Version 4                                                        |
  5. // +----------------------------------------------------------------------+
  6. // | Copyright (c) 1997-2002 The PHP Group                                |
  7. // +----------------------------------------------------------------------+
  8. // | This source file is subject to version 2.02 of the PHP license,      |
  9. // | that is bundled with this package in the file LICENSE, and is        |
  10. // | available at through the world-wide-web at                           |
  11. // | http://www.php.net/license/2_02.txt.                                 |
  12. // | If you did not receive a copy of the PHP license and are unable to   |
  13. // | obtain it through the world-wide-web, please send a note to          |
  14. // | license@php.net so we can mail you a copy immediately.               |
  15. // +----------------------------------------------------------------------+
  16. // | Authors:  Alan Knowles <alan@akbkhome>                               |
  17. // +----------------------------------------------------------------------+
  18. //
  19. // $Id: Text.php 329605 2013-03-01 01:59:25Z alan_k $
  20. //
  21.  
  22.  
  23. /**
  24. * Class that represents a text string node.
  25. *
  26. */
  27.  
  28. class HTML_Template_Flexy_Token_Text extends HTML_Template_Flexy_Token {
  29.      
  30.      
  31.     /**
  32.     * Simple check to see if this piece of text is a word
  33.     * so that gettext and the merging tricks dont try
  34.     * - merge white space with a flexy tag
  35.     * - gettext doesnt translate &nbsp; etc.
  36.     *
  37.     * @return   boolean  true if this is a word
  38.     * @access   public
  39.     */
  40.     function isWord({
  41.         if (!strlen(trim($this->value))) {
  42.             return false;
  43.         }
  44.         if (preg_match('/^\&[a-z0-9]+;$/i',trim($this->value))) {
  45.             return false;
  46.         }
  47.         return  preg_match('/\w/i',$this->value);
  48.     }
  49.     /**
  50.      * used to get the contents..
  51.      */
  52.     function toString()
  53.     {
  54.         return $this->value;
  55.         
  56.     }
  57. }

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