Overview

Packages

  • CONTENIDO
  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
    • ScriptCookieDirective
  • mpAutoloaderClassMap
  • None
  • PHP
  • Plugin
    • ContentAllocation
    • CronjobOverview
    • FormAssistant
    • FrontendLogic
    • FrontendUsers
    • Linkchecker
    • ModRewrite
    • Newsletter
    • Repository
      • FrontendNavigation
      • KeywordDensity
    • SmartyWrapper
    • UrlShortener
    • UserForum
    • Workflow
  • PluginManager
  • Setup
    • Form
    • GUI
    • Helper
      • Environment
      • Filesystem
      • MySQL
      • PHP
    • UpgradeJob

Classes

  • cCodeGeneratorAbstract
  • cCodeGeneratorFactory
  • cCodeGeneratorStandard
  • cContentTypeAbstract
  • cContentTypeAbstractTabbed
  • cContentTypeDate
  • cContentTypeFilelist
  • cContentTypeHead
  • cContentTypeHtml
  • cContentTypeHtmlhead
  • cContentTypeImg
  • cContentTypeImgdescr
  • cContentTypeImgeditor
  • cContentTypeLink
  • cContentTypeLinkdescr
  • cContentTypeLinkeditor
  • cContentTypeLinktarget
  • cContentTypeRaw
  • cContentTypeTeaser
  • cContentTypeText
  • cTypeGenerator
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo
  1: <?php
  2: 
  3: /**
  4:  * This file contains the cContentTypeHead 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_HEAD which lets the editor enter a single-line text.
 19:  *
 20:  * @package Core
 21:  * @subpackage ContentType
 22:  */
 23: class cContentTypeHead extends cContentTypeText {
 24:     /**
 25:      * Constructor to create an instance of this class.
 26:      *
 27:      * Initialises class attributes and handles store events.
 28:      *
 29:      * @param string $rawSettings
 30:      *         the raw settings in an XML structure or as plaintext
 31:      * @param int    $id
 32:      *         ID of the content type, e.g. 3 if CMS_DATE[3] is used
 33:      * @param array  $contentTypes
 34:      *         array containing the values of all content types
 35:      *
 36:      * @throws cDbException
 37:      */
 38:     public function __construct($rawSettings, $id, array $contentTypes) {
 39: 
 40:         // try to call constructor of parent of parent to avoid overwriting of $this->_settings
 41:         // this can happen in case of POST-data
 42:         if (false === get_parent_class($this) || false === get_parent_class(get_parent_class($this))) {
 43:             // can not get parent of parent class, call parent constructor as fallback
 44:             parent::__construct($rawSettings, $id, $contentTypes);
 45:         }
 46: 
 47:         // call constructor of parent of parent class
 48:         $nameParentParentClass = get_parent_class(get_parent_class($this));
 49:         $nameParentParentClass::__construct($rawSettings, $id, $contentTypes);
 50: 
 51:         // set props
 52:         $this->_type = 'CMS_HEAD';
 53:         $this->_prefix = 'head';
 54: 
 55:         // if form is submitted, store the current text
 56:         // notice: also check the ID of the content type (there could be more
 57:         // than one content type of the same type on the same page!)
 58:         if (isset($_POST[$this->_prefix . '_action']) && $_POST[$this->_prefix . '_action'] === 'store' && isset($_POST[$this->_prefix . '_id']) && (int) $_POST[$this->_prefix . '_id'] == $this->_id) {
 59:             $this->_settings = $_POST[$this->_prefix . '_text_' . $this->_id];
 60:             $this->_rawSettings = $this->_settings;
 61:             $this->_storeSettings();
 62: 
 63:             // make sure to escape variables before any output on page
 64:             $this->_settings = stripslashes($this->_settings);
 65:             $this->_settings = conHtmlSpecialChars($this->_settings);
 66:             $this->_rawSettings = stripslashes($this->_rawSettings);
 67:             $this->_rawSettings = conHtmlSpecialChars($this->_rawSettings);
 68:         }
 69:     }
 70: 
 71:     /**
 72:      * Generates the JS code for this content type.
 73:      *
 74:      * @return string
 75:      *         the JS code for the content type
 76:      * @throws cInvalidArgumentException
 77:      */
 78:     protected function _getEditJavaScript() {
 79:         $textbox = new cHTMLTextbox($this->_prefix . '_text_' . $this->_id, '', '', '', $this->_prefix . '_text_' . $this->_id, false, NULL, '', 'edit-textfield edit-' . $this->_prefix . '-textfield');
 80:         $textbox->setClass("$this->_id");
 81: 
 82:         $saveButton = new cHTMLImage($this->_cfg['path']['contenido_fullhtml'] . 'images/but_ok.gif');
 83:         $saveButton->setID($this->_prefix . '_savebutton_' . $this->_id);
 84:         $saveButton->appendStyleDefinitions(array(
 85:                 'margin-left' => '5px',
 86:                 'cursor' => 'pointer'
 87:         ));
 88: 
 89:         $template = new cTemplate();
 90:         $template->set('s', 'PREFIX', $this->_prefix);
 91:         $template->set('s', 'ID', $this->_id);
 92:         $template->set('s', 'TEXTBOX', $textbox->render());
 93:         $template->set('s', 'SAVEBUTTON', $saveButton->render());
 94:         $template->set('s', 'IDARTLANG', $this->_idArtLang);
 95: 
 96:         return $template->generate($this->_cfg['path']['contenido'] . 'templates/standard/template.cms_text_js.html', true);
 97:     }
 98: 
 99: }
100: 
CMS CONTENIDO 4.10.0 API documentation generated by ApiGen 2.8.0