Version Description
Download this release
Release Info
Developer | businessdirectoryplugin |
Plugin | Business Directory Plugin |
Version | 3.6.2.2 |
Comparing to | |
See all releases |
Code changes from version 3.6.2.1 to 3.6.2.2
- README.TXT +3 -3
- business-directory-plugin.php +2 -2
- vendors/edd/EDD_SL_Plugin_Updater.php +326 -158
README.TXT
CHANGED
@@ -5,7 +5,7 @@ Tags: wordpress directory,wordpress directory plugin, wordpress directory theme,
|
|
5 |
Requires at least: 3.7
|
6 |
Tested up to: 4.1.1
|
7 |
Last Updated: 2015-Apr-9
|
8 |
-
Stable tag: tags/3.6.2.
|
9 |
License: GPLv2 or later
|
10 |
|
11 |
Build local directories, business provider listings, Yellow-Pages directories, Yelp-like review sections and much more!
|
@@ -113,8 +113,8 @@ If you are having problems please visit [support forum](http://www.businessdirec
|
|
113 |
|
114 |
== Changelog ==
|
115 |
|
116 |
-
= Version 3.6.2.
|
117 |
-
* Added EDD updater class change to bring class up 1.6
|
118 |
|
119 |
= Version 3.6.2 =
|
120 |
* Fixed WP thumbnail issue where "close enough" sizes were not exactly sized to requested size (thumbnail issue)
|
5 |
Requires at least: 3.7
|
6 |
Tested up to: 4.1.1
|
7 |
Last Updated: 2015-Apr-9
|
8 |
+
Stable tag: tags/3.6.2.2
|
9 |
License: GPLv2 or later
|
10 |
|
11 |
Build local directories, business provider listings, Yellow-Pages directories, Yelp-like review sections and much more!
|
113 |
|
114 |
== Changelog ==
|
115 |
|
116 |
+
= Version 3.6.2.2 =
|
117 |
+
* Added EDD updater class change to bring class up to 1.6
|
118 |
|
119 |
= Version 3.6.2 =
|
120 |
* Fixed WP thumbnail issue where "close enough" sizes were not exactly sized to requested size (thumbnail issue)
|
business-directory-plugin.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: Business Directory Plugin
|
4 |
* Plugin URI: http://www.businessdirectoryplugin.com
|
5 |
* Description: Provides the ability to maintain a free or paid business directory on your WordPress powered site.
|
6 |
-
* Version: 3.6.2.
|
7 |
* Author: D. Rodenbaugh
|
8 |
* Author URI: http://businessdirectoryplugin.com
|
9 |
* License: GPLv2 or any later version
|
@@ -30,7 +30,7 @@
|
|
30 |
if( preg_match( '#' . basename( __FILE__ ) . '#', $_SERVER['PHP_SELF'] ) )
|
31 |
exit();
|
32 |
|
33 |
-
define( 'WPBDP_VERSION', '3.6.2.
|
34 |
|
35 |
define( 'WPBDP_PATH', plugin_dir_path( __FILE__ ) );
|
36 |
define( 'WPBDP_URL', trailingslashit( plugins_url( '/', __FILE__ ) ) );
|
3 |
* Plugin Name: Business Directory Plugin
|
4 |
* Plugin URI: http://www.businessdirectoryplugin.com
|
5 |
* Description: Provides the ability to maintain a free or paid business directory on your WordPress powered site.
|
6 |
+
* Version: 3.6.2.2
|
7 |
* Author: D. Rodenbaugh
|
8 |
* Author URI: http://businessdirectoryplugin.com
|
9 |
* License: GPLv2 or any later version
|
30 |
if( preg_match( '#' . basename( __FILE__ ) . '#', $_SERVER['PHP_SELF'] ) )
|
31 |
exit();
|
32 |
|
33 |
+
define( 'WPBDP_VERSION', '3.6.2.2' );
|
34 |
|
35 |
define( 'WPBDP_PATH', plugin_dir_path( __FILE__ ) );
|
36 |
define( 'WPBDP_URL', trailingslashit( plugins_url( '/', __FILE__ ) ) );
|
vendors/edd/EDD_SL_Plugin_Updater.php
CHANGED
@@ -3,168 +3,336 @@
|
|
3 |
// uncomment this line for testing
|
4 |
//set_site_transient( 'update_plugins', null );
|
5 |
|
|
|
|
|
|
|
6 |
/**
|
7 |
* Allows plugins to use their own update API.
|
8 |
*
|
9 |
* @author Pippin Williamson
|
10 |
-
* @version 1.
|
11 |
*/
|
12 |
class EDD_SL_Plugin_Updater {
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
170 |
}
|
3 |
// uncomment this line for testing
|
4 |
//set_site_transient( 'update_plugins', null );
|
5 |
|
6 |
+
// Exit if accessed directly
|
7 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
8 |
+
|
9 |
/**
|
10 |
* Allows plugins to use their own update API.
|
11 |
*
|
12 |
* @author Pippin Williamson
|
13 |
+
* @version 1.6
|
14 |
*/
|
15 |
class EDD_SL_Plugin_Updater {
|
16 |
+
private $api_url = '';
|
17 |
+
private $api_data = array();
|
18 |
+
private $name = '';
|
19 |
+
private $slug = '';
|
20 |
+
private $version = '';
|
21 |
+
|
22 |
+
/**
|
23 |
+
* Class constructor.
|
24 |
+
*
|
25 |
+
* @uses plugin_basename()
|
26 |
+
* @uses hook()
|
27 |
+
*
|
28 |
+
* @param string $_api_url The URL pointing to the custom API endpoint.
|
29 |
+
* @param string $_plugin_file Path to the plugin file.
|
30 |
+
* @param array $_api_data Optional data to send with API calls.
|
31 |
+
*/
|
32 |
+
function __construct( $_api_url, $_plugin_file, $_api_data = null ) {
|
33 |
+
$this->api_url = trailingslashit( $_api_url );
|
34 |
+
$this->api_data = $_api_data;
|
35 |
+
$this->name = plugin_basename( $_plugin_file );
|
36 |
+
$this->slug = basename( $_plugin_file, '.php' );
|
37 |
+
$this->version = $_api_data['version'];
|
38 |
+
|
39 |
+
// Set up hooks.
|
40 |
+
$this->init();
|
41 |
+
add_action( 'admin_init', array( $this, 'show_changelog' ) );
|
42 |
+
}
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Set up WordPress filters to hook into WP's update process.
|
46 |
+
*
|
47 |
+
* @uses add_filter()
|
48 |
+
*
|
49 |
+
* @return void
|
50 |
+
*/
|
51 |
+
public function init() {
|
52 |
+
|
53 |
+
add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
|
54 |
+
add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 );
|
55 |
+
|
56 |
+
add_action( 'after_plugin_row_' . $this->name, array( $this, 'show_update_notification' ), 10, 2 );
|
57 |
+
}
|
58 |
+
|
59 |
+
/**
|
60 |
+
* Check for Updates at the defined API endpoint and modify the update array.
|
61 |
+
*
|
62 |
+
* This function dives into the update API just when WordPress creates its update array,
|
63 |
+
* then adds a custom API call and injects the custom plugin data retrieved from the API.
|
64 |
+
* It is reassembled from parts of the native WordPress plugin update code.
|
65 |
+
* See wp-includes/update.php line 121 for the original wp_update_plugins() function.
|
66 |
+
*
|
67 |
+
* @uses api_request()
|
68 |
+
*
|
69 |
+
* @param array $_transient_data Update array build by WordPress.
|
70 |
+
* @return array Modified update array with custom plugin data.
|
71 |
+
*/
|
72 |
+
function check_update( $_transient_data ) {
|
73 |
+
|
74 |
+
global $pagenow;
|
75 |
+
|
76 |
+
if( ! is_object( $_transient_data ) ) {
|
77 |
+
$_transient_data = new stdClass;
|
78 |
+
}
|
79 |
+
|
80 |
+
if( 'plugins.php' == $pagenow && is_multisite() ) {
|
81 |
+
return $_transient_data;
|
82 |
+
}
|
83 |
+
|
84 |
+
if ( empty( $_transient_data->response ) || empty( $_transient_data->response[ $this->name ] ) ) {
|
85 |
+
|
86 |
+
$version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) );
|
87 |
+
|
88 |
+
if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) {
|
89 |
+
|
90 |
+
if( version_compare( $this->version, $version_info->new_version, '<' ) ) {
|
91 |
+
|
92 |
+
$_transient_data->response[ $this->name ] = $version_info;
|
93 |
+
|
94 |
+
}
|
95 |
+
|
96 |
+
$_transient_data->last_checked = time();
|
97 |
+
$_transient_data->checked[ $this->name ] = $this->version;
|
98 |
+
|
99 |
+
}
|
100 |
+
|
101 |
+
}
|
102 |
+
|
103 |
+
return $_transient_data;
|
104 |
+
}
|
105 |
+
|
106 |
+
/**
|
107 |
+
* show update nofication row -- needed for multisite subsites, because WP won't tell you otherwise!
|
108 |
+
*
|
109 |
+
* @param string $file
|
110 |
+
* @param array $plugin
|
111 |
+
*/
|
112 |
+
public function show_update_notification( $file, $plugin ) {
|
113 |
+
|
114 |
+
if( ! current_user_can( 'update_plugins' ) ) {
|
115 |
+
return;
|
116 |
+
}
|
117 |
+
|
118 |
+
if( ! is_multisite() ) {
|
119 |
+
return;
|
120 |
+
}
|
121 |
+
|
122 |
+
if ( $this->name != $file ) {
|
123 |
+
return;
|
124 |
+
}
|
125 |
+
|
126 |
+
// Remove our filter on the site transient
|
127 |
+
remove_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ), 10 );
|
128 |
+
|
129 |
+
$update_cache = get_site_transient( 'update_plugins' );
|
130 |
+
|
131 |
+
if ( ! is_object( $update_cache ) || empty( $update_cache->response ) || empty( $update_cache->response[ $this->name ] ) ) {
|
132 |
+
|
133 |
+
$cache_key = md5( 'edd_plugin_' .sanitize_key( $this->name ) . '_version_info' );
|
134 |
+
$version_info = get_transient( $cache_key );
|
135 |
+
|
136 |
+
if( false === $version_info ) {
|
137 |
+
|
138 |
+
$version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) );
|
139 |
+
|
140 |
+
set_transient( $cache_key, $version_info, 3600 );
|
141 |
+
}
|
142 |
+
|
143 |
+
|
144 |
+
if( ! is_object( $version_info ) ) {
|
145 |
+
return;
|
146 |
+
}
|
147 |
+
|
148 |
+
if( version_compare( $this->version, $version_info->new_version, '<' ) ) {
|
149 |
+
|
150 |
+
$update_cache->response[ $this->name ] = $version_info;
|
151 |
+
|
152 |
+
}
|
153 |
+
|
154 |
+
$update_cache->last_checked = time();
|
155 |
+
$update_cache->checked[ $this->name ] = $this->version;
|
156 |
+
|
157 |
+
set_site_transient( 'update_plugins', $update_cache );
|
158 |
+
|
159 |
+
} else {
|
160 |
+
|
161 |
+
$version_info = $update_cache->response[ $this->name ];
|
162 |
+
|
163 |
+
}
|
164 |
+
|
165 |
+
// Restore our filter
|
166 |
+
add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
|
167 |
+
|
168 |
+
if ( ! empty( $update_cache->response[ $this->name ] ) && version_compare( $this->version, $version_info->new_version, '<' ) ) {
|
169 |
+
|
170 |
+
// build a plugin list row, with update notification
|
171 |
+
$wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );
|
172 |
+
echo '<tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange"><div class="update-message">';
|
173 |
+
|
174 |
+
$changelog_link = self_admin_url( 'index.php?edd_sl_action=view_plugin_changelog&plugin=' . $this->name . '&slug=' . $this->slug . '&TB_iframe=true&width=772&height=911' );
|
175 |
+
|
176 |
+
if ( empty( $version_info->download_link ) ) {
|
177 |
+
printf(
|
178 |
+
__( 'There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a>.', 'edd' ),
|
179 |
+
esc_html( $version_info->name ),
|
180 |
+
esc_url( $changelog_link ),
|
181 |
+
esc_html( $version_info->new_version )
|
182 |
+
);
|
183 |
+
} else {
|
184 |
+
printf(
|
185 |
+
__( 'There is a new version of %1$s available. <a target="_blank" class="thickbox" href="%2$s">View version %3$s details</a> or <a href="%4$s">update now</a>.', 'edd' ),
|
186 |
+
esc_html( $version_info->name ),
|
187 |
+
esc_url( $changelog_link ),
|
188 |
+
esc_html( $version_info->new_version ),
|
189 |
+
esc_url( wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $this->name, 'upgrade-plugin_' . $this->name ) )
|
190 |
+
);
|
191 |
+
}
|
192 |
+
|
193 |
+
echo '</div></td></tr>';
|
194 |
+
}
|
195 |
+
}
|
196 |
+
|
197 |
+
|
198 |
+
/**
|
199 |
+
* Updates information on the "View version x.x details" page with custom data.
|
200 |
+
*
|
201 |
+
* @uses api_request()
|
202 |
+
*
|
203 |
+
* @param mixed $_data
|
204 |
+
* @param string $_action
|
205 |
+
* @param object $_args
|
206 |
+
* @return object $_data
|
207 |
+
*/
|
208 |
+
function plugins_api_filter( $_data, $_action = '', $_args = null ) {
|
209 |
+
|
210 |
+
|
211 |
+
if ( $_action != 'plugin_information' ) {
|
212 |
+
|
213 |
+
return $_data;
|
214 |
+
|
215 |
+
}
|
216 |
+
|
217 |
+
if ( ! isset( $_args->slug ) || ( $_args->slug != $this->slug ) ) {
|
218 |
+
|
219 |
+
return $_data;
|
220 |
+
|
221 |
+
}
|
222 |
+
|
223 |
+
$to_send = array(
|
224 |
+
'slug' => $this->slug,
|
225 |
+
'is_ssl' => is_ssl(),
|
226 |
+
'fields' => array(
|
227 |
+
'banners' => false, // These will be supported soon hopefully
|
228 |
+
'reviews' => false
|
229 |
+
)
|
230 |
+
);
|
231 |
+
|
232 |
+
$api_response = $this->api_request( 'plugin_information', $to_send );
|
233 |
+
|
234 |
+
if ( false !== $api_response ) {
|
235 |
+
$_data = $api_response;
|
236 |
+
}
|
237 |
+
|
238 |
+
return $_data;
|
239 |
+
}
|
240 |
+
|
241 |
+
|
242 |
+
/**
|
243 |
+
* Disable SSL verification in order to prevent download update failures
|
244 |
+
*
|
245 |
+
* @param array $args
|
246 |
+
* @param string $url
|
247 |
+
* @return object $array
|
248 |
+
*/
|
249 |
+
function http_request_args( $args, $url ) {
|
250 |
+
// If it is an https request and we are performing a package download, disable ssl verification
|
251 |
+
if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) {
|
252 |
+
$args['sslverify'] = false;
|
253 |
+
}
|
254 |
+
return $args;
|
255 |
+
}
|
256 |
+
|
257 |
+
/**
|
258 |
+
* Calls the API and, if successfull, returns the object delivered by the API.
|
259 |
+
*
|
260 |
+
* @uses get_bloginfo()
|
261 |
+
* @uses wp_remote_post()
|
262 |
+
* @uses is_wp_error()
|
263 |
+
*
|
264 |
+
* @param string $_action The requested action.
|
265 |
+
* @param array $_data Parameters for the API action.
|
266 |
+
* @return false|object
|
267 |
+
*/
|
268 |
+
private function api_request( $_action, $_data ) {
|
269 |
+
|
270 |
+
global $wp_version;
|
271 |
+
|
272 |
+
$data = array_merge( $this->api_data, $_data );
|
273 |
+
|
274 |
+
if ( $data['slug'] != $this->slug )
|
275 |
+
return;
|
276 |
+
|
277 |
+
if ( empty( $data['license'] ) )
|
278 |
+
return;
|
279 |
+
|
280 |
+
if( $this->api_url == home_url() ) {
|
281 |
+
return false; // Don't allow a plugin to ping itself
|
282 |
+
}
|
283 |
+
|
284 |
+
$api_params = array(
|
285 |
+
'edd_action' => 'get_version',
|
286 |
+
'license' => $data['license'],
|
287 |
+
'item_name' => isset( $data['item_name'] ) ? $data['item_name'] : false,
|
288 |
+
'item_id' => isset( $data['item_id'] ) ? $data['item_id'] : false,
|
289 |
+
'slug' => $data['slug'],
|
290 |
+
'author' => $data['author'],
|
291 |
+
'url' => home_url()
|
292 |
+
);
|
293 |
+
|
294 |
+
$request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) );
|
295 |
+
|
296 |
+
if ( ! is_wp_error( $request ) ) {
|
297 |
+
$request = json_decode( wp_remote_retrieve_body( $request ) );
|
298 |
+
}
|
299 |
+
|
300 |
+
if ( $request && isset( $request->sections ) ) {
|
301 |
+
$request->sections = maybe_unserialize( $request->sections );
|
302 |
+
} else {
|
303 |
+
$request = false;
|
304 |
+
}
|
305 |
+
|
306 |
+
return $request;
|
307 |
+
}
|
308 |
+
|
309 |
+
public function show_changelog() {
|
310 |
+
|
311 |
+
|
312 |
+
if( empty( $_REQUEST['edd_sl_action'] ) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action'] ) {
|
313 |
+
return;
|
314 |
+
}
|
315 |
+
|
316 |
+
if( empty( $_REQUEST['plugin'] ) ) {
|
317 |
+
return;
|
318 |
+
}
|
319 |
+
|
320 |
+
if( empty( $_REQUEST['slug'] ) ) {
|
321 |
+
return;
|
322 |
+
}
|
323 |
+
|
324 |
+
if( ! current_user_can( 'update_plugins' ) ) {
|
325 |
+
wp_die( __( 'You do not have permission to install plugin updates', 'edd' ), __( 'Error', 'edd' ), array( 'response' => 403 ) );
|
326 |
+
}
|
327 |
+
|
328 |
+
$response = $this->api_request( 'plugin_latest_version', array( 'slug' => $_REQUEST['slug'] ) );
|
329 |
+
|
330 |
+
if( $response && isset( $response->sections['changelog'] ) ) {
|
331 |
+
echo '<div style="background:#fff;padding:10px;">' . $response->sections['changelog'] . '</div>';
|
332 |
+
}
|
333 |
+
|
334 |
+
|
335 |
+
exit;
|
336 |
+
}
|
337 |
+
|
338 |
}
|