30 if (!defined(
'PHPEXCEL_ROOT')) {
34 define(
'PHPEXCEL_ROOT', dirname(__FILE__) .
'/../');
35 require(PHPEXCEL_ROOT .
'PHPExcel/Autoloader.php');
55 array(
'type' =>
'IWriter',
'path' =>
'PHPExcel/Writer/{0}.php',
'class' =>
'PHPExcel_Writer_{0}' ),
56 array(
'type' =>
'IReader',
'path' =>
'PHPExcel/Reader/{0}.php',
'class' =>
'PHPExcel_Reader_{0}' )
101 if (is_array($value)) {
102 self::$_searchLocations = $value;
104 throw new Exception(
'Invalid parameter passed.');
118 self::$_searchLocations[] = array(
'type' =>
$type,
'path' =>
$location,
'class' => $classname );
133 $searchType =
'IWriter';
136 foreach (self::$_searchLocations as $searchLocation) {
137 if ($searchLocation[
'type'] == $searchType) {
138 $className = str_replace(
'{0}', $writerType, $searchLocation[
'class']);
139 $classFile = str_replace(
'{0}', $writerType, $searchLocation[
'path']);
141 $instance =
new $className($phpExcel);
142 if (!is_null($instance)) {
149 throw new Exception(
"No $searchType found for type $writerType");
163 $searchType =
'IReader';
166 foreach (self::$_searchLocations as $searchLocation) {
167 if ($searchLocation[
'type'] == $searchType) {
168 $className = str_replace(
'{0}', $readerType, $searchLocation[
'class']);
169 $classFile = str_replace(
'{0}', $readerType, $searchLocation[
'path']);
171 $instance =
new $className();
172 if (!is_null($instance)) {
179 throw new Exception(
"No $searchType found for type $readerType");
191 public static function load($pFilename) {
193 return $reader->load($pFilename);
207 $className = get_class(
$reader);
208 $classType = explode(
'_',$className);
210 return array_pop($classType);
225 $pathinfo = pathinfo($pFilename);
227 if (isset($pathinfo[
'extension'])) {
228 switch (strtolower($pathinfo[
'extension'])) {
266 foreach (self::$_autoResolveClasses as $autoResolveClass) {
268 if (
$reader->canRead($pFilename)) {