PluginProbe
WPSSO Core – Complete Schema Markup and Meta Tags / 22.7.0
WPSSO Core – Complete Schema Markup and Meta Tags v22.7.0
22.7.0 22.6.1 22.6.0 22.5.3 22.5.2 22.5.1 22.4.0 22.3.0 22.2.1 22.2.0 22.1.3 22.1.2 22.1.1 22.1.0 22.0.0 21.13.3 21.13.2 trunk 21.13.1
wpsso / lib / integ / seo / aioseop.php

aioseop.php in WPSSO Core – Complete Schema Markup and Meta Tags 22.7.0, at lib/integ/seo/aioseop.php

114 lines 2.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /*
3 * License: GPLv3
4 * License URI: https://www.gnu.org/licenses/gpl.txt
5 * Copyright 2012-2026 Jean-Sebastien Morisset (https://wpsso.com/)
6 */
7
8 if ( ! defined( 'ABSPATH' ) ) {
9
10 die( 'These aren\'t the droids you\'re looking for.' );
11 }
12
13 /*
14 * Integration module for the All in One SEO plugin.
15 *
16 * See https://wordpress.org/plugins/all-in-one-seo-pack/.
17 */
18 if ( ! class_exists( 'WpssoIntegSeoAioseop' ) ) {
19
20 class WpssoIntegSeoAioseop {
21
22 private $p; // Wpsso class object.
23
24 private $cache_options;
25
26 public function __construct( &$plugin ) {
27
28 $this->p =& $plugin;
29
30 if ( $this->p->debug->enabled ) {
31
32 $this->p->debug->mark();
33 }
34
35 $this->p->util->add_plugin_filters( $this, array(
36 'title_seed' => 5,
37 'description_seed' => 4,
38 ), 100 );
39
40 add_filter( 'aioseo_schema_disable', '__return_true', 1000 );
41 }
42
43 public function filter_title_seed( $title_text, $mod, $num_hashtags, $md_key, $title_sep ) {
44
45 if ( $this->p->debug->enabled ) {
46
47 $this->p->debug->mark();
48 }
49
50 if ( $mod[ 'is_home_posts' ] ) { // Static posts page or blog archive page.
51
52 $title_text = aioseo()->meta->title->getHomePageTitle();
53
54 } elseif ( $mod[ 'is_post' ] ) {
55
56 $post_obj = SucomUtilWP::get_post_object( $mod[ 'id' ] );
57
58 $title_text = aioseo()->meta->title->getPostTitle( $post_obj );
59
60 } elseif ( $mod[ 'is_term' ] ) {
61
62 $term_obj = SucomUtilWP::get_term_object( $mod[ 'id' ] );
63
64 $title_text = aioseo()->meta->title->getTermTitle( $term_obj );
65 }
66
67 $title_text = $this->maybe_convert_vars( $title_text, $mod );
68
69 return $title_text;
70 }
71
72 public function filter_description_seed( $desc_text, $mod, $num_hashtags, $md_key ) {
73
74 if ( $this->p->debug->enabled ) {
75
76 $this->p->debug->mark();
77 }
78
79 if ( $mod[ 'is_home_posts' ] ) { // Static posts page or blog archive page.
80
81 $desc_text = aioseo()->meta->description->getHomePageDescription();
82
83 } elseif ( $mod[ 'is_post' ] ) {
84
85 $post_obj = SucomUtilWP::get_post_object( $mod[ 'id' ] );
86
87 $desc_text = aioseo()->meta->description->getPostDescription( $post_obj );
88
89 } elseif ( $mod[ 'is_term' ] ) {
90
91 $term_obj = SucomUtilWP::get_term_object( $mod[ 'id' ] );
92
93 $desc_text = aioseo()->meta->description->getTermDescription( $term_obj );
94 }
95
96 $desc_text = $this->maybe_convert_vars( $desc_text, $mod );
97
98 return $desc_text;
99 }
100
101 private function maybe_convert_vars( $value, array $mod ) {
102
103 if ( false !== strpos( $value, '#' ) ) {
104
105 $value = preg_replace( '/(^| )#([^#]+)( |$)/', '%%$2%%', $value ); // Convert inline variable names.
106
107 $value = $this->p->util->inline->replace_variables( $value, $mod );
108 }
109
110 return $value;
111 }
112 }
113 }
114