Version Description
Download this release
Release Info
| Developer | madalin.ungureanu |
| Plugin | |
| Version | 1.4.7 |
| Comparing to | |
| See all releases | |
Code changes from version 1.4.6 to 1.4.7
- class-translate-press.php +1 -1
- includes/class-edd-sl-plugin-updater.php +416 -403
- index.php +1 -1
- languages/translatepress-multilingual.catalog.php +3 -0
- languages/translatepress-multilingual.pot +33 -21
- readme.txt +5 -2
class-translate-press.php
CHANGED
|
@@ -44,7 +44,7 @@ class TRP_Translate_Press{
|
|
| 44 |
define( 'TRP_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|
| 45 |
define( 'TRP_PLUGIN_BASE', plugin_basename( __DIR__ . '/index.php' ) );
|
| 46 |
define( 'TRP_PLUGIN_SLUG', 'translatepress-multilingual' );
|
| 47 |
-
define( 'TRP_PLUGIN_VERSION', '1.4.
|
| 48 |
|
| 49 |
wp_cache_add_non_persistent_groups(array('trp'));
|
| 50 |
|
| 44 |
define( 'TRP_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|
| 45 |
define( 'TRP_PLUGIN_BASE', plugin_basename( __DIR__ . '/index.php' ) );
|
| 46 |
define( 'TRP_PLUGIN_SLUG', 'translatepress-multilingual' );
|
| 47 |
+
define( 'TRP_PLUGIN_VERSION', '1.4.7' );
|
| 48 |
|
| 49 |
wp_cache_add_non_persistent_groups(array('trp'));
|
| 50 |
|
includes/class-edd-sl-plugin-updater.php
CHANGED
|
@@ -9,487 +9,500 @@ if ( ! defined( 'ABSPATH' ) ) exit;
|
|
| 9 |
* @author Easy Digital Downloads
|
| 10 |
* @version 1.6.13
|
| 11 |
*/
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
private $api_data = array();
|
| 16 |
-
private $name = '';
|
| 17 |
-
private $slug = '';
|
| 18 |
-
private $version = '';
|
| 19 |
-
private $wp_override = false;
|
| 20 |
-
private $cache_key = '';
|
| 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 |
-
public function __construct( $_api_url, $_plugin_file, $_api_data = null ) {
|
| 33 |
-
|
| 34 |
-
global $edd_plugin_data;
|
| 35 |
-
|
| 36 |
-
$this->api_url = trailingslashit( $_api_url );
|
| 37 |
-
$this->api_data = $_api_data;
|
| 38 |
-
$this->name = plugin_basename( $_plugin_file );
|
| 39 |
-
$this->slug = basename( $_plugin_file, '.php' );
|
| 40 |
-
$this->version = $_api_data['version'];
|
| 41 |
-
$this->wp_override = isset( $_api_data['wp_override'] ) ? (bool) $_api_data['wp_override'] : false;
|
| 42 |
-
$this->beta = ! empty( $this->api_data['beta'] ) ? true : false;
|
| 43 |
-
$this->cache_key = md5( serialize( $this->slug . $this->api_data['license'] . $this->beta ) );
|
| 44 |
-
|
| 45 |
-
$edd_plugin_data[ $this->slug ] = $this->api_data;
|
| 46 |
-
|
| 47 |
-
// Set up hooks.
|
| 48 |
-
$this->init();
|
| 49 |
-
|
| 50 |
-
}
|
| 51 |
-
|
| 52 |
-
/**
|
| 53 |
-
* Set up WordPress filters to hook into WP's update process.
|
| 54 |
-
*
|
| 55 |
-
* @uses add_filter()
|
| 56 |
-
*
|
| 57 |
-
* @return void
|
| 58 |
-
*/
|
| 59 |
-
public function init() {
|
| 60 |
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
|
| 67 |
-
|
| 68 |
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
* @uses api_request()
|
| 78 |
-
*
|
| 79 |
-
* @param array $_transient_data Update array build by WordPress.
|
| 80 |
-
* @return array Modified update array with custom plugin data.
|
| 81 |
-
*/
|
| 82 |
-
public function check_update( $_transient_data ) {
|
| 83 |
|
| 84 |
-
|
| 85 |
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
}
|
| 89 |
|
| 90 |
-
|
| 91 |
-
return $_transient_data;
|
| 92 |
-
}
|
| 93 |
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 97 |
|
| 98 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 99 |
|
| 100 |
-
|
| 101 |
-
$version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug, 'beta' => $this->beta ) );
|
| 102 |
|
| 103 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 104 |
|
| 105 |
-
|
| 106 |
|
| 107 |
-
|
|
|
|
|
|
|
| 108 |
|
| 109 |
-
|
|
|
|
|
|
|
| 110 |
|
| 111 |
-
|
|
|
|
|
|
|
| 112 |
|
| 113 |
-
|
| 114 |
|
| 115 |
-
|
| 116 |
-
|
| 117 |
|
| 118 |
-
|
| 119 |
|
| 120 |
-
|
| 121 |
-
}
|
| 122 |
|
| 123 |
-
|
| 124 |
-
* show update nofication row -- needed for multisite subsites, because WP won't tell you otherwise!
|
| 125 |
-
*
|
| 126 |
-
* @param string $file
|
| 127 |
-
* @param array $plugin
|
| 128 |
-
*/
|
| 129 |
-
public function show_update_notification( $file, $plugin ) {
|
| 130 |
|
| 131 |
-
|
| 132 |
-
return;
|
| 133 |
-
}
|
| 134 |
|
| 135 |
-
|
| 136 |
-
return;
|
| 137 |
-
}
|
| 138 |
|
| 139 |
-
|
| 140 |
-
return;
|
| 141 |
-
}
|
| 142 |
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
}
|
| 146 |
|
| 147 |
-
|
| 148 |
-
remove_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ), 10 );
|
| 149 |
|
| 150 |
-
|
|
|
|
| 151 |
|
| 152 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 153 |
|
| 154 |
-
|
|
|
|
|
|
|
| 155 |
|
| 156 |
-
|
|
|
|
|
|
|
| 157 |
|
| 158 |
-
|
| 159 |
-
|
|
|
|
| 160 |
|
| 161 |
-
|
| 162 |
-
|
|
|
|
| 163 |
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
}
|
| 167 |
|
| 168 |
-
|
| 169 |
|
| 170 |
-
|
| 171 |
|
| 172 |
-
|
| 173 |
|
| 174 |
-
|
| 175 |
-
$update_cache->checked[ $this->name ] = $this->version;
|
| 176 |
|
| 177 |
-
|
|
|
|
| 178 |
|
| 179 |
-
|
|
|
|
| 180 |
|
| 181 |
-
|
|
|
|
|
|
|
| 182 |
|
| 183 |
-
|
| 184 |
|
| 185 |
-
|
| 186 |
-
add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
|
| 187 |
|
| 188 |
-
|
| 189 |
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
# <tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange">
|
| 193 |
-
echo '<tr class="plugin-update-tr" id="' . $this->slug . '-update" data-slug="' . $this->slug . '" data-plugin="' . $this->slug . '/' . $file . '">';
|
| 194 |
-
echo '<td colspan="3" class="plugin-update colspanchange">';
|
| 195 |
-
echo '<div class="update-message notice inline notice-warning notice-alt">';
|
| 196 |
|
| 197 |
-
|
| 198 |
|
| 199 |
-
|
| 200 |
-
printf(
|
| 201 |
-
__( 'There is a new version of %1$s available. %2$sView version %3$s details%4$s.', 'easy-digital-downloads' ),
|
| 202 |
-
esc_html( $version_info->name ),
|
| 203 |
-
'<a target="_blank" class="thickbox" href="' . esc_url( $changelog_link ) . '">',
|
| 204 |
-
esc_html( $version_info->new_version ),
|
| 205 |
-
'</a>'
|
| 206 |
-
);
|
| 207 |
-
} else {
|
| 208 |
-
printf(
|
| 209 |
-
__( 'There is a new version of %1$s available. %2$sView version %3$s details%4$s or %5$supdate now%6$s.', 'easy-digital-downloads' ),
|
| 210 |
-
esc_html( $version_info->name ),
|
| 211 |
-
'<a target="_blank" class="thickbox" href="' . esc_url( $changelog_link ) . '">',
|
| 212 |
-
esc_html( $version_info->new_version ),
|
| 213 |
-
'</a>',
|
| 214 |
-
'<a href="' . esc_url( wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $this->name, 'upgrade-plugin_' . $this->name ) ) .'">',
|
| 215 |
-
'</a>'
|
| 216 |
-
);
|
| 217 |
-
}
|
| 218 |
|
| 219 |
-
|
| 220 |
|
| 221 |
-
|
| 222 |
-
}
|
| 223 |
-
}
|
| 224 |
|
| 225 |
-
|
| 226 |
-
|
| 227 |
-
*
|
| 228 |
-
* @uses api_request()
|
| 229 |
-
*
|
| 230 |
-
* @param mixed $_data
|
| 231 |
-
* @param string $_action
|
| 232 |
-
* @param object $_args
|
| 233 |
-
* @return object $_data
|
| 234 |
-
*/
|
| 235 |
-
public function plugins_api_filter( $_data, $_action = '', $_args = null ) {
|
| 236 |
|
| 237 |
-
|
| 238 |
|
| 239 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 240 |
|
| 241 |
-
|
| 242 |
|
| 243 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 244 |
|
| 245 |
-
|
| 246 |
|
| 247 |
-
|
|
|
|
|
|
|
| 248 |
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
|
| 253 |
-
|
| 254 |
-
|
| 255 |
-
|
| 256 |
-
|
| 257 |
-
|
| 258 |
-
|
| 259 |
-
|
| 260 |
-
|
| 261 |
-
$edd_api_request_transient = $this->get_cached_version_info( $cache_key );
|
| 262 |
-
|
| 263 |
-
//If we have no transient-saved value, run the API, set a fresh transient with the API value, and return that value too right now.
|
| 264 |
-
if ( empty( $edd_api_request_transient ) ) {
|
| 265 |
-
|
| 266 |
-
$api_response = $this->api_request( 'plugin_information', $to_send );
|
| 267 |
-
|
| 268 |
-
// Expires in 3 hours
|
| 269 |
-
$this->set_version_info_cache( $api_response, $cache_key );
|
| 270 |
-
|
| 271 |
-
if ( false !== $api_response ) {
|
| 272 |
-
$_data = $api_response;
|
| 273 |
-
}
|
| 274 |
-
|
| 275 |
-
} else {
|
| 276 |
-
$_data = $edd_api_request_transient;
|
| 277 |
-
}
|
| 278 |
-
|
| 279 |
-
// Convert sections into an associative array, since we're getting an object, but Core expects an array.
|
| 280 |
-
if ( isset( $_data->sections ) && ! is_array( $_data->sections ) ) {
|
| 281 |
-
$new_sections = array();
|
| 282 |
-
foreach ( $_data->sections as $key => $value ) {
|
| 283 |
-
$new_sections[ $key ] = $value;
|
| 284 |
-
}
|
| 285 |
-
|
| 286 |
-
$_data->sections = $new_sections;
|
| 287 |
-
}
|
| 288 |
-
|
| 289 |
-
// Convert banners into an associative array, since we're getting an object, but Core expects an array.
|
| 290 |
-
if ( isset( $_data->banners ) && ! is_array( $_data->banners ) ) {
|
| 291 |
-
$new_banners = array();
|
| 292 |
-
foreach ( $_data->banners as $key => $value ) {
|
| 293 |
-
$new_banners[ $key ] = $value;
|
| 294 |
-
}
|
| 295 |
-
|
| 296 |
-
$_data->banners = $new_banners;
|
| 297 |
-
}
|
| 298 |
-
|
| 299 |
-
return $_data;
|
| 300 |
-
}
|
| 301 |
-
|
| 302 |
-
/**
|
| 303 |
-
* Disable SSL verification in order to prevent download update failures
|
| 304 |
-
*
|
| 305 |
-
* @param array $args
|
| 306 |
-
* @param string $url
|
| 307 |
-
* @return object $array
|
| 308 |
-
*/
|
| 309 |
-
public function http_request_args( $args, $url ) {
|
| 310 |
-
|
| 311 |
-
$verify_ssl = $this->verify_ssl();
|
| 312 |
-
if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) {
|
| 313 |
-
$args['sslverify'] = $verify_ssl;
|
| 314 |
-
}
|
| 315 |
-
return $args;
|
| 316 |
-
|
| 317 |
-
}
|
| 318 |
-
|
| 319 |
-
/**
|
| 320 |
-
* Calls the API and, if successfull, returns the object delivered by the API.
|
| 321 |
-
*
|
| 322 |
-
* @uses get_bloginfo()
|
| 323 |
-
* @uses wp_remote_post()
|
| 324 |
-
* @uses is_wp_error()
|
| 325 |
-
*
|
| 326 |
-
* @param string $_action The requested action.
|
| 327 |
-
* @param array $_data Parameters for the API action.
|
| 328 |
-
* @return false|object
|
| 329 |
-
*/
|
| 330 |
-
private function api_request( $_action, $_data ) {
|
| 331 |
-
|
| 332 |
-
global $wp_version;
|
| 333 |
-
|
| 334 |
-
$data = array_merge( $this->api_data, $_data );
|
| 335 |
-
|
| 336 |
-
if ( $data['slug'] != $this->slug ) {
|
| 337 |
-
return;
|
| 338 |
-
}
|
| 339 |
-
|
| 340 |
-
if( $this->api_url == trailingslashit (home_url() ) ) {
|
| 341 |
-
return false; // Don't allow a plugin to ping itself
|
| 342 |
-
}
|
| 343 |
-
|
| 344 |
-
$api_params = array(
|
| 345 |
-
'edd_action' => 'get_version',
|
| 346 |
-
'license' => ! empty( $data['license'] ) ? $data['license'] : '',
|
| 347 |
-
'item_name' => isset( $data['item_name'] ) ? $data['item_name'] : false,
|
| 348 |
-
'item_id' => isset( $data['item_id'] ) ? $data['item_id'] : false,
|
| 349 |
-
'version' => isset( $data['version'] ) ? $data['version'] : false,
|
| 350 |
-
'slug' => $data['slug'],
|
| 351 |
-
'author' => $data['author'],
|
| 352 |
-
'url' => home_url(),
|
| 353 |
-
'beta' => ! empty( $data['beta'] ),
|
| 354 |
-
);
|
| 355 |
-
|
| 356 |
-
$verify_ssl = $this->verify_ssl();
|
| 357 |
-
$request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => $verify_ssl, 'body' => $api_params ) );
|
| 358 |
-
|
| 359 |
-
if ( ! is_wp_error( $request ) ) {
|
| 360 |
-
$request = json_decode( wp_remote_retrieve_body( $request ) );
|
| 361 |
-
}
|
| 362 |
-
|
| 363 |
-
if ( $request && isset( $request->sections ) ) {
|
| 364 |
-
$request->sections = maybe_unserialize( $request->sections );
|
| 365 |
-
} else {
|
| 366 |
-
$request = false;
|
| 367 |
-
}
|
| 368 |
-
|
| 369 |
-
if ( $request && isset( $request->banners ) ) {
|
| 370 |
-
$request->banners = maybe_unserialize( $request->banners );
|
| 371 |
-
}
|
| 372 |
-
|
| 373 |
-
if( ! empty( $request->sections ) ) {
|
| 374 |
-
foreach( $request->sections as $key => $section ) {
|
| 375 |
-
$request->$key = (array) $section;
|
| 376 |
-
}
|
| 377 |
-
}
|
| 378 |
-
|
| 379 |
-
return $request;
|
| 380 |
-
}
|
| 381 |
-
|
| 382 |
-
public function show_changelog() {
|
| 383 |
-
|
| 384 |
-
global $edd_plugin_data;
|
| 385 |
-
|
| 386 |
-
if( empty( $_REQUEST['edd_sl_action'] ) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action'] ) {
|
| 387 |
-
return;
|
| 388 |
-
}
|
| 389 |
-
|
| 390 |
-
if( empty( $_REQUEST['plugin'] ) ) {
|
| 391 |
-
return;
|
| 392 |
-
}
|
| 393 |
-
|
| 394 |
-
if( empty( $_REQUEST['slug'] ) ) {
|
| 395 |
-
return;
|
| 396 |
-
}
|
| 397 |
-
|
| 398 |
-
if( ! current_user_can( 'update_plugins' ) ) {
|
| 399 |
-
wp_die( __( 'You do not have permission to install plugin updates', 'easy-digital-downloads' ), __( 'Error', 'easy-digital-downloads' ), array( 'response' => 403 ) );
|
| 400 |
-
}
|
| 401 |
-
|
| 402 |
-
$data = $edd_plugin_data[ $_REQUEST['slug'] ];
|
| 403 |
-
$beta = ! empty( $data['beta'] ) ? true : false;
|
| 404 |
-
$cache_key = md5( 'edd_plugin_' . sanitize_key( $_REQUEST['plugin'] ) . '_' . $beta . '_version_info' );
|
| 405 |
-
$version_info = $this->get_cached_version_info( $cache_key );
|
| 406 |
-
|
| 407 |
-
if( false === $version_info ) {
|
| 408 |
|
| 409 |
-
|
| 410 |
-
'edd_action' => 'get_version',
|
| 411 |
-
'item_name' => isset( $data['item_name'] ) ? $data['item_name'] : false,
|
| 412 |
-
'item_id' => isset( $data['item_id'] ) ? $data['item_id'] : false,
|
| 413 |
-
'slug' => $_REQUEST['slug'],
|
| 414 |
-
'author' => $data['author'],
|
| 415 |
-
'url' => home_url(),
|
| 416 |
-
'beta' => ! empty( $data['beta'] )
|
| 417 |
-
);
|
| 418 |
|
| 419 |
-
|
| 420 |
-
$request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => $verify_ssl, 'body' => $api_params ) );
|
| 421 |
|
| 422 |
-
|
| 423 |
-
$version_info = json_decode( wp_remote_retrieve_body( $request ) );
|
| 424 |
-
}
|
| 425 |
|
|
|
|
| 426 |
|
| 427 |
-
|
| 428 |
-
$version_info->sections = maybe_unserialize( $version_info->sections );
|
| 429 |
-
} else {
|
| 430 |
-
$version_info = false;
|
| 431 |
-
}
|
| 432 |
|
| 433 |
-
|
| 434 |
-
foreach( $version_info->sections as $key => $section ) {
|
| 435 |
-
$version_info->$key = (array) $section;
|
| 436 |
-
}
|
| 437 |
-
}
|
| 438 |
|
| 439 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 440 |
|
| 441 |
-
|
| 442 |
|
| 443 |
-
|
| 444 |
-
|
| 445 |
-
}
|
| 446 |
|
| 447 |
-
|
| 448 |
-
|
| 449 |
|
| 450 |
-
|
| 451 |
|
| 452 |
-
|
| 453 |
-
|
| 454 |
-
}
|
| 455 |
|
| 456 |
-
|
|
|
|
|
|
|
| 457 |
|
| 458 |
-
|
| 459 |
-
|
| 460 |
-
|
| 461 |
|
| 462 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 463 |
|
| 464 |
-
|
|
|
|
| 465 |
|
| 466 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 467 |
|
| 468 |
-
|
| 469 |
-
|
| 470 |
-
}
|
| 471 |
|
| 472 |
-
|
| 473 |
-
|
| 474 |
-
'value' => json_encode( $value )
|
| 475 |
-
);
|
| 476 |
|
| 477 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 478 |
|
| 479 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 480 |
|
| 481 |
-
|
| 482 |
-
* Returns if the SSL of the store should be verified.
|
| 483 |
-
*
|
| 484 |
-
* @since 1.6.13
|
| 485 |
-
* @return bool
|
| 486 |
-
*/
|
| 487 |
-
private function verify_ssl() {
|
| 488 |
-
return (bool) apply_filters( 'edd_sl_api_request_verify_ssl', true, $this );
|
| 489 |
-
}
|
| 490 |
|
| 491 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 492 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 493 |
|
| 494 |
if( !class_exists('TRP_LICENSE_PAGE') ) {
|
| 495 |
class TRP_LICENSE_PAGE
|
| 9 |
* @author Easy Digital Downloads
|
| 10 |
* @version 1.6.13
|
| 11 |
*/
|
| 12 |
+
if( !class_exists('TRP_EDD_SL_Plugin_Updater') ) {
|
| 13 |
+
class TRP_EDD_SL_Plugin_Updater
|
| 14 |
+
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
+
private $api_url = '';
|
| 17 |
+
private $api_data = array();
|
| 18 |
+
private $name = '';
|
| 19 |
+
private $slug = '';
|
| 20 |
+
private $version = '';
|
| 21 |
+
private $wp_override = false;
|
| 22 |
+
private $cache_key = '';
|
| 23 |
+
|
| 24 |
+
/**
|
| 25 |
+
* Class constructor.
|
| 26 |
+
*
|
| 27 |
+
* @uses plugin_basename()
|
| 28 |
+
* @uses hook()
|
| 29 |
+
*
|
| 30 |
+
* @param string $_api_url The URL pointing to the custom API endpoint.
|
| 31 |
+
* @param string $_plugin_file Path to the plugin file.
|
| 32 |
+
* @param array $_api_data Optional data to send with API calls.
|
| 33 |
+
*/
|
| 34 |
+
public function __construct($_api_url, $_plugin_file, $_api_data = null)
|
| 35 |
+
{
|
| 36 |
|
| 37 |
+
global $edd_plugin_data;
|
| 38 |
|
| 39 |
+
$this->api_url = trailingslashit($_api_url);
|
| 40 |
+
$this->api_data = $_api_data;
|
| 41 |
+
$this->name = plugin_basename($_plugin_file);
|
| 42 |
+
$this->slug = basename($_plugin_file, '.php');
|
| 43 |
+
$this->version = $_api_data['version'];
|
| 44 |
+
$this->wp_override = isset($_api_data['wp_override']) ? (bool)$_api_data['wp_override'] : false;
|
| 45 |
+
$this->beta = !empty($this->api_data['beta']) ? true : false;
|
| 46 |
+
$this->cache_key = md5(serialize($this->slug . $this->api_data['license'] . $this->beta));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
|
| 48 |
+
$edd_plugin_data[$this->slug] = $this->api_data;
|
| 49 |
|
| 50 |
+
// Set up hooks.
|
| 51 |
+
$this->init();
|
|
|
|
| 52 |
|
| 53 |
+
}
|
|
|
|
|
|
|
| 54 |
|
| 55 |
+
/**
|
| 56 |
+
* Set up WordPress filters to hook into WP's update process.
|
| 57 |
+
*
|
| 58 |
+
* @uses add_filter()
|
| 59 |
+
*
|
| 60 |
+
* @return void
|
| 61 |
+
*/
|
| 62 |
+
public function init()
|
| 63 |
+
{
|
| 64 |
|
| 65 |
+
add_filter('pre_set_site_transient_update_plugins', array($this, 'check_update'));
|
| 66 |
+
add_filter('plugins_api', array($this, 'plugins_api_filter'), 10, 3);
|
| 67 |
+
remove_action('after_plugin_row_' . $this->name, 'wp_plugin_update_row', 10);
|
| 68 |
+
add_action('after_plugin_row_' . $this->name, array($this, 'show_update_notification'), 10, 2);
|
| 69 |
+
add_action('admin_init', array($this, 'show_changelog'));
|
| 70 |
|
| 71 |
+
}
|
|
|
|
| 72 |
|
| 73 |
+
/**
|
| 74 |
+
* Check for Updates at the defined API endpoint and modify the update array.
|
| 75 |
+
*
|
| 76 |
+
* This function dives into the update API just when WordPress creates its update array,
|
| 77 |
+
* then adds a custom API call and injects the custom plugin data retrieved from the API.
|
| 78 |
+
* It is reassembled from parts of the native WordPress plugin update code.
|
| 79 |
+
* See wp-includes/update.php line 121 for the original wp_update_plugins() function.
|
| 80 |
+
*
|
| 81 |
+
* @uses api_request()
|
| 82 |
+
*
|
| 83 |
+
* @param array $_transient_data Update array build by WordPress.
|
| 84 |
+
* @return array Modified update array with custom plugin data.
|
| 85 |
+
*/
|
| 86 |
+
public function check_update($_transient_data)
|
| 87 |
+
{
|
| 88 |
|
| 89 |
+
global $pagenow;
|
| 90 |
|
| 91 |
+
if (!is_object($_transient_data)) {
|
| 92 |
+
$_transient_data = new stdClass;
|
| 93 |
+
}
|
| 94 |
|
| 95 |
+
if ('plugins.php' == $pagenow && is_multisite()) {
|
| 96 |
+
return $_transient_data;
|
| 97 |
+
}
|
| 98 |
|
| 99 |
+
if (!empty($_transient_data->response) && !empty($_transient_data->response[$this->name]) && false === $this->wp_override) {
|
| 100 |
+
return $_transient_data;
|
| 101 |
+
}
|
| 102 |
|
| 103 |
+
$version_info = $this->get_cached_version_info();
|
| 104 |
|
| 105 |
+
if (false === $version_info) {
|
| 106 |
+
$version_info = $this->api_request('plugin_latest_version', array('slug' => $this->slug, 'beta' => $this->beta));
|
| 107 |
|
| 108 |
+
$this->set_version_info_cache($version_info);
|
| 109 |
|
| 110 |
+
}
|
|
|
|
| 111 |
|
| 112 |
+
if (false !== $version_info && is_object($version_info) && isset($version_info->new_version)) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 113 |
|
| 114 |
+
if (version_compare($this->version, $version_info->new_version, '<')) {
|
|
|
|
|
|
|
| 115 |
|
| 116 |
+
$_transient_data->response[$this->name] = $version_info;
|
|
|
|
|
|
|
| 117 |
|
| 118 |
+
}
|
|
|
|
|
|
|
| 119 |
|
| 120 |
+
$_transient_data->last_checked = current_time('timestamp');
|
| 121 |
+
$_transient_data->checked[$this->name] = $this->version;
|
|
|
|
| 122 |
|
| 123 |
+
}
|
|
|
|
| 124 |
|
| 125 |
+
return $_transient_data;
|
| 126 |
+
}
|
| 127 |
|
| 128 |
+
/**
|
| 129 |
+
* show update nofication row -- needed for multisite subsites, because WP won't tell you otherwise!
|
| 130 |
+
*
|
| 131 |
+
* @param string $file
|
| 132 |
+
* @param array $plugin
|
| 133 |
+
*/
|
| 134 |
+
public function show_update_notification($file, $plugin)
|
| 135 |
+
{
|
| 136 |
|
| 137 |
+
if (is_network_admin()) {
|
| 138 |
+
return;
|
| 139 |
+
}
|
| 140 |
|
| 141 |
+
if (!current_user_can('update_plugins')) {
|
| 142 |
+
return;
|
| 143 |
+
}
|
| 144 |
|
| 145 |
+
if (!is_multisite()) {
|
| 146 |
+
return;
|
| 147 |
+
}
|
| 148 |
|
| 149 |
+
if ($this->name != $file) {
|
| 150 |
+
return;
|
| 151 |
+
}
|
| 152 |
|
| 153 |
+
// Remove our filter on the site transient
|
| 154 |
+
remove_filter('pre_set_site_transient_update_plugins', array($this, 'check_update'), 10);
|
|
|
|
| 155 |
|
| 156 |
+
$update_cache = get_site_transient('update_plugins');
|
| 157 |
|
| 158 |
+
$update_cache = is_object($update_cache) ? $update_cache : new stdClass();
|
| 159 |
|
| 160 |
+
if (empty($update_cache->response) || empty($update_cache->response[$this->name])) {
|
| 161 |
|
| 162 |
+
$version_info = $this->get_cached_version_info();
|
|
|
|
| 163 |
|
| 164 |
+
if (false === $version_info) {
|
| 165 |
+
$version_info = $this->api_request('plugin_latest_version', array('slug' => $this->slug, 'beta' => $this->beta));
|
| 166 |
|
| 167 |
+
$this->set_version_info_cache($version_info);
|
| 168 |
+
}
|
| 169 |
|
| 170 |
+
if (!is_object($version_info)) {
|
| 171 |
+
return;
|
| 172 |
+
}
|
| 173 |
|
| 174 |
+
if (version_compare($this->version, $version_info->new_version, '<')) {
|
| 175 |
|
| 176 |
+
$update_cache->response[$this->name] = $version_info;
|
|
|
|
| 177 |
|
| 178 |
+
}
|
| 179 |
|
| 180 |
+
$update_cache->last_checked = current_time('timestamp');
|
| 181 |
+
$update_cache->checked[$this->name] = $this->version;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 182 |
|
| 183 |
+
set_site_transient('update_plugins', $update_cache);
|
| 184 |
|
| 185 |
+
} else {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 186 |
|
| 187 |
+
$version_info = $update_cache->response[$this->name];
|
| 188 |
|
| 189 |
+
}
|
|
|
|
|
|
|
| 190 |
|
| 191 |
+
// Restore our filter
|
| 192 |
+
add_filter('pre_set_site_transient_update_plugins', array($this, 'check_update'));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 193 |
|
| 194 |
+
if (!empty($update_cache->response[$this->name]) && version_compare($this->version, $version_info->new_version, '<')) {
|
| 195 |
|
| 196 |
+
// build a plugin list row, with update notification
|
| 197 |
+
$wp_list_table = _get_list_table('WP_Plugins_List_Table');
|
| 198 |
+
# <tr class="plugin-update-tr"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange">
|
| 199 |
+
echo '<tr class="plugin-update-tr" id="' . $this->slug . '-update" data-slug="' . $this->slug . '" data-plugin="' . $this->slug . '/' . $file . '">';
|
| 200 |
+
echo '<td colspan="3" class="plugin-update colspanchange">';
|
| 201 |
+
echo '<div class="update-message notice inline notice-warning notice-alt">';
|
| 202 |
|
| 203 |
+
$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');
|
| 204 |
|
| 205 |
+
if (empty($version_info->download_link)) {
|
| 206 |
+
printf(
|
| 207 |
+
__('There is a new version of %1$s available. %2$sView version %3$s details%4$s.', 'easy-digital-downloads'),
|
| 208 |
+
esc_html($version_info->name),
|
| 209 |
+
'<a target="_blank" class="thickbox" href="' . esc_url($changelog_link) . '">',
|
| 210 |
+
esc_html($version_info->new_version),
|
| 211 |
+
'</a>'
|
| 212 |
+
);
|
| 213 |
+
} else {
|
| 214 |
+
printf(
|
| 215 |
+
__('There is a new version of %1$s available. %2$sView version %3$s details%4$s or %5$supdate now%6$s.', 'easy-digital-downloads'),
|
| 216 |
+
esc_html($version_info->name),
|
| 217 |
+
'<a target="_blank" class="thickbox" href="' . esc_url($changelog_link) . '">',
|
| 218 |
+
esc_html($version_info->new_version),
|
| 219 |
+
'</a>',
|
| 220 |
+
'<a href="' . esc_url(wp_nonce_url(self_admin_url('update.php?action=upgrade-plugin&plugin=') . $this->name, 'upgrade-plugin_' . $this->name)) . '">',
|
| 221 |
+
'</a>'
|
| 222 |
+
);
|
| 223 |
+
}
|
| 224 |
|
| 225 |
+
do_action("in_plugin_update_message-{$file}", $plugin, $version_info);
|
| 226 |
|
| 227 |
+
echo '</div></td></tr>';
|
| 228 |
+
}
|
| 229 |
+
}
|
| 230 |
|
| 231 |
+
/**
|
| 232 |
+
* Updates information on the "View version x.x details" page with custom data.
|
| 233 |
+
*
|
| 234 |
+
* @uses api_request()
|
| 235 |
+
*
|
| 236 |
+
* @param mixed $_data
|
| 237 |
+
* @param string $_action
|
| 238 |
+
* @param object $_args
|
| 239 |
+
* @return object $_data
|
| 240 |
+
*/
|
| 241 |
+
public function plugins_api_filter($_data, $_action = '', $_args = null)
|
| 242 |
+
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 243 |
|
| 244 |
+
if ($_action != 'plugin_information') {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 245 |
|
| 246 |
+
return $_data;
|
|
|
|
| 247 |
|
| 248 |
+
}
|
|
|
|
|
|
|
| 249 |
|
| 250 |
+
if (!isset($_args->slug) || ($_args->slug != $this->slug)) {
|
| 251 |
|
| 252 |
+
return $_data;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 253 |
|
| 254 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 255 |
|
| 256 |
+
$to_send = array(
|
| 257 |
+
'slug' => $this->slug,
|
| 258 |
+
'is_ssl' => is_ssl(),
|
| 259 |
+
'fields' => array(
|
| 260 |
+
'banners' => array(),
|
| 261 |
+
'reviews' => false
|
| 262 |
+
)
|
| 263 |
+
);
|
| 264 |
|
| 265 |
+
$cache_key = 'edd_api_request_' . md5(serialize($this->slug . $this->api_data['license'] . $this->beta));
|
| 266 |
|
| 267 |
+
// Get the transient where we store the api request for this plugin for 24 hours
|
| 268 |
+
$edd_api_request_transient = $this->get_cached_version_info($cache_key);
|
|
|
|
| 269 |
|
| 270 |
+
//If we have no transient-saved value, run the API, set a fresh transient with the API value, and return that value too right now.
|
| 271 |
+
if (empty($edd_api_request_transient)) {
|
| 272 |
|
| 273 |
+
$api_response = $this->api_request('plugin_information', $to_send);
|
| 274 |
|
| 275 |
+
// Expires in 3 hours
|
| 276 |
+
$this->set_version_info_cache($api_response, $cache_key);
|
|
|
|
| 277 |
|
| 278 |
+
if (false !== $api_response) {
|
| 279 |
+
$_data = $api_response;
|
| 280 |
+
}
|
| 281 |
|
| 282 |
+
} else {
|
| 283 |
+
$_data = $edd_api_request_transient;
|
| 284 |
+
}
|
| 285 |
|
| 286 |
+
// Convert sections into an associative array, since we're getting an object, but Core expects an array.
|
| 287 |
+
if (isset($_data->sections) && !is_array($_data->sections)) {
|
| 288 |
+
$new_sections = array();
|
| 289 |
+
foreach ($_data->sections as $key => $value) {
|
| 290 |
+
$new_sections[$key] = $value;
|
| 291 |
+
}
|
| 292 |
|
| 293 |
+
$_data->sections = $new_sections;
|
| 294 |
+
}
|
| 295 |
|
| 296 |
+
// Convert banners into an associative array, since we're getting an object, but Core expects an array.
|
| 297 |
+
if (isset($_data->banners) && !is_array($_data->banners)) {
|
| 298 |
+
$new_banners = array();
|
| 299 |
+
foreach ($_data->banners as $key => $value) {
|
| 300 |
+
$new_banners[$key] = $value;
|
| 301 |
+
}
|
| 302 |
|
| 303 |
+
$_data->banners = $new_banners;
|
| 304 |
+
}
|
|
|
|
| 305 |
|
| 306 |
+
return $_data;
|
| 307 |
+
}
|
|
|
|
|
|
|
| 308 |
|
| 309 |
+
/**
|
| 310 |
+
* Disable SSL verification in order to prevent download update failures
|
| 311 |
+
*
|
| 312 |
+
* @param array $args
|
| 313 |
+
* @param string $url
|
| 314 |
+
* @return object $array
|
| 315 |
+
*/
|
| 316 |
+
public function http_request_args($args, $url)
|
| 317 |
+
{
|
| 318 |
|
| 319 |
+
$verify_ssl = $this->verify_ssl();
|
| 320 |
+
if (strpos($url, 'https://') !== false && strpos($url, 'edd_action=package_download')) {
|
| 321 |
+
$args['sslverify'] = $verify_ssl;
|
| 322 |
+
}
|
| 323 |
+
return $args;
|
| 324 |
|
| 325 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 326 |
|
| 327 |
+
/**
|
| 328 |
+
* Calls the API and, if successfull, returns the object delivered by the API.
|
| 329 |
+
*
|
| 330 |
+
* @uses get_bloginfo()
|
| 331 |
+
* @uses wp_remote_post()
|
| 332 |
+
* @uses is_wp_error()
|
| 333 |
+
*
|
| 334 |
+
* @param string $_action The requested action.
|
| 335 |
+
* @param array $_data Parameters for the API action.
|
| 336 |
+
* @return false|object
|
| 337 |
+
*/
|
| 338 |
+
private function api_request($_action, $_data)
|
| 339 |
+
{
|
| 340 |
+
|
| 341 |
+
global $wp_version;
|
| 342 |
+
|
| 343 |
+
$data = array_merge($this->api_data, $_data);
|
| 344 |
|
| 345 |
+
if ($data['slug'] != $this->slug) {
|
| 346 |
+
return;
|
| 347 |
+
}
|
| 348 |
+
|
| 349 |
+
if ($this->api_url == trailingslashit(home_url())) {
|
| 350 |
+
return false; // Don't allow a plugin to ping itself
|
| 351 |
+
}
|
| 352 |
+
|
| 353 |
+
$api_params = array(
|
| 354 |
+
'edd_action' => 'get_version',
|
| 355 |
+
'license' => !empty($data['license']) ? $data['license'] : '',
|
| 356 |
+
'item_name' => isset($data['item_name']) ? $data['item_name'] : false,
|
| 357 |
+
'item_id' => isset($data['item_id']) ? $data['item_id'] : false,
|
| 358 |
+
'version' => isset($data['version']) ? $data['version'] : false,
|
| 359 |
+
'slug' => $data['slug'],
|
| 360 |
+
'author' => $data['author'],
|
| 361 |
+
'url' => home_url(),
|
| 362 |
+
'beta' => !empty($data['beta']),
|
| 363 |
+
);
|
| 364 |
+
|
| 365 |
+
$verify_ssl = $this->verify_ssl();
|
| 366 |
+
$request = wp_remote_post($this->api_url, array('timeout' => 15, 'sslverify' => $verify_ssl, 'body' => $api_params));
|
| 367 |
+
|
| 368 |
+
if (!is_wp_error($request)) {
|
| 369 |
+
$request = json_decode(wp_remote_retrieve_body($request));
|
| 370 |
+
}
|
| 371 |
+
|
| 372 |
+
if ($request && isset($request->sections)) {
|
| 373 |
+
$request->sections = maybe_unserialize($request->sections);
|
| 374 |
+
} else {
|
| 375 |
+
$request = false;
|
| 376 |
+
}
|
| 377 |
+
|
| 378 |
+
if ($request && isset($request->banners)) {
|
| 379 |
+
$request->banners = maybe_unserialize($request->banners);
|
| 380 |
+
}
|
| 381 |
+
|
| 382 |
+
if (!empty($request->sections)) {
|
| 383 |
+
foreach ($request->sections as $key => $section) {
|
| 384 |
+
$request->$key = (array)$section;
|
| 385 |
+
}
|
| 386 |
+
}
|
| 387 |
+
|
| 388 |
+
return $request;
|
| 389 |
+
}
|
| 390 |
+
|
| 391 |
+
public function show_changelog()
|
| 392 |
+
{
|
| 393 |
+
|
| 394 |
+
global $edd_plugin_data;
|
| 395 |
+
|
| 396 |
+
if (empty($_REQUEST['edd_sl_action']) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action']) {
|
| 397 |
+
return;
|
| 398 |
+
}
|
| 399 |
+
|
| 400 |
+
if (empty($_REQUEST['plugin'])) {
|
| 401 |
+
return;
|
| 402 |
+
}
|
| 403 |
+
|
| 404 |
+
if (empty($_REQUEST['slug'])) {
|
| 405 |
+
return;
|
| 406 |
+
}
|
| 407 |
+
|
| 408 |
+
if (!current_user_can('update_plugins')) {
|
| 409 |
+
wp_die(__('You do not have permission to install plugin updates', 'easy-digital-downloads'), __('Error', 'easy-digital-downloads'), array('response' => 403));
|
| 410 |
+
}
|
| 411 |
+
|
| 412 |
+
$data = $edd_plugin_data[$_REQUEST['slug']];
|
| 413 |
+
$beta = !empty($data['beta']) ? true : false;
|
| 414 |
+
$cache_key = md5('edd_plugin_' . sanitize_key($_REQUEST['plugin']) . '_' . $beta . '_version_info');
|
| 415 |
+
$version_info = $this->get_cached_version_info($cache_key);
|
| 416 |
+
|
| 417 |
+
if (false === $version_info) {
|
| 418 |
+
|
| 419 |
+
$api_params = array(
|
| 420 |
+
'edd_action' => 'get_version',
|
| 421 |
+
'item_name' => isset($data['item_name']) ? $data['item_name'] : false,
|
| 422 |
+
'item_id' => isset($data['item_id']) ? $data['item_id'] : false,
|
| 423 |
+
'slug' => $_REQUEST['slug'],
|
| 424 |
+
'author' => $data['author'],
|
| 425 |
+
'url' => home_url(),
|
| 426 |
+
'beta' => !empty($data['beta'])
|
| 427 |
+
);
|
| 428 |
+
|
| 429 |
+
$verify_ssl = $this->verify_ssl();
|
| 430 |
+
$request = wp_remote_post($this->api_url, array('timeout' => 15, 'sslverify' => $verify_ssl, 'body' => $api_params));
|
| 431 |
+
|
| 432 |
+
if (!is_wp_error($request)) {
|
| 433 |
+
$version_info = json_decode(wp_remote_retrieve_body($request));
|
| 434 |
+
}
|
| 435 |
+
|
| 436 |
+
|
| 437 |
+
if (!empty($version_info) && isset($version_info->sections)) {
|
| 438 |
+
$version_info->sections = maybe_unserialize($version_info->sections);
|
| 439 |
+
} else {
|
| 440 |
+
$version_info = false;
|
| 441 |
+
}
|
| 442 |
+
|
| 443 |
+
if (!empty($version_info)) {
|
| 444 |
+
foreach ($version_info->sections as $key => $section) {
|
| 445 |
+
$version_info->$key = (array)$section;
|
| 446 |
+
}
|
| 447 |
+
}
|
| 448 |
+
|
| 449 |
+
$this->set_version_info_cache($version_info, $cache_key);
|
| 450 |
+
|
| 451 |
+
}
|
| 452 |
+
|
| 453 |
+
if (!empty($version_info) && isset($version_info->sections['changelog'])) {
|
| 454 |
+
echo '<div style="background:#fff;padding:10px;">' . $version_info->sections['changelog'] . '</div>';
|
| 455 |
+
}
|
| 456 |
+
|
| 457 |
+
exit;
|
| 458 |
+
}
|
| 459 |
+
|
| 460 |
+
public function get_cached_version_info($cache_key = '')
|
| 461 |
+
{
|
| 462 |
+
|
| 463 |
+
if (empty($cache_key)) {
|
| 464 |
+
$cache_key = $this->cache_key;
|
| 465 |
+
}
|
| 466 |
+
|
| 467 |
+
$cache = get_option($cache_key);
|
| 468 |
+
|
| 469 |
+
if (empty($cache['timeout']) || current_time('timestamp') > $cache['timeout']) {
|
| 470 |
+
return false; // Cache is expired
|
| 471 |
+
}
|
| 472 |
+
|
| 473 |
+
return json_decode($cache['value']);
|
| 474 |
+
|
| 475 |
+
}
|
| 476 |
+
|
| 477 |
+
public function set_version_info_cache($value = '', $cache_key = '')
|
| 478 |
+
{
|
| 479 |
+
|
| 480 |
+
if (empty($cache_key)) {
|
| 481 |
+
$cache_key = $this->cache_key;
|
| 482 |
+
}
|
| 483 |
+
|
| 484 |
+
$data = array(
|
| 485 |
+
'timeout' => strtotime('+3 hours', current_time('timestamp')),
|
| 486 |
+
'value' => json_encode($value)
|
| 487 |
+
);
|
| 488 |
+
|
| 489 |
+
update_option($cache_key, $data);
|
| 490 |
+
|
| 491 |
+
}
|
| 492 |
+
|
| 493 |
+
/**
|
| 494 |
+
* Returns if the SSL of the store should be verified.
|
| 495 |
+
*
|
| 496 |
+
* @since 1.6.13
|
| 497 |
+
* @return bool
|
| 498 |
+
*/
|
| 499 |
+
private function verify_ssl()
|
| 500 |
+
{
|
| 501 |
+
return (bool)apply_filters('edd_sl_api_request_verify_ssl', true, $this);
|
| 502 |
+
}
|
| 503 |
+
|
| 504 |
+
}
|
| 505 |
+
}
|
| 506 |
|
| 507 |
if( !class_exists('TRP_LICENSE_PAGE') ) {
|
| 508 |
class TRP_LICENSE_PAGE
|
index.php
CHANGED
|
@@ -3,7 +3,7 @@
|
|
| 3 |
Plugin Name: TranslatePress - Multilingual
|
| 4 |
Plugin URI: https://translatepress.com/
|
| 5 |
Description: Experience a better way of translating your WordPress site, with full support for WooCommerce and site builders.
|
| 6 |
-
Version: 1.4.
|
| 7 |
Author: Cozmoslabs, Razvan Mocanu, Madalin Ungureanu, Cristophor Hurduban
|
| 8 |
Author URI: https://cozmoslabs.com/
|
| 9 |
Text Domain: translatepress-multilingual
|
| 3 |
Plugin Name: TranslatePress - Multilingual
|
| 4 |
Plugin URI: https://translatepress.com/
|
| 5 |
Description: Experience a better way of translating your WordPress site, with full support for WooCommerce and site builders.
|
| 6 |
+
Version: 1.4.7
|
| 7 |
Author: Cozmoslabs, Razvan Mocanu, Madalin Ungureanu, Cristophor Hurduban
|
| 8 |
Author URI: https://cozmoslabs.com/
|
| 9 |
Text Domain: translatepress-multilingual
|
languages/translatepress-multilingual.catalog.php
CHANGED
|
@@ -166,3 +166,6 @@
|
|
| 166 |
<?php __("Remove duplicate rows", "translatepress-multilingual"); ?>
|
| 167 |
<?php __("TranslatePress Database Updater", "translatepress-multilingual"); ?>
|
| 168 |
<?php __("Updating TranslatePress tables", "translatepress-multilingual"); ?>
|
|
|
|
|
|
|
|
|
| 166 |
<?php __("Remove duplicate rows", "translatepress-multilingual"); ?>
|
| 167 |
<?php __("TranslatePress Database Updater", "translatepress-multilingual"); ?>
|
| 168 |
<?php __("Updating TranslatePress tables", "translatepress-multilingual"); ?>
|
| 169 |
+
<?php __(" TranslatePress Settings", "translatepress-multilingual"); ?>
|
| 170 |
+
<?php __("Translator", "translatepress-multilingual"); ?>
|
| 171 |
+
<?php __("Allow this user to translate the website.", "translatepress-multilingual"); ?>
|
languages/translatepress-multilingual.pot
CHANGED
|
@@ -25,55 +25,55 @@ msgstr ""
|
|
| 25 |
msgid "All Languages"
|
| 26 |
msgstr ""
|
| 27 |
|
| 28 |
-
#:
|
| 29 |
msgid "The Yoast SEO Sitemaps will now contain the default language slug: example.com/en/sitemap_index.xml <br/> This works perfectly, just take it into account when you submit the sitemap to Google."
|
| 30 |
msgstr ""
|
| 31 |
|
| 32 |
-
#: includes/class-ald-settings.php:37
|
| 33 |
msgid "First by browser language, then IP address (recommended)"
|
| 34 |
msgstr ""
|
| 35 |
|
| 36 |
-
#: includes/class-ald-settings.php:38
|
| 37 |
msgid "First by IP address, then browser language"
|
| 38 |
msgstr ""
|
| 39 |
|
| 40 |
-
#: includes/class-ald-settings.php:39
|
| 41 |
msgid "Only by browser language"
|
| 42 |
msgstr ""
|
| 43 |
|
| 44 |
-
#: includes/class-ald-settings.php:40
|
| 45 |
msgid "Only by IP address"
|
| 46 |
msgstr ""
|
| 47 |
|
| 48 |
-
#: includes/class-ald-settings.php:110
|
| 49 |
msgid "<div class=\"warning\">WARNING. Cannot determine your language preference based on your current IP.<br>This is most likely because the website is on a local environment.</div>"
|
| 50 |
msgstr ""
|
| 51 |
|
| 52 |
-
#: partials/license-settings-page.php:4, ../tp-add-on-browse-as-other-roles/partials/license-settings-page.php:4, ../tp-add-on-extra-languages/partials/license-settings-page.php:4,
|
| 53 |
msgid "TranslatePress Settings"
|
| 54 |
msgstr ""
|
| 55 |
|
| 56 |
-
#: partials/license-settings-page.php:10, ../tp-add-on-browse-as-other-roles/partials/license-settings-page.php:10, ../tp-add-on-extra-languages/partials/license-settings-page.php:10,
|
| 57 |
msgid "License Key"
|
| 58 |
msgstr ""
|
| 59 |
|
| 60 |
-
#: partials/license-settings-page.php:15, ../tp-add-on-browse-as-other-roles/partials/license-settings-page.php:15, ../tp-add-on-extra-languages/partials/license-settings-page.php:15,
|
| 61 |
msgid "Enter your license key."
|
| 62 |
msgstr ""
|
| 63 |
|
| 64 |
-
#: partials/license-settings-page.php:22, partials/license-settings-page.php:31, ../tp-add-on-browse-as-other-roles/partials/license-settings-page.php:22, ../tp-add-on-browse-as-other-roles/partials/license-settings-page.php:31, ../tp-add-on-extra-languages/partials/license-settings-page.php:22, ../tp-add-on-extra-languages/partials/license-settings-page.php:31,
|
| 65 |
msgid "Activate License"
|
| 66 |
msgstr ""
|
| 67 |
|
| 68 |
-
#: partials/license-settings-page.php:28, ../tp-add-on-browse-as-other-roles/partials/license-settings-page.php:28, ../tp-add-on-extra-languages/partials/license-settings-page.php:28,
|
| 69 |
msgid "Deactivate License"
|
| 70 |
msgstr ""
|
| 71 |
|
| 72 |
-
#: partials/settings-option.php:2
|
| 73 |
msgid "Method of language detection"
|
| 74 |
msgstr ""
|
| 75 |
|
| 76 |
-
#: partials/settings-option.php:14
|
| 77 |
msgid "Select how the language should be detected for first time visitors.<br>The visitor's last displayed language will be remembered through cookies."
|
| 78 |
msgstr ""
|
| 79 |
|
|
@@ -113,35 +113,35 @@ msgstr ""
|
|
| 113 |
msgid "Select the languages you wish to make your website available in."
|
| 114 |
msgstr ""
|
| 115 |
|
| 116 |
-
#: ../translatepress/includes/class-edd-sl-plugin-updater.php:
|
| 117 |
msgid "An error occurred, please try again."
|
| 118 |
msgstr ""
|
| 119 |
|
| 120 |
-
#: ../translatepress/includes/class-edd-sl-plugin-updater.php:
|
| 121 |
msgid "Your license key expired on %s."
|
| 122 |
msgstr ""
|
| 123 |
|
| 124 |
-
#: ../translatepress/includes/class-edd-sl-plugin-updater.php:
|
| 125 |
msgid "Your license key has been disabled."
|
| 126 |
msgstr ""
|
| 127 |
|
| 128 |
-
#: ../translatepress/includes/class-edd-sl-plugin-updater.php:
|
| 129 |
msgid "Invalid license."
|
| 130 |
msgstr ""
|
| 131 |
|
| 132 |
-
#: ../translatepress/includes/class-edd-sl-plugin-updater.php:
|
| 133 |
msgid "Your license is not active for this URL."
|
| 134 |
msgstr ""
|
| 135 |
|
| 136 |
-
#: ../translatepress/includes/class-edd-sl-plugin-updater.php:
|
| 137 |
msgid "This appears to be an invalid license key for %s."
|
| 138 |
msgstr ""
|
| 139 |
|
| 140 |
-
#: ../translatepress/includes/class-edd-sl-plugin-updater.php:
|
| 141 |
msgid "Your license key has reached its activation limit."
|
| 142 |
msgstr ""
|
| 143 |
|
| 144 |
-
#: ../translatepress/includes/class-edd-sl-plugin-updater.php:
|
| 145 |
msgid "You have successfully activated your license"
|
| 146 |
msgstr ""
|
| 147 |
|
|
@@ -682,3 +682,15 @@ msgstr ""
|
|
| 682 |
#: ../translatepress/partials/trp-update-database.php:7
|
| 683 |
msgid "Updating TranslatePress tables"
|
| 684 |
msgstr ""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
msgid "All Languages"
|
| 26 |
msgstr ""
|
| 27 |
|
| 28 |
+
#: class-seo-pack.php:171
|
| 29 |
msgid "The Yoast SEO Sitemaps will now contain the default language slug: example.com/en/sitemap_index.xml <br/> This works perfectly, just take it into account when you submit the sitemap to Google."
|
| 30 |
msgstr ""
|
| 31 |
|
| 32 |
+
#: ../tp-add-on-automatic-language-detection/includes/class-ald-settings.php:37
|
| 33 |
msgid "First by browser language, then IP address (recommended)"
|
| 34 |
msgstr ""
|
| 35 |
|
| 36 |
+
#: ../tp-add-on-automatic-language-detection/includes/class-ald-settings.php:38
|
| 37 |
msgid "First by IP address, then browser language"
|
| 38 |
msgstr ""
|
| 39 |
|
| 40 |
+
#: ../tp-add-on-automatic-language-detection/includes/class-ald-settings.php:39
|
| 41 |
msgid "Only by browser language"
|
| 42 |
msgstr ""
|
| 43 |
|
| 44 |
+
#: ../tp-add-on-automatic-language-detection/includes/class-ald-settings.php:40
|
| 45 |
msgid "Only by IP address"
|
| 46 |
msgstr ""
|
| 47 |
|
| 48 |
+
#: ../tp-add-on-automatic-language-detection/includes/class-ald-settings.php:110
|
| 49 |
msgid "<div class=\"warning\">WARNING. Cannot determine your language preference based on your current IP.<br>This is most likely because the website is on a local environment.</div>"
|
| 50 |
msgstr ""
|
| 51 |
|
| 52 |
+
#: ../tp-add-on-automatic-language-detection/partials/license-settings-page.php:4, ../tp-add-on-browse-as-other-roles/partials/license-settings-page.php:4, ../tp-add-on-extra-languages/partials/license-settings-page.php:4, partials/license-settings-page.php:4, ../translatepress/partials/addons-settings-page.php:3, ../translatepress/partials/license-settings-page.php:8, ../translatepress/partials/license-settings-page.php:46, ../translatepress/partials/main-settings-page.php:5, ../translatepress/partials/test-google-key-settings-page.php:10, ../translatepress/partials/trp-remove-duplicate-rows.php:3, ../trp-add-on-translator-accounts-add-on/partials/license-settings-page.php:4
|
| 53 |
msgid "TranslatePress Settings"
|
| 54 |
msgstr ""
|
| 55 |
|
| 56 |
+
#: ../tp-add-on-automatic-language-detection/partials/license-settings-page.php:10, ../tp-add-on-browse-as-other-roles/partials/license-settings-page.php:10, ../tp-add-on-extra-languages/partials/license-settings-page.php:10, partials/license-settings-page.php:10, ../translatepress/partials/license-settings-page.php:14, ../trp-add-on-translator-accounts-add-on/partials/license-settings-page.php:10
|
| 57 |
msgid "License Key"
|
| 58 |
msgstr ""
|
| 59 |
|
| 60 |
+
#: ../tp-add-on-automatic-language-detection/partials/license-settings-page.php:15, ../tp-add-on-browse-as-other-roles/partials/license-settings-page.php:15, ../tp-add-on-extra-languages/partials/license-settings-page.php:15, partials/license-settings-page.php:15, ../translatepress/partials/license-settings-page.php:38, ../trp-add-on-translator-accounts-add-on/partials/license-settings-page.php:15
|
| 61 |
msgid "Enter your license key."
|
| 62 |
msgstr ""
|
| 63 |
|
| 64 |
+
#: ../tp-add-on-automatic-language-detection/partials/license-settings-page.php:22, ../tp-add-on-automatic-language-detection/partials/license-settings-page.php:31, ../tp-add-on-browse-as-other-roles/partials/license-settings-page.php:22, ../tp-add-on-browse-as-other-roles/partials/license-settings-page.php:31, ../tp-add-on-extra-languages/partials/license-settings-page.php:22, ../tp-add-on-extra-languages/partials/license-settings-page.php:31, partials/license-settings-page.php:22, partials/license-settings-page.php:31, ../translatepress/partials/license-settings-page.php:32, ../trp-add-on-translator-accounts-add-on/partials/license-settings-page.php:22, ../trp-add-on-translator-accounts-add-on/partials/license-settings-page.php:31
|
| 65 |
msgid "Activate License"
|
| 66 |
msgstr ""
|
| 67 |
|
| 68 |
+
#: ../tp-add-on-automatic-language-detection/partials/license-settings-page.php:28, ../tp-add-on-browse-as-other-roles/partials/license-settings-page.php:28, ../tp-add-on-extra-languages/partials/license-settings-page.php:28, partials/license-settings-page.php:28, ../translatepress/partials/license-settings-page.php:22, ../trp-add-on-translator-accounts-add-on/partials/license-settings-page.php:28
|
| 69 |
msgid "Deactivate License"
|
| 70 |
msgstr ""
|
| 71 |
|
| 72 |
+
#: ../tp-add-on-automatic-language-detection/partials/settings-option.php:2
|
| 73 |
msgid "Method of language detection"
|
| 74 |
msgstr ""
|
| 75 |
|
| 76 |
+
#: ../tp-add-on-automatic-language-detection/partials/settings-option.php:14
|
| 77 |
msgid "Select how the language should be detected for first time visitors.<br>The visitor's last displayed language will be remembered through cookies."
|
| 78 |
msgstr ""
|
| 79 |
|
| 113 |
msgid "Select the languages you wish to make your website available in."
|
| 114 |
msgstr ""
|
| 115 |
|
| 116 |
+
#: ../translatepress/includes/class-edd-sl-plugin-updater.php:676, ../translatepress/includes/class-edd-sl-plugin-updater.php:708, ../translatepress/includes/class-edd-sl-plugin-updater.php:779
|
| 117 |
msgid "An error occurred, please try again."
|
| 118 |
msgstr ""
|
| 119 |
|
| 120 |
+
#: ../translatepress/includes/class-edd-sl-plugin-updater.php:687
|
| 121 |
msgid "Your license key expired on %s."
|
| 122 |
msgstr ""
|
| 123 |
|
| 124 |
+
#: ../translatepress/includes/class-edd-sl-plugin-updater.php:692
|
| 125 |
msgid "Your license key has been disabled."
|
| 126 |
msgstr ""
|
| 127 |
|
| 128 |
+
#: ../translatepress/includes/class-edd-sl-plugin-updater.php:695
|
| 129 |
msgid "Invalid license."
|
| 130 |
msgstr ""
|
| 131 |
|
| 132 |
+
#: ../translatepress/includes/class-edd-sl-plugin-updater.php:699
|
| 133 |
msgid "Your license is not active for this URL."
|
| 134 |
msgstr ""
|
| 135 |
|
| 136 |
+
#: ../translatepress/includes/class-edd-sl-plugin-updater.php:702
|
| 137 |
msgid "This appears to be an invalid license key for %s."
|
| 138 |
msgstr ""
|
| 139 |
|
| 140 |
+
#: ../translatepress/includes/class-edd-sl-plugin-updater.php:705
|
| 141 |
msgid "Your license key has reached its activation limit."
|
| 142 |
msgstr ""
|
| 143 |
|
| 144 |
+
#: ../translatepress/includes/class-edd-sl-plugin-updater.php:739
|
| 145 |
msgid "You have successfully activated your license"
|
| 146 |
msgstr ""
|
| 147 |
|
| 682 |
#: ../translatepress/partials/trp-update-database.php:7
|
| 683 |
msgid "Updating TranslatePress tables"
|
| 684 |
msgstr ""
|
| 685 |
+
|
| 686 |
+
#: ../trp-add-on-translator-accounts-add-on/includes/class-translator-accounts.php:119
|
| 687 |
+
msgid " TranslatePress Settings"
|
| 688 |
+
msgstr ""
|
| 689 |
+
|
| 690 |
+
#: ../trp-add-on-translator-accounts-add-on/includes/class-translator-accounts.php:123, ../trp-add-on-translator-accounts-add-on/includes/class-translator-accounts.php:124
|
| 691 |
+
msgid "Translator"
|
| 692 |
+
msgstr ""
|
| 693 |
+
|
| 694 |
+
#: ../trp-add-on-translator-accounts-add-on/includes/class-translator-accounts.php:128
|
| 695 |
+
msgid "Allow this user to translate the website."
|
| 696 |
+
msgstr ""
|
readme.txt
CHANGED
|
@@ -4,7 +4,7 @@ Donate link: https://www.cozmoslabs.com/
|
|
| 4 |
Tags: translate, translation, multilingual, automatic translation, bilingual, front-end translation, google translate, language
|
| 5 |
Requires at least: 3.1.0
|
| 6 |
Tested up to: 5.1.1
|
| 7 |
-
Stable tag: 1.4.
|
| 8 |
License: GPLv2 or later
|
| 9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 10 |
|
|
@@ -456,4 +456,7 @@ For more information please check out [TranslatePress - Multilingual plugin docu
|
|
| 456 |
* Fixed JS error Uncaught Error: Syntax error, unrecognized expression
|
| 457 |
|
| 458 |
= 1.0.0 =
|
| 459 |
-
* Initial release.
|
|
|
|
|
|
|
|
|
| 4 |
Tags: translate, translation, multilingual, automatic translation, bilingual, front-end translation, google translate, language
|
| 5 |
Requires at least: 3.1.0
|
| 6 |
Tested up to: 5.1.1
|
| 7 |
+
Stable tag: 1.4.7
|
| 8 |
License: GPLv2 or later
|
| 9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
| 10 |
|
| 456 |
* Fixed JS error Uncaught Error: Syntax error, unrecognized expression
|
| 457 |
|
| 458 |
= 1.0.0 =
|
| 459 |
+
* Initial release.
|
| 460 |
+
|
| 461 |
+
1.4.7
|
| 462 |
+
|
