PluginProbe
Parse.ly / 3.24.3
Parse.ly v3.24.3
3.24.3 3.24.2 3.24.1 3.24.0 3.23.7 3.23.6 3.23.5 3.23.4 3.23.3 3.16.0 3.16.1 3.16.2 3.16.3 3.16.4 3.17.0 3.18.0 3.18.1 3.19.0 3.19.1 3.19.2 3.19.3 3.2.0 3.2.1 3.20.0 3.20.1 All 107 releases
← All changes | src/services/suggestions-api/endpoints/class-endpoint-suggest-linked-reference.php +6 -12 3.18.1 → 3.24.3 View file →
@@ -17,10 +17,8 @@
17 17 * The endpoint for the Suggest Linked Reference (Smart Links) API request.
18 18 *
19 19 * @since 3.17.0
20 20 *
21 - * @link https://content-suggestions-api.parsely.net/prod/docs#/default/suggest_linked_reference_suggest_linked_reference_post
22 - *
23 21 * @phpstan-type Traffic_Source = array{
24 22 * source: string,
25 23 * weight: float
26 24 * }
@@ -25,12 +23,12 @@
25 23 * weight: float
26 24 * }
27 25 *
28 26 * @phpstan-type Endpoint_Suggest_Linked_Reference_Options = array{
29 - * blending_weight?: float,
30 27 * max_items?: int,
31 28 * max_link_words?: int,
32 - * traffic_sources?: array<int, Traffic_Source>
29 + * traffic_sources?: array<int, Traffic_Source>,
30 + * url_exclusion_list?: array<string>
33 31 * }
34 32 */
35 33 class Endpoint_Suggest_Linked_Reference extends Suggestions_API_Base_Endpoint {
36 34 /**
@@ -52,16 +50,14 @@
52 50 * @since 3.17.0 Updated to use the new API service.
53 51 *
54 52 * @param string $content The content to generate links for.
55 53 * @param Endpoint_Suggest_Linked_Reference_Options $options The options to pass to the API request.
56 - * @param array<string> $url_exclusion_list A list of URLs to exclude from the suggestions.
57 54 * @return array<Smart_Link>|WP_Error The response from the remote API, or a WP_Error
58 55 * object if the response is an error.
59 56 */
60 57 public function get_links(
61 58 string $content,
62 - $options = array(),
63 - array $url_exclusion_list = array()
59 + $options = array()
64 60 ) {
65 61 $request_body = array(
66 62 'output_config' => array(
67 63 'max_link_words' => $options['max_link_words'] ?? 4,
@@ -69,10 +65,10 @@
69 65 ),
70 66 'text' => wp_strip_all_tags( $content ),
71 67 );
72 68
73 - if ( count( $url_exclusion_list ) > 0 ) {
74 - $request_body['url_exclusion_list'] = $url_exclusion_list;
69 + if ( isset( $options['url_exclusion_list'] ) && count( $options['url_exclusion_list'] ) > 0 ) {
70 + $request_body['url_exclusion_list'] = $options['url_exclusion_list'];
75 71 }
76 72
77 73 $response = $this->request( 'POST', array(), $request_body );
78 74
@@ -108,10 +104,8 @@
108 104 /** @var string $content */
109 105 $content = $args['content'] ?? '';
110 106 /** @var Endpoint_Suggest_Linked_Reference_Options $options */
111 107 $options = $args['options'] ?? array();
112 - /** @var string[] $url_exclusion_list */
113 - $url_exclusion_list = $args['url_exclusion_list'] ?? array();
114 108
115 - return $this->get_links( $content, $options, $url_exclusion_list );
109 + return $this->get_links( $content, $options );
116 110 }
117 111 }