-
Notifications
You must be signed in to change notification settings - Fork 0
/
xml-sitemaps-excludes-by-codechute.php
78 lines (69 loc) · 2.16 KB
/
xml-sitemaps-excludes-by-codechute.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?php
/**
* Plugin Name: XML Sitemaps Excludes for Yoast SEO
* Version: 1.0
* Plugin URI: https://codechute.com/
* Description: XML Sitemaps Excludes for Yoast SEO.
* Author: CodeChute
* Author URI: https://codechute.com/
* Text Domain: yoast-sitemaps-exclude
* Domain Path: /languages/
* License: GPL v3
*/
// If this file is called directly, abort.
if(!defined('WPINC')){ die; }
define('YSE_REVISION', '1.0');
define('YSE_PLUGIN_PATH', plugin_dir_path(__FILE__));
define('YSE_PLUGIN_SLUG_PATH', plugin_basename(__FILE__));
define('YSE_PLUGIN_URL', plugin_dir_url(__FILE__));
if(!class_exists('XmlSitemapsExcludesByCodeChute')){
class XmlSitemapsExcludesByCodeChute{
/**
* Core singleton class
* @var self - pattern realization
*/
private static $instance;
/**
* WmlSitemapsExcludesByCodeChute Constructor
*/
public function __construct(){
add_action( 'admin_init', array($this, 'check_requirements') );
$this->setup();
}
public function setup(){
require_once YSE_PLUGIN_PATH . 'inc/admin/settings.php';
require_once YSE_PLUGIN_PATH . 'inc/xml-sitemaps-excludes-frontend.php';
}
/**
* Get the instane of VC_Manager
*
* @return self
*/
public static function getInstance() {
if ( ! ( self::$instance instanceof self ) ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Checks if Yoast SEO activated.
*
* @return bool
*/
public function check_requirements() {
if(!is_plugin_active('wordpress-seo/wp-seo.php')){
add_action( 'admin_notices', array($this, 'admin_notice__error') );
return;
}
}
public function admin_notice__error(){
$class = 'notice notice-error';
$message = __( 'The following required plugin is currently inactive: Yoast SEO.', 'yoast-sitemaps-exclude' );
printf( '<div class="%1$s"><p>%2$s</p></div>', esc_attr( $class ), esc_html( $message ) );
}
}
}
global $xml_sitemaps_excludes_by_codechute;
if ( ! $xml_sitemaps_excludes_by_codechute ) {
$xml_sitemaps_excludes_by_codechute = XmlSitemapsExcludesByCodeChute::getInstance();
}