ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilBiblFileReaderBase Class Reference

Class ilBiblFileReaderBase. More...

+ Inheritance diagram for ilBiblFileReaderBase:
+ Collaboration diagram for ilBiblFileReaderBase:

Public Member Functions

 __construct (ilBiblEntryFactoryInterface $entry_factory, ilBiblFieldFactoryInterface $field_factory, ilBiblAttributeFactoryInterface $attribute_factory)
 ilBiblFileReaderBase constructor. More...
 
 getFileContent ()
 
 setFileContent ($file_content)
 
 getPathToFile ()
 
 setPathToFile ($path_to_file)
 
 getEntryFactory ()
 
Returns
ilBiblEntryFactoryInterface
More...
 
 getFieldFactory ()
 
Returns
ilBiblFieldFactoryInterface
More...
 
 getAttributeFactory ()
 
- Public Member Functions inherited from ilBiblFileReaderInterface
 readContent ($path_to_file)
 
 parseContent ()
 

Data Fields

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

Protected Member Functions

 convertStringToUTF8 ($string)
 

Protected Attributes

 $file_content = ''
 
 $path_to_file = ''
 
 $entry_factory
 
 $field_factory
 
 $attribute_factory
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilBiblFileReaderBase::__construct ( ilBiblEntryFactoryInterface  $entry_factory,
ilBiblFieldFactoryInterface  $field_factory,
ilBiblAttributeFactoryInterface  $attribute_factory 
)

ilBiblFileReaderBase constructor.

Parameters
ilBiblEntryFactoryInterface$entry_factory

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

References $attribute_factory, $DIC, $entry_factory, $field_factory, $path_to_file, convertStringToUTF8(), ilBiblFileReaderInterface\readContent(), setFileContent(), and setPathToFile().

48  {
49  $this->entry_factory = $entry_factory;
50  $this->field_factory = $field_factory;
51  $this->attribute_factory = $attribute_factory;
52  }
+ Here is the call graph for this function:

Member Function Documentation

◆ convertStringToUTF8()

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

Definition at line 79 of file class.ilBiblFileReaderBase.php.

Referenced by __construct().

80  {
81  if (!function_exists('mb_detect_encoding') || !function_exists('mb_detect_order')
82  || !function_exists("mb_convert_encoding")) {
83  return $string;
84  }
85  ob_end_clean();
86  $mb_detect_encoding = mb_detect_encoding($string);
87  mb_detect_order(array( self::ENCODING_UTF_8, self::ENCODING_ISO_8859_1 ));
88  switch ($mb_detect_encoding) {
89  case self::ENCODING_UTF_8:
90  break;
91  case self::ENCODING_ASCII:
92  $string = utf8_encode(iconv(self::ENCODING_ASCII, 'UTF-8//IGNORE', $string));
93  break;
94  default:
95  $string = mb_convert_encoding($string, self::ENCODING_UTF_8, $mb_detect_encoding);
96  break;
97  }
98 
99  return $string;
100  }
+ Here is the caller graph for this function:

◆ getAttributeFactory()

ilBiblFileReaderBase::getAttributeFactory ( )

Implements ilBiblFileReaderInterface.

Definition at line 213 of file class.ilBiblFileReaderBase.php.

References $attribute_factory.

Referenced by setPathToFile().

+ Here is the caller graph for this function:

◆ getEntryFactory()

ilBiblFileReaderBase::getEntryFactory ( )

Returns
ilBiblEntryFactoryInterface

Implements ilBiblFileReaderInterface.

Definition at line 196 of file class.ilBiblFileReaderBase.php.

References $entry_factory.

Referenced by setPathToFile().

+ Here is the caller graph for this function:

◆ getFieldFactory()

ilBiblFileReaderBase::getFieldFactory ( )

◆ getFileContent()

ilBiblFileReaderBase::getFileContent ( )
Returns
string

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

References $file_content.

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

+ Here is the caller graph for this function:

◆ getPathToFile()

ilBiblFileReaderBase::getPathToFile ( )
Returns
string

Definition at line 124 of file class.ilBiblFileReaderBase.php.

References $path_to_file.

◆ setFileContent()

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

Definition at line 115 of file class.ilBiblFileReaderBase.php.

References $file_content.

Referenced by __construct(), ilBiblTexFileReader\convertBibSpecialChars(), and ilBiblTexFileReader\normalizeContent().

116  {
117  $this->file_content = $file_content;
118  }
+ Here is the caller graph for this function:

◆ setPathToFile()

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

Definition at line 133 of file class.ilBiblFileReaderBase.php.

References $entry_factory, $key, $path_to_file, $type, $x, getAttributeFactory(), getEntryFactory(), ilObject2\getId(), ilBiblFileReaderInterface\parseContent(), ilStr\strLen(), and ilStr\subStr().

Referenced by __construct().

134  {
135  $this->path_to_file = $path_to_file;
136  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $attribute_factory

ilBiblFileReaderBase::$attribute_factory
protected

Definition at line 39 of file class.ilBiblFileReaderBase.php.

Referenced by __construct(), and getAttributeFactory().

◆ $entry_factory

ilBiblFileReaderBase::$entry_factory
protected

Definition at line 31 of file class.ilBiblFileReaderBase.php.

Referenced by __construct(), getEntryFactory(), and setPathToFile().

◆ $field_factory

ilBiblFileReaderBase::$field_factory
protected

Definition at line 35 of file class.ilBiblFileReaderBase.php.

Referenced by __construct(), and getFieldFactory().

◆ $file_content

ilBiblFileReaderBase::$file_content = ''
protected

Definition at line 23 of file class.ilBiblFileReaderBase.php.

Referenced by getFileContent(), and setFileContent().

◆ $path_to_file

ilBiblFileReaderBase::$path_to_file = ''
protected

Definition at line 27 of file class.ilBiblFileReaderBase.php.

Referenced by __construct(), getPathToFile(), and setPathToFile().

◆ ATTRIBUTE_VALUE_MAXIMAL_TEXT_LENGTH

const ilBiblFileReaderBase::ATTRIBUTE_VALUE_MAXIMAL_TEXT_LENGTH = 4000

Definition at line 16 of file class.ilBiblFileReaderBase.php.

◆ ENCODING_ASCII

const ilBiblFileReaderBase::ENCODING_ASCII = 'ASCII'

Definition at line 18 of file class.ilBiblFileReaderBase.php.

◆ ENCODING_ISO_8859_1

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

Definition at line 19 of file class.ilBiblFileReaderBase.php.

◆ ENCODING_UTF_8

const ilBiblFileReaderBase::ENCODING_UTF_8 = 'UTF-8'

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


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