Added feature #11431: Hook to manipulate the page request in method getPage of class...
authorChristian Kuhn <lolli@schwarzbu.ch>
Sun, 30 Aug 2009 13:54:33 +0000 (13:54 +0000)
committerChristian Kuhn <lolli@schwarzbu.ch>
Sun, 30 Aug 2009 13:54:33 +0000 (13:54 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@5845 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
t3lib/class.t3lib_page.php
t3lib/core_autoload.php
t3lib/interfaces/interface.t3lib_pageselect_getpagehook.php [new file with mode: 0644]

index a3288ca..53e24f8 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2009-08-30  Christian Kuhn  <lolli@schwarzbu.ch>
+
+       * Added feature #11431: Hook to manipulate the page request in method getPage of class t3lib_pageSelect
+
 2009-08-30  Rupert Germann  <rupi@gmx.li>
 
        * Fixed bug #11808: Increase performance using mbstring in t3lib_cs->crop (thanks to Timo Schmidt)
index fd7f0bf..514addf 100644 (file)
@@ -188,6 +188,19 @@ class t3lib_pageSelect {
         * @see getPage_noCheck()
         */
        function getPage($uid, $disableGroupAccessCheck=FALSE)  {
+                       // Hook to manipulate the page uid for special overlay handling
+               if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_page.php']['getPage'])) {
+                       foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_page.php']['getPage'] as $classRef) {
+                               $hookObject = t3lib_div::getUserObj($classRef);
+
+                               if (!($hookObject instanceof t3lib_pageSelect_getPageHook)) {
+                                       throw new UnexpectedValueException('$hookObject must implement interface t3lib_pageSelect_getPageHook', 1251476766);
+                               }
+
+                               $hookObject->getPage_preProcess($uid, $disableGroupAccessCheck, $this);
+                       }
+               }
+
                $accessCheck = $disableGroupAccessCheck ? '' : $this->where_groupAccess;
                $cacheKey = md5($accessCheck . '-' . $this->where_hid_del . '-' . $this->sys_language_uid);
 
index 80dde04..9f0e518 100644 (file)
@@ -40,6 +40,7 @@ return array(
        't3lib_matchcondition' => PATH_t3lib . 'class.t3lib_matchcondition.php',
        't3lib_modsettings' => PATH_t3lib . 'class.t3lib_modsettings.php',
        't3lib_pageselect' => PATH_t3lib . 'class.t3lib_page.php',
+       't3lib_pageselect_getpagehook' => PATH_t3lib . 'interfaces/interface.t3lib_pageselect_getpagehook.php',
        't3lib_pagetree' => PATH_t3lib . 'class.t3lib_pagetree.php',
        't3lib_parsehtml' => PATH_t3lib . 'class.t3lib_parsehtml.php',
        't3lib_parsehtml_proc' => PATH_t3lib . 'class.t3lib_parsehtml_proc.php',
diff --git a/t3lib/interfaces/interface.t3lib_pageselect_getpagehook.php b/t3lib/interfaces/interface.t3lib_pageselect_getpagehook.php
new file mode 100644 (file)
index 0000000..4bce46d
--- /dev/null
@@ -0,0 +1,51 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2009 Christian Kuhn <lolli@schwarzbu.ch>
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*  A copy is found in the textfile GPL.txt and important notices to the license
+*  from the author is found in LICENSE.txt distributed with these scripts.
+*
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+
+/**
+ * Interface for classes which hook into pageSelect and do additional getPage processing
+ *
+ * @author     Christian Kuhn <lolli@schwarzbu.ch>
+ * @package TYPO3
+ * @subpackage t3lib
+ */
+
+interface t3lib_pageSelect_getPageHook {
+
+       /**
+        * Modifies the DB params
+        *
+        * @param       integer         The page ID
+        * @param       boolean         If set, the check for group access is disabled. VERY rarely used
+        * @param       t3lib_pageSelect                parent t3lib_pageSelect object
+        * @return      void
+        */
+       public function getPage_preProcess(&$uid, &$disableGroupAccessCheck, t3lib_pageSelect $parentObject);
+
+}
+
+?>