Annotation of AMOLocaliser/res/cbx.php, revision 1.1

1.1     ! ej          1: <?php
        !             2: include_once('version.php');
        !             3: 
        !             4: function get_include_contents($filename) {
        !             5:     global $extdetails;
        !             6:        if (is_file($filename)) {
        !             7:         ob_start();
        !             8:         include $filename;
        !             9:         $contents = ob_get_contents();
        !            10:         ob_end_clean();
        !            11:         return $contents;
        !            12:     }
        !            13:     return false;
        !            14: }
        !            15: 
        !            16: function parse_properties_file($file) {
        !            17:        $out=array();
        !            18:        $lines=file($file,FILE_SKIP_EMPTY_LINES | FILE_IGNORE_NEW_LINES);
        !            19:        foreach($lines as $line) $out[substr($line,0,strpos($line,"="))]=trim(substr($line,strpos($line,"=")+1));
        !            20:        return $out;
        !            21: }
        !            22: 
        !            23: function make_chrome_manifest($header,$filename) {
        !            24:        global $extdetails;
        !            25:        $f=fopen($filename,'w');
        !            26:        fwrite($f,$header);
        !            27:        $oldwd=getcwd();
        !            28:        chdir($extdetails['builddir'].'\\'.$extdetails['locales']);
        !            29:        foreach(glob('*') as $dir) {
        !            30:                fwrite($f,str_replace('\\','/',"locale {$extdetails['name']} $dir {$extdetails['locales']}/{$dir}/{$extdetails['localesub']}\r\n"));
        !            31:                $extdetails['amoproperties'][$dir]=parse_properties_file("{$dir}\\{$extdetails['localesub']}amo.properties");
        !            32:        }
        !            33:        chdir($oldwd);
        !            34:        fclose($f);
        !            35: }
        !            36: 
        !            37: foreach(glob('*.xpi') as $filename) {
        !            38:                unlink($filename);
        !            39: }
        !            40: 
        !            41: echo system("rmdir {$extdetails['builddir']} /s/q");
        !            42: echo system('md '.$extdetails['builddir']);
        !            43: echo system("xcopy chrome {$extdetails['builddir']}\\chrome\\ /E /EXCLUDE:{$extdetails['excludedfiles']}");
        !            44: if (!$extdetails['inclocales']) {
        !            45:        echo system("xcopy {$extdetails['locales']} {$extdetails['builddir']}\\{$extdetails['locales']}\\ /E ");
        !            46: }
        !            47: else foreach($extdetails['inclocales'] as $loc) {
        !            48:        echo system("xcopy {$extdetails['locales']}\\$loc {$extdetails['builddir']}\\{$extdetails['locales']}\\$loc\\ /E ");
        !            49: }
        !            50: echo system("xcopy defaults {$extdetails['builddir']}\\defaults\\ /E");
        !            51: 
        !            52: if ($extdetails['manifestheader']!="") make_chrome_manifest(file_get_contents($extdetails['manifestheader']),'chrome.manifest');
        !            53: copy('chrome.manifest',$extdetails['builddir'].'\chrome.manifest');
        !            54: 
        !            55: file_put_contents('install.rdf',get_include_contents('res\install.rdf.php'));
        !            56: copy('install.rdf',"{$extdetails['builddir']}\\install.rdf");
        !            57: 
        !            58: foreach($extdetails['postprocessfiles'] as $file) {
        !            59:        file_put_contents("{$extdetails['builddir']}\\{$file}",get_include_contents($file));
        !            60: }
        !            61: 
        !            62: chdir($extdetails['builddir']);
        !            63: echo system("..\\..\\7za.exe a -tzip ..\\{$extdetails['xpi']} * -r -mx=9");
        !            64: chdir('..');
        !            65: echo system("rmdir {$extdetails['builddir']} /s/q");
        !            66: 
        !            67: if ($extdetails['archive']!="") copy($extdetails['xpi'],
        !            68:                "{$extdetails['archive']}\\{$extdetails['name']}{$extdetails['version']} [".filemtime($extdetails['xpi'])."].xpi");
        !            69: 
        !            70: file_put_contents('updatefragment.txt',get_include_contents('res\updatefragment.phpd'));
        !            71: ?>

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>