1 | <?php |
||
8 | class PDFTextExtractor extends FileTextExtractor |
||
|
|||
9 | { |
||
10 | /** |
||
11 | * Set to bin path this extractor can execute |
||
12 | * |
||
13 | * @var string |
||
14 | */ |
||
15 | private static $binary_location = null; |
||
16 | |||
17 | /** |
||
18 | * Used if binary_location isn't set. |
||
19 | * List of locations to search for a given binary in |
||
20 | * |
||
21 | * @config |
||
22 | * @var array |
||
23 | */ |
||
24 | private static $search_binary_locations = array( |
||
25 | '/usr/bin', |
||
26 | '/usr/local/bin', |
||
27 | ); |
||
28 | |||
29 | public function isAvailable() |
||
30 | { |
||
31 | $bin = $this->bin('pdftotext'); |
||
32 | return $bin && file_exists($bin) && is_executable($bin); |
||
33 | } |
||
34 | |||
35 | public function supportsExtension($extension) |
||
39 | |||
40 | public function supportsMime($mime) |
||
52 | |||
53 | /** |
||
54 | * Accessor to get the location of the binary |
||
55 | * |
||
56 | * @param string $program Name of binary |
||
57 | * @return string |
||
58 | */ |
||
59 | protected function bin($program = '') |
||
79 | |||
80 | public function getContent($path) |
||
88 | |||
89 | /** |
||
90 | * Invoke pdftotext with the given path |
||
91 | * |
||
92 | * @param string $path |
||
93 | * @return string Output |
||
94 | * @throws FileTextExtractor_Exception |
||
95 | */ |
||
96 | protected function getRawOutput($path) |
||
111 | |||
112 | /** |
||
113 | * Removes utf-8 ligatures. |
||
114 | * |
||
115 | * @link http://en.wikipedia.org/wiki/Typographic_ligature#Computer_typesetting |
||
116 | * |
||
117 | * @param string $input |
||
118 | * @return string |
||
119 | */ |
||
120 | protected function cleanupLigatures($input) |
||
133 | } |
||
134 |
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.