Merge branch 'psr2' into develop

This commit is contained in:
MarkBaker 2015-05-15 23:42:53 +01:00
commit 2af5e55f2c
46 changed files with 2909 additions and 2706 deletions

View File

@ -83,7 +83,7 @@ class PHPExcel_Calculation
* @access private
* @var PHPExcel_Calculation
*/
private static $_instance;
private static $instance;
/**
@ -92,7 +92,7 @@ class PHPExcel_Calculation
* @access private
* @var PHPExcel
*/
private $_workbook;
private $workbook;
/**
* List of instances of the calculation engine that we've instantiated for individual workbooks
@ -100,7 +100,7 @@ class PHPExcel_Calculation
* @access private
* @var PHPExcel_Calculation[]
*/
private static $_workbookSets;
private static $workbookSets;
/**
* Calculation cache
@ -108,7 +108,7 @@ class PHPExcel_Calculation
* @access private
* @var array
*/
private $_calculationCache = array ();
private $calculationCache = array ();
/**
@ -117,7 +117,7 @@ class PHPExcel_Calculation
* @access private
* @var boolean
*/
private $_calculationCacheEnabled = true;
private $calculationCacheEnabled = true;
/**
@ -127,7 +127,7 @@ class PHPExcel_Calculation
* @access private
* @var array
*/
private static $_operators = array(
private static $operators = array(
'+' => true, '-' => true, '*' => true, '/' => true,
'^' => true, '&' => true, '%' => false, '~' => false,
'>' => true, '<' => true, '=' => true, '>=' => true,
@ -140,7 +140,7 @@ class PHPExcel_Calculation
* @access private
* @var array
*/
private static $_binaryOperators = array(
private static $binaryOperators = array(
'+' => true, '-' => true, '*' => true, '/' => true,
'^' => true, '&' => true, '>' => true, '<' => true,
'=' => true, '>=' => true, '<=' => true, '<>' => true,
@ -183,9 +183,9 @@ class PHPExcel_Calculation
* @var array of string
*
*/
private $_cyclicReferenceStack;
private $cyclicReferenceStack;
private $_cellStack = array();
private $cellStack = array();
/**
* Current iteration counter for cyclic formulae
@ -195,9 +195,9 @@ class PHPExcel_Calculation
* @var integer
*
*/
private $_cyclicFormulaCount = 1;
private $cyclicFormulaCounter = 1;
private $_cyclicFormulaCell = '';
private $cyclicFormulaCell = '';
/**
* Number of iterations for cyclic formulae
@ -213,7 +213,7 @@ class PHPExcel_Calculation
* @var integer
*
*/
private $_savedPrecision = 14;
private $savedPrecision = 14;
/**
@ -222,7 +222,7 @@ class PHPExcel_Calculation
* @var string
*
*/
private static $_localeLanguage = 'en_us'; // US English (default locale)
private static $localeLanguage = 'en_us'; // US English (default locale)
/**
* List of available locale settings
@ -231,7 +231,7 @@ class PHPExcel_Calculation
* @var string[]
*
*/
private static $_validLocaleLanguages = array(
private static $validLocaleLanguages = array(
'en' // English (default language)
);
@ -241,8 +241,8 @@ class PHPExcel_Calculation
* @var string
*
*/
private static $_localeArgumentSeparator = ',';
private static $_localeFunctions = array();
private static $localeArgumentSeparator = ',';
private static $localeFunctions = array();
/**
* Locale-specific translations for Excel constants (True, False and Null)
@ -250,7 +250,7 @@ class PHPExcel_Calculation
* @var string[]
*
*/
public static $_localeBoolean = array(
public static $localeBoolean = array(
'TRUE' => 'TRUE',
'FALSE' => 'FALSE',
'NULL' => 'NULL'
@ -263,14 +263,14 @@ class PHPExcel_Calculation
* @var string[]
*
*/
private static $_ExcelConstants = array(
private static $excelConstants = array(
'TRUE' => true,
'FALSE' => false,
'NULL' => null
);
// PHPExcel functions
private static $_PHPExcelFunctions = array( // PHPExcel functions
private static $PHPExcelFunctions = array( // PHPExcel functions
'ABS' => array('category' => PHPExcel_Calculation_Function::CATEGORY_MATH_AND_TRIG,
'functionCall' => 'abs',
'argumentCount' => '1'
@ -1705,7 +1705,7 @@ class PHPExcel_Calculation
// Internal functions used for special control purposes
private static $_controlFunctions = array(
private static $controlFunctions = array(
'MKMATRIX' => array(
'argumentCount' => '*',
'functionCall' => 'self::_mkMatrix'
@ -1716,26 +1716,26 @@ class PHPExcel_Calculation
private function __construct(PHPExcel $workbook = null)
{
$setPrecision = (PHP_INT_SIZE == 4) ? 14 : 16;
$this->_savedPrecision = ini_get('precision');
if ($this->_savedPrecision < $setPrecision) {
$this->savedPrecision = ini_get('precision');
if ($this->savedPrecision < $setPrecision) {
ini_set('precision', $setPrecision);
}
$this->delta = 1 * pow(10, -$setPrecision);
if ($workbook !== null) {
self::$_workbookSets[$workbook->getID()] = $this;
self::$workbookSets[$workbook->getID()] = $this;
}
$this->_workbook = $workbook;
$this->_cyclicReferenceStack = new PHPExcel_CalcEngine_CyclicReferenceStack();
$this->_debugLog = new PHPExcel_CalcEngine_Logger($this->_cyclicReferenceStack);
$this->workbook = $workbook;
$this->cyclicReferenceStack = new PHPExcel_CalcEngine_CyclicReferenceStack();
$this->_debugLog = new PHPExcel_CalcEngine_Logger($this->cyclicReferenceStack);
}
public function __destruct()
{
if ($this->_savedPrecision != ini_get('precision')) {
ini_set('precision', $this->_savedPrecision);
if ($this->savedPrecision != ini_get('precision')) {
ini_set('precision', $this->savedPrecision);
}
}
@ -1745,7 +1745,7 @@ class PHPExcel_Calculation
foreach (glob($localeFileDirectory.'/*', GLOB_ONLYDIR) as $filename) {
$filename = substr($filename, strlen($localeFileDirectory)+1);
if ($filename != 'en') {
self::$_validLocaleLanguages[] = $filename;
self::$validLocaleLanguages[] = $filename;
}
}
}
@ -1761,17 +1761,17 @@ class PHPExcel_Calculation
public static function getInstance(PHPExcel $workbook = null)
{
if ($workbook !== null) {
if (isset(self::$_workbookSets[$workbook->getID()])) {
return self::$_workbookSets[$workbook->getID()];
if (isset(self::$workbookSets[$workbook->getID()])) {
return self::$workbookSets[$workbook->getID()];
}
return new PHPExcel_Calculation($workbook);
}
if (!isset(self::$_instance) || (self::$_instance === null)) {
self::$_instance = new PHPExcel_Calculation();
if (!isset(self::$instance) || (self::$instance === null)) {
self::$instance = new PHPExcel_Calculation();
}
return self::$_instance;
return self::$instance;
}
/**
@ -1783,8 +1783,8 @@ class PHPExcel_Calculation
public static function unsetInstance(PHPExcel $workbook = null)
{
if ($workbook !== null) {
if (isset(self::$_workbookSets[$workbook->getID()])) {
unset(self::$_workbookSets[$workbook->getID()]);
if (isset(self::$workbookSets[$workbook->getID()])) {
unset(self::$workbookSets[$workbook->getID()]);
}
}
}
@ -1833,7 +1833,7 @@ class PHPExcel_Calculation
*/
public static function getTRUE()
{
return self::$_localeBoolean['TRUE'];
return self::$localeBoolean['TRUE'];
}
/**
@ -1844,7 +1844,7 @@ class PHPExcel_Calculation
*/
public static function getFALSE()
{
return self::$_localeBoolean['FALSE'];
return self::$localeBoolean['FALSE'];
}
/**
@ -1886,7 +1886,7 @@ class PHPExcel_Calculation
*/
public function getCalculationCacheEnabled()
{
return $this->_calculationCacheEnabled;
return $this->calculationCacheEnabled;
}
/**
@ -1897,7 +1897,7 @@ class PHPExcel_Calculation
*/
public function setCalculationCacheEnabled($pValue = true)
{
$this->_calculationCacheEnabled = $pValue;
$this->calculationCacheEnabled = $pValue;
$this->clearCalculationCache();
}
@ -1925,7 +1925,7 @@ class PHPExcel_Calculation
*/
public function clearCalculationCache()
{
$this->_calculationCache = array();
$this->calculationCache = array();
}
/**
@ -1935,8 +1935,8 @@ class PHPExcel_Calculation
*/
public function clearCalculationCacheForWorksheet($worksheetName)
{
if (isset($this->_calculationCache[$worksheetName])) {
unset($this->_calculationCache[$worksheetName]);
if (isset($this->calculationCache[$worksheetName])) {
unset($this->calculationCache[$worksheetName]);
}
}
@ -1948,9 +1948,9 @@ class PHPExcel_Calculation
*/
public function renameCalculationCacheForWorksheet($fromWorksheetName, $toWorksheetName)
{
if (isset($this->_calculationCache[$fromWorksheetName])) {
$this->_calculationCache[$toWorksheetName] = &$this->_calculationCache[$fromWorksheetName];
unset($this->_calculationCache[$fromWorksheetName]);
if (isset($this->calculationCache[$fromWorksheetName])) {
$this->calculationCache[$toWorksheetName] = &$this->calculationCache[$fromWorksheetName];
unset($this->calculationCache[$fromWorksheetName]);
}
}
@ -1962,7 +1962,7 @@ class PHPExcel_Calculation
*/
public function getLocale()
{
return self::$_localeLanguage;
return self::$localeLanguage;
}
@ -1980,15 +1980,15 @@ class PHPExcel_Calculation
list($language) = explode('_', $locale);
}
if (count(self::$_validLocaleLanguages) == 1) {
if (count(self::$validLocaleLanguages) == 1) {
self::_loadLocales();
}
// Test whether we have any language data for this language (any locale)
if (in_array($language, self::$_validLocaleLanguages)) {
if (in_array($language, self::$validLocaleLanguages)) {
// initialise language/locale settings
self::$_localeFunctions = array();
self::$_localeArgumentSeparator = ',';
self::$_localeBoolean = array('TRUE' => 'TRUE', 'FALSE' => 'FALSE', 'NULL' => 'NULL');
self::$localeFunctions = array();
self::$localeArgumentSeparator = ',';
self::$localeBoolean = array('TRUE' => 'TRUE', 'FALSE' => 'FALSE', 'NULL' => 'NULL');
// Default is English, if user isn't requesting english, then read the necessary data from the locale files
if ($locale != 'en_us') {
// Search for a file with a list of function names for locale
@ -2008,17 +2008,17 @@ class PHPExcel_Calculation
list($fName, $lfName) = explode('=', $localeFunction);
$fName = trim($fName);
$lfName = trim($lfName);
if ((isset(self::$_PHPExcelFunctions[$fName])) && ($lfName != '') && ($fName != $lfName)) {
self::$_localeFunctions[$fName] = $lfName;
if ((isset(self::$PHPExcelFunctions[$fName])) && ($lfName != '') && ($fName != $lfName)) {
self::$localeFunctions[$fName] = $lfName;
}
}
}
// Default the TRUE and FALSE constants to the locale names of the TRUE() and FALSE() functions
if (isset(self::$_localeFunctions['TRUE'])) {
self::$_localeBoolean['TRUE'] = self::$_localeFunctions['TRUE'];
if (isset(self::$localeFunctions['TRUE'])) {
self::$localeBoolean['TRUE'] = self::$localeFunctions['TRUE'];
}
if (isset(self::$_localeFunctions['FALSE'])) {
self::$_localeBoolean['FALSE'] = self::$_localeFunctions['FALSE'];
if (isset(self::$localeFunctions['FALSE'])) {
self::$localeBoolean['FALSE'] = self::$localeFunctions['FALSE'];
}
$configFile = PHPEXCEL_ROOT . 'PHPExcel'.DIRECTORY_SEPARATOR.'locale'.DIRECTORY_SEPARATOR.str_replace('_', DIRECTORY_SEPARATOR, $locale).DIRECTORY_SEPARATOR.'config';
@ -2034,7 +2034,7 @@ class PHPExcel_Calculation
$settingName = strtoupper(trim($settingName));
switch ($settingName) {
case 'ARGUMENTSEPARATOR':
self::$_localeArgumentSeparator = trim($settingValue);
self::$localeArgumentSeparator = trim($settingValue);
break;
}
}
@ -2044,7 +2044,7 @@ class PHPExcel_Calculation
self::$functionReplaceFromExcel = self::$functionReplaceToExcel =
self::$functionReplaceFromLocale = self::$functionReplaceToLocale = null;
self::$_localeLanguage = $locale;
self::$localeLanguage = $locale;
return true;
}
return false;
@ -2076,7 +2076,7 @@ class PHPExcel_Calculation
private static function _translateFormula($from, $to, $formula, $fromSeparator, $toSeparator)
{
// Convert any Excel function names to the required language
if (self::$_localeLanguage !== 'en_us') {
if (self::$localeLanguage !== 'en_us') {
$inBraces = false;
// If there is the possibility of braces within a quoted string, then we don't treat those as matrix indicators
if (strpos($formula, '"') !== false) {
@ -2111,10 +2111,10 @@ class PHPExcel_Calculation
{
if (self::$functionReplaceFromExcel === null) {
self::$functionReplaceFromExcel = array();
foreach (array_keys(self::$_localeFunctions) as $excelFunctionName) {
foreach (array_keys(self::$localeFunctions) as $excelFunctionName) {
self::$functionReplaceFromExcel[] = '/(@?[^\w\.])'.preg_quote($excelFunctionName).'([\s]*\()/Ui';
}
foreach (array_keys(self::$_localeBoolean) as $excelBoolean) {
foreach (array_keys(self::$localeBoolean) as $excelBoolean) {
self::$functionReplaceFromExcel[] = '/(@?[^\w\.])'.preg_quote($excelBoolean).'([^\w\.])/Ui';
}
@ -2122,15 +2122,15 @@ class PHPExcel_Calculation
if (self::$functionReplaceToLocale === null) {
self::$functionReplaceToLocale = array();
foreach (array_values(self::$_localeFunctions) as $localeFunctionName) {
foreach (array_values(self::$localeFunctions) as $localeFunctionName) {
self::$functionReplaceToLocale[] = '$1'.trim($localeFunctionName).'$2';
}
foreach (array_values(self::$_localeBoolean) as $localeBoolean) {
foreach (array_values(self::$localeBoolean) as $localeBoolean) {
self::$functionReplaceToLocale[] = '$1'.trim($localeBoolean).'$2';
}
}
return self::_translateFormula(self::$functionReplaceFromExcel, self::$functionReplaceToLocale, $formula, ',', self::$_localeArgumentSeparator);
return self::_translateFormula(self::$functionReplaceFromExcel, self::$functionReplaceToLocale, $formula, ',', self::$localeArgumentSeparator);
}
@ -2141,35 +2141,35 @@ class PHPExcel_Calculation
{
if (self::$functionReplaceFromLocale === null) {
self::$functionReplaceFromLocale = array();
foreach (array_values(self::$_localeFunctions) as $localeFunctionName) {
foreach (array_values(self::$localeFunctions) as $localeFunctionName) {
self::$functionReplaceFromLocale[] = '/(@?[^\w\.])'.preg_quote($localeFunctionName).'([\s]*\()/Ui';
}
foreach (array_values(self::$_localeBoolean) as $excelBoolean) {
foreach (array_values(self::$localeBoolean) as $excelBoolean) {
self::$functionReplaceFromLocale[] = '/(@?[^\w\.])'.preg_quote($excelBoolean).'([^\w\.])/Ui';
}
}
if (self::$functionReplaceToExcel === null) {
self::$functionReplaceToExcel = array();
foreach (array_keys(self::$_localeFunctions) as $excelFunctionName) {
foreach (array_keys(self::$localeFunctions) as $excelFunctionName) {
self::$functionReplaceToExcel[] = '$1'.trim($excelFunctionName).'$2';
}
foreach (array_keys(self::$_localeBoolean) as $excelBoolean) {
foreach (array_keys(self::$localeBoolean) as $excelBoolean) {
self::$functionReplaceToExcel[] = '$1'.trim($excelBoolean).'$2';
}
}
return self::_translateFormula(self::$functionReplaceFromLocale, self::$functionReplaceToExcel, $formula, self::$_localeArgumentSeparator, ',');
return self::_translateFormula(self::$functionReplaceFromLocale, self::$functionReplaceToExcel, $formula, self::$localeArgumentSeparator, ',');
}
public static function _localeFunc($function)
public static function localeFunc($function)
{
if (self::$_localeLanguage !== 'en_us') {
if (self::$localeLanguage !== 'en_us') {
$functionName = trim($function, '(');
if (isset(self::$_localeFunctions[$functionName])) {
if (isset(self::$localeFunctions[$functionName])) {
$brace = ($functionName != $function);
$function = self::$_localeFunctions[$functionName];
$function = self::$localeFunctions[$functionName];
if ($brace) {
$function .= '(';
}
@ -2267,24 +2267,24 @@ class PHPExcel_Calculation
// Initialise the logging settings if requested
$this->formulaError = null;
$this->_debugLog->clearLog();
$this->_cyclicReferenceStack->clear();
$this->_cyclicFormulaCount = 1;
$this->cyclicReferenceStack->clear();
$this->cyclicFormulaCounter = 1;
self::$returnArrayAsType = self::RETURN_ARRAY_AS_ARRAY;
}
// Execute the calculation for the cell formula
$this->_cellStack[] = array(
$this->cellStack[] = array(
'sheet' => $pCell->getWorksheet()->getTitle(),
'cell' => $pCell->getCoordinate(),
);
try {
$result = self::_unwrapResult($this->_calculateFormulaValue($pCell->getValue(), $pCell->getCoordinate(), $pCell));
$cellAddress = array_pop($this->_cellStack);
$this->_workbook->getSheetByName($cellAddress['sheet'])->getCell($cellAddress['cell']);
$cellAddress = array_pop($this->cellStack);
$this->workbook->getSheetByName($cellAddress['sheet'])->getCell($cellAddress['cell']);
} catch (PHPExcel_Exception $e) {
$cellAddress = array_pop($this->_cellStack);
$this->_workbook->getSheetByName($cellAddress['sheet'])->getCell($cellAddress['cell']);
$cellAddress = array_pop($this->cellStack);
$this->workbook->getSheetByName($cellAddress['sheet'])->getCell($cellAddress['cell']);
throw new PHPExcel_Calculation_Exception($e->getMessage());
}
@ -2363,12 +2363,12 @@ class PHPExcel_Calculation
// Initialise the logging settings
$this->formulaError = null;
$this->_debugLog->clearLog();
$this->_cyclicReferenceStack->clear();
$this->cyclicReferenceStack->clear();
// Disable calculation cacheing because it only applies to cell calculations, not straight formulae
// But don't actually flush any cache
$resetCache = $this->getCalculationCacheEnabled();
$this->_calculationCacheEnabled = false;
$this->calculationCacheEnabled = false;
// Execute the calculation
try {
$result = self::_unwrapResult($this->_calculateFormulaValue($formula, $cellID, $pCell));
@ -2377,7 +2377,7 @@ class PHPExcel_Calculation
}
// Reset calculation cacheing to its previous state
$this->_calculationCacheEnabled = $resetCache;
$this->calculationCacheEnabled = $resetCache;
return $result;
}
@ -2388,10 +2388,10 @@ class PHPExcel_Calculation
// Is calculation cacheing enabled?
// Is the value present in calculation cache?
$this->_debugLog->writeDebugLog('Testing cache value for cell ', $cellReference);
if (($this->_calculationCacheEnabled) && (isset($this->_calculationCache[$cellReference]))) {
if (($this->calculationCacheEnabled) && (isset($this->calculationCache[$cellReference]))) {
$this->_debugLog->writeDebugLog('Retrieving value for cell ', $cellReference, ' from cache');
// Return the cached result
$cellValue = $this->_calculationCache[$cellReference];
$cellValue = $this->calculationCache[$cellReference];
return true;
}
return false;
@ -2399,8 +2399,8 @@ class PHPExcel_Calculation
public function saveValueToCache($cellReference, $cellValue)
{
if ($this->_calculationCacheEnabled) {
$this->_calculationCache[$cellReference] = $cellValue;
if ($this->calculationCacheEnabled) {
$this->calculationCache[$cellReference] = $cellValue;
}
}
@ -2436,28 +2436,28 @@ class PHPExcel_Calculation
return $cellValue;
}
if (($wsTitle{0} !== "\x00") && ($this->_cyclicReferenceStack->onStack($wsCellReference))) {
if (($wsTitle{0} !== "\x00") && ($this->cyclicReferenceStack->onStack($wsCellReference))) {
if ($this->cyclicFormulaCount <= 0) {
$this->_cyclicFormulaCell = '';
$this->cyclicFormulaCell = '';
return $this->_raiseFormulaError('Cyclic Reference in Formula');
} elseif ($this->_cyclicFormulaCell === $wsCellReference) {
++$this->_cyclicFormulaCount;
if ($this->_cyclicFormulaCount >= $this->cyclicFormulaCount) {
$this->_cyclicFormulaCell = '';
} elseif ($this->cyclicFormulaCell === $wsCellReference) {
++$this->cyclicFormulaCounter;
if ($this->cyclicFormulaCounter >= $this->cyclicFormulaCount) {
$this->cyclicFormulaCell = '';
return $cellValue;
}
} elseif ($this->_cyclicFormulaCell == '') {
if ($this->_cyclicFormulaCount >= $this->cyclicFormulaCount) {
} elseif ($this->cyclicFormulaCell == '') {
if ($this->cyclicFormulaCounter >= $this->cyclicFormulaCount) {
return $cellValue;
}
$this->_cyclicFormulaCell = $wsCellReference;
$this->cyclicFormulaCell = $wsCellReference;
}
}
// Parse the formula onto the token stack and calculate the value
$this->_cyclicReferenceStack->push($wsCellReference);
$this->cyclicReferenceStack->push($wsCellReference);
$cellValue = $this->_processTokenStack($this->_parseFormula($formula, $pCell), $cellID, $pCell);
$this->_cyclicReferenceStack->pop();
$this->cyclicReferenceStack->pop();
// Save to calculation cache
if ($cellID !== null) {
@ -2656,7 +2656,7 @@ class PHPExcel_Calculation
} elseif (is_string($value) && (trim($value, '"') == $value)) {
return '"'.$value.'"';
} elseif (is_bool($value)) {
return ($value) ? self::$_localeBoolean['TRUE'] : self::$_localeBoolean['FALSE'];
return ($value) ? self::$localeBoolean['TRUE'] : self::$localeBoolean['FALSE'];
}
}
return PHPExcel_Calculation_Functions::flattenSingleValue($value);
@ -2848,11 +2848,11 @@ class PHPExcel_Calculation
} elseif ((($opCharacter == '~') || ($opCharacter == '|')) && (!$isOperandOrFunction)) { // We have to explicitly deny a tilde or pipe, because they are legal
return $this->_raiseFormulaError("Formula Error: Illegal character '~'"); // on the stack but not in the input expression
} elseif ((isset(self::$_operators[$opCharacter]) or $isOperandOrFunction) && $expectingOperator) { // Are we putting an operator on the stack?
} elseif ((isset(self::$operators[$opCharacter]) or $isOperandOrFunction) && $expectingOperator) { // Are we putting an operator on the stack?
//echo 'Element with value '.$opCharacter.' is an Operator', PHP_EOL;
while ($stack->count() > 0 &&
($o2 = $stack->last()) &&
isset(self::$_operators[$o2['value']]) &&
isset(self::$operators[$o2['value']]) &&
@(self::$_operatorAssociativity[$opCharacter] ? self::$_operatorPrecedence[$opCharacter] < self::$_operatorPrecedence[$o2['value']] : self::$_operatorPrecedence[$opCharacter] <= self::$_operatorPrecedence[$o2['value']])) {
$output[] = $stack->pop(); // Swap operands and higher precedence operators from the stack to the output
}
@ -2885,14 +2885,14 @@ class PHPExcel_Calculation
//}
$output[] = $d; // Dump the argument count on the output
$output[] = $stack->pop(); // Pop the function and push onto the output
if (isset(self::$_controlFunctions[$functionName])) {
if (isset(self::$controlFunctions[$functionName])) {
//echo 'Built-in function '.$functionName, PHP_EOL;
$expectedArgumentCount = self::$_controlFunctions[$functionName]['argumentCount'];
$functionCall = self::$_controlFunctions[$functionName]['functionCall'];
} elseif (isset(self::$_PHPExcelFunctions[$functionName])) {
$expectedArgumentCount = self::$controlFunctions[$functionName]['argumentCount'];
$functionCall = self::$controlFunctions[$functionName]['functionCall'];
} elseif (isset(self::$PHPExcelFunctions[$functionName])) {
//echo 'PHPExcel function '.$functionName, PHP_EOL;
$expectedArgumentCount = self::$_PHPExcelFunctions[$functionName]['argumentCount'];
$functionCall = self::$_PHPExcelFunctions[$functionName]['functionCall'];
$expectedArgumentCount = self::$PHPExcelFunctions[$functionName]['argumentCount'];
$functionCall = self::$PHPExcelFunctions[$functionName]['functionCall'];
} else { // did we somehow push a non-function on the stack? this should never happen
return $this->_raiseFormulaError("Formula Error: Internal error, non-function on stack");
}
@ -2955,7 +2955,7 @@ class PHPExcel_Calculation
// If we've a comma when we're expecting an operand, then what we actually have is a null operand;
// so push a null onto the stack
if (($expectingOperand) || (!$expectingOperator)) {
$output[] = array('type' => 'NULL Value', 'value' => self::$_ExcelConstants['NULL'], 'reference' => null);
$output[] = array('type' => 'NULL Value', 'value' => self::$excelConstants['NULL'], 'reference' => null);
}
// make sure there was a function
$d = $stack->last(2);
@ -2984,7 +2984,7 @@ class PHPExcel_Calculation
if (preg_match('/^'.self::CALCULATION_REGEXP_FUNCTION.'$/i', $val, $matches)) {
$val = preg_replace('/\s/u', '', $val);
// echo 'Element '.$val.' is a Function<br />';
if (isset(self::$_PHPExcelFunctions[strtoupper($matches[1])]) || isset(self::$_controlFunctions[strtoupper($matches[1])])) { // it's a function
if (isset(self::$PHPExcelFunctions[strtoupper($matches[1])]) || isset(self::$controlFunctions[strtoupper($matches[1])])) { // it's a function
$stack->push('Function', strtoupper($val));
$ax = preg_match('/^\s*(\s*\))/ui', substr($formula, $index+$length), $amatch);
if ($ax) {
@ -3071,13 +3071,13 @@ class PHPExcel_Calculation
// echo 'Casting '.$val.' to integer<br />';
$val = (integer) $val;
}
} elseif (isset(self::$_ExcelConstants[trim(strtoupper($val))])) {
} elseif (isset(self::$excelConstants[trim(strtoupper($val))])) {
$excelConstant = trim(strtoupper($val));
// echo 'Element '.$excelConstant.' is an Excel Constant<br />';
$val = self::$_ExcelConstants[$excelConstant];
} elseif (($localeConstant = array_search(trim(strtoupper($val)), self::$_localeBoolean)) !== false) {
$val = self::$excelConstants[$excelConstant];
} elseif (($localeConstant = array_search(trim(strtoupper($val)), self::$localeBoolean)) !== false) {
// echo 'Element '.$localeConstant.' is an Excel Constant<br />';
$val = self::$_ExcelConstants[$localeConstant];
$val = self::$excelConstants[$localeConstant];
}
$details = array('type' => 'Value', 'value' => $val, 'reference' => null);
if ($localeConstant) {
@ -3091,13 +3091,13 @@ class PHPExcel_Calculation
++$index;
} elseif ($opCharacter == ')') { // miscellaneous error checking
if ($expectingOperand) {
$output[] = array('type' => 'NULL Value', 'value' => self::$_ExcelConstants['NULL'], 'reference' => null);
$output[] = array('type' => 'NULL Value', 'value' => self::$excelConstants['NULL'], 'reference' => null);
$expectingOperand = false;
$expectingOperator = true;
} else {
return $this->_raiseFormulaError("Formula Error: Unexpected ')'");
}
} elseif (isset(self::$_operators[$opCharacter]) && !$expectingOperator) {
} elseif (isset(self::$operators[$opCharacter]) && !$expectingOperator) {
return $this->_raiseFormulaError("Formula Error: Unexpected operator '$opCharacter'");
} else { // I don't even want to know what you did to get here
return $this->_raiseFormulaError("Formula Error: An unexpected error occured");
@ -3106,7 +3106,7 @@ class PHPExcel_Calculation
if ($index == strlen($formula)) {
// Did we end with an operator?.
// Only valid for the % unary operator
if ((isset(self::$_operators[$opCharacter])) && ($opCharacter != '%')) {
if ((isset(self::$operators[$opCharacter])) && ($opCharacter != '%')) {
return $this->_raiseFormulaError("Formula Error: Operator '$opCharacter' has no operands");
} else {
break;
@ -3128,7 +3128,7 @@ class PHPExcel_Calculation
// echo 'Element is an Intersect Operator<br />';
while ($stack->count() > 0 &&
($o2 = $stack->last()) &&
isset(self::$_operators[$o2['value']]) &&
isset(self::$operators[$o2['value']]) &&
@(self::$_operatorAssociativity[$opCharacter] ? self::$_operatorPrecedence[$opCharacter] < self::$_operatorPrecedence[$o2['value']] : self::$_operatorPrecedence[$opCharacter] <= self::$_operatorPrecedence[$o2['value']])) {
$output[] = $stack->pop(); // Swap operands and higher precedence operators from the stack to the output
}
@ -3183,7 +3183,7 @@ class PHPExcel_Calculation
$token = $tokenData['value'];
// echo '<b>Token is '.$token.'</b><br />';
// if the token is a binary operator, pop the top two values off the stack, do the operation, and push the result back on the stack
if (isset(self::$_binaryOperators[$token])) {
if (isset(self::$binaryOperators[$token])) {
// echo 'Token is a binary operator<br />';
// We must have two operands, error if we don't
if (($operand2Data = $stack->pop()) === null) {
@ -3256,7 +3256,7 @@ class PHPExcel_Calculation
}
$cellRef = PHPExcel_Cell::stringFromColumnIndex(min($oCol)).min($oRow).':'.PHPExcel_Cell::stringFromColumnIndex(max($oCol)).max($oRow);
if ($pCellParent !== null) {
$cellValue = $this->extractCellRange($cellRef, $this->_workbook->getSheetByName($sheet1), false);
$cellValue = $this->extractCellRange($cellRef, $this->workbook->getSheetByName($sheet1), false);
} else {
return $this->_raiseFormulaError('Unable to access Cell Reference');
}
@ -3285,10 +3285,10 @@ class PHPExcel_Calculation
// (converting the other operand to a matrix if need be); then perform the required
// matrix operation
if (is_bool($operand1)) {
$operand1 = ($operand1) ? self::$_localeBoolean['TRUE'] : self::$_localeBoolean['FALSE'];
$operand1 = ($operand1) ? self::$localeBoolean['TRUE'] : self::$localeBoolean['FALSE'];
}
if (is_bool($operand2)) {
$operand2 = ($operand2) ? self::$_localeBoolean['TRUE'] : self::$_localeBoolean['FALSE'];
$operand2 = ($operand2) ? self::$localeBoolean['TRUE'] : self::$localeBoolean['FALSE'];
}
if ((is_array($operand1)) || (is_array($operand2))) {
// Ensure that both operands are arrays/matrices
@ -3377,7 +3377,7 @@ class PHPExcel_Calculation
// echo '$cellRef='.$cellRef.' in worksheet '.$matches[2].'<br />';
$this->_debugLog->writeDebugLog('Evaluating Cell Range ', $cellRef, ' in worksheet ', $matches[2]);
if ($pCellParent !== null) {
$cellValue = $this->extractCellRange($cellRef, $this->_workbook->getSheetByName($matches[2]), false);
$cellValue = $this->extractCellRange($cellRef, $this->workbook->getSheetByName($matches[2]), false);
} else {
return $this->_raiseFormulaError('Unable to access Cell Reference');
}
@ -3410,9 +3410,9 @@ class PHPExcel_Calculation
// echo '$cellRef='.$cellRef.' in worksheet '.$matches[2].'<br />';
$this->_debugLog->writeDebugLog('Evaluating Cell ', $cellRef, ' in worksheet ', $matches[2]);
if ($pCellParent !== null) {
$cellSheet = $this->_workbook->getSheetByName($matches[2]);
$cellSheet = $this->workbook->getSheetByName($matches[2]);
if ($cellSheet && $cellSheet->cellExists($cellRef)) {
$cellValue = $this->extractCellRange($cellRef, $this->_workbook->getSheetByName($matches[2]), false);
$cellValue = $this->extractCellRange($cellRef, $this->workbook->getSheetByName($matches[2]), false);
$pCell->attach($pCellParent);
} else {
$cellValue = null;
@ -3444,17 +3444,17 @@ class PHPExcel_Calculation
$argCount = $stack->pop();
$argCount = $argCount['value'];
if ($functionName != 'MKMATRIX') {
$this->_debugLog->writeDebugLog('Evaluating Function ', self::_localeFunc($functionName), '() with ', (($argCount == 0) ? 'no' : $argCount), ' argument', (($argCount == 1) ? '' : 's'));
$this->_debugLog->writeDebugLog('Evaluating Function ', self::localeFunc($functionName), '() with ', (($argCount == 0) ? 'no' : $argCount), ' argument', (($argCount == 1) ? '' : 's'));
}
if ((isset(self::$_PHPExcelFunctions[$functionName])) || (isset(self::$_controlFunctions[$functionName]))) { // function
if (isset(self::$_PHPExcelFunctions[$functionName])) {
$functionCall = self::$_PHPExcelFunctions[$functionName]['functionCall'];
$passByReference = isset(self::$_PHPExcelFunctions[$functionName]['passByReference']);
$passCellReference = isset(self::$_PHPExcelFunctions[$functionName]['passCellReference']);
} elseif (isset(self::$_controlFunctions[$functionName])) {
$functionCall = self::$_controlFunctions[$functionName]['functionCall'];
$passByReference = isset(self::$_controlFunctions[$functionName]['passByReference']);
$passCellReference = isset(self::$_controlFunctions[$functionName]['passCellReference']);
if ((isset(self::$PHPExcelFunctions[$functionName])) || (isset(self::$controlFunctions[$functionName]))) { // function
if (isset(self::$PHPExcelFunctions[$functionName])) {
$functionCall = self::$PHPExcelFunctions[$functionName]['functionCall'];
$passByReference = isset(self::$PHPExcelFunctions[$functionName]['passByReference']);
$passCellReference = isset(self::$PHPExcelFunctions[$functionName]['passCellReference']);
} elseif (isset(self::$controlFunctions[$functionName])) {
$functionCall = self::$controlFunctions[$functionName]['functionCall'];
$passByReference = isset(self::$controlFunctions[$functionName]['passByReference']);
$passCellReference = isset(self::$controlFunctions[$functionName]['passCellReference']);
}
// get the arguments for this function
// echo 'Function '.$functionName.' expects '.$argCount.' arguments<br />';
@ -3463,8 +3463,8 @@ class PHPExcel_Calculation
$arg = $stack->pop();
$a = $argCount - $i - 1;
if (($passByReference) &&
(isset(self::$_PHPExcelFunctions[$functionName]['passByReference'][$a])) &&
(self::$_PHPExcelFunctions[$functionName]['passByReference'][$a])) {
(isset(self::$PHPExcelFunctions[$functionName]['passByReference'][$a])) &&
(self::$PHPExcelFunctions[$functionName]['passByReference'][$a])) {
if ($arg['reference'] === null) {
$args[] = $cellID;
if ($functionName != 'MKMATRIX') {
@ -3495,7 +3495,7 @@ class PHPExcel_Calculation
if ($functionName != 'MKMATRIX') {
if ($this->_debugLog->getWriteDebugLog()) {
krsort($argArrayVals);
$this->_debugLog->writeDebugLog('Evaluating ', self::_localeFunc($functionName), '( ', implode(self::$_localeArgumentSeparator.' ', PHPExcel_Calculation_Functions::flattenArray($argArrayVals)), ' )');
$this->_debugLog->writeDebugLog('Evaluating ', self::localeFunc($functionName), '( ', implode(self::$localeArgumentSeparator.' ', PHPExcel_Calculation_Functions::flattenArray($argArrayVals)), ' )');
}
}
// Process each argument in turn, building the return value as an array
@ -3507,16 +3507,16 @@ class PHPExcel_Calculation
// foreach($operand1 as $args) {
// if (is_array($args)) {
// foreach($args as $arg) {
// $this->_debugLog->writeDebugLog('Evaluating ', self::_localeFunc($functionName), '( ', $this->_showValue($arg), ' )');
// $this->_debugLog->writeDebugLog('Evaluating ', self::localeFunc($functionName), '( ', $this->_showValue($arg), ' )');
// $r = call_user_func_array($functionCall, $arg);
// $this->_debugLog->writeDebugLog('Evaluation Result for ', self::_localeFunc($functionName), '() function call is ', $this->_showTypeDetails($r));
// $this->_debugLog->writeDebugLog('Evaluation Result for ', self::localeFunc($functionName), '() function call is ', $this->_showTypeDetails($r));
// $result[$row][] = $r;
// }
// ++$row;
// } else {
// $this->_debugLog->writeDebugLog('Evaluating ', self::_localeFunc($functionName), '( ', $this->_showValue($args), ' )');
// $this->_debugLog->writeDebugLog('Evaluating ', self::localeFunc($functionName), '( ', $this->_showValue($args), ' )');
// $r = call_user_func_array($functionCall, $args);
// $this->_debugLog->writeDebugLog('Evaluation Result for ', self::_localeFunc($functionName), '() function call is ', $this->_showTypeDetails($r));
// $this->_debugLog->writeDebugLog('Evaluation Result for ', self::localeFunc($functionName), '() function call is ', $this->_showTypeDetails($r));
// $result[] = $r;
// }
// }
@ -3535,18 +3535,18 @@ class PHPExcel_Calculation
$result = call_user_func_array($functionCall, $args);
}
if ($functionName != 'MKMATRIX') {
$this->_debugLog->writeDebugLog('Evaluation Result for ', self::_localeFunc($functionName), '() function call is ', $this->_showTypeDetails($result));
$this->_debugLog->writeDebugLog('Evaluation Result for ', self::localeFunc($functionName), '() function call is ', $this->_showTypeDetails($result));
}
$stack->push('Value', self::_wrapResult($result));
}
} else {
// if the token is a number, boolean, string or an Excel error, push it onto the stack
if (isset(self::$_ExcelConstants[strtoupper($token)])) {
if (isset(self::$excelConstants[strtoupper($token)])) {
$excelConstant = strtoupper($token);
// echo 'Token is a PHPExcel constant: '.$excelConstant.'<br />';
$stack->push('Constant Value', self::$_ExcelConstants[$excelConstant]);
$this->_debugLog->writeDebugLog('Evaluating Constant ', $excelConstant, ' as ', $this->_showTypeDetails(self::$_ExcelConstants[$excelConstant]));
$stack->push('Constant Value', self::$excelConstants[$excelConstant]);
$this->_debugLog->writeDebugLog('Evaluating Constant ', $excelConstant, ' as ', $this->_showTypeDetails(self::$excelConstants[$excelConstant]));
} elseif ((is_numeric($token)) || ($token === null) || (is_bool($token)) || ($token == '') || ($token{0} == '"') || ($token{0} == '#')) {
// echo 'Token is a number, boolean, string, null or an Excel error<br />';
$stack->push('Value', $token);
@ -3828,7 +3828,7 @@ class PHPExcel_Calculation
protected function _raiseFormulaError($errorMessage)
{
$this->formulaError = $errorMessage;
$this->_cyclicReferenceStack->clear();
$this->cyclicReferenceStack->clear();
if (!$this->suppressFormulaErrors) {
throw new PHPExcel_Calculation_Exception($errorMessage);
}
@ -3860,7 +3860,7 @@ class PHPExcel_Calculation
list($pSheetName, $pRange) = PHPExcel_Worksheet::extractSheetTitle($pRange, true);
// echo 'New sheet name is '.$pSheetName, PHP_EOL;
// echo 'Adjusted Range reference is '.$pRange, PHP_EOL;
$pSheet = $this->_workbook->getSheetByName($pSheetName);
$pSheet = $this->workbook->getSheetByName($pSheetName);
}
// Extract range
@ -3918,7 +3918,7 @@ class PHPExcel_Calculation
list($pSheetName, $pRange) = PHPExcel_Worksheet::extractSheetTitle($pRange, true);
// echo 'New sheet name is '.$pSheetName, PHP_EOL;
// echo 'Adjusted Range reference is '.$pRange, PHP_EOL;
$pSheet = $this->_workbook->getSheetByName($pSheetName);
$pSheet = $this->workbook->getSheetByName($pSheetName);
}
// Named range?
@ -3990,8 +3990,8 @@ class PHPExcel_Calculation
public function isImplemented($pFunction = '')
{
$pFunction = strtoupper($pFunction);
if (isset(self::$_PHPExcelFunctions[$pFunction])) {
return (self::$_PHPExcelFunctions[$pFunction]['functionCall'] != 'PHPExcel_Calculation_Functions::DUMMY');
if (isset(self::$PHPExcelFunctions[$pFunction])) {
return (self::$PHPExcelFunctions[$pFunction]['functionCall'] != 'PHPExcel_Calculation_Functions::DUMMY');
} else {
return false;
}
@ -4007,7 +4007,7 @@ class PHPExcel_Calculation
{
$returnValue = array();
foreach (self::$_PHPExcelFunctions as $functionName => $function) {
foreach (self::$PHPExcelFunctions as $functionName => $function) {
if ($function['functionCall'] != 'PHPExcel_Calculation_Functions::DUMMY') {
$returnValue[$functionName] = new PHPExcel_Calculation_Function(
$function['category'],
@ -4028,7 +4028,7 @@ class PHPExcel_Calculation
*/
public function listAllFunctionNames()
{
return array_keys(self::$_PHPExcelFunctions);
return array_keys(self::$PHPExcelFunctions);
}
/**
@ -4039,7 +4039,7 @@ class PHPExcel_Calculation
public function listFunctionNames()
{
$returnValue = array();
foreach (self::$_PHPExcelFunctions as $functionName => $function) {
foreach (self::$PHPExcelFunctions as $functionName => $function) {
if ($function['functionCall'] != 'PHPExcel_Calculation_Functions::DUMMY') {
$returnValue[] = $functionName;
}

View File

@ -66,7 +66,7 @@ class PHPExcel_Calculation_Token_Stack
'reference' => $reference
);
if ($type == 'Function') {
$localeFunction = PHPExcel_Calculation::_localeFunc($value);
$localeFunction = PHPExcel_Calculation::localeFunc($value);
if ($localeFunction != $value) {
$this->stack[($this->count - 1)]['localeValue'] = $localeFunction;
}

View File

@ -40,14 +40,14 @@ class PHPExcel_Cell
*
* @var PHPExcel_Cell_IValueBinder
*/
private static $_valueBinder;
private static $valueBinder;
/**
* Value of the cell
*
* @var mixed
*/
private $_value;
private $value;
/**
* Calculated value of the cell (used for caching)
@ -59,34 +59,34 @@ class PHPExcel_Cell
*
* @var mixed
*/
private $_calculatedValue;
private $calculatedValue;
/**
* Type of the cell data
*
* @var string
*/
private $_dataType;
private $dataType;
/**
* Parent worksheet
*
* @var PHPExcel_CachedObjectStorage_CacheBase
*/
private $_parent;
private $parent;
/**
* Index to cellXf
*
* @var int
*/
private $_xfIndex = 0;
private $xfIndex = 0;
/**
* Attributes of the formula
*
*/
private $_formulaAttributes;
private $formulaAttributes;
/**
@ -96,19 +96,19 @@ class PHPExcel_Cell
**/
public function notifyCacheController()
{
$this->_parent->updateCacheData($this);
$this->parent->updateCacheData($this);
return $this;
}
public function detach()
{
$this->_parent = null;
$this->parent = null;
}
public function attach(PHPExcel_CachedObjectStorage_CacheBase $parent)
{
$this->_parent = $parent;
$this->parent = $parent;
}
@ -123,17 +123,17 @@ class PHPExcel_Cell
public function __construct($pValue = null, $pDataType = null, PHPExcel_Worksheet $pSheet = null)
{
// Initialise cell value
$this->_value = $pValue;
$this->value = $pValue;
// Set worksheet cache
$this->_parent = $pSheet->getCellCacheController();
$this->parent = $pSheet->getCellCacheController();
// Set datatype?
if ($pDataType !== null) {
if ($pDataType == PHPExcel_Cell_DataType::TYPE_STRING2) {
$pDataType = PHPExcel_Cell_DataType::TYPE_STRING;
}
$this->_dataType = $pDataType;
$this->dataType = $pDataType;
} elseif (!self::getValueBinder()->bindValue($this, $pValue)) {
throw new PHPExcel_Exception("Value could not be bound to cell.");
}
@ -146,7 +146,7 @@ class PHPExcel_Cell
*/
public function getColumn()
{
return $this->_parent->getCurrentColumn();
return $this->parent->getCurrentColumn();
}
/**
@ -156,7 +156,7 @@ class PHPExcel_Cell
*/
public function getRow()
{
return $this->_parent->getCurrentRow();
return $this->parent->getCurrentRow();
}
/**
@ -166,7 +166,7 @@ class PHPExcel_Cell
*/
public function getCoordinate()
{
return $this->_parent->getCurrentAddress();
return $this->parent->getCurrentAddress();
}
/**
@ -176,7 +176,7 @@ class PHPExcel_Cell
*/
public function getValue()
{
return $this->_value;
return $this->value;
}
/**
@ -223,7 +223,7 @@ class PHPExcel_Cell
// set the value according to data type
switch ($pDataType) {
case PHPExcel_Cell_DataType::TYPE_NULL:
$this->_value = $pValue;
$this->value = $pValue;
break;
case PHPExcel_Cell_DataType::TYPE_STRING2:
$pDataType = PHPExcel_Cell_DataType::TYPE_STRING;
@ -231,19 +231,19 @@ class PHPExcel_Cell
// Synonym for string
case PHPExcel_Cell_DataType::TYPE_INLINE:
// Rich text
$this->_value = PHPExcel_Cell_DataType::checkString($pValue);
$this->value = PHPExcel_Cell_DataType::checkString($pValue);
break;
case PHPExcel_Cell_DataType::TYPE_NUMERIC:
$this->_value = (float) $pValue;
$this->value = (float) $pValue;
break;
case PHPExcel_Cell_DataType::TYPE_FORMULA:
$this->_value = (string) $pValue;
$this->value = (string) $pValue;
break;
case PHPExcel_Cell_DataType::TYPE_BOOL:
$this->_value = (bool) $pValue;
$this->value = (bool) $pValue;
break;
case PHPExcel_Cell_DataType::TYPE_ERROR:
$this->_value = PHPExcel_Cell_DataType::checkErrorCode($pValue);
$this->value = PHPExcel_Cell_DataType::checkErrorCode($pValue);
break;
default:
throw new PHPExcel_Exception('Invalid datatype: ' . $pDataType);
@ -251,7 +251,7 @@ class PHPExcel_Cell
}
// set the datatype
$this->_dataType = $pDataType;
$this->dataType = $pDataType;
return $this->notifyCacheController();
}
@ -267,8 +267,8 @@ class PHPExcel_Cell
*/
public function getCalculatedValue($resetLog = true)
{
//echo 'Cell '.$this->getCoordinate().' value is a '.$this->_dataType.' with a value of '.$this->getValue().PHP_EOL;
if ($this->_dataType == PHPExcel_Cell_DataType::TYPE_FORMULA) {
//echo 'Cell '.$this->getCoordinate().' value is a '.$this->dataType.' with a value of '.$this->getValue().PHP_EOL;
if ($this->dataType == PHPExcel_Cell_DataType::TYPE_FORMULA) {
try {
//echo 'Cell value for '.$this->getCoordinate().' is a formula: Calculating value'.PHP_EOL;
$result = PHPExcel_Calculation::getInstance(
@ -282,9 +282,9 @@ class PHPExcel_Cell
}
}
} catch (PHPExcel_Exception $ex) {
if (($ex->getMessage() === 'Unable to access External Workbook') && ($this->_calculatedValue !== null)) {
//echo 'Returning fallback value of '.$this->_calculatedValue.' for cell '.$this->getCoordinate().PHP_EOL;
return $this->_calculatedValue; // Fallback for calculations referencing external files.
if (($ex->getMessage() === 'Unable to access External Workbook') && ($this->calculatedValue !== null)) {
//echo 'Returning fallback value of '.$this->calculatedValue.' for cell '.$this->getCoordinate().PHP_EOL;
return $this->calculatedValue; // Fallback for calculations referencing external files.
}
//echo 'Calculation Exception: '.$ex->getMessage().PHP_EOL;
$result = '#N/A';
@ -294,17 +294,17 @@ class PHPExcel_Cell
}
if ($result === '#Not Yet Implemented') {
//echo 'Returning fallback value of '.$this->_calculatedValue.' for cell '.$this->getCoordinate().PHP_EOL;
return $this->_calculatedValue; // Fallback if calculation engine does not support the formula.
//echo 'Returning fallback value of '.$this->calculatedValue.' for cell '.$this->getCoordinate().PHP_EOL;
return $this->calculatedValue; // Fallback if calculation engine does not support the formula.
}
//echo 'Returning calculated value of '.$result.' for cell '.$this->getCoordinate().PHP_EOL;
return $result;
} elseif ($this->_value instanceof PHPExcel_RichText) {
// echo 'Cell value for '.$this->getCoordinate().' is rich text: Returning data value of '.$this->_value.'<br />';
return $this->_value->getPlainText();
} elseif ($this->value instanceof PHPExcel_RichText) {
// echo 'Cell value for '.$this->getCoordinate().' is rich text: Returning data value of '.$this->value.'<br />';
return $this->value->getPlainText();
}
// echo 'Cell value for '.$this->getCoordinate().' is not a formula: Returning data value of '.$this->_value.'<br />';
return $this->_value;
// echo 'Cell value for '.$this->getCoordinate().' is not a formula: Returning data value of '.$this->value.'<br />';
return $this->value;
}
/**
@ -316,7 +316,7 @@ class PHPExcel_Cell
public function setCalculatedValue($pValue = null)
{
if ($pValue !== null) {
$this->_calculatedValue = (is_numeric($pValue)) ? (float) $pValue : $pValue;
$this->calculatedValue = (is_numeric($pValue)) ? (float) $pValue : $pValue;
}
return $this->notifyCacheController();
@ -334,7 +334,7 @@ class PHPExcel_Cell
*/
public function getOldCalculatedValue()
{
return $this->_calculatedValue;
return $this->calculatedValue;
}
/**
@ -344,7 +344,7 @@ class PHPExcel_Cell
*/
public function getDataType()
{
return $this->_dataType;
return $this->dataType;
}
/**
@ -358,7 +358,7 @@ class PHPExcel_Cell
if ($pDataType == PHPExcel_Cell_DataType::TYPE_STRING2) {
$pDataType = PHPExcel_Cell_DataType::TYPE_STRING;
}
$this->_dataType = $pDataType;
$this->dataType = $pDataType;
return $this->notifyCacheController();
}
@ -370,7 +370,7 @@ class PHPExcel_Cell
*/
public function isFormula()
{
return $this->_dataType == PHPExcel_Cell_DataType::TYPE_FORMULA;
return $this->dataType == PHPExcel_Cell_DataType::TYPE_FORMULA;
}
/**
@ -381,7 +381,7 @@ class PHPExcel_Cell
*/
public function hasDataValidation()
{
if (!isset($this->_parent)) {
if (!isset($this->parent)) {
throw new PHPExcel_Exception('Cannot check for data validation when cell is not bound to a worksheet');
}
@ -396,7 +396,7 @@ class PHPExcel_Cell
*/
public function getDataValidation()
{
if (!isset($this->_parent)) {
if (!isset($this->parent)) {
throw new PHPExcel_Exception('Cannot get data validation for cell that is not bound to a worksheet');
}
@ -412,7 +412,7 @@ class PHPExcel_Cell
*/
public function setDataValidation(PHPExcel_Cell_DataValidation $pDataValidation = null)
{
if (!isset($this->_parent)) {
if (!isset($this->parent)) {
throw new PHPExcel_Exception('Cannot set data validation for cell that is not bound to a worksheet');
}
@ -429,7 +429,7 @@ class PHPExcel_Cell
*/
public function hasHyperlink()
{
if (!isset($this->_parent)) {
if (!isset($this->parent)) {
throw new PHPExcel_Exception('Cannot check for hyperlink when cell is not bound to a worksheet');
}
@ -444,7 +444,7 @@ class PHPExcel_Cell
*/
public function getHyperlink()
{
if (!isset($this->_parent)) {
if (!isset($this->parent)) {
throw new PHPExcel_Exception('Cannot get hyperlink for cell that is not bound to a worksheet');
}
@ -460,7 +460,7 @@ class PHPExcel_Cell
*/
public function setHyperlink(PHPExcel_Cell_Hyperlink $pHyperlink = null)
{
if (!isset($this->_parent)) {
if (!isset($this->parent)) {
throw new PHPExcel_Exception('Cannot set hyperlink for cell that is not bound to a worksheet');
}
@ -476,7 +476,7 @@ class PHPExcel_Cell
*/
public function getParent()
{
return $this->_parent;
return $this->parent;
}
/**
@ -486,7 +486,7 @@ class PHPExcel_Cell
*/
public function getWorksheet()
{
return $this->_parent->getParent();
return $this->parent->getParent();
}
/**
@ -549,7 +549,7 @@ class PHPExcel_Cell
*/
public function rebindParent(PHPExcel_Worksheet $parent)
{
$this->_parent = $parent->getCellCacheController();
$this->parent = $parent->getCellCacheController();
return $this->notifyCacheController();
}
@ -943,11 +943,11 @@ class PHPExcel_Cell
*/
public static function getValueBinder()
{
if (self::$_valueBinder === null) {
self::$_valueBinder = new PHPExcel_Cell_DefaultValueBinder();
if (self::$valueBinder === null) {
self::$valueBinder = new PHPExcel_Cell_DefaultValueBinder();
}
return self::$_valueBinder;
return self::$valueBinder;
}
/**
@ -962,7 +962,7 @@ class PHPExcel_Cell
throw new PHPExcel_Exception("A PHPExcel_Cell_IValueBinder is required for PHPExcel to function correctly.");
}
self::$_valueBinder = $binder;
self::$valueBinder = $binder;
}
/**
@ -972,7 +972,7 @@ class PHPExcel_Cell
{
$vars = get_object_vars($this);
foreach ($vars as $key => $value) {
if ((is_object($value)) && ($key != '_parent')) {
if ((is_object($value)) && ($key != 'parent')) {
$this->$key = clone $value;
} else {
$this->$key = $value;
@ -987,7 +987,7 @@ class PHPExcel_Cell
*/
public function getXfIndex()
{
return $this->_xfIndex;
return $this->xfIndex;
}
/**
@ -998,7 +998,7 @@ class PHPExcel_Cell
*/
public function setXfIndex($pValue = 0)
{
$this->_xfIndex = $pValue;
$this->xfIndex = $pValue;
return $this->notifyCacheController();
}
@ -1008,7 +1008,7 @@ class PHPExcel_Cell
*/
public function setFormulaAttributes($pAttributes)
{
$this->_formulaAttributes = $pAttributes;
$this->formulaAttributes = $pAttributes;
return $this;
}
@ -1017,7 +1017,7 @@ class PHPExcel_Cell
*/
public function getFormulaAttributes()
{
return $this->_formulaAttributes;
return $this->formulaAttributes;
}
/**

View File

@ -14,7 +14,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*
* @var array of mixed
*/
private $_axis_number = array(
private $axisNumber = array(
'format' => self::FORMAT_CODE_GENERAL,
'source_linked' => 1
);
@ -24,7 +24,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*
* @var array of mixed
*/
private $_axis_options = array(
private $axisOptions = array(
'minimum' => null,
'maximum' => null,
'major_unit' => null,
@ -42,7 +42,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*
* @var array of mixed
*/
private $_fill_properties = array(
private $fillProperties = array(
'type' => self::EXCEL_COLOR_TYPE_ARGB,
'value' => null,
'alpha' => 0
@ -53,7 +53,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*
* @var array of mixed
*/
private $_line_properties = array(
private $lineProperties = array(
'type' => self::EXCEL_COLOR_TYPE_ARGB,
'value' => null,
'alpha' => 0
@ -64,7 +64,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*
* @var array of mixed
*/
private $_line_style_properties = array(
private $lineStyleProperties = array(
'width' => '9525',
'compound' => self::LINE_STYLE_COMPOUND_SIMPLE,
'dash' => self::LINE_STYLE_DASH_SOLID,
@ -87,7 +87,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*
* @var array of mixed
*/
private $_shadow_properties = array(
private $shadowProperties = array(
'presets' => self::SHADOW_PRESETS_NOSHADOW,
'effect' => null,
'color' => array(
@ -112,7 +112,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*
* @var array of mixed
*/
private $_glow_properties = array(
private $glowProperties = array(
'size' => null,
'color' => array(
'type' => self::EXCEL_COLOR_TYPE_STANDARD,
@ -126,7 +126,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*
* @var array of mixed
*/
private $_soft_edges = array(
private $softEdges = array(
'size' => null
);
@ -137,8 +137,8 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*/
public function setAxisNumberProperties($format_code)
{
$this->_axis_number['format'] = (string) $format_code;
$this->_axis_number['source_linked'] = 0;
$this->axisNumber['format'] = (string) $format_code;
$this->axisNumber['source_linked'] = 0;
}
/**
@ -148,7 +148,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*/
public function getAxisNumberFormat()
{
return $this->_axis_number['format'];
return $this->axisNumber['format'];
}
/**
@ -158,7 +158,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*/
public function getAxisNumberSourceLinked()
{
return (string) $this->_axis_number['source_linked'];
return (string) $this->axisNumber['source_linked'];
}
/**
@ -178,17 +178,17 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*/
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)
{
$this->_axis_options['axis_labels'] = (string) $axis_labels;
($horizontal_crosses_value !== null) ? $this->_axis_options['horizontal_crosses_value'] = (string) $horizontal_crosses_value : null;
($horizontal_crosses !== null) ? $this->_axis_options['horizontal_crosses'] = (string) $horizontal_crosses : null;
($axis_orientation !== null) ? $this->_axis_options['orientation'] = (string) $axis_orientation : null;
($major_tmt !== null) ? $this->_axis_options['major_tick_mark'] = (string) $major_tmt : null;
($minor_tmt !== null) ? $this->_axis_options['minor_tick_mark'] = (string) $minor_tmt : null;
($minor_tmt !== null) ? $this->_axis_options['minor_tick_mark'] = (string) $minor_tmt : null;
($minimum !== null) ? $this->_axis_options['minimum'] = (string) $minimum : null;
($maximum !== null) ? $this->_axis_options['maximum'] = (string) $maximum : null;
($major_unit !== null) ? $this->_axis_options['major_unit'] = (string) $major_unit : null;
($minor_unit !== null) ? $this->_axis_options['minor_unit'] = (string) $minor_unit : null;
$this->axisOptions['axis_labels'] = (string) $axis_labels;
($horizontal_crosses_value !== null) ? $this->axisOptions['horizontal_crosses_value'] = (string) $horizontal_crosses_value : null;
($horizontal_crosses !== null) ? $this->axisOptions['horizontal_crosses'] = (string) $horizontal_crosses : null;
($axis_orientation !== null) ? $this->axisOptions['orientation'] = (string) $axis_orientation : null;
($major_tmt !== null) ? $this->axisOptions['major_tick_mark'] = (string) $major_tmt : null;
($minor_tmt !== null) ? $this->axisOptions['minor_tick_mark'] = (string) $minor_tmt : null;
($minor_tmt !== null) ? $this->axisOptions['minor_tick_mark'] = (string) $minor_tmt : null;
($minimum !== null) ? $this->axisOptions['minimum'] = (string) $minimum : null;
($maximum !== null) ? $this->axisOptions['maximum'] = (string) $maximum : null;
($major_unit !== null) ? $this->axisOptions['major_unit'] = (string) $major_unit : null;
($minor_unit !== null) ? $this->axisOptions['minor_unit'] = (string) $minor_unit : null;
}
/**
@ -200,7 +200,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*/
public function getAxisOptionsProperty($property)
{
return $this->_axis_options[$property];
return $this->axisOptions[$property];
}
/**
@ -224,7 +224,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*/
public function setFillParameters($color, $alpha = 0, $type = self::EXCEL_COLOR_TYPE_ARGB)
{
$this->_fill_properties = $this->setColorProperties($color, $alpha, $type);
$this->fillProperties = $this->setColorProperties($color, $alpha, $type);
}
/**
@ -237,7 +237,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*/
public function setLineParameters($color, $alpha = 0, $type = self::EXCEL_COLOR_TYPE_ARGB)
{
$this->_line_properties = $this->setColorProperties($color, $alpha, $type);
$this->lineProperties = $this->setColorProperties($color, $alpha, $type);
}
/**
@ -249,7 +249,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*/
public function getFillProperty($property)
{
return $this->_fill_properties[$property];
return $this->fillProperties[$property];
}
/**
@ -261,7 +261,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*/
public function getLineProperty($property)
{
return $this->_line_properties[$property];
return $this->lineProperties[$property];
}
/**
@ -278,16 +278,17 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* @param string $end_arrow_size
*
*/
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) {
(!is_null($line_width)) ? $this->_line_style_properties['width'] = $this->getExcelPointsWidth((float) $line_width) : null;
(!is_null($compound_type)) ? $this->_line_style_properties['compound'] = (string) $compound_type : null;
(!is_null($dash_type)) ? $this->_line_style_properties['dash'] = (string) $dash_type : null;
(!is_null($cap_type)) ? $this->_line_style_properties['cap'] = (string) $cap_type : null;
(!is_null($join_type)) ? $this->_line_style_properties['join'] = (string) $join_type : null;
(!is_null($head_arrow_type)) ? $this->_line_style_properties['arrow']['head']['type'] = (string) $head_arrow_type : null;
(!is_null($head_arrow_size)) ? $this->_line_style_properties['arrow']['head']['size'] = (string) $head_arrow_size : null;
(!is_null($end_arrow_type)) ? $this->_line_style_properties['arrow']['end']['type'] = (string) $end_arrow_type : null;
(!is_null($end_arrow_size)) ? $this->_line_style_properties['arrow']['end']['size'] = (string) $end_arrow_size : null;
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)
{
(!is_null($line_width)) ? $this->lineStyleProperties['width'] = $this->getExcelPointsWidth((float) $line_width) : null;
(!is_null($compound_type)) ? $this->lineStyleProperties['compound'] = (string) $compound_type : null;
(!is_null($dash_type)) ? $this->lineStyleProperties['dash'] = (string) $dash_type : null;
(!is_null($cap_type)) ? $this->lineStyleProperties['cap'] = (string) $cap_type : null;
(!is_null($join_type)) ? $this->lineStyleProperties['join'] = (string) $join_type : null;
(!is_null($head_arrow_type)) ? $this->lineStyleProperties['arrow']['head']['type'] = (string) $head_arrow_type : null;
(!is_null($head_arrow_size)) ? $this->lineStyleProperties['arrow']['head']['size'] = (string) $head_arrow_size : null;
(!is_null($end_arrow_type)) ? $this->lineStyleProperties['arrow']['end']['type'] = (string) $end_arrow_type : null;
(!is_null($end_arrow_size)) ? $this->lineStyleProperties['arrow']['end']['size'] = (string) $end_arrow_size : null;
}
/**
@ -299,7 +300,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*/
public function getLineStyleProperty($elements)
{
return $this->getArrayElementsValue($this->_line_style_properties, $elements);
return $this->getArrayElementsValue($this->lineStyleProperties, $elements);
}
/**
@ -311,7 +312,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*/
public function getLineStyleArrowWidth($arrow)
{
return $this->getLineStyleArrowSize($this->_line_style_properties['arrow'][$arrow]['size'], 'w');
return $this->getLineStyleArrowSize($this->lineStyleProperties['arrow'][$arrow]['size'], 'w');
}
/**
@ -323,7 +324,7 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*/
public function getLineStyleArrowLength($arrow)
{
return $this->getLineStyleArrowSize($this->_line_style_properties['arrow'][$arrow]['size'], 'len');
return $this->getLineStyleArrowSize($this->lineStyleProperties['arrow'][$arrow]['size'], 'len');
}
/**
@ -338,15 +339,17 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* @param float $sh_distance
*
*/
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) {
$this->_setShadowPresetsProperties((int) $sh_presets)
->_setShadowColor(
is_null($sh_color_value) ? $this->_shadow_properties['color']['value'] : $sh_color_value
, is_null($sh_color_alpha) ? (int) $this->_shadow_properties['color']['alpha'] : $sh_color_alpha
, is_null($sh_color_type) ? $this->_shadow_properties['color']['type'] : $sh_color_type)
->_setShadowBlur($sh_blur)
->_setShadowAngle($sh_angle)
->_setShadowDistance($sh_distance);
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)
{
$this->setShadowPresetsProperties((int) $sh_presets)
->setShadowColor(
is_null($sh_color_value) ? $this->shadowProperties['color']['value'] : $sh_color_value,
is_null($sh_color_alpha) ? (int) $this->shadowProperties['color']['alpha'] : $sh_color_alpha,
is_null($sh_color_type) ? $this->shadowProperties['color']['type'] : $sh_color_type
)
->setShadowBlur($sh_blur)
->setShadowAngle($sh_angle)
->setShadowDistance($sh_distance);
}
/**
@ -356,9 +359,10 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*
* @return PHPExcel_Chart_Axis
*/
private function _setShadowPresetsProperties($shadow_presets) {
$this->_shadow_properties['presets'] = $shadow_presets;
$this->_setShadowProperiesMapValues($this->getShadowPresetsMap($shadow_presets));
private function setShadowPresetsProperties($shadow_presets)
{
$this->shadowProperties['presets'] = $shadow_presets;
$this->setShadowProperiesMapValues($this->getShadowPresetsMap($shadow_presets));
return $this;
}
@ -371,19 +375,20 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*
* @return PHPExcel_Chart_Axis
*/
private function _setShadowProperiesMapValues(array $properties_map, &$reference = null) {
private function setShadowProperiesMapValues(array $properties_map, &$reference = null)
{
$base_reference = $reference;
foreach ($properties_map as $property_key => $property_val) {
if (is_array($property_val)) {
if ($reference === null) {
$reference = & $this->_shadow_properties[$property_key];
$reference = & $this->shadowProperties[$property_key];
} else {
$reference = & $reference[$property_key];
}
$this->_setShadowProperiesMapValues($property_val, $reference);
$this->setShadowProperiesMapValues($property_val, $reference);
} else {
if ($base_reference === null) {
$this->_shadow_properties[$property_key] = $property_val;
$this->shadowProperties[$property_key] = $property_val;
} else {
$reference[$property_key] = $property_val;
}
@ -402,8 +407,9 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*
* @return PHPExcel_Chart_Axis
*/
private function _setShadowColor($color, $alpha, $type) {
$this->_shadow_properties['color'] = $this->setColorProperties($color, $alpha, $type);
private function setShadowColor($color, $alpha, $type)
{
$this->shadowProperties['color'] = $this->setColorProperties($color, $alpha, $type);
return $this;
}
@ -415,9 +421,10 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*
* @return PHPExcel_Chart_Axis
*/
private function _setShadowBlur($blur) {
private function setShadowBlur($blur)
{
if ($blur !== null) {
$this->_shadow_properties['blur'] = (string) $this->getExcelPointsWidth($blur);
$this->shadowProperties['blur'] = (string) $this->getExcelPointsWidth($blur);
}
return $this;
@ -430,9 +437,10 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*
* @return PHPExcel_Chart_Axis
*/
private function _setShadowAngle($angle) {
private function setShadowAngle($angle)
{
if ($angle !== null) {
$this->_shadow_properties['direction'] = (string) $this->getExcelPointsAngle($angle);
$this->shadowProperties['direction'] = (string) $this->getExcelPointsAngle($angle);
}
return $this;
@ -445,9 +453,10 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*
* @return PHPExcel_Chart_Axis
*/
private function _setShadowDistance($distance) {
private function setShadowDistance($distance)
{
if ($distance !== null) {
$this->_shadow_properties['distance'] = (string) $this->getExcelPointsWidth($distance);
$this->shadowProperties['distance'] = (string) $this->getExcelPointsWidth($distance);
}
return $this;
@ -461,8 +470,9 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* @param int $color_alpha
* @param string $color_type
*/
public function getShadowProperty($elements) {
return $this->getArrayElementsValue($this->_shadow_properties, $elements);
public function getShadowProperty($elements)
{
return $this->getArrayElementsValue($this->shadowProperties, $elements);
}
/**
@ -473,12 +483,13 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
* @param int $color_alpha
* @param string $color_type
*/
public function setGlowProperties($size, $color_value = null, $color_alpha = null, $color_type = null) {
$this->_setGlowSize($size)
->_setGlowColor(
is_null($color_value) ? $this->_glow_properties['color']['value'] : $color_value
, is_null($color_alpha) ? (int) $this->_glow_properties['color']['alpha'] : $color_alpha
, is_null($color_type) ? $this->_glow_properties['color']['type'] : $color_type
public function setGlowProperties($size, $color_value = null, $color_alpha = null, $color_type = null)
{
$this->setGlowSize($size)
->setGlowColor(
is_null($color_value) ? $this->glowProperties['color']['value'] : $color_value,
is_null($color_alpha) ? (int) $this->glowProperties['color']['alpha'] : $color_alpha,
is_null($color_type) ? $this->glowProperties['color']['type'] : $color_type
);
}
@ -489,8 +500,9 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*
* @return string
*/
public function getGlowProperty($property) {
return $this->getArrayElementsValue($this->_glow_properties, $property);
public function getGlowProperty($property)
{
return $this->getArrayElementsValue($this->glowProperties, $property);
}
/**
@ -500,9 +512,10 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*
* @return PHPExcel_Chart_Axis
*/
private function _setGlowSize($size) {
private function setGlowSize($size)
{
if (!is_null($size)) {
$this->_glow_properties['size'] = $this->getExcelPointsWidth($size);
$this->glowProperties['size'] = $this->getExcelPointsWidth($size);
}
return $this;
@ -517,8 +530,9 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*
* @return PHPExcel_Chart_Axis
*/
private function _setGlowColor($color, $alpha, $type) {
$this->_glow_properties['color'] = $this->setColorProperties($color, $alpha, $type);
private function setGlowColor($color, $alpha, $type)
{
$this->glowProperties['color'] = $this->setColorProperties($color, $alpha, $type);
return $this;
}
@ -528,9 +542,10 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*
* @param float $size
*/
public function setSoftEdges($size) {
public function setSoftEdges($size)
{
if (!is_null($size)) {
$_soft_edges['size'] = (string) $this->getExcelPointsWidth($size);
$softEdges['size'] = (string) $this->getExcelPointsWidth($size);
}
}
@ -539,7 +554,8 @@ class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
*
* @return string
*/
public function getSoftEdgesSize() {
return $this->_soft_edges['size'];
public function getSoftEdgesSize()
{
return $this->softEdges['size'];
}
}

View File

@ -75,90 +75,90 @@ class PHPExcel_Chart_DataSeries
*
* @var string
*/
private $_plotType = null;
private $plotType;
/**
* Plot Grouping Type
*
* @var boolean
*/
private $_plotGrouping = null;
private $plotGrouping;
/**
* Plot Direction
*
* @var boolean
*/
private $_plotDirection = null;
private $plotDirection;
/**
* Plot Style
*
* @var string
*/
private $_plotStyle = null;
private $plotStyle;
/**
* Order of plots in Series
*
* @var array of integer
*/
private $_plotOrder = array();
private $plotOrder = array();
/**
* Plot Label
*
* @var array of PHPExcel_Chart_DataSeriesValues
*/
private $_plotLabel = array();
private $plotLabel = array();
/**
* Plot Category
*
* @var array of PHPExcel_Chart_DataSeriesValues
*/
private $_plotCategory = array();
private $plotCategory = array();
/**
* Smooth Line
*
* @var string
*/
private $_smoothLine = null;
private $smoothLine;
/**
* Plot Values
*
* @var array of PHPExcel_Chart_DataSeriesValues
*/
private $_plotValues = array();
private $plotValues = array();
/**
* Create a new PHPExcel_Chart_DataSeries
*/
public function __construct($plotType = null, $plotGrouping = null, $plotOrder = array(), $plotLabel = array(), $plotCategory = array(), $plotValues = array(), $plotDirection = null, $smoothLine = null, $plotStyle = null)
{
$this->_plotType = $plotType;
$this->_plotGrouping = $plotGrouping;
$this->_plotOrder = $plotOrder;
$this->plotType = $plotType;
$this->plotGrouping = $plotGrouping;
$this->plotOrder = $plotOrder;
$keys = array_keys($plotValues);
$this->_plotValues = $plotValues;
$this->plotValues = $plotValues;
if ((count($plotLabel) == 0) || (is_null($plotLabel[$keys[0]]))) {
$plotLabel[$keys[0]] = new PHPExcel_Chart_DataSeriesValues();
}
$this->_plotLabel = $plotLabel;
$this->plotLabel = $plotLabel;
if ((count($plotCategory) == 0) || (is_null($plotCategory[$keys[0]]))) {
$plotCategory[$keys[0]] = new PHPExcel_Chart_DataSeriesValues();
}
$this->_plotCategory = $plotCategory;
$this->_smoothLine = $smoothLine;
$this->_plotStyle = $plotStyle;
$this->plotCategory = $plotCategory;
$this->smoothLine = $smoothLine;
$this->plotStyle = $plotStyle;
if (is_null($plotDirection)) {
$plotDirection = self::DIRECTION_COL;
}
$this->_plotDirection = $plotDirection;
$this->plotDirection = $plotDirection;
}
/**
@ -168,7 +168,7 @@ class PHPExcel_Chart_DataSeries
*/
public function getPlotType()
{
return $this->_plotType;
return $this->plotType;
}
/**
@ -179,7 +179,7 @@ class PHPExcel_Chart_DataSeries
*/
public function setPlotType($plotType = '')
{
$this->_plotType = $plotType;
$this->plotType = $plotType;
return $this;
}
@ -190,7 +190,7 @@ class PHPExcel_Chart_DataSeries
*/
public function getPlotGrouping()
{
return $this->_plotGrouping;
return $this->plotGrouping;
}
/**
@ -201,7 +201,7 @@ class PHPExcel_Chart_DataSeries
*/
public function setPlotGrouping($groupingType = null)
{
$this->_plotGrouping = $groupingType;
$this->plotGrouping = $groupingType;
return $this;
}
@ -212,7 +212,7 @@ class PHPExcel_Chart_DataSeries
*/
public function getPlotDirection()
{
return $this->_plotDirection;
return $this->plotDirection;
}
/**
@ -223,7 +223,7 @@ class PHPExcel_Chart_DataSeries
*/
public function setPlotDirection($plotDirection = null)
{
$this->_plotDirection = $plotDirection;
$this->plotDirection = $plotDirection;
return $this;
}
@ -234,7 +234,7 @@ class PHPExcel_Chart_DataSeries
*/
public function getPlotOrder()
{
return $this->_plotOrder;
return $this->plotOrder;
}
/**
@ -244,7 +244,7 @@ class PHPExcel_Chart_DataSeries
*/
public function getPlotLabels()
{
return $this->_plotLabel;
return $this->plotLabel;
}
/**
@ -254,11 +254,11 @@ class PHPExcel_Chart_DataSeries
*/
public function getPlotLabelByIndex($index)
{
$keys = array_keys($this->_plotLabel);
$keys = array_keys($this->plotLabel);
if (in_array($index, $keys)) {
return $this->_plotLabel[$index];
return $this->plotLabel[$index];
} elseif (isset($keys[$index])) {
return $this->_plotLabel[$keys[$index]];
return $this->plotLabel[$keys[$index]];
}
return false;
}
@ -270,7 +270,7 @@ class PHPExcel_Chart_DataSeries
*/
public function getPlotCategories()
{
return $this->_plotCategory;
return $this->plotCategory;
}
/**
@ -280,11 +280,11 @@ class PHPExcel_Chart_DataSeries
*/
public function getPlotCategoryByIndex($index)
{
$keys = array_keys($this->_plotCategory);
$keys = array_keys($this->plotCategory);
if (in_array($index, $keys)) {
return $this->_plotCategory[$index];
return $this->plotCategory[$index];
} elseif (isset($keys[$index])) {
return $this->_plotCategory[$keys[$index]];
return $this->plotCategory[$keys[$index]];
}
return false;
}
@ -296,7 +296,7 @@ class PHPExcel_Chart_DataSeries
*/
public function getPlotStyle()
{
return $this->_plotStyle;
return $this->plotStyle;
}
/**
@ -307,7 +307,7 @@ class PHPExcel_Chart_DataSeries
*/
public function setPlotStyle($plotStyle = null)
{
$this->_plotStyle = $plotStyle;
$this->plotStyle = $plotStyle;
return $this;
}
@ -318,7 +318,7 @@ class PHPExcel_Chart_DataSeries
*/
public function getPlotValues()
{
return $this->_plotValues;
return $this->plotValues;
}
/**
@ -328,11 +328,11 @@ class PHPExcel_Chart_DataSeries
*/
public function getPlotValuesByIndex($index)
{
$keys = array_keys($this->_plotValues);
$keys = array_keys($this->plotValues);
if (in_array($index, $keys)) {
return $this->_plotValues[$index];
return $this->plotValues[$index];
} elseif (isset($keys[$index])) {
return $this->_plotValues[$keys[$index]];
return $this->plotValues[$keys[$index]];
}
return false;
}
@ -344,7 +344,7 @@ class PHPExcel_Chart_DataSeries
*/
public function getPlotSeriesCount()
{
return count($this->_plotValues);
return count($this->plotValues);
}
/**
@ -354,7 +354,7 @@ class PHPExcel_Chart_DataSeries
*/
public function getSmoothLine()
{
return $this->_smoothLine;
return $this->smoothLine;
}
/**
@ -365,23 +365,23 @@ class PHPExcel_Chart_DataSeries
*/
public function setSmoothLine($smoothLine = true)
{
$this->_smoothLine = $smoothLine;
$this->smoothLine = $smoothLine;
return $this;
}
public function refresh(PHPExcel_Worksheet $worksheet)
{
foreach ($this->_plotValues as $plotValues) {
foreach ($this->plotValues as $plotValues) {
if ($plotValues !== null) {
$plotValues->refresh($worksheet, true);
}
}
foreach ($this->_plotLabel as $plotValues) {
foreach ($this->plotLabel as $plotValues) {
if ($plotValues !== null) {
$plotValues->refresh($worksheet, true);
}
}
foreach ($this->_plotCategory as $plotValues) {
foreach ($this->plotCategory as $plotValues) {
if ($plotValues !== null) {
$plotValues->refresh($worksheet, false);
}

View File

@ -31,7 +31,7 @@ class PHPExcel_Chart_DataSeriesValues
const DATASERIES_TYPE_STRING = 'String';
const DATASERIES_TYPE_NUMBER = 'Number';
private static $_dataTypeValues = array(
private static $dataTypeValues = array(
self::DATASERIES_TYPE_STRING,
self::DATASERIES_TYPE_NUMBER,
);
@ -41,42 +41,42 @@ class PHPExcel_Chart_DataSeriesValues
*
* @var string
*/
private $_dataType = null;
private $dataType;
/**
* Series Data Source
*
* @var string
*/
private $_dataSource = null;
private $dataSource;
/**
* Format Code
*
* @var string
*/
private $_formatCode = null;
private $formatCode;
/**
* Series Point Marker
*
* @var string
*/
private $_marker = null;
private $pointMarker;
/**
* Point Count (The number of datapoints in the dataseries)
*
* @var integer
*/
private $_pointCount = 0;
private $pointCount = 0;
/**
* Data Values
*
* @var array of mixed
*/
private $_dataValues = array();
private $dataValues = array();
/**
* Create a new PHPExcel_Chart_DataSeriesValues object
@ -84,11 +84,11 @@ class PHPExcel_Chart_DataSeriesValues
public function __construct($dataType = self::DATASERIES_TYPE_NUMBER, $dataSource = null, $formatCode = null, $pointCount = 0, $dataValues = array(), $marker = null)
{
$this->setDataType($dataType);
$this->_dataSource = $dataSource;
$this->_formatCode = $formatCode;
$this->_pointCount = $pointCount;
$this->_dataValues = $dataValues;
$this->_marker = $marker;
$this->dataSource = $dataSource;
$this->formatCode = $formatCode;
$this->pointCount = $pointCount;
$this->dataValues = $dataValues;
$this->pointMarker = $marker;
}
/**
@ -98,7 +98,7 @@ class PHPExcel_Chart_DataSeriesValues
*/
public function getDataType()
{
return $this->_dataType;
return $this->dataType;
}
/**
@ -114,10 +114,10 @@ class PHPExcel_Chart_DataSeriesValues
*/
public function setDataType($dataType = self::DATASERIES_TYPE_NUMBER)
{
if (!in_array($dataType, self::$_dataTypeValues)) {
if (!in_array($dataType, self::$dataTypeValues)) {
throw new PHPExcel_Chart_Exception('Invalid datatype for chart data series values');
}
$this->_dataType = $dataType;
$this->dataType = $dataType;
return $this;
}
@ -129,7 +129,7 @@ class PHPExcel_Chart_DataSeriesValues
*/
public function getDataSource()
{
return $this->_dataSource;
return $this->dataSource;
}
/**
@ -140,7 +140,7 @@ class PHPExcel_Chart_DataSeriesValues
*/
public function setDataSource($dataSource = null, $refreshDataValues = true)
{
$this->_dataSource = $dataSource;
$this->dataSource = $dataSource;
if ($refreshDataValues) {
// TO DO
@ -156,7 +156,7 @@ class PHPExcel_Chart_DataSeriesValues
*/
public function getPointMarker()
{
return $this->_marker;
return $this->pointMarker;
}
/**
@ -167,7 +167,7 @@ class PHPExcel_Chart_DataSeriesValues
*/
public function setPointMarker($marker = null)
{
$this->_marker = $marker;
$this->pointMarker = $marker;
return $this;
}
@ -179,7 +179,7 @@ class PHPExcel_Chart_DataSeriesValues
*/
public function getFormatCode()
{
return $this->_formatCode;
return $this->formatCode;
}
/**
@ -190,7 +190,7 @@ class PHPExcel_Chart_DataSeriesValues
*/
public function setFormatCode($formatCode = null)
{
$this->_formatCode = $formatCode;
$this->formatCode = $formatCode;
return $this;
}
@ -202,7 +202,7 @@ class PHPExcel_Chart_DataSeriesValues
*/
public function getPointCount()
{
return $this->_pointCount;
return $this->pointCount;
}
/**
@ -212,8 +212,8 @@ class PHPExcel_Chart_DataSeriesValues
*/
public function isMultiLevelSeries()
{
if (count($this->_dataValues) > 0) {
return is_array($this->_dataValues[0]);
if (count($this->dataValues) > 0) {
return is_array($this->dataValues[0]);
}
return null;
}
@ -226,7 +226,7 @@ class PHPExcel_Chart_DataSeriesValues
public function multiLevelCount()
{
$levelCount = 0;
foreach ($this->_dataValues as $dataValueSet) {
foreach ($this->dataValues as $dataValueSet) {
$levelCount = max($levelCount, count($dataValueSet));
}
return $levelCount;
@ -239,7 +239,7 @@ class PHPExcel_Chart_DataSeriesValues
*/
public function getDataValues()
{
return $this->_dataValues;
return $this->dataValues;
}
/**
@ -249,13 +249,13 @@ class PHPExcel_Chart_DataSeriesValues
*/
public function getDataValue()
{
$count = count($this->_dataValues);
$count = count($this->dataValues);
if ($count == 0) {
return null;
} elseif ($count == 1) {
return $this->_dataValues[0];
return $this->dataValues[0];
}
return $this->_dataValues;
return $this->dataValues;
}
/**
@ -263,14 +263,14 @@ class PHPExcel_Chart_DataSeriesValues
*
* @param array $dataValues
* @param boolean $refreshDataSource
* TRUE - refresh the value of _dataSource based on the values of $dataValues
* FALSE - don't change the value of _dataSource
* TRUE - refresh the value of dataSource based on the values of $dataValues
* FALSE - don't change the value of dataSource
* @return PHPExcel_Chart_DataSeriesValues
*/
public function setDataValues($dataValues = array(), $refreshDataSource = true)
{
$this->_dataValues = PHPExcel_Calculation_Functions::flattenArray($dataValues);
$this->_pointCount = count($dataValues);
$this->dataValues = PHPExcel_Calculation_Functions::flattenArray($dataValues);
$this->pointCount = count($dataValues);
if ($refreshDataSource) {
// TO DO
@ -279,39 +279,39 @@ class PHPExcel_Chart_DataSeriesValues
return $this;
}
private function _stripNulls($var)
private function stripNulls($var)
{
return $var !== null;
}
public function refresh(PHPExcel_Worksheet $worksheet, $flatten = true)
{
if ($this->_dataSource !== null) {
if ($this->dataSource !== null) {
$calcEngine = PHPExcel_Calculation::getInstance($worksheet->getParent());
$newDataValues = PHPExcel_Calculation::_unwrapResult(
$calcEngine->_calculateFormulaValue(
'='.$this->_dataSource,
'='.$this->dataSource,
null,
$worksheet->getCell('A1')
)
);
if ($flatten) {
$this->_dataValues = PHPExcel_Calculation_Functions::flattenArray($newDataValues);
foreach ($this->_dataValues as &$dataValue) {
$this->dataValues = PHPExcel_Calculation_Functions::flattenArray($newDataValues);
foreach ($this->dataValues as &$dataValue) {
if ((!empty($dataValue)) && ($dataValue[0] == '#')) {
$dataValue = 0.0;
}
}
unset($dataValue);
} else {
$cellRange = explode('!', $this->_dataSource);
$cellRange = explode('!', $this->dataSource);
if (count($cellRange) > 1) {
list(, $cellRange) = $cellRange;
}
$dimensions = PHPExcel_Cell::rangeDimension(str_replace('$', '', $cellRange));
if (($dimensions[0] == 1) || ($dimensions[1] == 1)) {
$this->_dataValues = PHPExcel_Calculation_Functions::flattenArray($newDataValues);
$this->dataValues = PHPExcel_Calculation_Functions::flattenArray($newDataValues);
} else {
$newArray = array_values(array_shift($newDataValues));
foreach ($newArray as $i => $newDataSet) {
@ -324,10 +324,10 @@ class PHPExcel_Chart_DataSeriesValues
array_unshift($newArray[$i++], $newDataVal);
}
}
$this->_dataValues = $newArray;
$this->dataValues = $newArray;
}
}
$this->_pointCount = count($this->_dataValues);
$this->pointCount = count($this->dataValues);
}
}
}

View File

@ -20,9 +20,9 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
*
*/
private $_object_state = false;
private $objectState = false;
private $_line_properties = array(
private $lineProperties = array(
'color' => array(
'type' => self::EXCEL_COLOR_TYPE_STANDARD,
'value' => null,
@ -47,7 +47,7 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
)
);
private $_shadow_properties = array(
private $shadowProperties = array(
'presets' => self::SHADOW_PRESETS_NOSHADOW,
'effect' => null,
'color' => array(
@ -67,7 +67,7 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
'rotWithShape' => null
);
private $_glow_properties = array(
private $glowProperties = array(
'size' => null,
'color' => array(
'type' => self::EXCEL_COLOR_TYPE_STANDARD,
@ -76,7 +76,7 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
)
);
private $_soft_edges = array(
private $softEdges = array(
'size' => null
);
@ -88,7 +88,7 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
public function getObjectState()
{
return $this->_object_state;
return $this->objectState;
}
/**
@ -97,9 +97,9 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
* @return PHPExcel_Chart_GridLines
*/
private function _activateObject()
private function activateObject()
{
$this->_object_state = true;
$this->objectState = true;
return $this;
}
@ -114,12 +114,12 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
public function setLineColorProperties($value, $alpha = 0, $type = self::EXCEL_COLOR_TYPE_STANDARD)
{
$this
->_activateObject()
->_line_properties['color'] = $this->setColorProperties(
$this->activateObject()
->lineProperties['color'] = $this->setColorProperties(
$value,
$alpha,
$type);
$type
);
}
/**
@ -138,33 +138,33 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
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)
{
$this->_activateObject();
$this->activateObject();
(!is_null($line_width))
? $this->_line_properties['style']['width'] = $this->getExcelPointsWidth((float) $line_width)
? $this->lineProperties['style']['width'] = $this->getExcelPointsWidth((float) $line_width)
: null;
(!is_null($compound_type))
? $this->_line_properties['style']['compound'] = (string) $compound_type
? $this->lineProperties['style']['compound'] = (string) $compound_type
: null;
(!is_null($dash_type))
? $this->_line_properties['style']['dash'] = (string) $dash_type
? $this->lineProperties['style']['dash'] = (string) $dash_type
: null;
(!is_null($cap_type))
? $this->_line_properties['style']['cap'] = (string) $cap_type
? $this->lineProperties['style']['cap'] = (string) $cap_type
: null;
(!is_null($join_type))
? $this->_line_properties['style']['join'] = (string) $join_type
? $this->lineProperties['style']['join'] = (string) $join_type
: null;
(!is_null($head_arrow_type))
? $this->_line_properties['style']['arrow']['head']['type'] = (string) $head_arrow_type
? $this->lineProperties['style']['arrow']['head']['type'] = (string) $head_arrow_type
: null;
(!is_null($head_arrow_size))
? $this->_line_properties['style']['arrow']['head']['size'] = (string) $head_arrow_size
? $this->lineProperties['style']['arrow']['head']['size'] = (string) $head_arrow_size
: null;
(!is_null($end_arrow_type))
? $this->_line_properties['style']['arrow']['end']['type'] = (string) $end_arrow_type
? $this->lineProperties['style']['arrow']['end']['type'] = (string) $end_arrow_type
: null;
(!is_null($end_arrow_size))
? $this->_line_properties['style']['arrow']['end']['size'] = (string) $end_arrow_size
? $this->lineProperties['style']['arrow']['end']['size'] = (string) $end_arrow_size
: null;
}
@ -178,7 +178,7 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
public function getLineColorProperty($parameter)
{
return $this->_line_properties['color'][$parameter];
return $this->lineProperties['color'][$parameter];
}
/**
@ -191,7 +191,7 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
public function getLineStyleProperty($elements)
{
return $this->getArrayElementsValue($this->_line_properties['style'], $elements);
return $this->getArrayElementsValue($this->lineProperties['style'], $elements);
}
/**
@ -207,9 +207,9 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
public function setGlowProperties($size, $color_value = null, $color_alpha = null, $color_type = null)
{
$this
->_activateObject()
->_setGlowSize($size)
->_setGlowColor($color_value, $color_alpha, $color_type);
->activateObject()
->setGlowSize($size)
->setGlowColor($color_value, $color_alpha, $color_type);
}
/**
@ -222,7 +222,7 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
public function getGlowColor($property)
{
return $this->_glow_properties['color'][$property];
return $this->glowProperties['color'][$property];
}
/**
@ -233,7 +233,7 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
public function getGlowSize()
{
return $this->_glow_properties['size'];
return $this->glowProperties['size'];
}
/**
@ -244,9 +244,9 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
* @return PHPExcel_Chart_GridLines
*/
private function _setGlowSize($size)
private function setGlowSize($size)
{
$this->_glow_properties['size'] = $this->getExcelPointsWidth((float) $size);
$this->glowProperties['size'] = $this->getExcelPointsWidth((float) $size);
return $this;
}
@ -261,16 +261,16 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
* @return PHPExcel_Chart_GridLines
*/
private function _setGlowColor($color, $alpha, $type)
private function setGlowColor($color, $alpha, $type)
{
if (!is_null($color)) {
$this->_glow_properties['color']['value'] = (string) $color;
$this->glowProperties['color']['value'] = (string) $color;
}
if (!is_null($alpha)) {
$this->_glow_properties['color']['alpha'] = $this->getTrueAlpha((int) $alpha);
$this->glowProperties['color']['alpha'] = $this->getTrueAlpha((int) $alpha);
}
if (!is_null($type)) {
$this->_glow_properties['color']['type'] = (string) $type;
$this->glowProperties['color']['type'] = (string) $type;
}
return $this;
@ -287,7 +287,7 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
public function getLineStyleArrowParameters($arrow_selector, $property_selector)
{
return $this->getLineStyleArrowSize($this->_line_properties['style']['arrow'][$arrow_selector]['size'], $property_selector);
return $this->getLineStyleArrowSize($this->lineProperties['style']['arrow'][$arrow_selector]['size'], $property_selector);
}
/**
@ -305,17 +305,16 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
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)
{
$this
->_activateObject()
->_setShadowPresetsProperties((int) $sh_presets)
->_setShadowColor(
is_null($sh_color_value) ? $this->_shadow_properties['color']['value'] : $sh_color_value
, is_null($sh_color_alpha) ? (int) $this->_shadow_properties['color']['alpha']
: $this->getTrueAlpha($sh_color_alpha)
, is_null($sh_color_type) ? $this->_shadow_properties['color']['type'] : $sh_color_type)
->_setShadowBlur($sh_blur)
->_setShadowAngle($sh_angle)
->_setShadowDistance($sh_distance);
$this->activateObject()
->setShadowPresetsProperties((int) $sh_presets)
->setShadowColor(
is_null($sh_color_value) ? $this->shadowProperties['color']['value'] : $sh_color_value,
is_null($sh_color_alpha) ? (int) $this->shadowProperties['color']['alpha'] : $this->getTrueAlpha($sh_color_alpha),
is_null($sh_color_type) ? $this->shadowProperties['color']['type'] : $sh_color_type
)
->setShadowBlur($sh_blur)
->setShadowAngle($sh_angle)
->setShadowDistance($sh_distance);
}
/**
@ -326,10 +325,10 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
* @return PHPExcel_Chart_GridLines
*/
private function _setShadowPresetsProperties($shadow_presets)
private function setShadowPresetsProperties($shadow_presets)
{
$this->_shadow_properties['presets'] = $shadow_presets;
$this->_setShadowProperiesMapValues($this->getShadowPresetsMap($shadow_presets));
$this->shadowProperties['presets'] = $shadow_presets;
$this->setShadowProperiesMapValues($this->getShadowPresetsMap($shadow_presets));
return $this;
}
@ -343,20 +342,20 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
* @return PHPExcel_Chart_GridLines
*/
private function _setShadowProperiesMapValues(array $properties_map, &$reference = null)
private function setShadowProperiesMapValues(array $properties_map, &$reference = null)
{
$base_reference = $reference;
foreach ($properties_map as $property_key => $property_val) {
if (is_array($property_val)) {
if ($reference === null) {
$reference = & $this->_shadow_properties[$property_key];
$reference = & $this->shadowProperties[$property_key];
} else {
$reference = & $reference[$property_key];
}
$this->_setShadowProperiesMapValues($property_val, $reference);
$this->setShadowProperiesMapValues($property_val, $reference);
} else {
if ($base_reference === null) {
$this->_shadow_properties[$property_key] = $property_val;
$this->shadowProperties[$property_key] = $property_val;
} else {
$reference[$property_key] = $property_val;
}
@ -374,16 +373,16 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
* @param string $type
* @return PHPExcel_Chart_GridLines
*/
private function _setShadowColor($color, $alpha, $type)
private function setShadowColor($color, $alpha, $type)
{
if (!is_null($color)) {
$this->_shadow_properties['color']['value'] = (string) $color;
$this->shadowProperties['color']['value'] = (string) $color;
}
if (!is_null($alpha)) {
$this->_shadow_properties['color']['alpha'] = $this->getTrueAlpha((int) $alpha);
$this->shadowProperties['color']['alpha'] = $this->getTrueAlpha((int) $alpha);
}
if (!is_null($type)) {
$this->_shadow_properties['color']['type'] = (string) $type;
$this->shadowProperties['color']['type'] = (string) $type;
}
return $this;
@ -396,10 +395,10 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
*
* @return PHPExcel_Chart_GridLines
*/
private function _setShadowBlur($blur)
private function setShadowBlur($blur)
{
if ($blur !== null) {
$this->_shadow_properties['blur'] = (string) $this->getExcelPointsWidth($blur);
$this->shadowProperties['blur'] = (string) $this->getExcelPointsWidth($blur);
}
return $this;
@ -412,10 +411,10 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
* @return PHPExcel_Chart_GridLines
*/
private function _setShadowAngle($angle)
private function setShadowAngle($angle)
{
if ($angle !== null) {
$this->_shadow_properties['direction'] = (string) $this->getExcelPointsAngle($angle);
$this->shadowProperties['direction'] = (string) $this->getExcelPointsAngle($angle);
}
return $this;
@ -427,10 +426,10 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
* @param float $distance
* @return PHPExcel_Chart_GridLines
*/
private function _setShadowDistance($distance)
private function setShadowDistance($distance)
{
if ($distance !== null) {
$this->_shadow_properties['distance'] = (string) $this->getExcelPointsWidth($distance);
$this->shadowProperties['distance'] = (string) $this->getExcelPointsWidth($distance);
}
return $this;
@ -445,7 +444,7 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
*/
public function getShadowProperty($elements)
{
return $this->getArrayElementsValue($this->_shadow_properties, $elements);
return $this->getArrayElementsValue($this->shadowProperties, $elements);
}
/**
@ -456,8 +455,8 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
public function setSoftEdgesSize($size)
{
if (!is_null($size)) {
$this->_activateObject();
$_soft_edges['size'] = (string) $this->getExcelPointsWidth($size);
$this->activateObject();
$softEdges['size'] = (string) $this->getExcelPointsWidth($size);
}
}
@ -468,6 +467,6 @@ class PHPExcel_Chart_GridLines extends PHPExcel_Chart_Properties
*/
public function getSoftEdgesSize()
{
return $this->_soft_edges['size'];
return $this->softEdges['size'];
}
}

View File

@ -40,49 +40,49 @@ class PHPExcel_Chart_Layout
*
* @var string
*/
private $_layoutTarget = null;
private $layoutTarget;
/**
* X Mode
*
* @var string
*/
private $_xMode = null;
private $xMode;
/**
* Y Mode
*
* @var string
*/
private $_yMode = null;
private $yMode;
/**
* X-Position
*
* @var float
*/
private $_xPos = null;
private $xPos;
/**
* Y-Position
*
* @var float
*/
private $_yPos = null;
private $yPos;
/**
* width
*
* @var float
*/
private $_width = null;
private $width;
/**
* height
*
* @var float
*/
private $_height = null;
private $height;
/**
* show legend key
@ -90,7 +90,7 @@ class PHPExcel_Chart_Layout
*
* @var boolean
*/
private $_showLegendKey = null;
private $showLegendKey;
/**
* show value
@ -98,7 +98,7 @@ class PHPExcel_Chart_Layout
*
* @var boolean
*/
private $_showVal = null;
private $showVal;
/**
* show category name
@ -106,7 +106,7 @@ class PHPExcel_Chart_Layout
*
* @var boolean
*/
private $_showCatName = null;
private $showCatName;
/**
* show data series name
@ -114,7 +114,7 @@ class PHPExcel_Chart_Layout
*
* @var boolean
*/
private $_showSerName = null;
private $showSerName;
/**
* show percentage
@ -122,14 +122,14 @@ class PHPExcel_Chart_Layout
*
* @var boolean
*/
private $_showPercent = null;
private $showPercent;
/**
* show bubble size
*
* @var boolean
*/
private $_showBubbleSize = null;
private $showBubbleSize;
/**
* show leader lines
@ -137,7 +137,7 @@ class PHPExcel_Chart_Layout
*
* @var boolean
*/
private $_showLeaderLines = null;
private $showLeaderLines;
/**
@ -146,25 +146,25 @@ class PHPExcel_Chart_Layout
public function __construct($layout = array())
{
if (isset($layout['layoutTarget'])) {
$this->_layoutTarget = $layout['layoutTarget'];
$this->layoutTarget = $layout['layoutTarget'];
}
if (isset($layout['xMode'])) {
$this->_xMode = $layout['xMode'];
$this->xMode = $layout['xMode'];
}
if (isset($layout['yMode'])) {
$this->_yMode = $layout['yMode'];
$this->yMode = $layout['yMode'];
}
if (isset($layout['x'])) {
$this->_xPos = (float) $layout['x'];
$this->xPos = (float) $layout['x'];
}
if (isset($layout['y'])) {
$this->_yPos = (float) $layout['y'];
$this->yPos = (float) $layout['y'];
}
if (isset($layout['w'])) {
$this->_width = (float) $layout['w'];
$this->width = (float) $layout['w'];
}
if (isset($layout['h'])) {
$this->_height = (float) $layout['h'];
$this->height = (float) $layout['h'];
}
}
@ -175,7 +175,7 @@ class PHPExcel_Chart_Layout
*/
public function getLayoutTarget()
{
return $this->_layoutTarget;
return $this->layoutTarget;
}
/**
@ -186,7 +186,7 @@ class PHPExcel_Chart_Layout
*/
public function setLayoutTarget($value)
{
$this->_layoutTarget = $value;
$this->layoutTarget = $value;
return $this;
}
@ -197,7 +197,7 @@ class PHPExcel_Chart_Layout
*/
public function getXMode()
{
return $this->_xMode;
return $this->xMode;
}
/**
@ -208,7 +208,7 @@ class PHPExcel_Chart_Layout
*/
public function setXMode($value)
{
$this->_xMode = $value;
$this->xMode = $value;
return $this;
}
@ -219,7 +219,7 @@ class PHPExcel_Chart_Layout
*/
public function getYMode()
{
return $this->_yMode;
return $this->yMode;
}
/**
@ -230,7 +230,7 @@ class PHPExcel_Chart_Layout
*/
public function setYMode($value)
{
$this->_yMode = $value;
$this->yMode = $value;
return $this;
}
@ -241,7 +241,7 @@ class PHPExcel_Chart_Layout
*/
public function getXPosition()
{
return $this->_xPos;
return $this->xPos;
}
/**
@ -252,7 +252,7 @@ class PHPExcel_Chart_Layout
*/
public function setXPosition($value)
{
$this->_xPos = $value;
$this->xPos = $value;
return $this;
}
@ -263,7 +263,7 @@ class PHPExcel_Chart_Layout
*/
public function getYPosition()
{
return $this->_yPos;
return $this->yPos;
}
/**
@ -274,7 +274,7 @@ class PHPExcel_Chart_Layout
*/
public function setYPosition($value)
{
$this->_yPos = $value;
$this->yPos = $value;
return $this;
}
@ -285,7 +285,7 @@ class PHPExcel_Chart_Layout
*/
public function getWidth()
{
return $this->_width;
return $this->width;
}
/**
@ -296,7 +296,7 @@ class PHPExcel_Chart_Layout
*/
public function setWidth($value)
{
$this->_width = $value;
$this->width = $value;
return $this;
}
@ -307,7 +307,7 @@ class PHPExcel_Chart_Layout
*/
public function getHeight()
{
return $this->_height;
return $this->height;
}
/**
@ -318,7 +318,7 @@ class PHPExcel_Chart_Layout
*/
public function setHeight($value)
{
$this->_height = $value;
$this->height = $value;
return $this;
}
@ -330,7 +330,7 @@ class PHPExcel_Chart_Layout
*/
public function getShowLegendKey()
{
return $this->_showLegendKey;
return $this->showLegendKey;
}
/**
@ -342,7 +342,7 @@ class PHPExcel_Chart_Layout
*/
public function setShowLegendKey($value)
{
$this->_showLegendKey = $value;
$this->showLegendKey = $value;
return $this;
}
@ -353,7 +353,7 @@ class PHPExcel_Chart_Layout
*/
public function getShowVal()
{
return $this->_showVal;
return $this->showVal;
}
/**
@ -365,7 +365,7 @@ class PHPExcel_Chart_Layout
*/
public function setShowVal($value)
{
$this->_showVal = $value;
$this->showVal = $value;
return $this;
}
@ -376,7 +376,7 @@ class PHPExcel_Chart_Layout
*/
public function getShowCatName()
{
return $this->_showCatName;
return $this->showCatName;
}
/**
@ -388,7 +388,7 @@ class PHPExcel_Chart_Layout
*/
public function setShowCatName($value)
{
$this->_showCatName = $value;
$this->showCatName = $value;
return $this;
}
@ -399,7 +399,7 @@ class PHPExcel_Chart_Layout
*/
public function getShowSerName()
{
return $this->_showSerName;
return $this->showSerName;
}
/**
@ -411,7 +411,7 @@ class PHPExcel_Chart_Layout
*/
public function setShowSerName($value)
{
$this->_showSerName = $value;
$this->showSerName = $value;
return $this;
}
@ -422,7 +422,7 @@ class PHPExcel_Chart_Layout
*/
public function getShowPercent()
{
return $this->_showPercent;
return $this->showPercent;
}
/**
@ -434,7 +434,7 @@ class PHPExcel_Chart_Layout
*/
public function setShowPercent($value)
{
$this->_showPercent = $value;
$this->showPercent = $value;
return $this;
}
@ -445,7 +445,7 @@ class PHPExcel_Chart_Layout
*/
public function getShowBubbleSize()
{
return $this->_showBubbleSize;
return $this->showBubbleSize;
}
/**
@ -457,7 +457,7 @@ class PHPExcel_Chart_Layout
*/
public function setShowBubbleSize($value)
{
$this->_showBubbleSize = $value;
$this->showBubbleSize = $value;
return $this;
}
@ -468,7 +468,7 @@ class PHPExcel_Chart_Layout
*/
public function getShowLeaderLines()
{
return $this->_showLeaderLines;
return $this->showLeaderLines;
}
/**
@ -480,7 +480,7 @@ class PHPExcel_Chart_Layout
*/
public function setShowLeaderLines($value)
{
$this->_showLeaderLines = $value;
$this->showLeaderLines = $value;
return $this;
}
}

View File

@ -55,30 +55,30 @@ class PHPExcel_Chart_Legend
*
* @var string
*/
private $_position = self::POSITION_RIGHT;
private $position = self::POSITION_RIGHT;
/**
* Allow overlay of other elements?
*
* @var boolean
*/
private $_overlay = TRUE;
private $overlay = true;
/**
* Legend Layout
*
* @var PHPExcel_Chart_Layout
*/
private $_layout = NULL;
private $layout = null;
/**
* Create a new PHPExcel_Chart_Legend
*/
public function __construct($position = self::POSITION_RIGHT, PHPExcel_Chart_Layout $layout = NULL, $overlay = FALSE)
public function __construct($position = self::POSITION_RIGHT, PHPExcel_Chart_Layout $layout = null, $overlay = false)
{
$this->setPosition($position);
$this->_layout = $layout;
$this->layout = $layout;
$this->setOverlay($overlay);
}
@ -87,8 +87,9 @@ class PHPExcel_Chart_Legend
*
* @return string
*/
public function getPosition() {
return $this->_position;
public function getPosition()
{
return $this->position;
}
/**
@ -96,12 +97,13 @@ class PHPExcel_Chart_Legend
*
* @param string $position
*/
public function setPosition($position = self::POSITION_RIGHT) {
public function setPosition($position = self::POSITION_RIGHT)
{
if (!in_array($position, self::$_positionXLref)) {
return false;
}
$this->_position = $position;
$this->position = $position;
return true;
}
@ -110,8 +112,9 @@ class PHPExcel_Chart_Legend
*
* @return number
*/
public function getPositionXL() {
return array_search($this->_position,self::$_positionXLref);
public function getPositionXL()
{
return array_search($this->position, self::$_positionXLref);
}
/**
@ -119,12 +122,13 @@ class PHPExcel_Chart_Legend
*
* @param number $positionXL
*/
public function setPositionXL($positionXL = self::xlLegendPositionRight) {
public function setPositionXL($positionXL = self::xlLegendPositionRight)
{
if (!array_key_exists($positionXL, self::$_positionXLref)) {
return false;
}
$this->_position = self::$_positionXLref[$positionXL];
$this->position = self::$_positionXLref[$positionXL];
return true;
}
@ -133,8 +137,9 @@ class PHPExcel_Chart_Legend
*
* @return boolean
*/
public function getOverlay() {
return $this->_overlay;
public function getOverlay()
{
return $this->overlay;
}
/**
@ -143,12 +148,13 @@ class PHPExcel_Chart_Legend
* @param boolean $overlay
* @return boolean
*/
public function setOverlay($overlay = FALSE) {
public function setOverlay($overlay = false)
{
if (!is_bool($overlay)) {
return false;
}
$this->_overlay = $overlay;
$this->overlay = $overlay;
return true;
}
@ -157,8 +163,8 @@ class PHPExcel_Chart_Legend
*
* @return PHPExcel_Chart_Layout
*/
public function getLayout() {
return $this->_layout;
public function getLayout()
{
return $this->layout;
}
}

View File

@ -32,22 +32,22 @@ class PHPExcel_Chart_PlotArea
*
* @var PHPExcel_Chart_Layout
*/
private $_layout = null;
private $layout = null;
/**
* Plot Series
*
* @var array of PHPExcel_Chart_DataSeries
*/
private $_plotSeries = array();
private $plotSeries = array();
/**
* Create a new PHPExcel_Chart_PlotArea
*/
public function __construct(PHPExcel_Chart_Layout $layout = null, $plotSeries = array())
{
$this->_layout = $layout;
$this->_plotSeries = $plotSeries;
$this->layout = $layout;
$this->plotSeries = $plotSeries;
}
/**
@ -57,7 +57,7 @@ class PHPExcel_Chart_PlotArea
*/
public function getLayout()
{
return $this->_layout;
return $this->layout;
}
/**
@ -67,7 +67,7 @@ class PHPExcel_Chart_PlotArea
*/
public function getPlotGroupCount()
{
return count($this->_plotSeries);
return count($this->plotSeries);
}
/**
@ -78,7 +78,7 @@ class PHPExcel_Chart_PlotArea
public function getPlotSeriesCount()
{
$seriesCount = 0;
foreach ($this->_plotSeries as $plot) {
foreach ($this->plotSeries as $plot) {
$seriesCount += $plot->getPlotSeriesCount();
}
return $seriesCount;
@ -91,7 +91,7 @@ class PHPExcel_Chart_PlotArea
*/
public function getPlotGroup()
{
return $this->_plotSeries;
return $this->plotSeries;
}
/**
@ -101,7 +101,7 @@ class PHPExcel_Chart_PlotArea
*/
public function getPlotGroupByIndex($index)
{
return $this->_plotSeries[$index];
return $this->plotSeries[$index];
}
/**
@ -112,14 +112,14 @@ class PHPExcel_Chart_PlotArea
*/
public function setPlotSeries($plotSeries = array())
{
$this->_plotSeries = $plotSeries;
$this->plotSeries = $plotSeries;
return $this;
}
public function refresh(PHPExcel_Worksheet $worksheet)
{
foreach ($this->_plotSeries as $plotSeries) {
foreach ($this->plotSeries as $plotSeries) {
$plotSeries->refresh($worksheet);
}
}

View File

@ -70,7 +70,7 @@ abstract class PHPExcel_Chart_Properties
LINE_STYLE_JOIN_MITER = 'miter',
LINE_STYLE_JOIN_BEVEL = 'bevel',
LINE_STYLE_ARROW_TYPE_NOARROW = NULL,
LINE_STYLE_ARROW_TYPE_NOARROW = null,
LINE_STYLE_ARROW_TYPE_ARROW = 'triangle',
LINE_STYLE_ARROW_TYPE_OPEN = 'arrow',
LINE_STYLE_ARROW_TYPE_STEALTH = 'stealth',
@ -88,7 +88,7 @@ abstract class PHPExcel_Chart_Properties
LINE_STYLE_ARROW_SIZE_9 = 9;
const
SHADOW_PRESETS_NOSHADOW = NULL,
SHADOW_PRESETS_NOSHADOW = null,
SHADOW_PRESETS_OUTER_BOTTTOM_RIGHT = 1,
SHADOW_PRESETS_OUTER_BOTTOM = 2,
SHADOW_PRESETS_OUTER_BOTTOM_LEFT = 3,
@ -137,7 +137,8 @@ abstract class PHPExcel_Chart_Properties
);
}
protected function getLineStyleArrowSize($array_selector, $array_kay_selector) {
protected function getLineStyleArrowSize($array_selector, $array_kay_selector)
{
$sizes = array(
1 => array('w' => 'sm', 'len' => 'sm'),
2 => array('w' => 'sm', 'len' => 'med'),
@ -153,7 +154,8 @@ abstract class PHPExcel_Chart_Properties
return $sizes[$array_selector][$array_kay_selector];
}
protected function getShadowPresetsMap($shadow_presets_option) {
protected function getShadowPresetsMap($shadow_presets_option)
{
$presets_options = array(
//OUTER
1 => array(
@ -345,7 +347,8 @@ abstract class PHPExcel_Chart_Properties
return $presets_options[$shadow_presets_option];
}
protected function getArrayElementsValue($properties, $elements) {
protected function getArrayElementsValue($properties, $elements)
{
$reference = & $properties;
if (!is_array($elements)) {
return $reference[$elements];

View File

@ -1,7 +1,9 @@
<?php
require_once(PHPExcel_Settings::getChartRendererPath().'/jpgraph.php');
/**
* PHPExcel
* PHPExcel_Chart_Renderer_jpgraph
*
* Copyright (c) 2006 - 2015 PHPExcel
*
@ -25,32 +27,22 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE##
*/
require_once(PHPExcel_Settings::getChartRendererPath().'/jpgraph.php');
/**
* PHPExcel_Chart_Renderer_jpgraph
*
* @category PHPExcel
* @package PHPExcel_Chart_Renderer
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Chart_Renderer_jpgraph
{
private static $_width = 640;
private static $width = 640;
private static $_height = 480;
private static $height = 480;
private static $_colourSet = array( 'mediumpurple1', 'palegreen3', 'gold1', 'cadetblue1',
private static $colourSet = array(
'mediumpurple1', 'palegreen3', 'gold1', 'cadetblue1',
'darkmagenta', 'coral', 'dodgerblue3', 'eggplant',
'mediumblue', 'magenta', 'sandybrown', 'cyan',
'firebrick1', 'forestgreen', 'deeppink4', 'darkolivegreen',
'goldenrod2'
);
private static $_markSet = array( 'diamond' => MARK_DIAMOND,
private static $markSet = array(
'diamond' => MARK_DIAMOND,
'square' => MARK_SQUARE,
'triangle' => MARK_UTRIANGLE,
'x' => MARK_X,
@ -62,44 +54,46 @@ class PHPExcel_Chart_Renderer_jpgraph
);
private $_chart = null;
private $chart;
private $_graph = null;
private $graph;
private static $_plotColour = 0;
private static $plotColour = 0;
private static $_plotMark = 0;
private static $plotMark = 0;
private function _formatPointMarker($seriesPlot, $markerID) {
$plotMarkKeys = array_keys(self::$_markSet);
private function formatPointMarker($seriesPlot, $markerID)
{
$plotMarkKeys = array_keys(self::$markSet);
if (is_null($markerID)) {
// Use default plot marker (next marker in the series)
self::$_plotMark %= count(self::$_markSet);
$seriesPlot->mark->SetType(self::$_markSet[$plotMarkKeys[self::$_plotMark++]]);
self::$plotMark %= count(self::$markSet);
$seriesPlot->mark->SetType(self::$markSet[$plotMarkKeys[self::$plotMark++]]);
} elseif ($markerID !== 'none') {
// Use specified plot marker (if it exists)
if (isset(self::$_markSet[$markerID])) {
$seriesPlot->mark->SetType(self::$_markSet[$markerID]);
if (isset(self::$markSet[$markerID])) {
$seriesPlot->mark->SetType(self::$markSet[$markerID]);
} else {
// If the specified plot marker doesn't exist, use default plot marker (next marker in the series)
self::$_plotMark %= count(self::$_markSet);
$seriesPlot->mark->SetType(self::$_markSet[$plotMarkKeys[self::$_plotMark++]]);
self::$plotMark %= count(self::$markSet);
$seriesPlot->mark->SetType(self::$markSet[$plotMarkKeys[self::$plotMark++]]);
}
} else {
// Hide plot marker
$seriesPlot->mark->Hide();
}
$seriesPlot->mark->SetColor(self::$_colourSet[self::$_plotColour]);
$seriesPlot->mark->SetFillColor(self::$_colourSet[self::$_plotColour]);
$seriesPlot->SetColor(self::$_colourSet[self::$_plotColour++]);
$seriesPlot->mark->SetColor(self::$colourSet[self::$plotColour]);
$seriesPlot->mark->SetFillColor(self::$colourSet[self::$plotColour]);
$seriesPlot->SetColor(self::$colourSet[self::$plotColour++]);
return $seriesPlot;
} // function _formatPointMarker()
}
private function _formatDataSetLabels($groupID, $datasetLabels, $labelCount, $rotation = '') {
$datasetLabelFormatCode = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex(0)->getFormatCode();
private function formatDataSetLabels($groupID, $datasetLabels, $labelCount, $rotation = '')
{
$datasetLabelFormatCode = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex(0)->getFormatCode();
if (!is_null($datasetLabelFormatCode)) {
// Retrieve any label formatting code
$datasetLabelFormatCode = stripslashes($datasetLabelFormatCode);
@ -124,16 +118,17 @@ class PHPExcel_Chart_Renderer_jpgraph
}
return $datasetLabels;
} // function _formatDataSetLabels()
}
private function _percentageSumCalculation($groupID, $seriesCount) {
private function percentageSumCalculation($groupID, $seriesCount)
{
// Adjust our values to a percentage value across all series in the group
for ($i = 0; $i < $seriesCount; ++$i) {
if ($i == 0) {
$sumValues = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues();
$sumValues = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues();
} else {
$nextValues = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues();
$nextValues = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues();
foreach ($nextValues as $k => $value) {
if (isset($sumValues[$k])) {
$sumValues[$k] += $value;
@ -145,21 +140,23 @@ class PHPExcel_Chart_Renderer_jpgraph
}
return $sumValues;
} // function _percentageSumCalculation()
}
private function _percentageAdjustValues($dataValues, $sumValues) {
private function percentageAdjustValues($dataValues, $sumValues)
{
foreach ($dataValues as $k => $dataValue) {
$dataValues[$k] = $dataValue / $sumValues[$k] * 100;
}
return $dataValues;
} // function _percentageAdjustValues()
}
private function _getCaption($captionElement) {
private function getCaption($captionElement)
{
// Read any caption
$caption = (!is_null($captionElement)) ? $captionElement->getCaption() : NULL;
$caption = (!is_null($captionElement)) ? $captionElement->getCaption() : null;
// Test if we have a title caption to display
if (!is_null($caption)) {
// If we do, it could be a plain string or an array
@ -169,123 +166,129 @@ class PHPExcel_Chart_Renderer_jpgraph
}
}
return $caption;
} // function _getCaption()
private function _renderTitle() {
$title = $this->_getCaption($this->_chart->getTitle());
if (!is_null($title)) {
$this->_graph->title->Set($title);
}
} // function _renderTitle()
private function _renderLegend() {
$legend = $this->_chart->getLegend();
private function renderTitle()
{
$title = $this->getCaption($this->chart->getTitle());
if (!is_null($title)) {
$this->graph->title->Set($title);
}
}
private function renderLegend()
{
$legend = $this->chart->getLegend();
if (!is_null($legend)) {
$legendPosition = $legend->getPosition();
$legendOverlay = $legend->getOverlay();
switch ($legendPosition) {
case 'r':
$this->_graph->legend->SetPos(0.01,0.5,'right','center'); // right
$this->_graph->legend->SetColumns(1);
$this->graph->legend->SetPos(0.01, 0.5, 'right', 'center'); // right
$this->graph->legend->SetColumns(1);
break;
case 'l':
$this->_graph->legend->SetPos(0.01,0.5,'left','center'); // left
$this->_graph->legend->SetColumns(1);
$this->graph->legend->SetPos(0.01, 0.5, 'left', 'center'); // left
$this->graph->legend->SetColumns(1);
break;
case 't':
$this->_graph->legend->SetPos(0.5,0.01,'center','top'); // top
$this->graph->legend->SetPos(0.5, 0.01, 'center', 'top'); // top
break;
case 'b':
$this->_graph->legend->SetPos(0.5,0.99,'center','bottom'); // bottom
$this->graph->legend->SetPos(0.5, 0.99, 'center', 'bottom'); // bottom
break;
default:
$this->_graph->legend->SetPos(0.01,0.01,'right','top'); // top-right
$this->_graph->legend->SetColumns(1);
$this->graph->legend->SetPos(0.01, 0.01, 'right', 'top'); // top-right
$this->graph->legend->SetColumns(1);
break;
}
} else {
$this->_graph->legend->Hide();
$this->graph->legend->Hide();
}
}
} // function _renderLegend()
private function _renderCartesianPlotArea($type='textlin') {
$this->_graph = new Graph(self::$_width,self::$_height);
$this->_graph->SetScale($type);
private function renderCartesianPlotArea($type = 'textlin')
{
$this->graph = new Graph(self::$width, self::$height);
$this->graph->SetScale($type);
$this->_renderTitle();
$this->renderTitle();
// Rotate for bar rather than column chart
$rotation = $this->_chart->getPlotArea()->getPlotGroupByIndex(0)->getPlotDirection();
$rotation = $this->chart->getPlotArea()->getPlotGroupByIndex(0)->getPlotDirection();
$reverse = ($rotation == 'bar') ? true : false;
$xAxisLabel = $this->_chart->getXAxisLabel();
$xAxisLabel = $this->chart->getXAxisLabel();
if (!is_null($xAxisLabel)) {
$title = $this->_getCaption($xAxisLabel);
$title = $this->getCaption($xAxisLabel);
if (!is_null($title)) {
$this->_graph->xaxis->SetTitle($title,'center');
$this->_graph->xaxis->title->SetMargin(35);
$this->graph->xaxis->SetTitle($title, 'center');
$this->graph->xaxis->title->SetMargin(35);
if ($reverse) {
$this->_graph->xaxis->title->SetAngle(90);
$this->_graph->xaxis->title->SetMargin(90);
$this->graph->xaxis->title->SetAngle(90);
$this->graph->xaxis->title->SetMargin(90);
}
}
}
$yAxisLabel = $this->_chart->getYAxisLabel();
$yAxisLabel = $this->chart->getYAxisLabel();
if (!is_null($yAxisLabel)) {
$title = $this->_getCaption($yAxisLabel);
$title = $this->getCaption($yAxisLabel);
if (!is_null($title)) {
$this->_graph->yaxis->SetTitle($title,'center');
$this->graph->yaxis->SetTitle($title, 'center');
if ($reverse) {
$this->_graph->yaxis->title->SetAngle(0);
$this->_graph->yaxis->title->SetMargin(-55);
$this->graph->yaxis->title->SetAngle(0);
$this->graph->yaxis->title->SetMargin(-55);
}
}
}
}
} // function _renderCartesianPlotArea()
private function _renderPiePlotArea($doughnut = False) {
$this->_graph = new PieGraph(self::$_width,self::$_height);
private function renderPiePlotArea($doughnut = false)
{
$this->graph = new PieGraph(self::$width, self::$height);
$this->_renderTitle();
} // function _renderPiePlotArea()
$this->renderTitle();
}
private function _renderRadarPlotArea() {
$this->_graph = new RadarGraph(self::$_width,self::$_height);
$this->_graph->SetScale('lin');
private function renderRadarPlotArea()
{
$this->graph = new RadarGraph(self::$width, self::$height);
$this->graph->SetScale('lin');
$this->_renderTitle();
} // function _renderRadarPlotArea()
$this->renderTitle();
}
private function _renderPlotLine($groupID, $filled = false, $combination = false, $dimensions = '2d') {
$grouping = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotGrouping();
private function renderPlotLine($groupID, $filled = false, $combination = false, $dimensions = '2d')
{
$grouping = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotGrouping();
$labelCount = count($this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex(0)->getPointCount());
$labelCount = count($this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex(0)->getPointCount());
if ($labelCount > 0) {
$datasetLabels = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex(0)->getDataValues();
$datasetLabels = $this->_formatDataSetLabels($groupID, $datasetLabels, $labelCount);
$this->_graph->xaxis->SetTickLabels($datasetLabels);
$datasetLabels = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex(0)->getDataValues();
$datasetLabels = $this->formatDataSetLabels($groupID, $datasetLabels, $labelCount);
$this->graph->xaxis->SetTickLabels($datasetLabels);
}
$seriesCount = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount();
$seriesCount = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount();
$seriesPlots = array();
if ($grouping == 'percentStacked') {
$sumValues = $this->_percentageSumCalculation($groupID, $seriesCount);
$sumValues = $this->percentageSumCalculation($groupID, $seriesCount);
}
// Loop through each data series in turn
for ($i = 0; $i < $seriesCount; ++$i) {
$dataValues = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues();
$marker = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getPointMarker();
$dataValues = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues();
$marker = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getPointMarker();
if ($grouping == 'percentStacked') {
$dataValues = $this->_percentageAdjustValues($dataValues, $sumValues);
$dataValues = $this->percentageAdjustValues($dataValues, $sumValues);
}
// Fill in any missing values in the $dataValues array
@ -306,12 +309,12 @@ class PHPExcel_Chart_Renderer_jpgraph
if ($filled) {
$seriesPlot->SetFilled(true);
$seriesPlot->SetColor('black');
$seriesPlot->SetFillColor(self::$_colourSet[self::$_plotColour++]);
$seriesPlot->SetFillColor(self::$colourSet[self::$plotColour++]);
} else {
// Set the appropriate plot marker
$this->_formatPointMarker($seriesPlot, $marker);
$this->formatPointMarker($seriesPlot, $marker);
}
$dataLabel = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($i)->getDataValue();
$dataLabel = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($i)->getDataValue();
$seriesPlot->SetLegend($dataLabel);
$seriesPlots[] = $seriesPlot;
@ -322,44 +325,45 @@ class PHPExcel_Chart_Renderer_jpgraph
} else {
$groupPlot = new AccLinePlot($seriesPlots);
}
$this->_graph->Add($groupPlot);
} // function _renderPlotLine()
$this->graph->Add($groupPlot);
}
private function _renderPlotBar($groupID, $dimensions = '2d') {
$rotation = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotDirection();
private function renderPlotBar($groupID, $dimensions = '2d')
{
$rotation = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotDirection();
// Rotate for bar rather than column chart
if (($groupID == 0) && ($rotation == 'bar')) {
$this->_graph->Set90AndMargin();
$this->graph->Set90AndMargin();
}
$grouping = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotGrouping();
$grouping = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotGrouping();
$labelCount = count($this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex(0)->getPointCount());
$labelCount = count($this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex(0)->getPointCount());
if ($labelCount > 0) {
$datasetLabels = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex(0)->getDataValues();
$datasetLabels = $this->_formatDataSetLabels($groupID, $datasetLabels, $labelCount, $rotation);
$datasetLabels = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex(0)->getDataValues();
$datasetLabels = $this->formatDataSetLabels($groupID, $datasetLabels, $labelCount, $rotation);
// Rotate for bar rather than column chart
if ($rotation == 'bar') {
$datasetLabels = array_reverse($datasetLabels);
$this->_graph->yaxis->SetPos('max');
$this->_graph->yaxis->SetLabelAlign('center','top');
$this->_graph->yaxis->SetLabelSide(SIDE_RIGHT);
$this->graph->yaxis->SetPos('max');
$this->graph->yaxis->SetLabelAlign('center', 'top');
$this->graph->yaxis->SetLabelSide(SIDE_RIGHT);
}
$this->_graph->xaxis->SetTickLabels($datasetLabels);
$this->graph->xaxis->SetTickLabels($datasetLabels);
}
$seriesCount = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount();
$seriesCount = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount();
$seriesPlots = array();
if ($grouping == 'percentStacked') {
$sumValues = $this->_percentageSumCalculation($groupID, $seriesCount);
$sumValues = $this->percentageSumCalculation($groupID, $seriesCount);
}
// Loop through each data series in turn
for ($j = 0; $j < $seriesCount; ++$j) {
$dataValues = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($j)->getDataValues();
$dataValues = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($j)->getDataValues();
if ($grouping == 'percentStacked') {
$dataValues = $this->_percentageAdjustValues($dataValues, $sumValues);
$dataValues = $this->percentageAdjustValues($dataValues, $sumValues);
}
// Fill in any missing values in the $dataValues array
@ -378,14 +382,14 @@ class PHPExcel_Chart_Renderer_jpgraph
}
$seriesPlot = new BarPlot($dataValues);
$seriesPlot->SetColor('black');
$seriesPlot->SetFillColor(self::$_colourSet[self::$_plotColour++]);
$seriesPlot->SetFillColor(self::$colourSet[self::$plotColour++]);
if ($dimensions == '3d') {
$seriesPlot->SetShadow();
}
if (!$this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($j)) {
if (!$this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($j)) {
$dataLabel = '';
} else {
$dataLabel = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($j)->getDataValue();
$dataLabel = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($j)->getDataValue();
}
$seriesPlot->SetLegend($dataLabel);
@ -407,21 +411,22 @@ class PHPExcel_Chart_Renderer_jpgraph
}
}
$this->_graph->Add($groupPlot);
} // function _renderPlotBar()
$this->graph->Add($groupPlot);
}
private function _renderPlotScatter($groupID, $bubble) {
$grouping = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotGrouping();
$scatterStyle = $bubbleSize = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotStyle();
private function renderPlotScatter($groupID, $bubble)
{
$grouping = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotGrouping();
$scatterStyle = $bubbleSize = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotStyle();
$seriesCount = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount();
$seriesCount = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount();
$seriesPlots = array();
// Loop through each data series in turn
for ($i = 0; $i < $seriesCount; ++$i) {
$dataValuesY = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex($i)->getDataValues();
$dataValuesX = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues();
$dataValuesY = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex($i)->getDataValues();
$dataValuesX = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues();
foreach ($dataValuesY as $k => $dataValueY) {
$dataValuesY[$k] = $k;
@ -430,43 +435,44 @@ class PHPExcel_Chart_Renderer_jpgraph
$seriesPlot = new ScatterPlot($dataValuesX, $dataValuesY);
if ($scatterStyle == 'lineMarker') {
$seriesPlot->SetLinkPoints();
$seriesPlot->link->SetColor(self::$_colourSet[self::$_plotColour]);
$seriesPlot->link->SetColor(self::$colourSet[self::$plotColour]);
} elseif ($scatterStyle == 'smoothMarker') {
$spline = new Spline($dataValuesY, $dataValuesX);
list($splineDataY, $splineDataX) = $spline->Get(count($dataValuesX) * self::$_width / 20);
list($splineDataY, $splineDataX) = $spline->Get(count($dataValuesX) * self::$width / 20);
$lplot = new LinePlot($splineDataX, $splineDataY);
$lplot->SetColor(self::$_colourSet[self::$_plotColour]);
$lplot->SetColor(self::$colourSet[self::$plotColour]);
$this->_graph->Add($lplot);
$this->graph->Add($lplot);
}
if ($bubble) {
$this->_formatPointMarker($seriesPlot,'dot');
$this->formatPointMarker($seriesPlot, 'dot');
$seriesPlot->mark->SetColor('black');
$seriesPlot->mark->SetSize($bubbleSize);
} else {
$marker = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getPointMarker();
$this->_formatPointMarker($seriesPlot, $marker);
$marker = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getPointMarker();
$this->formatPointMarker($seriesPlot, $marker);
}
$dataLabel = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($i)->getDataValue();
$dataLabel = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($i)->getDataValue();
$seriesPlot->SetLegend($dataLabel);
$this->_graph->Add($seriesPlot);
$this->graph->Add($seriesPlot);
}
}
} // function _renderPlotScatter()
private function _renderPlotRadar($groupID) {
$radarStyle = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotStyle();
private function renderPlotRadar($groupID)
{
$radarStyle = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotStyle();
$seriesCount = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount();
$seriesCount = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount();
$seriesPlots = array();
// Loop through each data series in turn
for ($i = 0; $i < $seriesCount; ++$i) {
$dataValuesY = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex($i)->getDataValues();
$dataValuesX = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues();
$marker = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getPointMarker();
$dataValuesY = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex($i)->getDataValues();
$dataValuesX = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues();
$marker = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getPointMarker();
$dataValues = array();
foreach ($dataValuesY as $k => $dataValueY) {
@ -477,51 +483,53 @@ class PHPExcel_Chart_Renderer_jpgraph
$tmp = array_shift($dataValuesX);
$dataValuesX[] = $tmp;
$this->_graph->SetTitles(array_reverse($dataValues));
$this->graph->SetTitles(array_reverse($dataValues));
$seriesPlot = new RadarPlot(array_reverse($dataValuesX));
$dataLabel = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($i)->getDataValue();
$seriesPlot->SetColor(self::$_colourSet[self::$_plotColour++]);
$dataLabel = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotLabelByIndex($i)->getDataValue();
$seriesPlot->SetColor(self::$colourSet[self::$plotColour++]);
if ($radarStyle == 'filled') {
$seriesPlot->SetFillColor(self::$_colourSet[self::$_plotColour]);
$seriesPlot->SetFillColor(self::$colourSet[self::$plotColour]);
}
$this->_formatPointMarker($seriesPlot, $marker);
$this->formatPointMarker($seriesPlot, $marker);
$seriesPlot->SetLegend($dataLabel);
$this->_graph->Add($seriesPlot);
$this->graph->Add($seriesPlot);
}
}
} // function _renderPlotRadar()
private function _renderPlotContour($groupID) {
$contourStyle = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotStyle();
private function renderPlotContour($groupID)
{
$contourStyle = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotStyle();
$seriesCount = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount();
$seriesCount = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount();
$seriesPlots = array();
$dataValues = array();
// Loop through each data series in turn
for ($i = 0; $i < $seriesCount; ++$i) {
$dataValuesY = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex($i)->getDataValues();
$dataValuesX = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues();
$dataValuesY = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex($i)->getDataValues();
$dataValuesX = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($i)->getDataValues();
$dataValues[$i] = $dataValuesX;
}
$seriesPlot = new ContourPlot($dataValues);
$this->_graph->Add($seriesPlot);
} // function _renderPlotContour()
$this->graph->Add($seriesPlot);
}
private function _renderPlotStock($groupID) {
$seriesCount = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount();
$plotOrder = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotOrder();
private function renderPlotStock($groupID)
{
$seriesCount = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount();
$plotOrder = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotOrder();
$dataValues = array();
// Loop through each data series in turn and build the plot arrays
foreach ($plotOrder as $i => $v) {
$dataValuesX = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($v)->getDataValues();
$dataValuesX = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($v)->getDataValues();
foreach ($dataValuesX as $j => $dataValueX) {
$dataValues[$plotOrder[$i]][$j] = $dataValueX;
}
@ -532,111 +540,117 @@ class PHPExcel_Chart_Renderer_jpgraph
$dataValuesPlot = array();
// Flatten the plot arrays to a single dimensional array to work with jpgraph
for($j = 0; $j < count($dataValues[0]); $j++) {
for($i = 0; $i < $seriesCount; $i++) {
for ($j = 0; $j < count($dataValues[0]); ++$j) {
for ($i = 0; $i < $seriesCount; ++$i) {
$dataValuesPlot[] = $dataValues[$i][$j];
}
}
// Set the x-axis labels
$labelCount = count($this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex(0)->getPointCount());
$labelCount = count($this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex(0)->getPointCount());
if ($labelCount > 0) {
$datasetLabels = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex(0)->getDataValues();
$datasetLabels = $this->_formatDataSetLabels($groupID, $datasetLabels, $labelCount);
$this->_graph->xaxis->SetTickLabels($datasetLabels);
$datasetLabels = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex(0)->getDataValues();
$datasetLabels = $this->formatDataSetLabels($groupID, $datasetLabels, $labelCount);
$this->graph->xaxis->SetTickLabels($datasetLabels);
}
$seriesPlot = new StockPlot($dataValuesPlot);
$seriesPlot->SetWidth(20);
$this->_graph->Add($seriesPlot);
} // function _renderPlotStock()
$this->graph->Add($seriesPlot);
}
private function _renderAreaChart($groupCount, $dimensions = '2d') {
private function renderAreaChart($groupCount, $dimensions = '2d')
{
require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_line.php');
$this->_renderCartesianPlotArea();
$this->renderCartesianPlotArea();
for ($i = 0; $i < $groupCount; ++$i) {
$this->_renderPlotLine($i,True,False, $dimensions);
$this->renderPlotLine($i, true, false, $dimensions);
}
}
} // function _renderAreaChart()
private function _renderLineChart($groupCount, $dimensions = '2d') {
private function renderLineChart($groupCount, $dimensions = '2d')
{
require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_line.php');
$this->_renderCartesianPlotArea();
$this->renderCartesianPlotArea();
for ($i = 0; $i < $groupCount; ++$i) {
$this->_renderPlotLine($i,False,False, $dimensions);
$this->renderPlotLine($i, false, false, $dimensions);
}
}
} // function _renderLineChart()
private function _renderBarChart($groupCount, $dimensions = '2d') {
private function renderBarChart($groupCount, $dimensions = '2d')
{
require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_bar.php');
$this->_renderCartesianPlotArea();
$this->renderCartesianPlotArea();
for ($i = 0; $i < $groupCount; ++$i) {
$this->_renderPlotBar($i, $dimensions);
$this->renderPlotBar($i, $dimensions);
}
}
} // function _renderBarChart()
private function _renderScatterChart($groupCount) {
private function renderScatterChart($groupCount)
{
require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_scatter.php');
require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_regstat.php');
require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_line.php');
$this->_renderCartesianPlotArea('linlin');
$this->renderCartesianPlotArea('linlin');
for ($i = 0; $i < $groupCount; ++$i) {
$this->_renderPlotScatter($i,false);
$this->renderPlotScatter($i, false);
}
}
} // function _renderScatterChart()
private function _renderBubbleChart($groupCount) {
private function renderBubbleChart($groupCount)
{
require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_scatter.php');
$this->_renderCartesianPlotArea('linlin');
$this->renderCartesianPlotArea('linlin');
for ($i = 0; $i < $groupCount; ++$i) {
$this->_renderPlotScatter($i,true);
$this->renderPlotScatter($i, true);
}
}
} // function _renderBubbleChart()
private function _renderPieChart($groupCount, $dimensions = '2d', $doughnut = False, $multiplePlots = False) {
private function renderPieChart($groupCount, $dimensions = '2d', $doughnut = false, $multiplePlots = false)
{
require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_pie.php');
if ($dimensions == '3d') {
require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_pie3d.php');
}
$this->_renderPiePlotArea($doughnut);
$this->renderPiePlotArea($doughnut);
$iLimit = ($multiplePlots) ? $groupCount : 1;
for ($groupID = 0; $groupID < $iLimit; ++$groupID) {
$grouping = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotGrouping();
$exploded = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotStyle();
$grouping = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotGrouping();
$exploded = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotStyle();
if ($groupID == 0) {
$labelCount = count($this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex(0)->getPointCount());
$labelCount = count($this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex(0)->getPointCount());
if ($labelCount > 0) {
$datasetLabels = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex(0)->getDataValues();
$datasetLabels = $this->_formatDataSetLabels($groupID, $datasetLabels, $labelCount);
$datasetLabels = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotCategoryByIndex(0)->getDataValues();
$datasetLabels = $this->formatDataSetLabels($groupID, $datasetLabels, $labelCount);
}
}
$seriesCount = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount();
$seriesCount = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotSeriesCount();
$seriesPlots = array();
// For pie charts, we only display the first series: doughnut charts generally display all series
$jLimit = ($multiplePlots) ? $seriesCount : 1;
// Loop through each data series in turn
for ($j = 0; $j < $jLimit; ++$j) {
$dataValues = $this->_chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($j)->getDataValues();
$dataValues = $this->chart->getPlotArea()->getPlotGroupByIndex($groupID)->getPlotValuesByIndex($j)->getDataValues();
// Fill in any missing values in the $dataValues array
$testCurrentIndex = 0;
@ -666,9 +680,10 @@ class PHPExcel_Chart_Renderer_jpgraph
$seriesPlot->SetMidColor('white');
}
$seriesPlot->SetColor(self::$_colourSet[self::$_plotColour++]);
if (count($datasetLabels) > 0)
$seriesPlot->SetColor(self::$colourSet[self::$plotColour++]);
if (count($datasetLabels) > 0) {
$seriesPlot->SetLabels(array_fill(0, count($datasetLabels), ''));
}
if ($dimensions != '3d') {
$seriesPlot->SetGuideLines(false);
}
@ -679,104 +694,109 @@ class PHPExcel_Chart_Renderer_jpgraph
$seriesPlot->SetLegends($datasetLabels);
}
$this->_graph->Add($seriesPlot);
$this->graph->Add($seriesPlot);
}
}
}
} // function _renderPieChart()
private function _renderRadarChart($groupCount) {
private function renderRadarChart($groupCount)
{
require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_radar.php');
$this->_renderRadarPlotArea();
$this->renderRadarPlotArea();
for ($groupID = 0; $groupID < $groupCount; ++$groupID) {
$this->_renderPlotRadar($groupID);
$this->renderPlotRadar($groupID);
}
}
} // function _renderRadarChart()
private function _renderStockChart($groupCount) {
private function renderStockChart($groupCount)
{
require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_stock.php');
$this->_renderCartesianPlotArea('intint');
$this->renderCartesianPlotArea('intint');
for ($groupID = 0; $groupID < $groupCount; ++$groupID) {
$this->_renderPlotStock($groupID);
$this->renderPlotStock($groupID);
}
}
} // function _renderStockChart()
private function _renderContourChart($groupCount, $dimensions) {
private function renderContourChart($groupCount, $dimensions)
{
require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_contour.php');
$this->_renderCartesianPlotArea('intint');
$this->renderCartesianPlotArea('intint');
for ($i = 0; $i < $groupCount; ++$i) {
$this->_renderPlotContour($i);
$this->renderPlotContour($i);
}
}
} // function _renderContourChart()
private function _renderCombinationChart($groupCount, $dimensions, $outputDestination) {
private function renderCombinationChart($groupCount, $dimensions, $outputDestination)
{
require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_line.php');
require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_bar.php');
require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_scatter.php');
require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_regstat.php');
require_once(PHPExcel_Settings::getChartRendererPath().'jpgraph_line.php');
$this->_renderCartesianPlotArea();
$this->renderCartesianPlotArea();
for ($i = 0; $i < $groupCount; ++$i) {
$dimensions = null;
$chartType = $this->_chart->getPlotArea()->getPlotGroupByIndex($i)->getPlotType();
$chartType = $this->chart->getPlotArea()->getPlotGroupByIndex($i)->getPlotType();
switch ($chartType) {
case 'area3DChart':
$dimensions = '3d';
case 'areaChart':
$this->_renderPlotLine($i,True,True, $dimensions);
$this->renderPlotLine($i, true, true, $dimensions);
break;
case 'bar3DChart':
$dimensions = '3d';
case 'barChart':
$this->_renderPlotBar($i, $dimensions);
$this->renderPlotBar($i, $dimensions);
break;
case 'line3DChart':
$dimensions = '3d';
case 'lineChart':
$this->_renderPlotLine($i,False,True, $dimensions);
$this->renderPlotLine($i, false, true, $dimensions);
break;
case 'scatterChart':
$this->_renderPlotScatter($i,false);
$this->renderPlotScatter($i, false);
break;
case 'bubbleChart':
$this->_renderPlotScatter($i,true);
$this->renderPlotScatter($i, true);
break;
default:
$this->_graph = null;
$this->graph = null;
return false;
}
}
$this->_renderLegend();
$this->renderLegend();
$this->_graph->Stroke($outputDestination);
$this->graph->Stroke($outputDestination);
return true;
} // function _renderCombinationChart()
}
public function render($outputDestination) {
self::$_plotColour = 0;
public function render($outputDestination)
{
self::$plotColour = 0;
$groupCount = $this->_chart->getPlotArea()->getPlotGroupCount();
$groupCount = $this->chart->getPlotArea()->getPlotGroupCount();
$dimensions = null;
if ($groupCount == 1) {
$chartType = $this->_chart->getPlotArea()->getPlotGroupByIndex(0)->getPlotType();
$chartType = $this->chart->getPlotArea()->getPlotGroupByIndex(0)->getPlotType();
} else {
$chartTypes = array();
for ($i = 0; $i < $groupCount; ++$i) {
$chartTypes[] = $this->_chart->getPlotArea()->getPlotGroupByIndex($i)->getPlotType();
$chartTypes[] = $this->chart->getPlotArea()->getPlotGroupByIndex($i)->getPlotType();
}
$chartTypes = array_unique($chartTypes);
if (count($chartTypes) == 1) {
@ -785,7 +805,7 @@ class PHPExcel_Chart_Renderer_jpgraph
echo 'Chart is not yet implemented<br />';
return false;
} else {
return $this->_renderCombinationChart($groupCount, $dimensions, $outputDestination);
return $this->renderCombinationChart($groupCount, $dimensions, $outputDestination);
}
}
@ -793,54 +813,54 @@ class PHPExcel_Chart_Renderer_jpgraph
case 'area3DChart':
$dimensions = '3d';
case 'areaChart':
$this->_renderAreaChart($groupCount, $dimensions);
$this->renderAreaChart($groupCount, $dimensions);
break;
case 'bar3DChart':
$dimensions = '3d';
case 'barChart':
$this->_renderBarChart($groupCount, $dimensions);
$this->renderBarChart($groupCount, $dimensions);
break;
case 'line3DChart':
$dimensions = '3d';
case 'lineChart':
$this->_renderLineChart($groupCount, $dimensions);
$this->renderLineChart($groupCount, $dimensions);
break;
case 'pie3DChart':
$dimensions = '3d';
case 'pieChart':
$this->_renderPieChart($groupCount, $dimensions,False,False);
$this->renderPieChart($groupCount, $dimensions, false, false);
break;
case 'doughnut3DChart':
$dimensions = '3d';
case 'doughnutChart':
$this->_renderPieChart($groupCount, $dimensions,True,True);
$this->renderPieChart($groupCount, $dimensions, true, true);
break;
case 'scatterChart':
$this->_renderScatterChart($groupCount);
$this->renderScatterChart($groupCount);
break;
case 'bubbleChart':
$this->_renderBubbleChart($groupCount);
$this->renderBubbleChart($groupCount);
break;
case 'radarChart':
$this->_renderRadarChart($groupCount);
$this->renderRadarChart($groupCount);
break;
case 'surface3DChart':
$dimensions = '3d';
case 'surfaceChart':
$this->_renderContourChart($groupCount, $dimensions);
$this->renderContourChart($groupCount, $dimensions);
break;
case 'stockChart':
$this->_renderStockChart($groupCount, $dimensions);
$this->renderStockChart($groupCount, $dimensions);
break;
default:
echo $chartType.' is not yet implemented<br />';
return false;
}
$this->_renderLegend();
$this->renderLegend();
$this->_graph->Stroke($outputDestination);
$this->graph->Stroke($outputDestination);
return true;
} // function render()
}
/**
@ -848,8 +868,7 @@ class PHPExcel_Chart_Renderer_jpgraph
*/
public function __construct(PHPExcel_Chart $chart)
{
$this->_graph = null;
$this->_chart = $chart;
} // function __construct()
} // PHPExcel_Chart_Renderer_jpgraph
$this->graph = null;
$this->chart = $chart;
}
}

View File

@ -1,6 +1,7 @@
<?php
/**
* PHPExcel
* PHPExcel_Chart_Title
*
* Copyright (c) 2006 - 2015 PHPExcel
*
@ -24,15 +25,6 @@
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version ##VERSION##, ##DATE##
*/
/**
* PHPExcel_Chart_Title
*
* @category PHPExcel
* @package PHPExcel_Chart
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Chart_Title
{
@ -41,22 +33,22 @@ class PHPExcel_Chart_Title
*
* @var string
*/
private $_caption = null;
private $caption = null;
/**
* Title Layout
*
* @var PHPExcel_Chart_Layout
*/
private $_layout = null;
private $layout = null;
/**
* Create a new PHPExcel_Chart_Title
*/
public function __construct($caption = null, PHPExcel_Chart_Layout $layout = null)
{
$this->_caption = $caption;
$this->_layout = $layout;
$this->caption = $caption;
$this->layout = $layout;
}
/**
@ -64,8 +56,9 @@ class PHPExcel_Chart_Title
*
* @return string
*/
public function getCaption() {
return $this->_caption;
public function getCaption()
{
return $this->caption;
}
/**
@ -74,8 +67,9 @@ class PHPExcel_Chart_Title
* @param string $caption
* @return PHPExcel_Chart_Title
*/
public function setCaption($caption = null) {
$this->_caption = $caption;
public function setCaption($caption = null)
{
$this->caption = $caption;
return $this;
}
@ -85,8 +79,8 @@ class PHPExcel_Chart_Title
*
* @return PHPExcel_Chart_Layout
*/
public function getLayout() {
return $this->_layout;
public function getLayout()
{
return $this->layout;
}
}

View File

@ -109,7 +109,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*
* @return string
*/
public function getAuthor() {
public function getAuthor()
{
return $this->_author;
}
@ -119,7 +120,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
* @param string $pValue
* @return PHPExcel_Comment
*/
public function setAuthor($pValue = '') {
public function setAuthor($pValue = '')
{
$this->_author = $pValue;
return $this;
}
@ -129,7 +131,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*
* @return PHPExcel_RichText
*/
public function getText() {
public function getText()
{
return $this->_text;
}
@ -139,7 +142,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
* @param PHPExcel_RichText $pValue
* @return PHPExcel_Comment
*/
public function setText(PHPExcel_RichText $pValue) {
public function setText(PHPExcel_RichText $pValue)
{
$this->_text = $pValue;
return $this;
}
@ -149,7 +153,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*
* @return string
*/
public function getWidth() {
public function getWidth()
{
return $this->_width;
}
@ -159,7 +164,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
* @param string $value
* @return PHPExcel_Comment
*/
public function setWidth($value = '96pt') {
public function setWidth($value = '96pt')
{
$this->_width = $value;
return $this;
}
@ -169,7 +175,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*
* @return string
*/
public function getHeight() {
public function getHeight()
{
return $this->_height;
}
@ -179,7 +186,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
* @param string $value
* @return PHPExcel_Comment
*/
public function setHeight($value = '55.5pt') {
public function setHeight($value = '55.5pt')
{
$this->_height = $value;
return $this;
}
@ -189,7 +197,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*
* @return string
*/
public function getMarginLeft() {
public function getMarginLeft()
{
return $this->_marginLeft;
}
@ -199,7 +208,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
* @param string $value
* @return PHPExcel_Comment
*/
public function setMarginLeft($value = '59.25pt') {
public function setMarginLeft($value = '59.25pt')
{
$this->_marginLeft = $value;
return $this;
}
@ -209,7 +219,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*
* @return string
*/
public function getMarginTop() {
public function getMarginTop()
{
return $this->_marginTop;
}
@ -219,7 +230,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
* @param string $value
* @return PHPExcel_Comment
*/
public function setMarginTop($value = '1.5pt') {
public function setMarginTop($value = '1.5pt')
{
$this->_marginTop = $value;
return $this;
}
@ -229,7 +241,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*
* @return boolean
*/
public function getVisible() {
public function getVisible()
{
return $this->_visible;
}
@ -239,7 +252,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
* @param boolean $value
* @return PHPExcel_Comment
*/
public function setVisible($value = false) {
public function setVisible($value = false)
{
$this->_visible = $value;
return $this;
}
@ -249,7 +263,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*
* @return PHPExcel_Style_Color
*/
public function getFillColor() {
public function getFillColor()
{
return $this->_fillColor;
}
@ -259,7 +274,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
* @param string $pValue
* @return PHPExcel_Comment
*/
public function setAlignment($pValue = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL) {
public function setAlignment($pValue = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL)
{
$this->_alignment = $pValue;
return $this;
}
@ -269,7 +285,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*
* @return string
*/
public function getAlignment() {
public function getAlignment()
{
return $this->_alignment;
}
@ -278,7 +295,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*
* @return string Hash code
*/
public function getHashCode() {
public function getHashCode()
{
return md5(
$this->_author
. $this->_text->getHashCode()
@ -296,7 +314,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
/**
* Implement PHP __clone to create a deep clone, not just a shallow copy.
*/
public function __clone() {
public function __clone()
{
$vars = get_object_vars($this);
foreach ($vars as $key => $value) {
if (is_object($value)) {
@ -312,8 +331,8 @@ class PHPExcel_Comment implements PHPExcel_IComparable
*
* @return string
*/
public function __toString() {
public function __toString()
{
return $this->_text->getPlainText();
}
}

View File

@ -33,7 +33,8 @@
* @package PHPExcel
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Exception extends Exception {
class PHPExcel_Exception extends Exception
{
/**
* Error handler callback
*
@ -43,7 +44,8 @@ class PHPExcel_Exception extends Exception {
* @param mixed $line
* @param mixed $context
*/
public static function errorHandlerCallback($code, $string, $file, $line, $context) {
public static function errorHandlerCallback($code, $string, $file, $line, $context)
{
$e = new self($string, $code);
$e->line = $line;
$e->file = $file;

View File

@ -69,7 +69,9 @@ class PHPExcel_IOFactory
/**
* Private constructor for PHPExcel_IOFactory
*/
private function __construct() { }
private function __construct()
{
}
/**
* Get search locations
@ -135,7 +137,7 @@ class PHPExcel_IOFactory
$className = str_replace('{0}', $writerType, $searchLocation['class']);
$instance = new $className($phpExcel);
if ($instance !== NULL) {
if ($instance !== null) {
return $instance;
}
}
@ -165,7 +167,7 @@ class PHPExcel_IOFactory
$className = str_replace('{0}', $readerType, $searchLocation['class']);
$instance = new $className();
if ($instance !== NULL) {
if ($instance !== null) {
return $instance;
}
}
@ -222,7 +224,7 @@ class PHPExcel_IOFactory
// First, lucky guess by inspecting file extension
$pathinfo = pathinfo($pFilename);
$extensionType = NULL;
$extensionType = null;
if (isset($pathinfo['extension'])) {
switch (strtolower($pathinfo['extension'])) {
case 'xlsx': // Excel (OfficeOpenXML) Spreadsheet

View File

@ -75,7 +75,7 @@ class PHPExcel_NamedRange
public function __construct($pName = null, PHPExcel_Worksheet $pWorksheet, $pRange = 'A1', $pLocalOnly = false, $pScope = null)
{
// Validate data
if (($pName === NULL) || ($pWorksheet === NULL) || ($pRange === NULL)) {
if (($pName === null) || ($pWorksheet === null) || ($pRange === null)) {
throw new PHPExcel_Exception('Parameters can not be null.');
}
@ -93,7 +93,8 @@ class PHPExcel_NamedRange
*
* @return string
*/
public function getName() {
public function getName()
{
return $this->_name;
}
@ -103,18 +104,19 @@ class PHPExcel_NamedRange
* @param string $value
* @return PHPExcel_NamedRange
*/
public function setName($value = null) {
if ($value !== NULL) {
public function setName($value = null)
{
if ($value !== null) {
// Old title
$oldTitle = $this->_name;
// Re-attach
if ($this->_worksheet !== NULL) {
if ($this->_worksheet !== null) {
$this->_worksheet->getParent()->removeNamedRange($this->_name, $this->_worksheet);
}
$this->_name = $value;
if ($this->_worksheet !== NULL) {
if ($this->_worksheet !== null) {
$this->_worksheet->getParent()->addNamedRange($this);
}
@ -130,7 +132,8 @@ class PHPExcel_NamedRange
*
* @return PHPExcel_Worksheet
*/
public function getWorksheet() {
public function getWorksheet()
{
return $this->_worksheet;
}
@ -140,8 +143,9 @@ class PHPExcel_NamedRange
* @param PHPExcel_Worksheet $value
* @return PHPExcel_NamedRange
*/
public function setWorksheet(PHPExcel_Worksheet $value = null) {
if ($value !== NULL) {
public function setWorksheet(PHPExcel_Worksheet $value = null)
{
if ($value !== null) {
$this->_worksheet = $value;
}
return $this;
@ -152,7 +156,8 @@ class PHPExcel_NamedRange
*
* @return string
*/
public function getRange() {
public function getRange()
{
return $this->_range;
}
@ -162,8 +167,9 @@ class PHPExcel_NamedRange
* @param string $value
* @return PHPExcel_NamedRange
*/
public function setRange($value = null) {
if ($value !== NULL) {
public function setRange($value = null)
{
if ($value !== null) {
$this->_range = $value;
}
return $this;
@ -174,7 +180,8 @@ class PHPExcel_NamedRange
*
* @return bool
*/
public function getLocalOnly() {
public function getLocalOnly()
{
return $this->_localOnly;
}
@ -184,7 +191,8 @@ class PHPExcel_NamedRange
* @param bool $value
* @return PHPExcel_NamedRange
*/
public function setLocalOnly($value = false) {
public function setLocalOnly($value = false)
{
$this->_localOnly = $value;
$this->_scope = $value ? $this->_worksheet : null;
return $this;
@ -195,7 +203,8 @@ class PHPExcel_NamedRange
*
* @return PHPExcel_Worksheet|null
*/
public function getScope() {
public function getScope()
{
return $this->_scope;
}
@ -205,7 +214,8 @@ class PHPExcel_NamedRange
* @param PHPExcel_Worksheet|null $value
* @return PHPExcel_NamedRange
*/
public function setScope(PHPExcel_Worksheet $value = null) {
public function setScope(PHPExcel_Worksheet $value = null)
{
$this->_scope = $value;
$this->_localOnly = ($value == null) ? false : true;
return $this;
@ -218,14 +228,16 @@ class PHPExcel_NamedRange
* @param PHPExcel_Worksheet|null $pSheet Scope. Use null for global scope
* @return PHPExcel_NamedRange
*/
public static function resolveRange($pNamedRange = '', PHPExcel_Worksheet $pSheet) {
public static function resolveRange($pNamedRange = '', PHPExcel_Worksheet $pSheet)
{
return $pSheet->getParent()->getNamedRange($pNamedRange, $pSheet);
}
/**
* Implement PHP __clone to create a deep clone, not just a shallow copy.
*/
public function __clone() {
public function __clone()
{
$vars = get_object_vars($this);
foreach ($vars as $key => $value) {
if (is_object($value)) {

View File

@ -46,8 +46,9 @@ class PHPExcel_ReferenceHelper
*
* @return PHPExcel_ReferenceHelper
*/
public static function getInstance() {
if (!isset(self::$_instance) || (self::$_instance === NULL)) {
public static function getInstance()
{
if (!isset(self::$_instance) || (self::$_instance === null)) {
self::$_instance = new PHPExcel_ReferenceHelper();
}
@ -57,7 +58,8 @@ class PHPExcel_ReferenceHelper
/**
* Create a new PHPExcel_ReferenceHelper
*/
protected function __construct() {
protected function __construct()
{
}
/**
@ -68,7 +70,8 @@ class PHPExcel_ReferenceHelper
* @param string $b Second column to test (e.g. 'Z')
* @return integer
*/
public static function columnSort($a, $b) {
public static function columnSort($a, $b)
{
return strcasecmp(strlen($a) . $a, strlen($b) . $b);
}
@ -80,7 +83,8 @@ class PHPExcel_ReferenceHelper
* @param string $b Second column to test (e.g. 'Z')
* @return integer
*/
public static function columnReverseSort($a, $b) {
public static function columnReverseSort($a, $b)
{
return 1 - strcasecmp(strlen($a) . $a, strlen($b) . $b);
}
@ -92,7 +96,8 @@ class PHPExcel_ReferenceHelper
* @param string $b Second cell to test (e.g. 'Z1')
* @return integer
*/
public static function cellSort($a, $b) {
public static function cellSort($a, $b)
{
sscanf($a, '%[A-Z]%d', $ac, $ar);
sscanf($b, '%[A-Z]%d', $bc, $br);
@ -110,7 +115,8 @@ class PHPExcel_ReferenceHelper
* @param string $b Second cell to test (e.g. 'Z1')
* @return integer
*/
public static function cellReverseSort($a, $b) {
public static function cellReverseSort($a, $b)
{
sscanf($a, '%[A-Z]%d', $ac, $ar);
sscanf($b, '%[A-Z]%d', $bc, $br);
@ -130,20 +136,21 @@ class PHPExcel_ReferenceHelper
* @param integer $pNumCols Number of columns to insert/delete (negative values indicate deletion)
* @return boolean
*/
private static function cellAddressInDeleteRange($cellAddress, $beforeRow, $pNumRows, $beforeColumnIndex, $pNumCols) {
private static function cellAddressInDeleteRange($cellAddress, $beforeRow, $pNumRows, $beforeColumnIndex, $pNumCols)
{
list($cellColumn, $cellRow) = PHPExcel_Cell::coordinateFromString($cellAddress);
$cellColumnIndex = PHPExcel_Cell::columnIndexFromString($cellColumn);
// Is cell within the range of rows/columns if we're deleting
if ($pNumRows < 0 &&
($cellRow >= ($beforeRow + $pNumRows)) &&
($cellRow < $beforeRow)) {
return TRUE;
return true;
} elseif ($pNumCols < 0 &&
($cellColumnIndex >= ($beforeColumnIndex + $pNumCols)) &&
($cellColumnIndex < $beforeColumnIndex)) {
return TRUE;
return true;
}
return FALSE;
return false;
}
/**
@ -220,9 +227,7 @@ class PHPExcel_ReferenceHelper
protected function _adjustHyperlinks($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
{
$aHyperlinkCollection = $pSheet->getHyperlinkCollection();
($pNumCols > 0 || $pNumRows > 0) ?
uksort($aHyperlinkCollection, array('PHPExcel_ReferenceHelper','cellReverseSort')) :
uksort($aHyperlinkCollection, array('PHPExcel_ReferenceHelper','cellSort'));
($pNumCols > 0 || $pNumRows > 0) ? uksort($aHyperlinkCollection, array('PHPExcel_ReferenceHelper','cellReverseSort')) : uksort($aHyperlinkCollection, array('PHPExcel_ReferenceHelper','cellSort'));
foreach ($aHyperlinkCollection as $key => $value) {
$newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows);
@ -246,9 +251,8 @@ class PHPExcel_ReferenceHelper
protected function _adjustDataValidations($pSheet, $pBefore, $beforeColumnIndex, $pNumCols, $beforeRow, $pNumRows)
{
$aDataValidationCollection = $pSheet->getDataValidationCollection();
($pNumCols > 0 || $pNumRows > 0) ?
uksort($aDataValidationCollection, array('PHPExcel_ReferenceHelper','cellReverseSort')) :
uksort($aDataValidationCollection, array('PHPExcel_ReferenceHelper','cellSort'));
($pNumCols > 0 || $pNumRows > 0) ? uksort($aDataValidationCollection, array('PHPExcel_ReferenceHelper','cellReverseSort')) : uksort($aDataValidationCollection, array('PHPExcel_ReferenceHelper','cellSort'));
foreach ($aDataValidationCollection as $key => $value) {
$newReference = $this->updateCellReference($key, $pBefore, $pNumCols, $pNumRows);
if ($key != $newReference) {
@ -372,7 +376,7 @@ class PHPExcel_ReferenceHelper
* @param PHPExcel_Worksheet $pSheet The worksheet that we're editing
* @throws PHPExcel_Exception
*/
public function insertNewBefore($pBefore = 'A1', $pNumCols = 0, $pNumRows = 0, PHPExcel_Worksheet $pSheet = NULL)
public function insertNewBefore($pBefore = 'A1', $pNumCols = 0, $pNumRows = 0, PHPExcel_Worksheet $pSheet = null)
{
$remove = ($pNumCols < 0 || $pNumRows < 0);
$aCellCollection = $pSheet->getCellCollection();
@ -442,8 +446,7 @@ class PHPExcel_ReferenceHelper
if ($cell->getDataType() == PHPExcel_Cell_DataType::TYPE_FORMULA) {
// Formula should be adjusted
$pSheet->getCell($newCoordinates)
->setValue($this->updateFormulaReferences($cell->getValue(),
$pBefore, $pNumCols, $pNumRows, $pSheet->getTitle()));
->setValue($this->updateFormulaReferences($cell->getValue(), $pBefore, $pNumCols, $pNumRows, $pSheet->getTitle()));
} else {
// Formula should not be adjusted
$pSheet->getCell($newCoordinates)->setValue($cell->getValue());
@ -451,14 +454,12 @@ class PHPExcel_ReferenceHelper
// Clear the original cell
$pSheet->getCellCacheController()->deleteCacheData($cellID);
} else {
/* We don't need to update styles for rows/columns before our insertion position,
but we do still need to adjust any formulae in those cells */
if ($cell->getDataType() == PHPExcel_Cell_DataType::TYPE_FORMULA) {
// Formula should be adjusted
$cell->setValue($this->updateFormulaReferences($cell->getValue(),
$pBefore, $pNumCols, $pNumRows, $pSheet->getTitle()));
$cell->setValue($this->updateFormulaReferences($cell->getValue(), $pBefore, $pNumCols, $pNumRows, $pSheet->getTitle()));
}
}
@ -620,9 +621,7 @@ class PHPExcel_ReferenceHelper
if (count($pSheet->getParent()->getNamedRanges()) > 0) {
foreach ($pSheet->getParent()->getNamedRanges() as $namedRange) {
if ($namedRange->getWorksheet()->getHashCode() == $pSheet->getHashCode()) {
$namedRange->setRange(
$this->updateCellReference($namedRange->getRange(), $pBefore, $pNumCols, $pNumRows)
);
$namedRange->setRange($this->updateCellReference($namedRange->getRange(), $pBefore, $pNumCols, $pNumRows));
}
}
}
@ -642,7 +641,8 @@ class PHPExcel_ReferenceHelper
* @return string Updated formula
* @throws PHPExcel_Exception
*/
public function updateFormulaReferences($pFormula = '', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0, $sheetName = '') {
public function updateFormulaReferences($pFormula = '', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0, $sheetName = '')
{
// Update cell references in the formula
$formulaBlocks = explode('"', $pFormula);
$i = false;
@ -781,7 +781,8 @@ class PHPExcel_ReferenceHelper
* @return string Updated cell range
* @throws PHPExcel_Exception
*/
public function updateCellReference($pCellRange = 'A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0) {
public function updateCellReference($pCellRange = 'A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0)
{
// Is it in another worksheet? Will not have to update anything.
if (strpos($pCellRange, "!") !== false) {
return $pCellRange;
@ -805,7 +806,8 @@ class PHPExcel_ReferenceHelper
* @param string $oldName Old name (name to replace)
* @param string $newName New name
*/
public function updateNamedFormulas(PHPExcel $pPhpExcel, $oldName = '', $newName = '') {
public function updateNamedFormulas(PHPExcel $pPhpExcel, $oldName = '', $newName = '')
{
if ($oldName == '') {
return;
}
@ -813,7 +815,7 @@ class PHPExcel_ReferenceHelper
foreach ($pPhpExcel->getWorksheetIterator() as $sheet) {
foreach ($sheet->getCellCollection(false) as $cellID) {
$cell = $sheet->getCell($cellID);
if (($cell !== NULL) && ($cell->getDataType() == PHPExcel_Cell_DataType::TYPE_FORMULA)) {
if (($cell !== null) && ($cell->getDataType() == PHPExcel_Cell_DataType::TYPE_FORMULA)) {
$formula = $cell->getValue();
if (strpos($formula, $oldName) !== false) {
$formula = str_replace("'" . $oldName . "'!", "'" . $newName . "'!", $formula);
@ -835,7 +837,8 @@ class PHPExcel_ReferenceHelper
* @return string Updated cell range
* @throws PHPExcel_Exception
*/
private function _updateCellRange($pCellRange = 'A1:A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0) {
private function _updateCellRange($pCellRange = 'A1:A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0)
{
if (strpos($pCellRange,':') !== false || strpos($pCellRange, ',') !== false) {
// Update range
$range = PHPExcel_Cell::splitRange($pCellRange);
@ -872,7 +875,8 @@ class PHPExcel_ReferenceHelper
* @return string Updated cell reference
* @throws PHPExcel_Exception
*/
private function _updateSingleCellReference($pCellReference = 'A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0) {
private function _updateSingleCellReference($pCellReference = 'A1', $pBefore = 'A1', $pNumCols = 0, $pNumRows = 0)
{
if (strpos($pCellReference, ':') === false && strpos($pCellReference, ',') === false) {
// Get coordinates of $pBefore
list($beforeColumn, $beforeRow) = PHPExcel_Cell::coordinateFromString($pBefore);
@ -881,10 +885,8 @@ class PHPExcel_ReferenceHelper
list($newColumn, $newRow) = PHPExcel_Cell::coordinateFromString($pCellReference);
// Verify which parts should be updated
$updateColumn = (($newColumn{0} != '$') && ($beforeColumn{0} != '$') &&
PHPExcel_Cell::columnIndexFromString($newColumn) >= PHPExcel_Cell::columnIndexFromString($beforeColumn));
$updateRow = (($newRow{0} != '$') && ($beforeRow{0} != '$') &&
$newRow >= $beforeRow);
$updateColumn = (($newColumn{0} != '$') && ($beforeColumn{0} != '$') && (PHPExcel_Cell::columnIndexFromString($newColumn) >= PHPExcel_Cell::columnIndexFromString($beforeColumn)));
$updateRow = (($newRow{0} != '$') && ($beforeRow{0} != '$') && $newRow >= $beforeRow);
// Create new column reference
if ($updateColumn) {
@ -908,7 +910,8 @@ class PHPExcel_ReferenceHelper
*
* @throws PHPExcel_Exception
*/
public final function __clone() {
final public function __clone()
{
throw new PHPExcel_Exception("Cloning a Singleton is not allowed!");
}
}

View File

@ -41,7 +41,8 @@ class PHPExcel_Shared_Drawing
* @param int $pValue Value in pixels
* @return int Value in EMU
*/
public static function pixelsToEMU($pValue = 0) {
public static function pixelsToEMU($pValue = 0)
{
return round($pValue * 9525);
}
@ -51,7 +52,8 @@ class PHPExcel_Shared_Drawing
* @param int $pValue Value in EMU
* @return int Value in pixels
*/
public static function EMUToPixels($pValue = 0) {
public static function EMUToPixels($pValue = 0)
{
if ($pValue != 0) {
return round($pValue / 9525);
} else {
@ -68,22 +70,19 @@ class PHPExcel_Shared_Drawing
* @param PHPExcel_Style_Font $pDefaultFont Default font of the workbook
* @return int Value in cell dimension
*/
public static function pixelsToCellDimension($pValue = 0, PHPExcel_Style_Font $pDefaultFont) {
public static function pixelsToCellDimension($pValue = 0, PHPExcel_Style_Font $pDefaultFont)
{
// Font name and size
$name = $pDefaultFont->getName();
$size = $pDefaultFont->getSize();
if (isset(PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size])) {
// Exact width can be determined
$colWidth = $pValue
* PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size]['width']
/ PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size]['px'];
$colWidth = $pValue * PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size]['width'] / PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size]['px'];
} else {
// We don't have data for this particular font and size, use approximation by
// extrapolating from Calibri 11
$colWidth = $pValue * 11
* PHPExcel_Shared_Font::$defaultColumnWidths['Calibri'][11]['width']
/ PHPExcel_Shared_Font::$defaultColumnWidths['Calibri'][11]['px'] / $size;
$colWidth = $pValue * 11 * PHPExcel_Shared_Font::$defaultColumnWidths['Calibri'][11]['width'] / PHPExcel_Shared_Font::$defaultColumnWidths['Calibri'][11]['px'] / $size;
}
return $colWidth;
@ -96,23 +95,19 @@ class PHPExcel_Shared_Drawing
* @param PHPExcel_Style_Font $pDefaultFont Default font of the workbook
* @return int Value in pixels
*/
public static function cellDimensionToPixels($pValue = 0, PHPExcel_Style_Font $pDefaultFont) {
public static function cellDimensionToPixels($pValue = 0, PHPExcel_Style_Font $pDefaultFont)
{
// Font name and size
$name = $pDefaultFont->getName();
$size = $pDefaultFont->getSize();
if (isset(PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size])) {
// Exact width can be determined
$colWidth = $pValue
* PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size]['px']
/ PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size]['width'];
$colWidth = $pValue * PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size]['px'] / PHPExcel_Shared_Font::$defaultColumnWidths[$name][$size]['width'];
} else {
// We don't have data for this particular font and size, use approximation by
// extrapolating from Calibri 11
$colWidth = $pValue * $size
* PHPExcel_Shared_Font::$defaultColumnWidths['Calibri'][11]['px']
/ PHPExcel_Shared_Font::$defaultColumnWidths['Calibri'][11]['width'] / 11;
$colWidth = $pValue * $size * PHPExcel_Shared_Font::$defaultColumnWidths['Calibri'][11]['px'] / PHPExcel_Shared_Font::$defaultColumnWidths['Calibri'][11]['width'] / 11;
}
// Round pixels to closest integer
@ -127,7 +122,8 @@ class PHPExcel_Shared_Drawing
* @param int $pValue Value in pixels
* @return int Value in points
*/
public static function pixelsToPoints($pValue = 0) {
public static function pixelsToPoints($pValue = 0)
{
return $pValue * 0.67777777;
}
@ -137,7 +133,8 @@ class PHPExcel_Shared_Drawing
* @param int $pValue Value in points
* @return int Value in pixels
*/
public static function pointsToPixels($pValue = 0) {
public static function pointsToPixels($pValue = 0)
{
if ($pValue != 0) {
return (int) ceil($pValue * 1.333333333);
} else {
@ -151,7 +148,8 @@ class PHPExcel_Shared_Drawing
* @param int $pValue Degrees
* @return int Angle
*/
public static function degreesToAngle($pValue = 0) {
public static function degreesToAngle($pValue = 0)
{
return (int)round($pValue * 60000);
}
@ -161,7 +159,8 @@ class PHPExcel_Shared_Drawing
* @param int $pValue Angle
* @return int Degrees
*/
public static function angleToDegrees($pValue = 0) {
public static function angleToDegrees($pValue = 0)
{
if ($pValue != 0) {
return round($pValue / 60000);
} else {
@ -181,8 +180,9 @@ class PHPExcel_Shared_Drawing
// Load the image into a string
$file = fopen($p_sFile, "rb");
$read = fread($file, 10);
while (!feof($file)&&($read<>""))
while (!feof($file) && ($read<>"")) {
$read .= fread($file, 1024);
}
$temp = unpack("H*", $read);
$hex = $temp[1];
@ -190,8 +190,7 @@ class PHPExcel_Shared_Drawing
// Process the header
// Structure: http://www.fastgraph.com/help/bmp_header_format.html
if (substr($header,0,4)=="424d")
{
if (substr($header, 0, 4)=="424d") {
// Cut it in parts of 2 bytes
$header_parts = str_split($header, 2);
@ -226,15 +225,14 @@ class PHPExcel_Shared_Drawing
// Using a for-loop with index-calculation instaid of str_split to avoid large memory consumption
// Calculate the next DWORD-position in the body
for ($i=0;$i<$body_size;$i+=3)
{
for ($i = 0 ; $i < $body_size ; $i += 3) {
// Calculate line-ending and padding
if ($x>=$width)
{
if ($x >= $width) {
// If padding needed, ignore image-padding
// Shift i to the ending of the current 32-bit-block
if ($usePadding)
if ($usePadding) {
$i += $width%4;
}
// Reset horizontal position
$x = 0;
@ -243,9 +241,10 @@ class PHPExcel_Shared_Drawing
$y++;
// Reached the image-height? Break the for-loop
if ($y>$height)
if ($y > $height) {
break;
}
}
// Calculation of the RGB-pixel (defined as BGR in image-data)
// Define $i_pos as absolute position in the body
@ -268,5 +267,4 @@ class PHPExcel_Shared_Drawing
// Return image-object
return $image;
}
}

View File

@ -87,5 +87,4 @@ class PHPExcel_Shared_Escher
{
return $this->_dgContainer = $dgContainer;
}
}

View File

@ -41,7 +41,7 @@ class PHPExcel_Shared_File
* @protected
* @var boolean
*/
protected static $_useUploadTempDirectory = FALSE;
protected static $_useUploadTempDirectory = false;
/**
@ -49,9 +49,10 @@ class PHPExcel_Shared_File
*
* @param boolean $useUploadTempDir Use File Upload Temporary directory (true or false)
*/
public static function setUseUploadTempDirectory($useUploadTempDir = FALSE) {
public static function setUseUploadTempDirectory($useUploadTempDir = false)
{
self::$_useUploadTempDirectory = (boolean) $useUploadTempDir;
} // function setUseUploadTempDirectory()
}
/**
@ -59,9 +60,10 @@ class PHPExcel_Shared_File
*
* @return boolean Use File Upload Temporary directory (true or false)
*/
public static function getUseUploadTempDirectory() {
public static function getUseUploadTempDirectory()
{
return self::$_useUploadTempDirectory;
} // function getUseUploadTempDirectory()
}
/**
@ -70,7 +72,8 @@ class PHPExcel_Shared_File
* @param string $pFilename Filename
* @return bool
*/
public static function file_exists($pFilename) {
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...
@ -99,7 +102,8 @@ class PHPExcel_Shared_File
* @param string $pFilename
* @return string
*/
public static function realpath($pFilename) {
public static function realpath($pFilename)
{
// Returnvalue
$returnValue = '';
@ -109,7 +113,7 @@ class PHPExcel_Shared_File
}
// Found something?
if ($returnValue == '' || ($returnValue === NULL)) {
if ($returnValue == '' || ($returnValue === null)) {
$pathArray = explode('/', $pFilename);
while (in_array('..', $pathArray) && $pathArray[0] != '..') {
for ($i = 0; $i < count($pathArray); ++$i) {
@ -137,25 +141,32 @@ class PHPExcel_Shared_File
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 (ini_get('upload_tmp_dir') !== false) {
if ($temp = ini_get('upload_tmp_dir')) {
if (file_exists($temp))
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 ((!empty($temp)) && (file_exists($temp))) {
return realpath($temp);
}
}
if ($temp = getenv('TEMP') ) {
if ((!empty($temp)) && (file_exists($temp))) { return realpath($temp); }
if ((!empty($temp)) && (file_exists($temp))) {
return realpath($temp);
}
}
if ($temp = getenv('TMPDIR') ) {
if ((!empty($temp)) && (file_exists($temp))) { return realpath($temp); }
if ((!empty($temp)) && (file_exists($temp))) {
return realpath($temp);
}
}
// trick for creating a file in system's temporary dir
@ -174,5 +185,4 @@ class PHPExcel_Shared_File
// be called if we're running 5.2.1 or earlier
return realpath(sys_get_temp_dir());
}
}

View File

@ -198,8 +198,7 @@ class PHPExcel_Shared_OLE
{
static $isRegistered = false;
if (!$isRegistered) {
stream_wrapper_register('ole-chainedblockstream',
'PHPExcel_Shared_OLE_ChainedBlockStream');
stream_wrapper_register('ole-chainedblockstream', 'PHPExcel_Shared_OLE_ChainedBlockStream');
$isRegistered = true;
}
@ -280,8 +279,7 @@ class PHPExcel_Shared_OLE
$this->root = $pps;
break;
case self::OLE_PPS_TYPE_DIR:
$pps = new PHPExcel_Shared_OLE_PPS(null, null, null, null, null,
null, null, null, null, array());
$pps = new PHPExcel_Shared_OLE_PPS(null, null, null, null, null, null, null, null, null, array());
break;
case self::OLE_PPS_TYPE_FILE:
$pps = new PHPExcel_Shared_OLE_PPS_File($name);
@ -304,9 +302,7 @@ class PHPExcel_Shared_OLE
$this->_list[] = $pps;
// check if the PPS tree (starting from root) is complete
if (isset($this->root) &&
$this->_ppsTreeComplete($this->root->No)) {
if (isset($this->root) && $this->_ppsTreeComplete($this->root->No)) {
break;
}
}
@ -473,8 +469,7 @@ class PHPExcel_Shared_OLE
// days from 1-1-1601 until the beggining of UNIX era
$days = 134774;
// calculate seconds
$big_date = $days*24*3600 + gmmktime(date("H", $date),date("i", $date),date("s", $date),
date("m", $date),date("d", $date),date("Y", $date));
$big_date = $days*24*3600 + gmmktime(date("H", $date), date("i", $date), date("s", $date), date("m", $date), date("d", $date), date("Y", $date));
// multiply just to make MS happy
$big_date *= 10000000;

View File

@ -5689,3 +5689,4 @@
return $p_path;
}
// --------------------------------------------------------------------------------

View File

@ -57,9 +57,10 @@ class PHPExcel_Shared_ZipStreamWrapper {
/**
* Register wrapper
*/
public static function register() {
@stream_wrapper_unregister("zip");
@stream_wrapper_register("zip", __CLASS__);
public static function register()
{
@stream_wrapper_unregister('zip');
@stream_wrapper_register('zip', __CLASS__);
}
/**
@ -71,7 +72,8 @@ class PHPExcel_Shared_ZipStreamWrapper {
* @param string &$openedPath absolute path of the opened stream (out parameter)
* @return bool true on success
*/
public function stream_open($path, $mode, $options, &$opened_path) {
public function stream_open($path, $mode, $options, &$opened_path)
{
// Check for mode
if ($mode{0} != 'r') {
throw new PHPExcel_Reader_Exception('Mode ' . $mode . ' is not supported. Only read mode is supported.');
@ -97,7 +99,8 @@ class PHPExcel_Shared_ZipStreamWrapper {
*
* @return boolean
*/
public function statName() {
public function statName()
{
return $this->_fileNameInArchive;
}
@ -106,7 +109,8 @@ class PHPExcel_Shared_ZipStreamWrapper {
*
* @return boolean
*/
public function url_stat() {
public function url_stat()
{
return $this->statName($this->_fileNameInArchive);
}
@ -115,7 +119,8 @@ class PHPExcel_Shared_ZipStreamWrapper {
*
* @return boolean
*/
public function stream_stat() {
public function stream_stat()
{
return $this->_archive->statName($this->_fileNameInArchive);
}
@ -125,7 +130,8 @@ class PHPExcel_Shared_ZipStreamWrapper {
* @param int $count maximum number of bytes to read
* @return string
*/
function stream_read($count) {
function stream_read($count)
{
$ret = substr($this->_data, $this->_position, $count);
$this->_position += strlen($ret);
return $ret;
@ -137,7 +143,8 @@ class PHPExcel_Shared_ZipStreamWrapper {
*
* @return int
*/
public function stream_tell() {
public function stream_tell()
{
return $this->_position;
}
@ -146,7 +153,8 @@ class PHPExcel_Shared_ZipStreamWrapper {
*
* @return bool
*/
public function stream_eof() {
public function stream_eof()
{
return $this->_position >= strlen($this->_data);
}
@ -157,7 +165,8 @@ class PHPExcel_Shared_ZipStreamWrapper {
* @param int $whence SEEK_SET, SEEK_CUR or SEEK_END
* @return bool
*/
public function stream_seek($offset, $whence) {
public function stream_seek($offset, $whence)
{
switch ($whence) {
case SEEK_SET:
if ($offset < strlen($this->_data) && $offset >= 0) {
@ -167,7 +176,6 @@ class PHPExcel_Shared_ZipStreamWrapper {
return false;
}
break;
case SEEK_CUR:
if ($offset >= 0) {
$this->_position += $offset;
@ -176,7 +184,6 @@ class PHPExcel_Shared_ZipStreamWrapper {
return false;
}
break;
case SEEK_END:
if (strlen($this->_data) + $offset >= 0) {
$this->_position = strlen($this->_data) + $offset;
@ -185,7 +192,6 @@ class PHPExcel_Shared_ZipStreamWrapper {
return false;
}
break;
default:
return false;
}

View File

@ -210,7 +210,6 @@ class PHPExcel_Style extends PHPExcel_Style_Supervisor implements PHPExcel_IComp
{
if (is_array($pStyles)) {
if ($this->isSupervisor) {
$pRange = $this->getSelectedCells();
// Uppercase coordinate

View File

@ -40,7 +40,7 @@ class PHPExcel_Worksheet_AutoFilter
*
* @var PHPExcel_Worksheet
*/
private $_workSheet = NULL;
private $_workSheet = null;
/**
@ -65,7 +65,7 @@ class PHPExcel_Worksheet_AutoFilter
* @param string $pRange Cell range (i.e. A1:E10)
* @param PHPExcel_Worksheet $pSheet
*/
public function __construct($pRange = '', PHPExcel_Worksheet $pSheet = NULL)
public function __construct($pRange = '', PHPExcel_Worksheet $pSheet = null)
{
$this->_range = $pRange;
$this->_workSheet = $pSheet;
@ -76,7 +76,8 @@ class PHPExcel_Worksheet_AutoFilter
*
* @return PHPExcel_Worksheet
*/
public function getParent() {
public function getParent()
{
return $this->_workSheet;
}
@ -86,7 +87,8 @@ class PHPExcel_Worksheet_AutoFilter
* @param PHPExcel_Worksheet $pSheet
* @return PHPExcel_Worksheet_AutoFilter
*/
public function setParent(PHPExcel_Worksheet $pSheet = NULL) {
public function setParent(PHPExcel_Worksheet $pSheet = null)
{
$this->_workSheet = $pSheet;
return $this;
@ -97,7 +99,8 @@ class PHPExcel_Worksheet_AutoFilter
*
* @return string
*/
public function getRange() {
public function getRange()
{
return $this->_range;
}
@ -108,14 +111,15 @@ class PHPExcel_Worksheet_AutoFilter
* @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_AutoFilter
*/
public function setRange($pRange = '') {
public function setRange($pRange = '')
{
// Uppercase coordinate
$cellAddress = explode('!',strtoupper($pRange));
if (count($cellAddress) > 1) {
list($worksheet, $pRange) = $cellAddress;
}
if (strpos($pRange,':') !== FALSE) {
if (strpos($pRange, ':') !== false) {
$this->_range = $pRange;
} elseif (empty($pRange)) {
$this->_range = '';
@ -146,7 +150,8 @@ class PHPExcel_Worksheet_AutoFilter
* @throws PHPExcel_Exception
* @return array of PHPExcel_Worksheet_AutoFilter_Column
*/
public function getColumns() {
public function getColumns()
{
return $this->_columns;
}
@ -157,7 +162,8 @@ class PHPExcel_Worksheet_AutoFilter
* @throws PHPExcel_Exception
* @return integer The column offset within the autofilter range
*/
public function testColumnInRange($column) {
public function testColumnInRange($column)
{
if (empty($this->_range)) {
throw new PHPExcel_Exception("No autofilter range is defined.");
}
@ -178,7 +184,8 @@ class PHPExcel_Worksheet_AutoFilter
* @throws PHPExcel_Exception
* @return integer The offset of the specified column within the autofilter range
*/
public function getColumnOffset($pColumn) {
public function getColumnOffset($pColumn)
{
return $this->testColumnInRange($pColumn);
}
@ -189,7 +196,8 @@ class PHPExcel_Worksheet_AutoFilter
* @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_AutoFilter_Column
*/
public function getColumn($pColumn) {
public function getColumn($pColumn)
{
$this->testColumnInRange($pColumn);
if (!isset($this->_columns[$pColumn])) {
@ -206,7 +214,8 @@ class PHPExcel_Worksheet_AutoFilter
* @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_AutoFilter_Column
*/
public function getColumnByOffset($pColumnOffset = 0) {
public function getColumnByOffset($pColumnOffset = 0)
{
list($rangeStart, $rangeEnd) = PHPExcel_Cell::rangeBoundaries($this->_range);
$pColumn = PHPExcel_Cell::stringFromColumnIndex($rangeStart[0] + $pColumnOffset - 1);
@ -250,7 +259,8 @@ class PHPExcel_Worksheet_AutoFilter
* @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_AutoFilter
*/
public function clearColumn($pColumn) {
public function clearColumn($pColumn)
{
$this->testColumnInRange($pColumn);
if (isset($this->_columns[$pColumn])) {
@ -271,11 +281,12 @@ class PHPExcel_Worksheet_AutoFilter
* @param string $toColumn Column name (e.g. B)
* @return PHPExcel_Worksheet_AutoFilter
*/
public function shiftColumn($fromColumn=NULL, $toColumn=NULL) {
public function shiftColumn($fromColumn = null, $toColumn = null)
{
$fromColumn = strtoupper($fromColumn);
$toColumn = strtoupper($toColumn);
if (($fromColumn !== NULL) && (isset($this->_columns[$fromColumn])) && ($toColumn !== NULL)) {
if (($fromColumn !== null) && (isset($this->_columns[$fromColumn])) && ($toColumn !== null)) {
$this->_columns[$fromColumn]->setParent();
$this->_columns[$fromColumn]->setColumnIndex($toColumn);
$this->_columns[$toColumn] = $this->_columns[$fromColumn];
@ -300,7 +311,7 @@ class PHPExcel_Worksheet_AutoFilter
{
$dataSetValues = $dataSet['filterValues'];
$blanks = $dataSet['blanks'];
if (($cellValue == '') || ($cellValue === NULL)) {
if (($cellValue == '') || ($cellValue === null)) {
return $blanks;
}
return in_array($cellValue, $dataSetValues);
@ -317,7 +328,7 @@ class PHPExcel_Worksheet_AutoFilter
{
$dateSet = $dataSet['filterValues'];
$blanks = $dataSet['blanks'];
if (($cellValue == '') || ($cellValue === NULL)) {
if (($cellValue == '') || ($cellValue === null)) {
return $blanks;
}
@ -338,12 +349,12 @@ class PHPExcel_Worksheet_AutoFilter
}
foreach ($dateSet as $dateValue) {
// Use of substr to extract value at the appropriate group level
if (substr($dtVal,0,strlen($dateValue)) == $dateValue)
return TRUE;
if (substr($dtVal,0,strlen($dateValue)) == $dateValue) {
return true;
}
}
return FALSE;
}
return false;
}
/**
@ -357,12 +368,12 @@ class PHPExcel_Worksheet_AutoFilter
{
$dataSet = $ruleSet['filterRules'];
$join = $ruleSet['join'];
$customRuleForBlanks = isset($ruleSet['customRuleForBlanks']) ? $ruleSet['customRuleForBlanks'] : FALSE;
$customRuleForBlanks = isset($ruleSet['customRuleForBlanks']) ? $ruleSet['customRuleForBlanks'] : false;
if (!$customRuleForBlanks) {
// Blank cells are always ignored, so return a FALSE
if (($cellValue == '') || ($cellValue === NULL)) {
return FALSE;
if (($cellValue == '') || ($cellValue === null)) {
return false;
}
}
$returnVal = ($join == PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND);
@ -392,13 +403,13 @@ class PHPExcel_Worksheet_AutoFilter
} elseif ($rule['value'] == '') {
switch ($rule['operator']) {
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_EQUAL :
$retVal = (($cellValue == '') || ($cellValue === NULL));
$retVal = (($cellValue == '') || ($cellValue === null));
break;
case PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_NOTEQUAL :
$retVal = (($cellValue != '') && ($cellValue !== NULL));
$retVal = (($cellValue != '') && ($cellValue !== null));
break;
default :
$retVal = TRUE;
$retVal = true;
break;
}
} else {
@ -411,8 +422,9 @@ class PHPExcel_Worksheet_AutoFilter
$returnVal = $returnVal || $retVal;
// Break as soon as we have a TRUE match for OR joins,
// to avoid unnecessary additional code execution
if ($returnVal)
if ($returnVal) {
return $returnVal;
}
break;
case PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND :
$returnVal = $returnVal && $retVal;
@ -433,18 +445,18 @@ class PHPExcel_Worksheet_AutoFilter
private static function _filterTestInPeriodDateSet($cellValue, $monthSet)
{
// Blank cells are always ignored, so return a FALSE
if (($cellValue == '') || ($cellValue === NULL)) {
return FALSE;
if (($cellValue == '') || ($cellValue === null)) {
return false;
}
if (is_numeric($cellValue)) {
$dateValue = date('m',PHPExcel_Shared_Date::ExcelToPHP($cellValue));
if (in_array($dateValue, $monthSet)) {
return TRUE;
return true;
}
}
return FALSE;
return false;
}
/**
@ -467,7 +479,7 @@ class PHPExcel_Worksheet_AutoFilter
{
$rDateType = PHPExcel_Calculation_Functions::getReturnDateType();
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC);
$val = $maxVal = NULL;
$val = $maxVal = null;
$ruleValues = array();
$baseDate = PHPExcel_Calculation_DateTime::DATENOW();
@ -555,33 +567,20 @@ class PHPExcel_Worksheet_AutoFilter
}
// Set the filter column rule attributes ready for writing
$filterColumn->setAttributes(array( 'val' => $val,
'maxVal' => $maxVal
)
);
$filterColumn->setAttributes(array('val' => $val, 'maxVal' => $maxVal));
// Set the rules for identifying rows for hide/show
$ruleValues[] = array( 'operator' => PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL,
'value' => $val
);
$ruleValues[] = array( 'operator' => PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_LESSTHAN,
'value' => $maxVal
);
$ruleValues[] = array('operator' => PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL, 'value' => $val);
$ruleValues[] = array('operator' => PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_LESSTHAN, 'value' => $maxVal);
PHPExcel_Calculation_Functions::setReturnDateType($rDateType);
return array(
'method' => '_filterTestInCustomDataSet',
'arguments' => array( 'filterRules' => $ruleValues,
'join' => PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND
)
);
return array('method' => '_filterTestInCustomDataSet', 'arguments' => array('filterRules' => $ruleValues, 'join' => PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_AND));
}
private function _calculateTopTenValue($columnID, $startRow, $endRow, $ruleType, $ruleValue) {
private function _calculateTopTenValue($columnID, $startRow, $endRow, $ruleType, $ruleValue)
{
$range = $columnID.$startRow.':'.$columnID.$endRow;
$dataValues = PHPExcel_Calculation_Functions::flattenArray(
$this->_workSheet->rangeToArray($range,NULL,TRUE,FALSE)
);
$dataValues = PHPExcel_Calculation_Functions::flattenArray($this->_workSheet->rangeToArray($range, null, true, false));
$dataValues = array_filter($dataValues);
if ($ruleType == PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_TOP) {
@ -605,7 +604,7 @@ class PHPExcel_Worksheet_AutoFilter
// The heading row should always be visible
// echo 'AutoFilter Heading Row ', $rangeStart[1],' is always SHOWN',PHP_EOL;
$this->_workSheet->getRowDimension($rangeStart[1])->setVisible(TRUE);
$this->_workSheet->getRowDimension($rangeStart[1])->setVisible(true);
$columnFilterTests = array();
foreach ($this->_columns as $columnID => $filterColumn) {
@ -619,17 +618,15 @@ class PHPExcel_Worksheet_AutoFilter
$ruleValues[] = $rule->getValue();
}
// Test if we want to include blanks in our filter criteria
$blanks = FALSE;
$blanks = false;
$ruleDataSet = array_filter($ruleValues);
if (count($ruleValues) != count($ruleDataSet))
$blanks = TRUE;
$blanks = true;
if ($ruleType == PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_FILTER) {
// Filter on absolute values
$columnFilterTests[$columnID] = array(
'method' => '_filterTestInSimpleDataSet',
'arguments' => array( 'filterValues' => $ruleDataSet,
'blanks' => $blanks
)
'arguments' => array('filterValues' => $ruleDataSet, 'blanks' => $blanks)
);
} else {
// Filter on date group values
@ -669,14 +666,12 @@ class PHPExcel_Worksheet_AutoFilter
$arguments['dateTime'] = array_filter($arguments['dateTime']);
$columnFilterTests[$columnID] = array(
'method' => '_filterTestInDateGroupSet',
'arguments' => array( 'filterValues' => $arguments,
'blanks' => $blanks
)
'arguments' => array('filterValues' => $arguments, 'blanks' => $blanks)
);
}
break;
case PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_CUSTOMFILTER :
$customRuleForBlanks = FALSE;
$customRuleForBlanks = false;
$ruleValues = array();
// Build a list of the filter value selections
foreach ($rules as $rule) {
@ -687,21 +682,16 @@ class PHPExcel_Worksheet_AutoFilter
$ruleValue = preg_quote($ruleValue);
$ruleValue = str_replace(self::$_fromReplace,self::$_toReplace, $ruleValue);
if (trim($ruleValue) == '') {
$customRuleForBlanks = TRUE;
$customRuleForBlanks = true;
$ruleValue = trim($ruleValue);
}
}
$ruleValues[] = array( 'operator' => $rule->getOperator(),
'value' => $ruleValue
);
$ruleValues[] = array('operator' => $rule->getOperator(), 'value' => $ruleValue);
}
$join = $filterColumn->getJoin();
$columnFilterTests[$columnID] = array(
'method' => '_filterTestInCustomDataSet',
'arguments' => array( 'filterRules' => $ruleValues,
'join' => $join,
'customRuleForBlanks' => $customRuleForBlanks
)
'arguments' => array('filterRules' => $ruleValues, 'join' => $join, 'customRuleForBlanks' => $customRuleForBlanks)
);
break;
case PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_FILTERTYPE_DYNAMICFILTER :
@ -714,7 +704,7 @@ class PHPExcel_Worksheet_AutoFilter
// Number (Average) based
// Calculate the average
$averageFormula = '=AVERAGE('.$columnID.($rangeStart[1]+1).':'.$columnID.$rangeEnd[1].')';
$average = PHPExcel_Calculation::getInstance()->calculateFormula($averageFormula,NULL, $this->_workSheet->getCell('A1'));
$average = PHPExcel_Calculation::getInstance()->calculateFormula($averageFormula,null, $this->_workSheet->getCell('A1'));
// Set above/below rule based on greaterThan or LessTan
$operator = ($dynamicRuleType === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DYNAMIC_ABOVEAVERAGE)
? PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_GREATERTHAN
@ -724,9 +714,7 @@ class PHPExcel_Worksheet_AutoFilter
);
$columnFilterTests[$columnID] = array(
'method' => '_filterTestInCustomDataSet',
'arguments' => array( 'filterRules' => $ruleValues,
'join' => PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_OR
)
'arguments' => array('filterRules' => $ruleValues, 'join' => PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_OR)
);
} else {
// Date based
@ -774,18 +762,12 @@ class PHPExcel_Worksheet_AutoFilter
$operator = ($toptenRuleType == PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_TOPTEN_TOP)
? PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_GREATERTHANOREQUAL
: PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_COLUMN_RULE_LESSTHANOREQUAL;
$ruleValues[] = array( 'operator' => $operator,
'value' => $maxVal
);
$ruleValues[] = array('operator' => $operator, 'value' => $maxVal);
$columnFilterTests[$columnID] = array(
'method' => '_filterTestInCustomDataSet',
'arguments' => array( 'filterRules' => $ruleValues,
'join' => PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_OR
)
);
$filterColumn->setAttributes(
array('maxVal' => $maxVal)
'arguments' => array('filterRules' => $ruleValues, 'join' => PHPExcel_Worksheet_AutoFilter_Column::AUTOFILTER_COLUMN_JOIN_OR)
);
$filterColumn->setAttributes(array('maxVal' => $maxVal));
break;
}
}
@ -796,7 +778,7 @@ class PHPExcel_Worksheet_AutoFilter
// Execute the column tests for each row in the autoFilter range to determine show/hide,
for ($row = $rangeStart[1]+1; $row <= $rangeEnd[1]; ++$row) {
// echo 'Testing Row = ', $row,PHP_EOL;
$result = TRUE;
$result = true;
foreach ($columnFilterTests as $columnID => $columnFilterTest) {
// echo 'Testing cell ', $columnID.$row,PHP_EOL;
$cellValue = $this->_workSheet->getCell($columnID.$row)->getCalculatedValue();
@ -805,16 +787,14 @@ class PHPExcel_Worksheet_AutoFilter
$result = $result &&
call_user_func_array(
array('PHPExcel_Worksheet_AutoFilter', $columnFilterTest['method']),
array(
$cellValue,
$columnFilterTest['arguments']
)
array($cellValue, $columnFilterTest['arguments'])
);
// echo (($result) ? 'VALID' : 'INVALID'),PHP_EOL;
// If filter test has resulted in FALSE, exit the loop straightaway rather than running any more tests
if (!$result)
if (!$result) {
break;
}
}
// Set show/hide for the row based on the result of the autoFilter result
// echo (($result) ? 'SHOW' : 'HIDE'),PHP_EOL;
$this->_workSheet->getRowDimension($row)->setVisible($result);
@ -827,13 +807,14 @@ class PHPExcel_Worksheet_AutoFilter
/**
* Implement PHP __clone to create a deep clone, not just a shallow copy.
*/
public function __clone() {
public function __clone()
{
$vars = get_object_vars($this);
foreach ($vars as $key => $value) {
if (is_object($value)) {
if ($key == '_workSheet') {
// Detach from worksheet
$this->{$key} = NULL;
$this->{$key} = null;
} else {
$this->{$key} = clone $value;
}
@ -858,5 +839,4 @@ class PHPExcel_Worksheet_AutoFilter
public function __toString() {
return (string) $this->_range;
}
}

View File

@ -220,7 +220,8 @@ class PHPExcel_Worksheet_AutoFilter_Column
*
* @return string
*/
public function getJoin() {
public function getJoin()
{
return $this->_join;
}
@ -409,5 +410,4 @@ class PHPExcel_Worksheet_AutoFilter_Column
}
}
}
}

View File

@ -267,5 +267,4 @@ class PHPExcel_Worksheet_ColumnDimension
}
}
}
}

View File

@ -59,7 +59,8 @@ class PHPExcel_Worksheet_Drawing extends PHPExcel_Worksheet_BaseDrawing implemen
*
* @return string
*/
public function getFilename() {
public function getFilename()
{
return basename($this->_path);
}
@ -68,7 +69,8 @@ class PHPExcel_Worksheet_Drawing extends PHPExcel_Worksheet_BaseDrawing implemen
*
* @return string
*/
public function getIndexedFilename() {
public function getIndexedFilename()
{
$fileName = $this->getFilename();
$fileName = str_replace(' ', '_', $fileName);
return str_replace('.' . $this->getExtension(), '', $fileName) . $this->getImageIndex() . '.' . $this->getExtension();
@ -79,7 +81,8 @@ class PHPExcel_Worksheet_Drawing extends PHPExcel_Worksheet_BaseDrawing implemen
*
* @return string
*/
public function getExtension() {
public function getExtension()
{
$exploded = explode(".", basename($this->_path));
return $exploded[count($exploded) - 1];
}
@ -89,7 +92,8 @@ class PHPExcel_Worksheet_Drawing extends PHPExcel_Worksheet_BaseDrawing implemen
*
* @return string
*/
public function getPath() {
public function getPath()
{
return $this->_path;
}
@ -101,7 +105,8 @@ class PHPExcel_Worksheet_Drawing extends PHPExcel_Worksheet_BaseDrawing implemen
* @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_Drawing
*/
public function setPath($pValue = '', $pVerifyFile = true) {
public function setPath($pValue = '', $pVerifyFile = true)
{
if ($pVerifyFile) {
if (file_exists($pValue)) {
$this->_path = $pValue;
@ -124,7 +129,8 @@ class PHPExcel_Worksheet_Drawing extends PHPExcel_Worksheet_BaseDrawing implemen
*
* @return string Hash code
*/
public function getHashCode() {
public function getHashCode()
{
return md5(
$this->_path
. parent::getHashCode()
@ -135,7 +141,8 @@ class PHPExcel_Worksheet_Drawing extends PHPExcel_Worksheet_BaseDrawing implemen
/**
* Implement PHP __clone to create a deep clone, not just a shallow copy.
*/
public function __clone() {
public function __clone()
{
$vars = get_object_vars($this);
foreach ($vars as $key => $value) {
if (is_object($value)) {

View File

@ -118,7 +118,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
*
* @return boolean
*/
public function getVisible() {
public function getVisible()
{
return $this->_visible;
}
@ -128,7 +129,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
* @param boolean $pValue
* @return PHPExcel_Worksheet_Drawing_Shadow
*/
public function setVisible($pValue = false) {
public function setVisible($pValue = false)
{
$this->_visible = $pValue;
return $this;
}
@ -138,7 +140,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
*
* @return int
*/
public function getBlurRadius() {
public function getBlurRadius()
{
return $this->_blurRadius;
}
@ -148,7 +151,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
* @param int $pValue
* @return PHPExcel_Worksheet_Drawing_Shadow
*/
public function setBlurRadius($pValue = 6) {
public function setBlurRadius($pValue = 6)
{
$this->_blurRadius = $pValue;
return $this;
}
@ -158,7 +162,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
*
* @return int
*/
public function getDistance() {
public function getDistance()
{
return $this->_distance;
}
@ -168,7 +173,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
* @param int $pValue
* @return PHPExcel_Worksheet_Drawing_Shadow
*/
public function setDistance($pValue = 2) {
public function setDistance($pValue = 2)
{
$this->_distance = $pValue;
return $this;
}
@ -178,7 +184,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
*
* @return int
*/
public function getDirection() {
public function getDirection()
{
return $this->_direction;
}
@ -188,7 +195,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
* @param int $pValue
* @return PHPExcel_Worksheet_Drawing_Shadow
*/
public function setDirection($pValue = 0) {
public function setDirection($pValue = 0)
{
$this->_direction = $pValue;
return $this;
}
@ -198,7 +206,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
*
* @return int
*/
public function getAlignment() {
public function getAlignment()
{
return $this->_alignment;
}
@ -208,7 +217,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
* @param int $pValue
* @return PHPExcel_Worksheet_Drawing_Shadow
*/
public function setAlignment($pValue = 0) {
public function setAlignment($pValue = 0)
{
$this->_alignment = $pValue;
return $this;
}
@ -218,7 +228,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
*
* @return PHPExcel_Style_Color
*/
public function getColor() {
public function getColor()
{
return $this->_color;
}
@ -229,7 +240,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
* @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_Drawing_Shadow
*/
public function setColor(PHPExcel_Style_Color $pValue = null) {
public function setColor(PHPExcel_Style_Color $pValue = null)
{
$this->_color = $pValue;
return $this;
}
@ -239,7 +251,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
*
* @return int
*/
public function getAlpha() {
public function getAlpha()
{
return $this->_alpha;
}
@ -249,7 +262,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
* @param int $pValue
* @return PHPExcel_Worksheet_Drawing_Shadow
*/
public function setAlpha($pValue = 0) {
public function setAlpha($pValue = 0)
{
$this->_alpha = $pValue;
return $this;
}
@ -259,7 +273,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
*
* @return string Hash code
*/
public function getHashCode() {
public function getHashCode()
{
return md5(
($this->_visible ? 't' : 'f')
. $this->_blurRadius
@ -275,7 +290,8 @@ class PHPExcel_Worksheet_Drawing_Shadow implements PHPExcel_IComparable
/**
* Implement PHP __clone to create a deep clone, not just a shallow copy.
*/
public function __clone() {
public function __clone()
{
$vars = get_object_vars($this);
foreach ($vars as $key => $value) {
if (is_object($value)) {

View File

@ -15,7 +15,7 @@
* 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
* License along with this library; if not,241 write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* @category PHPExcel
@ -192,7 +192,8 @@ class PHPExcel_Worksheet_HeaderFooter
*
* @return string
*/
public function getOddHeader() {
public function getOddHeader()
{
return $this->_oddHeader;
}
@ -202,7 +203,8 @@ class PHPExcel_Worksheet_HeaderFooter
* @param string $pValue
* @return PHPExcel_Worksheet_HeaderFooter
*/
public function setOddHeader($pValue) {
public function setOddHeader($pValue)
{
$this->_oddHeader = $pValue;
return $this;
}
@ -212,7 +214,8 @@ class PHPExcel_Worksheet_HeaderFooter
*
* @return string
*/
public function getOddFooter() {
public function getOddFooter()
{
return $this->_oddFooter;
}
@ -222,7 +225,8 @@ class PHPExcel_Worksheet_HeaderFooter
* @param string $pValue
* @return PHPExcel_Worksheet_HeaderFooter
*/
public function setOddFooter($pValue) {
public function setOddFooter($pValue)
{
$this->_oddFooter = $pValue;
return $this;
}
@ -232,7 +236,8 @@ class PHPExcel_Worksheet_HeaderFooter
*
* @return string
*/
public function getEvenHeader() {
public function getEvenHeader()
{
return $this->_evenHeader;
}
@ -242,7 +247,8 @@ class PHPExcel_Worksheet_HeaderFooter
* @param string $pValue
* @return PHPExcel_Worksheet_HeaderFooter
*/
public function setEvenHeader($pValue) {
public function setEvenHeader($pValue)
{
$this->_evenHeader = $pValue;
return $this;
}
@ -252,7 +258,8 @@ class PHPExcel_Worksheet_HeaderFooter
*
* @return string
*/
public function getEvenFooter() {
public function getEvenFooter()
{
return $this->_evenFooter;
}
@ -262,7 +269,8 @@ class PHPExcel_Worksheet_HeaderFooter
* @param string $pValue
* @return PHPExcel_Worksheet_HeaderFooter
*/
public function setEvenFooter($pValue) {
public function setEvenFooter($pValue)
{
$this->_evenFooter = $pValue;
return $this;
}
@ -272,7 +280,8 @@ class PHPExcel_Worksheet_HeaderFooter
*
* @return string
*/
public function getFirstHeader() {
public function getFirstHeader()
{
return $this->_firstHeader;
}
@ -282,7 +291,8 @@ class PHPExcel_Worksheet_HeaderFooter
* @param string $pValue
* @return PHPExcel_Worksheet_HeaderFooter
*/
public function setFirstHeader($pValue) {
public function setFirstHeader($pValue)
{
$this->_firstHeader = $pValue;
return $this;
}
@ -292,7 +302,8 @@ class PHPExcel_Worksheet_HeaderFooter
*
* @return string
*/
public function getFirstFooter() {
public function getFirstFooter()
{
return $this->_firstFooter;
}
@ -302,7 +313,8 @@ class PHPExcel_Worksheet_HeaderFooter
* @param string $pValue
* @return PHPExcel_Worksheet_HeaderFooter
*/
public function setFirstFooter($pValue) {
public function setFirstFooter($pValue)
{
$this->_firstFooter = $pValue;
return $this;
}
@ -312,7 +324,8 @@ class PHPExcel_Worksheet_HeaderFooter
*
* @return boolean
*/
public function getDifferentOddEven() {
public function getDifferentOddEven()
{
return $this->_differentOddEven;
}
@ -322,7 +335,8 @@ class PHPExcel_Worksheet_HeaderFooter
* @param boolean $pValue
* @return PHPExcel_Worksheet_HeaderFooter
*/
public function setDifferentOddEven($pValue = false) {
public function setDifferentOddEven($pValue = false)
{
$this->_differentOddEven = $pValue;
return $this;
}
@ -332,7 +346,8 @@ class PHPExcel_Worksheet_HeaderFooter
*
* @return boolean
*/
public function getDifferentFirst() {
public function getDifferentFirst()
{
return $this->_differentFirst;
}
@ -342,7 +357,8 @@ class PHPExcel_Worksheet_HeaderFooter
* @param boolean $pValue
* @return PHPExcel_Worksheet_HeaderFooter
*/
public function setDifferentFirst($pValue = false) {
public function setDifferentFirst($pValue = false)
{
$this->_differentFirst = $pValue;
return $this;
}
@ -352,7 +368,8 @@ class PHPExcel_Worksheet_HeaderFooter
*
* @return boolean
*/
public function getScaleWithDocument() {
public function getScaleWithDocument()
{
return $this->_scaleWithDocument;
}
@ -362,7 +379,8 @@ class PHPExcel_Worksheet_HeaderFooter
* @param boolean $pValue
* @return PHPExcel_Worksheet_HeaderFooter
*/
public function setScaleWithDocument($pValue = true) {
public function setScaleWithDocument($pValue = true)
{
$this->_scaleWithDocument = $pValue;
return $this;
}
@ -372,7 +390,8 @@ class PHPExcel_Worksheet_HeaderFooter
*
* @return boolean
*/
public function getAlignWithMargins() {
public function getAlignWithMargins()
{
return $this->_alignWithMargins;
}
@ -382,7 +401,8 @@ class PHPExcel_Worksheet_HeaderFooter
* @param boolean $pValue
* @return PHPExcel_Worksheet_HeaderFooter
*/
public function setAlignWithMargins($pValue = true) {
public function setAlignWithMargins($pValue = true)
{
$this->_alignWithMargins = $pValue;
return $this;
}
@ -395,7 +415,8 @@ class PHPExcel_Worksheet_HeaderFooter
* @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_HeaderFooter
*/
public function addImage(PHPExcel_Worksheet_HeaderFooterDrawing $image = null, $location = self::IMAGE_HEADER_LEFT) {
public function addImage(PHPExcel_Worksheet_HeaderFooterDrawing $image = null, $location = self::IMAGE_HEADER_LEFT)
{
$this->_headerFooterImages[$location] = $image;
return $this;
}
@ -407,7 +428,8 @@ class PHPExcel_Worksheet_HeaderFooter
* @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_HeaderFooter
*/
public function removeImage($location = self::IMAGE_HEADER_LEFT) {
public function removeImage($location = self::IMAGE_HEADER_LEFT)
{
if (isset($this->_headerFooterImages[$location])) {
unset($this->_headerFooterImages[$location]);
}
@ -421,7 +443,8 @@ class PHPExcel_Worksheet_HeaderFooter
* @throws PHPExcel_Exception
* @return PHPExcel_Worksheet_HeaderFooter
*/
public function setImages($images) {
public function setImages($images)
{
if (!is_array($images)) {
throw new PHPExcel_Exception('Invalid parameter!');
}
@ -435,15 +458,28 @@ class PHPExcel_Worksheet_HeaderFooter
*
* @return PHPExcel_Worksheet_HeaderFooterDrawing[]
*/
public function getImages() {
public function getImages()
{
// Sort array
$images = array();
if (isset($this->_headerFooterImages[self::IMAGE_HEADER_LEFT])) $images[self::IMAGE_HEADER_LEFT] = $this->_headerFooterImages[self::IMAGE_HEADER_LEFT];
if (isset($this->_headerFooterImages[self::IMAGE_HEADER_CENTER])) $images[self::IMAGE_HEADER_CENTER] = $this->_headerFooterImages[self::IMAGE_HEADER_CENTER];
if (isset($this->_headerFooterImages[self::IMAGE_HEADER_RIGHT])) $images[self::IMAGE_HEADER_RIGHT] = $this->_headerFooterImages[self::IMAGE_HEADER_RIGHT];
if (isset($this->_headerFooterImages[self::IMAGE_FOOTER_LEFT])) $images[self::IMAGE_FOOTER_LEFT] = $this->_headerFooterImages[self::IMAGE_FOOTER_LEFT];
if (isset($this->_headerFooterImages[self::IMAGE_FOOTER_CENTER])) $images[self::IMAGE_FOOTER_CENTER] = $this->_headerFooterImages[self::IMAGE_FOOTER_CENTER];
if (isset($this->_headerFooterImages[self::IMAGE_FOOTER_RIGHT])) $images[self::IMAGE_FOOTER_RIGHT] = $this->_headerFooterImages[self::IMAGE_FOOTER_RIGHT];
if (isset($this->_headerFooterImages[self::IMAGE_HEADER_LEFT])) {
$images[self::IMAGE_HEADER_LEFT] = $this->_headerFooterImages[self::IMAGE_HEADER_LEFT];
}
if (isset($this->_headerFooterImages[self::IMAGE_HEADER_CENTER])) {
$images[self::IMAGE_HEADER_CENTER] = $this->_headerFooterImages[self::IMAGE_HEADER_CENTER];
}
if (isset($this->_headerFooterImages[self::IMAGE_HEADER_RIGHT])) {
$images[self::IMAGE_HEADER_RIGHT] = $this->_headerFooterImages[self::IMAGE_HEADER_RIGHT];
}
if (isset($this->_headerFooterImages[self::IMAGE_FOOTER_LEFT])) {
$images[self::IMAGE_FOOTER_LEFT] = $this->_headerFooterImages[self::IMAGE_FOOTER_LEFT];
}
if (isset($this->_headerFooterImages[self::IMAGE_FOOTER_CENTER])) {
$images[self::IMAGE_FOOTER_CENTER] = $this->_headerFooterImages[self::IMAGE_FOOTER_CENTER];
}
if (isset($this->_headerFooterImages[self::IMAGE_FOOTER_RIGHT])) {
$images[self::IMAGE_FOOTER_RIGHT] = $this->_headerFooterImages[self::IMAGE_FOOTER_RIGHT];
}
$this->_headerFooterImages = $images;
return $this->_headerFooterImages;
@ -452,7 +488,8 @@ class PHPExcel_Worksheet_HeaderFooter
/**
* Implement PHP __clone to create a deep clone, not just a shallow copy.
*/
public function __clone() {
public function __clone()
{
$vars = get_object_vars($this);
foreach ($vars as $key => $value) {
if (is_object($value)) {

View File

@ -195,7 +195,8 @@ class PHPExcel_Worksheet_MemoryDrawing extends PHPExcel_Worksheet_BaseDrawing im
/**
* Implement PHP __clone to create a deep clone, not just a shallow copy.
*/
public function __clone() {
public function __clone()
{
$vars = get_object_vars($this);
foreach ($vars as $key => $value) {
if (is_object($value)) {

View File

@ -214,7 +214,7 @@ class PHPExcel_Worksheet_PageSetup
*
* @var boolean
*/
private $_fitToPage = FALSE;
private $_fitToPage = false;
/**
* Fit To Height
@ -251,28 +251,28 @@ class PHPExcel_Worksheet_PageSetup
*
* @var boolean
*/
private $_horizontalCentered = FALSE;
private $_horizontalCentered = false;
/**
* Center page vertically
*
* @var boolean
*/
private $_verticalCentered = FALSE;
private $_verticalCentered = false;
/**
* Print area
*
* @var string
*/
private $_printArea = NULL;
private $_printArea = null;
/**
* First page number
*
* @var int
*/
private $_firstPageNumber = NULL;
private $_firstPageNumber = null;
/**
* Create a new PHPExcel_Worksheet_PageSetup
@ -286,7 +286,8 @@ class PHPExcel_Worksheet_PageSetup
*
* @return int
*/
public function getPaperSize() {
public function getPaperSize()
{
return $this->_paperSize;
}
@ -296,7 +297,8 @@ class PHPExcel_Worksheet_PageSetup
* @param int $pValue
* @return PHPExcel_Worksheet_PageSetup
*/
public function setPaperSize($pValue = PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER) {
public function setPaperSize($pValue = PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER)
{
$this->_paperSize = $pValue;
return $this;
}
@ -306,7 +308,8 @@ class PHPExcel_Worksheet_PageSetup
*
* @return string
*/
public function getOrientation() {
public function getOrientation()
{
return $this->_orientation;
}
@ -316,7 +319,8 @@ class PHPExcel_Worksheet_PageSetup
* @param string $pValue
* @return PHPExcel_Worksheet_PageSetup
*/
public function setOrientation($pValue = PHPExcel_Worksheet_PageSetup::ORIENTATION_DEFAULT) {
public function setOrientation($pValue = PHPExcel_Worksheet_PageSetup::ORIENTATION_DEFAULT)
{
$this->_orientation = $pValue;
return $this;
}
@ -326,7 +330,8 @@ class PHPExcel_Worksheet_PageSetup
*
* @return int?
*/
public function getScale() {
public function getScale()
{
return $this->_scale;
}
@ -341,7 +346,8 @@ class PHPExcel_Worksheet_PageSetup
* @return PHPExcel_Worksheet_PageSetup
* @throws PHPExcel_Exception
*/
public function setScale($pValue = 100, $pUpdate = true) {
public function setScale($pValue = 100, $pUpdate = true)
{
// Microsoft Office Excel 2007 only allows setting a scale between 10 and 400 via the user interface,
// but it is apparently still able to handle any scale >= 0, where 0 results in 100
if (($pValue >= 0) || is_null($pValue)) {
@ -370,7 +376,8 @@ class PHPExcel_Worksheet_PageSetup
* @param boolean $pValue
* @return PHPExcel_Worksheet_PageSetup
*/
public function setFitToPage($pValue = TRUE) {
public function setFitToPage($pValue = true)
{
$this->_fitToPage = $pValue;
return $this;
}
@ -380,7 +387,8 @@ class PHPExcel_Worksheet_PageSetup
*
* @return int?
*/
public function getFitToHeight() {
public function getFitToHeight()
{
return $this->_fitToHeight;
}
@ -391,10 +399,11 @@ class PHPExcel_Worksheet_PageSetup
* @param boolean $pUpdate Update fitToPage so it applies rather than scaling
* @return PHPExcel_Worksheet_PageSetup
*/
public function setFitToHeight($pValue = 1, $pUpdate = TRUE) {
public function setFitToHeight($pValue = 1, $pUpdate = true)
{
$this->_fitToHeight = $pValue;
if ($pUpdate) {
$this->_fitToPage = TRUE;
$this->_fitToPage = true;
}
return $this;
}
@ -404,7 +413,8 @@ class PHPExcel_Worksheet_PageSetup
*
* @return int?
*/
public function getFitToWidth() {
public function getFitToWidth()
{
return $this->_fitToWidth;
}
@ -415,10 +425,11 @@ class PHPExcel_Worksheet_PageSetup
* @param boolean $pUpdate Update fitToPage so it applies rather than scaling
* @return PHPExcel_Worksheet_PageSetup
*/
public function setFitToWidth($pValue = 1, $pUpdate = TRUE) {
public function setFitToWidth($pValue = 1, $pUpdate = true)
{
$this->_fitToWidth = $pValue;
if ($pUpdate) {
$this->_fitToPage = TRUE;
$this->_fitToPage = true;
}
return $this;
}
@ -428,7 +439,8 @@ class PHPExcel_Worksheet_PageSetup
*
* @return boolean
*/
public function isColumnsToRepeatAtLeftSet() {
public function isColumnsToRepeatAtLeftSet()
{
if (is_array($this->_columnsToRepeatAtLeft)) {
if ($this->_columnsToRepeatAtLeft[0] != '' && $this->_columnsToRepeatAtLeft[1] != '') {
return true;
@ -443,7 +455,8 @@ class PHPExcel_Worksheet_PageSetup
*
* @return array Containing start column and end column, empty array if option unset
*/
public function getColumnsToRepeatAtLeft() {
public function getColumnsToRepeatAtLeft()
{
return $this->_columnsToRepeatAtLeft;
}
@ -453,7 +466,8 @@ class PHPExcel_Worksheet_PageSetup
* @param array $pValue Containing start column and end column, empty array if option unset
* @return PHPExcel_Worksheet_PageSetup
*/
public function setColumnsToRepeatAtLeft($pValue = null) {
public function setColumnsToRepeatAtLeft($pValue = null)
{
if (is_array($pValue)) {
$this->_columnsToRepeatAtLeft = $pValue;
}
@ -467,7 +481,8 @@ class PHPExcel_Worksheet_PageSetup
* @param string $pEnd
* @return PHPExcel_Worksheet_PageSetup
*/
public function setColumnsToRepeatAtLeftByStartAndEnd($pStart = 'A', $pEnd = 'A') {
public function setColumnsToRepeatAtLeftByStartAndEnd($pStart = 'A', $pEnd = 'A')
{
$this->_columnsToRepeatAtLeft = array($pStart, $pEnd);
return $this;
}
@ -477,7 +492,8 @@ class PHPExcel_Worksheet_PageSetup
*
* @return boolean
*/
public function isRowsToRepeatAtTopSet() {
public function isRowsToRepeatAtTopSet()
{
if (is_array($this->_rowsToRepeatAtTop)) {
if ($this->_rowsToRepeatAtTop[0] != 0 && $this->_rowsToRepeatAtTop[1] != 0) {
return true;
@ -492,7 +508,8 @@ class PHPExcel_Worksheet_PageSetup
*
* @return array Containing start column and end column, empty array if option unset
*/
public function getRowsToRepeatAtTop() {
public function getRowsToRepeatAtTop()
{
return $this->_rowsToRepeatAtTop;
}
@ -502,7 +519,8 @@ class PHPExcel_Worksheet_PageSetup
* @param array $pValue Containing start column and end column, empty array if option unset
* @return PHPExcel_Worksheet_PageSetup
*/
public function setRowsToRepeatAtTop($pValue = null) {
public function setRowsToRepeatAtTop($pValue = null)
{
if (is_array($pValue)) {
$this->_rowsToRepeatAtTop = $pValue;
}
@ -516,7 +534,8 @@ class PHPExcel_Worksheet_PageSetup
* @param int $pEnd
* @return PHPExcel_Worksheet_PageSetup
*/
public function setRowsToRepeatAtTopByStartAndEnd($pStart = 1, $pEnd = 1) {
public function setRowsToRepeatAtTopByStartAndEnd($pStart = 1, $pEnd = 1)
{
$this->_rowsToRepeatAtTop = array($pStart, $pEnd);
return $this;
}
@ -526,7 +545,8 @@ class PHPExcel_Worksheet_PageSetup
*
* @return bool
*/
public function getHorizontalCentered() {
public function getHorizontalCentered()
{
return $this->_horizontalCentered;
}
@ -536,7 +556,8 @@ class PHPExcel_Worksheet_PageSetup
* @param bool $value
* @return PHPExcel_Worksheet_PageSetup
*/
public function setHorizontalCentered($value = false) {
public function setHorizontalCentered($value = false)
{
$this->_horizontalCentered = $value;
return $this;
}
@ -546,7 +567,8 @@ class PHPExcel_Worksheet_PageSetup
*
* @return bool
*/
public function getVerticalCentered() {
public function getVerticalCentered()
{
return $this->_verticalCentered;
}
@ -556,7 +578,8 @@ class PHPExcel_Worksheet_PageSetup
* @param bool $value
* @return PHPExcel_Worksheet_PageSetup
*/
public function setVerticalCentered($value = false) {
public function setVerticalCentered($value = false)
{
$this->_verticalCentered = $value;
return $this;
}
@ -571,7 +594,8 @@ class PHPExcel_Worksheet_PageSetup
* @throws PHPExcel_Exception
* @return string
*/
public function getPrintArea($index = 0) {
public function getPrintArea($index = 0)
{
if ($index == 0) {
return $this->_printArea;
}
@ -591,7 +615,8 @@ class PHPExcel_Worksheet_PageSetup
* Print areas are numbered from 1
* @return boolean
*/
public function isPrintAreaSet($index = 0) {
public function isPrintAreaSet($index = 0)
{
if ($index == 0) {
return !is_null($this->_printArea);
}
@ -608,9 +633,10 @@ class PHPExcel_Worksheet_PageSetup
* Print areas are numbered from 1
* @return PHPExcel_Worksheet_PageSetup
*/
public function clearPrintArea($index = 0) {
public function clearPrintArea($index = 0)
{
if ($index == 0) {
$this->_printArea = NULL;
$this->_printArea = null;
} else {
$printAreas = explode(',', $this->_printArea);
if (isset($printAreas[$index-1])) {
@ -642,7 +668,8 @@ class PHPExcel_Worksheet_PageSetup
* @return PHPExcel_Worksheet_PageSetup
* @throws PHPExcel_Exception
*/
public function setPrintArea($value, $index = 0, $method = self::SETPRINTRANGE_OVERWRITE) {
public function setPrintArea($value, $index = 0, $method = self::SETPRINTRANGE_OVERWRITE)
{
if (strpos($value, '!') !== false) {
throw new PHPExcel_Exception('Cell coordinate must not specify a worksheet.');
} elseif (strpos($value, ':') === false) {
@ -700,7 +727,8 @@ class PHPExcel_Worksheet_PageSetup
* @return PHPExcel_Worksheet_PageSetup
* @throws PHPExcel_Exception
*/
public function addPrintArea($value, $index = -1) {
public function addPrintArea($value, $index = -1)
{
return $this->setPrintArea($value, $index, self::SETPRINTRANGE_INSERT);
}
@ -758,7 +786,8 @@ class PHPExcel_Worksheet_PageSetup
*
* @return int
*/
public function getFirstPageNumber() {
public function getFirstPageNumber()
{
return $this->_firstPageNumber;
}
@ -768,7 +797,8 @@ class PHPExcel_Worksheet_PageSetup
* @param int $value
* @return PHPExcel_Worksheet_HeaderFooter
*/
public function setFirstPageNumber($value = null) {
public function setFirstPageNumber($value = null)
{
$this->_firstPageNumber = $value;
return $this;
}
@ -778,14 +808,16 @@ class PHPExcel_Worksheet_PageSetup
*
* @return PHPExcel_Worksheet_HeaderFooter
*/
public function resetFirstPageNumber() {
public function resetFirstPageNumber()
{
return $this->setFirstPageNumber(null);
}
/**
* Implement PHP __clone to create a deep clone, not just a shallow copy.
*/
public function __clone() {
public function __clone()
{
$vars = get_object_vars($this);
foreach ($vars as $key => $value) {
if (is_object($value)) {

View File

@ -166,7 +166,8 @@ class PHPExcel_Worksheet_Protection
*
* @return boolean
*/
function isProtectionEnabled() {
function isProtectionEnabled()
{
return $this->_sheet ||
$this->_objects ||
$this->_scenarios ||
@ -190,7 +191,8 @@ class PHPExcel_Worksheet_Protection
*
* @return boolean
*/
function getSheet() {
function getSheet()
{
return $this->_sheet;
}
@ -200,7 +202,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setSheet($pValue = false) {
function setSheet($pValue = false)
{
$this->_sheet = $pValue;
return $this;
}
@ -210,7 +213,8 @@ class PHPExcel_Worksheet_Protection
*
* @return boolean
*/
function getObjects() {
function getObjects()
{
return $this->_objects;
}
@ -220,7 +224,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setObjects($pValue = false) {
function setObjects($pValue = false)
{
$this->_objects = $pValue;
return $this;
}
@ -230,7 +235,8 @@ class PHPExcel_Worksheet_Protection
*
* @return boolean
*/
function getScenarios() {
function getScenarios()
{
return $this->_scenarios;
}
@ -240,7 +246,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setScenarios($pValue = false) {
function setScenarios($pValue = false)
{
$this->_scenarios = $pValue;
return $this;
}
@ -250,7 +257,8 @@ class PHPExcel_Worksheet_Protection
*
* @return boolean
*/
function getFormatCells() {
function getFormatCells()
{
return $this->_formatCells;
}
@ -260,7 +268,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setFormatCells($pValue = false) {
function setFormatCells($pValue = false)
{
$this->_formatCells = $pValue;
return $this;
}
@ -270,7 +279,8 @@ class PHPExcel_Worksheet_Protection
*
* @return boolean
*/
function getFormatColumns() {
function getFormatColumns()
{
return $this->_formatColumns;
}
@ -280,7 +290,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setFormatColumns($pValue = false) {
function setFormatColumns($pValue = false)
{
$this->_formatColumns = $pValue;
return $this;
}
@ -290,7 +301,8 @@ class PHPExcel_Worksheet_Protection
*
* @return boolean
*/
function getFormatRows() {
function getFormatRows()
{
return $this->_formatRows;
}
@ -300,7 +312,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setFormatRows($pValue = false) {
function setFormatRows($pValue = false)
{
$this->_formatRows = $pValue;
return $this;
}
@ -310,7 +323,8 @@ class PHPExcel_Worksheet_Protection
*
* @return boolean
*/
function getInsertColumns() {
function getInsertColumns()
{
return $this->_insertColumns;
}
@ -320,7 +334,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setInsertColumns($pValue = false) {
function setInsertColumns($pValue = false)
{
$this->_insertColumns = $pValue;
return $this;
}
@ -330,7 +345,8 @@ class PHPExcel_Worksheet_Protection
*
* @return boolean
*/
function getInsertRows() {
function getInsertRows()
{
return $this->_insertRows;
}
@ -340,7 +356,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setInsertRows($pValue = false) {
function setInsertRows($pValue = false)
{
$this->_insertRows = $pValue;
return $this;
}
@ -350,7 +367,8 @@ class PHPExcel_Worksheet_Protection
*
* @return boolean
*/
function getInsertHyperlinks() {
function getInsertHyperlinks()
{
return $this->_insertHyperlinks;
}
@ -360,7 +378,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setInsertHyperlinks($pValue = false) {
function setInsertHyperlinks($pValue = false)
{
$this->_insertHyperlinks = $pValue;
return $this;
}
@ -370,7 +389,8 @@ class PHPExcel_Worksheet_Protection
*
* @return boolean
*/
function getDeleteColumns() {
function getDeleteColumns()
{
return $this->_deleteColumns;
}
@ -380,7 +400,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setDeleteColumns($pValue = false) {
function setDeleteColumns($pValue = false)
{
$this->_deleteColumns = $pValue;
return $this;
}
@ -390,7 +411,8 @@ class PHPExcel_Worksheet_Protection
*
* @return boolean
*/
function getDeleteRows() {
function getDeleteRows()
{
return $this->_deleteRows;
}
@ -400,7 +422,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setDeleteRows($pValue = false) {
function setDeleteRows($pValue = false)
{
$this->_deleteRows = $pValue;
return $this;
}
@ -410,7 +433,8 @@ class PHPExcel_Worksheet_Protection
*
* @return boolean
*/
function getSelectLockedCells() {
function getSelectLockedCells()
{
return $this->_selectLockedCells;
}
@ -420,7 +444,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setSelectLockedCells($pValue = false) {
function setSelectLockedCells($pValue = false)
{
$this->_selectLockedCells = $pValue;
return $this;
}
@ -430,7 +455,8 @@ class PHPExcel_Worksheet_Protection
*
* @return boolean
*/
function getSort() {
function getSort()
{
return $this->_sort;
}
@ -440,7 +466,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setSort($pValue = false) {
function setSort($pValue = false)
{
$this->_sort = $pValue;
return $this;
}
@ -450,7 +477,8 @@ class PHPExcel_Worksheet_Protection
*
* @return boolean
*/
function getAutoFilter() {
function getAutoFilter()
{
return $this->_autoFilter;
}
@ -460,7 +488,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setAutoFilter($pValue = false) {
function setAutoFilter($pValue = false)
{
$this->_autoFilter = $pValue;
return $this;
}
@ -470,7 +499,8 @@ class PHPExcel_Worksheet_Protection
*
* @return boolean
*/
function getPivotTables() {
function getPivotTables()
{
return $this->_pivotTables;
}
@ -480,7 +510,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setPivotTables($pValue = false) {
function setPivotTables($pValue = false)
{
$this->_pivotTables = $pValue;
return $this;
}
@ -490,7 +521,8 @@ class PHPExcel_Worksheet_Protection
*
* @return boolean
*/
function getSelectUnlockedCells() {
function getSelectUnlockedCells()
{
return $this->_selectUnlockedCells;
}
@ -500,7 +532,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pValue
* @return PHPExcel_Worksheet_Protection
*/
function setSelectUnlockedCells($pValue = false) {
function setSelectUnlockedCells($pValue = false)
{
$this->_selectUnlockedCells = $pValue;
return $this;
}
@ -510,7 +543,8 @@ class PHPExcel_Worksheet_Protection
*
* @return string
*/
function getPassword() {
function getPassword()
{
return $this->_password;
}
@ -521,7 +555,8 @@ class PHPExcel_Worksheet_Protection
* @param boolean $pAlreadyHashed If the password has already been hashed, set this to true
* @return PHPExcel_Worksheet_Protection
*/
function setPassword($pValue = '', $pAlreadyHashed = false) {
function setPassword($pValue = '', $pAlreadyHashed = false)
{
if (!$pAlreadyHashed) {
$pValue = PHPExcel_Shared_PasswordHasher::hashPassword($pValue);
}
@ -532,7 +567,8 @@ class PHPExcel_Worksheet_Protection
/**
* Implement PHP __clone to create a deep clone, not just a shallow copy.
*/
public function __clone() {
public function __clone()
{
$vars = get_object_vars($this);
foreach ($vars as $key => $value) {
if (is_object($value)) {

View File

@ -65,7 +65,8 @@ abstract class PHPExcel_Writer_Abstract implements PHPExcel_Writer_IWriter
*
* @return boolean
*/
public function getIncludeCharts() {
public function getIncludeCharts()
{
return $this->_includeCharts;
}
@ -93,7 +94,8 @@ abstract class PHPExcel_Writer_Abstract implements PHPExcel_Writer_IWriter
*
* @return boolean
*/
public function getPreCalculateFormulas() {
public function getPreCalculateFormulas()
{
return $this->_preCalculateFormulas;
}
@ -105,7 +107,8 @@ abstract class PHPExcel_Writer_Abstract implements PHPExcel_Writer_IWriter
* @param boolean $pValue Pre-Calculate Formulas?
* @return PHPExcel_Writer_IWriter
*/
public function setPreCalculateFormulas($pValue = TRUE) {
public function setPreCalculateFormulas($pValue = true)
{
$this->_preCalculateFormulas = (boolean) $pValue;
return $this;
}
@ -115,7 +118,8 @@ abstract class PHPExcel_Writer_Abstract implements PHPExcel_Writer_IWriter
*
* @return boolean
*/
public function getUseDiskCaching() {
public function getUseDiskCaching()
{
return $this->_useDiskCaching;
}
@ -127,10 +131,11 @@ abstract class PHPExcel_Writer_Abstract implements PHPExcel_Writer_IWriter
* @throws PHPExcel_Writer_Exception when directory does not exist
* @return PHPExcel_Writer_Excel2007
*/
public function setUseDiskCaching($pValue = FALSE, $pDirectory = NULL) {
public function setUseDiskCaching($pValue = false, $pDirectory = null)
{
$this->_useDiskCaching = $pValue;
if ($pDirectory !== NULL) {
if ($pDirectory !== null) {
if (is_dir($pDirectory)) {
$this->_diskCachingDirectory = $pDirectory;
} else {
@ -145,7 +150,8 @@ abstract class PHPExcel_Writer_Abstract implements PHPExcel_Writer_IWriter
*
* @return string
*/
public function getDiskCachingDirectory() {
public function getDiskCachingDirectory()
{
return $this->_diskCachingDirectory;
}
}

View File

@ -32,7 +32,8 @@
* @package PHPExcel_Writer_Excel2007
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
*/
class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPart {
class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPart
{
/**
* Write charts to XML format
*
@ -41,7 +42,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
* @return string XML Output
* @throws PHPExcel_Writer_Exception
*/
public function writeChart(PHPExcel_Chart $pChart = null) {
public function writeChart(PHPExcel_Chart $pChart = null)
{
// Create XML writer
$objWriter = null;
if ($this->getParentWriter()->getUseDiskCaching()) {
@ -115,7 +117,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
*
* @throws PHPExcel_Writer_Exception
*/
private function _writeTitle(PHPExcel_Chart_Title $title = null, $objWriter) {
private function _writeTitle(PHPExcel_Chart_Title $title = null, $objWriter)
{
if (is_null($title)) {
return;
}
@ -159,7 +162,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
*
* @throws PHPExcel_Writer_Exception
*/
private function _writeLegend(PHPExcel_Chart_Legend $legend = null, $objWriter) {
private function _writeLegend(PHPExcel_Chart_Legend $legend = null, $objWriter)
{
if (is_null($legend)) {
return;
}
@ -349,7 +353,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
*
* @throws PHPExcel_Writer_Exception
*/
private function _writeDataLbls($objWriter, $chartLayout) {
private function _writeDataLbls($objWriter, $chartLayout)
{
$objWriter->startElement('c:dLbls');
$objWriter->startElement('c:showLegendKey');
@ -403,7 +408,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
*
* @throws PHPExcel_Writer_Exception
*/
private function _writeCatAx($objWriter, PHPExcel_Chart_PlotArea $plotArea, $xAxisLabel, $groupType, $id1, $id2, $isMultiLevelSeries, $xAxis, $yAxis) {
private function _writeCatAx($objWriter, PHPExcel_Chart_PlotArea $plotArea, $xAxisLabel, $groupType, $id1, $id2, $isMultiLevelSeries, $xAxis, $yAxis)
{
$objWriter->startElement('c:catAx');
if ($id1 > 0) {
@ -524,7 +530,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
*
* @throws PHPExcel_Writer_Exception
*/
private function _writeValAx($objWriter, PHPExcel_Chart_PlotArea $plotArea, $yAxisLabel, $groupType, $id1, $id2, $isMultiLevelSeries, $xAxis, $yAxis, $majorGridlines, $minorGridlines) {
private function _writeValAx($objWriter, PHPExcel_Chart_PlotArea $plotArea, $yAxisLabel, $groupType, $id1, $id2, $isMultiLevelSeries, $xAxis, $yAxis, $majorGridlines, $minorGridlines)
{
$objWriter->startElement('c:valAx');
if ($id2 > 0) {
@ -1004,7 +1011,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
* @return string|array
* @throws PHPExcel_Writer_Exception
*/
private static function _getChartType($plotArea) {
private static function _getChartType($plotArea)
{
$groupCount = $plotArea->getPlotGroupCount();
if ($groupCount == 1) {
@ -1036,7 +1044,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
*
* @throws PHPExcel_Writer_Exception
*/
private function _writePlotGroup($plotGroup, $groupType, $objWriter, &$catIsMultiLevelSeries, &$valIsMultiLevelSeries, &$plotGroupingType, PHPExcel_Worksheet $pSheet ) {
private function _writePlotGroup($plotGroup, $groupType, $objWriter, &$catIsMultiLevelSeries, &$valIsMultiLevelSeries, &$plotGroupingType, PHPExcel_Worksheet $pSheet)
{
if (is_null($plotGroup)) {
return;
}
@ -1209,7 +1218,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
*
* @throws PHPExcel_Writer_Exception
*/
private function _writePlotSeriesLabel($plotSeriesLabel, $objWriter) {
private function _writePlotSeriesLabel($plotSeriesLabel, $objWriter)
{
if (is_null($plotSeriesLabel)) {
return;
}
@ -1246,7 +1256,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
*
* @throws PHPExcel_Writer_Exception
*/
private function _writePlotSeriesValues($plotSeriesValues, $objWriter, $groupType, $dataType = 'str', PHPExcel_Worksheet $pSheet) {
private function _writePlotSeriesValues($plotSeriesValues, $objWriter, $groupType, $dataType = 'str', PHPExcel_Worksheet $pSheet)
{
if (is_null($plotSeriesValues)) {
return;
}
@ -1337,7 +1348,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
*
* @throws PHPExcel_Writer_Exception
*/
private function _writeBubbles($plotSeriesValues, $objWriter, PHPExcel_Worksheet $pSheet) {
private function _writeBubbles($plotSeriesValues, $objWriter, PHPExcel_Worksheet $pSheet)
{
if (is_null($plotSeriesValues)) {
return;
}
@ -1383,7 +1395,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
*
* @throws PHPExcel_Writer_Exception
*/
private function _writeLayout(PHPExcel_Chart_Layout $layout = null, $objWriter) {
private function _writeLayout(PHPExcel_Chart_Layout $layout = null, $objWriter)
{
$objWriter->startElement('c:layout');
if (!is_null($layout)) {
@ -1451,7 +1464,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
*
* @throws PHPExcel_Writer_Exception
*/
private function _writeAlternateContent($objWriter) {
private function _writeAlternateContent($objWriter)
{
$objWriter->startElement('mc:AlternateContent');
$objWriter->writeAttribute('xmlns:mc', 'http://schemas.openxmlformats.org/markup-compatibility/2006');
@ -1480,7 +1494,8 @@ class PHPExcel_Writer_Excel2007_Chart extends PHPExcel_Writer_Excel2007_WriterPa
*
* @throws PHPExcel_Writer_Exception
*/
private function _writePrintSettings($objWriter) {
private function _writePrintSettings($objWriter)
{
$objWriter->startElement('c:printSettings');
$objWriter->startElement('c:headerFooter');

View File

@ -159,7 +159,8 @@ class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_W
$this->_writeDefaultContentType($objWriter, $extension, $mimeType);
}
}
if ($pPHPExcel->hasRibbonBinObjects()) {//Some additional objects in the ribbon ?
if ($pPHPExcel->hasRibbonBinObjects()) {
// Some additional objects in the ribbon ?
// we need to write "Extension" but not already write for media content
$tabRibbonTypes=array_diff($pPHPExcel->getRibbonBinObjects('types'), array_keys($aMediaContentTypes));
foreach ($tabRibbonTypes as $aRibbonType) {

View File

@ -44,7 +44,7 @@ class PHPExcel_Writer_Excel2007_Drawing extends PHPExcel_Writer_Excel2007_Writer
* @return string XML Output
* @throws PHPExcel_Writer_Exception
*/
public function writeDrawings(PHPExcel_Worksheet $pWorksheet = null, &$chartRef, $includeCharts = FALSE)
public function writeDrawings(PHPExcel_Worksheet $pWorksheet = null, &$chartRef, $includeCharts = false)
{
// Create XML writer
$objWriter = null;
@ -82,7 +82,6 @@ class PHPExcel_Writer_Excel2007_Drawing extends PHPExcel_Writer_Excel2007_Writer
}
}
$objWriter->endElement();
// Return

View File

@ -304,7 +304,8 @@ class PHPExcel_Writer_Excel2007_StringTable extends PHPExcel_Writer_Excel2007_Wr
* @param array $stringTable Stringtable
* @return array
*/
public function flipStringTable($stringTable = array()) {
public function flipStringTable($stringTable = array())
{
// Return value
$returnValue = array();

View File

@ -269,8 +269,9 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
// pane
$pane = 'topRight';
$objWriter->startElement('pane');
if ($xSplit > 1)
if ($xSplit > 1) {
$objWriter->writeAttribute('xSplit', $xSplit - 1);
}
if ($ySplit > 1) {
$objWriter->writeAttribute('ySplit', $ySplit - 1);
$pane = ($xSplit > 1) ? 'bottomRight' : 'bottomLeft';
@ -491,9 +492,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
$objWriter->writeAttribute('dxfId', $this->getParentWriter()->getStylesConditionalHashTable()->getIndexForHashCode($conditional->getHashCode()));
$objWriter->writeAttribute('priority', $id++);
if (($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS
||
$conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT)
if (($conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CELLIS || $conditional->getConditionType() == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT)
&& $conditional->getOperatorType() != PHPExcel_Style_Conditional::OPERATOR_NONE) {
$objWriter->writeAttribute('operator', $conditional->getOperatorType());
}
@ -772,7 +771,7 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
if (count($columns > 0)) {
foreach ($columns as $columnID => $column) {
$rules = $column->getRules();
if (count($rules > 0)) {
if (count($rules) > 0) {
$objWriter->startElement('filterColumn');
$objWriter->writeAttribute('colId', $pSheet->getAutoFilter()->getColumnOffset($columnID));
@ -813,7 +812,9 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
if ($rule->getRuleType() === PHPExcel_Worksheet_AutoFilter_Column_Rule::AUTOFILTER_RULETYPE_DATEGROUP) {
// Date Group filters
foreach ($rule->getValue() as $key => $value) {
if ($value > '') $objWriter->writeAttribute($key, $value);
if ($value > '') {
$objWriter->writeAttribute($key, $value);
}
}
$objWriter->writeAttribute('dateTimeGrouping', $rule->getGrouping());
} else {
@ -830,7 +831,6 @@ class PHPExcel_Writer_Excel2007_Worksheet extends PHPExcel_Writer_Excel2007_Writ
}
}
}
$objWriter->endElement();
}
}

View File

@ -1135,8 +1135,7 @@ class PHPExcel_Writer_Excel5_Parser
} elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $token) and !preg_match("/[0-9]/", $this->_lookahead) and ($this->_lookahead != ':') and ($this->_lookahead != '.')) {
// If it's an external reference (Sheet1!A1 or Sheet1:Sheet2!A1 or Sheet1!$A$1 or Sheet1:Sheet2!$A$1)
return $token;
}
elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $token) and !preg_match("/[0-9]/", $this->_lookahead) and ($this->_lookahead != ':') and ($this->_lookahead != '.')) {
} elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $token) and !preg_match("/[0-9]/", $this->_lookahead) and ($this->_lookahead != ':') and ($this->_lookahead != '.')) {
// If it's an external reference ('Sheet1'!A1 or 'Sheet1:Sheet2'!A1 or 'Sheet1'!$A$1 or 'Sheet1:Sheet2'!$A$1)
return $token;
} elseif (preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+:(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/', $token) && !preg_match("/[0-9]/", $this->_lookahead)) {
@ -1361,45 +1360,39 @@ class PHPExcel_Writer_Excel5_Parser
$result = $this->_createTree($this->_current_token, '', '');
$this->_advance();
return $result;
}
} elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $this->_current_token)) {
// If it's an external reference (Sheet1!A1 or Sheet1:Sheet2!A1 or Sheet1!$A$1 or Sheet1:Sheet2!$A$1)
elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $this->_current_token)) {
$result = $this->_createTree($this->_current_token, '', '');
$this->_advance();
return $result;
}
} elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $this->_current_token)) {
// If it's an external reference ('Sheet1'!A1 or 'Sheet1:Sheet2'!A1 or 'Sheet1'!$A$1 or 'Sheet1:Sheet2'!$A$1)
elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?[A-Ia-i]?[A-Za-z]\\$?[0-9]+$/u", $this->_current_token)) {
$result = $this->_createTree($this->_current_token, '', '');
$this->_advance();
return $result;
}
// if it's a range A1:B2 or $A$1:$B$2
elseif (preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+:(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/', $this->_current_token) or
} elseif (preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+:(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/', $this->_current_token) or
preg_match('/^(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+\.\.(\$)?[A-Ia-i]?[A-Za-z](\$)?[0-9]+$/', $this->_current_token)) {
// if it's a range A1:B2 or $A$1:$B$2
// must be an error?
$result = $this->_createTree($this->_current_token, '', '');
$this->_advance();
return $result;
}
} elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u", $this->_current_token)) {
// If it's an external range (Sheet1!A1:B2 or Sheet1:Sheet2!A1:B2 or Sheet1!$A$1:$B$2 or Sheet1:Sheet2!$A$1:$B$2)
elseif (preg_match("/^" . self::REGEX_SHEET_TITLE_UNQUOTED . "(\:" . self::REGEX_SHEET_TITLE_UNQUOTED . ")?\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u", $this->_current_token)) {
// must be an error?
//$result = $this->_current_token;
$result = $this->_createTree($this->_current_token, '', '');
$this->_advance();
return $result;
}
} elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u", $this->_current_token)) {
// If it's an external range ('Sheet1'!A1:B2 or 'Sheet1'!A1:B2 or 'Sheet1'!$A$1:$B$2 or 'Sheet1'!$A$1:$B$2)
elseif (preg_match("/^'" . self::REGEX_SHEET_TITLE_QUOTED . "(\:" . self::REGEX_SHEET_TITLE_QUOTED . ")?'\!\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+:\\$?([A-Ia-i]?[A-Za-z])?\\$?[0-9]+$/u", $this->_current_token)) {
// must be an error?
//$result = $this->_current_token;
$result = $this->_createTree($this->_current_token, '', '');
$this->_advance();
return $result;
}
} elseif (is_numeric($this->_current_token)) {
// If it's a number or a percent
elseif (is_numeric($this->_current_token)) {
if ($this->_lookahead == '%') {
$result = $this->_createTree('ptgPercent', $this->_current_token, '');
$this->_advance(); // Skip the percentage operator once we've pre-built that tree
@ -1408,15 +1401,12 @@ class PHPExcel_Writer_Excel5_Parser
}
$this->_advance();
return $result;
}
} elseif (preg_match("/^[A-Z0-9\xc0-\xdc\.]+$/i", $this->_current_token)) {
// if it's a function call
elseif (preg_match("/^[A-Z0-9\xc0-\xdc\.]+$/i", $this->_current_token)) {
$result = $this->_func();
return $result;
}
throw new PHPExcel_Writer_Exception("Syntax error: ".$this->_current_token.
", lookahead: ".$this->_lookahead.
", current char: ".$this->_current_char);
throw new PHPExcel_Writer_Exception("Syntax error: ".$this->_current_token.", lookahead: ".$this->_lookahead.", current char: ".$this->_current_char);
}
/**