Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Игорь
vtorpoisk
Commits
9f4f2745
Commit
9f4f2745
authored
Mar 01, 2021
by
Игорь
Browse files
init
parent
a765cdc4
Changes
230
Hide whitespace changes
Inline
Side-by-side
Too many changes to show.
To preserve performance only
230 of 230+
files are displayed.
Plain diff
Email patch
lib/Classes/PHPExcel/Shared/Escher.php
0 → 100644
View file @
9f4f2745
<?php
/**
* PHPExcel
*
* Copyright (c) 2006 - 2014 PHPExcel
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* @category PHPExcel
* @package PHPExcel_Shared_Escher
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 1.8.0, 2014-03-02
*/
/**
* PHPExcel_Shared_Escher
*
* @category PHPExcel
* @package PHPExcel_Shared_Escher
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class
PHPExcel_Shared_Escher
{
/**
* Drawing Group Container
*
* @var PHPExcel_Shared_Escher_DggContainer
*/
private
$_dggContainer
;
/**
* Drawing Container
*
* @var PHPExcel_Shared_Escher_DgContainer
*/
private
$_dgContainer
;
/**
* Get Drawing Group Container
*
* @return PHPExcel_Shared_Escher_DgContainer
*/
public
function
getDggContainer
()
{
return
$this
->
_dggContainer
;
}
/**
* Set Drawing Group Container
*
* @param PHPExcel_Shared_Escher_DggContainer $dggContainer
*/
public
function
setDggContainer
(
$dggContainer
)
{
return
$this
->
_dggContainer
=
$dggContainer
;
}
/**
* Get Drawing Container
*
* @return PHPExcel_Shared_Escher_DgContainer
*/
public
function
getDgContainer
()
{
return
$this
->
_dgContainer
;
}
/**
* Set Drawing Container
*
* @param PHPExcel_Shared_Escher_DgContainer $dgContainer
*/
public
function
setDgContainer
(
$dgContainer
)
{
return
$this
->
_dgContainer
=
$dgContainer
;
}
}
lib/Classes/PHPExcel/Shared/Escher/DgContainer.php
0 → 100644
View file @
9f4f2745
<?php
/**
* PHPExcel
*
* Copyright (c) 2006 - 2014 PHPExcel
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* @category PHPExcel
* @package PHPExcel_Shared_Escher
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 1.8.0, 2014-03-02
*/
/**
* PHPExcel_Shared_Escher_DgContainer
*
* @category PHPExcel
* @package PHPExcel_Shared_Escher
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class
PHPExcel_Shared_Escher_DgContainer
{
/**
* Drawing index, 1-based.
*
* @var int
*/
private
$_dgId
;
/**
* Last shape index in this drawing
*
* @var int
*/
private
$_lastSpId
;
private
$_spgrContainer
=
null
;
public
function
getDgId
()
{
return
$this
->
_dgId
;
}
public
function
setDgId
(
$value
)
{
$this
->
_dgId
=
$value
;
}
public
function
getLastSpId
()
{
return
$this
->
_lastSpId
;
}
public
function
setLastSpId
(
$value
)
{
$this
->
_lastSpId
=
$value
;
}
public
function
getSpgrContainer
()
{
return
$this
->
_spgrContainer
;
}
public
function
setSpgrContainer
(
$spgrContainer
)
{
return
$this
->
_spgrContainer
=
$spgrContainer
;
}
}
lib/Classes/PHPExcel/Shared/Escher/DgContainer/SpgrContainer.php
0 → 100644
View file @
9f4f2745
<?php
/**
* PHPExcel
*
* Copyright (c) 2006 - 2014 PHPExcel
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* @category PHPExcel
* @package PHPExcel_Shared_Escher
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 1.8.0, 2014-03-02
*/
/**
* PHPExcel_Shared_Escher_DgContainer_SpgrContainer
*
* @category PHPExcel
* @package PHPExcel_Shared_Escher
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class
PHPExcel_Shared_Escher_DgContainer_SpgrContainer
{
/**
* Parent Shape Group Container
*
* @var PHPExcel_Shared_Escher_DgContainer_SpgrContainer
*/
private
$_parent
;
/**
* Shape Container collection
*
* @var array
*/
private
$_children
=
array
();
/**
* Set parent Shape Group Container
*
* @param PHPExcel_Shared_Escher_DgContainer_SpgrContainer $parent
*/
public
function
setParent
(
$parent
)
{
$this
->
_parent
=
$parent
;
}
/**
* Get the parent Shape Group Container if any
*
* @return PHPExcel_Shared_Escher_DgContainer_SpgrContainer|null
*/
public
function
getParent
()
{
return
$this
->
_parent
;
}
/**
* Add a child. This will be either spgrContainer or spContainer
*
* @param mixed $child
*/
public
function
addChild
(
$child
)
{
$this
->
_children
[]
=
$child
;
$child
->
setParent
(
$this
);
}
/**
* Get collection of Shape Containers
*/
public
function
getChildren
()
{
return
$this
->
_children
;
}
/**
* Recursively get all spContainers within this spgrContainer
*
* @return PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer[]
*/
public
function
getAllSpContainers
()
{
$allSpContainers
=
array
();
foreach
(
$this
->
_children
as
$child
)
{
if
(
$child
instanceof
PHPExcel_Shared_Escher_DgContainer_SpgrContainer
)
{
$allSpContainers
=
array_merge
(
$allSpContainers
,
$child
->
getAllSpContainers
());
}
else
{
$allSpContainers
[]
=
$child
;
}
}
return
$allSpContainers
;
}
}
lib/Classes/PHPExcel/Shared/Escher/DgContainer/SpgrContainer/SpContainer.php
0 → 100644
View file @
9f4f2745
<?php
/**
* PHPExcel
*
* Copyright (c) 2006 - 2014 PHPExcel
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* @category PHPExcel
* @package PHPExcel_Shared_Escher
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 1.8.0, 2014-03-02
*/
/**
* PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
*
* @category PHPExcel
* @package PHPExcel_Shared_Escher
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class
PHPExcel_Shared_Escher_DgContainer_SpgrContainer_SpContainer
{
/**
* Parent Shape Group Container
*
* @var PHPExcel_Shared_Escher_DgContainer_SpgrContainer
*/
private
$_parent
;
/**
* Is this a group shape?
*
* @var boolean
*/
private
$_spgr
=
false
;
/**
* Shape type
*
* @var int
*/
private
$_spType
;
/**
* Shape flag
*
* @var int
*/
private
$_spFlag
;
/**
* Shape index (usually group shape has index 0, and the rest: 1,2,3...)
*
* @var boolean
*/
private
$_spId
;
/**
* Array of options
*
* @var array
*/
private
$_OPT
;
/**
* Cell coordinates of upper-left corner of shape, e.g. 'A1'
*
* @var string
*/
private
$_startCoordinates
;
/**
* Horizontal offset of upper-left corner of shape measured in 1/1024 of column width
*
* @var int
*/
private
$_startOffsetX
;
/**
* Vertical offset of upper-left corner of shape measured in 1/256 of row height
*
* @var int
*/
private
$_startOffsetY
;
/**
* Cell coordinates of bottom-right corner of shape, e.g. 'B2'
*
* @var string
*/
private
$_endCoordinates
;
/**
* Horizontal offset of bottom-right corner of shape measured in 1/1024 of column width
*
* @var int
*/
private
$_endOffsetX
;
/**
* Vertical offset of bottom-right corner of shape measured in 1/256 of row height
*
* @var int
*/
private
$_endOffsetY
;
/**
* Set parent Shape Group Container
*
* @param PHPExcel_Shared_Escher_DgContainer_SpgrContainer $parent
*/
public
function
setParent
(
$parent
)
{
$this
->
_parent
=
$parent
;
}
/**
* Get the parent Shape Group Container
*
* @return PHPExcel_Shared_Escher_DgContainer_SpgrContainer
*/
public
function
getParent
()
{
return
$this
->
_parent
;
}
/**
* Set whether this is a group shape
*
* @param boolean $value
*/
public
function
setSpgr
(
$value
=
false
)
{
$this
->
_spgr
=
$value
;
}
/**
* Get whether this is a group shape
*
* @return boolean
*/
public
function
getSpgr
()
{
return
$this
->
_spgr
;
}
/**
* Set the shape type
*
* @param int $value
*/
public
function
setSpType
(
$value
)
{
$this
->
_spType
=
$value
;
}
/**
* Get the shape type
*
* @return int
*/
public
function
getSpType
()
{
return
$this
->
_spType
;
}
/**
* Set the shape flag
*
* @param int $value
*/
public
function
setSpFlag
(
$value
)
{
$this
->
_spFlag
=
$value
;
}
/**
* Get the shape flag
*
* @return int
*/
public
function
getSpFlag
()
{
return
$this
->
_spFlag
;
}
/**
* Set the shape index
*
* @param int $value
*/
public
function
setSpId
(
$value
)
{
$this
->
_spId
=
$value
;
}
/**
* Get the shape index
*
* @return int
*/
public
function
getSpId
()
{
return
$this
->
_spId
;
}
/**
* Set an option for the Shape Group Container
*
* @param int $property The number specifies the option
* @param mixed $value
*/
public
function
setOPT
(
$property
,
$value
)
{
$this
->
_OPT
[
$property
]
=
$value
;
}
/**
* Get an option for the Shape Group Container
*
* @param int $property The number specifies the option
* @return mixed
*/
public
function
getOPT
(
$property
)
{
if
(
isset
(
$this
->
_OPT
[
$property
]))
{
return
$this
->
_OPT
[
$property
];
}
return
null
;
}
/**
* Get the collection of options
*
* @return array
*/
public
function
getOPTCollection
()
{
return
$this
->
_OPT
;
}
/**
* Set cell coordinates of upper-left corner of shape
*
* @param string $value
*/
public
function
setStartCoordinates
(
$value
=
'A1'
)
{
$this
->
_startCoordinates
=
$value
;
}
/**
* Get cell coordinates of upper-left corner of shape
*
* @return string
*/
public
function
getStartCoordinates
()
{
return
$this
->
_startCoordinates
;
}
/**
* Set offset in x-direction of upper-left corner of shape measured in 1/1024 of column width
*
* @param int $startOffsetX
*/
public
function
setStartOffsetX
(
$startOffsetX
=
0
)
{
$this
->
_startOffsetX
=
$startOffsetX
;
}
/**
* Get offset in x-direction of upper-left corner of shape measured in 1/1024 of column width
*
* @return int
*/
public
function
getStartOffsetX
()
{
return
$this
->
_startOffsetX
;
}
/**
* Set offset in y-direction of upper-left corner of shape measured in 1/256 of row height
*
* @param int $startOffsetY
*/
public
function
setStartOffsetY
(
$startOffsetY
=
0
)
{
$this
->
_startOffsetY
=
$startOffsetY
;
}
/**
* Get offset in y-direction of upper-left corner of shape measured in 1/256 of row height
*
* @return int
*/
public
function
getStartOffsetY
()
{
return
$this
->
_startOffsetY
;
}
/**
* Set cell coordinates of bottom-right corner of shape
*
* @param string $value
*/
public
function
setEndCoordinates
(
$value
=
'A1'
)
{
$this
->
_endCoordinates
=
$value
;
}
/**
* Get cell coordinates of bottom-right corner of shape
*
* @return string
*/
public
function
getEndCoordinates
()
{
return
$this
->
_endCoordinates
;
}
/**
* Set offset in x-direction of bottom-right corner of shape measured in 1/1024 of column width
*
* @param int $startOffsetX
*/
public
function
setEndOffsetX
(
$endOffsetX
=
0
)
{
$this
->
_endOffsetX
=
$endOffsetX
;
}
/**
* Get offset in x-direction of bottom-right corner of shape measured in 1/1024 of column width
*
* @return int
*/
public
function
getEndOffsetX
()
{
return
$this
->
_endOffsetX
;
}
/**
* Set offset in y-direction of bottom-right corner of shape measured in 1/256 of row height
*
* @param int $endOffsetY
*/
public
function
setEndOffsetY
(
$endOffsetY
=
0
)
{
$this
->
_endOffsetY
=
$endOffsetY
;
}
/**
* Get offset in y-direction of bottom-right corner of shape measured in 1/256 of row height
*
* @return int
*/
public
function
getEndOffsetY
()
{
return
$this
->
_endOffsetY
;
}
/**
* Get the nesting level of this spContainer. This is the number of spgrContainers between this spContainer and
* the dgContainer. A value of 1 = immediately within first spgrContainer
* Higher nesting level occurs if and only if spContainer is part of a shape group
*
* @return int Nesting level
*/
public
function
getNestingLevel
()
{
$nestingLevel
=
0
;
$parent
=
$this
->
getParent
();
while
(
$parent
instanceof
PHPExcel_Shared_Escher_DgContainer_SpgrContainer
)
{
++
$nestingLevel
;
$parent
=
$parent
->
getParent
();
}
return
$nestingLevel
;
}
}
lib/Classes/PHPExcel/Shared/Escher/DggContainer.php
0 → 100644
View file @
9f4f2745
<?php
/**
* PHPExcel
*
* Copyright (c) 2006 - 2014 PHPExcel
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* @category PHPExcel
* @package PHPExcel_Shared_Escher
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 1.8.0, 2014-03-02
*/
/**
* PHPExcel_Shared_Escher_DggContainer
*
* @category PHPExcel
* @package PHPExcel_Shared_Escher
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class
PHPExcel_Shared_Escher_DggContainer
{
/**
* Maximum shape index of all shapes in all drawings increased by one
*
* @var int
*/
private
$_spIdMax
;
/**
* Total number of drawings saved
*
* @var int
*/
private
$_cDgSaved
;
/**
* Total number of shapes saved (including group shapes)
*
* @var int
*/
private
$_cSpSaved
;
/**
* BLIP Store Container
*
* @var PHPExcel_Shared_Escher_DggContainer_BstoreContainer
*/
private
$_bstoreContainer
;
/**
* Array of options for the drawing group
*
* @var array
*/
private
$_OPT
=
array
();
/**
* Array of identifier clusters containg information about the maximum shape identifiers
*
* @var array
*/
private
$_IDCLs
=
array
();
/**
* Get maximum shape index of all shapes in all drawings (plus one)
*
* @return int
*/
public
function
getSpIdMax
()
{
return
$this
->
_spIdMax
;
}
/**
* Set maximum shape index of all shapes in all drawings (plus one)
*
* @param int
*/
public
function
setSpIdMax
(
$value
)
{
$this
->
_spIdMax
=
$value
;
}
/**
* Get total number of drawings saved
*
* @return int
*/
public
function
getCDgSaved
()
{
return
$this
->
_cDgSaved
;
}
/**
* Set total number of drawings saved
*
* @param int
*/
public
function
setCDgSaved
(
$value
)
{
$this
->
_cDgSaved
=
$value
;
}
/**
* Get total number of shapes saved (including group shapes)
*
* @return int
*/
public
function
getCSpSaved
()
{
return
$this
->
_cSpSaved
;
}
/**
* Set total number of shapes saved (including group shapes)
*
* @param int
*/
public
function
setCSpSaved
(
$value
)
{
$this
->
_cSpSaved
=
$value
;
}
/**
* Get BLIP Store Container
*
* @return PHPExcel_Shared_Escher_DggContainer_BstoreContainer
*/
public
function
getBstoreContainer
()
{
return
$this
->
_bstoreContainer
;
}
/**
* Set BLIP Store Container
*
* @param PHPExcel_Shared_Escher_DggContainer_BstoreContainer $bstoreContainer
*/
public
function
setBstoreContainer
(
$bstoreContainer
)
{
$this
->
_bstoreContainer
=
$bstoreContainer
;
}
/**
* Set an option for the drawing group
*
* @param int $property The number specifies the option
* @param mixed $value
*/
public
function
setOPT
(
$property
,
$value
)
{
$this
->
_OPT
[
$property
]
=
$value
;
}
/**
* Get an option for the drawing group
*
* @param int $property The number specifies the option
* @return mixed
*/
public
function
getOPT
(
$property
)
{
if
(
isset
(
$this
->
_OPT
[
$property
]))
{
return
$this
->
_OPT
[
$property
];
}
return
null
;
}
/**
* Get identifier clusters
*
* @return array
*/
public
function
getIDCLs
()
{
return
$this
->
_IDCLs
;
}
/**
* Set identifier clusters. array(<drawingId> => <max shape id>, ...)
*
* @param array $pValue
*/
public
function
setIDCLs
(
$pValue
)
{
$this
->
_IDCLs
=
$pValue
;
}
}
lib/Classes/PHPExcel/Shared/Escher/DggContainer/BstoreContainer.php
0 → 100644
View file @
9f4f2745
<?php
/**
* PHPExcel
*
* Copyright (c) 2006 - 2014 PHPExcel
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* @category PHPExcel
* @package PHPExcel_Shared_Escher
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 1.8.0, 2014-03-02
*/
/**
* PHPExcel_Shared_Escher_DggContainer_BstoreContainer
*
* @category PHPExcel
* @package PHPExcel_Shared_Escher
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class
PHPExcel_Shared_Escher_DggContainer_BstoreContainer
{
/**
* BLIP Store Entries. Each of them holds one BLIP (Big Large Image or Picture)
*
* @var array
*/
private
$_BSECollection
=
array
();
/**
* Add a BLIP Store Entry
*
* @param PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE $BSE
*/
public
function
addBSE
(
$BSE
)
{
$this
->
_BSECollection
[]
=
$BSE
;
$BSE
->
setParent
(
$this
);
}
/**
* Get the collection of BLIP Store Entries
*
* @return PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE[]
*/
public
function
getBSECollection
()
{
return
$this
->
_BSECollection
;
}
}
lib/Classes/PHPExcel/Shared/Escher/DggContainer/BstoreContainer/BSE.php
0 → 100644
View file @
9f4f2745
<?php
/**
* PHPExcel
*
* Copyright (c) 2006 - 2014 PHPExcel
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* @category PHPExcel
* @package PHPExcel_Shared_Escher
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 1.8.0, 2014-03-02
*/
/**
* PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE
*
* @category PHPExcel
* @package PHPExcel_Shared_Escher
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class
PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE
{
const
BLIPTYPE_ERROR
=
0x00
;
const
BLIPTYPE_UNKNOWN
=
0x01
;
const
BLIPTYPE_EMF
=
0x02
;
const
BLIPTYPE_WMF
=
0x03
;
const
BLIPTYPE_PICT
=
0x04
;
const
BLIPTYPE_JPEG
=
0x05
;
const
BLIPTYPE_PNG
=
0x06
;
const
BLIPTYPE_DIB
=
0x07
;
const
BLIPTYPE_TIFF
=
0x11
;
const
BLIPTYPE_CMYKJPEG
=
0x12
;
/**
* The parent BLIP Store Entry Container
*
* @var PHPExcel_Shared_Escher_DggContainer_BstoreContainer
*/
private
$_parent
;
/**
* The BLIP (Big Large Image or Picture)
*
* @var PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip
*/
private
$_blip
;
/**
* The BLIP type
*
* @var int
*/
private
$_blipType
;
/**
* Set parent BLIP Store Entry Container
*
* @param PHPExcel_Shared_Escher_DggContainer_BstoreContainer $parent
*/
public
function
setParent
(
$parent
)
{
$this
->
_parent
=
$parent
;
}
/**
* Get the BLIP
*
* @return PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip
*/
public
function
getBlip
()
{
return
$this
->
_blip
;
}
/**
* Set the BLIP
*
* @param PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip $blip
*/
public
function
setBlip
(
$blip
)
{
$this
->
_blip
=
$blip
;
$blip
->
setParent
(
$this
);
}
/**
* Get the BLIP type
*
* @return int
*/
public
function
getBlipType
()
{
return
$this
->
_blipType
;
}
/**
* Set the BLIP type
*
* @param int
*/
public
function
setBlipType
(
$blipType
)
{
$this
->
_blipType
=
$blipType
;
}
}
lib/Classes/PHPExcel/Shared/Escher/DggContainer/BstoreContainer/BSE/Blip.php
0 → 100644
View file @
9f4f2745
<?php
/**
* PHPExcel
*
* Copyright (c) 2006 - 2014 PHPExcel
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* @category PHPExcel
* @package PHPExcel_Shared_Escher
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 1.8.0, 2014-03-02
*/
/**
* PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip
*
* @category PHPExcel
* @package PHPExcel_Shared_Escher
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class
PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE_Blip
{
/**
* The parent BSE
*
* @var PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE
*/
private
$_parent
;
/**
* Raw image data
*
* @var string
*/
private
$_data
;
/**
* Get the raw image data
*
* @return string
*/
public
function
getData
()
{
return
$this
->
_data
;
}
/**
* Set the raw image data
*
* @param string
*/
public
function
setData
(
$data
)
{
$this
->
_data
=
$data
;
}
/**
* Set parent BSE
*
* @param PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE $parent
*/
public
function
setParent
(
$parent
)
{
$this
->
_parent
=
$parent
;
}
/**
* Get parent BSE
*
* @return PHPExcel_Shared_Escher_DggContainer_BstoreContainer_BSE $parent
*/
public
function
getParent
()
{
return
$this
->
_parent
;
}
}
lib/Classes/PHPExcel/Shared/Excel5.php
0 → 100644
View file @
9f4f2745
<?php
/**
* PHPExcel
*
* Copyright (c) 2006 - 2014 PHPExcel
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* @category PHPExcel
* @package PHPExcel_Shared
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 1.8.0, 2014-03-02
*/
/**
* PHPExcel_Shared_Excel5
*
* @category PHPExcel
* @package PHPExcel_Shared
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class
PHPExcel_Shared_Excel5
{
/**
* Get the width of a column in pixels. We use the relationship y = ceil(7x) where
* x is the width in intrinsic Excel units (measuring width in number of normal characters)
* This holds for Arial 10
*
* @param PHPExcel_Worksheet $sheet The sheet
* @param string $col The column
* @return integer The width in pixels
*/
public
static
function
sizeCol
(
$sheet
,
$col
=
'A'
)
{
// default font of the workbook
$font
=
$sheet
->
getParent
()
->
getDefaultStyle
()
->
getFont
();
$columnDimensions
=
$sheet
->
getColumnDimensions
();
// first find the true column width in pixels (uncollapsed and unhidden)
if
(
isset
(
$columnDimensions
[
$col
])
and
$columnDimensions
[
$col
]
->
getWidth
()
!=
-
1
)
{
// then we have column dimension with explicit width
$columnDimension
=
$columnDimensions
[
$col
];
$width
=
$columnDimension
->
getWidth
();
$pixelWidth
=
PHPExcel_Shared_Drawing
::
cellDimensionToPixels
(
$width
,
$font
);
}
else
if
(
$sheet
->
getDefaultColumnDimension
()
->
getWidth
()
!=
-
1
)
{
// then we have default column dimension with explicit width
$defaultColumnDimension
=
$sheet
->
getDefaultColumnDimension
();
$width
=
$defaultColumnDimension
->
getWidth
();
$pixelWidth
=
PHPExcel_Shared_Drawing
::
cellDimensionToPixels
(
$width
,
$font
);
}
else
{
// we don't even have any default column dimension. Width depends on default font
$pixelWidth
=
PHPExcel_Shared_Font
::
getDefaultColumnWidthByFont
(
$font
,
true
);
}
// now find the effective column width in pixels
if
(
isset
(
$columnDimensions
[
$col
])
and
!
$columnDimensions
[
$col
]
->
getVisible
())
{
$effectivePixelWidth
=
0
;
}
else
{
$effectivePixelWidth
=
$pixelWidth
;
}
return
$effectivePixelWidth
;
}
/**
* Convert the height of a cell from user's units to pixels. By interpolation
* the relationship is: y = 4/3x. If the height hasn't been set by the user we
* use the default value. If the row is hidden we use a value of zero.
*
* @param PHPExcel_Worksheet $sheet The sheet
* @param integer $row The row index (1-based)
* @return integer The width in pixels
*/
public
static
function
sizeRow
(
$sheet
,
$row
=
1
)
{
// default font of the workbook
$font
=
$sheet
->
getParent
()
->
getDefaultStyle
()
->
getFont
();
$rowDimensions
=
$sheet
->
getRowDimensions
();
// first find the true row height in pixels (uncollapsed and unhidden)
if
(
isset
(
$rowDimensions
[
$row
])
and
$rowDimensions
[
$row
]
->
getRowHeight
()
!=
-
1
)
{
// then we have a row dimension
$rowDimension
=
$rowDimensions
[
$row
];
$rowHeight
=
$rowDimension
->
getRowHeight
();
$pixelRowHeight
=
(
int
)
ceil
(
4
*
$rowHeight
/
3
);
// here we assume Arial 10
}
else
if
(
$sheet
->
getDefaultRowDimension
()
->
getRowHeight
()
!=
-
1
)
{
// then we have a default row dimension with explicit height
$defaultRowDimension
=
$sheet
->
getDefaultRowDimension
();
$rowHeight
=
$defaultRowDimension
->
getRowHeight
();
$pixelRowHeight
=
PHPExcel_Shared_Drawing
::
pointsToPixels
(
$rowHeight
);
}
else
{
// we don't even have any default row dimension. Height depends on default font
$pointRowHeight
=
PHPExcel_Shared_Font
::
getDefaultRowHeightByFont
(
$font
);
$pixelRowHeight
=
PHPExcel_Shared_Font
::
fontSizeToPixels
(
$pointRowHeight
);
}
// now find the effective row height in pixels
if
(
isset
(
$rowDimensions
[
$row
])
and
!
$rowDimensions
[
$row
]
->
getVisible
()
)
{
$effectivePixelRowHeight
=
0
;
}
else
{
$effectivePixelRowHeight
=
$pixelRowHeight
;
}
return
$effectivePixelRowHeight
;
}
/**
* Get the horizontal distance in pixels between two anchors
* The distanceX is found as sum of all the spanning columns widths minus correction for the two offsets
*
* @param PHPExcel_Worksheet $sheet
* @param string $startColumn
* @param integer $startOffsetX Offset within start cell measured in 1/1024 of the cell width
* @param string $endColumn
* @param integer $endOffsetX Offset within end cell measured in 1/1024 of the cell width
* @return integer Horizontal measured in pixels
*/
public
static
function
getDistanceX
(
PHPExcel_Worksheet
$sheet
,
$startColumn
=
'A'
,
$startOffsetX
=
0
,
$endColumn
=
'A'
,
$endOffsetX
=
0
)
{
$distanceX
=
0
;
// add the widths of the spanning columns
$startColumnIndex
=
PHPExcel_Cell
::
columnIndexFromString
(
$startColumn
)
-
1
;
// 1-based
$endColumnIndex
=
PHPExcel_Cell
::
columnIndexFromString
(
$endColumn
)
-
1
;
// 1-based
for
(
$i
=
$startColumnIndex
;
$i
<=
$endColumnIndex
;
++
$i
)
{
$distanceX
+=
self
::
sizeCol
(
$sheet
,
PHPExcel_Cell
::
stringFromColumnIndex
(
$i
));
}
// correct for offsetX in startcell
$distanceX
-=
(
int
)
floor
(
self
::
sizeCol
(
$sheet
,
$startColumn
)
*
$startOffsetX
/
1024
);
// correct for offsetX in endcell
$distanceX
-=
(
int
)
floor
(
self
::
sizeCol
(
$sheet
,
$endColumn
)
*
(
1
-
$endOffsetX
/
1024
));
return
$distanceX
;
}
/**
* Get the vertical distance in pixels between two anchors
* The distanceY is found as sum of all the spanning rows minus two offsets
*
* @param PHPExcel_Worksheet $sheet
* @param integer $startRow (1-based)
* @param integer $startOffsetY Offset within start cell measured in 1/256 of the cell height
* @param integer $endRow (1-based)
* @param integer $endOffsetY Offset within end cell measured in 1/256 of the cell height
* @return integer Vertical distance measured in pixels
*/
public
static
function
getDistanceY
(
PHPExcel_Worksheet
$sheet
,
$startRow
=
1
,
$startOffsetY
=
0
,
$endRow
=
1
,
$endOffsetY
=
0
)
{
$distanceY
=
0
;
// add the widths of the spanning rows
for
(
$row
=
$startRow
;
$row
<=
$endRow
;
++
$row
)
{
$distanceY
+=
self
::
sizeRow
(
$sheet
,
$row
);
}
// correct for offsetX in startcell
$distanceY
-=
(
int
)
floor
(
self
::
sizeRow
(
$sheet
,
$startRow
)
*
$startOffsetY
/
256
);
// correct for offsetX in endcell
$distanceY
-=
(
int
)
floor
(
self
::
sizeRow
(
$sheet
,
$endRow
)
*
(
1
-
$endOffsetY
/
256
));
return
$distanceY
;
}
/**
* Convert 1-cell anchor coordinates to 2-cell anchor coordinates
* This function is ported from PEAR Spreadsheet_Writer_Excel with small modifications
*
* Calculate the vertices that define the position of the image as required by
* the OBJ record.
*
* +------------+------------+
* | A | B |
* +-----+------------+------------+
* | |(x1,y1) | |
* | 1 |(A1)._______|______ |
* | | | | |
* | | | | |
* +-----+----| BITMAP |-----+
* | | | | |
* | 2 | |______________. |
* | | | (B2)|
* | | | (x2,y2)|
* +---- +------------+------------+
*
* Example of a bitmap that covers some of the area from cell A1 to cell B2.
*
* Based on the width and height of the bitmap we need to calculate 8 vars:
* $col_start, $row_start, $col_end, $row_end, $x1, $y1, $x2, $y2.
* The width and height of the cells are also variable and have to be taken into
* account.
* The values of $col_start and $row_start are passed in from the calling
* function. The values of $col_end and $row_end are calculated by subtracting
* the width and height of the bitmap from the width and height of the
* underlying cells.
* The vertices are expressed as a percentage of the underlying cell width as
* follows (rhs values are in pixels):
*
* x1 = X / W *1024
* y1 = Y / H *256
* x2 = (X-1) / W *1024
* y2 = (Y-1) / H *256
*
* Where: X is distance from the left side of the underlying cell
* Y is distance from the top of the underlying cell
* W is the width of the cell
* H is the height of the cell
*
* @param PHPExcel_Worksheet $sheet
* @param string $coordinates E.g. 'A1'
* @param integer $offsetX Horizontal offset in pixels
* @param integer $offsetY Vertical offset in pixels
* @param integer $width Width in pixels
* @param integer $height Height in pixels
* @return array
*/
public
static
function
oneAnchor2twoAnchor
(
$sheet
,
$coordinates
,
$offsetX
,
$offsetY
,
$width
,
$height
)
{
list
(
$column
,
$row
)
=
PHPExcel_Cell
::
coordinateFromString
(
$coordinates
);
$col_start
=
PHPExcel_Cell
::
columnIndexFromString
(
$column
)
-
1
;
$row_start
=
$row
-
1
;
$x1
=
$offsetX
;
$y1
=
$offsetY
;
// Initialise end cell to the same as the start cell
$col_end
=
$col_start
;
// Col containing lower right corner of object
$row_end
=
$row_start
;
// Row containing bottom right corner of object
// Zero the specified offset if greater than the cell dimensions
if
(
$x1
>=
self
::
sizeCol
(
$sheet
,
PHPExcel_Cell
::
stringFromColumnIndex
(
$col_start
)))
{
$x1
=
0
;
}
if
(
$y1
>=
self
::
sizeRow
(
$sheet
,
$row_start
+
1
))
{
$y1
=
0
;
}
$width
=
$width
+
$x1
-
1
;
$height
=
$height
+
$y1
-
1
;
// Subtract the underlying cell widths to find the end cell of the image
while
(
$width
>=
self
::
sizeCol
(
$sheet
,
PHPExcel_Cell
::
stringFromColumnIndex
(
$col_end
)))
{
$width
-=
self
::
sizeCol
(
$sheet
,
PHPExcel_Cell
::
stringFromColumnIndex
(
$col_end
));
++
$col_end
;
}
// Subtract the underlying cell heights to find the end cell of the image
while
(
$height
>=
self
::
sizeRow
(
$sheet
,
$row_end
+
1
))
{
$height
-=
self
::
sizeRow
(
$sheet
,
$row_end
+
1
);
++
$row_end
;
}
// Bitmap isn't allowed to start or finish in a hidden cell, i.e. a cell
// with zero height or width.
if
(
self
::
sizeCol
(
$sheet
,
PHPExcel_Cell
::
stringFromColumnIndex
(
$col_start
))
==
0
)
{
return
;
}
if
(
self
::
sizeCol
(
$sheet
,
PHPExcel_Cell
::
stringFromColumnIndex
(
$col_end
))
==
0
)
{
return
;
}
if
(
self
::
sizeRow
(
$sheet
,
$row_start
+
1
)
==
0
)
{
return
;
}
if
(
self
::
sizeRow
(
$sheet
,
$row_end
+
1
)
==
0
)
{
return
;
}
// Convert the pixel values to the percentage value expected by Excel
$x1
=
$x1
/
self
::
sizeCol
(
$sheet
,
PHPExcel_Cell
::
stringFromColumnIndex
(
$col_start
))
*
1024
;
$y1
=
$y1
/
self
::
sizeRow
(
$sheet
,
$row_start
+
1
)
*
256
;
$x2
=
(
$width
+
1
)
/
self
::
sizeCol
(
$sheet
,
PHPExcel_Cell
::
stringFromColumnIndex
(
$col_end
))
*
1024
;
// Distance to right side of object
$y2
=
(
$height
+
1
)
/
self
::
sizeRow
(
$sheet
,
$row_end
+
1
)
*
256
;
// Distance to bottom of object
$startCoordinates
=
PHPExcel_Cell
::
stringFromColumnIndex
(
$col_start
)
.
(
$row_start
+
1
);
$endCoordinates
=
PHPExcel_Cell
::
stringFromColumnIndex
(
$col_end
)
.
(
$row_end
+
1
);
$twoAnchor
=
array
(
'startCoordinates'
=>
$startCoordinates
,
'startOffsetX'
=>
$x1
,
'startOffsetY'
=>
$y1
,
'endCoordinates'
=>
$endCoordinates
,
'endOffsetX'
=>
$x2
,
'endOffsetY'
=>
$y2
,
);
return
$twoAnchor
;
}
}
lib/Classes/PHPExcel/Shared/File.php
0 → 100644
View file @
9f4f2745
<?php
/**
* PHPExcel
*
* Copyright (c) 2006 - 2014 PHPExcel
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* @category PHPExcel
* @package PHPExcel_Shared
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 1.8.0, 2014-03-02
*/
/**
* PHPExcel_Shared_File
*
* @category PHPExcel
* @package PHPExcel_Shared
* @copyright Copyright (c) 2006 - 2014 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class
PHPExcel_Shared_File
{
/*
* Use Temp or File Upload Temp for temporary files
*
* @protected
* @var boolean
*/
protected
static
$_useUploadTempDirectory
=
FALSE
;
/**
* Set the flag indicating whether the File Upload Temp directory should be used for temporary files
*
* @param boolean $useUploadTempDir Use File Upload Temporary directory (true or false)
*/
public
static
function
setUseUploadTempDirectory
(
$useUploadTempDir
=
FALSE
)
{
self
::
$_useUploadTempDirectory
=
(
boolean
)
$useUploadTempDir
;
}
// function setUseUploadTempDirectory()
/**
* Get the flag indicating whether the File Upload Temp directory should be used for temporary files
*
* @return boolean Use File Upload Temporary directory (true or false)
*/
public
static
function
getUseUploadTempDirectory
()
{
return
self
::
$_useUploadTempDirectory
;
}
// function getUseUploadTempDirectory()
/**
* Verify if a file exists
*
* @param string $pFilename Filename
* @return bool
*/
public
static
function
file_exists
(
$pFilename
)
{
// Sick construction, but it seems that
// file_exists returns strange values when
// doing the original file_exists on ZIP archives...
if
(
strtolower
(
substr
(
$pFilename
,
0
,
3
))
==
'zip'
)
{
// Open ZIP file and verify if the file exists
$zipFile
=
substr
(
$pFilename
,
6
,
strpos
(
$pFilename
,
'#'
)
-
6
);
$archiveFile
=
substr
(
$pFilename
,
strpos
(
$pFilename
,
'#'
)
+
1
);
$zip
=
new
ZipArchive
();
if
(
$zip
->
open
(
$zipFile
)
===
true
)
{
$returnValue
=
(
$zip
->
getFromName
(
$archiveFile
)
!==
false
);
$zip
->
close
();
return
$returnValue
;
}
else
{
return
false
;
}
}
else
{
// Regular file_exists
return
file_exists
(
$pFilename
);
}
}
/**
* Returns canonicalized absolute pathname, also for ZIP archives
*
* @param string $pFilename
* @return string
*/
public
static
function
realpath
(
$pFilename
)
{
// Returnvalue
$returnValue
=
''
;
// Try using realpath()
if
(
file_exists
(
$pFilename
))
{
$returnValue
=
realpath
(
$pFilename
);
}
// Found something?
if
(
$returnValue
==
''
||
(
$returnValue
===
NULL
))
{
$pathArray
=
explode
(
'/'
,
$pFilename
);
while
(
in_array
(
'..'
,
$pathArray
)
&&
$pathArray
[
0
]
!=
'..'
)
{
for
(
$i
=
0
;
$i
<
count
(
$pathArray
);
++
$i
)
{
if
(
$pathArray
[
$i
]
==
'..'
&&
$i
>
0
)
{
unset
(
$pathArray
[
$i
]);
unset
(
$pathArray
[
$i
-
1
]);
break
;
}
}
}
$returnValue
=
implode
(
'/'
,
$pathArray
);
}
// Return
return
$returnValue
;
}
/**
* Get the systems temporary directory.
*
* @return string
*/
public
static
function
sys_get_temp_dir
()
{
if
(
self
::
$_useUploadTempDirectory
)
{
// use upload-directory when defined to allow running on environments having very restricted
// open_basedir configs
if
(
ini_get
(
'upload_tmp_dir'
)
!==
FALSE
)
{
if
(
$temp
=
ini_get
(
'upload_tmp_dir'
))
{
if
(
file_exists
(
$temp
))
return
realpath
(
$temp
);
}
}
}
// sys_get_temp_dir is only available since PHP 5.2.1
// http://php.net/manual/en/function.sys-get-temp-dir.php#94119
if
(
!
function_exists
(
'sys_get_temp_dir'
))
{
if
(
$temp
=
getenv
(
'TMP'
)
)
{
if
((
!
empty
(
$temp
))
&&
(
file_exists
(
$temp
)))
{
return
realpath
(
$temp
);
}
}
if
(
$temp
=
getenv
(
'TEMP'
)
)
{
if
((
!
empty
(
$temp
))
&&
(
file_exists
(
$temp
)))
{
return
realpath
(
$temp
);
}
}
if
(
$temp
=
getenv
(
'TMPDIR'
)
)
{
if
((
!
empty
(
$temp
))
&&
(
file_exists
(
$temp
)))
{
return
realpath
(
$temp
);
}
}
// trick for creating a file in system's temporary dir
// without knowing the path of the system's temporary dir
$temp
=
tempnam
(
__FILE__
,
''
);
if
(
file_exists
(
$temp
))
{
unlink
(
$temp
);
return
realpath
(
dirname
(
$temp
));
}
return
null
;
}
// use ordinary built-in PHP function
// There should be no problem with the 5.2.4 Suhosin realpath() bug, because this line should only
// be called if we're running 5.2.1 or earlier
return
realpath
(
sys_get_temp_dir
());
}
}
Prev
1
…
8
9
10
11
12
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment