mirror of
https://github.com/WenPai-org/wp-china-yes.git
synced 2025-08-08 14:59:18 +08:00
feat:3.0.0版初次提交,新版将完全推倒重写
This commit is contained in:
parent
e556c4b6d9
commit
39735249ee
293 changed files with 26908 additions and 475 deletions
35
vendor/loco-translate/src/ajax/DownloadConfController.php
vendored
Normal file
35
vendor/loco-translate/src/ajax/DownloadConfController.php
vendored
Normal file
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
/**
|
||||
* Downloads a bundle configuration as XML or Json
|
||||
*/
|
||||
class Loco_ajax_DownloadConfController extends Loco_ajax_common_BundleController {
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function render(){
|
||||
|
||||
$this->validate();
|
||||
$bundle = $this->getBundle();
|
||||
|
||||
$file = new Loco_fs_File( $this->get('path') );
|
||||
// TODO should we download axtual loco.xml file if bundle is configured from it?
|
||||
//$file->normalize( $bundle->getDirectoryPath() );
|
||||
//if( $file->exists() ){}
|
||||
|
||||
$writer = new Loco_config_BundleWriter($bundle);
|
||||
|
||||
switch( $file->extension() ){
|
||||
case 'xml':
|
||||
return $writer->toXml();
|
||||
case 'json':
|
||||
return json_encode( $writer->jsonSerialize() );
|
||||
}
|
||||
|
||||
// @codeCoverageIgnoreStart
|
||||
throw new Loco_error_Exception('Specify either XML or JSON file path');
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue