1: <?php
2:
3: /**
4: * This file contains the cContentTypeLinktarget class.
5: *
6: * @package Core
7: * @subpackage ContentType
8: * @author Simon Sprankel
9: * @copyright four for business AG <www.4fb.de>
10: * @license http://www.contenido.org/license/LIZENZ.txt
11: * @link http://www.4fb.de
12: * @link http://www.contenido.org
13: */
14:
15: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
16:
17: /**
18: * Content type CMS_LINKTARGET which displays the link target.
19: *
20: * @package Core
21: * @subpackage ContentType
22: */
23: class cContentTypeLinktarget extends cContentTypeLinkeditor {
24:
25: /**
26: * Constructor to create an instance of this class.
27: *
28: * Initialises class attributes and handles store events.
29: *
30: * @param string $rawSettings
31: * the raw settings in an XML structure or as plaintext
32: * @param int $id
33: * ID of the content type, e.g. 3 if CMS_DATE[3] is used
34: * @param array $contentTypes
35: * array containing the values of all content types
36: */
37: public function __construct($rawSettings, $id, array $contentTypes) {
38:
39: // There are no raw settings here, because CMS_LINKEDITOR is now
40: // saved in con_upl_meta. So compute the appropriate raw settings
41: // and call the parent constructor with them.
42: if (!cXmlBase::isValidXML($rawSettings)) {
43: $rawSettings = $this->_getRawSettings("CMS_LINKEDITOR", $id, $contentTypes);
44: }
45:
46: // call parent constructor
47: parent::__construct($rawSettings, $id, $contentTypes);
48:
49: }
50:
51: /**
52: * Generates the code which should be shown if this content type is shown in
53: * the frontend.
54: *
55: * @return string
56: * escaped HTML code which sould be shown if content type is shown in frontend
57: */
58: public function generateViewCode() {
59: $target = ($this->_settings['linkeditor_newwindow'] == 'true') ? '_blank' : '';
60: return $this->_encodeForOutput($target);
61: }
62:
63: /**
64: * Generates the code which should be shown if this content type is edited.
65: *
66: * @return string
67: * escaped HTML code which should be shown if content type is edited
68: */
69: public function generateEditCode() {
70: return $this->generateViewCode();
71: }
72:
73: }
74: