| 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 WP Meta SEO plugin. |
| 15 |
* |
| 16 |
* See https://wordpress.org/plugins/wp-meta-seo/. |
| 17 |
*/ |
| 18 |
if ( ! class_exists( 'WpssoIntegSeoWpMetaSeo' ) ) { |
| 19 |
|
| 20 |
class WpssoIntegSeoWpMetaSeo { |
| 21 |
|
| 22 |
private $p; // Wpsso class object. |
| 23 |
|
| 24 |
private $hs; |
| 25 |
private $hs_it; |
| 26 |
private $opts = null; |
| 27 |
|
| 28 |
public function __construct( &$plugin ) { |
| 29 |
|
| 30 |
$this->p =& $plugin; |
| 31 |
|
| 32 |
if ( $this->p->debug->enabled ) { |
| 33 |
|
| 34 |
$this->p->debug->mark(); |
| 35 |
} |
| 36 |
|
| 37 |
$this->p->util->add_plugin_filters( $this, array( |
| 38 |
'title_seed' => 5, |
| 39 |
'description_seed' => 4, |
| 40 |
), 100 ); |
| 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_post' ] ) { |
| 51 |
|
| 52 |
$meta_key = '_metaseo_metatitle'; |
| 53 |
|
| 54 |
} elseif ( $mod[ 'is_term' ] ) { |
| 55 |
|
| 56 |
$meta_key = 'wpms_category_metatitle'; |
| 57 |
|
| 58 |
} else { // Nothing to do. |
| 59 |
|
| 60 |
return $title_text; |
| 61 |
} |
| 62 |
|
| 63 |
return WpssoAbstractWpMeta::get_mod_meta( $mod, $meta_key, $single = true ); |
| 64 |
} |
| 65 |
|
| 66 |
public function filter_description_seed( $desc_text, $mod, $num_hashtags, $md_key ) { |
| 67 |
|
| 68 |
if ( $this->p->debug->enabled ) { |
| 69 |
|
| 70 |
$this->p->debug->mark(); |
| 71 |
} |
| 72 |
|
| 73 |
if ( $mod[ 'is_post' ] ) { |
| 74 |
|
| 75 |
$meta_key = '_metaseo_metadesc'; |
| 76 |
|
| 77 |
} elseif ( $mod[ 'is_term' ] ) { |
| 78 |
|
| 79 |
$meta_key = 'wpms_category_metadesc'; |
| 80 |
|
| 81 |
} else { // Nothing to do. |
| 82 |
|
| 83 |
return $desc_text; |
| 84 |
} |
| 85 |
|
| 86 |
return WpssoAbstractWpMeta::get_mod_meta( $mod, $meta_key, $single = true ); |
| 87 |
} |
| 88 |
} |
| 89 |
} |
| 90 |
|