forked from Smartling/wordpress-localization-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsmartling-connector.php
More file actions
executable file
·78 lines (72 loc) · 3.27 KB
/
Copy pathsmartling-connector.php
File metadata and controls
executable file
·78 lines (72 loc) · 3.27 KB
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
/**
* @link https://www.smartling.com
* @since 1.0.0
* @package smartling-connector
* @wordpress-plugin
* Plugin Name: Smartling Connector
* Plugin URI: https://www.smartling.com/products/automate/integrations/wordpress/
* Description: Integrate your Wordpress site with Smartling to upload your content and download translations.
* Version: 1.10.14
* Author: Smartling
* Author URI: https://www.smartling.com
* License: GPL-2.0+
* Network: true
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
* Text Domain: smartling-connector
* Domain Path: /languages
*/
// If this file is called directly, abort.
if (!defined('WPINC')) {
die;
}
defined('SMARTLING_DEBUG') || file_exists(__DIR__ . '/smartling.debug') && define('SMARTLING_DEBUG', true);
/**
* Execute everything only on admin pages or while running cron tasks
*/
if (defined('SMARTLING_DEBUG') || is_admin() || (defined('DOING_CRON') && true === DOING_CRON)) {
if (!class_exists('Smartling_Version_Check')) {
/**
* Old-style code to run under PHP 5.2+
*/
class Smartling_Version_Check
{
/**
* Minimum version to run smartling plugin [major.minor]
*/
const SMARTLING_MIN_PHP_VERSION = '5.6';
public static function check_php_version()
{
$phpRequirements = explode('.', self::SMARTLING_MIN_PHP_VERSION);
$phpMinVerId = reset($phpRequirements) * 10000 + end($phpRequirements) * 100;
return (PHP_VERSION_ID >= $phpMinVerId);
}
public static function draw_php_low_version_message()
{
echo sprintf('<div class="error"><p>Smartling plugin requires at least %s PHP version to start.</p></div>', self::SMARTLING_MIN_PHP_VERSION);
}
}
}
if (!Smartling_Version_Check::check_php_version()) {
add_action('all_admin_notices', array('Smartling_Version_Check', 'draw_php_low_version_message'));
} else {
if (class_exists('Smartling\Bootstrap', false)) {
add_action('all_admin_notices', function () {
$msg = vsprintf(
'Smartling plugin (ver. %s) is already loaded. Skipping plugin load from %s.',
array(Smartling\Bootstrap::getContainer()->getParameter('plugin.version'), __FILE__)
);
echo vsprintf('<div class="error"><p>%s</p></div>', array($msg));
});
} else {
require_once plugin_dir_path(__FILE__) . 'inc/autoload.php';
$pluginData = get_file_data(__FILE__, ['Version' => 'Version']);
Smartling\Bootstrap::$pluginVersion = $pluginData['Version'];
$bootstrap = new Smartling\Bootstrap();
add_action('plugins_loaded', array($bootstrap, 'load',), 99);
register_activation_hook(__FILE__, array($bootstrap, 'activate',));
register_deactivation_hook(__FILE__, array($bootstrap, 'deactivate',));
register_uninstall_hook(__FILE__, array('Smartling\Bootstrap', 'uninstall'));
}
}
}