diff --git a/assets/css/wptxu-styles.css b/assets/css/wptxu-styles.css
index 5158726..d99be4e 100644
--- a/assets/css/wptxu-styles.css
+++ b/assets/css/wptxu-styles.css
@@ -75,4 +75,26 @@ div[id*=wptxu-input-] {
transform: rotate(359deg);
}
-}
\ No newline at end of file
+}
+
+.wptxu-license-information {
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
+ -webkit-flex-wrap: wrap;
+ -ms-flex-wrap: wrap;
+ flex-wrap: wrap;
+ -webkit-box-pack: justify;
+ -webkit-justify-content: space-between;
+ -ms-flex-pack: justify;
+ justify-content: space-between;
+ -webkit-box-align: center;
+ -webkit-align-items: center;
+ -ms-flex-align: center;
+ align-items: center;
+ }
+
+ .wptxu-vam {
+ vertical-align: middle;
+ }
\ No newline at end of file
diff --git a/assets/js/script.js b/assets/js/script.js
index bae165d..02e4258 100755
--- a/assets/js/script.js
+++ b/assets/js/script.js
@@ -29,4 +29,55 @@ jQuery(document).ready(function($) {
});
+ $('#wptxu_license_activate').live( "click", function(e) {
+ e.preventDefault();
+
+ $.ajax({
+ type: "POST",
+ url: wptxu_ajax.ajaxurl,
+ data: {
+ 'action': 'wptxu_activate_license',
+ 'wptxu_nonce': wptxu_ajax.wptxu_nonce,
+ },
+ beforeSend: function(reponse) {
+ $('#wptxu-spinner-key').addClass('is-active');
+ },
+ success: function(response) {
+ $('#wptxu-spinner-key').removeClass('is-active');
+ $('#wptxu-key-response').html(response);
+ },
+ fail: function() {
+ $('h1').after('
' + wptxu_ajax.ajax_fail.ajax_fail + '
');
+ }
+
+ });
+
+ });
+
+ $('#wptxu_license_deactivate').live( "click", function(e) {
+ e.preventDefault();
+
+ $.ajax({
+ type: "POST",
+ url: wptxu_ajax.ajaxurl,
+ data: {
+ 'action': 'wptxu_deactivate_license',
+ 'wptxu_nonce': wptxu_ajax.wptxu_nonce,
+ },
+ beforeSend: function(reponse) {
+ $('#wptxu-spinner-key').addClass('is-active');
+ },
+ success: function(response) {
+ $('#wptxu-spinner-key').removeClass('is-active');
+ $('#wptxu-key-response').html(response);
+ $('#wptxu-sl-key').val('');
+ $('h1').after('' + wptxu_ajax.license_deactivate.license_deactivate + '
');
+ },
+ fail: function() {
+ $('h1').after('' + wptxu_ajax.ajax_fail.ajax_fail + '
');
+ }
+ });
+
+ });
+
});
\ No newline at end of file
diff --git a/inc/admin/enqueue.php b/inc/admin/enqueue.php
index c2a593e..d04985d 100755
--- a/inc/admin/enqueue.php
+++ b/inc/admin/enqueue.php
@@ -10,6 +10,8 @@ function wptxu_load_admin_assets() {
$translation_array = array(
'ajax_loading' => __( 'Check for update...', 'wpt-tx-updater' ),
+ 'license_deactivate' => 'WPT tx updater : '.__( 'License deactivate', 'wpt-tx-updater' ),
+ 'ajax_fail' => __( 'Please try again soon.', 'wpt-tx-updater' ),
);
wp_register_style( 'wptxu-styles', WPTXU_URL_ASSETS_CSS . 'wptxu-styles.css' );
@@ -22,6 +24,8 @@ function wptxu_load_admin_assets() {
wp_localize_script( 'wptxu-script', 'wptxu_ajax', array(
'ajaxurl' => admin_url( 'admin-ajax.php' ),
'ajax_loading' => $translation_array,
+ 'license_deactivate' => $translation_array,
+ 'ajax_fail' => $translation_array,
'wptxu_nonce' => wp_create_nonce( 'wptxu-nonce' ),
) );
diff --git a/inc/admin/options.php b/inc/admin/options.php
index 848b5ac..21df21f 100755
--- a/inc/admin/options.php
+++ b/inc/admin/options.php
@@ -22,8 +22,17 @@ function wptxu_save_extra_profile_fields( $user_id ) {
} else {
+ $old = get_option( 'wptxu_sl_key' );
+
+ if ( $old && $old != $new ) {
+ delete_option( 'wptxu_license_status' );
+ delete_transient( '_wptxu_license_data' );
+ delete_transient( '_wptxu_license_error' );
+ }
+
update_usermeta( absint( $user_id ), 'wptxu_transifex_auth', base64_encode( $_POST['wptxu-tx-username'] . ':' . $_POST['wptxu-tx-password'] ) );
update_usermeta( absint( $user_id ), 'wptxu_transifex_user', $_POST['wptxu-tx-username'] );
+ update_option( 'wptxu_sl_key', $_POST['wptxu-sl-key'] );
}
diff --git a/inc/admin/ui/actions.php b/inc/admin/ui/actions.php
new file mode 100644
index 0000000..b435b6b
--- /dev/null
+++ b/inc/admin/ui/actions.php
@@ -0,0 +1,49 @@
+
+
+
+
+ $now && $expiration - $now < ( DAY_IN_SECONDS * 30 ) ) {
+ $expiration_message = sprintf(
+ __( 'Your license key expires soon! It expires on %s. Renew your license key.', 'wpt-tx-updater' ),
+ date_i18n( 'j F Y', strtotime( $expires, current_time( 'timestamp' ) ) ),
+ WPTXU_STORE_URL.'/commander/?edd_license_key=' . $key
+ );
+ } else {
+ $expiration_message = sprintf(
+ __( 'Your license key expires on %s.', 'wpt-tx-updater' ),
+ date_i18n( 'j F Y', strtotime( $expires, current_time( 'timestamp' ) ) )
+ );
+ }
+
+ ?>
+
+
+renew your license key.', 'wpt-tx-updater' ),
+ WPTXU_STORE_URL.'/commander/?edd_license_key=' . $key
+ );
+ break;
+
+ case 'missing' :
+ $message = sprintf(
+ __( 'Invalid license. Please visit your account page and verify it.', 'wpt-tx-updater' ),
+ WPTXU_STORE_URL.'/votre-compte'
+ );
+ break;
+
+ case 'invalid' :
+ case 'site_inactive' :
+ $message = sprintf( __( 'There was a problem activating your license key, please try again or contact support. Error code: %s', 'wpt-tx-updater' ), $notice );
+ break;
+
+ case 'item_name_mismatch' :
+ $message = __( 'This license does not belong to the product you have entered it for.', 'wpt-tx-updater' );
+ break;
+
+ case 'no_activations_left':
+ $message = sprintf( __( 'Your license key has reached its activation limit. View possible upgrades now.', 'wpt-tx-updater' ), WPTXU_STORE_URL.'/votre-compte' );
+ break;
+
+ }
+
+ return print_r($notice);
+
+ }
+
+}
diff --git a/inc/admin/ui/options.php b/inc/admin/ui/options.php
index c6f67c0..6518fda 100755
--- a/inc/admin/ui/options.php
+++ b/inc/admin/ui/options.php
@@ -10,9 +10,52 @@
add_action( 'edit_user_profile', 'wptxu_extra_profile_fields' );
function wptxu_extra_profile_fields( $user ) {
+
+ $license = get_option( 'wptxu_sl_key' );
+ $status = get_option( 'wptxu_license_status' );
+
?>
-
+ WPT transifex updater
+
+
+
+
$action,
+ 'license' => $key,
+ 'item_name' => urlencode( WPTXU_SLUG ), // The name of our product in EDD.
+ 'url' => home_url(),
+ );
+ } else {
+ $api_params = array(
+ 'edd_action' => $action,
+ 'license' => $key,
+ 'item_name' => urlencode( WPTXU_SLUG ),
+ );
+ }
+
+ $args = array(
+ 'timeout' => 30,
+ 'sslverify' => false,
+ 'body' => $api_params,
+ );
+
+ // Call the custom API.
+ $remote_call = wp_remote_post( add_query_arg( $api_params, WPTXU_STORE_URL ), $args );
+
+ // Make sure the response came back okay.
+ if ( is_wp_error( $remote_call ) ) {
+ $error_message = sprintf( __( 'There is a problem with remote site, please try again. %s
', 'wpt-tx-updater' ), $remote_call->get_error_message() );
+ return $error_message;
+ } else {
+ // Decode the license data.
+ $license_data = json_decode( wp_remote_retrieve_body( $remote_call ) );
+ }
+
+ return $license_data;
+
+}
diff --git a/inc/classes/wptxu-translation.php b/inc/classes/wptxu-translation.php
index bc87b23..12b360b 100755
--- a/inc/classes/wptxu-translation.php
+++ b/inc/classes/wptxu-translation.php
@@ -21,16 +21,14 @@ public function __construct( $project_id, $tx_infos, $project_type, $text_domain
$this->content = $content;
if( get_post_meta( $this->project_id, 'wptxu_mo_filename', true ) ) {
- $this->filename = get_post_meta( $this->project_id, 'wptxu_mo_filename', true );
- } else {
- $this->filename = $text_domain;
+ $this->text_domain = get_post_meta( $this->project_id, 'wptxu_mo_filename', true );
}
if( $this->project_type == 'plugins') {
$this->text_domain_path = WPTXU_CONTENT_PATH . '/' . $this->project_type . '/' . $this->text_domain . '/' . $this->lang_code . '/';
- $this->po_file_path = $this->text_domain_path . $this->filename . '-' . $this->lang_code . '.po';
- $this->mo_file_path = $this->text_domain_path . $this->filename . '-' . $this->lang_code . '.mo';
+ $this->po_file_path = $this->text_domain_path . $this->text_domain . '-' . $this->lang_code . '.po';
+ $this->mo_file_path = $this->text_domain_path . $this->text_domain . '-' . $this->lang_code . '.mo';
} else {
diff --git a/inc/classes/wptxu-updater.php b/inc/classes/wptxu-updater.php
new file mode 100644
index 0000000..bf7781b
--- /dev/null
+++ b/inc/classes/wptxu-updater.php
@@ -0,0 +1,378 @@
+api_url = trailingslashit( $_api_url );
+ $this->api_data = $_api_data;
+ $this->name = plugin_basename( $_plugin_file );
+ $this->slug = basename( $_plugin_file, '.php' );
+ $this->version = $_api_data['version'];
+ $this->wp_override = isset( $_api_data['wp_override'] ) ? (bool) $_api_data['wp_override'] : false;
+
+ $edd_plugin_data[ $this->slug ] = $this->api_data;
+
+ // Set up hooks.
+ $this->init();
+
+ }
+
+ /**
+ * Set up WordPress filters to hook into WP's update process.
+ *
+ * @uses add_filter()
+ *
+ * @return void
+ */
+ public function init() {
+
+ add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
+ add_filter( 'plugins_api', array( $this, 'plugins_api_filter' ), 10, 3 );
+ remove_action( 'after_plugin_row_' . $this->name, 'wp_plugin_update_row', 10, 2 );
+ add_action( 'after_plugin_row_' . $this->name, array( $this, 'show_update_notification' ), 10, 2 );
+ add_action( 'admin_init', array( $this, 'show_changelog' ) );
+
+ }
+
+ /**
+ * Check for Updates at the defined API endpoint and modify the update array.
+ *
+ * This function dives into the update API just when WordPress creates its update array,
+ * then adds a custom API call and injects the custom plugin data retrieved from the API.
+ * It is reassembled from parts of the native WordPress plugin update code.
+ * See wp-includes/update.php line 121 for the original wp_update_plugins() function.
+ *
+ * @uses api_request()
+ *
+ * @param array $_transient_data Update array build by WordPress.
+ * @return array Modified update array with custom plugin data.
+ */
+ public function check_update( $_transient_data ) {
+
+ global $pagenow;
+
+ if ( ! is_object( $_transient_data ) ) {
+ $_transient_data = new stdClass;
+ }
+
+ if ( 'plugins.php' == $pagenow && is_multisite() ) {
+ return $_transient_data;
+ }
+
+ if ( ! empty( $_transient_data->response ) && ! empty( $_transient_data->response[ $this->name ] ) && false === $this->wp_override ) {
+ return $_transient_data;
+ }
+
+ $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) );
+
+ if ( false !== $version_info && is_object( $version_info ) && isset( $version_info->new_version ) ) {
+
+ if ( version_compare( $this->version, $version_info->new_version, '<' ) ) {
+
+ $_transient_data->response[ $this->name ] = $version_info;
+
+ }
+
+ $_transient_data->last_checked = time();
+ $_transient_data->checked[ $this->name ] = $this->version;
+
+ }
+
+ return $_transient_data;
+ }
+
+ /**
+ * show update nofication row -- needed for multisite subsites, because WP won't tell you otherwise!
+ *
+ * @param string $file
+ * @param array $plugin
+ */
+ public function show_update_notification( $file, $plugin ) {
+
+ if( ! current_user_can( 'update_plugins' ) ) {
+ return;
+ }
+
+ if( ! is_multisite() ) {
+ return;
+ }
+
+ if ( $this->name != $file ) {
+ return;
+ }
+
+ // Remove our filter on the site transient
+ remove_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ), 10 );
+
+ $update_cache = get_site_transient( 'update_plugins' );
+
+ $update_cache = is_object( $update_cache ) ? $update_cache : new stdClass();
+
+ if ( empty( $update_cache->response ) || empty( $update_cache->response[ $this->name ] ) ) {
+
+ $cache_key = md5( 'edd_plugin_' . sanitize_key( $this->name ) . '_version_info' );
+ $version_info = get_transient( $cache_key );
+
+ if( false === $version_info ) {
+
+ $version_info = $this->api_request( 'plugin_latest_version', array( 'slug' => $this->slug ) );
+
+ set_transient( $cache_key, $version_info, 3600 );
+ }
+
+ if( ! is_object( $version_info ) ) {
+ return;
+ }
+
+ if( version_compare( $this->version, $version_info->new_version, '<' ) ) {
+
+ $update_cache->response[ $this->name ] = $version_info;
+
+ }
+
+ $update_cache->last_checked = time();
+ $update_cache->checked[ $this->name ] = $this->version;
+
+ set_site_transient( 'update_plugins', $update_cache );
+
+ } else {
+
+ $version_info = $update_cache->response[ $this->name ];
+
+ }
+
+ // Restore our filter
+ add_filter( 'pre_set_site_transient_update_plugins', array( $this, 'check_update' ) );
+
+ if ( ! empty( $update_cache->response[ $this->name ] ) && version_compare( $this->version, $version_info->new_version, '<' ) ) {
+
+ // build a plugin list row, with update notification
+ $wp_list_table = _get_list_table( 'WP_Plugins_List_Table' );
+ echo '';
+
+ $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' );
+
+ if ( empty( $version_info->download_link ) ) {
+ printf(
+ __( 'There is a new version of %1$s available. %2$sView version %3$s details%4$s.', 'easy-digital-downloads' ),
+ esc_html( $version_info->name ),
+ ' ',
+ esc_html( $version_info->new_version ),
+ ''
+ );
+ } else {
+ printf(
+ __( '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' ),
+ esc_html( $version_info->name ),
+ ' ',
+ esc_html( $version_info->new_version ),
+ '',
+ ' ',
+ ''
+ );
+ }
+
+ do_action( "in_plugin_update_message-{$file}", $plugin, $version_info );
+
+ echo ' |
';
+ }
+ }
+
+
+ /**
+ * Updates information on the "View version x.x details" page with custom data.
+ *
+ * @uses api_request()
+ *
+ * @param mixed $_data
+ * @param string $_action
+ * @param object $_args
+ * @return object $_data
+ */
+ public function plugins_api_filter( $_data, $_action = '', $_args = null ) {
+
+
+ if ( $_action != 'plugin_information' ) {
+
+ return $_data;
+
+ }
+
+ if ( ! isset( $_args->slug ) || ( $_args->slug != $this->slug ) ) {
+
+ return $_data;
+
+ }
+
+ $to_send = array(
+ 'slug' => $this->slug,
+ 'is_ssl' => is_ssl(),
+ 'fields' => array(
+ 'banners' => false, // These will be supported soon hopefully
+ 'reviews' => false
+ )
+ );
+
+ $api_response = $this->api_request( 'plugin_information', $to_send );
+
+ if ( false !== $api_response ) {
+ $_data = $api_response;
+ }
+
+ return $_data;
+ }
+
+
+ /**
+ * Disable SSL verification in order to prevent download update failures
+ *
+ * @param array $args
+ * @param string $url
+ * @return object $array
+ */
+ public function http_request_args( $args, $url ) {
+ // If it is an https request and we are performing a package download, disable ssl verification
+ if ( strpos( $url, 'https://' ) !== false && strpos( $url, 'edd_action=package_download' ) ) {
+ $args['sslverify'] = false;
+ }
+ return $args;
+ }
+
+ /**
+ * Calls the API and, if successfull, returns the object delivered by the API.
+ *
+ * @uses get_bloginfo()
+ * @uses wp_remote_post()
+ * @uses is_wp_error()
+ *
+ * @param string $_action The requested action.
+ * @param array $_data Parameters for the API action.
+ * @return false|object
+ */
+ private function api_request( $_action, $_data ) {
+
+ global $wp_version;
+
+ $data = array_merge( $this->api_data, $_data );
+
+ if ( $data['slug'] != $this->slug ) {
+ return;
+ }
+
+ if( $this->api_url == trailingslashit (home_url() ) ) {
+ return false; // Don't allow a plugin to ping itself
+ }
+
+ $api_params = array(
+ 'edd_action' => 'get_version',
+ 'license' => ! empty( $data['license'] ) ? $data['license'] : '',
+ 'item_name' => isset( $data['item_name'] ) ? $data['item_name'] : false,
+ 'item_id' => isset( $data['item_id'] ) ? $data['item_id'] : false,
+ 'slug' => $data['slug'],
+ 'author' => $data['author'],
+ 'url' => home_url()
+ );
+
+ $request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) );
+
+ if ( ! is_wp_error( $request ) ) {
+ $request = json_decode( wp_remote_retrieve_body( $request ) );
+ }
+
+ if ( $request && isset( $request->sections ) ) {
+ $request->sections = maybe_unserialize( $request->sections );
+ } else {
+ $request = false;
+ }
+
+ return $request;
+ }
+
+ public function show_changelog() {
+
+ global $edd_plugin_data;
+
+ if( empty( $_REQUEST['edd_sl_action'] ) || 'view_plugin_changelog' != $_REQUEST['edd_sl_action'] ) {
+ return;
+ }
+
+ if( empty( $_REQUEST['plugin'] ) ) {
+ return;
+ }
+
+ if( empty( $_REQUEST['slug'] ) ) {
+ return;
+ }
+
+ if( ! current_user_can( 'update_plugins' ) ) {
+ wp_die( __( 'You do not have permission to install plugin updates', 'easy-digital-downloads' ), __( 'Error', 'easy-digital-downloads' ), array( 'response' => 403 ) );
+ }
+
+ $data = $edd_plugin_data[ $_REQUEST['slug'] ];
+ $cache_key = md5( 'edd_plugin_' . sanitize_key( $_REQUEST['plugin'] ) . '_version_info' );
+ $version_info = get_transient( $cache_key );
+
+ if( false === $version_info ) {
+
+ $api_params = array(
+ 'edd_action' => 'get_version',
+ 'item_name' => isset( $data['item_name'] ) ? $data['item_name'] : false,
+ 'item_id' => isset( $data['item_id'] ) ? $data['item_id'] : false,
+ 'slug' => $_REQUEST['slug'],
+ 'author' => $data['author'],
+ 'url' => home_url()
+ );
+
+ $request = wp_remote_post( $this->api_url, array( 'timeout' => 15, 'sslverify' => false, 'body' => $api_params ) );
+
+ if ( ! is_wp_error( $request ) ) {
+ $version_info = json_decode( wp_remote_retrieve_body( $request ) );
+ }
+
+ if ( ! empty( $version_info ) && isset( $version_info->sections ) ) {
+ $version_info->sections = maybe_unserialize( $version_info->sections );
+ } else {
+ $version_info = false;
+ }
+
+ set_transient( $cache_key, $version_info, 3600 );
+
+ }
+
+ if( ! empty( $version_info ) && isset( $version_info->sections['changelog'] ) ) {
+ echo '' . $version_info->sections['changelog'] . '
';
+ }
+
+ exit;
+ }
+
+}
\ No newline at end of file
diff --git a/inc/common/translation.php b/inc/common/translation.php
index 54862e1..448e6b6 100644
--- a/inc/common/translation.php
+++ b/inc/common/translation.php
@@ -49,4 +49,4 @@ function wptxu_update_translation() {
die();
-}
\ No newline at end of file
+}
diff --git a/inc/functions/dates.php b/inc/functions/dates.php
deleted file mode 100755
index 90c895f..0000000
--- a/inc/functions/dates.php
+++ /dev/null
@@ -1,22 +0,0 @@
-ID, 'wptxu_project_type', true ); ?>
@@ -54,7 +54,7 @@ function wptxu_project_attributs( $post ) {
license );
+
+ if ( $license_data->license == 'valid' ) {
+
+ set_transient( '_wptxu_license_data', $license_data, DAY_IN_SECONDS );
+ delete_transient( '_wptxu_license_error' );
+ echo wptxu_action_remove_license( $license_data->expires );
+
+ } else {
+
+ set_transient( '_wptxu_license_error', $license_data->error );
+ echo ' '. wptxu_ajax_notices() .'
';
+
+ }
+
+ die();
+
+}
+add_action( 'wp_ajax_wptxu_activate_license', 'wptxu_activate_license' );
+
+/**
+ * Deactivate license
+ *
+ * @since 1.0.4
+ */
+function wptxu_deactivate_license() {
+
+ $license = get_option( 'wptxu_sl_key' );
+ $nonce = $_POST['wptxu_nonce'];
+
+ // run a quick security check
+ if ( ! wp_verify_nonce( $nonce, 'wptxu-nonce' ) ) {
+ wp_die( __( 'Cheatin’ uh?', 'wpt-tx-updater' ) );
+ }
+
+ $license_data = wptxu_sl_call( 'deactivate_license', $license );
+
+ if ( $license_data->license == 'deactivated' ) {
+
+ delete_option( 'wptxu_sl_key' );
+ delete_option( 'wptxu_license_status' );
+ delete_transient( '_wptxu_license_data' );
+ delete_transient( '_wptxu_license_error' );
+
+ }
+
+ die();
+}
+add_action( 'wp_ajax_wptxu_deactivate_license', 'wptxu_deactivate_license' );
diff --git a/inc/functions/parse-readme.php b/inc/functions/parse-readme.php
deleted file mode 100755
index 8408b3a..0000000
--- a/inc/functions/parse-readme.php
+++ /dev/null
@@ -1,2 +0,0 @@
-\n"
"Language-Team: FX Bénard \n"
"Language: fr_FR\n"
@@ -135,6 +135,45 @@ msgstr "Description du type de contenu"
msgid "Check for update..."
msgstr "Rechercher des mises à jour…"
+#: inc/admin/enqueue.php:13
+msgid "License deactivate"
+msgstr "Licence désactivée"
+
+#: inc/admin/enqueue.php:14
+msgid "Please try again soon."
+msgstr "Veuillez réessayer plus tard."
+
+#: inc/admin/ui/actions.php:12
+msgid "Activate License"
+msgstr "Activer la licence"
+
+#: inc/admin/ui/actions.php:28
+msgid "License key never expires."
+msgstr "La clé de licence n’expire jamais."
+
+#: inc/admin/ui/actions.php:31
+#, php-format
+msgid ""
+"Your license key expires soon! It expires on %s. Renew your license key."
+msgstr ""
+"Votre clé de licence expire bientôt ! Elle expire le %s. N’oubliez pas de la "
+"renouveler."
+
+#: inc/admin/ui/actions.php:37
+#, php-format
+msgid "Your license key expires on %s."
+msgstr "Votre clé de licence expire le %s."
+
+#: inc/admin/ui/actions.php:44
+msgid "License active"
+msgstr "Licence activée"
+
+#: inc/admin/ui/actions.php:46
+msgid "Deactivate License"
+msgstr "Désactiver la licence"
+
#: inc/admin/ui/meta-boxes.php:12
msgid "transifex API"
msgstr "transifex API"
@@ -168,66 +207,153 @@ msgstr ""
"Projet introuvable, le projet transifex et le projet en local doivent avoir "
"le même identifiant."
-#: inc/admin/ui/options.php:15
+#: inc/admin/ui/notices.php:64
+#, php-format
+msgid ""
+"Your license key expired. Please renew your license key."
+msgstr ""
+"Votre clé de licence est expiré. Veuillez la renouveler."
+
+#: inc/admin/ui/notices.php:71
+#, php-format
+msgid ""
+"Invalid license. Please visit your account page and verify it."
+msgstr ""
+"License non valide. Veuillez vous rendre sur la page de votre compte et la "
+"vérifier."
+
+#: inc/admin/ui/notices.php:78
+#, php-format
+msgid ""
+"There was a problem activating your license key, please try again or contact "
+"support. Error code: %s"
+msgstr ""
+"Une erreur s’est produite lors de l’activation de votre clé de licence, "
+"veuillez réessayer ou contactez le support. Code d’erreur : %s"
+
+#: inc/admin/ui/notices.php:82
+msgid "This license does not belong to the product you have entered it for."
+msgstr ""
+"Cette licence ne correspond pas au produit pour lequel vous l’avez saisi."
+
+#: inc/admin/ui/notices.php:86
+#, php-format
+msgid ""
+"Your license key has reached its activation limit. View "
+"possible upgrades now."
+msgstr ""
+"Votre clé de licence à atteint sa limite d’activation. Voir "
+"les différentes possibilités de mise à niveau maintenant."
+
+#: inc/admin/ui/options.php:24
+msgid "License key"
+msgstr "Clé de licence"
+
+#: inc/admin/ui/options.php:28
+msgid "Please enter your WPT transifex updater license key."
+msgstr "Veuillez saisir votre clé de licence de WPT transifex updater."
+
+#: inc/admin/ui/options.php:58
msgid "transifex Account Informations"
msgstr "Informations du compte transifex"
-#: inc/admin/ui/options.php:22
+#: inc/admin/ui/options.php:65
msgid "transifex Username"
msgstr "Nom d’utilisateur de transifex"
-#: inc/admin/ui/options.php:26
+#: inc/admin/ui/options.php:69
msgid "Please enter your transifex username."
msgstr "Veuillez saisir votre nom d’utilisateur de transifex."
-#: inc/admin/ui/options.php:31
+#: inc/admin/ui/options.php:74
msgid "transifex Password"
msgstr "Mot de passe de transifex"
-#: inc/admin/ui/options.php:35
+#: inc/admin/ui/options.php:78
msgid "Please enter your transifex password."
msgstr "Veuillez saisir votre mot de passe de transifex."
-#: inc/admin/ui/options.php:42
+#: inc/admin/ui/options.php:85
msgid "Connected as: "
msgstr "Connecté en tant que : "
-#: inc/admin/ui/options.php:44
+#: inc/admin/ui/options.php:87
msgid "Logout"
msgstr "Déconnexion"
-#: inc/classes/wptxu-translation.php:50
+#: inc/api/wptxu-sl-api.php:39
+#, php-format
+msgid ""
+""
+"span>There is a problem with remote site, please try again. %s
"
+msgstr ""
+"Une "
+"erreur s’est produite avec le serveur distant, merci de réessayer "
+"ultérieurement. %s
"
+
+#: inc/classes/wptxu-translation.php:48
msgid "Translation folder created."
msgstr "Le dossier de traduction a été créé."
-#: inc/classes/wptxu-translation.php:63
+#: inc/classes/wptxu-translation.php:61
msgid "Import po file on local filesystem."
msgstr "Importation du fichier .po sur le système."
-#: inc/classes/wptxu-translation.php:71
+#: inc/classes/wptxu-translation.php:69
msgid "Create mo file on local filesystem."
msgstr "Création du fichier . mo sur le système."
-#: inc/classes/wptxu-translation.php:82
+#: inc/classes/wptxu-translation.php:80
msgid "Create readme file on local filesystem."
msgstr "Création du fichier readme sur le système."
-#: inc/classes/wptxu-translation.php:94
+#: inc/classes/wptxu-translation.php:92
msgid "Translation is up to date!"
msgstr "La traduction est à jour !"
-#: inc/classes/wptxu-translation.php:99
+#: inc/classes/wptxu-translation.php:97
msgid "Translation update available!"
msgstr "Mise à jour de traduction disponible !"
-#: inc/classes/wptxu-translation.php:99
+#: inc/classes/wptxu-translation.php:97
msgid "Locale translation"
msgstr "Traduction locale"
-#: inc/classes/wptxu-translation.php:99
+#: inc/classes/wptxu-translation.php:97
msgid "transifex translation"
msgstr "traduction transifex"
+#: inc/classes/wptxu-updater.php:186
+#, php-format
+msgid ""
+"There is a new version of %1$s available. %2$sView version %3$s details%4$s."
+msgstr ""
+"Une nouvelle version de %1$s est disponible. %2$sAfficher les détails%4$s de "
+"la version %3$s."
+
+#: inc/classes/wptxu-updater.php:194
+#, php-format
+msgid ""
+"There is a new version of %1$s available. %2$sView version %3$s details%4$s "
+"or %5$supdate now%6$s."
+msgstr ""
+"Une nouvelle version de %1$s est disponible. %2$sAfficher les détails%4$s de "
+"la version %3$s ou %5$smettez à jour maintenant%6$s."
+
+#: inc/classes/wptxu-updater.php:337
+msgid "You do not have permission to install plugin updates"
+msgstr ""
+"Vous n’avez pas les droits suffisants pour installer les mises à jour de "
+"l’extension."
+
+#: inc/classes/wptxu-updater.php:337
+msgid "Error"
+msgstr "Erreur"
+
#: inc/common/admin-bar.php:30
msgid "Settings"
msgstr "Réglages"
@@ -240,7 +366,8 @@ msgstr "Mettre à jour la traduction"
msgid "Translation for: "
msgstr "Traduction pour : "
-#: inc/common/translation.php:18
+#: inc/common/translation.php:18 inc/functions/license.php:15
+#: inc/functions/license.php:52
msgid "Cheatin’ uh?"
msgstr "Une mauvaise manipulation ?"
@@ -265,8 +392,8 @@ msgid "Custom .mo filename"
msgstr "Nom de fichier .mo personnalisé"
#. Plugin Name of the plugin/theme
-msgid "WP Transifex Updater"
-msgstr "WP transifex Updater"
+msgid "WP transifex updater"
+msgstr "WP transifex updater"
#. Plugin URI of the plugin/theme
#. Author URI of the plugin/theme
diff --git a/languages/wpt-tx-updater.pot b/languages/wpt-tx-updater.pot
index ffad77b..38d8236 100644
--- a/languages/wpt-tx-updater.pot
+++ b/languages/wpt-tx-updater.pot
@@ -3,7 +3,7 @@ msgid ""
msgstr ""
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
"Project-Id-Version: WP Transifex Updater\n"
-"POT-Creation-Date: 2016-06-14 14:18+0200\n"
+"POT-Creation-Date: 2016-06-16 10:08+0200\n"
"PO-Revision-Date: 2016-06-09 09:53+0200\n"
"Last-Translator: FX Bénard \n"
"Language-Team: FX Bénard \n"
@@ -135,6 +135,42 @@ msgstr ""
msgid "Check for update..."
msgstr ""
+#: inc/admin/enqueue.php:13
+msgid "License deactivate"
+msgstr ""
+
+#: inc/admin/enqueue.php:14
+msgid "Please try again soon."
+msgstr ""
+
+#: inc/admin/ui/actions.php:12
+msgid "Activate License"
+msgstr ""
+
+#: inc/admin/ui/actions.php:28
+msgid "License key never expires."
+msgstr ""
+
+#: inc/admin/ui/actions.php:31
+#, php-format
+msgid ""
+"Your license key expires soon! It expires on %s. Renew your license key."
+msgstr ""
+
+#: inc/admin/ui/actions.php:37
+#, php-format
+msgid "Your license key expires on %s."
+msgstr ""
+
+#: inc/admin/ui/actions.php:44
+msgid "License active"
+msgstr ""
+
+#: inc/admin/ui/actions.php:46
+msgid "Deactivate License"
+msgstr ""
+
#: inc/admin/ui/meta-boxes.php:12
msgid "transifex API"
msgstr ""
@@ -162,66 +198,135 @@ msgid ""
"slug."
msgstr ""
-#: inc/admin/ui/options.php:15
+#: inc/admin/ui/notices.php:64
+#, php-format
+msgid ""
+"Your license key expired. Please renew your license key."
+msgstr ""
+
+#: inc/admin/ui/notices.php:71
+#, php-format
+msgid ""
+"Invalid license. Please visit your account page and verify it."
+msgstr ""
+
+#: inc/admin/ui/notices.php:78
+#, php-format
+msgid ""
+"There was a problem activating your license key, please try again or "
+"contact support. Error code: %s"
+msgstr ""
+
+#: inc/admin/ui/notices.php:82
+msgid "This license does not belong to the product you have entered it for."
+msgstr ""
+
+#: inc/admin/ui/notices.php:86
+#, php-format
+msgid ""
+"Your license key has reached its activation limit. View "
+"possible upgrades now."
+msgstr ""
+
+#: inc/admin/ui/options.php:24
+msgid "License key"
+msgstr ""
+
+#: inc/admin/ui/options.php:28
+msgid "Please enter your WPT transifex updater license key."
+msgstr ""
+
+#: inc/admin/ui/options.php:58
msgid "transifex Account Informations"
msgstr ""
-#: inc/admin/ui/options.php:22
+#: inc/admin/ui/options.php:65
msgid "transifex Username"
msgstr ""
-#: inc/admin/ui/options.php:26
+#: inc/admin/ui/options.php:69
msgid "Please enter your transifex username."
msgstr ""
-#: inc/admin/ui/options.php:31
+#: inc/admin/ui/options.php:74
msgid "transifex Password"
msgstr ""
-#: inc/admin/ui/options.php:35
+#: inc/admin/ui/options.php:78
msgid "Please enter your transifex password."
msgstr ""
-#: inc/admin/ui/options.php:42
+#: inc/admin/ui/options.php:85
msgid "Connected as: "
msgstr ""
-#: inc/admin/ui/options.php:44
+#: inc/admin/ui/options.php:87
msgid "Logout"
msgstr ""
-#: inc/classes/wptxu-translation.php:50
+#: inc/api/wptxu-sl-api.php:39
+#, php-format
+msgid ""
+""
+"span>There is a problem with remote site, please try again. %s
"
+msgstr ""
+
+#: inc/classes/wptxu-translation.php:48
msgid "Translation folder created."
msgstr ""
-#: inc/classes/wptxu-translation.php:63
+#: inc/classes/wptxu-translation.php:61
msgid "Import po file on local filesystem."
msgstr ""
-#: inc/classes/wptxu-translation.php:71
+#: inc/classes/wptxu-translation.php:69
msgid "Create mo file on local filesystem."
msgstr ""
-#: inc/classes/wptxu-translation.php:82
+#: inc/classes/wptxu-translation.php:80
msgid "Create readme file on local filesystem."
msgstr ""
-#: inc/classes/wptxu-translation.php:94
+#: inc/classes/wptxu-translation.php:92
msgid "Translation is up to date!"
msgstr ""
-#: inc/classes/wptxu-translation.php:99
+#: inc/classes/wptxu-translation.php:97
msgid "Translation update available!"
msgstr ""
-#: inc/classes/wptxu-translation.php:99
+#: inc/classes/wptxu-translation.php:97
msgid "Locale translation"
msgstr ""
-#: inc/classes/wptxu-translation.php:99
+#: inc/classes/wptxu-translation.php:97
msgid "transifex translation"
msgstr ""
+#: inc/classes/wptxu-updater.php:186
+#, php-format
+msgid ""
+"There is a new version of %1$s available. %2$sView version %3$s details"
+"%4$s."
+msgstr ""
+
+#: inc/classes/wptxu-updater.php:194
+#, php-format
+msgid ""
+"There is a new version of %1$s available. %2$sView version %3$s details"
+"%4$s or %5$supdate now%6$s."
+msgstr ""
+
+#: inc/classes/wptxu-updater.php:337
+msgid "You do not have permission to install plugin updates"
+msgstr ""
+
+#: inc/classes/wptxu-updater.php:337
+msgid "Error"
+msgstr ""
+
#: inc/common/admin-bar.php:30
msgid "Settings"
msgstr ""
@@ -234,7 +339,8 @@ msgstr ""
msgid "Translation for: "
msgstr ""
-#: inc/common/translation.php:18
+#: inc/common/translation.php:18 inc/functions/license.php:15
+#: inc/functions/license.php:52
msgid "Cheatin’ uh?"
msgstr ""
@@ -259,7 +365,7 @@ msgid "Custom .mo filename"
msgstr ""
#. Plugin Name of the plugin/theme
-msgid "WP Transifex Updater"
+msgid "WP transifex updater"
msgstr ""
#. Plugin URI of the plugin/theme
diff --git a/uninstall.php b/uninstall.php
index 9765b82..d2aa3a6 100755
--- a/uninstall.php
+++ b/uninstall.php
@@ -8,4 +8,12 @@
// Delete all project meta related to WPT Transifex Updater
delete_metadata( 'post', '', 'wptxu_project_type', '', true );
-delete_metadata( 'post', '', 'wptxu_mo_filename', '', true );
\ No newline at end of file
+delete_metadata( 'post', '', 'wptxu_mo_filename', '', true );
+
+// Delete plugin transients.
+delete_transient( '_wptxu_license_data' );
+delete_transient( '_wptxu_license_error' );
+
+// Delete plugin options.
+delete_option( 'wptxu_sl_key' );
+delete_option( 'wptxu_license_status' );
diff --git a/wpt-tx-updater.php b/wpt-tx-updater.php
index 73d9396..578a9eb 100755
--- a/wpt-tx-updater.php
+++ b/wpt-tx-updater.php
@@ -1,6 +1,6 @@
WPTXU_VERSION,
+ 'license' => $license_key,
+ 'item_name' => WPTXU_SLUG,
+ 'author' => 'G3ronim0',
+ )
+ );
+
+}
+add_action( 'admin_init', 'wptxu_updater', 0 );
/**
* Load plugin textdomain
@@ -131,6 +158,11 @@ function wptxu_activation() {
}
+/*
+ * Tell WP what to do when plugin is deactivated
+ *
+ * @since 1.0.0
+ */
register_deactivation_hook( __FILE__, 'wptxu_deactivate' );
function wptxu_deactivate() {
flush_rewrite_rules();