Version Description
Download this release
Release Info
Developer | codeinwp |
Plugin | WordPress Charts and Graphs Lite |
Version | 2.0.2 |
Comparing to | |
See all releases |
Code changes from version 2.0.0 to 2.0.2
- CHANGELOG.md +12 -1
- classes/Visualizer/Plugin.php +1 -1
- composer.json +0 -46
- css/media.css +1 -1
- index.php +1 -1
- vendor/autoload.php +7 -0
- vendor/autoload_52.php +7 -0
- vendor/codeinwp/themeisle-sdk/LICENSE +674 -0
- vendor/codeinwp/themeisle-sdk/README.md +2 -0
- vendor/codeinwp/themeisle-sdk/class-themeisle-sdk-licenser.php +660 -0
- vendor/codeinwp/themeisle-sdk/class-themeisle-sdk-loader.php +86 -0
- vendor/codeinwp/themeisle-sdk/class-themeisle-sdk-logger.php +80 -0
- vendor/codeinwp/themeisle-sdk/class-themeisle-sdk-product.php +265 -0
- vendor/codeinwp/themeisle-sdk/composer.json +27 -0
- vendor/codeinwp/themeisle-sdk/index.php +5 -0
- vendor/codeinwp/themeisle-sdk/phpcs.xml +34 -0
- vendor/composer/ClassLoader.php +413 -0
- vendor/composer/ClassLoader52.php +271 -0
- vendor/composer/LICENSE +21 -0
- vendor/composer/autoload_classmap.php +13 -0
- vendor/composer/autoload_namespaces.php +10 -0
- vendor/composer/autoload_psr4.php +9 -0
- vendor/composer/autoload_real.php +45 -0
- vendor/composer/autoload_real_52.php +44 -0
- vendor/composer/installed.json +80 -0
- vendor/xrstf/composer-php52/LICENSE +19 -0
- vendor/xrstf/composer-php52/README.md +37 -0
- vendor/xrstf/composer-php52/composer.json +26 -0
- vendor/xrstf/composer-php52/lib/xrstf/Composer52/AutoloadGenerator.php +346 -0
- vendor/xrstf/composer-php52/lib/xrstf/Composer52/ClassLoader.php +271 -0
- vendor/xrstf/composer-php52/lib/xrstf/Composer52/Generator.php +39 -0
CHANGELOG.md
CHANGED
@@ -1,4 +1,16 @@
|
|
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
|
4 |
|
5 |
-
Improved UI of the builder.
|
1 |
|
2 |
+
### v2.0.2 - 2017-04-13
|
3 |
+
**Changes:**
|
4 |
+
- Fixed svn deploy script.
|
5 |
+
|
6 |
+
### v2.0.2 - 2017-04-13
|
7 |
+
**Changes:**
|
8 |
+
- Fixed SVN deploy
|
9 |
+
|
10 |
+
### v2.0.1 - 2017-04-13
|
11 |
+
**Changes:**
|
12 |
+
- Fixed vendor include.
|
13 |
+
|
14 |
|
15 |
|
16 |
|
|
classes/Visualizer/Plugin.php
CHANGED
@@ -28,7 +28,7 @@
|
|
28 |
class Visualizer_Plugin {
|
29 |
|
30 |
const NAME = 'visualizer';
|
31 |
-
const VERSION = '2.0.
|
32 |
|
33 |
// custom post types
|
34 |
const CPT_VISUALIZER = 'visualizer';
|
28 |
class Visualizer_Plugin {
|
29 |
|
30 |
const NAME = 'visualizer';
|
31 |
+
const VERSION = '2.0.2';
|
32 |
|
33 |
// custom post types
|
34 |
const CPT_VISUALIZER = 'visualizer';
|
composer.json
DELETED
@@ -1,46 +0,0 @@
|
|
1 |
-
{
|
2 |
-
"name": "codeinwp/visualizer",
|
3 |
-
"description": "Visualizer for WordPress.",
|
4 |
-
"keywords": [
|
5 |
-
"wordpress",
|
6 |
-
"charts",
|
7 |
-
"visualization"
|
8 |
-
],
|
9 |
-
"repositories": [
|
10 |
-
{
|
11 |
-
"type": "vcs",
|
12 |
-
"url": "https://github.com/Codeinwp/themeisle-sdk"
|
13 |
-
}
|
14 |
-
],
|
15 |
-
"homepage": "https://themeisle.com/plugins/visualizer/",
|
16 |
-
"license": "GPL-2.0+",
|
17 |
-
"authors": [
|
18 |
-
{
|
19 |
-
"name": "ThemeIsle Team",
|
20 |
-
"email": "friends@themeisle.com.com",
|
21 |
-
"homepage": "https://themeisle.com"
|
22 |
-
}
|
23 |
-
],
|
24 |
-
"type": "wordpress-plugin",
|
25 |
-
"support": {
|
26 |
-
"issues": "https://github.com/Codeinwp/visualizer/issues",
|
27 |
-
"source": "https://github.com/Codeinwp/visualizer"
|
28 |
-
},
|
29 |
-
"require": {
|
30 |
-
"codeinwp/themeisle-sdk": "master",
|
31 |
-
"xrstf/composer-php52": "^1.0.20"
|
32 |
-
},
|
33 |
-
"minimum-stability": "dev",
|
34 |
-
"prefer-stable": true,
|
35 |
-
"scripts": {
|
36 |
-
"post-install-cmd": [
|
37 |
-
"xrstf\\Composer52\\Generator::onPostInstallCmd"
|
38 |
-
],
|
39 |
-
"post-update-cmd": [
|
40 |
-
"xrstf\\Composer52\\Generator::onPostInstallCmd"
|
41 |
-
],
|
42 |
-
"post-autoload-dump": [
|
43 |
-
"xrstf\\Composer52\\Generator::onPostInstallCmd"
|
44 |
-
]
|
45 |
-
}
|
46 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
css/media.css
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
/*
|
2 |
-
Version: 2.0.
|
3 |
*/
|
4 |
#visualizer-library-view {
|
5 |
padding: 30px 10px 10px 30px;
|
1 |
/*
|
2 |
+
Version: 2.0.2
|
3 |
*/
|
4 |
#visualizer-library-view {
|
5 |
padding: 30px 10px 10px 30px;
|
index.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
Plugin Name: Visualizer: Charts and Graphs Lite
|
5 |
Plugin URI: https://themeisle.com/plugins/visualizer-charts-and-graphs-lite/
|
6 |
Description: A simple, easy to use and quite powerful tool to create, manage and embed interactive charts into your WordPress posts and pages. The plugin uses Google Visualization API to render charts, which supports cross-browser compatibility (adopting VML for older IE versions) and cross-platform portability to iOS and new Android releases.
|
7 |
-
Version: 2.0.
|
8 |
Author: Themeisle
|
9 |
Author URI: http://themeisle.com
|
10 |
License: GPL v2.0 or later
|
4 |
Plugin Name: Visualizer: Charts and Graphs Lite
|
5 |
Plugin URI: https://themeisle.com/plugins/visualizer-charts-and-graphs-lite/
|
6 |
Description: A simple, easy to use and quite powerful tool to create, manage and embed interactive charts into your WordPress posts and pages. The plugin uses Google Visualization API to render charts, which supports cross-browser compatibility (adopting VML for older IE versions) and cross-platform portability to iOS and new Android releases.
|
7 |
+
Version: 2.0.2
|
8 |
Author: Themeisle
|
9 |
Author URI: http://themeisle.com
|
10 |
License: GPL v2.0 or later
|
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 ComposerAutoloaderInit23ab7635fef8dfda86dc6d7908d85506::getLoader();
|
vendor/autoload_52.php
ADDED
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload_52.php generated by xrstf/composer-php52
|
4 |
+
|
5 |
+
require_once dirname(__FILE__) . '/composer'.'/autoload_real_52.php';
|
6 |
+
|
7 |
+
return ComposerAutoloaderInitff2c8e464431f7e50e8d3bd7f1610808::getLoader();
|
vendor/codeinwp/themeisle-sdk/LICENSE
ADDED
@@ -0,0 +1,674 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
GNU GENERAL PUBLIC LICENSE
|
2 |
+
Version 3, 29 June 2007
|
3 |
+
|
4 |
+
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
5 |
+
Everyone is permitted to copy and distribute verbatim copies
|
6 |
+
of this license document, but changing it is not allowed.
|
7 |
+
|
8 |
+
Preamble
|
9 |
+
|
10 |
+
The GNU General Public License is a free, copyleft license for
|
11 |
+
software and other kinds of works.
|
12 |
+
|
13 |
+
The licenses for most software and other practical works are designed
|
14 |
+
to take away your freedom to share and change the works. By contrast,
|
15 |
+
the GNU General Public License is intended to guarantee your freedom to
|
16 |
+
share and change all versions of a program--to make sure it remains free
|
17 |
+
software for all its users. We, the Free Software Foundation, use the
|
18 |
+
GNU General Public License for most of our software; it applies also to
|
19 |
+
any other work released this way by its authors. You can apply it to
|
20 |
+
your programs, too.
|
21 |
+
|
22 |
+
When we speak of free software, we are referring to freedom, not
|
23 |
+
price. Our General Public Licenses are designed to make sure that you
|
24 |
+
have the freedom to distribute copies of free software (and charge for
|
25 |
+
them if you wish), that you receive source code or can get it if you
|
26 |
+
want it, that you can change the software or use pieces of it in new
|
27 |
+
free programs, and that you know you can do these things.
|
28 |
+
|
29 |
+
To protect your rights, we need to prevent others from denying you
|
30 |
+
these rights or asking you to surrender the rights. Therefore, you have
|
31 |
+
certain responsibilities if you distribute copies of the software, or if
|
32 |
+
you modify it: responsibilities to respect the freedom of others.
|
33 |
+
|
34 |
+
For example, if you distribute copies of such a program, whether
|
35 |
+
gratis or for a fee, you must pass on to the recipients the same
|
36 |
+
freedoms that you received. You must make sure that they, too, receive
|
37 |
+
or can get the source code. And you must show them these terms so they
|
38 |
+
know their rights.
|
39 |
+
|
40 |
+
Developers that use the GNU GPL protect your rights with two steps:
|
41 |
+
(1) assert copyright on the software, and (2) offer you this License
|
42 |
+
giving you legal permission to copy, distribute and/or modify it.
|
43 |
+
|
44 |
+
For the developers' and authors' protection, the GPL clearly explains
|
45 |
+
that there is no warranty for this free software. For both users' and
|
46 |
+
authors' sake, the GPL requires that modified versions be marked as
|
47 |
+
changed, so that their problems will not be attributed erroneously to
|
48 |
+
authors of previous versions.
|
49 |
+
|
50 |
+
Some devices are designed to deny users access to install or run
|
51 |
+
modified versions of the software inside them, although the manufacturer
|
52 |
+
can do so. This is fundamentally incompatible with the aim of
|
53 |
+
protecting users' freedom to change the software. The systematic
|
54 |
+
pattern of such abuse occurs in the area of products for individuals to
|
55 |
+
use, which is precisely where it is most unacceptable. Therefore, we
|
56 |
+
have designed this version of the GPL to prohibit the practice for those
|
57 |
+
products. If such problems arise substantially in other domains, we
|
58 |
+
stand ready to extend this provision to those domains in future versions
|
59 |
+
of the GPL, as needed to protect the freedom of users.
|
60 |
+
|
61 |
+
Finally, every program is threatened constantly by software patents.
|
62 |
+
States should not allow patents to restrict development and use of
|
63 |
+
software on general-purpose computers, but in those that do, we wish to
|
64 |
+
avoid the special danger that patents applied to a free program could
|
65 |
+
make it effectively proprietary. To prevent this, the GPL assures that
|
66 |
+
patents cannot be used to render the program non-free.
|
67 |
+
|
68 |
+
The precise terms and conditions for copying, distribution and
|
69 |
+
modification follow.
|
70 |
+
|
71 |
+
TERMS AND CONDITIONS
|
72 |
+
|
73 |
+
0. Definitions.
|
74 |
+
|
75 |
+
"This License" refers to version 3 of the GNU General Public License.
|
76 |
+
|
77 |
+
"Copyright" also means copyright-like laws that apply to other kinds of
|
78 |
+
works, such as semiconductor masks.
|
79 |
+
|
80 |
+
"The Program" refers to any copyrightable work licensed under this
|
81 |
+
License. Each licensee is addressed as "you". "Licensees" and
|
82 |
+
"recipients" may be individuals or organizations.
|
83 |
+
|
84 |
+
To "modify" a work means to copy from or adapt all or part of the work
|
85 |
+
in a fashion requiring copyright permission, other than the making of an
|
86 |
+
exact copy. The resulting work is called a "modified version" of the
|
87 |
+
earlier work or a work "based on" the earlier work.
|
88 |
+
|
89 |
+
A "covered work" means either the unmodified Program or a work based
|
90 |
+
on the Program.
|
91 |
+
|
92 |
+
To "propagate" a work means to do anything with it that, without
|
93 |
+
permission, would make you directly or secondarily liable for
|
94 |
+
infringement under applicable copyright law, except executing it on a
|
95 |
+
computer or modifying a private copy. Propagation includes copying,
|
96 |
+
distribution (with or without modification), making available to the
|
97 |
+
public, and in some countries other activities as well.
|
98 |
+
|
99 |
+
To "convey" a work means any kind of propagation that enables other
|
100 |
+
parties to make or receive copies. Mere interaction with a user through
|
101 |
+
a computer network, with no transfer of a copy, is not conveying.
|
102 |
+
|
103 |
+
An interactive user interface displays "Appropriate Legal Notices"
|
104 |
+
to the extent that it includes a convenient and prominently visible
|
105 |
+
feature that (1) displays an appropriate copyright notice, and (2)
|
106 |
+
tells the user that there is no warranty for the work (except to the
|
107 |
+
extent that warranties are provided), that licensees may convey the
|
108 |
+
work under this License, and how to view a copy of this License. If
|
109 |
+
the interface presents a list of user commands or options, such as a
|
110 |
+
menu, a prominent item in the list meets this criterion.
|
111 |
+
|
112 |
+
1. Source Code.
|
113 |
+
|
114 |
+
The "source code" for a work means the preferred form of the work
|
115 |
+
for making modifications to it. "Object code" means any non-source
|
116 |
+
form of a work.
|
117 |
+
|
118 |
+
A "Standard Interface" means an interface that either is an official
|
119 |
+
standard defined by a recognized standards body, or, in the case of
|
120 |
+
interfaces specified for a particular programming language, one that
|
121 |
+
is widely used among developers working in that language.
|
122 |
+
|
123 |
+
The "System Libraries" of an executable work include anything, other
|
124 |
+
than the work as a whole, that (a) is included in the normal form of
|
125 |
+
packaging a Major Component, but which is not part of that Major
|
126 |
+
Component, and (b) serves only to enable use of the work with that
|
127 |
+
Major Component, or to implement a Standard Interface for which an
|
128 |
+
implementation is available to the public in source code form. A
|
129 |
+
"Major Component", in this context, means a major essential component
|
130 |
+
(kernel, window system, and so on) of the specific operating system
|
131 |
+
(if any) on which the executable work runs, or a compiler used to
|
132 |
+
produce the work, or an object code interpreter used to run it.
|
133 |
+
|
134 |
+
The "Corresponding Source" for a work in object code form means all
|
135 |
+
the source code needed to generate, install, and (for an executable
|
136 |
+
work) run the object code and to modify the work, including scripts to
|
137 |
+
control those activities. However, it does not include the work's
|
138 |
+
System Libraries, or general-purpose tools or generally available free
|
139 |
+
programs which are used unmodified in performing those activities but
|
140 |
+
which are not part of the work. For example, Corresponding Source
|
141 |
+
includes interface definition files associated with source files for
|
142 |
+
the work, and the source code for shared libraries and dynamically
|
143 |
+
linked subprograms that the work is specifically designed to require,
|
144 |
+
such as by intimate data communication or control flow between those
|
145 |
+
subprograms and other parts of the work.
|
146 |
+
|
147 |
+
The Corresponding Source need not include anything that users
|
148 |
+
can regenerate automatically from other parts of the Corresponding
|
149 |
+
Source.
|
150 |
+
|
151 |
+
The Corresponding Source for a work in source code form is that
|
152 |
+
same work.
|
153 |
+
|
154 |
+
2. Basic Permissions.
|
155 |
+
|
156 |
+
All rights granted under this License are granted for the term of
|
157 |
+
copyright on the Program, and are irrevocable provided the stated
|
158 |
+
conditions are met. This License explicitly affirms your unlimited
|
159 |
+
permission to run the unmodified Program. The output from running a
|
160 |
+
covered work is covered by this License only if the output, given its
|
161 |
+
content, constitutes a covered work. This License acknowledges your
|
162 |
+
rights of fair use or other equivalent, as provided by copyright law.
|
163 |
+
|
164 |
+
You may make, run and propagate covered works that you do not
|
165 |
+
convey, without conditions so long as your license otherwise remains
|
166 |
+
in force. You may convey covered works to others for the sole purpose
|
167 |
+
of having them make modifications exclusively for you, or provide you
|
168 |
+
with facilities for running those works, provided that you comply with
|
169 |
+
the terms of this License in conveying all material for which you do
|
170 |
+
not control copyright. Those thus making or running the covered works
|
171 |
+
for you must do so exclusively on your behalf, under your direction
|
172 |
+
and control, on terms that prohibit them from making any copies of
|
173 |
+
your copyrighted material outside their relationship with you.
|
174 |
+
|
175 |
+
Conveying under any other circumstances is permitted solely under
|
176 |
+
the conditions stated below. Sublicensing is not allowed; section 10
|
177 |
+
makes it unnecessary.
|
178 |
+
|
179 |
+
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
180 |
+
|
181 |
+
No covered work shall be deemed part of an effective technological
|
182 |
+
measure under any applicable law fulfilling obligations under article
|
183 |
+
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
184 |
+
similar laws prohibiting or restricting circumvention of such
|
185 |
+
measures.
|
186 |
+
|
187 |
+
When you convey a covered work, you waive any legal power to forbid
|
188 |
+
circumvention of technological measures to the extent such circumvention
|
189 |
+
is effected by exercising rights under this License with respect to
|
190 |
+
the covered work, and you disclaim any intention to limit operation or
|
191 |
+
modification of the work as a means of enforcing, against the work's
|
192 |
+
users, your or third parties' legal rights to forbid circumvention of
|
193 |
+
technological measures.
|
194 |
+
|
195 |
+
4. Conveying Verbatim Copies.
|
196 |
+
|
197 |
+
You may convey verbatim copies of the Program's source code as you
|
198 |
+
receive it, in any medium, provided that you conspicuously and
|
199 |
+
appropriately publish on each copy an appropriate copyright notice;
|
200 |
+
keep intact all notices stating that this License and any
|
201 |
+
non-permissive terms added in accord with section 7 apply to the code;
|
202 |
+
keep intact all notices of the absence of any warranty; and give all
|
203 |
+
recipients a copy of this License along with the Program.
|
204 |
+
|
205 |
+
You may charge any price or no price for each copy that you convey,
|
206 |
+
and you may offer support or warranty protection for a fee.
|
207 |
+
|
208 |
+
5. Conveying Modified Source Versions.
|
209 |
+
|
210 |
+
You may convey a work based on the Program, or the modifications to
|
211 |
+
produce it from the Program, in the form of source code under the
|
212 |
+
terms of section 4, provided that you also meet all of these conditions:
|
213 |
+
|
214 |
+
a) The work must carry prominent notices stating that you modified
|
215 |
+
it, and giving a relevant date.
|
216 |
+
|
217 |
+
b) The work must carry prominent notices stating that it is
|
218 |
+
released under this License and any conditions added under section
|
219 |
+
7. This requirement modifies the requirement in section 4 to
|
220 |
+
"keep intact all notices".
|
221 |
+
|
222 |
+
c) You must license the entire work, as a whole, under this
|
223 |
+
License to anyone who comes into possession of a copy. This
|
224 |
+
License will therefore apply, along with any applicable section 7
|
225 |
+
additional terms, to the whole of the work, and all its parts,
|
226 |
+
regardless of how they are packaged. This License gives no
|
227 |
+
permission to license the work in any other way, but it does not
|
228 |
+
invalidate such permission if you have separately received it.
|
229 |
+
|
230 |
+
d) If the work has interactive user interfaces, each must display
|
231 |
+
Appropriate Legal Notices; however, if the Program has interactive
|
232 |
+
interfaces that do not display Appropriate Legal Notices, your
|
233 |
+
work need not make them do so.
|
234 |
+
|
235 |
+
A compilation of a covered work with other separate and independent
|
236 |
+
works, which are not by their nature extensions of the covered work,
|
237 |
+
and which are not combined with it such as to form a larger program,
|
238 |
+
in or on a volume of a storage or distribution medium, is called an
|
239 |
+
"aggregate" if the compilation and its resulting copyright are not
|
240 |
+
used to limit the access or legal rights of the compilation's users
|
241 |
+
beyond what the individual works permit. Inclusion of a covered work
|
242 |
+
in an aggregate does not cause this License to apply to the other
|
243 |
+
parts of the aggregate.
|
244 |
+
|
245 |
+
6. Conveying Non-Source Forms.
|
246 |
+
|
247 |
+
You may convey a covered work in object code form under the terms
|
248 |
+
of sections 4 and 5, provided that you also convey the
|
249 |
+
machine-readable Corresponding Source under the terms of this License,
|
250 |
+
in one of these ways:
|
251 |
+
|
252 |
+
a) Convey the object code in, or embodied in, a physical product
|
253 |
+
(including a physical distribution medium), accompanied by the
|
254 |
+
Corresponding Source fixed on a durable physical medium
|
255 |
+
customarily used for software interchange.
|
256 |
+
|
257 |
+
b) Convey the object code in, or embodied in, a physical product
|
258 |
+
(including a physical distribution medium), accompanied by a
|
259 |
+
written offer, valid for at least three years and valid for as
|
260 |
+
long as you offer spare parts or customer support for that product
|
261 |
+
model, to give anyone who possesses the object code either (1) a
|
262 |
+
copy of the Corresponding Source for all the software in the
|
263 |
+
product that is covered by this License, on a durable physical
|
264 |
+
medium customarily used for software interchange, for a price no
|
265 |
+
more than your reasonable cost of physically performing this
|
266 |
+
conveying of source, or (2) access to copy the
|
267 |
+
Corresponding Source from a network server at no charge.
|
268 |
+
|
269 |
+
c) Convey individual copies of the object code with a copy of the
|
270 |
+
written offer to provide the Corresponding Source. This
|
271 |
+
alternative is allowed only occasionally and noncommercially, and
|
272 |
+
only if you received the object code with such an offer, in accord
|
273 |
+
with subsection 6b.
|
274 |
+
|
275 |
+
d) Convey the object code by offering access from a designated
|
276 |
+
place (gratis or for a charge), and offer equivalent access to the
|
277 |
+
Corresponding Source in the same way through the same place at no
|
278 |
+
further charge. You need not require recipients to copy the
|
279 |
+
Corresponding Source along with the object code. If the place to
|
280 |
+
copy the object code is a network server, the Corresponding Source
|
281 |
+
may be on a different server (operated by you or a third party)
|
282 |
+
that supports equivalent copying facilities, provided you maintain
|
283 |
+
clear directions next to the object code saying where to find the
|
284 |
+
Corresponding Source. Regardless of what server hosts the
|
285 |
+
Corresponding Source, you remain obligated to ensure that it is
|
286 |
+
available for as long as needed to satisfy these requirements.
|
287 |
+
|
288 |
+
e) Convey the object code using peer-to-peer transmission, provided
|
289 |
+
you inform other peers where the object code and Corresponding
|
290 |
+
Source of the work are being offered to the general public at no
|
291 |
+
charge under subsection 6d.
|
292 |
+
|
293 |
+
A separable portion of the object code, whose source code is excluded
|
294 |
+
from the Corresponding Source as a System Library, need not be
|
295 |
+
included in conveying the object code work.
|
296 |
+
|
297 |
+
A "User Product" is either (1) a "consumer product", which means any
|
298 |
+
tangible personal property which is normally used for personal, family,
|
299 |
+
or household purposes, or (2) anything designed or sold for incorporation
|
300 |
+
into a dwelling. In determining whether a product is a consumer product,
|
301 |
+
doubtful cases shall be resolved in favor of coverage. For a particular
|
302 |
+
product received by a particular user, "normally used" refers to a
|
303 |
+
typical or common use of that class of product, regardless of the status
|
304 |
+
of the particular user or of the way in which the particular user
|
305 |
+
actually uses, or expects or is expected to use, the product. A product
|
306 |
+
is a consumer product regardless of whether the product has substantial
|
307 |
+
commercial, industrial or non-consumer uses, unless such uses represent
|
308 |
+
the only significant mode of use of the product.
|
309 |
+
|
310 |
+
"Installation Information" for a User Product means any methods,
|
311 |
+
procedures, authorization keys, or other information required to install
|
312 |
+
and execute modified versions of a covered work in that User Product from
|
313 |
+
a modified version of its Corresponding Source. The information must
|
314 |
+
suffice to ensure that the continued functioning of the modified object
|
315 |
+
code is in no case prevented or interfered with solely because
|
316 |
+
modification has been made.
|
317 |
+
|
318 |
+
If you convey an object code work under this section in, or with, or
|
319 |
+
specifically for use in, a User Product, and the conveying occurs as
|
320 |
+
part of a transaction in which the right of possession and use of the
|
321 |
+
User Product is transferred to the recipient in perpetuity or for a
|
322 |
+
fixed term (regardless of how the transaction is characterized), the
|
323 |
+
Corresponding Source conveyed under this section must be accompanied
|
324 |
+
by the Installation Information. But this requirement does not apply
|
325 |
+
if neither you nor any third party retains the ability to install
|
326 |
+
modified object code on the User Product (for example, the work has
|
327 |
+
been installed in ROM).
|
328 |
+
|
329 |
+
The requirement to provide Installation Information does not include a
|
330 |
+
requirement to continue to provide support service, warranty, or updates
|
331 |
+
for a work that has been modified or installed by the recipient, or for
|
332 |
+
the User Product in which it has been modified or installed. Access to a
|
333 |
+
network may be denied when the modification itself materially and
|
334 |
+
adversely affects the operation of the network or violates the rules and
|
335 |
+
protocols for communication across the network.
|
336 |
+
|
337 |
+
Corresponding Source conveyed, and Installation Information provided,
|
338 |
+
in accord with this section must be in a format that is publicly
|
339 |
+
documented (and with an implementation available to the public in
|
340 |
+
source code form), and must require no special password or key for
|
341 |
+
unpacking, reading or copying.
|
342 |
+
|
343 |
+
7. Additional Terms.
|
344 |
+
|
345 |
+
"Additional permissions" are terms that supplement the terms of this
|
346 |
+
License by making exceptions from one or more of its conditions.
|
347 |
+
Additional permissions that are applicable to the entire Program shall
|
348 |
+
be treated as though they were included in this License, to the extent
|
349 |
+
that they are valid under applicable law. If additional permissions
|
350 |
+
apply only to part of the Program, that part may be used separately
|
351 |
+
under those permissions, but the entire Program remains governed by
|
352 |
+
this License without regard to the additional permissions.
|
353 |
+
|
354 |
+
When you convey a copy of a covered work, you may at your option
|
355 |
+
remove any additional permissions from that copy, or from any part of
|
356 |
+
it. (Additional permissions may be written to require their own
|
357 |
+
removal in certain cases when you modify the work.) You may place
|
358 |
+
additional permissions on material, added by you to a covered work,
|
359 |
+
for which you have or can give appropriate copyright permission.
|
360 |
+
|
361 |
+
Notwithstanding any other provision of this License, for material you
|
362 |
+
add to a covered work, you may (if authorized by the copyright holders of
|
363 |
+
that material) supplement the terms of this License with terms:
|
364 |
+
|
365 |
+
a) Disclaiming warranty or limiting liability differently from the
|
366 |
+
terms of sections 15 and 16 of this License; or
|
367 |
+
|
368 |
+
b) Requiring preservation of specified reasonable legal notices or
|
369 |
+
author attributions in that material or in the Appropriate Legal
|
370 |
+
Notices displayed by works containing it; or
|
371 |
+
|
372 |
+
c) Prohibiting misrepresentation of the origin of that material, or
|
373 |
+
requiring that modified versions of such material be marked in
|
374 |
+
reasonable ways as different from the original version; or
|
375 |
+
|
376 |
+
d) Limiting the use for publicity purposes of names of licensors or
|
377 |
+
authors of the material; or
|
378 |
+
|
379 |
+
e) Declining to grant rights under trademark law for use of some
|
380 |
+
trade names, trademarks, or service marks; or
|
381 |
+
|
382 |
+
f) Requiring indemnification of licensors and authors of that
|
383 |
+
material by anyone who conveys the material (or modified versions of
|
384 |
+
it) with contractual assumptions of liability to the recipient, for
|
385 |
+
any liability that these contractual assumptions directly impose on
|
386 |
+
those licensors and authors.
|
387 |
+
|
388 |
+
All other non-permissive additional terms are considered "further
|
389 |
+
restrictions" within the meaning of section 10. If the Program as you
|
390 |
+
received it, or any part of it, contains a notice stating that it is
|
391 |
+
governed by this License along with a term that is a further
|
392 |
+
restriction, you may remove that term. If a license document contains
|
393 |
+
a further restriction but permits relicensing or conveying under this
|
394 |
+
License, you may add to a covered work material governed by the terms
|
395 |
+
of that license document, provided that the further restriction does
|
396 |
+
not survive such relicensing or conveying.
|
397 |
+
|
398 |
+
If you add terms to a covered work in accord with this section, you
|
399 |
+
must place, in the relevant source files, a statement of the
|
400 |
+
additional terms that apply to those files, or a notice indicating
|
401 |
+
where to find the applicable terms.
|
402 |
+
|
403 |
+
Additional terms, permissive or non-permissive, may be stated in the
|
404 |
+
form of a separately written license, or stated as exceptions;
|
405 |
+
the above requirements apply either way.
|
406 |
+
|
407 |
+
8. Termination.
|
408 |
+
|
409 |
+
You may not propagate or modify a covered work except as expressly
|
410 |
+
provided under this License. Any attempt otherwise to propagate or
|
411 |
+
modify it is void, and will automatically terminate your rights under
|
412 |
+
this License (including any patent licenses granted under the third
|
413 |
+
paragraph of section 11).
|
414 |
+
|
415 |
+
However, if you cease all violation of this License, then your
|
416 |
+
license from a particular copyright holder is reinstated (a)
|
417 |
+
provisionally, unless and until the copyright holder explicitly and
|
418 |
+
finally terminates your license, and (b) permanently, if the copyright
|
419 |
+
holder fails to notify you of the violation by some reasonable means
|
420 |
+
prior to 60 days after the cessation.
|
421 |
+
|
422 |
+
Moreover, your license from a particular copyright holder is
|
423 |
+
reinstated permanently if the copyright holder notifies you of the
|
424 |
+
violation by some reasonable means, this is the first time you have
|
425 |
+
received notice of violation of this License (for any work) from that
|
426 |
+
copyright holder, and you cure the violation prior to 30 days after
|
427 |
+
your receipt of the notice.
|
428 |
+
|
429 |
+
Termination of your rights under this section does not terminate the
|
430 |
+
licenses of parties who have received copies or rights from you under
|
431 |
+
this License. If your rights have been terminated and not permanently
|
432 |
+
reinstated, you do not qualify to receive new licenses for the same
|
433 |
+
material under section 10.
|
434 |
+
|
435 |
+
9. Acceptance Not Required for Having Copies.
|
436 |
+
|
437 |
+
You are not required to accept this License in order to receive or
|
438 |
+
run a copy of the Program. Ancillary propagation of a covered work
|
439 |
+
occurring solely as a consequence of using peer-to-peer transmission
|
440 |
+
to receive a copy likewise does not require acceptance. However,
|
441 |
+
nothing other than this License grants you permission to propagate or
|
442 |
+
modify any covered work. These actions infringe copyright if you do
|
443 |
+
not accept this License. Therefore, by modifying or propagating a
|
444 |
+
covered work, you indicate your acceptance of this License to do so.
|
445 |
+
|
446 |
+
10. Automatic Licensing of Downstream Recipients.
|
447 |
+
|
448 |
+
Each time you convey a covered work, the recipient automatically
|
449 |
+
receives a license from the original licensors, to run, modify and
|
450 |
+
propagate that work, subject to this License. You are not responsible
|
451 |
+
for enforcing compliance by third parties with this License.
|
452 |
+
|
453 |
+
An "entity transaction" is a transaction transferring control of an
|
454 |
+
organization, or substantially all assets of one, or subdividing an
|
455 |
+
organization, or merging organizations. If propagation of a covered
|
456 |
+
work results from an entity transaction, each party to that
|
457 |
+
transaction who receives a copy of the work also receives whatever
|
458 |
+
licenses to the work the party's predecessor in interest had or could
|
459 |
+
give under the previous paragraph, plus a right to possession of the
|
460 |
+
Corresponding Source of the work from the predecessor in interest, if
|
461 |
+
the predecessor has it or can get it with reasonable efforts.
|
462 |
+
|
463 |
+
You may not impose any further restrictions on the exercise of the
|
464 |
+
rights granted or affirmed under this License. For example, you may
|
465 |
+
not impose a license fee, royalty, or other charge for exercise of
|
466 |
+
rights granted under this License, and you may not initiate litigation
|
467 |
+
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
468 |
+
any patent claim is infringed by making, using, selling, offering for
|
469 |
+
sale, or importing the Program or any portion of it.
|
470 |
+
|
471 |
+
11. Patents.
|
472 |
+
|
473 |
+
A "contributor" is a copyright holder who authorizes use under this
|
474 |
+
License of the Program or a work on which the Program is based. The
|
475 |
+
work thus licensed is called the contributor's "contributor version".
|
476 |
+
|
477 |
+
A contributor's "essential patent claims" are all patent claims
|
478 |
+
owned or controlled by the contributor, whether already acquired or
|
479 |
+
hereafter acquired, that would be infringed by some manner, permitted
|
480 |
+
by this License, of making, using, or selling its contributor version,
|
481 |
+
but do not include claims that would be infringed only as a
|
482 |
+
consequence of further modification of the contributor version. For
|
483 |
+
purposes of this definition, "control" includes the right to grant
|
484 |
+
patent sublicenses in a manner consistent with the requirements of
|
485 |
+
this License.
|
486 |
+
|
487 |
+
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
488 |
+
patent license under the contributor's essential patent claims, to
|
489 |
+
make, use, sell, offer for sale, import and otherwise run, modify and
|
490 |
+
propagate the contents of its contributor version.
|
491 |
+
|
492 |
+
In the following three paragraphs, a "patent license" is any express
|
493 |
+
agreement or commitment, however denominated, not to enforce a patent
|
494 |
+
(such as an express permission to practice a patent or covenant not to
|
495 |
+
sue for patent infringement). To "grant" such a patent license to a
|
496 |
+
party means to make such an agreement or commitment not to enforce a
|
497 |
+
patent against the party.
|
498 |
+
|
499 |
+
If you convey a covered work, knowingly relying on a patent license,
|
500 |
+
and the Corresponding Source of the work is not available for anyone
|
501 |
+
to copy, free of charge and under the terms of this License, through a
|
502 |
+
publicly available network server or other readily accessible means,
|
503 |
+
then you must either (1) cause the Corresponding Source to be so
|
504 |
+
available, or (2) arrange to deprive yourself of the benefit of the
|
505 |
+
patent license for this particular work, or (3) arrange, in a manner
|
506 |
+
consistent with the requirements of this License, to extend the patent
|
507 |
+
license to downstream recipients. "Knowingly relying" means you have
|
508 |
+
actual knowledge that, but for the patent license, your conveying the
|
509 |
+
covered work in a country, or your recipient's use of the covered work
|
510 |
+
in a country, would infringe one or more identifiable patents in that
|
511 |
+
country that you have reason to believe are valid.
|
512 |
+
|
513 |
+
If, pursuant to or in connection with a single transaction or
|
514 |
+
arrangement, you convey, or propagate by procuring conveyance of, a
|
515 |
+
covered work, and grant a patent license to some of the parties
|
516 |
+
receiving the covered work authorizing them to use, propagate, modify
|
517 |
+
or convey a specific copy of the covered work, then the patent license
|
518 |
+
you grant is automatically extended to all recipients of the covered
|
519 |
+
work and works based on it.
|
520 |
+
|
521 |
+
A patent license is "discriminatory" if it does not include within
|
522 |
+
the scope of its coverage, prohibits the exercise of, or is
|
523 |
+
conditioned on the non-exercise of one or more of the rights that are
|
524 |
+
specifically granted under this License. You may not convey a covered
|
525 |
+
work if you are a party to an arrangement with a third party that is
|
526 |
+
in the business of distributing software, under which you make payment
|
527 |
+
to the third party based on the extent of your activity of conveying
|
528 |
+
the work, and under which the third party grants, to any of the
|
529 |
+
parties who would receive the covered work from you, a discriminatory
|
530 |
+
patent license (a) in connection with copies of the covered work
|
531 |
+
conveyed by you (or copies made from those copies), or (b) primarily
|
532 |
+
for and in connection with specific products or compilations that
|
533 |
+
contain the covered work, unless you entered into that arrangement,
|
534 |
+
or that patent license was granted, prior to 28 March 2007.
|
535 |
+
|
536 |
+
Nothing in this License shall be construed as excluding or limiting
|
537 |
+
any implied license or other defenses to infringement that may
|
538 |
+
otherwise be available to you under applicable patent law.
|
539 |
+
|
540 |
+
12. No Surrender of Others' Freedom.
|
541 |
+
|
542 |
+
If conditions are imposed on you (whether by court order, agreement or
|
543 |
+
otherwise) that contradict the conditions of this License, they do not
|
544 |
+
excuse you from the conditions of this License. If you cannot convey a
|
545 |
+
covered work so as to satisfy simultaneously your obligations under this
|
546 |
+
License and any other pertinent obligations, then as a consequence you may
|
547 |
+
not convey it at all. For example, if you agree to terms that obligate you
|
548 |
+
to collect a royalty for further conveying from those to whom you convey
|
549 |
+
the Program, the only way you could satisfy both those terms and this
|
550 |
+
License would be to refrain entirely from conveying the Program.
|
551 |
+
|
552 |
+
13. Use with the GNU Affero General Public License.
|
553 |
+
|
554 |
+
Notwithstanding any other provision of this License, you have
|
555 |
+
permission to link or combine any covered work with a work licensed
|
556 |
+
under version 3 of the GNU Affero General Public License into a single
|
557 |
+
combined work, and to convey the resulting work. The terms of this
|
558 |
+
License will continue to apply to the part which is the covered work,
|
559 |
+
but the special requirements of the GNU Affero General Public License,
|
560 |
+
section 13, concerning interaction through a network will apply to the
|
561 |
+
combination as such.
|
562 |
+
|
563 |
+
14. Revised Versions of this License.
|
564 |
+
|
565 |
+
The Free Software Foundation may publish revised and/or new versions of
|
566 |
+
the GNU General Public License from time to time. Such new versions will
|
567 |
+
be similar in spirit to the present version, but may differ in detail to
|
568 |
+
address new problems or concerns.
|
569 |
+
|
570 |
+
Each version is given a distinguishing version number. If the
|
571 |
+
Program specifies that a certain numbered version of the GNU General
|
572 |
+
Public License "or any later version" applies to it, you have the
|
573 |
+
option of following the terms and conditions either of that numbered
|
574 |
+
version or of any later version published by the Free Software
|
575 |
+
Foundation. If the Program does not specify a version number of the
|
576 |
+
GNU General Public License, you may choose any version ever published
|
577 |
+
by the Free Software Foundation.
|
578 |
+
|
579 |
+
If the Program specifies that a proxy can decide which future
|
580 |
+
versions of the GNU General Public License can be used, that proxy's
|
581 |
+
public statement of acceptance of a version permanently authorizes you
|
582 |
+
to choose that version for the Program.
|
583 |
+
|
584 |
+
Later license versions may give you additional or different
|
585 |
+
permissions. However, no additional obligations are imposed on any
|
586 |
+
author or copyright holder as a result of your choosing to follow a
|
587 |
+
later version.
|
588 |
+
|
589 |
+
15. Disclaimer of Warranty.
|
590 |
+
|
591 |
+
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
592 |
+
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
593 |
+
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
594 |
+
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
595 |
+
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
596 |
+
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
597 |
+
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
598 |
+
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
599 |
+
|
600 |
+
16. Limitation of Liability.
|
601 |
+
|
602 |
+
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
603 |
+
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
604 |
+
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
605 |
+
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
606 |
+
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
607 |
+
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
608 |
+
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
609 |
+
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
610 |
+
SUCH DAMAGES.
|
611 |
+
|
612 |
+
17. Interpretation of Sections 15 and 16.
|
613 |
+
|
614 |
+
If the disclaimer of warranty and limitation of liability provided
|
615 |
+
above cannot be given local legal effect according to their terms,
|
616 |
+
reviewing courts shall apply local law that most closely approximates
|
617 |
+
an absolute waiver of all civil liability in connection with the
|
618 |
+
Program, unless a warranty or assumption of liability accompanies a
|
619 |
+
copy of the Program in return for a fee.
|
620 |
+
|
621 |
+
END OF TERMS AND CONDITIONS
|
622 |
+
|
623 |
+
How to Apply These Terms to Your New Programs
|
624 |
+
|
625 |
+
If you develop a new program, and you want it to be of the greatest
|
626 |
+
possible use to the public, the best way to achieve this is to make it
|
627 |
+
free software which everyone can redistribute and change under these terms.
|
628 |
+
|
629 |
+
To do so, attach the following notices to the program. It is safest
|
630 |
+
to attach them to the start of each source file to most effectively
|
631 |
+
state the exclusion of warranty; and each file should have at least
|
632 |
+
the "copyright" line and a pointer to where the full notice is found.
|
633 |
+
|
634 |
+
{one line to give the program's name and a brief idea of what it does.}
|
635 |
+
Copyright (C) {year} {name of author}
|
636 |
+
|
637 |
+
This program is free software: you can redistribute it and/or modify
|
638 |
+
it under the terms of the GNU General Public License as published by
|
639 |
+
the Free Software Foundation, either version 3 of the License, or
|
640 |
+
(at your option) any later version.
|
641 |
+
|
642 |
+
This program is distributed in the hope that it will be useful,
|
643 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
644 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
645 |
+
GNU General Public License for more details.
|
646 |
+
|
647 |
+
You should have received a copy of the GNU General Public License
|
648 |
+
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
649 |
+
|
650 |
+
Also add information on how to contact you by electronic and paper mail.
|
651 |
+
|
652 |
+
If the program does terminal interaction, make it output a short
|
653 |
+
notice like this when it starts in an interactive mode:
|
654 |
+
|
655 |
+
{project} Copyright (C) {year} {fullname}
|
656 |
+
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
657 |
+
This is free software, and you are welcome to redistribute it
|
658 |
+
under certain conditions; type `show c' for details.
|
659 |
+
|
660 |
+
The hypothetical commands `show w' and `show c' should show the appropriate
|
661 |
+
parts of the General Public License. Of course, your program's commands
|
662 |
+
might be different; for a GUI interface, you would use an "about box".
|
663 |
+
|
664 |
+
You should also get your employer (if you work as a programmer) or school,
|
665 |
+
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
666 |
+
For more information on this, and how to apply and follow the GNU GPL, see
|
667 |
+
<http://www.gnu.org/licenses/>.
|
668 |
+
|
669 |
+
The GNU General Public License does not permit incorporating your program
|
670 |
+
into proprietary programs. If your program is a subroutine library, you
|
671 |
+
may consider it more useful to permit linking proprietary applications with
|
672 |
+
the library. If this is what you want to do, use the GNU Lesser General
|
673 |
+
Public License instead of this License. But first, please read
|
674 |
+
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
vendor/codeinwp/themeisle-sdk/README.md
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
1 |
+
# themeisle-sdk
|
2 |
+
ThemeIsle SDK library
|
vendor/codeinwp/themeisle-sdk/class-themeisle-sdk-licenser.php
ADDED
@@ -0,0 +1,660 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* The main loader class for license handling.
|
4 |
+
*
|
5 |
+
* @package ThemeIsleSDK
|
6 |
+
* @subpackage Licenser
|
7 |
+
* @copyright Copyright (c) 2017, Marius Cristea
|
8 |
+
* @license http://opensource.org/licenses/gpl-3.0.php GNU Public License
|
9 |
+
* @since 1.0.0
|
10 |
+
*/
|
11 |
+
if ( ! class_exists( 'ThemeIsle_SDK_Licenser' ) ) :
|
12 |
+
/**
|
13 |
+
* Class ThemeIsle_SDK_Licenser
|
14 |
+
*
|
15 |
+
* Used to update the themeisle products
|
16 |
+
*/
|
17 |
+
class ThemeIsle_SDK_Licenser {
|
18 |
+
|
19 |
+
/**
|
20 |
+
* @var string $license_key The license key string
|
21 |
+
*/
|
22 |
+
public $license_key;
|
23 |
+
|
24 |
+
/**
|
25 |
+
* @var bool $do_check This ensures that the custom API request only runs on the second time that WP fires the update check
|
26 |
+
*/
|
27 |
+
private $do_check = false;
|
28 |
+
|
29 |
+
/**
|
30 |
+
* @var bool $failed_checks Number of failed checks to the api endpoint
|
31 |
+
*/
|
32 |
+
private $failed_checks = 0;
|
33 |
+
/**
|
34 |
+
* @var ThemeIsle_SDK_Product $product The ThemeIsle Product.
|
35 |
+
*/
|
36 |
+
private $product;
|
37 |
+
/**
|
38 |
+
* @var string $product_key The product update response key.
|
39 |
+
*/
|
40 |
+
private $product_key;
|
41 |
+
/**
|
42 |
+
* @var int $max_failed Maximum failed checks allowed before show the notice
|
43 |
+
*/
|
44 |
+
private static $max_failed = 5;
|
45 |
+
|
46 |
+
/**
|
47 |
+
* ThemeIsle_SDK_Licenser constructor.
|
48 |
+
*
|
49 |
+
* @param ThemeIsle_SDK_Product $product The product object.
|
50 |
+
*/
|
51 |
+
public function __construct( $product ) {
|
52 |
+
$this->product = $product;
|
53 |
+
$this->product_key = $this->product->get_key() . '-update-response';
|
54 |
+
if ( ! $this->product->requires_license() ) {
|
55 |
+
$this->license_key = 'free';
|
56 |
+
} else {
|
57 |
+
$license_data = get_option( $this->product->get_key() . '_license_data', '' );
|
58 |
+
$this->failed_checks = intval( get_option( $this->product->get_key() . '_failed_checks', 0 ) );
|
59 |
+
if ( $license_data !== '' ) {
|
60 |
+
$this->license_key = isset( $license_data->key ) ? $license_data->key : get_option( $this->product->get_key() . '_license', '' );
|
61 |
+
} else {
|
62 |
+
$this->license_key = get_option( $this->product->get_key() . '_license', '' );
|
63 |
+
}
|
64 |
+
$this->register_license_hooks();
|
65 |
+
}
|
66 |
+
}
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Register license hooks for the themeisle products
|
70 |
+
*/
|
71 |
+
public function register_license_hooks() {
|
72 |
+
add_action( 'admin_init', array( $this, 'register_settings' ) );
|
73 |
+
add_action( 'admin_init', array( $this, 'activate_license' ) );
|
74 |
+
add_action( 'admin_init', array( $this, 'product_valid' ), 99999999 );
|
75 |
+
add_action( 'admin_notices', array( $this, 'show_notice' ) );
|
76 |
+
}
|
77 |
+
|
78 |
+
/**
|
79 |
+
* Register the setting for the license of the product
|
80 |
+
*
|
81 |
+
* @return bool
|
82 |
+
*/
|
83 |
+
public function register_settings() {
|
84 |
+
if ( ! is_admin() ) {
|
85 |
+
return false;
|
86 |
+
}
|
87 |
+
add_settings_field(
|
88 |
+
$this->product->get_key() . '_license',
|
89 |
+
$this->product->get_name() . ' license',
|
90 |
+
array( $this, 'license_view' ),
|
91 |
+
'general'
|
92 |
+
);
|
93 |
+
}
|
94 |
+
|
95 |
+
/**
|
96 |
+
* The license view field
|
97 |
+
*/
|
98 |
+
public function license_view() {
|
99 |
+
$status = $this->get_license_status();
|
100 |
+
$value = $this->license_key;
|
101 |
+
|
102 |
+
$activate_string = apply_filters( $this->product->get_key() . '_lc_activate_string', 'Activate' );
|
103 |
+
$deactivate_string = apply_filters( $this->product->get_key() . '_lc_deactivate_string', 'Deactivate' );
|
104 |
+
$valid_string = apply_filters( $this->product->get_key() . '_lc_valid_string', 'Valid' );
|
105 |
+
$invalid_string = apply_filters( $this->product->get_key() . '_lc_invalid_string', 'Invalid' );
|
106 |
+
$license_message = apply_filters( $this->product->get_key() . '_lc_license_message', 'Enter your license from %s purchase history in order to get %s updates' );
|
107 |
+
|
108 |
+
echo '<p ><input ' . ( ( $status === 'valid' ) ? ( 'style="border:1px solid #7ad03a; "' ) : '' ) . ' type="text" id="' . $this->product->get_key() . '_license" name="' . $this->product->get_key() . '_license" value="' . $value . '" /><a ' . ( ( $status === 'valid' ) ? ( 'style="color:#fff;background: #7ad03a; display: inline-block;text-decoration: none;font-size: 13px;line-height: 26px;height: 26px; margin-left:5px; padding: 0 10px 1px; -webkit-border-radius: 3px;border-radius: 3px; ">' . $valid_string ) : ( 'style="color:#fff;background: #dd3d36; display: inline-block;text-decoration: none;font-size: 13px;line-height: 26px;height: 26px; margin-left:5px; padding: 0 10px 1px; -webkit-border-radius: 3px;border-radius: 3px; ">' . $invalid_string ) ) . ' </a> <button name="' . $this->product->get_key() . '_btn_trigger" ' . ( ( $status === 'valid' ) ? ( ' class="button button-primary">' . $deactivate_string ) : ( ' class="button button-primary" value="yes" type="submit" >' . $activate_string ) ) . ' </button></p><p class="description">' . sprintf( $license_message, '<a href="' . $this->product->get_store_url() . '">' . $this->product->get_store_url() . '</a> ', $this->product->get_type() ) . '</p>';
|
109 |
+
|
110 |
+
}
|
111 |
+
|
112 |
+
/**
|
113 |
+
* Return the license status.
|
114 |
+
*
|
115 |
+
* @return string The License status.
|
116 |
+
*/
|
117 |
+
public function get_license_status() {
|
118 |
+
$license_data = get_option( $this->product->get_key() . '_license_data', '' );
|
119 |
+
if ( $license_data !== '' ) {
|
120 |
+
return isset( $license_data->license ) ? $license_data->license : get_option( $this->product->get_key() . '_license_status', 'not_active' );
|
121 |
+
} else {
|
122 |
+
return get_option( $this->product->get_key() . '_license_status', 'not_active' );
|
123 |
+
}
|
124 |
+
|
125 |
+
}
|
126 |
+
|
127 |
+
/**
|
128 |
+
* Check if the license is active or not
|
129 |
+
*
|
130 |
+
* @return bool
|
131 |
+
*/
|
132 |
+
public function check_activation() {
|
133 |
+
$license_data = get_option( $this->product->get_key() . '_license_data', '' );
|
134 |
+
if ( $license_data !== '' ) {
|
135 |
+
return isset( $license_data->error ) ? ( $license_data->error == 'no_activations_left' ) : false;
|
136 |
+
}
|
137 |
+
|
138 |
+
return false;
|
139 |
+
}
|
140 |
+
|
141 |
+
/**
|
142 |
+
* Check if the license is about to expire in the next month
|
143 |
+
*
|
144 |
+
* @return bool
|
145 |
+
*/
|
146 |
+
function check_expiration() {
|
147 |
+
$license_data = get_option( $this->product->get_key() . '_license_data', '' );
|
148 |
+
if ( $license_data !== '' ) {
|
149 |
+
if ( isset( $license_data->expires ) ) {
|
150 |
+
if ( strtotime( $license_data->expires ) - time() < 30 * 24 * 3600 ) {
|
151 |
+
return true;
|
152 |
+
}
|
153 |
+
}
|
154 |
+
}
|
155 |
+
|
156 |
+
return false;
|
157 |
+
}
|
158 |
+
|
159 |
+
/**
|
160 |
+
* Return the renew url from the store used
|
161 |
+
*
|
162 |
+
* @return string The renew url.
|
163 |
+
*/
|
164 |
+
function renew_url() {
|
165 |
+
$license_data = get_option( $this->product->get_key() . '_license_data', '' );
|
166 |
+
if ( $license_data !== '' ) {
|
167 |
+
if ( isset( $license_data->download_id ) && isset( $license_data->key ) ) {
|
168 |
+
return $this->product->get_store_url() . '/checkout/?edd_license_key=' . $license_data->key . '&download_id=' . $license_data->download_id;
|
169 |
+
}
|
170 |
+
}
|
171 |
+
|
172 |
+
return $this->product->get_store_url();
|
173 |
+
}
|
174 |
+
|
175 |
+
/**
|
176 |
+
* Check if we hide the notificatin nag or not
|
177 |
+
*
|
178 |
+
* @param string $hide The notification to hide.
|
179 |
+
*
|
180 |
+
* @return bool Either hide them or not.
|
181 |
+
*/
|
182 |
+
function check_hide( $hide ) {
|
183 |
+
if ( isset( $_GET[ $this->product->get_key() . '_hide_' . $hide ] ) ) {
|
184 |
+
if ( $_GET[ $this->product->get_key() . '_hide_' . $hide ] === 'yes' ) {
|
185 |
+
update_option( $this->product->get_key() . '_hide_' . $hide, 'yes' );
|
186 |
+
|
187 |
+
return false;
|
188 |
+
}
|
189 |
+
} else {
|
190 |
+
$license = get_option( $this->product->get_key() . '_hide_' . $hide, '' );
|
191 |
+
if ( $license === 'yes' ) {
|
192 |
+
return false;
|
193 |
+
}
|
194 |
+
}
|
195 |
+
|
196 |
+
return true;
|
197 |
+
}
|
198 |
+
|
199 |
+
/**
|
200 |
+
* Show the admin notice regarding the license status
|
201 |
+
*
|
202 |
+
* @return bool
|
203 |
+
*/
|
204 |
+
function show_notice() {
|
205 |
+
if ( ! is_admin() ) {
|
206 |
+
return false;
|
207 |
+
}
|
208 |
+
$status = $this->get_license_status();
|
209 |
+
$no_activations_string = apply_filters( $this->product->get_key() . '_lc_no_activations_string', 'No activations left for %s !!!. You need to
|
210 |
+
upgrade your plan in order to use %s on more
|
211 |
+
websites. Please ask the %s
|
212 |
+
Staff for more details.' );
|
213 |
+
$no_valid_string = apply_filters( $this->product->get_key() . '_lc_no_valid_string', 'In order to benefit from updates and support for %s , please add
|
214 |
+
your license code from your <a href="%s" target="_blank">purchase history</a> and validate it <a
|
215 |
+
href="%s">here</a> ' );
|
216 |
+
$expiration_string = apply_filters( $this->product->get_key() . '_lc_expiration_string', 'Your license is about to expire
|
217 |
+
for %s. You can go to %s and renew it ' );
|
218 |
+
$hide_notice_string = apply_filters( $this->product->get_key() . '_lc_hide_notice_string', 'Hide Notice' );
|
219 |
+
if ( $status != 'valid' ) {
|
220 |
+
if ( $this->check_activation() ) {
|
221 |
+
if ( $this->check_hide( 'activation' ) ) {
|
222 |
+
?>
|
223 |
+
<div class="error">
|
224 |
+
<p><strong><?php
|
225 |
+
echo sprintf( $no_activations_string, $this->product->get_name(), $this->product->get_name(), '<a href="' . $this->product->get_store_url() . '"
|
226 |
+
target="_blank">' . $this->product->get_store_name() . '</a>' );
|
227 |
+
?></strong> | <a
|
228 |
+
href="<?php echo add_query_arg( $this->product->get_key() . '_activation', 'yes' ); ?> "><?php echo $hide_notice_string; ?></a>
|
229 |
+
</p>
|
230 |
+
</div>
|
231 |
+
<?php
|
232 |
+
return false;
|
233 |
+
}
|
234 |
+
}
|
235 |
+
?>
|
236 |
+
<?php if ( $this->check_hide( 'valid' ) ) : ?>
|
237 |
+
<div class="error">
|
238 |
+
<p>
|
239 |
+
<strong><?php echo sprintf( $no_valid_string, $this->product->get_name() . ' ' . $this->product->get_type(), $this->product->get_type(), admin_url( 'options-general.php' ) . '#' . $this->product->get_key() ); ?> </strong>|
|
240 |
+
<a
|
241 |
+
href="<?php echo add_query_arg( $this->product->get_key() . '_hide_valid', 'yes' ); ?> "><?php echo $hide_notice_string; ?></a>
|
242 |
+
</p>
|
243 |
+
</div>
|
244 |
+
<?php endif; ?>
|
245 |
+
<?php
|
246 |
+
} else {
|
247 |
+
if ( $this->check_expiration() ) {
|
248 |
+
if ( $this->check_hide( 'expiration' ) ) {
|
249 |
+
?>
|
250 |
+
<div class="update-nag">
|
251 |
+
<p>
|
252 |
+
<strong><?php echo sprintf( $expiration_string, $this->product->get_name() . ' ' . $this->product->get_type(), '<a
|
253 |
+
href="' . $this->renew_url() . '"
|
254 |
+
target="_blank">' . $this->product->get_store_name() . '</a>' ); ?> </strong> |
|
255 |
+
<a
|
256 |
+
href="<?php echo add_query_arg( $this->product->get_key() . '_hide_expiration', 'yes' ); ?> "><?php echo $hide_notice_string; ?></a>
|
257 |
+
</p>
|
258 |
+
</div>
|
259 |
+
<?php
|
260 |
+
}
|
261 |
+
}
|
262 |
+
}
|
263 |
+
}
|
264 |
+
|
265 |
+
/**
|
266 |
+
* Run the license check call
|
267 |
+
*/
|
268 |
+
public function product_valid() {
|
269 |
+
if ( false === ( $license = get_transient( $this->product->get_key() . '_license_data' ) ) ) {
|
270 |
+
$license = $this->check_license();
|
271 |
+
set_transient( $this->product->get_key() . '_license_data', $license, 12 * HOUR_IN_SECONDS );
|
272 |
+
update_option( $this->product->get_key() . '_license_data', $license );
|
273 |
+
}
|
274 |
+
|
275 |
+
}
|
276 |
+
|
277 |
+
/**
|
278 |
+
* Increment the failed checks
|
279 |
+
*/
|
280 |
+
private function increment_failed_checks() {
|
281 |
+
$this->failed_checks ++;
|
282 |
+
update_option( $this->product->get_key() . '_failed_checks', $this->failed_checks );
|
283 |
+
}
|
284 |
+
|
285 |
+
/**
|
286 |
+
* Reset the failed checks
|
287 |
+
*/
|
288 |
+
private function reset_failed_checks() {
|
289 |
+
$this->failed_checks = 1;
|
290 |
+
update_option( $this->product->get_key() . '_failed_checks', $this->failed_checks );
|
291 |
+
}
|
292 |
+
|
293 |
+
/**
|
294 |
+
* Check the license status
|
295 |
+
*
|
296 |
+
* @return object The license data.
|
297 |
+
*/
|
298 |
+
public function check_license() {
|
299 |
+
$status = $this->get_license_status();
|
300 |
+
if ( $status == 'not_active' ) {
|
301 |
+
$license_data = new stdClass();
|
302 |
+
$license_data->license = 'not_active';
|
303 |
+
|
304 |
+
return $license_data;
|
305 |
+
}
|
306 |
+
$license = trim( $this->license_key );
|
307 |
+
$api_params = array(
|
308 |
+
'edd_action' => 'check_license',
|
309 |
+
'license' => $license,
|
310 |
+
'item_name' => urlencode( $this->product->get_name() ),
|
311 |
+
'url' => urlencode( home_url() ),
|
312 |
+
);
|
313 |
+
// Call the custom API.
|
314 |
+
$response = wp_remote_get( add_query_arg( $api_params, $this->product->get_store_url() ), array(
|
315 |
+
'timeout' => 15,
|
316 |
+
'sslverify' => false,
|
317 |
+
) );
|
318 |
+
if ( is_wp_error( $response ) ) {
|
319 |
+
$license_data = new stdClass();
|
320 |
+
$license_data->license = 'valid';
|
321 |
+
|
322 |
+
} else {
|
323 |
+
$license_data = json_decode( wp_remote_retrieve_body( $response ) );
|
324 |
+
if ( ! is_object( $license_data ) ) {
|
325 |
+
$license_data = new stdClass();
|
326 |
+
$license_data->license = 'valid';
|
327 |
+
}
|
328 |
+
}
|
329 |
+
$license_old = get_option( $this->product->get_key() . '_license_data', '' );
|
330 |
+
if ( $license_old->license == 'valid' && ( $license_data->license != $license_old->license ) ) {
|
331 |
+
$this->increment_failed_checks();
|
332 |
+
} else {
|
333 |
+
$this->reset_failed_checks();
|
334 |
+
}
|
335 |
+
|
336 |
+
if ( $this->failed_checks <= self::$max_failed ) {
|
337 |
+
return $license_old;
|
338 |
+
}
|
339 |
+
|
340 |
+
if ( isset( $license_old->hide_valid ) ) {
|
341 |
+
$license_data->hide_valid = true;
|
342 |
+
}
|
343 |
+
|
344 |
+
if ( ! isset( $license_data->key ) ) {
|
345 |
+
$license_data->key = isset( $license_old->key ) ? $license_old->key : '';
|
346 |
+
}
|
347 |
+
|
348 |
+
if ( isset( $license_old->hide_expiration ) ) {
|
349 |
+
$license_data->hide_expiration = true;
|
350 |
+
}
|
351 |
+
|
352 |
+
if ( isset( $license_old->hide_activation ) ) {
|
353 |
+
$license_data->hide_activation = true;
|
354 |
+
}
|
355 |
+
|
356 |
+
return $license_data;
|
357 |
+
|
358 |
+
}
|
359 |
+
|
360 |
+
/**
|
361 |
+
* Activate the license remotely
|
362 |
+
*/
|
363 |
+
function activate_license() {
|
364 |
+
// listen for our activate button to be clicked
|
365 |
+
if ( isset( $_POST[ $this->product->get_key() . '_btn_trigger' ] ) ) {
|
366 |
+
$status = $this->get_license_status();
|
367 |
+
// retrieve the license from the database
|
368 |
+
$license = $_POST[ $this->product->get_key() . '_license' ];
|
369 |
+
$api_params = array(
|
370 |
+
'license' => $license,
|
371 |
+
'item_name' => urlencode( $this->product->get_name() ),
|
372 |
+
'url' => urlencode( home_url() ),
|
373 |
+
);
|
374 |
+
if ( $status != 'valid' ) {
|
375 |
+
// data to send in our API request
|
376 |
+
$api_params['edd_action'] = 'activate_license';
|
377 |
+
} else {
|
378 |
+
$api_params['edd_action'] = 'deactivate_license';
|
379 |
+
}
|
380 |
+
// Call the custom API.
|
381 |
+
$response = wp_remote_get( add_query_arg( $api_params, $this->product->get_store_url() ) );
|
382 |
+
// make sure the response came back okay
|
383 |
+
if ( is_wp_error( $response ) ) {
|
384 |
+
$license_data = new stdClass();
|
385 |
+
$license_data->license = ( $status != 'valid' ) ? 'valid' : 'invalid';
|
386 |
+
|
387 |
+
} else {
|
388 |
+
$license_data = json_decode( wp_remote_retrieve_body( $response ) );
|
389 |
+
if ( ! is_object( $license_data ) ) {
|
390 |
+
$license_data = new stdClass();
|
391 |
+
$license_data->license = ( $status != 'valid' ) ? 'valid' : 'invalid';
|
392 |
+
}
|
393 |
+
}
|
394 |
+
if ( ! isset( $license_data->key ) ) {
|
395 |
+
$license_data->key = $license;
|
396 |
+
}
|
397 |
+
if ( $license_data->license == 'valid' ) {
|
398 |
+
$this->reset_failed_checks();
|
399 |
+
}
|
400 |
+
|
401 |
+
if ( isset( $license_data->plan ) ) {
|
402 |
+
update_option( $this->product->get_key() . '_license_plan', $license_data->plan );
|
403 |
+
}
|
404 |
+
|
405 |
+
update_option( $this->product->get_key() . '_license_data', $license_data );
|
406 |
+
delete_transient( $this->product->get_key() . '_license_data' );
|
407 |
+
set_transient( $this->product->get_key() . '_license_data', $license_data, 12 * HOUR_IN_SECONDS );
|
408 |
+
|
409 |
+
}
|
410 |
+
}
|
411 |
+
|
412 |
+
/**
|
413 |
+
* Enable the license system
|
414 |
+
*/
|
415 |
+
public function enable() {
|
416 |
+
if ( $this->product->get_type() == 'plugin' ) {
|
417 |
+
add_filter( 'pre_set_site_transient_update_plugins', array(
|
418 |
+
$this,
|
419 |
+
'pre_set_site_transient_update_plugins_filter',
|
420 |
+
) );
|
421 |
+
add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 );
|
422 |
+
add_filter( 'http_request_args', array( $this, 'http_request_args' ), 10, 2 );
|
423 |
+
}
|
424 |
+
if ( $this->product->get_type() == 'theme' ) {
|
425 |
+
add_filter( 'site_transient_update_themes', array( &$this, 'theme_update_transient' ) );
|
426 |
+
add_filter( 'delete_site_transient_update_themes', array( &$this, 'delete_theme_update_transient' ) );
|
427 |
+
add_action( 'load-update-core.php', array( &$this, 'delete_theme_update_transient' ) );
|
428 |
+
add_action( 'load-themes.php', array( &$this, 'delete_theme_update_transient' ) );
|
429 |
+
add_action( 'load-themes.php', array( &$this, 'load_themes_screen' ) );
|
430 |
+
|
431 |
+
}
|
432 |
+
|
433 |
+
}
|
434 |
+
|
435 |
+
/**
|
436 |
+
* Load the Themes screen
|
437 |
+
*/
|
438 |
+
function load_themes_screen() {
|
439 |
+
add_thickbox();
|
440 |
+
add_action( 'admin_notices', array( &$this, 'update_nag' ) );
|
441 |
+
}
|
442 |
+
|
443 |
+
/**
|
444 |
+
* Alter the nag for themes update
|
445 |
+
*/
|
446 |
+
function update_nag() {
|
447 |
+
$theme = wp_get_theme( $this->product->get_slug() );
|
448 |
+
$api_response = get_transient( $this->product_key );
|
449 |
+
if ( false === $api_response ) {
|
450 |
+
return;
|
451 |
+
}
|
452 |
+
$update_url = wp_nonce_url( 'update.php?action=upgrade-theme&theme=' . urlencode( $this->product->get_slug() ), 'upgrade-theme_' . $this->product->get_slug() );
|
453 |
+
$update_onclick = ' onclick="if ( confirm(\'' . esc_js( __( 'Updating this theme will lose any customizations you have made. Cancel to stop, OK to update.' ) ) . '\') ) {return true;}return false;"';
|
454 |
+
if ( version_compare( $this->product->get_version(), $api_response->new_version, '<' ) ) {
|
455 |
+
echo '<div id="update-nag">';
|
456 |
+
printf( '<strong>%1$s %2$s</strong> is available. <a href="%3$s" class="thickbox" title="%4s">Check out what\'s new</a> or <a href="%5$s"%6$s>update now</a>.',
|
457 |
+
$theme->get( 'Name' ),
|
458 |
+
$api_response->new_version,
|
459 |
+
'#TB_inline?width=640&inlineId=' . $this->product->get_version() . '_changelog',
|
460 |
+
$theme->get( 'Name' ),
|
461 |
+
$update_url,
|
462 |
+
$update_onclick
|
463 |
+
);
|
464 |
+
echo '</div>';
|
465 |
+
echo '<div id="' . $this->product->get_slug() . '_' . 'changelog" style="display:none;">';
|
466 |
+
echo wpautop( $api_response->sections['changelog'] );
|
467 |
+
echo '</div>';
|
468 |
+
}
|
469 |
+
}
|
470 |
+
|
471 |
+
/**
|
472 |
+
* @param mixed $value The transient data.
|
473 |
+
*
|
474 |
+
* @return mixed
|
475 |
+
*/
|
476 |
+
function theme_update_transient( $value ) {
|
477 |
+
$update_data = $this->check_for_update();
|
478 |
+
if ( $update_data ) {
|
479 |
+
$value->response[ $this->product->get_slug() ] = $update_data;
|
480 |
+
}
|
481 |
+
|
482 |
+
return $value;
|
483 |
+
}
|
484 |
+
|
485 |
+
/**
|
486 |
+
* Delete the update transient
|
487 |
+
*/
|
488 |
+
function delete_theme_update_transient() {
|
489 |
+
delete_transient( $this->product_key );
|
490 |
+
}
|
491 |
+
|
492 |
+
/**
|
493 |
+
* Check for updates
|
494 |
+
*
|
495 |
+
* @return array|bool Either the update data or false in case of failure
|
496 |
+
*/
|
497 |
+
function check_for_update() {
|
498 |
+
$theme = wp_get_theme( $this->product->get_slug() );
|
499 |
+
$update_data = get_transient( $this->product_key );
|
500 |
+
if ( false === $update_data ) {
|
501 |
+
$failed = false;
|
502 |
+
if ( empty( $this->license_key ) ) {
|
503 |
+
return false;
|
504 |
+
}
|
505 |
+
$api_params = array(
|
506 |
+
'edd_action' => 'get_version',
|
507 |
+
'version' => $this->product->get_version(),
|
508 |
+
'license' => $this->license_key,
|
509 |
+
'name' => $this->product->get_name(),
|
510 |
+
'slug' => $this->product->get_slug(),
|
511 |
+
'author' => $this->product->get_store_name(),
|
512 |
+
'url' => urlencode( home_url() ),
|
513 |
+
);
|
514 |
+
$response = wp_remote_post( $this->product->get_store_url(), array(
|
515 |
+
'timeout' => 15,
|
516 |
+
'sslverify' => false,
|
517 |
+
'body' => $api_params,
|
518 |
+
) );
|
519 |
+
// make sure the response was successful
|
520 |
+
if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) {
|
521 |
+
$failed = true;
|
522 |
+
}
|
523 |
+
$update_data = json_decode( wp_remote_retrieve_body( $response ) );
|
524 |
+
if ( ! is_object( $update_data ) ) {
|
525 |
+
$failed = true;
|
526 |
+
}
|
527 |
+
// if the response failed, try again in 30 minutes
|
528 |
+
if ( $failed ) {
|
529 |
+
$data = new stdClass;
|
530 |
+
$data->new_version = $this->product->get_version();
|
531 |
+
set_transient( $this->product_key, $data, strtotime( '+30 minutes' ) );
|
532 |
+
|
533 |
+
return false;
|
534 |
+
}
|
535 |
+
// if the status is 'ok', return the update arguments
|
536 |
+
if ( ! $failed ) {
|
537 |
+
$update_data->sections = maybe_unserialize( $update_data->sections );
|
538 |
+
set_transient( $this->product_key, $update_data, strtotime( '+12 hours' ) );
|
539 |
+
}
|
540 |
+
}
|
541 |
+
if ( version_compare( $this->product->get_version(), $update_data->new_version, '>=' ) ) {
|
542 |
+
return false;
|
543 |
+
}
|
544 |
+
|
545 |
+
return (array) $update_data;
|
546 |
+
}
|
547 |
+
|
548 |
+
/**
|
549 |
+
* Check for Updates at the defined API endpoint and modify the update array.
|
550 |
+
*
|
551 |
+
* This function dives into the update API just when WordPress creates its update array,
|
552 |
+
* then adds a custom API call and injects the custom plugin data retrieved from the API.
|
553 |
+
* It is reassembled from parts of the native WordPress plugin update code.
|
554 |
+
* See wp-includes/update.php line 121 for the original wp_update_plugins() function.
|
555 |
+
*
|
556 |
+
* @uses api_request()
|
557 |
+
*
|
558 |
+
* @param array $_transient_data Update array build by WordPress.
|
559 |
+
*
|
560 |
+
* @return array Modified update array with custom plugin data.
|
561 |
+
*/
|
562 |
+
public function pre_set_site_transient_update_plugins_filter( $_transient_data ) {
|
563 |
+
if ( empty( $_transient_data ) || ! $this->do_check ) {
|
564 |
+
$this->do_check = true;
|
565 |
+
|
566 |
+
return $_transient_data;
|
567 |
+
}
|
568 |
+
$api_response = $this->api_request();
|
569 |
+
if ( false !== $api_response && is_object( $api_response ) && isset( $api_response->new_version ) ) {
|
570 |
+
if ( version_compare( $this->product->get_version(), $api_response->new_version, '<' ) ) {
|
571 |
+
$_transient_data->response[ $this->product->get_slug() . '/' . $this->product->get_file() ] = $api_response;
|
572 |
+
}
|
573 |
+
}
|
574 |
+
|
575 |
+
return $_transient_data;
|
576 |
+
}
|
577 |
+
|
578 |
+
/**
|
579 |
+
* Calls the API and, if successfull, returns the object delivered by the API.
|
580 |
+
*
|
581 |
+
* @uses get_bloginfo()
|
582 |
+
* @uses wp_remote_post()
|
583 |
+
* @uses is_wp_error()
|
584 |
+
*
|
585 |
+
* @param string $_action The requested action.
|
586 |
+
* @param array $_data Parameters for the API action.
|
587 |
+
*
|
588 |
+
* @return false||object
|
589 |
+
*/
|
590 |
+
private function api_request( $_action = '', $_data = '' ) {
|
591 |
+
if ( empty( $this->license_key ) ) {
|
592 |
+
return;
|
593 |
+
}
|
594 |
+
$api_params = array(
|
595 |
+
'edd_action' => 'get_version',
|
596 |
+
'license' => $this->license_key,
|
597 |
+
'name' => urlencode( $this->product->get_name() ),
|
598 |
+
'slug' => urlencode( $this->product->get_slug() ),
|
599 |
+
'author' => $this->product->get_store_name(),
|
600 |
+
'url' => urlencode( home_url() ),
|
601 |
+
);
|
602 |
+
$request = wp_remote_post( $this->product->get_store_url(), array(
|
603 |
+
'timeout' => 15,
|
604 |
+
'sslverify' => false,
|
605 |
+
'body' => $api_params,
|
606 |
+
) );
|
607 |
+
if ( ! is_wp_error( $request ) ) :
|
608 |
+
$request = json_decode( wp_remote_retrieve_body( $request ) );
|
609 |
+
if ( $request && isset( $request->sections ) ) {
|
610 |
+
$request->sections = maybe_unserialize( $request->sections );
|
611 |
+
}
|
612 |
+
|
613 |
+
return $request;
|
614 |
+
else :
|
615 |
+
return false;
|
616 |
+
endif;
|
617 |
+
}
|
618 |
+
|
619 |
+
/**
|
620 |
+
* Updates information on the "View version x.x details" page with custom data.
|
621 |
+
*
|
622 |
+
* @uses api_request()
|
623 |
+
*
|
624 |
+
* @param mixed $_data Plugin data.
|
625 |
+
* @param string $_action Action to send.
|
626 |
+
* @param object $_args Arguments to use.
|
627 |
+
*
|
628 |
+
* @return object $_data
|
629 |
+
*/
|
630 |
+
public function plugins_api_filter( $_data, $_action = '', $_args = null ) {
|
631 |
+
if ( ( $_action != 'plugin_information' ) || ! isset( $_args->slug ) || ( $_args->slug != $this->product->get_slug() ) ) {
|
632 |
+
return $_data;
|
633 |
+
}
|
634 |
+
$api_response = $this->api_request();
|
635 |
+
if ( false !== $api_response ) {
|
636 |
+
$_data = $api_response;
|
637 |
+
}
|
638 |
+
|
639 |
+
return $_data;
|
640 |
+
}
|
641 |
+
|
642 |
+
/**
|
643 |
+
* Disable SSL verification in order to prevent download update failures
|
644 |
+
*
|
645 |
+
* @param array $args Http args.
|
646 |
+
* @param string $url Url to check.
|
647 |
+
*
|
648 |
+
* @return object $array
|
649 |
+
*/
|
650 |
+
function http_request_args( $args, $url ) {
|
651 |
+
// If it is an https request and we are performing a package download, disable ssl verification
|
652 |
+
if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) {
|
653 |
+
$args['sslverify'] = false;
|
654 |
+
}
|
655 |
+
|
656 |
+
return $args;
|
657 |
+
}
|
658 |
+
|
659 |
+
}
|
660 |
+
endif;
|
vendor/codeinwp/themeisle-sdk/class-themeisle-sdk-loader.php
ADDED
@@ -0,0 +1,86 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* The main loader class for ThemeIsle SDK
|
4 |
+
*
|
5 |
+
* @package ThemeIsleSDK
|
6 |
+
* @subpackage Loader
|
7 |
+
* @copyright Copyright (c) 2017, Marius Cristea
|
8 |
+
* @license http://opensource.org/licenses/gpl-3.0.php GNU Public License
|
9 |
+
* @since 1.0.0
|
10 |
+
*/
|
11 |
+
// Exit if accessed directly.
|
12 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
13 |
+
exit;
|
14 |
+
}
|
15 |
+
if ( ! class_exists( 'ThemeIsle_SDK_Loader' ) ) :
|
16 |
+
/**
|
17 |
+
* Singleton loader for ThemeIsle SDK.
|
18 |
+
*/
|
19 |
+
final class ThemeIsle_SDK_Loader {
|
20 |
+
/**
|
21 |
+
* @var ThemeIsle_SDK_Loader instance The singleton instance
|
22 |
+
*/
|
23 |
+
private static $instance;
|
24 |
+
/**
|
25 |
+
* @var string $version The class version.
|
26 |
+
*/
|
27 |
+
private static $version = '1.0.0';
|
28 |
+
/**
|
29 |
+
* @var array The products which use the SDK.
|
30 |
+
*/
|
31 |
+
private static $products;
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Register product into SDK.
|
35 |
+
*
|
36 |
+
* @param string $basefile The product basefile.
|
37 |
+
*
|
38 |
+
* @return ThemeIsle_SDK_Loader The singleton object.
|
39 |
+
*/
|
40 |
+
public static function init_product( $basefile ) {
|
41 |
+
if ( ! isset( self::$instance ) && ! ( self::$instance instanceof ThemeIsle_SDK_Loader ) ) {
|
42 |
+
self::$instance = new ThemeIsle_SDK_Loader;
|
43 |
+
self::$instance->setup_hooks();
|
44 |
+
}
|
45 |
+
$product_object = new ThemeIsle_SDK_Product( $basefile );
|
46 |
+
self::$products[ $product_object->get_slug() ] = $product_object;
|
47 |
+
// Based on the Wordpress Available file header we enable the logger or not.
|
48 |
+
if ( ! $product_object->is_wordpress_available() ) {
|
49 |
+
$licenser = new ThemeIsle_SDK_Licenser( $product_object );
|
50 |
+
$licenser->enable();
|
51 |
+
}
|
52 |
+
// We enable the logger feature.
|
53 |
+
if ( $product_object->is_logger_active() ) {
|
54 |
+
$logger = new ThemeIsle_SDK_Logger( $product_object );
|
55 |
+
$logger->enable();
|
56 |
+
}
|
57 |
+
|
58 |
+
return self::$instance;
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Setup loader hookds.
|
63 |
+
*/
|
64 |
+
public function setup_hooks() {
|
65 |
+
add_filter( 'extra_plugin_headers', array( $this, 'add_extra_headers' ) );
|
66 |
+
add_filter( 'extra_theme_headers', array( $this, 'add_extra_headers' ) );
|
67 |
+
}
|
68 |
+
|
69 |
+
/**
|
70 |
+
* @param array $headers The extra headers.
|
71 |
+
*
|
72 |
+
* @return array The new headers.
|
73 |
+
*/
|
74 |
+
function add_extra_headers( $headers ) {
|
75 |
+
if ( ! in_array( 'Requires License', $headers ) ) {
|
76 |
+
$headers[] = 'Requires License';
|
77 |
+
}
|
78 |
+
if ( ! in_array( 'WordPress Available', $headers ) ) {
|
79 |
+
$headers[] = 'WordPress Available';
|
80 |
+
}
|
81 |
+
|
82 |
+
return $headers;
|
83 |
+
}
|
84 |
+
|
85 |
+
}
|
86 |
+
endif;
|
vendor/codeinwp/themeisle-sdk/class-themeisle-sdk-logger.php
ADDED
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* The main loader class for ThemeIsle SDK
|
4 |
+
*
|
5 |
+
* @package ThemeIsleSDK
|
6 |
+
* @subpackage Logger
|
7 |
+
* @copyright Copyright (c) 2017, Marius Cristea
|
8 |
+
* @license http://opensource.org/licenses/gpl-3.0.php GNU Public License
|
9 |
+
* @since 1.0.0
|
10 |
+
*/
|
11 |
+
if ( ! class_exists( 'ThemeIsle_SDK_Logger' ) ) :
|
12 |
+
/**
|
13 |
+
* Class ThemeIsle_SDK_Logger
|
14 |
+
*
|
15 |
+
* Send the statistics to the Themeisle Endpoint
|
16 |
+
*/
|
17 |
+
/**
|
18 |
+
* Class ThemeIsle_SDK_Logger
|
19 |
+
*/
|
20 |
+
class ThemeIsle_SDK_Logger {
|
21 |
+
|
22 |
+
/**
|
23 |
+
* @var string $logging_url Url where to send the logs
|
24 |
+
*/
|
25 |
+
private $logging_url = 'http://mirror.themeisle.com';
|
26 |
+
|
27 |
+
/**
|
28 |
+
* @var ThemeIsle_SDK_Product $product Themeisle Product.
|
29 |
+
*/
|
30 |
+
private $product;
|
31 |
+
|
32 |
+
/**
|
33 |
+
* @var string $product_cron Cron name handler
|
34 |
+
*/
|
35 |
+
private $product_cron;
|
36 |
+
|
37 |
+
/**
|
38 |
+
* ThemeIsle_SDK_Logger constructor.
|
39 |
+
*
|
40 |
+
* @param ThemeIsle_SDK_Product $product_object Product Object.
|
41 |
+
*/
|
42 |
+
public function __construct( $product_object ) {
|
43 |
+
if ( $product_object instanceof ThemeIsle_SDK_Product ) {
|
44 |
+
$this->product = $product_object;
|
45 |
+
$this->product_cron = $product_object->get_key() . '_log_activity';
|
46 |
+
}
|
47 |
+
}
|
48 |
+
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Start the cron to send the log. It will randomize the interval in order to not send all the logs at the same time.
|
52 |
+
*/
|
53 |
+
public function enable() {
|
54 |
+
if ( ! wp_next_scheduled( $this->product_cron ) ) {
|
55 |
+
wp_schedule_single_event( time() + ( rand( 15, 24 ) * 3600 ), $this->product_cron );
|
56 |
+
}
|
57 |
+
add_action( $this->product_cron, array( $this, 'send_log' ) );
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* Send the statistics to the api endpoint
|
62 |
+
*/
|
63 |
+
public function send_log() {
|
64 |
+
wp_remote_post( $this->logging_url, array(
|
65 |
+
'method' => 'POST',
|
66 |
+
'timeout' => 3,
|
67 |
+
'redirection' => 5,
|
68 |
+
'headers' => array(
|
69 |
+
'X-ThemeIsle-Event' => 'log_site',
|
70 |
+
),
|
71 |
+
'body' => array(
|
72 |
+
'site' => get_site_url(),
|
73 |
+
'product' => $this->product->get_slug(),
|
74 |
+
'version' => $this->product->get_version(),
|
75 |
+
),
|
76 |
+
) );
|
77 |
+
}
|
78 |
+
|
79 |
+
}
|
80 |
+
endif;
|
vendor/codeinwp/themeisle-sdk/class-themeisle-sdk-product.php
ADDED
@@ -0,0 +1,265 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* The product model class for ThemeIsle SDK
|
4 |
+
*
|
5 |
+
* @package ThemeIsleSDK
|
6 |
+
* @subpackage Product
|
7 |
+
* @copyright Copyright (c) 2017, Marius Cristea
|
8 |
+
* @license http://opensource.org/licenses/gpl-3.0.php GNU Public License
|
9 |
+
* @since 1.0.0
|
10 |
+
*/
|
11 |
+
// Exit if accessed directly.
|
12 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
13 |
+
exit;
|
14 |
+
}
|
15 |
+
if ( ! class_exists( 'ThemeIsle_SDK_Product' ) ) :
|
16 |
+
/**
|
17 |
+
* Product model for ThemeIsle SDK.
|
18 |
+
*/
|
19 |
+
class ThemeIsle_SDK_Product {
|
20 |
+
/**
|
21 |
+
* @var string $slug THe product slug.
|
22 |
+
*/
|
23 |
+
private $slug;
|
24 |
+
/**
|
25 |
+
* @var string $basefile The file with headers.
|
26 |
+
*/
|
27 |
+
private $basefile;
|
28 |
+
/**
|
29 |
+
* @var string $type The product type ( plugin | theme ).
|
30 |
+
*/
|
31 |
+
private $type;
|
32 |
+
/**
|
33 |
+
* @var string $file The file name.
|
34 |
+
*/
|
35 |
+
private $file;
|
36 |
+
/**
|
37 |
+
* @var string $name The product name.
|
38 |
+
*/
|
39 |
+
private $name;
|
40 |
+
/**
|
41 |
+
* @var string $key The product ready key.
|
42 |
+
*/
|
43 |
+
private $key;
|
44 |
+
/**
|
45 |
+
* @var string $store_url The store url.
|
46 |
+
*/
|
47 |
+
private $store_url;
|
48 |
+
/**
|
49 |
+
* @var string $store_name The store name.
|
50 |
+
*/
|
51 |
+
private $store_name;
|
52 |
+
/**
|
53 |
+
* @var bool $requires_license Either user needs to activate it with license.
|
54 |
+
*/
|
55 |
+
private $requires_license;
|
56 |
+
/**
|
57 |
+
* @var bool $wordpress_available Either is available on wordpress or not.
|
58 |
+
*/
|
59 |
+
private $wordpress_available;
|
60 |
+
/**
|
61 |
+
* @var string $version The product version.
|
62 |
+
*/
|
63 |
+
private $version;
|
64 |
+
|
65 |
+
/**
|
66 |
+
* ThemeIsle_SDK_Product constructor.
|
67 |
+
*
|
68 |
+
* @param string $basefile Product basefile.
|
69 |
+
*/
|
70 |
+
public function __construct( $basefile ) {
|
71 |
+
if ( ! empty( $basefile ) ) {
|
72 |
+
if ( is_readable( $basefile ) ) {
|
73 |
+
$this->basefile = $basefile;
|
74 |
+
$this->setup_from_path();
|
75 |
+
$this->setup_from_fileheaders();
|
76 |
+
}
|
77 |
+
}
|
78 |
+
}
|
79 |
+
|
80 |
+
/**
|
81 |
+
* Setup props from fileheaders.
|
82 |
+
*/
|
83 |
+
public function setup_from_fileheaders() {
|
84 |
+
$file_headers = array();
|
85 |
+
if ( $this->type == 'plugin' ) {
|
86 |
+
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
87 |
+
$file_headers = get_plugin_data( $this->basefile );
|
88 |
+
}
|
89 |
+
if ( $this->type == 'theme' ) {
|
90 |
+
$file_headers = wp_get_theme( $this->basefile );
|
91 |
+
}
|
92 |
+
$this->name = $file_headers['Name'];
|
93 |
+
$this->store_name = $file_headers['AuthorName'];
|
94 |
+
$this->store_url = $file_headers['AuthorURI'];
|
95 |
+
$this->requires_license = ( $file_headers['Requires License'] == 'yes' ) ? true : false;
|
96 |
+
$this->wordpress_available = ( $file_headers['WordPress Available'] == 'yes' ) ? true : false;
|
97 |
+
$this->version = $file_headers['Version'];
|
98 |
+
|
99 |
+
}
|
100 |
+
|
101 |
+
/**
|
102 |
+
* The magic var_dump info method.
|
103 |
+
*
|
104 |
+
* @return array Debug info.
|
105 |
+
*/
|
106 |
+
public function __debugInfo() {
|
107 |
+
return array(
|
108 |
+
'name' => $this->name,
|
109 |
+
'slug' => $this->slug,
|
110 |
+
'version' => $this->version,
|
111 |
+
'basefile' => $this->basefile,
|
112 |
+
'key' => $this->key,
|
113 |
+
'type' => $this->type,
|
114 |
+
'store_name' => $this->store_name,
|
115 |
+
'store_url' => $this->store_url,
|
116 |
+
'wordpress_available' => $this->wordpress_available,
|
117 |
+
'requires_license' => $this->requires_license,
|
118 |
+
);
|
119 |
+
|
120 |
+
}
|
121 |
+
|
122 |
+
/**
|
123 |
+
* Setup props from path.
|
124 |
+
*/
|
125 |
+
public function setup_from_path() {
|
126 |
+
$this->file = basename( $this->basefile );
|
127 |
+
$dir = dirname( $this->basefile );
|
128 |
+
$this->slug = basename( $dir );
|
129 |
+
$exts = explode( '.', $this->basefile );
|
130 |
+
$ext = $exts[ count( $exts ) - 1 ];
|
131 |
+
if ( $ext == 'css' ) {
|
132 |
+
$this->type = 'theme';
|
133 |
+
}
|
134 |
+
if ( $ext == 'php' ) {
|
135 |
+
$this->type = 'plugin';
|
136 |
+
}
|
137 |
+
$this->key = self::key_ready_name( $this->slug );
|
138 |
+
}
|
139 |
+
|
140 |
+
/**
|
141 |
+
* @param string $string the String to be normalized for cron handler.
|
142 |
+
*
|
143 |
+
* @return string $name The normalized string.
|
144 |
+
*/
|
145 |
+
static function key_ready_name( $string ) {
|
146 |
+
return str_replace( '-', '_', strtolower( trim( $string ) ) );
|
147 |
+
}
|
148 |
+
|
149 |
+
/**
|
150 |
+
* Getter for product name.
|
151 |
+
*
|
152 |
+
* @return string The product name.
|
153 |
+
*/
|
154 |
+
public function get_name() {
|
155 |
+
return $this->name;
|
156 |
+
}
|
157 |
+
|
158 |
+
/**
|
159 |
+
* Getter for product version.
|
160 |
+
*
|
161 |
+
* @return string The product version.
|
162 |
+
*/
|
163 |
+
public function get_version() {
|
164 |
+
return $this->version;
|
165 |
+
}
|
166 |
+
|
167 |
+
/**
|
168 |
+
* If product is available on wordpress.org or not.
|
169 |
+
*
|
170 |
+
* @return bool Either is wp available or not.
|
171 |
+
*/
|
172 |
+
public function is_wordpress_available() {
|
173 |
+
return $this->wordpress_available;
|
174 |
+
}
|
175 |
+
|
176 |
+
/**
|
177 |
+
* Return the product key.
|
178 |
+
*
|
179 |
+
* @return string The product key.
|
180 |
+
*/
|
181 |
+
public function get_key() {
|
182 |
+
return $this->key;
|
183 |
+
}
|
184 |
+
|
185 |
+
/**
|
186 |
+
* Either the product requires license or not.
|
187 |
+
*
|
188 |
+
* @return bool Either requires license or not.
|
189 |
+
*/
|
190 |
+
public function requires_license() {
|
191 |
+
return $this->requires_license;
|
192 |
+
}
|
193 |
+
|
194 |
+
/**
|
195 |
+
* Check if the product is either theme or plugin.
|
196 |
+
*
|
197 |
+
* @return string Product type.
|
198 |
+
*/
|
199 |
+
public function get_type() {
|
200 |
+
return $this->type;
|
201 |
+
}
|
202 |
+
|
203 |
+
/**
|
204 |
+
* Returns the Store name.
|
205 |
+
*
|
206 |
+
* @return string Store name.
|
207 |
+
*/
|
208 |
+
public function get_store_name() {
|
209 |
+
return $this->store_name;
|
210 |
+
}
|
211 |
+
|
212 |
+
/**
|
213 |
+
* Returns the store url.
|
214 |
+
*
|
215 |
+
* @return string The store url.
|
216 |
+
*/
|
217 |
+
public function get_store_url() {
|
218 |
+
return $this->store_url;
|
219 |
+
}
|
220 |
+
|
221 |
+
/**
|
222 |
+
* Returns the product slug.
|
223 |
+
*
|
224 |
+
* @return string The product slug.
|
225 |
+
*/
|
226 |
+
public function get_slug() {
|
227 |
+
return $this->slug;
|
228 |
+
}
|
229 |
+
|
230 |
+
/**
|
231 |
+
* Returns product basefile, which holds the metaheaders.
|
232 |
+
*
|
233 |
+
* @return string The product basefile.
|
234 |
+
*/
|
235 |
+
public function get_basefile() {
|
236 |
+
return $this->basefile;
|
237 |
+
}
|
238 |
+
|
239 |
+
/**
|
240 |
+
* Returns product filename.
|
241 |
+
*
|
242 |
+
* @return string The product filename.
|
243 |
+
*/
|
244 |
+
public function get_file() {
|
245 |
+
return $this->file;
|
246 |
+
}
|
247 |
+
|
248 |
+
/**
|
249 |
+
* We log the user website and product version.
|
250 |
+
*
|
251 |
+
* @return bool Either we log the data or not.
|
252 |
+
*/
|
253 |
+
public function is_logger_active() {
|
254 |
+
// If is not available on wordpress log this automatically.
|
255 |
+
if ( ! $this->is_wordpress_available() ) {
|
256 |
+
return true;
|
257 |
+
} else {
|
258 |
+
// If we have the product on wprog, by default this will be false
|
259 |
+
// and we can change it in each product.
|
260 |
+
return apply_filters( $this->get_key() . '_logger_flag', false );
|
261 |
+
}
|
262 |
+
}
|
263 |
+
|
264 |
+
}
|
265 |
+
endif;
|
vendor/codeinwp/themeisle-sdk/composer.json
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "codeinwp/themeisle-sdk",
|
3 |
+
"description": "ThemeIsle SDK ",
|
4 |
+
"keywords": [
|
5 |
+
"wordpress"
|
6 |
+
],
|
7 |
+
"homepage": "https://github.com/Codeinwp/themeisle-sdk",
|
8 |
+
"license": "GPL-2.0+",
|
9 |
+
"authors": [
|
10 |
+
{
|
11 |
+
"name": "ThemeIsle team",
|
12 |
+
"email": "friends@themeisle.com",
|
13 |
+
"homepage": "https://themeisle.com"
|
14 |
+
}
|
15 |
+
],
|
16 |
+
"autoload": {
|
17 |
+
"classmap": [
|
18 |
+
"class-themeisle-sdk-loader.php",
|
19 |
+
"class-themeisle-sdk-product.php",
|
20 |
+
"class-themeisle-sdk-logger.php",
|
21 |
+
"class-themeisle-sdk-licenser.php"
|
22 |
+
]
|
23 |
+
},
|
24 |
+
"support": {
|
25 |
+
"issues": "https://github.com/Codeinwp/themeisle-sdk/issues"
|
26 |
+
}
|
27 |
+
}
|
vendor/codeinwp/themeisle-sdk/index.php
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* @package ThemeIsleSDK
|
4 |
+
* Ignore this.
|
5 |
+
*/
|
vendor/codeinwp/themeisle-sdk/phpcs.xml
ADDED
@@ -0,0 +1,34 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?xml version="1.0"?>
|
2 |
+
<ruleset name="Themeisle">
|
3 |
+
<description>Themeisle rules for PHP_CodeSnifferr</description>
|
4 |
+
|
5 |
+
<file>.</file>
|
6 |
+
|
7 |
+
<exclude-pattern>node_modules/*</exclude-pattern>
|
8 |
+
<exclude-pattern>vendor/*</exclude-pattern>
|
9 |
+
<exclude-pattern>lib/*</exclude-pattern>
|
10 |
+
<exclude-pattern>old/*</exclude-pattern>
|
11 |
+
<exclude-pattern>*.min.js</exclude-pattern>
|
12 |
+
<exclude-pattern>*.min.css</exclude-pattern>
|
13 |
+
<rule ref="WordPress-Core">
|
14 |
+
<exclude name="Squiz.Commenting.FileComment.SpacingAfterComment"/>
|
15 |
+
<exclude name="Squiz.Commenting.FunctionComment.MissingParamTag"/>
|
16 |
+
<exclude name="Squiz.Commenting.InlineComment.InvalidEndChar"/>
|
17 |
+
<exclude name="Generic.Commenting.DocComment.MissingShort"/>
|
18 |
+
<exclude name="Squiz.Commenting.InlineComment.NotCapital"/>
|
19 |
+
<exclude name="Squiz.Commenting.LongConditionClosingComment.Missing"/>
|
20 |
+
<exclude name="Squiz.Commenting.LongConditionClosingComment.Invalid"/>
|
21 |
+
<exclude name="WordPress.NamingConvention.ValidVariableName.StringNotSnakeCase"/>
|
22 |
+
<exclude name="WordPress.NamingConventions.ValidVariableName.NotSnakeCase"/>
|
23 |
+
<exclude name="WordPress.PHP.YodaConditions.NotYoda"/>
|
24 |
+
<exclude name="Squiz.PHP.DisallowMultipleAssignments" />
|
25 |
+
</rule>
|
26 |
+
<rule ref="WordPress-Docs">
|
27 |
+
|
28 |
+
</rule>
|
29 |
+
|
30 |
+
<rule ref="Squiz.Commenting.FunctionComment.ScalarTypeHintMissing">
|
31 |
+
<severity>0</severity>
|
32 |
+
</rule>
|
33 |
+
|
34 |
+
</ruleset>
|
vendor/composer/ClassLoader.php
ADDED
@@ -0,0 +1,413 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
+
|
57 |
+
private $classMapAuthoritative = false;
|
58 |
+
|
59 |
+
public function getPrefixes()
|
60 |
+
{
|
61 |
+
if (!empty($this->prefixesPsr0)) {
|
62 |
+
return call_user_func_array('array_merge', $this->prefixesPsr0);
|
63 |
+
}
|
64 |
+
|
65 |
+
return array();
|
66 |
+
}
|
67 |
+
|
68 |
+
public function getPrefixesPsr4()
|
69 |
+
{
|
70 |
+
return $this->prefixDirsPsr4;
|
71 |
+
}
|
72 |
+
|
73 |
+
public function getFallbackDirs()
|
74 |
+
{
|
75 |
+
return $this->fallbackDirsPsr0;
|
76 |
+
}
|
77 |
+
|
78 |
+
public function getFallbackDirsPsr4()
|
79 |
+
{
|
80 |
+
return $this->fallbackDirsPsr4;
|
81 |
+
}
|
82 |
+
|
83 |
+
public function getClassMap()
|
84 |
+
{
|
85 |
+
return $this->classMap;
|
86 |
+
}
|
87 |
+
|
88 |
+
/**
|
89 |
+
* @param array $classMap Class to filename map
|
90 |
+
*/
|
91 |
+
public function addClassMap(array $classMap)
|
92 |
+
{
|
93 |
+
if ($this->classMap) {
|
94 |
+
$this->classMap = array_merge($this->classMap, $classMap);
|
95 |
+
} else {
|
96 |
+
$this->classMap = $classMap;
|
97 |
+
}
|
98 |
+
}
|
99 |
+
|
100 |
+
/**
|
101 |
+
* Registers a set of PSR-0 directories for a given prefix, either
|
102 |
+
* appending or prepending to the ones previously set for this prefix.
|
103 |
+
*
|
104 |
+
* @param string $prefix The prefix
|
105 |
+
* @param array|string $paths The PSR-0 root directories
|
106 |
+
* @param bool $prepend Whether to prepend the directories
|
107 |
+
*/
|
108 |
+
public function add($prefix, $paths, $prepend = false)
|
109 |
+
{
|
110 |
+
if (!$prefix) {
|
111 |
+
if ($prepend) {
|
112 |
+
$this->fallbackDirsPsr0 = array_merge(
|
113 |
+
(array) $paths,
|
114 |
+
$this->fallbackDirsPsr0
|
115 |
+
);
|
116 |
+
} else {
|
117 |
+
$this->fallbackDirsPsr0 = array_merge(
|
118 |
+
$this->fallbackDirsPsr0,
|
119 |
+
(array) $paths
|
120 |
+
);
|
121 |
+
}
|
122 |
+
|
123 |
+
return;
|
124 |
+
}
|
125 |
+
|
126 |
+
$first = $prefix[0];
|
127 |
+
if (!isset($this->prefixesPsr0[$first][$prefix])) {
|
128 |
+
$this->prefixesPsr0[$first][$prefix] = (array) $paths;
|
129 |
+
|
130 |
+
return;
|
131 |
+
}
|
132 |
+
if ($prepend) {
|
133 |
+
$this->prefixesPsr0[$first][$prefix] = array_merge(
|
134 |
+
(array) $paths,
|
135 |
+
$this->prefixesPsr0[$first][$prefix]
|
136 |
+
);
|
137 |
+
} else {
|
138 |
+
$this->prefixesPsr0[$first][$prefix] = array_merge(
|
139 |
+
$this->prefixesPsr0[$first][$prefix],
|
140 |
+
(array) $paths
|
141 |
+
);
|
142 |
+
}
|
143 |
+
}
|
144 |
+
|
145 |
+
/**
|
146 |
+
* Registers a set of PSR-4 directories for a given namespace, either
|
147 |
+
* appending or prepending to the ones previously set for this namespace.
|
148 |
+
*
|
149 |
+
* @param string $prefix The prefix/namespace, with trailing '\\'
|
150 |
+
* @param array|string $paths The PSR-4 base directories
|
151 |
+
* @param bool $prepend Whether to prepend the directories
|
152 |
+
*
|
153 |
+
* @throws \InvalidArgumentException
|
154 |
+
*/
|
155 |
+
public function addPsr4($prefix, $paths, $prepend = false)
|
156 |
+
{
|
157 |
+
if (!$prefix) {
|
158 |
+
// Register directories for the root namespace.
|
159 |
+
if ($prepend) {
|
160 |
+
$this->fallbackDirsPsr4 = array_merge(
|
161 |
+
(array) $paths,
|
162 |
+
$this->fallbackDirsPsr4
|
163 |
+
);
|
164 |
+
} else {
|
165 |
+
$this->fallbackDirsPsr4 = array_merge(
|
166 |
+
$this->fallbackDirsPsr4,
|
167 |
+
(array) $paths
|
168 |
+
);
|
169 |
+
}
|
170 |
+
} elseif (!isset($this->prefixDirsPsr4[$prefix])) {
|
171 |
+
// Register directories for a new namespace.
|
172 |
+
$length = strlen($prefix);
|
173 |
+
if ('\\' !== $prefix[$length - 1]) {
|
174 |
+
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
|
175 |
+
}
|
176 |
+
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
|
177 |
+
$this->prefixDirsPsr4[$prefix] = (array) $paths;
|
178 |
+
} elseif ($prepend) {
|
179 |
+
// Prepend directories for an already registered namespace.
|
180 |
+
$this->prefixDirsPsr4[$prefix] = array_merge(
|
181 |
+
(array) $paths,
|
182 |
+
$this->prefixDirsPsr4[$prefix]
|
183 |
+
);
|
184 |
+
} else {
|
185 |
+
// Append directories for an already registered namespace.
|
186 |
+
$this->prefixDirsPsr4[$prefix] = array_merge(
|
187 |
+
$this->prefixDirsPsr4[$prefix],
|
188 |
+
(array) $paths
|
189 |
+
);
|
190 |
+
}
|
191 |
+
}
|
192 |
+
|
193 |
+
/**
|
194 |
+
* Registers a set of PSR-0 directories for a given prefix,
|
195 |
+
* replacing any others previously set for this prefix.
|
196 |
+
*
|
197 |
+
* @param string $prefix The prefix
|
198 |
+
* @param array|string $paths The PSR-0 base directories
|
199 |
+
*/
|
200 |
+
public function set($prefix, $paths)
|
201 |
+
{
|
202 |
+
if (!$prefix) {
|
203 |
+
$this->fallbackDirsPsr0 = (array) $paths;
|
204 |
+
} else {
|
205 |
+
$this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
|
206 |
+
}
|
207 |
+
}
|
208 |
+
|
209 |
+
/**
|
210 |
+
* Registers a set of PSR-4 directories for a given namespace,
|
211 |
+
* replacing any others previously set for this namespace.
|
212 |
+
*
|
213 |
+
* @param string $prefix The prefix/namespace, with trailing '\\'
|
214 |
+
* @param array|string $paths The PSR-4 base directories
|
215 |
+
*
|
216 |
+
* @throws \InvalidArgumentException
|
217 |
+
*/
|
218 |
+
public function setPsr4($prefix, $paths)
|
219 |
+
{
|
220 |
+
if (!$prefix) {
|
221 |
+
$this->fallbackDirsPsr4 = (array) $paths;
|
222 |
+
} else {
|
223 |
+
$length = strlen($prefix);
|
224 |
+
if ('\\' !== $prefix[$length - 1]) {
|
225 |
+
throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
|
226 |
+
}
|
227 |
+
$this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
|
228 |
+
$this->prefixDirsPsr4[$prefix] = (array) $paths;
|
229 |
+
}
|
230 |
+
}
|
231 |
+
|
232 |
+
/**
|
233 |
+
* Turns on searching the include path for class files.
|
234 |
+
*
|
235 |
+
* @param bool $useIncludePath
|
236 |
+
*/
|
237 |
+
public function setUseIncludePath($useIncludePath)
|
238 |
+
{
|
239 |
+
$this->useIncludePath = $useIncludePath;
|
240 |
+
}
|
241 |
+
|
242 |
+
/**
|
243 |
+
* Can be used to check if the autoloader uses the include path to check
|
244 |
+
* for classes.
|
245 |
+
*
|
246 |
+
* @return bool
|
247 |
+
*/
|
248 |
+
public function getUseIncludePath()
|
249 |
+
{
|
250 |
+
return $this->useIncludePath;
|
251 |
+
}
|
252 |
+
|
253 |
+
/**
|
254 |
+
* Turns off searching the prefix and fallback directories for classes
|
255 |
+
* that have not been registered with the class map.
|
256 |
+
*
|
257 |
+
* @param bool $classMapAuthoritative
|
258 |
+
*/
|
259 |
+
public function setClassMapAuthoritative($classMapAuthoritative)
|
260 |
+
{
|
261 |
+
$this->classMapAuthoritative = $classMapAuthoritative;
|
262 |
+
}
|
263 |
+
|
264 |
+
/**
|
265 |
+
* Should class lookup fail if not found in the current class map?
|
266 |
+
*
|
267 |
+
* @return bool
|
268 |
+
*/
|
269 |
+
public function isClassMapAuthoritative()
|
270 |
+
{
|
271 |
+
return $this->classMapAuthoritative;
|
272 |
+
}
|
273 |
+
|
274 |
+
/**
|
275 |
+
* Registers this instance as an autoloader.
|
276 |
+
*
|
277 |
+
* @param bool $prepend Whether to prepend the autoloader or not
|
278 |
+
*/
|
279 |
+
public function register($prepend = false)
|
280 |
+
{
|
281 |
+
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
|
282 |
+
}
|
283 |
+
|
284 |
+
/**
|
285 |
+
* Unregisters this instance as an autoloader.
|
286 |
+
*/
|
287 |
+
public function unregister()
|
288 |
+
{
|
289 |
+
spl_autoload_unregister(array($this, 'loadClass'));
|
290 |
+
}
|
291 |
+
|
292 |
+
/**
|
293 |
+
* Loads the given class or interface.
|
294 |
+
*
|
295 |
+
* @param string $class The name of the class
|
296 |
+
* @return bool|null True if loaded, null otherwise
|
297 |
+
*/
|
298 |
+
public function loadClass($class)
|
299 |
+
{
|
300 |
+
if ($file = $this->findFile($class)) {
|
301 |
+
includeFile($file);
|
302 |
+
|
303 |
+
return true;
|
304 |
+
}
|
305 |
+
}
|
306 |
+
|
307 |
+
/**
|
308 |
+
* Finds the path to the file where the class is defined.
|
309 |
+
*
|
310 |
+
* @param string $class The name of the class
|
311 |
+
*
|
312 |
+
* @return string|false The path if found, false otherwise
|
313 |
+
*/
|
314 |
+
public function findFile($class)
|
315 |
+
{
|
316 |
+
// work around for PHP 5.3.0 - 5.3.2 https://bugs.php.net/50731
|
317 |
+
if ('\\' == $class[0]) {
|
318 |
+
$class = substr($class, 1);
|
319 |
+
}
|
320 |
+
|
321 |
+
// class map lookup
|
322 |
+
if (isset($this->classMap[$class])) {
|
323 |
+
return $this->classMap[$class];
|
324 |
+
}
|
325 |
+
if ($this->classMapAuthoritative) {
|
326 |
+
return false;
|
327 |
+
}
|
328 |
+
|
329 |
+
$file = $this->findFileWithExtension($class, '.php');
|
330 |
+
|
331 |
+
// Search for Hack files if we are running on HHVM
|
332 |
+
if ($file === null && defined('HHVM_VERSION')) {
|
333 |
+
$file = $this->findFileWithExtension($class, '.hh');
|
334 |
+
}
|
335 |
+
|
336 |
+
if ($file === null) {
|
337 |
+
// Remember that this class does not exist.
|
338 |
+
return $this->classMap[$class] = false;
|
339 |
+
}
|
340 |
+
|
341 |
+
return $file;
|
342 |
+
}
|
343 |
+
|
344 |
+
private function findFileWithExtension($class, $ext)
|
345 |
+
{
|
346 |
+
// PSR-4 lookup
|
347 |
+
$logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
|
348 |
+
|
349 |
+
$first = $class[0];
|
350 |
+
if (isset($this->prefixLengthsPsr4[$first])) {
|
351 |
+
foreach ($this->prefixLengthsPsr4[$first] as $prefix => $length) {
|
352 |
+
if (0 === strpos($class, $prefix)) {
|
353 |
+
foreach ($this->prefixDirsPsr4[$prefix] as $dir) {
|
354 |
+
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $length))) {
|
355 |
+
return $file;
|
356 |
+
}
|
357 |
+
}
|
358 |
+
}
|
359 |
+
}
|
360 |
+
}
|
361 |
+
|
362 |
+
// PSR-4 fallback dirs
|
363 |
+
foreach ($this->fallbackDirsPsr4 as $dir) {
|
364 |
+
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
|
365 |
+
return $file;
|
366 |
+
}
|
367 |
+
}
|
368 |
+
|
369 |
+
// PSR-0 lookup
|
370 |
+
if (false !== $pos = strrpos($class, '\\')) {
|
371 |
+
// namespaced class name
|
372 |
+
$logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
|
373 |
+
. strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
|
374 |
+
} else {
|
375 |
+
// PEAR-like class name
|
376 |
+
$logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
|
377 |
+
}
|
378 |
+
|
379 |
+
if (isset($this->prefixesPsr0[$first])) {
|
380 |
+
foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
|
381 |
+
if (0 === strpos($class, $prefix)) {
|
382 |
+
foreach ($dirs as $dir) {
|
383 |
+
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
384 |
+
return $file;
|
385 |
+
}
|
386 |
+
}
|
387 |
+
}
|
388 |
+
}
|
389 |
+
}
|
390 |
+
|
391 |
+
// PSR-0 fallback dirs
|
392 |
+
foreach ($this->fallbackDirsPsr0 as $dir) {
|
393 |
+
if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
|
394 |
+
return $file;
|
395 |
+
}
|
396 |
+
}
|
397 |
+
|
398 |
+
// PSR-0 include paths.
|
399 |
+
if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
|
400 |
+
return $file;
|
401 |
+
}
|
402 |
+
}
|
403 |
+
}
|
404 |
+
|
405 |
+
/**
|
406 |
+
* Scope isolated include.
|
407 |
+
*
|
408 |
+
* Prevents access to $this/self from included files.
|
409 |
+
*/
|
410 |
+
function includeFile($file)
|
411 |
+
{
|
412 |
+
include $file;
|
413 |
+
}
|
vendor/composer/ClassLoader52.php
ADDED
@@ -0,0 +1,271 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (c) 2013, Christoph Mewes, http://www.xrstf.de
|
4 |
+
*
|
5 |
+
* This file is released under the terms of the MIT license. You can find the
|
6 |
+
* complete text in the attached LICENSE file or online at:
|
7 |
+
*
|
8 |
+
* http://www.opensource.org/licenses/mit-license.php
|
9 |
+
*
|
10 |
+
* --------------------------------------------------------------------------
|
11 |
+
*
|
12 |
+
* 99% of this is copied as-is from the original Composer source code and is
|
13 |
+
* released under MIT license as well. Copyright goes to:
|
14 |
+
*
|
15 |
+
* - Fabien Potencier <fabien@symfony.com>
|
16 |
+
* - Jordi Boggiano <j.boggiano@seld.be>
|
17 |
+
*/
|
18 |
+
|
19 |
+
class xrstf_Composer52_ClassLoader {
|
20 |
+
private $prefixes = array();
|
21 |
+
private $fallbackDirs = array();
|
22 |
+
private $useIncludePath = false;
|
23 |
+
private $classMap = array();
|
24 |
+
private $classMapAuthoratative = false;
|
25 |
+
private $allowUnderscore = false;
|
26 |
+
|
27 |
+
/**
|
28 |
+
* @param boolean $flag true to allow class names with a leading underscore, false to disable
|
29 |
+
*/
|
30 |
+
public function setAllowUnderscore($flag) {
|
31 |
+
$this->allowUnderscore = (boolean) $flag;
|
32 |
+
}
|
33 |
+
|
34 |
+
/**
|
35 |
+
* @return array
|
36 |
+
*/
|
37 |
+
public function getPrefixes() {
|
38 |
+
return $this->prefixes;
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Turns off searching the prefix and fallback directories for classes
|
43 |
+
* that have not been registered with the class map.
|
44 |
+
*
|
45 |
+
* @param bool $classMapAuthoratative
|
46 |
+
*/
|
47 |
+
public function setClassMapAuthoritative($classMapAuthoratative) {
|
48 |
+
$this->classMapAuthoratative = $classMapAuthoratative;
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Should class lookup fail if not found in the current class map?
|
53 |
+
*
|
54 |
+
* @return bool
|
55 |
+
*/
|
56 |
+
public function getClassMapAuthoratative() {
|
57 |
+
return $this->classMapAuthoratative;
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* @return array
|
62 |
+
*/
|
63 |
+
public function getFallbackDirs() {
|
64 |
+
return $this->fallbackDirs;
|
65 |
+
}
|
66 |
+
|
67 |
+
/**
|
68 |
+
* @return array
|
69 |
+
*/
|
70 |
+
public function getClassMap() {
|
71 |
+
return $this->classMap;
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* @param array $classMap class to filename map
|
76 |
+
*/
|
77 |
+
public function addClassMap(array $classMap) {
|
78 |
+
if ($this->classMap) {
|
79 |
+
$this->classMap = array_merge($this->classMap, $classMap);
|
80 |
+
}
|
81 |
+
else {
|
82 |
+
$this->classMap = $classMap;
|
83 |
+
}
|
84 |
+
}
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Registers a set of classes, merging with any others previously set.
|
88 |
+
*
|
89 |
+
* @param string $prefix the classes prefix
|
90 |
+
* @param array|string $paths the location(s) of the classes
|
91 |
+
* @param bool $prepend prepend the location(s)
|
92 |
+
*/
|
93 |
+
public function add($prefix, $paths, $prepend = false) {
|
94 |
+
if (!$prefix) {
|
95 |
+
if ($prepend) {
|
96 |
+
$this->fallbackDirs = array_merge(
|
97 |
+
(array) $paths,
|
98 |
+
$this->fallbackDirs
|
99 |
+
);
|
100 |
+
}
|
101 |
+
else {
|
102 |
+
$this->fallbackDirs = array_merge(
|
103 |
+
$this->fallbackDirs,
|
104 |
+
(array) $paths
|
105 |
+
);
|
106 |
+
}
|
107 |
+
|
108 |
+
return;
|
109 |
+
}
|
110 |
+
|
111 |
+
if (!isset($this->prefixes[$prefix])) {
|
112 |
+
$this->prefixes[$prefix] = (array) $paths;
|
113 |
+
return;
|
114 |
+
}
|
115 |
+
|
116 |
+
if ($prepend) {
|
117 |
+
$this->prefixes[$prefix] = array_merge(
|
118 |
+
(array) $paths,
|
119 |
+
$this->prefixes[$prefix]
|
120 |
+
);
|
121 |
+
}
|
122 |
+
else {
|
123 |
+
$this->prefixes[$prefix] = array_merge(
|
124 |
+
$this->prefixes[$prefix],
|
125 |
+
(array) $paths
|
126 |
+
);
|
127 |
+
}
|
128 |
+
}
|
129 |
+
|
130 |
+
/**
|
131 |
+
* Registers a set of classes, replacing any others previously set.
|
132 |
+
*
|
133 |
+
* @param string $prefix the classes prefix
|
134 |
+
* @param array|string $paths the location(s) of the classes
|
135 |
+
*/
|
136 |
+
public function set($prefix, $paths) {
|
137 |
+
if (!$prefix) {
|
138 |
+
$this->fallbackDirs = (array) $paths;
|
139 |
+
return;
|
140 |
+
}
|
141 |
+
|
142 |
+
$this->prefixes[$prefix] = (array) $paths;
|
143 |
+
}
|
144 |
+
|
145 |
+
/**
|
146 |
+
* Turns on searching the include path for class files.
|
147 |
+
*
|
148 |
+
* @param bool $useIncludePath
|
149 |
+
*/
|
150 |
+
public function setUseIncludePath($useIncludePath) {
|
151 |
+
$this->useIncludePath = $useIncludePath;
|
152 |
+
}
|
153 |
+
|
154 |
+
/**
|
155 |
+
* Can be used to check if the autoloader uses the include path to check
|
156 |
+
* for classes.
|
157 |
+
*
|
158 |
+
* @return bool
|
159 |
+
*/
|
160 |
+
public function getUseIncludePath() {
|
161 |
+
return $this->useIncludePath;
|
162 |
+
}
|
163 |
+
|
164 |
+
/**
|
165 |
+
* Registers this instance as an autoloader.
|
166 |
+
*/
|
167 |
+
public function register() {
|
168 |
+
spl_autoload_register(array($this, 'loadClass'), true);
|
169 |
+
}
|
170 |
+
|
171 |
+
/**
|
172 |
+
* Unregisters this instance as an autoloader.
|
173 |
+
*/
|
174 |
+
public function unregister() {
|
175 |
+
spl_autoload_unregister(array($this, 'loadClass'));
|
176 |
+
}
|
177 |
+
|
178 |
+
/**
|
179 |
+
* Loads the given class or interface.
|
180 |
+
*
|
181 |
+
* @param string $class the name of the class
|
182 |
+
* @return bool|null true, if loaded
|
183 |
+
*/
|
184 |
+
public function loadClass($class) {
|
185 |
+
if ($file = $this->findFile($class)) {
|
186 |
+
include $file;
|
187 |
+
return true;
|
188 |
+
}
|
189 |
+
}
|
190 |
+
|
191 |
+
/**
|
192 |
+
* Finds the path to the file where the class is defined.
|
193 |
+
*
|
194 |
+
* @param string $class the name of the class
|
195 |
+
* @return string|null the path, if found
|
196 |
+
*/
|
197 |
+
public function findFile($class) {
|
198 |
+
if ('\\' === $class[0]) {
|
199 |
+
$class = substr($class, 1);
|
200 |
+
}
|
201 |
+
|
202 |
+
if (isset($this->classMap[$class])) {
|
203 |
+
return $this->classMap[$class];
|
204 |
+
}
|
205 |
+
elseif ($this->classMapAuthoratative) {
|
206 |
+
return false;
|
207 |
+
}
|
208 |
+
|
209 |
+
$classPath = $this->getClassPath($class);
|
210 |
+
|
211 |
+
foreach ($this->prefixes as $prefix => $dirs) {
|
212 |
+
if (0 === strpos($class, $prefix)) {
|
213 |
+
foreach ($dirs as $dir) {
|
214 |
+
if (file_exists($dir.DIRECTORY_SEPARATOR.$classPath)) {
|
215 |
+
return $dir.DIRECTORY_SEPARATOR.$classPath;
|
216 |
+
}
|
217 |
+
}
|
218 |
+
}
|
219 |
+
}
|
220 |
+
|
221 |
+
foreach ($this->fallbackDirs as $dir) {
|
222 |
+
if (file_exists($dir.DIRECTORY_SEPARATOR.$classPath)) {
|
223 |
+
return $dir.DIRECTORY_SEPARATOR.$classPath;
|
224 |
+
}
|
225 |
+
}
|
226 |
+
|
227 |
+
if ($this->useIncludePath && $file = self::resolveIncludePath($classPath)) {
|
228 |
+
return $file;
|
229 |
+
}
|
230 |
+
|
231 |
+
return $this->classMap[$class] = false;
|
232 |
+
}
|
233 |
+
|
234 |
+
private function getClassPath($class) {
|
235 |
+
if (false !== $pos = strrpos($class, '\\')) {
|
236 |
+
// namespaced class name
|
237 |
+
$classPath = str_replace('\\', DIRECTORY_SEPARATOR, substr($class, 0, $pos)).DIRECTORY_SEPARATOR;
|
238 |
+
$className = substr($class, $pos + 1);
|
239 |
+
}
|
240 |
+
else {
|
241 |
+
// PEAR-like class name
|
242 |
+
$classPath = null;
|
243 |
+
$className = $class;
|
244 |
+
}
|
245 |
+
|
246 |
+
$className = str_replace('_', DIRECTORY_SEPARATOR, $className);
|
247 |
+
|
248 |
+
// restore the prefix
|
249 |
+
if ($this->allowUnderscore && DIRECTORY_SEPARATOR === $className[0]) {
|
250 |
+
$className[0] = '_';
|
251 |
+
}
|
252 |
+
|
253 |
+
$classPath .= $className.'.php';
|
254 |
+
|
255 |
+
return $classPath;
|
256 |
+
}
|
257 |
+
|
258 |
+
public static function resolveIncludePath($classPath) {
|
259 |
+
$paths = explode(PATH_SEPARATOR, get_include_path());
|
260 |
+
|
261 |
+
foreach ($paths as $path) {
|
262 |
+
$path = rtrim($path, '/\\');
|
263 |
+
|
264 |
+
if ($file = file_exists($path.DIRECTORY_SEPARATOR.$file)) {
|
265 |
+
return $file;
|
266 |
+
}
|
267 |
+
}
|
268 |
+
|
269 |
+
return false;
|
270 |
+
}
|
271 |
+
}
|
vendor/composer/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
Copyright (c) 2016 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 |
+
|
vendor/composer/autoload_classmap.php
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload_classmap.php @generated by Composer
|
4 |
+
|
5 |
+
$vendorDir = dirname(dirname(__FILE__));
|
6 |
+
$baseDir = dirname($vendorDir);
|
7 |
+
|
8 |
+
return array(
|
9 |
+
'ThemeIsle_SDK_Licenser' => $vendorDir . '/codeinwp/themeisle-sdk/class-themeisle-sdk-licenser.php',
|
10 |
+
'ThemeIsle_SDK_Loader' => $vendorDir . '/codeinwp/themeisle-sdk/class-themeisle-sdk-loader.php',
|
11 |
+
'ThemeIsle_SDK_Logger' => $vendorDir . '/codeinwp/themeisle-sdk/class-themeisle-sdk-logger.php',
|
12 |
+
'ThemeIsle_SDK_Product' => $vendorDir . '/codeinwp/themeisle-sdk/class-themeisle-sdk-product.php',
|
13 |
+
);
|
vendor/composer/autoload_namespaces.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload_namespaces.php @generated by Composer
|
4 |
+
|
5 |
+
$vendorDir = dirname(dirname(__FILE__));
|
6 |
+
$baseDir = dirname($vendorDir);
|
7 |
+
|
8 |
+
return array(
|
9 |
+
'xrstf\\Composer52' => array($vendorDir . '/xrstf/composer-php52/lib'),
|
10 |
+
);
|
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($vendorDir);
|
7 |
+
|
8 |
+
return array(
|
9 |
+
);
|
vendor/composer/autoload_real.php
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload_real.php @generated by Composer
|
4 |
+
|
5 |
+
class ComposerAutoloaderInit23ab7635fef8dfda86dc6d7908d85506
|
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 |
+
public static function getLoader()
|
17 |
+
{
|
18 |
+
if (null !== self::$loader) {
|
19 |
+
return self::$loader;
|
20 |
+
}
|
21 |
+
|
22 |
+
spl_autoload_register(array('ComposerAutoloaderInit23ab7635fef8dfda86dc6d7908d85506', 'loadClassLoader'), true, true);
|
23 |
+
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
24 |
+
spl_autoload_unregister(array('ComposerAutoloaderInit23ab7635fef8dfda86dc6d7908d85506', 'loadClassLoader'));
|
25 |
+
|
26 |
+
$map = require __DIR__ . '/autoload_namespaces.php';
|
27 |
+
foreach ($map as $namespace => $path) {
|
28 |
+
$loader->set($namespace, $path);
|
29 |
+
}
|
30 |
+
|
31 |
+
$map = require __DIR__ . '/autoload_psr4.php';
|
32 |
+
foreach ($map as $namespace => $path) {
|
33 |
+
$loader->setPsr4($namespace, $path);
|
34 |
+
}
|
35 |
+
|
36 |
+
$classMap = require __DIR__ . '/autoload_classmap.php';
|
37 |
+
if ($classMap) {
|
38 |
+
$loader->addClassMap($classMap);
|
39 |
+
}
|
40 |
+
|
41 |
+
$loader->register(true);
|
42 |
+
|
43 |
+
return $loader;
|
44 |
+
}
|
45 |
+
}
|
vendor/composer/autoload_real_52.php
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// autoload_real_52.php generated by xrstf/composer-php52
|
4 |
+
|
5 |
+
class ComposerAutoloaderInitff2c8e464431f7e50e8d3bd7f1610808 {
|
6 |
+
private static $loader;
|
7 |
+
|
8 |
+
public static function loadClassLoader($class) {
|
9 |
+
if ('xrstf_Composer52_ClassLoader' === $class) {
|
10 |
+
require dirname(__FILE__).'/ClassLoader52.php';
|
11 |
+
}
|
12 |
+
}
|
13 |
+
|
14 |
+
/**
|
15 |
+
* @return xrstf_Composer52_ClassLoader
|
16 |
+
*/
|
17 |
+
public static function getLoader() {
|
18 |
+
if (null !== self::$loader) {
|
19 |
+
return self::$loader;
|
20 |
+
}
|
21 |
+
|
22 |
+
spl_autoload_register(array('ComposerAutoloaderInitff2c8e464431f7e50e8d3bd7f1610808', 'loadClassLoader'), true /*, true */);
|
23 |
+
self::$loader = $loader = new xrstf_Composer52_ClassLoader();
|
24 |
+
spl_autoload_unregister(array('ComposerAutoloaderInitff2c8e464431f7e50e8d3bd7f1610808', 'loadClassLoader'));
|
25 |
+
|
26 |
+
$vendorDir = dirname(dirname(__FILE__));
|
27 |
+
$baseDir = dirname($vendorDir);
|
28 |
+
$dir = dirname(__FILE__);
|
29 |
+
|
30 |
+
$map = require $dir.'/autoload_namespaces.php';
|
31 |
+
foreach ($map as $namespace => $path) {
|
32 |
+
$loader->add($namespace, $path);
|
33 |
+
}
|
34 |
+
|
35 |
+
$classMap = require $dir.'/autoload_classmap.php';
|
36 |
+
if ($classMap) {
|
37 |
+
$loader->addClassMap($classMap);
|
38 |
+
}
|
39 |
+
|
40 |
+
$loader->register(true);
|
41 |
+
|
42 |
+
return $loader;
|
43 |
+
}
|
44 |
+
}
|
vendor/composer/installed.json
ADDED
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[
|
2 |
+
{
|
3 |
+
"name": "xrstf/composer-php52",
|
4 |
+
"version": "v1.0.20",
|
5 |
+
"version_normalized": "1.0.20.0",
|
6 |
+
"source": {
|
7 |
+
"type": "git",
|
8 |
+
"url": "https://github.com/composer-php52/composer-php52.git",
|
9 |
+
"reference": "bd41459d5e27df8d33057842b32377c39e97a5a8"
|
10 |
+
},
|
11 |
+
"dist": {
|
12 |
+
"type": "zip",
|
13 |
+
"url": "https://api.github.com/repos/composer-php52/composer-php52/zipball/bd41459d5e27df8d33057842b32377c39e97a5a8",
|
14 |
+
"reference": "bd41459d5e27df8d33057842b32377c39e97a5a8",
|
15 |
+
"shasum": ""
|
16 |
+
},
|
17 |
+
"time": "2016-04-16 21:52:24",
|
18 |
+
"type": "library",
|
19 |
+
"extra": {
|
20 |
+
"branch-alias": {
|
21 |
+
"dev-default": "1.x-dev"
|
22 |
+
}
|
23 |
+
},
|
24 |
+
"installation-source": "dist",
|
25 |
+
"autoload": {
|
26 |
+
"psr-0": {
|
27 |
+
"xrstf\\Composer52": "lib/"
|
28 |
+
}
|
29 |
+
},
|
30 |
+
"notification-url": "https://packagist.org/downloads/",
|
31 |
+
"license": [
|
32 |
+
"MIT"
|
33 |
+
]
|
34 |
+
},
|
35 |
+
{
|
36 |
+
"name": "codeinwp/themeisle-sdk",
|
37 |
+
"version": "dev-master",
|
38 |
+
"version_normalized": "9999999-dev",
|
39 |
+
"source": {
|
40 |
+
"type": "git",
|
41 |
+
"url": "git@github.com:Codeinwp/themeisle-sdk.git",
|
42 |
+
"reference": "beb20b65c6916d14e2222d40252a48faa440e72e"
|
43 |
+
},
|
44 |
+
"dist": {
|
45 |
+
"type": "zip",
|
46 |
+
"url": "https://api.github.com/repos/Codeinwp/themeisle-sdk/zipball/beb20b65c6916d14e2222d40252a48faa440e72e",
|
47 |
+
"reference": "beb20b65c6916d14e2222d40252a48faa440e72e",
|
48 |
+
"shasum": ""
|
49 |
+
},
|
50 |
+
"time": "2017-03-30 15:34:04",
|
51 |
+
"type": "library",
|
52 |
+
"installation-source": "source",
|
53 |
+
"autoload": {
|
54 |
+
"classmap": [
|
55 |
+
"class-themeisle-sdk-loader.php",
|
56 |
+
"class-themeisle-sdk-product.php",
|
57 |
+
"class-themeisle-sdk-logger.php",
|
58 |
+
"class-themeisle-sdk-licenser.php"
|
59 |
+
]
|
60 |
+
},
|
61 |
+
"license": [
|
62 |
+
"GPL-2.0+"
|
63 |
+
],
|
64 |
+
"authors": [
|
65 |
+
{
|
66 |
+
"name": "ThemeIsle team",
|
67 |
+
"email": "friends@themeisle.com",
|
68 |
+
"homepage": "https://themeisle.com"
|
69 |
+
}
|
70 |
+
],
|
71 |
+
"description": "ThemeIsle SDK ",
|
72 |
+
"homepage": "https://github.com/Codeinwp/themeisle-sdk",
|
73 |
+
"keywords": [
|
74 |
+
"wordpress"
|
75 |
+
],
|
76 |
+
"support": {
|
77 |
+
"issues": "https://github.com/Codeinwp/themeisle-sdk/issues"
|
78 |
+
}
|
79 |
+
}
|
80 |
+
]
|
vendor/xrstf/composer-php52/LICENSE
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Copyright (c) 2013 Christoph Mewes
|
2 |
+
|
3 |
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4 |
+
of this software and associated documentation files (the "Software"), to deal
|
5 |
+
in the Software without restriction, including without limitation the rights
|
6 |
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7 |
+
copies of the Software, and to permit persons to whom the Software is furnished
|
8 |
+
to do so, subject to the following conditions:
|
9 |
+
|
10 |
+
The above copyright notice and this permission notice shall be included in all
|
11 |
+
copies or substantial portions of the Software.
|
12 |
+
|
13 |
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14 |
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15 |
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16 |
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17 |
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18 |
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19 |
+
THE SOFTWARE.
|
vendor/xrstf/composer-php52/README.md
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
PHP 5.2 Autoloading for Composer
|
2 |
+
================================
|
3 |
+
|
4 |
+
This package provides an easy way to get a PHP 5.2 compatible autoloader out of Composer. The generated autoloader is fully compatible to the original and is written into separate files, each ending with `_52.php`.
|
5 |
+
|
6 |
+
Legacy
|
7 |
+
------
|
8 |
+
|
9 |
+
Please do not use this, if you can avoid it. It's a horrible hack, often breaks and is extremely tied to Composer's interna. This package was originally developed in 2012, when PHP 5.2 was much more common on cheap webhosts.
|
10 |
+
|
11 |
+
In 2016, this package has been moved from Bitbucket to a Github organization, because the original developer could no longer reliably maintain it. This is the reason for this legacy package name ``xrstf/...``.
|
12 |
+
|
13 |
+
Usage
|
14 |
+
-----
|
15 |
+
|
16 |
+
In your project's `composer.json`, add the following lines:
|
17 |
+
|
18 |
+
```json
|
19 |
+
{
|
20 |
+
"require": {
|
21 |
+
"xrstf/composer-php52": "1.*"
|
22 |
+
},
|
23 |
+
"scripts": {
|
24 |
+
"post-install-cmd": [
|
25 |
+
"xrstf\\Composer52\\Generator::onPostInstallCmd"
|
26 |
+
],
|
27 |
+
"post-update-cmd": [
|
28 |
+
"xrstf\\Composer52\\Generator::onPostInstallCmd"
|
29 |
+
],
|
30 |
+
"post-autoload-dump": [
|
31 |
+
"xrstf\\Composer52\\Generator::onPostInstallCmd"
|
32 |
+
]
|
33 |
+
}
|
34 |
+
}
|
35 |
+
```
|
36 |
+
|
37 |
+
After the next update/install, you will have a `vendor/autoload_52.php` file, that you can simply include and use in PHP 5.2 projects.
|
vendor/xrstf/composer-php52/composer.json
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "xrstf/composer-php52",
|
3 |
+
"license": "MIT",
|
4 |
+
"support": {
|
5 |
+
"source": "https://github.com/composer-php52/composer-php52",
|
6 |
+
"issues": "https://github.com/composer-php52/composer-php52/issues"
|
7 |
+
},
|
8 |
+
"autoload": {
|
9 |
+
"psr-0": {
|
10 |
+
"xrstf\\Composer52": "lib/"
|
11 |
+
}
|
12 |
+
},
|
13 |
+
"scripts": {
|
14 |
+
"post-install-cmd": [
|
15 |
+
"xrstf\\Composer52\\Generator::onPostInstallCmd"
|
16 |
+
],
|
17 |
+
"post-update-cmd": [
|
18 |
+
"xrstf\\Composer52\\Generator::onPostInstallCmd"
|
19 |
+
]
|
20 |
+
},
|
21 |
+
"extra": {
|
22 |
+
"branch-alias": {
|
23 |
+
"dev-default": "1.x-dev"
|
24 |
+
}
|
25 |
+
}
|
26 |
+
}
|
vendor/xrstf/composer-php52/lib/xrstf/Composer52/AutoloadGenerator.php
ADDED
@@ -0,0 +1,346 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (c) 2013, Christoph Mewes, http://www.xrstf.de
|
4 |
+
*
|
5 |
+
* This file is released under the terms of the MIT license. You can find the
|
6 |
+
* complete text in the attached LICENSE file or online at:
|
7 |
+
*
|
8 |
+
* http://www.opensource.org/licenses/mit-license.php
|
9 |
+
*
|
10 |
+
* --------------------------------------------------------------------------
|
11 |
+
*
|
12 |
+
* 99% of this is copied as-is from the original Composer source code and is
|
13 |
+
* released under MIT license as well. Copyright goes to:
|
14 |
+
*
|
15 |
+
* - Igor Wiedler <igor@wiedler.ch>
|
16 |
+
* - Jordi Boggiano <j.boggiano@seld.be>
|
17 |
+
*/
|
18 |
+
|
19 |
+
namespace xrstf\Composer52;
|
20 |
+
|
21 |
+
use Composer\Autoload\AutoloadGenerator as BaseGenerator;
|
22 |
+
use Composer\Autoload\ClassMapGenerator;
|
23 |
+
use Composer\Config;
|
24 |
+
use Composer\Installer\InstallationManager;
|
25 |
+
use Composer\Package\AliasPackage;
|
26 |
+
use Composer\Package\PackageInterface;
|
27 |
+
use Composer\Repository\InstalledRepositoryInterface;
|
28 |
+
use Composer\Util\Filesystem;
|
29 |
+
|
30 |
+
class AutoloadGenerator extends BaseGenerator {
|
31 |
+
|
32 |
+
/**
|
33 |
+
* @var bool
|
34 |
+
*/
|
35 |
+
private $classMapAuthoritative = false;
|
36 |
+
|
37 |
+
public function __construct() {
|
38 |
+
// do nothing (but keep this constructor so we can build an instance without the need for an event dispatcher)
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Whether or not generated autoloader considers the class map
|
43 |
+
* authoritative.
|
44 |
+
*
|
45 |
+
* @param bool $classMapAuthoritative
|
46 |
+
*/
|
47 |
+
public function setClassMapAuthoritative($classMapAuthoritative)
|
48 |
+
{
|
49 |
+
$this->classMapAuthoritative = (boolean) $classMapAuthoritative;
|
50 |
+
}
|
51 |
+
|
52 |
+
public function dump(Config $config, InstalledRepositoryInterface $localRepo, PackageInterface $mainPackage, InstallationManager $installationManager, $targetDir, $scanPsr0Packages = false, $suffix = '') {
|
53 |
+
if ($this->classMapAuthoritative) {
|
54 |
+
// Force scanPsr0Packages when classmap is authoritative
|
55 |
+
$scanPsr0Packages = true;
|
56 |
+
}
|
57 |
+
|
58 |
+
$filesystem = new Filesystem();
|
59 |
+
$filesystem->ensureDirectoryExists($config->get('vendor-dir'));
|
60 |
+
|
61 |
+
$cwd = getcwd();
|
62 |
+
$basePath = $filesystem->normalizePath($cwd);
|
63 |
+
$vendorPath = $filesystem->normalizePath(realpath($config->get('vendor-dir')));
|
64 |
+
$targetDir = $vendorPath.'/'.$targetDir;
|
65 |
+
$filesystem->ensureDirectoryExists($targetDir);
|
66 |
+
|
67 |
+
$useGlobalIncludePath = (bool) $config->get('use-include-path');
|
68 |
+
$prependAutoloader = $config->get('prepend-autoloader') === false ? 'false' : 'true';
|
69 |
+
$classMapAuthoritative = $config->get('classmap-authoritative');
|
70 |
+
|
71 |
+
$vendorPathCode = $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true);
|
72 |
+
$vendorPathToTargetDirCode = $filesystem->findShortestPathCode($vendorPath, realpath($targetDir), true);
|
73 |
+
|
74 |
+
$appBaseDirCode = $filesystem->findShortestPathCode($vendorPath, $basePath, true);
|
75 |
+
$appBaseDirCode = str_replace('__DIR__', '$vendorDir', $appBaseDirCode);
|
76 |
+
|
77 |
+
// add 5.2 compat
|
78 |
+
$vendorPathCode = str_replace('__DIR__', 'dirname(__FILE__)', $vendorPathCode);
|
79 |
+
$vendorPathToTargetDirCode = str_replace('__DIR__', 'dirname(__FILE__)', $vendorPathToTargetDirCode);
|
80 |
+
|
81 |
+
$packageMap = $this->buildPackageMap($installationManager, $mainPackage, $localRepo->getCanonicalPackages());
|
82 |
+
$autoloads = $this->parseAutoloads($packageMap, $mainPackage);
|
83 |
+
|
84 |
+
// add custom psr-0 autoloading if the root package has a target dir
|
85 |
+
$targetDirLoader = null;
|
86 |
+
$mainAutoload = $mainPackage->getAutoload();
|
87 |
+
if ($mainPackage->getTargetDir() && !empty($mainAutoload['psr-0'])) {
|
88 |
+
$levels = count(explode('/', $filesystem->normalizePath($mainPackage->getTargetDir())));
|
89 |
+
$prefixes = implode(', ', array_map(function ($prefix) {
|
90 |
+
return var_export($prefix, true);
|
91 |
+
}, array_keys($mainAutoload['psr-0'])));
|
92 |
+
|
93 |
+
$baseDirFromTargetDirCode = $filesystem->findShortestPathCode($targetDir, $basePath, true);
|
94 |
+
|
95 |
+
$targetDirLoader = <<<EOF
|
96 |
+
|
97 |
+
public static function autoload(\$class) {
|
98 |
+
\$dir = $baseDirFromTargetDirCode.'/';
|
99 |
+
\$prefixes = array($prefixes);
|
100 |
+
|
101 |
+
foreach (\$prefixes as \$prefix) {
|
102 |
+
if (0 !== strpos(\$class, \$prefix)) {
|
103 |
+
continue;
|
104 |
+
}
|
105 |
+
|
106 |
+
\$path = explode(DIRECTORY_SEPARATOR, self::getClassPath(\$class));
|
107 |
+
\$path = \$dir.implode('/', array_slice(\$path, $levels));
|
108 |
+
|
109 |
+
if (!\$path = self::resolveIncludePath(\$path)) {
|
110 |
+
return false;
|
111 |
+
}
|
112 |
+
|
113 |
+
require \$path;
|
114 |
+
return true;
|
115 |
+
}
|
116 |
+
}
|
117 |
+
|
118 |
+
EOF;
|
119 |
+
}
|
120 |
+
|
121 |
+
$filesCode = "";
|
122 |
+
$autoloads['files'] = new \RecursiveIteratorIterator(new \RecursiveArrayIterator($autoloads['files']));
|
123 |
+
foreach ($autoloads['files'] as $functionFile) {
|
124 |
+
// don't include file if it is using PHP 5.3+ syntax
|
125 |
+
// https://bitbucket.org/xrstf/composer-php52/issue/4
|
126 |
+
if ($this->isPHP53($functionFile)) {
|
127 |
+
$filesCode .= '// require '.$this->getPathCode($filesystem, $basePath, $vendorPath, $functionFile)."; // disabled because of PHP 5.3 syntax\n";
|
128 |
+
}
|
129 |
+
else {
|
130 |
+
$filesCode .= ' require '.$this->getPathCode($filesystem, $basePath, $vendorPath, $functionFile).";\n";
|
131 |
+
}
|
132 |
+
}
|
133 |
+
|
134 |
+
if (!$suffix) {
|
135 |
+
$suffix = md5(uniqid('', true));
|
136 |
+
}
|
137 |
+
|
138 |
+
$includePathFile = $this->getIncludePathsFile($packageMap, $filesystem, $basePath, $vendorPath, $vendorPathCode, $appBaseDirCode);
|
139 |
+
|
140 |
+
file_put_contents($vendorPath.'/autoload_52.php', $this->getAutoloadFile($vendorPathToTargetDirCode, $suffix));
|
141 |
+
file_put_contents($targetDir.'/autoload_real_52.php', $this->getAutoloadRealFile(true, (bool) $includePathFile, $targetDirLoader, $filesCode, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath, $prependAutoloader));
|
142 |
+
|
143 |
+
// use stream_copy_to_stream instead of copy
|
144 |
+
// to work around https://bugs.php.net/bug.php?id=64634
|
145 |
+
$sourceLoader = fopen(__DIR__.'/ClassLoader.php', 'r');
|
146 |
+
$targetLoader = fopen($targetDir.'/ClassLoader52.php', 'w+');
|
147 |
+
stream_copy_to_stream($sourceLoader, $targetLoader);
|
148 |
+
fclose($sourceLoader);
|
149 |
+
fclose($targetLoader);
|
150 |
+
unset($sourceLoader, $targetLoader);
|
151 |
+
}
|
152 |
+
|
153 |
+
protected function isPHP53($file) {
|
154 |
+
$tokens = token_get_all(file_get_contents($file));
|
155 |
+
$php53 = array(T_DIR, T_GOTO, T_NAMESPACE, T_NS_C, T_NS_SEPARATOR, T_USE);
|
156 |
+
|
157 |
+
// PHP 5.4+
|
158 |
+
if (defined('T_TRAIT')) {
|
159 |
+
$php53[] = T_TRAIT;
|
160 |
+
$php53[] = T_TRAIT_C;
|
161 |
+
$php53[] = T_TRAIT_C;
|
162 |
+
}
|
163 |
+
|
164 |
+
// PHP 5.5+
|
165 |
+
if (defined('T_FINALLY')) {
|
166 |
+
$php53[] = T_FINALLY;
|
167 |
+
$php53[] = T_YIELD;
|
168 |
+
}
|
169 |
+
|
170 |
+
foreach ($tokens as $token) {
|
171 |
+
if (is_array($token) && in_array($token[0], $php53)) {
|
172 |
+
return true;
|
173 |
+
}
|
174 |
+
}
|
175 |
+
|
176 |
+
return false;
|
177 |
+
}
|
178 |
+
|
179 |
+
protected function getIncludePathsFile(array $packageMap, Filesystem $filesystem, $basePath, $vendorPath, $vendorPathCode, $appBaseDirCode) {
|
180 |
+
$includePaths = array();
|
181 |
+
|
182 |
+
foreach ($packageMap as $item) {
|
183 |
+
list($package, $installPath) = $item;
|
184 |
+
|
185 |
+
if (null !== $package->getTargetDir() && strlen($package->getTargetDir()) > 0) {
|
186 |
+
$installPath = substr($installPath, 0, -strlen('/'.$package->getTargetDir()));
|
187 |
+
}
|
188 |
+
|
189 |
+
foreach ($package->getIncludePaths() as $includePath) {
|
190 |
+
$includePath = trim($includePath, '/');
|
191 |
+
$includePaths[] = empty($installPath) ? $includePath : $installPath.'/'.$includePath;
|
192 |
+
}
|
193 |
+
}
|
194 |
+
|
195 |
+
if (!$includePaths) {
|
196 |
+
return;
|
197 |
+
}
|
198 |
+
|
199 |
+
$includePathsFile = <<<EOF
|
200 |
+
<?php
|
201 |
+
|
202 |
+
// include_paths_52.php generated by xrstf/composer-php52
|
203 |
+
|
204 |
+
\$vendorDir = $vendorPathCode;
|
205 |
+
\$baseDir = $appBaseDirCode;
|
206 |
+
|
207 |
+
return array(
|
208 |
+
|
209 |
+
EOF;
|
210 |
+
|
211 |
+
foreach ($includePaths as $path) {
|
212 |
+
$includePathsFile .= "\t" . $this->getPathCode($filesystem, $basePath, $vendorPath, $path) . ",\n";
|
213 |
+
}
|
214 |
+
|
215 |
+
return $includePathsFile . ");\n";
|
216 |
+
}
|
217 |
+
|
218 |
+
protected function getAutoloadFile($vendorPathToTargetDirCode, $suffix) {
|
219 |
+
return <<<AUTOLOAD
|
220 |
+
<?php
|
221 |
+
|
222 |
+
// autoload_52.php generated by xrstf/composer-php52
|
223 |
+
|
224 |
+
require_once $vendorPathToTargetDirCode.'/autoload_real_52.php';
|
225 |
+
|
226 |
+
return ComposerAutoloaderInit$suffix::getLoader();
|
227 |
+
|
228 |
+
AUTOLOAD;
|
229 |
+
}
|
230 |
+
|
231 |
+
protected function getAutoloadRealFile($useClassMap, $useIncludePath, $targetDirLoader, $filesCode, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath, $prependAutoloader, $staticPhpVersion = 70000) {
|
232 |
+
// TODO the class ComposerAutoloaderInit should be revert to a closure
|
233 |
+
// when APC has been fixed:
|
234 |
+
// - https://github.com/composer/composer/issues/959
|
235 |
+
// - https://bugs.php.net/bug.php?id=52144
|
236 |
+
// - https://bugs.php.net/bug.php?id=61576
|
237 |
+
// - https://bugs.php.net/bug.php?id=59298
|
238 |
+
|
239 |
+
if ($filesCode) {
|
240 |
+
$filesCode = "\n\n".rtrim($filesCode);
|
241 |
+
}
|
242 |
+
|
243 |
+
$file = <<<HEADER
|
244 |
+
<?php
|
245 |
+
|
246 |
+
// autoload_real_52.php generated by xrstf/composer-php52
|
247 |
+
|
248 |
+
class ComposerAutoloaderInit$suffix {
|
249 |
+
private static \$loader;
|
250 |
+
|
251 |
+
public static function loadClassLoader(\$class) {
|
252 |
+
if ('xrstf_Composer52_ClassLoader' === \$class) {
|
253 |
+
require dirname(__FILE__).'/ClassLoader52.php';
|
254 |
+
}
|
255 |
+
}
|
256 |
+
|
257 |
+
/**
|
258 |
+
* @return xrstf_Composer52_ClassLoader
|
259 |
+
*/
|
260 |
+
public static function getLoader() {
|
261 |
+
if (null !== self::\$loader) {
|
262 |
+
return self::\$loader;
|
263 |
+
}
|
264 |
+
|
265 |
+
spl_autoload_register(array('ComposerAutoloaderInit$suffix', 'loadClassLoader'), true /*, true */);
|
266 |
+
self::\$loader = \$loader = new xrstf_Composer52_ClassLoader();
|
267 |
+
spl_autoload_unregister(array('ComposerAutoloaderInit$suffix', 'loadClassLoader'));
|
268 |
+
|
269 |
+
\$vendorDir = $vendorPathCode;
|
270 |
+
\$baseDir = $appBaseDirCode;
|
271 |
+
\$dir = dirname(__FILE__);
|
272 |
+
|
273 |
+
|
274 |
+
HEADER;
|
275 |
+
|
276 |
+
if ($useIncludePath) {
|
277 |
+
$file .= <<<'INCLUDE_PATH'
|
278 |
+
$includePaths = require $dir.'/include_paths.php';
|
279 |
+
array_push($includePaths, get_include_path());
|
280 |
+
set_include_path(implode(PATH_SEPARATOR, $includePaths));
|
281 |
+
|
282 |
+
|
283 |
+
INCLUDE_PATH;
|
284 |
+
}
|
285 |
+
|
286 |
+
$file .= <<<'PSR0'
|
287 |
+
$map = require $dir.'/autoload_namespaces.php';
|
288 |
+
foreach ($map as $namespace => $path) {
|
289 |
+
$loader->add($namespace, $path);
|
290 |
+
}
|
291 |
+
|
292 |
+
|
293 |
+
PSR0;
|
294 |
+
|
295 |
+
if ($useClassMap) {
|
296 |
+
$file .= <<<'CLASSMAP'
|
297 |
+
$classMap = require $dir.'/autoload_classmap.php';
|
298 |
+
if ($classMap) {
|
299 |
+
$loader->addClassMap($classMap);
|
300 |
+
}
|
301 |
+
|
302 |
+
|
303 |
+
CLASSMAP;
|
304 |
+
}
|
305 |
+
|
306 |
+
if ($this->classMapAuthoritative) {
|
307 |
+
$file .= <<<'CLASSMAPAUTHORITATIVE'
|
308 |
+
$loader->setClassMapAuthoritative(true);
|
309 |
+
|
310 |
+
CLASSMAPAUTHORITATIVE;
|
311 |
+
}
|
312 |
+
|
313 |
+
if ($useGlobalIncludePath) {
|
314 |
+
$file .= <<<'INCLUDEPATH'
|
315 |
+
$loader->setUseIncludePath(true);
|
316 |
+
|
317 |
+
|
318 |
+
INCLUDEPATH;
|
319 |
+
}
|
320 |
+
|
321 |
+
if ($targetDirLoader) {
|
322 |
+
$file .= <<<REGISTER_AUTOLOAD
|
323 |
+
spl_autoload_register(array('ComposerAutoloaderInit$suffix', 'autoload'), true);
|
324 |
+
|
325 |
+
|
326 |
+
REGISTER_AUTOLOAD;
|
327 |
+
|
328 |
+
}
|
329 |
+
|
330 |
+
$file .= <<<METHOD_FOOTER
|
331 |
+
\$loader->register($prependAutoloader);{$filesCode}
|
332 |
+
|
333 |
+
return \$loader;
|
334 |
+
}
|
335 |
+
|
336 |
+
METHOD_FOOTER;
|
337 |
+
|
338 |
+
$file .= $targetDirLoader;
|
339 |
+
|
340 |
+
return $file . <<<FOOTER
|
341 |
+
}
|
342 |
+
|
343 |
+
FOOTER;
|
344 |
+
|
345 |
+
}
|
346 |
+
}
|
vendor/xrstf/composer-php52/lib/xrstf/Composer52/ClassLoader.php
ADDED
@@ -0,0 +1,271 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (c) 2013, Christoph Mewes, http://www.xrstf.de
|
4 |
+
*
|
5 |
+
* This file is released under the terms of the MIT license. You can find the
|
6 |
+
* complete text in the attached LICENSE file or online at:
|
7 |
+
*
|
8 |
+
* http://www.opensource.org/licenses/mit-license.php
|
9 |
+
*
|
10 |
+
* --------------------------------------------------------------------------
|
11 |
+
*
|
12 |
+
* 99% of this is copied as-is from the original Composer source code and is
|
13 |
+
* released under MIT license as well. Copyright goes to:
|
14 |
+
*
|
15 |
+
* - Fabien Potencier <fabien@symfony.com>
|
16 |
+
* - Jordi Boggiano <j.boggiano@seld.be>
|
17 |
+
*/
|
18 |
+
|
19 |
+
class xrstf_Composer52_ClassLoader {
|
20 |
+
private $prefixes = array();
|
21 |
+
private $fallbackDirs = array();
|
22 |
+
private $useIncludePath = false;
|
23 |
+
private $classMap = array();
|
24 |
+
private $classMapAuthoratative = false;
|
25 |
+
private $allowUnderscore = false;
|
26 |
+
|
27 |
+
/**
|
28 |
+
* @param boolean $flag true to allow class names with a leading underscore, false to disable
|
29 |
+
*/
|
30 |
+
public function setAllowUnderscore($flag) {
|
31 |
+
$this->allowUnderscore = (boolean) $flag;
|
32 |
+
}
|
33 |
+
|
34 |
+
/**
|
35 |
+
* @return array
|
36 |
+
*/
|
37 |
+
public function getPrefixes() {
|
38 |
+
return $this->prefixes;
|
39 |
+
}
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Turns off searching the prefix and fallback directories for classes
|
43 |
+
* that have not been registered with the class map.
|
44 |
+
*
|
45 |
+
* @param bool $classMapAuthoratative
|
46 |
+
*/
|
47 |
+
public function setClassMapAuthoritative($classMapAuthoratative) {
|
48 |
+
$this->classMapAuthoratative = $classMapAuthoratative;
|
49 |
+
}
|
50 |
+
|
51 |
+
/**
|
52 |
+
* Should class lookup fail if not found in the current class map?
|
53 |
+
*
|
54 |
+
* @return bool
|
55 |
+
*/
|
56 |
+
public function getClassMapAuthoratative() {
|
57 |
+
return $this->classMapAuthoratative;
|
58 |
+
}
|
59 |
+
|
60 |
+
/**
|
61 |
+
* @return array
|
62 |
+
*/
|
63 |
+
public function getFallbackDirs() {
|
64 |
+
return $this->fallbackDirs;
|
65 |
+
}
|
66 |
+
|
67 |
+
/**
|
68 |
+
* @return array
|
69 |
+
*/
|
70 |
+
public function getClassMap() {
|
71 |
+
return $this->classMap;
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* @param array $classMap class to filename map
|
76 |
+
*/
|
77 |
+
public function addClassMap(array $classMap) {
|
78 |
+
if ($this->classMap) {
|
79 |
+
$this->classMap = array_merge($this->classMap, $classMap);
|
80 |
+
}
|
81 |
+
else {
|
82 |
+
$this->classMap = $classMap;
|
83 |
+
}
|
84 |
+
}
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Registers a set of classes, merging with any others previously set.
|
88 |
+
*
|
89 |
+
* @param string $prefix the classes prefix
|
90 |
+
* @param array|string $paths the location(s) of the classes
|
91 |
+
* @param bool $prepend prepend the location(s)
|
92 |
+
*/
|
93 |
+
public function add($prefix, $paths, $prepend = false) {
|
94 |
+
if (!$prefix) {
|
95 |
+
if ($prepend) {
|
96 |
+
$this->fallbackDirs = array_merge(
|
97 |
+
(array) $paths,
|
98 |
+
$this->fallbackDirs
|
99 |
+
);
|
100 |
+
}
|
101 |
+
else {
|
102 |
+
$this->fallbackDirs = array_merge(
|
103 |
+
$this->fallbackDirs,
|
104 |
+
(array) $paths
|
105 |
+
);
|
106 |
+
}
|
107 |
+
|
108 |
+
return;
|
109 |
+
}
|
110 |
+
|
111 |
+
if (!isset($this->prefixes[$prefix])) {
|
112 |
+
$this->prefixes[$prefix] = (array) $paths;
|
113 |
+
return;
|
114 |
+
}
|
115 |
+
|
116 |
+
if ($prepend) {
|
117 |
+
$this->prefixes[$prefix] = array_merge(
|
118 |
+
(array) $paths,
|
119 |
+
$this->prefixes[$prefix]
|
120 |
+
);
|
121 |
+
}
|
122 |
+
else {
|
123 |
+
$this->prefixes[$prefix] = array_merge(
|
124 |
+
$this->prefixes[$prefix],
|
125 |
+
(array) $paths
|
126 |
+
);
|
127 |
+
}
|
128 |
+
}
|
129 |
+
|
130 |
+
/**
|
131 |
+
* Registers a set of classes, replacing any others previously set.
|
132 |
+
*
|
133 |
+
* @param string $prefix the classes prefix
|
134 |
+
* @param array|string $paths the location(s) of the classes
|
135 |
+
*/
|
136 |
+
public function set($prefix, $paths) {
|
137 |
+
if (!$prefix) {
|
138 |
+
$this->fallbackDirs = (array) $paths;
|
139 |
+
return;
|
140 |
+
}
|
141 |
+
|
142 |
+
$this->prefixes[$prefix] = (array) $paths;
|
143 |
+
}
|
144 |
+
|
145 |
+
/**
|
146 |
+
* Turns on searching the include path for class files.
|
147 |
+
*
|
148 |
+
* @param bool $useIncludePath
|
149 |
+
*/
|
150 |
+
public function setUseIncludePath($useIncludePath) {
|
151 |
+
$this->useIncludePath = $useIncludePath;
|
152 |
+
}
|
153 |
+
|
154 |
+
/**
|
155 |
+
* Can be used to check if the autoloader uses the include path to check
|
156 |
+
* for classes.
|
157 |
+
*
|
158 |
+
* @return bool
|
159 |
+
*/
|
160 |
+
public function getUseIncludePath() {
|
161 |
+
return $this->useIncludePath;
|
162 |
+
}
|
163 |
+
|
164 |
+
/**
|
165 |
+
* Registers this instance as an autoloader.
|
166 |
+
*/
|
167 |
+
public function register() {
|
168 |
+
spl_autoload_register(array($this, 'loadClass'), true);
|
169 |
+
}
|
170 |
+
|
171 |
+
/**
|
172 |
+
* Unregisters this instance as an autoloader.
|
173 |
+
*/
|
174 |
+
public function unregister() {
|
175 |
+
spl_autoload_unregister(array($this, 'loadClass'));
|
176 |
+
}
|
177 |
+
|
178 |
+
/**
|
179 |
+
* Loads the given class or interface.
|
180 |
+
*
|
181 |
+
* @param string $class the name of the class
|
182 |
+
* @return bool|null true, if loaded
|
183 |
+
*/
|
184 |
+
public function loadClass($class) {
|
185 |
+
if ($file = $this->findFile($class)) {
|
186 |
+
include $file;
|
187 |
+
return true;
|
188 |
+
}
|
189 |
+
}
|
190 |
+
|
191 |
+
/**
|
192 |
+
* Finds the path to the file where the class is defined.
|
193 |
+
*
|
194 |
+
* @param string $class the name of the class
|
195 |
+
* @return string|null the path, if found
|
196 |
+
*/
|
197 |
+
public function findFile($class) {
|
198 |
+
if ('\\' === $class[0]) {
|
199 |
+
$class = substr($class, 1);
|
200 |
+
}
|
201 |
+
|
202 |
+
if (isset($this->classMap[$class])) {
|
203 |
+
return $this->classMap[$class];
|
204 |
+
}
|
205 |
+
elseif ($this->classMapAuthoratative) {
|
206 |
+
return false;
|
207 |
+
}
|
208 |
+
|
209 |
+
$classPath = $this->getClassPath($class);
|
210 |
+
|
211 |
+
foreach ($this->prefixes as $prefix => $dirs) {
|
212 |
+
if (0 === strpos($class, $prefix)) {
|
213 |
+
foreach ($dirs as $dir) {
|
214 |
+
if (file_exists($dir.DIRECTORY_SEPARATOR.$classPath)) {
|
215 |
+
return $dir.DIRECTORY_SEPARATOR.$classPath;
|
216 |
+
}
|
217 |
+
}
|
218 |
+
}
|
219 |
+
}
|
220 |
+
|
221 |
+
foreach ($this->fallbackDirs as $dir) {
|
222 |
+
if (file_exists($dir.DIRECTORY_SEPARATOR.$classPath)) {
|
223 |
+
return $dir.DIRECTORY_SEPARATOR.$classPath;
|
224 |
+
}
|
225 |
+
}
|
226 |
+
|
227 |
+
if ($this->useIncludePath && $file = self::resolveIncludePath($classPath)) {
|
228 |
+
return $file;
|
229 |
+
}
|
230 |
+
|
231 |
+
return $this->classMap[$class] = false;
|
232 |
+
}
|
233 |
+
|
234 |
+
private function getClassPath($class) {
|
235 |
+
if (false !== $pos = strrpos($class, '\\')) {
|
236 |
+
// namespaced class name
|
237 |
+
$classPath = str_replace('\\', DIRECTORY_SEPARATOR, substr($class, 0, $pos)).DIRECTORY_SEPARATOR;
|
238 |
+
$className = substr($class, $pos + 1);
|
239 |
+
}
|
240 |
+
else {
|
241 |
+
// PEAR-like class name
|
242 |
+
$classPath = null;
|
243 |
+
$className = $class;
|
244 |
+
}
|
245 |
+
|
246 |
+
$className = str_replace('_', DIRECTORY_SEPARATOR, $className);
|
247 |
+
|
248 |
+
// restore the prefix
|
249 |
+
if ($this->allowUnderscore && DIRECTORY_SEPARATOR === $className[0]) {
|
250 |
+
$className[0] = '_';
|
251 |
+
}
|
252 |
+
|
253 |
+
$classPath .= $className.'.php';
|
254 |
+
|
255 |
+
return $classPath;
|
256 |
+
}
|
257 |
+
|
258 |
+
public static function resolveIncludePath($classPath) {
|
259 |
+
$paths = explode(PATH_SEPARATOR, get_include_path());
|
260 |
+
|
261 |
+
foreach ($paths as $path) {
|
262 |
+
$path = rtrim($path, '/\\');
|
263 |
+
|
264 |
+
if ($file = file_exists($path.DIRECTORY_SEPARATOR.$file)) {
|
265 |
+
return $file;
|
266 |
+
}
|
267 |
+
}
|
268 |
+
|
269 |
+
return false;
|
270 |
+
}
|
271 |
+
}
|
vendor/xrstf/composer-php52/lib/xrstf/Composer52/Generator.php
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* Copyright (c) 2013, Christoph Mewes, http://www.xrstf.de
|
4 |
+
*
|
5 |
+
* This file is released under the terms of the MIT license. You can find the
|
6 |
+
* complete text in the attached LICENSE file or online at:
|
7 |
+
*
|
8 |
+
* http://www.opensource.org/licenses/mit-license.php
|
9 |
+
*/
|
10 |
+
|
11 |
+
namespace xrstf\Composer52;
|
12 |
+
|
13 |
+
use Composer\Repository\CompositeRepository;
|
14 |
+
use Composer\Script\Event;
|
15 |
+
|
16 |
+
class Generator {
|
17 |
+
public static function onPostInstallCmd(Event $event) {
|
18 |
+
$composer = $event->getComposer();
|
19 |
+
$installationManager = $composer->getInstallationManager();
|
20 |
+
$repoManager = $composer->getRepositoryManager();
|
21 |
+
$localRepo = $repoManager->getLocalRepository();
|
22 |
+
$package = $composer->getPackage();
|
23 |
+
$config = $composer->getConfig();
|
24 |
+
|
25 |
+
// We can't gain access to the Command's input object, so we have to look
|
26 |
+
// for -o / --optimize-autoloader ourselves. Sadly, neither getopt() works
|
27 |
+
// (always returns an empty array), nor does Symfony's Console Input, as
|
28 |
+
// it expects a full definition of the current command line and we can't
|
29 |
+
// provide that.
|
30 |
+
|
31 |
+
$args = $_SERVER['argv'];
|
32 |
+
$optimize = in_array('-o', $args) || in_array('--optimize-autoloader', $args) || in_array('--optimize', $args);
|
33 |
+
|
34 |
+
$suffix = $config->get('autoloader-suffix');
|
35 |
+
|
36 |
+
$generator = new AutoloadGenerator();
|
37 |
+
$generator->dump($config, $localRepo, $package, $installationManager, 'composer', $optimize, $suffix);
|
38 |
+
}
|
39 |
+
}
|