Diff: STRATO-apps/wordpress_03/app/wp-content/plugins/login-customizer/src/Includes/Compatibility.php
Keine Baseline-Datei – Diff nur gegen leer.
1
-
1
+
<?php
2
+
3
+
/**
4
+
* Plugin Compatibility
5
+
*
6
+
* @package LoginCustomizer\Includes
7
+
* @author WPBrigade
8
+
* @copyright Copyright (c) 2023, WPBrigade
9
+
* @link https://loginpress.pro/
10
+
* @license https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
11
+
*/
12
+
namespace LoginCustomizer\Includes;
13
+
14
+
class Compatibility {
15
+
16
+
public function __construct() {
17
+
$this->hooks();
18
+
}
19
+
20
+
/**
21
+
* The compatibility hooks
22
+
*
23
+
* @return void
24
+
*/
25
+
public function hooks() {
26
+
if ( function_exists( 'is_plugin_active' ) ) {
27
+
if ( is_plugin_active( 'wordpress-seo/wp-seo.php' ) ) {
28
+
/**
29
+
* This filters the ID of the page/post which you want to remove from the sitemap XML.
30
+
*
31
+
* @since 2.3.2
32
+
*
33
+
* @documentation https://developer.yoast.com/features/xml-sitemaps/api/
34
+
*/
35
+
add_filter( 'wpseo_exclude_from_sitemap_by_post_ids', array( $this, 'logincust_wpseo_exclude_from_sitemap' ), 10 );
36
+
} else {
37
+
add_filter( 'wp_sitemaps_posts_query_args', array( $this, 'logincust_exclude_from_sitemap' ), 10, 2 );
38
+
}
39
+
40
+
if ( is_plugin_active( 'seo-by-rank-math/rank-math.php' ) ) {
41
+
add_filter( 'rank_math/sitemap/posts_to_exclude', array( $this, 'logincust_exclude_from_rankmath_sitemap' ), 10, 1 );
42
+
}
43
+
}
44
+
}
45
+
46
+
47
+
/**
48
+
* Callback function to exclude Login Customizer page from sitemap.
49
+
*
50
+
* @return bool Exclude page/s or post/s.
51
+
* @since 2.3.2
52
+
*/
53
+
public function logincust_exclude_from_sitemap( $args, $post_type ) {
54
+
if ( 'page' !== $post_type ) {
55
+
return $args;
56
+
}
57
+
58
+
$page = get_page_by_path( 'login-customizer' );
59
+
if ( is_object( $page ) ) {
60
+
61
+
$args['post__not_in'] = isset( $args['post__not_in'] ) ? $args['post__not_in'] : array();
62
+
63
+
$args['post__not_in'][] = $page->ID;
64
+
}
65
+
return $args;
66
+
}
67
+
68
+
/**
69
+
* Callback function to exclude Login Customizer page from sitemap.
70
+
*
71
+
* @return bool Exclude page/s or post/s.
72
+
* @since 2.3.2
73
+
*/
74
+
public function logincust_wpseo_exclude_from_sitemap() {
75
+
$page = get_page_by_path( 'login-customizer' );
76
+
if ( is_object( $page ) ) {
77
+
return array( $page->ID );
78
+
}
79
+
}
80
+
81
+
/**
82
+
* Exclude Login Customizer page from Rank Math sitemap.
83
+
*
84
+
* @param array $posts Array of post IDs.
85
+
* @return array Array of post IDs.
86
+
* @since 2.5.3
87
+
*/
88
+
public function logincust_exclude_from_rankmath_sitemap( $posts ) {
89
+
90
+
$page = get_page_by_path( 'login-customizer' );
91
+
if ( is_object( $page ) ) {
92
+
$posts[] = $page->ID;
93
+
}
94
+
return $posts;
95
+
}
96
+
}
97
+