-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgp-reject-with-feedback.php
46 lines (40 loc) · 1.25 KB
/
gp-reject-with-feedback.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
<?php
/**
* Plugin Name: GlotPress - Reject Translation With Feedback
* Description: Reject GlotPress translations and feedback are organized into topics in a bbPress forum.
* Version: 1.0.0
*/
if ( ! function_exists( 'is_plugin_active' ) ) {
include_once( ABSPATH . '/wp-admin/includes/plugin.php' );
}
/**
* Check if GlotPress has been installed and activated
*/
function gp_reject_with_feedback_check_requirements() {
if ( is_plugin_active( 'glotpress/glotpress.php' ) ) {
return true;
} else {
add_action( 'admin_notices', 'gp_reject_with_feedback_missing_gp_notice' );
return false;
}
}
/**
* Show notice indicating that GlotPress is required
*/
function gp_reject_with_feedback_missing_gp_notice() {
$class = 'notice notice-error';
$message = __( 'This plugin requires Glotpress to be installed and active.', 'activate_gp_reject_with_feedback' );
printf( '<div class="%1$s"><p>%2$s</p></div>', esc_attr( $class ), esc_html( $message ) );
}
/**
* Activate Plugin
*
*/
function activate_gp_reject_with_feedback() {
require_once plugin_dir_path( __FILE__ ) . 'class-gp-reject-with-feedback.php';
if ( gp_reject_with_feedback_check_requirements() ) {
$plugin = new GP_Reject_With_Feedback;
$plugin->init();
}
}
activate_gp_reject_with_feedback();