3rdparty
6 days ago
abilities
6 days ago
admin
6 days ago
cli
5 years ago
frontend
2 weeks ago
helpers
2 weeks ago
metaboxes
2 years ago
module
2 weeks ago
modules
6 days ago
opengraph
2 weeks ago
replace-variables
2 weeks ago
rest
6 days ago
settings
2 weeks ago
traits
2 weeks ago
updates
2 weeks ago
class-auto-updater.php
5 years ago
class-cmb2.php
2 weeks ago
class-common.php
5 months ago
class-compatibility.php
1 year ago
class-data-encryption.php
5 months ago
class-defaults.php
6 years ago
class-frontend-seo-score.php
2 weeks ago
class-helper.php
10 months ago
class-installer.php
2 weeks ago
class-json-manager.php
1 year ago
class-kb.php
7 months ago
class-metadata.php
2 months ago
class-post.php
1 year ago
class-rewrite.php
5 months ago
class-settings.php
1 year ago
class-term.php
1 year ago
class-thumbnail-overlay.php
1 year ago
class-tracking.php
6 days ago
class-update-email.php
2 weeks ago
class-updates.php
3 months ago
class-user.php
8 months ago
index.php
7 years ago
interface-runner.php
7 years ago
template-tags.php
1 year ago
class-compatibility.php
104 lines
| 1 | <?php |
| 2 | /** |
| 3 | * The compatibility functionality for 3rd party plugins. |
| 4 | * |
| 5 | * @since 0.9.0 |
| 6 | * @package RankMath |
| 7 | * @subpackage RankMath\Core |
| 8 | * @author Rank Math <support@rankmath.com> |
| 9 | */ |
| 10 | |
| 11 | namespace RankMath; |
| 12 | |
| 13 | use RankMath\Traits\Hooker; |
| 14 | use RankMath\Helpers\Str; |
| 15 | |
| 16 | defined( 'ABSPATH' ) || exit; |
| 17 | |
| 18 | /** |
| 19 | * Compatibility class. |
| 20 | */ |
| 21 | class Compatibility { |
| 22 | |
| 23 | use Hooker; |
| 24 | |
| 25 | /** |
| 26 | * The Constructor. |
| 27 | */ |
| 28 | public function __construct() { |
| 29 | |
| 30 | if ( is_admin() ) { |
| 31 | |
| 32 | if ( \defined( 'PIRATE_FORMS_VERSION' ) ) { |
| 33 | $this->action( 'admin_enqueue_scripts', 'pirate_forms_dequeue_scripts' ); |
| 34 | } |
| 35 | } |
| 36 | |
| 37 | $this->filter( 'rank_math/pre_simple_page_id', 'subscribe_to_comments_reloaded' ); |
| 38 | $this->filter( 'genesis_detect_seo_plugins', 'disable_genesis_seo' ); |
| 39 | } |
| 40 | |
| 41 | /** |
| 42 | * Subscribe to comments reloaded page ID. |
| 43 | * |
| 44 | * @param int $page_id Change page id to real page. |
| 45 | * @return int |
| 46 | */ |
| 47 | public function subscribe_to_comments_reloaded( $page_id ) { |
| 48 | if ( is_plugin_active( 'subscribe-to-comments-reloaded/subscribe-to-comments-reloaded.php' ) ) { |
| 49 | $page_permalink = get_option( 'subscribe_reloaded_manager_page', '/comment-subscriptions/' ); |
| 50 | if ( function_exists( 'qtrans_convertURL' ) ) { |
| 51 | $page_permalink = qtrans_convertURL( $page_permalink ); |
| 52 | } |
| 53 | if ( isset( $_SERVER['REQUEST_URI'] ) && ( strpos( sanitize_text_field( $_SERVER['REQUEST_URI'] ), $page_permalink ) !== false ) ) { |
| 54 | $this->action( 'rank_math/head', 'subscribe_to_comments_reloaded_remove_robots', 1 ); |
| 55 | return get_queried_object_id(); |
| 56 | } |
| 57 | } |
| 58 | |
| 59 | return $page_id; |
| 60 | } |
| 61 | |
| 62 | /** |
| 63 | * Remove robots for this plugin. |
| 64 | */ |
| 65 | public function subscribe_to_comments_reloaded_remove_robots() { |
| 66 | remove_action( 'rank_math/frontend/robots', '__return_empty_array' ); |
| 67 | } |
| 68 | |
| 69 | /** |
| 70 | * Remove Pirate forms plugin scripts and styles from setting panels. |
| 71 | */ |
| 72 | public function pirate_forms_dequeue_scripts() { |
| 73 | |
| 74 | if ( ! wp_script_is( 'pirate_forms_pro_admin_scripts' ) ) { |
| 75 | return; |
| 76 | } |
| 77 | |
| 78 | $screen = get_current_screen(); |
| 79 | if ( |
| 80 | ( ! Str::contains( 'rank-math', $screen->id ) && ! in_array( $screen->base, [ 'post', 'term', 'profile', 'user-edit' ], true ) ) || |
| 81 | 'pf_form' === $screen->id |
| 82 | ) { |
| 83 | return; |
| 84 | } |
| 85 | |
| 86 | wp_dequeue_script( 'pirate_forms_pro_admin_scripts' ); |
| 87 | wp_dequeue_style( 'pirate_forms_pro_admin_styles' ); |
| 88 | } |
| 89 | |
| 90 | /** |
| 91 | * Disable Genesis SEO functionality. |
| 92 | * |
| 93 | * @param array $value Array hold disable info. |
| 94 | * |
| 95 | * @return array |
| 96 | */ |
| 97 | public function disable_genesis_seo( $value ) { |
| 98 | $value['classes'][] = '\RankMath\RankMath'; |
| 99 | $value['functions'][] = 'rank_math'; |
| 100 | |
| 101 | return $value; |
| 102 | } |
| 103 | } |
| 104 |