ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilBibliograficFileReaderBase Class Reference

Class ilBibliograficFileReaderBase. More...

+ Inheritance diagram for ilBibliograficFileReaderBase:
+ Collaboration diagram for ilBibliograficFileReaderBase:

Public Member Functions

 readContent ($path_to_file)
 
 getFileContent ()
 
 setFileContent ($file_content)
 
 getPathToFile ()
 
 setPathToFile ($path_to_file)
 
- Public Member Functions inherited from ilBibliograficFileReader
 readContent ($path_to_file)
 
 parseContent ()
 

Data Fields

const ENCODING_UTF_8 = 'UTF-8'
 
const ENCODING_ASCII = 'ASCII'
 
const ENCODING_ISO_8859_1 = 'ISO-8859-1'
 

Protected Member Functions

 convertFiletoUTF8 ()
 
 convertStringToUTF8 ($string)
 

Protected Attributes

 $file_content = ''
 
 $path_to_file = ''
 

Detailed Description

Member Function Documentation

◆ convertFiletoUTF8()

ilBibliograficFileReaderBase::convertFiletoUTF8 ( )
protected

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

38 {
39 file_put_contents($this->getPathToFile(), $this->convertStringToUTF8(file_get_contents($this->getPathToFile())));
40 }

References convertStringToUTF8(), and getPathToFile().

+ Here is the call graph for this function:

◆ convertStringToUTF8()

ilBibliograficFileReaderBase::convertStringToUTF8 (   $string)
protected
Parameters
$string
Returns
string

Definition at line 48 of file class.ilBibliograficFileReaderBase.php.

48 {
49 if (!function_exists('mb_detect_encoding') || !function_exists('mb_detect_order')
50 || !function_exists("mb_convert_encoding")
51 ) {
52 return $string;
53 }
54 ob_end_clean();
55 $mb_detect_encoding = mb_detect_encoding($string);
56 mb_detect_order(array( self::ENCODING_UTF_8, self::ENCODING_ISO_8859_1 ));
57 switch ($mb_detect_encoding) {
59 break;
61 $string = utf8_encode(iconv(self::ENCODING_ASCII, 'UTF-8//IGNORE', $string));
62 break;
63 default:
64 $string = mb_convert_encoding($string, self::ENCODING_UTF_8, $mb_detect_encoding);
65 break;
66 }
67
68 return $string;
69 }

References ENCODING_ASCII, and ENCODING_UTF_8.

Referenced by convertFiletoUTF8(), and readContent().

+ Here is the caller graph for this function:

◆ getFileContent()

ilBibliograficFileReaderBase::getFileContent ( )
Returns
string

Definition at line 75 of file class.ilBibliograficFileReaderBase.php.

References $file_content.

Referenced by ilBibTex\convertBibSpecialChars(), ilBibTex\normalizeContent(), and ilBibTex\parseContent().

+ Here is the caller graph for this function:

◆ getPathToFile()

ilBibliograficFileReaderBase::getPathToFile ( )
Returns
string

Definition at line 91 of file class.ilBibliograficFileReaderBase.php.

References $path_to_file.

Referenced by convertFiletoUTF8().

+ Here is the caller graph for this function:

◆ readContent()

ilBibliograficFileReaderBase::readContent (   $path_to_file)
Parameters
$path_to_file
Returns
bool

Implements ilBibliograficFileReader.

Definition at line 29 of file class.ilBibliograficFileReaderBase.php.

29 {
31 // $this->convertFiletoUTF8();
32 $this->setFileContent($this->convertStringToUTF8(file_get_contents($path_to_file)));
33
34 return true;
35 }

References $path_to_file, convertStringToUTF8(), setFileContent(), and setPathToFile().

+ Here is the call graph for this function:

◆ setFileContent()

ilBibliograficFileReaderBase::setFileContent (   $file_content)
Parameters
string$file_content

Definition at line 83 of file class.ilBibliograficFileReaderBase.php.

83 {
84 $this->file_content = $file_content;
85 }

References $file_content.

Referenced by ilBibTex\convertBibSpecialChars(), ilBibTex\normalizeContent(), and readContent().

+ Here is the caller graph for this function:

◆ setPathToFile()

ilBibliograficFileReaderBase::setPathToFile (   $path_to_file)
Parameters
string$path_to_file

Definition at line 99 of file class.ilBibliograficFileReaderBase.php.

99 {
100 $this->path_to_file = $path_to_file;
101 }

References $path_to_file.

Referenced by readContent().

+ Here is the caller graph for this function:

Field Documentation

◆ $file_content

ilBibliograficFileReaderBase::$file_content = ''
protected

Definition at line 17 of file class.ilBibliograficFileReaderBase.php.

Referenced by getFileContent(), and setFileContent().

◆ $path_to_file

ilBibliograficFileReaderBase::$path_to_file = ''
protected

◆ ENCODING_ASCII

const ilBibliograficFileReaderBase::ENCODING_ASCII = 'ASCII'

Definition at line 12 of file class.ilBibliograficFileReaderBase.php.

Referenced by convertStringToUTF8().

◆ ENCODING_ISO_8859_1

const ilBibliograficFileReaderBase::ENCODING_ISO_8859_1 = 'ISO-8859-1'

Definition at line 13 of file class.ilBibliograficFileReaderBase.php.

◆ ENCODING_UTF_8

const ilBibliograficFileReaderBase::ENCODING_UTF_8 = 'UTF-8'

Definition at line 11 of file class.ilBibliograficFileReaderBase.php.

Referenced by convertStringToUTF8().


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