[ Index ] |
PHP Cross Reference of phpBB-3.2.11-deutsch |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * 4 * This file is part of the phpBB Forum Software package. 5 * 6 * @copyright (c) phpBB Limited <https://www.phpbb.com> 7 * @license GNU General Public License, version 2 (GPL-2.0) 8 * 9 * For full copyright and license information, please see 10 * the docs/CREDITS.txt file. 11 * 12 */ 13 14 namespace phpbb\routing\resources_locator; 15 16 use phpbb\extension\manager; 17 18 /** 19 * Locates the yaml routing resources located in the default locations 20 */ 21 class default_resources_locator implements resources_locator_interface 22 { 23 /** 24 * phpBB root path 25 * 26 * @var string 27 */ 28 protected $phpbb_root_path; 29 30 /** 31 * Name of the current environment 32 * 33 * @var string 34 */ 35 protected $environment; 36 37 /** 38 * Extension manager 39 * 40 * @var manager 41 */ 42 protected $extension_manager; 43 44 /** 45 * Construct method 46 * 47 * @param string $phpbb_root_path phpBB root path 48 * @param string $environment Name of the current environment 49 * @param manager $extension_manager Extension manager 50 */ 51 public function __construct($phpbb_root_path, $environment, manager $extension_manager = null) 52 { 53 $this->phpbb_root_path = $phpbb_root_path; 54 $this->environment = $environment; 55 $this->extension_manager = $extension_manager; 56 } 57 58 /** 59 * {@inheritdoc} 60 */ 61 public function locate_resources() 62 { 63 $resources = [['config/' . $this->environment . '/routing/environment.yml', 'yaml']]; 64 65 $resources = $this->append_ext_resources($resources); 66 67 return $resources; 68 } 69 70 /** 71 * Append extension resources to an array of resouces 72 * 73 * @see resources_locator_interface::locate_resources() 74 * 75 * @param mixed[] $resources List of resources 76 * 77 * @return mixed[] List of resources 78 */ 79 protected function append_ext_resources(array $resources) 80 { 81 if ($this->extension_manager !== null) 82 { 83 foreach ($this->extension_manager->all_enabled(false) as $path) 84 { 85 if (file_exists($this->phpbb_root_path . $path . 'config/' . $this->environment . '/routing/environment.yml')) 86 { 87 $resources[] = [$path . 'config/' . $this->environment . '/routing/environment.yml', 'yaml']; 88 } 89 else if (!is_dir($this->phpbb_root_path . $path . 'config/' . $this->environment)) 90 { 91 if (file_exists($this->phpbb_root_path . $path . 'config/default/routing/environment.yml')) 92 { 93 $resources[] = [$path . 'config/default/routing/environment.yml', 'yaml']; 94 } 95 else if (!is_dir($this->phpbb_root_path . $path . 'config/default/routing') && file_exists($this->phpbb_root_path . $path . 'config/routing.yml')) 96 { 97 $resources[] = [$path . 'config/routing.yml', 'yaml']; 98 } 99 } 100 } 101 } 102 103 return $resources; 104 } 105 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Nov 11 20:33:01 2020 | Cross-referenced by PHPXref 0.7.1 |