PluginProbe
Parse.ly / 3.14.1
Parse.ly v3.14.1
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 3.20.2 3.20.3 All 105 releases
← All changes | src/Endpoints/class-metadata-endpoint.php +11 -11 3.2.13.14.1 View file →
@@ -1,10 +1,10 @@
1 1 <?php
2 2 /**
3 - * Metadata endpoint abstract class
3 + * Endpoints: Metadata endpoint abstract class
4 4 *
5 - * @package Parsely\Endpoints
6 - * @since 3.2.0
5 + * @package Parsely
6 + * @since 3.2.0
7 7 */
8 8
9 9 declare(strict_types=1);
10 10
@@ -10,11 +10,13 @@
10 10
11 11 namespace Parsely\Endpoints;
12 12
13 13 use Parsely\Parsely;
14 +use Parsely\UI\Metadata_Renderer;
14 15
15 16 /**
16 - * Metadata endpoint classes are expected to implement the remaining functions of the class.
17 + * Metadata endpoint classes are expected to implement the remaining functions
18 + * of the class.
17 19 *
18 20 * @since 3.2.0
19 21 */
20 22 abstract class Metadata_Endpoint {
@@ -36,13 +38,11 @@
36 38 $this->parsely = $parsely;
37 39 }
38 40
39 41 /**
40 - * Function to start up the class and enqueue necessary actions.
42 + * Starts up the class and enqueues necessary actions.
41 43 *
42 44 * @since 3.2.0
43 - *
44 - * @return void
45 45 */
46 46 abstract public function run(): void;
47 47
48 48 /**
@@ -48,15 +48,13 @@
48 48 /**
49 49 * Registers the metadata fields on the appropriate resource types.
50 50 *
51 51 * @since 3.2.0
52 - *
53 - * @return void
54 52 */
55 53 abstract public function register_meta(): void;
56 54
57 55 /**
58 - * Get the metadata in string format.
56 + * Returns the metadata in string format.
59 57 *
60 58 * @since 3.2.0
61 59 *
62 60 * @param string $meta_type `json_ld` or `repeated_metas`.
@@ -62,10 +60,12 @@
62 60 * @param string $meta_type `json_ld` or `repeated_metas`.
63 61 * @return string The metadata as HTML code.
64 62 */
65 63 public function get_rendered_meta( string $meta_type ): string {
64 + $metadata_renderer = new Metadata_Renderer( $this->parsely );
65 +
66 66 ob_start();
67 - $this->parsely->render_metadata( $meta_type );
67 + $metadata_renderer->render_metadata( $meta_type );
68 68 $out = ob_get_clean();
69 69
70 70 if ( false === $out ) {
71 71 return '';