[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final class PhabricatorSystemSelectEncodingController 4 extends PhabricatorController { 5 6 public function shouldRequireLogin() { 7 return false; 8 } 9 10 public function processRequest() { 11 $request = $this->getRequest(); 12 13 if (!function_exists('mb_list_encodings')) { 14 return $this->newDialog() 15 ->setTitle(pht('No Encoding Support')) 16 ->appendParagraph( 17 pht( 18 'This system does not have the "mbstring" extension installed, '. 19 'so character encodings are not supported. Install "mbstring" to '. 20 'enable support.')) 21 ->addCancelButton('/'); 22 } 23 24 if ($request->isFormPost()) { 25 $result = array('encoding' => $request->getStr('encoding')); 26 return id(new AphrontAjaxResponse())->setContent($result); 27 } 28 29 $encodings = mb_list_encodings(); 30 $encodings = array_fuse($encodings); 31 asort($encodings); 32 unset($encodings['pass']); 33 unset($encodings['auto']); 34 35 $encodings = array( 36 '' => pht('(Use Default)'), 37 ) + $encodings; 38 39 $form = id(new AphrontFormView()) 40 ->setUser($this->getRequest()->getUser()) 41 ->appendRemarkupInstructions(pht('Choose a text encoding to use.')) 42 ->appendChild( 43 id(new AphrontFormSelectControl()) 44 ->setLabel(pht('Encoding')) 45 ->setName('encoding') 46 ->setValue($request->getStr('encoding')) 47 ->setOptions($encodings)); 48 49 return $this->newDialog() 50 ->setTitle(pht('Select Character Encoding')) 51 ->appendChild($form->buildLayoutView()) 52 ->addSubmitButton(pht('Choose Encoding')) 53 ->addCancelButton('/'); 54 } 55 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Nov 30 09:20:46 2014 | Cross-referenced by PHPXref 0.7.1 |