Version Description
Upgrade to 1.8.1 to get the ability to have different landing pages based on the user's score, give users certificates, and an additional customizable text section at the end of quiz. Plus minor design changes to quiz and Quiz Dashboard and lots of bug fixes.
Download this release
Release Info
Developer | fpcorso |
Plugin | Quiz And Survey Master (Formerly Quiz Master Next) |
Version | 1.8.1 |
Comparing to | |
See all releases |
Code changes from version 1.7.1 to 1.8.1
- includes/WriteHTML.php +110 -0
- includes/font/courier.php +8 -0
- includes/font/courierb.php +8 -0
- includes/font/courierbi.php +8 -0
- includes/font/courieri.php +8 -0
- includes/font/helvetica.php +19 -0
- includes/font/helveticab.php +19 -0
- includes/font/helveticabi.php +19 -0
- includes/font/helveticai.php +19 -0
- includes/font/symbol.php +19 -0
- includes/font/times.php +19 -0
- includes/font/timesb.php +19 -0
- includes/font/timesbi.php +19 -0
- includes/font/timesi.php +19 -0
- includes/font/zapfdingbats.php +19 -0
- includes/fpdf.php +1804 -0
- includes/mlw_dashboard.php +62 -26
- includes/mlw_qmn_credits.php +12 -6
- includes/mlw_quiz.php +252 -55
- includes/mlw_quiz_admin.php +3 -3
- includes/mlw_quiz_install.php +4 -0
- includes/mlw_quiz_options.php +463 -46
- includes/mlw_results_details.php +58 -0
- includes/mlw_update.php +17 -1
- mlw_quizmaster2.php +2 -2
- readme.txt +20 -2
includes/WriteHTML.php
ADDED
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require('fpdf.php');
|
3 |
+
|
4 |
+
class PDF_HTML extends FPDF
|
5 |
+
{
|
6 |
+
var $B=0;
|
7 |
+
var $I=0;
|
8 |
+
var $U=0;
|
9 |
+
var $HREF='';
|
10 |
+
var $ALIGN='';
|
11 |
+
|
12 |
+
function WriteHTML($html)
|
13 |
+
{
|
14 |
+
//HTML parser
|
15 |
+
$html=str_replace("\n",' ',$html);
|
16 |
+
$a=preg_split('/<(.*)>/U',$html,-1,PREG_SPLIT_DELIM_CAPTURE);
|
17 |
+
foreach($a as $i=>$e)
|
18 |
+
{
|
19 |
+
if($i%2==0)
|
20 |
+
{
|
21 |
+
//Text
|
22 |
+
if($this->HREF)
|
23 |
+
$this->PutLink($this->HREF,$e);
|
24 |
+
elseif($this->ALIGN=='center')
|
25 |
+
$this->Cell(0,5,$e,0,1,'C');
|
26 |
+
else
|
27 |
+
$this->Write(5,$e);
|
28 |
+
}
|
29 |
+
else
|
30 |
+
{
|
31 |
+
//Tag
|
32 |
+
if($e[0]=='/')
|
33 |
+
$this->CloseTag(strtoupper(substr($e,1)));
|
34 |
+
else
|
35 |
+
{
|
36 |
+
//Extract properties
|
37 |
+
$a2=explode(' ',$e);
|
38 |
+
$tag=strtoupper(array_shift($a2));
|
39 |
+
$prop=array();
|
40 |
+
foreach($a2 as $v)
|
41 |
+
{
|
42 |
+
if(preg_match('/([^=]*)=["\']?([^"\']*)/',$v,$a3))
|
43 |
+
$prop[strtoupper($a3[1])]=$a3[2];
|
44 |
+
}
|
45 |
+
$this->OpenTag($tag,$prop);
|
46 |
+
}
|
47 |
+
}
|
48 |
+
}
|
49 |
+
}
|
50 |
+
|
51 |
+
function OpenTag($tag,$prop)
|
52 |
+
{
|
53 |
+
//Opening tag
|
54 |
+
if($tag=='B' || $tag=='I' || $tag=='U')
|
55 |
+
$this->SetStyle($tag,true);
|
56 |
+
if($tag=='A')
|
57 |
+
$this->HREF=$prop['HREF'];
|
58 |
+
if($tag=='BR')
|
59 |
+
$this->Ln(5);
|
60 |
+
if($tag=='P')
|
61 |
+
$this->ALIGN=$prop['ALIGN'];
|
62 |
+
if($tag=='HR')
|
63 |
+
{
|
64 |
+
if( !empty($prop['WIDTH']) )
|
65 |
+
$Width = $prop['WIDTH'];
|
66 |
+
else
|
67 |
+
$Width = $this->w - $this->lMargin-$this->rMargin;
|
68 |
+
$this->Ln(2);
|
69 |
+
$x = $this->GetX();
|
70 |
+
$y = $this->GetY();
|
71 |
+
$this->SetLineWidth(0.4);
|
72 |
+
$this->Line($x,$y,$x+$Width,$y);
|
73 |
+
$this->SetLineWidth(0.2);
|
74 |
+
$this->Ln(2);
|
75 |
+
}
|
76 |
+
}
|
77 |
+
|
78 |
+
function CloseTag($tag)
|
79 |
+
{
|
80 |
+
//Closing tag
|
81 |
+
if($tag=='B' || $tag=='I' || $tag=='U')
|
82 |
+
$this->SetStyle($tag,false);
|
83 |
+
if($tag=='A')
|
84 |
+
$this->HREF='';
|
85 |
+
if($tag=='P')
|
86 |
+
$this->ALIGN='';
|
87 |
+
}
|
88 |
+
|
89 |
+
function SetStyle($tag,$enable)
|
90 |
+
{
|
91 |
+
//Modify style and select corresponding font
|
92 |
+
$this->$tag+=($enable ? 1 : -1);
|
93 |
+
$style='';
|
94 |
+
foreach(array('B','I','U') as $s)
|
95 |
+
if($this->$s>0)
|
96 |
+
$style.=$s;
|
97 |
+
$this->SetFont('',$style);
|
98 |
+
}
|
99 |
+
|
100 |
+
function PutLink($URL,$txt)
|
101 |
+
{
|
102 |
+
//Put a hyperlink
|
103 |
+
$this->SetTextColor(0,0,255);
|
104 |
+
$this->SetStyle('U',true);
|
105 |
+
$this->Write(5,$txt,$URL);
|
106 |
+
$this->SetStyle('U',false);
|
107 |
+
$this->SetTextColor(0);
|
108 |
+
}
|
109 |
+
}
|
110 |
+
?>
|
includes/font/courier.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$type = 'Core';
|
3 |
+
$name = 'Courier';
|
4 |
+
$up = -100;
|
5 |
+
$ut = 50;
|
6 |
+
for($i=0;$i<=255;$i++)
|
7 |
+
$cw[chr($i)] = 600;
|
8 |
+
?>
|
includes/font/courierb.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$type = 'Core';
|
3 |
+
$name = 'Courier-Bold';
|
4 |
+
$up = -100;
|
5 |
+
$ut = 50;
|
6 |
+
for($i=0;$i<=255;$i++)
|
7 |
+
$cw[chr($i)] = 600;
|
8 |
+
?>
|
includes/font/courierbi.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$type = 'Core';
|
3 |
+
$name = 'Courier-BoldOblique';
|
4 |
+
$up = -100;
|
5 |
+
$ut = 50;
|
6 |
+
for($i=0;$i<=255;$i++)
|
7 |
+
$cw[chr($i)] = 600;
|
8 |
+
?>
|
includes/font/courieri.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$type = 'Core';
|
3 |
+
$name = 'Courier-Oblique';
|
4 |
+
$up = -100;
|
5 |
+
$ut = 50;
|
6 |
+
for($i=0;$i<=255;$i++)
|
7 |
+
$cw[chr($i)] = 600;
|
8 |
+
?>
|
includes/font/helvetica.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$type = 'Core';
|
3 |
+
$name = 'Helvetica';
|
4 |
+
$up = -100;
|
5 |
+
$ut = 50;
|
6 |
+
$cw = array(
|
7 |
+
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,
|
8 |
+
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,
|
9 |
+
','=>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,
|
10 |
+
'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,
|
11 |
+
'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,
|
12 |
+
'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,
|
13 |
+
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,
|
14 |
+
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,
|
15 |
+
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,
|
16 |
+
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,
|
17 |
+
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,
|
18 |
+
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);
|
19 |
+
?>
|
includes/font/helveticab.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$type = 'Core';
|
3 |
+
$name = 'Helvetica-Bold';
|
4 |
+
$up = -100;
|
5 |
+
$ut = 50;
|
6 |
+
$cw = array(
|
7 |
+
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,
|
8 |
+
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,
|
9 |
+
','=>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,
|
10 |
+
'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,
|
11 |
+
'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,
|
12 |
+
'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,
|
13 |
+
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,
|
14 |
+
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,
|
15 |
+
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,
|
16 |
+
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,
|
17 |
+
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,
|
18 |
+
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);
|
19 |
+
?>
|
includes/font/helveticabi.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$type = 'Core';
|
3 |
+
$name = 'Helvetica-BoldOblique';
|
4 |
+
$up = -100;
|
5 |
+
$ut = 50;
|
6 |
+
$cw = array(
|
7 |
+
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,
|
8 |
+
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,
|
9 |
+
','=>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,
|
10 |
+
'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,
|
11 |
+
'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,
|
12 |
+
'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,
|
13 |
+
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,
|
14 |
+
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,
|
15 |
+
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,
|
16 |
+
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,
|
17 |
+
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,
|
18 |
+
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);
|
19 |
+
?>
|
includes/font/helveticai.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$type = 'Core';
|
3 |
+
$name = 'Helvetica-Oblique';
|
4 |
+
$up = -100;
|
5 |
+
$ut = 50;
|
6 |
+
$cw = array(
|
7 |
+
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,
|
8 |
+
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,
|
9 |
+
','=>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,
|
10 |
+
'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,
|
11 |
+
'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,
|
12 |
+
'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,
|
13 |
+
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,
|
14 |
+
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,
|
15 |
+
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,
|
16 |
+
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,
|
17 |
+
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,
|
18 |
+
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);
|
19 |
+
?>
|
includes/font/symbol.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$type = 'Core';
|
3 |
+
$name = 'Symbol';
|
4 |
+
$up = -100;
|
5 |
+
$ut = 50;
|
6 |
+
$cw = array(
|
7 |
+
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,
|
8 |
+
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,
|
9 |
+
','=>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,
|
10 |
+
'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,
|
11 |
+
'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,
|
12 |
+
'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,
|
13 |
+
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,
|
14 |
+
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,
|
15 |
+
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,
|
16 |
+
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,
|
17 |
+
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,
|
18 |
+
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);
|
19 |
+
?>
|
includes/font/times.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$type = 'Core';
|
3 |
+
$name = 'Times-Roman';
|
4 |
+
$up = -100;
|
5 |
+
$ut = 50;
|
6 |
+
$cw = array(
|
7 |
+
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,
|
8 |
+
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,
|
9 |
+
','=>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,
|
10 |
+
'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,
|
11 |
+
'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,
|
12 |
+
'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,
|
13 |
+
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,
|
14 |
+
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,
|
15 |
+
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,
|
16 |
+
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,
|
17 |
+
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,
|
18 |
+
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);
|
19 |
+
?>
|
includes/font/timesb.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$type = 'Core';
|
3 |
+
$name = 'Times-Bold';
|
4 |
+
$up = -100;
|
5 |
+
$ut = 50;
|
6 |
+
$cw = array(
|
7 |
+
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,
|
8 |
+
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,
|
9 |
+
','=>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,
|
10 |
+
'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,
|
11 |
+
'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,
|
12 |
+
'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,
|
13 |
+
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,
|
14 |
+
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,
|
15 |
+
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,
|
16 |
+
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,
|
17 |
+
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,
|
18 |
+
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);
|
19 |
+
?>
|
includes/font/timesbi.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$type = 'Core';
|
3 |
+
$name = 'Times-BoldItalic';
|
4 |
+
$up = -100;
|
5 |
+
$ut = 50;
|
6 |
+
$cw = array(
|
7 |
+
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,
|
8 |
+
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,
|
9 |
+
','=>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,
|
10 |
+
'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,
|
11 |
+
'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,
|
12 |
+
'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,
|
13 |
+
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,
|
14 |
+
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,
|
15 |
+
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,
|
16 |
+
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,
|
17 |
+
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,
|
18 |
+
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);
|
19 |
+
?>
|
includes/font/timesi.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$type = 'Core';
|
3 |
+
$name = 'Times-Italic';
|
4 |
+
$up = -100;
|
5 |
+
$ut = 50;
|
6 |
+
$cw = array(
|
7 |
+
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,
|
8 |
+
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,
|
9 |
+
','=>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,
|
10 |
+
'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,
|
11 |
+
'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,
|
12 |
+
'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,
|
13 |
+
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,
|
14 |
+
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,
|
15 |
+
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,
|
16 |
+
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,
|
17 |
+
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,
|
18 |
+
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);
|
19 |
+
?>
|
includes/font/zapfdingbats.php
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$type = 'Core';
|
3 |
+
$name = 'ZapfDingbats';
|
4 |
+
$up = -100;
|
5 |
+
$ut = 50;
|
6 |
+
$cw = array(
|
7 |
+
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,
|
8 |
+
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,
|
9 |
+
','=>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,
|
10 |
+
'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,
|
11 |
+
'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,
|
12 |
+
'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,
|
13 |
+
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,
|
14 |
+
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,
|
15 |
+
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,
|
16 |
+
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,
|
17 |
+
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,
|
18 |
+
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);
|
19 |
+
?>
|
includes/fpdf.php
ADDED
@@ -0,0 +1,1804 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*******************************************************************************
|
3 |
+
* FPDF *
|
4 |
+
* *
|
5 |
+
* Version: 1.7 *
|
6 |
+
* Date: 2011-06-18 *
|
7 |
+
* Author: Olivier PLATHEY *
|
8 |
+
*******************************************************************************/
|
9 |
+
|
10 |
+
define('FPDF_VERSION','1.7');
|
11 |
+
|
12 |
+
class FPDF
|
13 |
+
{
|
14 |
+
var $page; // current page number
|
15 |
+
var $n; // current object number
|
16 |
+
var $offsets; // array of object offsets
|
17 |
+
var $buffer; // buffer holding in-memory PDF
|
18 |
+
var $pages; // array containing pages
|
19 |
+
var $state; // current document state
|
20 |
+
var $compress; // compression flag
|
21 |
+
var $k; // scale factor (number of points in user unit)
|
22 |
+
var $DefOrientation; // default orientation
|
23 |
+
var $CurOrientation; // current orientation
|
24 |
+
var $StdPageSizes; // standard page sizes
|
25 |
+
var $DefPageSize; // default page size
|
26 |
+
var $CurPageSize; // current page size
|
27 |
+
var $PageSizes; // used for pages with non default sizes or orientations
|
28 |
+
var $wPt, $hPt; // dimensions of current page in points
|
29 |
+
var $w, $h; // dimensions of current page in user unit
|
30 |
+
var $lMargin; // left margin
|
31 |
+
var $tMargin; // top margin
|
32 |
+
var $rMargin; // right margin
|
33 |
+
var $bMargin; // page break margin
|
34 |
+
var $cMargin; // cell margin
|
35 |
+
var $x, $y; // current position in user unit
|
36 |
+
var $lasth; // height of last printed cell
|
37 |
+
var $LineWidth; // line width in user unit
|
38 |
+
var $fontpath; // path containing fonts
|
39 |
+
var $CoreFonts; // array of core font names
|
40 |
+
var $fonts; // array of used fonts
|
41 |
+
var $FontFiles; // array of font files
|
42 |
+
var $diffs; // array of encoding differences
|
43 |
+
var $FontFamily; // current font family
|
44 |
+
var $FontStyle; // current font style
|
45 |
+
var $underline; // underlining flag
|
46 |
+
var $CurrentFont; // current font info
|
47 |
+
var $FontSizePt; // current font size in points
|
48 |
+
var $FontSize; // current font size in user unit
|
49 |
+
var $DrawColor; // commands for drawing color
|
50 |
+
var $FillColor; // commands for filling color
|
51 |
+
var $TextColor; // commands for text color
|
52 |
+
var $ColorFlag; // indicates whether fill and text colors are different
|
53 |
+
var $ws; // word spacing
|
54 |
+
var $images; // array of used images
|
55 |
+
var $PageLinks; // array of links in pages
|
56 |
+
var $links; // array of internal links
|
57 |
+
var $AutoPageBreak; // automatic page breaking
|
58 |
+
var $PageBreakTrigger; // threshold used to trigger page breaks
|
59 |
+
var $InHeader; // flag set when processing header
|
60 |
+
var $InFooter; // flag set when processing footer
|
61 |
+
var $ZoomMode; // zoom display mode
|
62 |
+
var $LayoutMode; // layout display mode
|
63 |
+
var $title; // title
|
64 |
+
var $subject; // subject
|
65 |
+
var $author; // author
|
66 |
+
var $keywords; // keywords
|
67 |
+
var $creator; // creator
|
68 |
+
var $AliasNbPages; // alias for total number of pages
|
69 |
+
var $PDFVersion; // PDF version number
|
70 |
+
|
71 |
+
/*******************************************************************************
|
72 |
+
* *
|
73 |
+
* Public methods *
|
74 |
+
* *
|
75 |
+
*******************************************************************************/
|
76 |
+
function FPDF($orientation='P', $unit='mm', $size='A4')
|
77 |
+
{
|
78 |
+
// Some checks
|
79 |
+
$this->_dochecks();
|
80 |
+
// Initialization of properties
|
81 |
+
$this->page = 0;
|
82 |
+
$this->n = 2;
|
83 |
+
$this->buffer = '';
|
84 |
+
$this->pages = array();
|
85 |
+
$this->PageSizes = array();
|
86 |
+
$this->state = 0;
|
87 |
+
$this->fonts = array();
|
88 |
+
$this->FontFiles = array();
|
89 |
+
$this->diffs = array();
|
90 |
+
$this->images = array();
|
91 |
+
$this->links = array();
|
92 |
+
$this->InHeader = false;
|
93 |
+
$this->InFooter = false;
|
94 |
+
$this->lasth = 0;
|
95 |
+
$this->FontFamily = '';
|
96 |
+
$this->FontStyle = '';
|
97 |
+
$this->FontSizePt = 12;
|
98 |
+
$this->underline = false;
|
99 |
+
$this->DrawColor = '0 G';
|
100 |
+
$this->FillColor = '0 g';
|
101 |
+
$this->TextColor = '0 g';
|
102 |
+
$this->ColorFlag = false;
|
103 |
+
$this->ws = 0;
|
104 |
+
// Font path
|
105 |
+
if(defined('FPDF_FONTPATH'))
|
106 |
+
{
|
107 |
+
$this->fontpath = FPDF_FONTPATH;
|
108 |
+
if(substr($this->fontpath,-1)!='/' && substr($this->fontpath,-1)!='\\')
|
109 |
+
$this->fontpath .= '/';
|
110 |
+
}
|
111 |
+
elseif(is_dir(dirname(__FILE__).'/font'))
|
112 |
+
$this->fontpath = dirname(__FILE__).'/font/';
|
113 |
+
else
|
114 |
+
$this->fontpath = '';
|
115 |
+
// Core fonts
|
116 |
+
$this->CoreFonts = array('courier', 'helvetica', 'times', 'symbol', 'zapfdingbats');
|
117 |
+
// Scale factor
|
118 |
+
if($unit=='pt')
|
119 |
+
$this->k = 1;
|
120 |
+
elseif($unit=='mm')
|
121 |
+
$this->k = 72/25.4;
|
122 |
+
elseif($unit=='cm')
|
123 |
+
$this->k = 72/2.54;
|
124 |
+
elseif($unit=='in')
|
125 |
+
$this->k = 72;
|
126 |
+
else
|
127 |
+
$this->Error('Incorrect unit: '.$unit);
|
128 |
+
// Page sizes
|
129 |
+
$this->StdPageSizes = array('a3'=>array(841.89,1190.55), 'a4'=>array(595.28,841.89), 'a5'=>array(420.94,595.28),
|
130 |
+
'letter'=>array(612,792), 'legal'=>array(612,1008));
|
131 |
+
$size = $this->_getpagesize($size);
|
132 |
+
$this->DefPageSize = $size;
|
133 |
+
$this->CurPageSize = $size;
|
134 |
+
// Page orientation
|
135 |
+
$orientation = strtolower($orientation);
|
136 |
+
if($orientation=='p' || $orientation=='portrait')
|
137 |
+
{
|
138 |
+
$this->DefOrientation = 'P';
|
139 |
+
$this->w = $size[0];
|
140 |
+
$this->h = $size[1];
|
141 |
+
}
|
142 |
+
elseif($orientation=='l' || $orientation=='landscape')
|
143 |
+
{
|
144 |
+
$this->DefOrientation = 'L';
|
145 |
+
$this->w = $size[1];
|
146 |
+
$this->h = $size[0];
|
147 |
+
}
|
148 |
+
else
|
149 |
+
$this->Error('Incorrect orientation: '.$orientation);
|
150 |
+
$this->CurOrientation = $this->DefOrientation;
|
151 |
+
$this->wPt = $this->w*$this->k;
|
152 |
+
$this->hPt = $this->h*$this->k;
|
153 |
+
// Page margins (1 cm)
|
154 |
+
$margin = 28.35/$this->k;
|
155 |
+
$this->SetMargins($margin,$margin);
|
156 |
+
// Interior cell margin (1 mm)
|
157 |
+
$this->cMargin = $margin/10;
|
158 |
+
// Line width (0.2 mm)
|
159 |
+
$this->LineWidth = .567/$this->k;
|
160 |
+
// Automatic page break
|
161 |
+
$this->SetAutoPageBreak(true,2*$margin);
|
162 |
+
// Default display mode
|
163 |
+
$this->SetDisplayMode('default');
|
164 |
+
// Enable compression
|
165 |
+
$this->SetCompression(true);
|
166 |
+
// Set default PDF version number
|
167 |
+
$this->PDFVersion = '1.3';
|
168 |
+
}
|
169 |
+
|
170 |
+
function SetMargins($left, $top, $right=null)
|
171 |
+
{
|
172 |
+
// Set left, top and right margins
|
173 |
+
$this->lMargin = $left;
|
174 |
+
$this->tMargin = $top;
|
175 |
+
if($right===null)
|
176 |
+
$right = $left;
|
177 |
+
$this->rMargin = $right;
|
178 |
+
}
|
179 |
+
|
180 |
+
function SetLeftMargin($margin)
|
181 |
+
{
|
182 |
+
// Set left margin
|
183 |
+
$this->lMargin = $margin;
|
184 |
+
if($this->page>0 && $this->x<$margin)
|
185 |
+
$this->x = $margin;
|
186 |
+
}
|
187 |
+
|
188 |
+
function SetTopMargin($margin)
|
189 |
+
{
|
190 |
+
// Set top margin
|
191 |
+
$this->tMargin = $margin;
|
192 |
+
}
|
193 |
+
|
194 |
+
function SetRightMargin($margin)
|
195 |
+
{
|
196 |
+
// Set right margin
|
197 |
+
$this->rMargin = $margin;
|
198 |
+
}
|
199 |
+
|
200 |
+
function SetAutoPageBreak($auto, $margin=0)
|
201 |
+
{
|
202 |
+
// Set auto page break mode and triggering margin
|
203 |
+
$this->AutoPageBreak = $auto;
|
204 |
+
$this->bMargin = $margin;
|
205 |
+
$this->PageBreakTrigger = $this->h-$margin;
|
206 |
+
}
|
207 |
+
|
208 |
+
function SetDisplayMode($zoom, $layout='default')
|
209 |
+
{
|
210 |
+
// Set display mode in viewer
|
211 |
+
if($zoom=='fullpage' || $zoom=='fullwidth' || $zoom=='real' || $zoom=='default' || !is_string($zoom))
|
212 |
+
$this->ZoomMode = $zoom;
|
213 |
+
else
|
214 |
+
$this->Error('Incorrect zoom display mode: '.$zoom);
|
215 |
+
if($layout=='single' || $layout=='continuous' || $layout=='two' || $layout=='default')
|
216 |
+
$this->LayoutMode = $layout;
|
217 |
+
else
|
218 |
+
$this->Error('Incorrect layout display mode: '.$layout);
|
219 |
+
}
|
220 |
+
|
221 |
+
function SetCompression($compress)
|
222 |
+
{
|
223 |
+
// Set page compression
|
224 |
+
if(function_exists('gzcompress'))
|
225 |
+
$this->compress = $compress;
|
226 |
+
else
|
227 |
+
$this->compress = false;
|
228 |
+
}
|
229 |
+
|
230 |
+
function SetTitle($title, $isUTF8=false)
|
231 |
+
{
|
232 |
+
// Title of document
|
233 |
+
if($isUTF8)
|
234 |
+
$title = $this->_UTF8toUTF16($title);
|
235 |
+
$this->title = $title;
|
236 |
+
}
|
237 |
+
|
238 |
+
function SetSubject($subject, $isUTF8=false)
|
239 |
+
{
|
240 |
+
// Subject of document
|
241 |
+
if($isUTF8)
|
242 |
+
$subject = $this->_UTF8toUTF16($subject);
|
243 |
+
$this->subject = $subject;
|
244 |
+
}
|
245 |
+
|
246 |
+
function SetAuthor($author, $isUTF8=false)
|
247 |
+
{
|
248 |
+
// Author of document
|
249 |
+
if($isUTF8)
|
250 |
+
$author = $this->_UTF8toUTF16($author);
|
251 |
+
$this->author = $author;
|
252 |
+
}
|
253 |
+
|
254 |
+
function SetKeywords($keywords, $isUTF8=false)
|
255 |
+
{
|
256 |
+
// Keywords of document
|
257 |
+
if($isUTF8)
|
258 |
+
$keywords = $this->_UTF8toUTF16($keywords);
|
259 |
+
$this->keywords = $keywords;
|
260 |
+
}
|
261 |
+
|
262 |
+
function SetCreator($creator, $isUTF8=false)
|
263 |
+
{
|
264 |
+
// Creator of document
|
265 |
+
if($isUTF8)
|
266 |
+
$creator = $this->_UTF8toUTF16($creator);
|
267 |
+
$this->creator = $creator;
|
268 |
+
}
|
269 |
+
|
270 |
+
function AliasNbPages($alias='{nb}')
|
271 |
+
{
|
272 |
+
// Define an alias for total number of pages
|
273 |
+
$this->AliasNbPages = $alias;
|
274 |
+
}
|
275 |
+
|
276 |
+
function Error($msg)
|
277 |
+
{
|
278 |
+
// Fatal error
|
279 |
+
die('<b>FPDF error:</b> '.$msg);
|
280 |
+
}
|
281 |
+
|
282 |
+
function Open()
|
283 |
+
{
|
284 |
+
// Begin document
|
285 |
+
$this->state = 1;
|
286 |
+
}
|
287 |
+
|
288 |
+
function Close()
|
289 |
+
{
|
290 |
+
// Terminate document
|
291 |
+
if($this->state==3)
|
292 |
+
return;
|
293 |
+
if($this->page==0)
|
294 |
+
$this->AddPage();
|
295 |
+
// Page footer
|
296 |
+
$this->InFooter = true;
|
297 |
+
$this->Footer();
|
298 |
+
$this->InFooter = false;
|
299 |
+
// Close page
|
300 |
+
$this->_endpage();
|
301 |
+
// Close document
|
302 |
+
$this->_enddoc();
|
303 |
+
}
|
304 |
+
|
305 |
+
function AddPage($orientation='', $size='')
|
306 |
+
{
|
307 |
+
// Start a new page
|
308 |
+
if($this->state==0)
|
309 |
+
$this->Open();
|
310 |
+
$family = $this->FontFamily;
|
311 |
+
$style = $this->FontStyle.($this->underline ? 'U' : '');
|
312 |
+
$fontsize = $this->FontSizePt;
|
313 |
+
$lw = $this->LineWidth;
|
314 |
+
$dc = $this->DrawColor;
|
315 |
+
$fc = $this->FillColor;
|
316 |
+
$tc = $this->TextColor;
|
317 |
+
$cf = $this->ColorFlag;
|
318 |
+
if($this->page>0)
|
319 |
+
{
|
320 |
+
// Page footer
|
321 |
+
$this->InFooter = true;
|
322 |
+
$this->Footer();
|
323 |
+
$this->InFooter = false;
|
324 |
+
// Close page
|
325 |
+
$this->_endpage();
|
326 |
+
}
|
327 |
+
// Start new page
|
328 |
+
$this->_beginpage($orientation,$size);
|
329 |
+
// Set line cap style to square
|
330 |
+
$this->_out('2 J');
|
331 |
+
// Set line width
|
332 |
+
$this->LineWidth = $lw;
|
333 |
+
$this->_out(sprintf('%.2F w',$lw*$this->k));
|
334 |
+
// Set font
|
335 |
+
if($family)
|
336 |
+
$this->SetFont($family,$style,$fontsize);
|
337 |
+
// Set colors
|
338 |
+
$this->DrawColor = $dc;
|
339 |
+
if($dc!='0 G')
|
340 |
+
$this->_out($dc);
|
341 |
+
$this->FillColor = $fc;
|
342 |
+
if($fc!='0 g')
|
343 |
+
$this->_out($fc);
|
344 |
+
$this->TextColor = $tc;
|
345 |
+
$this->ColorFlag = $cf;
|
346 |
+
// Page header
|
347 |
+
$this->InHeader = true;
|
348 |
+
$this->Header();
|
349 |
+
$this->InHeader = false;
|
350 |
+
// Restore line width
|
351 |
+
if($this->LineWidth!=$lw)
|
352 |
+
{
|
353 |
+
$this->LineWidth = $lw;
|
354 |
+
$this->_out(sprintf('%.2F w',$lw*$this->k));
|
355 |
+
}
|
356 |
+
// Restore font
|
357 |
+
if($family)
|
358 |
+
$this->SetFont($family,$style,$fontsize);
|
359 |
+
// Restore colors
|
360 |
+
if($this->DrawColor!=$dc)
|
361 |
+
{
|
362 |
+
$this->DrawColor = $dc;
|
363 |
+
$this->_out($dc);
|
364 |
+
}
|
365 |
+
if($this->FillColor!=$fc)
|
366 |
+
{
|
367 |
+
$this->FillColor = $fc;
|
368 |
+
$this->_out($fc);
|
369 |
+
}
|
370 |
+
$this->TextColor = $tc;
|
371 |
+
$this->ColorFlag = $cf;
|
372 |
+
}
|
373 |
+
|
374 |
+
function Header()
|
375 |
+
{
|
376 |
+
// To be implemented in your own inherited class
|
377 |
+
}
|
378 |
+
|
379 |
+
function Footer()
|
380 |
+
{
|
381 |
+
// To be implemented in your own inherited class
|
382 |
+
}
|
383 |
+
|
384 |
+
function PageNo()
|
385 |
+
{
|
386 |
+
// Get current page number
|
387 |
+
return $this->page;
|
388 |
+
}
|
389 |
+
|
390 |
+
function SetDrawColor($r, $g=null, $b=null)
|
391 |
+
{
|
392 |
+
// Set color for all stroking operations
|
393 |
+
if(($r==0 && $g==0 && $b==0) || $g===null)
|
394 |
+
$this->DrawColor = sprintf('%.3F G',$r/255);
|
395 |
+
else
|
396 |
+
$this->DrawColor = sprintf('%.3F %.3F %.3F RG',$r/255,$g/255,$b/255);
|
397 |
+
if($this->page>0)
|
398 |
+
$this->_out($this->DrawColor);
|
399 |
+
}
|
400 |
+
|
401 |
+
function SetFillColor($r, $g=null, $b=null)
|
402 |
+
{
|
403 |
+
// Set color for all filling operations
|
404 |
+
if(($r==0 && $g==0 && $b==0) || $g===null)
|
405 |
+
$this->FillColor = sprintf('%.3F g',$r/255);
|
406 |
+
else
|
407 |
+
$this->FillColor = sprintf('%.3F %.3F %.3F rg',$r/255,$g/255,$b/255);
|
408 |
+
$this->ColorFlag = ($this->FillColor!=$this->TextColor);
|
409 |
+
if($this->page>0)
|
410 |
+
$this->_out($this->FillColor);
|
411 |
+
}
|
412 |
+
|
413 |
+
function SetTextColor($r, $g=null, $b=null)
|
414 |
+
{
|
415 |
+
// Set color for text
|
416 |
+
if(($r==0 && $g==0 && $b==0) || $g===null)
|
417 |
+
$this->TextColor = sprintf('%.3F g',$r/255);
|
418 |
+
else
|
419 |
+
$this->TextColor = sprintf('%.3F %.3F %.3F rg',$r/255,$g/255,$b/255);
|
420 |
+
$this->ColorFlag = ($this->FillColor!=$this->TextColor);
|
421 |
+
}
|
422 |
+
|
423 |
+
function GetStringWidth($s)
|
424 |
+
{
|
425 |
+
// Get width of a string in the current font
|
426 |
+
$s = (string)$s;
|
427 |
+
$cw = &$this->CurrentFont['cw'];
|
428 |
+
$w = 0;
|
429 |
+
$l = strlen($s);
|
430 |
+
for($i=0;$i<$l;$i++)
|
431 |
+
$w += $cw[$s[$i]];
|
432 |
+
return $w*$this->FontSize/1000;
|
433 |
+
}
|
434 |
+
|
435 |
+
function SetLineWidth($width)
|
436 |
+
{
|
437 |
+
// Set line width
|
438 |
+
$this->LineWidth = $width;
|
439 |
+
if($this->page>0)
|
440 |
+
$this->_out(sprintf('%.2F w',$width*$this->k));
|
441 |
+
}
|
442 |
+
|
443 |
+
function Line($x1, $y1, $x2, $y2)
|
444 |
+
{
|
445 |
+
// Draw a line
|
446 |
+
$this->_out(sprintf('%.2F %.2F m %.2F %.2F l S',$x1*$this->k,($this->h-$y1)*$this->k,$x2*$this->k,($this->h-$y2)*$this->k));
|
447 |
+
}
|
448 |
+
|
449 |
+
function Rect($x, $y, $w, $h, $style='')
|
450 |
+
{
|
451 |
+
// Draw a rectangle
|
452 |
+
if($style=='F')
|
453 |
+
$op = 'f';
|
454 |
+
elseif($style=='FD' || $style=='DF')
|
455 |
+
$op = 'B';
|
456 |
+
else
|
457 |
+
$op = 'S';
|
458 |
+
$this->_out(sprintf('%.2F %.2F %.2F %.2F re %s',$x*$this->k,($this->h-$y)*$this->k,$w*$this->k,-$h*$this->k,$op));
|
459 |
+
}
|
460 |
+
|
461 |
+
function AddFont($family, $style='', $file='')
|
462 |
+
{
|
463 |
+
// Add a TrueType, OpenType or Type1 font
|
464 |
+
$family = strtolower($family);
|
465 |
+
if($file=='')
|
466 |
+
$file = str_replace(' ','',$family).strtolower($style).'.php';
|
467 |
+
$style = strtoupper($style);
|
468 |
+
if($style=='IB')
|
469 |
+
$style = 'BI';
|
470 |
+
$fontkey = $family.$style;
|
471 |
+
if(isset($this->fonts[$fontkey]))
|
472 |
+
return;
|
473 |
+
$info = $this->_loadfont($file);
|
474 |
+
$info['i'] = count($this->fonts)+1;
|
475 |
+
if(!empty($info['diff']))
|
476 |
+
{
|
477 |
+
// Search existing encodings
|
478 |
+
$n = array_search($info['diff'],$this->diffs);
|
479 |
+
if(!$n)
|
480 |
+
{
|
481 |
+
$n = count($this->diffs)+1;
|
482 |
+
$this->diffs[$n] = $info['diff'];
|
483 |
+
}
|
484 |
+
$info['diffn'] = $n;
|
485 |
+
}
|
486 |
+
if(!empty($info['file']))
|
487 |
+
{
|
488 |
+
// Embedded font
|
489 |
+
if($info['type']=='TrueType')
|
490 |
+
$this->FontFiles[$info['file']] = array('length1'=>$info['originalsize']);
|
491 |
+
else
|
492 |
+
$this->FontFiles[$info['file']] = array('length1'=>$info['size1'], 'length2'=>$info['size2']);
|
493 |
+
}
|
494 |
+
$this->fonts[$fontkey] = $info;
|
495 |
+
}
|
496 |
+
|
497 |
+
function SetFont($family, $style='', $size=0)
|
498 |
+
{
|
499 |
+
// Select a font; size given in points
|
500 |
+
if($family=='')
|
501 |
+
$family = $this->FontFamily;
|
502 |
+
else
|
503 |
+
$family = strtolower($family);
|
504 |
+
$style = strtoupper($style);
|
505 |
+
if(strpos($style,'U')!==false)
|
506 |
+
{
|
507 |
+
$this->underline = true;
|
508 |
+
$style = str_replace('U','',$style);
|
509 |
+
}
|
510 |
+
else
|
511 |
+
$this->underline = false;
|
512 |
+
if($style=='IB')
|
513 |
+
$style = 'BI';
|
514 |
+
if($size==0)
|
515 |
+
$size = $this->FontSizePt;
|
516 |
+
// Test if font is already selected
|
517 |
+
if($this->FontFamily==$family && $this->FontStyle==$style && $this->FontSizePt==$size)
|
518 |
+
return;
|
519 |
+
// Test if font is already loaded
|
520 |
+
$fontkey = $family.$style;
|
521 |
+
if(!isset($this->fonts[$fontkey]))
|
522 |
+
{
|
523 |
+
// Test if one of the core fonts
|
524 |
+
if($family=='arial')
|
525 |
+
$family = 'helvetica';
|
526 |
+
if(in_array($family,$this->CoreFonts))
|
527 |
+
{
|
528 |
+
if($family=='symbol' || $family=='zapfdingbats')
|
529 |
+
$style = '';
|
530 |
+
$fontkey = $family.$style;
|
531 |
+
if(!isset($this->fonts[$fontkey]))
|
532 |
+
$this->AddFont($family,$style);
|
533 |
+
}
|
534 |
+
else
|
535 |
+
$this->Error('Undefined font: '.$family.' '.$style);
|
536 |
+
}
|
537 |
+
// Select it
|
538 |
+
$this->FontFamily = $family;
|
539 |
+
$this->FontStyle = $style;
|
540 |
+
$this->FontSizePt = $size;
|
541 |
+
$this->FontSize = $size/$this->k;
|
542 |
+
$this->CurrentFont = &$this->fonts[$fontkey];
|
543 |
+
if($this->page>0)
|
544 |
+
$this->_out(sprintf('BT /F%d %.2F Tf ET',$this->CurrentFont['i'],$this->FontSizePt));
|
545 |
+
}
|
546 |
+
|
547 |
+
function SetFontSize($size)
|
548 |
+
{
|
549 |
+
// Set font size in points
|
550 |
+
if($this->FontSizePt==$size)
|
551 |
+
return;
|
552 |
+
$this->FontSizePt = $size;
|
553 |
+
$this->FontSize = $size/$this->k;
|
554 |
+
if($this->page>0)
|
555 |
+
$this->_out(sprintf('BT /F%d %.2F Tf ET',$this->CurrentFont['i'],$this->FontSizePt));
|
556 |
+
}
|
557 |
+
|
558 |
+
function AddLink()
|
559 |
+
{
|
560 |
+
// Create a new internal link
|
561 |
+
$n = count($this->links)+1;
|
562 |
+
$this->links[$n] = array(0, 0);
|
563 |
+
return $n;
|
564 |
+
}
|
565 |
+
|
566 |
+
function SetLink($link, $y=0, $page=-1)
|
567 |
+
{
|
568 |
+
// Set destination of internal link
|
569 |
+
if($y==-1)
|
570 |
+
$y = $this->y;
|
571 |
+
if($page==-1)
|
572 |
+
$page = $this->page;
|
573 |
+
$this->links[$link] = array($page, $y);
|
574 |
+
}
|
575 |
+
|
576 |
+
function Link($x, $y, $w, $h, $link)
|
577 |
+
{
|
578 |
+
// Put a link on the page
|
579 |
+
$this->PageLinks[$this->page][] = array($x*$this->k, $this->hPt-$y*$this->k, $w*$this->k, $h*$this->k, $link);
|
580 |
+
}
|
581 |
+
|
582 |
+
function Text($x, $y, $txt)
|
583 |
+
{
|
584 |
+
// Output a string
|
585 |
+
$s = sprintf('BT %.2F %.2F Td (%s) Tj ET',$x*$this->k,($this->h-$y)*$this->k,$this->_escape($txt));
|
586 |
+
if($this->underline && $txt!='')
|
587 |
+
$s .= ' '.$this->_dounderline($x,$y,$txt);
|
588 |
+
if($this->ColorFlag)
|
589 |
+
$s = 'q '.$this->TextColor.' '.$s.' Q';
|
590 |
+
$this->_out($s);
|
591 |
+
}
|
592 |
+
|
593 |
+
function AcceptPageBreak()
|
594 |
+
{
|
595 |
+
// Accept automatic page break or not
|
596 |
+
return $this->AutoPageBreak;
|
597 |
+
}
|
598 |
+
|
599 |
+
function Cell($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=false, $link='')
|
600 |
+
{
|
601 |
+
// Output a cell
|
602 |
+
$k = $this->k;
|
603 |
+
if($this->y+$h>$this->PageBreakTrigger && !$this->InHeader && !$this->InFooter && $this->AcceptPageBreak())
|
604 |
+
{
|
605 |
+
// Automatic page break
|
606 |
+
$x = $this->x;
|
607 |
+
$ws = $this->ws;
|
608 |
+
if($ws>0)
|
609 |
+
{
|
610 |
+
$this->ws = 0;
|
611 |
+
$this->_out('0 Tw');
|
612 |
+
}
|
613 |
+
$this->AddPage($this->CurOrientation,$this->CurPageSize);
|
614 |
+
$this->x = $x;
|
615 |
+
if($ws>0)
|
616 |
+
{
|
617 |
+
$this->ws = $ws;
|
618 |
+
$this->_out(sprintf('%.3F Tw',$ws*$k));
|
619 |
+
}
|
620 |
+
}
|
621 |
+
if($w==0)
|
622 |
+
$w = $this->w-$this->rMargin-$this->x;
|
623 |
+
$s = '';
|
624 |
+
if($fill || $border==1)
|
625 |
+
{
|
626 |
+
if($fill)
|
627 |
+
$op = ($border==1) ? 'B' : 'f';
|
628 |
+
else
|
629 |
+
$op = 'S';
|
630 |
+
$s = sprintf('%.2F %.2F %.2F %.2F re %s ',$this->x*$k,($this->h-$this->y)*$k,$w*$k,-$h*$k,$op);
|
631 |
+
}
|
632 |
+
if(is_string($border))
|
633 |
+
{
|
634 |
+
$x = $this->x;
|
635 |
+
$y = $this->y;
|
636 |
+
if(strpos($border,'L')!==false)
|
637 |
+
$s .= sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-$y)*$k,$x*$k,($this->h-($y+$h))*$k);
|
638 |
+
if(strpos($border,'T')!==false)
|
639 |
+
$s .= sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-$y)*$k,($x+$w)*$k,($this->h-$y)*$k);
|
640 |
+
if(strpos($border,'R')!==false)
|
641 |
+
$s .= sprintf('%.2F %.2F m %.2F %.2F l S ',($x+$w)*$k,($this->h-$y)*$k,($x+$w)*$k,($this->h-($y+$h))*$k);
|
642 |
+
if(strpos($border,'B')!==false)
|
643 |
+
$s .= sprintf('%.2F %.2F m %.2F %.2F l S ',$x*$k,($this->h-($y+$h))*$k,($x+$w)*$k,($this->h-($y+$h))*$k);
|
644 |
+
}
|
645 |
+
if($txt!=='')
|
646 |
+
{
|
647 |
+
if($align=='R')
|
648 |
+
$dx = $w-$this->cMargin-$this->GetStringWidth($txt);
|
649 |
+
elseif($align=='C')
|
650 |
+
$dx = ($w-$this->GetStringWidth($txt))/2;
|
651 |
+
else
|
652 |
+
$dx = $this->cMargin;
|
653 |
+
if($this->ColorFlag)
|
654 |
+
$s .= 'q '.$this->TextColor.' ';
|
655 |
+
$txt2 = str_replace(')','\\)',str_replace('(','\\(',str_replace('\\','\\\\',$txt)));
|
656 |
+
$s .= sprintf('BT %.2F %.2F Td (%s) Tj ET',($this->x+$dx)*$k,($this->h-($this->y+.5*$h+.3*$this->FontSize))*$k,$txt2);
|
657 |
+
if($this->underline)
|
658 |
+
$s .= ' '.$this->_dounderline($this->x+$dx,$this->y+.5*$h+.3*$this->FontSize,$txt);
|
659 |
+
if($this->ColorFlag)
|
660 |
+
$s .= ' Q';
|
661 |
+
if($link)
|
662 |
+
$this->Link($this->x+$dx,$this->y+.5*$h-.5*$this->FontSize,$this->GetStringWidth($txt),$this->FontSize,$link);
|
663 |
+
}
|
664 |
+
if($s)
|
665 |
+
$this->_out($s);
|
666 |
+
$this->lasth = $h;
|
667 |
+
if($ln>0)
|
668 |
+
{
|
669 |
+
// Go to next line
|
670 |
+
$this->y += $h;
|
671 |
+
if($ln==1)
|
672 |
+
$this->x = $this->lMargin;
|
673 |
+
}
|
674 |
+
else
|
675 |
+
$this->x += $w;
|
676 |
+
}
|
677 |
+
|
678 |
+
function MultiCell($w, $h, $txt, $border=0, $align='J', $fill=false)
|
679 |
+
{
|
680 |
+
// Output text with automatic or explicit line breaks
|
681 |
+
$cw = &$this->CurrentFont['cw'];
|
682 |
+
if($w==0)
|
683 |
+
$w = $this->w-$this->rMargin-$this->x;
|
684 |
+
$wmax = ($w-2*$this->cMargin)*1000/$this->FontSize;
|
685 |
+
$s = str_replace("\r",'',$txt);
|
686 |
+
$nb = strlen($s);
|
687 |
+
if($nb>0 && $s[$nb-1]=="\n")
|
688 |
+
$nb--;
|
689 |
+
$b = 0;
|
690 |
+
if($border)
|
691 |
+
{
|
692 |
+
if($border==1)
|
693 |
+
{
|
694 |
+
$border = 'LTRB';
|
695 |
+
$b = 'LRT';
|
696 |
+
$b2 = 'LR';
|
697 |
+
}
|
698 |
+
else
|
699 |
+
{
|
700 |
+
$b2 = '';
|
701 |
+
if(strpos($border,'L')!==false)
|
702 |
+
$b2 .= 'L';
|
703 |
+
if(strpos($border,'R')!==false)
|
704 |
+
$b2 .= 'R';
|
705 |
+
$b = (strpos($border,'T')!==false) ? $b2.'T' : $b2;
|
706 |
+
}
|
707 |
+
}
|
708 |
+
$sep = -1;
|
709 |
+
$i = 0;
|
710 |
+
$j = 0;
|
711 |
+
$l = 0;
|
712 |
+
$ns = 0;
|
713 |
+
$nl = 1;
|
714 |
+
while($i<$nb)
|
715 |
+
{
|
716 |
+
// Get next character
|
717 |
+
$c = $s[$i];
|
718 |
+
if($c=="\n")
|
719 |
+
{
|
720 |
+
// Explicit line break
|
721 |
+
if($this->ws>0)
|
722 |
+
{
|
723 |
+
$this->ws = 0;
|
724 |
+
$this->_out('0 Tw');
|
725 |
+
}
|
726 |
+
$this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill);
|
727 |
+
$i++;
|
728 |
+
$sep = -1;
|
729 |
+
$j = $i;
|
730 |
+
$l = 0;
|
731 |
+
$ns = 0;
|
732 |
+
$nl++;
|
733 |
+
if($border && $nl==2)
|
734 |
+
$b = $b2;
|
735 |
+
continue;
|
736 |
+
}
|
737 |
+
if($c==' ')
|
738 |
+
{
|
739 |
+
$sep = $i;
|
740 |
+
$ls = $l;
|
741 |
+
$ns++;
|
742 |
+
}
|
743 |
+
$l += $cw[$c];
|
744 |
+
if($l>$wmax)
|
745 |
+
{
|
746 |
+
// Automatic line break
|
747 |
+
if($sep==-1)
|
748 |
+
{
|
749 |
+
if($i==$j)
|
750 |
+
$i++;
|
751 |
+
if($this->ws>0)
|
752 |
+
{
|
753 |
+
$this->ws = 0;
|
754 |
+
$this->_out('0 Tw');
|
755 |
+
}
|
756 |
+
$this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill);
|
757 |
+
}
|
758 |
+
else
|
759 |
+
{
|
760 |
+
if($align=='J')
|
761 |
+
{
|
762 |
+
$this->ws = ($ns>1) ? ($wmax-$ls)/1000*$this->FontSize/($ns-1) : 0;
|
763 |
+
$this->_out(sprintf('%.3F Tw',$this->ws*$this->k));
|
764 |
+
}
|
765 |
+
$this->Cell($w,$h,substr($s,$j,$sep-$j),$b,2,$align,$fill);
|
766 |
+
$i = $sep+1;
|
767 |
+
}
|
768 |
+
$sep = -1;
|
769 |
+
$j = $i;
|
770 |
+
$l = 0;
|
771 |
+
$ns = 0;
|
772 |
+
$nl++;
|
773 |
+
if($border && $nl==2)
|
774 |
+
$b = $b2;
|
775 |
+
}
|
776 |
+
else
|
777 |
+
$i++;
|
778 |
+
}
|
779 |
+
// Last chunk
|
780 |
+
if($this->ws>0)
|
781 |
+
{
|
782 |
+
$this->ws = 0;
|
783 |
+
$this->_out('0 Tw');
|
784 |
+
}
|
785 |
+
if($border && strpos($border,'B')!==false)
|
786 |
+
$b .= 'B';
|
787 |
+
$this->Cell($w,$h,substr($s,$j,$i-$j),$b,2,$align,$fill);
|
788 |
+
$this->x = $this->lMargin;
|
789 |
+
}
|
790 |
+
|
791 |
+
function Write($h, $txt, $link='')
|
792 |
+
{
|
793 |
+
// Output text in flowing mode
|
794 |
+
$cw = &$this->CurrentFont['cw'];
|
795 |
+
$w = $this->w-$this->rMargin-$this->x;
|
796 |
+
$wmax = ($w-2*$this->cMargin)*1000/$this->FontSize;
|
797 |
+
$s = str_replace("\r",'',$txt);
|
798 |
+
$nb = strlen($s);
|
799 |
+
$sep = -1;
|
800 |
+
$i = 0;
|
801 |
+
$j = 0;
|
802 |
+
$l = 0;
|
803 |
+
$nl = 1;
|
804 |
+
while($i<$nb)
|
805 |
+
{
|
806 |
+
// Get next character
|
807 |
+
$c = $s[$i];
|
808 |
+
if($c=="\n")
|
809 |
+
{
|
810 |
+
// Explicit line break
|
811 |
+
$this->Cell($w,$h,substr($s,$j,$i-$j),0,2,'',0,$link);
|
812 |
+
$i++;
|
813 |
+
$sep = -1;
|
814 |
+
$j = $i;
|
815 |
+
$l = 0;
|
816 |
+
if($nl==1)
|
817 |
+
{
|
818 |
+
$this->x = $this->lMargin;
|
819 |
+
$w = $this->w-$this->rMargin-$this->x;
|
820 |
+
$wmax = ($w-2*$this->cMargin)*1000/$this->FontSize;
|
821 |
+
}
|
822 |
+
$nl++;
|
823 |
+
continue;
|
824 |
+
}
|
825 |
+
if($c==' ')
|
826 |
+
$sep = $i;
|
827 |
+
$l += $cw[$c];
|
828 |
+
if($l>$wmax)
|
829 |
+
{
|
830 |
+
// Automatic line break
|
831 |
+
if($sep==-1)
|
832 |
+
{
|
833 |
+
if($this->x>$this->lMargin)
|
834 |
+
{
|
835 |
+
// Move to next line
|
836 |
+
$this->x = $this->lMargin;
|
837 |
+
$this->y += $h;
|
838 |
+
$w = $this->w-$this->rMargin-$this->x;
|
839 |
+
$wmax = ($w-2*$this->cMargin)*1000/$this->FontSize;
|
840 |
+
$i++;
|
841 |
+
$nl++;
|
842 |
+
continue;
|
843 |
+
}
|
844 |
+
if($i==$j)
|
845 |
+
$i++;
|
846 |
+
$this->Cell($w,$h,substr($s,$j,$i-$j),0,2,'',0,$link);
|
847 |
+
}
|
848 |
+
else
|
849 |
+
{
|
850 |
+
$this->Cell($w,$h,substr($s,$j,$sep-$j),0,2,'',0,$link);
|
851 |
+
$i = $sep+1;
|
852 |
+
}
|
853 |
+
$sep = -1;
|
854 |
+
$j = $i;
|
855 |
+
$l = 0;
|
856 |
+
if($nl==1)
|
857 |
+
{
|
858 |
+
$this->x = $this->lMargin;
|
859 |
+
$w = $this->w-$this->rMargin-$this->x;
|
860 |
+
$wmax = ($w-2*$this->cMargin)*1000/$this->FontSize;
|
861 |
+
}
|
862 |
+
$nl++;
|
863 |
+
}
|
864 |
+
else
|
865 |
+
$i++;
|
866 |
+
}
|
867 |
+
// Last chunk
|
868 |
+
if($i!=$j)
|
869 |
+
$this->Cell($l/1000*$this->FontSize,$h,substr($s,$j),0,0,'',0,$link);
|
870 |
+
}
|
871 |
+
|
872 |
+
function Ln($h=null)
|
873 |
+
{
|
874 |
+
// Line feed; default value is last cell height
|
875 |
+
$this->x = $this->lMargin;
|
876 |
+
if($h===null)
|
877 |
+
$this->y += $this->lasth;
|
878 |
+
else
|
879 |
+
$this->y += $h;
|
880 |
+
}
|
881 |
+
|
882 |
+
function Image($file, $x=null, $y=null, $w=0, $h=0, $type='', $link='')
|
883 |
+
{
|
884 |
+
// Put an image on the page
|
885 |
+
if(!isset($this->images[$file]))
|
886 |
+
{
|
887 |
+
// First use of this image, get info
|
888 |
+
if($type=='')
|
889 |
+
{
|
890 |
+
$pos = strrpos($file,'.');
|
891 |
+
if(!$pos)
|
892 |
+
$this->Error('Image file has no extension and no type was specified: '.$file);
|
893 |
+
$type = substr($file,$pos+1);
|
894 |
+
}
|
895 |
+
$type = strtolower($type);
|
896 |
+
if($type=='jpeg')
|
897 |
+
$type = 'jpg';
|
898 |
+
$mtd = '_parse'.$type;
|
899 |
+
if(!method_exists($this,$mtd))
|
900 |
+
$this->Error('Unsupported image type: '.$type);
|
901 |
+
$info = $this->$mtd($file);
|
902 |
+
$info['i'] = count($this->images)+1;
|
903 |
+
$this->images[$file] = $info;
|
904 |
+
}
|
905 |
+
else
|
906 |
+
$info = $this->images[$file];
|
907 |
+
|
908 |
+
// Automatic width and height calculation if needed
|
909 |
+
if($w==0 && $h==0)
|
910 |
+
{
|
911 |
+
// Put image at 96 dpi
|
912 |
+
$w = -96;
|
913 |
+
$h = -96;
|
914 |
+
}
|
915 |
+
if($w<0)
|
916 |
+
$w = -$info['w']*72/$w/$this->k;
|
917 |
+
if($h<0)
|
918 |
+
$h = -$info['h']*72/$h/$this->k;
|
919 |
+
if($w==0)
|
920 |
+
$w = $h*$info['w']/$info['h'];
|
921 |
+
if($h==0)
|
922 |
+
$h = $w*$info['h']/$info['w'];
|
923 |
+
|
924 |
+
// Flowing mode
|
925 |
+
if($y===null)
|
926 |
+
{
|
927 |
+
if($this->y+$h>$this->PageBreakTrigger && !$this->InHeader && !$this->InFooter && $this->AcceptPageBreak())
|
928 |
+
{
|
929 |
+
// Automatic page break
|
930 |
+
$x2 = $this->x;
|
931 |
+
$this->AddPage($this->CurOrientation,$this->CurPageSize);
|
932 |
+
$this->x = $x2;
|
933 |
+
}
|
934 |
+
$y = $this->y;
|
935 |
+
$this->y += $h;
|
936 |
+
}
|
937 |
+
|
938 |
+
if($x===null)
|
939 |
+
$x = $this->x;
|
940 |
+
$this->_out(sprintf('q %.2F 0 0 %.2F %.2F %.2F cm /I%d Do Q',$w*$this->k,$h*$this->k,$x*$this->k,($this->h-($y+$h))*$this->k,$info['i']));
|
941 |
+
if($link)
|
942 |
+
$this->Link($x,$y,$w,$h,$link);
|
943 |
+
}
|
944 |
+
|
945 |
+
function GetX()
|
946 |
+
{
|
947 |
+
// Get x position
|
948 |
+
return $this->x;
|
949 |
+
}
|
950 |
+
|
951 |
+
function SetX($x)
|
952 |
+
{
|
953 |
+
// Set x position
|
954 |
+
if($x>=0)
|
955 |
+
$this->x = $x;
|
956 |
+
else
|
957 |
+
$this->x = $this->w+$x;
|
958 |
+
}
|
959 |
+
|
960 |
+
function GetY()
|
961 |
+
{
|
962 |
+
// Get y position
|
963 |
+
return $this->y;
|
964 |
+
}
|
965 |
+
|
966 |
+
function SetY($y)
|
967 |
+
{
|
968 |
+
// Set y position and reset x
|
969 |
+
$this->x = $this->lMargin;
|
970 |
+
if($y>=0)
|
971 |
+
$this->y = $y;
|
972 |
+
else
|
973 |
+
$this->y = $this->h+$y;
|
974 |
+
}
|
975 |
+
|
976 |
+
function SetXY($x, $y)
|
977 |
+
{
|
978 |
+
// Set x and y positions
|
979 |
+
$this->SetY($y);
|
980 |
+
$this->SetX($x);
|
981 |
+
}
|
982 |
+
|
983 |
+
function Output($name='', $dest='')
|
984 |
+
{
|
985 |
+
// Output PDF to some destination
|
986 |
+
if($this->state<3)
|
987 |
+
$this->Close();
|
988 |
+
$dest = strtoupper($dest);
|
989 |
+
if($dest=='')
|
990 |
+
{
|
991 |
+
if($name=='')
|
992 |
+
{
|
993 |
+
$name = 'doc.pdf';
|
994 |
+
$dest = 'I';
|
995 |
+
}
|
996 |
+
else
|
997 |
+
$dest = 'F';
|
998 |
+
}
|
999 |
+
switch($dest)
|
1000 |
+
{
|
1001 |
+
case 'I':
|
1002 |
+
// Send to standard output
|
1003 |
+
$this->_checkoutput();
|
1004 |
+
if(PHP_SAPI!='cli')
|
1005 |
+
{
|
1006 |
+
// We send to a browser
|
1007 |
+
header('Content-Type: application/pdf');
|
1008 |
+
header('Content-Disposition: inline; filename="'.$name.'"');
|
1009 |
+
header('Cache-Control: private, max-age=0, must-revalidate');
|
1010 |
+
header('Pragma: public');
|
1011 |
+
}
|
1012 |
+
echo $this->buffer;
|
1013 |
+
break;
|
1014 |
+
case 'D':
|
1015 |
+
// Download file
|
1016 |
+
$this->_checkoutput();
|
1017 |
+
header('Content-Type: application/x-download');
|
1018 |
+
header('Content-Disposition: attachment; filename="'.$name.'"');
|
1019 |
+
header('Cache-Control: private, max-age=0, must-revalidate');
|
1020 |
+
header('Pragma: public');
|
1021 |
+
echo $this->buffer;
|
1022 |
+
break;
|
1023 |
+
case 'F':
|
1024 |
+
// Save to local file
|
1025 |
+
$f = fopen($name,'wb');
|
1026 |
+
if(!$f)
|
1027 |
+
$this->Error('Unable to create output file: '.$name);
|
1028 |
+
fwrite($f,$this->buffer,strlen($this->buffer));
|
1029 |
+
fclose($f);
|
1030 |
+
break;
|
1031 |
+
case 'S':
|
1032 |
+
// Return as a string
|
1033 |
+
return $this->buffer;
|
1034 |
+
default:
|
1035 |
+
$this->Error('Incorrect output destination: '.$dest);
|
1036 |
+
}
|
1037 |
+
return '';
|
1038 |
+
}
|
1039 |
+
|
1040 |
+
/*******************************************************************************
|
1041 |
+
* *
|
1042 |
+
* Protected methods *
|
1043 |
+
* *
|
1044 |
+
*******************************************************************************/
|
1045 |
+
function _dochecks()
|
1046 |
+
{
|
1047 |
+
// Check availability of %F
|
1048 |
+
if(sprintf('%.1F',1.0)!='1.0')
|
1049 |
+
$this->Error('This version of PHP is not supported');
|
1050 |
+
// Check mbstring overloading
|
1051 |
+
if(ini_get('mbstring.func_overload') & 2)
|
1052 |
+
$this->Error('mbstring overloading must be disabled');
|
1053 |
+
// Ensure runtime magic quotes are disabled
|
1054 |
+
if(get_magic_quotes_runtime())
|
1055 |
+
@set_magic_quotes_runtime(0);
|
1056 |
+
}
|
1057 |
+
|
1058 |
+
function _checkoutput()
|
1059 |
+
{
|
1060 |
+
if(PHP_SAPI!='cli')
|
1061 |
+
{
|
1062 |
+
if(headers_sent($file,$line))
|
1063 |
+
$this->Error("Some data has already been output, can't send PDF file (output started at $file:$line)");
|
1064 |
+
}
|
1065 |
+
if(ob_get_length())
|
1066 |
+
{
|
1067 |
+
// The output buffer is not empty
|
1068 |
+
if(preg_match('/^(\xEF\xBB\xBF)?\s*$/',ob_get_contents()))
|
1069 |
+
{
|
1070 |
+
// It contains only a UTF-8 BOM and/or whitespace, let's clean it
|
1071 |
+
ob_clean();
|
1072 |
+
}
|
1073 |
+
else
|
1074 |
+
$this->Error("Some data has already been output, can't send PDF file");
|
1075 |
+
}
|
1076 |
+
}
|
1077 |
+
|
1078 |
+
function _getpagesize($size)
|
1079 |
+
{
|
1080 |
+
if(is_string($size))
|
1081 |
+
{
|
1082 |
+
$size = strtolower($size);
|
1083 |
+
if(!isset($this->StdPageSizes[$size]))
|
1084 |
+
$this->Error('Unknown page size: '.$size);
|
1085 |
+
$a = $this->StdPageSizes[$size];
|
1086 |
+
return array($a[0]/$this->k, $a[1]/$this->k);
|
1087 |
+
}
|
1088 |
+
else
|
1089 |
+
{
|
1090 |
+
if($size[0]>$size[1])
|
1091 |
+
return array($size[1], $size[0]);
|
1092 |
+
else
|
1093 |
+
return $size;
|
1094 |
+
}
|
1095 |
+
}
|
1096 |
+
|
1097 |
+
function _beginpage($orientation, $size)
|
1098 |
+
{
|
1099 |
+
$this->page++;
|
1100 |
+
$this->pages[$this->page] = '';
|
1101 |
+
$this->state = 2;
|
1102 |
+
$this->x = $this->lMargin;
|
1103 |
+
$this->y = $this->tMargin;
|
1104 |
+
$this->FontFamily = '';
|
1105 |
+
// Check page size and orientation
|
1106 |
+
if($orientation=='')
|
1107 |
+
$orientation = $this->DefOrientation;
|
1108 |
+
else
|
1109 |
+
$orientation = strtoupper($orientation[0]);
|
1110 |
+
if($size=='')
|
1111 |
+
$size = $this->DefPageSize;
|
1112 |
+
else
|
1113 |
+
$size = $this->_getpagesize($size);
|
1114 |
+
if($orientation!=$this->CurOrientation || $size[0]!=$this->CurPageSize[0] || $size[1]!=$this->CurPageSize[1])
|
1115 |
+
{
|
1116 |
+
// New size or orientation
|
1117 |
+
if($orientation=='P')
|
1118 |
+
{
|
1119 |
+
$this->w = $size[0];
|
1120 |
+
$this->h = $size[1];
|
1121 |
+
}
|
1122 |
+
else
|
1123 |
+
{
|
1124 |
+
$this->w = $size[1];
|
1125 |
+
$this->h = $size[0];
|
1126 |
+
}
|
1127 |
+
$this->wPt = $this->w*$this->k;
|
1128 |
+
$this->hPt = $this->h*$this->k;
|
1129 |
+
$this->PageBreakTrigger = $this->h-$this->bMargin;
|
1130 |
+
$this->CurOrientation = $orientation;
|
1131 |
+
$this->CurPageSize = $size;
|
1132 |
+
}
|
1133 |
+
if($orientation!=$this->DefOrientation || $size[0]!=$this->DefPageSize[0] || $size[1]!=$this->DefPageSize[1])
|
1134 |
+
$this->PageSizes[$this->page] = array($this->wPt, $this->hPt);
|
1135 |
+
}
|
1136 |
+
|
1137 |
+
function _endpage()
|
1138 |
+
{
|
1139 |
+
$this->state = 1;
|
1140 |
+
}
|
1141 |
+
|
1142 |
+
function _loadfont($font)
|
1143 |
+
{
|
1144 |
+
// Load a font definition file from the font directory
|
1145 |
+
include($this->fontpath.$font);
|
1146 |
+
$a = get_defined_vars();
|
1147 |
+
if(!isset($a['name']))
|
1148 |
+
$this->Error('Could not include font definition file');
|
1149 |
+
return $a;
|
1150 |
+
}
|
1151 |
+
|
1152 |
+
function _escape($s)
|
1153 |
+
{
|
1154 |
+
// Escape special characters in strings
|
1155 |
+
$s = str_replace('\\','\\\\',$s);
|
1156 |
+
$s = str_replace('(','\\(',$s);
|
1157 |
+
$s = str_replace(')','\\)',$s);
|
1158 |
+
$s = str_replace("\r",'\\r',$s);
|
1159 |
+
return $s;
|
1160 |
+
}
|
1161 |
+
|
1162 |
+
function _textstring($s)
|
1163 |
+
{
|
1164 |
+
// Format a text string
|
1165 |
+
return '('.$this->_escape($s).')';
|
1166 |
+
}
|
1167 |
+
|
1168 |
+
function _UTF8toUTF16($s)
|
1169 |
+
{
|
1170 |
+
// Convert UTF-8 to UTF-16BE with BOM
|
1171 |
+
$res = "\xFE\xFF";
|
1172 |
+
$nb = strlen($s);
|
1173 |
+
$i = 0;
|
1174 |
+
while($i<$nb)
|
1175 |
+
{
|
1176 |
+
$c1 = ord($s[$i++]);
|
1177 |
+
if($c1>=224)
|
1178 |
+
{
|
1179 |
+
// 3-byte character
|
1180 |
+
$c2 = ord($s[$i++]);
|
1181 |
+
$c3 = ord($s[$i++]);
|
1182 |
+
$res .= chr((($c1 & 0x0F)<<4) + (($c2 & 0x3C)>>2));
|
1183 |
+
$res .= chr((($c2 & 0x03)<<6) + ($c3 & 0x3F));
|
1184 |
+
}
|
1185 |
+
elseif($c1>=192)
|
1186 |
+
{
|
1187 |
+
// 2-byte character
|
1188 |
+
$c2 = ord($s[$i++]);
|
1189 |
+
$res .= chr(($c1 & 0x1C)>>2);
|
1190 |
+
$res .= chr((($c1 & 0x03)<<6) + ($c2 & 0x3F));
|
1191 |
+
}
|
1192 |
+
else
|
1193 |
+
{
|
1194 |
+
// Single-byte character
|
1195 |
+
$res .= "\0".chr($c1);
|
1196 |
+
}
|
1197 |
+
}
|
1198 |
+
return $res;
|
1199 |
+
}
|
1200 |
+
|
1201 |
+
function _dounderline($x, $y, $txt)
|
1202 |
+
{
|
1203 |
+
// Underline text
|
1204 |
+
$up = $this->CurrentFont['up'];
|
1205 |
+
$ut = $this->CurrentFont['ut'];
|
1206 |
+
$w = $this->GetStringWidth($txt)+$this->ws*substr_count($txt,' ');
|
1207 |
+
return sprintf('%.2F %.2F %.2F %.2F re f',$x*$this->k,($this->h-($y-$up/1000*$this->FontSize))*$this->k,$w*$this->k,-$ut/1000*$this->FontSizePt);
|
1208 |
+
}
|
1209 |
+
|
1210 |
+
function _parsejpg($file)
|
1211 |
+
{
|
1212 |
+
// Extract info from a JPEG file
|
1213 |
+
$a = getimagesize($file);
|
1214 |
+
if(!$a)
|
1215 |
+
$this->Error('Missing or incorrect image file: '.$file);
|
1216 |
+
if($a[2]!=2)
|
1217 |
+
$this->Error('Not a JPEG file: '.$file);
|
1218 |
+
if(!isset($a['channels']) || $a['channels']==3)
|
1219 |
+
$colspace = 'DeviceRGB';
|
1220 |
+
elseif($a['channels']==4)
|
1221 |
+
$colspace = 'DeviceCMYK';
|
1222 |
+
else
|
1223 |
+
$colspace = 'DeviceGray';
|
1224 |
+
$bpc = isset($a['bits']) ? $a['bits'] : 8;
|
1225 |
+
$data = file_get_contents($file);
|
1226 |
+
return array('w'=>$a[0], 'h'=>$a[1], 'cs'=>$colspace, 'bpc'=>$bpc, 'f'=>'DCTDecode', 'data'=>$data);
|
1227 |
+
}
|
1228 |
+
|
1229 |
+
function _parsepng($file)
|
1230 |
+
{
|
1231 |
+
// Extract info from a PNG file
|
1232 |
+
$f = fopen($file,'rb');
|
1233 |
+
if(!$f)
|
1234 |
+
$this->Error('Can\'t open image file: '.$file);
|
1235 |
+
$info = $this->_parsepngstream($f,$file);
|
1236 |
+
fclose($f);
|
1237 |
+
return $info;
|
1238 |
+
}
|
1239 |
+
|
1240 |
+
function _parsepngstream($f, $file)
|
1241 |
+
{
|
1242 |
+
// Check signature
|
1243 |
+
if($this->_readstream($f,8)!=chr(137).'PNG'.chr(13).chr(10).chr(26).chr(10))
|
1244 |
+
$this->Error('Not a PNG file: '.$file);
|
1245 |
+
|
1246 |
+
// Read header chunk
|
1247 |
+
$this->_readstream($f,4);
|
1248 |
+
if($this->_readstream($f,4)!='IHDR')
|
1249 |
+
$this->Error('Incorrect PNG file: '.$file);
|
1250 |
+
$w = $this->_readint($f);
|
1251 |
+
$h = $this->_readint($f);
|
1252 |
+
$bpc = ord($this->_readstream($f,1));
|
1253 |
+
if($bpc>8)
|
1254 |
+
$this->Error('16-bit depth not supported: '.$file);
|
1255 |
+
$ct = ord($this->_readstream($f,1));
|
1256 |
+
if($ct==0 || $ct==4)
|
1257 |
+
$colspace = 'DeviceGray';
|
1258 |
+
elseif($ct==2 || $ct==6)
|
1259 |
+
$colspace = 'DeviceRGB';
|
1260 |
+
elseif($ct==3)
|
1261 |
+
$colspace = 'Indexed';
|
1262 |
+
else
|
1263 |
+
$this->Error('Unknown color type: '.$file);
|
1264 |
+
if(ord($this->_readstream($f,1))!=0)
|
1265 |
+
$this->Error('Unknown compression method: '.$file);
|
1266 |
+
if(ord($this->_readstream($f,1))!=0)
|
1267 |
+
$this->Error('Unknown filter method: '.$file);
|
1268 |
+
if(ord($this->_readstream($f,1))!=0)
|
1269 |
+
$this->Error('Interlacing not supported: '.$file);
|
1270 |
+
$this->_readstream($f,4);
|
1271 |
+
$dp = '/Predictor 15 /Colors '.($colspace=='DeviceRGB' ? 3 : 1).' /BitsPerComponent '.$bpc.' /Columns '.$w;
|
1272 |
+
|
1273 |
+
// Scan chunks looking for palette, transparency and image data
|
1274 |
+
$pal = '';
|
1275 |
+
$trns = '';
|
1276 |
+
$data = '';
|
1277 |
+
do
|
1278 |
+
{
|
1279 |
+
$n = $this->_readint($f);
|
1280 |
+
$type = $this->_readstream($f,4);
|
1281 |
+
if($type=='PLTE')
|
1282 |
+
{
|
1283 |
+
// Read palette
|
1284 |
+
$pal = $this->_readstream($f,$n);
|
1285 |
+
$this->_readstream($f,4);
|
1286 |
+
}
|
1287 |
+
elseif($type=='tRNS')
|
1288 |
+
{
|
1289 |
+
// Read transparency info
|
1290 |
+
$t = $this->_readstream($f,$n);
|
1291 |
+
if($ct==0)
|
1292 |
+
$trns = array(ord(substr($t,1,1)));
|
1293 |
+
elseif($ct==2)
|
1294 |
+
$trns = array(ord(substr($t,1,1)), ord(substr($t,3,1)), ord(substr($t,5,1)));
|
1295 |
+
else
|
1296 |
+
{
|
1297 |
+
$pos = strpos($t,chr(0));
|
1298 |
+
if($pos!==false)
|
1299 |
+
$trns = array($pos);
|
1300 |
+
}
|
1301 |
+
$this->_readstream($f,4);
|
1302 |
+
}
|
1303 |
+
elseif($type=='IDAT')
|
1304 |
+
{
|
1305 |
+
// Read image data block
|
1306 |
+
$data .= $this->_readstream($f,$n);
|
1307 |
+
$this->_readstream($f,4);
|
1308 |
+
}
|
1309 |
+
elseif($type=='IEND')
|
1310 |
+
break;
|
1311 |
+
else
|
1312 |
+
$this->_readstream($f,$n+4);
|
1313 |
+
}
|
1314 |
+
while($n);
|
1315 |
+
|
1316 |
+
if($colspace=='Indexed' && empty($pal))
|
1317 |
+
$this->Error('Missing palette in '.$file);
|
1318 |
+
$info = array('w'=>$w, 'h'=>$h, 'cs'=>$colspace, 'bpc'=>$bpc, 'f'=>'FlateDecode', 'dp'=>$dp, 'pal'=>$pal, 'trns'=>$trns);
|
1319 |
+
if($ct>=4)
|
1320 |
+
{
|
1321 |
+
// Extract alpha channel
|
1322 |
+
if(!function_exists('gzuncompress'))
|
1323 |
+
$this->Error('Zlib not available, can\'t handle alpha channel: '.$file);
|
1324 |
+
$data = gzuncompress($data);
|
1325 |
+
$color = '';
|
1326 |
+
$alpha = '';
|
1327 |
+
if($ct==4)
|
1328 |
+
{
|
1329 |
+
// Gray image
|
1330 |
+
$len = 2*$w;
|
1331 |
+
for($i=0;$i<$h;$i++)
|
1332 |
+
{
|
1333 |
+
$pos = (1+$len)*$i;
|
1334 |
+
$color .= $data[$pos];
|
1335 |
+
$alpha .= $data[$pos];
|
1336 |
+
$line = substr($data,$pos+1,$len);
|
1337 |
+
$color .= preg_replace('/(.)./s','$1',$line);
|
1338 |
+
$alpha .= preg_replace('/.(.)/s','$1',$line);
|
1339 |
+
}
|
1340 |
+
}
|
1341 |
+
else
|
1342 |
+
{
|
1343 |
+
// RGB image
|
1344 |
+
$len = 4*$w;
|
1345 |
+
for($i=0;$i<$h;$i++)
|
1346 |
+
{
|
1347 |
+
$pos = (1+$len)*$i;
|
1348 |
+
$color .= $data[$pos];
|
1349 |
+
$alpha .= $data[$pos];
|
1350 |
+
$line = substr($data,$pos+1,$len);
|
1351 |
+
$color .= preg_replace('/(.{3})./s','$1',$line);
|
1352 |
+
$alpha .= preg_replace('/.{3}(.)/s','$1',$line);
|
1353 |
+
}
|
1354 |
+
}
|
1355 |
+
unset($data);
|
1356 |
+
$data = gzcompress($color);
|
1357 |
+
$info['smask'] = gzcompress($alpha);
|
1358 |
+
if($this->PDFVersion<'1.4')
|
1359 |
+
$this->PDFVersion = '1.4';
|
1360 |
+
}
|
1361 |
+
$info['data'] = $data;
|
1362 |
+
return $info;
|
1363 |
+
}
|
1364 |
+
|
1365 |
+
function _readstream($f, $n)
|
1366 |
+
{
|
1367 |
+
// Read n bytes from stream
|
1368 |
+
$res = '';
|
1369 |
+
while($n>0 && !feof($f))
|
1370 |
+
{
|
1371 |
+
$s = fread($f,$n);
|
1372 |
+
if($s===false)
|
1373 |
+
$this->Error('Error while reading stream');
|
1374 |
+
$n -= strlen($s);
|
1375 |
+
$res .= $s;
|
1376 |
+
}
|
1377 |
+
if($n>0)
|
1378 |
+
$this->Error('Unexpected end of stream');
|
1379 |
+
return $res;
|
1380 |
+
}
|
1381 |
+
|
1382 |
+
function _readint($f)
|
1383 |
+
{
|
1384 |
+
// Read a 4-byte integer from stream
|
1385 |
+
$a = unpack('Ni',$this->_readstream($f,4));
|
1386 |
+
return $a['i'];
|
1387 |
+
}
|
1388 |
+
|
1389 |
+
function _parsegif($file)
|
1390 |
+
{
|
1391 |
+
// Extract info from a GIF file (via PNG conversion)
|
1392 |
+
if(!function_exists('imagepng'))
|
1393 |
+
$this->Error('GD extension is required for GIF support');
|
1394 |
+
if(!function_exists('imagecreatefromgif'))
|
1395 |
+
$this->Error('GD has no GIF read support');
|
1396 |
+
$im = imagecreatefromgif($file);
|
1397 |
+
if(!$im)
|
1398 |
+
$this->Error('Missing or incorrect image file: '.$file);
|
1399 |
+
imageinterlace($im,0);
|
1400 |
+
$f = @fopen('php://temp','rb+');
|
1401 |
+
if($f)
|
1402 |
+
{
|
1403 |
+
// Perform conversion in memory
|
1404 |
+
ob_start();
|
1405 |
+
imagepng($im);
|
1406 |
+
$data = ob_get_clean();
|
1407 |
+
imagedestroy($im);
|
1408 |
+
fwrite($f,$data);
|
1409 |
+
rewind($f);
|
1410 |
+
$info = $this->_parsepngstream($f,$file);
|
1411 |
+
fclose($f);
|
1412 |
+
}
|
1413 |
+
else
|
1414 |
+
{
|
1415 |
+
// Use temporary file
|
1416 |
+
$tmp = tempnam('.','gif');
|
1417 |
+
if(!$tmp)
|
1418 |
+
$this->Error('Unable to create a temporary file');
|
1419 |
+
if(!imagepng($im,$tmp))
|
1420 |
+
$this->Error('Error while saving to temporary file');
|
1421 |
+
imagedestroy($im);
|
1422 |
+
$info = $this->_parsepng($tmp);
|
1423 |
+
unlink($tmp);
|
1424 |
+
}
|
1425 |
+
return $info;
|
1426 |
+
}
|
1427 |
+
|
1428 |
+
function _newobj()
|
1429 |
+
{
|
1430 |
+
// Begin a new object
|
1431 |
+
$this->n++;
|
1432 |
+
$this->offsets[$this->n] = strlen($this->buffer);
|
1433 |
+
$this->_out($this->n.' 0 obj');
|
1434 |
+
}
|
1435 |
+
|
1436 |
+
function _putstream($s)
|
1437 |
+
{
|
1438 |
+
$this->_out('stream');
|
1439 |
+
$this->_out($s);
|
1440 |
+
$this->_out('endstream');
|
1441 |
+
}
|
1442 |
+
|
1443 |
+
function _out($s)
|
1444 |
+
{
|
1445 |
+
// Add a line to the document
|
1446 |
+
if($this->state==2)
|
1447 |
+
$this->pages[$this->page] .= $s."\n";
|
1448 |
+
else
|
1449 |
+
$this->buffer .= $s."\n";
|
1450 |
+
}
|
1451 |
+
|
1452 |
+
function _putpages()
|
1453 |
+
{
|
1454 |
+
$nb = $this->page;
|
1455 |
+
if(!empty($this->AliasNbPages))
|
1456 |
+
{
|
1457 |
+
// Replace number of pages
|
1458 |
+
for($n=1;$n<=$nb;$n++)
|
1459 |
+
$this->pages[$n] = str_replace($this->AliasNbPages,$nb,$this->pages[$n]);
|
1460 |
+
}
|
1461 |
+
if($this->DefOrientation=='P')
|
1462 |
+
{
|
1463 |
+
$wPt = $this->DefPageSize[0]*$this->k;
|
1464 |
+
$hPt = $this->DefPageSize[1]*$this->k;
|
1465 |
+
}
|
1466 |
+
else
|
1467 |
+
{
|
1468 |
+
$wPt = $this->DefPageSize[1]*$this->k;
|
1469 |
+
$hPt = $this->DefPageSize[0]*$this->k;
|
1470 |
+
}
|
1471 |
+
$filter = ($this->compress) ? '/Filter /FlateDecode ' : '';
|
1472 |
+
for($n=1;$n<=$nb;$n++)
|
1473 |
+
{
|
1474 |
+
// Page
|
1475 |
+
$this->_newobj();
|
1476 |
+
$this->_out('<</Type /Page');
|
1477 |
+
$this->_out('/Parent 1 0 R');
|
1478 |
+
if(isset($this->PageSizes[$n]))
|
1479 |
+
$this->_out(sprintf('/MediaBox [0 0 %.2F %.2F]',$this->PageSizes[$n][0],$this->PageSizes[$n][1]));
|
1480 |
+
$this->_out('/Resources 2 0 R');
|
1481 |
+
if(isset($this->PageLinks[$n]))
|
1482 |
+
{
|
1483 |
+
// Links
|
1484 |
+
$annots = '/Annots [';
|
1485 |
+
foreach($this->PageLinks[$n] as $pl)
|
1486 |
+
{
|
1487 |
+
$rect = sprintf('%.2F %.2F %.2F %.2F',$pl[0],$pl[1],$pl[0]+$pl[2],$pl[1]-$pl[3]);
|
1488 |
+
$annots .= '<</Type /Annot /Subtype /Link /Rect ['.$rect.'] /Border [0 0 0] ';
|
1489 |
+
if(is_string($pl[4]))
|
1490 |
+
$annots .= '/A <</S /URI /URI '.$this->_textstring($pl[4]).'>>>>';
|
1491 |
+
else
|
1492 |
+
{
|
1493 |
+
$l = $this->links[$pl[4]];
|
1494 |
+
$h = isset($this->PageSizes[$l[0]]) ? $this->PageSizes[$l[0]][1] : $hPt;
|
1495 |
+
$annots .= sprintf('/Dest [%d 0 R /XYZ 0 %.2F null]>>',1+2*$l[0],$h-$l[1]*$this->k);
|
1496 |
+
}
|
1497 |
+
}
|
1498 |
+
$this->_out($annots.']');
|
1499 |
+
}
|
1500 |
+
if($this->PDFVersion>'1.3')
|
1501 |
+
$this->_out('/Group <</Type /Group /S /Transparency /CS /DeviceRGB>>');
|
1502 |
+
$this->_out('/Contents '.($this->n+1).' 0 R>>');
|
1503 |
+
$this->_out('endobj');
|
1504 |
+
// Page content
|
1505 |
+
$p = ($this->compress) ? gzcompress($this->pages[$n]) : $this->pages[$n];
|
1506 |
+
$this->_newobj();
|
1507 |
+
$this->_out('<<'.$filter.'/Length '.strlen($p).'>>');
|
1508 |
+
$this->_putstream($p);
|
1509 |
+
$this->_out('endobj');
|
1510 |
+
}
|
1511 |
+
// Pages root
|
1512 |
+
$this->offsets[1] = strlen($this->buffer);
|
1513 |
+
$this->_out('1 0 obj');
|
1514 |
+
$this->_out('<</Type /Pages');
|
1515 |
+
$kids = '/Kids [';
|
1516 |
+
for($i=0;$i<$nb;$i++)
|
1517 |
+
$kids .= (3+2*$i).' 0 R ';
|
1518 |
+
$this->_out($kids.']');
|
1519 |
+
$this->_out('/Count '.$nb);
|
1520 |
+
$this->_out(sprintf('/MediaBox [0 0 %.2F %.2F]',$wPt,$hPt));
|
1521 |
+
$this->_out('>>');
|
1522 |
+
$this->_out('endobj');
|
1523 |
+
}
|
1524 |
+
|
1525 |
+
function _putfonts()
|
1526 |
+
{
|
1527 |
+
$nf = $this->n;
|
1528 |
+
foreach($this->diffs as $diff)
|
1529 |
+
{
|
1530 |
+
// Encodings
|
1531 |
+
$this->_newobj();
|
1532 |
+
$this->_out('<</Type /Encoding /BaseEncoding /WinAnsiEncoding /Differences ['.$diff.']>>');
|
1533 |
+
$this->_out('endobj');
|
1534 |
+
}
|
1535 |
+
foreach($this->FontFiles as $file=>$info)
|
1536 |
+
{
|
1537 |
+
// Font file embedding
|
1538 |
+
$this->_newobj();
|
1539 |
+
$this->FontFiles[$file]['n'] = $this->n;
|
1540 |
+
$font = file_get_contents($this->fontpath.$file,true);
|
1541 |
+
if(!$font)
|
1542 |
+
$this->Error('Font file not found: '.$file);
|
1543 |
+
$compressed = (substr($file,-2)=='.z');
|
1544 |
+
if(!$compressed && isset($info['length2']))
|
1545 |
+
$font = substr($font,6,$info['length1']).substr($font,6+$info['length1']+6,$info['length2']);
|
1546 |
+
$this->_out('<</Length '.strlen($font));
|
1547 |
+
if($compressed)
|
1548 |
+
$this->_out('/Filter /FlateDecode');
|
1549 |
+
$this->_out('/Length1 '.$info['length1']);
|
1550 |
+
if(isset($info['length2']))
|
1551 |
+
$this->_out('/Length2 '.$info['length2'].' /Length3 0');
|
1552 |
+
$this->_out('>>');
|
1553 |
+
$this->_putstream($font);
|
1554 |
+
$this->_out('endobj');
|
1555 |
+
}
|
1556 |
+
foreach($this->fonts as $k=>$font)
|
1557 |
+
{
|
1558 |
+
// Font objects
|
1559 |
+
$this->fonts[$k]['n'] = $this->n+1;
|
1560 |
+
$type = $font['type'];
|
1561 |
+
$name = $font['name'];
|
1562 |
+
if($type=='Core')
|
1563 |
+
{
|
1564 |
+
// Core font
|
1565 |
+
$this->_newobj();
|
1566 |
+
$this->_out('<</Type /Font');
|
1567 |
+
$this->_out('/BaseFont /'.$name);
|
1568 |
+
$this->_out('/Subtype /Type1');
|
1569 |
+
if($name!='Symbol' && $name!='ZapfDingbats')
|
1570 |
+
$this->_out('/Encoding /WinAnsiEncoding');
|
1571 |
+
$this->_out('>>');
|
1572 |
+
$this->_out('endobj');
|
1573 |
+
}
|
1574 |
+
elseif($type=='Type1' || $type=='TrueType')
|
1575 |
+
{
|
1576 |
+
// Additional Type1 or TrueType/OpenType font
|
1577 |
+
$this->_newobj();
|
1578 |
+
$this->_out('<</Type /Font');
|
1579 |
+
$this->_out('/BaseFont /'.$name);
|
1580 |
+
$this->_out('/Subtype /'.$type);
|
1581 |
+
$this->_out('/FirstChar 32 /LastChar 255');
|
1582 |
+
$this->_out('/Widths '.($this->n+1).' 0 R');
|
1583 |
+
$this->_out('/FontDescriptor '.($this->n+2).' 0 R');
|
1584 |
+
if(isset($font['diffn']))
|
1585 |
+
$this->_out('/Encoding '.($nf+$font['diffn']).' 0 R');
|
1586 |
+
else
|
1587 |
+
$this->_out('/Encoding /WinAnsiEncoding');
|
1588 |
+
$this->_out('>>');
|
1589 |
+
$this->_out('endobj');
|
1590 |
+
// Widths
|
1591 |
+
$this->_newobj();
|
1592 |
+
$cw = &$font['cw'];
|
1593 |
+
$s = '[';
|
1594 |
+
for($i=32;$i<=255;$i++)
|
1595 |
+
$s .= $cw[chr($i)].' ';
|
1596 |
+
$this->_out($s.']');
|
1597 |
+
$this->_out('endobj');
|
1598 |
+
// Descriptor
|
1599 |
+
$this->_newobj();
|
1600 |
+
$s = '<</Type /FontDescriptor /FontName /'.$name;
|
1601 |
+
foreach($font['desc'] as $k=>$v)
|
1602 |
+
$s .= ' /'.$k.' '.$v;
|
1603 |
+
if(!empty($font['file']))
|
1604 |
+
$s .= ' /FontFile'.($type=='Type1' ? '' : '2').' '.$this->FontFiles[$font['file']]['n'].' 0 R';
|
1605 |
+
$this->_out($s.'>>');
|
1606 |
+
$this->_out('endobj');
|
1607 |
+
}
|
1608 |
+
else
|
1609 |
+
{
|
1610 |
+
// Allow for additional types
|
1611 |
+
$mtd = '_put'.strtolower($type);
|
1612 |
+
if(!method_exists($this,$mtd))
|
1613 |
+
$this->Error('Unsupported font type: '.$type);
|
1614 |
+
$this->$mtd($font);
|
1615 |
+
}
|
1616 |
+
}
|
1617 |
+
}
|
1618 |
+
|
1619 |
+
function _putimages()
|
1620 |
+
{
|
1621 |
+
foreach(array_keys($this->images) as $file)
|
1622 |
+
{
|
1623 |
+
$this->_putimage($this->images[$file]);
|
1624 |
+
unset($this->images[$file]['data']);
|
1625 |
+
unset($this->images[$file]['smask']);
|
1626 |
+
}
|
1627 |
+
}
|
1628 |
+
|
1629 |
+
function _putimage(&$info)
|
1630 |
+
{
|
1631 |
+
$this->_newobj();
|
1632 |
+
$info['n'] = $this->n;
|
1633 |
+
$this->_out('<</Type /XObject');
|
1634 |
+
$this->_out('/Subtype /Image');
|
1635 |
+
$this->_out('/Width '.$info['w']);
|
1636 |
+
$this->_out('/Height '.$info['h']);
|
1637 |
+
if($info['cs']=='Indexed')
|
1638 |
+
$this->_out('/ColorSpace [/Indexed /DeviceRGB '.(strlen($info['pal'])/3-1).' '.($this->n+1).' 0 R]');
|
1639 |
+
else
|
1640 |
+
{
|
1641 |
+
$this->_out('/ColorSpace /'.$info['cs']);
|
1642 |
+
if($info['cs']=='DeviceCMYK')
|
1643 |
+
$this->_out('/Decode [1 0 1 0 1 0 1 0]');
|
1644 |
+
}
|
1645 |
+
$this->_out('/BitsPerComponent '.$info['bpc']);
|
1646 |
+
if(isset($info['f']))
|
1647 |
+
$this->_out('/Filter /'.$info['f']);
|
1648 |
+
if(isset($info['dp']))
|
1649 |
+
$this->_out('/DecodeParms <<'.$info['dp'].'>>');
|
1650 |
+
if(isset($info['trns']) && is_array($info['trns']))
|
1651 |
+
{
|
1652 |
+
$trns = '';
|
1653 |
+
for($i=0;$i<count($info['trns']);$i++)
|
1654 |
+
$trns .= $info['trns'][$i].' '.$info['trns'][$i].' ';
|
1655 |
+
$this->_out('/Mask ['.$trns.']');
|
1656 |
+
}
|
1657 |
+
if(isset($info['smask']))
|
1658 |
+
$this->_out('/SMask '.($this->n+1).' 0 R');
|
1659 |
+
$this->_out('/Length '.strlen($info['data']).'>>');
|
1660 |
+
$this->_putstream($info['data']);
|
1661 |
+
$this->_out('endobj');
|
1662 |
+
// Soft mask
|
1663 |
+
if(isset($info['smask']))
|
1664 |
+
{
|
1665 |
+
$dp = '/Predictor 15 /Colors 1 /BitsPerComponent 8 /Columns '.$info['w'];
|
1666 |
+
$smask = array('w'=>$info['w'], 'h'=>$info['h'], 'cs'=>'DeviceGray', 'bpc'=>8, 'f'=>$info['f'], 'dp'=>$dp, 'data'=>$info['smask']);
|
1667 |
+
$this->_putimage($smask);
|
1668 |
+
}
|
1669 |
+
// Palette
|
1670 |
+
if($info['cs']=='Indexed')
|
1671 |
+
{
|
1672 |
+
$filter = ($this->compress) ? '/Filter /FlateDecode ' : '';
|
1673 |
+
$pal = ($this->compress) ? gzcompress($info['pal']) : $info['pal'];
|
1674 |
+
$this->_newobj();
|
1675 |
+
$this->_out('<<'.$filter.'/Length '.strlen($pal).'>>');
|
1676 |
+
$this->_putstream($pal);
|
1677 |
+
$this->_out('endobj');
|
1678 |
+
}
|
1679 |
+
}
|
1680 |
+
|
1681 |
+
function _putxobjectdict()
|
1682 |
+
{
|
1683 |
+
foreach($this->images as $image)
|
1684 |
+
$this->_out('/I'.$image['i'].' '.$image['n'].' 0 R');
|
1685 |
+
}
|
1686 |
+
|
1687 |
+
function _putresourcedict()
|
1688 |
+
{
|
1689 |
+
$this->_out('/ProcSet [/PDF /Text /ImageB /ImageC /ImageI]');
|
1690 |
+
$this->_out('/Font <<');
|
1691 |
+
foreach($this->fonts as $font)
|
1692 |
+
$this->_out('/F'.$font['i'].' '.$font['n'].' 0 R');
|
1693 |
+
$this->_out('>>');
|
1694 |
+
$this->_out('/XObject <<');
|
1695 |
+
$this->_putxobjectdict();
|
1696 |
+
$this->_out('>>');
|
1697 |
+
}
|
1698 |
+
|
1699 |
+
function _putresources()
|
1700 |
+
{
|
1701 |
+
$this->_putfonts();
|
1702 |
+
$this->_putimages();
|
1703 |
+
// Resource dictionary
|
1704 |
+
$this->offsets[2] = strlen($this->buffer);
|
1705 |
+
$this->_out('2 0 obj');
|
1706 |
+
$this->_out('<<');
|
1707 |
+
$this->_putresourcedict();
|
1708 |
+
$this->_out('>>');
|
1709 |
+
$this->_out('endobj');
|
1710 |
+
}
|
1711 |
+
|
1712 |
+
function _putinfo()
|
1713 |
+
{
|
1714 |
+
$this->_out('/Producer '.$this->_textstring('FPDF '.FPDF_VERSION));
|
1715 |
+
if(!empty($this->title))
|
1716 |
+
$this->_out('/Title '.$this->_textstring($this->title));
|
1717 |
+
if(!empty($this->subject))
|
1718 |
+
$this->_out('/Subject '.$this->_textstring($this->subject));
|
1719 |
+
if(!empty($this->author))
|
1720 |
+
$this->_out('/Author '.$this->_textstring($this->author));
|
1721 |
+
if(!empty($this->keywords))
|
1722 |
+
$this->_out('/Keywords '.$this->_textstring($this->keywords));
|
1723 |
+
if(!empty($this->creator))
|
1724 |
+
$this->_out('/Creator '.$this->_textstring($this->creator));
|
1725 |
+
$this->_out('/CreationDate '.$this->_textstring('D:'.@date('YmdHis')));
|
1726 |
+
}
|
1727 |
+
|
1728 |
+
function _putcatalog()
|
1729 |
+
{
|
1730 |
+
$this->_out('/Type /Catalog');
|
1731 |
+
$this->_out('/Pages 1 0 R');
|
1732 |
+
if($this->ZoomMode=='fullpage')
|
1733 |
+
$this->_out('/OpenAction [3 0 R /Fit]');
|
1734 |
+
elseif($this->ZoomMode=='fullwidth')
|
1735 |
+
$this->_out('/OpenAction [3 0 R /FitH null]');
|
1736 |
+
elseif($this->ZoomMode=='real')
|
1737 |
+
$this->_out('/OpenAction [3 0 R /XYZ null null 1]');
|
1738 |
+
elseif(!is_string($this->ZoomMode))
|
1739 |
+
$this->_out('/OpenAction [3 0 R /XYZ null null '.sprintf('%.2F',$this->ZoomMode/100).']');
|
1740 |
+
if($this->LayoutMode=='single')
|
1741 |
+
$this->_out('/PageLayout /SinglePage');
|
1742 |
+
elseif($this->LayoutMode=='continuous')
|
1743 |
+
$this->_out('/PageLayout /OneColumn');
|
1744 |
+
elseif($this->LayoutMode=='two')
|
1745 |
+
$this->_out('/PageLayout /TwoColumnLeft');
|
1746 |
+
}
|
1747 |
+
|
1748 |
+
function _putheader()
|
1749 |
+
{
|
1750 |
+
$this->_out('%PDF-'.$this->PDFVersion);
|
1751 |
+
}
|
1752 |
+
|
1753 |
+
function _puttrailer()
|
1754 |
+
{
|
1755 |
+
$this->_out('/Size '.($this->n+1));
|
1756 |
+
$this->_out('/Root '.$this->n.' 0 R');
|
1757 |
+
$this->_out('/Info '.($this->n-1).' 0 R');
|
1758 |
+
}
|
1759 |
+
|
1760 |
+
function _enddoc()
|
1761 |
+
{
|
1762 |
+
$this->_putheader();
|
1763 |
+
$this->_putpages();
|
1764 |
+
$this->_putresources();
|
1765 |
+
// Info
|
1766 |
+
$this->_newobj();
|
1767 |
+
$this->_out('<<');
|
1768 |
+
$this->_putinfo();
|
1769 |
+
$this->_out('>>');
|
1770 |
+
$this->_out('endobj');
|
1771 |
+
// Catalog
|
1772 |
+
$this->_newobj();
|
1773 |
+
$this->_out('<<');
|
1774 |
+
$this->_putcatalog();
|
1775 |
+
$this->_out('>>');
|
1776 |
+
$this->_out('endobj');
|
1777 |
+
// Cross-ref
|
1778 |
+
$o = strlen($this->buffer);
|
1779 |
+
$this->_out('xref');
|
1780 |
+
$this->_out('0 '.($this->n+1));
|
1781 |
+
$this->_out('0000000000 65535 f ');
|
1782 |
+
for($i=1;$i<=$this->n;$i++)
|
1783 |
+
$this->_out(sprintf('%010d 00000 n ',$this->offsets[$i]));
|
1784 |
+
// Trailer
|
1785 |
+
$this->_out('trailer');
|
1786 |
+
$this->_out('<<');
|
1787 |
+
$this->_puttrailer();
|
1788 |
+
$this->_out('>>');
|
1789 |
+
$this->_out('startxref');
|
1790 |
+
$this->_out($o);
|
1791 |
+
$this->_out('%%EOF');
|
1792 |
+
$this->state = 3;
|
1793 |
+
}
|
1794 |
+
// End of class
|
1795 |
+
}
|
1796 |
+
|
1797 |
+
// Handle special IE contype request
|
1798 |
+
if(isset($_SERVER['HTTP_USER_AGENT']) && $_SERVER['HTTP_USER_AGENT']=='contype')
|
1799 |
+
{
|
1800 |
+
header('Content-Type: application/pdf');
|
1801 |
+
exit;
|
1802 |
+
}
|
1803 |
+
|
1804 |
+
?>
|
includes/mlw_dashboard.php
CHANGED
@@ -144,8 +144,9 @@ function mlw_generate_quiz_dashboard(){
|
|
144 |
<h2>Quiz Master Next <?php _e("Dashboard", "mlw_qmn_text_domain"); ?><a id="opener" href="">(?)</a></h2>
|
145 |
|
146 |
<h3>Version <?php echo $mlw_quiz_version; ?></h3>
|
147 |
-
<p
|
148 |
|
|
|
149 |
<div style="float:left; width:19%;" class="inner-sidebar1">
|
150 |
<?php do_meta_boxes('quiz_wpss10','advanced',''); ?>
|
151 |
</div>
|
@@ -174,8 +175,6 @@ function mlw_generate_quiz_dashboard(){
|
|
174 |
<?php do_meta_boxes('quiz_wpss4','advanced',''); ?>
|
175 |
</div>
|
176 |
|
177 |
-
|
178 |
-
|
179 |
<!--<div style="clear:both">-->
|
180 |
|
181 |
<div style="float:left; width:38%;" class="inner-sidebar1">
|
@@ -201,7 +200,9 @@ function mlw_generate_quiz_dashboard(){
|
|
201 |
</div>
|
202 |
|
203 |
<div style="clear:both">
|
204 |
-
|
|
|
|
|
205 |
<div id="dialog" title="Help" style="display:none;">
|
206 |
<h3><b>Help</b></h3>
|
207 |
<p>This page is the main admin dashboard for the Quiz Master Next. It contains many useful widgets for the admin.</p>
|
@@ -219,6 +220,7 @@ function mlw_generate_quiz_dashboard(){
|
|
219 |
<?php
|
220 |
}
|
221 |
|
|
|
222 |
function mlw_dashboard_box()
|
223 |
{
|
224 |
//Gather the weekly stats, one variable for each day for the graph
|
@@ -233,47 +235,64 @@ function mlw_dashboard_box()
|
|
233 |
$mlw_quiz_taken_yesterday = $wpdb->get_results($sql);
|
234 |
$mlw_quiz_taken_yesterday = $wpdb->num_rows;
|
235 |
|
236 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
237 |
$mlw_three_days_ago = date("Y-m-d", $mlw_three_days_ago);
|
238 |
$sql = "SELECT quiz_name FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".$mlw_three_days_ago." 00:00:00' AND '".$mlw_three_days_ago." 23:59:59') AND deleted=0";
|
239 |
$mlw_quiz_taken_three_days = $wpdb->get_results($sql);
|
240 |
$mlw_quiz_taken_three_days = $wpdb->num_rows;
|
241 |
|
242 |
-
$mlw_four_days_ago = mktime(0, 0, 0, date("m") , date("d")-
|
243 |
$mlw_four_days_ago = date("Y-m-d", $mlw_four_days_ago);
|
244 |
$sql = "SELECT quiz_name FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".$mlw_four_days_ago." 00:00:00' AND '".$mlw_four_days_ago." 23:59:59') AND deleted=0";
|
245 |
$mlw_quiz_taken_four_days = $wpdb->get_results($sql);
|
246 |
$mlw_quiz_taken_four_days = $wpdb->num_rows;
|
247 |
|
248 |
-
$mlw_five_days_ago = mktime(0, 0, 0, date("m") , date("d")-
|
249 |
$mlw_five_days_ago = date("Y-m-d", $mlw_five_days_ago);
|
250 |
$sql = "SELECT quiz_name FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".$mlw_five_days_ago." 00:00:00' AND '".$mlw_five_days_ago." 23:59:59') AND deleted=0";
|
251 |
$mlw_quiz_taken_five_days = $wpdb->get_results($sql);
|
252 |
$mlw_quiz_taken_five_days = $wpdb->num_rows;
|
253 |
|
254 |
-
$mlw_six_days_ago = mktime(0, 0, 0, date("m") , date("d")-
|
255 |
$mlw_six_days_ago = date("Y-m-d", $mlw_six_days_ago);
|
256 |
$sql = "SELECT quiz_name FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".$mlw_six_days_ago." 00:00:00' AND '".$mlw_six_days_ago." 23:59:59') AND deleted=0";
|
257 |
$mlw_quiz_taken_six_days = $wpdb->get_results($sql);
|
258 |
$mlw_quiz_taken_six_days = $wpdb->num_rows;
|
259 |
|
260 |
-
$mlw_last_week = mktime(0, 0, 0, date("m") , date("d")-
|
261 |
$mlw_last_week = date("Y-m-d", $mlw_last_week);
|
262 |
$sql = "SELECT quiz_name FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".$mlw_last_week." 00:00:00' AND '".$mlw_last_week." 23:59:59') AND deleted=0";
|
263 |
$mlw_quiz_taken_week = $wpdb->get_results($sql);
|
264 |
$mlw_quiz_taken_week = $wpdb->num_rows;
|
265 |
?>
|
266 |
<div>
|
267 |
-
<span class="inlinesparkline"><?php echo $mlw_quiz_taken_week.",".$mlw_quiz_taken_six_days.",".$mlw_quiz_taken_five_days.",".$mlw_quiz_taken_four_days.",".$mlw_quiz_taken_three_days.",".$mlw_quiz_taken_yesterday.",".$mlw_quiz_taken_today; ?></span>
|
268 |
</div>
|
269 |
<?php
|
270 |
}
|
271 |
|
|
|
272 |
function mlw_dashboard_box_three()
|
273 |
{
|
274 |
-
//
|
275 |
global $wpdb;
|
276 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
277 |
$mlw_quiz_views = $wpdb->get_results($sql);
|
278 |
|
279 |
foreach($mlw_quiz_views as $mlw_eaches) {
|
@@ -281,7 +300,7 @@ function mlw_dashboard_box_three()
|
|
281 |
break;
|
282 |
}
|
283 |
|
284 |
-
$sql = "SELECT SUM(quiz_taken) AS QuizTaken FROM " . $wpdb->prefix . "mlw_quizzes";
|
285 |
$mlw_quiz_taken = $wpdb->get_results($sql);
|
286 |
|
287 |
foreach($mlw_quiz_taken as $mlw_eaches) {
|
@@ -289,7 +308,7 @@ function mlw_dashboard_box_three()
|
|
289 |
break;
|
290 |
}
|
291 |
|
292 |
-
$sql = "SELECT ROUND(AVG(quiz_views), 0) AS AvgViews FROM " . $wpdb->prefix . "mlw_quizzes";
|
293 |
$mlw_average_views = $wpdb->get_results($sql);
|
294 |
|
295 |
foreach($mlw_average_views as $mlw_eaches) {
|
@@ -297,7 +316,7 @@ function mlw_dashboard_box_three()
|
|
297 |
break;
|
298 |
}
|
299 |
|
300 |
-
$sql = "SELECT ROUND(AVG(quiz_taken), 0) AS AvgTaken FROM " . $wpdb->prefix . "mlw_quizzes";
|
301 |
$mlw_average_taken = $wpdb->get_results($sql);
|
302 |
|
303 |
foreach($mlw_average_taken as $mlw_eaches) {
|
@@ -305,7 +324,7 @@ function mlw_dashboard_box_three()
|
|
305 |
break;
|
306 |
}
|
307 |
|
308 |
-
$sql = "SELECT quiz_name FROM " . $wpdb->prefix . "mlw_quizzes ORDER BY quiz_views DESC LIMIT 1";
|
309 |
$mlw_quiz_most_viewed = $wpdb->get_results($sql);
|
310 |
|
311 |
foreach($mlw_quiz_most_viewed as $mlw_eaches) {
|
@@ -313,7 +332,7 @@ function mlw_dashboard_box_three()
|
|
313 |
break;
|
314 |
}
|
315 |
|
316 |
-
$sql = "SELECT quiz_name FROM " . $wpdb->prefix . "mlw_quizzes ORDER BY quiz_taken DESC LIMIT 1";
|
317 |
$mlw_quiz_most_taken = $wpdb->get_results($sql);
|
318 |
|
319 |
foreach($mlw_quiz_most_taken as $mlw_eaches) {
|
@@ -324,19 +343,35 @@ function mlw_dashboard_box_three()
|
|
324 |
<div>
|
325 |
<table width='100%'>
|
326 |
<tr>
|
327 |
-
<td align='left'>Total
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
328 |
<td align='right'><?php echo $mlw_quiz_views; ?></td>
|
329 |
</tr>
|
330 |
<tr>
|
331 |
-
<td align='left'>Total Times All Quizzes Have Been Taken</td>
|
332 |
<td align='right'><?php echo $mlw_quiz_taken; ?></td>
|
333 |
</tr>
|
334 |
<tr>
|
335 |
-
<td align='left'>Average Amount Each Quiz Has Been Viewed</td>
|
336 |
<td align='right'><?php echo $mlw_average_views; ?></td>
|
337 |
</tr>
|
338 |
<tr>
|
339 |
-
<td align='left'>Average Amount Each Quiz Has Been Taken</td>
|
340 |
<td align='right'><?php echo $mlw_average_taken; ?></td>
|
341 |
</tr>
|
342 |
<tr>
|
@@ -523,6 +558,7 @@ function mlw_dashboard_box_seven()
|
|
523 |
</tr>
|
524 |
</table>
|
525 |
</form>
|
|
|
526 |
</div>
|
527 |
<?php
|
528 |
}
|
@@ -593,7 +629,7 @@ function mlw_qmn_weekly_percent_taken_widget()
|
|
593 |
|
594 |
if ($mlw_qmn_last_week_taken != 0)
|
595 |
{
|
596 |
-
$mlw_qmn_analyze_week = (($mlw_qmn_this_week_taken - $mlw_qmn_last_week_taken) / $mlw_qmn_last_week_taken) * 100;
|
597 |
}
|
598 |
else
|
599 |
{
|
@@ -636,7 +672,7 @@ function mlw_qmn_daily_percent_taken_widget()
|
|
636 |
$mlw_qmn_last_weekday_taken = $wpdb->get_var( "SELECT COUNT(*) FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".$mlw_last_week." 00:00:00' AND '".$mlw_last_week." 23:59:59') AND deleted=0");
|
637 |
if ($mlw_qmn_last_weekday_taken != 0)
|
638 |
{
|
639 |
-
$mlw_qmn_analyze_today = (($mlw_qmn_today_taken - $mlw_qmn_last_weekday_taken) / $mlw_qmn_last_weekday_taken) * 100;
|
640 |
}
|
641 |
else
|
642 |
{
|
@@ -678,7 +714,7 @@ function mlw_qmn_monthly_percent_taken_widget()
|
|
678 |
$mlw_this_month = date("Y-m-d", $mlw_this_month);
|
679 |
$mlw_qmn_this_month_taken = $wpdb->get_var( "SELECT COUNT(*) FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".$mlw_this_month." 00:00:00' AND '".date("Y-m-d")." 23:59:59') AND deleted=0");
|
680 |
|
681 |
-
$mlw_last_month_start = mktime(0, 0, 0, date("m") , date("d")-
|
682 |
$mlw_last_month_start = date("Y-m-d", $mlw_last_month_start);
|
683 |
$mlw_last_month_end = mktime(0, 0, 0, date("m") , date("d")-30, date("Y"));
|
684 |
$mlw_last_month_end = date("Y-m-d", $mlw_last_month_end);
|
@@ -686,7 +722,7 @@ function mlw_qmn_monthly_percent_taken_widget()
|
|
686 |
|
687 |
if ($mlw_qmn_last_month_taken != 0)
|
688 |
{
|
689 |
-
$mlw_qmn_analyze_month = (($mlw_qmn_this_month_taken - $mlw_qmn_last_month_taken) / $mlw_qmn_last_month_taken) * 100;
|
690 |
}
|
691 |
else
|
692 |
{
|
@@ -736,7 +772,7 @@ function mlw_qmn_quaterly_percent_taken_widget()
|
|
736 |
|
737 |
if ($mlw_qmn_last_quater_taken != 0)
|
738 |
{
|
739 |
-
$mlw_qmn_analyze_quater = (($mlw_qmn_this_quater_taken - $mlw_qmn_last_quater_taken) / $mlw_qmn_last_quater_taken) * 100;
|
740 |
}
|
741 |
else
|
742 |
{
|
144 |
<h2>Quiz Master Next <?php _e("Dashboard", "mlw_qmn_text_domain"); ?><a id="opener" href="">(?)</a></h2>
|
145 |
|
146 |
<h3>Version <?php echo $mlw_quiz_version; ?></h3>
|
147 |
+
<p>Thank you for trying out this plugin. I hope you find it beneficial to your website. If it is, please consider a <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=RTGYAETX36ZQJ">donation</a>, a <a href="http://wordpress.org/support/view/plugin-reviews/quiz-master-next">review</a>, or taking this <a href="http://mylocalwebstop.com/sample-survey/" target="_blank">survey</a>. Thank you!</p>
|
148 |
|
149 |
+
<!--Display Widget Boxes-->
|
150 |
<div style="float:left; width:19%;" class="inner-sidebar1">
|
151 |
<?php do_meta_boxes('quiz_wpss10','advanced',''); ?>
|
152 |
</div>
|
175 |
<?php do_meta_boxes('quiz_wpss4','advanced',''); ?>
|
176 |
</div>
|
177 |
|
|
|
|
|
178 |
<!--<div style="clear:both">-->
|
179 |
|
180 |
<div style="float:left; width:38%;" class="inner-sidebar1">
|
200 |
</div>
|
201 |
|
202 |
<div style="clear:both">
|
203 |
+
|
204 |
+
|
205 |
+
<!--Dialogs-->
|
206 |
<div id="dialog" title="Help" style="display:none;">
|
207 |
<h3><b>Help</b></h3>
|
208 |
<p>This page is the main admin dashboard for the Quiz Master Next. It contains many useful widgets for the admin.</p>
|
220 |
<?php
|
221 |
}
|
222 |
|
223 |
+
//Quiz Daily Stats Widget - shows graph of quizzes taken each day for last 7 days
|
224 |
function mlw_dashboard_box()
|
225 |
{
|
226 |
//Gather the weekly stats, one variable for each day for the graph
|
235 |
$mlw_quiz_taken_yesterday = $wpdb->get_results($sql);
|
236 |
$mlw_quiz_taken_yesterday = $wpdb->num_rows;
|
237 |
|
238 |
+
$mlw_two_days_ago = mktime(0, 0, 0, date("m") , date("d")-2, date("Y"));
|
239 |
+
$mlw_two_days_ago = date("Y-m-d", $mlw_two_days_ago);
|
240 |
+
$sql = "SELECT quiz_name FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".$mlw_two_days_ago." 00:00:00' AND '".$mlw_two_days_ago." 23:59:59') AND deleted=0";
|
241 |
+
$mlw_quiz_taken_two_days = $wpdb->get_results($sql);
|
242 |
+
$mlw_quiz_taken_two_days = $wpdb->num_rows;
|
243 |
+
|
244 |
+
$mlw_three_days_ago = mktime(0, 0, 0, date("m") , date("d")-3, date("Y"));
|
245 |
$mlw_three_days_ago = date("Y-m-d", $mlw_three_days_ago);
|
246 |
$sql = "SELECT quiz_name FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".$mlw_three_days_ago." 00:00:00' AND '".$mlw_three_days_ago." 23:59:59') AND deleted=0";
|
247 |
$mlw_quiz_taken_three_days = $wpdb->get_results($sql);
|
248 |
$mlw_quiz_taken_three_days = $wpdb->num_rows;
|
249 |
|
250 |
+
$mlw_four_days_ago = mktime(0, 0, 0, date("m") , date("d")-4, date("Y"));
|
251 |
$mlw_four_days_ago = date("Y-m-d", $mlw_four_days_ago);
|
252 |
$sql = "SELECT quiz_name FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".$mlw_four_days_ago." 00:00:00' AND '".$mlw_four_days_ago." 23:59:59') AND deleted=0";
|
253 |
$mlw_quiz_taken_four_days = $wpdb->get_results($sql);
|
254 |
$mlw_quiz_taken_four_days = $wpdb->num_rows;
|
255 |
|
256 |
+
$mlw_five_days_ago = mktime(0, 0, 0, date("m") , date("d")-5, date("Y"));
|
257 |
$mlw_five_days_ago = date("Y-m-d", $mlw_five_days_ago);
|
258 |
$sql = "SELECT quiz_name FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".$mlw_five_days_ago." 00:00:00' AND '".$mlw_five_days_ago." 23:59:59') AND deleted=0";
|
259 |
$mlw_quiz_taken_five_days = $wpdb->get_results($sql);
|
260 |
$mlw_quiz_taken_five_days = $wpdb->num_rows;
|
261 |
|
262 |
+
$mlw_six_days_ago = mktime(0, 0, 0, date("m") , date("d")-6, date("Y"));
|
263 |
$mlw_six_days_ago = date("Y-m-d", $mlw_six_days_ago);
|
264 |
$sql = "SELECT quiz_name FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".$mlw_six_days_ago." 00:00:00' AND '".$mlw_six_days_ago." 23:59:59') AND deleted=0";
|
265 |
$mlw_quiz_taken_six_days = $wpdb->get_results($sql);
|
266 |
$mlw_quiz_taken_six_days = $wpdb->num_rows;
|
267 |
|
268 |
+
$mlw_last_week = mktime(0, 0, 0, date("m") , date("d")-7, date("Y"));
|
269 |
$mlw_last_week = date("Y-m-d", $mlw_last_week);
|
270 |
$sql = "SELECT quiz_name FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".$mlw_last_week." 00:00:00' AND '".$mlw_last_week." 23:59:59') AND deleted=0";
|
271 |
$mlw_quiz_taken_week = $wpdb->get_results($sql);
|
272 |
$mlw_quiz_taken_week = $wpdb->num_rows;
|
273 |
?>
|
274 |
<div>
|
275 |
+
<span class="inlinesparkline"><?php echo $mlw_quiz_taken_week.",".$mlw_quiz_taken_six_days.",".$mlw_quiz_taken_five_days.",".$mlw_quiz_taken_four_days.",".$mlw_quiz_taken_three_days.",".$mlw_quiz_taken_two_days.",".$mlw_quiz_taken_yesterday.",".$mlw_quiz_taken_today; ?></span>
|
276 |
</div>
|
277 |
<?php
|
278 |
}
|
279 |
|
280 |
+
//Quiz Total Stats - shows other useful stats
|
281 |
function mlw_dashboard_box_three()
|
282 |
{
|
283 |
+
//Function Variables
|
284 |
global $wpdb;
|
285 |
+
|
286 |
+
//Stats From Quiz Table
|
287 |
+
$mlw_stat_total_quiz = $wpdb->get_var( "SELECT COUNT(*) FROM ".$wpdb->prefix."mlw_quizzes" );
|
288 |
+
$mlw_stat_total_deleted_quiz = $wpdb->get_var( "SELECT COUNT(*) FROM ".$wpdb->prefix."mlw_quizzes WHERE deleted=1" );
|
289 |
+
$mlw_stat_total_active_quiz = $wpdb->get_var( "SELECT COUNT(*) FROM ".$wpdb->prefix."mlw_quizzes WHERE deleted=0" );
|
290 |
+
|
291 |
+
//Stats From Question Table
|
292 |
+
$mlw_stat_total_questions = $wpdb->get_var( "SELECT COUNT(*) FROM ".$wpdb->prefix."mlw_questions" );
|
293 |
+
|
294 |
+
|
295 |
+
$sql = "SELECT SUM(quiz_views) AS QuizViews FROM " . $wpdb->prefix . "mlw_quizzes WHERE deleted=0";
|
296 |
$mlw_quiz_views = $wpdb->get_results($sql);
|
297 |
|
298 |
foreach($mlw_quiz_views as $mlw_eaches) {
|
300 |
break;
|
301 |
}
|
302 |
|
303 |
+
$sql = "SELECT SUM(quiz_taken) AS QuizTaken FROM " . $wpdb->prefix . "mlw_quizzes WHERE deleted=0";
|
304 |
$mlw_quiz_taken = $wpdb->get_results($sql);
|
305 |
|
306 |
foreach($mlw_quiz_taken as $mlw_eaches) {
|
308 |
break;
|
309 |
}
|
310 |
|
311 |
+
$sql = "SELECT ROUND(AVG(quiz_views), 0) AS AvgViews FROM " . $wpdb->prefix . "mlw_quizzes WHERE deleted=0";
|
312 |
$mlw_average_views = $wpdb->get_results($sql);
|
313 |
|
314 |
foreach($mlw_average_views as $mlw_eaches) {
|
316 |
break;
|
317 |
}
|
318 |
|
319 |
+
$sql = "SELECT ROUND(AVG(quiz_taken), 0) AS AvgTaken FROM " . $wpdb->prefix . "mlw_quizzes WHERE deleted=0";
|
320 |
$mlw_average_taken = $wpdb->get_results($sql);
|
321 |
|
322 |
foreach($mlw_average_taken as $mlw_eaches) {
|
324 |
break;
|
325 |
}
|
326 |
|
327 |
+
$sql = "SELECT quiz_name FROM " . $wpdb->prefix . "mlw_quizzes WHERE deleted=0 ORDER BY quiz_views DESC LIMIT 1";
|
328 |
$mlw_quiz_most_viewed = $wpdb->get_results($sql);
|
329 |
|
330 |
foreach($mlw_quiz_most_viewed as $mlw_eaches) {
|
332 |
break;
|
333 |
}
|
334 |
|
335 |
+
$sql = "SELECT quiz_name FROM " . $wpdb->prefix . "mlw_quizzes WHERE deleted=0 ORDER BY quiz_taken DESC LIMIT 1";
|
336 |
$mlw_quiz_most_taken = $wpdb->get_results($sql);
|
337 |
|
338 |
foreach($mlw_quiz_most_taken as $mlw_eaches) {
|
343 |
<div>
|
344 |
<table width='100%'>
|
345 |
<tr>
|
346 |
+
<td align='left'>Total Created Quizzes</td>
|
347 |
+
<td align='right'><?php echo $mlw_stat_total_quiz; ?></td>
|
348 |
+
</tr>
|
349 |
+
<tr>
|
350 |
+
<td align='left'>Total Deleted Quizzes</td>
|
351 |
+
<td align='right'><?php echo $mlw_stat_total_deleted_quiz; ?></td>
|
352 |
+
</tr>
|
353 |
+
<tr>
|
354 |
+
<td align='left'>Total Active Quizzes</td>
|
355 |
+
<td align='right'><?php echo $mlw_stat_total_active_quiz; ?></td>
|
356 |
+
</tr>
|
357 |
+
<tr>
|
358 |
+
<td align='left'>Total Created Questions</td>
|
359 |
+
<td align='right'><?php echo $mlw_stat_total_questions; ?></td>
|
360 |
+
</tr>
|
361 |
+
<tr>
|
362 |
+
<td align='left'>Total Times All Active Quizzes Have Been Viewed</td>
|
363 |
<td align='right'><?php echo $mlw_quiz_views; ?></td>
|
364 |
</tr>
|
365 |
<tr>
|
366 |
+
<td align='left'>Total Times All Active Quizzes Have Been Taken</td>
|
367 |
<td align='right'><?php echo $mlw_quiz_taken; ?></td>
|
368 |
</tr>
|
369 |
<tr>
|
370 |
+
<td align='left'>Average Amount Each Active Quiz Has Been Viewed</td>
|
371 |
<td align='right'><?php echo $mlw_average_views; ?></td>
|
372 |
</tr>
|
373 |
<tr>
|
374 |
+
<td align='left'>Average Amount Each Active Quiz Has Been Taken</td>
|
375 |
<td align='right'><?php echo $mlw_average_taken; ?></td>
|
376 |
</tr>
|
377 |
<tr>
|
558 |
</tr>
|
559 |
</table>
|
560 |
</form>
|
561 |
+
<p>Disclaimer: in order to better assist you, this form will also send some useful information about your WordPress installation such as version of plugin, version of WordPress, and website url along with your message.</p>
|
562 |
</div>
|
563 |
<?php
|
564 |
}
|
629 |
|
630 |
if ($mlw_qmn_last_week_taken != 0)
|
631 |
{
|
632 |
+
$mlw_qmn_analyze_week = round((($mlw_qmn_this_week_taken - $mlw_qmn_last_week_taken) / $mlw_qmn_last_week_taken) * 100, 2);
|
633 |
}
|
634 |
else
|
635 |
{
|
672 |
$mlw_qmn_last_weekday_taken = $wpdb->get_var( "SELECT COUNT(*) FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".$mlw_last_week." 00:00:00' AND '".$mlw_last_week." 23:59:59') AND deleted=0");
|
673 |
if ($mlw_qmn_last_weekday_taken != 0)
|
674 |
{
|
675 |
+
$mlw_qmn_analyze_today = round((($mlw_qmn_today_taken - $mlw_qmn_last_weekday_taken) / $mlw_qmn_last_weekday_taken) * 100, 2);
|
676 |
}
|
677 |
else
|
678 |
{
|
714 |
$mlw_this_month = date("Y-m-d", $mlw_this_month);
|
715 |
$mlw_qmn_this_month_taken = $wpdb->get_var( "SELECT COUNT(*) FROM " . $wpdb->prefix . "mlw_results WHERE (time_taken_real BETWEEN '".$mlw_this_month." 00:00:00' AND '".date("Y-m-d")." 23:59:59') AND deleted=0");
|
716 |
|
717 |
+
$mlw_last_month_start = mktime(0, 0, 0, date("m") , date("d")-59, date("Y"));
|
718 |
$mlw_last_month_start = date("Y-m-d", $mlw_last_month_start);
|
719 |
$mlw_last_month_end = mktime(0, 0, 0, date("m") , date("d")-30, date("Y"));
|
720 |
$mlw_last_month_end = date("Y-m-d", $mlw_last_month_end);
|
722 |
|
723 |
if ($mlw_qmn_last_month_taken != 0)
|
724 |
{
|
725 |
+
$mlw_qmn_analyze_month = round((($mlw_qmn_this_month_taken - $mlw_qmn_last_month_taken) / $mlw_qmn_last_month_taken) * 100, 2);
|
726 |
}
|
727 |
else
|
728 |
{
|
772 |
|
773 |
if ($mlw_qmn_last_quater_taken != 0)
|
774 |
{
|
775 |
+
$mlw_qmn_analyze_quater = round((($mlw_qmn_this_quater_taken - $mlw_qmn_last_quater_taken) / $mlw_qmn_last_quater_taken) * 100, 2);
|
776 |
}
|
777 |
else
|
778 |
{
|
includes/mlw_qmn_credits.php
CHANGED
@@ -57,17 +57,23 @@ function mlw_generate_about_page()
|
|
57 |
<hr />
|
58 |
<h3>What's New In <?php echo $mlw_quiz_version; ?></h3>
|
59 |
<ul>
|
60 |
-
<li>Added
|
61 |
-
<li>Added
|
62 |
-
<li>Added
|
63 |
-
<li>
|
64 |
-
<li>
|
|
|
|
|
|
|
|
|
|
|
65 |
</ul>
|
66 |
<h3>What's Coming Soon</h3>
|
67 |
<ul>
|
68 |
<li>Time Limits</li>
|
69 |
<li>Quiz Pagination</li>
|
70 |
-
<li>
|
|
|
71 |
</ul>
|
72 |
|
73 |
<div id="dialog" title="Help">
|
57 |
<hr />
|
58 |
<h3>What's New In <?php echo $mlw_quiz_version; ?></h3>
|
59 |
<ul>
|
60 |
+
<li>Added Ability To Set Up Different Landing Pages Based On Score</li>
|
61 |
+
<li>Added Ability To Give Certificate After Quiz</li>
|
62 |
+
<li>Added Customizable Text Section At End Of Quiz</li>
|
63 |
+
<li>Enhanced Quiz Total Stats Widget</li>
|
64 |
+
<li>Minor Design Changes To Quiz</li>
|
65 |
+
<li>Fixed Session_Start Bug</li>
|
66 |
+
<li>Fixed Division By Zero Bug</li>
|
67 |
+
<li>Fixed Total Stats Deleted Bug</li>
|
68 |
+
<li>Fixed Dashboard Rounding Bug</li>
|
69 |
+
<li>Fixed Notice Of Unknown Company Field Bug</li>
|
70 |
</ul>
|
71 |
<h3>What's Coming Soon</h3>
|
72 |
<ul>
|
73 |
<li>Time Limits</li>
|
74 |
<li>Quiz Pagination</li>
|
75 |
+
<li>Importing Questions</li>
|
76 |
+
<li>Stats For Each Quiz</li>
|
77 |
</ul>
|
78 |
|
79 |
<div id="dialog" title="Help">
|
includes/mlw_quiz.php
CHANGED
@@ -13,14 +13,12 @@ function mlw_quiz_shortcode($atts)
|
|
13 |
/*
|
14 |
Code before loading the quiz
|
15 |
*/
|
16 |
-
|
17 |
//Variables needed throughout script
|
18 |
$mlw_quiz_id = $quiz;
|
19 |
$mlw_display = "";
|
20 |
global $wpdb;
|
21 |
$mlw_qmn_isAllowed = true;
|
22 |
-
|
23 |
-
session_start();
|
24 |
|
25 |
|
26 |
//Load quiz
|
@@ -62,10 +60,11 @@ function mlw_quiz_shortcode($atts)
|
|
62 |
if (isset($_POST["complete_quiz"]) && $_POST["complete_quiz"] == "confirmation")
|
63 |
{
|
64 |
$mlw_success = $_POST["complete_quiz"];
|
65 |
-
$mlw_user_name = $_POST["mlwUserName"];
|
66 |
-
$mlw_user_comp = $_POST["mlwUserComp"];
|
67 |
-
$mlw_user_email = $_POST["mlwUserEmail"];
|
68 |
-
$mlw_user_phone = $_POST["mlwUserPhone"];
|
|
|
69 |
$mlw_spam_email = $_POST["email"];
|
70 |
}
|
71 |
|
@@ -115,12 +114,57 @@ function mlw_quiz_shortcode($atts)
|
|
115 |
//Display Quiz
|
116 |
if (!isset($_POST["complete_quiz"]) && $mlw_quiz_options->quiz_name != "" && $mlw_qmn_isAllowed)
|
117 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
118 |
//Update the quiz views
|
119 |
$mlw_views = $mlw_quiz_options->quiz_views;
|
120 |
$mlw_views += 1;
|
121 |
$update = "UPDATE " . $wpdb->prefix . "mlw_quizzes" . " SET quiz_views='".$mlw_views."' WHERE quiz_id=".$mlw_quiz_id;
|
122 |
$results = $wpdb->query( $update );
|
123 |
-
$_SESSION['mlw_qmn_timer'] = time();
|
124 |
|
125 |
//Form validation script
|
126 |
$mlw_display .= "
|
@@ -199,7 +243,7 @@ function mlw_quiz_shortcode($atts)
|
|
199 |
$mlw_message_before = str_replace( "%QUIZ_NAME%" , $mlw_quiz_options->quiz_name, $mlw_message_before);
|
200 |
$mlw_display .= "<span>".$mlw_message_before."</span><br />";
|
201 |
$mlw_display .= "<span name='mlw_error_message' id='mlw_error_message' style='color: red;'></span><br />";
|
202 |
-
$mlw_display .= "<form name='quizForm' action='' method='post' onsubmit='return mlw_validateForm()' >";
|
203 |
|
204 |
if ($mlw_quiz_options->contact_info_location == 0)
|
205 |
{
|
@@ -213,32 +257,32 @@ function mlw_quiz_shortcode($atts)
|
|
213 |
{
|
214 |
if ($mlw_question->answer_one != "")
|
215 |
{
|
216 |
-
$mlw_display .= "<input type='radio' name='question".$mlw_question->question_id."' id='question".$mlw_question->question_id."_one' value='1' /> <label for='question".$mlw_question->question_id."_one'>".htmlspecialchars_decode($mlw_question->answer_one, ENT_QUOTES)."</label>";
|
217 |
$mlw_display .= "<br />";
|
218 |
}
|
219 |
if ($mlw_question->answer_two != "")
|
220 |
{
|
221 |
-
$mlw_display .= "<input type='radio' name='question".$mlw_question->question_id."' id='question".$mlw_question->question_id."_two' value='2' /> <label for='question".$mlw_question->question_id."_two'>".htmlspecialchars_decode($mlw_question->answer_two, ENT_QUOTES)."</label>";
|
222 |
$mlw_display .= "<br />";
|
223 |
}
|
224 |
if ($mlw_question->answer_three != "")
|
225 |
{
|
226 |
-
$mlw_display .= "<input type='radio' name='question".$mlw_question->question_id."' id='question".$mlw_question->question_id."_three' value='3' /> <label for='question".$mlw_question->question_id."_three'>".htmlspecialchars_decode($mlw_question->answer_three, ENT_QUOTES)."</label>";
|
227 |
$mlw_display .= "<br />";
|
228 |
}
|
229 |
if ($mlw_question->answer_four != "")
|
230 |
{
|
231 |
-
$mlw_display .= "<input type='radio' name='question".$mlw_question->question_id."' id='question".$mlw_question->question_id."_four' value='4' /> <label for='question".$mlw_question->question_id."_four'>".htmlspecialchars_decode($mlw_question->answer_four, ENT_QUOTES)."</label>";
|
232 |
$mlw_display .= "<br />";
|
233 |
}
|
234 |
if ($mlw_question->answer_five != "")
|
235 |
{
|
236 |
-
$mlw_display .= "<input type='radio' name='question".$mlw_question->question_id."' id='question".$mlw_question->question_id."_five' value='5' /> <label for='question".$mlw_question->question_id."_five'>".htmlspecialchars_decode($mlw_question->answer_five, ENT_QUOTES)."</label>";
|
237 |
$mlw_display .= "<br />";
|
238 |
}
|
239 |
if ($mlw_question->answer_six != "")
|
240 |
{
|
241 |
-
$mlw_display .= "<input type='radio' name='question".$mlw_question->question_id."' id='question".$mlw_question->question_id."_six' value='6' /> <label for='question".$mlw_question->question_id."_six'>".htmlspecialchars_decode($mlw_question->answer_six, ENT_QUOTES)."</label>";
|
242 |
$mlw_display .= "<br />";
|
243 |
}
|
244 |
}
|
@@ -246,33 +290,33 @@ function mlw_quiz_shortcode($atts)
|
|
246 |
{
|
247 |
if ($mlw_question->answer_one != "")
|
248 |
{
|
249 |
-
$mlw_display .= "<input type='radio' name='question".$mlw_question->question_id."' value='1' />".htmlspecialchars_decode($mlw_question->answer_one, ENT_QUOTES);
|
250 |
}
|
251 |
if ($mlw_question->answer_two != "")
|
252 |
{
|
253 |
-
$mlw_display .= "<input type='radio' name='question".$mlw_question->question_id."' value='2' />".htmlspecialchars_decode($mlw_question->answer_two, ENT_QUOTES);
|
254 |
}
|
255 |
if ($mlw_question->answer_three != "")
|
256 |
{
|
257 |
-
$mlw_display .= "<input type='radio' name='question".$mlw_question->question_id."' value='3' />".htmlspecialchars_decode($mlw_question->answer_three, ENT_QUOTES);
|
258 |
}
|
259 |
if ($mlw_question->answer_four != "")
|
260 |
{
|
261 |
-
$mlw_display .= "<input type='radio' name='question".$mlw_question->question_id."' value='4' />".htmlspecialchars_decode($mlw_question->answer_four, ENT_QUOTES);
|
262 |
}
|
263 |
if ($mlw_question->answer_five != "")
|
264 |
{
|
265 |
-
$mlw_display .= "<input type='radio' name='question".$mlw_question->question_id."' value='5' />".htmlspecialchars_decode($mlw_question->answer_five, ENT_QUOTES);
|
266 |
}
|
267 |
if ($mlw_question->answer_six != "")
|
268 |
{
|
269 |
-
$mlw_display .= "<input type='radio' name='question".$mlw_question->question_id."' value='6' />".htmlspecialchars_decode($mlw_question->answer_six, ENT_QUOTES);
|
270 |
}
|
271 |
$mlw_display .= "<br />";
|
272 |
}
|
273 |
else
|
274 |
{
|
275 |
-
$mlw_display .= "<select name='question".$mlw_question->question_id."'>";
|
276 |
if ($mlw_question->answer_one != "")
|
277 |
{
|
278 |
$mlw_display .= "<option value='1'>".htmlspecialchars_decode($mlw_question->answer_one, ENT_QUOTES)."</option>";
|
@@ -302,7 +346,7 @@ function mlw_quiz_shortcode($atts)
|
|
302 |
}
|
303 |
if ($mlw_question->comments == 0)
|
304 |
{
|
305 |
-
$mlw_display .= "<input type='text' id='mlwComment".$mlw_question->question_id."' name='mlwComment".$mlw_question->question_id."' value='".$mlw_quiz_options->comment_field_text."' onclick='clear_field(this)'/>";
|
306 |
$mlw_display .= "<br />";
|
307 |
}
|
308 |
if ($mlw_question->comments == 2)
|
@@ -323,18 +367,26 @@ function mlw_quiz_shortcode($atts)
|
|
323 |
{
|
324 |
$mlw_message_comments = $mlw_quiz_options->message_comment;
|
325 |
$mlw_message_comments = str_replace( "%QUIZ_NAME%" , $mlw_quiz_options->quiz_name, $mlw_message_comments);
|
326 |
-
$mlw_display .= "<label for='mlwQuizComments'>".$mlw_message_comments."</label>";
|
327 |
$mlw_display .= "<textarea cols='70' rows='15' id='mlwQuizComments' name='mlwQuizComments' ></textarea>";
|
328 |
$mlw_display .= "<br /><br />";
|
329 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
330 |
if ($mlw_quiz_options->contact_info_location == 1)
|
331 |
{
|
332 |
$mlw_display .= mlwDisplayContactInfo($mlw_quiz_options);
|
333 |
}
|
334 |
$mlw_display .= "<span style='display: none;'>If you are human, leave this field blank or you will be considered spam:</span>";
|
335 |
$mlw_display .= "<input style='display: none;' type='text' name='email' id='email' />";
|
|
|
336 |
$mlw_display .= "<input type='hidden' name='complete_quiz' value='confirmation' />";
|
337 |
-
$mlw_display .= "<input type='submit' value='".$mlw_quiz_options->submit_button_text."' />";
|
338 |
$mlw_display .= "<span name='mlw_error_message_bottom' id='mlw_error_message_bottom' style='color: red;'></span><br />";
|
339 |
$mlw_display .= "</form>";
|
340 |
|
@@ -358,7 +410,6 @@ function mlw_quiz_shortcode($atts)
|
|
358 |
$mlw_questions = $wpdb->get_results($sql);
|
359 |
|
360 |
//Variables needed for scoring
|
361 |
-
$mlw_qmn_timer = time() - $_SESSION['mlw_qmn_timer'];
|
362 |
$mlw_points = 0;
|
363 |
$mlw_correct = 0;
|
364 |
$mlw_total_questions = 0;
|
@@ -443,7 +494,18 @@ function mlw_quiz_shortcode($atts)
|
|
443 |
$mlw_question_answers .= "<br />";
|
444 |
}
|
445 |
}
|
446 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
447 |
|
448 |
//Prepare comment section if set
|
449 |
if (isset($_POST["mlwQuizComments"]))
|
@@ -455,23 +517,156 @@ function mlw_quiz_shortcode($atts)
|
|
455 |
$mlw_qm_quiz_comments = "";
|
456 |
}
|
457 |
|
458 |
-
|
459 |
-
|
460 |
-
$
|
461 |
-
$
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
|
474 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
475 |
|
476 |
//Prepare and send the user email
|
477 |
$mlw_message = "";
|
@@ -481,7 +676,7 @@ function mlw_quiz_shortcode($atts)
|
|
481 |
{
|
482 |
$mlw_message = $mlw_quiz_options->user_email_template;
|
483 |
$mlw_message = str_replace( "%POINT_SCORE%" , $mlw_points, $mlw_message);
|
484 |
-
$mlw_message = str_replace( "%AVERAGE_POINT%" ,
|
485 |
$mlw_message = str_replace( "%AMOUNT_CORRECT%" , $mlw_correct, $mlw_message);
|
486 |
$mlw_message = str_replace( "%TOTAL_QUESTIONS%" , $mlw_total_questions, $mlw_message);
|
487 |
$mlw_message = str_replace( "%CORRECT_SCORE%" , $mlw_total_score, $mlw_message);
|
@@ -493,6 +688,7 @@ function mlw_quiz_shortcode($atts)
|
|
493 |
$mlw_message = str_replace( "%QUESTIONS_ANSWERS%" , $mlw_question_answers, $mlw_message);
|
494 |
$mlw_message = str_replace( "%COMMENT_SECTION%" , $mlw_qm_quiz_comments, $mlw_message);
|
495 |
$mlw_message = str_replace( "%TIMER%" , $mlw_qmn_timer, $mlw_message);
|
|
|
496 |
$mlw_message = str_replace( "<br />" , "\n", $mlw_message);
|
497 |
$mlw_headers = 'From: '.$mlw_quiz_options->email_from_text.' <'.$mlw_quiz_options->admin_email.'>' . "\r\n";
|
498 |
wp_mail($mlw_user_email, "Quiz Results For ".$mlw_quiz_options->quiz_name, $mlw_message, $mlw_headers);
|
@@ -505,7 +701,7 @@ function mlw_quiz_shortcode($atts)
|
|
505 |
{
|
506 |
$mlw_message = $mlw_quiz_options->admin_email_template;
|
507 |
$mlw_message = str_replace( "%POINT_SCORE%" , $mlw_points, $mlw_message);
|
508 |
-
$mlw_message = str_replace( "%AVERAGE_POINT%" ,
|
509 |
$mlw_message = str_replace( "%AMOUNT_CORRECT%" , $mlw_correct, $mlw_message);
|
510 |
$mlw_message = str_replace( "%TOTAL_QUESTIONS%" , $mlw_total_questions, $mlw_message);
|
511 |
$mlw_message = str_replace( "%CORRECT_SCORE%" , $mlw_total_score, $mlw_message);
|
@@ -517,6 +713,7 @@ function mlw_quiz_shortcode($atts)
|
|
517 |
$mlw_message = str_replace( "%QUESTIONS_ANSWERS%" , $mlw_question_answers, $mlw_message);
|
518 |
$mlw_message = str_replace( "%COMMENT_SECTION%" , $mlw_qm_quiz_comments, $mlw_message);
|
519 |
$mlw_message = str_replace( "%TIMER%" , $mlw_qmn_timer, $mlw_message);
|
|
|
520 |
$mlw_message .= " This email was generated by the Quiz Master Next script by Frank Corso";
|
521 |
$mlw_message = str_replace( "<br />" , "\n", $mlw_message);
|
522 |
$mlw_headers = 'From: '.$mlw_quiz_options->email_from_text.' <'.$mlw_quiz_options->admin_email.'>' . "\r\n";
|
@@ -524,7 +721,7 @@ function mlw_quiz_shortcode($atts)
|
|
524 |
}
|
525 |
|
526 |
//Save the results into database
|
527 |
-
$mlw_quiz_results = "Quiz was taken in: ".$mlw_qmn_timer." seconds."."\n".$mlw_question_answers."\n"
|
528 |
$mlw_quiz_results = str_replace( "\n" , "<br>", $mlw_quiz_results);
|
529 |
$mlw_quiz_results = htmlspecialchars($mlw_quiz_results, ENT_QUOTES);
|
530 |
global $wpdb;
|
@@ -567,26 +764,26 @@ function mlwDisplayContactInfo($mlw_quiz_options)
|
|
567 |
if ($mlw_quiz_options->user_name != 2)
|
568 |
{
|
569 |
$mlw_contact_display .= "<span style='font-weight:bold;';>".$mlw_quiz_options->name_field_text."</span><br />";
|
570 |
-
$mlw_contact_display .= "<input type='text' name='mlwUserName' value='".$current_user->display_name."' />";
|
571 |
$mlw_contact_display .= "<br /><br />";
|
572 |
|
573 |
}
|
574 |
if ($mlw_quiz_options->user_comp != 2)
|
575 |
{
|
576 |
$mlw_contact_display .= "<span style='font-weight:bold;';>".$mlw_quiz_options->business_field_text."</span><br />";
|
577 |
-
$mlw_contact_display .= "<input type='text' name='mlwUserComp' value='' />";
|
578 |
$mlw_contact_display .= "<br /><br />";
|
579 |
}
|
580 |
if ($mlw_quiz_options->user_email != 2)
|
581 |
{
|
582 |
$mlw_contact_display .= "<span style='font-weight:bold;';>".$mlw_quiz_options->email_field_text."</span><br />";
|
583 |
-
$mlw_contact_display .= "<input type='text' name='mlwUserEmail' value='".$current_user->user_email."' />";
|
584 |
$mlw_contact_display .= "<br /><br />";
|
585 |
}
|
586 |
if ($mlw_quiz_options->user_phone != 2)
|
587 |
{
|
588 |
$mlw_contact_display .= "<span style='font-weight:bold;';>".$mlw_quiz_options->phone_field_text."</span><br />";
|
589 |
-
$mlw_contact_display .= "<input type='text' name='mlwUserPhone' value='' />";
|
590 |
$mlw_contact_display .= "<br /><br />";
|
591 |
}
|
592 |
|
@@ -602,25 +799,25 @@ function mlwDisplayContactInfo($mlw_quiz_options)
|
|
602 |
if ($mlw_quiz_options->user_name != 2)
|
603 |
{
|
604 |
$mlw_contact_display .= "<span style='font-weight:bold;';>".$mlw_quiz_options->name_field_text."</span><br />";
|
605 |
-
$mlw_contact_display .= "<input type='text' name='mlwUserName' value='' />";
|
606 |
$mlw_contact_display .= "<br /><br />";
|
607 |
}
|
608 |
if ($mlw_quiz_options->user_comp != 2)
|
609 |
{
|
610 |
$mlw_contact_display .= "<span style='font-weight:bold;';>".$mlw_quiz_options->business_field_text."</span><br />";
|
611 |
-
$mlw_contact_display .= "<input type='text' name='mlwUserComp' value='' />";
|
612 |
$mlw_contact_display .= "<br /><br />";
|
613 |
}
|
614 |
if ($mlw_quiz_options->user_email != 2)
|
615 |
{
|
616 |
$mlw_contact_display .= "<span style='font-weight:bold;';>".$mlw_quiz_options->email_field_text."</span><br />";
|
617 |
-
$mlw_contact_display .= "<input type='text' name='mlwUserEmail' value='' />";
|
618 |
$mlw_contact_display .= "<br /><br />";
|
619 |
}
|
620 |
if ($mlw_quiz_options->user_phone != 2)
|
621 |
{
|
622 |
$mlw_contact_display .= "<span style='font-weight:bold;';>".$mlw_quiz_options->phone_field_text."</span><br />";
|
623 |
-
$mlw_contact_display .= "<input type='text' name='mlwUserPhone' value='' />";
|
624 |
$mlw_contact_display .= "<br /><br />";
|
625 |
}
|
626 |
}
|
13 |
/*
|
14 |
Code before loading the quiz
|
15 |
*/
|
16 |
+
|
17 |
//Variables needed throughout script
|
18 |
$mlw_quiz_id = $quiz;
|
19 |
$mlw_display = "";
|
20 |
global $wpdb;
|
21 |
$mlw_qmn_isAllowed = true;
|
|
|
|
|
22 |
|
23 |
|
24 |
//Load quiz
|
60 |
if (isset($_POST["complete_quiz"]) && $_POST["complete_quiz"] == "confirmation")
|
61 |
{
|
62 |
$mlw_success = $_POST["complete_quiz"];
|
63 |
+
$mlw_user_name = isset($_POST["mlwUserName"]) ? $_POST["mlwUserName"] : 'None';
|
64 |
+
$mlw_user_comp = isset($_POST["mlwUserComp"]) ? $_POST["mlwUserComp"] : 'None';
|
65 |
+
$mlw_user_email = isset($_POST["mlwUserEmail"]) ? $_POST["mlwUserEmail"] : 'None';
|
66 |
+
$mlw_user_phone = isset($_POST["mlwUserPhone"]) ? $_POST["mlwUserPhone"] : 'None';
|
67 |
+
$mlw_qmn_timer = isset($_POST["timer"]) ? $_POST["timer"] : 0;
|
68 |
$mlw_spam_email = $_POST["email"];
|
69 |
}
|
70 |
|
114 |
//Display Quiz
|
115 |
if (!isset($_POST["complete_quiz"]) && $mlw_quiz_options->quiz_name != "" && $mlw_qmn_isAllowed)
|
116 |
{
|
117 |
+
?>
|
118 |
+
<script type="text/javascript">
|
119 |
+
var myVar=setInterval("mlwQmnTimer();",1000);
|
120 |
+
function mlwQmnTimer()
|
121 |
+
{
|
122 |
+
var x = +document.getElementById("timer").value;
|
123 |
+
x = x + 1;
|
124 |
+
document.getElementById("timer").value = x;
|
125 |
+
}
|
126 |
+
</script>
|
127 |
+
<style type="text/css">
|
128 |
+
input.submitButton
|
129 |
+
{
|
130 |
+
border: none;
|
131 |
+
-moz-border-radius: 20px;
|
132 |
+
-webkit-border-radius: 20px;
|
133 |
+
-khtml-border-radius: 20px;
|
134 |
+
border-radius: 20px;
|
135 |
+
display: block;
|
136 |
+
font: 18px Georgia, "Times New Roman", Times, serif;
|
137 |
+
letter-spacing: 1px;
|
138 |
+
margin: auto;
|
139 |
+
padding: 7px 25px;
|
140 |
+
text-shadow: 0 1px 1px #000000;
|
141 |
+
text-transform: uppercase;
|
142 |
+
cursor: pointer;
|
143 |
+
}
|
144 |
+
form.mlw_quiz_form input[type=radio] {
|
145 |
+
float: left;
|
146 |
+
margin-right: 10px;
|
147 |
+
cursor: pointer;
|
148 |
+
}
|
149 |
+
form.mlw_quiz_form input[type=text],
|
150 |
+
form.mlw_quiz_form textarea
|
151 |
+
{
|
152 |
+
-moz-border-radius: 20px;
|
153 |
+
-webkit-border-radius: 20px;
|
154 |
+
-khtml-border-radius: 20px;
|
155 |
+
border-radius: 20px;
|
156 |
+
}
|
157 |
+
form.mlw_quiz_form input:not([type=submit]):focus,
|
158 |
+
form.mlw_quiz_form textarea:focus {
|
159 |
+
background: #eaeaea;
|
160 |
+
}
|
161 |
+
</style>
|
162 |
+
<?
|
163 |
//Update the quiz views
|
164 |
$mlw_views = $mlw_quiz_options->quiz_views;
|
165 |
$mlw_views += 1;
|
166 |
$update = "UPDATE " . $wpdb->prefix . "mlw_quizzes" . " SET quiz_views='".$mlw_views."' WHERE quiz_id=".$mlw_quiz_id;
|
167 |
$results = $wpdb->query( $update );
|
|
|
168 |
|
169 |
//Form validation script
|
170 |
$mlw_display .= "
|
243 |
$mlw_message_before = str_replace( "%QUIZ_NAME%" , $mlw_quiz_options->quiz_name, $mlw_message_before);
|
244 |
$mlw_display .= "<span>".$mlw_message_before."</span><br />";
|
245 |
$mlw_display .= "<span name='mlw_error_message' id='mlw_error_message' style='color: red;'></span><br />";
|
246 |
+
$mlw_display .= "<form name='quizForm' action='' method='post' class='mlw_quiz_form' onsubmit='return mlw_validateForm()' >";
|
247 |
|
248 |
if ($mlw_quiz_options->contact_info_location == 0)
|
249 |
{
|
257 |
{
|
258 |
if ($mlw_question->answer_one != "")
|
259 |
{
|
260 |
+
$mlw_display .= "<input type='radio' required name='question".$mlw_question->question_id."' id='question".$mlw_question->question_id."_one' value='1' /> <label for='question".$mlw_question->question_id."_one'>".htmlspecialchars_decode($mlw_question->answer_one, ENT_QUOTES)."</label>";
|
261 |
$mlw_display .= "<br />";
|
262 |
}
|
263 |
if ($mlw_question->answer_two != "")
|
264 |
{
|
265 |
+
$mlw_display .= "<input type='radio' required name='question".$mlw_question->question_id."' id='question".$mlw_question->question_id."_two' value='2' /> <label for='question".$mlw_question->question_id."_two'>".htmlspecialchars_decode($mlw_question->answer_two, ENT_QUOTES)."</label>";
|
266 |
$mlw_display .= "<br />";
|
267 |
}
|
268 |
if ($mlw_question->answer_three != "")
|
269 |
{
|
270 |
+
$mlw_display .= "<input type='radio' required name='question".$mlw_question->question_id."' id='question".$mlw_question->question_id."_three' value='3' /> <label for='question".$mlw_question->question_id."_three'>".htmlspecialchars_decode($mlw_question->answer_three, ENT_QUOTES)."</label>";
|
271 |
$mlw_display .= "<br />";
|
272 |
}
|
273 |
if ($mlw_question->answer_four != "")
|
274 |
{
|
275 |
+
$mlw_display .= "<input type='radio' required name='question".$mlw_question->question_id."' id='question".$mlw_question->question_id."_four' value='4' /> <label for='question".$mlw_question->question_id."_four'>".htmlspecialchars_decode($mlw_question->answer_four, ENT_QUOTES)."</label>";
|
276 |
$mlw_display .= "<br />";
|
277 |
}
|
278 |
if ($mlw_question->answer_five != "")
|
279 |
{
|
280 |
+
$mlw_display .= "<input type='radio' required name='question".$mlw_question->question_id."' id='question".$mlw_question->question_id."_five' value='5' /> <label for='question".$mlw_question->question_id."_five'>".htmlspecialchars_decode($mlw_question->answer_five, ENT_QUOTES)."</label>";
|
281 |
$mlw_display .= "<br />";
|
282 |
}
|
283 |
if ($mlw_question->answer_six != "")
|
284 |
{
|
285 |
+
$mlw_display .= "<input type='radio' required name='question".$mlw_question->question_id."' id='question".$mlw_question->question_id."_six' value='6' /> <label for='question".$mlw_question->question_id."_six'>".htmlspecialchars_decode($mlw_question->answer_six, ENT_QUOTES)."</label>";
|
286 |
$mlw_display .= "<br />";
|
287 |
}
|
288 |
}
|
290 |
{
|
291 |
if ($mlw_question->answer_one != "")
|
292 |
{
|
293 |
+
$mlw_display .= "<input type='radio' required name='question".$mlw_question->question_id."' value='1' />".htmlspecialchars_decode($mlw_question->answer_one, ENT_QUOTES);
|
294 |
}
|
295 |
if ($mlw_question->answer_two != "")
|
296 |
{
|
297 |
+
$mlw_display .= "<input type='radio' required name='question".$mlw_question->question_id."' value='2' />".htmlspecialchars_decode($mlw_question->answer_two, ENT_QUOTES);
|
298 |
}
|
299 |
if ($mlw_question->answer_three != "")
|
300 |
{
|
301 |
+
$mlw_display .= "<input type='radio' required name='question".$mlw_question->question_id."' value='3' />".htmlspecialchars_decode($mlw_question->answer_three, ENT_QUOTES);
|
302 |
}
|
303 |
if ($mlw_question->answer_four != "")
|
304 |
{
|
305 |
+
$mlw_display .= "<input type='radio' required name='question".$mlw_question->question_id."' value='4' />".htmlspecialchars_decode($mlw_question->answer_four, ENT_QUOTES);
|
306 |
}
|
307 |
if ($mlw_question->answer_five != "")
|
308 |
{
|
309 |
+
$mlw_display .= "<input type='radio' required name='question".$mlw_question->question_id."' value='5' />".htmlspecialchars_decode($mlw_question->answer_five, ENT_QUOTES);
|
310 |
}
|
311 |
if ($mlw_question->answer_six != "")
|
312 |
{
|
313 |
+
$mlw_display .= "<input type='radio' required name='question".$mlw_question->question_id."' value='6' />".htmlspecialchars_decode($mlw_question->answer_six, ENT_QUOTES);
|
314 |
}
|
315 |
$mlw_display .= "<br />";
|
316 |
}
|
317 |
else
|
318 |
{
|
319 |
+
$mlw_display .= "<select required name='question".$mlw_question->question_id."'>";
|
320 |
if ($mlw_question->answer_one != "")
|
321 |
{
|
322 |
$mlw_display .= "<option value='1'>".htmlspecialchars_decode($mlw_question->answer_one, ENT_QUOTES)."</option>";
|
346 |
}
|
347 |
if ($mlw_question->comments == 0)
|
348 |
{
|
349 |
+
$mlw_display .= "<input type='text' x-webkit-speech id='mlwComment".$mlw_question->question_id."' name='mlwComment".$mlw_question->question_id."' value='".$mlw_quiz_options->comment_field_text."' onclick='clear_field(this)'/>";
|
350 |
$mlw_display .= "<br />";
|
351 |
}
|
352 |
if ($mlw_question->comments == 2)
|
367 |
{
|
368 |
$mlw_message_comments = $mlw_quiz_options->message_comment;
|
369 |
$mlw_message_comments = str_replace( "%QUIZ_NAME%" , $mlw_quiz_options->quiz_name, $mlw_message_comments);
|
370 |
+
$mlw_display .= "<label for='mlwQuizComments' style='font-weight:bold;'>".$mlw_message_comments."</label>";
|
371 |
$mlw_display .= "<textarea cols='70' rows='15' id='mlwQuizComments' name='mlwQuizComments' ></textarea>";
|
372 |
$mlw_display .= "<br /><br />";
|
373 |
}
|
374 |
+
if ($mlw_quiz_options->message_end_template != '')
|
375 |
+
{
|
376 |
+
$mlw_message_end = $mlw_quiz_options->message_end_template;
|
377 |
+
$mlw_message_end = str_replace( "%QUIZ_NAME%" , $mlw_quiz_options->quiz_name, $mlw_message_end);
|
378 |
+
$mlw_display .= "<span>".$mlw_message_end."</span>";
|
379 |
+
$mlw_display .= "<br /><br />";
|
380 |
+
}
|
381 |
if ($mlw_quiz_options->contact_info_location == 1)
|
382 |
{
|
383 |
$mlw_display .= mlwDisplayContactInfo($mlw_quiz_options);
|
384 |
}
|
385 |
$mlw_display .= "<span style='display: none;'>If you are human, leave this field blank or you will be considered spam:</span>";
|
386 |
$mlw_display .= "<input style='display: none;' type='text' name='email' id='email' />";
|
387 |
+
$mlw_display .= "<input type='hidden' name='timer' id='timer' value='0'/>";
|
388 |
$mlw_display .= "<input type='hidden' name='complete_quiz' value='confirmation' />";
|
389 |
+
$mlw_display .= "<input type='submit' class='submitButton' value='".$mlw_quiz_options->submit_button_text."' />";
|
390 |
$mlw_display .= "<span name='mlw_error_message_bottom' id='mlw_error_message_bottom' style='color: red;'></span><br />";
|
391 |
$mlw_display .= "</form>";
|
392 |
|
410 |
$mlw_questions = $wpdb->get_results($sql);
|
411 |
|
412 |
//Variables needed for scoring
|
|
|
413 |
$mlw_points = 0;
|
414 |
$mlw_correct = 0;
|
415 |
$mlw_total_questions = 0;
|
494 |
$mlw_question_answers .= "<br />";
|
495 |
}
|
496 |
}
|
497 |
+
|
498 |
+
//Calculate Total Percent Score And Average Points Only If Total Questions Doesn't Equal Zero To Avoid Division By Zero Error
|
499 |
+
if ($mlw_total_questions != 0)
|
500 |
+
{
|
501 |
+
$mlw_total_score = round((($mlw_correct/$mlw_total_questions)*100), 2);
|
502 |
+
$mlw_average_points = round(($mlw_points/$mlw_total_questions), 2);
|
503 |
+
}
|
504 |
+
else
|
505 |
+
{
|
506 |
+
$mlw_total_score = 0;
|
507 |
+
$mlw_average_points = 0;
|
508 |
+
}
|
509 |
|
510 |
//Prepare comment section if set
|
511 |
if (isset($_POST["mlwQuizComments"]))
|
517 |
$mlw_qm_quiz_comments = "";
|
518 |
}
|
519 |
|
520 |
+
|
521 |
+
//Prepare Certificate
|
522 |
+
$mlw_certificate_link = "";
|
523 |
+
$mlw_certificate_options = unserialize($mlw_quiz_options->certificate_template);
|
524 |
+
if (!is_array($mlw_certificate_options)) {
|
525 |
+
// something went wrong, initialize to empty array
|
526 |
+
$mlw_certificate_options = array('Enter title here', 'Enter text here', '', '', 1);
|
527 |
+
}
|
528 |
+
if ($mlw_certificate_options[4] == 0)
|
529 |
+
{
|
530 |
+
$mlw_message_certificate = $mlw_certificate_options[1];
|
531 |
+
$mlw_message_certificate = str_replace( "%POINT_SCORE%" , $mlw_points, $mlw_message_certificate);
|
532 |
+
$mlw_message_certificate = str_replace( "%AVERAGE_POINT%" , $mlw_average_points, $mlw_message_certificate);
|
533 |
+
$mlw_message_certificate = str_replace( "%AMOUNT_CORRECT%" , $mlw_correct, $mlw_message_certificate);
|
534 |
+
$mlw_message_certificate = str_replace( "%TOTAL_QUESTIONS%" , $mlw_total_questions, $mlw_message_certificate);
|
535 |
+
$mlw_message_certificate = str_replace( "%CORRECT_SCORE%" , $mlw_total_score, $mlw_message_certificate);
|
536 |
+
$mlw_message_certificate = str_replace( "%QUIZ_NAME%" , $mlw_quiz_options->quiz_name, $mlw_message_certificate);
|
537 |
+
$mlw_message_certificate = str_replace( "%USER_NAME%" , $mlw_user_name, $mlw_message_certificate);
|
538 |
+
$mlw_message_certificate = str_replace( "%USER_BUSINESS%" , $mlw_user_comp, $mlw_message_certificate);
|
539 |
+
$mlw_message_certificate = str_replace( "%USER_PHONE%" , $mlw_user_phone, $mlw_message_certificate);
|
540 |
+
$mlw_message_certificate = str_replace( "%USER_EMAIL%" , $mlw_user_email, $mlw_message_certificate);
|
541 |
+
$mlw_message_certificate = str_replace( "%QUESTIONS_ANSWERS%" , $mlw_question_answers, $mlw_message_certificate);
|
542 |
+
$mlw_message_certificate = str_replace( "%COMMENT_SECTION%" , $mlw_qm_quiz_comments, $mlw_message_certificate);
|
543 |
+
$mlw_message_certificate = str_replace( "%TIMER%" , $mlw_qmn_timer, $mlw_message_certificate);
|
544 |
+
$mlw_message_certificate = str_replace( "\n" , "<br>", $mlw_message_certificate);
|
545 |
+
$mlw_qmn_certifiicate_file = "<?php
|
546 |
+
include(\"".plugin_dir_path( __FILE__ )."WriteHTML.php\");
|
547 |
+
\$pdf = new PDF_HTML();
|
548 |
+
\$pdf->AddPage('L');";
|
549 |
+
$mlw_qmn_certifiicate_file .= $mlw_certificate_options[3] != '' ? "\$pdf->Image('".$mlw_certificate_options[3]."',0,0,\$pdf->w, \$pdf->h);" : '';
|
550 |
+
$mlw_qmn_certifiicate_file .= "\$pdf->Ln(20);
|
551 |
+
\$pdf->SetFont('Arial','B',24);
|
552 |
+
\$pdf->MultiCell(280,20,'".$mlw_certificate_options[0]."', 0, 'C');
|
553 |
+
\$pdf->Ln(15);
|
554 |
+
\$pdf->SetFont('Arial','',16);
|
555 |
+
\$pdf->WriteHTML('<p align=\"center\">".$mlw_message_certificate."</p>');";
|
556 |
+
$mlw_qmn_certifiicate_file .= $mlw_certificate_options[2] != '' ? "\$pdf->Image('".$mlw_certificate_options[2]."',110,130);" : '';
|
557 |
+
$mlw_qmn_certifiicate_file .= "\$pdf->Output('mlw_qmn_certificate.pdf', 'D');
|
558 |
+
unlink(__FILE__);
|
559 |
+
?>";
|
560 |
+
$mlw_qmn_certificate_filename = str_replace(home_url()."/", '', plugin_dir_url( __FILE__ ))."certificates/mlw_qmn_quiz".date("YmdHis").$mlw_qmn_timer.".php";
|
561 |
+
file_put_contents($mlw_qmn_certificate_filename, $mlw_qmn_certifiicate_file);
|
562 |
+
$mlw_qmn_certificate_filename = plugin_dir_url( __FILE__ )."certificates/mlw_qmn_quiz".date("YmdHis").$mlw_qmn_timer.".php";
|
563 |
+
$mlw_certificate_link = "<a href='".$mlw_qmn_certificate_filename."' style='color: blue;'>Download Certificate</a>";
|
564 |
+
}
|
565 |
+
|
566 |
+
/*
|
567 |
+
Prepare the landing page
|
568 |
+
-First, unserialize message_after column
|
569 |
+
-Second, check for array in case user has not updated
|
570 |
+
Message array = (array( bottomvalue, topvalue, text),array( bottomvalue, topvalue, text), etc..., array(0,0,text))
|
571 |
+
*/
|
572 |
+
$mlw_message_after_array = @unserialize($mlw_quiz_options->message_after);
|
573 |
+
if (is_array($mlw_message_after_array))
|
574 |
+
{
|
575 |
+
//Cycle through landing pages
|
576 |
+
foreach($mlw_message_after_array as $mlw_each)
|
577 |
+
{
|
578 |
+
//Check to see if default
|
579 |
+
if ($mlw_each[0] == 0 && $mlw_each[1] == 0)
|
580 |
+
{
|
581 |
+
$mlw_message_after = $mlw_each[2];
|
582 |
+
$mlw_message_after = str_replace( "%POINT_SCORE%" , $mlw_points, $mlw_message_after);
|
583 |
+
$mlw_message_after = str_replace( "%AVERAGE_POINT%" , $mlw_average_points, $mlw_message_after);
|
584 |
+
$mlw_message_after = str_replace( "%AMOUNT_CORRECT%" , $mlw_correct, $mlw_message_after);
|
585 |
+
$mlw_message_after = str_replace( "%TOTAL_QUESTIONS%" , $mlw_total_questions, $mlw_message_after);
|
586 |
+
$mlw_message_after = str_replace( "%CORRECT_SCORE%" , $mlw_total_score, $mlw_message_after);
|
587 |
+
$mlw_message_after = str_replace( "%QUIZ_NAME%" , $mlw_quiz_options->quiz_name, $mlw_message_after);
|
588 |
+
$mlw_message_after = str_replace( "%USER_NAME%" , $mlw_user_name, $mlw_message_after);
|
589 |
+
$mlw_message_after = str_replace( "%USER_BUSINESS%" , $mlw_user_comp, $mlw_message_after);
|
590 |
+
$mlw_message_after = str_replace( "%USER_PHONE%" , $mlw_user_phone, $mlw_message_after);
|
591 |
+
$mlw_message_after = str_replace( "%USER_EMAIL%" , $mlw_user_email, $mlw_message_after);
|
592 |
+
$mlw_message_after = str_replace( "%QUESTIONS_ANSWERS%" , $mlw_question_answers, $mlw_message_after);
|
593 |
+
$mlw_message_after = str_replace( "%COMMENT_SECTION%" , $mlw_qm_quiz_comments, $mlw_message_after);
|
594 |
+
$mlw_message_after = str_replace( "%TIMER%" , $mlw_qmn_timer, $mlw_message_after);
|
595 |
+
$mlw_message_after = str_replace( "%CERTIFICATE_LINK%" , $mlw_certificate_link, $mlw_message_after);
|
596 |
+
$mlw_message_after = str_replace( "\n" , "<br>", $mlw_message_after);
|
597 |
+
$mlw_display .= $mlw_message_after;
|
598 |
+
break;
|
599 |
+
}
|
600 |
+
else
|
601 |
+
{
|
602 |
+
//Check to see if points fall in correct range
|
603 |
+
if ($mlw_points >= $mlw_each[0] && $mlw_points <= $mlw_each[1])
|
604 |
+
{
|
605 |
+
$mlw_message_after = $mlw_each[2];
|
606 |
+
$mlw_message_after = str_replace( "%POINT_SCORE%" , $mlw_points, $mlw_message_after);
|
607 |
+
$mlw_message_after = str_replace( "%AVERAGE_POINT%" , $mlw_average_points, $mlw_message_after);
|
608 |
+
$mlw_message_after = str_replace( "%AMOUNT_CORRECT%" , $mlw_correct, $mlw_message_after);
|
609 |
+
$mlw_message_after = str_replace( "%TOTAL_QUESTIONS%" , $mlw_total_questions, $mlw_message_after);
|
610 |
+
$mlw_message_after = str_replace( "%CORRECT_SCORE%" , $mlw_total_score, $mlw_message_after);
|
611 |
+
$mlw_message_after = str_replace( "%QUIZ_NAME%" , $mlw_quiz_options->quiz_name, $mlw_message_after);
|
612 |
+
$mlw_message_after = str_replace( "%USER_NAME%" , $mlw_user_name, $mlw_message_after);
|
613 |
+
$mlw_message_after = str_replace( "%USER_BUSINESS%" , $mlw_user_comp, $mlw_message_after);
|
614 |
+
$mlw_message_after = str_replace( "%USER_PHONE%" , $mlw_user_phone, $mlw_message_after);
|
615 |
+
$mlw_message_after = str_replace( "%USER_EMAIL%" , $mlw_user_email, $mlw_message_after);
|
616 |
+
$mlw_message_after = str_replace( "%QUESTIONS_ANSWERS%" , $mlw_question_answers, $mlw_message_after);
|
617 |
+
$mlw_message_after = str_replace( "%COMMENT_SECTION%" , $mlw_qm_quiz_comments, $mlw_message_after);
|
618 |
+
$mlw_message_after = str_replace( "%TIMER%" , $mlw_qmn_timer, $mlw_message_after);
|
619 |
+
$mlw_message_after = str_replace( "%CERTIFICATE_LINK%" , $mlw_certificate_link, $mlw_message_after);
|
620 |
+
$mlw_message_after = str_replace( "\n" , "<br>", $mlw_message_after);
|
621 |
+
$mlw_display .= $mlw_message_after;
|
622 |
+
break;
|
623 |
+
}
|
624 |
+
//Check to see if score fall in correct range
|
625 |
+
if ($mlw_total_score >= $mlw_each[0] && $mlw_total_score <= $mlw_each[1])
|
626 |
+
{
|
627 |
+
$mlw_message_after = $mlw_each[2];
|
628 |
+
$mlw_message_after = str_replace( "%POINT_SCORE%" , $mlw_points, $mlw_message_after);
|
629 |
+
$mlw_message_after = str_replace( "%AVERAGE_POINT%" , $mlw_average_points, $mlw_message_after);
|
630 |
+
$mlw_message_after = str_replace( "%AMOUNT_CORRECT%" , $mlw_correct, $mlw_message_after);
|
631 |
+
$mlw_message_after = str_replace( "%TOTAL_QUESTIONS%" , $mlw_total_questions, $mlw_message_after);
|
632 |
+
$mlw_message_after = str_replace( "%CORRECT_SCORE%" , $mlw_total_score, $mlw_message_after);
|
633 |
+
$mlw_message_after = str_replace( "%QUIZ_NAME%" , $mlw_quiz_options->quiz_name, $mlw_message_after);
|
634 |
+
$mlw_message_after = str_replace( "%USER_NAME%" , $mlw_user_name, $mlw_message_after);
|
635 |
+
$mlw_message_after = str_replace( "%USER_BUSINESS%" , $mlw_user_comp, $mlw_message_after);
|
636 |
+
$mlw_message_after = str_replace( "%USER_PHONE%" , $mlw_user_phone, $mlw_message_after);
|
637 |
+
$mlw_message_after = str_replace( "%USER_EMAIL%" , $mlw_user_email, $mlw_message_after);
|
638 |
+
$mlw_message_after = str_replace( "%QUESTIONS_ANSWERS%" , $mlw_question_answers, $mlw_message_after);
|
639 |
+
$mlw_message_after = str_replace( "%COMMENT_SECTION%" , $mlw_qm_quiz_comments, $mlw_message_after);
|
640 |
+
$mlw_message_after = str_replace( "%TIMER%" , $mlw_qmn_timer, $mlw_message_after);
|
641 |
+
$mlw_message_after = str_replace( "%CERTIFICATE_LINK%" , $mlw_certificate_link, $mlw_message_after);
|
642 |
+
$mlw_message_after = str_replace( "\n" , "<br>", $mlw_message_after);
|
643 |
+
$mlw_display .= $mlw_message_after;
|
644 |
+
break;
|
645 |
+
}
|
646 |
+
}
|
647 |
+
}
|
648 |
+
}
|
649 |
+
else
|
650 |
+
{
|
651 |
+
//Prepare the after quiz message
|
652 |
+
$mlw_message_after = $mlw_quiz_options->message_after;
|
653 |
+
$mlw_message_after = str_replace( "%POINT_SCORE%" , $mlw_points, $mlw_message_after);
|
654 |
+
$mlw_message_after = str_replace( "%AVERAGE_POINT%" , $mlw_average_points, $mlw_message_after);
|
655 |
+
$mlw_message_after = str_replace( "%AMOUNT_CORRECT%" , $mlw_correct, $mlw_message_after);
|
656 |
+
$mlw_message_after = str_replace( "%TOTAL_QUESTIONS%" , $mlw_total_questions, $mlw_message_after);
|
657 |
+
$mlw_message_after = str_replace( "%CORRECT_SCORE%" , $mlw_total_score, $mlw_message_after);
|
658 |
+
$mlw_message_after = str_replace( "%QUIZ_NAME%" , $mlw_quiz_options->quiz_name, $mlw_message_after);
|
659 |
+
$mlw_message_after = str_replace( "%USER_NAME%" , $mlw_user_name, $mlw_message_after);
|
660 |
+
$mlw_message_after = str_replace( "%USER_BUSINESS%" , $mlw_user_comp, $mlw_message_after);
|
661 |
+
$mlw_message_after = str_replace( "%USER_PHONE%" , $mlw_user_phone, $mlw_message_after);
|
662 |
+
$mlw_message_after = str_replace( "%USER_EMAIL%" , $mlw_user_email, $mlw_message_after);
|
663 |
+
$mlw_message_after = str_replace( "%QUESTIONS_ANSWERS%" , $mlw_question_answers, $mlw_message_after);
|
664 |
+
$mlw_message_after = str_replace( "%COMMENT_SECTION%" , $mlw_qm_quiz_comments, $mlw_message_after);
|
665 |
+
$mlw_message_after = str_replace( "%TIMER%" , $mlw_qmn_timer, $mlw_message_after);
|
666 |
+
$mlw_message_after = str_replace( "%CERTIFICATE_LINK%" , $mlw_certificate_link, $mlw_message_after);
|
667 |
+
$mlw_message_after = str_replace( "\n" , "<br>", $mlw_message_after);
|
668 |
+
$mlw_display .= $mlw_message_after;
|
669 |
+
}
|
670 |
|
671 |
//Prepare and send the user email
|
672 |
$mlw_message = "";
|
676 |
{
|
677 |
$mlw_message = $mlw_quiz_options->user_email_template;
|
678 |
$mlw_message = str_replace( "%POINT_SCORE%" , $mlw_points, $mlw_message);
|
679 |
+
$mlw_message = str_replace( "%AVERAGE_POINT%" , $mlw_average_points, $mlw_message);
|
680 |
$mlw_message = str_replace( "%AMOUNT_CORRECT%" , $mlw_correct, $mlw_message);
|
681 |
$mlw_message = str_replace( "%TOTAL_QUESTIONS%" , $mlw_total_questions, $mlw_message);
|
682 |
$mlw_message = str_replace( "%CORRECT_SCORE%" , $mlw_total_score, $mlw_message);
|
688 |
$mlw_message = str_replace( "%QUESTIONS_ANSWERS%" , $mlw_question_answers, $mlw_message);
|
689 |
$mlw_message = str_replace( "%COMMENT_SECTION%" , $mlw_qm_quiz_comments, $mlw_message);
|
690 |
$mlw_message = str_replace( "%TIMER%" , $mlw_qmn_timer, $mlw_message);
|
691 |
+
$mlw_message = str_replace( "%CERTIFICATE_LINK%" , $mlw_certificate_link, $mlw_message);
|
692 |
$mlw_message = str_replace( "<br />" , "\n", $mlw_message);
|
693 |
$mlw_headers = 'From: '.$mlw_quiz_options->email_from_text.' <'.$mlw_quiz_options->admin_email.'>' . "\r\n";
|
694 |
wp_mail($mlw_user_email, "Quiz Results For ".$mlw_quiz_options->quiz_name, $mlw_message, $mlw_headers);
|
701 |
{
|
702 |
$mlw_message = $mlw_quiz_options->admin_email_template;
|
703 |
$mlw_message = str_replace( "%POINT_SCORE%" , $mlw_points, $mlw_message);
|
704 |
+
$mlw_message = str_replace( "%AVERAGE_POINT%" , $mlw_average_points, $mlw_message);
|
705 |
$mlw_message = str_replace( "%AMOUNT_CORRECT%" , $mlw_correct, $mlw_message);
|
706 |
$mlw_message = str_replace( "%TOTAL_QUESTIONS%" , $mlw_total_questions, $mlw_message);
|
707 |
$mlw_message = str_replace( "%CORRECT_SCORE%" , $mlw_total_score, $mlw_message);
|
713 |
$mlw_message = str_replace( "%QUESTIONS_ANSWERS%" , $mlw_question_answers, $mlw_message);
|
714 |
$mlw_message = str_replace( "%COMMENT_SECTION%" , $mlw_qm_quiz_comments, $mlw_message);
|
715 |
$mlw_message = str_replace( "%TIMER%" , $mlw_qmn_timer, $mlw_message);
|
716 |
+
$mlw_message = str_replace( "%CERTIFICATE_LINK%" , $mlw_certificate_link, $mlw_message);
|
717 |
$mlw_message .= " This email was generated by the Quiz Master Next script by Frank Corso";
|
718 |
$mlw_message = str_replace( "<br />" , "\n", $mlw_message);
|
719 |
$mlw_headers = 'From: '.$mlw_quiz_options->email_from_text.' <'.$mlw_quiz_options->admin_email.'>' . "\r\n";
|
721 |
}
|
722 |
|
723 |
//Save the results into database
|
724 |
+
$mlw_quiz_results = "Quiz was taken in: ".$mlw_qmn_timer." seconds."."\n".$mlw_question_answers."\n".$mlw_qm_quiz_comments;
|
725 |
$mlw_quiz_results = str_replace( "\n" , "<br>", $mlw_quiz_results);
|
726 |
$mlw_quiz_results = htmlspecialchars($mlw_quiz_results, ENT_QUOTES);
|
727 |
global $wpdb;
|
764 |
if ($mlw_quiz_options->user_name != 2)
|
765 |
{
|
766 |
$mlw_contact_display .= "<span style='font-weight:bold;';>".$mlw_quiz_options->name_field_text."</span><br />";
|
767 |
+
$mlw_contact_display .= "<input type='text' x-webkit-speech name='mlwUserName' value='".$current_user->display_name."' />";
|
768 |
$mlw_contact_display .= "<br /><br />";
|
769 |
|
770 |
}
|
771 |
if ($mlw_quiz_options->user_comp != 2)
|
772 |
{
|
773 |
$mlw_contact_display .= "<span style='font-weight:bold;';>".$mlw_quiz_options->business_field_text."</span><br />";
|
774 |
+
$mlw_contact_display .= "<input type='text' x-webkit-speech name='mlwUserComp' value='' />";
|
775 |
$mlw_contact_display .= "<br /><br />";
|
776 |
}
|
777 |
if ($mlw_quiz_options->user_email != 2)
|
778 |
{
|
779 |
$mlw_contact_display .= "<span style='font-weight:bold;';>".$mlw_quiz_options->email_field_text."</span><br />";
|
780 |
+
$mlw_contact_display .= "<input type='text' x-webkit-speech name='mlwUserEmail' value='".$current_user->user_email."' />";
|
781 |
$mlw_contact_display .= "<br /><br />";
|
782 |
}
|
783 |
if ($mlw_quiz_options->user_phone != 2)
|
784 |
{
|
785 |
$mlw_contact_display .= "<span style='font-weight:bold;';>".$mlw_quiz_options->phone_field_text."</span><br />";
|
786 |
+
$mlw_contact_display .= "<input type='text' x-webkit-speech name='mlwUserPhone' value='' />";
|
787 |
$mlw_contact_display .= "<br /><br />";
|
788 |
}
|
789 |
|
799 |
if ($mlw_quiz_options->user_name != 2)
|
800 |
{
|
801 |
$mlw_contact_display .= "<span style='font-weight:bold;';>".$mlw_quiz_options->name_field_text."</span><br />";
|
802 |
+
$mlw_contact_display .= "<input type='text' x-webkit-speech name='mlwUserName' value='' />";
|
803 |
$mlw_contact_display .= "<br /><br />";
|
804 |
}
|
805 |
if ($mlw_quiz_options->user_comp != 2)
|
806 |
{
|
807 |
$mlw_contact_display .= "<span style='font-weight:bold;';>".$mlw_quiz_options->business_field_text."</span><br />";
|
808 |
+
$mlw_contact_display .= "<input type='text' x-webkit-speech name='mlwUserComp' value='' />";
|
809 |
$mlw_contact_display .= "<br /><br />";
|
810 |
}
|
811 |
if ($mlw_quiz_options->user_email != 2)
|
812 |
{
|
813 |
$mlw_contact_display .= "<span style='font-weight:bold;';>".$mlw_quiz_options->email_field_text."</span><br />";
|
814 |
+
$mlw_contact_display .= "<input type='text' x-webkit-speech name='mlwUserEmail' value='' />";
|
815 |
$mlw_contact_display .= "<br /><br />";
|
816 |
}
|
817 |
if ($mlw_quiz_options->user_phone != 2)
|
818 |
{
|
819 |
$mlw_contact_display .= "<span style='font-weight:bold;';>".$mlw_quiz_options->phone_field_text."</span><br />";
|
820 |
+
$mlw_contact_display .= "<input type='text' x-webkit-speech name='mlwUserPhone' value='' />";
|
821 |
$mlw_contact_display .= "<br /><br />";
|
822 |
}
|
823 |
}
|
includes/mlw_quiz_admin.php
CHANGED
@@ -30,8 +30,8 @@ function mlw_generate_quiz_admin()
|
|
30 |
5. %FIFTH_PLACE_NAME%-%FIFTH_PLACE_SCORE%<br />";
|
31 |
$mlw_question_answer_default = "%QUESTION%<br /> Answer Provided: %USER_ANSWER%<br /> Correct Answer: %CORRECT_ANSWER%<br /> Comments Entered: %USER_COMMENTS%<br />";
|
32 |
$insert = "INSERT INTO " . $table_name .
|
33 |
-
"(quiz_id, quiz_name, message_before, message_after, message_comment, user_email_template, admin_email_template, submit_button_text, name_field_text, business_field_text, email_field_text, phone_field_text, comment_field_text, email_from_text, question_answer_template, leaderboard_template, system, randomness_order, loggedin_user_contact, show_score, send_user_email, send_admin_email, contact_info_location, user_name, user_comp, user_email, user_phone, admin_email, comment_section, question_from_total, total_user_tries, total_user_tries_text, quiz_views, quiz_taken, deleted) " .
|
34 |
-
"VALUES (NULL , '" . $quiz_name . "' , 'Enter your text here', 'Enter your text here', 'Enter your text here', 'Enter your text here', 'Enter your text here', 'Submit Quiz', 'Name', 'Business', 'Email', 'Phone Number', 'Comments', 'Wordpress', '".$mlw_question_answer_default."', '".$mlw_leaderboard_default."', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '".get_option( 'admin_email', 'Enter email' )."', 0, 0, 0, 'Enter Your Text Here', 0, 0, 0)";
|
35 |
$results = $wpdb->query( $insert );
|
36 |
if ($results != false)
|
37 |
{
|
@@ -120,7 +120,7 @@ function mlw_generate_quiz_admin()
|
|
120 |
$mlw_duplicate_quiz_id = $_POST["duplicate_quiz_id"];
|
121 |
$mlw_duplicate_quiz_name = $_POST["duplicate_new_quiz_name"];
|
122 |
$mlw_qmn_duplicate_data = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM " . $wpdb->prefix . "mlw_quizzes WHERE quiz_id=%d", $mlw_duplicate_quiz_id ) );
|
123 |
-
$results = $wpdb->query( "INSERT INTO ".$table_name." (quiz_id, quiz_name, message_before, message_after, message_comment, user_email_template, admin_email_template, submit_button_text, name_field_text, business_field_text, email_field_text, phone_field_text, comment_field_text, email_from_text, question_answer_template, leaderboard_template, system, randomness_order, loggedin_user_contact, show_score, send_user_email, send_admin_email, contact_info_location, user_name, user_comp, user_email, user_phone, admin_email, comment_section, question_from_total, total_user_tries, total_user_tries_text, quiz_views, quiz_taken, deleted) VALUES (NULL , '".$mlw_duplicate_quiz_name."' , '".$mlw_qmn_duplicate_data->message_before."', '".$mlw_qmn_duplicate_data->message_after."', '".$mlw_qmn_duplicate_data->message_comment."', '".$mlw_qmn_duplicate_data->user_email_template."', '".$mlw_qmn_duplicate_data->admin_email_template."', '".$mlw_qmn_duplicate_data->submit_button_text."', '".$mlw_qmn_duplicate_data->name_field_text."', '".$mlw_qmn_duplicate_data->business_field_text."', '".$mlw_qmn_duplicate_data->email_field_text."', '".$mlw_qmn_duplicate_data->phone_field_text."', '".$mlw_qmn_duplicate_data->comment_field_text."', '".$mlw_qmn_duplicate_data->email_from_text."', '".$mlw_qmn_duplicate_data->question_answer_template."', '".$mlw_qmn_duplicate_data->leaderboard_template."', ".$mlw_qmn_duplicate_data->system.", ".$mlw_qmn_duplicate_data->randomness_order.", ".$mlw_qmn_duplicate_data->loggedin_user_contact.", ".$mlw_qmn_duplicate_data->show_score.", ".$mlw_qmn_duplicate_data->send_user_email.", ".$mlw_qmn_duplicate_data->send_admin_email.", ".$mlw_qmn_duplicate_data->contact_info_location.", ".$mlw_qmn_duplicate_data->user_name.", ".$mlw_qmn_duplicate_data->user_comp.", ".$mlw_qmn_duplicate_data->user_email.", ".$mlw_qmn_duplicate_data->user_phone.", '".get_option( 'admin_email', 'Enter email' )."', ".$mlw_qmn_duplicate_data->comment_section.", ".$mlw_qmn_duplicate_data->question_from_total.", ".$mlw_qmn_duplicate_data->total_user_tries.", '".$mlw_qmn_duplicate_data->total_user_tries_text."', 0, 0, 0)" );
|
124 |
if ($results != false)
|
125 |
{
|
126 |
$hasDuplicatedQuiz = true;
|
30 |
5. %FIFTH_PLACE_NAME%-%FIFTH_PLACE_SCORE%<br />";
|
31 |
$mlw_question_answer_default = "%QUESTION%<br /> Answer Provided: %USER_ANSWER%<br /> Correct Answer: %CORRECT_ANSWER%<br /> Comments Entered: %USER_COMMENTS%<br />";
|
32 |
$insert = "INSERT INTO " . $table_name .
|
33 |
+
"(quiz_id, quiz_name, message_before, message_after, message_comment, message_end_template, user_email_template, admin_email_template, submit_button_text, name_field_text, business_field_text, email_field_text, phone_field_text, comment_field_text, email_from_text, question_answer_template, leaderboard_template, system, randomness_order, loggedin_user_contact, show_score, send_user_email, send_admin_email, contact_info_location, user_name, user_comp, user_email, user_phone, admin_email, comment_section, question_from_total, total_user_tries, total_user_tries_text, certificate_template, quiz_views, quiz_taken, deleted) " .
|
34 |
+
"VALUES (NULL , '" . $quiz_name . "' , 'Enter your text here', 'Enter your text here', 'Enter your text here', '', 'Enter your text here', 'Enter your text here', 'Submit Quiz', 'Name', 'Business', 'Email', 'Phone Number', 'Comments', 'Wordpress', '".$mlw_question_answer_default."', '".$mlw_leaderboard_default."', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '".get_option( 'admin_email', 'Enter email' )."', 0, 0, 0, 'Enter Your Text Here', 'Enter Your Text Here!', 0, 0, 0)";
|
35 |
$results = $wpdb->query( $insert );
|
36 |
if ($results != false)
|
37 |
{
|
120 |
$mlw_duplicate_quiz_id = $_POST["duplicate_quiz_id"];
|
121 |
$mlw_duplicate_quiz_name = $_POST["duplicate_new_quiz_name"];
|
122 |
$mlw_qmn_duplicate_data = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM " . $wpdb->prefix . "mlw_quizzes WHERE quiz_id=%d", $mlw_duplicate_quiz_id ) );
|
123 |
+
$results = $wpdb->query( "INSERT INTO ".$table_name." (quiz_id, quiz_name, message_before, message_after, message_comment, message_end_template, user_email_template, admin_email_template, submit_button_text, name_field_text, business_field_text, email_field_text, phone_field_text, comment_field_text, email_from_text, question_answer_template, leaderboard_template, system, randomness_order, loggedin_user_contact, show_score, send_user_email, send_admin_email, contact_info_location, user_name, user_comp, user_email, user_phone, admin_email, comment_section, question_from_total, total_user_tries, total_user_tries_text, certificate_template, quiz_views, quiz_taken, deleted) VALUES (NULL , '".$mlw_duplicate_quiz_name."' , '".$mlw_qmn_duplicate_data->message_before."', '".$mlw_qmn_duplicate_data->message_after."', '".$mlw_qmn_duplicate_data->message_comment."', '".$mlw_qmn_duplicate_data->message_end_template."', '".$mlw_qmn_duplicate_data->user_email_template."', '".$mlw_qmn_duplicate_data->admin_email_template."', '".$mlw_qmn_duplicate_data->submit_button_text."', '".$mlw_qmn_duplicate_data->name_field_text."', '".$mlw_qmn_duplicate_data->business_field_text."', '".$mlw_qmn_duplicate_data->email_field_text."', '".$mlw_qmn_duplicate_data->phone_field_text."', '".$mlw_qmn_duplicate_data->comment_field_text."', '".$mlw_qmn_duplicate_data->email_from_text."', '".$mlw_qmn_duplicate_data->question_answer_template."', '".$mlw_qmn_duplicate_data->leaderboard_template."', ".$mlw_qmn_duplicate_data->system.", ".$mlw_qmn_duplicate_data->randomness_order.", ".$mlw_qmn_duplicate_data->loggedin_user_contact.", ".$mlw_qmn_duplicate_data->show_score.", ".$mlw_qmn_duplicate_data->send_user_email.", ".$mlw_qmn_duplicate_data->send_admin_email.", ".$mlw_qmn_duplicate_data->contact_info_location.", ".$mlw_qmn_duplicate_data->user_name.", ".$mlw_qmn_duplicate_data->user_comp.", ".$mlw_qmn_duplicate_data->user_email.", ".$mlw_qmn_duplicate_data->user_phone.", '".get_option( 'admin_email', 'Enter email' )."', ".$mlw_qmn_duplicate_data->comment_section.", ".$mlw_qmn_duplicate_data->question_from_total.", ".$mlw_qmn_duplicate_data->total_user_tries.", '".$mlw_qmn_duplicate_data->total_user_tries_text."', '".$mlw_qmn_duplicate_data->certificate_template."', 0, 0, 0)" );
|
124 |
if ($results != false)
|
125 |
{
|
126 |
$hasDuplicatedQuiz = true;
|
includes/mlw_quiz_install.php
CHANGED
@@ -23,6 +23,8 @@ function mlw_quiz_activate()
|
|
23 |
message_after TEXT NOT NULL,
|
24 |
|
25 |
message_comment TEXT NOT NULL,
|
|
|
|
|
26 |
|
27 |
user_email_template TEXT NOT NULL,
|
28 |
|
@@ -77,6 +79,8 @@ function mlw_quiz_activate()
|
|
77 |
total_user_tries INT NOT NULL,
|
78 |
|
79 |
total_user_tries_text TEXT NOT NULL,
|
|
|
|
|
80 |
|
81 |
quiz_views INT NOT NULL,
|
82 |
|
23 |
message_after TEXT NOT NULL,
|
24 |
|
25 |
message_comment TEXT NOT NULL,
|
26 |
+
|
27 |
+
message_end_template TEXT NOT NULL,
|
28 |
|
29 |
user_email_template TEXT NOT NULL,
|
30 |
|
79 |
total_user_tries INT NOT NULL,
|
80 |
|
81 |
total_user_tries_text TEXT NOT NULL,
|
82 |
+
|
83 |
+
certificate_template TEXT NOT NULL,
|
84 |
|
85 |
quiz_views INT NOT NULL,
|
86 |
|
includes/mlw_quiz_options.php
CHANGED
@@ -18,7 +18,10 @@ function mlw_generate_quiz_options()
|
|
18 |
$hasUpdatedTemplates = false;
|
19 |
$hasDeletedQuestion = false;
|
20 |
$hasUpdatedQuestion = false;
|
|
|
21 |
$mlw_hasResetQuizStats = false;
|
|
|
|
|
22 |
$mlw_qmn_isQueryError = false;
|
23 |
$mlw_qmn_error_code = '0000';
|
24 |
|
@@ -184,7 +187,8 @@ function mlw_generate_quiz_options()
|
|
184 |
{
|
185 |
//Variables for save templates form
|
186 |
$mlw_before_message = $_POST["mlw_quiz_before_message"];
|
187 |
-
$
|
|
|
188 |
$mlw_user_tries_text = $_POST["mlw_quiz_total_user_tries_text"];
|
189 |
$mlw_user_email_template = $_POST["mlw_quiz_user_email_template"];
|
190 |
$mlw_admin_email_template = $_POST["mlw_quiz_admin_email_template"];
|
@@ -199,7 +203,7 @@ function mlw_generate_quiz_options()
|
|
199 |
$mlw_question_answer_template = $_POST["mlw_quiz_question_answer_template"];
|
200 |
$quiz_id = $_POST["quiz_id"];
|
201 |
|
202 |
-
$update = "UPDATE " . $wpdb->prefix . "mlw_quizzes" . " SET message_before='".$mlw_before_message."', message_comment='".$mlw_before_comments."', comment_field_text='".$mlw_comment_field_text."', email_from_text='".$mlw_email_from_text."', question_answer_template='".$mlw_question_answer_template."', submit_button_text='".$mlw_submit_button_text."', name_field_text='".$mlw_name_field_text."', business_field_text='".$mlw_business_field_text."', email_field_text='".$mlw_email_field_text."', phone_field_text='".$mlw_phone_field_text."',
|
203 |
$results = $wpdb->query( $update );
|
204 |
if ($results != false)
|
205 |
{
|
@@ -300,7 +304,133 @@ function mlw_generate_quiz_options()
|
|
300 |
}
|
301 |
}
|
302 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
303 |
|
|
|
304 |
/*
|
305 |
Code For Quiz Tools Tab
|
306 |
*/
|
@@ -334,7 +464,7 @@ function mlw_generate_quiz_options()
|
|
334 |
|
335 |
|
336 |
/*
|
337 |
-
Code
|
338 |
*/
|
339 |
|
340 |
//Load all quiz data
|
@@ -348,6 +478,20 @@ function mlw_generate_quiz_options()
|
|
348 |
break;
|
349 |
}
|
350 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
351 |
?>
|
352 |
<!-- css -->
|
353 |
<link type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/redmond/jquery-ui.css" rel="stylesheet" />
|
@@ -456,6 +600,26 @@ function mlw_generate_quiz_options()
|
|
456 |
return false;
|
457 |
} );
|
458 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
459 |
$j(function() {
|
460 |
$j('#mlw_reset_stats_dialog').dialog({
|
461 |
autoOpen: false,
|
@@ -528,6 +692,9 @@ function mlw_generate_quiz_options()
|
|
528 |
$j(function() {
|
529 |
$j( "#edit_question_type" ).buttonset();
|
530 |
});
|
|
|
|
|
|
|
531 |
$j(function() {
|
532 |
$j( "#edit_comments" ).buttonset();
|
533 |
});
|
@@ -714,6 +881,33 @@ function mlw_generate_quiz_options()
|
|
714 |
<p><span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span>
|
715 |
<strong>Success!</strong> The stats for this quiz has been reset!</p>
|
716 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
717 |
<?php
|
718 |
}
|
719 |
?>
|
@@ -722,8 +916,10 @@ function mlw_generate_quiz_options()
|
|
722 |
<li><a href="#tabs-1">Quiz Questions</a></li>
|
723 |
<li><a href="#tabs-2">Quiz Text</a></li>
|
724 |
<li><a href="#tabs-3">Quiz Options</a></li>
|
725 |
-
<li><a href="#tabs-4">Quiz Leaderboard</a></li>
|
726 |
-
<li><a href="#tabs-5">Quiz
|
|
|
|
|
727 |
</ul>
|
728 |
<div id="tabs-1">
|
729 |
<button id="new_question_button_two">Add Question</button><button id="question_tab_help">Help</button>
|
@@ -1153,6 +1349,7 @@ function mlw_generate_quiz_options()
|
|
1153 |
</tr>
|
1154 |
<tr>
|
1155 |
<td><strong>%TIMER%</strong> - The amount of time user spent of quiz</td>
|
|
|
1156 |
</tr>
|
1157 |
</table>
|
1158 |
<button id="save_template_button" onclick="javascript: document.quiz_template_form.submit();">Save Templates</button><button id="template_tab_help">Help</button>
|
@@ -1185,6 +1382,16 @@ function mlw_generate_quiz_options()
|
|
1185 |
<td><textarea cols="80" rows="15" id="mlw_quiz_before_comments" name="mlw_quiz_before_comments"><?php echo $mlw_quiz_options->message_comment; ?></textarea>
|
1186 |
</td>
|
1187 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1188 |
<tr>
|
1189 |
<td width="30%">
|
1190 |
<strong>Message Displayed After Quiz</strong>
|
@@ -1204,7 +1411,7 @@ function mlw_generate_quiz_options()
|
|
1204 |
<p style="margin: 2px 0">- %QUESTIONS_ANSWERS%</p>
|
1205 |
<p style="margin: 2px 0">- %TIMER%</p>
|
1206 |
</td>
|
1207 |
-
<td
|
1208 |
</td>
|
1209 |
</tr>
|
1210 |
<tr>
|
@@ -1498,6 +1705,199 @@ function mlw_generate_quiz_options()
|
|
1498 |
</form>
|
1499 |
</div>
|
1500 |
<div id="tabs-5">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1501 |
<p>Use this button to reset all the stats collected for this quiz (Quiz Views and Times Quiz Has Been Taken). </p>
|
1502 |
<button id="mlw_reset_stats_button">Reset Quiz Views And Taken Stats</button>
|
1503 |
<div id="mlw_reset_stats_dialog" title="Reset Stats For This Quiz" style="display:none;">
|
@@ -1513,57 +1913,74 @@ function mlw_generate_quiz_options()
|
|
1513 |
</div>
|
1514 |
</div>
|
1515 |
|
|
|
|
|
1516 |
<div id="delete_dialog" title="Delete Question?" style="display:none;">
|
1517 |
-
|
1518 |
-
|
1519 |
-
|
1520 |
-
|
1521 |
-
|
1522 |
-
|
1523 |
-
|
1524 |
-
|
1525 |
-
|
1526 |
</div>
|
|
|
1527 |
<div id="dialog" title="Help" style="display:none;">
|
1528 |
-
|
1529 |
-
|
1530 |
</div>
|
|
|
1531 |
<div id="questions_help_dialog" title="Help" style="display:none;">
|
1532 |
-
|
1533 |
-
|
1534 |
-
|
1535 |
-
|
1536 |
-
|
1537 |
</div>
|
|
|
1538 |
<div id="templates_help_dialog" title="Help" style="display:none;">
|
1539 |
-
|
1540 |
-
|
1541 |
-
|
1542 |
-
|
1543 |
-
|
1544 |
-
|
1545 |
-
|
1546 |
-
|
1547 |
-
|
1548 |
</div>
|
|
|
1549 |
<div id="options_help_dialog" title="Help" style="display:none;">
|
1550 |
-
|
1551 |
-
|
1552 |
-
|
1553 |
-
|
1554 |
-
|
1555 |
-
|
1556 |
-
|
1557 |
-
|
1558 |
-
|
1559 |
-
|
1560 |
-
|
1561 |
-
|
1562 |
</div>
|
|
|
1563 |
<div id="leaderboard_help_dialog" title="Help" style="display:none;">
|
1564 |
-
|
1565 |
-
|
1566 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1567 |
</div>
|
1568 |
|
1569 |
<?php
|
18 |
$hasUpdatedTemplates = false;
|
19 |
$hasDeletedQuestion = false;
|
20 |
$hasUpdatedQuestion = false;
|
21 |
+
$mlw_UpdatedCertificate = false;
|
22 |
$mlw_hasResetQuizStats = false;
|
23 |
+
$mlw_hasAddedLanding = false;
|
24 |
+
$mlw_hasSavedLanding = false;
|
25 |
$mlw_qmn_isQueryError = false;
|
26 |
$mlw_qmn_error_code = '0000';
|
27 |
|
187 |
{
|
188 |
//Variables for save templates form
|
189 |
$mlw_before_message = $_POST["mlw_quiz_before_message"];
|
190 |
+
$mlw_qmn_message_end = $_POST["message_end_template"];
|
191 |
+
//$mlw_after_message = $_POST["mlw_quiz_after_message"];
|
192 |
$mlw_user_tries_text = $_POST["mlw_quiz_total_user_tries_text"];
|
193 |
$mlw_user_email_template = $_POST["mlw_quiz_user_email_template"];
|
194 |
$mlw_admin_email_template = $_POST["mlw_quiz_admin_email_template"];
|
203 |
$mlw_question_answer_template = $_POST["mlw_quiz_question_answer_template"];
|
204 |
$quiz_id = $_POST["quiz_id"];
|
205 |
|
206 |
+
$update = "UPDATE " . $wpdb->prefix . "mlw_quizzes" . " SET message_before='".$mlw_before_message."', message_comment='".$mlw_before_comments."', message_end_template='".$mlw_qmn_message_end."', comment_field_text='".$mlw_comment_field_text."', email_from_text='".$mlw_email_from_text."', question_answer_template='".$mlw_question_answer_template."', submit_button_text='".$mlw_submit_button_text."', name_field_text='".$mlw_name_field_text."', business_field_text='".$mlw_business_field_text."', email_field_text='".$mlw_email_field_text."', phone_field_text='".$mlw_phone_field_text."', user_email_template='".$mlw_user_email_template."', admin_email_template='".$mlw_admin_email_template."', total_user_tries_text='".$mlw_user_tries_text."' WHERE quiz_id=".$quiz_id;
|
207 |
$results = $wpdb->query( $update );
|
208 |
if ($results != false)
|
209 |
{
|
304 |
}
|
305 |
}
|
306 |
|
307 |
+
/*
|
308 |
+
Code For Certificate Tab
|
309 |
+
*/
|
310 |
+
|
311 |
+
//Saved Certificate Options
|
312 |
+
if (isset($_POST["save_certificate_options"]) && $_POST["save_certificate_options"] == "confirmation")
|
313 |
+
{
|
314 |
+
$mlw_certificate_id = intval($_POST["certificate_quiz_id"]);
|
315 |
+
$mlw_certificate_title = $_POST["certificate_title"];
|
316 |
+
$mlw_certificate_text = $_POST["certificate_template"];
|
317 |
+
$mlw_certificate_logo = $_POST["certificate_logo"];
|
318 |
+
$mlw_certificate_background = $_POST["certificate_background"];
|
319 |
+
$mlw_enable_certificates = intval($_POST["enableCertificates"]);
|
320 |
+
$mlw_certificate = array($mlw_certificate_title, $mlw_certificate_text, $mlw_certificate_logo, $mlw_certificate_background, $mlw_enable_certificates);
|
321 |
+
$mlw_certificate_serialized = serialize($mlw_certificate);
|
322 |
+
|
323 |
+
$mlw_certificate_sql_results = $wpdb->query( $wpdb->prepare( "UPDATE " . $wpdb->prefix . "mlw_quizzes SET certificate_template=%s WHERE quiz_id=%d", $mlw_certificate_serialized, $mlw_certificate_id ) );
|
324 |
+
|
325 |
+
|
326 |
+
if ($mlw_certificate_sql_results != false)
|
327 |
+
{
|
328 |
+
$mlw_UpdatedCertificate = true;
|
329 |
+
|
330 |
+
//Insert Action Into Audit Trail
|
331 |
+
global $current_user;
|
332 |
+
get_currentuserinfo();
|
333 |
+
$table_name = $wpdb->prefix . "mlw_qm_audit_trail";
|
334 |
+
$insert = "INSERT INTO " . $table_name .
|
335 |
+
"(trail_id, action_user, action, time) " .
|
336 |
+
"VALUES (NULL , '" . $current_user->display_name . "' , 'Certificate Options Have Been Edited For Quiz Number ".$mlw_certificate_id."' , '" . date("h:i:s A m/d/Y") . "')";
|
337 |
+
$results = $wpdb->query( $insert );
|
338 |
+
}
|
339 |
+
else
|
340 |
+
{
|
341 |
+
$mlw_qmn_isQueryError = true;
|
342 |
+
$mlw_qmn_error_code = '0012';
|
343 |
+
}
|
344 |
+
}
|
345 |
+
|
346 |
+
/*
|
347 |
+
Code For Quiz Landing Page Tab
|
348 |
+
*/
|
349 |
+
|
350 |
+
//Check to add new landing page
|
351 |
+
if (isset($_POST["mlw_add_landing_page"]) && $_POST["mlw_add_landing_page"] == "confirmation")
|
352 |
+
{
|
353 |
+
//Function variables
|
354 |
+
$mlw_qmn_landing_id = intval($_POST["mlw_add_landing_quiz_id"]);
|
355 |
+
$mlw_qmn_message_after = $wpdb->get_var( $wpdb->prepare( "SELECT message_after FROM ".$wpdb->prefix."mlw_quizzes WHERE quiz_id=%d", $mlw_qmn_landing_id ) );
|
356 |
+
//Load message_after and check if it is array already. If not, turn it into one
|
357 |
+
$mlw_qmn_landing_array = @unserialize($mlw_qmn_message_after);
|
358 |
+
if (is_array($mlw_qmn_landing_array))
|
359 |
+
{
|
360 |
+
$mlw_new_landing_array = array(0, 100, 'Enter Your Text Here');
|
361 |
+
array_unshift($mlw_qmn_landing_array , $mlw_new_landing_array);
|
362 |
+
$mlw_qmn_landing_array = serialize($mlw_qmn_landing_array);
|
363 |
+
|
364 |
+
}
|
365 |
+
else
|
366 |
+
{
|
367 |
+
$mlw_qmn_landing_array = array(array(0, 0, $mlw_qmn_message_after));
|
368 |
+
$mlw_new_landing_array = array(0, 100, 'Enter Your Text Here');
|
369 |
+
array_unshift($mlw_qmn_landing_array , $mlw_new_landing_array);
|
370 |
+
$mlw_qmn_landing_array = serialize($mlw_qmn_landing_array);
|
371 |
+
}
|
372 |
+
|
373 |
+
//Update message_after with new array then check to see if worked
|
374 |
+
$mlw_new_landing_results = $wpdb->query( $wpdb->prepare( "UPDATE ".$wpdb->prefix."mlw_quizzes SET message_after=%s WHERE quiz_id=%d", $mlw_qmn_landing_array, $mlw_qmn_landing_id ) );
|
375 |
+
if ($mlw_new_landing_results != false)
|
376 |
+
{
|
377 |
+
$mlw_hasAddedLanding = true;
|
378 |
+
|
379 |
+
//Insert Action Into Audit Trail
|
380 |
+
global $current_user;
|
381 |
+
get_currentuserinfo();
|
382 |
+
$table_name = $wpdb->prefix . "mlw_qm_audit_trail";
|
383 |
+
$insert = "INSERT INTO " . $table_name .
|
384 |
+
"(trail_id, action_user, action, time) " .
|
385 |
+
"VALUES (NULL , '" . $current_user->display_name . "' , 'New Landing Page Has Been Created For Quiz Number ".$mlw_qmn_landing_id."' , '" . date("h:i:s A m/d/Y") . "')";
|
386 |
+
$results = $wpdb->query( $insert );
|
387 |
+
}
|
388 |
+
else
|
389 |
+
{
|
390 |
+
$mlw_qmn_isQueryError = true;
|
391 |
+
$mlw_qmn_error_code = '0013';
|
392 |
+
}
|
393 |
+
}
|
394 |
+
|
395 |
+
//Check to save landing pages
|
396 |
+
if (isset($_POST["mlw_save_landing_pages"]) && $_POST["mlw_save_landing_pages"] == "confirmation")
|
397 |
+
{
|
398 |
+
//Function Variables
|
399 |
+
$mlw_qmn_landing_id = intval($_POST["mlw_landing_quiz_id"]);
|
400 |
+
$mlw_qmn_landing_total = intval($_POST["mlw_landing_page_total"]);
|
401 |
+
|
402 |
+
//Create new array
|
403 |
+
$i = 1;
|
404 |
+
$mlw_qmn_new_landing_array = array();
|
405 |
+
while ($i <= $mlw_qmn_landing_total)
|
406 |
+
{
|
407 |
+
$mlw_qmn_landing_each = array(intval($_POST["message_after_begin_".$i]), intval($_POST["message_after_end_".$i]), $_POST["message_after_".$i]);
|
408 |
+
$mlw_qmn_new_landing_array[] = $mlw_qmn_landing_each;
|
409 |
+
$i++;
|
410 |
+
}
|
411 |
+
$mlw_qmn_new_landing_array = serialize($mlw_qmn_new_landing_array);
|
412 |
+
$mlw_new_landing_results = $wpdb->query( $wpdb->prepare( "UPDATE ".$wpdb->prefix."mlw_quizzes SET message_after=%s WHERE quiz_id=%d", $mlw_qmn_new_landing_array, $mlw_qmn_landing_id ) );
|
413 |
+
if ($mlw_new_landing_results != false)
|
414 |
+
{
|
415 |
+
$mlw_hasSavedLanding = true;
|
416 |
+
|
417 |
+
//Insert Action Into Audit Trail
|
418 |
+
global $current_user;
|
419 |
+
get_currentuserinfo();
|
420 |
+
$table_name = $wpdb->prefix . "mlw_qm_audit_trail";
|
421 |
+
$insert = "INSERT INTO " . $table_name .
|
422 |
+
"(trail_id, action_user, action, time) " .
|
423 |
+
"VALUES (NULL , '" . $current_user->display_name . "' , 'Landing Pages Have Been Saved For Quiz Number ".$mlw_qmn_landing_id."' , '" . date("h:i:s A m/d/Y") . "')";
|
424 |
+
$results = $wpdb->query( $insert );
|
425 |
+
}
|
426 |
+
else
|
427 |
+
{
|
428 |
+
$mlw_qmn_isQueryError = true;
|
429 |
+
$mlw_qmn_error_code = '0014';
|
430 |
+
}
|
431 |
+
}
|
432 |
|
433 |
+
|
434 |
/*
|
435 |
Code For Quiz Tools Tab
|
436 |
*/
|
464 |
|
465 |
|
466 |
/*
|
467 |
+
Code to load entire page
|
468 |
*/
|
469 |
|
470 |
//Load all quiz data
|
478 |
break;
|
479 |
}
|
480 |
}
|
481 |
+
|
482 |
+
//Load Certificate Options Variables
|
483 |
+
$mlw_certificate_options = @unserialize($mlw_quiz_options->certificate_template);
|
484 |
+
if (!is_array($mlw_certificate_options)) {
|
485 |
+
// something went wrong, initialize to empty array
|
486 |
+
$mlw_certificate_options = array('Enter title here', 'Enter text here', '', '', 1);
|
487 |
+
}
|
488 |
+
|
489 |
+
//Load Landing Pages
|
490 |
+
$mlw_message_after_array = @unserialize($mlw_quiz_options->message_after);
|
491 |
+
if (!is_array($mlw_message_after_array)) {
|
492 |
+
// something went wrong, initialize to empty array
|
493 |
+
$mlw_message_after_array = array(array(0, 0, $mlw_quiz_options->message_after));
|
494 |
+
}
|
495 |
?>
|
496 |
<!-- css -->
|
497 |
<link type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/redmond/jquery-ui.css" rel="stylesheet" />
|
600 |
return false;
|
601 |
} );
|
602 |
});
|
603 |
+
|
604 |
+
$j(function() {
|
605 |
+
$j('#landing_page_help_dialog').dialog({
|
606 |
+
autoOpen: false,
|
607 |
+
show: 'blind',
|
608 |
+
width:700,
|
609 |
+
hide: 'explode',
|
610 |
+
buttons: {
|
611 |
+
Ok: function() {
|
612 |
+
$j(this).dialog('close');
|
613 |
+
}
|
614 |
+
}
|
615 |
+
});
|
616 |
+
|
617 |
+
$j('#landing_page_help').click(function() {
|
618 |
+
$j('#landing_page_help_dialog').dialog('open');
|
619 |
+
return false;
|
620 |
+
} );
|
621 |
+
});
|
622 |
+
|
623 |
$j(function() {
|
624 |
$j('#mlw_reset_stats_dialog').dialog({
|
625 |
autoOpen: false,
|
692 |
$j(function() {
|
693 |
$j( "#edit_question_type" ).buttonset();
|
694 |
});
|
695 |
+
$j(function() {
|
696 |
+
$j( "#enableCertificates" ).buttonset();
|
697 |
+
});
|
698 |
$j(function() {
|
699 |
$j( "#edit_comments" ).buttonset();
|
700 |
});
|
881 |
<p><span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span>
|
882 |
<strong>Success!</strong> The stats for this quiz has been reset!</p>
|
883 |
</div>
|
884 |
+
<?php
|
885 |
+
}
|
886 |
+
if ($mlw_hasAddedLanding)
|
887 |
+
{
|
888 |
+
?>
|
889 |
+
<div class="ui-state-highlight ui-corner-all" style="margin-top: 20px; padding: 0 .7em;">
|
890 |
+
<p><span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span>
|
891 |
+
<strong>Success!</strong> A new landing page has been added successfully!</p>
|
892 |
+
</div>
|
893 |
+
<?php
|
894 |
+
}
|
895 |
+
if ($mlw_hasSavedLanding)
|
896 |
+
{
|
897 |
+
?>
|
898 |
+
<div class="ui-state-highlight ui-corner-all" style="margin-top: 20px; padding: 0 .7em;">
|
899 |
+
<p><span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span>
|
900 |
+
<strong>Success!</strong> The landing pages have been saved successfully!</p>
|
901 |
+
</div>
|
902 |
+
<?php
|
903 |
+
}
|
904 |
+
if ($mlw_UpdatedCertificate)
|
905 |
+
{
|
906 |
+
?>
|
907 |
+
<div class="ui-state-highlight ui-corner-all" style="margin-top: 20px; padding: 0 .7em;">
|
908 |
+
<p><span class="ui-icon ui-icon-info" style="float: left; margin-right: .3em;"></span>
|
909 |
+
<strong>Success!</strong> The certificate options have been saved successfully!</p>
|
910 |
+
</div>
|
911 |
<?php
|
912 |
}
|
913 |
?>
|
916 |
<li><a href="#tabs-1">Quiz Questions</a></li>
|
917 |
<li><a href="#tabs-2">Quiz Text</a></li>
|
918 |
<li><a href="#tabs-3">Quiz Options</a></li>
|
919 |
+
<li><a href="#tabs-4">Quiz Leaderboard</a></li>
|
920 |
+
<li><a href="#tabs-5">Quiz Certificate (Beta)</a></li>
|
921 |
+
<li><a href="#tabs-6">Quiz Landing Page</a></li>
|
922 |
+
<li><a href="#tabs-7">Quiz Tools</a></li>
|
923 |
</ul>
|
924 |
<div id="tabs-1">
|
925 |
<button id="new_question_button_two">Add Question</button><button id="question_tab_help">Help</button>
|
1349 |
</tr>
|
1350 |
<tr>
|
1351 |
<td><strong>%TIMER%</strong> - The amount of time user spent of quiz</td>
|
1352 |
+
<td><strong>%CERTIFICATE_LINK%</strong> - The link to the certificate after completing the quiz</td>
|
1353 |
</tr>
|
1354 |
</table>
|
1355 |
<button id="save_template_button" onclick="javascript: document.quiz_template_form.submit();">Save Templates</button><button id="template_tab_help">Help</button>
|
1382 |
<td><textarea cols="80" rows="15" id="mlw_quiz_before_comments" name="mlw_quiz_before_comments"><?php echo $mlw_quiz_options->message_comment; ?></textarea>
|
1383 |
</td>
|
1384 |
</tr>
|
1385 |
+
<tr>
|
1386 |
+
<td width="30%">
|
1387 |
+
<strong>Message Displayed At End Of Quiz (Leave Blank To Omit Text Section)</strong>
|
1388 |
+
<br />
|
1389 |
+
<p>Allowed Variables: </p>
|
1390 |
+
<p style="margin: 2px 0">- %QUIZ_NAME%</p>
|
1391 |
+
</td>
|
1392 |
+
<td><textarea cols="80" rows="15" id="message_end_template" name="message_end_template"><?php echo $mlw_quiz_options->message_end_template; ?></textarea>
|
1393 |
+
</td>
|
1394 |
+
</tr>
|
1395 |
<tr>
|
1396 |
<td width="30%">
|
1397 |
<strong>Message Displayed After Quiz</strong>
|
1411 |
<p style="margin: 2px 0">- %QUESTIONS_ANSWERS%</p>
|
1412 |
<p style="margin: 2px 0">- %TIMER%</p>
|
1413 |
</td>
|
1414 |
+
<td>Now you can have different landing pages based on the user score! This field is now edited on the Quiz Landing Page tab.
|
1415 |
</td>
|
1416 |
</tr>
|
1417 |
<tr>
|
1705 |
</form>
|
1706 |
</div>
|
1707 |
<div id="tabs-5">
|
1708 |
+
<h3>Quiz Certificate (Beta)</h3>
|
1709 |
+
<p>Enter in your text here to fill in the certificate for this quiz. Be sure to enter in the link variable into the templates on the Quiz Text tab so the user can access the certificate.</p>
|
1710 |
+
<p>These fields cannot contain HTML.</p>
|
1711 |
+
<button id="save_certificate_button" onclick="javascript: document.quiz_certificate_options_form.submit();">Save Certificate Options</button>
|
1712 |
+
<?php
|
1713 |
+
echo "<form action='' method='post' name='quiz_certificate_options_form'>";
|
1714 |
+
echo "<input type='hidden' name='save_certificate_options' value='confirmation' />";
|
1715 |
+
echo "<input type='hidden' name='certificate_quiz_id' value='".$quiz_id."' />";
|
1716 |
+
?>
|
1717 |
+
<table class="form-table">
|
1718 |
+
<tr valign="top">
|
1719 |
+
<td><label for="enableCertificates">Enable Certificates For This Quiz?</label></td>
|
1720 |
+
<td><div id="enableCertificates">
|
1721 |
+
<input type="radio" id="radio30" name="enableCertificates" <?php if ($mlw_certificate_options[4] == 0) {echo 'checked="checked"';} ?> value='0' /><label for="radio30">Yes</label>
|
1722 |
+
<input type="radio" id="radio31" name="enableCertificates" <?php if ($mlw_certificate_options[4] == 1) {echo 'checked="checked"';} ?> value='1' /><label for="radio31">No</label>
|
1723 |
+
</div></td>
|
1724 |
+
</tr>
|
1725 |
+
<tr>
|
1726 |
+
<td width="30%">
|
1727 |
+
<strong>Certificate Title</strong>
|
1728 |
+
</td>
|
1729 |
+
<td><textarea cols="80" rows="15" id="certificate_title" name="certificate_title"><?php echo $mlw_certificate_options[0]; ?></textarea>
|
1730 |
+
</td>
|
1731 |
+
</tr>
|
1732 |
+
<tr>
|
1733 |
+
<td width="30%">
|
1734 |
+
<strong>Message Displayed On Certificate</strong>
|
1735 |
+
<br />
|
1736 |
+
<p>Allowed Variables: </p>
|
1737 |
+
<p style="margin: 2px 0">- %POINT_SCORE%</p>
|
1738 |
+
<p style="margin: 2px 0">- %AVERAGE_POINT%</p>
|
1739 |
+
<p style="margin: 2px 0">- %AMOUNT_CORRECT%</p>
|
1740 |
+
<p style="margin: 2px 0">- %TOTAL_QUESTIONS%</p>
|
1741 |
+
<p style="margin: 2px 0">- %CORRECT_SCORE%</p>
|
1742 |
+
<p style="margin: 2px 0">- %QUIZ_NAME%</p>
|
1743 |
+
<p style="margin: 2px 0">- %USER_NAME%</p>
|
1744 |
+
<p style="margin: 2px 0">- %USER_BUSINESS%</p>
|
1745 |
+
<p style="margin: 2px 0">- %USER_PHONE%</p>
|
1746 |
+
<p style="margin: 2px 0">- %USER_EMAIL%</p>
|
1747 |
+
</td>
|
1748 |
+
<td><label for="certificate_template">Allowed tags: <b> - bold, <i>-italics, <u>-underline, <br>-New Line or start a new line by pressing enter</label><textarea cols="80" rows="15" id="certificate_template" name="certificate_template"><?php echo $mlw_certificate_options[1]; ?></textarea>
|
1749 |
+
</td>
|
1750 |
+
</tr>
|
1751 |
+
<tr>
|
1752 |
+
<td width="30%">
|
1753 |
+
<strong>URL To Logo (Must be JPG, JPEG, PNG or GIF)</strong>
|
1754 |
+
</td>
|
1755 |
+
<td><textarea cols="80" rows="15" id="certificate_logo" name="certificate_logo"><?php echo $mlw_certificate_options[2]; ?></textarea>
|
1756 |
+
</td>
|
1757 |
+
</tr>
|
1758 |
+
<tr>
|
1759 |
+
<td width="30%">
|
1760 |
+
<strong>URL To Background Img (Must be JPG, JPEG, PNG or GIF)</strong>
|
1761 |
+
</td>
|
1762 |
+
<td><textarea cols="80" rows="15" id="certificate_background" name="certificate_background"><?php echo $mlw_certificate_options[3]; ?></textarea>
|
1763 |
+
</td>
|
1764 |
+
</tr>
|
1765 |
+
</table>
|
1766 |
+
<button id="save_certificate_button" onclick="javascript: document.quiz_certificate_options_form.submit();">Save Certificate Options</button>
|
1767 |
+
</form>
|
1768 |
+
</div>
|
1769 |
+
<div id="tabs-6">
|
1770 |
+
<h3>Template Variables</h3>
|
1771 |
+
<table class="form-table">
|
1772 |
+
<tr>
|
1773 |
+
<td><strong>%POINT_SCORE%</strong> - Score for the quiz when using points</td>
|
1774 |
+
<td><strong>%AVERAGE_POINT%</strong> - The average amount of points user had per question</td>
|
1775 |
+
</tr>
|
1776 |
+
|
1777 |
+
<tr>
|
1778 |
+
<td><strong>%AMOUNT_CORRECT%</strong> - The number of correct answers the user had</td>
|
1779 |
+
<td><strong>%TOTAL_QUESTIONS%</strong> - The total number of questions in the quiz</td>
|
1780 |
+
</tr>
|
1781 |
+
|
1782 |
+
<tr>
|
1783 |
+
<td><strong>%CORRECT_SCORE%</strong> - Score for the quiz when using correct answers</td>
|
1784 |
+
</tr>
|
1785 |
+
|
1786 |
+
<tr>
|
1787 |
+
<td><strong>%USER_NAME%</strong> - The name the user entered before the quiz</td>
|
1788 |
+
<td><strong>%USER_BUSINESS%</strong> - The business the user entered before the quiz</td>
|
1789 |
+
</tr>
|
1790 |
+
|
1791 |
+
<tr>
|
1792 |
+
<td><strong>%USER_PHONE%</strong> - The phone number the user entered before the quiz</td>
|
1793 |
+
<td><strong>%USER_EMAIL%</strong> - The email the user entered before the quiz</td>
|
1794 |
+
</tr>
|
1795 |
+
|
1796 |
+
<tr>
|
1797 |
+
<td><strong>%QUIZ_NAME%</strong> - The name of the quiz</td>
|
1798 |
+
<td><strong>%QUESTIONS_ANSWERS%</strong> - Shows the question, the answer the user provided, and the correct answer</td>
|
1799 |
+
</tr>
|
1800 |
+
|
1801 |
+
<tr>
|
1802 |
+
<td><strong>%COMMENT_SECTION%</strong> - The comments the user entered into comment box if enabled</td>
|
1803 |
+
<td><strong>%QUESTION%</strong> - The question that the user answered</td>
|
1804 |
+
</tr>
|
1805 |
+
|
1806 |
+
<tr>
|
1807 |
+
<td><strong>%USER_ANSWER%</strong> - The answer the user gave for the question</td>
|
1808 |
+
<td><strong>%CORRECT_ANSWER%</strong> - The correct answer for the question</td>
|
1809 |
+
</tr>
|
1810 |
+
|
1811 |
+
<tr>
|
1812 |
+
<td><strong>%USER_COMMENTS%</strong> - The comments the user provided in the comment field for the question</td>
|
1813 |
+
<td><strong>%CORRECT_ANSWER_INFO%</strong> - Reason why the correct answer is the correct answer</td>
|
1814 |
+
</tr>
|
1815 |
+
<tr>
|
1816 |
+
<td><strong>%TIMER%</strong> - The amount of time user spent of quiz</td>
|
1817 |
+
<td><strong>%CERTIFICATE_LINK%</strong> - The link to the certificate after completing the quiz</td>
|
1818 |
+
</tr>
|
1819 |
+
</table>
|
1820 |
+
<button id="save_landing_button" onclick="javascript: document.mlw_quiz_save_landing_form.submit();">Save Landing Pages</button>
|
1821 |
+
<button id="new_landing_button" onclick="javascript: document.mlw_quiz_add_landing_form.submit();">Add New Landing Page</button>
|
1822 |
+
<button id="landing_page_help">Help</button>
|
1823 |
+
<form method="post" action="" name="mlw_quiz_save_landing_form" style=" display:inline!important;">
|
1824 |
+
<table class="widefat">
|
1825 |
+
<thead>
|
1826 |
+
<tr>
|
1827 |
+
<th>ID</th>
|
1828 |
+
<th>Score Greater Than</th>
|
1829 |
+
<th>Score Less Than</th>
|
1830 |
+
<th>Landing Page Shown</th>
|
1831 |
+
</tr>
|
1832 |
+
</thead>
|
1833 |
+
<tbody>
|
1834 |
+
<?php
|
1835 |
+
$mlw_each_count = 0;
|
1836 |
+
$alternate = "";
|
1837 |
+
foreach($mlw_message_after_array as $mlw_each)
|
1838 |
+
{
|
1839 |
+
if($alternate) $alternate = "";
|
1840 |
+
else $alternate = " class=\"alternate\"";
|
1841 |
+
$mlw_each_count += 1;
|
1842 |
+
if ($mlw_each[0] == 0 && $mlw_each[1] == 0)
|
1843 |
+
{
|
1844 |
+
echo "<tr{$alternate}>";
|
1845 |
+
echo "<td>";
|
1846 |
+
echo "Default";
|
1847 |
+
echo "</td>";
|
1848 |
+
echo "<td>";
|
1849 |
+
echo "<input type='hidden' id='message_after_begin_".$mlw_each_count."' name='message_after_begin_".$mlw_each_count."' value='0'/>-";
|
1850 |
+
echo "</td>";
|
1851 |
+
echo "<td>";
|
1852 |
+
echo "<input type='hidden' id='message_after_end_".$mlw_each_count."' name='message_after_end_".$mlw_each_count."' value='0'/>-";
|
1853 |
+
echo "</td>";
|
1854 |
+
echo "<td>";
|
1855 |
+
echo "<textarea cols='80' rows='15' id='message_after_".$mlw_each_count."' name='message_after_".$mlw_each_count."'>".$mlw_each[2]."</textarea>";
|
1856 |
+
echo "</td>";
|
1857 |
+
echo "</tr>";
|
1858 |
+
break;
|
1859 |
+
}
|
1860 |
+
else
|
1861 |
+
{
|
1862 |
+
echo "<tr{$alternate}>";
|
1863 |
+
echo "<td>";
|
1864 |
+
echo $mlw_each_count;
|
1865 |
+
echo "</td>";
|
1866 |
+
echo "<td>";
|
1867 |
+
echo "<input type='text' id='message_after_begin_".$mlw_each_count."' name='message_after_begin_".$mlw_each_count."' title='What score must the user score better than to see this page' value='".$mlw_each[0]."'/>";
|
1868 |
+
echo "</td>";
|
1869 |
+
echo "<td>";
|
1870 |
+
echo "<input type='text' id='message_after_end_".$mlw_each_count."' name='message_after_end_".$mlw_each_count."' title='What score must the user score worse than to see this page' value='".$mlw_each[1]."' />";
|
1871 |
+
echo "</td>";
|
1872 |
+
echo "<td>";
|
1873 |
+
echo "<textarea cols='80' rows='15' id='message_after_".$mlw_each_count."' title='What text will the user see when reaching this page' name='message_after_".$mlw_each_count."'>".$mlw_each[2]."</textarea>";
|
1874 |
+
echo "</td>";
|
1875 |
+
echo "</tr>";
|
1876 |
+
}
|
1877 |
+
}
|
1878 |
+
?>
|
1879 |
+
</tbody>
|
1880 |
+
<tfoot>
|
1881 |
+
<tr>
|
1882 |
+
<th>ID</th>
|
1883 |
+
<th>Score Greater Than</th>
|
1884 |
+
<th>Score Less Than</th>
|
1885 |
+
<th>Landing Page Shown</th>
|
1886 |
+
</tr>
|
1887 |
+
</tfoot>
|
1888 |
+
</table>
|
1889 |
+
<input type='hidden' name='mlw_save_landing_pages' value='confirmation' />
|
1890 |
+
<input type='hidden' name='mlw_landing_quiz_id' value='<?php echo $quiz_id; ?>' />
|
1891 |
+
<input type='hidden' name='mlw_landing_page_total' value='<?php echo $mlw_each_count; ?>' />
|
1892 |
+
<button id="save_landing_button" onclick="javascript: document.mlw_quiz_save_landing_form.submit();">Save Landing Pages</button>
|
1893 |
+
</form>
|
1894 |
+
<form method="post" action="" name="mlw_quiz_add_landing_form" style=" display:inline!important;">
|
1895 |
+
<input type='hidden' name='mlw_add_landing_page' value='confirmation' />
|
1896 |
+
<input type='hidden' name='mlw_add_landing_quiz_id' value='<?php echo $quiz_id; ?>' />
|
1897 |
+
<button id="new_landing_button" onclick="javascript: document.mlw_quiz_add_landing_form.submit();">Add New Landing Page</button>
|
1898 |
+
</form>
|
1899 |
+
</div>
|
1900 |
+
<div id="tabs-7">
|
1901 |
<p>Use this button to reset all the stats collected for this quiz (Quiz Views and Times Quiz Has Been Taken). </p>
|
1902 |
<button id="mlw_reset_stats_button">Reset Quiz Views And Taken Stats</button>
|
1903 |
<div id="mlw_reset_stats_dialog" title="Reset Stats For This Quiz" style="display:none;">
|
1913 |
</div>
|
1914 |
</div>
|
1915 |
|
1916 |
+
|
1917 |
+
<!--Dialogs-->
|
1918 |
<div id="delete_dialog" title="Delete Question?" style="display:none;">
|
1919 |
+
<h3><b>Are you sure you want to delete Question <span id="delete_question_id"></span>?</b></h3>
|
1920 |
+
<?php
|
1921 |
+
echo "<form action='' method='post'>";
|
1922 |
+
echo "<input type='hidden' name='delete_question' value='confirmation' />";
|
1923 |
+
echo "<input type='hidden' id='question_id' name='question_id' value='' />";
|
1924 |
+
echo "<input type='hidden' name='quiz_id' value='".$quiz_id."' />";
|
1925 |
+
echo "<p class='submit'><input type='submit' class='button-primary' value='Delete Question' /></p>";
|
1926 |
+
echo "</form>";
|
1927 |
+
?>
|
1928 |
</div>
|
1929 |
+
|
1930 |
<div id="dialog" title="Help" style="display:none;">
|
1931 |
+
<h3><b>Help</b></h3>
|
1932 |
+
<p>This page is used edit the questions and options for your quiz. Use the help buttons on each tab for assistance.</p>
|
1933 |
</div>
|
1934 |
+
|
1935 |
<div id="questions_help_dialog" title="Help" style="display:none;">
|
1936 |
+
<p>The question table lists the order the question appears in and the question itself.</p>
|
1937 |
+
<p>To edit a question, use the Edit link below the question.</p>
|
1938 |
+
<p>To add a question, click on the Add Question button. This will open a window for you to add a question. The window will ask for the question and up to 6 answers. If you are using the points system, enter in the amount of points each answer is worth. If you are using the correct system, check the answer that is the correct answer.
|
1939 |
+
You can then choose which style of question you would like by selecting an option for the "Question Type?" option. You can choose if you would like a comment field after the question by selecting an option to the "Comment Field?" question. You can also have a hint displayed to the user. You can then choose the order which the question is
|
1940 |
+
asked by editing the "Question Order" option. Click create question when you are finished.</p>
|
1941 |
</div>
|
1942 |
+
|
1943 |
<div id="templates_help_dialog" title="Help" style="display:none;">
|
1944 |
+
<p>This tab is used to edit the different messages the user and admin may see.</p>
|
1945 |
+
<p>The Message Displayed Before Quiz text is shown to the user at the beginning of the quiz.</p>
|
1946 |
+
<p>The Message Display Before Comment Box is shown to the user right before the section the user can type in comments if that option is enabled.</p>
|
1947 |
+
<p>The Message Displayed After Quiz text is show to the user after the quiz has been taken.</p>
|
1948 |
+
<p>The Email sent to user after completion text is the email that is sent to the user after completing the quiz. (This is only used if you have turned on the option on the options tab.)</p>
|
1949 |
+
<p>The Email sent to admin after completion text is the email that is sent to the admin after the quiz has been completed.</p>
|
1950 |
+
<p>The other templates section is for customizing the text on the submit button as well as the fields where are user can input his or her information.</p>
|
1951 |
+
<p>The %QUESTIONS_ANSWERS% Text area is where you can change the test shown in place of the %QUESTIONS_ANSWERS% variable.</p>
|
1952 |
+
<p>Some templates are able to have variables inside the text. When the quiz is run, these variables will change to their values.</p>
|
1953 |
</div>
|
1954 |
+
|
1955 |
<div id="options_help_dialog" title="Help" style="display:none;">
|
1956 |
+
<p>This tab is used to edit the different options for the quiz.</p>
|
1957 |
+
<p>The system option allows you to have the quiz be graded using a correct/incorrect system or the quiz can have each answer worth different amount of points.</p>
|
1958 |
+
<p>Are the questions random? -> If set to yes, the questions will be random. If set to no, the questions will be shown in the order you have set using the Question Order option.</p>
|
1959 |
+
<p>Would you like to ask for the contact information at the beginning or at the end of the quiz? -> This option will allow you to choose when to ask for contact information if asked.</p>
|
1960 |
+
<p>Should we ask for -> The next four options asks whether you want the quiz to ask for the user's name, business, email, and phone number.</p>
|
1961 |
+
<p>Would you like a place for the user to enter comments? -> If set to yes, a comment section will appear at the end of the quiz for the user to fill out. Customize the text shown above the field by editing
|
1962 |
+
the "Message Display Before Comment Box" field on the "Quiz Text" tab.</p>
|
1963 |
+
<p>Send user email upon completion?-> If set to yes, the user will be sent an email after taking the quiz. To customize the text of the email, edit the "Email sent to user after completion"
|
1964 |
+
field on the "Quiz Text" tab.</p>
|
1965 |
+
<p>Send admin email upon completion? -> If set to yes, the admin will be sent an email when a quiz has been taken. To customize the text of the email, edit the "Email sent to admin after completion"
|
1966 |
+
field on the "Quiz Text" tab.</p>
|
1967 |
+
<p>What email should we send the admin email to? -> This field allows you to set what email address to send the admin emails to.</p>
|
1968 |
</div>
|
1969 |
+
|
1970 |
<div id="leaderboard_help_dialog" title="Help" style="display:none;">
|
1971 |
+
<p>This tab is used to edit the options for the leaderboard for this quiz.</p>
|
1972 |
+
<p>Currently, you can edit the template for the leaderboard.</p>
|
1973 |
+
<p>The template is able to have variables inside the text. When the quiz is run, these variables will change to their values.</p>
|
1974 |
+
</div>
|
1975 |
+
|
1976 |
+
<div id="landing_page_help_dialog" title="Help" style="display: none;">
|
1977 |
+
<h3><b>Help</b></h3>
|
1978 |
+
<p>This page allows you to add, edit, and delete landing pages for your quiz!</p>
|
1979 |
+
<p>You can have unlimited different landing pages to show the user after he or she takes the quiz. For example, you can have a page shown if they pass, and then show the default if they fail.</p>
|
1980 |
+
<p>If you only need the one landing page, leave just the default and edit it and then click the Save button.</p>
|
1981 |
+
<p>To add a new landing page, click Add New Landing Page. A new section will appear with the new page.</p>
|
1982 |
+
<p>For your extra pages, you must designate what score the user must be above and what score the user must be below to see the page. If the user does not fall into any, the default page will be show.</p>
|
1983 |
+
<p>Be sure to save after any changes are made!</p>
|
1984 |
</div>
|
1985 |
|
1986 |
<?php
|
includes/mlw_results_details.php
CHANGED
@@ -12,9 +12,59 @@ function mlw_generate_result_details()
|
|
12 |
if ($mlw_result_id != "")
|
13 |
{
|
14 |
global $wpdb;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
$table_name = $wpdb->prefix . "mlw_results";
|
16 |
$sql = "SELECT quiz_results FROM " . $wpdb->prefix . "mlw_results WHERE result_id=".$mlw_result_id."";
|
17 |
$mlw_results_data = $wpdb->get_results($sql);
|
|
|
18 |
?>
|
19 |
<!-- css -->
|
20 |
<link type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/redmond/jquery-ui.css" rel="stylesheet" />
|
@@ -74,7 +124,15 @@ function mlw_generate_result_details()
|
|
74 |
<div class="wrap">
|
75 |
<div class='mlw_quiz_options'>
|
76 |
<h2>Quiz Results<a id="opener" href="">(?)</a></h2>
|
|
|
|
|
|
|
|
|
77 |
<?php
|
|
|
|
|
|
|
|
|
78 |
foreach($mlw_results_data as $mlw_results_info) {
|
79 |
echo htmlspecialchars_decode($mlw_results_info->quiz_results, ENT_QUOTES);
|
80 |
}
|
12 |
if ($mlw_result_id != "")
|
13 |
{
|
14 |
global $wpdb;
|
15 |
+
|
16 |
+
//Check if user wants to create certificate
|
17 |
+
if (isset($_POST["create_certificate"]) && $_POST["create_certificate"] == "confirmation")
|
18 |
+
{
|
19 |
+
$mlw_certificate_id = intval($_GET["result_id"]);
|
20 |
+
$mlw_quiz_results = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM ".$wpdb->prefix."mlw_results WHERE result_id=%d", $mlw_certificate_id ) );
|
21 |
+
|
22 |
+
$mlw_certificate_results = $wpdb->get_var( $wpdb->prepare( "SELECT certificate_template FROM ".$wpdb->prefix."mlw_quizzes WHERE quiz_id=%d", $mlw_quiz_results->quiz_id ) );
|
23 |
+
|
24 |
+
//Prepare Certificate
|
25 |
+
$mlw_certificate_options = unserialize($mlw_certificate_results);
|
26 |
+
if (!is_array($mlw_certificate_options)) {
|
27 |
+
// something went wrong, initialize to empty array
|
28 |
+
$mlw_certificate_options = array('Enter title here', 'Enter text here', '', '');
|
29 |
+
}
|
30 |
+
$mlw_message_certificate = $mlw_certificate_options[1];
|
31 |
+
$mlw_message_certificate = str_replace( "%POINT_SCORE%" , $mlw_quiz_results->point_score, $mlw_message_certificate);
|
32 |
+
$mlw_message_certificate = str_replace( "%AVERAGE_POINT%" , $mlw_quiz_results->point_score/$mlw_quiz_results->total, $mlw_message_certificate);
|
33 |
+
$mlw_message_certificate = str_replace( "%AMOUNT_CORRECT%" , $mlw_quiz_results->correct, $mlw_message_certificate);
|
34 |
+
$mlw_message_certificate = str_replace( "%TOTAL_QUESTIONS%" , $mlw_quiz_results->total, $mlw_message_certificate);
|
35 |
+
$mlw_message_certificate = str_replace( "%CORRECT_SCORE%" , $mlw_quiz_results->correct_score, $mlw_message_certificate);
|
36 |
+
$mlw_message_certificate = str_replace( "%QUIZ_NAME%" , $mlw_quiz_results->quiz_name, $mlw_message_certificate);
|
37 |
+
$mlw_message_certificate = str_replace( "%USER_NAME%" , $mlw_quiz_results->name, $mlw_message_certificate);
|
38 |
+
$mlw_message_certificate = str_replace( "%USER_BUSINESS%" , $mlw_quiz_results->business, $mlw_message_certificate);
|
39 |
+
$mlw_message_certificate = str_replace( "%USER_PHONE%" , $mlw_quiz_results->email, $mlw_message_certificate);
|
40 |
+
$mlw_message_certificate = str_replace( "%USER_EMAIL%" , $mlw_quiz_results->phone, $mlw_message_certificate);
|
41 |
+
$mlw_message_certificate = str_replace( "\n" , "<br>", $mlw_message_certificate);
|
42 |
+
$mlw_qmn_certifiicate_file = "<?php
|
43 |
+
include(\"".plugin_dir_path( __FILE__ )."WriteHTML.php\");
|
44 |
+
\$pdf = new PDF_HTML();
|
45 |
+
\$pdf->AddPage('L');";
|
46 |
+
$mlw_qmn_certifiicate_file .= $mlw_certificate_options[3] != '' ? "\$pdf->Image('".$mlw_certificate_options[3]."',0,0,\$pdf->w, \$pdf->h);" : '';
|
47 |
+
$mlw_qmn_certifiicate_file .= "\$pdf->Ln(20);
|
48 |
+
\$pdf->SetFont('Arial','B',24);
|
49 |
+
\$pdf->MultiCell(280,20,'".$mlw_certificate_options[0]."', 0, 'C');
|
50 |
+
\$pdf->Ln(15);
|
51 |
+
\$pdf->SetFont('Arial','',16);
|
52 |
+
\$pdf->WriteHTML('<p align=\"center\">".$mlw_message_certificate."</p>');";
|
53 |
+
$mlw_qmn_certifiicate_file .= $mlw_certificate_options[2] != '' ? "\$pdf->Image('".$mlw_certificate_options[2]."',110,130);" : '';
|
54 |
+
$mlw_qmn_certifiicate_file .= "\$pdf->Output('mlw_qmn_certificate.pdf', 'D');
|
55 |
+
unlink(__FILE__);
|
56 |
+
?>";
|
57 |
+
$mlw_qmn_certificate_filename = "../".str_replace(home_url()."/", '', plugin_dir_url( __FILE__ ))."certificates/mlw_qmn_quiz".date("YmdHis")."admin.php";
|
58 |
+
file_put_contents($mlw_qmn_certificate_filename, $mlw_qmn_certifiicate_file);
|
59 |
+
$mlw_qmn_certificate_filename = plugin_dir_url( __FILE__ )."certificates/mlw_qmn_quiz".date("YmdHis")."admin.php";
|
60 |
+
}
|
61 |
+
|
62 |
+
|
63 |
+
//Load Results
|
64 |
$table_name = $wpdb->prefix . "mlw_results";
|
65 |
$sql = "SELECT quiz_results FROM " . $wpdb->prefix . "mlw_results WHERE result_id=".$mlw_result_id."";
|
66 |
$mlw_results_data = $wpdb->get_results($sql);
|
67 |
+
|
68 |
?>
|
69 |
<!-- css -->
|
70 |
<link type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/themes/redmond/jquery-ui.css" rel="stylesheet" />
|
124 |
<div class="wrap">
|
125 |
<div class='mlw_quiz_options'>
|
126 |
<h2>Quiz Results<a id="opener" href="">(?)</a></h2>
|
127 |
+
<form action="" method="post" name="create_certificate_form">
|
128 |
+
<input type="hidden" name="create_certificate" value="confirmation" />
|
129 |
+
<input type="submit" value="Create Certificate" />
|
130 |
+
</form>
|
131 |
<?php
|
132 |
+
if (isset($_POST["create_certificate"]) && $_POST["create_certificate"] == "confirmation")
|
133 |
+
{
|
134 |
+
echo "<a href='".$mlw_qmn_certificate_filename."' style='color: blue;'>Download Certificate Here</a><br />";
|
135 |
+
}
|
136 |
foreach($mlw_results_data as $mlw_results_info) {
|
137 |
echo htmlspecialchars_decode($mlw_results_info->quiz_results, ENT_QUOTES);
|
138 |
}
|
includes/mlw_update.php
CHANGED
@@ -6,7 +6,7 @@ function mlw_quiz_update()
|
|
6 |
{
|
7 |
|
8 |
//Update this variable each update. This is what is checked when the plugin is deciding to run the upgrade script or not.
|
9 |
-
$data = "1.
|
10 |
if ( ! get_option('mlw_quiz_master_version'))
|
11 |
{
|
12 |
add_option('mlw_quiz_master_version' , $data);
|
@@ -114,6 +114,22 @@ function mlw_quiz_update()
|
|
114 |
$results = $wpdb->query( $update_sql );
|
115 |
}
|
116 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
global $wpdb;
|
118 |
$table_name = $wpdb->prefix . "mlw_questions";
|
119 |
//Update 0.5
|
6 |
{
|
7 |
|
8 |
//Update this variable each update. This is what is checked when the plugin is deciding to run the upgrade script or not.
|
9 |
+
$data = "1.8.1";
|
10 |
if ( ! get_option('mlw_quiz_master_version'))
|
11 |
{
|
12 |
add_option('mlw_quiz_master_version' , $data);
|
114 |
$results = $wpdb->query( $update_sql );
|
115 |
}
|
116 |
|
117 |
+
//Update 1.8.1
|
118 |
+
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'message_end_template'") != "message_end_template")
|
119 |
+
{
|
120 |
+
$sql = "ALTER TABLE ".$table_name." ADD message_end_template TEXT NOT NULL AFTER message_comment";
|
121 |
+
$results = $wpdb->query( $sql );
|
122 |
+
$update_sql = "UPDATE ".$table_name." SET message_end_template=''";
|
123 |
+
$results = $wpdb->query( $update_sql );
|
124 |
+
}
|
125 |
+
if($wpdb->get_var("SHOW COLUMNS FROM ".$table_name." LIKE 'certificate_template'") != "certificate_template")
|
126 |
+
{
|
127 |
+
$sql = "ALTER TABLE ".$table_name." ADD certificate_template TEXT NOT NULL AFTER total_user_tries_text";
|
128 |
+
$results = $wpdb->query( $sql );
|
129 |
+
$update_sql = "UPDATE ".$table_name." SET certificate_template='Enter your text here!'";
|
130 |
+
$results = $wpdb->query( $update_sql );
|
131 |
+
}
|
132 |
+
|
133 |
global $wpdb;
|
134 |
$table_name = $wpdb->prefix . "mlw_questions";
|
135 |
//Update 0.5
|
mlw_quizmaster2.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
/*
|
4 |
Plugin Name: Quiz Master Next
|
5 |
Description: Use this plugin to add multiple quizzes, tests, or surveys to your website.
|
6 |
-
Version: 1.
|
7 |
Author: Frank Corso
|
8 |
Author URI: http://www.mylocalwebstop.com/
|
9 |
Plugin URI: http://www.mylocalwebstop.com/
|
@@ -75,7 +75,7 @@ add_action('admin_notices', 'mlw_qmn_notice');
|
|
75 |
function mlw_qmn_notice() {
|
76 |
if ( get_option('mlw_qmn_review_notice') == 1 && current_user_can( 'manage_options' ) ) {
|
77 |
echo '<div class="updated"><p>';
|
78 |
-
printf(__('You have been using the Quiz Master Next plugin for a while now! Thanks for choosing to use this plugin. If it has benefited your website, please consider a <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=RTGYAETX36ZQJ">donation</a
|
79 |
echo "</p></div>";
|
80 |
}
|
81 |
}
|
3 |
/*
|
4 |
Plugin Name: Quiz Master Next
|
5 |
Description: Use this plugin to add multiple quizzes, tests, or surveys to your website.
|
6 |
+
Version: 1.8.1
|
7 |
Author: Frank Corso
|
8 |
Author URI: http://www.mylocalwebstop.com/
|
9 |
Plugin URI: http://www.mylocalwebstop.com/
|
75 |
function mlw_qmn_notice() {
|
76 |
if ( get_option('mlw_qmn_review_notice') == 1 && current_user_can( 'manage_options' ) ) {
|
77 |
echo '<div class="updated"><p>';
|
78 |
+
printf(__('You have been using the Quiz Master Next plugin for a while now! Thanks for choosing to use this plugin. If it has benefited your website, please consider a <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=RTGYAETX36ZQJ">donation</a>, a <a href="http://wordpress.org/support/view/plugin-reviews/quiz-master-next">review</a>, or taking this <a href="http://mylocalwebstop.com/sample-survey/" target="_blank">survey</a>. | <a href="%1$s">Hide Notice</a>'), '?mlw_qmn_ignore_notice=0');
|
79 |
echo "</p></div>";
|
80 |
}
|
81 |
}
|
readme.txt
CHANGED
@@ -4,19 +4,21 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
|
|
4 |
Tags: quiz, test, score, survey, contact, form, email, answer, question
|
5 |
Requires at least: 3.3
|
6 |
Tested up to: 3.8.1
|
7 |
-
Stable tag: 1.
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
10 |
Use this plugin to add multiple quizzes, tests, surveys, or contact forms to your website.
|
11 |
|
12 |
== Description ==
|
13 |
|
14 |
-
Use this plugin to add multiple quizzes, tests, and surveys to your website. This plugin allows for unlimited quizzes each with unlimited amount of questions. The plugin allows you to create the quiz, add it to any page using a customized shortcode, allows the user to take the quiz, and then saves the results.
|
15 |
|
16 |
= Features =
|
17 |
|
18 |
* Allows for Unlimited Quizzes, Tests, Surveys, Contact Forms, etc..
|
19 |
* Allows for Unlimited Questions in each Quiz
|
|
|
|
|
20 |
* Can use HTML for questions
|
21 |
* Can embed Youtube videos in questions
|
22 |
* Can ask for user's contact information at beginning or end of quiz
|
@@ -89,6 +91,19 @@ Feel free to use the widget on the quiz dashboard within the plugin or from the
|
|
89 |
|
90 |
== Changelog ==
|
91 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
92 |
= 1.7.1 (March 6, 2014) =
|
93 |
* Added Several New Widgets To Quiz Dashboard
|
94 |
* Added A Timer Mechanism To Track How Long User Takes On Quiz
|
@@ -327,6 +342,9 @@ Feel free to use the widget on the quiz dashboard within the plugin or from the
|
|
327 |
|
328 |
== Upgrade Notice ==
|
329 |
|
|
|
|
|
|
|
330 |
= 1.7.1 =
|
331 |
This update adds new widgets to Quiz Dashboard, adds a timer mechanism, and fixes several minor bugs.
|
332 |
|
4 |
Tags: quiz, test, score, survey, contact, form, email, answer, question
|
5 |
Requires at least: 3.3
|
6 |
Tested up to: 3.8.1
|
7 |
+
Stable tag: 1.8.1
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
10 |
Use this plugin to add multiple quizzes, tests, surveys, or contact forms to your website.
|
11 |
|
12 |
== Description ==
|
13 |
|
14 |
+
Use this plugin to add multiple quizzes, tests, and surveys to your website. This plugin allows for unlimited quizzes each with unlimited amount of questions. The plugin allows you to create the quiz, add it to any page using a customized shortcode, allows the user to take the quiz, and then saves the results. You can set up what the user sees after he or she takes the quiz based on the user's score. You can also have the plugin create a certificate for the user as well!
|
15 |
|
16 |
= Features =
|
17 |
|
18 |
* Allows for Unlimited Quizzes, Tests, Surveys, Contact Forms, etc..
|
19 |
* Allows for Unlimited Questions in each Quiz
|
20 |
+
* Allows for Unlimited landing pages for each quiz based on the user's score
|
21 |
+
* Allows for you to create certificates for the user
|
22 |
* Can use HTML for questions
|
23 |
* Can embed Youtube videos in questions
|
24 |
* Can ask for user's contact information at beginning or end of quiz
|
91 |
|
92 |
== Changelog ==
|
93 |
|
94 |
+
= 1.8.1 (March 8, 2014) =
|
95 |
+
* Added Customizable Text Section At End Of Quiz
|
96 |
+
* Added Ability To Set Up Different Landing Pages Based On Score
|
97 |
+
* Added Ability To Give Certificate After Quiz
|
98 |
+
* Enhanced Quiz Total Stats Widget
|
99 |
+
* Minor Design Changes To Quiz
|
100 |
+
* Fixed Session_Start Bug
|
101 |
+
* Fixed Division By Zero Bug
|
102 |
+
* Fixed Total Stats Deleted Bug
|
103 |
+
* Fixed Dashboard Rounding Bug
|
104 |
+
* Fixed Notice Unknown Company Field Bug
|
105 |
+
|
106 |
+
|
107 |
= 1.7.1 (March 6, 2014) =
|
108 |
* Added Several New Widgets To Quiz Dashboard
|
109 |
* Added A Timer Mechanism To Track How Long User Takes On Quiz
|
342 |
|
343 |
== Upgrade Notice ==
|
344 |
|
345 |
+
= 1.8.1 =
|
346 |
+
Upgrade to 1.8.1 to get the ability to have different landing pages based on the user's score, give users certificates, and an additional customizable text section at the end of quiz. Plus minor design changes to quiz and Quiz Dashboard and lots of bug fixes.
|
347 |
+
|
348 |
= 1.7.1 =
|
349 |
This update adds new widgets to Quiz Dashboard, adds a timer mechanism, and fixes several minor bugs.
|
350 |
|