Cleaned up some code, verified compatibility with TYPO3 4.7, raised requirements...
authorfrancois <francois@735d13b6-9817-0410-8766-e36946ffe9aa>
Tue, 26 Jun 2012 12:07:48 +0000 (12:07 +0000)
committerfrancois <francois@735d13b6-9817-0410-8766-e36946ffe9aa>
Tue, 26 Jun 2012 12:07:48 +0000 (12:07 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Extensions/phpdisplay/trunk@63926 735d13b6-9817-0410-8766-e36946ffe9aa

ChangeLog
Configuration/TCA/tx_phpdisplay_displays.php
class.tx_phpdisplay.php
class.tx_phpdisplay_template.php
doc/manual.pdf
doc/manual.sxw
ext_emconf.php
samples/dummy.php

index b690570..6c5755e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2012-06-26 Francois Suter (Cobweb)  <typo3@cobweb.ch>
+
+       * Cleaned up some code, verified compatibility with TYPO3 4.7, raised requirements to TYPO3 4.5, resolves #38395
+
 2012-01-08 Francois Suter (Cobweb)  <typo3@cobweb.ch>
 
        * Replaced reference to parent object with new, general member variable, resolves #33053
index 58b08b9..5cc4ba6 100644 (file)
@@ -39,7 +39,6 @@ $TCA['tx_phpdisplay_displays'] = array(
                        'label' => 'LLL:EXT:phpdisplay/Resources/Private/Language/locallang_db.xml:tx_phpdisplay_displays.template',
                        'config' => array(
                                'type' => 'input',
-                               'default' => 'fileadmin/templates/plugins/tesseract/list_of_news.php',
                                'size' => '30',
                                'eval' => 'trim',
                                'default' => 'FILE:EXT:phpdisplay/samples/dummy.php',
index b1e8a1d..be3d1d2 100644 (file)
@@ -37,7 +37,7 @@ class tx_phpdisplay extends tx_tesseract_feconsumerbase {
 
        public $tsKey = 'tx_phpdisplay';
        public $extKey = 'phpdisplay';
-       protected $conf;
+       protected $configuration;
        protected $table; // Name of the table where the details about the data display are stored
        protected $uid; // Primary key of the record to fetch for the details
        protected $structure = array(); // Input standardised data structure
@@ -68,15 +68,6 @@ class tx_phpdisplay extends tx_tesseract_feconsumerbase {
        }
 
        /**
-        * Return the controller data.
-        *
-        * @return      array
-        */
-       public function getController() {
-               return $this->controller;
-       }
-
-       /**
         * Return the filter data.
         *
         * @return      array
@@ -153,7 +144,8 @@ class tx_phpdisplay extends tx_tesseract_feconsumerbase {
        /**
         * This method sets the result. Useful for hooks.
         *
-        * @return      void
+        * @param mixed $result Predefined result
+        * @return void
         */
        public function setResult($result) {
 
@@ -168,7 +160,7 @@ class tx_phpdisplay extends tx_tesseract_feconsumerbase {
        public function startProcess() {
 
                if (isset($GLOBALS['_GET']['debug']['structure']) && isset($GLOBALS['TYPO3_MISC']['microtime_BE_USER_start'])) {
-                       t3lib_div::debug($this->structure);
+                       t3lib_utility_Debug::debug($this->structure);
                }
                // Initializes local cObj
                $this->localCObj = t3lib_div::makeInstance('tslib_cObj');
@@ -183,6 +175,7 @@ class tx_phpdisplay extends tx_tesseract_feconsumerbase {
                }
 
                if (is_file($templateFile)) {
+                               /** @var $template tx_phpdisplay_template */
                        $template = t3lib_div::makeInstance('tx_phpdisplay_template');
                        $template->set('controller', $this->getController());
                        $template->set('filter', $this->getFilter());
@@ -202,11 +195,11 @@ class tx_phpdisplay extends tx_tesseract_feconsumerbase {
        protected function debug() {
 
                if (isset($GLOBALS['_GET']['debug']['structure']) && $GLOBALS['TSFE']->beUserLogin) {
-                       t3lib_div::debug($this->getDataStructure());
+                       t3lib_utility_Debug::debug($this->getDataStructure());
                }
 
                if (isset($GLOBALS['_GET']['debug']['filter']) && $GLOBALS['TSFE']->beUserLogin) {
-                       t3lib_div::debug($this->getFilter());
+                       t3lib_utility_Debug::debug($this->getFilter());
                }
        }
 
index 0da97d1..4c95fd5 100644 (file)
@@ -54,12 +54,13 @@ class tx_phpdisplay_template {
         * Open, parse, and return the template file.
         *
         * @param $file string the template file name
+        * @return string The content of the template file
         */
        function fetch($file = null){
                if(! $file) {
                        $file = $this->file;
                }
-               
+
                extract($this->vars); // Extract the vars to local namespace
                ob_start(); // Start output buffering
                include ($file); // Include the file
index 8e213f2..12f79ca 100644 (file)
Binary files a/doc/manual.pdf and b/doc/manual.pdf differ
index 25f6031..6dc173c 100755 (executable)
Binary files a/doc/manual.sxw and b/doc/manual.sxw differ
index 836bf8a..54bbbc3 100644 (file)
@@ -32,7 +32,7 @@ $EM_CONF[$_EXTKEY] = array(
        'version' => '1.1.0',
        'constraints' => array(
                'depends' => array(
-                       'typo3' => '4.3.0-0.0.0',
+                       'typo3' => '4.5.0-4.7.99',
                        'tesseract' => '1.0.0-0.0.0',
                ),
                'conflicts' => array(
index 6b4f62d..9c25cb9 100644 (file)
@@ -1 +1 @@
-<!-- Looping around $records -->\r<b>It works!</b> See content of FILE:EXT:phpdisplay/samples/dummy.php to have more examples.\r<br />\r\r<!-- PHP TEMPLATE SYNTAX FOR HTML -->\r<?php if (! empty($datastructure['page']['records'])): ?>\r <?php foreach($datastructure['page']['records'] as $record): ?>\r                <?php print $record['title'] ?>\r        <?php endforeach ?>\r<?php endif ?>\r\r<?php\r      // debug\r       #t3lib_div::debug($datastructure,'debug');\r     #t3lib_div::debug($filter,'debug');\r    \r       // CObj\r        $localCObj = t3lib_div::makeInstance('tslib_cObj');\r    $localCObj->start(array(), '');\r        \r       // Parameters\r  $parameters = t3lib_div::_GP('tx_displaycontroller');\r  \r       // FE USER\r     $feUser = $GLOBALS['TSFE']->fe_user->user;\r     $feUserUid = $GLOBALS['TSFE']->fe_user->user['uid']; \r\r // link\r        $localCObj->start($record);\r    $config = array();\r     $config['returnLast'] = 'url';\r $config['parameter.']['data'] = 'TSFE:tmpl|setup|plugin.|tx_speciality.|courses_detail_pid';\r   $config['additionalParams'] = '&tx_displaycontroller[table]=courses&tx_displaycontroller[showUid]={field:uid}';\r        $config['additionalParams.']['insertData'] = 1;\r        $link = $localCObj->typolink('',$config);\r\r     // Generating thumbnails\r       $configThumbnail = array();\r    $configThumbnail['file'] = $record['file'];\r    $configThumbnail['altText'] = $record['title'];\r        $configThumbnail['file.']['height'] = 70; \r     $configThumbnail['file.']['width'] = 50; \r      $configThumbnail['file.']['minW'] = 70; \r       $configThumbnail['file.']['minH'] = 50; \r       $htmlThumbnail = $localCObj->IMAGE($configThumbnail);\r\r\r        // Generating thumbnails from PDF\r      $configThumbnail = array();\r    $configThumbnail['file'] = $record['file'];\r    $configThumbnail['altText'] = $record['title'];\r        #$configThumbnail['file.']['height'] = 70; \r    $configThumbnail['file.']['width'] = 50; \r      #$configThumbnail['file.']['minW'] = 70; \r      #$configThumbnail['file.']['minH'] = 50; \r      $configThumbnail['file.']['import.']['cObject'] = 'IMG_RESOURCE';\r      $configThumbnail['file.']['import.']['cObject.']['ext'] = 'jpg';\r       $configThumbnail['file.']['import.']['cObject.']['quality'] = '100';\r   $configThumbnail['file.']['import.']['cObject.']['file.']['params'] = '-trim';\r $configThumbnail['file.']['import.']['cObject.']['file'] = $configThumbnail['file'];\r   #$configThumbnail['file.']['import.']['cObject.']['file.']['width'] = '1080';\r  $htmlThumbnail = $localCObj->IMAGE($configThumbnail);\r  \r       // TypoScript configuration\r    $configuration = $TSFE->tmpl->setup['config.'];\r        \r       // Language support\r    $LANG = t3lib_div::makeInstance('Language');\r   $LANG->lang = $configuration['language'];\r      $LANG->charSet = 'utf-8';\r      $LANG->includeLLFile('EXT:speciality/Resources/Private/locallang.xml');\r        \r       print $LANG->getLL('cat');\r     print $LANG->sL('LLL:EXT:speciality/Resources/Private/locallang.xml');\r \r       // RTE\r $config['parseFunc.'] = $GLOBALS['TSFE']->tmpl->setup['lib.']['parseFunc_RTE.'];\r       $config['value'] = $record['bodytext'];\r        $value = $localCObj->TEXT($config);\r    \r       // PAGEBROWSE\r  $conf = $GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_pagebrowse_pi1.'];\r        $conf['pageParameterName'] = 'tx_displaycontroller|page';\r      \r       \r       // Adds limit to the query and calculates the number of pages.\r if ($filter['limit']['max'] != '' && $filter['limit']['max'] != '0') {\r         //$conf['extraQueryString'] .= '&' . $this->pObj->getPrefixId() . '[max]=' . $filter['limit']['max'];\r          $conf['numberOfPages'] = ceil($datastructure['news']['totalCount'] / $filter['limit']['max']);\r         $conf['items_per_page'] = $filter['limit']['max'];\r             $conf['total_items'] = $datastructure['news']['totalCount'];\r           $conf['total_pages'] = $conf['numberOfPages']; // duplicated, because $conf['numberOfPages'] is protected\r      }\r      else {\r         $conf['numberOfPages'] = 1;\r    }\r      \r       // Defines other possible pagebrowse configuration options\r     #$conf['enableMorePages'] = '';\r        #$conf['enableLessPages'] = '';\r        #$conf['pagesBefore'] = '';\r    #$conf['pagesAfter'] = '';\r     \r       /* @var $cObj tslib_cObj */\r    print $localCObj->cObjGetSingle('USER', $conf);\r?>\r
\ No newline at end of file
+<!-- Looping around $records -->\r<b>It works!</b> See content of FILE:EXT:phpdisplay/samples/dummy.php to have more examples.\r<br />\r\r<!-- PHP TEMPLATE SYNTAX FOR HTML -->\r<?php if (! empty($datastructure['page']['records'])): ?>\r <?php foreach($datastructure['page']['records'] as $record): ?>\r                <?php print $record['title'] ?>\r        <?php endforeach ?>\r<?php endif ?>\r\r<?php\r      // debug\r       #t3lib_utility_Debug::debug($datastructure,'debug');\r   #t3lib_utility_Debug::debug($filter,'debug');\r\r  /** @var $localCObj tslib_cObj */\r     $localCObj = t3lib_div::makeInstance('tslib_cObj');\r    $localCObj->start(array(), '');\r\r       // Parameters\r  $parameters = t3lib_div::_GP('tx_displaycontroller');\r\r // FE USER\r     $feUser = $GLOBALS['TSFE']->fe_user->user;\r     $feUserUid = $GLOBALS['TSFE']->fe_user->user['uid'];\r\r  // link\r        $localCObj->start($record);\r    $config = array();\r     $config['returnLast'] = 'url';\r $config['parameter.']['data'] = 'TSFE:tmpl|setup|plugin.|tx_speciality.|courses_detail_pid';\r   $config['additionalParams'] = '&tx_displaycontroller[table]=courses&tx_displaycontroller[showUid]={field:uid}';\r        $config['additionalParams.']['insertData'] = 1;\r        $link = $localCObj->typolink('',$config);\r\r     // Generating thumbnails\r       $configThumbnail = array();\r    $configThumbnail['file'] = $record['file'];\r    $configThumbnail['altText'] = $record['title'];\r        $configThumbnail['file.']['height'] = 70;\r      $configThumbnail['file.']['width'] = 50;\r       $configThumbnail['file.']['minW'] = 70;\r        $configThumbnail['file.']['minH'] = 50;\r        $htmlThumbnail = $localCObj->IMAGE($configThumbnail);\r\r\r        // Generating thumbnails from PDF\r      $configThumbnail = array();\r    $configThumbnail['file'] = $record['file'];\r    $configThumbnail['altText'] = $record['title'];\r        #$configThumbnail['file.']['height'] = 70;\r     $configThumbnail['file.']['width'] = 50;\r       #$configThumbnail['file.']['minW'] = 70;\r       #$configThumbnail['file.']['minH'] = 50;\r       $configThumbnail['file.']['import.']['cObject'] = 'IMG_RESOURCE';\r      $configThumbnail['file.']['import.']['cObject.']['ext'] = 'jpg';\r       $configThumbnail['file.']['import.']['cObject.']['quality'] = '100';\r   $configThumbnail['file.']['import.']['cObject.']['file.']['params'] = '-trim';\r $configThumbnail['file.']['import.']['cObject.']['file'] = $configThumbnail['file'];\r   #$configThumbnail['file.']['import.']['cObject.']['file.']['width'] = '1080';\r  $htmlThumbnail = $localCObj->IMAGE($configThumbnail);\r\r // TypoScript configuration\r    $configuration = $TSFE->tmpl->setup['config.'];\r\r       // Language support\r    /** @var $LANG Language */\r     $LANG = t3lib_div::makeInstance('Language');\r   $LANG->lang = $configuration['language'];\r      $LANG->charSet = 'utf-8';\r      $LANG->includeLLFile('EXT:speciality/Resources/Private/locallang.xml');\r\r       print $LANG->getLL('cat');\r     print $LANG->sL('LLL:EXT:speciality/Resources/Private/locallang.xml');\r\r        // RTE\r $config['parseFunc.'] = $GLOBALS['TSFE']->tmpl->setup['lib.']['parseFunc_RTE.'];\r       $config['value'] = $record['bodytext'];\r        $value = $localCObj->TEXT($config);\r\r   // PAGEBROWSE\r  $conf = $GLOBALS['TSFE']->tmpl->setup['plugin.']['tx_pagebrowse_pi1.'];\r        $conf['pageParameterName'] = 'tx_displaycontroller|page';\r\r\r    // Adds limit to the query and calculates the number of pages.\r if ($filter['limit']['max'] != '' && $filter['limit']['max'] != '0') {\r         //$conf['extraQueryString'] .= '&' . $this->pObj->getPrefixId() . '[max]=' . $filter['limit']['max'];\r          $conf['numberOfPages'] = ceil($datastructure['news']['totalCount'] / $filter['limit']['max']);\r         $conf['items_per_page'] = $filter['limit']['max'];\r             $conf['total_items'] = $datastructure['news']['totalCount'];\r           $conf['total_pages'] = $conf['numberOfPages']; // duplicated, because $conf['numberOfPages'] is protected\r      }\r      else {\r         $conf['numberOfPages'] = 1;\r    }\r\r     // Defines other possible pagebrowse configuration options\r     #$conf['enableMorePages'] = '';\r        #$conf['enableLessPages'] = '';\r        #$conf['pagesBefore'] = '';\r    #$conf['pagesAfter'] = '';\r\r    /* @var $cObj tslib_cObj */\r    print $localCObj->cObjGetSingle('USER', $conf);\r?>\r
\ No newline at end of file