https://t.me/AnonymousX5
Server : LiteSpeed
System : Linux server354.web-hosting.com 4.18.0-553.45.1.lve.el8.x86_64 #1 SMP Wed Mar 26 12:08:09 UTC 2025 x86_64
User : getfsxkz ( 1681)
PHP Version : 8.1.33
Disable Function : NONE
Directory :  /home/getfsxkz/theaztech.org/wp-content/plugins/XSystem/SXINDEX/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/getfsxkz/theaztech.org/wp-content/plugins/XSystem/SXINDEX/class.PDF.php
<?php

	require_once __DIR__ . '/fpdf/fpdf.php';

	class PDF_Worker extends FPDF {
		protected $B = 0, $I = 0, $U = 0, $HREF = '';
		protected $headerTitle = '';
		
		public function setMetadata(array $metadata): void {
			if (!is_array($this->metadata)) {
				$this->metadata = [];
			}
			foreach ($metadata as $key => $value) {
				$key = preg_replace('/[^A-Za-z]/', '', $key);
				$this->metadata[$key] = $value;
			}
		}

		function setHeaderTitle($title) {
			$this->headerTitle = $title;
		}

		function Header() {
			if ($this->headerTitle) {
				$this->SetFont('Arial', 'B', 14);
				$this->SetY(10);
				$this->SetTextColor(0, 0, 0);

				$pageWidth = $this->GetPageWidth();
				$textWidth = $this->GetStringWidth($this->headerTitle);
				$x = $pageWidth - $textWidth - $this->rMargin;

				$this->SetX($x);
				$this->Cell($textWidth, 7, $this->headerTitle, 0, 0, 'R');

				$this->SetDrawColor(0, 0, 0);
				$this->SetLineWidth(0.4);
				$this->Line($this->lMargin, $this->GetY() + 8, $pageWidth - $this->rMargin, $this->GetY() + 8);

				$this->Ln(20);
			}
		}
		
		function Footer() {
			$this->SetY(-15);
			$this->SetFont('Arial', 'I', 8);
			$this->SetTextColor(128, 128, 128);
			$pageNum = 'Page ' . $this->PageNo();
			$this->Cell(0, 10, $pageNum, 0, 0, 'C');
		}
		
		function AddImage($base64) {
			if (strpos($base64, 'base64,') !== false) {
				$base64 = substr($base64, strpos($base64, 'base64,') + 7);
			}
			$binaryData = base64_decode($base64);
			$tempFile = tempnam(sys_get_temp_dir(), 'pdfimg_') . '.png';
			file_put_contents($tempFile, $binaryData);
			$info = getimagesize($tempFile);
			$imgWidthPx = $info[0];
			$imgHeightPx = $info[1];
			$dpi = 96;
			$imgWidthMM = $imgWidthPx * 25.4 / $dpi;
			$imgHeightMM = $imgHeightPx * 25.4 / $dpi;
			$pageWidth = $this->GetPageWidth() - $this->lMargin - $this->rMargin;
			if ($imgWidthMM > $pageWidth) {
				$scale = $pageWidth / $imgWidthMM;
				$imgWidthMM = $pageWidth;
				$imgHeightMM *= $scale;
			}
			$currentY = $this->GetY();
			$pageHeight = $this->GetPageHeight() - $this->bMargin;
			$remainingHeight = $pageHeight - $currentY;
			if ($imgHeightMM <= $remainingHeight) {
				$x = ($this->GetPageWidth() - $imgWidthMM) / 2;
				$y = $currentY;
				$this->Image($tempFile, $x, $y, $imgWidthMM, $imgHeightMM);
				$this->Ln($imgHeightMM + 3);
			}
			unlink($tempFile);
		}

		function WriteHTML($html) {
			$html = str_replace("\n", ' ', $html);
			$a = preg_split('/<(.*)>/U', $html, -1, PREG_SPLIT_DELIM_CAPTURE);
			for ($i = 0; $i < count($a); $i++) {
				if ($i % 2 == 0) {
					$this->WriteLine(html_entity_decode($a[$i]));
				} else {
					$tag = strtoupper($a[$i]);
					if ($tag === 'IMGBASE64') {
						if (isset($a[$i + 1])) {
							$this->AddImage($a[$i + 1]);
						}
						$i += 2;
					} elseif ($tag[0] === '/') {
						$this->CloseTag(substr($tag, 1));
					} else {
						$a2 = explode(' ', $tag);
						$mainTag = array_shift($a2);
						$attr = [];
						foreach ($a2 as $v) {
							if (preg_match('/([^=]*)=["\']?([^"\']*)/', $v, $a3)) {
								$attr[strtoupper($a3[1])] = $a3[2];
							}
						}
						$this->OpenTag($mainTag, $attr);
					}
				}
			}
		
		}
		
		function WriteLine($text) {
			if (trim($text) === '') return;
			$lineHeight = $this->FontSizePt * 0.5;
			$this->SetFont('Arial', $this->getCurrentStyle(), $this->FontSizePt);

			if ($this->HREF) {
				$this->SetTextColor(0, 0, 255);
				$this->Write($lineHeight, $text, $this->HREF);
				$this->Ln($lineHeight);
				$this->SetTextColor(0);
			} else {
				$this->MultiCell(0, $lineHeight, $text);
			}
		}

		function OpenTag($tag, $attr) {
			switch ($tag) {
				case 'B': $this->SetStyle('B', true); break;
				case 'I': $this->SetStyle('I', true); break;
				case 'U': $this->SetStyle('U', true); break;
				case 'A': $this->HREF = $attr['HREF'] ?? ''; break;
				case 'BR': $this->Ln($this->FontSizePt * 0.3); break;
				case 'H1':
					$this->Ln(2);
					$this->SetFont('Arial', 'B', 18);
					break;
				case 'H2':
					$this->Ln(1.5);
					$this->SetFont('Arial', 'B', 15);
					break;
				case 'H3':
					$this->Ln(1.2);
					$this->SetFont('Arial', 'B', 13);
					break;
				case 'P':
					$this->Ln(1);
					break;
			}
		}

		function CloseTag($tag) {
			switch ($tag) {
				case 'B': case 'I': case 'U':
					$this->SetStyle($tag, false);
					break;
				case 'A':
					$this->HREF = '';
					break;
				case 'H1':
					$this->SetFont('Arial', '', 12);
					$this->Ln(4);
					break;
				case 'H2':
					$this->SetFont('Arial', '', 12);
					$this->Ln(3);
					break;
				case 'H3':
					$this->SetFont('Arial', '', 12);
					$this->Ln(2);
					break;
				case 'P':
					$this->SetFont('Arial', '', 12);
					$this->Ln(2);
					break;
			}
		}

		function SetStyle($tag, $enable) {
			$this->$tag += ($enable ? 1 : -1);
		}

		function getCurrentStyle() {
			$style = '';
			foreach (['B', 'I', 'U'] as $s) {
				if ($this->$s > 0) $style .= $s;
			}
			return $style;
		}

		function OutputF($title, $html, $filepath) {
			$html = mb_convert_encoding($html, 'Windows-1252', 'UTF-8');
			$this->SetMargins(15, 10, 15);
			$this->setHeaderTitle($title);
			$this->AddPage();
			$this->SetFont('Arial', '', 12);
			$this->WriteHTML($html);
			$this->Output($filepath, 'F');
		}
	}
?>

https://t.me/AnonymousX5 - 2025