[ Index ] |
|
Code source de CMS made simple 1.0.5 |
1 <?php 2 #CMS - CMS Made Simple 3 #(c)2004 by Ted Kulp (wishy@users.sf.net) 4 #This project's homepage is: http://cmsmadesimple.sf.net 5 # 6 #This program is free software; you can redistribute it and/or modify 7 #it under the terms of the GNU General Public License as published by 8 #the Free Software Foundation; either version 2 of the License, or 9 #(at your option) any later version. 10 # 11 #This program is distributed in the hope that it will be useful, 12 #but WITHOUT ANY WARRANTY; without even the implied warranty of 13 #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 #GNU General Public License for more details. 15 #You should have received a copy of the GNU General Public License 16 #along with this program; if not, write to the Free Software 17 #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 19 function smarty_cms_function_valid_xhtml($params, &$smarty) 20 { 21 22 $link_url = 23 (isset($params['url']) && trim($params['url']) != '') 24 ? $params['url'] 25 : 'http://validator.w3.org/check/referer' 26 ; 27 28 $link_target = 29 (isset($params['target']) && trim($params['target']) != '') 30 ? $params['target'] 31 : '' 32 ; 33 $link_target_html = $link_target != '' ? ' target="' . $link_target . '"' : ''; 34 35 $link_class = 36 (isset($params['class']) && trim($params['class']) != '') 37 ? $params['class'] 38 : '' 39 ; 40 $link_class_html = $link_class != '' ? ' class="' . $link_class . '"' : ''; 41 42 $link_text = 43 (isset($params['text']) && trim($params['text']) != '') 44 ? $params['text'] 45 : 'valid XHTML 1.0 Transitional' 46 ; 47 48 $use_image = ((! isset($params['image'])) || $params['image'] != 'false'); 49 50 $image_src = 51 (isset($params['src']) && trim($params['src']) != '') 52 ? $params['src'] 53 : 'http://www.w3.org/Icons/valid-xhtml10' 54 ; 55 56 $image_alt = isset($params['alt']) ? $params['alt'] : $link_text; 57 58 $image_width = 59 (isset($params['width']) && trim($params['width']) != '') 60 ? $params['width'] 61 : '88' 62 ; 63 $image_height = 64 (isset($params['height']) && trim($params['height']) != '') 65 ? $params['height'] 66 : '31' 67 ; 68 $image_size_html = ' width="' . $image_width . '" height="' . $image_height . '"'; 69 70 $image_class = 71 (isset($params['image_class']) && trim($params['image_class']) != '') 72 ? $params['image_class'] 73 : '' 74 ; 75 $image_class_html = $image_class != '' ? ' class="' . $image_class . '"' : ''; 76 77 $html = '<a href="' . $link_url . '"' . $link_class_html . $link_target_html . '>'; 78 $html .= 79 $use_image 80 ? '<img src="' . $image_src . '" alt="' . $image_alt . '"' . $image_size_html . $image_class_html . ' border="0" />' 81 : $link_text; 82 $html .= '</a>'; 83 84 return $html; 85 } 86 87 function smarty_cms_help_function_valid_xhtml() 88 { 89 ?> 90 <h3>What does this do?</h3> 91 <p>Returns a link to the w3c HTML validator.</p> 92 <h3>How do I use it?</h3> 93 <p>Just insert the tag into your template/page like: <code>{valid_xhtml}</code></p> 94 <h3>What parameters does it take?</h3> 95 <p> 96 <ul> 97 <li><em>(optional)</em> url (string) - The URL used for validation, if none is given http://validator.w3.org/check/referer is used.</li> 98 <li><em>(optional)</em> class (string) - If set, this will be used as class attribute for the link (a) element</li> 99 <li><em>(optional)</em> target (string) - If set, this will be used as target attribute for the link (a) element</li> 100 <li><em>(optional)</em> image (true/false) - If set to false, a text link will be used instead of an image/icon.</li> 101 <li><em>(optional)</em> text (string) - If set, this will be used for the link text or alternate text for the image. Default is 'valid XHTML 1.0 Transitional'.<br /> When an image is used, the given string will also be used for the image alt attribute (by default, this can be overridden by using the 'alt' parameter).</li> 102 <li><em>(optional)</em> image_class (string) - Only if 'image' is not set to false. If set, this will be used as class attribute for the image (img) element</li> 103 <li><em>(optional)</em> src (string) - Only if 'image' is not set to false. The icon to show. Default is http://www.w3.org/Icons/valid-xhtml10</li> 104 <li><em>(optional)</em> width (string) - Only if 'image' is not set to false. The image width. Default is 88 (width of http://www.w3.org/Icons/valid-xhtml10)</li> 105 <li><em>(optional)</em> height (string) - Only if 'image' is not set to false. The image height. Default is 31 (height of http://www.w3.org/Icons/valid-xhtml10)</li> 106 <li><em>(optional)</em> alt (string) - Only if 'image' is not set to false. The alternate text ('alt' attribute) for the image (element). If none is given the link text will be used.</li> 107 </ul> 108 </p> 109 <?php 110 } 111 112 function smarty_cms_about_function_valid_xhtml() 113 { 114 ?> 115 <p>Author: Dick Ittmann<dittmann2@users.sourceforge.net></p> 116 <p>Version: 1.0</p> 117 <p> 118 Change History:<br/> 119 None 120 </p> 121 <?php 122 } 123 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Tue Apr 3 18:50:37 2007 | par Balluche grâce à PHPXref 0.7 |