Commit e1e87b19 by Stefan Galinski

Merge branch 'master' into 'master'

TYPO3 CMS 7.6 compatibility

A working version for TYPO3 CMS 7.6.x
CMS 6.2.x needs to be tested

See merge request !1
parents f42217fe 3571b3f7
......@@ -72,21 +72,21 @@ class tx_pmkshadowbox_build {
* @throws Exception
*/
public function __construct($cacheHandler = NULL) {
$this->cObj = t3lib_div::makeInstance('tslib_cObj');
$this->sourceDirectory = t3lib_extMgm::siteRelPath('pmkshadowbox') . 'resources/shadowbox/source/';
$this->cObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\ContentObject\\ContentObjectRenderer');
$this->sourceDirectory = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath('pmkshadowbox') . 'resources/shadowbox/source/';
$this->extensionConfiguration = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['pmkshadowbox']);
if ($cacheHandler === NULL) {
try {
$this->cacheHandler = t3lib_div::makeInstance(
$this->cacheHandler = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
'tx_pmkshadowbox_cache',
'typo3temp/pmkshadowbox/'
);
} catch (Exception $exception) {
t3lib_div::sysLog(
\TYPO3\CMS\Core\Utility\GeneralUtility::sysLog(
$exception->getMessage(),
'pmkshadowbox',
t3lib_div::SYSLOG_SEVERITY_ERROR
\TYPO3\CMS\Core\Utility\GeneralUtility::SYSLOG_SEVERITY_ERROR
);
throw $exception;
}
......@@ -122,7 +122,7 @@ class tx_pmkshadowbox_build {
*/
protected function applyStdWrapOn(array $configuration) {
if (!is_object($GLOBALS['TSFE'])) {
$GLOBALS['TSFE'] = t3lib_div::makeInstance('tslib_fe', array(), 0, 0);
$GLOBALS['TSFE'] = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Frontend\\Controller\\TypoScriptFrontendController', array(), 0, 0);
}
$newConfiguration = array();
......@@ -228,7 +228,7 @@ class tx_pmkshadowbox_build {
* @return string
*/
protected function getSkinModificationDirectory($typo3SkinModificationDirectory) {
$skinModificationDirectory = t3lib_div::getFileAbsFileName($typo3SkinModificationDirectory);
$skinModificationDirectory = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($typo3SkinModificationDirectory);
if (is_dir($skinModificationDirectory)) {
$skinModificationDirectory = str_replace(PATH_site, '', $skinModificationDirectory);
} else {
......@@ -247,7 +247,7 @@ class tx_pmkshadowbox_build {
* @return string
*/
protected function getFlashPlayer($flashPlayer) {
$flashPlayer = t3lib_div::getFileAbsFileName($flashPlayer);
$flashPlayer = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($flashPlayer);
if (file_exists($flashPlayer)) {
$flashPlayer = str_replace(PATH_site, '', $flashPlayer);
} else {
......@@ -266,7 +266,7 @@ class tx_pmkshadowbox_build {
* @return string
*/
protected function getFlashPlayerYT($flashPlayerYT) {
$flashPlayerYT = t3lib_div::getFileAbsFileName($flashPlayerYT);
$flashPlayerYT = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($flashPlayerYT);
if (file_exists($flashPlayerYT)) {
$flashPlayerYT = str_replace(PATH_site, '', $flashPlayerYT);
} else {
......@@ -285,7 +285,7 @@ class tx_pmkshadowbox_build {
* @return string
*/
protected function getFlashExpressInstallScript($flashExpressInstallScript) {
$flashExpressInstallScript = t3lib_div::getFileAbsFileName($flashExpressInstallScript);
$flashExpressInstallScript = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName($flashExpressInstallScript);
if (file_exists($flashExpressInstallScript)) {
$flashExpressInstallScript = str_replace(PATH_site, '', $flashExpressInstallScript);
......@@ -355,7 +355,7 @@ class tx_pmkshadowbox_build {
foreach ($scripts as $script) {
if (($content = file_get_contents(PATH_site . $script)) === FALSE) {
$message = 'Could not read the source file: ' . PATH_site . $script;
t3lib_div::sysLog($message, 'pmkshadowbox', t3lib_div::SYSLOG_SEVERITY_ERROR);
\TYPO3\CMS\Core\Utility\GeneralUtility::sysLog($message, 'pmkshadowbox', \TYPO3\CMS\Core\Utility\GeneralUtility::SYSLOG_SEVERITY_ERROR);
throw new Exception($message);
}
$scriptContent .= $content;
......@@ -363,9 +363,9 @@ class tx_pmkshadowbox_build {
// the scriptmerger check prevents the minification of the script twice!
if ($this->extensionConfiguration['enableJavascriptMinification'] === '1' &&
!t3lib_extMgm::isLoaded('scriptmerger') && t3lib_div::compat_version('6.0')
!\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('scriptmerger') && \TYPO3\CMS\Core\Utility\GeneralUtility::compat_version('6.0')
) {
require_once(t3lib_extMgm::extPath('pmkshadowbox') . 'resources/jsmin.php');
require_once(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('pmkshadowbox') . 'resources/jsmin.php');
$scriptContent = JSMin::minify($scriptContent);
}
......@@ -501,7 +501,7 @@ class tx_pmkshadowbox_build {
)
);
return t3lib_div::removeArrayEntryByValue($scripts, '');
return \TYPO3\CMS\Core\Utility\GeneralUtility::removeArrayEntryByValue($scripts, '');
}
/**
......
......@@ -56,10 +56,10 @@ class tx_pmkshadowbox_cache {
public function __construct($cacheDirectory = 'typo3temp/pmkshadowbox/') {
$this->cacheDirectory = $cacheDirectory;
if (!is_dir(PATH_site . $this->cacheDirectory)) {
if (!t3lib_div::mkdir(PATH_site . $this->cacheDirectory)) {
if (!\TYPO3\CMS\Core\Utility\GeneralUtility::mkdir(PATH_site . $this->cacheDirectory)) {
$message = 'Cache directory "' . PATH_site . $this->cacheDirectory .
'" couldn\'t be created!';
t3lib_div::sysLog($message, 'pmkshadowbox', t3lib_div::SYSLOG_SEVERITY_ERROR);
\TYPO3\CMS\Core\Utility\GeneralUtility::sysLog($message, 'pmkshadowbox', \TYPO3\CMS\Core\Utility\GeneralUtility::SYSLOG_SEVERITY_ERROR);
throw new Exception($message);
}
}
......@@ -86,7 +86,7 @@ class tx_pmkshadowbox_cache {
$this->buildDirectory = $buildDirectory;
if (!is_dir(PATH_site . $this->cacheDirectory . $this->buildDirectory)) {
t3lib_div::mkdir(PATH_site . $this->cacheDirectory . $this->buildDirectory);
\TYPO3\CMS\Core\Utility\GeneralUtility::mkdir(PATH_site . $this->cacheDirectory . $this->buildDirectory);
}
}
......@@ -113,7 +113,7 @@ class tx_pmkshadowbox_cache {
if (unlink($cacheFileInfo->getPathname()) === FALSE) {
$message = 'cache->clear(): File "' .
$cacheFileInfo->getPathname() . '" couldn\'t be removed!';
t3lib_div::sysLog($message, 'pmkshadowbox', t3lib_div::SYSLOG_SEVERITY_ERROR);
\TYPO3\CMS\Core\Utility\GeneralUtility::sysLog($message, 'pmkshadowbox', \TYPO3\CMS\Core\Utility\GeneralUtility::SYSLOG_SEVERITY_ERROR);
throw new Exception($message);
}
}
......@@ -121,7 +121,7 @@ class tx_pmkshadowbox_cache {
if (rmdir($fileInfo->getPathname()) === FALSE) {
$message = 'cache->clear(): Build directory "' .
$fileInfo->getPathname() . '" couldn\'t be removed!';
t3lib_div::sysLog($message, 'pmkshadowbox', t3lib_div::SYSLOG_SEVERITY_ERROR);
\TYPO3\CMS\Core\Utility\GeneralUtility::sysLog($message, 'pmkshadowbox', \TYPO3\CMS\Core\Utility\GeneralUtility::SYSLOG_SEVERITY_ERROR);
throw new Exception($message);
}
}
......@@ -137,9 +137,9 @@ class tx_pmkshadowbox_cache {
*/
public function writeCacheFile($scriptName, $scriptContent) {
$script = $this->cacheDirectory . $this->buildDirectory . $scriptName;
if (t3lib_div::writeFile(PATH_site . $script, $scriptContent) === FALSE) {
if (\TYPO3\CMS\Core\Utility\GeneralUtility::writeFile(PATH_site . $script, $scriptContent) === FALSE) {
$message = 'cache->writeCacheFile: Could not write the script file: ' . $script;
t3lib_div::sysLog($message, 'pmkshadowbox', t3lib_div::SYSLOG_SEVERITY_ERROR);
\TYPO3\CMS\Core\Utility\GeneralUtility::sysLog($message, 'pmkshadowbox', \TYPO3\CMS\Core\Utility\GeneralUtility::SYSLOG_SEVERITY_ERROR);
throw new Exception($message);
}
......@@ -164,7 +164,7 @@ class tx_pmkshadowbox_cache {
if (copy($resource, PATH_site . $destination) === FALSE) {
$message = 'cache->copyResourceFile: Resource "' .
$resource . '" couldn\'t be copied!';
t3lib_div::sysLog($message, 'pmkshadowbox', t3lib_div::SYSLOG_SEVERITY_ERROR);
\TYPO3\CMS\Core\Utility\GeneralUtility::sysLog($message, 'pmkshadowbox', \TYPO3\CMS\Core\Utility\GeneralUtility::SYSLOG_SEVERITY_ERROR);
throw new Exception($message);
}
......
......@@ -26,10 +26,6 @@
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
if (!t3lib_div::compat_version('6.2.0')) {
require_once(PATH_typo3 . 'interfaces/interface.backend_cacheActionsHook.php');
}
/**
* Extending class to render the menu for the cache clearing actions,
* and adding Clear Shadowbox Builds option
......@@ -38,7 +34,7 @@ if (!t3lib_div::compat_version('6.2.0')) {
* @package TYPO3
* @subpackage pmkshadowbox
*/
class tx_pmkshadowbox_clearcachemenu implements backend_cacheActionsHook {
class tx_pmkshadowbox_clearcachemenu implements \TYPO3\CMS\Backend\Toolbar\ClearCacheActionsHookInterface {
/**
* Adds a new entry to the cache menu items array
*
......@@ -57,7 +53,7 @@ class tx_pmkshadowbox_clearcachemenu implements backend_cacheActionsHook {
'id' => 'clearShadowboxBuilds',
'title' => $title,
'href' => $GLOBALS['BACK_PATH'] . 'ajax.php?ajaxID=pmkshadowbox::clearShadowboxBuilds',
'icon' => '<img src="' . t3lib_extMgm::extRelPath('pmkshadowbox') .
'icon' => '<img src="' . \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('pmkshadowbox') .
'ext_icon.gif" width="16" height="16" title="' . htmlspecialchars($title) . '" alt="" />'
);
......
......@@ -36,9 +36,9 @@ class tx_pmkshadowbox_printsave {
* @return void
*/
public function main() {
$image = $this->cleanGPValue(t3lib_div::_GET('image'));
$image = $this->cleanGPValue(\TYPO3\CMS\Core\Utility\GeneralUtility::_GET('image'));
// Check if the requested file has an valid image file extension
$allowedExtensions = t3lib_div::trimExplode(
$allowedExtensions = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(
',', (strlen(
$GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']
) > 0 ? $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'] : 'gif,jpg,jpeg,tif,bmp,pcx,tga,png,pdf,ai'), 1
......@@ -52,13 +52,13 @@ class tx_pmkshadowbox_printsave {
}
if (!is_file(
t3lib_div::getFileAbsFileName(str_replace(t3lib_div::getIndpEnv('TYPO3_SITE_URL'), '', $image))
\TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName(str_replace(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL'), '', $image))
)
) {
die('File not found!');
}
switch ($this->cleanGPValue(t3lib_div::_GET('mode'))) {
switch ($this->cleanGPValue(\TYPO3\CMS\Core\Utility\GeneralUtility::_GET('mode'))) {
case 'print':
$this->print_image($image);
break;
......@@ -103,7 +103,7 @@ class tx_pmkshadowbox_printsave {
* @return bool
*/
public function force_download($filename, $mimetype = '') {
$filename = str_replace(t3lib_div::getIndpEnv('TYPO3_SITE_URL'), PATH_site, $filename);
$filename = str_replace(\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL'), PATH_site, $filename);
if (!file_exists($filename)) {
return FALSE;
}
......@@ -206,7 +206,7 @@ if (defined(
}
// Make instance:
$output = t3lib_div::makeInstance('tx_pmkshadowbox_printsave');
$output = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_pmkshadowbox_printsave');
$output->main();
?>
\ No newline at end of file
......@@ -31,7 +31,7 @@
*
* @author Peter Klein <pmk@io.dk>
*/
class tx_ttnews_imageMarker extends tslib_pibase {
class tx_ttnews_imageMarker extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin {
/**
* Same as class name
*
......@@ -84,13 +84,9 @@ class tx_ttnews_imageMarker extends tslib_pibase {
*/
function makeImageMarkers($row, $lConf, $tt_news, &$parentMarkerArray) {
$imageNum = isset($lConf['imageCount']) ? $lConf['imageCount'] : 1;
if (class_exists('t3lib_utility_Math')) {
$imageNum = t3lib_utility_Math::forceIntegerInRange($imageNum, 0, 100);
} else {
$imageNum = t3lib_div::intInRange($imageNum, 0, 100);
}
$imageNum = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($imageNum, 0, 100);
$theImgCode = '';
$imgs = t3lib_div::trimExplode(',', $row['image'], 1);
$imgs = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $row['image'], 1);
$imgsCaptions = explode(chr(10), $row['imagecaption']);
$imgsAltTexts = explode(chr(10), $row['imagealttext']);
$imgsTitleTexts = explode(chr(10), $row['imagetitletext']);
......
<?php
$extensionPath = t3lib_extMgm::extPath('pmkshadowbox');
$extensionPath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('pmkshadowbox');
return array(
'tx_pmkshadowbox_cache' => $extensionPath . 'classes/class.tx_pmkshadowbox_cache.php',
'tx_pmkshadowbox_build' => $extensionPath . 'classes/class.tx_pmkshadowbox_build.php',
'tx_ttnews_imageMarker' => $extensionPath . 'classes/class.tx_ttnews_imageMarkerHook.php',
'tx_ttnews_imageMarkerHook' => $extensionPath . 'classes/class.tx_ttnews_imageMarkerHook.php',
'JSMin' => $extensionPath . 'resources/jsmin.php',
);
?>
\ No newline at end of file
......@@ -15,9 +15,9 @@ $EM_CONF[$_EXTKEY] = array(
'description' => 'Shadowbox is an online media viewer application (Lightbox) that supports all of the web\'s most popular media publishing formats. Shadowbox is written entirely in JavaScript and CSS and is highly customizable. Compatible with ALL JS Frameworks.',
'category' => 'fe',
'shy' => 0,
'version' => '3.4.0',
'version' => '3.5.0',
'dependencies' => '',
'conflicts' => 'kj_imagelightbox2,perfectlightbox,wsclicklightbox,ju_multibox,pmkslimbox,dam_ttnews',
'conflicts' => 'kj_imagelightbox2,perfectlightbox,wsclicklightbox,ju_multibox,pmkslimbox',
'priority' => '',
'loadOrder' => '',
'module' => '',
......@@ -36,7 +36,7 @@ $EM_CONF[$_EXTKEY] = array(
array (
'depends' =>
array (
'typo3' => '4.5.0-6.2.99',
'typo3' => '6.2.99-7.6.99',
'php' => '5.3.0-5.5.99',
),
'conflicts' =>
......
......@@ -9,7 +9,7 @@ $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['clea
'EXT:pmkshadowbox/classes/class.tx_pmkshadowbox_cache.php:&tx_pmkshadowbox_cache->clearCachePostProc';
// Hook for adding "IMAGE_NUM_CURRENT" register value in tt_news
if (t3lib_extMgm::isLoaded('tt_news')) {
if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('tt_news')) {
$TYPO3_CONF_VARS['EXTCONF']['tt_news']['extraItemMarkerHook'][] =
'EXT:pmkshadowbox/classes/class.tx_ttnews_imageMarkerHook.php:&tx_ttnews_imageMarker';
}
......
......@@ -4,19 +4,19 @@ if (!defined('TYPO3_MODE')) {
die ('Access denied.');
}
t3lib_extMgm::addStaticFile('pmkshadowbox', 'static/PMK_Shadowbox/', 'Shadowbox - Base');
t3lib_extMgm::addStaticFile(
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile('pmkshadowbox', 'static/PMK_Shadowbox/', 'Shadowbox - Base');
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile(
'pmkshadowbox', 'static/PMK_Shadowbox_ClickEnlarge/', 'Shadowbox - tt_content (Click Enlarge)'
);
t3lib_extMgm::addStaticFile(
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile(
'pmkshadowbox', 'static/PMK_Shadowbox_CloudZoom/', 'Shadowbox - tt_content (Cloud Zoom)'
);
t3lib_extMgm::addStaticFile('pmkshadowbox', 'static/PMK_Shadowbox_tt_news/', 'Shadowbox - tt_news');
t3lib_extMgm::addStaticFile('pmkshadowbox', 'static/PMK_Shadowbox_tt_products/', 'Shadowbox - tt_products');
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile('pmkshadowbox', 'static/PMK_Shadowbox_tt_news/', 'Shadowbox - tt_news');
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile('pmkshadowbox', 'static/PMK_Shadowbox_tt_products/', 'Shadowbox - tt_products');
$shadowboxExtConf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['pmkshadowbox']);
if ((int) $shadowboxExtConf['enableCloudZoom'] >= 1) {
t3lib_extMgm::addTCAcolumns(
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTCAcolumns(
'tt_content', array(
'pmkshadowbox_use_cloud_zoom' => array(
'exclude' => 0,
......@@ -29,6 +29,6 @@ if ((int) $shadowboxExtConf['enableCloudZoom'] >= 1) {
)
);
t3lib_extMgm::addToAllTCAtypes('tt_content', 'pmkshadowbox_use_cloud_zoom', '', 'after:image_zoom');
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addToAllTCAtypes('tt_content', 'pmkshadowbox_use_cloud_zoom', '', 'after:image_zoom');
}
?>
......@@ -107,7 +107,7 @@ class tx_pmkshadowbox_cacheTest extends tx_phpunit_testcase {
public function testCopyResourceFile() {
$this->fixture->setBuildDirectory($this->buildDirectory);
$resource = t3lib_extMgm::extPath('pmkshadowbox') .
$resource = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('pmkshadowbox') .
'resources/shadowbox/source/resources/player.swf';
$destination = $this->fixture->copyResourceFile($resource, 'test.swf');
$expectedPathName = $this->cacheDirectory . $this->buildDirectory . 'test.swf';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment