Skip to content

Commit

Permalink
fix: use wp_get_shortlink for wp_short_url option
Browse files Browse the repository at this point in the history
  • Loading branch information
Soare-Robert-Daniel committed Jul 16, 2024
1 parent 694f66d commit f40200f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 5 additions & 1 deletion includes/admin/abstract/class-rop-services-abstract.php
Original file line number Diff line number Diff line change
Expand Up @@ -346,10 +346,14 @@ protected function get_url( $post_details ) {
return '';
}

if ( empty( $post_details['short_url'] ) || empty( $post_details['short_url_service'] || 'wp_short_url' === $post_details['short_url_service'] ) ) {
if ( empty( $post_details['short_url'] ) || empty( $post_details['short_url_service'] ) ) {
return ' ' . $post_details['post_url'];
}

if ( 'wp_short_url' === $post_details['short_url_service'] ) {
return ' ' . wp_get_shortlink( $post_details['post_id'] );
}

$post_format_helper = new Rop_Post_Format_Helper();

return ' ' . $post_format_helper->get_short_url( $post_details['post_url'], $post_details['short_url_service'], $post_details['shortner_credentials'] );
Expand Down
3 changes: 1 addition & 2 deletions includes/admin/helpers/class-rop-post-format-helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -1033,8 +1033,7 @@ public function build_image( $post_id ) {
*
* @return string
*/
public function get_short_url( $url, $short_url_service, $credentials = array() ) {
$shortner_factory = new Rop_Shortner_Factory();
public function get_short_url( $url, $short_url_service, $credentials = array() ) {

try {
$shortner_service = $shortner_factory->build( $short_url_service );
Expand Down

0 comments on commit f40200f

Please sign in to comment.