TYPO3 CMS  TYPO3_6-2
TYPO3\CMS\T3editor\T3editor Class Reference
Inheritance diagram for TYPO3\CMS\T3editor\T3editor:
TYPO3\CMS\Core\SingletonInterface tx_t3editor

Public Member Functions

 setMode ($mode)
 
 setAjaxSaveType ($ajaxSaveType)
 
 setModeByFile ($file)
 
 setModeByType ($type)
 
 getMode ()
 
 isEnabled ()
 
 __construct ()
 
 getModeSpecificJavascriptCode ()
 
 getCodeEditor ($name, $class='', $content='', $additionalParams='', $alt='', array $hiddenfields=array())
 
 ajaxSaveCode ($params, $ajaxObj)
 
 getPlugins ($params, \TYPO3\CMS\Core\Http\AjaxRequestHandler &$ajaxObj)
 

Public Attributes

const MODE_TYPOSCRIPT = 'typoscript'
 
const MODE_JAVASCRIPT = 'javascript'
 
const MODE_CSS = 'css'
 
const MODE_XML = 'xml'
 
const MODE_HTML = 'html'
 
const MODE_PHP = 'php'
 
const MODE_SPARQL = 'sparql'
 
const MODE_MIXED = 'mixed'
 

Protected Member Functions

 getPreparedTemplate ()
 
 getParserfileByMode ($mode)
 
 getStylesheetByMode ($mode)
 
 getJavaScriptLabels ()
 
 getJavaScriptLabelsFromLocallang ($selectionPrefix='js.', $stripFromSelectionName='')
 

Protected Attributes

 $mode = ''
 
 $ajaxSaveType = ''
 
 $editorCounter = 0
 
 $_isEnabled = TRUE
 

Detailed Description

This file is part of the TYPO3 CMS project.

It is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, either version 2 of the License, or any later version.

For the full copyright and license information, please read the LICENSE.txt file that was distributed with this source code.

The TYPO3 project - inspiring people to share! Provides a javascript-driven code editor with syntax highlighting for TS, HTML, CSS and more

Author
Tobias Liebig mail_.nosp@m.typo.nosp@m.3@eto.nosp@m.bi.d.nosp@m.e

Definition at line 22 of file T3editor.php.

Constructor & Destructor Documentation

◆ __construct()

Member Function Documentation

◆ ajaxSaveCode()

TYPO3\CMS\T3editor\T3editor::ajaxSaveCode (   $params,
  $ajaxObj 
)

Save the content from t3editor retrieved via Ajax

new Ajax.Request('/dev/t3e/dummy/typo3/ajax.php', { parameters: { ajaxID: 'T3editor::saveCode', t3editor_savetype: 'TypoScriptTemplateInformationModuleFunctionController' } });

Parameters
array$paramsParameters (not used yet)
\TYPO3\CMS\Core\Http\AjaxRequestHandler$ajaxObjAjaxRequestHandler to handle response

Definition at line 390 of file T3editor.php.

References $ajaxObj, $GLOBALS, TYPO3\CMS\Core\Utility\GeneralUtility\_GP(), and TYPO3\CMS\Core\Utility\GeneralUtility\callUserFunction().

◆ getCodeEditor()

TYPO3\CMS\T3editor\T3editor::getCodeEditor (   $name,
  $class = '',
  $content = '',
  $additionalParams = '',
  $alt = '',
array  $hiddenfields = array() 
)

Generates HTML with code editor

Parameters
string$nameName attribute of HTML tag
string$classClass attribute of HTML tag
string$contentContent of the editor
string$additionalParamsAny additional editor parameters
string$altAlt attribute
array$hiddenfields
Returns
string Generated HTML code for editor

Definition at line 350 of file T3editor.php.

References $GLOBALS, and TYPO3\CMS\T3editor\T3editor\isEnabled().

◆ getJavaScriptLabels()

TYPO3\CMS\T3editor\T3editor::getJavaScriptLabels ( )
protected

Gets the labels to be used in JavaScript in the Ext JS interface. TODO this method is copied from EXT:Recycler, maybe this should be refactored into a helper class

Returns
array The labels to be used in JavaScript

Definition at line 309 of file T3editor.php.

References TYPO3\CMS\T3editor\T3editor\getJavaScriptLabelsFromLocallang().

Referenced by TYPO3\CMS\T3editor\T3editor\__construct().

◆ getJavaScriptLabelsFromLocallang()

TYPO3\CMS\T3editor\T3editor::getJavaScriptLabelsFromLocallang (   $selectionPrefix = 'js.',
  $stripFromSelectionName = '' 
)
protected

Gets labels to be used in JavaScript fetched from the current locallang file. TODO this method is copied from EXT:Recycler, maybe this should be refactored into a helper class

Parameters
string$selectionPrefixPrefix to select the correct labels (default: 'js.')
string$stripFromSelectionNameSub-prefix to be removed from label names in the result (default: '')
Returns
array Lables to be used in JavaScript of the current locallang file
Todo:
Check, whether this method can be moved in a generic way to $GLOBALS['LANG']

Definition at line 324 of file T3editor.php.

References $GLOBALS.

Referenced by TYPO3\CMS\T3editor\T3editor\getJavaScriptLabels().

◆ getMode()

TYPO3\CMS\T3editor\T3editor::getMode ( )

Get mode

Returns
string

Definition at line 139 of file T3editor.php.

References TYPO3\CMS\T3editor\T3editor\$mode.

◆ getModeSpecificJavascriptCode()

TYPO3\CMS\T3editor\T3editor::getModeSpecificJavascriptCode ( )

◆ getParserfileByMode()

TYPO3\CMS\T3editor\T3editor::getParserfileByMode (   $mode)
protected

Determine the correct parser js file for given mode

Parameters
string$mode
Returns
string Parser file name

Definition at line 234 of file T3editor.php.

References $GLOBALS, and TYPO3\CMS\T3editor\T3editor\$mode.

Referenced by TYPO3\CMS\T3editor\T3editor\getModeSpecificJavascriptCode().

◆ getPlugins()

TYPO3\CMS\T3editor\T3editor::getPlugins (   $params,
\TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxObj 
)

Gets plugins that are defined at $TYPO3_CONF_VARS['EXTCONF']['t3editor']'plugins'

Parameters
array$paramsadditional parameters (not used here)
\TYPO3\CMS\Core\Http\AjaxRequestHandler&$ajaxObjThe AjaxRequestHandler object of this request
Returns
void
Author
Oliver Hader olive.nosp@m.r@ty.nosp@m.po3.o.nosp@m.rg

Definition at line 424 of file T3editor.php.

References $GLOBALS, and $result.

◆ getPreparedTemplate()

TYPO3\CMS\T3editor\T3editor::getPreparedTemplate ( )
protected

Get the template code, prepared for javascript (no line breaks, quoted in single quotes)

Returns
string The template code, prepared to use in javascript

Definition at line 221 of file T3editor.php.

References TYPO3\CMS\Core\Utility\GeneralUtility\getUrl().

Referenced by TYPO3\CMS\T3editor\T3editor\__construct().

◆ getStylesheetByMode()

TYPO3\CMS\T3editor\T3editor::getStylesheetByMode (   $mode)
protected

Determine the correct css file for given mode

Parameters
string$mode
Returns
string css file name

Definition at line 270 of file T3editor.php.

References TYPO3\CMS\T3editor\T3editor\$mode.

Referenced by TYPO3\CMS\T3editor\T3editor\getModeSpecificJavascriptCode().

◆ isEnabled()

TYPO3\CMS\T3editor\T3editor::isEnabled ( )
Returns
boolean TRUE if the t3editor is enabled

Definition at line 146 of file T3editor.php.

References TYPO3\CMS\T3editor\T3editor\$_isEnabled.

Referenced by TYPO3\CMS\T3editor\T3editor\__construct(), and TYPO3\CMS\T3editor\T3editor\getCodeEditor().

◆ setAjaxSaveType()

TYPO3\CMS\T3editor\T3editor::setAjaxSaveType (   $ajaxSaveType)

Set the AJAX save type

Parameters
string$ajaxSaveType
Returns

Definition at line 73 of file T3editor.php.

References TYPO3\CMS\T3editor\T3editor\$ajaxSaveType.

◆ setMode()

TYPO3\CMS\T3editor\T3editor::setMode (   $mode)

sets the type of code to edit (::MODE_TYPOSCRIPT, ::MODE_JAVASCRIPT)

Parameters
$modestring Expects one of the predefined constants
Returns

Definition at line 62 of file T3editor.php.

References TYPO3\CMS\T3editor\T3editor\$mode.

Referenced by TYPO3\CMS\T3editor\T3editor\setModeByType().

◆ setModeByFile()

TYPO3\CMS\T3editor\T3editor::setModeByFile (   $file)

Set mode by file

Parameters
string$file
Returns
string

Definition at line 84 of file T3editor.php.

References TYPO3\CMS\T3editor\T3editor\setModeByType(), and TYPO3\CMS\Core\Utility\GeneralUtility\split_fileref().

◆ setModeByType()

TYPO3\CMS\T3editor\T3editor::setModeByType (   $type)

Set mode by type

Parameters
string$type
Returns
void

Definition at line 95 of file T3editor.php.

References TYPO3\CMS\T3editor\T3editor\$mode, and TYPO3\CMS\T3editor\T3editor\setMode().

Referenced by TYPO3\CMS\T3editor\T3editor\setModeByFile().

Member Data Documentation

◆ $_isEnabled

TYPO3\CMS\T3editor\T3editor::$_isEnabled = TRUE
protected

Definition at line 54 of file T3editor.php.

Referenced by TYPO3\CMS\T3editor\T3editor\isEnabled().

◆ $ajaxSaveType

TYPO3\CMS\T3editor\T3editor::$ajaxSaveType = ''
protected

Definition at line 40 of file T3editor.php.

Referenced by TYPO3\CMS\T3editor\T3editor\setAjaxSaveType().

◆ $editorCounter

TYPO3\CMS\T3editor\T3editor::$editorCounter = 0
protected

Definition at line 47 of file T3editor.php.

◆ $mode

◆ MODE_CSS

const TYPO3\CMS\T3editor\T3editor::MODE_CSS = 'css'

Definition at line 26 of file T3editor.php.

◆ MODE_HTML

const TYPO3\CMS\T3editor\T3editor::MODE_HTML = 'html'

Definition at line 28 of file T3editor.php.

◆ MODE_JAVASCRIPT

const TYPO3\CMS\T3editor\T3editor::MODE_JAVASCRIPT = 'javascript'

Definition at line 25 of file T3editor.php.

◆ MODE_MIXED

const TYPO3\CMS\T3editor\T3editor::MODE_MIXED = 'mixed'

Definition at line 31 of file T3editor.php.

Referenced by TYPO3\CMS\T3editor\FormWizard\main().

◆ MODE_PHP

const TYPO3\CMS\T3editor\T3editor::MODE_PHP = 'php'

Definition at line 29 of file T3editor.php.

◆ MODE_SPARQL

const TYPO3\CMS\T3editor\T3editor::MODE_SPARQL = 'sparql'

Definition at line 30 of file T3editor.php.

◆ MODE_TYPOSCRIPT

const TYPO3\CMS\T3editor\T3editor::MODE_TYPOSCRIPT = 'typoscript'

◆ MODE_XML

const TYPO3\CMS\T3editor\T3editor::MODE_XML = 'xml'

Definition at line 27 of file T3editor.php.