[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/modules/mod_wrapper/src/Helper/ -> WrapperHelper.php (source)

   1  <?php
   2  
   3  /**
   4   * @package     Joomla.Site
   5   * @subpackage  mod_wrapper
   6   *
   7   * @copyright   (C) 2006 Open Source Matters, Inc. <https://www.joomla.org>
   8   * @license     GNU General Public License version 2 or later; see LICENSE.txt
   9   */
  10  
  11  namespace Joomla\Module\Wrapper\Site\Helper;
  12  
  13  use Joomla\CMS\Factory;
  14  
  15  // phpcs:disable PSR1.Files.SideEffects
  16  \defined('_JEXEC') or die;
  17  // phpcs:enable PSR1.Files.SideEffects
  18  
  19  /**
  20   * Helper for mod_wrapper
  21   *
  22   * @since  1.5
  23   */
  24  class WrapperHelper
  25  {
  26      /**
  27       * Gets the parameters for the wrapper
  28       *
  29       * @param   mixed  &$params  The parameters set in the administrator section
  30       *
  31       * @return  mixed  &$params  The modified parameters
  32       *
  33       * @since   1.5
  34       */
  35      public static function getParams(&$params)
  36      {
  37          $params->def('url', '');
  38          $params->def('scrolling', 'auto');
  39          $params->def('height', '200');
  40          $params->def('height_auto', 0);
  41          $params->def('width', '100%');
  42          $params->def('add', 1);
  43          $params->def('name', 'wrapper');
  44  
  45          $url = $params->get('url');
  46  
  47          if ($params->get('add')) {
  48              // Adds 'http://' if none is set
  49              if (strpos($url, '/') === 0) {
  50                  // Relative URL in component. use server http_host.
  51                  $url = 'http://' . Factory::getApplication()->input->server->get('HTTP_HOST') . $url;
  52              } elseif (strpos($url, 'http') === false && strpos($url, 'https') === false) {
  53                  $url = 'http://' . $url;
  54              }
  55          }
  56  
  57          $load = '';
  58  
  59          // Auto height control
  60          if ($params->def('height_auto')) {
  61              $load = 'onload="iFrameHeight(this)"';
  62          }
  63  
  64          $params->set('load', $load);
  65          $params->set('url', $url);
  66  
  67          return $params;
  68      }
  69  }


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer