PluginProbe ʕ •ᴥ•ʔ
Matomo Analytics – Powerful, Privacy-First Insights for WordPress / 4.1.2
Matomo Analytics – Powerful, Privacy-First Insights for WordPress v4.1.2
5.13.0 5.12.1 5.12.0 5.11.1 5.11.0 5.10.2 5.10.1 trunk 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.3.0 1.3.1 1.3.2 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.1.0 4.1.1 4.1.2 4.1.3 4.10.0 4.11.0 4.12.0 4.13.0 4.13.2 4.13.3 4.13.4 4.13.5 4.14.0 4.14.1 4.14.2 4.15.0 4.15.1 4.15.2 4.15.3 4.2.0 4.3.0 4.3.1 4.4.1 4.4.2 4.5.0 4.6.0 5.0.1 5.0.2 5.0.3 5.0.4 5.0.5 5.0.6 5.0.7 5.0.8 5.1.0 5.1.1 5.1.2 5.1.3 5.1.4 5.1.5 5.1.6 5.1.7 5.10.0 5.2.0 5.2.1 5.2.2 5.3.0 5.3.1 5.3.2 5.3.3 5.6.0 5.6.1 5.7.0 5.7.1 5.8.0 5.8.1 5.8.2
matomo / app / vendor / opis / closure / src / ClosureStream.php
matomo / app / vendor / opis / closure / src Last commit date
Analyzer.php 5 years ago ClosureContext.php 5 years ago ClosureScope.php 5 years ago ClosureStream.php 5 years ago ISecurityProvider.php 5 years ago ReflectionClosure.php 5 years ago SecurityException.php 5 years ago SecurityProvider.php 5 years ago SelfReference.php 5 years ago SerializableClosure.php 5 years ago
ClosureStream.php
100 lines
1 <?php
2 /* ===========================================================================
3 * Copyright (c) 2018-2019 Zindex Software
4 *
5 * Licensed under the MIT License
6 * =========================================================================== */
7
8 namespace Opis\Closure;
9
10 /**
11 * @internal
12 */
13 class ClosureStream
14 {
15 const STREAM_PROTO = 'closure';
16
17 protected static $isRegistered = false;
18
19 protected $content;
20
21 protected $length;
22
23 protected $pointer = 0;
24
25 function stream_open($path, $mode, $options, &$opened_path)
26 {
27 $this->content = "<?php\nreturn " . substr($path, strlen(static::STREAM_PROTO . '://')) . ";";
28 $this->length = strlen($this->content);
29 return true;
30 }
31
32 public function stream_read($count)
33 {
34 $value = substr($this->content, $this->pointer, $count);
35 $this->pointer += $count;
36 return $value;
37 }
38
39 public function stream_eof()
40 {
41 return $this->pointer >= $this->length;
42 }
43
44 public function stream_set_option($option, $arg1, $arg2)
45 {
46 return false;
47 }
48
49 public function stream_stat()
50 {
51 $stat = stat(__FILE__);
52 $stat[7] = $stat['size'] = $this->length;
53 return $stat;
54 }
55
56 public function url_stat($path, $flags)
57 {
58 $stat = stat(__FILE__);
59 $stat[7] = $stat['size'] = $this->length;
60 return $stat;
61 }
62
63 public function stream_seek($offset, $whence = SEEK_SET)
64 {
65 $crt = $this->pointer;
66
67 switch ($whence) {
68 case SEEK_SET:
69 $this->pointer = $offset;
70 break;
71 case SEEK_CUR:
72 $this->pointer += $offset;
73 break;
74 case SEEK_END:
75 $this->pointer = $this->length + $offset;
76 break;
77 }
78
79 if ($this->pointer < 0 || $this->pointer >= $this->length) {
80 $this->pointer = $crt;
81 return false;
82 }
83
84 return true;
85 }
86
87 public function stream_tell()
88 {
89 return $this->pointer;
90 }
91
92 public static function register()
93 {
94 if (!static::$isRegistered) {
95 static::$isRegistered = stream_wrapper_register(static::STREAM_PROTO, __CLASS__);
96 }
97 }
98
99 }
100