Пример #1
0
 static function alpha_builds($clean = true)
 {
     $localeDetails = new localeDetails();
     $version = self::alpha_version;
     $ret = array();
     foreach (self::alpha_locales() as $locale) {
         $ret[] = array('locale' => array('code' => $locale, 'english' => $localeDetails->getEnglishNameForLocale($locale), 'native' => $localeDetails->getNativeNameForLocale($locale)), 'download' => array(self::maemo => self::download_url($locale, self::maemo, $version, $clean), self::android => self::download_url($locale, self::android, $version, $clean)));
     }
     return $ret;
 }
Пример #2
0
    /**
     * This is a TEMPORARY functions while we migrate pages from mozilla-europe to mozilla.com.  This function
     * will return the language arrays into a format that the old download.js understands.
     *
     * There are currently two sets of behavior for our download buttons:
     *
     * 1) Locale and platform are detected by javascript, and the best download we can give is
     *    offered in the green download button.  This means someone visiting http://www.mozilla.com/de/
     *    with an English browser will be given an English download (even if the content of the page
     *    is in German).
     *
     * 2) Platform is detected by javascript and locale is determined by URL.  This means visiting
     *    http://www.mozilla.com/de/ will offer a German download, no matter what locale the visitor's
     *    browser is in.
     *
     * As of this writing, mozilla-europe.org is using method #2, mozilla.com is using method #1.  Our
     * goal is to get both sites on method #2, however, since mozilla.com only has en-US on it right now,
     * we'd only ever offer users an English download.  Until we get translated content for other locales,
     * we'll have to revert to option #1 on mozilla.com.  This function translates the php into js so we can
     * continue to provide that behavior.
     *
     * When this file is removed, grep for the following string:
     *          20070827_TEMP
     * Sections of code marked with that string are related directly to this file, and are not used
     * elsewhere (and can be removed).
     *
     *  -- clouserw
     */
    function getJavaScriptDownloadArray()
    {
        // Good thing this is going to be cached, because this is gonna be ugly...
        $_firefoxDetails = new firefoxDetails();
        $_thunderbirdDetails = new thunderbirdDetails();
        $_localeDetails = new localeDetails();
        // Building the array in php is going to be easier, so we'll do that first
        $_php_array = array();
        foreach ($_localeDetails->languages as $locale => $names) {
            $locale_array = explode('-', strtolower($locale));
            $_language_code = $locale_array[0];
            $_region_code = isset($locale_array[1]) ? $locale_array[1] : '-';
            $_newest_firefox = $_firefoxDetails->getNewestVersionForLocale($locale);
            $_oldest_firefox = $_firefoxDetails->getOldestVersionForLocale($locale);
            $_beta_firefox = $_firefoxDetails->getDevelVersionForLocale($locale);
            $_aurora_firefox = $_firefoxDetails->getAuroraVersionForLocale($locale);
            $_newest_thunderbird = $_thunderbirdDetails->getNewestVersionForLocale($locale);
            $_oldest_thunderbird = $_thunderbirdDetails->getOldestVersionForLocale($locale);
            $_beta_thunderbird = $_thunderbirdDetails->getDevelVersionForLocale($locale);
            $_oldest_firefox = $_oldest_firefox == $_newest_firefox ? '' : $_oldest_firefox;
            $_oldest_thunderbird = $_oldest_thunderbird == $_newest_thunderbird ? '' : $_oldest_thunderbird;
            $_php_array[$_language_code][$_region_code] = array('fx' => $_newest_firefox, 'fxold' => $_oldest_firefox, 'fxbeta' => $_beta_firefox, 'fxaurora' => $_aurora_firefox, 'tb' => $_newest_thunderbird, 'tbold' => $_oldest_thunderbird, 'tbbeta' => $_beta_thunderbird, 'name' => $_localeDetails->getEnglishNameForLocale($locale), 'localName' => $_localeDetails->getNativeNameForLocale($locale));
        }
        $_final = '';
        $_final_region = '';
        foreach ($_php_array as $locale => $val) {
            $_final .= empty($_final) ? '' : ",\n";
            $_final .= '"' . $locale . '": {';
            foreach ($val as $region => $data) {
                $_fx = empty($data['fx']) ? 'null' : '"' . $data['fx'] . '"';
                $_fxold = empty($data['fxold']) ? 'null' : '"' . $data['fxold'] . '"';
                $_fxbeta = empty($data['fxbeta']) ? 'null' : '"' . $data['fxbeta'] . '"';
                $_fxaurora = empty($data['fxaurora']) ? 'null' : '"' . $data['fxaurora'] . '"';
                $_tb = empty($data['tb']) ? 'null' : '"' . $data['tb'] . '"';
                $_tbold = empty($data['tbold']) ? 'null' : '"' . $data['tbold'] . '"';
                $_tbbeta = empty($data['tbbeta']) ? 'null' : '"' . $data['tbbeta'] . '"';
                $_final_region .= empty($_final_region) ? '' : ",\n";
                $_final_region .= <<<A_FINAL
 \t"{$region}": { fx: {$_fx},\tfxold: {$_fxold},\tfxbeta: {$_fxbeta},\tfxaurora: {$_fxaurora},\ttb: {$_tb},\ttbold: {$_tbold},\ttbbeta: {$_tbbeta},\tname: "{$data['name']}",\tlocalName: "{$data['localName']}" }
A_FINAL;
            }
            $_final .= $_final_region . ' }';
            $_final_region = '';
        }
        return "var gLanguages = {\n{$_final}\n};";
    }