|
1 | 1 | <?php |
2 | | -namespace Aoe\Linkhandler; |
| 2 | +namespace Cobweb\Linkhandler; |
3 | 3 |
|
4 | | -/* * |
5 | | - * This script belongs to the TYPO3 extension "linkhandler". * |
6 | | - * * |
7 | | - * It is free software; you can redistribute it and/or modify it under * |
8 | | - * the terms of the GNU General Public License as published by the Free * |
9 | | - * Software Foundation, either version 3 of the License, or (at your * |
10 | | - * option) any later version. * |
11 | | - * * |
12 | | - * This script is distributed in the hope that it will be useful, but * |
13 | | - * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- * |
14 | | - * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General * |
15 | | - * Public License for more details. * |
16 | | - * * |
17 | | - * You should have received a copy of the GNU General Public License * |
18 | | - * along with the script. * |
19 | | - * If not, see http://www.gnu.org/licenses/gpl.html * |
20 | | - * * |
21 | | - * The TYPO3 project - inspiring people to share! * |
22 | | - * */ |
| 4 | +/* |
| 5 | + * This file is part of the TYPO3 CMS project. |
| 6 | + * |
| 7 | + * It is free software; you can redistribute it and/or modify it under |
| 8 | + * the terms of the GNU General Public License, either version 2 |
| 9 | + * of the License, or any later version. |
| 10 | + * |
| 11 | + * For the full copyright and license information, please read the |
| 12 | + * LICENSE.txt file that was distributed with this source code. |
| 13 | + * |
| 14 | + * The TYPO3 project - inspiring people to share! |
| 15 | + */ |
23 | 16 |
|
24 | 17 | use \TYPO3\CMS\Core\Utility\GeneralUtility; |
25 | 18 |
|
26 | 19 | /** |
27 | | - * This class will be called by the signal slot dispatcher in the SoftReferenceIndex. |
| 20 | + * Class called by the signal slot dispatcher in the SoftReferenceIndex. |
28 | 21 | * |
29 | 22 | * @author Michael Klapper <[email protected]>> |
30 | 23 | * @author Alexander Stehlik <[email protected]> |
@@ -54,64 +47,53 @@ public function getTypoLinkParts($linkHandlerFound, $finalTagParts, $linkHandler |
54 | 47 | } |
55 | 48 |
|
56 | 49 | /** |
57 | | - * Will be called by the SoftReferenceIndex signal slot for updating the given SoftReference information. |
| 50 | + * Updates the soft reference information. |
58 | 51 | * |
59 | 52 | * @param bool $linkHandlerFound Set this to TRUE in the returning array to tell the parent class that we succeeded. |
60 | | - * @param array $tLP TypoLink properties. |
| 53 | + * @param array $typolinkProperties TypoLink properties. |
61 | 54 | * @param string $content The content to process. |
62 | 55 | * @param array $elements Reference to the array of elements to be modified with substitution / information entries. |
63 | | - * @param string $idx Index value of the found element - user to make unique but stable tokenID |
64 | | - * @param string $tokenID Unique identifyer for a link of an record |
| 56 | + * @param string $index Index value of the found element - user to make unique but stable tokenID |
| 57 | + * @param string $tokenID Unique identifier for a link to a record |
65 | 58 | * @param \TYPO3\CMS\Core\Database\SoftReferenceIndex $softReferenceIndex |
66 | 59 | * @return array |
67 | 60 | */ |
68 | 61 | public function setTypoLinkPartsElement( |
69 | 62 | $linkHandlerFound, |
70 | | - $tLP, |
| 63 | + $typolinkProperties, |
71 | 64 | $content, |
72 | 65 | $elements, |
73 | | - $idx, |
| 66 | + $index, |
74 | 67 | $tokenID, |
75 | 68 | $softReferenceIndex |
76 | 69 | ) { |
77 | 70 |
|
78 | | - if ($tLP['LINK_TYPE'] === 'linkhandler') { |
79 | | - |
80 | | - $linkInfo = $this->getTabHandlerFactory()->getLinkInfoArrayFromMatchingHandler($tLP['url']); |
| 71 | + if ($typolinkProperties['LINK_TYPE'] === 'linkhandler') { |
81 | 72 |
|
82 | | - if (count($linkInfo)) { |
83 | | - $content = $this->setTypoLinkPartsElementForLinkhandler($linkInfo, $elements, $idx, $tokenID, $content); |
84 | | - $linkHandlerFound = true; |
85 | | - } |
| 73 | + $content = $this->setTypoLinkPartsElementForLinkhandler($typolinkProperties['url'], $elements, $index, $tokenID, $content); |
| 74 | + $linkHandlerFound = true; |
86 | 75 | } |
87 | 76 |
|
88 | | - return array($linkHandlerFound, $tLP, $content, $elements, $idx, $tokenID, $softReferenceIndex); |
89 | | - } |
90 | | - |
91 | | - /** |
92 | | - * @return \Aoe\Linkhandler\Browser\TabHandlerFactory |
93 | | - */ |
94 | | - protected function getTabHandlerFactory() |
95 | | - { |
96 | | - return GeneralUtility::makeInstance('Aoe\\Linkhandler\\Browser\\TabHandlerFactory'); |
| 77 | + return array($linkHandlerFound, $typolinkProperties, $content, $elements, $index, $tokenID, $softReferenceIndex); |
97 | 78 | } |
98 | 79 |
|
99 | 80 | /** |
100 | 81 | * Generates the SoftReferenceIndex data. |
101 | 82 | * |
102 | | - * @param array $linkInfo Link information provied by the matching tab handler. |
| 83 | + * @param string $url Raw URL pointing to a DB record (format will be "record:key:table:uid" |
103 | 84 | * @param string $content The content to process. |
104 | 85 | * @param array $elements Reference to the array of elements to be modified with substitution / information entries. |
105 | | - * @param string $idx Index value of the found element - user to make unique but stable tokenID |
| 86 | + * @param string $index Index value of the found element - user to make unique but stable tokenID |
106 | 87 | * @param string $tokenID Unique identifyer for a link of an record |
107 | 88 | * @return string |
108 | 89 | */ |
109 | | - protected function setTypoLinkPartsElementForLinkhandler($linkInfo, &$elements, $idx, $tokenID, $content) |
| 90 | + protected function setTypoLinkPartsElementForLinkhandler($url, &$elements, $index, $tokenID, $content) |
110 | 91 | { |
111 | 92 |
|
112 | | - $elements[$tokenID . ':' . $idx]['subst'] = array( |
| 93 | + $referenceParts = explode(':', $url); |
| 94 | + $elements[$tokenID . ':' . $index]['subst'] = array( |
113 | 95 | 'type' => 'db', |
114 | | - 'recordRef' => $linkInfo['recordTable'] . ':' . $linkInfo['recordUid'], |
| 96 | + 'recordRef' => $referenceParts[2] . ':' . $referenceParts[3], |
115 | 97 | 'tokenID' => $tokenID, |
116 | 98 | 'tokenValue' => $content |
117 | 99 | ); |
|
0 commit comments