PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / trunk
Yoast SEO – Advanced SEO with real-time guidance and built-in AI vtrunk
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
← All changes | src/services/importing/aioseo/aioseo-replacevar-service.php +9 -9 18.3 → trunk View file →
@@ -10,11 +10,11 @@
10 10
11 11 /**
12 12 * Mapping between the AiOSEO replace vars and the Yoast replace vars.
13 13 *
14 + * @see https://yoast.com/help/list-available-snippet-variables-yoast-seo/
15 + *
14 16 * @var array
15 - *
16 - * @see https://yoast.com/help/list-available-snippet-variables-yoast-seo/
17 17 */
18 18 protected $replace_vars_map = [
19 19 // The key is the AiOSEO replace var, the value is the Yoast replace var (see class-wpseo-replace-vars).
20 20 '#archive_title' => '%%archive_title%%',
@@ -54,9 +54,9 @@
54 54 *
55 55 * @param string $aioseo_var The AIOSEO replacevar.
56 56 * @param string $yoast_var The Yoast replacevar.
57 57 *
58 - * @return void.
58 + * @return void
59 59 */
60 60 public function compose_map( $aioseo_var, $yoast_var ) {
61 61 $map = $this->replace_vars_map;
62 62
@@ -75,23 +75,23 @@
75 75 public function transform( $aioseo_replacevar ) {
76 76 $yoast_replacevar = \str_replace( \array_keys( $this->replace_vars_map ), \array_values( $this->replace_vars_map ), $aioseo_replacevar );
77 77
78 78 // Transform the '#custom_field-<custom_field>' tags into '%%cf_<custom_field>%%' ones.
79 - $yoast_replacevar = preg_replace_callback(
79 + $yoast_replacevar = \preg_replace_callback(
80 80 '/#custom_field-([a-zA-Z0-9_-]+)/',
81 - function ( $cf_matches ) {
81 + static function ( $cf_matches ) {
82 82 return '%%cf_' . $cf_matches[1] . '%%';
83 83 },
84 - $yoast_replacevar
84 + $yoast_replacevar,
85 85 );
86 86
87 87 // Transform the '#tax_name-<custom-tax-name>' tags into '%%ct_<custom-tax-name>%%' ones.
88 - $yoast_replacevar = preg_replace_callback(
88 + $yoast_replacevar = \preg_replace_callback(
89 89 '/#tax_name-([a-zA-Z0-9_-]+)/',
90 - function ( $ct_matches ) {
90 + static function ( $ct_matches ) {
91 91 return '%%ct_' . $ct_matches[1] . '%%';
92 92 },
93 - $yoast_replacevar
93 + $yoast_replacevar,
94 94 );
95 95
96 96 return $yoast_replacevar;
97 97 }