Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F92984446
PhabricatorSystemSelectEncodingController.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Mon, Nov 25, 08:55
Size
1 KB
Mime Type
text/x-php
Expires
Wed, Nov 27, 08:55 (2 d)
Engine
blob
Format
Raw Data
Handle
22550217
Attached To
rPH Phabricator
PhabricatorSystemSelectEncodingController.php
View Options
<?php
final
class
PhabricatorSystemSelectEncodingController
extends
PhabricatorController
{
public
function
shouldRequireLogin
()
{
return
false
;
}
public
function
processRequest
()
{
$request
=
$this
->
getRequest
();
if
(!
function_exists
(
'mb_list_encodings'
))
{
return
$this
->
newDialog
()
->
setTitle
(
pht
(
'No Encoding Support'
))
->
appendParagraph
(
pht
(
'This system does not have the "%s" extension installed, '
.
'so character encodings are not supported. Install "%s" to '
.
'enable support.'
,
'mbstring'
,
'mbstring'
))
->
addCancelButton
(
'/'
);
}
if
(
$request
->
isFormPost
())
{
$result
=
array
(
'encoding'
=>
$request
->
getStr
(
'encoding'
));
return
id
(
new
AphrontAjaxResponse
())->
setContent
(
$result
);
}
$encodings
=
mb_list_encodings
();
$encodings
=
array_fuse
(
$encodings
);
asort
(
$encodings
);
unset
(
$encodings
[
'pass'
]);
unset
(
$encodings
[
'auto'
]);
$encodings
=
array
(
''
=>
pht
(
'(Use Default)'
),
)
+
$encodings
;
$form
=
id
(
new
AphrontFormView
())
->
setUser
(
$this
->
getRequest
()->
getUser
())
->
appendRemarkupInstructions
(
pht
(
'Choose a text encoding to use.'
))
->
appendChild
(
id
(
new
AphrontFormSelectControl
())
->
setLabel
(
pht
(
'Encoding'
))
->
setName
(
'encoding'
)
->
setValue
(
$request
->
getStr
(
'encoding'
))
->
setOptions
(
$encodings
));
return
$this
->
newDialog
()
->
setTitle
(
pht
(
'Select Character Encoding'
))
->
appendChild
(
$form
->
buildLayoutView
())
->
addSubmitButton
(
pht
(
'Choose Encoding'
))
->
addCancelButton
(
'/'
);
}
}
Event Timeline
Log In to Comment