Verzeichnisstruktur phpBB-3.2.0
- Veröffentlicht
- 06.01.2017
So funktioniert es
|
Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück |
Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
Shell.php
001 <?php
002
003 /*
004 * This file is part of the Symfony package.
005 *
006 * (c) Fabien Potencier <fabien@symfony.com>
007 *
008 * For the full copyright and license information, please view the LICENSE
009 * file that was distributed with this source code.
010 */
011
012 namespace Symfony\Component\Finder\Shell;
013
014 @trigger_error('The '.__NAMESPACE__.'\Shell class is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
015
016 /**
017 * @author Jean-François Simon <contact@jfsimon.fr>
018 *
019 * @deprecated since 2.8, to be removed in 3.0.
020 */
021 class Shell
022 {
023 const TYPE_UNIX = 1;
024 const TYPE_DARWIN = 2;
025 const TYPE_CYGWIN = 3;
026 const TYPE_WINDOWS = 4;
027 const TYPE_BSD = 5;
028
029 /**
030 * @var string|null
031 */
032 private $type;
033
034 /**
035 * Returns guessed OS type.
036 *
037 * @return int
038 */
039 public function getType()
040 {
041 if (null === $this->type) {
042 $this->type = $this->guessType();
043 }
044
045 return $this->type;
046 }
047
048 /**
049 * Tests if a command is available.
050 *
051 * @param string $command
052 *
053 * @return bool
054 */
055 public function testCommand($command)
056 {
057 if (!function_exists('exec')) {
058 return false;
059 }
060
061 // todo: find a better way (command could not be available)
062 $testCommand = 'which ';
063 if (self::TYPE_WINDOWS === $this->type) {
064 $testCommand = 'where ';
065 }
066
067 $command = escapeshellcmd($command);
068
069 exec($testCommand.$command, $output, $code);
070
071 return 0 === $code && count($output) > 0;
072 }
073
074 /**
075 * Guesses OS type.
076 *
077 * @return int
078 */
079 private function guessType()
080 {
081 $os = strtolower(PHP_OS);
082
083 if (false !== strpos($os, 'cygwin')) {
084 return self::TYPE_CYGWIN;
085 }
086
087 if (false !== strpos($os, 'darwin')) {
088 return self::TYPE_DARWIN;
089 }
090
091 if (false !== strpos($os, 'bsd')) {
092 return self::TYPE_BSD;
093 }
094
095 if (0 === strpos($os, 'win')) {
096 return self::TYPE_WINDOWS;
097 }
098
099 return self::TYPE_UNIX;
100 }
101 }
102