Your Name 7 months ago
parent
commit
ade1a7d7d8
100 changed files with 49847 additions and 3 deletions
  1. 89
    0
      application/api/controller/Diyajax.php
  2. 512
    0
      application/api/model/v1/Zc.php
  3. 2
    1
      composer.json
  4. BIN
      public/001.xlsx
  5. BIN
      public/003.xlsx
  6. BIN
      public/test.xlsx
  7. BIN
      public/test3.xlsx
  8. 1
    0
      vendor/composer/autoload_namespaces.php
  9. 11
    0
      vendor/composer/autoload_static.php
  10. 70
    0
      vendor/composer/installed.json
  11. 11
    2
      vendor/composer/installed.php
  12. 3
    0
      vendor/phpoffice/phpexcel/.gitattributes
  13. 9
    0
      vendor/phpoffice/phpexcel/.gitignore
  14. 29
    0
      vendor/phpoffice/phpexcel/.travis.yml
  15. 1153
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel.php
  16. 81
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/Autoloader.php
  17. 290
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/CachedObjectStorage/APC.php
  18. 368
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/CachedObjectStorage/CacheBase.php
  19. 208
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/CachedObjectStorage/DiscISAM.php
  20. 103
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/CachedObjectStorage/ICache.php
  21. 149
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/CachedObjectStorage/Igbinary.php
  22. 308
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/CachedObjectStorage/Memcache.php
  23. 118
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/CachedObjectStorage/Memory.php
  24. 133
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/CachedObjectStorage/MemoryGZip.php
  25. 129
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/CachedObjectStorage/MemorySerialized.php
  26. 200
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/CachedObjectStorage/PHPTemp.php
  27. 307
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/CachedObjectStorage/SQLite.php
  28. 346
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/CachedObjectStorage/SQLite3.php
  29. 289
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/CachedObjectStorage/Wincache.php
  30. 231
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/CachedObjectStorageFactory.php
  31. 94
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/CalcEngine/CyclicReferenceStack.php
  32. 151
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/CalcEngine/Logger.php
  33. 4391
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation.php
  34. 676
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Database.php
  35. 1553
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/DateTime.php
  36. 2650
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Engineering.php
  37. 46
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Exception.php
  38. 45
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/ExceptionHandler.php
  39. 2359
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Financial.php
  40. 622
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/FormulaParser.php
  41. 176
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/FormulaToken.php
  42. 148
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Function.php
  43. 759
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Functions.php
  44. 285
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Logical.php
  45. 879
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/LookupRef.php
  46. 1459
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/MathTrig.php
  47. 3745
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Statistical.php
  48. 651
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/TextData.php
  49. 111
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Token/Stack.php
  50. 351
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/functionlist.txt
  51. 1032
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/Cell.php
  52. 187
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/Cell/AdvancedValueBinder.php
  53. 115
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/Cell/DataType.php
  54. 492
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/Cell/DataValidation.php
  55. 102
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/Cell/DefaultValueBinder.php
  56. 124
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/Cell/Hyperlink.php
  57. 47
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/Cell/IValueBinder.php
  58. 680
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/Chart.php
  59. 561
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/Chart/Axis.php
  60. 390
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/Chart/DataSeries.php
  61. 333
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/Chart/DataSeriesValues.php
  62. 46
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/Chart/Exception.php
  63. 472
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/Chart/GridLines.php
  64. 486
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/Chart/Layout.php
  65. 170
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/Chart/Legend.php
  66. 126
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/Chart/PlotArea.php
  67. 363
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/Chart/Properties.php
  68. 20
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/Chart/Renderer/PHP Charting Libraries.txt
  69. 883
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/Chart/Renderer/jpgraph.php
  70. 86
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/Chart/Title.php
  71. 338
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/Comment.php
  72. 611
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/DocumentProperties.php
  73. 222
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/DocumentSecurity.php
  74. 54
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/Exception.php
  75. 204
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/HashTable.php
  76. 808
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/Helper/HTML.php
  77. 34
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/IComparable.php
  78. 289
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/IOFactory.php
  79. 249
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/NamedRange.php
  80. 301
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Abstract.php
  81. 406
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/CSV.php
  82. 51
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/DefaultReadFilter.php
  83. 801
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Excel2003XML.php
  84. 2051
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Excel2007.php
  85. 520
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Excel2007/Chart.php
  86. 127
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Excel2007/Theme.php
  87. 7594
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Excel5.php
  88. 32
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Excel5/Color.php
  89. 77
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Excel5/Color/BIFF5.php
  90. 77
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Excel5/Color/BIFF8.php
  91. 31
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Excel5/Color/BuiltIn.php
  92. 28
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Excel5/ErrorCode.php
  93. 669
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Excel5/Escher.php
  94. 203
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Excel5/MD5.php
  95. 81
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Excel5/RC4.php
  96. 36
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Excel5/Style/Border.php
  97. 41
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Excel5/Style/FillPattern.php
  98. 46
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Exception.php
  99. 850
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Gnumeric.php
  100. 0
    0
      vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/HTML.php

+ 89
- 0
application/api/controller/Diyajax.php View File

@@ -15,6 +15,7 @@ namespace app\api\controller;
15 15
 
16 16
 use think\Config;
17 17
 use think\Db;
18
+use PHPExcel_IOFactory;
18 19
 
19 20
 class Diyajax extends Base
20 21
 {
@@ -561,4 +562,92 @@ class Diyajax extends Base
561 562
         $zrs = $list[0]['id'] + 1000;
562 563
         respose(['code'=>1, 'msg'=>'请求成功', 'data'=>$list,'zrs'=>$zrs]);
563 564
     }
565
+
566
+    /*
567
+     * 导入数据处理
568
+     * /api/Diyajax/exportData
569
+     * https://www.zc10000.com/api/Diyajax/exportData
570
+     *
571
+     * 清除sql命令
572
+     *
573
+TRUNCATE TABLE ey_zc_zs;
574
+TRUNCATE TABLE ey_zc_zy;
575
+TRUNCATE TABLE ey_zc_position;
576
+TRUNCATE TABLE ey_zczy_position;
577
+TRUNCATE TABLE ey_zczs_position;
578
+TRUNCATE TABLE ey_zcwf_position;
579
+TRUNCATE TABLE ey_zcwe_position;
580
+TRUNCATE TABLE ey_zcwd_position;
581
+TRUNCATE TABLE ey_zcdj_position;
582
+     */
583
+    public function exportData(){
584
+        $fileTmpPath = './public/003.xlsx';
585
+        $expType = PHPExcel_IOFactory::identify($fileTmpPath);
586
+        $objReader = PHPExcel_IOFactory::createReader($expType);
587
+        $objPHPExcel = $objReader->load($fileTmpPath);
588
+
589
+        $sheet = $objPHPExcel->getSheet(0); //获取第一张表
590
+        $highestRow = $sheet->getHighestRow(); //获取总行数
591
+        $highestColumn = $sheet->getHighestColumn(); //XFD
592
+
593
+        //var_dump($highestRow);die;
594
+        //var_dump($highestColumn);die;
595
+        //$highestRow = 2; //测试
596
+        echo "<pre>";
597
+
598
+        $rowData_1 = $sheet->rangeToArray('A' . 1 . ':' . $highestColumn . 1, NULL, TRUE, FALSE);
599
+        //var_dump($rowData_1);
600
+
601
+        // 循环读取每个单元格的内容。行数是以第1行为起始
602
+        for ($row = 2; $row <= $highestRow; $row++) {
603
+            $rowData = $sheet->rangeToArray('A' . $row . ':' . $highestColumn . $row, NULL, TRUE, FALSE);
604
+            // 处理$rowData,例如保存到数据库等
605
+            // ...
606
+            //var_dump($rowData);
607
+
608
+            //判断条件 丢弃
609
+            $xlmcc = $rowData[0][4];
610
+            if($xlmcc == '研究生' || $xlmcc == '双学位'){
611
+                echo '忽略这个记录<br/>';
612
+            }else {
613
+                if(!empty($rowData[0][0])) {
614
+                    //处理职称名称 返回职称ID
615
+                    $aid = model('v1.Zc')->zcPos($rowData[0][0]);
616
+                    //申报等级
617
+                    $did = model('v1.Zc')->zcTypeAndDj($aid, $rowData[0][2]);
618
+                    //添加专业 - 具体专业
619
+                    $yids = model('v1.Zc')->zczyAdd($aid, $rowData);
620
+                    //添加专业绑定职称
621
+                    if (!empty($yids)) {
622
+                        model('v1.Zc')->bindZcZy($aid, $yids);
623
+                    }
624
+                    if (!empty($rowData[0][8])) {
625
+                        //添加证书 得到证书id
626
+                        $sid = model('v1.Zc')->ZsZcAdd($aid, $rowData[0][8]);
627
+                        //添加证书绑定职称
628
+                        $zids = [$sid];
629
+                        model('v1.Zc')->bingZs($aid, $zids);
630
+                        //证书绑定学历
631
+                        //博士,硕士,研究生,双学位,本科,大专,高技,中专
632
+                        model('v1.Zc')->zsBindXl($sid, $rowData);
633
+                    }
634
+                    //添加主规则  区域/申报等级/职称名称
635
+                    $gid = model('v1.Zc')->addZcwd($aid, $did, $rowData);
636
+                    //添加学历规则  学历/学历条件/毕业年限/年龄/专业要求/具体专业
637
+                    $xid = model('v1.Zc')->addZcXi($gid, $yids, $rowData);
638
+                    //添加证书规则 且还是或 存在疑问?  前置+具体要求
639
+                    if (!empty($rowData[0][8])) {
640
+                        $zid = model('v1.Zc')->addZsGz($gid, $xid, $sid, $rowData);
641
+                    }
642
+                    $title = $rowData[0][0] . '-' . $rowData[0][2] . '-' . $rowData[0][1] . '-' . $rowData[0][4];
643
+                    echo '已处理[' . $title . ']这个记录<br/>';
644
+                }else{
645
+                    echo $row.'为空这个记录<br/>';
646
+                }
647
+            }
648
+        }
649
+        echo "</pre>";
650
+    }
651
+
652
+
564 653
 }

+ 512
- 0
application/api/model/v1/Zc.php View File

@@ -0,0 +1,512 @@
1
+<?php
2
+
3
+
4
+namespace app\api\model\v1;
5
+
6
+use think\Db;
7
+use think\Cache;
8
+
9
+class Zc extends Base{
10
+
11
+    /*
12
+     * 添加职称
13
+     */
14
+    public function zcPos($name){
15
+        //查询是否存在
16
+        $name = trim($name);
17
+        $row = Db::name('zc_position')->where('title',$name)->find();
18
+        if($row){
19
+            return $row['id'];
20
+        }else{
21
+            $id = Db::name('zc_position')->insertGetId([
22
+                'title' => $name,
23
+                'intro' => '0',
24
+                'type' => 0, //地区 默认全国
25
+                'dj_group_id' => 0, //等级分组
26
+                'add_time' => time(),
27
+                'update_time' => time(),
28
+            ]);
29
+            return $id;
30
+        }
31
+    }
32
+    /*
33
+     * 插入等级和等级分类
34
+     */
35
+    public function zcTypeAndDj($aid,$name){
36
+        //查询职称等级组id
37
+        $one = Db::name('zc_position')->where(['id'=>$aid])->find();
38
+        //dj_group_id
39
+
40
+        //查询是否存在
41
+        $row = Db::name('zcdj_position')
42
+            ->where('title',$name)
43
+            ->where('type',$one['dj_group_id'])
44
+            ->find();
45
+
46
+        if($row){
47
+            //存在
48
+            return $row['id'];
49
+        }else{
50
+            //新增
51
+            if((int)$one['dj_group_id'] > 0){
52
+                //已有等级分组 但是没有该等级 新增
53
+                $id = Db::name('zcdj_position')->insertGetId([
54
+                    'title' => $name,
55
+                    'intro' => '0',
56
+                    'type' => $one['dj_group_id'], //所属分组
57
+                    'add_time' => time(),
58
+                    'update_time' => time(),
59
+                ]);
60
+                return $id;
61
+            }else{
62
+                //存在手动添加的相同等级信息 只是未绑定职称  忽略这种情况
63
+                //不同等级分组 可能存在等级名称相同  允许存在这种情况
64
+                //创建新分组
65
+                $cid = Db::name('zc_type')->insertGetId([
66
+                    'name' => $one['title'],
67
+                    'pid' => 25,
68
+                    'level' => 1,
69
+                    'add_time' => time(),
70
+                    'update_time' => time(),
71
+                    'catid' => 3
72
+                ]);
73
+                //创建等级
74
+                $did = Db::name('zcdj_position')->insertGetId([
75
+                    'title' => $name,
76
+                    'type' => $cid,
77
+                    'intro' => '0',
78
+                    'add_time' => time(),
79
+                    'update_time' => time()
80
+                ]);
81
+                //绑定职称
82
+                Db::name('zc_position')->where(['id'=>$aid])->update([
83
+                    'dj_group_id' => $cid
84
+                ]);
85
+                return $did;
86
+            }
87
+        }
88
+    }
89
+
90
+    /*
91
+     * 新增妆业
92
+     */
93
+    public function zczyAdd($aid,$rowData){
94
+
95
+        $one = Db::name('zc_position')->where(['id'=>$aid])->find();
96
+        //查询分类是否存在
97
+        $two = Db::name('zc_type')->where([
98
+                'pid' => 23, //默认都属于计算机
99
+                'level' => 1,
100
+                'is_del' => 0,
101
+                'name' => $one['title'],
102
+                'catid' => 2,
103
+            ])->find();
104
+        if($two){
105
+            $yid = $two['id'];
106
+        }else{
107
+            //创建分类
108
+            $yid = Db::name('zc_type')->insertGetId([
109
+                    'name' => $one['title'],
110
+                    'pid' => 23,
111
+                    'level' => 1,
112
+                    'add_time' => time(),
113
+                    'update_time' => time(),
114
+                    'catid' => 2
115
+                ]);
116
+        }
117
+        //处理分类
118
+        $list_ids = [];
119
+        foreach ($rowData[0] as $k=>$v){
120
+            if($k >= 10){
121
+                if(!empty($v)) {
122
+                    //查询专业是否存在 不考虑分类
123
+                    $row = Db::name('zczy_position')
124
+                        ->where('title', $v)
125
+                        //->where('type',$yid)
126
+                        ->where('is_del', 0)
127
+                        ->find();
128
+                    if ($row) {
129
+                        $list_ids[] = $row['id'];
130
+                    } else {
131
+                        //首次创建 以职称为分类名称
132
+                        $zy_id = Db::name('zczy_position')->insertGetId([
133
+                            'title' => $v,
134
+                            'type' => $yid,
135
+                            'intro' => '0',
136
+                            'add_time' => time(),
137
+                            'update_time' => time()
138
+                        ]);
139
+                        $list_ids[] = $zy_id;
140
+                    }
141
+                }
142
+            }
143
+        }
144
+        return $list_ids;
145
+    }
146
+
147
+    /*
148
+     * 职称绑定专业
149
+     */
150
+    public function bindZcZy($aid,$yids){
151
+        //删除旧数据
152
+        Db::name('zc_zy')
153
+            ->where(['zc_id'=>$aid,'is_del'=>0])
154
+            ->update(['is_del'=>1,'del_time'=>time()]);
155
+
156
+        //插入新数据
157
+        $map_data = [];
158
+        foreach ($yids as $k => $v) {
159
+            $map_data[] = [
160
+                'map_id' => $v, //专业的id
161
+                'zc_id' => $aid,
162
+                'add_time' => time(),
163
+                'is_del' => 0,
164
+                'del_time' => 0
165
+            ];
166
+        }
167
+        Db::name('zc_zy')->insertAll($map_data);
168
+    }
169
+
170
+    //添加证书
171
+    public function ZsZcAdd($aid,$name){
172
+        $one = Db::name('zc_position')->where(['id'=>$aid])->find();
173
+        //查询证书分类是否存在
174
+        $two = Db::name('zc_type')->where([
175
+                'pid' => 17, //默认都属于计算机
176
+                'level' => 1,
177
+                'is_del' => 0,
178
+                'name' => $one['title'],
179
+                'catid' => 1,
180
+            ])->find();
181
+        if(empty($two)){
182
+            //插入证书分类
183
+            $sid = Db::name('zc_type')->insertGetId([
184
+                'name' => $one['title'],
185
+                'pid' => 17,
186
+                'level' => 1,
187
+                'add_time' => time(),
188
+                'update_time' => time(),
189
+                'catid' => 1
190
+            ]);
191
+        }else{
192
+            $sid = $two['id'];
193
+        }
194
+
195
+        //查询证书是否存在
196
+        $row = Db::name('zczs_position')
197
+            ->where('title',$name)
198
+            ->where('type',$sid)  //要不要绑定分类
199
+            ->where('is_del',0)
200
+            ->find();
201
+        if($row){
202
+            return $row['id'];
203
+        }else{
204
+            //首次创建 以职称为分类名称
205
+            $zs_id = Db::name('zczs_position')->insertGetId([
206
+                'title' => $name,
207
+                'type' => $sid,
208
+                'intro' => '0',
209
+                'add_time' => time(),
210
+                'update_time' => time()
211
+            ]);
212
+            return $zs_id;
213
+        }
214
+    }
215
+    /*
216
+     * 证书绑定职称
217
+     */
218
+    public function bingZs($aid,$zids){
219
+        //删除旧数据
220
+        Db::name('zc_zs')
221
+            ->where(['zc_id'=>$aid,'is_del'=>0])
222
+            ->update(['is_del'=>1,'del_time'=>time()]);
223
+
224
+        //插入新数据
225
+        $map_data = [];
226
+        foreach ($zids as $k => $v) {
227
+            $map_data[] = [
228
+                'map_id' => $v, //专业的id
229
+                'zc_id' => $aid,
230
+                'add_time' => time(),
231
+                'is_del' => 0,
232
+                'del_time' => 0
233
+            ];
234
+        }
235
+        Db::name('zc_zs')->insertAll($map_data);
236
+    }
237
+
238
+    /*
239
+     * 证书绑定学历
240
+     */
241
+    public function zsBindXl($sid,$rowData){
242
+        $xl = $rowData[0][4];
243
+        $xl_str = [
244
+            '博士' => 6,
245
+            '硕士' => 5,
246
+            //'研究生' => 60,
247
+            //'双学位' => 50,
248
+            '本科' => 4,
249
+            '大专' => 3,
250
+            '高技' => 2,
251
+            '中专' => 1,
252
+        ];
253
+        if(!empty($xl)){
254
+            //同一职称下 不同学历 可能存在相同证书名称
255
+            //判断大小
256
+            $bdxl = Db::name('zczs_position')->where(['id'=>$sid])->value('bdxl');
257
+            $xl_num = $xl_str[$xl];
258
+            //已绑定学历且大于当前学历 执行更新
259
+            if(empty($bdxl) || !empty($bdxl) && (int)$bdxl > (int)$xl_num){
260
+                Db::name('zczs_position')->where(['id'=>$sid])->update(['bdxl'=>$xl_num]);
261
+            }
262
+        }
263
+    }
264
+
265
+    /*
266
+     * 添加主规则记录 返回id
267
+     */
268
+    public function addZcwd($aid,$did,$rowData){
269
+
270
+        //地区
271
+        $area = $rowData[0][1];
272
+        if(!empty($area)){
273
+            //查询地区
274
+            $a = Db::name('citysite')
275
+                ->where('name','like','%'.$area)
276
+                ->find();
277
+            $sf = $a['id'];
278
+            $cs = 0;
279
+            //判断是否城市
280
+            if((int)$a['level'] === 2){
281
+                //查询省份
282
+                $b = Db::name('citysite')
283
+                    ->where('id','=',$a['parent_id'])
284
+                    ->find();
285
+                $sf = $b['id']; //省份
286
+                $cs = $a['id']; //城市
287
+            }
288
+        }else{
289
+            //默认全国
290
+            $sf = 28;
291
+            $cs = 0;
292
+        }
293
+
294
+        $zc = Db::name('zcwd_position')->where([
295
+                'type'        => $aid, //职称ID
296
+                'sf' => $sf,
297
+                'cs' => $cs,
298
+                'sbdj' => $did,
299
+                'is_del' => 0
300
+            ])->find();
301
+
302
+        if($zc){
303
+            return $zc['id'];
304
+        }else{
305
+            //标题
306
+            $title = $rowData[0][0].'-'.$rowData[0][2].'-'.$rowData[0][1];
307
+            //查询是否已存在该规则
308
+            $data = array(
309
+                'title'       => $title,
310
+                'type'        => $aid, //职称ID
311
+                'intro'       => '0', //备注
312
+                'admin_id'    => 1,
313
+                'lang'        => 'cn',
314
+                'add_time'    => getTime(),
315
+                'update_time' => getTime(),
316
+                'sf' => $sf,
317
+                'cs' => $cs,
318
+                'sbdj' => $did,
319
+                'is_ega' => 0,
320
+                'ega_0' => 23,
321
+                'ega_1' => 60,
322
+                'byzy' => 0,
323
+                'zhengshu2' => '',
324
+                'xlyq' => 0,
325
+                'xxlx' => 0,
326
+                'bysj' => 0,
327
+                'bysj_time' => 0,
328
+                'is_zs' => 0,
329
+                'zhengshu' => '',
330
+                'sjnx' => 0,
331
+                'gzyq' => json_encode([]),
332
+                'qttj' => '',
333
+                'orderno' => date('YmdHis',time()).rand(1000,9999)
334
+            );
335
+            $insertID = Db::name('zcwd_position')->insertGetId($data);
336
+            return $insertID;
337
+        }
338
+    }
339
+
340
+
341
+    /*
342
+     * 添加学历
343
+     * 3学历 应该是 学校类型
344
+     * 4学历条件
345
+     * 5毕业年限
346
+     * 6年龄
347
+     * 7专业要求()一致
348
+     */
349
+    public function addZcXi($gid,$yids,$rowData){
350
+
351
+
352
+        //年龄
353
+        $nl = $rowData[0][6];
354
+        if(empty($nl)){
355
+            $is_ega = 0;
356
+            $ega_0 = 18;
357
+            $ega_1 = 99;
358
+        }else{
359
+            $is_ega = 1;
360
+            $ega_0 = $nl;
361
+            $ega_1 = 99;
362
+        }
363
+
364
+        //专业要求
365
+        $zyyq = $rowData[0][7];
366
+        if($zyyq == '一致'){
367
+            $byzy = 1; //要求
368
+        }else{
369
+            $byzy = 0; //不要求
370
+        }
371
+
372
+        //学历要求
373
+        $xlyq_str = $rowData[0][4];
374
+        $xl_str = [
375
+            '博士' => 6,
376
+            '硕士' => 5,
377
+            //'研究生' => 60,
378
+            //'双学位' => 50,
379
+            '本科' => 4,
380
+            '大专' => 3,
381
+            '高技' => 2,
382
+            '中专' => 1,
383
+        ];
384
+        $xlyq = 0;
385
+        if(isset($xl_str[$xlyq_str])){
386
+            $xlyq = $xl_str[$xlyq_str];
387
+        }
388
+
389
+        //学校类型
390
+        $xxlx_str = $rowData[0][3];
391
+        if($xxlx_str == '不限'){
392
+            $xxlx = 0;
393
+        }else if($xxlx_str == '全日制'){
394
+            $xxlx = 1;
395
+        }else if($xxlx_str == '非全日制'){
396
+            $xxlx = 2;
397
+        }
398
+
399
+        //毕业年限
400
+        $bynx = $rowData[0][5];
401
+        if(empty($bynx)){
402
+            //不要求
403
+            $bysj = 0;
404
+            $bynx = 0;
405
+        }else{
406
+            $bysj = 1;
407
+        }
408
+
409
+        //判断是否存在 该规则
410
+        $oen = Db::name('zcwe_position')
411
+            ->where([
412
+                'type'=>$gid, //规则id
413
+                'is_del' => 0,
414
+                'is_ega' => $is_ega,
415
+                'ega_0' => $ega_0,
416
+                'ega_1' => $ega_1,
417
+                'byzy' => $byzy, //专业要求
418
+                'zhengshu2' => json_encode($yids,JSON_UNESCAPED_UNICODE),
419
+                'xlyq' => $xlyq, //学历要求
420
+                'xxlx' => $xxlx, //学校类型
421
+                'bysj' => $bysj, //
422
+                'bysj_time' => $bynx,
423
+            ])->find();
424
+        if($oen){
425
+            //存在
426
+            return $oen['id'];
427
+        }else{
428
+            //新增学历
429
+            //标题
430
+            $title = $rowData[0][0].'-'.$rowData[0][2].'-'.$rowData[0][1].'-'.$rowData[0][4];
431
+            //查询是否已存在该规则
432
+            $data = array(
433
+                'title'       => $title,
434
+                'type'        => $gid, //职称ID
435
+                'intro'       => '0', //备注
436
+                'admin_id'    => 1,
437
+                'lang'        => 'cn',
438
+                'add_time'    => getTime(),
439
+                'update_time' => getTime(),
440
+                'sf' => 0,
441
+                'cs' => 0,
442
+                'sbdj' => 0,
443
+                'is_ega' => $is_ega,
444
+                'ega_0' => $ega_0,
445
+                'ega_1' => $ega_1,
446
+                'byzy' => $byzy, //专业要求
447
+                'zhengshu2' => json_encode($yids,JSON_UNESCAPED_UNICODE),
448
+                'xlyq' => $xlyq, //学历要求
449
+                'xxlx' => $xxlx, //学校类型
450
+                'bysj' => $bysj, //
451
+                'bysj_time' => $bynx,
452
+                'is_zs' => 0,
453
+                'zhengshu' => '',
454
+                'sjnx' => 0,
455
+                'gzyq' => json_encode([]),
456
+                'qttj' => ''
457
+            );
458
+            $insertID = Db::name('zcwe_position')->insertGetId($data);
459
+            return $insertID;
460
+        }
461
+    }
462
+
463
+    /*
464
+     * 添加证书规则
465
+     */
466
+    public function addZsGz($gid,$xid,$sid,$rowData){
467
+        $oen = Db::name('zcwf_position')
468
+            ->where([
469
+                'type'        => $gid, //所属职称主规则id
470
+                'type_son'        => $xid, //所属上级学历id
471
+                'is_zs' => 1,
472
+                'zhengshu' => json_encode([$sid]),
473
+                'sjnx' => json_encode([$rowData[0][9]]),
474
+            ])->find();
475
+        if($oen){
476
+            return $oen['id'];
477
+        }else{
478
+            //标题
479
+            $title = $rowData[0][0].'-'.$rowData[0][2].'-'.$rowData[0][1].'-'.$rowData[0][4];
480
+            // 添加广告位置表信息
481
+            $data = array(
482
+                'title'       => $title,
483
+                'type'        => $gid, //所属职称主规则id
484
+                'type_son'        => $xid, //所属上级学历id
485
+                'intro'       => '0', //备注
486
+                'admin_id'    => 1,
487
+                'lang'        => 'cn',
488
+                'add_time'    => getTime(),
489
+                'update_time' => getTime(),
490
+                'sf' => 0,
491
+                'cs' => 0,
492
+                'sbdj' => 0,
493
+                'is_ega' => 0,
494
+                'ega_0' => 0,
495
+                'ega_1' => 0,
496
+                'byzy' => 0,
497
+                'zhengshu2' => '',
498
+                'xlyq' => 0,
499
+                'xxlx' => 0,
500
+                'bysj' =>0,
501
+                'bysj_time' => 0,
502
+                'is_zs' => 1,
503
+                'zhengshu' => json_encode([$sid]),
504
+                'sjnx' => json_encode([$rowData[0][9]]),
505
+                'gzyq' => json_encode([]),
506
+                'qttj' => '',
507
+            );
508
+            $insertID = Db::name('zcwf_position')->insertGetId($data);
509
+            return $insertID;
510
+        }
511
+    }
512
+}

+ 2
- 1
composer.json View File

@@ -1,5 +1,6 @@
1 1
 {
2 2
     "require": {
3
-        "overtrue/pinyin": "~4.0"
3
+        "overtrue/pinyin": "~4.0",
4
+        "phpoffice/phpexcel": "^1.8"
4 5
     }
5 6
 }

BIN
public/001.xlsx View File


BIN
public/003.xlsx View File


BIN
public/test.xlsx View File


BIN
public/test3.xlsx View File


+ 1
- 0
vendor/composer/autoload_namespaces.php View File

@@ -6,4 +6,5 @@ $vendorDir = dirname(dirname(__FILE__));
6 6
 $baseDir = dirname($vendorDir);
7 7
 
8 8
 return array(
9
+    'PHPExcel' => array($vendorDir . '/phpoffice/phpexcel/Classes'),
9 10
 );

+ 11
- 0
vendor/composer/autoload_static.php View File

@@ -24,6 +24,16 @@ class ComposerStaticInitc94c02985840e0e24a4e6317fb9e1871
24 24
         ),
25 25
     );
26 26
 
27
+    public static $prefixesPsr0 = array (
28
+        'P' => 
29
+        array (
30
+            'PHPExcel' => 
31
+            array (
32
+                0 => __DIR__ . '/..' . '/phpoffice/phpexcel/Classes',
33
+            ),
34
+        ),
35
+    );
36
+
27 37
     public static $classMap = array (
28 38
         'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
29 39
     );
@@ -33,6 +43,7 @@ class ComposerStaticInitc94c02985840e0e24a4e6317fb9e1871
33 43
         return \Closure::bind(function () use ($loader) {
34 44
             $loader->prefixLengthsPsr4 = ComposerStaticInitc94c02985840e0e24a4e6317fb9e1871::$prefixLengthsPsr4;
35 45
             $loader->prefixDirsPsr4 = ComposerStaticInitc94c02985840e0e24a4e6317fb9e1871::$prefixDirsPsr4;
46
+            $loader->prefixesPsr0 = ComposerStaticInitc94c02985840e0e24a4e6317fb9e1871::$prefixesPsr0;
36 47
             $loader->classMap = ComposerStaticInitc94c02985840e0e24a4e6317fb9e1871::$classMap;
37 48
 
38 49
         }, null, ClassLoader::class);

+ 70
- 0
vendor/composer/installed.json View File

@@ -75,6 +75,76 @@
75 75
                 }
76 76
             ],
77 77
             "install-path": "../overtrue/pinyin"
78
+        },
79
+        {
80
+            "name": "phpoffice/phpexcel",
81
+            "version": "1.8.2",
82
+            "version_normalized": "1.8.2.0",
83
+            "source": {
84
+                "type": "git",
85
+                "url": "https://github.com/PHPOffice/PHPExcel.git",
86
+                "reference": "1441011fb7ecdd8cc689878f54f8b58a6805f870"
87
+            },
88
+            "dist": {
89
+                "type": "zip",
90
+                "url": "https://api.github.com/repos/PHPOffice/PHPExcel/zipball/1441011fb7ecdd8cc689878f54f8b58a6805f870",
91
+                "reference": "1441011fb7ecdd8cc689878f54f8b58a6805f870",
92
+                "shasum": ""
93
+            },
94
+            "require": {
95
+                "ext-mbstring": "*",
96
+                "ext-xml": "*",
97
+                "ext-xmlwriter": "*",
98
+                "php": "^5.2|^7.0"
99
+            },
100
+            "require-dev": {
101
+                "squizlabs/php_codesniffer": "2.*"
102
+            },
103
+            "time": "2018-11-22T23:07:24+00:00",
104
+            "type": "library",
105
+            "installation-source": "dist",
106
+            "autoload": {
107
+                "psr-0": {
108
+                    "PHPExcel": "Classes/"
109
+                }
110
+            },
111
+            "notification-url": "https://packagist.org/downloads/",
112
+            "license": [
113
+                "LGPL-2.1"
114
+            ],
115
+            "authors": [
116
+                {
117
+                    "name": "Maarten Balliauw",
118
+                    "homepage": "http://blog.maartenballiauw.be"
119
+                },
120
+                {
121
+                    "name": "Erik Tilt"
122
+                },
123
+                {
124
+                    "name": "Franck Lefevre",
125
+                    "homepage": "http://rootslabs.net"
126
+                },
127
+                {
128
+                    "name": "Mark Baker",
129
+                    "homepage": "http://markbakeruk.net"
130
+                }
131
+            ],
132
+            "description": "PHPExcel - OpenXML - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine",
133
+            "homepage": "https://github.com/PHPOffice/PHPExcel",
134
+            "keywords": [
135
+                "OpenXML",
136
+                "excel",
137
+                "php",
138
+                "spreadsheet",
139
+                "xls",
140
+                "xlsx"
141
+            ],
142
+            "support": {
143
+                "issues": "https://github.com/PHPOffice/PHPExcel/issues",
144
+                "source": "https://github.com/PHPOffice/PHPExcel/tree/master"
145
+            },
146
+            "abandoned": "phpoffice/phpspreadsheet",
147
+            "install-path": "../phpoffice/phpexcel"
78 148
         }
79 149
     ],
80 150
     "dev": true,

+ 11
- 2
vendor/composer/installed.php View File

@@ -5,7 +5,7 @@
5 5
         'type' => 'library',
6 6
         'install_path' => __DIR__ . '/../../',
7 7
         'aliases' => array(),
8
-        'reference' => 'd2677f76f389738b44394c8437766653366c3aae',
8
+        'reference' => '3d93a7df2e63f6382dbb024868f96b5592aa8b11',
9 9
         'name' => '__root__',
10 10
         'dev' => true,
11 11
     ),
@@ -16,7 +16,7 @@
16 16
             'type' => 'library',
17 17
             'install_path' => __DIR__ . '/../../',
18 18
             'aliases' => array(),
19
-            'reference' => 'd2677f76f389738b44394c8437766653366c3aae',
19
+            'reference' => '3d93a7df2e63f6382dbb024868f96b5592aa8b11',
20 20
             'dev_requirement' => false,
21 21
         ),
22 22
         'overtrue/pinyin' => array(
@@ -28,5 +28,14 @@
28 28
             'reference' => '4d0fb4f27f0c79e81c9489e0c0ae4a4f8837eae7',
29 29
             'dev_requirement' => false,
30 30
         ),
31
+        'phpoffice/phpexcel' => array(
32
+            'pretty_version' => '1.8.2',
33
+            'version' => '1.8.2.0',
34
+            'type' => 'library',
35
+            'install_path' => __DIR__ . '/../phpoffice/phpexcel',
36
+            'aliases' => array(),
37
+            'reference' => '1441011fb7ecdd8cc689878f54f8b58a6805f870',
38
+            'dev_requirement' => false,
39
+        ),
31 40
     ),
32 41
 );

+ 3
- 0
vendor/phpoffice/phpexcel/.gitattributes View File

@@ -0,0 +1,3 @@
1
+/Build export-ignore
2
+/unitTests export-ignore
3
+README.md export-ignore

+ 9
- 0
vendor/phpoffice/phpexcel/.gitignore View File

@@ -0,0 +1,9 @@
1
+build/PHPExcel.phar
2
+unitTests/codeCoverage
3
+analysis
4
+
5
+## IDE support
6
+*.buildpath
7
+*.project
8
+/.settings
9
+/.idea

+ 29
- 0
vendor/phpoffice/phpexcel/.travis.yml View File

@@ -0,0 +1,29 @@
1
+language: php
2
+
3
+php:
4
+  - 5.4
5
+  - 5.5
6
+  - 5.6
7
+  - 7.0
8
+  - hhvm
9
+ 
10
+matrix:
11
+  allow_failures:
12
+    - php: hhvm
13
+
14
+before_script:
15
+  ## Packages
16
+  - sudo apt-get -qq update > /dev/null
17
+  ## Composer
18
+  - composer self-update
19
+  - composer install --prefer-source --dev
20
+  - phpenv global "$TRAVIS_PHP_VERSION"
21
+
22
+script:
23
+  ## PHP_CodeSniffer
24
+  - ./vendor/bin/phpcs --report-width=200 --report-summary  --report-full Classes/ unitTests/ --standard=PSR2 -n
25
+  ## PHPUnit
26
+  - phpunit -c ./unitTests/
27
+
28
+notifications:
29
+  email: false

+ 1153
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel.php
File diff suppressed because it is too large
View File


+ 81
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/Autoloader.php View File

@@ -0,0 +1,81 @@
1
+<?php
2
+
3
+PHPExcel_Autoloader::register();
4
+//    As we always try to run the autoloader before anything else, we can use it to do a few
5
+//        simple checks and initialisations
6
+//PHPExcel_Shared_ZipStreamWrapper::register();
7
+// check mbstring.func_overload
8
+if (ini_get('mbstring.func_overload') & 2) {
9
+    throw new PHPExcel_Exception('Multibyte function overloading in PHP must be disabled for string functions (2).');
10
+}
11
+PHPExcel_Shared_String::buildCharacterSets();
12
+
13
+/**
14
+ * PHPExcel
15
+ *
16
+ * Copyright (c) 2006 - 2015 PHPExcel
17
+ *
18
+ * This library is free software; you can redistribute it and/or
19
+ * modify it under the terms of the GNU Lesser General Public
20
+ * License as published by the Free Software Foundation; either
21
+ * version 2.1 of the License, or (at your option) any later version.
22
+ *
23
+ * This library is distributed in the hope that it will be useful,
24
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
25
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
26
+ * Lesser General Public License for more details.
27
+ *
28
+ * You should have received a copy of the GNU Lesser General Public
29
+ * License along with this library; if not, write to the Free Software
30
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
31
+ *
32
+ * @category   PHPExcel
33
+ * @package    PHPExcel
34
+ * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
35
+ * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
36
+ * @version    ##VERSION##, ##DATE##
37
+ */
38
+class PHPExcel_Autoloader
39
+{
40
+    /**
41
+     * Register the Autoloader with SPL
42
+     *
43
+     */
44
+    public static function register()
45
+    {
46
+        if (function_exists('__autoload')) {
47
+            // Register any existing autoloader function with SPL, so we don't get any clashes
48
+            spl_autoload_register('__autoload');
49
+        }
50
+        // Register ourselves with SPL
51
+        if (version_compare(PHP_VERSION, '5.3.0') >= 0) {
52
+            return spl_autoload_register(array('PHPExcel_Autoloader', 'load'), true, true);
53
+        } else {
54
+            return spl_autoload_register(array('PHPExcel_Autoloader', 'load'));
55
+        }
56
+    }
57
+
58
+    /**
59
+     * Autoload a class identified by name
60
+     *
61
+     * @param    string    $pClassName        Name of the object to load
62
+     */
63
+    public static function load($pClassName)
64
+    {
65
+        if ((class_exists($pClassName, false)) || (strpos($pClassName, 'PHPExcel') !== 0)) {
66
+            // Either already loaded, or not a PHPExcel class request
67
+            return false;
68
+        }
69
+
70
+        $pClassFilePath = PHPEXCEL_ROOT .
71
+            str_replace('_', DIRECTORY_SEPARATOR, $pClassName) .
72
+            '.php';
73
+
74
+        if ((file_exists($pClassFilePath) === false) || (is_readable($pClassFilePath) === false)) {
75
+            // Can't load
76
+            return false;
77
+        }
78
+
79
+        require($pClassFilePath);
80
+    }
81
+}

+ 290
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/CachedObjectStorage/APC.php View File

@@ -0,0 +1,290 @@
1
+<?php
2
+
3
+/**
4
+ * PHPExcel_CachedObjectStorage_APC
5
+ *
6
+ * Copyright (c) 2006 - 2015 PHPExcel
7
+ *
8
+ * This library is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU Lesser General Public
10
+ * License as published by the Free Software Foundation; either
11
+ * version 2.1 of the License, or (at your option) any later version.
12
+ *
13
+ * This library is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
+ * Lesser General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU Lesser General Public
19
+ * License along with this library; if not, write to the Free Software
20
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21
+ *
22
+ * @category   PHPExcel
23
+ * @package    PHPExcel_CachedObjectStorage
24
+ * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
25
+ * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
26
+ * @version    ##VERSION##, ##DATE##
27
+ */
28
+class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache
29
+{
30
+    /**
31
+     * Prefix used to uniquely identify cache data for this worksheet
32
+     *
33
+     * @access    private
34
+     * @var string
35
+     */
36
+    private $cachePrefix = null;
37
+
38
+    /**
39
+     * Cache timeout
40
+     *
41
+     * @access    private
42
+     * @var integer
43
+     */
44
+    private $cacheTime = 600;
45
+
46
+    /**
47
+     * Store cell data in cache for the current cell object if it's "dirty",
48
+     *     and the 'nullify' the current cell object
49
+     *
50
+     * @access  private
51
+     * @return  void
52
+     * @throws  PHPExcel_Exception
53
+     */
54
+    protected function storeData()
55
+    {
56
+        if ($this->currentCellIsDirty && !empty($this->currentObjectID)) {
57
+            $this->currentObject->detach();
58
+
59
+            if (!apc_store(
60
+                $this->cachePrefix . $this->currentObjectID . '.cache',
61
+                serialize($this->currentObject),
62
+                $this->cacheTime
63
+            )) {
64
+                $this->__destruct();
65
+                throw new PHPExcel_Exception('Failed to store cell ' . $this->currentObjectID . ' in APC');
66
+            }
67
+            $this->currentCellIsDirty = false;
68
+        }
69
+        $this->currentObjectID = $this->currentObject = null;
70
+    }
71
+
72
+    /**
73
+     * Add or Update a cell in cache identified by coordinate address
74
+     *
75
+     * @access  public
76
+     * @param   string         $pCoord  Coordinate address of the cell to update
77
+     * @param   PHPExcel_Cell  $cell    Cell to update
78
+     * @return  PHPExcel_Cell
79
+     * @throws  PHPExcel_Exception
80
+     */
81
+    public function addCacheData($pCoord, PHPExcel_Cell $cell)
82
+    {
83
+        if (($pCoord !== $this->currentObjectID) && ($this->currentObjectID !== null)) {
84
+            $this->storeData();
85
+        }
86
+        $this->cellCache[$pCoord] = true;
87
+
88
+        $this->currentObjectID = $pCoord;
89
+        $this->currentObject = $cell;
90
+        $this->currentCellIsDirty = true;
91
+
92
+        return $cell;
93
+    }
94
+
95
+    /**
96
+     * Is a value set in the current PHPExcel_CachedObjectStorage_ICache for an indexed cell?
97
+     *
98
+     * @access  public
99
+     * @param   string  $pCoord  Coordinate address of the cell to check
100
+     * @throws  PHPExcel_Exception
101
+     * @return  boolean
102
+     */
103
+    public function isDataSet($pCoord)
104
+    {
105
+        //    Check if the requested entry is the current object, or exists in the cache
106
+        if (parent::isDataSet($pCoord)) {
107
+            if ($this->currentObjectID == $pCoord) {
108
+                return true;
109
+            }
110
+            //    Check if the requested entry still exists in apc
111
+            $success = apc_fetch($this->cachePrefix.$pCoord.'.cache');
112
+            if ($success === false) {
113
+                //    Entry no longer exists in APC, so clear it from the cache array
114
+                parent::deleteCacheData($pCoord);
115
+                throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in APC cache');
116
+            }
117
+            return true;
118
+        }
119
+        return false;
120
+    }
121
+
122
+    /**
123
+     * Get cell at a specific coordinate
124
+     *
125
+     * @access  public
126
+     * @param   string         $pCoord  Coordinate of the cell
127
+     * @throws  PHPExcel_Exception
128
+     * @return  PHPExcel_Cell  Cell that was found, or null if not found
129
+     */
130
+    public function getCacheData($pCoord)
131
+    {
132
+        if ($pCoord === $this->currentObjectID) {
133
+            return $this->currentObject;
134
+        }
135
+        $this->storeData();
136
+
137
+        //    Check if the entry that has been requested actually exists
138
+        if (parent::isDataSet($pCoord)) {
139
+            $obj = apc_fetch($this->cachePrefix . $pCoord . '.cache');
140
+            if ($obj === false) {
141
+                //    Entry no longer exists in APC, so clear it from the cache array
142
+                parent::deleteCacheData($pCoord);
143
+                throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in APC cache');
144
+            }
145
+        } else {
146
+            //    Return null if requested entry doesn't exist in cache
147
+            return null;
148
+        }
149
+
150
+        //    Set current entry to the requested entry
151
+        $this->currentObjectID = $pCoord;
152
+        $this->currentObject = unserialize($obj);
153
+        //    Re-attach this as the cell's parent
154
+        $this->currentObject->attach($this);
155
+
156
+        //    Return requested entry
157
+        return $this->currentObject;
158
+    }
159
+
160
+    /**
161
+     * Get a list of all cell addresses currently held in cache
162
+     *
163
+     * @return  string[]
164
+     */
165
+    public function getCellList()
166
+    {
167
+        if ($this->currentObjectID !== null) {
168
+            $this->storeData();
169
+        }
170
+
171
+        return parent::getCellList();
172
+    }
173
+
174
+    /**
175
+     * Delete a cell in cache identified by coordinate address
176
+     *
177
+     * @access  public
178
+     * @param   string  $pCoord  Coordinate address of the cell to delete
179
+     * @throws  PHPExcel_Exception
180
+     */
181
+    public function deleteCacheData($pCoord)
182
+    {
183
+        //    Delete the entry from APC
184
+        apc_delete($this->cachePrefix.$pCoord.'.cache');
185
+
186
+        //    Delete the entry from our cell address array
187
+        parent::deleteCacheData($pCoord);
188
+    }
189
+
190
+    /**
191
+     * Clone the cell collection
192
+     *
193
+     * @access  public
194
+     * @param   PHPExcel_Worksheet  $parent  The new worksheet
195
+     * @throws  PHPExcel_Exception
196
+     * @return  void
197
+     */
198
+    public function copyCellCollection(PHPExcel_Worksheet $parent)
199
+    {
200
+        parent::copyCellCollection($parent);
201
+        //    Get a new id for the new file name
202
+        $baseUnique = $this->getUniqueID();
203
+        $newCachePrefix = substr(md5($baseUnique), 0, 8) . '.';
204
+        $cacheList = $this->getCellList();
205
+        foreach ($cacheList as $cellID) {
206
+            if ($cellID != $this->currentObjectID) {
207
+                $obj = apc_fetch($this->cachePrefix . $cellID . '.cache');
208
+                if ($obj === false) {
209
+                    //    Entry no longer exists in APC, so clear it from the cache array
210
+                    parent::deleteCacheData($cellID);
211
+                    throw new PHPExcel_Exception('Cell entry ' . $cellID . ' no longer exists in APC');
212
+                }
213
+                if (!apc_store($newCachePrefix . $cellID . '.cache', $obj, $this->cacheTime)) {
214
+                    $this->__destruct();
215
+                    throw new PHPExcel_Exception('Failed to store cell ' . $cellID . ' in APC');
216
+                }
217
+            }
218
+        }
219
+        $this->cachePrefix = $newCachePrefix;
220
+    }
221
+
222
+    /**
223
+     * Clear the cell collection and disconnect from our parent
224
+     *
225
+     * @return  void
226
+     */
227
+    public function unsetWorksheetCells()
228
+    {
229
+        if ($this->currentObject !== null) {
230
+            $this->currentObject->detach();
231
+            $this->currentObject = $this->currentObjectID = null;
232
+        }
233
+
234
+        //    Flush the APC cache
235
+        $this->__destruct();
236
+
237
+        $this->cellCache = array();
238
+
239
+        //    detach ourself from the worksheet, so that it can then delete this object successfully
240
+        $this->parent = null;
241
+    }
242
+
243
+    /**
244
+     * Initialise this new cell collection
245
+     *
246
+     * @param  PHPExcel_Worksheet  $parent     The worksheet for this cell collection
247
+     * @param  array of mixed      $arguments  Additional initialisation arguments
248
+     */
249
+    public function __construct(PHPExcel_Worksheet $parent, $arguments)
250
+    {
251
+        $cacheTime = (isset($arguments['cacheTime'])) ? $arguments['cacheTime'] : 600;
252
+
253
+        if ($this->cachePrefix === null) {
254
+            $baseUnique = $this->getUniqueID();
255
+            $this->cachePrefix = substr(md5($baseUnique), 0, 8) . '.';
256
+            $this->cacheTime = $cacheTime;
257
+
258
+            parent::__construct($parent);
259
+        }
260
+    }
261
+
262
+    /**
263
+     * Destroy this cell collection
264
+     */
265
+    public function __destruct()
266
+    {
267
+        $cacheList = $this->getCellList();
268
+        foreach ($cacheList as $cellID) {
269
+            apc_delete($this->cachePrefix . $cellID . '.cache');
270
+        }
271
+    }
272
+
273
+    /**
274
+     * Identify whether the caching method is currently available
275
+     * Some methods are dependent on the availability of certain extensions being enabled in the PHP build
276
+     *
277
+     * @return  boolean
278
+     */
279
+    public static function cacheMethodIsAvailable()
280
+    {
281
+        if (!function_exists('apc_store')) {
282
+            return false;
283
+        }
284
+        if (apc_sma_info() === false) {
285
+            return false;
286
+        }
287
+
288
+        return true;
289
+    }
290
+}

+ 368
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/CachedObjectStorage/CacheBase.php View File

@@ -0,0 +1,368 @@
1
+<?php
2
+
3
+/**
4
+ * PHPExcel_CachedObjectStorage_CacheBase
5
+ *
6
+ * Copyright (c) 2006 - 2015 PHPExcel
7
+ *
8
+ * This library is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU Lesser General Public
10
+ * License as published by the Free Software Foundation; either
11
+ * version 2.1 of the License, or (at your option) any later version.
12
+ *
13
+ * This library is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
+ * Lesser General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU Lesser General Public
19
+ * License along with this library; if not, write to the Free Software
20
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21
+ *
22
+ * @category   PHPExcel
23
+ * @package    PHPExcel_CachedObjectStorage
24
+ * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
25
+ * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
26
+ * @version    ##VERSION##, ##DATE##
27
+ */
28
+abstract class PHPExcel_CachedObjectStorage_CacheBase
29
+{
30
+    /**
31
+     * Parent worksheet
32
+     *
33
+     * @var PHPExcel_Worksheet
34
+     */
35
+    protected $parent;
36
+
37
+    /**
38
+     * The currently active Cell
39
+     *
40
+     * @var PHPExcel_Cell
41
+     */
42
+    protected $currentObject = null;
43
+
44
+    /**
45
+     * Coordinate address of the currently active Cell
46
+     *
47
+     * @var string
48
+     */
49
+    protected $currentObjectID = null;
50
+
51
+    /**
52
+     * Flag indicating whether the currently active Cell requires saving
53
+     *
54
+     * @var boolean
55
+     */
56
+    protected $currentCellIsDirty = true;
57
+
58
+    /**
59
+     * An array of cells or cell pointers for the worksheet cells held in this cache,
60
+     *        and indexed by their coordinate address within the worksheet
61
+     *
62
+     * @var array of mixed
63
+     */
64
+    protected $cellCache = array();
65
+
66
+    /**
67
+     * Initialise this new cell collection
68
+     *
69
+     * @param    PHPExcel_Worksheet    $parent        The worksheet for this cell collection
70
+     */
71
+    public function __construct(PHPExcel_Worksheet $parent)
72
+    {
73
+        //    Set our parent worksheet.
74
+        //    This is maintained within the cache controller to facilitate re-attaching it to PHPExcel_Cell objects when
75
+        //        they are woken from a serialized state
76
+        $this->parent = $parent;
77
+    }
78
+
79
+    /**
80
+     * Return the parent worksheet for this cell collection
81
+     *
82
+     * @return    PHPExcel_Worksheet
83
+     */
84
+    public function getParent()
85
+    {
86
+        return $this->parent;
87
+    }
88
+
89
+    /**
90
+     * Is a value set in the current PHPExcel_CachedObjectStorage_ICache for an indexed cell?
91
+     *
92
+     * @param    string        $pCoord        Coordinate address of the cell to check
93
+     * @return    boolean
94
+     */
95
+    public function isDataSet($pCoord)
96
+    {
97
+        if ($pCoord === $this->currentObjectID) {
98
+            return true;
99
+        }
100
+        //    Check if the requested entry exists in the cache
101
+        return isset($this->cellCache[$pCoord]);
102
+    }
103
+
104
+    /**
105
+     * Move a cell object from one address to another
106
+     *
107
+     * @param    string        $fromAddress    Current address of the cell to move
108
+     * @param    string        $toAddress        Destination address of the cell to move
109
+     * @return    boolean
110
+     */
111
+    public function moveCell($fromAddress, $toAddress)
112
+    {
113
+        if ($fromAddress === $this->currentObjectID) {
114
+            $this->currentObjectID = $toAddress;
115
+        }
116
+        $this->currentCellIsDirty = true;
117
+        if (isset($this->cellCache[$fromAddress])) {
118
+            $this->cellCache[$toAddress] = &$this->cellCache[$fromAddress];
119
+            unset($this->cellCache[$fromAddress]);
120
+        }
121
+
122
+        return true;
123
+    }
124
+
125
+    /**
126
+     * Add or Update a cell in cache
127
+     *
128
+     * @param    PHPExcel_Cell    $cell        Cell to update
129
+     * @return    PHPExcel_Cell
130
+     * @throws    PHPExcel_Exception
131
+     */
132
+    public function updateCacheData(PHPExcel_Cell $cell)
133
+    {
134
+        return $this->addCacheData($cell->getCoordinate(), $cell);
135
+    }
136
+
137
+    /**
138
+     * Delete a cell in cache identified by coordinate address
139
+     *
140
+     * @param    string            $pCoord        Coordinate address of the cell to delete
141
+     * @throws    PHPExcel_Exception
142
+     */
143
+    public function deleteCacheData($pCoord)
144
+    {
145
+        if ($pCoord === $this->currentObjectID && !is_null($this->currentObject)) {
146
+            $this->currentObject->detach();
147
+            $this->currentObjectID = $this->currentObject = null;
148
+        }
149
+
150
+        if (is_object($this->cellCache[$pCoord])) {
151
+            $this->cellCache[$pCoord]->detach();
152
+            unset($this->cellCache[$pCoord]);
153
+        }
154
+        $this->currentCellIsDirty = false;
155
+    }
156
+
157
+    /**
158
+     * Get a list of all cell addresses currently held in cache
159
+     *
160
+     * @return    string[]
161
+     */
162
+    public function getCellList()
163
+    {
164
+        return array_keys($this->cellCache);
165
+    }
166
+
167
+    /**
168
+     * Sort the list of all cell addresses currently held in cache by row and column
169
+     *
170
+     * @return    string[]
171
+     */
172
+    public function getSortedCellList()
173
+    {
174
+        $sortKeys = array();
175
+        foreach ($this->getCellList() as $coord) {
176
+            sscanf($coord, '%[A-Z]%d', $column, $row);
177
+            $sortKeys[sprintf('%09d%3s', $row, $column)] = $coord;
178
+        }
179
+        ksort($sortKeys);
180
+
181
+        return array_values($sortKeys);
182
+    }
183
+
184
+    /**
185
+     * Get highest worksheet column and highest row that have cell records
186
+     *
187
+     * @return array Highest column name and highest row number
188
+     */
189
+    public function getHighestRowAndColumn()
190
+    {
191
+        // Lookup highest column and highest row
192
+        $col = array('A' => '1A');
193
+        $row = array(1);
194
+        foreach ($this->getCellList() as $coord) {
195
+            sscanf($coord, '%[A-Z]%d', $c, $r);
196
+            $row[$r] = $r;
197
+            $col[$c] = strlen($c).$c;
198
+        }
199
+        if (!empty($row)) {
200
+            // Determine highest column and row
201
+            $highestRow = max($row);
202
+            $highestColumn = substr(max($col), 1);
203
+        }
204
+
205
+        return array(
206
+            'row'    => $highestRow,
207
+            'column' => $highestColumn
208
+        );
209
+    }
210
+
211
+    /**
212
+     * Return the cell address of the currently active cell object
213
+     *
214
+     * @return    string
215
+     */
216
+    public function getCurrentAddress()
217
+    {
218
+        return $this->currentObjectID;
219
+    }
220
+
221
+    /**
222
+     * Return the column address of the currently active cell object
223
+     *
224
+     * @return    string
225
+     */
226
+    public function getCurrentColumn()
227
+    {
228
+        sscanf($this->currentObjectID, '%[A-Z]%d', $column, $row);
229
+        return $column;
230
+    }
231
+
232
+    /**
233
+     * Return the row address of the currently active cell object
234
+     *
235
+     * @return    integer
236
+     */
237
+    public function getCurrentRow()
238
+    {
239
+        sscanf($this->currentObjectID, '%[A-Z]%d', $column, $row);
240
+        return (integer) $row;
241
+    }
242
+
243
+    /**
244
+     * Get highest worksheet column
245
+     *
246
+     * @param   string     $row        Return the highest column for the specified row,
247
+     *                                     or the highest column of any row if no row number is passed
248
+     * @return  string     Highest column name
249
+     */
250
+    public function getHighestColumn($row = null)
251
+    {
252
+        if ($row == null) {
253
+            $colRow = $this->getHighestRowAndColumn();
254
+            return $colRow['column'];
255
+        }
256
+
257
+        $columnList = array(1);
258
+        foreach ($this->getCellList() as $coord) {
259
+            sscanf($coord, '%[A-Z]%d', $c, $r);
260
+            if ($r != $row) {
261
+                continue;
262
+            }
263
+            $columnList[] = PHPExcel_Cell::columnIndexFromString($c);
264
+        }
265
+        return PHPExcel_Cell::stringFromColumnIndex(max($columnList) - 1);
266
+    }
267
+
268
+    /**
269
+     * Get highest worksheet row
270
+     *
271
+     * @param   string     $column     Return the highest row for the specified column,
272
+     *                                     or the highest row of any column if no column letter is passed
273
+     * @return  int        Highest row number
274
+     */
275
+    public function getHighestRow($column = null)
276
+    {
277
+        if ($column == null) {
278
+            $colRow = $this->getHighestRowAndColumn();
279
+            return $colRow['row'];
280
+        }
281
+
282
+        $rowList = array(0);
283
+        foreach ($this->getCellList() as $coord) {
284
+            sscanf($coord, '%[A-Z]%d', $c, $r);
285
+            if ($c != $column) {
286
+                continue;
287
+            }
288
+            $rowList[] = $r;
289
+        }
290
+
291
+        return max($rowList);
292
+    }
293
+
294
+    /**
295
+     * Generate a unique ID for cache referencing
296
+     *
297
+     * @return string Unique Reference
298
+     */
299
+    protected function getUniqueID()
300
+    {
301
+        if (function_exists('posix_getpid')) {
302
+            $baseUnique = posix_getpid();
303
+        } else {
304
+            $baseUnique = mt_rand();
305
+        }
306
+        return uniqid($baseUnique, true);
307
+    }
308
+
309
+    /**
310
+     * Clone the cell collection
311
+     *
312
+     * @param    PHPExcel_Worksheet    $parent        The new worksheet
313
+     * @return    void
314
+     */
315
+    public function copyCellCollection(PHPExcel_Worksheet $parent)
316
+    {
317
+        $this->currentCellIsDirty;
318
+        $this->storeData();
319
+
320
+        $this->parent = $parent;
321
+        if (($this->currentObject !== null) && (is_object($this->currentObject))) {
322
+            $this->currentObject->attach($this);
323
+        }
324
+    }    //    function copyCellCollection()
325
+
326
+    /**
327
+     * Remove a row, deleting all cells in that row
328
+     *
329
+     * @param string    $row    Row number to remove
330
+     * @return void
331
+     */
332
+    public function removeRow($row)
333
+    {
334
+        foreach ($this->getCellList() as $coord) {
335
+            sscanf($coord, '%[A-Z]%d', $c, $r);
336
+            if ($r == $row) {
337
+                $this->deleteCacheData($coord);
338
+            }
339
+        }
340
+    }
341
+
342
+    /**
343
+     * Remove a column, deleting all cells in that column
344
+     *
345
+     * @param string    $column    Column ID to remove
346
+     * @return void
347
+     */
348
+    public function removeColumn($column)
349
+    {
350
+        foreach ($this->getCellList() as $coord) {
351
+            sscanf($coord, '%[A-Z]%d', $c, $r);
352
+            if ($c == $column) {
353
+                $this->deleteCacheData($coord);
354
+            }
355
+        }
356
+    }
357
+
358
+    /**
359
+     * Identify whether the caching method is currently available
360
+     * Some methods are dependent on the availability of certain extensions being enabled in the PHP build
361
+     *
362
+     * @return    boolean
363
+     */
364
+    public static function cacheMethodIsAvailable()
365
+    {
366
+        return true;
367
+    }
368
+}

+ 208
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/CachedObjectStorage/DiscISAM.php View File

@@ -0,0 +1,208 @@
1
+<?php
2
+
3
+/**
4
+ * PHPExcel_CachedObjectStorage_DiscISAM
5
+ *
6
+ * Copyright (c) 2006 - 2015 PHPExcel
7
+ *
8
+ * This library is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU Lesser General Public
10
+ * License as published by the Free Software Foundation; either
11
+ * version 2.1 of the License, or (at your option) any later version.
12
+ *
13
+ * This library is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
+ * Lesser General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU Lesser General Public
19
+ * License along with this library; if not, write to the Free Software
20
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21
+ *
22
+ * @category   PHPExcel
23
+ * @package    PHPExcel_CachedObjectStorage
24
+ * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
25
+ * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
26
+ * @version    ##VERSION##, ##DATE##
27
+ */
28
+class PHPExcel_CachedObjectStorage_DiscISAM extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache
29
+{
30
+    /**
31
+     * Name of the file for this cache
32
+     *
33
+     * @var string
34
+     */
35
+    private $fileName = null;
36
+
37
+    /**
38
+     * File handle for this cache file
39
+     *
40
+     * @var resource
41
+     */
42
+    private $fileHandle = null;
43
+
44
+    /**
45
+     * Directory/Folder where the cache file is located
46
+     *
47
+     * @var string
48
+     */
49
+    private $cacheDirectory = null;
50
+
51
+    /**
52
+     * Store cell data in cache for the current cell object if it's "dirty",
53
+     *     and the 'nullify' the current cell object
54
+     *
55
+     * @return    void
56
+     * @throws    PHPExcel_Exception
57
+     */
58
+    protected function storeData()
59
+    {
60
+        if ($this->currentCellIsDirty && !empty($this->currentObjectID)) {
61
+            $this->currentObject->detach();
62
+
63
+            fseek($this->fileHandle, 0, SEEK_END);
64
+
65
+            $this->cellCache[$this->currentObjectID] = array(
66
+                'ptr' => ftell($this->fileHandle),
67
+                'sz'  => fwrite($this->fileHandle, serialize($this->currentObject))
68
+            );
69
+            $this->currentCellIsDirty = false;
70
+        }
71
+        $this->currentObjectID = $this->currentObject = null;
72
+    }
73
+
74
+    /**
75
+     * Add or Update a cell in cache identified by coordinate address
76
+     *
77
+     * @param    string            $pCoord        Coordinate address of the cell to update
78
+     * @param    PHPExcel_Cell    $cell        Cell to update
79
+     * @return    PHPExcel_Cell
80
+     * @throws    PHPExcel_Exception
81
+     */
82
+    public function addCacheData($pCoord, PHPExcel_Cell $cell)
83
+    {
84
+        if (($pCoord !== $this->currentObjectID) && ($this->currentObjectID !== null)) {
85
+            $this->storeData();
86
+        }
87
+
88
+        $this->currentObjectID = $pCoord;
89
+        $this->currentObject = $cell;
90
+        $this->currentCellIsDirty = true;
91
+
92
+        return $cell;
93
+    }
94
+
95
+    /**
96
+     * Get cell at a specific coordinate
97
+     *
98
+     * @param     string             $pCoord        Coordinate of the cell
99
+     * @throws     PHPExcel_Exception
100
+     * @return     PHPExcel_Cell     Cell that was found, or null if not found
101
+     */
102
+    public function getCacheData($pCoord)
103
+    {
104
+        if ($pCoord === $this->currentObjectID) {
105
+            return $this->currentObject;
106
+        }
107
+        $this->storeData();
108
+
109
+        //    Check if the entry that has been requested actually exists
110
+        if (!isset($this->cellCache[$pCoord])) {
111
+            //    Return null if requested entry doesn't exist in cache
112
+            return null;
113
+        }
114
+
115
+        //    Set current entry to the requested entry
116
+        $this->currentObjectID = $pCoord;
117
+        fseek($this->fileHandle, $this->cellCache[$pCoord]['ptr']);
118
+        $this->currentObject = unserialize(fread($this->fileHandle, $this->cellCache[$pCoord]['sz']));
119
+        //    Re-attach this as the cell's parent
120
+        $this->currentObject->attach($this);
121
+
122
+        //    Return requested entry
123
+        return $this->currentObject;
124
+    }
125
+
126
+    /**
127
+     * Get a list of all cell addresses currently held in cache
128
+     *
129
+     * @return  string[]
130
+     */
131
+    public function getCellList()
132
+    {
133
+        if ($this->currentObjectID !== null) {
134
+            $this->storeData();
135
+        }
136
+
137
+        return parent::getCellList();
138
+    }
139
+
140
+    /**
141
+     * Clone the cell collection
142
+     *
143
+     * @param    PHPExcel_Worksheet    $parent        The new worksheet
144
+     */
145
+    public function copyCellCollection(PHPExcel_Worksheet $parent)
146
+    {
147
+        parent::copyCellCollection($parent);
148
+        //    Get a new id for the new file name
149
+        $baseUnique = $this->getUniqueID();
150
+        $newFileName = $this->cacheDirectory.'/PHPExcel.'.$baseUnique.'.cache';
151
+        //    Copy the existing cell cache file
152
+        copy($this->fileName, $newFileName);
153
+        $this->fileName = $newFileName;
154
+        //    Open the copied cell cache file
155
+        $this->fileHandle = fopen($this->fileName, 'a+');
156
+    }
157
+
158
+    /**
159
+     * Clear the cell collection and disconnect from our parent
160
+     *
161
+     */
162
+    public function unsetWorksheetCells()
163
+    {
164
+        if (!is_null($this->currentObject)) {
165
+            $this->currentObject->detach();
166
+            $this->currentObject = $this->currentObjectID = null;
167
+        }
168
+        $this->cellCache = array();
169
+
170
+        //    detach ourself from the worksheet, so that it can then delete this object successfully
171
+        $this->parent = null;
172
+
173
+        //    Close down the temporary cache file
174
+        $this->__destruct();
175
+    }
176
+
177
+    /**
178
+     * Initialise this new cell collection
179
+     *
180
+     * @param    PHPExcel_Worksheet    $parent        The worksheet for this cell collection
181
+     * @param    array of mixed        $arguments    Additional initialisation arguments
182
+     */
183
+    public function __construct(PHPExcel_Worksheet $parent, $arguments)
184
+    {
185
+        $this->cacheDirectory    = ((isset($arguments['dir'])) && ($arguments['dir'] !== null))
186
+                                    ? $arguments['dir']
187
+                                    : PHPExcel_Shared_File::sys_get_temp_dir();
188
+
189
+        parent::__construct($parent);
190
+        if (is_null($this->fileHandle)) {
191
+            $baseUnique = $this->getUniqueID();
192
+            $this->fileName = $this->cacheDirectory.'/PHPExcel.'.$baseUnique.'.cache';
193
+            $this->fileHandle = fopen($this->fileName, 'a+');
194
+        }
195
+    }
196
+
197
+    /**
198
+     * Destroy this cell collection
199
+     */
200
+    public function __destruct()
201
+    {
202
+        if (!is_null($this->fileHandle)) {
203
+            fclose($this->fileHandle);
204
+            unlink($this->fileName);
205
+        }
206
+        $this->fileHandle = null;
207
+    }
208
+}

+ 103
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/CachedObjectStorage/ICache.php View File

@@ -0,0 +1,103 @@
1
+<?php
2
+
3
+/**
4
+ * PHPExcel_CachedObjectStorage_ICache
5
+ *
6
+ * Copyright (c) 2006 - 2015 PHPExcel
7
+ *
8
+ * This library is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU Lesser General Public
10
+ * License as published by the Free Software Foundation; either
11
+ * version 2.1 of the License, or (at your option) any later version.
12
+ *
13
+ * This library is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
+ * Lesser General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU Lesser General Public
19
+ * License along with this library; if not, write to the Free Software
20
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21
+ *
22
+ * @category   PHPExcel
23
+ * @package    PHPExcel_CachedObjectStorage
24
+ * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
25
+ * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
26
+ * @version    ##VERSION##, ##DATE##
27
+ */
28
+interface PHPExcel_CachedObjectStorage_ICache
29
+{
30
+    /**
31
+     * Add or Update a cell in cache identified by coordinate address
32
+     *
33
+     * @param    string            $pCoord        Coordinate address of the cell to update
34
+     * @param    PHPExcel_Cell    $cell        Cell to update
35
+     * @return    PHPExcel_Cell
36
+     * @throws    PHPExcel_Exception
37
+     */
38
+    public function addCacheData($pCoord, PHPExcel_Cell $cell);
39
+
40
+    /**
41
+     * Add or Update a cell in cache
42
+     *
43
+     * @param    PHPExcel_Cell    $cell        Cell to update
44
+     * @return    PHPExcel_Cell
45
+     * @throws    PHPExcel_Exception
46
+     */
47
+    public function updateCacheData(PHPExcel_Cell $cell);
48
+
49
+    /**
50
+     * Fetch a cell from cache identified by coordinate address
51
+     *
52
+     * @param    string            $pCoord        Coordinate address of the cell to retrieve
53
+     * @return PHPExcel_Cell     Cell that was found, or null if not found
54
+     * @throws    PHPExcel_Exception
55
+     */
56
+    public function getCacheData($pCoord);
57
+
58
+    /**
59
+     * Delete a cell in cache identified by coordinate address
60
+     *
61
+     * @param    string            $pCoord        Coordinate address of the cell to delete
62
+     * @throws    PHPExcel_Exception
63
+     */
64
+    public function deleteCacheData($pCoord);
65
+
66
+    /**
67
+     * Is a value set in the current PHPExcel_CachedObjectStorage_ICache for an indexed cell?
68
+     *
69
+     * @param    string        $pCoord        Coordinate address of the cell to check
70
+     * @return    boolean
71
+     */
72
+    public function isDataSet($pCoord);
73
+
74
+    /**
75
+     * Get a list of all cell addresses currently held in cache
76
+     *
77
+     * @return    string[]
78
+     */
79
+    public function getCellList();
80
+
81
+    /**
82
+     * Get the list of all cell addresses currently held in cache sorted by column and row
83
+     *
84
+     * @return    string[]
85
+     */
86
+    public function getSortedCellList();
87
+
88
+    /**
89
+     * Clone the cell collection
90
+     *
91
+     * @param    PHPExcel_Worksheet    $parent        The new worksheet
92
+     * @return    void
93
+     */
94
+    public function copyCellCollection(PHPExcel_Worksheet $parent);
95
+
96
+    /**
97
+     * Identify whether the caching method is currently available
98
+     * Some methods are dependent on the availability of certain extensions being enabled in the PHP build
99
+     *
100
+     * @return    boolean
101
+     */
102
+    public static function cacheMethodIsAvailable();
103
+}

+ 149
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/CachedObjectStorage/Igbinary.php View File

@@ -0,0 +1,149 @@
1
+<?php
2
+
3
+/**
4
+ * PHPExcel_CachedObjectStorage_Igbinary
5
+ *
6
+ * Copyright (c) 2006 - 2015 PHPExcel
7
+ *
8
+ * This library is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU Lesser General Public
10
+ * License as published by the Free Software Foundation; either
11
+ * version 2.1 of the License, or (at your option) any later version.
12
+ *
13
+ * This library is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
+ * Lesser General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU Lesser General Public
19
+ * License along with this library; if not, write to the Free Software
20
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21
+ *
22
+ * @category   PHPExcel
23
+ * @package    PHPExcel_CachedObjectStorage
24
+ * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
25
+ * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
26
+ * @version    ##VERSION##, ##DATE##
27
+ */
28
+class PHPExcel_CachedObjectStorage_Igbinary extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache
29
+{
30
+    /**
31
+     * Store cell data in cache for the current cell object if it's "dirty",
32
+     *     and the 'nullify' the current cell object
33
+     *
34
+     * @return    void
35
+     * @throws    PHPExcel_Exception
36
+     */
37
+    protected function storeData()
38
+    {
39
+        if ($this->currentCellIsDirty && !empty($this->currentObjectID)) {
40
+            $this->currentObject->detach();
41
+
42
+            $this->cellCache[$this->currentObjectID] = igbinary_serialize($this->currentObject);
43
+            $this->currentCellIsDirty = false;
44
+        }
45
+        $this->currentObjectID = $this->currentObject = null;
46
+    }    //    function _storeData()
47
+
48
+
49
+    /**
50
+     * Add or Update a cell in cache identified by coordinate address
51
+     *
52
+     * @param    string            $pCoord        Coordinate address of the cell to update
53
+     * @param    PHPExcel_Cell    $cell        Cell to update
54
+     * @return    PHPExcel_Cell
55
+     * @throws    PHPExcel_Exception
56
+     */
57
+    public function addCacheData($pCoord, PHPExcel_Cell $cell)
58
+    {
59
+        if (($pCoord !== $this->currentObjectID) && ($this->currentObjectID !== null)) {
60
+            $this->storeData();
61
+        }
62
+
63
+        $this->currentObjectID = $pCoord;
64
+        $this->currentObject = $cell;
65
+        $this->currentCellIsDirty = true;
66
+
67
+        return $cell;
68
+    }    //    function addCacheData()
69
+
70
+
71
+    /**
72
+     * Get cell at a specific coordinate
73
+     *
74
+     * @param     string             $pCoord        Coordinate of the cell
75
+     * @throws     PHPExcel_Exception
76
+     * @return     PHPExcel_Cell     Cell that was found, or null if not found
77
+     */
78
+    public function getCacheData($pCoord)
79
+    {
80
+        if ($pCoord === $this->currentObjectID) {
81
+            return $this->currentObject;
82
+        }
83
+        $this->storeData();
84
+
85
+        //    Check if the entry that has been requested actually exists
86
+        if (!isset($this->cellCache[$pCoord])) {
87
+            //    Return null if requested entry doesn't exist in cache
88
+            return null;
89
+        }
90
+
91
+        //    Set current entry to the requested entry
92
+        $this->currentObjectID = $pCoord;
93
+        $this->currentObject = igbinary_unserialize($this->cellCache[$pCoord]);
94
+        //    Re-attach this as the cell's parent
95
+        $this->currentObject->attach($this);
96
+
97
+        //    Return requested entry
98
+        return $this->currentObject;
99
+    }    //    function getCacheData()
100
+
101
+
102
+    /**
103
+     * Get a list of all cell addresses currently held in cache
104
+     *
105
+     * @return  string[]
106
+     */
107
+    public function getCellList()
108
+    {
109
+        if ($this->currentObjectID !== null) {
110
+            $this->storeData();
111
+        }
112
+
113
+        return parent::getCellList();
114
+    }
115
+
116
+
117
+    /**
118
+     * Clear the cell collection and disconnect from our parent
119
+     *
120
+     * @return    void
121
+     */
122
+    public function unsetWorksheetCells()
123
+    {
124
+        if (!is_null($this->currentObject)) {
125
+            $this->currentObject->detach();
126
+            $this->currentObject = $this->currentObjectID = null;
127
+        }
128
+        $this->cellCache = array();
129
+
130
+        //    detach ourself from the worksheet, so that it can then delete this object successfully
131
+        $this->parent = null;
132
+    }    //    function unsetWorksheetCells()
133
+
134
+
135
+    /**
136
+     * Identify whether the caching method is currently available
137
+     * Some methods are dependent on the availability of certain extensions being enabled in the PHP build
138
+     *
139
+     * @return    boolean
140
+     */
141
+    public static function cacheMethodIsAvailable()
142
+    {
143
+        if (!function_exists('igbinary_serialize')) {
144
+            return false;
145
+        }
146
+
147
+        return true;
148
+    }
149
+}

+ 308
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/CachedObjectStorage/Memcache.php View File

@@ -0,0 +1,308 @@
1
+<?php
2
+
3
+/**
4
+ * PHPExcel_CachedObjectStorage_Memcache
5
+ *
6
+ * Copyright (c) 2006 - 2015 PHPExcel
7
+ *
8
+ * This library is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU Lesser General Public
10
+ * License as published by the Free Software Foundation; either
11
+ * version 2.1 of the License, or (at your option) any later version.
12
+ *
13
+ * This library is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
+ * Lesser General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU Lesser General Public
19
+ * License along with this library; if not, write to the Free Software
20
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21
+ *
22
+ * @category   PHPExcel
23
+ * @package    PHPExcel_CachedObjectStorage
24
+ * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
25
+ * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
26
+ * @version    ##VERSION##, ##DATE##
27
+ */
28
+class PHPExcel_CachedObjectStorage_Memcache extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache
29
+{
30
+    /**
31
+     * Prefix used to uniquely identify cache data for this worksheet
32
+     *
33
+     * @var string
34
+     */
35
+    private $cachePrefix = null;
36
+
37
+    /**
38
+     * Cache timeout
39
+     *
40
+     * @var integer
41
+     */
42
+    private $cacheTime = 600;
43
+
44
+    /**
45
+     * Memcache interface
46
+     *
47
+     * @var resource
48
+     */
49
+    private $memcache = null;
50
+
51
+
52
+    /**
53
+     * Store cell data in cache for the current cell object if it's "dirty",
54
+     *     and the 'nullify' the current cell object
55
+     *
56
+     * @return    void
57
+     * @throws    PHPExcel_Exception
58
+     */
59
+    protected function storeData()
60
+    {
61
+        if ($this->currentCellIsDirty && !empty($this->currentObjectID)) {
62
+            $this->currentObject->detach();
63
+
64
+            $obj = serialize($this->currentObject);
65
+            if (!$this->memcache->replace($this->cachePrefix . $this->currentObjectID . '.cache', $obj, null, $this->cacheTime)) {
66
+                if (!$this->memcache->add($this->cachePrefix . $this->currentObjectID . '.cache', $obj, null, $this->cacheTime)) {
67
+                    $this->__destruct();
68
+                    throw new PHPExcel_Exception("Failed to store cell {$this->currentObjectID} in MemCache");
69
+                }
70
+            }
71
+            $this->currentCellIsDirty = false;
72
+        }
73
+        $this->currentObjectID = $this->currentObject = null;
74
+    }    //    function _storeData()
75
+
76
+
77
+    /**
78
+     * Add or Update a cell in cache identified by coordinate address
79
+     *
80
+     * @param    string            $pCoord        Coordinate address of the cell to update
81
+     * @param    PHPExcel_Cell    $cell        Cell to update
82
+     * @return    PHPExcel_Cell
83
+     * @throws    PHPExcel_Exception
84
+     */
85
+    public function addCacheData($pCoord, PHPExcel_Cell $cell)
86
+    {
87
+        if (($pCoord !== $this->currentObjectID) && ($this->currentObjectID !== null)) {
88
+            $this->storeData();
89
+        }
90
+        $this->cellCache[$pCoord] = true;
91
+
92
+        $this->currentObjectID = $pCoord;
93
+        $this->currentObject = $cell;
94
+        $this->currentCellIsDirty = true;
95
+
96
+        return $cell;
97
+    }    //    function addCacheData()
98
+
99
+
100
+    /**
101
+     * Is a value set in the current PHPExcel_CachedObjectStorage_ICache for an indexed cell?
102
+     *
103
+     * @param    string        $pCoord        Coordinate address of the cell to check
104
+     * @return    boolean
105
+     * @return    boolean
106
+     */
107
+    public function isDataSet($pCoord)
108
+    {
109
+        //    Check if the requested entry is the current object, or exists in the cache
110
+        if (parent::isDataSet($pCoord)) {
111
+            if ($this->currentObjectID == $pCoord) {
112
+                return true;
113
+            }
114
+            //    Check if the requested entry still exists in Memcache
115
+            $success = $this->memcache->get($this->cachePrefix.$pCoord.'.cache');
116
+            if ($success === false) {
117
+                //    Entry no longer exists in Memcache, so clear it from the cache array
118
+                parent::deleteCacheData($pCoord);
119
+                throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in MemCache');
120
+            }
121
+            return true;
122
+        }
123
+        return false;
124
+    }
125
+
126
+
127
+    /**
128
+     * Get cell at a specific coordinate
129
+     *
130
+     * @param     string             $pCoord        Coordinate of the cell
131
+     * @throws     PHPExcel_Exception
132
+     * @return     PHPExcel_Cell     Cell that was found, or null if not found
133
+     */
134
+    public function getCacheData($pCoord)
135
+    {
136
+        if ($pCoord === $this->currentObjectID) {
137
+            return $this->currentObject;
138
+        }
139
+        $this->storeData();
140
+
141
+        //    Check if the entry that has been requested actually exists
142
+        if (parent::isDataSet($pCoord)) {
143
+            $obj = $this->memcache->get($this->cachePrefix . $pCoord . '.cache');
144
+            if ($obj === false) {
145
+                //    Entry no longer exists in Memcache, so clear it from the cache array
146
+                parent::deleteCacheData($pCoord);
147
+                throw new PHPExcel_Exception("Cell entry {$pCoord} no longer exists in MemCache");
148
+            }
149
+        } else {
150
+            //    Return null if requested entry doesn't exist in cache
151
+            return null;
152
+        }
153
+
154
+        //    Set current entry to the requested entry
155
+        $this->currentObjectID = $pCoord;
156
+        $this->currentObject = unserialize($obj);
157
+        //    Re-attach this as the cell's parent
158
+        $this->currentObject->attach($this);
159
+
160
+        //    Return requested entry
161
+        return $this->currentObject;
162
+    }
163
+
164
+    /**
165
+     * Get a list of all cell addresses currently held in cache
166
+     *
167
+     * @return  string[]
168
+     */
169
+    public function getCellList()
170
+    {
171
+        if ($this->currentObjectID !== null) {
172
+            $this->storeData();
173
+        }
174
+
175
+        return parent::getCellList();
176
+    }
177
+
178
+    /**
179
+     * Delete a cell in cache identified by coordinate address
180
+     *
181
+     * @param    string            $pCoord        Coordinate address of the cell to delete
182
+     * @throws    PHPExcel_Exception
183
+     */
184
+    public function deleteCacheData($pCoord)
185
+    {
186
+        //    Delete the entry from Memcache
187
+        $this->memcache->delete($this->cachePrefix . $pCoord . '.cache');
188
+
189
+        //    Delete the entry from our cell address array
190
+        parent::deleteCacheData($pCoord);
191
+    }
192
+
193
+    /**
194
+     * Clone the cell collection
195
+     *
196
+     * @param    PHPExcel_Worksheet    $parent        The new worksheet
197
+     * @return    void
198
+     */
199
+    public function copyCellCollection(PHPExcel_Worksheet $parent)
200
+    {
201
+        parent::copyCellCollection($parent);
202
+        //    Get a new id for the new file name
203
+        $baseUnique = $this->getUniqueID();
204
+        $newCachePrefix = substr(md5($baseUnique), 0, 8) . '.';
205
+        $cacheList = $this->getCellList();
206
+        foreach ($cacheList as $cellID) {
207
+            if ($cellID != $this->currentObjectID) {
208
+                $obj = $this->memcache->get($this->cachePrefix.$cellID.'.cache');
209
+                if ($obj === false) {
210
+                    //    Entry no longer exists in Memcache, so clear it from the cache array
211
+                    parent::deleteCacheData($cellID);
212
+                    throw new PHPExcel_Exception("Cell entry {$cellID} no longer exists in MemCache");
213
+                }
214
+                if (!$this->memcache->add($newCachePrefix . $cellID . '.cache', $obj, null, $this->cacheTime)) {
215
+                    $this->__destruct();
216
+                    throw new PHPExcel_Exception("Failed to store cell {$cellID} in MemCache");
217
+                }
218
+            }
219
+        }
220
+        $this->cachePrefix = $newCachePrefix;
221
+    }
222
+
223
+    /**
224
+     * Clear the cell collection and disconnect from our parent
225
+     *
226
+     * @return    void
227
+     */
228
+    public function unsetWorksheetCells()
229
+    {
230
+        if (!is_null($this->currentObject)) {
231
+            $this->currentObject->detach();
232
+            $this->currentObject = $this->currentObjectID = null;
233
+        }
234
+
235
+        //    Flush the Memcache cache
236
+        $this->__destruct();
237
+
238
+        $this->cellCache = array();
239
+
240
+        //    detach ourself from the worksheet, so that it can then delete this object successfully
241
+        $this->parent = null;
242
+    }
243
+
244
+    /**
245
+     * Initialise this new cell collection
246
+     *
247
+     * @param    PHPExcel_Worksheet    $parent        The worksheet for this cell collection
248
+     * @param    array of mixed        $arguments    Additional initialisation arguments
249
+     */
250
+    public function __construct(PHPExcel_Worksheet $parent, $arguments)
251
+    {
252
+        $memcacheServer = (isset($arguments['memcacheServer'])) ? $arguments['memcacheServer'] : 'localhost';
253
+        $memcachePort = (isset($arguments['memcachePort'])) ? $arguments['memcachePort'] : 11211;
254
+        $cacheTime = (isset($arguments['cacheTime'])) ? $arguments['cacheTime'] : 600;
255
+
256
+        if (is_null($this->cachePrefix)) {
257
+            $baseUnique = $this->getUniqueID();
258
+            $this->cachePrefix = substr(md5($baseUnique), 0, 8) . '.';
259
+
260
+            //    Set a new Memcache object and connect to the Memcache server
261
+            $this->memcache = new Memcache();
262
+            if (!$this->memcache->addServer($memcacheServer, $memcachePort, false, 50, 5, 5, true, array($this, 'failureCallback'))) {
263
+                throw new PHPExcel_Exception("Could not connect to MemCache server at {$memcacheServer}:{$memcachePort}");
264
+            }
265
+            $this->cacheTime = $cacheTime;
266
+
267
+            parent::__construct($parent);
268
+        }
269
+    }
270
+
271
+    /**
272
+     * Memcache error handler
273
+     *
274
+     * @param    string    $host        Memcache server
275
+     * @param    integer    $port        Memcache port
276
+     * @throws    PHPExcel_Exception
277
+     */
278
+    public function failureCallback($host, $port)
279
+    {
280
+        throw new PHPExcel_Exception("memcache {$host}:{$port} failed");
281
+    }
282
+
283
+    /**
284
+     * Destroy this cell collection
285
+     */
286
+    public function __destruct()
287
+    {
288
+        $cacheList = $this->getCellList();
289
+        foreach ($cacheList as $cellID) {
290
+            $this->memcache->delete($this->cachePrefix.$cellID . '.cache');
291
+        }
292
+    }
293
+
294
+    /**
295
+     * Identify whether the caching method is currently available
296
+     * Some methods are dependent on the availability of certain extensions being enabled in the PHP build
297
+     *
298
+     * @return    boolean
299
+     */
300
+    public static function cacheMethodIsAvailable()
301
+    {
302
+        if (!function_exists('memcache_add')) {
303
+            return false;
304
+        }
305
+
306
+        return true;
307
+    }
308
+}

+ 118
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/CachedObjectStorage/Memory.php View File

@@ -0,0 +1,118 @@
1
+<?php
2
+
3
+/**
4
+ * PHPExcel_CachedObjectStorage_Memory
5
+ *
6
+ * Copyright (c) 2006 - 2015 PHPExcel
7
+ *
8
+ * This library is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU Lesser General Public
10
+ * License as published by the Free Software Foundation; either
11
+ * version 2.1 of the License, or (at your option) any later version.
12
+ *
13
+ * This library is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
+ * Lesser General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU Lesser General Public
19
+ * License along with this library; if not, write to the Free Software
20
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21
+ *
22
+ * @category   PHPExcel
23
+ * @package    PHPExcel_CachedObjectStorage
24
+ * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
25
+ * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
26
+ * @version    ##VERSION##, ##DATE##
27
+ */
28
+class PHPExcel_CachedObjectStorage_Memory extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache
29
+{
30
+    /**
31
+     * Dummy method callable from CacheBase, but unused by Memory cache
32
+     *
33
+     * @return    void
34
+     */
35
+    protected function storeData()
36
+    {
37
+    }
38
+
39
+    /**
40
+     * Add or Update a cell in cache identified by coordinate address
41
+     *
42
+     * @param    string            $pCoord        Coordinate address of the cell to update
43
+     * @param    PHPExcel_Cell    $cell        Cell to update
44
+     * @return    PHPExcel_Cell
45
+     * @throws    PHPExcel_Exception
46
+     */
47
+    public function addCacheData($pCoord, PHPExcel_Cell $cell)
48
+    {
49
+        $this->cellCache[$pCoord] = $cell;
50
+
51
+        //    Set current entry to the new/updated entry
52
+        $this->currentObjectID = $pCoord;
53
+
54
+        return $cell;
55
+    }
56
+
57
+
58
+    /**
59
+     * Get cell at a specific coordinate
60
+     *
61
+     * @param     string             $pCoord        Coordinate of the cell
62
+     * @throws     PHPExcel_Exception
63
+     * @return     PHPExcel_Cell     Cell that was found, or null if not found
64
+     */
65
+    public function getCacheData($pCoord)
66
+    {
67
+        //    Check if the entry that has been requested actually exists
68
+        if (!isset($this->cellCache[$pCoord])) {
69
+            $this->currentObjectID = null;
70
+            //    Return null if requested entry doesn't exist in cache
71
+            return null;
72
+        }
73
+
74
+        //    Set current entry to the requested entry
75
+        $this->currentObjectID = $pCoord;
76
+
77
+        //    Return requested entry
78
+        return $this->cellCache[$pCoord];
79
+    }
80
+
81
+
82
+    /**
83
+     * Clone the cell collection
84
+     *
85
+     * @param    PHPExcel_Worksheet    $parent        The new worksheet
86
+     */
87
+    public function copyCellCollection(PHPExcel_Worksheet $parent)
88
+    {
89
+        parent::copyCellCollection($parent);
90
+
91
+        $newCollection = array();
92
+        foreach ($this->cellCache as $k => &$cell) {
93
+            $newCollection[$k] = clone $cell;
94
+            $newCollection[$k]->attach($this);
95
+        }
96
+
97
+        $this->cellCache = $newCollection;
98
+    }
99
+
100
+    /**
101
+     * Clear the cell collection and disconnect from our parent
102
+     *
103
+     */
104
+    public function unsetWorksheetCells()
105
+    {
106
+        // Because cells are all stored as intact objects in memory, we need to detach each one from the parent
107
+        foreach ($this->cellCache as $k => &$cell) {
108
+            $cell->detach();
109
+            $this->cellCache[$k] = null;
110
+        }
111
+        unset($cell);
112
+
113
+        $this->cellCache = array();
114
+
115
+        //    detach ourself from the worksheet, so that it can then delete this object successfully
116
+        $this->parent = null;
117
+    }
118
+}

+ 133
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/CachedObjectStorage/MemoryGZip.php View File

@@ -0,0 +1,133 @@
1
+<?php
2
+
3
+/**
4
+ * PHPExcel_CachedObjectStorage_MemoryGZip
5
+ *
6
+ * Copyright (c) 2006 - 2015 PHPExcel
7
+ *
8
+ * This library is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU Lesser General Public
10
+ * License as published by the Free Software Foundation; either
11
+ * version 2.1 of the License, or (at your option) any later version.
12
+ *
13
+ * This library is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
+ * Lesser General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU Lesser General Public
19
+ * License along with this library; if not, write to the Free Software
20
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21
+ *
22
+ * @category   PHPExcel
23
+ * @package    PHPExcel_CachedObjectStorage
24
+ * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
25
+ * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
26
+ * @version    ##VERSION##, ##DATE##
27
+ */
28
+class PHPExcel_CachedObjectStorage_MemoryGZip extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache
29
+{
30
+    /**
31
+     * Store cell data in cache for the current cell object if it's "dirty",
32
+     *     and the 'nullify' the current cell object
33
+     *
34
+     * @return    void
35
+     * @throws    PHPExcel_Exception
36
+     */
37
+    protected function storeData()
38
+    {
39
+        if ($this->currentCellIsDirty && !empty($this->currentObjectID)) {
40
+            $this->currentObject->detach();
41
+
42
+            $this->cellCache[$this->currentObjectID] = gzdeflate(serialize($this->currentObject));
43
+            $this->currentCellIsDirty = false;
44
+        }
45
+        $this->currentObjectID = $this->currentObject = null;
46
+    }
47
+
48
+
49
+    /**
50
+     * Add or Update a cell in cache identified by coordinate address
51
+     *
52
+     * @param    string            $pCoord        Coordinate address of the cell to update
53
+     * @param    PHPExcel_Cell    $cell        Cell to update
54
+     * @return    PHPExcel_Cell
55
+     * @throws    PHPExcel_Exception
56
+     */
57
+    public function addCacheData($pCoord, PHPExcel_Cell $cell)
58
+    {
59
+        if (($pCoord !== $this->currentObjectID) && ($this->currentObjectID !== null)) {
60
+            $this->storeData();
61
+        }
62
+
63
+        $this->currentObjectID = $pCoord;
64
+        $this->currentObject = $cell;
65
+        $this->currentCellIsDirty = true;
66
+
67
+        return $cell;
68
+    }
69
+
70
+
71
+    /**
72
+     * Get cell at a specific coordinate
73
+     *
74
+     * @param     string             $pCoord        Coordinate of the cell
75
+     * @throws     PHPExcel_Exception
76
+     * @return     PHPExcel_Cell     Cell that was found, or null if not found
77
+     */
78
+    public function getCacheData($pCoord)
79
+    {
80
+        if ($pCoord === $this->currentObjectID) {
81
+            return $this->currentObject;
82
+        }
83
+        $this->storeData();
84
+
85
+        //    Check if the entry that has been requested actually exists
86
+        if (!isset($this->cellCache[$pCoord])) {
87
+            //    Return null if requested entry doesn't exist in cache
88
+            return null;
89
+        }
90
+
91
+        //    Set current entry to the requested entry
92
+        $this->currentObjectID = $pCoord;
93
+        $this->currentObject = unserialize(gzinflate($this->cellCache[$pCoord]));
94
+        //    Re-attach this as the cell's parent
95
+        $this->currentObject->attach($this);
96
+
97
+        //    Return requested entry
98
+        return $this->currentObject;
99
+    }
100
+
101
+
102
+    /**
103
+     * Get a list of all cell addresses currently held in cache
104
+     *
105
+     * @return  string[]
106
+     */
107
+    public function getCellList()
108
+    {
109
+        if ($this->currentObjectID !== null) {
110
+            $this->storeData();
111
+        }
112
+
113
+        return parent::getCellList();
114
+    }
115
+
116
+
117
+    /**
118
+     * Clear the cell collection and disconnect from our parent
119
+     *
120
+     * @return    void
121
+     */
122
+    public function unsetWorksheetCells()
123
+    {
124
+        if (!is_null($this->currentObject)) {
125
+            $this->currentObject->detach();
126
+            $this->currentObject = $this->currentObjectID = null;
127
+        }
128
+        $this->cellCache = array();
129
+
130
+        //    detach ourself from the worksheet, so that it can then delete this object successfully
131
+        $this->parent = null;
132
+    }
133
+}

+ 129
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/CachedObjectStorage/MemorySerialized.php View File

@@ -0,0 +1,129 @@
1
+<?php
2
+
3
+/**
4
+ * PHPExcel_CachedObjectStorage_MemorySerialized
5
+ *
6
+ * Copyright (c) 2006 - 2015 PHPExcel
7
+ *
8
+ * This library is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU Lesser General Public
10
+ * License as published by the Free Software Foundation; either
11
+ * version 2.1 of the License, or (at your option) any later version.
12
+ *
13
+ * This library is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
+ * Lesser General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU Lesser General Public
19
+ * License along with this library; if not, write to the Free Software
20
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21
+ *
22
+ * @category   PHPExcel
23
+ * @package    PHPExcel_CachedObjectStorage
24
+ * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
25
+ * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
26
+ * @version    ##VERSION##, ##DATE##
27
+ */
28
+class PHPExcel_CachedObjectStorage_MemorySerialized extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache
29
+{
30
+    /**
31
+     * Store cell data in cache for the current cell object if it's "dirty",
32
+     *     and the 'nullify' the current cell object
33
+     *
34
+     * @return    void
35
+     * @throws    PHPExcel_Exception
36
+     */
37
+    protected function storeData()
38
+    {
39
+        if ($this->currentCellIsDirty && !empty($this->currentObjectID)) {
40
+            $this->currentObject->detach();
41
+
42
+            $this->cellCache[$this->currentObjectID] = serialize($this->currentObject);
43
+            $this->currentCellIsDirty = false;
44
+        }
45
+        $this->currentObjectID = $this->currentObject = null;
46
+    }
47
+
48
+    /**
49
+     * Add or Update a cell in cache identified by coordinate address
50
+     *
51
+     * @param    string            $pCoord        Coordinate address of the cell to update
52
+     * @param    PHPExcel_Cell    $cell        Cell to update
53
+     * @return    PHPExcel_Cell
54
+     * @throws    PHPExcel_Exception
55
+     */
56
+    public function addCacheData($pCoord, PHPExcel_Cell $cell)
57
+    {
58
+        if (($pCoord !== $this->currentObjectID) && ($this->currentObjectID !== null)) {
59
+            $this->storeData();
60
+        }
61
+
62
+        $this->currentObjectID = $pCoord;
63
+        $this->currentObject = $cell;
64
+        $this->currentCellIsDirty = true;
65
+
66
+        return $cell;
67
+    }
68
+
69
+    /**
70
+     * Get cell at a specific coordinate
71
+     *
72
+     * @param     string             $pCoord        Coordinate of the cell
73
+     * @throws     PHPExcel_Exception
74
+     * @return     PHPExcel_Cell     Cell that was found, or null if not found
75
+     */
76
+    public function getCacheData($pCoord)
77
+    {
78
+        if ($pCoord === $this->currentObjectID) {
79
+            return $this->currentObject;
80
+        }
81
+        $this->storeData();
82
+
83
+        //    Check if the entry that has been requested actually exists
84
+        if (!isset($this->cellCache[$pCoord])) {
85
+            //    Return null if requested entry doesn't exist in cache
86
+            return null;
87
+        }
88
+
89
+        //    Set current entry to the requested entry
90
+        $this->currentObjectID = $pCoord;
91
+        $this->currentObject = unserialize($this->cellCache[$pCoord]);
92
+        //    Re-attach this as the cell's parent
93
+        $this->currentObject->attach($this);
94
+
95
+        //    Return requested entry
96
+        return $this->currentObject;
97
+    }
98
+
99
+    /**
100
+     * Get a list of all cell addresses currently held in cache
101
+     *
102
+     * @return  string[]
103
+     */
104
+    public function getCellList()
105
+    {
106
+        if ($this->currentObjectID !== null) {
107
+            $this->storeData();
108
+        }
109
+
110
+        return parent::getCellList();
111
+    }
112
+
113
+    /**
114
+     * Clear the cell collection and disconnect from our parent
115
+     *
116
+     * @return    void
117
+     */
118
+    public function unsetWorksheetCells()
119
+    {
120
+        if (!is_null($this->currentObject)) {
121
+            $this->currentObject->detach();
122
+            $this->currentObject = $this->currentObjectID = null;
123
+        }
124
+        $this->cellCache = array();
125
+
126
+        //    detach ourself from the worksheet, so that it can then delete this object successfully
127
+        $this->parent = null;
128
+    }
129
+}

+ 200
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/CachedObjectStorage/PHPTemp.php View File

@@ -0,0 +1,200 @@
1
+<?php
2
+
3
+/**
4
+ * PHPExcel_CachedObjectStorage_PHPTemp
5
+ *
6
+ * Copyright (c) 2006 - 2015 PHPExcel
7
+ *
8
+ * This library is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU Lesser General Public
10
+ * License as published by the Free Software Foundation; either
11
+ * version 2.1 of the License, or (at your option) any later version.
12
+ *
13
+ * This library is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
+ * Lesser General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU Lesser General Public
19
+ * License along with this library; if not, write to the Free Software
20
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21
+ *
22
+ * @category   PHPExcel
23
+ * @package    PHPExcel_CachedObjectStorage
24
+ * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
25
+ * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
26
+ * @version    ##VERSION##, ##DATE##
27
+ */
28
+class PHPExcel_CachedObjectStorage_PHPTemp extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache
29
+{
30
+    /**
31
+     * Name of the file for this cache
32
+     *
33
+     * @var string
34
+     */
35
+    private $fileHandle = null;
36
+
37
+    /**
38
+     * Memory limit to use before reverting to file cache
39
+     *
40
+     * @var integer
41
+     */
42
+    private $memoryCacheSize = null;
43
+
44
+    /**
45
+     * Store cell data in cache for the current cell object if it's "dirty",
46
+     *     and the 'nullify' the current cell object
47
+     *
48
+     * @return    void
49
+     * @throws    PHPExcel_Exception
50
+     */
51
+    protected function storeData()
52
+    {
53
+        if ($this->currentCellIsDirty && !empty($this->currentObjectID)) {
54
+            $this->currentObject->detach();
55
+
56
+            fseek($this->fileHandle, 0, SEEK_END);
57
+
58
+            $this->cellCache[$this->currentObjectID] = array(
59
+                'ptr' => ftell($this->fileHandle),
60
+                'sz'  => fwrite($this->fileHandle, serialize($this->currentObject))
61
+            );
62
+            $this->currentCellIsDirty = false;
63
+        }
64
+        $this->currentObjectID = $this->currentObject = null;
65
+    }
66
+
67
+
68
+    /**
69
+     * Add or Update a cell in cache identified by coordinate address
70
+     *
71
+     * @param    string            $pCoord        Coordinate address of the cell to update
72
+     * @param    PHPExcel_Cell    $cell        Cell to update
73
+     * @return    PHPExcel_Cell
74
+     * @throws    PHPExcel_Exception
75
+     */
76
+    public function addCacheData($pCoord, PHPExcel_Cell $cell)
77
+    {
78
+        if (($pCoord !== $this->currentObjectID) && ($this->currentObjectID !== null)) {
79
+            $this->storeData();
80
+        }
81
+
82
+        $this->currentObjectID = $pCoord;
83
+        $this->currentObject = $cell;
84
+        $this->currentCellIsDirty = true;
85
+
86
+        return $cell;
87
+    }
88
+
89
+
90
+    /**
91
+     * Get cell at a specific coordinate
92
+     *
93
+     * @param     string             $pCoord        Coordinate of the cell
94
+     * @throws     PHPExcel_Exception
95
+     * @return     PHPExcel_Cell     Cell that was found, or null if not found
96
+     */
97
+    public function getCacheData($pCoord)
98
+    {
99
+        if ($pCoord === $this->currentObjectID) {
100
+            return $this->currentObject;
101
+        }
102
+        $this->storeData();
103
+
104
+        //    Check if the entry that has been requested actually exists
105
+        if (!isset($this->cellCache[$pCoord])) {
106
+            //    Return null if requested entry doesn't exist in cache
107
+            return null;
108
+        }
109
+
110
+        //    Set current entry to the requested entry
111
+        $this->currentObjectID = $pCoord;
112
+        fseek($this->fileHandle, $this->cellCache[$pCoord]['ptr']);
113
+        $this->currentObject = unserialize(fread($this->fileHandle, $this->cellCache[$pCoord]['sz']));
114
+        //    Re-attach this as the cell's parent
115
+        $this->currentObject->attach($this);
116
+
117
+        //    Return requested entry
118
+        return $this->currentObject;
119
+    }
120
+
121
+    /**
122
+     * Get a list of all cell addresses currently held in cache
123
+     *
124
+     * @return  string[]
125
+     */
126
+    public function getCellList()
127
+    {
128
+        if ($this->currentObjectID !== null) {
129
+            $this->storeData();
130
+        }
131
+
132
+        return parent::getCellList();
133
+    }
134
+
135
+    /**
136
+     * Clone the cell collection
137
+     *
138
+     * @param    PHPExcel_Worksheet    $parent        The new worksheet
139
+     * @return    void
140
+     */
141
+    public function copyCellCollection(PHPExcel_Worksheet $parent)
142
+    {
143
+        parent::copyCellCollection($parent);
144
+        //    Open a new stream for the cell cache data
145
+        $newFileHandle = fopen('php://temp/maxmemory:' . $this->memoryCacheSize, 'a+');
146
+        //    Copy the existing cell cache data to the new stream
147
+        fseek($this->fileHandle, 0);
148
+        while (!feof($this->fileHandle)) {
149
+            fwrite($newFileHandle, fread($this->fileHandle, 1024));
150
+        }
151
+        $this->fileHandle = $newFileHandle;
152
+    }
153
+
154
+    /**
155
+     * Clear the cell collection and disconnect from our parent
156
+     *
157
+     * @return    void
158
+     */
159
+    public function unsetWorksheetCells()
160
+    {
161
+        if (!is_null($this->currentObject)) {
162
+            $this->currentObject->detach();
163
+            $this->currentObject = $this->currentObjectID = null;
164
+        }
165
+        $this->cellCache = array();
166
+
167
+        //    detach ourself from the worksheet, so that it can then delete this object successfully
168
+        $this->parent = null;
169
+
170
+        //    Close down the php://temp file
171
+        $this->__destruct();
172
+    }
173
+
174
+    /**
175
+     * Initialise this new cell collection
176
+     *
177
+     * @param    PHPExcel_Worksheet    $parent        The worksheet for this cell collection
178
+     * @param    array of mixed        $arguments    Additional initialisation arguments
179
+     */
180
+    public function __construct(PHPExcel_Worksheet $parent, $arguments)
181
+    {
182
+        $this->memoryCacheSize = (isset($arguments['memoryCacheSize'])) ? $arguments['memoryCacheSize'] : '1MB';
183
+
184
+        parent::__construct($parent);
185
+        if (is_null($this->fileHandle)) {
186
+            $this->fileHandle = fopen('php://temp/maxmemory:' . $this->memoryCacheSize, 'a+');
187
+        }
188
+    }
189
+
190
+    /**
191
+     * Destroy this cell collection
192
+     */
193
+    public function __destruct()
194
+    {
195
+        if (!is_null($this->fileHandle)) {
196
+            fclose($this->fileHandle);
197
+        }
198
+        $this->fileHandle = null;
199
+    }
200
+}

+ 307
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/CachedObjectStorage/SQLite.php View File

@@ -0,0 +1,307 @@
1
+<?php
2
+
3
+/**
4
+ * PHPExcel_CachedObjectStorage_SQLite
5
+ *
6
+ * Copyright (c) 2006 - 2015 PHPExcel
7
+ *
8
+ * This library is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU Lesser General Public
10
+ * License as published by the Free Software Foundation; either
11
+ * version 2.1 of the License, or (at your option) any later version.
12
+ *
13
+ * This library is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
+ * Lesser General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU Lesser General Public
19
+ * License along with this library; if not, write to the Free Software
20
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21
+ *
22
+ * @category   PHPExcel
23
+ * @package    PHPExcel_CachedObjectStorage
24
+ * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
25
+ * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
26
+ * @version    ##VERSION##, ##DATE##
27
+ */
28
+class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache
29
+{
30
+    /**
31
+     * Database table name
32
+     *
33
+     * @var string
34
+     */
35
+    private $TableName = null;
36
+
37
+    /**
38
+     * Database handle
39
+     *
40
+     * @var resource
41
+     */
42
+    private $DBHandle = null;
43
+
44
+    /**
45
+     * Store cell data in cache for the current cell object if it's "dirty",
46
+     *     and the 'nullify' the current cell object
47
+     *
48
+     * @return    void
49
+     * @throws    PHPExcel_Exception
50
+     */
51
+    protected function storeData()
52
+    {
53
+        if ($this->currentCellIsDirty && !empty($this->currentObjectID)) {
54
+            $this->currentObject->detach();
55
+
56
+            if (!$this->DBHandle->queryExec("INSERT OR REPLACE INTO kvp_".$this->TableName." VALUES('".$this->currentObjectID."','".sqlite_escape_string(serialize($this->currentObject))."')")) {
57
+                throw new PHPExcel_Exception(sqlite_error_string($this->DBHandle->lastError()));
58
+            }
59
+            $this->currentCellIsDirty = false;
60
+        }
61
+        $this->currentObjectID = $this->currentObject = null;
62
+    }
63
+
64
+    /**
65
+     * Add or Update a cell in cache identified by coordinate address
66
+     *
67
+     * @param    string            $pCoord        Coordinate address of the cell to update
68
+     * @param    PHPExcel_Cell    $cell        Cell to update
69
+     * @return    PHPExcel_Cell
70
+     * @throws    PHPExcel_Exception
71
+     */
72
+    public function addCacheData($pCoord, PHPExcel_Cell $cell)
73
+    {
74
+        if (($pCoord !== $this->currentObjectID) && ($this->currentObjectID !== null)) {
75
+            $this->storeData();
76
+        }
77
+
78
+        $this->currentObjectID = $pCoord;
79
+        $this->currentObject = $cell;
80
+        $this->currentCellIsDirty = true;
81
+
82
+        return $cell;
83
+    }
84
+
85
+    /**
86
+     * Get cell at a specific coordinate
87
+     *
88
+     * @param     string             $pCoord        Coordinate of the cell
89
+     * @throws     PHPExcel_Exception
90
+     * @return     PHPExcel_Cell     Cell that was found, or null if not found
91
+     */
92
+    public function getCacheData($pCoord)
93
+    {
94
+        if ($pCoord === $this->currentObjectID) {
95
+            return $this->currentObject;
96
+        }
97
+        $this->storeData();
98
+
99
+        $query = "SELECT value FROM kvp_".$this->TableName." WHERE id='".$pCoord."'";
100
+        $cellResultSet = $this->DBHandle->query($query, SQLITE_ASSOC);
101
+        if ($cellResultSet === false) {
102
+            throw new PHPExcel_Exception(sqlite_error_string($this->DBHandle->lastError()));
103
+        } elseif ($cellResultSet->numRows() == 0) {
104
+            //    Return null if requested entry doesn't exist in cache
105
+            return null;
106
+        }
107
+
108
+        //    Set current entry to the requested entry
109
+        $this->currentObjectID = $pCoord;
110
+
111
+        $cellResult = $cellResultSet->fetchSingle();
112
+        $this->currentObject = unserialize($cellResult);
113
+        //    Re-attach this as the cell's parent
114
+        $this->currentObject->attach($this);
115
+
116
+        //    Return requested entry
117
+        return $this->currentObject;
118
+    }
119
+
120
+    /**
121
+     * Is a value set for an indexed cell?
122
+     *
123
+     * @param    string        $pCoord        Coordinate address of the cell to check
124
+     * @return    boolean
125
+     */
126
+    public function isDataSet($pCoord)
127
+    {
128
+        if ($pCoord === $this->currentObjectID) {
129
+            return true;
130
+        }
131
+
132
+        //    Check if the requested entry exists in the cache
133
+        $query = "SELECT id FROM kvp_".$this->TableName." WHERE id='".$pCoord."'";
134
+        $cellResultSet = $this->DBHandle->query($query, SQLITE_ASSOC);
135
+        if ($cellResultSet === false) {
136
+            throw new PHPExcel_Exception(sqlite_error_string($this->DBHandle->lastError()));
137
+        } elseif ($cellResultSet->numRows() == 0) {
138
+            //    Return null if requested entry doesn't exist in cache
139
+            return false;
140
+        }
141
+        return true;
142
+    }
143
+
144
+    /**
145
+     * Delete a cell in cache identified by coordinate address
146
+     *
147
+     * @param    string            $pCoord        Coordinate address of the cell to delete
148
+     * @throws    PHPExcel_Exception
149
+     */
150
+    public function deleteCacheData($pCoord)
151
+    {
152
+        if ($pCoord === $this->currentObjectID) {
153
+            $this->currentObject->detach();
154
+            $this->currentObjectID = $this->currentObject = null;
155
+        }
156
+
157
+        //    Check if the requested entry exists in the cache
158
+        $query = "DELETE FROM kvp_".$this->TableName." WHERE id='".$pCoord."'";
159
+        if (!$this->DBHandle->queryExec($query)) {
160
+            throw new PHPExcel_Exception(sqlite_error_string($this->DBHandle->lastError()));
161
+        }
162
+
163
+        $this->currentCellIsDirty = false;
164
+    }
165
+
166
+    /**
167
+     * Move a cell object from one address to another
168
+     *
169
+     * @param    string        $fromAddress    Current address of the cell to move
170
+     * @param    string        $toAddress        Destination address of the cell to move
171
+     * @return    boolean
172
+     */
173
+    public function moveCell($fromAddress, $toAddress)
174
+    {
175
+        if ($fromAddress === $this->currentObjectID) {
176
+            $this->currentObjectID = $toAddress;
177
+        }
178
+
179
+        $query = "DELETE FROM kvp_".$this->TableName." WHERE id='".$toAddress."'";
180
+        $result = $this->DBHandle->exec($query);
181
+        if ($result === false) {
182
+            throw new PHPExcel_Exception($this->DBHandle->lastErrorMsg());
183
+        }
184
+
185
+        $query = "UPDATE kvp_".$this->TableName." SET id='".$toAddress."' WHERE id='".$fromAddress."'";
186
+        $result = $this->DBHandle->exec($query);
187
+        if ($result === false) {
188
+            throw new PHPExcel_Exception($this->DBHandle->lastErrorMsg());
189
+        }
190
+
191
+        return true;
192
+    }
193
+
194
+    /**
195
+     * Get a list of all cell addresses currently held in cache
196
+     *
197
+     * @return    string[]
198
+     */
199
+    public function getCellList()
200
+    {
201
+        if ($this->currentObjectID !== null) {
202
+            $this->storeData();
203
+        }
204
+
205
+        $query = "SELECT id FROM kvp_".$this->TableName;
206
+        $cellIdsResult = $this->DBHandle->unbufferedQuery($query, SQLITE_ASSOC);
207
+        if ($cellIdsResult === false) {
208
+            throw new PHPExcel_Exception(sqlite_error_string($this->DBHandle->lastError()));
209
+        }
210
+
211
+        $cellKeys = array();
212
+        foreach ($cellIdsResult as $row) {
213
+            $cellKeys[] = $row['id'];
214
+        }
215
+
216
+        return $cellKeys;
217
+    }
218
+
219
+    /**
220
+     * Clone the cell collection
221
+     *
222
+     * @param    PHPExcel_Worksheet    $parent        The new worksheet
223
+     * @return    void
224
+     */
225
+    public function copyCellCollection(PHPExcel_Worksheet $parent)
226
+    {
227
+        $this->currentCellIsDirty;
228
+        $this->storeData();
229
+
230
+        //    Get a new id for the new table name
231
+        $tableName = str_replace('.', '_', $this->getUniqueID());
232
+        if (!$this->DBHandle->queryExec('CREATE TABLE kvp_'.$tableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB)
233
+            AS SELECT * FROM kvp_'.$this->TableName)
234
+        ) {
235
+            throw new PHPExcel_Exception(sqlite_error_string($this->DBHandle->lastError()));
236
+        }
237
+
238
+        //    Copy the existing cell cache file
239
+        $this->TableName = $tableName;
240
+    }
241
+
242
+    /**
243
+     * Clear the cell collection and disconnect from our parent
244
+     *
245
+     * @return    void
246
+     */
247
+    public function unsetWorksheetCells()
248
+    {
249
+        if (!is_null($this->currentObject)) {
250
+            $this->currentObject->detach();
251
+            $this->currentObject = $this->currentObjectID = null;
252
+        }
253
+        //    detach ourself from the worksheet, so that it can then delete this object successfully
254
+        $this->parent = null;
255
+
256
+        //    Close down the temporary cache file
257
+        $this->__destruct();
258
+    }
259
+
260
+    /**
261
+     * Initialise this new cell collection
262
+     *
263
+     * @param    PHPExcel_Worksheet    $parent        The worksheet for this cell collection
264
+     */
265
+    public function __construct(PHPExcel_Worksheet $parent)
266
+    {
267
+        parent::__construct($parent);
268
+        if (is_null($this->DBHandle)) {
269
+            $this->TableName = str_replace('.', '_', $this->getUniqueID());
270
+            $_DBName = ':memory:';
271
+
272
+            $this->DBHandle = new SQLiteDatabase($_DBName);
273
+            if ($this->DBHandle === false) {
274
+                throw new PHPExcel_Exception(sqlite_error_string($this->DBHandle->lastError()));
275
+            }
276
+            if (!$this->DBHandle->queryExec('CREATE TABLE kvp_'.$this->TableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB)')) {
277
+                throw new PHPExcel_Exception(sqlite_error_string($this->DBHandle->lastError()));
278
+            }
279
+        }
280
+    }
281
+
282
+    /**
283
+     * Destroy this cell collection
284
+     */
285
+    public function __destruct()
286
+    {
287
+        if (!is_null($this->DBHandle)) {
288
+            $this->DBHandle->queryExec('DROP TABLE kvp_'.$this->TableName);
289
+        }
290
+        $this->DBHandle = null;
291
+    }
292
+
293
+    /**
294
+     * Identify whether the caching method is currently available
295
+     * Some methods are dependent on the availability of certain extensions being enabled in the PHP build
296
+     *
297
+     * @return    boolean
298
+     */
299
+    public static function cacheMethodIsAvailable()
300
+    {
301
+        if (!function_exists('sqlite_open')) {
302
+            return false;
303
+        }
304
+
305
+        return true;
306
+    }
307
+}

+ 346
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/CachedObjectStorage/SQLite3.php View File

@@ -0,0 +1,346 @@
1
+<?php
2
+
3
+/**
4
+ * PHPExcel_CachedObjectStorage_SQLite3
5
+ *
6
+ * Copyright (c) 2006 - 2015 PHPExcel
7
+ *
8
+ * This library is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU Lesser General Public
10
+ * License as published by the Free Software Foundation; either
11
+ * version 2.1 of the License, or (at your option) any later version.
12
+ *
13
+ * This library is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
+ * Lesser General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU Lesser General Public
19
+ * License along with this library; if not, write to the Free Software
20
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21
+ *
22
+ * @category   PHPExcel
23
+ * @package    PHPExcel_CachedObjectStorage
24
+ * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
25
+ * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
26
+ * @version    ##VERSION##, ##DATE##
27
+ */
28
+class PHPExcel_CachedObjectStorage_SQLite3 extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache
29
+{
30
+    /**
31
+     * Database table name
32
+     *
33
+     * @var string
34
+     */
35
+    private $TableName = null;
36
+
37
+    /**
38
+     * Database handle
39
+     *
40
+     * @var resource
41
+     */
42
+    private $DBHandle = null;
43
+
44
+    /**
45
+     * Prepared statement for a SQLite3 select query
46
+     *
47
+     * @var SQLite3Stmt
48
+     */
49
+    private $selectQuery;
50
+
51
+    /**
52
+     * Prepared statement for a SQLite3 insert query
53
+     *
54
+     * @var SQLite3Stmt
55
+     */
56
+    private $insertQuery;
57
+
58
+    /**
59
+     * Prepared statement for a SQLite3 update query
60
+     *
61
+     * @var SQLite3Stmt
62
+     */
63
+    private $updateQuery;
64
+
65
+    /**
66
+     * Prepared statement for a SQLite3 delete query
67
+     *
68
+     * @var SQLite3Stmt
69
+     */
70
+    private $deleteQuery;
71
+
72
+    /**
73
+     * Store cell data in cache for the current cell object if it's "dirty",
74
+     *     and the 'nullify' the current cell object
75
+     *
76
+     * @return    void
77
+     * @throws    PHPExcel_Exception
78
+     */
79
+    protected function storeData()
80
+    {
81
+        if ($this->currentCellIsDirty && !empty($this->currentObjectID)) {
82
+            $this->currentObject->detach();
83
+
84
+            $this->insertQuery->bindValue('id', $this->currentObjectID, SQLITE3_TEXT);
85
+            $this->insertQuery->bindValue('data', serialize($this->currentObject), SQLITE3_BLOB);
86
+            $result = $this->insertQuery->execute();
87
+            if ($result === false) {
88
+                throw new PHPExcel_Exception($this->DBHandle->lastErrorMsg());
89
+            }
90
+            $this->currentCellIsDirty = false;
91
+        }
92
+        $this->currentObjectID = $this->currentObject = null;
93
+    }
94
+
95
+    /**
96
+     * Add or Update a cell in cache identified by coordinate address
97
+     *
98
+     * @param    string            $pCoord        Coordinate address of the cell to update
99
+     * @param    PHPExcel_Cell    $cell        Cell to update
100
+     * @return    PHPExcel_Cell
101
+     * @throws    PHPExcel_Exception
102
+     */
103
+    public function addCacheData($pCoord, PHPExcel_Cell $cell)
104
+    {
105
+        if (($pCoord !== $this->currentObjectID) && ($this->currentObjectID !== null)) {
106
+            $this->storeData();
107
+        }
108
+
109
+        $this->currentObjectID = $pCoord;
110
+        $this->currentObject = $cell;
111
+        $this->currentCellIsDirty = true;
112
+
113
+        return $cell;
114
+    }
115
+
116
+    /**
117
+     * Get cell at a specific coordinate
118
+     *
119
+     * @param     string             $pCoord        Coordinate of the cell
120
+     * @throws     PHPExcel_Exception
121
+     * @return     PHPExcel_Cell     Cell that was found, or null if not found
122
+     */
123
+    public function getCacheData($pCoord)
124
+    {
125
+        if ($pCoord === $this->currentObjectID) {
126
+            return $this->currentObject;
127
+        }
128
+        $this->storeData();
129
+
130
+        $this->selectQuery->bindValue('id', $pCoord, SQLITE3_TEXT);
131
+        $cellResult = $this->selectQuery->execute();
132
+        if ($cellResult === false) {
133
+            throw new PHPExcel_Exception($this->DBHandle->lastErrorMsg());
134
+        }
135
+        $cellData = $cellResult->fetchArray(SQLITE3_ASSOC);
136
+        if ($cellData === false) {
137
+            //    Return null if requested entry doesn't exist in cache
138
+            return null;
139
+        }
140
+
141
+        //    Set current entry to the requested entry
142
+        $this->currentObjectID = $pCoord;
143
+
144
+        $this->currentObject = unserialize($cellData['value']);
145
+        //    Re-attach this as the cell's parent
146
+        $this->currentObject->attach($this);
147
+
148
+        //    Return requested entry
149
+        return $this->currentObject;
150
+    }
151
+
152
+    /**
153
+     *    Is a value set for an indexed cell?
154
+     *
155
+     * @param    string        $pCoord        Coordinate address of the cell to check
156
+     * @return    boolean
157
+     */
158
+    public function isDataSet($pCoord)
159
+    {
160
+        if ($pCoord === $this->currentObjectID) {
161
+            return true;
162
+        }
163
+
164
+        //    Check if the requested entry exists in the cache
165
+        $this->selectQuery->bindValue('id', $pCoord, SQLITE3_TEXT);
166
+        $cellResult = $this->selectQuery->execute();
167
+        if ($cellResult === false) {
168
+            throw new PHPExcel_Exception($this->DBHandle->lastErrorMsg());
169
+        }
170
+        $cellData = $cellResult->fetchArray(SQLITE3_ASSOC);
171
+
172
+        return ($cellData === false) ? false : true;
173
+    }
174
+
175
+    /**
176
+     *    Delete a cell in cache identified by coordinate address
177
+     *
178
+     * @param    string            $pCoord        Coordinate address of the cell to delete
179
+     * @throws    PHPExcel_Exception
180
+     */
181
+    public function deleteCacheData($pCoord)
182
+    {
183
+        if ($pCoord === $this->currentObjectID) {
184
+            $this->currentObject->detach();
185
+            $this->currentObjectID = $this->currentObject = null;
186
+        }
187
+
188
+        //    Check if the requested entry exists in the cache
189
+        $this->deleteQuery->bindValue('id', $pCoord, SQLITE3_TEXT);
190
+        $result = $this->deleteQuery->execute();
191
+        if ($result === false) {
192
+            throw new PHPExcel_Exception($this->DBHandle->lastErrorMsg());
193
+        }
194
+
195
+        $this->currentCellIsDirty = false;
196
+    }
197
+
198
+    /**
199
+     * Move a cell object from one address to another
200
+     *
201
+     * @param    string        $fromAddress    Current address of the cell to move
202
+     * @param    string        $toAddress        Destination address of the cell to move
203
+     * @return    boolean
204
+     */
205
+    public function moveCell($fromAddress, $toAddress)
206
+    {
207
+        if ($fromAddress === $this->currentObjectID) {
208
+            $this->currentObjectID = $toAddress;
209
+        }
210
+
211
+        $this->deleteQuery->bindValue('id', $toAddress, SQLITE3_TEXT);
212
+        $result = $this->deleteQuery->execute();
213
+        if ($result === false) {
214
+            throw new PHPExcel_Exception($this->DBHandle->lastErrorMsg());
215
+        }
216
+
217
+        $this->updateQuery->bindValue('toid', $toAddress, SQLITE3_TEXT);
218
+        $this->updateQuery->bindValue('fromid', $fromAddress, SQLITE3_TEXT);
219
+        $result = $this->updateQuery->execute();
220
+        if ($result === false) {
221
+            throw new PHPExcel_Exception($this->DBHandle->lastErrorMsg());
222
+        }
223
+
224
+        return true;
225
+    }
226
+
227
+    /**
228
+     * Get a list of all cell addresses currently held in cache
229
+     *
230
+     * @return    string[]
231
+     */
232
+    public function getCellList()
233
+    {
234
+        if ($this->currentObjectID !== null) {
235
+            $this->storeData();
236
+        }
237
+
238
+        $query = "SELECT id FROM kvp_".$this->TableName;
239
+        $cellIdsResult = $this->DBHandle->query($query);
240
+        if ($cellIdsResult === false) {
241
+            throw new PHPExcel_Exception($this->DBHandle->lastErrorMsg());
242
+        }
243
+
244
+        $cellKeys = array();
245
+        while ($row = $cellIdsResult->fetchArray(SQLITE3_ASSOC)) {
246
+            $cellKeys[] = $row['id'];
247
+        }
248
+
249
+        return $cellKeys;
250
+    }
251
+
252
+    /**
253
+     * Clone the cell collection
254
+     *
255
+     * @param    PHPExcel_Worksheet    $parent        The new worksheet
256
+     * @return    void
257
+     */
258
+    public function copyCellCollection(PHPExcel_Worksheet $parent)
259
+    {
260
+        $this->currentCellIsDirty;
261
+        $this->storeData();
262
+
263
+        //    Get a new id for the new table name
264
+        $tableName = str_replace('.', '_', $this->getUniqueID());
265
+        if (!$this->DBHandle->exec('CREATE TABLE kvp_'.$tableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB)
266
+            AS SELECT * FROM kvp_'.$this->TableName)
267
+        ) {
268
+            throw new PHPExcel_Exception($this->DBHandle->lastErrorMsg());
269
+        }
270
+
271
+        //    Copy the existing cell cache file
272
+        $this->TableName = $tableName;
273
+    }
274
+
275
+    /**
276
+     * Clear the cell collection and disconnect from our parent
277
+     *
278
+     * @return    void
279
+     */
280
+    public function unsetWorksheetCells()
281
+    {
282
+        if (!is_null($this->currentObject)) {
283
+            $this->currentObject->detach();
284
+            $this->currentObject = $this->currentObjectID = null;
285
+        }
286
+        //    detach ourself from the worksheet, so that it can then delete this object successfully
287
+        $this->parent = null;
288
+
289
+        //    Close down the temporary cache file
290
+        $this->__destruct();
291
+    }
292
+
293
+    /**
294
+     * Initialise this new cell collection
295
+     *
296
+     * @param    PHPExcel_Worksheet    $parent        The worksheet for this cell collection
297
+     */
298
+    public function __construct(PHPExcel_Worksheet $parent)
299
+    {
300
+        parent::__construct($parent);
301
+        if (is_null($this->DBHandle)) {
302
+            $this->TableName = str_replace('.', '_', $this->getUniqueID());
303
+            $_DBName = ':memory:';
304
+
305
+            $this->DBHandle = new SQLite3($_DBName);
306
+            if ($this->DBHandle === false) {
307
+                throw new PHPExcel_Exception($this->DBHandle->lastErrorMsg());
308
+            }
309
+            if (!$this->DBHandle->exec('CREATE TABLE kvp_'.$this->TableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB)')) {
310
+                throw new PHPExcel_Exception($this->DBHandle->lastErrorMsg());
311
+            }
312
+        }
313
+
314
+        $this->selectQuery = $this->DBHandle->prepare("SELECT value FROM kvp_".$this->TableName." WHERE id = :id");
315
+        $this->insertQuery = $this->DBHandle->prepare("INSERT OR REPLACE INTO kvp_".$this->TableName." VALUES(:id,:data)");
316
+        $this->updateQuery = $this->DBHandle->prepare("UPDATE kvp_".$this->TableName." SET id=:toId WHERE id=:fromId");
317
+        $this->deleteQuery = $this->DBHandle->prepare("DELETE FROM kvp_".$this->TableName." WHERE id = :id");
318
+    }
319
+
320
+    /**
321
+     * Destroy this cell collection
322
+     */
323
+    public function __destruct()
324
+    {
325
+        if (!is_null($this->DBHandle)) {
326
+            $this->DBHandle->exec('DROP TABLE kvp_'.$this->TableName);
327
+            $this->DBHandle->close();
328
+        }
329
+        $this->DBHandle = null;
330
+    }
331
+
332
+    /**
333
+     * Identify whether the caching method is currently available
334
+     * Some methods are dependent on the availability of certain extensions being enabled in the PHP build
335
+     *
336
+     * @return    boolean
337
+     */
338
+    public static function cacheMethodIsAvailable()
339
+    {
340
+        if (!class_exists('SQLite3', false)) {
341
+            return false;
342
+        }
343
+
344
+        return true;
345
+    }
346
+}

+ 289
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/CachedObjectStorage/Wincache.php View File

@@ -0,0 +1,289 @@
1
+<?php
2
+
3
+/**
4
+ * PHPExcel_CachedObjectStorage_Wincache
5
+ *
6
+ * Copyright (c) 2006 - 2015 PHPExcel
7
+ *
8
+ * This library is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU Lesser General Public
10
+ * License as published by the Free Software Foundation; either
11
+ * version 2.1 of the License, or (at your option) any later version.
12
+ *
13
+ * This library is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
+ * Lesser General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU Lesser General Public
19
+ * License along with this library; if not, write to the Free Software
20
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21
+ *
22
+ * @category   PHPExcel
23
+ * @package    PHPExcel_CachedObjectStorage
24
+ * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
25
+ * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
26
+ * @version    ##VERSION##, ##DATE##
27
+ */
28
+class PHPExcel_CachedObjectStorage_Wincache extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache
29
+{
30
+    /**
31
+     * Prefix used to uniquely identify cache data for this worksheet
32
+     *
33
+     * @var string
34
+     */
35
+    private $cachePrefix = null;
36
+
37
+    /**
38
+     * Cache timeout
39
+     *
40
+     * @var integer
41
+     */
42
+    private $cacheTime = 600;
43
+
44
+
45
+    /**
46
+     * Store cell data in cache for the current cell object if it's "dirty",
47
+     *     and the 'nullify' the current cell object
48
+     *
49
+     * @return    void
50
+     * @throws    PHPExcel_Exception
51
+     */
52
+    protected function storeData()
53
+    {
54
+        if ($this->currentCellIsDirty && !empty($this->currentObjectID)) {
55
+            $this->currentObject->detach();
56
+
57
+            $obj = serialize($this->currentObject);
58
+            if (wincache_ucache_exists($this->cachePrefix.$this->currentObjectID.'.cache')) {
59
+                if (!wincache_ucache_set($this->cachePrefix.$this->currentObjectID.'.cache', $obj, $this->cacheTime)) {
60
+                    $this->__destruct();
61
+                    throw new PHPExcel_Exception('Failed to store cell '.$this->currentObjectID.' in WinCache');
62
+                }
63
+            } else {
64
+                if (!wincache_ucache_add($this->cachePrefix.$this->currentObjectID.'.cache', $obj, $this->cacheTime)) {
65
+                    $this->__destruct();
66
+                    throw new PHPExcel_Exception('Failed to store cell '.$this->currentObjectID.' in WinCache');
67
+                }
68
+            }
69
+            $this->currentCellIsDirty = false;
70
+        }
71
+
72
+        $this->currentObjectID = $this->currentObject = null;
73
+    }
74
+
75
+    /**
76
+     * Add or Update a cell in cache identified by coordinate address
77
+     *
78
+     * @param    string            $pCoord        Coordinate address of the cell to update
79
+     * @param    PHPExcel_Cell    $cell        Cell to update
80
+     * @return    PHPExcel_Cell
81
+     * @throws    PHPExcel_Exception
82
+     */
83
+    public function addCacheData($pCoord, PHPExcel_Cell $cell)
84
+    {
85
+        if (($pCoord !== $this->currentObjectID) && ($this->currentObjectID !== null)) {
86
+            $this->storeData();
87
+        }
88
+        $this->cellCache[$pCoord] = true;
89
+
90
+        $this->currentObjectID = $pCoord;
91
+        $this->currentObject = $cell;
92
+        $this->currentCellIsDirty = true;
93
+
94
+        return $cell;
95
+    }
96
+
97
+    /**
98
+     * Is a value set in the current PHPExcel_CachedObjectStorage_ICache for an indexed cell?
99
+     *
100
+     * @param    string        $pCoord        Coordinate address of the cell to check
101
+     * @return    boolean
102
+     */
103
+    public function isDataSet($pCoord)
104
+    {
105
+        //    Check if the requested entry is the current object, or exists in the cache
106
+        if (parent::isDataSet($pCoord)) {
107
+            if ($this->currentObjectID == $pCoord) {
108
+                return true;
109
+            }
110
+            //    Check if the requested entry still exists in cache
111
+            $success = wincache_ucache_exists($this->cachePrefix.$pCoord.'.cache');
112
+            if ($success === false) {
113
+                //    Entry no longer exists in Wincache, so clear it from the cache array
114
+                parent::deleteCacheData($pCoord);
115
+                throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in WinCache');
116
+            }
117
+            return true;
118
+        }
119
+        return false;
120
+    }
121
+
122
+
123
+    /**
124
+     * Get cell at a specific coordinate
125
+     *
126
+     * @param    string            $pCoord        Coordinate of the cell
127
+     * @throws    PHPExcel_Exception
128
+     * @return    PHPExcel_Cell    Cell that was found, or null if not found
129
+     */
130
+    public function getCacheData($pCoord)
131
+    {
132
+        if ($pCoord === $this->currentObjectID) {
133
+            return $this->currentObject;
134
+        }
135
+        $this->storeData();
136
+
137
+        //    Check if the entry that has been requested actually exists
138
+        $obj = null;
139
+        if (parent::isDataSet($pCoord)) {
140
+            $success = false;
141
+            $obj = wincache_ucache_get($this->cachePrefix.$pCoord.'.cache', $success);
142
+            if ($success === false) {
143
+                //    Entry no longer exists in WinCache, so clear it from the cache array
144
+                parent::deleteCacheData($pCoord);
145
+                throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in WinCache');
146
+            }
147
+        } else {
148
+            //    Return null if requested entry doesn't exist in cache
149
+            return null;
150
+        }
151
+
152
+        //    Set current entry to the requested entry
153
+        $this->currentObjectID = $pCoord;
154
+        $this->currentObject = unserialize($obj);
155
+        //    Re-attach this as the cell's parent
156
+        $this->currentObject->attach($this);
157
+
158
+        //    Return requested entry
159
+        return $this->currentObject;
160
+    }
161
+
162
+
163
+    /**
164
+     * Get a list of all cell addresses currently held in cache
165
+     *
166
+     * @return  string[]
167
+     */
168
+    public function getCellList()
169
+    {
170
+        if ($this->currentObjectID !== null) {
171
+            $this->storeData();
172
+        }
173
+
174
+        return parent::getCellList();
175
+    }
176
+
177
+    /**
178
+     * Delete a cell in cache identified by coordinate address
179
+     *
180
+     * @param    string            $pCoord        Coordinate address of the cell to delete
181
+     * @throws    PHPExcel_Exception
182
+     */
183
+    public function deleteCacheData($pCoord)
184
+    {
185
+        //    Delete the entry from Wincache
186
+        wincache_ucache_delete($this->cachePrefix.$pCoord.'.cache');
187
+
188
+        //    Delete the entry from our cell address array
189
+        parent::deleteCacheData($pCoord);
190
+    }
191
+
192
+    /**
193
+     * Clone the cell collection
194
+     *
195
+     * @param    PHPExcel_Worksheet    $parent        The new worksheet
196
+     * @return    void
197
+     */
198
+    public function copyCellCollection(PHPExcel_Worksheet $parent)
199
+    {
200
+        parent::copyCellCollection($parent);
201
+        //    Get a new id for the new file name
202
+        $baseUnique = $this->getUniqueID();
203
+        $newCachePrefix = substr(md5($baseUnique), 0, 8) . '.';
204
+        $cacheList = $this->getCellList();
205
+        foreach ($cacheList as $cellID) {
206
+            if ($cellID != $this->currentObjectID) {
207
+                $success = false;
208
+                $obj = wincache_ucache_get($this->cachePrefix.$cellID.'.cache', $success);
209
+                if ($success === false) {
210
+                    //    Entry no longer exists in WinCache, so clear it from the cache array
211
+                    parent::deleteCacheData($cellID);
212
+                    throw new PHPExcel_Exception('Cell entry '.$cellID.' no longer exists in Wincache');
213
+                }
214
+                if (!wincache_ucache_add($newCachePrefix.$cellID.'.cache', $obj, $this->cacheTime)) {
215
+                    $this->__destruct();
216
+                    throw new PHPExcel_Exception('Failed to store cell '.$cellID.' in Wincache');
217
+                }
218
+            }
219
+        }
220
+        $this->cachePrefix = $newCachePrefix;
221
+    }
222
+
223
+
224
+    /**
225
+     * Clear the cell collection and disconnect from our parent
226
+     *
227
+     * @return    void
228
+     */
229
+    public function unsetWorksheetCells()
230
+    {
231
+        if (!is_null($this->currentObject)) {
232
+            $this->currentObject->detach();
233
+            $this->currentObject = $this->currentObjectID = null;
234
+        }
235
+
236
+        //    Flush the WinCache cache
237
+        $this->__destruct();
238
+
239
+        $this->cellCache = array();
240
+
241
+        //    detach ourself from the worksheet, so that it can then delete this object successfully
242
+        $this->parent = null;
243
+    }
244
+
245
+    /**
246
+     * Initialise this new cell collection
247
+     *
248
+     * @param    PHPExcel_Worksheet    $parent        The worksheet for this cell collection
249
+     * @param    array of mixed        $arguments    Additional initialisation arguments
250
+     */
251
+    public function __construct(PHPExcel_Worksheet $parent, $arguments)
252
+    {
253
+        $cacheTime    = (isset($arguments['cacheTime']))    ? $arguments['cacheTime']    : 600;
254
+
255
+        if (is_null($this->cachePrefix)) {
256
+            $baseUnique = $this->getUniqueID();
257
+            $this->cachePrefix = substr(md5($baseUnique), 0, 8).'.';
258
+            $this->cacheTime = $cacheTime;
259
+
260
+            parent::__construct($parent);
261
+        }
262
+    }
263
+
264
+    /**
265
+     * Destroy this cell collection
266
+     */
267
+    public function __destruct()
268
+    {
269
+        $cacheList = $this->getCellList();
270
+        foreach ($cacheList as $cellID) {
271
+            wincache_ucache_delete($this->cachePrefix.$cellID.'.cache');
272
+        }
273
+    }
274
+
275
+    /**
276
+     * Identify whether the caching method is currently available
277
+     * Some methods are dependent on the availability of certain extensions being enabled in the PHP build
278
+     *
279
+     * @return    boolean
280
+     */
281
+    public static function cacheMethodIsAvailable()
282
+    {
283
+        if (!function_exists('wincache_ucache_add')) {
284
+            return false;
285
+        }
286
+
287
+        return true;
288
+    }
289
+}

+ 231
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/CachedObjectStorageFactory.php View File

@@ -0,0 +1,231 @@
1
+<?php
2
+
3
+/**
4
+ * PHPExcel_CachedObjectStorageFactory
5
+ *
6
+ * Copyright (c) 2006 - 2015 PHPExcel
7
+ *
8
+ * This library is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU Lesser General Public
10
+ * License as published by the Free Software Foundation; either
11
+ * version 2.1 of the License, or (at your option) any later version.
12
+ *
13
+ * This library is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
+ * Lesser General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU Lesser General Public
19
+ * License along with this library; if not, write to the Free Software
20
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21
+ *
22
+ * @category   PHPExcel
23
+ * @package    PHPExcel_CachedObjectStorage
24
+ * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
25
+ * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
26
+ * @version    ##VERSION##, ##DATE##
27
+ */
28
+class PHPExcel_CachedObjectStorageFactory
29
+{
30
+    const cache_in_memory               = 'Memory';
31
+    const cache_in_memory_gzip          = 'MemoryGZip';
32
+    const cache_in_memory_serialized    = 'MemorySerialized';
33
+    const cache_igbinary                = 'Igbinary';
34
+    const cache_to_discISAM             = 'DiscISAM';
35
+    const cache_to_apc                  = 'APC';
36
+    const cache_to_memcache             = 'Memcache';
37
+    const cache_to_phpTemp              = 'PHPTemp';
38
+    const cache_to_wincache             = 'Wincache';
39
+    const cache_to_sqlite               = 'SQLite';
40
+    const cache_to_sqlite3              = 'SQLite3';
41
+
42
+    /**
43
+     * Name of the method used for cell cacheing
44
+     *
45
+     * @var string
46
+     */
47
+    private static $cacheStorageMethod = null;
48
+
49
+    /**
50
+     * Name of the class used for cell cacheing
51
+     *
52
+     * @var string
53
+     */
54
+    private static $cacheStorageClass = null;
55
+
56
+    /**
57
+     * List of all possible cache storage methods
58
+     *
59
+     * @var string[]
60
+     */
61
+    private static $storageMethods = array(
62
+        self::cache_in_memory,
63
+        self::cache_in_memory_gzip,
64
+        self::cache_in_memory_serialized,
65
+        self::cache_igbinary,
66
+        self::cache_to_phpTemp,
67
+        self::cache_to_discISAM,
68
+        self::cache_to_apc,
69
+        self::cache_to_memcache,
70
+        self::cache_to_wincache,
71
+        self::cache_to_sqlite,
72
+        self::cache_to_sqlite3,
73
+    );
74
+
75
+    /**
76
+     * Default arguments for each cache storage method
77
+     *
78
+     * @var array of mixed array
79
+     */
80
+    private static $storageMethodDefaultParameters = array(
81
+        self::cache_in_memory               => array(
82
+                                                    ),
83
+        self::cache_in_memory_gzip          => array(
84
+                                                    ),
85
+        self::cache_in_memory_serialized    => array(
86
+                                                    ),
87
+        self::cache_igbinary                => array(
88
+                                                    ),
89
+        self::cache_to_phpTemp              => array( 'memoryCacheSize' => '1MB'
90
+                                                    ),
91
+        self::cache_to_discISAM             => array( 'dir'             => null
92
+                                                    ),
93
+        self::cache_to_apc                  => array( 'cacheTime'       => 600
94
+                                                    ),
95
+        self::cache_to_memcache             => array( 'memcacheServer'  => 'localhost',
96
+                                                      'memcachePort'    => 11211,
97
+                                                      'cacheTime'       => 600
98
+                                                    ),
99
+        self::cache_to_wincache             => array( 'cacheTime'       => 600
100
+                                                    ),
101
+        self::cache_to_sqlite               => array(
102
+                                                    ),
103
+        self::cache_to_sqlite3              => array(
104
+                                                    ),
105
+    );
106
+
107
+    /**
108
+     * Arguments for the active cache storage method
109
+     *
110
+     * @var array of mixed array
111
+     */
112
+    private static $storageMethodParameters = array();
113
+
114
+    /**
115
+     * Return the current cache storage method
116
+     *
117
+     * @return string|null
118
+     **/
119
+    public static function getCacheStorageMethod()
120
+    {
121
+        return self::$cacheStorageMethod;
122
+    }
123
+
124
+    /**
125
+     * Return the current cache storage class
126
+     *
127
+     * @return PHPExcel_CachedObjectStorage_ICache|null
128
+     **/
129
+    public static function getCacheStorageClass()
130
+    {
131
+        return self::$cacheStorageClass;
132
+    }
133
+
134
+    /**
135
+     * Return the list of all possible cache storage methods
136
+     *
137
+     * @return string[]
138
+     **/
139
+    public static function getAllCacheStorageMethods()
140
+    {
141
+        return self::$storageMethods;
142
+    }
143
+
144
+    /**
145
+     * Return the list of all available cache storage methods
146
+     *
147
+     * @return string[]
148
+     **/
149
+    public static function getCacheStorageMethods()
150
+    {
151
+        $activeMethods = array();
152
+        foreach (self::$storageMethods as $storageMethod) {
153
+            $cacheStorageClass = 'PHPExcel_CachedObjectStorage_' . $storageMethod;
154
+            if (call_user_func(array($cacheStorageClass, 'cacheMethodIsAvailable'))) {
155
+                $activeMethods[] = $storageMethod;
156
+            }
157
+        }
158
+        return $activeMethods;
159
+    }
160
+
161
+    /**
162
+     * Identify the cache storage method to use
163
+     *
164
+     * @param    string            $method        Name of the method to use for cell cacheing
165
+     * @param    array of mixed    $arguments    Additional arguments to pass to the cell caching class
166
+     *                                        when instantiating
167
+     * @return boolean
168
+     **/
169
+    public static function initialize($method = self::cache_in_memory, $arguments = array())
170
+    {
171
+        if (!in_array($method, self::$storageMethods)) {
172
+            return false;
173
+        }
174
+
175
+        $cacheStorageClass = 'PHPExcel_CachedObjectStorage_'.$method;
176
+        if (!call_user_func(array( $cacheStorageClass,
177
+                                   'cacheMethodIsAvailable'))) {
178
+            return false;
179
+        }
180
+
181
+        self::$storageMethodParameters[$method] = self::$storageMethodDefaultParameters[$method];
182
+        foreach ($arguments as $k => $v) {
183
+            if (array_key_exists($k, self::$storageMethodParameters[$method])) {
184
+                self::$storageMethodParameters[$method][$k] = $v;
185
+            }
186
+        }
187
+
188
+        if (self::$cacheStorageMethod === null) {
189
+            self::$cacheStorageClass = 'PHPExcel_CachedObjectStorage_' . $method;
190
+            self::$cacheStorageMethod = $method;
191
+        }
192
+        return true;
193
+    }
194
+
195
+    /**
196
+     * Initialise the cache storage
197
+     *
198
+     * @param    PHPExcel_Worksheet     $parent        Enable cell caching for this worksheet
199
+     * @return    PHPExcel_CachedObjectStorage_ICache
200
+     **/
201
+    public static function getInstance(PHPExcel_Worksheet $parent)
202
+    {
203
+        $cacheMethodIsAvailable = true;
204
+        if (self::$cacheStorageMethod === null) {
205
+            $cacheMethodIsAvailable = self::initialize();
206
+        }
207
+
208
+        if ($cacheMethodIsAvailable) {
209
+            $instance = new self::$cacheStorageClass(
210
+                $parent,
211
+                self::$storageMethodParameters[self::$cacheStorageMethod]
212
+            );
213
+            if ($instance !== null) {
214
+                return $instance;
215
+            }
216
+        }
217
+
218
+        return false;
219
+    }
220
+
221
+    /**
222
+     * Clear the cache storage
223
+     *
224
+     **/
225
+    public static function finalize()
226
+    {
227
+        self::$cacheStorageMethod = null;
228
+        self::$cacheStorageClass = null;
229
+        self::$storageMethodParameters = array();
230
+    }
231
+}

+ 94
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/CalcEngine/CyclicReferenceStack.php View File

@@ -0,0 +1,94 @@
1
+<?php
2
+
3
+/**
4
+ * PHPExcel_CalcEngine_CyclicReferenceStack
5
+ *
6
+ * Copyright (c) 2006 - 2015 PHPExcel
7
+ *
8
+ * This library is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU Lesser General Public
10
+ * License as published by the Free Software Foundation; either
11
+ * version 2.1 of the License, or (at your option) any later version.
12
+ *
13
+ * This library is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
+ * Lesser General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU Lesser General Public
19
+ * License along with this library; if not, write to the Free Software
20
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21
+ *
22
+ * @category   PHPExcel
23
+ * @package    PHPExcel_Calculation
24
+ * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
25
+ * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
26
+ * @version    ##VERSION##, ##DATE##
27
+ */
28
+class PHPExcel_CalcEngine_CyclicReferenceStack
29
+{
30
+    /**
31
+     *  The call stack for calculated cells
32
+     *
33
+     *  @var mixed[]
34
+     */
35
+    private $stack = array();
36
+
37
+    /**
38
+     * Return the number of entries on the stack
39
+     *
40
+     * @return  integer
41
+     */
42
+    public function count()
43
+    {
44
+        return count($this->stack);
45
+    }
46
+
47
+    /**
48
+     * Push a new entry onto the stack
49
+     *
50
+     * @param  mixed  $value
51
+     */
52
+    public function push($value)
53
+    {
54
+        $this->stack[$value] = $value;
55
+    }
56
+
57
+    /**
58
+     * Pop the last entry from the stack
59
+     *
60
+     * @return  mixed
61
+     */
62
+    public function pop()
63
+    {
64
+        return array_pop($this->stack);
65
+    }
66
+
67
+    /**
68
+     * Test to see if a specified entry exists on the stack
69
+     *
70
+     * @param  mixed  $value  The value to test
71
+     */
72
+    public function onStack($value)
73
+    {
74
+        return isset($this->stack[$value]);
75
+    }
76
+
77
+    /**
78
+     * Clear the stack
79
+     */
80
+    public function clear()
81
+    {
82
+        $this->stack = array();
83
+    }
84
+
85
+    /**
86
+     * Return an array of all entries on the stack
87
+     *
88
+     * @return  mixed[]
89
+     */
90
+    public function showStack()
91
+    {
92
+        return $this->stack;
93
+    }
94
+}

+ 151
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/CalcEngine/Logger.php View File

@@ -0,0 +1,151 @@
1
+<?php
2
+
3
+/**
4
+ * PHPExcel_CalcEngine_Logger
5
+ *
6
+ * Copyright (c) 2006 - 2015 PHPExcel
7
+ *
8
+ * This library is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU Lesser General Public
10
+ * License as published by the Free Software Foundation; either
11
+ * version 2.1 of the License, or (at your option) any later version.
12
+ *
13
+ * This library is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
+ * Lesser General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU Lesser General Public
19
+ * License along with this library; if not, write to the Free Software
20
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21
+ *
22
+ * @category   PHPExcel
23
+ * @package    PHPExcel_Calculation
24
+ * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
25
+ * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
26
+ * @version    ##VERSION##, ##DATE##
27
+ */
28
+class PHPExcel_CalcEngine_Logger
29
+{
30
+    /**
31
+     * Flag to determine whether a debug log should be generated by the calculation engine
32
+     *        If true, then a debug log will be generated
33
+     *        If false, then a debug log will not be generated
34
+     *
35
+     * @var boolean
36
+     */
37
+    private $writeDebugLog = false;
38
+
39
+    /**
40
+     * Flag to determine whether a debug log should be echoed by the calculation engine
41
+     *        If true, then a debug log will be echoed
42
+     *        If false, then a debug log will not be echoed
43
+     * A debug log can only be echoed if it is generated
44
+     *
45
+     * @var boolean
46
+     */
47
+    private $echoDebugLog = false;
48
+
49
+    /**
50
+     * The debug log generated by the calculation engine
51
+     *
52
+     * @var string[]
53
+     */
54
+    private $debugLog = array();
55
+
56
+    /**
57
+     * The calculation engine cell reference stack
58
+     *
59
+     * @var PHPExcel_CalcEngine_CyclicReferenceStack
60
+     */
61
+    private $cellStack;
62
+
63
+    /**
64
+     * Instantiate a Calculation engine logger
65
+     *
66
+     * @param  PHPExcel_CalcEngine_CyclicReferenceStack $stack
67
+     */
68
+    public function __construct(PHPExcel_CalcEngine_CyclicReferenceStack $stack)
69
+    {
70
+        $this->cellStack = $stack;
71
+    }
72
+
73
+    /**
74
+     * Enable/Disable Calculation engine logging
75
+     *
76
+     * @param  boolean $pValue
77
+     */
78
+    public function setWriteDebugLog($pValue = false)
79
+    {
80
+        $this->writeDebugLog = $pValue;
81
+    }
82
+
83
+    /**
84
+     * Return whether calculation engine logging is enabled or disabled
85
+     *
86
+     * @return  boolean
87
+     */
88
+    public function getWriteDebugLog()
89
+    {
90
+        return $this->writeDebugLog;
91
+    }
92
+
93
+    /**
94
+     * Enable/Disable echoing of debug log information
95
+     *
96
+     * @param  boolean $pValue
97
+     */
98
+    public function setEchoDebugLog($pValue = false)
99
+    {
100
+        $this->echoDebugLog = $pValue;
101
+    }
102
+
103
+    /**
104
+     * Return whether echoing of debug log information is enabled or disabled
105
+     *
106
+     * @return  boolean
107
+     */
108
+    public function getEchoDebugLog()
109
+    {
110
+        return $this->echoDebugLog;
111
+    }
112
+
113
+    /**
114
+     * Write an entry to the calculation engine debug log
115
+     */
116
+    public function writeDebugLog()
117
+    {
118
+        //    Only write the debug log if logging is enabled
119
+        if ($this->writeDebugLog) {
120
+            $message = implode(func_get_args());
121
+            $cellReference = implode(' -> ', $this->cellStack->showStack());
122
+            if ($this->echoDebugLog) {
123
+                echo $cellReference,
124
+                    ($this->cellStack->count() > 0 ? ' => ' : ''),
125
+                    $message,
126
+                    PHP_EOL;
127
+            }
128
+            $this->debugLog[] = $cellReference .
129
+                ($this->cellStack->count() > 0 ? ' => ' : '') .
130
+                $message;
131
+        }
132
+    }
133
+
134
+    /**
135
+     * Clear the calculation engine debug log
136
+     */
137
+    public function clearLog()
138
+    {
139
+        $this->debugLog = array();
140
+    }
141
+
142
+    /**
143
+     * Return the calculation engine debug log
144
+     *
145
+     * @return  string[]
146
+     */
147
+    public function getLog()
148
+    {
149
+        return $this->debugLog;
150
+    }
151
+}

+ 4391
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation.php
File diff suppressed because it is too large
View File


+ 676
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Database.php View File

@@ -0,0 +1,676 @@
1
+<?php
2
+
3
+/** PHPExcel root directory */
4
+if (!defined('PHPEXCEL_ROOT')) {
5
+    /**
6
+     * @ignore
7
+     */
8
+    define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
9
+    require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
10
+}
11
+
12
+/**
13
+ * PHPExcel_Calculation_Database
14
+ *
15
+ * Copyright (c) 2006 - 2015 PHPExcel
16
+ *
17
+ * This library is free software; you can redistribute it and/or
18
+ * modify it under the terms of the GNU Lesser General Public
19
+ * License as published by the Free Software Foundation; either
20
+ * version 2.1 of the License, or (at your option) any later version.
21
+ *
22
+ * This library is distributed in the hope that it will be useful,
23
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
24
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
25
+ * Lesser General Public License for more details.
26
+ *
27
+ * You should have received a copy of the GNU Lesser General Public
28
+ * License along with this library; if not, write to the Free Software
29
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
30
+ *
31
+ * @category    PHPExcel
32
+ * @package        PHPExcel_Calculation
33
+ * @copyright    Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
34
+ * @license        http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
35
+ * @version        ##VERSION##, ##DATE##
36
+ */
37
+class PHPExcel_Calculation_Database
38
+{
39
+    /**
40
+     * fieldExtract
41
+     *
42
+     * Extracts the column ID to use for the data field.
43
+     *
44
+     * @access    private
45
+     * @param    mixed[]        $database        The range of cells that makes up the list or database.
46
+     *                                        A database is a list of related data in which rows of related
47
+     *                                        information are records, and columns of data are fields. The
48
+     *                                        first row of the list contains labels for each column.
49
+     * @param    mixed        $field            Indicates which column is used in the function. Enter the
50
+     *                                        column label enclosed between double quotation marks, such as
51
+     *                                        "Age" or "Yield," or a number (without quotation marks) that
52
+     *                                        represents the position of the column within the list: 1 for
53
+     *                                        the first column, 2 for the second column, and so on.
54
+     * @return    string|NULL
55
+     *
56
+     */
57
+    private static function fieldExtract($database, $field)
58
+    {
59
+        $field = strtoupper(PHPExcel_Calculation_Functions::flattenSingleValue($field));
60
+        $fieldNames = array_map('strtoupper', array_shift($database));
61
+
62
+        if (is_numeric($field)) {
63
+            $keys = array_keys($fieldNames);
64
+            return $keys[$field-1];
65
+        }
66
+        $key = array_search($field, $fieldNames);
67
+        return ($key) ? $key : null;
68
+    }
69
+
70
+    /**
71
+     * filter
72
+     *
73
+     * Parses the selection criteria, extracts the database rows that match those criteria, and
74
+     * returns that subset of rows.
75
+     *
76
+     * @access    private
77
+     * @param    mixed[]        $database        The range of cells that makes up the list or database.
78
+     *                                        A database is a list of related data in which rows of related
79
+     *                                        information are records, and columns of data are fields. The
80
+     *                                        first row of the list contains labels for each column.
81
+     * @param    mixed[]        $criteria        The range of cells that contains the conditions you specify.
82
+     *                                        You can use any range for the criteria argument, as long as it
83
+     *                                        includes at least one column label and at least one cell below
84
+     *                                        the column label in which you specify a condition for the
85
+     *                                        column.
86
+     * @return    array of mixed
87
+     *
88
+     */
89
+    private static function filter($database, $criteria)
90
+    {
91
+        $fieldNames = array_shift($database);
92
+        $criteriaNames = array_shift($criteria);
93
+
94
+        //    Convert the criteria into a set of AND/OR conditions with [:placeholders]
95
+        $testConditions = $testValues = array();
96
+        $testConditionsCount = 0;
97
+        foreach ($criteriaNames as $key => $criteriaName) {
98
+            $testCondition = array();
99
+            $testConditionCount = 0;
100
+            foreach ($criteria as $row => $criterion) {
101
+                if ($criterion[$key] > '') {
102
+                    $testCondition[] = '[:'.$criteriaName.']'.PHPExcel_Calculation_Functions::ifCondition($criterion[$key]);
103
+                    $testConditionCount++;
104
+                }
105
+            }
106
+            if ($testConditionCount > 1) {
107
+                $testConditions[] = 'OR(' . implode(',', $testCondition) . ')';
108
+                $testConditionsCount++;
109
+            } elseif ($testConditionCount == 1) {
110
+                $testConditions[] = $testCondition[0];
111
+                $testConditionsCount++;
112
+            }
113
+        }
114
+
115
+        if ($testConditionsCount > 1) {
116
+            $testConditionSet = 'AND(' . implode(',', $testConditions) . ')';
117
+        } elseif ($testConditionsCount == 1) {
118
+            $testConditionSet = $testConditions[0];
119
+        }
120
+
121
+        //    Loop through each row of the database
122
+        foreach ($database as $dataRow => $dataValues) {
123
+            //    Substitute actual values from the database row for our [:placeholders]
124
+            $testConditionList = $testConditionSet;
125
+            foreach ($criteriaNames as $key => $criteriaName) {
126
+                $k = array_search($criteriaName, $fieldNames);
127
+                if (isset($dataValues[$k])) {
128
+                    $dataValue = $dataValues[$k];
129
+                    $dataValue = (is_string($dataValue)) ? PHPExcel_Calculation::wrapResult(strtoupper($dataValue)) : $dataValue;
130
+                    $testConditionList = str_replace('[:' . $criteriaName . ']', $dataValue, $testConditionList);
131
+                }
132
+            }
133
+            //    evaluate the criteria against the row data
134
+            $result = PHPExcel_Calculation::getInstance()->_calculateFormulaValue('='.$testConditionList);
135
+            //    If the row failed to meet the criteria, remove it from the database
136
+            if (!$result) {
137
+                unset($database[$dataRow]);
138
+            }
139
+        }
140
+
141
+        return $database;
142
+    }
143
+
144
+
145
+    private static function getFilteredColumn($database, $field, $criteria)
146
+    {
147
+        //    reduce the database to a set of rows that match all the criteria
148
+        $database = self::filter($database, $criteria);
149
+        //    extract an array of values for the requested column
150
+        $colData = array();
151
+        foreach ($database as $row) {
152
+            $colData[] = $row[$field];
153
+        }
154
+        
155
+        return $colData;
156
+    }
157
+
158
+    /**
159
+     * DAVERAGE
160
+     *
161
+     * Averages the values in a column of a list or database that match conditions you specify.
162
+     *
163
+     * Excel Function:
164
+     *        DAVERAGE(database,field,criteria)
165
+     *
166
+     * @access    public
167
+     * @category Database Functions
168
+     * @param    mixed[]            $database    The range of cells that makes up the list or database.
169
+     *                                        A database is a list of related data in which rows of related
170
+     *                                        information are records, and columns of data are fields. The
171
+     *                                        first row of the list contains labels for each column.
172
+     * @param    string|integer    $field        Indicates which column is used in the function. Enter the
173
+     *                                        column label enclosed between double quotation marks, such as
174
+     *                                        "Age" or "Yield," or a number (without quotation marks) that
175
+     *                                        represents the position of the column within the list: 1 for
176
+     *                                        the first column, 2 for the second column, and so on.
177
+     * @param    mixed[]            $criteria    The range of cells that contains the conditions you specify.
178
+     *                                        You can use any range for the criteria argument, as long as it
179
+     *                                        includes at least one column label and at least one cell below
180
+     *                                        the column label in which you specify a condition for the
181
+     *                                        column.
182
+     * @return    float
183
+     *
184
+     */
185
+    public static function DAVERAGE($database, $field, $criteria)
186
+    {
187
+        $field = self::fieldExtract($database, $field);
188
+        if (is_null($field)) {
189
+            return null;
190
+        }
191
+
192
+        // Return
193
+        return PHPExcel_Calculation_Statistical::AVERAGE(
194
+            self::getFilteredColumn($database, $field, $criteria)
195
+        );
196
+    }
197
+
198
+
199
+    /**
200
+     * DCOUNT
201
+     *
202
+     * Counts the cells that contain numbers in a column of a list or database that match conditions
203
+     * that you specify.
204
+     *
205
+     * Excel Function:
206
+     *        DCOUNT(database,[field],criteria)
207
+     *
208
+     * Excel Function:
209
+     *        DAVERAGE(database,field,criteria)
210
+     *
211
+     * @access    public
212
+     * @category Database Functions
213
+     * @param    mixed[]            $database    The range of cells that makes up the list or database.
214
+     *                                        A database is a list of related data in which rows of related
215
+     *                                        information are records, and columns of data are fields. The
216
+     *                                        first row of the list contains labels for each column.
217
+     * @param    string|integer    $field        Indicates which column is used in the function. Enter the
218
+     *                                        column label enclosed between double quotation marks, such as
219
+     *                                        "Age" or "Yield," or a number (without quotation marks) that
220
+     *                                        represents the position of the column within the list: 1 for
221
+     *                                        the first column, 2 for the second column, and so on.
222
+     * @param    mixed[]            $criteria    The range of cells that contains the conditions you specify.
223
+     *                                        You can use any range for the criteria argument, as long as it
224
+     *                                        includes at least one column label and at least one cell below
225
+     *                                        the column label in which you specify a condition for the
226
+     *                                        column.
227
+     * @return    integer
228
+     *
229
+     * @TODO    The field argument is optional. If field is omitted, DCOUNT counts all records in the
230
+     *            database that match the criteria.
231
+     *
232
+     */
233
+    public static function DCOUNT($database, $field, $criteria)
234
+    {
235
+        $field = self::fieldExtract($database, $field);
236
+        if (is_null($field)) {
237
+            return null;
238
+        }
239
+
240
+        // Return
241
+        return PHPExcel_Calculation_Statistical::COUNT(
242
+            self::getFilteredColumn($database, $field, $criteria)
243
+        );
244
+    }
245
+
246
+
247
+    /**
248
+     * DCOUNTA
249
+     *
250
+     * Counts the nonblank cells in a column of a list or database that match conditions that you specify.
251
+     *
252
+     * Excel Function:
253
+     *        DCOUNTA(database,[field],criteria)
254
+     *
255
+     * @access    public
256
+     * @category Database Functions
257
+     * @param    mixed[]            $database    The range of cells that makes up the list or database.
258
+     *                                        A database is a list of related data in which rows of related
259
+     *                                        information are records, and columns of data are fields. The
260
+     *                                        first row of the list contains labels for each column.
261
+     * @param    string|integer    $field        Indicates which column is used in the function. Enter the
262
+     *                                        column label enclosed between double quotation marks, such as
263
+     *                                        "Age" or "Yield," or a number (without quotation marks) that
264
+     *                                        represents the position of the column within the list: 1 for
265
+     *                                        the first column, 2 for the second column, and so on.
266
+     * @param    mixed[]            $criteria    The range of cells that contains the conditions you specify.
267
+     *                                        You can use any range for the criteria argument, as long as it
268
+     *                                        includes at least one column label and at least one cell below
269
+     *                                        the column label in which you specify a condition for the
270
+     *                                        column.
271
+     * @return    integer
272
+     *
273
+     * @TODO    The field argument is optional. If field is omitted, DCOUNTA counts all records in the
274
+     *            database that match the criteria.
275
+     *
276
+     */
277
+    public static function DCOUNTA($database, $field, $criteria)
278
+    {
279
+        $field = self::fieldExtract($database, $field);
280
+        if (is_null($field)) {
281
+            return null;
282
+        }
283
+
284
+        //    reduce the database to a set of rows that match all the criteria
285
+        $database = self::filter($database, $criteria);
286
+        //    extract an array of values for the requested column
287
+        $colData = array();
288
+        foreach ($database as $row) {
289
+            $colData[] = $row[$field];
290
+        }
291
+
292
+        // Return
293
+        return PHPExcel_Calculation_Statistical::COUNTA(
294
+            self::getFilteredColumn($database, $field, $criteria)
295
+        );
296
+    }
297
+
298
+
299
+    /**
300
+     * DGET
301
+     *
302
+     * Extracts a single value from a column of a list or database that matches conditions that you
303
+     * specify.
304
+     *
305
+     * Excel Function:
306
+     *        DGET(database,field,criteria)
307
+     *
308
+     * @access    public
309
+     * @category Database Functions
310
+     * @param    mixed[]            $database    The range of cells that makes up the list or database.
311
+     *                                        A database is a list of related data in which rows of related
312
+     *                                        information are records, and columns of data are fields. The
313
+     *                                        first row of the list contains labels for each column.
314
+     * @param    string|integer    $field        Indicates which column is used in the function. Enter the
315
+     *                                        column label enclosed between double quotation marks, such as
316
+     *                                        "Age" or "Yield," or a number (without quotation marks) that
317
+     *                                        represents the position of the column within the list: 1 for
318
+     *                                        the first column, 2 for the second column, and so on.
319
+     * @param    mixed[]            $criteria    The range of cells that contains the conditions you specify.
320
+     *                                        You can use any range for the criteria argument, as long as it
321
+     *                                        includes at least one column label and at least one cell below
322
+     *                                        the column label in which you specify a condition for the
323
+     *                                        column.
324
+     * @return    mixed
325
+     *
326
+     */
327
+    public static function DGET($database, $field, $criteria)
328
+    {
329
+        $field = self::fieldExtract($database, $field);
330
+        if (is_null($field)) {
331
+            return null;
332
+        }
333
+
334
+        // Return
335
+        $colData = self::getFilteredColumn($database, $field, $criteria);
336
+        if (count($colData) > 1) {
337
+            return PHPExcel_Calculation_Functions::NaN();
338
+        }
339
+
340
+        return $colData[0];
341
+    }
342
+
343
+
344
+    /**
345
+     * DMAX
346
+     *
347
+     * Returns the largest number in a column of a list or database that matches conditions you that
348
+     * specify.
349
+     *
350
+     * Excel Function:
351
+     *        DMAX(database,field,criteria)
352
+     *
353
+     * @access    public
354
+     * @category Database Functions
355
+     * @param    mixed[]            $database    The range of cells that makes up the list or database.
356
+     *                                        A database is a list of related data in which rows of related
357
+     *                                        information are records, and columns of data are fields. The
358
+     *                                        first row of the list contains labels for each column.
359
+     * @param    string|integer    $field        Indicates which column is used in the function. Enter the
360
+     *                                        column label enclosed between double quotation marks, such as
361
+     *                                        "Age" or "Yield," or a number (without quotation marks) that
362
+     *                                        represents the position of the column within the list: 1 for
363
+     *                                        the first column, 2 for the second column, and so on.
364
+     * @param    mixed[]            $criteria    The range of cells that contains the conditions you specify.
365
+     *                                        You can use any range for the criteria argument, as long as it
366
+     *                                        includes at least one column label and at least one cell below
367
+     *                                        the column label in which you specify a condition for the
368
+     *                                        column.
369
+     * @return    float
370
+     *
371
+     */
372
+    public static function DMAX($database, $field, $criteria)
373
+    {
374
+        $field = self::fieldExtract($database, $field);
375
+        if (is_null($field)) {
376
+            return null;
377
+        }
378
+
379
+        // Return
380
+        return PHPExcel_Calculation_Statistical::MAX(
381
+            self::getFilteredColumn($database, $field, $criteria)
382
+        );
383
+    }
384
+
385
+
386
+    /**
387
+     * DMIN
388
+     *
389
+     * Returns the smallest number in a column of a list or database that matches conditions you that
390
+     * specify.
391
+     *
392
+     * Excel Function:
393
+     *        DMIN(database,field,criteria)
394
+     *
395
+     * @access    public
396
+     * @category Database Functions
397
+     * @param    mixed[]            $database    The range of cells that makes up the list or database.
398
+     *                                        A database is a list of related data in which rows of related
399
+     *                                        information are records, and columns of data are fields. The
400
+     *                                        first row of the list contains labels for each column.
401
+     * @param    string|integer    $field        Indicates which column is used in the function. Enter the
402
+     *                                        column label enclosed between double quotation marks, such as
403
+     *                                        "Age" or "Yield," or a number (without quotation marks) that
404
+     *                                        represents the position of the column within the list: 1 for
405
+     *                                        the first column, 2 for the second column, and so on.
406
+     * @param    mixed[]            $criteria    The range of cells that contains the conditions you specify.
407
+     *                                        You can use any range for the criteria argument, as long as it
408
+     *                                        includes at least one column label and at least one cell below
409
+     *                                        the column label in which you specify a condition for the
410
+     *                                        column.
411
+     * @return    float
412
+     *
413
+     */
414
+    public static function DMIN($database, $field, $criteria)
415
+    {
416
+        $field = self::fieldExtract($database, $field);
417
+        if (is_null($field)) {
418
+            return null;
419
+        }
420
+
421
+        // Return
422
+        return PHPExcel_Calculation_Statistical::MIN(
423
+            self::getFilteredColumn($database, $field, $criteria)
424
+        );
425
+    }
426
+
427
+
428
+    /**
429
+     * DPRODUCT
430
+     *
431
+     * Multiplies the values in a column of a list or database that match conditions that you specify.
432
+     *
433
+     * Excel Function:
434
+     *        DPRODUCT(database,field,criteria)
435
+     *
436
+     * @access    public
437
+     * @category Database Functions
438
+     * @param    mixed[]            $database    The range of cells that makes up the list or database.
439
+     *                                        A database is a list of related data in which rows of related
440
+     *                                        information are records, and columns of data are fields. The
441
+     *                                        first row of the list contains labels for each column.
442
+     * @param    string|integer    $field        Indicates which column is used in the function. Enter the
443
+     *                                        column label enclosed between double quotation marks, such as
444
+     *                                        "Age" or "Yield," or a number (without quotation marks) that
445
+     *                                        represents the position of the column within the list: 1 for
446
+     *                                        the first column, 2 for the second column, and so on.
447
+     * @param    mixed[]            $criteria    The range of cells that contains the conditions you specify.
448
+     *                                        You can use any range for the criteria argument, as long as it
449
+     *                                        includes at least one column label and at least one cell below
450
+     *                                        the column label in which you specify a condition for the
451
+     *                                        column.
452
+     * @return    float
453
+     *
454
+     */
455
+    public static function DPRODUCT($database, $field, $criteria)
456
+    {
457
+        $field = self::fieldExtract($database, $field);
458
+        if (is_null($field)) {
459
+            return null;
460
+        }
461
+
462
+        // Return
463
+        return PHPExcel_Calculation_MathTrig::PRODUCT(
464
+            self::getFilteredColumn($database, $field, $criteria)
465
+        );
466
+    }
467
+
468
+
469
+    /**
470
+     * DSTDEV
471
+     *
472
+     * Estimates the standard deviation of a population based on a sample by using the numbers in a
473
+     * column of a list or database that match conditions that you specify.
474
+     *
475
+     * Excel Function:
476
+     *        DSTDEV(database,field,criteria)
477
+     *
478
+     * @access    public
479
+     * @category Database Functions
480
+     * @param    mixed[]            $database    The range of cells that makes up the list or database.
481
+     *                                        A database is a list of related data in which rows of related
482
+     *                                        information are records, and columns of data are fields. The
483
+     *                                        first row of the list contains labels for each column.
484
+     * @param    string|integer    $field        Indicates which column is used in the function. Enter the
485
+     *                                        column label enclosed between double quotation marks, such as
486
+     *                                        "Age" or "Yield," or a number (without quotation marks) that
487
+     *                                        represents the position of the column within the list: 1 for
488
+     *                                        the first column, 2 for the second column, and so on.
489
+     * @param    mixed[]            $criteria    The range of cells that contains the conditions you specify.
490
+     *                                        You can use any range for the criteria argument, as long as it
491
+     *                                        includes at least one column label and at least one cell below
492
+     *                                        the column label in which you specify a condition for the
493
+     *                                        column.
494
+     * @return    float
495
+     *
496
+     */
497
+    public static function DSTDEV($database, $field, $criteria)
498
+    {
499
+        $field = self::fieldExtract($database, $field);
500
+        if (is_null($field)) {
501
+            return null;
502
+        }
503
+
504
+        // Return
505
+        return PHPExcel_Calculation_Statistical::STDEV(
506
+            self::getFilteredColumn($database, $field, $criteria)
507
+        );
508
+    }
509
+
510
+
511
+    /**
512
+     * DSTDEVP
513
+     *
514
+     * Calculates the standard deviation of a population based on the entire population by using the
515
+     * numbers in a column of a list or database that match conditions that you specify.
516
+     *
517
+     * Excel Function:
518
+     *        DSTDEVP(database,field,criteria)
519
+     *
520
+     * @access    public
521
+     * @category Database Functions
522
+     * @param    mixed[]            $database    The range of cells that makes up the list or database.
523
+     *                                        A database is a list of related data in which rows of related
524
+     *                                        information are records, and columns of data are fields. The
525
+     *                                        first row of the list contains labels for each column.
526
+     * @param    string|integer    $field        Indicates which column is used in the function. Enter the
527
+     *                                        column label enclosed between double quotation marks, such as
528
+     *                                        "Age" or "Yield," or a number (without quotation marks) that
529
+     *                                        represents the position of the column within the list: 1 for
530
+     *                                        the first column, 2 for the second column, and so on.
531
+     * @param    mixed[]            $criteria    The range of cells that contains the conditions you specify.
532
+     *                                        You can use any range for the criteria argument, as long as it
533
+     *                                        includes at least one column label and at least one cell below
534
+     *                                        the column label in which you specify a condition for the
535
+     *                                        column.
536
+     * @return    float
537
+     *
538
+     */
539
+    public static function DSTDEVP($database, $field, $criteria)
540
+    {
541
+        $field = self::fieldExtract($database, $field);
542
+        if (is_null($field)) {
543
+            return null;
544
+        }
545
+
546
+        // Return
547
+        return PHPExcel_Calculation_Statistical::STDEVP(
548
+            self::getFilteredColumn($database, $field, $criteria)
549
+        );
550
+    }
551
+
552
+
553
+    /**
554
+     * DSUM
555
+     *
556
+     * Adds the numbers in a column of a list or database that match conditions that you specify.
557
+     *
558
+     * Excel Function:
559
+     *        DSUM(database,field,criteria)
560
+     *
561
+     * @access    public
562
+     * @category Database Functions
563
+     * @param    mixed[]            $database    The range of cells that makes up the list or database.
564
+     *                                        A database is a list of related data in which rows of related
565
+     *                                        information are records, and columns of data are fields. The
566
+     *                                        first row of the list contains labels for each column.
567
+     * @param    string|integer    $field        Indicates which column is used in the function. Enter the
568
+     *                                        column label enclosed between double quotation marks, such as
569
+     *                                        "Age" or "Yield," or a number (without quotation marks) that
570
+     *                                        represents the position of the column within the list: 1 for
571
+     *                                        the first column, 2 for the second column, and so on.
572
+     * @param    mixed[]            $criteria    The range of cells that contains the conditions you specify.
573
+     *                                        You can use any range for the criteria argument, as long as it
574
+     *                                        includes at least one column label and at least one cell below
575
+     *                                        the column label in which you specify a condition for the
576
+     *                                        column.
577
+     * @return    float
578
+     *
579
+     */
580
+    public static function DSUM($database, $field, $criteria)
581
+    {
582
+        $field = self::fieldExtract($database, $field);
583
+        if (is_null($field)) {
584
+            return null;
585
+        }
586
+
587
+        // Return
588
+        return PHPExcel_Calculation_MathTrig::SUM(
589
+            self::getFilteredColumn($database, $field, $criteria)
590
+        );
591
+    }
592
+
593
+
594
+    /**
595
+     * DVAR
596
+     *
597
+     * Estimates the variance of a population based on a sample by using the numbers in a column
598
+     * of a list or database that match conditions that you specify.
599
+     *
600
+     * Excel Function:
601
+     *        DVAR(database,field,criteria)
602
+     *
603
+     * @access    public
604
+     * @category Database Functions
605
+     * @param    mixed[]            $database    The range of cells that makes up the list or database.
606
+     *                                        A database is a list of related data in which rows of related
607
+     *                                        information are records, and columns of data are fields. The
608
+     *                                        first row of the list contains labels for each column.
609
+     * @param    string|integer    $field        Indicates which column is used in the function. Enter the
610
+     *                                        column label enclosed between double quotation marks, such as
611
+     *                                        "Age" or "Yield," or a number (without quotation marks) that
612
+     *                                        represents the position of the column within the list: 1 for
613
+     *                                        the first column, 2 for the second column, and so on.
614
+     * @param    mixed[]            $criteria    The range of cells that contains the conditions you specify.
615
+     *                                        You can use any range for the criteria argument, as long as it
616
+     *                                        includes at least one column label and at least one cell below
617
+     *                                        the column label in which you specify a condition for the
618
+     *                                        column.
619
+     * @return    float
620
+     *
621
+     */
622
+    public static function DVAR($database, $field, $criteria)
623
+    {
624
+        $field = self::fieldExtract($database, $field);
625
+        if (is_null($field)) {
626
+            return null;
627
+        }
628
+
629
+        // Return
630
+        return PHPExcel_Calculation_Statistical::VARFunc(
631
+            self::getFilteredColumn($database, $field, $criteria)
632
+        );
633
+    }
634
+
635
+
636
+    /**
637
+     * DVARP
638
+     *
639
+     * Calculates the variance of a population based on the entire population by using the numbers
640
+     * in a column of a list or database that match conditions that you specify.
641
+     *
642
+     * Excel Function:
643
+     *        DVARP(database,field,criteria)
644
+     *
645
+     * @access    public
646
+     * @category Database Functions
647
+     * @param    mixed[]            $database    The range of cells that makes up the list or database.
648
+     *                                        A database is a list of related data in which rows of related
649
+     *                                        information are records, and columns of data are fields. The
650
+     *                                        first row of the list contains labels for each column.
651
+     * @param    string|integer    $field        Indicates which column is used in the function. Enter the
652
+     *                                        column label enclosed between double quotation marks, such as
653
+     *                                        "Age" or "Yield," or a number (without quotation marks) that
654
+     *                                        represents the position of the column within the list: 1 for
655
+     *                                        the first column, 2 for the second column, and so on.
656
+     * @param    mixed[]            $criteria    The range of cells that contains the conditions you specify.
657
+     *                                        You can use any range for the criteria argument, as long as it
658
+     *                                        includes at least one column label and at least one cell below
659
+     *                                        the column label in which you specify a condition for the
660
+     *                                        column.
661
+     * @return    float
662
+     *
663
+     */
664
+    public static function DVARP($database, $field, $criteria)
665
+    {
666
+        $field = self::fieldExtract($database, $field);
667
+        if (is_null($field)) {
668
+            return null;
669
+        }
670
+
671
+        // Return
672
+        return PHPExcel_Calculation_Statistical::VARP(
673
+            self::getFilteredColumn($database, $field, $criteria)
674
+        );
675
+    }
676
+}

+ 1553
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/DateTime.php
File diff suppressed because it is too large
View File


+ 2650
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Engineering.php
File diff suppressed because it is too large
View File


+ 46
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Exception.php View File

@@ -0,0 +1,46 @@
1
+<?php
2
+
3
+/**
4
+ * PHPExcel_Calculation_Exception
5
+ *
6
+ * Copyright (c) 2006 - 2015 PHPExcel
7
+ *
8
+ * This library is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU Lesser General Public
10
+ * License as published by the Free Software Foundation; either
11
+ * version 2.1 of the License, or (at your option) any later version.
12
+ *
13
+ * This library is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
+ * Lesser General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU Lesser General Public
19
+ * License along with this library; if not, write to the Free Software
20
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21
+ *
22
+ * @category   PHPExcel
23
+ * @package    PHPExcel_Calculation
24
+ * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
25
+ * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
26
+ * @version    ##VERSION##, ##DATE##
27
+ */
28
+class PHPExcel_Calculation_Exception extends PHPExcel_Exception
29
+{
30
+    /**
31
+     * Error handler callback
32
+     *
33
+     * @param mixed $code
34
+     * @param mixed $string
35
+     * @param mixed $file
36
+     * @param mixed $line
37
+     * @param mixed $context
38
+     */
39
+    public static function errorHandlerCallback($code, $string, $file, $line, $context)
40
+    {
41
+        $e = new self($string, $code);
42
+        $e->line = $line;
43
+        $e->file = $file;
44
+        throw $e;
45
+    }
46
+}

+ 45
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/ExceptionHandler.php View File

@@ -0,0 +1,45 @@
1
+<?php
2
+
3
+/**
4
+ * PHPExcel_Calculation_ExceptionHandler
5
+ *
6
+ * Copyright (c) 2006 - 2015 PHPExcel
7
+ *
8
+ * This library is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU Lesser General Public
10
+ * License as published by the Free Software Foundation; either
11
+ * version 2.1 of the License, or (at your option) any later version.
12
+ *
13
+ * This library is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
+ * Lesser General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU Lesser General Public
19
+ * License along with this library; if not, write to the Free Software
20
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21
+ *
22
+ * @category   PHPExcel
23
+ * @package    PHPExcel_Calculation
24
+ * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
25
+ * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
26
+ * @version    ##VERSION##, ##DATE##
27
+ */
28
+class PHPExcel_Calculation_ExceptionHandler
29
+{
30
+    /**
31
+     * Register errorhandler
32
+     */
33
+    public function __construct()
34
+    {
35
+        set_error_handler(array('PHPExcel_Calculation_Exception', 'errorHandlerCallback'), E_ALL);
36
+    }
37
+
38
+    /**
39
+     * Unregister errorhandler
40
+     */
41
+    public function __destruct()
42
+    {
43
+        restore_error_handler();
44
+    }
45
+}

+ 2359
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Financial.php
File diff suppressed because it is too large
View File


+ 622
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/FormulaParser.php View File

@@ -0,0 +1,622 @@
1
+<?php
2
+
3
+/*
4
+PARTLY BASED ON:
5
+    Copyright (c) 2007 E. W. Bachtal, Inc.
6
+
7
+    Permission is hereby granted, free of charge, to any person obtaining a copy of this software
8
+    and associated documentation files (the "Software"), to deal in the Software without restriction,
9
+    including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
+    and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
11
+    subject to the following conditions:
12
+
13
+      The above copyright notice and this permission notice shall be included in all copies or substantial
14
+      portions of the Software.
15
+
16
+    The software is provided "as is", without warranty of any kind, express or implied, including but not
17
+    limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In
18
+    no event shall the authors or copyright holders be liable for any claim, damages or other liability,
19
+    whether in an action of contract, tort or otherwise, arising from, out of or in connection with the
20
+    software or the use or other dealings in the software.
21
+
22
+    http://ewbi.blogs.com/develops/2007/03/excel_formula_p.html
23
+    http://ewbi.blogs.com/develops/2004/12/excel_formula_p.html
24
+*/
25
+
26
+/**
27
+ * PHPExcel_Calculation_FormulaParser
28
+ *
29
+ * Copyright (c) 2006 - 2015 PHPExcel
30
+ *
31
+ * This library is free software; you can redistribute it and/or
32
+ * modify it under the terms of the GNU Lesser General Public
33
+ * License as published by the Free Software Foundation; either
34
+ * version 2.1 of the License, or (at your option) any later version.
35
+ *
36
+ * This library is distributed in the hope that it will be useful,
37
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
38
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
39
+ * Lesser General Public License for more details.
40
+ *
41
+ * You should have received a copy of the GNU Lesser General Public
42
+ * License along with this library; if not, write to the Free Software
43
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
44
+ *
45
+ * @category   PHPExcel
46
+ * @package    PHPExcel_Calculation
47
+ * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
48
+ * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
49
+ * @version    ##VERSION##, ##DATE##
50
+ */
51
+
52
+
53
+class PHPExcel_Calculation_FormulaParser
54
+{
55
+    /* Character constants */
56
+    const QUOTE_DOUBLE  = '"';
57
+    const QUOTE_SINGLE  = '\'';
58
+    const BRACKET_CLOSE = ']';
59
+    const BRACKET_OPEN  = '[';
60
+    const BRACE_OPEN    = '{';
61
+    const BRACE_CLOSE   = '}';
62
+    const PAREN_OPEN    = '(';
63
+    const PAREN_CLOSE   = ')';
64
+    const SEMICOLON     = ';';
65
+    const WHITESPACE    = ' ';
66
+    const COMMA         = ',';
67
+    const ERROR_START   = '#';
68
+
69
+    const OPERATORS_SN             = "+-";
70
+    const OPERATORS_INFIX         = "+-*/^&=><";
71
+    const OPERATORS_POSTFIX     = "%";
72
+
73
+    /**
74
+     * Formula
75
+     *
76
+     * @var string
77
+     */
78
+    private $formula;
79
+
80
+    /**
81
+     * Tokens
82
+     *
83
+     * @var PHPExcel_Calculation_FormulaToken[]
84
+     */
85
+    private $tokens = array();
86
+
87
+    /**
88
+     * Create a new PHPExcel_Calculation_FormulaParser
89
+     *
90
+     * @param     string        $pFormula    Formula to parse
91
+     * @throws     PHPExcel_Calculation_Exception
92
+     */
93
+    public function __construct($pFormula = '')
94
+    {
95
+        // Check parameters
96
+        if (is_null($pFormula)) {
97
+            throw new PHPExcel_Calculation_Exception("Invalid parameter passed: formula");
98
+        }
99
+
100
+        // Initialise values
101
+        $this->formula = trim($pFormula);
102
+        // Parse!
103
+        $this->parseToTokens();
104
+    }
105
+
106
+    /**
107
+     * Get Formula
108
+     *
109
+     * @return string
110
+     */
111
+    public function getFormula()
112
+    {
113
+        return $this->formula;
114
+    }
115
+
116
+    /**
117
+     * Get Token
118
+     *
119
+     * @param     int        $pId    Token id
120
+     * @return    string
121
+     * @throws  PHPExcel_Calculation_Exception
122
+     */
123
+    public function getToken($pId = 0)
124
+    {
125
+        if (isset($this->tokens[$pId])) {
126
+            return $this->tokens[$pId];
127
+        } else {
128
+            throw new PHPExcel_Calculation_Exception("Token with id $pId does not exist.");
129
+        }
130
+    }
131
+
132
+    /**
133
+     * Get Token count
134
+     *
135
+     * @return string
136
+     */
137
+    public function getTokenCount()
138
+    {
139
+        return count($this->tokens);
140
+    }
141
+
142
+    /**
143
+     * Get Tokens
144
+     *
145
+     * @return PHPExcel_Calculation_FormulaToken[]
146
+     */
147
+    public function getTokens()
148
+    {
149
+        return $this->tokens;
150
+    }
151
+
152
+    /**
153
+     * Parse to tokens
154
+     */
155
+    private function parseToTokens()
156
+    {
157
+        // No attempt is made to verify formulas; assumes formulas are derived from Excel, where
158
+        // they can only exist if valid; stack overflows/underflows sunk as nulls without exceptions.
159
+
160
+        // Check if the formula has a valid starting =
161
+        $formulaLength = strlen($this->formula);
162
+        if ($formulaLength < 2 || $this->formula{0} != '=') {
163
+            return;
164
+        }
165
+
166
+        // Helper variables
167
+        $tokens1    = $tokens2     = $stack = array();
168
+        $inString    = $inPath     = $inRange     = $inError = false;
169
+        $token        = $previousToken    = $nextToken    = null;
170
+
171
+        $index    = 1;
172
+        $value    = '';
173
+
174
+        $ERRORS             = array("#NULL!", "#DIV/0!", "#VALUE!", "#REF!", "#NAME?", "#NUM!", "#N/A");
175
+        $COMPARATORS_MULTI     = array(">=", "<=", "<>");
176
+
177
+        while ($index < $formulaLength) {
178
+            // state-dependent character evaluation (order is important)
179
+
180
+            // double-quoted strings
181
+            // embeds are doubled
182
+            // end marks token
183
+            if ($inString) {
184
+                if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::QUOTE_DOUBLE) {
185
+                    if ((($index + 2) <= $formulaLength) && ($this->formula{$index + 1} == PHPExcel_Calculation_FormulaParser::QUOTE_DOUBLE)) {
186
+                        $value .= PHPExcel_Calculation_FormulaParser::QUOTE_DOUBLE;
187
+                        ++$index;
188
+                    } else {
189
+                        $inString = false;
190
+                        $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_TEXT);
191
+                        $value = "";
192
+                    }
193
+                } else {
194
+                    $value .= $this->formula{$index};
195
+                }
196
+                ++$index;
197
+                continue;
198
+            }
199
+
200
+            // single-quoted strings (links)
201
+            // embeds are double
202
+            // end does not mark a token
203
+            if ($inPath) {
204
+                if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::QUOTE_SINGLE) {
205
+                    if ((($index + 2) <= $formulaLength) && ($this->formula{$index + 1} == PHPExcel_Calculation_FormulaParser::QUOTE_SINGLE)) {
206
+                        $value .= PHPExcel_Calculation_FormulaParser::QUOTE_SINGLE;
207
+                        ++$index;
208
+                    } else {
209
+                        $inPath = false;
210
+                    }
211
+                } else {
212
+                    $value .= $this->formula{$index};
213
+                }
214
+                ++$index;
215
+                continue;
216
+            }
217
+
218
+            // bracked strings (R1C1 range index or linked workbook name)
219
+            // no embeds (changed to "()" by Excel)
220
+            // end does not mark a token
221
+            if ($inRange) {
222
+                if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::BRACKET_CLOSE) {
223
+                    $inRange = false;
224
+                }
225
+                $value .= $this->formula{$index};
226
+                ++$index;
227
+                continue;
228
+            }
229
+
230
+            // error values
231
+            // end marks a token, determined from absolute list of values
232
+            if ($inError) {
233
+                $value .= $this->formula{$index};
234
+                ++$index;
235
+                if (in_array($value, $ERRORS)) {
236
+                    $inError = false;
237
+                    $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_ERROR);
238
+                    $value = "";
239
+                }
240
+                continue;
241
+            }
242
+
243
+            // scientific notation check
244
+            if (strpos(PHPExcel_Calculation_FormulaParser::OPERATORS_SN, $this->formula{$index}) !== false) {
245
+                if (strlen($value) > 1) {
246
+                    if (preg_match("/^[1-9]{1}(\.[0-9]+)?E{1}$/", $this->formula{$index}) != 0) {
247
+                        $value .= $this->formula{$index};
248
+                        ++$index;
249
+                        continue;
250
+                    }
251
+                }
252
+            }
253
+
254
+            // independent character evaluation (order not important)
255
+
256
+            // establish state-dependent character evaluations
257
+            if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::QUOTE_DOUBLE) {
258
+                if (strlen($value > 0)) {
259
+                    // unexpected
260
+                    $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN);
261
+                    $value = "";
262
+                }
263
+                $inString = true;
264
+                ++$index;
265
+                continue;
266
+            }
267
+
268
+            if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::QUOTE_SINGLE) {
269
+                if (strlen($value) > 0) {
270
+                    // unexpected
271
+                    $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN);
272
+                    $value = "";
273
+                }
274
+                $inPath = true;
275
+                ++$index;
276
+                continue;
277
+            }
278
+
279
+            if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::BRACKET_OPEN) {
280
+                $inRange = true;
281
+                $value .= PHPExcel_Calculation_FormulaParser::BRACKET_OPEN;
282
+                ++$index;
283
+                continue;
284
+            }
285
+
286
+            if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::ERROR_START) {
287
+                if (strlen($value) > 0) {
288
+                    // unexpected
289
+                    $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN);
290
+                    $value = "";
291
+                }
292
+                $inError = true;
293
+                $value .= PHPExcel_Calculation_FormulaParser::ERROR_START;
294
+                ++$index;
295
+                continue;
296
+            }
297
+
298
+            // mark start and end of arrays and array rows
299
+            if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::BRACE_OPEN) {
300
+                if (strlen($value) > 0) {
301
+                    // unexpected
302
+                    $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN);
303
+                    $value = "";
304
+                }
305
+
306
+                $tmp = new PHPExcel_Calculation_FormulaToken("ARRAY", PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_START);
307
+                $tokens1[] = $tmp;
308
+                $stack[] = clone $tmp;
309
+
310
+                $tmp = new PHPExcel_Calculation_FormulaToken("ARRAYROW", PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_START);
311
+                $tokens1[] = $tmp;
312
+                $stack[] = clone $tmp;
313
+
314
+                ++$index;
315
+                continue;
316
+            }
317
+
318
+            if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::SEMICOLON) {
319
+                if (strlen($value) > 0) {
320
+                    $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND);
321
+                    $value = "";
322
+                }
323
+
324
+                $tmp = array_pop($stack);
325
+                $tmp->setValue("");
326
+                $tmp->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP);
327
+                $tokens1[] = $tmp;
328
+
329
+                $tmp = new PHPExcel_Calculation_FormulaToken(",", PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_ARGUMENT);
330
+                $tokens1[] = $tmp;
331
+
332
+                $tmp = new PHPExcel_Calculation_FormulaToken("ARRAYROW", PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_START);
333
+                $tokens1[] = $tmp;
334
+                $stack[] = clone $tmp;
335
+
336
+                ++$index;
337
+                continue;
338
+            }
339
+
340
+            if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::BRACE_CLOSE) {
341
+                if (strlen($value) > 0) {
342
+                    $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND);
343
+                    $value = "";
344
+                }
345
+
346
+                $tmp = array_pop($stack);
347
+                $tmp->setValue("");
348
+                $tmp->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP);
349
+                $tokens1[] = $tmp;
350
+
351
+                $tmp = array_pop($stack);
352
+                $tmp->setValue("");
353
+                $tmp->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP);
354
+                $tokens1[] = $tmp;
355
+
356
+                ++$index;
357
+                continue;
358
+            }
359
+
360
+            // trim white-space
361
+            if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::WHITESPACE) {
362
+                if (strlen($value) > 0) {
363
+                    $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND);
364
+                    $value = "";
365
+                }
366
+                $tokens1[] = new PHPExcel_Calculation_FormulaToken("", PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_WHITESPACE);
367
+                ++$index;
368
+                while (($this->formula{$index} == PHPExcel_Calculation_FormulaParser::WHITESPACE) && ($index < $formulaLength)) {
369
+                    ++$index;
370
+                }
371
+                continue;
372
+            }
373
+
374
+            // multi-character comparators
375
+            if (($index + 2) <= $formulaLength) {
376
+                if (in_array(substr($this->formula, $index, 2), $COMPARATORS_MULTI)) {
377
+                    if (strlen($value) > 0) {
378
+                        $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND);
379
+                        $value = "";
380
+                    }
381
+                    $tokens1[] = new PHPExcel_Calculation_FormulaToken(substr($this->formula, $index, 2), PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORINFIX, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_LOGICAL);
382
+                    $index += 2;
383
+                    continue;
384
+                }
385
+            }
386
+
387
+            // standard infix operators
388
+            if (strpos(PHPExcel_Calculation_FormulaParser::OPERATORS_INFIX, $this->formula{$index}) !== false) {
389
+                if (strlen($value) > 0) {
390
+                    $tokens1[] =new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND);
391
+                    $value = "";
392
+                }
393
+                $tokens1[] = new PHPExcel_Calculation_FormulaToken($this->formula{$index}, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORINFIX);
394
+                ++$index;
395
+                continue;
396
+            }
397
+
398
+            // standard postfix operators (only one)
399
+            if (strpos(PHPExcel_Calculation_FormulaParser::OPERATORS_POSTFIX, $this->formula{$index}) !== false) {
400
+                if (strlen($value) > 0) {
401
+                    $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND);
402
+                    $value = "";
403
+                }
404
+                $tokens1[] = new PHPExcel_Calculation_FormulaToken($this->formula{$index}, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORPOSTFIX);
405
+                ++$index;
406
+                continue;
407
+            }
408
+
409
+            // start subexpression or function
410
+            if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::PAREN_OPEN) {
411
+                if (strlen($value) > 0) {
412
+                    $tmp = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_START);
413
+                    $tokens1[] = $tmp;
414
+                    $stack[] = clone $tmp;
415
+                    $value = "";
416
+                } else {
417
+                    $tmp = new PHPExcel_Calculation_FormulaToken("", PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_SUBEXPRESSION, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_START);
418
+                    $tokens1[] = $tmp;
419
+                    $stack[] = clone $tmp;
420
+                }
421
+                ++$index;
422
+                continue;
423
+            }
424
+
425
+            // function, subexpression, or array parameters, or operand unions
426
+            if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::COMMA) {
427
+                if (strlen($value) > 0) {
428
+                    $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND);
429
+                    $value = "";
430
+                }
431
+
432
+                $tmp = array_pop($stack);
433
+                $tmp->setValue("");
434
+                $tmp->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP);
435
+                $stack[] = $tmp;
436
+
437
+                if ($tmp->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION) {
438
+                    $tokens1[] = new PHPExcel_Calculation_FormulaToken(",", PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORINFIX, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_UNION);
439
+                } else {
440
+                    $tokens1[] = new PHPExcel_Calculation_FormulaToken(",", PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_ARGUMENT);
441
+                }
442
+                ++$index;
443
+                continue;
444
+            }
445
+
446
+            // stop subexpression
447
+            if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::PAREN_CLOSE) {
448
+                if (strlen($value) > 0) {
449
+                    $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND);
450
+                    $value = "";
451
+                }
452
+
453
+                $tmp = array_pop($stack);
454
+                $tmp->setValue("");
455
+                $tmp->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP);
456
+                $tokens1[] = $tmp;
457
+
458
+                ++$index;
459
+                continue;
460
+            }
461
+
462
+            // token accumulation
463
+            $value .= $this->formula{$index};
464
+            ++$index;
465
+        }
466
+
467
+        // dump remaining accumulation
468
+        if (strlen($value) > 0) {
469
+            $tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND);
470
+        }
471
+
472
+        // move tokenList to new set, excluding unnecessary white-space tokens and converting necessary ones to intersections
473
+        $tokenCount = count($tokens1);
474
+        for ($i = 0; $i < $tokenCount; ++$i) {
475
+            $token = $tokens1[$i];
476
+            if (isset($tokens1[$i - 1])) {
477
+                $previousToken = $tokens1[$i - 1];
478
+            } else {
479
+                $previousToken = null;
480
+            }
481
+            if (isset($tokens1[$i + 1])) {
482
+                $nextToken = $tokens1[$i + 1];
483
+            } else {
484
+                $nextToken = null;
485
+            }
486
+
487
+            if (is_null($token)) {
488
+                continue;
489
+            }
490
+
491
+            if ($token->getTokenType() != PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_WHITESPACE) {
492
+                $tokens2[] = $token;
493
+                continue;
494
+            }
495
+
496
+            if (is_null($previousToken)) {
497
+                continue;
498
+            }
499
+
500
+            if (! (
501
+                    (($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION) && ($previousToken->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP)) ||
502
+                    (($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_SUBEXPRESSION) && ($previousToken->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP)) ||
503
+                    ($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND)
504
+                  ) ) {
505
+                continue;
506
+            }
507
+
508
+            if (is_null($nextToken)) {
509
+                continue;
510
+            }
511
+
512
+            if (! (
513
+                    (($nextToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION) && ($nextToken->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_START)) ||
514
+                    (($nextToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_SUBEXPRESSION) && ($nextToken->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_START)) ||
515
+                    ($nextToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND)
516
+                  ) ) {
517
+                continue;
518
+            }
519
+
520
+            $tokens2[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORINFIX, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_INTERSECTION);
521
+        }
522
+
523
+        // move tokens to final list, switching infix "-" operators to prefix when appropriate, switching infix "+" operators
524
+        // to noop when appropriate, identifying operand and infix-operator subtypes, and pulling "@" from function names
525
+        $this->tokens = array();
526
+
527
+        $tokenCount = count($tokens2);
528
+        for ($i = 0; $i < $tokenCount; ++$i) {
529
+            $token = $tokens2[$i];
530
+            if (isset($tokens2[$i - 1])) {
531
+                $previousToken = $tokens2[$i - 1];
532
+            } else {
533
+                $previousToken = null;
534
+            }
535
+            if (isset($tokens2[$i + 1])) {
536
+                $nextToken = $tokens2[$i + 1];
537
+            } else {
538
+                $nextToken = null;
539
+            }
540
+
541
+            if (is_null($token)) {
542
+                continue;
543
+            }
544
+
545
+            if ($token->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORINFIX && $token->getValue() == "-") {
546
+                if ($i == 0) {
547
+                    $token->setTokenType(PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORPREFIX);
548
+                } elseif ((($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION) &&
549
+                    ($previousToken->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP)) ||
550
+                    (($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_SUBEXPRESSION) &&
551
+                    ($previousToken->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP)) ||
552
+                    ($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORPOSTFIX) ||
553
+                    ($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND)) {
554
+                    $token->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_MATH);
555
+                } else {
556
+                    $token->setTokenType(PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORPREFIX);
557
+                }
558
+
559
+                $this->tokens[] = $token;
560
+                continue;
561
+            }
562
+
563
+            if ($token->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORINFIX && $token->getValue() == "+") {
564
+                if ($i == 0) {
565
+                    continue;
566
+                } elseif ((($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION) &&
567
+                    ($previousToken->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP)) ||
568
+                    (($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_SUBEXPRESSION) &&
569
+                    ($previousToken->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP)) ||
570
+                    ($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORPOSTFIX) ||
571
+                    ($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND)) {
572
+                    $token->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_MATH);
573
+                } else {
574
+                    continue;
575
+                }
576
+
577
+                $this->tokens[] = $token;
578
+                continue;
579
+            }
580
+
581
+            if ($token->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORINFIX &&
582
+                $token->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_NOTHING) {
583
+                if (strpos("<>=", substr($token->getValue(), 0, 1)) !== false) {
584
+                    $token->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_LOGICAL);
585
+                } elseif ($token->getValue() == "&") {
586
+                    $token->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_CONCATENATION);
587
+                } else {
588
+                    $token->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_MATH);
589
+                }
590
+
591
+                $this->tokens[] = $token;
592
+                continue;
593
+            }
594
+
595
+            if ($token->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND &&
596
+                $token->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_NOTHING) {
597
+                if (!is_numeric($token->getValue())) {
598
+                    if (strtoupper($token->getValue()) == "TRUE" || strtoupper($token->getValue() == "FALSE")) {
599
+                        $token->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_LOGICAL);
600
+                    } else {
601
+                        $token->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_RANGE);
602
+                    }
603
+                } else {
604
+                    $token->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_NUMBER);
605
+                }
606
+
607
+                $this->tokens[] = $token;
608
+                continue;
609
+            }
610
+
611
+            if ($token->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION) {
612
+                if (strlen($token->getValue() > 0)) {
613
+                    if (substr($token->getValue(), 0, 1) == "@") {
614
+                        $token->setValue(substr($token->getValue(), 1));
615
+                    }
616
+                }
617
+            }
618
+
619
+            $this->tokens[] = $token;
620
+        }
621
+    }
622
+}

+ 176
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/FormulaToken.php View File

@@ -0,0 +1,176 @@
1
+<?php
2
+
3
+/*
4
+PARTLY BASED ON:
5
+    Copyright (c) 2007 E. W. Bachtal, Inc.
6
+
7
+    Permission is hereby granted, free of charge, to any person obtaining a copy of this software
8
+    and associated documentation files (the "Software"), to deal in the Software without restriction,
9
+    including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
10
+    and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
11
+    subject to the following conditions:
12
+
13
+      The above copyright notice and this permission notice shall be included in all copies or substantial
14
+      portions of the Software.
15
+
16
+    The software is provided "as is", without warranty of any kind, express or implied, including but not
17
+    limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In
18
+    no event shall the authors or copyright holders be liable for any claim, damages or other liability,
19
+    whether in an action of contract, tort or otherwise, arising from, out of or in connection with the
20
+    software or the use or other dealings in the software.
21
+
22
+    http://ewbi.blogs.com/develops/2007/03/excel_formula_p.html
23
+    http://ewbi.blogs.com/develops/2004/12/excel_formula_p.html
24
+*/
25
+
26
+/**
27
+ * PHPExcel_Calculation_FormulaToken
28
+ *
29
+ * Copyright (c) 2006 - 2015 PHPExcel
30
+ *
31
+ * This library is free software; you can redistribute it and/or
32
+ * modify it under the terms of the GNU Lesser General Public
33
+ * License as published by the Free Software Foundation; either
34
+ * version 2.1 of the License, or (at your option) any later version.
35
+ *
36
+ * This library is distributed in the hope that it will be useful,
37
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
38
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
39
+ * Lesser General Public License for more details.
40
+ *
41
+ * You should have received a copy of the GNU Lesser General Public
42
+ * License along with this library; if not, write to the Free Software
43
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
44
+ *
45
+ * @category   PHPExcel
46
+ * @package    PHPExcel_Calculation
47
+ * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
48
+ * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
49
+ * @version    ##VERSION##, ##DATE##
50
+ */
51
+
52
+
53
+class PHPExcel_Calculation_FormulaToken
54
+{
55
+    /* Token types */
56
+    const TOKEN_TYPE_NOOP            = 'Noop';
57
+    const TOKEN_TYPE_OPERAND         = 'Operand';
58
+    const TOKEN_TYPE_FUNCTION        = 'Function';
59
+    const TOKEN_TYPE_SUBEXPRESSION   = 'Subexpression';
60
+    const TOKEN_TYPE_ARGUMENT        = 'Argument';
61
+    const TOKEN_TYPE_OPERATORPREFIX  = 'OperatorPrefix';
62
+    const TOKEN_TYPE_OPERATORINFIX   = 'OperatorInfix';
63
+    const TOKEN_TYPE_OPERATORPOSTFIX = 'OperatorPostfix';
64
+    const TOKEN_TYPE_WHITESPACE      = 'Whitespace';
65
+    const TOKEN_TYPE_UNKNOWN         = 'Unknown';
66
+
67
+    /* Token subtypes */
68
+    const TOKEN_SUBTYPE_NOTHING       = 'Nothing';
69
+    const TOKEN_SUBTYPE_START         = 'Start';
70
+    const TOKEN_SUBTYPE_STOP          = 'Stop';
71
+    const TOKEN_SUBTYPE_TEXT          = 'Text';
72
+    const TOKEN_SUBTYPE_NUMBER        = 'Number';
73
+    const TOKEN_SUBTYPE_LOGICAL       = 'Logical';
74
+    const TOKEN_SUBTYPE_ERROR         = 'Error';
75
+    const TOKEN_SUBTYPE_RANGE         = 'Range';
76
+    const TOKEN_SUBTYPE_MATH          = 'Math';
77
+    const TOKEN_SUBTYPE_CONCATENATION = 'Concatenation';
78
+    const TOKEN_SUBTYPE_INTERSECTION  = 'Intersection';
79
+    const TOKEN_SUBTYPE_UNION         = 'Union';
80
+
81
+    /**
82
+     * Value
83
+     *
84
+     * @var string
85
+     */
86
+    private $value;
87
+
88
+    /**
89
+     * Token Type (represented by TOKEN_TYPE_*)
90
+     *
91
+     * @var string
92
+     */
93
+    private $tokenType;
94
+
95
+    /**
96
+     * Token SubType (represented by TOKEN_SUBTYPE_*)
97
+     *
98
+     * @var string
99
+     */
100
+    private $tokenSubType;
101
+
102
+    /**
103
+     * Create a new PHPExcel_Calculation_FormulaToken
104
+     *
105
+     * @param string    $pValue
106
+     * @param string    $pTokenType     Token type (represented by TOKEN_TYPE_*)
107
+     * @param string    $pTokenSubType     Token Subtype (represented by TOKEN_SUBTYPE_*)
108
+     */
109
+    public function __construct($pValue, $pTokenType = PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN, $pTokenSubType = PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_NOTHING)
110
+    {
111
+        // Initialise values
112
+        $this->value       = $pValue;
113
+        $this->tokenType    = $pTokenType;
114
+        $this->tokenSubType = $pTokenSubType;
115
+    }
116
+
117
+    /**
118
+     * Get Value
119
+     *
120
+     * @return string
121
+     */
122
+    public function getValue()
123
+    {
124
+        return $this->value;
125
+    }
126
+
127
+    /**
128
+     * Set Value
129
+     *
130
+     * @param string    $value
131
+     */
132
+    public function setValue($value)
133
+    {
134
+        $this->value = $value;
135
+    }
136
+
137
+    /**
138
+     * Get Token Type (represented by TOKEN_TYPE_*)
139
+     *
140
+     * @return string
141
+     */
142
+    public function getTokenType()
143
+    {
144
+        return $this->tokenType;
145
+    }
146
+
147
+    /**
148
+     * Set Token Type
149
+     *
150
+     * @param string    $value
151
+     */
152
+    public function setTokenType($value = PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN)
153
+    {
154
+        $this->tokenType = $value;
155
+    }
156
+
157
+    /**
158
+     * Get Token SubType (represented by TOKEN_SUBTYPE_*)
159
+     *
160
+     * @return string
161
+     */
162
+    public function getTokenSubType()
163
+    {
164
+        return $this->tokenSubType;
165
+    }
166
+
167
+    /**
168
+     * Set Token SubType
169
+     *
170
+     * @param string    $value
171
+     */
172
+    public function setTokenSubType($value = PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_NOTHING)
173
+    {
174
+        $this->tokenSubType = $value;
175
+    }
176
+}

+ 148
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Function.php View File

@@ -0,0 +1,148 @@
1
+<?php
2
+
3
+/**
4
+ * PHPExcel_Calculation_Function
5
+ *
6
+ * Copyright (c) 2006 - 2015 PHPExcel
7
+ *
8
+ * This library is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU Lesser General Public
10
+ * License as published by the Free Software Foundation; either
11
+ * version 2.1 of the License, or (at your option) any later version.
12
+ *
13
+ * This library is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
+ * Lesser General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU Lesser General Public
19
+ * License along with this library; if not, write to the Free Software
20
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21
+ *
22
+ * @category   PHPExcel
23
+ * @package    PHPExcel_Calculation
24
+ * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
25
+ * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
26
+ * @version    ##VERSION##, ##DATE##
27
+ */
28
+class PHPExcel_Calculation_Function
29
+{
30
+    /* Function categories */
31
+    const CATEGORY_CUBE                 = 'Cube';
32
+    const CATEGORY_DATABASE             = 'Database';
33
+    const CATEGORY_DATE_AND_TIME        = 'Date and Time';
34
+    const CATEGORY_ENGINEERING          = 'Engineering';
35
+    const CATEGORY_FINANCIAL            = 'Financial';
36
+    const CATEGORY_INFORMATION          = 'Information';
37
+    const CATEGORY_LOGICAL              = 'Logical';
38
+    const CATEGORY_LOOKUP_AND_REFERENCE = 'Lookup and Reference';
39
+    const CATEGORY_MATH_AND_TRIG        = 'Math and Trig';
40
+    const CATEGORY_STATISTICAL          = 'Statistical';
41
+    const CATEGORY_TEXT_AND_DATA        = 'Text and Data';
42
+
43
+    /**
44
+     * Category (represented by CATEGORY_*)
45
+     *
46
+     * @var string
47
+     */
48
+    private $category;
49
+
50
+    /**
51
+     * Excel name
52
+     *
53
+     * @var string
54
+     */
55
+    private $excelName;
56
+
57
+    /**
58
+     * PHPExcel name
59
+     *
60
+     * @var string
61
+     */
62
+    private $phpExcelName;
63
+
64
+    /**
65
+     * Create a new PHPExcel_Calculation_Function
66
+     *
67
+     * @param     string        $pCategory         Category (represented by CATEGORY_*)
68
+     * @param     string        $pExcelName        Excel function name
69
+     * @param     string        $pPHPExcelName    PHPExcel function mapping
70
+     * @throws     PHPExcel_Calculation_Exception
71
+     */
72
+    public function __construct($pCategory = null, $pExcelName = null, $pPHPExcelName = null)
73
+    {
74
+        if (($pCategory !== null) && ($pExcelName !== null) && ($pPHPExcelName !== null)) {
75
+            // Initialise values
76
+            $this->category     = $pCategory;
77
+            $this->excelName    = $pExcelName;
78
+            $this->phpExcelName = $pPHPExcelName;
79
+        } else {
80
+            throw new PHPExcel_Calculation_Exception("Invalid parameters passed.");
81
+        }
82
+    }
83
+
84
+    /**
85
+     * Get Category (represented by CATEGORY_*)
86
+     *
87
+     * @return string
88
+     */
89
+    public function getCategory()
90
+    {
91
+        return $this->category;
92
+    }
93
+
94
+    /**
95
+     * Set Category (represented by CATEGORY_*)
96
+     *
97
+     * @param     string        $value
98
+     * @throws     PHPExcel_Calculation_Exception
99
+     */
100
+    public function setCategory($value = null)
101
+    {
102
+        if (!is_null($value)) {
103
+            $this->category = $value;
104
+        } else {
105
+            throw new PHPExcel_Calculation_Exception("Invalid parameter passed.");
106
+        }
107
+    }
108
+
109
+    /**
110
+     * Get Excel name
111
+     *
112
+     * @return string
113
+     */
114
+    public function getExcelName()
115
+    {
116
+        return $this->excelName;
117
+    }
118
+
119
+    /**
120
+     * Set Excel name
121
+     *
122
+     * @param string    $value
123
+     */
124
+    public function setExcelName($value)
125
+    {
126
+        $this->excelName = $value;
127
+    }
128
+
129
+    /**
130
+     * Get PHPExcel name
131
+     *
132
+     * @return string
133
+     */
134
+    public function getPHPExcelName()
135
+    {
136
+        return $this->phpExcelName;
137
+    }
138
+
139
+    /**
140
+     * Set PHPExcel name
141
+     *
142
+     * @param string    $value
143
+     */
144
+    public function setPHPExcelName($value)
145
+    {
146
+        $this->phpExcelName = $value;
147
+    }
148
+}

+ 759
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Functions.php View File

@@ -0,0 +1,759 @@
1
+<?php
2
+
3
+/** PHPExcel root directory */
4
+if (!defined('PHPEXCEL_ROOT')) {
5
+    /**
6
+     * @ignore
7
+     */
8
+    define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
9
+    require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
10
+}
11
+
12
+
13
+/** MAX_VALUE */
14
+define('MAX_VALUE', 1.2e308);
15
+
16
+/** 2 / PI */
17
+define('M_2DIVPI', 0.63661977236758134307553505349006);
18
+
19
+/** MAX_ITERATIONS */
20
+define('MAX_ITERATIONS', 256);
21
+
22
+/** PRECISION */
23
+define('PRECISION', 8.88E-016);
24
+
25
+
26
+/**
27
+ * PHPExcel_Calculation_Functions
28
+ *
29
+ * Copyright (c) 2006 - 2015 PHPExcel
30
+ *
31
+ * This library is free software; you can redistribute it and/or
32
+ * modify it under the terms of the GNU Lesser General Public
33
+ * License as published by the Free Software Foundation; either
34
+ * version 2.1 of the License, or (at your option) any later version.
35
+ *
36
+ * This library is distributed in the hope that it will be useful,
37
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
38
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
39
+ * Lesser General Public License for more details.
40
+ *
41
+ * You should have received a copy of the GNU Lesser General Public
42
+ * License along with this library; if not, write to the Free Software
43
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
44
+ *
45
+ * @category    PHPExcel
46
+ * @package        PHPExcel_Calculation
47
+ * @copyright    Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
48
+ * @license        http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
49
+ * @version        ##VERSION##, ##DATE##
50
+ */
51
+class PHPExcel_Calculation_Functions
52
+{
53
+
54
+    /** constants */
55
+    const COMPATIBILITY_EXCEL      = 'Excel';
56
+    const COMPATIBILITY_GNUMERIC   = 'Gnumeric';
57
+    const COMPATIBILITY_OPENOFFICE = 'OpenOfficeCalc';
58
+
59
+    const RETURNDATE_PHP_NUMERIC = 'P';
60
+    const RETURNDATE_PHP_OBJECT  = 'O';
61
+    const RETURNDATE_EXCEL       = 'E';
62
+
63
+
64
+    /**
65
+     * Compatibility mode to use for error checking and responses
66
+     *
67
+     * @access    private
68
+     * @var string
69
+     */
70
+    protected static $compatibilityMode = self::COMPATIBILITY_EXCEL;
71
+
72
+    /**
73
+     * Data Type to use when returning date values
74
+     *
75
+     * @access    private
76
+     * @var string
77
+     */
78
+    protected static $returnDateType = self::RETURNDATE_EXCEL;
79
+
80
+    /**
81
+     * List of error codes
82
+     *
83
+     * @access    private
84
+     * @var array
85
+     */
86
+    protected static $errorCodes = array(
87
+        'null'           => '#NULL!',
88
+        'divisionbyzero' => '#DIV/0!',
89
+        'value'          => '#VALUE!',
90
+        'reference'      => '#REF!',
91
+        'name'           => '#NAME?',
92
+        'num'            => '#NUM!',
93
+        'na'             => '#N/A',
94
+        'gettingdata'    => '#GETTING_DATA'
95
+    );
96
+
97
+
98
+    /**
99
+     * Set the Compatibility Mode
100
+     *
101
+     * @access    public
102
+     * @category Function Configuration
103
+     * @param     string        $compatibilityMode        Compatibility Mode
104
+     *                                                Permitted values are:
105
+     *                                                    PHPExcel_Calculation_Functions::COMPATIBILITY_EXCEL            'Excel'
106
+     *                                                    PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC        'Gnumeric'
107
+     *                                                    PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE    'OpenOfficeCalc'
108
+     * @return     boolean    (Success or Failure)
109
+     */
110
+    public static function setCompatibilityMode($compatibilityMode)
111
+    {
112
+        if (($compatibilityMode == self::COMPATIBILITY_EXCEL) ||
113
+            ($compatibilityMode == self::COMPATIBILITY_GNUMERIC) ||
114
+            ($compatibilityMode == self::COMPATIBILITY_OPENOFFICE)) {
115
+            self::$compatibilityMode = $compatibilityMode;
116
+            return true;
117
+        }
118
+        return false;
119
+    }
120
+
121
+
122
+    /**
123
+     * Return the current Compatibility Mode
124
+     *
125
+     * @access    public
126
+     * @category Function Configuration
127
+     * @return     string        Compatibility Mode
128
+     *                            Possible Return values are:
129
+     *                                PHPExcel_Calculation_Functions::COMPATIBILITY_EXCEL            'Excel'
130
+     *                                PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC        'Gnumeric'
131
+     *                                PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE    'OpenOfficeCalc'
132
+     */
133
+    public static function getCompatibilityMode()
134
+    {
135
+        return self::$compatibilityMode;
136
+    }
137
+
138
+
139
+    /**
140
+     * Set the Return Date Format used by functions that return a date/time (Excel, PHP Serialized Numeric or PHP Object)
141
+     *
142
+     * @access    public
143
+     * @category Function Configuration
144
+     * @param     string    $returnDateType            Return Date Format
145
+     *                                                Permitted values are:
146
+     *                                                    PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC        'P'
147
+     *                                                    PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT        'O'
148
+     *                                                    PHPExcel_Calculation_Functions::RETURNDATE_EXCEL            'E'
149
+     * @return     boolean                            Success or failure
150
+     */
151
+    public static function setReturnDateType($returnDateType)
152
+    {
153
+        if (($returnDateType == self::RETURNDATE_PHP_NUMERIC) ||
154
+            ($returnDateType == self::RETURNDATE_PHP_OBJECT) ||
155
+            ($returnDateType == self::RETURNDATE_EXCEL)) {
156
+            self::$returnDateType = $returnDateType;
157
+            return true;
158
+        }
159
+        return false;
160
+    }
161
+
162
+
163
+    /**
164
+     * Return the current Return Date Format for functions that return a date/time (Excel, PHP Serialized Numeric or PHP Object)
165
+     *
166
+     * @access    public
167
+     * @category Function Configuration
168
+     * @return     string        Return Date Format
169
+     *                            Possible Return values are:
170
+     *                                PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC        'P'
171
+     *                                PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT        'O'
172
+     *                                PHPExcel_Calculation_Functions::RETURNDATE_EXCEL            'E'
173
+     */
174
+    public static function getReturnDateType()
175
+    {
176
+        return self::$returnDateType;
177
+    }
178
+
179
+
180
+    /**
181
+     * DUMMY
182
+     *
183
+     * @access    public
184
+     * @category Error Returns
185
+     * @return    string    #Not Yet Implemented
186
+     */
187
+    public static function DUMMY()
188
+    {
189
+        return '#Not Yet Implemented';
190
+    }
191
+
192
+
193
+    /**
194
+     * DIV0
195
+     *
196
+     * @access    public
197
+     * @category Error Returns
198
+     * @return    string    #Not Yet Implemented
199
+     */
200
+    public static function DIV0()
201
+    {
202
+        return self::$errorCodes['divisionbyzero'];
203
+    }
204
+
205
+
206
+    /**
207
+     * NA
208
+     *
209
+     * Excel Function:
210
+     *        =NA()
211
+     *
212
+     * Returns the error value #N/A
213
+     *        #N/A is the error value that means "no value is available."
214
+     *
215
+     * @access    public
216
+     * @category Logical Functions
217
+     * @return    string    #N/A!
218
+     */
219
+    public static function NA()
220
+    {
221
+        return self::$errorCodes['na'];
222
+    }
223
+
224
+
225
+    /**
226
+     * NaN
227
+     *
228
+     * Returns the error value #NUM!
229
+     *
230
+     * @access    public
231
+     * @category Error Returns
232
+     * @return    string    #NUM!
233
+     */
234
+    public static function NaN()
235
+    {
236
+        return self::$errorCodes['num'];
237
+    }
238
+
239
+
240
+    /**
241
+     * NAME
242
+     *
243
+     * Returns the error value #NAME?
244
+     *
245
+     * @access    public
246
+     * @category Error Returns
247
+     * @return    string    #NAME?
248
+     */
249
+    public static function NAME()
250
+    {
251
+        return self::$errorCodes['name'];
252
+    }
253
+
254
+
255
+    /**
256
+     * REF
257
+     *
258
+     * Returns the error value #REF!
259
+     *
260
+     * @access    public
261
+     * @category Error Returns
262
+     * @return    string    #REF!
263
+     */
264
+    public static function REF()
265
+    {
266
+        return self::$errorCodes['reference'];
267
+    }
268
+
269
+
270
+    /**
271
+     * NULL
272
+     *
273
+     * Returns the error value #NULL!
274
+     *
275
+     * @access    public
276
+     * @category Error Returns
277
+     * @return    string    #NULL!
278
+     */
279
+    public static function NULL()
280
+    {
281
+        return self::$errorCodes['null'];
282
+    }
283
+
284
+
285
+    /**
286
+     * VALUE
287
+     *
288
+     * Returns the error value #VALUE!
289
+     *
290
+     * @access    public
291
+     * @category Error Returns
292
+     * @return    string    #VALUE!
293
+     */
294
+    public static function VALUE()
295
+    {
296
+        return self::$errorCodes['value'];
297
+    }
298
+
299
+
300
+    public static function isMatrixValue($idx)
301
+    {
302
+        return ((substr_count($idx, '.') <= 1) || (preg_match('/\.[A-Z]/', $idx) > 0));
303
+    }
304
+
305
+
306
+    public static function isValue($idx)
307
+    {
308
+        return (substr_count($idx, '.') == 0);
309
+    }
310
+
311
+
312
+    public static function isCellValue($idx)
313
+    {
314
+        return (substr_count($idx, '.') > 1);
315
+    }
316
+
317
+
318
+    public static function ifCondition($condition)
319
+    {
320
+        $condition    = PHPExcel_Calculation_Functions::flattenSingleValue($condition);
321
+        if (!isset($condition{0})) {
322
+            $condition = '=""';
323
+        }
324
+        if (!in_array($condition{0}, array('>', '<', '='))) {
325
+            if (!is_numeric($condition)) {
326
+                $condition = PHPExcel_Calculation::wrapResult(strtoupper($condition));
327
+            }
328
+            return '=' . $condition;
329
+        } else {
330
+            preg_match('/([<>=]+)(.*)/', $condition, $matches);
331
+            list(, $operator, $operand) = $matches;
332
+
333
+            if (!is_numeric($operand)) {
334
+                $operand = str_replace('"', '""', $operand);
335
+                $operand = PHPExcel_Calculation::wrapResult(strtoupper($operand));
336
+            }
337
+
338
+            return $operator.$operand;
339
+        }
340
+    }
341
+
342
+    /**
343
+     * ERROR_TYPE
344
+     *
345
+     * @param    mixed    $value    Value to check
346
+     * @return    boolean
347
+     */
348
+    public static function ERROR_TYPE($value = '')
349
+    {
350
+        $value = self::flattenSingleValue($value);
351
+
352
+        $i = 1;
353
+        foreach (self::$errorCodes as $errorCode) {
354
+            if ($value === $errorCode) {
355
+                return $i;
356
+            }
357
+            ++$i;
358
+        }
359
+        return self::NA();
360
+    }
361
+
362
+
363
+    /**
364
+     * IS_BLANK
365
+     *
366
+     * @param    mixed    $value    Value to check
367
+     * @return    boolean
368
+     */
369
+    public static function IS_BLANK($value = null)
370
+    {
371
+        if (!is_null($value)) {
372
+            $value    = self::flattenSingleValue($value);
373
+        }
374
+
375
+        return is_null($value);
376
+    }
377
+
378
+
379
+    /**
380
+     * IS_ERR
381
+     *
382
+     * @param    mixed    $value    Value to check
383
+     * @return    boolean
384
+     */
385
+    public static function IS_ERR($value = '')
386
+    {
387
+        $value = self::flattenSingleValue($value);
388
+
389
+        return self::IS_ERROR($value) && (!self::IS_NA($value));
390
+    }
391
+
392
+
393
+    /**
394
+     * IS_ERROR
395
+     *
396
+     * @param    mixed    $value    Value to check
397
+     * @return    boolean
398
+     */
399
+    public static function IS_ERROR($value = '')
400
+    {
401
+        $value = self::flattenSingleValue($value);
402
+
403
+        if (!is_string($value)) {
404
+            return false;
405
+        }
406
+        return in_array($value, array_values(self::$errorCodes));
407
+    }
408
+
409
+
410
+    /**
411
+     * IS_NA
412
+     *
413
+     * @param    mixed    $value    Value to check
414
+     * @return    boolean
415
+     */
416
+    public static function IS_NA($value = '')
417
+    {
418
+        $value = self::flattenSingleValue($value);
419
+
420
+        return ($value === self::NA());
421
+    }
422
+
423
+
424
+    /**
425
+     * IS_EVEN
426
+     *
427
+     * @param    mixed    $value    Value to check
428
+     * @return    boolean
429
+     */
430
+    public static function IS_EVEN($value = null)
431
+    {
432
+        $value = self::flattenSingleValue($value);
433
+
434
+        if ($value === null) {
435
+            return self::NAME();
436
+        } elseif ((is_bool($value)) || ((is_string($value)) && (!is_numeric($value)))) {
437
+            return self::VALUE();
438
+        }
439
+
440
+        return ($value % 2 == 0);
441
+    }
442
+
443
+
444
+    /**
445
+     * IS_ODD
446
+     *
447
+     * @param    mixed    $value    Value to check
448
+     * @return    boolean
449
+     */
450
+    public static function IS_ODD($value = null)
451
+    {
452
+        $value = self::flattenSingleValue($value);
453
+
454
+        if ($value === null) {
455
+            return self::NAME();
456
+        } elseif ((is_bool($value)) || ((is_string($value)) && (!is_numeric($value)))) {
457
+            return self::VALUE();
458
+        }
459
+
460
+        return (abs($value) % 2 == 1);
461
+    }
462
+
463
+
464
+    /**
465
+     * IS_NUMBER
466
+     *
467
+     * @param    mixed    $value        Value to check
468
+     * @return    boolean
469
+     */
470
+    public static function IS_NUMBER($value = null)
471
+    {
472
+        $value = self::flattenSingleValue($value);
473
+
474
+        if (is_string($value)) {
475
+            return false;
476
+        }
477
+        return is_numeric($value);
478
+    }
479
+
480
+
481
+    /**
482
+     * IS_LOGICAL
483
+     *
484
+     * @param    mixed    $value        Value to check
485
+     * @return    boolean
486
+     */
487
+    public static function IS_LOGICAL($value = null)
488
+    {
489
+        $value = self::flattenSingleValue($value);
490
+
491
+        return is_bool($value);
492
+    }
493
+
494
+
495
+    /**
496
+     * IS_TEXT
497
+     *
498
+     * @param    mixed    $value        Value to check
499
+     * @return    boolean
500
+     */
501
+    public static function IS_TEXT($value = null)
502
+    {
503
+        $value = self::flattenSingleValue($value);
504
+
505
+        return (is_string($value) && !self::IS_ERROR($value));
506
+    }
507
+
508
+
509
+    /**
510
+     * IS_NONTEXT
511
+     *
512
+     * @param    mixed    $value        Value to check
513
+     * @return    boolean
514
+     */
515
+    public static function IS_NONTEXT($value = null)
516
+    {
517
+        return !self::IS_TEXT($value);
518
+    }
519
+
520
+
521
+	/**
522
+	 * VERSION
523
+	 *
524
+	 * @return	string	Version information
525
+	 */
526
+	public static function VERSION() {
527
+		return 'PHPExcel 1.8.2, 2018-11-22';
528
+	}	//	function VERSION()
529
+
530
+
531
+    /**
532
+     * N
533
+     *
534
+     * Returns a value converted to a number
535
+     *
536
+     * @param    value        The value you want converted
537
+     * @return    number        N converts values listed in the following table
538
+     *        If value is or refers to N returns
539
+     *        A number            That number
540
+     *        A date                The serial number of that date
541
+     *        TRUE                1
542
+     *        FALSE                0
543
+     *        An error value        The error value
544
+     *        Anything else        0
545
+     */
546
+    public static function N($value = null)
547
+    {
548
+        while (is_array($value)) {
549
+            $value = array_shift($value);
550
+        }
551
+
552
+        switch (gettype($value)) {
553
+            case 'double':
554
+            case 'float':
555
+            case 'integer':
556
+                return $value;
557
+            case 'boolean':
558
+                return (integer) $value;
559
+            case 'string':
560
+                //    Errors
561
+                if ((strlen($value) > 0) && ($value{0} == '#')) {
562
+                    return $value;
563
+                }
564
+                break;
565
+        }
566
+        return 0;
567
+    }
568
+
569
+
570
+    /**
571
+     * TYPE
572
+     *
573
+     * Returns a number that identifies the type of a value
574
+     *
575
+     * @param    value        The value you want tested
576
+     * @return    number        N converts values listed in the following table
577
+     *        If value is or refers to N returns
578
+     *        A number            1
579
+     *        Text                2
580
+     *        Logical Value        4
581
+     *        An error value        16
582
+     *        Array or Matrix        64
583
+     */
584
+    public static function TYPE($value = null)
585
+    {
586
+        $value = self::flattenArrayIndexed($value);
587
+        if (is_array($value) && (count($value) > 1)) {
588
+            end($value);
589
+            $a = key($value);
590
+            //    Range of cells is an error
591
+            if (self::isCellValue($a)) {
592
+                return 16;
593
+            //    Test for Matrix
594
+            } elseif (self::isMatrixValue($a)) {
595
+                return 64;
596
+            }
597
+        } elseif (empty($value)) {
598
+            //    Empty Cell
599
+            return 1;
600
+        }
601
+        $value = self::flattenSingleValue($value);
602
+
603
+        if (($value === null) || (is_float($value)) || (is_int($value))) {
604
+                return 1;
605
+        } elseif (is_bool($value)) {
606
+                return 4;
607
+        } elseif (is_array($value)) {
608
+                return 64;
609
+        } elseif (is_string($value)) {
610
+            //    Errors
611
+            if ((strlen($value) > 0) && ($value{0} == '#')) {
612
+                return 16;
613
+            }
614
+            return 2;
615
+        }
616
+        return 0;
617
+    }
618
+
619
+
620
+    /**
621
+     * Convert a multi-dimensional array to a simple 1-dimensional array
622
+     *
623
+     * @param    array    $array    Array to be flattened
624
+     * @return    array    Flattened array
625
+     */
626
+    public static function flattenArray($array)
627
+    {
628
+        if (!is_array($array)) {
629
+            return (array) $array;
630
+        }
631
+
632
+        $arrayValues = array();
633
+        foreach ($array as $value) {
634
+            if (is_array($value)) {
635
+                foreach ($value as $val) {
636
+                    if (is_array($val)) {
637
+                        foreach ($val as $v) {
638
+                            $arrayValues[] = $v;
639
+                        }
640
+                    } else {
641
+                        $arrayValues[] = $val;
642
+                    }
643
+                }
644
+            } else {
645
+                $arrayValues[] = $value;
646
+            }
647
+        }
648
+
649
+        return $arrayValues;
650
+    }
651
+
652
+
653
+    /**
654
+     * Convert a multi-dimensional array to a simple 1-dimensional array, but retain an element of indexing
655
+     *
656
+     * @param    array    $array    Array to be flattened
657
+     * @return    array    Flattened array
658
+     */
659
+    public static function flattenArrayIndexed($array)
660
+    {
661
+        if (!is_array($array)) {
662
+            return (array) $array;
663
+        }
664
+
665
+        $arrayValues = array();
666
+        foreach ($array as $k1 => $value) {
667
+            if (is_array($value)) {
668
+                foreach ($value as $k2 => $val) {
669
+                    if (is_array($val)) {
670
+                        foreach ($val as $k3 => $v) {
671
+                            $arrayValues[$k1.'.'.$k2.'.'.$k3] = $v;
672
+                        }
673
+                    } else {
674
+                        $arrayValues[$k1.'.'.$k2] = $val;
675
+                    }
676
+                }
677
+            } else {
678
+                $arrayValues[$k1] = $value;
679
+            }
680
+        }
681
+
682
+        return $arrayValues;
683
+    }
684
+
685
+
686
+    /**
687
+     * Convert an array to a single scalar value by extracting the first element
688
+     *
689
+     * @param    mixed        $value        Array or scalar value
690
+     * @return    mixed
691
+     */
692
+    public static function flattenSingleValue($value = '')
693
+    {
694
+        while (is_array($value)) {
695
+            $value = array_pop($value);
696
+        }
697
+
698
+        return $value;
699
+    }
700
+}
701
+
702
+
703
+//
704
+//    There are a few mathematical functions that aren't available on all versions of PHP for all platforms
705
+//    These functions aren't available in Windows implementations of PHP prior to version 5.3.0
706
+//    So we test if they do exist for this version of PHP/operating platform; and if not we create them
707
+//
708
+if (!function_exists('acosh')) {
709
+    function acosh($x)
710
+    {
711
+        return 2 * log(sqrt(($x + 1) / 2) + sqrt(($x - 1) / 2));
712
+    }    //    function acosh()
713
+}
714
+
715
+if (!function_exists('asinh')) {
716
+    function asinh($x)
717
+    {
718
+        return log($x + sqrt(1 + $x * $x));
719
+    }    //    function asinh()
720
+}
721
+
722
+if (!function_exists('atanh')) {
723
+    function atanh($x)
724
+    {
725
+        return (log(1 + $x) - log(1 - $x)) / 2;
726
+    }    //    function atanh()
727
+}
728
+
729
+
730
+//
731
+//    Strangely, PHP doesn't have a mb_str_replace multibyte function
732
+//    As we'll only ever use this function with UTF-8 characters, we can simply "hard-code" the character set
733
+//
734
+if ((!function_exists('mb_str_replace')) &&
735
+    (function_exists('mb_substr')) && (function_exists('mb_strlen')) && (function_exists('mb_strpos'))) {
736
+    function mb_str_replace($search, $replace, $subject)
737
+    {
738
+        if (is_array($subject)) {
739
+            $ret = array();
740
+            foreach ($subject as $key => $val) {
741
+                $ret[$key] = mb_str_replace($search, $replace, $val);
742
+            }
743
+            return $ret;
744
+        }
745
+
746
+        foreach ((array) $search as $key => $s) {
747
+            if ($s == '' && $s !== 0) {
748
+                continue;
749
+            }
750
+            $r = !is_array($replace) ? $replace : (array_key_exists($key, $replace) ? $replace[$key] : '');
751
+            $pos = mb_strpos($subject, $s, 0, 'UTF-8');
752
+            while ($pos !== false) {
753
+                $subject = mb_substr($subject, 0, $pos, 'UTF-8') . $r . mb_substr($subject, $pos + mb_strlen($s, 'UTF-8'), 65535, 'UTF-8');
754
+                $pos = mb_strpos($subject, $s, $pos + mb_strlen($r, 'UTF-8'), 'UTF-8');
755
+            }
756
+        }
757
+        return $subject;
758
+    }
759
+}

+ 285
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Logical.php View File

@@ -0,0 +1,285 @@
1
+<?php
2
+
3
+/** PHPExcel root directory */
4
+if (!defined('PHPEXCEL_ROOT')) {
5
+    /**
6
+     * @ignore
7
+     */
8
+    define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
9
+    require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
10
+}
11
+
12
+/**
13
+ * PHPExcel_Calculation_Logical
14
+ *
15
+ * Copyright (c) 2006 - 2015 PHPExcel
16
+ *
17
+ * This library is free software; you can redistribute it and/or
18
+ * modify it under the terms of the GNU Lesser General Public
19
+ * License as published by the Free Software Foundation; either
20
+ * version 2.1 of the License, or (at your option) any later version.
21
+ *
22
+ * This library is distributed in the hope that it will be useful,
23
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
24
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
25
+ * Lesser General Public License for more details.
26
+ *
27
+ * You should have received a copy of the GNU Lesser General Public
28
+ * License along with this library; if not, write to the Free Software
29
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
30
+ *
31
+ * @category    PHPExcel
32
+ * @package        PHPExcel_Calculation
33
+ * @copyright    Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
34
+ * @license        http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
35
+ * @version        ##VERSION##, ##DATE##
36
+ */
37
+class PHPExcel_Calculation_Logical
38
+{
39
+    /**
40
+     * TRUE
41
+     *
42
+     * Returns the boolean TRUE.
43
+     *
44
+     * Excel Function:
45
+     *        =TRUE()
46
+     *
47
+     * @access    public
48
+     * @category Logical Functions
49
+     * @return    boolean        True
50
+     */
51
+    public static function TRUE()
52
+    {
53
+        return true;
54
+    }
55
+
56
+
57
+    /**
58
+     * FALSE
59
+     *
60
+     * Returns the boolean FALSE.
61
+     *
62
+     * Excel Function:
63
+     *        =FALSE()
64
+     *
65
+     * @access    public
66
+     * @category Logical Functions
67
+     * @return    boolean        False
68
+     */
69
+    public static function FALSE()
70
+    {
71
+        return false;
72
+    }
73
+
74
+
75
+    /**
76
+     * LOGICAL_AND
77
+     *
78
+     * Returns boolean TRUE if all its arguments are TRUE; returns FALSE if one or more argument is FALSE.
79
+     *
80
+     * Excel Function:
81
+     *        =AND(logical1[,logical2[, ...]])
82
+     *
83
+     *        The arguments must evaluate to logical values such as TRUE or FALSE, or the arguments must be arrays
84
+     *            or references that contain logical values.
85
+     *
86
+     *        Boolean arguments are treated as True or False as appropriate
87
+     *        Integer or floating point arguments are treated as True, except for 0 or 0.0 which are False
88
+     *        If any argument value is a string, or a Null, the function returns a #VALUE! error, unless the string holds
89
+     *            the value TRUE or FALSE, in which case it is evaluated as the corresponding boolean value
90
+     *
91
+     * @access    public
92
+     * @category Logical Functions
93
+     * @param    mixed        $arg,...        Data values
94
+     * @return    boolean        The logical AND of the arguments.
95
+     */
96
+    public static function LOGICAL_AND()
97
+    {
98
+        // Return value
99
+        $returnValue = true;
100
+
101
+        // Loop through the arguments
102
+        $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
103
+        $argCount = -1;
104
+        foreach ($aArgs as $argCount => $arg) {
105
+            // Is it a boolean value?
106
+            if (is_bool($arg)) {
107
+                $returnValue = $returnValue && $arg;
108
+            } elseif ((is_numeric($arg)) && (!is_string($arg))) {
109
+                $returnValue = $returnValue && ($arg != 0);
110
+            } elseif (is_string($arg)) {
111
+                $arg = strtoupper($arg);
112
+                if (($arg == 'TRUE') || ($arg == PHPExcel_Calculation::getTRUE())) {
113
+                    $arg = true;
114
+                } elseif (($arg == 'FALSE') || ($arg == PHPExcel_Calculation::getFALSE())) {
115
+                    $arg = false;
116
+                } else {
117
+                    return PHPExcel_Calculation_Functions::VALUE();
118
+                }
119
+                $returnValue = $returnValue && ($arg != 0);
120
+            }
121
+        }
122
+
123
+        // Return
124
+        if ($argCount < 0) {
125
+            return PHPExcel_Calculation_Functions::VALUE();
126
+        }
127
+        return $returnValue;
128
+    }
129
+
130
+
131
+    /**
132
+     * LOGICAL_OR
133
+     *
134
+     * Returns boolean TRUE if any argument is TRUE; returns FALSE if all arguments are FALSE.
135
+     *
136
+     * Excel Function:
137
+     *        =OR(logical1[,logical2[, ...]])
138
+     *
139
+     *        The arguments must evaluate to logical values such as TRUE or FALSE, or the arguments must be arrays
140
+     *            or references that contain logical values.
141
+     *
142
+     *        Boolean arguments are treated as True or False as appropriate
143
+     *        Integer or floating point arguments are treated as True, except for 0 or 0.0 which are False
144
+     *        If any argument value is a string, or a Null, the function returns a #VALUE! error, unless the string holds
145
+     *            the value TRUE or FALSE, in which case it is evaluated as the corresponding boolean value
146
+     *
147
+     * @access    public
148
+     * @category Logical Functions
149
+     * @param    mixed        $arg,...        Data values
150
+     * @return    boolean        The logical OR of the arguments.
151
+     */
152
+    public static function LOGICAL_OR()
153
+    {
154
+        // Return value
155
+        $returnValue = false;
156
+
157
+        // Loop through the arguments
158
+        $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
159
+        $argCount = -1;
160
+        foreach ($aArgs as $argCount => $arg) {
161
+            // Is it a boolean value?
162
+            if (is_bool($arg)) {
163
+                $returnValue = $returnValue || $arg;
164
+            } elseif ((is_numeric($arg)) && (!is_string($arg))) {
165
+                $returnValue = $returnValue || ($arg != 0);
166
+            } elseif (is_string($arg)) {
167
+                $arg = strtoupper($arg);
168
+                if (($arg == 'TRUE') || ($arg == PHPExcel_Calculation::getTRUE())) {
169
+                    $arg = true;
170
+                } elseif (($arg == 'FALSE') || ($arg == PHPExcel_Calculation::getFALSE())) {
171
+                    $arg = false;
172
+                } else {
173
+                    return PHPExcel_Calculation_Functions::VALUE();
174
+                }
175
+                $returnValue = $returnValue || ($arg != 0);
176
+            }
177
+        }
178
+
179
+        // Return
180
+        if ($argCount < 0) {
181
+            return PHPExcel_Calculation_Functions::VALUE();
182
+        }
183
+        return $returnValue;
184
+    }
185
+
186
+
187
+    /**
188
+     * NOT
189
+     *
190
+     * Returns the boolean inverse of the argument.
191
+     *
192
+     * Excel Function:
193
+     *        =NOT(logical)
194
+     *
195
+     *        The argument must evaluate to a logical value such as TRUE or FALSE
196
+     *
197
+     *        Boolean arguments are treated as True or False as appropriate
198
+     *        Integer or floating point arguments are treated as True, except for 0 or 0.0 which are False
199
+     *        If any argument value is a string, or a Null, the function returns a #VALUE! error, unless the string holds
200
+     *            the value TRUE or FALSE, in which case it is evaluated as the corresponding boolean value
201
+     *
202
+     * @access    public
203
+     * @category Logical Functions
204
+     * @param    mixed        $logical    A value or expression that can be evaluated to TRUE or FALSE
205
+     * @return    boolean        The boolean inverse of the argument.
206
+     */
207
+    public static function NOT($logical = false)
208
+    {
209
+        $logical = PHPExcel_Calculation_Functions::flattenSingleValue($logical);
210
+        if (is_string($logical)) {
211
+            $logical = strtoupper($logical);
212
+            if (($logical == 'TRUE') || ($logical == PHPExcel_Calculation::getTRUE())) {
213
+                return false;
214
+            } elseif (($logical == 'FALSE') || ($logical == PHPExcel_Calculation::getFALSE())) {
215
+                return true;
216
+            } else {
217
+                return PHPExcel_Calculation_Functions::VALUE();
218
+            }
219
+        }
220
+
221
+        return !$logical;
222
+    }
223
+
224
+    /**
225
+     * STATEMENT_IF
226
+     *
227
+     * Returns one value if a condition you specify evaluates to TRUE and another value if it evaluates to FALSE.
228
+     *
229
+     * Excel Function:
230
+     *        =IF(condition[,returnIfTrue[,returnIfFalse]])
231
+     *
232
+     *        Condition is any value or expression that can be evaluated to TRUE or FALSE.
233
+     *            For example, A10=100 is a logical expression; if the value in cell A10 is equal to 100,
234
+     *            the expression evaluates to TRUE. Otherwise, the expression evaluates to FALSE.
235
+     *            This argument can use any comparison calculation operator.
236
+     *        ReturnIfTrue is the value that is returned if condition evaluates to TRUE.
237
+     *            For example, if this argument is the text string "Within budget" and the condition argument evaluates to TRUE,
238
+     *            then the IF function returns the text "Within budget"
239
+     *            If condition is TRUE and ReturnIfTrue is blank, this argument returns 0 (zero). To display the word TRUE, use
240
+     *            the logical value TRUE for this argument.
241
+     *            ReturnIfTrue can be another formula.
242
+     *        ReturnIfFalse is the value that is returned if condition evaluates to FALSE.
243
+     *            For example, if this argument is the text string "Over budget" and the condition argument evaluates to FALSE,
244
+     *            then the IF function returns the text "Over budget".
245
+     *            If condition is FALSE and ReturnIfFalse is omitted, then the logical value FALSE is returned.
246
+     *            If condition is FALSE and ReturnIfFalse is blank, then the value 0 (zero) is returned.
247
+     *            ReturnIfFalse can be another formula.
248
+     *
249
+     * @access    public
250
+     * @category Logical Functions
251
+     * @param    mixed    $condition        Condition to evaluate
252
+     * @param    mixed    $returnIfTrue    Value to return when condition is true
253
+     * @param    mixed    $returnIfFalse    Optional value to return when condition is false
254
+     * @return    mixed    The value of returnIfTrue or returnIfFalse determined by condition
255
+     */
256
+    public static function STATEMENT_IF($condition = true, $returnIfTrue = 0, $returnIfFalse = false)
257
+    {
258
+        $condition     = (is_null($condition))     ? true :  (boolean) PHPExcel_Calculation_Functions::flattenSingleValue($condition);
259
+        $returnIfTrue  = (is_null($returnIfTrue))  ? 0 :     PHPExcel_Calculation_Functions::flattenSingleValue($returnIfTrue);
260
+        $returnIfFalse = (is_null($returnIfFalse)) ? false : PHPExcel_Calculation_Functions::flattenSingleValue($returnIfFalse);
261
+
262
+        return ($condition) ? $returnIfTrue : $returnIfFalse;
263
+    }
264
+
265
+
266
+    /**
267
+     * IFERROR
268
+     *
269
+     * Excel Function:
270
+     *        =IFERROR(testValue,errorpart)
271
+     *
272
+     * @access    public
273
+     * @category Logical Functions
274
+     * @param    mixed    $testValue    Value to check, is also the value returned when no error
275
+     * @param    mixed    $errorpart    Value to return when testValue is an error condition
276
+     * @return    mixed    The value of errorpart or testValue determined by error condition
277
+     */
278
+    public static function IFERROR($testValue = '', $errorpart = '')
279
+    {
280
+        $testValue = (is_null($testValue)) ? '' : PHPExcel_Calculation_Functions::flattenSingleValue($testValue);
281
+        $errorpart = (is_null($errorpart)) ? '' : PHPExcel_Calculation_Functions::flattenSingleValue($errorpart);
282
+
283
+        return self::STATEMENT_IF(PHPExcel_Calculation_Functions::IS_ERROR($testValue), $errorpart, $testValue);
284
+    }
285
+}

+ 879
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/LookupRef.php View File

@@ -0,0 +1,879 @@
1
+<?php
2
+
3
+/** PHPExcel root directory */
4
+if (!defined('PHPEXCEL_ROOT')) {
5
+    /**
6
+     * @ignore
7
+     */
8
+    define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
9
+    require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
10
+}
11
+
12
+/**
13
+ * PHPExcel_Calculation_LookupRef
14
+ *
15
+ * Copyright (c) 2006 - 2015 PHPExcel
16
+ *
17
+ * This library is free software; you can redistribute it and/or
18
+ * modify it under the terms of the GNU Lesser General Public
19
+ * License as published by the Free Software Foundation; either
20
+ * version 2.1 of the License, or (at your option) any later version.
21
+ *
22
+ * This library is distributed in the hope that it will be useful,
23
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
24
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
25
+ * Lesser General Public License for more details.
26
+ *
27
+ * You should have received a copy of the GNU Lesser General Public
28
+ * License along with this library; if not, write to the Free Software
29
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
30
+ *
31
+ * @category    PHPExcel
32
+ * @package        PHPExcel_Calculation
33
+ * @copyright    Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
34
+ * @license        http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
35
+ * @version        ##VERSION##, ##DATE##
36
+ */
37
+class PHPExcel_Calculation_LookupRef
38
+{
39
+    /**
40
+     * CELL_ADDRESS
41
+     *
42
+     * Creates a cell address as text, given specified row and column numbers.
43
+     *
44
+     * Excel Function:
45
+     *        =ADDRESS(row, column, [relativity], [referenceStyle], [sheetText])
46
+     *
47
+     * @param    row                Row number to use in the cell reference
48
+     * @param    column            Column number to use in the cell reference
49
+     * @param    relativity        Flag indicating the type of reference to return
50
+     *                                1 or omitted    Absolute
51
+     *                                2                Absolute row; relative column
52
+     *                                3                Relative row; absolute column
53
+     *                                4                Relative
54
+     * @param    referenceStyle    A logical value that specifies the A1 or R1C1 reference style.
55
+     *                                TRUE or omitted        CELL_ADDRESS returns an A1-style reference
56
+     *                                FALSE                CELL_ADDRESS returns an R1C1-style reference
57
+     * @param    sheetText        Optional Name of worksheet to use
58
+     * @return    string
59
+     */
60
+    public static function CELL_ADDRESS($row, $column, $relativity = 1, $referenceStyle = true, $sheetText = '')
61
+    {
62
+        $row        = PHPExcel_Calculation_Functions::flattenSingleValue($row);
63
+        $column     = PHPExcel_Calculation_Functions::flattenSingleValue($column);
64
+        $relativity = PHPExcel_Calculation_Functions::flattenSingleValue($relativity);
65
+        $sheetText  = PHPExcel_Calculation_Functions::flattenSingleValue($sheetText);
66
+
67
+        if (($row < 1) || ($column < 1)) {
68
+            return PHPExcel_Calculation_Functions::VALUE();
69
+        }
70
+
71
+        if ($sheetText > '') {
72
+            if (strpos($sheetText, ' ') !== false) {
73
+                $sheetText = "'".$sheetText."'";
74
+            }
75
+            $sheetText .='!';
76
+        }
77
+        if ((!is_bool($referenceStyle)) || $referenceStyle) {
78
+            $rowRelative = $columnRelative = '$';
79
+            $column = PHPExcel_Cell::stringFromColumnIndex($column-1);
80
+            if (($relativity == 2) || ($relativity == 4)) {
81
+                $columnRelative = '';
82
+            }
83
+            if (($relativity == 3) || ($relativity == 4)) {
84
+                $rowRelative = '';
85
+            }
86
+            return $sheetText.$columnRelative.$column.$rowRelative.$row;
87
+        } else {
88
+            if (($relativity == 2) || ($relativity == 4)) {
89
+                $column = '['.$column.']';
90
+            }
91
+            if (($relativity == 3) || ($relativity == 4)) {
92
+                $row = '['.$row.']';
93
+            }
94
+            return $sheetText.'R'.$row.'C'.$column;
95
+        }
96
+    }
97
+
98
+
99
+    /**
100
+     * COLUMN
101
+     *
102
+     * Returns the column number of the given cell reference
103
+     * If the cell reference is a range of cells, COLUMN returns the column numbers of each column in the reference as a horizontal array.
104
+     * If cell reference is omitted, and the function is being called through the calculation engine, then it is assumed to be the
105
+     *        reference of the cell in which the COLUMN function appears; otherwise this function returns 0.
106
+     *
107
+     * Excel Function:
108
+     *        =COLUMN([cellAddress])
109
+     *
110
+     * @param    cellAddress        A reference to a range of cells for which you want the column numbers
111
+     * @return    integer or array of integer
112
+     */
113
+    public static function COLUMN($cellAddress = null)
114
+    {
115
+        if (is_null($cellAddress) || trim($cellAddress) === '') {
116
+            return 0;
117
+        }
118
+
119
+        if (is_array($cellAddress)) {
120
+            foreach ($cellAddress as $columnKey => $value) {
121
+                $columnKey = preg_replace('/[^a-z]/i', '', $columnKey);
122
+                return (integer) PHPExcel_Cell::columnIndexFromString($columnKey);
123
+            }
124
+        } else {
125
+            if (strpos($cellAddress, '!') !== false) {
126
+                list($sheet, $cellAddress) = explode('!', $cellAddress);
127
+            }
128
+            if (strpos($cellAddress, ':') !== false) {
129
+                list($startAddress, $endAddress) = explode(':', $cellAddress);
130
+                $startAddress = preg_replace('/[^a-z]/i', '', $startAddress);
131
+                $endAddress = preg_replace('/[^a-z]/i', '', $endAddress);
132
+                $returnValue = array();
133
+                do {
134
+                    $returnValue[] = (integer) PHPExcel_Cell::columnIndexFromString($startAddress);
135
+                } while ($startAddress++ != $endAddress);
136
+                return $returnValue;
137
+            } else {
138
+                $cellAddress = preg_replace('/[^a-z]/i', '', $cellAddress);
139
+                return (integer) PHPExcel_Cell::columnIndexFromString($cellAddress);
140
+            }
141
+        }
142
+    }
143
+
144
+
145
+    /**
146
+     * COLUMNS
147
+     *
148
+     * Returns the number of columns in an array or reference.
149
+     *
150
+     * Excel Function:
151
+     *        =COLUMNS(cellAddress)
152
+     *
153
+     * @param    cellAddress        An array or array formula, or a reference to a range of cells for which you want the number of columns
154
+     * @return    integer            The number of columns in cellAddress
155
+     */
156
+    public static function COLUMNS($cellAddress = null)
157
+    {
158
+        if (is_null($cellAddress) || $cellAddress === '') {
159
+            return 1;
160
+        } elseif (!is_array($cellAddress)) {
161
+            return PHPExcel_Calculation_Functions::VALUE();
162
+        }
163
+
164
+        reset($cellAddress);
165
+        $isMatrix = (is_numeric(key($cellAddress)));
166
+        list($columns, $rows) = PHPExcel_Calculation::_getMatrixDimensions($cellAddress);
167
+
168
+        if ($isMatrix) {
169
+            return $rows;
170
+        } else {
171
+            return $columns;
172
+        }
173
+    }
174
+
175
+
176
+    /**
177
+     * ROW
178
+     *
179
+     * Returns the row number of the given cell reference
180
+     * If the cell reference is a range of cells, ROW returns the row numbers of each row in the reference as a vertical array.
181
+     * If cell reference is omitted, and the function is being called through the calculation engine, then it is assumed to be the
182
+     *        reference of the cell in which the ROW function appears; otherwise this function returns 0.
183
+     *
184
+     * Excel Function:
185
+     *        =ROW([cellAddress])
186
+     *
187
+     * @param    cellAddress        A reference to a range of cells for which you want the row numbers
188
+     * @return    integer or array of integer
189
+     */
190
+    public static function ROW($cellAddress = null)
191
+    {
192
+        if (is_null($cellAddress) || trim($cellAddress) === '') {
193
+            return 0;
194
+        }
195
+
196
+        if (is_array($cellAddress)) {
197
+            foreach ($cellAddress as $columnKey => $rowValue) {
198
+                foreach ($rowValue as $rowKey => $cellValue) {
199
+                    return (integer) preg_replace('/[^0-9]/i', '', $rowKey);
200
+                }
201
+            }
202
+        } else {
203
+            if (strpos($cellAddress, '!') !== false) {
204
+                list($sheet, $cellAddress) = explode('!', $cellAddress);
205
+            }
206
+            if (strpos($cellAddress, ':') !== false) {
207
+                list($startAddress, $endAddress) = explode(':', $cellAddress);
208
+                $startAddress = preg_replace('/[^0-9]/', '', $startAddress);
209
+                $endAddress = preg_replace('/[^0-9]/', '', $endAddress);
210
+                $returnValue = array();
211
+                do {
212
+                    $returnValue[][] = (integer) $startAddress;
213
+                } while ($startAddress++ != $endAddress);
214
+                return $returnValue;
215
+            } else {
216
+                list($cellAddress) = explode(':', $cellAddress);
217
+                return (integer) preg_replace('/[^0-9]/', '', $cellAddress);
218
+            }
219
+        }
220
+    }
221
+
222
+
223
+    /**
224
+     * ROWS
225
+     *
226
+     * Returns the number of rows in an array or reference.
227
+     *
228
+     * Excel Function:
229
+     *        =ROWS(cellAddress)
230
+     *
231
+     * @param    cellAddress        An array or array formula, or a reference to a range of cells for which you want the number of rows
232
+     * @return    integer            The number of rows in cellAddress
233
+     */
234
+    public static function ROWS($cellAddress = null)
235
+    {
236
+        if (is_null($cellAddress) || $cellAddress === '') {
237
+            return 1;
238
+        } elseif (!is_array($cellAddress)) {
239
+            return PHPExcel_Calculation_Functions::VALUE();
240
+        }
241
+
242
+        reset($cellAddress);
243
+        $isMatrix = (is_numeric(key($cellAddress)));
244
+        list($columns, $rows) = PHPExcel_Calculation::_getMatrixDimensions($cellAddress);
245
+
246
+        if ($isMatrix) {
247
+            return $columns;
248
+        } else {
249
+            return $rows;
250
+        }
251
+    }
252
+
253
+
254
+    /**
255
+     * HYPERLINK
256
+     *
257
+     * Excel Function:
258
+     *        =HYPERLINK(linkURL,displayName)
259
+     *
260
+     * @access    public
261
+     * @category Logical Functions
262
+     * @param    string            $linkURL        Value to check, is also the value returned when no error
263
+     * @param    string            $displayName    Value to return when testValue is an error condition
264
+     * @param    PHPExcel_Cell    $pCell            The cell to set the hyperlink in
265
+     * @return    mixed    The value of $displayName (or $linkURL if $displayName was blank)
266
+     */
267
+    public static function HYPERLINK($linkURL = '', $displayName = null, PHPExcel_Cell $pCell = null)
268
+    {
269
+        $args = func_get_args();
270
+        $pCell = array_pop($args);
271
+
272
+        $linkURL     = (is_null($linkURL))     ? '' : PHPExcel_Calculation_Functions::flattenSingleValue($linkURL);
273
+        $displayName = (is_null($displayName)) ? '' : PHPExcel_Calculation_Functions::flattenSingleValue($displayName);
274
+
275
+        if ((!is_object($pCell)) || (trim($linkURL) == '')) {
276
+            return PHPExcel_Calculation_Functions::REF();
277
+        }
278
+
279
+        if ((is_object($displayName)) || trim($displayName) == '') {
280
+            $displayName = $linkURL;
281
+        }
282
+
283
+        $pCell->getHyperlink()->setUrl($linkURL);
284
+        $pCell->getHyperlink()->setTooltip($displayName);
285
+
286
+        return $displayName;
287
+    }
288
+
289
+
290
+    /**
291
+     * INDIRECT
292
+     *
293
+     * Returns the reference specified by a text string.
294
+     * References are immediately evaluated to display their contents.
295
+     *
296
+     * Excel Function:
297
+     *        =INDIRECT(cellAddress)
298
+     *
299
+     * NOTE - INDIRECT() does not yet support the optional a1 parameter introduced in Excel 2010
300
+     *
301
+     * @param    cellAddress        $cellAddress    The cell address of the current cell (containing this formula)
302
+     * @param    PHPExcel_Cell    $pCell            The current cell (containing this formula)
303
+     * @return    mixed            The cells referenced by cellAddress
304
+     *
305
+     * @todo    Support for the optional a1 parameter introduced in Excel 2010
306
+     *
307
+     */
308
+    public static function INDIRECT($cellAddress = null, PHPExcel_Cell $pCell = null)
309
+    {
310
+        $cellAddress    = PHPExcel_Calculation_Functions::flattenSingleValue($cellAddress);
311
+        if (is_null($cellAddress) || $cellAddress === '') {
312
+            return PHPExcel_Calculation_Functions::REF();
313
+        }
314
+
315
+        $cellAddress1 = $cellAddress;
316
+        $cellAddress2 = null;
317
+        if (strpos($cellAddress, ':') !== false) {
318
+            list($cellAddress1, $cellAddress2) = explode(':', $cellAddress);
319
+        }
320
+
321
+        if ((!preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $cellAddress1, $matches)) ||
322
+            ((!is_null($cellAddress2)) && (!preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $cellAddress2, $matches)))) {
323
+            if (!preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_NAMEDRANGE.'$/i', $cellAddress1, $matches)) {
324
+                return PHPExcel_Calculation_Functions::REF();
325
+            }
326
+
327
+            if (strpos($cellAddress, '!') !== false) {
328
+                list($sheetName, $cellAddress) = explode('!', $cellAddress);
329
+                $sheetName = trim($sheetName, "'");
330
+                $pSheet = $pCell->getWorksheet()->getParent()->getSheetByName($sheetName);
331
+            } else {
332
+                $pSheet = $pCell->getWorksheet();
333
+            }
334
+
335
+            return PHPExcel_Calculation::getInstance()->extractNamedRange($cellAddress, $pSheet, false);
336
+        }
337
+
338
+        if (strpos($cellAddress, '!') !== false) {
339
+            list($sheetName, $cellAddress) = explode('!', $cellAddress);
340
+            $sheetName = trim($sheetName, "'");
341
+            $pSheet = $pCell->getWorksheet()->getParent()->getSheetByName($sheetName);
342
+        } else {
343
+            $pSheet = $pCell->getWorksheet();
344
+        }
345
+
346
+        return PHPExcel_Calculation::getInstance()->extractCellRange($cellAddress, $pSheet, false);
347
+    }
348
+
349
+
350
+    /**
351
+     * OFFSET
352
+     *
353
+     * Returns a reference to a range that is a specified number of rows and columns from a cell or range of cells.
354
+     * The reference that is returned can be a single cell or a range of cells. You can specify the number of rows and
355
+     * the number of columns to be returned.
356
+     *
357
+     * Excel Function:
358
+     *        =OFFSET(cellAddress, rows, cols, [height], [width])
359
+     *
360
+     * @param    cellAddress        The reference from which you want to base the offset. Reference must refer to a cell or
361
+     *                                range of adjacent cells; otherwise, OFFSET returns the #VALUE! error value.
362
+     * @param    rows            The number of rows, up or down, that you want the upper-left cell to refer to.
363
+     *                                Using 5 as the rows argument specifies that the upper-left cell in the reference is
364
+     *                                five rows below reference. Rows can be positive (which means below the starting reference)
365
+     *                                or negative (which means above the starting reference).
366
+     * @param    cols            The number of columns, to the left or right, that you want the upper-left cell of the result
367
+     *                                to refer to. Using 5 as the cols argument specifies that the upper-left cell in the
368
+     *                                reference is five columns to the right of reference. Cols can be positive (which means
369
+     *                                to the right of the starting reference) or negative (which means to the left of the
370
+     *                                starting reference).
371
+     * @param    height            The height, in number of rows, that you want the returned reference to be. Height must be a positive number.
372
+     * @param    width            The width, in number of columns, that you want the returned reference to be. Width must be a positive number.
373
+     * @return    string            A reference to a cell or range of cells
374
+     */
375
+    public static function OFFSET($cellAddress = null, $rows = 0, $columns = 0, $height = null, $width = null)
376
+    {
377
+        $rows    = PHPExcel_Calculation_Functions::flattenSingleValue($rows);
378
+        $columns = PHPExcel_Calculation_Functions::flattenSingleValue($columns);
379
+        $height  = PHPExcel_Calculation_Functions::flattenSingleValue($height);
380
+        $width   = PHPExcel_Calculation_Functions::flattenSingleValue($width);
381
+        if ($cellAddress == null) {
382
+            return 0;
383
+        }
384
+
385
+        $args = func_get_args();
386
+        $pCell = array_pop($args);
387
+        if (!is_object($pCell)) {
388
+            return PHPExcel_Calculation_Functions::REF();
389
+        }
390
+
391
+        $sheetName = null;
392
+        if (strpos($cellAddress, "!")) {
393
+            list($sheetName, $cellAddress) = explode("!", $cellAddress);
394
+            $sheetName = trim($sheetName, "'");
395
+        }
396
+        if (strpos($cellAddress, ":")) {
397
+            list($startCell, $endCell) = explode(":", $cellAddress);
398
+        } else {
399
+            $startCell = $endCell = $cellAddress;
400
+        }
401
+        list($startCellColumn, $startCellRow) = PHPExcel_Cell::coordinateFromString($startCell);
402
+        list($endCellColumn, $endCellRow) = PHPExcel_Cell::coordinateFromString($endCell);
403
+
404
+        $startCellRow += $rows;
405
+        $startCellColumn = PHPExcel_Cell::columnIndexFromString($startCellColumn) - 1;
406
+        $startCellColumn += $columns;
407
+
408
+        if (($startCellRow <= 0) || ($startCellColumn < 0)) {
409
+            return PHPExcel_Calculation_Functions::REF();
410
+        }
411
+        $endCellColumn = PHPExcel_Cell::columnIndexFromString($endCellColumn) - 1;
412
+        if (($width != null) && (!is_object($width))) {
413
+            $endCellColumn = $startCellColumn + $width - 1;
414
+        } else {
415
+            $endCellColumn += $columns;
416
+        }
417
+        $startCellColumn = PHPExcel_Cell::stringFromColumnIndex($startCellColumn);
418
+
419
+        if (($height != null) && (!is_object($height))) {
420
+            $endCellRow = $startCellRow + $height - 1;
421
+        } else {
422
+            $endCellRow += $rows;
423
+        }
424
+
425
+        if (($endCellRow <= 0) || ($endCellColumn < 0)) {
426
+            return PHPExcel_Calculation_Functions::REF();
427
+        }
428
+        $endCellColumn = PHPExcel_Cell::stringFromColumnIndex($endCellColumn);
429
+
430
+        $cellAddress = $startCellColumn.$startCellRow;
431
+        if (($startCellColumn != $endCellColumn) || ($startCellRow != $endCellRow)) {
432
+            $cellAddress .= ':'.$endCellColumn.$endCellRow;
433
+        }
434
+
435
+        if ($sheetName !== null) {
436
+            $pSheet = $pCell->getWorksheet()->getParent()->getSheetByName($sheetName);
437
+        } else {
438
+            $pSheet = $pCell->getWorksheet();
439
+        }
440
+
441
+        return PHPExcel_Calculation::getInstance()->extractCellRange($cellAddress, $pSheet, false);
442
+    }
443
+
444
+
445
+    /**
446
+     * CHOOSE
447
+     *
448
+     * Uses lookup_value to return a value from the list of value arguments.
449
+     * Use CHOOSE to select one of up to 254 values based on the lookup_value.
450
+     *
451
+     * Excel Function:
452
+     *        =CHOOSE(index_num, value1, [value2], ...)
453
+     *
454
+     * @param    index_num        Specifies which value argument is selected.
455
+     *                            Index_num must be a number between 1 and 254, or a formula or reference to a cell containing a number
456
+     *                                between 1 and 254.
457
+     * @param    value1...        Value1 is required, subsequent values are optional.
458
+     *                            Between 1 to 254 value arguments from which CHOOSE selects a value or an action to perform based on
459
+     *                                index_num. The arguments can be numbers, cell references, defined names, formulas, functions, or
460
+     *                                text.
461
+     * @return    mixed            The selected value
462
+     */
463
+    public static function CHOOSE()
464
+    {
465
+        $chooseArgs = func_get_args();
466
+        $chosenEntry = PHPExcel_Calculation_Functions::flattenArray(array_shift($chooseArgs));
467
+        $entryCount = count($chooseArgs) - 1;
468
+
469
+        if (is_array($chosenEntry)) {
470
+            $chosenEntry = array_shift($chosenEntry);
471
+        }
472
+        if ((is_numeric($chosenEntry)) && (!is_bool($chosenEntry))) {
473
+            --$chosenEntry;
474
+        } else {
475
+            return PHPExcel_Calculation_Functions::VALUE();
476
+        }
477
+        $chosenEntry = floor($chosenEntry);
478
+        if (($chosenEntry < 0) || ($chosenEntry > $entryCount)) {
479
+            return PHPExcel_Calculation_Functions::VALUE();
480
+        }
481
+
482
+        if (is_array($chooseArgs[$chosenEntry])) {
483
+            return PHPExcel_Calculation_Functions::flattenArray($chooseArgs[$chosenEntry]);
484
+        } else {
485
+            return $chooseArgs[$chosenEntry];
486
+        }
487
+    }
488
+
489
+
490
+    /**
491
+     * MATCH
492
+     *
493
+     * The MATCH function searches for a specified item in a range of cells
494
+     *
495
+     * Excel Function:
496
+     *        =MATCH(lookup_value, lookup_array, [match_type])
497
+     *
498
+     * @param    lookup_value    The value that you want to match in lookup_array
499
+     * @param    lookup_array    The range of cells being searched
500
+     * @param    match_type        The number -1, 0, or 1. -1 means above, 0 means exact match, 1 means below. If match_type is 1 or -1, the list has to be ordered.
501
+     * @return    integer            The relative position of the found item
502
+     */
503
+    public static function MATCH($lookup_value, $lookup_array, $match_type = 1)
504
+    {
505
+        $lookup_array = PHPExcel_Calculation_Functions::flattenArray($lookup_array);
506
+        $lookup_value = PHPExcel_Calculation_Functions::flattenSingleValue($lookup_value);
507
+        $match_type    = (is_null($match_type)) ? 1 : (int) PHPExcel_Calculation_Functions::flattenSingleValue($match_type);
508
+        //    MATCH is not case sensitive
509
+        $lookup_value = strtolower($lookup_value);
510
+
511
+        //    lookup_value type has to be number, text, or logical values
512
+        if ((!is_numeric($lookup_value)) && (!is_string($lookup_value)) && (!is_bool($lookup_value))) {
513
+            return PHPExcel_Calculation_Functions::NA();
514
+        }
515
+
516
+        //    match_type is 0, 1 or -1
517
+        if (($match_type !== 0) && ($match_type !== -1) && ($match_type !== 1)) {
518
+            return PHPExcel_Calculation_Functions::NA();
519
+        }
520
+
521
+        //    lookup_array should not be empty
522
+        $lookupArraySize = count($lookup_array);
523
+        if ($lookupArraySize <= 0) {
524
+            return PHPExcel_Calculation_Functions::NA();
525
+        }
526
+
527
+        //    lookup_array should contain only number, text, or logical values, or empty (null) cells
528
+        foreach ($lookup_array as $i => $lookupArrayValue) {
529
+            //    check the type of the value
530
+            if ((!is_numeric($lookupArrayValue)) && (!is_string($lookupArrayValue)) &&
531
+                (!is_bool($lookupArrayValue)) && (!is_null($lookupArrayValue))) {
532
+                return PHPExcel_Calculation_Functions::NA();
533
+            }
534
+            //    convert strings to lowercase for case-insensitive testing
535
+            if (is_string($lookupArrayValue)) {
536
+                $lookup_array[$i] = strtolower($lookupArrayValue);
537
+            }
538
+            if ((is_null($lookupArrayValue)) && (($match_type == 1) || ($match_type == -1))) {
539
+                $lookup_array = array_slice($lookup_array, 0, $i-1);
540
+            }
541
+        }
542
+
543
+        // if match_type is 1 or -1, the list has to be ordered
544
+        if ($match_type == 1) {
545
+            asort($lookup_array);
546
+            $keySet = array_keys($lookup_array);
547
+        } elseif ($match_type == -1) {
548
+            arsort($lookup_array);
549
+            $keySet = array_keys($lookup_array);
550
+        }
551
+
552
+        // **
553
+        // find the match
554
+        // **
555
+        foreach ($lookup_array as $i => $lookupArrayValue) {
556
+            if (($match_type == 0) && ($lookupArrayValue == $lookup_value)) {
557
+                //    exact match
558
+                return ++$i;
559
+            } elseif (($match_type == -1) && ($lookupArrayValue <= $lookup_value)) {
560
+                $i = array_search($i, $keySet);
561
+                // if match_type is -1 <=> find the smallest value that is greater than or equal to lookup_value
562
+                if ($i < 1) {
563
+                    // 1st cell was already smaller than the lookup_value
564
+                    break;
565
+                } else {
566
+                    // the previous cell was the match
567
+                    return $keySet[$i-1]+1;
568
+                }
569
+            } elseif (($match_type == 1) && ($lookupArrayValue >= $lookup_value)) {
570
+                $i = array_search($i, $keySet);
571
+                // if match_type is 1 <=> find the largest value that is less than or equal to lookup_value
572
+                if ($i < 1) {
573
+                    // 1st cell was already bigger than the lookup_value
574
+                    break;
575
+                } else {
576
+                    // the previous cell was the match
577
+                    return $keySet[$i-1]+1;
578
+                }
579
+            }
580
+        }
581
+
582
+        //    unsuccessful in finding a match, return #N/A error value
583
+        return PHPExcel_Calculation_Functions::NA();
584
+    }
585
+
586
+
587
+    /**
588
+     * INDEX
589
+     *
590
+     * Uses an index to choose a value from a reference or array
591
+     *
592
+     * Excel Function:
593
+     *        =INDEX(range_array, row_num, [column_num])
594
+     *
595
+     * @param    range_array        A range of cells or an array constant
596
+     * @param    row_num            The row in array from which to return a value. If row_num is omitted, column_num is required.
597
+     * @param    column_num        The column in array from which to return a value. If column_num is omitted, row_num is required.
598
+     * @return    mixed            the value of a specified cell or array of cells
599
+     */
600
+    public static function INDEX($arrayValues, $rowNum = 0, $columnNum = 0)
601
+    {
602
+        if (($rowNum < 0) || ($columnNum < 0)) {
603
+            return PHPExcel_Calculation_Functions::VALUE();
604
+        }
605
+
606
+        if (!is_array($arrayValues)) {
607
+            return PHPExcel_Calculation_Functions::REF();
608
+        }
609
+
610
+        $rowKeys = array_keys($arrayValues);
611
+        $columnKeys = @array_keys($arrayValues[$rowKeys[0]]);
612
+
613
+        if ($columnNum > count($columnKeys)) {
614
+            return PHPExcel_Calculation_Functions::VALUE();
615
+        } elseif ($columnNum == 0) {
616
+            if ($rowNum == 0) {
617
+                return $arrayValues;
618
+            }
619
+            $rowNum = $rowKeys[--$rowNum];
620
+            $returnArray = array();
621
+            foreach ($arrayValues as $arrayColumn) {
622
+                if (is_array($arrayColumn)) {
623
+                    if (isset($arrayColumn[$rowNum])) {
624
+                        $returnArray[] = $arrayColumn[$rowNum];
625
+                    } else {
626
+                        return $arrayValues[$rowNum];
627
+                    }
628
+                } else {
629
+                    return $arrayValues[$rowNum];
630
+                }
631
+            }
632
+            return $returnArray;
633
+        }
634
+        $columnNum = $columnKeys[--$columnNum];
635
+        if ($rowNum > count($rowKeys)) {
636
+            return PHPExcel_Calculation_Functions::VALUE();
637
+        } elseif ($rowNum == 0) {
638
+            return $arrayValues[$columnNum];
639
+        }
640
+        $rowNum = $rowKeys[--$rowNum];
641
+
642
+        return $arrayValues[$rowNum][$columnNum];
643
+    }
644
+
645
+
646
+    /**
647
+     * TRANSPOSE
648
+     *
649
+     * @param    array    $matrixData    A matrix of values
650
+     * @return    array
651
+     *
652
+     * Unlike the Excel TRANSPOSE function, which will only work on a single row or column, this function will transpose a full matrix.
653
+     */
654
+    public static function TRANSPOSE($matrixData)
655
+    {
656
+        $returnMatrix = array();
657
+        if (!is_array($matrixData)) {
658
+            $matrixData = array(array($matrixData));
659
+        }
660
+
661
+        $column = 0;
662
+        foreach ($matrixData as $matrixRow) {
663
+            $row = 0;
664
+            foreach ($matrixRow as $matrixCell) {
665
+                $returnMatrix[$row][$column] = $matrixCell;
666
+                ++$row;
667
+            }
668
+            ++$column;
669
+        }
670
+        return $returnMatrix;
671
+    }
672
+
673
+
674
+    private static function vlookupSort($a, $b)
675
+    {
676
+        reset($a);
677
+        $firstColumn = key($a);
678
+        if (($aLower = strtolower($a[$firstColumn])) == ($bLower = strtolower($b[$firstColumn]))) {
679
+            return 0;
680
+        }
681
+        return ($aLower < $bLower) ? -1 : 1;
682
+    }
683
+
684
+
685
+    /**
686
+     * VLOOKUP
687
+     * The VLOOKUP function searches for value in the left-most column of lookup_array and returns the value in the same row based on the index_number.
688
+     * @param    lookup_value    The value that you want to match in lookup_array
689
+     * @param    lookup_array    The range of cells being searched
690
+     * @param    index_number    The column number in table_array from which the matching value must be returned. The first column is 1.
691
+     * @param    not_exact_match    Determines if you are looking for an exact match based on lookup_value.
692
+     * @return    mixed            The value of the found cell
693
+     */
694
+    public static function VLOOKUP($lookup_value, $lookup_array, $index_number, $not_exact_match = true)
695
+    {
696
+        $lookup_value    = PHPExcel_Calculation_Functions::flattenSingleValue($lookup_value);
697
+        $index_number    = PHPExcel_Calculation_Functions::flattenSingleValue($index_number);
698
+        $not_exact_match = PHPExcel_Calculation_Functions::flattenSingleValue($not_exact_match);
699
+
700
+        // index_number must be greater than or equal to 1
701
+        if ($index_number < 1) {
702
+            return PHPExcel_Calculation_Functions::VALUE();
703
+        }
704
+
705
+        // index_number must be less than or equal to the number of columns in lookup_array
706
+        if ((!is_array($lookup_array)) || (empty($lookup_array))) {
707
+            return PHPExcel_Calculation_Functions::REF();
708
+        } else {
709
+            $f = array_keys($lookup_array);
710
+            $firstRow = array_pop($f);
711
+            if ((!is_array($lookup_array[$firstRow])) || ($index_number > count($lookup_array[$firstRow]))) {
712
+                return PHPExcel_Calculation_Functions::REF();
713
+            } else {
714
+                $columnKeys = array_keys($lookup_array[$firstRow]);
715
+                $returnColumn = $columnKeys[--$index_number];
716
+                $firstColumn = array_shift($columnKeys);
717
+            }
718
+        }
719
+
720
+        if (!$not_exact_match) {
721
+            uasort($lookup_array, array('self', 'vlookupSort'));
722
+        }
723
+
724
+        $rowNumber = $rowValue = false;
725
+        foreach ($lookup_array as $rowKey => $rowData) {
726
+            if ((is_numeric($lookup_value) && is_numeric($rowData[$firstColumn]) && ($rowData[$firstColumn] > $lookup_value)) ||
727
+                (!is_numeric($lookup_value) && !is_numeric($rowData[$firstColumn]) && (strtolower($rowData[$firstColumn]) > strtolower($lookup_value)))) {
728
+                break;
729
+            }
730
+            $rowNumber = $rowKey;
731
+            $rowValue = $rowData[$firstColumn];
732
+        }
733
+
734
+        if ($rowNumber !== false) {
735
+            if ((!$not_exact_match) && ($rowValue != $lookup_value)) {
736
+                //    if an exact match is required, we have what we need to return an appropriate response
737
+                return PHPExcel_Calculation_Functions::NA();
738
+            } else {
739
+                //    otherwise return the appropriate value
740
+                return $lookup_array[$rowNumber][$returnColumn];
741
+            }
742
+        }
743
+
744
+        return PHPExcel_Calculation_Functions::NA();
745
+    }
746
+
747
+
748
+    /**
749
+     * HLOOKUP
750
+     * The HLOOKUP function searches for value in the top-most row of lookup_array and returns the value in the same column based on the index_number.
751
+     * @param    lookup_value    The value that you want to match in lookup_array
752
+     * @param    lookup_array    The range of cells being searched
753
+     * @param    index_number    The row number in table_array from which the matching value must be returned. The first row is 1.
754
+     * @param    not_exact_match Determines if you are looking for an exact match based on lookup_value.
755
+     * @return   mixed           The value of the found cell
756
+     */
757
+    public static function HLOOKUP($lookup_value, $lookup_array, $index_number, $not_exact_match = true)
758
+    {
759
+        $lookup_value   = PHPExcel_Calculation_Functions::flattenSingleValue($lookup_value);
760
+        $index_number   = PHPExcel_Calculation_Functions::flattenSingleValue($index_number);
761
+        $not_exact_match    = PHPExcel_Calculation_Functions::flattenSingleValue($not_exact_match);
762
+
763
+        // index_number must be greater than or equal to 1
764
+        if ($index_number < 1) {
765
+            return PHPExcel_Calculation_Functions::VALUE();
766
+        }
767
+
768
+        // index_number must be less than or equal to the number of columns in lookup_array
769
+        if ((!is_array($lookup_array)) || (empty($lookup_array))) {
770
+            return PHPExcel_Calculation_Functions::REF();
771
+        } else {
772
+            $f = array_keys($lookup_array);
773
+            $firstRow = array_pop($f);
774
+            if ((!is_array($lookup_array[$firstRow])) || ($index_number > count($lookup_array[$firstRow]))) {
775
+                return PHPExcel_Calculation_Functions::REF();
776
+            } else {
777
+                $columnKeys = array_keys($lookup_array[$firstRow]);
778
+                                $firstkey = $f[0] - 1;
779
+                $returnColumn = $firstkey + $index_number;
780
+                $firstColumn = array_shift($f);
781
+            }
782
+        }
783
+
784
+        if (!$not_exact_match) {
785
+            $firstRowH = asort($lookup_array[$firstColumn]);
786
+        }
787
+
788
+        $rowNumber = $rowValue = false;
789
+        foreach ($lookup_array[$firstColumn] as $rowKey => $rowData) {
790
+            if ((is_numeric($lookup_value) && is_numeric($rowData) && ($rowData > $lookup_value)) ||
791
+                (!is_numeric($lookup_value) && !is_numeric($rowData) && (strtolower($rowData) > strtolower($lookup_value)))) {
792
+                break;
793
+            }
794
+            $rowNumber = $rowKey;
795
+            $rowValue = $rowData;
796
+        }
797
+
798
+        if ($rowNumber !== false) {
799
+            if ((!$not_exact_match) && ($rowValue != $lookup_value)) {
800
+                //  if an exact match is required, we have what we need to return an appropriate response
801
+                return PHPExcel_Calculation_Functions::NA();
802
+            } else {
803
+                //  otherwise return the appropriate value
804
+                return $lookup_array[$returnColumn][$rowNumber];
805
+            }
806
+        }
807
+
808
+        return PHPExcel_Calculation_Functions::NA();
809
+    }
810
+
811
+
812
+    /**
813
+     * LOOKUP
814
+     * The LOOKUP function searches for value either from a one-row or one-column range or from an array.
815
+     * @param    lookup_value    The value that you want to match in lookup_array
816
+     * @param    lookup_vector    The range of cells being searched
817
+     * @param    result_vector    The column from which the matching value must be returned
818
+     * @return    mixed            The value of the found cell
819
+     */
820
+    public static function LOOKUP($lookup_value, $lookup_vector, $result_vector = null)
821
+    {
822
+        $lookup_value = PHPExcel_Calculation_Functions::flattenSingleValue($lookup_value);
823
+
824
+        if (!is_array($lookup_vector)) {
825
+            return PHPExcel_Calculation_Functions::NA();
826
+        }
827
+        $lookupRows = count($lookup_vector);
828
+        $l = array_keys($lookup_vector);
829
+        $l = array_shift($l);
830
+        $lookupColumns = count($lookup_vector[$l]);
831
+        if ((($lookupRows == 1) && ($lookupColumns > 1)) || (($lookupRows == 2) && ($lookupColumns != 2))) {
832
+            $lookup_vector = self::TRANSPOSE($lookup_vector);
833
+            $lookupRows = count($lookup_vector);
834
+            $l = array_keys($lookup_vector);
835
+            $lookupColumns = count($lookup_vector[array_shift($l)]);
836
+        }
837
+
838
+        if (is_null($result_vector)) {
839
+            $result_vector = $lookup_vector;
840
+        }
841
+        $resultRows = count($result_vector);
842
+        $l = array_keys($result_vector);
843
+        $l = array_shift($l);
844
+        $resultColumns = count($result_vector[$l]);
845
+        if ((($resultRows == 1) && ($resultColumns > 1)) || (($resultRows == 2) && ($resultColumns != 2))) {
846
+            $result_vector = self::TRANSPOSE($result_vector);
847
+            $resultRows = count($result_vector);
848
+            $r = array_keys($result_vector);
849
+            $resultColumns = count($result_vector[array_shift($r)]);
850
+        }
851
+
852
+        if ($lookupRows == 2) {
853
+            $result_vector = array_pop($lookup_vector);
854
+            $lookup_vector = array_shift($lookup_vector);
855
+        }
856
+        if ($lookupColumns != 2) {
857
+            foreach ($lookup_vector as &$value) {
858
+                if (is_array($value)) {
859
+                    $k = array_keys($value);
860
+                    $key1 = $key2 = array_shift($k);
861
+                    $key2++;
862
+                    $dataValue1 = $value[$key1];
863
+                } else {
864
+                    $key1 = 0;
865
+                    $key2 = 1;
866
+                    $dataValue1 = $value;
867
+                }
868
+                $dataValue2 = array_shift($result_vector);
869
+                if (is_array($dataValue2)) {
870
+                    $dataValue2 = array_shift($dataValue2);
871
+                }
872
+                $value = array($key1 => $dataValue1, $key2 => $dataValue2);
873
+            }
874
+            unset($value);
875
+        }
876
+
877
+        return self::VLOOKUP($lookup_value, $lookup_vector, 2);
878
+    }
879
+}

+ 1459
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/MathTrig.php
File diff suppressed because it is too large
View File


+ 3745
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Statistical.php
File diff suppressed because it is too large
View File


+ 651
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/TextData.php View File

@@ -0,0 +1,651 @@
1
+<?php
2
+
3
+/** PHPExcel root directory */
4
+if (!defined('PHPEXCEL_ROOT')) {
5
+    /**
6
+     * @ignore
7
+     */
8
+    define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
9
+    require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
10
+}
11
+
12
+/**
13
+ * PHPExcel_Calculation_TextData
14
+ *
15
+ * Copyright (c) 2006 - 2015 PHPExcel
16
+ *
17
+ * This library is free software; you can redistribute it and/or
18
+ * modify it under the terms of the GNU Lesser General Public
19
+ * License as published by the Free Software Foundation; either
20
+ * version 2.1 of the License, or (at your option) any later version.
21
+ *
22
+ * This library is distributed in the hope that it will be useful,
23
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
24
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
25
+ * Lesser General Public License for more details.
26
+ *
27
+ * You should have received a copy of the GNU Lesser General Public
28
+ * License along with this library; if not, write to the Free Software
29
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
30
+ *
31
+ * @category    PHPExcel
32
+ * @package        PHPExcel_Calculation
33
+ * @copyright    Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
34
+ * @license        http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
35
+ * @version        ##VERSION##, ##DATE##
36
+ */
37
+class PHPExcel_Calculation_TextData
38
+{
39
+    private static $invalidChars;
40
+
41
+    private static function unicodeToOrd($c)
42
+    {
43
+        if (ord($c{0}) >=0 && ord($c{0}) <= 127) {
44
+            return ord($c{0});
45
+        } elseif (ord($c{0}) >= 192 && ord($c{0}) <= 223) {
46
+            return (ord($c{0})-192)*64 + (ord($c{1})-128);
47
+        } elseif (ord($c{0}) >= 224 && ord($c{0}) <= 239) {
48
+            return (ord($c{0})-224)*4096 + (ord($c{1})-128)*64 + (ord($c{2})-128);
49
+        } elseif (ord($c{0}) >= 240 && ord($c{0}) <= 247) {
50
+            return (ord($c{0})-240)*262144 + (ord($c{1})-128)*4096 + (ord($c{2})-128)*64 + (ord($c{3})-128);
51
+        } elseif (ord($c{0}) >= 248 && ord($c{0}) <= 251) {
52
+            return (ord($c{0})-248)*16777216 + (ord($c{1})-128)*262144 + (ord($c{2})-128)*4096 + (ord($c{3})-128)*64 + (ord($c{4})-128);
53
+        } elseif (ord($c{0}) >= 252 && ord($c{0}) <= 253) {
54
+            return (ord($c{0})-252)*1073741824 + (ord($c{1})-128)*16777216 + (ord($c{2})-128)*262144 + (ord($c{3})-128)*4096 + (ord($c{4})-128)*64 + (ord($c{5})-128);
55
+        } elseif (ord($c{0}) >= 254 && ord($c{0}) <= 255) {
56
+            // error
57
+            return PHPExcel_Calculation_Functions::VALUE();
58
+        }
59
+        return 0;
60
+    }
61
+
62
+    /**
63
+     * CHARACTER
64
+     *
65
+     * @param    string    $character    Value
66
+     * @return    int
67
+     */
68
+    public static function CHARACTER($character)
69
+    {
70
+        $character = PHPExcel_Calculation_Functions::flattenSingleValue($character);
71
+
72
+        if ((!is_numeric($character)) || ($character < 0)) {
73
+            return PHPExcel_Calculation_Functions::VALUE();
74
+        }
75
+
76
+        if (function_exists('mb_convert_encoding')) {
77
+            return mb_convert_encoding('&#'.intval($character).';', 'UTF-8', 'HTML-ENTITIES');
78
+        } else {
79
+            return chr(intval($character));
80
+        }
81
+    }
82
+
83
+
84
+    /**
85
+     * TRIMNONPRINTABLE
86
+     *
87
+     * @param    mixed    $stringValue    Value to check
88
+     * @return    string
89
+     */
90
+    public static function TRIMNONPRINTABLE($stringValue = '')
91
+    {
92
+        $stringValue    = PHPExcel_Calculation_Functions::flattenSingleValue($stringValue);
93
+
94
+        if (is_bool($stringValue)) {
95
+            return ($stringValue) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
96
+        }
97
+
98
+        if (self::$invalidChars == null) {
99
+            self::$invalidChars = range(chr(0), chr(31));
100
+        }
101
+
102
+        if (is_string($stringValue) || is_numeric($stringValue)) {
103
+            return str_replace(self::$invalidChars, '', trim($stringValue, "\x00..\x1F"));
104
+        }
105
+        return null;
106
+    }
107
+
108
+
109
+    /**
110
+     * TRIMSPACES
111
+     *
112
+     * @param    mixed    $stringValue    Value to check
113
+     * @return    string
114
+     */
115
+    public static function TRIMSPACES($stringValue = '')
116
+    {
117
+        $stringValue = PHPExcel_Calculation_Functions::flattenSingleValue($stringValue);
118
+        if (is_bool($stringValue)) {
119
+            return ($stringValue) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
120
+        }
121
+
122
+        if (is_string($stringValue) || is_numeric($stringValue)) {
123
+            return trim(preg_replace('/ +/', ' ', trim($stringValue, ' ')), ' ');
124
+        }
125
+        return null;
126
+    }
127
+
128
+
129
+    /**
130
+     * ASCIICODE
131
+     *
132
+     * @param    string    $characters        Value
133
+     * @return    int
134
+     */
135
+    public static function ASCIICODE($characters)
136
+    {
137
+        if (($characters === null) || ($characters === '')) {
138
+            return PHPExcel_Calculation_Functions::VALUE();
139
+        }
140
+        $characters    = PHPExcel_Calculation_Functions::flattenSingleValue($characters);
141
+        if (is_bool($characters)) {
142
+            if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) {
143
+                $characters = (int) $characters;
144
+            } else {
145
+                $characters = ($characters) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
146
+            }
147
+        }
148
+
149
+        $character = $characters;
150
+        if ((function_exists('mb_strlen')) && (function_exists('mb_substr'))) {
151
+            if (mb_strlen($characters, 'UTF-8') > 1) {
152
+                $character = mb_substr($characters, 0, 1, 'UTF-8');
153
+            }
154
+            return self::unicodeToOrd($character);
155
+        } else {
156
+            if (strlen($characters) > 0) {
157
+                $character = substr($characters, 0, 1);
158
+            }
159
+            return ord($character);
160
+        }
161
+    }
162
+
163
+
164
+    /**
165
+     * CONCATENATE
166
+     *
167
+     * @return    string
168
+     */
169
+    public static function CONCATENATE()
170
+    {
171
+        $returnValue = '';
172
+
173
+        // Loop through arguments
174
+        $aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
175
+        foreach ($aArgs as $arg) {
176
+            if (is_bool($arg)) {
177
+                if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) {
178
+                    $arg = (int) $arg;
179
+                } else {
180
+                    $arg = ($arg) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
181
+                }
182
+            }
183
+            $returnValue .= $arg;
184
+        }
185
+
186
+        return $returnValue;
187
+    }
188
+
189
+
190
+    /**
191
+     * DOLLAR
192
+     *
193
+     * This function converts a number to text using currency format, with the decimals rounded to the specified place.
194
+     * The format used is $#,##0.00_);($#,##0.00)..
195
+     *
196
+     * @param    float    $value            The value to format
197
+     * @param    int        $decimals        The number of digits to display to the right of the decimal point.
198
+     *                                    If decimals is negative, number is rounded to the left of the decimal point.
199
+     *                                    If you omit decimals, it is assumed to be 2
200
+     * @return    string
201
+     */
202
+    public static function DOLLAR($value = 0, $decimals = 2)
203
+    {
204
+        $value        = PHPExcel_Calculation_Functions::flattenSingleValue($value);
205
+        $decimals    = is_null($decimals) ? 0 : PHPExcel_Calculation_Functions::flattenSingleValue($decimals);
206
+
207
+        // Validate parameters
208
+        if (!is_numeric($value) || !is_numeric($decimals)) {
209
+            return PHPExcel_Calculation_Functions::NaN();
210
+        }
211
+        $decimals = floor($decimals);
212
+
213
+        $mask = '$#,##0';
214
+        if ($decimals > 0) {
215
+            $mask .= '.' . str_repeat('0', $decimals);
216
+        } else {
217
+            $round = pow(10, abs($decimals));
218
+            if ($value < 0) {
219
+                $round = 0-$round;
220
+            }
221
+            $value = PHPExcel_Calculation_MathTrig::MROUND($value, $round);
222
+        }
223
+
224
+        return PHPExcel_Style_NumberFormat::toFormattedString($value, $mask);
225
+
226
+    }
227
+
228
+
229
+    /**
230
+     * SEARCHSENSITIVE
231
+     *
232
+     * @param    string    $needle        The string to look for
233
+     * @param    string    $haystack    The string in which to look
234
+     * @param    int        $offset        Offset within $haystack
235
+     * @return    string
236
+     */
237
+    public static function SEARCHSENSITIVE($needle, $haystack, $offset = 1)
238
+    {
239
+        $needle   = PHPExcel_Calculation_Functions::flattenSingleValue($needle);
240
+        $haystack = PHPExcel_Calculation_Functions::flattenSingleValue($haystack);
241
+        $offset   = PHPExcel_Calculation_Functions::flattenSingleValue($offset);
242
+
243
+        if (!is_bool($needle)) {
244
+            if (is_bool($haystack)) {
245
+                $haystack = ($haystack) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
246
+            }
247
+
248
+            if (($offset > 0) && (PHPExcel_Shared_String::CountCharacters($haystack) > $offset)) {
249
+                if (PHPExcel_Shared_String::CountCharacters($needle) == 0) {
250
+                    return $offset;
251
+                }
252
+                if (function_exists('mb_strpos')) {
253
+                    $pos = mb_strpos($haystack, $needle, --$offset, 'UTF-8');
254
+                } else {
255
+                    $pos = strpos($haystack, $needle, --$offset);
256
+                }
257
+                if ($pos !== false) {
258
+                    return ++$pos;
259
+                }
260
+            }
261
+        }
262
+        return PHPExcel_Calculation_Functions::VALUE();
263
+    }
264
+
265
+
266
+    /**
267
+     * SEARCHINSENSITIVE
268
+     *
269
+     * @param    string    $needle        The string to look for
270
+     * @param    string    $haystack    The string in which to look
271
+     * @param    int        $offset        Offset within $haystack
272
+     * @return    string
273
+     */
274
+    public static function SEARCHINSENSITIVE($needle, $haystack, $offset = 1)
275
+    {
276
+        $needle   = PHPExcel_Calculation_Functions::flattenSingleValue($needle);
277
+        $haystack = PHPExcel_Calculation_Functions::flattenSingleValue($haystack);
278
+        $offset   = PHPExcel_Calculation_Functions::flattenSingleValue($offset);
279
+
280
+        if (!is_bool($needle)) {
281
+            if (is_bool($haystack)) {
282
+                $haystack = ($haystack) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
283
+            }
284
+
285
+            if (($offset > 0) && (PHPExcel_Shared_String::CountCharacters($haystack) > $offset)) {
286
+                if (PHPExcel_Shared_String::CountCharacters($needle) == 0) {
287
+                    return $offset;
288
+                }
289
+                if (function_exists('mb_stripos')) {
290
+                    $pos = mb_stripos($haystack, $needle, --$offset, 'UTF-8');
291
+                } else {
292
+                    $pos = stripos($haystack, $needle, --$offset);
293
+                }
294
+                if ($pos !== false) {
295
+                    return ++$pos;
296
+                }
297
+            }
298
+        }
299
+        return PHPExcel_Calculation_Functions::VALUE();
300
+    }
301
+
302
+
303
+    /**
304
+     * FIXEDFORMAT
305
+     *
306
+     * @param    mixed        $value    Value to check
307
+     * @param    integer        $decimals
308
+     * @param    boolean        $no_commas
309
+     * @return    boolean
310
+     */
311
+    public static function FIXEDFORMAT($value, $decimals = 2, $no_commas = false)
312
+    {
313
+        $value     = PHPExcel_Calculation_Functions::flattenSingleValue($value);
314
+        $decimals  = PHPExcel_Calculation_Functions::flattenSingleValue($decimals);
315
+        $no_commas = PHPExcel_Calculation_Functions::flattenSingleValue($no_commas);
316
+
317
+        // Validate parameters
318
+        if (!is_numeric($value) || !is_numeric($decimals)) {
319
+            return PHPExcel_Calculation_Functions::NaN();
320
+        }
321
+        $decimals = floor($decimals);
322
+
323
+        $valueResult = round($value, $decimals);
324
+        if ($decimals < 0) {
325
+            $decimals = 0;
326
+        }
327
+        if (!$no_commas) {
328
+            $valueResult = number_format($valueResult, $decimals);
329
+        }
330
+
331
+        return (string) $valueResult;
332
+    }
333
+
334
+
335
+    /**
336
+     * LEFT
337
+     *
338
+     * @param    string    $value    Value
339
+     * @param    int        $chars    Number of characters
340
+     * @return    string
341
+     */
342
+    public static function LEFT($value = '', $chars = 1)
343
+    {
344
+        $value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
345
+        $chars = PHPExcel_Calculation_Functions::flattenSingleValue($chars);
346
+
347
+        if ($chars < 0) {
348
+            return PHPExcel_Calculation_Functions::VALUE();
349
+        }
350
+
351
+        if (is_bool($value)) {
352
+            $value = ($value) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
353
+        }
354
+
355
+        if (function_exists('mb_substr')) {
356
+            return mb_substr($value, 0, $chars, 'UTF-8');
357
+        } else {
358
+            return substr($value, 0, $chars);
359
+        }
360
+    }
361
+
362
+
363
+    /**
364
+     * MID
365
+     *
366
+     * @param    string    $value    Value
367
+     * @param    int        $start    Start character
368
+     * @param    int        $chars    Number of characters
369
+     * @return    string
370
+     */
371
+    public static function MID($value = '', $start = 1, $chars = null)
372
+    {
373
+        $value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
374
+        $start = PHPExcel_Calculation_Functions::flattenSingleValue($start);
375
+        $chars = PHPExcel_Calculation_Functions::flattenSingleValue($chars);
376
+
377
+        if (($start < 1) || ($chars < 0)) {
378
+            return PHPExcel_Calculation_Functions::VALUE();
379
+        }
380
+
381
+        if (is_bool($value)) {
382
+            $value = ($value) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
383
+        }
384
+
385
+        if (function_exists('mb_substr')) {
386
+            return mb_substr($value, --$start, $chars, 'UTF-8');
387
+        } else {
388
+            return substr($value, --$start, $chars);
389
+        }
390
+    }
391
+
392
+
393
+    /**
394
+     * RIGHT
395
+     *
396
+     * @param    string    $value    Value
397
+     * @param    int        $chars    Number of characters
398
+     * @return    string
399
+     */
400
+    public static function RIGHT($value = '', $chars = 1)
401
+    {
402
+        $value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
403
+        $chars = PHPExcel_Calculation_Functions::flattenSingleValue($chars);
404
+
405
+        if ($chars < 0) {
406
+            return PHPExcel_Calculation_Functions::VALUE();
407
+        }
408
+
409
+        if (is_bool($value)) {
410
+            $value = ($value) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
411
+        }
412
+
413
+        if ((function_exists('mb_substr')) && (function_exists('mb_strlen'))) {
414
+            return mb_substr($value, mb_strlen($value, 'UTF-8') - $chars, $chars, 'UTF-8');
415
+        } else {
416
+            return substr($value, strlen($value) - $chars);
417
+        }
418
+    }
419
+
420
+
421
+    /**
422
+     * STRINGLENGTH
423
+     *
424
+     * @param    string    $value    Value
425
+     * @return    string
426
+     */
427
+    public static function STRINGLENGTH($value = '')
428
+    {
429
+        $value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
430
+
431
+        if (is_bool($value)) {
432
+            $value = ($value) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
433
+        }
434
+
435
+        if (function_exists('mb_strlen')) {
436
+            return mb_strlen($value, 'UTF-8');
437
+        } else {
438
+            return strlen($value);
439
+        }
440
+    }
441
+
442
+
443
+    /**
444
+     * LOWERCASE
445
+     *
446
+     * Converts a string value to upper case.
447
+     *
448
+     * @param    string        $mixedCaseString
449
+     * @return    string
450
+     */
451
+    public static function LOWERCASE($mixedCaseString)
452
+    {
453
+        $mixedCaseString = PHPExcel_Calculation_Functions::flattenSingleValue($mixedCaseString);
454
+
455
+        if (is_bool($mixedCaseString)) {
456
+            $mixedCaseString = ($mixedCaseString) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
457
+        }
458
+
459
+        return PHPExcel_Shared_String::StrToLower($mixedCaseString);
460
+    }
461
+
462
+
463
+    /**
464
+     * UPPERCASE
465
+     *
466
+     * Converts a string value to upper case.
467
+     *
468
+     * @param    string        $mixedCaseString
469
+     * @return    string
470
+     */
471
+    public static function UPPERCASE($mixedCaseString)
472
+    {
473
+        $mixedCaseString = PHPExcel_Calculation_Functions::flattenSingleValue($mixedCaseString);
474
+
475
+        if (is_bool($mixedCaseString)) {
476
+            $mixedCaseString = ($mixedCaseString) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
477
+        }
478
+
479
+        return PHPExcel_Shared_String::StrToUpper($mixedCaseString);
480
+    }
481
+
482
+
483
+    /**
484
+     * PROPERCASE
485
+     *
486
+     * Converts a string value to upper case.
487
+     *
488
+     * @param    string        $mixedCaseString
489
+     * @return    string
490
+     */
491
+    public static function PROPERCASE($mixedCaseString)
492
+    {
493
+        $mixedCaseString = PHPExcel_Calculation_Functions::flattenSingleValue($mixedCaseString);
494
+
495
+        if (is_bool($mixedCaseString)) {
496
+            $mixedCaseString = ($mixedCaseString) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
497
+        }
498
+
499
+        return PHPExcel_Shared_String::StrToTitle($mixedCaseString);
500
+    }
501
+
502
+
503
+    /**
504
+     * REPLACE
505
+     *
506
+     * @param    string    $oldText    String to modify
507
+     * @param    int        $start        Start character
508
+     * @param    int        $chars        Number of characters
509
+     * @param    string    $newText    String to replace in defined position
510
+     * @return    string
511
+     */
512
+    public static function REPLACE($oldText = '', $start = 1, $chars = null, $newText)
513
+    {
514
+        $oldText = PHPExcel_Calculation_Functions::flattenSingleValue($oldText);
515
+        $start   = PHPExcel_Calculation_Functions::flattenSingleValue($start);
516
+        $chars   = PHPExcel_Calculation_Functions::flattenSingleValue($chars);
517
+        $newText = PHPExcel_Calculation_Functions::flattenSingleValue($newText);
518
+
519
+        $left = self::LEFT($oldText, $start-1);
520
+        $right = self::RIGHT($oldText, self::STRINGLENGTH($oldText)-($start+$chars)+1);
521
+
522
+        return $left.$newText.$right;
523
+    }
524
+
525
+
526
+    /**
527
+     * SUBSTITUTE
528
+     *
529
+     * @param    string    $text        Value
530
+     * @param    string    $fromText    From Value
531
+     * @param    string    $toText        To Value
532
+     * @param    integer    $instance    Instance Number
533
+     * @return    string
534
+     */
535
+    public static function SUBSTITUTE($text = '', $fromText = '', $toText = '', $instance = 0)
536
+    {
537
+        $text     = PHPExcel_Calculation_Functions::flattenSingleValue($text);
538
+        $fromText = PHPExcel_Calculation_Functions::flattenSingleValue($fromText);
539
+        $toText   = PHPExcel_Calculation_Functions::flattenSingleValue($toText);
540
+        $instance = floor(PHPExcel_Calculation_Functions::flattenSingleValue($instance));
541
+
542
+        if ($instance == 0) {
543
+            if (function_exists('mb_str_replace')) {
544
+                return mb_str_replace($fromText, $toText, $text);
545
+            } else {
546
+                return str_replace($fromText, $toText, $text);
547
+            }
548
+        } else {
549
+            $pos = -1;
550
+            while ($instance > 0) {
551
+                if (function_exists('mb_strpos')) {
552
+                    $pos = mb_strpos($text, $fromText, $pos+1, 'UTF-8');
553
+                } else {
554
+                    $pos = strpos($text, $fromText, $pos+1);
555
+                }
556
+                if ($pos === false) {
557
+                    break;
558
+                }
559
+                --$instance;
560
+            }
561
+            if ($pos !== false) {
562
+                if (function_exists('mb_strlen')) {
563
+                    return self::REPLACE($text, ++$pos, mb_strlen($fromText, 'UTF-8'), $toText);
564
+                } else {
565
+                    return self::REPLACE($text, ++$pos, strlen($fromText), $toText);
566
+                }
567
+            }
568
+        }
569
+
570
+        return $text;
571
+    }
572
+
573
+
574
+    /**
575
+     * RETURNSTRING
576
+     *
577
+     * @param    mixed    $testValue    Value to check
578
+     * @return    boolean
579
+     */
580
+    public static function RETURNSTRING($testValue = '')
581
+    {
582
+        $testValue = PHPExcel_Calculation_Functions::flattenSingleValue($testValue);
583
+
584
+        if (is_string($testValue)) {
585
+            return $testValue;
586
+        }
587
+        return null;
588
+    }
589
+
590
+
591
+    /**
592
+     * TEXTFORMAT
593
+     *
594
+     * @param    mixed    $value    Value to check
595
+     * @param    string    $format    Format mask to use
596
+     * @return    boolean
597
+     */
598
+    public static function TEXTFORMAT($value, $format)
599
+    {
600
+        $value  = PHPExcel_Calculation_Functions::flattenSingleValue($value);
601
+        $format = PHPExcel_Calculation_Functions::flattenSingleValue($format);
602
+
603
+        if ((is_string($value)) && (!is_numeric($value)) && PHPExcel_Shared_Date::isDateTimeFormatCode($format)) {
604
+            $value = PHPExcel_Calculation_DateTime::DATEVALUE($value);
605
+        }
606
+
607
+        return (string) PHPExcel_Style_NumberFormat::toFormattedString($value, $format);
608
+    }
609
+
610
+    /**
611
+     * VALUE
612
+     *
613
+     * @param    mixed    $value    Value to check
614
+     * @return    boolean
615
+     */
616
+    public static function VALUE($value = '')
617
+    {
618
+        $value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
619
+
620
+        if (!is_numeric($value)) {
621
+            $numberValue = str_replace(
622
+                PHPExcel_Shared_String::getThousandsSeparator(),
623
+                '',
624
+                trim($value, " \t\n\r\0\x0B" . PHPExcel_Shared_String::getCurrencyCode())
625
+            );
626
+            if (is_numeric($numberValue)) {
627
+                return (float) $numberValue;
628
+            }
629
+
630
+            $dateSetting = PHPExcel_Calculation_Functions::getReturnDateType();
631
+            PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
632
+
633
+            if (strpos($value, ':') !== false) {
634
+                $timeValue = PHPExcel_Calculation_DateTime::TIMEVALUE($value);
635
+                if ($timeValue !== PHPExcel_Calculation_Functions::VALUE()) {
636
+                    PHPExcel_Calculation_Functions::setReturnDateType($dateSetting);
637
+                    return $timeValue;
638
+                }
639
+            }
640
+            $dateValue = PHPExcel_Calculation_DateTime::DATEVALUE($value);
641
+            if ($dateValue !== PHPExcel_Calculation_Functions::VALUE()) {
642
+                PHPExcel_Calculation_Functions::setReturnDateType($dateSetting);
643
+                return $dateValue;
644
+            }
645
+            PHPExcel_Calculation_Functions::setReturnDateType($dateSetting);
646
+
647
+            return PHPExcel_Calculation_Functions::VALUE();
648
+        }
649
+        return (float) $value;
650
+    }
651
+}

+ 111
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/Token/Stack.php View File

@@ -0,0 +1,111 @@
1
+<?php
2
+
3
+/**
4
+ * PHPExcel_Calculation_Token_Stack
5
+ *
6
+ * Copyright (c) 2006 - 2015 PHPExcel
7
+ *
8
+ * This library is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU Lesser General Public
10
+ * License as published by the Free Software Foundation; either
11
+ * version 2.1 of the License, or (at your option) any later version.
12
+ *
13
+ * This library is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
+ * Lesser General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU Lesser General Public
19
+ * License along with this library; if not, write to the Free Software
20
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21
+ *
22
+ * @category   PHPExcel
23
+ * @package    PHPExcel_Calculation
24
+ * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
25
+ * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
26
+ * @version    ##VERSION##, ##DATE##
27
+ */
28
+class PHPExcel_Calculation_Token_Stack
29
+{
30
+    /**
31
+     *  The parser stack for formulae
32
+     *
33
+     *  @var mixed[]
34
+     */
35
+    private $stack = array();
36
+
37
+    /**
38
+     *  Count of entries in the parser stack
39
+     *
40
+     *  @var integer
41
+     */
42
+    private $count = 0;
43
+
44
+    /**
45
+     * Return the number of entries on the stack
46
+     *
47
+     * @return  integer
48
+     */
49
+    public function count()
50
+    {
51
+        return $this->count;
52
+    }
53
+
54
+    /**
55
+     * Push a new entry onto the stack
56
+     *
57
+     * @param  mixed  $type
58
+     * @param  mixed  $value
59
+     * @param  mixed  $reference
60
+     */
61
+    public function push($type, $value, $reference = null)
62
+    {
63
+        $this->stack[$this->count++] = array(
64
+            'type'      => $type,
65
+            'value'     => $value,
66
+            'reference' => $reference
67
+        );
68
+        if ($type == 'Function') {
69
+            $localeFunction = PHPExcel_Calculation::localeFunc($value);
70
+            if ($localeFunction != $value) {
71
+                $this->stack[($this->count - 1)]['localeValue'] = $localeFunction;
72
+            }
73
+        }
74
+    }
75
+
76
+    /**
77
+     * Pop the last entry from the stack
78
+     *
79
+     * @return  mixed
80
+     */
81
+    public function pop()
82
+    {
83
+        if ($this->count > 0) {
84
+            return $this->stack[--$this->count];
85
+        }
86
+        return null;
87
+    }
88
+
89
+    /**
90
+     * Return an entry from the stack without removing it
91
+     *
92
+     * @param   integer  $n  number indicating how far back in the stack we want to look
93
+     * @return  mixed
94
+     */
95
+    public function last($n = 1)
96
+    {
97
+        if ($this->count - $n < 0) {
98
+            return null;
99
+        }
100
+        return $this->stack[$this->count - $n];
101
+    }
102
+
103
+    /**
104
+     * Clear the stack
105
+     */
106
+    public function clear()
107
+    {
108
+        $this->stack = array();
109
+        $this->count = 0;
110
+    }
111
+}

+ 351
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/Calculation/functionlist.txt View File

@@ -0,0 +1,351 @@
1
+ABS
2
+ACCRINT
3
+ACCRINTM
4
+ACOS
5
+ACOSH
6
+ADDRESS
7
+AMORDEGRC
8
+AMORLINC
9
+AND
10
+AREAS
11
+ASC
12
+ASIN
13
+ASINH
14
+ATAN
15
+ATAN2
16
+ATANH
17
+AVEDEV
18
+AVERAGE
19
+AVERAGEA
20
+AVERAGEIF
21
+AVERAGEIFS
22
+BAHTTEXT
23
+BESSELI
24
+BESSELJ
25
+BESSELK
26
+BESSELY
27
+BETADIST
28
+BETAINV
29
+BIN2DEC
30
+BIN2HEX
31
+BIN2OCT
32
+BINOMDIST
33
+CEILING
34
+CELL
35
+CHAR
36
+CHIDIST
37
+CHIINV
38
+CHITEST
39
+CHOOSE
40
+CLEAN
41
+CODE
42
+COLUMN
43
+COLUMNS
44
+COMBIN
45
+COMPLEX
46
+CONCATENATE
47
+CONFIDENCE
48
+CONVERT
49
+CORREL
50
+COS
51
+COSH
52
+COUNT
53
+COUNTA
54
+COUNTBLANK
55
+COUNTIF
56
+COUNTIFS
57
+COUPDAYBS
58
+COUPDAYBS
59
+COUPDAYSNC
60
+COUPNCD
61
+COUPNUM
62
+COUPPCD
63
+COVAR
64
+CRITBINOM
65
+CUBEKPIMEMBER
66
+CUBEMEMBER
67
+CUBEMEMBERPROPERTY
68
+CUBERANKEDMEMBER
69
+CUBESET
70
+CUBESETCOUNT
71
+CUBEVALUE
72
+CUMIPMT
73
+CUMPRINC
74
+DATE
75
+DATEDIF
76
+DATEVALUE
77
+DAVERAGE
78
+DAY
79
+DAYS360
80
+DB
81
+DCOUNT
82
+DCOUNTA
83
+DDB
84
+DEC2BIN
85
+DEC2HEX
86
+DEC2OCT
87
+DEGREES
88
+DELTA
89
+DEVSQ
90
+DGET
91
+DISC
92
+DMAX
93
+DMIN
94
+DOLLAR
95
+DOLLARDE
96
+DOLLARFR
97
+DPRODUCT
98
+DSTDEV
99
+DSTDEVP
100
+DSUM
101
+DURATION
102
+DVAR
103
+DVARP
104
+EDATE
105
+EFFECT
106
+EOMONTH
107
+ERF
108
+ERFC
109
+ERROR.TYPE
110
+EVEN
111
+EXACT
112
+EXP
113
+EXPONDIST
114
+FACT
115
+FACTDOUBLE
116
+FALSE
117
+FDIST
118
+FIND
119
+FINDB
120
+FINV
121
+FISHER
122
+FISHERINV
123
+FIXED
124
+FLOOR
125
+FORECAST
126
+FREQUENCY
127
+FTEST
128
+FV
129
+FVSCHEDULE
130
+GAMAMDIST
131
+GAMMAINV
132
+GAMMALN
133
+GCD
134
+GEOMEAN
135
+GESTEP
136
+GETPIVOTDATA
137
+GROWTH
138
+HARMEAN
139
+HEX2BIN
140
+HEX2OCT
141
+HLOOKUP
142
+HOUR
143
+HYPERLINK
144
+HYPGEOMDIST
145
+IF
146
+IFERROR
147
+IMABS
148
+IMAGINARY
149
+IMARGUMENT
150
+IMCONJUGATE
151
+IMCOS
152
+IMEXP
153
+IMLN
154
+IMLOG10
155
+IMLOG2
156
+IMPOWER
157
+IMPRODUCT
158
+IMREAL
159
+IMSIN
160
+IMSQRT
161
+IMSUB
162
+IMSUM
163
+INDEX
164
+INDIRECT
165
+INFO
166
+INT
167
+INTERCEPT
168
+INTRATE
169
+IPMT
170
+IRR
171
+ISBLANK
172
+ISERR
173
+ISERROR
174
+ISEVEN
175
+ISLOGICAL
176
+ISNA
177
+ISNONTEXT
178
+ISNUMBER
179
+ISODD
180
+ISPMT
181
+ISREF
182
+ISTEXT
183
+JIS
184
+KURT
185
+LARGE
186
+LCM
187
+LEFT
188
+LEFTB
189
+LEN
190
+LENB
191
+LINEST
192
+LN
193
+LOG
194
+LOG10
195
+LOGEST
196
+LOGINV
197
+LOGNORMDIST
198
+LOOKUP
199
+LOWER
200
+MATCH
201
+MAX
202
+MAXA
203
+MDETERM
204
+MDURATION
205
+MEDIAN
206
+MID
207
+MIDB
208
+MIN
209
+MINA
210
+MINUTE
211
+MINVERSE
212
+MIRR
213
+MMULT
214
+MOD
215
+MODE
216
+MONTH
217
+MROUND
218
+MULTINOMIAL
219
+N
220
+NA
221
+NEGBINOMDIST
222
+NETWORKDAYS
223
+NOMINAL
224
+NORMDIST
225
+NORMINV
226
+NORMSDIST
227
+NORMSINV
228
+NOT
229
+NOW
230
+NPER
231
+NPV
232
+OCT2BIN
233
+OCT2DEC
234
+OCT2HEX
235
+ODD
236
+ODDFPRICE
237
+ODDFYIELD
238
+ODDLPRICE
239
+ODDLYIELD
240
+OFFSET
241
+OR
242
+PEARSON
243
+PERCENTILE
244
+PERCENTRANK
245
+PERMUT
246
+PHONETIC
247
+PI
248
+PMT
249
+POISSON
250
+POWER
251
+PPMT
252
+PRICE
253
+PRICEDISC
254
+PRICEMAT
255
+PROB
256
+PRODUCT
257
+PROPER
258
+PV
259
+QUARTILE
260
+QUOTIENT
261
+RADIANS
262
+RAND
263
+RANDBETWEEN
264
+RANK
265
+RATE
266
+RECEIVED
267
+REPLACE
268
+REPLACEB
269
+REPT
270
+RIGHT
271
+RIGHTB
272
+ROMAN
273
+ROUND
274
+ROUNDDOWN
275
+ROUNDUP
276
+ROW
277
+ROWS
278
+RSQ
279
+RTD
280
+SEARCH
281
+SEARCHB
282
+SECOND
283
+SERIESSUM
284
+SIGN
285
+SIN
286
+SINH
287
+SKEW
288
+SLN
289
+SLOPE
290
+SMALL
291
+SQRT
292
+SQRTPI
293
+STANDARDIZE
294
+STDEV
295
+STDEVA
296
+STDEVP
297
+STDEVPA
298
+STEYX
299
+SUBSTITUTE
300
+SUBTOTAL
301
+SUM
302
+SUMIF
303
+SUMIFS
304
+SUMPRODUCT
305
+SUMSQ
306
+SUMX2MY2
307
+SUMX2PY2
308
+SUMXMY2
309
+SYD
310
+T
311
+TAN
312
+TANH
313
+TBILLEQ
314
+TBILLPRICE
315
+TBILLYIELD
316
+TDIST
317
+TEXT
318
+TIME
319
+TIMEVALUE
320
+TINV
321
+TODAY
322
+TRANSPOSE
323
+TREND
324
+TRIM
325
+TRIMMEAN
326
+TRUE
327
+TRUNC
328
+TTEST
329
+TYPE
330
+UPPER
331
+USDOLLAR
332
+VALUE
333
+VAR
334
+VARA
335
+VARP
336
+VARPA
337
+VDB
338
+VERSION
339
+VLOOKUP
340
+WEEKDAY
341
+WEEKNUM
342
+WEIBULL
343
+WORKDAY
344
+XIRR
345
+XNPV
346
+YEAR
347
+YEARFRAC
348
+YIELD
349
+YIELDDISC
350
+YIELDMAT
351
+ZTEST

+ 1032
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/Cell.php
File diff suppressed because it is too large
View File


+ 187
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/Cell/AdvancedValueBinder.php View File

@@ -0,0 +1,187 @@
1
+<?php
2
+
3
+/** PHPExcel root directory */
4
+if (!defined('PHPEXCEL_ROOT')) {
5
+    /**
6
+     * @ignore
7
+     */
8
+    define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
9
+    require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
10
+}
11
+
12
+/**
13
+ * PHPExcel_Cell_AdvancedValueBinder
14
+ *
15
+ * Copyright (c) 2006 - 2015 PHPExcel
16
+ *
17
+ * This library is free software; you can redistribute it and/or
18
+ * modify it under the terms of the GNU Lesser General Public
19
+ * License as published by the Free Software Foundation; either
20
+ * version 2.1 of the License, or (at your option) any later version.
21
+ *
22
+ * This library is distributed in the hope that it will be useful,
23
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
24
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
25
+ * Lesser General Public License for more details.
26
+ *
27
+ * You should have received a copy of the GNU Lesser General Public
28
+ * License along with this library; if not, write to the Free Software
29
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
30
+ *
31
+ * @category   PHPExcel
32
+ * @package    PHPExcel_Cell
33
+ * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
34
+ * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
35
+ * @version    ##VERSION##, ##DATE##
36
+ */
37
+class PHPExcel_Cell_AdvancedValueBinder extends PHPExcel_Cell_DefaultValueBinder implements PHPExcel_Cell_IValueBinder
38
+{
39
+    /**
40
+     * Bind value to a cell
41
+     *
42
+     * @param  PHPExcel_Cell  $cell  Cell to bind value to
43
+     * @param  mixed $value          Value to bind in cell
44
+     * @return boolean
45
+     */
46
+    public function bindValue(PHPExcel_Cell $cell, $value = null)
47
+    {
48
+        // sanitize UTF-8 strings
49
+        if (is_string($value)) {
50
+            $value = PHPExcel_Shared_String::SanitizeUTF8($value);
51
+        }
52
+
53
+        // Find out data type
54
+        $dataType = parent::dataTypeForValue($value);
55
+
56
+        // Style logic - strings
57
+        if ($dataType === PHPExcel_Cell_DataType::TYPE_STRING && !$value instanceof PHPExcel_RichText) {
58
+            //    Test for booleans using locale-setting
59
+            if ($value == PHPExcel_Calculation::getTRUE()) {
60
+                $cell->setValueExplicit(true, PHPExcel_Cell_DataType::TYPE_BOOL);
61
+                return true;
62
+            } elseif ($value == PHPExcel_Calculation::getFALSE()) {
63
+                $cell->setValueExplicit(false, PHPExcel_Cell_DataType::TYPE_BOOL);
64
+                return true;
65
+            }
66
+
67
+            // Check for number in scientific format
68
+            if (preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_NUMBER.'$/', $value)) {
69
+                $cell->setValueExplicit((float) $value, PHPExcel_Cell_DataType::TYPE_NUMERIC);
70
+                return true;
71
+            }
72
+
73
+            // Check for fraction
74
+            if (preg_match('/^([+-]?)\s*([0-9]+)\s?\/\s*([0-9]+)$/', $value, $matches)) {
75
+                // Convert value to number
76
+                $value = $matches[2] / $matches[3];
77
+                if ($matches[1] == '-') {
78
+                    $value = 0 - $value;
79
+                }
80
+                $cell->setValueExplicit((float) $value, PHPExcel_Cell_DataType::TYPE_NUMERIC);
81
+                // Set style
82
+                $cell->getWorksheet()->getStyle($cell->getCoordinate())
83
+                    ->getNumberFormat()->setFormatCode('??/??');
84
+                return true;
85
+            } elseif (preg_match('/^([+-]?)([0-9]*) +([0-9]*)\s?\/\s*([0-9]*)$/', $value, $matches)) {
86
+                // Convert value to number
87
+                $value = $matches[2] + ($matches[3] / $matches[4]);
88
+                if ($matches[1] == '-') {
89
+                    $value = 0 - $value;
90
+                }
91
+                $cell->setValueExplicit((float) $value, PHPExcel_Cell_DataType::TYPE_NUMERIC);
92
+                // Set style
93
+                $cell->getWorksheet()->getStyle($cell->getCoordinate())
94
+                    ->getNumberFormat()->setFormatCode('# ??/??');
95
+                return true;
96
+            }
97
+
98
+            // Check for percentage
99
+            if (preg_match('/^\-?[0-9]*\.?[0-9]*\s?\%$/', $value)) {
100
+                // Convert value to number
101
+                $value = (float) str_replace('%', '', $value) / 100;
102
+                $cell->setValueExplicit($value, PHPExcel_Cell_DataType::TYPE_NUMERIC);
103
+                // Set style
104
+                $cell->getWorksheet()->getStyle($cell->getCoordinate())
105
+                    ->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_PERCENTAGE_00);
106
+                return true;
107
+            }
108
+
109
+            // Check for currency
110
+            $currencyCode = PHPExcel_Shared_String::getCurrencyCode();
111
+            $decimalSeparator = PHPExcel_Shared_String::getDecimalSeparator();
112
+            $thousandsSeparator = PHPExcel_Shared_String::getThousandsSeparator();
113
+            if (preg_match('/^'.preg_quote($currencyCode).' *(\d{1,3}('.preg_quote($thousandsSeparator).'\d{3})*|(\d+))('.preg_quote($decimalSeparator).'\d{2})?$/', $value)) {
114
+                // Convert value to number
115
+                $value = (float) trim(str_replace(array($currencyCode, $thousandsSeparator, $decimalSeparator), array('', '', '.'), $value));
116
+                $cell->setValueExplicit($value, PHPExcel_Cell_DataType::TYPE_NUMERIC);
117
+                // Set style
118
+                $cell->getWorksheet()->getStyle($cell->getCoordinate())
119
+                    ->getNumberFormat()->setFormatCode(
120
+                        str_replace('$', $currencyCode, PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE)
121
+                    );
122
+                return true;
123
+            } elseif (preg_match('/^\$ *(\d{1,3}(\,\d{3})*|(\d+))(\.\d{2})?$/', $value)) {
124
+                // Convert value to number
125
+                $value = (float) trim(str_replace(array('$',','), '', $value));
126
+                $cell->setValueExplicit($value, PHPExcel_Cell_DataType::TYPE_NUMERIC);
127
+                // Set style
128
+                $cell->getWorksheet()->getStyle($cell->getCoordinate())
129
+                    ->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE);
130
+                return true;
131
+            }
132
+
133
+            // Check for time without seconds e.g. '9:45', '09:45'
134
+            if (preg_match('/^(\d|[0-1]\d|2[0-3]):[0-5]\d$/', $value)) {
135
+                // Convert value to number
136
+                list($h, $m) = explode(':', $value);
137
+                $days = $h / 24 + $m / 1440;
138
+                $cell->setValueExplicit($days, PHPExcel_Cell_DataType::TYPE_NUMERIC);
139
+                // Set style
140
+                $cell->getWorksheet()->getStyle($cell->getCoordinate())
141
+                    ->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME3);
142
+                return true;
143
+            }
144
+
145
+            // Check for time with seconds '9:45:59', '09:45:59'
146
+            if (preg_match('/^(\d|[0-1]\d|2[0-3]):[0-5]\d:[0-5]\d$/', $value)) {
147
+                // Convert value to number
148
+                list($h, $m, $s) = explode(':', $value);
149
+                $days = $h / 24 + $m / 1440 + $s / 86400;
150
+                // Convert value to number
151
+                $cell->setValueExplicit($days, PHPExcel_Cell_DataType::TYPE_NUMERIC);
152
+                // Set style
153
+                $cell->getWorksheet()->getStyle($cell->getCoordinate())
154
+                    ->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME4);
155
+                return true;
156
+            }
157
+
158
+            // Check for datetime, e.g. '2008-12-31', '2008-12-31 15:59', '2008-12-31 15:59:10'
159
+            if (($d = PHPExcel_Shared_Date::stringToExcel($value)) !== false) {
160
+                // Convert value to number
161
+                $cell->setValueExplicit($d, PHPExcel_Cell_DataType::TYPE_NUMERIC);
162
+                // Determine style. Either there is a time part or not. Look for ':'
163
+                if (strpos($value, ':') !== false) {
164
+                    $formatCode = 'yyyy-mm-dd h:mm';
165
+                } else {
166
+                    $formatCode = 'yyyy-mm-dd';
167
+                }
168
+                $cell->getWorksheet()->getStyle($cell->getCoordinate())
169
+                    ->getNumberFormat()->setFormatCode($formatCode);
170
+                return true;
171
+            }
172
+
173
+            // Check for newline character "\n"
174
+            if (strpos($value, "\n") !== false) {
175
+                $value = PHPExcel_Shared_String::SanitizeUTF8($value);
176
+                $cell->setValueExplicit($value, PHPExcel_Cell_DataType::TYPE_STRING);
177
+                // Set style
178
+                $cell->getWorksheet()->getStyle($cell->getCoordinate())
179
+                    ->getAlignment()->setWrapText(true);
180
+                return true;
181
+            }
182
+        }
183
+
184
+        // Not bound yet? Use parent...
185
+        return parent::bindValue($cell, $value);
186
+    }
187
+}

+ 115
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/Cell/DataType.php View File

@@ -0,0 +1,115 @@
1
+<?php
2
+
3
+/**
4
+ * PHPExcel_Cell_DataType
5
+ *
6
+ * Copyright (c) 2006 - 2015 PHPExcel
7
+ *
8
+ * This library is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU Lesser General Public
10
+ * License as published by the Free Software Foundation; either
11
+ * version 2.1 of the License, or (at your option) any later version.
12
+ *
13
+ * This library is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
+ * Lesser General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU Lesser General Public
19
+ * License along with this library; if not, write to the Free Software
20
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21
+ *
22
+ * @category   PHPExcel
23
+ * @package    PHPExcel_Cell
24
+ * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
25
+ * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
26
+ * @version    ##VERSION##, ##DATE##
27
+ */
28
+class PHPExcel_Cell_DataType
29
+{
30
+    /* Data types */
31
+    const TYPE_STRING2  = 'str';
32
+    const TYPE_STRING   = 's';
33
+    const TYPE_FORMULA  = 'f';
34
+    const TYPE_NUMERIC  = 'n';
35
+    const TYPE_BOOL     = 'b';
36
+    const TYPE_NULL     = 'null';
37
+    const TYPE_INLINE   = 'inlineStr';
38
+    const TYPE_ERROR    = 'e';
39
+
40
+    /**
41
+     * List of error codes
42
+     *
43
+     * @var array
44
+     */
45
+    private static $errorCodes = array(
46
+        '#NULL!'  => 0,
47
+        '#DIV/0!' => 1,
48
+        '#VALUE!' => 2,
49
+        '#REF!'   => 3,
50
+        '#NAME?'  => 4,
51
+        '#NUM!'   => 5,
52
+        '#N/A'    => 6
53
+    );
54
+
55
+    /**
56
+     * Get list of error codes
57
+     *
58
+     * @return array
59
+     */
60
+    public static function getErrorCodes()
61
+    {
62
+        return self::$errorCodes;
63
+    }
64
+
65
+    /**
66
+     * DataType for value
67
+     *
68
+     * @deprecated  Replaced by PHPExcel_Cell_IValueBinder infrastructure, will be removed in version 1.8.0
69
+     * @param       mixed  $pValue
70
+     * @return      string
71
+     */
72
+    public static function dataTypeForValue($pValue = null)
73
+    {
74
+        return PHPExcel_Cell_DefaultValueBinder::dataTypeForValue($pValue);
75
+    }
76
+
77
+    /**
78
+     * Check a string that it satisfies Excel requirements
79
+     *
80
+     * @param  mixed  Value to sanitize to an Excel string
81
+     * @return mixed  Sanitized value
82
+     */
83
+    public static function checkString($pValue = null)
84
+    {
85
+        if ($pValue instanceof PHPExcel_RichText) {
86
+            // TODO: Sanitize Rich-Text string (max. character count is 32,767)
87
+            return $pValue;
88
+        }
89
+
90
+        // string must never be longer than 32,767 characters, truncate if necessary
91
+        $pValue = PHPExcel_Shared_String::Substring($pValue, 0, 32767);
92
+
93
+        // we require that newline is represented as "\n" in core, not as "\r\n" or "\r"
94
+        $pValue = str_replace(array("\r\n", "\r"), "\n", $pValue);
95
+
96
+        return $pValue;
97
+    }
98
+
99
+    /**
100
+     * Check a value that it is a valid error code
101
+     *
102
+     * @param  mixed   Value to sanitize to an Excel error code
103
+     * @return string  Sanitized value
104
+     */
105
+    public static function checkErrorCode($pValue = null)
106
+    {
107
+        $pValue = (string) $pValue;
108
+
109
+        if (!array_key_exists($pValue, self::$errorCodes)) {
110
+            $pValue = '#NULL!';
111
+        }
112
+
113
+        return $pValue;
114
+    }
115
+}

+ 492
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/Cell/DataValidation.php View File

@@ -0,0 +1,492 @@
1
+<?php
2
+
3
+/**
4
+ * PHPExcel_Cell_DataValidation
5
+ *
6
+ * Copyright (c) 2006 - 2015 PHPExcel
7
+ *
8
+ * This library is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU Lesser General Public
10
+ * License as published by the Free Software Foundation; either
11
+ * version 2.1 of the License, or (at your option) any later version.
12
+ *
13
+ * This library is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
+ * Lesser General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU Lesser General Public
19
+ * License along with this library; if not, write to the Free Software
20
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21
+ *
22
+ * @category   PHPExcel
23
+ * @package    PHPExcel_Cell
24
+ * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
25
+ * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
26
+ * @version    ##VERSION##, ##DATE##
27
+ */
28
+class PHPExcel_Cell_DataValidation
29
+{
30
+    /* Data validation types */
31
+    const TYPE_NONE        = 'none';
32
+    const TYPE_CUSTOM      = 'custom';
33
+    const TYPE_DATE        = 'date';
34
+    const TYPE_DECIMAL     = 'decimal';
35
+    const TYPE_LIST        = 'list';
36
+    const TYPE_TEXTLENGTH  = 'textLength';
37
+    const TYPE_TIME        = 'time';
38
+    const TYPE_WHOLE       = 'whole';
39
+
40
+    /* Data validation error styles */
41
+    const STYLE_STOP         = 'stop';
42
+    const STYLE_WARNING      = 'warning';
43
+    const STYLE_INFORMATION  = 'information';
44
+
45
+    /* Data validation operators */
46
+    const OPERATOR_BETWEEN             = 'between';
47
+    const OPERATOR_EQUAL               = 'equal';
48
+    const OPERATOR_GREATERTHAN         = 'greaterThan';
49
+    const OPERATOR_GREATERTHANOREQUAL  = 'greaterThanOrEqual';
50
+    const OPERATOR_LESSTHAN            = 'lessThan';
51
+    const OPERATOR_LESSTHANOREQUAL     = 'lessThanOrEqual';
52
+    const OPERATOR_NOTBETWEEN          = 'notBetween';
53
+    const OPERATOR_NOTEQUAL            = 'notEqual';
54
+
55
+    /**
56
+     * Formula 1
57
+     *
58
+     * @var string
59
+     */
60
+    private $formula1;
61
+
62
+    /**
63
+     * Formula 2
64
+     *
65
+     * @var string
66
+     */
67
+    private $formula2;
68
+
69
+    /**
70
+     * Type
71
+     *
72
+     * @var string
73
+     */
74
+    private $type = PHPExcel_Cell_DataValidation::TYPE_NONE;
75
+
76
+    /**
77
+     * Error style
78
+     *
79
+     * @var string
80
+     */
81
+    private $errorStyle = PHPExcel_Cell_DataValidation::STYLE_STOP;
82
+
83
+    /**
84
+     * Operator
85
+     *
86
+     * @var string
87
+     */
88
+    private $operator;
89
+
90
+    /**
91
+     * Allow Blank
92
+     *
93
+     * @var boolean
94
+     */
95
+    private $allowBlank;
96
+
97
+    /**
98
+     * Show DropDown
99
+     *
100
+     * @var boolean
101
+     */
102
+    private $showDropDown;
103
+
104
+    /**
105
+     * Show InputMessage
106
+     *
107
+     * @var boolean
108
+     */
109
+    private $showInputMessage;
110
+
111
+    /**
112
+     * Show ErrorMessage
113
+     *
114
+     * @var boolean
115
+     */
116
+    private $showErrorMessage;
117
+
118
+    /**
119
+     * Error title
120
+     *
121
+     * @var string
122
+     */
123
+    private $errorTitle;
124
+
125
+    /**
126
+     * Error
127
+     *
128
+     * @var string
129
+     */
130
+    private $error;
131
+
132
+    /**
133
+     * Prompt title
134
+     *
135
+     * @var string
136
+     */
137
+    private $promptTitle;
138
+
139
+    /**
140
+     * Prompt
141
+     *
142
+     * @var string
143
+     */
144
+    private $prompt;
145
+
146
+    /**
147
+     * Create a new PHPExcel_Cell_DataValidation
148
+     */
149
+    public function __construct()
150
+    {
151
+        // Initialise member variables
152
+        $this->formula1          = '';
153
+        $this->formula2          = '';
154
+        $this->type              = PHPExcel_Cell_DataValidation::TYPE_NONE;
155
+        $this->errorStyle        = PHPExcel_Cell_DataValidation::STYLE_STOP;
156
+        $this->operator          = '';
157
+        $this->allowBlank        = false;
158
+        $this->showDropDown      = false;
159
+        $this->showInputMessage  = false;
160
+        $this->showErrorMessage  = false;
161
+        $this->errorTitle        = '';
162
+        $this->error             = '';
163
+        $this->promptTitle       = '';
164
+        $this->prompt            = '';
165
+    }
166
+
167
+    /**
168
+     * Get Formula 1
169
+     *
170
+     * @return string
171
+     */
172
+    public function getFormula1()
173
+    {
174
+        return $this->formula1;
175
+    }
176
+
177
+    /**
178
+     * Set Formula 1
179
+     *
180
+     * @param  string    $value
181
+     * @return PHPExcel_Cell_DataValidation
182
+     */
183
+    public function setFormula1($value = '')
184
+    {
185
+        $this->formula1 = $value;
186
+        return $this;
187
+    }
188
+
189
+    /**
190
+     * Get Formula 2
191
+     *
192
+     * @return string
193
+     */
194
+    public function getFormula2()
195
+    {
196
+        return $this->formula2;
197
+    }
198
+
199
+    /**
200
+     * Set Formula 2
201
+     *
202
+     * @param  string    $value
203
+     * @return PHPExcel_Cell_DataValidation
204
+     */
205
+    public function setFormula2($value = '')
206
+    {
207
+        $this->formula2 = $value;
208
+        return $this;
209
+    }
210
+
211
+    /**
212
+     * Get Type
213
+     *
214
+     * @return string
215
+     */
216
+    public function getType()
217
+    {
218
+        return $this->type;
219
+    }
220
+
221
+    /**
222
+     * Set Type
223
+     *
224
+     * @param  string    $value
225
+     * @return PHPExcel_Cell_DataValidation
226
+     */
227
+    public function setType($value = PHPExcel_Cell_DataValidation::TYPE_NONE)
228
+    {
229
+        $this->type = $value;
230
+        return $this;
231
+    }
232
+
233
+    /**
234
+     * Get Error style
235
+     *
236
+     * @return string
237
+     */
238
+    public function getErrorStyle()
239
+    {
240
+        return $this->errorStyle;
241
+    }
242
+
243
+    /**
244
+     * Set Error style
245
+     *
246
+     * @param  string    $value
247
+     * @return PHPExcel_Cell_DataValidation
248
+     */
249
+    public function setErrorStyle($value = PHPExcel_Cell_DataValidation::STYLE_STOP)
250
+    {
251
+        $this->errorStyle = $value;
252
+        return $this;
253
+    }
254
+
255
+    /**
256
+     * Get Operator
257
+     *
258
+     * @return string
259
+     */
260
+    public function getOperator()
261
+    {
262
+        return $this->operator;
263
+    }
264
+
265
+    /**
266
+     * Set Operator
267
+     *
268
+     * @param  string    $value
269
+     * @return PHPExcel_Cell_DataValidation
270
+     */
271
+    public function setOperator($value = '')
272
+    {
273
+        $this->operator = $value;
274
+        return $this;
275
+    }
276
+
277
+    /**
278
+     * Get Allow Blank
279
+     *
280
+     * @return boolean
281
+     */
282
+    public function getAllowBlank()
283
+    {
284
+        return $this->allowBlank;
285
+    }
286
+
287
+    /**
288
+     * Set Allow Blank
289
+     *
290
+     * @param  boolean    $value
291
+     * @return PHPExcel_Cell_DataValidation
292
+     */
293
+    public function setAllowBlank($value = false)
294
+    {
295
+        $this->allowBlank = $value;
296
+        return $this;
297
+    }
298
+
299
+    /**
300
+     * Get Show DropDown
301
+     *
302
+     * @return boolean
303
+     */
304
+    public function getShowDropDown()
305
+    {
306
+        return $this->showDropDown;
307
+    }
308
+
309
+    /**
310
+     * Set Show DropDown
311
+     *
312
+     * @param  boolean    $value
313
+     * @return PHPExcel_Cell_DataValidation
314
+     */
315
+    public function setShowDropDown($value = false)
316
+    {
317
+        $this->showDropDown = $value;
318
+        return $this;
319
+    }
320
+
321
+    /**
322
+     * Get Show InputMessage
323
+     *
324
+     * @return boolean
325
+     */
326
+    public function getShowInputMessage()
327
+    {
328
+        return $this->showInputMessage;
329
+    }
330
+
331
+    /**
332
+     * Set Show InputMessage
333
+     *
334
+     * @param  boolean    $value
335
+     * @return PHPExcel_Cell_DataValidation
336
+     */
337
+    public function setShowInputMessage($value = false)
338
+    {
339
+        $this->showInputMessage = $value;
340
+        return $this;
341
+    }
342
+
343
+    /**
344
+     * Get Show ErrorMessage
345
+     *
346
+     * @return boolean
347
+     */
348
+    public function getShowErrorMessage()
349
+    {
350
+        return $this->showErrorMessage;
351
+    }
352
+
353
+    /**
354
+     * Set Show ErrorMessage
355
+     *
356
+     * @param  boolean    $value
357
+     * @return PHPExcel_Cell_DataValidation
358
+     */
359
+    public function setShowErrorMessage($value = false)
360
+    {
361
+        $this->showErrorMessage = $value;
362
+        return $this;
363
+    }
364
+
365
+    /**
366
+     * Get Error title
367
+     *
368
+     * @return string
369
+     */
370
+    public function getErrorTitle()
371
+    {
372
+        return $this->errorTitle;
373
+    }
374
+
375
+    /**
376
+     * Set Error title
377
+     *
378
+     * @param  string    $value
379
+     * @return PHPExcel_Cell_DataValidation
380
+     */
381
+    public function setErrorTitle($value = '')
382
+    {
383
+        $this->errorTitle = $value;
384
+        return $this;
385
+    }
386
+
387
+    /**
388
+     * Get Error
389
+     *
390
+     * @return string
391
+     */
392
+    public function getError()
393
+    {
394
+        return $this->error;
395
+    }
396
+
397
+    /**
398
+     * Set Error
399
+     *
400
+     * @param  string    $value
401
+     * @return PHPExcel_Cell_DataValidation
402
+     */
403
+    public function setError($value = '')
404
+    {
405
+        $this->error = $value;
406
+        return $this;
407
+    }
408
+
409
+    /**
410
+     * Get Prompt title
411
+     *
412
+     * @return string
413
+     */
414
+    public function getPromptTitle()
415
+    {
416
+        return $this->promptTitle;
417
+    }
418
+
419
+    /**
420
+     * Set Prompt title
421
+     *
422
+     * @param  string    $value
423
+     * @return PHPExcel_Cell_DataValidation
424
+     */
425
+    public function setPromptTitle($value = '')
426
+    {
427
+        $this->promptTitle = $value;
428
+        return $this;
429
+    }
430
+
431
+    /**
432
+     * Get Prompt
433
+     *
434
+     * @return string
435
+     */
436
+    public function getPrompt()
437
+    {
438
+        return $this->prompt;
439
+    }
440
+
441
+    /**
442
+     * Set Prompt
443
+     *
444
+     * @param  string    $value
445
+     * @return PHPExcel_Cell_DataValidation
446
+     */
447
+    public function setPrompt($value = '')
448
+    {
449
+        $this->prompt = $value;
450
+        return $this;
451
+    }
452
+
453
+    /**
454
+     * Get hash code
455
+     *
456
+     * @return string    Hash code
457
+     */
458
+    public function getHashCode()
459
+    {
460
+        return md5(
461
+            $this->formula1 .
462
+            $this->formula2 .
463
+            $this->type = PHPExcel_Cell_DataValidation::TYPE_NONE .
464
+            $this->errorStyle = PHPExcel_Cell_DataValidation::STYLE_STOP .
465
+            $this->operator .
466
+            ($this->allowBlank ? 't' : 'f') .
467
+            ($this->showDropDown ? 't' : 'f') .
468
+            ($this->showInputMessage ? 't' : 'f') .
469
+            ($this->showErrorMessage ? 't' : 'f') .
470
+            $this->errorTitle .
471
+            $this->error .
472
+            $this->promptTitle .
473
+            $this->prompt .
474
+            __CLASS__
475
+        );
476
+    }
477
+
478
+    /**
479
+     * Implement PHP __clone to create a deep clone, not just a shallow copy.
480
+     */
481
+    public function __clone()
482
+    {
483
+        $vars = get_object_vars($this);
484
+        foreach ($vars as $key => $value) {
485
+            if (is_object($value)) {
486
+                $this->$key = clone $value;
487
+            } else {
488
+                $this->$key = $value;
489
+            }
490
+        }
491
+    }
492
+}

+ 102
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/Cell/DefaultValueBinder.php View File

@@ -0,0 +1,102 @@
1
+<?php
2
+
3
+/** PHPExcel root directory */
4
+if (!defined('PHPEXCEL_ROOT')) {
5
+    /**
6
+     * @ignore
7
+     */
8
+    define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
9
+    require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
10
+}
11
+
12
+/**
13
+ * PHPExcel_Cell_DefaultValueBinder
14
+ *
15
+ * Copyright (c) 2006 - 2015 PHPExcel
16
+ *
17
+ * This library is free software; you can redistribute it and/or
18
+ * modify it under the terms of the GNU Lesser General Public
19
+ * License as published by the Free Software Foundation; either
20
+ * version 2.1 of the License, or (at your option) any later version.
21
+ *
22
+ * This library is distributed in the hope that it will be useful,
23
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
24
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
25
+ * Lesser General Public License for more details.
26
+ *
27
+ * You should have received a copy of the GNU Lesser General Public
28
+ * License along with this library; if not, write to the Free Software
29
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
30
+ *
31
+ * @category   PHPExcel
32
+ * @package    PHPExcel_Cell
33
+ * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
34
+ * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
35
+ * @version    ##VERSION##, ##DATE##
36
+ */
37
+class PHPExcel_Cell_DefaultValueBinder implements PHPExcel_Cell_IValueBinder
38
+{
39
+    /**
40
+     * Bind value to a cell
41
+     *
42
+     * @param  PHPExcel_Cell  $cell   Cell to bind value to
43
+     * @param  mixed          $value  Value to bind in cell
44
+     * @return boolean
45
+     */
46
+    public function bindValue(PHPExcel_Cell $cell, $value = null)
47
+    {
48
+        // sanitize UTF-8 strings
49
+        if (is_string($value)) {
50
+            $value = PHPExcel_Shared_String::SanitizeUTF8($value);
51
+        } elseif (is_object($value)) {
52
+            // Handle any objects that might be injected
53
+            if ($value instanceof DateTime) {
54
+                $value = $value->format('Y-m-d H:i:s');
55
+            } elseif (!($value instanceof PHPExcel_RichText)) {
56
+                $value = (string) $value;
57
+            }
58
+        }
59
+
60
+        // Set value explicit
61
+        $cell->setValueExplicit($value, self::dataTypeForValue($value));
62
+
63
+        // Done!
64
+        return true;
65
+    }
66
+
67
+    /**
68
+     * DataType for value
69
+     *
70
+     * @param   mixed  $pValue
71
+     * @return  string
72
+     */
73
+    public static function dataTypeForValue($pValue = null)
74
+    {
75
+        // Match the value against a few data types
76
+        if ($pValue === null) {
77
+            return PHPExcel_Cell_DataType::TYPE_NULL;
78
+        } elseif ($pValue === '') {
79
+            return PHPExcel_Cell_DataType::TYPE_STRING;
80
+        } elseif ($pValue instanceof PHPExcel_RichText) {
81
+            return PHPExcel_Cell_DataType::TYPE_INLINE;
82
+        } elseif ($pValue{0} === '=' && strlen($pValue) > 1) {
83
+            return PHPExcel_Cell_DataType::TYPE_FORMULA;
84
+        } elseif (is_bool($pValue)) {
85
+            return PHPExcel_Cell_DataType::TYPE_BOOL;
86
+        } elseif (is_float($pValue) || is_int($pValue)) {
87
+            return PHPExcel_Cell_DataType::TYPE_NUMERIC;
88
+        } elseif (preg_match('/^[\+\-]?([0-9]+\\.?[0-9]*|[0-9]*\\.?[0-9]+)([Ee][\-\+]?[0-2]?\d{1,3})?$/', $pValue)) {
89
+            $tValue = ltrim($pValue, '+-');
90
+            if (is_string($pValue) && $tValue{0} === '0' && strlen($tValue) > 1 && $tValue{1} !== '.') {
91
+                return PHPExcel_Cell_DataType::TYPE_STRING;
92
+            } elseif ((strpos($pValue, '.') === false) && ($pValue > PHP_INT_MAX)) {
93
+                return PHPExcel_Cell_DataType::TYPE_STRING;
94
+            }
95
+            return PHPExcel_Cell_DataType::TYPE_NUMERIC;
96
+        } elseif (is_string($pValue) && array_key_exists($pValue, PHPExcel_Cell_DataType::getErrorCodes())) {
97
+            return PHPExcel_Cell_DataType::TYPE_ERROR;
98
+        }
99
+
100
+        return PHPExcel_Cell_DataType::TYPE_STRING;
101
+    }
102
+}

+ 124
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/Cell/Hyperlink.php View File

@@ -0,0 +1,124 @@
1
+<?php
2
+
3
+/**
4
+ * PHPExcel_Cell_Hyperlink
5
+ *
6
+ * Copyright (c) 2006 - 2015 PHPExcel
7
+ *
8
+ * This library is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU Lesser General Public
10
+ * License as published by the Free Software Foundation; either
11
+ * version 2.1 of the License, or (at your option) any later version.
12
+ *
13
+ * This library is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
+ * Lesser General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU Lesser General Public
19
+ * License along with this library; if not, write to the Free Software
20
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21
+ *
22
+ * @category   PHPExcel
23
+ * @package    PHPExcel_Cell
24
+ * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
25
+ * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
26
+ * @version    ##VERSION##, ##DATE##
27
+ */
28
+class PHPExcel_Cell_Hyperlink
29
+{
30
+    /**
31
+     * URL to link the cell to
32
+     *
33
+     * @var string
34
+     */
35
+    private $url;
36
+
37
+    /**
38
+     * Tooltip to display on the hyperlink
39
+     *
40
+     * @var string
41
+     */
42
+    private $tooltip;
43
+
44
+    /**
45
+     * Create a new PHPExcel_Cell_Hyperlink
46
+     *
47
+     * @param  string  $pUrl      Url to link the cell to
48
+     * @param  string  $pTooltip  Tooltip to display on the hyperlink
49
+     */
50
+    public function __construct($pUrl = '', $pTooltip = '')
51
+    {
52
+        // Initialise member variables
53
+        $this->url     = $pUrl;
54
+        $this->tooltip = $pTooltip;
55
+    }
56
+
57
+    /**
58
+     * Get URL
59
+     *
60
+     * @return string
61
+     */
62
+    public function getUrl()
63
+    {
64
+        return $this->url;
65
+    }
66
+
67
+    /**
68
+     * Set URL
69
+     *
70
+     * @param  string    $value
71
+     * @return PHPExcel_Cell_Hyperlink
72
+     */
73
+    public function setUrl($value = '')
74
+    {
75
+        $this->url = $value;
76
+        return $this;
77
+    }
78
+
79
+    /**
80
+     * Get tooltip
81
+     *
82
+     * @return string
83
+     */
84
+    public function getTooltip()
85
+    {
86
+        return $this->tooltip;
87
+    }
88
+
89
+    /**
90
+     * Set tooltip
91
+     *
92
+     * @param  string    $value
93
+     * @return PHPExcel_Cell_Hyperlink
94
+     */
95
+    public function setTooltip($value = '')
96
+    {
97
+        $this->tooltip = $value;
98
+        return $this;
99
+    }
100
+
101
+    /**
102
+     * Is this hyperlink internal? (to another worksheet)
103
+     *
104
+     * @return boolean
105
+     */
106
+    public function isInternal()
107
+    {
108
+        return strpos($this->url, 'sheet://') !== false;
109
+    }
110
+
111
+    /**
112
+     * Get hash code
113
+     *
114
+     * @return string    Hash code
115
+     */
116
+    public function getHashCode()
117
+    {
118
+        return md5(
119
+            $this->url .
120
+            $this->tooltip .
121
+            __CLASS__
122
+        );
123
+    }
124
+}

+ 47
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/Cell/IValueBinder.php View File

@@ -0,0 +1,47 @@
1
+<?php
2
+
3
+/**
4
+ * PHPExcel
5
+ *
6
+ * Copyright (c) 2006 - 2015 PHPExcel
7
+ *
8
+ * This library is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU Lesser General Public
10
+ * License as published by the Free Software Foundation; either
11
+ * version 2.1 of the License, or (at your option) any later version.
12
+ *
13
+ * This library is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
+ * Lesser General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU Lesser General Public
19
+ * License along with this library; if not, write to the Free Software
20
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21
+ *
22
+ * @category   PHPExcel
23
+ * @package    PHPExcel_Cell
24
+ * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
25
+ * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
26
+ * @version    ##VERSION##, ##DATE##
27
+ */
28
+
29
+
30
+/**
31
+ * PHPExcel_Cell_IValueBinder
32
+ *
33
+ * @category   PHPExcel
34
+ * @package    PHPExcel_Cell
35
+ * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
36
+ */
37
+interface PHPExcel_Cell_IValueBinder
38
+{
39
+    /**
40
+     * Bind value to a cell
41
+     *
42
+     * @param  PHPExcel_Cell $cell    Cell to bind value to
43
+     * @param  mixed $value           Value to bind in cell
44
+     * @return boolean
45
+     */
46
+    public function bindValue(PHPExcel_Cell $cell, $value = null);
47
+}

+ 680
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/Chart.php View File

@@ -0,0 +1,680 @@
1
+<?php
2
+
3
+/**
4
+ * PHPExcel_Chart
5
+ *
6
+ * Copyright (c) 2006 - 2015 PHPExcel
7
+ *
8
+ * This library is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU Lesser General Public
10
+ * License as published by the Free Software Foundation; either
11
+ * version 2.1 of the License, or (at your option) any later version.
12
+ *
13
+ * This library is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
+ * Lesser General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU Lesser General Public
19
+ * License along with this library; if not, write to the Free Software
20
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21
+ *
22
+ * @category    PHPExcel
23
+ * @package        PHPExcel_Chart
24
+ * @copyright    Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
25
+ * @license        http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
26
+ * @version        ##VERSION##, ##DATE##
27
+ */
28
+class PHPExcel_Chart
29
+{
30
+    /**
31
+     * Chart Name
32
+     *
33
+     * @var string
34
+     */
35
+    private $name = '';
36
+
37
+    /**
38
+     * Worksheet
39
+     *
40
+     * @var PHPExcel_Worksheet
41
+     */
42
+    private $worksheet;
43
+
44
+    /**
45
+     * Chart Title
46
+     *
47
+     * @var PHPExcel_Chart_Title
48
+     */
49
+    private $title;
50
+
51
+    /**
52
+     * Chart Legend
53
+     *
54
+     * @var PHPExcel_Chart_Legend
55
+     */
56
+    private $legend;
57
+
58
+    /**
59
+     * X-Axis Label
60
+     *
61
+     * @var PHPExcel_Chart_Title
62
+     */
63
+    private $xAxisLabel;
64
+
65
+    /**
66
+     * Y-Axis Label
67
+     *
68
+     * @var PHPExcel_Chart_Title
69
+     */
70
+    private $yAxisLabel;
71
+
72
+    /**
73
+     * Chart Plot Area
74
+     *
75
+     * @var PHPExcel_Chart_PlotArea
76
+     */
77
+    private $plotArea;
78
+
79
+    /**
80
+     * Plot Visible Only
81
+     *
82
+     * @var boolean
83
+     */
84
+    private $plotVisibleOnly = true;
85
+
86
+    /**
87
+     * Display Blanks as
88
+     *
89
+     * @var string
90
+     */
91
+    private $displayBlanksAs = '0';
92
+
93
+    /**
94
+     * Chart Asix Y as
95
+     *
96
+     * @var PHPExcel_Chart_Axis
97
+     */
98
+    private $yAxis;
99
+
100
+    /**
101
+     * Chart Asix X as
102
+     *
103
+     * @var PHPExcel_Chart_Axis
104
+     */
105
+    private $xAxis;
106
+
107
+    /**
108
+     * Chart Major Gridlines as
109
+     *
110
+     * @var PHPExcel_Chart_GridLines
111
+     */
112
+    private $majorGridlines;
113
+
114
+    /**
115
+     * Chart Minor Gridlines as
116
+     *
117
+     * @var PHPExcel_Chart_GridLines
118
+     */
119
+    private $minorGridlines;
120
+
121
+    /**
122
+     * Top-Left Cell Position
123
+     *
124
+     * @var string
125
+     */
126
+    private $topLeftCellRef = 'A1';
127
+
128
+
129
+    /**
130
+     * Top-Left X-Offset
131
+     *
132
+     * @var integer
133
+     */
134
+    private $topLeftXOffset = 0;
135
+
136
+
137
+    /**
138
+     * Top-Left Y-Offset
139
+     *
140
+     * @var integer
141
+     */
142
+    private $topLeftYOffset = 0;
143
+
144
+
145
+    /**
146
+     * Bottom-Right Cell Position
147
+     *
148
+     * @var string
149
+     */
150
+    private $bottomRightCellRef = 'A1';
151
+
152
+
153
+    /**
154
+     * Bottom-Right X-Offset
155
+     *
156
+     * @var integer
157
+     */
158
+    private $bottomRightXOffset = 10;
159
+
160
+
161
+    /**
162
+     * Bottom-Right Y-Offset
163
+     *
164
+     * @var integer
165
+     */
166
+    private $bottomRightYOffset = 10;
167
+
168
+
169
+    /**
170
+     * Create a new PHPExcel_Chart
171
+     */
172
+    public function __construct($name, PHPExcel_Chart_Title $title = null, PHPExcel_Chart_Legend $legend = null, PHPExcel_Chart_PlotArea $plotArea = null, $plotVisibleOnly = true, $displayBlanksAs = '0', PHPExcel_Chart_Title $xAxisLabel = null, PHPExcel_Chart_Title $yAxisLabel = null, PHPExcel_Chart_Axis $xAxis = null, PHPExcel_Chart_Axis $yAxis = null, PHPExcel_Chart_GridLines $majorGridlines = null, PHPExcel_Chart_GridLines $minorGridlines = null)
173
+    {
174
+        $this->name = $name;
175
+        $this->title = $title;
176
+        $this->legend = $legend;
177
+        $this->xAxisLabel = $xAxisLabel;
178
+        $this->yAxisLabel = $yAxisLabel;
179
+        $this->plotArea = $plotArea;
180
+        $this->plotVisibleOnly = $plotVisibleOnly;
181
+        $this->displayBlanksAs = $displayBlanksAs;
182
+        $this->xAxis = $xAxis;
183
+        $this->yAxis = $yAxis;
184
+        $this->majorGridlines = $majorGridlines;
185
+        $this->minorGridlines = $minorGridlines;
186
+    }
187
+
188
+    /**
189
+     * Get Name
190
+     *
191
+     * @return string
192
+     */
193
+    public function getName()
194
+    {
195
+        return $this->name;
196
+    }
197
+
198
+    /**
199
+     * Get Worksheet
200
+     *
201
+     * @return PHPExcel_Worksheet
202
+     */
203
+    public function getWorksheet()
204
+    {
205
+        return $this->worksheet;
206
+    }
207
+
208
+    /**
209
+     * Set Worksheet
210
+     *
211
+     * @param    PHPExcel_Worksheet    $pValue
212
+     * @throws    PHPExcel_Chart_Exception
213
+     * @return PHPExcel_Chart
214
+     */
215
+    public function setWorksheet(PHPExcel_Worksheet $pValue = null)
216
+    {
217
+        $this->worksheet = $pValue;
218
+
219
+        return $this;
220
+    }
221
+
222
+    /**
223
+     * Get Title
224
+     *
225
+     * @return PHPExcel_Chart_Title
226
+     */
227
+    public function getTitle()
228
+    {
229
+        return $this->title;
230
+    }
231
+
232
+    /**
233
+     * Set Title
234
+     *
235
+     * @param    PHPExcel_Chart_Title $title
236
+     * @return    PHPExcel_Chart
237
+     */
238
+    public function setTitle(PHPExcel_Chart_Title $title)
239
+    {
240
+        $this->title = $title;
241
+
242
+        return $this;
243
+    }
244
+
245
+    /**
246
+     * Get Legend
247
+     *
248
+     * @return PHPExcel_Chart_Legend
249
+     */
250
+    public function getLegend()
251
+    {
252
+        return $this->legend;
253
+    }
254
+
255
+    /**
256
+     * Set Legend
257
+     *
258
+     * @param    PHPExcel_Chart_Legend $legend
259
+     * @return    PHPExcel_Chart
260
+     */
261
+    public function setLegend(PHPExcel_Chart_Legend $legend)
262
+    {
263
+        $this->legend = $legend;
264
+
265
+        return $this;
266
+    }
267
+
268
+    /**
269
+     * Get X-Axis Label
270
+     *
271
+     * @return PHPExcel_Chart_Title
272
+     */
273
+    public function getXAxisLabel()
274
+    {
275
+        return $this->xAxisLabel;
276
+    }
277
+
278
+    /**
279
+     * Set X-Axis Label
280
+     *
281
+     * @param    PHPExcel_Chart_Title $label
282
+     * @return    PHPExcel_Chart
283
+     */
284
+    public function setXAxisLabel(PHPExcel_Chart_Title $label)
285
+    {
286
+        $this->xAxisLabel = $label;
287
+
288
+        return $this;
289
+    }
290
+
291
+    /**
292
+     * Get Y-Axis Label
293
+     *
294
+     * @return PHPExcel_Chart_Title
295
+     */
296
+    public function getYAxisLabel()
297
+    {
298
+        return $this->yAxisLabel;
299
+    }
300
+
301
+    /**
302
+     * Set Y-Axis Label
303
+     *
304
+     * @param    PHPExcel_Chart_Title $label
305
+     * @return    PHPExcel_Chart
306
+     */
307
+    public function setYAxisLabel(PHPExcel_Chart_Title $label)
308
+    {
309
+        $this->yAxisLabel = $label;
310
+
311
+        return $this;
312
+    }
313
+
314
+    /**
315
+     * Get Plot Area
316
+     *
317
+     * @return PHPExcel_Chart_PlotArea
318
+     */
319
+    public function getPlotArea()
320
+    {
321
+        return $this->plotArea;
322
+    }
323
+
324
+    /**
325
+     * Get Plot Visible Only
326
+     *
327
+     * @return boolean
328
+     */
329
+    public function getPlotVisibleOnly()
330
+    {
331
+        return $this->plotVisibleOnly;
332
+    }
333
+
334
+    /**
335
+     * Set Plot Visible Only
336
+     *
337
+     * @param boolean $plotVisibleOnly
338
+     * @return PHPExcel_Chart
339
+     */
340
+    public function setPlotVisibleOnly($plotVisibleOnly = true)
341
+    {
342
+        $this->plotVisibleOnly = $plotVisibleOnly;
343
+
344
+        return $this;
345
+    }
346
+
347
+    /**
348
+     * Get Display Blanks as
349
+     *
350
+     * @return string
351
+     */
352
+    public function getDisplayBlanksAs()
353
+    {
354
+        return $this->displayBlanksAs;
355
+    }
356
+
357
+    /**
358
+     * Set Display Blanks as
359
+     *
360
+     * @param string $displayBlanksAs
361
+     * @return PHPExcel_Chart
362
+     */
363
+    public function setDisplayBlanksAs($displayBlanksAs = '0')
364
+    {
365
+        $this->displayBlanksAs = $displayBlanksAs;
366
+    }
367
+
368
+
369
+    /**
370
+     * Get yAxis
371
+     *
372
+     * @return PHPExcel_Chart_Axis
373
+     */
374
+    public function getChartAxisY()
375
+    {
376
+        if ($this->yAxis !== null) {
377
+            return $this->yAxis;
378
+        }
379
+
380
+        return new PHPExcel_Chart_Axis();
381
+    }
382
+
383
+    /**
384
+     * Get xAxis
385
+     *
386
+     * @return PHPExcel_Chart_Axis
387
+     */
388
+    public function getChartAxisX()
389
+    {
390
+        if ($this->xAxis !== null) {
391
+            return $this->xAxis;
392
+        }
393
+
394
+        return new PHPExcel_Chart_Axis();
395
+    }
396
+
397
+    /**
398
+     * Get Major Gridlines
399
+     *
400
+     * @return PHPExcel_Chart_GridLines
401
+     */
402
+    public function getMajorGridlines()
403
+    {
404
+        if ($this->majorGridlines !== null) {
405
+            return $this->majorGridlines;
406
+        }
407
+
408
+        return new PHPExcel_Chart_GridLines();
409
+    }
410
+
411
+    /**
412
+     * Get Minor Gridlines
413
+     *
414
+     * @return PHPExcel_Chart_GridLines
415
+     */
416
+    public function getMinorGridlines()
417
+    {
418
+        if ($this->minorGridlines !== null) {
419
+            return $this->minorGridlines;
420
+        }
421
+
422
+        return new PHPExcel_Chart_GridLines();
423
+    }
424
+
425
+
426
+    /**
427
+     * Set the Top Left position for the chart
428
+     *
429
+     * @param    string    $cell
430
+     * @param    integer    $xOffset
431
+     * @param    integer    $yOffset
432
+     * @return PHPExcel_Chart
433
+     */
434
+    public function setTopLeftPosition($cell, $xOffset = null, $yOffset = null)
435
+    {
436
+        $this->topLeftCellRef = $cell;
437
+        if (!is_null($xOffset)) {
438
+            $this->setTopLeftXOffset($xOffset);
439
+        }
440
+        if (!is_null($yOffset)) {
441
+            $this->setTopLeftYOffset($yOffset);
442
+        }
443
+
444
+        return $this;
445
+    }
446
+
447
+    /**
448
+     * Get the top left position of the chart
449
+     *
450
+     * @return array    an associative array containing the cell address, X-Offset and Y-Offset from the top left of that cell
451
+     */
452
+    public function getTopLeftPosition()
453
+    {
454
+        return array(
455
+            'cell'    => $this->topLeftCellRef,
456
+            'xOffset' => $this->topLeftXOffset,
457
+            'yOffset' => $this->topLeftYOffset
458
+        );
459
+    }
460
+
461
+    /**
462
+     * Get the cell address where the top left of the chart is fixed
463
+     *
464
+     * @return string
465
+     */
466
+    public function getTopLeftCell()
467
+    {
468
+        return $this->topLeftCellRef;
469
+    }
470
+
471
+    /**
472
+     * Set the Top Left cell position for the chart
473
+     *
474
+     * @param    string    $cell
475
+     * @return PHPExcel_Chart
476
+     */
477
+    public function setTopLeftCell($cell)
478
+    {
479
+        $this->topLeftCellRef = $cell;
480
+
481
+        return $this;
482
+    }
483
+
484
+    /**
485
+     * Set the offset position within the Top Left cell for the chart
486
+     *
487
+     * @param    integer    $xOffset
488
+     * @param    integer    $yOffset
489
+     * @return PHPExcel_Chart
490
+     */
491
+    public function setTopLeftOffset($xOffset = null, $yOffset = null)
492
+    {
493
+        if (!is_null($xOffset)) {
494
+            $this->setTopLeftXOffset($xOffset);
495
+        }
496
+        if (!is_null($yOffset)) {
497
+            $this->setTopLeftYOffset($yOffset);
498
+        }
499
+
500
+        return $this;
501
+    }
502
+
503
+    /**
504
+     * Get the offset position within the Top Left cell for the chart
505
+     *
506
+     * @return integer[]
507
+     */
508
+    public function getTopLeftOffset()
509
+    {
510
+        return array(
511
+            'X' => $this->topLeftXOffset,
512
+            'Y' => $this->topLeftYOffset
513
+        );
514
+    }
515
+
516
+    public function setTopLeftXOffset($xOffset)
517
+    {
518
+        $this->topLeftXOffset = $xOffset;
519
+
520
+        return $this;
521
+    }
522
+
523
+    public function getTopLeftXOffset()
524
+    {
525
+        return $this->topLeftXOffset;
526
+    }
527
+
528
+    public function setTopLeftYOffset($yOffset)
529
+    {
530
+        $this->topLeftYOffset = $yOffset;
531
+
532
+        return $this;
533
+    }
534
+
535
+    public function getTopLeftYOffset()
536
+    {
537
+        return $this->topLeftYOffset;
538
+    }
539
+
540
+    /**
541
+     * Set the Bottom Right position of the chart
542
+     *
543
+     * @param    string    $cell
544
+     * @param    integer    $xOffset
545
+     * @param    integer    $yOffset
546
+     * @return PHPExcel_Chart
547
+     */
548
+    public function setBottomRightPosition($cell, $xOffset = null, $yOffset = null)
549
+    {
550
+        $this->bottomRightCellRef = $cell;
551
+        if (!is_null($xOffset)) {
552
+            $this->setBottomRightXOffset($xOffset);
553
+        }
554
+        if (!is_null($yOffset)) {
555
+            $this->setBottomRightYOffset($yOffset);
556
+        }
557
+
558
+        return $this;
559
+    }
560
+
561
+    /**
562
+     * Get the bottom right position of the chart
563
+     *
564
+     * @return array    an associative array containing the cell address, X-Offset and Y-Offset from the top left of that cell
565
+     */
566
+    public function getBottomRightPosition()
567
+    {
568
+        return array(
569
+            'cell'    => $this->bottomRightCellRef,
570
+            'xOffset' => $this->bottomRightXOffset,
571
+            'yOffset' => $this->bottomRightYOffset
572
+        );
573
+    }
574
+
575
+    public function setBottomRightCell($cell)
576
+    {
577
+        $this->bottomRightCellRef = $cell;
578
+
579
+        return $this;
580
+    }
581
+
582
+    /**
583
+     * Get the cell address where the bottom right of the chart is fixed
584
+     *
585
+     * @return string
586
+     */
587
+    public function getBottomRightCell()
588
+    {
589
+        return $this->bottomRightCellRef;
590
+    }
591
+
592
+    /**
593
+     * Set the offset position within the Bottom Right cell for the chart
594
+     *
595
+     * @param    integer    $xOffset
596
+     * @param    integer    $yOffset
597
+     * @return PHPExcel_Chart
598
+     */
599
+    public function setBottomRightOffset($xOffset = null, $yOffset = null)
600
+    {
601
+        if (!is_null($xOffset)) {
602
+            $this->setBottomRightXOffset($xOffset);
603
+        }
604
+        if (!is_null($yOffset)) {
605
+            $this->setBottomRightYOffset($yOffset);
606
+        }
607
+
608
+        return $this;
609
+    }
610
+
611
+    /**
612
+     * Get the offset position within the Bottom Right cell for the chart
613
+     *
614
+     * @return integer[]
615
+     */
616
+    public function getBottomRightOffset()
617
+    {
618
+        return array(
619
+            'X' => $this->bottomRightXOffset,
620
+            'Y' => $this->bottomRightYOffset
621
+        );
622
+    }
623
+
624
+    public function setBottomRightXOffset($xOffset)
625
+    {
626
+        $this->bottomRightXOffset = $xOffset;
627
+
628
+        return $this;
629
+    }
630
+
631
+    public function getBottomRightXOffset()
632
+    {
633
+        return $this->bottomRightXOffset;
634
+    }
635
+
636
+    public function setBottomRightYOffset($yOffset)
637
+    {
638
+        $this->bottomRightYOffset = $yOffset;
639
+
640
+        return $this;
641
+    }
642
+
643
+    public function getBottomRightYOffset()
644
+    {
645
+        return $this->bottomRightYOffset;
646
+    }
647
+
648
+
649
+    public function refresh()
650
+    {
651
+        if ($this->worksheet !== null) {
652
+            $this->plotArea->refresh($this->worksheet);
653
+        }
654
+    }
655
+
656
+    public function render($outputDestination = null)
657
+    {
658
+        $libraryName = PHPExcel_Settings::getChartRendererName();
659
+        if (is_null($libraryName)) {
660
+            return false;
661
+        }
662
+        //    Ensure that data series values are up-to-date before we render
663
+        $this->refresh();
664
+
665
+        $libraryPath = PHPExcel_Settings::getChartRendererPath();
666
+        $includePath = str_replace('\\', '/', get_include_path());
667
+        $rendererPath = str_replace('\\', '/', $libraryPath);
668
+        if (strpos($rendererPath, $includePath) === false) {
669
+            set_include_path(get_include_path() . PATH_SEPARATOR . $libraryPath);
670
+        }
671
+
672
+        $rendererName = 'PHPExcel_Chart_Renderer_'.$libraryName;
673
+        $renderer = new $rendererName($this);
674
+
675
+        if ($outputDestination == 'php://output') {
676
+            $outputDestination = null;
677
+        }
678
+        return $renderer->render($outputDestination);
679
+    }
680
+}

+ 561
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/Chart/Axis.php View File

@@ -0,0 +1,561 @@
1
+<?php
2
+
3
+/**
4
+ * Created by PhpStorm.
5
+ * User: Wiktor Trzonkowski
6
+ * Date: 6/17/14
7
+ * Time: 12:11 PM
8
+ */
9
+
10
+class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
11
+{
12
+    /**
13
+     * Axis Number
14
+     *
15
+     * @var  array of mixed
16
+     */
17
+    private $axisNumber = array(
18
+        'format' => self::FORMAT_CODE_GENERAL,
19
+        'source_linked' => 1
20
+    );
21
+
22
+    /**
23
+     * Axis Options
24
+     *
25
+     * @var  array of mixed
26
+     */
27
+    private $axisOptions = array(
28
+        'minimum' => null,
29
+        'maximum' => null,
30
+        'major_unit' => null,
31
+        'minor_unit' => null,
32
+        'orientation' => self::ORIENTATION_NORMAL,
33
+        'minor_tick_mark' => self::TICK_MARK_NONE,
34
+        'major_tick_mark' => self::TICK_MARK_NONE,
35
+        'axis_labels' => self::AXIS_LABELS_NEXT_TO,
36
+        'horizontal_crosses' => self::HORIZONTAL_CROSSES_AUTOZERO,
37
+        'horizontal_crosses_value' => null
38
+    );
39
+
40
+    /**
41
+     * Fill Properties
42
+     *
43
+     * @var  array of mixed
44
+     */
45
+    private $fillProperties = array(
46
+        'type' => self::EXCEL_COLOR_TYPE_ARGB,
47
+        'value' => null,
48
+        'alpha' => 0
49
+    );
50
+
51
+    /**
52
+     * Line Properties
53
+     *
54
+     * @var  array of mixed
55
+     */
56
+    private $lineProperties = array(
57
+        'type' => self::EXCEL_COLOR_TYPE_ARGB,
58
+        'value' => null,
59
+        'alpha' => 0
60
+    );
61
+
62
+    /**
63
+     * Line Style Properties
64
+     *
65
+     * @var  array of mixed
66
+     */
67
+    private $lineStyleProperties = array(
68
+        'width' => '9525',
69
+        'compound' => self::LINE_STYLE_COMPOUND_SIMPLE,
70
+        'dash' => self::LINE_STYLE_DASH_SOLID,
71
+        'cap' => self::LINE_STYLE_CAP_FLAT,
72
+        'join' => self::LINE_STYLE_JOIN_BEVEL,
73
+        'arrow' => array(
74
+            'head' => array(
75
+                'type' => self::LINE_STYLE_ARROW_TYPE_NOARROW,
76
+                'size' => self::LINE_STYLE_ARROW_SIZE_5
77
+            ),
78
+            'end' => array(
79
+                'type' => self::LINE_STYLE_ARROW_TYPE_NOARROW,
80
+                'size' => self::LINE_STYLE_ARROW_SIZE_8
81
+            ),
82
+        )
83
+    );
84
+
85
+    /**
86
+     * Shadow Properties
87
+     *
88
+     * @var  array of mixed
89
+     */
90
+    private $shadowProperties = array(
91
+        'presets' => self::SHADOW_PRESETS_NOSHADOW,
92
+        'effect' => null,
93
+        'color' => array(
94
+            'type' => self::EXCEL_COLOR_TYPE_STANDARD,
95
+            'value' => 'black',
96
+            'alpha' => 40,
97
+        ),
98
+        'size' => array(
99
+            'sx' => null,
100
+            'sy' => null,
101
+            'kx' => null
102
+        ),
103
+        'blur' => null,
104
+        'direction' => null,
105
+        'distance' => null,
106
+        'algn' => null,
107
+        'rotWithShape' => null
108
+    );
109
+
110
+    /**
111
+     * Glow Properties
112
+     *
113
+     * @var  array of mixed
114
+     */
115
+    private $glowProperties = array(
116
+        'size' => null,
117
+        'color' => array(
118
+            'type' => self::EXCEL_COLOR_TYPE_STANDARD,
119
+            'value' => 'black',
120
+            'alpha' => 40
121
+        )
122
+    );
123
+
124
+    /**
125
+     * Soft Edge Properties
126
+     *
127
+     * @var  array of mixed
128
+     */
129
+    private $softEdges = array(
130
+        'size' => null
131
+    );
132
+
133
+    /**
134
+     * Get Series Data Type
135
+     *
136
+     * @return  string
137
+     */
138
+    public function setAxisNumberProperties($format_code)
139
+    {
140
+        $this->axisNumber['format'] = (string) $format_code;
141
+        $this->axisNumber['source_linked'] = 0;
142
+    }
143
+
144
+    /**
145
+     * Get Axis Number Format Data Type
146
+     *
147
+     * @return  string
148
+     */
149
+    public function getAxisNumberFormat()
150
+    {
151
+        return $this->axisNumber['format'];
152
+    }
153
+
154
+    /**
155
+     * Get Axis Number Source Linked
156
+     *
157
+     * @return  string
158
+     */
159
+    public function getAxisNumberSourceLinked()
160
+    {
161
+        return (string) $this->axisNumber['source_linked'];
162
+    }
163
+
164
+    /**
165
+     * Set Axis Options Properties
166
+     *
167
+     * @param string $axis_labels
168
+     * @param string $horizontal_crosses_value
169
+     * @param string $horizontal_crosses
170
+     * @param string $axis_orientation
171
+     * @param string $major_tmt
172
+     * @param string $minor_tmt
173
+     * @param string $minimum
174
+     * @param string $maximum
175
+     * @param string $major_unit
176
+     * @param string $minor_unit
177
+     *
178
+     */
179
+    public function setAxisOptionsProperties($axis_labels, $horizontal_crosses_value = null, $horizontal_crosses = null, $axis_orientation = null, $major_tmt = null, $minor_tmt = null, $minimum = null, $maximum = null, $major_unit = null, $minor_unit = null)
180
+    {
181
+        $this->axisOptions['axis_labels'] = (string) $axis_labels;
182
+        ($horizontal_crosses_value !== null) ? $this->axisOptions['horizontal_crosses_value'] = (string) $horizontal_crosses_value : null;
183
+        ($horizontal_crosses !== null) ? $this->axisOptions['horizontal_crosses'] = (string) $horizontal_crosses : null;
184
+        ($axis_orientation !== null) ? $this->axisOptions['orientation'] = (string) $axis_orientation : null;
185
+        ($major_tmt !== null) ? $this->axisOptions['major_tick_mark'] = (string) $major_tmt : null;
186
+        ($minor_tmt !== null) ? $this->axisOptions['minor_tick_mark'] = (string) $minor_tmt : null;
187
+        ($minor_tmt !== null) ? $this->axisOptions['minor_tick_mark'] = (string) $minor_tmt : null;
188
+        ($minimum !== null) ? $this->axisOptions['minimum'] = (string) $minimum : null;
189
+        ($maximum !== null) ? $this->axisOptions['maximum'] = (string) $maximum : null;
190
+        ($major_unit !== null) ? $this->axisOptions['major_unit'] = (string) $major_unit : null;
191
+        ($minor_unit !== null) ? $this->axisOptions['minor_unit'] = (string) $minor_unit : null;
192
+    }
193
+
194
+    /**
195
+     * Get Axis Options Property
196
+     *
197
+     * @param string $property
198
+     *
199
+     * @return string
200
+     */
201
+    public function getAxisOptionsProperty($property)
202
+    {
203
+        return $this->axisOptions[$property];
204
+    }
205
+
206
+    /**
207
+     * Set Axis Orientation Property
208
+     *
209
+     * @param string $orientation
210
+     *
211
+     */
212
+    public function setAxisOrientation($orientation)
213
+    {
214
+        $this->orientation = (string) $orientation;
215
+    }
216
+
217
+    /**
218
+     * Set Fill Property
219
+     *
220
+     * @param string $color
221
+     * @param int $alpha
222
+     * @param string $type
223
+     *
224
+     */
225
+    public function setFillParameters($color, $alpha = 0, $type = self::EXCEL_COLOR_TYPE_ARGB)
226
+    {
227
+        $this->fillProperties = $this->setColorProperties($color, $alpha, $type);
228
+    }
229
+
230
+    /**
231
+     * Set Line Property
232
+     *
233
+     * @param string $color
234
+     * @param int $alpha
235
+     * @param string $type
236
+     *
237
+     */
238
+    public function setLineParameters($color, $alpha = 0, $type = self::EXCEL_COLOR_TYPE_ARGB)
239
+    {
240
+        $this->lineProperties = $this->setColorProperties($color, $alpha, $type);
241
+    }
242
+
243
+    /**
244
+     * Get Fill Property
245
+     *
246
+     * @param string $property
247
+     *
248
+     * @return string
249
+     */
250
+    public function getFillProperty($property)
251
+    {
252
+        return $this->fillProperties[$property];
253
+    }
254
+
255
+    /**
256
+     * Get Line Property
257
+     *
258
+     * @param string $property
259
+     *
260
+     * @return string
261
+     */
262
+    public function getLineProperty($property)
263
+    {
264
+        return $this->lineProperties[$property];
265
+    }
266
+
267
+    /**
268
+     * Set Line Style Properties
269
+     *
270
+     * @param float $line_width
271
+     * @param string $compound_type
272
+     * @param string $dash_type
273
+     * @param string $cap_type
274
+     * @param string $join_type
275
+     * @param string $head_arrow_type
276
+     * @param string $head_arrow_size
277
+     * @param string $end_arrow_type
278
+     * @param string $end_arrow_size
279
+     *
280
+     */
281
+    public function setLineStyleProperties($line_width = null, $compound_type = null, $dash_type = null, $cap_type = null, $join_type = null, $head_arrow_type = null, $head_arrow_size = null, $end_arrow_type = null, $end_arrow_size = null)
282
+    {
283
+        (!is_null($line_width)) ? $this->lineStyleProperties['width'] = $this->getExcelPointsWidth((float) $line_width) : null;
284
+        (!is_null($compound_type)) ? $this->lineStyleProperties['compound'] = (string) $compound_type : null;
285
+        (!is_null($dash_type)) ? $this->lineStyleProperties['dash'] = (string) $dash_type : null;
286
+        (!is_null($cap_type)) ? $this->lineStyleProperties['cap'] = (string) $cap_type : null;
287
+        (!is_null($join_type)) ? $this->lineStyleProperties['join'] = (string) $join_type : null;
288
+        (!is_null($head_arrow_type)) ? $this->lineStyleProperties['arrow']['head']['type'] = (string) $head_arrow_type : null;
289
+        (!is_null($head_arrow_size)) ? $this->lineStyleProperties['arrow']['head']['size'] = (string) $head_arrow_size : null;
290
+        (!is_null($end_arrow_type)) ? $this->lineStyleProperties['arrow']['end']['type'] = (string) $end_arrow_type : null;
291
+        (!is_null($end_arrow_size)) ? $this->lineStyleProperties['arrow']['end']['size'] = (string) $end_arrow_size : null;
292
+    }
293
+
294
+    /**
295
+     * Get Line Style Property
296
+     *
297
+     * @param array|string $elements
298
+     *
299
+     * @return string
300
+     */
301
+    public function getLineStyleProperty($elements)
302
+    {
303
+        return $this->getArrayElementsValue($this->lineStyleProperties, $elements);
304
+    }
305
+
306
+    /**
307
+     * Get Line Style Arrow Excel Width
308
+     *
309
+     * @param string $arrow
310
+     *
311
+     * @return string
312
+     */
313
+    public function getLineStyleArrowWidth($arrow)
314
+    {
315
+        return $this->getLineStyleArrowSize($this->lineStyleProperties['arrow'][$arrow]['size'], 'w');
316
+    }
317
+
318
+    /**
319
+     * Get Line Style Arrow Excel Length
320
+     *
321
+     * @param string $arrow
322
+     *
323
+     * @return string
324
+     */
325
+    public function getLineStyleArrowLength($arrow)
326
+    {
327
+        return $this->getLineStyleArrowSize($this->lineStyleProperties['arrow'][$arrow]['size'], 'len');
328
+    }
329
+
330
+    /**
331
+     * Set Shadow Properties
332
+     *
333
+     * @param int $shadow_presets
334
+     * @param string $sh_color_value
335
+     * @param string $sh_color_type
336
+     * @param string $sh_color_alpha
337
+     * @param float $sh_blur
338
+     * @param int $sh_angle
339
+     * @param float $sh_distance
340
+     *
341
+     */
342
+    public function setShadowProperties($sh_presets, $sh_color_value = null, $sh_color_type = null, $sh_color_alpha = null, $sh_blur = null, $sh_angle = null, $sh_distance = null)
343
+    {
344
+        $this->setShadowPresetsProperties((int) $sh_presets)
345
+            ->setShadowColor(
346
+                is_null($sh_color_value) ? $this->shadowProperties['color']['value'] : $sh_color_value,
347
+                is_null($sh_color_alpha) ? (int) $this->shadowProperties['color']['alpha'] : $sh_color_alpha,
348
+                is_null($sh_color_type) ? $this->shadowProperties['color']['type'] : $sh_color_type
349
+            )
350
+            ->setShadowBlur($sh_blur)
351
+            ->setShadowAngle($sh_angle)
352
+            ->setShadowDistance($sh_distance);
353
+    }
354
+
355
+    /**
356
+     * Set Shadow Color
357
+     *
358
+     * @param int $shadow_presets
359
+     *
360
+     * @return PHPExcel_Chart_Axis
361
+     */
362
+    private function setShadowPresetsProperties($shadow_presets)
363
+    {
364
+        $this->shadowProperties['presets'] = $shadow_presets;
365
+        $this->setShadowProperiesMapValues($this->getShadowPresetsMap($shadow_presets));
366
+
367
+        return $this;
368
+    }
369
+
370
+    /**
371
+     * Set Shadow Properties from Maped Values
372
+     *
373
+     * @param array $properties_map
374
+     * @param * $reference
375
+     *
376
+     * @return PHPExcel_Chart_Axis
377
+     */
378
+    private function setShadowProperiesMapValues(array $properties_map, &$reference = null)
379
+    {
380
+        $base_reference = $reference;
381
+        foreach ($properties_map as $property_key => $property_val) {
382
+            if (is_array($property_val)) {
383
+                if ($reference === null) {
384
+                    $reference = & $this->shadowProperties[$property_key];
385
+                } else {
386
+                    $reference = & $reference[$property_key];
387
+                }
388
+                $this->setShadowProperiesMapValues($property_val, $reference);
389
+            } else {
390
+                if ($base_reference === null) {
391
+                    $this->shadowProperties[$property_key] = $property_val;
392
+                } else {
393
+                    $reference[$property_key] = $property_val;
394
+                }
395
+            }
396
+        }
397
+
398
+        return $this;
399
+    }
400
+
401
+    /**
402
+     * Set Shadow Color
403
+     *
404
+     * @param string $color
405
+     * @param int $alpha
406
+     * @param string $type
407
+     *
408
+     * @return PHPExcel_Chart_Axis
409
+     */
410
+    private function setShadowColor($color, $alpha, $type)
411
+    {
412
+        $this->shadowProperties['color'] = $this->setColorProperties($color, $alpha, $type);
413
+
414
+        return $this;
415
+    }
416
+
417
+    /**
418
+     * Set Shadow Blur
419
+     *
420
+     * @param float $blur
421
+     *
422
+     * @return PHPExcel_Chart_Axis
423
+     */
424
+    private function setShadowBlur($blur)
425
+    {
426
+        if ($blur !== null) {
427
+            $this->shadowProperties['blur'] = (string) $this->getExcelPointsWidth($blur);
428
+        }
429
+
430
+        return $this;
431
+    }
432
+
433
+    /**
434
+     * Set Shadow Angle
435
+     *
436
+     * @param int $angle
437
+     *
438
+     * @return PHPExcel_Chart_Axis
439
+     */
440
+    private function setShadowAngle($angle)
441
+    {
442
+        if ($angle !== null) {
443
+            $this->shadowProperties['direction'] = (string) $this->getExcelPointsAngle($angle);
444
+        }
445
+
446
+        return $this;
447
+    }
448
+
449
+    /**
450
+     * Set Shadow Distance
451
+     *
452
+     * @param float $distance
453
+     *
454
+     * @return PHPExcel_Chart_Axis
455
+     */
456
+    private function setShadowDistance($distance)
457
+    {
458
+        if ($distance !== null) {
459
+            $this->shadowProperties['distance'] = (string) $this->getExcelPointsWidth($distance);
460
+        }
461
+
462
+        return $this;
463
+    }
464
+
465
+    /**
466
+     * Get Glow Property
467
+     *
468
+     * @param float $size
469
+     * @param string $color_value
470
+     * @param int $color_alpha
471
+     * @param string $color_type
472
+     */
473
+    public function getShadowProperty($elements)
474
+    {
475
+        return $this->getArrayElementsValue($this->shadowProperties, $elements);
476
+    }
477
+
478
+    /**
479
+     * Set Glow Properties
480
+     *
481
+     * @param float $size
482
+     * @param string $color_value
483
+     * @param int $color_alpha
484
+     * @param string $color_type
485
+     */
486
+    public function setGlowProperties($size, $color_value = null, $color_alpha = null, $color_type = null)
487
+    {
488
+        $this->setGlowSize($size)
489
+            ->setGlowColor(
490
+                is_null($color_value) ? $this->glowProperties['color']['value'] : $color_value,
491
+                is_null($color_alpha) ? (int) $this->glowProperties['color']['alpha'] : $color_alpha,
492
+                is_null($color_type) ? $this->glowProperties['color']['type'] : $color_type
493
+            );
494
+    }
495
+
496
+    /**
497
+     * Get Glow Property
498
+     *
499
+     * @param array|string $property
500
+     *
501
+     * @return string
502
+     */
503
+    public function getGlowProperty($property)
504
+    {
505
+        return $this->getArrayElementsValue($this->glowProperties, $property);
506
+    }
507
+
508
+    /**
509
+     * Set Glow Color
510
+     *
511
+     * @param float $size
512
+     *
513
+     * @return PHPExcel_Chart_Axis
514
+     */
515
+    private function setGlowSize($size)
516
+    {
517
+        if (!is_null($size)) {
518
+            $this->glowProperties['size'] = $this->getExcelPointsWidth($size);
519
+        }
520
+
521
+        return $this;
522
+    }
523
+
524
+    /**
525
+     * Set Glow Color
526
+     *
527
+     * @param string $color
528
+     * @param int $alpha
529
+     * @param string $type
530
+     *
531
+     * @return PHPExcel_Chart_Axis
532
+     */
533
+    private function setGlowColor($color, $alpha, $type)
534
+    {
535
+        $this->glowProperties['color'] = $this->setColorProperties($color, $alpha, $type);
536
+
537
+        return $this;
538
+    }
539
+
540
+    /**
541
+     * Set Soft Edges Size
542
+     *
543
+     * @param float $size
544
+     */
545
+    public function setSoftEdges($size)
546
+    {
547
+        if (!is_null($size)) {
548
+            $softEdges['size'] = (string) $this->getExcelPointsWidth($size);
549
+        }
550
+    }
551
+
552
+    /**
553
+     * Get Soft Edges Size
554
+     *
555
+     * @return string
556
+     */
557
+    public function getSoftEdgesSize()
558
+    {
559
+        return $this->softEdges['size'];
560
+    }
561
+}

+ 390
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/Chart/DataSeries.php View File

@@ -0,0 +1,390 @@
1
+<?php
2
+/**
3
+ * PHPExcel
4
+ *
5
+ * Copyright (c) 2006 - 2015 PHPExcel
6
+ *
7
+ * This library is free software; you can redistribute it and/or
8
+ * modify it under the terms of the GNU Lesser General Public
9
+ * License as published by the Free Software Foundation; either
10
+ * version 2.1 of the License, or (at your option) any later version.
11
+ *
12
+ * This library is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
+ * Lesser General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU Lesser General Public
18
+ * License along with this library; if not, write to the Free Software
19
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
20
+ *
21
+ * @category    PHPExcel
22
+ * @package        PHPExcel_Chart
23
+ * @copyright    Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
24
+ * @license        http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
25
+ * @version    ##VERSION##, ##DATE##
26
+ */
27
+
28
+
29
+/**
30
+ * PHPExcel_Chart_DataSeries
31
+ *
32
+ * @category    PHPExcel
33
+ * @package        PHPExcel_Chart
34
+ * @copyright    Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
35
+ */
36
+class PHPExcel_Chart_DataSeries
37
+{
38
+    const TYPE_BARCHART        = 'barChart';
39
+    const TYPE_BARCHART_3D     = 'bar3DChart';
40
+    const TYPE_LINECHART       = 'lineChart';
41
+    const TYPE_LINECHART_3D    = 'line3DChart';
42
+    const TYPE_AREACHART       = 'areaChart';
43
+    const TYPE_AREACHART_3D    = 'area3DChart';
44
+    const TYPE_PIECHART        = 'pieChart';
45
+    const TYPE_PIECHART_3D     = 'pie3DChart';
46
+    const TYPE_DOUGHTNUTCHART  = 'doughnutChart';
47
+    const TYPE_DONUTCHART      = self::TYPE_DOUGHTNUTCHART;    //    Synonym
48
+    const TYPE_SCATTERCHART    = 'scatterChart';
49
+    const TYPE_SURFACECHART    = 'surfaceChart';
50
+    const TYPE_SURFACECHART_3D = 'surface3DChart';
51
+    const TYPE_RADARCHART      = 'radarChart';
52
+    const TYPE_BUBBLECHART     = 'bubbleChart';
53
+    const TYPE_STOCKCHART      = 'stockChart';
54
+    const TYPE_CANDLECHART     = self::TYPE_STOCKCHART;       //    Synonym
55
+
56
+    const GROUPING_CLUSTERED       = 'clustered';
57
+    const GROUPING_STACKED         = 'stacked';
58
+    const GROUPING_PERCENT_STACKED = 'percentStacked';
59
+    const GROUPING_STANDARD        = 'standard';
60
+
61
+    const DIRECTION_BAR        = 'bar';
62
+    const DIRECTION_HORIZONTAL = self::DIRECTION_BAR;
63
+    const DIRECTION_COL        = 'col';
64
+    const DIRECTION_COLUMN     = self::DIRECTION_COL;
65
+    const DIRECTION_VERTICAL   = self::DIRECTION_COL;
66
+
67
+    const STYLE_LINEMARKER   = 'lineMarker';
68
+    const STYLE_SMOOTHMARKER = 'smoothMarker';
69
+    const STYLE_MARKER       = 'marker';
70
+    const STYLE_FILLED       = 'filled';
71
+
72
+
73
+    /**
74
+     * Series Plot Type
75
+     *
76
+     * @var string
77
+     */
78
+    private $plotType;
79
+
80
+    /**
81
+     * Plot Grouping Type
82
+     *
83
+     * @var boolean
84
+     */
85
+    private $plotGrouping;
86
+
87
+    /**
88
+     * Plot Direction
89
+     *
90
+     * @var boolean
91
+     */
92
+    private $plotDirection;
93
+
94
+    /**
95
+     * Plot Style
96
+     *
97
+     * @var string
98
+     */
99
+    private $plotStyle;
100
+
101
+    /**
102
+     * Order of plots in Series
103
+     *
104
+     * @var array of integer
105
+     */
106
+    private $plotOrder = array();
107
+
108
+    /**
109
+     * Plot Label
110
+     *
111
+     * @var array of PHPExcel_Chart_DataSeriesValues
112
+     */
113
+    private $plotLabel = array();
114
+
115
+    /**
116
+     * Plot Category
117
+     *
118
+     * @var array of PHPExcel_Chart_DataSeriesValues
119
+     */
120
+    private $plotCategory = array();
121
+
122
+    /**
123
+     * Smooth Line
124
+     *
125
+     * @var string
126
+     */
127
+    private $smoothLine;
128
+
129
+    /**
130
+     * Plot Values
131
+     *
132
+     * @var array of PHPExcel_Chart_DataSeriesValues
133
+     */
134
+    private $plotValues = array();
135
+
136
+    /**
137
+     * Create a new PHPExcel_Chart_DataSeries
138
+     */
139
+    public function __construct($plotType = null, $plotGrouping = null, $plotOrder = array(), $plotLabel = array(), $plotCategory = array(), $plotValues = array(), $plotDirection = null, $smoothLine = null, $plotStyle = null)
140
+    {
141
+        $this->plotType = $plotType;
142
+        $this->plotGrouping = $plotGrouping;
143
+        $this->plotOrder = $plotOrder;
144
+        $keys = array_keys($plotValues);
145
+        $this->plotValues = $plotValues;
146
+        if ((count($plotLabel) == 0) || (is_null($plotLabel[$keys[0]]))) {
147
+            $plotLabel[$keys[0]] = new PHPExcel_Chart_DataSeriesValues();
148
+        }
149
+
150
+        $this->plotLabel = $plotLabel;
151
+        if ((count($plotCategory) == 0) || (is_null($plotCategory[$keys[0]]))) {
152
+            $plotCategory[$keys[0]] = new PHPExcel_Chart_DataSeriesValues();
153
+        }
154
+        $this->plotCategory = $plotCategory;
155
+        $this->smoothLine = $smoothLine;
156
+        $this->plotStyle = $plotStyle;
157
+        
158
+        if (is_null($plotDirection)) {
159
+            $plotDirection = self::DIRECTION_COL;
160
+        }
161
+        $this->plotDirection = $plotDirection;
162
+    }
163
+
164
+    /**
165
+     * Get Plot Type
166
+     *
167
+     * @return string
168
+     */
169
+    public function getPlotType()
170
+    {
171
+        return $this->plotType;
172
+    }
173
+
174
+    /**
175
+     * Set Plot Type
176
+     *
177
+     * @param string $plotType
178
+     * @return PHPExcel_Chart_DataSeries
179
+     */
180
+    public function setPlotType($plotType = '')
181
+    {
182
+        $this->plotType = $plotType;
183
+        return $this;
184
+    }
185
+
186
+    /**
187
+     * Get Plot Grouping Type
188
+     *
189
+     * @return string
190
+     */
191
+    public function getPlotGrouping()
192
+    {
193
+        return $this->plotGrouping;
194
+    }
195
+
196
+    /**
197
+     * Set Plot Grouping Type
198
+     *
199
+     * @param string $groupingType
200
+     * @return PHPExcel_Chart_DataSeries
201
+     */
202
+    public function setPlotGrouping($groupingType = null)
203
+    {
204
+        $this->plotGrouping = $groupingType;
205
+        return $this;
206
+    }
207
+
208
+    /**
209
+     * Get Plot Direction
210
+     *
211
+     * @return string
212
+     */
213
+    public function getPlotDirection()
214
+    {
215
+        return $this->plotDirection;
216
+    }
217
+
218
+    /**
219
+     * Set Plot Direction
220
+     *
221
+     * @param string $plotDirection
222
+     * @return PHPExcel_Chart_DataSeries
223
+     */
224
+    public function setPlotDirection($plotDirection = null)
225
+    {
226
+        $this->plotDirection = $plotDirection;
227
+        return $this;
228
+    }
229
+
230
+    /**
231
+     * Get Plot Order
232
+     *
233
+     * @return string
234
+     */
235
+    public function getPlotOrder()
236
+    {
237
+        return $this->plotOrder;
238
+    }
239
+
240
+    /**
241
+     * Get Plot Labels
242
+     *
243
+     * @return array of PHPExcel_Chart_DataSeriesValues
244
+     */
245
+    public function getPlotLabels()
246
+    {
247
+        return $this->plotLabel;
248
+    }
249
+
250
+    /**
251
+     * Get Plot Label by Index
252
+     *
253
+     * @return PHPExcel_Chart_DataSeriesValues
254
+     */
255
+    public function getPlotLabelByIndex($index)
256
+    {
257
+        $keys = array_keys($this->plotLabel);
258
+        if (in_array($index, $keys)) {
259
+            return $this->plotLabel[$index];
260
+        } elseif (isset($keys[$index])) {
261
+            return $this->plotLabel[$keys[$index]];
262
+        }
263
+        return false;
264
+    }
265
+
266
+    /**
267
+     * Get Plot Categories
268
+     *
269
+     * @return array of PHPExcel_Chart_DataSeriesValues
270
+     */
271
+    public function getPlotCategories()
272
+    {
273
+        return $this->plotCategory;
274
+    }
275
+
276
+    /**
277
+     * Get Plot Category by Index
278
+     *
279
+     * @return PHPExcel_Chart_DataSeriesValues
280
+     */
281
+    public function getPlotCategoryByIndex($index)
282
+    {
283
+        $keys = array_keys($this->plotCategory);
284
+        if (in_array($index, $keys)) {
285
+            return $this->plotCategory[$index];
286
+        } elseif (isset($keys[$index])) {
287
+            return $this->plotCategory[$keys[$index]];
288
+        }
289
+        return false;
290
+    }
291
+
292
+    /**
293
+     * Get Plot Style
294
+     *
295
+     * @return string
296
+     */
297
+    public function getPlotStyle()
298
+    {
299
+        return $this->plotStyle;
300
+    }
301
+
302
+    /**
303
+     * Set Plot Style
304
+     *
305
+     * @param string $plotStyle
306
+     * @return PHPExcel_Chart_DataSeries
307
+     */
308
+    public function setPlotStyle($plotStyle = null)
309
+    {
310
+        $this->plotStyle = $plotStyle;
311
+        return $this;
312
+    }
313
+
314
+    /**
315
+     * Get Plot Values
316
+     *
317
+     * @return array of PHPExcel_Chart_DataSeriesValues
318
+     */
319
+    public function getPlotValues()
320
+    {
321
+        return $this->plotValues;
322
+    }
323
+
324
+    /**
325
+     * Get Plot Values by Index
326
+     *
327
+     * @return PHPExcel_Chart_DataSeriesValues
328
+     */
329
+    public function getPlotValuesByIndex($index)
330
+    {
331
+        $keys = array_keys($this->plotValues);
332
+        if (in_array($index, $keys)) {
333
+            return $this->plotValues[$index];
334
+        } elseif (isset($keys[$index])) {
335
+            return $this->plotValues[$keys[$index]];
336
+        }
337
+        return false;
338
+    }
339
+
340
+    /**
341
+     * Get Number of Plot Series
342
+     *
343
+     * @return integer
344
+     */
345
+    public function getPlotSeriesCount()
346
+    {
347
+        return count($this->plotValues);
348
+    }
349
+
350
+    /**
351
+     * Get Smooth Line
352
+     *
353
+     * @return boolean
354
+     */
355
+    public function getSmoothLine()
356
+    {
357
+        return $this->smoothLine;
358
+    }
359
+
360
+    /**
361
+     * Set Smooth Line
362
+     *
363
+     * @param boolean $smoothLine
364
+     * @return PHPExcel_Chart_DataSeries
365
+     */
366
+    public function setSmoothLine($smoothLine = true)
367
+    {
368
+        $this->smoothLine = $smoothLine;
369
+        return $this;
370
+    }
371
+
372
+    public function refresh(PHPExcel_Worksheet $worksheet)
373
+    {
374
+        foreach ($this->plotValues as $plotValues) {
375
+            if ($plotValues !== null) {
376
+                $plotValues->refresh($worksheet, true);
377
+            }
378
+        }
379
+        foreach ($this->plotLabel as $plotValues) {
380
+            if ($plotValues !== null) {
381
+                $plotValues->refresh($worksheet, true);
382
+            }
383
+        }
384
+        foreach ($this->plotCategory as $plotValues) {
385
+            if ($plotValues !== null) {
386
+                $plotValues->refresh($worksheet, false);
387
+            }
388
+        }
389
+    }
390
+}

+ 333
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/Chart/DataSeriesValues.php View File

@@ -0,0 +1,333 @@
1
+<?php
2
+
3
+/**
4
+ * PHPExcel_Chart_DataSeriesValues
5
+ *
6
+ * Copyright (c) 2006 - 2015 PHPExcel
7
+ *
8
+ * This library is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU Lesser General Public
10
+ * License as published by the Free Software Foundation; either
11
+ * version 2.1 of the License, or (at your option) any later version.
12
+ *
13
+ * This library is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
+ * Lesser General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU Lesser General Public
19
+ * License along with this library; if not, write to the Free Software
20
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21
+ *
22
+ * @category    PHPExcel
23
+ * @package        PHPExcel_Chart
24
+ * @copyright    Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
25
+ * @license        http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
26
+ * @version        ##VERSION##, ##DATE##
27
+ */
28
+class PHPExcel_Chart_DataSeriesValues
29
+{
30
+
31
+    const DATASERIES_TYPE_STRING    = 'String';
32
+    const DATASERIES_TYPE_NUMBER    = 'Number';
33
+
34
+    private static $dataTypeValues = array(
35
+        self::DATASERIES_TYPE_STRING,
36
+        self::DATASERIES_TYPE_NUMBER,
37
+    );
38
+
39
+    /**
40
+     * Series Data Type
41
+     *
42
+     * @var    string
43
+     */
44
+    private $dataType;
45
+
46
+    /**
47
+     * Series Data Source
48
+     *
49
+     * @var    string
50
+     */
51
+    private $dataSource;
52
+
53
+    /**
54
+     * Format Code
55
+     *
56
+     * @var    string
57
+     */
58
+    private $formatCode;
59
+
60
+    /**
61
+     * Series Point Marker
62
+     *
63
+     * @var    string
64
+     */
65
+    private $pointMarker;
66
+
67
+    /**
68
+     * Point Count (The number of datapoints in the dataseries)
69
+     *
70
+     * @var    integer
71
+     */
72
+    private $pointCount = 0;
73
+
74
+    /**
75
+     * Data Values
76
+     *
77
+     * @var    array of mixed
78
+     */
79
+    private $dataValues = array();
80
+
81
+    /**
82
+     * Create a new PHPExcel_Chart_DataSeriesValues object
83
+     */
84
+    public function __construct($dataType = self::DATASERIES_TYPE_NUMBER, $dataSource = null, $formatCode = null, $pointCount = 0, $dataValues = array(), $marker = null)
85
+    {
86
+        $this->setDataType($dataType);
87
+        $this->dataSource = $dataSource;
88
+        $this->formatCode = $formatCode;
89
+        $this->pointCount = $pointCount;
90
+        $this->dataValues = $dataValues;
91
+        $this->pointMarker = $marker;
92
+    }
93
+
94
+    /**
95
+     * Get Series Data Type
96
+     *
97
+     * @return    string
98
+     */
99
+    public function getDataType()
100
+    {
101
+        return $this->dataType;
102
+    }
103
+
104
+    /**
105
+     * Set Series Data Type
106
+     *
107
+     * @param    string    $dataType    Datatype of this data series
108
+     *                                Typical values are:
109
+     *                                    PHPExcel_Chart_DataSeriesValues::DATASERIES_TYPE_STRING
110
+     *                                        Normally used for axis point values
111
+     *                                    PHPExcel_Chart_DataSeriesValues::DATASERIES_TYPE_NUMBER
112
+     *                                        Normally used for chart data values
113
+     * @return    PHPExcel_Chart_DataSeriesValues
114
+     */
115
+    public function setDataType($dataType = self::DATASERIES_TYPE_NUMBER)
116
+    {
117
+        if (!in_array($dataType, self::$dataTypeValues)) {
118
+            throw new PHPExcel_Chart_Exception('Invalid datatype for chart data series values');
119
+        }
120
+        $this->dataType = $dataType;
121
+
122
+        return $this;
123
+    }
124
+
125
+    /**
126
+     * Get Series Data Source (formula)
127
+     *
128
+     * @return    string
129
+     */
130
+    public function getDataSource()
131
+    {
132
+        return $this->dataSource;
133
+    }
134
+
135
+    /**
136
+     * Set Series Data Source (formula)
137
+     *
138
+     * @param    string    $dataSource
139
+     * @return    PHPExcel_Chart_DataSeriesValues
140
+     */
141
+    public function setDataSource($dataSource = null, $refreshDataValues = true)
142
+    {
143
+        $this->dataSource = $dataSource;
144
+
145
+        if ($refreshDataValues) {
146
+            //    TO DO
147
+        }
148
+
149
+        return $this;
150
+    }
151
+
152
+    /**
153
+     * Get Point Marker
154
+     *
155
+     * @return string
156
+     */
157
+    public function getPointMarker()
158
+    {
159
+        return $this->pointMarker;
160
+    }
161
+
162
+    /**
163
+     * Set Point Marker
164
+     *
165
+     * @param    string    $marker
166
+     * @return    PHPExcel_Chart_DataSeriesValues
167
+     */
168
+    public function setPointMarker($marker = null)
169
+    {
170
+        $this->pointMarker = $marker;
171
+
172
+        return $this;
173
+    }
174
+
175
+    /**
176
+     * Get Series Format Code
177
+     *
178
+     * @return    string
179
+     */
180
+    public function getFormatCode()
181
+    {
182
+        return $this->formatCode;
183
+    }
184
+
185
+    /**
186
+     * Set Series Format Code
187
+     *
188
+     * @param    string    $formatCode
189
+     * @return    PHPExcel_Chart_DataSeriesValues
190
+     */
191
+    public function setFormatCode($formatCode = null)
192
+    {
193
+        $this->formatCode = $formatCode;
194
+
195
+        return $this;
196
+    }
197
+
198
+    /**
199
+     * Get Series Point Count
200
+     *
201
+     * @return    integer
202
+     */
203
+    public function getPointCount()
204
+    {
205
+        return $this->pointCount;
206
+    }
207
+
208
+    /**
209
+     * Identify if the Data Series is a multi-level or a simple series
210
+     *
211
+     * @return    boolean
212
+     */
213
+    public function isMultiLevelSeries()
214
+    {
215
+        if (count($this->dataValues) > 0) {
216
+            return is_array($this->dataValues[0]);
217
+        }
218
+        return null;
219
+    }
220
+
221
+    /**
222
+     * Return the level count of a multi-level Data Series
223
+     *
224
+     * @return    boolean
225
+     */
226
+    public function multiLevelCount()
227
+    {
228
+        $levelCount = 0;
229
+        foreach ($this->dataValues as $dataValueSet) {
230
+            $levelCount = max($levelCount, count($dataValueSet));
231
+        }
232
+        return $levelCount;
233
+    }
234
+
235
+    /**
236
+     * Get Series Data Values
237
+     *
238
+     * @return    array of mixed
239
+     */
240
+    public function getDataValues()
241
+    {
242
+        return $this->dataValues;
243
+    }
244
+
245
+    /**
246
+     * Get the first Series Data value
247
+     *
248
+     * @return    mixed
249
+     */
250
+    public function getDataValue()
251
+    {
252
+        $count = count($this->dataValues);
253
+        if ($count == 0) {
254
+            return null;
255
+        } elseif ($count == 1) {
256
+            return $this->dataValues[0];
257
+        }
258
+        return $this->dataValues;
259
+    }
260
+
261
+    /**
262
+     * Set Series Data Values
263
+     *
264
+     * @param    array    $dataValues
265
+     * @param    boolean    $refreshDataSource
266
+     *                    TRUE - refresh the value of dataSource based on the values of $dataValues
267
+     *                    FALSE - don't change the value of dataSource
268
+     * @return    PHPExcel_Chart_DataSeriesValues
269
+     */
270
+    public function setDataValues($dataValues = array(), $refreshDataSource = true)
271
+    {
272
+        $this->dataValues = PHPExcel_Calculation_Functions::flattenArray($dataValues);
273
+        $this->pointCount = count($dataValues);
274
+
275
+        if ($refreshDataSource) {
276
+            //    TO DO
277
+        }
278
+
279
+        return $this;
280
+    }
281
+
282
+    private function stripNulls($var)
283
+    {
284
+        return $var !== null;
285
+    }
286
+
287
+    public function refresh(PHPExcel_Worksheet $worksheet, $flatten = true)
288
+    {
289
+        if ($this->dataSource !== null) {
290
+            $calcEngine = PHPExcel_Calculation::getInstance($worksheet->getParent());
291
+            $newDataValues = PHPExcel_Calculation::unwrapResult(
292
+                $calcEngine->_calculateFormulaValue(
293
+                    '='.$this->dataSource,
294
+                    null,
295
+                    $worksheet->getCell('A1')
296
+                )
297
+            );
298
+            if ($flatten) {
299
+                $this->dataValues = PHPExcel_Calculation_Functions::flattenArray($newDataValues);
300
+                foreach ($this->dataValues as &$dataValue) {
301
+                    if ((!empty($dataValue)) && ($dataValue[0] == '#')) {
302
+                        $dataValue = 0.0;
303
+                    }
304
+                }
305
+                unset($dataValue);
306
+            } else {
307
+                $cellRange = explode('!', $this->dataSource);
308
+                if (count($cellRange) > 1) {
309
+                    list(, $cellRange) = $cellRange;
310
+                }
311
+
312
+                $dimensions = PHPExcel_Cell::rangeDimension(str_replace('$', '', $cellRange));
313
+                if (($dimensions[0] == 1) || ($dimensions[1] == 1)) {
314
+                    $this->dataValues = PHPExcel_Calculation_Functions::flattenArray($newDataValues);
315
+                } else {
316
+                    $newArray = array_values(array_shift($newDataValues));
317
+                    foreach ($newArray as $i => $newDataSet) {
318
+                        $newArray[$i] = array($newDataSet);
319
+                    }
320
+
321
+                    foreach ($newDataValues as $newDataSet) {
322
+                        $i = 0;
323
+                        foreach ($newDataSet as $newDataVal) {
324
+                            array_unshift($newArray[$i++], $newDataVal);
325
+                        }
326
+                    }
327
+                    $this->dataValues = $newArray;
328
+                }
329
+            }
330
+            $this->pointCount = count($this->dataValues);
331
+        }
332
+    }
333
+}

+ 46
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/Chart/Exception.php View File

@@ -0,0 +1,46 @@
1
+<?php
2
+
3
+/**
4
+ * PHPExcel_Chart_Exception
5
+ *
6
+ * Copyright (c) 2006 - 2015 PHPExcel
7
+ *
8
+ * This library is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU Lesser General Public
10
+ * License as published by the Free Software Foundation; either
11
+ * version 2.1 of the License, or (at your option) any later version.
12
+ *
13
+ * This library is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
+ * Lesser General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU Lesser General Public
19
+ * License along with this library; if not, write to the Free Software
20
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21
+ *
22
+ * @category   PHPExcel
23
+ * @package    PHPExcel_Chart
24
+ * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
25
+ * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
26
+ * @version    ##VERSION##, ##DATE##
27
+ */
28
+class PHPExcel_Chart_Exception extends PHPExcel_Exception
29
+{
30
+    /**
31
+     * Error handler callback
32
+     *
33
+     * @param mixed $code
34
+     * @param mixed $string
35
+     * @param mixed $file
36
+     * @param mixed $line
37
+     * @param mixed $context
38
+     */
39
+    public static function errorHandlerCallback($code, $string, $file, $line, $context)
40
+    {
41
+        $e = new self($string, $code);
42
+        $e->line = $line;
43
+        $e->file = $file;
44
+        throw $e;
45
+    }
46
+}

+ 472
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/Chart/GridLines.php View File

@@ -0,0 +1,472 @@
1
+<?php
2
+
3
+/**
4
+ * Created by PhpStorm.
5
+ * User: Wiktor Trzonkowski
6
+ * Date: 7/2/14
7
+ * Time: 2:36 PM
8
+ */
9
+
10
+class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
11
+{
12
+
13
+  /**
14
+   * Properties of Class:
15
+   * Object State (State for Minor Tick Mark) @var bool
16
+   * Line Properties @var  array of mixed
17
+   * Shadow Properties @var  array of mixed
18
+   * Glow Properties @var  array of mixed
19
+   * Soft Properties @var  array of mixed
20
+   *
21
+   */
22
+
23
+    private $objectState = false;
24
+
25
+    private $lineProperties = array(
26
+        'color' => array(
27
+            'type' => self::EXCEL_COLOR_TYPE_STANDARD,
28
+            'value' => null,
29
+            'alpha' => 0
30
+        ),
31
+        'style' => array(
32
+            'width' => '9525',
33
+            'compound' => self::LINE_STYLE_COMPOUND_SIMPLE,
34
+            'dash' => self::LINE_STYLE_DASH_SOLID,
35
+            'cap' => self::LINE_STYLE_CAP_FLAT,
36
+            'join' => self::LINE_STYLE_JOIN_BEVEL,
37
+            'arrow' => array(
38
+                'head' => array(
39
+                    'type' => self::LINE_STYLE_ARROW_TYPE_NOARROW,
40
+                    'size' => self::LINE_STYLE_ARROW_SIZE_5
41
+                ),
42
+                'end' => array(
43
+                    'type' => self::LINE_STYLE_ARROW_TYPE_NOARROW,
44
+                    'size' => self::LINE_STYLE_ARROW_SIZE_8
45
+                ),
46
+            )
47
+        )
48
+    );
49
+
50
+    private $shadowProperties = array(
51
+        'presets' => self::SHADOW_PRESETS_NOSHADOW,
52
+        'effect' => null,
53
+        'color' => array(
54
+            'type' => self::EXCEL_COLOR_TYPE_STANDARD,
55
+            'value' => 'black',
56
+            'alpha' => 85,
57
+        ),
58
+        'size' => array(
59
+            'sx' => null,
60
+            'sy' => null,
61
+            'kx' => null
62
+        ),
63
+        'blur' => null,
64
+        'direction' => null,
65
+        'distance' => null,
66
+        'algn' => null,
67
+        'rotWithShape' => null
68
+    );
69
+
70
+    private $glowProperties = array(
71
+        'size' => null,
72
+        'color' => array(
73
+            'type' => self::EXCEL_COLOR_TYPE_STANDARD,
74
+            'value' => 'black',
75
+            'alpha' => 40
76
+        )
77
+    );
78
+
79
+    private $softEdges = array(
80
+        'size' => null
81
+     );
82
+
83
+    /**
84
+     * Get Object State
85
+     *
86
+     * @return bool
87
+     */
88
+
89
+    public function getObjectState()
90
+    {
91
+        return $this->objectState;
92
+    }
93
+
94
+    /**
95
+     * Change Object State to True
96
+     *
97
+     * @return PHPExcel_Chart_GridLines
98
+     */
99
+
100
+    private function activateObject()
101
+    {
102
+        $this->objectState = true;
103
+
104
+        return $this;
105
+    }
106
+
107
+    /**
108
+     * Set Line Color Properties
109
+     *
110
+     * @param string $value
111
+     * @param int $alpha
112
+     * @param string $type
113
+     */
114
+
115
+    public function setLineColorProperties($value, $alpha = 0, $type = self::EXCEL_COLOR_TYPE_STANDARD)
116
+    {
117
+        $this->activateObject()
118
+            ->lineProperties['color'] = $this->setColorProperties(
119
+                $value,
120
+                $alpha,
121
+                $type
122
+            );
123
+    }
124
+
125
+    /**
126
+     * Set Line Color Properties
127
+     *
128
+     * @param float $line_width
129
+     * @param string $compound_type
130
+     * @param string $dash_type
131
+     * @param string $cap_type
132
+     * @param string $join_type
133
+     * @param string $head_arrow_type
134
+     * @param string $head_arrow_size
135
+     * @param string $end_arrow_type
136
+     * @param string $end_arrow_size
137
+     */
138
+
139
+    public function setLineStyleProperties($line_width = null, $compound_type = null, $dash_type = null, $cap_type = null, $join_type = null, $head_arrow_type = null, $head_arrow_size = null, $end_arrow_type = null, $end_arrow_size = null)
140
+    {
141
+        $this->activateObject();
142
+        (!is_null($line_width))
143
+                ? $this->lineProperties['style']['width'] = $this->getExcelPointsWidth((float) $line_width)
144
+                : null;
145
+        (!is_null($compound_type))
146
+                ? $this->lineProperties['style']['compound'] = (string) $compound_type
147
+                : null;
148
+        (!is_null($dash_type))
149
+                ? $this->lineProperties['style']['dash'] = (string) $dash_type
150
+                : null;
151
+        (!is_null($cap_type))
152
+                ? $this->lineProperties['style']['cap'] = (string) $cap_type
153
+                : null;
154
+        (!is_null($join_type))
155
+                ? $this->lineProperties['style']['join'] = (string) $join_type
156
+                : null;
157
+        (!is_null($head_arrow_type))
158
+                ? $this->lineProperties['style']['arrow']['head']['type'] = (string) $head_arrow_type
159
+                : null;
160
+        (!is_null($head_arrow_size))
161
+                ? $this->lineProperties['style']['arrow']['head']['size'] = (string) $head_arrow_size
162
+                : null;
163
+        (!is_null($end_arrow_type))
164
+                ? $this->lineProperties['style']['arrow']['end']['type'] = (string) $end_arrow_type
165
+                : null;
166
+        (!is_null($end_arrow_size))
167
+                ? $this->lineProperties['style']['arrow']['end']['size'] = (string) $end_arrow_size
168
+                : null;
169
+    }
170
+
171
+    /**
172
+     * Get Line Color Property
173
+     *
174
+     * @param string $parameter
175
+     *
176
+     * @return string
177
+     */
178
+
179
+    public function getLineColorProperty($parameter)
180
+    {
181
+        return $this->lineProperties['color'][$parameter];
182
+    }
183
+
184
+    /**
185
+     * Get Line Style Property
186
+     *
187
+     * @param    array|string $elements
188
+     *
189
+     * @return string
190
+     */
191
+
192
+    public function getLineStyleProperty($elements)
193
+    {
194
+        return $this->getArrayElementsValue($this->lineProperties['style'], $elements);
195
+    }
196
+
197
+    /**
198
+     * Set Glow Properties
199
+     *
200
+     * @param    float $size
201
+     * @param    string $color_value
202
+     * @param    int $color_alpha
203
+     * @param    string $color_type
204
+     *
205
+     */
206
+
207
+    public function setGlowProperties($size, $color_value = null, $color_alpha = null, $color_type = null)
208
+    {
209
+        $this
210
+                ->activateObject()
211
+                ->setGlowSize($size)
212
+                ->setGlowColor($color_value, $color_alpha, $color_type);
213
+    }
214
+
215
+    /**
216
+     * Get Glow Color Property
217
+     *
218
+     * @param string $property
219
+     *
220
+     * @return string
221
+     */
222
+
223
+    public function getGlowColor($property)
224
+    {
225
+        return $this->glowProperties['color'][$property];
226
+    }
227
+
228
+    /**
229
+     * Get Glow Size
230
+     *
231
+     * @return string
232
+     */
233
+
234
+    public function getGlowSize()
235
+    {
236
+        return $this->glowProperties['size'];
237
+    }
238
+
239
+    /**
240
+     * Set Glow Size
241
+     *
242
+     * @param float $size
243
+     *
244
+     * @return PHPExcel_Chart_GridLines
245
+     */
246
+
247
+    private function setGlowSize($size)
248
+    {
249
+        $this->glowProperties['size'] = $this->getExcelPointsWidth((float) $size);
250
+
251
+        return $this;
252
+    }
253
+
254
+    /**
255
+     * Set Glow Color
256
+     *
257
+     * @param string $color
258
+     * @param int $alpha
259
+     * @param string $type
260
+     *
261
+     * @return PHPExcel_Chart_GridLines
262
+     */
263
+
264
+    private function setGlowColor($color, $alpha, $type)
265
+    {
266
+        if (!is_null($color)) {
267
+            $this->glowProperties['color']['value'] = (string) $color;
268
+        }
269
+        if (!is_null($alpha)) {
270
+            $this->glowProperties['color']['alpha'] = $this->getTrueAlpha((int) $alpha);
271
+        }
272
+        if (!is_null($type)) {
273
+            $this->glowProperties['color']['type'] = (string) $type;
274
+        }
275
+
276
+        return $this;
277
+    }
278
+
279
+    /**
280
+     * Get Line Style Arrow Parameters
281
+     *
282
+     * @param string $arrow_selector
283
+     * @param string $property_selector
284
+     *
285
+     * @return string
286
+     */
287
+
288
+    public function getLineStyleArrowParameters($arrow_selector, $property_selector)
289
+    {
290
+        return $this->getLineStyleArrowSize($this->lineProperties['style']['arrow'][$arrow_selector]['size'], $property_selector);
291
+    }
292
+
293
+    /**
294
+     * Set Shadow Properties
295
+     *
296
+     * @param int $sh_presets
297
+     * @param string $sh_color_value
298
+     * @param string $sh_color_type
299
+     * @param int $sh_color_alpha
300
+     * @param string $sh_blur
301
+     * @param int $sh_angle
302
+     * @param float $sh_distance
303
+     *
304
+     */
305
+
306
+    public function setShadowProperties($sh_presets, $sh_color_value = null, $sh_color_type = null, $sh_color_alpha = null, $sh_blur = null, $sh_angle = null, $sh_distance = null)
307
+    {
308
+        $this->activateObject()
309
+            ->setShadowPresetsProperties((int) $sh_presets)
310
+            ->setShadowColor(
311
+                is_null($sh_color_value) ? $this->shadowProperties['color']['value'] : $sh_color_value,
312
+                is_null($sh_color_alpha) ? (int) $this->shadowProperties['color']['alpha'] : $this->getTrueAlpha($sh_color_alpha),
313
+                is_null($sh_color_type) ? $this->shadowProperties['color']['type'] : $sh_color_type
314
+            )
315
+            ->setShadowBlur($sh_blur)
316
+            ->setShadowAngle($sh_angle)
317
+            ->setShadowDistance($sh_distance);
318
+    }
319
+
320
+    /**
321
+     * Set Shadow Presets Properties
322
+     *
323
+     * @param int $shadow_presets
324
+     *
325
+     * @return PHPExcel_Chart_GridLines
326
+     */
327
+
328
+    private function setShadowPresetsProperties($shadow_presets)
329
+    {
330
+        $this->shadowProperties['presets'] = $shadow_presets;
331
+        $this->setShadowProperiesMapValues($this->getShadowPresetsMap($shadow_presets));
332
+
333
+        return $this;
334
+    }
335
+
336
+    /**
337
+     * Set Shadow Properties Values
338
+     *
339
+     * @param array $properties_map
340
+     * @param * $reference
341
+     *
342
+     * @return PHPExcel_Chart_GridLines
343
+     */
344
+
345
+    private function setShadowProperiesMapValues(array $properties_map, &$reference = null)
346
+    {
347
+        $base_reference = $reference;
348
+        foreach ($properties_map as $property_key => $property_val) {
349
+            if (is_array($property_val)) {
350
+                if ($reference === null) {
351
+                    $reference = & $this->shadowProperties[$property_key];
352
+                } else {
353
+                    $reference = & $reference[$property_key];
354
+                }
355
+                $this->setShadowProperiesMapValues($property_val, $reference);
356
+            } else {
357
+                if ($base_reference === null) {
358
+                    $this->shadowProperties[$property_key] = $property_val;
359
+                } else {
360
+                    $reference[$property_key] = $property_val;
361
+                }
362
+            }
363
+        }
364
+
365
+        return $this;
366
+    }
367
+
368
+    /**
369
+     * Set Shadow Color
370
+     *
371
+     * @param string $color
372
+     * @param int $alpha
373
+     * @param string $type
374
+     * @return PHPExcel_Chart_GridLines
375
+     */
376
+    private function setShadowColor($color, $alpha, $type)
377
+    {
378
+        if (!is_null($color)) {
379
+            $this->shadowProperties['color']['value'] = (string) $color;
380
+        }
381
+        if (!is_null($alpha)) {
382
+            $this->shadowProperties['color']['alpha'] = $this->getTrueAlpha((int) $alpha);
383
+        }
384
+        if (!is_null($type)) {
385
+            $this->shadowProperties['color']['type'] = (string) $type;
386
+        }
387
+
388
+        return $this;
389
+    }
390
+
391
+    /**
392
+     * Set Shadow Blur
393
+     *
394
+     * @param float $blur
395
+     *
396
+     * @return PHPExcel_Chart_GridLines
397
+     */
398
+    private function setShadowBlur($blur)
399
+    {
400
+        if ($blur !== null) {
401
+            $this->shadowProperties['blur'] = (string) $this->getExcelPointsWidth($blur);
402
+        }
403
+
404
+        return $this;
405
+    }
406
+
407
+    /**
408
+     * Set Shadow Angle
409
+     *
410
+     * @param int $angle
411
+     * @return PHPExcel_Chart_GridLines
412
+     */
413
+
414
+    private function setShadowAngle($angle)
415
+    {
416
+        if ($angle !== null) {
417
+            $this->shadowProperties['direction'] = (string) $this->getExcelPointsAngle($angle);
418
+        }
419
+
420
+        return $this;
421
+    }
422
+
423
+    /**
424
+     * Set Shadow Distance
425
+     *
426
+     * @param float $distance
427
+     * @return PHPExcel_Chart_GridLines
428
+     */
429
+    private function setShadowDistance($distance)
430
+    {
431
+        if ($distance !== null) {
432
+            $this->shadowProperties['distance'] = (string) $this->getExcelPointsWidth($distance);
433
+        }
434
+
435
+        return $this;
436
+    }
437
+
438
+    /**
439
+     * Get Shadow Property
440
+     *
441
+     * @param string $elements
442
+     * @param array $elements
443
+     * @return string
444
+     */
445
+    public function getShadowProperty($elements)
446
+    {
447
+        return $this->getArrayElementsValue($this->shadowProperties, $elements);
448
+    }
449
+
450
+    /**
451
+     * Set Soft Edges Size
452
+     *
453
+     * @param float $size
454
+     */
455
+    public function setSoftEdgesSize($size)
456
+    {
457
+        if (!is_null($size)) {
458
+            $this->activateObject();
459
+            $softEdges['size'] = (string) $this->getExcelPointsWidth($size);
460
+        }
461
+    }
462
+
463
+    /**
464
+     * Get Soft Edges Size
465
+     *
466
+     * @return string
467
+     */
468
+    public function getSoftEdgesSize()
469
+    {
470
+        return $this->softEdges['size'];
471
+    }
472
+}

+ 486
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/Chart/Layout.php View File

@@ -0,0 +1,486 @@
1
+<?php
2
+/**
3
+ * PHPExcel
4
+ *
5
+ * Copyright (c) 2006 - 2015 PHPExcel
6
+ *
7
+ * This library is free software; you can redistribute it and/or
8
+ * modify it under the terms of the GNU Lesser General Public
9
+ * License as published by the Free Software Foundation; either
10
+ * version 2.1 of the License, or (at your option) any later version.
11
+ *
12
+ * This library is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
+ * Lesser General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU Lesser General Public
18
+ * License along with this library; if not, write to the Free Software
19
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
20
+ *
21
+ * @category    PHPExcel
22
+ * @package        PHPExcel_Chart
23
+ * @copyright    Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
24
+ * @license        http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
25
+ * @version        ##VERSION##, ##DATE##
26
+ */
27
+
28
+
29
+/**
30
+ * PHPExcel_Chart_Layout
31
+ *
32
+ * @category    PHPExcel
33
+ * @package        PHPExcel_Chart
34
+ * @copyright    Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
35
+ */
36
+class PHPExcel_Chart_Layout
37
+{
38
+    /**
39
+     * layoutTarget
40
+     *
41
+     * @var string
42
+     */
43
+    private $layoutTarget;
44
+
45
+    /**
46
+     * X Mode
47
+     *
48
+     * @var string
49
+     */
50
+    private $xMode;
51
+
52
+    /**
53
+     * Y Mode
54
+     *
55
+     * @var string
56
+     */
57
+    private $yMode;
58
+
59
+    /**
60
+     * X-Position
61
+     *
62
+     * @var float
63
+     */
64
+    private $xPos;
65
+
66
+    /**
67
+     * Y-Position
68
+     *
69
+     * @var float
70
+     */
71
+    private $yPos;
72
+
73
+    /**
74
+     * width
75
+     *
76
+     * @var float
77
+     */
78
+    private $width;
79
+
80
+    /**
81
+     * height
82
+     *
83
+     * @var float
84
+     */
85
+    private $height;
86
+
87
+    /**
88
+     * show legend key
89
+     * Specifies that legend keys should be shown in data labels
90
+     *
91
+     * @var boolean
92
+     */
93
+    private $showLegendKey;
94
+
95
+    /**
96
+     * show value
97
+     * Specifies that the value should be shown in a data label.
98
+     *
99
+     * @var boolean
100
+     */
101
+    private $showVal;
102
+
103
+    /**
104
+     * show category name
105
+     * Specifies that the category name should be shown in the data label.
106
+     *
107
+     * @var boolean
108
+     */
109
+    private $showCatName;
110
+
111
+    /**
112
+     * show data series name
113
+     * Specifies that the series name should be shown in the data label.
114
+     *
115
+     * @var boolean
116
+     */
117
+    private $showSerName;
118
+
119
+    /**
120
+     * show percentage
121
+     * Specifies that the percentage should be shown in the data label.
122
+     *
123
+     * @var boolean
124
+     */
125
+    private $showPercent;
126
+
127
+    /**
128
+     * show bubble size
129
+     *
130
+     * @var boolean
131
+     */
132
+    private $showBubbleSize;
133
+
134
+    /**
135
+     * show leader lines
136
+     * Specifies that leader lines should be shown for the data label.
137
+     *
138
+     * @var boolean
139
+     */
140
+    private $showLeaderLines;
141
+
142
+
143
+    /**
144
+     * Create a new PHPExcel_Chart_Layout
145
+     */
146
+    public function __construct($layout = array())
147
+    {
148
+        if (isset($layout['layoutTarget'])) {
149
+            $this->layoutTarget = $layout['layoutTarget'];
150
+        }
151
+        if (isset($layout['xMode'])) {
152
+            $this->xMode = $layout['xMode'];
153
+        }
154
+        if (isset($layout['yMode'])) {
155
+            $this->yMode = $layout['yMode'];
156
+        }
157
+        if (isset($layout['x'])) {
158
+            $this->xPos = (float) $layout['x'];
159
+        }
160
+        if (isset($layout['y'])) {
161
+            $this->yPos = (float) $layout['y'];
162
+        }
163
+        if (isset($layout['w'])) {
164
+            $this->width = (float) $layout['w'];
165
+        }
166
+        if (isset($layout['h'])) {
167
+            $this->height = (float) $layout['h'];
168
+        }
169
+    }
170
+
171
+    /**
172
+     * Get Layout Target
173
+     *
174
+     * @return string
175
+     */
176
+    public function getLayoutTarget()
177
+    {
178
+        return $this->layoutTarget;
179
+    }
180
+
181
+    /**
182
+     * Set Layout Target
183
+     *
184
+     * @param Layout Target $value
185
+     * @return PHPExcel_Chart_Layout
186
+     */
187
+    public function setLayoutTarget($value)
188
+    {
189
+        $this->layoutTarget = $value;
190
+        return $this;
191
+    }
192
+
193
+    /**
194
+     * Get X-Mode
195
+     *
196
+     * @return string
197
+     */
198
+    public function getXMode()
199
+    {
200
+        return $this->xMode;
201
+    }
202
+
203
+    /**
204
+     * Set X-Mode
205
+     *
206
+     * @param X-Mode $value
207
+     * @return PHPExcel_Chart_Layout
208
+     */
209
+    public function setXMode($value)
210
+    {
211
+        $this->xMode = $value;
212
+        return $this;
213
+    }
214
+
215
+    /**
216
+     * Get Y-Mode
217
+     *
218
+     * @return string
219
+     */
220
+    public function getYMode()
221
+    {
222
+        return $this->yMode;
223
+    }
224
+
225
+    /**
226
+     * Set Y-Mode
227
+     *
228
+     * @param Y-Mode $value
229
+     * @return PHPExcel_Chart_Layout
230
+     */
231
+    public function setYMode($value)
232
+    {
233
+        $this->yMode = $value;
234
+        return $this;
235
+    }
236
+
237
+    /**
238
+     * Get X-Position
239
+     *
240
+     * @return number
241
+     */
242
+    public function getXPosition()
243
+    {
244
+        return $this->xPos;
245
+    }
246
+
247
+    /**
248
+     * Set X-Position
249
+     *
250
+     * @param X-Position $value
251
+     * @return PHPExcel_Chart_Layout
252
+     */
253
+    public function setXPosition($value)
254
+    {
255
+        $this->xPos = $value;
256
+        return $this;
257
+    }
258
+
259
+    /**
260
+     * Get Y-Position
261
+     *
262
+     * @return number
263
+     */
264
+    public function getYPosition()
265
+    {
266
+        return $this->yPos;
267
+    }
268
+
269
+    /**
270
+     * Set Y-Position
271
+     *
272
+     * @param Y-Position $value
273
+     * @return PHPExcel_Chart_Layout
274
+     */
275
+    public function setYPosition($value)
276
+    {
277
+        $this->yPos = $value;
278
+        return $this;
279
+    }
280
+
281
+    /**
282
+     * Get Width
283
+     *
284
+     * @return number
285
+     */
286
+    public function getWidth()
287
+    {
288
+        return $this->width;
289
+    }
290
+
291
+    /**
292
+     * Set Width
293
+     *
294
+     * @param Width $value
295
+     * @return PHPExcel_Chart_Layout
296
+     */
297
+    public function setWidth($value)
298
+    {
299
+        $this->width = $value;
300
+        return $this;
301
+    }
302
+
303
+    /**
304
+     * Get Height
305
+     *
306
+     * @return number
307
+     */
308
+    public function getHeight()
309
+    {
310
+        return $this->height;
311
+    }
312
+
313
+    /**
314
+     * Set Height
315
+     *
316
+     * @param Height $value
317
+     * @return PHPExcel_Chart_Layout
318
+     */
319
+    public function setHeight($value)
320
+    {
321
+        $this->height = $value;
322
+        return $this;
323
+    }
324
+
325
+
326
+    /**
327
+     * Get show legend key
328
+     *
329
+     * @return boolean
330
+     */
331
+    public function getShowLegendKey()
332
+    {
333
+        return $this->showLegendKey;
334
+    }
335
+
336
+    /**
337
+     * Set show legend key
338
+     * Specifies that legend keys should be shown in data labels.
339
+     *
340
+     * @param boolean $value        Show legend key
341
+     * @return PHPExcel_Chart_Layout
342
+     */
343
+    public function setShowLegendKey($value)
344
+    {
345
+        $this->showLegendKey = $value;
346
+        return $this;
347
+    }
348
+
349
+    /**
350
+     * Get show value
351
+     *
352
+     * @return boolean
353
+     */
354
+    public function getShowVal()
355
+    {
356
+        return $this->showVal;
357
+    }
358
+
359
+    /**
360
+     * Set show val
361
+     * Specifies that the value should be shown in data labels.
362
+     *
363
+     * @param boolean $value        Show val
364
+     * @return PHPExcel_Chart_Layout
365
+     */
366
+    public function setShowVal($value)
367
+    {
368
+        $this->showVal = $value;
369
+        return $this;
370
+    }
371
+
372
+    /**
373
+     * Get show category name
374
+     *
375
+     * @return boolean
376
+     */
377
+    public function getShowCatName()
378
+    {
379
+        return $this->showCatName;
380
+    }
381
+
382
+    /**
383
+     * Set show cat name
384
+     * Specifies that the category name should be shown in data labels.
385
+     *
386
+     * @param boolean $value        Show cat name
387
+     * @return PHPExcel_Chart_Layout
388
+     */
389
+    public function setShowCatName($value)
390
+    {
391
+        $this->showCatName = $value;
392
+        return $this;
393
+    }
394
+
395
+    /**
396
+     * Get show data series name
397
+     *
398
+     * @return boolean
399
+     */
400
+    public function getShowSerName()
401
+    {
402
+        return $this->showSerName;
403
+    }
404
+
405
+    /**
406
+     * Set show ser name
407
+     * Specifies that the series name should be shown in data labels.
408
+     *
409
+     * @param boolean $value        Show series name
410
+     * @return PHPExcel_Chart_Layout
411
+     */
412
+    public function setShowSerName($value)
413
+    {
414
+        $this->showSerName = $value;
415
+        return $this;
416
+    }
417
+
418
+    /**
419
+     * Get show percentage
420
+     *
421
+     * @return boolean
422
+     */
423
+    public function getShowPercent()
424
+    {
425
+        return $this->showPercent;
426
+    }
427
+
428
+    /**
429
+     * Set show percentage
430
+     * Specifies that the percentage should be shown in data labels.
431
+     *
432
+     * @param boolean $value        Show percentage
433
+     * @return PHPExcel_Chart_Layout
434
+     */
435
+    public function setShowPercent($value)
436
+    {
437
+        $this->showPercent = $value;
438
+        return $this;
439
+    }
440
+
441
+    /**
442
+     * Get show bubble size
443
+     *
444
+     * @return boolean
445
+     */
446
+    public function getShowBubbleSize()
447
+    {
448
+        return $this->showBubbleSize;
449
+    }
450
+
451
+    /**
452
+     * Set show bubble size
453
+     * Specifies that the bubble size should be shown in data labels.
454
+     *
455
+     * @param boolean $value        Show bubble size
456
+     * @return PHPExcel_Chart_Layout
457
+     */
458
+    public function setShowBubbleSize($value)
459
+    {
460
+        $this->showBubbleSize = $value;
461
+        return $this;
462
+    }
463
+
464
+    /**
465
+     * Get show leader lines
466
+     *
467
+     * @return boolean
468
+     */
469
+    public function getShowLeaderLines()
470
+    {
471
+        return $this->showLeaderLines;
472
+    }
473
+
474
+    /**
475
+     * Set show leader lines
476
+     * Specifies that leader lines should be shown in data labels.
477
+     *
478
+     * @param boolean $value        Show leader lines
479
+     * @return PHPExcel_Chart_Layout
480
+     */
481
+    public function setShowLeaderLines($value)
482
+    {
483
+        $this->showLeaderLines = $value;
484
+        return $this;
485
+    }
486
+}

+ 170
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/Chart/Legend.php View File

@@ -0,0 +1,170 @@
1
+<?php
2
+
3
+/**
4
+ * PHPExcel_Chart_Legend
5
+ *
6
+ * Copyright (c) 2006 - 2015 PHPExcel
7
+ *
8
+ * This library is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU Lesser General Public
10
+ * License as published by the Free Software Foundation; either
11
+ * version 2.1 of the License, or (at your option) any later version.
12
+ *
13
+ * This library is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
+ * Lesser General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU Lesser General Public
19
+ * License along with this library; if not, write to the Free Software
20
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21
+ *
22
+ * @category    PHPExcel
23
+ * @package        PHPExcel_Chart
24
+ * @copyright    Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
25
+ * @license        http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
26
+ * @version        ##VERSION##, ##DATE##
27
+ */
28
+class PHPExcel_Chart_Legend
29
+{
30
+    /** Legend positions */
31
+    const xlLegendPositionBottom = -4107;    //    Below the chart.
32
+    const xlLegendPositionCorner = 2;        //    In the upper right-hand corner of the chart border.
33
+    const xlLegendPositionCustom = -4161;    //    A custom position.
34
+    const xlLegendPositionLeft   = -4131;    //    Left of the chart.
35
+    const xlLegendPositionRight  = -4152;    //    Right of the chart.
36
+    const xlLegendPositionTop    = -4160;    //    Above the chart.
37
+
38
+    const POSITION_RIGHT    = 'r';
39
+    const POSITION_LEFT     = 'l';
40
+    const POSITION_BOTTOM   = 'b';
41
+    const POSITION_TOP      = 't';
42
+    const POSITION_TOPRIGHT = 'tr';
43
+
44
+    private static $positionXLref = array(
45
+        self::xlLegendPositionBottom => self::POSITION_BOTTOM,
46
+        self::xlLegendPositionCorner => self::POSITION_TOPRIGHT,
47
+        self::xlLegendPositionCustom => '??',
48
+        self::xlLegendPositionLeft   => self::POSITION_LEFT,
49
+        self::xlLegendPositionRight  => self::POSITION_RIGHT,
50
+        self::xlLegendPositionTop    => self::POSITION_TOP
51
+    );
52
+
53
+    /**
54
+     * Legend position
55
+     *
56
+     * @var    string
57
+     */
58
+    private $position = self::POSITION_RIGHT;
59
+
60
+    /**
61
+     * Allow overlay of other elements?
62
+     *
63
+     * @var    boolean
64
+     */
65
+    private $overlay = true;
66
+
67
+    /**
68
+     * Legend Layout
69
+     *
70
+     * @var    PHPExcel_Chart_Layout
71
+     */
72
+    private $layout = null;
73
+
74
+
75
+    /**
76
+     *    Create a new PHPExcel_Chart_Legend
77
+     */
78
+    public function __construct($position = self::POSITION_RIGHT, PHPExcel_Chart_Layout $layout = null, $overlay = false)
79
+    {
80
+        $this->setPosition($position);
81
+        $this->layout = $layout;
82
+        $this->setOverlay($overlay);
83
+    }
84
+
85
+    /**
86
+     * Get legend position as an excel string value
87
+     *
88
+     * @return    string
89
+     */
90
+    public function getPosition()
91
+    {
92
+        return $this->position;
93
+    }
94
+
95
+    /**
96
+     * Get legend position using an excel string value
97
+     *
98
+     * @param    string    $position
99
+     */
100
+    public function setPosition($position = self::POSITION_RIGHT)
101
+    {
102
+        if (!in_array($position, self::$positionXLref)) {
103
+            return false;
104
+        }
105
+
106
+        $this->position = $position;
107
+        return true;
108
+    }
109
+
110
+    /**
111
+     * Get legend position as an Excel internal numeric value
112
+     *
113
+     * @return    number
114
+     */
115
+    public function getPositionXL()
116
+    {
117
+        return array_search($this->position, self::$positionXLref);
118
+    }
119
+
120
+    /**
121
+     * Set legend position using an Excel internal numeric value
122
+     *
123
+     * @param    number    $positionXL
124
+     */
125
+    public function setPositionXL($positionXL = self::xlLegendPositionRight)
126
+    {
127
+        if (!array_key_exists($positionXL, self::$positionXLref)) {
128
+            return false;
129
+        }
130
+
131
+        $this->position = self::$positionXLref[$positionXL];
132
+        return true;
133
+    }
134
+
135
+    /**
136
+     * Get allow overlay of other elements?
137
+     *
138
+     * @return    boolean
139
+     */
140
+    public function getOverlay()
141
+    {
142
+        return $this->overlay;
143
+    }
144
+
145
+    /**
146
+     * Set allow overlay of other elements?
147
+     *
148
+     * @param    boolean    $overlay
149
+     * @return    boolean
150
+     */
151
+    public function setOverlay($overlay = false)
152
+    {
153
+        if (!is_bool($overlay)) {
154
+            return false;
155
+        }
156
+
157
+        $this->overlay = $overlay;
158
+        return true;
159
+    }
160
+
161
+    /**
162
+     * Get Layout
163
+     *
164
+     * @return PHPExcel_Chart_Layout
165
+     */
166
+    public function getLayout()
167
+    {
168
+        return $this->layout;
169
+    }
170
+}

+ 126
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/Chart/PlotArea.php View File

@@ -0,0 +1,126 @@
1
+<?php
2
+
3
+/**
4
+ * PHPExcel_Chart_PlotArea
5
+ *
6
+ * Copyright (c) 2006 - 2015 PHPExcel
7
+ *
8
+ * This library is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU Lesser General Public
10
+ * License as published by the Free Software Foundation; either
11
+ * version 2.1 of the License, or (at your option) any later version.
12
+ *
13
+ * This library is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
+ * Lesser General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU Lesser General Public
19
+ * License along with this library; if not, write to the Free Software
20
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21
+ *
22
+ * @category    PHPExcel
23
+ * @package        PHPExcel_Chart
24
+ * @copyright    Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
25
+ * @license        http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
26
+ * @version        ##VERSION##, ##DATE##
27
+ */
28
+class PHPExcel_Chart_PlotArea
29
+{
30
+    /**
31
+     * PlotArea Layout
32
+     *
33
+     * @var PHPExcel_Chart_Layout
34
+     */
35
+    private $layout = null;
36
+
37
+    /**
38
+     * Plot Series
39
+     *
40
+     * @var array of PHPExcel_Chart_DataSeries
41
+     */
42
+    private $plotSeries = array();
43
+
44
+    /**
45
+     * Create a new PHPExcel_Chart_PlotArea
46
+     */
47
+    public function __construct(PHPExcel_Chart_Layout $layout = null, $plotSeries = array())
48
+    {
49
+        $this->layout = $layout;
50
+        $this->plotSeries = $plotSeries;
51
+    }
52
+
53
+    /**
54
+     * Get Layout
55
+     *
56
+     * @return PHPExcel_Chart_Layout
57
+     */
58
+    public function getLayout()
59
+    {
60
+        return $this->layout;
61
+    }
62
+
63
+    /**
64
+     * Get Number of Plot Groups
65
+     *
66
+     * @return array of PHPExcel_Chart_DataSeries
67
+     */
68
+    public function getPlotGroupCount()
69
+    {
70
+        return count($this->plotSeries);
71
+    }
72
+
73
+    /**
74
+     * Get Number of Plot Series
75
+     *
76
+     * @return integer
77
+     */
78
+    public function getPlotSeriesCount()
79
+    {
80
+        $seriesCount = 0;
81
+        foreach ($this->plotSeries as $plot) {
82
+            $seriesCount += $plot->getPlotSeriesCount();
83
+        }
84
+        return $seriesCount;
85
+    }
86
+
87
+    /**
88
+     * Get Plot Series
89
+     *
90
+     * @return array of PHPExcel_Chart_DataSeries
91
+     */
92
+    public function getPlotGroup()
93
+    {
94
+        return $this->plotSeries;
95
+    }
96
+
97
+    /**
98
+     * Get Plot Series by Index
99
+     *
100
+     * @return PHPExcel_Chart_DataSeries
101
+     */
102
+    public function getPlotGroupByIndex($index)
103
+    {
104
+        return $this->plotSeries[$index];
105
+    }
106
+
107
+    /**
108
+     * Set Plot Series
109
+     *
110
+     * @param [PHPExcel_Chart_DataSeries]
111
+     * @return PHPExcel_Chart_PlotArea
112
+     */
113
+    public function setPlotSeries($plotSeries = array())
114
+    {
115
+        $this->plotSeries = $plotSeries;
116
+        
117
+        return $this;
118
+    }
119
+
120
+    public function refresh(PHPExcel_Worksheet $worksheet)
121
+    {
122
+        foreach ($this->plotSeries as $plotSeries) {
123
+            $plotSeries->refresh($worksheet);
124
+        }
125
+    }
126
+}

+ 363
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/Chart/Properties.php View File

@@ -0,0 +1,363 @@
1
+<?php
2
+/**
3
+ * Created by PhpStorm.
4
+ * User: nhw2h8s
5
+ * Date: 7/2/14
6
+ * Time: 5:45 PM
7
+ */
8
+
9
+abstract class PHPExcel_Chart_Properties
10
+{
11
+    const
12
+        EXCEL_COLOR_TYPE_STANDARD = 'prstClr',
13
+        EXCEL_COLOR_TYPE_SCHEME = 'schemeClr',
14
+        EXCEL_COLOR_TYPE_ARGB = 'srgbClr';
15
+
16
+    const
17
+        AXIS_LABELS_LOW = 'low',
18
+        AXIS_LABELS_HIGH = 'high',
19
+        AXIS_LABELS_NEXT_TO = 'nextTo',
20
+        AXIS_LABELS_NONE = 'none';
21
+
22
+    const
23
+        TICK_MARK_NONE = 'none',
24
+        TICK_MARK_INSIDE = 'in',
25
+        TICK_MARK_OUTSIDE = 'out',
26
+        TICK_MARK_CROSS = 'cross';
27
+
28
+    const
29
+        HORIZONTAL_CROSSES_AUTOZERO = 'autoZero',
30
+        HORIZONTAL_CROSSES_MAXIMUM = 'max';
31
+
32
+    const
33
+        FORMAT_CODE_GENERAL = 'General',
34
+        FORMAT_CODE_NUMBER = '#,##0.00',
35
+        FORMAT_CODE_CURRENCY = '$#,##0.00',
36
+        FORMAT_CODE_ACCOUNTING = '_($* #,##0.00_);_($* (#,##0.00);_($* "-"??_);_(@_)',
37
+        FORMAT_CODE_DATE = 'm/d/yyyy',
38
+        FORMAT_CODE_TIME = '[$-F400]h:mm:ss AM/PM',
39
+        FORMAT_CODE_PERCENTAGE = '0.00%',
40
+        FORMAT_CODE_FRACTION = '# ?/?',
41
+        FORMAT_CODE_SCIENTIFIC = '0.00E+00',
42
+        FORMAT_CODE_TEXT = '@',
43
+        FORMAT_CODE_SPECIAL = '00000';
44
+
45
+    const
46
+        ORIENTATION_NORMAL = 'minMax',
47
+        ORIENTATION_REVERSED = 'maxMin';
48
+
49
+    const
50
+        LINE_STYLE_COMPOUND_SIMPLE = 'sng',
51
+        LINE_STYLE_COMPOUND_DOUBLE = 'dbl',
52
+        LINE_STYLE_COMPOUND_THICKTHIN = 'thickThin',
53
+        LINE_STYLE_COMPOUND_THINTHICK = 'thinThick',
54
+        LINE_STYLE_COMPOUND_TRIPLE = 'tri',
55
+
56
+        LINE_STYLE_DASH_SOLID = 'solid',
57
+        LINE_STYLE_DASH_ROUND_DOT = 'sysDot',
58
+        LINE_STYLE_DASH_SQUERE_DOT = 'sysDash',
59
+        LINE_STYPE_DASH_DASH = 'dash',
60
+        LINE_STYLE_DASH_DASH_DOT = 'dashDot',
61
+        LINE_STYLE_DASH_LONG_DASH = 'lgDash',
62
+        LINE_STYLE_DASH_LONG_DASH_DOT = 'lgDashDot',
63
+        LINE_STYLE_DASH_LONG_DASH_DOT_DOT = 'lgDashDotDot',
64
+
65
+        LINE_STYLE_CAP_SQUARE = 'sq',
66
+        LINE_STYLE_CAP_ROUND = 'rnd',
67
+        LINE_STYLE_CAP_FLAT = 'flat',
68
+
69
+        LINE_STYLE_JOIN_ROUND = 'bevel',
70
+        LINE_STYLE_JOIN_MITER = 'miter',
71
+        LINE_STYLE_JOIN_BEVEL = 'bevel',
72
+
73
+        LINE_STYLE_ARROW_TYPE_NOARROW = null,
74
+        LINE_STYLE_ARROW_TYPE_ARROW = 'triangle',
75
+        LINE_STYLE_ARROW_TYPE_OPEN = 'arrow',
76
+        LINE_STYLE_ARROW_TYPE_STEALTH = 'stealth',
77
+        LINE_STYLE_ARROW_TYPE_DIAMOND = 'diamond',
78
+        LINE_STYLE_ARROW_TYPE_OVAL = 'oval',
79
+
80
+        LINE_STYLE_ARROW_SIZE_1 = 1,
81
+        LINE_STYLE_ARROW_SIZE_2 = 2,
82
+        LINE_STYLE_ARROW_SIZE_3 = 3,
83
+        LINE_STYLE_ARROW_SIZE_4 = 4,
84
+        LINE_STYLE_ARROW_SIZE_5 = 5,
85
+        LINE_STYLE_ARROW_SIZE_6 = 6,
86
+        LINE_STYLE_ARROW_SIZE_7 = 7,
87
+        LINE_STYLE_ARROW_SIZE_8 = 8,
88
+        LINE_STYLE_ARROW_SIZE_9 = 9;
89
+
90
+    const
91
+        SHADOW_PRESETS_NOSHADOW = null,
92
+        SHADOW_PRESETS_OUTER_BOTTTOM_RIGHT = 1,
93
+        SHADOW_PRESETS_OUTER_BOTTOM = 2,
94
+        SHADOW_PRESETS_OUTER_BOTTOM_LEFT = 3,
95
+        SHADOW_PRESETS_OUTER_RIGHT = 4,
96
+        SHADOW_PRESETS_OUTER_CENTER = 5,
97
+        SHADOW_PRESETS_OUTER_LEFT = 6,
98
+        SHADOW_PRESETS_OUTER_TOP_RIGHT = 7,
99
+        SHADOW_PRESETS_OUTER_TOP = 8,
100
+        SHADOW_PRESETS_OUTER_TOP_LEFT = 9,
101
+        SHADOW_PRESETS_INNER_BOTTTOM_RIGHT = 10,
102
+        SHADOW_PRESETS_INNER_BOTTOM = 11,
103
+        SHADOW_PRESETS_INNER_BOTTOM_LEFT = 12,
104
+        SHADOW_PRESETS_INNER_RIGHT = 13,
105
+        SHADOW_PRESETS_INNER_CENTER = 14,
106
+        SHADOW_PRESETS_INNER_LEFT = 15,
107
+        SHADOW_PRESETS_INNER_TOP_RIGHT = 16,
108
+        SHADOW_PRESETS_INNER_TOP = 17,
109
+        SHADOW_PRESETS_INNER_TOP_LEFT = 18,
110
+        SHADOW_PRESETS_PERSPECTIVE_BELOW = 19,
111
+        SHADOW_PRESETS_PERSPECTIVE_UPPER_RIGHT = 20,
112
+        SHADOW_PRESETS_PERSPECTIVE_UPPER_LEFT = 21,
113
+        SHADOW_PRESETS_PERSPECTIVE_LOWER_RIGHT = 22,
114
+        SHADOW_PRESETS_PERSPECTIVE_LOWER_LEFT = 23;
115
+
116
+    protected function getExcelPointsWidth($width)
117
+    {
118
+        return $width * 12700;
119
+    }
120
+
121
+    protected function getExcelPointsAngle($angle)
122
+    {
123
+        return $angle * 60000;
124
+    }
125
+
126
+    protected function getTrueAlpha($alpha)
127
+    {
128
+        return (string) 100 - $alpha . '000';
129
+    }
130
+
131
+    protected function setColorProperties($color, $alpha, $type)
132
+    {
133
+        return array(
134
+            'type' => (string) $type,
135
+            'value' => (string) $color,
136
+            'alpha' => (string) $this->getTrueAlpha($alpha)
137
+        );
138
+    }
139
+
140
+    protected function getLineStyleArrowSize($array_selector, $array_kay_selector)
141
+    {
142
+        $sizes = array(
143
+            1 => array('w' => 'sm', 'len' => 'sm'),
144
+            2 => array('w' => 'sm', 'len' => 'med'),
145
+            3 => array('w' => 'sm', 'len' => 'lg'),
146
+            4 => array('w' => 'med', 'len' => 'sm'),
147
+            5 => array('w' => 'med', 'len' => 'med'),
148
+            6 => array('w' => 'med', 'len' => 'lg'),
149
+            7 => array('w' => 'lg', 'len' => 'sm'),
150
+            8 => array('w' => 'lg', 'len' => 'med'),
151
+            9 => array('w' => 'lg', 'len' => 'lg')
152
+        );
153
+
154
+        return $sizes[$array_selector][$array_kay_selector];
155
+    }
156
+
157
+    protected function getShadowPresetsMap($shadow_presets_option)
158
+    {
159
+        $presets_options = array(
160
+            //OUTER
161
+            1 => array(
162
+                'effect' => 'outerShdw',
163
+                'blur' => '50800',
164
+                'distance' => '38100',
165
+                'direction' => '2700000',
166
+                'algn' => 'tl',
167
+                'rotWithShape' => '0'
168
+            ),
169
+            2 => array(
170
+                'effect' => 'outerShdw',
171
+                'blur' => '50800',
172
+                'distance' => '38100',
173
+                'direction' => '5400000',
174
+                'algn' => 't',
175
+                'rotWithShape' => '0'
176
+            ),
177
+            3 => array(
178
+                'effect' => 'outerShdw',
179
+                'blur' => '50800',
180
+                'distance' => '38100',
181
+                'direction' => '8100000',
182
+                'algn' => 'tr',
183
+                'rotWithShape' => '0'
184
+            ),
185
+            4 => array(
186
+                'effect' => 'outerShdw',
187
+                'blur' => '50800',
188
+                'distance' => '38100',
189
+                'algn' => 'l',
190
+                'rotWithShape' => '0'
191
+            ),
192
+            5 => array(
193
+                'effect' => 'outerShdw',
194
+                'size' => array(
195
+                    'sx' => '102000',
196
+                    'sy' => '102000'
197
+                )
198
+                ,
199
+                'blur' => '63500',
200
+                'distance' => '38100',
201
+                'algn' => 'ctr',
202
+                'rotWithShape' => '0'
203
+            ),
204
+            6 => array(
205
+                'effect' => 'outerShdw',
206
+                'blur' => '50800',
207
+                'distance' => '38100',
208
+                'direction' => '10800000',
209
+                'algn' => 'r',
210
+                'rotWithShape' => '0'
211
+            ),
212
+            7 => array(
213
+                'effect' => 'outerShdw',
214
+                'blur' => '50800',
215
+                'distance' => '38100',
216
+                'direction' => '18900000',
217
+                'algn' => 'bl',
218
+                'rotWithShape' => '0'
219
+            ),
220
+            8 => array(
221
+                'effect' => 'outerShdw',
222
+                'blur' => '50800',
223
+                'distance' => '38100',
224
+                'direction' => '16200000',
225
+                'rotWithShape' => '0'
226
+            ),
227
+            9 => array(
228
+                'effect' => 'outerShdw',
229
+                'blur' => '50800',
230
+                'distance' => '38100',
231
+                'direction' => '13500000',
232
+                'algn' => 'br',
233
+                'rotWithShape' => '0'
234
+            ),
235
+            //INNER
236
+            10 => array(
237
+                'effect' => 'innerShdw',
238
+                'blur' => '63500',
239
+                'distance' => '50800',
240
+                'direction' => '2700000',
241
+            ),
242
+            11 => array(
243
+                'effect' => 'innerShdw',
244
+                'blur' => '63500',
245
+                'distance' => '50800',
246
+                'direction' => '5400000',
247
+            ),
248
+            12 => array(
249
+                'effect' => 'innerShdw',
250
+                'blur' => '63500',
251
+                'distance' => '50800',
252
+                'direction' => '8100000',
253
+            ),
254
+            13 => array(
255
+                'effect' => 'innerShdw',
256
+                'blur' => '63500',
257
+                'distance' => '50800',
258
+            ),
259
+            14 => array(
260
+                'effect' => 'innerShdw',
261
+                'blur' => '114300',
262
+            ),
263
+            15 => array(
264
+                'effect' => 'innerShdw',
265
+                'blur' => '63500',
266
+                'distance' => '50800',
267
+                'direction' => '10800000',
268
+            ),
269
+            16 => array(
270
+                'effect' => 'innerShdw',
271
+                'blur' => '63500',
272
+                'distance' => '50800',
273
+                'direction' => '18900000',
274
+            ),
275
+            17 => array(
276
+                'effect' => 'innerShdw',
277
+                'blur' => '63500',
278
+                'distance' => '50800',
279
+                'direction' => '16200000',
280
+            ),
281
+            18 => array(
282
+                'effect' => 'innerShdw',
283
+                'blur' => '63500',
284
+                'distance' => '50800',
285
+                'direction' => '13500000',
286
+            ),
287
+            //perspective
288
+            19 => array(
289
+                'effect' => 'outerShdw',
290
+                'blur' => '152400',
291
+                'distance' => '317500',
292
+                'size' => array(
293
+                    'sx' => '90000',
294
+                    'sy' => '-19000',
295
+                ),
296
+                'direction' => '5400000',
297
+                'rotWithShape' => '0',
298
+            ),
299
+            20 => array(
300
+                'effect' => 'outerShdw',
301
+                'blur' => '76200',
302
+                'direction' => '18900000',
303
+                'size' => array(
304
+                    'sy' => '23000',
305
+                    'kx' => '-1200000',
306
+                ),
307
+                'algn' => 'bl',
308
+                'rotWithShape' => '0',
309
+            ),
310
+            21 => array(
311
+                'effect' => 'outerShdw',
312
+                'blur' => '76200',
313
+                'direction' => '13500000',
314
+                'size' => array(
315
+                    'sy' => '23000',
316
+                    'kx' => '1200000',
317
+                ),
318
+                'algn' => 'br',
319
+                'rotWithShape' => '0',
320
+            ),
321
+            22 => array(
322
+                'effect' => 'outerShdw',
323
+                'blur' => '76200',
324
+                'distance' => '12700',
325
+                'direction' => '2700000',
326
+                'size' => array(
327
+                    'sy' => '-23000',
328
+                    'kx' => '-800400',
329
+                ),
330
+                'algn' => 'bl',
331
+                'rotWithShape' => '0',
332
+            ),
333
+            23 => array(
334
+                'effect' => 'outerShdw',
335
+                'blur' => '76200',
336
+                'distance' => '12700',
337
+                'direction' => '8100000',
338
+                'size' => array(
339
+                    'sy' => '-23000',
340
+                    'kx' => '800400',
341
+                ),
342
+                'algn' => 'br',
343
+                'rotWithShape' => '0',
344
+            ),
345
+        );
346
+
347
+        return $presets_options[$shadow_presets_option];
348
+    }
349
+
350
+    protected function getArrayElementsValue($properties, $elements)
351
+    {
352
+        $reference = & $properties;
353
+        if (!is_array($elements)) {
354
+            return $reference[$elements];
355
+        } else {
356
+            foreach ($elements as $keys) {
357
+                $reference = & $reference[$keys];
358
+            }
359
+            return $reference;
360
+        }
361
+        return $this;
362
+    }
363
+}

+ 20
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/Chart/Renderer/PHP Charting Libraries.txt View File

@@ -0,0 +1,20 @@
1
+ChartDirector
2
+	http://www.advsofteng.com/cdphp.html
3
+
4
+GraPHPite
5
+	http://graphpite.sourceforge.net/
6
+
7
+JpGraph
8
+	http://www.aditus.nu/jpgraph/
9
+
10
+LibChart
11
+	http://naku.dohcrew.com/libchart/pages/introduction/
12
+
13
+pChart
14
+	http://pchart.sourceforge.net/
15
+
16
+TeeChart
17
+	http://www.steema.com/products/teechart/overview.html
18
+
19
+PHPGraphLib
20
+    http://www.ebrueggeman.com/phpgraphlib

+ 883
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/Chart/Renderer/jpgraph.php View File

@@ -0,0 +1,883 @@
1
+<?php
2
+
3
+require_once(PHPExcel_Settings::getChartRendererPath().'/jpgraph.php');
4
+
5
+/**
6
+ * PHPExcel_Chart_Renderer_jpgraph
7
+ *
8
+ * Copyright (c) 2006 - 2015 PHPExcel
9
+ *
10
+ * This library is free software; you can redistribute it and/or
11
+ * modify it under the terms of the GNU Lesser General Public
12
+ * License as published by the Free Software Foundation; either
13
+ * version 2.1 of the License, or (at your option) any later version.
14
+ *
15
+ * This library is distributed in the hope that it will be useful,
16
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18
+ * Lesser General Public License for more details.
19
+ *
20
+ * You should have received a copy of the GNU Lesser General Public
21
+ * License along with this library; if not, write to the Free Software
22
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
23
+ *
24
+ * @category    PHPExcel
25
+ * @package        PHPExcel_Chart_Renderer
26
+ * @copyright    Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
27
+ * @license        http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
28
+ * @version        ##VERSION##, ##DATE##
29
+ */
30
+class PHPExcel_Chart_Renderer_jpgraph
31
+{
32
+    private static $width    = 640;
33
+
34
+    private static $height    = 480;
35
+
36
+    private static $colourSet = array(
37
+        'mediumpurple1',    'palegreen3',     'gold1',          'cadetblue1',
38
+        'darkmagenta',      'coral',          'dodgerblue3',    'eggplant',
39
+        'mediumblue',       'magenta',        'sandybrown',     'cyan',
40
+        'firebrick1',       'forestgreen',    'deeppink4',      'darkolivegreen',
41
+        'goldenrod2'
42
+    );
43
+
44
+    private static $markSet = array(
45
+        'diamond'  => MARK_DIAMOND,
46
+        'square'   => MARK_SQUARE,
47
+        'triangle' => MARK_UTRIANGLE,
48
+        'x'        => MARK_X,
49
+        'star'     => MARK_STAR,
50
+        'dot'      => MARK_FILLEDCIRCLE,
51
+        'dash'     => MARK_DTRIANGLE,
52
+        'circle'   => MARK_CIRCLE,
53
+        'plus'     => MARK_CROSS
54
+    );
55
+
56
+
57
+    private $chart;
58
+
59
+    private $graph;
60
+
61
+    private static $plotColour = 0;
62
+
63
+    private static $plotMark = 0;
64
+
65
+
66
+    private function formatPointMarker($seriesPlot, $markerID)
67
+    {
68
+        $plotMarkKeys = array_keys(self::$markSet);
69
+        if (is_null($markerID)) {
70
+            //    Use default plot marker (next marker in the series)
71
+            self::$plotMark %= count(self::$markSet);
72
+            $seriesPlot->mark->SetType(self::$markSet[$plotMarkKeys[self::$plotMark++]]);
73
+        } elseif ($markerID !== 'none') {
74
+            //    Use specified plot marker (if it exists)
75
+            if (isset(self::$markSet[$markerID])) {
76
+                $seriesPlot->mark->SetType(self::$markSet[$markerID]);
77
+            } else {
78
+                //    If the specified plot marker doesn't exist, use default plot marker (next marker in the series)
79
+                self::$plotMark %= count(self::$markSet);
80
+                $seriesPlot->mark->SetType(self::$markSet[$plotMarkKeys[self::$plotMark++]]);
81
+            }
82
+        } else {
83
+            //    Hide plot marker
84
+            $seriesPlot->mark->Hide();
85
+        }
86
+        $seriesPlot->mark->SetColor(self::$colourSet[self::$plotColour]);
87
+        $seriesPlot->mark->SetFillColor(self::$colourSet[self::$plotColour]);
88
+        $seriesPlot->SetColor(self::$colourSet[self::$plotColour++]);
89
+
90
+        return $seriesPlot;
91
+    }
92
+
93
+
94
+    private function formatDataSetLabels($groupID, $datasetLabels, $labelCount, $rotation = '')
95
+    {
96
+        $datasetLabelFormatCode = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex(0)->getFormatCode();
97
+        if (!is_null($datasetLabelFormatCode)) {
98
+            //    Retrieve any label formatting code
99
+            $datasetLabelFormatCode = stripslashes($datasetLabelFormatCode);
100
+        }
101
+
102
+        $testCurrentIndex = 0;
103
+        foreach ($datasetLabels as $i => $datasetLabel) {
104
+            if (is_array($datasetLabel)) {
105
+                if ($rotation == 'bar') {
106
+                    $datasetLabels[$i] = implode(" ", $datasetLabel);
107
+                } else {
108
+                    $datasetLabel = array_reverse($datasetLabel);
109
+                    $datasetLabels[$i] = implode("\n", $datasetLabel);
110
+                }
111
+            } else {
112
+                //    Format labels according to any formatting code
113
+                if (!is_null($datasetLabelFormatCode)) {
114
+                    $datasetLabels[$i] = PHPExcel_Style_NumberFormat::toFormattedString($datasetLabel, $datasetLabelFormatCode);
115
+                }
116
+            }
117
+            ++$testCurrentIndex;
118
+        }
119
+
120
+        return $datasetLabels;
121
+    }
122
+
123
+
124
+    private function percentageSumCalculation($groupID, $seriesCount)
125
+    {
126
+        //    Adjust our values to a percentage value across all series in the group
127
+        for ($i = 0; $i < $seriesCount; ++$i) {
128
+            if ($i == 0) {
129
+                $sumValues = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues();
130
+            } else {
131
+                $nextValues = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues();
132
+                foreach ($nextValues as $k => $value) {
133
+                    if (isset($sumValues[$k])) {
134
+                        $sumValues[$k] += $value;
135
+                    } else {
136
+                        $sumValues[$k] = $value;
137
+                    }
138
+                }
139
+            }
140
+        }
141
+
142
+        return $sumValues;
143
+    }
144
+
145
+
146
+    private function percentageAdjustValues($dataValues, $sumValues)
147
+    {
148
+        foreach ($dataValues as $k => $dataValue) {
149
+            $dataValues[$k] = $dataValue / $sumValues[$k] * 100;
150
+        }
151
+
152
+        return $dataValues;
153
+    }
154
+
155
+
156
+    private function getCaption($captionElement)
157
+    {
158
+        //    Read any caption
159
+        $caption = (!is_null($captionElement)) ? $captionElement->getCaption() : null;
160
+        //    Test if we have a title caption to display
161
+        if (!is_null($caption)) {
162
+            //    If we do, it could be a plain string or an array
163
+            if (is_array($caption)) {
164
+                //    Implode an array to a plain string
165
+                $caption = implode('', $caption);
166
+            }
167
+        }
168
+        return $caption;
169
+    }
170
+
171
+
172
+    private function renderTitle()
173
+    {
174
+        $title = $this->getCaption($this->chart->getTitle());
175
+        if (!is_null($title)) {
176
+            $this->graph->title->Set($title);
177
+        }
178
+    }
179
+
180
+
181
+    private function renderLegend()
182
+    {
183
+        $legend = $this->chart->getLegend();
184
+        if (!is_null($legend)) {
185
+            $legendPosition = $legend->getPosition();
186
+            $legendOverlay = $legend->getOverlay();
187
+            switch ($legendPosition) {
188
+                case 'r':
189
+                    $this->graph->legend->SetPos(0.01, 0.5, 'right', 'center');    //    right
190
+                    $this->graph->legend->SetColumns(1);
191
+                    break;
192
+                case 'l':
193
+                    $this->graph->legend->SetPos(0.01, 0.5, 'left', 'center');    //    left
194
+                    $this->graph->legend->SetColumns(1);
195
+                    break;
196
+                case 't':
197
+                    $this->graph->legend->SetPos(0.5, 0.01, 'center', 'top');    //    top
198
+                    break;
199
+                case 'b':
200
+                    $this->graph->legend->SetPos(0.5, 0.99, 'center', 'bottom');    //    bottom
201
+                    break;
202
+                default:
203
+                    $this->graph->legend->SetPos(0.01, 0.01, 'right', 'top');    //    top-right
204
+                    $this->graph->legend->SetColumns(1);
205
+                    break;
206
+            }
207
+        } else {
208
+            $this->graph->legend->Hide();
209
+        }
210
+    }
211
+
212
+
213
+    private function renderCartesianPlotArea($type = 'textlin')
214
+    {
215
+        $this->graph = new Graph(self::$width, self::$height);
216
+        $this->graph->SetScale($type);
217
+
218
+        $this->renderTitle();
219
+
220
+        //    Rotate for bar rather than column chart
221
+        $rotation = $this->chart->getPlotArea()->getPlotGroupByIndex(0)->getPlotDirection();
222
+        $reverse = ($rotation == 'bar') ? true : false;
223
+
224
+        $xAxisLabel = $this->chart->getXAxisLabel();
225
+        if (!is_null($xAxisLabel)) {
226
+            $title = $this->getCaption($xAxisLabel);
227
+            if (!is_null($title)) {
228
+                $this->graph->xaxis->SetTitle($title, 'center');
229
+                $this->graph->xaxis->title->SetMargin(35);
230
+                if ($reverse) {
231
+                    $this->graph->xaxis->title->SetAngle(90);
232
+                    $this->graph->xaxis->title->SetMargin(90);
233
+                }
234
+            }
235
+        }
236
+
237
+        $yAxisLabel = $this->chart->getYAxisLabel();
238
+        if (!is_null($yAxisLabel)) {
239
+            $title = $this->getCaption($yAxisLabel);
240
+            if (!is_null($title)) {
241
+                $this->graph->yaxis->SetTitle($title, 'center');
242
+                if ($reverse) {
243
+                    $this->graph->yaxis->title->SetAngle(0);
244
+                    $this->graph->yaxis->title->SetMargin(-55);
245
+                }
246
+            }
247
+        }
248
+    }
249
+
250
+
251
+    private function renderPiePlotArea($doughnut = false)
252
+    {
253
+        $this->graph = new PieGraph(self::$width, self::$height);
254
+
255
+        $this->renderTitle();
256
+    }
257
+
258
+
259
+    private function renderRadarPlotArea()
260
+    {
261
+        $this->graph = new RadarGraph(self::$width, self::$height);
262
+        $this->graph->SetScale('lin');
263
+
264
+        $this->renderTitle();
265
+    }
266
+
267
+
268
+    private function renderPlotLine($groupID, $filled = false, $combination = false, $dimensions = '2d')
269
+    {
270
+        $grouping = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotGrouping();
271
+
272
+        $labelCount = count($this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex(0)->getPointCount());
273
+        if ($labelCount > 0) {
274
+            $datasetLabels = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex(0)->getDataValues();
275
+            $datasetLabels = $this->formatDataSetLabels($groupID, $datasetLabels, $labelCount);
276
+            $this->graph->xaxis->SetTickLabels($datasetLabels);
277
+        }
278
+
279
+        $seriesCount = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount();
280
+        $seriesPlots = array();
281
+        if ($grouping == 'percentStacked') {
282
+            $sumValues = $this->percentageSumCalculation($groupID, $seriesCount);
283
+        }
284
+
285
+        //    Loop through each data series in turn
286
+        for ($i = 0; $i < $seriesCount; ++$i) {
287
+            $dataValues = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues();
288
+            $marker = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getPointMarker();
289
+
290
+            if ($grouping == 'percentStacked') {
291
+                $dataValues = $this->percentageAdjustValues($dataValues, $sumValues);
292
+            }
293
+
294
+            //    Fill in any missing values in the $dataValues array
295
+            $testCurrentIndex = 0;
296
+            foreach ($dataValues as $k => $dataValue) {
297
+                while ($k != $testCurrentIndex) {
298
+                    $dataValues[$testCurrentIndex] = null;
299
+                    ++$testCurrentIndex;
300
+                }
301
+                ++$testCurrentIndex;
302
+            }
303
+
304
+            $seriesPlot = new LinePlot($dataValues);
305
+            if ($combination) {
306
+                $seriesPlot->SetBarCenter();
307
+            }
308
+
309
+            if ($filled) {
310
+                $seriesPlot->SetFilled(true);
311
+                $seriesPlot->SetColor('black');
312
+                $seriesPlot->SetFillColor(self::$colourSet[self::$plotColour++]);
313
+            } else {
314
+                //    Set the appropriate plot marker
315
+                $this->formatPointMarker($seriesPlot, $marker);
316
+            }
317
+            $dataLabel = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($i)->getDataValue();
318
+            $seriesPlot->SetLegend($dataLabel);
319
+
320
+            $seriesPlots[] = $seriesPlot;
321
+        }
322
+
323
+        if ($grouping == 'standard') {
324
+            $groupPlot = $seriesPlots;
325
+        } else {
326
+            $groupPlot = new AccLinePlot($seriesPlots);
327
+        }
328
+        $this->graph->Add($groupPlot);
329
+    }
330
+
331
+
332
+    private function renderPlotBar($groupID, $dimensions = '2d')
333
+    {
334
+        $rotation = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotDirection();
335
+        //    Rotate for bar rather than column chart
336
+        if (($groupID == 0) && ($rotation == 'bar')) {
337
+            $this->graph->Set90AndMargin();
338
+        }
339
+        $grouping = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotGrouping();
340
+
341
+        $labelCount = count($this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex(0)->getPointCount());
342
+        if ($labelCount > 0) {
343
+            $datasetLabels = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex(0)->getDataValues();
344
+            $datasetLabels = $this->formatDataSetLabels($groupID, $datasetLabels, $labelCount, $rotation);
345
+            //    Rotate for bar rather than column chart
346
+            if ($rotation == 'bar') {
347
+                $datasetLabels = array_reverse($datasetLabels);
348
+                $this->graph->yaxis->SetPos('max');
349
+                $this->graph->yaxis->SetLabelAlign('center', 'top');
350
+                $this->graph->yaxis->SetLabelSide(SIDE_RIGHT);
351
+            }
352
+            $this->graph->xaxis->SetTickLabels($datasetLabels);
353
+        }
354
+
355
+
356
+        $seriesCount = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount();
357
+        $seriesPlots = array();
358
+        if ($grouping == 'percentStacked') {
359
+            $sumValues = $this->percentageSumCalculation($groupID, $seriesCount);
360
+        }
361
+
362
+        //    Loop through each data series in turn
363
+        for ($j = 0; $j < $seriesCount; ++$j) {
364
+            $dataValues = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($j)->getDataValues();
365
+            if ($grouping == 'percentStacked') {
366
+                $dataValues = $this->percentageAdjustValues($dataValues, $sumValues);
367
+            }
368
+
369
+            //    Fill in any missing values in the $dataValues array
370
+            $testCurrentIndex = 0;
371
+            foreach ($dataValues as $k => $dataValue) {
372
+                while ($k != $testCurrentIndex) {
373
+                    $dataValues[$testCurrentIndex] = null;
374
+                    ++$testCurrentIndex;
375
+                }
376
+                ++$testCurrentIndex;
377
+            }
378
+
379
+            //    Reverse the $dataValues order for bar rather than column chart
380
+            if ($rotation == 'bar') {
381
+                $dataValues = array_reverse($dataValues);
382
+            }
383
+            $seriesPlot = new BarPlot($dataValues);
384
+            $seriesPlot->SetColor('black');
385
+            $seriesPlot->SetFillColor(self::$colourSet[self::$plotColour++]);
386
+            if ($dimensions == '3d') {
387
+                $seriesPlot->SetShadow();
388
+            }
389
+            if (!$this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($j)) {
390
+                $dataLabel = '';
391
+            } else {
392
+                $dataLabel = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($j)->getDataValue();
393
+            }
394
+            $seriesPlot->SetLegend($dataLabel);
395
+
396
+            $seriesPlots[] = $seriesPlot;
397
+        }
398
+        //    Reverse the plot order for bar rather than column chart
399
+        if (($rotation == 'bar') && (!($grouping == 'percentStacked'))) {
400
+            $seriesPlots = array_reverse($seriesPlots);
401
+        }
402
+
403
+        if ($grouping == 'clustered') {
404
+            $groupPlot = new GroupBarPlot($seriesPlots);
405
+        } elseif ($grouping == 'standard') {
406
+            $groupPlot = new GroupBarPlot($seriesPlots);
407
+        } else {
408
+            $groupPlot = new AccBarPlot($seriesPlots);
409
+            if ($dimensions == '3d') {
410
+                $groupPlot->SetShadow();
411
+            }
412
+        }
413
+
414
+        $this->graph->Add($groupPlot);
415
+    }
416
+
417
+
418
+    private function renderPlotScatter($groupID, $bubble)
419
+    {
420
+        $grouping = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotGrouping();
421
+        $scatterStyle = $bubbleSize = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotStyle();
422
+
423
+        $seriesCount = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount();
424
+        $seriesPlots = array();
425
+
426
+        //    Loop through each data series in turn
427
+        for ($i = 0; $i < $seriesCount; ++$i) {
428
+            $dataValuesY = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex($i)->getDataValues();
429
+            $dataValuesX = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues();
430
+
431
+            foreach ($dataValuesY as $k => $dataValueY) {
432
+                $dataValuesY[$k] = $k;
433
+            }
434
+
435
+            $seriesPlot = new ScatterPlot($dataValuesX, $dataValuesY);
436
+            if ($scatterStyle == 'lineMarker') {
437
+                $seriesPlot->SetLinkPoints();
438
+                $seriesPlot->link->SetColor(self::$colourSet[self::$plotColour]);
439
+            } elseif ($scatterStyle == 'smoothMarker') {
440
+                $spline = new Spline($dataValuesY, $dataValuesX);
441
+                list($splineDataY, $splineDataX) = $spline->Get(count($dataValuesX) * self::$width / 20);
442
+                $lplot = new LinePlot($splineDataX, $splineDataY);
443
+                $lplot->SetColor(self::$colourSet[self::$plotColour]);
444
+
445
+                $this->graph->Add($lplot);
446
+            }
447
+
448
+            if ($bubble) {
449
+                $this->formatPointMarker($seriesPlot, 'dot');
450
+                $seriesPlot->mark->SetColor('black');
451
+                $seriesPlot->mark->SetSize($bubbleSize);
452
+            } else {
453
+                $marker = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getPointMarker();
454
+                $this->formatPointMarker($seriesPlot, $marker);
455
+            }
456
+            $dataLabel = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($i)->getDataValue();
457
+            $seriesPlot->SetLegend($dataLabel);
458
+
459
+            $this->graph->Add($seriesPlot);
460
+        }
461
+    }
462
+
463
+
464
+    private function renderPlotRadar($groupID)
465
+    {
466
+        $radarStyle = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotStyle();
467
+
468
+        $seriesCount = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount();
469
+        $seriesPlots = array();
470
+
471
+        //    Loop through each data series in turn
472
+        for ($i = 0; $i < $seriesCount; ++$i) {
473
+            $dataValuesY = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex($i)->getDataValues();
474
+            $dataValuesX = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues();
475
+            $marker = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getPointMarker();
476
+
477
+            $dataValues = array();
478
+            foreach ($dataValuesY as $k => $dataValueY) {
479
+                $dataValues[$k] = implode(' ', array_reverse($dataValueY));
480
+            }
481
+            $tmp = array_shift($dataValues);
482
+            $dataValues[] = $tmp;
483
+            $tmp = array_shift($dataValuesX);
484
+            $dataValuesX[] = $tmp;
485
+
486
+            $this->graph->SetTitles(array_reverse($dataValues));
487
+
488
+            $seriesPlot = new RadarPlot(array_reverse($dataValuesX));
489
+
490
+            $dataLabel = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($i)->getDataValue();
491
+            $seriesPlot->SetColor(self::$colourSet[self::$plotColour++]);
492
+            if ($radarStyle == 'filled') {
493
+                $seriesPlot->SetFillColor(self::$colourSet[self::$plotColour]);
494
+            }
495
+            $this->formatPointMarker($seriesPlot, $marker);
496
+            $seriesPlot->SetLegend($dataLabel);
497
+
498
+            $this->graph->Add($seriesPlot);
499
+        }
500
+    }
501
+
502
+
503
+    private function renderPlotContour($groupID)
504
+    {
505
+        $contourStyle = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotStyle();
506
+
507
+        $seriesCount = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount();
508
+        $seriesPlots = array();
509
+
510
+        $dataValues = array();
511
+        //    Loop through each data series in turn
512
+        for ($i = 0; $i < $seriesCount; ++$i) {
513
+            $dataValuesY = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex($i)->getDataValues();
514
+            $dataValuesX = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues();
515
+
516
+            $dataValues[$i] = $dataValuesX;
517
+        }
518
+        $seriesPlot = new ContourPlot($dataValues);
519
+
520
+        $this->graph->Add($seriesPlot);
521
+    }
522
+
523
+
524
+    private function renderPlotStock($groupID)
525
+    {
526
+        $seriesCount = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount();
527
+        $plotOrder = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotOrder();
528
+
529
+        $dataValues = array();
530
+        //    Loop through each data series in turn and build the plot arrays
531
+        foreach ($plotOrder as $i => $v) {
532
+            $dataValuesX = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($v)->getDataValues();
533
+            foreach ($dataValuesX as $j => $dataValueX) {
534
+                $dataValues[$plotOrder[$i]][$j] = $dataValueX;
535
+            }
536
+        }
537
+        if (empty($dataValues)) {
538
+            return;
539
+        }
540
+
541
+        $dataValuesPlot = array();
542
+        // Flatten the plot arrays to a single dimensional array to work with jpgraph
543
+        for ($j = 0; $j < count($dataValues[0]); ++$j) {
544
+            for ($i = 0; $i < $seriesCount; ++$i) {
545
+                $dataValuesPlot[] = $dataValues[$i][$j];
546
+            }
547
+        }
548
+
549
+        // Set the x-axis labels
550
+        $labelCount = count($this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex(0)->getPointCount());
551
+        if ($labelCount > 0) {
552
+            $datasetLabels = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex(0)->getDataValues();
553
+            $datasetLabels = $this->formatDataSetLabels($groupID, $datasetLabels, $labelCount);
554
+            $this->graph->xaxis->SetTickLabels($datasetLabels);
555
+        }
556
+
557
+        $seriesPlot = new StockPlot($dataValuesPlot);
558
+        $seriesPlot->SetWidth(20);
559
+
560
+        $this->graph->Add($seriesPlot);
561
+    }
562
+
563
+
564
+    private function renderAreaChart($groupCount, $dimensions = '2d')
565
+    {
566
+        require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_line.php');
567
+
568
+        $this->renderCartesianPlotArea();
569
+
570
+        for ($i = 0; $i < $groupCount; ++$i) {
571
+            $this->renderPlotLine($i, true, false, $dimensions);
572
+        }
573
+    }
574
+
575
+
576
+    private function renderLineChart($groupCount, $dimensions = '2d')
577
+    {
578
+        require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_line.php');
579
+
580
+        $this->renderCartesianPlotArea();
581
+
582
+        for ($i = 0; $i < $groupCount; ++$i) {
583
+            $this->renderPlotLine($i, false, false, $dimensions);
584
+        }
585
+    }
586
+
587
+
588
+    private function renderBarChart($groupCount, $dimensions = '2d')
589
+    {
590
+        require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_bar.php');
591
+
592
+        $this->renderCartesianPlotArea();
593
+
594
+        for ($i = 0; $i < $groupCount; ++$i) {
595
+            $this->renderPlotBar($i, $dimensions);
596
+        }
597
+    }
598
+
599
+
600
+    private function renderScatterChart($groupCount)
601
+    {
602
+        require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_scatter.php');
603
+        require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_regstat.php');
604
+        require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_line.php');
605
+
606
+        $this->renderCartesianPlotArea('linlin');
607
+
608
+        for ($i = 0; $i < $groupCount; ++$i) {
609
+            $this->renderPlotScatter($i, false);
610
+        }
611
+    }
612
+
613
+
614
+    private function renderBubbleChart($groupCount)
615
+    {
616
+        require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_scatter.php');
617
+
618
+        $this->renderCartesianPlotArea('linlin');
619
+
620
+        for ($i = 0; $i < $groupCount; ++$i) {
621
+            $this->renderPlotScatter($i, true);
622
+        }
623
+    }
624
+
625
+
626
+    private function renderPieChart($groupCount, $dimensions = '2d', $doughnut = false, $multiplePlots = false)
627
+    {
628
+        require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_pie.php');
629
+        if ($dimensions == '3d') {
630
+            require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_pie3d.php');
631
+        }
632
+
633
+        $this->renderPiePlotArea($doughnut);
634
+
635
+        $iLimit = ($multiplePlots) ? $groupCount : 1;
636
+        for ($groupID = 0; $groupID < $iLimit; ++$groupID) {
637
+            $grouping = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotGrouping();
638
+            $exploded = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotStyle();
639
+            if ($groupID == 0) {
640
+                $labelCount = count($this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex(0)->getPointCount());
641
+                if ($labelCount > 0) {
642
+                    $datasetLabels = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex(0)->getDataValues();
643
+                    $datasetLabels = $this->formatDataSetLabels($groupID, $datasetLabels, $labelCount);
644
+                }
645
+            }
646
+
647
+            $seriesCount = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount();
648
+            $seriesPlots = array();
649
+            //    For pie charts, we only display the first series: doughnut charts generally display all series
650
+            $jLimit = ($multiplePlots) ? $seriesCount : 1;
651
+            //    Loop through each data series in turn
652
+            for ($j = 0; $j < $jLimit; ++$j) {
653
+                $dataValues = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($j)->getDataValues();
654
+
655
+                //    Fill in any missing values in the $dataValues array
656
+                $testCurrentIndex = 0;
657
+                foreach ($dataValues as $k => $dataValue) {
658
+                    while ($k != $testCurrentIndex) {
659
+                        $dataValues[$testCurrentIndex] = null;
660
+                        ++$testCurrentIndex;
661
+                    }
662
+                    ++$testCurrentIndex;
663
+                }
664
+
665
+                if ($dimensions == '3d') {
666
+                    $seriesPlot = new PiePlot3D($dataValues);
667
+                } else {
668
+                    if ($doughnut) {
669
+                        $seriesPlot = new PiePlotC($dataValues);
670
+                    } else {
671
+                        $seriesPlot = new PiePlot($dataValues);
672
+                    }
673
+                }
674
+
675
+                if ($multiplePlots) {
676
+                    $seriesPlot->SetSize(($jLimit-$j) / ($jLimit * 4));
677
+                }
678
+
679
+                if ($doughnut) {
680
+                    $seriesPlot->SetMidColor('white');
681
+                }
682
+
683
+                $seriesPlot->SetColor(self::$colourSet[self::$plotColour++]);
684
+                if (count($datasetLabels) > 0) {
685
+                    $seriesPlot->SetLabels(array_fill(0, count($datasetLabels), ''));
686
+                }
687
+                if ($dimensions != '3d') {
688
+                    $seriesPlot->SetGuideLines(false);
689
+                }
690
+                if ($j == 0) {
691
+                    if ($exploded) {
692
+                        $seriesPlot->ExplodeAll();
693
+                    }
694
+                    $seriesPlot->SetLegends($datasetLabels);
695
+                }
696
+
697
+                $this->graph->Add($seriesPlot);
698
+            }
699
+        }
700
+    }
701
+
702
+
703
+    private function renderRadarChart($groupCount)
704
+    {
705
+        require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_radar.php');
706
+
707
+        $this->renderRadarPlotArea();
708
+
709
+        for ($groupID = 0; $groupID < $groupCount; ++$groupID) {
710
+            $this->renderPlotRadar($groupID);
711
+        }
712
+    }
713
+
714
+
715
+    private function renderStockChart($groupCount)
716
+    {
717
+        require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_stock.php');
718
+
719
+        $this->renderCartesianPlotArea('intint');
720
+
721
+        for ($groupID = 0; $groupID < $groupCount; ++$groupID) {
722
+            $this->renderPlotStock($groupID);
723
+        }
724
+    }
725
+
726
+
727
+    private function renderContourChart($groupCount, $dimensions)
728
+    {
729
+        require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_contour.php');
730
+
731
+        $this->renderCartesianPlotArea('intint');
732
+
733
+        for ($i = 0; $i < $groupCount; ++$i) {
734
+            $this->renderPlotContour($i);
735
+        }
736
+    }
737
+
738
+
739
+    private function renderCombinationChart($groupCount, $dimensions, $outputDestination)
740
+    {
741
+        require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_line.php');
742
+        require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_bar.php');
743
+        require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_scatter.php');
744
+        require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_regstat.php');
745
+        require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_line.php');
746
+
747
+        $this->renderCartesianPlotArea();
748
+
749
+        for ($i = 0; $i < $groupCount; ++$i) {
750
+            $dimensions = null;
751
+            $chartType = $this->chart->getPlotArea()->getPlotGroupByIndex($i)->getPlotType();
752
+            switch ($chartType) {
753
+                case 'area3DChart':
754
+                    $dimensions = '3d';
755
+                    // no break
756
+                case 'areaChart':
757
+                    $this->renderPlotLine($i, true, true, $dimensions);
758
+                    break;
759
+                case 'bar3DChart':
760
+                    $dimensions = '3d';
761
+                    // no break
762
+                case 'barChart':
763
+                    $this->renderPlotBar($i, $dimensions);
764
+                    break;
765
+                case 'line3DChart':
766
+                    $dimensions = '3d';
767
+                    // no break
768
+                case 'lineChart':
769
+                    $this->renderPlotLine($i, false, true, $dimensions);
770
+                    break;
771
+                case 'scatterChart':
772
+                    $this->renderPlotScatter($i, false);
773
+                    break;
774
+                case 'bubbleChart':
775
+                    $this->renderPlotScatter($i, true);
776
+                    break;
777
+                default:
778
+                    $this->graph = null;
779
+                    return false;
780
+            }
781
+        }
782
+
783
+        $this->renderLegend();
784
+
785
+        $this->graph->Stroke($outputDestination);
786
+        return true;
787
+    }
788
+
789
+
790
+    public function render($outputDestination)
791
+    {
792
+        self::$plotColour = 0;
793
+
794
+        $groupCount = $this->chart->getPlotArea()->getPlotGroupCount();
795
+
796
+        $dimensions = null;
797
+        if ($groupCount == 1) {
798
+            $chartType = $this->chart->getPlotArea()->getPlotGroupByIndex(0)->getPlotType();
799
+        } else {
800
+            $chartTypes = array();
801
+            for ($i = 0; $i < $groupCount; ++$i) {
802
+                $chartTypes[] = $this->chart->getPlotArea()->getPlotGroupByIndex($i)->getPlotType();
803
+            }
804
+            $chartTypes = array_unique($chartTypes);
805
+            if (count($chartTypes) == 1) {
806
+                $chartType = array_pop($chartTypes);
807
+            } elseif (count($chartTypes) == 0) {
808
+                echo 'Chart is not yet implemented<br />';
809
+                return false;
810
+            } else {
811
+                return $this->renderCombinationChart($groupCount, $dimensions, $outputDestination);
812
+            }
813
+        }
814
+
815
+        switch ($chartType) {
816
+            case 'area3DChart':
817
+                $dimensions = '3d';
818
+                // no break
819
+            case 'areaChart':
820
+                $this->renderAreaChart($groupCount, $dimensions);
821
+                break;
822
+            case 'bar3DChart':
823
+                $dimensions = '3d';
824
+                // no break
825
+            case 'barChart':
826
+                $this->renderBarChart($groupCount, $dimensions);
827
+                break;
828
+            case 'line3DChart':
829
+                $dimensions = '3d';
830
+                // no break
831
+            case 'lineChart':
832
+                $this->renderLineChart($groupCount, $dimensions);
833
+                break;
834
+            case 'pie3DChart':
835
+                $dimensions = '3d';
836
+                // no break
837
+            case 'pieChart':
838
+                $this->renderPieChart($groupCount, $dimensions, false, false);
839
+                break;
840
+            case 'doughnut3DChart':
841
+                $dimensions = '3d';
842
+                // no break
843
+            case 'doughnutChart':
844
+                $this->renderPieChart($groupCount, $dimensions, true, true);
845
+                break;
846
+            case 'scatterChart':
847
+                $this->renderScatterChart($groupCount);
848
+                break;
849
+            case 'bubbleChart':
850
+                $this->renderBubbleChart($groupCount);
851
+                break;
852
+            case 'radarChart':
853
+                $this->renderRadarChart($groupCount);
854
+                break;
855
+            case 'surface3DChart':
856
+                $dimensions = '3d';
857
+                // no break
858
+            case 'surfaceChart':
859
+                $this->renderContourChart($groupCount, $dimensions);
860
+                break;
861
+            case 'stockChart':
862
+                $this->renderStockChart($groupCount, $dimensions);
863
+                break;
864
+            default:
865
+                echo $chartType.' is not yet implemented<br />';
866
+                return false;
867
+        }
868
+        $this->renderLegend();
869
+
870
+        $this->graph->Stroke($outputDestination);
871
+        return true;
872
+    }
873
+
874
+
875
+    /**
876
+     * Create a new PHPExcel_Chart_Renderer_jpgraph
877
+     */
878
+    public function __construct(PHPExcel_Chart $chart)
879
+    {
880
+        $this->graph    = null;
881
+        $this->chart    = $chart;
882
+    }
883
+}

+ 86
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/Chart/Title.php View File

@@ -0,0 +1,86 @@
1
+<?php
2
+
3
+/**
4
+ * PHPExcel_Chart_Title
5
+ *
6
+ * Copyright (c) 2006 - 2015 PHPExcel
7
+ *
8
+ * This library is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU Lesser General Public
10
+ * License as published by the Free Software Foundation; either
11
+ * version 2.1 of the License, or (at your option) any later version.
12
+ *
13
+ * This library is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
+ * Lesser General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU Lesser General Public
19
+ * License along with this library; if not, write to the Free Software
20
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21
+ *
22
+ * @category    PHPExcel
23
+ * @package        PHPExcel_Chart
24
+ * @copyright    Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
25
+ * @license        http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
26
+ * @version        ##VERSION##, ##DATE##
27
+ */
28
+class PHPExcel_Chart_Title
29
+{
30
+
31
+    /**
32
+     * Title Caption
33
+     *
34
+     * @var string
35
+     */
36
+    private $caption = null;
37
+
38
+    /**
39
+     * Title Layout
40
+     *
41
+     * @var PHPExcel_Chart_Layout
42
+     */
43
+    private $layout = null;
44
+
45
+    /**
46
+     * Create a new PHPExcel_Chart_Title
47
+     */
48
+    public function __construct($caption = null, PHPExcel_Chart_Layout $layout = null)
49
+    {
50
+        $this->caption = $caption;
51
+        $this->layout = $layout;
52
+    }
53
+
54
+    /**
55
+     * Get caption
56
+     *
57
+     * @return string
58
+     */
59
+    public function getCaption()
60
+    {
61
+        return $this->caption;
62
+    }
63
+
64
+    /**
65
+     * Set caption
66
+     *
67
+     * @param string $caption
68
+     * @return PHPExcel_Chart_Title
69
+     */
70
+    public function setCaption($caption = null)
71
+    {
72
+        $this->caption = $caption;
73
+        
74
+        return $this;
75
+    }
76
+
77
+    /**
78
+     * Get Layout
79
+     *
80
+     * @return PHPExcel_Chart_Layout
81
+     */
82
+    public function getLayout()
83
+    {
84
+        return $this->layout;
85
+    }
86
+}

+ 338
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/Comment.php View File

@@ -0,0 +1,338 @@
1
+<?php
2
+
3
+/**
4
+ * PHPExcel_Comment
5
+ *
6
+ * Copyright (c) 2006 - 2015 PHPExcel
7
+ *
8
+ * This library is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU Lesser General Public
10
+ * License as published by the Free Software Foundation; either
11
+ * version 2.1 of the License, or (at your option) any later version.
12
+ *
13
+ * This library is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
+ * Lesser General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU Lesser General Public
19
+ * License along with this library; if not, write to the Free Software
20
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21
+ *
22
+ * @category   PHPExcel
23
+ * @package    PHPExcel
24
+ * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
25
+ * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
26
+ * @version    ##VERSION##, ##DATE##
27
+ */
28
+class PHPExcel_Comment implements PHPExcel_IComparable
29
+{
30
+    /**
31
+     * Author
32
+     *
33
+     * @var string
34
+     */
35
+    private $author;
36
+
37
+    /**
38
+     * Rich text comment
39
+     *
40
+     * @var PHPExcel_RichText
41
+     */
42
+    private $text;
43
+
44
+    /**
45
+     * Comment width (CSS style, i.e. XXpx or YYpt)
46
+     *
47
+     * @var string
48
+     */
49
+    private $width = '96pt';
50
+
51
+    /**
52
+     * Left margin (CSS style, i.e. XXpx or YYpt)
53
+     *
54
+     * @var string
55
+     */
56
+    private $marginLeft = '59.25pt';
57
+
58
+    /**
59
+     * Top margin (CSS style, i.e. XXpx or YYpt)
60
+     *
61
+     * @var string
62
+     */
63
+    private $marginTop = '1.5pt';
64
+
65
+    /**
66
+     * Visible
67
+     *
68
+     * @var boolean
69
+     */
70
+    private $visible = false;
71
+
72
+    /**
73
+     * Comment height (CSS style, i.e. XXpx or YYpt)
74
+     *
75
+     * @var string
76
+     */
77
+    private $height = '55.5pt';
78
+
79
+    /**
80
+     * Comment fill color
81
+     *
82
+     * @var PHPExcel_Style_Color
83
+     */
84
+    private $fillColor;
85
+
86
+    /**
87
+     * Alignment
88
+     *
89
+     * @var string
90
+     */
91
+    private $alignment;
92
+
93
+    /**
94
+     * Create a new PHPExcel_Comment
95
+     *
96
+     * @throws PHPExcel_Exception
97
+     */
98
+    public function __construct()
99
+    {
100
+        // Initialise variables
101
+        $this->author    = 'Author';
102
+        $this->text      = new PHPExcel_RichText();
103
+        $this->fillColor = new PHPExcel_Style_Color('FFFFFFE1');
104
+        $this->alignment = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL;
105
+    }
106
+
107
+    /**
108
+     * Get Author
109
+     *
110
+     * @return string
111
+     */
112
+    public function getAuthor()
113
+    {
114
+        return $this->author;
115
+    }
116
+
117
+    /**
118
+     * Set Author
119
+     *
120
+     * @param string $pValue
121
+     * @return PHPExcel_Comment
122
+     */
123
+    public function setAuthor($pValue = '')
124
+    {
125
+        $this->author = $pValue;
126
+        return $this;
127
+    }
128
+
129
+    /**
130
+     * Get Rich text comment
131
+     *
132
+     * @return PHPExcel_RichText
133
+     */
134
+    public function getText()
135
+    {
136
+        return $this->text;
137
+    }
138
+
139
+    /**
140
+     * Set Rich text comment
141
+     *
142
+     * @param PHPExcel_RichText $pValue
143
+     * @return PHPExcel_Comment
144
+     */
145
+    public function setText(PHPExcel_RichText $pValue)
146
+    {
147
+        $this->text = $pValue;
148
+        return $this;
149
+    }
150
+
151
+    /**
152
+     * Get comment width (CSS style, i.e. XXpx or YYpt)
153
+     *
154
+     * @return string
155
+     */
156
+    public function getWidth()
157
+    {
158
+        return $this->width;
159
+    }
160
+
161
+    /**
162
+     * Set comment width (CSS style, i.e. XXpx or YYpt)
163
+     *
164
+     * @param string $value
165
+     * @return PHPExcel_Comment
166
+     */
167
+    public function setWidth($value = '96pt')
168
+    {
169
+        $this->width = $value;
170
+        return $this;
171
+    }
172
+
173
+    /**
174
+     * Get comment height (CSS style, i.e. XXpx or YYpt)
175
+     *
176
+     * @return string
177
+     */
178
+    public function getHeight()
179
+    {
180
+        return $this->height;
181
+    }
182
+
183
+    /**
184
+     * Set comment height (CSS style, i.e. XXpx or YYpt)
185
+     *
186
+     * @param string $value
187
+     * @return PHPExcel_Comment
188
+     */
189
+    public function setHeight($value = '55.5pt')
190
+    {
191
+        $this->height = $value;
192
+        return $this;
193
+    }
194
+
195
+    /**
196
+     * Get left margin (CSS style, i.e. XXpx or YYpt)
197
+     *
198
+     * @return string
199
+     */
200
+    public function getMarginLeft()
201
+    {
202
+        return $this->marginLeft;
203
+    }
204
+
205
+    /**
206
+     * Set left margin (CSS style, i.e. XXpx or YYpt)
207
+     *
208
+     * @param string $value
209
+     * @return PHPExcel_Comment
210
+     */
211
+    public function setMarginLeft($value = '59.25pt')
212
+    {
213
+        $this->marginLeft = $value;
214
+        return $this;
215
+    }
216
+
217
+    /**
218
+     * Get top margin (CSS style, i.e. XXpx or YYpt)
219
+     *
220
+     * @return string
221
+     */
222
+    public function getMarginTop()
223
+    {
224
+        return $this->marginTop;
225
+    }
226
+
227
+    /**
228
+     * Set top margin (CSS style, i.e. XXpx or YYpt)
229
+     *
230
+     * @param string $value
231
+     * @return PHPExcel_Comment
232
+     */
233
+    public function setMarginTop($value = '1.5pt')
234
+    {
235
+        $this->marginTop = $value;
236
+        return $this;
237
+    }
238
+
239
+    /**
240
+     * Is the comment visible by default?
241
+     *
242
+     * @return boolean
243
+     */
244
+    public function getVisible()
245
+    {
246
+        return $this->visible;
247
+    }
248
+
249
+    /**
250
+     * Set comment default visibility
251
+     *
252
+     * @param boolean $value
253
+     * @return PHPExcel_Comment
254
+     */
255
+    public function setVisible($value = false)
256
+    {
257
+        $this->visible = $value;
258
+        return $this;
259
+    }
260
+
261
+    /**
262
+     * Get fill color
263
+     *
264
+     * @return PHPExcel_Style_Color
265
+     */
266
+    public function getFillColor()
267
+    {
268
+        return $this->fillColor;
269
+    }
270
+
271
+    /**
272
+     * Set Alignment
273
+     *
274
+     * @param string $pValue
275
+     * @return PHPExcel_Comment
276
+     */
277
+    public function setAlignment($pValue = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL)
278
+    {
279
+        $this->alignment = $pValue;
280
+        return $this;
281
+    }
282
+
283
+    /**
284
+     * Get Alignment
285
+     *
286
+     * @return string
287
+     */
288
+    public function getAlignment()
289
+    {
290
+        return $this->alignment;
291
+    }
292
+
293
+    /**
294
+     * Get hash code
295
+     *
296
+     * @return string    Hash code
297
+     */
298
+    public function getHashCode()
299
+    {
300
+        return md5(
301
+            $this->author .
302
+            $this->text->getHashCode() .
303
+            $this->width .
304
+            $this->height .
305
+            $this->marginLeft .
306
+            $this->marginTop .
307
+            ($this->visible ? 1 : 0) .
308
+            $this->fillColor->getHashCode() .
309
+            $this->alignment .
310
+            __CLASS__
311
+        );
312
+    }
313
+
314
+    /**
315
+     * Implement PHP __clone to create a deep clone, not just a shallow copy.
316
+     */
317
+    public function __clone()
318
+    {
319
+        $vars = get_object_vars($this);
320
+        foreach ($vars as $key => $value) {
321
+            if (is_object($value)) {
322
+                $this->$key = clone $value;
323
+            } else {
324
+                $this->$key = $value;
325
+            }
326
+        }
327
+    }
328
+
329
+    /**
330
+     * Convert to string
331
+     *
332
+     * @return string
333
+     */
334
+    public function __toString()
335
+    {
336
+        return $this->text->getPlainText();
337
+    }
338
+}

+ 611
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/DocumentProperties.php View File

@@ -0,0 +1,611 @@
1
+<?php
2
+
3
+/**
4
+ * PHPExcel_DocumentProperties
5
+ *
6
+ * Copyright (c) 2006 - 2015 PHPExcel
7
+ *
8
+ * This library is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU Lesser General Public
10
+ * License as published by the Free Software Foundation; either
11
+ * version 2.1 of the License, or (at your option) any later version.
12
+ *
13
+ * This library is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
+ * Lesser General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU Lesser General Public
19
+ * License along with this library; if not, write to the Free Software
20
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21
+ *
22
+ * @category    PHPExcel
23
+ * @package    PHPExcel
24
+ * @copyright    Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
25
+ * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
26
+ * @version    ##VERSION##, ##DATE##
27
+ */
28
+class PHPExcel_DocumentProperties
29
+{
30
+    /** constants */
31
+    const PROPERTY_TYPE_BOOLEAN = 'b';
32
+    const PROPERTY_TYPE_INTEGER = 'i';
33
+    const PROPERTY_TYPE_FLOAT   = 'f';
34
+    const PROPERTY_TYPE_DATE    = 'd';
35
+    const PROPERTY_TYPE_STRING  = 's';
36
+    const PROPERTY_TYPE_UNKNOWN = 'u';
37
+
38
+    /**
39
+     * Creator
40
+     *
41
+     * @var string
42
+     */
43
+    private $creator = 'Unknown Creator';
44
+
45
+    /**
46
+     * LastModifiedBy
47
+     *
48
+     * @var string
49
+     */
50
+    private $lastModifiedBy;
51
+
52
+    /**
53
+     * Created
54
+     *
55
+     * @var datetime
56
+     */
57
+    private $created;
58
+
59
+    /**
60
+     * Modified
61
+     *
62
+     * @var datetime
63
+     */
64
+    private $modified;
65
+
66
+    /**
67
+     * Title
68
+     *
69
+     * @var string
70
+     */
71
+    private $title = 'Untitled Spreadsheet';
72
+
73
+    /**
74
+     * Description
75
+     *
76
+     * @var string
77
+     */
78
+    private $description = '';
79
+
80
+    /**
81
+     * Subject
82
+     *
83
+     * @var string
84
+     */
85
+    private $subject = '';
86
+
87
+    /**
88
+     * Keywords
89
+     *
90
+     * @var string
91
+     */
92
+    private $keywords = '';
93
+
94
+    /**
95
+     * Category
96
+     *
97
+     * @var string
98
+     */
99
+    private $category = '';
100
+
101
+    /**
102
+     * Manager
103
+     *
104
+     * @var string
105
+     */
106
+    private $manager = '';
107
+
108
+    /**
109
+     * Company
110
+     *
111
+     * @var string
112
+     */
113
+    private $company = 'Microsoft Corporation';
114
+
115
+    /**
116
+     * Custom Properties
117
+     *
118
+     * @var string
119
+     */
120
+    private $customProperties = array();
121
+
122
+
123
+    /**
124
+     * Create a new PHPExcel_DocumentProperties
125
+     */
126
+    public function __construct()
127
+    {
128
+        // Initialise values
129
+        $this->lastModifiedBy = $this->creator;
130
+        $this->created  = time();
131
+        $this->modified = time();
132
+    }
133
+
134
+    /**
135
+     * Get Creator
136
+     *
137
+     * @return string
138
+     */
139
+    public function getCreator()
140
+    {
141
+        return $this->creator;
142
+    }
143
+
144
+    /**
145
+     * Set Creator
146
+     *
147
+     * @param string $pValue
148
+     * @return PHPExcel_DocumentProperties
149
+     */
150
+    public function setCreator($pValue = '')
151
+    {
152
+        $this->creator = $pValue;
153
+        return $this;
154
+    }
155
+
156
+    /**
157
+     * Get Last Modified By
158
+     *
159
+     * @return string
160
+     */
161
+    public function getLastModifiedBy()
162
+    {
163
+        return $this->lastModifiedBy;
164
+    }
165
+
166
+    /**
167
+     * Set Last Modified By
168
+     *
169
+     * @param string $pValue
170
+     * @return PHPExcel_DocumentProperties
171
+     */
172
+    public function setLastModifiedBy($pValue = '')
173
+    {
174
+        $this->lastModifiedBy = $pValue;
175
+        return $this;
176
+    }
177
+
178
+    /**
179
+     * Get Created
180
+     *
181
+     * @return datetime
182
+     */
183
+    public function getCreated()
184
+    {
185
+        return $this->created;
186
+    }
187
+
188
+    /**
189
+     * Set Created
190
+     *
191
+     * @param datetime $pValue
192
+     * @return PHPExcel_DocumentProperties
193
+     */
194
+    public function setCreated($pValue = null)
195
+    {
196
+        if ($pValue === null) {
197
+            $pValue = time();
198
+        } elseif (is_string($pValue)) {
199
+            if (is_numeric($pValue)) {
200
+                $pValue = intval($pValue);
201
+            } else {
202
+                $pValue = strtotime($pValue);
203
+            }
204
+        }
205
+
206
+        $this->created = $pValue;
207
+        return $this;
208
+    }
209
+
210
+    /**
211
+     * Get Modified
212
+     *
213
+     * @return datetime
214
+     */
215
+    public function getModified()
216
+    {
217
+        return $this->modified;
218
+    }
219
+
220
+    /**
221
+     * Set Modified
222
+     *
223
+     * @param datetime $pValue
224
+     * @return PHPExcel_DocumentProperties
225
+     */
226
+    public function setModified($pValue = null)
227
+    {
228
+        if ($pValue === null) {
229
+            $pValue = time();
230
+        } elseif (is_string($pValue)) {
231
+            if (is_numeric($pValue)) {
232
+                $pValue = intval($pValue);
233
+            } else {
234
+                $pValue = strtotime($pValue);
235
+            }
236
+        }
237
+
238
+        $this->modified = $pValue;
239
+        return $this;
240
+    }
241
+
242
+    /**
243
+     * Get Title
244
+     *
245
+     * @return string
246
+     */
247
+    public function getTitle()
248
+    {
249
+        return $this->title;
250
+    }
251
+
252
+    /**
253
+     * Set Title
254
+     *
255
+     * @param string $pValue
256
+     * @return PHPExcel_DocumentProperties
257
+     */
258
+    public function setTitle($pValue = '')
259
+    {
260
+        $this->title = $pValue;
261
+        return $this;
262
+    }
263
+
264
+    /**
265
+     * Get Description
266
+     *
267
+     * @return string
268
+     */
269
+    public function getDescription()
270
+    {
271
+        return $this->description;
272
+    }
273
+
274
+    /**
275
+     * Set Description
276
+     *
277
+     * @param string $pValue
278
+     * @return PHPExcel_DocumentProperties
279
+     */
280
+    public function setDescription($pValue = '')
281
+    {
282
+        $this->description = $pValue;
283
+        return $this;
284
+    }
285
+
286
+    /**
287
+     * Get Subject
288
+     *
289
+     * @return string
290
+     */
291
+    public function getSubject()
292
+    {
293
+        return $this->subject;
294
+    }
295
+
296
+    /**
297
+     * Set Subject
298
+     *
299
+     * @param string $pValue
300
+     * @return PHPExcel_DocumentProperties
301
+     */
302
+    public function setSubject($pValue = '')
303
+    {
304
+        $this->subject = $pValue;
305
+        return $this;
306
+    }
307
+
308
+    /**
309
+     * Get Keywords
310
+     *
311
+     * @return string
312
+     */
313
+    public function getKeywords()
314
+    {
315
+        return $this->keywords;
316
+    }
317
+
318
+    /**
319
+     * Set Keywords
320
+     *
321
+     * @param string $pValue
322
+     * @return PHPExcel_DocumentProperties
323
+     */
324
+    public function setKeywords($pValue = '')
325
+    {
326
+        $this->keywords = $pValue;
327
+        return $this;
328
+    }
329
+
330
+    /**
331
+     * Get Category
332
+     *
333
+     * @return string
334
+     */
335
+    public function getCategory()
336
+    {
337
+        return $this->category;
338
+    }
339
+
340
+    /**
341
+     * Set Category
342
+     *
343
+     * @param string $pValue
344
+     * @return PHPExcel_DocumentProperties
345
+     */
346
+    public function setCategory($pValue = '')
347
+    {
348
+        $this->category = $pValue;
349
+        return $this;
350
+    }
351
+
352
+    /**
353
+     * Get Company
354
+     *
355
+     * @return string
356
+     */
357
+    public function getCompany()
358
+    {
359
+        return $this->company;
360
+    }
361
+
362
+    /**
363
+     * Set Company
364
+     *
365
+     * @param string $pValue
366
+     * @return PHPExcel_DocumentProperties
367
+     */
368
+    public function setCompany($pValue = '')
369
+    {
370
+        $this->company = $pValue;
371
+        return $this;
372
+    }
373
+
374
+    /**
375
+     * Get Manager
376
+     *
377
+     * @return string
378
+     */
379
+    public function getManager()
380
+    {
381
+        return $this->manager;
382
+    }
383
+
384
+    /**
385
+     * Set Manager
386
+     *
387
+     * @param string $pValue
388
+     * @return PHPExcel_DocumentProperties
389
+     */
390
+    public function setManager($pValue = '')
391
+    {
392
+        $this->manager = $pValue;
393
+        return $this;
394
+    }
395
+
396
+    /**
397
+     * Get a List of Custom Property Names
398
+     *
399
+     * @return array of string
400
+     */
401
+    public function getCustomProperties()
402
+    {
403
+        return array_keys($this->customProperties);
404
+    }
405
+
406
+    /**
407
+     * Check if a Custom Property is defined
408
+     *
409
+     * @param string $propertyName
410
+     * @return boolean
411
+     */
412
+    public function isCustomPropertySet($propertyName)
413
+    {
414
+        return isset($this->customProperties[$propertyName]);
415
+    }
416
+
417
+    /**
418
+     * Get a Custom Property Value
419
+     *
420
+     * @param string $propertyName
421
+     * @return string
422
+     */
423
+    public function getCustomPropertyValue($propertyName)
424
+    {
425
+        if (isset($this->customProperties[$propertyName])) {
426
+            return $this->customProperties[$propertyName]['value'];
427
+        }
428
+
429
+    }
430
+
431
+    /**
432
+     * Get a Custom Property Type
433
+     *
434
+     * @param string $propertyName
435
+     * @return string
436
+     */
437
+    public function getCustomPropertyType($propertyName)
438
+    {
439
+        if (isset($this->customProperties[$propertyName])) {
440
+            return $this->customProperties[$propertyName]['type'];
441
+        }
442
+
443
+    }
444
+
445
+    /**
446
+     * Set a Custom Property
447
+     *
448
+     * @param string $propertyName
449
+     * @param mixed $propertyValue
450
+     * @param string $propertyType
451
+     *      'i'    : Integer
452
+     *   'f' : Floating Point
453
+     *   's' : String
454
+     *   'd' : Date/Time
455
+     *   'b' : Boolean
456
+     * @return PHPExcel_DocumentProperties
457
+     */
458
+    public function setCustomProperty($propertyName, $propertyValue = '', $propertyType = null)
459
+    {
460
+        if (($propertyType === null) || (!in_array($propertyType, array(self::PROPERTY_TYPE_INTEGER,
461
+                                                                        self::PROPERTY_TYPE_FLOAT,
462
+                                                                        self::PROPERTY_TYPE_STRING,
463
+                                                                        self::PROPERTY_TYPE_DATE,
464
+                                                                        self::PROPERTY_TYPE_BOOLEAN)))) {
465
+            if ($propertyValue === null) {
466
+                $propertyType = self::PROPERTY_TYPE_STRING;
467
+            } elseif (is_float($propertyValue)) {
468
+                $propertyType = self::PROPERTY_TYPE_FLOAT;
469
+            } elseif (is_int($propertyValue)) {
470
+                $propertyType = self::PROPERTY_TYPE_INTEGER;
471
+            } elseif (is_bool($propertyValue)) {
472
+                $propertyType = self::PROPERTY_TYPE_BOOLEAN;
473
+            } else {
474
+                $propertyType = self::PROPERTY_TYPE_STRING;
475
+            }
476
+        }
477
+
478
+        $this->customProperties[$propertyName] = array(
479
+            'value' => $propertyValue,
480
+            'type' => $propertyType
481
+        );
482
+        return $this;
483
+    }
484
+
485
+    /**
486
+     * Implement PHP __clone to create a deep clone, not just a shallow copy.
487
+     */
488
+    public function __clone()
489
+    {
490
+        $vars = get_object_vars($this);
491
+        foreach ($vars as $key => $value) {
492
+            if (is_object($value)) {
493
+                $this->$key = clone $value;
494
+            } else {
495
+                $this->$key = $value;
496
+            }
497
+        }
498
+    }
499
+
500
+    public static function convertProperty($propertyValue, $propertyType)
501
+    {
502
+        switch ($propertyType) {
503
+            case 'empty':     //    Empty
504
+                return '';
505
+                break;
506
+            case 'null':      //    Null
507
+                return null;
508
+                break;
509
+            case 'i1':        //    1-Byte Signed Integer
510
+            case 'i2':        //    2-Byte Signed Integer
511
+            case 'i4':        //    4-Byte Signed Integer
512
+            case 'i8':        //    8-Byte Signed Integer
513
+            case 'int':       //    Integer
514
+                return (int) $propertyValue;
515
+                break;
516
+            case 'ui1':       //    1-Byte Unsigned Integer
517
+            case 'ui2':       //    2-Byte Unsigned Integer
518
+            case 'ui4':       //    4-Byte Unsigned Integer
519
+            case 'ui8':       //    8-Byte Unsigned Integer
520
+            case 'uint':      //    Unsigned Integer
521
+                return abs((int) $propertyValue);
522
+                break;
523
+            case 'r4':        //    4-Byte Real Number
524
+            case 'r8':        //    8-Byte Real Number
525
+            case 'decimal':   //    Decimal
526
+                return (float) $propertyValue;
527
+                break;
528
+            case 'lpstr':     //    LPSTR
529
+            case 'lpwstr':    //    LPWSTR
530
+            case 'bstr':      //    Basic String
531
+                return $propertyValue;
532
+                break;
533
+            case 'date':      //    Date and Time
534
+            case 'filetime':  //    File Time
535
+                return strtotime($propertyValue);
536
+                break;
537
+            case 'bool':     //    Boolean
538
+                return ($propertyValue == 'true') ? true : false;
539
+                break;
540
+            case 'cy':       //    Currency
541
+            case 'error':    //    Error Status Code
542
+            case 'vector':   //    Vector
543
+            case 'array':    //    Array
544
+            case 'blob':     //    Binary Blob
545
+            case 'oblob':    //    Binary Blob Object
546
+            case 'stream':   //    Binary Stream
547
+            case 'ostream':  //    Binary Stream Object
548
+            case 'storage':  //    Binary Storage
549
+            case 'ostorage': //    Binary Storage Object
550
+            case 'vstream':  //    Binary Versioned Stream
551
+            case 'clsid':    //    Class ID
552
+            case 'cf':       //    Clipboard Data
553
+                return $propertyValue;
554
+                break;
555
+        }
556
+        return $propertyValue;
557
+    }
558
+
559
+    public static function convertPropertyType($propertyType)
560
+    {
561
+        switch ($propertyType) {
562
+            case 'i1':       //    1-Byte Signed Integer
563
+            case 'i2':       //    2-Byte Signed Integer
564
+            case 'i4':       //    4-Byte Signed Integer
565
+            case 'i8':       //    8-Byte Signed Integer
566
+            case 'int':      //    Integer
567
+            case 'ui1':      //    1-Byte Unsigned Integer
568
+            case 'ui2':      //    2-Byte Unsigned Integer
569
+            case 'ui4':      //    4-Byte Unsigned Integer
570
+            case 'ui8':      //    8-Byte Unsigned Integer
571
+            case 'uint':     //    Unsigned Integer
572
+                return self::PROPERTY_TYPE_INTEGER;
573
+                break;
574
+            case 'r4':       //    4-Byte Real Number
575
+            case 'r8':       //    8-Byte Real Number
576
+            case 'decimal':  //    Decimal
577
+                return self::PROPERTY_TYPE_FLOAT;
578
+                break;
579
+            case 'empty':    //    Empty
580
+            case 'null':     //    Null
581
+            case 'lpstr':    //    LPSTR
582
+            case 'lpwstr':   //    LPWSTR
583
+            case 'bstr':     //    Basic String
584
+                return self::PROPERTY_TYPE_STRING;
585
+                break;
586
+            case 'date':     //    Date and Time
587
+            case 'filetime': //    File Time
588
+                return self::PROPERTY_TYPE_DATE;
589
+                break;
590
+            case 'bool':     //    Boolean
591
+                return self::PROPERTY_TYPE_BOOLEAN;
592
+                break;
593
+            case 'cy':       //    Currency
594
+            case 'error':    //    Error Status Code
595
+            case 'vector':   //    Vector
596
+            case 'array':    //    Array
597
+            case 'blob':     //    Binary Blob
598
+            case 'oblob':    //    Binary Blob Object
599
+            case 'stream':   //    Binary Stream
600
+            case 'ostream':  //    Binary Stream Object
601
+            case 'storage':  //    Binary Storage
602
+            case 'ostorage': //    Binary Storage Object
603
+            case 'vstream':  //    Binary Versioned Stream
604
+            case 'clsid':    //    Class ID
605
+            case 'cf':       //    Clipboard Data
606
+                return self::PROPERTY_TYPE_UNKNOWN;
607
+                break;
608
+        }
609
+        return self::PROPERTY_TYPE_UNKNOWN;
610
+    }
611
+}

+ 222
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/DocumentSecurity.php View File

@@ -0,0 +1,222 @@
1
+<?php
2
+
3
+/**
4
+ * PHPExcel_DocumentSecurity
5
+ *
6
+ * Copyright (c) 2006 - 2015 PHPExcel
7
+ *
8
+ * This library is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU Lesser General Public
10
+ * License as published by the Free Software Foundation; either
11
+ * version 2.1 of the License, or (at your option) any later version.
12
+ *
13
+ * This library is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
+ * Lesser General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU Lesser General Public
19
+ * License along with this library; if not, write to the Free Software
20
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21
+ *
22
+ * @category   PHPExcel
23
+ * @package    PHPExcel
24
+ * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
25
+ * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
26
+ * @version    ##VERSION##, ##DATE##
27
+ */
28
+class PHPExcel_DocumentSecurity
29
+{
30
+    /**
31
+     * LockRevision
32
+     *
33
+     * @var boolean
34
+     */
35
+    private $lockRevision;
36
+
37
+    /**
38
+     * LockStructure
39
+     *
40
+     * @var boolean
41
+     */
42
+    private $lockStructure;
43
+
44
+    /**
45
+     * LockWindows
46
+     *
47
+     * @var boolean
48
+     */
49
+    private $lockWindows;
50
+
51
+    /**
52
+     * RevisionsPassword
53
+     *
54
+     * @var string
55
+     */
56
+    private $revisionsPassword;
57
+
58
+    /**
59
+     * WorkbookPassword
60
+     *
61
+     * @var string
62
+     */
63
+    private $workbookPassword;
64
+
65
+    /**
66
+     * Create a new PHPExcel_DocumentSecurity
67
+     */
68
+    public function __construct()
69
+    {
70
+        // Initialise values
71
+        $this->lockRevision      = false;
72
+        $this->lockStructure     = false;
73
+        $this->lockWindows       = false;
74
+        $this->revisionsPassword = '';
75
+        $this->workbookPassword  = '';
76
+    }
77
+
78
+    /**
79
+     * Is some sort of document security enabled?
80
+     *
81
+     * @return boolean
82
+     */
83
+    public function isSecurityEnabled()
84
+    {
85
+        return  $this->lockRevision ||
86
+                $this->lockStructure ||
87
+                $this->lockWindows;
88
+    }
89
+
90
+    /**
91
+     * Get LockRevision
92
+     *
93
+     * @return boolean
94
+     */
95
+    public function getLockRevision()
96
+    {
97
+        return $this->lockRevision;
98
+    }
99
+
100
+    /**
101
+     * Set LockRevision
102
+     *
103
+     * @param boolean $pValue
104
+     * @return PHPExcel_DocumentSecurity
105
+     */
106
+    public function setLockRevision($pValue = false)
107
+    {
108
+        $this->lockRevision = $pValue;
109
+        return $this;
110
+    }
111
+
112
+    /**
113
+     * Get LockStructure
114
+     *
115
+     * @return boolean
116
+     */
117
+    public function getLockStructure()
118
+    {
119
+        return $this->lockStructure;
120
+    }
121
+
122
+    /**
123
+     * Set LockStructure
124
+     *
125
+     * @param boolean $pValue
126
+     * @return PHPExcel_DocumentSecurity
127
+     */
128
+    public function setLockStructure($pValue = false)
129
+    {
130
+        $this->lockStructure = $pValue;
131
+        return $this;
132
+    }
133
+
134
+    /**
135
+     * Get LockWindows
136
+     *
137
+     * @return boolean
138
+     */
139
+    public function getLockWindows()
140
+    {
141
+        return $this->lockWindows;
142
+    }
143
+
144
+    /**
145
+     * Set LockWindows
146
+     *
147
+     * @param boolean $pValue
148
+     * @return PHPExcel_DocumentSecurity
149
+     */
150
+    public function setLockWindows($pValue = false)
151
+    {
152
+        $this->lockWindows = $pValue;
153
+        return $this;
154
+    }
155
+
156
+    /**
157
+     * Get RevisionsPassword (hashed)
158
+     *
159
+     * @return string
160
+     */
161
+    public function getRevisionsPassword()
162
+    {
163
+        return $this->revisionsPassword;
164
+    }
165
+
166
+    /**
167
+     * Set RevisionsPassword
168
+     *
169
+     * @param string     $pValue
170
+     * @param boolean     $pAlreadyHashed If the password has already been hashed, set this to true
171
+     * @return PHPExcel_DocumentSecurity
172
+     */
173
+    public function setRevisionsPassword($pValue = '', $pAlreadyHashed = false)
174
+    {
175
+        if (!$pAlreadyHashed) {
176
+            $pValue = PHPExcel_Shared_PasswordHasher::hashPassword($pValue);
177
+        }
178
+        $this->revisionsPassword = $pValue;
179
+        return $this;
180
+    }
181
+
182
+    /**
183
+     * Get WorkbookPassword (hashed)
184
+     *
185
+     * @return string
186
+     */
187
+    public function getWorkbookPassword()
188
+    {
189
+        return $this->workbookPassword;
190
+    }
191
+
192
+    /**
193
+     * Set WorkbookPassword
194
+     *
195
+     * @param string     $pValue
196
+     * @param boolean     $pAlreadyHashed If the password has already been hashed, set this to true
197
+     * @return PHPExcel_DocumentSecurity
198
+     */
199
+    public function setWorkbookPassword($pValue = '', $pAlreadyHashed = false)
200
+    {
201
+        if (!$pAlreadyHashed) {
202
+            $pValue = PHPExcel_Shared_PasswordHasher::hashPassword($pValue);
203
+        }
204
+        $this->workbookPassword = $pValue;
205
+        return $this;
206
+    }
207
+
208
+    /**
209
+     * Implement PHP __clone to create a deep clone, not just a shallow copy.
210
+     */
211
+    public function __clone()
212
+    {
213
+        $vars = get_object_vars($this);
214
+        foreach ($vars as $key => $value) {
215
+            if (is_object($value)) {
216
+                $this->$key = clone $value;
217
+            } else {
218
+                $this->$key = $value;
219
+            }
220
+        }
221
+    }
222
+}

+ 54
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/Exception.php View File

@@ -0,0 +1,54 @@
1
+<?php
2
+/**
3
+ * PHPExcel
4
+ *
5
+ * Copyright (c) 2006 - 2015 PHPExcel
6
+ *
7
+ * This library is free software; you can redistribute it and/or
8
+ * modify it under the terms of the GNU Lesser General Public
9
+ * License as published by the Free Software Foundation; either
10
+ * version 2.1 of the License, or (at your option) any later version.
11
+ *
12
+ * This library is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
+ * Lesser General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU Lesser General Public
18
+ * License along with this library; if not, write to the Free Software
19
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
20
+ *
21
+ * @category   PHPExcel
22
+ * @package    PHPExcel
23
+ * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
24
+ * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
25
+ * @version    ##VERSION##, ##DATE##
26
+ */
27
+
28
+
29
+/**
30
+ * PHPExcel_Exception
31
+ *
32
+ * @category   PHPExcel
33
+ * @package    PHPExcel
34
+ * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
35
+ */
36
+class PHPExcel_Exception extends Exception
37
+{
38
+    /**
39
+     * Error handler callback
40
+     *
41
+     * @param mixed $code
42
+     * @param mixed $string
43
+     * @param mixed $file
44
+     * @param mixed $line
45
+     * @param mixed $context
46
+     */
47
+    public static function errorHandlerCallback($code, $string, $file, $line, $context)
48
+    {
49
+        $e = new self($string, $code);
50
+        $e->line = $line;
51
+        $e->file = $file;
52
+        throw $e;
53
+    }
54
+}

+ 204
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/HashTable.php View File

@@ -0,0 +1,204 @@
1
+<?php
2
+
3
+/**
4
+ * PHPExcel_HashTable
5
+ *
6
+ * Copyright (c) 2006 - 2015 PHPExcel
7
+ *
8
+ * This library is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU Lesser General Public
10
+ * License as published by the Free Software Foundation; either
11
+ * version 2.1 of the License, or (at your option) any later version.
12
+ *
13
+ * This library is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
+ * Lesser General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU Lesser General Public
19
+ * License along with this library; if not, write to the Free Software
20
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21
+ *
22
+ * @category   PHPExcel
23
+ * @package    PHPExcel
24
+ * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
25
+ * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
26
+ * @version    ##VERSION##, ##DATE##
27
+ */
28
+class PHPExcel_HashTable
29
+{
30
+    /**
31
+     * HashTable elements
32
+     *
33
+     * @var array
34
+     */
35
+    protected $items = array();
36
+
37
+    /**
38
+     * HashTable key map
39
+     *
40
+     * @var array
41
+     */
42
+    protected $keyMap = array();
43
+
44
+    /**
45
+     * Create a new PHPExcel_HashTable
46
+     *
47
+     * @param    PHPExcel_IComparable[] $pSource    Optional source array to create HashTable from
48
+     * @throws    PHPExcel_Exception
49
+     */
50
+    public function __construct($pSource = null)
51
+    {
52
+        if ($pSource !== null) {
53
+            // Create HashTable
54
+            $this->addFromSource($pSource);
55
+        }
56
+    }
57
+
58
+    /**
59
+     * Add HashTable items from source
60
+     *
61
+     * @param    PHPExcel_IComparable[] $pSource    Source array to create HashTable from
62
+     * @throws    PHPExcel_Exception
63
+     */
64
+    public function addFromSource($pSource = null)
65
+    {
66
+        // Check if an array was passed
67
+        if ($pSource == null) {
68
+            return;
69
+        } elseif (!is_array($pSource)) {
70
+            throw new PHPExcel_Exception('Invalid array parameter passed.');
71
+        }
72
+
73
+        foreach ($pSource as $item) {
74
+            $this->add($item);
75
+        }
76
+    }
77
+
78
+    /**
79
+     * Add HashTable item
80
+     *
81
+     * @param    PHPExcel_IComparable $pSource    Item to add
82
+     * @throws    PHPExcel_Exception
83
+     */
84
+    public function add(PHPExcel_IComparable $pSource = null)
85
+    {
86
+        $hash = $pSource->getHashCode();
87
+        if (!isset($this->items[$hash])) {
88
+            $this->items[$hash] = $pSource;
89
+            $this->keyMap[count($this->items) - 1] = $hash;
90
+        }
91
+    }
92
+
93
+    /**
94
+     * Remove HashTable item
95
+     *
96
+     * @param    PHPExcel_IComparable $pSource    Item to remove
97
+     * @throws    PHPExcel_Exception
98
+     */
99
+    public function remove(PHPExcel_IComparable $pSource = null)
100
+    {
101
+        $hash = $pSource->getHashCode();
102
+        if (isset($this->items[$hash])) {
103
+            unset($this->items[$hash]);
104
+
105
+            $deleteKey = -1;
106
+            foreach ($this->keyMap as $key => $value) {
107
+                if ($deleteKey >= 0) {
108
+                    $this->keyMap[$key - 1] = $value;
109
+                }
110
+
111
+                if ($value == $hash) {
112
+                    $deleteKey = $key;
113
+                }
114
+            }
115
+            unset($this->keyMap[count($this->keyMap) - 1]);
116
+        }
117
+    }
118
+
119
+    /**
120
+     * Clear HashTable
121
+     *
122
+     */
123
+    public function clear()
124
+    {
125
+        $this->items = array();
126
+        $this->keyMap = array();
127
+    }
128
+
129
+    /**
130
+     * Count
131
+     *
132
+     * @return int
133
+     */
134
+    public function count()
135
+    {
136
+        return count($this->items);
137
+    }
138
+
139
+    /**
140
+     * Get index for hash code
141
+     *
142
+     * @param    string    $pHashCode
143
+     * @return    int    Index
144
+     */
145
+    public function getIndexForHashCode($pHashCode = '')
146
+    {
147
+        return array_search($pHashCode, $this->keyMap);
148
+    }
149
+
150
+    /**
151
+     * Get by index
152
+     *
153
+     * @param    int    $pIndex
154
+     * @return    PHPExcel_IComparable
155
+     *
156
+     */
157
+    public function getByIndex($pIndex = 0)
158
+    {
159
+        if (isset($this->keyMap[$pIndex])) {
160
+            return $this->getByHashCode($this->keyMap[$pIndex]);
161
+        }
162
+
163
+        return null;
164
+    }
165
+
166
+    /**
167
+     * Get by hashcode
168
+     *
169
+     * @param    string    $pHashCode
170
+     * @return    PHPExcel_IComparable
171
+     *
172
+     */
173
+    public function getByHashCode($pHashCode = '')
174
+    {
175
+        if (isset($this->items[$pHashCode])) {
176
+            return $this->items[$pHashCode];
177
+        }
178
+
179
+        return null;
180
+    }
181
+
182
+    /**
183
+     * HashTable to array
184
+     *
185
+     * @return PHPExcel_IComparable[]
186
+     */
187
+    public function toArray()
188
+    {
189
+        return $this->items;
190
+    }
191
+
192
+    /**
193
+     * Implement PHP __clone to create a deep clone, not just a shallow copy.
194
+     */
195
+    public function __clone()
196
+    {
197
+        $vars = get_object_vars($this);
198
+        foreach ($vars as $key => $value) {
199
+            if (is_object($value)) {
200
+                $this->$key = clone $value;
201
+            }
202
+        }
203
+    }
204
+}

+ 808
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/Helper/HTML.php View File

@@ -0,0 +1,808 @@
1
+<?php
2
+
3
+class PHPExcel_Helper_HTML
4
+{
5
+    protected static $colourMap = array(
6
+        'aliceblue' => 'f0f8ff',
7
+        'antiquewhite' => 'faebd7',
8
+        'antiquewhite1' => 'ffefdb',
9
+        'antiquewhite2' => 'eedfcc',
10
+        'antiquewhite3' => 'cdc0b0',
11
+        'antiquewhite4' => '8b8378',
12
+        'aqua' => '00ffff',
13
+        'aquamarine1' => '7fffd4',
14
+        'aquamarine2' => '76eec6',
15
+        'aquamarine4' => '458b74',
16
+        'azure1' => 'f0ffff',
17
+        'azure2' => 'e0eeee',
18
+        'azure3' => 'c1cdcd',
19
+        'azure4' => '838b8b',
20
+        'beige' => 'f5f5dc',
21
+        'bisque1' => 'ffe4c4',
22
+        'bisque2' => 'eed5b7',
23
+        'bisque3' => 'cdb79e',
24
+        'bisque4' => '8b7d6b',
25
+        'black' => '000000',
26
+        'blanchedalmond' => 'ffebcd',
27
+        'blue' => '0000ff',
28
+        'blue1' => '0000ff',
29
+        'blue2' => '0000ee',
30
+        'blue4' => '00008b',
31
+        'blueviolet' => '8a2be2',
32
+        'brown' => 'a52a2a',
33
+        'brown1' => 'ff4040',
34
+        'brown2' => 'ee3b3b',
35
+        'brown3' => 'cd3333',
36
+        'brown4' => '8b2323',
37
+        'burlywood' => 'deb887',
38
+        'burlywood1' => 'ffd39b',
39
+        'burlywood2' => 'eec591',
40
+        'burlywood3' => 'cdaa7d',
41
+        'burlywood4' => '8b7355',
42
+        'cadetblue' => '5f9ea0',
43
+        'cadetblue1' => '98f5ff',
44
+        'cadetblue2' => '8ee5ee',
45
+        'cadetblue3' => '7ac5cd',
46
+        'cadetblue4' => '53868b',
47
+        'chartreuse1' => '7fff00',
48
+        'chartreuse2' => '76ee00',
49
+        'chartreuse3' => '66cd00',
50
+        'chartreuse4' => '458b00',
51
+        'chocolate' => 'd2691e',
52
+        'chocolate1' => 'ff7f24',
53
+        'chocolate2' => 'ee7621',
54
+        'chocolate3' => 'cd661d',
55
+        'coral' => 'ff7f50',
56
+        'coral1' => 'ff7256',
57
+        'coral2' => 'ee6a50',
58
+        'coral3' => 'cd5b45',
59
+        'coral4' => '8b3e2f',
60
+        'cornflowerblue' => '6495ed',
61
+        'cornsilk1' => 'fff8dc',
62
+        'cornsilk2' => 'eee8cd',
63
+        'cornsilk3' => 'cdc8b1',
64
+        'cornsilk4' => '8b8878',
65
+        'cyan1' => '00ffff',
66
+        'cyan2' => '00eeee',
67
+        'cyan3' => '00cdcd',
68
+        'cyan4' => '008b8b',
69
+        'darkgoldenrod' => 'b8860b',
70
+        'darkgoldenrod1' => 'ffb90f',
71
+        'darkgoldenrod2' => 'eead0e',
72
+        'darkgoldenrod3' => 'cd950c',
73
+        'darkgoldenrod4' => '8b6508',
74
+        'darkgreen' => '006400',
75
+        'darkkhaki' => 'bdb76b',
76
+        'darkolivegreen' => '556b2f',
77
+        'darkolivegreen1' => 'caff70',
78
+        'darkolivegreen2' => 'bcee68',
79
+        'darkolivegreen3' => 'a2cd5a',
80
+        'darkolivegreen4' => '6e8b3d',
81
+        'darkorange' => 'ff8c00',
82
+        'darkorange1' => 'ff7f00',
83
+        'darkorange2' => 'ee7600',
84
+        'darkorange3' => 'cd6600',
85
+        'darkorange4' => '8b4500',
86
+        'darkorchid' => '9932cc',
87
+        'darkorchid1' => 'bf3eff',
88
+        'darkorchid2' => 'b23aee',
89
+        'darkorchid3' => '9a32cd',
90
+        'darkorchid4' => '68228b',
91
+        'darksalmon' => 'e9967a',
92
+        'darkseagreen' => '8fbc8f',
93
+        'darkseagreen1' => 'c1ffc1',
94
+        'darkseagreen2' => 'b4eeb4',
95
+        'darkseagreen3' => '9bcd9b',
96
+        'darkseagreen4' => '698b69',
97
+        'darkslateblue' => '483d8b',
98
+        'darkslategray' => '2f4f4f',
99
+        'darkslategray1' => '97ffff',
100
+        'darkslategray2' => '8deeee',
101
+        'darkslategray3' => '79cdcd',
102
+        'darkslategray4' => '528b8b',
103
+        'darkturquoise' => '00ced1',
104
+        'darkviolet' => '9400d3',
105
+        'deeppink1' => 'ff1493',
106
+        'deeppink2' => 'ee1289',
107
+        'deeppink3' => 'cd1076',
108
+        'deeppink4' => '8b0a50',
109
+        'deepskyblue1' => '00bfff',
110
+        'deepskyblue2' => '00b2ee',
111
+        'deepskyblue3' => '009acd',
112
+        'deepskyblue4' => '00688b',
113
+        'dimgray' => '696969',
114
+        'dodgerblue1' => '1e90ff',
115
+        'dodgerblue2' => '1c86ee',
116
+        'dodgerblue3' => '1874cd',
117
+        'dodgerblue4' => '104e8b',
118
+        'firebrick' => 'b22222',
119
+        'firebrick1' => 'ff3030',
120
+        'firebrick2' => 'ee2c2c',
121
+        'firebrick3' => 'cd2626',
122
+        'firebrick4' => '8b1a1a',
123
+        'floralwhite' => 'fffaf0',
124
+        'forestgreen' => '228b22',
125
+        'fuchsia' => 'ff00ff',
126
+        'gainsboro' => 'dcdcdc',
127
+        'ghostwhite' => 'f8f8ff',
128
+        'gold1' => 'ffd700',
129
+        'gold2' => 'eec900',
130
+        'gold3' => 'cdad00',
131
+        'gold4' => '8b7500',
132
+        'goldenrod' => 'daa520',
133
+        'goldenrod1' => 'ffc125',
134
+        'goldenrod2' => 'eeb422',
135
+        'goldenrod3' => 'cd9b1d',
136
+        'goldenrod4' => '8b6914',
137
+        'gray' => 'bebebe',
138
+        'gray1' => '030303',
139
+        'gray10' => '1a1a1a',
140
+        'gray11' => '1c1c1c',
141
+        'gray12' => '1f1f1f',
142
+        'gray13' => '212121',
143
+        'gray14' => '242424',
144
+        'gray15' => '262626',
145
+        'gray16' => '292929',
146
+        'gray17' => '2b2b2b',
147
+        'gray18' => '2e2e2e',
148
+        'gray19' => '303030',
149
+        'gray2' => '050505',
150
+        'gray20' => '333333',
151
+        'gray21' => '363636',
152
+        'gray22' => '383838',
153
+        'gray23' => '3b3b3b',
154
+        'gray24' => '3d3d3d',
155
+        'gray25' => '404040',
156
+        'gray26' => '424242',
157
+        'gray27' => '454545',
158
+        'gray28' => '474747',
159
+        'gray29' => '4a4a4a',
160
+        'gray3' => '080808',
161
+        'gray30' => '4d4d4d',
162
+        'gray31' => '4f4f4f',
163
+        'gray32' => '525252',
164
+        'gray33' => '545454',
165
+        'gray34' => '575757',
166
+        'gray35' => '595959',
167
+        'gray36' => '5c5c5c',
168
+        'gray37' => '5e5e5e',
169
+        'gray38' => '616161',
170
+        'gray39' => '636363',
171
+        'gray4' => '0a0a0a',
172
+        'gray40' => '666666',
173
+        'gray41' => '696969',
174
+        'gray42' => '6b6b6b',
175
+        'gray43' => '6e6e6e',
176
+        'gray44' => '707070',
177
+        'gray45' => '737373',
178
+        'gray46' => '757575',
179
+        'gray47' => '787878',
180
+        'gray48' => '7a7a7a',
181
+        'gray49' => '7d7d7d',
182
+        'gray5' => '0d0d0d',
183
+        'gray50' => '7f7f7f',
184
+        'gray51' => '828282',
185
+        'gray52' => '858585',
186
+        'gray53' => '878787',
187
+        'gray54' => '8a8a8a',
188
+        'gray55' => '8c8c8c',
189
+        'gray56' => '8f8f8f',
190
+        'gray57' => '919191',
191
+        'gray58' => '949494',
192
+        'gray59' => '969696',
193
+        'gray6' => '0f0f0f',
194
+        'gray60' => '999999',
195
+        'gray61' => '9c9c9c',
196
+        'gray62' => '9e9e9e',
197
+        'gray63' => 'a1a1a1',
198
+        'gray64' => 'a3a3a3',
199
+        'gray65' => 'a6a6a6',
200
+        'gray66' => 'a8a8a8',
201
+        'gray67' => 'ababab',
202
+        'gray68' => 'adadad',
203
+        'gray69' => 'b0b0b0',
204
+        'gray7' => '121212',
205
+        'gray70' => 'b3b3b3',
206
+        'gray71' => 'b5b5b5',
207
+        'gray72' => 'b8b8b8',
208
+        'gray73' => 'bababa',
209
+        'gray74' => 'bdbdbd',
210
+        'gray75' => 'bfbfbf',
211
+        'gray76' => 'c2c2c2',
212
+        'gray77' => 'c4c4c4',
213
+        'gray78' => 'c7c7c7',
214
+        'gray79' => 'c9c9c9',
215
+        'gray8' => '141414',
216
+        'gray80' => 'cccccc',
217
+        'gray81' => 'cfcfcf',
218
+        'gray82' => 'd1d1d1',
219
+        'gray83' => 'd4d4d4',
220
+        'gray84' => 'd6d6d6',
221
+        'gray85' => 'd9d9d9',
222
+        'gray86' => 'dbdbdb',
223
+        'gray87' => 'dedede',
224
+        'gray88' => 'e0e0e0',
225
+        'gray89' => 'e3e3e3',
226
+        'gray9' => '171717',
227
+        'gray90' => 'e5e5e5',
228
+        'gray91' => 'e8e8e8',
229
+        'gray92' => 'ebebeb',
230
+        'gray93' => 'ededed',
231
+        'gray94' => 'f0f0f0',
232
+        'gray95' => 'f2f2f2',
233
+        'gray97' => 'f7f7f7',
234
+        'gray98' => 'fafafa',
235
+        'gray99' => 'fcfcfc',
236
+        'green' => '00ff00',
237
+        'green1' => '00ff00',
238
+        'green2' => '00ee00',
239
+        'green3' => '00cd00',
240
+        'green4' => '008b00',
241
+        'greenyellow' => 'adff2f',
242
+        'honeydew1' => 'f0fff0',
243
+        'honeydew2' => 'e0eee0',
244
+        'honeydew3' => 'c1cdc1',
245
+        'honeydew4' => '838b83',
246
+        'hotpink' => 'ff69b4',
247
+        'hotpink1' => 'ff6eb4',
248
+        'hotpink2' => 'ee6aa7',
249
+        'hotpink3' => 'cd6090',
250
+        'hotpink4' => '8b3a62',
251
+        'indianred' => 'cd5c5c',
252
+        'indianred1' => 'ff6a6a',
253
+        'indianred2' => 'ee6363',
254
+        'indianred3' => 'cd5555',
255
+        'indianred4' => '8b3a3a',
256
+        'ivory1' => 'fffff0',
257
+        'ivory2' => 'eeeee0',
258
+        'ivory3' => 'cdcdc1',
259
+        'ivory4' => '8b8b83',
260
+        'khaki' => 'f0e68c',
261
+        'khaki1' => 'fff68f',
262
+        'khaki2' => 'eee685',
263
+        'khaki3' => 'cdc673',
264
+        'khaki4' => '8b864e',
265
+        'lavender' => 'e6e6fa',
266
+        'lavenderblush1' => 'fff0f5',
267
+        'lavenderblush2' => 'eee0e5',
268
+        'lavenderblush3' => 'cdc1c5',
269
+        'lavenderblush4' => '8b8386',
270
+        'lawngreen' => '7cfc00',
271
+        'lemonchiffon1' => 'fffacd',
272
+        'lemonchiffon2' => 'eee9bf',
273
+        'lemonchiffon3' => 'cdc9a5',
274
+        'lemonchiffon4' => '8b8970',
275
+        'light' => 'eedd82',
276
+        'lightblue' => 'add8e6',
277
+        'lightblue1' => 'bfefff',
278
+        'lightblue2' => 'b2dfee',
279
+        'lightblue3' => '9ac0cd',
280
+        'lightblue4' => '68838b',
281
+        'lightcoral' => 'f08080',
282
+        'lightcyan1' => 'e0ffff',
283
+        'lightcyan2' => 'd1eeee',
284
+        'lightcyan3' => 'b4cdcd',
285
+        'lightcyan4' => '7a8b8b',
286
+        'lightgoldenrod1' => 'ffec8b',
287
+        'lightgoldenrod2' => 'eedc82',
288
+        'lightgoldenrod3' => 'cdbe70',
289
+        'lightgoldenrod4' => '8b814c',
290
+        'lightgoldenrodyellow' => 'fafad2',
291
+        'lightgray' => 'd3d3d3',
292
+        'lightpink' => 'ffb6c1',
293
+        'lightpink1' => 'ffaeb9',
294
+        'lightpink2' => 'eea2ad',
295
+        'lightpink3' => 'cd8c95',
296
+        'lightpink4' => '8b5f65',
297
+        'lightsalmon1' => 'ffa07a',
298
+        'lightsalmon2' => 'ee9572',
299
+        'lightsalmon3' => 'cd8162',
300
+        'lightsalmon4' => '8b5742',
301
+        'lightseagreen' => '20b2aa',
302
+        'lightskyblue' => '87cefa',
303
+        'lightskyblue1' => 'b0e2ff',
304
+        'lightskyblue2' => 'a4d3ee',
305
+        'lightskyblue3' => '8db6cd',
306
+        'lightskyblue4' => '607b8b',
307
+        'lightslateblue' => '8470ff',
308
+        'lightslategray' => '778899',
309
+        'lightsteelblue' => 'b0c4de',
310
+        'lightsteelblue1' => 'cae1ff',
311
+        'lightsteelblue2' => 'bcd2ee',
312
+        'lightsteelblue3' => 'a2b5cd',
313
+        'lightsteelblue4' => '6e7b8b',
314
+        'lightyellow1' => 'ffffe0',
315
+        'lightyellow2' => 'eeeed1',
316
+        'lightyellow3' => 'cdcdb4',
317
+        'lightyellow4' => '8b8b7a',
318
+        'lime' => '00ff00',
319
+        'limegreen' => '32cd32',
320
+        'linen' => 'faf0e6',
321
+        'magenta' => 'ff00ff',
322
+        'magenta2' => 'ee00ee',
323
+        'magenta3' => 'cd00cd',
324
+        'magenta4' => '8b008b',
325
+        'maroon' => 'b03060',
326
+        'maroon1' => 'ff34b3',
327
+        'maroon2' => 'ee30a7',
328
+        'maroon3' => 'cd2990',
329
+        'maroon4' => '8b1c62',
330
+        'medium' => '66cdaa',
331
+        'mediumaquamarine' => '66cdaa',
332
+        'mediumblue' => '0000cd',
333
+        'mediumorchid' => 'ba55d3',
334
+        'mediumorchid1' => 'e066ff',
335
+        'mediumorchid2' => 'd15fee',
336
+        'mediumorchid3' => 'b452cd',
337
+        'mediumorchid4' => '7a378b',
338
+        'mediumpurple' => '9370db',
339
+        'mediumpurple1' => 'ab82ff',
340
+        'mediumpurple2' => '9f79ee',
341
+        'mediumpurple3' => '8968cd',
342
+        'mediumpurple4' => '5d478b',
343
+        'mediumseagreen' => '3cb371',
344
+        'mediumslateblue' => '7b68ee',
345
+        'mediumspringgreen' => '00fa9a',
346
+        'mediumturquoise' => '48d1cc',
347
+        'mediumvioletred' => 'c71585',
348
+        'midnightblue' => '191970',
349
+        'mintcream' => 'f5fffa',
350
+        'mistyrose1' => 'ffe4e1',
351
+        'mistyrose2' => 'eed5d2',
352
+        'mistyrose3' => 'cdb7b5',
353
+        'mistyrose4' => '8b7d7b',
354
+        'moccasin' => 'ffe4b5',
355
+        'navajowhite1' => 'ffdead',
356
+        'navajowhite2' => 'eecfa1',
357
+        'navajowhite3' => 'cdb38b',
358
+        'navajowhite4' => '8b795e',
359
+        'navy' => '000080',
360
+        'navyblue' => '000080',
361
+        'oldlace' => 'fdf5e6',
362
+        'olive' => '808000',
363
+        'olivedrab' => '6b8e23',
364
+        'olivedrab1' => 'c0ff3e',
365
+        'olivedrab2' => 'b3ee3a',
366
+        'olivedrab4' => '698b22',
367
+        'orange' => 'ffa500',
368
+        'orange1' => 'ffa500',
369
+        'orange2' => 'ee9a00',
370
+        'orange3' => 'cd8500',
371
+        'orange4' => '8b5a00',
372
+        'orangered1' => 'ff4500',
373
+        'orangered2' => 'ee4000',
374
+        'orangered3' => 'cd3700',
375
+        'orangered4' => '8b2500',
376
+        'orchid' => 'da70d6',
377
+        'orchid1' => 'ff83fa',
378
+        'orchid2' => 'ee7ae9',
379
+        'orchid3' => 'cd69c9',
380
+        'orchid4' => '8b4789',
381
+        'pale' => 'db7093',
382
+        'palegoldenrod' => 'eee8aa',
383
+        'palegreen' => '98fb98',
384
+        'palegreen1' => '9aff9a',
385
+        'palegreen2' => '90ee90',
386
+        'palegreen3' => '7ccd7c',
387
+        'palegreen4' => '548b54',
388
+        'paleturquoise' => 'afeeee',
389
+        'paleturquoise1' => 'bbffff',
390
+        'paleturquoise2' => 'aeeeee',
391
+        'paleturquoise3' => '96cdcd',
392
+        'paleturquoise4' => '668b8b',
393
+        'palevioletred' => 'db7093',
394
+        'palevioletred1' => 'ff82ab',
395
+        'palevioletred2' => 'ee799f',
396
+        'palevioletred3' => 'cd6889',
397
+        'palevioletred4' => '8b475d',
398
+        'papayawhip' => 'ffefd5',
399
+        'peachpuff1' => 'ffdab9',
400
+        'peachpuff2' => 'eecbad',
401
+        'peachpuff3' => 'cdaf95',
402
+        'peachpuff4' => '8b7765',
403
+        'pink' => 'ffc0cb',
404
+        'pink1' => 'ffb5c5',
405
+        'pink2' => 'eea9b8',
406
+        'pink3' => 'cd919e',
407
+        'pink4' => '8b636c',
408
+        'plum' => 'dda0dd',
409
+        'plum1' => 'ffbbff',
410
+        'plum2' => 'eeaeee',
411
+        'plum3' => 'cd96cd',
412
+        'plum4' => '8b668b',
413
+        'powderblue' => 'b0e0e6',
414
+        'purple' => 'a020f0',
415
+        'rebeccapurple' => '663399',
416
+        'purple1' => '9b30ff',
417
+        'purple2' => '912cee',
418
+        'purple3' => '7d26cd',
419
+        'purple4' => '551a8b',
420
+        'red' => 'ff0000',
421
+        'red1' => 'ff0000',
422
+        'red2' => 'ee0000',
423
+        'red3' => 'cd0000',
424
+        'red4' => '8b0000',
425
+        'rosybrown' => 'bc8f8f',
426
+        'rosybrown1' => 'ffc1c1',
427
+        'rosybrown2' => 'eeb4b4',
428
+        'rosybrown3' => 'cd9b9b',
429
+        'rosybrown4' => '8b6969',
430
+        'royalblue' => '4169e1',
431
+        'royalblue1' => '4876ff',
432
+        'royalblue2' => '436eee',
433
+        'royalblue3' => '3a5fcd',
434
+        'royalblue4' => '27408b',
435
+        'saddlebrown' => '8b4513',
436
+        'salmon' => 'fa8072',
437
+        'salmon1' => 'ff8c69',
438
+        'salmon2' => 'ee8262',
439
+        'salmon3' => 'cd7054',
440
+        'salmon4' => '8b4c39',
441
+        'sandybrown' => 'f4a460',
442
+        'seagreen1' => '54ff9f',
443
+        'seagreen2' => '4eee94',
444
+        'seagreen3' => '43cd80',
445
+        'seagreen4' => '2e8b57',
446
+        'seashell1' => 'fff5ee',
447
+        'seashell2' => 'eee5de',
448
+        'seashell3' => 'cdc5bf',
449
+        'seashell4' => '8b8682',
450
+        'sienna' => 'a0522d',
451
+        'sienna1' => 'ff8247',
452
+        'sienna2' => 'ee7942',
453
+        'sienna3' => 'cd6839',
454
+        'sienna4' => '8b4726',
455
+        'silver' => 'c0c0c0',
456
+        'skyblue' => '87ceeb',
457
+        'skyblue1' => '87ceff',
458
+        'skyblue2' => '7ec0ee',
459
+        'skyblue3' => '6ca6cd',
460
+        'skyblue4' => '4a708b',
461
+        'slateblue' => '6a5acd',
462
+        'slateblue1' => '836fff',
463
+        'slateblue2' => '7a67ee',
464
+        'slateblue3' => '6959cd',
465
+        'slateblue4' => '473c8b',
466
+        'slategray' => '708090',
467
+        'slategray1' => 'c6e2ff',
468
+        'slategray2' => 'b9d3ee',
469
+        'slategray3' => '9fb6cd',
470
+        'slategray4' => '6c7b8b',
471
+        'snow1' => 'fffafa',
472
+        'snow2' => 'eee9e9',
473
+        'snow3' => 'cdc9c9',
474
+        'snow4' => '8b8989',
475
+        'springgreen1' => '00ff7f',
476
+        'springgreen2' => '00ee76',
477
+        'springgreen3' => '00cd66',
478
+        'springgreen4' => '008b45',
479
+        'steelblue' => '4682b4',
480
+        'steelblue1' => '63b8ff',
481
+        'steelblue2' => '5cacee',
482
+        'steelblue3' => '4f94cd',
483
+        'steelblue4' => '36648b',
484
+        'tan' => 'd2b48c',
485
+        'tan1' => 'ffa54f',
486
+        'tan2' => 'ee9a49',
487
+        'tan3' => 'cd853f',
488
+        'tan4' => '8b5a2b',
489
+        'teal' => '008080',
490
+        'thistle' => 'd8bfd8',
491
+        'thistle1' => 'ffe1ff',
492
+        'thistle2' => 'eed2ee',
493
+        'thistle3' => 'cdb5cd',
494
+        'thistle4' => '8b7b8b',
495
+        'tomato1' => 'ff6347',
496
+        'tomato2' => 'ee5c42',
497
+        'tomato3' => 'cd4f39',
498
+        'tomato4' => '8b3626',
499
+        'turquoise' => '40e0d0',
500
+        'turquoise1' => '00f5ff',
501
+        'turquoise2' => '00e5ee',
502
+        'turquoise3' => '00c5cd',
503
+        'turquoise4' => '00868b',
504
+        'violet' => 'ee82ee',
505
+        'violetred' => 'd02090',
506
+        'violetred1' => 'ff3e96',
507
+        'violetred2' => 'ee3a8c',
508
+        'violetred3' => 'cd3278',
509
+        'violetred4' => '8b2252',
510
+        'wheat' => 'f5deb3',
511
+        'wheat1' => 'ffe7ba',
512
+        'wheat2' => 'eed8ae',
513
+        'wheat3' => 'cdba96',
514
+        'wheat4' => '8b7e66',
515
+        'white' => 'ffffff',
516
+        'whitesmoke' => 'f5f5f5',
517
+        'yellow' => 'ffff00',
518
+        'yellow1' => 'ffff00',
519
+        'yellow2' => 'eeee00',
520
+        'yellow3' => 'cdcd00',
521
+        'yellow4' => '8b8b00',
522
+        'yellowgreen' => '9acd32',
523
+    );
524
+
525
+    protected $face;
526
+    protected $size;
527
+    protected $color;
528
+
529
+    protected $bold = false;
530
+    protected $italic = false;
531
+    protected $underline = false;
532
+    protected $superscript = false;
533
+    protected $subscript = false;
534
+    protected $strikethrough = false;
535
+
536
+    protected $startTagCallbacks = array(
537
+        'font' => 'startFontTag',
538
+        'b' => 'startBoldTag',
539
+        'strong' => 'startBoldTag',
540
+        'i' => 'startItalicTag',
541
+        'em' => 'startItalicTag',
542
+        'u' => 'startUnderlineTag',
543
+        'ins' => 'startUnderlineTag',
544
+        'del' => 'startStrikethruTag',
545
+        'sup' => 'startSuperscriptTag',
546
+        'sub' => 'startSubscriptTag',
547
+    );
548
+
549
+    protected $endTagCallbacks = array(
550
+        'font' => 'endFontTag',
551
+        'b' => 'endBoldTag',
552
+        'strong' => 'endBoldTag',
553
+        'i' => 'endItalicTag',
554
+        'em' => 'endItalicTag',
555
+        'u' => 'endUnderlineTag',
556
+        'ins' => 'endUnderlineTag',
557
+        'del' => 'endStrikethruTag',
558
+        'sup' => 'endSuperscriptTag',
559
+        'sub' => 'endSubscriptTag',
560
+        'br' => 'breakTag',
561
+        'p' => 'breakTag',
562
+        'h1' => 'breakTag',
563
+        'h2' => 'breakTag',
564
+        'h3' => 'breakTag',
565
+        'h4' => 'breakTag',
566
+        'h5' => 'breakTag',
567
+        'h6' => 'breakTag',
568
+    );
569
+
570
+    protected $stack = array();
571
+
572
+    protected $stringData = '';
573
+
574
+    protected $richTextObject;
575
+
576
+    protected function initialise()
577
+    {
578
+        $this->face = $this->size = $this->color = null;
579
+        $this->bold = $this->italic = $this->underline = $this->superscript = $this->subscript = $this->strikethrough = false;
580
+
581
+        $this->stack = array();
582
+
583
+        $this->stringData = '';
584
+    }
585
+
586
+    public function toRichTextObject($html)
587
+    {
588
+        $this->initialise();
589
+
590
+        //  Create a new DOM object
591
+        $dom = new \DOMDocument;
592
+        //  Load the HTML file into the DOM object
593
+        //  Note the use of error suppression, because typically this will be an html fragment, so not fully valid markup
594
+        $loaded = @$dom->loadHTML($html);
595
+
596
+        //  Discard excess white space
597
+        $dom->preserveWhiteSpace = false;
598
+
599
+        $this->richTextObject = new PHPExcel_RichText();;
600
+        $this->parseElements($dom);
601
+
602
+        // Clean any further spurious whitespace
603
+        $this->cleanWhitespace();
604
+
605
+        return $this->richTextObject;
606
+    }
607
+
608
+    protected function cleanWhitespace()
609
+    {
610
+        foreach ($this->richTextObject->getRichTextElements() as $key => $element) {
611
+            $text = $element->getText();
612
+            // Trim any leading spaces on the first run
613
+            if ($key == 0) {
614
+                $text = ltrim($text);
615
+            }
616
+            // Trim any spaces immediately after a line break
617
+            $text = preg_replace('/\n */mu', "\n", $text);
618
+            $element->setText($text);
619
+        }
620
+    }
621
+
622
+    protected function buildTextRun()
623
+    {
624
+        $text = $this->stringData;
625
+        if (trim($text) === '') {
626
+            return;
627
+        }
628
+
629
+        $richtextRun = $this->richTextObject->createTextRun($this->stringData);
630
+        if ($this->face) {
631
+            $richtextRun->getFont()->setName($this->face);
632
+        }
633
+        if ($this->size) {
634
+            $richtextRun->getFont()->setSize($this->size);
635
+        }
636
+        if ($this->color) {
637
+            $richtextRun->getFont()->setColor(new PHPExcel_Style_Color('ff' . $this->color));
638
+        }
639
+        if ($this->bold) {
640
+            $richtextRun->getFont()->setBold(true);
641
+        }
642
+        if ($this->italic) {
643
+            $richtextRun->getFont()->setItalic(true);
644
+        }
645
+        if ($this->underline) {
646
+            $richtextRun->getFont()->setUnderline(PHPExcel_Style_Font::UNDERLINE_SINGLE);
647
+        }
648
+        if ($this->superscript) {
649
+            $richtextRun->getFont()->setSuperScript(true);
650
+        }
651
+        if ($this->subscript) {
652
+            $richtextRun->getFont()->setSubScript(true);
653
+        }
654
+        if ($this->strikethrough) {
655
+            $richtextRun->getFont()->setStrikethrough(true);
656
+        }
657
+        $this->stringData = '';
658
+    }
659
+
660
+    protected function rgbToColour($rgb)
661
+    {
662
+        preg_match_all('/\d+/', $rgb, $values);
663
+        foreach ($values[0] as &$value) {
664
+            $value = str_pad(dechex($value), 2, '0', STR_PAD_LEFT);
665
+        }
666
+        return implode($values[0]);
667
+    }
668
+
669
+    protected function colourNameLookup($rgb)
670
+    {
671
+        return self::$colourMap[$rgb];
672
+    }
673
+
674
+    protected function startFontTag($tag)
675
+    {
676
+        foreach ($tag->attributes as $attribute) {
677
+            $attributeName = strtolower($attribute->name);
678
+            $attributeValue = $attribute->value;
679
+
680
+            if ($attributeName == 'color') {
681
+                if (preg_match('/rgb\s*\(/', $attributeValue)) {
682
+                    $this->$attributeName = $this->rgbToColour($attributeValue);
683
+                } elseif (strpos(trim($attributeValue), '#') === 0) {
684
+                    $this->$attributeName = ltrim($attributeValue, '#');
685
+                } else {
686
+                    $this->$attributeName = $this->colourNameLookup($attributeValue);
687
+                }
688
+            } else {
689
+                $this->$attributeName = $attributeValue;
690
+            }
691
+        }
692
+    }
693
+
694
+    protected function endFontTag()
695
+    {
696
+        $this->face = $this->size = $this->color = null;
697
+    }
698
+
699
+    protected function startBoldTag()
700
+    {
701
+        $this->bold = true;
702
+    }
703
+
704
+    protected function endBoldTag()
705
+    {
706
+        $this->bold = false;
707
+    }
708
+
709
+    protected function startItalicTag()
710
+    {
711
+        $this->italic = true;
712
+    }
713
+
714
+    protected function endItalicTag()
715
+    {
716
+        $this->italic = false;
717
+    }
718
+
719
+    protected function startUnderlineTag()
720
+    {
721
+        $this->underline = true;
722
+    }
723
+
724
+    protected function endUnderlineTag()
725
+    {
726
+        $this->underline = false;
727
+    }
728
+
729
+    protected function startSubscriptTag()
730
+    {
731
+        $this->subscript = true;
732
+    }
733
+
734
+    protected function endSubscriptTag()
735
+    {
736
+        $this->subscript = false;
737
+    }
738
+
739
+    protected function startSuperscriptTag()
740
+    {
741
+        $this->superscript = true;
742
+    }
743
+
744
+    protected function endSuperscriptTag()
745
+    {
746
+        $this->superscript = false;
747
+    }
748
+
749
+    protected function startStrikethruTag()
750
+    {
751
+        $this->strikethrough = true;
752
+    }
753
+
754
+    protected function endStrikethruTag()
755
+    {
756
+        $this->strikethrough = false;
757
+    }
758
+
759
+    protected function breakTag()
760
+    {
761
+        $this->stringData .= "\n";
762
+    }
763
+
764
+    protected function parseTextNode(DOMText $textNode)
765
+    {
766
+        $domText = preg_replace(
767
+            '/\s+/u',
768
+            ' ',
769
+            str_replace(array("\r", "\n"), ' ', $textNode->nodeValue)
770
+        );
771
+        $this->stringData .= $domText;
772
+        $this->buildTextRun();
773
+    }
774
+
775
+    protected function handleCallback($element, $callbackTag, $callbacks)
776
+    {
777
+        if (isset($callbacks[$callbackTag])) {
778
+            $elementHandler = $callbacks[$callbackTag];
779
+            if (method_exists($this, $elementHandler)) {
780
+                call_user_func(array($this, $elementHandler), $element);
781
+            }
782
+        }
783
+    }
784
+
785
+    protected function parseElementNode(DOMElement $element)
786
+    {
787
+        $callbackTag = strtolower($element->nodeName);
788
+        $this->stack[] = $callbackTag;
789
+
790
+        $this->handleCallback($element, $callbackTag, $this->startTagCallbacks);
791
+
792
+        $this->parseElements($element);
793
+        array_pop($this->stack);
794
+
795
+        $this->handleCallback($element, $callbackTag, $this->endTagCallbacks);
796
+    }
797
+
798
+    protected function parseElements(DOMNode $element)
799
+    {
800
+        foreach ($element->childNodes as $child) {
801
+            if ($child instanceof DOMText) {
802
+                $this->parseTextNode($child);
803
+            } elseif ($child instanceof DOMElement) {
804
+                $this->parseElementNode($child);
805
+            }
806
+        }
807
+    }
808
+}

+ 34
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/IComparable.php View File

@@ -0,0 +1,34 @@
1
+<?php
2
+
3
+/**
4
+ * PHPExcel_IComparable
5
+ *
6
+ * This library is free software; you can redistribute it and/or
7
+ * modify it under the terms of the GNU Lesser General Public
8
+ * License as published by the Free Software Foundation; either
9
+ * version 2.1 of the License, or (at your option) any later version.
10
+ *
11
+ * This library is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14
+ * Lesser General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Lesser General Public
17
+ * License along with this library; if not, write to the Free Software
18
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
19
+ *
20
+ * @category   PHPExcel
21
+ * @package    PHPExcel
22
+ * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
23
+ * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
24
+ * @version    ##VERSION##, ##DATE##
25
+ */
26
+interface PHPExcel_IComparable
27
+{
28
+    /**
29
+     * Get hash code
30
+     *
31
+     * @return string    Hash code
32
+     */
33
+    public function getHashCode();
34
+}

+ 289
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/IOFactory.php View File

@@ -0,0 +1,289 @@
1
+<?php
2
+
3
+/**    PHPExcel root directory */
4
+if (!defined('PHPEXCEL_ROOT')) {
5
+    /**
6
+     * @ignore
7
+     */
8
+    define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../');
9
+    require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
10
+}
11
+
12
+/**
13
+ * PHPExcel_IOFactory
14
+ *
15
+ * Copyright (c) 2006 - 2015 PHPExcel
16
+ *
17
+ * This library is free software; you can redistribute it and/or
18
+ * modify it under the terms of the GNU Lesser General Public
19
+ * License as published by the Free Software Foundation; either
20
+ * version 2.1 of the License, or (at your option) any later version.
21
+ *
22
+ * This library is distributed in the hope that it will be useful,
23
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
24
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
25
+ * Lesser General Public License for more details.
26
+ *
27
+ * You should have received a copy of the GNU Lesser General Public
28
+ * License along with this library; if not, write to the Free Software
29
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
30
+ *
31
+ * @category   PHPExcel
32
+ * @package    PHPExcel
33
+ * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
34
+ * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
35
+ * @version    ##VERSION##, ##DATE##
36
+ */
37
+class PHPExcel_IOFactory
38
+{
39
+    /**
40
+     * Search locations
41
+     *
42
+     * @var    array
43
+     * @access    private
44
+     * @static
45
+     */
46
+    private static $searchLocations = array(
47
+        array( 'type' => 'IWriter', 'path' => 'PHPExcel/Writer/{0}.php', 'class' => 'PHPExcel_Writer_{0}' ),
48
+        array( 'type' => 'IReader', 'path' => 'PHPExcel/Reader/{0}.php', 'class' => 'PHPExcel_Reader_{0}' )
49
+    );
50
+
51
+    /**
52
+     * Autoresolve classes
53
+     *
54
+     * @var    array
55
+     * @access    private
56
+     * @static
57
+     */
58
+    private static $autoResolveClasses = array(
59
+        'Excel2007',
60
+        'Excel5',
61
+        'Excel2003XML',
62
+        'OOCalc',
63
+        'SYLK',
64
+        'Gnumeric',
65
+        'HTML',
66
+        'CSV',
67
+    );
68
+
69
+    /**
70
+     *    Private constructor for PHPExcel_IOFactory
71
+     */
72
+    private function __construct()
73
+    {
74
+    }
75
+
76
+    /**
77
+     * Get search locations
78
+     *
79
+     * @static
80
+     * @access    public
81
+     * @return    array
82
+     */
83
+    public static function getSearchLocations()
84
+    {
85
+        return self::$searchLocations;
86
+    }
87
+
88
+    /**
89
+     * Set search locations
90
+     *
91
+     * @static
92
+     * @access    public
93
+     * @param    array $value
94
+     * @throws    PHPExcel_Reader_Exception
95
+     */
96
+    public static function setSearchLocations($value)
97
+    {
98
+        if (is_array($value)) {
99
+            self::$searchLocations = $value;
100
+        } else {
101
+            throw new PHPExcel_Reader_Exception('Invalid parameter passed.');
102
+        }
103
+    }
104
+
105
+    /**
106
+     * Add search location
107
+     *
108
+     * @static
109
+     * @access    public
110
+     * @param    string $type        Example: IWriter
111
+     * @param    string $location    Example: PHPExcel/Writer/{0}.php
112
+     * @param    string $classname     Example: PHPExcel_Writer_{0}
113
+     */
114
+    public static function addSearchLocation($type = '', $location = '', $classname = '')
115
+    {
116
+        self::$searchLocations[] = array( 'type' => $type, 'path' => $location, 'class' => $classname );
117
+    }
118
+
119
+    /**
120
+     * Create PHPExcel_Writer_IWriter
121
+     *
122
+     * @static
123
+     * @access    public
124
+     * @param    PHPExcel $phpExcel
125
+     * @param    string  $writerType    Example: Excel2007
126
+     * @return    PHPExcel_Writer_IWriter
127
+     * @throws    PHPExcel_Reader_Exception
128
+     */
129
+    public static function createWriter(PHPExcel $phpExcel, $writerType = '')
130
+    {
131
+        // Search type
132
+        $searchType = 'IWriter';
133
+
134
+        // Include class
135
+        foreach (self::$searchLocations as $searchLocation) {
136
+            if ($searchLocation['type'] == $searchType) {
137
+                $className = str_replace('{0}', $writerType, $searchLocation['class']);
138
+
139
+                $instance = new $className($phpExcel);
140
+                if ($instance !== null) {
141
+                    return $instance;
142
+                }
143
+            }
144
+        }
145
+
146
+        // Nothing found...
147
+        throw new PHPExcel_Reader_Exception("No $searchType found for type $writerType");
148
+    }
149
+
150
+    /**
151
+     * Create PHPExcel_Reader_IReader
152
+     *
153
+     * @static
154
+     * @access    public
155
+     * @param    string $readerType    Example: Excel2007
156
+     * @return    PHPExcel_Reader_IReader
157
+     * @throws    PHPExcel_Reader_Exception
158
+     */
159
+    public static function createReader($readerType = '')
160
+    {
161
+        // Search type
162
+        $searchType = 'IReader';
163
+
164
+        // Include class
165
+        foreach (self::$searchLocations as $searchLocation) {
166
+            if ($searchLocation['type'] == $searchType) {
167
+                $className = str_replace('{0}', $readerType, $searchLocation['class']);
168
+
169
+                $instance = new $className();
170
+                if ($instance !== null) {
171
+                    return $instance;
172
+                }
173
+            }
174
+        }
175
+
176
+        // Nothing found...
177
+        throw new PHPExcel_Reader_Exception("No $searchType found for type $readerType");
178
+    }
179
+
180
+    /**
181
+     * Loads PHPExcel from file using automatic PHPExcel_Reader_IReader resolution
182
+     *
183
+     * @static
184
+     * @access public
185
+     * @param     string         $pFilename        The name of the spreadsheet file
186
+     * @return    PHPExcel
187
+     * @throws    PHPExcel_Reader_Exception
188
+     */
189
+    public static function load($pFilename)
190
+    {
191
+        $reader = self::createReaderForFile($pFilename);
192
+        return $reader->load($pFilename);
193
+    }
194
+
195
+    /**
196
+     * Identify file type using automatic PHPExcel_Reader_IReader resolution
197
+     *
198
+     * @static
199
+     * @access public
200
+     * @param     string         $pFilename        The name of the spreadsheet file to identify
201
+     * @return    string
202
+     * @throws    PHPExcel_Reader_Exception
203
+     */
204
+    public static function identify($pFilename)
205
+    {
206
+        $reader = self::createReaderForFile($pFilename);
207
+        $className = get_class($reader);
208
+        $classType = explode('_', $className);
209
+        unset($reader);
210
+        return array_pop($classType);
211
+    }
212
+
213
+    /**
214
+     * Create PHPExcel_Reader_IReader for file using automatic PHPExcel_Reader_IReader resolution
215
+     *
216
+     * @static
217
+     * @access    public
218
+     * @param     string         $pFilename        The name of the spreadsheet file
219
+     * @return    PHPExcel_Reader_IReader
220
+     * @throws    PHPExcel_Reader_Exception
221
+     */
222
+    public static function createReaderForFile($pFilename)
223
+    {
224
+        // First, lucky guess by inspecting file extension
225
+        $pathinfo = pathinfo($pFilename);
226
+
227
+        $extensionType = null;
228
+        if (isset($pathinfo['extension'])) {
229
+            switch (strtolower($pathinfo['extension'])) {
230
+                case 'xlsx':            //    Excel (OfficeOpenXML) Spreadsheet
231
+                case 'xlsm':            //    Excel (OfficeOpenXML) Macro Spreadsheet (macros will be discarded)
232
+                case 'xltx':            //    Excel (OfficeOpenXML) Template
233
+                case 'xltm':            //    Excel (OfficeOpenXML) Macro Template (macros will be discarded)
234
+                    $extensionType = 'Excel2007';
235
+                    break;
236
+                case 'xls':                //    Excel (BIFF) Spreadsheet
237
+                case 'xlt':                //    Excel (BIFF) Template
238
+                    $extensionType = 'Excel5';
239
+                    break;
240
+                case 'ods':                //    Open/Libre Offic Calc
241
+                case 'ots':                //    Open/Libre Offic Calc Template
242
+                    $extensionType = 'OOCalc';
243
+                    break;
244
+                case 'slk':
245
+                    $extensionType = 'SYLK';
246
+                    break;
247
+                case 'xml':                //    Excel 2003 SpreadSheetML
248
+                    $extensionType = 'Excel2003XML';
249
+                    break;
250
+                case 'gnumeric':
251
+                    $extensionType = 'Gnumeric';
252
+                    break;
253
+                case 'htm':
254
+                case 'html':
255
+                    $extensionType = 'HTML';
256
+                    break;
257
+                case 'csv':
258
+                    // Do nothing
259
+                    // We must not try to use CSV reader since it loads
260
+                    // all files including Excel files etc.
261
+                    break;
262
+                default:
263
+                    break;
264
+            }
265
+
266
+            if ($extensionType !== null) {
267
+                $reader = self::createReader($extensionType);
268
+                // Let's see if we are lucky
269
+                if (isset($reader) && $reader->canRead($pFilename)) {
270
+                    return $reader;
271
+                }
272
+            }
273
+        }
274
+
275
+        // If we reach here then "lucky guess" didn't give any result
276
+        // Try walking through all the options in self::$autoResolveClasses
277
+        foreach (self::$autoResolveClasses as $autoResolveClass) {
278
+            //    Ignore our original guess, we know that won't work
279
+            if ($autoResolveClass !== $extensionType) {
280
+                $reader = self::createReader($autoResolveClass);
281
+                if ($reader->canRead($pFilename)) {
282
+                    return $reader;
283
+                }
284
+            }
285
+        }
286
+
287
+        throw new PHPExcel_Reader_Exception('Unable to identify a reader for this file');
288
+    }
289
+}

+ 249
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/NamedRange.php View File

@@ -0,0 +1,249 @@
1
+<?php
2
+
3
+/**
4
+ * PHPExcel_NamedRange
5
+ *
6
+ * Copyright (c) 2006 - 2015 PHPExcel
7
+ *
8
+ * This library is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU Lesser General Public
10
+ * License as published by the Free Software Foundation; either
11
+ * version 2.1 of the License, or (at your option) any later version.
12
+ *
13
+ * This library is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
+ * Lesser General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU Lesser General Public
19
+ * License along with this library; if not, write to the Free Software
20
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21
+ *
22
+ * @category   PHPExcel
23
+ * @package    PHPExcel
24
+ * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
25
+ * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
26
+ * @version    ##VERSION##, ##DATE##
27
+ */
28
+class PHPExcel_NamedRange
29
+{
30
+    /**
31
+     * Range name
32
+     *
33
+     * @var string
34
+     */
35
+    private $name;
36
+
37
+    /**
38
+     * Worksheet on which the named range can be resolved
39
+     *
40
+     * @var PHPExcel_Worksheet
41
+     */
42
+    private $worksheet;
43
+
44
+    /**
45
+     * Range of the referenced cells
46
+     *
47
+     * @var string
48
+     */
49
+    private $range;
50
+
51
+    /**
52
+     * Is the named range local? (i.e. can only be used on $this->worksheet)
53
+     *
54
+     * @var bool
55
+     */
56
+    private $localOnly;
57
+
58
+    /**
59
+     * Scope
60
+     *
61
+     * @var PHPExcel_Worksheet
62
+     */
63
+    private $scope;
64
+
65
+    /**
66
+     * Create a new NamedRange
67
+     *
68
+     * @param string $pName
69
+     * @param PHPExcel_Worksheet $pWorksheet
70
+     * @param string $pRange
71
+     * @param bool $pLocalOnly
72
+     * @param PHPExcel_Worksheet|null $pScope    Scope. Only applies when $pLocalOnly = true. Null for global scope.
73
+     * @throws PHPExcel_Exception
74
+     */
75
+    public function __construct($pName = null, PHPExcel_Worksheet $pWorksheet, $pRange = 'A1', $pLocalOnly = false, $pScope = null)
76
+    {
77
+        // Validate data
78
+        if (($pName === null) || ($pWorksheet === null) || ($pRange === null)) {
79
+            throw new PHPExcel_Exception('Parameters can not be null.');
80
+        }
81
+
82
+        // Set local members
83
+        $this->name       = $pName;
84
+        $this->worksheet  = $pWorksheet;
85
+        $this->range      = $pRange;
86
+        $this->localOnly  = $pLocalOnly;
87
+        $this->scope      = ($pLocalOnly == true) ? (($pScope == null) ? $pWorksheet : $pScope) : null;
88
+    }
89
+
90
+    /**
91
+     * Get name
92
+     *
93
+     * @return string
94
+     */
95
+    public function getName()
96
+    {
97
+        return $this->name;
98
+    }
99
+
100
+    /**
101
+     * Set name
102
+     *
103
+     * @param string $value
104
+     * @return PHPExcel_NamedRange
105
+     */
106
+    public function setName($value = null)
107
+    {
108
+        if ($value !== null) {
109
+            // Old title
110
+            $oldTitle = $this->name;
111
+
112
+            // Re-attach
113
+            if ($this->worksheet !== null) {
114
+                $this->worksheet->getParent()->removeNamedRange($this->name, $this->worksheet);
115
+            }
116
+            $this->name = $value;
117
+
118
+            if ($this->worksheet !== null) {
119
+                $this->worksheet->getParent()->addNamedRange($this);
120
+            }
121
+
122
+            // New title
123
+            $newTitle = $this->name;
124
+            PHPExcel_ReferenceHelper::getInstance()->updateNamedFormulas($this->worksheet->getParent(), $oldTitle, $newTitle);
125
+        }
126
+        return $this;
127
+    }
128
+
129
+    /**
130
+     * Get worksheet
131
+     *
132
+     * @return PHPExcel_Worksheet
133
+     */
134
+    public function getWorksheet()
135
+    {
136
+        return $this->worksheet;
137
+    }
138
+
139
+    /**
140
+     * Set worksheet
141
+     *
142
+     * @param PHPExcel_Worksheet $value
143
+     * @return PHPExcel_NamedRange
144
+     */
145
+    public function setWorksheet(PHPExcel_Worksheet $value = null)
146
+    {
147
+        if ($value !== null) {
148
+            $this->worksheet = $value;
149
+        }
150
+        return $this;
151
+    }
152
+
153
+    /**
154
+     * Get range
155
+     *
156
+     * @return string
157
+     */
158
+    public function getRange()
159
+    {
160
+        return $this->range;
161
+    }
162
+
163
+    /**
164
+     * Set range
165
+     *
166
+     * @param string $value
167
+     * @return PHPExcel_NamedRange
168
+     */
169
+    public function setRange($value = null)
170
+    {
171
+        if ($value !== null) {
172
+            $this->range = $value;
173
+        }
174
+        return $this;
175
+    }
176
+
177
+    /**
178
+     * Get localOnly
179
+     *
180
+     * @return bool
181
+     */
182
+    public function getLocalOnly()
183
+    {
184
+        return $this->localOnly;
185
+    }
186
+
187
+    /**
188
+     * Set localOnly
189
+     *
190
+     * @param bool $value
191
+     * @return PHPExcel_NamedRange
192
+     */
193
+    public function setLocalOnly($value = false)
194
+    {
195
+        $this->localOnly = $value;
196
+        $this->scope = $value ? $this->worksheet : null;
197
+        return $this;
198
+    }
199
+
200
+    /**
201
+     * Get scope
202
+     *
203
+     * @return PHPExcel_Worksheet|null
204
+     */
205
+    public function getScope()
206
+    {
207
+        return $this->scope;
208
+    }
209
+
210
+    /**
211
+     * Set scope
212
+     *
213
+     * @param PHPExcel_Worksheet|null $value
214
+     * @return PHPExcel_NamedRange
215
+     */
216
+    public function setScope(PHPExcel_Worksheet $value = null)
217
+    {
218
+        $this->scope = $value;
219
+        $this->localOnly = ($value == null) ? false : true;
220
+        return $this;
221
+    }
222
+
223
+    /**
224
+     * Resolve a named range to a regular cell range
225
+     *
226
+     * @param string $pNamedRange Named range
227
+     * @param PHPExcel_Worksheet|null $pSheet Scope. Use null for global scope
228
+     * @return PHPExcel_NamedRange
229
+     */
230
+    public static function resolveRange($pNamedRange = '', PHPExcel_Worksheet $pSheet)
231
+    {
232
+        return $pSheet->getParent()->getNamedRange($pNamedRange, $pSheet);
233
+    }
234
+
235
+    /**
236
+     * Implement PHP __clone to create a deep clone, not just a shallow copy.
237
+     */
238
+    public function __clone()
239
+    {
240
+        $vars = get_object_vars($this);
241
+        foreach ($vars as $key => $value) {
242
+            if (is_object($value)) {
243
+                $this->$key = clone $value;
244
+            } else {
245
+                $this->$key = $value;
246
+            }
247
+        }
248
+    }
249
+}

+ 301
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Abstract.php View File

@@ -0,0 +1,301 @@
1
+<?php
2
+
3
+/**
4
+ * PHPExcel_Reader_Abstract
5
+ *
6
+ * Copyright (c) 2006 - 2015 PHPExcel
7
+ *
8
+ * This library is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU Lesser General Public
10
+ * License as published by the Free Software Foundation; either
11
+ * version 2.1 of the License, or (at your option) any later version.
12
+ *
13
+ * This library is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
+ * Lesser General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU Lesser General Public
19
+ * License along with this library; if not, write to the Free Software
20
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21
+ *
22
+ * @category   PHPExcel
23
+ * @package    PHPExcel_Reader
24
+ * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
25
+ * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
26
+ * @version    ##VERSION##, ##DATE##
27
+ */
28
+abstract class PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader
29
+{
30
+    /**
31
+     * Read data only?
32
+     * Identifies whether the Reader should only read data values for cells, and ignore any formatting information;
33
+     *        or whether it should read both data and formatting
34
+     *
35
+     * @var    boolean
36
+     */
37
+    protected $readDataOnly = false;
38
+
39
+    /**
40
+     * Read empty cells?
41
+     * Identifies whether the Reader should read data values for cells all cells, or should ignore cells containing
42
+     *         null value or empty string
43
+     *
44
+     * @var    boolean
45
+     */
46
+    protected $readEmptyCells = true;
47
+
48
+    /**
49
+     * Read charts that are defined in the workbook?
50
+     * Identifies whether the Reader should read the definitions for any charts that exist in the workbook;
51
+     *
52
+     * @var    boolean
53
+     */
54
+    protected $includeCharts = false;
55
+
56
+    /**
57
+     * Restrict which sheets should be loaded?
58
+     * This property holds an array of worksheet names to be loaded. If null, then all worksheets will be loaded.
59
+     *
60
+     * @var array of string
61
+     */
62
+    protected $loadSheetsOnly;
63
+
64
+    /**
65
+     * PHPExcel_Reader_IReadFilter instance
66
+     *
67
+     * @var PHPExcel_Reader_IReadFilter
68
+     */
69
+    protected $readFilter;
70
+
71
+    protected $fileHandle = null;
72
+
73
+
74
+    /**
75
+     * Read data only?
76
+     *        If this is true, then the Reader will only read data values for cells, it will not read any formatting information.
77
+     *        If false (the default) it will read data and formatting.
78
+     *
79
+     * @return    boolean
80
+     */
81
+    public function getReadDataOnly()
82
+    {
83
+        return $this->readDataOnly;
84
+    }
85
+
86
+    /**
87
+     * Set read data only
88
+     *        Set to true, to advise the Reader only to read data values for cells, and to ignore any formatting information.
89
+     *        Set to false (the default) to advise the Reader to read both data and formatting for cells.
90
+     *
91
+     * @param    boolean    $pValue
92
+     *
93
+     * @return    PHPExcel_Reader_IReader
94
+     */
95
+    public function setReadDataOnly($pValue = false)
96
+    {
97
+        $this->readDataOnly = $pValue;
98
+        return $this;
99
+    }
100
+
101
+    /**
102
+     * Read empty cells?
103
+     *        If this is true (the default), then the Reader will read data values for all cells, irrespective of value.
104
+     *        If false it will not read data for cells containing a null value or an empty string.
105
+     *
106
+     * @return    boolean
107
+     */
108
+    public function getReadEmptyCells()
109
+    {
110
+        return $this->readEmptyCells;
111
+    }
112
+
113
+    /**
114
+     * Set read empty cells
115
+     *        Set to true (the default) to advise the Reader read data values for all cells, irrespective of value.
116
+     *        Set to false to advise the Reader to ignore cells containing a null value or an empty string.
117
+     *
118
+     * @param    boolean    $pValue
119
+     *
120
+     * @return    PHPExcel_Reader_IReader
121
+     */
122
+    public function setReadEmptyCells($pValue = true)
123
+    {
124
+        $this->readEmptyCells = $pValue;
125
+        return $this;
126
+    }
127
+
128
+    /**
129
+     * Read charts in workbook?
130
+     *        If this is true, then the Reader will include any charts that exist in the workbook.
131
+     *      Note that a ReadDataOnly value of false overrides, and charts won't be read regardless of the IncludeCharts value.
132
+     *        If false (the default) it will ignore any charts defined in the workbook file.
133
+     *
134
+     * @return    boolean
135
+     */
136
+    public function getIncludeCharts()
137
+    {
138
+        return $this->includeCharts;
139
+    }
140
+
141
+    /**
142
+     * Set read charts in workbook
143
+     *        Set to true, to advise the Reader to include any charts that exist in the workbook.
144
+     *      Note that a ReadDataOnly value of false overrides, and charts won't be read regardless of the IncludeCharts value.
145
+     *        Set to false (the default) to discard charts.
146
+     *
147
+     * @param    boolean    $pValue
148
+     *
149
+     * @return    PHPExcel_Reader_IReader
150
+     */
151
+    public function setIncludeCharts($pValue = false)
152
+    {
153
+        $this->includeCharts = (boolean) $pValue;
154
+        return $this;
155
+    }
156
+
157
+    /**
158
+     * Get which sheets to load
159
+     * Returns either an array of worksheet names (the list of worksheets that should be loaded), or a null
160
+     *        indicating that all worksheets in the workbook should be loaded.
161
+     *
162
+     * @return mixed
163
+     */
164
+    public function getLoadSheetsOnly()
165
+    {
166
+        return $this->loadSheetsOnly;
167
+    }
168
+
169
+    /**
170
+     * Set which sheets to load
171
+     *
172
+     * @param mixed $value
173
+     *        This should be either an array of worksheet names to be loaded, or a string containing a single worksheet name.
174
+     *        If NULL, then it tells the Reader to read all worksheets in the workbook
175
+     *
176
+     * @return PHPExcel_Reader_IReader
177
+     */
178
+    public function setLoadSheetsOnly($value = null)
179
+    {
180
+        if ($value === null) {
181
+            return $this->setLoadAllSheets();
182
+        }
183
+
184
+        $this->loadSheetsOnly = is_array($value) ? $value : array($value);
185
+        return $this;
186
+    }
187
+
188
+    /**
189
+     * Set all sheets to load
190
+     *        Tells the Reader to load all worksheets from the workbook.
191
+     *
192
+     * @return PHPExcel_Reader_IReader
193
+     */
194
+    public function setLoadAllSheets()
195
+    {
196
+        $this->loadSheetsOnly = null;
197
+        return $this;
198
+    }
199
+
200
+    /**
201
+     * Read filter
202
+     *
203
+     * @return PHPExcel_Reader_IReadFilter
204
+     */
205
+    public function getReadFilter()
206
+    {
207
+        return $this->readFilter;
208
+    }
209
+
210
+    /**
211
+     * Set read filter
212
+     *
213
+     * @param PHPExcel_Reader_IReadFilter $pValue
214
+     * @return PHPExcel_Reader_IReader
215
+     */
216
+    public function setReadFilter(PHPExcel_Reader_IReadFilter $pValue)
217
+    {
218
+        $this->readFilter = $pValue;
219
+        return $this;
220
+    }
221
+
222
+    /**
223
+     * Open file for reading
224
+     *
225
+     * @param string $pFilename
226
+     * @throws    PHPExcel_Reader_Exception
227
+     * @return resource
228
+     */
229
+    protected function openFile($pFilename)
230
+    {
231
+        // Check if file exists
232
+        if (!file_exists($pFilename) || !is_readable($pFilename)) {
233
+            throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
234
+        }
235
+
236
+        // Open file
237
+        $this->fileHandle = fopen($pFilename, 'r');
238
+        if ($this->fileHandle === false) {
239
+            throw new PHPExcel_Reader_Exception("Could not open file " . $pFilename . " for reading.");
240
+        }
241
+    }
242
+
243
+    /**
244
+     * Can the current PHPExcel_Reader_IReader read the file?
245
+     *
246
+     * @param     string         $pFilename
247
+     * @return boolean
248
+     * @throws PHPExcel_Reader_Exception
249
+     */
250
+    public function canRead($pFilename)
251
+    {
252
+        // Check if file exists
253
+        try {
254
+            $this->openFile($pFilename);
255
+        } catch (Exception $e) {
256
+            return false;
257
+        }
258
+
259
+        $readable = $this->isValidFormat();
260
+        fclose($this->fileHandle);
261
+        return $readable;
262
+    }
263
+
264
+    /**
265
+     * Scan theXML for use of <!ENTITY to prevent XXE/XEE attacks
266
+     *
267
+     * @param     string         $xml
268
+     * @throws PHPExcel_Reader_Exception
269
+     */
270
+    public function securityScan($xml)
271
+    {
272
+        $pattern = '/encoding="(.*?)"/';
273
+        $result = preg_match($pattern, $xml, $matches);
274
+        if ($result) {
275
+            $charset = $matches[1];
276
+        } else {
277
+            $charset = 'UTF-8';
278
+        }
279
+
280
+        if ($charset !== 'UTF-8') {
281
+            $xml = mb_convert_encoding($xml, 'UTF-8', $charset);
282
+        }
283
+
284
+        $pattern = '/\\0?' . implode('\\0?', str_split('<!DOCTYPE')) . '\\0?/';
285
+        if (preg_match($pattern, $xml)) {
286
+            throw new PHPExcel_Reader_Exception('Detected use of ENTITY in XML, spreadsheet file load() aborted to prevent XXE/XEE attacks');
287
+        }
288
+        return $xml;
289
+    }
290
+
291
+    /**
292
+     * Scan theXML for use of <!ENTITY to prevent XXE/XEE attacks
293
+     *
294
+     * @param     string         $filestream
295
+     * @throws PHPExcel_Reader_Exception
296
+     */
297
+    public function securityScanFile($filestream)
298
+    {
299
+        return $this->securityScan(file_get_contents($filestream));
300
+    }
301
+}

+ 406
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/CSV.php View File

@@ -0,0 +1,406 @@
1
+<?php
2
+
3
+/** PHPExcel root directory */
4
+if (!defined('PHPEXCEL_ROOT')) {
5
+    /**
6
+     * @ignore
7
+     */
8
+    define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
9
+    require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
10
+}
11
+
12
+/**
13
+ * PHPExcel_Reader_CSV
14
+ *
15
+ * Copyright (c) 2006 - 2015 PHPExcel
16
+ *
17
+ * This library is free software; you can redistribute it and/or
18
+ * modify it under the terms of the GNU Lesser General Public
19
+ * License as published by the Free Software Foundation; either
20
+ * version 2.1 of the License, or (at your option) any later version.
21
+ *
22
+ * This library is distributed in the hope that it will be useful,
23
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
24
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
25
+ * Lesser General Public License for more details.
26
+ *
27
+ * You should have received a copy of the GNU Lesser General Public
28
+ * License along with this library; if not, write to the Free Software
29
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
30
+ *
31
+ * @category   PHPExcel
32
+ * @package    PHPExcel_Reader
33
+ * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
34
+ * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
35
+ * @version    ##VERSION##, ##DATE##
36
+ */
37
+class PHPExcel_Reader_CSV extends PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader
38
+{
39
+    /**
40
+     * Input encoding
41
+     *
42
+     * @access    private
43
+     * @var    string
44
+     */
45
+    private $inputEncoding = 'UTF-8';
46
+
47
+    /**
48
+     * Delimiter
49
+     *
50
+     * @access    private
51
+     * @var string
52
+     */
53
+    private $delimiter = ',';
54
+
55
+    /**
56
+     * Enclosure
57
+     *
58
+     * @access    private
59
+     * @var    string
60
+     */
61
+    private $enclosure = '"';
62
+
63
+    /**
64
+     * Sheet index to read
65
+     *
66
+     * @access    private
67
+     * @var    int
68
+     */
69
+    private $sheetIndex = 0;
70
+
71
+    /**
72
+     * Load rows contiguously
73
+     *
74
+     * @access    private
75
+     * @var    int
76
+     */
77
+    private $contiguous = false;
78
+
79
+    /**
80
+     * Row counter for loading rows contiguously
81
+     *
82
+     * @var    int
83
+     */
84
+    private $contiguousRow = -1;
85
+
86
+
87
+    /**
88
+     * Create a new PHPExcel_Reader_CSV
89
+     */
90
+    public function __construct()
91
+    {
92
+        $this->readFilter = new PHPExcel_Reader_DefaultReadFilter();
93
+    }
94
+
95
+    /**
96
+     * Validate that the current file is a CSV file
97
+     *
98
+     * @return boolean
99
+     */
100
+    protected function isValidFormat()
101
+    {
102
+        return true;
103
+    }
104
+
105
+    /**
106
+     * Set input encoding
107
+     *
108
+     * @param string $pValue Input encoding
109
+     */
110
+    public function setInputEncoding($pValue = 'UTF-8')
111
+    {
112
+        $this->inputEncoding = $pValue;
113
+        return $this;
114
+    }
115
+
116
+    /**
117
+     * Get input encoding
118
+     *
119
+     * @return string
120
+     */
121
+    public function getInputEncoding()
122
+    {
123
+        return $this->inputEncoding;
124
+    }
125
+
126
+    /**
127
+     * Move filepointer past any BOM marker
128
+     *
129
+     */
130
+    protected function skipBOM()
131
+    {
132
+        rewind($this->fileHandle);
133
+
134
+        switch ($this->inputEncoding) {
135
+            case 'UTF-8':
136
+                fgets($this->fileHandle, 4) == "\xEF\xBB\xBF" ?
137
+                    fseek($this->fileHandle, 3) : fseek($this->fileHandle, 0);
138
+                break;
139
+            case 'UTF-16LE':
140
+                fgets($this->fileHandle, 3) == "\xFF\xFE" ?
141
+                    fseek($this->fileHandle, 2) : fseek($this->fileHandle, 0);
142
+                break;
143
+            case 'UTF-16BE':
144
+                fgets($this->fileHandle, 3) == "\xFE\xFF" ?
145
+                    fseek($this->fileHandle, 2) : fseek($this->fileHandle, 0);
146
+                break;
147
+            case 'UTF-32LE':
148
+                fgets($this->fileHandle, 5) == "\xFF\xFE\x00\x00" ?
149
+                    fseek($this->fileHandle, 4) : fseek($this->fileHandle, 0);
150
+                break;
151
+            case 'UTF-32BE':
152
+                fgets($this->fileHandle, 5) == "\x00\x00\xFE\xFF" ?
153
+                    fseek($this->fileHandle, 4) : fseek($this->fileHandle, 0);
154
+                break;
155
+            default:
156
+                break;
157
+        }
158
+    }
159
+
160
+    /**
161
+     * Identify any separator that is explicitly set in the file
162
+     *
163
+     */
164
+    protected function checkSeparator()
165
+    {
166
+        $line = fgets($this->fileHandle);
167
+        if ($line === false) {
168
+            return;
169
+        }
170
+
171
+        if ((strlen(trim($line, "\r\n")) == 5) && (stripos($line, 'sep=') === 0)) {
172
+            $this->delimiter = substr($line, 4, 1);
173
+            return;
174
+        }
175
+        return $this->skipBOM();
176
+    }
177
+
178
+    /**
179
+     * Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns)
180
+     *
181
+     * @param     string         $pFilename
182
+     * @throws    PHPExcel_Reader_Exception
183
+     */
184
+    public function listWorksheetInfo($pFilename)
185
+    {
186
+        // Open file
187
+        $this->openFile($pFilename);
188
+        if (!$this->isValidFormat()) {
189
+            fclose($this->fileHandle);
190
+            throw new PHPExcel_Reader_Exception($pFilename . " is an Invalid Spreadsheet file.");
191
+        }
192
+        $fileHandle = $this->fileHandle;
193
+
194
+        // Skip BOM, if any
195
+        $this->skipBOM();
196
+        $this->checkSeparator();
197
+
198
+        $escapeEnclosures = array( "\\" . $this->enclosure, $this->enclosure . $this->enclosure );
199
+
200
+        $worksheetInfo = array();
201
+        $worksheetInfo[0]['worksheetName'] = 'Worksheet';
202
+        $worksheetInfo[0]['lastColumnLetter'] = 'A';
203
+        $worksheetInfo[0]['lastColumnIndex'] = 0;
204
+        $worksheetInfo[0]['totalRows'] = 0;
205
+        $worksheetInfo[0]['totalColumns'] = 0;
206
+
207
+        // Loop through each line of the file in turn
208
+        while (($rowData = fgetcsv($fileHandle, 0, $this->delimiter, $this->enclosure)) !== false) {
209
+            $worksheetInfo[0]['totalRows']++;
210
+            $worksheetInfo[0]['lastColumnIndex'] = max($worksheetInfo[0]['lastColumnIndex'], count($rowData) - 1);
211
+        }
212
+
213
+        $worksheetInfo[0]['lastColumnLetter'] = PHPExcel_Cell::stringFromColumnIndex($worksheetInfo[0]['lastColumnIndex']);
214
+        $worksheetInfo[0]['totalColumns'] = $worksheetInfo[0]['lastColumnIndex'] + 1;
215
+
216
+        // Close file
217
+        fclose($fileHandle);
218
+
219
+        return $worksheetInfo;
220
+    }
221
+
222
+    /**
223
+     * Loads PHPExcel from file
224
+     *
225
+     * @param     string         $pFilename
226
+     * @return PHPExcel
227
+     * @throws PHPExcel_Reader_Exception
228
+     */
229
+    public function load($pFilename)
230
+    {
231
+        // Create new PHPExcel
232
+        $objPHPExcel = new PHPExcel();
233
+
234
+        // Load into this instance
235
+        return $this->loadIntoExisting($pFilename, $objPHPExcel);
236
+    }
237
+
238
+    /**
239
+     * Loads PHPExcel from file into PHPExcel instance
240
+     *
241
+     * @param     string         $pFilename
242
+     * @param    PHPExcel    $objPHPExcel
243
+     * @return     PHPExcel
244
+     * @throws     PHPExcel_Reader_Exception
245
+     */
246
+    public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel)
247
+    {
248
+        $lineEnding = ini_get('auto_detect_line_endings');
249
+        ini_set('auto_detect_line_endings', true);
250
+
251
+        // Open file
252
+        $this->openFile($pFilename);
253
+        if (!$this->isValidFormat()) {
254
+            fclose($this->fileHandle);
255
+            throw new PHPExcel_Reader_Exception($pFilename . " is an Invalid Spreadsheet file.");
256
+        }
257
+        $fileHandle = $this->fileHandle;
258
+
259
+        // Skip BOM, if any
260
+        $this->skipBOM();
261
+        $this->checkSeparator();
262
+
263
+        // Create new PHPExcel object
264
+        while ($objPHPExcel->getSheetCount() <= $this->sheetIndex) {
265
+            $objPHPExcel->createSheet();
266
+        }
267
+        $sheet = $objPHPExcel->setActiveSheetIndex($this->sheetIndex);
268
+
269
+        $escapeEnclosures = array( "\\" . $this->enclosure,
270
+                                   $this->enclosure . $this->enclosure
271
+                                 );
272
+
273
+        // Set our starting row based on whether we're in contiguous mode or not
274
+        $currentRow = 1;
275
+        if ($this->contiguous) {
276
+            $currentRow = ($this->contiguousRow == -1) ? $sheet->getHighestRow(): $this->contiguousRow;
277
+        }
278
+
279
+        // Loop through each line of the file in turn
280
+        while (($rowData = fgetcsv($fileHandle, 0, $this->delimiter, $this->enclosure)) !== false) {
281
+            $columnLetter = 'A';
282
+            foreach ($rowData as $rowDatum) {
283
+                if ($rowDatum != '' && $this->readFilter->readCell($columnLetter, $currentRow)) {
284
+                    // Unescape enclosures
285
+                    $rowDatum = str_replace($escapeEnclosures, $this->enclosure, $rowDatum);
286
+
287
+                    // Convert encoding if necessary
288
+                    if ($this->inputEncoding !== 'UTF-8') {
289
+                        $rowDatum = PHPExcel_Shared_String::ConvertEncoding($rowDatum, 'UTF-8', $this->inputEncoding);
290
+                    }
291
+
292
+                    // Set cell value
293
+                    $sheet->getCell($columnLetter . $currentRow)->setValue($rowDatum);
294
+                }
295
+                ++$columnLetter;
296
+            }
297
+            ++$currentRow;
298
+        }
299
+
300
+        // Close file
301
+        fclose($fileHandle);
302
+
303
+        if ($this->contiguous) {
304
+            $this->contiguousRow = $currentRow;
305
+        }
306
+
307
+        ini_set('auto_detect_line_endings', $lineEnding);
308
+
309
+        // Return
310
+        return $objPHPExcel;
311
+    }
312
+
313
+    /**
314
+     * Get delimiter
315
+     *
316
+     * @return string
317
+     */
318
+    public function getDelimiter()
319
+    {
320
+        return $this->delimiter;
321
+    }
322
+
323
+    /**
324
+     * Set delimiter
325
+     *
326
+     * @param    string    $pValue        Delimiter, defaults to ,
327
+     * @return    PHPExcel_Reader_CSV
328
+     */
329
+    public function setDelimiter($pValue = ',')
330
+    {
331
+        $this->delimiter = $pValue;
332
+        return $this;
333
+    }
334
+
335
+    /**
336
+     * Get enclosure
337
+     *
338
+     * @return string
339
+     */
340
+    public function getEnclosure()
341
+    {
342
+        return $this->enclosure;
343
+    }
344
+
345
+    /**
346
+     * Set enclosure
347
+     *
348
+     * @param    string    $pValue        Enclosure, defaults to "
349
+     * @return PHPExcel_Reader_CSV
350
+     */
351
+    public function setEnclosure($pValue = '"')
352
+    {
353
+        if ($pValue == '') {
354
+            $pValue = '"';
355
+        }
356
+        $this->enclosure = $pValue;
357
+        return $this;
358
+    }
359
+
360
+    /**
361
+     * Get sheet index
362
+     *
363
+     * @return integer
364
+     */
365
+    public function getSheetIndex()
366
+    {
367
+        return $this->sheetIndex;
368
+    }
369
+
370
+    /**
371
+     * Set sheet index
372
+     *
373
+     * @param    integer        $pValue        Sheet index
374
+     * @return PHPExcel_Reader_CSV
375
+     */
376
+    public function setSheetIndex($pValue = 0)
377
+    {
378
+        $this->sheetIndex = $pValue;
379
+        return $this;
380
+    }
381
+
382
+    /**
383
+     * Set Contiguous
384
+     *
385
+     * @param boolean $contiguous
386
+     */
387
+    public function setContiguous($contiguous = false)
388
+    {
389
+        $this->contiguous = (bool) $contiguous;
390
+        if (!$contiguous) {
391
+            $this->contiguousRow = -1;
392
+        }
393
+
394
+        return $this;
395
+    }
396
+
397
+    /**
398
+     * Get Contiguous
399
+     *
400
+     * @return boolean
401
+     */
402
+    public function getContiguous()
403
+    {
404
+        return $this->contiguous;
405
+    }
406
+}

+ 51
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/DefaultReadFilter.php View File

@@ -0,0 +1,51 @@
1
+<?php
2
+
3
+/** PHPExcel root directory */
4
+if (!defined('PHPEXCEL_ROOT')) {
5
+    /**
6
+     * @ignore
7
+     */
8
+    define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
9
+    require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
10
+}
11
+
12
+/**
13
+ * PHPExcel_Reader_DefaultReadFilter
14
+ *
15
+ * Copyright (c) 2006 - 2015 PHPExcel
16
+ *
17
+ * This library is free software; you can redistribute it and/or
18
+ * modify it under the terms of the GNU Lesser General Public
19
+ * License as published by the Free Software Foundation; either
20
+ * version 2.1 of the License, or (at your option) any later version.
21
+ *
22
+ * This library is distributed in the hope that it will be useful,
23
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
24
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
25
+ * Lesser General Public License for more details.
26
+ *
27
+ * You should have received a copy of the GNU Lesser General Public
28
+ * License along with this library; if not, write to the Free Software
29
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
30
+ *
31
+ * @category   PHPExcel
32
+ * @package    PHPExcel_Reader
33
+ * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
34
+ * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
35
+ * @version    ##VERSION##, ##DATE##
36
+ */
37
+class PHPExcel_Reader_DefaultReadFilter implements PHPExcel_Reader_IReadFilter
38
+{
39
+    /**
40
+     * Should this cell be read?
41
+     *
42
+     * @param    $column           Column address (as a string value like "A", or "IV")
43
+     * @param    $row              Row number
44
+     * @param    $worksheetName    Optional worksheet name
45
+     * @return   boolean
46
+     */
47
+    public function readCell($column, $row, $worksheetName = '')
48
+    {
49
+        return true;
50
+    }
51
+}

+ 801
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Excel2003XML.php View File

@@ -0,0 +1,801 @@
1
+<?php
2
+
3
+/** PHPExcel root directory */
4
+if (!defined('PHPEXCEL_ROOT')) {
5
+    /**
6
+     * @ignore
7
+     */
8
+    define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
9
+    require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
10
+}
11
+
12
+/**
13
+ * PHPExcel_Reader_Excel2003XML
14
+ *
15
+ * Copyright (c) 2006 - 2015 PHPExcel
16
+ *
17
+ * This library is free software; you can redistribute it and/or
18
+ * modify it under the terms of the GNU Lesser General Public
19
+ * License as published by the Free Software Foundation; either
20
+ * version 2.1 of the License, or (at your option) any later version.
21
+ *
22
+ * This library is distributed in the hope that it will be useful,
23
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
24
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
25
+ * Lesser General Public License for more details.
26
+ *
27
+ * You should have received a copy of the GNU Lesser General Public
28
+ * License along with this library; if not, write to the Free Software
29
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
30
+ *
31
+ * @category   PHPExcel
32
+ * @package    PHPExcel_Reader
33
+ * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
34
+ * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
35
+ * @version    ##VERSION##, ##DATE##
36
+ */
37
+class PHPExcel_Reader_Excel2003XML extends PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader
38
+{
39
+    /**
40
+     * Formats
41
+     *
42
+     * @var array
43
+     */
44
+    protected $styles = array();
45
+
46
+    /**
47
+     * Character set used in the file
48
+     *
49
+     * @var string
50
+     */
51
+    protected $charSet = 'UTF-8';
52
+
53
+    /**
54
+     * Create a new PHPExcel_Reader_Excel2003XML
55
+     */
56
+    public function __construct()
57
+    {
58
+        $this->readFilter = new PHPExcel_Reader_DefaultReadFilter();
59
+    }
60
+
61
+
62
+    /**
63
+     * Can the current PHPExcel_Reader_IReader read the file?
64
+     *
65
+     * @param     string         $pFilename
66
+     * @return     boolean
67
+     * @throws PHPExcel_Reader_Exception
68
+     */
69
+    public function canRead($pFilename)
70
+    {
71
+
72
+        //    Office                    xmlns:o="urn:schemas-microsoft-com:office:office"
73
+        //    Excel                    xmlns:x="urn:schemas-microsoft-com:office:excel"
74
+        //    XML Spreadsheet            xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
75
+        //    Spreadsheet component    xmlns:c="urn:schemas-microsoft-com:office:component:spreadsheet"
76
+        //    XML schema                 xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882"
77
+        //    XML data type            xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"
78
+        //    MS-persist recordset    xmlns:rs="urn:schemas-microsoft-com:rowset"
79
+        //    Rowset                    xmlns:z="#RowsetSchema"
80
+        //
81
+
82
+        $signature = array(
83
+                '<?xml version="1.0"',
84
+                '<?mso-application progid="Excel.Sheet"?>'
85
+            );
86
+
87
+        // Open file
88
+        $this->openFile($pFilename);
89
+        $fileHandle = $this->fileHandle;
90
+        
91
+        // Read sample data (first 2 KB will do)
92
+        $data = fread($fileHandle, 2048);
93
+        fclose($fileHandle);
94
+
95
+        $valid = true;
96
+        foreach ($signature as $match) {
97
+            // every part of the signature must be present
98
+            if (strpos($data, $match) === false) {
99
+                $valid = false;
100
+                break;
101
+            }
102
+        }
103
+
104
+        //    Retrieve charset encoding
105
+        if (preg_match('/<?xml.*encoding=[\'"](.*?)[\'"].*?>/um', $data, $matches)) {
106
+            $this->charSet = strtoupper($matches[1]);
107
+        }
108
+//        echo 'Character Set is ', $this->charSet,'<br />';
109
+
110
+        return $valid;
111
+    }
112
+
113
+
114
+    /**
115
+     * Reads names of the worksheets from a file, without parsing the whole file to a PHPExcel object
116
+     *
117
+     * @param     string         $pFilename
118
+     * @throws     PHPExcel_Reader_Exception
119
+     */
120
+    public function listWorksheetNames($pFilename)
121
+    {
122
+        // Check if file exists
123
+        if (!file_exists($pFilename)) {
124
+            throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
125
+        }
126
+        if (!$this->canRead($pFilename)) {
127
+            throw new PHPExcel_Reader_Exception($pFilename . " is an Invalid Spreadsheet file.");
128
+        }
129
+
130
+        $worksheetNames = array();
131
+
132
+        $xml = simplexml_load_string($this->securityScan(file_get_contents($pFilename)), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
133
+        $namespaces = $xml->getNamespaces(true);
134
+
135
+        $xml_ss = $xml->children($namespaces['ss']);
136
+        foreach ($xml_ss->Worksheet as $worksheet) {
137
+            $worksheet_ss = $worksheet->attributes($namespaces['ss']);
138
+            $worksheetNames[] = self::convertStringEncoding((string) $worksheet_ss['Name'], $this->charSet);
139
+        }
140
+
141
+        return $worksheetNames;
142
+    }
143
+
144
+
145
+    /**
146
+     * Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns)
147
+     *
148
+     * @param   string     $pFilename
149
+     * @throws   PHPExcel_Reader_Exception
150
+     */
151
+    public function listWorksheetInfo($pFilename)
152
+    {
153
+        // Check if file exists
154
+        if (!file_exists($pFilename)) {
155
+            throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
156
+        }
157
+
158
+        $worksheetInfo = array();
159
+
160
+        $xml = simplexml_load_string($this->securityScan(file_get_contents($pFilename)), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
161
+        $namespaces = $xml->getNamespaces(true);
162
+
163
+        $worksheetID = 1;
164
+        $xml_ss = $xml->children($namespaces['ss']);
165
+        foreach ($xml_ss->Worksheet as $worksheet) {
166
+            $worksheet_ss = $worksheet->attributes($namespaces['ss']);
167
+
168
+            $tmpInfo = array();
169
+            $tmpInfo['worksheetName'] = '';
170
+            $tmpInfo['lastColumnLetter'] = 'A';
171
+            $tmpInfo['lastColumnIndex'] = 0;
172
+            $tmpInfo['totalRows'] = 0;
173
+            $tmpInfo['totalColumns'] = 0;
174
+
175
+            if (isset($worksheet_ss['Name'])) {
176
+                $tmpInfo['worksheetName'] = (string) $worksheet_ss['Name'];
177
+            } else {
178
+                $tmpInfo['worksheetName'] = "Worksheet_{$worksheetID}";
179
+            }
180
+
181
+            if (isset($worksheet->Table->Row)) {
182
+                $rowIndex = 0;
183
+
184
+                foreach ($worksheet->Table->Row as $rowData) {
185
+                    $columnIndex = 0;
186
+                    $rowHasData = false;
187
+
188
+                    foreach ($rowData->Cell as $cell) {
189
+                        if (isset($cell->Data)) {
190
+                            $tmpInfo['lastColumnIndex'] = max($tmpInfo['lastColumnIndex'], $columnIndex);
191
+                            $rowHasData = true;
192
+                        }
193
+
194
+                        ++$columnIndex;
195
+                    }
196
+
197
+                    ++$rowIndex;
198
+
199
+                    if ($rowHasData) {
200
+                        $tmpInfo['totalRows'] = max($tmpInfo['totalRows'], $rowIndex);
201
+                    }
202
+                }
203
+            }
204
+
205
+            $tmpInfo['lastColumnLetter'] = PHPExcel_Cell::stringFromColumnIndex($tmpInfo['lastColumnIndex']);
206
+            $tmpInfo['totalColumns'] = $tmpInfo['lastColumnIndex'] + 1;
207
+
208
+            $worksheetInfo[] = $tmpInfo;
209
+            ++$worksheetID;
210
+        }
211
+
212
+        return $worksheetInfo;
213
+    }
214
+
215
+
216
+    /**
217
+     * Loads PHPExcel from file
218
+     *
219
+     * @param     string         $pFilename
220
+     * @return     PHPExcel
221
+     * @throws     PHPExcel_Reader_Exception
222
+     */
223
+    public function load($pFilename)
224
+    {
225
+        // Create new PHPExcel
226
+        $objPHPExcel = new PHPExcel();
227
+        $objPHPExcel->removeSheetByIndex(0);
228
+
229
+        // Load into this instance
230
+        return $this->loadIntoExisting($pFilename, $objPHPExcel);
231
+    }
232
+
233
+    protected static function identifyFixedStyleValue($styleList, &$styleAttributeValue)
234
+    {
235
+        $styleAttributeValue = strtolower($styleAttributeValue);
236
+        foreach ($styleList as $style) {
237
+            if ($styleAttributeValue == strtolower($style)) {
238
+                $styleAttributeValue = $style;
239
+                return true;
240
+            }
241
+        }
242
+        return false;
243
+    }
244
+
245
+    /**
246
+     * pixel units to excel width units(units of 1/256th of a character width)
247
+     * @param pxs
248
+     * @return
249
+     */
250
+    protected static function pixel2WidthUnits($pxs)
251
+    {
252
+        $UNIT_OFFSET_MAP = array(0, 36, 73, 109, 146, 182, 219);
253
+
254
+        $widthUnits = 256 * ($pxs / 7);
255
+        $widthUnits += $UNIT_OFFSET_MAP[($pxs % 7)];
256
+        return $widthUnits;
257
+    }
258
+
259
+    /**
260
+     * excel width units(units of 1/256th of a character width) to pixel units
261
+     * @param widthUnits
262
+     * @return
263
+     */
264
+    protected static function widthUnits2Pixel($widthUnits)
265
+    {
266
+        $pixels = ($widthUnits / 256) * 7;
267
+        $offsetWidthUnits = $widthUnits % 256;
268
+        $pixels += round($offsetWidthUnits / (256 / 7));
269
+        return $pixels;
270
+    }
271
+
272
+    protected static function hex2str($hex)
273
+    {
274
+        return chr(hexdec($hex[1]));
275
+    }
276
+
277
+    /**
278
+     * Loads PHPExcel from file into PHPExcel instance
279
+     *
280
+     * @param     string         $pFilename
281
+     * @param    PHPExcel    $objPHPExcel
282
+     * @return     PHPExcel
283
+     * @throws     PHPExcel_Reader_Exception
284
+     */
285
+    public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel)
286
+    {
287
+        $fromFormats    = array('\-', '\ ');
288
+        $toFormats      = array('-', ' ');
289
+
290
+        $underlineStyles = array (
291
+            PHPExcel_Style_Font::UNDERLINE_NONE,
292
+            PHPExcel_Style_Font::UNDERLINE_DOUBLE,
293
+            PHPExcel_Style_Font::UNDERLINE_DOUBLEACCOUNTING,
294
+            PHPExcel_Style_Font::UNDERLINE_SINGLE,
295
+            PHPExcel_Style_Font::UNDERLINE_SINGLEACCOUNTING
296
+        );
297
+        $verticalAlignmentStyles = array (
298
+            PHPExcel_Style_Alignment::VERTICAL_BOTTOM,
299
+            PHPExcel_Style_Alignment::VERTICAL_TOP,
300
+            PHPExcel_Style_Alignment::VERTICAL_CENTER,
301
+            PHPExcel_Style_Alignment::VERTICAL_JUSTIFY
302
+        );
303
+        $horizontalAlignmentStyles = array (
304
+            PHPExcel_Style_Alignment::HORIZONTAL_GENERAL,
305
+            PHPExcel_Style_Alignment::HORIZONTAL_LEFT,
306
+            PHPExcel_Style_Alignment::HORIZONTAL_RIGHT,
307
+            PHPExcel_Style_Alignment::HORIZONTAL_CENTER,
308
+            PHPExcel_Style_Alignment::HORIZONTAL_CENTER_CONTINUOUS,
309
+            PHPExcel_Style_Alignment::HORIZONTAL_JUSTIFY
310
+        );
311
+
312
+        $timezoneObj = new DateTimeZone('Europe/London');
313
+        $GMT = new DateTimeZone('UTC');
314
+
315
+        // Check if file exists
316
+        if (!file_exists($pFilename)) {
317
+            throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
318
+        }
319
+
320
+        if (!$this->canRead($pFilename)) {
321
+            throw new PHPExcel_Reader_Exception($pFilename . " is an Invalid Spreadsheet file.");
322
+        }
323
+
324
+        $xml = simplexml_load_string($this->securityScan(file_get_contents($pFilename)), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
325
+        $namespaces = $xml->getNamespaces(true);
326
+
327
+        $docProps = $objPHPExcel->getProperties();
328
+        if (isset($xml->DocumentProperties[0])) {
329
+            foreach ($xml->DocumentProperties[0] as $propertyName => $propertyValue) {
330
+                switch ($propertyName) {
331
+                    case 'Title':
332
+                        $docProps->setTitle(self::convertStringEncoding($propertyValue, $this->charSet));
333
+                        break;
334
+                    case 'Subject':
335
+                        $docProps->setSubject(self::convertStringEncoding($propertyValue, $this->charSet));
336
+                        break;
337
+                    case 'Author':
338
+                        $docProps->setCreator(self::convertStringEncoding($propertyValue, $this->charSet));
339
+                        break;
340
+                    case 'Created':
341
+                        $creationDate = strtotime($propertyValue);
342
+                        $docProps->setCreated($creationDate);
343
+                        break;
344
+                    case 'LastAuthor':
345
+                        $docProps->setLastModifiedBy(self::convertStringEncoding($propertyValue, $this->charSet));
346
+                        break;
347
+                    case 'LastSaved':
348
+                        $lastSaveDate = strtotime($propertyValue);
349
+                        $docProps->setModified($lastSaveDate);
350
+                        break;
351
+                    case 'Company':
352
+                        $docProps->setCompany(self::convertStringEncoding($propertyValue, $this->charSet));
353
+                        break;
354
+                    case 'Category':
355
+                        $docProps->setCategory(self::convertStringEncoding($propertyValue, $this->charSet));
356
+                        break;
357
+                    case 'Manager':
358
+                        $docProps->setManager(self::convertStringEncoding($propertyValue, $this->charSet));
359
+                        break;
360
+                    case 'Keywords':
361
+                        $docProps->setKeywords(self::convertStringEncoding($propertyValue, $this->charSet));
362
+                        break;
363
+                    case 'Description':
364
+                        $docProps->setDescription(self::convertStringEncoding($propertyValue, $this->charSet));
365
+                        break;
366
+                }
367
+            }
368
+        }
369
+        if (isset($xml->CustomDocumentProperties)) {
370
+            foreach ($xml->CustomDocumentProperties[0] as $propertyName => $propertyValue) {
371
+                $propertyAttributes = $propertyValue->attributes($namespaces['dt']);
372
+                $propertyName = preg_replace_callback('/_x([0-9a-z]{4})_/', 'PHPExcel_Reader_Excel2003XML::hex2str', $propertyName);
373
+                $propertyType = PHPExcel_DocumentProperties::PROPERTY_TYPE_UNKNOWN;
374
+                switch ((string) $propertyAttributes) {
375
+                    case 'string':
376
+                        $propertyType = PHPExcel_DocumentProperties::PROPERTY_TYPE_STRING;
377
+                        $propertyValue = trim($propertyValue);
378
+                        break;
379
+                    case 'boolean':
380
+                        $propertyType = PHPExcel_DocumentProperties::PROPERTY_TYPE_BOOLEAN;
381
+                        $propertyValue = (bool) $propertyValue;
382
+                        break;
383
+                    case 'integer':
384
+                        $propertyType = PHPExcel_DocumentProperties::PROPERTY_TYPE_INTEGER;
385
+                        $propertyValue = intval($propertyValue);
386
+                        break;
387
+                    case 'float':
388
+                        $propertyType = PHPExcel_DocumentProperties::PROPERTY_TYPE_FLOAT;
389
+                        $propertyValue = floatval($propertyValue);
390
+                        break;
391
+                    case 'dateTime.tz':
392
+                        $propertyType = PHPExcel_DocumentProperties::PROPERTY_TYPE_DATE;
393
+                        $propertyValue = strtotime(trim($propertyValue));
394
+                        break;
395
+                }
396
+                $docProps->setCustomProperty($propertyName, $propertyValue, $propertyType);
397
+            }
398
+        }
399
+
400
+        foreach ($xml->Styles[0] as $style) {
401
+            $style_ss = $style->attributes($namespaces['ss']);
402
+            $styleID = (string) $style_ss['ID'];
403
+//            echo 'Style ID = '.$styleID.'<br />';
404
+            $this->styles[$styleID] = (isset($this->styles['Default'])) ? $this->styles['Default'] : array();
405
+            foreach ($style as $styleType => $styleData) {
406
+                $styleAttributes = $styleData->attributes($namespaces['ss']);
407
+//                echo $styleType.'<br />';
408
+                switch ($styleType) {
409
+                    case 'Alignment':
410
+                        foreach ($styleAttributes as $styleAttributeKey => $styleAttributeValue) {
411
+//                                echo $styleAttributeKey.' = '.$styleAttributeValue.'<br />';
412
+                            $styleAttributeValue = (string) $styleAttributeValue;
413
+                            switch ($styleAttributeKey) {
414
+                                case 'Vertical':
415
+                                    if (self::identifyFixedStyleValue($verticalAlignmentStyles, $styleAttributeValue)) {
416
+                                        $this->styles[$styleID]['alignment']['vertical'] = $styleAttributeValue;
417
+                                    }
418
+                                    break;
419
+                                case 'Horizontal':
420
+                                    if (self::identifyFixedStyleValue($horizontalAlignmentStyles, $styleAttributeValue)) {
421
+                                        $this->styles[$styleID]['alignment']['horizontal'] = $styleAttributeValue;
422
+                                    }
423
+                                    break;
424
+                                case 'WrapText':
425
+                                    $this->styles[$styleID]['alignment']['wrap'] = true;
426
+                                    break;
427
+                            }
428
+                        }
429
+                        break;
430
+                    case 'Borders':
431
+                        foreach ($styleData->Border as $borderStyle) {
432
+                            $borderAttributes = $borderStyle->attributes($namespaces['ss']);
433
+                            $thisBorder = array();
434
+                            foreach ($borderAttributes as $borderStyleKey => $borderStyleValue) {
435
+//                                    echo $borderStyleKey.' = '.$borderStyleValue.'<br />';
436
+                                switch ($borderStyleKey) {
437
+                                    case 'LineStyle':
438
+                                        $thisBorder['style'] = PHPExcel_Style_Border::BORDER_MEDIUM;
439
+//                                                $thisBorder['style'] = $borderStyleValue;
440
+                                        break;
441
+                                    case 'Weight':
442
+//                                                $thisBorder['style'] = $borderStyleValue;
443
+                                        break;
444
+                                    case 'Position':
445
+                                        $borderPosition = strtolower($borderStyleValue);
446
+                                        break;
447
+                                    case 'Color':
448
+                                        $borderColour = substr($borderStyleValue, 1);
449
+                                        $thisBorder['color']['rgb'] = $borderColour;
450
+                                        break;
451
+                                }
452
+                            }
453
+                            if (!empty($thisBorder)) {
454
+                                if (($borderPosition == 'left') || ($borderPosition == 'right') || ($borderPosition == 'top') || ($borderPosition == 'bottom')) {
455
+                                    $this->styles[$styleID]['borders'][$borderPosition] = $thisBorder;
456
+                                }
457
+                            }
458
+                        }
459
+                        break;
460
+                    case 'Font':
461
+                        foreach ($styleAttributes as $styleAttributeKey => $styleAttributeValue) {
462
+//                                echo $styleAttributeKey.' = '.$styleAttributeValue.'<br />';
463
+                            $styleAttributeValue = (string) $styleAttributeValue;
464
+                            switch ($styleAttributeKey) {
465
+                                case 'FontName':
466
+                                    $this->styles[$styleID]['font']['name'] = $styleAttributeValue;
467
+                                    break;
468
+                                case 'Size':
469
+                                    $this->styles[$styleID]['font']['size'] = $styleAttributeValue;
470
+                                    break;
471
+                                case 'Color':
472
+                                    $this->styles[$styleID]['font']['color']['rgb'] = substr($styleAttributeValue, 1);
473
+                                    break;
474
+                                case 'Bold':
475
+                                    $this->styles[$styleID]['font']['bold'] = true;
476
+                                    break;
477
+                                case 'Italic':
478
+                                    $this->styles[$styleID]['font']['italic'] = true;
479
+                                    break;
480
+                                case 'Underline':
481
+                                    if (self::identifyFixedStyleValue($underlineStyles, $styleAttributeValue)) {
482
+                                        $this->styles[$styleID]['font']['underline'] = $styleAttributeValue;
483
+                                    }
484
+                                    break;
485
+                            }
486
+                        }
487
+                        break;
488
+                    case 'Interior':
489
+                        foreach ($styleAttributes as $styleAttributeKey => $styleAttributeValue) {
490
+//                                echo $styleAttributeKey.' = '.$styleAttributeValue.'<br />';
491
+                            switch ($styleAttributeKey) {
492
+                                case 'Color':
493
+                                    $this->styles[$styleID]['fill']['color']['rgb'] = substr($styleAttributeValue, 1);
494
+                                    break;
495
+                            }
496
+                        }
497
+                        break;
498
+                    case 'NumberFormat':
499
+                        foreach ($styleAttributes as $styleAttributeKey => $styleAttributeValue) {
500
+//                                echo $styleAttributeKey.' = '.$styleAttributeValue.'<br />';
501
+                            $styleAttributeValue = str_replace($fromFormats, $toFormats, $styleAttributeValue);
502
+                            switch ($styleAttributeValue) {
503
+                                case 'Short Date':
504
+                                    $styleAttributeValue = 'dd/mm/yyyy';
505
+                                    break;
506
+                            }
507
+                            if ($styleAttributeValue > '') {
508
+                                $this->styles[$styleID]['numberformat']['code'] = $styleAttributeValue;
509
+                            }
510
+                        }
511
+                        break;
512
+                    case 'Protection':
513
+                        foreach ($styleAttributes as $styleAttributeKey => $styleAttributeValue) {
514
+//                                echo $styleAttributeKey.' = '.$styleAttributeValue.'<br />';
515
+                        }
516
+                        break;
517
+                }
518
+            }
519
+//            print_r($this->styles[$styleID]);
520
+//            echo '<hr />';
521
+        }
522
+//        echo '<hr />';
523
+
524
+        $worksheetID = 0;
525
+        $xml_ss = $xml->children($namespaces['ss']);
526
+
527
+        foreach ($xml_ss->Worksheet as $worksheet) {
528
+            $worksheet_ss = $worksheet->attributes($namespaces['ss']);
529
+
530
+            if ((isset($this->loadSheetsOnly)) && (isset($worksheet_ss['Name'])) &&
531
+                (!in_array($worksheet_ss['Name'], $this->loadSheetsOnly))) {
532
+                continue;
533
+            }
534
+
535
+//            echo '<h3>Worksheet: ', $worksheet_ss['Name'],'<h3>';
536
+//
537
+            // Create new Worksheet
538
+            $objPHPExcel->createSheet();
539
+            $objPHPExcel->setActiveSheetIndex($worksheetID);
540
+            if (isset($worksheet_ss['Name'])) {
541
+                $worksheetName = self::convertStringEncoding((string) $worksheet_ss['Name'], $this->charSet);
542
+                //    Use false for $updateFormulaCellReferences to prevent adjustment of worksheet references in
543
+                //        formula cells... during the load, all formulae should be correct, and we're simply bringing
544
+                //        the worksheet name in line with the formula, not the reverse
545
+                $objPHPExcel->getActiveSheet()->setTitle($worksheetName, false);
546
+            }
547
+
548
+            $columnID = 'A';
549
+            if (isset($worksheet->Table->Column)) {
550
+                foreach ($worksheet->Table->Column as $columnData) {
551
+                    $columnData_ss = $columnData->attributes($namespaces['ss']);
552
+                    if (isset($columnData_ss['Index'])) {
553
+                        $columnID = PHPExcel_Cell::stringFromColumnIndex($columnData_ss['Index']-1);
554
+                    }
555
+                    if (isset($columnData_ss['Width'])) {
556
+                        $columnWidth = $columnData_ss['Width'];
557
+//                        echo '<b>Setting column width for '.$columnID.' to '.$columnWidth.'</b><br />';
558
+                        $objPHPExcel->getActiveSheet()->getColumnDimension($columnID)->setWidth($columnWidth / 5.4);
559
+                    }
560
+                    ++$columnID;
561
+                }
562
+            }
563
+
564
+            $rowID = 1;
565
+            if (isset($worksheet->Table->Row)) {
566
+                $additionalMergedCells = 0;
567
+                foreach ($worksheet->Table->Row as $rowData) {
568
+                    $rowHasData = false;
569
+                    $row_ss = $rowData->attributes($namespaces['ss']);
570
+                    if (isset($row_ss['Index'])) {
571
+                        $rowID = (integer) $row_ss['Index'];
572
+                    }
573
+//                    echo '<b>Row '.$rowID.'</b><br />';
574
+
575
+                    $columnID = 'A';
576
+                    foreach ($rowData->Cell as $cell) {
577
+                        $cell_ss = $cell->attributes($namespaces['ss']);
578
+                        if (isset($cell_ss['Index'])) {
579
+                            $columnID = PHPExcel_Cell::stringFromColumnIndex($cell_ss['Index']-1);
580
+                        }
581
+                        $cellRange = $columnID.$rowID;
582
+
583
+                        if ($this->getReadFilter() !== null) {
584
+                            if (!$this->getReadFilter()->readCell($columnID, $rowID, $worksheetName)) {
585
+                                continue;
586
+                            }
587
+                        }
588
+
589
+                        if ((isset($cell_ss['MergeAcross'])) || (isset($cell_ss['MergeDown']))) {
590
+                            $columnTo = $columnID;
591
+                            if (isset($cell_ss['MergeAcross'])) {
592
+                                $additionalMergedCells += (int)$cell_ss['MergeAcross'];
593
+                                $columnTo = PHPExcel_Cell::stringFromColumnIndex(PHPExcel_Cell::columnIndexFromString($columnID) + $cell_ss['MergeAcross'] -1);
594
+                            }
595
+                            $rowTo = $rowID;
596
+                            if (isset($cell_ss['MergeDown'])) {
597
+                                $rowTo = $rowTo + $cell_ss['MergeDown'];
598
+                            }
599
+                            $cellRange .= ':'.$columnTo.$rowTo;
600
+                            $objPHPExcel->getActiveSheet()->mergeCells($cellRange);
601
+                        }
602
+
603
+                        $cellIsSet = $hasCalculatedValue = false;
604
+                        $cellDataFormula = '';
605
+                        if (isset($cell_ss['Formula'])) {
606
+                            $cellDataFormula = $cell_ss['Formula'];
607
+                            // added this as a check for array formulas
608
+                            if (isset($cell_ss['ArrayRange'])) {
609
+                                $cellDataCSEFormula = $cell_ss['ArrayRange'];
610
+//                                echo "found an array formula at ".$columnID.$rowID."<br />";
611
+                            }
612
+                            $hasCalculatedValue = true;
613
+                        }
614
+                        if (isset($cell->Data)) {
615
+                            $cellValue = $cellData = $cell->Data;
616
+                            $type = PHPExcel_Cell_DataType::TYPE_NULL;
617
+                            $cellData_ss = $cellData->attributes($namespaces['ss']);
618
+                            if (isset($cellData_ss['Type'])) {
619
+                                $cellDataType = $cellData_ss['Type'];
620
+                                switch ($cellDataType) {
621
+                                    /*
622
+                                    const TYPE_STRING        = 's';
623
+                                    const TYPE_FORMULA        = 'f';
624
+                                    const TYPE_NUMERIC        = 'n';
625
+                                    const TYPE_BOOL            = 'b';
626
+                                    const TYPE_NULL            = 'null';
627
+                                    const TYPE_INLINE        = 'inlineStr';
628
+                                    const TYPE_ERROR        = 'e';
629
+                                    */
630
+                                    case 'String':
631
+                                        $cellValue = self::convertStringEncoding($cellValue, $this->charSet);
632
+                                        $type = PHPExcel_Cell_DataType::TYPE_STRING;
633
+                                        break;
634
+                                    case 'Number':
635
+                                        $type = PHPExcel_Cell_DataType::TYPE_NUMERIC;
636
+                                        $cellValue = (float) $cellValue;
637
+                                        if (floor($cellValue) == $cellValue) {
638
+                                            $cellValue = (integer) $cellValue;
639
+                                        }
640
+                                        break;
641
+                                    case 'Boolean':
642
+                                        $type = PHPExcel_Cell_DataType::TYPE_BOOL;
643
+                                        $cellValue = ($cellValue != 0);
644
+                                        break;
645
+                                    case 'DateTime':
646
+                                        $type = PHPExcel_Cell_DataType::TYPE_NUMERIC;
647
+                                        $cellValue = PHPExcel_Shared_Date::PHPToExcel(strtotime($cellValue));
648
+                                        break;
649
+                                    case 'Error':
650
+                                        $type = PHPExcel_Cell_DataType::TYPE_ERROR;
651
+                                        break;
652
+                                }
653
+                            }
654
+
655
+                            if ($hasCalculatedValue) {
656
+//                                echo 'FORMULA<br />';
657
+                                $type = PHPExcel_Cell_DataType::TYPE_FORMULA;
658
+                                $columnNumber = PHPExcel_Cell::columnIndexFromString($columnID);
659
+                                if (substr($cellDataFormula, 0, 3) == 'of:') {
660
+                                    $cellDataFormula = substr($cellDataFormula, 3);
661
+//                                    echo 'Before: ', $cellDataFormula,'<br />';
662
+                                    $temp = explode('"', $cellDataFormula);
663
+                                    $key = false;
664
+                                    foreach ($temp as &$value) {
665
+                                        //    Only replace in alternate array entries (i.e. non-quoted blocks)
666
+                                        if ($key = !$key) {
667
+                                            $value = str_replace(array('[.', '.', ']'), '', $value);
668
+                                        }
669
+                                    }
670
+                                } else {
671
+                                    //    Convert R1C1 style references to A1 style references (but only when not quoted)
672
+//                                    echo 'Before: ', $cellDataFormula,'<br />';
673
+                                    $temp = explode('"', $cellDataFormula);
674
+                                    $key = false;
675
+                                    foreach ($temp as &$value) {
676
+                                        //    Only replace in alternate array entries (i.e. non-quoted blocks)
677
+                                        if ($key = !$key) {
678
+                                            preg_match_all('/(R(\[?-?\d*\]?))(C(\[?-?\d*\]?))/', $value, $cellReferences, PREG_SET_ORDER + PREG_OFFSET_CAPTURE);
679
+                                            //    Reverse the matches array, otherwise all our offsets will become incorrect if we modify our way
680
+                                            //        through the formula from left to right. Reversing means that we work right to left.through
681
+                                            //        the formula
682
+                                            $cellReferences = array_reverse($cellReferences);
683
+                                            //    Loop through each R1C1 style reference in turn, converting it to its A1 style equivalent,
684
+                                            //        then modify the formula to use that new reference
685
+                                            foreach ($cellReferences as $cellReference) {
686
+                                                $rowReference = $cellReference[2][0];
687
+                                                //    Empty R reference is the current row
688
+                                                if ($rowReference == '') {
689
+                                                    $rowReference = $rowID;
690
+                                                }
691
+                                                //    Bracketed R references are relative to the current row
692
+                                                if ($rowReference{0} == '[') {
693
+                                                    $rowReference = $rowID + trim($rowReference, '[]');
694
+                                                }
695
+                                                $columnReference = $cellReference[4][0];
696
+                                                //    Empty C reference is the current column
697
+                                                if ($columnReference == '') {
698
+                                                    $columnReference = $columnNumber;
699
+                                                }
700
+                                                //    Bracketed C references are relative to the current column
701
+                                                if ($columnReference{0} == '[') {
702
+                                                    $columnReference = $columnNumber + trim($columnReference, '[]');
703
+                                                }
704
+                                                $A1CellReference = PHPExcel_Cell::stringFromColumnIndex($columnReference-1).$rowReference;
705
+                                                $value = substr_replace($value, $A1CellReference, $cellReference[0][1], strlen($cellReference[0][0]));
706
+                                            }
707
+                                        }
708
+                                    }
709
+                                }
710
+                                unset($value);
711
+                                //    Then rebuild the formula string
712
+                                $cellDataFormula = implode('"', $temp);
713
+//                                echo 'After: ', $cellDataFormula,'<br />';
714
+                            }
715
+
716
+//                            echo 'Cell '.$columnID.$rowID.' is a '.$type.' with a value of '.(($hasCalculatedValue) ? $cellDataFormula : $cellValue).'<br />';
717
+//
718
+                            $objPHPExcel->getActiveSheet()->getCell($columnID.$rowID)->setValueExplicit((($hasCalculatedValue) ? $cellDataFormula : $cellValue), $type);
719
+                            if ($hasCalculatedValue) {
720
+//                                echo 'Formula result is '.$cellValue.'<br />';
721
+                                $objPHPExcel->getActiveSheet()->getCell($columnID.$rowID)->setCalculatedValue($cellValue);
722
+                            }
723
+                            $cellIsSet = $rowHasData = true;
724
+                        }
725
+
726
+                        if (isset($cell->Comment)) {
727
+//                            echo '<b>comment found</b><br />';
728
+                            $commentAttributes = $cell->Comment->attributes($namespaces['ss']);
729
+                            $author = 'unknown';
730
+                            if (isset($commentAttributes->Author)) {
731
+                                $author = (string)$commentAttributes->Author;
732
+//                                echo 'Author: ', $author,'<br />';
733
+                            }
734
+                            $node = $cell->Comment->Data->asXML();
735
+//                            $annotation = str_replace('html:','',substr($node,49,-10));
736
+//                            echo $annotation,'<br />';
737
+                            $annotation = strip_tags($node);
738
+//                            echo 'Annotation: ', $annotation,'<br />';
739
+                            $objPHPExcel->getActiveSheet()->getComment($columnID.$rowID)->setAuthor(self::convertStringEncoding($author, $this->charSet))->setText($this->parseRichText($annotation));
740
+                        }
741
+
742
+                        if (($cellIsSet) && (isset($cell_ss['StyleID']))) {
743
+                            $style = (string) $cell_ss['StyleID'];
744
+//                            echo 'Cell style for '.$columnID.$rowID.' is '.$style.'<br />';
745
+                            if ((isset($this->styles[$style])) && (!empty($this->styles[$style]))) {
746
+//                                echo 'Cell '.$columnID.$rowID.'<br />';
747
+//                                print_r($this->styles[$style]);
748
+//                                echo '<br />';
749
+                                if (!$objPHPExcel->getActiveSheet()->cellExists($columnID.$rowID)) {
750
+                                    $objPHPExcel->getActiveSheet()->getCell($columnID.$rowID)->setValue(null);
751
+                                }
752
+                                $objPHPExcel->getActiveSheet()->getStyle($cellRange)->applyFromArray($this->styles[$style]);
753
+                            }
754
+                        }
755
+                        ++$columnID;
756
+                        while ($additionalMergedCells > 0) {
757
+                            ++$columnID;
758
+                            $additionalMergedCells--;
759
+                        }
760
+                    }
761
+
762
+                    if ($rowHasData) {
763
+                        if (isset($row_ss['StyleID'])) {
764
+                            $rowStyle = $row_ss['StyleID'];
765
+                        }
766
+                        if (isset($row_ss['Height'])) {
767
+                            $rowHeight = $row_ss['Height'];
768
+//                            echo '<b>Setting row height to '.$rowHeight.'</b><br />';
769
+                            $objPHPExcel->getActiveSheet()->getRowDimension($rowID)->setRowHeight($rowHeight);
770
+                        }
771
+                    }
772
+
773
+                    ++$rowID;
774
+                }
775
+            }
776
+            ++$worksheetID;
777
+        }
778
+
779
+        // Return
780
+        return $objPHPExcel;
781
+    }
782
+
783
+
784
+    protected static function convertStringEncoding($string, $charset)
785
+    {
786
+        if ($charset != 'UTF-8') {
787
+            return PHPExcel_Shared_String::ConvertEncoding($string, 'UTF-8', $charset);
788
+        }
789
+        return $string;
790
+    }
791
+
792
+
793
+    protected function parseRichText($is = '')
794
+    {
795
+        $value = new PHPExcel_RichText();
796
+
797
+        $value->createText(self::convertStringEncoding($is, $this->charSet));
798
+
799
+        return $value;
800
+    }
801
+}

+ 2051
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Excel2007.php
File diff suppressed because it is too large
View File


+ 520
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Excel2007/Chart.php View File

@@ -0,0 +1,520 @@
1
+<?php
2
+/**
3
+ * PHPExcel
4
+ *
5
+ * Copyright (c) 2006 - 2015 PHPExcel
6
+ *
7
+ * This library is free software; you can redistribute it and/or
8
+ * modify it under the terms of the GNU Lesser General Public
9
+ * License as published by the Free Software Foundation; either
10
+ * version 2.1 of the License, or (at your option) any later version.
11
+ *
12
+ * This library is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
+ * Lesser General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU Lesser General Public
18
+ * License along with this library; if not, write to the Free Software
19
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
20
+ *
21
+ * @category    PHPExcel
22
+ * @package        PHPExcel_Reader_Excel2007
23
+ * @copyright    Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
24
+ * @license        http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
25
+ * @version        ##VERSION##, ##DATE##
26
+ */
27
+
28
+/**
29
+ * PHPExcel_Reader_Excel2007_Chart
30
+ *
31
+ * @category    PHPExcel
32
+ * @package        PHPExcel_Reader_Excel2007
33
+ * @copyright    Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
34
+ */
35
+class PHPExcel_Reader_Excel2007_Chart
36
+{
37
+    private static function getAttribute($component, $name, $format)
38
+    {
39
+        $attributes = $component->attributes();
40
+        if (isset($attributes[$name])) {
41
+            if ($format == 'string') {
42
+                return (string) $attributes[$name];
43
+            } elseif ($format == 'integer') {
44
+                return (integer) $attributes[$name];
45
+            } elseif ($format == 'boolean') {
46
+                return (boolean) ($attributes[$name] === '0' || $attributes[$name] !== 'true') ? false : true;
47
+            } else {
48
+                return (float) $attributes[$name];
49
+            }
50
+        }
51
+        return null;
52
+    }
53
+
54
+
55
+    private static function readColor($color, $background = false)
56
+    {
57
+        if (isset($color["rgb"])) {
58
+            return (string)$color["rgb"];
59
+        } elseif (isset($color["indexed"])) {
60
+            return PHPExcel_Style_Color::indexedColor($color["indexed"]-7, $background)->getARGB();
61
+        }
62
+    }
63
+
64
+    public static function readChart($chartElements, $chartName)
65
+    {
66
+        $namespacesChartMeta = $chartElements->getNamespaces(true);
67
+        $chartElementsC = $chartElements->children($namespacesChartMeta['c']);
68
+
69
+        $XaxisLabel = $YaxisLabel = $legend = $title = null;
70
+        $dispBlanksAs = $plotVisOnly = null;
71
+
72
+        foreach ($chartElementsC as $chartElementKey => $chartElement) {
73
+            switch ($chartElementKey) {
74
+                case "chart":
75
+                    foreach ($chartElement as $chartDetailsKey => $chartDetails) {
76
+                        $chartDetailsC = $chartDetails->children($namespacesChartMeta['c']);
77
+                        switch ($chartDetailsKey) {
78
+                            case "plotArea":
79
+                                $plotAreaLayout = $XaxisLable = $YaxisLable = null;
80
+                                $plotSeries = $plotAttributes = array();
81
+                                foreach ($chartDetails as $chartDetailKey => $chartDetail) {
82
+                                    switch ($chartDetailKey) {
83
+                                        case "layout":
84
+                                            $plotAreaLayout = self::chartLayoutDetails($chartDetail, $namespacesChartMeta, 'plotArea');
85
+                                            break;
86
+                                        case "catAx":
87
+                                            if (isset($chartDetail->title)) {
88
+                                                $XaxisLabel = self::chartTitle($chartDetail->title->children($namespacesChartMeta['c']), $namespacesChartMeta, 'cat');
89
+                                            }
90
+                                            break;
91
+                                        case "dateAx":
92
+                                            if (isset($chartDetail->title)) {
93
+                                                $XaxisLabel = self::chartTitle($chartDetail->title->children($namespacesChartMeta['c']), $namespacesChartMeta, 'cat');
94
+                                            }
95
+                                            break;
96
+                                        case "valAx":
97
+                                            if (isset($chartDetail->title)) {
98
+                                                $YaxisLabel = self::chartTitle($chartDetail->title->children($namespacesChartMeta['c']), $namespacesChartMeta, 'cat');
99
+                                            }
100
+                                            break;
101
+                                        case "barChart":
102
+                                        case "bar3DChart":
103
+                                            $barDirection = self::getAttribute($chartDetail->barDir, 'val', 'string');
104
+                                            $plotSer = self::chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey);
105
+                                            $plotSer->setPlotDirection($barDirection);
106
+                                            $plotSeries[] = $plotSer;
107
+                                            $plotAttributes = self::readChartAttributes($chartDetail);
108
+                                            break;
109
+                                        case "lineChart":
110
+                                        case "line3DChart":
111
+                                            $plotSeries[] = self::chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey);
112
+                                            $plotAttributes = self::readChartAttributes($chartDetail);
113
+                                            break;
114
+                                        case "areaChart":
115
+                                        case "area3DChart":
116
+                                            $plotSeries[] = self::chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey);
117
+                                            $plotAttributes = self::readChartAttributes($chartDetail);
118
+                                            break;
119
+                                        case "doughnutChart":
120
+                                        case "pieChart":
121
+                                        case "pie3DChart":
122
+                                            $explosion = isset($chartDetail->ser->explosion);
123
+                                            $plotSer = self::chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey);
124
+                                            $plotSer->setPlotStyle($explosion);
125
+                                            $plotSeries[] = $plotSer;
126
+                                            $plotAttributes = self::readChartAttributes($chartDetail);
127
+                                            break;
128
+                                        case "scatterChart":
129
+                                            $scatterStyle = self::getAttribute($chartDetail->scatterStyle, 'val', 'string');
130
+                                            $plotSer = self::chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey);
131
+                                            $plotSer->setPlotStyle($scatterStyle);
132
+                                            $plotSeries[] = $plotSer;
133
+                                            $plotAttributes = self::readChartAttributes($chartDetail);
134
+                                            break;
135
+                                        case "bubbleChart":
136
+                                            $bubbleScale = self::getAttribute($chartDetail->bubbleScale, 'val', 'integer');
137
+                                            $plotSer = self::chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey);
138
+                                            $plotSer->setPlotStyle($bubbleScale);
139
+                                            $plotSeries[] = $plotSer;
140
+                                            $plotAttributes = self::readChartAttributes($chartDetail);
141
+                                            break;
142
+                                        case "radarChart":
143
+                                            $radarStyle = self::getAttribute($chartDetail->radarStyle, 'val', 'string');
144
+                                            $plotSer = self::chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey);
145
+                                            $plotSer->setPlotStyle($radarStyle);
146
+                                            $plotSeries[] = $plotSer;
147
+                                            $plotAttributes = self::readChartAttributes($chartDetail);
148
+                                            break;
149
+                                        case "surfaceChart":
150
+                                        case "surface3DChart":
151
+                                            $wireFrame = self::getAttribute($chartDetail->wireframe, 'val', 'boolean');
152
+                                            $plotSer = self::chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey);
153
+                                            $plotSer->setPlotStyle($wireFrame);
154
+                                            $plotSeries[] = $plotSer;
155
+                                            $plotAttributes = self::readChartAttributes($chartDetail);
156
+                                            break;
157
+                                        case "stockChart":
158
+                                            $plotSeries[] = self::chartDataSeries($chartDetail, $namespacesChartMeta, $chartDetailKey);
159
+                                            $plotAttributes = self::readChartAttributes($plotAreaLayout);
160
+                                            break;
161
+                                    }
162
+                                }
163
+                                if ($plotAreaLayout == null) {
164
+                                    $plotAreaLayout = new PHPExcel_Chart_Layout();
165
+                                }
166
+                                $plotArea = new PHPExcel_Chart_PlotArea($plotAreaLayout, $plotSeries);
167
+                                self::setChartAttributes($plotAreaLayout, $plotAttributes);
168
+                                break;
169
+                            case "plotVisOnly":
170
+                                $plotVisOnly = self::getAttribute($chartDetails, 'val', 'string');
171
+                                break;
172
+                            case "dispBlanksAs":
173
+                                $dispBlanksAs = self::getAttribute($chartDetails, 'val', 'string');
174
+                                break;
175
+                            case "title":
176
+                                $title = self::chartTitle($chartDetails, $namespacesChartMeta, 'title');
177
+                                break;
178
+                            case "legend":
179
+                                $legendPos = 'r';
180
+                                $legendLayout = null;
181
+                                $legendOverlay = false;
182
+                                foreach ($chartDetails as $chartDetailKey => $chartDetail) {
183
+                                    switch ($chartDetailKey) {
184
+                                        case "legendPos":
185
+                                            $legendPos = self::getAttribute($chartDetail, 'val', 'string');
186
+                                            break;
187
+                                        case "overlay":
188
+                                            $legendOverlay = self::getAttribute($chartDetail, 'val', 'boolean');
189
+                                            break;
190
+                                        case "layout":
191
+                                            $legendLayout = self::chartLayoutDetails($chartDetail, $namespacesChartMeta, 'legend');
192
+                                            break;
193
+                                    }
194
+                                }
195
+                                $legend = new PHPExcel_Chart_Legend($legendPos, $legendLayout, $legendOverlay);
196
+                                break;
197
+                        }
198
+                    }
199
+            }
200
+        }
201
+        $chart = new PHPExcel_Chart($chartName, $title, $legend, $plotArea, $plotVisOnly, $dispBlanksAs, $XaxisLabel, $YaxisLabel);
202
+
203
+        return $chart;
204
+    }
205
+
206
+    private static function chartTitle($titleDetails, $namespacesChartMeta, $type)
207
+    {
208
+        $caption = array();
209
+        $titleLayout = null;
210
+        foreach ($titleDetails as $titleDetailKey => $chartDetail) {
211
+            switch ($titleDetailKey) {
212
+                case "tx":
213
+                    $titleDetails = $chartDetail->rich->children($namespacesChartMeta['a']);
214
+                    foreach ($titleDetails as $titleKey => $titleDetail) {
215
+                        switch ($titleKey) {
216
+                            case "p":
217
+                                $titleDetailPart = $titleDetail->children($namespacesChartMeta['a']);
218
+                                $caption[] = self::parseRichText($titleDetailPart);
219
+                        }
220
+                    }
221
+                    break;
222
+                case "layout":
223
+                    $titleLayout = self::chartLayoutDetails($chartDetail, $namespacesChartMeta);
224
+                    break;
225
+            }
226
+        }
227
+
228
+        return new PHPExcel_Chart_Title($caption, $titleLayout);
229
+    }
230
+
231
+    private static function chartLayoutDetails($chartDetail, $namespacesChartMeta)
232
+    {
233
+        if (!isset($chartDetail->manualLayout)) {
234
+            return null;
235
+        }
236
+        $details = $chartDetail->manualLayout->children($namespacesChartMeta['c']);
237
+        if (is_null($details)) {
238
+            return null;
239
+        }
240
+        $layout = array();
241
+        foreach ($details as $detailKey => $detail) {
242
+//            echo $detailKey, ' => ',self::getAttribute($detail, 'val', 'string'),PHP_EOL;
243
+            $layout[$detailKey] = self::getAttribute($detail, 'val', 'string');
244
+        }
245
+        return new PHPExcel_Chart_Layout($layout);
246
+    }
247
+
248
+    private static function chartDataSeries($chartDetail, $namespacesChartMeta, $plotType)
249
+    {
250
+        $multiSeriesType = null;
251
+        $smoothLine = false;
252
+        $seriesLabel = $seriesCategory = $seriesValues = $plotOrder = array();
253
+
254
+        $seriesDetailSet = $chartDetail->children($namespacesChartMeta['c']);
255
+        foreach ($seriesDetailSet as $seriesDetailKey => $seriesDetails) {
256
+            switch ($seriesDetailKey) {
257
+                case "grouping":
258
+                    $multiSeriesType = self::getAttribute($chartDetail->grouping, 'val', 'string');
259
+                    break;
260
+                case "ser":
261
+                    $marker = null;
262
+                    foreach ($seriesDetails as $seriesKey => $seriesDetail) {
263
+                        switch ($seriesKey) {
264
+                            case "idx":
265
+                                $seriesIndex = self::getAttribute($seriesDetail, 'val', 'integer');
266
+                                break;
267
+                            case "order":
268
+                                $seriesOrder = self::getAttribute($seriesDetail, 'val', 'integer');
269
+                                $plotOrder[$seriesIndex] = $seriesOrder;
270
+                                break;
271
+                            case "tx":
272
+                                $seriesLabel[$seriesIndex] = self::chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta);
273
+                                break;
274
+                            case "marker":
275
+                                $marker = self::getAttribute($seriesDetail->symbol, 'val', 'string');
276
+                                break;
277
+                            case "smooth":
278
+                                $smoothLine = self::getAttribute($seriesDetail, 'val', 'boolean');
279
+                                break;
280
+                            case "cat":
281
+                                $seriesCategory[$seriesIndex] = self::chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta);
282
+                                break;
283
+                            case "val":
284
+                                $seriesValues[$seriesIndex] = self::chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta, $marker);
285
+                                break;
286
+                            case "xVal":
287
+                                $seriesCategory[$seriesIndex] = self::chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta, $marker);
288
+                                break;
289
+                            case "yVal":
290
+                                $seriesValues[$seriesIndex] = self::chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta, $marker);
291
+                                break;
292
+                        }
293
+                    }
294
+            }
295
+        }
296
+        return new PHPExcel_Chart_DataSeries($plotType, $multiSeriesType, $plotOrder, $seriesLabel, $seriesCategory, $seriesValues, $smoothLine);
297
+    }
298
+
299
+
300
+    private static function chartDataSeriesValueSet($seriesDetail, $namespacesChartMeta, $marker = null, $smoothLine = false)
301
+    {
302
+        if (isset($seriesDetail->strRef)) {
303
+            $seriesSource = (string) $seriesDetail->strRef->f;
304
+            $seriesData = self::chartDataSeriesValues($seriesDetail->strRef->strCache->children($namespacesChartMeta['c']), 's');
305
+
306
+            return new PHPExcel_Chart_DataSeriesValues('String', $seriesSource, $seriesData['formatCode'], $seriesData['pointCount'], $seriesData['dataValues'], $marker, $smoothLine);
307
+        } elseif (isset($seriesDetail->numRef)) {
308
+            $seriesSource = (string) $seriesDetail->numRef->f;
309
+            $seriesData = self::chartDataSeriesValues($seriesDetail->numRef->numCache->children($namespacesChartMeta['c']));
310
+
311
+            return new PHPExcel_Chart_DataSeriesValues('Number', $seriesSource, $seriesData['formatCode'], $seriesData['pointCount'], $seriesData['dataValues'], $marker, $smoothLine);
312
+        } elseif (isset($seriesDetail->multiLvlStrRef)) {
313
+            $seriesSource = (string) $seriesDetail->multiLvlStrRef->f;
314
+            $seriesData = self::chartDataSeriesValuesMultiLevel($seriesDetail->multiLvlStrRef->multiLvlStrCache->children($namespacesChartMeta['c']), 's');
315
+            $seriesData['pointCount'] = count($seriesData['dataValues']);
316
+
317
+            return new PHPExcel_Chart_DataSeriesValues('String', $seriesSource, $seriesData['formatCode'], $seriesData['pointCount'], $seriesData['dataValues'], $marker, $smoothLine);
318
+        } elseif (isset($seriesDetail->multiLvlNumRef)) {
319
+            $seriesSource = (string) $seriesDetail->multiLvlNumRef->f;
320
+            $seriesData = self::chartDataSeriesValuesMultiLevel($seriesDetail->multiLvlNumRef->multiLvlNumCache->children($namespacesChartMeta['c']), 's');
321
+            $seriesData['pointCount'] = count($seriesData['dataValues']);
322
+
323
+            return new PHPExcel_Chart_DataSeriesValues('String', $seriesSource, $seriesData['formatCode'], $seriesData['pointCount'], $seriesData['dataValues'], $marker, $smoothLine);
324
+        }
325
+        return null;
326
+    }
327
+
328
+
329
+    private static function chartDataSeriesValues($seriesValueSet, $dataType = 'n')
330
+    {
331
+        $seriesVal = array();
332
+        $formatCode = '';
333
+        $pointCount = 0;
334
+
335
+        foreach ($seriesValueSet as $seriesValueIdx => $seriesValue) {
336
+            switch ($seriesValueIdx) {
337
+                case 'ptCount':
338
+                    $pointCount = self::getAttribute($seriesValue, 'val', 'integer');
339
+                    break;
340
+                case 'formatCode':
341
+                    $formatCode = (string) $seriesValue;
342
+                    break;
343
+                case 'pt':
344
+                    $pointVal = self::getAttribute($seriesValue, 'idx', 'integer');
345
+                    if ($dataType == 's') {
346
+                        $seriesVal[$pointVal] = (string) $seriesValue->v;
347
+                    } else {
348
+                        $seriesVal[$pointVal] = (float) $seriesValue->v;
349
+                    }
350
+                    break;
351
+            }
352
+        }
353
+
354
+        return array(
355
+            'formatCode'    => $formatCode,
356
+            'pointCount'    => $pointCount,
357
+            'dataValues'    => $seriesVal
358
+        );
359
+    }
360
+
361
+    private static function chartDataSeriesValuesMultiLevel($seriesValueSet, $dataType = 'n')
362
+    {
363
+        $seriesVal = array();
364
+        $formatCode = '';
365
+        $pointCount = 0;
366
+
367
+        foreach ($seriesValueSet->lvl as $seriesLevelIdx => $seriesLevel) {
368
+            foreach ($seriesLevel as $seriesValueIdx => $seriesValue) {
369
+                switch ($seriesValueIdx) {
370
+                    case 'ptCount':
371
+                        $pointCount = self::getAttribute($seriesValue, 'val', 'integer');
372
+                        break;
373
+                    case 'formatCode':
374
+                        $formatCode = (string) $seriesValue;
375
+                        break;
376
+                    case 'pt':
377
+                        $pointVal = self::getAttribute($seriesValue, 'idx', 'integer');
378
+                        if ($dataType == 's') {
379
+                            $seriesVal[$pointVal][] = (string) $seriesValue->v;
380
+                        } else {
381
+                            $seriesVal[$pointVal][] = (float) $seriesValue->v;
382
+                        }
383
+                        break;
384
+                }
385
+            }
386
+        }
387
+
388
+        return array(
389
+            'formatCode'    => $formatCode,
390
+            'pointCount'    => $pointCount,
391
+            'dataValues'    => $seriesVal
392
+        );
393
+    }
394
+
395
+    private static function parseRichText($titleDetailPart = null)
396
+    {
397
+        $value = new PHPExcel_RichText();
398
+
399
+        foreach ($titleDetailPart as $titleDetailElementKey => $titleDetailElement) {
400
+            if (isset($titleDetailElement->t)) {
401
+                $objText = $value->createTextRun((string) $titleDetailElement->t);
402
+            }
403
+            if (isset($titleDetailElement->rPr)) {
404
+                if (isset($titleDetailElement->rPr->rFont["val"])) {
405
+                    $objText->getFont()->setName((string) $titleDetailElement->rPr->rFont["val"]);
406
+                }
407
+
408
+                $fontSize = (self::getAttribute($titleDetailElement->rPr, 'sz', 'integer'));
409
+                if (!is_null($fontSize)) {
410
+                    $objText->getFont()->setSize(floor($fontSize / 100));
411
+                }
412
+
413
+                $fontColor = (self::getAttribute($titleDetailElement->rPr, 'color', 'string'));
414
+                if (!is_null($fontColor)) {
415
+                    $objText->getFont()->setColor(new PHPExcel_Style_Color(self::readColor($fontColor)));
416
+                }
417
+
418
+                $bold = self::getAttribute($titleDetailElement->rPr, 'b', 'boolean');
419
+                if (!is_null($bold)) {
420
+                    $objText->getFont()->setBold($bold);
421
+                }
422
+
423
+                $italic = self::getAttribute($titleDetailElement->rPr, 'i', 'boolean');
424
+                if (!is_null($italic)) {
425
+                    $objText->getFont()->setItalic($italic);
426
+                }
427
+
428
+                $baseline = self::getAttribute($titleDetailElement->rPr, 'baseline', 'integer');
429
+                if (!is_null($baseline)) {
430
+                    if ($baseline > 0) {
431
+                        $objText->getFont()->setSuperScript(true);
432
+                    } elseif ($baseline < 0) {
433
+                        $objText->getFont()->setSubScript(true);
434
+                    }
435
+                }
436
+
437
+                $underscore = (self::getAttribute($titleDetailElement->rPr, 'u', 'string'));
438
+                if (!is_null($underscore)) {
439
+                    if ($underscore == 'sng') {
440
+                        $objText->getFont()->setUnderline(PHPExcel_Style_Font::UNDERLINE_SINGLE);
441
+                    } elseif ($underscore == 'dbl') {
442
+                        $objText->getFont()->setUnderline(PHPExcel_Style_Font::UNDERLINE_DOUBLE);
443
+                    } else {
444
+                        $objText->getFont()->setUnderline(PHPExcel_Style_Font::UNDERLINE_NONE);
445
+                    }
446
+                }
447
+
448
+                $strikethrough = (self::getAttribute($titleDetailElement->rPr, 's', 'string'));
449
+                if (!is_null($strikethrough)) {
450
+                    if ($strikethrough == 'noStrike') {
451
+                        $objText->getFont()->setStrikethrough(false);
452
+                    } else {
453
+                        $objText->getFont()->setStrikethrough(true);
454
+                    }
455
+                }
456
+            }
457
+        }
458
+
459
+        return $value;
460
+    }
461
+
462
+    private static function readChartAttributes($chartDetail)
463
+    {
464
+        $plotAttributes = array();
465
+        if (isset($chartDetail->dLbls)) {
466
+            if (isset($chartDetail->dLbls->howLegendKey)) {
467
+                $plotAttributes['showLegendKey'] = self::getAttribute($chartDetail->dLbls->showLegendKey, 'val', 'string');
468
+            }
469
+            if (isset($chartDetail->dLbls->showVal)) {
470
+                $plotAttributes['showVal'] = self::getAttribute($chartDetail->dLbls->showVal, 'val', 'string');
471
+            }
472
+            if (isset($chartDetail->dLbls->showCatName)) {
473
+                $plotAttributes['showCatName'] = self::getAttribute($chartDetail->dLbls->showCatName, 'val', 'string');
474
+            }
475
+            if (isset($chartDetail->dLbls->showSerName)) {
476
+                $plotAttributes['showSerName'] = self::getAttribute($chartDetail->dLbls->showSerName, 'val', 'string');
477
+            }
478
+            if (isset($chartDetail->dLbls->showPercent)) {
479
+                $plotAttributes['showPercent'] = self::getAttribute($chartDetail->dLbls->showPercent, 'val', 'string');
480
+            }
481
+            if (isset($chartDetail->dLbls->showBubbleSize)) {
482
+                $plotAttributes['showBubbleSize'] = self::getAttribute($chartDetail->dLbls->showBubbleSize, 'val', 'string');
483
+            }
484
+            if (isset($chartDetail->dLbls->showLeaderLines)) {
485
+                $plotAttributes['showLeaderLines'] = self::getAttribute($chartDetail->dLbls->showLeaderLines, 'val', 'string');
486
+            }
487
+        }
488
+
489
+        return $plotAttributes;
490
+    }
491
+
492
+    private static function setChartAttributes($plotArea, $plotAttributes)
493
+    {
494
+        foreach ($plotAttributes as $plotAttributeKey => $plotAttributeValue) {
495
+            switch ($plotAttributeKey) {
496
+                case 'showLegendKey':
497
+                    $plotArea->setShowLegendKey($plotAttributeValue);
498
+                    break;
499
+                case 'showVal':
500
+                    $plotArea->setShowVal($plotAttributeValue);
501
+                    break;
502
+                case 'showCatName':
503
+                    $plotArea->setShowCatName($plotAttributeValue);
504
+                    break;
505
+                case 'showSerName':
506
+                    $plotArea->setShowSerName($plotAttributeValue);
507
+                    break;
508
+                case 'showPercent':
509
+                    $plotArea->setShowPercent($plotAttributeValue);
510
+                    break;
511
+                case 'showBubbleSize':
512
+                    $plotArea->setShowBubbleSize($plotAttributeValue);
513
+                    break;
514
+                case 'showLeaderLines':
515
+                    $plotArea->setShowLeaderLines($plotAttributeValue);
516
+                    break;
517
+            }
518
+        }
519
+    }
520
+}

+ 127
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Excel2007/Theme.php View File

@@ -0,0 +1,127 @@
1
+<?php
2
+/**
3
+ * PHPExcel
4
+ *
5
+ * Copyright (c) 2006 - 2015 PHPExcel
6
+ *
7
+ * This library is free software; you can redistribute it and/or
8
+ * modify it under the terms of the GNU Lesser General Public
9
+ * License as published by the Free Software Foundation; either
10
+ * version 2.1 of the License, or (at your option) any later version.
11
+ *
12
+ * This library is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
+ * Lesser General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU Lesser General Public
18
+ * License along with this library; if not, write to the Free Software
19
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
20
+ *
21
+ * @category   PHPExcel
22
+ * @package    PHPExcel_Reader_Excel2007
23
+ * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
24
+ * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
25
+ * @version    ##VERSION##, ##DATE##
26
+ */
27
+
28
+
29
+/**
30
+ * PHPExcel_Reader_Excel2007_Theme
31
+ *
32
+ * @category   PHPExcel
33
+ * @package    PHPExcel_Reader_Excel2007
34
+ * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
35
+ */
36
+class PHPExcel_Reader_Excel2007_Theme
37
+{
38
+    /**
39
+     * Theme Name
40
+     *
41
+     * @var string
42
+     */
43
+    private $themeName;
44
+
45
+    /**
46
+     * Colour Scheme Name
47
+     *
48
+     * @var string
49
+     */
50
+    private $colourSchemeName;
51
+
52
+    /**
53
+     * Colour Map indexed by position
54
+     *
55
+     * @var array of string
56
+     */
57
+    private $colourMapValues;
58
+
59
+
60
+    /**
61
+     * Colour Map
62
+     *
63
+     * @var array of string
64
+     */
65
+    private $colourMap;
66
+
67
+
68
+    /**
69
+     * Create a new PHPExcel_Theme
70
+     *
71
+     */
72
+    public function __construct($themeName, $colourSchemeName, $colourMap)
73
+    {
74
+        // Initialise values
75
+        $this->themeName        = $themeName;
76
+        $this->colourSchemeName = $colourSchemeName;
77
+        $this->colourMap        = $colourMap;
78
+    }
79
+
80
+    /**
81
+     * Get Theme Name
82
+     *
83
+     * @return string
84
+     */
85
+    public function getThemeName()
86
+    {
87
+        return $this->themeName;
88
+    }
89
+
90
+    /**
91
+     * Get colour Scheme Name
92
+     *
93
+     * @return string
94
+     */
95
+    public function getColourSchemeName()
96
+    {
97
+        return $this->colourSchemeName;
98
+    }
99
+
100
+    /**
101
+     * Get colour Map Value by Position
102
+     *
103
+     * @return string
104
+     */
105
+    public function getColourByIndex($index = 0)
106
+    {
107
+        if (isset($this->colourMap[$index])) {
108
+            return $this->colourMap[$index];
109
+        }
110
+        return null;
111
+    }
112
+
113
+    /**
114
+     * Implement PHP __clone to create a deep clone, not just a shallow copy.
115
+     */
116
+    public function __clone()
117
+    {
118
+        $vars = get_object_vars($this);
119
+        foreach ($vars as $key => $value) {
120
+            if ((is_object($value)) && ($key != '_parent')) {
121
+                $this->$key = clone $value;
122
+            } else {
123
+                $this->$key = $value;
124
+            }
125
+        }
126
+    }
127
+}

+ 7594
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Excel5.php
File diff suppressed because it is too large
View File


+ 32
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Excel5/Color.php View File

@@ -0,0 +1,32 @@
1
+<?php
2
+
3
+class PHPExcel_Reader_Excel5_Color
4
+{
5
+    /**
6
+     * Read color
7
+     *
8
+     * @param int $color Indexed color
9
+     * @param array $palette Color palette
10
+     * @return array RGB color value, example: array('rgb' => 'FF0000')
11
+     */
12
+    public static function map($color, $palette, $version)
13
+    {
14
+        if ($color <= 0x07 || $color >= 0x40) {
15
+            // special built-in color
16
+            return PHPExcel_Reader_Excel5_Color_BuiltIn::lookup($color);
17
+        } elseif (isset($palette) && isset($palette[$color - 8])) {
18
+            // palette color, color index 0x08 maps to pallete index 0
19
+            return $palette[$color - 8];
20
+        } else {
21
+            // default color table
22
+            if ($version == PHPExcel_Reader_Excel5::XLS_BIFF8) {
23
+                return PHPExcel_Reader_Excel5_Color_BIFF8::lookup($color);
24
+            } else {
25
+                // BIFF5
26
+                return PHPExcel_Reader_Excel5_Color_BIFF5::lookup($color);
27
+            }
28
+        }
29
+
30
+        return $color;
31
+    }
32
+}

+ 77
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Excel5/Color/BIFF5.php View File

@@ -0,0 +1,77 @@
1
+<?php
2
+
3
+class PHPExcel_Reader_Excel5_Color_BIFF5
4
+{
5
+    protected static $map = array(
6
+        0x08 => '000000',
7
+        0x09 => 'FFFFFF',
8
+        0x0A => 'FF0000',
9
+        0x0B => '00FF00',
10
+        0x0C => '0000FF',
11
+        0x0D => 'FFFF00',
12
+        0x0E => 'FF00FF',
13
+        0x0F => '00FFFF',
14
+        0x10 => '800000',
15
+        0x11 => '008000',
16
+        0x12 => '000080',
17
+        0x13 => '808000',
18
+        0x14 => '800080',
19
+        0x15 => '008080',
20
+        0x16 => 'C0C0C0',
21
+        0x17 => '808080',
22
+        0x18 => '8080FF',
23
+        0x19 => '802060',
24
+        0x1A => 'FFFFC0',
25
+        0x1B => 'A0E0F0',
26
+        0x1C => '600080',
27
+        0x1D => 'FF8080',
28
+        0x1E => '0080C0',
29
+        0x1F => 'C0C0FF',
30
+        0x20 => '000080',
31
+        0x21 => 'FF00FF',
32
+        0x22 => 'FFFF00',
33
+        0x23 => '00FFFF',
34
+        0x24 => '800080',
35
+        0x25 => '800000',
36
+        0x26 => '008080',
37
+        0x27 => '0000FF',
38
+        0x28 => '00CFFF',
39
+        0x29 => '69FFFF',
40
+        0x2A => 'E0FFE0',
41
+        0x2B => 'FFFF80',
42
+        0x2C => 'A6CAF0',
43
+        0x2D => 'DD9CB3',
44
+        0x2E => 'B38FEE',
45
+        0x2F => 'E3E3E3',
46
+        0x30 => '2A6FF9',
47
+        0x31 => '3FB8CD',
48
+        0x32 => '488436',
49
+        0x33 => '958C41',
50
+        0x34 => '8E5E42',
51
+        0x35 => 'A0627A',
52
+        0x36 => '624FAC',
53
+        0x37 => '969696',
54
+        0x38 => '1D2FBE',
55
+        0x39 => '286676',
56
+        0x3A => '004500',
57
+        0x3B => '453E01',
58
+        0x3C => '6A2813',
59
+        0x3D => '85396A',
60
+        0x3E => '4A3285',
61
+        0x3F => '424242',
62
+    );
63
+
64
+    /**
65
+     * Map color array from BIFF5 built-in color index
66
+     *
67
+     * @param int $color
68
+     * @return array
69
+     */
70
+    public static function lookup($color)
71
+    {
72
+        if (isset(self::$map[$color])) {
73
+            return array('rgb' => self::$map[$color]);
74
+        }
75
+        return array('rgb' => '000000');
76
+    }
77
+}

+ 77
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Excel5/Color/BIFF8.php View File

@@ -0,0 +1,77 @@
1
+<?php
2
+
3
+class PHPExcel_Reader_Excel5_Color_BIFF8
4
+{
5
+    protected static $map = array(
6
+        0x08 => '000000',
7
+        0x09 => 'FFFFFF',
8
+        0x0A => 'FF0000',
9
+        0x0B => '00FF00',
10
+        0x0C => '0000FF',
11
+        0x0D => 'FFFF00',
12
+        0x0E => 'FF00FF',
13
+        0x0F => '00FFFF',
14
+        0x10 => '800000',
15
+        0x11 => '008000',
16
+        0x12 => '000080',
17
+        0x13 => '808000',
18
+        0x14 => '800080',
19
+        0x15 => '008080',
20
+        0x16 => 'C0C0C0',
21
+        0x17 => '808080',
22
+        0x18 => '9999FF',
23
+        0x19 => '993366',
24
+        0x1A => 'FFFFCC',
25
+        0x1B => 'CCFFFF',
26
+        0x1C => '660066',
27
+        0x1D => 'FF8080',
28
+        0x1E => '0066CC',
29
+        0x1F => 'CCCCFF',
30
+        0x20 => '000080',
31
+        0x21 => 'FF00FF',
32
+        0x22 => 'FFFF00',
33
+        0x23 => '00FFFF',
34
+        0x24 => '800080',
35
+        0x25 => '800000',
36
+        0x26 => '008080',
37
+        0x27 => '0000FF',
38
+        0x28 => '00CCFF',
39
+        0x29 => 'CCFFFF',
40
+        0x2A => 'CCFFCC',
41
+        0x2B => 'FFFF99',
42
+        0x2C => '99CCFF',
43
+        0x2D => 'FF99CC',
44
+        0x2E => 'CC99FF',
45
+        0x2F => 'FFCC99',
46
+        0x30 => '3366FF',
47
+        0x31 => '33CCCC',
48
+        0x32 => '99CC00',
49
+        0x33 => 'FFCC00',
50
+        0x34 => 'FF9900',
51
+        0x35 => 'FF6600',
52
+        0x36 => '666699',
53
+        0x37 => '969696',
54
+        0x38 => '003366',
55
+        0x39 => '339966',
56
+        0x3A => '003300',
57
+        0x3B => '333300',
58
+        0x3C => '993300',
59
+        0x3D => '993366',
60
+        0x3E => '333399',
61
+        0x3F => '333333',
62
+    );
63
+
64
+   /**
65
+     * Map color array from BIFF8 built-in color index
66
+     *
67
+     * @param int $color
68
+     * @return array
69
+     */
70
+    public static function lookup($color)
71
+    {
72
+        if (isset(self::$map[$color])) {
73
+            return array('rgb' => self::$map[$color]);
74
+        }
75
+        return array('rgb' => '000000');
76
+    }
77
+}

+ 31
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Excel5/Color/BuiltIn.php View File

@@ -0,0 +1,31 @@
1
+<?php
2
+
3
+class PHPExcel_Reader_Excel5_Color_BuiltIn
4
+{
5
+    protected static $map = array(
6
+        0x00 => '000000',
7
+        0x01 => 'FFFFFF',
8
+        0x02 => 'FF0000',
9
+        0x03 => '00FF00',
10
+        0x04 => '0000FF',
11
+        0x05 => 'FFFF00',
12
+        0x06 => 'FF00FF',
13
+        0x07 => '00FFFF',
14
+        0x40 => '000000', // system window text color
15
+        0x41 => 'FFFFFF', // system window background color
16
+    );
17
+
18
+    /**
19
+     * Map built-in color to RGB value
20
+     *
21
+     * @param int $color Indexed color
22
+     * @return array
23
+     */
24
+    public static function lookup($color)
25
+    {
26
+        if (isset(self::$map[$color])) {
27
+            return array('rgb' => self::$map[$color]);
28
+        }
29
+        return array('rgb' => '000000');
30
+    }
31
+}

+ 28
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Excel5/ErrorCode.php View File

@@ -0,0 +1,28 @@
1
+<?php
2
+
3
+class PHPExcel_Reader_Excel5_ErrorCode
4
+{
5
+    protected static $map = array(
6
+        0x00 => '#NULL!',
7
+        0x07 => '#DIV/0!',
8
+        0x0F => '#VALUE!',
9
+        0x17 => '#REF!',
10
+        0x1D => '#NAME?',
11
+        0x24 => '#NUM!',
12
+        0x2A => '#N/A',
13
+    );
14
+
15
+    /**
16
+     * Map error code, e.g. '#N/A'
17
+     *
18
+     * @param int $code
19
+     * @return string
20
+     */
21
+    public static function lookup($code)
22
+    {
23
+        if (isset(self::$map[$code])) {
24
+            return self::$map[$code];
25
+        }
26
+        return false;
27
+    }
28
+}

+ 669
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Excel5/Escher.php View File

@@ -0,0 +1,669 @@
1
+<?php
2
+
3
+/**
4
+ * PHPExcel_Reader_Excel5_Escher
5
+ *
6
+ * Copyright (c) 2006 - 2015 PHPExcel
7
+ *
8
+ * This library is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU Lesser General Public
10
+ * License as published by the Free Software Foundation; either
11
+ * version 2.1 of the License, or (at your option) any later version.
12
+ *
13
+ * This library is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
+ * Lesser General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU Lesser General Public
19
+ * License along with this library; if not, write to the Free Software
20
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21
+ *
22
+ * @category   PHPExcel
23
+ * @package    PHPExcel_Reader_Excel5
24
+ * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
25
+ * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
26
+ * @version    ##VERSION##, ##DATE##
27
+ */
28
+class PHPExcel_Reader_Excel5_Escher
29
+{
30
+    const DGGCONTAINER      = 0xF000;
31
+    const BSTORECONTAINER   = 0xF001;
32
+    const DGCONTAINER       = 0xF002;
33
+    const SPGRCONTAINER     = 0xF003;
34
+    const SPCONTAINER       = 0xF004;
35
+    const DGG               = 0xF006;
36
+    const BSE               = 0xF007;
37
+    const DG                = 0xF008;
38
+    const SPGR              = 0xF009;
39
+    const SP                = 0xF00A;
40
+    const OPT               = 0xF00B;
41
+    const CLIENTTEXTBOX     = 0xF00D;
42
+    const CLIENTANCHOR      = 0xF010;
43
+    const CLIENTDATA        = 0xF011;
44
+    const BLIPJPEG          = 0xF01D;
45
+    const BLIPPNG           = 0xF01E;
46
+    const SPLITMENUCOLORS   = 0xF11E;
47
+    const TERTIARYOPT       = 0xF122;
48
+
49
+    /**
50
+     * Escher stream data (binary)
51
+     *
52
+     * @var string
53
+     */
54
+    private $data;
55
+
56
+    /**
57
+     * Size in bytes of the Escher stream data
58
+     *
59
+     * @var int
60
+     */
61
+    private $dataSize;
62
+
63
+    /**
64
+     * Current position of stream pointer in Escher stream data
65
+     *
66
+     * @var int
67
+     */
68
+    private $pos;
69
+
70
+    /**
71
+     * The object to be returned by the reader. Modified during load.
72
+     *
73
+     * @var mixed
74
+     */
75
+    private $object;
76
+
77
+    /**
78
+     * Create a new PHPExcel_Reader_Excel5_Escher instance
79
+     *
80
+     * @param mixed $object
81
+     */
82
+    public function __construct($object)
83
+    {
84
+        $this->object = $object;
85
+    }
86
+
87
+    /**
88
+     * Load Escher stream data. May be a partial Escher stream.
89
+     *
90
+     * @param string $data
91
+     */
92
+    public function load($data)
93
+    {
94
+        $this->data = $data;
95
+
96
+        // total byte size of Excel data (workbook global substream + sheet substreams)
97
+        $this->dataSize = strlen($this->data);
98
+
99
+        $this->pos = 0;
100
+
101
+        // Parse Escher stream
102
+        while ($this->pos < $this->dataSize) {
103
+            // offset: 2; size: 2: Record Type
104
+            $fbt = PHPExcel_Reader_Excel5::getInt2d($this->data, $this->pos + 2);
105
+
106
+            switch ($fbt) {
107
+                case self::DGGCONTAINER:
108
+                    $this->readDggContainer();
109
+                    break;
110
+                case self::DGG:
111
+                    $this->readDgg();
112
+                    break;
113
+                case self::BSTORECONTAINER:
114
+                    $this->readBstoreContainer();
115
+                    break;
116
+                case self::BSE:
117
+                    $this->readBSE();
118
+                    break;
119
+                case self::BLIPJPEG:
120
+                    $this->readBlipJPEG();
121
+                    break;
122
+                case self::BLIPPNG:
123
+                    $this->readBlipPNG();
124
+                    break;
125
+                case self::OPT:
126
+                    $this->readOPT();
127
+                    break;
128
+                case self::TERTIARYOPT:
129
+                    $this->readTertiaryOPT();
130
+                    break;
131
+                case self::SPLITMENUCOLORS:
132
+                    $this->readSplitMenuColors();
133
+                    break;
134
+                case self::DGCONTAINER:
135
+                    $this->readDgContainer();
136
+                    break;
137
+                case self::DG:
138
+                    $this->readDg();
139
+                    break;
140
+                case self::SPGRCONTAINER:
141
+                    $this->readSpgrContainer();
142
+                    break;
143
+                case self::SPCONTAINER:
144
+                    $this->readSpContainer();
145
+                    break;
146
+                case self::SPGR:
147
+                    $this->readSpgr();
148
+                    break;
149
+                case self::SP:
150
+                    $this->readSp();
151
+                    break;
152
+                case self::CLIENTTEXTBOX:
153
+                    $this->readClientTextbox();
154
+                    break;
155
+                case self::CLIENTANCHOR:
156
+                    $this->readClientAnchor();
157
+                    break;
158
+                case self::CLIENTDATA:
159
+                    $this->readClientData();
160
+                    break;
161
+                default:
162
+                    $this->readDefault();
163
+                    break;
164
+            }
165
+        }
166
+
167
+        return $this->object;
168
+    }
169
+
170
+    /**
171
+     * Read a generic record
172
+     */
173
+    private function readDefault()
174
+    {
175
+        // offset 0; size: 2; recVer and recInstance
176
+        $verInstance = PHPExcel_Reader_Excel5::getInt2d($this->data, $this->pos);
177
+
178
+        // offset: 2; size: 2: Record Type
179
+        $fbt = PHPExcel_Reader_Excel5::getInt2d($this->data, $this->pos + 2);
180
+
181
+        // bit: 0-3; mask: 0x000F; recVer
182
+        $recVer = (0x000F & $verInstance) >> 0;
183
+
184
+        $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4);
185
+        $recordData = substr($this->data, $this->pos + 8, $length);
186
+
187
+        // move stream pointer to next record
188
+        $this->pos += 8 + $length;
189
+    }
190
+
191
+    /**
192
+     * Read DggContainer record (Drawing Group Container)
193
+     */
194
+    private function readDggContainer()
195
+    {
196
+        $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4);
197
+        $recordData = substr($this->data, $this->pos + 8, $length);
198
+
199
+        // move stream pointer to next record
200
+        $this->pos += 8 + $length;
201
+
202
+        // record is a container, read contents
203
+        $dggContainer = new PHPExcel_Shared_Escher_DggContainer();
204
+        $this->object->setDggContainer($dggContainer);
205
+        $reader = new PHPExcel_Reader_Excel5_Escher($dggContainer);
206
+        $reader->load($recordData);
207
+    }
208
+
209
+    /**
210
+     * Read Dgg record (Drawing Group)
211
+     */
212
+    private function readDgg()
213
+    {
214
+        $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4);
215
+        $recordData = substr($this->data, $this->pos + 8, $length);
216
+
217
+        // move stream pointer to next record
218
+        $this->pos += 8 + $length;
219
+    }
220
+
221
+    /**
222
+     * Read BstoreContainer record (Blip Store Container)
223
+     */
224
+    private function readBstoreContainer()
225
+    {
226
+        $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4);
227
+        $recordData = substr($this->data, $this->pos + 8, $length);
228
+
229
+        // move stream pointer to next record
230
+        $this->pos += 8 + $length;
231
+
232
+        // record is a container, read contents
233
+        $bstoreContainer = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer();
234
+        $this->object->setBstoreContainer($bstoreContainer);
235
+        $reader = new PHPExcel_Reader_Excel5_Escher($bstoreContainer);
236
+        $reader->load($recordData);
237
+    }
238
+
239
+    /**
240
+     * Read BSE record
241
+     */
242
+    private function readBSE()
243
+    {
244
+        // offset: 0; size: 2; recVer and recInstance
245
+
246
+        // bit: 4-15; mask: 0xFFF0; recInstance
247
+        $recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::getInt2d($this->data, $this->pos)) >> 4;
248
+
249
+        $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4);
250
+        $recordData = substr($this->data, $this->pos + 8, $length);
251
+
252
+        // move stream pointer to next record
253
+        $this->pos += 8 + $length;
254
+
255
+        // add BSE to BstoreContainer
256
+        $BSE = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE();
257
+        $this->object->addBSE($BSE);
258
+
259
+        $BSE->setBLIPType($recInstance);
260
+
261
+        // offset: 0; size: 1; btWin32 (MSOBLIPTYPE)
262
+        $btWin32 = ord($recordData[0]);
263
+
264
+        // offset: 1; size: 1; btWin32 (MSOBLIPTYPE)
265
+        $btMacOS = ord($recordData[1]);
266
+
267
+        // offset: 2; size: 16; MD4 digest
268
+        $rgbUid = substr($recordData, 2, 16);
269
+
270
+        // offset: 18; size: 2; tag
271
+        $tag = PHPExcel_Reader_Excel5::getInt2d($recordData, 18);
272
+
273
+        // offset: 20; size: 4; size of BLIP in bytes
274
+        $size = PHPExcel_Reader_Excel5::getInt4d($recordData, 20);
275
+
276
+        // offset: 24; size: 4; number of references to this BLIP
277
+        $cRef = PHPExcel_Reader_Excel5::getInt4d($recordData, 24);
278
+
279
+        // offset: 28; size: 4; MSOFO file offset
280
+        $foDelay = PHPExcel_Reader_Excel5::getInt4d($recordData, 28);
281
+
282
+        // offset: 32; size: 1; unused1
283
+        $unused1 = ord($recordData{32});
284
+
285
+        // offset: 33; size: 1; size of nameData in bytes (including null terminator)
286
+        $cbName = ord($recordData{33});
287
+
288
+        // offset: 34; size: 1; unused2
289
+        $unused2 = ord($recordData{34});
290
+
291
+        // offset: 35; size: 1; unused3
292
+        $unused3 = ord($recordData{35});
293
+
294
+        // offset: 36; size: $cbName; nameData
295
+        $nameData = substr($recordData, 36, $cbName);
296
+
297
+        // offset: 36 + $cbName, size: var; the BLIP data
298
+        $blipData = substr($recordData, 36 + $cbName);
299
+
300
+        // record is a container, read contents
301
+        $reader = new PHPExcel_Reader_Excel5_Escher($BSE);
302
+        $reader->load($blipData);
303
+    }
304
+
305
+    /**
306
+     * Read BlipJPEG record. Holds raw JPEG image data
307
+     */
308
+    private function readBlipJPEG()
309
+    {
310
+        // offset: 0; size: 2; recVer and recInstance
311
+
312
+        // bit: 4-15; mask: 0xFFF0; recInstance
313
+        $recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::getInt2d($this->data, $this->pos)) >> 4;
314
+
315
+        $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4);
316
+        $recordData = substr($this->data, $this->pos + 8, $length);
317
+
318
+        // move stream pointer to next record
319
+        $this->pos += 8 + $length;
320
+
321
+        $pos = 0;
322
+
323
+        // offset: 0; size: 16; rgbUid1 (MD4 digest of)
324
+        $rgbUid1 = substr($recordData, 0, 16);
325
+        $pos += 16;
326
+
327
+        // offset: 16; size: 16; rgbUid2 (MD4 digest), only if $recInstance = 0x46B or 0x6E3
328
+        if (in_array($recInstance, array(0x046B, 0x06E3))) {
329
+            $rgbUid2 = substr($recordData, 16, 16);
330
+            $pos += 16;
331
+        }
332
+
333
+        // offset: var; size: 1; tag
334
+        $tag = ord($recordData{$pos});
335
+        $pos += 1;
336
+
337
+        // offset: var; size: var; the raw image data
338
+        $data = substr($recordData, $pos);
339
+
340
+        $blip = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip();
341
+        $blip->setData($data);
342
+
343
+        $this->object->setBlip($blip);
344
+    }
345
+
346
+    /**
347
+     * Read BlipPNG record. Holds raw PNG image data
348
+     */
349
+    private function readBlipPNG()
350
+    {
351
+        // offset: 0; size: 2; recVer and recInstance
352
+
353
+        // bit: 4-15; mask: 0xFFF0; recInstance
354
+        $recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::getInt2d($this->data, $this->pos)) >> 4;
355
+
356
+        $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4);
357
+        $recordData = substr($this->data, $this->pos + 8, $length);
358
+
359
+        // move stream pointer to next record
360
+        $this->pos += 8 + $length;
361
+
362
+        $pos = 0;
363
+
364
+        // offset: 0; size: 16; rgbUid1 (MD4 digest of)
365
+        $rgbUid1 = substr($recordData, 0, 16);
366
+        $pos += 16;
367
+
368
+        // offset: 16; size: 16; rgbUid2 (MD4 digest), only if $recInstance = 0x46B or 0x6E3
369
+        if ($recInstance == 0x06E1) {
370
+            $rgbUid2 = substr($recordData, 16, 16);
371
+            $pos += 16;
372
+        }
373
+
374
+        // offset: var; size: 1; tag
375
+        $tag = ord($recordData{$pos});
376
+        $pos += 1;
377
+
378
+        // offset: var; size: var; the raw image data
379
+        $data = substr($recordData, $pos);
380
+
381
+        $blip = new PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip();
382
+        $blip->setData($data);
383
+
384
+        $this->object->setBlip($blip);
385
+    }
386
+
387
+    /**
388
+     * Read OPT record. This record may occur within DggContainer record or SpContainer
389
+     */
390
+    private function readOPT()
391
+    {
392
+        // offset: 0; size: 2; recVer and recInstance
393
+
394
+        // bit: 4-15; mask: 0xFFF0; recInstance
395
+        $recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::getInt2d($this->data, $this->pos)) >> 4;
396
+
397
+        $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4);
398
+        $recordData = substr($this->data, $this->pos + 8, $length);
399
+
400
+        // move stream pointer to next record
401
+        $this->pos += 8 + $length;
402
+
403
+        $this->readOfficeArtRGFOPTE($recordData, $recInstance);
404
+    }
405
+
406
+    /**
407
+     * Read TertiaryOPT record
408
+     */
409
+    private function readTertiaryOPT()
410
+    {
411
+        // offset: 0; size: 2; recVer and recInstance
412
+
413
+        // bit: 4-15; mask: 0xFFF0; recInstance
414
+        $recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::getInt2d($this->data, $this->pos)) >> 4;
415
+
416
+        $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4);
417
+        $recordData = substr($this->data, $this->pos + 8, $length);
418
+
419
+        // move stream pointer to next record
420
+        $this->pos += 8 + $length;
421
+    }
422
+
423
+    /**
424
+     * Read SplitMenuColors record
425
+     */
426
+    private function readSplitMenuColors()
427
+    {
428
+        $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4);
429
+        $recordData = substr($this->data, $this->pos + 8, $length);
430
+
431
+        // move stream pointer to next record
432
+        $this->pos += 8 + $length;
433
+    }
434
+
435
+    /**
436
+     * Read DgContainer record (Drawing Container)
437
+     */
438
+    private function readDgContainer()
439
+    {
440
+        $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4);
441
+        $recordData = substr($this->data, $this->pos + 8, $length);
442
+
443
+        // move stream pointer to next record
444
+        $this->pos += 8 + $length;
445
+
446
+        // record is a container, read contents
447
+        $dgContainer = new PHPExcel_Shared_Escher_DgContainer();
448
+        $this->object->setDgContainer($dgContainer);
449
+        $reader = new PHPExcel_Reader_Excel5_Escher($dgContainer);
450
+        $escher = $reader->load($recordData);
451
+    }
452
+
453
+    /**
454
+     * Read Dg record (Drawing)
455
+     */
456
+    private function readDg()
457
+    {
458
+        $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4);
459
+        $recordData = substr($this->data, $this->pos + 8, $length);
460
+
461
+        // move stream pointer to next record
462
+        $this->pos += 8 + $length;
463
+    }
464
+
465
+    /**
466
+     * Read SpgrContainer record (Shape Group Container)
467
+     */
468
+    private function readSpgrContainer()
469
+    {
470
+        // context is either context DgContainer or SpgrContainer
471
+
472
+        $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4);
473
+        $recordData = substr($this->data, $this->pos + 8, $length);
474
+
475
+        // move stream pointer to next record
476
+        $this->pos += 8 + $length;
477
+
478
+        // record is a container, read contents
479
+        $spgrContainer = new PHPExcel_Shared_Escher_DgContainer_SpgrContainer();
480
+
481
+        if ($this->object instanceof PHPExcel_Shared_Escher_DgContainer) {
482
+            // DgContainer
483
+            $this->object->setSpgrContainer($spgrContainer);
484
+        } else {
485
+            // SpgrContainer
486
+            $this->object->addChild($spgrContainer);
487
+        }
488
+
489
+        $reader = new PHPExcel_Reader_Excel5_Escher($spgrContainer);
490
+        $escher = $reader->load($recordData);
491
+    }
492
+
493
+    /**
494
+     * Read SpContainer record (Shape Container)
495
+     */
496
+    private function readSpContainer()
497
+    {
498
+        $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4);
499
+        $recordData = substr($this->data, $this->pos + 8, $length);
500
+
501
+        // add spContainer to spgrContainer
502
+        $spContainer = new PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer();
503
+        $this->object->addChild($spContainer);
504
+
505
+        // move stream pointer to next record
506
+        $this->pos += 8 + $length;
507
+
508
+        // record is a container, read contents
509
+        $reader = new PHPExcel_Reader_Excel5_Escher($spContainer);
510
+        $escher = $reader->load($recordData);
511
+    }
512
+
513
+    /**
514
+     * Read Spgr record (Shape Group)
515
+     */
516
+    private function readSpgr()
517
+    {
518
+        $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4);
519
+        $recordData = substr($this->data, $this->pos + 8, $length);
520
+
521
+        // move stream pointer to next record
522
+        $this->pos += 8 + $length;
523
+    }
524
+
525
+    /**
526
+     * Read Sp record (Shape)
527
+     */
528
+    private function readSp()
529
+    {
530
+        // offset: 0; size: 2; recVer and recInstance
531
+
532
+        // bit: 4-15; mask: 0xFFF0; recInstance
533
+        $recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::getInt2d($this->data, $this->pos)) >> 4;
534
+
535
+        $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4);
536
+        $recordData = substr($this->data, $this->pos + 8, $length);
537
+
538
+        // move stream pointer to next record
539
+        $this->pos += 8 + $length;
540
+    }
541
+
542
+    /**
543
+     * Read ClientTextbox record
544
+     */
545
+    private function readClientTextbox()
546
+    {
547
+        // offset: 0; size: 2; recVer and recInstance
548
+
549
+        // bit: 4-15; mask: 0xFFF0; recInstance
550
+        $recInstance = (0xFFF0 & PHPExcel_Reader_Excel5::getInt2d($this->data, $this->pos)) >> 4;
551
+
552
+        $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4);
553
+        $recordData = substr($this->data, $this->pos + 8, $length);
554
+
555
+        // move stream pointer to next record
556
+        $this->pos += 8 + $length;
557
+    }
558
+
559
+    /**
560
+     * Read ClientAnchor record. This record holds information about where the shape is anchored in worksheet
561
+     */
562
+    private function readClientAnchor()
563
+    {
564
+        $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4);
565
+        $recordData = substr($this->data, $this->pos + 8, $length);
566
+
567
+        // move stream pointer to next record
568
+        $this->pos += 8 + $length;
569
+
570
+        // offset: 2; size: 2; upper-left corner column index (0-based)
571
+        $c1 = PHPExcel_Reader_Excel5::getInt2d($recordData, 2);
572
+
573
+        // offset: 4; size: 2; upper-left corner horizontal offset in 1/1024 of column width
574
+        $startOffsetX = PHPExcel_Reader_Excel5::getInt2d($recordData, 4);
575
+
576
+        // offset: 6; size: 2; upper-left corner row index (0-based)
577
+        $r1 = PHPExcel_Reader_Excel5::getInt2d($recordData, 6);
578
+
579
+        // offset: 8; size: 2; upper-left corner vertical offset in 1/256 of row height
580
+        $startOffsetY = PHPExcel_Reader_Excel5::getInt2d($recordData, 8);
581
+
582
+        // offset: 10; size: 2; bottom-right corner column index (0-based)
583
+        $c2 = PHPExcel_Reader_Excel5::getInt2d($recordData, 10);
584
+
585
+        // offset: 12; size: 2; bottom-right corner horizontal offset in 1/1024 of column width
586
+        $endOffsetX = PHPExcel_Reader_Excel5::getInt2d($recordData, 12);
587
+
588
+        // offset: 14; size: 2; bottom-right corner row index (0-based)
589
+        $r2 = PHPExcel_Reader_Excel5::getInt2d($recordData, 14);
590
+
591
+        // offset: 16; size: 2; bottom-right corner vertical offset in 1/256 of row height
592
+        $endOffsetY = PHPExcel_Reader_Excel5::getInt2d($recordData, 16);
593
+
594
+        // set the start coordinates
595
+        $this->object->setStartCoordinates(PHPExcel_Cell::stringFromColumnIndex($c1) . ($r1 + 1));
596
+
597
+        // set the start offsetX
598
+        $this->object->setStartOffsetX($startOffsetX);
599
+
600
+        // set the start offsetY
601
+        $this->object->setStartOffsetY($startOffsetY);
602
+
603
+        // set the end coordinates
604
+        $this->object->setEndCoordinates(PHPExcel_Cell::stringFromColumnIndex($c2) . ($r2 + 1));
605
+
606
+        // set the end offsetX
607
+        $this->object->setEndOffsetX($endOffsetX);
608
+
609
+        // set the end offsetY
610
+        $this->object->setEndOffsetY($endOffsetY);
611
+    }
612
+
613
+    /**
614
+     * Read ClientData record
615
+     */
616
+    private function readClientData()
617
+    {
618
+        $length = PHPExcel_Reader_Excel5::getInt4d($this->data, $this->pos + 4);
619
+        $recordData = substr($this->data, $this->pos + 8, $length);
620
+
621
+        // move stream pointer to next record
622
+        $this->pos += 8 + $length;
623
+    }
624
+
625
+    /**
626
+     * Read OfficeArtRGFOPTE table of property-value pairs
627
+     *
628
+     * @param string $data Binary data
629
+     * @param int $n Number of properties
630
+     */
631
+    private function readOfficeArtRGFOPTE($data, $n)
632
+    {
633
+        $splicedComplexData = substr($data, 6 * $n);
634
+
635
+        // loop through property-value pairs
636
+        for ($i = 0; $i < $n; ++$i) {
637
+            // read 6 bytes at a time
638
+            $fopte = substr($data, 6 * $i, 6);
639
+
640
+            // offset: 0; size: 2; opid
641
+            $opid = PHPExcel_Reader_Excel5::getInt2d($fopte, 0);
642
+
643
+            // bit: 0-13; mask: 0x3FFF; opid.opid
644
+            $opidOpid = (0x3FFF & $opid) >> 0;
645
+
646
+            // bit: 14; mask 0x4000; 1 = value in op field is BLIP identifier
647
+            $opidFBid = (0x4000 & $opid) >> 14;
648
+
649
+            // bit: 15; mask 0x8000; 1 = this is a complex property, op field specifies size of complex data
650
+            $opidFComplex = (0x8000 & $opid) >> 15;
651
+
652
+            // offset: 2; size: 4; the value for this property
653
+            $op = PHPExcel_Reader_Excel5::getInt4d($fopte, 2);
654
+
655
+            if ($opidFComplex) {
656
+                $complexData = substr($splicedComplexData, 0, $op);
657
+                $splicedComplexData = substr($splicedComplexData, $op);
658
+
659
+                // we store string value with complex data
660
+                $value = $complexData;
661
+            } else {
662
+                // we store integer value
663
+                $value = $op;
664
+            }
665
+
666
+            $this->object->setOPT($opidOpid, $value);
667
+        }
668
+    }
669
+}

+ 203
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Excel5/MD5.php View File

@@ -0,0 +1,203 @@
1
+<?php
2
+
3
+/**
4
+ * PHPExcel_Reader_Excel5_MD5
5
+ *
6
+ * Copyright (c) 2006 - 2015 PHPExcel
7
+ *
8
+ * This library is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU Lesser General Public
10
+ * License as published by the Free Software Foundation; either
11
+ * version 2.1 of the License, or (at your option) any later version.
12
+ *
13
+ * This library is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
+ * Lesser General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU Lesser General Public
19
+ * License along with this library; if not, write to the Free Software
20
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21
+ *
22
+ * @category   PHPExcel
23
+ * @package    PHPExcel_Reader_Excel5
24
+ * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
25
+ * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt        LGPL
26
+ * @version    ##VERSION##, ##DATE##
27
+ */
28
+class PHPExcel_Reader_Excel5_MD5
29
+{
30
+    // Context
31
+    private $a;
32
+    private $b;
33
+    private $c;
34
+    private $d;
35
+
36
+    /**
37
+     * MD5 stream constructor
38
+     */
39
+    public function __construct()
40
+    {
41
+        $this->reset();
42
+    }
43
+
44
+    /**
45
+     * Reset the MD5 stream context
46
+     */
47
+    public function reset()
48
+    {
49
+        $this->a = 0x67452301;
50
+        $this->b = 0xEFCDAB89;
51
+        $this->c = 0x98BADCFE;
52
+        $this->d = 0x10325476;
53
+    }
54
+
55
+    /**
56
+     * Get MD5 stream context
57
+     *
58
+     * @return string
59
+     */
60
+    public function getContext()
61
+    {
62
+        $s = '';
63
+        foreach (array('a', 'b', 'c', 'd') as $i) {
64
+            $v = $this->{$i};
65
+            $s .= chr($v & 0xff);
66
+            $s .= chr(($v >> 8) & 0xff);
67
+            $s .= chr(($v >> 16) & 0xff);
68
+            $s .= chr(($v >> 24) & 0xff);
69
+        }
70
+
71
+        return $s;
72
+    }
73
+
74
+    /**
75
+     * Add data to context
76
+     *
77
+     * @param string $data Data to add
78
+     */
79
+    public function add($data)
80
+    {
81
+        $words = array_values(unpack('V16', $data));
82
+
83
+        $A = $this->a;
84
+        $B = $this->b;
85
+        $C = $this->c;
86
+        $D = $this->d;
87
+
88
+        $F = array('PHPExcel_Reader_Excel5_MD5','f');
89
+        $G = array('PHPExcel_Reader_Excel5_MD5','g');
90
+        $H = array('PHPExcel_Reader_Excel5_MD5','h');
91
+        $I = array('PHPExcel_Reader_Excel5_MD5','i');
92
+
93
+        /* ROUND 1 */
94
+        self::step($F, $A, $B, $C, $D, $words[0], 7, 0xd76aa478);
95
+        self::step($F, $D, $A, $B, $C, $words[1], 12, 0xe8c7b756);
96
+        self::step($F, $C, $D, $A, $B, $words[2], 17, 0x242070db);
97
+        self::step($F, $B, $C, $D, $A, $words[3], 22, 0xc1bdceee);
98
+        self::step($F, $A, $B, $C, $D, $words[4], 7, 0xf57c0faf);
99
+        self::step($F, $D, $A, $B, $C, $words[5], 12, 0x4787c62a);
100
+        self::step($F, $C, $D, $A, $B, $words[6], 17, 0xa8304613);
101
+        self::step($F, $B, $C, $D, $A, $words[7], 22, 0xfd469501);
102
+        self::step($F, $A, $B, $C, $D, $words[8], 7, 0x698098d8);
103
+        self::step($F, $D, $A, $B, $C, $words[9], 12, 0x8b44f7af);
104
+        self::step($F, $C, $D, $A, $B, $words[10], 17, 0xffff5bb1);
105
+        self::step($F, $B, $C, $D, $A, $words[11], 22, 0x895cd7be);
106
+        self::step($F, $A, $B, $C, $D, $words[12], 7, 0x6b901122);
107
+        self::step($F, $D, $A, $B, $C, $words[13], 12, 0xfd987193);
108
+        self::step($F, $C, $D, $A, $B, $words[14], 17, 0xa679438e);
109
+        self::step($F, $B, $C, $D, $A, $words[15], 22, 0x49b40821);
110
+
111
+        /* ROUND 2 */
112
+        self::step($G, $A, $B, $C, $D, $words[1], 5, 0xf61e2562);
113
+        self::step($G, $D, $A, $B, $C, $words[6], 9, 0xc040b340);
114
+        self::step($G, $C, $D, $A, $B, $words[11], 14, 0x265e5a51);
115
+        self::step($G, $B, $C, $D, $A, $words[0], 20, 0xe9b6c7aa);
116
+        self::step($G, $A, $B, $C, $D, $words[5], 5, 0xd62f105d);
117
+        self::step($G, $D, $A, $B, $C, $words[10], 9, 0x02441453);
118
+        self::step($G, $C, $D, $A, $B, $words[15], 14, 0xd8a1e681);
119
+        self::step($G, $B, $C, $D, $A, $words[4], 20, 0xe7d3fbc8);
120
+        self::step($G, $A, $B, $C, $D, $words[9], 5, 0x21e1cde6);
121
+        self::step($G, $D, $A, $B, $C, $words[14], 9, 0xc33707d6);
122
+        self::step($G, $C, $D, $A, $B, $words[3], 14, 0xf4d50d87);
123
+        self::step($G, $B, $C, $D, $A, $words[8], 20, 0x455a14ed);
124
+        self::step($G, $A, $B, $C, $D, $words[13], 5, 0xa9e3e905);
125
+        self::step($G, $D, $A, $B, $C, $words[2], 9, 0xfcefa3f8);
126
+        self::step($G, $C, $D, $A, $B, $words[7], 14, 0x676f02d9);
127
+        self::step($G, $B, $C, $D, $A, $words[12], 20, 0x8d2a4c8a);
128
+
129
+        /* ROUND 3 */
130
+        self::step($H, $A, $B, $C, $D, $words[5], 4, 0xfffa3942);
131
+        self::step($H, $D, $A, $B, $C, $words[8], 11, 0x8771f681);
132
+        self::step($H, $C, $D, $A, $B, $words[11], 16, 0x6d9d6122);
133
+        self::step($H, $B, $C, $D, $A, $words[14], 23, 0xfde5380c);
134
+        self::step($H, $A, $B, $C, $D, $words[1], 4, 0xa4beea44);
135
+        self::step($H, $D, $A, $B, $C, $words[4], 11, 0x4bdecfa9);
136
+        self::step($H, $C, $D, $A, $B, $words[7], 16, 0xf6bb4b60);
137
+        self::step($H, $B, $C, $D, $A, $words[10], 23, 0xbebfbc70);
138
+        self::step($H, $A, $B, $C, $D, $words[13], 4, 0x289b7ec6);
139
+        self::step($H, $D, $A, $B, $C, $words[0], 11, 0xeaa127fa);
140
+        self::step($H, $C, $D, $A, $B, $words[3], 16, 0xd4ef3085);
141
+        self::step($H, $B, $C, $D, $A, $words[6], 23, 0x04881d05);
142
+        self::step($H, $A, $B, $C, $D, $words[9], 4, 0xd9d4d039);
143
+        self::step($H, $D, $A, $B, $C, $words[12], 11, 0xe6db99e5);
144
+        self::step($H, $C, $D, $A, $B, $words[15], 16, 0x1fa27cf8);
145
+        self::step($H, $B, $C, $D, $A, $words[2], 23, 0xc4ac5665);
146
+
147
+        /* ROUND 4 */
148
+        self::step($I, $A, $B, $C, $D, $words[0], 6, 0xf4292244);
149
+        self::step($I, $D, $A, $B, $C, $words[7], 10, 0x432aff97);
150
+        self::step($I, $C, $D, $A, $B, $words[14], 15, 0xab9423a7);
151
+        self::step($I, $B, $C, $D, $A, $words[5], 21, 0xfc93a039);
152
+        self::step($I, $A, $B, $C, $D, $words[12], 6, 0x655b59c3);
153
+        self::step($I, $D, $A, $B, $C, $words[3], 10, 0x8f0ccc92);
154
+        self::step($I, $C, $D, $A, $B, $words[10], 15, 0xffeff47d);
155
+        self::step($I, $B, $C, $D, $A, $words[1], 21, 0x85845dd1);
156
+        self::step($I, $A, $B, $C, $D, $words[8], 6, 0x6fa87e4f);
157
+        self::step($I, $D, $A, $B, $C, $words[15], 10, 0xfe2ce6e0);
158
+        self::step($I, $C, $D, $A, $B, $words[6], 15, 0xa3014314);
159
+        self::step($I, $B, $C, $D, $A, $words[13], 21, 0x4e0811a1);
160
+        self::step($I, $A, $B, $C, $D, $words[4], 6, 0xf7537e82);
161
+        self::step($I, $D, $A, $B, $C, $words[11], 10, 0xbd3af235);
162
+        self::step($I, $C, $D, $A, $B, $words[2], 15, 0x2ad7d2bb);
163
+        self::step($I, $B, $C, $D, $A, $words[9], 21, 0xeb86d391);
164
+
165
+        $this->a = ($this->a + $A) & 0xffffffff;
166
+        $this->b = ($this->b + $B) & 0xffffffff;
167
+        $this->c = ($this->c + $C) & 0xffffffff;
168
+        $this->d = ($this->d + $D) & 0xffffffff;
169
+    }
170
+
171
+    private static function f($X, $Y, $Z)
172
+    {
173
+        return (($X & $Y) | ((~ $X) & $Z)); // X AND Y OR NOT X AND Z
174
+    }
175
+
176
+    private static function g($X, $Y, $Z)
177
+    {
178
+        return (($X & $Z) | ($Y & (~ $Z))); // X AND Z OR Y AND NOT Z
179
+    }
180
+
181
+    private static function h($X, $Y, $Z)
182
+    {
183
+        return ($X ^ $Y ^ $Z); // X XOR Y XOR Z
184
+    }
185
+
186
+    private static function i($X, $Y, $Z)
187
+    {
188
+        return ($Y ^ ($X | (~ $Z))) ; // Y XOR (X OR NOT Z)
189
+    }
190
+
191
+    private static function step($func, &$A, $B, $C, $D, $M, $s, $t)
192
+    {
193
+        $A = ($A + call_user_func($func, $B, $C, $D) + $M + $t) & 0xffffffff;
194
+        $A = self::rotate($A, $s);
195
+        $A = ($B + $A) & 0xffffffff;
196
+    }
197
+
198
+    private static function rotate($decimal, $bits)
199
+    {
200
+        $binary = str_pad(decbin($decimal), 32, "0", STR_PAD_LEFT);
201
+        return bindec(substr($binary, $bits).substr($binary, 0, $bits));
202
+    }
203
+}

+ 81
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Excel5/RC4.php View File

@@ -0,0 +1,81 @@
1
+<?php
2
+
3
+/**
4
+ * PHPExcel_Reader_Excel5_RC4
5
+ *
6
+ * Copyright (c) 2006 - 2015 PHPExcel
7
+ *
8
+ * This library is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU Lesser General Public
10
+ * License as published by the Free Software Foundation; either
11
+ * version 2.1 of the License, or (at your option) any later version.
12
+ *
13
+ * This library is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
+ * Lesser General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU Lesser General Public
19
+ * License along with this library; if not, write to the Free Software
20
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21
+ *
22
+ * @category   PHPExcel
23
+ * @package    PHPExcel_Reader_Excel5
24
+ * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
25
+ * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
26
+ * @version    ##VERSION##, ##DATE##
27
+ */
28
+class PHPExcel_Reader_Excel5_RC4
29
+{
30
+    // Context
31
+    protected $s = array();
32
+    protected $i = 0;
33
+    protected $j = 0;
34
+
35
+    /**
36
+     * RC4 stream decryption/encryption constrcutor
37
+     *
38
+     * @param string $key Encryption key/passphrase
39
+     */
40
+    public function __construct($key)
41
+    {
42
+        $len = strlen($key);
43
+
44
+        for ($this->i = 0; $this->i < 256; $this->i++) {
45
+            $this->s[$this->i] = $this->i;
46
+        }
47
+
48
+        $this->j = 0;
49
+        for ($this->i = 0; $this->i < 256; $this->i++) {
50
+            $this->j = ($this->j + $this->s[$this->i] + ord($key[$this->i % $len])) % 256;
51
+            $t = $this->s[$this->i];
52
+            $this->s[$this->i] = $this->s[$this->j];
53
+            $this->s[$this->j] = $t;
54
+        }
55
+        $this->i = $this->j = 0;
56
+    }
57
+
58
+    /**
59
+     * Symmetric decryption/encryption function
60
+     *
61
+     * @param string $data Data to encrypt/decrypt
62
+     *
63
+     * @return string
64
+     */
65
+    public function RC4($data)
66
+    {
67
+        $len = strlen($data);
68
+        for ($c = 0; $c < $len; $c++) {
69
+            $this->i = ($this->i + 1) % 256;
70
+            $this->j = ($this->j + $this->s[$this->i]) % 256;
71
+            $t = $this->s[$this->i];
72
+            $this->s[$this->i] = $this->s[$this->j];
73
+            $this->s[$this->j] = $t;
74
+
75
+            $t = ($this->s[$this->i] + $this->s[$this->j]) % 256;
76
+
77
+            $data[$c] = chr(ord($data[$c]) ^ $this->s[$t]);
78
+        }
79
+        return $data;
80
+    }
81
+}

+ 36
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Excel5/Style/Border.php View File

@@ -0,0 +1,36 @@
1
+<?php
2
+
3
+class PHPExcel_Reader_Excel5_Style_Border
4
+{
5
+    protected static $map = array(
6
+        0x00 => PHPExcel_Style_Border::BORDER_NONE,
7
+        0x01 => PHPExcel_Style_Border::BORDER_THIN,
8
+        0x02 => PHPExcel_Style_Border::BORDER_MEDIUM,
9
+        0x03 => PHPExcel_Style_Border::BORDER_DASHED,
10
+        0x04 => PHPExcel_Style_Border::BORDER_DOTTED,
11
+        0x05 => PHPExcel_Style_Border::BORDER_THICK,
12
+        0x06 => PHPExcel_Style_Border::BORDER_DOUBLE,
13
+        0x07 => PHPExcel_Style_Border::BORDER_HAIR,
14
+        0x08 => PHPExcel_Style_Border::BORDER_MEDIUMDASHED,
15
+        0x09 => PHPExcel_Style_Border::BORDER_DASHDOT,
16
+        0x0A => PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT,
17
+        0x0B => PHPExcel_Style_Border::BORDER_DASHDOTDOT,
18
+        0x0C => PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT,
19
+        0x0D => PHPExcel_Style_Border::BORDER_SLANTDASHDOT,
20
+    );
21
+
22
+    /**
23
+     * Map border style
24
+     * OpenOffice documentation: 2.5.11
25
+     *
26
+     * @param int $index
27
+     * @return string
28
+     */
29
+    public static function lookup($index)
30
+    {
31
+        if (isset(self::$map[$index])) {
32
+            return self::$map[$index];
33
+        }
34
+        return PHPExcel_Style_Border::BORDER_NONE;
35
+    }
36
+}

+ 41
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Excel5/Style/FillPattern.php View File

@@ -0,0 +1,41 @@
1
+<?php
2
+
3
+class PHPExcel_Reader_Excel5_Style_FillPattern
4
+{
5
+    protected static $map = array(
6
+        0x00 => PHPExcel_Style_Fill::FILL_NONE,
7
+        0x01 => PHPExcel_Style_Fill::FILL_SOLID,
8
+        0x02 => PHPExcel_Style_Fill::FILL_PATTERN_MEDIUMGRAY,
9
+        0x03 => PHPExcel_Style_Fill::FILL_PATTERN_DARKGRAY,
10
+        0x04 => PHPExcel_Style_Fill::FILL_PATTERN_LIGHTGRAY,
11
+        0x05 => PHPExcel_Style_Fill::FILL_PATTERN_DARKHORIZONTAL,
12
+        0x06 => PHPExcel_Style_Fill::FILL_PATTERN_DARKVERTICAL,
13
+        0x07 => PHPExcel_Style_Fill::FILL_PATTERN_DARKDOWN,
14
+        0x08 => PHPExcel_Style_Fill::FILL_PATTERN_DARKUP,
15
+        0x09 => PHPExcel_Style_Fill::FILL_PATTERN_DARKGRID,
16
+        0x0A => PHPExcel_Style_Fill::FILL_PATTERN_DARKTRELLIS,
17
+        0x0B => PHPExcel_Style_Fill::FILL_PATTERN_LIGHTHORIZONTAL,
18
+        0x0C => PHPExcel_Style_Fill::FILL_PATTERN_LIGHTVERTICAL,
19
+        0x0D => PHPExcel_Style_Fill::FILL_PATTERN_LIGHTDOWN,
20
+        0x0E => PHPExcel_Style_Fill::FILL_PATTERN_LIGHTUP,
21
+        0x0F => PHPExcel_Style_Fill::FILL_PATTERN_LIGHTGRID,
22
+        0x10 => PHPExcel_Style_Fill::FILL_PATTERN_LIGHTTRELLIS,
23
+        0x11 => PHPExcel_Style_Fill::FILL_PATTERN_GRAY125,
24
+        0x12 => PHPExcel_Style_Fill::FILL_PATTERN_GRAY0625,
25
+    );
26
+
27
+    /**
28
+     * Get fill pattern from index
29
+     * OpenOffice documentation: 2.5.12
30
+     *
31
+     * @param int $index
32
+     * @return string
33
+     */
34
+    public static function lookup($index)
35
+    {
36
+        if (isset(self::$map[$index])) {
37
+            return self::$map[$index];
38
+        }
39
+        return PHPExcel_Style_Fill::FILL_NONE;
40
+    }
41
+}

+ 46
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Exception.php View File

@@ -0,0 +1,46 @@
1
+<?php
2
+
3
+/**
4
+ * PHPExcel_Reader_Exception
5
+ *
6
+ * Copyright (c) 2006 - 2015 PHPExcel
7
+ *
8
+ * This library is free software; you can redistribute it and/or
9
+ * modify it under the terms of the GNU Lesser General Public
10
+ * License as published by the Free Software Foundation; either
11
+ * version 2.1 of the License, or (at your option) any later version.
12
+ *
13
+ * This library is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16
+ * Lesser General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU Lesser General Public
19
+ * License along with this library; if not, write to the Free Software
20
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21
+ *
22
+ * @category   PHPExcel
23
+ * @package    PHPExcel_Reader
24
+ * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
25
+ * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
26
+ * @version    ##VERSION##, ##DATE##
27
+ */
28
+class PHPExcel_Reader_Exception extends PHPExcel_Exception
29
+{
30
+    /**
31
+     * Error handler callback
32
+     *
33
+     * @param mixed $code
34
+     * @param mixed $string
35
+     * @param mixed $file
36
+     * @param mixed $line
37
+     * @param mixed $context
38
+     */
39
+    public static function errorHandlerCallback($code, $string, $file, $line, $context)
40
+    {
41
+        $e = new self($string, $code);
42
+        $e->line = $line;
43
+        $e->file = $file;
44
+        throw $e;
45
+    }
46
+}

+ 850
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Gnumeric.php View File

@@ -0,0 +1,850 @@
1
+<?php
2
+
3
+/** PHPExcel root directory */
4
+if (!defined('PHPEXCEL_ROOT')) {
5
+    /**
6
+     * @ignore
7
+     */
8
+    define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
9
+    require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
10
+}
11
+
12
+/**
13
+ * PHPExcel_Reader_Gnumeric
14
+ *
15
+ * Copyright (c) 2006 - 2015 PHPExcel
16
+ *
17
+ * This library is free software; you can redistribute it and/or
18
+ * modify it under the terms of the GNU Lesser General Public
19
+ * License as published by the Free Software Foundation; either
20
+ * version 2.1 of the License, or (at your option) any later version.
21
+ *
22
+ * This library is distributed in the hope that it will be useful,
23
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
24
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
25
+ * Lesser General Public License for more details.
26
+ *
27
+ * You should have received a copy of the GNU Lesser General Public
28
+ * License along with this library; if not, write to the Free Software
29
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
30
+ *
31
+ * @category   PHPExcel
32
+ * @package    PHPExcel_Reader
33
+ * @copyright  Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
34
+ * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
35
+ * @version    ##VERSION##, ##DATE##
36
+ */
37
+class PHPExcel_Reader_Gnumeric extends PHPExcel_Reader_Abstract implements PHPExcel_Reader_IReader
38
+{
39
+    /**
40
+     * Formats
41
+     *
42
+     * @var array
43
+     */
44
+    private $styles = array();
45
+
46
+    /**
47
+     * Shared Expressions
48
+     *
49
+     * @var array
50
+     */
51
+    private $expressions = array();
52
+
53
+    private $referenceHelper = null;
54
+
55
+    /**
56
+     * Create a new PHPExcel_Reader_Gnumeric
57
+     */
58
+    public function __construct()
59
+    {
60
+        $this->readFilter     = new PHPExcel_Reader_DefaultReadFilter();
61
+        $this->referenceHelper = PHPExcel_ReferenceHelper::getInstance();
62
+    }
63
+
64
+    /**
65
+     * Can the current PHPExcel_Reader_IReader read the file?
66
+     *
67
+     * @param     string         $pFilename
68
+     * @return     boolean
69
+     * @throws PHPExcel_Reader_Exception
70
+     */
71
+    public function canRead($pFilename)
72
+    {
73
+        // Check if file exists
74
+        if (!file_exists($pFilename)) {
75
+            throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
76
+        }
77
+
78
+        // Check if gzlib functions are available
79
+        if (!function_exists('gzread')) {
80
+            throw new PHPExcel_Reader_Exception("gzlib library is not enabled");
81
+        }
82
+
83
+        // Read signature data (first 3 bytes)
84
+        $fh = fopen($pFilename, 'r');
85
+        $data = fread($fh, 2);
86
+        fclose($fh);
87
+
88
+        if ($data != chr(0x1F).chr(0x8B)) {
89
+            return false;
90
+        }
91
+
92
+        return true;
93
+    }
94
+
95
+    /**
96
+     * Reads names of the worksheets from a file, without parsing the whole file to a PHPExcel object
97
+     *
98
+     * @param     string         $pFilename
99
+     * @throws     PHPExcel_Reader_Exception
100
+     */
101
+    public function listWorksheetNames($pFilename)
102
+    {
103
+        // Check if file exists
104
+        if (!file_exists($pFilename)) {
105
+            throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
106
+        }
107
+
108
+        $xml = new XMLReader();
109
+        $xml->xml($this->securityScanFile('compress.zlib://'.realpath($pFilename)), null, PHPExcel_Settings::getLibXmlLoaderOptions());
110
+        $xml->setParserProperty(2, true);
111
+
112
+        $worksheetNames = array();
113
+        while ($xml->read()) {
114
+            if ($xml->name == 'gnm:SheetName' && $xml->nodeType == XMLReader::ELEMENT) {
115
+                $xml->read();    //    Move onto the value node
116
+                $worksheetNames[] = (string) $xml->value;
117
+            } elseif ($xml->name == 'gnm:Sheets') {
118
+                //    break out of the loop once we've got our sheet names rather than parse the entire file
119
+                break;
120
+            }
121
+        }
122
+
123
+        return $worksheetNames;
124
+    }
125
+
126
+    /**
127
+     * Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns)
128
+     *
129
+     * @param   string     $pFilename
130
+     * @throws   PHPExcel_Reader_Exception
131
+     */
132
+    public function listWorksheetInfo($pFilename)
133
+    {
134
+        // Check if file exists
135
+        if (!file_exists($pFilename)) {
136
+            throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
137
+        }
138
+
139
+        $xml = new XMLReader();
140
+        $xml->xml($this->securityScanFile('compress.zlib://'.realpath($pFilename)), null, PHPExcel_Settings::getLibXmlLoaderOptions());
141
+        $xml->setParserProperty(2, true);
142
+
143
+        $worksheetInfo = array();
144
+        while ($xml->read()) {
145
+            if ($xml->name == 'gnm:Sheet' && $xml->nodeType == XMLReader::ELEMENT) {
146
+                $tmpInfo = array(
147
+                    'worksheetName' => '',
148
+                    'lastColumnLetter' => 'A',
149
+                    'lastColumnIndex' => 0,
150
+                    'totalRows' => 0,
151
+                    'totalColumns' => 0,
152
+                );
153
+
154
+                while ($xml->read()) {
155
+                    if ($xml->name == 'gnm:Name' && $xml->nodeType == XMLReader::ELEMENT) {
156
+                        $xml->read();    //    Move onto the value node
157
+                        $tmpInfo['worksheetName'] = (string) $xml->value;
158
+                    } elseif ($xml->name == 'gnm:MaxCol' && $xml->nodeType == XMLReader::ELEMENT) {
159
+                        $xml->read();    //    Move onto the value node
160
+                        $tmpInfo['lastColumnIndex'] = (int) $xml->value;
161
+                        $tmpInfo['totalColumns'] = (int) $xml->value + 1;
162
+                    } elseif ($xml->name == 'gnm:MaxRow' && $xml->nodeType == XMLReader::ELEMENT) {
163
+                        $xml->read();    //    Move onto the value node
164
+                        $tmpInfo['totalRows'] = (int) $xml->value + 1;
165
+                        break;
166
+                    }
167
+                }
168
+                $tmpInfo['lastColumnLetter'] = PHPExcel_Cell::stringFromColumnIndex($tmpInfo['lastColumnIndex']);
169
+                $worksheetInfo[] = $tmpInfo;
170
+            }
171
+        }
172
+
173
+        return $worksheetInfo;
174
+    }
175
+
176
+    private function gzfileGetContents($filename)
177
+    {
178
+        $file = @gzopen($filename, 'rb');
179
+        if ($file !== false) {
180
+            $data = '';
181
+            while (!gzeof($file)) {
182
+                $data .= gzread($file, 1024);
183
+            }
184
+            gzclose($file);
185
+        }
186
+        return $data;
187
+    }
188
+
189
+    /**
190
+     * Loads PHPExcel from file
191
+     *
192
+     * @param     string         $pFilename
193
+     * @return     PHPExcel
194
+     * @throws     PHPExcel_Reader_Exception
195
+     */
196
+    public function load($pFilename)
197
+    {
198
+        // Create new PHPExcel
199
+        $objPHPExcel = new PHPExcel();
200
+
201
+        // Load into this instance
202
+        return $this->loadIntoExisting($pFilename, $objPHPExcel);
203
+    }
204
+
205
+    /**
206
+     * Loads PHPExcel from file into PHPExcel instance
207
+     *
208
+     * @param     string         $pFilename
209
+     * @param    PHPExcel    $objPHPExcel
210
+     * @return     PHPExcel
211
+     * @throws     PHPExcel_Reader_Exception
212
+     */
213
+    public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel)
214
+    {
215
+        // Check if file exists
216
+        if (!file_exists($pFilename)) {
217
+            throw new PHPExcel_Reader_Exception("Could not open " . $pFilename . " for reading! File does not exist.");
218
+        }
219
+
220
+        $timezoneObj = new DateTimeZone('Europe/London');
221
+        $GMT = new DateTimeZone('UTC');
222
+
223
+        $gFileData = $this->gzfileGetContents($pFilename);
224
+
225
+//        echo '<pre>';
226
+//        echo htmlentities($gFileData,ENT_QUOTES,'UTF-8');
227
+//        echo '</pre><hr />';
228
+//
229
+        $xml = simplexml_load_string($this->securityScan($gFileData), 'SimpleXMLElement', PHPExcel_Settings::getLibXmlLoaderOptions());
230
+        $namespacesMeta = $xml->getNamespaces(true);
231
+
232
+//        var_dump($namespacesMeta);
233
+//
234
+        $gnmXML = $xml->children($namespacesMeta['gnm']);
235
+
236
+        $docProps = $objPHPExcel->getProperties();
237
+        //    Document Properties are held differently, depending on the version of Gnumeric
238
+        if (isset($namespacesMeta['office'])) {
239
+            $officeXML = $xml->children($namespacesMeta['office']);
240
+            $officeDocXML = $officeXML->{'document-meta'};
241
+            $officeDocMetaXML = $officeDocXML->meta;
242
+
243
+            foreach ($officeDocMetaXML as $officePropertyData) {
244
+                $officePropertyDC = array();
245
+                if (isset($namespacesMeta['dc'])) {
246
+                    $officePropertyDC = $officePropertyData->children($namespacesMeta['dc']);
247
+                }
248
+                foreach ($officePropertyDC as $propertyName => $propertyValue) {
249
+                    $propertyValue = (string) $propertyValue;
250
+                    switch ($propertyName) {
251
+                        case 'title':
252
+                            $docProps->setTitle(trim($propertyValue));
253
+                            break;
254
+                        case 'subject':
255
+                            $docProps->setSubject(trim($propertyValue));
256
+                            break;
257
+                        case 'creator':
258
+                            $docProps->setCreator(trim($propertyValue));
259
+                            $docProps->setLastModifiedBy(trim($propertyValue));
260
+                            break;
261
+                        case 'date':
262
+                            $creationDate = strtotime(trim($propertyValue));
263
+                            $docProps->setCreated($creationDate);
264
+                            $docProps->setModified($creationDate);
265
+                            break;
266
+                        case 'description':
267
+                            $docProps->setDescription(trim($propertyValue));
268
+                            break;
269
+                    }
270
+                }
271
+                $officePropertyMeta = array();
272
+                if (isset($namespacesMeta['meta'])) {
273
+                    $officePropertyMeta = $officePropertyData->children($namespacesMeta['meta']);
274
+                }
275
+                foreach ($officePropertyMeta as $propertyName => $propertyValue) {
276
+                    $attributes = $propertyValue->attributes($namespacesMeta['meta']);
277
+                    $propertyValue = (string) $propertyValue;
278
+                    switch ($propertyName) {
279
+                        case 'keyword':
280
+                            $docProps->setKeywords(trim($propertyValue));
281
+                            break;
282
+                        case 'initial-creator':
283
+                            $docProps->setCreator(trim($propertyValue));
284
+                            $docProps->setLastModifiedBy(trim($propertyValue));
285
+                            break;
286
+                        case 'creation-date':
287
+                            $creationDate = strtotime(trim($propertyValue));
288
+                            $docProps->setCreated($creationDate);
289
+                            $docProps->setModified($creationDate);
290
+                            break;
291
+                        case 'user-defined':
292
+                            list(, $attrName) = explode(':', $attributes['name']);
293
+                            switch ($attrName) {
294
+                                case 'publisher':
295
+                                    $docProps->setCompany(trim($propertyValue));
296
+                                    break;
297
+                                case 'category':
298
+                                    $docProps->setCategory(trim($propertyValue));
299
+                                    break;
300
+                                case 'manager':
301
+                                    $docProps->setManager(trim($propertyValue));
302
+                                    break;
303
+                            }
304
+                            break;
305
+                    }
306
+                }
307
+            }
308
+        } elseif (isset($gnmXML->Summary)) {
309
+            foreach ($gnmXML->Summary->Item as $summaryItem) {
310
+                $propertyName = $summaryItem->name;
311
+                $propertyValue = $summaryItem->{'val-string'};
312
+                switch ($propertyName) {
313
+                    case 'title':
314
+                        $docProps->setTitle(trim($propertyValue));
315
+                        break;
316
+                    case 'comments':
317
+                        $docProps->setDescription(trim($propertyValue));
318
+                        break;
319
+                    case 'keywords':
320
+                        $docProps->setKeywords(trim($propertyValue));
321
+                        break;
322
+                    case 'category':
323
+                        $docProps->setCategory(trim($propertyValue));
324
+                        break;
325
+                    case 'manager':
326
+                        $docProps->setManager(trim($propertyValue));
327
+                        break;
328
+                    case 'author':
329
+                        $docProps->setCreator(trim($propertyValue));
330
+                        $docProps->setLastModifiedBy(trim($propertyValue));
331
+                        break;
332
+                    case 'company':
333
+                        $docProps->setCompany(trim($propertyValue));
334
+                        break;
335
+                }
336
+            }
337
+        }
338
+
339
+        $worksheetID = 0;
340
+        foreach ($gnmXML->Sheets->Sheet as $sheet) {
341
+            $worksheetName = (string) $sheet->Name;
342
+//            echo '<b>Worksheet: ', $worksheetName,'</b><br />';
343
+            if ((isset($this->loadSheetsOnly)) && (!in_array($worksheetName, $this->loadSheetsOnly))) {
344
+                continue;
345
+            }
346
+
347
+            $maxRow = $maxCol = 0;
348
+
349
+            // Create new Worksheet
350
+            $objPHPExcel->createSheet();
351
+            $objPHPExcel->setActiveSheetIndex($worksheetID);
352
+            //    Use false for $updateFormulaCellReferences to prevent adjustment of worksheet references in formula
353
+            //        cells... during the load, all formulae should be correct, and we're simply bringing the worksheet
354
+            //        name in line with the formula, not the reverse
355
+            $objPHPExcel->getActiveSheet()->setTitle($worksheetName, false);
356
+
357
+            if ((!$this->readDataOnly) && (isset($sheet->PrintInformation))) {
358
+                if (isset($sheet->PrintInformation->Margins)) {
359
+                    foreach ($sheet->PrintInformation->Margins->children('gnm', true) as $key => $margin) {
360
+                        $marginAttributes = $margin->attributes();
361
+                        $marginSize = 72 / 100;    //    Default
362
+                        switch ($marginAttributes['PrefUnit']) {
363
+                            case 'mm':
364
+                                $marginSize = intval($marginAttributes['Points']) / 100;
365
+                                break;
366
+                        }
367
+                        switch ($key) {
368
+                            case 'top':
369
+                                $objPHPExcel->getActiveSheet()->getPageMargins()->setTop($marginSize);
370
+                                break;
371
+                            case 'bottom':
372
+                                $objPHPExcel->getActiveSheet()->getPageMargins()->setBottom($marginSize);
373
+                                break;
374
+                            case 'left':
375
+                                $objPHPExcel->getActiveSheet()->getPageMargins()->setLeft($marginSize);
376
+                                break;
377
+                            case 'right':
378
+                                $objPHPExcel->getActiveSheet()->getPageMargins()->setRight($marginSize);
379
+                                break;
380
+                            case 'header':
381
+                                $objPHPExcel->getActiveSheet()->getPageMargins()->setHeader($marginSize);
382
+                                break;
383
+                            case 'footer':
384
+                                $objPHPExcel->getActiveSheet()->getPageMargins()->setFooter($marginSize);
385
+                                break;
386
+                        }
387
+                    }
388
+                }
389
+            }
390
+
391
+            foreach ($sheet->Cells->Cell as $cell) {
392
+                $cellAttributes = $cell->attributes();
393
+                $row = (int) $cellAttributes->Row + 1;
394
+                $column = (int) $cellAttributes->Col;
395
+
396
+                if ($row > $maxRow) {
397
+                    $maxRow = $row;
398
+                }
399
+                if ($column > $maxCol) {
400
+                    $maxCol = $column;
401
+                }
402
+
403
+                $column = PHPExcel_Cell::stringFromColumnIndex($column);
404
+
405
+                // Read cell?
406
+                if ($this->getReadFilter() !== null) {
407
+                    if (!$this->getReadFilter()->readCell($column, $row, $worksheetName)) {
408
+                        continue;
409
+                    }
410
+                }
411
+
412
+                $ValueType = $cellAttributes->ValueType;
413
+                $ExprID = (string) $cellAttributes->ExprID;
414
+//                echo 'Cell ', $column, $row,'<br />';
415
+//                echo 'Type is ', $ValueType,'<br />';
416
+//                echo 'Value is ', $cell,'<br />';
417
+                $type = PHPExcel_Cell_DataType::TYPE_FORMULA;
418
+                if ($ExprID > '') {
419
+                    if (((string) $cell) > '') {
420
+                        $this->expressions[$ExprID] = array(
421
+                            'column'    => $cellAttributes->Col,
422
+                            'row'        => $cellAttributes->Row,
423
+                            'formula'    => (string) $cell
424
+                        );
425
+//                        echo 'NEW EXPRESSION ', $ExprID,'<br />';
426
+                    } else {
427
+                        $expression = $this->expressions[$ExprID];
428
+
429
+                        $cell = $this->referenceHelper->updateFormulaReferences(
430
+                            $expression['formula'],
431
+                            'A1',
432
+                            $cellAttributes->Col - $expression['column'],
433
+                            $cellAttributes->Row - $expression['row'],
434
+                            $worksheetName
435
+                        );
436
+//                        echo 'SHARED EXPRESSION ', $ExprID,'<br />';
437
+//                        echo 'New Value is ', $cell,'<br />';
438
+                    }
439
+                    $type = PHPExcel_Cell_DataType::TYPE_FORMULA;
440
+                } else {
441
+                    switch ($ValueType) {
442
+                        case '10':        //    NULL
443
+                            $type = PHPExcel_Cell_DataType::TYPE_NULL;
444
+                            break;
445
+                        case '20':        //    Boolean
446
+                            $type = PHPExcel_Cell_DataType::TYPE_BOOL;
447
+                            $cell = ($cell == 'TRUE') ? true: false;
448
+                            break;
449
+                        case '30':        //    Integer
450
+                            $cell = intval($cell);
451
+                            // Excel 2007+ doesn't differentiate between integer and float, so set the value and dropthru to the next (numeric) case
452
+                        case '40':        //    Float
453
+                            $type = PHPExcel_Cell_DataType::TYPE_NUMERIC;
454
+                            break;
455
+                        case '50':        //    Error
456
+                            $type = PHPExcel_Cell_DataType::TYPE_ERROR;
457
+                            break;
458
+                        case '60':        //    String
459
+                            $type = PHPExcel_Cell_DataType::TYPE_STRING;
460
+                            break;
461
+                        case '70':        //    Cell Range
462
+                        case '80':        //    Array
463
+                    }
464
+                }
465
+                $objPHPExcel->getActiveSheet()->getCell($column.$row)->setValueExplicit($cell, $type);
466
+            }
467
+
468
+            if ((!$this->readDataOnly) && (isset($sheet->Objects))) {
469
+                foreach ($sheet->Objects->children('gnm', true) as $key => $comment) {
470
+                    $commentAttributes = $comment->attributes();
471
+                    //    Only comment objects are handled at the moment
472
+                    if ($commentAttributes->Text) {
473
+                        $objPHPExcel->getActiveSheet()->getComment((string)$commentAttributes->ObjectBound)->setAuthor((string)$commentAttributes->Author)->setText($this->parseRichText((string)$commentAttributes->Text));
474
+                    }
475
+                }
476
+            }
477
+//            echo '$maxCol=', $maxCol,'; $maxRow=', $maxRow,'<br />';
478
+//
479
+            foreach ($sheet->Styles->StyleRegion as $styleRegion) {
480
+                $styleAttributes = $styleRegion->attributes();
481
+                if (($styleAttributes['startRow'] <= $maxRow) &&
482
+                    ($styleAttributes['startCol'] <= $maxCol)) {
483
+                    $startColumn = PHPExcel_Cell::stringFromColumnIndex((int) $styleAttributes['startCol']);
484
+                    $startRow = $styleAttributes['startRow'] + 1;
485
+
486
+                    $endColumn = ($styleAttributes['endCol'] > $maxCol) ? $maxCol : (int) $styleAttributes['endCol'];
487
+                    $endColumn = PHPExcel_Cell::stringFromColumnIndex($endColumn);
488
+                    $endRow = ($styleAttributes['endRow'] > $maxRow) ? $maxRow : $styleAttributes['endRow'];
489
+                    $endRow += 1;
490
+                    $cellRange = $startColumn.$startRow.':'.$endColumn.$endRow;
491
+//                    echo $cellRange,'<br />';
492
+
493
+                    $styleAttributes = $styleRegion->Style->attributes();
494
+//                    var_dump($styleAttributes);
495
+//                    echo '<br />';
496
+
497
+                    //    We still set the number format mask for date/time values, even if readDataOnly is true
498
+                    if ((!$this->readDataOnly) ||
499
+                        (PHPExcel_Shared_Date::isDateTimeFormatCode((string) $styleAttributes['Format']))) {
500
+                        $styleArray = array();
501
+                        $styleArray['numberformat']['code'] = (string) $styleAttributes['Format'];
502
+                        //    If readDataOnly is false, we set all formatting information
503
+                        if (!$this->readDataOnly) {
504
+                            switch ($styleAttributes['HAlign']) {
505
+                                case '1':
506
+                                    $styleArray['alignment']['horizontal'] = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL;
507
+                                    break;
508
+                                case '2':
509
+                                    $styleArray['alignment']['horizontal'] = PHPExcel_Style_Alignment::HORIZONTAL_LEFT;
510
+                                    break;
511
+                                case '4':
512
+                                    $styleArray['alignment']['horizontal'] = PHPExcel_Style_Alignment::HORIZONTAL_RIGHT;
513
+                                    break;
514
+                                case '8':
515
+                                    $styleArray['alignment']['horizontal'] = PHPExcel_Style_Alignment::HORIZONTAL_CENTER;
516
+                                    break;
517
+                                case '16':
518
+                                case '64':
519
+                                    $styleArray['alignment']['horizontal'] = PHPExcel_Style_Alignment::HORIZONTAL_CENTER_CONTINUOUS;
520
+                                    break;
521
+                                case '32':
522
+                                    $styleArray['alignment']['horizontal'] = PHPExcel_Style_Alignment::HORIZONTAL_JUSTIFY;
523
+                                    break;
524
+                            }
525
+
526
+                            switch ($styleAttributes['VAlign']) {
527
+                                case '1':
528
+                                    $styleArray['alignment']['vertical'] = PHPExcel_Style_Alignment::VERTICAL_TOP;
529
+                                    break;
530
+                                case '2':
531
+                                    $styleArray['alignment']['vertical'] = PHPExcel_Style_Alignment::VERTICAL_BOTTOM;
532
+                                    break;
533
+                                case '4':
534
+                                    $styleArray['alignment']['vertical'] = PHPExcel_Style_Alignment::VERTICAL_CENTER;
535
+                                    break;
536
+                                case '8':
537
+                                    $styleArray['alignment']['vertical'] = PHPExcel_Style_Alignment::VERTICAL_JUSTIFY;
538
+                                    break;
539
+                            }
540
+
541
+                            $styleArray['alignment']['wrap'] = ($styleAttributes['WrapText'] == '1') ? true : false;
542
+                            $styleArray['alignment']['shrinkToFit'] = ($styleAttributes['ShrinkToFit'] == '1') ? true : false;
543
+                            $styleArray['alignment']['indent'] = (intval($styleAttributes["Indent"]) > 0) ? $styleAttributes["indent"] : 0;
544
+
545
+                            $RGB = self::parseGnumericColour($styleAttributes["Fore"]);
546
+                            $styleArray['font']['color']['rgb'] = $RGB;
547
+                            $RGB = self::parseGnumericColour($styleAttributes["Back"]);
548
+                            $shade = $styleAttributes["Shade"];
549
+                            if (($RGB != '000000') || ($shade != '0')) {
550
+                                $styleArray['fill']['color']['rgb'] = $styleArray['fill']['startcolor']['rgb'] = $RGB;
551
+                                $RGB2 = self::parseGnumericColour($styleAttributes["PatternColor"]);
552
+                                $styleArray['fill']['endcolor']['rgb'] = $RGB2;
553
+                                switch ($shade) {
554
+                                    case '1':
555
+                                        $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_SOLID;
556
+                                        break;
557
+                                    case '2':
558
+                                        $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_GRADIENT_LINEAR;
559
+                                        break;
560
+                                    case '3':
561
+                                        $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_GRADIENT_PATH;
562
+                                        break;
563
+                                    case '4':
564
+                                        $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_DARKDOWN;
565
+                                        break;
566
+                                    case '5':
567
+                                        $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_DARKGRAY;
568
+                                        break;
569
+                                    case '6':
570
+                                        $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_DARKGRID;
571
+                                        break;
572
+                                    case '7':
573
+                                        $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_DARKHORIZONTAL;
574
+                                        break;
575
+                                    case '8':
576
+                                        $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_DARKTRELLIS;
577
+                                        break;
578
+                                    case '9':
579
+                                        $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_DARKUP;
580
+                                        break;
581
+                                    case '10':
582
+                                        $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_DARKVERTICAL;
583
+                                        break;
584
+                                    case '11':
585
+                                        $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_GRAY0625;
586
+                                        break;
587
+                                    case '12':
588
+                                        $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_GRAY125;
589
+                                        break;
590
+                                    case '13':
591
+                                        $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_LIGHTDOWN;
592
+                                        break;
593
+                                    case '14':
594
+                                        $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_LIGHTGRAY;
595
+                                        break;
596
+                                    case '15':
597
+                                        $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_LIGHTGRID;
598
+                                        break;
599
+                                    case '16':
600
+                                        $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_LIGHTHORIZONTAL;
601
+                                        break;
602
+                                    case '17':
603
+                                        $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_LIGHTTRELLIS;
604
+                                        break;
605
+                                    case '18':
606
+                                        $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_LIGHTUP;
607
+                                        break;
608
+                                    case '19':
609
+                                        $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_LIGHTVERTICAL;
610
+                                        break;
611
+                                    case '20':
612
+                                        $styleArray['fill']['type'] = PHPExcel_Style_Fill::FILL_PATTERN_MEDIUMGRAY;
613
+                                        break;
614
+                                }
615
+                            }
616
+
617
+                            $fontAttributes = $styleRegion->Style->Font->attributes();
618
+//                            var_dump($fontAttributes);
619
+//                            echo '<br />';
620
+                            $styleArray['font']['name'] = (string) $styleRegion->Style->Font;
621
+                            $styleArray['font']['size'] = intval($fontAttributes['Unit']);
622
+                            $styleArray['font']['bold'] = ($fontAttributes['Bold'] == '1') ? true : false;
623
+                            $styleArray['font']['italic'] = ($fontAttributes['Italic'] == '1') ? true : false;
624
+                            $styleArray['font']['strike'] = ($fontAttributes['StrikeThrough'] == '1') ? true : false;
625
+                            switch ($fontAttributes['Underline']) {
626
+                                case '1':
627
+                                    $styleArray['font']['underline'] = PHPExcel_Style_Font::UNDERLINE_SINGLE;
628
+                                    break;
629
+                                case '2':
630
+                                    $styleArray['font']['underline'] = PHPExcel_Style_Font::UNDERLINE_DOUBLE;
631
+                                    break;
632
+                                case '3':
633
+                                    $styleArray['font']['underline'] = PHPExcel_Style_Font::UNDERLINE_SINGLEACCOUNTING;
634
+                                    break;
635
+                                case '4':
636
+                                    $styleArray['font']['underline'] = PHPExcel_Style_Font::UNDERLINE_DOUBLEACCOUNTING;
637
+                                    break;
638
+                                default:
639
+                                    $styleArray['font']['underline'] = PHPExcel_Style_Font::UNDERLINE_NONE;
640
+                                    break;
641
+                            }
642
+                            switch ($fontAttributes['Script']) {
643
+                                case '1':
644
+                                    $styleArray['font']['superScript'] = true;
645
+                                    break;
646
+                                case '-1':
647
+                                    $styleArray['font']['subScript'] = true;
648
+                                    break;
649
+                            }
650
+
651
+                            if (isset($styleRegion->Style->StyleBorder)) {
652
+                                if (isset($styleRegion->Style->StyleBorder->Top)) {
653
+                                    $styleArray['borders']['top'] = self::parseBorderAttributes($styleRegion->Style->StyleBorder->Top->attributes());
654
+                                }
655
+                                if (isset($styleRegion->Style->StyleBorder->Bottom)) {
656
+                                    $styleArray['borders']['bottom'] = self::parseBorderAttributes($styleRegion->Style->StyleBorder->Bottom->attributes());
657
+                                }
658
+                                if (isset($styleRegion->Style->StyleBorder->Left)) {
659
+                                    $styleArray['borders']['left'] = self::parseBorderAttributes($styleRegion->Style->StyleBorder->Left->attributes());
660
+                                }
661
+                                if (isset($styleRegion->Style->StyleBorder->Right)) {
662
+                                    $styleArray['borders']['right'] = self::parseBorderAttributes($styleRegion->Style->StyleBorder->Right->attributes());
663
+                                }
664
+                                if ((isset($styleRegion->Style->StyleBorder->Diagonal)) && (isset($styleRegion->Style->StyleBorder->{'Rev-Diagonal'}))) {
665
+                                    $styleArray['borders']['diagonal'] = self::parseBorderAttributes($styleRegion->Style->StyleBorder->Diagonal->attributes());
666
+                                    $styleArray['borders']['diagonaldirection'] = PHPExcel_Style_Borders::DIAGONAL_BOTH;
667
+                                } elseif (isset($styleRegion->Style->StyleBorder->Diagonal)) {
668
+                                    $styleArray['borders']['diagonal'] = self::parseBorderAttributes($styleRegion->Style->StyleBorder->Diagonal->attributes());
669
+                                    $styleArray['borders']['diagonaldirection'] = PHPExcel_Style_Borders::DIAGONAL_UP;
670
+                                } elseif (isset($styleRegion->Style->StyleBorder->{'Rev-Diagonal'})) {
671
+                                    $styleArray['borders']['diagonal'] = self::parseBorderAttributes($styleRegion->Style->StyleBorder->{'Rev-Diagonal'}->attributes());
672
+                                    $styleArray['borders']['diagonaldirection'] = PHPExcel_Style_Borders::DIAGONAL_DOWN;
673
+                                }
674
+                            }
675
+                            if (isset($styleRegion->Style->HyperLink)) {
676
+                                //    TO DO
677
+                                $hyperlink = $styleRegion->Style->HyperLink->attributes();
678
+                            }
679
+                        }
680
+//                        var_dump($styleArray);
681
+//                        echo '<br />';
682
+                        $objPHPExcel->getActiveSheet()->getStyle($cellRange)->applyFromArray($styleArray);
683
+                    }
684
+                }
685
+            }
686
+
687
+            if ((!$this->readDataOnly) && (isset($sheet->Cols))) {
688
+                //    Column Widths
689
+                $columnAttributes = $sheet->Cols->attributes();
690
+                $defaultWidth = $columnAttributes['DefaultSizePts']  / 5.4;
691
+                $c = 0;
692
+                foreach ($sheet->Cols->ColInfo as $columnOverride) {
693
+                    $columnAttributes = $columnOverride->attributes();
694
+                    $column = $columnAttributes['No'];
695
+                    $columnWidth = $columnAttributes['Unit']  / 5.4;
696
+                    $hidden = ((isset($columnAttributes['Hidden'])) && ($columnAttributes['Hidden'] == '1')) ? true : false;
697
+                    $columnCount = (isset($columnAttributes['Count'])) ? $columnAttributes['Count'] : 1;
698
+                    while ($c < $column) {
699
+                        $objPHPExcel->getActiveSheet()->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($c))->setWidth($defaultWidth);
700
+                        ++$c;
701
+                    }
702
+                    while (($c < ($column+$columnCount)) && ($c <= $maxCol)) {
703
+                        $objPHPExcel->getActiveSheet()->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($c))->setWidth($columnWidth);
704
+                        if ($hidden) {
705
+                            $objPHPExcel->getActiveSheet()->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($c))->setVisible(false);
706
+                        }
707
+                        ++$c;
708
+                    }
709
+                }
710
+                while ($c <= $maxCol) {
711
+                    $objPHPExcel->getActiveSheet()->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($c))->setWidth($defaultWidth);
712
+                    ++$c;
713
+                }
714
+            }
715
+
716
+            if ((!$this->readDataOnly) && (isset($sheet->Rows))) {
717
+                //    Row Heights
718
+                $rowAttributes = $sheet->Rows->attributes();
719
+                $defaultHeight = $rowAttributes['DefaultSizePts'];
720
+                $r = 0;
721
+
722
+                foreach ($sheet->Rows->RowInfo as $rowOverride) {
723
+                    $rowAttributes = $rowOverride->attributes();
724
+                    $row = $rowAttributes['No'];
725
+                    $rowHeight = $rowAttributes['Unit'];
726
+                    $hidden = ((isset($rowAttributes['Hidden'])) && ($rowAttributes['Hidden'] == '1')) ? true : false;
727
+                    $rowCount = (isset($rowAttributes['Count'])) ? $rowAttributes['Count'] : 1;
728
+                    while ($r < $row) {
729
+                        ++$r;
730
+                        $objPHPExcel->getActiveSheet()->getRowDimension($r)->setRowHeight($defaultHeight);
731
+                    }
732
+                    while (($r < ($row+$rowCount)) && ($r < $maxRow)) {
733
+                        ++$r;
734
+                        $objPHPExcel->getActiveSheet()->getRowDimension($r)->setRowHeight($rowHeight);
735
+                        if ($hidden) {
736
+                            $objPHPExcel->getActiveSheet()->getRowDimension($r)->setVisible(false);
737
+                        }
738
+                    }
739
+                }
740
+                while ($r < $maxRow) {
741
+                    ++$r;
742
+                    $objPHPExcel->getActiveSheet()->getRowDimension($r)->setRowHeight($defaultHeight);
743
+                }
744
+            }
745
+
746
+            //    Handle Merged Cells in this worksheet
747
+            if (isset($sheet->MergedRegions)) {
748
+                foreach ($sheet->MergedRegions->Merge as $mergeCells) {
749
+                    if (strpos($mergeCells, ':') !== false) {
750
+                        $objPHPExcel->getActiveSheet()->mergeCells($mergeCells);
751
+                    }
752
+                }
753
+            }
754
+
755
+            $worksheetID++;
756
+        }
757
+
758
+        //    Loop through definedNames (global named ranges)
759
+        if (isset($gnmXML->Names)) {
760
+            foreach ($gnmXML->Names->Name as $namedRange) {
761
+                $name = (string) $namedRange->name;
762
+                $range = (string) $namedRange->value;
763
+                if (stripos($range, '#REF!') !== false) {
764
+                    continue;
765
+                }
766
+
767
+                $range = explode('!', $range);
768
+                $range[0] = trim($range[0], "'");
769
+                if ($worksheet = $objPHPExcel->getSheetByName($range[0])) {
770
+                    $extractedRange = str_replace('$', '', $range[1]);
771
+                    $objPHPExcel->addNamedRange(new PHPExcel_NamedRange($name, $worksheet, $extractedRange));
772
+                }
773
+            }
774
+        }
775
+
776
+        // Return
777
+        return $objPHPExcel;
778
+    }
779
+
780
+    private static function parseBorderAttributes($borderAttributes)
781
+    {
782
+        $styleArray = array();
783
+        if (isset($borderAttributes["Color"])) {
784
+            $styleArray['color']['rgb'] = self::parseGnumericColour($borderAttributes["Color"]);
785
+        }
786
+
787
+        switch ($borderAttributes["Style"]) {
788
+            case '0':
789
+                $styleArray['style'] = PHPExcel_Style_Border::BORDER_NONE;
790
+                break;
791
+            case '1':
792
+                $styleArray['style'] = PHPExcel_Style_Border::BORDER_THIN;
793
+                break;
794
+            case '2':
795
+                $styleArray['style'] = PHPExcel_Style_Border::BORDER_MEDIUM;
796
+                break;
797
+            case '3':
798
+                $styleArray['style'] = PHPExcel_Style_Border::BORDER_SLANTDASHDOT;
799
+                break;
800
+            case '4':
801
+                $styleArray['style'] = PHPExcel_Style_Border::BORDER_DASHED;
802
+                break;
803
+            case '5':
804
+                $styleArray['style'] = PHPExcel_Style_Border::BORDER_THICK;
805
+                break;
806
+            case '6':
807
+                $styleArray['style'] = PHPExcel_Style_Border::BORDER_DOUBLE;
808
+                break;
809
+            case '7':
810
+                $styleArray['style'] = PHPExcel_Style_Border::BORDER_DOTTED;
811
+                break;
812
+            case '8':
813
+                $styleArray['style'] = PHPExcel_Style_Border::BORDER_MEDIUMDASHED;
814
+                break;
815
+            case '9':
816
+                $styleArray['style'] = PHPExcel_Style_Border::BORDER_DASHDOT;
817
+                break;
818
+            case '10':
819
+                $styleArray['style'] = PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT;
820
+                break;
821
+            case '11':
822
+                $styleArray['style'] = PHPExcel_Style_Border::BORDER_DASHDOTDOT;
823
+                break;
824
+            case '12':
825
+                $styleArray['style'] = PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT;
826
+                break;
827
+            case '13':
828
+                $styleArray['style'] = PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT;
829
+                break;
830
+        }
831
+        return $styleArray;
832
+    }
833
+
834
+    private function parseRichText($is = '')
835
+    {
836
+        $value = new PHPExcel_RichText();
837
+        $value->createText($is);
838
+
839
+        return $value;
840
+    }
841
+
842
+    private static function parseGnumericColour($gnmColour)
843
+    {
844
+        list($gnmR, $gnmG, $gnmB) = explode(':', $gnmColour);
845
+        $gnmR = substr(str_pad($gnmR, 4, '0', STR_PAD_RIGHT), 0, 2);
846
+        $gnmG = substr(str_pad($gnmG, 4, '0', STR_PAD_RIGHT), 0, 2);
847
+        $gnmB = substr(str_pad($gnmB, 4, '0', STR_PAD_RIGHT), 0, 2);
848
+        return $gnmR . $gnmG . $gnmB;
849
+    }
850
+}

+ 0
- 0
vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/HTML.php View File


Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save