Loads a template containing the functions which convert properties into
methods.

@return
512675
private String createScript(String skinCookieName) {
		StringWriter sw = new StringWriter();
		try (InputStream is = ClassLoaderResourceUtils.getResourceAsStream(SCRIPT_TEMPLATE, this)) {
			IOUtils.copy(is, sw);
		} catch (IOException e) {
			Marker fatal = MarkerFactory.getMarker("FATAL");
			LOGGER.error(fatal, "a serious error occurred when initializing ThemeSwitcherJsGenerator");
			throw new BundlingProcessException(
					"Classloading issues prevent loading the themeSwitcher template to be loaded. ", e);
		}

		return sw.getBuffer().toString().replaceAll("\\{JAWR_SKIN_COOKIE_NAME\\}", skinCookieName);
	}
1135205
public static function load_template_with_dependencies_parameters() {
        return new external_function_parameters([
            'component' => new external_value(PARAM_COMPONENT, 'component containing the template'),
            'template' => new external_value(PARAM_ALPHANUMEXT, 'name of the template'),
            'themename' => new external_value(PARAM_ALPHANUMEXT, 'The current theme.'),
            'includecomments' => new external_value(PARAM_BOOL, 'Include comments or not', VALUE_DEFAULT, false),
            'lang' => new external_value(PARAM_LANG, 'lang', VALUE_DEFAULT, null),
        ]);
    }
620562
private Properties loadProperties() {

        props = new Properties();

        try {
            InputStream in = Version.class.getResourceAsStream("version.properties");
            props.load(in);
            in.close();
        } catch (Exception e) {
            throw new Error("Missing version.properties");
        }

        return props;
    }
278369
public Map<String, Object> load() throws PropertyException {
		try {
			return mReader.load();
		} catch (IOException e) {
			throw new PropertyException(e.getMessage());
		}
	}
877440
private Map<String, Object> loadPropertyFiles() {
        final Map<String, Object> definedProps = new HashMap<>();
        for (int propertyFileIndex = 0; propertyFileIndex < propertyFiles.size(); propertyFileIndex++) {
            final String filename = propertyFiles.elementAt(propertyFileIndex);
            final Properties props = new Properties();
            FileInputStream fis = null;
            try {
                fis = new FileInputStream(filename);
                props.load(fis);
            } catch (final IOException e) {
                System.out.println("Could not load property file " + filename + ": " + e.getMessage());
            } finally {
                FileUtils.close(fis);
            }

            // ensure that -D properties take precedence
            final Enumeration propertyNames = props.propertyNames();
            while (propertyNames.hasMoreElements()) {
                final String name = propertyNames.nextElement().toString();
                if (!definedProps.containsKey(name)) {
                    final Argument arg = getPluginArguments().get("--" + name);
                    final String value = props.getProperty(name);
                    if (arg != null) {
                        definedProps.put(name, arg.getValue(value));
                    } else {
                        definedProps.put(name, value);
                    }
                }
            }
        }
        return definedProps;
    }
1312748
public static FunctionMap loadFunctionMap() {
        FunctionMap fm = new FunctionMap();
        fm.fm = new HashMap<>();

        fm.addFunction("keyMatch", new KeyMatchFunc());
        fm.addFunction("keyMatch2", new KeyMatch2Func());
        fm.addFunction("regexMatch", new RegexMatchFunc());
        fm.addFunction("ipMatch", new IPMatchFunc());

        return fm;
    }
271199
public TemplateCompilationResults reloadContextAndTemplates(boolean all)
        throws Exception {

        // Create the new merged context source
        TeaServletContextSource contextSource =
            new TeaServletContextSource(
                mApplicationDepot.getClass().getClassLoader(),
                mApplicationDepot,
                getServletContext(),
                getLog(),
                true,
                mProperties.getBoolean("management.httpcontext", false),
                mProperties.getInt("management.httpcontext.readUrlCacheSize", 500),
                isProfilingEnabled());

        // Create a new template source using the newly loaded context
        // source from the new application depot
        TeaServletTemplateSource templateSrc =
            createTemplateSource(contextSource);

        // Recompile all templates using the new context source
        TemplateCompilationResults results =
            templateSrc.compileTemplates(null, all);

        // The new context source and template source are ready for
        // use, set the member variables
        synchronized(this) {
            mApplicationDepot.setContextSource(contextSource);
            mTemplateSource = templateSrc;
        }

        // Return the compilation results
        return results;
    }
1204381
function(methods) {
        var api;
        for (var name in methods) {
            if (methods.hasOwnProperty(name)) {
                api = this._addMethod(name, methods[name]);
            }
        }
        return api;
    }
870223
function () {
                    // Ensure we've got a proper binding context to work with
                    var bindingContext = (dataOrBindingContext && (dataOrBindingContext instanceof ko.bindingContext))
                        ? dataOrBindingContext
                        : new ko.bindingContext(ko.utils.unwrapObservable(dataOrBindingContext));

                    // Support selecting template as a function of the data being rendered
                    var templateName = typeof(template) == 'function' ? template(bindingContext['$data']) : template;

                    var renderedNodesArray = executeTemplate(targetNodeOrNodeArray, renderMode, templateName, bindingContext, options);
                    if (renderMode == "replaceNode") {
                        targetNodeOrNodeArray = renderedNodesArray;
                        firstTargetNode = getFirstNodeFromPossibleArray(targetNodeOrNodeArray);
                    }
                }
590702
protected function loadTemplates()
	{
		$loader = new \Twig_Loader_Filesystem(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'templates');
		$this->twigEnv = new Twig_Environment($loader, ['cache' => false, 'debug' => true]);
		$this->twigEnv->addExtension(new Twig_Extension_Debug());

		// Custom filter for phpdoc
		$filter = new \Twig_Filter('phpdoc', function($string, $indentationCount = 0, $indentChar = "\t") {
			$result = str_repeat($indentChar, $indentationCount) . '/**' . "\n";
			// Split per line
			$lines = explode("\n", trim($string));
			foreach ($lines as $line) {
				$result .= str_repeat($indentChar, $indentationCount) . ' * ' . $line . "\n";
			}
			$result .= str_repeat($indentChar, $indentationCount) . ' */' . "\n";
			return $result;
		});

		$this->twigEnv->addFilter($filter);

		$this->managerTemplate = $this->twigEnv->load('manager.php.twig');
		$this->resourceTemplate = $this->twigEnv->load('resource.php.twig');
		$this->mainClientTemplate = $this->twigEnv->load('mainClient.php.twig');
		$this->mainExceptionTemplate = $this->twigEnv->load('mainException.php.twig');
		$this->unexpectedResponseExceptionTemplate = $this->twigEnv->load('unexpectedResponseException.php.twig');

		if (!is_null($this->testsOutputPath)) {
			$this->mainClientTestTemplate = $this->twigEnv->load('mainClientTest.php.twig');
			$this->managerTestTemplate = $this->twigEnv->load('managerTest.php.twig');
		}
	}
1133752
public HashMap<String, Object> getFunctions(ClassModel classModel) {
        HashMap<String, Object> result = newHashMap();
        for (String name : functions.keySet()) {
            result.put(name, new TemplateFunction(functions.get(name), classModel));
        }
        return result;
    }
1082526
function() {
            var self = this;

            this.template = this.options.template;
            this.args = this.options.args || {};

            // Related view
            this.view = this.options.view || null;

            // Init template context
            _.extend(this.args, {
                "_": _,
                "hr": {
                    "configs": configs,
                    "urls": Urls,
                    "i18n": I18n,
                    "offline": Offline
                },
                "view": {
                    "component": function(cid, args, name, subid) {
                        name = name || cid;

                        if (!self.view) {
                            throw new Error("Error in template " + self.template + " : try to import component in a non view-related template ");
                        }

                        if (Template.components[cid] == null) {
                            throw new Error("Error in template " + self.template + " : try to import component "+cid);
                        }

                        var view = new Template.components[cid].Class(args || {}, self.view);
                        
                        self.view.addComponent(name, view);

                        var component = $("<component/>", {
                            "data-component": view.cid
                        });

                        return component[0].outerHTML;
                    }
                },
                "template": {
                    "args": this.args,
                    "name": this.template,
                    "import": function(name, args, cname) {
                        cname = cname || name;
                        return this.args.view.component("template", {template: name, args: args}, cname);
                    },
                    "htmlid": function(h) {
                        return _.escape(h);
                    }
                }
            }, Template.options);

            return this;
        }
466971
public static Properties load(String props, Properties defProps) {
    Properties		result;
    InputStream		is;

    result = new Properties(defProps);
    is     = null;
    try {
      is = ClassLoader.getSystemResourceAsStream(props);
      result.load(is);
    }
    catch (Exception e) {
      result = defProps;
    }
    finally {
      try {
	if (is != null)
	  is.close();
      }
      catch (Exception e) {
	// ignored
      }
    }

    return result;
  }
1182271
private void initTemplates() throws Exception {
        if (templates != null && templates.length > 0) {
            for (String template : templates) {
                Assert.hasText(template, "Can not read template in ["
                        + template
                        + "]. Check that templates is not empty.");
                createTemplate(client.getLowLevelClient(), classpathRoot, template, forceTemplate);
            }
        }
    }
37392
function loadFields(list, callback) {
  list.forEach(loadMethods)

  function loadMethods(field) {
    var module = require('./fields/' + field + '.js')
      , methods

    if (typeof module === 'function' || typeof module === 'string') {
      methods = {}
      methods[field] = module
    }
    else {
      methods = module
    }

    callback(methods)
  }
}
635178
public PropertiesLoaderBuilder loadAllPropertiesFromSpring() {
        for (PropertySource<?> propertySource : env.getPropertySources()) {
            if (propertySource instanceof MapPropertySource) {
                MapPropertySource mapPropSource = (MapPropertySource) propertySource;
                for (String propName : mapPropSource.getPropertyNames()) {
                    if (!props.containsKey(propName)) {
                        props.put(propName, env.getProperty(propName));
                    }
                }
            }
        }
        return this;
    }
186003
private static Templates initTemplates() {
		try {
			URL xsltURL = ThemeUtil.class.getResource(RESOURCE_NAME);
			if (xsltURL != null) {
				Source xsltSource = new StreamSource(xsltURL.openStream(), xsltURL.toExternalForm());
				TransformerFactory factory = new net.sf.saxon.TransformerFactoryImpl();
				Templates templates = factory.newTemplates(xsltSource);
				LOG.debug("Generated XSLT templates for: " + RESOURCE_NAME);
				return templates;
			} else {
				// Server-side XSLT enabled but theme resource not on classpath.
				throw new IllegalStateException(RESOURCE_NAME + " not on classpath");
			}
		} catch (IOException | TransformerConfigurationException ex) {
			throw new SystemException("Could not create transformer for " + RESOURCE_NAME, ex);
		}
	}