Code Duplication    Length = 51-70 lines in 2 locations

typo3/sysext/recordlist/Classes/RecordList/AbstractDatabaseRecordList.php 1 location

@@ 1050-1100 (lines=51) @@
1047
     * @return string The item title. Ready for HTML output (is htmlspecialchars()'ed)
1048
     * @deprecated since TYPO3 v9, will be removed in TYPO3 v10
1049
     */
1050
    public function linkWrapItems($table, $uid, $code, $row)
1051
    {
1052
        $lang = $this->getLanguageService();
1053
        $origCode = $code;
1054
        // If the title is blank, make a "no title" label:
1055
        if ((string)$code === '') {
1056
            $code = '<i>[' . htmlspecialchars($lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.no_title')) . ']</i> - '
1057
                . htmlspecialchars(BackendUtility::getRecordTitle($table, $row));
1058
        } else {
1059
            $code = htmlspecialchars($code, ENT_QUOTES, 'UTF-8', false);
1060
            if ($code != htmlspecialchars($origCode)) {
1061
                $code = '<span title="' . htmlspecialchars($origCode, ENT_QUOTES, 'UTF-8', false) . '">' . $code . '</span>';
1062
            }
1063
        }
1064
        switch ((string)$this->clickTitleMode) {
1065
            case 'edit':
1066
                // If the listed table is 'pages' we have to request the permission settings for each page:
1067
                if ($table === 'pages') {
1068
                    $localCalcPerms = $this->getBackendUserAuthentication()->calcPerms(BackendUtility::getRecord('pages', $row['uid']));
1069
                    $permsEdit = $localCalcPerms & Permission::PAGE_EDIT;
1070
                } else {
1071
                    $permsEdit = $this->calcPerms & Permission::CONTENT_EDIT;
1072
                }
1073
                // "Edit" link: ( Only if permissions to edit the page-record of the content of the parent page ($this->id)
1074
                if ($permsEdit) {
1075
                    $params = '&edit[' . $table . '][' . $row['uid'] . ']=edit';
1076
                    $code = '<a href="#" onclick="' . htmlspecialchars(BackendUtility::editOnClick($params, '', -1)) . '" title="' . htmlspecialchars($lang->getLL('edit')) . '">' . $code . '</a>';
1077
                }
1078
                break;
1079
            case 'show':
1080
                // "Show" link (only pages and tt_content elements)
1081
                if ($table === 'pages' || $table === 'tt_content') {
1082
                    $code = '<a href="#" onclick="' . htmlspecialchars(
1083
                        BackendUtility::viewOnClick(($table === 'tt_content' ? $this->id . '#' . $row['uid'] : $row['uid']))
1084
                    ) . '" title="' . htmlspecialchars($lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.showPage')) . '">' . $code . '</a>';
1085
                }
1086
                break;
1087
            case 'info':
1088
                // "Info": (All records)
1089
                $code = '<a href="#" onclick="' . htmlspecialchars(('top.launchView(\'' . $table . '\', \'' . $row['uid'] . '\'); return false;')) . '" title="' . htmlspecialchars($lang->getLL('showInfo')) . '">' . $code . '</a>';
1090
                break;
1091
            default:
1092
                // Output the label now:
1093
                if ($table === 'pages') {
1094
                    $code = '<a href="' . htmlspecialchars($this->listURL($uid, '', 'firstElementNumber')) . '" onclick="setHighlight(' . $uid . ')">' . $code . '</a>';
1095
                } else {
1096
                    $code = $this->linkUrlMail($code, $origCode);
1097
                }
1098
        }
1099
        return $code;
1100
    }
1101
1102
    /**
1103
     * Wrapping input code in link to URL or email if $testString is either.

typo3/sysext/backend/Classes/View/PageLayoutView.php 1 location

@@ 3622-3691 (lines=70) @@
3619
     * @param mixed[] $row Item row
3620
     * @return string The item title. Ready for HTML output (is htmlspecialchars()'ed)
3621
     */
3622
    public function linkWrapItems($table, $uid, $code, $row)
3623
    {
3624
        $lang = $this->getLanguageService();
3625
        $origCode = $code;
3626
        // If the title is blank, make a "no title" label:
3627
        if ((string)$code === '') {
3628
            $code = '<i>[' . htmlspecialchars(
3629
                    $lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.no_title')
3630
                ) . ']</i> - '
3631
                . htmlspecialchars(BackendUtility::getRecordTitle($table, $row));
3632
        } else {
3633
            $code = htmlspecialchars($code, ENT_QUOTES, 'UTF-8', false);
3634
            if ($code != htmlspecialchars($origCode)) {
3635
                $code = '<span title="' . htmlspecialchars(
3636
                        $origCode,
3637
                        ENT_QUOTES,
3638
                        'UTF-8',
3639
                        false
3640
                    ) . '">' . $code . '</span>';
3641
            }
3642
        }
3643
        switch ((string)$this->clickTitleMode) {
3644
            case 'edit':
3645
                // If the listed table is 'pages' we have to request the permission settings for each page:
3646
                if ($table === 'pages') {
3647
                    $localCalcPerms = $this->getBackendUserAuthentication()->calcPerms(
3648
                        BackendUtility::getRecord('pages', $row['uid'])
3649
                    );
3650
                    $permsEdit = $localCalcPerms & Permission::PAGE_EDIT;
3651
                } else {
3652
                    $permsEdit = $this->calcPerms & Permission::CONTENT_EDIT;
3653
                }
3654
                // "Edit" link: ( Only if permissions to edit the page-record of the content of the parent page ($this->id)
3655
                if ($permsEdit) {
3656
                    $params = '&edit[' . $table . '][' . $row['uid'] . ']=edit';
3657
                    $code = '<a href="#" onclick="' . htmlspecialchars(
3658
                            BackendUtility::editOnClick($params, '', -1)
3659
                        ) . '" title="' . htmlspecialchars($lang->getLL('edit')) . '">' . $code . '</a>';
3660
                }
3661
                break;
3662
            case 'show':
3663
                // "Show" link (only pages and tt_content elements)
3664
                if ($table === 'pages' || $table === 'tt_content') {
3665
                    $code = '<a href="#" onclick="' . htmlspecialchars(
3666
                            BackendUtility::viewOnClick(
3667
                                ($table === 'tt_content' ? $this->id . '#' . $row['uid'] : $row['uid'])
3668
                            )
3669
                        ) . '" title="' . htmlspecialchars(
3670
                            $lang->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.showPage')
3671
                        ) . '">' . $code . '</a>';
3672
                }
3673
                break;
3674
            case 'info':
3675
                // "Info": (All records)
3676
                $code = '<a href="#" onclick="' . htmlspecialchars(
3677
                        ('top.launchView(\'' . $table . '\', \'' . $row['uid'] . '\'); return false;')
3678
                    ) . '" title="' . htmlspecialchars($lang->getLL('showInfo')) . '">' . $code . '</a>';
3679
                break;
3680
            default:
3681
                // Output the label now:
3682
                if ($table === 'pages') {
3683
                    $code = '<a href="' . htmlspecialchars(
3684
                            $this->listURL($uid, '', 'firstElementNumber')
3685
                        ) . '" onclick="setHighlight(' . $uid . ')">' . $code . '</a>';
3686
                } else {
3687
                    $code = $this->linkUrlMail($code, $origCode);
3688
                }
3689
        }
3690
        return $code;
3691
    }
3692
3693
    /**
3694
     * Wrapping input code in link to URL or email if $testString is either.