[ Index ]
 

Code source de e107 0.7.8

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

title

Body

[fermer]

/e107_handlers/ -> popup_handler.php (source)

   1  <?php
   2  /*
   3  +---------------------------------------------------------------+
   4  |        e107 website system
   5  |
   6  |        ©Steve Dunstan 2001-2002
   7  |        http://e107.org
   8  |        jalist@e107.org
   9  |
  10  |        Released under the terms and conditions of the
  11  |        GNU General Public License (http://gnu.org).
  12  |
  13  |        $Source: /cvsroot/e107/e107_0.7/e107_handlers/popup_handler.php,v $
  14  |        $Revision: 1.6 $
  15  |        $Date: 2006/11/09 09:37:11 $
  16  |        $Author: lisa_ $
  17  +---------------------------------------------------------------+
  18  */
  19  
  20  if (!defined('e107_INIT')) { exit; }
  21  
  22  class popup{
  23  
  24      // usage:
  25      // you need to add the following call to popup.js in a headerjs function
  26      //
  27      // function headerjs(){
  28      // echo "<script type='text/javascript' src='".e_FILE."popup.js'></script>\n";
  29      // }
  30      // on the page where you want to popup image to appear,
  31      // you need to include this class and create a new object for it:
  32      // require_once(e_HANDLER."popup_handler.php");
  33      // $pp = new popup;
  34      // then you need to prepare the right paramater in the function call.
  35      // the function returns the image with the popup link as a href on it
  36      // clicking the popup will use the js functions in the included js file to popup the image
  37      // $pp -> popup($oSrc, $oSrcThumb, $oIconWidth, $oMaxWidth, $oTitle, $oText)
  38  
  39  	function popup($image, $thumb, $iconwidth='100', $maxwidth='', $title, $text){
  40              global $tp;
  41              //$image    :    full path to the large image you want to popup
  42              //$thumb    :    full path to the small image to show on screen
  43              //$maxwidth    :    the maximum size (width or height) an image may be popup'ed
  44              //$title    :    the window title of the popup
  45              //$text        :    the additional text to add into the popup
  46  
  47              if(file_exists($image)){
  48                  
  49                  //use $image if $thumb doesn't exist
  50                  if(!file_exists($thumb)){
  51                      $thumb = $image;
  52                  }
  53                  $imagearray = getimagesize(trim($image));
  54                  //$imagearray holds width and height parameters of the image
  55                  //$imagearray[0] is width - $imagearray[1] is height
  56  
  57                  if($imagearray[1] > $imagearray[0]){
  58                      if(isset($maxwidth) && $maxwidth!='' && $imagearray[1] > $maxwidth){
  59                          $width        = round(($maxwidth*$imagearray[0])/$imagearray[1],0);
  60                          $height        = $maxwidth;
  61                      }else{
  62                          $width        = $imagearray[0];
  63                          $height        = $imagearray[1];
  64                      }
  65                  }else{
  66                      if(isset($maxwidth) && $maxwidth!='' && $imagearray[0] > $maxwidth){
  67                          $width        = $maxwidth;
  68                          $height        = round(($maxwidth*$imagearray[1])/$imagearray[0],0);
  69                      }else{
  70                          $width        = $imagearray[0];
  71                          $height        = $imagearray[1];
  72                      }
  73                  }
  74                  $iconwidth = ($title == "help" ? "" : ($iconwidth ? "width:".intval($iconwidth)."px;" : "width:100px;") );
  75  
  76                  $width        = intval($width);
  77                  $search        = array("'", '$', '"', '&#036;','&#039;', '&#092;');
  78                  $replace    = array("\'", '\$', '&quot;', '\$', "\'", '\\');
  79                  $title        = str_replace($search, $replace, $title);
  80                  $text        = str_replace($search, $replace, $text);
  81  
  82                  $popup = "<a href='javascript:void(0);' onclick=\"javascript:openPerfectPopup('".$image."',".$width.",'".$title."','".$text."')\" style='cursor:pointer;' onmouseover=\"window.status='".POPUP_LAN_1."'; return true;\" onmouseout=\"window.status=''; return true;\" ><img src='".$thumb."' style='".$iconwidth."' alt='' /></a><br /><br />";
  83  
  84              }else{
  85                  $popup = "";
  86              }
  87              return $popup;
  88      }
  89  }
  90  
  91  ?>


Généré le : Sun Apr 1 01:23:32 2007 par Balluche grâce à PHPXref 0.7