X7ROOT File Manager
Current Path:
/home/okeydcqc/public_html/wp-content/plugins/depicter/app/src/Services
home
/
okeydcqc
/
public_html
/
wp-content
/
plugins
/
depicter
/
app
/
src
/
Services
/
ðŸ“
..
📄
AIWizardService.php
(4.27 KB)
📄
AssetsAPIService.php
(6.49 KB)
📄
AuthenticationService.php
(2.14 KB)
📄
AuthorizationService.php
(706 B)
📄
BackgroundRemovalService.php
(4.62 KB)
📄
ClientService.php
(7.02 KB)
📄
DocumentFontsService.php
(4.31 KB)
📄
DocumentFontsV1Service.php
(6.61 KB)
📄
ExportService.php
(2.97 KB)
📄
GeoLocateService.php
(2 KB)
📄
GoogleFontsService.php
(5.69 KB)
📄
GoogleRecaptchaV3.php
(1.69 KB)
📄
I18nService.php
(2.02 KB)
📄
ImportService.php
(6.14 KB)
📄
LeadService.php
(6.41 KB)
📄
MediaBridge.php
(8.27 KB)
📄
MediaLibraryService.php
(9.34 KB)
📄
RemoteAPIService.php
(4.77 KB)
📄
ServiceProvider.php
(4.08 KB)
📄
SettingsManagerService.php
(8.82 KB)
📄
StorageService.php
(1.37 KB)
📄
StyleGeneratorService.php
(5.63 KB)
📄
UsageService.php
(3.29 KB)
📄
UserAPIService.php
(3.43 KB)
Editing: I18nService.php
<?php namespace Depicter\Services; class I18nService { /** * @var string */ public $phpFileUrl; /** * @var string */ public $jsonUrl; /** * @var string */ public $json; /** * I18nService constructor. * * @param $phpFileUrl * @param $jsonUrl */ public function __construct( $phpFileUrl, $jsonUrl ) { $this->phpFileUrl = $phpFileUrl; $this->jsonUrl = $jsonUrl; $this->readJson(); $this->run(); } /** * read json file * * @return void */ public function readJson() { $this->json = file_get_contents( $this->jsonUrl ); } public function run() { $data = json_decode( $this->json, true ); $newTexts = "\t\t\t/** ==EditorLocalizationList==START== **/\n\t\t\t"; foreach ( $data as $key => $value ) { $key = str_replace(array("\r\n", "\n", "\r"), '\n', $key); $key = str_replace(array("'"), "\'", $key); $newTexts .= "'".$key."' => __('".$key."', 'depicter'),\n\t\t\t"; } $newTexts .= "/** ==EditorLocalizationList==END== **/\n"; $this->searchAndReplacePhpFile( $newTexts ); } /** * search and replace php file for new texts * @param $newTexts */ public function searchAndReplacePhpFile( $newTexts ) { $lines = file( $this->phpFileUrl ); $startLine = 0; $endLine = 0; foreach ( $lines as $lineNumber => $line ) { if ( $lineNumber == 0 ) { continue; } if ( strpos( "'" . $line ."'", '/** ==EditorLocalizationList==START== **/' ) !== false ) { $startLine = $lineNumber; } if ( strpos( $line, '/** ==EditorLocalizationList==END== **/' ) !== false ) { $endLine = $lineNumber; } if ( $lineNumber >= $startLine && $startLine ) { unset( $lines[ $lineNumber ] ); } if ( $lineNumber == $endLine ) { $lines[ $lineNumber ] = $newTexts; break; } } ksort( $lines ); file_put_contents( $this->phpFileUrl, implode( '', $lines ) ); } } $editorLocalizeFile = 'app/src/Editor/EditorLocalization.php'; $jsonFile = 'resources/scripts/i18n/en/locale.json'; $translateHandler = new I18nService( $editorLocalizeFile, $jsonFile );
Upload File
Create Folder