[ Index ]
 

Code source de Joomla 1.0.13

Accédez au Source d'autres logiciels libres

title

Body

[fermer]

/modules/ -> mod_wrapper.php (source)

   1  <?php
   2  /**
   3  * @version $Id: mod_wrapper.php 5752 2006-11-13 00:17:30Z friesengeist $
   4  * @package Joomla_1.0.0
   5  * @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
   6  * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
   7  * Joomla! is free software. This version may have been modified pursuant
   8  * to the GNU General Public License, and as distributed it includes or
   9  * is derivative of works licensed under the GNU General Public License or
  10  * other free or open source software licenses.
  11  * See COPYRIGHT.php for copyright notices and details.
  12  */
  13  
  14  // no direct access
  15  defined( '_VALID_MOS' ) or die( 'Restricted access' );
  16  
  17  global $mod_wrapper_count;
  18  
  19  $params->def( 'url', '' );
  20  $params->def( 'scrolling', 'auto' );
  21  $params->def( 'height', '200' );
  22  $params->def( 'height_auto', '0' );
  23  $params->def( 'width', '100%' );
  24  $params->def( 'add', '1' );
  25  
  26  $url = $params->get( 'url' );
  27  if ( $params->get( 'add' ) ) {
  28      // adds 'http://' if none is set
  29      if ( substr( $url, 0, 1 ) == '/' ) {
  30          // relative url in component. use server http_host.
  31          $url = 'http://'. $_SERVER['HTTP_HOST'] . $url;
  32      } elseif ( !strstr( $url, 'http' ) && !strstr( $url, 'https' ) ) {
  33          $url = 'http://'. $url;
  34      } else {
  35          $url = $url;
  36      }
  37  }
  38  
  39  // Create a unique ID for the IFrame, output the javascript function only once
  40  if (!isset( $mod_wrapper_count )) {
  41      $mod_wrapper_count = 0;
  42      ?>
  43  <script language="javascript" type="text/javascript">
  44  function iFrameHeightX( iFrameId ) {
  45      var h = 0;
  46      if ( !document.all ) {
  47          h = document.getElementById(iFrameId).contentDocument.height;
  48          document.getElementById(iFrameId).style.height = h + 60 + 'px';
  49      } else if( document.all ) {
  50          h = document.frames(iFrameId).document.body.scrollHeight;
  51          document.all[iFrameId].style.height = h + 20 + 'px';
  52      }
  53  }
  54  </script>
  55      <?php
  56  }
  57  
  58  // auto height control
  59  if ( $params->def( 'height_auto' ) ) {
  60      $load = 'onload="iFrameHeightX(\'blockrandom' . $mod_wrapper_count . '\')" ';
  61  } else {
  62      $load = '';
  63  }
  64  ?>
  65  <iframe
  66  <?php echo $load; ?>
  67  id="blockrandom<?php echo $mod_wrapper_count++; ?>"
  68  src="<?php echo $url; ?>"
  69  width="<?php echo $params->get( 'width' ); ?>"
  70  height="<?php echo $params->get( 'height' ); ?>"
  71  scrolling="<?php echo $params->get( 'scrolling' ); ?>"
  72  align="top"
  73  frameborder="0"
  74  class="wrapper<?php echo $params->get( 'moduleclass_sfx' ); ?>">
  75  <?php echo _CMN_IFRAMES; ?>
  76  </iframe>


Généré le : Wed Nov 21 14:43:32 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics