Re: Error: CuteEditorInitialize is not defined

  •  12-17-2008, 10:12 AM

    Re: Error: CuteEditorInitialize is not defined

    I agree, that there should be a method of the CuteEditor class that retuns only the headers for a field, but until there is one, this is what I've done to get round it which gets over the problems you describe:
     
    Note that my Rich_text class just gets a new instance of the CuteEditor class with parameters specific to the supplied field which has it's definitions set up in advance and returns the output of the CuteEditot.getString()
     
    It sets CE_Editor1_IDSettingClass_Strings to a empty object as the variable will get set anyway when the ajax code is written which saves 16k of download.
     
    public function get_rich_text_headers() {
                $header = array ();
                $header [] = '<script language="JavaScript">var CE_Editor1_IDSettingClass_Strings={};</script>';
                foreach ( $this->form_fields as $fld ) {
                    if ($fld ['type'] == Field::RICH_TEXT or $fld ['type'] == Field::FILE) {
                        $rich_text = Rich_text::get_rich_text ( $fld ['name'] );
                        $script_matches = '';
                        $link_matches = '';
                        preg_match_all ( '/<script.+?<"/script>/si', $rich_text,
                                $script_matches );
                        preg_match_all ( '/<link.+?"/>/si', $rich_text,
                                $link_matches );
                        foreach ( $script_matches [0] as $value ) {
                            if (strpos ( $value,
                                    'CE_Editor1_IDSettingClass_Strings' ) ===
                                     false) {
                                        $header [] = $value;
                            }
                        }
                        foreach ( $link_matches [0] as $value ) {
                            $header [] = $value;
                        }
                    }
                }
                
                $header = array_unique ( $header );
                return join ( ""n", $header );
            }
View Complete Thread