| 1 |
<?php |
| 2 |
namespace FileBird\Classes; |
| 3 |
|
| 4 |
use FileBird\Classes\Helpers; |
| 5 |
|
| 6 |
defined( 'ABSPATH' ) || exit; |
| 7 |
|
| 8 |
class ActivePro { |
| 9 |
private $envato_login_url = 'https://active.ninjateam.org/envato-login/'; |
| 10 |
|
| 11 |
const FB_SLUG = 'filebird_pro'; |
| 12 |
|
| 13 |
public function __construct() { |
| 14 |
add_filter( 'fbv_data', array( $this, 'localize_fbv_data' ) ); |
| 15 |
} |
| 16 |
|
| 17 |
public function resPermissionsCheck() { |
| 18 |
return current_user_can( 'upload_files' ); |
| 19 |
} |
| 20 |
|
| 21 |
public function localize_fbv_data( $data ) { |
| 22 |
$return_args = array( |
| 23 |
'action' => 'fb_login_envato_success', |
| 24 |
'nonce' => wp_create_nonce( 'njt_filebird_login_envato' ), |
| 25 |
); |
| 26 |
|
| 27 |
$return_url = add_query_arg( $return_args, admin_url( 'admin-ajax.php' ) ); |
| 28 |
$domain = $this->get_domain(); |
| 29 |
$data['login_envato_url'] = esc_url( |
| 30 |
add_query_arg( |
| 31 |
array( |
| 32 |
'domain' => $domain, |
| 33 |
'plugin' => 'filebird', |
| 34 |
'return_url' => urlencode( $return_url ), |
| 35 |
'ip' => Helpers::getIp(), |
| 36 |
), |
| 37 |
$this->envato_login_url |
| 38 |
) |
| 39 |
); |
| 40 |
|
| 41 |
$data['license']['status'] = false; |
| 42 |
|
| 43 |
$data['deactivate_license_nonce'] = wp_create_nonce( 'deactivate_license_nonce' ); |
| 44 |
if ( ! isset( $data['i18n'] ) ) { |
| 45 |
$data['i18n'] = array(); |
| 46 |
} |
| 47 |
$data['i18n']['active_to_update'] = esc_html__( 'Please activate FileBird license to use this feature.', 'filebird' ); |
| 48 |
$data['i18n']['deactivate_license_confirm_title'] = esc_html__( 'Deactivating license', 'filebird' ); |
| 49 |
$data['i18n']['deactivate_license_confirm_content'] = esc_html__( 'Are you sure to deactivate the current license key? You will not get regular updates or any support for this site.', 'filebird' ); |
| 50 |
$data['i18n']['deactivate_license_try_again'] = esc_html__( 'Please try again later!', 'filebird' ); |
| 51 |
$data['i18n']['update_error'] = esc_html__( 'Update failed: Your current FileBird license is being used on another site: {site}. To get this update, please deactivate the license on the other site first.', 'filebird' ); |
| 52 |
return $data; |
| 53 |
} |
| 54 |
private function get_domain() { |
| 55 |
return Helpers::getDomain(); |
| 56 |
} |
| 57 |
} |