Link.php 22.5 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?PHP
/***************************************************************
 *  Copyright notice
 *
 *  (c) 2010 Glowbase GmbH <support@glowbase.com>
 *  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.
 *
 *  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!
 ***************************************************************/

namespace qfq;

//use qfq;

require_once(__DIR__ . '/Define.php');
require_once(__DIR__ . '/Utils.php');
31
32
require_once(__DIR__ . '/../store/Store.php');
require_once(__DIR__ . '/../store/Sip.php');
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59

/*
 * u:url
 * m:mailto
 * p:page
 * 
 * t:text
 * a:AltText
 * o:ToolTip
 * 
 * r:render   
 * g:target
 * c:class  [n|i|e]:<class>
 * q:question  <text>
 * e:encryption 0|1
 * 
 * E:edit
 * N:new
 * D:delete
 * H:Help
 * I:information
 * M:Magnifier
 * B:bullet
 * P:picture       [file]
 * C:checkbox    [name]
 * R:right 
 * h:hash  
60
 *
61
62
63
64
65
66
 * A:    A:[u:p:m]
 * G:    G:[N|..]
 */

class Link {

Carsten  Rose's avatar
Carsten Rose committed
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
    private $mailto = "",
        $url = "",
        $image = "",
        $text = "",
        $altText = "",
        $imageTitle = "",
        $question = "",
        $target = "",
        $toolTip = ['', ''],
        $additionalUrlParams = "",
        $link = "";

    private $modeRender = 0,
        $picturePosition = "l",
        $modeHash = false,
        $renderControl,
        $encryption = 1;

    private $linkClass = "", // class name
        $defaultLinkClass = "",
        $linkClassSelector = array("i" => "internal", "e" => "external"),
        $cssLinkClassInternal = '',
        $cssLinkClassExternal = '';

91

92
93
94
    //TODO: delete muss noch implementiert werden
    private $delete = '';

Carsten  Rose's avatar
Carsten Rose committed
95
    /**
96
     * @var Sip
Carsten  Rose's avatar
Carsten Rose committed
97
98
99
     */
    private $sip = null;

100
101
102
103
104
    /**
     * @var Store
     */
    private $store = null;

105
106
107
108
109
110
111
112
113
114
115
116
    // Simulate global variable: will be set much earlier in other functions. Will be shown in error messages.
    private $fr_error;

    /**
     * @var Utils
     */
    private $utils;
    /**
     * @var string
     */
    private $pageAlias = '';

117

118
119
120
    /**
     * __construct
     *
121
122
     * @param $fr_error
     * @param Sip $sip
123
     */
Carsten  Rose's avatar
Carsten Rose committed
124
    public function __construct($fr_error, Sip $sip, $phpUnit = false) {
125
        $this->fr_error = $fr_error;
Carsten  Rose's avatar
Carsten Rose committed
126
        $this->sip = $sip;
Carsten  Rose's avatar
Carsten Rose committed
127
        $this->store = Store::getInstance('', $phpUnit);
128
129
        $this->cssLinkClassInternal = $this->store->getVar(SYSTEM_CSS_LINK_CLASS_INTERNAL, STORE_SYSTEM);
        $this->cssLinkClassExternal = $this->store->getVar(SYSTEM_CSS_LINK_CLASS_EXTERNAL, STORE_SYSTEM);
130
131
        $this->initRenderControl();

132
    }
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151

    /**
     * Initializes RenderControl Array
     *
     * @param    void
     * @return    void
     */
    private function initRenderControl() {

        $this->utils = new Utils();

        /*
         * mode:
         * 0: no output
         * 1: text
         * 2: url
         * 3: <a href=url>url</a>
         * 4: <a href=url>Text</a>
         *
Carsten  Rose's avatar
Carsten Rose committed
152
         *  r=render mode, u=url, t:text and/or image.
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
         *
         *                  [r][u][t] = mode
         */

        $this->renderControl[0][0][0] = 0;
        $this->renderControl[0][0][1] = 0;
        $this->renderControl[0][1][0] = 3;
        $this->renderControl[0][1][1] = 4;

        $this->renderControl[1][0][0] = 0;
        $this->renderControl[1][0][1] = 1;
        $this->renderControl[1][1][0] = 3;
        $this->renderControl[1][1][1] = 4;

        $this->renderControl[2][0][0] = 0;
        $this->renderControl[2][0][1] = 0;
        $this->renderControl[2][1][0] = 0;
        $this->renderControl[2][1][1] = 4;

        $this->renderControl[3][0][0] = 0;
        $this->renderControl[3][0][1] = 1;
        $this->renderControl[3][1][0] = 2;
        $this->renderControl[3][1][1] = 1;

        $this->renderControl[4][0][0] = 0;
        $this->renderControl[4][0][1] = 1;
        $this->renderControl[4][1][0] = 2;
        $this->renderControl[4][1][1] = 2;

        $this->renderControl[5][0][0] = 0;
        $this->renderControl[5][0][1] = 0;
        $this->renderControl[5][1][0] = 0;
        $this->renderControl[5][1][1] = 0;
186
    }
187
188
189
190
191
192
193
194

    /**
     * Build the whole link
     *
     * @param    string $str :  Qualifier with params. 'report'-syntax. F.e.:  A:u:www.example.com|G:P:home.gif|t:Home"
     *
     * @return    string      The complete Link
     */
195
    public function renderLink($str) {
196
197

        // str="u:http://www.example.com|c:i|t:delete"
198
        $param = explode("|", $str);
199
200

        // Parse all parameter, fill variables
201
        foreach ($param as $item) {
202
            $arr = explode(":", $item, 2);
203
204

            // set class defaults
205
206
207
            $this->parseItem($arr[0], $arr[1]);
        }

208
        // if there is no url or mailto definition: {{global.pageId}}
209
210
        if (!$this->url && !$this->mailto)
            $this->url = "?" . $this->store->getVar(TYPO3_PAGE_ID, STORE_TYPO3);
211
212
213

        $this->doCssClass();

214
        $htmlUrl = $this->doUrl();
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
        $htmlImage = $this->doImage();

        // Compose Image & Text
        $distance = ' ';
        $this->text = ($this->picturePosition == "l") ? $htmlImage . $distance . $this->text : $this->text . $distance . $htmlImage;

        // ToolTip
        $extraSpan = array();
        if ($this->toolTip) {
            $extraSpan[0] = "<span " . $this->toolTip[0] . ">" . $this->toolTip[1];
            $extraSpan[1] = "</span>";
        }

        // Create 'fake' modes for encrypted 'mailto'
        $prefix = "";
        if ($this->mailto) {
            $prefix = "1";
            $this->url = "dummy";
        }
        // Create 'fake' mode for ajax delete
        if ($this->delete) {
            $prefix = "2";
        }
        // Compose URL
        // get Render Mode via Array renderControl
        $mode = $prefix . $this->renderControl[$this->modeRender][$this->url ? 1 : 0][$this->text ? 1 : 0];
        // 0-4 URL, plain email
        // 10-14 encrypted email
        switch ($mode) {
            // 0: No Output
            case '0':
            case '10':
            case '20':
                $this->link = "";
                break;

            // 1: 'text'
            case '1':
                $this->link = $extraSpan[0] . $this->text . $extraSpan[1];
                break;
            case '11':
256
                $this->link = $extraSpan[0] . $this->encryptMailtoJS($this->mailto, $this->text, $this->linkClass, false) . $extraSpan[1];
257
258
259
260
261
262
263
                break;

            // 2: 'url'
            case '2':
                $this->link = $extraSpan[0] . $this->url . $extraSpan[1];
                break;
            case '12':
264
                $this->link = $extraSpan[0] . $this->encryptMailtoJS($this->mailto, $this->text, $this->linkClass, false) . $extraSpan[1];
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
                break;

            // 3: <a href=url>url</a>
            case '3':
                $this->link = $htmlUrl . $this->url . '</a>' . $this->toolTip[1];
                break;
            case '13':
                $this->link = $this->encryptMailtoJS($this->mailto, $this->mailto, $this->linkClass, TRUE);
                break;

            // 4: <a href=url>Text</a>
            case '4':
                $this->link = $htmlUrl . $this->text . '</a>' . $this->toolTip[1];
                break;
            case '14':
                $this->link = $this->encryptMailtoJS($this->mailto, $this->text, $this->linkClass, TRUE);
                break;
            case '21':
            case '22':
            case '23':
            case '24':
286
287
            //TODO: Alter Code, umstellen auf JS Client von RO. Vorlage koennte 'Delete' in Subrecord sein.
            $this->link = "<a href=\"javascript: void(0);\" onClick=\"var del = new FR.Delete({recordId:'',hash:'',forward:'" . $this->pageAlias . "'});\" " . $this->linkClass . ">" . $this->text . "</a>";
288
289
290
291
        }

        return $this->link;

292
    }
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307

    /**
     * Parse Item of link string, fill class global variables.
     *
     * @param    string $key :    F.e.: 'u'
     * @param    string $value :  F.e.: 'http://www.nzz.ch'
     * @throws SyntaxReportException
     */
    private function parseItem($key, $value) {

        switch ($key) {
            // URL
            case "u":
                if ($this->url || $this->mailto) throw new SyntaxReportException ("Multiple URL, PAGE or MAILTO defined : '$key'", "", __FILE__, __LINE__, "Column: " . $this->fr_error["columnIndex"], $this->fr_error);
                $this->url = $value;
308
                $this->defaultLinkClass = $this->cssLinkClassExternal;
309
310
311
312
                break;
            case "m":
                if ($this->url || $this->mailto) throw new SyntaxReportException ("Multiple URL, PAGE or MAILTO defined : '$key'", "", __FILE__, __LINE__, "Column: " . $this->fr_error["columnIndex"], $this->fr_error);
                $this->mailto = $value;
313
                $this->defaultLinkClass = $this->cssLinkClassExternal;
314
315
316
                break;
            case "p":
                if ($this->url || $this->mailto) throw new SyntaxReportException ("Multiple URL, PAGE or MAILTO defined : '$key'", "", __FILE__, __LINE__, "Column: " . $this->fr_error["columnIndex"], $this->fr_error);
317
                $this->pageAlias = $value ? $value : $this->store->getVar(TYPO3_PAGE_ID, STORE_TYPO3); // If no pageid|pagealias is defined, take current page
Carsten  Rose's avatar
Carsten Rose committed
318
//                $this->url = "?" . $this->pageAlias;
319
                $this->defaultLinkClass = $this->cssLinkClassInternal;
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
                break;
            // Text
            case "t":
                $this->text = $value;
                break;
            case "a":
                $this->altText = $value;
                break;
            case "o":
                $this->toolTip = $this->utils->createToolTip($value);
                break;

            // Image
            case "P":
                if ($this->image) throw new SyntaxReportException ("Multiple images defined: '$key'", "", __FILE__, __LINE__, "Column: " . $this->fr_error["columnIndex"], $this->fr_error);
                $this->image = $value;
                $this->AltText = "Grafic: " . $value;
                $this->imageTitle = $value;
                break;
            case "B":
                if ($this->image) throw new SyntaxReportException ("Multiple images defined: '$key'", "", __FILE__, __LINE__, "Column: " . $this->fr_error["columnIndex"], $this->fr_error);
                $this->image = PATH_ICONS . "bullet-" . ($value ? $value : "green") . '.gif';
                $this->defaultAltText = "Bullet: " . $value;
                $this->imageTitle = $value;
                break;
            case "C":
                if ($this->image) throw new SyntaxReportException ("Multiple images defined: '$key'", "", __FILE__, __LINE__, "Column: " . $this->fr_error["columnIndex"], $this->fr_error);
                $this->image = PATH_ICONS . "checked-" . ($value ? $value : "green") . '.gif';
                $this->defaultAltText = "Checked: " . $value;
                $this->imageTitle = $value;
                break;
            case "D":
                if ($this->image) throw new SyntaxReportException ("Multiple images defined: '$key'", "", __FILE__, __LINE__, "Column: " . $this->fr_error["columnIndex"], $this->fr_error);
                $this->image = PATH_ICONS . 'delete.gif';
                $this->defaultAltText = "Delete";
                $this->imageTitle = "Delete";
                $this->delete = true;
                // Include Extjs library
                $this->utils->loadJSlib($this->fr_error);
                break;
            case "E":
                if ($this->image) throw new SyntaxReportException ("Multiple images defined: '$key'", "", __FILE__, __LINE__, "Column: " . $this->fr_error["columnIndex"], $this->fr_error);
                $this->image = PATH_ICONS . 'edit.gif';
                $this->defaultAltText = "Edit";
                $this->imageTitle = "Edit";
                break;
            case "H":
                if ($this->image) throw new SyntaxReportException ("Multiple images defined: '$key'", "", __FILE__, __LINE__, "Column: " . $this->fr_error["columnIndex"], $this->fr_error);
                $this->image = PATH_ICONS . 'help.gif';
                $this->defaultAltText = "Help";
                $this->imageTitle = "Help";
                break;
            case "I":
                if ($this->image) throw new SyntaxReportException ("Multiple images defined: '$key'", "", __FILE__, __LINE__, "Column: " . $this->fr_error["columnIndex"], $this->fr_error);
                $this->image = PATH_ICONS . 'info.gif';
                $this->defaultAltText = "Information";
                $this->imageTitle = "Information";
                break;
            case "N":
                if ($this->image) throw new SyntaxReportException ("Multiple images defined: '$key'", "", __FILE__, __LINE__, "Column: " . $this->fr_error["columnIndex"], $this->fr_error);
                $this->image = PATH_ICONS . 'new.gif';
                $this->defaultAltText = "New";
                $this->imageTitle = "New";
                break;
            case "S":
                if ($this->image) throw new SyntaxReportException ("Multiple images defined: '$key'", "", __FILE__, __LINE__, "Column: " . $this->fr_error["columnIndex"], $this->fr_error);
                $this->image = PATH_ICONS . 'show.gif';
                $this->defaultAltText = "Details";
                $this->imageTitle = "Details";
                break;

            // Misc
            case "r":
                if ($this->modeRender) throw new SyntaxReportException ("Multiple render modes defined: '$key'", "", __FILE__, __LINE__, "Column: " . $this->fr_error["columnIndex"], $this->fr_error);
                $this->modeRender = $value;
                break;
            case "g":
                if ($this->target) throw new SyntaxReportException ("Multiple 'target' defined: '$key'", "", __FILE__, __LINE__, "Column: " . $this->fr_error["columnIndex"], $this->fr_error);
                $this->target = $value;
                break;
            case "c":
                if ($this->linkClass) throw new SyntaxReportException ("Multiple linkClass defined: '$key'", "", __FILE__, __LINE__, "Column: " . $this->fr_error["columnIndex"], $this->fr_error);
                $this->linkClass = $value;
                break;
            case "q":
                if ($this->question) throw new SyntaxReportException ("Multiple question defined: '$key'", "", __FILE__, __LINE__, "Column: " . $this->fr_error["columnIndex"], $this->fr_error);
                $this->question = $value ? $value : "Please confirm";
                break;
            case "e":
                if ($this->encryption != 1) throw new SyntaxReportException ("Multiple encryption defined: '$key'", "", __FILE__, __LINE__, "Column: " . $this->fr_error["columnIndex"], $this->fr_error);
                $this->encryption = $value ? $value : "1";
                break;
            case "h":
                if ($this->modeHash) throw new SyntaxReportException ("Multiple modeHash defined: '$key'", "", __FILE__, __LINE__, "Column: " . $this->fr_error["columnIndex"], $this->fr_error);
                $this->modeHash = TRUE;
                break;
            case "U":    //if($this->additionalUrlParams) throw new syntaxException ( "Multiple additionalUrlParams defined: '$key'","",__FILE__,__LINE__, "Column: " . $fthis->r_error["columnIndex"], $this->fr_error);
417
                $this->additionalUrlParams = $value;
418
419
420
421
422
423
424
425
426
427
                break;
            case "R":
                if ($this->picturePosition != "l") throw new SyntaxReportException ("Multiple picturePosition defined: '$key'", "", __FILE__, __LINE__, "Column: " . $this->fr_error["columnIndex"], $this->fr_error);
                $this->picturePosition = "r";
                break;

            // A,G
            case "G":
            case "A":
                $arr = explode(":", $value, 2);
428
            // set class defaults
429
430
431
432
433
434
435
436
437
                $this->parseItem($arr[0], $arr[1]);
                break;
            case "" :
                break;
            default:
                throw new SyntaxReportException ("Unknown link qualifier: '$key'", "", __FILE__, __LINE__, "Column: " . $this->fr_error["columnIndex"], $this->fr_error);

        }

438
    }
439
440
441
442
443
444
445
446
447

    /**
     * Parse CSS Class Settings
     *
     * @param    void
     *
     * @return    void
     */
    private function doCssClass() {
448
        $class = '';
449

450
451
452
453
454
455
456
457
458
459
460
        switch ($this->linkClass) {
            case 'n':
                $class = '';
                break;
            case 'i':
            case 'e':
                $class = $this->linkClassSelector[$this->linkClass];
                break;
            default:
                $class = ($this->linkClass == '') ? $this->defaultLinkClass : $this->linkClass;
                break;
461
        }
462

Carsten  Rose's avatar
Carsten Rose committed
463
//        $this->linkClass = ($class == '') ? '' : ' class="' . $this->linkClass . '"';
464
    }
465
466

    /**
467
468
469
470
     * Builds complete HTML anchor.
     * - <a href="mailto:info@example.com:>info@example.com</a>
     * - <a href="http://example.com:>http://example.com</a>
     * - If $this->modeHash is set, create a
471
472
     *
     * @return string
473
     * @throws SyntaxReportException
474
     */
475
    private function doUrl() {
Carsten  Rose's avatar
Carsten Rose committed
476
        $tags = '';
477
478
479
480
481
482
483
        // build URL
        $htmlUrl = "";

        if ($this->url) {

            if ($this->modeHash) {

Carsten  Rose's avatar
Carsten Rose committed
484
                $this->url = $this->sip->queryStringToSip('id=' . $this->pageAlias . '&' . $this->additionalUrlParams);
485

486
            } else {
487

488
489
490
491
492
493
494
                if ($this->additionalUrlParams) {
                    // Append '&' or '?' depending if there is already a '?'
                    $this->url .= (strpos($this->url, '?') >= 0) ? '&' : '?';
                    // Append all additional params.
                    $this->url .= $this->additionalUrlParams;
                }
            }
495
496
        }

497
498
        // If there is no encryption: handle the mailto as an ordinary URL
        if ($this->mailto) {
499

500
501
502
503
504
505
            if ($this->encryption == 0) {
                $this->url = "mailto:" . $this->mailto;
                $this->mailto = "";
            } else {
                throw new SyntaxReportException ("Oops, sorry: encrypted mail not implemented ...", "", __FILE__, __LINE__,
                    "Column: " . $this->fr_error["columnIndex"], $this->fr_error);
506
507
508
            }
        }

Carsten  Rose's avatar
Carsten Rose committed
509
510
511
512
513
514
        $tags .= Support::doAttribute('href', $this->url);
        $tags .= Support::doAttribute('class', $this->linkClass);
        $tags .= Support::doAttribute('target', $this->target);
        if ($this->question) {
            $tags .= Support::doAttribute('onclick', 'confirm(\'' . $this->question . '\')');
        }
515

Carsten  Rose's avatar
Carsten Rose committed
516
        $htmlUrl = '<a ' . $tags . $this->toolTip[0] . '>';
517
518
519

        return ($htmlUrl);
    }
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542

    /**
     * Create Image HTML Tag
     * @return string $htmlImage
     * @internal param $void
     *
     */
    private function doImage() {
        $htmlImage = "";

        // Build Image
        if ($this->image) {

            if ($this->altText) $this->altText = ' alttext="' . $this->altText . '"';

            if ($this->image) $this->image = ' src="' . $this->image . '"';

            if ($this->imageTitle) $this->imageTitle = ' title="' . $this->imageTitle . '"';

            $htmlImage = '<img' . $this->image . $this->altText . $this->imageTitle . ' />';
        }

        return ($htmlImage);
543
    }
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560

    /**
     *  Encrypt the mailto address via JS.
     *  Email address protected against email crawler (as long as they don't interpret JS).
     *
     *    <script language=javascript><!--
     *    var mm1 = name
     *    var mm2 = @domain.
     *    var ... = tld
     *    document.write("<a href=" + "mail" + "to:" + mm1 + mm2 + ... + ">" + name + "</a>")
     *    document.write("<a href=" + "mail" + "to:" + mm1 + mm2 + ... + ">" + @domain. + "</a>")
     *    document.write("<a href=" + "mail" + "to:" + mm1 + mm2 + ... + ">" + tld + "</a>")
     *    //--></script>';
     *
     * @param    string $mailto Email address to encrypt.
     * @param    string $text Text to wrap <a href..>, </a> around.
     * @param    string $class Optional class definition
561
     * @param    bool $href TRUE: create a '<a>',   false: just encrypt or show the email, no link.
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
     *
     * @return    string The complete Link
     */
    private function encryptMailtoJS($mailto, $text, $class = "", $href = TRUE) {

        // Prepare CSS Definition
        if ($class) $class = str_replace('"', "'", $class);

        // Split $mailto
        $tmp = $this->splitAndAddDelimter($mailto, "@");
        $arr = array_merge($this->splitAndAddDelimter($tmp[0], "."), $this->splitAndAddDelimter($tmp[1], "."));

        $tt = "<script language=javascript><!--" . chr(10);
        $ii = 0;
        if ($href) {
            $dw = 'document.write("<a href=" + "mail" + "to:"';
            foreach ($arr as $value) {
                // Setup JS Variables
                $tt .= 'var mm' . $ii . '= "' . $value . '"' . chr(10);
                // Compose $dw (documentwrite statement)
                $dw .= ' + mm' . $ii++;
            }
            $dw .= ' + "' . $class . str_replace('"', '\\"', $this->toolTip[0]) . '>"';
            $closeDw = '"</a>")';
        } else {
            $dw = 'document.write(';
            $closeDw = ')';
        }

        // Wrap mailto around text
        if ($mailto == $text) {
            // Text is an email: wrap every single part of mailto.
            $ii = 0;
            foreach ($arr as $value) {
                $tt .= $dw . " + mm" . $ii++ . ' + ' . $closeDw . chr(10);
            }
        } else {
            // Single wrap text
            $tt .= $dw . ' + "' . $text . '" + ' . $closeDw . chr(10);
        }

        $tt .= '//--></script>';
        if ($href) $tt .= $this->toolTip[1];

        return ($tt);
607
    }
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630

    /**
     * Split a string around the $delimiter.
     *
     * Append the delimiter to each part except the last one.
     *
     * @param $mailto
     * @param $delimiter
     * @return array
     */
    private function splitAndAddDelimter($mailto, $delimiter) {
        $value = '';

        $arr = explode($delimiter, $mailto);            // split string

        foreach ($arr as $key => $value) {
            $arr[$key] = $value . $delimiter;
        }

        if (isset($key))
            $arr[$key] = $value;

        return ($arr);
631
    }
632
}