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
    • ContentRssCreator
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
    • ScriptCookieDirective
  • mpAutoloaderClassMap
  • None
  • Plugin
    • ContentAllocation
    • CronjobOverview
    • FormAssistant
    • FrontendLogic
    • FrontendUsers
    • Linkchecker
    • ModRewrite
    • Newsletter
    • Repository
      • FrontendNavigation
      • KeywordDensity
    • SearchSolr
    • SmartyWrapper
    • UrlShortener
    • UserForum
    • Workflow
  • PluginManager
  • Setup
    • Form
    • GUI
    • Helper
      • Environment
      • Filesystem
      • MySQL
      • PHP
    • UpgradeJob
  • Smarty
    • Cacher
    • Compiler
    • Config
    • Debug
    • PluginsBlock
    • PluginsFilter
    • PluginsFunction
    • PluginsInternal
    • PluginsModifier
    • PluginsModifierCompiler
    • PluginsShared
    • Security
    • Template
    • TemplateResources
  • Swift
    • ByteStream
    • CharacterStream
    • Encoder
    • Events
    • KeyCache
    • Mailer
    • Mime
    • Plugins
    • Transport

Classes

  • Swift_FailoverTransport
  • Swift_LoadBalancedTransport
  • Swift_MailTransport
  • Swift_Plugins_Loggers_ArrayLogger
  • Swift_Plugins_Loggers_EchoLogger
  • Swift_SendmailTransport
  • Swift_SmtpTransport
  • Swift_Transport_AbstractSmtpTransport
  • Swift_Transport_Esmtp_Auth_CramMd5Authenticator
  • Swift_Transport_Esmtp_Auth_LoginAuthenticator
  • Swift_Transport_Esmtp_Auth_PlainAuthenticator
  • Swift_Transport_Esmtp_AuthHandler
  • Swift_Transport_EsmtpTransport
  • Swift_Transport_FailoverTransport
  • Swift_Transport_LoadBalancedTransport
  • Swift_Transport_MailTransport
  • Swift_Transport_SendmailTransport
  • Swift_Transport_SimpleMailInvoker
  • Swift_Transport_StreamBuffer

Interfaces

  • Swift_Plugins_Logger
  • Swift_Plugins_Pop_Pop3Exception
  • Swift_Transport
  • Swift_Transport_Esmtp_Authenticator
  • Swift_Transport_EsmtpHandler
  • Swift_Transport_IoBuffer
  • Swift_Transport_MailInvoker
  • Swift_Transport_SmtpAgent
  • Swift_TransportException
  • Overview
  • Package
  • Function
  • Todo
  • Download
  1: <?php
  2: /**
  3:  * This file contains the cContentTypeText 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_TEXT which lets the editor enter a single-line text.
 20:  *
 21:  * @package Core
 22:  * @subpackage ContentType
 23:  */
 24: class cContentTypeText extends cContentTypeAbstract {
 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:         $rawSettings = conHtmlSpecialChars($rawSettings);
 38:         // change attributes from the parent class and call the parent
 39:         // constructor
 40:         parent::__construct($rawSettings, $id, $contentTypes);
 41:         $this->_type = 'CMS_TEXT';
 42:         $this->_prefix = 'text';
 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: 
 52:             // make sure to escape variables before any output on page
 53:             $this->_settings = stripslashes($this->_settings);
 54:             $this->_settings = conHtmlSpecialChars($this->_settings);
 55:             $this->_rawSettings = stripslashes($this->_rawSettings);
 56:             $this->_rawSettings = conHtmlSpecialChars($this->_rawSettings);
 57:         }
 58:     }
 59: 
 60:     /**
 61:      * Generates the code which should be shown if this content type is edited.
 62:      *
 63:      * @return string escaped HTML code which should be shown if content type is
 64:      *         edited
 65:      */
 66:     public function generateEditCode() {
 67:         $script = $this->_getEditJavaScript();
 68: 
 69:         $div = new cHTMLDiv($this->_rawSettings);
 70:         $div->setID($this->_prefix . '_text_' . $this->_id);
 71:         $div->appendStyleDefinition('display', 'inline');
 72: 
 73:         $editButton = new cHTMLImage($this->_cfg['path']['contenido_fullhtml'] . $this->_cfg['path']['images'] . 'but_edithead.gif');
 74:         $editButton->setID($this->_prefix . '_editbutton_' . $this->_id);
 75:         $editButton->appendStyleDefinitions(array(
 76:             'margin-left' => '5px',
 77:             'cursor' => 'pointer'
 78:         ));
 79: 
 80:         return $this->_encodeForOutput($script . $div->render() . $editButton->render());
 81:     }
 82: 
 83:     /**
 84:      * Generates the JS code for this content type.
 85:      *
 86:      * @return string the JS code for the content type
 87:      */
 88:     protected function _getEditJavaScript() {
 89:         $textbox = new cHTMLTextarea($this->_prefix . '_text_' . $this->_id, '', '', '', $this->_prefix . '_text_' . $this->_id, false, NULL, '', 'edit-textfield edit-' . $this->_prefix . '-textfield');
 90:         $textbox->setClass("$this->_id");
 91: 
 92:         $saveButton = new cHTMLImage($this->_cfg['path']['contenido_fullhtml'] . 'images/but_ok.gif');
 93:         $saveButton->setID($this->_prefix . '_savebutton_' . $this->_id);
 94:         $saveButton->appendStyleDefinitions(array(
 95:             'margin-left' => '5px',
 96:             'cursor' => 'pointer'
 97:         ));
 98: 
 99:         $template = new cTemplate();
100:         $template->set('s', 'PREFIX', $this->_prefix);
101:         $template->set('s', 'ID', $this->_id);
102:         $template->set('s', 'TEXTBOX', $textbox->render());
103:         $template->set('s', 'SAVEBUTTON', $saveButton->render());
104:         $template->set('s', 'IDARTLANG', $this->_idArtLang);
105: 
106:         return $template->generate($this->_cfg['path']['contenido'] . 'templates/standard/template.cms_text_js.html', true);
107:     }
108: 
109:     /**
110:      * Generates the code which should be shown if this content type is shown in
111:      * the frontend.
112:      *
113:      * @return string escaped HTML code which should be shown if content type is
114:      *         shown in frontend
115:      */
116:     public function generateViewCode() {
117:         return $this->_encodeForOutput($this->_rawSettings);
118:     }
119: 
120: }
CMS CONTENIDO 4.9.7 API documentation generated by ApiGen