This repository has been archived by the owner on Mar 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathzanto.php
executable file
·109 lines (93 loc) · 3.42 KB
/
zanto.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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<?php
/*
Plugin Name: Zanto WP Translation
Plugin URI: http://zanto.org/
Description: Make blogs in a WordPress multisite translations of each other
Version: 0.3.4
Author: Ayebare Mucunguzi Brooks
Author URI: http://zanto.org
Text Domain: Zanto
Domain Path: /languages/
*/
if ( $_SERVER[ 'SCRIPT_FILENAME' ] == __FILE__ )
die( 'Access denied.' );
define( 'GTP_ZANTO_VERSION', '0.3.4' );
define( 'GTP_NAME', 'Zanto Wordpress Translation Plugin' );
define( 'GTP_REQUIRED_WP_VERSION', '3.1' ); // because of esc_textarea()
define( 'GTP_PLUGIN_PATH', dirname( __FILE__ ) );
define( 'GTP_PLUGIN_FOLDER', basename( GTP_PLUGIN_PATH ) );
define( 'GTP_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
(!function_exists( 'is_multisite' ) || !is_multisite()) ? define( 'GTP_MULTISITE', false ) : define( 'GTP_MULTISITE', true );
/**
* Loads plugin translations
*/
function zanto_load_lang_files() {
$lang_dir = GTP_PLUGIN_FOLDER . '/languages/';
load_plugin_textdomain( 'Zanto', false, $lang_dir );
}
add_filter( 'wp_loaded', 'zanto_load_lang_files' );
/**
* Checks if the system requirements are met
* @author Ayebare Mucunguzi
* @return array 0 to indicate un-met conditions.
*/
$zwt_icon_url = GTP_PLUGIN_URL . 'images/logo-admin.gif';
$zwt_menu_url = GTP_PLUGIN_URL . 'images/menu-icon.gif';
if ( is_admin() ) {
require_once(GTP_PLUGIN_PATH . '/includes/notices/admin-notice-helper.php');
require_once(GTP_PLUGIN_PATH . '/includes/notices/email-notifications.php');
}
require_once(GTP_PLUGIN_PATH . '/includes/install-requirements.php');
$zwt_unfullfilled_requirments = zwt_requirements_missing();
// Check if requirements are missing and load main class
// The main program needs to be in a separate file that only gets loaded if the plugin requirements are met. Otherwise older PHP installations could crash when trying to parse it.
if ( !$zwt_unfullfilled_requirments ) {
require_once(GTP_PLUGIN_PATH . '/classes/class.zwt-module.php');
require_once(GTP_PLUGIN_PATH . '/classes/class.zwt-base.php');
require_once(GTP_PLUGIN_PATH . '/classes/class.zwt-lang-switcher.php');
require_once(GTP_PLUGIN_PATH . '/classes/class.zwt-widgets.php');
require_once(GTP_PLUGIN_PATH . '/classes/class.zwt-mo.php');
require_once(GTP_PLUGIN_PATH . '/classes/class.zwt-download-mo.php');
require_once(GTP_PLUGIN_PATH . '/includes/functions.php');
require_once(GTP_PLUGIN_PATH . '/includes/template-functions.php');
if ( class_exists( 'ZWT_Base' ) ) {
$zwt_site_obj = ZWT_Base::getInstance();
$zwt_language_switcher = new ZWT_Lang_Switcher();
register_activation_hook( __FILE__, array(
$zwt_site_obj,
'activate'
) );
register_deactivation_hook( __FILE__, array(
$zwt_site_obj,
'deactivate'
) );
}
} else {
add_action( 'admin_notices', 'zwt_requirements_error' );
zwt_deactivate_zanto();
}
/**
* Prints an error and de-activates Zanto when the system requirements aren't met.
* @author Zanto Translate
*/
function zwt_requirements_error() {
global $wp_version;
require_once(GTP_PLUGIN_PATH . '/views/requirements-error.php');
}
/**
* The main function responsible for returning Zanto WP Translation objec
* Instance to functions everywhere.
*
* Use this function like you would a global variable, except without needing
* to declare the global.
*
* Example: <?php $nf = Zanto_WT(); ?>
*
* @since 0.3.2
* @return object The Zanto Translation object Instance
*/
function Zanto_WT() {
global $zwt_site_obj;
return $zwt_site_obj;
}
?>