PageRenderTime 59ms CodeModel.GetById 29ms RepoModel.GetById 0ms app.codeStats 0ms

/typo3/sysext/rtehtmlarea/mod4/select_image.php

https://bitbucket.org/linxpinx/mercurial
PHP | 118 lines | 56 code | 7 blank | 55 comment | 9 complexity | fc8b139241d60eab1213bce7c0288fde MD5 | raw file
Possible License(s): BSD-3-Clause, GPL-2.0, Unlicense, LGPL-2.1, Apache-2.0
  1. <?php
  2. /***************************************************************
  3. * Copyright notice
  4. *
  5. * (c) 1999-2010 Kasper Skaarhoj (kasper@typo3.com)
  6. * (c) 2004-2010 Stanislas Rolland <typo3(arobas)jbr.ca>
  7. * All rights reserved
  8. *
  9. * This script is part of the TYPO3 project. The TYPO3 project is
  10. * free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License as published by
  12. * the Free Software Foundation; either version 2 of the License, or
  13. * (at your option) any later version.
  14. *
  15. * The GNU General Public License can be found at
  16. * http://www.gnu.org/copyleft/gpl.html.
  17. * A copy is found in the textfile GPL.txt and important notices to the license
  18. * from the author is found in LICENSE.txt distributed with these scripts.
  19. *
  20. *
  21. * This script is distributed in the hope that it will be useful,
  22. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  23. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  24. * GNU General Public License for more details.
  25. *
  26. * This copyright notice MUST APPEAR in all copies of the script!
  27. ***************************************************************/
  28. /**
  29. * Displays image selector for the RTE
  30. *
  31. * @author Kasper Skaarhoj <kasper@typo3.com>
  32. * @author Stanislas Rolland <typo3(arobas)jbr.ca>
  33. *
  34. * $Id: select_image.php 7905 2010-06-13 14:42:33Z ohader $ *
  35. */
  36. error_reporting (E_ALL ^ E_NOTICE);
  37. unset($MCONF);
  38. require('conf.php');
  39. require($BACK_PATH.'init.php');
  40. require($BACK_PATH.'template.php');
  41. require_once('class.tx_rtehtmlarea_select_image.php');
  42. $LANG->includeLLFile('EXT:lang/locallang_browse_links.xml');
  43. $LANG->includeLLFile('EXT:rtehtmlarea/mod4/locallang.xml');
  44. $LANG->includeLLFile('EXT:rtehtmlarea/htmlarea/locallang_dialogs.xml');
  45. /**
  46. * Script class for the Element Browser window.
  47. *
  48. * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
  49. * @package TYPO3
  50. * @subpackage core
  51. */
  52. class tx_rtehtmlarea_SC_select_image {
  53. public $mode = 'rte';
  54. public $button = 'image';
  55. protected $content = '';
  56. /**
  57. * Main function, rendering the element browser in RTE mode.
  58. *
  59. * @return void
  60. */
  61. function main() {
  62. // Setting alternative browsing mounts (ONLY local to browse_links.php this script so they stay "read-only")
  63. $altMountPoints = trim($GLOBALS['BE_USER']->getTSConfigVal('options.folderTree.altElementBrowserMountPoints'));
  64. if ($altMountPoints) {
  65. $altMountPoints = t3lib_div::trimExplode(',', $altMountPoints);
  66. foreach ($altMountPoints as $filePathRelativeToFileadmindir) {
  67. $GLOBALS['BE_USER']->addFileMount('', $filePathRelativeToFileadmindir, $filePathRelativeToFileadmindir, 1, 'readonly');
  68. }
  69. $GLOBALS['FILEMOUNTS'] = $GLOBALS['BE_USER']->returnFilemounts();
  70. }
  71. // Rendering type by user function
  72. $browserRendered = false;
  73. if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/browse_links.php']['browserRendering'])) {
  74. foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/browse_links.php']['browserRendering'] as $classRef) {
  75. $browserRenderObj = t3lib_div::getUserObj($classRef);
  76. if (is_object($browserRenderObj) && method_exists($browserRenderObj, 'isValid') && method_exists($browserRenderObj, 'render')) {
  77. if ($browserRenderObj->isValid($this->mode, $this)) {
  78. $this->content .= $browserRenderObj->render($this->mode, $this);
  79. $browserRendered = true;
  80. break;
  81. }
  82. }
  83. }
  84. }
  85. // If type was not rendered, use default rendering functions
  86. if (!$browserRendered) {
  87. $GLOBALS['SOBE']->browser = t3lib_div::makeInstance('tx_rtehtmlarea_select_image');
  88. $GLOBALS['SOBE']->browser->init();
  89. $modData = $GLOBALS['BE_USER']->getModuleData('select_image.php','ses');
  90. list($modData, $store) = $GLOBALS['SOBE']->browser->processSessionData($modData);
  91. $GLOBALS['BE_USER']->pushModuleData('select_image.php',$modData);
  92. $this->content = $GLOBALS['SOBE']->browser->main_rte();
  93. }
  94. }
  95. /**
  96. * Print module content
  97. *
  98. * @return void
  99. */
  100. function printContent() {
  101. echo $this->content;
  102. }
  103. }
  104. if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/mod4/select_image.php']) {
  105. include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/rtehtmlarea/mod4/select_image.php']);
  106. }
  107. // Make instance:
  108. $SOBE = t3lib_div::makeInstance('tx_rtehtmlarea_SC_select_image');
  109. $SOBE->main();
  110. $SOBE->printContent();
  111. ?>