Version Description
- 2018-02-20 =
- Change: Plugins page removed as this plugin is no longer required by WP Offload S3 or WP Offload S3 Lite
- Bug fix: Update checking broken for version 1.5 or less of WP Offload S3
- Bug fix:
WP_Offload_S3_Autoloader
class included in plugin - Bug fix: License in composer.json fails Packagist validation
Download this release
Release Info
Developer | deliciousbrains |
Plugin | Amazon Web Services |
Version | 1.0.5 |
Comparing to | |
See all releases |
Code changes from version 1.0.4 to 1.0.5
- README.md +12 -5
- amazon-web-services.php +3 -3
- assets/css/styles.css +1 -1
- assets/sass/styles.scss +1 -166
- classes/amazon-web-services.php +6 -150
- composer.json +2 -2
- languages/amazon-web-services-en.pot +12 -65
- readme.txt +12 -5
- view/addon.php +0 -26
- view/addons.php +0 -5
- view/settings.php +2 -0
- wp-offload-s3-autoloader.php +0 -94
README.md
CHANGED
@@ -3,17 +3,18 @@
|
|
3 |
**Tags:** amazon, amazon web services
|
4 |
**Requires at least:** 4.6
|
5 |
**Tested up to:** 4.9
|
6 |
-
**Stable tag:** 1.0.
|
7 |
**License:** GPLv3
|
8 |
|
9 |
-
Houses the Amazon Web Services (AWS) PHP libraries and manages access keys.
|
10 |
|
11 |
## Description ##
|
12 |
|
13 |
-
This plugin
|
14 |
|
15 |
-
|
16 |
-
|
|
|
17 |
|
18 |
### Requirements ###
|
19 |
|
@@ -35,6 +36,12 @@ This plugin is required by other plugins, which use its libraries and its settin
|
|
35 |
|
36 |
## Changelog ##
|
37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
### 1.0.4 - 2017-11-20 ###
|
39 |
* Improvement: Compatibility with WordPress 4.9
|
40 |
* Improvement: Compatibility with WP Offload S3 1.5.1
|
3 |
**Tags:** amazon, amazon web services
|
4 |
**Requires at least:** 4.6
|
5 |
**Tested up to:** 4.9
|
6 |
+
**Stable tag:** 1.0.5
|
7 |
**License:** GPLv3
|
8 |
|
9 |
+
Houses the Amazon Web Services (AWS) PHP SDK v2 libraries and manages access keys.
|
10 |
|
11 |
## Description ##
|
12 |
|
13 |
+
This plugin allows the user to define AWS access keys and allows other plugins to hook into it and use the AWS SDK that's included.
|
14 |
|
15 |
+
The plan was for this plugin to be a dependency of several plugins and all could use the same AWS SDK. We realized however that there are [problems with this idea](https://deliciousbrains.com/wp-offload-s3-1-6-released/?utm_campaign=WP%2BOffload%2BS3&utm_source=wordpress.org&utm_medium=free%2Bplugin%2Blisting&utm_content=AWS) and we've taken [another approach](https://deliciousbrains.com/wp-offload-s3-1-6-released/?utm_campaign=WP%2BOffload%2BS3&utm_source=wordpress.org&utm_medium=free%2Bplugin%2Blisting&utm_content=AWS).
|
16 |
+
|
17 |
+
This plugin was used by our plugins ([WP Offload S3](https://deliciousbrains.com/wp-offload-s3/?utm_campaign=WP%2BOffload%2BS3&utm_source=wordpress.org&utm_medium=free%2Bplugin%2Blisting&utm_content=AWS) and [WP Offload S3 Lite](http://wordpress.org/plugins/amazon-s3-and-cloudfront/)) but it is almost certainly used by other plugins we're not aware of. So although it is no longer needed for our plugins, we'll leave it here for others.
|
18 |
|
19 |
### Requirements ###
|
20 |
|
36 |
|
37 |
## Changelog ##
|
38 |
|
39 |
+
### 1.0.5 - 2018-02-20 ###
|
40 |
+
* Change: Plugins page removed as this plugin is no longer required by [WP Offload S3](https://deliciousbrains.com/wp-offload-s3/?utm_campaign=WP%2BOffload%2BS3&utm_source=wordpress.org&utm_medium=free%2Bplugin%2Blisting&utm_content=AWS) or [WP Offload S3 Lite](http://wordpress.org/plugins/amazon-s3-and-cloudfront/)
|
41 |
+
* Bug fix: Update checking broken for version 1.5 or less of WP Offload S3
|
42 |
+
* Bug fix: `WP_Offload_S3_Autoloader` class included in plugin
|
43 |
+
* Bug fix: License in composer.json fails Packagist validation
|
44 |
+
|
45 |
### 1.0.4 - 2017-11-20 ###
|
46 |
* Improvement: Compatibility with WordPress 4.9
|
47 |
* Improvement: Compatibility with WP Offload S3 1.5.1
|
amazon-web-services.php
CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Amazon Web Services
|
|
4 |
Plugin URI: http://wordpress.org/extend/plugins/amazon-web-services/
|
5 |
Description: Includes the Amazon Web Services PHP libraries, stores access keys, and allows other plugins to hook into it.
|
6 |
Author: Delicious Brains
|
7 |
-
Version: 1.0.
|
8 |
Author URI: https://deliciousbrains.com/
|
9 |
Network: True
|
10 |
Text Domain: amazon-web-services
|
@@ -22,11 +22,11 @@ Domain Path: /languages/
|
|
22 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
23 |
// **********************************************************************
|
24 |
|
25 |
-
$GLOBALS['aws_meta']['amazon-web-services']['version'] = '1.0.
|
26 |
|
27 |
$GLOBALS['aws_meta']['amazon-web-services']['supported_addon_versions'] = array(
|
28 |
'amazon-s3-and-cloudfront' => '1.2.1',
|
29 |
-
'amazon-s3-and-cloudfront-pro' => '1.
|
30 |
);
|
31 |
|
32 |
require dirname( __FILE__ ) . '/classes/aws-compatibility-check.php';
|
4 |
Plugin URI: http://wordpress.org/extend/plugins/amazon-web-services/
|
5 |
Description: Includes the Amazon Web Services PHP libraries, stores access keys, and allows other plugins to hook into it.
|
6 |
Author: Delicious Brains
|
7 |
+
Version: 1.0.5
|
8 |
Author URI: https://deliciousbrains.com/
|
9 |
Network: True
|
10 |
Text Domain: amazon-web-services
|
22 |
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
23 |
// **********************************************************************
|
24 |
|
25 |
+
$GLOBALS['aws_meta']['amazon-web-services']['version'] = '1.0.5';
|
26 |
|
27 |
$GLOBALS['aws_meta']['amazon-web-services']['supported_addon_versions'] = array(
|
28 |
'amazon-s3-and-cloudfront' => '1.2.1',
|
29 |
+
'amazon-s3-and-cloudfront-pro' => '1.0b1',
|
30 |
);
|
31 |
|
32 |
require dirname( __FILE__ ) . '/classes/aws-compatibility-check.php';
|
assets/css/styles.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.aws-content,.aws-updated,.aws-compatibility-notice{-webkit-box-sizing:border-box;box-sizing:border-box;max-width:650px}.toplevel_page_amazon-web-services .error,.toplevel_page_amazon-web-services .notice,.toplevel_page_amazon-web-services .updated{-webkit-box-sizing:border-box;box-sizing:border-box;max-width:650px}.aws-
|
1 |
+
.aws-content,.aws-updated,.aws-compatibility-notice{-webkit-box-sizing:border-box;box-sizing:border-box;max-width:650px}.toplevel_page_amazon-web-services .error,.toplevel_page_amazon-web-services .notice,.toplevel_page_amazon-web-services .updated{-webkit-box-sizing:border-box;box-sizing:border-box;max-width:650px}.aws-settings h3{font-size:20px}.aws-settings .need-help{background-color:#fff;padding:20px 20px 20px 50px;line-height:1;font-size:16px;font-weight:bold;position:relative}.aws-settings .need-help:before{font-family:"dashicons";content:"\f348";font-size:24px;line-height:1;width:24px;height:24px;position:absolute;top:16px;left:16px}.aws-settings .need-help a{text-decoration:none}.aws-settings>p{font-size:14px}body.toplevel_page_amazon-web-services .wrap h1{color:#fff;font-weight:600;font-size:26px;line-height:1;margin:20px 0 15px 0;width:650px;padding:100px 0 0 25px;height:150px;background:#f7a80d url(../img/aws-logo.svg) right 40px center no-repeat;background-size:100px 79px;box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box}
|
assets/sass/styles.scss
CHANGED
@@ -16,11 +16,6 @@ $aws_orange: #f7a80d;
|
|
16 |
}
|
17 |
}
|
18 |
|
19 |
-
.aws-addons,
|
20 |
-
.aws-main[data-view="addons"] .aws-compatibility-notice {
|
21 |
-
max-width: 772px;
|
22 |
-
}
|
23 |
-
|
24 |
.aws-settings {
|
25 |
h3 {
|
26 |
font-size: 20px;
|
@@ -51,7 +46,7 @@ $aws_orange: #f7a80d;
|
|
51 |
}
|
52 |
}
|
53 |
|
54 |
-
p {
|
55 |
font-size: 14px;
|
56 |
}
|
57 |
}
|
@@ -73,163 +68,3 @@ body.toplevel_page_amazon-web-services .wrap {
|
|
73 |
-webkit-box-sizing: border-box;
|
74 |
}
|
75 |
}
|
76 |
-
|
77 |
-
/**
|
78 |
-
* Addons page
|
79 |
-
*/
|
80 |
-
.aws-addons {
|
81 |
-
.addons-list {
|
82 |
-
margin: 20px 0 200px;
|
83 |
-
padding-top: 5px;
|
84 |
-
border-top: 1px solid #ddd;
|
85 |
-
font-size: 14px;
|
86 |
-
|
87 |
-
li:last-child {
|
88 |
-
margin-bottom: 0;
|
89 |
-
}
|
90 |
-
|
91 |
-
// First depth
|
92 |
-
article {
|
93 |
-
margin-top: 10px;
|
94 |
-
width: 100%;
|
95 |
-
height: 250px;
|
96 |
-
position: relative;
|
97 |
-
font-weight: 300;
|
98 |
-
line-height: 1;
|
99 |
-
overflow: hidden;
|
100 |
-
|
101 |
-
.info {
|
102 |
-
position: absolute;
|
103 |
-
bottom: 20px;
|
104 |
-
left: 20px;
|
105 |
-
|
106 |
-
ul {
|
107 |
-
margin: 16px 0 0;
|
108 |
-
color: rgba(255, 255, 255, .7);
|
109 |
-
|
110 |
-
li {
|
111 |
-
display: inline-block;
|
112 |
-
margin: 0 30px 0 0;
|
113 |
-
|
114 |
-
&:last-child {
|
115 |
-
margin-right: 0;
|
116 |
-
}
|
117 |
-
}
|
118 |
-
}
|
119 |
-
|
120 |
-
a {
|
121 |
-
color: #fff;
|
122 |
-
text-decoration: none;
|
123 |
-
|
124 |
-
&:hover {
|
125 |
-
text-decoration: underline;
|
126 |
-
}
|
127 |
-
}
|
128 |
-
}
|
129 |
-
|
130 |
-
h1, h2 {
|
131 |
-
padding: 0;
|
132 |
-
color: #fff;
|
133 |
-
line-height: 1;
|
134 |
-
font-weight: 600;
|
135 |
-
}
|
136 |
-
|
137 |
-
h1 {
|
138 |
-
margin: 0;
|
139 |
-
font-size: 26px;
|
140 |
-
}
|
141 |
-
|
142 |
-
h2 {
|
143 |
-
margin: 4px 0 0;
|
144 |
-
font-size: 18px;
|
145 |
-
}
|
146 |
-
|
147 |
-
.label {
|
148 |
-
position: absolute;
|
149 |
-
top: 10px;
|
150 |
-
right: 10px;
|
151 |
-
font-style: italic;
|
152 |
-
color: #fff;
|
153 |
-
}
|
154 |
-
}
|
155 |
-
|
156 |
-
// Addons
|
157 |
-
> li > ul {
|
158 |
-
background-color: #fff;
|
159 |
-
border-top: 0;
|
160 |
-
padding: 10px;
|
161 |
-
overflow: hidden;
|
162 |
-
|
163 |
-
article {
|
164 |
-
display: flex;
|
165 |
-
align-items: center;
|
166 |
-
justify-content: center;
|
167 |
-
|
168 |
-
img {
|
169 |
-
width: 100px;
|
170 |
-
height: 100px;
|
171 |
-
}
|
172 |
-
|
173 |
-
h1 {
|
174 |
-
margin-top: 8px;
|
175 |
-
font-size: 30px;
|
176 |
-
line-height: 1.2;
|
177 |
-
}
|
178 |
-
|
179 |
-
.info {
|
180 |
-
display: block;
|
181 |
-
left: auto;
|
182 |
-
bottom: auto;
|
183 |
-
margin: 0 auto;
|
184 |
-
text-align: center;
|
185 |
-
|
186 |
-
ul {
|
187 |
-
li {
|
188 |
-
margin-right: 10px;
|
189 |
-
font-size: 13px;
|
190 |
-
line-height: 1.6;
|
191 |
-
}
|
192 |
-
}
|
193 |
-
}
|
194 |
-
}
|
195 |
-
|
196 |
-
li {
|
197 |
-
margin-bottom: 0;
|
198 |
-
}
|
199 |
-
}
|
200 |
-
|
201 |
-
.amazon-s3-and-cloudfront > article {
|
202 |
-
background-image: url(../img/as3cf-banner-bw.jpg);
|
203 |
-
background-size: 772px 150px;
|
204 |
-
background-repeat: no-repeat;
|
205 |
-
height: 150px;
|
206 |
-
|
207 |
-
@media (min--moz-device-pixel-ratio: 1.3),
|
208 |
-
(-o-min-device-pixel-ratio: 2.6/2),
|
209 |
-
(-webkit-min-device-pixel-ratio: 1.3),
|
210 |
-
(min-device-pixel-ratio: 1.3),
|
211 |
-
(min-resolution: 1.3dppx) {
|
212 |
-
background-image: url(../img/as3cf-banner-bw@2x.jpg);
|
213 |
-
}
|
214 |
-
}
|
215 |
-
|
216 |
-
.amazon-s3-and-cloudfront-pro > article {
|
217 |
-
background-image: url(../img/as3cf-banner.jpg);
|
218 |
-
background-size: 772px 250px;
|
219 |
-
background-repeat: no-repeat;
|
220 |
-
|
221 |
-
@media (min--moz-device-pixel-ratio: 1.3),
|
222 |
-
(-o-min-device-pixel-ratio: 2.6/2),
|
223 |
-
(-webkit-min-device-pixel-ratio: 1.3),
|
224 |
-
(min-device-pixel-ratio: 1.3),
|
225 |
-
(min-resolution: 1.3dppx) {
|
226 |
-
background-image: url(../img/as3cf-banner@2x.jpg);
|
227 |
-
}
|
228 |
-
}
|
229 |
-
|
230 |
-
.amazon-s3-and-cloudfront-assets-pull > article {
|
231 |
-
background-color: #0769ad;
|
232 |
-
margin-top: 0;
|
233 |
-
}
|
234 |
-
}
|
235 |
-
}
|
16 |
}
|
17 |
}
|
18 |
|
|
|
|
|
|
|
|
|
|
|
19 |
.aws-settings {
|
20 |
h3 {
|
21 |
font-size: 20px;
|
46 |
}
|
47 |
}
|
48 |
|
49 |
+
> p {
|
50 |
font-size: 14px;
|
51 |
}
|
52 |
}
|
68 |
-webkit-box-sizing: border-box;
|
69 |
}
|
70 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
classes/amazon-web-services.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
use Aws\Common\Aws;
|
3 |
|
4 |
class Amazon_Web_Services extends AWS_Plugin_Base {
|
@@ -52,6 +53,7 @@ class Amazon_Web_Services extends AWS_Plugin_Base {
|
|
52 |
$this->plugin_menu_title = __( 'AWS', 'amazon-web-services' );
|
53 |
|
54 |
add_filter( 'plugin_action_links', array( $this, 'plugin_actions_settings_link' ), 10, 2 );
|
|
|
55 |
|
56 |
load_plugin_textdomain( 'amazon-web-services', false, dirname( plugin_basename( $plugin_file_path ) ) . '/languages/' );
|
57 |
}
|
@@ -66,17 +68,11 @@ class Amazon_Web_Services extends AWS_Plugin_Base {
|
|
66 |
$icon_url = false;
|
67 |
}
|
68 |
|
69 |
-
$hook_suffixes
|
70 |
$hook_suffixes[] = add_menu_page( $this->plugin_title, $this->plugin_menu_title, $this->plugin_permission, $this->plugin_slug, array(
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
$title = __( 'Addons', 'amazon-web-services' );
|
76 |
-
$hook_suffixes[] = $this->add_page( $title, $title, $this->plugin_permission, 'aws-addons', array(
|
77 |
-
$this,
|
78 |
-
'render_page',
|
79 |
-
) );
|
80 |
|
81 |
global $submenu;
|
82 |
if ( isset( $submenu[ $this->plugin_slug ][0][0] ) ) {
|
@@ -123,12 +119,6 @@ class Amazon_Web_Services extends AWS_Plugin_Base {
|
|
123 |
$this->enqueue_style( 'aws-styles', 'assets/css/styles' );
|
124 |
$this->enqueue_script( 'aws-script', 'assets/js/script', array( 'jquery' ) );
|
125 |
|
126 |
-
if ( isset( $_GET['page'] ) && 'aws-addons' === sanitize_key( $_GET['page'] ) ) { // input var okay
|
127 |
-
add_filter( 'admin_body_class', array( $this, 'admin_plugin_body_class' ) );
|
128 |
-
wp_enqueue_script( 'plugin-install' );
|
129 |
-
add_thickbox();
|
130 |
-
}
|
131 |
-
|
132 |
$this->handle_post_request();
|
133 |
|
134 |
do_action( 'aws_plugin_load', $this );
|
@@ -192,16 +182,6 @@ class Amazon_Web_Services extends AWS_Plugin_Base {
|
|
192 |
wp_die( 'What the heck are we doin here?' );
|
193 |
}
|
194 |
|
195 |
-
if ( preg_match( '@^aws-(.*)$@', $_GET['page'], $matches ) ) {
|
196 |
-
$allowed = array(
|
197 |
-
'addons' => __( 'Amazon Web Services: Addons', 'amazon-web-services' ),
|
198 |
-
);
|
199 |
-
if ( array_key_exists( $matches[1], $allowed ) ) {
|
200 |
-
$view = $matches[1];
|
201 |
-
$page_title = $allowed[ $view ];
|
202 |
-
}
|
203 |
-
}
|
204 |
-
|
205 |
$this->render_view( 'header', array( 'page' => $view, 'page_title' => $page_title ) );
|
206 |
$this->render_view( $view );
|
207 |
$this->render_view( 'footer' );
|
@@ -369,130 +349,6 @@ class Amazon_Web_Services extends AWS_Plugin_Base {
|
|
369 |
return __( 'Access Keys', 'amazon-web-services' );
|
370 |
}
|
371 |
|
372 |
-
/**
|
373 |
-
* Get all defined addons that use this plugin
|
374 |
-
*
|
375 |
-
* @param bool $unfiltered
|
376 |
-
*
|
377 |
-
* @return array
|
378 |
-
*/
|
379 |
-
public function get_addons( $unfiltered = false ) {
|
380 |
-
$addons = array(
|
381 |
-
'amazon-s3-and-cloudfront' => array(
|
382 |
-
'title' => __( 'WP Offload S3 Lite', 'amazon-web-services' ),
|
383 |
-
'url' => 'https://wordpress.org/plugins/amazon-s3-and-cloudfront/',
|
384 |
-
'install' => true,
|
385 |
-
),
|
386 |
-
'amazon-s3-and-cloudfront-pro' => array(
|
387 |
-
'title' => __( 'WP Offload S3', 'amazon-web-services' ),
|
388 |
-
'url' => $this->dbrains_url( '/wp-offload-s3', array(
|
389 |
-
'utm_campaign' => 'WP+Offload+S3',
|
390 |
-
) ),
|
391 |
-
'addons' => array(
|
392 |
-
'amazon-s3-and-cloudfront-assets-pull' => array(
|
393 |
-
'title' => __( 'Assets Pull', 'amazon-web-services' ),
|
394 |
-
'url' => $this->dbrains_url( '/wp-offload-s3/doc/assets-pull-addon/', array(
|
395 |
-
'utm_campaign' => 'addons+install',
|
396 |
-
) ),
|
397 |
-
'label' => __( 'Feature', 'amazon-web-services' ),
|
398 |
-
'icon' => true,
|
399 |
-
),
|
400 |
-
),
|
401 |
-
),
|
402 |
-
);
|
403 |
-
|
404 |
-
if ( $unfiltered ) {
|
405 |
-
return $addons;
|
406 |
-
}
|
407 |
-
|
408 |
-
$addons = apply_filters( 'aws_addons', $addons );
|
409 |
-
|
410 |
-
return $addons;
|
411 |
-
}
|
412 |
-
|
413 |
-
/**
|
414 |
-
* Recursively build addons list
|
415 |
-
*
|
416 |
-
* @param array|null $addons
|
417 |
-
*/
|
418 |
-
function render_addons( $addons = null ) {
|
419 |
-
if ( is_null( $addons ) ) {
|
420 |
-
$addons = $this->get_addons();
|
421 |
-
}
|
422 |
-
|
423 |
-
if ( class_exists( 'Amazon_S3_And_CloudFront_Pro' ) ) {
|
424 |
-
unset( $addons['amazon-s3-and-cloudfront'] );
|
425 |
-
}
|
426 |
-
|
427 |
-
foreach ( $addons as $slug => $addon ) {
|
428 |
-
$this->render_view( 'addon', array( 'slug' => $slug, 'addon' => $addon ) );
|
429 |
-
}
|
430 |
-
}
|
431 |
-
|
432 |
-
/**
|
433 |
-
* Add install links to AWS addon page
|
434 |
-
*
|
435 |
-
* @param string $slug
|
436 |
-
* @param array $addon Details of the addon
|
437 |
-
*/
|
438 |
-
function get_addon_install_link( $slug, $addon ) {
|
439 |
-
$installed = file_exists( WP_PLUGIN_DIR . '/' . $slug );
|
440 |
-
$activated = $this->is_plugin_activated( $slug );
|
441 |
-
|
442 |
-
if ( $installed && $activated ) {
|
443 |
-
echo '<li class="installed activated">' . esc_html( _x( 'Installed & Activated', 'Plugin already installed and activated', 'amazon-web-services' ) ) . '</li>';
|
444 |
-
} elseif ( $installed ) {
|
445 |
-
echo '<li class="installed">' . esc_html( _x( 'Installed', 'Plugin already installed', 'amazon-web-services' ) ) . '</li>';
|
446 |
-
echo '<li class="activate"><a href="' . esc_url( $this->get_plugin_activate_url( $slug ) ) . '">' . esc_html( _x( 'Activate Now', 'Activate plugin now', 'amazon-web-services' ) ) . '</a></li>';
|
447 |
-
} else {
|
448 |
-
if ( isset( $addon['install'] ) && $addon['install'] ) {
|
449 |
-
echo '<li class="install"><a href="' . esc_url( $this->get_plugin_install_url( $slug ) ) . '">' . esc_html( _x( 'Install Now', 'Install plugin now', 'amazon-web-services' ) ) . '</a></li>';
|
450 |
-
}
|
451 |
-
}
|
452 |
-
|
453 |
-
// Other links
|
454 |
-
if ( isset( $addon['links'] ) ) {
|
455 |
-
foreach ( $addon['links'] as $link ) {
|
456 |
-
if ( ! isset( $link['url'] ) || ! isset( $link['text'] ) ) {
|
457 |
-
continue;
|
458 |
-
}
|
459 |
-
echo '<li><a href="' . esc_url( $link['url'] ) . '">' . esc_html( $link['text'] ) . '</a></li>';
|
460 |
-
}
|
461 |
-
}
|
462 |
-
}
|
463 |
-
|
464 |
-
/**
|
465 |
-
* Get the URL of the addon's icon
|
466 |
-
*
|
467 |
-
* @param string $slug
|
468 |
-
*
|
469 |
-
* @return string
|
470 |
-
*/
|
471 |
-
function get_addon_icon_url( $slug ) {
|
472 |
-
$filename = str_replace( 'amazon-s3-and-cloudfront-', '', $slug );
|
473 |
-
$filename = 'icon-' . $filename . '.svg';
|
474 |
-
echo plugins_url( 'assets/img/' . $filename, $this->plugin_file_path );
|
475 |
-
}
|
476 |
-
|
477 |
-
/**
|
478 |
-
* Add details link to AWS addon page
|
479 |
-
*
|
480 |
-
* @param string $slug
|
481 |
-
* @param array $addon Details of the addon
|
482 |
-
*/
|
483 |
-
function get_addon_details_link( $slug, $addon ) {
|
484 |
-
$url = $addon['url'];
|
485 |
-
$title = __( 'Visit Site', 'amazon-web-services' );
|
486 |
-
$class = '';
|
487 |
-
if ( isset( $addon['free'] ) && $addon['free'] ) {
|
488 |
-
$title = _x( 'View Details', 'View plugin details', 'amazon-web-services' );
|
489 |
-
$url = self_admin_url( 'plugin-install.php?tab=plugin-information&plugin=' . $slug . '&TB_iframe=true&width=600&height=800' );
|
490 |
-
$class = 'thickbox';
|
491 |
-
}
|
492 |
-
|
493 |
-
echo '<li class="visit-site"><a class="' . $class . '" href="' . esc_url( $url ) . '">' . esc_html( $title ) . '</a></li>';
|
494 |
-
}
|
495 |
-
|
496 |
/**
|
497 |
* Check if plugin is activated
|
498 |
*
|
1 |
<?php
|
2 |
+
|
3 |
use Aws\Common\Aws;
|
4 |
|
5 |
class Amazon_Web_Services extends AWS_Plugin_Base {
|
53 |
$this->plugin_menu_title = __( 'AWS', 'amazon-web-services' );
|
54 |
|
55 |
add_filter( 'plugin_action_links', array( $this, 'plugin_actions_settings_link' ), 10, 2 );
|
56 |
+
add_filter( 'network_admin_plugin_action_links', array( $this, 'plugin_actions_settings_link' ), 10, 2 );
|
57 |
|
58 |
load_plugin_textdomain( 'amazon-web-services', false, dirname( plugin_basename( $plugin_file_path ) ) . '/languages/' );
|
59 |
}
|
68 |
$icon_url = false;
|
69 |
}
|
70 |
|
71 |
+
$hook_suffixes = array();
|
72 |
$hook_suffixes[] = add_menu_page( $this->plugin_title, $this->plugin_menu_title, $this->plugin_permission, $this->plugin_slug, array(
|
73 |
+
$this,
|
74 |
+
'render_page',
|
75 |
+
), $icon_url );
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
|
77 |
global $submenu;
|
78 |
if ( isset( $submenu[ $this->plugin_slug ][0][0] ) ) {
|
119 |
$this->enqueue_style( 'aws-styles', 'assets/css/styles' );
|
120 |
$this->enqueue_script( 'aws-script', 'assets/js/script', array( 'jquery' ) );
|
121 |
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
$this->handle_post_request();
|
123 |
|
124 |
do_action( 'aws_plugin_load', $this );
|
182 |
wp_die( 'What the heck are we doin here?' );
|
183 |
}
|
184 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
185 |
$this->render_view( 'header', array( 'page' => $view, 'page_title' => $page_title ) );
|
186 |
$this->render_view( $view );
|
187 |
$this->render_view( 'footer' );
|
349 |
return __( 'Access Keys', 'amazon-web-services' );
|
350 |
}
|
351 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
352 |
/**
|
353 |
* Check if plugin is activated
|
354 |
*
|
composer.json
CHANGED
@@ -2,10 +2,10 @@
|
|
2 |
"name": "deliciousbrains/wp-amazon-web-services",
|
3 |
"type": "wordpress-plugin",
|
4 |
"homepage": "https://github.com/deliciousbrains/wp-amazon-web-services",
|
5 |
-
"license": "
|
6 |
"description": "Houses the Amazon Web Services (AWS) PHP libraries and manages access keys. Required by other AWS plugins.",
|
7 |
"keywords": ["plugin","amazon-web-services","aws","amazon"],
|
8 |
"require": {
|
9 |
-
"composer/installers": "
|
10 |
}
|
11 |
}
|
2 |
"name": "deliciousbrains/wp-amazon-web-services",
|
3 |
"type": "wordpress-plugin",
|
4 |
"homepage": "https://github.com/deliciousbrains/wp-amazon-web-services",
|
5 |
+
"license": "GPL-3.0-only",
|
6 |
"description": "Houses the Amazon Web Services (AWS) PHP libraries and manages access keys. Required by other AWS plugins.",
|
7 |
"keywords": ["plugin","amazon-web-services","aws","amazon"],
|
8 |
"require": {
|
9 |
+
"composer/installers": "^1.0"
|
10 |
}
|
11 |
}
|
languages/amazon-web-services-en.pot
CHANGED
@@ -8,7 +8,7 @@ msgid ""
|
|
8 |
msgstr ""
|
9 |
"Project-Id-Version: amazon-web-services\n"
|
10 |
"Report-Msgid-Bugs-To: nom@deliciousbrains.com\n"
|
11 |
-
"POT-Creation-Date:
|
12 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
13 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
14 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
@@ -17,84 +17,31 @@ msgstr ""
|
|
17 |
"Content-Type: text/plain; charset=CHARSET\n"
|
18 |
"Content-Transfer-Encoding: 8bit\n"
|
19 |
|
20 |
-
#: classes/amazon-web-services.php:
|
21 |
-
#: classes/amazon-web-services.php:
|
22 |
msgid "Amazon Web Services"
|
23 |
msgstr ""
|
24 |
|
25 |
-
#: classes/amazon-web-services.php:
|
26 |
msgid "AWS"
|
27 |
msgstr ""
|
28 |
|
29 |
-
#: classes/amazon-web-services.php:
|
30 |
-
|
31 |
-
msgstr ""
|
32 |
-
|
33 |
-
#: classes/amazon-web-services.php:83
|
34 |
-
#: classes/amazon-web-services.php:369
|
35 |
#: view/settings.php:16
|
36 |
msgid "Access Keys"
|
37 |
msgstr ""
|
38 |
|
39 |
-
#: classes/amazon-web-services.php:
|
40 |
msgid "Cheatin' eh?"
|
41 |
msgstr ""
|
42 |
|
43 |
-
#: classes/amazon-web-services.php:
|
44 |
-
msgid "Amazon Web Services: Addons"
|
45 |
-
msgstr ""
|
46 |
-
|
47 |
-
#: classes/amazon-web-services.php:318
|
48 |
#, php-format
|
49 |
msgid ""
|
50 |
"You must first <a href=\"%s\">set your AWS access keys</a> to use this addon."
|
51 |
msgstr ""
|
52 |
|
53 |
-
#: classes/amazon-web-services.php:382
|
54 |
-
msgid "WP Offload S3 Lite"
|
55 |
-
msgstr ""
|
56 |
-
|
57 |
-
#: classes/amazon-web-services.php:387
|
58 |
-
msgid "WP Offload S3"
|
59 |
-
msgstr ""
|
60 |
-
|
61 |
-
#: classes/amazon-web-services.php:393
|
62 |
-
msgid "Assets Pull"
|
63 |
-
msgstr ""
|
64 |
-
|
65 |
-
#: classes/amazon-web-services.php:397
|
66 |
-
msgid "Feature"
|
67 |
-
msgstr ""
|
68 |
-
|
69 |
-
#: classes/amazon-web-services.php:443
|
70 |
-
msgctxt "Plugin already installed and activated"
|
71 |
-
msgid "Installed & Activated"
|
72 |
-
msgstr ""
|
73 |
-
|
74 |
-
#: classes/amazon-web-services.php:445
|
75 |
-
msgctxt "Plugin already installed"
|
76 |
-
msgid "Installed"
|
77 |
-
msgstr ""
|
78 |
-
|
79 |
-
#: classes/amazon-web-services.php:446
|
80 |
-
msgctxt "Activate plugin now"
|
81 |
-
msgid "Activate Now"
|
82 |
-
msgstr ""
|
83 |
-
|
84 |
-
#: classes/amazon-web-services.php:449
|
85 |
-
msgctxt "Install plugin now"
|
86 |
-
msgid "Install Now"
|
87 |
-
msgstr ""
|
88 |
-
|
89 |
-
#: classes/amazon-web-services.php:485
|
90 |
-
msgid "Visit Site"
|
91 |
-
msgstr ""
|
92 |
-
|
93 |
-
#: classes/amazon-web-services.php:488
|
94 |
-
msgctxt "View plugin details"
|
95 |
-
msgid "View Details"
|
96 |
-
msgstr ""
|
97 |
-
|
98 |
#: classes/aws-compatibility-check.php:25
|
99 |
msgid "a PHP version less than 5.3.3"
|
100 |
msgstr ""
|
@@ -252,18 +199,18 @@ msgid ""
|
|
252 |
"\"\">click here to reveal a form.</a>"
|
253 |
msgstr ""
|
254 |
|
255 |
-
#: view/settings.php:
|
256 |
msgid "Access Key ID:"
|
257 |
msgstr ""
|
258 |
|
259 |
-
#: view/settings.php:
|
260 |
msgid "Secret Access Key:"
|
261 |
msgstr ""
|
262 |
|
263 |
-
#: view/settings.php:
|
264 |
msgid "Save Changes"
|
265 |
msgstr ""
|
266 |
|
267 |
-
#: view/settings.php:
|
268 |
msgid "Remove Keys"
|
269 |
msgstr ""
|
8 |
msgstr ""
|
9 |
"Project-Id-Version: amazon-web-services\n"
|
10 |
"Report-Msgid-Bugs-To: nom@deliciousbrains.com\n"
|
11 |
+
"POT-Creation-Date: 2018-02-20 16:17+0000\n"
|
12 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
13 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
14 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
17 |
"Content-Type: text/plain; charset=CHARSET\n"
|
18 |
"Content-Transfer-Encoding: 8bit\n"
|
19 |
|
20 |
+
#: classes/amazon-web-services.php:52
|
21 |
+
#: classes/amazon-web-services.php:178
|
22 |
msgid "Amazon Web Services"
|
23 |
msgstr ""
|
24 |
|
25 |
+
#: classes/amazon-web-services.php:53
|
26 |
msgid "AWS"
|
27 |
msgstr ""
|
28 |
|
29 |
+
#: classes/amazon-web-services.php:79
|
30 |
+
#: classes/amazon-web-services.php:349
|
|
|
|
|
|
|
|
|
31 |
#: view/settings.php:16
|
32 |
msgid "Access Keys"
|
33 |
msgstr ""
|
34 |
|
35 |
+
#: classes/amazon-web-services.php:136
|
36 |
msgid "Cheatin' eh?"
|
37 |
msgstr ""
|
38 |
|
39 |
+
#: classes/amazon-web-services.php:298
|
|
|
|
|
|
|
|
|
40 |
#, php-format
|
41 |
msgid ""
|
42 |
"You must first <a href=\"%s\">set your AWS access keys</a> to use this addon."
|
43 |
msgstr ""
|
44 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
#: classes/aws-compatibility-check.php:25
|
46 |
msgid "a PHP version less than 5.3.3"
|
47 |
msgstr ""
|
199 |
"\"\">click here to reveal a form.</a>"
|
200 |
msgstr ""
|
201 |
|
202 |
+
#: view/settings.php:76
|
203 |
msgid "Access Key ID:"
|
204 |
msgstr ""
|
205 |
|
206 |
+
#: view/settings.php:82
|
207 |
msgid "Secret Access Key:"
|
208 |
msgstr ""
|
209 |
|
210 |
+
#: view/settings.php:89
|
211 |
msgid "Save Changes"
|
212 |
msgstr ""
|
213 |
|
214 |
+
#: view/settings.php:92
|
215 |
msgid "Remove Keys"
|
216 |
msgstr ""
|
readme.txt
CHANGED
@@ -3,17 +3,18 @@ Contributors: bradt, deliciousbrains
|
|
3 |
Tags: amazon, amazon web services
|
4 |
Requires at least: 4.6
|
5 |
Tested up to: 4.9
|
6 |
-
Stable tag: 1.0.
|
7 |
License: GPLv3
|
8 |
|
9 |
-
Houses the Amazon Web Services (AWS) PHP libraries and manages access keys.
|
10 |
|
11 |
== Description ==
|
12 |
|
13 |
-
This plugin
|
14 |
|
15 |
-
|
16 |
-
|
|
|
17 |
|
18 |
= Requirements =
|
19 |
|
@@ -33,6 +34,12 @@ This plugin is required by other plugins, which use its libraries and its settin
|
|
33 |
|
34 |
== Changelog ==
|
35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
= 1.0.4 - 2017-11-20 =
|
37 |
* Improvement: Compatibility with WordPress 4.9
|
38 |
* Improvement: Compatibility with WP Offload S3 1.5.1
|
3 |
Tags: amazon, amazon web services
|
4 |
Requires at least: 4.6
|
5 |
Tested up to: 4.9
|
6 |
+
Stable tag: 1.0.5
|
7 |
License: GPLv3
|
8 |
|
9 |
+
Houses the Amazon Web Services (AWS) PHP SDK v2 libraries and manages access keys.
|
10 |
|
11 |
== Description ==
|
12 |
|
13 |
+
This plugin allows the user to define AWS access keys and allows other plugins to hook into it and use the AWS SDK that's included.
|
14 |
|
15 |
+
The plan was for this plugin to be a dependency of several plugins and all could use the same AWS SDK. We realized however that there are [problems with this idea](https://deliciousbrains.com/wp-offload-s3-1-6-released/?utm_campaign=WP%2BOffload%2BS3&utm_source=wordpress.org&utm_medium=free%2Bplugin%2Blisting&utm_content=AWS) and we've taken [another approach](https://deliciousbrains.com/wp-offload-s3-1-6-released/?utm_campaign=WP%2BOffload%2BS3&utm_source=wordpress.org&utm_medium=free%2Bplugin%2Blisting&utm_content=AWS).
|
16 |
+
|
17 |
+
This plugin was used by our plugins ([WP Offload S3](https://deliciousbrains.com/wp-offload-s3/?utm_campaign=WP%2BOffload%2BS3&utm_source=wordpress.org&utm_medium=free%2Bplugin%2Blisting&utm_content=AWS) and [WP Offload S3 Lite](http://wordpress.org/plugins/amazon-s3-and-cloudfront/)) but it is almost certainly used by other plugins we're not aware of. So although it is no longer needed for our plugins, we'll leave it here for others.
|
18 |
|
19 |
= Requirements =
|
20 |
|
34 |
|
35 |
== Changelog ==
|
36 |
|
37 |
+
= 1.0.5 - 2018-02-20 =
|
38 |
+
* Change: Plugins page removed as this plugin is no longer required by [WP Offload S3](https://deliciousbrains.com/wp-offload-s3/?utm_campaign=WP%2BOffload%2BS3&utm_source=wordpress.org&utm_medium=free%2Bplugin%2Blisting&utm_content=AWS) or [WP Offload S3 Lite](http://wordpress.org/plugins/amazon-s3-and-cloudfront/)
|
39 |
+
* Bug fix: Update checking broken for version 1.5 or less of WP Offload S3
|
40 |
+
* Bug fix: `WP_Offload_S3_Autoloader` class included in plugin
|
41 |
+
* Bug fix: License in composer.json fails Packagist validation
|
42 |
+
|
43 |
= 1.0.4 - 2017-11-20 =
|
44 |
* Improvement: Compatibility with WordPress 4.9
|
45 |
* Improvement: Compatibility with WP Offload S3 1.5.1
|
view/addon.php
DELETED
@@ -1,26 +0,0 @@
|
|
1 |
-
<li class="addon <?php echo $slug; ?>">
|
2 |
-
<article>
|
3 |
-
<div class="info">
|
4 |
-
<?php if ( isset( $addon['icon'] ) ) : ?>
|
5 |
-
<img src="<?php echo $this->get_addon_icon_url( $slug ); ?>">
|
6 |
-
<?php endif; ?>
|
7 |
-
<h1><?php echo $addon['title']; // xss ok ?></h1>
|
8 |
-
<?php if ( isset( $addon['sub'] ) ) : ?>
|
9 |
-
<h2><?php echo esc_html( $addon['sub'] ); ?></h2>
|
10 |
-
<?php endif; ?>
|
11 |
-
<ul>
|
12 |
-
<?php echo $this->get_addon_details_link( $slug, $addon ); ?>
|
13 |
-
<?php echo $this->get_addon_install_link( $slug, $addon ); ?>
|
14 |
-
</ul>
|
15 |
-
</div>
|
16 |
-
<?php if ( isset( $addon['label'] ) ) : ?>
|
17 |
-
<span class="label"><?php echo esc_html( $addon['label'] ); ?></span>
|
18 |
-
<?php endif; ?>
|
19 |
-
</article>
|
20 |
-
|
21 |
-
<?php if ( isset( $addon['addons'] ) ) : ?>
|
22 |
-
<ul>
|
23 |
-
<?php $this->render_addons( $addon['addons'] ); ?>
|
24 |
-
</ul>
|
25 |
-
<?php endif; ?>
|
26 |
-
</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
view/addons.php
DELETED
@@ -1,5 +0,0 @@
|
|
1 |
-
<div class="aws-content aws-addons">
|
2 |
-
<ul class="addons-list">
|
3 |
-
<?php $this->render_addons(); ?>
|
4 |
-
</ul>
|
5 |
-
</div>
|
|
|
|
|
|
|
|
|
|
view/settings.php
CHANGED
@@ -60,6 +60,8 @@ define( 'DBI_AWS_SECRET_ACCESS_KEY', '****************************************'
|
|
60 |
|
61 |
<form method="post" <?php echo ( ! $this->get_access_key_id() && ! $this->get_secret_access_key() ) ? 'style="display: none;"' : ''; // xss ok ?>>
|
62 |
|
|
|
|
|
63 |
<?php if ( isset( $_POST['access_key_id'] ) ) { // input var okay ?>
|
64 |
<div class="aws-updated updated">
|
65 |
<p><strong>Settings saved.</strong></p>
|
60 |
|
61 |
<form method="post" <?php echo ( ! $this->get_access_key_id() && ! $this->get_secret_access_key() ) ? 'style="display: none;"' : ''; // xss ok ?>>
|
62 |
|
63 |
+
<?php do_action( 'aws_access_key_form_header' ); ?>
|
64 |
+
|
65 |
<?php if ( isset( $_POST['access_key_id'] ) ) { // input var okay ?>
|
66 |
<div class="aws-updated updated">
|
67 |
<p><strong>Settings saved.</strong></p>
|
wp-offload-s3-autoloader.php
DELETED
@@ -1,94 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
// Check if already defined
|
4 |
-
if ( ! class_exists( 'WP_Offload_S3_Autoloader' ) ) {
|
5 |
-
|
6 |
-
class WP_Offload_S3_Autoloader {
|
7 |
-
|
8 |
-
/**
|
9 |
-
* @var string
|
10 |
-
*/
|
11 |
-
protected $abspath;
|
12 |
-
|
13 |
-
/**
|
14 |
-
* @var string
|
15 |
-
*/
|
16 |
-
protected $prefix;
|
17 |
-
|
18 |
-
/**
|
19 |
-
* @var string
|
20 |
-
*/
|
21 |
-
protected $vendor = 'DeliciousBrains';
|
22 |
-
|
23 |
-
/**
|
24 |
-
* Autoloader constructor.
|
25 |
-
*
|
26 |
-
* @param string $prefix
|
27 |
-
* @param string $abspath
|
28 |
-
*/
|
29 |
-
public function __construct( $prefix, $abspath ) {
|
30 |
-
$this->prefix = $prefix;
|
31 |
-
$this->abspath = $abspath;
|
32 |
-
|
33 |
-
spl_autoload_register( array( $this, 'autoloader' ) );
|
34 |
-
}
|
35 |
-
|
36 |
-
/**
|
37 |
-
* Autoloader.
|
38 |
-
*
|
39 |
-
* @param string $class_name
|
40 |
-
*/
|
41 |
-
public function autoloader( $class_name ) {
|
42 |
-
if ( ! $this->class_belongs_to_plugin( $class_name ) ) {
|
43 |
-
return;
|
44 |
-
}
|
45 |
-
|
46 |
-
$path = $this->get_classes_directory() . $this->get_class_path( $class_name );
|
47 |
-
|
48 |
-
if ( file_exists( $path ) ) {
|
49 |
-
require_once $path;
|
50 |
-
}
|
51 |
-
}
|
52 |
-
|
53 |
-
/**
|
54 |
-
* Class belong to plugin.
|
55 |
-
*
|
56 |
-
* @param string $class_name
|
57 |
-
*
|
58 |
-
* @return bool
|
59 |
-
*/
|
60 |
-
protected function class_belongs_to_plugin( $class_name ) {
|
61 |
-
if ( 0 !== strpos( $class_name, $this->vendor . '\\' . $this->prefix . '\\' ) ) {
|
62 |
-
return false;
|
63 |
-
}
|
64 |
-
|
65 |
-
return true;
|
66 |
-
}
|
67 |
-
|
68 |
-
/**
|
69 |
-
* Get class path.
|
70 |
-
*
|
71 |
-
* @param string $class_name
|
72 |
-
*
|
73 |
-
* @return string
|
74 |
-
*/
|
75 |
-
protected function get_class_path( $class_name ) {
|
76 |
-
$parts = explode( '\\', strtolower( $class_name ) );
|
77 |
-
$parts = array_slice( $parts, 2 );
|
78 |
-
|
79 |
-
$filename = implode( DIRECTORY_SEPARATOR, $parts ) . '.php';
|
80 |
-
|
81 |
-
return str_replace( '_', '-', strtolower( $filename ) );
|
82 |
-
}
|
83 |
-
|
84 |
-
/**
|
85 |
-
* Get classes directory.
|
86 |
-
*
|
87 |
-
* @return string
|
88 |
-
*/
|
89 |
-
protected function get_classes_directory() {
|
90 |
-
return $this->abspath . DIRECTORY_SEPARATOR . 'classes' . DIRECTORY_SEPARATOR;
|
91 |
-
}
|
92 |
-
|
93 |
-
}
|
94 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|