Ticket #2069: 2069.patch

File 2069.patch, 3.1 KB (added by Wiktor Walc, 16 years ago)
  • FCKeditor.body.php

     
    123123                               
    124124                return true;
    125125        }
     126       
     127        public function onSanitizerAfterFixTagAttributes($text, $element, &$attribs)
     128        {
     129                $text = preg_match_all("/Fckmw\d+fckmw/", $text, $matches);
     130               
     131                if (!empty($matches[0][0])) {
     132                        global $leaveRawTemplates;
     133                        if (!isset($leaveRawTemplates)) {
     134                                $leaveRawTemplates = array();
     135                        }
     136                        $leaveRawTemplates = array_merge($leaveRawTemplates, $matches[0]);
     137                        $attribs = array_merge($attribs, $matches[0]);
     138                }
    126139
     140                return true;
     141        }
     142
    127143        public function registerHooks() {
    128144                global $wgHooks, $wgExtensionFunctions;
    129145
     
    138154                $wgHooks['LanguageGetMagic'][]                  = array($this, "onLanguageGetMagic");
    139155                $wgHooks['ParserBeforeInternalParse'][]         = array($this, "onParserBeforeInternalParse");
    140156                $wgHooks['EditPageBeforeConflictDiff'][]                = array($this, 'onEditPageBeforeConflictDiff');
     157                $wgHooks['SanitizerAfterFixTagAttributes'][]    = array($this, 'onSanitizerAfterFixTagAttributes');
    141158
    142159                if ($this->debug) {
    143160                        /*
  • FCKeditorParser.body.php

     
    463463                }
    464464
    465465                if (!empty($this->fck_mw_strtr_span)) {
     466                        global $leaveRawTemplates;
     467                        if (!empty($leaveRawTemplates)) {
     468                                foreach ($leaveRawTemplates as $l) {
     469                                        $this->fck_mw_strtr_span[$l] = substr($this->fck_mw_strtr_span[$l], 30, -7);
     470                                }
     471                        }
    466472                        $parserOutput->setText(strtr($parserOutput->getText(), $this->fck_mw_strtr_span));
    467473                }
    468474
  • mw12/FCKeditorParser_OldPP.body.php

     
    463463                }
    464464
    465465                if (!empty($this->fck_mw_strtr_span)) {
     466                        global $leaveRawTemplates;
     467                        if (!empty($leaveRawTemplates)) {
     468                                foreach ($leaveRawTemplates as $l) {
     469                                        $this->fck_mw_strtr_span[$l] = substr($this->fck_mw_strtr_span[$l], 30, -7);
     470                                }
     471                        }
    466472                        $parserOutput->setText(strtr($parserOutput->getText(), $this->fck_mw_strtr_span));
    467473                }
    468474                if (!empty($this->fck_matches)) {
  • plugins/mediawiki/fckplugin.js

     
    672672                                else
    673673                                        sAttValue = htmlNode.getAttribute( sAttName, 2 ) ;      // We must use getAttribute to get it exactly as it is defined.
    674674
    675                                 attStr += ' ' + sAttName + '="' + String(sAttValue).replace( '"', '"' ) + '"' ;
     675                                // leave templates
     676                                if ( sAttName.StartsWith( '{{' ) && sAttName.EndsWith( '}}' ) ) {
     677                                        attStr += ' ' + sAttName ;
     678                                }
     679                                else {
     680                                        attStr += ' ' + sAttName + '="' + String(sAttValue).replace( '"', '"' ) + '"' ;
     681                                }
    676682                        }
    677683                }
    678684                return attStr ;
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy