public static function get_init_code()
    {
        if (self::is_publishing()) {
            $code = "";

            // if objects have set up initialization code, add that in
            foreach (self::$init_code as $block) {
                $block = trim($block);
                if (strlen($block) == 0) {
                    continue;
                }
                if (substr($block, 0, 5) != '<?php') {
                    $code .= '<?php ';
                }
                $code .= $block;
                if (substr($block, -2) != '?>') {
                    $code .= ' ?>';
                }
                $code .= "\n";
            }
            
            // if there are variables to initialize, add that in
            if (count(self::$vars) > 0) {
                $code .= "\n<?php\n";
                foreach (self::$vars as $var => $valCode) {
                    if ($valCode === true) {
                        continue;
                    } // this means it was already set in the initialization
                    $code .= '$' . $var . ' = ' . $valCode . ";\n";
                }
                $code .= "\n?>\n";
            }
            
            return $code;
        }
    }