-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLanguageFileConversion_lib.php
More file actions
60 lines (50 loc) · 1.34 KB
/
LanguageFileConversion_lib.php
File metadata and controls
60 lines (50 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
interface translationConverter
{
public function XMLToLang();
public static function langToXML($langFile);
}
class LanguageConverter
{
/**
* Get language slug from file name.
* @author david.williams
* @param String $path Path to xml or language file.
* @return String Language slug.
*/
protected function getLangSlug($path)
{
$langSlug = str_replace("/", "\\", $path);
$langSlug = explode("\\", $langSlug);
return end($langSlug);
}
/**
* Get client custom slug from path.
* @author david.williams
* @param String $path Path to xml or language file.
* @return String Client custom slug.
*/
protected function getClientSlug($path)
{
$langSlug = explode("_", pathinfo($path)['filename']);
return $langSlug[0];
}
/**
* Get full file name from xml document.
* @author david.williams
* @return String name of file without extention.
*/
protected function getCurrentFileName(){
$fileURI = pathinfo($this->xml->documentURI);
return $fileURI['filename'];
}
/**
* Get directory of current xml.
* @author david.williams
* @return String directory of currently open xml file.
*/
protected function getCurrentFileDir(){
$fileURI = pathinfo(str_replace("file:/", "", $this->xml->documentURI) );
return $fileURI['dirname'];
}
}