-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathXPHPExcel.php
39 lines (34 loc) · 843 Bytes
/
XPHPExcel.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
/**
* Wrapper for the PHPExcel library.
* @see README.md
*/
class XPHPExcel extends CComponent
{
private static $_isInitialized = false;
/**
* Register autoloader.
*/
public static function init()
{
if (!self::$_isInitialized) {
$baseFile = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'PHPExcel.php';
if (!file_exists($baseFile)) {
throw new CException('Cannot find PHPExcel.php in expected path.');
}
spl_autoload_unregister(array('YiiBase', 'autoload'));
require($baseFile);
spl_autoload_register(array('YiiBase', 'autoload'));
self::$_isInitialized = true;
}
}
/**
* Returns new PHPExcel object. Automatically registers autoloader.
* @return PHPExcel
*/
public static function createPHPExcel()
{
self::init();
return new PHPExcel;
}
}