PluginProbe ʕ •ᴥ•ʔ
Independent Analytics – WordPress Analytics Plugin / 1.18
Independent Analytics – WordPress Analytics Plugin v1.18
2.15.0 2.14.10 trunk 1.1 1.10 1.10.1 1.11 1.12 1.13 1.14 1.15 1.16 1.17 1.17.1 1.17.2 1.17.3 1.17.4 1.18 1.18.1 1.19.0 1.19.1 1.2 1.20.0 1.21.0 1.22.0 1.22.1 1.23.0 1.23.1 1.24.0 1.24.1 1.25.0 1.25.1 1.26.0 1.27.0 1.28.0 1.28.1 1.28.2 1.28.3 1.29.0 1.3 1.30.0 1.30.1 1.4 1.5 1.6 1.7 1.8 1.9 2.0.0 2.0.1 2.1.4 2.1.5 2.1.6 2.10.0 2.10.1 2.10.2 2.10.3 2.10.4 2.11.0 2.11.1 2.11.10 2.11.2 2.11.3 2.11.4 2.11.5 2.11.6 2.11.7 2.11.8 2.11.9 2.12.0 2.12.1 2.12.2 2.13.1 2.13.2 2.13.5 2.13.6 2.14.0 2.14.1 2.14.2 2.14.4 2.14.6 2.14.7 2.14.8 2.14.9 2.2.0 2.2.1 2.3.1 2.3.2 2.4.2 2.4.3 2.5.0 2.5.1 2.6.0 2.6.1 2.6.2 2.6.3 2.6.4 2.7.0 2.7.1 2.7.2 2.7.3 2.8.2 2.8.3 2.8.4 2.8.5 2.8.6 2.8.7 2.8.8 2.8.9 2.9.2 2.9.3 2.9.4 2.9.5 2.9.6 2.9.7
independent-analytics / vendor / phenx / php-font-lib / src / FontLib / Table / DirectoryEntry.php
independent-analytics / vendor / phenx / php-font-lib / src / FontLib / Table Last commit date
Type 3 years ago DirectoryEntry.php 3 years ago Table.php 3 years ago
DirectoryEntry.php
119 lines
1 <?php
2
3 /**
4 * @package php-font-lib
5 * @link https://github.com/PhenX/php-font-lib
6 * @author Fabien Ménager <fabien.menager@gmail.com>
7 * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
8 */
9 namespace IAWP\FontLib\Table;
10
11 use IAWP\FontLib\TrueType\File;
12 use IAWP\FontLib\Font;
13 use IAWP\FontLib\BinaryStream;
14 /**
15 * Generic Font table directory entry.
16 *
17 * @package php-font-lib
18 */
19 class DirectoryEntry extends BinaryStream
20 {
21 /**
22 * @var File
23 */
24 protected $font;
25 /**
26 * @var Table
27 */
28 protected $font_table;
29 public $entryLength = 4;
30 public $tag;
31 public $checksum;
32 public $offset;
33 public $length;
34 protected $origF;
35 /**
36 * @param string $data
37 *
38 * @return int
39 */
40 static function computeChecksum($data)
41 {
42 $len = \mb_strlen($data, '8bit');
43 $mod = $len % 4;
44 if ($mod) {
45 $data = \str_pad($data, $len + (4 - $mod), "\x00");
46 }
47 $len = \mb_strlen($data, '8bit');
48 $hi = 0x0;
49 $lo = 0x0;
50 for ($i = 0; $i < $len; $i += 4) {
51 $hi += (\ord($data[$i]) << 8) + \ord($data[$i + 1]);
52 $lo += (\ord($data[$i + 2]) << 8) + \ord($data[$i + 3]);
53 $hi += $lo >> 16;
54 $lo = $lo & 0xffff;
55 $hi = $hi & 0xffff;
56 }
57 return ($hi << 8) + $lo;
58 }
59 function __construct(File $font)
60 {
61 $this->font = $font;
62 $this->f = $font->f;
63 }
64 function parse()
65 {
66 $this->tag = $this->font->read(4);
67 }
68 function open($filename, $mode = self::modeRead)
69 {
70 // void
71 }
72 function setTable(Table $font_table)
73 {
74 $this->font_table = $font_table;
75 }
76 function encode($entry_offset)
77 {
78 Font::d("\n==== {$this->tag} ====");
79 //Font::d("Entry offset = $entry_offset");
80 $data = $this->font_table;
81 $font = $this->font;
82 $table_offset = $font->pos();
83 $this->offset = $table_offset;
84 $table_length = $data->encode();
85 $font->seek($table_offset);
86 $table_data = $font->read($table_length);
87 $font->seek($entry_offset);
88 $font->write($this->tag, 4);
89 $font->writeUInt32(self::computeChecksum($table_data));
90 $font->writeUInt32($table_offset);
91 $font->writeUInt32($table_length);
92 Font::d("Bytes written = {$table_length}");
93 $font->seek($table_offset + $table_length);
94 }
95 /**
96 * @return File
97 */
98 function getFont()
99 {
100 return $this->font;
101 }
102 function startRead()
103 {
104 $this->font->seek($this->offset);
105 }
106 function endRead()
107 {
108 //
109 }
110 function startWrite()
111 {
112 $this->font->seek($this->offset);
113 }
114 function endWrite()
115 {
116 //
117 }
118 }
119