Opened 17 years ago
Closed 12 years ago
#1545 closed New Feature (wontfix)
Support packing namespace constants ( jsMyObject.MYCONSTANT=1; )
Reported by: | Joe Wieloch | Owned by: | |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | Project : CKPackager | Version: | |
Keywords: | HasPatch | Cc: |
Description
Our project has many namespace constants which we want to be packed.
Below shows constant declarations we wish to have processed:
In the javascript:
jsTreeView.EXPAND = 1; jsTreeView.COLLAPSE = 2; jsTreeView.TOGGLE = 3;
In the FCKPackager.xml:
<Constant name="jsTreeView.EXPAND" value="1"/> <Constant name="jsTreeView.COLLAPSE" value="2"/> <Constant name="jsTreeView.TOGGLE" value="3"/>
We modified fckpackager.php to support packing these. I'm posting our changes here for consideration.
The following method was modified in class FCKConstantProcessor:
function Process( $script ) { if ( !$this->HasConstants ) return $script; $output = $script ; if ( $this->RemoveDeclaration ) { // /var\s+(?:BASIC_COLOR_RED|BASIC_COLOR_BLUE)\s*=.+?;/ // remove if global constant $output = preg_replace( '/var\\s+(?:' . $this->_ContantsRegexPart . ')\\s*=.+?;/m', '', $output ) ; // remove if namespace constant (jsMyObject.MYCONSTANT=1;) $output = preg_replace( '/(?<!\\w)(?:' . $this->_ContantsRegexPart . ')\\s*=[^=]+?;/m', '', $output ) ; } $output = preg_replace_callback( '/(?<!var\\s|...\.|\\w)(?:' . $this->_ContantsRegexPart . ')(?!\\w|\\s*=[^=])/', array( &$this, '_Contant_Replace_Evaluator' ), $output ) ; return $output ; }
The above also includes the possible fix noted in #1244
Change History (4)
comment:1 Changed 17 years ago by
comment:2 Changed 17 years ago by
Type: | Bug → New Feature |
---|
comment:3 Changed 17 years ago by
Keywords: | HasPatch added |
---|
comment:4 Changed 12 years ago by
Resolution: | → wontfix |
---|---|
Status: | new → closed |
FCKeditor is no longer supported and I believe this problem is not reproducible anymore in CKEditor and its packager.
Sorry, this should be filed as a new feature request.