Browse Source

Move plugins to Classes/Plugins and add namespaces

pull/329/head
Sebastian Meyer 3 years ago
parent
commit
919ee33f82
  1. 2
      CODE_OF_CONDUCT.md
  2. 71
      Classes/Common/AbstractPlugin.php
  3. 12
      Classes/Common/Document.php
  4. 12
      Classes/Common/DocumentTypeCheck.php
  5. 28
      Classes/Common/Helper.php
  6. 36
      Classes/Common/Indexer.php
  7. 2
      Classes/Hooks/ConfigurationForm.php
  8. 95
      Classes/Hooks/FormEngine.php
  9. 24
      Classes/Plugins/AudioPlayer.php
  10. 20
      Classes/Plugins/Basket.php
  11. 31
      Classes/Plugins/Calendar.php
  12. 24
      Classes/Plugins/Collection.php
  13. 66
      Classes/Plugins/Eid/PageViewProxy.php
  14. 18
      Classes/Plugins/Eid/SearchSuggest.php
  15. 10
      Classes/Plugins/Feeds.php
  16. 22
      Classes/Plugins/ListView.php
  17. 22
      Classes/Plugins/Metadata.php
  18. 20
      Classes/Plugins/Navigation.php
  19. 29
      Classes/Plugins/OaiPmh.php
  20. 24
      Classes/Plugins/PageGrid.php
  21. 44
      Classes/Plugins/PageView.php
  22. 36
      Classes/Plugins/Search.php
  23. 12
      Classes/Plugins/Statistics.php
  24. 24
      Classes/Plugins/TableOfContents.php
  25. 20
      Classes/Plugins/Toolbox.php
  26. 20
      Classes/Plugins/Tools/FulltextTool.php
  27. 22
      Classes/Plugins/Tools/ImageDownloadTool.php
  28. 20
      Classes/Plugins/Tools/ImageManipulationTool.php
  29. 24
      Classes/Plugins/Tools/PdfDownloadTool.php
  30. 20
      Classes/Plugins/Validator.php
  31. 8
      Configuration/Flexforms/AudioPlayer.xml
  32. 20
      Configuration/Flexforms/Basket.xml
  33. 4
      Configuration/Flexforms/Calendar.xml
  34. 24
      Configuration/Flexforms/Collection.xml
  35. 18
      Configuration/Flexforms/Feeds.xml
  36. 14
      Configuration/Flexforms/ListView.xml
  37. 24
      Configuration/Flexforms/Metadata.xml
  38. 8
      Configuration/Flexforms/Navigation.xml
  39. 18
      Configuration/Flexforms/OaiPmh.xml
  40. 10
      Configuration/Flexforms/PageGrid.xml
  41. 24
      Configuration/Flexforms/PageView.xml
  42. 50
      Configuration/Flexforms/Search.xml
  43. 6
      Configuration/Flexforms/Statistics.xml
  44. 12
      Configuration/Flexforms/TableOfContents.xml
  45. 8
      Configuration/Flexforms/Toolbox.xml
  46. 4
      Configuration/Flexforms/Validator.xml
  47. 4
      Configuration/TCA/Overrides/sys_template.php
  48. 91
      Configuration/TCA/Overrides/tt_content.php
  49. 14
      Configuration/TCA/tx_dlf_actionlog.php
  50. 12
      Configuration/TCA/tx_dlf_basket.php
  51. 34
      Configuration/TCA/tx_dlf_collections.php
  52. 46
      Configuration/TCA/tx_dlf_documents.php
  53. 12
      Configuration/TCA/tx_dlf_formats.php
  54. 26
      Configuration/TCA/tx_dlf_libraries.php
  55. 10
      Configuration/TCA/tx_dlf_mail.php
  56. 34
      Configuration/TCA/tx_dlf_metadata.php
  57. 12
      Configuration/TCA/tx_dlf_metadataformat.php
  58. 8
      Configuration/TCA/tx_dlf_printer.php
  59. 8
      Configuration/TCA/tx_dlf_solrcores.php
  60. 20
      Configuration/TCA/tx_dlf_structures.php
  61. 2
      Configuration/TypoScript/Search/setup.txt
  62. 2
      Configuration/TypoScript/TableOfContents/setup.txt
  63. 14
      Configuration/TypoScript/setup.txt
  64. 6
      Documentation/Introduction/Index.rst
  65. 101
      Documentation/Plugins/Index.rst
  66. 11
      Resources/Private/.htaccess
  67. 2
      Resources/Private/Language/AudioPlayer.xml
  68. 2
      Resources/Private/Language/Basket.xml
  69. 2
      Resources/Private/Language/Calendar.xml
  70. 2
      Resources/Private/Language/Collection.xml
  71. 2
      Resources/Private/Language/Feeds.xml
  72. 96
      Resources/Private/Language/FlashMessages.xml
  73. 2
      Resources/Private/Language/FulltextTool.xml
  74. 2
      Resources/Private/Language/ImageDownloadTool.xml
  75. 2
      Resources/Private/Language/ImageManipulationTool.xml
  76. 130
      Resources/Private/Language/Labels.xml
  77. 2
      Resources/Private/Language/ListView.xml
  78. 2
      Resources/Private/Language/Metadata.xml
  79. 2
      Resources/Private/Language/Navigation.xml
  80. 2
      Resources/Private/Language/OaiPmh.xml
  81. 2
      Resources/Private/Language/PageGrid.xml
  82. 2
      Resources/Private/Language/PageView.xml
  83. 2
      Resources/Private/Language/PdfDownloadTool.xml
  84. 2
      Resources/Private/Language/Search.xml
  85. 2
      Resources/Private/Language/Statistics.xml
  86. 2
      Resources/Private/Language/TableOfContents.xml
  87. 2
      Resources/Private/Language/Toolbox.xml
  88. 2
      Resources/Private/Language/Validator.xml
  89. 0
      Resources/Private/Templates/AudioPlayer.tmpl
  90. 0
      Resources/Private/Templates/Basket.tmpl
  91. 4
      Resources/Private/Templates/Calendar.tmpl
  92. 0
      Resources/Private/Templates/Collection.tmpl
  93. 0
      Resources/Private/Templates/FulltextTool.tmpl
  94. 0
      Resources/Private/Templates/ImageDownloadTool.tmpl
  95. 0
      Resources/Private/Templates/ImageManipulationTool.tmpl
  96. 0
      Resources/Private/Templates/ListView.tmpl
  97. 0
      Resources/Private/Templates/Metadata.tmpl
  98. 0
      Resources/Private/Templates/Navigation.tmpl
  99. 0
      Resources/Private/Templates/PageGrid.tmpl
  100. 0
      Resources/Private/Templates/PageView.tmpl

2
CODE_OF_CONDUCT.md

@ -2,7 +2,7 @@
## Our Pledge
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone.
## Our Standards

71
Classes/Common/AbstractPlugin.php

@ -50,6 +50,25 @@ abstract class AbstractPlugin extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin
protected $template = '';
/**
* Read and parse the template file
*
* @access protected
*
* @param string $part: Name of the subpart to load
*
* @return void
*/
protected function getTemplate($part = '###TEMPLATE###') {
if (!empty($this->conf['templateFile'])) {
// Load template file from configuration.
$this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), $part);
} else {
// Load default template file.
$this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/Resources/Private/Templates/'.get_class($this).'.tmpl'), $part);
}
}
/**
* All the needed configuration values are stored in class variables
* Priority: Flexforms > TS-Templates > Extension Configuration > ext_localconf.php
*
@ -81,6 +100,15 @@ abstract class AbstractPlugin extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin
}
// Read old plugin TS configuration.
$oldPluginConf = $GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_dlf_'.strtolower(get_class($this)).'.'];
if (is_array($oldPluginConf)) {
$conf = \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiceWithOverrule($oldPluginConf, $conf);
}
// Read general TS configuration.
$generalConf = $GLOBALS['TSFE']->tmpl->setup['plugin.'][$this->prefixId.'.'];
@ -114,7 +142,7 @@ abstract class AbstractPlugin extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin
$this->pi_setPiVarDefaults();
// Load translation files.
$this->pi_loadLL();
$this->pi_loadLL('EXT:'.$this->extKey.'/Resources/Private/Language/'.get_class($this).'.xml');
}
@ -216,45 +244,6 @@ abstract class AbstractPlugin extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin
abstract public function main($content, $conf);
/**
* Sets default plugin variables from Typoscript
* (stdWrap backport from TYPO3 6.2)
* @see http://forge.typo3.org/issues/22045
*
* @access public
*
* @return void
*/
public function pi_setPiVarDefaults() {
if (is_array($this->conf['_DEFAULT_PI_VARS.'])) {
foreach ($this->conf['_DEFAULT_PI_VARS.'] as $GPkey => $GPval) {
if (strpos($GPkey, '.')) {
$GPkey = substr($GPkey, 0, -1);
}
if (is_array($this->conf['_DEFAULT_PI_VARS.'][$GPkey.'.']['stdWrap.'])) {
$GPval = $GPval ? $GPval : '';
$this->conf['_DEFAULT_PI_VARS.'][$GPkey] = $this->cObj->stdWrap($GPval, $this->conf['_DEFAULT_PI_VARS.'][$GPkey.'.']['stdWrap.']);
unset ($this->conf['_DEFAULT_PI_VARS.'][$GPkey.'.']['stdWrap.']);
}
}
$this->piVars = Helper::array_merge_recursive_overrule($this->conf['_DEFAULT_PI_VARS.'], is_array($this->piVars) ? $this->piVars : array ());
}
}
/**
* Wraps the input string in a tag with the class attribute set to the class name
*
* @access public
@ -267,7 +256,7 @@ abstract class AbstractPlugin extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin
if (!$GLOBALS['TSFE']->config['config']['disableWrapInBaseClass']) {
// Use get_class($this) instead of $this->prefixId for content wrapping because $this->prefixId is the same for all plugins.
$content = '<div class="'.str_replace('_', '-', get_class($this)).'">'.$content.'</div>';
$content = '<div class="tx-dlf-'.get_class($this).'">'.$content.'</div>';
if (!$GLOBALS['TSFE']->config['config']['disablePrefixComment']) {

12
Classes/Common/Document.php

@ -1564,8 +1564,8 @@ final class Document {
$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
\TYPO3\CMS\Core\Messaging\FlashMessage::class,
htmlspecialchars(sprintf(Helper::getLL('flash.newCollection'), $collection, $substUid[$collNewUid])),
Helper::getLL('flash.attention', TRUE),
htmlspecialchars(sprintf(Helper::getMessage('flash.newCollection'), $collection, $substUid[$collNewUid])),
Helper::getMessage('flash.attention', TRUE),
\TYPO3\CMS\Core\Messaging\FlashMessage::INFO,
TRUE
);
@ -1625,8 +1625,8 @@ final class Document {
$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
\TYPO3\CMS\Core\Messaging\FlashMessage::class,
htmlspecialchars(sprintf(Helper::getLL('flash.newLibrary'), $owner, $ownerUid)),
Helper::getLL('flash.attention', TRUE),
htmlspecialchars(sprintf(Helper::getMessage('flash.newLibrary'), $owner, $ownerUid)),
Helper::getMessage('flash.attention', TRUE),
\TYPO3\CMS\Core\Messaging\FlashMessage::INFO,
TRUE
);
@ -1793,8 +1793,8 @@ final class Document {
$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
\TYPO3\CMS\Core\Messaging\FlashMessage::class,
htmlspecialchars(sprintf(Helper::getLL('flash.documentSaved'), $metadata['title'][0], $this->uid)),
Helper::getLL('flash.done', TRUE),
htmlspecialchars(sprintf(Helper::getMessage('flash.documentSaved'), $metadata['title'][0], $this->uid)),
Helper::getMessage('flash.done', TRUE),
\TYPO3\CMS\Core\Messaging\FlashMessage::OK,
TRUE
);

12
Classes/Common/DocumentTypeCheck.php

@ -81,14 +81,14 @@ class DocumentTypeCheck {
*
* 1. newspaper
* case 1) - type=newspaper
* - children array([0], [1], [2], ...) -> type = year --> Newspaper Anchor File
* - children array ([0], [1], [2], ...) -> type = year --> Newspaper Anchor File
* case 2) - type=newspaper
* - children array([0]) --> type = year
* - children array([0], [1], [2], ...) --> type = month --> Year Anchor File
* - children array ([0]) --> type = year
* - children array ([0], [1], [2], ...) --> type = month --> Year Anchor File
* case 3) - type=newspaper
* - children array([0]) --> type = year
* - children array([0]) --> type = month
* - children array([0], [1], [2], ...) --> type = day --> Issue
* - children array ([0]) --> type = year
* - children array ([0]) --> type = month
* - children array ([0], [1], [2], ...) --> type = day --> Issue
*/
switch ($toc[0]['type']) {

28
Classes/Common/Helper.php

@ -31,12 +31,12 @@ class Helper {
public static $extKey = 'dlf';
/**
* The locallang array for common use
* The locallang array for flash messages
*
* @var array
* @access protected
*/
protected static $locallang = array ();
protected static $messages = array ();
/**
* Adds a message to the message queue.
@ -679,7 +679,7 @@ class Helper {
}
/**
* Wrapper function for getting localizations in frontend and backend
* Wrapper function for getting localized messages in frontend and backend
*
* @param string $key: The locallang key to translate
* @param boolean $hsc: Should the result be htmlspecialchar()'ed?
@ -687,46 +687,46 @@ class Helper {
*
* @return string The translated string or the given key on failure
*/
public static function getLL($key, $hsc = FALSE, $default = '') {
public static function getMessage($key, $hsc = FALSE, $default = '') {
// Set initial output to default value.
$translated = (string) $default;
// Load common locallang file.
if (empty(self::$locallang)) {
// Load common messages file.
if (empty(self::$messages)) {
$file = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath(self::$extKey, 'common/locallang.xml');
$file = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath(self::$extKey, 'Resources/Private/Language/FlashMessages.xml');
if (TYPO3_MODE === 'FE') {
self::$locallang = $GLOBALS['TSFE']->readLLfile($file);
self::$messages = $GLOBALS['TSFE']->readLLfile($file);
} elseif (TYPO3_MODE === 'BE') {
self::$locallang = $GLOBALS['LANG']->includeLLFile($file, FALSE, TRUE);
self::$messages = $GLOBALS['LANG']->includeLLFile($file, FALSE, TRUE);
} elseif (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\Helper->getLL('.$key.', '.$default.', ['.($hsc ? 'TRUE' : 'FALSE').'])] Unexpected TYPO3_MODE "'.TYPO3_MODE.'"', self::$extKey, SYSLOG_SEVERITY_ERROR);
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\Helper->getMessage('.$key.', '.$default.', ['.($hsc ? 'TRUE' : 'FALSE').'])] Unexpected TYPO3_MODE "'.TYPO3_MODE.'"', self::$extKey, SYSLOG_SEVERITY_ERROR);
}
}
// Get translation.
if (!empty(self::$locallang['default'][$key])) {
if (!empty(self::$messages['default'][$key])) {
if (TYPO3_MODE === 'FE') {
$translated = $GLOBALS['TSFE']->getLLL($key, self::$locallang);
$translated = $GLOBALS['TSFE']->getLLL($key, self::$messages);
} elseif (TYPO3_MODE === 'BE') {
$translated = $GLOBALS['LANG']->getLLL($key, self::$locallang, FALSE);
$translated = $GLOBALS['LANG']->getLLL($key, self::$messages, FALSE);
} elseif (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\Helper->getLL('.$key.', '.$default.', ['.($hsc ? 'TRUE' : 'FALSE').'])] Unexpected TYPO3_MODE "'.TYPO3_MODE.'"', self::$extKey, SYSLOG_SEVERITY_ERROR);
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Common\Helper->getMessage('.$key.', '.$default.', ['.($hsc ? 'TRUE' : 'FALSE').'])] Unexpected TYPO3_MODE "'.TYPO3_MODE.'"', self::$extKey, SYSLOG_SEVERITY_ERROR);
}

36
Classes/Common/Indexer.php

@ -181,8 +181,8 @@ class Indexer {
$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
\TYPO3\CMS\Core\Messaging\FlashMessage::class,
htmlspecialchars(sprintf(Helper::getLL('flash.documentIndexed'), $resArray['title'], $doc->uid)),
Helper::getLL('flash.done', TRUE),
htmlspecialchars(sprintf(Helper::getMessage('flash.documentIndexed'), $resArray['title'], $doc->uid)),
Helper::getMessage('flash.done', TRUE),
\TYPO3\CMS\Core\Messaging\FlashMessage::OK,
TRUE
);
@ -191,8 +191,8 @@ class Indexer {
$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
\TYPO3\CMS\Core\Messaging\FlashMessage::class,
htmlspecialchars(sprintf(Helper::getLL('flash.documentNotIndexed'), $resArray['title'], $doc->uid)),
Helper::getLL('flash.error', TRUE),
htmlspecialchars(sprintf(Helper::getMessage('flash.documentNotIndexed'), $resArray['title'], $doc->uid)),
Helper::getMessage('flash.error', TRUE),
\TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,
TRUE
);
@ -211,8 +211,8 @@ class Indexer {
$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
\TYPO3\CMS\Core\Messaging\FlashMessage::class,
Helper::getLL('flash.solrException', TRUE).'<br />'.htmlspecialchars($e->getMessage()),
Helper::getLL('flash.error', TRUE),
Helper::getMessage('flash.solrException', TRUE).'<br />'.htmlspecialchars($e->getMessage()),
Helper::getMessage('flash.error', TRUE),
\TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,
TRUE
);
@ -237,8 +237,8 @@ class Indexer {
$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
\TYPO3\CMS\Core\Messaging\FlashMessage::class,
Helper::getLL('flash.solrNoConnection', TRUE),
Helper::getLL('flash.warning', TRUE),
Helper::getMessage('flash.solrNoConnection', TRUE),
Helper::getMessage('flash.warning', TRUE),
\TYPO3\CMS\Core\Messaging\FlashMessage::WARNING,
TRUE
);
@ -307,8 +307,8 @@ class Indexer {
$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
\TYPO3\CMS\Core\Messaging\FlashMessage::class,
Helper::getLL('flash.solrException', TRUE).'<br />'.htmlspecialchars($e->getMessage()),
Helper::getLL('flash.error', TRUE),
Helper::getMessage('flash.solrException', TRUE).'<br />'.htmlspecialchars($e->getMessage()),
Helper::getMessage('flash.error', TRUE),
\TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,
TRUE
);
@ -333,8 +333,8 @@ class Indexer {
$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
\TYPO3\CMS\Core\Messaging\FlashMessage::class,
Helper::getLL('flash.solrNoConnection', TRUE),
Helper::getLL('flash.error', TRUE),
Helper::getMessage('flash.solrNoConnection', TRUE),
Helper::getMessage('flash.error', TRUE),
\TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,
TRUE
);
@ -357,8 +357,8 @@ class Indexer {
$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
\TYPO3\CMS\Core\Messaging\FlashMessage::class,
htmlspecialchars(sprintf(Helper::getLL('flash.documentDeleted'), $title, $uid)),
Helper::getLL('flash.done', TRUE),
htmlspecialchars(sprintf(Helper::getMessage('flash.documentDeleted'), $title, $uid)),
Helper::getMessage('flash.done', TRUE),
\TYPO3\CMS\Core\Messaging\FlashMessage::OK,
TRUE
);
@ -638,8 +638,8 @@ class Indexer {
$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
\TYPO3\CMS\Core\Messaging\FlashMessage::class,
Helper::getLL('flash.solrException', TRUE).'<br />'.htmlspecialchars($e->getMessage()),
Helper::getLL('flash.error', TRUE),
Helper::getMessage('flash.solrException', TRUE).'<br />'.htmlspecialchars($e->getMessage()),
Helper::getMessage('flash.error', TRUE),
\TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,
TRUE
);
@ -805,8 +805,8 @@ class Indexer {
$message = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
\TYPO3\CMS\Core\Messaging\FlashMessage::class,
Helper::getLL('flash.solrException', TRUE).'<br />'.htmlspecialchars($e->getMessage()),
Helper::getLL('flash.error', TRUE),
Helper::getMessage('flash.solrException', TRUE).'<br />'.htmlspecialchars($e->getMessage()),
Helper::getMessage('flash.error', TRUE),
\TYPO3\CMS\Core\Messaging\FlashMessage::ERROR,
TRUE
);

2
Classes/Hooks/ConfigurationForm.php

@ -683,7 +683,7 @@ class ConfigurationForm {
public function __construct() {
// Load localization file.
$GLOBALS['LANG']->includeLLFile('EXT:dlf/locallang.xml');
$GLOBALS['LANG']->includeLLFile('EXT:dlf/Resources/Private/Language/FlashMessages.xml');
// Get current configuration.
$this->conf = array_merge((array) unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf']['dlf']), (array) \TYPO3\CMS\Core\Utility\GeneralUtility::_POST('data'));

95
Classes/Hooks/FormEngine.php

@ -64,22 +64,7 @@ class FormEngine {
*/
public function itemsProcFunc_collectionList(&$params, &$pObj) {
// the access to pi_flexform data has changed in TYPO3 7.6
if (version_compare(TYPO3_version, '7.6', '<')) {
if ($params['row']['pi_flexform']) {
$pi_flexform = \TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($params['row']['pi_flexform']);
$pages = $pi_flexform['data']['sDEF']['lDEF']['pages']['vDEF'];
}
} else {
$pages = $params['row']['pages'];
}
$pages = $params['row']['pages'];
if (!empty($pages)) {
@ -121,7 +106,7 @@ class FormEngine {
}
/**
* Helper to get flexform's items array for plugin "tx_dlf_search"
* Helper to get flexform's items array for plugin "Search"
*
* @access public
*
@ -132,22 +117,7 @@ class FormEngine {
*/
public function itemsProcFunc_extendedSearchList(&$params, &$pObj) {
// the access to pi_flexform data has changed in TYPO3 7.6
if (version_compare(TYPO3_version, '7.6', '<')) {
if ($params['row']['pi_flexform']) {
$pi_flexform = \TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($params['row']['pi_flexform']);
$pages = $pi_flexform['data']['sDEF']['lDEF']['pages']['vDEF'];
}
} else {
$pages = $params['row']['pages'];
}
$pages = $params['row']['pages'];
if (!empty($pages)) {
@ -189,7 +159,7 @@ class FormEngine {
}
/**
* Helper to get flexform's items array for plugin "tx_dlf_search"
* Helper to get flexform's items array for plugin "Search"
*
* @access public
*
@ -200,22 +170,7 @@ class FormEngine {
*/
public function itemsProcFunc_facetsList(&$params, &$pObj) {
// the access to pi_flexform data has changed in TYPO3 7.6
if (version_compare(TYPO3_version, '7.6', '<')) {
if ($params['row']['pi_flexform']) {
$pi_flexform = \TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($params['row']['pi_flexform']);
$pages = $pi_flexform['data']['sDEF']['lDEF']['pages']['vDEF'];
}
} else {
$pages = $params['row']['pages'];
}
$pages = $params['row']['pages'];
if (!empty($pages)) {
@ -257,7 +212,7 @@ class FormEngine {
}
/**
* Helper to get flexform's items array for plugin "tx_dlf_oai"
* Helper to get flexform's items array for plugin "OaiPmh"
*
* @access public
*
@ -268,22 +223,7 @@ class FormEngine {
*/
public function itemsProcFunc_libraryList(&$params, &$pObj) {
// the access to pi_flexform data has changed in TYPO3 7.6
if (version_compare(TYPO3_version, '7.6', '<')) {
if ($params['row']['pi_flexform']) {
$pi_flexform = \TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($params['row']['pi_flexform']);
$pages = $pi_flexform['data']['sDEF']['lDEF']['pages']['vDEF'];
}
} else {
$pages = $params['row']['pages'];
}
$pages = $params['row']['pages'];
if (!empty($pages)) {
@ -325,7 +265,7 @@ class FormEngine {
}
/**
* Helper to get flexform's items array for plugin "tx_dlf_search"
* Helper to get flexform's items array for plugin "Search"
*
* @access public
*
@ -336,22 +276,7 @@ class FormEngine {
*/
public function itemsProcFunc_solrList(&$params, &$pObj) {
// the access to pi_flexform data has changed in TYPO3 7.6
if (version_compare(TYPO3_version, '7.6', '<')) {
if ($params['row']['pi_flexform']) {
$pi_flexform = \TYPO3\CMS\Core\Utility\GeneralUtility::xml2array($params['row']['pi_flexform']);
$pages = $pi_flexform['data']['sDEF']['lDEF']['pages']['vDEF'];
}
} else {
$pages = $params['row']['pages'];
}
$pages = $params['row']['pages'];
if (!empty($pages)) {
@ -393,7 +318,7 @@ class FormEngine {
}
/**
* Helper to get flexform's items array for plugin "tx_dlf_toolbox"
* Helper to get flexform's items array for plugin "Toolbox"
*
* @access public
*

24
plugins/audioplayer/class.tx_dlf_audioplayer.php → Classes/Plugins/AudioPlayer.php

@ -1,4 +1,6 @@
<?php
namespace Kitodo\Dlf\Plugins;
/**
* (c) Kitodo. Key to digital objects e.V. <contact@kitodo.org>
*
@ -10,16 +12,16 @@
*/
/**
* Plugin 'DLF: Audioplayer' for the 'dlf' extension.
* Plugin AudioPlayer for the 'dlf' extension.
*
* @author Sebastian Meyer <sebastian.meyer@slub-dresden.de>
* @package TYPO3
* @subpackage tx_dlf
* @subpackage dlf
* @access public
*/
class tx_dlf_audioplayer extends \Kitodo\Dlf\Common\AbstractPlugin {
class AudioPlayer extends \Kitodo\Dlf\Common\AbstractPlugin {
public $scriptRelPath = 'plugins/audioplayer/class.tx_dlf_audioplayer.php';
public $scriptRelPath = 'Classes/Plugins/AudioPlayer.php';
/**
* Holds the current audio file's URL, MIME type and optional label
@ -44,7 +46,7 @@ class tx_dlf_audioplayer extends \Kitodo\Dlf\Common\AbstractPlugin {
$output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'Resources/Public/Javascript/jPlayer/jquery.jplayer.min.js"></script>';
$output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/audioplayer/js/tx_dlf_audioplayer.js"></script>';
$output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'Resources/Public/Javascript/AudioPlayer/AudioPlayer.js"></script>';
// Add player configuration.
$output[] = '
@ -53,7 +55,7 @@ class tx_dlf_audioplayer extends \Kitodo\Dlf\Common\AbstractPlugin {
</style>
<script id="tx-dlf-audioplayer-initViewer" type="text/javascript">
$(document).ready(function() {
tx_dlf_audioplayer = new dlfAudioPlayer({
AudioPlayer = new dlfAudioPlayer({
audio: {
mimeType: "' . $this->audio['mimetype'].'",
title: "' . $this->audio['label'].'",
@ -127,15 +129,7 @@ class tx_dlf_audioplayer extends \Kitodo\Dlf\Common\AbstractPlugin {
}
// Load template file.
if (!empty($this->conf['templateFile'])) {
$this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###');
} else {
$this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/audioplayer/template.tmpl'), '###TEMPLATE###');
}
$this->getTemplate();
// Fill in the template markers.
$markerArray = array (

20
plugins/basket/class.tx_dlf_basket.php → Classes/Plugins/Basket.php

@ -1,4 +1,6 @@
<?php
namespace Kitodo\Dlf\Plugins;
/**
* (c) Kitodo. Key to digital objects e.V. <contact@kitodo.org>
*
@ -13,16 +15,16 @@ use Kitodo\Dlf\Common\Document;
use Kitodo\Dlf\Common\Helper;
/**
* Plugin 'DLF: Basket' for the 'dlf' extension.
* Plugin 'Basket' for the 'dlf' extension.
*
* @author Christopher Timm <timm@effective-webwork.de>
* @package TYPO3
* @subpackage tx_dlf
* @subpackage dlf
* @access public
*/
class tx_dlf_basket extends \Kitodo\Dlf\Common\AbstractPlugin {
class Basket extends \Kitodo\Dlf\Common\AbstractPlugin {
public $scriptRelPath = 'plugins/basket/class.tx_dlf_basket.php';
public $scriptRelPath = 'Classes/Plugins/Basket.php';
/**
* The main method of the PlugIn
@ -42,15 +44,7 @@ class tx_dlf_basket extends \Kitodo\Dlf\Common\AbstractPlugin {
$this->setCache(FALSE);
// Load template file.
if (!empty($this->conf['templateFile'])) {
$this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###');
} else {
$this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/basket/template.tmpl'), '###TEMPLATE###');
}
$this->getTemplate();
$subpartArray['entry'] = $this->cObj->getSubpart($this->template, '###ENTRY###');

31
plugins/newspaper/class.tx_dlf_newspaper.php → Classes/Plugins/Calendar.php

@ -1,4 +1,6 @@
<?php
namespace Kitodo\Dlf\Plugins;
/**
* (c) Kitodo. Key to digital objects e.V. <contact@kitodo.org>
*
@ -12,19 +14,18 @@
use Kitodo\Dlf\Common\Helper;
/**
* Plugin 'DLF: Newspaper' for the 'dlf' extension.
* Plugin 'Calendar' for the 'dlf' extension.
*
* @author Alexander Bigga <alexander.bigga@slub-dresden.de>
* @copyright Copyright (c) 2016, Alexander Bigga, SLUB Dresden
* @package TYPO3
* @subpackage tx_dlf
* @subpackage dlf
* @access public
*/
class tx_dlf_newspaper extends \Kitodo\Dlf\Common\AbstractPlugin {
class Calendar extends \Kitodo\Dlf\Common\AbstractPlugin {
public $extKey = 'dlf';
public $scriptRelPath = 'plugins/newspaper/class.tx_dlf_newspaper.php';
public $scriptRelPath = 'Classes/Plugins/Calendar.php';
/**
* The main method of the PlugIn
@ -68,15 +69,7 @@ class tx_dlf_newspaper extends \Kitodo\Dlf\Common\AbstractPlugin {
}
// Load template file.
if (!empty($this->conf['templateFile'])) {
$this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATECALENDAR###');
} else {
$this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/newspaper/template.tmpl'), '###TEMPLATECALENDAR###');
}
$this->getTemplate('###TEMPLATECALENDAR###');
// Get all children of year anchor.
$result = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
@ -349,15 +342,7 @@ class tx_dlf_newspaper extends \Kitodo\Dlf\Common\AbstractPlugin {
}
// Load template file.
if (!empty($this->conf['templateFile'])) {
$this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATEYEAR###');
} else {
$this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/newspaper/template.tmpl'), '###TEMPLATEYEAR###');
}
$this->getTemplate('###TEMPLATEYEAR###');
// Get subpart templates
$subparts['year'] = $this->cObj->getSubpart($this->template, '###LISTYEAR###');

24
plugins/collection/class.tx_dlf_collection.php → Classes/Plugins/Collection.php

@ -1,4 +1,6 @@
<?php
namespace Kitodo\Dlf\Plugins;
/**
* (c) Kitodo. Key to digital objects e.V. <contact@kitodo.org>
*
@ -14,16 +16,16 @@ use Kitodo\Dlf\Common\Helper;
use Kitodo\Dlf\Common\Solr;
/**
* Plugin 'DLF: Collection' for the 'dlf' extension.
* Plugin 'Collection' for the 'dlf' extension.
*
* @author Sebastian Meyer <sebastian.meyer@slub-dresden.de>
* @package TYPO3
* @subpackage tx_dlf
* @subpackage dlf
* @access public
*/
class tx_dlf_collection extends \Kitodo\Dlf\Common\AbstractPlugin {
class Collection extends \Kitodo\Dlf\Common\AbstractPlugin {
public $scriptRelPath = 'plugins/collection/class.tx_dlf_collection.php';
public $scriptRelPath = 'Classes/Plugins/Collection.php';
/**
* This holds the hook objects
@ -55,7 +57,7 @@ class tx_dlf_collection extends \Kitodo\Dlf\Common\AbstractPlugin {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_collection->main('.$content.', [data])] Incomplete plugin configuration', $this->extKey, SYSLOG_SEVERITY_WARNING, $conf);
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Plugins\Collection->main('.$content.', [data])] Incomplete plugin configuration', $this->extKey, SYSLOG_SEVERITY_WARNING, $conf);
}
@ -64,15 +66,7 @@ class tx_dlf_collection extends \Kitodo\Dlf\Common\AbstractPlugin {
}
// Load template file.
if (!empty($this->conf['templateFile'])) {
$this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###');
} else {
$this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/collection/template.tmpl'), '###TEMPLATE###');
}
$this->getTemplate();
// Get hook objects.
$this->hookObjects = Helper::getHookObjects($this->scriptRelPath);
@ -384,7 +378,7 @@ class tx_dlf_collection extends \Kitodo\Dlf\Common\AbstractPlugin {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_collection->showSingleCollection('.intval($id).')] Apache Solr not available', $this->extKey, SYSLOG_SEVERITY_ERROR);
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Plugins\Collection->showSingleCollection('.intval($id).')] Apache Solr not available', $this->extKey, SYSLOG_SEVERITY_ERROR);
}

66
Classes/Plugins/Eid/PageViewProxy.php

@ -0,0 +1,66 @@
<?php
namespace Kitodo\Dlf\Plugins\Eid;
/**
* (c) Kitodo. Key to digital objects e.V. <contact@kitodo.org>
*
* This file is part of the Kitodo and TYPO3 projects.
*
* @license GNU General Public License version 3 or later.
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*/
/**
* eID image proxy for plugin 'Page View' of the 'dlf' extension.
*
* @author Alexander Bigga <alexander.bigga@slub-dresden.de>
* @copyright Copyright (c) 2015, Alexander Bigga, SLUB Dresden
* @package TYPO3
* @subpackage tx_dlf
* @access public
*/
class PageViewProxy extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin {
public $scriptRelPath = 'Classes/Plugins/Eid/PageViewProxy.php';
/**
* The main method of the eID script
*
* @access public
*
* @param string $content: The PlugIn content
* @param array $conf: The PlugIn configuration
*
* @return string
*/
public function main($content = '', $conf = array ()) {
$this->cObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer::class);
$header = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('header');
$url = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('url');
$fetchedData = \TYPO3\CMS\Core\Utility\GeneralUtility::getUrl($url, \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($header, 0, 2, 0));
// Add some header tags
header('Last-Modified: '.gmdate("D, d M Y H:i:s").'GMT');
header('Cache-Control: max-age=3600, must-revalidate');
header('Content-Length: '.strlen($fetchedData));
header('Content-Type: '.finfo_buffer(finfo_open(FILEINFO_MIME), $fetchedData));
// Get last modified date from request header
$fetchedHeader = explode("\n", \TYPO3\CMS\Core\Utility\GeneralUtility::getUrl($url, 2));
foreach ($fetchedHeader as $headerline) {
if (stripos($headerline, 'Last-Modified:') !== FALSE) {
header($headerline);
break;
}
}
echo $fetchedData;
}
}

18
plugins/search/class.tx_dlf_search_suggest.php → Classes/Plugins/Eid/SearchSuggest.php

@ -1,4 +1,6 @@
<?php
namespace Kitodo\Dlf\Plugins\Eid;
/**
* (c) Kitodo. Key to digital objects e.V. <contact@kitodo.org>
*
@ -13,27 +15,27 @@ use Kitodo\Dlf\Common\Helper;
use Kitodo\Dlf\Common\Solr;
/**
* Search suggestions for the plugin 'DLF: Search' of the 'dlf' extension.
* eID search suggestions for plugin 'Search' of the 'dlf' extension.
*
* @author Henrik Lochmann <dev@mentalmotive.com>
* @author Sebastian Meyer <sebastian.meyer@slub-dresden.de>
* @package TYPO3
* @subpackage tx_dlf
* @subpackage dlf
* @access public
*/
class tx_dlf_search_suggest extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin {
class SearchSuggest extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin {
public $scriptRelPath = 'plugins/search/class.tx_dlf_search_suggest.php';
public $scriptRelPath = 'Classes/Plugins/Eid/SearchSuggest.php';
/**
* The main method of the PlugIn
* The main method of the eID script
*
* @access public
*
* @param string $content: The PlugIn content
* @param array $conf: The PlugIn configuration
*
* @return void
* @return string XML response of search suggestions
*/
public function main($content = '', $conf = array ()) {
@ -62,7 +64,3 @@ class tx_dlf_search_suggest extends \TYPO3\CMS\Frontend\Plugin\AbstractPlugin {
}
}
$cObj = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('tx_dlf_search_suggest');
$cObj->main();

10
plugins/feeds/class.tx_dlf_feeds.php → Classes/Plugins/Feeds.php

@ -1,4 +1,6 @@
<?php
namespace Kitodo\Dlf\Plugins;
/**
* (c) Kitodo. Key to digital objects e.V. <contact@kitodo.org>
*
@ -13,16 +15,16 @@ use Kitodo\Dlf\Common\Document;
use Kitodo\Dlf\Common\Helper;
/**
* Plugin 'DLF: Feeds' for the 'dlf' extension.
* Plugin 'Feeds' for the 'dlf' extension.
*
* @author Sebastian Meyer <sebastian.meyer@slub-dresden.de>
* @package TYPO3
* @subpackage tx_dlf
* @subpackage dlf
* @access public
*/
class tx_dlf_feeds extends \Kitodo\Dlf\Common\AbstractPlugin {
class Feeds extends \Kitodo\Dlf\Common\AbstractPlugin {
public $scriptRelPath = 'plugins/feeds/class.tx_dlf_feeds.php';
public $scriptRelPath = 'Classes/Plugins/Feeds.php';
/**
* The main method of the PlugIn

22
plugins/listview/class.tx_dlf_listview.php → Classes/Plugins/ListView.php

@ -1,4 +1,6 @@
<?php
namespace Kitodo\Dlf\Plugins;
/**
* (c) Kitodo. Key to digital objects e.V. <contact@kitodo.org>
*
@ -15,18 +17,18 @@ use Kitodo\Dlf\Common\Helper;
use Kitodo\Dlf\Common\Solr;
/**
* Plugin 'DLF: List View' for the 'dlf' extension.
* Plugin 'List View' for the 'dlf' extension.
*
* @author Sebastian Meyer <sebastian.meyer@slub-dresden.de>
* @author Henrik Lochmann <dev@mentalmotive.com>
* @author Frank Ulrich Weber <fuw@zeutschel.de>
* @package TYPO3
* @subpackage tx_dlf
* @subpackage dlf
* @access public
*/
class tx_dlf_listview extends \Kitodo\Dlf\Common\AbstractPlugin {
class ListView extends \Kitodo\Dlf\Common\AbstractPlugin {
public $scriptRelPath = 'plugins/listview/class.tx_dlf_listview.php';
public $scriptRelPath = 'Classes/Plugins/ListView.php';
/**
* This holds the field wrap of the metadata
@ -707,7 +709,7 @@ class tx_dlf_listview extends \Kitodo\Dlf\Common\AbstractPlugin {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_listview->main('.$content.', [data])] Apache Solr not available', $this->extKey, SYSLOG_SEVERITY_ERROR, $conf);
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Plugins\ListView->main('.$content.', [data])] Apache Solr not available', $this->extKey, SYSLOG_SEVERITY_ERROR, $conf);
}
@ -737,15 +739,7 @@ class tx_dlf_listview extends \Kitodo\Dlf\Common\AbstractPlugin {
}
// Load template file.
if (!empty($this->conf['templateFile'])) {
$this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###');
} else {
$this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/listview/template.tmpl'), '###TEMPLATE###');
}
$this->getTemplate();
$subpartArray['entry'] = $this->cObj->getSubpart($this->template, '###ENTRY###');

22
plugins/metadata/class.tx_dlf_metadata.php → Classes/Plugins/Metadata.php

@ -1,4 +1,6 @@
<?php
namespace Kitodo\Dlf\Plugins;
/**
* (c) Kitodo. Key to digital objects e.V. <contact@kitodo.org>
*
@ -13,17 +15,17 @@ use Kitodo\Dlf\Common\Document;
use Kitodo\Dlf\Common\Helper;
/**
* Plugin 'DLF: Metadata' for the 'dlf' extension.
* Plugin 'Metadata' for the 'dlf' extension.
*
* @author Sebastian Meyer <sebastian.meyer@slub-dresden.de>
* @author Siegfried Schweizer <siegfried.schweizer@sbb.spk-berlin.de>
* @package TYPO3
* @subpackage tx_dlf
* @subpackage dlf
* @access public
*/
class tx_dlf_metadata extends \Kitodo\Dlf\Common\AbstractPlugin {
class Metadata extends \Kitodo\Dlf\Common\AbstractPlugin {
public $scriptRelPath = 'plugins/metadata/class.tx_dlf_metadata.php';
public $scriptRelPath = 'Classes/Plugins/Metadata.php';
/**
* This holds the hook objects
@ -154,7 +156,7 @@ class tx_dlf_metadata extends \Kitodo\Dlf\Common\AbstractPlugin {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_metadata->main('.$content.', [data])] No metadata found for document with UID "'.$this->doc->uid.'"', $this->extKey, SYSLOG_SEVERITY_WARNING, $conf);
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Plugins\Metadata->main('.$content.', [data])] No metadata found for document with UID "'.$this->doc->uid.'"', $this->extKey, SYSLOG_SEVERITY_WARNING, $conf);
}
@ -196,15 +198,7 @@ class tx_dlf_metadata extends \Kitodo\Dlf\Common\AbstractPlugin {
protected function printMetadata(array $metadataArray) {
// Load template file.
if (!empty($this->conf['templateFile'])) {
$this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###');
} else {
$this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/metadata/template.tmpl'), '###TEMPLATE###');
}
$this->getTemplate();
$output = '';

20
plugins/navigation/class.tx_dlf_navigation.php → Classes/Plugins/Navigation.php

@ -1,4 +1,6 @@
<?php
namespace Kitodo\Dlf\Plugins;
/**
* (c) Kitodo. Key to digital objects e.V. <contact@kitodo.org>
*
@ -13,16 +15,16 @@ use Kitodo\Dlf\Common\DocumentList;
use Kitodo\Dlf\Common\Helper;
/**
* Plugin 'DLF: Navigation' for the 'dlf' extension.
* Plugin 'Navigation' for the 'dlf' extension.
*
* @author Sebastian Meyer <sebastian.meyer@slub-dresden.de>
* @package TYPO3
* @subpackage tx_dlf
* @subpackage dlf
* @access public
*/
class tx_dlf_navigation extends \Kitodo\Dlf\Common\AbstractPlugin {
class Navigation extends \Kitodo\Dlf\Common\AbstractPlugin {
public $scriptRelPath = 'plugins/navigation/class.tx_dlf_navigation.php';
public $scriptRelPath = 'Classes/Plugins/Navigation.php';
/**
* Display a link to the list view
@ -164,15 +166,7 @@ class tx_dlf_navigation extends \Kitodo\Dlf\Common\AbstractPlugin {
}
// Load template file.
if (!empty($this->conf['templateFile'])) {
$this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###');
} else {
$this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/navigation/template.tmpl'), '###TEMPLATE###');
}
$this->getTemplate();
// Steps for X pages backward / forward. Double page view uses double steps.
$pageSteps = $this->conf['pageStep'] * ($this->piVars['double'] + 1);

29
plugins/oai/class.tx_dlf_oai.php → Classes/Plugins/OaiPmh.php

@ -1,4 +1,6 @@
<?php
namespace Kitodo\Dlf\Plugins;
/**
* (c) Kitodo. Key to digital objects e.V. <contact@kitodo.org>
*
@ -14,16 +16,16 @@ use Kitodo\Dlf\Common\Helper;
use Kitodo\Dlf\Common\Solr;
/**
* Plugin 'DLF: OAI-PMH Interface' for the 'dlf' extension.
* Plugin 'OAI-PMH Interface' for the 'dlf' extension.
*
* @author Sebastian Meyer <sebastian.meyer@slub-dresden.de>
* @package TYPO3
* @subpackage tx_dlf
* @subpackage dlf
* @access public
*/
class tx_dlf_oai extends \Kitodo\Dlf\Common\AbstractPlugin {
class OaiPmh extends \Kitodo\Dlf\Common\AbstractPlugin {
public $scriptRelPath = 'plugins/oai/class.tx_dlf_oai.php';
public $scriptRelPath = 'Classes/Plugins/OaiPmh.php';
/**
* Did an error occur?
@ -82,7 +84,7 @@ class tx_dlf_oai extends \Kitodo\Dlf\Common\AbstractPlugin {
if ($GLOBALS['TYPO3_DB']->sql_affected_rows() === -1) {
// Deletion failed.
$this->devLog('[tx_dlf_oai->deleteExpiredTokens()] Could not delete expired resumption tokens', SYSLOG_SEVERITY_WARNING);
$this->devLog('[\Kitodo\Dlf\Plugins\OaiPmh->deleteExpiredTokens()] Could not delete expired resumption tokens', SYSLOG_SEVERITY_WARNING);
}
}
@ -325,10 +327,10 @@ class tx_dlf_oai extends \Kitodo\Dlf\Common\AbstractPlugin {
// Import node into \DOMDocument.
$mets = $this->oai->importNode($root->item(0), TRUE);
} else {
$this->devLog('[tx_dlf_oai->getMetsData([data])] No METS part found in document with location "'.$metadata['location'].'"', SYSLOG_SEVERITY_ERROR, $metadata);
$this->devLog('[\Kitodo\Dlf\Plugins\OaiPmh->getMetsData([data])] No METS part found in document with location "'.$metadata['location'].'"', SYSLOG_SEVERITY_ERROR, $metadata);
}
} else {
$this->devLog('[tx_dlf_oai->getMetsData([data])] Could not load XML file from "'.$metadata['location'].'"', SYSLOG_SEVERITY_ERROR, $metadata);
$this->devLog('[\Kitodo\Dlf\Plugins\OaiPmh->getMetsData([data])] Could not load XML file from "'.$metadata['location'].'"', SYSLOG_SEVERITY_ERROR, $metadata);
}
if ($mets === NULL) {
@ -381,7 +383,7 @@ class tx_dlf_oai extends \Kitodo\Dlf\Common\AbstractPlugin {
} else {
// Use default stylesheet if no custom stylesheet is given.
$stylesheet = \TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/oai/transform.xsl');
$stylesheet = \TYPO3\CMS\Core\Utility\GeneralUtility::locationHeaderUrl(\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'Resources/Public/Stylesheets/OaiPmh.xsl');
}
$this->oai->appendChild($this->oai->createProcessingInstruction('xml-stylesheet', 'type="text/xsl" href="'.htmlspecialchars($stylesheet, ENT_NOQUOTES, 'UTF-8').'"'));
@ -625,7 +627,7 @@ class tx_dlf_oai extends \Kitodo\Dlf\Common\AbstractPlugin {
$repositoryName = htmlspecialchars($resArray['oai_label'], ENT_NOQUOTES);
} else {
$this->devLog('[tx_dlf_oai->verbIdentify()] Incomplete plugin configuration', SYSLOG_SEVERITY_NOTICE);
$this->devLog('[\Kitodo\Dlf\Plugins\OaiPmh->verbIdentify()] Incomplete plugin configuration', SYSLOG_SEVERITY_NOTICE);
}
// Get earliest datestamp. Use a default value if that fails.
@ -645,7 +647,7 @@ class tx_dlf_oai extends \Kitodo\Dlf\Common\AbstractPlugin {
list ($timestamp) = $GLOBALS['TYPO3_DB']->sql_fetch_row($result);
$earliestDatestamp = gmdate('Y-m-d\TH:i:s\Z', $timestamp);
} else {
$this->devLog('[tx_dlf_oai->verbIdentify()] No records found with PID "'.$this->conf['pages'].'"', SYSLOG_SEVERITY_NOTICE);
$this->devLog('[\Kitodo\Dlf\Plugins\OaiPmh->verbIdentify()] No records found with PID "'.$this->conf['pages'].'"', SYSLOG_SEVERITY_NOTICE);
}
$linkConf = array (
@ -1126,7 +1128,7 @@ class tx_dlf_oai extends \Kitodo\Dlf\Common\AbstractPlugin {
$resumptionToken = $this->oai->createElementNS('http://www.openarchives.org/OAI/2.0/', 'resumptionToken', htmlspecialchars($token, ENT_NOQUOTES, 'UTF-8'));
} else {
$this->devLog('[tx_dlf_oai->verb'.$this->piVars['verb'].'()] Could not create resumption token', SYSLOG_SEVERITY_ERROR);
$this->devLog('[\Kitodo\Dlf\Plugins\OaiPmh->verb'.$this->piVars['verb'].'()] Could not create resumption token', SYSLOG_SEVERITY_ERROR);
}
} else {
@ -1148,8 +1150,3 @@ class tx_dlf_oai extends \Kitodo\Dlf\Common\AbstractPlugin {
}
}
if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/dlf/plugins/oai/class.tx_dlf_oai.php']) {
include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/dlf/plugins/oai/class.tx_dlf_oai.php']);
}

24
plugins/pagegrid/class.tx_dlf_pagegrid.php → Classes/Plugins/PageGrid.php

@ -1,4 +1,6 @@
<?php
namespace Kitodo\Dlf\Plugins;
/**
* (c) Kitodo. Key to digital objects e.V. <contact@kitodo.org>
*
@ -10,17 +12,17 @@
*/
/**
* Plugin 'DLF: Page Preview' for the 'dlf' extension.
* Plugin 'Page Grid' for the 'dlf' extension.
*
* @author Henrik Lochmann <dev@mentalmotive.com>
* @author Sebastian Meyer <sebastian.meyer@slub-dresden.de>
* @package TYPO3
* @subpackage tx_dlf
* @subpackage dlf
* @access public
*/
class tx_dlf_pagegrid extends \Kitodo\Dlf\Common\AbstractPlugin {
class PageGrid extends \Kitodo\Dlf\Common\AbstractPlugin {
public $scriptRelPath = 'plugins/pagegrid/class.tx_dlf_pagegrid.php';
public $scriptRelPath = 'Classes/Plugins/PageGrid.php';
/**
* Renders entry for one page of the current document.
@ -62,7 +64,7 @@ class tx_dlf_pagegrid extends \Kitodo\Dlf\Common\AbstractPlugin {
} else {
$thumbnailFile = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pagegrid/placeholder.jpg';
$thumbnailFile = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'Resources/Public/Images/PageGridPlaceholder.jpg';
}
@ -198,15 +200,7 @@ class tx_dlf_pagegrid extends \Kitodo\Dlf\Common\AbstractPlugin {
}
// Load template file.
if (!empty($this->conf['templateFile'])) {
$this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###');
} else {
$this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/pagegrid/template.tmpl'), '###TEMPLATE###');
}
$this->getTemplate();
$entryTemplate = $this->cObj->getSubpart($this->template, '###ENTRY###');
@ -214,7 +208,7 @@ class tx_dlf_pagegrid extends \Kitodo\Dlf\Common\AbstractPlugin {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_pagegrid->main('.$content.', [data])] No template subpart for list entry found', $this->extKey, SYSLOG_SEVERITY_WARNING, $conf);
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Plugins\PageGrid->main('.$content.', [data])] No template subpart for list entry found', $this->extKey, SYSLOG_SEVERITY_WARNING, $conf);
}

44
plugins/pageview/class.tx_dlf_pageview.php → Classes/Plugins/PageView.php

@ -1,4 +1,6 @@
<?php
namespace Kitodo\Dlf\Plugins;
/**
* (c) Kitodo. Key to digital objects e.V. <contact@kitodo.org>
*
@ -10,16 +12,16 @@
*/
/**
* Plugin 'DLF: Pageview' for the 'dlf' extension.
* Plugin 'Page View' for the 'dlf' extension.
*
* @author Sebastian Meyer <sebastian.meyer@slub-dresden.de>
* @package TYPO3
* @subpackage tx_dlf
* @subpackage dlf
* @access public
*/
class tx_dlf_pageview extends \Kitodo\Dlf\Common\AbstractPlugin {
class PageView extends \Kitodo\Dlf\Common\AbstractPlugin {
public $scriptRelPath = 'plugins/pageview/class.tx_dlf_pageview.php';
public $scriptRelPath = 'Classes/Plugins/PageView.php';
/**
* Holds the controls to add to the map
@ -64,21 +66,21 @@ class tx_dlf_pageview extends \Kitodo\Dlf\Common\AbstractPlugin {
$output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'Resources/Public/Javascript/OpenLayers/ol3-dlf.js"></script>';
// Add viewer library.
$output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pageview/tx_dlf_utils.js"></script>';
$output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'Resources/Public/Javascript/PageView/Utility.js"></script>';
$output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pageview/tx_dlf_ol3.js"></script>';
$output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'Resources/Public/Javascript/PageView/OL3.js"></script>';
$output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pageview/tx_dlf_ol3_styles.js"></script>';
$output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'Resources/Public/Javascript/PageView/OL3Styles.js"></script>';
$output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pageview/tx_dlf_ol3_source.js"></script>';
$output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'Resources/Public/Javascript/PageView/OL3Sources.js"></script>';
$output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pageview/tx_dlf_altoparser.js"></script>';
$output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'Resources/Public/Javascript/PageView/AltoParser.js"></script>';
$output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pageview/tx_dlf_pageview_imagemanipulation_control.js"></script>';
$output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'Resources/Public/Javascript/PageView/ImageManipulationControl.js"></script>';
$output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pageview/tx_dlf_pageview_fulltext_control.js"></script>';
$output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'Resources/Public/Javascript/PageView/FulltextControl.js"></script>';
$output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/pageview/tx_dlf_pageview.js"></script>';
$output[] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'Resources/Public/Javascript/PageView/PageView.js"></script>';
// Add viewer configuration.
$output[] = '
@ -250,7 +252,7 @@ class tx_dlf_pageview extends \Kitodo\Dlf\Common\AbstractPlugin {
// Configure @action URL for form.
$linkConf = array (
'parameter' => $GLOBALS['TSFE']->id,
'additionalParams' => '&eID=tx_dlf_geturl_eid&url='.urlencode($image['url']),
'additionalParams' => '&eID=tx_dlf_pageview_proxy&url='.urlencode($image['url']),
);
$image['url'] = $this->cObj->typoLink_URL($linkConf);
@ -264,7 +266,7 @@ class tx_dlf_pageview extends \Kitodo\Dlf\Common\AbstractPlugin {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_pageview->getImage('.$page.')] File not found in fileGrp "'.$fileGrp.'"', $this->extKey, SYSLOG_SEVERITY_WARNING);
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Plugins\PageView->getImage('.$page.')] File not found in fileGrp "'.$fileGrp.'"', $this->extKey, SYSLOG_SEVERITY_WARNING);
}
@ -297,7 +299,7 @@ class tx_dlf_pageview extends \Kitodo\Dlf\Common\AbstractPlugin {
// Configure @action URL for form.
$linkConf = array (
'parameter' => $GLOBALS['TSFE']->id,
'additionalParams' => '&eID=tx_dlf_geturl_eid&url='.urlencode($fulltext['url']),
'additionalParams' => '&eID=tx_dlf_pageview_proxy&url='.urlencode($fulltext['url']),
);
$fulltext['url'] = $this->cObj->typoLink_URL($linkConf);
@ -308,7 +310,7 @@ class tx_dlf_pageview extends \Kitodo\Dlf\Common\AbstractPlugin {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_pageview->getFulltext('.$page.')] File not found in fileGrp "'.$this->conf['fileGrpFulltext'].'"', $this->extKey, SYSLOG_SEVERITY_WARNING);
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Plugins\PageView->getFulltext('.$page.')] File not found in fileGrp "'.$this->conf['fileGrpFulltext'].'"', $this->extKey, SYSLOG_SEVERITY_WARNING);
}
@ -367,15 +369,7 @@ class tx_dlf_pageview extends \Kitodo\Dlf\Common\AbstractPlugin {
}
// Load template file.
if (!empty($this->conf['templateFile'])) {
$this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###');
} else {
$this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/pageview/template.tmpl'), '###TEMPLATE###');
}
$this->getTemplate();
// Get image data.
$this->images[0] = $this->getImage($this->piVars['page']);

36
plugins/search/class.tx_dlf_search.php → Classes/Plugins/Search.php

@ -1,4 +1,6 @@
<?php
namespace Kitodo\Dlf\Plugins;
/**
* (c) Kitodo. Key to digital objects e.V. <contact@kitodo.org>
*
@ -16,18 +18,18 @@ use Kitodo\Dlf\Common\Indexer;
use Kitodo\Dlf\Common\Solr;
/**
* Plugin 'DLF: Search' for the 'dlf' extension.
* Plugin 'Search' for the 'dlf' extension.
*
* @author Sebastian Meyer <sebastian.meyer@slub-dresden.de>
* @author Henrik Lochmann <dev@mentalmotive.com>
* @author Frank Ulrich Weber <fuw@zeutschel.de>
* @package TYPO3
* @subpackage tx_dlf
* @subpackage dlf
* @access public
*/
class tx_dlf_search extends \Kitodo\Dlf\Common\AbstractPlugin {
class Search extends \Kitodo\Dlf\Common\AbstractPlugin {
public $scriptRelPath = 'plugins/search/class.tx_dlf_search.php';
public $scriptRelPath = 'Classes/Plugins/Search.php';
/**
* Adds the JS files necessary for search suggestions
@ -50,13 +52,13 @@ class tx_dlf_search extends \Kitodo\Dlf\Common\AbstractPlugin {
if ($GLOBALS['TYPO3_DB']->sql_num_rows($result)) {
$GLOBALS['TSFE']->additionalHeaderData[$this->prefixId.'_search_suggest'] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'plugins/search/tx_dlf_search_suggest.js"></script>';
$GLOBALS['TSFE']->additionalHeaderData[$this->prefixId.'_search_suggest'] = '<script type="text/javascript" src="'.\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::siteRelPath($this->extKey).'Resources/Public/Javascript/Search/Suggester.js"></script>';
} else {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_search->addAutocompleteJS()] No metadata fields configured for search suggestions', $this->extKey, SYSLOG_SEVERITY_WARNING);
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Plugins\Search->addAutocompleteJS()] No metadata fields configured for search suggestions', $this->extKey, SYSLOG_SEVERITY_WARNING);
}
@ -251,7 +253,7 @@ class tx_dlf_search extends \Kitodo\Dlf\Common\AbstractPlugin {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_search->addFacetsMenu()] Incomplete plugin configuration', $this->extKey, SYSLOG_SEVERITY_WARNING);
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Plugins\Search->addFacetsMenu()] Incomplete plugin configuration', $this->extKey, SYSLOG_SEVERITY_WARNING);
}
@ -280,7 +282,7 @@ class tx_dlf_search extends \Kitodo\Dlf\Common\AbstractPlugin {
$TSconfig['special'] = 'userfunction';
$TSconfig['special.']['userFunc'] = 'tx_dlf_search->makeFacetsMenuArray';
$TSconfig['special.']['userFunc'] = 'Kitodo\\Dlf\\Plugins\\Search->makeFacetsMenuArray';
$TSconfig['special.']['facets'] = $facets;
@ -453,7 +455,7 @@ class tx_dlf_search extends \Kitodo\Dlf\Common\AbstractPlugin {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_search->main('.$content.', [data])] Incomplete plugin configuration', $this->extKey, SYSLOG_SEVERITY_WARNING, $conf);
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Plugins\Search->main('.$content.', [data])] Incomplete plugin configuration', $this->extKey, SYSLOG_SEVERITY_WARNING, $conf);
}
@ -486,15 +488,7 @@ class tx_dlf_search extends \Kitodo\Dlf\Common\AbstractPlugin {
}
// Load template file.
if (!empty($this->conf['templateFile'])) {
$this->template = $this->cObj->getSubpart($this->cObj->fileResource($this->conf['templateFile']), '###TEMPLATE###');
} else {
$this->template = $this->cObj->getSubpart($this->cObj->fileResource('EXT:dlf/plugins/search/template.tmpl'), '###TEMPLATE###');
}
$this->getTemplate();
// Configure @action URL for form.
$linkConf = array (
@ -533,7 +527,7 @@ class tx_dlf_search extends \Kitodo\Dlf\Common\AbstractPlugin {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_search->main('.$content.', [data])] Apache Solr not available', $this->extKey, SYSLOG_SEVERITY_ERROR, $conf);
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Plugins\Search->main('.$content.', [data])] Apache Solr not available', $this->extKey, SYSLOG_SEVERITY_ERROR, $conf);
}
@ -673,7 +667,7 @@ class tx_dlf_search extends \Kitodo\Dlf\Common\AbstractPlugin {
if (TYPO3_DLOG) {
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[tx_dlf_search->main('.$content.', [data])] Apache Solr not available', $this->extKey, SYSLOG_SEVERITY_ERROR, $conf);
\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('[\Kitodo\Dlf\Plugins\Search->main('.$content.', [data])] Apache Solr not available', $this->extKey, SYSLOG_SEVERITY_ERROR, $conf);