ILIAS  release_8 Revision v8.24
ilLangDeprecated Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Collaboration diagram for ilLangDeprecated:

Public Member Functions

 __construct ()
 ilLangDeprecated constructor. More...
 
 getDeprecatedLangVars ()
 Get deprecated lang vars. More...
 

Protected Member Functions

 getCandidates ()
 Get candidates from the db. More...
 
 parseCodeFiles ()
 Parse Code Files. More...
 
 getCodeFiles (string $path)
 Get code files. More...
 
 parseCodeFile (string $file_path)
 Parse code file and reduce candidates. More...
 

Protected Attributes

array $candidates
 

Private Attributes

const ILIAS_CLASS_FILE_RE = "class\..*\.php$"
 
ilDBInterface $db
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Search for deprecated lang vars

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e

Definition at line 28 of file class.ilLangDeprecated.php.

Constructor & Destructor Documentation

◆ __construct()

ilLangDeprecated::__construct ( )

ilLangDeprecated constructor.

Definition at line 38 of file class.ilLangDeprecated.php.

39 {
40 global $DIC;
41 $this->db = $DIC->database();
42 }
global $DIC
Definition: feed.php:28

References $DIC.

Member Function Documentation

◆ getCandidates()

ilLangDeprecated::getCandidates ( )
protected

Get candidates from the db.

Base are all lang vars of the english lang file reduced by the ones being accessed (having entries in lng_log)

Definition at line 58 of file class.ilLangDeprecated.php.

58 : void
59 {
60 $log = array();
61 $set = $this->db->query("SELECT module, identifier FROM lng_log ");
62 while ($rec = $this->db->fetchAssoc($set)) {
63 $log[$rec["module"] . ":" . $rec["identifier"]] = 1;
64 }
65 $set = $this->db->query("SELECT module, identifier FROM lng_data WHERE lang_key = " .
66 $this->db->quote("en", "text") . " ORDER BY module, identifier");
67 while ($rec = $this->db->fetchAssoc($set)) {
68 if (!isset($log[$rec["module"] . ":" . $rec["identifier"]])) {
69 $this->candidates[$rec["identifier"]] = $rec["module"];
70 }
71 }
72 }
$log
Definition: result.php:33

References $log.

Referenced by getDeprecatedLangVars().

+ Here is the caller graph for this function:

◆ getCodeFiles()

ilLangDeprecated::getCodeFiles ( string  $path)
protected

Get code files.

Definition at line 87 of file class.ilLangDeprecated.php.

87 : \Generator
88 {
89 foreach (
90 new \RegexIterator(
91 new \RecursiveIteratorIterator(
92 new \RecursiveDirectoryIterator($path),
93 \RecursiveIteratorIterator::SELF_FIRST,
94 \RecursiveIteratorIterator::CATCH_GET_CHILD
95 ),
96 '/' . self::ILIAS_CLASS_FILE_RE . '/i'
97 ) as $file
98 ) {
99 yield $file;
100 }
101 }
$path
Definition: ltiservices.php:32

References $path.

Referenced by parseCodeFiles().

+ Here is the caller graph for this function:

◆ getDeprecatedLangVars()

ilLangDeprecated::getDeprecatedLangVars ( )

Get deprecated lang vars.

Definition at line 47 of file class.ilLangDeprecated.php.

47 : array
48 {
49 $this->getCandidates();
50 $this->parseCodeFiles();
51 return $this->candidates;
52 }
parseCodeFiles()
Parse Code Files.
getCandidates()
Get candidates from the db.

References $candidates, getCandidates(), and parseCodeFiles().

+ Here is the call graph for this function:

◆ parseCodeFile()

ilLangDeprecated::parseCodeFile ( string  $file_path)
protected

Parse code file and reduce candidates.

Definition at line 106 of file class.ilLangDeprecated.php.

106 : void
107 {
108 $tokens = token_get_all(file_get_contents($file_path));
109 $num_tokens = count($tokens);
110
111 for ($i = 0; $i < $num_tokens; $i++) {
112 if (is_string($tokens[$i])) {
113 continue;
114 }
115
116 $token = $tokens[$i][0];
117 switch ($token) {
118 case T_STRING:
119 case T_CONSTANT_ENCAPSED_STRING:
120 $lv = str_replace(array("'", '"'), "", $tokens[$i][1]);
121 if ($lv !== "") {
122 unset($this->candidates[$lv]);
123 }
124 break;
125 }
126 }
127 }
$i
Definition: metadata.php:41
$token
Definition: xapitoken.php:70

References $i, and $token.

Referenced by parseCodeFiles().

+ Here is the caller graph for this function:

◆ parseCodeFiles()

ilLangDeprecated::parseCodeFiles ( )
protected

Parse Code Files.

Definition at line 77 of file class.ilLangDeprecated.php.

77 : void
78 {
79 foreach ($this->getCodeFiles(ILIAS_ABSOLUTE_PATH) as $file) {
80 $this->parseCodeFile($file->getPathname());
81 }
82 }
parseCodeFile(string $file_path)
Parse code file and reduce candidates.
getCodeFiles(string $path)
Get code files.

References getCodeFiles(), and parseCodeFile().

Referenced by getDeprecatedLangVars().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $candidates

array ilLangDeprecated::$candidates
protected

Definition at line 32 of file class.ilLangDeprecated.php.

Referenced by getDeprecatedLangVars().

◆ $db

ilDBInterface ilLangDeprecated::$db
private

Definition at line 33 of file class.ilLangDeprecated.php.

◆ ILIAS_CLASS_FILE_RE

const ilLangDeprecated::ILIAS_CLASS_FILE_RE = "class\..*\.php$"
private

Definition at line 30 of file class.ilLangDeprecated.php.


The documentation for this class was generated from the following file: