Skip to content

Commit

Permalink
fix: add revly shortener processing in free
Browse files Browse the repository at this point in the history
  • Loading branch information
Soare-Robert-Daniel committed Jul 17, 2024
1 parent 43f4569 commit 24e994f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 10 deletions.
20 changes: 18 additions & 2 deletions includes/admin/shortners/class-rop-rvivly-shortner.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,23 @@ public function set_website( $website = false ) {
* @return string
*/
public function shorten_url( $url ) {
$instance = $this;
return apply_filters( 'rop_shorten_url', $url, 'rviv.ly', $this->website, $this->credentials, $instance );
$shortURL = $url;

$response = $this->callAPI(
'https://rviv.ly/yourls-api.php',
array( 'method' => 'post' ),
array( 'action' => 'shorturl', 'format' => 'simple', 'signature' => substr( md5( $this->website . md5( 'themeisle' ) ), 0, 10 ), 'url' => $url, 'website' => base64_encode( $this->website ) ),
null
);

$shortURL = $url;
if ( intval( $response['error'] ) == 200 ) {
$shortURL = $response['response'];
}
if ( $shortURL == null || $shortURL === '' ) {
$shortURL = $url;
}

return $shortURL;
}
}
16 changes: 8 additions & 8 deletions vue/src/vue-elements/post-format.vue
Original file line number Diff line number Diff line change
Expand Up @@ -470,15 +470,15 @@
</div>
</div>
<div
v-if="isNewUserPro && (post_format.short_url_service !== 'rviv.ly' && post_format.short_url_service !== 'wp_short_url')"
class="columns "
>
<div class="column text-center">
<p class="upsell">
<i class="fa fa-info-circle" /> {{ labels.hashtag_field_upsell }}
</p>
v-if="isNewUserPro && (post_format.short_url_service !== 'rviv.ly' && post_format.short_url_service !== 'wp_short_url')"
class="columns "
>
<div class="column text-center">
<p class="upsell">
<i class="fa fa-info-circle" /> {{ labels.hashtag_field_upsell }}
</p>
</div>
</div>
</div>
</template>


Expand Down

0 comments on commit 24e994f

Please sign in to comment.