Code

Skip closing tag
[gosa.git] / include / smarty / plugins / block.render.php
1 <?php
3 function smarty_block_render($params, $text, &$smarty)
4 {
5         $text = stripslashes($text);
6         $acl = "";
8         /* Skip closing tag </render> */        
9         if(empty($text)) {
10                 return("");
11         }
13         /* Get acl parameter */
14         if (isset($params['acl'])) {
15                 $acl = $params['acl'];
16                 unset($params['acl']);
17         }
19         /* Read / Write*/
20         if(preg_match("/w/i",$acl)){
21                 return ($text);
22         }
24         $from   =  array("/name=/i");
25         $to     =  array("disabled name=");
26         $text = preg_replace($from,$to,$text);
27                 
28         /* Read only */
29         if(preg_match("/r/i",$acl)){
30                 return($text);  
31         }
33         /* No acls */   
34         if(preg_match("/type['\"= ].*submit/",$text)){
35                 $text = preg_replace("/submit/","button",$text);
36         }else{
37                 $text = preg_replace("/value=['\" ].*['\" ]/","",$text);
38         }
40         return $text;
41 }
43 ?>