[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/administrator/components/com_media/tmpl/media/ -> default.php (source)

   1  <?php
   2  /**
   3   * @package     Joomla.Administrator
   4   * @subpackage  com_media
   5   *
   6   * @copyright   (C) 2007 Open Source Matters, Inc. <https://www.joomla.org>
   7   * @license     GNU General Public License version 2 or later; see LICENSE.txt
   8   */
   9  defined('_JEXEC') or die;
  10  
  11  use Joomla\CMS\Component\ComponentHelper;
  12  use Joomla\CMS\Factory;
  13  use Joomla\CMS\Session\Session;
  14  use Joomla\CMS\Toolbar\Toolbar;
  15  use Joomla\CMS\Uri\Uri;
  16  
  17  $app    = Factory::getApplication();
  18  $params = ComponentHelper::getParams('com_media');
  19  $input  = $app->input;
  20  $user   = $app->getIdentity();
  21  
  22  /** @var Joomla\CMS\WebAsset\WebAssetManager $wa */
  23  $wa = $this->document->getWebAssetManager();
  24  $wa->useScript('keepalive')
  25      ->useStyle('com_media.mediamanager')
  26      ->useScript('com_media.mediamanager');
  27  
  28  // Populate the language
  29  $this->loadTemplate('texts');
  30  
  31  $tmpl = $input->getCmd('tmpl');
  32  
  33  // Load the toolbar when we are in an iframe
  34  if ($tmpl === 'component')
  35  {
  36      echo '<div class="subhead noshadow">';
  37      echo Toolbar::getInstance('toolbar')->render();
  38      echo '</div>';
  39  }
  40  
  41  $mediaTypes = '&mediatypes=' . $input->getString('mediatypes', '0,1,2,3');
  42  
  43  // Populate the media config
  44  $config = [
  45      'apiBaseUrl'          => Uri::base() . 'index.php?option=com_media&format=json' . $mediaTypes,
  46      'csrfToken'           => Session::getFormToken(),
  47      'filePath'            => $params->get('file_path', 'images'),
  48      'fileBaseUrl'         => Uri::root() . $params->get('file_path', 'images'),
  49      'fileBaseRelativeUrl' => $params->get('file_path', 'images'),
  50      'editViewUrl'         => Uri::base() . 'index.php?option=com_media&view=file' . ($tmpl ? '&tmpl=' . $tmpl : '')  . $mediaTypes,
  51      'imagesExtensions'    => array_map('trim', explode(',', $params->get('image_extensions', 'bmp,gif,jpg,jpeg,png,webp'))),
  52      'audioExtensions'     => array_map('trim', explode(',', $params->get('audio_extensions', 'mp3,m4a,mp4a,ogg'))),
  53      'videoExtensions'     => array_map('trim', explode(',', $params->get('video_extensions', 'mp4,mp4v,mpeg,mov,webm'))),
  54      'documentExtensions'  => array_map('trim', explode(',', $params->get('doc_extensions', 'doc,odg,odp,ods,odt,pdf,ppt,txt,xcf,xls,csv'))),
  55      'maxUploadSizeMb'     => $params->get('upload_maxsize', 10),
  56      'providers'           => (array) $this->providers,
  57      'currentPath'         => $this->currentPath,
  58      'isModal'             => $tmpl === 'component',
  59      'canCreate'           => $user->authorise('core.create', 'com_media'),
  60      'canEdit'             => $user->authorise('core.edit', 'com_media'),
  61      'canDelete'           => $user->authorise('core.delete', 'com_media'),
  62  ];
  63  $this->document->addScriptOptions('com_media', $config);
  64  ?>
  65  <div id="com-media"></div>


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