Allow a language to be chosen before installing WordPress. First pass.
* Checks WordPress.org for available languages. * In get_locale(), starts using the WPLANG option that has existed in multisite since the MU days. * Adds new argument to wp_install() for setting WPLANG. see #28577. Built from https://develop.svn.wordpress.org/trunk@28774 git-svn-id: http://core.svn.wordpress.org/trunk@28587 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
b2f6e1f674
commit
c504fb41a1
|
@ -311,3 +311,38 @@ body.rtl,
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
.language-chooser select {
|
||||
margin: 1px;
|
||||
padding: 8px;
|
||||
width: 100%;
|
||||
display: block;
|
||||
border: 1px solid #ddd;
|
||||
-webkit-border-radius: 0;
|
||||
border-radius: 0; /* Reset mobile webkit's default element styling */
|
||||
-webkit-transition: .05s border-color ease-in-out;
|
||||
transition: .05s border-color ease-in-out;
|
||||
outline: 0;
|
||||
-webkit-box-shadow: inset 0 1px 2px rgba(0,0,0,0.07);
|
||||
box-shadow: inset 0 1px 2px rgba(0,0,0,0.07);
|
||||
background-color: #fff;
|
||||
color: #333;
|
||||
font-size: 16px;
|
||||
font-family: inherit;
|
||||
font-weight: inherit;
|
||||
}
|
||||
|
||||
.language-chooser select:focus {
|
||||
border-color: #5b9dd9;
|
||||
-webkit-box-shadow: 0 0 2px rgba(30,140,190,0.8);
|
||||
box-shadow: 0 0 2px rgba(30,140,190,0.8);
|
||||
}
|
||||
|
||||
.wp-core-ui .language-chooser .button.button-hero {
|
||||
font-size: 30px;
|
||||
line-height: 30px;
|
||||
}
|
||||
|
||||
.language-chooser p {
|
||||
text-align: left;
|
||||
}
|
|
@ -1 +1 @@
|
|||
html{background:#f1f1f1;margin:0 20px}body{background:#fff;color:#444;font-family:"Open Sans",sans-serif;margin:140px auto 25px;padding:20px 20px 10px;max-width:700px;-webkit-font-smoothing:subpixel-antialiased;-webkit-box-shadow:0 1px 3px rgba(0,0,0,.13);box-shadow:0 1px 3px rgba(0,0,0,.13)}a{color:#0074a2;text-decoration:none}a:hover{color:#2ea2cc}h1{border-bottom:1px solid #dedede;clear:both;color:#666;font-size:24px;margin:30px 0;padding:0;padding-bottom:7px;font-weight:400}h2{font-size:16px}dd,dt,li,p{padding-bottom:2px;font-size:14px;line-height:1.5}.code,code{font-family:Consolas,Monaco,monospace}dl,ol,ul{padding:5px 22px 5px 5px}a img{border:0}abbr{border:0;font-variant:normal}#logo{margin:6px 0 14px;border-bottom:0;text-align:center}#logo a{background-image:url(../images/w-logo-blue.png?ver=20131202);background-image:none,url(../images/wordpress-logo.svg?ver=20131107);-webkit-background-size:80px 80px;background-size:80px 80px;background-position:center top;background-repeat:no-repeat;color:#999;height:80px;font-size:20px;font-weight:400;line-height:1.3em;margin:-130px auto 25px;padding:0;text-decoration:none;width:80px;text-indent:-9999px;outline:0;overflow:hidden;display:block}.step{margin:20px 0 15px}.step,th{text-align:right;padding:0}.step .button-large{font-size:14px}textarea{border:1px solid #dfdfdf;font-family:"Open Sans",sans-serif;width:100%;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.form-table{border-collapse:collapse;margin-top:1em;width:100%}.form-table td{margin-bottom:9px;padding:10px 0 10px 20px;border-bottom:8px solid #fff;font-size:14px;vertical-align:top}.form-table th{font-size:14px;text-align:right;padding:16px 0 10px 20px;width:140px;vertical-align:top}.form-table code{line-height:18px;font-size:14px}.form-table p{margin:4px 0 0;font-size:11px}.form-table input{line-height:20px;font-size:15px;padding:3px 5px;border:1px solid #ddd;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,.07);box-shadow:inset 0 1px 2px rgba(0,0,0,.07)}input,submit{font-family:"Open Sans",sans-serif}.form-table input[type=password],.form-table input[type=text]{width:206px}.form-table th p{font-weight:400}.form-table.install-success td{vertical-align:middle;padding:16px 0 10px 20px}.form-table.install-success td p{margin:0;font-size:14px}.form-table.install-success td code{margin:0;font-size:18px}#error-page{margin-top:50px}#error-page p{font-size:14px;line-height:18px;margin:25px 0 20px}#error-page code,.code{font-family:Consolas,Monaco,monospace}#pass-strength-result{background-color:#eee;border-color:#ddd!important;border-style:solid;border-width:1px;margin:5px 0 5px 5px;padding:5px;text-align:center;width:200px;display:none}#pass-strength-result.bad{background-color:#ffb78c;border-color:#ff853c!important}#pass-strength-result.good{background-color:#ffec8b;border-color:#fc0!important}#pass-strength-result.short{background-color:#ffa0a0;border-color:#f04040!important}#pass-strength-result.strong{background-color:#c3ff88;border-color:#8dff1c!important}.message{border:1px solid #c00;padding:.5em .7em;margin:5px 0 15px;background-color:#ffebe8}#admin_email,#dbhost,#dbname,#pass1,#pass2,#prefix,#pwd,#uname,#user_login{direction:ltr}.rtl input,.rtl submit,.rtl textarea,body.rtl{font-family:Tahoma,sans-serif}:lang(he-il) .rtl input,:lang(he-il) .rtl submit,:lang(he-il) .rtl textarea,:lang(he-il) body.rtl{font-family:Arial,sans-serif}@media only screen and (max-width:799px){body{margin-top:115px}#logo a{margin:-125px auto 30px}}@media screen and (max-width:782px){.form-table{margin-top:0}.form-table td,.form-table th{display:block;width:auto;vertical-align:middle}.form-table th{padding:20px 0 0}.form-table td{padding:5px 0;border:0;margin:0}input,textarea{font-size:16px}.form-table span.description,.form-table td input[type=password],.form-table td input[type=text],.form-table td select,.form-table td textarea{width:100%;font-size:16px;line-height:1.5;padding:7px 10px;display:block;max-width:none;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}}
|
||||
html{background:#f1f1f1;margin:0 20px}body{background:#fff;color:#444;font-family:"Open Sans",sans-serif;margin:140px auto 25px;padding:20px 20px 10px;max-width:700px;-webkit-font-smoothing:subpixel-antialiased;-webkit-box-shadow:0 1px 3px rgba(0,0,0,.13);box-shadow:0 1px 3px rgba(0,0,0,.13)}a{color:#0074a2;text-decoration:none}a:hover{color:#2ea2cc}h1{border-bottom:1px solid #dedede;clear:both;color:#666;font-size:24px;margin:30px 0;padding:0;padding-bottom:7px;font-weight:400}h2{font-size:16px}dd,dt,li,p{padding-bottom:2px;font-size:14px;line-height:1.5}.code,code{font-family:Consolas,Monaco,monospace}dl,ol,ul{padding:5px 22px 5px 5px}a img{border:0}abbr{border:0;font-variant:normal}#logo{margin:6px 0 14px;border-bottom:0;text-align:center}#logo a{background-image:url(../images/w-logo-blue.png?ver=20131202);background-image:none,url(../images/wordpress-logo.svg?ver=20131107);-webkit-background-size:80px 80px;background-size:80px 80px;background-position:center top;background-repeat:no-repeat;color:#999;height:80px;font-size:20px;font-weight:400;line-height:1.3em;margin:-130px auto 25px;padding:0;text-decoration:none;width:80px;text-indent:-9999px;outline:0;overflow:hidden;display:block}.step{margin:20px 0 15px}.step,th{text-align:right;padding:0}.step .button-large{font-size:14px}textarea{border:1px solid #dfdfdf;font-family:"Open Sans",sans-serif;width:100%;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.form-table{border-collapse:collapse;margin-top:1em;width:100%}.form-table td{margin-bottom:9px;padding:10px 0 10px 20px;border-bottom:8px solid #fff;font-size:14px;vertical-align:top}.form-table th{font-size:14px;text-align:right;padding:16px 0 10px 20px;width:140px;vertical-align:top}.form-table code{line-height:18px;font-size:14px}.form-table p{margin:4px 0 0;font-size:11px}.form-table input{line-height:20px;font-size:15px;padding:3px 5px;border:1px solid #ddd;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,.07);box-shadow:inset 0 1px 2px rgba(0,0,0,.07)}input,submit{font-family:"Open Sans",sans-serif}.form-table input[type=password],.form-table input[type=text]{width:206px}.form-table th p{font-weight:400}.form-table.install-success td{vertical-align:middle;padding:16px 0 10px 20px}.form-table.install-success td p{margin:0;font-size:14px}.form-table.install-success td code{margin:0;font-size:18px}#error-page{margin-top:50px}#error-page p{font-size:14px;line-height:18px;margin:25px 0 20px}#error-page code,.code{font-family:Consolas,Monaco,monospace}#pass-strength-result{background-color:#eee;border-color:#ddd!important;border-style:solid;border-width:1px;margin:5px 0 5px 5px;padding:5px;text-align:center;width:200px;display:none}#pass-strength-result.bad{background-color:#ffb78c;border-color:#ff853c!important}#pass-strength-result.good{background-color:#ffec8b;border-color:#fc0!important}#pass-strength-result.short{background-color:#ffa0a0;border-color:#f04040!important}#pass-strength-result.strong{background-color:#c3ff88;border-color:#8dff1c!important}.message{border:1px solid #c00;padding:.5em .7em;margin:5px 0 15px;background-color:#ffebe8}#admin_email,#dbhost,#dbname,#pass1,#pass2,#prefix,#pwd,#uname,#user_login{direction:ltr}.rtl input,.rtl submit,.rtl textarea,body.rtl{font-family:Tahoma,sans-serif}:lang(he-il) .rtl input,:lang(he-il) .rtl submit,:lang(he-il) .rtl textarea,:lang(he-il) body.rtl{font-family:Arial,sans-serif}@media only screen and (max-width:799px){body{margin-top:115px}#logo a{margin:-125px auto 30px}}@media screen and (max-width:782px){.form-table{margin-top:0}.form-table td,.form-table th{display:block;width:auto;vertical-align:middle}.form-table th{padding:20px 0 0}.form-table td{padding:5px 0;border:0;margin:0}input,textarea{font-size:16px}.form-table span.description,.form-table td input[type=password],.form-table td input[type=text],.form-table td select,.form-table td textarea{width:100%;font-size:16px;line-height:1.5;padding:7px 10px;display:block;max-width:none;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}}.language-chooser select{margin:1px;padding:8px;width:100%;display:block;border:1px solid #ddd;-webkit-border-radius:0;border-radius:0;-webkit-transition:.05s border-color ease-in-out;transition:.05s border-color ease-in-out;outline:0;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,.07);box-shadow:inset 0 1px 2px rgba(0,0,0,.07);background-color:#fff;color:#333;font-size:16px;font-family:inherit;font-weight:inherit}.language-chooser select:focus{border-color:#5b9dd9;-webkit-box-shadow:0 0 2px rgba(30,140,190,.8);box-shadow:0 0 2px rgba(30,140,190,.8)}.wp-core-ui .language-chooser .button.button-hero{font-size:30px;line-height:30px}.language-chooser p{text-align:left}
|
|
@ -311,3 +311,38 @@ body.rtl,
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
.language-chooser select {
|
||||
margin: 1px;
|
||||
padding: 8px;
|
||||
width: 100%;
|
||||
display: block;
|
||||
border: 1px solid #ddd;
|
||||
-webkit-border-radius: 0;
|
||||
border-radius: 0; /* Reset mobile webkit's default element styling */
|
||||
-webkit-transition: .05s border-color ease-in-out;
|
||||
transition: .05s border-color ease-in-out;
|
||||
outline: 0;
|
||||
-webkit-box-shadow: inset 0 1px 2px rgba(0,0,0,0.07);
|
||||
box-shadow: inset 0 1px 2px rgba(0,0,0,0.07);
|
||||
background-color: #fff;
|
||||
color: #333;
|
||||
font-size: 16px;
|
||||
font-family: inherit;
|
||||
font-weight: inherit;
|
||||
}
|
||||
|
||||
.language-chooser select:focus {
|
||||
border-color: #5b9dd9;
|
||||
-webkit-box-shadow: 0 0 2px rgba(30,140,190,0.8);
|
||||
box-shadow: 0 0 2px rgba(30,140,190,0.8);
|
||||
}
|
||||
|
||||
.wp-core-ui .language-chooser .button.button-hero {
|
||||
font-size: 30px;
|
||||
line-height: 30px;
|
||||
}
|
||||
|
||||
.language-chooser p {
|
||||
text-align: right;
|
||||
}
|
|
@ -1 +1 @@
|
|||
html{background:#f1f1f1;margin:0 20px}body{background:#fff;color:#444;font-family:"Open Sans",sans-serif;margin:140px auto 25px;padding:20px 20px 10px;max-width:700px;-webkit-font-smoothing:subpixel-antialiased;-webkit-box-shadow:0 1px 3px rgba(0,0,0,.13);box-shadow:0 1px 3px rgba(0,0,0,.13)}a{color:#0074a2;text-decoration:none}a:hover{color:#2ea2cc}h1{border-bottom:1px solid #dedede;clear:both;color:#666;font-size:24px;margin:30px 0;padding:0;padding-bottom:7px;font-weight:400}h2{font-size:16px}dd,dt,li,p{padding-bottom:2px;font-size:14px;line-height:1.5}.code,code{font-family:Consolas,Monaco,monospace}dl,ol,ul{padding:5px 5px 5px 22px}a img{border:0}abbr{border:0;font-variant:normal}#logo{margin:6px 0 14px;border-bottom:0;text-align:center}#logo a{background-image:url(../images/w-logo-blue.png?ver=20131202);background-image:none,url(../images/wordpress-logo.svg?ver=20131107);-webkit-background-size:80px 80px;background-size:80px 80px;background-position:center top;background-repeat:no-repeat;color:#999;height:80px;font-size:20px;font-weight:400;line-height:1.3em;margin:-130px auto 25px;padding:0;text-decoration:none;width:80px;text-indent:-9999px;outline:0;overflow:hidden;display:block}.step{margin:20px 0 15px}.step,th{text-align:left;padding:0}.step .button-large{font-size:14px}textarea{border:1px solid #dfdfdf;font-family:"Open Sans",sans-serif;width:100%;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.form-table{border-collapse:collapse;margin-top:1em;width:100%}.form-table td{margin-bottom:9px;padding:10px 20px 10px 0;border-bottom:8px solid #fff;font-size:14px;vertical-align:top}.form-table th{font-size:14px;text-align:left;padding:16px 20px 10px 0;width:140px;vertical-align:top}.form-table code{line-height:18px;font-size:14px}.form-table p{margin:4px 0 0;font-size:11px}.form-table input{line-height:20px;font-size:15px;padding:3px 5px;border:1px solid #ddd;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,.07);box-shadow:inset 0 1px 2px rgba(0,0,0,.07)}input,submit{font-family:"Open Sans",sans-serif}.form-table input[type=password],.form-table input[type=text]{width:206px}.form-table th p{font-weight:400}.form-table.install-success td{vertical-align:middle;padding:16px 20px 10px 0}.form-table.install-success td p{margin:0;font-size:14px}.form-table.install-success td code{margin:0;font-size:18px}#error-page{margin-top:50px}#error-page p{font-size:14px;line-height:18px;margin:25px 0 20px}#error-page code,.code{font-family:Consolas,Monaco,monospace}#pass-strength-result{background-color:#eee;border-color:#ddd!important;border-style:solid;border-width:1px;margin:5px 5px 5px 0;padding:5px;text-align:center;width:200px;display:none}#pass-strength-result.bad{background-color:#ffb78c;border-color:#ff853c!important}#pass-strength-result.good{background-color:#ffec8b;border-color:#fc0!important}#pass-strength-result.short{background-color:#ffa0a0;border-color:#f04040!important}#pass-strength-result.strong{background-color:#c3ff88;border-color:#8dff1c!important}.message{border:1px solid #c00;padding:.5em .7em;margin:5px 0 15px;background-color:#ffebe8}#admin_email,#dbhost,#dbname,#pass1,#pass2,#prefix,#pwd,#uname,#user_login{direction:ltr}.rtl input,.rtl submit,.rtl textarea,body.rtl{font-family:Tahoma,sans-serif}:lang(he-il) .rtl input,:lang(he-il) .rtl submit,:lang(he-il) .rtl textarea,:lang(he-il) body.rtl{font-family:Arial,sans-serif}@media only screen and (max-width:799px){body{margin-top:115px}#logo a{margin:-125px auto 30px}}@media screen and (max-width:782px){.form-table{margin-top:0}.form-table td,.form-table th{display:block;width:auto;vertical-align:middle}.form-table th{padding:20px 0 0}.form-table td{padding:5px 0;border:0;margin:0}input,textarea{font-size:16px}.form-table span.description,.form-table td input[type=password],.form-table td input[type=text],.form-table td select,.form-table td textarea{width:100%;font-size:16px;line-height:1.5;padding:7px 10px;display:block;max-width:none;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}}
|
||||
html{background:#f1f1f1;margin:0 20px}body{background:#fff;color:#444;font-family:"Open Sans",sans-serif;margin:140px auto 25px;padding:20px 20px 10px;max-width:700px;-webkit-font-smoothing:subpixel-antialiased;-webkit-box-shadow:0 1px 3px rgba(0,0,0,.13);box-shadow:0 1px 3px rgba(0,0,0,.13)}a{color:#0074a2;text-decoration:none}a:hover{color:#2ea2cc}h1{border-bottom:1px solid #dedede;clear:both;color:#666;font-size:24px;margin:30px 0;padding:0;padding-bottom:7px;font-weight:400}h2{font-size:16px}dd,dt,li,p{padding-bottom:2px;font-size:14px;line-height:1.5}.code,code{font-family:Consolas,Monaco,monospace}dl,ol,ul{padding:5px 5px 5px 22px}a img{border:0}abbr{border:0;font-variant:normal}#logo{margin:6px 0 14px;border-bottom:0;text-align:center}#logo a{background-image:url(../images/w-logo-blue.png?ver=20131202);background-image:none,url(../images/wordpress-logo.svg?ver=20131107);-webkit-background-size:80px 80px;background-size:80px 80px;background-position:center top;background-repeat:no-repeat;color:#999;height:80px;font-size:20px;font-weight:400;line-height:1.3em;margin:-130px auto 25px;padding:0;text-decoration:none;width:80px;text-indent:-9999px;outline:0;overflow:hidden;display:block}.step{margin:20px 0 15px}.step,th{text-align:left;padding:0}.step .button-large{font-size:14px}textarea{border:1px solid #dfdfdf;font-family:"Open Sans",sans-serif;width:100%;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.form-table{border-collapse:collapse;margin-top:1em;width:100%}.form-table td{margin-bottom:9px;padding:10px 20px 10px 0;border-bottom:8px solid #fff;font-size:14px;vertical-align:top}.form-table th{font-size:14px;text-align:left;padding:16px 20px 10px 0;width:140px;vertical-align:top}.form-table code{line-height:18px;font-size:14px}.form-table p{margin:4px 0 0;font-size:11px}.form-table input{line-height:20px;font-size:15px;padding:3px 5px;border:1px solid #ddd;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,.07);box-shadow:inset 0 1px 2px rgba(0,0,0,.07)}input,submit{font-family:"Open Sans",sans-serif}.form-table input[type=password],.form-table input[type=text]{width:206px}.form-table th p{font-weight:400}.form-table.install-success td{vertical-align:middle;padding:16px 20px 10px 0}.form-table.install-success td p{margin:0;font-size:14px}.form-table.install-success td code{margin:0;font-size:18px}#error-page{margin-top:50px}#error-page p{font-size:14px;line-height:18px;margin:25px 0 20px}#error-page code,.code{font-family:Consolas,Monaco,monospace}#pass-strength-result{background-color:#eee;border-color:#ddd!important;border-style:solid;border-width:1px;margin:5px 5px 5px 0;padding:5px;text-align:center;width:200px;display:none}#pass-strength-result.bad{background-color:#ffb78c;border-color:#ff853c!important}#pass-strength-result.good{background-color:#ffec8b;border-color:#fc0!important}#pass-strength-result.short{background-color:#ffa0a0;border-color:#f04040!important}#pass-strength-result.strong{background-color:#c3ff88;border-color:#8dff1c!important}.message{border:1px solid #c00;padding:.5em .7em;margin:5px 0 15px;background-color:#ffebe8}#admin_email,#dbhost,#dbname,#pass1,#pass2,#prefix,#pwd,#uname,#user_login{direction:ltr}.rtl input,.rtl submit,.rtl textarea,body.rtl{font-family:Tahoma,sans-serif}:lang(he-il) .rtl input,:lang(he-il) .rtl submit,:lang(he-il) .rtl textarea,:lang(he-il) body.rtl{font-family:Arial,sans-serif}@media only screen and (max-width:799px){body{margin-top:115px}#logo a{margin:-125px auto 30px}}@media screen and (max-width:782px){.form-table{margin-top:0}.form-table td,.form-table th{display:block;width:auto;vertical-align:middle}.form-table th{padding:20px 0 0}.form-table td{padding:5px 0;border:0;margin:0}input,textarea{font-size:16px}.form-table span.description,.form-table td input[type=password],.form-table td input[type=text],.form-table td select,.form-table td textarea{width:100%;font-size:16px;line-height:1.5;padding:7px 10px;display:block;max-width:none;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}}.language-chooser select{margin:1px;padding:8px;width:100%;display:block;border:1px solid #ddd;-webkit-border-radius:0;border-radius:0;-webkit-transition:.05s border-color ease-in-out;transition:.05s border-color ease-in-out;outline:0;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,.07);box-shadow:inset 0 1px 2px rgba(0,0,0,.07);background-color:#fff;color:#333;font-size:16px;font-family:inherit;font-weight:inherit}.language-chooser select:focus{border-color:#5b9dd9;-webkit-box-shadow:0 0 2px rgba(30,140,190,.8);box-shadow:0 0 2px rgba(30,140,190,.8)}.wp-core-ui .language-chooser .button.button-hero{font-size:30px;line-height:30px}.language-chooser p{text-align:right}
|
|
@ -32,9 +32,10 @@ if ( !function_exists('wp_install') ) :
|
|||
* @param bool $public Whether blog is public.
|
||||
* @param null $deprecated Optional. Not used.
|
||||
* @param string $user_password Optional. User's chosen password. Will default to a random password.
|
||||
* @param string $language Optional. Language chosen.
|
||||
* @return array Array keys 'url', 'user_id', 'password', 'password_message'.
|
||||
*/
|
||||
function wp_install( $blog_title, $user_name, $user_email, $public, $deprecated = '', $user_password = '' ) {
|
||||
function wp_install( $blog_title, $user_name, $user_email, $public, $deprecated = '', $user_password = '', $language = '' ) {
|
||||
if ( !empty( $deprecated ) )
|
||||
_deprecated_argument( __FUNCTION__, '2.6' );
|
||||
|
||||
|
@ -48,6 +49,10 @@ function wp_install( $blog_title, $user_name, $user_email, $public, $deprecated
|
|||
update_option('admin_email', $user_email);
|
||||
update_option('blog_public', $public);
|
||||
|
||||
if ( $language ) {
|
||||
update_option( 'WPLANG', $language );
|
||||
}
|
||||
|
||||
$guessurl = wp_guess_url();
|
||||
|
||||
update_option('siteurl', $guessurl);
|
||||
|
|
|
@ -43,6 +43,28 @@ require_once( ABSPATH . 'wp-includes/wp-db.php' );
|
|||
|
||||
$step = isset( $_GET['step'] ) ? (int) $_GET['step'] : 0;
|
||||
|
||||
/**
|
||||
* @todo rename, move
|
||||
*/
|
||||
function wp_get_available_translations() {
|
||||
$url = 'http://api.wordpress.org/translations/core/1.0/';
|
||||
if ( wp_http_supports( array( 'ssl' ) ) ) {
|
||||
$url = set_url_scheme( $url, 'https' );
|
||||
}
|
||||
|
||||
$options = array(
|
||||
'timeout' => 3,
|
||||
'body' => array( 'version' => $GLOBALS['wp_version'] ),
|
||||
);
|
||||
|
||||
$response = wp_remote_post( $url, $options );
|
||||
$body = wp_remote_retrieve_body( $response );
|
||||
if ( $body && $body = json_decode( $body, true ) ) {
|
||||
return $body;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display install header.
|
||||
*
|
||||
|
@ -136,6 +158,7 @@ function display_setup_form( $error = null ) {
|
|||
</tr>
|
||||
</table>
|
||||
<p class="step"><input type="submit" name="Submit" value="<?php esc_attr_e( 'Install WordPress' ); ?>" class="button button-large" /></p>
|
||||
<input type="hidden" name="language" value="<?php echo isset( $_POST['language'] ) ? esc_attr( $_POST['language'] ) : ''; ?>" />
|
||||
</form>
|
||||
<?php
|
||||
} // end display_setup_form()
|
||||
|
@ -169,9 +192,51 @@ if ( ! is_string( $wpdb->base_prefix ) || '' === $wpdb->base_prefix ) {
|
|||
}
|
||||
|
||||
switch($step) {
|
||||
case 0: // Step 1
|
||||
case 1: // Step 1, direct link.
|
||||
display_header();
|
||||
case 0: // Step 0
|
||||
if ( $body = wp_get_available_translations() ) {
|
||||
display_header();
|
||||
|
||||
echo '<form id="setup" method="post" action="install.php?step=1">';
|
||||
echo '<div class="language-chooser">';
|
||||
echo '<select name="language" id="language-chooser" size="15">';
|
||||
echo '<option selected="selected" value="">English (United States)</option>';
|
||||
foreach ( $body['languages'] as $language ) {
|
||||
echo '<option value="' . esc_attr( $language['language'] ) . '">' . esc_html( $language['native_name'] ) . "</option>\n";
|
||||
}
|
||||
echo "</select>\n";
|
||||
echo '<p class="step"><input type="submit" class="button button-primary button-hero" value="»" /></p>';
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
break;
|
||||
}
|
||||
// Deliberately fall through if we can't reach the translations API.
|
||||
|
||||
case 1: // Step 1, direct link or from language chooser.
|
||||
if ( ! empty( $_POST['language'] ) ) {
|
||||
$body = wp_get_available_translations();
|
||||
foreach ( $body['languages'] as $language ) {
|
||||
if ( $language['language'] === $_POST['language'] ) {
|
||||
$loading_language = $_POST['language'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ( ! empty( $loading_language ) ) {
|
||||
require ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
|
||||
$skin = new Automatic_Upgrader_Skin;
|
||||
$upgrader = new Language_Pack_Upgrader( $skin );
|
||||
$options = array( 'clear_update_cache' => false );
|
||||
$language['type'] = 'core';
|
||||
$language = (object) $language;
|
||||
/**
|
||||
* @todo failures (such as non-direct FS)
|
||||
*/
|
||||
$upgrader->upgrade( $language, array( 'clear_update_cache' => false ) );
|
||||
load_textdomain( 'default', WP_LANG_DIR . "/{$loading_language}.mo" );
|
||||
load_textdomain( 'default', WP_LANG_DIR . "/admin-{$loading_language}.mo" );
|
||||
}
|
||||
}
|
||||
|
||||
display_header();
|
||||
?>
|
||||
<h1><?php _ex( 'Welcome', 'Howdy' ); ?></h1>
|
||||
<p><?php printf( __( 'Welcome to the famous five minute WordPress installation process! You may want to browse the <a href="%s">ReadMe documentation</a> at your leisure. Otherwise, just fill in the information below and you’ll be on your way to using the most extendable and powerful personal publishing platform in the world.' ), '../readme.html' ); ?></p>
|
||||
|
@ -183,6 +248,16 @@ switch($step) {
|
|||
display_setup_form();
|
||||
break;
|
||||
case 2:
|
||||
$loading_language = '';
|
||||
if ( ! empty( $_POST['language'] ) ) {
|
||||
$available_languages = get_available_languages();
|
||||
if ( isset( $available_languages[ $_POST['language'] ] ) ) {
|
||||
$loading_language = $_POST['language'];
|
||||
load_textdomain( 'default', WP_LANG_DIR . "/{$loading_language}.mo" );
|
||||
load_textdomain( 'default', WP_LANG_DIR . "/admin-{$loading_language}.mo" );
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! empty( $wpdb->error ) )
|
||||
wp_die( $wpdb->error->get_error_message() );
|
||||
|
||||
|
@ -219,7 +294,7 @@ switch($step) {
|
|||
|
||||
if ( $error === false ) {
|
||||
$wpdb->show_errors();
|
||||
$result = wp_install( $weblog_title, $user_name, $admin_email, $public, '', wp_slash( $admin_password ) );
|
||||
$result = wp_install( $weblog_title, $user_name, $admin_email, $public, '', wp_slash( $admin_password ), $loading_language );
|
||||
?>
|
||||
|
||||
<h1><?php _e( 'Success!' ); ?></h1>
|
||||
|
@ -250,7 +325,7 @@ switch($step) {
|
|||
}
|
||||
if ( !wp_is_mobile() ) {
|
||||
?>
|
||||
<script type="text/javascript">var t = document.getElementById('weblog_title'); if (t){ t.focus(); }</script>
|
||||
<script type="text/javascript">var t = document.getElementById('weblog_title') || document.getElementById('language-chooser'); if (t){ t.focus(); }</script>
|
||||
<?php } ?>
|
||||
<?php wp_print_scripts( 'user-profile' ); ?>
|
||||
</body>
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
function get_locale() {
|
||||
global $locale;
|
||||
|
||||
if ( isset( $locale ) )
|
||||
if ( isset( $locale ) ) {
|
||||
/**
|
||||
* Filter WordPress install's locale ID.
|
||||
*
|
||||
|
@ -35,6 +35,7 @@ function get_locale() {
|
|||
* @param string $locale The locale ID.
|
||||
*/
|
||||
return apply_filters( 'locale', $locale );
|
||||
}
|
||||
|
||||
// WPLANG is defined in wp-config.
|
||||
if ( defined( 'WPLANG' ) )
|
||||
|
@ -48,6 +49,11 @@ function get_locale() {
|
|||
|
||||
if ( $ms_locale !== false )
|
||||
$locale = $ms_locale;
|
||||
} elseif ( ! defined( 'WP_INSTALLING' ) ) {
|
||||
$db_locale = get_option( 'WPLANG' );
|
||||
if ( $db_locale ) {
|
||||
$locale = $db_locale;
|
||||
}
|
||||
}
|
||||
|
||||
if ( empty( $locale ) )
|
||||
|
|
Loading…
Reference in New Issue