PluginProbe
Revive.so – Bulk Rewrite and Republish Blog Posts / 2.0.5
Revive.so – Bulk Rewrite and Republish Blog Posts v2.0.5
trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8
revive-so / revive-so.php

revive-so.php in Revive.so – Bulk Rewrite and Republish Blog Posts 2.0.5, at revive-so.php

257 lines 6.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Plugin Name: Revive.so
5 * Description: Revive.so is the ultimate WordPress plugin for content rejuvenation. Republish and recirculate evergreen posts with a simple click. This will boost your content's visibility, engagement, and SEO rankings. Don't let your valuable content fade into obscurity.
6 * Version: 2.0.5
7 * Author: Revive.so
8 * Author URI: https://revive.so/
9 * Requires at least: 5.4
10 * Tested up to: 6.8
11 * Text Domain: revive-so
12 *
13 * License: GPL v3
14 *
15 * This program is free software: you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation, either version 3 of the License, or
18 * (at your option) any later version.
19 *
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * You should have received a copy of the GNU General Public License
26 * along with this program. If not, see <http://www.gnu.org/licenses/>.
27 */
28
29 // If this file is called directly, abort!!!
30 defined( 'ABSPATH' ) || exit;
31
32 /**
33 * Check if Reviveso class is already exists.
34 *
35 * @class Main class of the plugin.
36 */
37 if ( ! class_exists( 'Reviveso' ) ) {
38
39 /**
40 * Reviveso class.
41 *
42 * @class Main class of the plugin.
43 */
44 final class Reviveso {
45
46
47 /**
48 * Plugin version.
49 *
50 * @var string
51 */
52 public $version = '2.0.5';
53
54 /**
55 * Minimum version of WordPress required to run Reviveso.
56 *
57 * @var string
58 */
59 private $wordpress_version = '5.4';
60
61 /**
62 * Minimum version of PHP required to run Reviveso.
63 *
64 * @var string
65 */
66 private $php_version = '7.3';
67
68 /**
69 * Hold install error messages.
70 *
71 * @var bool
72 */
73 private $messages = array();
74
75 /**
76 * The single instance of the class.
77 *
78 * @var Reviveso
79 */
80 protected static $instance = null;
81
82 /**
83 * Retrieve main Reviveso instance.
84 *
85 * Ensure only one instance is loaded or can be loaded.
86 *
87 * @see reviveso()
88 * @return Reviveso
89 */
90 public static function get() {
91 if ( is_null( self::$instance ) && ! ( self::$instance instanceof Reviveso ) ) {
92 self::$instance = new Reviveso();
93 self::$instance->setup();
94 }
95
96 return self::$instance;
97 }
98
99 /**
100 * Instantiate the plugin.
101 */
102 private function setup() {
103 // Define plugin constants.
104 $this->define_constants();
105
106 if ( ! $this->is_requirements_meet() ) {
107 return;
108 }
109
110 // Include required files.
111 $this->includes();
112
113 // Instantiate services.
114 $this->instantiate();
115 REVIVESO_Tailwind_UI::get_instance();
116 // Loaded action.
117 do_action( 'reviveso_plugin_loaded' );
118 }
119
120 /**
121 * Check that the WordPress and PHP setup meets the plugin requirements.
122 *
123 * @return bool
124 */
125 private function is_requirements_meet() {
126
127 // Check WordPress version.
128 if ( version_compare( get_bloginfo( 'version' ), $this->wordpress_version, '<' ) ) {
129 /* translators: WordPress Version */
130 $this->messages[] = sprintf( esc_html__( 'You are using the outdated WordPress, please update it to version %s or higher.', 'revive-so' ), $this->wordpress_version );
131 }
132
133 // Check PHP version.
134 if ( version_compare( phpversion(), $this->php_version, '<' ) ) {
135 /* translators: PHP Version */
136 $this->messages[] = sprintf( esc_html__( 'Reviveso requires PHP version %s or above. Please update PHP to run this plugin.', 'revive-so' ), $this->php_version );
137 }
138
139 if ( empty( $this->messages ) ) {
140 return true;
141 }
142
143 // Auto-deactivate plugin.
144 add_action( 'admin_init', array( $this, 'auto_deactivate' ) );
145 add_action( 'admin_notices', array( $this, 'activation_error' ), 8 );
146
147 return false;
148 }
149
150 /**
151 * Auto-deactivate plugin if requirements are not met, and display a notice.
152 */
153 public function auto_deactivate() {
154 deactivate_plugins( REVIVESO_BASENAME );
155 if ( isset( $_GET['activate'] ) ) { // phpcs:ignore
156 unset( $_GET['activate'] ); // phpcs:ignore
157 }
158 }
159
160 /**
161 * Error notice on plugin activation.
162 */
163 public function activation_error() {
164
165 if ( REVIVESO_Admin::is_reviveso_admin_page() ) {
166 ?>
167 <!-- Global notification live region, render this permanently at the end of the document -->
168 <div aria-live='assertive' class='reviveso-notice mt-6 pointer-events-none fixed inset-0 flex items-end px-4 py-6 sm:items-start sm:p-6'>
169 <div class='flex w-full flex-col items-center space-y-4 sm:items-end'>
170 <div class='border-2 border-t-0 border-b-0 border-r-0 border-red-500 pointer-events-auto w-full max-w-sm overflow-hidden rounded-lg bg-white shadow-lg ring-1 ring-black ring-opacity-5'>
171 <div class='p-4'>
172 <div class='flex items-center'>
173 <div class='flex w-0 flex-1 justify-between'>
174 <p class='w-0 flex-1 text-sm font-medium text-gray-900'>
175 <?php echo wp_kses_post( join( '<br>', $this->messages ) ); ?>
176 </p>
177 </div>
178 </div>
179 </div>
180 </div>
181 </div>
182 </div>
183
184 <?php
185 } else {
186 ?>
187 <div class="notice reviveso-notice notice-error">
188 <p>
189 <?php
190 echo wp_kses_post( join( '<br>', $this->messages ) );
191 ?>
192 </p>
193 </div>
194 <?php
195 }
196 }
197
198 /**
199 * Define the plugin constants.
200 */
201 private function define_constants() {
202 define( 'REVIVESO_VERSION', $this->version );
203 define( 'REVIVESO_FILE', __FILE__ );
204 define( 'REVIVESO_PATH', dirname( REVIVESO_FILE ) . '/' );
205 define( 'REVIVESO_URL', plugins_url( '', REVIVESO_FILE ) . '/' );
206 define( 'REVIVESO_BASENAME', plugin_basename( REVIVESO_FILE ) );
207 defined( 'REVIVE_STORE_URL' ) || define( 'REVIVE_STORE_URL', 'https://revive.so/' );
208 defined( 'REVIVE_STORE_UPGRADE_URL' ) || define( 'REVIVE_STORE_UPGRADE_URL', 'https://revive.so/pricing' );
209 }
210
211 /**
212 * Include the required files.
213 */
214 private function includes() {
215 include __DIR__ . '/vendor/autoload.php';
216 }
217
218 /**
219 * Instantiate services.
220 */
221 private function instantiate() {
222 // Activation hook.
223 register_activation_hook(
224 REVIVESO_FILE,
225 function () {
226 REVIVESO_Activate::activate();
227 }
228 );
229
230 // Deactivation hook.
231 register_deactivation_hook(
232 REVIVESO_FILE,
233 function () {
234 REVIVESO_Deactivate::deactivate();
235 }
236 );
237
238 // Init Reviveso Classes.
239 add_action( 'init', array( 'REVIVESO_Loader', 'register_services' ), 30 );
240 }
241 }
242 }
243
244 /**
245 * Returns the main instance of Reviveso to prevent the need to use globals.
246 *
247 * @return Reviveso
248 */
249 if ( ! function_exists( 'revive_so_run_plugin' ) ) {
250 function revive_so_run_plugin() {
251 return Reviveso::get();
252 }
253 }
254
255 // Start it.
256 revive_so_run_plugin();
257