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 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: // change attributes from the parent class and call the parent
38: // constructor
39: parent::__construct($rawSettings, $id, $contentTypes);
40: $this->_type = 'CMS_HEAD';
41: $this->_prefix = 'head';
42:
43: // if form is submitted, store the current text
44: // notice: also check the ID of the content type (there could be more
45: // than one content type of the same type on the same page!)
46: if (isset($_POST[$this->_prefix . '_action']) && $_POST[$this->_prefix . '_action'] === 'store' && isset($_POST[$this->_prefix . '_id']) && (int) $_POST[$this->_prefix . '_id'] == $this->_id) {
47: $this->_settings = $_POST[$this->_prefix . '_text_' . $this->_id];
48: $this->_rawSettings = $this->_settings;
49: $this->_storeSettings();
50: $this->_settings = stripslashes($this->_settings);
51: $this->_rawSettings = stripslashes($this->_rawSettings);
52: }
53: }
54:
55: }