-
Notifications
You must be signed in to change notification settings - Fork 2
/
wpml.php
93 lines (71 loc) · 2.12 KB
/
wpml.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
79
80
81
82
83
84
85
86
87
88
89
90
91
<?php
/*
Plugin Name: AppThemes WPML Bridge
Plugin URI: https://docs.appthemes.com/wpml-bridge-plugin/
Description: Creates bridge between AppThemes Products and WPML plugin.
AppThemes ID: appthemes-wpml
Version: 1.3
Author: AppThemes
Author URI: http://appthemes.com
Text Domain: appthemes-wpml
Domain Path: /languages
*/
/**
* Plugin version and textdomain constants.
*/
define( 'APP_WPML_VERSION', '1.3' );
define( 'APP_WPML_TD', 'appthemes-wpml' );
/**
* Load Text-Domain.
*
* @return void
*/
function app_wpml_load_textdomain() {
load_plugin_textdomain( APP_WPML_TD, false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
}
add_action( 'plugins_loaded', 'app_wpml_load_textdomain' );
/**
* Setup the WPML Bridge.
*
* @return void
*/
function app_wpml_setup() {
// Check for existence of WPML plugin
if ( ! defined( 'ICL_SITEPRESS_VERSION' ) || ! defined( 'WPML_ST_VERSION' ) ) {
add_action( 'admin_notices', 'app_wpml_display_warning' );
return;
}
require_once( dirname( __FILE__ ) . '/wpml-actions.php' );
}
add_action( 'plugins_loaded', 'app_wpml_setup' );
/**
* Check for existence of AppThemes Products.
*
* @return void
*/
function app_wpml_check_appthemes() {
if ( ! function_exists( 'appthemes_init' ) ) {
add_action( 'admin_notices', 'app_wpml_display_warning' );
return;
}
}
add_action( 'init', 'app_wpml_check_appthemes' );
/**
* Displays warning when AppThemes Theme or WPML plugin is not installed.
*
* @return void
*/
function app_wpml_display_warning() {
$message = __( 'AppThemes WPML Bridge could not run.', APP_WPML_TD );
if ( ! function_exists( 'appthemes_init' ) ) {
$message = __( 'AppThemes WPML Bridge does not support the current theme.', APP_WPML_TD );
}
if ( ! defined( 'ICL_SITEPRESS_VERSION' ) ) {
$message = __( 'AppThemes WPML Bridge require WPML Multilingual CMS plugin to work.', APP_WPML_TD );
}
if ( ! defined( 'WPML_ST_VERSION' ) ) {
$message = __( 'AppThemes WPML Bridge require WPML String Translation plugin to work.', APP_WPML_TD );
}
echo '<div class="error fade"><p>' . $message . '</p></div>';
deactivate_plugins( plugin_basename( __FILE__ ) );
}