[(#LOGO_SITE_SPIP||image_reduire{150,100}) ]
#NOM_SITE_SPIP
[(#CHEMIN{images/thickbox.png}||image_reduire{150,100})] Thickbox v3
by
Version 3 (stable) - (c) 2009 GNU GPL v3
[ thickbox : <:phpdoc:map:> | <:phpdoc:index:> ]

<:phpdoc:source_file_for:> 'Balise generale'

  <:phpdoc:back_to_doc:> : Balise generale

  1. <?php
  2. /**
  3.  * @name         Balise generale
  4.  * @author         Piero Wbmstr <@link piero.wbmstr@gmail.com>
  5.  * @copyright     CreaDesign 2009 {@link http://creadesignweb.free.fr/}
  6.  * @license        http://opensource.org/licenses/gpl-license.php GNU Public License
  7.  * @version     0.2 (06/2009)
  8.  * @package        thickbox
  9.  * @subpackage    Balises
  10.  *
  11.  *  BASED ON :
  12.  *  - Thickbox 3.1 - One Box To Rule Them All.
  13.  *    By Cody Lindley (http://www.codylindley.com)
  14.  *    Copyright (c) 2007 cody lindley - MIT License
  15.  *
  16.  *  - plugin SPIP 'Thickbox 2'
  17.  *    By Fil, Izo, BoOz (http://spip-zone.info/spip.php?article31)
  18.  */
  19. if (!defined("_ECRIRE_INC_VERSION")) return;
  20.  
  21. function balise_THICKBOX($p{
  22.     return calculer_balise_dynamique($pthickboxarray());
  23. }
  24.  
  25. function balise_thickbox_dyn($_type$_url$title=''$text=''$_width=false$_height=false$mode=''$id=''$add_class=''{
  26.     global $div$img$tb_conf$str_href$str_titre$str_class$str_input$str_dim_img$str_rel$str_frame$str_dialogbox$modal$nomodal$frame$noframe$inline$titre$width$height;
  27.     $tb_conf thickbox_config();
  28.     $str_class " class='thickbox".(($add_class AND strlen($add_class)) ' '.$add_class '')."'";
  29.     $str_frame "&amp;KeepThis=true&amp;TB_iframe=true";
  30.     $str_input " type='button'";
  31.     $str_dialogbox "page=".strlen($tb_conf['dialogbox_url']substr($tb_conf['dialogbox_url']0strrpos($tb_conf['dialogbox_url']'.')) substr($GLOBALS['THICKBOX_DEFAULTS']['dialogbox_url']0strrpos($GLOBALS['THICKBOX_DEFAULTS']['dialogbox_url']'.')) )."&amp;";
  32.  
  33.     $modes explode(';'$mode);
  34.     $modal in_array('modal'$modestrue:false;
  35.     $nomodal in_array('nomodal'$modestrue:false;
  36.     $frame in_array('frame'$modestrue:false;
  37.     $noframe in_array('noframe'$modestrue:false;
  38.     $inline in_array('inline'$modestrue:false;
  39.     $type $_type $_type 'link';
  40.     $img in_array($typearray('image','gallery')) true:false;
  41.  
  42.     if($type == 'dialogbox'$url $GLOBALS['meta']['adresse_site'].'/?'.$str_dialogbox.$_url;
  43.     else {
  44. //        $url = (eregi("^http://[_A-Z0-9-]+\.[_A-Z0-9-]+[.A-Z0-9-]*(/~|/?)[/_.A-Z0-9#?&=+-]*$", $_url) 
  45.         $url (preg_match("/^[http|https]+[:\/\/]+[A-Za-z0-9\-_]+\\.+[A-Za-z0-9\.\/%&=\?\-_]+$/i"$_url)
  46.             OR substr_count($_url':8888') ) 
  47.             $_url 
  48.             : 
  49. //            ( eregi("[/_.A-Z0-9-]*[_.A-Z0-9-]+\.(jpg|gif|png|jpeg|html)$", $_url) ?
  50.             preg_match("/[A-Za-z0-9\-_]+\.(jpg|gif|png|jpeg|html)$/i"$_url?
  51.                 $GLOBALS['meta']['adresse_site'].'/'.$_url
  52.                 :
  53.                 strlen($_url&& ($_url[0== '?'
  54.                     $GLOBALS['meta']['adresse_site'].'/'.$_url 
  55.                     : 
  56.                     $GLOBALS['meta']['adresse_site'].'/?'.$_url 
  57.                 )
  58.             );
  59.     }
  60.     if($img{
  61.         $file tb_cut_filename($url);
  62.         $width $_width intval($_width$tb_conf['option_width_img'intval($tb_conf['option_width_img']$GLOBALS['THICKBOX_DEFAULTS']['option_width_img']);
  63.         $height $_height intval($_height$tb_conf['option_height_img'intval($tb_conf['option_height_img']$GLOBALS['THICKBOX_DEFAULTS']['option_height_img']);
  64.         $titre ($title!=''$title $file['name'];
  65.     }
  66.     else {
  67.         if($type == 'dialogbox'{
  68.             $width $_width intval($_width$tb_conf['option_width_db'intval($tb_conf['option_width_db']$GLOBALS['THICKBOX_DEFAULTS']['option_width_db']);
  69.             $height $_height intval($_height$tb_conf['option_height_db'intval($tb_conf['option_height_db']$GLOBALS['THICKBOX_DEFAULTS']['option_height_db']);
  70.         }
  71.         else {
  72.             $width $_width intval($_width$tb_conf['option_width'intval($tb_conf['option_width']$GLOBALS['THICKBOX_DEFAULTS']['option_width']);
  73.             $height $_height intval($_height$tb_conf['option_height'intval($tb_conf['option_height']$GLOBALS['THICKBOX_DEFAULTS']['option_height']);
  74.         }
  75.         $titre ($title!=''$title strlen($tb_conf['titre_default']$tb_conf['titre_default'false);
  76.     }
  77.     $str_titre (strlen($titre)) " title='".$titre."'" false;
  78.  
  79.     if($inline AND $id!=''$str_href '\#TB_inline?';
  80.     else $str_href $url;
  81.     if($frame OR ($type == 'dialogbox' AND !$noframe)) $str_href .= $str_frame;
  82.     if($img{
  83.         if($file['width'$file['height']){
  84.             $str_dim_img " width='".$width."px' height='".intval(($file['height']*$height)/$file['width'])."px'";
  85.         }
  86.         else{
  87.             $str_dim_img " width='".intval(($file['width']*$width)/$file['height'])."px' height='".$height."px'";
  88.         }
  89.     }
  90.     else $str_href .= '&amp;width='.$width.'&amp;height='.$height;
  91.     if($modal OR ($type == 'dialogbox' AND !$nomodal)) $str_href .= '&amp;modal=true';
  92.     if($inline AND $id!=''$str_href .= '&amp;inlineId='.$id;
  93.  
  94.     switch ($type{
  95.         case 'link' 
  96.             $div sprintf("<a href='%s' %s>%s</a>"$str_href$str_class.$str_titre$text);
  97.             break;
  98.         case 'input' :
  99.             $div sprintf("<input alt='%s' %s value='%s' />"$str_href$str_input.$options.$str_class.$str_titre$text);
  100.             break;
  101.         case 'image' :
  102.             $div sprintf("<a href='%s' type='%s' %s><img src='%s' %s /></a>"$str_href$file['mime']$str_titre$str_href$str_dim_img);
  103.             break;
  104.         case 'gallery' :
  105.             static $gal_id;
  106.             if (!isset($gal_id)) $gal_id uniqid();
  107.             if (!strlen($text)) $text $gal_id;
  108.             $str_rel " rel='gallery-".$text."'";
  109.             $div sprintf("<a href='%s' type='%s' %s><img src='%s' %s /></a>"$str_href$file['mime']$str_rel.$str_titre$str_href$str_dim_img);
  110.             break;
  111.         case 'dialogbox' :
  112.             $div sprintf("<a href='%s' %s>%s</a>"$str_href$str_class.$str_titre$text);
  113.             break;
  114.         case 'url' :
  115.             $div sprintf("'%s' %s"$str_href$str_class.$str_titre);
  116.             break;
  117.     }
  118.  
  119.     echo $div;
  120. }
  121. ?>

PhpDoc phpDocumentor 1.4.1
| <:phpdoc:date_generation:>
| Mon, 28 Feb 2011 12:54:17 +0100

CreaDesign Crea Design
 | PhpDocumentor plugin pour SPIP
 | version 1.0.09 (c) 08/2009

| SPIP | <:accueil_site:> | <:espace_prive:> | <:phpdoc:accueil_doc:> Thickbox v3 |