PluginProbe
Revive Social – Social Media Auto Post and Scheduling Automation Plugin / trunk
Revive Social – Social Media Auto Post and Scheduling Automation Plugin vtrunk
9.4.2 9.4.1 9.4.0 9.3.6 1.4 1.5 3.0 3.1.1 3.2.1 3.2.2 3.2.4 3.2.5 3.2.6 3.2.7 3.2.9 3.3.0 3.3.1 3.3.3 4.0.10 6.7.2 6.7.4 6.8 6.8.4-back 6.9.6.3 7.0.8 All 145 releases
tweet-old-post / tweet-old-post.php

tweet-old-post.php in Revive Social – Social Media Auto Post and Scheduling Automation Plugin trunk, at tweet-old-post.php

265 lines 8.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Main loader file
5 *
6 * This file is read by WordPress to generate the plugin information in the plugin
7 * admin area. This file also includes all of the dependencies used by the plugin,
8 * registers the activation and deactivation functions, and defines a function
9 * that starts the plugin.
10 *
11 * @link https://revive.social
12 * @since 3.0.0
13 * @package ROP
14 *
15 * @wordpress-plugin
16 * Plugin Name: Revive Social
17 * Plugin URI: https://revive.social/
18 * Description: WordPress plugin that automatically schedules and posts your content to multiple social networks (including Facebook, X, LinkedIn, and Instagram), helping you promote and drive more traffic to your website. For questions, comments, or feature requests, <a href="http://revive.social/support/?utm_source=plugindesc&utm_medium=announce&utm_campaign=top">contact </a> us!
19 * Version: 9.4.2
20 * Author: revive.social
21 * Author URI: https://revive.social/
22 * WordPress Available: yes
23 * Pro Slug: tweet-old-post-pro
24 * Requires License: no
25 * License: GPLv2 or later
26 * License URI: http://www.gnu.org/licenses/gpl-2.0.html
27 * Text Domain: tweet-old-post
28 * Domain Path: /languages
29 */
30
31 // If this file is called directly, abort.
32
33 if ( ! defined( 'WPINC' ) ) {
34 die;
35 }
36
37 if ( function_exists( 'phpversion' ) ) {
38
39 if ( version_compare( phpversion(), '7.4', '<' ) ) {
40 add_action( 'admin_notices', 'rop_php_notice' );
41 add_action( 'admin_init', 'deactivate_rop', 1 );
42 return;
43 }
44 }
45
46 if ( defined( 'PHP_VERSION' ) ) {
47 if ( version_compare( PHP_VERSION, '7.4', '<' ) ) {
48 add_action( 'admin_notices', 'rop_php_notice' );
49 add_action( 'admin_init', 'deactivate_rop', 1 );
50 return;
51 }
52 }
53
54 /**
55 * Shows a notice with a doc link to a fix for sites which have Buffer connected.
56 *
57 * @since 8.6.2
58 */
59 function rop_buffer_present_notice() {
60 ?>
61
62 <div class="notice notice-error is-dismissible">
63 <?php echo sprintf( __( '%1$s %2$sRevive Social:%3$s You have Buffer account(s) connected to Revive Social. You need to remove these accounts to avoid issues with the plugin. Plugin has been deactivated. %4$sClick here to read the article with the fix.%5$s %6$s', 'tweet-old-post' ), '<p>', '<b>', '</b>', '<a href="https://docs.revive.social/article/1318-fix-php-fatal-error-uncaught-exception-invalid-service-name-given" target="_blank">', '</a>', '</p>' ); ?>
64 </div>
65 <?php
66 }
67
68 /**
69 * Detects if there's a buffer account connected to ROP.
70 *
71 * Disables ROP if any are found
72 *
73 * @since 8.6.2
74 */
75 function rop_buffer_present() {
76
77 $rop_data = get_option( 'rop_data' );
78
79 if ( empty( $rop_data['services'] ) ) {
80 return;
81 }
82
83 $services = $rop_data['services'];
84
85 foreach ( $services as $service ) {
86
87 if ( isset( $service['service'] ) && strpos( $service['service'], 'buffer' ) !== false ) {
88 add_action( 'admin_notices', 'rop_buffer_present_notice' );
89
90 if ( ! function_exists( 'deactivate_plugins' ) ) {
91 require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
92 }
93 deactivate_plugins( 'tweet-old-post/tweet-old-post.php' );
94 return;
95 }
96 }
97 }
98 add_action( 'init', 'rop_buffer_present', 1 );
99
100 /**
101 * Shows a notice for sites running PHP less than 5.6.
102 *
103 * @since 8.1.4
104 */
105 function rop_php_notice() {
106 ?>
107
108 <div class="notice notice-error is-dismissible">
109 <?php echo sprintf( __( '%1$s You\'re using a PHP version lower than 7.4! Revive Social requires at least %2$sPHP 7.4%3$s to function properly. Plugin has been deactivated. %4$sLearn more here%5$s. %6$s', 'tweet-old-post' ), '<p>', '<b>', '</b>', '<a href="https://docs.revive.social/article/947-how-to-update-your-php-version" target="_blank">', '</a>', '</p>' ); ?>
110 </div>
111 <?php
112 }
113
114 /**
115 * Deactivates Revive Old Posts.
116 *
117 * @since 8.1.4
118 */
119 function deactivate_rop() {
120 if ( is_plugin_active( 'tweet-old-post/tweet-old-post.php' ) ) {
121 deactivate_plugins( 'tweet-old-post/tweet-old-post.php' );
122 }
123 }
124
125 /**
126 * The code that runs during plugin activation.
127 * This action is documented in includes/class-rop-activator.php
128 */
129 function rop_activation() {
130 Rop_Activator::activate();
131 }
132
133 /**
134 * The code that runs during plugin deactivation.
135 * This action is documented in includes/class-rop-deactivator.php
136 */
137 function rop_deactivation() {
138 Rop_Deactivator::deactivate();
139 }
140
141 register_activation_hook( __FILE__, 'rop_activation' );
142 register_deactivation_hook( __FILE__, 'rop_deactivation' );
143
144 /**
145 * Begins execution of the plugin.
146 *
147 * Since everything within the plugin is registered via hooks,
148 * then kicking off the plugin from this point in the file does
149 * not affect the page life cycle.
150 *
151 * @since 8.0.0
152 */
153 function run_rop() {
154
155 // Is the remote Cron in use ?
156 $use_remote_cron = get_option( 'rop_use_remote_cron', false );
157 $use_remote_cron = filter_var( $use_remote_cron, FILTER_VALIDATE_BOOLEAN );
158 define( 'ROP_CRON_ALTERNATIVE', $use_remote_cron );
159
160 define( 'ROP_LITE_VERSION', '9.4.2' );
161 define( 'ROP_LITE_BASE_FILE', __FILE__ );
162 $debug = false;
163 if ( function_exists( 'wp_get_environment_type' ) ) {
164 if ( wp_get_environment_type() !== 'production' ) {
165 $debug = true;
166 }
167 }
168 define( 'ROP_DEBUG', $debug );
169 define( 'ROP_LITE_PATH', plugin_dir_path( __FILE__ ) );
170 define( 'ROP_PRO_PATH', WP_PLUGIN_DIR . '/tweet-old-post-pro/' );
171 define( 'ROP_PATH', plugin_dir_path( __FILE__ ) );
172 define( 'ROP_LITE_URL', plugin_dir_url( __FILE__ ) );
173 define( 'ROP_STATUS_ALERT', 6 ); // How many consecutive errors count towards status alert "Status: Error (check logs)"
174 define( 'ROP_TEMP_IMAGES', plugin_dir_path( __FILE__ ) . 'temp-images/' ); // Path for external images downloaded for sharing
175 define( 'ROP_PRODUCT_SLUG', basename( ROP_PATH ) );
176
177 // Authorization APP Data
178 define( 'ROP_AUTH_APP_URL', 'https://app.revive.social' );
179 define( 'ROP_APP_FACEBOOK_PATH', '/fb_auth' );
180 define( 'ROP_APP_TWITTER_PATH', '/tw_auth' );
181 define( 'ROP_APP_LINKEDIN_PATH', '/li_auth' );
182 define( 'ROP_APP_TUMBLR_PATH', '/tumblr_auth' );
183 define( 'ROP_APP_GMB_PATH', '/gmb_auth' );
184 define( 'ROP_APP_VK_PATH', '/vk_auth' );
185 define( 'ROP_INSTALL_TOKEN_OPTION', 'rop_install_token' );
186 define( 'ROP_POST_SHARING_CONTROL_API', ROP_AUTH_APP_URL . '/wp-json/auth-option/v1/post-sharing-control' );
187 define( 'ROP_POST_ON_X_API', ROP_AUTH_APP_URL . '/wp-json/auth-option/v1/post-on-x' );
188 define( 'ROP_POST_LOGS_API', ROP_AUTH_APP_URL . '/wp-json/auth-option/v1/logs' );
189
190 add_filter(
191 'themeisle_sdk_compatibilities/' . basename( ROP_LITE_PATH ),
192 function ( $compatibilities ) {
193 $compatibilities['RopPRO'] = array(
194 'basefile' => defined( 'ROP_PRO_DIR_PATH' ) ? ROP_PRO_DIR_PATH . 'tweet-old-post-pro.php' : '',
195 'required' => '3.0',
196 'tested_up' => '3.3',
197 );
198 return $compatibilities;
199 }
200 );
201 add_filter(
202 'tweet_old_post_welcome_metadata',
203 function () {
204 return array(
205 'is_enabled' => ! defined( 'ROP_PRO_DIR_PATH' ),
206 'pro_name' => 'Revive Old Post Pro',
207 'logo' => ROP_LITE_URL . 'assets/img/logo_rop.png',
208 'cta_link' => tsdk_utmify( add_query_arg( array( 'discount' => 'LOYALUSER582' ), Rop_I18n::UPSELL_LINK ), 'rop-welcome', 'notice' ),
209 );
210 }
211 );
212 $vendor_file = ROP_LITE_PATH . '/vendor/autoload.php';
213 if ( is_readable( $vendor_file ) ) {
214 require_once $vendor_file;
215 }
216
217 if ( defined( 'ROP_CRON_ALTERNATIVE' ) && true === ROP_CRON_ALTERNATIVE ) {
218
219 if ( class_exists( 'RopCronSystem\Rop_Cron_Core' ) ) {
220
221 new RopCronSystem\Rop_Cron_Core();
222 }
223 }
224
225 add_filter(
226 'themeisle_sdk_products',
227 function ( $products ) {
228 $products[] = ROP_LITE_BASE_FILE;
229
230 return $products;
231 }
232 );
233
234 add_filter(
235 'tweet_old_post_about_us_metadata',
236 function() {
237 $global_settings = new \Rop_Global_Settings();
238 return array(
239 'logo' => ROP_LITE_URL . 'assets/img/logo_rop.png',
240 'location' => 'TweetOldPost',
241 'has_upgrade_menu' => $global_settings->license_type() < 1,
242 'upgrade_text' => esc_html__( 'Upgrade to Pro', 'tweet-old-post' ),
243 'upgrade_link' => function_exists( 'tsdk_utmify' ) ? tsdk_utmify( Rop_I18n::UPSELL_LINK, 'aboutUsPage' ) : esc_url( Rop_I18n::UPSELL_LINK ),
244 );
245 }
246 );
247
248 add_filter( 'themeisle_sdk_enable_telemetry', '__return_true' );
249
250 $plugin = new Rop();
251 $plugin->run();
252
253 }
254
255 require( plugin_dir_path( __FILE__ ) . '/class-rop-autoloader.php' );
256 Rop_Autoloader::define_namespaces( array( 'Rop' ) );
257 /**
258 * Invocation of the Autoloader::loader method.
259 *
260 * @since 8.0.0
261 */
262 spl_autoload_register( array( 'Rop_Autoloader', 'loader' ) );
263
264 run_rop();
265