Import initial du projet Production
This commit is contained in:
12
Cron/Acte.php
Executable file
12
Cron/Acte.php
Executable file
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
require_once 'Modele.php';
|
||||
|
||||
class Acte extends Modele {
|
||||
|
||||
public function getInfos($codeActe)
|
||||
{
|
||||
$sql = 'select libelle from p_acte where (codeActe=?)';
|
||||
$resultat = $this->executerRequete($sql, array($codeActe));
|
||||
return $resultat->fetch(PDO::FETCH_ASSOC);
|
||||
}
|
||||
}
|
||||
13
Cron/Beneficiaire.php
Executable file
13
Cron/Beneficiaire.php
Executable file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
require_once 'Modele.php';
|
||||
|
||||
class Beneficiaire extends Modele {
|
||||
|
||||
public function getInfosBeneficiaire($idBeneficiaire)
|
||||
{
|
||||
$sql = 'call sp_get_infos_beneficiaire(?);';
|
||||
|
||||
$resultat = $this->executerRequete($sql, array($idBeneficiaire));
|
||||
return $resultat->fetch(PDO::FETCH_ASSOC);
|
||||
}
|
||||
}
|
||||
34
Cron/Configuration.php
Executable file
34
Cron/Configuration.php
Executable file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
class Configuration
|
||||
{
|
||||
private static $parametres;
|
||||
public static function get($nom, $valeurParDefaut = null)
|
||||
{
|
||||
$parametres = self::getParametres();
|
||||
if (isset($parametres[$nom])) {
|
||||
$valeur = $parametres[$nom];
|
||||
}
|
||||
else {
|
||||
$valeur = $valeurParDefaut;
|
||||
}
|
||||
return $valeur;
|
||||
}
|
||||
private static function getParametres()
|
||||
{
|
||||
if (self::$parametres == null) {
|
||||
$cheminFichier = __DIR__ ."/dev.ini";
|
||||
|
||||
// require_once __DIR__ .'/Fpdf/fpdf.php';
|
||||
if (!file_exists($cheminFichier)) {
|
||||
$cheminFichier = __DIR__ ."/prod.ini";
|
||||
}
|
||||
if (!file_exists($cheminFichier)) {
|
||||
throw new Exception("Aucun fichier de configuration trouvé");
|
||||
}
|
||||
else {
|
||||
self::$parametres = parse_ini_file($cheminFichier);
|
||||
}
|
||||
}
|
||||
return self::$parametres;
|
||||
}
|
||||
}
|
||||
34
Cron/Configuration_old.php
Executable file
34
Cron/Configuration_old.php
Executable file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
class Configuration
|
||||
{
|
||||
private static $parametres;
|
||||
public static function get($nom, $valeurParDefaut = null)
|
||||
{
|
||||
$parametres = self::getParametres();
|
||||
if (isset($parametres[$nom])) {
|
||||
$valeur = $parametres[$nom];
|
||||
}
|
||||
else {
|
||||
$valeur = $valeurParDefaut;
|
||||
}
|
||||
return $valeur;
|
||||
}
|
||||
private static function getParametres()
|
||||
{
|
||||
if (self::$parametres == null) {
|
||||
$cheminFichier = __DIR__ ."/dev.ini";
|
||||
|
||||
// require_once __DIR__ .'/Fpdf/fpdf.php';
|
||||
if (!file_exists($cheminFichier)) {
|
||||
$cheminFichier = __DIR__ ."/prod.ini";
|
||||
}
|
||||
if (!file_exists($cheminFichier)) {
|
||||
throw new Exception("Aucun fichier de configuration trouvé");
|
||||
}
|
||||
else {
|
||||
self::$parametres = parse_ini_file($cheminFichier);
|
||||
}
|
||||
}
|
||||
return self::$parametres;
|
||||
}
|
||||
}
|
||||
9
Cron/Controleurrequete.php
Executable file
9
Cron/Controleurrequete.php
Executable file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
// require_once __DIR__ .'/Fpdf/fpdf.php';
|
||||
require_once __DIR__ .'/Fpdf/fpdf_protection.php';
|
||||
require_once __DIR__ .'/PHPExcel/PHPExcel.php';
|
||||
require_once __DIR__ .'/PHPExcel/PHPExcel/IOFactory.php';
|
||||
require_once __DIR__ .'/PHPExcel/PHPExcel/Writer/Excel2007.php';
|
||||
|
||||
// Ajout du 05/12/2019
|
||||
require_once 'Localisation.php';
|
||||
52
Cron/Cronchaqueminuteproduction.php
Executable file
52
Cron/Cronchaqueminuteproduction.php
Executable file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
require_once 'Societeusercentral.php';
|
||||
require_once 'Cronenvoimail.php';
|
||||
|
||||
class Cronchaqueminuteproduction
|
||||
{
|
||||
private $cronenvoimail;
|
||||
|
||||
public function __construct() {
|
||||
|
||||
}
|
||||
|
||||
public function executer()
|
||||
{
|
||||
$this->societeusercentral = new Societeusercentral();
|
||||
$this->cronenvoimail = new Cronenvoimail();
|
||||
|
||||
$liste_societeuser = $this->societeusercentral->getSocieteusers();
|
||||
|
||||
$_SESSION['old_codeSociete']="";
|
||||
|
||||
foreach ($liste_societeuser as $societeuser)
|
||||
{
|
||||
$codeSociete = $societeuser['codeSociete'];
|
||||
$_SESSION['c_codeSociete'] = $codeSociete;
|
||||
|
||||
// Début Cronenvoimail
|
||||
$this->cronenvoimail->chargersociete();
|
||||
$nbMail = $this->cronenvoimail->nbMailParCron;
|
||||
$this->cronenvoimail->$nbMail = $nbMail;
|
||||
$this->cronenvoimail->charger_les_mails($nbMail);
|
||||
$this->cronenvoimail->envoyer_les_mails();
|
||||
// Fin Cronenvoimail
|
||||
}
|
||||
}
|
||||
}
|
||||
// Execution
|
||||
$cronchaqueminuteproduction = new Cronchaqueminuteproduction();
|
||||
// $cronchaqueminuteproduction->executer();
|
||||
|
||||
$iterations = 25; // On va boucler 25 fois
|
||||
// $interval = 5; // secondes
|
||||
$interval = 2000; // millisecondes
|
||||
|
||||
for ($i = 0; $i < $iterations; $i++)
|
||||
{
|
||||
$cronchaqueminuteproduction->executer();
|
||||
if ($i < $iterations - 1) {
|
||||
// sleep($interval); // secondes
|
||||
usleep($interval); // Stoppe en millisecondes
|
||||
}
|
||||
}
|
||||
35
Cron/Cronchaquenuit.php
Executable file
35
Cron/Cronchaquenuit.php
Executable file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
require_once 'Societeusercentral.php';
|
||||
require_once 'Societeuser.php';
|
||||
|
||||
class Cronchaquenuit
|
||||
{
|
||||
private $societeusercentral;
|
||||
private $societeuser;
|
||||
|
||||
public function __construct() {
|
||||
|
||||
}
|
||||
|
||||
public function executer()
|
||||
{
|
||||
$this->societeusercentral = new Societeusercentral();
|
||||
$this->societeuser = new Societeuser();
|
||||
|
||||
$liste_societeuser = $this->societeusercentral->getSocieteusers();
|
||||
|
||||
$_SESSION['old_codeSociete']="";
|
||||
|
||||
foreach ($liste_societeuser as $societeuser)
|
||||
{
|
||||
$codeSociete = $societeuser['codeSociete'];
|
||||
|
||||
$_SESSION['c_codeSociete'] = $codeSociete;
|
||||
|
||||
$this->societeuser->utilitaires_chaque_nuit_saas($codeSociete);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Execution
|
||||
$cronchaquenuit = new Cronchaquenuit();
|
||||
$cronchaquenuit->executer();
|
||||
1381
Cron/Cronenvoimail.php
Executable file
1381
Cron/Cronenvoimail.php
Executable file
File diff suppressed because it is too large
Load Diff
237
Cron/Cronenvoimailconsoparfamille.php
Executable file
237
Cron/Cronenvoimailconsoparfamille.php
Executable file
@@ -0,0 +1,237 @@
|
||||
<?php
|
||||
require_once 'Functions.php';
|
||||
|
||||
class Cronenvoimailconsoparfamille
|
||||
{
|
||||
|
||||
public function __construct() {
|
||||
|
||||
}
|
||||
|
||||
public function chargerconsoperiodefamille(){
|
||||
require_once 'Statistique.php';
|
||||
|
||||
$this->detailsp = new Statistique();
|
||||
|
||||
$debutStat = date("Y-m-d", mktime(0,0,0,date("m")-1,1,date("Y")));
|
||||
$finStat = date("Y-m-d", mktime(0,0,0,date("m"),0,date("Y")));
|
||||
|
||||
$consos = $this->detailsp->etatrapportspadherentperiode($debutStat, $finStat);
|
||||
|
||||
$nb = count($consos);
|
||||
|
||||
foreach ($consos as $v)
|
||||
{
|
||||
if ($v['email']>" "){
|
||||
$this->lancemailpdf($v['idAdherent'], $v['email'], $debutStat, $finStat);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function lancemailpdf($idAdherent, $email, $debutStat, $finStat)
|
||||
{
|
||||
require_once 'Ebenegmail.php';
|
||||
require_once 'Fpdf/fpdf_protection.php';
|
||||
require_once 'Societeuser.php';
|
||||
|
||||
// $this->mail_C = $mail;
|
||||
$this->mail_C = $_SESSION['c_mail'];
|
||||
|
||||
$this->ste = new Societeuser();
|
||||
|
||||
$societe = $this->ste->getparametressociete();
|
||||
|
||||
$entete = $this->detailsp->detailrapportspadhperiodepdfentete($idAdherent, $debutStat, $finStat);
|
||||
|
||||
$detailsps = $this->detailsp->detailrapportspadhperiodefacturepdf($idAdherent, $debutStat, $finStat);
|
||||
|
||||
// $pdf = new FPDF();
|
||||
$pdf = new FPDF_Protection();
|
||||
$pdf->SetAuthor('EBENE SOLUTIONS INFORMATIQUES');
|
||||
$userPassword = '';
|
||||
$ownerPassword = null;
|
||||
$pdf->SetProtection(['print'], $userPassword, $ownerPassword);
|
||||
|
||||
$pdf->AliasNbPages();
|
||||
$pdf->AddPage();
|
||||
|
||||
$pdf->SetMargins(15, 15, 15) ;
|
||||
$pdf->Image('Img/logo_societe.png',94,3,18);
|
||||
|
||||
$tp = 9;
|
||||
$ht = 6;
|
||||
|
||||
$pdf->Ln(10);
|
||||
|
||||
$pdf->SetFont('Arial','BU',10);
|
||||
|
||||
// $pdf->AliasNbPages();
|
||||
$pdf->Cell(0,6,_('DETAIL DES FACTURES FAMILLE'),0,1,'C',false);
|
||||
|
||||
$pdf->Ln(2);
|
||||
|
||||
$pdf->SetFont('Arial','B',7);
|
||||
|
||||
$pdf->Cell(0,5,_('Garant').' : '.$entete['garant'],0,1,'L',false);
|
||||
$pdf->Cell(0,5,_('Souscripteur').' : '.$entete['souscripteur'],0,1,'L',false);
|
||||
$pdf->Cell(0,5,_('Police').' No : '.$entete['numeroPolice'].' / '.$entete['libellePolice'],0,1,'L',false);
|
||||
$pdf->Cell(0,5,_(convertirc('Adhérent')).' Mle : '.$entete['numeroAdherent'].' / '.$entete['adherent'],0,1,'L',false);
|
||||
$pdf->Cell(0,5,_(convertirc('Période couverte')).' : '.dateLang($entete['dateEffetAdherent'], $_SESSION['lang']).' '._('au').' '.dateLang($entete['dateFinAdherent'], $_SESSION['lang']),0,1,'L',false);
|
||||
$pdf->Cell(0,5,_(convertirc('Période Analyse')).' : '.dateLang($entete['debutAnalyse'], $_SESSION['lang']).' '._('au').' '.dateLang($entete['finAnalyse'], $_SESSION['lang']),0,1,'L',false);
|
||||
$pdf->Cell(0,5,'Edition : '.heureCouranteLang($_SESSION['lang']),0,1,'R',false);
|
||||
|
||||
$pdf->Ln(2);
|
||||
|
||||
$hl=5;
|
||||
|
||||
$pdf->Cell(20,$hl,_('Matricule'),"1",0,'C');
|
||||
$pdf->Cell(65,$hl,convertirc(_('Bénéficiaire')),"1",0,'C');
|
||||
$pdf->Cell(15,$hl,"Date","1",0,'C');
|
||||
$pdf->Cell(50,$hl,_('Prestataire'),"1",0,'C');
|
||||
$pdf->Cell(15,$hl,_('Montant'),"1",0,'C');
|
||||
$pdf->Cell(15,$hl,_('No Fact'),"1",1,'C');
|
||||
|
||||
$pdf->SetFont('Arial','I',6);
|
||||
foreach ($detailsps as $detailsp)
|
||||
{
|
||||
$pdf->Cell(20,$hl,$detailsp['numeroBeneficiaire'],"1",0,'L');
|
||||
$pdf->Cell(65,$hl,$detailsp['beneficiaire'],"1",0,'L');
|
||||
$pdf->Cell(15,$hl,dateLang($detailsp['dateFacture'], $_SESSION['lang']),"1",0,'C');
|
||||
$pdf->Cell(50,$hl,$detailsp['prestataire'],"1",0,'L');
|
||||
$pdf->Cell(15,$hl,format_N($detailsp['montant']),"1",0,'C');
|
||||
$pdf->Cell(15,$hl,$detailsp['facture'],"1",1,'C');
|
||||
}
|
||||
$pdf->SetFont('Arial','BI',6);
|
||||
|
||||
$pdf->Cell(150,$hl,"TOTAL","1",0,'C');
|
||||
$pdf->Cell(15,$hl,format_N($detailsp['montantTotal']),"1",0,'C');
|
||||
$pdf->Cell(15,$hl,"","1",1,'C');
|
||||
|
||||
$pdf->Ln(5);
|
||||
|
||||
$pdf->SetFont('Arial','BI', $tp);
|
||||
|
||||
if (est_anglophone())
|
||||
{
|
||||
$pdf->Cell(0,$ht,"Done at " . $societe['ville'].", on ".dateCouranteLang($_SESSION['lang']),0,1,'C',false);
|
||||
}
|
||||
else
|
||||
{
|
||||
$pdf->Cell(0,$ht,convertirc("Fait à ") . $societe['ville'].", le ".dateCouranteLang($_SESSION['lang']),0,1,'C',false);
|
||||
}
|
||||
|
||||
$pdf->Ln(10);
|
||||
|
||||
$pdf->SetFont('Arial','BU', $tp);
|
||||
|
||||
$pdf->Cell(0,$ht,_(convertirc("L'Assuré")),0,1,'C',false);
|
||||
|
||||
$pdf->Cell(0,$ht,_("Le Souscripteur"),0,0,'L',false);
|
||||
|
||||
$pdf->Cell(0,$ht,_("Le Gestionnaire"),0,0,'R',false);
|
||||
|
||||
// DEBUT ENVOI DU MAIL AVEC PIECE JOINTE
|
||||
|
||||
$mail_C = $this->mail_C;
|
||||
|
||||
$mail_C->ClearAllRecipients();
|
||||
$mail_C->clearAttachments();
|
||||
|
||||
$addr = explode(';', $email);
|
||||
|
||||
foreach ($addr as $ad)
|
||||
{
|
||||
if(tester_une_adresse_email($ad))
|
||||
{
|
||||
$mail_C->AddAddress(trim($ad) );
|
||||
}
|
||||
else
|
||||
{
|
||||
// echo "Veuillez revoir cette adresse PHP : " . $ad;
|
||||
// exit();
|
||||
}
|
||||
}
|
||||
|
||||
if (est_anglophone())
|
||||
{
|
||||
$fichier="FAM_INVOICE_DETAIL_".$debutStat."_".$finStat."_".uniqid().".pdf";
|
||||
$pdf->Output($fichier,"F");
|
||||
|
||||
$obejt = "FAMILY INVOICE DETAIL : ".$debutStat." TO ".$finStat;
|
||||
|
||||
$body = "Dear Customer,";
|
||||
|
||||
$body .= "<br/> <br/>";
|
||||
|
||||
$body .= "Hope this email find you well,";
|
||||
|
||||
$body .= "<br/> <br/>";
|
||||
|
||||
$body .= "Please find attached your consumption report by family for the period from ".$debutStat." to ".$finStat.'.';
|
||||
|
||||
$body .= "<br/> <br/>";
|
||||
|
||||
$body .= "We remain at your disposal and available for any additional information desired.";
|
||||
|
||||
$body .= "<br/> <br/>";
|
||||
|
||||
$body .= "Kind Regards.";
|
||||
|
||||
$altbody = "SEE ATTACHMENT";
|
||||
}
|
||||
else
|
||||
{
|
||||
$fichier="DETAIL_FACTURE_FAMILLE_".$debutStat."_".$finStat."_".uniqid().".pdf";
|
||||
$pdf->Output($fichier,"F");
|
||||
|
||||
$obejt = "DETAIL DES FACTURES : ".$debutStat." AU ".$finStat;
|
||||
|
||||
$body = "Cher Client,";
|
||||
|
||||
$body .= "<br/> <br/>";
|
||||
|
||||
$body .= "Nous vous prions de trouver en pièce jointe votre rapport de consommations par famille pour la période du ".$debutStat." au ".$finStat.'.';
|
||||
|
||||
$body .= "<br/> <br/>";
|
||||
|
||||
$body .= "Nous restons à votre écoute et disponible pour toute information complémentaire souhaitée.";
|
||||
|
||||
$body .= "<br/> <br/>";
|
||||
|
||||
$body .= "Portez-vous bien,";
|
||||
|
||||
$body .= "<br/> <br/>";
|
||||
|
||||
$body .= "Cordialement!";
|
||||
|
||||
$altbody = "VOIR PIECE JOINTE";
|
||||
}
|
||||
|
||||
$obejt = $obejt;
|
||||
|
||||
$pj = $fichier;
|
||||
|
||||
$mail_C->Subject = $obejt;
|
||||
|
||||
$mail_C->AltBody = $altbody;
|
||||
$mail_C->Body=$body;
|
||||
|
||||
$mail_C->addAttachment($pj);
|
||||
|
||||
if (!$mail_C->send())
|
||||
{
|
||||
// echo "Erreur mail : " . $mail_C->ErrorInfo;
|
||||
}
|
||||
else
|
||||
{
|
||||
// echo "Message envoyé!";
|
||||
}
|
||||
|
||||
// supprimons le fichier
|
||||
unlink ($pj);
|
||||
}
|
||||
}
|
||||
|
||||
$envoimail = new Cronenvoimailconsoparfamille();
|
||||
|
||||
$envoimail->chargerconsoperiodefamille();
|
||||
598
Cron/Cronenvoisms.php
Executable file
598
Cron/Cronenvoisms.php
Executable file
@@ -0,0 +1,598 @@
|
||||
<?php
|
||||
require_once 'Functions.php';
|
||||
|
||||
class Cronenvoisms
|
||||
{
|
||||
public function __construct() {
|
||||
}
|
||||
|
||||
public function charger_les_sms($nbSms)
|
||||
{
|
||||
require_once 'Envoismscron.php';
|
||||
|
||||
$this->smscron = new Envoismscron();
|
||||
|
||||
$this->lesSms = $this->smscron->get_les_smsaenvoyer($nbSms);
|
||||
}
|
||||
|
||||
public function chargersociete()
|
||||
{
|
||||
require_once 'Societeuser.php';
|
||||
|
||||
$this->societe = new Societeuser();
|
||||
$societe = $this->societe->getparametressociete();
|
||||
|
||||
$this->fournisseurSms = $societe['fournisseurSms'];
|
||||
$this->devise = $societe['devise'];
|
||||
$this->nbSmsParCron = $societe['nbSmsParCron'];
|
||||
$this->nomProduitSante = $societe['nomProduitSante'];
|
||||
$this->titreSms = $societe['titreSms'];
|
||||
$this->compteSms = $societe['compteSms'];
|
||||
|
||||
$this->loginSms = $societe['loginSms'];
|
||||
$this->motPassSms = $societe['motPassSms'];
|
||||
}
|
||||
|
||||
public function marquersms($idSms, $etat)
|
||||
{
|
||||
require_once 'Envoismscron.php';
|
||||
|
||||
$this->smscron = new Envoismscron();
|
||||
$smsaenvoyer = $this->smscron->marquersms($idSms, $etat);
|
||||
}
|
||||
|
||||
public function envoyer_les_sms()
|
||||
{
|
||||
$lesSms = $this->lesSms;
|
||||
|
||||
foreach ($lesSms as $un_sms)
|
||||
{
|
||||
$this->idSms = $un_sms['idSms'];
|
||||
$this->destinataires = $un_sms['destinataires'];
|
||||
$this->message = $un_sms['message'];
|
||||
|
||||
$this->envoyer_un_des_sms();
|
||||
|
||||
// sleep(1);
|
||||
usleep(2000); // Stoppe pour 2 millisecondes
|
||||
}
|
||||
}
|
||||
|
||||
public function envoyer_un_des_sms()
|
||||
{
|
||||
$destinataires = $this->destinataires;
|
||||
$message = $this->message;
|
||||
$fournisseurSms = $this->fournisseurSms;
|
||||
$nomProduitSante = $this->nomProduitSante;
|
||||
$titreSms = $this->titreSms;
|
||||
$fournisseurSms = $this->fournisseurSms;
|
||||
|
||||
|
||||
$dest = explode(',', $destinataires);
|
||||
foreach ($dest as $tel)
|
||||
{
|
||||
if($fournisseurSms=="esicia")
|
||||
{
|
||||
$this->envoyersmsesicia($tel, $message, $titreSms);
|
||||
}
|
||||
elseif($fournisseurSms=="blive")
|
||||
{
|
||||
$this->envoyersmsbliive($tel, $message, $titreSms);
|
||||
}
|
||||
elseif($fournisseurSms=="hooza")
|
||||
{
|
||||
$this->envoyersmshooza($tel, $message, $titreSms);
|
||||
}
|
||||
elseif($fournisseurSms=="skysms")
|
||||
{
|
||||
$this->envoyersmsskysms($tel, $message, $titreSms);
|
||||
}
|
||||
elseif($fournisseurSms=="satelcom")
|
||||
{
|
||||
$this->envoyersmssatelcom($tel, $message, $titreSms);
|
||||
}
|
||||
elseif($fournisseurSms=="noah")
|
||||
{
|
||||
$this->envoyersmsnoah($tel, $message, $titreSms);
|
||||
}
|
||||
elseif($fournisseurSms=="nerhysms")
|
||||
{
|
||||
$this->envoyersmsnerhysms($tel, $message, $titreSms);
|
||||
}
|
||||
elseif($fournisseurSms=="emisms")
|
||||
{
|
||||
$this->envoyersmsemisms($tel, $message, $titreSms);
|
||||
}
|
||||
elseif($fournisseurSms=="erling")
|
||||
{
|
||||
$this->envoyersmserling($tel, $message, $titreSms);
|
||||
}
|
||||
elseif($fournisseurSms=="ovh")
|
||||
{
|
||||
$this->envoyersmsovh($tel, $message, $titreSms);
|
||||
}
|
||||
elseif($fournisseurSms=="afriksms")
|
||||
{
|
||||
$this->envoyersmsafriksms($tel, $message, $titreSms);
|
||||
}
|
||||
elseif($fournisseurSms=="ekotech")
|
||||
{
|
||||
$this->envoyersmsekotech($tel, $message, $titreSms);
|
||||
}
|
||||
|
||||
// sleep(1);
|
||||
usleep(2000); // Stoppe pour 2 millisecondes
|
||||
}
|
||||
}
|
||||
|
||||
public function envoyersmsbliive($destinataires_c, $message_c, $titreSms_c)
|
||||
{
|
||||
$loginSms = $this->loginSms;
|
||||
$motPassSms = $this->motPassSms;
|
||||
|
||||
$url = "https://app.blive.bi/bridge-ws/ws/send";
|
||||
|
||||
$get = array
|
||||
(
|
||||
'id' =>$loginSms,
|
||||
'from' =>$titreSms_c,
|
||||
'to' =>$destinataires_c,
|
||||
'text' =>$message_c
|
||||
);
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_USERPWD, $motPassSms);
|
||||
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
|
||||
curl_setopt($ch, CURLOPT_POST, TRUE);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $get);
|
||||
|
||||
$result = curl_exec($ch);
|
||||
|
||||
if (curl_errno($ch))
|
||||
{
|
||||
echo 'Error:' . curl_error($ch);
|
||||
}
|
||||
|
||||
curl_close($ch);
|
||||
|
||||
$this->marquersms($this->idSms, "1");
|
||||
}
|
||||
|
||||
public function envoyersmsesicia($destinataires_c, $message_c, $titreSms_c)
|
||||
{
|
||||
$loginSms = $this->loginSms;
|
||||
$motPassSms = $this->motPassSms;
|
||||
|
||||
$url = "http://gateway.esicia.com/sendsms/?";
|
||||
|
||||
$postFields = array
|
||||
(
|
||||
'ohereza' =>$titreSms_c,
|
||||
'kuri' =>$destinataires_c,
|
||||
'ubutumwa' =>$message_c,
|
||||
'client' =>$loginSms,
|
||||
'password' =>$motPassSms,
|
||||
'msgid' =>'kanesin'
|
||||
);
|
||||
|
||||
$post = http_build_query($postFields);
|
||||
|
||||
$url .= $post;
|
||||
|
||||
$result = file_get_contents($url);
|
||||
|
||||
$this->marquersms($this->idSms, "1");
|
||||
}
|
||||
|
||||
public function envoyersmshooza($destinataires_c, $message_c, $titreSms_c)
|
||||
{
|
||||
$loginSms = $this->loginSms;
|
||||
$motPassSms = $this->motPassSms;
|
||||
|
||||
$url = "http://rslr.connectbind.com/bulksms/bulksms";
|
||||
|
||||
$get = array
|
||||
(
|
||||
'username' =>$loginSms,
|
||||
'password' =>$motPassSms,
|
||||
'type' =>'0',
|
||||
'dlr' =>'1',
|
||||
'destination' =>$destinataires_c,
|
||||
'source' =>$titreSms_c,
|
||||
'message' =>$message_c
|
||||
);
|
||||
|
||||
$defaults = array(
|
||||
CURLOPT_URL => $url. (strpos($url, '?') === FALSE ? '?' : ''). http_build_query($get),
|
||||
CURLOPT_HEADER => 0,
|
||||
CURLOPT_RETURNTRANSFER => TRUE,
|
||||
CURLOPT_TIMEOUT => 10
|
||||
);
|
||||
|
||||
$ch = curl_init();
|
||||
|
||||
curl_setopt_array($ch, ($defaults));
|
||||
if( ! $result = curl_exec($ch))
|
||||
{
|
||||
trigger_error(curl_error($ch));
|
||||
}
|
||||
|
||||
curl_close($ch);
|
||||
|
||||
$this->marquersms($this->idSms, "1");
|
||||
}
|
||||
|
||||
public function envoyersmsskysms($destinataires_c, $message_c, $titreSms_c)
|
||||
{
|
||||
$loginSms = $this->loginSms;
|
||||
$motPassSms = $this->motPassSms;
|
||||
|
||||
$url = "http://137.74.43.214:9000/api/public/sendsms/v2/output=text?";
|
||||
|
||||
$postFields = array
|
||||
(
|
||||
'user' => $loginSms,
|
||||
'password' => $motPassSms,
|
||||
'sender' => $titreSms_c,
|
||||
'phone' => $destinataires_c,
|
||||
'message' => $message_c
|
||||
);
|
||||
|
||||
$post = http_build_query($postFields);
|
||||
|
||||
$url .= $post;
|
||||
|
||||
$result = file_get_contents($url);
|
||||
|
||||
$this->marquersms($this->idSms, "1");
|
||||
}
|
||||
|
||||
public function envoyersmssatelcom($destinataires_c, $message_c, $titreSms_c)
|
||||
{
|
||||
$loginSms = $this->loginSms;
|
||||
$motPassSms = $this->motPassSms;
|
||||
|
||||
$url = "http://satelsms.satelcom.cd:8080/bulksms/bulksms?";
|
||||
|
||||
$postFields = array
|
||||
(
|
||||
'username' => $loginSms,
|
||||
'password' => $motPassSms,
|
||||
'type' => '0',
|
||||
'dlr' => '1',
|
||||
'destination' => $destinataires_c,
|
||||
'source' => $titreSms_c,
|
||||
'message' => $message_c
|
||||
);
|
||||
|
||||
$post = http_build_query($postFields);
|
||||
|
||||
$url .= $post;
|
||||
|
||||
$result = file_get_contents($url);
|
||||
|
||||
$this->marquersms($this->idSms, "1");
|
||||
}
|
||||
|
||||
public function envoyersmsnoah($destinataires_c, $message_c, $titreSms_c)
|
||||
{
|
||||
|
||||
$apiId = 'R1CU5E98NHGNZP7ER8GKSVJ11AEVL1';
|
||||
$suid = '5164CR45MTKYZ9';
|
||||
|
||||
$curl = curl_init();
|
||||
$post = array(
|
||||
"apiId" => $apiId,
|
||||
"suid" => $suid,
|
||||
"message" => $message_c,
|
||||
"numbers" => [$destinataires_c],
|
||||
"country" => "ci"
|
||||
);
|
||||
$postjson = json_encode($post);
|
||||
|
||||
curl_setopt_array($curl, array(
|
||||
CURLOPT_URL => 'https://texto.noahmobile.com/api/v1/send',
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_ENCODING => '',
|
||||
CURLOPT_MAXREDIRS => 10,
|
||||
CURLOPT_TIMEOUT => 0,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => 'POST',
|
||||
CURLOPT_POSTFIELDS =>$postjson,
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'NOMO-API-KEY: 8C537744BA5B5BB5BFFBA064E853FB16A7A6F002B775C',
|
||||
'Content-Type: application/json'
|
||||
),
|
||||
));
|
||||
|
||||
$response = curl_exec($curl);
|
||||
|
||||
|
||||
curl_close($curl);
|
||||
echo $response;
|
||||
|
||||
$this->marquersms($this->idSms, "1");
|
||||
|
||||
/*
|
||||
$user = "rkramo@vitalis-ci.com";
|
||||
$secret = "8dsuUuFvCGs9oi49kq9dTwPsw+ANiMWO9xJK@jin";
|
||||
$msg = rawurlencode($message_c);
|
||||
$receiver = urlencode($destinataires_c);
|
||||
|
||||
//$msg = $message_c;
|
||||
//$receiver = $destinataires_c;
|
||||
|
||||
$sender = $titreSms_c;
|
||||
$cltmsgid = "1";
|
||||
|
||||
$url = "http://sms.noahmobile.com/send_message/user/".$user."/secret/".$secret;
|
||||
$url .= "/msg/".$msg."/receiver/".$receiver."/sender/".$sender."/cltmsgid/".$cltmsgid;
|
||||
|
||||
|
||||
$curl = curl_init($url);
|
||||
curl_setopt_array($curl, [
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_TIMEOUT => 30
|
||||
]);
|
||||
|
||||
$data= curl_exec($curl);
|
||||
|
||||
|
||||
if($response===false){
|
||||
var_dump(curl_error($curl));
|
||||
}else{
|
||||
if(curl_getinfo($curl, CURLINFO_HTTP_CODE) === 200){
|
||||
|
||||
|
||||
$this->marquersms($this->idSms, "1");
|
||||
|
||||
$data = json_decode($data,true);
|
||||
|
||||
echo '<pre>';
|
||||
var_dump($data);
|
||||
echo '</pre>';
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
curl_close($curl);
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
public function envoyersmsnerhysms($destinataires_c, $message_c, $titreSms_c)
|
||||
{
|
||||
|
||||
$post = array(
|
||||
"from" => $titreSms_c,
|
||||
"content"=> $message_c,
|
||||
"to" => [$destinataires_c]
|
||||
);
|
||||
|
||||
$postjson = json_encode($post);
|
||||
|
||||
|
||||
$curl = curl_init();
|
||||
|
||||
curl_setopt_array($curl, array(
|
||||
CURLOPT_URL => 'https://app.nerhysms.com/api/send/multiple',
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_ENCODING => '',
|
||||
CURLOPT_MAXREDIRS => 10,
|
||||
CURLOPT_TIMEOUT => 0,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => 'POST',
|
||||
CURLOPT_POSTFIELDS =>$postjson,
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Authorization: Bearer 97e9dab8fa04aad831b1f41b80',
|
||||
'Content-Type: application/json'
|
||||
),
|
||||
));
|
||||
|
||||
$response = curl_exec($curl);
|
||||
|
||||
curl_close($curl);
|
||||
echo $response;
|
||||
|
||||
$this->marquersms($this->idSms, "1");
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
public function envoyersmsemisms($destinataires_c, $message_c, $titreSms_c)
|
||||
{
|
||||
$loginSms = $this->loginSms;
|
||||
$motPassSms = $this->motPassSms;
|
||||
|
||||
$url = "https://app.emisms.com/sms/api?";
|
||||
|
||||
$postFields = array
|
||||
(
|
||||
'action' => $loginSms,
|
||||
'api_key' => $motPassSms,
|
||||
'to' => $destinataires_c,
|
||||
'from' => $titreSms_c,
|
||||
'sms' => $message_c
|
||||
);
|
||||
|
||||
$post = http_build_query($postFields);
|
||||
|
||||
$url .= $post;
|
||||
|
||||
$result = file_get_contents($url);
|
||||
|
||||
$this->marquersms($this->idSms, "1");
|
||||
}
|
||||
|
||||
public function envoyersmserling($destinataires_c, $message_c, $titreSms_c)
|
||||
{
|
||||
$loginSms = $this->loginSms;
|
||||
$motPassSms = $this->motPassSms;
|
||||
|
||||
$url = "http://erling.vavasms.com/api/v1/text/single";
|
||||
|
||||
$get = array
|
||||
(
|
||||
'api_key' =>$motPassSms,
|
||||
'sender_id' =>$titreSms_c,
|
||||
'phone' =>$destinataires_c,
|
||||
'message' =>$message_c
|
||||
);
|
||||
|
||||
$defaults = array(
|
||||
CURLOPT_URL => $url. (strpos($url, '?') === FALSE ? '?' : ''). http_build_query($get),
|
||||
CURLOPT_HEADER => 0,
|
||||
CURLOPT_RETURNTRANSFER => TRUE,
|
||||
CURLOPT_TIMEOUT => 10
|
||||
);
|
||||
|
||||
$ch = curl_init();
|
||||
|
||||
curl_setopt_array($ch, ($defaults));
|
||||
if( ! $result = curl_exec($ch))
|
||||
{
|
||||
trigger_error(curl_error($ch));
|
||||
}
|
||||
|
||||
curl_close($ch);
|
||||
|
||||
$this->marquersms($this->idSms, "1");
|
||||
}
|
||||
|
||||
public function envoyersmsovh($destinataires_c, $message_c, $titreSms_c)
|
||||
{
|
||||
$loginSms = $this->loginSms;
|
||||
$motPassSms = $this->motPassSms;
|
||||
$titreSms = $this->titreSms;
|
||||
$compteSms = $this->compteSms;
|
||||
|
||||
$url = "https://www.ovh.com/cgi-bin/sms/http2sms.cgi?";
|
||||
|
||||
$get = array
|
||||
(
|
||||
'account' => $compteSms,
|
||||
'login' => $loginSms,
|
||||
'password' => $motPassSms,
|
||||
// 'from' => 'INTERSANTE',
|
||||
'from' => $titreSms,
|
||||
'to' => $destinataires_c,
|
||||
'message' => $message_c
|
||||
);
|
||||
|
||||
$defaults = array(
|
||||
CURLOPT_URL => $url. (strpos($url, '?') === FALSE ? '?' : ''). http_build_query($get),
|
||||
CURLOPT_HEADER => 0,
|
||||
CURLOPT_RETURNTRANSFER => TRUE,
|
||||
CURLOPT_TIMEOUT => 10
|
||||
);
|
||||
|
||||
$ch = curl_init();
|
||||
|
||||
curl_setopt_array($ch, ($defaults));
|
||||
if( ! $result = curl_exec($ch))
|
||||
{
|
||||
trigger_error(curl_error($ch));
|
||||
}
|
||||
|
||||
curl_close($ch);
|
||||
|
||||
$this->marquersms($this->idSms, "1");
|
||||
}
|
||||
|
||||
public function envoyersmsafriksms($destinataires_c, $message_c, $titreSms_c)
|
||||
{
|
||||
|
||||
$curl = curl_init();
|
||||
|
||||
$loginSms = $this->loginSms;
|
||||
$motPassSms = $this->motPassSms;
|
||||
$titreSms = $this->titreSms;
|
||||
$compteSms = $this->compteSms;
|
||||
|
||||
$url = "https://api.afriksms.com/api/web/web_v1/outbounds/send?";
|
||||
|
||||
$postFields = array
|
||||
(
|
||||
'ClientId' => $loginSms,
|
||||
'ApiKey' => $motPassSms,
|
||||
'SenderId' => $titreSms,
|
||||
'Message' => $message_c,
|
||||
'MobileNumbers' => $destinataires_c
|
||||
);
|
||||
|
||||
$post = http_build_query($postFields);
|
||||
|
||||
$url .= $post;
|
||||
|
||||
curl_setopt_array
|
||||
(
|
||||
$curl,
|
||||
array
|
||||
(
|
||||
CURLOPT_URL => $url,
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_ENCODING => '',
|
||||
CURLOPT_MAXREDIRS => 10,
|
||||
CURLOPT_TIMEOUT => 0,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => 'GET',
|
||||
)
|
||||
);
|
||||
|
||||
$response = curl_exec($curl);
|
||||
// var_dump($response);
|
||||
|
||||
curl_close($curl);
|
||||
|
||||
$this->marquersms($this->idSms, "1");
|
||||
}
|
||||
|
||||
public function envoyersmsekotech($destinataires_c, $message_c, $titreSms_c)
|
||||
{
|
||||
|
||||
$curl = curl_init();
|
||||
|
||||
$loginSms = $this->loginSms;
|
||||
$motPassSms = $this->motPassSms;
|
||||
$titreSms = $this->titreSms;
|
||||
|
||||
$url = "https://api-public.ekotech.cm/messages";
|
||||
|
||||
curl_setopt_array($curl, array(
|
||||
CURLOPT_URL => $url,
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_ENCODING => "",
|
||||
CURLOPT_MAXREDIRS => 10,
|
||||
CURLOPT_TIMEOUT => 30,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => "POST",
|
||||
CURLOPT_POSTFIELDS => "username=$loginSms&password=$motPassSms&msisdn=$destinataires_c&msg=$message_c&sender=$titreSms"
|
||||
));
|
||||
|
||||
$response = curl_exec($curl);
|
||||
// var_dump($response);
|
||||
|
||||
curl_close($curl);
|
||||
|
||||
$this->marquersms($this->idSms, "1");
|
||||
}
|
||||
}
|
||||
// FIN CLASSE
|
||||
|
||||
// envoi des SMS
|
||||
$envoismsdivers = new Cronenvoisms();
|
||||
|
||||
$envoismsdivers->chargersociete();
|
||||
|
||||
$nbSms = $envoismsdivers->nbSmsParCron;
|
||||
|
||||
$envoismsdivers->charger_les_sms($nbSms);
|
||||
|
||||
$envoismsdivers->envoyer_les_sms();
|
||||
43
Cron/Cronfacturesaaschaquemois.php
Executable file
43
Cron/Cronfacturesaaschaquemois.php
Executable file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
require_once 'Societeusercentral.php';
|
||||
require_once 'Crongenererfacturesaas.php';
|
||||
|
||||
class Cronfacturesaaschaquemois
|
||||
{
|
||||
private $societeusercentral;
|
||||
private $cronfacturesaas;
|
||||
|
||||
public function __construct() {
|
||||
|
||||
}
|
||||
|
||||
public function executer()
|
||||
{
|
||||
$this->societeusercentral = new Societeusercentral();
|
||||
$this->cronfacturesaas = new Crongenererfacturesaas();
|
||||
|
||||
$liste_societeuser = $this->societeusercentral->getSocieteusers();
|
||||
|
||||
$_SESSION['old_codeSociete']="";
|
||||
|
||||
foreach ($liste_societeuser as $societeuser)
|
||||
{
|
||||
$codeSociete = $societeuser['codeSociete'];
|
||||
$smsNotificationSaas = $societeuser['smsNotificationSaas'];
|
||||
$mailNotificationSaas = $societeuser['mailNotificationSaas'];
|
||||
|
||||
$_SESSION['c_codeSociete'] = $codeSociete;
|
||||
|
||||
$nbAssures = $this->cronfacturesaas->counter_assure_saas_mois($codeSociete);
|
||||
|
||||
$dateFacture=date('Y-m-d');
|
||||
|
||||
$this->societeusercentral->inserer_facture_saas($codeSociete, $dateFacture, $nbAssures);
|
||||
|
||||
$this->cronfacturesaas->envoyer_notification_facture_saas_mois($codeSociete, $smsNotificationSaas, $mailNotificationSaas);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Execution
|
||||
$cronfacturesaaschaquemois = new Cronfacturesaaschaquemois();
|
||||
$cronfacturesaaschaquemois->executer();
|
||||
28
Cron/Crongenererfacturesaas.php
Executable file
28
Cron/Crongenererfacturesaas.php
Executable file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
require_once 'Functions.php';
|
||||
|
||||
class Crongenererfacturesaas
|
||||
{
|
||||
public function __construct() {
|
||||
}
|
||||
|
||||
public function counter_assure_saas_mois($codeSociete)
|
||||
{
|
||||
require_once 'Genererfacturesaascron.php';
|
||||
|
||||
$this->facturesaascron = new Genererfacturesaascron();
|
||||
|
||||
return $this->facturesaascron->counter_assure_saas_mois($codeSociete);
|
||||
}
|
||||
|
||||
|
||||
public function envoyer_notification_facture_saas_mois($codeSociete, $smsNotificationSaas, $mailNotificationSaas)
|
||||
{
|
||||
require_once 'Genererfacturesaascron.php';
|
||||
|
||||
$this->facturesaascron = new Genererfacturesaascron();
|
||||
|
||||
$this->facturesaascron->envoyer_notification_facture_saas_mois($codeSociete, $smsNotificationSaas, $mailNotificationSaas);
|
||||
}
|
||||
|
||||
}
|
||||
76
Cron/Cronnettoyerfichierstemp.php
Executable file
76
Cron/Cronnettoyerfichierstemp.php
Executable file
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
require_once 'Functions.php';
|
||||
|
||||
class Cronnettoyerfihierstemp
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
// function suppression($dossier_traite , $extension_choisie, $age_requis)
|
||||
function suppression($dossier_traite , $age_requis)
|
||||
{
|
||||
$repertoire = opendir($dossier_traite);
|
||||
|
||||
while(false !== ($fichier = readdir($repertoire)))
|
||||
{
|
||||
$chemin = $dossier_traite."/".$fichier;
|
||||
|
||||
|
||||
$infos = pathinfo($chemin);
|
||||
// $extension = $infos['extension'];
|
||||
|
||||
$age_fichier = time() - filemtime($chemin);
|
||||
|
||||
// if($fichier!="." AND $fichier!=".." AND !is_dir($fichier)
|
||||
// $extension == $extension_choisie AND $age_fichier > $age_requis)
|
||||
|
||||
/*
|
||||
echo "Chemai, : ".$chemin." Age : ".$age_fichier;
|
||||
|
||||
echo "<br>";
|
||||
*/
|
||||
|
||||
if($fichier!="." AND $fichier!=".." AND !is_dir($fichier) AND $age_fichier > $age_requis)
|
||||
{
|
||||
unlink($chemin);
|
||||
}
|
||||
}
|
||||
|
||||
closedir($repertoire); // On ferme !
|
||||
}
|
||||
|
||||
function suppressionimport($dossier_traite , $age_requis)
|
||||
{
|
||||
$repertoire = opendir($dossier_traite);
|
||||
|
||||
while(false !== ($fichier = readdir($repertoire)))
|
||||
{
|
||||
$chemin = $dossier_traite."/".$fichier;
|
||||
|
||||
|
||||
$infos = pathinfo($chemin);
|
||||
// $extension = $infos['extension'];
|
||||
|
||||
$age_fichier = time() - filemtime($chemin);
|
||||
|
||||
if($fichier!="." AND $fichier!=".." AND !is_dir($fichier) AND $age_fichier > $age_requis)
|
||||
{
|
||||
unlink($chemin);
|
||||
}
|
||||
}
|
||||
|
||||
closedir($repertoire); // On ferme !
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$nettoyerfihierstemp = new Cronnettoyerfihierstemp();
|
||||
|
||||
$nettoyerfihierstemp->suppression( "../Temp" , "3600" );
|
||||
|
||||
$nettoyerfihierstemp->suppression( "../Temp/import" , "432000" );
|
||||
|
||||
|
||||
?>
|
||||
35
Cron/Cronnouvelexercice.php
Executable file
35
Cron/Cronnouvelexercice.php
Executable file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
require_once 'Societeusercentral.php';
|
||||
require_once 'Societeuser.php';
|
||||
|
||||
class Cronnouvelexercice
|
||||
{
|
||||
private $societeusercentral;
|
||||
private $societeuser;
|
||||
|
||||
public function __construct() {
|
||||
|
||||
}
|
||||
|
||||
public function executer()
|
||||
{
|
||||
$this->societeusercentral = new Societeusercentral();
|
||||
$this->societeuser = new Societeuser();
|
||||
|
||||
$liste_societeuser = $this->societeusercentral->getSocieteusers();
|
||||
|
||||
$_SESSION['old_codeSociete']="";
|
||||
|
||||
foreach ($liste_societeuser as $societeuser)
|
||||
{
|
||||
$codeSociete = $societeuser['codeSociete'];
|
||||
|
||||
$_SESSION['c_codeSociete'] = $codeSociete;
|
||||
|
||||
$this->societeuser->creer_exercice_saas($codeSociete);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Execution
|
||||
$cronnouvelexercice = new Cronnouvelexercice();
|
||||
$cronnouvelexercice->executer();
|
||||
25
Cron/Cronrapportsp.php
Executable file
25
Cron/Cronrapportsp.php
Executable file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
class Cronrapportsp
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
public function lancer_archivage()
|
||||
{
|
||||
require_once 'Statistique.php';
|
||||
|
||||
$this->statistique = new Statistique();
|
||||
$this->statistique->initstat();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Lancer archivage
|
||||
|
||||
$cronrapportsp = new Cronrapportsp();
|
||||
|
||||
$cronrapportsp->lancer_archivage();
|
||||
22
Cron/Derogation.php
Executable file
22
Cron/Derogation.php
Executable file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
require_once 'Modele.php';
|
||||
|
||||
class Derogation extends Modele {
|
||||
|
||||
public function getInfos($codeDerogation)
|
||||
{
|
||||
$sql = 'select libelle, libelleEng from p_derogation where (codeDerogation=?)';
|
||||
$resultat = $this->executerRequete($sql, array($codeDerogation));
|
||||
return $resultat->fetch(PDO::FETCH_ASSOC);
|
||||
}
|
||||
|
||||
public function getinfosDerogation($idDemandederogation)
|
||||
{
|
||||
$sql = 'call sp_get_infos_derogation(?)';
|
||||
|
||||
$resultat = $this->executerRequete($sql, array($idDemandederogation));
|
||||
|
||||
return $resultat->fetch(PDO::FETCH_ASSOC);
|
||||
}
|
||||
|
||||
}
|
||||
15
Cron/Destinataire.php
Executable file
15
Cron/Destinataire.php
Executable file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
require_once 'Modele.php';
|
||||
|
||||
class Destinataire extends Modele {
|
||||
|
||||
public function listedestinataires()
|
||||
{
|
||||
$sql = "select email from destinataire_mail where (email>' ') order by email;";
|
||||
|
||||
$resultat = $this->executerRequete($sql);
|
||||
|
||||
return $resultat->fetchAll(PDO::FETCH_ASSOC);
|
||||
}
|
||||
|
||||
}
|
||||
41
Cron/Ebenegmail.php
Executable file
41
Cron/Ebenegmail.php
Executable file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
use PHPMailer\PHPMailer\PHPMailer;
|
||||
use PHPMailer\PHPMailer\Exception;
|
||||
|
||||
// Inclusion des fichiers
|
||||
require 'PHPMailer/Exception.php';
|
||||
require 'PHPMailer/PHPMailer.php';
|
||||
require 'PHPMailer/SMTP.php';
|
||||
|
||||
$mail = new PHPMailer(true);
|
||||
$mail->CharSet = 'UTF-8'; // Utiliser UTF-8
|
||||
$mail->Encoding = 'base64'; // Encodage du contenu
|
||||
$mail->isSMTP();
|
||||
|
||||
//Enable SMTP debugging
|
||||
// 0 = off (for production use)
|
||||
// 1 = client messages
|
||||
// 2 = // dev => client and server messages
|
||||
// $mail->SMTPDebug = 2; // dev => client and server messages
|
||||
$mail->SMTPDebug = 0;
|
||||
|
||||
// $mail->Debugoutput = 'html';
|
||||
|
||||
$mail->Host = 'smtp.gmail.com';
|
||||
// $mail->Host = gethostbyname('smtp.gmail.com');
|
||||
// if your network does not support SMTP over IPv6
|
||||
|
||||
$mail->Port = 587;
|
||||
|
||||
$mail->SMTPSecure = 'tls';
|
||||
|
||||
$mail->SMTPAuth = true;
|
||||
|
||||
$mail->Username = "intersantesaas@gmail.com";
|
||||
// $mail->Password = "Moritio1973";
|
||||
$mail->Password = "qvix febq ylkp enks";
|
||||
|
||||
$mail->setFrom('intersantesaas@gmail.com', 'INTER-SANTE : EBENE');
|
||||
|
||||
$_SESSION['c_mail'] = $mail;
|
||||
58
Cron/Ebenegmail_old.php
Executable file
58
Cron/Ebenegmail_old.php
Executable file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
// date_default_timezone_set('Etc/UTC');
|
||||
// date_default_timezone_set("Africa/Kigali");
|
||||
|
||||
require 'PHPMailer/PHPMailerAutoload.php';
|
||||
|
||||
$mail = new PHPMailer(true);
|
||||
$mail->CharSet = 'UTF-8'; // Utiliser UTF-8
|
||||
$mail->Encoding = 'base64'; // Encodage du contenu
|
||||
$mail->isSMTP();
|
||||
|
||||
/*
|
||||
$mail = new PHPMailer;
|
||||
$mail->CharSet = 'UTF-8';
|
||||
$mail->isSMTP();
|
||||
*/
|
||||
|
||||
/*
|
||||
$mail = new PHPMailer(true);
|
||||
$mail->CharSet = 'UTF-8'; // Utiliser UTF-8
|
||||
$mail->Encoding = 'base64'; // Encodage du contenu
|
||||
$mail->isHTML(true); // Si tu envoies du HTML
|
||||
*/
|
||||
|
||||
//Enable SMTP debugging
|
||||
// 0 = off (for production use)
|
||||
// 1 = client messages
|
||||
// 2 = // dev => client and server messages
|
||||
// $mail->SMTPDebug = 2; // dev => client and server messages
|
||||
$mail->SMTPDebug = 0;
|
||||
|
||||
// $mail->Debugoutput = 'html';
|
||||
|
||||
$mail->Host = 'smtp.gmail.com';
|
||||
// $mail->Host = gethostbyname('smtp.gmail.com');
|
||||
// if your network does not support SMTP over IPv6
|
||||
|
||||
$mail->Port = 587;
|
||||
|
||||
$mail->SMTPSecure = 'tls';
|
||||
|
||||
$mail->SMTPAuth = true;
|
||||
|
||||
// $mail->Username = "intersanteebene@gmail.com";
|
||||
$mail->Username = "intersantesaas@gmail.com";
|
||||
// $mail->Password = "Moritio1973";
|
||||
// $mail->Password = "hftebsmxzqviinuh";
|
||||
$mail->Password = "qvix febq ylkp enks";
|
||||
|
||||
// $mail->setFrom('intersanteebene@gmail.com', 'INTER-SANTE : EBENE');
|
||||
$mail->setFrom('intersantesaas@gmail.com', 'INTER-SANTE : EBENE');
|
||||
// $mail->addReplyTo('verification@radiant.rw', 'RADIANT INSURANCE COMPANY');
|
||||
|
||||
$_SESSION['c_mail'] = $mail;
|
||||
|
||||
// à activer en cas de besoin
|
||||
// $mail->msgHTML(file_get_contents('contents.html'), dirname(__FILE__));
|
||||
|
||||
107
Cron/Emaildivers.php
Executable file
107
Cron/Emaildivers.php
Executable file
@@ -0,0 +1,107 @@
|
||||
<?php
|
||||
require_once 'Functions.php';
|
||||
require_once 'Controleurrequete.php';
|
||||
require_once 'Destinataire.php';
|
||||
|
||||
|
||||
class Emaildivers
|
||||
{
|
||||
private $destinataire;
|
||||
private $mail_C;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->destinataire = new Destinataire();
|
||||
require_once 'Ebenegmail.php';
|
||||
$this->mail_C = $mail;
|
||||
}
|
||||
|
||||
public function excutercron()
|
||||
{
|
||||
// echo "Emaildivers";
|
||||
// exit();
|
||||
|
||||
$destinataires = $this->destinataire->listedestinataires();
|
||||
|
||||
$compteur = 0;
|
||||
|
||||
foreach ($destinataires as $destinataire)
|
||||
{
|
||||
$compteur += 1;
|
||||
|
||||
/*
|
||||
if($compteur>4)
|
||||
{
|
||||
echo "FIN Emaildivers";
|
||||
exit();
|
||||
}
|
||||
*/
|
||||
|
||||
// $codePrestataire = $prestataire['codePrestataire'];
|
||||
// $libelle = $prestataire['libelle'];
|
||||
|
||||
$email = $destinataire['email'];
|
||||
|
||||
// Pour tester
|
||||
|
||||
// $email = "lkane@ebene.info";
|
||||
|
||||
// echo "$compteur $codePrestataire $libelle $email ";
|
||||
// echo '</BR>'; echo '</BR>';
|
||||
// Fin tests */
|
||||
|
||||
|
||||
// DEBUT ENVOI DU MAIL AVEC PIECE JOINTE
|
||||
|
||||
$mail_C = $this->mail_C;
|
||||
|
||||
$mail_C->ClearAllRecipients();
|
||||
|
||||
$mail_C->clearAttachments();
|
||||
|
||||
$addr = explode(';', $email);
|
||||
foreach ($addr as $ad)
|
||||
{
|
||||
$mail_C->AddAddress(trim($ad) );
|
||||
}
|
||||
|
||||
$mail_C->AddCC("prugira@radiant.rw");
|
||||
$mail_C->AddCC("imugabo@radiant.rw");
|
||||
// $mail_C->AddCC("lkane@ebene.info");
|
||||
|
||||
$obejt = "RADIANT INSURANCE COMPANY : INFORMATION";
|
||||
$body = "Mufatanyabikorwa wacu,
|
||||
|
||||
Tunejejwe no kubamenyesha ko redressement igiye kujya ikorerwa muri systeme yacu nshya ya Intersante.Turabasaba ko mwaduha Email adresse ndetse na numero ya telephone tuzajya twoherezaho ubutumwa igihe hari facture yarangiye ikeneye redressement.
|
||||
Mugire akazi keza.
|
||||
|
||||
Murakoze.";
|
||||
|
||||
$mail_C->Subject = $obejt;
|
||||
|
||||
$mail_C->AltBody = $altbody;
|
||||
$mail_C->Body=$body;
|
||||
|
||||
// var_dump($mail_C);
|
||||
|
||||
if (!$mail_C->send())
|
||||
{
|
||||
// echo "Erreur mail : " . $mail_C->ErrorInfo;
|
||||
}
|
||||
else
|
||||
{
|
||||
// echo "Message envoyé!";
|
||||
}
|
||||
|
||||
// FIN ENVOI DU MAIL AVEC PIECE JOINTE
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// echo '</BR>'; echo '</BR>';
|
||||
|
||||
$emaildivers = new Emaildivers();
|
||||
// date_default_timezone_set("Africa/Kigali");
|
||||
$emaildivers->excutercron();
|
||||
echo "Fin Tache Cron";
|
||||
94
Cron/Emaildiverspj.php
Executable file
94
Cron/Emaildiverspj.php
Executable file
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
require_once 'Functions.php';
|
||||
require_once 'Controleurrequete.php';
|
||||
require_once 'Destinataire.php';
|
||||
|
||||
|
||||
class Emaildiverspj
|
||||
{
|
||||
private $destinataire;
|
||||
private $mail_C;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->destinataire = new Destinataire();
|
||||
require_once 'Ebenegmail.php';
|
||||
$this->mail_C = $mail;
|
||||
}
|
||||
|
||||
public function excutercron()
|
||||
{
|
||||
$destinataires = $this->destinataire->listedestinataires();
|
||||
|
||||
$compteur = 0;
|
||||
|
||||
foreach ($destinataires as $destinataire)
|
||||
{
|
||||
$compteur += 1;
|
||||
|
||||
// $codePrestataire = $prestataire['codePrestataire'];
|
||||
// $libelle = $prestataire['libelle'];
|
||||
$email = $destinataire['email'];
|
||||
|
||||
// Pour tester
|
||||
|
||||
// $email = "lkane@ebene.info";
|
||||
|
||||
echo "$compteur $codePrestataire $libelle $email ";
|
||||
echo '</BR>'; echo '</BR>';
|
||||
// Fin tests */
|
||||
|
||||
// DEBUT ENVOI DU MAIL AVEC PIECE JOINTE
|
||||
|
||||
/*
|
||||
|
||||
$mail_C = $this->mail_C;
|
||||
|
||||
$mail_C->ClearAllRecipients();
|
||||
|
||||
$mail_C->clearAttachments();
|
||||
|
||||
$addr = explode(';', $email);
|
||||
foreach ($addr as $ad)
|
||||
{
|
||||
$mail_C->AddAddress(trim($ad) );
|
||||
}
|
||||
|
||||
$mail_C->AddCC("prugira@radiant.rw");
|
||||
$mail_C->AddCC("imugabo@radiant.rw");
|
||||
|
||||
$obejt = "RADIANT INSURANCE COMPANY : INFORMATION";
|
||||
$body = "Kubafatanya bikorwa bacu,
|
||||
Twabamenyeshaga ko uwaba agifite imbongamizi akeneye ubufasha mugukoresha system nshya Intersante yasimbuye smart ko kuwagatanu sambiri le 29/6/2018 hateganyijwe amahugurwa aha kukicaro gikuru cya Radiant kuri CHIC sambiri,uwaba agifite ikibazo yakohereza umuntu akaza akongera agahugurwa.
|
||||
Tubaye tubashimiye.";
|
||||
|
||||
$mail_C->Subject = $obejt;
|
||||
|
||||
$mail_C->AltBody = $altbody;
|
||||
$mail_C->Body=$body;
|
||||
|
||||
// var_dump($mail_C);
|
||||
|
||||
if (!$mail_C->send())
|
||||
{
|
||||
// echo "Erreur mail : " . $mail_C->ErrorInfo;
|
||||
}
|
||||
else
|
||||
{
|
||||
// echo "Message envoyé!";
|
||||
}
|
||||
|
||||
// FIN ENVOI DU MAIL AVEC PIECE JOINTE
|
||||
|
||||
*/
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// echo '</BR>'; echo '</BR>';
|
||||
|
||||
$emaildiverspj = new Emaildiverspj();
|
||||
// date_default_timezone_set("Africa/Kigali");
|
||||
$emaildiverspj->excutercron();
|
||||
echo "Fin Tache Cron";
|
||||
97
Cron/Emailprestataires.php
Executable file
97
Cron/Emailprestataires.php
Executable file
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
require_once 'Functions.php';
|
||||
require_once 'Controleurrequete.php';
|
||||
require_once 'Prestataire.php';
|
||||
|
||||
|
||||
class Emailprestataires
|
||||
{
|
||||
private $prestataire;
|
||||
private $mail_C;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->prestataire = new Prestataire();
|
||||
require_once 'Ebenegmail.php';
|
||||
$this->mail_C = $mail;
|
||||
}
|
||||
|
||||
public function excutercron()
|
||||
{
|
||||
$prestataires = $this->prestataire->listemailprestataire();
|
||||
|
||||
$compteur = 0;
|
||||
|
||||
foreach ($prestataires as $prestataire)
|
||||
{
|
||||
// codePrestataire, libelle, email
|
||||
$compteur += 1;
|
||||
|
||||
$codePrestataire = $prestataire['codePrestataire'];
|
||||
$libelle = $prestataire['libelle'];
|
||||
$email = $prestataire['email'];
|
||||
|
||||
// Pour tester
|
||||
|
||||
// $email = "lkane@ebene.info";
|
||||
|
||||
// echo "$compteur $codePrestataire $libelle $email ";
|
||||
// echo '</BR>'; echo '</BR>';
|
||||
// Fin tests */
|
||||
|
||||
// DEBUT ENVOI DU MAIL AVEC PIECE JOINTE
|
||||
|
||||
$mail_C = $this->mail_C;
|
||||
|
||||
$mail_C->ClearAllRecipients();
|
||||
|
||||
// $mail_C->clearAttachments();
|
||||
|
||||
// pour envoi à moi seul
|
||||
// $email = "kanelazeni@gmail.com";
|
||||
// fin envoi à moi seul
|
||||
|
||||
$addr = explode(';', $email);
|
||||
foreach ($addr as $ad)
|
||||
{
|
||||
$mail_C->AddAddress(trim($ad) );
|
||||
}
|
||||
|
||||
$mail_C->AddCC("prugira@radiant.rw");
|
||||
$mail_C->AddCC("imugabo@radiant.rw");
|
||||
|
||||
$obejt = "RADIANT INSURANCE COMPANY : INFORMATION";
|
||||
$body = "Ku bafanyabikorwa bacu mu bwishingizi bwo kwivuza,
|
||||
|
||||
Muraho.Dushingiye ku itegeko rishya rigenga imisoro ryasohotse mu I Gazeti numero ….yo ku wa 16/04/2018, mu ngingo yayo ya 60, twifuzaga gusaba abafatanyabikorwa bacu bose ko mwatugezaho byihutirwa C.I.T(COPERATE INCOME TAX ) (UMUSORO KUNYUNGU ) Kugirango tubashe kwishyura twubahiriza itegeko kandi twirinda ingaruka zabaho igihe amategeko atubahirijwe.
|
||||
|
||||
Twizeye ko mubyakira neza, mugire amahoro";
|
||||
|
||||
$mail_C->Subject = $obejt;
|
||||
|
||||
$mail_C->AltBody = $altbody;
|
||||
$mail_C->Body=$body;
|
||||
|
||||
// var_dump($mail_C);
|
||||
|
||||
if (!$mail_C->send())
|
||||
{
|
||||
// echo "Erreur mail : " . $mail_C->ErrorInfo;
|
||||
}
|
||||
else
|
||||
{
|
||||
// echo "Message envoyé!";
|
||||
}
|
||||
|
||||
// FIN ENVOI DU MAIL AVEC PIECE JOINTE
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// echo '</BR>'; echo '</BR>';
|
||||
|
||||
$emailprestataires = new Emailprestataires();
|
||||
date_default_timezone_set("Africa/Kigali");
|
||||
$emailprestataires->excutercron();
|
||||
echo "Fin Tache Cron";
|
||||
98
Cron/Emailprestatairesdoublon.php
Executable file
98
Cron/Emailprestatairesdoublon.php
Executable file
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
require_once 'Functions.php';
|
||||
require_once 'Controleurrequete.php';
|
||||
require_once 'Prestataire.php';
|
||||
|
||||
|
||||
class Emailprestatairesdoublon
|
||||
{
|
||||
private $prestataire;
|
||||
private $mail_C;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->prestataire = new Prestataire();
|
||||
require_once 'Ebenegmail.php';
|
||||
$this->mail_C = $mail;
|
||||
}
|
||||
|
||||
public function excutercron()
|
||||
{
|
||||
// $prestataires = $this->prestataire->listemailprestataire();
|
||||
$prestataires = $this->prestataire->listemailprestatairedoublon();
|
||||
|
||||
$compteur = 0;
|
||||
|
||||
foreach ($prestataires as $prestataire)
|
||||
{
|
||||
// codePrestataire, libelle, email
|
||||
$compteur += 1;
|
||||
|
||||
$codePrestataire = $prestataire['codePrestataire'];
|
||||
$libelle = $prestataire['libelle'];
|
||||
$email = $prestataire['email'];
|
||||
|
||||
// Pour tester
|
||||
|
||||
// $email = "lkane@ebene.info";
|
||||
|
||||
// echo "$compteur $codePrestataire $libelle $email ";
|
||||
// echo '</BR>'; echo '</BR>';
|
||||
// Fin tests */
|
||||
|
||||
// DEBUT ENVOI DU MAIL AVEC PIECE JOINTE
|
||||
|
||||
$mail_C = $this->mail_C;
|
||||
|
||||
$mail_C->ClearAllRecipients();
|
||||
|
||||
// $mail_C->clearAttachments();
|
||||
|
||||
// pour envoi à moi seul
|
||||
// $email = "kanelazeni@gmail.com";
|
||||
// fin envoi à moi seul
|
||||
|
||||
$addr = explode(';', $email);
|
||||
foreach ($addr as $ad)
|
||||
{
|
||||
$mail_C->AddAddress(trim($ad) );
|
||||
}
|
||||
|
||||
$mail_C->AddCC("prugira@radiant.rw");
|
||||
$mail_C->AddCC("imugabo@radiant.rw");
|
||||
|
||||
$obejt = "RADIANT INSURANCE COMPANY : INFORMATION";
|
||||
$body = "Ku bafanyabikorwa bacu mu bwishingizi bwo kwivuza,
|
||||
|
||||
Muraho.Dushingiye ku itegeko rishya rigenga imisoro ryasohotse mu I Gazeti numero ….yo ku wa 16/04/2018, mu ngingo yayo ya 60, twifuzaga gusaba abafatanyabikorwa bacu bose ko mwatugezaho byihutirwa C.I.T(COPERATE INCOME TAX ) (UMUSORO KUNYUNGU ) Kugirango tubashe kwishyura twubahiriza itegeko kandi twirinda ingaruka zabaho igihe amategeko atubahirijwe.
|
||||
|
||||
Twizeye ko mubyakira neza, mugire amahoro";
|
||||
|
||||
$mail_C->Subject = $obejt;
|
||||
|
||||
$mail_C->AltBody = $altbody;
|
||||
$mail_C->Body=$body;
|
||||
|
||||
// var_dump($mail_C);
|
||||
|
||||
if (!$mail_C->send())
|
||||
{
|
||||
// echo "Erreur mail : " . $mail_C->ErrorInfo;
|
||||
}
|
||||
else
|
||||
{
|
||||
// echo "Message envoyé!";
|
||||
}
|
||||
|
||||
// FIN ENVOI DU MAIL AVEC PIECE JOINTE
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// echo '</BR>'; echo '</BR>';
|
||||
|
||||
$emailprestataires = new Emailprestatairesdoublon();
|
||||
// date_default_timezone_set("Africa/Kigali");
|
||||
$emailprestataires->excutercron();
|
||||
echo "Fin Tache Cron";
|
||||
100
Cron/Emailprestatairespublics.php
Executable file
100
Cron/Emailprestatairespublics.php
Executable file
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
require_once 'Functions.php';
|
||||
require_once 'Controleurrequete.php';
|
||||
require_once 'Prestataire.php';
|
||||
|
||||
|
||||
class Emailprestatairespublics
|
||||
{
|
||||
private $prestataire;
|
||||
private $mail_C;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->prestataire = new Prestataire();
|
||||
require_once 'Ebenegmail.php';
|
||||
$this->mail_C = $mail;
|
||||
}
|
||||
|
||||
public function excutercron()
|
||||
{
|
||||
// $prestataires = $this->prestataire->listemailprestataire();
|
||||
// $prestataires = $this->prestataire->listemailprestatairedoublon();
|
||||
$prestataires = $this->prestataire->listemailprestatairepublic();
|
||||
|
||||
$compteur = 0;
|
||||
|
||||
foreach ($prestataires as $prestataire)
|
||||
{
|
||||
// codePrestataire, libelle, email
|
||||
$compteur += 1;
|
||||
|
||||
$codePrestataire = $prestataire['codePrestataire'];
|
||||
$libelle = $prestataire['libelle'];
|
||||
$email = $prestataire['email'];
|
||||
|
||||
// Pour tester
|
||||
|
||||
// $email = "lkane@ebene.info";
|
||||
|
||||
// echo "$compteur $codePrestataire $libelle $email ";
|
||||
// echo '</BR>'; echo '</BR>';
|
||||
// Fin tests */
|
||||
|
||||
// DEBUT ENVOI DU MAIL AVEC PIECE JOINTE
|
||||
|
||||
$mail_C = $this->mail_C;
|
||||
|
||||
$mail_C->ClearAllRecipients();
|
||||
|
||||
// $mail_C->clearAttachments();
|
||||
|
||||
// pour envoi à moi seul
|
||||
// $email = "kanelazeni@gmail.com";
|
||||
// fin envoi à moi seul
|
||||
|
||||
$addr = explode(';', $email);
|
||||
foreach ($addr as $ad)
|
||||
{
|
||||
$mail_C->AddAddress(trim($ad) );
|
||||
}
|
||||
|
||||
$mail_C->AddCC("prugira@radiant.rw");
|
||||
$mail_C->AddCC("imugabo@radiant.rw");
|
||||
$mail_C->AddCC("lkane@ebene.info");
|
||||
|
||||
$obejt = "RADIANT INSURANCE COMPANY : INFORMATION";
|
||||
$body = "Ku bafanyabikorwa bacu mu bwishingizi bwo kwivuza,
|
||||
|
||||
Muraho.Dushingiye ku itegeko rishya rigenga imisoro ryasohotse mu I Gazeti numero ….yo ku wa 16/04/2018, mu ngingo yayo ya 60, twifuzaga gusaba abafatanyabikorwa bacu bose ko mwatugezaho byihutirwa C.I.T(COPERATE INCOME TAX ) (UMUSORO KUNYUNGU ) Kugirango tubashe kwishyura twubahiriza itegeko kandi twirinda ingaruka zabaho igihe amategeko atubahirijwe.
|
||||
|
||||
Twizeye ko mubyakira neza, mugire amahoro";
|
||||
|
||||
$mail_C->Subject = $obejt;
|
||||
|
||||
$mail_C->AltBody = $altbody;
|
||||
$mail_C->Body=$body;
|
||||
|
||||
// var_dump($mail_C);
|
||||
|
||||
if (!$mail_C->send())
|
||||
{
|
||||
// echo "Erreur mail : " . $mail_C->ErrorInfo;
|
||||
}
|
||||
else
|
||||
{
|
||||
// echo "Message envoyé!";
|
||||
}
|
||||
|
||||
// FIN ENVOI DU MAIL AVEC PIECE JOINTE
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// echo '</BR>'; echo '</BR>';
|
||||
|
||||
$emailprestataires = new Emailprestatairespublics();
|
||||
// date_default_timezone_set("Africa/Kigali");
|
||||
$emailprestataires->excutercron();
|
||||
echo "Fin Tache Cron";
|
||||
201
Cron/Emailrapprtsp.php
Executable file
201
Cron/Emailrapprtsp.php
Executable file
@@ -0,0 +1,201 @@
|
||||
<?php
|
||||
require_once 'Functions.php';
|
||||
require_once 'Controleurrequete.php';
|
||||
require_once 'Statistique.php';
|
||||
|
||||
class Emailrapprtsp
|
||||
{
|
||||
private $rapportsp;
|
||||
private $mail_C;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->rapportsp = new Statistique();
|
||||
require_once 'Ebenegmail.php';
|
||||
$this->mail_C = $mail;
|
||||
}
|
||||
|
||||
public function excutercron()
|
||||
{
|
||||
$polices = $this->rapportsp->listepolicerapportspmail();
|
||||
|
||||
foreach ($polices as $police)
|
||||
{
|
||||
$dateAnalyse = $police['dateAnalyse'];
|
||||
$idPolice = $police['idPolice'];
|
||||
$email = $police['email'];
|
||||
|
||||
$this->detailrapportsppdf($idPolice, $dateAnalyse, $email);
|
||||
}
|
||||
}
|
||||
|
||||
public function detailrapportsppdf($idPolice, $dateAnalyse, $email)
|
||||
{
|
||||
$entete = $this->rapportsp->detailrapportsppdfentete($idPolice, $dateAnalyse);
|
||||
|
||||
$detailsps = $this->rapportsp->detailrapportsppdf($idPolice, $dateAnalyse);
|
||||
|
||||
$pdf = new FPDF_Protection();
|
||||
$pdf->SetAuthor('EBENE SOLUTIONS INFORMATIQUES');
|
||||
$userPassword = '';
|
||||
$ownerPassword = null;
|
||||
$pdf->SetProtection(['print'], $userPassword, $ownerPassword);
|
||||
|
||||
$pdf->AliasNbPages();
|
||||
|
||||
$pdf->AddPage();
|
||||
|
||||
$pdf->SetMargins(15, 15, 15) ;
|
||||
$pdf->SetFont('Arial','BU',10);
|
||||
|
||||
// $pdf->AliasNbPages();
|
||||
$pdf->Cell(0,6,$entete['nomAssureur'] . " : " . _("RAPPORT SINISTRE A PRIME PAR FAMILLE"),0,1,'C',false);
|
||||
|
||||
$pdf->Ln(2);
|
||||
|
||||
$pdf->SetFont('Arial','B',7);
|
||||
|
||||
$pdf->Cell(0,5,_('Souscripteur').' : '.$entete['souscripteur'],0,1,'L',false);
|
||||
$pdf->Cell(0,5,_('No Police').' : '.$entete['numeroPolice'],0,1,'L',false);
|
||||
$pdf->Cell(0,5,'E-mail : '.$email,0,1,'L',false);
|
||||
$pdf->Cell(0,5,_(convertirc('Période couverte')).' : '.$entete['dateEffetPolice'].' '._('au').' '.$entete['dateFinPolice'],0,1,'L',false);
|
||||
$pdf->Cell(0,5,_('Date Analyse').' : '.$entete['dateAnalyse'],0,0,'L',false);
|
||||
$pdf->Cell(0,5,'Edition : '.heureCouranteLang($_SESSION['lang']),0,1,'R',false);
|
||||
|
||||
$pdf->Ln(2);
|
||||
|
||||
$hl=5;
|
||||
|
||||
$pdf->Cell(60,$hl,convertirc(_('Adhérent')),"1",0,'C');
|
||||
$pdf->Cell(15,$hl,convertirc(_('Date Effet')),"1",0,'C');
|
||||
$pdf->Cell(10,$hl,convertirc(_('Jours')),"1",0,'C');
|
||||
$pdf->Cell(25,$hl,convertirc(_('Prime An')),"1",0,'C');
|
||||
$pdf->Cell(25,$hl,convertirc(_('Prim Acq')),"1",0,'C');
|
||||
$pdf->Cell(25,$hl,convertirc(_('Sinistres')),"1",0,'C');
|
||||
$pdf->Cell(20,$hl,convertirc("Ratio"),"1",1,'C');
|
||||
|
||||
$pdf->SetFont('Arial','I',7);
|
||||
foreach ($detailsps as $detailsp)
|
||||
{
|
||||
$pdf->Cell(60,$hl,convertirc($detailsp['adherent']),"1",0,'L');
|
||||
$pdf->Cell(15,$hl,$detailsp['dateEffetAdherent'],"1",0,'C');
|
||||
$pdf->Cell(10,$hl,$detailsp['duree_acq'],"1",0,'C');
|
||||
$pdf->Cell(25,$hl,format_N($detailsp['primeAnnuelle']),"1",0,'C');
|
||||
$pdf->Cell(25,$hl,format_N($detailsp['primeAcquise']),"1",0,'C');
|
||||
$pdf->Cell(25,$hl,format_N($detailsp['sinistres']),"1",0,'C');
|
||||
$pdf->Cell(10,$hl,$detailsp['rapportSp'],"1",0,'C');
|
||||
$pdf->Cell(10,$hl,$detailsp['rapportSpAn'],"1",1,'C');
|
||||
}
|
||||
$pdf->SetFont('Arial','BI',7);
|
||||
|
||||
$pdf->Cell(85,$hl,convertirc("TOTAL"),"1",0,'C');
|
||||
$pdf->Cell(25,$hl,format_N($detailsp['primeAnnuelleTotal']),"1",0,'C');
|
||||
$pdf->Cell(25,$hl,format_N($detailsp['primeAcquiseTotal']),"1",0,'C');
|
||||
$pdf->Cell(25,$hl,format_N($detailsp['sinistresTotal']),"1",0,'C');
|
||||
$pdf->Cell(10,$hl,$detailsp['rapportSpTotal'],"1",0,'C');
|
||||
$pdf->Cell(10,$hl,$detailsp['rapportSpTotalAn'],"1",1,'C');
|
||||
|
||||
// DEBUT ENVOI DU MAIL AVEC PIECE JOINTE
|
||||
|
||||
$mail_C = $this->mail_C;
|
||||
|
||||
$mail_C->ClearAllRecipients();
|
||||
$mail_C->clearAttachments();
|
||||
|
||||
$addr = explode(';', $email);
|
||||
|
||||
foreach ($addr as $ad)
|
||||
{
|
||||
if(tester_une_adresse_email($ad))
|
||||
{
|
||||
$mail_C->AddAddress(trim($ad) );
|
||||
}
|
||||
}
|
||||
|
||||
if (est_anglophone())
|
||||
{
|
||||
$fichier="SUMMARY_END_".$dateAnalyse."_".uniqid().".pdf";
|
||||
$pdf->Output($fichier,"F");
|
||||
|
||||
$obejt = "SUMMARY END : ".$dateAnalyse;
|
||||
|
||||
$body = convertirc("Dear Customer,");
|
||||
|
||||
$body .= "<br/> <br/>";
|
||||
|
||||
$body .= convertirc("Hope this email find you well,");
|
||||
|
||||
$body .= "<br/> <br/>";
|
||||
|
||||
$body .= convertirc("Attached file is claims report of your staff from starting date up to ".$dateAnalyse).'.';
|
||||
|
||||
$body .= "<br/> <br/>";
|
||||
|
||||
$body .= convertirc("You can share those informations with every one and if any more clarification do not hesitate to contact us for more details.");
|
||||
|
||||
$body .= "<br/> <br/>";
|
||||
|
||||
$body .= convertirc("Kind Regards.");
|
||||
|
||||
$altbody = "SEE ATTACHMENT";
|
||||
}
|
||||
else
|
||||
{
|
||||
$fichier="RAPPORT_SP_".$dateAnalyse."_".uniqid().".pdf";
|
||||
$pdf->Output($fichier,"F");
|
||||
|
||||
$obejt = "RAPPORT AU : ".$dateAnalyse;
|
||||
|
||||
$body = convertirc("Cher Client,");
|
||||
|
||||
$body .= "<br/> <br/>";
|
||||
|
||||
$body .= "Nous vous prions de trouver en pièce jointe votre rapport de consommations par famille à la date du ".$dateAnalyse.'.';
|
||||
|
||||
$body .= "<br/> <br/>";
|
||||
|
||||
$body .= "Vous pouvez partager ces informations avec tout le monde et si vous avez besoin de précisions";
|
||||
|
||||
$body .= "<br/> <br/>";
|
||||
|
||||
$body .= "N'hésitez pas à nous contacter pour plus de détails.";
|
||||
|
||||
$body .= "<br/> <br/>";
|
||||
|
||||
$body .= "Cordialement!";
|
||||
|
||||
$altbody = "VOIR PIECE JOINTE";
|
||||
}
|
||||
|
||||
$obejt = convertirc($obejt);
|
||||
|
||||
$pj = $fichier;
|
||||
|
||||
$mail_C->Subject = $obejt;
|
||||
|
||||
$mail_C->AltBody = $altbody;
|
||||
$mail_C->Body=$body;
|
||||
|
||||
$mail_C->addAttachment($pj);
|
||||
|
||||
if (!$mail_C->send())
|
||||
{
|
||||
// echo "Erreur mail : " . $mail_C->ErrorInfo;
|
||||
}
|
||||
else
|
||||
{
|
||||
// echo "Message envoyé!";
|
||||
}
|
||||
|
||||
// FIN ENVOI DU MAIL AVEC PIECE JOINTE
|
||||
|
||||
// supprimons le fichier
|
||||
unlink ($pj);
|
||||
}
|
||||
}
|
||||
|
||||
// echo '</BR>'; echo '</BR>';
|
||||
|
||||
$emailrapprtsp = new Emailrapprtsp();
|
||||
$emailrapprtsp->excutercron();
|
||||
// echo "Fin Tache Cron";
|
||||
50
Cron/Ententeprealable.php
Executable file
50
Cron/Ententeprealable.php
Executable file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
require_once 'Modele.php';
|
||||
|
||||
class Ententeprealable extends Modele {
|
||||
|
||||
public function getinfosEntenteprealable($idDemandeententeprealable)
|
||||
{
|
||||
$sql = 'call sp_get_infos_ententeprealable(?)';
|
||||
|
||||
$resultat = $this->executerRequete($sql, array($idDemandeententeprealable));
|
||||
|
||||
return $resultat->fetch(PDO::FETCH_ASSOC);
|
||||
}
|
||||
|
||||
public function getinfosAutorisation($idDemandeautorisation)
|
||||
{
|
||||
$sql = 'call sp_get_infos_autorisation(?)';
|
||||
|
||||
$resultat = $this->executerRequete($sql, array($idDemandeautorisation));
|
||||
|
||||
return $resultat->fetch(PDO::FETCH_ASSOC);
|
||||
}
|
||||
|
||||
public function getinfosEntenteprealablepha($idDemandeententeprealable)
|
||||
{
|
||||
$sql = 'call sp_get_infos_ententeprealable_pha(?)';
|
||||
|
||||
$resultat = $this->executerRequete($sql, array($idDemandeententeprealable));
|
||||
|
||||
return $resultat->fetch(PDO::FETCH_ASSOC);
|
||||
}
|
||||
|
||||
public function getinfosEntenteprealableopt($idDemandeententeprealable)
|
||||
{
|
||||
$sql = 'call sp_get_infos_ententeprealable_opt(?)';
|
||||
|
||||
$resultat = $this->executerRequete($sql, array($idDemandeententeprealable));
|
||||
|
||||
return $resultat->fetch(PDO::FETCH_ASSOC);
|
||||
}
|
||||
|
||||
public function getinfosEntenteprealablemont($idDemandeententeprealable)
|
||||
{
|
||||
$sql = 'call sp_get_infos_ententeprealable_mont(?)';
|
||||
|
||||
$resultat = $this->executerRequete($sql, array($idDemandeententeprealable));
|
||||
|
||||
return $resultat->fetch(PDO::FETCH_ASSOC);
|
||||
}
|
||||
}
|
||||
32
Cron/Envoimailcron.php
Executable file
32
Cron/Envoimailcron.php
Executable file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
require_once 'Modele.php';
|
||||
|
||||
class Envoimailcron extends Modele {
|
||||
|
||||
public function marquermail($idMail, $etat)
|
||||
{
|
||||
$sql = 'call sp_marquer_mail(?, ?)';
|
||||
$this->executerRequete($sql, array($idMail, $etat));
|
||||
}
|
||||
|
||||
public function getmailaenvoyer()
|
||||
{
|
||||
$sql = 'call sp_charger_mail_a_envoyer()';
|
||||
|
||||
$mailaenvoyer = $this->executerRequete($sql);
|
||||
|
||||
$ligne = $mailaenvoyer->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
return $ligne;
|
||||
}
|
||||
|
||||
public function get_les_mails_aenvoyer($nbMail)
|
||||
{
|
||||
$sql = 'call sp_r_charger_les_mails_a_envoyer(?)';
|
||||
|
||||
$resultat = $this->executerRequete($sql, array($nbMail));
|
||||
|
||||
return $resultat->fetchAll(PDO::FETCH_ASSOC);
|
||||
}
|
||||
|
||||
}
|
||||
56
Cron/Envoismscron.php
Executable file
56
Cron/Envoismscron.php
Executable file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
require_once 'Modele.php';
|
||||
|
||||
class Envoismscron extends Modele {
|
||||
|
||||
public function marquersms($idSms, $etat)
|
||||
{
|
||||
$sql = 'call sp_r_marquer_sms(?, ?)';
|
||||
$this->executerRequete($sql, array($idSms, $etat));
|
||||
}
|
||||
|
||||
public function getsmsaenvoyer()
|
||||
{
|
||||
$sql = 'call sp_r_charger_sms_a_envoyer()';
|
||||
|
||||
$resultat = $this->executerRequete($sql);
|
||||
|
||||
$ligne = $resultat->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
return $ligne;
|
||||
}
|
||||
|
||||
public function get_les_smsaenvoyer($nbSms)
|
||||
{
|
||||
$sql = 'call sp_r_charger_les_sms_a_envoyer(?)';
|
||||
|
||||
$resultat = $this->executerRequete($sql, array($nbSms));
|
||||
|
||||
return $resultat->fetchAll(PDO::FETCH_ASSOC);
|
||||
}
|
||||
|
||||
public function marquersmswhatsapp($idSms, $etat)
|
||||
{
|
||||
$sql = 'call sp_r_marquer_sms(?, ?)';
|
||||
$this->executerRequete($sql, array($idSms, $etat));
|
||||
}
|
||||
|
||||
public function get_les_smsaenvoyer($nbSms)
|
||||
{
|
||||
$sql = 'call sp_r_charger_les_sms_a_envoyer(?)';
|
||||
|
||||
$resultat = $this->executerRequete($sql, array($nbSms));
|
||||
|
||||
return $resultat->fetchAll(PDO::FETCH_ASSOC);
|
||||
}
|
||||
|
||||
public function get_les_smsaenvoyerwhatsapp($nbSms)
|
||||
{
|
||||
$sql = 'call sp_r_charger_les_smswhatsapp_a_envoyer(?)';
|
||||
|
||||
$resultat = $this->executerRequete($sql, array($nbSms));
|
||||
|
||||
return $resultat->fetchAll(PDO::FETCH_ASSOC);
|
||||
}
|
||||
|
||||
}
|
||||
28
Cron/Facture.php
Executable file
28
Cron/Facture.php
Executable file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
require_once 'Modele.php';
|
||||
|
||||
class Facture extends Modele {
|
||||
|
||||
public function getfacture($idFacture)
|
||||
{
|
||||
$sql = 'call sp_r_get_facture(?)';
|
||||
|
||||
$facture = $this->executerRequete($sql, array($idFacture));
|
||||
|
||||
$ligne = $facture->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
return $ligne;
|
||||
}
|
||||
|
||||
public function getfacturecron($numeroFeuilleMaladie, $codePrestataire)
|
||||
{
|
||||
$sql = 'call sp_r_get_facture_cron(?, ?)';
|
||||
|
||||
$facture = $this->executerRequete($sql, array($numeroFeuilleMaladie, $codePrestataire));
|
||||
|
||||
$ligne = $facture->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
return $ligne;
|
||||
}
|
||||
|
||||
}
|
||||
16
Cron/Feuillemaladie.php
Executable file
16
Cron/Feuillemaladie.php
Executable file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
require_once 'Modele.php';
|
||||
|
||||
class Feuillemaladie extends Modele {
|
||||
|
||||
public function getfeuillemaladie($numeroFeuilleMaladie)
|
||||
{
|
||||
$sql = 'call sp_p_get_feuille_maladie(?)';
|
||||
|
||||
$feuillemaladie = $this->executerRequete($sql, array($numeroFeuilleMaladie));
|
||||
|
||||
$ligne = $feuillemaladie->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
return $ligne;
|
||||
}
|
||||
}
|
||||
10
Cron/Fpdf/font/courier.php
Executable file
10
Cron/Fpdf/font/courier.php
Executable file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
$type = 'Core';
|
||||
$name = 'Courier';
|
||||
$up = -100;
|
||||
$ut = 50;
|
||||
for($i=0;$i<=255;$i++)
|
||||
$cw[chr($i)] = 600;
|
||||
$enc = 'cp1252';
|
||||
$uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96));
|
||||
?>
|
||||
10
Cron/Fpdf/font/courierb.php
Executable file
10
Cron/Fpdf/font/courierb.php
Executable file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
$type = 'Core';
|
||||
$name = 'Courier-Bold';
|
||||
$up = -100;
|
||||
$ut = 50;
|
||||
for($i=0;$i<=255;$i++)
|
||||
$cw[chr($i)] = 600;
|
||||
$enc = 'cp1252';
|
||||
$uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96));
|
||||
?>
|
||||
10
Cron/Fpdf/font/courierbi.php
Executable file
10
Cron/Fpdf/font/courierbi.php
Executable file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
$type = 'Core';
|
||||
$name = 'Courier-BoldOblique';
|
||||
$up = -100;
|
||||
$ut = 50;
|
||||
for($i=0;$i<=255;$i++)
|
||||
$cw[chr($i)] = 600;
|
||||
$enc = 'cp1252';
|
||||
$uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96));
|
||||
?>
|
||||
10
Cron/Fpdf/font/courieri.php
Executable file
10
Cron/Fpdf/font/courieri.php
Executable file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
$type = 'Core';
|
||||
$name = 'Courier-Oblique';
|
||||
$up = -100;
|
||||
$ut = 50;
|
||||
for($i=0;$i<=255;$i++)
|
||||
$cw[chr($i)] = 600;
|
||||
$enc = 'cp1252';
|
||||
$uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96));
|
||||
?>
|
||||
21
Cron/Fpdf/font/helvetica.php
Executable file
21
Cron/Fpdf/font/helvetica.php
Executable file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
$type = 'Core';
|
||||
$name = 'Helvetica';
|
||||
$up = -100;
|
||||
$ut = 50;
|
||||
$cw = array(
|
||||
chr(0)=>278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278,
|
||||
chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>278,'"'=>355,'#'=>556,'$'=>556,'%'=>889,'&'=>667,'\''=>191,'('=>333,')'=>333,'*'=>389,'+'=>584,
|
||||
','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>278,';'=>278,'<'=>584,'='=>584,'>'=>584,'?'=>556,'@'=>1015,'A'=>667,
|
||||
'B'=>667,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>500,'K'=>667,'L'=>556,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944,
|
||||
'X'=>667,'Y'=>667,'Z'=>611,'['=>278,'\\'=>278,']'=>278,'^'=>469,'_'=>556,'`'=>333,'a'=>556,'b'=>556,'c'=>500,'d'=>556,'e'=>556,'f'=>278,'g'=>556,'h'=>556,'i'=>222,'j'=>222,'k'=>500,'l'=>222,'m'=>833,
|
||||
'n'=>556,'o'=>556,'p'=>556,'q'=>556,'r'=>333,'s'=>500,'t'=>278,'u'=>556,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>500,'{'=>334,'|'=>260,'}'=>334,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>222,chr(131)=>556,
|
||||
chr(132)=>333,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>222,chr(146)=>222,chr(147)=>333,chr(148)=>333,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000,
|
||||
chr(154)=>500,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>260,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333,
|
||||
chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>556,chr(182)=>537,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>667,chr(193)=>667,chr(194)=>667,chr(195)=>667,chr(196)=>667,chr(197)=>667,
|
||||
chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722,
|
||||
chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>500,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>556,chr(241)=>556,
|
||||
chr(242)=>556,chr(243)=>556,chr(244)=>556,chr(245)=>556,chr(246)=>556,chr(247)=>584,chr(248)=>611,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500);
|
||||
$enc = 'cp1252';
|
||||
$uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96));
|
||||
?>
|
||||
21
Cron/Fpdf/font/helveticab.php
Executable file
21
Cron/Fpdf/font/helveticab.php
Executable file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
$type = 'Core';
|
||||
$name = 'Helvetica-Bold';
|
||||
$up = -100;
|
||||
$ut = 50;
|
||||
$cw = array(
|
||||
chr(0)=>278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278,
|
||||
chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>333,'"'=>474,'#'=>556,'$'=>556,'%'=>889,'&'=>722,'\''=>238,'('=>333,')'=>333,'*'=>389,'+'=>584,
|
||||
','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>333,';'=>333,'<'=>584,'='=>584,'>'=>584,'?'=>611,'@'=>975,'A'=>722,
|
||||
'B'=>722,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>556,'K'=>722,'L'=>611,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944,
|
||||
'X'=>667,'Y'=>667,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>584,'_'=>556,'`'=>333,'a'=>556,'b'=>611,'c'=>556,'d'=>611,'e'=>556,'f'=>333,'g'=>611,'h'=>611,'i'=>278,'j'=>278,'k'=>556,'l'=>278,'m'=>889,
|
||||
'n'=>611,'o'=>611,'p'=>611,'q'=>611,'r'=>389,'s'=>556,'t'=>333,'u'=>611,'v'=>556,'w'=>778,'x'=>556,'y'=>556,'z'=>500,'{'=>389,'|'=>280,'}'=>389,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>278,chr(131)=>556,
|
||||
chr(132)=>500,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>278,chr(146)=>278,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000,
|
||||
chr(154)=>556,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>280,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333,
|
||||
chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>611,chr(182)=>556,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722,
|
||||
chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722,
|
||||
chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>556,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>611,chr(241)=>611,
|
||||
chr(242)=>611,chr(243)=>611,chr(244)=>611,chr(245)=>611,chr(246)=>611,chr(247)=>584,chr(248)=>611,chr(249)=>611,chr(250)=>611,chr(251)=>611,chr(252)=>611,chr(253)=>556,chr(254)=>611,chr(255)=>556);
|
||||
$enc = 'cp1252';
|
||||
$uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96));
|
||||
?>
|
||||
21
Cron/Fpdf/font/helveticabi.php
Executable file
21
Cron/Fpdf/font/helveticabi.php
Executable file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
$type = 'Core';
|
||||
$name = 'Helvetica-BoldOblique';
|
||||
$up = -100;
|
||||
$ut = 50;
|
||||
$cw = array(
|
||||
chr(0)=>278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278,
|
||||
chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>333,'"'=>474,'#'=>556,'$'=>556,'%'=>889,'&'=>722,'\''=>238,'('=>333,')'=>333,'*'=>389,'+'=>584,
|
||||
','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>333,';'=>333,'<'=>584,'='=>584,'>'=>584,'?'=>611,'@'=>975,'A'=>722,
|
||||
'B'=>722,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>556,'K'=>722,'L'=>611,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944,
|
||||
'X'=>667,'Y'=>667,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>584,'_'=>556,'`'=>333,'a'=>556,'b'=>611,'c'=>556,'d'=>611,'e'=>556,'f'=>333,'g'=>611,'h'=>611,'i'=>278,'j'=>278,'k'=>556,'l'=>278,'m'=>889,
|
||||
'n'=>611,'o'=>611,'p'=>611,'q'=>611,'r'=>389,'s'=>556,'t'=>333,'u'=>611,'v'=>556,'w'=>778,'x'=>556,'y'=>556,'z'=>500,'{'=>389,'|'=>280,'}'=>389,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>278,chr(131)=>556,
|
||||
chr(132)=>500,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>278,chr(146)=>278,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000,
|
||||
chr(154)=>556,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>280,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333,
|
||||
chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>611,chr(182)=>556,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722,
|
||||
chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722,
|
||||
chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>556,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>611,chr(241)=>611,
|
||||
chr(242)=>611,chr(243)=>611,chr(244)=>611,chr(245)=>611,chr(246)=>611,chr(247)=>584,chr(248)=>611,chr(249)=>611,chr(250)=>611,chr(251)=>611,chr(252)=>611,chr(253)=>556,chr(254)=>611,chr(255)=>556);
|
||||
$enc = 'cp1252';
|
||||
$uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96));
|
||||
?>
|
||||
21
Cron/Fpdf/font/helveticai.php
Executable file
21
Cron/Fpdf/font/helveticai.php
Executable file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
$type = 'Core';
|
||||
$name = 'Helvetica-Oblique';
|
||||
$up = -100;
|
||||
$ut = 50;
|
||||
$cw = array(
|
||||
chr(0)=>278,chr(1)=>278,chr(2)=>278,chr(3)=>278,chr(4)=>278,chr(5)=>278,chr(6)=>278,chr(7)=>278,chr(8)=>278,chr(9)=>278,chr(10)=>278,chr(11)=>278,chr(12)=>278,chr(13)=>278,chr(14)=>278,chr(15)=>278,chr(16)=>278,chr(17)=>278,chr(18)=>278,chr(19)=>278,chr(20)=>278,chr(21)=>278,
|
||||
chr(22)=>278,chr(23)=>278,chr(24)=>278,chr(25)=>278,chr(26)=>278,chr(27)=>278,chr(28)=>278,chr(29)=>278,chr(30)=>278,chr(31)=>278,' '=>278,'!'=>278,'"'=>355,'#'=>556,'$'=>556,'%'=>889,'&'=>667,'\''=>191,'('=>333,')'=>333,'*'=>389,'+'=>584,
|
||||
','=>278,'-'=>333,'.'=>278,'/'=>278,'0'=>556,'1'=>556,'2'=>556,'3'=>556,'4'=>556,'5'=>556,'6'=>556,'7'=>556,'8'=>556,'9'=>556,':'=>278,';'=>278,'<'=>584,'='=>584,'>'=>584,'?'=>556,'@'=>1015,'A'=>667,
|
||||
'B'=>667,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>722,'I'=>278,'J'=>500,'K'=>667,'L'=>556,'M'=>833,'N'=>722,'O'=>778,'P'=>667,'Q'=>778,'R'=>722,'S'=>667,'T'=>611,'U'=>722,'V'=>667,'W'=>944,
|
||||
'X'=>667,'Y'=>667,'Z'=>611,'['=>278,'\\'=>278,']'=>278,'^'=>469,'_'=>556,'`'=>333,'a'=>556,'b'=>556,'c'=>500,'d'=>556,'e'=>556,'f'=>278,'g'=>556,'h'=>556,'i'=>222,'j'=>222,'k'=>500,'l'=>222,'m'=>833,
|
||||
'n'=>556,'o'=>556,'p'=>556,'q'=>556,'r'=>333,'s'=>500,'t'=>278,'u'=>556,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>500,'{'=>334,'|'=>260,'}'=>334,'~'=>584,chr(127)=>350,chr(128)=>556,chr(129)=>350,chr(130)=>222,chr(131)=>556,
|
||||
chr(132)=>333,chr(133)=>1000,chr(134)=>556,chr(135)=>556,chr(136)=>333,chr(137)=>1000,chr(138)=>667,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>222,chr(146)=>222,chr(147)=>333,chr(148)=>333,chr(149)=>350,chr(150)=>556,chr(151)=>1000,chr(152)=>333,chr(153)=>1000,
|
||||
chr(154)=>500,chr(155)=>333,chr(156)=>944,chr(157)=>350,chr(158)=>500,chr(159)=>667,chr(160)=>278,chr(161)=>333,chr(162)=>556,chr(163)=>556,chr(164)=>556,chr(165)=>556,chr(166)=>260,chr(167)=>556,chr(168)=>333,chr(169)=>737,chr(170)=>370,chr(171)=>556,chr(172)=>584,chr(173)=>333,chr(174)=>737,chr(175)=>333,
|
||||
chr(176)=>400,chr(177)=>584,chr(178)=>333,chr(179)=>333,chr(180)=>333,chr(181)=>556,chr(182)=>537,chr(183)=>278,chr(184)=>333,chr(185)=>333,chr(186)=>365,chr(187)=>556,chr(188)=>834,chr(189)=>834,chr(190)=>834,chr(191)=>611,chr(192)=>667,chr(193)=>667,chr(194)=>667,chr(195)=>667,chr(196)=>667,chr(197)=>667,
|
||||
chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>278,chr(205)=>278,chr(206)=>278,chr(207)=>278,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>584,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722,
|
||||
chr(220)=>722,chr(221)=>667,chr(222)=>667,chr(223)=>611,chr(224)=>556,chr(225)=>556,chr(226)=>556,chr(227)=>556,chr(228)=>556,chr(229)=>556,chr(230)=>889,chr(231)=>500,chr(232)=>556,chr(233)=>556,chr(234)=>556,chr(235)=>556,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>556,chr(241)=>556,
|
||||
chr(242)=>556,chr(243)=>556,chr(244)=>556,chr(245)=>556,chr(246)=>556,chr(247)=>584,chr(248)=>611,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500);
|
||||
$enc = 'cp1252';
|
||||
$uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96));
|
||||
?>
|
||||
20
Cron/Fpdf/font/symbol.php
Executable file
20
Cron/Fpdf/font/symbol.php
Executable file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
$type = 'Core';
|
||||
$name = 'Symbol';
|
||||
$up = -100;
|
||||
$ut = 50;
|
||||
$cw = array(
|
||||
chr(0)=>250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250,
|
||||
chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>713,'#'=>500,'$'=>549,'%'=>833,'&'=>778,'\''=>439,'('=>333,')'=>333,'*'=>500,'+'=>549,
|
||||
','=>250,'-'=>549,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>278,';'=>278,'<'=>549,'='=>549,'>'=>549,'?'=>444,'@'=>549,'A'=>722,
|
||||
'B'=>667,'C'=>722,'D'=>612,'E'=>611,'F'=>763,'G'=>603,'H'=>722,'I'=>333,'J'=>631,'K'=>722,'L'=>686,'M'=>889,'N'=>722,'O'=>722,'P'=>768,'Q'=>741,'R'=>556,'S'=>592,'T'=>611,'U'=>690,'V'=>439,'W'=>768,
|
||||
'X'=>645,'Y'=>795,'Z'=>611,'['=>333,'\\'=>863,']'=>333,'^'=>658,'_'=>500,'`'=>500,'a'=>631,'b'=>549,'c'=>549,'d'=>494,'e'=>439,'f'=>521,'g'=>411,'h'=>603,'i'=>329,'j'=>603,'k'=>549,'l'=>549,'m'=>576,
|
||||
'n'=>521,'o'=>549,'p'=>549,'q'=>521,'r'=>549,'s'=>603,'t'=>439,'u'=>576,'v'=>713,'w'=>686,'x'=>493,'y'=>686,'z'=>494,'{'=>480,'|'=>200,'}'=>480,'~'=>549,chr(127)=>0,chr(128)=>0,chr(129)=>0,chr(130)=>0,chr(131)=>0,
|
||||
chr(132)=>0,chr(133)=>0,chr(134)=>0,chr(135)=>0,chr(136)=>0,chr(137)=>0,chr(138)=>0,chr(139)=>0,chr(140)=>0,chr(141)=>0,chr(142)=>0,chr(143)=>0,chr(144)=>0,chr(145)=>0,chr(146)=>0,chr(147)=>0,chr(148)=>0,chr(149)=>0,chr(150)=>0,chr(151)=>0,chr(152)=>0,chr(153)=>0,
|
||||
chr(154)=>0,chr(155)=>0,chr(156)=>0,chr(157)=>0,chr(158)=>0,chr(159)=>0,chr(160)=>750,chr(161)=>620,chr(162)=>247,chr(163)=>549,chr(164)=>167,chr(165)=>713,chr(166)=>500,chr(167)=>753,chr(168)=>753,chr(169)=>753,chr(170)=>753,chr(171)=>1042,chr(172)=>987,chr(173)=>603,chr(174)=>987,chr(175)=>603,
|
||||
chr(176)=>400,chr(177)=>549,chr(178)=>411,chr(179)=>549,chr(180)=>549,chr(181)=>713,chr(182)=>494,chr(183)=>460,chr(184)=>549,chr(185)=>549,chr(186)=>549,chr(187)=>549,chr(188)=>1000,chr(189)=>603,chr(190)=>1000,chr(191)=>658,chr(192)=>823,chr(193)=>686,chr(194)=>795,chr(195)=>987,chr(196)=>768,chr(197)=>768,
|
||||
chr(198)=>823,chr(199)=>768,chr(200)=>768,chr(201)=>713,chr(202)=>713,chr(203)=>713,chr(204)=>713,chr(205)=>713,chr(206)=>713,chr(207)=>713,chr(208)=>768,chr(209)=>713,chr(210)=>790,chr(211)=>790,chr(212)=>890,chr(213)=>823,chr(214)=>549,chr(215)=>250,chr(216)=>713,chr(217)=>603,chr(218)=>603,chr(219)=>1042,
|
||||
chr(220)=>987,chr(221)=>603,chr(222)=>987,chr(223)=>603,chr(224)=>494,chr(225)=>329,chr(226)=>790,chr(227)=>790,chr(228)=>786,chr(229)=>713,chr(230)=>384,chr(231)=>384,chr(232)=>384,chr(233)=>384,chr(234)=>384,chr(235)=>384,chr(236)=>494,chr(237)=>494,chr(238)=>494,chr(239)=>494,chr(240)=>0,chr(241)=>329,
|
||||
chr(242)=>274,chr(243)=>686,chr(244)=>686,chr(245)=>686,chr(246)=>384,chr(247)=>384,chr(248)=>384,chr(249)=>384,chr(250)=>384,chr(251)=>384,chr(252)=>494,chr(253)=>494,chr(254)=>494,chr(255)=>0);
|
||||
$uv = array(32=>160,33=>33,34=>8704,35=>35,36=>8707,37=>array(37,2),39=>8715,40=>array(40,2),42=>8727,43=>array(43,2),45=>8722,46=>array(46,18),64=>8773,65=>array(913,2),67=>935,68=>array(916,2),70=>934,71=>915,72=>919,73=>921,74=>977,75=>array(922,4),79=>array(927,2),81=>920,82=>929,83=>array(931,3),86=>962,87=>937,88=>926,89=>936,90=>918,91=>91,92=>8756,93=>93,94=>8869,95=>95,96=>63717,97=>array(945,2),99=>967,100=>array(948,2),102=>966,103=>947,104=>951,105=>953,106=>981,107=>array(954,4),111=>array(959,2),113=>952,114=>961,115=>array(963,3),118=>982,119=>969,120=>958,121=>968,122=>950,123=>array(123,3),126=>8764,160=>8364,161=>978,162=>8242,163=>8804,164=>8725,165=>8734,166=>402,167=>9827,168=>9830,169=>9829,170=>9824,171=>8596,172=>array(8592,4),176=>array(176,2),178=>8243,179=>8805,180=>215,181=>8733,182=>8706,183=>8226,184=>247,185=>array(8800,2),187=>8776,188=>8230,189=>array(63718,2),191=>8629,192=>8501,193=>8465,194=>8476,195=>8472,196=>8855,197=>8853,198=>8709,199=>array(8745,2),201=>8835,202=>8839,203=>8836,204=>8834,205=>8838,206=>array(8712,2),208=>8736,209=>8711,210=>63194,211=>63193,212=>63195,213=>8719,214=>8730,215=>8901,216=>172,217=>array(8743,2),219=>8660,220=>array(8656,4),224=>9674,225=>9001,226=>array(63720,3),229=>8721,230=>array(63723,10),241=>9002,242=>8747,243=>8992,244=>63733,245=>8993,246=>array(63734,9));
|
||||
?>
|
||||
21
Cron/Fpdf/font/times.php
Executable file
21
Cron/Fpdf/font/times.php
Executable file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
$type = 'Core';
|
||||
$name = 'Times-Roman';
|
||||
$up = -100;
|
||||
$ut = 50;
|
||||
$cw = array(
|
||||
chr(0)=>250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250,
|
||||
chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>408,'#'=>500,'$'=>500,'%'=>833,'&'=>778,'\''=>180,'('=>333,')'=>333,'*'=>500,'+'=>564,
|
||||
','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>278,';'=>278,'<'=>564,'='=>564,'>'=>564,'?'=>444,'@'=>921,'A'=>722,
|
||||
'B'=>667,'C'=>667,'D'=>722,'E'=>611,'F'=>556,'G'=>722,'H'=>722,'I'=>333,'J'=>389,'K'=>722,'L'=>611,'M'=>889,'N'=>722,'O'=>722,'P'=>556,'Q'=>722,'R'=>667,'S'=>556,'T'=>611,'U'=>722,'V'=>722,'W'=>944,
|
||||
'X'=>722,'Y'=>722,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>469,'_'=>500,'`'=>333,'a'=>444,'b'=>500,'c'=>444,'d'=>500,'e'=>444,'f'=>333,'g'=>500,'h'=>500,'i'=>278,'j'=>278,'k'=>500,'l'=>278,'m'=>778,
|
||||
'n'=>500,'o'=>500,'p'=>500,'q'=>500,'r'=>333,'s'=>389,'t'=>278,'u'=>500,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>444,'{'=>480,'|'=>200,'}'=>480,'~'=>541,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500,
|
||||
chr(132)=>444,chr(133)=>1000,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>556,chr(139)=>333,chr(140)=>889,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>444,chr(148)=>444,chr(149)=>350,chr(150)=>500,chr(151)=>1000,chr(152)=>333,chr(153)=>980,
|
||||
chr(154)=>389,chr(155)=>333,chr(156)=>722,chr(157)=>350,chr(158)=>444,chr(159)=>722,chr(160)=>250,chr(161)=>333,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>200,chr(167)=>500,chr(168)=>333,chr(169)=>760,chr(170)=>276,chr(171)=>500,chr(172)=>564,chr(173)=>333,chr(174)=>760,chr(175)=>333,
|
||||
chr(176)=>400,chr(177)=>564,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>500,chr(182)=>453,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>310,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>444,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722,
|
||||
chr(198)=>889,chr(199)=>667,chr(200)=>611,chr(201)=>611,chr(202)=>611,chr(203)=>611,chr(204)=>333,chr(205)=>333,chr(206)=>333,chr(207)=>333,chr(208)=>722,chr(209)=>722,chr(210)=>722,chr(211)=>722,chr(212)=>722,chr(213)=>722,chr(214)=>722,chr(215)=>564,chr(216)=>722,chr(217)=>722,chr(218)=>722,chr(219)=>722,
|
||||
chr(220)=>722,chr(221)=>722,chr(222)=>556,chr(223)=>500,chr(224)=>444,chr(225)=>444,chr(226)=>444,chr(227)=>444,chr(228)=>444,chr(229)=>444,chr(230)=>667,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>500,
|
||||
chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>564,chr(248)=>500,chr(249)=>500,chr(250)=>500,chr(251)=>500,chr(252)=>500,chr(253)=>500,chr(254)=>500,chr(255)=>500);
|
||||
$enc = 'cp1252';
|
||||
$uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96));
|
||||
?>
|
||||
21
Cron/Fpdf/font/timesb.php
Executable file
21
Cron/Fpdf/font/timesb.php
Executable file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
$type = 'Core';
|
||||
$name = 'Times-Bold';
|
||||
$up = -100;
|
||||
$ut = 50;
|
||||
$cw = array(
|
||||
chr(0)=>250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250,
|
||||
chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>555,'#'=>500,'$'=>500,'%'=>1000,'&'=>833,'\''=>278,'('=>333,')'=>333,'*'=>500,'+'=>570,
|
||||
','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>333,';'=>333,'<'=>570,'='=>570,'>'=>570,'?'=>500,'@'=>930,'A'=>722,
|
||||
'B'=>667,'C'=>722,'D'=>722,'E'=>667,'F'=>611,'G'=>778,'H'=>778,'I'=>389,'J'=>500,'K'=>778,'L'=>667,'M'=>944,'N'=>722,'O'=>778,'P'=>611,'Q'=>778,'R'=>722,'S'=>556,'T'=>667,'U'=>722,'V'=>722,'W'=>1000,
|
||||
'X'=>722,'Y'=>722,'Z'=>667,'['=>333,'\\'=>278,']'=>333,'^'=>581,'_'=>500,'`'=>333,'a'=>500,'b'=>556,'c'=>444,'d'=>556,'e'=>444,'f'=>333,'g'=>500,'h'=>556,'i'=>278,'j'=>333,'k'=>556,'l'=>278,'m'=>833,
|
||||
'n'=>556,'o'=>500,'p'=>556,'q'=>556,'r'=>444,'s'=>389,'t'=>333,'u'=>556,'v'=>500,'w'=>722,'x'=>500,'y'=>500,'z'=>444,'{'=>394,'|'=>220,'}'=>394,'~'=>520,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500,
|
||||
chr(132)=>500,chr(133)=>1000,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>556,chr(139)=>333,chr(140)=>1000,chr(141)=>350,chr(142)=>667,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>500,chr(151)=>1000,chr(152)=>333,chr(153)=>1000,
|
||||
chr(154)=>389,chr(155)=>333,chr(156)=>722,chr(157)=>350,chr(158)=>444,chr(159)=>722,chr(160)=>250,chr(161)=>333,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>220,chr(167)=>500,chr(168)=>333,chr(169)=>747,chr(170)=>300,chr(171)=>500,chr(172)=>570,chr(173)=>333,chr(174)=>747,chr(175)=>333,
|
||||
chr(176)=>400,chr(177)=>570,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>556,chr(182)=>540,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>330,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>500,chr(192)=>722,chr(193)=>722,chr(194)=>722,chr(195)=>722,chr(196)=>722,chr(197)=>722,
|
||||
chr(198)=>1000,chr(199)=>722,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>389,chr(205)=>389,chr(206)=>389,chr(207)=>389,chr(208)=>722,chr(209)=>722,chr(210)=>778,chr(211)=>778,chr(212)=>778,chr(213)=>778,chr(214)=>778,chr(215)=>570,chr(216)=>778,chr(217)=>722,chr(218)=>722,chr(219)=>722,
|
||||
chr(220)=>722,chr(221)=>722,chr(222)=>611,chr(223)=>556,chr(224)=>500,chr(225)=>500,chr(226)=>500,chr(227)=>500,chr(228)=>500,chr(229)=>500,chr(230)=>722,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>556,
|
||||
chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>570,chr(248)=>500,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>500,chr(254)=>556,chr(255)=>500);
|
||||
$enc = 'cp1252';
|
||||
$uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96));
|
||||
?>
|
||||
21
Cron/Fpdf/font/timesbi.php
Executable file
21
Cron/Fpdf/font/timesbi.php
Executable file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
$type = 'Core';
|
||||
$name = 'Times-BoldItalic';
|
||||
$up = -100;
|
||||
$ut = 50;
|
||||
$cw = array(
|
||||
chr(0)=>250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250,
|
||||
chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>389,'"'=>555,'#'=>500,'$'=>500,'%'=>833,'&'=>778,'\''=>278,'('=>333,')'=>333,'*'=>500,'+'=>570,
|
||||
','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>333,';'=>333,'<'=>570,'='=>570,'>'=>570,'?'=>500,'@'=>832,'A'=>667,
|
||||
'B'=>667,'C'=>667,'D'=>722,'E'=>667,'F'=>667,'G'=>722,'H'=>778,'I'=>389,'J'=>500,'K'=>667,'L'=>611,'M'=>889,'N'=>722,'O'=>722,'P'=>611,'Q'=>722,'R'=>667,'S'=>556,'T'=>611,'U'=>722,'V'=>667,'W'=>889,
|
||||
'X'=>667,'Y'=>611,'Z'=>611,'['=>333,'\\'=>278,']'=>333,'^'=>570,'_'=>500,'`'=>333,'a'=>500,'b'=>500,'c'=>444,'d'=>500,'e'=>444,'f'=>333,'g'=>500,'h'=>556,'i'=>278,'j'=>278,'k'=>500,'l'=>278,'m'=>778,
|
||||
'n'=>556,'o'=>500,'p'=>500,'q'=>500,'r'=>389,'s'=>389,'t'=>278,'u'=>556,'v'=>444,'w'=>667,'x'=>500,'y'=>444,'z'=>389,'{'=>348,'|'=>220,'}'=>348,'~'=>570,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500,
|
||||
chr(132)=>500,chr(133)=>1000,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>556,chr(139)=>333,chr(140)=>944,chr(141)=>350,chr(142)=>611,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>500,chr(148)=>500,chr(149)=>350,chr(150)=>500,chr(151)=>1000,chr(152)=>333,chr(153)=>1000,
|
||||
chr(154)=>389,chr(155)=>333,chr(156)=>722,chr(157)=>350,chr(158)=>389,chr(159)=>611,chr(160)=>250,chr(161)=>389,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>220,chr(167)=>500,chr(168)=>333,chr(169)=>747,chr(170)=>266,chr(171)=>500,chr(172)=>606,chr(173)=>333,chr(174)=>747,chr(175)=>333,
|
||||
chr(176)=>400,chr(177)=>570,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>576,chr(182)=>500,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>300,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>500,chr(192)=>667,chr(193)=>667,chr(194)=>667,chr(195)=>667,chr(196)=>667,chr(197)=>667,
|
||||
chr(198)=>944,chr(199)=>667,chr(200)=>667,chr(201)=>667,chr(202)=>667,chr(203)=>667,chr(204)=>389,chr(205)=>389,chr(206)=>389,chr(207)=>389,chr(208)=>722,chr(209)=>722,chr(210)=>722,chr(211)=>722,chr(212)=>722,chr(213)=>722,chr(214)=>722,chr(215)=>570,chr(216)=>722,chr(217)=>722,chr(218)=>722,chr(219)=>722,
|
||||
chr(220)=>722,chr(221)=>611,chr(222)=>611,chr(223)=>500,chr(224)=>500,chr(225)=>500,chr(226)=>500,chr(227)=>500,chr(228)=>500,chr(229)=>500,chr(230)=>722,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>556,
|
||||
chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>570,chr(248)=>500,chr(249)=>556,chr(250)=>556,chr(251)=>556,chr(252)=>556,chr(253)=>444,chr(254)=>500,chr(255)=>444);
|
||||
$enc = 'cp1252';
|
||||
$uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96));
|
||||
?>
|
||||
21
Cron/Fpdf/font/timesi.php
Executable file
21
Cron/Fpdf/font/timesi.php
Executable file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
$type = 'Core';
|
||||
$name = 'Times-Italic';
|
||||
$up = -100;
|
||||
$ut = 50;
|
||||
$cw = array(
|
||||
chr(0)=>250,chr(1)=>250,chr(2)=>250,chr(3)=>250,chr(4)=>250,chr(5)=>250,chr(6)=>250,chr(7)=>250,chr(8)=>250,chr(9)=>250,chr(10)=>250,chr(11)=>250,chr(12)=>250,chr(13)=>250,chr(14)=>250,chr(15)=>250,chr(16)=>250,chr(17)=>250,chr(18)=>250,chr(19)=>250,chr(20)=>250,chr(21)=>250,
|
||||
chr(22)=>250,chr(23)=>250,chr(24)=>250,chr(25)=>250,chr(26)=>250,chr(27)=>250,chr(28)=>250,chr(29)=>250,chr(30)=>250,chr(31)=>250,' '=>250,'!'=>333,'"'=>420,'#'=>500,'$'=>500,'%'=>833,'&'=>778,'\''=>214,'('=>333,')'=>333,'*'=>500,'+'=>675,
|
||||
','=>250,'-'=>333,'.'=>250,'/'=>278,'0'=>500,'1'=>500,'2'=>500,'3'=>500,'4'=>500,'5'=>500,'6'=>500,'7'=>500,'8'=>500,'9'=>500,':'=>333,';'=>333,'<'=>675,'='=>675,'>'=>675,'?'=>500,'@'=>920,'A'=>611,
|
||||
'B'=>611,'C'=>667,'D'=>722,'E'=>611,'F'=>611,'G'=>722,'H'=>722,'I'=>333,'J'=>444,'K'=>667,'L'=>556,'M'=>833,'N'=>667,'O'=>722,'P'=>611,'Q'=>722,'R'=>611,'S'=>500,'T'=>556,'U'=>722,'V'=>611,'W'=>833,
|
||||
'X'=>611,'Y'=>556,'Z'=>556,'['=>389,'\\'=>278,']'=>389,'^'=>422,'_'=>500,'`'=>333,'a'=>500,'b'=>500,'c'=>444,'d'=>500,'e'=>444,'f'=>278,'g'=>500,'h'=>500,'i'=>278,'j'=>278,'k'=>444,'l'=>278,'m'=>722,
|
||||
'n'=>500,'o'=>500,'p'=>500,'q'=>500,'r'=>389,'s'=>389,'t'=>278,'u'=>500,'v'=>444,'w'=>667,'x'=>444,'y'=>444,'z'=>389,'{'=>400,'|'=>275,'}'=>400,'~'=>541,chr(127)=>350,chr(128)=>500,chr(129)=>350,chr(130)=>333,chr(131)=>500,
|
||||
chr(132)=>556,chr(133)=>889,chr(134)=>500,chr(135)=>500,chr(136)=>333,chr(137)=>1000,chr(138)=>500,chr(139)=>333,chr(140)=>944,chr(141)=>350,chr(142)=>556,chr(143)=>350,chr(144)=>350,chr(145)=>333,chr(146)=>333,chr(147)=>556,chr(148)=>556,chr(149)=>350,chr(150)=>500,chr(151)=>889,chr(152)=>333,chr(153)=>980,
|
||||
chr(154)=>389,chr(155)=>333,chr(156)=>667,chr(157)=>350,chr(158)=>389,chr(159)=>556,chr(160)=>250,chr(161)=>389,chr(162)=>500,chr(163)=>500,chr(164)=>500,chr(165)=>500,chr(166)=>275,chr(167)=>500,chr(168)=>333,chr(169)=>760,chr(170)=>276,chr(171)=>500,chr(172)=>675,chr(173)=>333,chr(174)=>760,chr(175)=>333,
|
||||
chr(176)=>400,chr(177)=>675,chr(178)=>300,chr(179)=>300,chr(180)=>333,chr(181)=>500,chr(182)=>523,chr(183)=>250,chr(184)=>333,chr(185)=>300,chr(186)=>310,chr(187)=>500,chr(188)=>750,chr(189)=>750,chr(190)=>750,chr(191)=>500,chr(192)=>611,chr(193)=>611,chr(194)=>611,chr(195)=>611,chr(196)=>611,chr(197)=>611,
|
||||
chr(198)=>889,chr(199)=>667,chr(200)=>611,chr(201)=>611,chr(202)=>611,chr(203)=>611,chr(204)=>333,chr(205)=>333,chr(206)=>333,chr(207)=>333,chr(208)=>722,chr(209)=>667,chr(210)=>722,chr(211)=>722,chr(212)=>722,chr(213)=>722,chr(214)=>722,chr(215)=>675,chr(216)=>722,chr(217)=>722,chr(218)=>722,chr(219)=>722,
|
||||
chr(220)=>722,chr(221)=>556,chr(222)=>611,chr(223)=>500,chr(224)=>500,chr(225)=>500,chr(226)=>500,chr(227)=>500,chr(228)=>500,chr(229)=>500,chr(230)=>667,chr(231)=>444,chr(232)=>444,chr(233)=>444,chr(234)=>444,chr(235)=>444,chr(236)=>278,chr(237)=>278,chr(238)=>278,chr(239)=>278,chr(240)=>500,chr(241)=>500,
|
||||
chr(242)=>500,chr(243)=>500,chr(244)=>500,chr(245)=>500,chr(246)=>500,chr(247)=>675,chr(248)=>500,chr(249)=>500,chr(250)=>500,chr(251)=>500,chr(252)=>500,chr(253)=>444,chr(254)=>500,chr(255)=>444);
|
||||
$enc = 'cp1252';
|
||||
$uv = array(0=>array(0,128),128=>8364,130=>8218,131=>402,132=>8222,133=>8230,134=>array(8224,2),136=>710,137=>8240,138=>352,139=>8249,140=>338,142=>381,145=>array(8216,2),147=>array(8220,2),149=>8226,150=>array(8211,2),152=>732,153=>8482,154=>353,155=>8250,156=>339,158=>382,159=>376,160=>array(160,96));
|
||||
?>
|
||||
20
Cron/Fpdf/font/zapfdingbats.php
Executable file
20
Cron/Fpdf/font/zapfdingbats.php
Executable file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
$type = 'Core';
|
||||
$name = 'ZapfDingbats';
|
||||
$up = -100;
|
||||
$ut = 50;
|
||||
$cw = array(
|
||||
chr(0)=>0,chr(1)=>0,chr(2)=>0,chr(3)=>0,chr(4)=>0,chr(5)=>0,chr(6)=>0,chr(7)=>0,chr(8)=>0,chr(9)=>0,chr(10)=>0,chr(11)=>0,chr(12)=>0,chr(13)=>0,chr(14)=>0,chr(15)=>0,chr(16)=>0,chr(17)=>0,chr(18)=>0,chr(19)=>0,chr(20)=>0,chr(21)=>0,
|
||||
chr(22)=>0,chr(23)=>0,chr(24)=>0,chr(25)=>0,chr(26)=>0,chr(27)=>0,chr(28)=>0,chr(29)=>0,chr(30)=>0,chr(31)=>0,' '=>278,'!'=>974,'"'=>961,'#'=>974,'$'=>980,'%'=>719,'&'=>789,'\''=>790,'('=>791,')'=>690,'*'=>960,'+'=>939,
|
||||
','=>549,'-'=>855,'.'=>911,'/'=>933,'0'=>911,'1'=>945,'2'=>974,'3'=>755,'4'=>846,'5'=>762,'6'=>761,'7'=>571,'8'=>677,'9'=>763,':'=>760,';'=>759,'<'=>754,'='=>494,'>'=>552,'?'=>537,'@'=>577,'A'=>692,
|
||||
'B'=>786,'C'=>788,'D'=>788,'E'=>790,'F'=>793,'G'=>794,'H'=>816,'I'=>823,'J'=>789,'K'=>841,'L'=>823,'M'=>833,'N'=>816,'O'=>831,'P'=>923,'Q'=>744,'R'=>723,'S'=>749,'T'=>790,'U'=>792,'V'=>695,'W'=>776,
|
||||
'X'=>768,'Y'=>792,'Z'=>759,'['=>707,'\\'=>708,']'=>682,'^'=>701,'_'=>826,'`'=>815,'a'=>789,'b'=>789,'c'=>707,'d'=>687,'e'=>696,'f'=>689,'g'=>786,'h'=>787,'i'=>713,'j'=>791,'k'=>785,'l'=>791,'m'=>873,
|
||||
'n'=>761,'o'=>762,'p'=>762,'q'=>759,'r'=>759,'s'=>892,'t'=>892,'u'=>788,'v'=>784,'w'=>438,'x'=>138,'y'=>277,'z'=>415,'{'=>392,'|'=>392,'}'=>668,'~'=>668,chr(127)=>0,chr(128)=>390,chr(129)=>390,chr(130)=>317,chr(131)=>317,
|
||||
chr(132)=>276,chr(133)=>276,chr(134)=>509,chr(135)=>509,chr(136)=>410,chr(137)=>410,chr(138)=>234,chr(139)=>234,chr(140)=>334,chr(141)=>334,chr(142)=>0,chr(143)=>0,chr(144)=>0,chr(145)=>0,chr(146)=>0,chr(147)=>0,chr(148)=>0,chr(149)=>0,chr(150)=>0,chr(151)=>0,chr(152)=>0,chr(153)=>0,
|
||||
chr(154)=>0,chr(155)=>0,chr(156)=>0,chr(157)=>0,chr(158)=>0,chr(159)=>0,chr(160)=>0,chr(161)=>732,chr(162)=>544,chr(163)=>544,chr(164)=>910,chr(165)=>667,chr(166)=>760,chr(167)=>760,chr(168)=>776,chr(169)=>595,chr(170)=>694,chr(171)=>626,chr(172)=>788,chr(173)=>788,chr(174)=>788,chr(175)=>788,
|
||||
chr(176)=>788,chr(177)=>788,chr(178)=>788,chr(179)=>788,chr(180)=>788,chr(181)=>788,chr(182)=>788,chr(183)=>788,chr(184)=>788,chr(185)=>788,chr(186)=>788,chr(187)=>788,chr(188)=>788,chr(189)=>788,chr(190)=>788,chr(191)=>788,chr(192)=>788,chr(193)=>788,chr(194)=>788,chr(195)=>788,chr(196)=>788,chr(197)=>788,
|
||||
chr(198)=>788,chr(199)=>788,chr(200)=>788,chr(201)=>788,chr(202)=>788,chr(203)=>788,chr(204)=>788,chr(205)=>788,chr(206)=>788,chr(207)=>788,chr(208)=>788,chr(209)=>788,chr(210)=>788,chr(211)=>788,chr(212)=>894,chr(213)=>838,chr(214)=>1016,chr(215)=>458,chr(216)=>748,chr(217)=>924,chr(218)=>748,chr(219)=>918,
|
||||
chr(220)=>927,chr(221)=>928,chr(222)=>928,chr(223)=>834,chr(224)=>873,chr(225)=>828,chr(226)=>924,chr(227)=>924,chr(228)=>917,chr(229)=>930,chr(230)=>931,chr(231)=>463,chr(232)=>883,chr(233)=>836,chr(234)=>836,chr(235)=>867,chr(236)=>867,chr(237)=>696,chr(238)=>696,chr(239)=>874,chr(240)=>0,chr(241)=>874,
|
||||
chr(242)=>760,chr(243)=>946,chr(244)=>771,chr(245)=>865,chr(246)=>771,chr(247)=>888,chr(248)=>967,chr(249)=>888,chr(250)=>831,chr(251)=>873,chr(252)=>927,chr(253)=>970,chr(254)=>918,chr(255)=>0);
|
||||
$uv = array(32=>32,33=>array(9985,4),37=>9742,38=>array(9990,4),42=>9755,43=>9758,44=>array(9996,28),72=>9733,73=>array(10025,35),108=>9679,109=>10061,110=>9632,111=>array(10063,4),115=>9650,116=>9660,117=>9670,118=>10070,119=>9687,120=>array(10072,7),128=>array(10088,14),161=>array(10081,7),168=>9827,169=>9830,170=>9829,171=>9824,172=>array(9312,10),182=>array(10102,31),213=>8594,214=>array(8596,2),216=>array(10136,24),241=>array(10161,14));
|
||||
?>
|
||||
2154
Cron/Fpdf/fpdf.php
Executable file
2154
Cron/Fpdf/fpdf.php
Executable file
File diff suppressed because it is too large
Load Diff
198
Cron/Fpdf/fpdf_protection.php
Normal file
198
Cron/Fpdf/fpdf_protection.php
Normal file
@@ -0,0 +1,198 @@
|
||||
<?php
|
||||
/****************************************************************************
|
||||
* Software: FPDF_Protection *
|
||||
* Version: 1.06 *
|
||||
* Date: 2023-01-01 *
|
||||
* Author: Klemen VODOPIVEC *
|
||||
* License: FPDF *
|
||||
* *
|
||||
* Thanks: Cpdf (http://www.ros.co.nz/pdf) was my working sample of how to *
|
||||
* implement protection in pdf. *
|
||||
****************************************************************************/
|
||||
|
||||
require('fpdfdraw.php');
|
||||
|
||||
function RC4($key, $data)
|
||||
{
|
||||
static $last_key, $last_state;
|
||||
|
||||
if($key != $last_key)
|
||||
{
|
||||
$k = str_repeat($key, ceil(256/strlen($key)));
|
||||
$state = range(0, 255);
|
||||
$j = 0;
|
||||
for ($i=0; $i<256; $i++){
|
||||
$t = $state[$i];
|
||||
$j = ($j + $t + ord($k[$i])) % 256;
|
||||
$state[$i] = $state[$j];
|
||||
$state[$j] = $t;
|
||||
}
|
||||
$last_key = $key;
|
||||
$last_state = $state;
|
||||
}
|
||||
else
|
||||
$state = $last_state;
|
||||
|
||||
$len = strlen($data);
|
||||
$a = 0;
|
||||
$b = 0;
|
||||
$out = '';
|
||||
for ($i=0; $i<$len; $i++){
|
||||
$a = ($a+1) % 256;
|
||||
$t = $state[$a];
|
||||
$b = ($b+$t) % 256;
|
||||
$state[$a] = $state[$b];
|
||||
$state[$b] = $t;
|
||||
$k = $state[($state[$a]+$state[$b]) % 256];
|
||||
$out .= chr(ord($data[$i]) ^ $k);
|
||||
}
|
||||
return $out;
|
||||
}
|
||||
|
||||
class FPDF_Protection extends PDF_Draw
|
||||
{
|
||||
protected $encrypted = false;
|
||||
protected $padding;
|
||||
protected $encryption_key;
|
||||
protected $Uvalue; //U entry in pdf document
|
||||
protected $Ovalue; //O entry in pdf document
|
||||
protected $Pvalue; //P entry in pdf document
|
||||
protected $enc_obj_id; //encryption object id
|
||||
|
||||
/**
|
||||
* Function to set permissions as well as user and owner passwords
|
||||
*
|
||||
* - permissions is an array with values taken from the following list:
|
||||
* copy, print, modify, annot-forms
|
||||
* If a value is present it means that the permission is granted
|
||||
* - If a user password is set, user will be prompted before document is opened
|
||||
* - If an owner password is set, document can be opened in privilege mode with no
|
||||
* restriction if that password is entered
|
||||
*/
|
||||
function SetProtection($permissions=array(), $user_pass='', $owner_pass=null)
|
||||
{
|
||||
$options = array('print' => 4, 'modify' => 8, 'copy' => 16, 'annot-forms' => 32 );
|
||||
$protection = 192;
|
||||
foreach($permissions as $permission)
|
||||
{
|
||||
if (!isset($options[$permission]))
|
||||
$this->Error('Incorrect permission: '.$permission);
|
||||
$protection += $options[$permission];
|
||||
}
|
||||
if ($owner_pass === null)
|
||||
$owner_pass = uniqid(rand());
|
||||
$this->encrypted = true;
|
||||
$this->padding = "\x28\xBF\x4E\x5E\x4E\x75\x8A\x41\x64\x00\x4E\x56\xFF\xFA\x01\x08".
|
||||
"\x2E\x2E\x00\xB6\xD0\x68\x3E\x80\x2F\x0C\xA9\xFE\x64\x53\x69\x7A";
|
||||
$this->_generateencryptionkey($user_pass, $owner_pass, $protection);
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* *
|
||||
* Private methods *
|
||||
* *
|
||||
****************************************************************************/
|
||||
|
||||
function _putstream($s)
|
||||
{
|
||||
if ($this->encrypted)
|
||||
$s = RC4($this->_objectkey($this->n), $s);
|
||||
parent::_putstream($s);
|
||||
}
|
||||
|
||||
function _textstring($s)
|
||||
{
|
||||
if (!$this->_isascii($s))
|
||||
$s = $this->_UTF8toUTF16($s);
|
||||
if ($this->encrypted)
|
||||
$s = RC4($this->_objectkey($this->n), $s);
|
||||
return '('.$this->_escape($s).')';
|
||||
}
|
||||
|
||||
/**
|
||||
* Compute key depending on object number where the encrypted data is stored
|
||||
*/
|
||||
function _objectkey($n)
|
||||
{
|
||||
return substr($this->_md5_16($this->encryption_key.pack('VXxx',$n)),0,10);
|
||||
}
|
||||
|
||||
function _putresources()
|
||||
{
|
||||
parent::_putresources();
|
||||
if ($this->encrypted) {
|
||||
$this->_newobj();
|
||||
$this->enc_obj_id = $this->n;
|
||||
$this->_put('<<');
|
||||
$this->_putencryption();
|
||||
$this->_put('>>');
|
||||
$this->_put('endobj');
|
||||
}
|
||||
}
|
||||
|
||||
function _putencryption()
|
||||
{
|
||||
$this->_put('/Filter /Standard');
|
||||
$this->_put('/V 1');
|
||||
$this->_put('/R 2');
|
||||
$this->_put('/O ('.$this->_escape($this->Ovalue).')');
|
||||
$this->_put('/U ('.$this->_escape($this->Uvalue).')');
|
||||
$this->_put('/P '.$this->Pvalue);
|
||||
}
|
||||
|
||||
function _puttrailer()
|
||||
{
|
||||
parent::_puttrailer();
|
||||
if ($this->encrypted) {
|
||||
$this->_put('/Encrypt '.$this->enc_obj_id.' 0 R');
|
||||
$this->_put('/ID [()()]');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get MD5 as binary string
|
||||
*/
|
||||
function _md5_16($string)
|
||||
{
|
||||
return md5($string, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Compute O value
|
||||
*/
|
||||
function _Ovalue($user_pass, $owner_pass)
|
||||
{
|
||||
$tmp = $this->_md5_16($owner_pass);
|
||||
$owner_RC4_key = substr($tmp,0,5);
|
||||
return RC4($owner_RC4_key, $user_pass);
|
||||
}
|
||||
|
||||
/**
|
||||
* Compute U value
|
||||
*/
|
||||
function _Uvalue()
|
||||
{
|
||||
return RC4($this->encryption_key, $this->padding);
|
||||
}
|
||||
|
||||
/**
|
||||
* Compute encryption key
|
||||
*/
|
||||
function _generateencryptionkey($user_pass, $owner_pass, $protection)
|
||||
{
|
||||
// Pad passwords
|
||||
$user_pass = substr($user_pass.$this->padding,0,32);
|
||||
$owner_pass = substr($owner_pass.$this->padding,0,32);
|
||||
// Compute O value
|
||||
$this->Ovalue = $this->_Ovalue($user_pass,$owner_pass);
|
||||
// Compute encyption key
|
||||
$tmp = $this->_md5_16($user_pass.$this->Ovalue.chr($protection)."\xFF\xFF\xFF");
|
||||
$this->encryption_key = substr($tmp,0,5);
|
||||
// Compute U value
|
||||
$this->Uvalue = $this->_Uvalue();
|
||||
// Compute P value
|
||||
$this->Pvalue = -(($protection^255)+1);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
482
Cron/Fpdf/fpdfdraw.php
Normal file
482
Cron/Fpdf/fpdfdraw.php
Normal file
@@ -0,0 +1,482 @@
|
||||
<?php
|
||||
require('fpdf.php');
|
||||
|
||||
class PDF_Draw extends FPDF {
|
||||
// Sets line style
|
||||
// Parameters:
|
||||
// - style: Line style. Array with keys among the following:
|
||||
// . width: Width of the line in user units
|
||||
// . cap: Type of cap to put on the line (butt, round, square). The difference between 'square' and 'butt' is that 'square' projects a flat end past the end of the line.
|
||||
// . join: miter, round or bevel
|
||||
// . dash: Dash pattern. Is 0 (without dash) or array with series of length values, which are the lengths of the on and off dashes.
|
||||
// For example: (2) represents 2 on, 2 off, 2 on , 2 off ...
|
||||
// (2,1) is 2 on, 1 off, 2 on, 1 off.. etc
|
||||
// . phase: Modifier of the dash pattern which is used to shift the point at which the pattern starts
|
||||
// . color: Draw color. Array with components (red, green, blue)
|
||||
function SetLineStyle($style) {
|
||||
extract($style);
|
||||
if (isset($width)) {
|
||||
$width_prev = $this->LineWidth;
|
||||
$this->SetLineWidth($width);
|
||||
$this->LineWidth = $width_prev;
|
||||
}
|
||||
if (isset($cap)) {
|
||||
$ca = array('butt' => 0, 'round'=> 1, 'square' => 2);
|
||||
if (isset($ca[$cap]))
|
||||
$this->_out($ca[$cap] . ' J');
|
||||
}
|
||||
if (isset($join)) {
|
||||
$ja = array('miter' => 0, 'round' => 1, 'bevel' => 2);
|
||||
if (isset($ja[$join]))
|
||||
$this->_out($ja[$join] . ' j');
|
||||
}
|
||||
if (isset($dash)) {
|
||||
$dash_string = '';
|
||||
if ($dash) {
|
||||
$tab = explode(',', $dash);
|
||||
$dash_string = '';
|
||||
foreach ($tab as $i => $v) {
|
||||
if ($i > 0)
|
||||
$dash_string .= ' ';
|
||||
$dash_string .= sprintf('%.2F', $v);
|
||||
}
|
||||
}
|
||||
if (!isset($phase) || !$dash)
|
||||
$phase = 0;
|
||||
$this->_out(sprintf('[%s] %.2F d', $dash_string, $phase));
|
||||
}
|
||||
if (isset($color)) {
|
||||
list($r, $g, $b) = $color;
|
||||
$this->SetDrawColor($r, $g, $b);
|
||||
}
|
||||
}
|
||||
|
||||
// Draws a line
|
||||
// Parameters:
|
||||
// - x1, y1: Start point
|
||||
// - x2, y2: End point
|
||||
// - style: Line style. Array like for SetLineStyle
|
||||
function Line($x1, $y1, $x2, $y2, $style = null) {
|
||||
if ($style)
|
||||
$this->SetLineStyle($style);
|
||||
parent::Line($x1, $y1, $x2, $y2);
|
||||
}
|
||||
|
||||
// Draws a rectangle
|
||||
// Parameters:
|
||||
// - x, y: Top left corner
|
||||
// - w, h: Width and height
|
||||
// - style: Style of rectangle (draw and/or fill: D, F, DF, FD)
|
||||
// - border_style: Border style of rectangle. Array with some of this index
|
||||
// . all: Line style of all borders. Array like for SetLineStyle
|
||||
// . L: Line style of left border. null (no border) or array like for SetLineStyle
|
||||
// . T: Line style of top border. null (no border) or array like for SetLineStyle
|
||||
// . R: Line style of right border. null (no border) or array like for SetLineStyle
|
||||
// . B: Line style of bottom border. null (no border) or array like for SetLineStyle
|
||||
// - fill_color: Fill color. Array with components (red, green, blue)
|
||||
function Rect($x, $y, $w, $h, $style = '', $border_style = null, $fill_color = null) {
|
||||
if (!(false === strpos($style, 'F')) && $fill_color) {
|
||||
list($r, $g, $b) = $fill_color;
|
||||
$this->SetFillColor($r, $g, $b);
|
||||
}
|
||||
switch ($style) {
|
||||
case 'F':
|
||||
$border_style = null;
|
||||
parent::Rect($x, $y, $w, $h, $style);
|
||||
break;
|
||||
case 'DF': case 'FD':
|
||||
if (!$border_style || isset($border_style['all'])) {
|
||||
if (isset($border_style['all'])) {
|
||||
$this->SetLineStyle($border_style['all']);
|
||||
$border_style = null;
|
||||
}
|
||||
} else
|
||||
$style = 'F';
|
||||
parent::Rect($x, $y, $w, $h, $style);
|
||||
break;
|
||||
default:
|
||||
if (!$border_style || isset($border_style['all'])) {
|
||||
if (isset($border_style['all']) && $border_style['all']) {
|
||||
$this->SetLineStyle($border_style['all']);
|
||||
$border_style = null;
|
||||
}
|
||||
parent::Rect($x, $y, $w, $h, $style);
|
||||
}
|
||||
break;
|
||||
}
|
||||
if ($border_style) {
|
||||
if (isset($border_style['L']) && $border_style['L'])
|
||||
$this->Line($x, $y, $x, $y + $h, $border_style['L']);
|
||||
if (isset($border_style['T']) && $border_style['T'])
|
||||
$this->Line($x, $y, $x + $w, $y, $border_style['T']);
|
||||
if (isset($border_style['R']) && $border_style['R'])
|
||||
$this->Line($x + $w, $y, $x + $w, $y + $h, $border_style['R']);
|
||||
if (isset($border_style['B']) && $border_style['B'])
|
||||
$this->Line($x, $y + $h, $x + $w, $y + $h, $border_style['B']);
|
||||
}
|
||||
}
|
||||
|
||||
// Draws a B<>zier curve (the B<>zier curve is tangent to the line between the control points at either end of the curve)
|
||||
// Parameters:
|
||||
// - x0, y0: Start point
|
||||
// - x1, y1: Control point 1
|
||||
// - x2, y2: Control point 2
|
||||
// - x3, y3: End point
|
||||
// - style: Style of rectangule (draw and/or fill: D, F, DF, FD)
|
||||
// - line_style: Line style for curve. Array like for SetLineStyle
|
||||
// - fill_color: Fill color. Array with components (red, green, blue)
|
||||
function Curve($x0, $y0, $x1, $y1, $x2, $y2, $x3, $y3, $style = '', $line_style = null, $fill_color = null) {
|
||||
if (!(false === strpos($style, 'F')) && $fill_color) {
|
||||
list($r, $g, $b) = $fill_color;
|
||||
$this->SetFillColor($r, $g, $b);
|
||||
}
|
||||
switch ($style) {
|
||||
case 'F':
|
||||
$op = 'f';
|
||||
$line_style = null;
|
||||
break;
|
||||
case 'FD': case 'DF':
|
||||
$op = 'B';
|
||||
break;
|
||||
default:
|
||||
$op = 'S';
|
||||
break;
|
||||
}
|
||||
if ($line_style)
|
||||
$this->SetLineStyle($line_style);
|
||||
|
||||
$this->_Point($x0, $y0);
|
||||
$this->_Curve($x1, $y1, $x2, $y2, $x3, $y3);
|
||||
$this->_out($op);
|
||||
}
|
||||
|
||||
// Draws an ellipse
|
||||
// Parameters:
|
||||
// - x0, y0: Center point
|
||||
// - rx, ry: Horizontal and vertical radius (if ry = 0, draws a circle)
|
||||
// - angle: Orientation angle (anti-clockwise)
|
||||
// - astart: Start angle
|
||||
// - afinish: Finish angle
|
||||
// - style: Style of ellipse (draw and/or fill: D, F, DF, FD, C (D + close))
|
||||
// - line_style: Line style for ellipse. Array like for SetLineStyle
|
||||
// - fill_color: Fill color. Array with components (red, green, blue)
|
||||
// - nSeg: Ellipse is made up of nSeg B<>zier curves
|
||||
function Ellipse($x0, $y0, $rx, $ry = 0, $angle = 0, $astart = 0, $afinish = 360, $style = '', $line_style = null, $fill_color = null, $nSeg = 8) {
|
||||
if ($rx) {
|
||||
if (!(false === strpos($style, 'F')) && $fill_color) {
|
||||
list($r, $g, $b) = $fill_color;
|
||||
$this->SetFillColor($r, $g, $b);
|
||||
}
|
||||
switch ($style) {
|
||||
case 'F':
|
||||
$op = 'f';
|
||||
$line_style = null;
|
||||
break;
|
||||
case 'FD': case 'DF':
|
||||
$op = 'B';
|
||||
break;
|
||||
case 'C':
|
||||
$op = 's'; // small 's' means closing the path as well
|
||||
break;
|
||||
default:
|
||||
$op = 'S';
|
||||
break;
|
||||
}
|
||||
if ($line_style)
|
||||
$this->SetLineStyle($line_style);
|
||||
if (!$ry)
|
||||
$ry = $rx;
|
||||
$rx *= $this->k;
|
||||
$ry *= $this->k;
|
||||
if ($nSeg < 2)
|
||||
$nSeg = 2;
|
||||
|
||||
$astart = deg2rad((float) $astart);
|
||||
$afinish = deg2rad((float) $afinish);
|
||||
$totalAngle = $afinish - $astart;
|
||||
|
||||
$dt = $totalAngle/$nSeg;
|
||||
$dtm = $dt/3;
|
||||
|
||||
$x0 *= $this->k;
|
||||
$y0 = ($this->h - $y0) * $this->k;
|
||||
if ($angle != 0) {
|
||||
$a = -deg2rad((float) $angle);
|
||||
$this->_out(sprintf('q %.2F %.2F %.2F %.2F %.2F %.2F cm', cos($a), -1 * sin($a), sin($a), cos($a), $x0, $y0));
|
||||
$x0 = 0;
|
||||
$y0 = 0;
|
||||
}
|
||||
|
||||
$t1 = $astart;
|
||||
$a0 = $x0 + ($rx * cos($t1));
|
||||
$b0 = $y0 + ($ry * sin($t1));
|
||||
$c0 = -$rx * sin($t1);
|
||||
$d0 = $ry * cos($t1);
|
||||
$this->_Point($a0 / $this->k, $this->h - ($b0 / $this->k));
|
||||
for ($i = 1; $i <= $nSeg; $i++) {
|
||||
// Draw this bit of the total curve
|
||||
$t1 = ($i * $dt) + $astart;
|
||||
$a1 = $x0 + ($rx * cos($t1));
|
||||
$b1 = $y0 + ($ry * sin($t1));
|
||||
$c1 = -$rx * sin($t1);
|
||||
$d1 = $ry * cos($t1);
|
||||
$this->_Curve(($a0 + ($c0 * $dtm)) / $this->k,
|
||||
$this->h - (($b0 + ($d0 * $dtm)) / $this->k),
|
||||
($a1 - ($c1 * $dtm)) / $this->k,
|
||||
$this->h - (($b1 - ($d1 * $dtm)) / $this->k),
|
||||
$a1 / $this->k,
|
||||
$this->h - ($b1 / $this->k));
|
||||
$a0 = $a1;
|
||||
$b0 = $b1;
|
||||
$c0 = $c1;
|
||||
$d0 = $d1;
|
||||
}
|
||||
$this->_out($op);
|
||||
if ($angle !=0)
|
||||
$this->_out('Q');
|
||||
}
|
||||
}
|
||||
|
||||
// Draws a circle
|
||||
// Parameters:
|
||||
// - x0, y0: Center point
|
||||
// - r: Radius
|
||||
// - astart: Start angle
|
||||
// - afinish: Finish angle
|
||||
// - style: Style of circle (draw and/or fill) (D, F, DF, FD, C (D + close))
|
||||
// - line_style: Line style for circle. Array like for SetLineStyle
|
||||
// - fill_color: Fill color. Array with components (red, green, blue)
|
||||
// - nSeg: Ellipse is made up of nSeg B<>zier curves
|
||||
function Circle($x0, $y0, $r, $astart = 0, $afinish = 360, $style = '', $line_style = null, $fill_color = null, $nSeg = 8) {
|
||||
$this->Ellipse($x0, $y0, $r, 0, 0, $astart, $afinish, $style, $line_style, $fill_color, $nSeg);
|
||||
}
|
||||
|
||||
// Draws a polygon
|
||||
// Parameters:
|
||||
// - p: Points. Array with values x0, y0, x1, y1,..., x(np-1), y(np - 1)
|
||||
// - style: Style of polygon (draw and/or fill) (D, F, DF, FD)
|
||||
// - line_style: Line style. Array with one of this index
|
||||
// . all: Line style of all lines. Array like for SetLineStyle
|
||||
// . 0..np-1: Line style of each line. Item is 0 (not line) or like for SetLineStyle
|
||||
// - fill_color: Fill color. Array with components (red, green, blue)
|
||||
function Polygon($p, $style = '', $line_style = null, $fill_color = null) {
|
||||
$np = count($p) / 2;
|
||||
if (!(false === strpos($style, 'F')) && $fill_color) {
|
||||
list($r, $g, $b) = $fill_color;
|
||||
$this->SetFillColor($r, $g, $b);
|
||||
}
|
||||
switch ($style) {
|
||||
case 'F':
|
||||
$line_style = null;
|
||||
$op = 'f';
|
||||
break;
|
||||
case 'FD': case 'DF':
|
||||
$op = 'B';
|
||||
break;
|
||||
default:
|
||||
$op = 'S';
|
||||
break;
|
||||
}
|
||||
$draw = true;
|
||||
if ($line_style)
|
||||
if (isset($line_style['all']))
|
||||
$this->SetLineStyle($line_style['all']);
|
||||
else { // 0 .. (np - 1), op = {B, S}
|
||||
$draw = false;
|
||||
if ('B' == $op) {
|
||||
$op = 'f';
|
||||
$this->_Point($p[0], $p[1]);
|
||||
for ($i = 2; $i < ($np * 2); $i = $i + 2)
|
||||
$this->_Line($p[$i], $p[$i + 1]);
|
||||
$this->_Line($p[0], $p[1]);
|
||||
$this->_out($op);
|
||||
}
|
||||
$p[$np * 2] = $p[0];
|
||||
$p[($np * 2) + 1] = $p[1];
|
||||
for ($i = 0; $i < $np; $i++)
|
||||
if (!empty($line_style[$i]))
|
||||
$this->Line($p[$i * 2], $p[($i * 2) + 1], $p[($i * 2) + 2], $p[($i * 2) + 3], $line_style[$i]);
|
||||
}
|
||||
|
||||
if ($draw) {
|
||||
$this->_Point($p[0], $p[1]);
|
||||
for ($i = 2; $i < ($np * 2); $i = $i + 2)
|
||||
$this->_Line($p[$i], $p[$i + 1]);
|
||||
$this->_Line($p[0], $p[1]);
|
||||
$this->_out($op);
|
||||
}
|
||||
}
|
||||
|
||||
// Draws a regular polygon
|
||||
// Parameters:
|
||||
// - x0, y0: Center point
|
||||
// - r: Radius of circumscribed circle
|
||||
// - ns: Number of sides
|
||||
// - angle: Orientation angle (anti-clockwise)
|
||||
// - circle: Draw circumscribed circle or not
|
||||
// - style: Style of polygon (draw and/or fill) (D, F, DF, FD)
|
||||
// - line_style: Line style. Array with one of this index
|
||||
// . all: Line style of all lines. Array like for SetLineStyle
|
||||
// . 0..ns-1: Line style of each line. Item is 0 (not line) or like for SetLineStyle
|
||||
// - fill_color: Fill color. Array with components (red, green, blue)
|
||||
// - circle_style: Style of circumscribed circle (draw and/or fill) (D, F, DF, FD) (if draw)
|
||||
// - circle_line_style: Line style for circumscribed circle. Array like for SetLineStyle (if draw)
|
||||
// - circle_fill_color: Fill color for circumscribed circle. Array with components (red, green, blue) (if draw fill circle)
|
||||
function RegularPolygon($x0, $y0, $r, $ns, $angle = 0, $circle = false, $style = '', $line_style = null, $fill_color = null, $circle_style = '', $circle_line_style = null, $circle_fill_color = null) {
|
||||
if ($ns < 3)
|
||||
$ns = 3;
|
||||
if ($circle)
|
||||
$this->Circle($x0, $y0, $r, 0, 360, $circle_style, $circle_line_style, $circle_fill_color);
|
||||
$p = null;
|
||||
for ($i = 0; $i < $ns; $i++) {
|
||||
$a = $angle + ($i * 360 / $ns);
|
||||
$a_rad = deg2rad((float) $a);
|
||||
$p[] = $x0 + ($r * sin($a_rad));
|
||||
$p[] = $y0 + ($r * cos($a_rad));
|
||||
}
|
||||
$this->Polygon($p, $style, $line_style, $fill_color);
|
||||
}
|
||||
|
||||
// Draws a star polygon
|
||||
// Parameters:
|
||||
// - x0, y0: Center point
|
||||
// - r: Radius of circumscribed circle
|
||||
// - nv: Number of vertices
|
||||
// - ng: Number of gaps (ng % nv = 1 => regular polygon)
|
||||
// - angle: Orientation angle (anti-clockwise)
|
||||
// - circle: Draw circumscribed circle or not
|
||||
// - style: Style of polygon (draw and/or fill) (D, F, DF, FD)
|
||||
// - line_style: Line style. Array with one of this index
|
||||
// . all: Line style of all lines. Array like for SetLineStyle
|
||||
// . 0..n-1: Line style of each line. Item is 0 (not line) or like for SetLineStyle
|
||||
// - fill_color: Fill color. Array with components (red, green, blue)
|
||||
// - circle_style: Style of circumscribed circle (draw and/or fill) (D, F, DF, FD) (if draw)
|
||||
// - circle_line_style: Line style for circumscribed circle. Array like for SetLineStyle (if draw)
|
||||
// - circle_fill_color: Fill color for circumscribed circle. Array with components (red, green, blue) (if draw fill circle)
|
||||
function StarPolygon($x0, $y0, $r, $nv, $ng, $angle = 0, $circle = false, $style = '', $line_style = null, $fill_color = null, $circle_style = '', $circle_line_style = null, $circle_fill_color = null) {
|
||||
if ($nv < 2)
|
||||
$nv = 2;
|
||||
if ($circle)
|
||||
$this->Circle($x0, $y0, $r, 0, 360, $circle_style, $circle_line_style, $circle_fill_color);
|
||||
$p2 = null;
|
||||
$visited = null;
|
||||
for ($i = 0; $i < $nv; $i++) {
|
||||
$a = $angle + ($i * 360 / $nv);
|
||||
$a_rad = deg2rad((float) $a);
|
||||
$p2[] = $x0 + ($r * sin($a_rad));
|
||||
$p2[] = $y0 + ($r * cos($a_rad));
|
||||
$visited[] = false;
|
||||
}
|
||||
$p = null;
|
||||
$i = 0;
|
||||
do {
|
||||
$p[] = $p2[$i * 2];
|
||||
$p[] = $p2[($i * 2) + 1];
|
||||
$visited[$i] = true;
|
||||
$i += $ng;
|
||||
$i %= $nv;
|
||||
} while (!$visited[$i]);
|
||||
$this->Polygon($p, $style, $line_style, $fill_color);
|
||||
}
|
||||
|
||||
// Draws a rounded rectangle
|
||||
// Parameters:
|
||||
// - x, y: Top left corner
|
||||
// - w, h: Width and height
|
||||
// - r: Radius of the rounded corners
|
||||
// - round_corner: Draws rounded corner or not. String with a 0 (not rounded i-corner) or 1 (rounded i-corner) in i-position. Positions are, in order and begin to 0: top left, top right, bottom right and bottom left
|
||||
// - style: Style of rectangle (draw and/or fill) (D, F, DF, FD)
|
||||
// - border_style: Border style of rectangle. Array like for SetLineStyle
|
||||
// - fill_color: Fill color. Array with components (red, green, blue)
|
||||
function RoundedRect($x, $y, $w, $h, $r, $round_corner = '1111', $style = '', $border_style = null, $fill_color = null) {
|
||||
if ('0000' == $round_corner) // Not rounded
|
||||
$this->Rect($x, $y, $w, $h, $style, $border_style, $fill_color);
|
||||
else { // Rounded
|
||||
if (!(false === strpos($style, 'F')) && $fill_color) {
|
||||
list($red, $g, $b) = $fill_color;
|
||||
$this->SetFillColor($red, $g, $b);
|
||||
}
|
||||
switch ($style) {
|
||||
case 'F':
|
||||
$border_style = null;
|
||||
$op = 'f';
|
||||
break;
|
||||
case 'FD': case 'DF':
|
||||
$op = 'B';
|
||||
break;
|
||||
default:
|
||||
$op = 'S';
|
||||
break;
|
||||
}
|
||||
if ($border_style)
|
||||
$this->SetLineStyle($border_style);
|
||||
|
||||
$MyArc = 4 / 3 * (sqrt(2) - 1);
|
||||
|
||||
$this->_Point($x + $r, $y);
|
||||
$xc = $x + $w - $r;
|
||||
$yc = $y + $r;
|
||||
$this->_Line($xc, $y);
|
||||
if ($round_corner[0])
|
||||
$this->_Curve($xc + ($r * $MyArc), $yc - $r, $xc + $r, $yc - ($r * $MyArc), $xc + $r, $yc);
|
||||
else
|
||||
$this->_Line($x + $w, $y);
|
||||
|
||||
$xc = $x + $w - $r ;
|
||||
$yc = $y + $h - $r;
|
||||
$this->_Line($x + $w, $yc);
|
||||
|
||||
if ($round_corner[1])
|
||||
$this->_Curve($xc + $r, $yc + ($r * $MyArc), $xc + ($r * $MyArc), $yc + $r, $xc, $yc + $r);
|
||||
else
|
||||
$this->_Line($x + $w, $y + $h);
|
||||
|
||||
$xc = $x + $r;
|
||||
$yc = $y + $h - $r;
|
||||
$this->_Line($xc, $y + $h);
|
||||
if ($round_corner[2])
|
||||
$this->_Curve($xc - ($r * $MyArc), $yc + $r, $xc - $r, $yc + ($r * $MyArc), $xc - $r, $yc);
|
||||
else
|
||||
$this->_Line($x, $y + $h);
|
||||
|
||||
$xc = $x + $r;
|
||||
$yc = $y + $r;
|
||||
$this->_Line($x, $yc);
|
||||
if ($round_corner[3])
|
||||
$this->_Curve($xc - $r, $yc - ($r * $MyArc), $xc - ($r * $MyArc), $yc - $r, $xc, $yc - $r);
|
||||
else {
|
||||
$this->_Line($x, $y);
|
||||
$this->_Line($x + $r, $y);
|
||||
}
|
||||
$this->_out($op);
|
||||
}
|
||||
}
|
||||
|
||||
/* PRIVATE METHODS */
|
||||
|
||||
// Sets a draw point
|
||||
// Parameters:
|
||||
// - x, y: Point
|
||||
function _Point($x, $y) {
|
||||
$this->_out(sprintf('%.2F %.2F m', $x * $this->k, ($this->h - $y) * $this->k));
|
||||
}
|
||||
|
||||
// Draws a line from last draw point
|
||||
// Parameters:
|
||||
// - x, y: End point
|
||||
function _Line($x, $y) {
|
||||
$this->_out(sprintf('%.2F %.2F l', $x * $this->k, ($this->h - $y) * $this->k));
|
||||
}
|
||||
|
||||
// Draws a B<>zier curve from last draw point
|
||||
// Parameters:
|
||||
// - x1, y1: Control point 1
|
||||
// - x2, y2: Control point 2
|
||||
// - x3, y3: End point
|
||||
function _Curve($x1, $y1, $x2, $y2, $x3, $y3) {
|
||||
$this->_out(sprintf('%.2F %.2F %.2F %.2F %.2F %.2F c', $x1 * $this->k, ($this->h - $y1) * $this->k, $x2 * $this->k, ($this->h - $y2) * $this->k, $x3 * $this->k, ($this->h - $y3) * $this->k));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
850
Cron/Functions.php
Executable file
850
Cron/Functions.php
Executable file
@@ -0,0 +1,850 @@
|
||||
<?php
|
||||
|
||||
// funtion de cron
|
||||
|
||||
require_once 'Lang.php';
|
||||
|
||||
|
||||
date_default_timezone_set("Africa/Kigali");
|
||||
|
||||
function tester_des_adresses_email($liste_email)
|
||||
{
|
||||
$addr = explode(';', $liste_email);
|
||||
foreach ($addr as $ad)
|
||||
{
|
||||
if (preg_match("#^[a-z0-9._-]+@[a-z0-9._-]{2,}\.[a-z]{2,4}$#i", $ad)==false)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function tester_une_adresse_email($email)
|
||||
{
|
||||
return preg_match("#^[a-z0-9._-]+@[a-z0-9._-]{2,}\.[a-z]{2,4}$#i", $email);
|
||||
}
|
||||
|
||||
function tester_des_adresse_email($email)
|
||||
{
|
||||
$addr = explode(';', $email);
|
||||
foreach ($addr as $ad)
|
||||
{
|
||||
if (preg_match("#^[a-z0-9._-]+@[a-z0-9._-]{2,}\.[a-z]{2,4}$#i", $ad)==false)
|
||||
{
|
||||
echo "mauvaise adresse functions";
|
||||
exit();
|
||||
}
|
||||
}
|
||||
echo "bonne adresse functions";
|
||||
}
|
||||
|
||||
function convetirEnLettre($number, $lang='fr_FR')
|
||||
{
|
||||
return ucfirst(numfmt_create($lang, NumberFormatter::SPELLOUT)->format($number));
|
||||
}
|
||||
|
||||
function format_N($nombre)
|
||||
{
|
||||
if (is_numeric($nombre))
|
||||
{
|
||||
return number_format($nombre, 0, ',', ' ');
|
||||
} else
|
||||
{
|
||||
return "0";
|
||||
}
|
||||
}
|
||||
|
||||
function heureFr($d)
|
||||
{
|
||||
if ($d<="0000-00-00") return "";
|
||||
return date("d/m/Y", strtotime($d));
|
||||
}
|
||||
|
||||
function dateFr($d)
|
||||
{
|
||||
if ($d<="0000-00-00") return "";
|
||||
return date("d/m/Y", strtotime($d));
|
||||
}
|
||||
|
||||
function dateEng($d)
|
||||
{
|
||||
if ($d<="0000-00-00") return "";
|
||||
return date("m/j/Y", strtotime($d));
|
||||
}
|
||||
|
||||
function dateLang($d, $lang=null)
|
||||
{
|
||||
if (isset($lang) && $lang=="en_US")
|
||||
{
|
||||
// return dateEng($d);
|
||||
return dateFr($d);
|
||||
}
|
||||
else
|
||||
{
|
||||
return dateFr($d);
|
||||
}
|
||||
}
|
||||
|
||||
function dateheureFr($d)
|
||||
{
|
||||
if ($d<="0000-00-00") return "";
|
||||
return date("d/m/Y", strtotime($d)).' '.substr($d,-8);
|
||||
}
|
||||
|
||||
function dateheureEng($d)
|
||||
{
|
||||
if ($d<="0000-00-00") return "";
|
||||
return date("m/d/Y", strtotime($d)).' '.substr($d,-8);
|
||||
}
|
||||
|
||||
function dateheureLang($d, $lang=null)
|
||||
{
|
||||
if (isset($lang) && $lang=="en_US")
|
||||
{
|
||||
// return dateheureEng($d);
|
||||
return dateheureFr($d);
|
||||
}
|
||||
else
|
||||
{
|
||||
return dateheureFr($d);
|
||||
}
|
||||
}
|
||||
|
||||
function heureCourante()
|
||||
{
|
||||
return date("d/m/Y H:i:s");
|
||||
}
|
||||
|
||||
function heureCouranteLang($lang=null)
|
||||
{
|
||||
if (isset($lang) && $lang=="en_US")
|
||||
{
|
||||
// return heureCouranteEng();
|
||||
return heureCouranteFr();
|
||||
}
|
||||
else
|
||||
{
|
||||
return heureCouranteFr();
|
||||
}
|
||||
}
|
||||
|
||||
function heureCouranteFr()
|
||||
{
|
||||
return date("d/m/Y H:i:s");
|
||||
}
|
||||
|
||||
function heureCouranteEng()
|
||||
{
|
||||
return date("m/d/Y H:i:s");
|
||||
}
|
||||
|
||||
function dateCouranteLang($lang=null)
|
||||
{
|
||||
if (isset($lang) && $lang=="en_US")
|
||||
{
|
||||
// return dateCouranteEng();
|
||||
return dateCouranteFr();
|
||||
}
|
||||
else
|
||||
{
|
||||
return dateCouranteFr();
|
||||
}
|
||||
}
|
||||
|
||||
function dateCouranteFr()
|
||||
{
|
||||
return date('d/m/Y');
|
||||
}
|
||||
|
||||
function dateCouranteEng()
|
||||
{
|
||||
return date("m/d/Y");
|
||||
}
|
||||
|
||||
function heureCouranteSql()
|
||||
{
|
||||
return date("Y-m-d H:i:s");
|
||||
}
|
||||
|
||||
function dateJourSql()
|
||||
{
|
||||
return date("Y-m-d");
|
||||
}
|
||||
|
||||
|
||||
function existeParam($param)
|
||||
{
|
||||
return (($param!==null) && ($param != ""));
|
||||
}
|
||||
|
||||
function contruireParam($param)
|
||||
{
|
||||
return ($param == null) ? "" : trim($param);
|
||||
}
|
||||
|
||||
function contruireParamLike($param)
|
||||
{
|
||||
$p=($param == null) ? "" : trim($param);
|
||||
return "%".$p."%";
|
||||
}
|
||||
|
||||
function liste_options($liste,$val_def,$strict=false)
|
||||
{
|
||||
// <option value="orange" label="Orange" />
|
||||
|
||||
$select = $strict ? '' : '<OPTION value=""> </OPTION>';
|
||||
foreach ($liste as $option):
|
||||
$select .= ' <OPTION value="'.$option["code"].'"';
|
||||
if($val_def == $option["code"])
|
||||
{
|
||||
$select .= ' selected';
|
||||
}
|
||||
$select .= '> '.$option["libelle"].' </option> ';
|
||||
endforeach;
|
||||
echo $select;
|
||||
}
|
||||
|
||||
function liste_options_consultation($liste,$val_def,$strict=false)
|
||||
{
|
||||
// $select = $strict ? '' : '<OPTION value="">Tous</OPTION>';
|
||||
if (est_anglophone())
|
||||
{
|
||||
$select = $strict ? '' : '<OPTION value="">All</OPTION>';
|
||||
}
|
||||
else
|
||||
{
|
||||
$select = $strict ? '' : '<OPTION value="">Tous</OPTION>';
|
||||
}
|
||||
|
||||
foreach ($liste as $option):
|
||||
$select .= ' <OPTION value="'.$option["code"].'"';
|
||||
if($val_def == $option["code"])
|
||||
{
|
||||
$select .= ' selected';
|
||||
}
|
||||
$select .= '> '.$option["libelle"].' </option> ';
|
||||
endforeach;
|
||||
echo $select;
|
||||
}
|
||||
|
||||
function datePlus($date,$part, $nb)
|
||||
{
|
||||
|
||||
switch ($part) {
|
||||
case "A":
|
||||
$duree = new DateInterval('P'.$nb.'Y');
|
||||
break;
|
||||
case "M":
|
||||
$duree = new DateInterval('P'.$nb.'M');
|
||||
break;
|
||||
case "J":
|
||||
$duree = new DateInterval('P'.$nb.'D');
|
||||
break;
|
||||
default:
|
||||
$duree = new DateInterval('P1Y');
|
||||
}
|
||||
$d = DateTime::createFromFormat('j/m/Y',$date);
|
||||
$d->add($duree);
|
||||
$duree = new DateInterval('P1D');
|
||||
$d->sub($duree);
|
||||
return $d->format('d/m/Y');
|
||||
}
|
||||
|
||||
function dateMoins($date,$part, $nb)
|
||||
{
|
||||
|
||||
switch ($part) {
|
||||
case "A":
|
||||
$duree = new DateInterval('P'.$nb.'Y');
|
||||
break;
|
||||
case "M":
|
||||
$duree = new DateInterval('P'.$nb.'M');
|
||||
break;
|
||||
case "J":
|
||||
$duree = new DateInterval('P'.$nb.'D');
|
||||
break;
|
||||
default:
|
||||
$duree = new DateInterval('P1Y');
|
||||
}
|
||||
$d = DateTime::createFromFormat('j/m/Y',$date);
|
||||
$d->sub($duree);
|
||||
$duree = new DateInterval('P1D');
|
||||
$d->add($duree);
|
||||
return $d->format('d/m/Y');
|
||||
}
|
||||
|
||||
function convertirc($valeur)
|
||||
{
|
||||
$valeur = $valeur ?? '';
|
||||
|
||||
return iconv('UTF-8', 'ISO-8859-15//TRANSLIT', $valeur);
|
||||
}
|
||||
|
||||
function echapperf($valeur)
|
||||
{
|
||||
return addslashes($valeur);
|
||||
}
|
||||
|
||||
function nettoyerf($valeur)
|
||||
{
|
||||
return htmlspecialchars($valeur, ENT_QUOTES, 'UTF-8', true);
|
||||
}
|
||||
|
||||
function dechapperf($valeur)
|
||||
{
|
||||
return stripslashes($valeur);
|
||||
}
|
||||
|
||||
function liste_utilisateurs_profil($listeutilisateur)
|
||||
{
|
||||
$tableau = '<table id="listeutilisateur" class="table table-responsive table-condensed table-hover"> ';
|
||||
$tableau .=' <thead> ';
|
||||
$tableau .=' <tr> ';
|
||||
$tableau .=' <th>Login</th> ';
|
||||
$tableau .=' <th>Nom</th> ';
|
||||
$tableau .=' <th align="center">choix</th> ';
|
||||
$tableau .=' </tr> ';
|
||||
$tableau .=' </thead> ';
|
||||
$tableau .=' <tbody> ';
|
||||
|
||||
foreach ($listeutilisateur as $utilisateur):
|
||||
$tableau .= '<tr>';
|
||||
$tableau .= ' <td width="20%" >'.$utilisateur['codeUtilisateur'].'</td>';
|
||||
$tableau .= ' <td>'.$utilisateur['nom'].'</td>';
|
||||
$tableau .= ' <td><input type="checkbox" ';
|
||||
if($utilisateur['choix']=='1')
|
||||
{
|
||||
$tableau .= ' checked ';
|
||||
}
|
||||
$tableau .= ' value="'.$utilisateur['choix'].'" onClick="javascript:if(this.value==1){this.value=0}else{this.value=1};attribuer_profil_utilisateur(this.value,'.$utilisateur['id'].');"></td>';
|
||||
$tableau .= '</tr>';
|
||||
endforeach;
|
||||
|
||||
$tableau .=' </tbody> ';
|
||||
$tableau .=' </table> ';
|
||||
|
||||
echo $tableau;
|
||||
}
|
||||
|
||||
function liste_utilisateurs_prestataire($listeutilisateur)
|
||||
{
|
||||
$tableau = '<table id="listeutilisateur" class="table table-responsive table-condensed table-hover"> ';
|
||||
$tableau .=' <thead> ';
|
||||
$tableau .=' <tr> ';
|
||||
$tableau .=' <th>Login</th> ';
|
||||
$tableau .=' <th>Nom</th> ';
|
||||
$tableau .=' <th align="center">choix</th> ';
|
||||
$tableau .=' </tr> ';
|
||||
$tableau .=' </thead> ';
|
||||
$tableau .=' <tbody> ';
|
||||
|
||||
foreach ($listeutilisateur as $utilisateur):
|
||||
$tableau .= '<tr>';
|
||||
$tableau .= ' <td width="20%" >'.$utilisateur['codeUtilisateur'].'</td>';
|
||||
$tableau .= ' <td>'.$utilisateur['nom'].'</td>';
|
||||
$tableau .= ' <td><input type="checkbox" ';
|
||||
if($utilisateur['choix']=='1')
|
||||
{
|
||||
$tableau .= ' checked ';
|
||||
}
|
||||
$tableau .= ' value="'.$utilisateur['choix'].'" onClick="javascript:if(this.value==1){this.value=0}else{this.value=1};attribuer_prestataire_utilisateur(this.value,'.$utilisateur['id'].');"></td>';
|
||||
$tableau .= '</tr>';
|
||||
endforeach;
|
||||
|
||||
$tableau .=' </tbody> ';
|
||||
$tableau .=' </table> ';
|
||||
|
||||
echo $tableau;
|
||||
}
|
||||
|
||||
function liste_menus_profil($listemenu)
|
||||
{
|
||||
$tableau = '<table id="listemenu" class="table table-responsive table-condensed table-hover"> ';
|
||||
$tableau .=' <thead> ';
|
||||
$tableau .=' <tr> ';
|
||||
$tableau .=' <th width="80%">Menu</th> ';
|
||||
$tableau .=' <th style="text-align: center;">choix</th> ';
|
||||
$tableau .=' </tr> ';
|
||||
$tableau .=' </thead> ';
|
||||
$tableau .=' <tbody> ';
|
||||
|
||||
foreach ($listemenu as $menu):
|
||||
$tableau .= '<tr>';
|
||||
$tableau .= ' <td width="10%">'.$menu['libeleMenu'].'</td> ';
|
||||
$tableau .= ' <td style="text-align: center;"><input type="checkbox" ';
|
||||
if($menu['choix']=='1')
|
||||
{
|
||||
$tableau .= ' checked ';
|
||||
}
|
||||
$tableau .= ' value="'.$menu['choix'].'"';
|
||||
$tableau .= ' onClick="javascript:if(this.value==1){this.value=0}else{this.value=1};';
|
||||
$tableau .= " ajouter_menu_profil(this.value,'".$menu['codeMenu']."',".$menu['id_menuprofil'].");";
|
||||
$tableau .= ' "> </td> ';
|
||||
$tableau .= ' </tr> ';
|
||||
endforeach;
|
||||
|
||||
$tableau .=' </tbody> ';
|
||||
$tableau .=' </table> ';
|
||||
|
||||
echo $tableau;
|
||||
}
|
||||
|
||||
|
||||
function liste_vues_profil($listemenu)
|
||||
{
|
||||
$tableau = '<table id="listemenu" class="table table-responsive table-condensed table-hover"> ';
|
||||
$tableau .=' <thead> ';
|
||||
$tableau .=' <tr> ';
|
||||
$tableau .=' <th width="80%">Menu</th> ';
|
||||
$tableau .=' <th style="text-align: center;">choix</th> ';
|
||||
$tableau .=' </tr> ';
|
||||
$tableau .=' </thead> ';
|
||||
$tableau .=' <tbody> ';
|
||||
|
||||
foreach ($listemenu as $menu):
|
||||
$tableau .= '<tr>';
|
||||
$tableau .= ' <td width="10%">'.$menu['libeleMenu'].'</td> ';
|
||||
$tableau .= ' <td style="text-align: center;"><input type="checkbox" ';
|
||||
if($menu['choix']=='1')
|
||||
{
|
||||
$tableau .= ' checked ';
|
||||
}
|
||||
$tableau .= ' value="'.$menu['choix'].'"';
|
||||
$tableau .= ' onClick="javascript:if(this.value==1){this.value=0}else{this.value=1};';
|
||||
$tableau .= " ajouter_vue_profil(this.value,'".$menu['codeMenu']."',".$menu['id_menuvueprofil'].");";
|
||||
$tableau .= ' "> </td> ';
|
||||
$tableau .= ' </tr> ';
|
||||
endforeach;
|
||||
|
||||
$tableau .=' </tbody> ';
|
||||
$tableau .=' </table> ';
|
||||
|
||||
echo $tableau;
|
||||
}
|
||||
|
||||
function envoyer_mail_pj($mailto, $subject, $msg, $filename, $old_file_name)
|
||||
{
|
||||
// clé aléatoire de limite
|
||||
$boundary = md5(uniqid(microtime(), TRUE));
|
||||
|
||||
// Headers
|
||||
$headers = 'From: SYSTEME DE GESTION MALADIE AFRIK ASSUR <info@afrikassur.com>'."\r\n";
|
||||
$headers .= 'Mime-Version: 1.0'."\r\n";
|
||||
$headers .= 'Content-Type: multipart/mixed;boundary='.$boundary."\r\n";
|
||||
$headers .= "\r\n";
|
||||
|
||||
// Message
|
||||
$message = "\r\n\r\n";
|
||||
|
||||
// Texte
|
||||
$message .= '--'.$boundary."\r\n";
|
||||
//$message .= 'Content-type:text/plain;charset=utf-8'."\r\n";
|
||||
$message .= 'Content-type:text/plain;'."\r\n";
|
||||
$message .= 'Content-transfer-encoding:8bit'."\r\n";
|
||||
// $message .= 'Un message avec une pièce jointe.'."\r\n";
|
||||
$message .= convertirc($msg)."\r\n";
|
||||
|
||||
// Pièce jointe
|
||||
if (file_exists($filename))
|
||||
{
|
||||
$file_type = filetype($filename);
|
||||
$file_size = filesize($filename);
|
||||
|
||||
$handle = fopen($filename, 'r') or die('Impossible à ouvrir '.$filename.'!');
|
||||
$content = fread($handle, $file_size);
|
||||
$content = chunk_split(base64_encode($content));
|
||||
$f = fclose($handle);
|
||||
|
||||
$message .= '--'.$boundary."\r\n";
|
||||
// $message .= 'Content-type:'.$file_type.';name='.$filename."\r\n";
|
||||
$message .= 'Content-type:'.$file_type.';name='.$old_file_name."\r\n";
|
||||
|
||||
$message .= 'Content-transfer-encoding:base64'."\r\n";
|
||||
$message .= $content."\r\n";
|
||||
}
|
||||
|
||||
// Fin
|
||||
$message .= '--'.$boundary."\r\n";
|
||||
|
||||
// Function mail()
|
||||
mail($mailto, $subject, $message, $headers);
|
||||
// fin envoi mail
|
||||
}
|
||||
|
||||
function uploader_image($message)
|
||||
{
|
||||
echo "uploader_image";
|
||||
$message = "uploader_image";
|
||||
exit();
|
||||
|
||||
// Constantes
|
||||
define('TARGET', 'Photos/'); // Repertoire cible
|
||||
define('MAX_SIZE', 100000); // Taille max en octets du fichier
|
||||
define('WIDTH_MAX', 800); // Largeur max de l'image en pixels
|
||||
define('HEIGHT_MAX', 800); // Hauteur max de l'image en pixels
|
||||
|
||||
// Tableaux de donnees
|
||||
//$tabExt = array('jpg','gif','png','jpeg'); // Extensions autorisees
|
||||
$tabExt = array('jpg','png','jpeg'); // Extensions autorisees
|
||||
$infosImg = array();
|
||||
|
||||
// Variables
|
||||
$extension = '';
|
||||
$message = '';
|
||||
$nomImage = '';
|
||||
|
||||
if( !is_dir(TARGET) ) {
|
||||
if( !mkdir(TARGET, 0755) ) {
|
||||
exit('Erreur : le répertoire cible ne peut-être créé ! Vérifiez que vous diposiez des droits suffisants pour le faire ou créez le manuellement !');
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($_POST))
|
||||
{
|
||||
// On verifie si le champ est rempli
|
||||
if( !empty($_FILES['fichier_image_a_uploader']['name']) )
|
||||
{
|
||||
// Recuperation de l'extension du fichier
|
||||
$extension = pathinfo($_FILES['fichier_image_a_uploader']['name'], PATHINFO_EXTENSION);
|
||||
|
||||
// On verifie l'extension du fichier
|
||||
if(in_array(strtolower($extension),$tabExt))
|
||||
{
|
||||
// On recupere les dimensions du fichier
|
||||
$infosImg = getimagesize($_FILES['fichier_image_a_uploader']['tmp_name']);
|
||||
|
||||
// On verifie le type de l'image
|
||||
if($infosImg[2] >= 1 && $infosImg[2] <= 14)
|
||||
{
|
||||
// On verifie les dimensions et taille de l'image
|
||||
if(($infosImg[0] <= WIDTH_MAX) && ($infosImg[1] <= HEIGHT_MAX) && (filesize($_FILES['fichier_image_a_uploader']['tmp_name']) <= MAX_SIZE))
|
||||
{
|
||||
// Parcours du tableau d'erreurs
|
||||
if(isset($_FILES['fichier_image_a_uploader']['error'])
|
||||
&& UPLOAD_ERR_OK === $_FILES['fichier_image_a_uploader']['error'])
|
||||
{
|
||||
// On renomme le fichier
|
||||
$nomImage = md5(uniqid()) .'.'. $extension;
|
||||
|
||||
// Si c'est OK, on teste l'upload
|
||||
if(move_uploaded_file($_FILES['fichier_image_a_uploader']['tmp_name'], TARGET.$nomImage))
|
||||
{
|
||||
$message = 'Upload réussi !';
|
||||
}
|
||||
else
|
||||
{
|
||||
// Sinon on affiche une erreur systeme
|
||||
$message = 'Problème lors de l\'upload !';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$message = 'Une erreur interne a empêché l\'uplaod de l\'image';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Sinon erreur sur les dimensions et taille de l'image
|
||||
$message = 'Erreur dans les dimensions de l\'image !';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Sinon erreur sur le type de l'image
|
||||
$message = 'Le fichier à uploader n\'est pas une image !';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Sinon on affiche une erreur pour l'extension
|
||||
$message = 'L\'extension du fichier est incorrecte !';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Sinon on affiche une erreur pour le champ vide
|
||||
$message = 'Veuillez remplir le formulaire svp !';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function viderContexte() {
|
||||
$_SESSION['idAdherent_C'] = "";
|
||||
$_SESSION['numeroAdherent_C'] = "";
|
||||
$_SESSION['nomAdherent_C'] = "";
|
||||
$_SESSION['email_C'] = "";
|
||||
$_SESSION['telephonePortable_C'] = "";
|
||||
|
||||
$_SESSION['idBeneficiaire'] = "";
|
||||
$_SESSION['numeroBeneficiaire_C'] = "";
|
||||
$_SESSION['nomBeneficiaire_C'] = "";
|
||||
$_SESSION['lienPhoto_C'] = "";
|
||||
$_SESSION['garantieArchive_C'] = "0";
|
||||
|
||||
/* viderContexte prestations */
|
||||
|
||||
$_SESSION['dateEffetPolice_C'] = "";
|
||||
$_SESSION['dateFinPolice_C'] = "";
|
||||
$_SESSION['dateEcheancePolice_C'] = "";
|
||||
$_SESSION['codeEtatPolice_C'] = "";
|
||||
$_SESSION['idCollege_C'] = "";
|
||||
$_SESSION['codeProduit_C'] = "";
|
||||
$_SESSION['idAdherent_C'] = "";
|
||||
$_SESSION['numeroAdherent_C'] = "";
|
||||
$_SESSION['nomAdherent_C'] = "";
|
||||
$_SESSION['prenomsAdherent_C'] = "";
|
||||
$_SESSION['telephonePortableAdherent_C'] = "";
|
||||
$_SESSION['codeLangueAdherent'] = "fr_FR";
|
||||
$_SESSION['emailAdherent_C'] = "";
|
||||
$_SESSION['produit_C'] = "";
|
||||
$_SESSION['libelleCollege_C'] = "";
|
||||
$_SESSION['adresseGeoAdherent_C'] = "";
|
||||
$_SESSION['paysAdherent_C'] = "";
|
||||
$_SESSION['adressePostaleAdherent_C'] = "";
|
||||
$_SESSION['telephonFixeAdherent_C'] = "";
|
||||
$_SESSION['nomBeneficiaire_C'] = "";
|
||||
$_SESSION['prenomsBeneficiaire_C'] = "";
|
||||
$_SESSION['codeLienParente_C'] = "";
|
||||
$_SESSION['numeroPiece_C'] = "";
|
||||
$_SESSION['sexe_C'] = "";
|
||||
$_SESSION['codeGroupeSanguin_C'] = "";
|
||||
$_SESSION['dateNaissance_C'] = "";
|
||||
$_SESSION['telephonePortableBeneficiaire_C'] = "";
|
||||
$_SESSION['dateEntreeBeneficiaire_C'] = "";
|
||||
$_SESSION['dateSortieBeneficiaire_C'] = "";
|
||||
$_SESSION['codeMotifSortie_C'] = "";
|
||||
$_SESSION['codeEtatBeneficiaire_C'] = "";
|
||||
$_SESSION['lienPhoto_C'] = "";
|
||||
$_SESSION['dateEffetBeneficiaire_C'] = "";
|
||||
$_SESSION['dateEffetCouvert'] = "0";
|
||||
$_SESSION['enVigueur_C'] = "";
|
||||
$_SESSION['naturepiece_C'] = "";
|
||||
$_SESSION['lienparente_C'] = "";
|
||||
$_SESSION['motifsortie_C'] = "";
|
||||
$_SESSION['etatbeneficiaire_C'] = "";
|
||||
$_SESSION['ageBeneficiaire_C'] = "";
|
||||
$_SESSION['idBeneficiaire_C'] = "";
|
||||
|
||||
$_SESSION['user_id_C'] = "0";
|
||||
$_SESSION['finger_id_C'] = "0";
|
||||
|
||||
$_SESSION['idSubstitut_C'] = "0";
|
||||
$_SESSION['substitutnonassure_C'] = "";
|
||||
$_SESSION['substitutenVigueur_C'] = "0";
|
||||
|
||||
$_SESSION['numeroBeneficiaire_C'] = "";
|
||||
$_SESSION['college_couvert_C'] = "0";
|
||||
$_SESSION['derogation_en_cours_C'] = "0";
|
||||
$_SESSION['derogation_finger_en_cours_C'] = "0";
|
||||
|
||||
$_SESSION['tm_C'] = "0";
|
||||
$_SESSION['numeroFeuilleMaladie_C'] = "0";
|
||||
$_SESSION['numeroPrescription_C'] = "0";
|
||||
|
||||
$_SESSION['numeroExamen_C'] = "0";
|
||||
$_SESSION['numeroPrescriptionKine_C'] = "0";
|
||||
$_SESSION['idFacture_C'] = "0";
|
||||
|
||||
$_SESSION['beneficiaire_C'] = "";
|
||||
$_SESSION['adherent_C'] = "";
|
||||
$_SESSION['enVigueur_C'] = "";
|
||||
|
||||
$_SESSION['decede_C'] = "0";
|
||||
$_SESSION['dateDeces_C'] = "";
|
||||
$_SESSION['fraisFuneraireDemande_C'] = "0";
|
||||
$_SESSION['fraisFunerairePaye_C'] = "0";
|
||||
}
|
||||
|
||||
function nomsansaccent($chaine) {
|
||||
$trans = array("Â" => "A", "Ã" => "A", "Ä" => "A", "Å" => "A", "Ç" => "C",
|
||||
"È" => "E", "É" => "E", "Ê" => "E", "Ë" => "E", "Ì" => "I", "Í" => "I",
|
||||
"Î" => "I", "Ï" => "I", "Ò" => "O", "Ó" => "O", "Ô" => "O", "Õ" => "O",
|
||||
"Ö" => "O", "Ù" => "U", "Ú" => "U", "Û" => "U", "Ü" => "U", "Ý" => "Y",
|
||||
"à" => "a", "á" => "a", "â" => "a", "ã" => "a", "ä" => "a", "å" => "a",
|
||||
"ç" => "c", "è" => "e", "é" => "e", "ê" => "e", "ë" => "e", "ì" => "i",
|
||||
"í" => "i", "î" => "i", "ï" => "i", "ð" => "o", "ò" => "o", "ó" => "o",
|
||||
"ô" => "o", "õ" => "o", "ö" => "o", "ù" => "u", "ú" => "u", "û" => "u",
|
||||
"ü" => "u", "ý" => "y", "ÿ" => "y", " " => "_");
|
||||
|
||||
$noaccent = strtr($chaine, $trans);
|
||||
$noaccent = strtolower($noaccent);
|
||||
|
||||
return $noaccent;
|
||||
}
|
||||
|
||||
function securite_bdd($string)
|
||||
{
|
||||
// On regarde si le type de string est un nombre entier (int)
|
||||
if(ctype_digit($string))
|
||||
{
|
||||
$string = intval($string);
|
||||
}
|
||||
// Pour tous les autres types
|
||||
else
|
||||
{
|
||||
$string = mysql_real_escape_string($string);
|
||||
$string = addcslashes($string, '%_');
|
||||
}
|
||||
return $string;
|
||||
}
|
||||
|
||||
function dateDifference($date_1 , $date_2)
|
||||
{
|
||||
$d1 = DateTime::createFromFormat('d/m/Y',$date_1);
|
||||
$d2 = DateTime::createFromFormat('d/m/Y',$date_2);
|
||||
$interval = $d1->diff($d2);
|
||||
return $interval->format('%y');
|
||||
}
|
||||
|
||||
function age($date_1 , $date_2)
|
||||
{
|
||||
//$d1 = DateTime::createFromFormat('d/m/Y',$date_1);
|
||||
//$d2 = DateTime::createFromFormat('d/m/Y',$date_2);
|
||||
|
||||
$d1 = new DateTime($date_1);
|
||||
$d2 = new DateTime($date_2);
|
||||
|
||||
$interval = $d1->diff($d2);
|
||||
return $interval->format('%y');
|
||||
}
|
||||
|
||||
function checkbox( $pdf, $checked = TRUE, $checkbox_size = 5 , $ori_font_family = 'Arial', $ori_font_size = '10', $ori_font_style = '' )
|
||||
{
|
||||
if($checked == TRUE)
|
||||
$check = "4";
|
||||
else
|
||||
$check = "";
|
||||
|
||||
$pdf->SetFont('ZapfDingbats','', $ori_font_size);
|
||||
$pdf->Cell($checkbox_size, $checkbox_size, $check, 1, 0);
|
||||
$pdf->SetFont( $ori_font_family, $ori_font_style, $ori_font_size);
|
||||
}
|
||||
|
||||
// public static function asLetters($number) {
|
||||
function asLetters($number)
|
||||
{
|
||||
$convert = explode('.', $number);
|
||||
$num[17] = array('zéro', 'un', 'deux', 'trois', 'quatre', 'cinq', 'six', 'sept', 'huit',
|
||||
'neuf', 'dix', 'onze', 'douze', 'treize', 'quatorze', 'quinze', 'seize');
|
||||
|
||||
$num[100] = array(20 => 'vingt', 30 => 'trente', 40 => 'quarante', 50 => 'cinquante',
|
||||
60 => 'soixante', 70 => 'soixante-dix', 80 => 'quatre-vingt', 90 => 'quatre-vingt-dix');
|
||||
|
||||
if (isset($convert[1]) && $convert[1] != '') {
|
||||
return asLetters($convert[0]).' et '.asLetters($convert[1]);
|
||||
}
|
||||
if ($number < 0) return 'moins '.asLetters(-$number);
|
||||
if ($number < 17) {
|
||||
return $num[17][$number];
|
||||
}
|
||||
elseif ($number < 20) {
|
||||
return 'dix-'.asLetters($number-10);
|
||||
}
|
||||
elseif ($number < 100) {
|
||||
if ($number%10 == 0) {
|
||||
return $num[100][$number];
|
||||
}
|
||||
elseif (substr($number, -1) == 1) {
|
||||
if( ((int)($number/10)*10)<70 ){
|
||||
return asLetters((int)($number/10)*10).'-et-un';
|
||||
}
|
||||
elseif ($number == 71) {
|
||||
return 'soixante-et-onze';
|
||||
}
|
||||
elseif ($number == 81) {
|
||||
return 'quatre-vingt-un';
|
||||
}
|
||||
elseif ($number == 91) {
|
||||
return 'quatre-vingt-onze';
|
||||
}
|
||||
}
|
||||
elseif ($number < 70) {
|
||||
return asLetters($number-$number%10).'-'.asLetters($number%10);
|
||||
}
|
||||
elseif ($number < 80) {
|
||||
return asLetters(60).'-'.asLetters($number%20);
|
||||
}
|
||||
else {
|
||||
return asLetters(80).'-'.asLetters($number%20);
|
||||
}
|
||||
}
|
||||
elseif ($number == 100) {
|
||||
return 'cent';
|
||||
}
|
||||
elseif ($number < 200) {
|
||||
return asLetters(100).' '.asLetters($number%100);
|
||||
}
|
||||
elseif ($number < 1000) {
|
||||
return asLetters((int)($number/100)).' '.asLetters(100).($number%100 > 0 ? ' '.asLetters($number%100): '');
|
||||
}
|
||||
elseif ($number == 1000){
|
||||
return 'mille';
|
||||
}
|
||||
elseif ($number < 2000) {
|
||||
return asLetters(1000).' '.asLetters($number%1000).' ';
|
||||
}
|
||||
elseif ($number < 1000000) {
|
||||
return asLetters((int)($number/1000)).' '.asLetters(1000).($number%1000 > 0 ? ' '.asLetters($number%1000): '');
|
||||
}
|
||||
elseif ($number == 1000000) {
|
||||
// return 'millions';
|
||||
return 'un million';
|
||||
}
|
||||
elseif ($number < 2000000) {
|
||||
return asLetters(1000000).' '.asLetters($number%1000000);
|
||||
}
|
||||
elseif ($number < 1000000000) {
|
||||
// return asLetters((int)($number/1000000)).' '.asLetters(1000000).($number%1000000 > 0 ? ' '.asLetters($number%1000000): '');
|
||||
return asLetters((int)($number/1000000)).' millions '.($number%1000000 > 0 ? ' '.asLetters($number%1000000): '');
|
||||
}
|
||||
}
|
||||
/*
|
||||
function liste_options_center($liste,$val_def,$strict=false)
|
||||
{
|
||||
$select = $strict ? '' : '<OPTION align="center" value=""> </OPTION>';
|
||||
foreach ($liste as $option):
|
||||
$select .= ' <OPTION value="'.$option["code"].'"';
|
||||
if($val_def == $option["code"])
|
||||
{
|
||||
$select .= ' selected';
|
||||
}
|
||||
$select .= '> '.$option["libelle"].' </option> ';
|
||||
endforeach;
|
||||
echo $select;
|
||||
}
|
||||
*/
|
||||
|
||||
function div_oui_non($ouiNon, $lang=null)
|
||||
{
|
||||
if($ouiNon == "1")
|
||||
{
|
||||
if (isset($lang) && $lang=="en_US")
|
||||
{
|
||||
$div = 'Yes';
|
||||
}
|
||||
else
|
||||
{
|
||||
$div = 'Oui';
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isset($lang) && $lang=="en_US")
|
||||
{
|
||||
$div = 'No';
|
||||
}
|
||||
else
|
||||
{
|
||||
$div = 'Non';
|
||||
}
|
||||
|
||||
}
|
||||
echo $div;
|
||||
}
|
||||
|
||||
function est_anglophone()
|
||||
{
|
||||
return (isset($_SESSION['lang']) && $_SESSION['lang']=="en_US");
|
||||
}
|
||||
25
Cron/Genererfacturesaascron.php
Executable file
25
Cron/Genererfacturesaascron.php
Executable file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
require_once 'Modele.php';
|
||||
|
||||
class Genererfacturesaascron extends Modele {
|
||||
|
||||
public function counter_assure_saas_mois($codeSociete)
|
||||
{
|
||||
$datefacture = date('Y-m-d');
|
||||
|
||||
$sql = 'select fn_counter_assure_saas_mois(?, ?) as nbAssures;';
|
||||
|
||||
$resultat = $this->executerRequete($sql, array($codeSociete, $datefacture))->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
return $resultat['nbAssures'];
|
||||
}
|
||||
|
||||
public function envoyer_notification_facture_saas_mois($codeSociete, $smsNotificationSaas, $mailNotificationSaas)
|
||||
{
|
||||
// $datefacture = date('Y-m-d');
|
||||
|
||||
$sql = 'call sp_envoyer_notification_facture_saas_mois(?, ?, ?)';
|
||||
|
||||
$this->executerRequete($sql, array($codeSociete, $smsNotificationSaas, $mailNotificationSaas));
|
||||
}
|
||||
}
|
||||
BIN
Cron/Img/logo_societe.png
Normal file
BIN
Cron/Img/logo_societe.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 70 KiB |
9
Cron/Lang.php
Executable file
9
Cron/Lang.php
Executable file
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
// $supported_locales = array('fr_FR', 'en_US');
|
||||
|
||||
$_SESSION['lang'] = 'fr_FR';
|
||||
|
||||
// $_SESSION['lang'] = 'en_US';
|
||||
|
||||
?>
|
||||
37
Cron/Localisation.php
Executable file
37
Cron/Localisation.php
Executable file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
error_reporting(E_ALL | E_STRICT);
|
||||
|
||||
define('PROJECT_DIR', realpath('../Gettext/'));
|
||||
define('LOCALE_DIR', PROJECT_DIR .'/locale');
|
||||
define('DEFAULT_LOCALE', 'fr_FR');
|
||||
|
||||
require_once('../Gettext/gettext.inc');
|
||||
|
||||
$supported_locales = array('fr_FR', 'en_US');
|
||||
$encoding = 'UTF-8';
|
||||
|
||||
if (isset($_SESSION['lang']))
|
||||
{
|
||||
$locale = $_SESSION['lang'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$locale = DEFAULT_LOCALE;
|
||||
}
|
||||
|
||||
// gettext setup
|
||||
T_setlocale(LC_MESSAGES, $locale);
|
||||
|
||||
$domain = 'messages';
|
||||
|
||||
bindtextdomain($domain, LOCALE_DIR);
|
||||
|
||||
if (function_exists('bind_textdomain_codeset'))
|
||||
bind_textdomain_codeset($domain, $encoding);
|
||||
|
||||
textdomain($domain);
|
||||
|
||||
//header("Content-type: text/html; charset=$encoding");
|
||||
|
||||
?>
|
||||
63
Cron/Modele.php
Executable file
63
Cron/Modele.php
Executable file
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
require_once 'Configuration.php';
|
||||
|
||||
abstract class Modele
|
||||
{
|
||||
private static $bdd;
|
||||
|
||||
protected function executerRequete($sql, $params = null)
|
||||
{
|
||||
if ($params == null) {
|
||||
$resultat = self::getBdd()->query($sql); // exécution directe
|
||||
}
|
||||
else {
|
||||
$resultat = self::getBdd()->prepare($sql); // requête préparée
|
||||
$resultat->execute($params);
|
||||
}
|
||||
return $resultat;
|
||||
}
|
||||
private static function getBdd()
|
||||
{
|
||||
if (!isset($_SESSION['c_codeSociete']))
|
||||
{
|
||||
$_SESSION['c_codeSociete']="ebene";
|
||||
$_SESSION['old_codeSociete']="";
|
||||
}
|
||||
$codeSociete = $_SESSION['c_codeSociete'];
|
||||
|
||||
// if (self::$bdd === null) {
|
||||
if ($_SESSION['c_codeSociete'] != $_SESSION['old_codeSociete']) {
|
||||
$_SESSION['old_codeSociete']= $_SESSION['c_codeSociete'];
|
||||
$dsn = Configuration::get("dsn".$codeSociete);
|
||||
$login = Configuration::get("login".$codeSociete);
|
||||
$mdp = Configuration::get("mdp".$codeSociete);
|
||||
|
||||
$_SESSION['param_bdd'] = array
|
||||
(
|
||||
"codeSociete" => $codeSociete,
|
||||
"dsn" => $dsn,
|
||||
"login" => $login,
|
||||
"mdp" => $mdp
|
||||
);
|
||||
|
||||
self::$bdd = new PDO
|
||||
(
|
||||
$dsn,
|
||||
$login,
|
||||
$mdp,
|
||||
array
|
||||
(
|
||||
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
|
||||
PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true
|
||||
)
|
||||
);
|
||||
// $pdo->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, false);
|
||||
}
|
||||
return self::$bdd;
|
||||
}
|
||||
|
||||
protected function dernierId()
|
||||
{
|
||||
return self::getBdd()->lastInsertId();
|
||||
}
|
||||
}
|
||||
38
Cron/Modele_old.php
Executable file
38
Cron/Modele_old.php
Executable file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
require_once 'Configuration.php';
|
||||
|
||||
abstract class Modele
|
||||
{
|
||||
private static $bdd;
|
||||
|
||||
protected function executerRequete($sql, $params = null)
|
||||
{
|
||||
if ($params == null) {
|
||||
$resultat = self::getBdd()->query($sql); // exécution directe
|
||||
}
|
||||
else {
|
||||
$resultat = self::getBdd()->prepare($sql); // requête préparée
|
||||
$resultat->execute($params);
|
||||
}
|
||||
return $resultat;
|
||||
}
|
||||
private static function getBdd()
|
||||
{
|
||||
if (self::$bdd === null) {
|
||||
$dsn = Configuration::get("dsn");
|
||||
$login = Configuration::get("login");
|
||||
$mdp = Configuration::get("mdp");
|
||||
self::$bdd = new PDO($dsn, $login, $mdp,
|
||||
array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION));
|
||||
|
||||
self::$bdd->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, true);
|
||||
|
||||
}
|
||||
return self::$bdd;
|
||||
}
|
||||
|
||||
protected function dernierId()
|
||||
{
|
||||
return self::getBdd()->lastInsertId();
|
||||
}
|
||||
}
|
||||
46
Cron/Modelecentral.php
Executable file
46
Cron/Modelecentral.php
Executable file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
require_once 'Configuration.php';
|
||||
|
||||
abstract class Modelecentral
|
||||
{
|
||||
private static $bdd;
|
||||
|
||||
protected function executerRequete($sql, $params = null)
|
||||
{
|
||||
if ($params == null) {
|
||||
$resultat = self::getBdd()->query($sql); // exécution directe
|
||||
}
|
||||
else {
|
||||
$resultat = self::getBdd()->prepare($sql); // requête préparée
|
||||
$resultat->execute($params);
|
||||
}
|
||||
return $resultat;
|
||||
}
|
||||
private static function getBdd()
|
||||
{
|
||||
if (self::$bdd === null) {
|
||||
$dsn = Configuration::get("dsncentral");
|
||||
$login = Configuration::get("logincentral");
|
||||
$mdp = Configuration::get("mdpcentral");
|
||||
self::$bdd = new PDO
|
||||
(
|
||||
$dsn,
|
||||
$login,
|
||||
$mdp,
|
||||
array
|
||||
(
|
||||
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
|
||||
PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true
|
||||
)
|
||||
);
|
||||
|
||||
// $pdo->setAttribute(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY, false);
|
||||
}
|
||||
return self::$bdd;
|
||||
}
|
||||
|
||||
protected function dernierId()
|
||||
{
|
||||
return self::getBdd()->lastInsertId();
|
||||
}
|
||||
}
|
||||
1153
Cron/PHPExcel/PHPExcel.php
Executable file
1153
Cron/PHPExcel/PHPExcel.php
Executable file
File diff suppressed because it is too large
Load Diff
81
Cron/PHPExcel/PHPExcel/Autoloader.php
Executable file
81
Cron/PHPExcel/PHPExcel/Autoloader.php
Executable file
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
PHPExcel_Autoloader::register();
|
||||
// As we always try to run the autoloader before anything else, we can use it to do a few
|
||||
// simple checks and initialisations
|
||||
//PHPExcel_Shared_ZipStreamWrapper::register();
|
||||
// check mbstring.func_overload
|
||||
if (ini_get('mbstring.func_overload') & 2) {
|
||||
throw new PHPExcel_Exception('Multibyte function overloading in PHP must be disabled for string functions (2).');
|
||||
}
|
||||
PHPExcel_Shared_String::buildCharacterSets();
|
||||
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2015 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel
|
||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version ##VERSION##, ##DATE##
|
||||
*/
|
||||
class PHPExcel_Autoloader
|
||||
{
|
||||
/**
|
||||
* Register the Autoloader with SPL
|
||||
*
|
||||
*/
|
||||
public static function register()
|
||||
{
|
||||
if (function_exists('__autoload')) {
|
||||
// Register any existing autoloader function with SPL, so we don't get any clashes
|
||||
spl_autoload_register('__autoload');
|
||||
}
|
||||
// Register ourselves with SPL
|
||||
if (version_compare(PHP_VERSION, '5.3.0') >= 0) {
|
||||
return spl_autoload_register(array('PHPExcel_Autoloader', 'load'), true, true);
|
||||
} else {
|
||||
return spl_autoload_register(array('PHPExcel_Autoloader', 'load'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Autoload a class identified by name
|
||||
*
|
||||
* @param string $pClassName Name of the object to load
|
||||
*/
|
||||
public static function load($pClassName)
|
||||
{
|
||||
if ((class_exists($pClassName, false)) || (strpos($pClassName, 'PHPExcel') !== 0)) {
|
||||
// Either already loaded, or not a PHPExcel class request
|
||||
return false;
|
||||
}
|
||||
|
||||
$pClassFilePath = PHPEXCEL_ROOT .
|
||||
str_replace('_', DIRECTORY_SEPARATOR, $pClassName) .
|
||||
'.php';
|
||||
|
||||
if ((file_exists($pClassFilePath) === false) || (is_readable($pClassFilePath) === false)) {
|
||||
// Can't load
|
||||
return false;
|
||||
}
|
||||
|
||||
require($pClassFilePath);
|
||||
}
|
||||
}
|
||||
290
Cron/PHPExcel/PHPExcel/CachedObjectStorage/APC.php
Executable file
290
Cron/PHPExcel/PHPExcel/CachedObjectStorage/APC.php
Executable file
@@ -0,0 +1,290 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PHPExcel_CachedObjectStorage_APC
|
||||
*
|
||||
* Copyright (c) 2006 - 2015 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_CachedObjectStorage
|
||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version ##VERSION##, ##DATE##
|
||||
*/
|
||||
class PHPExcel_CachedObjectStorage_APC extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache
|
||||
{
|
||||
/**
|
||||
* Prefix used to uniquely identify cache data for this worksheet
|
||||
*
|
||||
* @access private
|
||||
* @var string
|
||||
*/
|
||||
private $cachePrefix = null;
|
||||
|
||||
/**
|
||||
* Cache timeout
|
||||
*
|
||||
* @access private
|
||||
* @var integer
|
||||
*/
|
||||
private $cacheTime = 600;
|
||||
|
||||
/**
|
||||
* Store cell data in cache for the current cell object if it's "dirty",
|
||||
* and the 'nullify' the current cell object
|
||||
*
|
||||
* @access private
|
||||
* @return void
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
protected function storeData()
|
||||
{
|
||||
if ($this->currentCellIsDirty && !empty($this->currentObjectID)) {
|
||||
$this->currentObject->detach();
|
||||
|
||||
if (!apc_store(
|
||||
$this->cachePrefix . $this->currentObjectID . '.cache',
|
||||
serialize($this->currentObject),
|
||||
$this->cacheTime
|
||||
)) {
|
||||
$this->__destruct();
|
||||
throw new PHPExcel_Exception('Failed to store cell ' . $this->currentObjectID . ' in APC');
|
||||
}
|
||||
$this->currentCellIsDirty = false;
|
||||
}
|
||||
$this->currentObjectID = $this->currentObject = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add or Update a cell in cache identified by coordinate address
|
||||
*
|
||||
* @access public
|
||||
* @param string $pCoord Coordinate address of the cell to update
|
||||
* @param PHPExcel_Cell $cell Cell to update
|
||||
* @return PHPExcel_Cell
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function addCacheData($pCoord, PHPExcel_Cell $cell)
|
||||
{
|
||||
if (($pCoord !== $this->currentObjectID) && ($this->currentObjectID !== null)) {
|
||||
$this->storeData();
|
||||
}
|
||||
$this->cellCache[$pCoord] = true;
|
||||
|
||||
$this->currentObjectID = $pCoord;
|
||||
$this->currentObject = $cell;
|
||||
$this->currentCellIsDirty = true;
|
||||
|
||||
return $cell;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is a value set in the current PHPExcel_CachedObjectStorage_ICache for an indexed cell?
|
||||
*
|
||||
* @access public
|
||||
* @param string $pCoord Coordinate address of the cell to check
|
||||
* @throws PHPExcel_Exception
|
||||
* @return boolean
|
||||
*/
|
||||
public function isDataSet($pCoord)
|
||||
{
|
||||
// Check if the requested entry is the current object, or exists in the cache
|
||||
if (parent::isDataSet($pCoord)) {
|
||||
if ($this->currentObjectID == $pCoord) {
|
||||
return true;
|
||||
}
|
||||
// Check if the requested entry still exists in apc
|
||||
$success = apc_fetch($this->cachePrefix.$pCoord.'.cache');
|
||||
if ($success === false) {
|
||||
// Entry no longer exists in APC, so clear it from the cache array
|
||||
parent::deleteCacheData($pCoord);
|
||||
throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in APC cache');
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get cell at a specific coordinate
|
||||
*
|
||||
* @access public
|
||||
* @param string $pCoord Coordinate of the cell
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Cell Cell that was found, or null if not found
|
||||
*/
|
||||
public function getCacheData($pCoord)
|
||||
{
|
||||
if ($pCoord === $this->currentObjectID) {
|
||||
return $this->currentObject;
|
||||
}
|
||||
$this->storeData();
|
||||
|
||||
// Check if the entry that has been requested actually exists
|
||||
if (parent::isDataSet($pCoord)) {
|
||||
$obj = apc_fetch($this->cachePrefix . $pCoord . '.cache');
|
||||
if ($obj === false) {
|
||||
// Entry no longer exists in APC, so clear it from the cache array
|
||||
parent::deleteCacheData($pCoord);
|
||||
throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in APC cache');
|
||||
}
|
||||
} else {
|
||||
// Return null if requested entry doesn't exist in cache
|
||||
return null;
|
||||
}
|
||||
|
||||
// Set current entry to the requested entry
|
||||
$this->currentObjectID = $pCoord;
|
||||
$this->currentObject = unserialize($obj);
|
||||
// Re-attach this as the cell's parent
|
||||
$this->currentObject->attach($this);
|
||||
|
||||
// Return requested entry
|
||||
return $this->currentObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of all cell addresses currently held in cache
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function getCellList()
|
||||
{
|
||||
if ($this->currentObjectID !== null) {
|
||||
$this->storeData();
|
||||
}
|
||||
|
||||
return parent::getCellList();
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a cell in cache identified by coordinate address
|
||||
*
|
||||
* @access public
|
||||
* @param string $pCoord Coordinate address of the cell to delete
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function deleteCacheData($pCoord)
|
||||
{
|
||||
// Delete the entry from APC
|
||||
apc_delete($this->cachePrefix.$pCoord.'.cache');
|
||||
|
||||
// Delete the entry from our cell address array
|
||||
parent::deleteCacheData($pCoord);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clone the cell collection
|
||||
*
|
||||
* @access public
|
||||
* @param PHPExcel_Worksheet $parent The new worksheet
|
||||
* @throws PHPExcel_Exception
|
||||
* @return void
|
||||
*/
|
||||
public function copyCellCollection(PHPExcel_Worksheet $parent)
|
||||
{
|
||||
parent::copyCellCollection($parent);
|
||||
// Get a new id for the new file name
|
||||
$baseUnique = $this->getUniqueID();
|
||||
$newCachePrefix = substr(md5($baseUnique), 0, 8) . '.';
|
||||
$cacheList = $this->getCellList();
|
||||
foreach ($cacheList as $cellID) {
|
||||
if ($cellID != $this->currentObjectID) {
|
||||
$obj = apc_fetch($this->cachePrefix . $cellID . '.cache');
|
||||
if ($obj === false) {
|
||||
// Entry no longer exists in APC, so clear it from the cache array
|
||||
parent::deleteCacheData($cellID);
|
||||
throw new PHPExcel_Exception('Cell entry ' . $cellID . ' no longer exists in APC');
|
||||
}
|
||||
if (!apc_store($newCachePrefix . $cellID . '.cache', $obj, $this->cacheTime)) {
|
||||
$this->__destruct();
|
||||
throw new PHPExcel_Exception('Failed to store cell ' . $cellID . ' in APC');
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->cachePrefix = $newCachePrefix;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the cell collection and disconnect from our parent
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function unsetWorksheetCells()
|
||||
{
|
||||
if ($this->currentObject !== null) {
|
||||
$this->currentObject->detach();
|
||||
$this->currentObject = $this->currentObjectID = null;
|
||||
}
|
||||
|
||||
// Flush the APC cache
|
||||
$this->__destruct();
|
||||
|
||||
$this->cellCache = array();
|
||||
|
||||
// detach ourself from the worksheet, so that it can then delete this object successfully
|
||||
$this->parent = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise this new cell collection
|
||||
*
|
||||
* @param PHPExcel_Worksheet $parent The worksheet for this cell collection
|
||||
* @param array of mixed $arguments Additional initialisation arguments
|
||||
*/
|
||||
public function __construct(PHPExcel_Worksheet $parent, $arguments)
|
||||
{
|
||||
$cacheTime = (isset($arguments['cacheTime'])) ? $arguments['cacheTime'] : 600;
|
||||
|
||||
if ($this->cachePrefix === null) {
|
||||
$baseUnique = $this->getUniqueID();
|
||||
$this->cachePrefix = substr(md5($baseUnique), 0, 8) . '.';
|
||||
$this->cacheTime = $cacheTime;
|
||||
|
||||
parent::__construct($parent);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy this cell collection
|
||||
*/
|
||||
public function __destruct()
|
||||
{
|
||||
$cacheList = $this->getCellList();
|
||||
foreach ($cacheList as $cellID) {
|
||||
apc_delete($this->cachePrefix . $cellID . '.cache');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Identify whether the caching method is currently available
|
||||
* Some methods are dependent on the availability of certain extensions being enabled in the PHP build
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public static function cacheMethodIsAvailable()
|
||||
{
|
||||
if (!function_exists('apc_store')) {
|
||||
return false;
|
||||
}
|
||||
if (apc_sma_info() === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
368
Cron/PHPExcel/PHPExcel/CachedObjectStorage/CacheBase.php
Executable file
368
Cron/PHPExcel/PHPExcel/CachedObjectStorage/CacheBase.php
Executable file
@@ -0,0 +1,368 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PHPExcel_CachedObjectStorage_CacheBase
|
||||
*
|
||||
* Copyright (c) 2006 - 2015 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_CachedObjectStorage
|
||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version ##VERSION##, ##DATE##
|
||||
*/
|
||||
abstract class PHPExcel_CachedObjectStorage_CacheBase
|
||||
{
|
||||
/**
|
||||
* Parent worksheet
|
||||
*
|
||||
* @var PHPExcel_Worksheet
|
||||
*/
|
||||
protected $parent;
|
||||
|
||||
/**
|
||||
* The currently active Cell
|
||||
*
|
||||
* @var PHPExcel_Cell
|
||||
*/
|
||||
protected $currentObject = null;
|
||||
|
||||
/**
|
||||
* Coordinate address of the currently active Cell
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $currentObjectID = null;
|
||||
|
||||
/**
|
||||
* Flag indicating whether the currently active Cell requires saving
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
protected $currentCellIsDirty = true;
|
||||
|
||||
/**
|
||||
* An array of cells or cell pointers for the worksheet cells held in this cache,
|
||||
* and indexed by their coordinate address within the worksheet
|
||||
*
|
||||
* @var array of mixed
|
||||
*/
|
||||
protected $cellCache = array();
|
||||
|
||||
/**
|
||||
* Initialise this new cell collection
|
||||
*
|
||||
* @param PHPExcel_Worksheet $parent The worksheet for this cell collection
|
||||
*/
|
||||
public function __construct(PHPExcel_Worksheet $parent)
|
||||
{
|
||||
// Set our parent worksheet.
|
||||
// This is maintained within the cache controller to facilitate re-attaching it to PHPExcel_Cell objects when
|
||||
// they are woken from a serialized state
|
||||
$this->parent = $parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the parent worksheet for this cell collection
|
||||
*
|
||||
* @return PHPExcel_Worksheet
|
||||
*/
|
||||
public function getParent()
|
||||
{
|
||||
return $this->parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is a value set in the current PHPExcel_CachedObjectStorage_ICache for an indexed cell?
|
||||
*
|
||||
* @param string $pCoord Coordinate address of the cell to check
|
||||
* @return boolean
|
||||
*/
|
||||
public function isDataSet($pCoord)
|
||||
{
|
||||
if ($pCoord === $this->currentObjectID) {
|
||||
return true;
|
||||
}
|
||||
// Check if the requested entry exists in the cache
|
||||
return isset($this->cellCache[$pCoord]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Move a cell object from one address to another
|
||||
*
|
||||
* @param string $fromAddress Current address of the cell to move
|
||||
* @param string $toAddress Destination address of the cell to move
|
||||
* @return boolean
|
||||
*/
|
||||
public function moveCell($fromAddress, $toAddress)
|
||||
{
|
||||
if ($fromAddress === $this->currentObjectID) {
|
||||
$this->currentObjectID = $toAddress;
|
||||
}
|
||||
$this->currentCellIsDirty = true;
|
||||
if (isset($this->cellCache[$fromAddress])) {
|
||||
$this->cellCache[$toAddress] = &$this->cellCache[$fromAddress];
|
||||
unset($this->cellCache[$fromAddress]);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add or Update a cell in cache
|
||||
*
|
||||
* @param PHPExcel_Cell $cell Cell to update
|
||||
* @return PHPExcel_Cell
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function updateCacheData(PHPExcel_Cell $cell)
|
||||
{
|
||||
return $this->addCacheData($cell->getCoordinate(), $cell);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a cell in cache identified by coordinate address
|
||||
*
|
||||
* @param string $pCoord Coordinate address of the cell to delete
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function deleteCacheData($pCoord)
|
||||
{
|
||||
if ($pCoord === $this->currentObjectID && !is_null($this->currentObject)) {
|
||||
$this->currentObject->detach();
|
||||
$this->currentObjectID = $this->currentObject = null;
|
||||
}
|
||||
|
||||
if (is_object($this->cellCache[$pCoord])) {
|
||||
$this->cellCache[$pCoord]->detach();
|
||||
unset($this->cellCache[$pCoord]);
|
||||
}
|
||||
$this->currentCellIsDirty = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of all cell addresses currently held in cache
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function getCellList()
|
||||
{
|
||||
return array_keys($this->cellCache);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sort the list of all cell addresses currently held in cache by row and column
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function getSortedCellList()
|
||||
{
|
||||
$sortKeys = array();
|
||||
foreach ($this->getCellList() as $coord) {
|
||||
sscanf($coord, '%[A-Z]%d', $column, $row);
|
||||
$sortKeys[sprintf('%09d%3s', $row, $column)] = $coord;
|
||||
}
|
||||
ksort($sortKeys);
|
||||
|
||||
return array_values($sortKeys);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get highest worksheet column and highest row that have cell records
|
||||
*
|
||||
* @return array Highest column name and highest row number
|
||||
*/
|
||||
public function getHighestRowAndColumn()
|
||||
{
|
||||
// Lookup highest column and highest row
|
||||
$col = array('A' => '1A');
|
||||
$row = array(1);
|
||||
foreach ($this->getCellList() as $coord) {
|
||||
sscanf($coord, '%[A-Z]%d', $c, $r);
|
||||
$row[$r] = $r;
|
||||
$col[$c] = strlen($c).$c;
|
||||
}
|
||||
if (!empty($row)) {
|
||||
// Determine highest column and row
|
||||
$highestRow = max($row);
|
||||
$highestColumn = substr(max($col), 1);
|
||||
}
|
||||
|
||||
return array(
|
||||
'row' => $highestRow,
|
||||
'column' => $highestColumn
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the cell address of the currently active cell object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCurrentAddress()
|
||||
{
|
||||
return $this->currentObjectID;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the column address of the currently active cell object
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCurrentColumn()
|
||||
{
|
||||
sscanf($this->currentObjectID, '%[A-Z]%d', $column, $row);
|
||||
return $column;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the row address of the currently active cell object
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function getCurrentRow()
|
||||
{
|
||||
sscanf($this->currentObjectID, '%[A-Z]%d', $column, $row);
|
||||
return (integer) $row;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get highest worksheet column
|
||||
*
|
||||
* @param string $row Return the highest column for the specified row,
|
||||
* or the highest column of any row if no row number is passed
|
||||
* @return string Highest column name
|
||||
*/
|
||||
public function getHighestColumn($row = null)
|
||||
{
|
||||
if ($row == null) {
|
||||
$colRow = $this->getHighestRowAndColumn();
|
||||
return $colRow['column'];
|
||||
}
|
||||
|
||||
$columnList = array(1);
|
||||
foreach ($this->getCellList() as $coord) {
|
||||
sscanf($coord, '%[A-Z]%d', $c, $r);
|
||||
if ($r != $row) {
|
||||
continue;
|
||||
}
|
||||
$columnList[] = PHPExcel_Cell::columnIndexFromString($c);
|
||||
}
|
||||
return PHPExcel_Cell::stringFromColumnIndex(max($columnList) - 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get highest worksheet row
|
||||
*
|
||||
* @param string $column Return the highest row for the specified column,
|
||||
* or the highest row of any column if no column letter is passed
|
||||
* @return int Highest row number
|
||||
*/
|
||||
public function getHighestRow($column = null)
|
||||
{
|
||||
if ($column == null) {
|
||||
$colRow = $this->getHighestRowAndColumn();
|
||||
return $colRow['row'];
|
||||
}
|
||||
|
||||
$rowList = array(0);
|
||||
foreach ($this->getCellList() as $coord) {
|
||||
sscanf($coord, '%[A-Z]%d', $c, $r);
|
||||
if ($c != $column) {
|
||||
continue;
|
||||
}
|
||||
$rowList[] = $r;
|
||||
}
|
||||
|
||||
return max($rowList);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a unique ID for cache referencing
|
||||
*
|
||||
* @return string Unique Reference
|
||||
*/
|
||||
protected function getUniqueID()
|
||||
{
|
||||
if (function_exists('posix_getpid')) {
|
||||
$baseUnique = posix_getpid();
|
||||
} else {
|
||||
$baseUnique = mt_rand();
|
||||
}
|
||||
return uniqid($baseUnique, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clone the cell collection
|
||||
*
|
||||
* @param PHPExcel_Worksheet $parent The new worksheet
|
||||
* @return void
|
||||
*/
|
||||
public function copyCellCollection(PHPExcel_Worksheet $parent)
|
||||
{
|
||||
$this->currentCellIsDirty;
|
||||
$this->storeData();
|
||||
|
||||
$this->parent = $parent;
|
||||
if (($this->currentObject !== null) && (is_object($this->currentObject))) {
|
||||
$this->currentObject->attach($this);
|
||||
}
|
||||
} // function copyCellCollection()
|
||||
|
||||
/**
|
||||
* Remove a row, deleting all cells in that row
|
||||
*
|
||||
* @param string $row Row number to remove
|
||||
* @return void
|
||||
*/
|
||||
public function removeRow($row)
|
||||
{
|
||||
foreach ($this->getCellList() as $coord) {
|
||||
sscanf($coord, '%[A-Z]%d', $c, $r);
|
||||
if ($r == $row) {
|
||||
$this->deleteCacheData($coord);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a column, deleting all cells in that column
|
||||
*
|
||||
* @param string $column Column ID to remove
|
||||
* @return void
|
||||
*/
|
||||
public function removeColumn($column)
|
||||
{
|
||||
foreach ($this->getCellList() as $coord) {
|
||||
sscanf($coord, '%[A-Z]%d', $c, $r);
|
||||
if ($c == $column) {
|
||||
$this->deleteCacheData($coord);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Identify whether the caching method is currently available
|
||||
* Some methods are dependent on the availability of certain extensions being enabled in the PHP build
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public static function cacheMethodIsAvailable()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
208
Cron/PHPExcel/PHPExcel/CachedObjectStorage/DiscISAM.php
Executable file
208
Cron/PHPExcel/PHPExcel/CachedObjectStorage/DiscISAM.php
Executable file
@@ -0,0 +1,208 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PHPExcel_CachedObjectStorage_DiscISAM
|
||||
*
|
||||
* Copyright (c) 2006 - 2015 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_CachedObjectStorage
|
||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version ##VERSION##, ##DATE##
|
||||
*/
|
||||
class PHPExcel_CachedObjectStorage_DiscISAM extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache
|
||||
{
|
||||
/**
|
||||
* Name of the file for this cache
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $fileName = null;
|
||||
|
||||
/**
|
||||
* File handle for this cache file
|
||||
*
|
||||
* @var resource
|
||||
*/
|
||||
private $fileHandle = null;
|
||||
|
||||
/**
|
||||
* Directory/Folder where the cache file is located
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $cacheDirectory = null;
|
||||
|
||||
/**
|
||||
* Store cell data in cache for the current cell object if it's "dirty",
|
||||
* and the 'nullify' the current cell object
|
||||
*
|
||||
* @return void
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
protected function storeData()
|
||||
{
|
||||
if ($this->currentCellIsDirty && !empty($this->currentObjectID)) {
|
||||
$this->currentObject->detach();
|
||||
|
||||
fseek($this->fileHandle, 0, SEEK_END);
|
||||
|
||||
$this->cellCache[$this->currentObjectID] = array(
|
||||
'ptr' => ftell($this->fileHandle),
|
||||
'sz' => fwrite($this->fileHandle, serialize($this->currentObject))
|
||||
);
|
||||
$this->currentCellIsDirty = false;
|
||||
}
|
||||
$this->currentObjectID = $this->currentObject = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add or Update a cell in cache identified by coordinate address
|
||||
*
|
||||
* @param string $pCoord Coordinate address of the cell to update
|
||||
* @param PHPExcel_Cell $cell Cell to update
|
||||
* @return PHPExcel_Cell
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function addCacheData($pCoord, PHPExcel_Cell $cell)
|
||||
{
|
||||
if (($pCoord !== $this->currentObjectID) && ($this->currentObjectID !== null)) {
|
||||
$this->storeData();
|
||||
}
|
||||
|
||||
$this->currentObjectID = $pCoord;
|
||||
$this->currentObject = $cell;
|
||||
$this->currentCellIsDirty = true;
|
||||
|
||||
return $cell;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get cell at a specific coordinate
|
||||
*
|
||||
* @param string $pCoord Coordinate of the cell
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Cell Cell that was found, or null if not found
|
||||
*/
|
||||
public function getCacheData($pCoord)
|
||||
{
|
||||
if ($pCoord === $this->currentObjectID) {
|
||||
return $this->currentObject;
|
||||
}
|
||||
$this->storeData();
|
||||
|
||||
// Check if the entry that has been requested actually exists
|
||||
if (!isset($this->cellCache[$pCoord])) {
|
||||
// Return null if requested entry doesn't exist in cache
|
||||
return null;
|
||||
}
|
||||
|
||||
// Set current entry to the requested entry
|
||||
$this->currentObjectID = $pCoord;
|
||||
fseek($this->fileHandle, $this->cellCache[$pCoord]['ptr']);
|
||||
$this->currentObject = unserialize(fread($this->fileHandle, $this->cellCache[$pCoord]['sz']));
|
||||
// Re-attach this as the cell's parent
|
||||
$this->currentObject->attach($this);
|
||||
|
||||
// Return requested entry
|
||||
return $this->currentObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of all cell addresses currently held in cache
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function getCellList()
|
||||
{
|
||||
if ($this->currentObjectID !== null) {
|
||||
$this->storeData();
|
||||
}
|
||||
|
||||
return parent::getCellList();
|
||||
}
|
||||
|
||||
/**
|
||||
* Clone the cell collection
|
||||
*
|
||||
* @param PHPExcel_Worksheet $parent The new worksheet
|
||||
*/
|
||||
public function copyCellCollection(PHPExcel_Worksheet $parent)
|
||||
{
|
||||
parent::copyCellCollection($parent);
|
||||
// Get a new id for the new file name
|
||||
$baseUnique = $this->getUniqueID();
|
||||
$newFileName = $this->cacheDirectory.'/PHPExcel.'.$baseUnique.'.cache';
|
||||
// Copy the existing cell cache file
|
||||
copy($this->fileName, $newFileName);
|
||||
$this->fileName = $newFileName;
|
||||
// Open the copied cell cache file
|
||||
$this->fileHandle = fopen($this->fileName, 'a+');
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the cell collection and disconnect from our parent
|
||||
*
|
||||
*/
|
||||
public function unsetWorksheetCells()
|
||||
{
|
||||
if (!is_null($this->currentObject)) {
|
||||
$this->currentObject->detach();
|
||||
$this->currentObject = $this->currentObjectID = null;
|
||||
}
|
||||
$this->cellCache = array();
|
||||
|
||||
// detach ourself from the worksheet, so that it can then delete this object successfully
|
||||
$this->parent = null;
|
||||
|
||||
// Close down the temporary cache file
|
||||
$this->__destruct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise this new cell collection
|
||||
*
|
||||
* @param PHPExcel_Worksheet $parent The worksheet for this cell collection
|
||||
* @param array of mixed $arguments Additional initialisation arguments
|
||||
*/
|
||||
public function __construct(PHPExcel_Worksheet $parent, $arguments)
|
||||
{
|
||||
$this->cacheDirectory = ((isset($arguments['dir'])) && ($arguments['dir'] !== null))
|
||||
? $arguments['dir']
|
||||
: PHPExcel_Shared_File::sys_get_temp_dir();
|
||||
|
||||
parent::__construct($parent);
|
||||
if (is_null($this->fileHandle)) {
|
||||
$baseUnique = $this->getUniqueID();
|
||||
$this->fileName = $this->cacheDirectory.'/PHPExcel.'.$baseUnique.'.cache';
|
||||
$this->fileHandle = fopen($this->fileName, 'a+');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy this cell collection
|
||||
*/
|
||||
public function __destruct()
|
||||
{
|
||||
if (!is_null($this->fileHandle)) {
|
||||
fclose($this->fileHandle);
|
||||
unlink($this->fileName);
|
||||
}
|
||||
$this->fileHandle = null;
|
||||
}
|
||||
}
|
||||
103
Cron/PHPExcel/PHPExcel/CachedObjectStorage/ICache.php
Executable file
103
Cron/PHPExcel/PHPExcel/CachedObjectStorage/ICache.php
Executable file
@@ -0,0 +1,103 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PHPExcel_CachedObjectStorage_ICache
|
||||
*
|
||||
* Copyright (c) 2006 - 2015 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_CachedObjectStorage
|
||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version ##VERSION##, ##DATE##
|
||||
*/
|
||||
interface PHPExcel_CachedObjectStorage_ICache
|
||||
{
|
||||
/**
|
||||
* Add or Update a cell in cache identified by coordinate address
|
||||
*
|
||||
* @param string $pCoord Coordinate address of the cell to update
|
||||
* @param PHPExcel_Cell $cell Cell to update
|
||||
* @return PHPExcel_Cell
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function addCacheData($pCoord, PHPExcel_Cell $cell);
|
||||
|
||||
/**
|
||||
* Add or Update a cell in cache
|
||||
*
|
||||
* @param PHPExcel_Cell $cell Cell to update
|
||||
* @return PHPExcel_Cell
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function updateCacheData(PHPExcel_Cell $cell);
|
||||
|
||||
/**
|
||||
* Fetch a cell from cache identified by coordinate address
|
||||
*
|
||||
* @param string $pCoord Coordinate address of the cell to retrieve
|
||||
* @return PHPExcel_Cell Cell that was found, or null if not found
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function getCacheData($pCoord);
|
||||
|
||||
/**
|
||||
* Delete a cell in cache identified by coordinate address
|
||||
*
|
||||
* @param string $pCoord Coordinate address of the cell to delete
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function deleteCacheData($pCoord);
|
||||
|
||||
/**
|
||||
* Is a value set in the current PHPExcel_CachedObjectStorage_ICache for an indexed cell?
|
||||
*
|
||||
* @param string $pCoord Coordinate address of the cell to check
|
||||
* @return boolean
|
||||
*/
|
||||
public function isDataSet($pCoord);
|
||||
|
||||
/**
|
||||
* Get a list of all cell addresses currently held in cache
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function getCellList();
|
||||
|
||||
/**
|
||||
* Get the list of all cell addresses currently held in cache sorted by column and row
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function getSortedCellList();
|
||||
|
||||
/**
|
||||
* Clone the cell collection
|
||||
*
|
||||
* @param PHPExcel_Worksheet $parent The new worksheet
|
||||
* @return void
|
||||
*/
|
||||
public function copyCellCollection(PHPExcel_Worksheet $parent);
|
||||
|
||||
/**
|
||||
* Identify whether the caching method is currently available
|
||||
* Some methods are dependent on the availability of certain extensions being enabled in the PHP build
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public static function cacheMethodIsAvailable();
|
||||
}
|
||||
149
Cron/PHPExcel/PHPExcel/CachedObjectStorage/Igbinary.php
Executable file
149
Cron/PHPExcel/PHPExcel/CachedObjectStorage/Igbinary.php
Executable file
@@ -0,0 +1,149 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PHPExcel_CachedObjectStorage_Igbinary
|
||||
*
|
||||
* Copyright (c) 2006 - 2015 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_CachedObjectStorage
|
||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version ##VERSION##, ##DATE##
|
||||
*/
|
||||
class PHPExcel_CachedObjectStorage_Igbinary extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache
|
||||
{
|
||||
/**
|
||||
* Store cell data in cache for the current cell object if it's "dirty",
|
||||
* and the 'nullify' the current cell object
|
||||
*
|
||||
* @return void
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
protected function storeData()
|
||||
{
|
||||
if ($this->currentCellIsDirty && !empty($this->currentObjectID)) {
|
||||
$this->currentObject->detach();
|
||||
|
||||
$this->cellCache[$this->currentObjectID] = igbinary_serialize($this->currentObject);
|
||||
$this->currentCellIsDirty = false;
|
||||
}
|
||||
$this->currentObjectID = $this->currentObject = null;
|
||||
} // function _storeData()
|
||||
|
||||
|
||||
/**
|
||||
* Add or Update a cell in cache identified by coordinate address
|
||||
*
|
||||
* @param string $pCoord Coordinate address of the cell to update
|
||||
* @param PHPExcel_Cell $cell Cell to update
|
||||
* @return PHPExcel_Cell
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function addCacheData($pCoord, PHPExcel_Cell $cell)
|
||||
{
|
||||
if (($pCoord !== $this->currentObjectID) && ($this->currentObjectID !== null)) {
|
||||
$this->storeData();
|
||||
}
|
||||
|
||||
$this->currentObjectID = $pCoord;
|
||||
$this->currentObject = $cell;
|
||||
$this->currentCellIsDirty = true;
|
||||
|
||||
return $cell;
|
||||
} // function addCacheData()
|
||||
|
||||
|
||||
/**
|
||||
* Get cell at a specific coordinate
|
||||
*
|
||||
* @param string $pCoord Coordinate of the cell
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Cell Cell that was found, or null if not found
|
||||
*/
|
||||
public function getCacheData($pCoord)
|
||||
{
|
||||
if ($pCoord === $this->currentObjectID) {
|
||||
return $this->currentObject;
|
||||
}
|
||||
$this->storeData();
|
||||
|
||||
// Check if the entry that has been requested actually exists
|
||||
if (!isset($this->cellCache[$pCoord])) {
|
||||
// Return null if requested entry doesn't exist in cache
|
||||
return null;
|
||||
}
|
||||
|
||||
// Set current entry to the requested entry
|
||||
$this->currentObjectID = $pCoord;
|
||||
$this->currentObject = igbinary_unserialize($this->cellCache[$pCoord]);
|
||||
// Re-attach this as the cell's parent
|
||||
$this->currentObject->attach($this);
|
||||
|
||||
// Return requested entry
|
||||
return $this->currentObject;
|
||||
} // function getCacheData()
|
||||
|
||||
|
||||
/**
|
||||
* Get a list of all cell addresses currently held in cache
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function getCellList()
|
||||
{
|
||||
if ($this->currentObjectID !== null) {
|
||||
$this->storeData();
|
||||
}
|
||||
|
||||
return parent::getCellList();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Clear the cell collection and disconnect from our parent
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function unsetWorksheetCells()
|
||||
{
|
||||
if (!is_null($this->currentObject)) {
|
||||
$this->currentObject->detach();
|
||||
$this->currentObject = $this->currentObjectID = null;
|
||||
}
|
||||
$this->cellCache = array();
|
||||
|
||||
// detach ourself from the worksheet, so that it can then delete this object successfully
|
||||
$this->parent = null;
|
||||
} // function unsetWorksheetCells()
|
||||
|
||||
|
||||
/**
|
||||
* Identify whether the caching method is currently available
|
||||
* Some methods are dependent on the availability of certain extensions being enabled in the PHP build
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public static function cacheMethodIsAvailable()
|
||||
{
|
||||
if (!function_exists('igbinary_serialize')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
308
Cron/PHPExcel/PHPExcel/CachedObjectStorage/Memcache.php
Executable file
308
Cron/PHPExcel/PHPExcel/CachedObjectStorage/Memcache.php
Executable file
@@ -0,0 +1,308 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PHPExcel_CachedObjectStorage_Memcache
|
||||
*
|
||||
* Copyright (c) 2006 - 2015 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_CachedObjectStorage
|
||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version ##VERSION##, ##DATE##
|
||||
*/
|
||||
class PHPExcel_CachedObjectStorage_Memcache extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache
|
||||
{
|
||||
/**
|
||||
* Prefix used to uniquely identify cache data for this worksheet
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $cachePrefix = null;
|
||||
|
||||
/**
|
||||
* Cache timeout
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
private $cacheTime = 600;
|
||||
|
||||
/**
|
||||
* Memcache interface
|
||||
*
|
||||
* @var resource
|
||||
*/
|
||||
private $memcache = null;
|
||||
|
||||
|
||||
/**
|
||||
* Store cell data in cache for the current cell object if it's "dirty",
|
||||
* and the 'nullify' the current cell object
|
||||
*
|
||||
* @return void
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
protected function storeData()
|
||||
{
|
||||
if ($this->currentCellIsDirty && !empty($this->currentObjectID)) {
|
||||
$this->currentObject->detach();
|
||||
|
||||
$obj = serialize($this->currentObject);
|
||||
if (!$this->memcache->replace($this->cachePrefix . $this->currentObjectID . '.cache', $obj, null, $this->cacheTime)) {
|
||||
if (!$this->memcache->add($this->cachePrefix . $this->currentObjectID . '.cache', $obj, null, $this->cacheTime)) {
|
||||
$this->__destruct();
|
||||
throw new PHPExcel_Exception("Failed to store cell {$this->currentObjectID} in MemCache");
|
||||
}
|
||||
}
|
||||
$this->currentCellIsDirty = false;
|
||||
}
|
||||
$this->currentObjectID = $this->currentObject = null;
|
||||
} // function _storeData()
|
||||
|
||||
|
||||
/**
|
||||
* Add or Update a cell in cache identified by coordinate address
|
||||
*
|
||||
* @param string $pCoord Coordinate address of the cell to update
|
||||
* @param PHPExcel_Cell $cell Cell to update
|
||||
* @return PHPExcel_Cell
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function addCacheData($pCoord, PHPExcel_Cell $cell)
|
||||
{
|
||||
if (($pCoord !== $this->currentObjectID) && ($this->currentObjectID !== null)) {
|
||||
$this->storeData();
|
||||
}
|
||||
$this->cellCache[$pCoord] = true;
|
||||
|
||||
$this->currentObjectID = $pCoord;
|
||||
$this->currentObject = $cell;
|
||||
$this->currentCellIsDirty = true;
|
||||
|
||||
return $cell;
|
||||
} // function addCacheData()
|
||||
|
||||
|
||||
/**
|
||||
* Is a value set in the current PHPExcel_CachedObjectStorage_ICache for an indexed cell?
|
||||
*
|
||||
* @param string $pCoord Coordinate address of the cell to check
|
||||
* @return boolean
|
||||
* @return boolean
|
||||
*/
|
||||
public function isDataSet($pCoord)
|
||||
{
|
||||
// Check if the requested entry is the current object, or exists in the cache
|
||||
if (parent::isDataSet($pCoord)) {
|
||||
if ($this->currentObjectID == $pCoord) {
|
||||
return true;
|
||||
}
|
||||
// Check if the requested entry still exists in Memcache
|
||||
$success = $this->memcache->get($this->cachePrefix.$pCoord.'.cache');
|
||||
if ($success === false) {
|
||||
// Entry no longer exists in Memcache, so clear it from the cache array
|
||||
parent::deleteCacheData($pCoord);
|
||||
throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in MemCache');
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get cell at a specific coordinate
|
||||
*
|
||||
* @param string $pCoord Coordinate of the cell
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Cell Cell that was found, or null if not found
|
||||
*/
|
||||
public function getCacheData($pCoord)
|
||||
{
|
||||
if ($pCoord === $this->currentObjectID) {
|
||||
return $this->currentObject;
|
||||
}
|
||||
$this->storeData();
|
||||
|
||||
// Check if the entry that has been requested actually exists
|
||||
if (parent::isDataSet($pCoord)) {
|
||||
$obj = $this->memcache->get($this->cachePrefix . $pCoord . '.cache');
|
||||
if ($obj === false) {
|
||||
// Entry no longer exists in Memcache, so clear it from the cache array
|
||||
parent::deleteCacheData($pCoord);
|
||||
throw new PHPExcel_Exception("Cell entry {$pCoord} no longer exists in MemCache");
|
||||
}
|
||||
} else {
|
||||
// Return null if requested entry doesn't exist in cache
|
||||
return null;
|
||||
}
|
||||
|
||||
// Set current entry to the requested entry
|
||||
$this->currentObjectID = $pCoord;
|
||||
$this->currentObject = unserialize($obj);
|
||||
// Re-attach this as the cell's parent
|
||||
$this->currentObject->attach($this);
|
||||
|
||||
// Return requested entry
|
||||
return $this->currentObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of all cell addresses currently held in cache
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function getCellList()
|
||||
{
|
||||
if ($this->currentObjectID !== null) {
|
||||
$this->storeData();
|
||||
}
|
||||
|
||||
return parent::getCellList();
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a cell in cache identified by coordinate address
|
||||
*
|
||||
* @param string $pCoord Coordinate address of the cell to delete
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function deleteCacheData($pCoord)
|
||||
{
|
||||
// Delete the entry from Memcache
|
||||
$this->memcache->delete($this->cachePrefix . $pCoord . '.cache');
|
||||
|
||||
// Delete the entry from our cell address array
|
||||
parent::deleteCacheData($pCoord);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clone the cell collection
|
||||
*
|
||||
* @param PHPExcel_Worksheet $parent The new worksheet
|
||||
* @return void
|
||||
*/
|
||||
public function copyCellCollection(PHPExcel_Worksheet $parent)
|
||||
{
|
||||
parent::copyCellCollection($parent);
|
||||
// Get a new id for the new file name
|
||||
$baseUnique = $this->getUniqueID();
|
||||
$newCachePrefix = substr(md5($baseUnique), 0, 8) . '.';
|
||||
$cacheList = $this->getCellList();
|
||||
foreach ($cacheList as $cellID) {
|
||||
if ($cellID != $this->currentObjectID) {
|
||||
$obj = $this->memcache->get($this->cachePrefix.$cellID.'.cache');
|
||||
if ($obj === false) {
|
||||
// Entry no longer exists in Memcache, so clear it from the cache array
|
||||
parent::deleteCacheData($cellID);
|
||||
throw new PHPExcel_Exception("Cell entry {$cellID} no longer exists in MemCache");
|
||||
}
|
||||
if (!$this->memcache->add($newCachePrefix . $cellID . '.cache', $obj, null, $this->cacheTime)) {
|
||||
$this->__destruct();
|
||||
throw new PHPExcel_Exception("Failed to store cell {$cellID} in MemCache");
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->cachePrefix = $newCachePrefix;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the cell collection and disconnect from our parent
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function unsetWorksheetCells()
|
||||
{
|
||||
if (!is_null($this->currentObject)) {
|
||||
$this->currentObject->detach();
|
||||
$this->currentObject = $this->currentObjectID = null;
|
||||
}
|
||||
|
||||
// Flush the Memcache cache
|
||||
$this->__destruct();
|
||||
|
||||
$this->cellCache = array();
|
||||
|
||||
// detach ourself from the worksheet, so that it can then delete this object successfully
|
||||
$this->parent = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise this new cell collection
|
||||
*
|
||||
* @param PHPExcel_Worksheet $parent The worksheet for this cell collection
|
||||
* @param array of mixed $arguments Additional initialisation arguments
|
||||
*/
|
||||
public function __construct(PHPExcel_Worksheet $parent, $arguments)
|
||||
{
|
||||
$memcacheServer = (isset($arguments['memcacheServer'])) ? $arguments['memcacheServer'] : 'localhost';
|
||||
$memcachePort = (isset($arguments['memcachePort'])) ? $arguments['memcachePort'] : 11211;
|
||||
$cacheTime = (isset($arguments['cacheTime'])) ? $arguments['cacheTime'] : 600;
|
||||
|
||||
if (is_null($this->cachePrefix)) {
|
||||
$baseUnique = $this->getUniqueID();
|
||||
$this->cachePrefix = substr(md5($baseUnique), 0, 8) . '.';
|
||||
|
||||
// Set a new Memcache object and connect to the Memcache server
|
||||
$this->memcache = new Memcache();
|
||||
if (!$this->memcache->addServer($memcacheServer, $memcachePort, false, 50, 5, 5, true, array($this, 'failureCallback'))) {
|
||||
throw new PHPExcel_Exception("Could not connect to MemCache server at {$memcacheServer}:{$memcachePort}");
|
||||
}
|
||||
$this->cacheTime = $cacheTime;
|
||||
|
||||
parent::__construct($parent);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Memcache error handler
|
||||
*
|
||||
* @param string $host Memcache server
|
||||
* @param integer $port Memcache port
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function failureCallback($host, $port)
|
||||
{
|
||||
throw new PHPExcel_Exception("memcache {$host}:{$port} failed");
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy this cell collection
|
||||
*/
|
||||
public function __destruct()
|
||||
{
|
||||
$cacheList = $this->getCellList();
|
||||
foreach ($cacheList as $cellID) {
|
||||
$this->memcache->delete($this->cachePrefix.$cellID . '.cache');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Identify whether the caching method is currently available
|
||||
* Some methods are dependent on the availability of certain extensions being enabled in the PHP build
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public static function cacheMethodIsAvailable()
|
||||
{
|
||||
if (!function_exists('memcache_add')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
118
Cron/PHPExcel/PHPExcel/CachedObjectStorage/Memory.php
Executable file
118
Cron/PHPExcel/PHPExcel/CachedObjectStorage/Memory.php
Executable file
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PHPExcel_CachedObjectStorage_Memory
|
||||
*
|
||||
* Copyright (c) 2006 - 2015 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_CachedObjectStorage
|
||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version ##VERSION##, ##DATE##
|
||||
*/
|
||||
class PHPExcel_CachedObjectStorage_Memory extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache
|
||||
{
|
||||
/**
|
||||
* Dummy method callable from CacheBase, but unused by Memory cache
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function storeData()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Add or Update a cell in cache identified by coordinate address
|
||||
*
|
||||
* @param string $pCoord Coordinate address of the cell to update
|
||||
* @param PHPExcel_Cell $cell Cell to update
|
||||
* @return PHPExcel_Cell
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function addCacheData($pCoord, PHPExcel_Cell $cell)
|
||||
{
|
||||
$this->cellCache[$pCoord] = $cell;
|
||||
|
||||
// Set current entry to the new/updated entry
|
||||
$this->currentObjectID = $pCoord;
|
||||
|
||||
return $cell;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get cell at a specific coordinate
|
||||
*
|
||||
* @param string $pCoord Coordinate of the cell
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Cell Cell that was found, or null if not found
|
||||
*/
|
||||
public function getCacheData($pCoord)
|
||||
{
|
||||
// Check if the entry that has been requested actually exists
|
||||
if (!isset($this->cellCache[$pCoord])) {
|
||||
$this->currentObjectID = null;
|
||||
// Return null if requested entry doesn't exist in cache
|
||||
return null;
|
||||
}
|
||||
|
||||
// Set current entry to the requested entry
|
||||
$this->currentObjectID = $pCoord;
|
||||
|
||||
// Return requested entry
|
||||
return $this->cellCache[$pCoord];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Clone the cell collection
|
||||
*
|
||||
* @param PHPExcel_Worksheet $parent The new worksheet
|
||||
*/
|
||||
public function copyCellCollection(PHPExcel_Worksheet $parent)
|
||||
{
|
||||
parent::copyCellCollection($parent);
|
||||
|
||||
$newCollection = array();
|
||||
foreach ($this->cellCache as $k => &$cell) {
|
||||
$newCollection[$k] = clone $cell;
|
||||
$newCollection[$k]->attach($this);
|
||||
}
|
||||
|
||||
$this->cellCache = $newCollection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the cell collection and disconnect from our parent
|
||||
*
|
||||
*/
|
||||
public function unsetWorksheetCells()
|
||||
{
|
||||
// Because cells are all stored as intact objects in memory, we need to detach each one from the parent
|
||||
foreach ($this->cellCache as $k => &$cell) {
|
||||
$cell->detach();
|
||||
$this->cellCache[$k] = null;
|
||||
}
|
||||
unset($cell);
|
||||
|
||||
$this->cellCache = array();
|
||||
|
||||
// detach ourself from the worksheet, so that it can then delete this object successfully
|
||||
$this->parent = null;
|
||||
}
|
||||
}
|
||||
133
Cron/PHPExcel/PHPExcel/CachedObjectStorage/MemoryGZip.php
Executable file
133
Cron/PHPExcel/PHPExcel/CachedObjectStorage/MemoryGZip.php
Executable file
@@ -0,0 +1,133 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PHPExcel_CachedObjectStorage_MemoryGZip
|
||||
*
|
||||
* Copyright (c) 2006 - 2015 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_CachedObjectStorage
|
||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version ##VERSION##, ##DATE##
|
||||
*/
|
||||
class PHPExcel_CachedObjectStorage_MemoryGZip extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache
|
||||
{
|
||||
/**
|
||||
* Store cell data in cache for the current cell object if it's "dirty",
|
||||
* and the 'nullify' the current cell object
|
||||
*
|
||||
* @return void
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
protected function storeData()
|
||||
{
|
||||
if ($this->currentCellIsDirty && !empty($this->currentObjectID)) {
|
||||
$this->currentObject->detach();
|
||||
|
||||
$this->cellCache[$this->currentObjectID] = gzdeflate(serialize($this->currentObject));
|
||||
$this->currentCellIsDirty = false;
|
||||
}
|
||||
$this->currentObjectID = $this->currentObject = null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add or Update a cell in cache identified by coordinate address
|
||||
*
|
||||
* @param string $pCoord Coordinate address of the cell to update
|
||||
* @param PHPExcel_Cell $cell Cell to update
|
||||
* @return PHPExcel_Cell
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function addCacheData($pCoord, PHPExcel_Cell $cell)
|
||||
{
|
||||
if (($pCoord !== $this->currentObjectID) && ($this->currentObjectID !== null)) {
|
||||
$this->storeData();
|
||||
}
|
||||
|
||||
$this->currentObjectID = $pCoord;
|
||||
$this->currentObject = $cell;
|
||||
$this->currentCellIsDirty = true;
|
||||
|
||||
return $cell;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get cell at a specific coordinate
|
||||
*
|
||||
* @param string $pCoord Coordinate of the cell
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Cell Cell that was found, or null if not found
|
||||
*/
|
||||
public function getCacheData($pCoord)
|
||||
{
|
||||
if ($pCoord === $this->currentObjectID) {
|
||||
return $this->currentObject;
|
||||
}
|
||||
$this->storeData();
|
||||
|
||||
// Check if the entry that has been requested actually exists
|
||||
if (!isset($this->cellCache[$pCoord])) {
|
||||
// Return null if requested entry doesn't exist in cache
|
||||
return null;
|
||||
}
|
||||
|
||||
// Set current entry to the requested entry
|
||||
$this->currentObjectID = $pCoord;
|
||||
$this->currentObject = unserialize(gzinflate($this->cellCache[$pCoord]));
|
||||
// Re-attach this as the cell's parent
|
||||
$this->currentObject->attach($this);
|
||||
|
||||
// Return requested entry
|
||||
return $this->currentObject;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get a list of all cell addresses currently held in cache
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function getCellList()
|
||||
{
|
||||
if ($this->currentObjectID !== null) {
|
||||
$this->storeData();
|
||||
}
|
||||
|
||||
return parent::getCellList();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Clear the cell collection and disconnect from our parent
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function unsetWorksheetCells()
|
||||
{
|
||||
if (!is_null($this->currentObject)) {
|
||||
$this->currentObject->detach();
|
||||
$this->currentObject = $this->currentObjectID = null;
|
||||
}
|
||||
$this->cellCache = array();
|
||||
|
||||
// detach ourself from the worksheet, so that it can then delete this object successfully
|
||||
$this->parent = null;
|
||||
}
|
||||
}
|
||||
129
Cron/PHPExcel/PHPExcel/CachedObjectStorage/MemorySerialized.php
Executable file
129
Cron/PHPExcel/PHPExcel/CachedObjectStorage/MemorySerialized.php
Executable file
@@ -0,0 +1,129 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PHPExcel_CachedObjectStorage_MemorySerialized
|
||||
*
|
||||
* Copyright (c) 2006 - 2015 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_CachedObjectStorage
|
||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version ##VERSION##, ##DATE##
|
||||
*/
|
||||
class PHPExcel_CachedObjectStorage_MemorySerialized extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache
|
||||
{
|
||||
/**
|
||||
* Store cell data in cache for the current cell object if it's "dirty",
|
||||
* and the 'nullify' the current cell object
|
||||
*
|
||||
* @return void
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
protected function storeData()
|
||||
{
|
||||
if ($this->currentCellIsDirty && !empty($this->currentObjectID)) {
|
||||
$this->currentObject->detach();
|
||||
|
||||
$this->cellCache[$this->currentObjectID] = serialize($this->currentObject);
|
||||
$this->currentCellIsDirty = false;
|
||||
}
|
||||
$this->currentObjectID = $this->currentObject = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add or Update a cell in cache identified by coordinate address
|
||||
*
|
||||
* @param string $pCoord Coordinate address of the cell to update
|
||||
* @param PHPExcel_Cell $cell Cell to update
|
||||
* @return PHPExcel_Cell
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function addCacheData($pCoord, PHPExcel_Cell $cell)
|
||||
{
|
||||
if (($pCoord !== $this->currentObjectID) && ($this->currentObjectID !== null)) {
|
||||
$this->storeData();
|
||||
}
|
||||
|
||||
$this->currentObjectID = $pCoord;
|
||||
$this->currentObject = $cell;
|
||||
$this->currentCellIsDirty = true;
|
||||
|
||||
return $cell;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get cell at a specific coordinate
|
||||
*
|
||||
* @param string $pCoord Coordinate of the cell
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Cell Cell that was found, or null if not found
|
||||
*/
|
||||
public function getCacheData($pCoord)
|
||||
{
|
||||
if ($pCoord === $this->currentObjectID) {
|
||||
return $this->currentObject;
|
||||
}
|
||||
$this->storeData();
|
||||
|
||||
// Check if the entry that has been requested actually exists
|
||||
if (!isset($this->cellCache[$pCoord])) {
|
||||
// Return null if requested entry doesn't exist in cache
|
||||
return null;
|
||||
}
|
||||
|
||||
// Set current entry to the requested entry
|
||||
$this->currentObjectID = $pCoord;
|
||||
$this->currentObject = unserialize($this->cellCache[$pCoord]);
|
||||
// Re-attach this as the cell's parent
|
||||
$this->currentObject->attach($this);
|
||||
|
||||
// Return requested entry
|
||||
return $this->currentObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of all cell addresses currently held in cache
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function getCellList()
|
||||
{
|
||||
if ($this->currentObjectID !== null) {
|
||||
$this->storeData();
|
||||
}
|
||||
|
||||
return parent::getCellList();
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the cell collection and disconnect from our parent
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function unsetWorksheetCells()
|
||||
{
|
||||
if (!is_null($this->currentObject)) {
|
||||
$this->currentObject->detach();
|
||||
$this->currentObject = $this->currentObjectID = null;
|
||||
}
|
||||
$this->cellCache = array();
|
||||
|
||||
// detach ourself from the worksheet, so that it can then delete this object successfully
|
||||
$this->parent = null;
|
||||
}
|
||||
}
|
||||
200
Cron/PHPExcel/PHPExcel/CachedObjectStorage/PHPTemp.php
Executable file
200
Cron/PHPExcel/PHPExcel/CachedObjectStorage/PHPTemp.php
Executable file
@@ -0,0 +1,200 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PHPExcel_CachedObjectStorage_PHPTemp
|
||||
*
|
||||
* Copyright (c) 2006 - 2015 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_CachedObjectStorage
|
||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version ##VERSION##, ##DATE##
|
||||
*/
|
||||
class PHPExcel_CachedObjectStorage_PHPTemp extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache
|
||||
{
|
||||
/**
|
||||
* Name of the file for this cache
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $fileHandle = null;
|
||||
|
||||
/**
|
||||
* Memory limit to use before reverting to file cache
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
private $memoryCacheSize = null;
|
||||
|
||||
/**
|
||||
* Store cell data in cache for the current cell object if it's "dirty",
|
||||
* and the 'nullify' the current cell object
|
||||
*
|
||||
* @return void
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
protected function storeData()
|
||||
{
|
||||
if ($this->currentCellIsDirty && !empty($this->currentObjectID)) {
|
||||
$this->currentObject->detach();
|
||||
|
||||
fseek($this->fileHandle, 0, SEEK_END);
|
||||
|
||||
$this->cellCache[$this->currentObjectID] = array(
|
||||
'ptr' => ftell($this->fileHandle),
|
||||
'sz' => fwrite($this->fileHandle, serialize($this->currentObject))
|
||||
);
|
||||
$this->currentCellIsDirty = false;
|
||||
}
|
||||
$this->currentObjectID = $this->currentObject = null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add or Update a cell in cache identified by coordinate address
|
||||
*
|
||||
* @param string $pCoord Coordinate address of the cell to update
|
||||
* @param PHPExcel_Cell $cell Cell to update
|
||||
* @return PHPExcel_Cell
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function addCacheData($pCoord, PHPExcel_Cell $cell)
|
||||
{
|
||||
if (($pCoord !== $this->currentObjectID) && ($this->currentObjectID !== null)) {
|
||||
$this->storeData();
|
||||
}
|
||||
|
||||
$this->currentObjectID = $pCoord;
|
||||
$this->currentObject = $cell;
|
||||
$this->currentCellIsDirty = true;
|
||||
|
||||
return $cell;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get cell at a specific coordinate
|
||||
*
|
||||
* @param string $pCoord Coordinate of the cell
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Cell Cell that was found, or null if not found
|
||||
*/
|
||||
public function getCacheData($pCoord)
|
||||
{
|
||||
if ($pCoord === $this->currentObjectID) {
|
||||
return $this->currentObject;
|
||||
}
|
||||
$this->storeData();
|
||||
|
||||
// Check if the entry that has been requested actually exists
|
||||
if (!isset($this->cellCache[$pCoord])) {
|
||||
// Return null if requested entry doesn't exist in cache
|
||||
return null;
|
||||
}
|
||||
|
||||
// Set current entry to the requested entry
|
||||
$this->currentObjectID = $pCoord;
|
||||
fseek($this->fileHandle, $this->cellCache[$pCoord]['ptr']);
|
||||
$this->currentObject = unserialize(fread($this->fileHandle, $this->cellCache[$pCoord]['sz']));
|
||||
// Re-attach this as the cell's parent
|
||||
$this->currentObject->attach($this);
|
||||
|
||||
// Return requested entry
|
||||
return $this->currentObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of all cell addresses currently held in cache
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function getCellList()
|
||||
{
|
||||
if ($this->currentObjectID !== null) {
|
||||
$this->storeData();
|
||||
}
|
||||
|
||||
return parent::getCellList();
|
||||
}
|
||||
|
||||
/**
|
||||
* Clone the cell collection
|
||||
*
|
||||
* @param PHPExcel_Worksheet $parent The new worksheet
|
||||
* @return void
|
||||
*/
|
||||
public function copyCellCollection(PHPExcel_Worksheet $parent)
|
||||
{
|
||||
parent::copyCellCollection($parent);
|
||||
// Open a new stream for the cell cache data
|
||||
$newFileHandle = fopen('php://temp/maxmemory:' . $this->memoryCacheSize, 'a+');
|
||||
// Copy the existing cell cache data to the new stream
|
||||
fseek($this->fileHandle, 0);
|
||||
while (!feof($this->fileHandle)) {
|
||||
fwrite($newFileHandle, fread($this->fileHandle, 1024));
|
||||
}
|
||||
$this->fileHandle = $newFileHandle;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the cell collection and disconnect from our parent
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function unsetWorksheetCells()
|
||||
{
|
||||
if (!is_null($this->currentObject)) {
|
||||
$this->currentObject->detach();
|
||||
$this->currentObject = $this->currentObjectID = null;
|
||||
}
|
||||
$this->cellCache = array();
|
||||
|
||||
// detach ourself from the worksheet, so that it can then delete this object successfully
|
||||
$this->parent = null;
|
||||
|
||||
// Close down the php://temp file
|
||||
$this->__destruct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise this new cell collection
|
||||
*
|
||||
* @param PHPExcel_Worksheet $parent The worksheet for this cell collection
|
||||
* @param array of mixed $arguments Additional initialisation arguments
|
||||
*/
|
||||
public function __construct(PHPExcel_Worksheet $parent, $arguments)
|
||||
{
|
||||
$this->memoryCacheSize = (isset($arguments['memoryCacheSize'])) ? $arguments['memoryCacheSize'] : '1MB';
|
||||
|
||||
parent::__construct($parent);
|
||||
if (is_null($this->fileHandle)) {
|
||||
$this->fileHandle = fopen('php://temp/maxmemory:' . $this->memoryCacheSize, 'a+');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy this cell collection
|
||||
*/
|
||||
public function __destruct()
|
||||
{
|
||||
if (!is_null($this->fileHandle)) {
|
||||
fclose($this->fileHandle);
|
||||
}
|
||||
$this->fileHandle = null;
|
||||
}
|
||||
}
|
||||
307
Cron/PHPExcel/PHPExcel/CachedObjectStorage/SQLite.php
Executable file
307
Cron/PHPExcel/PHPExcel/CachedObjectStorage/SQLite.php
Executable file
@@ -0,0 +1,307 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PHPExcel_CachedObjectStorage_SQLite
|
||||
*
|
||||
* Copyright (c) 2006 - 2015 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_CachedObjectStorage
|
||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version ##VERSION##, ##DATE##
|
||||
*/
|
||||
class PHPExcel_CachedObjectStorage_SQLite extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache
|
||||
{
|
||||
/**
|
||||
* Database table name
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $TableName = null;
|
||||
|
||||
/**
|
||||
* Database handle
|
||||
*
|
||||
* @var resource
|
||||
*/
|
||||
private $DBHandle = null;
|
||||
|
||||
/**
|
||||
* Store cell data in cache for the current cell object if it's "dirty",
|
||||
* and the 'nullify' the current cell object
|
||||
*
|
||||
* @return void
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
protected function storeData()
|
||||
{
|
||||
if ($this->currentCellIsDirty && !empty($this->currentObjectID)) {
|
||||
$this->currentObject->detach();
|
||||
|
||||
if (!$this->DBHandle->queryExec("INSERT OR REPLACE INTO kvp_".$this->TableName." VALUES('".$this->currentObjectID."','".sqlite_escape_string(serialize($this->currentObject))."')")) {
|
||||
throw new PHPExcel_Exception(sqlite_error_string($this->DBHandle->lastError()));
|
||||
}
|
||||
$this->currentCellIsDirty = false;
|
||||
}
|
||||
$this->currentObjectID = $this->currentObject = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add or Update a cell in cache identified by coordinate address
|
||||
*
|
||||
* @param string $pCoord Coordinate address of the cell to update
|
||||
* @param PHPExcel_Cell $cell Cell to update
|
||||
* @return PHPExcel_Cell
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function addCacheData($pCoord, PHPExcel_Cell $cell)
|
||||
{
|
||||
if (($pCoord !== $this->currentObjectID) && ($this->currentObjectID !== null)) {
|
||||
$this->storeData();
|
||||
}
|
||||
|
||||
$this->currentObjectID = $pCoord;
|
||||
$this->currentObject = $cell;
|
||||
$this->currentCellIsDirty = true;
|
||||
|
||||
return $cell;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get cell at a specific coordinate
|
||||
*
|
||||
* @param string $pCoord Coordinate of the cell
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Cell Cell that was found, or null if not found
|
||||
*/
|
||||
public function getCacheData($pCoord)
|
||||
{
|
||||
if ($pCoord === $this->currentObjectID) {
|
||||
return $this->currentObject;
|
||||
}
|
||||
$this->storeData();
|
||||
|
||||
$query = "SELECT value FROM kvp_".$this->TableName." WHERE id='".$pCoord."'";
|
||||
$cellResultSet = $this->DBHandle->query($query, SQLITE_ASSOC);
|
||||
if ($cellResultSet === false) {
|
||||
throw new PHPExcel_Exception(sqlite_error_string($this->DBHandle->lastError()));
|
||||
} elseif ($cellResultSet->numRows() == 0) {
|
||||
// Return null if requested entry doesn't exist in cache
|
||||
return null;
|
||||
}
|
||||
|
||||
// Set current entry to the requested entry
|
||||
$this->currentObjectID = $pCoord;
|
||||
|
||||
$cellResult = $cellResultSet->fetchSingle();
|
||||
$this->currentObject = unserialize($cellResult);
|
||||
// Re-attach this as the cell's parent
|
||||
$this->currentObject->attach($this);
|
||||
|
||||
// Return requested entry
|
||||
return $this->currentObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is a value set for an indexed cell?
|
||||
*
|
||||
* @param string $pCoord Coordinate address of the cell to check
|
||||
* @return boolean
|
||||
*/
|
||||
public function isDataSet($pCoord)
|
||||
{
|
||||
if ($pCoord === $this->currentObjectID) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check if the requested entry exists in the cache
|
||||
$query = "SELECT id FROM kvp_".$this->TableName." WHERE id='".$pCoord."'";
|
||||
$cellResultSet = $this->DBHandle->query($query, SQLITE_ASSOC);
|
||||
if ($cellResultSet === false) {
|
||||
throw new PHPExcel_Exception(sqlite_error_string($this->DBHandle->lastError()));
|
||||
} elseif ($cellResultSet->numRows() == 0) {
|
||||
// Return null if requested entry doesn't exist in cache
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a cell in cache identified by coordinate address
|
||||
*
|
||||
* @param string $pCoord Coordinate address of the cell to delete
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function deleteCacheData($pCoord)
|
||||
{
|
||||
if ($pCoord === $this->currentObjectID) {
|
||||
$this->currentObject->detach();
|
||||
$this->currentObjectID = $this->currentObject = null;
|
||||
}
|
||||
|
||||
// Check if the requested entry exists in the cache
|
||||
$query = "DELETE FROM kvp_".$this->TableName." WHERE id='".$pCoord."'";
|
||||
if (!$this->DBHandle->queryExec($query)) {
|
||||
throw new PHPExcel_Exception(sqlite_error_string($this->DBHandle->lastError()));
|
||||
}
|
||||
|
||||
$this->currentCellIsDirty = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Move a cell object from one address to another
|
||||
*
|
||||
* @param string $fromAddress Current address of the cell to move
|
||||
* @param string $toAddress Destination address of the cell to move
|
||||
* @return boolean
|
||||
*/
|
||||
public function moveCell($fromAddress, $toAddress)
|
||||
{
|
||||
if ($fromAddress === $this->currentObjectID) {
|
||||
$this->currentObjectID = $toAddress;
|
||||
}
|
||||
|
||||
$query = "DELETE FROM kvp_".$this->TableName." WHERE id='".$toAddress."'";
|
||||
$result = $this->DBHandle->exec($query);
|
||||
if ($result === false) {
|
||||
throw new PHPExcel_Exception($this->DBHandle->lastErrorMsg());
|
||||
}
|
||||
|
||||
$query = "UPDATE kvp_".$this->TableName." SET id='".$toAddress."' WHERE id='".$fromAddress."'";
|
||||
$result = $this->DBHandle->exec($query);
|
||||
if ($result === false) {
|
||||
throw new PHPExcel_Exception($this->DBHandle->lastErrorMsg());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of all cell addresses currently held in cache
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function getCellList()
|
||||
{
|
||||
if ($this->currentObjectID !== null) {
|
||||
$this->storeData();
|
||||
}
|
||||
|
||||
$query = "SELECT id FROM kvp_".$this->TableName;
|
||||
$cellIdsResult = $this->DBHandle->unbufferedQuery($query, SQLITE_ASSOC);
|
||||
if ($cellIdsResult === false) {
|
||||
throw new PHPExcel_Exception(sqlite_error_string($this->DBHandle->lastError()));
|
||||
}
|
||||
|
||||
$cellKeys = array();
|
||||
foreach ($cellIdsResult as $row) {
|
||||
$cellKeys[] = $row['id'];
|
||||
}
|
||||
|
||||
return $cellKeys;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clone the cell collection
|
||||
*
|
||||
* @param PHPExcel_Worksheet $parent The new worksheet
|
||||
* @return void
|
||||
*/
|
||||
public function copyCellCollection(PHPExcel_Worksheet $parent)
|
||||
{
|
||||
$this->currentCellIsDirty;
|
||||
$this->storeData();
|
||||
|
||||
// Get a new id for the new table name
|
||||
$tableName = str_replace('.', '_', $this->getUniqueID());
|
||||
if (!$this->DBHandle->queryExec('CREATE TABLE kvp_'.$tableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB)
|
||||
AS SELECT * FROM kvp_'.$this->TableName)
|
||||
) {
|
||||
throw new PHPExcel_Exception(sqlite_error_string($this->DBHandle->lastError()));
|
||||
}
|
||||
|
||||
// Copy the existing cell cache file
|
||||
$this->TableName = $tableName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the cell collection and disconnect from our parent
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function unsetWorksheetCells()
|
||||
{
|
||||
if (!is_null($this->currentObject)) {
|
||||
$this->currentObject->detach();
|
||||
$this->currentObject = $this->currentObjectID = null;
|
||||
}
|
||||
// detach ourself from the worksheet, so that it can then delete this object successfully
|
||||
$this->parent = null;
|
||||
|
||||
// Close down the temporary cache file
|
||||
$this->__destruct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise this new cell collection
|
||||
*
|
||||
* @param PHPExcel_Worksheet $parent The worksheet for this cell collection
|
||||
*/
|
||||
public function __construct(PHPExcel_Worksheet $parent)
|
||||
{
|
||||
parent::__construct($parent);
|
||||
if (is_null($this->DBHandle)) {
|
||||
$this->TableName = str_replace('.', '_', $this->getUniqueID());
|
||||
$_DBName = ':memory:';
|
||||
|
||||
$this->DBHandle = new SQLiteDatabase($_DBName);
|
||||
if ($this->DBHandle === false) {
|
||||
throw new PHPExcel_Exception(sqlite_error_string($this->DBHandle->lastError()));
|
||||
}
|
||||
if (!$this->DBHandle->queryExec('CREATE TABLE kvp_'.$this->TableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB)')) {
|
||||
throw new PHPExcel_Exception(sqlite_error_string($this->DBHandle->lastError()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy this cell collection
|
||||
*/
|
||||
public function __destruct()
|
||||
{
|
||||
if (!is_null($this->DBHandle)) {
|
||||
$this->DBHandle->queryExec('DROP TABLE kvp_'.$this->TableName);
|
||||
}
|
||||
$this->DBHandle = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Identify whether the caching method is currently available
|
||||
* Some methods are dependent on the availability of certain extensions being enabled in the PHP build
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public static function cacheMethodIsAvailable()
|
||||
{
|
||||
if (!function_exists('sqlite_open')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
346
Cron/PHPExcel/PHPExcel/CachedObjectStorage/SQLite3.php
Executable file
346
Cron/PHPExcel/PHPExcel/CachedObjectStorage/SQLite3.php
Executable file
@@ -0,0 +1,346 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PHPExcel_CachedObjectStorage_SQLite3
|
||||
*
|
||||
* Copyright (c) 2006 - 2015 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_CachedObjectStorage
|
||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version ##VERSION##, ##DATE##
|
||||
*/
|
||||
class PHPExcel_CachedObjectStorage_SQLite3 extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache
|
||||
{
|
||||
/**
|
||||
* Database table name
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $TableName = null;
|
||||
|
||||
/**
|
||||
* Database handle
|
||||
*
|
||||
* @var resource
|
||||
*/
|
||||
private $DBHandle = null;
|
||||
|
||||
/**
|
||||
* Prepared statement for a SQLite3 select query
|
||||
*
|
||||
* @var SQLite3Stmt
|
||||
*/
|
||||
private $selectQuery;
|
||||
|
||||
/**
|
||||
* Prepared statement for a SQLite3 insert query
|
||||
*
|
||||
* @var SQLite3Stmt
|
||||
*/
|
||||
private $insertQuery;
|
||||
|
||||
/**
|
||||
* Prepared statement for a SQLite3 update query
|
||||
*
|
||||
* @var SQLite3Stmt
|
||||
*/
|
||||
private $updateQuery;
|
||||
|
||||
/**
|
||||
* Prepared statement for a SQLite3 delete query
|
||||
*
|
||||
* @var SQLite3Stmt
|
||||
*/
|
||||
private $deleteQuery;
|
||||
|
||||
/**
|
||||
* Store cell data in cache for the current cell object if it's "dirty",
|
||||
* and the 'nullify' the current cell object
|
||||
*
|
||||
* @return void
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
protected function storeData()
|
||||
{
|
||||
if ($this->currentCellIsDirty && !empty($this->currentObjectID)) {
|
||||
$this->currentObject->detach();
|
||||
|
||||
$this->insertQuery->bindValue('id', $this->currentObjectID, SQLITE3_TEXT);
|
||||
$this->insertQuery->bindValue('data', serialize($this->currentObject), SQLITE3_BLOB);
|
||||
$result = $this->insertQuery->execute();
|
||||
if ($result === false) {
|
||||
throw new PHPExcel_Exception($this->DBHandle->lastErrorMsg());
|
||||
}
|
||||
$this->currentCellIsDirty = false;
|
||||
}
|
||||
$this->currentObjectID = $this->currentObject = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add or Update a cell in cache identified by coordinate address
|
||||
*
|
||||
* @param string $pCoord Coordinate address of the cell to update
|
||||
* @param PHPExcel_Cell $cell Cell to update
|
||||
* @return PHPExcel_Cell
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function addCacheData($pCoord, PHPExcel_Cell $cell)
|
||||
{
|
||||
if (($pCoord !== $this->currentObjectID) && ($this->currentObjectID !== null)) {
|
||||
$this->storeData();
|
||||
}
|
||||
|
||||
$this->currentObjectID = $pCoord;
|
||||
$this->currentObject = $cell;
|
||||
$this->currentCellIsDirty = true;
|
||||
|
||||
return $cell;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get cell at a specific coordinate
|
||||
*
|
||||
* @param string $pCoord Coordinate of the cell
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Cell Cell that was found, or null if not found
|
||||
*/
|
||||
public function getCacheData($pCoord)
|
||||
{
|
||||
if ($pCoord === $this->currentObjectID) {
|
||||
return $this->currentObject;
|
||||
}
|
||||
$this->storeData();
|
||||
|
||||
$this->selectQuery->bindValue('id', $pCoord, SQLITE3_TEXT);
|
||||
$cellResult = $this->selectQuery->execute();
|
||||
if ($cellResult === false) {
|
||||
throw new PHPExcel_Exception($this->DBHandle->lastErrorMsg());
|
||||
}
|
||||
$cellData = $cellResult->fetchArray(SQLITE3_ASSOC);
|
||||
if ($cellData === false) {
|
||||
// Return null if requested entry doesn't exist in cache
|
||||
return null;
|
||||
}
|
||||
|
||||
// Set current entry to the requested entry
|
||||
$this->currentObjectID = $pCoord;
|
||||
|
||||
$this->currentObject = unserialize($cellData['value']);
|
||||
// Re-attach this as the cell's parent
|
||||
$this->currentObject->attach($this);
|
||||
|
||||
// Return requested entry
|
||||
return $this->currentObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is a value set for an indexed cell?
|
||||
*
|
||||
* @param string $pCoord Coordinate address of the cell to check
|
||||
* @return boolean
|
||||
*/
|
||||
public function isDataSet($pCoord)
|
||||
{
|
||||
if ($pCoord === $this->currentObjectID) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check if the requested entry exists in the cache
|
||||
$this->selectQuery->bindValue('id', $pCoord, SQLITE3_TEXT);
|
||||
$cellResult = $this->selectQuery->execute();
|
||||
if ($cellResult === false) {
|
||||
throw new PHPExcel_Exception($this->DBHandle->lastErrorMsg());
|
||||
}
|
||||
$cellData = $cellResult->fetchArray(SQLITE3_ASSOC);
|
||||
|
||||
return ($cellData === false) ? false : true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a cell in cache identified by coordinate address
|
||||
*
|
||||
* @param string $pCoord Coordinate address of the cell to delete
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function deleteCacheData($pCoord)
|
||||
{
|
||||
if ($pCoord === $this->currentObjectID) {
|
||||
$this->currentObject->detach();
|
||||
$this->currentObjectID = $this->currentObject = null;
|
||||
}
|
||||
|
||||
// Check if the requested entry exists in the cache
|
||||
$this->deleteQuery->bindValue('id', $pCoord, SQLITE3_TEXT);
|
||||
$result = $this->deleteQuery->execute();
|
||||
if ($result === false) {
|
||||
throw new PHPExcel_Exception($this->DBHandle->lastErrorMsg());
|
||||
}
|
||||
|
||||
$this->currentCellIsDirty = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Move a cell object from one address to another
|
||||
*
|
||||
* @param string $fromAddress Current address of the cell to move
|
||||
* @param string $toAddress Destination address of the cell to move
|
||||
* @return boolean
|
||||
*/
|
||||
public function moveCell($fromAddress, $toAddress)
|
||||
{
|
||||
if ($fromAddress === $this->currentObjectID) {
|
||||
$this->currentObjectID = $toAddress;
|
||||
}
|
||||
|
||||
$this->deleteQuery->bindValue('id', $toAddress, SQLITE3_TEXT);
|
||||
$result = $this->deleteQuery->execute();
|
||||
if ($result === false) {
|
||||
throw new PHPExcel_Exception($this->DBHandle->lastErrorMsg());
|
||||
}
|
||||
|
||||
$this->updateQuery->bindValue('toid', $toAddress, SQLITE3_TEXT);
|
||||
$this->updateQuery->bindValue('fromid', $fromAddress, SQLITE3_TEXT);
|
||||
$result = $this->updateQuery->execute();
|
||||
if ($result === false) {
|
||||
throw new PHPExcel_Exception($this->DBHandle->lastErrorMsg());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of all cell addresses currently held in cache
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function getCellList()
|
||||
{
|
||||
if ($this->currentObjectID !== null) {
|
||||
$this->storeData();
|
||||
}
|
||||
|
||||
$query = "SELECT id FROM kvp_".$this->TableName;
|
||||
$cellIdsResult = $this->DBHandle->query($query);
|
||||
if ($cellIdsResult === false) {
|
||||
throw new PHPExcel_Exception($this->DBHandle->lastErrorMsg());
|
||||
}
|
||||
|
||||
$cellKeys = array();
|
||||
while ($row = $cellIdsResult->fetchArray(SQLITE3_ASSOC)) {
|
||||
$cellKeys[] = $row['id'];
|
||||
}
|
||||
|
||||
return $cellKeys;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clone the cell collection
|
||||
*
|
||||
* @param PHPExcel_Worksheet $parent The new worksheet
|
||||
* @return void
|
||||
*/
|
||||
public function copyCellCollection(PHPExcel_Worksheet $parent)
|
||||
{
|
||||
$this->currentCellIsDirty;
|
||||
$this->storeData();
|
||||
|
||||
// Get a new id for the new table name
|
||||
$tableName = str_replace('.', '_', $this->getUniqueID());
|
||||
if (!$this->DBHandle->exec('CREATE TABLE kvp_'.$tableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB)
|
||||
AS SELECT * FROM kvp_'.$this->TableName)
|
||||
) {
|
||||
throw new PHPExcel_Exception($this->DBHandle->lastErrorMsg());
|
||||
}
|
||||
|
||||
// Copy the existing cell cache file
|
||||
$this->TableName = $tableName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the cell collection and disconnect from our parent
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function unsetWorksheetCells()
|
||||
{
|
||||
if (!is_null($this->currentObject)) {
|
||||
$this->currentObject->detach();
|
||||
$this->currentObject = $this->currentObjectID = null;
|
||||
}
|
||||
// detach ourself from the worksheet, so that it can then delete this object successfully
|
||||
$this->parent = null;
|
||||
|
||||
// Close down the temporary cache file
|
||||
$this->__destruct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise this new cell collection
|
||||
*
|
||||
* @param PHPExcel_Worksheet $parent The worksheet for this cell collection
|
||||
*/
|
||||
public function __construct(PHPExcel_Worksheet $parent)
|
||||
{
|
||||
parent::__construct($parent);
|
||||
if (is_null($this->DBHandle)) {
|
||||
$this->TableName = str_replace('.', '_', $this->getUniqueID());
|
||||
$_DBName = ':memory:';
|
||||
|
||||
$this->DBHandle = new SQLite3($_DBName);
|
||||
if ($this->DBHandle === false) {
|
||||
throw new PHPExcel_Exception($this->DBHandle->lastErrorMsg());
|
||||
}
|
||||
if (!$this->DBHandle->exec('CREATE TABLE kvp_'.$this->TableName.' (id VARCHAR(12) PRIMARY KEY, value BLOB)')) {
|
||||
throw new PHPExcel_Exception($this->DBHandle->lastErrorMsg());
|
||||
}
|
||||
}
|
||||
|
||||
$this->selectQuery = $this->DBHandle->prepare("SELECT value FROM kvp_".$this->TableName." WHERE id = :id");
|
||||
$this->insertQuery = $this->DBHandle->prepare("INSERT OR REPLACE INTO kvp_".$this->TableName." VALUES(:id,:data)");
|
||||
$this->updateQuery = $this->DBHandle->prepare("UPDATE kvp_".$this->TableName." SET id=:toId WHERE id=:fromId");
|
||||
$this->deleteQuery = $this->DBHandle->prepare("DELETE FROM kvp_".$this->TableName." WHERE id = :id");
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy this cell collection
|
||||
*/
|
||||
public function __destruct()
|
||||
{
|
||||
if (!is_null($this->DBHandle)) {
|
||||
$this->DBHandle->exec('DROP TABLE kvp_'.$this->TableName);
|
||||
$this->DBHandle->close();
|
||||
}
|
||||
$this->DBHandle = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Identify whether the caching method is currently available
|
||||
* Some methods are dependent on the availability of certain extensions being enabled in the PHP build
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public static function cacheMethodIsAvailable()
|
||||
{
|
||||
if (!class_exists('SQLite3', false)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
289
Cron/PHPExcel/PHPExcel/CachedObjectStorage/Wincache.php
Executable file
289
Cron/PHPExcel/PHPExcel/CachedObjectStorage/Wincache.php
Executable file
@@ -0,0 +1,289 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PHPExcel_CachedObjectStorage_Wincache
|
||||
*
|
||||
* Copyright (c) 2006 - 2015 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_CachedObjectStorage
|
||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version ##VERSION##, ##DATE##
|
||||
*/
|
||||
class PHPExcel_CachedObjectStorage_Wincache extends PHPExcel_CachedObjectStorage_CacheBase implements PHPExcel_CachedObjectStorage_ICache
|
||||
{
|
||||
/**
|
||||
* Prefix used to uniquely identify cache data for this worksheet
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $cachePrefix = null;
|
||||
|
||||
/**
|
||||
* Cache timeout
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
private $cacheTime = 600;
|
||||
|
||||
|
||||
/**
|
||||
* Store cell data in cache for the current cell object if it's "dirty",
|
||||
* and the 'nullify' the current cell object
|
||||
*
|
||||
* @return void
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
protected function storeData()
|
||||
{
|
||||
if ($this->currentCellIsDirty && !empty($this->currentObjectID)) {
|
||||
$this->currentObject->detach();
|
||||
|
||||
$obj = serialize($this->currentObject);
|
||||
if (wincache_ucache_exists($this->cachePrefix.$this->currentObjectID.'.cache')) {
|
||||
if (!wincache_ucache_set($this->cachePrefix.$this->currentObjectID.'.cache', $obj, $this->cacheTime)) {
|
||||
$this->__destruct();
|
||||
throw new PHPExcel_Exception('Failed to store cell '.$this->currentObjectID.' in WinCache');
|
||||
}
|
||||
} else {
|
||||
if (!wincache_ucache_add($this->cachePrefix.$this->currentObjectID.'.cache', $obj, $this->cacheTime)) {
|
||||
$this->__destruct();
|
||||
throw new PHPExcel_Exception('Failed to store cell '.$this->currentObjectID.' in WinCache');
|
||||
}
|
||||
}
|
||||
$this->currentCellIsDirty = false;
|
||||
}
|
||||
|
||||
$this->currentObjectID = $this->currentObject = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add or Update a cell in cache identified by coordinate address
|
||||
*
|
||||
* @param string $pCoord Coordinate address of the cell to update
|
||||
* @param PHPExcel_Cell $cell Cell to update
|
||||
* @return PHPExcel_Cell
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function addCacheData($pCoord, PHPExcel_Cell $cell)
|
||||
{
|
||||
if (($pCoord !== $this->currentObjectID) && ($this->currentObjectID !== null)) {
|
||||
$this->storeData();
|
||||
}
|
||||
$this->cellCache[$pCoord] = true;
|
||||
|
||||
$this->currentObjectID = $pCoord;
|
||||
$this->currentObject = $cell;
|
||||
$this->currentCellIsDirty = true;
|
||||
|
||||
return $cell;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is a value set in the current PHPExcel_CachedObjectStorage_ICache for an indexed cell?
|
||||
*
|
||||
* @param string $pCoord Coordinate address of the cell to check
|
||||
* @return boolean
|
||||
*/
|
||||
public function isDataSet($pCoord)
|
||||
{
|
||||
// Check if the requested entry is the current object, or exists in the cache
|
||||
if (parent::isDataSet($pCoord)) {
|
||||
if ($this->currentObjectID == $pCoord) {
|
||||
return true;
|
||||
}
|
||||
// Check if the requested entry still exists in cache
|
||||
$success = wincache_ucache_exists($this->cachePrefix.$pCoord.'.cache');
|
||||
if ($success === false) {
|
||||
// Entry no longer exists in Wincache, so clear it from the cache array
|
||||
parent::deleteCacheData($pCoord);
|
||||
throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in WinCache');
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get cell at a specific coordinate
|
||||
*
|
||||
* @param string $pCoord Coordinate of the cell
|
||||
* @throws PHPExcel_Exception
|
||||
* @return PHPExcel_Cell Cell that was found, or null if not found
|
||||
*/
|
||||
public function getCacheData($pCoord)
|
||||
{
|
||||
if ($pCoord === $this->currentObjectID) {
|
||||
return $this->currentObject;
|
||||
}
|
||||
$this->storeData();
|
||||
|
||||
// Check if the entry that has been requested actually exists
|
||||
$obj = null;
|
||||
if (parent::isDataSet($pCoord)) {
|
||||
$success = false;
|
||||
$obj = wincache_ucache_get($this->cachePrefix.$pCoord.'.cache', $success);
|
||||
if ($success === false) {
|
||||
// Entry no longer exists in WinCache, so clear it from the cache array
|
||||
parent::deleteCacheData($pCoord);
|
||||
throw new PHPExcel_Exception('Cell entry '.$pCoord.' no longer exists in WinCache');
|
||||
}
|
||||
} else {
|
||||
// Return null if requested entry doesn't exist in cache
|
||||
return null;
|
||||
}
|
||||
|
||||
// Set current entry to the requested entry
|
||||
$this->currentObjectID = $pCoord;
|
||||
$this->currentObject = unserialize($obj);
|
||||
// Re-attach this as the cell's parent
|
||||
$this->currentObject->attach($this);
|
||||
|
||||
// Return requested entry
|
||||
return $this->currentObject;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get a list of all cell addresses currently held in cache
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function getCellList()
|
||||
{
|
||||
if ($this->currentObjectID !== null) {
|
||||
$this->storeData();
|
||||
}
|
||||
|
||||
return parent::getCellList();
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a cell in cache identified by coordinate address
|
||||
*
|
||||
* @param string $pCoord Coordinate address of the cell to delete
|
||||
* @throws PHPExcel_Exception
|
||||
*/
|
||||
public function deleteCacheData($pCoord)
|
||||
{
|
||||
// Delete the entry from Wincache
|
||||
wincache_ucache_delete($this->cachePrefix.$pCoord.'.cache');
|
||||
|
||||
// Delete the entry from our cell address array
|
||||
parent::deleteCacheData($pCoord);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clone the cell collection
|
||||
*
|
||||
* @param PHPExcel_Worksheet $parent The new worksheet
|
||||
* @return void
|
||||
*/
|
||||
public function copyCellCollection(PHPExcel_Worksheet $parent)
|
||||
{
|
||||
parent::copyCellCollection($parent);
|
||||
// Get a new id for the new file name
|
||||
$baseUnique = $this->getUniqueID();
|
||||
$newCachePrefix = substr(md5($baseUnique), 0, 8) . '.';
|
||||
$cacheList = $this->getCellList();
|
||||
foreach ($cacheList as $cellID) {
|
||||
if ($cellID != $this->currentObjectID) {
|
||||
$success = false;
|
||||
$obj = wincache_ucache_get($this->cachePrefix.$cellID.'.cache', $success);
|
||||
if ($success === false) {
|
||||
// Entry no longer exists in WinCache, so clear it from the cache array
|
||||
parent::deleteCacheData($cellID);
|
||||
throw new PHPExcel_Exception('Cell entry '.$cellID.' no longer exists in Wincache');
|
||||
}
|
||||
if (!wincache_ucache_add($newCachePrefix.$cellID.'.cache', $obj, $this->cacheTime)) {
|
||||
$this->__destruct();
|
||||
throw new PHPExcel_Exception('Failed to store cell '.$cellID.' in Wincache');
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->cachePrefix = $newCachePrefix;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Clear the cell collection and disconnect from our parent
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function unsetWorksheetCells()
|
||||
{
|
||||
if (!is_null($this->currentObject)) {
|
||||
$this->currentObject->detach();
|
||||
$this->currentObject = $this->currentObjectID = null;
|
||||
}
|
||||
|
||||
// Flush the WinCache cache
|
||||
$this->__destruct();
|
||||
|
||||
$this->cellCache = array();
|
||||
|
||||
// detach ourself from the worksheet, so that it can then delete this object successfully
|
||||
$this->parent = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise this new cell collection
|
||||
*
|
||||
* @param PHPExcel_Worksheet $parent The worksheet for this cell collection
|
||||
* @param array of mixed $arguments Additional initialisation arguments
|
||||
*/
|
||||
public function __construct(PHPExcel_Worksheet $parent, $arguments)
|
||||
{
|
||||
$cacheTime = (isset($arguments['cacheTime'])) ? $arguments['cacheTime'] : 600;
|
||||
|
||||
if (is_null($this->cachePrefix)) {
|
||||
$baseUnique = $this->getUniqueID();
|
||||
$this->cachePrefix = substr(md5($baseUnique), 0, 8).'.';
|
||||
$this->cacheTime = $cacheTime;
|
||||
|
||||
parent::__construct($parent);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy this cell collection
|
||||
*/
|
||||
public function __destruct()
|
||||
{
|
||||
$cacheList = $this->getCellList();
|
||||
foreach ($cacheList as $cellID) {
|
||||
wincache_ucache_delete($this->cachePrefix.$cellID.'.cache');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Identify whether the caching method is currently available
|
||||
* Some methods are dependent on the availability of certain extensions being enabled in the PHP build
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public static function cacheMethodIsAvailable()
|
||||
{
|
||||
if (!function_exists('wincache_ucache_add')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
231
Cron/PHPExcel/PHPExcel/CachedObjectStorageFactory.php
Executable file
231
Cron/PHPExcel/PHPExcel/CachedObjectStorageFactory.php
Executable file
@@ -0,0 +1,231 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PHPExcel_CachedObjectStorageFactory
|
||||
*
|
||||
* Copyright (c) 2006 - 2015 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_CachedObjectStorage
|
||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version ##VERSION##, ##DATE##
|
||||
*/
|
||||
class PHPExcel_CachedObjectStorageFactory
|
||||
{
|
||||
const cache_in_memory = 'Memory';
|
||||
const cache_in_memory_gzip = 'MemoryGZip';
|
||||
const cache_in_memory_serialized = 'MemorySerialized';
|
||||
const cache_igbinary = 'Igbinary';
|
||||
const cache_to_discISAM = 'DiscISAM';
|
||||
const cache_to_apc = 'APC';
|
||||
const cache_to_memcache = 'Memcache';
|
||||
const cache_to_phpTemp = 'PHPTemp';
|
||||
const cache_to_wincache = 'Wincache';
|
||||
const cache_to_sqlite = 'SQLite';
|
||||
const cache_to_sqlite3 = 'SQLite3';
|
||||
|
||||
/**
|
||||
* Name of the method used for cell cacheing
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private static $cacheStorageMethod = null;
|
||||
|
||||
/**
|
||||
* Name of the class used for cell cacheing
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private static $cacheStorageClass = null;
|
||||
|
||||
/**
|
||||
* List of all possible cache storage methods
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
private static $storageMethods = array(
|
||||
self::cache_in_memory,
|
||||
self::cache_in_memory_gzip,
|
||||
self::cache_in_memory_serialized,
|
||||
self::cache_igbinary,
|
||||
self::cache_to_phpTemp,
|
||||
self::cache_to_discISAM,
|
||||
self::cache_to_apc,
|
||||
self::cache_to_memcache,
|
||||
self::cache_to_wincache,
|
||||
self::cache_to_sqlite,
|
||||
self::cache_to_sqlite3,
|
||||
);
|
||||
|
||||
/**
|
||||
* Default arguments for each cache storage method
|
||||
*
|
||||
* @var array of mixed array
|
||||
*/
|
||||
private static $storageMethodDefaultParameters = array(
|
||||
self::cache_in_memory => array(
|
||||
),
|
||||
self::cache_in_memory_gzip => array(
|
||||
),
|
||||
self::cache_in_memory_serialized => array(
|
||||
),
|
||||
self::cache_igbinary => array(
|
||||
),
|
||||
self::cache_to_phpTemp => array( 'memoryCacheSize' => '1MB'
|
||||
),
|
||||
self::cache_to_discISAM => array( 'dir' => null
|
||||
),
|
||||
self::cache_to_apc => array( 'cacheTime' => 600
|
||||
),
|
||||
self::cache_to_memcache => array( 'memcacheServer' => 'localhost',
|
||||
'memcachePort' => 11211,
|
||||
'cacheTime' => 600
|
||||
),
|
||||
self::cache_to_wincache => array( 'cacheTime' => 600
|
||||
),
|
||||
self::cache_to_sqlite => array(
|
||||
),
|
||||
self::cache_to_sqlite3 => array(
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
* Arguments for the active cache storage method
|
||||
*
|
||||
* @var array of mixed array
|
||||
*/
|
||||
private static $storageMethodParameters = array();
|
||||
|
||||
/**
|
||||
* Return the current cache storage method
|
||||
*
|
||||
* @return string|null
|
||||
**/
|
||||
public static function getCacheStorageMethod()
|
||||
{
|
||||
return self::$cacheStorageMethod;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the current cache storage class
|
||||
*
|
||||
* @return PHPExcel_CachedObjectStorage_ICache|null
|
||||
**/
|
||||
public static function getCacheStorageClass()
|
||||
{
|
||||
return self::$cacheStorageClass;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the list of all possible cache storage methods
|
||||
*
|
||||
* @return string[]
|
||||
**/
|
||||
public static function getAllCacheStorageMethods()
|
||||
{
|
||||
return self::$storageMethods;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the list of all available cache storage methods
|
||||
*
|
||||
* @return string[]
|
||||
**/
|
||||
public static function getCacheStorageMethods()
|
||||
{
|
||||
$activeMethods = array();
|
||||
foreach (self::$storageMethods as $storageMethod) {
|
||||
$cacheStorageClass = 'PHPExcel_CachedObjectStorage_' . $storageMethod;
|
||||
if (call_user_func(array($cacheStorageClass, 'cacheMethodIsAvailable'))) {
|
||||
$activeMethods[] = $storageMethod;
|
||||
}
|
||||
}
|
||||
return $activeMethods;
|
||||
}
|
||||
|
||||
/**
|
||||
* Identify the cache storage method to use
|
||||
*
|
||||
* @param string $method Name of the method to use for cell cacheing
|
||||
* @param array of mixed $arguments Additional arguments to pass to the cell caching class
|
||||
* when instantiating
|
||||
* @return boolean
|
||||
**/
|
||||
public static function initialize($method = self::cache_in_memory, $arguments = array())
|
||||
{
|
||||
if (!in_array($method, self::$storageMethods)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$cacheStorageClass = 'PHPExcel_CachedObjectStorage_'.$method;
|
||||
if (!call_user_func(array( $cacheStorageClass,
|
||||
'cacheMethodIsAvailable'))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
self::$storageMethodParameters[$method] = self::$storageMethodDefaultParameters[$method];
|
||||
foreach ($arguments as $k => $v) {
|
||||
if (array_key_exists($k, self::$storageMethodParameters[$method])) {
|
||||
self::$storageMethodParameters[$method][$k] = $v;
|
||||
}
|
||||
}
|
||||
|
||||
if (self::$cacheStorageMethod === null) {
|
||||
self::$cacheStorageClass = 'PHPExcel_CachedObjectStorage_' . $method;
|
||||
self::$cacheStorageMethod = $method;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialise the cache storage
|
||||
*
|
||||
* @param PHPExcel_Worksheet $parent Enable cell caching for this worksheet
|
||||
* @return PHPExcel_CachedObjectStorage_ICache
|
||||
**/
|
||||
public static function getInstance(PHPExcel_Worksheet $parent)
|
||||
{
|
||||
$cacheMethodIsAvailable = true;
|
||||
if (self::$cacheStorageMethod === null) {
|
||||
$cacheMethodIsAvailable = self::initialize();
|
||||
}
|
||||
|
||||
if ($cacheMethodIsAvailable) {
|
||||
$instance = new self::$cacheStorageClass(
|
||||
$parent,
|
||||
self::$storageMethodParameters[self::$cacheStorageMethod]
|
||||
);
|
||||
if ($instance !== null) {
|
||||
return $instance;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the cache storage
|
||||
*
|
||||
**/
|
||||
public static function finalize()
|
||||
{
|
||||
self::$cacheStorageMethod = null;
|
||||
self::$cacheStorageClass = null;
|
||||
self::$storageMethodParameters = array();
|
||||
}
|
||||
}
|
||||
94
Cron/PHPExcel/PHPExcel/CalcEngine/CyclicReferenceStack.php
Executable file
94
Cron/PHPExcel/PHPExcel/CalcEngine/CyclicReferenceStack.php
Executable file
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PHPExcel_CalcEngine_CyclicReferenceStack
|
||||
*
|
||||
* Copyright (c) 2006 - 2015 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Calculation
|
||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version ##VERSION##, ##DATE##
|
||||
*/
|
||||
class PHPExcel_CalcEngine_CyclicReferenceStack
|
||||
{
|
||||
/**
|
||||
* The call stack for calculated cells
|
||||
*
|
||||
* @var mixed[]
|
||||
*/
|
||||
private $stack = array();
|
||||
|
||||
/**
|
||||
* Return the number of entries on the stack
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function count()
|
||||
{
|
||||
return count($this->stack);
|
||||
}
|
||||
|
||||
/**
|
||||
* Push a new entry onto the stack
|
||||
*
|
||||
* @param mixed $value
|
||||
*/
|
||||
public function push($value)
|
||||
{
|
||||
$this->stack[$value] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Pop the last entry from the stack
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function pop()
|
||||
{
|
||||
return array_pop($this->stack);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test to see if a specified entry exists on the stack
|
||||
*
|
||||
* @param mixed $value The value to test
|
||||
*/
|
||||
public function onStack($value)
|
||||
{
|
||||
return isset($this->stack[$value]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the stack
|
||||
*/
|
||||
public function clear()
|
||||
{
|
||||
$this->stack = array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an array of all entries on the stack
|
||||
*
|
||||
* @return mixed[]
|
||||
*/
|
||||
public function showStack()
|
||||
{
|
||||
return $this->stack;
|
||||
}
|
||||
}
|
||||
151
Cron/PHPExcel/PHPExcel/CalcEngine/Logger.php
Executable file
151
Cron/PHPExcel/PHPExcel/CalcEngine/Logger.php
Executable file
@@ -0,0 +1,151 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PHPExcel_CalcEngine_Logger
|
||||
*
|
||||
* Copyright (c) 2006 - 2015 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Calculation
|
||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version ##VERSION##, ##DATE##
|
||||
*/
|
||||
class PHPExcel_CalcEngine_Logger
|
||||
{
|
||||
/**
|
||||
* Flag to determine whether a debug log should be generated by the calculation engine
|
||||
* If true, then a debug log will be generated
|
||||
* If false, then a debug log will not be generated
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $writeDebugLog = false;
|
||||
|
||||
/**
|
||||
* Flag to determine whether a debug log should be echoed by the calculation engine
|
||||
* If true, then a debug log will be echoed
|
||||
* If false, then a debug log will not be echoed
|
||||
* A debug log can only be echoed if it is generated
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $echoDebugLog = false;
|
||||
|
||||
/**
|
||||
* The debug log generated by the calculation engine
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
private $debugLog = array();
|
||||
|
||||
/**
|
||||
* The calculation engine cell reference stack
|
||||
*
|
||||
* @var PHPExcel_CalcEngine_CyclicReferenceStack
|
||||
*/
|
||||
private $cellStack;
|
||||
|
||||
/**
|
||||
* Instantiate a Calculation engine logger
|
||||
*
|
||||
* @param PHPExcel_CalcEngine_CyclicReferenceStack $stack
|
||||
*/
|
||||
public function __construct(PHPExcel_CalcEngine_CyclicReferenceStack $stack)
|
||||
{
|
||||
$this->cellStack = $stack;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable/Disable Calculation engine logging
|
||||
*
|
||||
* @param boolean $pValue
|
||||
*/
|
||||
public function setWriteDebugLog($pValue = false)
|
||||
{
|
||||
$this->writeDebugLog = $pValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return whether calculation engine logging is enabled or disabled
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getWriteDebugLog()
|
||||
{
|
||||
return $this->writeDebugLog;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable/Disable echoing of debug log information
|
||||
*
|
||||
* @param boolean $pValue
|
||||
*/
|
||||
public function setEchoDebugLog($pValue = false)
|
||||
{
|
||||
$this->echoDebugLog = $pValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return whether echoing of debug log information is enabled or disabled
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getEchoDebugLog()
|
||||
{
|
||||
return $this->echoDebugLog;
|
||||
}
|
||||
|
||||
/**
|
||||
* Write an entry to the calculation engine debug log
|
||||
*/
|
||||
public function writeDebugLog()
|
||||
{
|
||||
// Only write the debug log if logging is enabled
|
||||
if ($this->writeDebugLog) {
|
||||
$message = implode(func_get_args());
|
||||
$cellReference = implode(' -> ', $this->cellStack->showStack());
|
||||
if ($this->echoDebugLog) {
|
||||
echo $cellReference,
|
||||
($this->cellStack->count() > 0 ? ' => ' : ''),
|
||||
$message,
|
||||
PHP_EOL;
|
||||
}
|
||||
$this->debugLog[] = $cellReference .
|
||||
($this->cellStack->count() > 0 ? ' => ' : '') .
|
||||
$message;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the calculation engine debug log
|
||||
*/
|
||||
public function clearLog()
|
||||
{
|
||||
$this->debugLog = array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the calculation engine debug log
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function getLog()
|
||||
{
|
||||
return $this->debugLog;
|
||||
}
|
||||
}
|
||||
4391
Cron/PHPExcel/PHPExcel/Calculation.php
Executable file
4391
Cron/PHPExcel/PHPExcel/Calculation.php
Executable file
File diff suppressed because it is too large
Load Diff
676
Cron/PHPExcel/PHPExcel/Calculation/Database.php
Executable file
676
Cron/PHPExcel/PHPExcel/Calculation/Database.php
Executable file
@@ -0,0 +1,676 @@
|
||||
<?php
|
||||
|
||||
/** PHPExcel root directory */
|
||||
if (!defined('PHPEXCEL_ROOT')) {
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
|
||||
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
}
|
||||
|
||||
/**
|
||||
* PHPExcel_Calculation_Database
|
||||
*
|
||||
* Copyright (c) 2006 - 2015 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Calculation
|
||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version ##VERSION##, ##DATE##
|
||||
*/
|
||||
class PHPExcel_Calculation_Database
|
||||
{
|
||||
/**
|
||||
* fieldExtract
|
||||
*
|
||||
* Extracts the column ID to use for the data field.
|
||||
*
|
||||
* @access private
|
||||
* @param mixed[] $database The range of cells that makes up the list or database.
|
||||
* A database is a list of related data in which rows of related
|
||||
* information are records, and columns of data are fields. The
|
||||
* first row of the list contains labels for each column.
|
||||
* @param mixed $field Indicates which column is used in the function. Enter the
|
||||
* column label enclosed between double quotation marks, such as
|
||||
* "Age" or "Yield," or a number (without quotation marks) that
|
||||
* represents the position of the column within the list: 1 for
|
||||
* the first column, 2 for the second column, and so on.
|
||||
* @return string|NULL
|
||||
*
|
||||
*/
|
||||
private static function fieldExtract($database, $field)
|
||||
{
|
||||
$field = strtoupper(PHPExcel_Calculation_Functions::flattenSingleValue($field));
|
||||
$fieldNames = array_map('strtoupper', array_shift($database));
|
||||
|
||||
if (is_numeric($field)) {
|
||||
$keys = array_keys($fieldNames);
|
||||
return $keys[$field-1];
|
||||
}
|
||||
$key = array_search($field, $fieldNames);
|
||||
return ($key) ? $key : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* filter
|
||||
*
|
||||
* Parses the selection criteria, extracts the database rows that match those criteria, and
|
||||
* returns that subset of rows.
|
||||
*
|
||||
* @access private
|
||||
* @param mixed[] $database The range of cells that makes up the list or database.
|
||||
* A database is a list of related data in which rows of related
|
||||
* information are records, and columns of data are fields. The
|
||||
* first row of the list contains labels for each column.
|
||||
* @param mixed[] $criteria The range of cells that contains the conditions you specify.
|
||||
* You can use any range for the criteria argument, as long as it
|
||||
* includes at least one column label and at least one cell below
|
||||
* the column label in which you specify a condition for the
|
||||
* column.
|
||||
* @return array of mixed
|
||||
*
|
||||
*/
|
||||
private static function filter($database, $criteria)
|
||||
{
|
||||
$fieldNames = array_shift($database);
|
||||
$criteriaNames = array_shift($criteria);
|
||||
|
||||
// Convert the criteria into a set of AND/OR conditions with [:placeholders]
|
||||
$testConditions = $testValues = array();
|
||||
$testConditionsCount = 0;
|
||||
foreach ($criteriaNames as $key => $criteriaName) {
|
||||
$testCondition = array();
|
||||
$testConditionCount = 0;
|
||||
foreach ($criteria as $row => $criterion) {
|
||||
if ($criterion[$key] > '') {
|
||||
$testCondition[] = '[:'.$criteriaName.']'.PHPExcel_Calculation_Functions::ifCondition($criterion[$key]);
|
||||
$testConditionCount++;
|
||||
}
|
||||
}
|
||||
if ($testConditionCount > 1) {
|
||||
$testConditions[] = 'OR(' . implode(',', $testCondition) . ')';
|
||||
$testConditionsCount++;
|
||||
} elseif ($testConditionCount == 1) {
|
||||
$testConditions[] = $testCondition[0];
|
||||
$testConditionsCount++;
|
||||
}
|
||||
}
|
||||
|
||||
if ($testConditionsCount > 1) {
|
||||
$testConditionSet = 'AND(' . implode(',', $testConditions) . ')';
|
||||
} elseif ($testConditionsCount == 1) {
|
||||
$testConditionSet = $testConditions[0];
|
||||
}
|
||||
|
||||
// Loop through each row of the database
|
||||
foreach ($database as $dataRow => $dataValues) {
|
||||
// Substitute actual values from the database row for our [:placeholders]
|
||||
$testConditionList = $testConditionSet;
|
||||
foreach ($criteriaNames as $key => $criteriaName) {
|
||||
$k = array_search($criteriaName, $fieldNames);
|
||||
if (isset($dataValues[$k])) {
|
||||
$dataValue = $dataValues[$k];
|
||||
$dataValue = (is_string($dataValue)) ? PHPExcel_Calculation::wrapResult(strtoupper($dataValue)) : $dataValue;
|
||||
$testConditionList = str_replace('[:' . $criteriaName . ']', $dataValue, $testConditionList);
|
||||
}
|
||||
}
|
||||
// evaluate the criteria against the row data
|
||||
$result = PHPExcel_Calculation::getInstance()->_calculateFormulaValue('='.$testConditionList);
|
||||
// If the row failed to meet the criteria, remove it from the database
|
||||
if (!$result) {
|
||||
unset($database[$dataRow]);
|
||||
}
|
||||
}
|
||||
|
||||
return $database;
|
||||
}
|
||||
|
||||
|
||||
private static function getFilteredColumn($database, $field, $criteria)
|
||||
{
|
||||
// reduce the database to a set of rows that match all the criteria
|
||||
$database = self::filter($database, $criteria);
|
||||
// extract an array of values for the requested column
|
||||
$colData = array();
|
||||
foreach ($database as $row) {
|
||||
$colData[] = $row[$field];
|
||||
}
|
||||
|
||||
return $colData;
|
||||
}
|
||||
|
||||
/**
|
||||
* DAVERAGE
|
||||
*
|
||||
* Averages the values in a column of a list or database that match conditions you specify.
|
||||
*
|
||||
* Excel Function:
|
||||
* DAVERAGE(database,field,criteria)
|
||||
*
|
||||
* @access public
|
||||
* @category Database Functions
|
||||
* @param mixed[] $database The range of cells that makes up the list or database.
|
||||
* A database is a list of related data in which rows of related
|
||||
* information are records, and columns of data are fields. The
|
||||
* first row of the list contains labels for each column.
|
||||
* @param string|integer $field Indicates which column is used in the function. Enter the
|
||||
* column label enclosed between double quotation marks, such as
|
||||
* "Age" or "Yield," or a number (without quotation marks) that
|
||||
* represents the position of the column within the list: 1 for
|
||||
* the first column, 2 for the second column, and so on.
|
||||
* @param mixed[] $criteria The range of cells that contains the conditions you specify.
|
||||
* You can use any range for the criteria argument, as long as it
|
||||
* includes at least one column label and at least one cell below
|
||||
* the column label in which you specify a condition for the
|
||||
* column.
|
||||
* @return float
|
||||
*
|
||||
*/
|
||||
public static function DAVERAGE($database, $field, $criteria)
|
||||
{
|
||||
$field = self::fieldExtract($database, $field);
|
||||
if (is_null($field)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Return
|
||||
return PHPExcel_Calculation_Statistical::AVERAGE(
|
||||
self::getFilteredColumn($database, $field, $criteria)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* DCOUNT
|
||||
*
|
||||
* Counts the cells that contain numbers in a column of a list or database that match conditions
|
||||
* that you specify.
|
||||
*
|
||||
* Excel Function:
|
||||
* DCOUNT(database,[field],criteria)
|
||||
*
|
||||
* Excel Function:
|
||||
* DAVERAGE(database,field,criteria)
|
||||
*
|
||||
* @access public
|
||||
* @category Database Functions
|
||||
* @param mixed[] $database The range of cells that makes up the list or database.
|
||||
* A database is a list of related data in which rows of related
|
||||
* information are records, and columns of data are fields. The
|
||||
* first row of the list contains labels for each column.
|
||||
* @param string|integer $field Indicates which column is used in the function. Enter the
|
||||
* column label enclosed between double quotation marks, such as
|
||||
* "Age" or "Yield," or a number (without quotation marks) that
|
||||
* represents the position of the column within the list: 1 for
|
||||
* the first column, 2 for the second column, and so on.
|
||||
* @param mixed[] $criteria The range of cells that contains the conditions you specify.
|
||||
* You can use any range for the criteria argument, as long as it
|
||||
* includes at least one column label and at least one cell below
|
||||
* the column label in which you specify a condition for the
|
||||
* column.
|
||||
* @return integer
|
||||
*
|
||||
* @TODO The field argument is optional. If field is omitted, DCOUNT counts all records in the
|
||||
* database that match the criteria.
|
||||
*
|
||||
*/
|
||||
public static function DCOUNT($database, $field, $criteria)
|
||||
{
|
||||
$field = self::fieldExtract($database, $field);
|
||||
if (is_null($field)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Return
|
||||
return PHPExcel_Calculation_Statistical::COUNT(
|
||||
self::getFilteredColumn($database, $field, $criteria)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* DCOUNTA
|
||||
*
|
||||
* Counts the nonblank cells in a column of a list or database that match conditions that you specify.
|
||||
*
|
||||
* Excel Function:
|
||||
* DCOUNTA(database,[field],criteria)
|
||||
*
|
||||
* @access public
|
||||
* @category Database Functions
|
||||
* @param mixed[] $database The range of cells that makes up the list or database.
|
||||
* A database is a list of related data in which rows of related
|
||||
* information are records, and columns of data are fields. The
|
||||
* first row of the list contains labels for each column.
|
||||
* @param string|integer $field Indicates which column is used in the function. Enter the
|
||||
* column label enclosed between double quotation marks, such as
|
||||
* "Age" or "Yield," or a number (without quotation marks) that
|
||||
* represents the position of the column within the list: 1 for
|
||||
* the first column, 2 for the second column, and so on.
|
||||
* @param mixed[] $criteria The range of cells that contains the conditions you specify.
|
||||
* You can use any range for the criteria argument, as long as it
|
||||
* includes at least one column label and at least one cell below
|
||||
* the column label in which you specify a condition for the
|
||||
* column.
|
||||
* @return integer
|
||||
*
|
||||
* @TODO The field argument is optional. If field is omitted, DCOUNTA counts all records in the
|
||||
* database that match the criteria.
|
||||
*
|
||||
*/
|
||||
public static function DCOUNTA($database, $field, $criteria)
|
||||
{
|
||||
$field = self::fieldExtract($database, $field);
|
||||
if (is_null($field)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// reduce the database to a set of rows that match all the criteria
|
||||
$database = self::filter($database, $criteria);
|
||||
// extract an array of values for the requested column
|
||||
$colData = array();
|
||||
foreach ($database as $row) {
|
||||
$colData[] = $row[$field];
|
||||
}
|
||||
|
||||
// Return
|
||||
return PHPExcel_Calculation_Statistical::COUNTA(
|
||||
self::getFilteredColumn($database, $field, $criteria)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* DGET
|
||||
*
|
||||
* Extracts a single value from a column of a list or database that matches conditions that you
|
||||
* specify.
|
||||
*
|
||||
* Excel Function:
|
||||
* DGET(database,field,criteria)
|
||||
*
|
||||
* @access public
|
||||
* @category Database Functions
|
||||
* @param mixed[] $database The range of cells that makes up the list or database.
|
||||
* A database is a list of related data in which rows of related
|
||||
* information are records, and columns of data are fields. The
|
||||
* first row of the list contains labels for each column.
|
||||
* @param string|integer $field Indicates which column is used in the function. Enter the
|
||||
* column label enclosed between double quotation marks, such as
|
||||
* "Age" or "Yield," or a number (without quotation marks) that
|
||||
* represents the position of the column within the list: 1 for
|
||||
* the first column, 2 for the second column, and so on.
|
||||
* @param mixed[] $criteria The range of cells that contains the conditions you specify.
|
||||
* You can use any range for the criteria argument, as long as it
|
||||
* includes at least one column label and at least one cell below
|
||||
* the column label in which you specify a condition for the
|
||||
* column.
|
||||
* @return mixed
|
||||
*
|
||||
*/
|
||||
public static function DGET($database, $field, $criteria)
|
||||
{
|
||||
$field = self::fieldExtract($database, $field);
|
||||
if (is_null($field)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Return
|
||||
$colData = self::getFilteredColumn($database, $field, $criteria);
|
||||
if (count($colData) > 1) {
|
||||
return PHPExcel_Calculation_Functions::NaN();
|
||||
}
|
||||
|
||||
return $colData[0];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* DMAX
|
||||
*
|
||||
* Returns the largest number in a column of a list or database that matches conditions you that
|
||||
* specify.
|
||||
*
|
||||
* Excel Function:
|
||||
* DMAX(database,field,criteria)
|
||||
*
|
||||
* @access public
|
||||
* @category Database Functions
|
||||
* @param mixed[] $database The range of cells that makes up the list or database.
|
||||
* A database is a list of related data in which rows of related
|
||||
* information are records, and columns of data are fields. The
|
||||
* first row of the list contains labels for each column.
|
||||
* @param string|integer $field Indicates which column is used in the function. Enter the
|
||||
* column label enclosed between double quotation marks, such as
|
||||
* "Age" or "Yield," or a number (without quotation marks) that
|
||||
* represents the position of the column within the list: 1 for
|
||||
* the first column, 2 for the second column, and so on.
|
||||
* @param mixed[] $criteria The range of cells that contains the conditions you specify.
|
||||
* You can use any range for the criteria argument, as long as it
|
||||
* includes at least one column label and at least one cell below
|
||||
* the column label in which you specify a condition for the
|
||||
* column.
|
||||
* @return float
|
||||
*
|
||||
*/
|
||||
public static function DMAX($database, $field, $criteria)
|
||||
{
|
||||
$field = self::fieldExtract($database, $field);
|
||||
if (is_null($field)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Return
|
||||
return PHPExcel_Calculation_Statistical::MAX(
|
||||
self::getFilteredColumn($database, $field, $criteria)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* DMIN
|
||||
*
|
||||
* Returns the smallest number in a column of a list or database that matches conditions you that
|
||||
* specify.
|
||||
*
|
||||
* Excel Function:
|
||||
* DMIN(database,field,criteria)
|
||||
*
|
||||
* @access public
|
||||
* @category Database Functions
|
||||
* @param mixed[] $database The range of cells that makes up the list or database.
|
||||
* A database is a list of related data in which rows of related
|
||||
* information are records, and columns of data are fields. The
|
||||
* first row of the list contains labels for each column.
|
||||
* @param string|integer $field Indicates which column is used in the function. Enter the
|
||||
* column label enclosed between double quotation marks, such as
|
||||
* "Age" or "Yield," or a number (without quotation marks) that
|
||||
* represents the position of the column within the list: 1 for
|
||||
* the first column, 2 for the second column, and so on.
|
||||
* @param mixed[] $criteria The range of cells that contains the conditions you specify.
|
||||
* You can use any range for the criteria argument, as long as it
|
||||
* includes at least one column label and at least one cell below
|
||||
* the column label in which you specify a condition for the
|
||||
* column.
|
||||
* @return float
|
||||
*
|
||||
*/
|
||||
public static function DMIN($database, $field, $criteria)
|
||||
{
|
||||
$field = self::fieldExtract($database, $field);
|
||||
if (is_null($field)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Return
|
||||
return PHPExcel_Calculation_Statistical::MIN(
|
||||
self::getFilteredColumn($database, $field, $criteria)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* DPRODUCT
|
||||
*
|
||||
* Multiplies the values in a column of a list or database that match conditions that you specify.
|
||||
*
|
||||
* Excel Function:
|
||||
* DPRODUCT(database,field,criteria)
|
||||
*
|
||||
* @access public
|
||||
* @category Database Functions
|
||||
* @param mixed[] $database The range of cells that makes up the list or database.
|
||||
* A database is a list of related data in which rows of related
|
||||
* information are records, and columns of data are fields. The
|
||||
* first row of the list contains labels for each column.
|
||||
* @param string|integer $field Indicates which column is used in the function. Enter the
|
||||
* column label enclosed between double quotation marks, such as
|
||||
* "Age" or "Yield," or a number (without quotation marks) that
|
||||
* represents the position of the column within the list: 1 for
|
||||
* the first column, 2 for the second column, and so on.
|
||||
* @param mixed[] $criteria The range of cells that contains the conditions you specify.
|
||||
* You can use any range for the criteria argument, as long as it
|
||||
* includes at least one column label and at least one cell below
|
||||
* the column label in which you specify a condition for the
|
||||
* column.
|
||||
* @return float
|
||||
*
|
||||
*/
|
||||
public static function DPRODUCT($database, $field, $criteria)
|
||||
{
|
||||
$field = self::fieldExtract($database, $field);
|
||||
if (is_null($field)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Return
|
||||
return PHPExcel_Calculation_MathTrig::PRODUCT(
|
||||
self::getFilteredColumn($database, $field, $criteria)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* DSTDEV
|
||||
*
|
||||
* Estimates the standard deviation of a population based on a sample by using the numbers in a
|
||||
* column of a list or database that match conditions that you specify.
|
||||
*
|
||||
* Excel Function:
|
||||
* DSTDEV(database,field,criteria)
|
||||
*
|
||||
* @access public
|
||||
* @category Database Functions
|
||||
* @param mixed[] $database The range of cells that makes up the list or database.
|
||||
* A database is a list of related data in which rows of related
|
||||
* information are records, and columns of data are fields. The
|
||||
* first row of the list contains labels for each column.
|
||||
* @param string|integer $field Indicates which column is used in the function. Enter the
|
||||
* column label enclosed between double quotation marks, such as
|
||||
* "Age" or "Yield," or a number (without quotation marks) that
|
||||
* represents the position of the column within the list: 1 for
|
||||
* the first column, 2 for the second column, and so on.
|
||||
* @param mixed[] $criteria The range of cells that contains the conditions you specify.
|
||||
* You can use any range for the criteria argument, as long as it
|
||||
* includes at least one column label and at least one cell below
|
||||
* the column label in which you specify a condition for the
|
||||
* column.
|
||||
* @return float
|
||||
*
|
||||
*/
|
||||
public static function DSTDEV($database, $field, $criteria)
|
||||
{
|
||||
$field = self::fieldExtract($database, $field);
|
||||
if (is_null($field)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Return
|
||||
return PHPExcel_Calculation_Statistical::STDEV(
|
||||
self::getFilteredColumn($database, $field, $criteria)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* DSTDEVP
|
||||
*
|
||||
* Calculates the standard deviation of a population based on the entire population by using the
|
||||
* numbers in a column of a list or database that match conditions that you specify.
|
||||
*
|
||||
* Excel Function:
|
||||
* DSTDEVP(database,field,criteria)
|
||||
*
|
||||
* @access public
|
||||
* @category Database Functions
|
||||
* @param mixed[] $database The range of cells that makes up the list or database.
|
||||
* A database is a list of related data in which rows of related
|
||||
* information are records, and columns of data are fields. The
|
||||
* first row of the list contains labels for each column.
|
||||
* @param string|integer $field Indicates which column is used in the function. Enter the
|
||||
* column label enclosed between double quotation marks, such as
|
||||
* "Age" or "Yield," or a number (without quotation marks) that
|
||||
* represents the position of the column within the list: 1 for
|
||||
* the first column, 2 for the second column, and so on.
|
||||
* @param mixed[] $criteria The range of cells that contains the conditions you specify.
|
||||
* You can use any range for the criteria argument, as long as it
|
||||
* includes at least one column label and at least one cell below
|
||||
* the column label in which you specify a condition for the
|
||||
* column.
|
||||
* @return float
|
||||
*
|
||||
*/
|
||||
public static function DSTDEVP($database, $field, $criteria)
|
||||
{
|
||||
$field = self::fieldExtract($database, $field);
|
||||
if (is_null($field)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Return
|
||||
return PHPExcel_Calculation_Statistical::STDEVP(
|
||||
self::getFilteredColumn($database, $field, $criteria)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* DSUM
|
||||
*
|
||||
* Adds the numbers in a column of a list or database that match conditions that you specify.
|
||||
*
|
||||
* Excel Function:
|
||||
* DSUM(database,field,criteria)
|
||||
*
|
||||
* @access public
|
||||
* @category Database Functions
|
||||
* @param mixed[] $database The range of cells that makes up the list or database.
|
||||
* A database is a list of related data in which rows of related
|
||||
* information are records, and columns of data are fields. The
|
||||
* first row of the list contains labels for each column.
|
||||
* @param string|integer $field Indicates which column is used in the function. Enter the
|
||||
* column label enclosed between double quotation marks, such as
|
||||
* "Age" or "Yield," or a number (without quotation marks) that
|
||||
* represents the position of the column within the list: 1 for
|
||||
* the first column, 2 for the second column, and so on.
|
||||
* @param mixed[] $criteria The range of cells that contains the conditions you specify.
|
||||
* You can use any range for the criteria argument, as long as it
|
||||
* includes at least one column label and at least one cell below
|
||||
* the column label in which you specify a condition for the
|
||||
* column.
|
||||
* @return float
|
||||
*
|
||||
*/
|
||||
public static function DSUM($database, $field, $criteria)
|
||||
{
|
||||
$field = self::fieldExtract($database, $field);
|
||||
if (is_null($field)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Return
|
||||
return PHPExcel_Calculation_MathTrig::SUM(
|
||||
self::getFilteredColumn($database, $field, $criteria)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* DVAR
|
||||
*
|
||||
* Estimates the variance of a population based on a sample by using the numbers in a column
|
||||
* of a list or database that match conditions that you specify.
|
||||
*
|
||||
* Excel Function:
|
||||
* DVAR(database,field,criteria)
|
||||
*
|
||||
* @access public
|
||||
* @category Database Functions
|
||||
* @param mixed[] $database The range of cells that makes up the list or database.
|
||||
* A database is a list of related data in which rows of related
|
||||
* information are records, and columns of data are fields. The
|
||||
* first row of the list contains labels for each column.
|
||||
* @param string|integer $field Indicates which column is used in the function. Enter the
|
||||
* column label enclosed between double quotation marks, such as
|
||||
* "Age" or "Yield," or a number (without quotation marks) that
|
||||
* represents the position of the column within the list: 1 for
|
||||
* the first column, 2 for the second column, and so on.
|
||||
* @param mixed[] $criteria The range of cells that contains the conditions you specify.
|
||||
* You can use any range for the criteria argument, as long as it
|
||||
* includes at least one column label and at least one cell below
|
||||
* the column label in which you specify a condition for the
|
||||
* column.
|
||||
* @return float
|
||||
*
|
||||
*/
|
||||
public static function DVAR($database, $field, $criteria)
|
||||
{
|
||||
$field = self::fieldExtract($database, $field);
|
||||
if (is_null($field)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Return
|
||||
return PHPExcel_Calculation_Statistical::VARFunc(
|
||||
self::getFilteredColumn($database, $field, $criteria)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* DVARP
|
||||
*
|
||||
* Calculates the variance of a population based on the entire population by using the numbers
|
||||
* in a column of a list or database that match conditions that you specify.
|
||||
*
|
||||
* Excel Function:
|
||||
* DVARP(database,field,criteria)
|
||||
*
|
||||
* @access public
|
||||
* @category Database Functions
|
||||
* @param mixed[] $database The range of cells that makes up the list or database.
|
||||
* A database is a list of related data in which rows of related
|
||||
* information are records, and columns of data are fields. The
|
||||
* first row of the list contains labels for each column.
|
||||
* @param string|integer $field Indicates which column is used in the function. Enter the
|
||||
* column label enclosed between double quotation marks, such as
|
||||
* "Age" or "Yield," or a number (without quotation marks) that
|
||||
* represents the position of the column within the list: 1 for
|
||||
* the first column, 2 for the second column, and so on.
|
||||
* @param mixed[] $criteria The range of cells that contains the conditions you specify.
|
||||
* You can use any range for the criteria argument, as long as it
|
||||
* includes at least one column label and at least one cell below
|
||||
* the column label in which you specify a condition for the
|
||||
* column.
|
||||
* @return float
|
||||
*
|
||||
*/
|
||||
public static function DVARP($database, $field, $criteria)
|
||||
{
|
||||
$field = self::fieldExtract($database, $field);
|
||||
if (is_null($field)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Return
|
||||
return PHPExcel_Calculation_Statistical::VARP(
|
||||
self::getFilteredColumn($database, $field, $criteria)
|
||||
);
|
||||
}
|
||||
}
|
||||
1553
Cron/PHPExcel/PHPExcel/Calculation/DateTime.php
Executable file
1553
Cron/PHPExcel/PHPExcel/Calculation/DateTime.php
Executable file
File diff suppressed because it is too large
Load Diff
2650
Cron/PHPExcel/PHPExcel/Calculation/Engineering.php
Executable file
2650
Cron/PHPExcel/PHPExcel/Calculation/Engineering.php
Executable file
File diff suppressed because it is too large
Load Diff
46
Cron/PHPExcel/PHPExcel/Calculation/Exception.php
Executable file
46
Cron/PHPExcel/PHPExcel/Calculation/Exception.php
Executable file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PHPExcel_Calculation_Exception
|
||||
*
|
||||
* Copyright (c) 2006 - 2015 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Calculation
|
||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version ##VERSION##, ##DATE##
|
||||
*/
|
||||
class PHPExcel_Calculation_Exception extends PHPExcel_Exception
|
||||
{
|
||||
/**
|
||||
* Error handler callback
|
||||
*
|
||||
* @param mixed $code
|
||||
* @param mixed $string
|
||||
* @param mixed $file
|
||||
* @param mixed $line
|
||||
* @param mixed $context
|
||||
*/
|
||||
public static function errorHandlerCallback($code, $string, $file, $line, $context)
|
||||
{
|
||||
$e = new self($string, $code);
|
||||
$e->line = $line;
|
||||
$e->file = $file;
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
45
Cron/PHPExcel/PHPExcel/Calculation/ExceptionHandler.php
Executable file
45
Cron/PHPExcel/PHPExcel/Calculation/ExceptionHandler.php
Executable file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PHPExcel_Calculation_ExceptionHandler
|
||||
*
|
||||
* Copyright (c) 2006 - 2015 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Calculation
|
||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version ##VERSION##, ##DATE##
|
||||
*/
|
||||
class PHPExcel_Calculation_ExceptionHandler
|
||||
{
|
||||
/**
|
||||
* Register errorhandler
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
set_error_handler(array('PHPExcel_Calculation_Exception', 'errorHandlerCallback'), E_ALL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unregister errorhandler
|
||||
*/
|
||||
public function __destruct()
|
||||
{
|
||||
restore_error_handler();
|
||||
}
|
||||
}
|
||||
2359
Cron/PHPExcel/PHPExcel/Calculation/Financial.php
Executable file
2359
Cron/PHPExcel/PHPExcel/Calculation/Financial.php
Executable file
File diff suppressed because it is too large
Load Diff
622
Cron/PHPExcel/PHPExcel/Calculation/FormulaParser.php
Executable file
622
Cron/PHPExcel/PHPExcel/Calculation/FormulaParser.php
Executable file
@@ -0,0 +1,622 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
PARTLY BASED ON:
|
||||
Copyright (c) 2007 E. W. Bachtal, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
|
||||
and associated documentation files (the "Software"), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial
|
||||
portions of the Software.
|
||||
|
||||
The software is provided "as is", without warranty of any kind, express or implied, including but not
|
||||
limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In
|
||||
no event shall the authors or copyright holders be liable for any claim, damages or other liability,
|
||||
whether in an action of contract, tort or otherwise, arising from, out of or in connection with the
|
||||
software or the use or other dealings in the software.
|
||||
|
||||
http://ewbi.blogs.com/develops/2007/03/excel_formula_p.html
|
||||
http://ewbi.blogs.com/develops/2004/12/excel_formula_p.html
|
||||
*/
|
||||
|
||||
/**
|
||||
* PHPExcel_Calculation_FormulaParser
|
||||
*
|
||||
* Copyright (c) 2006 - 2015 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Calculation
|
||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version ##VERSION##, ##DATE##
|
||||
*/
|
||||
|
||||
|
||||
class PHPExcel_Calculation_FormulaParser
|
||||
{
|
||||
/* Character constants */
|
||||
const QUOTE_DOUBLE = '"';
|
||||
const QUOTE_SINGLE = '\'';
|
||||
const BRACKET_CLOSE = ']';
|
||||
const BRACKET_OPEN = '[';
|
||||
const BRACE_OPEN = '{';
|
||||
const BRACE_CLOSE = '}';
|
||||
const PAREN_OPEN = '(';
|
||||
const PAREN_CLOSE = ')';
|
||||
const SEMICOLON = ';';
|
||||
const WHITESPACE = ' ';
|
||||
const COMMA = ',';
|
||||
const ERROR_START = '#';
|
||||
|
||||
const OPERATORS_SN = "+-";
|
||||
const OPERATORS_INFIX = "+-*/^&=><";
|
||||
const OPERATORS_POSTFIX = "%";
|
||||
|
||||
/**
|
||||
* Formula
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $formula;
|
||||
|
||||
/**
|
||||
* Tokens
|
||||
*
|
||||
* @var PHPExcel_Calculation_FormulaToken[]
|
||||
*/
|
||||
private $tokens = array();
|
||||
|
||||
/**
|
||||
* Create a new PHPExcel_Calculation_FormulaParser
|
||||
*
|
||||
* @param string $pFormula Formula to parse
|
||||
* @throws PHPExcel_Calculation_Exception
|
||||
*/
|
||||
public function __construct($pFormula = '')
|
||||
{
|
||||
// Check parameters
|
||||
if (is_null($pFormula)) {
|
||||
throw new PHPExcel_Calculation_Exception("Invalid parameter passed: formula");
|
||||
}
|
||||
|
||||
// Initialise values
|
||||
$this->formula = trim($pFormula);
|
||||
// Parse!
|
||||
$this->parseToTokens();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Formula
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFormula()
|
||||
{
|
||||
return $this->formula;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Token
|
||||
*
|
||||
* @param int $pId Token id
|
||||
* @return string
|
||||
* @throws PHPExcel_Calculation_Exception
|
||||
*/
|
||||
public function getToken($pId = 0)
|
||||
{
|
||||
if (isset($this->tokens[$pId])) {
|
||||
return $this->tokens[$pId];
|
||||
} else {
|
||||
throw new PHPExcel_Calculation_Exception("Token with id $pId does not exist.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Token count
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTokenCount()
|
||||
{
|
||||
return count($this->tokens);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Tokens
|
||||
*
|
||||
* @return PHPExcel_Calculation_FormulaToken[]
|
||||
*/
|
||||
public function getTokens()
|
||||
{
|
||||
return $this->tokens;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse to tokens
|
||||
*/
|
||||
private function parseToTokens()
|
||||
{
|
||||
// No attempt is made to verify formulas; assumes formulas are derived from Excel, where
|
||||
// they can only exist if valid; stack overflows/underflows sunk as nulls without exceptions.
|
||||
|
||||
// Check if the formula has a valid starting =
|
||||
$formulaLength = strlen($this->formula);
|
||||
if ($formulaLength < 2 || $this->formula{0} != '=') {
|
||||
return;
|
||||
}
|
||||
|
||||
// Helper variables
|
||||
$tokens1 = $tokens2 = $stack = array();
|
||||
$inString = $inPath = $inRange = $inError = false;
|
||||
$token = $previousToken = $nextToken = null;
|
||||
|
||||
$index = 1;
|
||||
$value = '';
|
||||
|
||||
$ERRORS = array("#NULL!", "#DIV/0!", "#VALUE!", "#REF!", "#NAME?", "#NUM!", "#N/A");
|
||||
$COMPARATORS_MULTI = array(">=", "<=", "<>");
|
||||
|
||||
while ($index < $formulaLength) {
|
||||
// state-dependent character evaluation (order is important)
|
||||
|
||||
// double-quoted strings
|
||||
// embeds are doubled
|
||||
// end marks token
|
||||
if ($inString) {
|
||||
if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::QUOTE_DOUBLE) {
|
||||
if ((($index + 2) <= $formulaLength) && ($this->formula{$index + 1} == PHPExcel_Calculation_FormulaParser::QUOTE_DOUBLE)) {
|
||||
$value .= PHPExcel_Calculation_FormulaParser::QUOTE_DOUBLE;
|
||||
++$index;
|
||||
} else {
|
||||
$inString = false;
|
||||
$tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_TEXT);
|
||||
$value = "";
|
||||
}
|
||||
} else {
|
||||
$value .= $this->formula{$index};
|
||||
}
|
||||
++$index;
|
||||
continue;
|
||||
}
|
||||
|
||||
// single-quoted strings (links)
|
||||
// embeds are double
|
||||
// end does not mark a token
|
||||
if ($inPath) {
|
||||
if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::QUOTE_SINGLE) {
|
||||
if ((($index + 2) <= $formulaLength) && ($this->formula{$index + 1} == PHPExcel_Calculation_FormulaParser::QUOTE_SINGLE)) {
|
||||
$value .= PHPExcel_Calculation_FormulaParser::QUOTE_SINGLE;
|
||||
++$index;
|
||||
} else {
|
||||
$inPath = false;
|
||||
}
|
||||
} else {
|
||||
$value .= $this->formula{$index};
|
||||
}
|
||||
++$index;
|
||||
continue;
|
||||
}
|
||||
|
||||
// bracked strings (R1C1 range index or linked workbook name)
|
||||
// no embeds (changed to "()" by Excel)
|
||||
// end does not mark a token
|
||||
if ($inRange) {
|
||||
if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::BRACKET_CLOSE) {
|
||||
$inRange = false;
|
||||
}
|
||||
$value .= $this->formula{$index};
|
||||
++$index;
|
||||
continue;
|
||||
}
|
||||
|
||||
// error values
|
||||
// end marks a token, determined from absolute list of values
|
||||
if ($inError) {
|
||||
$value .= $this->formula{$index};
|
||||
++$index;
|
||||
if (in_array($value, $ERRORS)) {
|
||||
$inError = false;
|
||||
$tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_ERROR);
|
||||
$value = "";
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
// scientific notation check
|
||||
if (strpos(PHPExcel_Calculation_FormulaParser::OPERATORS_SN, $this->formula{$index}) !== false) {
|
||||
if (strlen($value) > 1) {
|
||||
if (preg_match("/^[1-9]{1}(\.[0-9]+)?E{1}$/", $this->formula{$index}) != 0) {
|
||||
$value .= $this->formula{$index};
|
||||
++$index;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// independent character evaluation (order not important)
|
||||
|
||||
// establish state-dependent character evaluations
|
||||
if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::QUOTE_DOUBLE) {
|
||||
if (strlen($value > 0)) {
|
||||
// unexpected
|
||||
$tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN);
|
||||
$value = "";
|
||||
}
|
||||
$inString = true;
|
||||
++$index;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::QUOTE_SINGLE) {
|
||||
if (strlen($value) > 0) {
|
||||
// unexpected
|
||||
$tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN);
|
||||
$value = "";
|
||||
}
|
||||
$inPath = true;
|
||||
++$index;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::BRACKET_OPEN) {
|
||||
$inRange = true;
|
||||
$value .= PHPExcel_Calculation_FormulaParser::BRACKET_OPEN;
|
||||
++$index;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::ERROR_START) {
|
||||
if (strlen($value) > 0) {
|
||||
// unexpected
|
||||
$tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN);
|
||||
$value = "";
|
||||
}
|
||||
$inError = true;
|
||||
$value .= PHPExcel_Calculation_FormulaParser::ERROR_START;
|
||||
++$index;
|
||||
continue;
|
||||
}
|
||||
|
||||
// mark start and end of arrays and array rows
|
||||
if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::BRACE_OPEN) {
|
||||
if (strlen($value) > 0) {
|
||||
// unexpected
|
||||
$tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN);
|
||||
$value = "";
|
||||
}
|
||||
|
||||
$tmp = new PHPExcel_Calculation_FormulaToken("ARRAY", PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_START);
|
||||
$tokens1[] = $tmp;
|
||||
$stack[] = clone $tmp;
|
||||
|
||||
$tmp = new PHPExcel_Calculation_FormulaToken("ARRAYROW", PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_START);
|
||||
$tokens1[] = $tmp;
|
||||
$stack[] = clone $tmp;
|
||||
|
||||
++$index;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::SEMICOLON) {
|
||||
if (strlen($value) > 0) {
|
||||
$tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND);
|
||||
$value = "";
|
||||
}
|
||||
|
||||
$tmp = array_pop($stack);
|
||||
$tmp->setValue("");
|
||||
$tmp->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP);
|
||||
$tokens1[] = $tmp;
|
||||
|
||||
$tmp = new PHPExcel_Calculation_FormulaToken(",", PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_ARGUMENT);
|
||||
$tokens1[] = $tmp;
|
||||
|
||||
$tmp = new PHPExcel_Calculation_FormulaToken("ARRAYROW", PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_START);
|
||||
$tokens1[] = $tmp;
|
||||
$stack[] = clone $tmp;
|
||||
|
||||
++$index;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::BRACE_CLOSE) {
|
||||
if (strlen($value) > 0) {
|
||||
$tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND);
|
||||
$value = "";
|
||||
}
|
||||
|
||||
$tmp = array_pop($stack);
|
||||
$tmp->setValue("");
|
||||
$tmp->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP);
|
||||
$tokens1[] = $tmp;
|
||||
|
||||
$tmp = array_pop($stack);
|
||||
$tmp->setValue("");
|
||||
$tmp->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP);
|
||||
$tokens1[] = $tmp;
|
||||
|
||||
++$index;
|
||||
continue;
|
||||
}
|
||||
|
||||
// trim white-space
|
||||
if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::WHITESPACE) {
|
||||
if (strlen($value) > 0) {
|
||||
$tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND);
|
||||
$value = "";
|
||||
}
|
||||
$tokens1[] = new PHPExcel_Calculation_FormulaToken("", PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_WHITESPACE);
|
||||
++$index;
|
||||
while (($this->formula{$index} == PHPExcel_Calculation_FormulaParser::WHITESPACE) && ($index < $formulaLength)) {
|
||||
++$index;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
// multi-character comparators
|
||||
if (($index + 2) <= $formulaLength) {
|
||||
if (in_array(substr($this->formula, $index, 2), $COMPARATORS_MULTI)) {
|
||||
if (strlen($value) > 0) {
|
||||
$tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND);
|
||||
$value = "";
|
||||
}
|
||||
$tokens1[] = new PHPExcel_Calculation_FormulaToken(substr($this->formula, $index, 2), PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORINFIX, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_LOGICAL);
|
||||
$index += 2;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// standard infix operators
|
||||
if (strpos(PHPExcel_Calculation_FormulaParser::OPERATORS_INFIX, $this->formula{$index}) !== false) {
|
||||
if (strlen($value) > 0) {
|
||||
$tokens1[] =new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND);
|
||||
$value = "";
|
||||
}
|
||||
$tokens1[] = new PHPExcel_Calculation_FormulaToken($this->formula{$index}, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORINFIX);
|
||||
++$index;
|
||||
continue;
|
||||
}
|
||||
|
||||
// standard postfix operators (only one)
|
||||
if (strpos(PHPExcel_Calculation_FormulaParser::OPERATORS_POSTFIX, $this->formula{$index}) !== false) {
|
||||
if (strlen($value) > 0) {
|
||||
$tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND);
|
||||
$value = "";
|
||||
}
|
||||
$tokens1[] = new PHPExcel_Calculation_FormulaToken($this->formula{$index}, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORPOSTFIX);
|
||||
++$index;
|
||||
continue;
|
||||
}
|
||||
|
||||
// start subexpression or function
|
||||
if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::PAREN_OPEN) {
|
||||
if (strlen($value) > 0) {
|
||||
$tmp = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_START);
|
||||
$tokens1[] = $tmp;
|
||||
$stack[] = clone $tmp;
|
||||
$value = "";
|
||||
} else {
|
||||
$tmp = new PHPExcel_Calculation_FormulaToken("", PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_SUBEXPRESSION, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_START);
|
||||
$tokens1[] = $tmp;
|
||||
$stack[] = clone $tmp;
|
||||
}
|
||||
++$index;
|
||||
continue;
|
||||
}
|
||||
|
||||
// function, subexpression, or array parameters, or operand unions
|
||||
if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::COMMA) {
|
||||
if (strlen($value) > 0) {
|
||||
$tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND);
|
||||
$value = "";
|
||||
}
|
||||
|
||||
$tmp = array_pop($stack);
|
||||
$tmp->setValue("");
|
||||
$tmp->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP);
|
||||
$stack[] = $tmp;
|
||||
|
||||
if ($tmp->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION) {
|
||||
$tokens1[] = new PHPExcel_Calculation_FormulaToken(",", PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORINFIX, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_UNION);
|
||||
} else {
|
||||
$tokens1[] = new PHPExcel_Calculation_FormulaToken(",", PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_ARGUMENT);
|
||||
}
|
||||
++$index;
|
||||
continue;
|
||||
}
|
||||
|
||||
// stop subexpression
|
||||
if ($this->formula{$index} == PHPExcel_Calculation_FormulaParser::PAREN_CLOSE) {
|
||||
if (strlen($value) > 0) {
|
||||
$tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND);
|
||||
$value = "";
|
||||
}
|
||||
|
||||
$tmp = array_pop($stack);
|
||||
$tmp->setValue("");
|
||||
$tmp->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP);
|
||||
$tokens1[] = $tmp;
|
||||
|
||||
++$index;
|
||||
continue;
|
||||
}
|
||||
|
||||
// token accumulation
|
||||
$value .= $this->formula{$index};
|
||||
++$index;
|
||||
}
|
||||
|
||||
// dump remaining accumulation
|
||||
if (strlen($value) > 0) {
|
||||
$tokens1[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND);
|
||||
}
|
||||
|
||||
// move tokenList to new set, excluding unnecessary white-space tokens and converting necessary ones to intersections
|
||||
$tokenCount = count($tokens1);
|
||||
for ($i = 0; $i < $tokenCount; ++$i) {
|
||||
$token = $tokens1[$i];
|
||||
if (isset($tokens1[$i - 1])) {
|
||||
$previousToken = $tokens1[$i - 1];
|
||||
} else {
|
||||
$previousToken = null;
|
||||
}
|
||||
if (isset($tokens1[$i + 1])) {
|
||||
$nextToken = $tokens1[$i + 1];
|
||||
} else {
|
||||
$nextToken = null;
|
||||
}
|
||||
|
||||
if (is_null($token)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($token->getTokenType() != PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_WHITESPACE) {
|
||||
$tokens2[] = $token;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (is_null($previousToken)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (! (
|
||||
(($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION) && ($previousToken->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP)) ||
|
||||
(($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_SUBEXPRESSION) && ($previousToken->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP)) ||
|
||||
($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND)
|
||||
) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (is_null($nextToken)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (! (
|
||||
(($nextToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION) && ($nextToken->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_START)) ||
|
||||
(($nextToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_SUBEXPRESSION) && ($nextToken->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_START)) ||
|
||||
($nextToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND)
|
||||
) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$tokens2[] = new PHPExcel_Calculation_FormulaToken($value, PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORINFIX, PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_INTERSECTION);
|
||||
}
|
||||
|
||||
// move tokens to final list, switching infix "-" operators to prefix when appropriate, switching infix "+" operators
|
||||
// to noop when appropriate, identifying operand and infix-operator subtypes, and pulling "@" from function names
|
||||
$this->tokens = array();
|
||||
|
||||
$tokenCount = count($tokens2);
|
||||
for ($i = 0; $i < $tokenCount; ++$i) {
|
||||
$token = $tokens2[$i];
|
||||
if (isset($tokens2[$i - 1])) {
|
||||
$previousToken = $tokens2[$i - 1];
|
||||
} else {
|
||||
$previousToken = null;
|
||||
}
|
||||
if (isset($tokens2[$i + 1])) {
|
||||
$nextToken = $tokens2[$i + 1];
|
||||
} else {
|
||||
$nextToken = null;
|
||||
}
|
||||
|
||||
if (is_null($token)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($token->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORINFIX && $token->getValue() == "-") {
|
||||
if ($i == 0) {
|
||||
$token->setTokenType(PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORPREFIX);
|
||||
} elseif ((($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION) &&
|
||||
($previousToken->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP)) ||
|
||||
(($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_SUBEXPRESSION) &&
|
||||
($previousToken->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP)) ||
|
||||
($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORPOSTFIX) ||
|
||||
($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND)) {
|
||||
$token->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_MATH);
|
||||
} else {
|
||||
$token->setTokenType(PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORPREFIX);
|
||||
}
|
||||
|
||||
$this->tokens[] = $token;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($token->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORINFIX && $token->getValue() == "+") {
|
||||
if ($i == 0) {
|
||||
continue;
|
||||
} elseif ((($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION) &&
|
||||
($previousToken->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP)) ||
|
||||
(($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_SUBEXPRESSION) &&
|
||||
($previousToken->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_STOP)) ||
|
||||
($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORPOSTFIX) ||
|
||||
($previousToken->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND)) {
|
||||
$token->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_MATH);
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->tokens[] = $token;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($token->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERATORINFIX &&
|
||||
$token->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_NOTHING) {
|
||||
if (strpos("<>=", substr($token->getValue(), 0, 1)) !== false) {
|
||||
$token->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_LOGICAL);
|
||||
} elseif ($token->getValue() == "&") {
|
||||
$token->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_CONCATENATION);
|
||||
} else {
|
||||
$token->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_MATH);
|
||||
}
|
||||
|
||||
$this->tokens[] = $token;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($token->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_OPERAND &&
|
||||
$token->getTokenSubType() == PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_NOTHING) {
|
||||
if (!is_numeric($token->getValue())) {
|
||||
if (strtoupper($token->getValue()) == "TRUE" || strtoupper($token->getValue() == "FALSE")) {
|
||||
$token->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_LOGICAL);
|
||||
} else {
|
||||
$token->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_RANGE);
|
||||
}
|
||||
} else {
|
||||
$token->setTokenSubType(PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_NUMBER);
|
||||
}
|
||||
|
||||
$this->tokens[] = $token;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($token->getTokenType() == PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_FUNCTION) {
|
||||
if (strlen($token->getValue() > 0)) {
|
||||
if (substr($token->getValue(), 0, 1) == "@") {
|
||||
$token->setValue(substr($token->getValue(), 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->tokens[] = $token;
|
||||
}
|
||||
}
|
||||
}
|
||||
176
Cron/PHPExcel/PHPExcel/Calculation/FormulaToken.php
Executable file
176
Cron/PHPExcel/PHPExcel/Calculation/FormulaToken.php
Executable file
@@ -0,0 +1,176 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
PARTLY BASED ON:
|
||||
Copyright (c) 2007 E. W. Bachtal, Inc.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software
|
||||
and associated documentation files (the "Software"), to deal in the Software without restriction,
|
||||
including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial
|
||||
portions of the Software.
|
||||
|
||||
The software is provided "as is", without warranty of any kind, express or implied, including but not
|
||||
limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In
|
||||
no event shall the authors or copyright holders be liable for any claim, damages or other liability,
|
||||
whether in an action of contract, tort or otherwise, arising from, out of or in connection with the
|
||||
software or the use or other dealings in the software.
|
||||
|
||||
http://ewbi.blogs.com/develops/2007/03/excel_formula_p.html
|
||||
http://ewbi.blogs.com/develops/2004/12/excel_formula_p.html
|
||||
*/
|
||||
|
||||
/**
|
||||
* PHPExcel_Calculation_FormulaToken
|
||||
*
|
||||
* Copyright (c) 2006 - 2015 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Calculation
|
||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version ##VERSION##, ##DATE##
|
||||
*/
|
||||
|
||||
|
||||
class PHPExcel_Calculation_FormulaToken
|
||||
{
|
||||
/* Token types */
|
||||
const TOKEN_TYPE_NOOP = 'Noop';
|
||||
const TOKEN_TYPE_OPERAND = 'Operand';
|
||||
const TOKEN_TYPE_FUNCTION = 'Function';
|
||||
const TOKEN_TYPE_SUBEXPRESSION = 'Subexpression';
|
||||
const TOKEN_TYPE_ARGUMENT = 'Argument';
|
||||
const TOKEN_TYPE_OPERATORPREFIX = 'OperatorPrefix';
|
||||
const TOKEN_TYPE_OPERATORINFIX = 'OperatorInfix';
|
||||
const TOKEN_TYPE_OPERATORPOSTFIX = 'OperatorPostfix';
|
||||
const TOKEN_TYPE_WHITESPACE = 'Whitespace';
|
||||
const TOKEN_TYPE_UNKNOWN = 'Unknown';
|
||||
|
||||
/* Token subtypes */
|
||||
const TOKEN_SUBTYPE_NOTHING = 'Nothing';
|
||||
const TOKEN_SUBTYPE_START = 'Start';
|
||||
const TOKEN_SUBTYPE_STOP = 'Stop';
|
||||
const TOKEN_SUBTYPE_TEXT = 'Text';
|
||||
const TOKEN_SUBTYPE_NUMBER = 'Number';
|
||||
const TOKEN_SUBTYPE_LOGICAL = 'Logical';
|
||||
const TOKEN_SUBTYPE_ERROR = 'Error';
|
||||
const TOKEN_SUBTYPE_RANGE = 'Range';
|
||||
const TOKEN_SUBTYPE_MATH = 'Math';
|
||||
const TOKEN_SUBTYPE_CONCATENATION = 'Concatenation';
|
||||
const TOKEN_SUBTYPE_INTERSECTION = 'Intersection';
|
||||
const TOKEN_SUBTYPE_UNION = 'Union';
|
||||
|
||||
/**
|
||||
* Value
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $value;
|
||||
|
||||
/**
|
||||
* Token Type (represented by TOKEN_TYPE_*)
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $tokenType;
|
||||
|
||||
/**
|
||||
* Token SubType (represented by TOKEN_SUBTYPE_*)
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $tokenSubType;
|
||||
|
||||
/**
|
||||
* Create a new PHPExcel_Calculation_FormulaToken
|
||||
*
|
||||
* @param string $pValue
|
||||
* @param string $pTokenType Token type (represented by TOKEN_TYPE_*)
|
||||
* @param string $pTokenSubType Token Subtype (represented by TOKEN_SUBTYPE_*)
|
||||
*/
|
||||
public function __construct($pValue, $pTokenType = PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN, $pTokenSubType = PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_NOTHING)
|
||||
{
|
||||
// Initialise values
|
||||
$this->value = $pValue;
|
||||
$this->tokenType = $pTokenType;
|
||||
$this->tokenSubType = $pTokenSubType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Value
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getValue()
|
||||
{
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Value
|
||||
*
|
||||
* @param string $value
|
||||
*/
|
||||
public function setValue($value)
|
||||
{
|
||||
$this->value = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Token Type (represented by TOKEN_TYPE_*)
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTokenType()
|
||||
{
|
||||
return $this->tokenType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Token Type
|
||||
*
|
||||
* @param string $value
|
||||
*/
|
||||
public function setTokenType($value = PHPExcel_Calculation_FormulaToken::TOKEN_TYPE_UNKNOWN)
|
||||
{
|
||||
$this->tokenType = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Token SubType (represented by TOKEN_SUBTYPE_*)
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTokenSubType()
|
||||
{
|
||||
return $this->tokenSubType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Token SubType
|
||||
*
|
||||
* @param string $value
|
||||
*/
|
||||
public function setTokenSubType($value = PHPExcel_Calculation_FormulaToken::TOKEN_SUBTYPE_NOTHING)
|
||||
{
|
||||
$this->tokenSubType = $value;
|
||||
}
|
||||
}
|
||||
148
Cron/PHPExcel/PHPExcel/Calculation/Function.php
Executable file
148
Cron/PHPExcel/PHPExcel/Calculation/Function.php
Executable file
@@ -0,0 +1,148 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PHPExcel_Calculation_Function
|
||||
*
|
||||
* Copyright (c) 2006 - 2015 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Calculation
|
||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version ##VERSION##, ##DATE##
|
||||
*/
|
||||
class PHPExcel_Calculation_Function
|
||||
{
|
||||
/* Function categories */
|
||||
const CATEGORY_CUBE = 'Cube';
|
||||
const CATEGORY_DATABASE = 'Database';
|
||||
const CATEGORY_DATE_AND_TIME = 'Date and Time';
|
||||
const CATEGORY_ENGINEERING = 'Engineering';
|
||||
const CATEGORY_FINANCIAL = 'Financial';
|
||||
const CATEGORY_INFORMATION = 'Information';
|
||||
const CATEGORY_LOGICAL = 'Logical';
|
||||
const CATEGORY_LOOKUP_AND_REFERENCE = 'Lookup and Reference';
|
||||
const CATEGORY_MATH_AND_TRIG = 'Math and Trig';
|
||||
const CATEGORY_STATISTICAL = 'Statistical';
|
||||
const CATEGORY_TEXT_AND_DATA = 'Text and Data';
|
||||
|
||||
/**
|
||||
* Category (represented by CATEGORY_*)
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $category;
|
||||
|
||||
/**
|
||||
* Excel name
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $excelName;
|
||||
|
||||
/**
|
||||
* PHPExcel name
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $phpExcelName;
|
||||
|
||||
/**
|
||||
* Create a new PHPExcel_Calculation_Function
|
||||
*
|
||||
* @param string $pCategory Category (represented by CATEGORY_*)
|
||||
* @param string $pExcelName Excel function name
|
||||
* @param string $pPHPExcelName PHPExcel function mapping
|
||||
* @throws PHPExcel_Calculation_Exception
|
||||
*/
|
||||
public function __construct($pCategory = null, $pExcelName = null, $pPHPExcelName = null)
|
||||
{
|
||||
if (($pCategory !== null) && ($pExcelName !== null) && ($pPHPExcelName !== null)) {
|
||||
// Initialise values
|
||||
$this->category = $pCategory;
|
||||
$this->excelName = $pExcelName;
|
||||
$this->phpExcelName = $pPHPExcelName;
|
||||
} else {
|
||||
throw new PHPExcel_Calculation_Exception("Invalid parameters passed.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Category (represented by CATEGORY_*)
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCategory()
|
||||
{
|
||||
return $this->category;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Category (represented by CATEGORY_*)
|
||||
*
|
||||
* @param string $value
|
||||
* @throws PHPExcel_Calculation_Exception
|
||||
*/
|
||||
public function setCategory($value = null)
|
||||
{
|
||||
if (!is_null($value)) {
|
||||
$this->category = $value;
|
||||
} else {
|
||||
throw new PHPExcel_Calculation_Exception("Invalid parameter passed.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Excel name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getExcelName()
|
||||
{
|
||||
return $this->excelName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Excel name
|
||||
*
|
||||
* @param string $value
|
||||
*/
|
||||
public function setExcelName($value)
|
||||
{
|
||||
$this->excelName = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get PHPExcel name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPHPExcelName()
|
||||
{
|
||||
return $this->phpExcelName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set PHPExcel name
|
||||
*
|
||||
* @param string $value
|
||||
*/
|
||||
public function setPHPExcelName($value)
|
||||
{
|
||||
$this->phpExcelName = $value;
|
||||
}
|
||||
}
|
||||
760
Cron/PHPExcel/PHPExcel/Calculation/Functions.php
Executable file
760
Cron/PHPExcel/PHPExcel/Calculation/Functions.php
Executable file
@@ -0,0 +1,760 @@
|
||||
<?php
|
||||
|
||||
/** PHPExcel root directory */
|
||||
if (!defined('PHPEXCEL_ROOT')) {
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
|
||||
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
}
|
||||
|
||||
|
||||
/** MAX_VALUE */
|
||||
define('MAX_VALUE', 1.2e308);
|
||||
|
||||
/** 2 / PI */
|
||||
define('M_2DIVPI', 0.63661977236758134307553505349006);
|
||||
|
||||
/** MAX_ITERATIONS */
|
||||
define('MAX_ITERATIONS', 256);
|
||||
|
||||
/** PRECISION */
|
||||
define('PRECISION', 8.88E-016);
|
||||
|
||||
|
||||
/**
|
||||
* PHPExcel_Calculation_Functions
|
||||
*
|
||||
* Copyright (c) 2006 - 2015 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Calculation
|
||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version ##VERSION##, ##DATE##
|
||||
*/
|
||||
class PHPExcel_Calculation_Functions
|
||||
{
|
||||
|
||||
/** constants */
|
||||
const COMPATIBILITY_EXCEL = 'Excel';
|
||||
const COMPATIBILITY_GNUMERIC = 'Gnumeric';
|
||||
const COMPATIBILITY_OPENOFFICE = 'OpenOfficeCalc';
|
||||
|
||||
const RETURNDATE_PHP_NUMERIC = 'P';
|
||||
const RETURNDATE_PHP_OBJECT = 'O';
|
||||
const RETURNDATE_EXCEL = 'E';
|
||||
|
||||
|
||||
/**
|
||||
* Compatibility mode to use for error checking and responses
|
||||
*
|
||||
* @access private
|
||||
* @var string
|
||||
*/
|
||||
protected static $compatibilityMode = self::COMPATIBILITY_EXCEL;
|
||||
|
||||
/**
|
||||
* Data Type to use when returning date values
|
||||
*
|
||||
* @access private
|
||||
* @var string
|
||||
*/
|
||||
protected static $returnDateType = self::RETURNDATE_EXCEL;
|
||||
|
||||
/**
|
||||
* List of error codes
|
||||
*
|
||||
* @access private
|
||||
* @var array
|
||||
*/
|
||||
protected static $errorCodes = array(
|
||||
'null' => '#NULL!',
|
||||
'divisionbyzero' => '#DIV/0!',
|
||||
'value' => '#VALUE!',
|
||||
'reference' => '#REF!',
|
||||
'name' => '#NAME?',
|
||||
'num' => '#NUM!',
|
||||
'na' => '#N/A',
|
||||
'gettingdata' => '#GETTING_DATA'
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* Set the Compatibility Mode
|
||||
*
|
||||
* @access public
|
||||
* @category Function Configuration
|
||||
* @param string $compatibilityMode Compatibility Mode
|
||||
* Permitted values are:
|
||||
* PHPExcel_Calculation_Functions::COMPATIBILITY_EXCEL 'Excel'
|
||||
* PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC 'Gnumeric'
|
||||
* PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE 'OpenOfficeCalc'
|
||||
* @return boolean (Success or Failure)
|
||||
*/
|
||||
public static function setCompatibilityMode($compatibilityMode)
|
||||
{
|
||||
if (($compatibilityMode == self::COMPATIBILITY_EXCEL) ||
|
||||
($compatibilityMode == self::COMPATIBILITY_GNUMERIC) ||
|
||||
($compatibilityMode == self::COMPATIBILITY_OPENOFFICE)) {
|
||||
self::$compatibilityMode = $compatibilityMode;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the current Compatibility Mode
|
||||
*
|
||||
* @access public
|
||||
* @category Function Configuration
|
||||
* @return string Compatibility Mode
|
||||
* Possible Return values are:
|
||||
* PHPExcel_Calculation_Functions::COMPATIBILITY_EXCEL 'Excel'
|
||||
* PHPExcel_Calculation_Functions::COMPATIBILITY_GNUMERIC 'Gnumeric'
|
||||
* PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE 'OpenOfficeCalc'
|
||||
*/
|
||||
public static function getCompatibilityMode()
|
||||
{
|
||||
return self::$compatibilityMode;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the Return Date Format used by functions that return a date/time (Excel, PHP Serialized Numeric or PHP Object)
|
||||
*
|
||||
* @access public
|
||||
* @category Function Configuration
|
||||
* @param string $returnDateType Return Date Format
|
||||
* Permitted values are:
|
||||
* PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC 'P'
|
||||
* PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT 'O'
|
||||
* PHPExcel_Calculation_Functions::RETURNDATE_EXCEL 'E'
|
||||
* @return boolean Success or failure
|
||||
*/
|
||||
public static function setReturnDateType($returnDateType)
|
||||
{
|
||||
if (($returnDateType == self::RETURNDATE_PHP_NUMERIC) ||
|
||||
($returnDateType == self::RETURNDATE_PHP_OBJECT) ||
|
||||
($returnDateType == self::RETURNDATE_EXCEL)) {
|
||||
self::$returnDateType = $returnDateType;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the current Return Date Format for functions that return a date/time (Excel, PHP Serialized Numeric or PHP Object)
|
||||
*
|
||||
* @access public
|
||||
* @category Function Configuration
|
||||
* @return string Return Date Format
|
||||
* Possible Return values are:
|
||||
* PHPExcel_Calculation_Functions::RETURNDATE_PHP_NUMERIC 'P'
|
||||
* PHPExcel_Calculation_Functions::RETURNDATE_PHP_OBJECT 'O'
|
||||
* PHPExcel_Calculation_Functions::RETURNDATE_EXCEL 'E'
|
||||
*/
|
||||
public static function getReturnDateType()
|
||||
{
|
||||
return self::$returnDateType;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* DUMMY
|
||||
*
|
||||
* @access public
|
||||
* @category Error Returns
|
||||
* @return string #Not Yet Implemented
|
||||
*/
|
||||
public static function DUMMY()
|
||||
{
|
||||
return '#Not Yet Implemented';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* DIV0
|
||||
*
|
||||
* @access public
|
||||
* @category Error Returns
|
||||
* @return string #Not Yet Implemented
|
||||
*/
|
||||
public static function DIV0()
|
||||
{
|
||||
return self::$errorCodes['divisionbyzero'];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* NA
|
||||
*
|
||||
* Excel Function:
|
||||
* =NA()
|
||||
*
|
||||
* Returns the error value #N/A
|
||||
* #N/A is the error value that means "no value is available."
|
||||
*
|
||||
* @access public
|
||||
* @category Logical Functions
|
||||
* @return string #N/A!
|
||||
*/
|
||||
public static function NA()
|
||||
{
|
||||
return self::$errorCodes['na'];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* NaN
|
||||
*
|
||||
* Returns the error value #NUM!
|
||||
*
|
||||
* @access public
|
||||
* @category Error Returns
|
||||
* @return string #NUM!
|
||||
*/
|
||||
public static function NaN()
|
||||
{
|
||||
return self::$errorCodes['num'];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* NAME
|
||||
*
|
||||
* Returns the error value #NAME?
|
||||
*
|
||||
* @access public
|
||||
* @category Error Returns
|
||||
* @return string #NAME?
|
||||
*/
|
||||
public static function NAME()
|
||||
{
|
||||
return self::$errorCodes['name'];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* REF
|
||||
*
|
||||
* Returns the error value #REF!
|
||||
*
|
||||
* @access public
|
||||
* @category Error Returns
|
||||
* @return string #REF!
|
||||
*/
|
||||
public static function REF()
|
||||
{
|
||||
return self::$errorCodes['reference'];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* NULL
|
||||
*
|
||||
* Returns the error value #NULL!
|
||||
*
|
||||
* @access public
|
||||
* @category Error Returns
|
||||
* @return string #NULL!
|
||||
*/
|
||||
public static function NULL()
|
||||
{
|
||||
return self::$errorCodes['null'];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* VALUE
|
||||
*
|
||||
* Returns the error value #VALUE!
|
||||
*
|
||||
* @access public
|
||||
* @category Error Returns
|
||||
* @return string #VALUE!
|
||||
*/
|
||||
public static function VALUE()
|
||||
{
|
||||
return self::$errorCodes['value'];
|
||||
}
|
||||
|
||||
|
||||
public static function isMatrixValue($idx)
|
||||
{
|
||||
return ((substr_count($idx, '.') <= 1) || (preg_match('/\.[A-Z]/', $idx) > 0));
|
||||
}
|
||||
|
||||
|
||||
public static function isValue($idx)
|
||||
{
|
||||
return (substr_count($idx, '.') == 0);
|
||||
}
|
||||
|
||||
|
||||
public static function isCellValue($idx)
|
||||
{
|
||||
return (substr_count($idx, '.') > 1);
|
||||
}
|
||||
|
||||
|
||||
public static function ifCondition($condition)
|
||||
{
|
||||
$condition = PHPExcel_Calculation_Functions::flattenSingleValue($condition);
|
||||
if (!isset($condition{0})) {
|
||||
$condition = '=""';
|
||||
}
|
||||
if (!in_array($condition{0}, array('>', '<', '='))) {
|
||||
if (!is_numeric($condition)) {
|
||||
$condition = PHPExcel_Calculation::wrapResult(strtoupper($condition));
|
||||
}
|
||||
return '=' . $condition;
|
||||
} else {
|
||||
preg_match('/([<>=]+)(.*)/', $condition, $matches);
|
||||
list(, $operator, $operand) = $matches;
|
||||
|
||||
if (!is_numeric($operand)) {
|
||||
$operand = str_replace('"', '""', $operand);
|
||||
$operand = PHPExcel_Calculation::wrapResult(strtoupper($operand));
|
||||
}
|
||||
|
||||
return $operator.$operand;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* ERROR_TYPE
|
||||
*
|
||||
* @param mixed $value Value to check
|
||||
* @return boolean
|
||||
*/
|
||||
public static function ERROR_TYPE($value = '')
|
||||
{
|
||||
$value = self::flattenSingleValue($value);
|
||||
|
||||
$i = 1;
|
||||
foreach (self::$errorCodes as $errorCode) {
|
||||
if ($value === $errorCode) {
|
||||
return $i;
|
||||
}
|
||||
++$i;
|
||||
}
|
||||
return self::NA();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* IS_BLANK
|
||||
*
|
||||
* @param mixed $value Value to check
|
||||
* @return boolean
|
||||
*/
|
||||
public static function IS_BLANK($value = null)
|
||||
{
|
||||
if (!is_null($value)) {
|
||||
$value = self::flattenSingleValue($value);
|
||||
}
|
||||
|
||||
return is_null($value);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* IS_ERR
|
||||
*
|
||||
* @param mixed $value Value to check
|
||||
* @return boolean
|
||||
*/
|
||||
public static function IS_ERR($value = '')
|
||||
{
|
||||
$value = self::flattenSingleValue($value);
|
||||
|
||||
return self::IS_ERROR($value) && (!self::IS_NA($value));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* IS_ERROR
|
||||
*
|
||||
* @param mixed $value Value to check
|
||||
* @return boolean
|
||||
*/
|
||||
public static function IS_ERROR($value = '')
|
||||
{
|
||||
$value = self::flattenSingleValue($value);
|
||||
|
||||
if (!is_string($value)) {
|
||||
return false;
|
||||
}
|
||||
return in_array($value, array_values(self::$errorCodes));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* IS_NA
|
||||
*
|
||||
* @param mixed $value Value to check
|
||||
* @return boolean
|
||||
*/
|
||||
public static function IS_NA($value = '')
|
||||
{
|
||||
$value = self::flattenSingleValue($value);
|
||||
|
||||
return ($value === self::NA());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* IS_EVEN
|
||||
*
|
||||
* @param mixed $value Value to check
|
||||
* @return boolean
|
||||
*/
|
||||
public static function IS_EVEN($value = null)
|
||||
{
|
||||
$value = self::flattenSingleValue($value);
|
||||
|
||||
if ($value === null) {
|
||||
return self::NAME();
|
||||
} elseif ((is_bool($value)) || ((is_string($value)) && (!is_numeric($value)))) {
|
||||
return self::VALUE();
|
||||
}
|
||||
|
||||
return ($value % 2 == 0);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* IS_ODD
|
||||
*
|
||||
* @param mixed $value Value to check
|
||||
* @return boolean
|
||||
*/
|
||||
public static function IS_ODD($value = null)
|
||||
{
|
||||
$value = self::flattenSingleValue($value);
|
||||
|
||||
if ($value === null) {
|
||||
return self::NAME();
|
||||
} elseif ((is_bool($value)) || ((is_string($value)) && (!is_numeric($value)))) {
|
||||
return self::VALUE();
|
||||
}
|
||||
|
||||
return (abs($value) % 2 == 1);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* IS_NUMBER
|
||||
*
|
||||
* @param mixed $value Value to check
|
||||
* @return boolean
|
||||
*/
|
||||
public static function IS_NUMBER($value = null)
|
||||
{
|
||||
$value = self::flattenSingleValue($value);
|
||||
|
||||
if (is_string($value)) {
|
||||
return false;
|
||||
}
|
||||
return is_numeric($value);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* IS_LOGICAL
|
||||
*
|
||||
* @param mixed $value Value to check
|
||||
* @return boolean
|
||||
*/
|
||||
public static function IS_LOGICAL($value = null)
|
||||
{
|
||||
$value = self::flattenSingleValue($value);
|
||||
|
||||
return is_bool($value);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* IS_TEXT
|
||||
*
|
||||
* @param mixed $value Value to check
|
||||
* @return boolean
|
||||
*/
|
||||
public static function IS_TEXT($value = null)
|
||||
{
|
||||
$value = self::flattenSingleValue($value);
|
||||
|
||||
return (is_string($value) && !self::IS_ERROR($value));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* IS_NONTEXT
|
||||
*
|
||||
* @param mixed $value Value to check
|
||||
* @return boolean
|
||||
*/
|
||||
public static function IS_NONTEXT($value = null)
|
||||
{
|
||||
return !self::IS_TEXT($value);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* VERSION
|
||||
*
|
||||
* @return string Version information
|
||||
*/
|
||||
public static function VERSION()
|
||||
{
|
||||
return 'PHPExcel ##VERSION##, ##DATE##';
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* N
|
||||
*
|
||||
* Returns a value converted to a number
|
||||
*
|
||||
* @param value The value you want converted
|
||||
* @return number N converts values listed in the following table
|
||||
* If value is or refers to N returns
|
||||
* A number That number
|
||||
* A date The serial number of that date
|
||||
* TRUE 1
|
||||
* FALSE 0
|
||||
* An error value The error value
|
||||
* Anything else 0
|
||||
*/
|
||||
public static function N($value = null)
|
||||
{
|
||||
while (is_array($value)) {
|
||||
$value = array_shift($value);
|
||||
}
|
||||
|
||||
switch (gettype($value)) {
|
||||
case 'double':
|
||||
case 'float':
|
||||
case 'integer':
|
||||
return $value;
|
||||
case 'boolean':
|
||||
return (integer) $value;
|
||||
case 'string':
|
||||
// Errors
|
||||
if ((strlen($value) > 0) && ($value{0} == '#')) {
|
||||
return $value;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* TYPE
|
||||
*
|
||||
* Returns a number that identifies the type of a value
|
||||
*
|
||||
* @param value The value you want tested
|
||||
* @return number N converts values listed in the following table
|
||||
* If value is or refers to N returns
|
||||
* A number 1
|
||||
* Text 2
|
||||
* Logical Value 4
|
||||
* An error value 16
|
||||
* Array or Matrix 64
|
||||
*/
|
||||
public static function TYPE($value = null)
|
||||
{
|
||||
$value = self::flattenArrayIndexed($value);
|
||||
if (is_array($value) && (count($value) > 1)) {
|
||||
end($value);
|
||||
$a = key($value);
|
||||
// Range of cells is an error
|
||||
if (self::isCellValue($a)) {
|
||||
return 16;
|
||||
// Test for Matrix
|
||||
} elseif (self::isMatrixValue($a)) {
|
||||
return 64;
|
||||
}
|
||||
} elseif (empty($value)) {
|
||||
// Empty Cell
|
||||
return 1;
|
||||
}
|
||||
$value = self::flattenSingleValue($value);
|
||||
|
||||
if (($value === null) || (is_float($value)) || (is_int($value))) {
|
||||
return 1;
|
||||
} elseif (is_bool($value)) {
|
||||
return 4;
|
||||
} elseif (is_array($value)) {
|
||||
return 64;
|
||||
} elseif (is_string($value)) {
|
||||
// Errors
|
||||
if ((strlen($value) > 0) && ($value{0} == '#')) {
|
||||
return 16;
|
||||
}
|
||||
return 2;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Convert a multi-dimensional array to a simple 1-dimensional array
|
||||
*
|
||||
* @param array $array Array to be flattened
|
||||
* @return array Flattened array
|
||||
*/
|
||||
public static function flattenArray($array)
|
||||
{
|
||||
if (!is_array($array)) {
|
||||
return (array) $array;
|
||||
}
|
||||
|
||||
$arrayValues = array();
|
||||
foreach ($array as $value) {
|
||||
if (is_array($value)) {
|
||||
foreach ($value as $val) {
|
||||
if (is_array($val)) {
|
||||
foreach ($val as $v) {
|
||||
$arrayValues[] = $v;
|
||||
}
|
||||
} else {
|
||||
$arrayValues[] = $val;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$arrayValues[] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
return $arrayValues;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Convert a multi-dimensional array to a simple 1-dimensional array, but retain an element of indexing
|
||||
*
|
||||
* @param array $array Array to be flattened
|
||||
* @return array Flattened array
|
||||
*/
|
||||
public static function flattenArrayIndexed($array)
|
||||
{
|
||||
if (!is_array($array)) {
|
||||
return (array) $array;
|
||||
}
|
||||
|
||||
$arrayValues = array();
|
||||
foreach ($array as $k1 => $value) {
|
||||
if (is_array($value)) {
|
||||
foreach ($value as $k2 => $val) {
|
||||
if (is_array($val)) {
|
||||
foreach ($val as $k3 => $v) {
|
||||
$arrayValues[$k1.'.'.$k2.'.'.$k3] = $v;
|
||||
}
|
||||
} else {
|
||||
$arrayValues[$k1.'.'.$k2] = $val;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$arrayValues[$k1] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
return $arrayValues;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Convert an array to a single scalar value by extracting the first element
|
||||
*
|
||||
* @param mixed $value Array or scalar value
|
||||
* @return mixed
|
||||
*/
|
||||
public static function flattenSingleValue($value = '')
|
||||
{
|
||||
while (is_array($value)) {
|
||||
$value = array_pop($value);
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// There are a few mathematical functions that aren't available on all versions of PHP for all platforms
|
||||
// These functions aren't available in Windows implementations of PHP prior to version 5.3.0
|
||||
// So we test if they do exist for this version of PHP/operating platform; and if not we create them
|
||||
//
|
||||
if (!function_exists('acosh')) {
|
||||
function acosh($x)
|
||||
{
|
||||
return 2 * log(sqrt(($x + 1) / 2) + sqrt(($x - 1) / 2));
|
||||
} // function acosh()
|
||||
}
|
||||
|
||||
if (!function_exists('asinh')) {
|
||||
function asinh($x)
|
||||
{
|
||||
return log($x + sqrt(1 + $x * $x));
|
||||
} // function asinh()
|
||||
}
|
||||
|
||||
if (!function_exists('atanh')) {
|
||||
function atanh($x)
|
||||
{
|
||||
return (log(1 + $x) - log(1 - $x)) / 2;
|
||||
} // function atanh()
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Strangely, PHP doesn't have a mb_str_replace multibyte function
|
||||
// As we'll only ever use this function with UTF-8 characters, we can simply "hard-code" the character set
|
||||
//
|
||||
if ((!function_exists('mb_str_replace')) &&
|
||||
(function_exists('mb_substr')) && (function_exists('mb_strlen')) && (function_exists('mb_strpos'))) {
|
||||
function mb_str_replace($search, $replace, $subject)
|
||||
{
|
||||
if (is_array($subject)) {
|
||||
$ret = array();
|
||||
foreach ($subject as $key => $val) {
|
||||
$ret[$key] = mb_str_replace($search, $replace, $val);
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
foreach ((array) $search as $key => $s) {
|
||||
if ($s == '' && $s !== 0) {
|
||||
continue;
|
||||
}
|
||||
$r = !is_array($replace) ? $replace : (array_key_exists($key, $replace) ? $replace[$key] : '');
|
||||
$pos = mb_strpos($subject, $s, 0, 'UTF-8');
|
||||
while ($pos !== false) {
|
||||
$subject = mb_substr($subject, 0, $pos, 'UTF-8') . $r . mb_substr($subject, $pos + mb_strlen($s, 'UTF-8'), 65535, 'UTF-8');
|
||||
$pos = mb_strpos($subject, $s, $pos + mb_strlen($r, 'UTF-8'), 'UTF-8');
|
||||
}
|
||||
}
|
||||
return $subject;
|
||||
}
|
||||
}
|
||||
285
Cron/PHPExcel/PHPExcel/Calculation/Logical.php
Executable file
285
Cron/PHPExcel/PHPExcel/Calculation/Logical.php
Executable file
@@ -0,0 +1,285 @@
|
||||
<?php
|
||||
|
||||
/** PHPExcel root directory */
|
||||
if (!defined('PHPEXCEL_ROOT')) {
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
|
||||
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
}
|
||||
|
||||
/**
|
||||
* PHPExcel_Calculation_Logical
|
||||
*
|
||||
* Copyright (c) 2006 - 2015 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Calculation
|
||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version ##VERSION##, ##DATE##
|
||||
*/
|
||||
class PHPExcel_Calculation_Logical
|
||||
{
|
||||
/**
|
||||
* TRUE
|
||||
*
|
||||
* Returns the boolean TRUE.
|
||||
*
|
||||
* Excel Function:
|
||||
* =TRUE()
|
||||
*
|
||||
* @access public
|
||||
* @category Logical Functions
|
||||
* @return boolean True
|
||||
*/
|
||||
public static function TRUE()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* FALSE
|
||||
*
|
||||
* Returns the boolean FALSE.
|
||||
*
|
||||
* Excel Function:
|
||||
* =FALSE()
|
||||
*
|
||||
* @access public
|
||||
* @category Logical Functions
|
||||
* @return boolean False
|
||||
*/
|
||||
public static function FALSE()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* LOGICAL_AND
|
||||
*
|
||||
* Returns boolean TRUE if all its arguments are TRUE; returns FALSE if one or more argument is FALSE.
|
||||
*
|
||||
* Excel Function:
|
||||
* =AND(logical1[,logical2[, ...]])
|
||||
*
|
||||
* The arguments must evaluate to logical values such as TRUE or FALSE, or the arguments must be arrays
|
||||
* or references that contain logical values.
|
||||
*
|
||||
* Boolean arguments are treated as True or False as appropriate
|
||||
* Integer or floating point arguments are treated as True, except for 0 or 0.0 which are False
|
||||
* If any argument value is a string, or a Null, the function returns a #VALUE! error, unless the string holds
|
||||
* the value TRUE or FALSE, in which case it is evaluated as the corresponding boolean value
|
||||
*
|
||||
* @access public
|
||||
* @category Logical Functions
|
||||
* @param mixed $arg,... Data values
|
||||
* @return boolean The logical AND of the arguments.
|
||||
*/
|
||||
public static function LOGICAL_AND()
|
||||
{
|
||||
// Return value
|
||||
$returnValue = true;
|
||||
|
||||
// Loop through the arguments
|
||||
$aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
|
||||
$argCount = -1;
|
||||
foreach ($aArgs as $argCount => $arg) {
|
||||
// Is it a boolean value?
|
||||
if (is_bool($arg)) {
|
||||
$returnValue = $returnValue && $arg;
|
||||
} elseif ((is_numeric($arg)) && (!is_string($arg))) {
|
||||
$returnValue = $returnValue && ($arg != 0);
|
||||
} elseif (is_string($arg)) {
|
||||
$arg = strtoupper($arg);
|
||||
if (($arg == 'TRUE') || ($arg == PHPExcel_Calculation::getTRUE())) {
|
||||
$arg = true;
|
||||
} elseif (($arg == 'FALSE') || ($arg == PHPExcel_Calculation::getFALSE())) {
|
||||
$arg = false;
|
||||
} else {
|
||||
return PHPExcel_Calculation_Functions::VALUE();
|
||||
}
|
||||
$returnValue = $returnValue && ($arg != 0);
|
||||
}
|
||||
}
|
||||
|
||||
// Return
|
||||
if ($argCount < 0) {
|
||||
return PHPExcel_Calculation_Functions::VALUE();
|
||||
}
|
||||
return $returnValue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* LOGICAL_OR
|
||||
*
|
||||
* Returns boolean TRUE if any argument is TRUE; returns FALSE if all arguments are FALSE.
|
||||
*
|
||||
* Excel Function:
|
||||
* =OR(logical1[,logical2[, ...]])
|
||||
*
|
||||
* The arguments must evaluate to logical values such as TRUE or FALSE, or the arguments must be arrays
|
||||
* or references that contain logical values.
|
||||
*
|
||||
* Boolean arguments are treated as True or False as appropriate
|
||||
* Integer or floating point arguments are treated as True, except for 0 or 0.0 which are False
|
||||
* If any argument value is a string, or a Null, the function returns a #VALUE! error, unless the string holds
|
||||
* the value TRUE or FALSE, in which case it is evaluated as the corresponding boolean value
|
||||
*
|
||||
* @access public
|
||||
* @category Logical Functions
|
||||
* @param mixed $arg,... Data values
|
||||
* @return boolean The logical OR of the arguments.
|
||||
*/
|
||||
public static function LOGICAL_OR()
|
||||
{
|
||||
// Return value
|
||||
$returnValue = false;
|
||||
|
||||
// Loop through the arguments
|
||||
$aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
|
||||
$argCount = -1;
|
||||
foreach ($aArgs as $argCount => $arg) {
|
||||
// Is it a boolean value?
|
||||
if (is_bool($arg)) {
|
||||
$returnValue = $returnValue || $arg;
|
||||
} elseif ((is_numeric($arg)) && (!is_string($arg))) {
|
||||
$returnValue = $returnValue || ($arg != 0);
|
||||
} elseif (is_string($arg)) {
|
||||
$arg = strtoupper($arg);
|
||||
if (($arg == 'TRUE') || ($arg == PHPExcel_Calculation::getTRUE())) {
|
||||
$arg = true;
|
||||
} elseif (($arg == 'FALSE') || ($arg == PHPExcel_Calculation::getFALSE())) {
|
||||
$arg = false;
|
||||
} else {
|
||||
return PHPExcel_Calculation_Functions::VALUE();
|
||||
}
|
||||
$returnValue = $returnValue || ($arg != 0);
|
||||
}
|
||||
}
|
||||
|
||||
// Return
|
||||
if ($argCount < 0) {
|
||||
return PHPExcel_Calculation_Functions::VALUE();
|
||||
}
|
||||
return $returnValue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* NOT
|
||||
*
|
||||
* Returns the boolean inverse of the argument.
|
||||
*
|
||||
* Excel Function:
|
||||
* =NOT(logical)
|
||||
*
|
||||
* The argument must evaluate to a logical value such as TRUE or FALSE
|
||||
*
|
||||
* Boolean arguments are treated as True or False as appropriate
|
||||
* Integer or floating point arguments are treated as True, except for 0 or 0.0 which are False
|
||||
* If any argument value is a string, or a Null, the function returns a #VALUE! error, unless the string holds
|
||||
* the value TRUE or FALSE, in which case it is evaluated as the corresponding boolean value
|
||||
*
|
||||
* @access public
|
||||
* @category Logical Functions
|
||||
* @param mixed $logical A value or expression that can be evaluated to TRUE or FALSE
|
||||
* @return boolean The boolean inverse of the argument.
|
||||
*/
|
||||
public static function NOT($logical = false)
|
||||
{
|
||||
$logical = PHPExcel_Calculation_Functions::flattenSingleValue($logical);
|
||||
if (is_string($logical)) {
|
||||
$logical = strtoupper($logical);
|
||||
if (($logical == 'TRUE') || ($logical == PHPExcel_Calculation::getTRUE())) {
|
||||
return false;
|
||||
} elseif (($logical == 'FALSE') || ($logical == PHPExcel_Calculation::getFALSE())) {
|
||||
return true;
|
||||
} else {
|
||||
return PHPExcel_Calculation_Functions::VALUE();
|
||||
}
|
||||
}
|
||||
|
||||
return !$logical;
|
||||
}
|
||||
|
||||
/**
|
||||
* STATEMENT_IF
|
||||
*
|
||||
* Returns one value if a condition you specify evaluates to TRUE and another value if it evaluates to FALSE.
|
||||
*
|
||||
* Excel Function:
|
||||
* =IF(condition[,returnIfTrue[,returnIfFalse]])
|
||||
*
|
||||
* Condition is any value or expression that can be evaluated to TRUE or FALSE.
|
||||
* For example, A10=100 is a logical expression; if the value in cell A10 is equal to 100,
|
||||
* the expression evaluates to TRUE. Otherwise, the expression evaluates to FALSE.
|
||||
* This argument can use any comparison calculation operator.
|
||||
* ReturnIfTrue is the value that is returned if condition evaluates to TRUE.
|
||||
* For example, if this argument is the text string "Within budget" and the condition argument evaluates to TRUE,
|
||||
* then the IF function returns the text "Within budget"
|
||||
* If condition is TRUE and ReturnIfTrue is blank, this argument returns 0 (zero). To display the word TRUE, use
|
||||
* the logical value TRUE for this argument.
|
||||
* ReturnIfTrue can be another formula.
|
||||
* ReturnIfFalse is the value that is returned if condition evaluates to FALSE.
|
||||
* For example, if this argument is the text string "Over budget" and the condition argument evaluates to FALSE,
|
||||
* then the IF function returns the text "Over budget".
|
||||
* If condition is FALSE and ReturnIfFalse is omitted, then the logical value FALSE is returned.
|
||||
* If condition is FALSE and ReturnIfFalse is blank, then the value 0 (zero) is returned.
|
||||
* ReturnIfFalse can be another formula.
|
||||
*
|
||||
* @access public
|
||||
* @category Logical Functions
|
||||
* @param mixed $condition Condition to evaluate
|
||||
* @param mixed $returnIfTrue Value to return when condition is true
|
||||
* @param mixed $returnIfFalse Optional value to return when condition is false
|
||||
* @return mixed The value of returnIfTrue or returnIfFalse determined by condition
|
||||
*/
|
||||
public static function STATEMENT_IF($condition = true, $returnIfTrue = 0, $returnIfFalse = false)
|
||||
{
|
||||
$condition = (is_null($condition)) ? true : (boolean) PHPExcel_Calculation_Functions::flattenSingleValue($condition);
|
||||
$returnIfTrue = (is_null($returnIfTrue)) ? 0 : PHPExcel_Calculation_Functions::flattenSingleValue($returnIfTrue);
|
||||
$returnIfFalse = (is_null($returnIfFalse)) ? false : PHPExcel_Calculation_Functions::flattenSingleValue($returnIfFalse);
|
||||
|
||||
return ($condition) ? $returnIfTrue : $returnIfFalse;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* IFERROR
|
||||
*
|
||||
* Excel Function:
|
||||
* =IFERROR(testValue,errorpart)
|
||||
*
|
||||
* @access public
|
||||
* @category Logical Functions
|
||||
* @param mixed $testValue Value to check, is also the value returned when no error
|
||||
* @param mixed $errorpart Value to return when testValue is an error condition
|
||||
* @return mixed The value of errorpart or testValue determined by error condition
|
||||
*/
|
||||
public static function IFERROR($testValue = '', $errorpart = '')
|
||||
{
|
||||
$testValue = (is_null($testValue)) ? '' : PHPExcel_Calculation_Functions::flattenSingleValue($testValue);
|
||||
$errorpart = (is_null($errorpart)) ? '' : PHPExcel_Calculation_Functions::flattenSingleValue($errorpart);
|
||||
|
||||
return self::STATEMENT_IF(PHPExcel_Calculation_Functions::IS_ERROR($testValue), $errorpart, $testValue);
|
||||
}
|
||||
}
|
||||
879
Cron/PHPExcel/PHPExcel/Calculation/LookupRef.php
Executable file
879
Cron/PHPExcel/PHPExcel/Calculation/LookupRef.php
Executable file
@@ -0,0 +1,879 @@
|
||||
<?php
|
||||
|
||||
/** PHPExcel root directory */
|
||||
if (!defined('PHPEXCEL_ROOT')) {
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
|
||||
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
}
|
||||
|
||||
/**
|
||||
* PHPExcel_Calculation_LookupRef
|
||||
*
|
||||
* Copyright (c) 2006 - 2015 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Calculation
|
||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version ##VERSION##, ##DATE##
|
||||
*/
|
||||
class PHPExcel_Calculation_LookupRef
|
||||
{
|
||||
/**
|
||||
* CELL_ADDRESS
|
||||
*
|
||||
* Creates a cell address as text, given specified row and column numbers.
|
||||
*
|
||||
* Excel Function:
|
||||
* =ADDRESS(row, column, [relativity], [referenceStyle], [sheetText])
|
||||
*
|
||||
* @param row Row number to use in the cell reference
|
||||
* @param column Column number to use in the cell reference
|
||||
* @param relativity Flag indicating the type of reference to return
|
||||
* 1 or omitted Absolute
|
||||
* 2 Absolute row; relative column
|
||||
* 3 Relative row; absolute column
|
||||
* 4 Relative
|
||||
* @param referenceStyle A logical value that specifies the A1 or R1C1 reference style.
|
||||
* TRUE or omitted CELL_ADDRESS returns an A1-style reference
|
||||
* FALSE CELL_ADDRESS returns an R1C1-style reference
|
||||
* @param sheetText Optional Name of worksheet to use
|
||||
* @return string
|
||||
*/
|
||||
public static function CELL_ADDRESS($row, $column, $relativity = 1, $referenceStyle = true, $sheetText = '')
|
||||
{
|
||||
$row = PHPExcel_Calculation_Functions::flattenSingleValue($row);
|
||||
$column = PHPExcel_Calculation_Functions::flattenSingleValue($column);
|
||||
$relativity = PHPExcel_Calculation_Functions::flattenSingleValue($relativity);
|
||||
$sheetText = PHPExcel_Calculation_Functions::flattenSingleValue($sheetText);
|
||||
|
||||
if (($row < 1) || ($column < 1)) {
|
||||
return PHPExcel_Calculation_Functions::VALUE();
|
||||
}
|
||||
|
||||
if ($sheetText > '') {
|
||||
if (strpos($sheetText, ' ') !== false) {
|
||||
$sheetText = "'".$sheetText."'";
|
||||
}
|
||||
$sheetText .='!';
|
||||
}
|
||||
if ((!is_bool($referenceStyle)) || $referenceStyle) {
|
||||
$rowRelative = $columnRelative = '$';
|
||||
$column = PHPExcel_Cell::stringFromColumnIndex($column-1);
|
||||
if (($relativity == 2) || ($relativity == 4)) {
|
||||
$columnRelative = '';
|
||||
}
|
||||
if (($relativity == 3) || ($relativity == 4)) {
|
||||
$rowRelative = '';
|
||||
}
|
||||
return $sheetText.$columnRelative.$column.$rowRelative.$row;
|
||||
} else {
|
||||
if (($relativity == 2) || ($relativity == 4)) {
|
||||
$column = '['.$column.']';
|
||||
}
|
||||
if (($relativity == 3) || ($relativity == 4)) {
|
||||
$row = '['.$row.']';
|
||||
}
|
||||
return $sheetText.'R'.$row.'C'.$column;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* COLUMN
|
||||
*
|
||||
* Returns the column number of the given cell reference
|
||||
* If the cell reference is a range of cells, COLUMN returns the column numbers of each column in the reference as a horizontal array.
|
||||
* If cell reference is omitted, and the function is being called through the calculation engine, then it is assumed to be the
|
||||
* reference of the cell in which the COLUMN function appears; otherwise this function returns 0.
|
||||
*
|
||||
* Excel Function:
|
||||
* =COLUMN([cellAddress])
|
||||
*
|
||||
* @param cellAddress A reference to a range of cells for which you want the column numbers
|
||||
* @return integer or array of integer
|
||||
*/
|
||||
public static function COLUMN($cellAddress = null)
|
||||
{
|
||||
if (is_null($cellAddress) || trim($cellAddress) === '') {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (is_array($cellAddress)) {
|
||||
foreach ($cellAddress as $columnKey => $value) {
|
||||
$columnKey = preg_replace('/[^a-z]/i', '', $columnKey);
|
||||
return (integer) PHPExcel_Cell::columnIndexFromString($columnKey);
|
||||
}
|
||||
} else {
|
||||
if (strpos($cellAddress, '!') !== false) {
|
||||
list($sheet, $cellAddress) = explode('!', $cellAddress);
|
||||
}
|
||||
if (strpos($cellAddress, ':') !== false) {
|
||||
list($startAddress, $endAddress) = explode(':', $cellAddress);
|
||||
$startAddress = preg_replace('/[^a-z]/i', '', $startAddress);
|
||||
$endAddress = preg_replace('/[^a-z]/i', '', $endAddress);
|
||||
$returnValue = array();
|
||||
do {
|
||||
$returnValue[] = (integer) PHPExcel_Cell::columnIndexFromString($startAddress);
|
||||
} while ($startAddress++ != $endAddress);
|
||||
return $returnValue;
|
||||
} else {
|
||||
$cellAddress = preg_replace('/[^a-z]/i', '', $cellAddress);
|
||||
return (integer) PHPExcel_Cell::columnIndexFromString($cellAddress);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* COLUMNS
|
||||
*
|
||||
* Returns the number of columns in an array or reference.
|
||||
*
|
||||
* Excel Function:
|
||||
* =COLUMNS(cellAddress)
|
||||
*
|
||||
* @param cellAddress An array or array formula, or a reference to a range of cells for which you want the number of columns
|
||||
* @return integer The number of columns in cellAddress
|
||||
*/
|
||||
public static function COLUMNS($cellAddress = null)
|
||||
{
|
||||
if (is_null($cellAddress) || $cellAddress === '') {
|
||||
return 1;
|
||||
} elseif (!is_array($cellAddress)) {
|
||||
return PHPExcel_Calculation_Functions::VALUE();
|
||||
}
|
||||
|
||||
reset($cellAddress);
|
||||
$isMatrix = (is_numeric(key($cellAddress)));
|
||||
list($columns, $rows) = PHPExcel_Calculation::_getMatrixDimensions($cellAddress);
|
||||
|
||||
if ($isMatrix) {
|
||||
return $rows;
|
||||
} else {
|
||||
return $columns;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* ROW
|
||||
*
|
||||
* Returns the row number of the given cell reference
|
||||
* If the cell reference is a range of cells, ROW returns the row numbers of each row in the reference as a vertical array.
|
||||
* If cell reference is omitted, and the function is being called through the calculation engine, then it is assumed to be the
|
||||
* reference of the cell in which the ROW function appears; otherwise this function returns 0.
|
||||
*
|
||||
* Excel Function:
|
||||
* =ROW([cellAddress])
|
||||
*
|
||||
* @param cellAddress A reference to a range of cells for which you want the row numbers
|
||||
* @return integer or array of integer
|
||||
*/
|
||||
public static function ROW($cellAddress = null)
|
||||
{
|
||||
if (is_null($cellAddress) || trim($cellAddress) === '') {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (is_array($cellAddress)) {
|
||||
foreach ($cellAddress as $columnKey => $rowValue) {
|
||||
foreach ($rowValue as $rowKey => $cellValue) {
|
||||
return (integer) preg_replace('/[^0-9]/i', '', $rowKey);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (strpos($cellAddress, '!') !== false) {
|
||||
list($sheet, $cellAddress) = explode('!', $cellAddress);
|
||||
}
|
||||
if (strpos($cellAddress, ':') !== false) {
|
||||
list($startAddress, $endAddress) = explode(':', $cellAddress);
|
||||
$startAddress = preg_replace('/[^0-9]/', '', $startAddress);
|
||||
$endAddress = preg_replace('/[^0-9]/', '', $endAddress);
|
||||
$returnValue = array();
|
||||
do {
|
||||
$returnValue[][] = (integer) $startAddress;
|
||||
} while ($startAddress++ != $endAddress);
|
||||
return $returnValue;
|
||||
} else {
|
||||
list($cellAddress) = explode(':', $cellAddress);
|
||||
return (integer) preg_replace('/[^0-9]/', '', $cellAddress);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* ROWS
|
||||
*
|
||||
* Returns the number of rows in an array or reference.
|
||||
*
|
||||
* Excel Function:
|
||||
* =ROWS(cellAddress)
|
||||
*
|
||||
* @param cellAddress An array or array formula, or a reference to a range of cells for which you want the number of rows
|
||||
* @return integer The number of rows in cellAddress
|
||||
*/
|
||||
public static function ROWS($cellAddress = null)
|
||||
{
|
||||
if (is_null($cellAddress) || $cellAddress === '') {
|
||||
return 1;
|
||||
} elseif (!is_array($cellAddress)) {
|
||||
return PHPExcel_Calculation_Functions::VALUE();
|
||||
}
|
||||
|
||||
reset($cellAddress);
|
||||
$isMatrix = (is_numeric(key($cellAddress)));
|
||||
list($columns, $rows) = PHPExcel_Calculation::_getMatrixDimensions($cellAddress);
|
||||
|
||||
if ($isMatrix) {
|
||||
return $columns;
|
||||
} else {
|
||||
return $rows;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* HYPERLINK
|
||||
*
|
||||
* Excel Function:
|
||||
* =HYPERLINK(linkURL,displayName)
|
||||
*
|
||||
* @access public
|
||||
* @category Logical Functions
|
||||
* @param string $linkURL Value to check, is also the value returned when no error
|
||||
* @param string $displayName Value to return when testValue is an error condition
|
||||
* @param PHPExcel_Cell $pCell The cell to set the hyperlink in
|
||||
* @return mixed The value of $displayName (or $linkURL if $displayName was blank)
|
||||
*/
|
||||
public static function HYPERLINK($linkURL = '', $displayName = null, PHPExcel_Cell $pCell = null)
|
||||
{
|
||||
$args = func_get_args();
|
||||
$pCell = array_pop($args);
|
||||
|
||||
$linkURL = (is_null($linkURL)) ? '' : PHPExcel_Calculation_Functions::flattenSingleValue($linkURL);
|
||||
$displayName = (is_null($displayName)) ? '' : PHPExcel_Calculation_Functions::flattenSingleValue($displayName);
|
||||
|
||||
if ((!is_object($pCell)) || (trim($linkURL) == '')) {
|
||||
return PHPExcel_Calculation_Functions::REF();
|
||||
}
|
||||
|
||||
if ((is_object($displayName)) || trim($displayName) == '') {
|
||||
$displayName = $linkURL;
|
||||
}
|
||||
|
||||
$pCell->getHyperlink()->setUrl($linkURL);
|
||||
$pCell->getHyperlink()->setTooltip($displayName);
|
||||
|
||||
return $displayName;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* INDIRECT
|
||||
*
|
||||
* Returns the reference specified by a text string.
|
||||
* References are immediately evaluated to display their contents.
|
||||
*
|
||||
* Excel Function:
|
||||
* =INDIRECT(cellAddress)
|
||||
*
|
||||
* NOTE - INDIRECT() does not yet support the optional a1 parameter introduced in Excel 2010
|
||||
*
|
||||
* @param cellAddress $cellAddress The cell address of the current cell (containing this formula)
|
||||
* @param PHPExcel_Cell $pCell The current cell (containing this formula)
|
||||
* @return mixed The cells referenced by cellAddress
|
||||
*
|
||||
* @todo Support for the optional a1 parameter introduced in Excel 2010
|
||||
*
|
||||
*/
|
||||
public static function INDIRECT($cellAddress = null, PHPExcel_Cell $pCell = null)
|
||||
{
|
||||
$cellAddress = PHPExcel_Calculation_Functions::flattenSingleValue($cellAddress);
|
||||
if (is_null($cellAddress) || $cellAddress === '') {
|
||||
return PHPExcel_Calculation_Functions::REF();
|
||||
}
|
||||
|
||||
$cellAddress1 = $cellAddress;
|
||||
$cellAddress2 = null;
|
||||
if (strpos($cellAddress, ':') !== false) {
|
||||
list($cellAddress1, $cellAddress2) = explode(':', $cellAddress);
|
||||
}
|
||||
|
||||
if ((!preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $cellAddress1, $matches)) ||
|
||||
((!is_null($cellAddress2)) && (!preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $cellAddress2, $matches)))) {
|
||||
if (!preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_NAMEDRANGE.'$/i', $cellAddress1, $matches)) {
|
||||
return PHPExcel_Calculation_Functions::REF();
|
||||
}
|
||||
|
||||
if (strpos($cellAddress, '!') !== false) {
|
||||
list($sheetName, $cellAddress) = explode('!', $cellAddress);
|
||||
$sheetName = trim($sheetName, "'");
|
||||
$pSheet = $pCell->getWorksheet()->getParent()->getSheetByName($sheetName);
|
||||
} else {
|
||||
$pSheet = $pCell->getWorksheet();
|
||||
}
|
||||
|
||||
return PHPExcel_Calculation::getInstance()->extractNamedRange($cellAddress, $pSheet, false);
|
||||
}
|
||||
|
||||
if (strpos($cellAddress, '!') !== false) {
|
||||
list($sheetName, $cellAddress) = explode('!', $cellAddress);
|
||||
$sheetName = trim($sheetName, "'");
|
||||
$pSheet = $pCell->getWorksheet()->getParent()->getSheetByName($sheetName);
|
||||
} else {
|
||||
$pSheet = $pCell->getWorksheet();
|
||||
}
|
||||
|
||||
return PHPExcel_Calculation::getInstance()->extractCellRange($cellAddress, $pSheet, false);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* OFFSET
|
||||
*
|
||||
* Returns a reference to a range that is a specified number of rows and columns from a cell or range of cells.
|
||||
* The reference that is returned can be a single cell or a range of cells. You can specify the number of rows and
|
||||
* the number of columns to be returned.
|
||||
*
|
||||
* Excel Function:
|
||||
* =OFFSET(cellAddress, rows, cols, [height], [width])
|
||||
*
|
||||
* @param cellAddress The reference from which you want to base the offset. Reference must refer to a cell or
|
||||
* range of adjacent cells; otherwise, OFFSET returns the #VALUE! error value.
|
||||
* @param rows The number of rows, up or down, that you want the upper-left cell to refer to.
|
||||
* Using 5 as the rows argument specifies that the upper-left cell in the reference is
|
||||
* five rows below reference. Rows can be positive (which means below the starting reference)
|
||||
* or negative (which means above the starting reference).
|
||||
* @param cols The number of columns, to the left or right, that you want the upper-left cell of the result
|
||||
* to refer to. Using 5 as the cols argument specifies that the upper-left cell in the
|
||||
* reference is five columns to the right of reference. Cols can be positive (which means
|
||||
* to the right of the starting reference) or negative (which means to the left of the
|
||||
* starting reference).
|
||||
* @param height The height, in number of rows, that you want the returned reference to be. Height must be a positive number.
|
||||
* @param width The width, in number of columns, that you want the returned reference to be. Width must be a positive number.
|
||||
* @return string A reference to a cell or range of cells
|
||||
*/
|
||||
public static function OFFSET($cellAddress = null, $rows = 0, $columns = 0, $height = null, $width = null)
|
||||
{
|
||||
$rows = PHPExcel_Calculation_Functions::flattenSingleValue($rows);
|
||||
$columns = PHPExcel_Calculation_Functions::flattenSingleValue($columns);
|
||||
$height = PHPExcel_Calculation_Functions::flattenSingleValue($height);
|
||||
$width = PHPExcel_Calculation_Functions::flattenSingleValue($width);
|
||||
if ($cellAddress == null) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
$args = func_get_args();
|
||||
$pCell = array_pop($args);
|
||||
if (!is_object($pCell)) {
|
||||
return PHPExcel_Calculation_Functions::REF();
|
||||
}
|
||||
|
||||
$sheetName = null;
|
||||
if (strpos($cellAddress, "!")) {
|
||||
list($sheetName, $cellAddress) = explode("!", $cellAddress);
|
||||
$sheetName = trim($sheetName, "'");
|
||||
}
|
||||
if (strpos($cellAddress, ":")) {
|
||||
list($startCell, $endCell) = explode(":", $cellAddress);
|
||||
} else {
|
||||
$startCell = $endCell = $cellAddress;
|
||||
}
|
||||
list($startCellColumn, $startCellRow) = PHPExcel_Cell::coordinateFromString($startCell);
|
||||
list($endCellColumn, $endCellRow) = PHPExcel_Cell::coordinateFromString($endCell);
|
||||
|
||||
$startCellRow += $rows;
|
||||
$startCellColumn = PHPExcel_Cell::columnIndexFromString($startCellColumn) - 1;
|
||||
$startCellColumn += $columns;
|
||||
|
||||
if (($startCellRow <= 0) || ($startCellColumn < 0)) {
|
||||
return PHPExcel_Calculation_Functions::REF();
|
||||
}
|
||||
$endCellColumn = PHPExcel_Cell::columnIndexFromString($endCellColumn) - 1;
|
||||
if (($width != null) && (!is_object($width))) {
|
||||
$endCellColumn = $startCellColumn + $width - 1;
|
||||
} else {
|
||||
$endCellColumn += $columns;
|
||||
}
|
||||
$startCellColumn = PHPExcel_Cell::stringFromColumnIndex($startCellColumn);
|
||||
|
||||
if (($height != null) && (!is_object($height))) {
|
||||
$endCellRow = $startCellRow + $height - 1;
|
||||
} else {
|
||||
$endCellRow += $rows;
|
||||
}
|
||||
|
||||
if (($endCellRow <= 0) || ($endCellColumn < 0)) {
|
||||
return PHPExcel_Calculation_Functions::REF();
|
||||
}
|
||||
$endCellColumn = PHPExcel_Cell::stringFromColumnIndex($endCellColumn);
|
||||
|
||||
$cellAddress = $startCellColumn.$startCellRow;
|
||||
if (($startCellColumn != $endCellColumn) || ($startCellRow != $endCellRow)) {
|
||||
$cellAddress .= ':'.$endCellColumn.$endCellRow;
|
||||
}
|
||||
|
||||
if ($sheetName !== null) {
|
||||
$pSheet = $pCell->getWorksheet()->getParent()->getSheetByName($sheetName);
|
||||
} else {
|
||||
$pSheet = $pCell->getWorksheet();
|
||||
}
|
||||
|
||||
return PHPExcel_Calculation::getInstance()->extractCellRange($cellAddress, $pSheet, false);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* CHOOSE
|
||||
*
|
||||
* Uses lookup_value to return a value from the list of value arguments.
|
||||
* Use CHOOSE to select one of up to 254 values based on the lookup_value.
|
||||
*
|
||||
* Excel Function:
|
||||
* =CHOOSE(index_num, value1, [value2], ...)
|
||||
*
|
||||
* @param index_num Specifies which value argument is selected.
|
||||
* Index_num must be a number between 1 and 254, or a formula or reference to a cell containing a number
|
||||
* between 1 and 254.
|
||||
* @param value1... Value1 is required, subsequent values are optional.
|
||||
* Between 1 to 254 value arguments from which CHOOSE selects a value or an action to perform based on
|
||||
* index_num. The arguments can be numbers, cell references, defined names, formulas, functions, or
|
||||
* text.
|
||||
* @return mixed The selected value
|
||||
*/
|
||||
public static function CHOOSE()
|
||||
{
|
||||
$chooseArgs = func_get_args();
|
||||
$chosenEntry = PHPExcel_Calculation_Functions::flattenArray(array_shift($chooseArgs));
|
||||
$entryCount = count($chooseArgs) - 1;
|
||||
|
||||
if (is_array($chosenEntry)) {
|
||||
$chosenEntry = array_shift($chosenEntry);
|
||||
}
|
||||
if ((is_numeric($chosenEntry)) && (!is_bool($chosenEntry))) {
|
||||
--$chosenEntry;
|
||||
} else {
|
||||
return PHPExcel_Calculation_Functions::VALUE();
|
||||
}
|
||||
$chosenEntry = floor($chosenEntry);
|
||||
if (($chosenEntry < 0) || ($chosenEntry > $entryCount)) {
|
||||
return PHPExcel_Calculation_Functions::VALUE();
|
||||
}
|
||||
|
||||
if (is_array($chooseArgs[$chosenEntry])) {
|
||||
return PHPExcel_Calculation_Functions::flattenArray($chooseArgs[$chosenEntry]);
|
||||
} else {
|
||||
return $chooseArgs[$chosenEntry];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* MATCH
|
||||
*
|
||||
* The MATCH function searches for a specified item in a range of cells
|
||||
*
|
||||
* Excel Function:
|
||||
* =MATCH(lookup_value, lookup_array, [match_type])
|
||||
*
|
||||
* @param lookup_value The value that you want to match in lookup_array
|
||||
* @param lookup_array The range of cells being searched
|
||||
* @param match_type The number -1, 0, or 1. -1 means above, 0 means exact match, 1 means below. If match_type is 1 or -1, the list has to be ordered.
|
||||
* @return integer The relative position of the found item
|
||||
*/
|
||||
public static function MATCH($lookup_value, $lookup_array, $match_type = 1)
|
||||
{
|
||||
$lookup_array = PHPExcel_Calculation_Functions::flattenArray($lookup_array);
|
||||
$lookup_value = PHPExcel_Calculation_Functions::flattenSingleValue($lookup_value);
|
||||
$match_type = (is_null($match_type)) ? 1 : (int) PHPExcel_Calculation_Functions::flattenSingleValue($match_type);
|
||||
// MATCH is not case sensitive
|
||||
$lookup_value = strtolower($lookup_value);
|
||||
|
||||
// lookup_value type has to be number, text, or logical values
|
||||
if ((!is_numeric($lookup_value)) && (!is_string($lookup_value)) && (!is_bool($lookup_value))) {
|
||||
return PHPExcel_Calculation_Functions::NA();
|
||||
}
|
||||
|
||||
// match_type is 0, 1 or -1
|
||||
if (($match_type !== 0) && ($match_type !== -1) && ($match_type !== 1)) {
|
||||
return PHPExcel_Calculation_Functions::NA();
|
||||
}
|
||||
|
||||
// lookup_array should not be empty
|
||||
$lookupArraySize = count($lookup_array);
|
||||
if ($lookupArraySize <= 0) {
|
||||
return PHPExcel_Calculation_Functions::NA();
|
||||
}
|
||||
|
||||
// lookup_array should contain only number, text, or logical values, or empty (null) cells
|
||||
foreach ($lookup_array as $i => $lookupArrayValue) {
|
||||
// check the type of the value
|
||||
if ((!is_numeric($lookupArrayValue)) && (!is_string($lookupArrayValue)) &&
|
||||
(!is_bool($lookupArrayValue)) && (!is_null($lookupArrayValue))) {
|
||||
return PHPExcel_Calculation_Functions::NA();
|
||||
}
|
||||
// convert strings to lowercase for case-insensitive testing
|
||||
if (is_string($lookupArrayValue)) {
|
||||
$lookup_array[$i] = strtolower($lookupArrayValue);
|
||||
}
|
||||
if ((is_null($lookupArrayValue)) && (($match_type == 1) || ($match_type == -1))) {
|
||||
$lookup_array = array_slice($lookup_array, 0, $i-1);
|
||||
}
|
||||
}
|
||||
|
||||
// if match_type is 1 or -1, the list has to be ordered
|
||||
if ($match_type == 1) {
|
||||
asort($lookup_array);
|
||||
$keySet = array_keys($lookup_array);
|
||||
} elseif ($match_type == -1) {
|
||||
arsort($lookup_array);
|
||||
$keySet = array_keys($lookup_array);
|
||||
}
|
||||
|
||||
// **
|
||||
// find the match
|
||||
// **
|
||||
foreach ($lookup_array as $i => $lookupArrayValue) {
|
||||
if (($match_type == 0) && ($lookupArrayValue == $lookup_value)) {
|
||||
// exact match
|
||||
return ++$i;
|
||||
} elseif (($match_type == -1) && ($lookupArrayValue <= $lookup_value)) {
|
||||
$i = array_search($i, $keySet);
|
||||
// if match_type is -1 <=> find the smallest value that is greater than or equal to lookup_value
|
||||
if ($i < 1) {
|
||||
// 1st cell was already smaller than the lookup_value
|
||||
break;
|
||||
} else {
|
||||
// the previous cell was the match
|
||||
return $keySet[$i-1]+1;
|
||||
}
|
||||
} elseif (($match_type == 1) && ($lookupArrayValue >= $lookup_value)) {
|
||||
$i = array_search($i, $keySet);
|
||||
// if match_type is 1 <=> find the largest value that is less than or equal to lookup_value
|
||||
if ($i < 1) {
|
||||
// 1st cell was already bigger than the lookup_value
|
||||
break;
|
||||
} else {
|
||||
// the previous cell was the match
|
||||
return $keySet[$i-1]+1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// unsuccessful in finding a match, return #N/A error value
|
||||
return PHPExcel_Calculation_Functions::NA();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* INDEX
|
||||
*
|
||||
* Uses an index to choose a value from a reference or array
|
||||
*
|
||||
* Excel Function:
|
||||
* =INDEX(range_array, row_num, [column_num])
|
||||
*
|
||||
* @param range_array A range of cells or an array constant
|
||||
* @param row_num The row in array from which to return a value. If row_num is omitted, column_num is required.
|
||||
* @param column_num The column in array from which to return a value. If column_num is omitted, row_num is required.
|
||||
* @return mixed the value of a specified cell or array of cells
|
||||
*/
|
||||
public static function INDEX($arrayValues, $rowNum = 0, $columnNum = 0)
|
||||
{
|
||||
if (($rowNum < 0) || ($columnNum < 0)) {
|
||||
return PHPExcel_Calculation_Functions::VALUE();
|
||||
}
|
||||
|
||||
if (!is_array($arrayValues)) {
|
||||
return PHPExcel_Calculation_Functions::REF();
|
||||
}
|
||||
|
||||
$rowKeys = array_keys($arrayValues);
|
||||
$columnKeys = @array_keys($arrayValues[$rowKeys[0]]);
|
||||
|
||||
if ($columnNum > count($columnKeys)) {
|
||||
return PHPExcel_Calculation_Functions::VALUE();
|
||||
} elseif ($columnNum == 0) {
|
||||
if ($rowNum == 0) {
|
||||
return $arrayValues;
|
||||
}
|
||||
$rowNum = $rowKeys[--$rowNum];
|
||||
$returnArray = array();
|
||||
foreach ($arrayValues as $arrayColumn) {
|
||||
if (is_array($arrayColumn)) {
|
||||
if (isset($arrayColumn[$rowNum])) {
|
||||
$returnArray[] = $arrayColumn[$rowNum];
|
||||
} else {
|
||||
return $arrayValues[$rowNum];
|
||||
}
|
||||
} else {
|
||||
return $arrayValues[$rowNum];
|
||||
}
|
||||
}
|
||||
return $returnArray;
|
||||
}
|
||||
$columnNum = $columnKeys[--$columnNum];
|
||||
if ($rowNum > count($rowKeys)) {
|
||||
return PHPExcel_Calculation_Functions::VALUE();
|
||||
} elseif ($rowNum == 0) {
|
||||
return $arrayValues[$columnNum];
|
||||
}
|
||||
$rowNum = $rowKeys[--$rowNum];
|
||||
|
||||
return $arrayValues[$rowNum][$columnNum];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* TRANSPOSE
|
||||
*
|
||||
* @param array $matrixData A matrix of values
|
||||
* @return array
|
||||
*
|
||||
* Unlike the Excel TRANSPOSE function, which will only work on a single row or column, this function will transpose a full matrix.
|
||||
*/
|
||||
public static function TRANSPOSE($matrixData)
|
||||
{
|
||||
$returnMatrix = array();
|
||||
if (!is_array($matrixData)) {
|
||||
$matrixData = array(array($matrixData));
|
||||
}
|
||||
|
||||
$column = 0;
|
||||
foreach ($matrixData as $matrixRow) {
|
||||
$row = 0;
|
||||
foreach ($matrixRow as $matrixCell) {
|
||||
$returnMatrix[$row][$column] = $matrixCell;
|
||||
++$row;
|
||||
}
|
||||
++$column;
|
||||
}
|
||||
return $returnMatrix;
|
||||
}
|
||||
|
||||
|
||||
private static function vlookupSort($a, $b)
|
||||
{
|
||||
reset($a);
|
||||
$firstColumn = key($a);
|
||||
if (($aLower = strtolower($a[$firstColumn])) == ($bLower = strtolower($b[$firstColumn]))) {
|
||||
return 0;
|
||||
}
|
||||
return ($aLower < $bLower) ? -1 : 1;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* VLOOKUP
|
||||
* The VLOOKUP function searches for value in the left-most column of lookup_array and returns the value in the same row based on the index_number.
|
||||
* @param lookup_value The value that you want to match in lookup_array
|
||||
* @param lookup_array The range of cells being searched
|
||||
* @param index_number The column number in table_array from which the matching value must be returned. The first column is 1.
|
||||
* @param not_exact_match Determines if you are looking for an exact match based on lookup_value.
|
||||
* @return mixed The value of the found cell
|
||||
*/
|
||||
public static function VLOOKUP($lookup_value, $lookup_array, $index_number, $not_exact_match = true)
|
||||
{
|
||||
$lookup_value = PHPExcel_Calculation_Functions::flattenSingleValue($lookup_value);
|
||||
$index_number = PHPExcel_Calculation_Functions::flattenSingleValue($index_number);
|
||||
$not_exact_match = PHPExcel_Calculation_Functions::flattenSingleValue($not_exact_match);
|
||||
|
||||
// index_number must be greater than or equal to 1
|
||||
if ($index_number < 1) {
|
||||
return PHPExcel_Calculation_Functions::VALUE();
|
||||
}
|
||||
|
||||
// index_number must be less than or equal to the number of columns in lookup_array
|
||||
if ((!is_array($lookup_array)) || (empty($lookup_array))) {
|
||||
return PHPExcel_Calculation_Functions::REF();
|
||||
} else {
|
||||
$f = array_keys($lookup_array);
|
||||
$firstRow = array_pop($f);
|
||||
if ((!is_array($lookup_array[$firstRow])) || ($index_number > count($lookup_array[$firstRow]))) {
|
||||
return PHPExcel_Calculation_Functions::REF();
|
||||
} else {
|
||||
$columnKeys = array_keys($lookup_array[$firstRow]);
|
||||
$returnColumn = $columnKeys[--$index_number];
|
||||
$firstColumn = array_shift($columnKeys);
|
||||
}
|
||||
}
|
||||
|
||||
if (!$not_exact_match) {
|
||||
uasort($lookup_array, array('self', 'vlookupSort'));
|
||||
}
|
||||
|
||||
$rowNumber = $rowValue = false;
|
||||
foreach ($lookup_array as $rowKey => $rowData) {
|
||||
if ((is_numeric($lookup_value) && is_numeric($rowData[$firstColumn]) && ($rowData[$firstColumn] > $lookup_value)) ||
|
||||
(!is_numeric($lookup_value) && !is_numeric($rowData[$firstColumn]) && (strtolower($rowData[$firstColumn]) > strtolower($lookup_value)))) {
|
||||
break;
|
||||
}
|
||||
$rowNumber = $rowKey;
|
||||
$rowValue = $rowData[$firstColumn];
|
||||
}
|
||||
|
||||
if ($rowNumber !== false) {
|
||||
if ((!$not_exact_match) && ($rowValue != $lookup_value)) {
|
||||
// if an exact match is required, we have what we need to return an appropriate response
|
||||
return PHPExcel_Calculation_Functions::NA();
|
||||
} else {
|
||||
// otherwise return the appropriate value
|
||||
return $lookup_array[$rowNumber][$returnColumn];
|
||||
}
|
||||
}
|
||||
|
||||
return PHPExcel_Calculation_Functions::NA();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* HLOOKUP
|
||||
* The HLOOKUP function searches for value in the top-most row of lookup_array and returns the value in the same column based on the index_number.
|
||||
* @param lookup_value The value that you want to match in lookup_array
|
||||
* @param lookup_array The range of cells being searched
|
||||
* @param index_number The row number in table_array from which the matching value must be returned. The first row is 1.
|
||||
* @param not_exact_match Determines if you are looking for an exact match based on lookup_value.
|
||||
* @return mixed The value of the found cell
|
||||
*/
|
||||
public static function HLOOKUP($lookup_value, $lookup_array, $index_number, $not_exact_match = true)
|
||||
{
|
||||
$lookup_value = PHPExcel_Calculation_Functions::flattenSingleValue($lookup_value);
|
||||
$index_number = PHPExcel_Calculation_Functions::flattenSingleValue($index_number);
|
||||
$not_exact_match = PHPExcel_Calculation_Functions::flattenSingleValue($not_exact_match);
|
||||
|
||||
// index_number must be greater than or equal to 1
|
||||
if ($index_number < 1) {
|
||||
return PHPExcel_Calculation_Functions::VALUE();
|
||||
}
|
||||
|
||||
// index_number must be less than or equal to the number of columns in lookup_array
|
||||
if ((!is_array($lookup_array)) || (empty($lookup_array))) {
|
||||
return PHPExcel_Calculation_Functions::REF();
|
||||
} else {
|
||||
$f = array_keys($lookup_array);
|
||||
$firstRow = array_pop($f);
|
||||
if ((!is_array($lookup_array[$firstRow])) || ($index_number > count($lookup_array[$firstRow]))) {
|
||||
return PHPExcel_Calculation_Functions::REF();
|
||||
} else {
|
||||
$columnKeys = array_keys($lookup_array[$firstRow]);
|
||||
$firstkey = $f[0] - 1;
|
||||
$returnColumn = $firstkey + $index_number;
|
||||
$firstColumn = array_shift($f);
|
||||
}
|
||||
}
|
||||
|
||||
if (!$not_exact_match) {
|
||||
$firstRowH = asort($lookup_array[$firstColumn]);
|
||||
}
|
||||
|
||||
$rowNumber = $rowValue = false;
|
||||
foreach ($lookup_array[$firstColumn] as $rowKey => $rowData) {
|
||||
if ((is_numeric($lookup_value) && is_numeric($rowData) && ($rowData > $lookup_value)) ||
|
||||
(!is_numeric($lookup_value) && !is_numeric($rowData) && (strtolower($rowData) > strtolower($lookup_value)))) {
|
||||
break;
|
||||
}
|
||||
$rowNumber = $rowKey;
|
||||
$rowValue = $rowData;
|
||||
}
|
||||
|
||||
if ($rowNumber !== false) {
|
||||
if ((!$not_exact_match) && ($rowValue != $lookup_value)) {
|
||||
// if an exact match is required, we have what we need to return an appropriate response
|
||||
return PHPExcel_Calculation_Functions::NA();
|
||||
} else {
|
||||
// otherwise return the appropriate value
|
||||
return $lookup_array[$returnColumn][$rowNumber];
|
||||
}
|
||||
}
|
||||
|
||||
return PHPExcel_Calculation_Functions::NA();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* LOOKUP
|
||||
* The LOOKUP function searches for value either from a one-row or one-column range or from an array.
|
||||
* @param lookup_value The value that you want to match in lookup_array
|
||||
* @param lookup_vector The range of cells being searched
|
||||
* @param result_vector The column from which the matching value must be returned
|
||||
* @return mixed The value of the found cell
|
||||
*/
|
||||
public static function LOOKUP($lookup_value, $lookup_vector, $result_vector = null)
|
||||
{
|
||||
$lookup_value = PHPExcel_Calculation_Functions::flattenSingleValue($lookup_value);
|
||||
|
||||
if (!is_array($lookup_vector)) {
|
||||
return PHPExcel_Calculation_Functions::NA();
|
||||
}
|
||||
$lookupRows = count($lookup_vector);
|
||||
$l = array_keys($lookup_vector);
|
||||
$l = array_shift($l);
|
||||
$lookupColumns = count($lookup_vector[$l]);
|
||||
if ((($lookupRows == 1) && ($lookupColumns > 1)) || (($lookupRows == 2) && ($lookupColumns != 2))) {
|
||||
$lookup_vector = self::TRANSPOSE($lookup_vector);
|
||||
$lookupRows = count($lookup_vector);
|
||||
$l = array_keys($lookup_vector);
|
||||
$lookupColumns = count($lookup_vector[array_shift($l)]);
|
||||
}
|
||||
|
||||
if (is_null($result_vector)) {
|
||||
$result_vector = $lookup_vector;
|
||||
}
|
||||
$resultRows = count($result_vector);
|
||||
$l = array_keys($result_vector);
|
||||
$l = array_shift($l);
|
||||
$resultColumns = count($result_vector[$l]);
|
||||
if ((($resultRows == 1) && ($resultColumns > 1)) || (($resultRows == 2) && ($resultColumns != 2))) {
|
||||
$result_vector = self::TRANSPOSE($result_vector);
|
||||
$resultRows = count($result_vector);
|
||||
$r = array_keys($result_vector);
|
||||
$resultColumns = count($result_vector[array_shift($r)]);
|
||||
}
|
||||
|
||||
if ($lookupRows == 2) {
|
||||
$result_vector = array_pop($lookup_vector);
|
||||
$lookup_vector = array_shift($lookup_vector);
|
||||
}
|
||||
if ($lookupColumns != 2) {
|
||||
foreach ($lookup_vector as &$value) {
|
||||
if (is_array($value)) {
|
||||
$k = array_keys($value);
|
||||
$key1 = $key2 = array_shift($k);
|
||||
$key2++;
|
||||
$dataValue1 = $value[$key1];
|
||||
} else {
|
||||
$key1 = 0;
|
||||
$key2 = 1;
|
||||
$dataValue1 = $value;
|
||||
}
|
||||
$dataValue2 = array_shift($result_vector);
|
||||
if (is_array($dataValue2)) {
|
||||
$dataValue2 = array_shift($dataValue2);
|
||||
}
|
||||
$value = array($key1 => $dataValue1, $key2 => $dataValue2);
|
||||
}
|
||||
unset($value);
|
||||
}
|
||||
|
||||
return self::VLOOKUP($lookup_value, $lookup_vector, 2);
|
||||
}
|
||||
}
|
||||
1459
Cron/PHPExcel/PHPExcel/Calculation/MathTrig.php
Executable file
1459
Cron/PHPExcel/PHPExcel/Calculation/MathTrig.php
Executable file
File diff suppressed because it is too large
Load Diff
3745
Cron/PHPExcel/PHPExcel/Calculation/Statistical.php
Executable file
3745
Cron/PHPExcel/PHPExcel/Calculation/Statistical.php
Executable file
File diff suppressed because it is too large
Load Diff
651
Cron/PHPExcel/PHPExcel/Calculation/TextData.php
Executable file
651
Cron/PHPExcel/PHPExcel/Calculation/TextData.php
Executable file
@@ -0,0 +1,651 @@
|
||||
<?php
|
||||
|
||||
/** PHPExcel root directory */
|
||||
if (!defined('PHPEXCEL_ROOT')) {
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
|
||||
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
}
|
||||
|
||||
/**
|
||||
* PHPExcel_Calculation_TextData
|
||||
*
|
||||
* Copyright (c) 2006 - 2015 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Calculation
|
||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version ##VERSION##, ##DATE##
|
||||
*/
|
||||
class PHPExcel_Calculation_TextData
|
||||
{
|
||||
private static $invalidChars;
|
||||
|
||||
private static function unicodeToOrd($c)
|
||||
{
|
||||
if (ord($c{0}) >=0 && ord($c{0}) <= 127) {
|
||||
return ord($c{0});
|
||||
} elseif (ord($c{0}) >= 192 && ord($c{0}) <= 223) {
|
||||
return (ord($c{0})-192)*64 + (ord($c{1})-128);
|
||||
} elseif (ord($c{0}) >= 224 && ord($c{0}) <= 239) {
|
||||
return (ord($c{0})-224)*4096 + (ord($c{1})-128)*64 + (ord($c{2})-128);
|
||||
} elseif (ord($c{0}) >= 240 && ord($c{0}) <= 247) {
|
||||
return (ord($c{0})-240)*262144 + (ord($c{1})-128)*4096 + (ord($c{2})-128)*64 + (ord($c{3})-128);
|
||||
} elseif (ord($c{0}) >= 248 && ord($c{0}) <= 251) {
|
||||
return (ord($c{0})-248)*16777216 + (ord($c{1})-128)*262144 + (ord($c{2})-128)*4096 + (ord($c{3})-128)*64 + (ord($c{4})-128);
|
||||
} elseif (ord($c{0}) >= 252 && ord($c{0}) <= 253) {
|
||||
return (ord($c{0})-252)*1073741824 + (ord($c{1})-128)*16777216 + (ord($c{2})-128)*262144 + (ord($c{3})-128)*4096 + (ord($c{4})-128)*64 + (ord($c{5})-128);
|
||||
} elseif (ord($c{0}) >= 254 && ord($c{0}) <= 255) {
|
||||
// error
|
||||
return PHPExcel_Calculation_Functions::VALUE();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* CHARACTER
|
||||
*
|
||||
* @param string $character Value
|
||||
* @return int
|
||||
*/
|
||||
public static function CHARACTER($character)
|
||||
{
|
||||
$character = PHPExcel_Calculation_Functions::flattenSingleValue($character);
|
||||
|
||||
if ((!is_numeric($character)) || ($character < 0)) {
|
||||
return PHPExcel_Calculation_Functions::VALUE();
|
||||
}
|
||||
|
||||
if (function_exists('mb_convert_encoding')) {
|
||||
return mb_convert_encoding('&#'.intval($character).';', 'UTF-8', 'HTML-ENTITIES');
|
||||
} else {
|
||||
return chr(intval($character));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* TRIMNONPRINTABLE
|
||||
*
|
||||
* @param mixed $stringValue Value to check
|
||||
* @return string
|
||||
*/
|
||||
public static function TRIMNONPRINTABLE($stringValue = '')
|
||||
{
|
||||
$stringValue = PHPExcel_Calculation_Functions::flattenSingleValue($stringValue);
|
||||
|
||||
if (is_bool($stringValue)) {
|
||||
return ($stringValue) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
|
||||
}
|
||||
|
||||
if (self::$invalidChars == null) {
|
||||
self::$invalidChars = range(chr(0), chr(31));
|
||||
}
|
||||
|
||||
if (is_string($stringValue) || is_numeric($stringValue)) {
|
||||
return str_replace(self::$invalidChars, '', trim($stringValue, "\x00..\x1F"));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* TRIMSPACES
|
||||
*
|
||||
* @param mixed $stringValue Value to check
|
||||
* @return string
|
||||
*/
|
||||
public static function TRIMSPACES($stringValue = '')
|
||||
{
|
||||
$stringValue = PHPExcel_Calculation_Functions::flattenSingleValue($stringValue);
|
||||
if (is_bool($stringValue)) {
|
||||
return ($stringValue) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
|
||||
}
|
||||
|
||||
if (is_string($stringValue) || is_numeric($stringValue)) {
|
||||
return trim(preg_replace('/ +/', ' ', trim($stringValue, ' ')), ' ');
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* ASCIICODE
|
||||
*
|
||||
* @param string $characters Value
|
||||
* @return int
|
||||
*/
|
||||
public static function ASCIICODE($characters)
|
||||
{
|
||||
if (($characters === null) || ($characters === '')) {
|
||||
return PHPExcel_Calculation_Functions::VALUE();
|
||||
}
|
||||
$characters = PHPExcel_Calculation_Functions::flattenSingleValue($characters);
|
||||
if (is_bool($characters)) {
|
||||
if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) {
|
||||
$characters = (int) $characters;
|
||||
} else {
|
||||
$characters = ($characters) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
|
||||
}
|
||||
}
|
||||
|
||||
$character = $characters;
|
||||
if ((function_exists('mb_strlen')) && (function_exists('mb_substr'))) {
|
||||
if (mb_strlen($characters, 'UTF-8') > 1) {
|
||||
$character = mb_substr($characters, 0, 1, 'UTF-8');
|
||||
}
|
||||
return self::unicodeToOrd($character);
|
||||
} else {
|
||||
if (strlen($characters) > 0) {
|
||||
$character = substr($characters, 0, 1);
|
||||
}
|
||||
return ord($character);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* CONCATENATE
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function CONCATENATE()
|
||||
{
|
||||
$returnValue = '';
|
||||
|
||||
// Loop through arguments
|
||||
$aArgs = PHPExcel_Calculation_Functions::flattenArray(func_get_args());
|
||||
foreach ($aArgs as $arg) {
|
||||
if (is_bool($arg)) {
|
||||
if (PHPExcel_Calculation_Functions::getCompatibilityMode() == PHPExcel_Calculation_Functions::COMPATIBILITY_OPENOFFICE) {
|
||||
$arg = (int) $arg;
|
||||
} else {
|
||||
$arg = ($arg) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
|
||||
}
|
||||
}
|
||||
$returnValue .= $arg;
|
||||
}
|
||||
|
||||
return $returnValue;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* DOLLAR
|
||||
*
|
||||
* This function converts a number to text using currency format, with the decimals rounded to the specified place.
|
||||
* The format used is $#,##0.00_);($#,##0.00)..
|
||||
*
|
||||
* @param float $value The value to format
|
||||
* @param int $decimals The number of digits to display to the right of the decimal point.
|
||||
* If decimals is negative, number is rounded to the left of the decimal point.
|
||||
* If you omit decimals, it is assumed to be 2
|
||||
* @return string
|
||||
*/
|
||||
public static function DOLLAR($value = 0, $decimals = 2)
|
||||
{
|
||||
$value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
|
||||
$decimals = is_null($decimals) ? 0 : PHPExcel_Calculation_Functions::flattenSingleValue($decimals);
|
||||
|
||||
// Validate parameters
|
||||
if (!is_numeric($value) || !is_numeric($decimals)) {
|
||||
return PHPExcel_Calculation_Functions::NaN();
|
||||
}
|
||||
$decimals = floor($decimals);
|
||||
|
||||
$mask = '$#,##0';
|
||||
if ($decimals > 0) {
|
||||
$mask .= '.' . str_repeat('0', $decimals);
|
||||
} else {
|
||||
$round = pow(10, abs($decimals));
|
||||
if ($value < 0) {
|
||||
$round = 0-$round;
|
||||
}
|
||||
$value = PHPExcel_Calculation_MathTrig::MROUND($value, $round);
|
||||
}
|
||||
|
||||
return PHPExcel_Style_NumberFormat::toFormattedString($value, $mask);
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* SEARCHSENSITIVE
|
||||
*
|
||||
* @param string $needle The string to look for
|
||||
* @param string $haystack The string in which to look
|
||||
* @param int $offset Offset within $haystack
|
||||
* @return string
|
||||
*/
|
||||
public static function SEARCHSENSITIVE($needle, $haystack, $offset = 1)
|
||||
{
|
||||
$needle = PHPExcel_Calculation_Functions::flattenSingleValue($needle);
|
||||
$haystack = PHPExcel_Calculation_Functions::flattenSingleValue($haystack);
|
||||
$offset = PHPExcel_Calculation_Functions::flattenSingleValue($offset);
|
||||
|
||||
if (!is_bool($needle)) {
|
||||
if (is_bool($haystack)) {
|
||||
$haystack = ($haystack) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
|
||||
}
|
||||
|
||||
if (($offset > 0) && (PHPExcel_Shared_String::CountCharacters($haystack) > $offset)) {
|
||||
if (PHPExcel_Shared_String::CountCharacters($needle) == 0) {
|
||||
return $offset;
|
||||
}
|
||||
if (function_exists('mb_strpos')) {
|
||||
$pos = mb_strpos($haystack, $needle, --$offset, 'UTF-8');
|
||||
} else {
|
||||
$pos = strpos($haystack, $needle, --$offset);
|
||||
}
|
||||
if ($pos !== false) {
|
||||
return ++$pos;
|
||||
}
|
||||
}
|
||||
}
|
||||
return PHPExcel_Calculation_Functions::VALUE();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* SEARCHINSENSITIVE
|
||||
*
|
||||
* @param string $needle The string to look for
|
||||
* @param string $haystack The string in which to look
|
||||
* @param int $offset Offset within $haystack
|
||||
* @return string
|
||||
*/
|
||||
public static function SEARCHINSENSITIVE($needle, $haystack, $offset = 1)
|
||||
{
|
||||
$needle = PHPExcel_Calculation_Functions::flattenSingleValue($needle);
|
||||
$haystack = PHPExcel_Calculation_Functions::flattenSingleValue($haystack);
|
||||
$offset = PHPExcel_Calculation_Functions::flattenSingleValue($offset);
|
||||
|
||||
if (!is_bool($needle)) {
|
||||
if (is_bool($haystack)) {
|
||||
$haystack = ($haystack) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
|
||||
}
|
||||
|
||||
if (($offset > 0) && (PHPExcel_Shared_String::CountCharacters($haystack) > $offset)) {
|
||||
if (PHPExcel_Shared_String::CountCharacters($needle) == 0) {
|
||||
return $offset;
|
||||
}
|
||||
if (function_exists('mb_stripos')) {
|
||||
$pos = mb_stripos($haystack, $needle, --$offset, 'UTF-8');
|
||||
} else {
|
||||
$pos = stripos($haystack, $needle, --$offset);
|
||||
}
|
||||
if ($pos !== false) {
|
||||
return ++$pos;
|
||||
}
|
||||
}
|
||||
}
|
||||
return PHPExcel_Calculation_Functions::VALUE();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* FIXEDFORMAT
|
||||
*
|
||||
* @param mixed $value Value to check
|
||||
* @param integer $decimals
|
||||
* @param boolean $no_commas
|
||||
* @return boolean
|
||||
*/
|
||||
public static function FIXEDFORMAT($value, $decimals = 2, $no_commas = false)
|
||||
{
|
||||
$value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
|
||||
$decimals = PHPExcel_Calculation_Functions::flattenSingleValue($decimals);
|
||||
$no_commas = PHPExcel_Calculation_Functions::flattenSingleValue($no_commas);
|
||||
|
||||
// Validate parameters
|
||||
if (!is_numeric($value) || !is_numeric($decimals)) {
|
||||
return PHPExcel_Calculation_Functions::NaN();
|
||||
}
|
||||
$decimals = floor($decimals);
|
||||
|
||||
$valueResult = round($value, $decimals);
|
||||
if ($decimals < 0) {
|
||||
$decimals = 0;
|
||||
}
|
||||
if (!$no_commas) {
|
||||
$valueResult = number_format($valueResult, $decimals);
|
||||
}
|
||||
|
||||
return (string) $valueResult;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* LEFT
|
||||
*
|
||||
* @param string $value Value
|
||||
* @param int $chars Number of characters
|
||||
* @return string
|
||||
*/
|
||||
public static function LEFT($value = '', $chars = 1)
|
||||
{
|
||||
$value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
|
||||
$chars = PHPExcel_Calculation_Functions::flattenSingleValue($chars);
|
||||
|
||||
if ($chars < 0) {
|
||||
return PHPExcel_Calculation_Functions::VALUE();
|
||||
}
|
||||
|
||||
if (is_bool($value)) {
|
||||
$value = ($value) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
|
||||
}
|
||||
|
||||
if (function_exists('mb_substr')) {
|
||||
return mb_substr($value, 0, $chars, 'UTF-8');
|
||||
} else {
|
||||
return substr($value, 0, $chars);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* MID
|
||||
*
|
||||
* @param string $value Value
|
||||
* @param int $start Start character
|
||||
* @param int $chars Number of characters
|
||||
* @return string
|
||||
*/
|
||||
public static function MID($value = '', $start = 1, $chars = null)
|
||||
{
|
||||
$value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
|
||||
$start = PHPExcel_Calculation_Functions::flattenSingleValue($start);
|
||||
$chars = PHPExcel_Calculation_Functions::flattenSingleValue($chars);
|
||||
|
||||
if (($start < 1) || ($chars < 0)) {
|
||||
return PHPExcel_Calculation_Functions::VALUE();
|
||||
}
|
||||
|
||||
if (is_bool($value)) {
|
||||
$value = ($value) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
|
||||
}
|
||||
|
||||
if (function_exists('mb_substr')) {
|
||||
return mb_substr($value, --$start, $chars, 'UTF-8');
|
||||
} else {
|
||||
return substr($value, --$start, $chars);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* RIGHT
|
||||
*
|
||||
* @param string $value Value
|
||||
* @param int $chars Number of characters
|
||||
* @return string
|
||||
*/
|
||||
public static function RIGHT($value = '', $chars = 1)
|
||||
{
|
||||
$value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
|
||||
$chars = PHPExcel_Calculation_Functions::flattenSingleValue($chars);
|
||||
|
||||
if ($chars < 0) {
|
||||
return PHPExcel_Calculation_Functions::VALUE();
|
||||
}
|
||||
|
||||
if (is_bool($value)) {
|
||||
$value = ($value) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
|
||||
}
|
||||
|
||||
if ((function_exists('mb_substr')) && (function_exists('mb_strlen'))) {
|
||||
return mb_substr($value, mb_strlen($value, 'UTF-8') - $chars, $chars, 'UTF-8');
|
||||
} else {
|
||||
return substr($value, strlen($value) - $chars);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* STRINGLENGTH
|
||||
*
|
||||
* @param string $value Value
|
||||
* @return string
|
||||
*/
|
||||
public static function STRINGLENGTH($value = '')
|
||||
{
|
||||
$value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
|
||||
|
||||
if (is_bool($value)) {
|
||||
$value = ($value) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
|
||||
}
|
||||
|
||||
if (function_exists('mb_strlen')) {
|
||||
return mb_strlen($value, 'UTF-8');
|
||||
} else {
|
||||
return strlen($value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* LOWERCASE
|
||||
*
|
||||
* Converts a string value to upper case.
|
||||
*
|
||||
* @param string $mixedCaseString
|
||||
* @return string
|
||||
*/
|
||||
public static function LOWERCASE($mixedCaseString)
|
||||
{
|
||||
$mixedCaseString = PHPExcel_Calculation_Functions::flattenSingleValue($mixedCaseString);
|
||||
|
||||
if (is_bool($mixedCaseString)) {
|
||||
$mixedCaseString = ($mixedCaseString) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
|
||||
}
|
||||
|
||||
return PHPExcel_Shared_String::StrToLower($mixedCaseString);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* UPPERCASE
|
||||
*
|
||||
* Converts a string value to upper case.
|
||||
*
|
||||
* @param string $mixedCaseString
|
||||
* @return string
|
||||
*/
|
||||
public static function UPPERCASE($mixedCaseString)
|
||||
{
|
||||
$mixedCaseString = PHPExcel_Calculation_Functions::flattenSingleValue($mixedCaseString);
|
||||
|
||||
if (is_bool($mixedCaseString)) {
|
||||
$mixedCaseString = ($mixedCaseString) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
|
||||
}
|
||||
|
||||
return PHPExcel_Shared_String::StrToUpper($mixedCaseString);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* PROPERCASE
|
||||
*
|
||||
* Converts a string value to upper case.
|
||||
*
|
||||
* @param string $mixedCaseString
|
||||
* @return string
|
||||
*/
|
||||
public static function PROPERCASE($mixedCaseString)
|
||||
{
|
||||
$mixedCaseString = PHPExcel_Calculation_Functions::flattenSingleValue($mixedCaseString);
|
||||
|
||||
if (is_bool($mixedCaseString)) {
|
||||
$mixedCaseString = ($mixedCaseString) ? PHPExcel_Calculation::getTRUE() : PHPExcel_Calculation::getFALSE();
|
||||
}
|
||||
|
||||
return PHPExcel_Shared_String::StrToTitle($mixedCaseString);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* REPLACE
|
||||
*
|
||||
* @param string $oldText String to modify
|
||||
* @param int $start Start character
|
||||
* @param int $chars Number of characters
|
||||
* @param string $newText String to replace in defined position
|
||||
* @return string
|
||||
*/
|
||||
public static function REPLACE($oldText = '', $start = 1, $chars = null, $newText)
|
||||
{
|
||||
$oldText = PHPExcel_Calculation_Functions::flattenSingleValue($oldText);
|
||||
$start = PHPExcel_Calculation_Functions::flattenSingleValue($start);
|
||||
$chars = PHPExcel_Calculation_Functions::flattenSingleValue($chars);
|
||||
$newText = PHPExcel_Calculation_Functions::flattenSingleValue($newText);
|
||||
|
||||
$left = self::LEFT($oldText, $start-1);
|
||||
$right = self::RIGHT($oldText, self::STRINGLENGTH($oldText)-($start+$chars)+1);
|
||||
|
||||
return $left.$newText.$right;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* SUBSTITUTE
|
||||
*
|
||||
* @param string $text Value
|
||||
* @param string $fromText From Value
|
||||
* @param string $toText To Value
|
||||
* @param integer $instance Instance Number
|
||||
* @return string
|
||||
*/
|
||||
public static function SUBSTITUTE($text = '', $fromText = '', $toText = '', $instance = 0)
|
||||
{
|
||||
$text = PHPExcel_Calculation_Functions::flattenSingleValue($text);
|
||||
$fromText = PHPExcel_Calculation_Functions::flattenSingleValue($fromText);
|
||||
$toText = PHPExcel_Calculation_Functions::flattenSingleValue($toText);
|
||||
$instance = floor(PHPExcel_Calculation_Functions::flattenSingleValue($instance));
|
||||
|
||||
if ($instance == 0) {
|
||||
if (function_exists('mb_str_replace')) {
|
||||
return mb_str_replace($fromText, $toText, $text);
|
||||
} else {
|
||||
return str_replace($fromText, $toText, $text);
|
||||
}
|
||||
} else {
|
||||
$pos = -1;
|
||||
while ($instance > 0) {
|
||||
if (function_exists('mb_strpos')) {
|
||||
$pos = mb_strpos($text, $fromText, $pos+1, 'UTF-8');
|
||||
} else {
|
||||
$pos = strpos($text, $fromText, $pos+1);
|
||||
}
|
||||
if ($pos === false) {
|
||||
break;
|
||||
}
|
||||
--$instance;
|
||||
}
|
||||
if ($pos !== false) {
|
||||
if (function_exists('mb_strlen')) {
|
||||
return self::REPLACE($text, ++$pos, mb_strlen($fromText, 'UTF-8'), $toText);
|
||||
} else {
|
||||
return self::REPLACE($text, ++$pos, strlen($fromText), $toText);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* RETURNSTRING
|
||||
*
|
||||
* @param mixed $testValue Value to check
|
||||
* @return boolean
|
||||
*/
|
||||
public static function RETURNSTRING($testValue = '')
|
||||
{
|
||||
$testValue = PHPExcel_Calculation_Functions::flattenSingleValue($testValue);
|
||||
|
||||
if (is_string($testValue)) {
|
||||
return $testValue;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* TEXTFORMAT
|
||||
*
|
||||
* @param mixed $value Value to check
|
||||
* @param string $format Format mask to use
|
||||
* @return boolean
|
||||
*/
|
||||
public static function TEXTFORMAT($value, $format)
|
||||
{
|
||||
$value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
|
||||
$format = PHPExcel_Calculation_Functions::flattenSingleValue($format);
|
||||
|
||||
if ((is_string($value)) && (!is_numeric($value)) && PHPExcel_Shared_Date::isDateTimeFormatCode($format)) {
|
||||
$value = PHPExcel_Calculation_DateTime::DATEVALUE($value);
|
||||
}
|
||||
|
||||
return (string) PHPExcel_Style_NumberFormat::toFormattedString($value, $format);
|
||||
}
|
||||
|
||||
/**
|
||||
* VALUE
|
||||
*
|
||||
* @param mixed $value Value to check
|
||||
* @return boolean
|
||||
*/
|
||||
public static function VALUE($value = '')
|
||||
{
|
||||
$value = PHPExcel_Calculation_Functions::flattenSingleValue($value);
|
||||
|
||||
if (!is_numeric($value)) {
|
||||
$numberValue = str_replace(
|
||||
PHPExcel_Shared_String::getThousandsSeparator(),
|
||||
'',
|
||||
trim($value, " \t\n\r\0\x0B" . PHPExcel_Shared_String::getCurrencyCode())
|
||||
);
|
||||
if (is_numeric($numberValue)) {
|
||||
return (float) $numberValue;
|
||||
}
|
||||
|
||||
$dateSetting = PHPExcel_Calculation_Functions::getReturnDateType();
|
||||
PHPExcel_Calculation_Functions::setReturnDateType(PHPExcel_Calculation_Functions::RETURNDATE_EXCEL);
|
||||
|
||||
if (strpos($value, ':') !== false) {
|
||||
$timeValue = PHPExcel_Calculation_DateTime::TIMEVALUE($value);
|
||||
if ($timeValue !== PHPExcel_Calculation_Functions::VALUE()) {
|
||||
PHPExcel_Calculation_Functions::setReturnDateType($dateSetting);
|
||||
return $timeValue;
|
||||
}
|
||||
}
|
||||
$dateValue = PHPExcel_Calculation_DateTime::DATEVALUE($value);
|
||||
if ($dateValue !== PHPExcel_Calculation_Functions::VALUE()) {
|
||||
PHPExcel_Calculation_Functions::setReturnDateType($dateSetting);
|
||||
return $dateValue;
|
||||
}
|
||||
PHPExcel_Calculation_Functions::setReturnDateType($dateSetting);
|
||||
|
||||
return PHPExcel_Calculation_Functions::VALUE();
|
||||
}
|
||||
return (float) $value;
|
||||
}
|
||||
}
|
||||
111
Cron/PHPExcel/PHPExcel/Calculation/Token/Stack.php
Executable file
111
Cron/PHPExcel/PHPExcel/Calculation/Token/Stack.php
Executable file
@@ -0,0 +1,111 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PHPExcel_Calculation_Token_Stack
|
||||
*
|
||||
* Copyright (c) 2006 - 2015 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Calculation
|
||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version ##VERSION##, ##DATE##
|
||||
*/
|
||||
class PHPExcel_Calculation_Token_Stack
|
||||
{
|
||||
/**
|
||||
* The parser stack for formulae
|
||||
*
|
||||
* @var mixed[]
|
||||
*/
|
||||
private $stack = array();
|
||||
|
||||
/**
|
||||
* Count of entries in the parser stack
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
private $count = 0;
|
||||
|
||||
/**
|
||||
* Return the number of entries on the stack
|
||||
*
|
||||
* @return integer
|
||||
*/
|
||||
public function count()
|
||||
{
|
||||
return $this->count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Push a new entry onto the stack
|
||||
*
|
||||
* @param mixed $type
|
||||
* @param mixed $value
|
||||
* @param mixed $reference
|
||||
*/
|
||||
public function push($type, $value, $reference = null)
|
||||
{
|
||||
$this->stack[$this->count++] = array(
|
||||
'type' => $type,
|
||||
'value' => $value,
|
||||
'reference' => $reference
|
||||
);
|
||||
if ($type == 'Function') {
|
||||
$localeFunction = PHPExcel_Calculation::localeFunc($value);
|
||||
if ($localeFunction != $value) {
|
||||
$this->stack[($this->count - 1)]['localeValue'] = $localeFunction;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Pop the last entry from the stack
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function pop()
|
||||
{
|
||||
if ($this->count > 0) {
|
||||
return $this->stack[--$this->count];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an entry from the stack without removing it
|
||||
*
|
||||
* @param integer $n number indicating how far back in the stack we want to look
|
||||
* @return mixed
|
||||
*/
|
||||
public function last($n = 1)
|
||||
{
|
||||
if ($this->count - $n < 0) {
|
||||
return null;
|
||||
}
|
||||
return $this->stack[$this->count - $n];
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear the stack
|
||||
*/
|
||||
public function clear()
|
||||
{
|
||||
$this->stack = array();
|
||||
$this->count = 0;
|
||||
}
|
||||
}
|
||||
351
Cron/PHPExcel/PHPExcel/Calculation/functionlist.txt
Executable file
351
Cron/PHPExcel/PHPExcel/Calculation/functionlist.txt
Executable file
@@ -0,0 +1,351 @@
|
||||
ABS
|
||||
ACCRINT
|
||||
ACCRINTM
|
||||
ACOS
|
||||
ACOSH
|
||||
ADDRESS
|
||||
AMORDEGRC
|
||||
AMORLINC
|
||||
AND
|
||||
AREAS
|
||||
ASC
|
||||
ASIN
|
||||
ASINH
|
||||
ATAN
|
||||
ATAN2
|
||||
ATANH
|
||||
AVEDEV
|
||||
AVERAGE
|
||||
AVERAGEA
|
||||
AVERAGEIF
|
||||
AVERAGEIFS
|
||||
BAHTTEXT
|
||||
BESSELI
|
||||
BESSELJ
|
||||
BESSELK
|
||||
BESSELY
|
||||
BETADIST
|
||||
BETAINV
|
||||
BIN2DEC
|
||||
BIN2HEX
|
||||
BIN2OCT
|
||||
BINOMDIST
|
||||
CEILING
|
||||
CELL
|
||||
CHAR
|
||||
CHIDIST
|
||||
CHIINV
|
||||
CHITEST
|
||||
CHOOSE
|
||||
CLEAN
|
||||
CODE
|
||||
COLUMN
|
||||
COLUMNS
|
||||
COMBIN
|
||||
COMPLEX
|
||||
CONCATENATE
|
||||
CONFIDENCE
|
||||
CONVERT
|
||||
CORREL
|
||||
COS
|
||||
COSH
|
||||
COUNT
|
||||
COUNTA
|
||||
COUNTBLANK
|
||||
COUNTIF
|
||||
COUNTIFS
|
||||
COUPDAYBS
|
||||
COUPDAYBS
|
||||
COUPDAYSNC
|
||||
COUPNCD
|
||||
COUPNUM
|
||||
COUPPCD
|
||||
COVAR
|
||||
CRITBINOM
|
||||
CUBEKPIMEMBER
|
||||
CUBEMEMBER
|
||||
CUBEMEMBERPROPERTY
|
||||
CUBERANKEDMEMBER
|
||||
CUBESET
|
||||
CUBESETCOUNT
|
||||
CUBEVALUE
|
||||
CUMIPMT
|
||||
CUMPRINC
|
||||
DATE
|
||||
DATEDIF
|
||||
DATEVALUE
|
||||
DAVERAGE
|
||||
DAY
|
||||
DAYS360
|
||||
DB
|
||||
DCOUNT
|
||||
DCOUNTA
|
||||
DDB
|
||||
DEC2BIN
|
||||
DEC2HEX
|
||||
DEC2OCT
|
||||
DEGREES
|
||||
DELTA
|
||||
DEVSQ
|
||||
DGET
|
||||
DISC
|
||||
DMAX
|
||||
DMIN
|
||||
DOLLAR
|
||||
DOLLARDE
|
||||
DOLLARFR
|
||||
DPRODUCT
|
||||
DSTDEV
|
||||
DSTDEVP
|
||||
DSUM
|
||||
DURATION
|
||||
DVAR
|
||||
DVARP
|
||||
EDATE
|
||||
EFFECT
|
||||
EOMONTH
|
||||
ERF
|
||||
ERFC
|
||||
ERROR.TYPE
|
||||
EVEN
|
||||
EXACT
|
||||
EXP
|
||||
EXPONDIST
|
||||
FACT
|
||||
FACTDOUBLE
|
||||
FALSE
|
||||
FDIST
|
||||
FIND
|
||||
FINDB
|
||||
FINV
|
||||
FISHER
|
||||
FISHERINV
|
||||
FIXED
|
||||
FLOOR
|
||||
FORECAST
|
||||
FREQUENCY
|
||||
FTEST
|
||||
FV
|
||||
FVSCHEDULE
|
||||
GAMAMDIST
|
||||
GAMMAINV
|
||||
GAMMALN
|
||||
GCD
|
||||
GEOMEAN
|
||||
GESTEP
|
||||
GETPIVOTDATA
|
||||
GROWTH
|
||||
HARMEAN
|
||||
HEX2BIN
|
||||
HEX2OCT
|
||||
HLOOKUP
|
||||
HOUR
|
||||
HYPERLINK
|
||||
HYPGEOMDIST
|
||||
IF
|
||||
IFERROR
|
||||
IMABS
|
||||
IMAGINARY
|
||||
IMARGUMENT
|
||||
IMCONJUGATE
|
||||
IMCOS
|
||||
IMEXP
|
||||
IMLN
|
||||
IMLOG10
|
||||
IMLOG2
|
||||
IMPOWER
|
||||
IMPRODUCT
|
||||
IMREAL
|
||||
IMSIN
|
||||
IMSQRT
|
||||
IMSUB
|
||||
IMSUM
|
||||
INDEX
|
||||
INDIRECT
|
||||
INFO
|
||||
INT
|
||||
INTERCEPT
|
||||
INTRATE
|
||||
IPMT
|
||||
IRR
|
||||
ISBLANK
|
||||
ISERR
|
||||
ISERROR
|
||||
ISEVEN
|
||||
ISLOGICAL
|
||||
ISNA
|
||||
ISNONTEXT
|
||||
ISNUMBER
|
||||
ISODD
|
||||
ISPMT
|
||||
ISREF
|
||||
ISTEXT
|
||||
JIS
|
||||
KURT
|
||||
LARGE
|
||||
LCM
|
||||
LEFT
|
||||
LEFTB
|
||||
LEN
|
||||
LENB
|
||||
LINEST
|
||||
LN
|
||||
LOG
|
||||
LOG10
|
||||
LOGEST
|
||||
LOGINV
|
||||
LOGNORMDIST
|
||||
LOOKUP
|
||||
LOWER
|
||||
MATCH
|
||||
MAX
|
||||
MAXA
|
||||
MDETERM
|
||||
MDURATION
|
||||
MEDIAN
|
||||
MID
|
||||
MIDB
|
||||
MIN
|
||||
MINA
|
||||
MINUTE
|
||||
MINVERSE
|
||||
MIRR
|
||||
MMULT
|
||||
MOD
|
||||
MODE
|
||||
MONTH
|
||||
MROUND
|
||||
MULTINOMIAL
|
||||
N
|
||||
NA
|
||||
NEGBINOMDIST
|
||||
NETWORKDAYS
|
||||
NOMINAL
|
||||
NORMDIST
|
||||
NORMINV
|
||||
NORMSDIST
|
||||
NORMSINV
|
||||
NOT
|
||||
NOW
|
||||
NPER
|
||||
NPV
|
||||
OCT2BIN
|
||||
OCT2DEC
|
||||
OCT2HEX
|
||||
ODD
|
||||
ODDFPRICE
|
||||
ODDFYIELD
|
||||
ODDLPRICE
|
||||
ODDLYIELD
|
||||
OFFSET
|
||||
OR
|
||||
PEARSON
|
||||
PERCENTILE
|
||||
PERCENTRANK
|
||||
PERMUT
|
||||
PHONETIC
|
||||
PI
|
||||
PMT
|
||||
POISSON
|
||||
POWER
|
||||
PPMT
|
||||
PRICE
|
||||
PRICEDISC
|
||||
PRICEMAT
|
||||
PROB
|
||||
PRODUCT
|
||||
PROPER
|
||||
PV
|
||||
QUARTILE
|
||||
QUOTIENT
|
||||
RADIANS
|
||||
RAND
|
||||
RANDBETWEEN
|
||||
RANK
|
||||
RATE
|
||||
RECEIVED
|
||||
REPLACE
|
||||
REPLACEB
|
||||
REPT
|
||||
RIGHT
|
||||
RIGHTB
|
||||
ROMAN
|
||||
ROUND
|
||||
ROUNDDOWN
|
||||
ROUNDUP
|
||||
ROW
|
||||
ROWS
|
||||
RSQ
|
||||
RTD
|
||||
SEARCH
|
||||
SEARCHB
|
||||
SECOND
|
||||
SERIESSUM
|
||||
SIGN
|
||||
SIN
|
||||
SINH
|
||||
SKEW
|
||||
SLN
|
||||
SLOPE
|
||||
SMALL
|
||||
SQRT
|
||||
SQRTPI
|
||||
STANDARDIZE
|
||||
STDEV
|
||||
STDEVA
|
||||
STDEVP
|
||||
STDEVPA
|
||||
STEYX
|
||||
SUBSTITUTE
|
||||
SUBTOTAL
|
||||
SUM
|
||||
SUMIF
|
||||
SUMIFS
|
||||
SUMPRODUCT
|
||||
SUMSQ
|
||||
SUMX2MY2
|
||||
SUMX2PY2
|
||||
SUMXMY2
|
||||
SYD
|
||||
T
|
||||
TAN
|
||||
TANH
|
||||
TBILLEQ
|
||||
TBILLPRICE
|
||||
TBILLYIELD
|
||||
TDIST
|
||||
TEXT
|
||||
TIME
|
||||
TIMEVALUE
|
||||
TINV
|
||||
TODAY
|
||||
TRANSPOSE
|
||||
TREND
|
||||
TRIM
|
||||
TRIMMEAN
|
||||
TRUE
|
||||
TRUNC
|
||||
TTEST
|
||||
TYPE
|
||||
UPPER
|
||||
USDOLLAR
|
||||
VALUE
|
||||
VAR
|
||||
VARA
|
||||
VARP
|
||||
VARPA
|
||||
VDB
|
||||
VERSION
|
||||
VLOOKUP
|
||||
WEEKDAY
|
||||
WEEKNUM
|
||||
WEIBULL
|
||||
WORKDAY
|
||||
XIRR
|
||||
XNPV
|
||||
YEAR
|
||||
YEARFRAC
|
||||
YIELD
|
||||
YIELDDISC
|
||||
YIELDMAT
|
||||
ZTEST
|
||||
1032
Cron/PHPExcel/PHPExcel/Cell.php
Executable file
1032
Cron/PHPExcel/PHPExcel/Cell.php
Executable file
File diff suppressed because it is too large
Load Diff
187
Cron/PHPExcel/PHPExcel/Cell/AdvancedValueBinder.php
Executable file
187
Cron/PHPExcel/PHPExcel/Cell/AdvancedValueBinder.php
Executable file
@@ -0,0 +1,187 @@
|
||||
<?php
|
||||
|
||||
/** PHPExcel root directory */
|
||||
if (!defined('PHPEXCEL_ROOT')) {
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
|
||||
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
}
|
||||
|
||||
/**
|
||||
* PHPExcel_Cell_AdvancedValueBinder
|
||||
*
|
||||
* Copyright (c) 2006 - 2015 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Cell
|
||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version ##VERSION##, ##DATE##
|
||||
*/
|
||||
class PHPExcel_Cell_AdvancedValueBinder extends PHPExcel_Cell_DefaultValueBinder implements PHPExcel_Cell_IValueBinder
|
||||
{
|
||||
/**
|
||||
* Bind value to a cell
|
||||
*
|
||||
* @param PHPExcel_Cell $cell Cell to bind value to
|
||||
* @param mixed $value Value to bind in cell
|
||||
* @return boolean
|
||||
*/
|
||||
public function bindValue(PHPExcel_Cell $cell, $value = null)
|
||||
{
|
||||
// sanitize UTF-8 strings
|
||||
if (is_string($value)) {
|
||||
$value = PHPExcel_Shared_String::SanitizeUTF8($value);
|
||||
}
|
||||
|
||||
// Find out data type
|
||||
$dataType = parent::dataTypeForValue($value);
|
||||
|
||||
// Style logic - strings
|
||||
if ($dataType === PHPExcel_Cell_DataType::TYPE_STRING && !$value instanceof PHPExcel_RichText) {
|
||||
// Test for booleans using locale-setting
|
||||
if ($value == PHPExcel_Calculation::getTRUE()) {
|
||||
$cell->setValueExplicit(true, PHPExcel_Cell_DataType::TYPE_BOOL);
|
||||
return true;
|
||||
} elseif ($value == PHPExcel_Calculation::getFALSE()) {
|
||||
$cell->setValueExplicit(false, PHPExcel_Cell_DataType::TYPE_BOOL);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check for number in scientific format
|
||||
if (preg_match('/^'.PHPExcel_Calculation::CALCULATION_REGEXP_NUMBER.'$/', $value)) {
|
||||
$cell->setValueExplicit((float) $value, PHPExcel_Cell_DataType::TYPE_NUMERIC);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check for fraction
|
||||
if (preg_match('/^([+-]?)\s*([0-9]+)\s?\/\s*([0-9]+)$/', $value, $matches)) {
|
||||
// Convert value to number
|
||||
$value = $matches[2] / $matches[3];
|
||||
if ($matches[1] == '-') {
|
||||
$value = 0 - $value;
|
||||
}
|
||||
$cell->setValueExplicit((float) $value, PHPExcel_Cell_DataType::TYPE_NUMERIC);
|
||||
// Set style
|
||||
$cell->getWorksheet()->getStyle($cell->getCoordinate())
|
||||
->getNumberFormat()->setFormatCode('??/??');
|
||||
return true;
|
||||
} elseif (preg_match('/^([+-]?)([0-9]*) +([0-9]*)\s?\/\s*([0-9]*)$/', $value, $matches)) {
|
||||
// Convert value to number
|
||||
$value = $matches[2] + ($matches[3] / $matches[4]);
|
||||
if ($matches[1] == '-') {
|
||||
$value = 0 - $value;
|
||||
}
|
||||
$cell->setValueExplicit((float) $value, PHPExcel_Cell_DataType::TYPE_NUMERIC);
|
||||
// Set style
|
||||
$cell->getWorksheet()->getStyle($cell->getCoordinate())
|
||||
->getNumberFormat()->setFormatCode('# ??/??');
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check for percentage
|
||||
if (preg_match('/^\-?[0-9]*\.?[0-9]*\s?\%$/', $value)) {
|
||||
// Convert value to number
|
||||
$value = (float) str_replace('%', '', $value) / 100;
|
||||
$cell->setValueExplicit($value, PHPExcel_Cell_DataType::TYPE_NUMERIC);
|
||||
// Set style
|
||||
$cell->getWorksheet()->getStyle($cell->getCoordinate())
|
||||
->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_PERCENTAGE_00);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check for currency
|
||||
$currencyCode = PHPExcel_Shared_String::getCurrencyCode();
|
||||
$decimalSeparator = PHPExcel_Shared_String::getDecimalSeparator();
|
||||
$thousandsSeparator = PHPExcel_Shared_String::getThousandsSeparator();
|
||||
if (preg_match('/^'.preg_quote($currencyCode).' *(\d{1,3}('.preg_quote($thousandsSeparator).'\d{3})*|(\d+))('.preg_quote($decimalSeparator).'\d{2})?$/', $value)) {
|
||||
// Convert value to number
|
||||
$value = (float) trim(str_replace(array($currencyCode, $thousandsSeparator, $decimalSeparator), array('', '', '.'), $value));
|
||||
$cell->setValueExplicit($value, PHPExcel_Cell_DataType::TYPE_NUMERIC);
|
||||
// Set style
|
||||
$cell->getWorksheet()->getStyle($cell->getCoordinate())
|
||||
->getNumberFormat()->setFormatCode(
|
||||
str_replace('$', $currencyCode, PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE)
|
||||
);
|
||||
return true;
|
||||
} elseif (preg_match('/^\$ *(\d{1,3}(\,\d{3})*|(\d+))(\.\d{2})?$/', $value)) {
|
||||
// Convert value to number
|
||||
$value = (float) trim(str_replace(array('$',','), '', $value));
|
||||
$cell->setValueExplicit($value, PHPExcel_Cell_DataType::TYPE_NUMERIC);
|
||||
// Set style
|
||||
$cell->getWorksheet()->getStyle($cell->getCoordinate())
|
||||
->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_CURRENCY_USD_SIMPLE);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check for time without seconds e.g. '9:45', '09:45'
|
||||
if (preg_match('/^(\d|[0-1]\d|2[0-3]):[0-5]\d$/', $value)) {
|
||||
// Convert value to number
|
||||
list($h, $m) = explode(':', $value);
|
||||
$days = $h / 24 + $m / 1440;
|
||||
$cell->setValueExplicit($days, PHPExcel_Cell_DataType::TYPE_NUMERIC);
|
||||
// Set style
|
||||
$cell->getWorksheet()->getStyle($cell->getCoordinate())
|
||||
->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME3);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check for time with seconds '9:45:59', '09:45:59'
|
||||
if (preg_match('/^(\d|[0-1]\d|2[0-3]):[0-5]\d:[0-5]\d$/', $value)) {
|
||||
// Convert value to number
|
||||
list($h, $m, $s) = explode(':', $value);
|
||||
$days = $h / 24 + $m / 1440 + $s / 86400;
|
||||
// Convert value to number
|
||||
$cell->setValueExplicit($days, PHPExcel_Cell_DataType::TYPE_NUMERIC);
|
||||
// Set style
|
||||
$cell->getWorksheet()->getStyle($cell->getCoordinate())
|
||||
->getNumberFormat()->setFormatCode(PHPExcel_Style_NumberFormat::FORMAT_DATE_TIME4);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check for datetime, e.g. '2008-12-31', '2008-12-31 15:59', '2008-12-31 15:59:10'
|
||||
if (($d = PHPExcel_Shared_Date::stringToExcel($value)) !== false) {
|
||||
// Convert value to number
|
||||
$cell->setValueExplicit($d, PHPExcel_Cell_DataType::TYPE_NUMERIC);
|
||||
// Determine style. Either there is a time part or not. Look for ':'
|
||||
if (strpos($value, ':') !== false) {
|
||||
$formatCode = 'yyyy-mm-dd h:mm';
|
||||
} else {
|
||||
$formatCode = 'yyyy-mm-dd';
|
||||
}
|
||||
$cell->getWorksheet()->getStyle($cell->getCoordinate())
|
||||
->getNumberFormat()->setFormatCode($formatCode);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check for newline character "\n"
|
||||
if (strpos($value, "\n") !== false) {
|
||||
$value = PHPExcel_Shared_String::SanitizeUTF8($value);
|
||||
$cell->setValueExplicit($value, PHPExcel_Cell_DataType::TYPE_STRING);
|
||||
// Set style
|
||||
$cell->getWorksheet()->getStyle($cell->getCoordinate())
|
||||
->getAlignment()->setWrapText(true);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Not bound yet? Use parent...
|
||||
return parent::bindValue($cell, $value);
|
||||
}
|
||||
}
|
||||
115
Cron/PHPExcel/PHPExcel/Cell/DataType.php
Executable file
115
Cron/PHPExcel/PHPExcel/Cell/DataType.php
Executable file
@@ -0,0 +1,115 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PHPExcel_Cell_DataType
|
||||
*
|
||||
* Copyright (c) 2006 - 2015 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Cell
|
||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version ##VERSION##, ##DATE##
|
||||
*/
|
||||
class PHPExcel_Cell_DataType
|
||||
{
|
||||
/* Data types */
|
||||
const TYPE_STRING2 = 'str';
|
||||
const TYPE_STRING = 's';
|
||||
const TYPE_FORMULA = 'f';
|
||||
const TYPE_NUMERIC = 'n';
|
||||
const TYPE_BOOL = 'b';
|
||||
const TYPE_NULL = 'null';
|
||||
const TYPE_INLINE = 'inlineStr';
|
||||
const TYPE_ERROR = 'e';
|
||||
|
||||
/**
|
||||
* List of error codes
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private static $errorCodes = array(
|
||||
'#NULL!' => 0,
|
||||
'#DIV/0!' => 1,
|
||||
'#VALUE!' => 2,
|
||||
'#REF!' => 3,
|
||||
'#NAME?' => 4,
|
||||
'#NUM!' => 5,
|
||||
'#N/A' => 6
|
||||
);
|
||||
|
||||
/**
|
||||
* Get list of error codes
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public static function getErrorCodes()
|
||||
{
|
||||
return self::$errorCodes;
|
||||
}
|
||||
|
||||
/**
|
||||
* DataType for value
|
||||
*
|
||||
* @deprecated Replaced by PHPExcel_Cell_IValueBinder infrastructure, will be removed in version 1.8.0
|
||||
* @param mixed $pValue
|
||||
* @return string
|
||||
*/
|
||||
public static function dataTypeForValue($pValue = null)
|
||||
{
|
||||
return PHPExcel_Cell_DefaultValueBinder::dataTypeForValue($pValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check a string that it satisfies Excel requirements
|
||||
*
|
||||
* @param mixed Value to sanitize to an Excel string
|
||||
* @return mixed Sanitized value
|
||||
*/
|
||||
public static function checkString($pValue = null)
|
||||
{
|
||||
if ($pValue instanceof PHPExcel_RichText) {
|
||||
// TODO: Sanitize Rich-Text string (max. character count is 32,767)
|
||||
return $pValue;
|
||||
}
|
||||
|
||||
// string must never be longer than 32,767 characters, truncate if necessary
|
||||
$pValue = PHPExcel_Shared_String::Substring($pValue, 0, 32767);
|
||||
|
||||
// we require that newline is represented as "\n" in core, not as "\r\n" or "\r"
|
||||
$pValue = str_replace(array("\r\n", "\r"), "\n", $pValue);
|
||||
|
||||
return $pValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check a value that it is a valid error code
|
||||
*
|
||||
* @param mixed Value to sanitize to an Excel error code
|
||||
* @return string Sanitized value
|
||||
*/
|
||||
public static function checkErrorCode($pValue = null)
|
||||
{
|
||||
$pValue = (string) $pValue;
|
||||
|
||||
if (!array_key_exists($pValue, self::$errorCodes)) {
|
||||
$pValue = '#NULL!';
|
||||
}
|
||||
|
||||
return $pValue;
|
||||
}
|
||||
}
|
||||
492
Cron/PHPExcel/PHPExcel/Cell/DataValidation.php
Executable file
492
Cron/PHPExcel/PHPExcel/Cell/DataValidation.php
Executable file
@@ -0,0 +1,492 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PHPExcel_Cell_DataValidation
|
||||
*
|
||||
* Copyright (c) 2006 - 2015 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Cell
|
||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version ##VERSION##, ##DATE##
|
||||
*/
|
||||
class PHPExcel_Cell_DataValidation
|
||||
{
|
||||
/* Data validation types */
|
||||
const TYPE_NONE = 'none';
|
||||
const TYPE_CUSTOM = 'custom';
|
||||
const TYPE_DATE = 'date';
|
||||
const TYPE_DECIMAL = 'decimal';
|
||||
const TYPE_LIST = 'list';
|
||||
const TYPE_TEXTLENGTH = 'textLength';
|
||||
const TYPE_TIME = 'time';
|
||||
const TYPE_WHOLE = 'whole';
|
||||
|
||||
/* Data validation error styles */
|
||||
const STYLE_STOP = 'stop';
|
||||
const STYLE_WARNING = 'warning';
|
||||
const STYLE_INFORMATION = 'information';
|
||||
|
||||
/* Data validation operators */
|
||||
const OPERATOR_BETWEEN = 'between';
|
||||
const OPERATOR_EQUAL = 'equal';
|
||||
const OPERATOR_GREATERTHAN = 'greaterThan';
|
||||
const OPERATOR_GREATERTHANOREQUAL = 'greaterThanOrEqual';
|
||||
const OPERATOR_LESSTHAN = 'lessThan';
|
||||
const OPERATOR_LESSTHANOREQUAL = 'lessThanOrEqual';
|
||||
const OPERATOR_NOTBETWEEN = 'notBetween';
|
||||
const OPERATOR_NOTEQUAL = 'notEqual';
|
||||
|
||||
/**
|
||||
* Formula 1
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $formula1;
|
||||
|
||||
/**
|
||||
* Formula 2
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $formula2;
|
||||
|
||||
/**
|
||||
* Type
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $type = PHPExcel_Cell_DataValidation::TYPE_NONE;
|
||||
|
||||
/**
|
||||
* Error style
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $errorStyle = PHPExcel_Cell_DataValidation::STYLE_STOP;
|
||||
|
||||
/**
|
||||
* Operator
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $operator;
|
||||
|
||||
/**
|
||||
* Allow Blank
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $allowBlank;
|
||||
|
||||
/**
|
||||
* Show DropDown
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $showDropDown;
|
||||
|
||||
/**
|
||||
* Show InputMessage
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $showInputMessage;
|
||||
|
||||
/**
|
||||
* Show ErrorMessage
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $showErrorMessage;
|
||||
|
||||
/**
|
||||
* Error title
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $errorTitle;
|
||||
|
||||
/**
|
||||
* Error
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $error;
|
||||
|
||||
/**
|
||||
* Prompt title
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $promptTitle;
|
||||
|
||||
/**
|
||||
* Prompt
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $prompt;
|
||||
|
||||
/**
|
||||
* Create a new PHPExcel_Cell_DataValidation
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
// Initialise member variables
|
||||
$this->formula1 = '';
|
||||
$this->formula2 = '';
|
||||
$this->type = PHPExcel_Cell_DataValidation::TYPE_NONE;
|
||||
$this->errorStyle = PHPExcel_Cell_DataValidation::STYLE_STOP;
|
||||
$this->operator = '';
|
||||
$this->allowBlank = false;
|
||||
$this->showDropDown = false;
|
||||
$this->showInputMessage = false;
|
||||
$this->showErrorMessage = false;
|
||||
$this->errorTitle = '';
|
||||
$this->error = '';
|
||||
$this->promptTitle = '';
|
||||
$this->prompt = '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Formula 1
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFormula1()
|
||||
{
|
||||
return $this->formula1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Formula 1
|
||||
*
|
||||
* @param string $value
|
||||
* @return PHPExcel_Cell_DataValidation
|
||||
*/
|
||||
public function setFormula1($value = '')
|
||||
{
|
||||
$this->formula1 = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Formula 2
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFormula2()
|
||||
{
|
||||
return $this->formula2;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Formula 2
|
||||
*
|
||||
* @param string $value
|
||||
* @return PHPExcel_Cell_DataValidation
|
||||
*/
|
||||
public function setFormula2($value = '')
|
||||
{
|
||||
$this->formula2 = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Type
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
return $this->type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Type
|
||||
*
|
||||
* @param string $value
|
||||
* @return PHPExcel_Cell_DataValidation
|
||||
*/
|
||||
public function setType($value = PHPExcel_Cell_DataValidation::TYPE_NONE)
|
||||
{
|
||||
$this->type = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Error style
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getErrorStyle()
|
||||
{
|
||||
return $this->errorStyle;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Error style
|
||||
*
|
||||
* @param string $value
|
||||
* @return PHPExcel_Cell_DataValidation
|
||||
*/
|
||||
public function setErrorStyle($value = PHPExcel_Cell_DataValidation::STYLE_STOP)
|
||||
{
|
||||
$this->errorStyle = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Operator
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getOperator()
|
||||
{
|
||||
return $this->operator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Operator
|
||||
*
|
||||
* @param string $value
|
||||
* @return PHPExcel_Cell_DataValidation
|
||||
*/
|
||||
public function setOperator($value = '')
|
||||
{
|
||||
$this->operator = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Allow Blank
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getAllowBlank()
|
||||
{
|
||||
return $this->allowBlank;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Allow Blank
|
||||
*
|
||||
* @param boolean $value
|
||||
* @return PHPExcel_Cell_DataValidation
|
||||
*/
|
||||
public function setAllowBlank($value = false)
|
||||
{
|
||||
$this->allowBlank = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Show DropDown
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getShowDropDown()
|
||||
{
|
||||
return $this->showDropDown;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Show DropDown
|
||||
*
|
||||
* @param boolean $value
|
||||
* @return PHPExcel_Cell_DataValidation
|
||||
*/
|
||||
public function setShowDropDown($value = false)
|
||||
{
|
||||
$this->showDropDown = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Show InputMessage
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getShowInputMessage()
|
||||
{
|
||||
return $this->showInputMessage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Show InputMessage
|
||||
*
|
||||
* @param boolean $value
|
||||
* @return PHPExcel_Cell_DataValidation
|
||||
*/
|
||||
public function setShowInputMessage($value = false)
|
||||
{
|
||||
$this->showInputMessage = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Show ErrorMessage
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getShowErrorMessage()
|
||||
{
|
||||
return $this->showErrorMessage;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Show ErrorMessage
|
||||
*
|
||||
* @param boolean $value
|
||||
* @return PHPExcel_Cell_DataValidation
|
||||
*/
|
||||
public function setShowErrorMessage($value = false)
|
||||
{
|
||||
$this->showErrorMessage = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Error title
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getErrorTitle()
|
||||
{
|
||||
return $this->errorTitle;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Error title
|
||||
*
|
||||
* @param string $value
|
||||
* @return PHPExcel_Cell_DataValidation
|
||||
*/
|
||||
public function setErrorTitle($value = '')
|
||||
{
|
||||
$this->errorTitle = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Error
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getError()
|
||||
{
|
||||
return $this->error;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Error
|
||||
*
|
||||
* @param string $value
|
||||
* @return PHPExcel_Cell_DataValidation
|
||||
*/
|
||||
public function setError($value = '')
|
||||
{
|
||||
$this->error = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Prompt title
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPromptTitle()
|
||||
{
|
||||
return $this->promptTitle;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Prompt title
|
||||
*
|
||||
* @param string $value
|
||||
* @return PHPExcel_Cell_DataValidation
|
||||
*/
|
||||
public function setPromptTitle($value = '')
|
||||
{
|
||||
$this->promptTitle = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Prompt
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPrompt()
|
||||
{
|
||||
return $this->prompt;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Prompt
|
||||
*
|
||||
* @param string $value
|
||||
* @return PHPExcel_Cell_DataValidation
|
||||
*/
|
||||
public function setPrompt($value = '')
|
||||
{
|
||||
$this->prompt = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get hash code
|
||||
*
|
||||
* @return string Hash code
|
||||
*/
|
||||
public function getHashCode()
|
||||
{
|
||||
return md5(
|
||||
$this->formula1 .
|
||||
$this->formula2 .
|
||||
$this->type = PHPExcel_Cell_DataValidation::TYPE_NONE .
|
||||
$this->errorStyle = PHPExcel_Cell_DataValidation::STYLE_STOP .
|
||||
$this->operator .
|
||||
($this->allowBlank ? 't' : 'f') .
|
||||
($this->showDropDown ? 't' : 'f') .
|
||||
($this->showInputMessage ? 't' : 'f') .
|
||||
($this->showErrorMessage ? 't' : 'f') .
|
||||
$this->errorTitle .
|
||||
$this->error .
|
||||
$this->promptTitle .
|
||||
$this->prompt .
|
||||
__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)) {
|
||||
$this->$key = clone $value;
|
||||
} else {
|
||||
$this->$key = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
102
Cron/PHPExcel/PHPExcel/Cell/DefaultValueBinder.php
Executable file
102
Cron/PHPExcel/PHPExcel/Cell/DefaultValueBinder.php
Executable file
@@ -0,0 +1,102 @@
|
||||
<?php
|
||||
|
||||
/** PHPExcel root directory */
|
||||
if (!defined('PHPEXCEL_ROOT')) {
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
define('PHPEXCEL_ROOT', dirname(__FILE__) . '/../../');
|
||||
require(PHPEXCEL_ROOT . 'PHPExcel/Autoloader.php');
|
||||
}
|
||||
|
||||
/**
|
||||
* PHPExcel_Cell_DefaultValueBinder
|
||||
*
|
||||
* Copyright (c) 2006 - 2015 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Cell
|
||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version ##VERSION##, ##DATE##
|
||||
*/
|
||||
class PHPExcel_Cell_DefaultValueBinder implements PHPExcel_Cell_IValueBinder
|
||||
{
|
||||
/**
|
||||
* Bind value to a cell
|
||||
*
|
||||
* @param PHPExcel_Cell $cell Cell to bind value to
|
||||
* @param mixed $value Value to bind in cell
|
||||
* @return boolean
|
||||
*/
|
||||
public function bindValue(PHPExcel_Cell $cell, $value = null)
|
||||
{
|
||||
// sanitize UTF-8 strings
|
||||
if (is_string($value)) {
|
||||
$value = PHPExcel_Shared_String::SanitizeUTF8($value);
|
||||
} elseif (is_object($value)) {
|
||||
// Handle any objects that might be injected
|
||||
if ($value instanceof DateTime) {
|
||||
$value = $value->format('Y-m-d H:i:s');
|
||||
} elseif (!($value instanceof PHPExcel_RichText)) {
|
||||
$value = (string) $value;
|
||||
}
|
||||
}
|
||||
|
||||
// Set value explicit
|
||||
$cell->setValueExplicit($value, self::dataTypeForValue($value));
|
||||
|
||||
// Done!
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* DataType for value
|
||||
*
|
||||
* @param mixed $pValue
|
||||
* @return string
|
||||
*/
|
||||
public static function dataTypeForValue($pValue = null)
|
||||
{
|
||||
// Match the value against a few data types
|
||||
if ($pValue === null) {
|
||||
return PHPExcel_Cell_DataType::TYPE_NULL;
|
||||
} elseif ($pValue === '') {
|
||||
return PHPExcel_Cell_DataType::TYPE_STRING;
|
||||
} elseif ($pValue instanceof PHPExcel_RichText) {
|
||||
return PHPExcel_Cell_DataType::TYPE_INLINE;
|
||||
} elseif ($pValue{0} === '=' && strlen($pValue) > 1) {
|
||||
return PHPExcel_Cell_DataType::TYPE_FORMULA;
|
||||
} elseif (is_bool($pValue)) {
|
||||
return PHPExcel_Cell_DataType::TYPE_BOOL;
|
||||
} elseif (is_float($pValue) || is_int($pValue)) {
|
||||
return PHPExcel_Cell_DataType::TYPE_NUMERIC;
|
||||
} elseif (preg_match('/^[\+\-]?([0-9]+\\.?[0-9]*|[0-9]*\\.?[0-9]+)([Ee][\-\+]?[0-2]?\d{1,3})?$/', $pValue)) {
|
||||
$tValue = ltrim($pValue, '+-');
|
||||
if (is_string($pValue) && $tValue{0} === '0' && strlen($tValue) > 1 && $tValue{1} !== '.') {
|
||||
return PHPExcel_Cell_DataType::TYPE_STRING;
|
||||
} elseif ((strpos($pValue, '.') === false) && ($pValue > PHP_INT_MAX)) {
|
||||
return PHPExcel_Cell_DataType::TYPE_STRING;
|
||||
}
|
||||
return PHPExcel_Cell_DataType::TYPE_NUMERIC;
|
||||
} elseif (is_string($pValue) && array_key_exists($pValue, PHPExcel_Cell_DataType::getErrorCodes())) {
|
||||
return PHPExcel_Cell_DataType::TYPE_ERROR;
|
||||
}
|
||||
|
||||
return PHPExcel_Cell_DataType::TYPE_STRING;
|
||||
}
|
||||
}
|
||||
124
Cron/PHPExcel/PHPExcel/Cell/Hyperlink.php
Executable file
124
Cron/PHPExcel/PHPExcel/Cell/Hyperlink.php
Executable file
@@ -0,0 +1,124 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PHPExcel_Cell_Hyperlink
|
||||
*
|
||||
* Copyright (c) 2006 - 2015 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Cell
|
||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version ##VERSION##, ##DATE##
|
||||
*/
|
||||
class PHPExcel_Cell_Hyperlink
|
||||
{
|
||||
/**
|
||||
* URL to link the cell to
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $url;
|
||||
|
||||
/**
|
||||
* Tooltip to display on the hyperlink
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $tooltip;
|
||||
|
||||
/**
|
||||
* Create a new PHPExcel_Cell_Hyperlink
|
||||
*
|
||||
* @param string $pUrl Url to link the cell to
|
||||
* @param string $pTooltip Tooltip to display on the hyperlink
|
||||
*/
|
||||
public function __construct($pUrl = '', $pTooltip = '')
|
||||
{
|
||||
// Initialise member variables
|
||||
$this->url = $pUrl;
|
||||
$this->tooltip = $pTooltip;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get URL
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getUrl()
|
||||
{
|
||||
return $this->url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set URL
|
||||
*
|
||||
* @param string $value
|
||||
* @return PHPExcel_Cell_Hyperlink
|
||||
*/
|
||||
public function setUrl($value = '')
|
||||
{
|
||||
$this->url = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get tooltip
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTooltip()
|
||||
{
|
||||
return $this->tooltip;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set tooltip
|
||||
*
|
||||
* @param string $value
|
||||
* @return PHPExcel_Cell_Hyperlink
|
||||
*/
|
||||
public function setTooltip($value = '')
|
||||
{
|
||||
$this->tooltip = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is this hyperlink internal? (to another worksheet)
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function isInternal()
|
||||
{
|
||||
return strpos($this->url, 'sheet://') !== false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get hash code
|
||||
*
|
||||
* @return string Hash code
|
||||
*/
|
||||
public function getHashCode()
|
||||
{
|
||||
return md5(
|
||||
$this->url .
|
||||
$this->tooltip .
|
||||
__CLASS__
|
||||
);
|
||||
}
|
||||
}
|
||||
47
Cron/PHPExcel/PHPExcel/Cell/IValueBinder.php
Executable file
47
Cron/PHPExcel/PHPExcel/Cell/IValueBinder.php
Executable file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PHPExcel
|
||||
*
|
||||
* Copyright (c) 2006 - 2015 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Cell
|
||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version ##VERSION##, ##DATE##
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* PHPExcel_Cell_IValueBinder
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Cell
|
||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
*/
|
||||
interface PHPExcel_Cell_IValueBinder
|
||||
{
|
||||
/**
|
||||
* Bind value to a cell
|
||||
*
|
||||
* @param PHPExcel_Cell $cell Cell to bind value to
|
||||
* @param mixed $value Value to bind in cell
|
||||
* @return boolean
|
||||
*/
|
||||
public function bindValue(PHPExcel_Cell $cell, $value = null);
|
||||
}
|
||||
680
Cron/PHPExcel/PHPExcel/Chart.php
Executable file
680
Cron/PHPExcel/PHPExcel/Chart.php
Executable file
@@ -0,0 +1,680 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PHPExcel_Chart
|
||||
*
|
||||
* Copyright (c) 2006 - 2015 PHPExcel
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPExcel
|
||||
* @package PHPExcel_Chart
|
||||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version ##VERSION##, ##DATE##
|
||||
*/
|
||||
class PHPExcel_Chart
|
||||
{
|
||||
/**
|
||||
* Chart Name
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $name = '';
|
||||
|
||||
/**
|
||||
* Worksheet
|
||||
*
|
||||
* @var PHPExcel_Worksheet
|
||||
*/
|
||||
private $worksheet;
|
||||
|
||||
/**
|
||||
* Chart Title
|
||||
*
|
||||
* @var PHPExcel_Chart_Title
|
||||
*/
|
||||
private $title;
|
||||
|
||||
/**
|
||||
* Chart Legend
|
||||
*
|
||||
* @var PHPExcel_Chart_Legend
|
||||
*/
|
||||
private $legend;
|
||||
|
||||
/**
|
||||
* X-Axis Label
|
||||
*
|
||||
* @var PHPExcel_Chart_Title
|
||||
*/
|
||||
private $xAxisLabel;
|
||||
|
||||
/**
|
||||
* Y-Axis Label
|
||||
*
|
||||
* @var PHPExcel_Chart_Title
|
||||
*/
|
||||
private $yAxisLabel;
|
||||
|
||||
/**
|
||||
* Chart Plot Area
|
||||
*
|
||||
* @var PHPExcel_Chart_PlotArea
|
||||
*/
|
||||
private $plotArea;
|
||||
|
||||
/**
|
||||
* Plot Visible Only
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
private $plotVisibleOnly = true;
|
||||
|
||||
/**
|
||||
* Display Blanks as
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $displayBlanksAs = '0';
|
||||
|
||||
/**
|
||||
* Chart Asix Y as
|
||||
*
|
||||
* @var PHPExcel_Chart_Axis
|
||||
*/
|
||||
private $yAxis;
|
||||
|
||||
/**
|
||||
* Chart Asix X as
|
||||
*
|
||||
* @var PHPExcel_Chart_Axis
|
||||
*/
|
||||
private $xAxis;
|
||||
|
||||
/**
|
||||
* Chart Major Gridlines as
|
||||
*
|
||||
* @var PHPExcel_Chart_GridLines
|
||||
*/
|
||||
private $majorGridlines;
|
||||
|
||||
/**
|
||||
* Chart Minor Gridlines as
|
||||
*
|
||||
* @var PHPExcel_Chart_GridLines
|
||||
*/
|
||||
private $minorGridlines;
|
||||
|
||||
/**
|
||||
* Top-Left Cell Position
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $topLeftCellRef = 'A1';
|
||||
|
||||
|
||||
/**
|
||||
* Top-Left X-Offset
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
private $topLeftXOffset = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Top-Left Y-Offset
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
private $topLeftYOffset = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Bottom-Right Cell Position
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $bottomRightCellRef = 'A1';
|
||||
|
||||
|
||||
/**
|
||||
* Bottom-Right X-Offset
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
private $bottomRightXOffset = 10;
|
||||
|
||||
|
||||
/**
|
||||
* Bottom-Right Y-Offset
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
private $bottomRightYOffset = 10;
|
||||
|
||||
|
||||
/**
|
||||
* Create a new PHPExcel_Chart
|
||||
*/
|
||||
public function __construct($name, PHPExcel_Chart_Title $title = null, PHPExcel_Chart_Legend $legend = null, PHPExcel_Chart_PlotArea $plotArea = null, $plotVisibleOnly = true, $displayBlanksAs = '0', PHPExcel_Chart_Title $xAxisLabel = null, PHPExcel_Chart_Title $yAxisLabel = null, PHPExcel_Chart_Axis $xAxis = null, PHPExcel_Chart_Axis $yAxis = null, PHPExcel_Chart_GridLines $majorGridlines = null, PHPExcel_Chart_GridLines $minorGridlines = null)
|
||||
{
|
||||
$this->name = $name;
|
||||
$this->title = $title;
|
||||
$this->legend = $legend;
|
||||
$this->xAxisLabel = $xAxisLabel;
|
||||
$this->yAxisLabel = $yAxisLabel;
|
||||
$this->plotArea = $plotArea;
|
||||
$this->plotVisibleOnly = $plotVisibleOnly;
|
||||
$this->displayBlanksAs = $displayBlanksAs;
|
||||
$this->xAxis = $xAxis;
|
||||
$this->yAxis = $yAxis;
|
||||
$this->majorGridlines = $majorGridlines;
|
||||
$this->minorGridlines = $minorGridlines;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Name
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Worksheet
|
||||
*
|
||||
* @return PHPExcel_Worksheet
|
||||
*/
|
||||
public function getWorksheet()
|
||||
{
|
||||
return $this->worksheet;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Worksheet
|
||||
*
|
||||
* @param PHPExcel_Worksheet $pValue
|
||||
* @throws PHPExcel_Chart_Exception
|
||||
* @return PHPExcel_Chart
|
||||
*/
|
||||
public function setWorksheet(PHPExcel_Worksheet $pValue = null)
|
||||
{
|
||||
$this->worksheet = $pValue;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Title
|
||||
*
|
||||
* @return PHPExcel_Chart_Title
|
||||
*/
|
||||
public function getTitle()
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Title
|
||||
*
|
||||
* @param PHPExcel_Chart_Title $title
|
||||
* @return PHPExcel_Chart
|
||||
*/
|
||||
public function setTitle(PHPExcel_Chart_Title $title)
|
||||
{
|
||||
$this->title = $title;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Legend
|
||||
*
|
||||
* @return PHPExcel_Chart_Legend
|
||||
*/
|
||||
public function getLegend()
|
||||
{
|
||||
return $this->legend;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Legend
|
||||
*
|
||||
* @param PHPExcel_Chart_Legend $legend
|
||||
* @return PHPExcel_Chart
|
||||
*/
|
||||
public function setLegend(PHPExcel_Chart_Legend $legend)
|
||||
{
|
||||
$this->legend = $legend;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get X-Axis Label
|
||||
*
|
||||
* @return PHPExcel_Chart_Title
|
||||
*/
|
||||
public function getXAxisLabel()
|
||||
{
|
||||
return $this->xAxisLabel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set X-Axis Label
|
||||
*
|
||||
* @param PHPExcel_Chart_Title $label
|
||||
* @return PHPExcel_Chart
|
||||
*/
|
||||
public function setXAxisLabel(PHPExcel_Chart_Title $label)
|
||||
{
|
||||
$this->xAxisLabel = $label;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Y-Axis Label
|
||||
*
|
||||
* @return PHPExcel_Chart_Title
|
||||
*/
|
||||
public function getYAxisLabel()
|
||||
{
|
||||
return $this->yAxisLabel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Y-Axis Label
|
||||
*
|
||||
* @param PHPExcel_Chart_Title $label
|
||||
* @return PHPExcel_Chart
|
||||
*/
|
||||
public function setYAxisLabel(PHPExcel_Chart_Title $label)
|
||||
{
|
||||
$this->yAxisLabel = $label;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Plot Area
|
||||
*
|
||||
* @return PHPExcel_Chart_PlotArea
|
||||
*/
|
||||
public function getPlotArea()
|
||||
{
|
||||
return $this->plotArea;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Plot Visible Only
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function getPlotVisibleOnly()
|
||||
{
|
||||
return $this->plotVisibleOnly;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Plot Visible Only
|
||||
*
|
||||
* @param boolean $plotVisibleOnly
|
||||
* @return PHPExcel_Chart
|
||||
*/
|
||||
public function setPlotVisibleOnly($plotVisibleOnly = true)
|
||||
{
|
||||
$this->plotVisibleOnly = $plotVisibleOnly;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Display Blanks as
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDisplayBlanksAs()
|
||||
{
|
||||
return $this->displayBlanksAs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Display Blanks as
|
||||
*
|
||||
* @param string $displayBlanksAs
|
||||
* @return PHPExcel_Chart
|
||||
*/
|
||||
public function setDisplayBlanksAs($displayBlanksAs = '0')
|
||||
{
|
||||
$this->displayBlanksAs = $displayBlanksAs;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get yAxis
|
||||
*
|
||||
* @return PHPExcel_Chart_Axis
|
||||
*/
|
||||
public function getChartAxisY()
|
||||
{
|
||||
if ($this->yAxis !== null) {
|
||||
return $this->yAxis;
|
||||
}
|
||||
|
||||
return new PHPExcel_Chart_Axis();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get xAxis
|
||||
*
|
||||
* @return PHPExcel_Chart_Axis
|
||||
*/
|
||||
public function getChartAxisX()
|
||||
{
|
||||
if ($this->xAxis !== null) {
|
||||
return $this->xAxis;
|
||||
}
|
||||
|
||||
return new PHPExcel_Chart_Axis();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Major Gridlines
|
||||
*
|
||||
* @return PHPExcel_Chart_GridLines
|
||||
*/
|
||||
public function getMajorGridlines()
|
||||
{
|
||||
if ($this->majorGridlines !== null) {
|
||||
return $this->majorGridlines;
|
||||
}
|
||||
|
||||
return new PHPExcel_Chart_GridLines();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Minor Gridlines
|
||||
*
|
||||
* @return PHPExcel_Chart_GridLines
|
||||
*/
|
||||
public function getMinorGridlines()
|
||||
{
|
||||
if ($this->minorGridlines !== null) {
|
||||
return $this->minorGridlines;
|
||||
}
|
||||
|
||||
return new PHPExcel_Chart_GridLines();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the Top Left position for the chart
|
||||
*
|
||||
* @param string $cell
|
||||
* @param integer $xOffset
|
||||
* @param integer $yOffset
|
||||
* @return PHPExcel_Chart
|
||||
*/
|
||||
public function setTopLeftPosition($cell, $xOffset = null, $yOffset = null)
|
||||
{
|
||||
$this->topLeftCellRef = $cell;
|
||||
if (!is_null($xOffset)) {
|
||||
$this->setTopLeftXOffset($xOffset);
|
||||
}
|
||||
if (!is_null($yOffset)) {
|
||||
$this->setTopLeftYOffset($yOffset);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the top left position of the chart
|
||||
*
|
||||
* @return array an associative array containing the cell address, X-Offset and Y-Offset from the top left of that cell
|
||||
*/
|
||||
public function getTopLeftPosition()
|
||||
{
|
||||
return array(
|
||||
'cell' => $this->topLeftCellRef,
|
||||
'xOffset' => $this->topLeftXOffset,
|
||||
'yOffset' => $this->topLeftYOffset
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the cell address where the top left of the chart is fixed
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTopLeftCell()
|
||||
{
|
||||
return $this->topLeftCellRef;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the Top Left cell position for the chart
|
||||
*
|
||||
* @param string $cell
|
||||
* @return PHPExcel_Chart
|
||||
*/
|
||||
public function setTopLeftCell($cell)
|
||||
{
|
||||
$this->topLeftCellRef = $cell;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the offset position within the Top Left cell for the chart
|
||||
*
|
||||
* @param integer $xOffset
|
||||
* @param integer $yOffset
|
||||
* @return PHPExcel_Chart
|
||||
*/
|
||||
public function setTopLeftOffset($xOffset = null, $yOffset = null)
|
||||
{
|
||||
if (!is_null($xOffset)) {
|
||||
$this->setTopLeftXOffset($xOffset);
|
||||
}
|
||||
if (!is_null($yOffset)) {
|
||||
$this->setTopLeftYOffset($yOffset);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the offset position within the Top Left cell for the chart
|
||||
*
|
||||
* @return integer[]
|
||||
*/
|
||||
public function getTopLeftOffset()
|
||||
{
|
||||
return array(
|
||||
'X' => $this->topLeftXOffset,
|
||||
'Y' => $this->topLeftYOffset
|
||||
);
|
||||
}
|
||||
|
||||
public function setTopLeftXOffset($xOffset)
|
||||
{
|
||||
$this->topLeftXOffset = $xOffset;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getTopLeftXOffset()
|
||||
{
|
||||
return $this->topLeftXOffset;
|
||||
}
|
||||
|
||||
public function setTopLeftYOffset($yOffset)
|
||||
{
|
||||
$this->topLeftYOffset = $yOffset;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getTopLeftYOffset()
|
||||
{
|
||||
return $this->topLeftYOffset;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the Bottom Right position of the chart
|
||||
*
|
||||
* @param string $cell
|
||||
* @param integer $xOffset
|
||||
* @param integer $yOffset
|
||||
* @return PHPExcel_Chart
|
||||
*/
|
||||
public function setBottomRightPosition($cell, $xOffset = null, $yOffset = null)
|
||||
{
|
||||
$this->bottomRightCellRef = $cell;
|
||||
if (!is_null($xOffset)) {
|
||||
$this->setBottomRightXOffset($xOffset);
|
||||
}
|
||||
if (!is_null($yOffset)) {
|
||||
$this->setBottomRightYOffset($yOffset);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the bottom right position of the chart
|
||||
*
|
||||
* @return array an associative array containing the cell address, X-Offset and Y-Offset from the top left of that cell
|
||||
*/
|
||||
public function getBottomRightPosition()
|
||||
{
|
||||
return array(
|
||||
'cell' => $this->bottomRightCellRef,
|
||||
'xOffset' => $this->bottomRightXOffset,
|
||||
'yOffset' => $this->bottomRightYOffset
|
||||
);
|
||||
}
|
||||
|
||||
public function setBottomRightCell($cell)
|
||||
{
|
||||
$this->bottomRightCellRef = $cell;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the cell address where the bottom right of the chart is fixed
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getBottomRightCell()
|
||||
{
|
||||
return $this->bottomRightCellRef;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the offset position within the Bottom Right cell for the chart
|
||||
*
|
||||
* @param integer $xOffset
|
||||
* @param integer $yOffset
|
||||
* @return PHPExcel_Chart
|
||||
*/
|
||||
public function setBottomRightOffset($xOffset = null, $yOffset = null)
|
||||
{
|
||||
if (!is_null($xOffset)) {
|
||||
$this->setBottomRightXOffset($xOffset);
|
||||
}
|
||||
if (!is_null($yOffset)) {
|
||||
$this->setBottomRightYOffset($yOffset);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the offset position within the Bottom Right cell for the chart
|
||||
*
|
||||
* @return integer[]
|
||||
*/
|
||||
public function getBottomRightOffset()
|
||||
{
|
||||
return array(
|
||||
'X' => $this->bottomRightXOffset,
|
||||
'Y' => $this->bottomRightYOffset
|
||||
);
|
||||
}
|
||||
|
||||
public function setBottomRightXOffset($xOffset)
|
||||
{
|
||||
$this->bottomRightXOffset = $xOffset;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getBottomRightXOffset()
|
||||
{
|
||||
return $this->bottomRightXOffset;
|
||||
}
|
||||
|
||||
public function setBottomRightYOffset($yOffset)
|
||||
{
|
||||
$this->bottomRightYOffset = $yOffset;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getBottomRightYOffset()
|
||||
{
|
||||
return $this->bottomRightYOffset;
|
||||
}
|
||||
|
||||
|
||||
public function refresh()
|
||||
{
|
||||
if ($this->worksheet !== null) {
|
||||
$this->plotArea->refresh($this->worksheet);
|
||||
}
|
||||
}
|
||||
|
||||
public function render($outputDestination = null)
|
||||
{
|
||||
$libraryName = PHPExcel_Settings::getChartRendererName();
|
||||
if (is_null($libraryName)) {
|
||||
return false;
|
||||
}
|
||||
// Ensure that data series values are up-to-date before we render
|
||||
$this->refresh();
|
||||
|
||||
$libraryPath = PHPExcel_Settings::getChartRendererPath();
|
||||
$includePath = str_replace('\\', '/', get_include_path());
|
||||
$rendererPath = str_replace('\\', '/', $libraryPath);
|
||||
if (strpos($rendererPath, $includePath) === false) {
|
||||
set_include_path(get_include_path() . PATH_SEPARATOR . $libraryPath);
|
||||
}
|
||||
|
||||
$rendererName = 'PHPExcel_Chart_Renderer_'.$libraryName;
|
||||
$renderer = new $rendererName($this);
|
||||
|
||||
if ($outputDestination == 'php://output') {
|
||||
$outputDestination = null;
|
||||
}
|
||||
return $renderer->render($outputDestination);
|
||||
}
|
||||
}
|
||||
561
Cron/PHPExcel/PHPExcel/Chart/Axis.php
Executable file
561
Cron/PHPExcel/PHPExcel/Chart/Axis.php
Executable file
@@ -0,0 +1,561 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: Wiktor Trzonkowski
|
||||
* Date: 6/17/14
|
||||
* Time: 12:11 PM
|
||||
*/
|
||||
|
||||
class PHPExcel_Chart_Axis extends PHPExcel_Chart_Properties
|
||||
{
|
||||
/**
|
||||
* Axis Number
|
||||
*
|
||||
* @var array of mixed
|
||||
*/
|
||||
private $axisNumber = array(
|
||||
'format' => self::FORMAT_CODE_GENERAL,
|
||||
'source_linked' => 1
|
||||
);
|
||||
|
||||
/**
|
||||
* Axis Options
|
||||
*
|
||||
* @var array of mixed
|
||||
*/
|
||||
private $axisOptions = array(
|
||||
'minimum' => null,
|
||||
'maximum' => null,
|
||||
'major_unit' => null,
|
||||
'minor_unit' => null,
|
||||
'orientation' => self::ORIENTATION_NORMAL,
|
||||
'minor_tick_mark' => self::TICK_MARK_NONE,
|
||||
'major_tick_mark' => self::TICK_MARK_NONE,
|
||||
'axis_labels' => self::AXIS_LABELS_NEXT_TO,
|
||||
'horizontal_crosses' => self::HORIZONTAL_CROSSES_AUTOZERO,
|
||||
'horizontal_crosses_value' => null
|
||||
);
|
||||
|
||||
/**
|
||||
* Fill Properties
|
||||
*
|
||||
* @var array of mixed
|
||||
*/
|
||||
private $fillProperties = array(
|
||||
'type' => self::EXCEL_COLOR_TYPE_ARGB,
|
||||
'value' => null,
|
||||
'alpha' => 0
|
||||
);
|
||||
|
||||
/**
|
||||
* Line Properties
|
||||
*
|
||||
* @var array of mixed
|
||||
*/
|
||||
private $lineProperties = array(
|
||||
'type' => self::EXCEL_COLOR_TYPE_ARGB,
|
||||
'value' => null,
|
||||
'alpha' => 0
|
||||
);
|
||||
|
||||
/**
|
||||
* Line Style Properties
|
||||
*
|
||||
* @var array of mixed
|
||||
*/
|
||||
private $lineStyleProperties = array(
|
||||
'width' => '9525',
|
||||
'compound' => self::LINE_STYLE_COMPOUND_SIMPLE,
|
||||
'dash' => self::LINE_STYLE_DASH_SOLID,
|
||||
'cap' => self::LINE_STYLE_CAP_FLAT,
|
||||
'join' => self::LINE_STYLE_JOIN_BEVEL,
|
||||
'arrow' => array(
|
||||
'head' => array(
|
||||
'type' => self::LINE_STYLE_ARROW_TYPE_NOARROW,
|
||||
'size' => self::LINE_STYLE_ARROW_SIZE_5
|
||||
),
|
||||
'end' => array(
|
||||
'type' => self::LINE_STYLE_ARROW_TYPE_NOARROW,
|
||||
'size' => self::LINE_STYLE_ARROW_SIZE_8
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* Shadow Properties
|
||||
*
|
||||
* @var array of mixed
|
||||
*/
|
||||
private $shadowProperties = array(
|
||||
'presets' => self::SHADOW_PRESETS_NOSHADOW,
|
||||
'effect' => null,
|
||||
'color' => array(
|
||||
'type' => self::EXCEL_COLOR_TYPE_STANDARD,
|
||||
'value' => 'black',
|
||||
'alpha' => 40,
|
||||
),
|
||||
'size' => array(
|
||||
'sx' => null,
|
||||
'sy' => null,
|
||||
'kx' => null
|
||||
),
|
||||
'blur' => null,
|
||||
'direction' => null,
|
||||
'distance' => null,
|
||||
'algn' => null,
|
||||
'rotWithShape' => null
|
||||
);
|
||||
|
||||
/**
|
||||
* Glow Properties
|
||||
*
|
||||
* @var array of mixed
|
||||
*/
|
||||
private $glowProperties = array(
|
||||
'size' => null,
|
||||
'color' => array(
|
||||
'type' => self::EXCEL_COLOR_TYPE_STANDARD,
|
||||
'value' => 'black',
|
||||
'alpha' => 40
|
||||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* Soft Edge Properties
|
||||
*
|
||||
* @var array of mixed
|
||||
*/
|
||||
private $softEdges = array(
|
||||
'size' => null
|
||||
);
|
||||
|
||||
/**
|
||||
* Get Series Data Type
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function setAxisNumberProperties($format_code)
|
||||
{
|
||||
$this->axisNumber['format'] = (string) $format_code;
|
||||
$this->axisNumber['source_linked'] = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Axis Number Format Data Type
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getAxisNumberFormat()
|
||||
{
|
||||
return $this->axisNumber['format'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Axis Number Source Linked
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getAxisNumberSourceLinked()
|
||||
{
|
||||
return (string) $this->axisNumber['source_linked'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Axis Options Properties
|
||||
*
|
||||
* @param string $axis_labels
|
||||
* @param string $horizontal_crosses_value
|
||||
* @param string $horizontal_crosses
|
||||
* @param string $axis_orientation
|
||||
* @param string $major_tmt
|
||||
* @param string $minor_tmt
|
||||
* @param string $minimum
|
||||
* @param string $maximum
|
||||
* @param string $major_unit
|
||||
* @param string $minor_unit
|
||||
*
|
||||
*/
|
||||
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->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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Axis Options Property
|
||||
*
|
||||
* @param string $property
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getAxisOptionsProperty($property)
|
||||
{
|
||||
return $this->axisOptions[$property];
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Axis Orientation Property
|
||||
*
|
||||
* @param string $orientation
|
||||
*
|
||||
*/
|
||||
public function setAxisOrientation($orientation)
|
||||
{
|
||||
$this->orientation = (string) $orientation;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Fill Property
|
||||
*
|
||||
* @param string $color
|
||||
* @param int $alpha
|
||||
* @param string $type
|
||||
*
|
||||
*/
|
||||
public function setFillParameters($color, $alpha = 0, $type = self::EXCEL_COLOR_TYPE_ARGB)
|
||||
{
|
||||
$this->fillProperties = $this->setColorProperties($color, $alpha, $type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Line Property
|
||||
*
|
||||
* @param string $color
|
||||
* @param int $alpha
|
||||
* @param string $type
|
||||
*
|
||||
*/
|
||||
public function setLineParameters($color, $alpha = 0, $type = self::EXCEL_COLOR_TYPE_ARGB)
|
||||
{
|
||||
$this->lineProperties = $this->setColorProperties($color, $alpha, $type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Fill Property
|
||||
*
|
||||
* @param string $property
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFillProperty($property)
|
||||
{
|
||||
return $this->fillProperties[$property];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Line Property
|
||||
*
|
||||
* @param string $property
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLineProperty($property)
|
||||
{
|
||||
return $this->lineProperties[$property];
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Line Style Properties
|
||||
*
|
||||
* @param float $line_width
|
||||
* @param string $compound_type
|
||||
* @param string $dash_type
|
||||
* @param string $cap_type
|
||||
* @param string $join_type
|
||||
* @param string $head_arrow_type
|
||||
* @param string $head_arrow_size
|
||||
* @param string $end_arrow_type
|
||||
* @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->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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Line Style Property
|
||||
*
|
||||
* @param array|string $elements
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLineStyleProperty($elements)
|
||||
{
|
||||
return $this->getArrayElementsValue($this->lineStyleProperties, $elements);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Line Style Arrow Excel Width
|
||||
*
|
||||
* @param string $arrow
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLineStyleArrowWidth($arrow)
|
||||
{
|
||||
return $this->getLineStyleArrowSize($this->lineStyleProperties['arrow'][$arrow]['size'], 'w');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Line Style Arrow Excel Length
|
||||
*
|
||||
* @param string $arrow
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLineStyleArrowLength($arrow)
|
||||
{
|
||||
return $this->getLineStyleArrowSize($this->lineStyleProperties['arrow'][$arrow]['size'], 'len');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Shadow Properties
|
||||
*
|
||||
* @param int $shadow_presets
|
||||
* @param string $sh_color_value
|
||||
* @param string $sh_color_type
|
||||
* @param string $sh_color_alpha
|
||||
* @param float $sh_blur
|
||||
* @param int $sh_angle
|
||||
* @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->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);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Shadow Color
|
||||
*
|
||||
* @param int $shadow_presets
|
||||
*
|
||||
* @return PHPExcel_Chart_Axis
|
||||
*/
|
||||
private function setShadowPresetsProperties($shadow_presets)
|
||||
{
|
||||
$this->shadowProperties['presets'] = $shadow_presets;
|
||||
$this->setShadowProperiesMapValues($this->getShadowPresetsMap($shadow_presets));
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Shadow Properties from Maped Values
|
||||
*
|
||||
* @param array $properties_map
|
||||
* @param * $reference
|
||||
*
|
||||
* @return PHPExcel_Chart_Axis
|
||||
*/
|
||||
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->shadowProperties[$property_key];
|
||||
} else {
|
||||
$reference = & $reference[$property_key];
|
||||
}
|
||||
$this->setShadowProperiesMapValues($property_val, $reference);
|
||||
} else {
|
||||
if ($base_reference === null) {
|
||||
$this->shadowProperties[$property_key] = $property_val;
|
||||
} else {
|
||||
$reference[$property_key] = $property_val;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Shadow Color
|
||||
*
|
||||
* @param string $color
|
||||
* @param int $alpha
|
||||
* @param string $type
|
||||
*
|
||||
* @return PHPExcel_Chart_Axis
|
||||
*/
|
||||
private function setShadowColor($color, $alpha, $type)
|
||||
{
|
||||
$this->shadowProperties['color'] = $this->setColorProperties($color, $alpha, $type);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Shadow Blur
|
||||
*
|
||||
* @param float $blur
|
||||
*
|
||||
* @return PHPExcel_Chart_Axis
|
||||
*/
|
||||
private function setShadowBlur($blur)
|
||||
{
|
||||
if ($blur !== null) {
|
||||
$this->shadowProperties['blur'] = (string) $this->getExcelPointsWidth($blur);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Shadow Angle
|
||||
*
|
||||
* @param int $angle
|
||||
*
|
||||
* @return PHPExcel_Chart_Axis
|
||||
*/
|
||||
private function setShadowAngle($angle)
|
||||
{
|
||||
if ($angle !== null) {
|
||||
$this->shadowProperties['direction'] = (string) $this->getExcelPointsAngle($angle);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Shadow Distance
|
||||
*
|
||||
* @param float $distance
|
||||
*
|
||||
* @return PHPExcel_Chart_Axis
|
||||
*/
|
||||
private function setShadowDistance($distance)
|
||||
{
|
||||
if ($distance !== null) {
|
||||
$this->shadowProperties['distance'] = (string) $this->getExcelPointsWidth($distance);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Glow Property
|
||||
*
|
||||
* @param float $size
|
||||
* @param string $color_value
|
||||
* @param int $color_alpha
|
||||
* @param string $color_type
|
||||
*/
|
||||
public function getShadowProperty($elements)
|
||||
{
|
||||
return $this->getArrayElementsValue($this->shadowProperties, $elements);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Glow Properties
|
||||
*
|
||||
* @param float $size
|
||||
* @param string $color_value
|
||||
* @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->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
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Glow Property
|
||||
*
|
||||
* @param array|string $property
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getGlowProperty($property)
|
||||
{
|
||||
return $this->getArrayElementsValue($this->glowProperties, $property);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Glow Color
|
||||
*
|
||||
* @param float $size
|
||||
*
|
||||
* @return PHPExcel_Chart_Axis
|
||||
*/
|
||||
private function setGlowSize($size)
|
||||
{
|
||||
if (!is_null($size)) {
|
||||
$this->glowProperties['size'] = $this->getExcelPointsWidth($size);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Glow Color
|
||||
*
|
||||
* @param string $color
|
||||
* @param int $alpha
|
||||
* @param string $type
|
||||
*
|
||||
* @return PHPExcel_Chart_Axis
|
||||
*/
|
||||
private function setGlowColor($color, $alpha, $type)
|
||||
{
|
||||
$this->glowProperties['color'] = $this->setColorProperties($color, $alpha, $type);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Soft Edges Size
|
||||
*
|
||||
* @param float $size
|
||||
*/
|
||||
public function setSoftEdges($size)
|
||||
{
|
||||
if (!is_null($size)) {
|
||||
$softEdges['size'] = (string) $this->getExcelPointsWidth($size);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Soft Edges Size
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSoftEdgesSize()
|
||||
{
|
||||
return $this->softEdges['size'];
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user