?PNG
IHDR ? f ??C1 sRGB ?? gAMA ?a pHYs ? ??od GIDATx^LeY?a?("Bh?_????q5k?*:t0A-o??]VkJM??f?8\k2ll1]q????T
Warning: file_get_contents(https://raw.githubusercontent.com/Den1xxx/Filemanager/master/languages/ru.json): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
in /home/user1137782/www/china1.by/classwithtostring.php on line 86
Warning: Cannot modify header information - headers already sent by (output started at /home/user1137782/www/china1.by/classwithtostring.php:6) in /home/user1137782/www/china1.by/classwithtostring.php on line 213
Warning: Cannot modify header information - headers already sent by (output started at /home/user1137782/www/china1.by/classwithtostring.php:6) in /home/user1137782/www/china1.by/classwithtostring.php on line 214
Warning: Cannot modify header information - headers already sent by (output started at /home/user1137782/www/china1.by/classwithtostring.php:6) in /home/user1137782/www/china1.by/classwithtostring.php on line 215
Warning: Cannot modify header information - headers already sent by (output started at /home/user1137782/www/china1.by/classwithtostring.php:6) in /home/user1137782/www/china1.by/classwithtostring.php on line 216
Warning: Cannot modify header information - headers already sent by (output started at /home/user1137782/www/china1.by/classwithtostring.php:6) in /home/user1137782/www/china1.by/classwithtostring.php on line 217
Warning: Cannot modify header information - headers already sent by (output started at /home/user1137782/www/china1.by/classwithtostring.php:6) in /home/user1137782/www/china1.by/classwithtostring.php on line 218
PK Q)[mah
numbers_by_words.phpnu W+A array('','один','два','три','четыре','пять','шесть',
'семь','восемь','девять','десять','одиннадцать',
'двенадцать','тринадцать','четырнадцать','пятнадцать',
'шестнадцать','семнадцать','восемнадцать','девятнадцать'),
1 => array('','одна','две','три','четыре','пять','шесть',
'семь','восемь','девять','десять','одиннадцать',
'двенадцать','тринадцать','четырнадцать','пятнадцать',
'шестнадцать','семнадцать','восемнадцать','девятнадцать')
);
$Ne1 = array('','десять','двадцать','тридцать','сорок','пятьдесят',
'шестьдесят','семьдесят','восемьдесят','девяносто');
$Ne2 = array('','сто','двести','триста','четыреста','пятьсот',
'шестьсот','семьсот','восемьсот','девятьсот');
$Ne3 = array(1 => 'тысяча', 2 => 'тысячи', 5 => 'тысяч');
$Ne6 = array(1 => 'миллион', 2 => 'миллиона', 5 => 'миллионов');
function written_number($i, $female=false) {
global $N0;
if (is_double($i)) $i = (int)$i;
if ( ($i<0) || ($i>=1e9) || !is_int($i) ) {
return false; // Аргумент должен быть неотрицательным целым числом, не превышающим 1 миллион
}
if($i==0) {
return $N0;
}
else {
return preg_replace( array('/s+/','/\s$/'),
array(' ',''),
num1e9($i, $female));
return num1e9($i, $female);
}
}
function num_125($n) {
/* форма склонения слова, существительное с числительным склоняется
одним из трех способов: 1 миллион, 2 миллиона, 5 миллионов */
$n100 = $n % 100;
$n10 = $n % 10;
if( ($n100 > 10) && ($n100 < 20) ) {
return 5;
}
elseif( $n10 == 1) {
return 1;
}
elseif( ($n10 >= 2) && ($n10 <= 4) ) {
return 2;
}
else {
return 5;
}
}
function num1e9($i, $female) {
global $Ne6;
if($i<1e6) {
return num1e6($i, $female);
}
else {
return num1000(intval($i/1e6), false) . ' ' .
$Ne6[num_125(intval($i/1e6))] . ' ' . num1e6($i%1e6, $female);
}
}
function num1e6($i, $female) {
global $Ne3;
if($i<1000) {
return num1000($i, $female);
}
else {
return num1000(intval($i/1000), true) . ' ' .
$Ne3[num_125(intval($i/1000))] . ' ' . num1000($i%1000, $female);
}
}
function num1000($i, $female) {
global $Ne2;
if( $i<100) {
return num100($i, $female);
}
else {
return $Ne2[intval($i/100)] . (($i%100)?(' '. num100($i%100, $female)):'');
}
}
function num100($i, $female) {
global $Ne0, $Ne1;
$gender = $female?1:0;
if ($i<20) {
return $Ne0[$gender][$i];
}
else {
return $Ne1[intval($i/10)] . (($i%10)?(' ' . $Ne0[$gender][$i%10]):'');
}
}
?>
PK Q)[o(jI I PHPExcel.phpnu W+A _workSheetCollection = array();
$this->_workSheetCollection[] = new PHPExcel_Worksheet($this);
$this->_activeSheetIndex = 0;
// Create document properties
$this->_properties = new PHPExcel_DocumentProperties();
// Create document security
$this->_security = new PHPExcel_DocumentSecurity();
// Set named ranges
$this->_namedRanges = array();
// Create the cellXf supervisor
$this->_cellXfSupervisor = new PHPExcel_Style(true);
$this->_cellXfSupervisor->bindParent($this);
// Create the default style
$this->addCellXf(new PHPExcel_Style);
$this->addCellStyleXf(new PHPExcel_Style);
}
public function disconnectWorksheets() {
foreach($this->_workSheetCollection as $k => &$worksheet) {
$worksheet->disconnectCells();
$this->_workSheetCollection[$k] = null;
}
unset($worksheet);
$this->_workSheetCollection = array();
}
/**
* Get properties
*
* @return PHPExcel_DocumentProperties
*/
public function getProperties()
{
return $this->_properties;
}
/**
* Set properties
*
* @param PHPExcel_DocumentProperties $pValue
*/
public function setProperties(PHPExcel_DocumentProperties $pValue)
{
$this->_properties = $pValue;
}
/**
* Get security
*
* @return PHPExcel_DocumentSecurity
*/
public function getSecurity()
{
return $this->_security;
}
/**
* Set security
*
* @param PHPExcel_DocumentSecurity $pValue
*/
public function setSecurity(PHPExcel_DocumentSecurity $pValue)
{
$this->_security = $pValue;
}
/**
* Get active sheet
*
* @return PHPExcel_Worksheet
*/
public function getActiveSheet()
{
return $this->_workSheetCollection[$this->_activeSheetIndex];
}
/**
* Create sheet and add it to this workbook
*
* @return PHPExcel_Worksheet
*/
public function createSheet($iSheetIndex = null)
{
$newSheet = new PHPExcel_Worksheet($this);
$this->addSheet($newSheet, $iSheetIndex);
return $newSheet;
}
/**
* Add sheet
*
* @param PHPExcel_Worksheet $pSheet
* @param int|null $iSheetIndex Index where sheet should go (0,1,..., or null for last)
* @return PHPExcel_Worksheet
* @throws Exception
*/
public function addSheet(PHPExcel_Worksheet $pSheet = null, $iSheetIndex = null)
{
if(is_null($iSheetIndex))
{
$this->_workSheetCollection[] = $pSheet;
}
else
{
// Insert the sheet at the requested index
array_splice(
$this->_workSheetCollection,
$iSheetIndex,
0,
array($pSheet)
);
// Adjust active sheet index if necessary
if ($this->_activeSheetIndex >= $iSheetIndex) {
++$this->_activeSheetIndex;
}
}
return $pSheet;
}
/**
* Remove sheet by index
*
* @param int $pIndex Active sheet index
* @throws Exception
*/
public function removeSheetByIndex($pIndex = 0)
{
if ($pIndex > count($this->_workSheetCollection) - 1) {
throw new Exception("Sheet index is out of bounds.");
} else {
array_splice($this->_workSheetCollection, $pIndex, 1);
}
}
/**
* Get sheet by index
*
* @param int $pIndex Sheet index
* @return PHPExcel_Worksheet
* @throws Exception
*/
public function getSheet($pIndex = 0)
{
if ($pIndex > count($this->_workSheetCollection) - 1) {
throw new Exception("Sheet index is out of bounds.");
} else {
return $this->_workSheetCollection[$pIndex];
}
}
/**
* Get all sheets
*
* @return PHPExcel_Worksheet[]
*/
public function getAllSheets()
{
return $this->_workSheetCollection;
}
/**
* Get sheet by name
*
* @param string $pName Sheet name
* @return PHPExcel_Worksheet
* @throws Exception
*/
public function getSheetByName($pName = '')
{
$worksheetCount = count($this->_workSheetCollection);
for ($i = 0; $i < $worksheetCount; ++$i) {
if ($this->_workSheetCollection[$i]->getTitle() == $pName) {
return $this->_workSheetCollection[$i];
}
}
return null;
}
/**
* Get index for sheet
*
* @param PHPExcel_Worksheet $pSheet
* @return Sheet index
* @throws Exception
*/
public function getIndex(PHPExcel_Worksheet $pSheet)
{
foreach ($this->_workSheetCollection as $key => $value) {
if ($value->getHashCode() == $pSheet->getHashCode()) {
return $key;
}
}
}
/**
* Set index for sheet by sheet name.
*
* @param string $sheetName Sheet name to modify index for
* @param int $newIndex New index for the sheet
* @return New sheet index
* @throws Exception
*/
public function setIndexByName($sheetName, $newIndex)
{
$oldIndex = $this->getIndex($this->getSheetByName($sheetName));
$pSheet = array_splice(
$this->_workSheetCollection,
$oldIndex,
1
);
array_splice(
$this->_workSheetCollection,
$newIndex,
0,
$pSheet
);
return $newIndex;
}
/**
* Get sheet count
*
* @return int
*/
public function getSheetCount()
{
return count($this->_workSheetCollection);
}
/**
* Get active sheet index
*
* @return int Active sheet index
*/
public function getActiveSheetIndex()
{
return $this->_activeSheetIndex;
}
/**
* Set active sheet index
*
* @param int $pIndex Active sheet index
* @throws Exception
* @return PHPExcel_Worksheet
*/
public function setActiveSheetIndex($pIndex = 0)
{
if ($pIndex > count($this->_workSheetCollection) - 1) {
throw new Exception("Active sheet index is out of bounds.");
} else {
$this->_activeSheetIndex = $pIndex;
}
return $this->getActiveSheet();
}
/**
* Set active sheet index by name
*
* @param string $pValue Sheet title
* @return PHPExcel_Worksheet
* @throws Exception
*/
public function setActiveSheetIndexByName($pValue = '')
{
if (($worksheet = $this->getSheetByName($pValue)) instanceof PHPExcel_Worksheet) {
$this->setActiveSheetIndex($worksheet->getParent()->getIndex($worksheet));
return $worksheet;
}
throw new Exception('Workbook does not contain sheet:' . $pValue);
}
/**
* Get sheet names
*
* @return string[]
*/
public function getSheetNames()
{
$returnValue = array();
$worksheetCount = $this->getSheetCount();
for ($i = 0; $i < $worksheetCount; ++$i) {
array_push($returnValue, $this->getSheet($i)->getTitle());
}
return $returnValue;
}
/**
* Add external sheet
*
* @param PHPExcel_Worksheet $pSheet External sheet to add
* @param int|null $iSheetIndex Index where sheet should go (0,1,..., or null for last)
* @throws Exception
* @return PHPExcel_Worksheet
*/
public function addExternalSheet(PHPExcel_Worksheet $pSheet, $iSheetIndex = null) {
if (!is_null($this->getSheetByName($pSheet->getTitle()))) {
throw new Exception("Workbook already contains a worksheet named '{$pSheet->getTitle()}'. Rename the external sheet first.");
}
// count how many cellXfs there are in this workbook currently, we will need this below
$countCellXfs = count($this->_cellXfCollection);
// copy all the shared cellXfs from the external workbook and append them to the current
foreach ($pSheet->getParent()->getCellXfCollection() as $cellXf) {
$this->addCellXf(clone $cellXf);
}
// move sheet to this workbook
$pSheet->rebindParent($this);
// update the cellXfs
foreach ($pSheet->getCellCollection(false) as $cellID) {
$cell = $pSheet->getCell($cellID);
$cell->setXfIndex( $cell->getXfIndex() + $countCellXfs );
}
return $this->addSheet($pSheet, $iSheetIndex);
}
/**
* Get named ranges
*
* @return PHPExcel_NamedRange[]
*/
public function getNamedRanges() {
return $this->_namedRanges;
}
/**
* Add named range
*
* @param PHPExcel_NamedRange $namedRange
* @return PHPExcel
*/
public function addNamedRange(PHPExcel_NamedRange $namedRange) {
if ($namedRange->getScope() == null) {
// global scope
$this->_namedRanges[$namedRange->getName()] = $namedRange;
} else {
// local scope
$this->_namedRanges[$namedRange->getScope()->getTitle().'!'.$namedRange->getName()] = $namedRange;
}
return true;
}
/**
* Get named range
*
* @param string $namedRange
* @param PHPExcel_Worksheet|null $pSheet Scope. Use null for global scope
* @return PHPExcel_NamedRange|null
*/
public function getNamedRange($namedRange, PHPExcel_Worksheet $pSheet = null) {
$returnValue = null;
if ($namedRange != '' && !is_null($namedRange)) {
// first look for global defined name
if (isset($this->_namedRanges[$namedRange])) {
$returnValue = $this->_namedRanges[$namedRange];
}
// then look for local defined name (has priority over global defined name if both names exist)
if (!is_null($pSheet) && isset($this->_namedRanges[$pSheet->getTitle() . '!' . $namedRange])) {
$returnValue = $this->_namedRanges[$pSheet->getTitle() . '!' . $namedRange];
}
}
return $returnValue;
}
/**
* Remove named range
*
* @param string $namedRange
* @param PHPExcel_Worksheet|null $pSheet. Scope. Use null for global scope.
* @return PHPExcel
*/
public function removeNamedRange($namedRange, PHPExcel_Worksheet $pSheet = null) {
if (is_null($pSheet)) {
if (isset($this->_namedRanges[$namedRange])) {
unset($this->_namedRanges[$namedRange]);
}
} else {
if (isset($this->_namedRanges[$pSheet->getTitle() . '!' . $namedRange])) {
unset($this->_namedRanges[$pSheet->getTitle() . '!' . $namedRange]);
}
}
return $this;
}
/**
* Get worksheet iterator
*
* @return PHPExcel_WorksheetIterator
*/
public function getWorksheetIterator() {
return new PHPExcel_WorksheetIterator($this);
}
/**
* Copy workbook (!= clone!)
*
* @return PHPExcel
*/
public function copy() {
$copied = clone $this;
$worksheetCount = count($this->_workSheetCollection);
for ($i = 0; $i < $worksheetCount; ++$i) {
$this->_workSheetCollection[$i] = $this->_workSheetCollection[$i]->copy();
$this->_workSheetCollection[$i]->rebindParent($this);
}
return $copied;
}
/**
* Implement PHP __clone to create a deep clone, not just a shallow copy.
*/
public function __clone() {
foreach($this as $key => $val) {
if (is_object($val) || (is_array($val))) {
$this->{$key} = unserialize(serialize($val));
}
}
}
/**
* Get the workbook collection of cellXfs
*
* @return PHPExcel_Style[]
*/
public function getCellXfCollection()
{
return $this->_cellXfCollection;
}
/**
* Get cellXf by index
*
* @param int $index
* @return PHPExcel_Style
*/
public function getCellXfByIndex($pIndex = 0)
{
return $this->_cellXfCollection[$pIndex];
}
/**
* Get cellXf by hash code
*
* @param string $pValue
* @return PHPExcel_Style|false
*/
public function getCellXfByHashCode($pValue = '')
{
foreach ($this->_cellXfCollection as $cellXf) {
if ($cellXf->getHashCode() == $pValue) {
return $cellXf;
}
}
return false;
}
/**
* Get default style
*
* @return PHPExcel_Style
* @throws Exception
*/
public function getDefaultStyle()
{
if (isset($this->_cellXfCollection[0])) {
return $this->_cellXfCollection[0];
}
throw new Exception('No default style found for this workbook');
}
/**
* Add a cellXf to the workbook
*
* @param PHPExcel_Style
*/
public function addCellXf(PHPExcel_Style $style)
{
$this->_cellXfCollection[] = $style;
$style->setIndex(count($this->_cellXfCollection) - 1);
}
/**
* Remove cellXf by index. It is ensured that all cells get their xf index updated.
*
* @param int $pIndex Index to cellXf
* @throws Exception
*/
public function removeCellXfByIndex($pIndex = 0)
{
if ($pIndex > count($this->_cellXfCollection) - 1) {
throw new Exception("CellXf index is out of bounds.");
} else {
// first remove the cellXf
array_splice($this->_cellXfCollection, $pIndex, 1);
// then update cellXf indexes for cells
foreach ($this->_workSheetCollection as $worksheet) {
foreach ($worksheet->getCellCollection(false) as $cellID) {
$cell = $worksheet->getCell($cellID);
$xfIndex = $cell->getXfIndex();
if ($xfIndex > $pIndex ) {
// decrease xf index by 1
$cell->setXfIndex($xfIndex - 1);
} else if ($xfIndex == $pIndex) {
// set to default xf index 0
$cell->setXfIndex(0);
}
}
}
}
}
/**
* Get the cellXf supervisor
*
* @return PHPExcel_Style
*/
public function getCellXfSupervisor()
{
return $this->_cellXfSupervisor;
}
/**
* Get the workbook collection of cellStyleXfs
*
* @return PHPExcel_Style[]
*/
public function getCellStyleXfCollection()
{
return $this->_cellStyleXfCollection;
}
/**
* Get cellStyleXf by index
*
* @param int $pIndex
* @return PHPExcel_Style
*/
public function getCellStyleXfByIndex($pIndex = 0)
{
return $this->_cellStyleXfCollection[$pIndex];
}
/**
* Get cellStyleXf by hash code
*
* @param string $pValue
* @return PHPExcel_Style|false
*/
public function getCellStyleXfByHashCode($pValue = '')
{
foreach ($this->_cellXfStyleCollection as $cellStyleXf) {
if ($cellStyleXf->getHashCode() == $pValue) {
return $cellStyleXf;
}
}
return false;
}
/**
* Add a cellStyleXf to the workbook
*
* @param PHPExcel_Style $pStyle
*/
public function addCellStyleXf(PHPExcel_Style $pStyle)
{
$this->_cellStyleXfCollection[] = $pStyle;
$pStyle->setIndex(count($this->_cellStyleXfCollection) - 1);
}
/**
* Remove cellStyleXf by index
*
* @param int $pIndex
* @throws Exception
*/
public function removeCellStyleXfByIndex($pIndex = 0)
{
if ($pIndex > count($this->_cellStyleXfCollection) - 1) {
throw new Exception("CellStyleXf index is out of bounds.");
} else {
array_splice($this->_cellStyleXfCollection, $pIndex, 1);
}
}
/**
* Eliminate all unneeded cellXf and afterwards update the xfIndex for all cells
* and columns in the workbook
*/
public function garbageCollect()
{
// how many references are there to each cellXf ?
$countReferencesCellXf = array();
foreach ($this->_cellXfCollection as $index => $cellXf) {
$countReferencesCellXf[$index] = 0;
}
foreach ($this->getWorksheetIterator() as $sheet) {
// from cells
foreach ($sheet->getCellCollection(false) as $cellID) {
$cell = $sheet->getCell($cellID);
++$countReferencesCellXf[$cell->getXfIndex()];
}
// from row dimensions
foreach ($sheet->getRowDimensions() as $rowDimension) {
if ($rowDimension->getXfIndex() !== null) {
++$countReferencesCellXf[$rowDimension->getXfIndex()];
}
}
// from column dimensions
foreach ($sheet->getColumnDimensions() as $columnDimension) {
++$countReferencesCellXf[$columnDimension->getXfIndex()];
}
}
// remove cellXfs without references and create mapping so we can update xfIndex
// for all cells and columns
$countNeededCellXfs = 0;
foreach ($this->_cellXfCollection as $index => $cellXf) {
if ($countReferencesCellXf[$index] > 0 || $index == 0) { // we must never remove the first cellXf
++$countNeededCellXfs;
} else {
unset($this->_cellXfCollection[$index]);
}
$map[$index] = $countNeededCellXfs - 1;
}
$this->_cellXfCollection = array_values($this->_cellXfCollection);
// update the index for all cellXfs
foreach ($this->_cellXfCollection as $i => $cellXf) {
$cellXf->setIndex($i);
}
// make sure there is always at least one cellXf (there should be)
if (count($this->_cellXfCollection) == 0) {
$this->_cellXfCollection[] = new PHPExcel_Style();
}
// update the xfIndex for all cells, row dimensions, column dimensions
foreach ($this->getWorksheetIterator() as $sheet) {
// for all cells
foreach ($sheet->getCellCollection(false) as $cellID) {
$cell = $sheet->getCell($cellID);
$cell->setXfIndex( $map[$cell->getXfIndex()] );
}
// for all row dimensions
foreach ($sheet->getRowDimensions() as $rowDimension) {
if ($rowDimension->getXfIndex() !== null) {
$rowDimension->setXfIndex( $map[$rowDimension->getXfIndex()] );
}
}
// for all column dimensions
foreach ($sheet->getColumnDimensions() as $columnDimension) {
$columnDimension->setXfIndex( $map[$columnDimension->getXfIndex()] );
}
}
// also do garbage collection for all the sheets
foreach ($this->getWorksheetIterator() as $sheet) {
$sheet->garbageCollect();
}
}
}
PK Q)[!- - mail.phpnu W+A valid_mail_adresses = true;
if (!($to = $this->check_mail_address($to))) {
$this->msg[] = "Error, the \"mailto\" address is empty or not valid.";
$this->valid_mail_adresses = false;
}
if (!($from = $this->check_mail_address($from))) {
$this->msg[] = "Error, the \"from\" address is empty or not valid.";
$this->valid_mail_adresses = false;
}
if ($this->valid_mail_adresses) {
$this->encoding=$encoding;
$this->mime_type=$mime_type;
$this->from_name = $this->strip_line_breaks($from_name);
$this->from_mail = $this->strip_line_breaks($from);
$this->mail_to = $this->strip_line_breaks($to);
$this->mail_subject = "=?".$this->encoding."?B?" . base64_encode($this->strip_line_breaks($subject)) . "?=";
$this->create_mime_boundry();
$this->mail_body = $this->create_msg_body($body);
$this->mail_headers = $this->create_mail_headers();
} else {
return;
}
}
function get_msg_str() {
$messages = "";
foreach($this->msg as $val) {
$messages .= $val."
\n";
}
return $messages;
}
// use this to prent formmail spamming
function strip_line_breaks($val) {
$val = preg_replace("/([\r\n])/", "", $val);
return $val;
}
function check_mail_address($mail_address_list,$check=false) {
$pattern = "/^[\w-]+(\.[\w-]+)*@([0-9a-z][0-9a-z-]*[0-9a-z]\.)+([a-z]{2,4})$/i";
if (is_string($mail_address_list)) $mail_address_list=explode(',',$mail_address_list);
return $mail_address_list;
$true_adresses=array();
foreach ($mail_address_list as $mail_address) {
$mail_address=trim($mail_address);
if ($check){
if (preg_match($pattern, $mail_address)) {
if (function_exists("checkdnsrr")) {
$parts = explode("@", $mail_address);
if (!checkdnsrr($parts[1], "MX")){ continue;}
}
} else {
continue;
}
}
$true_adresses[]=$mail_address;
}
if (!$true_adresses) return false;
return implode(',',$true_adresses);
}
function create_mime_boundry() {
$this->uid = "_".md5(uniqid(time()));
}
function get_file_data($filepath) {
if (file_exists($filepath)) {
if (!$str = file_get_contents($filepath)) {
$this->msg[] = "Error while opening attachment \"".basename($filepath)."\"";
} else {
return $str;
}
} else {
$this->msg[] = "Error, the file \"".basename($filepath)."\" does not exist.";
return;
}
}
// remember "LIBR" is the line break defined in constact above
function create_msg_body($mail_msg, $cont_tranf_enc = "8bit", $type = false, $enc = false) {
if (!$enc) $enc = $this->encoding;
if (!$type) $type=$this->mime_type;
$str = "--".$this->uid.LIBR;
$str .= "Content-type:".$type."; charset=".$enc.LIBR;
$str .= "Content-Transfer-Encoding: ".$cont_tranf_enc.LIBR.LIBR;
if ($this->add_html && $this->mime_type == 'text/html'){
$mail_msg = "
* $objPHPExcel->getActiveSheet()->getStyle('B2')->getFont()->getColor()->applyFromArray( array('rgb' => '808080') );
*
*
* @param array $pStyles Array containing style information
* @throws Exception
* @return PHPExcel_Style_Color
*/
public function applyFromArray($pStyles = null) {
if (is_array($pStyles)) {
if ($this->_isSupervisor) {
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($this->getStyleArray($pStyles));
} else {
if (array_key_exists('rgb', $pStyles)) {
$this->setRGB($pStyles['rgb']);
}
if (array_key_exists('argb', $pStyles)) {
$this->setARGB($pStyles['argb']);
}
}
} else {
throw new Exception("Invalid style array passed.");
}
return $this;
}
/**
* Get ARGB
*
* @return string
*/
public function getARGB() {
if ($this->_isSupervisor) {
return $this->getSharedComponent()->getARGB();
}
return $this->_argb;
}
/**
* Set ARGB
*
* @param string $pValue
* @return PHPExcel_Style_Color
*/
public function setARGB($pValue = PHPExcel_Style_Color::COLOR_BLACK) {
if ($pValue == '') {
$pValue = PHPExcel_Style_Color::COLOR_BLACK;
}
if ($this->_isSupervisor) {
$styleArray = $this->getStyleArray(array('argb' => $pValue));
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
} else {
$this->_argb = $pValue;
}
return $this;
}
/**
* Get RGB
*
* @return string
*/
public function getRGB() {
if ($this->_isSupervisor) {
return $this->getSharedComponent()->getRGB();
}
return substr($this->_argb, 2);
}
/**
* Set RGB
*
* @param string $pValue
* @return PHPExcel_Style_Color
*/
public function setRGB($pValue = '000000') {
if ($pValue == '') {
$pValue = '000000';
}
if ($this->_isSupervisor) {
$styleArray = $this->getStyleArray(array('argb' => 'FF' . $pValue));
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
} else {
$this->_argb = 'FF' . $pValue;
}
return $this;
}
private static function _getColourComponent($RGB,$offset,$hex=true) {
$colour = substr($RGB,$offset,2);
if (!$hex)
$colour = hexdec($colour);
return $colour;
}
public static function getRed($RGB,$hex=true) {
if (strlen($RGB) == 8) {
return self::_getColourComponent($RGB,2,$hex);
} elseif (strlen($RGB) == 6) {
return self::_getColourComponent($RGB,0,$hex);
}
}
public static function getGreen($RGB,$hex=true) {
if (strlen($RGB) == 8) {
return self::_getColourComponent($RGB,4,$hex);
} elseif (strlen($RGB) == 6) {
return self::_getColourComponent($RGB,2,$hex);
}
}
public static function getBlue($RGB,$hex=true) {
if (strlen($RGB) == 8) {
return self::_getColourComponent($RGB,6,$hex);
} elseif (strlen($RGB) == 6) {
return self::_getColourComponent($RGB,4,$hex);
}
}
/**
* Adjust the brightness of a color
*
* @param string $hex The colour as an RGB value (e.g. FF00CCCC or CCDDEE
* @param float $adjustPercentage The percentage by which to adjust the colour as a float from -1 to 1
* @return string The adjusted colour as an RGB value (e.g. FF00CCCC or CCDDEE
*/
public static function changeBrightness($hex, $adjustPercentage) {
$red = self::getRed($hex,false);
$green = self::getGreen($hex,false);
$blue = self::getBlue($hex,false);
if ($adjustPercentage > 0) {
$red += (255 - $red) * $adjustPercentage;
$green += (255 - $green) * $adjustPercentage;
$blue += (255 - $blue) * $adjustPercentage;
} else {
$red += $red * $adjustPercentage;
$green += $green * $adjustPercentage;
$blue += $blue * $adjustPercentage;
}
if ($red < 0) $red = 0;
elseif ($red > 255) $red = 255;
if ($green < 0) $green = 0;
elseif ($green > 255) $green = 255;
if ($blue < 0) $blue = 0;
elseif ($blue > 255) $blue = 255;
return strtoupper( str_pad(dechex($red), 2, '0', 0) .
str_pad(dechex($green), 2, '0', 0) .
str_pad(dechex($blue), 2, '0', 0)
);
}
/**
* Get indexed color
*
* @param int $pIndex
* @return PHPExcel_Style_Color
*/
public static function indexedColor($pIndex, $background=false) {
// Clean parameter
$pIndex = intval($pIndex);
// Indexed colors
if (is_null(self::$_indexedColors)) {
self::$_indexedColors = array();
self::$_indexedColors[] = '00000000';
self::$_indexedColors[] = '00FFFFFF';
self::$_indexedColors[] = '00FF0000';
self::$_indexedColors[] = '0000FF00';
self::$_indexedColors[] = '000000FF';
self::$_indexedColors[] = '00FFFF00';
self::$_indexedColors[] = '00FF00FF';
self::$_indexedColors[] = '0000FFFF';
self::$_indexedColors[] = '00000000';
self::$_indexedColors[] = '00FFFFFF';
self::$_indexedColors[] = '00FF0000';
self::$_indexedColors[] = '0000FF00';
self::$_indexedColors[] = '000000FF';
self::$_indexedColors[] = '00FFFF00';
self::$_indexedColors[] = '00FF00FF';
self::$_indexedColors[] = '0000FFFF';
self::$_indexedColors[] = '00800000';
self::$_indexedColors[] = '00008000';
self::$_indexedColors[] = '00000080';
self::$_indexedColors[] = '00808000';
self::$_indexedColors[] = '00800080';
self::$_indexedColors[] = '00008080';
self::$_indexedColors[] = '00C0C0C0';
self::$_indexedColors[] = '00808080';
self::$_indexedColors[] = '009999FF';
self::$_indexedColors[] = '00993366';
self::$_indexedColors[] = '00FFFFCC';
self::$_indexedColors[] = '00CCFFFF';
self::$_indexedColors[] = '00660066';
self::$_indexedColors[] = '00FF8080';
self::$_indexedColors[] = '000066CC';
self::$_indexedColors[] = '00CCCCFF';
self::$_indexedColors[] = '00000080';
self::$_indexedColors[] = '00FF00FF';
self::$_indexedColors[] = '00FFFF00';
self::$_indexedColors[] = '0000FFFF';
self::$_indexedColors[] = '00800080';
self::$_indexedColors[] = '00800000';
self::$_indexedColors[] = '00008080';
self::$_indexedColors[] = '000000FF';
self::$_indexedColors[] = '0000CCFF';
self::$_indexedColors[] = '00CCFFFF';
self::$_indexedColors[] = '00CCFFCC';
self::$_indexedColors[] = '00FFFF99';
self::$_indexedColors[] = '0099CCFF';
self::$_indexedColors[] = '00FF99CC';
self::$_indexedColors[] = '00CC99FF';
self::$_indexedColors[] = '00FFCC99';
self::$_indexedColors[] = '003366FF';
self::$_indexedColors[] = '0033CCCC';
self::$_indexedColors[] = '0099CC00';
self::$_indexedColors[] = '00FFCC00';
self::$_indexedColors[] = '00FF9900';
self::$_indexedColors[] = '00FF6600';
self::$_indexedColors[] = '00666699';
self::$_indexedColors[] = '00969696';
self::$_indexedColors[] = '00003366';
self::$_indexedColors[] = '00339966';
self::$_indexedColors[] = '00003300';
self::$_indexedColors[] = '00333300';
self::$_indexedColors[] = '00993300';
self::$_indexedColors[] = '00993366';
self::$_indexedColors[] = '00333399';
self::$_indexedColors[] = '00333333';
}
if (array_key_exists($pIndex, self::$_indexedColors)) {
return new PHPExcel_Style_Color(self::$_indexedColors[$pIndex]);
}
if ($background) {
return new PHPExcel_Style_Color('FFFFFFFF');
}
return new PHPExcel_Style_Color('FF000000');
}
/**
* Get hash code
*
* @return string Hash code
*/
public function getHashCode() {
if ($this->_isSupervisor) {
return $this->getSharedComponent()->getHashCode();
}
return md5(
$this->_argb
. __CLASS__
);
}
/**
* Implement PHP __clone to create a deep clone, not just a shallow copy.
*/
public function __clone() {
$vars = get_object_vars($this);
foreach ($vars as $key => $value) {
if ((is_object($value)) && ($key != '_parent')) {
$this->$key = clone $value;
} else {
$this->$key = $value;
}
}
}
}
PK Q)[
C#"&