| [ Index ] |
PHP Cross Reference of Web Application Component Toolkit |
[Summary view] [Print] [Text view]
1 <?php 2 //-------------------------------------------------------------------------------- 3 // Copyright 2003 Procata, Inc. 4 // Released under the LGPL license (http://www.gnu.org/copyleft/lesser.html) 5 //-------------------------------------------------------------------------------- 6 /** 7 * @package WACT_COMPONENT 8 * @version $Id: widgets.inc.php,v 1.1 2004/02/11 22:25:12 jeffmoore Exp $ 9 */ 10 //-------------------------------------------------------------------------------- 11 12 /** 13 * Widgets are runtime components which have no compile time template tag. 14 * They can be created and added by the PHP script controlling the template. 15 */ 16 17 18 /** 19 * Allows plain text to be added 20 * Widgets are runtime components which have no compile time template tag. 21 * They can be created and added by the PHP script controlling the template. 22 * @see http://wact.sourceforge.net/index.php/TextWidget 23 * @access public 24 * @package WACT_COMPONENT 25 */ 26 class TextWidget extends Component { 27 /** 28 * Text to add 29 * @var string 30 */ 31 var $text; 32 33 /** 34 * Constructs TextComponent 35 * @param string text to add 36 * @access public 37 */ 38 function TextWidget($text) { 39 $this->text = $text; 40 $this->IsDynamicallyRendered = TRUE; 41 } 42 43 /** 44 * Override parent method to prevent use of children 45 * @return void 46 * @access public 47 */ 48 function addChild() { 49 // Should we kick an error message here? 50 } 51 52 /** 53 * Outputs the text Widget. 54 * @return void 55 * @access public 56 */ 57 function render() { 58 echo ( htmlspecialchars($this->text, ENT_NOQUOTES) ); 59 } 60 } 61 62 /** 63 * Allows a tag to be created, which cannot contain children e.g. img 64 * @see http://wact.sourceforge.net/index.php/TagWidget 65 * @access public 66 * @package WACT_COMPONENT 67 */ 68 class TagWidget extends TagComponent { 69 /** 70 * Name of the tag 71 * @var string 72 * @access private 73 */ 74 var $tag; 75 76 /** 77 * Whether the tag is closing or not 78 * @var boolean 79 * @access private 80 */ 81 var $closing = true; 82 83 /** 84 * Constructs TagWidget 85 * @param string name of tag 86 * @param boolean whether tag is closing 87 * @access public 88 */ 89 function TagWidget($tag,$closing=true) { 90 $this->tag = htmlspecialchars($tag,ENT_QUOTES); 91 $this->closing = $closing; 92 $this->IsDynamicallyRendered = TRUE; 93 } 94 95 /** 96 * Override parent method to prevent use of children 97 * @return void 98 * @access public 99 */ 100 function addChild() { 101 // Should we kick an error message here? 102 } 103 104 /** 105 * Outputs the tag 106 * @return void 107 * @access public 108 */ 109 function render() { 110 echo ( '<'.$this->tag ); 111 echo ( $this->renderAttributes()); 112 if ( $this->closing ) 113 echo ( '/>' ); 114 else 115 echo ( '>' ); 116 } 117 } 118 119 /** 120 * Allows a tag to be created, which can contain children 121 * @see http://wact.sourceforge.net/index.php/TagContainerWidget 122 * @access public 123 * @package WACT_COMPONENT 124 */ 125 class TagContainerWidget extends TagComponent { 126 /** 127 * Name of the tag 128 * @var string 129 * @access private 130 */ 131 var $tag; 132 133 /** 134 * Constructs TagContainerWidget 135 * @param string name of tag 136 * @param boolean whether tag is closing 137 * @access public 138 */ 139 function TagContainerWidget($tag) { 140 $this->tag = htmlspecialchars($tag, ENT_QUOTES); 141 $this->IsDynamicallyRendered = TRUE; 142 } 143 144 /** 145 * Outputs the tag, rendering any child components as well 146 * @return void 147 * @access public 148 */ 149 function render() { 150 echo ( '<'.$this->tag ); 151 echo ( $this->renderAttributes().'>'); 152 parent :: render(); 153 echo ( '</'.$this->tag.'>' ); 154 } 155 } 156 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Sun Nov 28 19:36:09 2004 | Cross-referenced by PHPXref 0.5 |