| @@ -11,11 +11,12 @@ | ||
| 11 | 11 | |
| 12 | 12 | namespace Parsely\UI; |
| 13 | 13 | |
| 14 | 14 | use Parsely\Parsely; |
| 15 | -use Parsely\Utils\Utils; | |
| 16 | 15 | use WP_Widget; |
| 17 | 16 | |
| 17 | +use function Parsely\Utils\get_asset_info; | |
| 18 | + | |
| 18 | 19 | use const Parsely\PARSELY_FILE; |
| 19 | 20 | |
| 20 | 21 | /** |
| 21 | 22 | * Provides a widget with Parse.ly recommended articles. |
| @@ -91,9 +92,9 @@ | ||
| 91 | 92 | * @param int $return_limit Number of records to retrieve; defaults to "10". |
| 92 | 93 | * @return string API URL. |
| 93 | 94 | */ |
| 94 | 95 | private function get_api_url( string $site_id, ?int $published_within, ?string $sort, int $return_limit ): string { |
| 95 | - $related_api_endpoint = $this->parsely->get_content_api()->get_endpoint( '/related' ); | |
| 96 | + $related_api_endpoint = Parsely::PUBLIC_API_BASE_URL . '/related'; | |
| 96 | 97 | |
| 97 | 98 | $query_args = array( |
| 98 | 99 | 'apikey' => $site_id, |
| 99 | 100 | 'sort' => $sort, |
| @@ -103,9 +104,9 @@ | ||
| 103 | 104 | if ( null !== $published_within && 0 !== $published_within ) { |
| 104 | 105 | $query_args['pub_date_start'] = $published_within . 'd'; |
| 105 | 106 | } |
| 106 | 107 | |
| 107 | - return $related_api_endpoint->get_endpoint_url( $query_args ); | |
| 108 | + return add_query_arg( $query_args, $related_api_endpoint ); | |
| 108 | 109 | } |
| 109 | 110 | |
| 110 | 111 | /** |
| 111 | 112 | * This is the widget function. |
| @@ -152,9 +153,9 @@ | ||
| 152 | 153 | ></div> |
| 153 | 154 | |
| 154 | 155 | <?php |
| 155 | 156 | |
| 156 | - $recommended_widget_script_asset = Utils::get_asset_info( 'build/recommended-widget.asset.php' ); | |
| 157 | + $recommended_widget_script_asset = get_asset_info( 'build/recommended-widget.asset.php' ); | |
| 157 | 158 | |
| 158 | 159 | wp_register_script( |
| 159 | 160 | 'wp-parsely-recommended-widget', |
| 160 | 161 | plugin_dir_url( PARSELY_FILE ) . 'build/recommended-widget.js', |