[ Index ] |
|
Code source de eGroupWare 1.2.106-2 |
1 <?php 2 /** 3 * 4 * Tests the default and example plugins for Savant. 5 * 6 * @version $Id: plugins.tpl.php 18360 2005-05-26 19:38:09Z mipmip $ 7 * 8 */ 9 ?> 10 11 12 <h1>ahref</h1> 13 14 <h2>from strings</h2> 15 <pre> 16 <?php 17 $result = $this->splugin('ahref', 'http://example.com/index.html?this=this&that=that#something', 'Example Link', 'target="_blank"'); 18 echo '<p>' . $this->splugin('modify', $result, 'htmlentities nl2br') . '</p>'; 19 echo "<p>$result</p>"; 20 ?> 21 </pre> 22 23 <h2>from arrays</h2> 24 <pre> 25 <?php 26 $result = $this->splugin( 27 'ahref', 28 parse_url('http://example.com/index.html?this=this&that=that#something'), 29 'Example Link', 30 array('target' => "_blank") 31 ); 32 echo '<p>' . $this->splugin('modify', $result, 'htmlentities nl2br') . '</p>'; 33 echo "<p>$result</p>"; 34 ?> 35 </pre> 36 37 38 <h1>checkbox</h1> 39 40 <pre> 41 <?php 42 $result = ''; 43 foreach ($this->set as $key => $val) { 44 $result .= $this->splugin( 45 'checkbox', // plugin 46 "xboxen[$key]", // checkbox name 47 $key, // checkbox value 48 'key1', // pre-checked 49 '', // default value when not checked 50 'dumb="dumber"' // attributes 51 ); 52 $result .= $val . "<br /><br />\n"; 53 } 54 55 $this->plugin('modify', $result, 'htmlentities nl2br'); 56 ?> 57 </pre> 58 59 <form><?php echo $result ?></form> 60 61 62 <h1>cycle</h1> 63 64 65 <h2>repeat 1 on array</h2> 66 <pre> 67 <?php for ($i = 0; $i < 9; $i++): ?> 68 <?php $this->plugin('cycle', array('a', 'b', 'c'), $i) ?><br /> 69 <?php endfor; ?> 70 </pre> 71 72 73 74 75 76 <h2>repeat 3 on preset</h2> 77 78 79 <pre> 80 <?php for ($i = 0; $i < 12; $i++): ?> 81 <?php $this->plugin('cycle', 'lightdark', $i, 3) ?><br /> 82 <?php endfor; ?> 83 </pre> 84 85 86 87 88 89 90 <h1>dateformat</h1> 91 <p><?php $this->plugin('dateformat', "Aug 8, 1970") ?></p> 92 <p><?php $this->plugin('dateformat', "Aug 8, 1970", 'mydate') ?></p> 93 94 95 96 97 <h1>javascript</h1> 98 <pre><?php echo htmlentities($this->splugin('javascript', 'path/to/file.js')) ?></pre> 99 100 101 <h1>image</h1> 102 103 <h2>local</h2> 104 <pre><?php echo htmlentities($this->splugin('image', 'savant.gif')) ?></pre> 105 <?php $this->plugin('image', 'savant.gif') ?> 106 107 <h2>nonexistent</h2> 108 <pre><?php echo htmlentities($this->splugin('image', 'savantx.gif', 'image does not exist')) ?></pre> 109 <?php $this->plugin('image', 'savantx.gif', 'image does not exist') ?> 110 111 <h2>stream</h2> 112 <pre><?php echo htmlentities($this->splugin('image', 'http://phpsavant.com/etc/fester.jpg')) ?></pre> 113 <?php $this->plugin('image', 'http://phpsavant.com/etc/fester.jpg') ?> 114 115 116 <h1>options</h1> 117 118 <h2>assoc</h2> 119 <pre> 120 <?php 121 $result = $this->splugin('options', $this->set, 'key1', 'dumb="dumber"'); 122 $this->plugin('modify', $result, 'htmlentities nl2br'); 123 ?> 124 </pre> 125 <form><select name="test"><?php echo $result ?></select></form> 126 127 128 <h2>seq</h2> 129 <pre> 130 <?php 131 $result = $this->splugin('options', $this->set, 'val2', array('attrib' => 'this & that'), true); 132 $this->plugin('modify', $result, 'htmlentities nl2br'); 133 ?> 134 </pre> 135 <form><select name="test"><?php echo $result ?></select></form> 136 137 138 139 <h1>radios</h1> 140 141 <h2>assoc</h2> 142 <pre> 143 <?php 144 $result = $this->splugin('radios', 'das_radio', $this->set, 'key1', 'nil', "<br /><br />\n", 'dumb="dumber"'); 145 $this->plugin('modify', $result, 'htmlentities nl2br'); 146 ?> 147 </pre> 148 <form><?php echo $result ?></form> 149 150 <h2>seq</h2> 151 <pre> 152 <?php 153 $result = $this->splugin('radios', 'das_radio', $this->set, 'val2', 'nil', "<br /><br />\n", 'dumb="dumber"', true); 154 $this->plugin('modify', $result, 'htmlentities nl2br'); 155 ?> 156 </pre> 157 <form><?php echo $result ?></form> 158 159 160 161 <h1>stylesheet</h1> 162 <pre><?php echo htmlentities($this->splugin('stylesheet', 'path/to/styles.css')) ?></pre> 163 164 165 <h1>textarea</h1> 166 <pre> 167 <?php 168 $result = $this->splugin('textarea', 'longtext', "some really long text"); 169 $this->plugin('modify', $result, 'htmlentities nl2br'); 170 ?> 171 </pre> 172 173 174 <?php 175 // tests the plugin path and a call-by-instance plugin 176 ?> 177 178 <h1>fester</h1> 179 180 <?php $this->plugin('fester', 'Gomez') ?><br /> 181 <?php $this->plugin('fester', 'Morticia') ?><br /> 182 <?php $this->plugin('fester', 'Cara Mia!') ?><br /> 183 184 185 <h1>Plugin Objects</h1> 186 187 _resource[plugin]: <pre><?php print_r($this->_resource['plugin']) ?></pre> 188 189 190 191 192 <!-- end -->
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 17:20:01 2007 | par Balluche grâce à PHPXref 0.7 |