TYPO3 CMS  TYPO3_6-2
AbstractImagePreset.php
Go to the documentation of this file.
1 <?php
3 
18 
23 
27  protected $defaultExecutableSearchPaths = array(
28  '/usr/local/bin/',
29  '/opt/local/bin/',
30  '/usr/bin/',
31  '/usr/X11R6/bin/',
32  '/opt/bin/',
33  'C:/php/ImageMagick/',
34  'C:/php/GraphicsMagick/',
35  'C:/apache/ImageMagick/',
36  'C:/apache/GraphicsMagick/',
37  );
38 
42  protected $foundPath = '';
43 
49  public function getFoundPath() {
50  return $this->foundPath;
51  }
52 
59  public function isActive() {
60  $isActive = TRUE;
61  foreach ($this->configurationValues as $configurationKey => $configurationValue) {
62  if ($configurationKey !== 'GFX/im_path'
63  && $configurationKey !== 'GFX/im_path_lzw'
64  ) {
65  $currentValue = $this->configurationManager->getConfigurationValueByPath($configurationKey);
66  if ($currentValue !== $configurationValue) {
67  $isActive = FALSE;
68  break;
69  }
70  }
71  }
72  return $isActive;
73  }
74 
80  public function isAvailable() {
81  $searchPaths = $this->getSearchPaths();
82  return $this->findExecutableInPath($searchPaths);
83  }
84 
90  public function getConfigurationValues() {
91  $this->findExecutableInPath($this->getSearchPaths());
93  $configurationValues['GFX/im_path'] = $this->getFoundPath();
94  $configurationValues['GFX/im_path_lzw'] = $this->getFoundPath();
95  return $configurationValues;
96  }
97 
104  abstract protected function findExecutableInPath(array $searchPaths);
105 
111  protected function getSearchPaths() {
113 
114  // Add configured im_path on top
115  $imPath = $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_path'];
116  if (strlen($imPath) && !in_array($imPath, $searchPaths)) {
117  $path = $this->cleanUpPath($imPath);
118  array_unshift($searchPaths, $path);
119  }
120 
121  // Add configured im_path_lzw on top
122  $imLzwSearchPath = $GLOBALS['TYPO3_CONF_VARS']['GFX']['im_path_lzw'];
123  if (strlen($imLzwSearchPath) && !in_array($imLzwSearchPath, $searchPaths)) {
124  $path = $this->cleanUpPath($imLzwSearchPath);
125  array_unshift($searchPaths, $path);
126  }
127 
128  // Add additional search path from form if given
129  if (isset($this->postValues['additionalSearchPath'])
130  && strlen($this->postValues['additionalSearchPath'])
131  && !in_array($this->postValues['additionalSearchPath'], $searchPaths)
132  ) {
133  $path = $this->cleanUpPath($this->postValues['additionalSearchPath']);
134  array_unshift($searchPaths, $path);
135  }
136 
137  return $searchPaths;
138  }
139 
146  protected function cleanUpPath($path) {
148  // Add trailing slash if missing
149  if (!preg_match('/[\\/]$/', $path)) {
150  $path .= '/';
151  }
152  return $path;
153  }
154 }
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]