Completed
Push — master ( d208aa...25518b )
by Lars
12:37
created
src/Intraface/modules/invoice/CreditNote.php 1 patch
Doc Comments   +14 added lines patch added patch discarded remove patch
@@ -15,6 +15,9 @@  discard block
 block discarded – undo
15 15
         parent::__construct($kernel, 'credit_note', $id);
16 16
     }
17 17
 
18
+    /**
19
+     * @param string $status
20
+     */
18 21
     function setStatus($status)
19 22
     {
20 23
         $return = parent::setStatus($status);
@@ -37,6 +40,9 @@  discard block
 block discarded – undo
37 40
         }
38 41
     }
39 42
 
43
+    /**
44
+     * @return boolean
45
+     */
40 46
     function readyForState($year, $check_products = 'check_products')
41 47
     {
42 48
         if (!is_object($year)) {
@@ -93,6 +99,14 @@  discard block
 block discarded – undo
93 99
         return $return;
94 100
     }
95 101
 
102
+    /**
103
+     * @param Year $year
104
+     * @param integer $voucher_number
105
+     * @param string $voucher_date
106
+     * @param Stub_Translation $translation
107
+     *
108
+     * @return boolean
109
+     */
96 110
     function state($year, $voucher_number, $voucher_date, $translation)
97 111
     {
98 112
         if (!is_object($year)) {
Please login to merge, or discard this patch.
src/Intraface/modules/onlinepayment/OnlinePayment.php 1 patch
Doc Comments   +10 added lines, -3 removed lines patch added patch discarded remove patch
@@ -298,6 +298,10 @@  discard block
 block discarded – undo
298 298
         return $this->id;
299 299
     }
300 300
 
301
+    /**
302
+     * @param string $belong_to
303
+     * @param integer $belong_to_id
304
+     */
301 305
     function changeBelongTo($belong_to, $belong_to_id)
302 306
     {
303 307
         if ($this->id == 0) {
@@ -320,6 +324,9 @@  discard block
 block discarded – undo
320 324
         return $this->id;
321 325
     }
322 326
 
327
+    /**
328
+     * @param string $status
329
+     */
323 330
     function setStatus($status)
324 331
     {
325 332
         if ($this->id == 0) {
@@ -580,7 +587,7 @@  discard block
 block discarded – undo
580 587
     /**
581 588
      * returns the possible status types
582 589
      *
583
-     * @return array with status types
590
+     * @return string[] with status types
584 591
      */
585 592
     static function getStatusTypes()
586 593
     {
@@ -596,7 +603,7 @@  discard block
 block discarded – undo
596 603
     /**
597 604
      * returns possible belong to types
598 605
      *
599
-     * @return array with belong to types
606
+     * @return string[] with belong to types
600 607
      */
601 608
     private function getBelongToTypes()
602 609
     {
@@ -609,7 +616,7 @@  discard block
 block discarded – undo
609 616
     /**
610 617
      * returns the implemented providers
611 618
      *
612
-     * @return array with providers
619
+     * @return string[] with providers
613 620
      */
614 621
     static function getImplementedProviders()
615 622
     {
Please login to merge, or discard this patch.
src/Intraface/User.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
         $this->error       = $this->getError();
86 86
 
87 87
         if (PEAR::isError($this->db)) {
88
-            throw new Exception($this->db->getMessage() . $this->db->getUserInfo());
88
+            throw new Exception($this->db->getMessage().$this->db->getUserInfo());
89 89
         }
90 90
 
91 91
         if ($this->id > 0) {
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
      */
109 109
     protected function load()
110 110
     {
111
-        $result = $this->db->query("SELECT id, email, disabled FROM user WHERE id = " . $this->db->quote($this->id, 'integer'));
111
+        $result = $this->db->query("SELECT id, email, disabled FROM user WHERE id = ".$this->db->quote($this->id, 'integer'));
112 112
 
113 113
         if (PEAR::isError($result)) {
114 114
             throw new Exception($result->getUserInfo());
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
         if (!empty($this->modules[$module])) {
201 201
             return $module_id = $this->modules[$module];
202 202
         } else {
203
-            throw new Exception('user says unknown module ' . $module);
203
+            throw new Exception('user says unknown module '.$module);
204 204
         }
205 205
     }
206 206
 
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
      */
261 261
     public function hasModuleAccess($module, $intranet_id = 0)
262 262
     {
263
-        $filename = PATH_INCLUDE_MODULE . $module . '/Main' . ucfirst($module) . '.php';
263
+        $filename = PATH_INCLUDE_MODULE.$module.'/Main'.ucfirst($module).'.php';
264 264
         if (file_exists($filename)) {
265 265
             require_once $filename;
266 266
             $module_class = 'Main'.ucfirst($module);
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
     {
466 466
         $id = intval($id);
467 467
         if ($this->hasIntranetAccess($id)) {
468
-            $this->db->exec("UPDATE user SET active_intranet_id = ". $this->db->quote($id, 'integer')." WHERE id = ". $this->db->quote($this->get('id'), 'integer'));
468
+            $this->db->exec("UPDATE user SET active_intranet_id = ".$this->db->quote($id, 'integer')." WHERE id = ".$this->db->quote($this->get('id'), 'integer'));
469 469
             return $id;
470 470
         }
471 471
         return false;
@@ -568,7 +568,7 @@  discard block
 block discarded – undo
568 568
         $row = $result->fetchRow(MDB2_FETCHMODE_ASSOC);
569 569
         $new_password = Intraface_Kernel::randomKey(8);
570 570
 
571
-        $db->exec("UPDATE user SET password = '".md5($new_password)."' WHERE id =" . $row['id']);
571
+        $db->exec("UPDATE user SET password = '".md5($new_password)."' WHERE id =".$row['id']);
572 572
 
573 573
         return $new_password;
574 574
     }
@@ -579,7 +579,7 @@  discard block
 block discarded – undo
579 579
             return false;
580 580
         }
581 581
 
582
-        $result = $this->db->query("SELECT * FROM user WHERE password = '".safeToDb(md5($old_password))."' AND id = " . $this->get('id'));
582
+        $result = $this->db->query("SELECT * FROM user WHERE password = '".safeToDb(md5($old_password))."' AND id = ".$this->get('id'));
583 583
         if ($result->numRows() < 1) {
584 584
             $this->error->set('error in old password');
585 585
         }
@@ -595,7 +595,7 @@  discard block
 block discarded – undo
595 595
             return false;
596 596
         }
597 597
 
598
-        $this->db->query("UPDATE user SET password = '".safeToDb(md5($new_password))."' WHERE id = " . $this->get('id'));
598
+        $this->db->query("UPDATE user SET password = '".safeToDb(md5($new_password))."' WHERE id = ".$this->get('id'));
599 599
 
600 600
         return true;
601 601
     }
Please login to merge, or discard this patch.
src/Intraface/modules/cms/Site.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -71,14 +71,14 @@  discard block
 block discarded – undo
71 71
 
72 72
         if ($this->id > 0) {
73 73
             $sql_type = "UPDATE ";
74
-            $sql_end = " WHERE id = " . $this->id;
74
+            $sql_end = " WHERE id = ".$this->id;
75 75
         } else {
76 76
             $sql_type = "INSERT INTO ";
77 77
             $sql_end = " , date_created = NOW()";
78 78
         }
79 79
 
80 80
         $db = new DB_Sql;
81
-        $db->query($sql_type . " cms_site
81
+        $db->query($sql_type." cms_site
82 82
             SET intranet_id = ".$this->kernel->intranet->get('id').",
83 83
             name = '".$var['name']."',
84 84
             url = '".$var['url']."',
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
             $this->id = $db->insertedId();
89 89
         }
90 90
 
91
-        $this->kernel->setting->set('intranet', 'cc_license', intval($var['cc_license']), 'site_id_' . $this->id);
91
+        $this->kernel->setting->set('intranet', 'cc_license', intval($var['cc_license']), 'site_id_'.$this->id);
92 92
 
93 93
         $this->load();
94 94
 
@@ -98,14 +98,14 @@  discard block
 block discarded – undo
98 98
     function load()
99 99
     {
100 100
         $db = new DB_Sql;
101
-        $db->query("SELECT id, name, url FROM cms_site WHERE id = " . $this->id . " AND intranet_id = ".$this->kernel->intranet->get('id')." LIMIT 1");
101
+        $db->query("SELECT id, name, url FROM cms_site WHERE id = ".$this->id." AND intranet_id = ".$this->kernel->intranet->get('id')." LIMIT 1");
102 102
         if (!$db->nextRecord()) {
103 103
             return 0;
104 104
         }
105 105
         $this->value['id'] = $db->f('id');
106 106
         $this->value['name'] = $db->f('name');
107 107
         $this->value['url'] = $db->f('url');
108
-        $this->value['cc_license'] = $this->kernel->setting->get('intranet', 'cc_license', 'site_id_' . $this->get('id'));
108
+        $this->value['cc_license'] = $this->kernel->setting->get('intranet', 'cc_license', 'site_id_'.$this->get('id'));
109 109
     }
110 110
 
111 111
     function delete()
@@ -115,14 +115,14 @@  discard block
 block discarded – undo
115 115
             return 0;
116 116
         }
117 117
         $db = new Db_Sql;
118
-        $db->query("UPDATE cms_site SET active = 0 WHERE intranet_id=".$this->kernel->intranet->get('id')." AND id = " . $this->id);
118
+        $db->query("UPDATE cms_site SET active = 0 WHERE intranet_id=".$this->kernel->intranet->get('id')." AND id = ".$this->id);
119 119
         return 1;
120 120
     }
121 121
 
122 122
     function getList()
123 123
     {
124 124
         $db = new DB_Sql;
125
-        $db->query("SELECT id, name FROM cms_site WHERE intranet_id = " . $this->kernel->intranet->get('id'). " AND active = 1");
125
+        $db->query("SELECT id, name FROM cms_site WHERE intranet_id = ".$this->kernel->intranet->get('id')." AND active = 1");
126 126
         $i = 0;
127 127
         $sites = array();
128 128
         while ($db->nextRecord()) {
Please login to merge, or discard this patch.
src/Intraface/modules/debtor/Controller/ReminderEmail.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -12,14 +12,14 @@  discard block
 block discarded – undo
12 12
 
13 13
     function visit(Reminder $reminder)
14 14
     {
15
-        $this->output .= "Dato: " . $reminder->get("dk_this_date") ."\n\n";
16
-        $this->output .= $reminder->contact->address->get("name") . "\n";
15
+        $this->output .= "Dato: ".$reminder->get("dk_this_date")."\n\n";
16
+        $this->output .= $reminder->contact->address->get("name")."\n";
17 17
         if ($reminder->get("attention_to") != "") {
18 18
             $this->output .= "Att.: ".$reminder->get("attention_to")."\n";
19 19
         }
20
-        $this->output .= $reminder->contact->address->get("address") . "\n";
21
-        $this->output .= $reminder->contact->address->get("postcode") . "  " .  $reminder->contact->address->get("city") ."\n\n";
22
-        $this->output .= $reminder->get("text") . "\n\n";
20
+        $this->output .= $reminder->contact->address->get("address")."\n";
21
+        $this->output .= $reminder->contact->address->get("postcode")."  ".$reminder->contact->address->get("city")."\n\n";
22
+        $this->output .= $reminder->get("text")."\n\n";
23 23
 
24 24
         // Overskrifter - Vareudskrivning
25 25
         $this->output .= "Beskrivelse          Dato        Forfaldsdato    Beløb\n";
@@ -33,24 +33,24 @@  discard block
 block discarded – undo
33 33
             $j++) {
34 34
                 $this->output .= ' ';
35 35
             }
36
-                $this->output .= ' ' . $items[$i]["dk_this_date"];
37
-                $this->output .= '  ' . $items[$i]["dk_due_date"];
38
-                $this->output .= '      ' . number_format($items[$i]["arrears"], 2, ",", ".");
36
+                $this->output .= ' '.$items[$i]["dk_this_date"];
37
+                $this->output .= '  '.$items[$i]["dk_due_date"];
38
+                $this->output .= '      '.number_format($items[$i]["arrears"], 2, ",", ".");
39 39
                 $total += $items[$i]["arrears"];
40 40
         }
41 41
             $items = $reminder->item->getList("reminder");
42 42
         for ($i = 0, $max = count($items); $i < $max; $i++) {
43 43
             $this->output .= "\nTidl. rykkkergebyr  ";
44
-            $this->output .= ' ' . $items[$i]["dk_this_date"];
45
-            $this->output .= '  ' .$items[$i]["dk_due_date"];
46
-            $this->output .= '      ' . number_format($items[$i]["reminder_fee"], 2, ",", ".");
44
+            $this->output .= ' '.$items[$i]["dk_this_date"];
45
+            $this->output .= '  '.$items[$i]["dk_due_date"];
46
+            $this->output .= '      '.number_format($items[$i]["reminder_fee"], 2, ",", ".");
47 47
             $total += $items[$i]["reminder_fee"];
48 48
         }
49 49
         if ($reminder->get("reminder_fee") != 0) {
50 50
             $this->output .= "\nRykkergebyr                                      ".number_format($reminder->get("reminder_fee"), 2, ",", ".");
51 51
             $total += $reminder->get("reminder_fee");
52 52
         }
53
-            $this->output .= "\n\nTotal:                                           " . number_format($total, 2, ",", ".");
53
+            $this->output .= "\n\nTotal:                                           ".number_format($total, 2, ",", ".");
54 54
 
55 55
             $parameter = array(
56 56
                 "contact" => $reminder->contact,
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
                 "amount" => $total,
59 59
                 "due_date" => $reminder->get("dk_due_date"),
60 60
                 "girocode" => $reminder->get("girocode"));
61
-            $this->output .= "\n\nDet skyldige beløb betales senest: " . $parameter['due_date'];
61
+            $this->output .= "\n\nDet skyldige beløb betales senest: ".$parameter['due_date'];
62 62
 
63 63
             // TODO: change to payment_method
64 64
         switch ($reminder->get('payment_method_key')) {
@@ -68,16 +68,16 @@  discard block
 block discarded – undo
68 68
                 $this->output .= "\nBank:                ".$reminder->kernel->setting->get('intranet', 'bank_name');
69 69
                 $this->output .= "\nRegnr.:              ".$reminder->kernel->setting->get('intranet', 'bank_reg_number');
70 70
                 $this->output .= "\nKontonr.:            ".$reminder->kernel->setting->get('intranet', 'bank_account_number');
71
-                $this->output .= "\nBesked til modtager: " . "Kunde #" . $reminder->contact->get("number");
71
+                $this->output .= "\nBesked til modtager: "."Kunde #".$reminder->contact->get("number");
72 72
                 break;
73 73
             case 3:
74 74
                 $this->output .= "\n\nBetaling via homebanking\n+71< ".str_repeat("0", 15 - strlen($parameter["girocode"])).$parameter["girocode"]." +".$this->context->getKernel()->setting->get('intranet', 'giro_account_number')."<";
75 75
                 break;
76 76
         }
77 77
 
78
-            $this->output .= "\n\nMed venlig hilsen\n\n" . $reminder->kernel->user->getAddress()->get("name") . "\n" .$reminder->kernel->intranet->get("name");
79
-            $this->output .= "\n" . $reminder->kernel->intranet->address->get("address");
80
-            $this->output .= "\n" . $reminder->kernel->intranet->address->get("postcode") . "  " . $reminder->kernel->intranet->address->get("city");
78
+            $this->output .= "\n\nMed venlig hilsen\n\n".$reminder->kernel->user->getAddress()->get("name")."\n".$reminder->kernel->intranet->get("name");
79
+            $this->output .= "\n".$reminder->kernel->intranet->address->get("address");
80
+            $this->output .= "\n".$reminder->kernel->intranet->address->get("postcode")."  ".$reminder->kernel->intranet->address->get("city");
81 81
     }
82 82
 
83 83
     public function getText()
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
             throw new Exception('Kontaktpersonen har ikke nogen email');
109 109
         }
110 110
 
111
-        $subject  =     "Påmindelse om betaling";
111
+        $subject = "Påmindelse om betaling";
112 112
 
113 113
         $reminder_text = new Reminder_Text();
114 114
         $reminder_text->visit($reminder);
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
         if ($id = $email->save($var)) {
147 147
             $redirect = new Intraface_Redirect($this->context->getKernel());
148 148
             $shared_email = $this->context->getKernel()->useModule('email');
149
-            $url = $redirect->setDestination($shared_email->getPath().$id . '?edit', NET_SCHME . NET_HOST . $this->context->url());
149
+            $url = $redirect->setDestination($shared_email->getPath().$id.'?edit', NET_SCHME.NET_HOST.$this->context->url());
150 150
             $redirect->setIdentifier('send_email');
151 151
             $redirect->askParameter('send_email_status');
152 152
             return new k_SeeOther($url);
Please login to merge, or discard this patch.
src/Intraface/modules/debtor/Controller/Reminder.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
             }
52 52
         }
53 53
 
54
-        $smarty = $this->template->create(dirname(__FILE__) . '/templates/reminder');
54
+        $smarty = $this->template->create(dirname(__FILE__).'/templates/reminder');
55 55
         return $smarty->render($this);
56 56
     }
57 57
 
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
             $checked_reminder[] = $reminders[$i]["reminder_id"];
83 83
         }
84 84
 
85
-        $smarty = $this->template->create(dirname(__FILE__) . '/templates/reminder-edit');
85
+        $smarty = $this->template->create(dirname(__FILE__).'/templates/reminder-edit');
86 86
         return $smarty->render($this, array('value' => $value, 'checked_invoice' => $checked_invoice, 'checked_reminder' => $checked_reminder));
87 87
     }
88 88
 
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
             throw new Exception('Kontaktpersonen har ikke nogen email');
181 181
         }
182 182
 
183
-        $subject  =     "Påmindelse om betaling";
183
+        $subject = "Påmindelse om betaling";
184 184
 
185 185
         $reminder_text = new Reminder_Text();
186 186
         $reminder_text->visit($reminder);
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
         if ($id = $email->save($var)) {
219 219
             $redirect = new Intraface_Redirect($this->getKernel());
220 220
             $shared_email = $this->getKernel()->useModule('email');
221
-            $url = $redirect->setDestination($shared_email->getPath() . $id . '?edit', NET_SCHEME . NET_HOST . $this->url());
221
+            $url = $redirect->setDestination($shared_email->getPath().$id.'?edit', NET_SCHEME.NET_HOST.$this->url());
222 222
             $redirect->setIdentifier('send_email');
223 223
             $redirect->askParameter('send_email_status');
224 224
             return new k_SeeOther($url);
@@ -265,14 +265,14 @@  discard block
 block discarded – undo
265 265
 
266 266
     function visit(Reminder $reminder)
267 267
     {
268
-        $this->output .= "Dato: " . $reminder->get("dk_this_date") ."\n\n";
269
-        $this->output .= $reminder->contact->address->get("name") . "\n";
268
+        $this->output .= "Dato: ".$reminder->get("dk_this_date")."\n\n";
269
+        $this->output .= $reminder->contact->address->get("name")."\n";
270 270
         if ($reminder->get("attention_to") != "") {
271 271
             $this->output .= "Att.: ".$reminder->get("attention_to")."\n";
272 272
         }
273
-        $this->output .= $reminder->contact->address->get("address") . "\n";
274
-        $this->output .= $reminder->contact->address->get("postcode") . "  " .  $reminder->contact->address->get("city") ."\n\n";
275
-        $this->output .= $reminder->get("text") . "\n\n";
273
+        $this->output .= $reminder->contact->address->get("address")."\n";
274
+        $this->output .= $reminder->contact->address->get("postcode")."  ".$reminder->contact->address->get("city")."\n\n";
275
+        $this->output .= $reminder->get("text")."\n\n";
276 276
 
277 277
         // Overskrifter - Vareudskrivning
278 278
         $this->output .= "Beskrivelse          Dato        Forfaldsdato    Bel�b\n";
@@ -286,24 +286,24 @@  discard block
 block discarded – undo
286 286
             $j++) {
287 287
                 $this->output .= ' ';
288 288
             }
289
-                $this->output .= ' ' . $items[$i]["dk_this_date"];
290
-                $this->output .= '  ' . $items[$i]["dk_due_date"];
291
-                $this->output .= '      ' . number_format($items[$i]["arrears"], 2, ",", ".");
289
+                $this->output .= ' '.$items[$i]["dk_this_date"];
290
+                $this->output .= '  '.$items[$i]["dk_due_date"];
291
+                $this->output .= '      '.number_format($items[$i]["arrears"], 2, ",", ".");
292 292
                 $total += $items[$i]["arrears"];
293 293
         }
294 294
             $items = $reminder->item->getList("reminder");
295 295
         for ($i = 0, $max = count($items); $i < $max; $i++) {
296 296
             $this->output .= "\nTidl. rykkkergebyr  ";
297
-            $this->output .= ' ' . $items[$i]["dk_this_date"];
298
-            $this->output .= '  ' .$items[$i]["dk_due_date"];
299
-            $this->output .= '      ' . number_format($items[$i]["reminder_fee"], 2, ",", ".");
297
+            $this->output .= ' '.$items[$i]["dk_this_date"];
298
+            $this->output .= '  '.$items[$i]["dk_due_date"];
299
+            $this->output .= '      '.number_format($items[$i]["reminder_fee"], 2, ",", ".");
300 300
             $total += $items[$i]["reminder_fee"];
301 301
         }
302 302
         if ($reminder->get("reminder_fee") != 0) {
303 303
             $this->output .= "\nRykkergebyr                                      ".number_format($reminder->get("reminder_fee"), 2, ",", ".");
304 304
             $total += $reminder->get("reminder_fee");
305 305
         }
306
-            $this->output .= "\n\nTotal:                                           " . number_format($total, 2, ",", ".");
306
+            $this->output .= "\n\nTotal:                                           ".number_format($total, 2, ",", ".");
307 307
 
308 308
             $parameter = array(
309 309
                 "contact" => $reminder->contact,
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
                 "amount" => $total,
312 312
                 "due_date" => $reminder->get("dk_due_date"),
313 313
                 "girocode" => $reminder->get("girocode"));
314
-            $this->output .= "\n\nDet skyldige beløb betales senest: " . $parameter['due_date'];
314
+            $this->output .= "\n\nDet skyldige beløb betales senest: ".$parameter['due_date'];
315 315
 
316 316
             // TODO: change to payment_method
317 317
         switch ($reminder->get('payment_method_key')) {
@@ -321,16 +321,16 @@  discard block
 block discarded – undo
321 321
                 $this->output .= "\nBank:                ".$reminder->kernel->setting->get('intranet', 'bank_name');
322 322
                 $this->output .= "\nRegnr.:              ".$reminder->kernel->setting->get('intranet', 'bank_reg_number');
323 323
                 $this->output .= "\nKontonr.:            ".$reminder->kernel->setting->get('intranet', 'bank_account_number');
324
-                $this->output .= "\nBesked til modtager: " . "Kunde #" . $reminder->contact->get("number");
324
+                $this->output .= "\nBesked til modtager: "."Kunde #".$reminder->contact->get("number");
325 325
                 break;
326 326
             case 3:
327 327
                 $this->output .= "\n\nBetaling via homebanking\n+71< ".str_repeat("0", 15 - strlen($parameter["girocode"])).$parameter["girocode"]." +".$kernel->setting->get('intranet', 'giro_account_number')."<";
328 328
                 break;
329 329
         }
330 330
 
331
-            $this->output .= "\n\nMed venlig hilsen\n\n" . $reminder->kernel->user->getAddress()->get("name") . "\n" .$reminder->kernel->intranet->get("name");
332
-            $this->output .= "\n" . $reminder->kernel->intranet->address->get("address");
333
-            $this->output .= "\n" . $reminder->kernel->intranet->address->get("postcode") . "  " . $reminder->kernel->intranet->address->get("city");
331
+            $this->output .= "\n\nMed venlig hilsen\n\n".$reminder->kernel->user->getAddress()->get("name")."\n".$reminder->kernel->intranet->get("name");
332
+            $this->output .= "\n".$reminder->kernel->intranet->address->get("address");
333
+            $this->output .= "\n".$reminder->kernel->intranet->address->get("postcode")."  ".$reminder->kernel->intranet->address->get("city");
334 334
     }
335 335
 
336 336
     public function getText()
Please login to merge, or discard this patch.
src/Intraface/modules/contact/ContactReminder.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
             throw new Exception('Could not save information in ContactReminder->update' . $result->getUserInfo());
225 225
             return false;
226 226
         }
227
-         return $this->id;
227
+            return $this->id;
228 228
     }
229 229
 
230 230
     /**
@@ -244,8 +244,8 @@  discard block
 block discarded – undo
244 244
             throw new Exception('Could not postphone reminder' . $result->getUserInfo());
245 245
             return false;
246 246
         }
247
-         $this->load();
248
-         return true;
247
+            $this->load();
248
+            return true;
249 249
     }
250 250
 
251 251
     /**
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
         if ($result->numRows() == 0) {
278 278
             return array();
279 279
         }
280
-         return $result->fetchAll(MDB2_FETCHMODE_ASSOC);
280
+            return $result->fetchAll(MDB2_FETCHMODE_ASSOC);
281 281
     }
282 282
 
283 283
     /**
@@ -295,8 +295,8 @@  discard block
 block discarded – undo
295 295
             throw new Exception('Could not postphone reminder' . $result->getUserInfo());
296 296
             return false;
297 297
         }
298
-         $this->load();
299
-         return true;
298
+            $this->load();
299
+            return true;
300 300
     }
301 301
 
302 302
     public function getDBQuery()
Please login to merge, or discard this patch.
src/Intraface/LegacyCpdf.php 1 patch
Spacing   +665 added lines, -665 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
      *
58 58
      * @var integer
59 59
      */
60
-    private $numObj=0;
60
+    private $numObj = 0;
61 61
 
62 62
     /**
63 63
       * this array contains all of the pdf objects, ready for final assembly
@@ -143,21 +143,21 @@  discard block
 block discarded – undo
143 143
       *
144 144
       * @var string
145 145
       */
146
-    private $currentFont='';
146
+    private $currentFont = '';
147 147
 
148 148
     /**
149 149
      * the current base font
150 150
      *
151 151
      * @var string
152 152
      */
153
-    private $currentBaseFont='';
153
+    private $currentBaseFont = '';
154 154
 
155 155
     /**
156 156
       * the number of the current font within the font array
157 157
       *
158 158
       * @var integer
159 159
       */
160
-    private $currentFontNum=0;
160
+    private $currentFontNum = 0;
161 161
 
162 162
     /**
163 163
      * @var integer
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
     /**
195 195
       * current style that lines are drawn in
196 196
       */
197
-    private $currentLineStyle='';
197
+    private $currentLineStyle = '';
198 198
 
199 199
     /**
200 200
       * an array which is used to save the state of the document, mainly the colours and styles
@@ -210,46 +210,46 @@  discard block
 block discarded – undo
210 210
     /**
211 211
      * number of page objects within the document
212 212
      */
213
-    private $numPages=0;
213
+    private $numPages = 0;
214 214
 
215 215
     /**
216 216
      * object Id storage stack
217 217
      */
218
-    private $stack=array();
218
+    private $stack = array();
219 219
 
220 220
     /**
221 221
      * number of elements within the object Id storage stack
222 222
      */
223
-    private $nStack=0;
223
+    private $nStack = 0;
224 224
 
225 225
     /**
226 226
      * an array which contains information about the objects which are not firmly attached to pages
227 227
      * these have been added with the addObject function
228 228
      */
229
-    private $looseObjects=array();
229
+    private $looseObjects = array();
230 230
 
231 231
     /**
232 232
      * array contains infomation about how the loose objects are to be added to the document
233 233
      */
234
-    private $addLooseObjects=array();
234
+    private $addLooseObjects = array();
235 235
 
236 236
     /**
237 237
       * the objectId of the information object for the document
238 238
       * this contains authorship, title etc.
239 239
       */
240
-    private $infoObject=0;
240
+    private $infoObject = 0;
241 241
 
242 242
     /**
243 243
       * number of images being tracked within the document
244 244
       */
245
-    private $numImages=0;
245
+    private $numImages = 0;
246 246
 
247 247
     /**
248 248
       * some additional options while generation
249 249
       * currently used for compression only
250 250
       * Default: 'compression' => -1 which will set gzcompress to the default level of 6
251 251
       */
252
-    public $options=array('compression'=>-1);
252
+    public $options = array('compression'=>-1);
253 253
 
254 254
     /**
255 255
       * the objectId of the first page of the document
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
       * used to track the last used value of the inter-word spacing, this is so that it is known
261 261
       * when the spacing is changed.
262 262
       */
263
-    private $wordSpaceAdjust=0;
263
+    private $wordSpaceAdjust = 0;
264 264
 
265 265
     /**
266 266
       * track if the current font is bolded or italicised
@@ -270,29 +270,29 @@  discard block
 block discarded – undo
270 270
     /**
271 271
      * messages are stored here during processing, these can be selected afterwards to give some useful debug information
272 272
      */
273
-    public $messages='';
273
+    public $messages = '';
274 274
 
275 275
     /**
276 276
      * the ancryption array for the document encryption is stored here
277 277
      */
278
-    private $arc4='';
278
+    private $arc4 = '';
279 279
 
280 280
     /**
281 281
      * the object Id of the encryption information
282 282
      */
283
-    private $arc4_objnum=0;
283
+    private $arc4_objnum = 0;
284 284
 
285 285
     /**
286 286
      * the file identifier, used to uniquely identify a pdf document
287 287
      */
288
-    public $fileIdentifier='';
288
+    public $fileIdentifier = '';
289 289
 
290 290
     /**
291 291
      * a flag to say if a document is to be encrypted or not
292 292
      *
293 293
      * @var boolean
294 294
      */
295
-    private $encrypted=0;
295
+    private $encrypted = 0;
296 296
 
297 297
     /**
298 298
      * Set the encryption mode
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
      *
306 306
      * @var string
307 307
      */
308
-    private $encryptionKey='';
308
+    private $encryptionKey = '';
309 309
     
310 310
     /*
311 311
      * encryption padding fetched from the Adobe PDF reference
@@ -387,32 +387,32 @@  discard block
 block discarded – undo
387 387
      */
388 388
     private function o_destination($id, $action, $options = '')
389 389
     {
390
-        if ($action!='new') {
391
-            $o =& $this->objects[$id];
390
+        if ($action != 'new') {
391
+            $o = & $this->objects[$id];
392 392
         }
393 393
         switch ($action) {
394 394
             case 'new':
395
-                 $this->objects[$id]=array('t'=>'destination','info'=>array());
395
+                 $this->objects[$id] = array('t'=>'destination', 'info'=>array());
396 396
                  $tmp = '';
397 397
                 switch ($options['type']) {
398 398
                     case 'XYZ':
399 399
                     case 'FitR':
400
-                        $tmp =  ' '.$options['p3'].$tmp;
400
+                        $tmp = ' '.$options['p3'].$tmp;
401 401
                     case 'FitH':
402 402
                     case 'FitV':
403 403
                     case 'FitBH':
404 404
                     case 'FitBV':
405
-                        $tmp =  ' '.$options['p1'].' '.$options['p2'].$tmp;
405
+                        $tmp = ' '.$options['p1'].' '.$options['p2'].$tmp;
406 406
                     case 'Fit':
407 407
                     case 'FitB':
408
-                        $tmp =  $options['type'].$tmp;
409
-                        $this->objects[$id]['info']['string']=$tmp;
410
-                        $this->objects[$id]['info']['page']=$options['page'];
408
+                        $tmp = $options['type'].$tmp;
409
+                        $this->objects[$id]['info']['string'] = $tmp;
410
+                        $this->objects[$id]['info']['page'] = $options['page'];
411 411
                 }
412 412
                 break;
413 413
             case 'out':
414 414
                 $tmp = $o['info'];
415
-                $res="\n".$id." 0 obj\n".'['.$tmp['page'].' 0 R /'.$tmp['string']."]\nendobj";
415
+                $res = "\n".$id." 0 obj\n".'['.$tmp['page'].' 0 R /'.$tmp['string']."]\nendobj";
416 416
                 return $res;
417 417
                 break;
418 418
         }
@@ -424,12 +424,12 @@  discard block
 block discarded – undo
424 424
      */
425 425
     private function o_viewerPreferences($id, $action, $options = '')
426 426
     {
427
-        if ($action!='new') {
428
-            $o =& $this->objects[$id];
427
+        if ($action != 'new') {
428
+            $o = & $this->objects[$id];
429 429
         }
430 430
         switch ($action) {
431 431
             case 'new':
432
-                $this->objects[$id]=array('t'=>'viewerPreferences','info'=>array());
432
+                $this->objects[$id] = array('t'=>'viewerPreferences', 'info'=>array());
433 433
                 break;
434 434
             case 'add':
435 435
                 foreach ($options as $k => $v) {
@@ -442,17 +442,17 @@  discard block
 block discarded – undo
442 442
                         case 'DisplayDocTitle':
443 443
                         case 'NonFullScreenPageMode':
444 444
                         case 'Direction':
445
-                            $o['info'][$k]=$v;
445
+                            $o['info'][$k] = $v;
446 446
                             break;
447 447
                     }
448 448
                 }
449 449
                 break;
450 450
             case 'out':
451
-                $res="\n".$id." 0 obj\n".'<< ';
451
+                $res = "\n".$id." 0 obj\n".'<< ';
452 452
                 foreach ($o['info'] as $k => $v) {
453
-                    $res.="\n/".$k.' '.$v;
453
+                    $res .= "\n/".$k.' '.$v;
454 454
                 }
455
-                $res.="\n>>\n";
455
+                $res .= "\n>>\n";
456 456
                 return $res;
457 457
                 break;
458 458
         }
@@ -464,47 +464,47 @@  discard block
 block discarded – undo
464 464
      */
465 465
     private function o_catalog($id, $action, $options = '')
466 466
     {
467
-        if ($action!='new') {
468
-            $o =& $this->objects[$id];
467
+        if ($action != 'new') {
468
+            $o = & $this->objects[$id];
469 469
         }
470 470
         switch ($action) {
471 471
             case 'new':
472
-                $this->objects[$id]=array('t'=>'catalog','info'=>array());
473
-                $this->catalogId=$id;
472
+                $this->objects[$id] = array('t'=>'catalog', 'info'=>array());
473
+                $this->catalogId = $id;
474 474
                 break;
475 475
             case 'outlines':
476 476
             case 'pages':
477 477
             case 'openHere':
478
-                $o['info'][$action]=$options;
478
+                $o['info'][$action] = $options;
479 479
                 break;
480 480
             case 'viewerPreferences':
481 481
                 if (!isset($o['info']['viewerPreferences'])) {
482 482
                     $this->numObj++;
483 483
                     $this->o_viewerPreferences($this->numObj, 'new');
484
-                    $o['info']['viewerPreferences']=$this->numObj;
484
+                    $o['info']['viewerPreferences'] = $this->numObj;
485 485
                 }
486 486
                 $vp = $o['info']['viewerPreferences'];
487 487
                 $this->o_viewerPreferences($vp, 'add', $options);
488 488
                 break;
489 489
             case 'out':
490
-                $res="\n".$id." 0 obj\n".'<< /Type /Catalog';
490
+                $res = "\n".$id." 0 obj\n".'<< /Type /Catalog';
491 491
                 foreach ($o['info'] as $k => $v) {
492 492
                     switch ($k) {
493 493
                         case 'outlines':
494
-                            $res.=' /Outlines '.$v.' 0 R';
494
+                            $res .= ' /Outlines '.$v.' 0 R';
495 495
                             break;
496 496
                         case 'pages':
497
-                            $res.=' /Pages '.$v.' 0 R';
497
+                            $res .= ' /Pages '.$v.' 0 R';
498 498
                             break;
499 499
                         case 'viewerPreferences':
500
-                            $res.=' /ViewerPreferences '.$o['info']['viewerPreferences'].' 0 R';
500
+                            $res .= ' /ViewerPreferences '.$o['info']['viewerPreferences'].' 0 R';
501 501
                             break;
502 502
                         case 'openHere':
503
-                            $res.=' /OpenAction '.$o['info']['openHere'].' 0 R';
503
+                            $res .= ' /OpenAction '.$o['info']['openHere'].' 0 R';
504 504
                             break;
505 505
                     }
506 506
                 }
507
-                $res.=" >>\nendobj";
507
+                $res .= " >>\nendobj";
508 508
                 return $res;
509 509
                 break;
510 510
         }
@@ -516,93 +516,93 @@  discard block
 block discarded – undo
516 516
      */
517 517
     private function o_pages($id, $action, $options = '')
518 518
     {
519
-        if ($action!='new') {
520
-            $o =& $this->objects[$id];
519
+        if ($action != 'new') {
520
+            $o = & $this->objects[$id];
521 521
         }
522 522
         switch ($action) {
523 523
             case 'new':
524
-                $this->objects[$id]=array('t'=>'pages','info'=>array());
524
+                $this->objects[$id] = array('t'=>'pages', 'info'=>array());
525 525
                 $this->o_catalog($this->catalogId, 'pages', $id);
526 526
                 break;
527 527
             case 'page':
528 528
                 if (!is_array($options)) {
529 529
                     // then it will just be the id of the new page
530
-                    $o['info']['pages'][]=$options;
530
+                    $o['info']['pages'][] = $options;
531 531
                 } else {
532 532
                     // then it should be an array having 'id','rid','pos', where rid=the page to which this one will be placed relative
533 533
                     // and pos is either 'before' or 'after', saying where this page will fit.
534 534
                     if (isset($options['id']) && isset($options['rid']) && isset($options['pos'])) {
535 535
                         $i = array_search($options['rid'], $o['info']['pages']);
536
-                        if (isset($o['info']['pages'][$i]) && $o['info']['pages'][$i]==$options['rid']) {
536
+                        if (isset($o['info']['pages'][$i]) && $o['info']['pages'][$i] == $options['rid']) {
537 537
                             // then there is a match make a space
538 538
                             switch ($options['pos']) {
539 539
                                 case 'before':
540 540
                                     $k = $i;
541 541
                                     break;
542 542
                                 case 'after':
543
-                                    $k=$i+1;
543
+                                    $k = $i + 1;
544 544
                                     break;
545 545
                                 default:
546
-                                    $k=-1;
546
+                                    $k = -1;
547 547
                                     break;
548 548
                             }
549
-                            if ($k>=0) {
550
-                                for ($j=count($o['info']['pages'])-1; $j>=$k; $j--) {
551
-                                    $o['info']['pages'][$j+1]=$o['info']['pages'][$j];
549
+                            if ($k >= 0) {
550
+                                for ($j = count($o['info']['pages']) - 1; $j >= $k; $j--) {
551
+                                    $o['info']['pages'][$j + 1] = $o['info']['pages'][$j];
552 552
                                 }
553
-                                $o['info']['pages'][$k]=$options['id'];
553
+                                $o['info']['pages'][$k] = $options['id'];
554 554
                             }
555 555
                         }
556 556
                     }
557 557
                 }
558 558
                 break;
559 559
             case 'procset':
560
-                $o['info']['procset']=$options;
560
+                $o['info']['procset'] = $options;
561 561
                 break;
562 562
             case 'mediaBox':
563
-                $o['info']['mediaBox']=$options; // which should be an array of 4 numbers
563
+                $o['info']['mediaBox'] = $options; // which should be an array of 4 numbers
564 564
                 break;
565 565
             case 'font':
566
-                $o['info']['fonts'][]=array('objNum'=>$options['objNum'],'fontNum'=>$options['fontNum']);
566
+                $o['info']['fonts'][] = array('objNum'=>$options['objNum'], 'fontNum'=>$options['fontNum']);
567 567
                 break;
568 568
             case 'xObject':
569
-                $o['info']['xObjects'][]=array('objNum'=>$options['objNum'],'label'=>$options['label']);
569
+                $o['info']['xObjects'][] = array('objNum'=>$options['objNum'], 'label'=>$options['label']);
570 570
                 break;
571 571
             case 'out':
572 572
                 if (count($o['info']['pages'])) {
573
-                    $res="\n".$id." 0 obj\n<< /Type /Pages /Kids [";
573
+                    $res = "\n".$id." 0 obj\n<< /Type /Pages /Kids [";
574 574
                     foreach ($o['info']['pages'] as $k => $v) {
575
-                        $res.=$v." 0 R ";
575
+                        $res .= $v." 0 R ";
576 576
                     }
577
-                    $res.="] /Count ".count($this->objects[$id]['info']['pages']);
577
+                    $res .= "] /Count ".count($this->objects[$id]['info']['pages']);
578 578
                     if ((isset($o['info']['fonts']) && count($o['info']['fonts'])) || isset($o['info']['procset'])) {
579
-                        $res.=" /Resources <<";
579
+                        $res .= " /Resources <<";
580 580
                         if (isset($o['info']['procset'])) {
581
-                            $res.=" /ProcSet ".$o['info']['procset'];
581
+                            $res .= " /ProcSet ".$o['info']['procset'];
582 582
                         }
583 583
                         if (isset($o['info']['fonts']) && count($o['info']['fonts'])) {
584
-                            $res.=" /Font << ";
584
+                            $res .= " /Font << ";
585 585
                             foreach ($o['info']['fonts'] as $finfo) {
586
-                                $res.=" /F".$finfo['fontNum']." ".$finfo['objNum']." 0 R";
586
+                                $res .= " /F".$finfo['fontNum']." ".$finfo['objNum']." 0 R";
587 587
                             }
588
-                            $res.=" >>";
588
+                            $res .= " >>";
589 589
                         }
590 590
                         if (isset($o['info']['xObjects']) && count($o['info']['xObjects'])) {
591
-                            $res.=" /XObject << ";
591
+                            $res .= " /XObject << ";
592 592
                             foreach ($o['info']['xObjects'] as $finfo) {
593
-                                $res.=" /".$finfo['label']." ".$finfo['objNum']." 0 R";
593
+                                $res .= " /".$finfo['label']." ".$finfo['objNum']." 0 R";
594 594
                             }
595
-                            $res.=" >>";
595
+                            $res .= " >>";
596 596
                         }
597
-                        $res.=" >>";
597
+                        $res .= " >>";
598 598
                         if (isset($o['info']['mediaBox'])) {
599
-                            $tmp=$o['info']['mediaBox'];
600
-                            $res.=" /MediaBox [".sprintf('%.3F', $tmp[0]).' '.sprintf('%.3F', $tmp[1]).' '.sprintf('%.3F', $tmp[2]).' '.sprintf('%.3F', $tmp[3]).']';
599
+                            $tmp = $o['info']['mediaBox'];
600
+                            $res .= " /MediaBox [".sprintf('%.3F', $tmp[0]).' '.sprintf('%.3F', $tmp[1]).' '.sprintf('%.3F', $tmp[2]).' '.sprintf('%.3F', $tmp[3]).']';
601 601
                         }
602 602
                     }
603
-                    $res.=" >>\nendobj";
603
+                    $res .= " >>\nendobj";
604 604
                 } else {
605
-                    $res="\n".$id." 0 obj\n<< /Type /Pages\n/Count 0\n>>\nendobj";
605
+                    $res = "\n".$id." 0 obj\n<< /Type /Pages\n/Count 0\n>>\nendobj";
606 606
                 }
607 607
                 return $res;
608 608
                 break;
@@ -617,14 +617,14 @@  discard block
 block discarded – undo
617 617
     {
618 618
         switch ($action) {
619 619
             case 'new':
620
-                $this->objects[$id]=array('t'=>'redirect','data'=>$options['data'],'info'=>array());
621
-                $this->o_pages($this->currentNode, 'xObject', array('label'=>$options['label'],'objNum'=>$id));
620
+                $this->objects[$id] = array('t'=>'redirect', 'data'=>$options['data'], 'info'=>array());
621
+                $this->o_pages($this->currentNode, 'xObject', array('label'=>$options['label'], 'objNum'=>$id));
622 622
                 break;
623 623
             case 'out':
624
-                $o =& $this->objects[$id];
625
-                $tmp=$o['data'];
626
-                $res= "\n".$id." 0 obj\n<<";
627
-                $res.="/R".$o['data']." ".$o['data']." 0 R>>\nendobj";
624
+                $o = & $this->objects[$id];
625
+                $tmp = $o['data'];
626
+                $res = "\n".$id." 0 obj\n<<";
627
+                $res .= "/R".$o['data']." ".$o['data']." 0 R>>\nendobj";
628 628
                 return $res;
629 629
                 break;
630 630
         }
@@ -636,26 +636,26 @@  discard block
 block discarded – undo
636 636
      */
637 637
     private function o_outlines($id, $action, $options = '')
638 638
     {
639
-        if ($action!='new') {
640
-            $o =& $this->objects[$id];
639
+        if ($action != 'new') {
640
+            $o = & $this->objects[$id];
641 641
         }
642 642
         switch ($action) {
643 643
             case 'new':
644
-                $this->objects[$id]=array('t'=>'outlines','info'=>array('outlines'=>array()));
644
+                $this->objects[$id] = array('t'=>'outlines', 'info'=>array('outlines'=>array()));
645 645
                 $this->o_catalog($this->catalogId, 'outlines', $id);
646 646
                 break;
647 647
             case 'outline':
648
-                $o['info']['outlines'][]=$options;
648
+                $o['info']['outlines'][] = $options;
649 649
                 break;
650 650
             case 'out':
651 651
                 if (count($o['info']['outlines'])) {
652
-                    $res="\n".$id." 0 obj\n<< /Type /Outlines /Kids [";
652
+                    $res = "\n".$id." 0 obj\n<< /Type /Outlines /Kids [";
653 653
                     foreach ($o['info']['outlines'] as $k => $v) {
654
-                        $res.=$v." 0 R ";
654
+                        $res .= $v." 0 R ";
655 655
                     }
656
-                    $res.="] /Count ".count($o['info']['outlines'])." >>\nendobj";
656
+                    $res .= "] /Count ".count($o['info']['outlines'])." >>\nendobj";
657 657
                 } else {
658
-                    $res="\n".$id." 0 obj\n<< /Type /Outlines /Count 0 >>\nendobj";
658
+                    $res = "\n".$id." 0 obj\n<< /Type /Outlines /Count 0 >>\nendobj";
659 659
                 }
660 660
                 return $res;
661 661
                 break;
@@ -668,36 +668,36 @@  discard block
 block discarded – undo
668 668
      */
669 669
     private function o_font($id, $action, $options = '')
670 670
     {
671
-        if ($action!='new') {
672
-            $o =& $this->objects[$id];
671
+        if ($action != 'new') {
672
+            $o = & $this->objects[$id];
673 673
         }
674 674
         switch ($action) {
675 675
             case 'new':
676
-                $this->objects[$id]=array('t'=>'font','info'=>array('name'=>$options['name'], 'fontFileName' => $options['fontFileName'],'SubType'=>'Type1'));
677
-                $fontNum=$this->numFonts;
678
-                $this->objects[$id]['info']['fontNum']=$fontNum;
676
+                $this->objects[$id] = array('t'=>'font', 'info'=>array('name'=>$options['name'], 'fontFileName' => $options['fontFileName'], 'SubType'=>'Type1'));
677
+                $fontNum = $this->numFonts;
678
+                $this->objects[$id]['info']['fontNum'] = $fontNum;
679 679
                 // deal with the encoding and the differences
680 680
                 if (isset($options['differences'])) {
681 681
                     // then we'll need an encoding dictionary
682 682
                     $this->numObj++;
683 683
                     $this->o_fontEncoding($this->numObj, 'new', $options);
684
-                    $this->objects[$id]['info']['encodingDictionary']=$this->numObj;
684
+                    $this->objects[$id]['info']['encodingDictionary'] = $this->numObj;
685 685
                 } elseif (isset($options['encoding'])) {
686 686
                     // we can specify encoding here
687 687
                     switch ($options['encoding']) {
688 688
                         case 'WinAnsiEncoding':
689 689
                         case 'MacRomanEncoding':
690 690
                         case 'MacExpertEncoding':
691
-                            $this->objects[$id]['info']['encoding']=$options['encoding'];
691
+                            $this->objects[$id]['info']['encoding'] = $options['encoding'];
692 692
                             break;
693 693
                         case 'none':
694 694
                             break;
695 695
                         default:
696
-                            $this->objects[$id]['info']['encoding']='WinAnsiEncoding';
696
+                            $this->objects[$id]['info']['encoding'] = 'WinAnsiEncoding';
697 697
                             break;
698 698
                     }
699 699
                 } else {
700
-                    $this->objects[$id]['info']['encoding']='WinAnsiEncoding';
700
+                    $this->objects[$id]['info']['encoding'] = 'WinAnsiEncoding';
701 701
                 }
702 702
                 
703 703
                 if ($this->fonts[$options['fontFileName']]['isUnicode']) {
@@ -714,8 +714,8 @@  discard block
 block discarded – undo
714 714
 
715 715
                     $stream = "/CIDInit /ProcSet findresource begin\n12 dict begin\nbegincmap\n/CIDSystemInfo <</Registry (Adobe) /Ordering (UCS) /Supplement 0 >> def\n/CMapName /Adobe-Identity-UCS def\n/CMapType 2 def\n1 begincodespacerange\n<0000> <FFFF>\nendcodespacerange\n1 beginbfrange\n<0000> <FFFF> <0000>\nendbfrange\nendcmap\nCMapName currentdict /CMap defineresource pop\nend\nend\n";
716 716
 
717
-                    $res = "<</Length " . mb_strlen($stream, '8bit') . " >>\n";
718
-                    $res .= "stream\n" . $stream . "\nendstream";
717
+                    $res = "<</Length ".mb_strlen($stream, '8bit')." >>\n";
718
+                    $res .= "stream\n".$stream."\nendstream";
719 719
 
720 720
                     $this->objects[$toUnicodeId]['c'] = $res;
721 721
 
@@ -724,7 +724,7 @@  discard block
 block discarded – undo
724 724
                     $this->objects[$id]['info']['cidFont'] = $cidFontId;
725 725
                 }
726 726
                 // also tell the pages node about the new font
727
-                $this->o_pages($this->currentNode, 'font', array('fontNum'=>$fontNum,'objNum'=>$id));
727
+                $this->o_pages($this->currentNode, 'font', array('fontNum'=>$fontNum, 'objNum'=>$id));
728 728
                 break;
729 729
             case 'add':
730 730
                 foreach ($options as $k => $v) {
@@ -757,8 +757,8 @@  discard block
 block discarded – undo
757 757
                         $pfbid = $this->objects[$o['info']['FontDescriptor']]['info']['FontFile2'];
758 758
                         // if subsetting is set
759 759
                         if ($this->fonts[$o['info']['fontFileName']]['isSubset'] && !empty($this->fonts[$o['info']['fontFileName']]['subset'])) {
760
-                            $this->debug('subset font for ' . $o['info']['fontFileName'], E_USER_NOTICE);
761
-                            $subsetFontName = "AAAAAD+" . $o['info']['name'];
760
+                            $this->debug('subset font for '.$o['info']['fontFileName'], E_USER_NOTICE);
761
+                            $subsetFontName = "AAAAAD+".$o['info']['name'];
762 762
                             $o['info']['name'] = $subsetFontName;
763 763
                             // find descendant font
764 764
                             $this->objects[$o['info']['cidFont']]['info']['name'] = $subsetFontName;
@@ -770,7 +770,7 @@  discard block
 block discarded – undo
770 770
                             // combine all used characters as string
771 771
                             $s = implode('', array_keys($this->fonts[$o['info']['fontFileName']]['subset']));
772 772
                             // submit the string to TTFsubset class to return the subset (as binary)
773
-                            $data = $t->doSubset($o['info']['fontFileName'] . '.ttf', $s, null);
773
+                            $data = $t->doSubset($o['info']['fontFileName'].'.ttf', $s, null);
774 774
                             // $data is the new (subset) of the font font
775 775
                             //file_put_contents($o['info']['name'] . '.ttf', $data);
776 776
                             
@@ -783,22 +783,22 @@  discard block
 block discarded – undo
783 783
                             }
784 784
                             $cidwidth = $newcidwidth;
785 785
                         } else {
786
-                            $data = file_get_contents($o['info']['fontFileName']. '.ttf');
786
+                            $data = file_get_contents($o['info']['fontFileName'].'.ttf');
787 787
                         }
788 788
                     
789 789
                         // TODO: cache the subset
790 790
                         
791 791
                         $l1 = strlen($data);
792
-                        $this->objects[$pfbid]['c'].= $data;
792
+                        $this->objects[$pfbid]['c'] .= $data;
793 793
                         $this->o_contents($pfbid, 'add', array('Length1'=>$l1));
794 794
                     } elseif (isset($this->objects[$o['info']['FontDescriptor']]['info']['FontFile'])) {
795 795
                         // find FontFile id - used for PFB fonts
796 796
                         $pfbid = $this->objects[$o['info']['FontDescriptor']]['info']['FontFile'];
797
-                        $data = file_get_contents($o['info']['fontFileName']. '.pfb');
798
-                        $l1 = strpos($data, 'eexec')+6;
799
-                        $l2 = strpos($data, '00000000')-$l1;
800
-                        $l3 = strlen($data)-$l2-$l1;
801
-                        $this->o_contents($pfbid, 'add', array('Length1'=>$l1,'Length2'=>$l2,'Length3'=>$l3));
797
+                        $data = file_get_contents($o['info']['fontFileName'].'.pfb');
798
+                        $l1 = strpos($data, 'eexec') + 6;
799
+                        $l2 = strpos($data, '00000000') - $l1;
800
+                        $l3 = strlen($data) - $l2 - $l1;
801
+                        $this->o_contents($pfbid, 'add', array('Length1'=>$l1, 'Length2'=>$l2, 'Length3'=>$l3));
802 802
                     } else {
803 803
                         $this->debug("Failed to select the correct font program", E_USER_WARNING);
804 804
                     }
@@ -816,32 +816,32 @@  discard block
 block discarded – undo
816 816
                     $res = "\n$id 0 obj\n<</Type /Font /Subtype /Type0 /BaseFont /".$o['info']['name']."";
817 817
                     // The horizontal identity mapping for 2-byte CIDs; may be used
818 818
                     // with CIDFonts using any Registry, Ordering, and Supplement values.
819
-                       $res.= " /Encoding /Identity-H /DescendantFonts [".$o['info']['cidFont']." 0 R] /ToUnicode ".$o['info']['toUnicode']." 0 R >>\n";
820
-                    $res.= "endobj";
819
+                       $res .= " /Encoding /Identity-H /DescendantFonts [".$o['info']['cidFont']." 0 R] /ToUnicode ".$o['info']['toUnicode']." 0 R >>\n";
820
+                    $res .= "endobj";
821 821
                 } else {
822
-                    $res="\n".$id." 0 obj\n<< /Type /Font /Subtype /".$o['info']['SubType']." ";
823
-                    $res.="/Name /F".$o['info']['fontNum']." ";
824
-                    $res.="/BaseFont /".$o['info']['name']." ";
822
+                    $res = "\n".$id." 0 obj\n<< /Type /Font /Subtype /".$o['info']['SubType']." ";
823
+                    $res .= "/Name /F".$o['info']['fontNum']." ";
824
+                    $res .= "/BaseFont /".$o['info']['name']." ";
825 825
                     if (isset($o['info']['encodingDictionary'])) {
826 826
                         // then place a reference to the dictionary
827
-                        $res.="/Encoding ".$o['info']['encodingDictionary']." 0 R ";
827
+                        $res .= "/Encoding ".$o['info']['encodingDictionary']." 0 R ";
828 828
                     } elseif (isset($o['info']['encoding'])) {
829 829
                         // use the specified encoding
830
-                        $res.="/Encoding /".$o['info']['encoding']." ";
830
+                        $res .= "/Encoding /".$o['info']['encoding']." ";
831 831
                     }
832 832
                     if (isset($o['info']['FirstChar'])) {
833
-                        $res.="/FirstChar ".$o['info']['FirstChar']." ";
833
+                        $res .= "/FirstChar ".$o['info']['FirstChar']." ";
834 834
                     }
835 835
                     if (isset($o['info']['LastChar'])) {
836
-                        $res.="/LastChar ".$o['info']['LastChar']." ";
836
+                        $res .= "/LastChar ".$o['info']['LastChar']." ";
837 837
                     }
838 838
                     if (isset($o['info']['Widths'])) {
839
-                        $res.="/Widths ".$o['info']['Widths']." 0 R ";
839
+                        $res .= "/Widths ".$o['info']['Widths']." 0 R ";
840 840
                     }
841 841
                     if (isset($o['info']['FontDescriptor'])) {
842
-                        $res.="/FontDescriptor ".$o['info']['FontDescriptor']." 0 R ";
842
+                        $res .= "/FontDescriptor ".$o['info']['FontDescriptor']." 0 R ";
843 843
                     }
844
-                    $res.=">>\nendobj";
844
+                    $res .= ">>\nendobj";
845 845
                 }
846 846
                 return $res;
847 847
                 break;
@@ -854,15 +854,15 @@  discard block
 block discarded – undo
854 854
      */
855 855
     private function o_fontDescriptor($id, $action, $options = '')
856 856
     {
857
-        if ($action!='new') {
858
-            $o =& $this->objects[$id];
857
+        if ($action != 'new') {
858
+            $o = & $this->objects[$id];
859 859
         }
860 860
         switch ($action) {
861 861
             case 'new':
862
-                $this->objects[$id]=array('t'=>'fontDescriptor','info'=>$options);
862
+                $this->objects[$id] = array('t'=>'fontDescriptor', 'info'=>$options);
863 863
                 break;
864 864
             case 'out':
865
-                $res="\n".$id." 0 obj\n<< /Type /FontDescriptor ";
865
+                $res = "\n".$id." 0 obj\n<< /Type /FontDescriptor ";
866 866
                 foreach ($o['info'] as $label => $value) {
867 867
                     switch ($label) {
868 868
                         case 'Ascent':
@@ -879,23 +879,23 @@  discard block
 block discarded – undo
879 879
                         case 'XHeight':
880 880
                         case 'CharSet':
881 881
                             if (strlen($value)) {
882
-                                $res.='/'.$label.' '.$value." ";
882
+                                $res .= '/'.$label.' '.$value." ";
883 883
                             }
884 884
                             break;
885 885
                         case 'FontFile':
886 886
                         case 'FontFile2':
887 887
                         case 'FontFile3':
888
-                            $res.='/'.$label.' '.$value." 0 R ";
888
+                            $res .= '/'.$label.' '.$value." 0 R ";
889 889
                             break;
890 890
                         case 'FontBBox':
891
-                            $res.='/'.$label.' ['.$value[0].' '.$value[1].' '.$value[2].' '.$value[3]."] ";
891
+                            $res .= '/'.$label.' ['.$value[0].' '.$value[1].' '.$value[2].' '.$value[3]."] ";
892 892
                             break;
893 893
                         case 'FontName':
894
-                            $res.='/'.$label.' /'.$value." ";
894
+                            $res .= '/'.$label.' /'.$value." ";
895 895
                             break;
896 896
                     }
897 897
                 }
898
-                $res.=">>\nendobj";
898
+                $res .= ">>\nendobj";
899 899
                 return $res;
900 900
                 break;
901 901
         }
@@ -907,34 +907,34 @@  discard block
 block discarded – undo
907 907
      */
908 908
     private function o_fontEncoding($id, $action, $options = '')
909 909
     {
910
-        if ($action!='new') {
911
-            $o =& $this->objects[$id];
910
+        if ($action != 'new') {
911
+            $o = & $this->objects[$id];
912 912
         }
913 913
         switch ($action) {
914 914
             case 'new':
915 915
                 // the options array should contain 'differences' and maybe 'encoding'
916
-                $this->objects[$id]=array('t'=>'fontEncoding','info'=>$options);
916
+                $this->objects[$id] = array('t'=>'fontEncoding', 'info'=>$options);
917 917
                 break;
918 918
             case 'out':
919
-                $res="\n".$id." 0 obj\n<< /Type /Encoding ";
919
+                $res = "\n".$id." 0 obj\n<< /Type /Encoding ";
920 920
                 if (!isset($o['info']['encoding'])) {
921
-                    $o['info']['encoding']='WinAnsiEncoding';
921
+                    $o['info']['encoding'] = 'WinAnsiEncoding';
922 922
                 }
923
-                if ($o['info']['encoding']!='none') {
924
-                    $res.="/BaseEncoding /".$o['info']['encoding']." ";
923
+                if ($o['info']['encoding'] != 'none') {
924
+                    $res .= "/BaseEncoding /".$o['info']['encoding']." ";
925 925
                 }
926
-                $res.="/Differences [";
927
-                $onum=-100;
926
+                $res .= "/Differences [";
927
+                $onum = -100;
928 928
                 foreach ($o['info']['differences'] as $num => $label) {
929
-                    if ($num!=$onum+1) {
929
+                    if ($num != $onum + 1) {
930 930
                         // we cannot make use of consecutive numbering
931
-                        $res.= " ".$num." /".$label;
931
+                        $res .= " ".$num." /".$label;
932 932
                     } else {
933
-                        $res.= " /".$label;
933
+                        $res .= " /".$label;
934 934
                     }
935
-                    $onum=$num;
935
+                    $onum = $num;
936 936
                 }
937
-                $res.="] >>\nendobj";
937
+                $res .= "] >>\nendobj";
938 938
                 return $res;
939 939
                 break;
940 940
         }
@@ -987,13 +987,13 @@  discard block
 block discarded – undo
987 987
 
988 988
             case 'out':
989 989
                   $res = "\n$id 0 obj\n";
990
-                  $res.= "<</Type /Font /Subtype /CIDFontType2 /BaseFont /".$o['info']['name']." /CIDSystemInfo << /Registry (Adobe) /Ordering (Identity) /Supplement 0 >>";
990
+                  $res .= "<</Type /Font /Subtype /CIDFontType2 /BaseFont /".$o['info']['name']." /CIDSystemInfo << /Registry (Adobe) /Ordering (Identity) /Supplement 0 >>";
991 991
                 if (isset($o['info']['FontDescriptor'])) {
992
-                    $res.= " /FontDescriptor ".$o['info']['FontDescriptor']." 0 R";
992
+                    $res .= " /FontDescriptor ".$o['info']['FontDescriptor']." 0 R";
993 993
                 }
994 994
 
995 995
                 if (isset($o['info']['MissingWidth'])) {
996
-                    $res.= " /DW ".$o['info']['MissingWidth']."";
996
+                    $res .= " /DW ".$o['info']['MissingWidth']."";
997 997
                 }
998 998
 
999 999
                 if (isset($o['info']['fontFileName']) && isset($this->fonts[$o['info']['fontFileName']]['CIDWidths'])) {
@@ -1002,14 +1002,14 @@  discard block
 block discarded – undo
1002 1002
                     foreach ($cid_widths as $cid => $width) {
1003 1003
                         $w .= "$cid [$width] ";
1004 1004
                     }
1005
-                    $res.= " /W [$w]";
1005
+                    $res .= " /W [$w]";
1006 1006
                 }
1007 1007
           
1008 1008
                 if ($this->embedFont) {
1009
-                      $res.= " /CIDToGIDMap ".$o['info']['cidToGidMap']." 0 R";
1009
+                      $res .= " /CIDToGIDMap ".$o['info']['cidToGidMap']." 0 R";
1010 1010
                 }
1011
-                  $res.= "  >>\n";
1012
-                  $res.= "endobj";
1011
+                  $res .= "  >>\n";
1012
+                  $res .= "endobj";
1013 1013
 
1014 1014
                 return $res;
1015 1015
         }
@@ -1036,19 +1036,19 @@  discard block
 block discarded – undo
1036 1036
                   $tmp = $this->fonts[$fontFileName]['CIDtoGID'] = base64_decode($this->fonts[$fontFileName]['CIDtoGID']);
1037 1037
           
1038 1038
                 if (isset($o['raw'])) {
1039
-                    $res.= $tmp;
1039
+                    $res .= $tmp;
1040 1040
                 } else {
1041
-                    $res.= "<<";
1041
+                    $res .= "<<";
1042 1042
                     if (function_exists('gzcompress') && $this->options['compression']) {
1043 1043
                         // then implement ZLIB based compression on this content stream
1044 1044
                         $tmp = gzcompress($tmp, $this->options['compression']);
1045
-                        $res.= " /Filter /FlateDecode";
1045
+                        $res .= " /Filter /FlateDecode";
1046 1046
                     }
1047 1047
             
1048
-                    $res.= " /Length ".mb_strlen($tmp, '8bit') .">>\nstream\n$tmp\nendstream";
1048
+                    $res .= " /Length ".mb_strlen($tmp, '8bit').">>\nstream\n$tmp\nendstream";
1049 1049
                 }
1050 1050
 
1051
-                  $res.= "\nendobj";
1051
+                  $res .= "\nendobj";
1052 1052
                 return $res;
1053 1053
         }
1054 1054
     }
@@ -1059,14 +1059,14 @@  discard block
 block discarded – undo
1059 1059
      */
1060 1060
     private function o_info($id, $action, $options = '')
1061 1061
     {
1062
-        if ($action!='new') {
1063
-            $o =& $this->objects[$id];
1062
+        if ($action != 'new') {
1063
+            $o = & $this->objects[$id];
1064 1064
         }
1065 1065
         switch ($action) {
1066 1066
             case 'new':
1067
-                $this->infoObject=$id;
1068
-                $date='D:'.date('Ymd');
1069
-                $this->objects[$id]=array('t'=>'info','info'=>array('Creator'=>'R and OS php pdf writer, http://www.ros.co.nz','CreationDate'=>$date));
1067
+                $this->infoObject = $id;
1068
+                $date = 'D:'.date('Ymd');
1069
+                $this->objects[$id] = array('t'=>'info', 'info'=>array('Creator'=>'R and OS php pdf writer, http://www.ros.co.nz', 'CreationDate'=>$date));
1070 1070
                 break;
1071 1071
             case 'Title':
1072 1072
             case 'Author':
@@ -1077,23 +1077,23 @@  discard block
 block discarded – undo
1077 1077
             case 'CreationDate':
1078 1078
             case 'ModDate':
1079 1079
             case 'Trapped':
1080
-                $o['info'][$action]=$options;
1080
+                $o['info'][$action] = $options;
1081 1081
                 break;
1082 1082
             case 'out':
1083 1083
                 if ($this->encrypted) {
1084 1084
                     $this->encryptInit($id);
1085 1085
                 }
1086
-                $res="\n".$id." 0 obj\n<< ";
1086
+                $res = "\n".$id." 0 obj\n<< ";
1087 1087
                 foreach ($o['info'] as $k => $v) {
1088
-                    $res.='/'.$k.' (';
1088
+                    $res .= '/'.$k.' (';
1089 1089
                     if ($this->encrypted) {
1090
-                        $res.=$this->filterText($this->ARC4($v), true, false);
1090
+                        $res .= $this->filterText($this->ARC4($v), true, false);
1091 1091
                     } else {
1092
-                        $res.=$this->filterText($v, true, false);
1092
+                        $res .= $this->filterText($v, true, false);
1093 1093
                     }
1094
-                    $res.=") ";
1094
+                    $res .= ") ";
1095 1095
                 }
1096
-                $res.=">>\nendobj";
1096
+                $res .= ">>\nendobj";
1097 1097
                 return $res;
1098 1098
             break;
1099 1099
         }
@@ -1105,39 +1105,39 @@  discard block
 block discarded – undo
1105 1105
      */
1106 1106
     private function o_action($id, $action, $options = '')
1107 1107
     {
1108
-        if ($action!='new') {
1109
-            $o =& $this->objects[$id];
1108
+        if ($action != 'new') {
1109
+            $o = & $this->objects[$id];
1110 1110
         }
1111 1111
         switch ($action) {
1112 1112
             case 'new':
1113 1113
                 if (is_array($options)) {
1114
-                    $this->objects[$id]=array('t'=>'action','info'=>$options,'type'=>$options['type']);
1114
+                    $this->objects[$id] = array('t'=>'action', 'info'=>$options, 'type'=>$options['type']);
1115 1115
                 } else {
1116 1116
                     // then assume a URI action
1117
-                    $this->objects[$id]=array('t'=>'action','info'=>$options,'type'=>'URI');
1117
+                    $this->objects[$id] = array('t'=>'action', 'info'=>$options, 'type'=>'URI');
1118 1118
                 }
1119 1119
                 break;
1120 1120
             case 'out':
1121 1121
                 if ($this->encrypted) {
1122 1122
                     $this->encryptInit($id);
1123 1123
                 }
1124
-                $res="\n".$id." 0 obj\n<< /Type /Action";
1124
+                $res = "\n".$id." 0 obj\n<< /Type /Action";
1125 1125
                 switch ($o['type']) {
1126 1126
                     case 'ilink':
1127 1127
                         // there will be an 'label' setting, this is the name of the destination
1128
-                        $res.=" /S /GoTo /D ".$this->destinations[(string)$o['info']['label']]." 0 R";
1128
+                        $res .= " /S /GoTo /D ".$this->destinations[(string)$o['info']['label']]." 0 R";
1129 1129
                         break;
1130 1130
                     case 'URI':
1131
-                        $res.=" /S /URI /URI (";
1131
+                        $res .= " /S /URI /URI (";
1132 1132
                         if ($this->encrypted) {
1133
-                            $res.=$this->filterText($this->ARC4($o['info']), true, false);
1133
+                            $res .= $this->filterText($this->ARC4($o['info']), true, false);
1134 1134
                         } else {
1135
-                            $res.=$this->filterText($o['info'], true, false);
1135
+                            $res .= $this->filterText($o['info'], true, false);
1136 1136
                         }
1137
-                            $res.=")";
1137
+                            $res .= ")";
1138 1138
                         break;
1139 1139
                 }
1140
-                $res.=" >>\nendobj";
1140
+                $res .= " >>\nendobj";
1141 1141
                 return $res;
1142 1142
             break;
1143 1143
         }
@@ -1150,8 +1150,8 @@  discard block
 block discarded – undo
1150 1150
      */
1151 1151
     private function o_annotation($id, $action, $options = '')
1152 1152
     {
1153
-        if ($action!='new') {
1154
-            $o =& $this->objects[$id];
1153
+        if ($action != 'new') {
1154
+            $o = & $this->objects[$id];
1155 1155
         }
1156 1156
         switch ($action) {
1157 1157
             case 'new':
@@ -1161,38 +1161,38 @@  discard block
 block discarded – undo
1161 1161
                 // and add the action object which is going to be required
1162 1162
                 switch ($options['type']) {
1163 1163
                     case 'link':
1164
-                        $this->objects[$id]=array('t'=>'annotation','info'=>$options);
1164
+                        $this->objects[$id] = array('t'=>'annotation', 'info'=>$options);
1165 1165
                         $this->numObj++;
1166 1166
                         $this->o_action($this->numObj, 'new', $options['url']);
1167
-                        $this->objects[$id]['info']['actionId']=$this->numObj;
1167
+                        $this->objects[$id]['info']['actionId'] = $this->numObj;
1168 1168
                         break;
1169 1169
                     case 'ilink':
1170 1170
                         // this is to a named internal link
1171 1171
                         $label = $options['label'];
1172
-                        $this->objects[$id]=array('t'=>'annotation','info'=>$options);
1172
+                        $this->objects[$id] = array('t'=>'annotation', 'info'=>$options);
1173 1173
                         $this->numObj++;
1174
-                        $this->o_action($this->numObj, 'new', array('type'=>'ilink','label'=>$label));
1175
-                        $this->objects[$id]['info']['actionId']=$this->numObj;
1174
+                        $this->o_action($this->numObj, 'new', array('type'=>'ilink', 'label'=>$label));
1175
+                        $this->objects[$id]['info']['actionId'] = $this->numObj;
1176 1176
                         break;
1177 1177
                 }
1178 1178
                 break;
1179 1179
             case 'out':
1180
-                $res="\n".$id." 0 obj << /Type /Annot";
1180
+                $res = "\n".$id." 0 obj << /Type /Annot";
1181 1181
                 switch ($o['info']['type']) {
1182 1182
                     case 'link':
1183 1183
                     case 'ilink':
1184
-                        $res.= " /Subtype /Link";
1184
+                        $res .= " /Subtype /Link";
1185 1185
                         break;
1186 1186
                 }
1187
-                $res.=" /A ".$o['info']['actionId']." 0 R";
1188
-                $res.=" /Border [0 0 0]";
1189
-                $res.=" /H /I";
1190
-                $res.=" /Rect [ ";
1187
+                $res .= " /A ".$o['info']['actionId']." 0 R";
1188
+                $res .= " /Border [0 0 0]";
1189
+                $res .= " /H /I";
1190
+                $res .= " /Rect [ ";
1191 1191
                 foreach ($o['info']['rect'] as $v) {
1192
-                    $res.= sprintf("%.4f ", $v);
1192
+                    $res .= sprintf("%.4f ", $v);
1193 1193
                 }
1194
-                $res.="]";
1195
-                $res.=" >>\nendobj";
1194
+                $res .= "]";
1195
+                $res .= " >>\nendobj";
1196 1196
                 return $res;
1197 1197
             break;
1198 1198
         }
@@ -1204,66 +1204,66 @@  discard block
 block discarded – undo
1204 1204
      */
1205 1205
     private function o_page($id, $action, $options = '')
1206 1206
     {
1207
-        if ($action!='new') {
1208
-            $o =& $this->objects[$id];
1207
+        if ($action != 'new') {
1208
+            $o = & $this->objects[$id];
1209 1209
         }
1210 1210
         switch ($action) {
1211 1211
             case 'new':
1212 1212
                 $this->numPages++;
1213
-                $this->objects[$id]=array('t'=>'page','info'=>array('parent'=>$this->currentNode,'pageNum'=>$this->numPages));
1213
+                $this->objects[$id] = array('t'=>'page', 'info'=>array('parent'=>$this->currentNode, 'pageNum'=>$this->numPages));
1214 1214
                 if (is_array($options)) {
1215 1215
                     // then this must be a page insertion, array shoudl contain 'rid','pos'=[before|after]
1216
-                    $options['id']=$id;
1216
+                    $options['id'] = $id;
1217 1217
                     $this->o_pages($this->currentNode, 'page', $options);
1218 1218
                 } else {
1219 1219
                     $this->o_pages($this->currentNode, 'page', $id);
1220 1220
                 }
1221
-                    $this->currentPage=$id;
1221
+                    $this->currentPage = $id;
1222 1222
                     // make a contents object to go with this page
1223 1223
                     $this->numObj++;
1224 1224
                     $this->o_contents($this->numObj, 'new', $id);
1225
-                    $this->currentContents=$this->numObj;
1226
-                    $this->objects[$id]['info']['contents']=array();
1227
-                    $this->objects[$id]['info']['contents'][]=$this->numObj;
1225
+                    $this->currentContents = $this->numObj;
1226
+                    $this->objects[$id]['info']['contents'] = array();
1227
+                    $this->objects[$id]['info']['contents'][] = $this->numObj;
1228 1228
                     $match = ($this->numPages%2 ? 'odd' : 'even');
1229 1229
                 foreach ($this->addLooseObjects as $oId => $target) {
1230
-                    if ($target=='all' || $match==$target) {
1231
-                        $this->objects[$id]['info']['contents'][]=$oId;
1230
+                    if ($target == 'all' || $match == $target) {
1231
+                        $this->objects[$id]['info']['contents'][] = $oId;
1232 1232
                     }
1233 1233
                 }
1234 1234
                 break;
1235 1235
             case 'content':
1236
-                $o['info']['contents'][]=$options;
1236
+                $o['info']['contents'][] = $options;
1237 1237
                 break;
1238 1238
             case 'annot':
1239 1239
                 // add an annotation to this page
1240 1240
                 if (!isset($o['info']['annot'])) {
1241
-                    $o['info']['annot']=array();
1241
+                    $o['info']['annot'] = array();
1242 1242
                 }
1243 1243
                 // $options should contain the id of the annotation dictionary
1244
-                $o['info']['annot'][]=$options;
1244
+                $o['info']['annot'][] = $options;
1245 1245
                 break;
1246 1246
             case 'out':
1247
-                $res="\n".$id." 0 obj\n<< /Type /Page";
1248
-                $res.=" /Parent ".$o['info']['parent']." 0 R";
1247
+                $res = "\n".$id." 0 obj\n<< /Type /Page";
1248
+                $res .= " /Parent ".$o['info']['parent']." 0 R";
1249 1249
                 if (isset($o['info']['annot'])) {
1250
-                    $res.=" /Annots [";
1250
+                    $res .= " /Annots [";
1251 1251
                     foreach ($o['info']['annot'] as $aId) {
1252
-                        $res.=" ".$aId." 0 R";
1252
+                        $res .= " ".$aId." 0 R";
1253 1253
                     }
1254
-                    $res.=" ]";
1254
+                    $res .= " ]";
1255 1255
                 }
1256 1256
                 $count = count($o['info']['contents']);
1257
-                if ($count==1) {
1258
-                    $res.=" /Contents ".$o['info']['contents'][0]." 0 R";
1259
-                } elseif ($count>1) {
1260
-                    $res.=" /Contents [ ";
1257
+                if ($count == 1) {
1258
+                    $res .= " /Contents ".$o['info']['contents'][0]." 0 R";
1259
+                } elseif ($count > 1) {
1260
+                    $res .= " /Contents [ ";
1261 1261
                     foreach ($o['info']['contents'] as $cId) {
1262
-                        $res.=$cId." 0 R ";
1262
+                        $res .= $cId." 0 R ";
1263 1263
                     }
1264
-                    $res.="]";
1264
+                    $res .= "]";
1265 1265
                 }
1266
-                    $res.=" >>\nendobj";
1266
+                    $res .= " >>\nendobj";
1267 1267
                 return $res;
1268 1268
             break;
1269 1269
         }
@@ -1275,35 +1275,35 @@  discard block
 block discarded – undo
1275 1275
      */
1276 1276
     private function o_contents($id, $action, $options = '')
1277 1277
     {
1278
-        if ($action!='new') {
1279
-            $o =& $this->objects[$id];
1278
+        if ($action != 'new') {
1279
+            $o = & $this->objects[$id];
1280 1280
         }
1281 1281
         switch ($action) {
1282 1282
             case 'new':
1283
-                $this->objects[$id]=array('t'=>'contents','c'=>'','info'=>array());
1283
+                $this->objects[$id] = array('t'=>'contents', 'c'=>'', 'info'=>array());
1284 1284
                 if (strlen($options) && intval($options)) {
1285 1285
                     // then this contents is the primary for a page
1286
-                    $this->objects[$id]['onPage']=$options;
1287
-                } elseif ($options=='raw') {
1286
+                    $this->objects[$id]['onPage'] = $options;
1287
+                } elseif ($options == 'raw') {
1288 1288
                     // then this page contains some other type of system object
1289
-                    $this->objects[$id]['raw']=1;
1289
+                    $this->objects[$id]['raw'] = 1;
1290 1290
                 }
1291 1291
                 break;
1292 1292
             case 'add':
1293 1293
                 // add more options to the decleration
1294 1294
                 foreach ($options as $k => $v) {
1295
-                    $o['info'][$k]=$v;
1295
+                    $o['info'][$k] = $v;
1296 1296
                 }
1297 1297
             case 'out':
1298
-                $tmp=$o['c'];
1299
-                $res= "\n".$id." 0 obj\n";
1298
+                $tmp = $o['c'];
1299
+                $res = "\n".$id." 0 obj\n";
1300 1300
                 if (isset($this->objects[$id]['raw'])) {
1301
-                    $res.=$tmp;
1301
+                    $res .= $tmp;
1302 1302
                 } else {
1303
-                    $res.= "<<";
1303
+                    $res .= "<<";
1304 1304
                     if (function_exists('gzcompress') && $this->options['compression']) {
1305 1305
                         // then implement ZLIB based compression on this content stream
1306
-                        $res.=" /Filter /FlateDecode";
1306
+                        $res .= " /Filter /FlateDecode";
1307 1307
                         $tmp = gzcompress($tmp, $this->options['compression']);
1308 1308
                     }
1309 1309
                     if ($this->encrypted) {
@@ -1313,9 +1313,9 @@  discard block
 block discarded – undo
1313 1313
                     foreach ($o['info'] as $k => $v) {
1314 1314
                         $res .= " /".$k.' '.$v;
1315 1315
                     }
1316
-                    $res.=" /Length ".strlen($tmp)." >> stream\n".$tmp."\nendstream";
1316
+                    $res .= " /Length ".strlen($tmp)." >> stream\n".$tmp."\nendstream";
1317 1317
                 }
1318
-                    $res.="\nendobj";
1318
+                    $res .= "\nendobj";
1319 1319
                 return $res;
1320 1320
             break;
1321 1321
         }
@@ -1327,43 +1327,43 @@  discard block
 block discarded – undo
1327 1327
      */
1328 1328
     private function o_image($id, $action, $options = '')
1329 1329
     {
1330
-        if ($action!='new') {
1331
-            $o =& $this->objects[$id];
1330
+        if ($action != 'new') {
1331
+            $o = & $this->objects[$id];
1332 1332
         }
1333 1333
         switch ($action) {
1334 1334
             case 'new':
1335 1335
                 // make the new object
1336
-                $this->objects[$id]=array('t'=>'image','data'=>$options['data'],'info'=>array());
1337
-                $this->objects[$id]['info']['Type']='/XObject';
1338
-                $this->objects[$id]['info']['Subtype']='/Image';
1339
-                $this->objects[$id]['info']['Width']=$options['iw'];
1340
-                $this->objects[$id]['info']['Height']=$options['ih'];
1341
-                if (!isset($options['type']) || $options['type']=='jpg') {
1336
+                $this->objects[$id] = array('t'=>'image', 'data'=>$options['data'], 'info'=>array());
1337
+                $this->objects[$id]['info']['Type'] = '/XObject';
1338
+                $this->objects[$id]['info']['Subtype'] = '/Image';
1339
+                $this->objects[$id]['info']['Width'] = $options['iw'];
1340
+                $this->objects[$id]['info']['Height'] = $options['ih'];
1341
+                if (!isset($options['type']) || $options['type'] == 'jpg') {
1342 1342
                     if (!isset($options['channels'])) {
1343
-                        $options['channels']=3;
1343
+                        $options['channels'] = 3;
1344 1344
                     }
1345 1345
                     switch ($options['channels']) {
1346 1346
                         case 1:
1347
-                            $this->objects[$id]['info']['ColorSpace']='/DeviceGray';
1347
+                            $this->objects[$id]['info']['ColorSpace'] = '/DeviceGray';
1348 1348
                             break;
1349 1349
                         default:
1350
-                            $this->objects[$id]['info']['ColorSpace']='/DeviceRGB';
1350
+                            $this->objects[$id]['info']['ColorSpace'] = '/DeviceRGB';
1351 1351
                             break;
1352 1352
                     }
1353
-                    $this->objects[$id]['info']['Filter']='/DCTDecode';
1354
-                    $this->objects[$id]['info']['BitsPerComponent']=8;
1355
-                } elseif ($options['type']=='png') {
1353
+                    $this->objects[$id]['info']['Filter'] = '/DCTDecode';
1354
+                    $this->objects[$id]['info']['BitsPerComponent'] = 8;
1355
+                } elseif ($options['type'] == 'png') {
1356 1356
                     if (strlen($options['pdata'])) {
1357 1357
                         $this->numObj++;
1358
-                        $this->objects[$this->numObj]=array('t'=>'image','c'=>'','info'=>array());
1358
+                        $this->objects[$this->numObj] = array('t'=>'image', 'c'=>'', 'info'=>array());
1359 1359
                         $this->objects[$this->numObj]['info'] = array('Type'=>'/XObject', 'Subtype'=>'/Image', 'Width'=> $options['iw'], 'Height'=> $options['ih'], 'Filter'=>'/FlateDecode', 'ColorSpace'=>'/DeviceGray', 'BitsPerComponent'=>'8', 'DecodeParms'=>'<< /Predictor 15 /Colors 1 /BitsPerComponent 8 /Columns '.$options['iw'].' >>');
1360
-                        $this->objects[$this->numObj]['data']=$options['pdata'];
1360
+                        $this->objects[$this->numObj]['data'] = $options['pdata'];
1361 1361
                         if (isset($options['transparency'])) {
1362 1362
                             switch ($options['transparency']['type']) {
1363 1363
                                 case 'indexed':
1364
-                                    $tmp=' [ '.$options['transparency']['data'].' '.$options['transparency']['data'].'] ';
1364
+                                    $tmp = ' [ '.$options['transparency']['data'].' '.$options['transparency']['data'].'] ';
1365 1365
                                     $this->objects[$id]['info']['Mask'] = $tmp;
1366
-                                    $this->objects[$id]['info']['ColorSpace'] = ' [ /Indexed /DeviceRGB '.(strlen($options['pdata'])/3-1).' '.$this->numObj.' 0 R ]';
1366
+                                    $this->objects[$id]['info']['ColorSpace'] = ' [ /Indexed /DeviceRGB '.(strlen($options['pdata'])/3 - 1).' '.$this->numObj.' 0 R ]';
1367 1367
                                     break;
1368 1368
                                 case 'alpha':
1369 1369
                                     $this->objects[$id]['info']['SMask'] = $this->numObj.' 0 R';
@@ -1372,28 +1372,28 @@  discard block
 block discarded – undo
1372 1372
                             }
1373 1373
                         }
1374 1374
                     } else {
1375
-                        $this->objects[$id]['info']['ColorSpace']='/'.$options['color'];
1375
+                        $this->objects[$id]['info']['ColorSpace'] = '/'.$options['color'];
1376 1376
                     }
1377
-                    $this->objects[$id]['info']['BitsPerComponent']=$options['bitsPerComponent'];
1378
-                    $this->objects[$id]['info']['Filter']='/FlateDecode';
1377
+                    $this->objects[$id]['info']['BitsPerComponent'] = $options['bitsPerComponent'];
1378
+                    $this->objects[$id]['info']['Filter'] = '/FlateDecode';
1379 1379
                     $this->objects[$id]['data'] = $options['data'];
1380
-                    $this->objects[$id]['info']['DecodeParms']='<< /Predictor 15 /Colors '.$options['ncolor'].' /Columns '.$options['iw'].' /BitsPerComponent '.$options['bitsPerComponent'].'>>';
1380
+                    $this->objects[$id]['info']['DecodeParms'] = '<< /Predictor 15 /Colors '.$options['ncolor'].' /Columns '.$options['iw'].' /BitsPerComponent '.$options['bitsPerComponent'].'>>';
1381 1381
                 }
1382 1382
                     // assign it a place in the named resource dictionary as an external object, according to
1383 1383
                     // the label passed in with it.
1384
-                    $this->o_pages($this->currentNode, 'xObject', array('label'=>$options['label'],'objNum'=>$id));
1384
+                    $this->o_pages($this->currentNode, 'xObject', array('label'=>$options['label'], 'objNum'=>$id));
1385 1385
                 break;
1386 1386
             case 'out':
1387
-                $tmp=$o['data'];
1388
-                $res= "\n".$id." 0 obj\n<<";
1387
+                $tmp = $o['data'];
1388
+                $res = "\n".$id." 0 obj\n<<";
1389 1389
                 foreach ($o['info'] as $k => $v) {
1390
-                    $res.=" /".$k.' '.$v;
1390
+                    $res .= " /".$k.' '.$v;
1391 1391
                 }
1392 1392
                 if ($this->encrypted) {
1393 1393
                     $this->encryptInit($id);
1394 1394
                     $tmp = $this->ARC4($tmp);
1395 1395
                 }
1396
-                $res.=" /Length ".strlen($tmp)." >> stream\n".$tmp."\nendstream\nendobj";
1396
+                $res .= " /Length ".strlen($tmp)." >> stream\n".$tmp."\nendstream\nendobj";
1397 1397
                 return $res;
1398 1398
             break;
1399 1399
         }
@@ -1405,14 +1405,14 @@  discard block
 block discarded – undo
1405 1405
      */
1406 1406
     private function o_encryption($id, $action, $options = '')
1407 1407
     {
1408
-        if ($action!='new') {
1409
-            $o =& $this->objects[$id];
1408
+        if ($action != 'new') {
1409
+            $o = & $this->objects[$id];
1410 1410
         }
1411 1411
         switch ($action) {
1412 1412
             case 'new':
1413 1413
                 // make the new object
1414
-                $this->objects[$id]=array('t'=>'encryption','info'=>$options);
1415
-                $this->arc4_objnum=$id;
1414
+                $this->objects[$id] = array('t'=>'encryption', 'info'=>$options);
1415
+                $this->arc4_objnum = $id;
1416 1416
             
1417 1417
                 // Pad or truncate the owner password
1418 1418
                 $owner = substr($options['owner'].$this->encryptionPad, 0, 32);
@@ -1431,26 +1431,26 @@  discard block
 block discarded – undo
1431 1431
                 // encryption key is set in encryptUser function
1432 1432
                 //$this->encryptionKey = $encryptionKey;
1433 1433
             
1434
-                $this->encrypted=1;
1434
+                $this->encrypted = 1;
1435 1435
                 break;
1436 1436
             case 'out':
1437
-                $res= "\n".$id." 0 obj\n<<";
1438
-                $res.=' /Filter /Standard';
1437
+                $res = "\n".$id." 0 obj\n<<";
1438
+                $res .= ' /Filter /Standard';
1439 1439
                 if ($this->encryptionMode > 1) { // RC4 128bit encryption
1440
-                    $res.=' /V 2';
1441
-                    $res.=' /R 3';
1442
-                    $res.=' /Length 128';
1440
+                    $res .= ' /V 2';
1441
+                    $res .= ' /R 3';
1442
+                    $res .= ' /Length 128';
1443 1443
                 } else { // RC4 40bit encryption
1444
-                    $res.=' /V 1';
1445
-                    $res.=' /R 2';
1444
+                    $res .= ' /V 1';
1445
+                    $res .= ' /R 2';
1446 1446
                 }
1447 1447
                     // use hex string instead of char code - char codes can make troubles (E.g. CR or LF)
1448
-                    $res.=' /O <'.$this->strToHex($o['info']['O']).'>';
1449
-                    $res.=' /U <'.$this->strToHex($o['info']['U']).'>';
1448
+                    $res .= ' /O <'.$this->strToHex($o['info']['O']).'>';
1449
+                    $res .= ' /U <'.$this->strToHex($o['info']['U']).'>';
1450 1450
                     // and the p-value needs to be converted to account for the twos-complement approach
1451 1451
                     //$o['info']['p'] = (($o['info']['p'] ^ 0xFFFFFFFF)+1)*-1;
1452
-                    $res.=' /P '.($o['info']['p']);
1453
-                    $res.=" >>\nendobj";
1452
+                    $res .= ' /P '.($o['info']['p']);
1453
+                    $res .= " >>\nendobj";
1454 1454
                 return $res;
1455 1455
             break;
1456 1456
         }
@@ -1479,13 +1479,13 @@  discard block
 block discarded – undo
1479 1479
         $ownerKey = substr($ownerHash, 0, $keylength); // PDF 1.4 - Create the encryption key (IMPORTANT: need to check Length)
1480 1480
         
1481 1481
         $this->ARC4_init($ownerKey); // 5 bytes of the encryption key (hashed 50 times)
1482
-        $ovalue=$this->ARC4($user); // PDF 1.4 - Encrypt the padded user password using RC4
1482
+        $ovalue = $this->ARC4($user); // PDF 1.4 - Encrypt the padded user password using RC4
1483 1483
         
1484 1484
         if ($this->encryptionMode > 1) {
1485 1485
             $len = strlen($ownerKey);
1486
-            for ($i = 1; $i<=19; ++$i) {
1486
+            for ($i = 1; $i <= 19; ++$i) {
1487 1487
                 $ek = '';
1488
-                for ($j=0; $j < $len; $j++) {
1488
+                for ($j = 0; $j < $len; $j++) {
1489 1489
                     $ek .= chr(ord($ownerKey[$j]) ^ $i);
1490 1490
                 }
1491 1491
                 $this->ARC4_init($ek);
@@ -1526,12 +1526,12 @@  discard block
 block discarded – undo
1526 1526
             
1527 1527
             // encrypt the hash from the previous method by using the encryptionKey
1528 1528
             $this->ARC4_init($this->encryptionKey);
1529
-            $uvalue=$this->ARC4($userHash);
1529
+            $uvalue = $this->ARC4($userHash);
1530 1530
             
1531 1531
             $len = strlen($this->encryptionKey);
1532
-            for ($i = 1; $i<=19; ++$i) {
1532
+            for ($i = 1; $i <= 19; ++$i) {
1533 1533
                 $ek = '';
1534
-                for ($j=0; $j< $len; $j++) {
1534
+                for ($j = 0; $j < $len; $j++) {
1535 1535
                     $ek .= chr(ord($this->encryptionKey[$j]) ^ $i);
1536 1536
                 }
1537 1537
                 $this->ARC4_init($ek);
@@ -1544,7 +1544,7 @@  discard block
 block discarded – undo
1544 1544
             $this->ARC4_init($this->encryptionKey);
1545 1545
             //$this->encryptionKey = $encryptionKey;
1546 1546
             //$this->encrypted=1;
1547
-            $uvalue=$this->ARC4($this->encryptionPad);
1547
+            $uvalue = $this->ARC4($this->encryptionPad);
1548 1548
         }
1549 1549
         return $uvalue;
1550 1550
     }
@@ -1557,7 +1557,7 @@  discard block
 block discarded – undo
1557 1557
     protected function strToHex($string)
1558 1558
     {
1559 1559
         $hex = '';
1560
-        for ($i=0; $i < strlen($string); $i++) {
1560
+        for ($i = 0; $i < strlen($string); $i++) {
1561 1561
             $hex .= sprintf("%02x", ord($string[$i]));
1562 1562
         }
1563 1563
         return $hex;
@@ -1566,7 +1566,7 @@  discard block
 block discarded – undo
1566 1566
     protected function hexToStr($hex)
1567 1567
     {
1568 1568
         $str = '';
1569
-        for ($i=0; $i<strlen($hex); $i+=2) {
1569
+        for ($i = 0; $i < strlen($hex); $i += 2) {
1570 1570
             $str .= chr(hexdec(substr($hex, $i, 2)));
1571 1571
         }
1572 1572
         return $str;
@@ -1591,10 +1591,10 @@  discard block
 block discarded – undo
1591 1591
     {
1592 1592
         $tmp = $this->encryptionKey;
1593 1593
         $hex = dechex($id);
1594
-        if (strlen($hex)<6) {
1595
-            $hex = substr('000000', 0, 6-strlen($hex)).$hex;
1594
+        if (strlen($hex) < 6) {
1595
+            $hex = substr('000000', 0, 6 - strlen($hex)).$hex;
1596 1596
         }
1597
-        $tmp.= chr(hexdec(substr($hex, 4, 2))).chr(hexdec(substr($hex, 2, 2))).chr(hexdec(substr($hex, 0, 2))).chr(0).chr(0);
1597
+        $tmp .= chr(hexdec(substr($hex, 4, 2))).chr(hexdec(substr($hex, 2, 2))).chr(hexdec(substr($hex, 0, 2))).chr(0).chr(0);
1598 1598
         $key = $this->md5_16($tmp);
1599 1599
         if ($this->encryptionMode > 1) {
1600 1600
             $this->ARC4_init(substr($key, 0, 16)); // use max 16 bytes for RC4 128bit encryption key
@@ -1611,23 +1611,23 @@  discard block
 block discarded – undo
1611 1611
     {
1612 1612
         $this->arc4 = '';
1613 1613
         // setup the control array
1614
-        if (strlen($key)==0) {
1614
+        if (strlen($key) == 0) {
1615 1615
             return;
1616 1616
         }
1617 1617
         $k = '';
1618
-        while (strlen($k)<256) {
1619
-            $k.=$key;
1618
+        while (strlen($k) < 256) {
1619
+            $k .= $key;
1620 1620
         }
1621
-        $k=substr($k, 0, 256);
1622
-        for ($i=0; $i<256; $i++) {
1621
+        $k = substr($k, 0, 256);
1622
+        for ($i = 0; $i < 256; $i++) {
1623 1623
             $this->arc4 .= chr($i);
1624 1624
         }
1625
-        $j=0;
1626
-        for ($i=0; $i<256; $i++) {
1625
+        $j = 0;
1626
+        for ($i = 0; $i < 256; $i++) {
1627 1627
             $t = $this->arc4[$i];
1628 1628
             $j = ($j + ord($t) + ord($k[$i]))%256;
1629
-            $this->arc4[$i]=$this->arc4[$j];
1630
-            $this->arc4[$j]=$t;
1629
+            $this->arc4[$i] = $this->arc4[$j];
1630
+            $this->arc4[$j] = $t;
1631 1631
         }
1632 1632
     }
1633 1633
 
@@ -1637,19 +1637,19 @@  discard block
 block discarded – undo
1637 1637
      */
1638 1638
     private function ARC4($text)
1639 1639
     {
1640
-        $len=strlen($text);
1641
-        $a=0;
1642
-        $b=0;
1640
+        $len = strlen($text);
1641
+        $a = 0;
1642
+        $b = 0;
1643 1643
         $c = $this->arc4;
1644
-        $out='';
1645
-        for ($i=0; $i<$len; $i++) {
1646
-            $a = ($a+1)%256;
1647
-            $t= $c[$a];
1648
-            $b = ($b+ord($t))%256;
1649
-            $c[$a]=$c[$b];
1650
-            $c[$b]=$t;
1651
-            $k = ord($c[(ord($c[$a])+ord($c[$b]))%256]);
1652
-            $out.=chr(ord($text[$i]) ^ $k);
1644
+        $out = '';
1645
+        for ($i = 0; $i < $len; $i++) {
1646
+            $a = ($a + 1)%256;
1647
+            $t = $c[$a];
1648
+            $b = ($b + ord($t))%256;
1649
+            $c[$a] = $c[$b];
1650
+            $c[$b] = $t;
1651
+            $k = ord($c[(ord($c[$a]) + ord($c[$b]))%256]);
1652
+            $out .= chr(ord($text[$i]) ^ $k);
1653 1653
         }
1654 1654
         return $out;
1655 1655
     }
@@ -1661,7 +1661,7 @@  discard block
 block discarded – undo
1661 1661
     public function addLink($url, $x0, $y0, $x1, $y1)
1662 1662
     {
1663 1663
         $this->numObj++;
1664
-        $info = array('type'=>'link','url'=>$url,'rect'=>array($x0,$y0,$x1,$y1));
1664
+        $info = array('type'=>'link', 'url'=>$url, 'rect'=>array($x0, $y0, $x1, $y1));
1665 1665
         $this->o_annotation($this->numObj, 'new', $info);
1666 1666
     }
1667 1667
 
@@ -1672,7 +1672,7 @@  discard block
 block discarded – undo
1672 1672
     public function addInternalLink($label, $x0, $y0, $x1, $y1)
1673 1673
     {
1674 1674
         $this->numObj++;
1675
-        $info = array('type'=>'ilink','label'=>$label,'rect'=>array($x0,$y0,$x1,$y1));
1675
+        $info = array('type'=>'ilink', 'label'=>$label, 'rect'=>array($x0, $y0, $x1, $y1));
1676 1676
         $this->o_annotation($this->numObj, 'new', $info);
1677 1677
     }
1678 1678
 
@@ -1685,9 +1685,9 @@  discard block
 block discarded – undo
1685 1685
     public function setEncryption($userPass = '', $ownerPass = '', $pc = array(), $mode = 1)
1686 1686
     {
1687 1687
         if ($mode > 1) {
1688
-            $p=bindec('01111111111111111111000011000000'); // revision 3 is using bit 3 - 6 AND 9 - 12
1688
+            $p = bindec('01111111111111111111000011000000'); // revision 3 is using bit 3 - 6 AND 9 - 12
1689 1689
         } else {
1690
-            $p=bindec('01111111111111111111111111000000'); // while revision 2 is using bit 3 - 6 only
1690
+            $p = bindec('01111111111111111111111111000000'); // while revision 2 is using bit 3 - 6 only
1691 1691
         }
1692 1692
         
1693 1693
         $options = array(
@@ -1702,9 +1702,9 @@  discard block
 block discarded – undo
1702 1702
         );
1703 1703
         foreach ($pc as $k => $v) {
1704 1704
             if ($v && isset($options[$k])) {
1705
-                $p+=$options[$k];
1705
+                $p += $options[$k];
1706 1706
             } elseif (isset($options[$v])) {
1707
-                $p+=$options[$v];
1707
+                $p += $options[$v];
1708 1708
             }
1709 1709
         }
1710 1710
         
@@ -1715,10 +1715,10 @@  discard block
 block discarded – undo
1715 1715
         if ($this->arc4_objnum == 0) {
1716 1716
             // then the block does not exist already, add it.
1717 1717
             $this->numObj++;
1718
-            if (strlen($ownerPass)==0) {
1719
-                $ownerPass=$userPass;
1718
+            if (strlen($ownerPass) == 0) {
1719
+                $ownerPass = $userPass;
1720 1720
             }
1721
-            $this->o_encryption($this->numObj, 'new', array('user'=>$userPass,'owner'=>$ownerPass,'p'=>$p));
1721
+            $this->o_encryption($this->numObj, 'new', array('user'=>$userPass, 'owner'=>$ownerPass, 'p'=>$p));
1722 1722
         }
1723 1723
     }
1724 1724
 
@@ -1743,7 +1743,7 @@  discard block
 block discarded – undo
1743 1743
 
1744 1744
         if ($debug) {
1745 1745
             // turn compression off
1746
-            $this->options['compression']=0;
1746
+            $this->options['compression'] = 0;
1747 1747
         }
1748 1748
 
1749 1749
         if ($this->arc4_objnum) {
@@ -1756,23 +1756,23 @@  discard block
 block discarded – undo
1756 1756
 
1757 1757
         $this->checkAllHere();
1758 1758
 
1759
-        $xref=array();
1760
-        $content="%PDF-1.4\n%����";
1759
+        $xref = array();
1760
+        $content = "%PDF-1.4\n%����";
1761 1761
         //  $content="%PDF-1.3\n";
1762
-        $pos=strlen($content);
1762
+        $pos = strlen($content);
1763 1763
         foreach ($this->objects as $k => $v) {
1764
-            $tmp='o_'.$v['t'];
1765
-            $cont=$this->$tmp($k, 'out');
1766
-            $content.=$cont;
1767
-            $xref[]=$pos;
1768
-            $pos+=strlen($cont);
1764
+            $tmp = 'o_'.$v['t'];
1765
+            $cont = $this->$tmp($k, 'out');
1766
+            $content .= $cont;
1767
+            $xref[] = $pos;
1768
+            $pos += strlen($cont);
1769 1769
         }
1770 1770
         ++$pos;
1771
-        $content.="\nxref\n0 ".(count($xref)+1)."\n0000000000 65535 f \n";
1771
+        $content .= "\nxref\n0 ".(count($xref) + 1)."\n0000000000 65535 f \n";
1772 1772
         foreach ($xref as $p) {
1773
-            $content.=substr('0000000000', 0, 10-strlen($p+1)).($p+1)." 00000 n \n";
1773
+            $content .= substr('0000000000', 0, 10 - strlen($p + 1)).($p + 1)." 00000 n \n";
1774 1774
         }
1775
-        $content.="trailer\n<< /Size ".(count($xref)+1)." /Root 1 0 R /Info ".$this->infoObject." 0 R";
1775
+        $content .= "trailer\n<< /Size ".(count($xref) + 1)." /Root 1 0 R /Info ".$this->infoObject." 0 R";
1776 1776
         // if encryption has been applied to this document then add the marker for this dictionary
1777 1777
         if ($this->arc4_objnum > 0) {
1778 1778
             $content .= " /Encrypt ".$this->arc4_objnum." 0 R";
@@ -1791,9 +1791,9 @@  discard block
 block discarded – undo
1791 1791
      *
1792 1792
      * @access protected
1793 1793
      */
1794
-    protected function newDocument($pageSize = array(0,0,612,792))
1794
+    protected function newDocument($pageSize = array(0, 0, 612, 792))
1795 1795
     {
1796
-        $this->numObj=0;
1796
+        $this->numObj = 0;
1797 1797
         $this->objects = array();
1798 1798
 
1799 1799
         $this->numObj++;
@@ -1838,7 +1838,7 @@  discard block
 block discarded – undo
1838 1838
         $pos = strrpos($font, '/');
1839 1839
         if ($pos === false) {
1840 1840
             // $dir  = './';
1841
-            $dir  = dirname(__FILE__) . '/fonts/';
1841
+            $dir  = dirname(__FILE__).'/fonts/';
1842 1842
             $name = $font;
1843 1843
         } else {
1844 1844
             $dir  = substr($font, 0, $pos + 1);
@@ -1864,7 +1864,7 @@  discard block
 block discarded – undo
1864 1864
             } else {
1865 1865
                 $this->debug('openFont: cached file found in '.$this->tempPath.'/'.$cachedFile);
1866 1866
                 $this->fonts[$font] = require($this->tempPath.'/'.$cachedFile);
1867
-                if (!isset($this->fonts[$font]['_version_']) || $this->fonts[$font]['_version_']<2) {
1867
+                if (!isset($this->fonts[$font]['_version_']) || $this->fonts[$font]['_version_'] < 2) {
1868 1868
                     // if the font file is old, then clear it out and prepare for re-creation
1869 1869
                     $this->debug('openFont: version conflict with cached font file. Force recreation');
1870 1870
                     unset($this->fonts[$font]);
@@ -1885,8 +1885,8 @@  discard block
 block discarded – undo
1885 1885
             
1886 1886
             $file = file($dir.$metrics_name);
1887 1887
             foreach ($file as $row) {
1888
-                $row=trim($row);
1889
-                $pos=strpos($row, ' ');
1888
+                $row = trim($row);
1889
+                $pos = strpos($row, ' ');
1890 1890
                 if ($pos) {
1891 1891
                     // then there must be some keyword
1892 1892
                     $key = substr($row, 0, $pos);
@@ -1909,10 +1909,10 @@  discard block
 block discarded – undo
1909 1909
                         case 'StdHW':
1910 1910
                         case 'StdVW':
1911 1911
                         case 'StartCharMetrics':
1912
-                            $data[$key]=trim(substr($row, $pos));
1912
+                            $data[$key] = trim(substr($row, $pos));
1913 1913
                             break;
1914 1914
                         case 'FontBBox':
1915
-                            $data[$key]=explode(' ', trim(substr($row, $pos)));
1915
+                            $data[$key] = explode(' ', trim(substr($row, $pos)));
1916 1916
                             break;
1917 1917
                         case 'C':
1918 1918
                             // C 39 ; WX 222 ; N quoteright ; B 53 463 157 718 ;
@@ -1976,16 +1976,16 @@  discard block
 block discarded – undo
1976 1976
                         case 'KPX':
1977 1977
                             break;
1978 1978
                         // KPX Adieresis yacute -40
1979
-                        $bits=explode(' ', $row);
1980
-                        $data['KPX'][$bits[1]][$bits[2]]=$bits[3];
1979
+                        $bits = explode(' ', $row);
1980
+                        $data['KPX'][$bits[1]][$bits[2]] = $bits[3];
1981 1981
                         break;
1982 1982
                     }
1983 1983
                 }
1984 1984
             }
1985 1985
             $data['CIDtoGID'] = base64_encode($cidtogid);
1986
-            $data['_version_']=2;
1986
+            $data['_version_'] = 2;
1987 1987
             
1988
-            $this->fonts[$font]=$data;
1988
+            $this->fonts[$font] = $data;
1989 1989
             $fp = fopen($this->tempPath.'/'.$cachedFile, 'w'); // use the temp folder to write cached font data
1990 1990
             fwrite($fp, '<?php /* R&OS php pdf class font cache file */ return '.var_export($data, true).'; ?>');
1991 1991
             fclose($fp);
@@ -2017,7 +2017,7 @@  discard block
 block discarded – undo
2017 2017
     
2018 2018
         $ext = substr($fontName, -4);
2019 2019
         if ($ext === '.afm' || $ext === '.ufm') {
2020
-            $fontName = substr($fontName, 0, strlen($fontName)-4);
2020
+            $fontName = substr($fontName, 0, strlen($fontName) - 4);
2021 2021
         }
2022 2022
         
2023 2023
         $pos = strrpos($fontName, '/');
@@ -2098,14 +2098,14 @@  discard block
 block discarded – undo
2098 2098
                     // also need to adjust the widths for the differences array
2099 2099
                     if (isset($options['differences'])) {
2100 2100
                         foreach ($options['differences'] as $charNum => $charName) {
2101
-                            if ($charNum>$lastChar) {
2101
+                            if ($charNum > $lastChar) {
2102 2102
                                 for ($i = $lastChar + 1; $i <= $charNum; $i++) {
2103
-                                    $widths[]=0;
2103
+                                    $widths[] = 0;
2104 2104
                                 }
2105 2105
                                 $lastChar = $charNum;
2106 2106
                             }
2107 2107
                             if (isset($font['C'][$charName])) {
2108
-                                $widths[$charNum-$firstChar]=$font['C'][$charName];
2108
+                                $widths[$charNum - $firstChar] = $font['C'][$charName];
2109 2109
                                 if ($font['isUnicode']) {
2110 2110
                                     $cid_widths[$charName] = $font['C'][$charName];
2111 2111
                                 }
@@ -2124,7 +2124,7 @@  discard block
 block discarded – undo
2124 2124
                     if (!$font['isUnicode']) {
2125 2125
                         $this->numObj++;
2126 2126
                         $this->o_contents($this->numObj, 'new', 'raw');
2127
-                        $this->objects[$this->numObj]['c'].='['.implode(' ', $widths).']';
2127
+                        $this->objects[$this->numObj]['c'] .= '['.implode(' ', $widths).']';
2128 2128
                         $widthid = $this->numObj;
2129 2129
                     }
2130 2130
                     
@@ -2144,16 +2144,16 @@  discard block
 block discarded – undo
2144 2144
                     $fontDescriptorId = ++$this->numObj;
2145 2145
                     
2146 2146
                     // determine flags (more than a little flakey, hopefully will not matter much)
2147
-                    $flags=0;
2148
-                    if ($font['ItalicAngle']!=0) {
2149
-                        $flags+=pow(2, 6);
2147
+                    $flags = 0;
2148
+                    if ($font['ItalicAngle'] != 0) {
2149
+                        $flags += pow(2, 6);
2150 2150
                     }
2151
-                    if ($font['IsFixedPitch']=='true') {
2152
-                        $flags+=1;
2151
+                    if ($font['IsFixedPitch'] == 'true') {
2152
+                        $flags += 1;
2153 2153
                     }
2154
-                    $flags+=pow(2, 5); // assume non-sybolic
2154
+                    $flags += pow(2, 5); // assume non-sybolic
2155 2155
 
2156
-                    $list = array('Ascent'=>'Ascender','CapHeight'=>'CapHeight','Descent'=>'Descender','FontBBox'=>'FontBBox','ItalicAngle'=>'ItalicAngle');
2156
+                    $list = array('Ascent'=>'Ascender', 'CapHeight'=>'CapHeight', 'Descent'=>'Descender', 'FontBBox'=>'FontBBox', 'ItalicAngle'=>'ItalicAngle');
2157 2157
                     $fdopt = array(
2158 2158
                         'Flags' => $flags,
2159 2159
                         'FontName' => $adobeFontName,
@@ -2161,13 +2161,13 @@  discard block
 block discarded – undo
2161 2161
                     );
2162 2162
                     foreach ($list as $k => $v) {
2163 2163
                         if (isset($font[$v])) {
2164
-                            $fdopt[$k]=$font[$v];
2164
+                            $fdopt[$k] = $font[$v];
2165 2165
                         }
2166 2166
                     }
2167 2167
                     
2168 2168
                     // setup the basic properties for o_font output
2169
-                    $tmp = array('BaseFont'=>$adobeFontName,'Widths'=>$widthid
2170
-                                      ,'FirstChar'=>$firstChar,'LastChar'=>$lastChar
2169
+                    $tmp = array('BaseFont'=>$adobeFontName, 'Widths'=>$widthid
2170
+                                      ,'FirstChar'=>$firstChar, 'LastChar'=>$lastChar
2171 2171
                                       ,'FontDescriptor'=>$fontDescriptorId);
2172 2172
                     
2173 2173
                     // binary content of pfb or ttf file
@@ -2176,11 +2176,11 @@  discard block
 block discarded – undo
2176 2176
                     // embed the font program
2177 2177
                     // to allow font subsets embedding fonts is proceed in o_font 'output'
2178 2178
                     if ($this->embedFont) {
2179
-                        if ($fbtype=='pfb') {
2180
-                            $fdopt['FontFile']=$pfbid;
2181
-                        } elseif ($fbtype=='ttf') {
2182
-                            $fdopt['FontFile2']=$pfbid;
2183
-                            $tmp['SubType']='TrueType'; // Declare basic font as TrueType
2179
+                        if ($fbtype == 'pfb') {
2180
+                            $fdopt['FontFile'] = $pfbid;
2181
+                        } elseif ($fbtype == 'ttf') {
2182
+                            $fdopt['FontFile2'] = $pfbid;
2183
+                            $tmp['SubType'] = 'TrueType'; // Declare basic font as TrueType
2184 2184
                         }
2185 2185
                         $this->o_fontDescriptor($fontDescriptorId, 'new', $fdopt);
2186 2186
                         $this->o_contents($pfbid, 'new');
@@ -2198,7 +2198,7 @@  discard block
 block discarded – undo
2198 2198
                 // also set the differences here, note that this means that these will take effect only the
2199 2199
                 // first time that a font is selected, else they are ignored
2200 2200
                 if (isset($options['differences'])) {
2201
-                    $font['differences']=$options['differences'];
2201
+                    $font['differences'] = $options['differences'];
2202 2202
                 }
2203 2203
             }
2204 2204
         }
@@ -2210,7 +2210,7 @@  discard block
 block discarded – undo
2210 2210
         
2211 2211
         if ($set && isset($this->fonts[$fontName])) {
2212 2212
             // so if for some reason the font was not set in the last one then it will not be selected
2213
-            $this->currentBaseFont=$fontName;
2213
+            $this->currentBaseFont = $fontName;
2214 2214
             // the next line means that if a new font is selected, then the current text state will be
2215 2215
             // applied to it as well.
2216 2216
             $this->setCurrentFont();
@@ -2232,9 +2232,9 @@  discard block
 block discarded – undo
2232 2232
      */
2233 2233
     protected function setCurrentFont()
2234 2234
     {
2235
-        if (strlen($this->currentBaseFont)==0) {
2235
+        if (strlen($this->currentBaseFont) == 0) {
2236 2236
             // then assume an initial font
2237
-            $this->selectFont(dirname(__FILE__) . '/fonts/Helvetica');
2237
+            $this->selectFont(dirname(__FILE__).'/fonts/Helvetica');
2238 2238
         }
2239 2239
         $pos = strrpos($this->currentBaseFont, '/');
2240 2240
         if ($pos !== false) {
@@ -2280,7 +2280,7 @@  discard block
 block discarded – undo
2280 2280
      */
2281 2281
     protected function addContent($content)
2282 2282
     {
2283
-        $this->objects[$this->currentContents]['c'].=$content;
2283
+        $this->objects[$this->currentContents]['c'] .= $content;
2284 2284
     }
2285 2285
 
2286 2286
     /**
@@ -2289,9 +2289,9 @@  discard block
 block discarded – undo
2289 2289
      */
2290 2290
     public function setColor($r, $g, $b, $force = 0)
2291 2291
     {
2292
-        if ($r>=0 && ($force || $r!=$this->currentColour['r'] || $g!=$this->currentColour['g'] || $b!=$this->currentColour['b'])) {
2293
-            $this->objects[$this->currentContents]['c'].="\n".sprintf('%.3F', $r).' '.sprintf('%.3F', $g).' '.sprintf('%.3F', $b).' rg';
2294
-            $this->currentColour=array('r'=>$r,'g'=>$g,'b'=>$b);
2292
+        if ($r >= 0 && ($force || $r != $this->currentColour['r'] || $g != $this->currentColour['g'] || $b != $this->currentColour['b'])) {
2293
+            $this->objects[$this->currentContents]['c'] .= "\n".sprintf('%.3F', $r).' '.sprintf('%.3F', $g).' '.sprintf('%.3F', $b).' rg';
2294
+            $this->currentColour = array('r'=>$r, 'g'=>$g, 'b'=>$b);
2295 2295
         }
2296 2296
     }
2297 2297
 
@@ -2301,9 +2301,9 @@  discard block
 block discarded – undo
2301 2301
      */
2302 2302
     public function setStrokeColor($r, $g, $b, $force = 0)
2303 2303
     {
2304
-        if ($r>=0 && ($force || $r!=$this->currentStrokeColour['r'] || $g!=$this->currentStrokeColour['g'] || $b!=$this->currentStrokeColour['b'])) {
2305
-            $this->objects[$this->currentContents]['c'].="\n".sprintf('%.3F', $r).' '.sprintf('%.3F', $g).' '.sprintf('%.3F', $b).' RG';
2306
-            $this->currentStrokeColour=array('r'=>$r,'g'=>$g,'b'=>$b);
2304
+        if ($r >= 0 && ($force || $r != $this->currentStrokeColour['r'] || $g != $this->currentStrokeColour['g'] || $b != $this->currentStrokeColour['b'])) {
2305
+            $this->objects[$this->currentContents]['c'] .= "\n".sprintf('%.3F', $r).' '.sprintf('%.3F', $g).' '.sprintf('%.3F', $b).' RG';
2306
+            $this->currentStrokeColour = array('r'=>$r, 'g'=>$g, 'b'=>$b);
2307 2307
         }
2308 2308
     }
2309 2309
 
@@ -2313,7 +2313,7 @@  discard block
 block discarded – undo
2313 2313
      */
2314 2314
     public function line($x1, $y1, $x2, $y2)
2315 2315
     {
2316
-        $this->objects[$this->currentContents]['c'].="\n".sprintf('%.3F', $x1).' '.sprintf('%.3F', $y1).' m '.sprintf('%.3F', $x2).' '.sprintf('%.3F', $y2).' l S';
2316
+        $this->objects[$this->currentContents]['c'] .= "\n".sprintf('%.3F', $x1).' '.sprintf('%.3F', $y1).' m '.sprintf('%.3F', $x2).' '.sprintf('%.3F', $y2).' l S';
2317 2317
     }
2318 2318
 
2319 2319
     /**
@@ -2324,8 +2324,8 @@  discard block
 block discarded – undo
2324 2324
     {
2325 2325
         // in the current line style, draw a bezier curve from (x0,y0) to (x3,y3) using the other two points
2326 2326
         // as the control points for the curve.
2327
-        $this->objects[$this->currentContents]['c'].="\n".sprintf('%.3F', $x0).' '.sprintf('%.3F', $y0).' m '.sprintf('%.3F', $x1).' '.sprintf('%.3F', $y1);
2328
-        $this->objects[$this->currentContents]['c'].= ' '.sprintf('%.3F', $x2).' '.sprintf('%.3F', $y2).' '.sprintf('%.3F', $x3).' '.sprintf('%.3F', $y3).' c S';
2327
+        $this->objects[$this->currentContents]['c'] .= "\n".sprintf('%.3F', $x0).' '.sprintf('%.3F', $y0).' m '.sprintf('%.3F', $x1).' '.sprintf('%.3F', $y1);
2328
+        $this->objects[$this->currentContents]['c'] .= ' '.sprintf('%.3F', $x2).' '.sprintf('%.3F', $y2).' '.sprintf('%.3F', $x3).' '.sprintf('%.3F', $y3).' c S';
2329 2329
     }
2330 2330
 
2331 2331
     /**
@@ -2359,19 +2359,19 @@  discard block
 block discarded – undo
2359 2359
      */
2360 2360
     public function ellipse($x0, $y0, $r1, $r2 = 0, $angle = 0, $nSeg = 8, $astart = 0, $afinish = 360, $close = 1, $fill = 0)
2361 2361
     {
2362
-        if ($r1==0) {
2362
+        if ($r1 == 0) {
2363 2363
             return;
2364 2364
         }
2365
-        if ($r2==0) {
2366
-            $r2=$r1;
2365
+        if ($r2 == 0) {
2366
+            $r2 = $r1;
2367 2367
         }
2368
-        if ($nSeg<2) {
2369
-            $nSeg=2;
2368
+        if ($nSeg < 2) {
2369
+            $nSeg = 2;
2370 2370
         }
2371 2371
 
2372 2372
         $astart = deg2rad((float)$astart);
2373 2373
         $afinish = deg2rad((float)$afinish);
2374
-        $totalAngle =$afinish-$astart;
2374
+        $totalAngle = $afinish - $astart;
2375 2375
 
2376 2376
         $dt = $totalAngle/$nSeg;
2377 2377
         $dtm = $dt/3;
@@ -2381,43 +2381,43 @@  discard block
 block discarded – undo
2381 2381
             $tmp = "\n q ";
2382 2382
             $tmp .= sprintf('%.3F', cos($a)).' '.sprintf('%.3F', (-1.0*sin($a))).' '.sprintf('%.3F', sin($a)).' '.sprintf('%.3F', cos($a)).' ';
2383 2383
             $tmp .= sprintf('%.3F', $x0).' '.sprintf('%.3F', $y0).' cm';
2384
-            $this->objects[$this->currentContents]['c'].= $tmp;
2385
-            $x0=0;
2386
-            $y0=0;
2384
+            $this->objects[$this->currentContents]['c'] .= $tmp;
2385
+            $x0 = 0;
2386
+            $y0 = 0;
2387 2387
         }
2388 2388
 
2389 2389
         $t1 = $astart;
2390
-        $a0 = $x0+$r1*cos($t1);
2391
-        $b0 = $y0+$r2*sin($t1);
2390
+        $a0 = $x0 + $r1*cos($t1);
2391
+        $b0 = $y0 + $r2*sin($t1);
2392 2392
         $c0 = -$r1*sin($t1);
2393 2393
         $d0 = $r2*cos($t1);
2394 2394
 
2395
-        $this->objects[$this->currentContents]['c'].="\n".sprintf('%.3F', $a0).' '.sprintf('%.3F', $b0).' m ';
2396
-        for ($i=1; $i<=$nSeg; $i++) {
2395
+        $this->objects[$this->currentContents]['c'] .= "\n".sprintf('%.3F', $a0).' '.sprintf('%.3F', $b0).' m ';
2396
+        for ($i = 1; $i <= $nSeg; $i++) {
2397 2397
             // draw this bit of the total curve
2398
-            $t1 = $i*$dt+$astart;
2399
-            $a1 = $x0+$r1*cos($t1);
2400
-            $b1 = $y0+$r2*sin($t1);
2398
+            $t1 = $i*$dt + $astart;
2399
+            $a1 = $x0 + $r1*cos($t1);
2400
+            $b1 = $y0 + $r2*sin($t1);
2401 2401
             $c1 = -$r1*sin($t1);
2402 2402
             $d1 = $r2*cos($t1);
2403
-            $this->objects[$this->currentContents]['c'].="\n".sprintf('%.3F', ($a0+$c0*$dtm)).' '.sprintf('%.3F', ($b0+$d0*$dtm));
2404
-            $this->objects[$this->currentContents]['c'].= ' '.sprintf('%.3F', ($a1-$c1*$dtm)).' '.sprintf('%.3F', ($b1-$d1*$dtm)).' '.sprintf('%.3F', $a1).' '.sprintf('%.3F', $b1).' c';
2405
-            $a0=$a1;
2406
-            $b0=$b1;
2407
-            $c0=$c1;
2408
-            $d0=$d1;
2403
+            $this->objects[$this->currentContents]['c'] .= "\n".sprintf('%.3F', ($a0 + $c0*$dtm)).' '.sprintf('%.3F', ($b0 + $d0*$dtm));
2404
+            $this->objects[$this->currentContents]['c'] .= ' '.sprintf('%.3F', ($a1 - $c1*$dtm)).' '.sprintf('%.3F', ($b1 - $d1*$dtm)).' '.sprintf('%.3F', $a1).' '.sprintf('%.3F', $b1).' c';
2405
+            $a0 = $a1;
2406
+            $b0 = $b1;
2407
+            $c0 = $c1;
2408
+            $d0 = $d1;
2409 2409
         }
2410 2410
         if ($fill) {
2411
-            $this->objects[$this->currentContents]['c'].=' f';
2411
+            $this->objects[$this->currentContents]['c'] .= ' f';
2412 2412
         } else {
2413 2413
             if ($close) {
2414
-                $this->objects[$this->currentContents]['c'].=' s'; // small 's' signifies closing the path as well
2414
+                $this->objects[$this->currentContents]['c'] .= ' s'; // small 's' signifies closing the path as well
2415 2415
             } else {
2416
-                $this->objects[$this->currentContents]['c'].=' S';
2416
+                $this->objects[$this->currentContents]['c'] .= ' S';
2417 2417
             }
2418 2418
         }
2419
-        if ($angle !=0) {
2420
-            $this->objects[$this->currentContents]['c'].=' Q';
2419
+        if ($angle != 0) {
2420
+            $this->objects[$this->currentContents]['c'] .= ' Q';
2421 2421
         }
2422 2422
     }
2423 2423
 
@@ -2440,26 +2440,26 @@  discard block
 block discarded – undo
2440 2440
 
2441 2441
         // this is quite inefficient in that it sets all the parameters whenever 1 is changed, but will fix another day
2442 2442
         $string = '';
2443
-        if ($width>0) {
2444
-            $string.= $width.' w';
2443
+        if ($width > 0) {
2444
+            $string .= $width.' w';
2445 2445
         }
2446
-        $ca = array('butt'=>0,'round'=>1,'square'=>2);
2446
+        $ca = array('butt'=>0, 'round'=>1, 'square'=>2);
2447 2447
         if (isset($ca[$cap])) {
2448
-            $string.= ' '.$ca[$cap].' J';
2448
+            $string .= ' '.$ca[$cap].' J';
2449 2449
         }
2450
-        $ja = array('miter'=>0,'round'=>1,'bevel'=>2);
2450
+        $ja = array('miter'=>0, 'round'=>1, 'bevel'=>2);
2451 2451
         if (isset($ja[$join])) {
2452
-            $string.= ' '.$ja[$join].' j';
2452
+            $string .= ' '.$ja[$join].' j';
2453 2453
         }
2454 2454
         if (is_array($dash)) {
2455
-            $string.= ' [';
2455
+            $string .= ' [';
2456 2456
             foreach ($dash as $len) {
2457
-                $string.=' '.$len;
2457
+                $string .= ' '.$len;
2458 2458
             }
2459
-            $string.= ' ] '.$phase.' d';
2459
+            $string .= ' ] '.$phase.' d';
2460 2460
         }
2461 2461
         $this->currentLineStyle = $string;
2462
-        $this->objects[$this->currentContents]['c'].="\n".$string;
2462
+        $this->objects[$this->currentContents]['c'] .= "\n".$string;
2463 2463
     }
2464 2464
 
2465 2465
     /**
@@ -2468,15 +2468,15 @@  discard block
 block discarded – undo
2468 2468
      */
2469 2469
     public function polygon($p, $np, $f = 0)
2470 2470
     {
2471
-        $this->objects[$this->currentContents]['c'].="\n";
2472
-        $this->objects[$this->currentContents]['c'].=sprintf('%.3F', $p[0]).' '.sprintf('%.3F', $p[1]).' m ';
2473
-        for ($i=2; $i<$np*2; $i=$i+2) {
2474
-            $this->objects[$this->currentContents]['c'].= sprintf('%.3F', $p[$i]).' '.sprintf('%.3F', $p[$i+1]).' l ';
2471
+        $this->objects[$this->currentContents]['c'] .= "\n";
2472
+        $this->objects[$this->currentContents]['c'] .= sprintf('%.3F', $p[0]).' '.sprintf('%.3F', $p[1]).' m ';
2473
+        for ($i = 2; $i < $np*2; $i = $i + 2) {
2474
+            $this->objects[$this->currentContents]['c'] .= sprintf('%.3F', $p[$i]).' '.sprintf('%.3F', $p[$i + 1]).' l ';
2475 2475
         }
2476
-        if ($f==1) {
2477
-            $this->objects[$this->currentContents]['c'].=' f';
2476
+        if ($f == 1) {
2477
+            $this->objects[$this->currentContents]['c'] .= ' f';
2478 2478
         } else {
2479
-            $this->objects[$this->currentContents]['c'].=' S';
2479
+            $this->objects[$this->currentContents]['c'] .= ' S';
2480 2480
         }
2481 2481
     }
2482 2482
 
@@ -2487,7 +2487,7 @@  discard block
 block discarded – undo
2487 2487
      */
2488 2488
     public function filledRectangle($x1, $y1, $width, $height)
2489 2489
     {
2490
-        $this->objects[$this->currentContents]['c'].="\n".sprintf('%.3F', $x1).' '.sprintf('%.3F', $y1).' '.sprintf('%.3F', $width).' '.sprintf('%.3F', $height).' re f';
2490
+        $this->objects[$this->currentContents]['c'] .= "\n".sprintf('%.3F', $x1).' '.sprintf('%.3F', $y1).' '.sprintf('%.3F', $width).' '.sprintf('%.3F', $height).' re f';
2491 2491
     }
2492 2492
 
2493 2493
     /**
@@ -2497,7 +2497,7 @@  discard block
 block discarded – undo
2497 2497
      */
2498 2498
     public function rectangle($x1, $y1, $width, $height)
2499 2499
     {
2500
-        $this->objects[$this->currentContents]['c'].="\n".sprintf('%.3F', $x1).' '.sprintf('%.3F', $y1).' '.sprintf('%.3F', $width).' '.sprintf('%.3F', $height).' re S';
2500
+        $this->objects[$this->currentContents]['c'] .= "\n".sprintf('%.3F', $x1).' '.sprintf('%.3F', $y1).' '.sprintf('%.3F', $width).' '.sprintf('%.3F', $height).' re S';
2501 2501
     }
2502 2502
 
2503 2503
     /**
@@ -2512,7 +2512,7 @@  discard block
 block discarded – undo
2512 2512
         // then on the new page, re-open them with the right setings
2513 2513
 
2514 2514
         if ($this->nStateStack) {
2515
-            for ($i=$this->nStateStack; $i>=1; $i--) {
2515
+            for ($i = $this->nStateStack; $i >= 1; $i--) {
2516 2516
                 $this->restoreState($i);
2517 2517
             }
2518 2518
         }
@@ -2522,28 +2522,28 @@  discard block
 block discarded – undo
2522 2522
             // the id from the ezPdf class is the od of the contents of the page, not the page object itself
2523 2523
             // query that object to find the parent
2524 2524
             $rid = $this->objects[$id]['onPage'];
2525
-            $opt= array('rid'=>$rid,'pos'=>$pos);
2525
+            $opt = array('rid'=>$rid, 'pos'=>$pos);
2526 2526
             $this->o_page($this->numObj, 'new', $opt);
2527 2527
         } else {
2528 2528
             $this->o_page($this->numObj, 'new');
2529 2529
         }
2530 2530
         // if there is a stack saved, then put that onto the page
2531 2531
         if ($this->nStateStack) {
2532
-            for ($i=1; $i<=$this->nStateStack; $i++) {
2532
+            for ($i = 1; $i <= $this->nStateStack; $i++) {
2533 2533
                 $this->saveState($i);
2534 2534
             }
2535 2535
         }
2536 2536
         // and if there has been a stroke or fill colour set, then transfer them
2537
-        if ($this->currentColour['r']>=0) {
2537
+        if ($this->currentColour['r'] >= 0) {
2538 2538
             $this->setColor($this->currentColour['r'], $this->currentColour['g'], $this->currentColour['b'], 1);
2539 2539
         }
2540
-        if ($this->currentStrokeColour['r']>=0) {
2540
+        if ($this->currentStrokeColour['r'] >= 0) {
2541 2541
             $this->setStrokeColor($this->currentStrokeColour['r'], $this->currentStrokeColour['g'], $this->currentStrokeColour['b'], 1);
2542 2542
         }
2543 2543
 
2544 2544
         // if there is a line style set, then put this in too
2545 2545
         if (strlen($this->currentLineStyle)) {
2546
-            $this->objects[$this->currentContents]['c'].="\n".$this->currentLineStyle;
2546
+            $this->objects[$this->currentContents]['c'] .= "\n".$this->currentLineStyle;
2547 2547
         }
2548 2548
 
2549 2549
         // the call to the o_page object set currentContents to the present page, so this can be returned as the page id
@@ -2568,23 +2568,23 @@  discard block
 block discarded – undo
2568 2568
         // 'compress'=> 1 or 0 - apply content stream compression, this is on (1) by default
2569 2569
         // 'download'=> 1 or 0 - provide download dialog
2570 2570
         if (!is_array($options)) {
2571
-            $options=array();
2571
+            $options = array();
2572 2572
         }
2573
-        if (isset($options['compress']) && $options['compress']==0) {
2573
+        if (isset($options['compress']) && $options['compress'] == 0) {
2574 2574
             $tmp = $this->output(1);
2575 2575
         } else {
2576 2576
             $tmp = $this->output();
2577 2577
         }
2578 2578
         header("Content-Type: application/pdf");
2579 2579
         header("Content-Length: ".strlen(ltrim($tmp)));
2580
-        $fileName = (isset($options['Content-Disposition'])?$options['Content-Disposition']:'file.pdf');
2580
+        $fileName = (isset($options['Content-Disposition']) ? $options['Content-Disposition'] : 'file.pdf');
2581 2581
         if (isset($options['download']) && $options['download'] == 1) {
2582 2582
             $attached = 'attachment';
2583 2583
         } else {
2584 2584
             $attached = 'inline';
2585 2585
         }
2586 2586
         header("Content-Disposition: $attached; filename=".$fileName);
2587
-        if (isset($options['Accept-Ranges']) && $options['Accept-Ranges']==1) {
2587
+        if (isset($options['Accept-Ranges']) && $options['Accept-Ranges'] == 1) {
2588 2588
             header("Accept-Ranges: ".strlen(ltrim($tmp)));
2589 2589
         }
2590 2590
         echo ltrim($tmp);
@@ -2646,13 +2646,13 @@  discard block
 block discarded – undo
2646 2646
                 $hexStr = $this->strToHex($text);
2647 2647
                 // store all used characters if subset font is set to true
2648 2648
                 if ($this->fonts[$cf]['isSubset']) {
2649
-                    for ($i = 0; $i < (strlen($hexStr) / 2); $i++) {
2650
-                        array_push($this->fonts[$cf]['subset'], substr($hexStr, ($i * 2), 2));
2649
+                    for ($i = 0; $i < (strlen($hexStr)/2); $i++) {
2650
+                        array_push($this->fonts[$cf]['subset'], substr($hexStr, ($i*2), 2));
2651 2651
                     }
2652 2652
                 }
2653 2653
             }
2654 2654
         }
2655
-        $text = strtr($text, array(')' => '\\)', '(' => '\\(', '\\' => '\\\\', chr(8) => '\\b', chr(9) => '\\t', chr(10) => '\\n', chr(12) => '\\f' ,chr(13) => '\\r'));
2655
+        $text = strtr($text, array(')' => '\\)', '(' => '\\(', '\\' => '\\\\', chr(8) => '\\b', chr(9) => '\\t', chr(10) => '\\n', chr(12) => '\\f', chr(13) => '\\r'));
2656 2656
 
2657 2657
         if ($this->rtl) {
2658 2658
             $text = strrev($text);
@@ -2708,7 +2708,7 @@  discard block
 block discarded – undo
2708 2708
                     // compose UTF-8 bytes to a single unicode value
2709 2709
                     $c = $bytes[0];
2710 2710
                     for ($j = 1; $j < $numbytes; $j++) {
2711
-                        $c += ($bytes[$j] << (($numbytes - $j - 1) * 0x06));
2711
+                        $c += ($bytes[$j] << (($numbytes - $j - 1)*0x06));
2712 2712
                     }
2713 2713
                     if ((($c >= 0xD800) and ($c <= 0xDFFF)) or ($c >= 0x10FFFF)) {
2714 2714
                         // The definition of UTF-8 prohibits encoding character numbers between
@@ -2759,12 +2759,12 @@  discard block
 block discarded – undo
2759 2759
             if ($c === 0xFFFD) {
2760 2760
                 $out .= "\xFF\xFD"; // replacement character
2761 2761
             } elseif ($c < 0x10000) {
2762
-                $out .= chr($c >> 0x08) . chr($c & 0xFF);
2762
+                $out .= chr($c >> 0x08).chr($c & 0xFF);
2763 2763
             } else {
2764 2764
                 $c -= 0x10000;
2765 2765
                 $w1 = 0xD800 | ($c >> 0x10);
2766 2766
                 $w2 = 0xDC00 | ($c & 0x3FF);
2767
-                $out .= chr($w1 >> 0x08) . chr($w1 & 0xFF) . chr($w2 >> 0x08) . chr($w2 & 0xFF);
2767
+                $out .= chr($w1 >> 0x08).chr($w1 & 0xFF).chr($w2 >> 0x08).chr($w2 & 0xFF);
2768 2768
             }
2769 2769
         }
2770 2770
         return $out;
@@ -2782,10 +2782,10 @@  discard block
 block discarded – undo
2782 2782
         $w = $this->getTextWidth($size, $text);
2783 2783
         // need to adjust for the number of spaces in this text
2784 2784
         $words = explode(' ', $text);
2785
-        $nspaces=count($words)-1;
2785
+        $nspaces = count($words) - 1;
2786 2786
         $w += $wa*$nspaces;
2787 2787
         $a = deg2rad((float)$angle);
2788
-        return array(cos($a)*$w+$x,-sin($a)*$w+$y);
2788
+        return array(cos($a)*$w + $x, -sin($a)*$w + $y);
2789 2789
     }
2790 2790
 
2791 2791
     /**
@@ -2795,8 +2795,8 @@  discard block
 block discarded – undo
2795 2795
      */
2796 2796
     private function checkTextDirective(&$text, $i, &$f)
2797 2797
     {
2798
-        $x=0;
2799
-        $y=0;
2798
+        $x = 0;
2799
+        $y = 0;
2800 2800
         return $this->checkTextDirective1($text, $i, $f, 0, $x, $y);
2801 2801
     }
2802 2802
 
@@ -2812,8 +2812,8 @@  discard block
 block discarded – undo
2812 2812
     private function checkTextDirective1(&$text, $i, &$f, $final, &$x, &$y, $size = 0, $angle = 0, $wordSpaceAdjust = 0)
2813 2813
     {
2814 2814
         $directive = 0;
2815
-        $j=$i;
2816
-        if ($text[$j]=='<') {
2815
+        $j = $i;
2816
+        if ($text[$j] == '<') {
2817 2817
             $j++;
2818 2818
             switch ($text[$j]) {
2819 2819
                 case '/':
@@ -2825,44 +2825,44 @@  discard block
 block discarded – undo
2825 2825
                         case 'b':
2826 2826
                         case 'i':
2827 2827
                             $j++;
2828
-                            if ($text[$j]=='>') {
2829
-                                $p = strrpos($this->currentTextState, $text[$j-1]);
2828
+                            if ($text[$j] == '>') {
2829
+                                $p = strrpos($this->currentTextState, $text[$j - 1]);
2830 2830
                                 if ($p !== false) {
2831 2831
                                     // then there is one to remove
2832
-                                    $this->currentTextState = substr($this->currentTextState, 0, $p).substr($this->currentTextState, $p+1);
2832
+                                    $this->currentTextState = substr($this->currentTextState, 0, $p).substr($this->currentTextState, $p + 1);
2833 2833
                                 }
2834
-                                $directive=$j-$i+1;
2834
+                                $directive = $j - $i + 1;
2835 2835
                             }
2836 2836
                             break;
2837 2837
                         case 'c':
2838 2838
                             // this this might be a callback function
2839 2839
                             $j++;
2840 2840
                             $k = strpos($text, '>', $j);
2841
-                            if ($k!==false && $text[$j]==':') {
2841
+                            if ($k !== false && $text[$j] == ':') {
2842 2842
                                 // then this will be treated as a callback directive
2843
-                                $directive = $k-$i+1;
2844
-                                $f=0;
2843
+                                $directive = $k - $i + 1;
2844
+                                $f = 0;
2845 2845
                                 // split the remainder on colons to get the function name and the paramater
2846
-                                $tmp = substr($text, $j+1, $k-$j-1);
2846
+                                $tmp = substr($text, $j + 1, $k - $j - 1);
2847 2847
                                 $b1 = strpos($tmp, ':');
2848
-                                if ($b1!==false) {
2848
+                                if ($b1 !== false) {
2849 2849
                                     $func = substr($tmp, 0, $b1);
2850
-                                    $parm = substr($tmp, $b1+1);
2850
+                                    $parm = substr($tmp, $b1 + 1);
2851 2851
                                 } else {
2852
-                                    $func=$tmp;
2853
-                                    $parm='';
2852
+                                    $func = $tmp;
2853
+                                    $parm = '';
2854 2854
                                 }
2855 2855
                                 if (!isset($func) || !strlen(trim($func))) {
2856
-                                    $directive=0;
2856
+                                    $directive = 0;
2857 2857
                                 } else {
2858 2858
                                     // only call the function if this is the final call
2859 2859
                                     if ($final) {
2860 2860
                                         // need to assess the text position, calculate the text width to this point
2861 2861
                                         // can use getTextWidth to find the text width I think
2862 2862
                                         $tmp = $this->getTextPosition($x, $y, $angle, $size, $wordSpaceAdjust, substr($text, 0, $i));
2863
-                                        $info = array('x'=>$tmp[0],'y'=>$tmp[1],'angle'=>$angle,'status'=>'end','p'=>$parm,'nCallback'=>$this->nCallback);
2864
-                                        $x=$tmp[0];
2865
-                                        $y=$tmp[1];
2863
+                                        $info = array('x'=>$tmp[0], 'y'=>$tmp[1], 'angle'=>$angle, 'status'=>'end', 'p'=>$parm, 'nCallback'=>$this->nCallback);
2864
+                                        $x = $tmp[0];
2865
+                                        $y = $tmp[1];
2866 2866
                                         $ret = $this->$func($info);
2867 2867
                                         if (is_array($ret)) {
2868 2868
                                             // then the return from the callback function could set the position, to start with, later will do font colour, and font
@@ -2870,7 +2870,7 @@  discard block
 block discarded – undo
2870 2870
                                                 switch ($rk) {
2871 2871
                                                     case 'x':
2872 2872
                                                     case 'y':
2873
-                                                        $$rk=$rv;
2873
+                                                        $$rk = $rv;
2874 2874
                                                         break;
2875 2875
                                                 }
2876 2876
                                             }
@@ -2878,8 +2878,8 @@  discard block
 block discarded – undo
2878 2878
                                         // also remove from to the stack
2879 2879
                                         // for simplicity, just take from the end, fix this another day
2880 2880
                                         $this->nCallback--;
2881
-                                        if ($this->nCallback<0) {
2882
-                                            $this->nCallBack=0;
2881
+                                        if ($this->nCallback < 0) {
2882
+                                            $this->nCallBack = 0;
2883 2883
                                         }
2884 2884
                                     }
2885 2885
                                 }
@@ -2890,34 +2890,34 @@  discard block
 block discarded – undo
2890 2890
                 case 'b':
2891 2891
                 case 'i':
2892 2892
                     $j++;
2893
-                    if ($text[$j]=='>') {
2894
-                        $this->currentTextState.=$text[$j-1];
2895
-                        $directive=$j-$i+1;
2893
+                    if ($text[$j] == '>') {
2894
+                        $this->currentTextState .= $text[$j - 1];
2895
+                        $directive = $j - $i + 1;
2896 2896
                     }
2897 2897
                     break;
2898 2898
                 case 'C':
2899
-                    $noClose=1;
2899
+                    $noClose = 1;
2900 2900
                 case 'c':
2901 2901
                     // this this might be a callback function
2902 2902
                     $j++;
2903 2903
                     $k = strpos($text, '>', $j);
2904
-                    if ($k!==false && $text[$j]==':') {
2904
+                    if ($k !== false && $text[$j] == ':') {
2905 2905
                         // then this will be treated as a callback directive
2906
-                        $directive = $k-$i+1;
2907
-                        $f=0;
2906
+                        $directive = $k - $i + 1;
2907
+                        $f = 0;
2908 2908
                         // split the remainder on colons to get the function name and the paramater
2909 2909
                         // $bits = explode(':',substr($text,$j+1,$k-$j-1));
2910
-                        $tmp = substr($text, $j+1, $k-$j-1);
2910
+                        $tmp = substr($text, $j + 1, $k - $j - 1);
2911 2911
                         $b1 = strpos($tmp, ':');
2912
-                        if ($b1!==false) {
2912
+                        if ($b1 !== false) {
2913 2913
                             $func = substr($tmp, 0, $b1);
2914
-                            $parm = substr($tmp, $b1+1);
2914
+                            $parm = substr($tmp, $b1 + 1);
2915 2915
                         } else {
2916
-                            $func=$tmp;
2917
-                            $parm='';
2916
+                            $func = $tmp;
2917
+                            $parm = '';
2918 2918
                         }
2919 2919
                         if (!isset($func) || !strlen(trim($func))) {
2920
-                            $directive=0;
2920
+                            $directive = 0;
2921 2921
                         } else {
2922 2922
                         // only call the function if this is the final call, ie, the one actually doing printing, not measurement
2923 2923
                             if ($final) {
@@ -2925,14 +2925,14 @@  discard block
 block discarded – undo
2925 2925
                                 // can use getTextWidth to find the text width I think
2926 2926
                                 // also add the text height and decender
2927 2927
                                 $tmp = $this->getTextPosition($x, $y, $angle, $size, $wordSpaceAdjust, substr($text, 0, $i));
2928
-                                $info = array('x'=>$tmp[0],'y'=>$tmp[1],'angle'=>$angle,'status'=>'start','p'=>$parm,'f'=>$func,'height'=>$this->getFontHeight($size),'decender'=>$this->getFontDecender($size));
2929
-                                $x=$tmp[0];
2930
-                                $y=$tmp[1];
2928
+                                $info = array('x'=>$tmp[0], 'y'=>$tmp[1], 'angle'=>$angle, 'status'=>'start', 'p'=>$parm, 'f'=>$func, 'height'=>$this->getFontHeight($size), 'decender'=>$this->getFontDecender($size));
2929
+                                $x = $tmp[0];
2930
+                                $y = $tmp[1];
2931 2931
                                 if (!isset($noClose) || !$noClose) {
2932 2932
                                     // only add to the stack if this is a small 'c', therefore is a start-stop pair
2933 2933
                                     $this->nCallback++;
2934
-                                    $info['nCallback']=$this->nCallback;
2935
-                                    $this->callback[$this->nCallback]=$info;
2934
+                                    $info['nCallback'] = $this->nCallback;
2935
+                                    $this->callback[$this->nCallback] = $info;
2936 2936
                                 }
2937 2937
                                 $ret = $this->$func($info);
2938 2938
                                 if (is_array($ret)) {
@@ -2941,7 +2941,7 @@  discard block
 block discarded – undo
2941 2941
                                         switch ($rk) {
2942 2942
                                             case 'x':
2943 2943
                                             case 'y':
2944
-                                                $$rk=$rv;
2944
+                                                $$rk = $rv;
2945 2945
                                                 break;
2946 2946
                                         }
2947 2947
                                     }
@@ -2962,13 +2962,13 @@  discard block
 block discarded – undo
2962 2962
     public function addText($x, $y, $size, $text, $angle = 0, $wordSpaceAdjust = 0)
2963 2963
     {
2964 2964
         if (!$this->numFonts) {
2965
-            $this->selectFont(dirname(__FILE__) . '/fonts/Helvetica');
2965
+            $this->selectFont(dirname(__FILE__).'/fonts/Helvetica');
2966 2966
         }
2967 2967
         // if there are any open callbacks, then they should be called, to show the start of the line
2968 2968
         if ($this->nCallback > 0) {
2969 2969
             for ($i = $this->nCallback; $i > 0; $i--) {
2970 2970
                 // call each function
2971
-                $info = array('x'=>$x,'y'=>$y,'angle'=>$angle,'status'=>'sol','p'=>$this->callback[$i]['p'],'nCallback'=>$this->callback[$i]['nCallback'],'height'=>$this->callback[$i]['height'],'decender'=>$this->callback[$i]['decender']);
2971
+                $info = array('x'=>$x, 'y'=>$y, 'angle'=>$angle, 'status'=>'sol', 'p'=>$this->callback[$i]['p'], 'nCallback'=>$this->callback[$i]['nCallback'], 'height'=>$this->callback[$i]['height'], 'decender'=>$this->callback[$i]['decender']);
2972 2972
                 $func = $this->callback[$i]['f'];
2973 2973
                 $this->$func($info);
2974 2974
             }
@@ -2986,14 +2986,14 @@  discard block
 block discarded – undo
2986 2986
         }
2987 2987
         
2988 2988
         $len = strlen($text);
2989
-        $start=0;
2990
-        for ($i=0; $i<$len; $i++) {
2991
-            $f=1;
2989
+        $start = 0;
2990
+        for ($i = 0; $i < $len; $i++) {
2991
+            $f = 1;
2992 2992
             $directive = $this->checkTextDirective($text, $i, $f);
2993 2993
             if ($directive) {
2994 2994
                 // then we should write what we need to
2995
-                if ($i>$start) {
2996
-                    $part = substr($text, $start, $i-$start);
2995
+                if ($i > $start) {
2996
+                    $part = substr($text, $start, $i - $start);
2997 2997
                     $this->addContent(' /F'.$this->currentFontNum.' '.sprintf('%.1f', $size).' Tf ');
2998 2998
                     $this->addContent(' ('.$this->filterText($part, false).') Tj');
2999 2999
                 }
@@ -3002,13 +3002,13 @@  discard block
 block discarded – undo
3002 3002
                     $this->setCurrentFont();
3003 3003
                 } else {
3004 3004
                     $this->addContent(' ET');
3005
-                    $f=1;
3006
-                    $xp=$x;
3007
-                    $yp=$y;
3005
+                    $f = 1;
3006
+                    $xp = $x;
3007
+                    $yp = $y;
3008 3008
                     $directive = $this->checkTextDirective1($text, $i, $f, 1, $xp, $yp, $size, $angle, $wordSpaceAdjust);
3009 3009
 
3010 3010
                     // restart the text object
3011
-                    if ($angle==0) {
3011
+                    if ($angle == 0) {
3012 3012
                         $this->addContent("\n".'BT '.sprintf('%.3F', $xp).' '.sprintf('%.3F', $yp).' Td');
3013 3013
                     } else {
3014 3014
                         $a = deg2rad((float)$angle);
@@ -3017,14 +3017,14 @@  discard block
 block discarded – undo
3017 3017
                         $tmp .= sprintf('%.3F', $xp).' '.sprintf('%.3F', $yp).' Tm';
3018 3018
                         $this->addContent($tmp);
3019 3019
                     }
3020
-                    if ($wordSpaceAdjust!=0 || $wordSpaceAdjust != $this->wordSpaceAdjust) {
3021
-                        $this->wordSpaceAdjust=$wordSpaceAdjust;
3020
+                    if ($wordSpaceAdjust != 0 || $wordSpaceAdjust != $this->wordSpaceAdjust) {
3021
+                        $this->wordSpaceAdjust = $wordSpaceAdjust;
3022 3022
                         $this->addContent(' '.sprintf('%.3F', $wordSpaceAdjust).' Tw');
3023 3023
                     }
3024 3024
                 }
3025 3025
                 // and move the writing point to the next piece of text
3026
-                $i=$i+$directive-1;
3027
-                $start=$i+1;
3026
+                $i = $i + $directive - 1;
3027
+                $start = $i + 1;
3028 3028
             }
3029 3029
         }
3030 3030
 
@@ -3034,7 +3034,7 @@  discard block
 block discarded – undo
3034 3034
           // modify unicode text so that extra word spacing is manually implemented (bug #)
3035 3035
             $cf = $this->currentFont;
3036 3036
             if ($this->fonts[$cf]['isUnicode'] && $wordSpaceAdjust != 0) {
3037
-                $space_scale = 1000 / $size;
3037
+                $space_scale = 1000/$size;
3038 3038
                 $place_text = str_replace(' ', ' ) '.(-round($space_scale*$wordSpaceAdjust)).' (', $place_text);
3039 3039
             }
3040 3040
             $this->addContent(" /F$this->currentFontNum ".sprintf('%.1F Tf ', $size));
@@ -3085,7 +3085,7 @@  discard block
 block discarded – undo
3085 3085
 
3086 3086
         // hmm, this is where it all starts to get tricky - use the font information to
3087 3087
         // calculate the width of each character, add them up and convert to user units
3088
-        $w=0;
3088
+        $w = 0;
3089 3089
         $len = strlen($text);
3090 3090
         $cf = $this->currentFont;
3091 3091
         // font is set to unicode mode
@@ -3095,15 +3095,15 @@  discard block
 block discarded – undo
3095 3095
             $out = $this->utf8toUtf16BE($text);
3096 3096
         }
3097 3097
         
3098
-        for ($i=0; $i< strlen($text); $i++) {
3099
-            $f=1;
3098
+        for ($i = 0; $i < strlen($text); $i++) {
3099
+            $f = 1;
3100 3100
             $directive = $this->checkTextDirective($text, $i, $f);
3101 3101
             if ($directive) {
3102 3102
                 if ($f) {
3103 3103
                     $this->setCurrentFont();
3104 3104
                     $cf = $this->currentFont;
3105 3105
                 }
3106
-                $i=$i+$directive-1;
3106
+                $i = $i + $directive - 1;
3107 3107
             } else {
3108 3108
                 if ($unicode) {
3109 3109
                     // use the previous converted text (utf8toUtf16BE) and get the correct character index by using below workaround
@@ -3116,10 +3116,10 @@  discard block
 block discarded – undo
3116 3116
                     // then this character is being replaced by another
3117 3117
                     $name = $this->fonts[$cf]['differences'][$char];
3118 3118
                     if (isset($this->fonts[$cf]['C'][$name])) {
3119
-                        $w+=$this->fonts[$cf]['C'][$name];
3119
+                        $w += $this->fonts[$cf]['C'][$name];
3120 3120
                     }
3121 3121
                 } elseif (isset($this->fonts[$cf]['C'][$char])) {
3122
-                    $w+=$this->fonts[$cf]['C'][$char];
3122
+                    $w += $this->fonts[$cf]['C'][$char];
3123 3123
                 }
3124 3124
             }
3125 3125
         }
@@ -3140,20 +3140,20 @@  discard block
 block discarded – undo
3140 3140
                 return;
3141 3141
                 break;
3142 3142
             case 'right':
3143
-                $x+=$width-$actual;
3143
+                $x += $width - $actual;
3144 3144
                 break;
3145 3145
             case 'center':
3146 3146
             case 'centre':
3147
-                $x+=($width-$actual)/2;
3147
+                $x += ($width - $actual)/2;
3148 3148
                 break;
3149 3149
             case 'full':
3150 3150
                 // count the number of words
3151 3151
                 $words = explode(' ', $text);
3152
-                $nspaces=count($words)-1;
3153
-                if ($nspaces>0) {
3154
-                    $adjust = ($width-$actual)/$nspaces;
3152
+                $nspaces = count($words) - 1;
3153
+                if ($nspaces > 0) {
3154
+                    $adjust = ($width - $actual)/$nspaces;
3155 3155
                 } else {
3156
-                    $adjust=0;
3156
+                    $adjust = 0;
3157 3157
                 }
3158 3158
                 break;
3159 3159
         }
@@ -3178,27 +3178,27 @@  discard block
 block discarded – undo
3178 3178
         $store_currentTextState = $this->currentTextState;
3179 3179
 
3180 3180
         if (!$this->numFonts) {
3181
-            $this->selectFont(dirname(__FILE__) . '/fonts/Helvetica');
3181
+            $this->selectFont(dirname(__FILE__).'/fonts/Helvetica');
3182 3182
         }
3183
-        if ($width<=0) {
3183
+        if ($width <= 0) {
3184 3184
             // error, pretend it printed ok, otherwise risking a loop
3185 3185
             return '';
3186 3186
         }
3187
-        $w=0;
3188
-        $break=0;
3189
-        $breakWidth=0;
3190
-        $len=strlen($text);
3187
+        $w = 0;
3188
+        $break = 0;
3189
+        $breakWidth = 0;
3190
+        $len = strlen($text);
3191 3191
         $cf = $this->currentFont;
3192 3192
         $tw = $width/$size*1000;
3193
-        for ($i=0; $i<$len; $i++) {
3194
-            $f=1;
3193
+        for ($i = 0; $i < $len; $i++) {
3194
+            $f = 1;
3195 3195
             $directive = $this->checkTextDirective($text, $i, $f);
3196 3196
             if ($directive) {
3197 3197
                 if ($f) {
3198 3198
                     $this->setCurrentFont();
3199 3199
                     $cf = $this->currentFont;
3200 3200
                 }
3201
-                $i=$i+$directive-1;
3201
+                $i = $i + $directive - 1;
3202 3202
             } else {
3203 3203
                 $cOrd = ord($text[$i]);
3204 3204
                 if (isset($this->fonts[$cf]['differences'][$cOrd])) {
@@ -3209,18 +3209,18 @@  discard block
 block discarded – undo
3209 3209
                 }
3210 3210
 
3211 3211
                 if (isset($this->fonts[$cf]['C'][$cOrd2])) {
3212
-                    $w+=$this->fonts[$cf]['C'][$cOrd2];
3212
+                    $w += $this->fonts[$cf]['C'][$cOrd2];
3213 3213
                 }
3214
-                if ($w>$tw) {
3214
+                if ($w > $tw) {
3215 3215
                     // then we need to truncate this line
3216
-                    if ($break>0) {
3216
+                    if ($break > 0) {
3217 3217
                         // then we have somewhere that we can split :)
3218
-                        if ($text[$break]==' ') {
3218
+                        if ($text[$break] == ' ') {
3219 3219
                             $tmp = substr($text, 0, $break);
3220 3220
                         } else {
3221
-                            $tmp = substr($text, 0, $break+1);
3221
+                            $tmp = substr($text, 0, $break + 1);
3222 3222
                         }
3223
-                        $adjust=0;
3223
+                        $adjust = 0;
3224 3224
                         $this->adjustWrapText($tmp, $breakWidth, $width, $x, $adjust, $justification);
3225 3225
 
3226 3226
                         // reset the text state
@@ -3229,16 +3229,16 @@  discard block
 block discarded – undo
3229 3229
                         if (!$test) {
3230 3230
                             $this->addText($x, $y, $size, $tmp, $angle, $adjust);
3231 3231
                         }
3232
-                        return substr($text, $break+1);
3232
+                        return substr($text, $break + 1);
3233 3233
                     } else {
3234 3234
                         // just split before the current character
3235 3235
                         $tmp = substr($text, 0, $i);
3236
-                        $adjust=0;
3237
-                        $ctmp=ord($text[$i]);
3236
+                        $adjust = 0;
3237
+                        $ctmp = ord($text[$i]);
3238 3238
                         if (isset($this->fonts[$cf]['differences'][$ctmp])) {
3239
-                            $ctmp=$this->fonts[$cf]['differences'][$ctmp];
3239
+                            $ctmp = $this->fonts[$cf]['differences'][$ctmp];
3240 3240
                         }
3241
-                        $tmpw=($w-$this->fonts[$cf]['C'][$ctmp])*$size/1000;
3241
+                        $tmpw = ($w - $this->fonts[$cf]['C'][$ctmp])*$size/1000;
3242 3242
                         $this->adjustWrapText($tmp, $tmpw, $width, $x, $adjust, $justification);
3243 3243
                         // reset the text state
3244 3244
                         $this->currentTextState = $store_currentTextState;
@@ -3249,26 +3249,26 @@  discard block
 block discarded – undo
3249 3249
                         return substr($text, $i);
3250 3250
                     }
3251 3251
                 }
3252
-                if ($text[$i]=='-') {
3253
-                    $break=$i;
3252
+                if ($text[$i] == '-') {
3253
+                    $break = $i;
3254 3254
                     $breakWidth = $w*$size/1000;
3255 3255
                 }
3256
-                if ($text[$i]==' ') {
3257
-                    $break=$i;
3258
-                    $ctmp=ord($text[$i]);
3256
+                if ($text[$i] == ' ') {
3257
+                    $break = $i;
3258
+                    $ctmp = ord($text[$i]);
3259 3259
                     if (isset($this->fonts[$cf]['differences'][$ctmp])) {
3260
-                        $ctmp=$this->fonts[$cf]['differences'][$ctmp];
3260
+                        $ctmp = $this->fonts[$cf]['differences'][$ctmp];
3261 3261
                     }
3262
-                    $breakWidth = ($w-$this->fonts[$cf]['C'][$ctmp])*$size/1000;
3262
+                    $breakWidth = ($w - $this->fonts[$cf]['C'][$ctmp])*$size/1000;
3263 3263
                 }
3264 3264
             }
3265 3265
         }
3266 3266
         // then there was no need to break this line
3267
-        if ($justification=='full') {
3268
-            $justification='left';
3267
+        if ($justification == 'full') {
3268
+            $justification = 'left';
3269 3269
         }
3270
-        $adjust=0;
3271
-        $tmpw=$w*$size/1000;
3270
+        $adjust = 0;
3271
+        $tmpw = $w*$size/1000;
3272 3272
         $this->adjustWrapText($text, $tmpw, $width, $x, $adjust, $justification);
3273 3273
         // reset the text state
3274 3274
         $this->currentTextState = $store_currentTextState;
@@ -3294,17 +3294,17 @@  discard block
 block discarded – undo
3294 3294
             $opt = $this->stateStack[$pageEnd]; // ok to use this as stack starts numbering at 1
3295 3295
             $this->setColor($opt['col']['r'], $opt['col']['g'], $opt['col']['b'], 1);
3296 3296
             $this->setStrokeColor($opt['str']['r'], $opt['str']['g'], $opt['str']['b'], 1);
3297
-            $this->objects[$this->currentContents]['c'].="\n".$opt['lin'];
3297
+            $this->objects[$this->currentContents]['c'] .= "\n".$opt['lin'];
3298 3298
             // $this->currentLineStyle = $opt['lin'];
3299 3299
         } else {
3300 3300
             $this->nStateStack++;
3301
-            $this->stateStack[$this->nStateStack]=array(
3301
+            $this->stateStack[$this->nStateStack] = array(
3302 3302
                 'col'=>$this->currentColour
3303 3303
                 ,'str'=>$this->currentStrokeColour
3304 3304
                 ,'lin'=>$this->currentLineStyle
3305 3305
             );
3306 3306
         }
3307
-        $this->objects[$this->currentContents]['c'].="\nq";
3307
+        $this->objects[$this->currentContents]['c'] .= "\nq";
3308 3308
     }
3309 3309
 
3310 3310
     /**
@@ -3317,12 +3317,12 @@  discard block
 block discarded – undo
3317 3317
             $n = $this->nStateStack;
3318 3318
             $this->currentColour = $this->stateStack[$n]['col'];
3319 3319
             $this->currentStrokeColour = $this->stateStack[$n]['str'];
3320
-            $this->objects[$this->currentContents]['c'].="\n".$this->stateStack[$n]['lin'];
3320
+            $this->objects[$this->currentContents]['c'] .= "\n".$this->stateStack[$n]['lin'];
3321 3321
             $this->currentLineStyle = $this->stateStack[$n]['lin'];
3322 3322
             unset($this->stateStack[$n]);
3323 3323
             $this->nStateStack--;
3324 3324
         }
3325
-        $this->objects[$this->currentContents]['c'].="\nQ";
3325
+        $this->objects[$this->currentContents]['c'] .= "\nQ";
3326 3326
     }
3327 3327
 
3328 3328
     /**
@@ -3335,12 +3335,12 @@  discard block
 block discarded – undo
3335 3335
     public function openObject()
3336 3336
     {
3337 3337
         $this->nStack++;
3338
-        $this->stack[$this->nStack]=array('c'=>$this->currentContents,'p'=>$this->currentPage);
3338
+        $this->stack[$this->nStack] = array('c'=>$this->currentContents, 'p'=>$this->currentPage);
3339 3339
         // add a new object of the content type, to hold the data flow
3340 3340
         $this->numObj++;
3341 3341
         $this->o_contents($this->numObj, 'new');
3342
-        $this->currentContents=$this->numObj;
3343
-        $this->looseObjects[$this->numObj]=1;
3342
+        $this->currentContents = $this->numObj;
3343
+        $this->looseObjects[$this->numObj] = 1;
3344 3344
 
3345 3345
         return $this->numObj;
3346 3346
     }
@@ -3352,8 +3352,8 @@  discard block
 block discarded – undo
3352 3352
     public function reopenObject($id)
3353 3353
     {
3354 3354
         $this->nStack++;
3355
-        $this->stack[$this->nStack]=array('c'=>$this->currentContents,'p'=>$this->currentPage);
3356
-        $this->currentContents=$id;
3355
+        $this->stack[$this->nStack] = array('c'=>$this->currentContents, 'p'=>$this->currentPage);
3356
+        $this->currentContents = $id;
3357 3357
        // also if this object is the primary contents for a page, then set the current page to its parent
3358 3358
         if (isset($this->objects[$id]['onPage'])) {
3359 3359
             $this->currentPage = $this->objects[$id]['onPage'];
@@ -3368,9 +3368,9 @@  discard block
 block discarded – undo
3368 3368
     {
3369 3369
         // close the object, as long as there was one open in the first place, which will be indicated by
3370 3370
         // an objectId on the stack.
3371
-        if ($this->nStack>0) {
3372
-            $this->currentContents=$this->stack[$this->nStack]['c'];
3373
-            $this->currentPage=$this->stack[$this->nStack]['p'];
3371
+        if ($this->nStack > 0) {
3372
+            $this->currentContents = $this->stack[$this->nStack]['c'];
3373
+            $this->currentPage = $this->stack[$this->nStack]['p'];
3374 3374
             $this->nStack--;
3375 3375
             // easier to probably not worry about removing the old entries, they will be overwritten
3376 3376
             // if there are new ones.
@@ -3386,7 +3386,7 @@  discard block
 block discarded – undo
3386 3386
         // if an object has been appearing on pages up to now, then stop it, this page will
3387 3387
         // be the last one that could contian it.
3388 3388
         if (isset($this->addLooseObjects[$id])) {
3389
-            $this->addLooseObjects[$id]='';
3389
+            $this->addLooseObjects[$id] = '';
3390 3390
         }
3391 3391
     }
3392 3392
 
@@ -3397,13 +3397,13 @@  discard block
 block discarded – undo
3397 3397
     public function addObject($id, $options = 'add')
3398 3398
     {
3399 3399
         // add the specified object to the page
3400
-        if (isset($this->looseObjects[$id]) && $this->currentContents!=$id) {
3400
+        if (isset($this->looseObjects[$id]) && $this->currentContents != $id) {
3401 3401
             // then it is a valid object, and it is not being added to itself
3402 3402
             switch ($options) {
3403 3403
                 case 'all':
3404 3404
                     // then this object is to be added to this page (done in the next block) and
3405 3405
                     // all future new pages.
3406
-                    $this->addLooseObjects[$id]='all';
3406
+                    $this->addLooseObjects[$id] = 'all';
3407 3407
                 case 'add':
3408 3408
                     if (isset($this->objects[$this->currentContents]['onPage'])) {
3409 3409
                         // then the destination contents is the primary for the page
@@ -3412,27 +3412,27 @@  discard block
 block discarded – undo
3412 3412
                     }
3413 3413
                     break;
3414 3414
                 case 'even':
3415
-                    $this->addLooseObjects[$id]='even';
3416
-                    $pageObjectId=$this->objects[$this->currentContents]['onPage'];
3417
-                    if ($this->objects[$pageObjectId]['info']['pageNum']%2==0) {
3415
+                    $this->addLooseObjects[$id] = 'even';
3416
+                    $pageObjectId = $this->objects[$this->currentContents]['onPage'];
3417
+                    if ($this->objects[$pageObjectId]['info']['pageNum']%2 == 0) {
3418 3418
                         $this->addObject($id); // hacky huh :)
3419 3419
                     }
3420 3420
                     break;
3421 3421
                 case 'odd':
3422
-                    $this->addLooseObjects[$id]='odd';
3423
-                    $pageObjectId=$this->objects[$this->currentContents]['onPage'];
3424
-                    if ($this->objects[$pageObjectId]['info']['pageNum']%2==1) {
3422
+                    $this->addLooseObjects[$id] = 'odd';
3423
+                    $pageObjectId = $this->objects[$this->currentContents]['onPage'];
3424
+                    if ($this->objects[$pageObjectId]['info']['pageNum']%2 == 1) {
3425 3425
                         $this->addObject($id); // hacky huh :)
3426 3426
                     }
3427 3427
                     break;
3428 3428
                 case 'next':
3429
-                    $this->addLooseObjects[$id]='all';
3429
+                    $this->addLooseObjects[$id] = 'all';
3430 3430
                     break;
3431 3431
                 case 'nexteven':
3432
-                    $this->addLooseObjects[$id]='even';
3432
+                    $this->addLooseObjects[$id] = 'even';
3433 3433
                     break;
3434 3434
                 case 'nextodd':
3435
-                    $this->addLooseObjects[$id]='odd';
3435
+                    $this->addLooseObjects[$id] = 'odd';
3436 3436
                     break;
3437 3437
             }
3438 3438
         }
@@ -3481,10 +3481,10 @@  discard block
 block discarded – undo
3481 3481
     private function getBytes(&$data, $pos, $num)
3482 3482
     {
3483 3483
         // return the integer represented by $num bytes from $pos within $data
3484
-        $ret=0;
3485
-        for ($i=0; $i<$num; $i++) {
3486
-            $ret=$ret*256;
3487
-            $ret+=ord($data[$pos+$i]);
3484
+        $ret = 0;
3485
+        for ($i = 0; $i < $num; $i++) {
3486
+            $ret = $ret*256;
3487
+            $ret += ord($data[$pos + $i]);
3488 3488
         }
3489 3489
         return $ret;
3490 3490
     }
@@ -3501,30 +3501,30 @@  discard block
 block discarded – undo
3501 3501
         $p = 8;
3502 3502
         $len = strlen($data);
3503 3503
         // cycle through the file, identifying chunks
3504
-        while ($p<$len) {
3504
+        while ($p < $len) {
3505 3505
             $chunkLen = $this->getBytes($data, $p, 4);
3506
-            $chunkType = substr($data, $p+4, 4);
3506
+            $chunkType = substr($data, $p + 4, 4);
3507 3507
             //error_log($chunkType. ' - '.$chunkLen);
3508 3508
             switch ($chunkType) {
3509 3509
                 case 'IHDR':
3510 3510
                 //this is where all the file information comes from
3511
-                    $default['info']['width']=$this->getBytes($data, $p+8, 4);
3512
-                    $default['info']['height']=$this->getBytes($data, $p+12, 4);
3513
-                    $default['info']['bitDepth']=ord($data[$p+16]);
3514
-                    $default['info']['colorType']=ord($data[$p+17]);
3515
-                    $default['info']['compressionMethod']=ord($data[$p+18]);
3516
-                    $default['info']['filterMethod']=ord($data[$p+19]);
3517
-                    $default['info']['interlaceMethod']=ord($data[$p+20]);
3511
+                    $default['info']['width'] = $this->getBytes($data, $p + 8, 4);
3512
+                    $default['info']['height'] = $this->getBytes($data, $p + 12, 4);
3513
+                    $default['info']['bitDepth'] = ord($data[$p + 16]);
3514
+                    $default['info']['colorType'] = ord($data[$p + 17]);
3515
+                    $default['info']['compressionMethod'] = ord($data[$p + 18]);
3516
+                    $default['info']['filterMethod'] = ord($data[$p + 19]);
3517
+                    $default['info']['interlaceMethod'] = ord($data[$p + 20]);
3518 3518
                 
3519
-                    $this->debug('readPngChunks: ColorType is' . $default['info']['colorType'], E_USER_NOTICE);
3519
+                    $this->debug('readPngChunks: ColorType is'.$default['info']['colorType'], E_USER_NOTICE);
3520 3520
                 
3521 3521
                     $default['haveHeader'] = true;
3522 3522
                 
3523
-                    if ($default['info']['compressionMethod']!=0) {
3523
+                    if ($default['info']['compressionMethod'] != 0) {
3524 3524
                         $error = true;
3525 3525
                         $errormsg = "unsupported compression method";
3526 3526
                     }
3527
-                    if ($default['info']['filterMethod']!=0) {
3527
+                    if ($default['info']['filterMethod'] != 0) {
3528 3528
                         $error = true;
3529 3529
                         $errormsg = "unsupported filter method";
3530 3530
                     }
@@ -3539,12 +3539,12 @@  discard block
 block discarded – undo
3539 3539
         
3540 3540
                         // there will be one entry for each palette entry. up until the last non-opaque entry.
3541 3541
                         // set up an array, stretching over all palette entries which will be o (opaque) or 1 (transparent)
3542
-                        $default['transparency']['type']='indexed';
3542
+                        $default['transparency']['type'] = 'indexed';
3543 3543
                         //$numPalette = strlen($default['pdata'])/3;
3544
-                        $trans=0;
3545
-                        for ($i=$chunkLen; $i>=0; $i--) {
3546
-                            if (ord($data[$p+8+$i])==0) {
3547
-                                $trans=$i;
3544
+                        $trans = 0;
3545
+                        for ($i = $chunkLen; $i >= 0; $i--) {
3546
+                            if (ord($data[$p + 8 + $i]) == 0) {
3547
+                                $trans = $i;
3548 3548
                             }
3549 3549
                         }
3550 3550
                         $default['transparency']['data'] = $trans;
@@ -3553,16 +3553,16 @@  discard block
 block discarded – undo
3553 3553
                         // Gray: 2 bytes, range 0 .. (2^bitdepth)-1
3554 3554
         
3555 3555
                         // $transparency['grayscale']=$this->getBytes($data,$p+8,2); // g = grayscale
3556
-                        $default['transparency']['type']='indexed';
3557
-                        $default['transparency']['data'] = ord($data[$p+8+1]);
3556
+                        $default['transparency']['type'] = 'indexed';
3557
+                        $default['transparency']['data'] = ord($data[$p + 8 + 1]);
3558 3558
                     } elseif ($default['info']['colorType'] == 2) { // truecolor
3559 3559
                         // corresponding to entries in the plte chunk
3560 3560
                         // Red: 2 bytes, range 0 .. (2^bitdepth)-1
3561 3561
                         // Green: 2 bytes, range 0 .. (2^bitdepth)-1
3562 3562
                         // Blue: 2 bytes, range 0 .. (2^bitdepth)-1
3563
-                        $default['transparency']['r']=$this->getBytes($data, $p+8, 2); // r from truecolor
3564
-                        $default['transparency']['g']=$this->getBytes($data, $p+10, 2); // g from truecolor
3565
-                        $default['transparency']['b']=$this->getBytes($data, $p+12, 2); // b from truecolor
3563
+                        $default['transparency']['r'] = $this->getBytes($data, $p + 8, 2); // r from truecolor
3564
+                        $default['transparency']['g'] = $this->getBytes($data, $p + 10, 2); // g from truecolor
3565
+                        $default['transparency']['b'] = $this->getBytes($data, $p + 12, 2); // b from truecolor
3566 3566
                     } elseif ($default['info']['colorType'] == 6 || $default['info']['colorType'] == 4) {
3567 3567
                         // set transparency type to "alpha" and proceed with it in $this->o_image later
3568 3568
                         $default['transparency']['type'] = 'alpha';
@@ -3579,11 +3579,11 @@  discard block
 block discarded – undo
3579 3579
                             for ($ypx = 0; $ypx < $default['info']['height']; ++$ypx) {
3580 3580
                                 $colorBits = imagecolorat($img, $xpx, $ypx);
3581 3581
                                 $color = imagecolorsforindex($img, $colorBits);
3582
-                                $color['alpha'] = (((127 - $color['alpha']) / 127) * 255);
3582
+                                $color['alpha'] = (((127 - $color['alpha'])/127)*255);
3583 3583
                                 imagesetpixel($imgalpha, $xpx, $ypx, $color['alpha']);
3584 3584
                             }
3585 3585
                         }
3586
-                        $tmpfile_alpha=tempnam($this->tempPath, 'ezImg');
3586
+                        $tmpfile_alpha = tempnam($this->tempPath, 'ezImg');
3587 3587
                     
3588 3588
                         imagepng($imgalpha, $tmpfile_alpha);
3589 3589
                         imagedestroy($imgalpha);
@@ -3595,7 +3595,7 @@  discard block
 block discarded – undo
3595 3595
                         $default['pdata'] = $alphaImg['idata'];
3596 3596
                     
3597 3597
                         // generate true color image with no alpha channel
3598
-                        $tmpfile_tt=tempnam($this->tempPath, 'ezImg');
3598
+                        $tmpfile_tt = tempnam($this->tempPath, 'ezImg');
3599 3599
                     
3600 3600
                         $imgplain = imagecreatetruecolor($default['info']['width'], $default['info']['height']);
3601 3601
                         imagecopy($imgplain, $img, 0, 0, 0, 0, $default['info']['width'], $default['info']['height']);
@@ -3615,10 +3615,10 @@  discard block
 block discarded – undo
3615 3615
                     }
3616 3616
                     break;
3617 3617
                 case 'PLTE':
3618
-                    $default['pdata'] = substr($data, $p+8, $chunkLen);
3618
+                    $default['pdata'] = substr($data, $p + 8, $chunkLen);
3619 3619
                     break;
3620 3620
                 case 'IDAT':
3621
-                    $default['idata'] .= substr($data, $p+8, $chunkLen);
3621
+                    $default['idata'] .= substr($data, $p + 8, $chunkLen);
3622 3622
                     break;
3623 3623
                 case 'tRNS': // this HEADER info is optional. More info: rfc2083 (http://tools.ietf.org/html/rfc2083)
3624 3624
                     // error_log('OPTIONAL HEADER -tRNS- exist:');
@@ -3628,7 +3628,7 @@  discard block
 block discarded – undo
3628 3628
                 default:
3629 3629
                     break;
3630 3630
             }
3631
-            $p += $chunkLen+12;
3631
+            $p += $chunkLen + 12;
3632 3632
         }
3633 3633
         return $default;
3634 3634
     }
@@ -3644,18 +3644,18 @@  discard block
 block discarded – undo
3644 3644
         $error = false;
3645 3645
         $errormsg = "";
3646 3646
         
3647
-        $this->debug('addPngFromFile: opening image ' . $file);
3647
+        $this->debug('addPngFromFile: opening image '.$file);
3648 3648
         
3649 3649
         $data = file_get_contents($file);
3650 3650
         
3651 3651
         if ($data === false) {
3652
-            $this->debug('addPngFromFile: trouble opening file ' . $file, E_USER_WARNING);
3652
+            $this->debug('addPngFromFile: trouble opening file '.$file, E_USER_WARNING);
3653 3653
             return;
3654 3654
         }
3655 3655
         
3656 3656
         $header = chr(137).chr(80).chr(78).chr(71).chr(13).chr(10).chr(26).chr(10);
3657
-        if (substr($data, 0, 8)!=$header) {
3658
-            $this->debug('addPngFromFile: Invalid PNG header for file: ' . $file, E_USER_WARNING);
3657
+        if (substr($data, 0, 8) != $header) {
3658
+            $this->debug('addPngFromFile: Invalid PNG header for file: '.$file, E_USER_WARNING);
3659 3659
             return;
3660 3660
         }
3661 3661
         
@@ -3675,24 +3675,24 @@  discard block
 block discarded – undo
3675 3675
             $errormsg = "only bit depth of 8 or less is supported.";
3676 3676
         }
3677 3677
 
3678
-        if ($iChunk['info']['colorType'] == 1 || $iChunk['info']['colorType'] == 5 || $iChunk['info']['colorType']== 7) {
3678
+        if ($iChunk['info']['colorType'] == 1 || $iChunk['info']['colorType'] == 5 || $iChunk['info']['colorType'] == 7) {
3679 3679
             $error = true;
3680 3680
             $errormsg = 'Unsupported PNG color type: '.$iChunk['info']['colorType'];
3681 3681
         } elseif (isset($iChunk['info'])) {
3682 3682
             switch ($iChunk['info']['colorType']) {
3683 3683
                 case 3:
3684 3684
                     $color = 'DeviceRGB';
3685
-                    $ncolor=1;
3685
+                    $ncolor = 1;
3686 3686
                     break;
3687 3687
                 case 6:
3688 3688
                 case 2:
3689 3689
                     $color = 'DeviceRGB';
3690
-                    $ncolor=3;
3690
+                    $ncolor = 3;
3691 3691
                     break;
3692 3692
                 case 4:
3693 3693
                 case 0:
3694 3694
                     $color = 'DeviceGray';
3695
-                    $ncolor=1;
3695
+                    $ncolor = 1;
3696 3696
                     break;
3697 3697
             }
3698 3698
         }
@@ -3701,11 +3701,11 @@  discard block
 block discarded – undo
3701 3701
             $this->debug('addPngFromFile: '.$errormsg, E_USER_WARNING);
3702 3702
             return;
3703 3703
         }
3704
-        if ($w==0) {
3705
-            $w=$h/$iChunk['info']['height']*$iChunk['info']['width'];
3704
+        if ($w == 0) {
3705
+            $w = $h/$iChunk['info']['height']*$iChunk['info']['width'];
3706 3706
         }
3707
-        if ($h==0) {
3708
-            $h=$w*$iChunk['info']['height']/$iChunk['info']['width'];
3707
+        if ($h == 0) {
3708
+            $h = $w*$iChunk['info']['height']/$iChunk['info']['width'];
3709 3709
         }
3710 3710
         
3711 3711
         if ($this->hashed) {
@@ -3715,24 +3715,24 @@  discard block
 block discarded – undo
3715 3715
             $label = $this->objectHash[$oHash];
3716 3716
         } else {
3717 3717
             $this->numImages++;
3718
-            $label='I'.$this->numImages;
3718
+            $label = 'I'.$this->numImages;
3719 3719
             $this->numObj++;
3720 3720
             
3721 3721
             if (isset($oHash)) {
3722 3722
                 $this->objectHash[$oHash] = $label;
3723 3723
             }
3724 3724
             
3725
-            $options = array('label'=>$label,'data'=>$iChunk['idata'],'bitsPerComponent'=>$iChunk['info']['bitDepth'],'pdata'=>$iChunk['pdata']
3726
-                                      ,'iw'=>$iChunk['info']['width'],'ih'=>$iChunk['info']['height'],'type'=>'png','color'=>$color,'ncolor'=>$ncolor);
3725
+            $options = array('label'=>$label, 'data'=>$iChunk['idata'], 'bitsPerComponent'=>$iChunk['info']['bitDepth'], 'pdata'=>$iChunk['pdata']
3726
+                                      ,'iw'=>$iChunk['info']['width'], 'ih'=>$iChunk['info']['height'], 'type'=>'png', 'color'=>$color, 'ncolor'=>$ncolor);
3727 3727
             if (isset($iChunk['transparency'])) {
3728
-                $options['transparency']=$iChunk['transparency'];
3728
+                $options['transparency'] = $iChunk['transparency'];
3729 3729
             }
3730 3730
             $this->o_image($this->numObj, 'new', $options);
3731 3731
         }
3732 3732
         
3733
-        $this->objects[$this->currentContents]['c'].="\nq ".sprintf('%.3F', $w)." 0 0 ".sprintf('%.3F', $h)." ".sprintf('%.3F', $x)." ".sprintf('%.3F', $y)." cm";
3734
-        $this->objects[$this->currentContents]['c'].=" /".$label.' Do';
3735
-        $this->objects[$this->currentContents]['c'].=" Q";
3733
+        $this->objects[$this->currentContents]['c'] .= "\nq ".sprintf('%.3F', $w)." 0 0 ".sprintf('%.3F', $h)." ".sprintf('%.3F', $x)." ".sprintf('%.3F', $y)." cm";
3734
+        $this->objects[$this->currentContents]['c'] .= " /".$label.' Do';
3735
+        $this->objects[$this->currentContents]['c'] .= " Q";
3736 3736
     }
3737 3737
     
3738 3738
     /**
@@ -3748,9 +3748,9 @@  discard block
 block discarded – undo
3748 3748
             return;
3749 3749
         }
3750 3750
 
3751
-        $tmp=getimagesize($img);
3752
-        $imageWidth=$tmp[0];
3753
-        $imageHeight=$tmp[1];
3751
+        $tmp = getimagesize($img);
3752
+        $imageWidth = $tmp[0];
3753
+        $imageHeight = $tmp[1];
3754 3754
 
3755 3755
         if (isset($tmp['channels'])) {
3756 3756
             $channels = $tmp['channels'];
@@ -3758,14 +3758,14 @@  discard block
 block discarded – undo
3758 3758
             $channels = 3;
3759 3759
         }
3760 3760
 
3761
-        if ($w<=0 && $h<=0) {
3762
-            $w=$imageWidth;
3761
+        if ($w <= 0 && $h <= 0) {
3762
+            $w = $imageWidth;
3763 3763
         }
3764
-        if ($w==0) {
3765
-            $w=$h/$imageHeight*$imageWidth;
3764
+        if ($w == 0) {
3765
+            $w = $h/$imageHeight*$imageWidth;
3766 3766
         }
3767
-        if ($h==0) {
3768
-            $h=$w*$imageHeight/$imageWidth;
3767
+        if ($h == 0) {
3768
+            $h = $w*$imageHeight/$imageWidth;
3769 3769
         }
3770 3770
 
3771 3771
         $data = file_get_contents($img);
@@ -3793,23 +3793,23 @@  discard block
 block discarded – undo
3793 3793
             return;
3794 3794
         }
3795 3795
         
3796
-        $tmp=getimagesize($img);
3797
-        $imageWidth=$tmp[0];
3798
-        $imageHeight=$tmp[1];
3796
+        $tmp = getimagesize($img);
3797
+        $imageWidth = $tmp[0];
3798
+        $imageHeight = $tmp[1];
3799 3799
         
3800 3800
         
3801
-        if ($w<=0 && $h<=0) {
3802
-            $w=$imageWidth;
3801
+        if ($w <= 0 && $h <= 0) {
3802
+            $w = $imageWidth;
3803 3803
         }
3804
-        if ($w==0) {
3805
-            $w=$h/$imageHeight*$imageWidth;
3804
+        if ($w == 0) {
3805
+            $w = $h/$imageHeight*$imageWidth;
3806 3806
         }
3807
-        if ($h==0) {
3808
-            $h=$w*$imageHeight/$imageWidth;
3807
+        if ($h == 0) {
3808
+            $h = $w*$imageHeight/$imageWidth;
3809 3809
         }
3810 3810
         
3811 3811
         $imgres = imagecreatefromgif($img);
3812
-        $tmpName=tempnam($this->tempPath, 'img');
3812
+        $tmpName = tempnam($this->tempPath, 'img');
3813 3813
         imagejpeg($imgres, $tmpName, 90);
3814 3814
         
3815 3815
         $this->addJpegFromFile($tmpName, $x, $y, $w, $h);
@@ -3837,26 +3837,26 @@  discard block
 block discarded – undo
3837 3837
 
3838 3838
         // there seems to be some problem here in that images that have quality set above 75 do not appear
3839 3839
         // not too sure why this is, but in the meantime I have restricted this to 75.
3840
-        if ($quality>75) {
3841
-            $quality=75;
3840
+        if ($quality > 75) {
3841
+            $quality = 75;
3842 3842
         }
3843 3843
 
3844 3844
         // if the width or height are set to zero, then set the other one based on keeping the image
3845 3845
         // height/width ratio the same, if they are both zero, then give up :)
3846
-        $imageWidth=imagesx($img);
3847
-        $imageHeight=imagesy($img);
3846
+        $imageWidth = imagesx($img);
3847
+        $imageHeight = imagesy($img);
3848 3848
 
3849
-        if ($w<=0 && $h<=0) {
3849
+        if ($w <= 0 && $h <= 0) {
3850 3850
             return;
3851 3851
         }
3852
-        if ($w==0) {
3853
-            $w=$h/$imageHeight*$imageWidth;
3852
+        if ($w == 0) {
3853
+            $w = $h/$imageHeight*$imageWidth;
3854 3854
         }
3855
-        if ($h==0) {
3856
-            $h=$w*$imageHeight/$imageWidth;
3855
+        if ($h == 0) {
3856
+            $h = $w*$imageHeight/$imageWidth;
3857 3857
         }
3858 3858
 
3859
-        $tmpName=tempnam($this->tempPath, 'img');
3859
+        $tmpName = tempnam($this->tempPath, 'img');
3860 3860
         imagejpeg($img, $tmpName, $quality);
3861 3861
         
3862 3862
         $data = file_get_contents($tmpName);
@@ -3882,19 +3882,19 @@  discard block
 block discarded – undo
3882 3882
             $label = $this->objectHash[$oHash];
3883 3883
         } else {
3884 3884
             $this->numImages++;
3885
-            $label='I'.$this->numImages;
3885
+            $label = 'I'.$this->numImages;
3886 3886
             $this->numObj++;
3887 3887
             
3888 3888
             if (isset($oHash)) {
3889 3889
                 $this->objectHash[$oHash] = $label;
3890 3890
             }
3891 3891
             
3892
-            $this->o_image($this->numObj, 'new', array('label'=>$label,'data'=>$data,'iw'=>$imageWidth,'ih'=>$imageHeight,'channels'=>$channels));
3892
+            $this->o_image($this->numObj, 'new', array('label'=>$label, 'data'=>$data, 'iw'=>$imageWidth, 'ih'=>$imageHeight, 'channels'=>$channels));
3893 3893
         }
3894 3894
 
3895
-        $this->objects[$this->currentContents]['c'].="\nq ".sprintf('%.3F', $w)." 0 0 ".sprintf('%.3F', $h)." ".sprintf('%.3F', $x)." ".sprintf('%.3F', $y)." cm";
3896
-        $this->objects[$this->currentContents]['c'].=" /".$label.' Do';
3897
-        $this->objects[$this->currentContents]['c'].=" Q";
3895
+        $this->objects[$this->currentContents]['c'] .= "\nq ".sprintf('%.3F', $w)." 0 0 ".sprintf('%.3F', $h)." ".sprintf('%.3F', $x)." ".sprintf('%.3F', $y)." cm";
3896
+        $this->objects[$this->currentContents]['c'] .= " /".$label.' Do';
3897
+        $this->objects[$this->currentContents]['c'] .= " Q";
3898 3898
     }
3899 3899
 
3900 3900
     /**
@@ -3914,7 +3914,7 @@  discard block
 block discarded – undo
3914 3914
         // 'FitBH' top
3915 3915
         // 'FitBV' left
3916 3916
         $this->numObj++;
3917
-        $this->o_destination($this->numObj, 'new', array('page'=>$this->currentPage,'type'=>$style,'p1'=>$a,'p2'=>$b,'p3'=>$c));
3917
+        $this->o_destination($this->numObj, 'new', array('page'=>$this->currentPage, 'type'=>$style, 'p1'=>$a, 'p2'=>$b, 'p3'=>$c));
3918 3918
         $id = $this->catalogId;
3919 3919
         $this->o_catalog($id, 'openHere', $this->numObj);
3920 3920
     }
@@ -3929,10 +3929,10 @@  discard block
 block discarded – undo
3929 3929
         // it has been linked to
3930 3930
         // styles are the same as the 'openHere' function
3931 3931
         $this->numObj++;
3932
-        $this->o_destination($this->numObj, 'new', array('page'=>$this->currentPage,'type'=>$style,'p1'=>$a,'p2'=>$b,'p3'=>$c));
3932
+        $this->o_destination($this->numObj, 'new', array('page'=>$this->currentPage, 'type'=>$style, 'p1'=>$a, 'p2'=>$b, 'p3'=>$c));
3933 3933
         $id = $this->numObj;
3934 3934
         // store the label->idf relationship, note that this means that labels can be used only once
3935
-        $this->destinations["$label"]=$id;
3935
+        $this->destinations["$label"] = $id;
3936 3936
     }
3937 3937
 
3938 3938
     /**
@@ -3967,7 +3967,7 @@  discard block
 block discarded – undo
3967 3967
                     trigger_error($message, $error_type);
3968 3968
                     break;
3969 3969
                 case 'variable':
3970
-                    $this->messages.=$message."\n";
3970
+                    $this->messages .= $message."\n";
3971 3971
                     break;
3972 3972
             }
3973 3973
         }
@@ -3995,7 +3995,7 @@  discard block
 block discarded – undo
3995 3995
                     $this->checkpoint = $tmp;
3996 3996
                     unset($tmp);
3997 3997
                 } else {
3998
-                    $this->checkpoint='';
3998
+                    $this->checkpoint = '';
3999 3999
                 }
4000 4000
                 break;
4001 4001
             case 'rewind':
@@ -4005,7 +4005,7 @@  discard block
 block discarded – undo
4005 4005
                     $tmp = $this->checkpoint;
4006 4006
                     foreach ($tmp as $k => $v) {
4007 4007
                         if ($k != 'checkpoint') {
4008
-                            $this->$k=$v;
4008
+                            $this->$k = $v;
4009 4009
                         }
4010 4010
                     }
4011 4011
                     unset($tmp);
@@ -4016,7 +4016,7 @@  discard block
 block discarded – undo
4016 4016
                     // can only abort if were inside a checkpoint
4017 4017
                     $tmp = $this->checkpoint;
4018 4018
                     foreach ($tmp as $k => $v) {
4019
-                        $this->$k=$v;
4019
+                        $this->$k = $v;
4020 4020
                     }
4021 4021
                     unset($tmp);
4022 4022
                 }
Please login to merge, or discard this patch.
src/Intraface/XMLRPC/Shop/Server0100.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -590,7 +590,7 @@  discard block
 block discarded – undo
590 590
         return $this->prepareResponseData($this->cleanUpProductList($product->getRelatedProducts($currencies, 'webshop')));
591 591
     }
592 592
 
593
-   /**
593
+    /**
594 594
      * Gets featured products
595 595
      *
596 596
      * Method is experimental and only used by discimport.dk. If you need to use it
@@ -640,7 +640,7 @@  discard block
 block discarded – undo
640 640
         return $this->prepareResponseData($related_products);
641 641
     }
642 642
 
643
-   /**
643
+    /**
644 644
      * Gets product keywords which can be used to sort ones webshop
645 645
      *
646 646
      *
Please login to merge, or discard this patch.