[ Index ]
 

Code source de CMS made simple 1.0.5

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/plugins/ -> function.valid_css.php (source)

   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_css($params, &$smarty)
  20  {
  21      $link_url = 
  22      (isset($params['url']) && trim($params['url']) != '')
  23      ? $params['url']
  24          : 'http://jigsaw.w3.org/css-validator/check/referer'
  25      ;
  26      
  27      $link_target =
  28      (isset($params['target']) && trim($params['target']) != '')
  29      ? $params['target']
  30      : ''
  31      ;
  32      $link_target_html = $link_target != '' ? ' target="' . $link_target . '"' : '';
  33      
  34      $link_class =
  35      (isset($params['class']) && trim($params['class']) != '')
  36      ? $params['class']
  37      : ''
  38      ;
  39      $link_class_html  = $link_class  != '' ? ' class="'  . $link_class  . '"' : '';
  40      
  41      $link_text = 
  42      (isset($params['text']) && trim($params['text']) != '')
  43      ? $params['text']
  44      : 'valid CSS 2.1'
  45      ;
  46      
  47      $use_image = ((! isset($params['image'])) || $params['image'] != 'false');
  48      
  49      $image_src = 
  50      (isset($params['src']) && trim($params['src']) != '') 
  51      ? $params['src'] 
  52      : 'http://jigsaw.w3.org/css-validator/images/vcss'
  53      ;
  54      
  55      $image_alt = isset($params['alt']) ? $params['alt'] : $link_text;
  56      
  57      $image_width = 
  58      (isset($params['width']) && trim($params['width']) != '') 
  59      ? $params['width'] 
  60      : '88'
  61      ;
  62      $image_height = 
  63      (isset($params['height']) && trim($params['height']) != '') 
  64      ? $params['height'] 
  65      : '31'
  66      ;
  67      $image_size_html = ' width="' . $image_width . '" height="' . $image_height . '"';
  68      
  69      $image_class =
  70      (isset($params['image_class']) && trim($params['image_class']) != '')
  71      ? $params['image_class']
  72      : ''
  73      ;
  74      $image_class_html  = $image_class  != '' ? ' class="'  . $image_class  . '"' : '';
  75      
  76      $html = '<a href="' . $link_url . '"' . $link_class_html . $link_target_html . '>';
  77      $html .= 
  78      $use_image
  79      ? '<img src="' . $image_src . '" alt="' . $image_alt . '"' . $image_size_html . $image_class_html . ' border="0" />' 
  80      : $link_text;
  81      $html .= '</a>';
  82      
  83      return $html;
  84  }
  85  
  86  function smarty_cms_help_function_valid_css() 
  87  {
  88  ?>
  89  <h3>What does this do?</h3>
  90  <p>Returns a link to the w3c CSS validator.</p>
  91  <h3>How do I use it?</h3>
  92  <p>Just insert the tag into your template/page like: <code>{valid_css}</code></p>
  93  <h3>What parameters does it take?</h3>
  94  <p>
  95      <ul>
  96          <li><em>(optional)</em> url         (string)     - The URL used for validation, if none is given http://jigsaw.w3.org/css-validator/check/referer is used.</li>
  97      <li><em>(optional)</em> class       (string)     - If set, this will be used as class attribute for the link (a) element</li>
  98      <li><em>(optional)</em> target      (string)     - If set, this will be used as target attribute for the link (a) element</li>
  99      <li><em>(optional)</em> image       (true/false) - If set to false, a text link will be used instead of an image/icon.</li>
 100      <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 CSS 2.1'.<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>
 101      <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>
 102          <li><em>(optional)</em> src         (string)     - Only if 'image' is not set to false. The icon to show. Default is http://jigsaw.w3.org/css-validator/images/vcss</li>
 103          <li><em>(optional)</em> width       (string)     - Only if 'image' is not set to false. The image width. Default is 88 (width of http://jigsaw.w3.org/css-validator/images/vcss)</li>
 104          <li><em>(optional)</em> height      (string)     - Only if 'image' is not set to false. The image height. Default is 31 (height of http://jigsaw.w3.org/css-validator/images/vcss)</li>
 105      <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>
 106      </ul>
 107  </p>
 108  <?php
 109  }
 110  
 111  function smarty_cms_about_function_valid_css() 
 112  {
 113  ?>
 114  <p>Author: Tatu Wikman&lt;tatu.wikman[at]gmail.com&gt;</p>
 115  <p>Version: 1.0</p>
 116  <p>
 117      Change History:<br/>
 118      None
 119  </p>
 120  <p>Thanks go to Dick Ittmann for valid_xhtml tag which is used as a base for this tag</p>
 121  <?php
 122  }
 123  ?>


Généré le : Tue Apr 3 18:50:37 2007 par Balluche grâce à PHPXref 0.7