PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 18.4
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v18.4
28.5 28.4 28.3 28.2 28.1 28.0 27.9 27.8 27.7 27.6 27.5 trunk 18.0 18.1 18.2 18.3 18.4 18.4.1 18.5 18.5.1 18.6 18.7 18.8 18.9 19.0 All 129 releases
wordpress-seo / vendor / wordproof / wordpress-sdk / app / Controllers / CertificateController.php

CertificateController.php in Yoast SEO – Advanced SEO with real-time guidance and built-in AI 18.4, at vendor/wordproof/wordpress-sdk/app/Controllers/CertificateController.php

80 lines 2.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace WordProof\SDK\Controllers;
4
5 use WordProof\SDK\Helpers\AssetHelper;
6 use WordProof\SDK\Helpers\CertificateHelper;
7 use WordProof\SDK\Helpers\EnvironmentHelper;
8 use WordProof\SDK\Helpers\PostMetaHelper;
9 use WordProof\SDK\Helpers\SettingsHelper;
10
11 class CertificateController
12 {
13 /**
14 * Enqueue the uikit script.
15 *
16 * @action wp_head
17 */
18 public function enqueue()
19 {
20 if (CertificateHelper::show()) {
21 AssetHelper::enqueue('uikit');
22 }
23 }
24
25 /**
26 * Add scripts and schema to the head of the current page.
27 *
28 * @action wp_head
29 */
30 public function head()
31 {
32 if (!CertificateHelper::show()) {
33 return;
34 }
35
36 global $post;
37
38 $schema = "\n";
39 $schema .= '<script type="application/ld+json" class="' . esc_attr('wordproof-schema-graph') . '">';
40 $schema .= json_encode(PostMetaHelper::get($post->ID, '_wordproof_schema'), JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
41 $schema .= "</script>";
42 $schema .= "\n";
43
44 // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
45 echo $schema;
46 }
47
48 /**
49 * Adds the certificate tag to the content before rendering it.
50 *
51 * @param $content
52 * @return mixed|string Content string from 'the_content' filter
53 * @filter the_content
54 */
55 public function certificateTag($content)
56 {
57 if (!CertificateHelper::show()) {
58 return $content;
59 }
60
61 if (SettingsHelper::hideCertificateLink()) {
62 return $content;
63 }
64
65 global $post;
66 $identifier = $post->ID;
67
68 $text = SettingsHelper::certificateLinkText();
69 $showRevisions = SettingsHelper::showRevisions() ? 'true' : 'false';
70 $debug = EnvironmentHelper::development() ? 'true' : 'false';
71 $lastModified = get_the_modified_date('c', $post->ID);
72
73 $content.= "\n" . '<w-certificate debug="' . $debug . '" shared-identifier="' . $identifier . '" render-without-button="true" show-revisions="' . $showRevisions . '" last-modified="' . $lastModified . '"></w-certificate>';
74 $content.= "\n" . '<p><w-certificate-button shared-identifier="' . $identifier . '" icon="shield" shape="text" text="' . $text . '"></w-certificate-button></p>';
75 $content.= "\n";
76
77 return $content;
78 }
79 }
80