New files from unstable branch
[fa-stable.git] / reporting / includes / fpdi / wrapper_functions.php
1 <?php
2 //
3 //  FPDI - Version 1.2.1
4 //
5 //    Copyright 2004-2008 Setasign - Jan Slabon
6 //
7 //  Licensed under the Apache License, Version 2.0 (the "License");
8 //  you may not use this file except in compliance with the License.
9 //  You may obtain a copy of the License at
10 //
11 //      http://www.apache.org/licenses/LICENSE-2.0
12 //
13 //  Unless required by applicable law or agreed to in writing, software
14 //  distributed under the License is distributed on an "AS IS" BASIS,
15 //  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 //  See the License for the specific language governing permissions and
17 //  limitations under the License.
18 //
19
20
21 if (!defined("PHP_VER_LOWER43")) 
22         define("PHP_VER_LOWER43", version_compare(PHP_VERSION, "4.3", "<"));
23
24
25 /**
26  * ensure that strspn works correct if php-version < 4.3
27  */
28 function _strspn($str1, $str2, $start=null, $length=null) {
29     $numargs = func_num_args();
30
31     if (PHP_VER_LOWER43 == 1) {
32         if (isset($length)) {
33             $str1 = substr($str1, $start, $length);
34         } else {
35             $str1 = substr($str1, $start);
36         }
37     }
38
39     if ($numargs == 2 || PHP_VER_LOWER43 == 1) {
40         return strspn($str1, $str2);
41     } else if ($numargs == 3) {
42         return strspn($str1, $str2, $start);
43     } else {
44         return strspn($str1, $str2, $start, $length);
45     }
46 }
47
48
49 /**
50  * ensure that strcspn works correct if php-version < 4.3
51  */
52 function _strcspn($str1, $str2, $start=null, $length=null) {
53     $numargs = func_num_args();
54
55     if (PHP_VER_LOWER43 == 1) {
56         if (isset($length)) {
57             $str1 = substr($str1, $start, $length);
58         } else {
59             $str1 = substr($str1, $start);
60         }
61     }
62
63     if ($numargs == 2 || PHP_VER_LOWER43 == 1) {
64         return strcspn($str1, $str2);
65     } else if ($numargs == 3) {
66         return strcspn($str1, $str2, $start);
67     } else {
68         return strcspn($str1, $str2, $start, $length);
69     }
70 }