2 /***************************************************************
5 * (c) 2007-2008 Ingo Renner <ingo@typo3.org>
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
16 * A copy is found in the textfile GPL.txt and important notices to the license
17 * from the author is found in LICENSE.txt distributed with these scripts.
20 * This script is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
25 * This copyright notice MUST APPEAR in all copies of the script!
26 ***************************************************************/
28 if(TYPO3_REQUESTTYPE
& TYPO3_REQUESTTYPE_AJAX
) {
29 require_once('interfaces/interface.backend_toolbaritem.php');
30 require_once(PATH_t3lib
.'class.t3lib_loadmodules.php');
31 require_once(PATH_typo3
.'sysext/lang/lang.php');
33 $GLOBALS['LANG'] = t3lib_div
::makeInstance('language');
34 $GLOBALS['LANG']->init($GLOBALS['BE_USER']->uc
['lang']);
35 $GLOBALS['LANG']->includeLLFile('EXT:lang/locallang_misc.xml');
37 // needed to get the correct icons when reloading the menu after saving it
38 $loadModules = t3lib_div
::makeInstance('t3lib_loadModules');
39 $loadModules->load($GLOBALS['TBE_MODULES']);
44 * class to render the shortcut menu
48 * @author Ingo Renner <ingo@typo3.org>
52 class ShortcutMenu
implements backend_toolbarItem
{
54 private $shortcutGroups;
57 * all available shortcuts
64 * labels of all groups.
65 * If value is 1, the system will try to find a label in the locallang array.
72 * reference back to the backend object
76 private $backendReference;
81 * @param TYPO3backend TYPO3 backend object reference
84 public function __construct(TYPO3backend
&$backendReference = null) {
85 $this->backendReference
= $backendReference;
86 $this->shortcuts
= array();
88 // by default, 5 groups are set
89 $this->shortcutGroups
= array(
97 $this->shortcutGroups
= $this->initShortcutGroups();
98 $this->shortcuts
= $this->initShortcuts();
102 * checks whether the user has access to this toolbar item
104 * @return boolean true if user has access, false if not
106 public function checkAccess() {
107 // FIXME - needs proper access check
112 * Creates the shortcut menu (default renderer)
114 * @return string workspace selector as HTML select
116 public function render() {
117 $this->addJavascriptToBackend();
119 $shortcutMenu = array();
121 $shortcutMenu[] = '<a href="#" class="toolbar-item"><img'.t3lib_iconWorks
::skinImg($this->backPath
, 'gfx/toolbar_shortcut.png', 'width="16" height="16"').' title="Shortcuts" alt="" /></a>';
122 $shortcutMenu[] = '<div class="toolbar-item-menu" style="display: none;">';
123 $shortcutMenu[] = $this->renderMenu();
124 $shortcutMenu[] = '</div>';
126 return implode("\n", $shortcutMenu);
130 * renders the pure contents of the menu
132 * @return string the menu's content
134 public function renderMenu() {
136 $groupIcon = '<img'.t3lib_iconWorks
::skinImg($this->backPath
, 'gfx/i/sysf.gif', 'width="18" height="16"').' title="Shortcut Group" alt="" />';
137 $editIcon = '<img'.t3lib_iconWorks
::skinImg($this->backPath
, 'gfx/edit2.gif', 'width="11" height="12"').' title="Edit Shortcut" alt=""';
138 $deleteIcon = '<img'.t3lib_iconWorks
::skinImg($this->backPath
, 'gfx/garbage.gif', 'width="11" height="12"').' title="Delete Shortcut" alt="" />';
140 $shortcutMenu[] = '<table border="0" cellspacing="0" cellpadding="0" class="shortcut-list">';
142 // render shortcuts with no group (group id = 0) first
143 $noGroupShortcuts = $this->getShortcutsByGroup(0);
144 foreach($noGroupShortcuts as $shortcut) {
146 <tr id="shortcut-'.$shortcut['raw']['uid'].'" class="shortcut">
147 <td class="shortcut-icon">'.$shortcut['icon'].'</td>
148 <td class="shortcut-label">
149 <a id="shortcut-label-'.$shortcut['raw']['uid'].'" href="" onclick="'.$shortcut['action'].'">'.$shortcut['label'].'</a>
151 <td class="shortcut-edit">'.$editIcon.' id="shortcut-edit-'.$shortcut['raw']['uid'].'" /></td>
152 <td class="shortcut-delete">'.$deleteIcon.'</td>
156 // now render groups and the contained shortcuts
157 $groups = $this->getGroupsFromShortcuts();
158 krsort($groups, SORT_NUMERIC
);
159 foreach($groups as $groupId => $groupLabel) {
162 <tr class="shortcut-group" id="shortcut-group-'.$groupId.'">
163 <td class="shortcut-group-icon">'.$groupIcon.'</td>
164 <td class="shortcut-group-label">'.$groupLabel.'</td>
165 <td colspan="2"> </td>
168 $shortcuts = $this->getShortcutsByGroup($groupId);
170 foreach($shortcuts as $shortcut) {
175 $firstRow = ' first-row';
179 <tr id="shortcut-'.$shortcut['raw']['uid'].'" class="shortcut'.$firstRow.'">
180 <td class="shortcut-icon">'.$shortcut['icon'].'</td>
181 <td class="shortcut-label">
182 <a id="shortcut-label-'.$shortcut['raw']['uid'].'" href="" onclick="'.$shortcut['action'].'">'.$shortcut['label'].'</a>
184 <td class="shortcut-edit">'.$editIcon.' id="shortcut-edit-'.$shortcut['raw']['uid'].'" /></td>
185 <td class="shortcut-delete">'.$deleteIcon.'</td>
189 $shortcutMenu[] = $shortcutGroup;
193 if(count($shortcutMenu) == 1) {
194 //no shortcuts added yet, show a small help message how to add shortcuts
195 $icon = '<img'.t3lib_iconWorks
::skinImg($backPath,'gfx/shortcut.gif','width="14" height="14"').' title="shortcut icon" alt="" />';
196 $label = str_replace('%icon%', $icon, $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_misc.php:shortcutDescription'));
198 $shortcutMenu[] = '<tr><td style="padding:1px 2px; color: #838383;">'.$label.'</td></tr>';
201 $shortcutMenu[] = '</table>';
203 $compiledShortcutMenu = implode("\n", $shortcutMenu);
205 return $compiledShortcutMenu;
209 * renders the menu so that it can be returned as response to an AJAX call
211 * @param array array of parameters from the AJAX interface, currently unused
212 * @param TYPO3AJAX object of type TYPO3AJAX
215 public function renderAjax($params = array(), TYPO3AJAX
&$ajaxObj = null) {
216 $menuContent = $this->renderMenu();
218 $ajaxObj->addContent('shortcutMenu', $menuContent);
222 * adds the neccessary javascript ot the backend
226 private function addJavascriptToBackend() {
227 $this->backendReference
->addJavascriptFile('js/shortcutmenu.js');
231 * returns additional attributes for the list item in the toolbar
233 * @return string list item HTML attibutes
235 public function getAdditionalAttributes() {
236 return ' id="shortcut-menu"';
240 * retrieves the shortcuts for the current user
242 * @return array array of shortcuts
244 private function initShortcuts() {
245 $shortcuts = array();
246 $globalGroups = $this->getGlobalShortcutGroups();
248 $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery(
251 '((userid = '.$GLOBALS['BE_USER']->user
['uid'].' AND sc_group>=0) OR sc_group IN ('.implode(',', array_keys($globalGroups)).'))',
256 // Traverse shortcuts
257 while($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
258 $shortcut = array('raw' => $row);
259 $moduleParts = explode('|', $row['module_name']);
260 $row['module_name'] = $moduleParts[0];
261 $row['M_module_name'] = $moduleParts[1];
262 $moduleParts = explode('_', $row['M_module_name'] ?
263 $row['M_module_name'] :
266 $queryParts = parse_url($row['url']);
267 $queryParameters = t3lib_div
::explodeUrl2Array($queryParts['query'], 1);
269 if($row['module_name'] == 'xMOD_alt_doc.php' && is_array($queryParameters['edit'])) {
270 $shortcut['table'] = key($queryParameters['edit']);
271 $shortcut['recordid'] = key($queryParameters['edit'][$shortcut['table']]);
273 if($queryParameters['edit'][$shortcut['table']][$shortcut['recordid']] == 'edit') {
274 $shortcut['type'] = 'edit';
275 } elseif($queryParameters['edit'][$shortcut['table']][$shortcut['recordid']] == 'new') {
276 $shortcut['type'] = 'new';
279 if(substr($shortcut['recordid'], -1) == ',') {
280 $shortcut['recordid'] = substr($shortcut['recordid'], 0, -1);
283 $shortcut['type'] = 'other';
286 // check for module access
287 if(!$GLOBALS['BE_USER']->isAdmin()) {
288 if(!isset($GLOBALS['LANG']->moduleLabels
['tabs_images'][implode('_', $moduleParts).'_tab'])) {
289 // nice hack to check if the user has access to this module
290 // - otherwise the translation label would not have been loaded :-)
294 $pageId = $this->getLinkedPageId($row['url']);
295 if(t3lib_div
::testInt($pageId)) {
296 // check for webmount access
297 if(!$GLOBALS['BE_USER']->isInWebMount($pageId)) {
301 // check for record access
302 $pageRow = t3lib_BEfunc
::getRecord('pages', $pageId);
303 if(!$GLOBALS['BE_USER']->doesUserHaveAccess($pageRow, $perms = 1)) {
309 $shortcutGroup = $row['sc_group'];
310 if($shortcutGroup && strcmp($lastGroup, $shortcutGroup) && ($shortcutGroup != -100)) {
311 $shortcut['groupLabel'] = $this->getShortcutGroupLabel($shortcutGroup);
314 if($row['description']) {
315 $shortcut['label'] = $row['description'];
317 $shortcut['label'] = t3lib_div
::fixed_lgd(rawurldecode($queryParts['query']), 150);
320 $shortcut['group'] = $shortcutGroup;
321 $shortcut['icon'] = $this->getShortcutIcon($row, $shortcut);
322 $shortcut['iconTitle'] = $this->getShortcutIconTitle($shortcutLabel, $row['module_name'], $row['M_module_name']);
323 $shortcut['action'] = 'jump(unescape(\''.rawurlencode($row['url']).'\'),\''.implode('_',$moduleParts).'\',\''.$moduleParts[0].'\');';
325 $lastGroup = $row['sc_group'];
326 $shortcuts[] = $shortcut;
333 * gets shortcuts for a specific group
335 * @param integer group Id
336 * @return array array of shortcuts that matched the group
338 private function getShortcutsByGroup($groupId) {
339 $shortcuts = array();
341 foreach($this->shortcuts
as $shortcut) {
342 if($shortcut['group'] == $groupId) {
343 $shortcuts[] = $shortcut;
351 * gets a shortcut by its uid
353 * @param integer shortcut id to get the complete shortcut for
354 * @return mixed an array containing the shortcut's data on success or false on failure
356 private function getShortcutById($shortcutId) {
357 $returnShortcut = false;
359 foreach($this->shortcuts
as $shortcut) {
360 if($shortcut['raw']['uid'] == (int) $shortcutId) {
361 $returnShortcut = $shortcut;
366 return $returnShortcut;
370 * gets the available shortcut groups from default gropups, user TSConfig,
373 * @param array array of parameters from the AJAX interface, currently unused
374 * @param TYPO3AJAX object of type TYPO3AJAX
377 private function initShortcutGroups($params = array(), TYPO3AJAX
&$ajaxObj = null) {
378 // groups from TSConfig
379 $userShortcutGroups = $GLOBALS['BE_USER']->getTSConfig('options.shortcutGroups');
381 if(is_array($userShortcutGroups['properties']) && count($userShortcutGroups['properties'])) {
382 foreach($userShortcutGroups['properties'] as $groupId => $label) {
383 if(strcmp('', $label) && strcmp('0', $label)) {
384 $this->shortcutGroups
[$groupId] = (string) $label;
385 } elseif($GLOBALS['BE_USER']->isAdmin()) {
386 unset($this->shortcutGroups
[$groupId]);
391 // generate global groups, all global groups have negative IDs.
392 if(count($this->shortcutGroups
)) {
393 $groups = $this->shortcutGroups
;
394 foreach($groups as $groupId => $groupLabel) {
395 $this->shortcutGroups
[($groupId * -1)] = $groupLabel;
399 // group -100 is kind of superglobal and can't be changed.
400 $this->shortcutGroups
[-100] = 1;
403 foreach($this->shortcutGroups
as $groupId => $groupLabel) {
404 $label = $groupLabel;
406 if($groupLabel == '1') {
407 $label = $GLOBALS['LANG']->getLL('shortcut_group_'.abs($groupId), 1);
411 $label = $GLOBALS['LANG']->getLL('shortcut_group', 1).' '.abs($groupId);
417 $label = $GLOBALS['LANG']->getLL('shortcut_global', 1).': '.
423 if($groupId == -100) {
424 $label = $GLOBALS['LANG']->getLL('shortcut_global', 1).': '.$GLOBALS['LANG']->getLL('shortcut_all', 1);
428 $this->shortcutGroups
[$groupId] = $label;
431 return $this->shortcutGroups
;
435 * gets the available shortcut groups
437 * @param array array of parameters from the AJAX interface, currently unused
438 * @param TYPO3AJAX object of type TYPO3AJAX
441 public function getAjaxShortcutGroups($params = array(), TYPO3AJAX
&$ajaxObj = null) {
442 $shortcutGroups = $this->shortcutGroups
;
444 if(!$GLOBALS['BE_USER']->isAdmin()) {
445 foreach($shortcutGroups as $groupId => $groupName) {
446 if(intval($groupId) < 0) {
447 unset($shortcutGroups[$groupId]);
452 $ajaxObj->addContent('shortcutGroups', $shortcutGroups);
453 $ajaxObj->setContentFormat('json');
457 * deletes a shortcut through an AJAX call
459 * @param array array of parameters from the AJAX interface, currently unused
460 * @param TYPO3AJAX object of type TYPO3AJAX
463 public function deleteAjaxShortcut($params = array(), TYPO3AJAX
&$ajaxObj = null) {
464 $shortcutId = (int) t3lib_div
::_POST('shortcutId');
465 $fullShortcut = $this->getShortcutById($shortcutId);
466 $ajaxReturn = 'failed';
468 if($fullShortcut['raw']['userid'] == $GLOBALS['BE_USER']->user
['uid']) {
469 $GLOBALS['TYPO3_DB']->exec_DELETEquery(
474 if($GLOBALS['TYPO3_DB']->sql_affected_rows() == 1) {
475 $ajaxReturn = 'deleted';
479 $ajaxObj->addContent('delete', $ajaxReturn);
483 * creates a shortcut through an AJAX call
485 * @param array array of parameters from the AJAX interface, currently unused
486 * @param TYPO3AJAX object of type TYPO3AJAX
489 public function createAjaxShortcut($params = array(), TYPO3AJAX
&$ajaxObj = null) {
492 $shortcutCreated = 'failed';
493 $shortcutName = 'Shortcut'; // default name
494 $shortcutNamePrepend = '';
496 $url = urldecode(t3lib_div
::_POST('url'));
497 $module = t3lib_div
::_POST('module');
498 $motherModule = t3lib_div
::_POST('motherModName');
500 // determine shortcut type
501 $queryParts = parse_url($url);
502 $queryParameters = t3lib_div
::explodeUrl2Array($queryParts['query'], 1);
504 if(is_array($queryParameters['edit'])) {
505 $shortcut['table'] = key($queryParameters['edit']);
506 $shortcut['recordid'] = key($queryParameters['edit'][$shortcut['table']]);
508 if($queryParameters['edit'][$shortcut['table']][$shortcut['recordid']] == 'edit') {
509 $shortcut['type'] = 'edit';
510 $shortcutNamePrepend = $GLOBALS['LANG']->getLL('shortcut_edit', 1);
511 } elseif($queryParameters['edit'][$shortcut['table']][$shortcut['recordid']] == 'new') {
512 $shortcut['type'] = 'new';
513 $shortcutNamePrepend = $GLOBALS['LANG']->getLL('shortcut_create', 1);
516 $shortcut['type'] = 'other';
519 // Lookup the title of this page and use it as default description
520 $pageId = $this->getLinkedPageId($url);
522 if(t3lib_div
::testInt($pageId)) {
523 $page = t3lib_BEfunc
::getRecord('pages', $pageId);
525 // set the name to the title of the page
526 if($shortcut['type'] == 'other') {
527 $shortcutName = $page['title'];
529 $shortcutName = $shortcutNamePrepend.' '.$LANG->sL($TCA[$shortcut['table']]['ctrl']['title']).' ('.$page['title'].')';
533 if (preg_match('/\/$/', $pageId)) {
534 // if $pageId is a string and ends with a slash,
535 // assume it is a fileadmin reference and set
536 // the description to the basename of that path
537 $shortcutName .= basename($pageId);
541 // adding the shortcut
542 if($module && $url) {
543 $fieldValues = array(
544 'userid' => $GLOBALS['BE_USER']->user
['uid'],
545 'module_name' => $module.'|'.$motherModule,
547 'description' => $shortcutName,
550 $GLOBALS['TYPO3_DB']->exec_INSERTquery('sys_be_shortcuts', $fieldValues);
552 if($GLOBALS['TYPO3_DB']->sql_affected_rows() == 1) {
553 $shortcutCreated = 'success';
557 $ajaxObj->addContent('create', $shortcutCreated);
561 * gets called when a shortcut is changed, checks whether the user has
562 * permissions to do so and saves the changes if everything is ok
564 * @param array array of parameters from the AJAX interface, currently unused
565 * @param TYPO3AJAX object of type TYPO3AJAX
568 public function setAjaxShortcut($params = array(), TYPO3AJAX
&$ajaxObj = null) {
570 $shortcutId = (int) t3lib_div
::_POST('shortcutId');
571 $shortcutName = strip_tags(t3lib_div
::_POST('value'));
572 $shortcutGroupId = (int) t3lib_div
::_POST('shortcut-group');
574 if($shortcutGroupId > 0 ||
$GLOBALS['BE_USER']->isAdmin()) {
575 // users can delete only their own shortcuts (except admins)
576 $addUserWhere = (!$GLOBALS['BE_USER']->isAdmin() ?
577 ' AND userid='.intval($GLOBALS['BE_USER']->user
['uid'])
581 $fieldValues = array(
582 'description' => $shortcutName,
583 'sc_group' => $shortcutGroupId
586 if($fieldValues['sc_group'] < 0 && !$GLOBALS['BE_USER']->isAdmin()) {
587 $fieldValues['sc_group'] = 0;
590 $GLOBALS['TYPO3_DB']->exec_UPDATEquery(
592 'uid='.$shortcutId.$addUserWhere,
596 $affectedRows = $GLOBALS['TYPO3_DB']->sql_affected_rows();
597 if($affectedRows == 1) {
598 $ajaxObj->addContent('shortcut', $shortcutName);
600 $ajaxObj->addContent('shortcut', 'failed');
604 $ajaxObj->setContentFormat('plain');
608 * gets the label for a shortcut group
610 * @param integer a shortcut group id
611 * @return string the shortcut group label, can be an empty string if no group was found for the id
613 private function getShortcutGroupLabel($groupId) {
616 if($this->shortcutGroups
[$groupId]) {
617 $label = $this->shortcutGroups
[$groupId];
624 * gets a list of global groups, shortcuts in these groups are available to all users
626 * @return array array of global groups
628 private function getGlobalShortcutGroups() {
629 $globalGroups = array();
631 foreach($this->shortcutGroups
as $groupId => $groupLabel) {
633 $globalGroups[$groupId] = $groupLabel;
637 return $globalGroups;
641 * runs through the available shortcuts an collects their groups
643 * @return array array of groups which have shortcuts
645 private function getGroupsFromShortcuts() {
648 foreach($this->shortcuts
as $shortcut) {
649 $groups[$shortcut['group']] = $this->shortcutGroups
[$shortcut['group']];
652 return array_unique($groups);
656 * gets the icon for the shortcut
658 * @param string backend module name
659 * @return string shortcut icon as img tag
661 private function getShortcutIcon($row, $shortcut) {
664 switch($row['module_name']) {
665 case 'xMOD_alt_doc.php':
666 $table = $shortcut['table'];
667 $recordid = $shortcut['recordid'];
669 if($shortcut['type'] == 'edit') {
670 // Creating the list of fields to include in the SQL query:
671 $selectFields = $this->fieldArray
;
672 $selectFields[] = 'uid';
673 $selectFields[] = 'pid';
675 if($table=='pages') {
676 if(t3lib_extMgm
::isLoaded('cms')) {
677 $selectFields[] = 'module';
678 $selectFields[] = 'extendToSubpages';
680 $selectFields[] = 'doktype';
683 if(is_array($TCA[$table]['ctrl']['enablecolumns'])) {
684 $selectFields = array_merge($selectFields,$TCA[$table]['ctrl']['enablecolumns']);
687 if($TCA[$table]['ctrl']['type']) {
688 $selectFields[] = $TCA[$table]['ctrl']['type'];
691 if($TCA[$table]['ctrl']['typeicon_column']) {
692 $selectFields[] = $TCA[$table]['ctrl']['typeicon_column'];
695 if($TCA[$table]['ctrl']['versioningWS']) {
696 $selectFields[] = 't3ver_state';
699 $selectFields = array_unique($selectFields); // Unique list!
700 $permissionClause = ($table=='pages' && $this->perms_clause
) ?
701 ' AND '.$this->perms_clause
:
704 $sqlQueryParts = array(
705 'SELECT' => implode(',', $selectFields),
707 'WHERE' => 'uid IN ('.$recordid.') '.$permissionClause.
708 t3lib_BEfunc
::deleteClause($table).
709 t3lib_BEfunc
::versioningPlaceholderClause($table)
711 $result = $GLOBALS['TYPO3_DB']->exec_SELECT_queryArray($sqlQueryParts);
712 $row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($result);
714 $icon = t3lib_iconWorks
::getIcon($table, $row, $this->backPath
);
715 } elseif($shortcut['type'] == 'new') {
716 $icon = t3lib_iconWorks
::getIcon($table, '', $this->backPath
);
719 $icon = t3lib_iconWorks
::skinImg($this->backPath
, $icon, '', 1);
721 case 'xMOD_file_edit.php':
722 $icon = 'gfx/edit_file.gif';
724 case 'xMOD_wizard_rte.php':
725 $icon = 'gfx/edit_rtewiz.gif';
728 if($GLOBALS['LANG']->moduleLabels
['tabs_images'][$row['module_name'].'_tab']) {
729 $icon = $GLOBALS['LANG']->moduleLabels
['tabs_images'][$row['module_name'].'_tab'];
731 // change icon of fileadmin references - otherwise it doesn't differ with Web->List
732 $icon = str_replace('mod/file/list/list.gif', 'mod/file/file.gif', $icon);
734 if(t3lib_div
::isAbsPath($icon)) {
735 $icon = '../'.substr($icon, strlen(PATH_site
));
738 $icon = 'gfx/dummy_module.gif';
742 return '<img src="'.$icon.'" alt="shortcut icon" />';
746 * Returns title for the shortcut icon
748 * @param string shortcut label
749 * @param string backend module name (key)
750 * @param string parent module label
751 * @return string title for the shortcut icon
753 private function getShortcutIconTitle($shortcutLabel, $moduleName, $parentModuleName = '') {
756 if(substr($moduleName, 0, 5) == 'xMOD_') {
757 $title = substr($moduleName, 5);
759 $splitModuleName = explode('_', $moduleName);
760 $title = $GLOBALS['LANG']->moduleLabels
['tabs'][$splitModuleName[0].'_tab'];
762 if(count($splitModuleName) > 1) {
763 $title .= '>'.$GLOBALS['LANG']->moduleLabels
['tabs'][$moduleName.'_tab'];
767 if($parentModuleName) {
768 $title .= ' ('.$parentModuleName.')';
771 $title .= ': '.$shortcutLabel;
777 * Return the ID of the page in the URL if found.
779 * @param string The URL of the current shortcut link
780 * @return string If a page ID was found, it is returned. Otherwise: 0
782 private function getLinkedPageId($url) {
783 return preg_replace('/.*[\?&]id=([^&]+).*/', '$1', $url);
789 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE
]['XCLASS']['typo3/classes/class.shortcutmenu.php']) {
790 include_once($TYPO3_CONF_VARS[TYPO3_MODE
]['XCLASS']['typo3/classes/class.shortcutmenu.php']);