Version Description
Download this release
Release Info
Developer | nico23 |
Plugin | ARVE Advanced Responsive Video Embedder (YouTube, Vimeo, HTML5 Video …) |
Version | 9.4.2 |
Comparing to | |
See all releases |
Code changes from version 9.4.1 to 9.4.2
- advanced-responsive-video-embedder.php +3 -5
- changelog.md +4 -0
- php/Admin/vendor/autoload.php +7 -0
- php/Admin/vendor/composer/ClassLoader.php +445 -0
- php/Admin/vendor/composer/LICENSE +21 -0
- php/Admin/vendor/composer/autoload_classmap.php +9 -0
- php/Admin/vendor/composer/autoload_files.php +11 -0
- php/Admin/vendor/composer/autoload_namespaces.php +9 -0
- php/Admin/vendor/composer/autoload_psr4.php +9 -0
- php/Admin/vendor/composer/autoload_real.php +73 -0
- php/Admin/vendor/composer/autoload_static.php +20 -0
- php/Admin/vendor/composer/installed.json +44 -0
- php/Admin/vendor/julien731/wp-dismissible-notices-handler/assets/js/main.js +15 -0
- php/Admin/vendor/julien731/wp-dismissible-notices-handler/composer.json +20 -0
- php/Admin/vendor/julien731/wp-dismissible-notices-handler/handler.php +604 -0
- php/Admin/vendor/julien731/wp-dismissible-notices-handler/includes/helper-functions.php +111 -0
- readme.txt +26 -2
advanced-responsive-video-embedder.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: ARVE Advanced Responsive Video Embedder
|
4 |
* Plugin URI: https://nextgenthemes.com/plugins/arve-pro/
|
5 |
* Description: Easy responsive video embeds via URL (like WordPress) or Shortcodes. Supports almost anything you can imagine.
|
6 |
-
* Version: 9.4.
|
7 |
* Author: Nicolas Jonas
|
8 |
* Author URI: https://nextgenthemes.com
|
9 |
* License: GPL-3.0
|
@@ -21,7 +21,7 @@
|
|
21 |
|
22 |
namespace Nextgenthemes\ARVE;
|
23 |
|
24 |
-
const VERSION = '9.4.
|
25 |
const PRO_VERSION_REQUIRED = '5.1.5';
|
26 |
const NUM_TRACKS = 3;
|
27 |
const PLUGIN_FILE = __FILE__;
|
@@ -57,9 +57,7 @@ function init_920() {
|
|
57 |
require_once PLUGIN_DIR . '/php/functions-settings.php';
|
58 |
|
59 |
if ( is_admin() ) {
|
60 |
-
|
61 |
-
require_once PLUGIN_DIR . '/vendor/autoload.php';
|
62 |
-
}
|
63 |
}
|
64 |
require_once PLUGIN_DIR . '/php/Admin/functions-admin.php';
|
65 |
require_once PLUGIN_DIR . '/php/Admin/functions-settings-page.php';
|
3 |
* Plugin Name: ARVE Advanced Responsive Video Embedder
|
4 |
* Plugin URI: https://nextgenthemes.com/plugins/arve-pro/
|
5 |
* Description: Easy responsive video embeds via URL (like WordPress) or Shortcodes. Supports almost anything you can imagine.
|
6 |
+
* Version: 9.4.2
|
7 |
* Author: Nicolas Jonas
|
8 |
* Author URI: https://nextgenthemes.com
|
9 |
* License: GPL-3.0
|
21 |
|
22 |
namespace Nextgenthemes\ARVE;
|
23 |
|
24 |
+
const VERSION = '9.4.2';
|
25 |
const PRO_VERSION_REQUIRED = '5.1.5';
|
26 |
const NUM_TRACKS = 3;
|
27 |
const PLUGIN_FILE = __FILE__;
|
57 |
require_once PLUGIN_DIR . '/php/functions-settings.php';
|
58 |
|
59 |
if ( is_admin() ) {
|
60 |
+
require_once PLUGIN_DIR . '/php/Admin/vendor/autoload.php';
|
|
|
|
|
61 |
}
|
62 |
require_once PLUGIN_DIR . '/php/Admin/functions-admin.php';
|
63 |
require_once PLUGIN_DIR . '/php/Admin/functions-settings-page.php';
|
changelog.md
CHANGED
@@ -4,6 +4,10 @@
|
|
4 |
* [ARVE Pro changelog](https://nextgenthemes.com/plugins/arve-pro/#changelog)
|
5 |
* [ARVE Random Videos changelog](https://nextgenthemes.com/plugins/random-video/#changelog)
|
6 |
|
|
|
|
|
|
|
|
|
7 |
### 2021-01-28 9.4.1 ###
|
8 |
|
9 |
* Fix: (hopefully) Non dismissible admin notices. Also removed the notice that came with 9.0-beta completely.
|
4 |
* [ARVE Pro changelog](https://nextgenthemes.com/plugins/arve-pro/#changelog)
|
5 |
* [ARVE Random Videos changelog](https://nextgenthemes.com/plugins/random-video/#changelog)
|
6 |
|
7 |
+
### 2021-01-28 9.4.2 ###
|
8 |
+
|
9 |
+
* Fix: Include new library for notices.
|
10 |
+
|
11 |
### 2021-01-28 9.4.1 ###
|
12 |
|
13 |
* Fix: (hopefully) Non dismissible admin notices. Also removed the notice that came with 9.0-beta completely.
|
php/Admin/vendor/autoload.php
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload.php @generated by Composer
|
4 |
+
|
5 |
+
require_once __DIR__ . '/composer/autoload_real.php';
|
6 |
+
|
7 |
+
return ComposerAutoloaderInitaf41d04bdafc625aeb08cb6c03a36d8f::getLoader();
|
php/Admin/vendor/composer/ClassLoader.php
ADDED
@@ -0,0 +1,445 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/*
|
4 |
+
* This file is part of Composer.
|
5 |
+
*
|
6 |
+
* (c) Nils Adermann <naderman@naderman.de>
|
7 |
+
* Jordi Boggiano <j.boggiano@seld.be>
|
8 |
+
*
|
9 |
+
* For the full copyright and license information, please view the LICENSE
|
10 |
+
* file that was distributed with this source code.
|
11 |
+
*/
|
12 |
+
|
13 |
+
namespace Composer\Autoload;
|
14 |
+
|
15 |
+
/**
|
16 |
+
* ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
|
17 |
+
*
|
18 |
+
* $loader = new \Composer\Autoload\ClassLoader();
|
19 |
+
*
|
20 |
+
* // register classes with namespaces
|
21 |
+
* $loader->add('Symfony\Component', __DIR__.'/component');
|
22 |
+
* $loader->add('Symfony', __DIR__.'/framework');
|
23 |
+
*
|
24 |
+
* // activate the autoloader
|
25 |
+
* $loader->register();
|
26 |
+
*
|
27 |
+
* // to enable searching the include path (eg. for PEAR packages)
|
28 |
+
* $loader->setUseIncludePath(true);
|
29 |
+
*
|
30 |
+
* In this example, if you try to use a class in the Symfony\Component
|
31 |
+
* namespace or one of its children (Symfony\Component\Console for instance),
|
32 |
+
* the autoloader will first look for the class under the component/
|
33 |
+
* directory, and it will then fallback to the framework/ directory if not
|
34 |
+
* found before giving up.
|
35 |
+
*
|
36 |
+
* This class is loosely based on the Symfony UniversalClassLoader.
|
37 |
+
*
|
38 |
+
* @author Fabien Potencier <fabien@symfony.com>
|
39 |
+
* @author Jordi Boggiano <j.boggiano@seld.be>
|
40 |
+
* @see http://www.php-fig.org/psr/psr-0/
|
41 |
+
* @see http://www.php-fig.org/psr/psr-4/
|
42 |
+
*/
|
43 |
+
class ClassLoader
|
44 |
+
{
|
45 |
+
// PSR-4
|
46 |
+
private $prefixLengthsPsr4 = array();
|
47 |
+
private $prefixDirsPsr4 = array();
|
48 |
+
private $fallbackDirsPsr4 = array();
|
49 |
+
|
50 |
+
// PSR-0
|
51 |
+
private $prefixesPsr0 = array();
|
52 |
+
private $fallbackDirsPsr0 = array();
|
53 |
+
|
54 |
+
private $useIncludePath = false;
|
55 |
+
private $classMap = array();
|
56 |
+
private $classMapAuthoritative = false;
|
57 |
+
private $missingClasses = array();
|
58 |
+
private $apcuPrefix;
|
59 |
+
|
60 |
+
public function getPrefixes()
|
61 |
+
{
|
62 |
+
if (!empty($this->prefixesPsr0)) {
|
63 |
+
return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
|
64 |
+
}
|
65 |
+
|
66 |
+
return array();
|
67 |
+
}
|
68 |
+
|
69 |
+
public function getPrefixesPsr4()
|
70 |
+
{
|
71 |
+
return $this->prefixDirsPsr4;
|
72 |
+
}
|
73 |
+
|
74 |
+
public function getFallbackDirs()
|
75 |
+
{
|
76 |
+
return $this->fallbackDirsPsr0;
|
77 |
+
}
|
78 |
+
|
79 |
+
public function getFallbackDirsPsr4()
|
80 |
+
{
|
81 |
+
return $this->fallbackDirsPsr4;
|
82 |
+
}
|
83 |
+
|
84 |
+
public function getClassMap()
|
85 |
+
{
|
86 |
+
return $this->classMap;
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* @param array $classMap Class to filename map
|
91 |
+
*/
|
92 |
+
public function addClassMap(array $classMap)
|
93 |
+
{
|
94 |
+
if ($this->classMap) {
|
95 |
+
$this->classMap = array_merge($this->classMap, $classMap);
|
96 |
+
} else {
|
97 |
+
$this->classMap = $classMap;
|
98 |
+
}
|
99 |
+
}
|
100 |
+
|
101 |
+
/**
|
102 |
+
* Registers a set of PSR-0 directories for a given prefix, either
|
103 |
+
* appending or prepending to the ones previously set for this prefix.
|
104 |
+
*
|
105 |
+
* @param string $prefix The prefix
|
106 |
+
* @param array|string $paths The PSR-0 root directories
|
107 |
+
* @param bool $prepend Whether to prepend the directories
|
108 |
+
*/
|
109 |
+
public function add($prefix, $paths, $prepend = false)
|
110 |
+
{
|
111 |
+
if (!$prefix) {
|
112 |
+
if ($prepend) {
|
113 |
+
$this->fallbackDirsPsr0 = array_merge(
|
114 |
+
(array) $paths,
|
115 |
+
$this->fallbackDirsPsr0
|
116 |
+
);
|
117 |
+
} else {
|
118 |
+
$this->fallbackDirsPsr0 = array_merge(
|
119 |
+
$this->fallbackDirsPsr0,
|
120 |
+
(array) $paths
|
121 |
+
);
|
122 |
+
}
|
123 |
+
|
124 |
+
return;
|
125 |
+
}
|
126 |
+
|
127 |
+
$first = $prefix[0];
|
128 |
+
if (!isset($this->prefixesPsr0[$first][$prefix])) {
|
129 |
+
$this->prefixesPsr0[$first][$prefix] = (array) $paths;
|
130 |
+
|
131 |
+
return;
|
132 |
+
}
|
133 |
+
if ($prepend) {
|
134 |
+
$this->prefixesPsr0[$first][$prefix] = array_merge(
|
135 |
+
(array) $paths,
|
136 |
+
$this->prefixesPsr0[$first][$prefix]
|
137 |
+
);
|
138 |
+
} else {
|
139 |
+
$this->prefixesPsr0[$first][$prefix] = array_merge(
|
140 |
+
$this->prefixesPsr0[$first][$prefix],
|
141 |
+
(array) $paths
|
142 |
+
);
|
143 |
+
}
|
144 |
+
}
|
145 |
+
|
146 |
+
/**
|
147 |
+
* Registers a set of PSR-4 directories for a given namespace, either
|
148 |
+
* appending or prepending to the ones previously set for this namespace.
|
149 |
+
*
|
150 |
+
* @param string $prefix The prefix/namespace, with trailing '\\'
|
151 |
+
* @param array|string $paths The PSR-4 base directories
|
152 |
+
* @param bool $prepend Whether to prepend the directories
|
153 |
+
*
|
154 |
+
* @throws \InvalidArgumentException
|
155 |
+
*/
|
156 |
+
public function addPsr4($prefix, $paths, $prepend = false)
|
157 |
+
{
|
158 |
+
if (!$prefix) {
|
159 |
+
// Register directories for the root namespace.
|
160 |
+
if ($prepend) {
|
161 |
+
$this->fallbackDirsPsr4 = array_merge(
|
162 |
+
(array) $paths,
|
163 |
+
$this->fallbackDirsPsr4
|
164 |
+
);
|
165 |
+
} else {
|
166 |
+
$this->fallbackDirsPsr4 = array_merge(
|
167 |
+
$this->fallbackDirsPsr4,
|
168 |
+
(array) $paths
|
169 |
+
);
|
170 |
+
}
|
171 |
+
} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
|
172 |
+
// Register directories for a new namespace.
|
173 |
+
$length = strlen($prefix);
|
174 |
+
if ('\\' !== $prefix[$length - 1]) {
|
175 |
+
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
|
176 |
+
}
|
177 |
+
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
|
178 |
+
$this->prefixDirsPsr4[$prefix] = (array) $paths;
|
179 |
+
} elseif ($prepend) {
|
180 |
+
// Prepend directories for an already registered namespace.
|
181 |
+
$this->prefixDirsPsr4[$prefix] = array_merge(
|
182 |
+
(array) $paths,
|
183 |
+
$this->prefixDirsPsr4[$prefix]
|
184 |
+
);
|
185 |
+
} else {
|
186 |
+
// Append directories for an already registered namespace.
|
187 |
+
$this->prefixDirsPsr4[$prefix] = array_merge(
|
188 |
+
$this->prefixDirsPsr4[$prefix],
|
189 |
+
(array) $paths
|
190 |
+
);
|
191 |
+
}
|
192 |
+
}
|
193 |
+
|
194 |
+
/**
|
195 |
+
* Registers a set of PSR-0 directories for a given prefix,
|
196 |
+
* replacing any others previously set for this prefix.
|
197 |
+
*
|
198 |
+
* @param string $prefix The prefix
|
199 |
+
* @param array|string $paths The PSR-0 base directories
|
200 |
+
*/
|
201 |
+
public function set($prefix, $paths)
|
202 |
+
{
|
203 |
+
if (!$prefix) {
|
204 |
+
$this->fallbackDirsPsr0 = (array) $paths;
|
205 |
+
} else {
|
206 |
+
$this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
|
207 |
+
}
|
208 |
+
}
|
209 |
+
|
210 |
+
/**
|
211 |
+
* Registers a set of PSR-4 directories for a given namespace,
|
212 |
+
* replacing any others previously set for this namespace.
|
213 |
+
*
|
214 |
+
* @param string $prefix The prefix/namespace, with trailing '\\'
|
215 |
+
* @param array|string $paths The PSR-4 base directories
|
216 |
+
*
|
217 |
+
* @throws \InvalidArgumentException
|
218 |
+
*/
|
219 |
+
public function setPsr4($prefix, $paths)
|
220 |
+
{
|
221 |
+
if (!$prefix) {
|
222 |
+
$this->fallbackDirsPsr4 = (array) $paths;
|
223 |
+
} else {
|
224 |
+
$length = strlen($prefix);
|
225 |
+
if ('\\' !== $prefix[$length - 1]) {
|
226 |
+
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
|
227 |
+
}
|
228 |
+
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
|
229 |
+
$this->prefixDirsPsr4[$prefix] = (array) $paths;
|
230 |
+
}
|
231 |
+
}
|
232 |
+
|
233 |
+
/**
|
234 |
+
* Turns on searching the include path for class files.
|
235 |
+
*
|
236 |
+
* @param bool $useIncludePath
|
237 |
+
*/
|
238 |
+
public function setUseIncludePath($useIncludePath)
|
239 |
+
{
|
240 |
+
$this->useIncludePath = $useIncludePath;
|
241 |
+
}
|
242 |
+
|
243 |
+
/**
|
244 |
+
* Can be used to check if the autoloader uses the include path to check
|
245 |
+
* for classes.
|
246 |
+
*
|
247 |
+
* @return bool
|
248 |
+
*/
|
249 |
+
public function getUseIncludePath()
|
250 |
+
{
|
251 |
+
return $this->useIncludePath;
|
252 |
+
}
|
253 |
+
|
254 |
+
/**
|
255 |
+
* Turns off searching the prefix and fallback directories for classes
|
256 |
+
* that have not been registered with the class map.
|
257 |
+
*
|
258 |
+
* @param bool $classMapAuthoritative
|
259 |
+
*/
|
260 |
+
public function setClassMapAuthoritative($classMapAuthoritative)
|
261 |
+
{
|
262 |
+
$this->classMapAuthoritative = $classMapAuthoritative;
|
263 |
+
}
|
264 |
+
|
265 |
+
/**
|
266 |
+
* Should class lookup fail if not found in the current class map?
|
267 |
+
*
|
268 |
+
* @return bool
|
269 |
+
*/
|
270 |
+
public function isClassMapAuthoritative()
|
271 |
+
{
|
272 |
+
return $this->classMapAuthoritative;
|
273 |
+
}
|
274 |
+
|
275 |
+
/**
|
276 |
+
* APCu prefix to use to cache found/not-found classes, if the extension is enabled.
|
277 |
+
*
|
278 |
+
* @param string|null $apcuPrefix
|
279 |
+
*/
|
280 |
+
public function setApcuPrefix($apcuPrefix)
|
281 |
+
{
|
282 |
+
$this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
|
283 |
+
}
|
284 |
+
|
285 |
+
/**
|
286 |
+
* The APCu prefix in use, or null if APCu caching is not enabled.
|
287 |
+
*
|
288 |
+
* @return string|null
|
289 |
+
*/
|
290 |
+
public function getApcuPrefix()
|
291 |
+
{
|
292 |
+
return $this->apcuPrefix;
|
293 |
+
}
|
294 |
+
|
295 |
+
/**
|
296 |
+
* Registers this instance as an autoloader.
|
297 |
+
*
|
298 |
+
* @param bool $prepend Whether to prepend the autoloader or not
|
299 |
+
*/
|
300 |
+
public function register($prepend = false)
|
301 |
+
{
|
302 |
+
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
|
303 |
+
}
|
304 |
+
|
305 |
+
/**
|
306 |
+
* Unregisters this instance as an autoloader.
|
307 |
+
*/
|
308 |
+
public function unregister()
|
309 |
+
{
|
310 |
+
spl_autoload_unregister(array($this, 'loadClass'));
|
311 |
+
}
|
312 |
+
|
313 |
+
/**
|
314 |
+
* Loads the given class or interface.
|
315 |
+
*
|
316 |
+
* @param string $class The name of the class
|
317 |
+
* @return bool|null True if loaded, null otherwise
|
318 |
+
*/
|
319 |
+
public function loadClass($class)
|
320 |
+
{
|
321 |
+
if ($file = $this->findFile($class)) {
|
322 |
+
includeFile($file);
|
323 |
+
|
324 |
+
return true;
|
325 |
+
}
|
326 |
+
}
|
327 |
+
|
328 |
+
/**
|
329 |
+
* Finds the path to the file where the class is defined.
|
330 |
+
*
|
331 |
+
* @param string $class The name of the class
|
332 |
+
*
|
333 |
+
* @return string|false The path if found, false otherwise
|
334 |
+
*/
|
335 |
+
public function findFile($class)
|
336 |
+
{
|
337 |
+
// class map lookup
|
338 |
+
if (isset($this->classMap[$class])) {
|
339 |
+
return $this->classMap[$class];
|
340 |
+
}
|
341 |
+
if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
|
342 |
+
return false;
|
343 |
+
}
|
344 |
+
if (null !== $this->apcuPrefix) {
|
345 |
+
$file = apcu_fetch($this->apcuPrefix.$class, $hit);
|
346 |
+
if ($hit) {
|
347 |
+
return $file;
|
348 |
+
}
|
349 |
+
}
|
350 |
+
|
351 |
+
$file = $this->findFileWithExtension($class, '.php');
|
352 |
+
|
353 |
+
// Search for Hack files if we are running on HHVM
|
354 |
+
if (false === $file && defined('HHVM_VERSION')) {
|
355 |
+
$file = $this->findFileWithExtension($class, '.hh');
|
356 |
+
}
|
357 |
+
|
358 |
+
if (null !== $this->apcuPrefix) {
|
359 |
+
apcu_add($this->apcuPrefix.$class, $file);
|
360 |
+
}
|
361 |
+
|
362 |
+
if (false === $file) {
|
363 |
+
// Remember that this class does not exist.
|
364 |
+
$this->missingClasses[$class] = true;
|
365 |
+
}
|
366 |
+
|
367 |
+
return $file;
|
368 |
+
}
|
369 |
+
|
370 |
+
private function findFileWithExtension($class, $ext)
|
371 |
+
{
|
372 |
+
// PSR-4 lookup
|
373 |
+
$logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
|
374 |
+
|
375 |
+
$first = $class[0];
|
376 |
+
if (isset($this->prefixLengthsPsr4[$first])) {
|
377 |
+
$subPath = $class;
|
378 |
+
while (false !== $lastPos = strrpos($subPath, '\\')) {
|
379 |
+
$subPath = substr($subPath, 0, $lastPos);
|
380 |
+
$search = $subPath . '\\';
|
381 |
+
if (isset($this->prefixDirsPsr4[$search])) {
|
382 |
+
$pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
|
383 |
+
foreach ($this->prefixDirsPsr4[$search] as $dir) {
|
384 |
+
if (file_exists($file = $dir . $pathEnd)) {
|
385 |
+
return $file;
|
386 |
+
}
|
387 |
+
}
|
388 |
+
}
|
389 |
+
}
|
390 |
+
}
|
391 |
+
|
392 |
+
// PSR-4 fallback dirs
|
393 |
+
foreach ($this->fallbackDirsPsr4 as $dir) {
|
394 |
+
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
|
395 |
+
return $file;
|
396 |
+
}
|
397 |
+
}
|
398 |
+
|
399 |
+
// PSR-0 lookup
|
400 |
+
if (false !== $pos = strrpos($class, '\\')) {
|
401 |
+
// namespaced class name
|
402 |
+
$logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
|
403 |
+
. strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
|
404 |
+
} else {
|
405 |
+
// PEAR-like class name
|
406 |
+
$logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
|
407 |
+
}
|
408 |
+
|
409 |
+
if (isset($this->prefixesPsr0[$first])) {
|
410 |
+
foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
|
411 |
+
if (0 === strpos($class, $prefix)) {
|
412 |
+
foreach ($dirs as $dir) {
|
413 |
+
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
414 |
+
return $file;
|
415 |
+
}
|
416 |
+
}
|
417 |
+
}
|
418 |
+
}
|
419 |
+
}
|
420 |
+
|
421 |
+
// PSR-0 fallback dirs
|
422 |
+
foreach ($this->fallbackDirsPsr0 as $dir) {
|
423 |
+
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
424 |
+
return $file;
|
425 |
+
}
|
426 |
+
}
|
427 |
+
|
428 |
+
// PSR-0 include paths.
|
429 |
+
if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
|
430 |
+
return $file;
|
431 |
+
}
|
432 |
+
|
433 |
+
return false;
|
434 |
+
}
|
435 |
+
}
|
436 |
+
|
437 |
+
/**
|
438 |
+
* Scope isolated include.
|
439 |
+
*
|
440 |
+
* Prevents access to $this/self from included files.
|
441 |
+
*/
|
442 |
+
function includeFile($file)
|
443 |
+
{
|
444 |
+
include $file;
|
445 |
+
}
|
php/Admin/vendor/composer/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
Copyright (c) Nils Adermann, Jordi Boggiano
|
3 |
+
|
4 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
5 |
+
of this software and associated documentation files (the "Software"), to deal
|
6 |
+
in the Software without restriction, including without limitation the rights
|
7 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8 |
+
copies of the Software, and to permit persons to whom the Software is furnished
|
9 |
+
to do so, subject to the following conditions:
|
10 |
+
|
11 |
+
The above copyright notice and this permission notice shall be included in all
|
12 |
+
copies or substantial portions of the Software.
|
13 |
+
|
14 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
16 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
17 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
18 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
19 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
20 |
+
THE SOFTWARE.
|
21 |
+
|
php/Admin/vendor/composer/autoload_classmap.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload_classmap.php @generated by Composer
|
4 |
+
|
5 |
+
$vendorDir = dirname(dirname(__FILE__));
|
6 |
+
$baseDir = dirname(dirname(dirname($vendorDir)));
|
7 |
+
|
8 |
+
return array(
|
9 |
+
);
|
php/Admin/vendor/composer/autoload_files.php
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload_files.php @generated by Composer
|
4 |
+
|
5 |
+
$vendorDir = dirname(dirname(__FILE__));
|
6 |
+
$baseDir = dirname(dirname(dirname($vendorDir)));
|
7 |
+
|
8 |
+
return array(
|
9 |
+
'c14057a02afc95b84dc5bf85d98c5b66' => $vendorDir . '/julien731/wp-dismissible-notices-handler/handler.php',
|
10 |
+
'ff8834a662873e3e689a4283b27598d2' => $vendorDir . '/julien731/wp-dismissible-notices-handler/includes/helper-functions.php',
|
11 |
+
);
|
php/Admin/vendor/composer/autoload_namespaces.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload_namespaces.php @generated by Composer
|
4 |
+
|
5 |
+
$vendorDir = dirname(dirname(__FILE__));
|
6 |
+
$baseDir = dirname(dirname(dirname($vendorDir)));
|
7 |
+
|
8 |
+
return array(
|
9 |
+
);
|
php/Admin/vendor/composer/autoload_psr4.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload_psr4.php @generated by Composer
|
4 |
+
|
5 |
+
$vendorDir = dirname(dirname(__FILE__));
|
6 |
+
$baseDir = dirname(dirname(dirname($vendorDir)));
|
7 |
+
|
8 |
+
return array(
|
9 |
+
);
|
php/Admin/vendor/composer/autoload_real.php
ADDED
@@ -0,0 +1,73 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload_real.php @generated by Composer
|
4 |
+
|
5 |
+
class ComposerAutoloaderInitaf41d04bdafc625aeb08cb6c03a36d8f
|
6 |
+
{
|
7 |
+
private static $loader;
|
8 |
+
|
9 |
+
public static function loadClassLoader($class)
|
10 |
+
{
|
11 |
+
if ('Composer\Autoload\ClassLoader' === $class) {
|
12 |
+
require __DIR__ . '/ClassLoader.php';
|
13 |
+
}
|
14 |
+
}
|
15 |
+
|
16 |
+
/**
|
17 |
+
* @return \Composer\Autoload\ClassLoader
|
18 |
+
*/
|
19 |
+
public static function getLoader()
|
20 |
+
{
|
21 |
+
if (null !== self::$loader) {
|
22 |
+
return self::$loader;
|
23 |
+
}
|
24 |
+
|
25 |
+
spl_autoload_register(array('ComposerAutoloaderInitaf41d04bdafc625aeb08cb6c03a36d8f', 'loadClassLoader'), true, true);
|
26 |
+
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
27 |
+
spl_autoload_unregister(array('ComposerAutoloaderInitaf41d04bdafc625aeb08cb6c03a36d8f', 'loadClassLoader'));
|
28 |
+
|
29 |
+
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
30 |
+
if ($useStaticLoader) {
|
31 |
+
require_once __DIR__ . '/autoload_static.php';
|
32 |
+
|
33 |
+
call_user_func(\Composer\Autoload\ComposerStaticInitaf41d04bdafc625aeb08cb6c03a36d8f::getInitializer($loader));
|
34 |
+
} else {
|
35 |
+
$map = require __DIR__ . '/autoload_namespaces.php';
|
36 |
+
foreach ($map as $namespace => $path) {
|
37 |
+
$loader->set($namespace, $path);
|
38 |
+
}
|
39 |
+
|
40 |
+
$map = require __DIR__ . '/autoload_psr4.php';
|
41 |
+
foreach ($map as $namespace => $path) {
|
42 |
+
$loader->setPsr4($namespace, $path);
|
43 |
+
}
|
44 |
+
|
45 |
+
$classMap = require __DIR__ . '/autoload_classmap.php';
|
46 |
+
if ($classMap) {
|
47 |
+
$loader->addClassMap($classMap);
|
48 |
+
}
|
49 |
+
}
|
50 |
+
|
51 |
+
$loader->register(true);
|
52 |
+
|
53 |
+
if ($useStaticLoader) {
|
54 |
+
$includeFiles = Composer\Autoload\ComposerStaticInitaf41d04bdafc625aeb08cb6c03a36d8f::$files;
|
55 |
+
} else {
|
56 |
+
$includeFiles = require __DIR__ . '/autoload_files.php';
|
57 |
+
}
|
58 |
+
foreach ($includeFiles as $fileIdentifier => $file) {
|
59 |
+
composerRequireaf41d04bdafc625aeb08cb6c03a36d8f($fileIdentifier, $file);
|
60 |
+
}
|
61 |
+
|
62 |
+
return $loader;
|
63 |
+
}
|
64 |
+
}
|
65 |
+
|
66 |
+
function composerRequireaf41d04bdafc625aeb08cb6c03a36d8f($fileIdentifier, $file)
|
67 |
+
{
|
68 |
+
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
69 |
+
require $file;
|
70 |
+
|
71 |
+
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
72 |
+
}
|
73 |
+
}
|
php/Admin/vendor/composer/autoload_static.php
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload_static.php @generated by Composer
|
4 |
+
|
5 |
+
namespace Composer\Autoload;
|
6 |
+
|
7 |
+
class ComposerStaticInitaf41d04bdafc625aeb08cb6c03a36d8f
|
8 |
+
{
|
9 |
+
public static $files = array (
|
10 |
+
'c14057a02afc95b84dc5bf85d98c5b66' => __DIR__ . '/..' . '/julien731/wp-dismissible-notices-handler/handler.php',
|
11 |
+
'ff8834a662873e3e689a4283b27598d2' => __DIR__ . '/..' . '/julien731/wp-dismissible-notices-handler/includes/helper-functions.php',
|
12 |
+
);
|
13 |
+
|
14 |
+
public static function getInitializer(ClassLoader $loader)
|
15 |
+
{
|
16 |
+
return \Closure::bind(function () use ($loader) {
|
17 |
+
|
18 |
+
}, null, ClassLoader::class);
|
19 |
+
}
|
20 |
+
}
|
php/Admin/vendor/composer/installed.json
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[
|
2 |
+
{
|
3 |
+
"name": "julien731/wp-dismissible-notices-handler",
|
4 |
+
"version": "1.2.1",
|
5 |
+
"version_normalized": "1.2.1.0",
|
6 |
+
"source": {
|
7 |
+
"type": "git",
|
8 |
+
"url": "https://github.com/julien731/WP-Dismissible-Notices-Handler.git",
|
9 |
+
"reference": "e5c11a5bd490405f162213c45fb579ba8a9ae992"
|
10 |
+
},
|
11 |
+
"dist": {
|
12 |
+
"type": "zip",
|
13 |
+
"url": "https://api.github.com/repos/julien731/WP-Dismissible-Notices-Handler/zipball/e5c11a5bd490405f162213c45fb579ba8a9ae992",
|
14 |
+
"reference": "e5c11a5bd490405f162213c45fb579ba8a9ae992",
|
15 |
+
"shasum": ""
|
16 |
+
},
|
17 |
+
"require": {
|
18 |
+
"php": ">=5.5.0"
|
19 |
+
},
|
20 |
+
"time": "2021-01-15T10:27:28+00:00",
|
21 |
+
"type": "library",
|
22 |
+
"installation-source": "dist",
|
23 |
+
"autoload": {
|
24 |
+
"files": [
|
25 |
+
"handler.php",
|
26 |
+
"includes/helper-functions.php"
|
27 |
+
]
|
28 |
+
},
|
29 |
+
"notification-url": "https://packagist.org/downloads/",
|
30 |
+
"license": [
|
31 |
+
"GNU GPL"
|
32 |
+
],
|
33 |
+
"authors": [
|
34 |
+
{
|
35 |
+
"name": "Julien Liabeuf",
|
36 |
+
"email": "julien@liabeuf.fr",
|
37 |
+
"homepage": "https://julienliabeuf.com",
|
38 |
+
"role": "Lead Developer"
|
39 |
+
}
|
40 |
+
],
|
41 |
+
"description": "A simple library to handle Ajax-dismissible admin notices for WordPress",
|
42 |
+
"homepage": "https://github.com/julien731/WP-Dismissible-Notices-Handler"
|
43 |
+
}
|
44 |
+
]
|
php/Admin/vendor/julien731/wp-dismissible-notices-handler/assets/js/main.js
ADDED
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
jQuery(document).ready(function($) {
|
2 |
+
$( '.notice.is-dismissible' ).on('click', '.notice-dismiss', function ( event ) {
|
3 |
+
event.preventDefault();
|
4 |
+
var $this = $(this);
|
5 |
+
if( 'undefined' == $this.parent().attr('id') ){
|
6 |
+
return;
|
7 |
+
}
|
8 |
+
$.post( ajaxurl, {
|
9 |
+
action: 'dnh_dismiss_notice',
|
10 |
+
url: ajaxurl,
|
11 |
+
id: $this.parent().attr('id')
|
12 |
+
});
|
13 |
+
|
14 |
+
});
|
15 |
+
});
|
php/Admin/vendor/julien731/wp-dismissible-notices-handler/composer.json
ADDED
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "julien731/wp-dismissible-notices-handler",
|
3 |
+
"description": "A simple library to handle Ajax-dismissible admin notices for WordPress",
|
4 |
+
"homepage": "https://github.com/julien731/WP-Dismissible-Notices-Handler",
|
5 |
+
"license": "GNU GPL",
|
6 |
+
"authors": [
|
7 |
+
{
|
8 |
+
"name": "Julien Liabeuf",
|
9 |
+
"email": "julien@liabeuf.fr",
|
10 |
+
"homepage": "https://julienliabeuf.com",
|
11 |
+
"role": "Lead Developer"
|
12 |
+
}
|
13 |
+
],
|
14 |
+
"require": {
|
15 |
+
"php": ">=5.5.0"
|
16 |
+
},
|
17 |
+
"autoload": {
|
18 |
+
"files": ["handler.php", "includes/helper-functions.php"]
|
19 |
+
}
|
20 |
+
}
|
php/Admin/vendor/julien731/wp-dismissible-notices-handler/handler.php
ADDED
@@ -0,0 +1,604 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Dismissible Notices Handler.
|
4 |
+
*
|
5 |
+
* This library is designed to handle dismissible admin notices.
|
6 |
+
*
|
7 |
+
* LICENSE: This program is free software; you can redistribute it and/or modify it under the terms of the GNU
|
8 |
+
* General Public License as published by the Free Software Foundation; either version 3 of the License, or (at
|
9 |
+
* your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
10 |
+
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
11 |
+
* General Public License for more details. You should have received a copy of the GNU General Public License along
|
12 |
+
* with this program. If not, see <http://opensource.org/licenses/gpl-license.php>
|
13 |
+
*
|
14 |
+
* @package Dismissible Notices Handler
|
15 |
+
* @author Julien Liabeuf <julien@liabeuf.fr>
|
16 |
+
* @version 1.2.0
|
17 |
+
* @license GPL-2.0+
|
18 |
+
* @link https://julienliabeuf.com
|
19 |
+
* @copyright 2018 Julien Liabeuf
|
20 |
+
*/
|
21 |
+
|
22 |
+
if ( ! class_exists( 'Dismissible_Notices_Handler' ) ) {
|
23 |
+
|
24 |
+
final class Dismissible_Notices_Handler {
|
25 |
+
|
26 |
+
/**
|
27 |
+
* @var Dismissible_Notices_Handler Holds the unique instance of the handler
|
28 |
+
* @since 1.0
|
29 |
+
*/
|
30 |
+
private static $instance;
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Library version
|
34 |
+
*
|
35 |
+
* @since 1.0
|
36 |
+
* @var string
|
37 |
+
*/
|
38 |
+
public $version = '1.2.1';
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Required version of PHP.
|
42 |
+
*
|
43 |
+
* @since 1.0
|
44 |
+
* @var string
|
45 |
+
*/
|
46 |
+
public $php_version_required = '5.5';
|
47 |
+
|
48 |
+
/**
|
49 |
+
* Minimum version of WordPress required to use the library
|
50 |
+
*
|
51 |
+
* @since 1.0
|
52 |
+
* @var string
|
53 |
+
*/
|
54 |
+
public $wordpress_version_required = '4.7';
|
55 |
+
|
56 |
+
/**
|
57 |
+
* @var array Holds all our registered notices
|
58 |
+
* @since 1.0
|
59 |
+
*/
|
60 |
+
private $notices;
|
61 |
+
|
62 |
+
/**
|
63 |
+
* Instantiate and return the unique Dismissible_Notices_Handler object
|
64 |
+
*
|
65 |
+
* @since 1.0
|
66 |
+
* @return object Dismissible_Notices_Handler Unique instance of the handler
|
67 |
+
*/
|
68 |
+
public static function instance() {
|
69 |
+
|
70 |
+
if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Dismissible_Notices_Handler ) ) {
|
71 |
+
self::$instance = new Dismissible_Notices_Handler;
|
72 |
+
self::$instance->init();
|
73 |
+
}
|
74 |
+
|
75 |
+
return self::$instance;
|
76 |
+
|
77 |
+
}
|
78 |
+
|
79 |
+
/**
|
80 |
+
* Initialize the library
|
81 |
+
*
|
82 |
+
* @since 1.0
|
83 |
+
* @return void
|
84 |
+
*/
|
85 |
+
private function init() {
|
86 |
+
|
87 |
+
// Make sure WordPress is compatible
|
88 |
+
if ( ! self::$instance->is_wp_compatible() ) {
|
89 |
+
self::$instance->spit_error(
|
90 |
+
sprintf(
|
91 |
+
/* translators: %s: required wordpress version */
|
92 |
+
esc_html__( 'The library can not be used because your version of WordPress is too old. You need version %s at least.', 'wp-dismissible-notices-handler' ),
|
93 |
+
self::$instance->wordpress_version_required
|
94 |
+
)
|
95 |
+
);
|
96 |
+
|
97 |
+
return;
|
98 |
+
}
|
99 |
+
|
100 |
+
// Make sure PHP is compatible
|
101 |
+
if ( ! self::$instance->is_php_compatible() ) {
|
102 |
+
self::$instance->spit_error(
|
103 |
+
sprintf(
|
104 |
+
/* translators: %s: required php version */
|
105 |
+
esc_html__( 'The library can not be used because your version of PHP is too old. You need version %s at least.', 'wp-dismissible-notices-handler' ),
|
106 |
+
self::$instance->php_version_required
|
107 |
+
)
|
108 |
+
);
|
109 |
+
|
110 |
+
return;
|
111 |
+
}
|
112 |
+
|
113 |
+
add_action( 'admin_notices', array( self::$instance, 'display' ) );
|
114 |
+
add_action( 'admin_print_scripts', array( self::$instance, 'load_script' ) );
|
115 |
+
add_action( 'wp_ajax_dnh_dismiss_notice', array( self::$instance, 'dismiss_notice_ajax' ) );
|
116 |
+
|
117 |
+
}
|
118 |
+
|
119 |
+
/**
|
120 |
+
* Check if the current WordPress version fits the requirements
|
121 |
+
*
|
122 |
+
* @since 1.0
|
123 |
+
* @return boolean
|
124 |
+
*/
|
125 |
+
private function is_wp_compatible() {
|
126 |
+
|
127 |
+
if ( version_compare( get_bloginfo( 'version' ), self::$instance->wordpress_version_required, '<' ) ) {
|
128 |
+
return false;
|
129 |
+
}
|
130 |
+
|
131 |
+
return true;
|
132 |
+
|
133 |
+
}
|
134 |
+
|
135 |
+
/**
|
136 |
+
* Check if the version of PHP is compatible with this library
|
137 |
+
*
|
138 |
+
* @since 1.0
|
139 |
+
* @return boolean
|
140 |
+
*/
|
141 |
+
private function is_php_compatible() {
|
142 |
+
|
143 |
+
if ( version_compare( phpversion(), self::$instance->php_version_required, '<' ) ) {
|
144 |
+
return false;
|
145 |
+
}
|
146 |
+
|
147 |
+
return true;
|
148 |
+
|
149 |
+
}
|
150 |
+
|
151 |
+
/**
|
152 |
+
* Load the script
|
153 |
+
*
|
154 |
+
* @since 1.0
|
155 |
+
* @return void
|
156 |
+
*/
|
157 |
+
public function load_script() {
|
158 |
+
wp_register_script( 'dnh', trailingslashit( plugin_dir_url( __FILE__ ) ) . 'assets/js/main.js', array( 'jquery' ), self::$instance->version, true );
|
159 |
+
wp_enqueue_script( 'dnh' );
|
160 |
+
}
|
161 |
+
|
162 |
+
/**
|
163 |
+
* Display all the registered notices
|
164 |
+
*
|
165 |
+
* @since 1.0
|
166 |
+
* @return void
|
167 |
+
*/
|
168 |
+
public function display() {
|
169 |
+
|
170 |
+
if ( is_null( self::$instance->notices ) || empty( self::$instance->notices ) ) {
|
171 |
+
return;
|
172 |
+
}
|
173 |
+
|
174 |
+
foreach ( self::$instance->notices as $id => $notice ) {
|
175 |
+
|
176 |
+
$id = self::$instance->get_id( $id );
|
177 |
+
|
178 |
+
// Check if the notice was dismissed
|
179 |
+
if ( self::$instance->is_dismissed( $id ) ) {
|
180 |
+
continue;
|
181 |
+
}
|
182 |
+
|
183 |
+
// Check if the current user has required capability
|
184 |
+
if ( ! empty( $notice['cap'] ) && ! current_user_can( $notice['cap'] ) ) {
|
185 |
+
continue;
|
186 |
+
}
|
187 |
+
|
188 |
+
$class = array(
|
189 |
+
'notice',
|
190 |
+
$notice['type'],
|
191 |
+
'is-dismissible',
|
192 |
+
$notice['class'],
|
193 |
+
);
|
194 |
+
|
195 |
+
printf( '<div id="%3$s" class="%1$s"><p>%2$s</p></div>', trim( implode( ' ', $class ) ), $notice['content'], "dnh-$id" );
|
196 |
+
|
197 |
+
}
|
198 |
+
|
199 |
+
}
|
200 |
+
|
201 |
+
/**
|
202 |
+
* Spits an error message at the top of the admin screen
|
203 |
+
*
|
204 |
+
* @since 1.0
|
205 |
+
*
|
206 |
+
* @param string $error Error message to spit
|
207 |
+
*
|
208 |
+
* @return void
|
209 |
+
*/
|
210 |
+
protected function spit_error( $error ) {
|
211 |
+
printf(
|
212 |
+
'<div style="margin: 20px; text-align: center;"><strong>%1$s</strong> %2$s</pre></div>',
|
213 |
+
esc_html__( 'Dismissible Notices Handler Error:', 'wp-dismissible-notices-handler' ),
|
214 |
+
wp_kses_post( $error )
|
215 |
+
);
|
216 |
+
}
|
217 |
+
|
218 |
+
/**
|
219 |
+
* Sanitize a notice ID and return it
|
220 |
+
*
|
221 |
+
* @since 1.0
|
222 |
+
*
|
223 |
+
* @param string $id
|
224 |
+
*
|
225 |
+
* @return string
|
226 |
+
*/
|
227 |
+
public function get_id( $id ) {
|
228 |
+
return sanitize_key( $id );
|
229 |
+
}
|
230 |
+
|
231 |
+
/**
|
232 |
+
* Get available notice types
|
233 |
+
*
|
234 |
+
* @since 1.0
|
235 |
+
* @return array
|
236 |
+
*/
|
237 |
+
public function get_types() {
|
238 |
+
|
239 |
+
$types = array(
|
240 |
+
'error',
|
241 |
+
'updated',
|
242 |
+
// New types of notification style.
|
243 |
+
'notice-error',
|
244 |
+
'notice-warning',
|
245 |
+
'notice-success',
|
246 |
+
'notice-info',
|
247 |
+
);
|
248 |
+
|
249 |
+
return apply_filters( 'dnh_notice_types', $types );
|
250 |
+
|
251 |
+
}
|
252 |
+
|
253 |
+
/**
|
254 |
+
* Get the default arguments for a notice
|
255 |
+
*
|
256 |
+
* @since 1.0
|
257 |
+
* @return array
|
258 |
+
*/
|
259 |
+
private function default_args() {
|
260 |
+
|
261 |
+
$args = array(
|
262 |
+
'screen' => '', // Coming soon
|
263 |
+
'scope' => 'user', // Scope of the dismissal. Either user or global
|
264 |
+
'cap' => '', // Required user capability
|
265 |
+
'class' => '', // Additional class to add to the notice
|
266 |
+
);
|
267 |
+
|
268 |
+
return apply_filters( 'dnh_default_args', $args );
|
269 |
+
|
270 |
+
}
|
271 |
+
|
272 |
+
/**
|
273 |
+
* Register a new notice
|
274 |
+
*
|
275 |
+
* @since 1.0
|
276 |
+
*
|
277 |
+
* @param string $id Notice ID, used to identify it
|
278 |
+
* @param string $type Type of notice to display
|
279 |
+
* @param string $content Notice content
|
280 |
+
* @param array $args Additional parameters
|
281 |
+
*
|
282 |
+
* @return bool
|
283 |
+
*/
|
284 |
+
public function register_notice( $id, $type, $content, $args = array() ) {
|
285 |
+
|
286 |
+
if ( is_null( self::$instance->notices ) ) {
|
287 |
+
self::$instance->notices = array();
|
288 |
+
}
|
289 |
+
|
290 |
+
$id = self::$instance->get_id( $id );
|
291 |
+
$type = in_array( $t = sanitize_text_field( $type ), self::$instance->get_types() ) ? $t : 'updated';
|
292 |
+
$content = wp_kses_post( $content );
|
293 |
+
$args = wp_parse_args( $args, self::$instance->default_args() );
|
294 |
+
|
295 |
+
if ( array_key_exists( $id, self::$instance->notices ) ) {
|
296 |
+
|
297 |
+
self::$instance->spit_error(
|
298 |
+
sprintf(
|
299 |
+
/* translators: %s: required php version */
|
300 |
+
esc_html__( 'A notice with the ID %s has already been registered.', 'wp-dismissible-notices-handler' ),
|
301 |
+
"<code>$id</code>"
|
302 |
+
)
|
303 |
+
);
|
304 |
+
|
305 |
+
return false;
|
306 |
+
}
|
307 |
+
|
308 |
+
$notice = array(
|
309 |
+
'type' => $type,
|
310 |
+
'content' => $content,
|
311 |
+
);
|
312 |
+
|
313 |
+
$notice = array_merge( $notice, $args );
|
314 |
+
|
315 |
+
self::$instance->notices[ $id ] = $notice;
|
316 |
+
|
317 |
+
return true;
|
318 |
+
|
319 |
+
}
|
320 |
+
|
321 |
+
/**
|
322 |
+
* Notice dismissal triggered by Ajax
|
323 |
+
*
|
324 |
+
* @since 1.0
|
325 |
+
* @return void
|
326 |
+
*/
|
327 |
+
public function dismiss_notice_ajax() {
|
328 |
+
|
329 |
+
if ( ! isset( $_POST['id'] ) ) {
|
330 |
+
echo 0;
|
331 |
+
exit;
|
332 |
+
}
|
333 |
+
|
334 |
+
if ( empty( $_POST['id'] ) || false === strpos( $_POST['id'], 'dnh-' ) ) {
|
335 |
+
echo 0;
|
336 |
+
exit;
|
337 |
+
}
|
338 |
+
|
339 |
+
$id = self::$instance->get_id( str_replace( 'dnh-', '', $_POST['id'] ) );
|
340 |
+
|
341 |
+
echo self::$instance->dismiss_notice( $id );
|
342 |
+
exit;
|
343 |
+
|
344 |
+
}
|
345 |
+
|
346 |
+
/**
|
347 |
+
* Dismiss a notice
|
348 |
+
*
|
349 |
+
* @since 1.0
|
350 |
+
*
|
351 |
+
* @param string $id ID of the notice to dismiss
|
352 |
+
*
|
353 |
+
* @return bool
|
354 |
+
*/
|
355 |
+
public function dismiss_notice( $id ) {
|
356 |
+
|
357 |
+
$notice = self::$instance->get_notice( self::$instance->get_id( $id ) );
|
358 |
+
|
359 |
+
if ( false === $notice ) {
|
360 |
+
return false;
|
361 |
+
}
|
362 |
+
|
363 |
+
if ( self::$instance->is_dismissed( $id ) ) {
|
364 |
+
return false;
|
365 |
+
}
|
366 |
+
|
367 |
+
return 'user' === $notice['scope'] ? self::$instance->dismiss_user( $id ) : self::$instance->dismiss_global( $id );
|
368 |
+
|
369 |
+
}
|
370 |
+
|
371 |
+
/**
|
372 |
+
* Dismiss notice for the current user
|
373 |
+
*
|
374 |
+
* @since 1.0
|
375 |
+
*
|
376 |
+
* @param string $id Notice ID
|
377 |
+
*
|
378 |
+
* @return int|bool
|
379 |
+
*/
|
380 |
+
private function dismiss_user( $id ) {
|
381 |
+
|
382 |
+
$dismissed = self::$instance->dismissed_user();
|
383 |
+
|
384 |
+
if ( in_array( $id, $dismissed ) ) {
|
385 |
+
return false;
|
386 |
+
}
|
387 |
+
|
388 |
+
array_push( $dismissed, $id );
|
389 |
+
|
390 |
+
return update_user_meta( get_current_user_id(), 'dnh_dismissed_notices', $dismissed );
|
391 |
+
|
392 |
+
}
|
393 |
+
|
394 |
+
/**
|
395 |
+
* Dismiss notice globally on the site
|
396 |
+
*
|
397 |
+
* @since 1.0
|
398 |
+
*
|
399 |
+
* @param string $id Notice ID
|
400 |
+
*
|
401 |
+
* @return bool
|
402 |
+
*/
|
403 |
+
private function dismiss_global( $id ) {
|
404 |
+
|
405 |
+
$dismissed = self::$instance->dismissed_global();
|
406 |
+
|
407 |
+
if ( in_array( $id, $dismissed ) ) {
|
408 |
+
return false;
|
409 |
+
}
|
410 |
+
|
411 |
+
array_push( $dismissed, $id );
|
412 |
+
|
413 |
+
return update_option( 'dnh_dismissed_notices', $dismissed );
|
414 |
+
|
415 |
+
}
|
416 |
+
|
417 |
+
/**
|
418 |
+
* Restore a dismissed notice
|
419 |
+
*
|
420 |
+
* @since 1.0
|
421 |
+
*
|
422 |
+
* @param string $id ID of the notice to restore
|
423 |
+
*
|
424 |
+
* @return bool
|
425 |
+
*/
|
426 |
+
public function restore_notice( $id ) {
|
427 |
+
|
428 |
+
$id = self::$instance->get_id( $id );
|
429 |
+
$notice = self::$instance->get_notice( $id );
|
430 |
+
|
431 |
+
if ( false === $notice ) {
|
432 |
+
return false;
|
433 |
+
}
|
434 |
+
|
435 |
+
return 'user' === $notice['scope'] ? self::$instance->restore_user( $id ) : self::$instance->restore_global( $id );
|
436 |
+
|
437 |
+
}
|
438 |
+
|
439 |
+
/**
|
440 |
+
* Restore a notice dismissed by the current user
|
441 |
+
*
|
442 |
+
* @since 1.0
|
443 |
+
*
|
444 |
+
* @param string $id ID of the notice to restore
|
445 |
+
*
|
446 |
+
* @return bool
|
447 |
+
*/
|
448 |
+
private function restore_user( $id ) {
|
449 |
+
|
450 |
+
$id = self::$instance->get_id( $id );
|
451 |
+
$notice = self::$instance->get_notice( $id );
|
452 |
+
|
453 |
+
if ( false === $notice ) {
|
454 |
+
return false;
|
455 |
+
}
|
456 |
+
|
457 |
+
$dismissed = self::$instance->dismissed_user();
|
458 |
+
|
459 |
+
if ( ! in_array( $id, $dismissed ) ) {
|
460 |
+
return false;
|
461 |
+
}
|
462 |
+
|
463 |
+
$flip = array_flip( $dismissed );
|
464 |
+
$key = $flip[ $id ];
|
465 |
+
|
466 |
+
unset( $dismissed[ $key ] );
|
467 |
+
|
468 |
+
return update_user_meta( get_current_user_id(), 'dnh_dismissed_notices', $dismissed );
|
469 |
+
|
470 |
+
}
|
471 |
+
|
472 |
+
/**
|
473 |
+
* Restore a notice dismissed globally
|
474 |
+
*
|
475 |
+
* @since 1.0
|
476 |
+
*
|
477 |
+
* @param string $id ID of the notice to restore
|
478 |
+
*
|
479 |
+
* @return bool
|
480 |
+
*/
|
481 |
+
private function restore_global( $id ) {
|
482 |
+
|
483 |
+
$id = self::$instance->get_id( $id );
|
484 |
+
$notice = self::$instance->get_notice( $id );
|
485 |
+
|
486 |
+
if ( false === $notice ) {
|
487 |
+
return false;
|
488 |
+
}
|
489 |
+
|
490 |
+
$dismissed = self::$instance->dismissed_global();
|
491 |
+
|
492 |
+
if ( ! in_array( $id, $dismissed ) ) {
|
493 |
+
return false;
|
494 |
+
}
|
495 |
+
|
496 |
+
$flip = array_flip( $dismissed );
|
497 |
+
$key = $flip[ $id ];
|
498 |
+
|
499 |
+
unset( $dismissed[ $key ] );
|
500 |
+
|
501 |
+
return update_option( 'dnh_dismissed_notices', $dismissed );
|
502 |
+
|
503 |
+
}
|
504 |
+
|
505 |
+
/**
|
506 |
+
* Get all dismissed notices
|
507 |
+
*
|
508 |
+
* This includes notices dismissed globally or per user.
|
509 |
+
*
|
510 |
+
* @since 1.0
|
511 |
+
* @return array
|
512 |
+
*/
|
513 |
+
public function dismissed_notices() {
|
514 |
+
|
515 |
+
$user = self::$instance->dismissed_user();
|
516 |
+
$global = self::$instance->dismissed_global();
|
517 |
+
|
518 |
+
return array_merge( $user, $global );
|
519 |
+
|
520 |
+
}
|
521 |
+
|
522 |
+
/**
|
523 |
+
* Get user dismissed notices
|
524 |
+
*
|
525 |
+
* @since 1.0
|
526 |
+
* @return array
|
527 |
+
*/
|
528 |
+
private function dismissed_user() {
|
529 |
+
|
530 |
+
$dismissed = get_user_meta( get_current_user_id(), 'dnh_dismissed_notices', true );
|
531 |
+
|
532 |
+
if ( '' === $dismissed ) {
|
533 |
+
$dismissed = array();
|
534 |
+
}
|
535 |
+
|
536 |
+
return $dismissed;
|
537 |
+
|
538 |
+
}
|
539 |
+
|
540 |
+
/**
|
541 |
+
* Get globally dismissed notices
|
542 |
+
*
|
543 |
+
* @since 1.0
|
544 |
+
* @return array
|
545 |
+
*/
|
546 |
+
private function dismissed_global() {
|
547 |
+
return get_option( 'dnh_dismissed_notices', array() );
|
548 |
+
}
|
549 |
+
|
550 |
+
/**
|
551 |
+
* Check if a notice has been dismissed
|
552 |
+
*
|
553 |
+
* @since 1.0
|
554 |
+
*
|
555 |
+
* @param string $id Notice ID
|
556 |
+
*
|
557 |
+
* @return bool
|
558 |
+
*/
|
559 |
+
public function is_dismissed( $id ) {
|
560 |
+
|
561 |
+
$dismissed = self::$instance->dismissed_notices();
|
562 |
+
|
563 |
+
if ( ! in_array( self::$instance->get_id( $id ), $dismissed ) ) {
|
564 |
+
return false;
|
565 |
+
}
|
566 |
+
|
567 |
+
return true;
|
568 |
+
|
569 |
+
}
|
570 |
+
|
571 |
+
/**
|
572 |
+
* Get all the registered notices
|
573 |
+
*
|
574 |
+
* @since 1.0
|
575 |
+
* @return array|null
|
576 |
+
*/
|
577 |
+
public function get_notices() {
|
578 |
+
return self::$instance->notices;
|
579 |
+
}
|
580 |
+
|
581 |
+
/**
|
582 |
+
* Return a specific notice
|
583 |
+
*
|
584 |
+
* @since 1.0
|
585 |
+
*
|
586 |
+
* @param string $id Notice ID
|
587 |
+
*
|
588 |
+
* @return array|false
|
589 |
+
*/
|
590 |
+
public function get_notice( $id ) {
|
591 |
+
|
592 |
+
$id = self::$instance->get_id( $id );
|
593 |
+
|
594 |
+
if ( ! is_array( self::$instance->notices ) || ! array_key_exists( $id, self::$instance->notices ) ) {
|
595 |
+
return false;
|
596 |
+
}
|
597 |
+
|
598 |
+
return self::$instance->notices[ $id ];
|
599 |
+
|
600 |
+
}
|
601 |
+
|
602 |
+
}
|
603 |
+
|
604 |
+
}
|
php/Admin/vendor/julien731/wp-dismissible-notices-handler/includes/helper-functions.php
ADDED
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Dismissible Notices Handler.
|
4 |
+
*
|
5 |
+
* LICENSE: This program is free software; you can redistribute it and/or modify it under the terms of the GNU
|
6 |
+
* General Public License as published by the Free Software Foundation; either version 3 of the License, or (at
|
7 |
+
* your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
8 |
+
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
9 |
+
* General Public License for more details. You should have received a copy of the GNU General Public License along
|
10 |
+
* with this program. If not, see <http://opensource.org/licenses/gpl-license.php>
|
11 |
+
*
|
12 |
+
* @package Dismissible Notices Handler/Helper Functions
|
13 |
+
* @author Julien Liabeuf <julien@liabeuf.fr>
|
14 |
+
* @version 1.0
|
15 |
+
* @license GPL-2.0+
|
16 |
+
* @link https://julienliabeuf.com
|
17 |
+
* @copyright 2016 Julien Liabeuf
|
18 |
+
*/
|
19 |
+
|
20 |
+
/**
|
21 |
+
* The main function responsible for returning the unique Dismissible Notices Handler instance
|
22 |
+
*
|
23 |
+
* Use this function like you would a global variable, except without needing
|
24 |
+
* to declare the global.
|
25 |
+
*
|
26 |
+
* @since 1.0
|
27 |
+
* @return object Dismissible_Notices_Handler
|
28 |
+
*/
|
29 |
+
|
30 |
+
if ( function_exists( 'DNH' ) ) {
|
31 |
+
return;
|
32 |
+
}
|
33 |
+
|
34 |
+
function DNH() {
|
35 |
+
return Dismissible_Notices_Handler::instance();
|
36 |
+
}
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Register a new notice
|
40 |
+
*
|
41 |
+
* @since 1.0
|
42 |
+
*
|
43 |
+
* @param string $id Notice ID, used to identify it
|
44 |
+
* @param string $type Type of notice to display
|
45 |
+
* @param string $content Notice content
|
46 |
+
* @param array $args Additional parameters
|
47 |
+
*
|
48 |
+
* @return bool
|
49 |
+
*/
|
50 |
+
function dnh_register_notice( $id, $type, $content, $args = array() ) {
|
51 |
+
|
52 |
+
if ( ! function_exists( 'DNH' ) ) {
|
53 |
+
return false;
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Get the library running
|
58 |
+
*/
|
59 |
+
DNH();
|
60 |
+
|
61 |
+
return DNH()->register_notice( $id, $type, $content, $args );
|
62 |
+
|
63 |
+
}
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Restore a previously dismissed notice
|
67 |
+
*
|
68 |
+
* @since 1.0
|
69 |
+
*
|
70 |
+
* @param string $id ID of the notice to restore
|
71 |
+
*
|
72 |
+
* @return bool
|
73 |
+
*/
|
74 |
+
function dnh_restore_notice( $id ) {
|
75 |
+
|
76 |
+
if ( ! function_exists( 'DNH' ) ) {
|
77 |
+
return false;
|
78 |
+
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Get the library running
|
82 |
+
*/
|
83 |
+
DNH();
|
84 |
+
|
85 |
+
return DNH()->restore_notice( $id );
|
86 |
+
|
87 |
+
}
|
88 |
+
|
89 |
+
/**
|
90 |
+
* Check if a notice has been dismissed
|
91 |
+
*
|
92 |
+
* @since 1.0
|
93 |
+
*
|
94 |
+
* @param string $id ID of the notice to check
|
95 |
+
*
|
96 |
+
* @return bool
|
97 |
+
*/
|
98 |
+
function dnh_is_dismissed( $id ) {
|
99 |
+
|
100 |
+
if ( ! function_exists( 'DNH' ) ) {
|
101 |
+
return false;
|
102 |
+
}
|
103 |
+
|
104 |
+
/**
|
105 |
+
* Get the library running
|
106 |
+
*/
|
107 |
+
DNH();
|
108 |
+
|
109 |
+
return DNH()->is_dismissed( $id );
|
110 |
+
|
111 |
+
}
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Tags: YouTube, Vimeo, lazyload, thumbnail, video, responsive, embeds, video-embe
|
|
5 |
Requires at least: 4.9.16
|
6 |
Tested up to: 5.6
|
7 |
Requires PHP: 5.6
|
8 |
-
Stable tag: 9.4.
|
9 |
License: GPL-3.0
|
10 |
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
11 |
|
@@ -55,7 +55,8 @@ It is very likely the one and only plugin you will ever need to handle video emb
|
|
55 |
#### Supported Providers ####
|
56 |
|
57 |
[All providers with iframe embed codes](https://nextgenthemes.com/plugins/arve/documentation/#general-iframe-embedding)
|
58 |
-
Alugha, Archive.org, Bitchute, Break, Brightcove, Comedy Central, Dailymotion, Dailymotion Playlist, DTube, Facebook,
|
|
|
59 |
### Reviews ###
|
60 |
|
61 |
#### ★ ★ ★ ★ ★ Great plugin, great support ####
|
@@ -172,6 +173,29 @@ Please read the [official documentation](https://wordpress.org/support/article/m
|
|
172 |
* [ARVE Pro changelog](https://nextgenthemes.com/plugins/arve-pro/#changelog)
|
173 |
* [ARVE Random Videos changelog](https://nextgenthemes.com/plugins/random-video/#changelog)
|
174 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
175 |
### 2021-01-28 9.4.1 ###
|
176 |
|
177 |
* Fix: (hopefully) Non dismissible admin notices. Also removed the notice that came with 9.0-beta completely.
|
5 |
Requires at least: 4.9.16
|
6 |
Tested up to: 5.6
|
7 |
Requires PHP: 5.6
|
8 |
+
Stable tag: 9.4.2
|
9 |
License: GPL-3.0
|
10 |
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
11 |
|
55 |
#### Supported Providers ####
|
56 |
|
57 |
[All providers with iframe embed codes](https://nextgenthemes.com/plugins/arve/documentation/#general-iframe-embedding)
|
58 |
+
Alugha, Archive.org, Banned.video, Bitchute, Break, Mail.ru, Brightcove, cantcensortruth.com, Comedy Central, Dailymotion, Dailymotion Playlist, DTube, Facebook, Google Drive, mp4 or webm video files, ARVE general iframe embed, IGN, IMDB, Kickstarter, kla.tv, LiveLeak, Livestream.com, Metacafe, myspace, ooyala, Rumble.com, RuTube.ru, Snotr, Spike, TED Talks, Twitch, Ustream, Viddler, Vimeo, VK, vzaar, Wistia, XTube, Yahoo, Youku, YouTube, YouTube Playlist
|
59 |
+
|
60 |
### Reviews ###
|
61 |
|
62 |
#### ★ ★ ★ ★ ★ Great plugin, great support ####
|
173 |
* [ARVE Pro changelog](https://nextgenthemes.com/plugins/arve-pro/#changelog)
|
174 |
* [ARVE Random Videos changelog](https://nextgenthemes.com/plugins/random-video/#changelog)
|
175 |
|
176 |
+
### 2021-02-13 9.5.1-beta7 ###
|
177 |
+
|
178 |
+
* Fixed and further simplified oembed caching.
|
179 |
+
* Improved: Allow forms for Wistia.
|
180 |
+
|
181 |
+
### 2021-02-13 9.5.1-beta1 ###
|
182 |
+
|
183 |
+
* New video hosts support for
|
184 |
+
* [LBRY](https://lbry.com)
|
185 |
+
* [Odyssey](https://odysee.com)
|
186 |
+
* [mail.ru](https://my.mail.ru/videos/)
|
187 |
+
* [donnersender.ru](https://donnersender.ru)
|
188 |
+
* [banned.video](https://banned.video) & [cantcensortruth.com](https://cantcensortruth.com) mirror site. Works directly with their URLs, **not** their embed codes. ARVE works without using their JavaScript on your site.
|
189 |
+
* Fix: Classic Video widget use with provider urls.
|
190 |
+
* Fix: Filtered out link in new admin notices.
|
191 |
+
* Improved: Caching system simplified and improved.
|
192 |
+
* Improved: Added info if logged in user can not install plugins.
|
193 |
+
* Improved: Make more tags filterable.
|
194 |
+
|
195 |
+
### 2021-01-28 9.4.2 ###
|
196 |
+
|
197 |
+
* Fix: Include new library for notices.
|
198 |
+
|
199 |
### 2021-01-28 9.4.1 ###
|
200 |
|
201 |
* Fix: (hopefully) Non dismissible admin notices. Also removed the notice that came with 9.0-beta completely.
|