Code Duplication    Length = 37-37 lines in 2 locations

index.php 1 location

@@ 109-145 (lines=37) @@
106
 *
107
 * @param string $class The fully-qualified class name.
108
 */
109
spl_autoload_register(function ($class) use ($sourcedir)
110
{
111
	$classMap = array(
112
		'ReCaptcha\\' => 'ReCaptcha/',
113
		'MatthiasMullie\\Minify\\' => 'minify/src/',
114
		'MatthiasMullie\\PathConverter\\' => 'minify/path-converter/src/',
115
	);
116
117
	// Do any third-party scripts want in on the fun?
118
	call_integration_hook('integrate_autoload', array(&$classMap));
119
120
	foreach ($classMap as $prefix => $dirName)
121
	{
122
		// does the class use the namespace prefix?
123
		$len = strlen($prefix);
124
		if (strncmp($prefix, $class, $len) !== 0)
125
		{
126
			continue;
127
		}
128
129
		// get the relative class name
130
		$relativeClass = substr($class, $len);
131
132
		// replace the namespace prefix with the base directory, replace namespace
133
		// separators with directory separators in the relative class name, append
134
		// with .php
135
		$fileName = $dirName . strtr($relativeClass, '\\', '/') . '.php';
136
137
		// if the file exists, require it
138
		if (file_exists($fileName = $sourcedir . '/' . $fileName))
139
		{
140
			require_once $fileName;
141
142
			return;
143
		}
144
	}
145
});
146
147
// Register an error handler.
148
set_error_handler('smf_error_handler');

SSI.php 1 location

@@ 111-147 (lines=37) @@
108
 *
109
 * @param string $class The fully-qualified class name.
110
 */
111
spl_autoload_register(function ($class) use ($sourcedir)
112
{
113
	$classMap = array(
114
		'ReCaptcha\\' => 'ReCaptcha/',
115
		'MatthiasMullie\\Minify\\' => 'minify/src/',
116
		'MatthiasMullie\\PathConverter\\' => 'minify/path-converter/src/',
117
	);
118
119
	// Do any third-party scripts want in on the fun?
120
	call_integration_hook('integrate_autoload', array(&$classMap));
121
122
	foreach ($classMap as $prefix => $dirName)
123
	{
124
		// does the class use the namespace prefix?
125
		$len = strlen($prefix);
126
		if (strncmp($prefix, $class, $len) !== 0)
127
		{
128
			continue;
129
		}
130
131
		// get the relative class name
132
		$relativeClass = substr($class, $len);
133
134
		// replace the namespace prefix with the base directory, replace namespace
135
		// separators with directory separators in the relative class name, append
136
		// with .php
137
		$fileName = $dirName . strtr($relativeClass, '\\', '/') . '.php';
138
139
		// if the file exists, require it
140
		if (file_exists($fileName = $sourcedir . '/' . $fileName))
141
		{
142
			require_once $fileName;
143
144
			return;
145
		}
146
	}
147
});
148
149
// Primarily, this is to fix the URLs...
150
ob_start('ob_sessrewrite');