PluginProbe
User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor / 2.0.6
User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor v2.0.6
4.0.2 4.0.1 4.0.0 3.16.6 3.16.5 3.16.4 3.16.3 3.16.2 3.16.1 3.16.0 3.15.9 3.9.9 3.9.5 3.9.6 3.9.7 3.9.8 1.1.7 1.1.8 1.1.9 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 All 340 releases
profile-builder / assets / lib / Mustache / Loader / CascadingLoader.php

CascadingLoader.php in User Profile Builder – Beautiful User Registration Forms, User Profiles & User Role Editor 2.0.6, at assets/lib/Mustache/Loader/CascadingLoader.php

70 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /*
4 * This file is part of Mustache.php.
5 *
6 * (c) 2013 Justin Hileman
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12 /**
13 * A Mustache Template cascading loader implementation, which delegates to other
14 * Loader instances.
15 */
16 class Mustache_Loader_CascadingLoader implements Mustache_Loader
17 {
18 private $loaders;
19
20 /**
21 * Construct a CascadingLoader with an array of loaders:
22 *
23 * $loader = new Mustache_Loader_CascadingLoader(array(
24 * new Mustache_Loader_InlineLoader(__FILE__, __COMPILER_HALT_OFFSET__),
25 * new Mustache_Loader_FilesystemLoader(__DIR__.'/templates')
26 * ));
27 *
28 * @param array $loaders An array of Mustache Loader instances
29 */
30 public function __construct(array $loaders = array())
31 {
32 $this->loaders = array();
33 foreach ($loaders as $loader) {
34 $this->addLoader($loader);
35 }
36 }
37
38 /**
39 * Add a Loader instance.
40 *
41 * @param Mustache_Loader $loader A Mustache Loader instance
42 */
43 public function addLoader(Mustache_Loader $loader)
44 {
45 $this->loaders[] = $loader;
46 }
47
48 /**
49 * Load a Template by name.
50 *
51 * @throws Mustache_Exception_UnknownTemplateException If a template file is not found.
52 *
53 * @param string $name
54 *
55 * @return string Mustache Template source
56 */
57 public function load($name)
58 {
59 foreach ($this->loaders as $loader) {
60 try {
61 return $loader->load($name);
62 } catch (Mustache_Exception_UnknownTemplateException $e) {
63 // do nothing, check the next loader.
64 }
65 }
66
67 throw new Mustache_Exception_UnknownTemplateException($name);
68 }
69 }
70