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