-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathgathercontent-importer.php
118 lines (105 loc) · 4.48 KB
/
gathercontent-importer.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
110
111
112
113
114
115
116
117
118
<?php
/**
* Plugin Name: GatherContent Plugin
* Plugin URI: http://www.gathercontent.com
* Description: Imports items from GatherContent to your wordpress site
* Version: 3.2.22
* Author: GatherContent
* Requires PHP: 7.0
* Author URI: http://www.gathercontent.com
* Text Domain: gathercontent-import
* Domain Path: /languages
* License: GPL-2.0+
*/
/**
* Copyright (c) 2016 GatherContent (email : [email protected])
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License, version 2 or, at
* your discretion, any later version, as published by the Free
* Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
// Useful global constants
define( 'GATHERCONTENT_VERSION', '3.2.22' );
define( 'GATHERCONTENT_ENQUEUE_VERSION', '3.2.22' );
define( 'GATHERCONTENT_SLUG', 'gathercontent-import' );
define( 'GATHERCONTENT_PLUGIN', __FILE__ );
define( 'GATHERCONTENT_URL', plugin_dir_url( __FILE__ ) );
define( 'GATHERCONTENT_PATH', dirname( __FILE__ ) . '/' );
define( 'GATHERCONTENT_INC', GATHERCONTENT_PATH . 'includes/' );
if ( version_compare( phpversion(), '7.0', '<' ) ) {
// Womp womp.. PHP needs to be updated!
add_action( 'all_admin_notices', 'gathercontent_importer_php_version_too_low_notice' );
} elseif ( version_compare( $GLOBALS['wp_version'], '5.8.2', '<' ) ) {
// Sad Trombone.. WordPress needs to be updated!
add_action( 'all_admin_notices', 'gathercontent_importer_wp_version_too_low_notice' );
} else {
// Include files
require_once GATHERCONTENT_INC . 'functions/core.php';
require_once GATHERCONTENT_INC . 'functions/functions.php';
}
/**
* If the server does not have the minimum supported version of PHP,
* this notice will be shown in the dashboard.
*
* @since 3.0.0
*
* @return void
*/
function gathercontent_importer_php_version_too_low_notice() {
printf(
'<div id="message" class="error"><p>%s</p></div>',
__( 'Sorry, the GatherContent plugin requires a minimum PHP version of 5.3. Please contact your host and ask them to upgrade. For convenience, you can use the note provided on the WordPress recommended host supports page: <a href="https://wordpress.org/about/requirements/">https://wordpress.org/about/requirements/</a>', 'gathercontent-import' )
);
}
/**
* If the version of WordPress is not supported, this notice will be shown in the dashboard.
*
* @since 3.0.0
*
* @return void
*/
function gathercontent_importer_wp_version_too_low_notice() {
printf(
'<div id="message" class="error"><p>%s</p></div>',
__( 'Sorry, for security and performance reasons, the GatherContent plugin requires a minimum WordPress version of 4.4. Please update WordPress to the most recent version.', 'gathercontent-import' )
);
}
/**
* Registers the default textdomain.
*
* @since 3.0.0
*
* @uses apply_filters()
* @uses get_locale()
* @uses load_textdomain()
* @uses load_plugin_textdomain()
* @uses plugin_basename()
*
* @return void
*/
function gathercontent_importer_i18n() {
$text_domain = GATHERCONTENT_SLUG;
$locale = apply_filters( 'plugin_locale', get_locale(), $text_domain );
load_textdomain( $text_domain, WP_LANG_DIR . "/{$text_domain}/{$text_domain}-{$locale}.mo" );
load_plugin_textdomain( $text_domain, false, plugin_basename( GATHERCONTENT_PATH ) . '/languages/' );
}
add_action( 'init', 'gathercontent_importer_i18n' );
add_action( 'admin_init', 'cwby_check_new_plugin_isnt_activated' );
function cwby_check_new_plugin_isnt_activated() {
// make sure to add your own plugin active check to stop looping over the wp_die call.
if ( is_plugin_active( 'content-workflow-by-bynder/gathercontent-importer.php' ) && is_plugin_active( 'gathercontent-import/gathercontent-importer.php' ) ) {
deactivate_plugins( 'gathercontent-import/gathercontent-importer.php' );
$button = '<br><a href="' . esc_attr( network_admin_url( 'plugins.php' ) ) . '" rel="nofollow ugc">Return to Plugins</a>';
wp_die( 'GatherContent plugin can not be activated while the Content Workflow plugin is active, and has therefore been deactivated! ' . $button );
}
}