Project

General

Profile

Feature #19809 » bug_10118_v4.patch

Administrator Admin, 2010-08-16 22:11

View differences:

typo3/sysext/cms/tslib/class.tslib_pibase.php (working copy)
/**
* Wraps the input string in a <div> tag with the class attribute set to the prefixId.
* All content returned from your plugins should be returned through this function so all content from your plugin is encapsulated in a <div>-tag nicely identifying the content of your plugin.
* All content returned from your plugins should be returned through this function so all
* content from your plugin is encapsulated in a <div>-tag nicely identifying the content of your plugin.
*
* @param string HTML content to wrap in the div-tags with the "main class" of the plugin
* @return string HTML content wrapped, ready to return to the parent object.
* The wrap can be disabled for all plugins using:
* # config.disableWrapInBaseClass = 1
* The wrap can be disabled for all plugins with empty content using:
* # config.pi_disableWrapInBaseClass = ifEmpty
*
* The wrap can be disabled for a specific plugin using:
* # plugin.tx_example_pi1.disablePrefixComment = 1
* The wrap can be disabled for a specific plugin with empty content using:
* # plugin.tx_example_pi1.pi_disablePrefixComment = ifEmpty
*
* @param string $content HTML content to wrap in the div-tags with the "main class" of the plugin
* @return string HTML content wrapped, ready to return to the parent object.
*/
function pi_wrapInBaseClass($str) {
$content = '<div class="'.str_replace('_','-',$this->prefixId).'">
'.$str.'
</div>
';
if(!$GLOBALS['TSFE']->config['config']['disablePrefixComment']) {
$content = '
<!--
BEGIN: Content of extension "'.$this->extKey.'", plugin "'.$this->prefixId.'"
-->
'.$content.'
<!-- END: Content of extension "'.$this->extKey.'", plugin "'.$this->prefixId.'" -->
';
function pi_wrapInBaseClass($content) {
$isDisableWrap = $GLOBALS['TSFE']->config['config']['disableWrapInBaseClass'] == 1 ||
$this->conf['pi_disableWrapInBaseClass'] == 1;
$isDisableWrapIfEmpty = $GLOBALS['TSFE']->config['config']['disableWrapInBaseClass'] == 'ifEmpty'
|| $this->conf['pi_disableWrapInBaseClass'] == 'ifEmpty';
$isDisablePrefixComment = $GLOBALS['TSFE']->config['config']['disablePrefixComment']
|| $this->conf['pi_disablePrefixComment'] == 1;
if (!$isDisableWrap && (!$isDisableWrapIfEmpty || $content)) {
$classname = str_replace('_', '-', $this->prefixId);
$content = $this->cObj->wrap($content, '<div class="' . $classname . '">|</div>');
}
if(!$isDisablePrefixComment) {
$comment = 'Content of extension "' . $this->extKey . '", plugin "' . $this->prefixId . '"';
$content = $this->cObj->wrap($content, '<!-- BEGIN: ' . $comment . ' -->|<!-- END: ' . $comment . ' -->');
}
return $content;
}
......
// NO extension of class - does not make sense here.
?>
?>
(3-3/5)