Skip to content

Commit

Permalink
fix: url format for license endpoint, improve changelog handling and …
Browse files Browse the repository at this point in the history
…license checks
  • Loading branch information
selul committed Aug 12, 2019
1 parent be119c1 commit a492c68
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 9 deletions.
16 changes: 8 additions & 8 deletions src/Modules/Licenser.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,10 @@ public function license_view() {
-webkit-border-radius: 3px;
border-radius: 3px;
}
button.button.themeisle-sdk-licenser-button-cta{

button.button.themeisle-sdk-licenser-button-cta {
line-height: 26px;
height:29px;
height: 29px;
vertical-align: top;
}

Expand Down Expand Up @@ -493,7 +494,7 @@ function update_nag() {
'<strong>%1$s %2$s</strong> is available. <a href="%3$s" class="thickbox" title="%4s">Check out what\'s new</a> or <a href="%5$s"%6$s>update now</a>.',
$theme->get( 'Name' ),
$api_response->new_version,
'#TB_inline?width=640&amp;inlineId=' . $this->product->get_version() . '_changelog',
sprintf( '%s&TB_iframe=true&amp;width=1024&amp;height=800', $this->product->get_changelog() ),
$theme->get( 'Name' ),
$update_url,
$update_onclick
Expand Down Expand Up @@ -566,18 +567,17 @@ private function get_version_data() {
$api_params = array(
'edd_action' => 'get_version',
'version' => $this->product->get_version(),
'license' => $this->license_key,
'name' => $this->product->get_name(),
'license' => empty( $this->license_key ) ? 'free' : '',
'name' => rawurlencode( $this->product->get_name() ),
'slug' => $this->product->get_slug(),
'author' => $this->get_distributor_name(),
'author' => rawurlencode( $this->get_distributor_name() ),
'url' => rawurlencode( home_url() ),
);
$response = wp_remote_get(
$this->get_api_url(),
add_query_arg( $api_params, $this->get_api_url() ),
array(
'timeout' => 15,
'sslverify' => false,
'body' => $api_params,
)
);
if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) {
Expand Down
17 changes: 16 additions & 1 deletion src/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ public function get_store_name() {
public function get_store_url() {

if ( strpos( $this->store_url, '/themeisle.com' ) !== false ) {
return 'https://store.themeisle.com';
return 'https://store.themeisle.com/';
}

return $this->store_url;
Expand All @@ -360,6 +360,21 @@ public function get_basefile() {
return $this->basefile;
}

/**
* Get changelog url.
*
* @return string Changelog url.
*/
public function get_changelog() {
return add_query_arg(
[
'name' => rawurlencode( $this->get_name() ),
'edd_action' => 'view_changelog',
],
$this->get_store_url()
);
}

/**
* Returns product filename.
*
Expand Down

0 comments on commit a492c68

Please sign in to comment.