PluginProbe
Blog2Social: Social Media Auto Post & Scheduler / trunk
Blog2Social: Social Media Auto Post & Scheduler vtrunk
9.0.3 9.0.2 9.0.1 9.0.0 8.9.3 8.9.2 trunk 6.0.0 6.1.0 6.1.1 6.1.2 6.2.0 6.3.0 6.3.1 6.4.0 6.4.1 6.4.2 6.5.0 6.5.1 6.5.2 6.5.3 6.5.4 6.5.5 6.5.6 6.5.7 All 123 releases
blog2social / blog2social.php

blog2social.php in Blog2Social: Social Media Auto Post & Scheduler trunk, at blog2social.php

135 lines 6.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if (!defined('ABSPATH')) {
3 exit;
4 }
5
6 /*
7 * Plugin Name: Blog2Social: Social Media Auto Post & Scheduler
8 * Plugin URI: https://www.blog2social.com
9 * Description: Automatically share and schedule your WordPress content on top social platforms like Facebook, Instagram, LinkedIn, TikTok, and more.
10 * Author: Blog2Social, miaadenion
11 * Text Domain: blog2social
12 * Domain Path: /languages
13 * Version: 9.0.3
14 * Requires at least: 6.2
15 * Requires PHP: 7.4
16 * Tested up to: 7.1
17 * Author URI: https://www.blog2social.com
18 * License: GPLv3
19 */
20
21 /**
22 * @phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound, WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound
23 */
24
25 define('B2S_PLUGIN_VERSION', '903');
26 define('B2S_PLUGIN_LANGUAGE', serialize(array('de_DE', 'en_US')));
27 define('B2S_PLUGIN_DIR', plugin_dir_path(__FILE__));
28 define('B2S_PLUGIN_URL', plugin_dir_url(__FILE__));
29 define('B2S_PLUGIN_HOOK', basename(dirname(__FILE__)) . '/' . basename(__FILE__));
30 define('B2S_PLUGIN_FILE', __FILE__);
31 define('B2S_PLUGIN_LANGUAGE_PATH', dirname(plugin_basename(__FILE__)) . '/languages/');
32 $language = (!in_array(get_locale(), unserialize(B2S_PLUGIN_LANGUAGE))) ? 'en_US' : get_locale();
33 define('B2S_LANGUAGE', $language);
34 define('B2S_PLUGIN_BASENAME', plugin_basename(__FILE__));
35
36 define('B2S_PLUGIN_API_ASS_ENDPOINT', 'https://api.assistini.com/');
37 define('B2S_PLUGIN_API_ASS_ENDPOINT_AUTH', 'https://developer.blog2social.com/');
38 define('B2S_PLUGIN_API_ENDPOINT_AUTH', 'https://developer.blog2social.com/wp/v3/network/auth.php');
39 define('B2S_PLUGIN_API_ENDPOINT_AUTH_SHORTENER', 'https://developer.blog2social.com/wp/v3/network/shortener.php');
40 define('B2S_PLUGIN_API_ENDPOINT_INSTANT_SHARE', 'https://developer.blog2social.com/wp/v3/instant/share.php');
41 define('B2S_PLUGIN_API_VIDEO_UPLOAD_ENDPOINT', 'https://api-upload.blog2social.com/api/rest/v1.0/');
42 define('B2S_PLUGIN_PRG_API_ENDPOINT', 'http://developer.pr-gateway.de/wp/v3/');
43
44
45 if (defined("B2S_PLUGIN_SERVER_LOCATION_MODE") && (int)B2S_PLUGIN_SERVER_LOCATION_MODE == 1) {
46 define('B2S_PLUGIN_API_ENDPOINT', 'https://blog2social-wordpress-api.adenion.de/');
47 define('B2S_PLUGIN_SERVER_URL', 'https://blog2social-wordpress-api.adenion.de');
48 } else {
49 define('B2S_PLUGIN_API_ENDPOINT', 'https://developer.blog2social.com/wp/v3/');
50 define('B2S_PLUGIN_SERVER_URL', 'https://developer.blog2social.com');
51 }
52
53 //B2SLoader
54 require_once(B2S_PLUGIN_DIR . 'includes/Loader.php');
55 require_once(B2S_PLUGIN_DIR . 'includes/Tools.php');
56 require_once(B2S_PLUGIN_DIR . 'includes/System.php');
57 require_once(B2S_PLUGIN_DIR . 'includes/Options.php');
58 require_once(B2S_PLUGIN_DIR . 'includes/Changelog.php');
59
60 $b2sLoad = new B2S_Loader();
61 register_uninstall_hook(B2S_PLUGIN_FILE, 'uninstallPlugin');
62 register_activation_hook(B2S_PLUGIN_FILE, array($b2sLoad, 'activatePlugin'));
63 register_deactivation_hook(B2S_PLUGIN_FILE, array($b2sLoad, 'deactivatePlugin'));
64 add_action('init', array($b2sLoad, 'load'));
65
66 /* $b2sCheck = new B2S_System();
67 if ($b2sCheck->check() === true) {
68 add_action('init', array($b2sLoad, 'load'));
69 add_filter('safe_style_css', function ($styles) {
70 $styles[] = 'display';
71 return $styles;
72 });
73 } else {
74 require_once(B2S_PLUGIN_DIR . 'includes/Notice.php');
75 add_action('admin_notices', array('B2S_Notice', 'sytemNotice'));
76 } */
77
78 function uninstallPlugin() {
79 require_once(plugin_dir_path(__FILE__) . 'includes/Tools.php');
80 require_once(plugin_dir_path(__FILE__) . 'includes/System.php');
81 $b2sCheck = new B2S_System();
82 if ($b2sCheck->check() === true) {
83 global $wpdb;
84 if (is_multisite()) {
85 $sql = "SELECT blog_id FROM {$wpdb->base_prefix}blogs";
86
87 // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
88 $blog_ids = $wpdb->get_results($sql, ARRAY_A);
89 if (is_array($blog_ids) && !empty($blog_ids)) {
90 $union = "";
91 foreach ($blog_ids as $key => $blog_data) {
92 $blog_prefix = $wpdb->get_blog_prefix($blog_data['blog_id']);
93 if (!empty($blog_prefix)) {
94 $existsTable = $wpdb->get_results($wpdb->prepare('SHOW TABLES LIKE %s', $blog_prefix . 'b2s_user"'), ARRAY_A);
95 if (is_array($existsTable) && !empty($existsTable)) {
96 if (!empty($union)) {
97 $union .= " UNION ALL ";
98 }
99 $union .= " SELECT token,blog_user_id FROM {$blog_prefix}b2s_user ";
100 }
101 }
102 }
103 if (!empty($union)) {
104
105 $sql = "SELECT * FROM ( " . $union . " ) as all_tokens";
106 // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
107 $data = $wpdb->get_results($sql, ARRAY_A);
108 if (!empty($data) && is_array($data)) {
109 require_once (plugin_dir_path(__FILE__) . 'includes/B2S/Api/Post.php');
110 B2S_Api_Post::post('https://developer.blog2social.com/wp/v3/', array('action' => 'uninstallPlugin', 'blog_url' => get_option('home'), 'data' => serialize($data), 'is_multisite' => true));
111 }
112 }
113 }
114 } else {
115
116 $sql = "SELECT token,blog_user_id FROM `{$wpdb->prefix}b2s_user`";
117 // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared
118 $data = $wpdb->get_results($sql, ARRAY_A);
119 if (!empty($data) && is_array($data)) {
120 require_once (plugin_dir_path(__FILE__) . 'includes/B2S/Api/Post.php');
121 B2S_Api_Post::post('https://developer.blog2social.com/wp/v3/', array('action' => 'uninstallPlugin', 'blog_url' => get_option('home'), 'data' => serialize($data), 'is_multisite' => false));
122 }
123 }
124 }
125 //global $wpdb;
126 //update_option('b2s_plugin_version', '0');
127 //$wpdb->query('DROP TABLE IF EXISTS `b2s_posts`');
128 //$wpdb->query('DROP TABLE IF EXISTS `b2s_user`');
129 //$wpdb->query('DROP TABLE IF EXISTS `b2s_filter`');
130 //$wpdb->query('DROP TABLE IF EXISTS `b2s_posts_network_details`');
131 //$wpdb->query('DROP TABLE IF EXISTS `b2s_posts_sched_details`');
132 //$wpdb->query('DROP TABLE IF EXISTS `b2s_user_network_settings`');
133 //$wpdb->query('DROP TABLE IF EXISTS `b2s_user_contact`');
134 }
135