1: <?php
2: /**
3: * This file contains the cContentTypeHead 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_HEAD which lets the editor enter a single-line text.
20: *
21: * @package Core
22: * @subpackage ContentType
23: */
24: class cContentTypeHead extends cContentTypeText {
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 integer $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: * @return void
36: */
37: public function __construct($rawSettings, $id, array $contentTypes) {
38: // change attributes from the parent class and call the parent
39: // constructor
40: parent::__construct($rawSettings, $id, $contentTypes);
41: $this->_type = 'CMS_HEAD';
42: $this->_prefix = 'head';
43:
44: // if form is submitted, store the current text
45: // notice: also check the ID of the content type (there could be more
46: // than one content type of the same type on the same page!)
47: if (isset($_POST[$this->_prefix . '_action']) && $_POST[$this->_prefix . '_action'] === 'store' && isset($_POST[$this->_prefix . '_id']) && (int) $_POST[$this->_prefix . '_id'] == $this->_id) {
48: $this->_settings = $_POST[$this->_prefix . '_text_' . $this->_id];
49: $this->_rawSettings = $this->_settings;
50: $this->_storeSettings();
51: $this->_settings = stripslashes($this->_settings);
52: $this->_rawSettings = stripslashes($this->_rawSettings);
53: }
54: }
55:
56: }