Version Description
Bugfixing Meta Tags
Download this release
Release Info
Developer | PR-Gateway |
Plugin | Blog2Social: Social Media Auto Post & Scheduler |
Version | 6.8.6 |
Comparing to | |
See all releases |
Code changes from version 6.8.5 to 6.8.6
- blog2social.php +2 -2
- includes/Loader.php +1932 -1932
- readme.txt +5 -1
blog2social.php
CHANGED
@@ -6,12 +6,12 @@
|
|
6 |
* Author: Blog2Social, Adenion
|
7 |
* Text Domain: blog2social
|
8 |
* Domain Path: /languages
|
9 |
-
* Version: 6.8.
|
10 |
* Author URI: https://www.blog2social.com
|
11 |
* License: GPL2+
|
12 |
*/
|
13 |
|
14 |
-
define('B2S_PLUGIN_VERSION', '
|
15 |
define('B2S_PLUGIN_LANGUAGE', serialize(array('de_DE', 'en_US')));
|
16 |
define('B2S_PLUGIN_DIR', plugin_dir_path(__FILE__));
|
17 |
define('B2S_PLUGIN_URL', plugin_dir_url(__FILE__));
|
6 |
* Author: Blog2Social, Adenion
|
7 |
* Text Domain: blog2social
|
8 |
* Domain Path: /languages
|
9 |
+
* Version: 6.8.6
|
10 |
* Author URI: https://www.blog2social.com
|
11 |
* License: GPL2+
|
12 |
*/
|
13 |
|
14 |
+
define('B2S_PLUGIN_VERSION', '686');
|
15 |
define('B2S_PLUGIN_LANGUAGE', serialize(array('de_DE', 'en_US')));
|
16 |
define('B2S_PLUGIN_DIR', plugin_dir_path(__FILE__));
|
17 |
define('B2S_PLUGIN_URL', plugin_dir_url(__FILE__));
|
includes/Loader.php
CHANGED
@@ -1,1932 +1,1932 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
class B2S_Loader {
|
4 |
-
|
5 |
-
public $blogUserData;
|
6 |
-
public $lastVersion;
|
7 |
-
|
8 |
-
public function __construct() {
|
9 |
-
|
10 |
-
}
|
11 |
-
|
12 |
-
public function load() {
|
13 |
-
if (!is_admin()) {
|
14 |
-
$this->call_public_hooks();
|
15 |
-
}
|
16 |
-
$this->call_global_hooks();
|
17 |
-
if (is_admin()) {
|
18 |
-
$this->call_admin_hooks();
|
19 |
-
}
|
20 |
-
}
|
21 |
-
|
22 |
-
public function call_global_hooks() {
|
23 |
-
|
24 |
-
$this->b2s_register_custom_post_type();
|
25 |
-
|
26 |
-
require_once(B2S_PLUGIN_DIR . 'includes/Options.php');
|
27 |
-
require_once(B2S_PLUGIN_DIR . 'includes/B2S/AutoPost.php');
|
28 |
-
require_once(B2S_PLUGIN_DIR . 'includes/B2S/Rating.php');
|
29 |
-
require_once(B2S_PLUGIN_DIR . 'includes/B2S/Heartbeat.php');
|
30 |
-
require_once(B2S_PLUGIN_DIR . 'includes/B2S/Api/Post.php');
|
31 |
-
require_once(B2S_PLUGIN_DIR . 'includes/B2S/Api/Get.php');
|
32 |
-
require_once(B2S_PLUGIN_DIR . 'includes/Util.php');
|
33 |
-
require_once(B2S_PLUGIN_DIR . 'includes/Tools.php');
|
34 |
-
require_once(B2S_PLUGIN_DIR . 'includes/B2S/Hook/Filter.php');
|
35 |
-
|
36 |
-
define('B2S_PLUGIN_POSTPERPAGE', '15');
|
37 |
-
define('B2S_PLUGIN_VERSION_TYPE', serialize(array(0 => 'Free', 1 => 'Smart', 2 => 'Pro', 3 => 'Business', 4 => 'Premium')));
|
38 |
-
define('B2S_PLUGIN_NETWORK', serialize(array(1 => 'Facebook', 2 => 'Twitter', 3 => 'Linkedin', 4 => 'Tumblr', 5 => 'Storify', 6 => 'Pinterest', 7 => 'Flickr', 8 => 'Xing', 9 => 'Diigo', 10 => 'Google+', 11 => 'Medium', 12 => 'Instagram', 13 => 'Delicious', 14 => 'Torial', 15 => 'Reddit', 16 => 'Bloglovin', 17 => 'VKontakte', 18 => 'Google My Business', 19 => 'Xing', 20 => 'Pinterest', 21 => 'Imgur', 24 => 'Telegram', 25 => 'Blogger', 26 => 'Ravelry', 27 => 'Instapaper')));
|
39 |
-
define('B2S_PLUGIN_SCHED_DEFAULT_TIMES', serialize(array(1 => array(18, 22), 2 => array(8, 10), 3 => array(7, 10), 4 => array(20, 22), 5 => array(), 6 => array(19, 22), 7 => array(7, 9), 8 => array(7, 10), 9 => array(16, 19), 10 => array(7, 10), 11 => array(8, 10), 12 => array(19, 22), 13 => array(11, 13), 14 => array(6, 8), 15 => array(6, 9), 16 => array(16, 19), 17 => array(21, 24), 18 => array(19, 21), 19 => array(7, 10), 24 => array(10, 12))));
|
40 |
-
define('B2S_PLUGIN_SCHED_DEFAULT_TIMES_INFO', serialize(array(1 => array(0 => array(13, 16), 1 => array(18, 22)), 2 => array(0 => array(7, 10), 1 => array(11, 13), 2 => array(16, 19)), 3 => array(0 => array(7, 10), 1 => array(17, 18)), 4 => array(0 => array(20, 22)), 5 => array(), 6 => array(0 => array(12, 14), 1 => array(19, 22)), 7 => array(0 => array(7, 9), 1 => array(17, 19)), 8 => array(0 => array(7, 10), 1 => array(17, 18)), 9 => array(0 => array(8, 10), 1 => array(11, 13), 2 => array(16, 19)), 10 => array(0 => array(7, 10), 1 => array(14, 15)), 11 => array(0 => array(8, 10)), 12 => array(0 => array(11, 13), 1 => array(19, 22)), 13 => array(0 => array(8, 10), 1 => array(11, 13), 2 => array(16, 19)), 14 => array(0 => array(6, 8)), 15 => array(0 => array(6, 9)), 16 => array(0 => array(16, 19)), 17 => array(0 => array(21, 1)), 18 => array(0 => array(9, 11), 1 => array(19, 21)), 19 => array(0 => array(7, 10), 1 => array(17, 18)), 20 => array(0 => array(12, 14), 1 => array(19, 22)), 24 => array(0 => array(10, 12), 1 => array(17, 19)))));
|
41 |
-
define('B2S_PLUGIN_NETWORK_ALLOW_PROFILE', serialize(array(1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 20, 21, 24, 25, 26, 27)));
|
42 |
-
define('B2S_PLUGIN_NETWORK_ALLOW_PAGE', serialize(array(1, 3, 10, 12, 17, 19)));
|
43 |
-
define('B2S_PLUGIN_NETWORK_ALLOW_GROUP', serialize(array(1, 10, 11, 17, 19)));
|
44 |
-
define('B2S_PLUGIN_NETWORK_CROSSPOSTING_LIMIT', serialize(array(19 => array(2 => 3)))); //2=group
|
45 |
-
define('B2S_PLUGIN_NETWORK_ALLOW_MODIFY_BOARD_AND_GROUP', serialize(array(6 => array('TYPE' => array(0), 'TITLE' => esc_html__('Modify pin board', 'blog2social')), 8 => array('TYPE' => array(2), 'TITLE' => esc_html__('Edit group settings', 'blog2social')), 15 => array('TYPE' => array(0), 'TITLE' => esc_html__('Modify subreddit', 'blog2social')), 19 => array('TYPE' => array(2), 'TITLE' => esc_html__('Modify forum', 'blog2social')), 20 => array('TYPE' => array(0), 'TITLE' => esc_html__('Modify pin board', 'blog2social')))));
|
46 |
-
define('B2S_PLUGIN_AUTO_POST_LIMIT', serialize(array(0 => 0, 1 => 25, 2 => 50, 3 => 100, 4 => 100)));
|
47 |
-
define('B2S_PLUGIN_RE_POST_LIMIT', serialize(array(0 => 0, 1 => 25, 2 => 50, 3 => 100, 4 => 100)));
|
48 |
-
define('B2S_PLUGIN_NETWORK_OAUTH', serialize(array(1, 2, 3, 4, 7, 8, 11, 15, 17, 18, 20, 21, 25)));
|
49 |
-
define('B2S_PLUGIN_NETWORK_SETTINGS_TEMPLATE_DEFAULT', serialize(array(
|
50 |
-
1 => array(0 => array('short_text' => array('active' => 0, 'range_min' => 200, 'range_max' => 400, 'excerpt_range_min' => 200, 'excerpt_range_max' => 400, 'limit' => 500), 'content' => "{CONTENT}\n{KEYWORDS}", 'format' => 0, 'addLink' => false),
|
51 |
-
1 => array('short_text' => array('active' => 0, 'range_min' => 200, 'range_max' => 400, 'excerpt_range_min' => 200, 'excerpt_range_max' => 400, 'limit' => 0), 'content' => "{CONTENT}\n{KEYWORDS}", 'format' => 0, 'addLink' => false),
|
52 |
-
2 => array('short_text' => array('active' => 0, 'range_min' => 200, 'range_max' => 400, 'excerpt_range_min' => 200, 'excerpt_range_max' => 400, 'limit' => 0), 'content' => "{CONTENT}\n{KEYWORDS}", 'format' => 0, 'addLink' => false)
|
53 |
-
),
|
54 |
-
2 => array(0 => array('short_text' => array('active' => 0, 'range_min' => 200, 'range_max' => 254, 'excerpt_range_min' => 200, 'excerpt_range_max' => 254, 'limit' => 280), 'content' => '{CONTENT} {KEYWORDS}', 'format' => 1, 'addLink' => true)),
|
55 |
-
3 => array(0 => array('short_text' => array('active' => 0, 'range_min' => 200, 'range_max' => 400, 'excerpt_range_min' => 200, 'excerpt_range_max' => 400, 'limit' => 3000), 'content' => "{CONTENT}\n{KEYWORDS}", 'format' => 0),
|
56 |
-
1 => array('short_text' => array('active' => 0, 'range_min' => 200, 'range_max' => 400, 'excerpt_range_min' => 200, 'excerpt_range_max' => 400, 'limit' => 3000), 'content' => "{CONTENT}\n{KEYWORDS}", 'format' => 0),
|
57 |
-
),
|
58 |
-
4 => array(0 => array('short_text' => array('active' => 0, 'range_min' => 1000, 'range_max' => 20000, 'excerpt_range_min' => 1000, 'excerpt_range_max' => 20000, 'limit' => 0), 'content' => '{CONTENT}', 'format' => false, 'disableKeywords' => true)),
|
59 |
-
6 => array(0 => array('short_text' => array('active' => 0, 'range_min' => 350, 'range_max' => 421, 'excerpt_range_min' => 350, 'excerpt_range_max' => 421, 'limit' => 495), 'content' => "{CONTENT}\n{KEYWORDS}", 'format' => false)),
|
60 |
-
7 => array(0 => array('short_text' => array('active' => 0, 'range_min' => 1000, 'range_max' => 1500, 'excerpt_range_min' => 1000, 'excerpt_range_max' => 1500, 'limit' => 0), 'content' => '{CONTENT}', 'format' => false, 'disableKeywords' => true)),
|
61 |
-
9 => array(0 => array('short_text' => array('active' => 0, 'range_min' => 200, 'range_max' => 250, 'excerpt_range_min' => 200, 'excerpt_range_max' => 250, 'limit' => 250), 'content' => '{CONTENT}', 'format' => false, 'disableKeywords' => true)),
|
62 |
-
11 => array(0 => array('short_text' => array('active' => 0, 'range_min' => 1000, 'range_max' => 20000, 'excerpt_range_min' => 1000, 'excerpt_range_max' => 20000, 'limit' => 0), 'content' => '{CONTENT}', 'format' => false, 'separateKeywords' => true),
|
63 |
-
2 => array('short_text' => array('active' => 0, 'range_min' => 1000, 'range_max' => 20000, 'excerpt_range_min' => 1000, 'excerpt_range_max' => 20000, 'limit' => 0), 'content' => '{CONTENT}', 'format' => false, 'separateKeywords' => true)),
|
64 |
-
12 => array(1 => array('short_text' => array('active' => 0, 'range_min' => 200, 'range_max' => 400, 'excerpt_range_min' => 240, 'excerpt_range_max' => 400, 'limit' => 2000), 'content' => "{CONTENT}\n{KEYWORDS}", 'format' => 1, 'addLink' => false, 'shuffleHashtags' => false)),
|
65 |
-
14 => array(0 => array('short_text' => array('active' => 0, 'range_min' => 1000, 'range_max' => 20000, 'excerpt_range_min' => 1000, 'excerpt_range_max' => 20000, 'limit' => 0), 'content' => '{CONTENT}', 'format' => false, 'disableKeywords' => true)),
|
66 |
-
15 => array(0 => array('short_text' => array('active' => 0, 'range_min' => 200, 'range_max' => 300, 'excerpt_range_min' => 200, 'excerpt_range_max' => 300, 'limit' => 0), 'content' => '{CONTENT}', 'format' => false, 'disableKeywords' => true)),
|
67 |
-
16 => array(0 => array('short_text' => array('active' => 0, 'range_min' => 1000, 'range_max' => 1500, 'excerpt_range_min' => 1000, 'excerpt_range_max' => 1500, 'limit' => 0), 'content' => '{CONTENT}', 'format' => false, 'disableKeywords' => true)),
|
68 |
-
17 => array(0 => array('short_text' => array('active' => 0, 'range_min' => 1000, 'range_max' => 1500, 'excerpt_range_min' => 1000, 'excerpt_range_max' => 1500, 'limit' => 0), 'content' => "{CONTENT}\n{KEYWORDS}", 'format' => 0),
|
69 |
-
1 => array('short_text' => array('active' => 0, 'range_min' => 1000, 'range_max' => 1500, 'excerpt_range_min' => 1000, 'excerpt_range_max' => 1500, 'limit' => 0), 'content' => "{CONTENT}\n{KEYWORDS}", 'format' => 0),
|
70 |
-
2 => array('short_text' => array('active' => 0, 'range_min' => 1000, 'range_max' => 1500, 'excerpt_range_min' => 1000, 'excerpt_range_max' => 1500, 'limit' => 0), 'content' => "{CONTENT}\n{KEYWORDS}", 'format' => 0)),
|
71 |
-
18 => array(0 => array('short_text' => array('active' => 0, 'range_min' => 1000, 'range_max' => 1500, 'excerpt_range_min' => 1000, 'excerpt_range_max' => 1500, 'limit' => 1500), 'content' => "{CONTENT}\n{KEYWORDS}", 'format' => false)),
|
72 |
-
19 => array(0 => array('short_text' => array('active' => 0, 'range_min' => 200, 'range_max' => 320, 'excerpt_range_min' => 200, 'excerpt_range_max' => 320, 'limit' => 0), 'content' => '{CONTENT}', 'format' => 0, 'disableKeywords' => true),
|
73 |
-
1 => array('short_text' => array(0 => array('active' => 0, 'range_min' => 200, 'range_max' => 320, 'excerpt_range_min' => 200, 'excerpt_range_max' => 320, 'limit' => 1000), 4 => array('active' => 0, 'range_min' => 880, 'range_max' => 920, 'excerpt_range_min' => 880, 'excerpt_range_max' => 920, 'limit' => 1000)), 'content' => '{CONTENT}', 'format' => 1, 'disableKeywords' => true),
|
74 |
-
2 => array('short_text' => array('active' => 0, 'range_min' => 200, 'range_max' => 320, 'excerpt_range_min' => 200, 'excerpt_range_max' => 320, 'limit' => 10000), 'content' => '{CONTENT}', 'format' => 1, 'disableKeywords' => true)),
|
75 |
-
24 => array(0 => array('short_text' => array('active' => 0, 'range_min' => 200, 'range_max' => 320, 'excerpt_range_min' => 200, 'excerpt_range_max' => 320, 'limit' => 420), 'content' => '{CONTENT}', 'format' => 0, 'addLink' => true)),
|
76 |
-
25 => array(0 => array('short_text' => array('active' => 0, 'range_min' => 1000, 'range_max' => 20000, 'excerpt_range_min' => 1000, 'excerpt_range_max' => 20000, 'limit' => 0), 'content' => '{CONTENT}', 'format' => false)),
|
77 |
-
26 => array(0 => array('short_text' => array('active' => 0, 'range_min' => 1000, 'range_max' => 20000, 'excerpt_range_min' => 1000, 'excerpt_range_max' => 20000, 'limit' => 0), 'content' => '{CONTENT}', 'format' => false)),
|
78 |
-
27 => array(0 => array('short_text' => array('active' => 0, 'range_min' => 1000, 'range_max' => 20000, 'excerpt_range_min' => 1000, 'excerpt_range_max' => 20000, 'limit' => 0), 'content' => '{CONTENT}', 'format' => false))
|
79 |
-
)));
|
80 |
-
define('B2S_PLUGIN_SYSTEMREQUIREMENT_WORDPRESSVERSION', '4.7.0');
|
81 |
-
define('B2S_PLUGIN_SYSTEMREQUIREMENT_PHPVERSION', '5.5.3');
|
82 |
-
define('B2S_PLUGIN_SYSTEMREQUIREMENT_MYSQLVERSION', '5.5.3');
|
83 |
-
define('B2S_PLUGIN_SYSTEMREQUIREMENT_DATABASERIGHTS', true);
|
84 |
-
define('B2S_PLUGIN_SYSTEMREQUIREMENT_HEARTBEAT', true);
|
85 |
-
define('B2S_PLUGIN_SYSTEMREQUIREMENT_PHPCURL', true);
|
86 |
-
define('B2S_PLUGIN_SYSTEMREQUIREMENT_PHPMBSTRING', true);
|
87 |
-
define('B2S_PLUGIN_SYSTEMREQUIREMENT_PHPDOM', true);
|
88 |
-
define('B2S_PLUGIN_SYSTEMREQUIREMENT_HOTLINKPROTECTION', true);
|
89 |
-
define('B2S_PLUGIN_SYSTEMREQUIREMENT_PLUGINWARNING_WORDS', serialize(array('hotlink', 'firewall', 'security', 'heartbeat', 'disable')));
|
90 |
-
define('B2S_PLUGIN_SYSTEMREQUIREMENT_WPJSON', true);
|
91 |
-
define('B2S_PLUGIN_SYSTEMREQUIREMENT_OPENSSL', true);
|
92 |
-
define('B2S_PLUGIN_PAGE_SLUG', serialize(array('blog2social', 'blog2social-post', 'blog2social-calendar', 'blog2social-curation', 'blog2social-network', 'blog2social-settings', 'prg-post', 'blog2social-support', 'blog2social-premium', 'blog2social-sched', 'blog2social-approve', 'blog2social-publish', 'blog2social-notice', 'blog2social-ship', 'blog2social-curation-draft', 'blog2social-draft-post', 'prg-login', 'prg-ship')));
|
93 |
-
define('B2S_PLUGIN_NETWORK_NOT_ALLOW_GIF', json_encode(array(16, 18, 26)));
|
94 |
-
define('B2S_PLUGIN_NETWORK_ANIMATE_GIF', json_encode(array(1 => array(0 => false, 1 => true), 2 => array(0 => false, 1 => true), 3 => array(0 => true, 1 => true), 4 => array(0 => true), 6 => array(0 => true), 7 => array(0 => false), 11 => array(0 => true), 12 => array(0 => false, 1 => false), 14 => array(0 => true), 15 => array(0 => false), 17 => array(0 => false), 19 => array(0 => true, 1 => true), 21 => array(0 => true), 24 => array(0 => true))));
|
95 |
-
define('B2S_PLUGIN_NETWORK_META_TAGS', json_encode(array('og' => array(1, 3, 15, 19, 17), 'twitter' => array(2, 24))));
|
96 |
-
define('B2S_PLUGIN_SHORTENER', serialize(array(0 => esc_html__('Bitly', 'blog2social'), 1 => esc_html__('Rebrandly', 'blog2social'), 2 => esc_html__('Sniply', 'blog2social'))));
|
97 |
-
|
98 |
-
add_filter('heartbeat_received', array(B2S_Heartbeat::getInstance(), 'init'), 10, 2);
|
99 |
-
add_action('wp_logout', array($this, 'releaseLocks'));
|
100 |
-
add_action('transition_post_status', array($this, 'b2s_auto_post_import'), 9999, 3); //for Auto-Posting imported + manuell
|
101 |
-
//add_action('rest_api_inserted_post', array($this, 'b2s_auto_post_import_rest_api_jetpack'), 9999, 3); //call via transition_post_status hook
|
102 |
-
//add_action('rest_api_init', array($this, 'b2s_rest_api_init'));
|
103 |
-
}
|
104 |
-
|
105 |
-
public function call_admin_hooks() {
|
106 |
-
|
107 |
-
require_once(B2S_PLUGIN_DIR . 'includes/Meta.php');
|
108 |
-
require_once(B2S_PLUGIN_DIR . 'includes/B2S/PostBox.php');
|
109 |
-
require_once(B2S_PLUGIN_DIR . 'includes/Notice.php');
|
110 |
-
require_once(B2S_PLUGIN_DIR . 'includes/PRG/Api/Post.php');
|
111 |
-
require_once(B2S_PLUGIN_DIR . 'includes/PRG/Api/Get.php');
|
112 |
-
require_once(B2S_PLUGIN_DIR . 'includes/Ajax/Post.php');
|
113 |
-
require_once(B2S_PLUGIN_DIR . 'includes/Ajax/Get.php');
|
114 |
-
require_once(B2S_PLUGIN_DIR . 'includes/B2S/AutoPost.php');
|
115 |
-
require_once(B2S_PLUGIN_DIR . 'includes/B2S/Rating.php');
|
116 |
-
require_once(B2S_PLUGIN_DIR . 'includes/Util.php');
|
117 |
-
require_once(B2S_PLUGIN_DIR . 'includes/Tools.php');
|
118 |
-
|
119 |
-
define('B2S_PLUGIN_BLOG_USER_ID', get_current_user_id());
|
120 |
-
define('B2S_PLUGIN_ADMIN', current_user_can('edit_others_posts'));
|
121 |
-
|
122 |
-
$this->blogUserData = get_userdata(B2S_PLUGIN_BLOG_USER_ID);
|
123 |
-
|
124 |
-
//deactivated since 4.2.0
|
125 |
-
//add_action('plugins_loaded', array($this, 'update_db_check'));
|
126 |
-
|
127 |
-
$this->update_db_check();
|
128 |
-
|
129 |
-
add_action('admin_init', array($this, 'registerAssets'));
|
130 |
-
add_action('admin_enqueue_scripts', array($this, 'addBootAssets'));
|
131 |
-
add_action('admin_menu', array($this, 'createMenu'));
|
132 |
-
add_action('admin_bar_menu', array($this, 'createToolbarMenu'), 94);
|
133 |
-
add_action('admin_notices', array('B2S_Notice', 'getProVersionNotice'));
|
134 |
-
add_action('wp_loaded', array('B2S_Notice', 'hideProVersionNotice'));
|
135 |
-
add_action('admin_notices', array($this, 'b2s_save_post_alert_meta_box'));
|
136 |
-
add_action('add_meta_boxes', array($this, 'b2s_load_post_box'));
|
137 |
-
add_action('save_post', array($this, 'b2s_save_post_box'), 1, 3);
|
138 |
-
add_action('trash_post', array($this, 'b2s_delete_sched_post'), 10);
|
139 |
-
add_action('wp_trash_post', array($this, 'b2s_delete_sched_post'), 10);
|
140 |
-
|
141 |
-
add_action('admin_footer', array($this, 'plugin_deactivate_add_modal'));
|
142 |
-
add_filter('plugin_action_links_' . B2S_PLUGIN_BASENAME, array($this, 'override_plugin_action_links'));
|
143 |
-
add_filter('network_admin_plugin_action_links_' . B2S_PLUGIN_BASENAME, array($this, 'override_multisite_plugin_action_links'));
|
144 |
-
|
145 |
-
Ajax_Get::getInstance();
|
146 |
-
Ajax_Post::getInstance();
|
147 |
-
|
148 |
-
if ((int) B2S_PLUGIN_BLOG_USER_ID > 0) {
|
149 |
-
$this->getToken();
|
150 |
-
$this->getUserDetails();
|
151 |
-
}
|
152 |
-
$this->plugin_init_language();
|
153 |
-
}
|
154 |
-
|
155 |
-
public function call_public_hooks() {
|
156 |
-
add_filter('wp_footer', array($this, 'b2s_get_full_content'), 99); //for shortcodes
|
157 |
-
add_action('wp_head', array($this, 'b2s_build_frontend_meta'), 1); // for MetaTags
|
158 |
-
}
|
159 |
-
|
160 |
-
public function b2s_build_frontend_meta() {
|
161 |
-
require_once(B2S_PLUGIN_DIR . 'includes/Meta.php');
|
162 |
-
B2S_Meta::getInstance()->_run();
|
163 |
-
}
|
164 |
-
|
165 |
-
/* public function b2s_rest_api_init() {
|
166 |
-
register_rest_route('blog2social/v1/post', '/authorize', array(
|
167 |
-
'methods' => WP_REST_Server::CREATABLE,
|
168 |
-
'callback' => array($this, 'b2s_rest_api_post_authorize')
|
169 |
-
));
|
170 |
-
} */
|
171 |
-
|
172 |
-
/* public function b2s_rest_api_post_authorize($post = array()) {
|
173 |
-
$contentType = 'application/json';
|
174 |
-
if (isset($post['token']) && !empty($post['token']) && isset($post['user']) && !empty($post['user']) && isset($post['network_id']) && (int) $post['network_id'] > 0) {
|
175 |
-
$privateKey = B2S_PLUGIN_DIR . '/includes/B2S/Api/Network/private_key.pem';
|
176 |
-
if (function_exists('openssl_public_decrypt') && file_exists($privateKey)) {
|
177 |
-
if ((int) $post['network_id'] == 6) {
|
178 |
-
try {
|
179 |
-
require_once(B2S_PLUGIN_DIR . 'includes/B2S/Api/Network/Pinterest.php');
|
180 |
-
$user = '';
|
181 |
-
$pass = '';
|
182 |
-
openssl_private_decrypt(base64_decode(trim($post['user']['pass'])), $pass, $getPrivateKey);
|
183 |
-
openssl_private_decrypt(base64_decode(trim($post['user']['name'])), $user, $getPrivateKey);
|
184 |
-
$pt = new B2S_Api_Network_Pinterest();
|
185 |
-
$result = $pt->authorize($user, $pass);
|
186 |
-
$status = isset($result['cookie_data']) && !empty($result['cookie_data']) ? 200 : 400;
|
187 |
-
$response = array('code' => $status, 'result' => array_merge($result, array('token' => $post['token'], 'network_id' => (int) $post['network_id'])));
|
188 |
-
return new WP_REST_Response($response, $status, array('Content-Type: ' . $contentType));
|
189 |
-
} catch (Exception $ex) {
|
190 |
-
$response = array('code' => 500, 'result' => array('token' => $post['token'], 'network_id' => (int) $post['network_id'], 'error' => 1, 'error_pos' => 8, 'error_data' => serialize($ex->getMessage())));
|
191 |
-
return new WP_REST_Response($response, 500, array('Content-Type: ' . $contentType));
|
192 |
-
}
|
193 |
-
}
|
194 |
-
$response = array('code' => 409, 'result' => array('token' => $post['token'], 'network_id' => (int) $post['network_id'], 'error' => 1, 'error_pos' => 9, 'error_data' => 'network_not_exists'));
|
195 |
-
return new WP_REST_Response($response, 409, array('Content-Type: ' . $contentType));
|
196 |
-
}
|
197 |
-
$response = array('code' => 501, 'result' => array('token' => $post['token'], 'network_id' => (int) $post['network_id'], 'error' => 1, 'error_pos' => 9, 'error_data' => 'openssl_not_exists'));
|
198 |
-
return new WP_REST_Response($response, 501, array('Content-Type: ' . $contentType));
|
199 |
-
}
|
200 |
-
$response = array('code' => 502, 'result' => array('error' => 1, 'error_pos' => 10, 'error_data' => 'bad_request'));
|
201 |
-
return new WP_REST_Response($response, 502, array('Content-Type: ' . $contentType));
|
202 |
-
} */
|
203 |
-
|
204 |
-
private function b2s_register_custom_post_type() {
|
205 |
-
if (post_type_exists("b2s_ex_post")) {
|
206 |
-
return;
|
207 |
-
}
|
208 |
-
register_post_type('b2s_ex_post', array('public' => false, 'label' => 'Related Posts for Blog2Social'));
|
209 |
-
}
|
210 |
-
|
211 |
-
public function plugin_deactivate_add_modal() {
|
212 |
-
include_once(B2S_PLUGIN_DIR . '/views/b2s/partials/plugin-deactivate-modal.php');
|
213 |
-
}
|
214 |
-
|
215 |
-
//Insert Posts via wordpress.com (mobile app) & jetpack
|
216 |
-
//https://developer.jetpack.com/hooks/rest_api_inserted_post/
|
217 |
-
//NOTICE: jetpack call transition_post_status hook
|
218 |
-
/* public function b2s_auto_post_import_rest_api_jetpack($post_id, $insert, $new) {
|
219 |
-
if ((int) $post_id > 0 && is_array($insert) && isset($insert['post_status']) && $insert['post_status'] == 'publish') {
|
220 |
-
$post = get_post((int) $post_id);
|
221 |
-
$this->b2s_auto_post_import($insert['post_status'], 'draft', $post);
|
222 |
-
}
|
223 |
-
} */
|
224 |
-
|
225 |
-
public function b2s_auto_post_import($new_status, $old_status, $post) {
|
226 |
-
//is first publish
|
227 |
-
if ($old_status != 'publish' && $old_status != 'trash' && $new_status == 'publish' && isset($post->post_author) && (int) $post->post_author > 0) {
|
228 |
-
if (wp_is_post_revision($post->ID)) {
|
229 |
-
return;
|
230 |
-
}
|
231 |
-
//is lock if manuell Auto-Posting in form
|
232 |
-
$isLock = get_option('B2S_LOCK_AUTO_POST_IMPORT_' . (int) $post->post_author);
|
233 |
-
if ($isLock === false) {
|
234 |
-
$options = new B2S_Options((int) $post->post_author);
|
235 |
-
$autoPostData = $options->_getOption('auto_post_import');
|
236 |
-
if ($autoPostData !== false && is_array($autoPostData)) {
|
237 |
-
if (isset($autoPostData['active']) && (int) $autoPostData['active'] == 1) {
|
238 |
-
//Premium
|
239 |
-
$tokenInfo = get_option('B2S_PLUGIN_USER_VERSION_' . (int) $post->post_author);
|
240 |
-
if ($tokenInfo !== false && isset($tokenInfo['B2S_PLUGIN_USER_VERSION']) && (int) $tokenInfo['B2S_PLUGIN_USER_VERSION'] >= 1) {
|
241 |
-
$filter = true;
|
242 |
-
if (isset($autoPostData['post_filter']) && (int) $autoPostData['post_filter'] == 1) {
|
243 |
-
if (isset($autoPostData['post_type']) && is_array($autoPostData['post_type']) && !empty($autoPostData['post_type'])) {
|
244 |
-
if (isset($autoPostData['post_type_state']) && (int) $autoPostData['post_type_state'] == 0) { //include
|
245 |
-
if (!in_array($post->post_type, $autoPostData['post_type'])) {
|
246 |
-
$filter = false;
|
247 |
-
}
|
248 |
-
} else { //exclude
|
249 |
-
if (in_array($post->post_type, $autoPostData['post_type'])) {
|
250 |
-
$filter = false;
|
251 |
-
}
|
252 |
-
}
|
253 |
-
}
|
254 |
-
if (isset($autoPostData['post_categories']) && is_array($autoPostData['post_categories']) && !empty($autoPostData['post_categories'])) {
|
255 |
-
$postcat = get_the_category($post->ID);
|
256 |
-
if ($postcat != false && is_array($postcat) && !empty($postcat)) {
|
257 |
-
foreach ($postcat as $k => $v) {
|
258 |
-
if (isset($autoPostData['post_categories_state']) && (int) $autoPostData['post_categories_state'] == 0) { //include
|
259 |
-
if (!in_array($v->term_id, $autoPostData['post_categories'])) {
|
260 |
-
$filter = false;
|
261 |
-
}
|
262 |
-
} else { //exclude
|
263 |
-
if (in_array($v->term_id, $autoPostData['post_categories'])) {
|
264 |
-
$filter = false;
|
265 |
-
}
|
266 |
-
}
|
267 |
-
}
|
268 |
-
}
|
269 |
-
}
|
270 |
-
}
|
271 |
-
if ($filter && isset($autoPostData['network_auth_id']) && !empty($autoPostData['network_auth_id']) && is_array($autoPostData['network_auth_id'])) {
|
272 |
-
//LIMIT
|
273 |
-
$limit = false;
|
274 |
-
$ship = false;
|
275 |
-
$count = 0;
|
276 |
-
$optionUserTimeZone = $options->_getOption('user_time_zone');
|
277 |
-
$userTimeZone = ($optionUserTimeZone !== false) ? $optionUserTimeZone : get_option('timezone_string');
|
278 |
-
$userTimeZoneOffset = (empty($userTimeZone)) ? get_option('gmt_offset') : B2S_Util::getOffsetToUtcByTimeZone($userTimeZone);
|
279 |
-
$current_utc_datetime = gmdate('Y-m-d H:i:s');
|
280 |
-
$current_user_date = date('Y-m-d', strtotime(B2S_Util::getUTCForDate($current_utc_datetime, $userTimeZoneOffset)));
|
281 |
-
$userVersion = (int) $tokenInfo['B2S_PLUGIN_USER_VERSION'];
|
282 |
-
|
283 |
-
$autoPostCon = $options->_getOption('auto_post_import_condition');
|
284 |
-
$conData = array();
|
285 |
-
if ($autoPostCon !== false && is_array($autoPostCon) && isset($autoPostCon['count']) && isset($autoPostCon['last_call_date'])) {
|
286 |
-
$con = unserialize(B2S_PLUGIN_AUTO_POST_LIMIT);
|
287 |
-
$limitCount = (isset($con[$userVersion]) && !empty($con[$userVersion])) ? $con[$userVersion] : $con[1]; //25 default
|
288 |
-
if (($autoPostCon['count'] < $limitCount) || ($current_user_date != $autoPostCon['last_call_date'])) {
|
289 |
-
$limit = true;
|
290 |
-
$count = ($current_user_date != $autoPostCon['last_call_date']) ? 1 : $autoPostCon['count'] + 1;
|
291 |
-
$conData = array('count' => $count, 'last_call_date' => $current_user_date);
|
292 |
-
}
|
293 |
-
} else {
|
294 |
-
$limit = true;
|
295 |
-
$count = 1;
|
296 |
-
$conData = array('count' => $count, 'last_call_date' => $current_user_date);
|
297 |
-
}
|
298 |
-
if (!empty($conData)) {
|
299 |
-
$options->_setOption('auto_post_import_condition', $conData);
|
300 |
-
}
|
301 |
-
|
302 |
-
if ($limit) {
|
303 |
-
global $wpdb;
|
304 |
-
$hook_filter = new B2S_Hook_Filter();
|
305 |
-
$optionPostFormat = $options->_getOption('post_template');
|
306 |
-
$url = get_permalink($post->ID);
|
307 |
-
$title = isset($post->post_title) ? B2S_Util::getTitleByLanguage(strip_tags($post->post_title)) : '';
|
308 |
-
$keywords = $hook_filter->get_wp_post_hashtag((int) $post->ID, $post->post_type);
|
309 |
-
if (($keywords == false || empty($keywords)) && is_plugin_active('wp-automatic/wp-automatic.php')) {
|
310 |
-
$keywords = B2S_Tools::extractKeywords($title);
|
311 |
-
}
|
312 |
-
$content = (isset($post->post_content) && !empty($post->post_content)) ? trim($post->post_content) : '';
|
313 |
-
$excerpt = (isset($post->post_excerpt) && !empty($post->post_excerpt)) ? trim($post->post_excerpt) : '';
|
314 |
-
$images_urls = $hook_filter->get_wp_post_image((int) $post->ID, true, $content);
|
315 |
-
$image_url = ((!empty($images_urls) && isset(array_values($images_urls)[0][0])) ? array_values($images_urls)[0][0] : false);
|
316 |
-
$delay = (isset($autoPostData['ship_state']) && (int) $autoPostData['ship_state'] = 0) ? 0 : (isset($autoPostData['ship_delay_time']) ? (int) $autoPostData['ship_delay_time'] : 0);
|
317 |
-
$current_user_datetime = date('Y-m-d H:i:s', strtotime(B2S_Util::getUTCForDate($current_utc_datetime, $userTimeZoneOffset)));
|
318 |
-
|
319 |
-
//ShareNow
|
320 |
-
$sched_type = 3;
|
321 |
-
$time = ($delay == 0) ? "-30 seconds" : "+" . $delay . " minutes";
|
322 |
-
$sched_date = date('Y-m-d H:i:s', strtotime($time, strtotime($current_user_datetime)));
|
323 |
-
$sched_date_utc = date('Y-m-d H:i:s', strtotime($time, strtotime($current_utc_datetime)));
|
324 |
-
|
325 |
-
$defaultPostData = array('default_titel' => $title,
|
326 |
-
'image_url' => ($image_url !== false) ? trim(urldecode($image_url)) : '',
|
327 |
-
'lang' => trim(strtolower(substr(B2S_LANGUAGE, 0, 2))),
|
328 |
-
'no_cache' => 0, //default inactive , 1=active 0=not
|
329 |
-
'board' => '', 'group' => '', 'url' => $url, 'user_timezone' => $userTimeZoneOffset);
|
330 |
-
|
331 |
-
$defaultBlogPostData = array('post_id' => (int) $post->ID, 'blog_user_id' => (int) $post->post_author, 'user_timezone' => $userTimeZoneOffset, 'sched_type' => $sched_type, 'sched_date' => $sched_date, 'sched_date_utc' => $sched_date_utc);
|
332 |
-
|
333 |
-
$autoShare = new B2S_AutoPost((int) $post->ID, $defaultBlogPostData, $current_user_date, false, $title, $content, $excerpt, $url, $image_url, $keywords, trim(strtolower(substr(B2S_LANGUAGE, 0, 2))), $optionPostFormat, true, $userVersion);
|
334 |
-
|
335 |
-
//TOS Twitter 032018 - none multiple Accounts - User select once
|
336 |
-
$networkTos = true;
|
337 |
-
|
338 |
-
foreach ($autoPostData['network_auth_id'] as $k => $value) {
|
339 |
-
$networkDetails = $wpdb->get_results($wpdb->prepare("SELECT postNetworkDetails.network_id, postNetworkDetails.network_type, postNetworkDetails.network_display_name FROM {$wpdb->prefix}b2s_posts_network_details AS postNetworkDetails WHERE postNetworkDetails.network_auth_id = %s", $value));
|
340 |
-
if ((int) $networkDetails[0]->network_id == 1 || (int) $networkDetails[0]->network_id == 3 || (int) $networkDetails[0]->network_id == 19) {
|
341 |
-
$linkNoCache = B2S_Tools::getNoCacheData((int) $post->post_author);
|
342 |
-
if (is_array($linkNoCache) && isset($linkNoCache[$networkDetails[0]->network_id]) && (int) $linkNoCache[$networkDetails[0]->network_id] > 0) {
|
343 |
-
$defaultPostData['no_cache'] = $linkNoCache[$networkDetails[0]->network_id];
|
344 |
-
}
|
345 |
-
}
|
346 |
-
if (is_array($networkDetails) && isset($networkDetails[0]->network_id) && isset($networkDetails[0]->network_type) && isset($networkDetails[0]->network_display_name)) {
|
347 |
-
//TOS Twitter 032018 - none multiple Accounts - User select once
|
348 |
-
if ((int) $networkDetails[0]->network_id != 2 || ( (int) $networkDetails[0]->network_id == 2 && $networkTos)) {
|
349 |
-
//at first: set one profile
|
350 |
-
if ((int) $networkDetails[0]->network_id == 2) {
|
351 |
-
$networkTos = false;
|
352 |
-
}
|
353 |
-
$res = $autoShare->prepareShareData($value, $networkDetails[0]->network_id, $networkDetails[0]->network_type);
|
354 |
-
if ($res !== false && is_array($res)) {
|
355 |
-
$ship = true;
|
356 |
-
$res = array_merge($res, $defaultPostData);
|
357 |
-
$autoShare->saveShareData($res, $networkDetails[0]->network_id, $networkDetails[0]->network_type, $value, 0, strip_tags($networkDetails[0]->network_display_name));
|
358 |
-
}
|
359 |
-
}
|
360 |
-
}
|
361 |
-
}
|
362 |
-
if ($ship) {
|
363 |
-
B2S_Heartbeat::getInstance()->postToServer();
|
364 |
-
}
|
365 |
-
}
|
366 |
-
}
|
367 |
-
}
|
368 |
-
}
|
369 |
-
}
|
370 |
-
} else {
|
371 |
-
//Unlock Auto-Post-Import
|
372 |
-
delete_option('B2S_LOCK_AUTO_POST_IMPORT_' . (int) $post->post_author);
|
373 |
-
}
|
374 |
-
}
|
375 |
-
}
|
376 |
-
|
377 |
-
public function update_db_check() {
|
378 |
-
$this->lastVersion = get_option('b2s_plugin_version');
|
379 |
-
if ($this->lastVersion == false || (int) $this->lastVersion < B2S_PLUGIN_VERSION) {
|
380 |
-
$this->activatePlugin();
|
381 |
-
update_option('b2s_plugin_version', B2S_PLUGIN_VERSION, false);
|
382 |
-
}
|
383 |
-
}
|
384 |
-
|
385 |
-
public function b2s_delete_sched_post($post_id) {
|
386 |
-
wp_enqueue_script('B2SPOSTSCHEDHEARTBEATJS');
|
387 |
-
if ((int) $post_id > 0) {
|
388 |
-
global $wpdb;
|
389 |
-
//Heartbeat => b2s_delete_sched_post
|
390 |
-
$sql = "SELECT id, post_for_approve FROM {$wpdb->prefix}b2s_posts WHERE post_id = %d AND hook_action <= %d AND hide = %d AND sched_date_utc != %s AND publish_date = %s";
|
391 |
-
$deleteData = $wpdb->get_results($wpdb->prepare($sql, $post_id, 2, 0, "0000-00-00 00:00:00", "0000-00-00 00:00:00"), ARRAY_A);
|
392 |
-
if (is_array($deleteData) && !empty($deleteData) && isset($deleteData[0])) {
|
393 |
-
foreach ($deleteData as $k => $value) {
|
394 |
-
if ((int) $value['id'] > 0) {
|
395 |
-
if ((int) $value['post_for_approve'] == 1) {
|
396 |
-
$data = array('hook_action' => '0', 'hide' => 1);
|
397 |
-
} else {
|
398 |
-
$data = array('hook_action' => '3', 'hide' => 1);
|
399 |
-
}
|
400 |
-
$where = array('id' => (int) $value['id']);
|
401 |
-
$wpdb->update($wpdb->prefix . 'b2s_posts', $data, $where, array('%d'), array('%d'));
|
402 |
-
}
|
403 |
-
}
|
404 |
-
}
|
405 |
-
}
|
406 |
-
}
|
407 |
-
|
408 |
-
public function b2s_get_full_content() {
|
409 |
-
if (isset($_GET['b2s_get_full_content'])) {
|
410 |
-
$b2sPostContent = do_shortcode(get_the_content());
|
411 |
-
$b2sPostId = get_the_ID();
|
412 |
-
update_option('B2S_PLUGIN_POST_CONTENT_' . $b2sPostId, $b2sPostContent, false);
|
413 |
-
}
|
414 |
-
}
|
415 |
-
|
416 |
-
public function b2s_load_post_box() {
|
417 |
-
if (defined("B2S_PLUGIN_TOKEN")) {
|
418 |
-
$post_types = get_post_types(array('public' => true));
|
419 |
-
if (is_array($post_types) && !empty($post_types)) {
|
420 |
-
foreach ($post_types as $post_type) {
|
421 |
-
if ($post_type != 'attachment' && $post_type != 'nav_menu_item') {
|
422 |
-
add_meta_box('b2s-post-meta-box-auto', esc_html__('Blog2Social: Autoposter', 'blog2social'), array($this, 'b2s_view_post_box'), $post_type, 'side', 'high');
|
423 |
-
add_meta_box('b2s-post-box-calendar-header', esc_html__('Blog2Social: Social Media Content Calendar', 'blog2social'), array($this, 'b2s_view_post_box_calendar'), $post_type, 'normal', 'high');
|
424 |
-
}
|
425 |
-
}
|
426 |
-
}
|
427 |
-
}
|
428 |
-
}
|
429 |
-
|
430 |
-
public function b2s_view_post_box() {
|
431 |
-
wp_enqueue_style('B2SAIRDATEPICKERCSS');
|
432 |
-
wp_enqueue_style('B2SPOSTBOXCSS');
|
433 |
-
wp_enqueue_script('B2SAIRDATEPICKERJS');
|
434 |
-
wp_enqueue_script('B2SAIRDATEPICKERDEJS');
|
435 |
-
wp_enqueue_script('B2SAIRDATEPICKERENJS');
|
436 |
-
wp_enqueue_script('B2SPOSTBOXJS');
|
437 |
-
|
438 |
-
wp_nonce_field("b2s-meta-box-nonce-post-area", "b2s-meta-box-nonce");
|
439 |
-
wp_nonce_field('b2s_security_nonce', 'b2s_security_nonce');
|
440 |
-
$postId = (isset($_GET['post']) && (int) $_GET['post'] > 0) ? (int) $_GET['post'] : 0;
|
441 |
-
$postType = (isset($_GET['post_type']) && !empty($_GET['post_type'])) ? sanitize_text_field($_GET['post_type']) : get_post_type($postId);
|
442 |
-
$postStatus = ($postId != 0) ? get_post_status($postId) : '';
|
443 |
-
$postBox = new B2S_PostBox();
|
444 |
-
echo $postBox->getPostBox($postId, $postType, $postStatus);
|
445 |
-
}
|
446 |
-
|
447 |
-
public function b2s_view_post_box_calendar() {
|
448 |
-
wp_enqueue_style('B2SFULLCALLENDARCSS');
|
449 |
-
wp_enqueue_style('B2SCALENDARCSS');
|
450 |
-
wp_enqueue_script('B2SFULLCALENDARMOMENTJS');
|
451 |
-
wp_enqueue_script('B2SFULLCALENDARJS');
|
452 |
-
wp_enqueue_script('B2SFULLCALENDARLOCALEJS');
|
453 |
-
wp_enqueue_script('B2SLIB');
|
454 |
-
echo '<div class="b2s-post-box-calendar-content"></div>';
|
455 |
-
}
|
456 |
-
|
457 |
-
public function b2s_save_post_box() {
|
458 |
-
|
459 |
-
if (!isset($_POST['wphb-clear-cache'])) { // WP-Hummingbird BTN clear cache - protection
|
460 |
-
if (!isset($_POST['wp-preview']) || (isset($_POST['wp-preview']) && $_POST['wp-preview'] != 'dopreview')) {
|
461 |
-
if (isset($_POST['post_ID']) && (int) $_POST['post_ID'] > 0) {
|
462 |
-
|
463 |
-
//Gutenberg WP V5.0 - B2S V5.1.0 optimization
|
464 |
-
if (!isset($_POST['post_title']) || !isset($_POST['content'])) {
|
465 |
-
$content = get_post((int) $_POST['post_ID']);
|
466 |
-
if (!isset($_POST['post_title'])) {
|
467 |
-
$_POST['post_title'] = $content->post_title;
|
468 |
-
}
|
469 |
-
if (!isset($_POST['content'])) {
|
470 |
-
$_POST['content'] = $content->post_content;
|
471 |
-
}
|
472 |
-
}
|
473 |
-
$hook_filter = new B2S_Hook_Filter();
|
474 |
-
$b2sPostLang = (isset($_POST['b2s-user-lang']) && !empty($_POST['b2s-user-lang'])) ? sanitize_text_field($_POST['b2s-user-lang']) : 'en';
|
475 |
-
//OgMeta
|
476 |
-
if (isset($_POST['isOgMetaChecked']) && (int) $_POST['isOgMetaChecked'] == 1 && (int) $_POST['post_ID'] > 0 && isset($_POST['content']) && isset($_POST['post_title'])) {
|
477 |
-
$meta = B2S_Meta::getInstance();
|
478 |
-
$meta->getMeta(((int) $_POST['post_ID']));
|
479 |
-
$title = B2S_Util::getTitleByLanguage(sanitize_text_field($_POST['post_title']), strtolower($b2sPostLang));
|
480 |
-
if (has_excerpt((int) $_POST['post_ID'])) {
|
481 |
-
$desc = sanitize_textarea_field(get_the_excerpt());
|
482 |
-
} else {
|
483 |
-
$desc = str_replace("\r\n", ' ', substr(sanitize_textarea_field(strip_shortcodes($_POST['content'])), 0, 160));
|
484 |
-
}
|
485 |
-
$images_urls = $hook_filter->get_wp_post_image((int) $_POST['post_ID'], true, ((isset($_POST['content']) && !empty($_POST['content'])) ? trim($_POST['content']) : ''));
|
486 |
-
$image_url = ((!empty($images_urls) && isset(array_values($images_urls)[0][0])) ? array_values($images_urls)[0][0] : false);
|
487 |
-
$meta->setMeta('og_title', $title);
|
488 |
-
$meta->setMeta('og_desc', $desc);
|
489 |
-
$meta->setMeta('og_image', (($image_url !== false) ? trim(esc_url(urldecode($image_url))) : ''));
|
490 |
-
$meta->setMeta('og_image_alt', ((
|
491 |
-
$meta->updateMeta((int) $_POST['post_ID']);
|
492 |
-
}
|
493 |
-
|
494 |
-
//CardMeta
|
495 |
-
if (isset($_POST['isCardMetaChecked']) && (int) $_POST['isCardMetaChecked'] == 1 && (int) $_POST['post_ID'] > 0 && isset($_POST['content']) && isset($_POST['post_title'])) {
|
496 |
-
$meta = B2S_Meta::getInstance();
|
497 |
-
$meta->getMeta(((int) $_POST['post_ID']));
|
498 |
-
$title = B2S_Util::getTitleByLanguage(sanitize_text_field($_POST['post_title']), strtolower($b2sPostLang));
|
499 |
-
if (has_excerpt((int) $_POST['post_ID'])) {
|
500 |
-
$desc = sanitize_textarea_field(get_the_excerpt());
|
501 |
-
} else {
|
502 |
-
$desc = str_replace("\r\n", ' ', substr(sanitize_textarea_field(strip_shortcodes($_POST['content'])), 0, 160));
|
503 |
-
}
|
504 |
-
$images_urls = $hook_filter->get_wp_post_image((int) $_POST['post_ID'], true, ((isset($_POST['content']) && !empty($_POST['content'])) ? trim($_POST['content']) : ''));
|
505 |
-
$image_url = ((!empty($images_urls) && isset(array_values($images_urls)[0][0])) ? array_values($images_urls)[0][0] : false);
|
506 |
-
$meta->setMeta('card_title', $title);
|
507 |
-
$meta->setMeta('card_desc', $desc);
|
508 |
-
$meta->setMeta('card_image', (($image_url !== false) ? trim(esc_url(urldecode($image_url))) : ''));
|
509 |
-
$meta->updateMeta((int) $_POST['post_ID']);
|
510 |
-
}
|
511 |
-
|
512 |
-
if (isset($_POST['post_ID']) && isset($_POST['user_ID']) && (int) $_POST['post_ID'] > 0 && (int) $_POST['user_ID'] > 0 && !defined("B2S_SAVE_META_BOX_AUTO_SHARE") && !wp_is_post_autosave($_POST['post_ID']) && isset($_POST['b2s-meta-box-nonce']) && wp_verify_nonce($_POST['b2s-meta-box-nonce'], 'b2s-meta-box-nonce-post-area') && isset($_POST['post_status'])) {
|
513 |
-
$ship = false;
|
514 |
-
if (isset($_POST['b2s-enable-auto-post'])) {
|
515 |
-
if ((int) $_POST['b2s-enable-auto-post'] == 1) {
|
516 |
-
if ((strtolower($_POST['post_status']) == "publish" || strtolower($_POST['post_status']) == "future") && isset($_POST['b2s-post-meta-box-profil-dropdown'])) {
|
517 |
-
$profilId = (int) $_POST['b2s-post-meta-box-profil-dropdown'];
|
518 |
-
|
519 |
-
//save network settings and besttimes if different than default
|
520 |
-
$postOptions = new B2S_Options($_POST['post_ID'], 'B2S_PLUGIN_POST_OPTIONS');
|
521 |
-
$newPostOption = $postOptions->_getOption('auto_post_manuell');
|
522 |
-
if ($newPostOption == false || !is_array($newPostOption)) {
|
523 |
-
$newPostOption = array();
|
524 |
-
}
|
525 |
-
$tempOption = array();
|
526 |
-
if (isset($_POST['b2s-profile-default']) && $profilId != (int) $_POST['b2s-profile-default']) {
|
527 |
-
$tempOption['profile'] = $profilId;
|
528 |
-
} else {
|
529 |
-
unset($tempOption['profile']);
|
530 |
-
}
|
531 |
-
if (isset($_POST['b2s-post-meta-box-profil-dropdown-twitter']) && (int) $_POST['b2s-post-meta-box-profil-dropdown-twitter'] > 0 && isset($_POST['b2s-twitter-default']) && (int) $_POST['b2s-post-meta-box-profil-dropdown-twitter'] != (int) $_POST['b2s-twitter-default']) {
|
532 |
-
$tempOption['twitter'] = (int) $_POST['b2s-post-meta-box-profil-dropdown-twitter'];
|
533 |
-
} else {
|
534 |
-
unset($tempOption['twitter']);
|
535 |
-
}
|
536 |
-
if (isset($_POST['b2s-post-meta-box-sched-select']) && isset($_POST['b2s-best-times-default']) && (int) $_POST['b2s-post-meta-box-sched-select'] != (int) $_POST['b2s-best-times-default']) {
|
537 |
-
$tempOption['best_times'] = (int) $_POST['b2s-post-meta-box-sched-select'];
|
538 |
-
} else {
|
539 |
-
unset($tempOption['best_times']);
|
540 |
-
}
|
541 |
-
$newPostOption[B2S_PLUGIN_BLOG_USER_ID] = $tempOption;
|
542 |
-
$postOptions->_setOption('auto_post_manuell', $newPostOption);
|
543 |
-
|
544 |
-
if (isset($_POST['b2s-post-meta-box-profil-data-' . $profilId]) && !empty($_POST['b2s-post-meta-box-profil-data-' . $profilId])) {
|
545 |
-
$networkData = json_decode(base64_decode($_POST['b2s-post-meta-box-profil-data-' . $profilId]));
|
546 |
-
if ($networkData !== false && is_array($networkData) && !empty($networkData)) {
|
547 |
-
$user_timezone = isset($_POST['b2s-user-timezone']) ? (int) $_POST['b2s-user-timezone'] : 0;
|
548 |
-
$current_utc_date = gmdate('Y-m-d H:i:s');
|
549 |
-
$current_user_date = date('Y-m-d H:i:s', strtotime(B2S_Util::getUTCForDate($current_utc_date, $user_timezone)));
|
550 |
-
$post_date = '';
|
551 |
-
//WP User Sched Post + B2S Share NOW
|
552 |
-
if (isset($_POST['mm']) && isset($_POST['jj']) && isset($_POST['aa']) && isset($_POST['hh']) && isset($_POST['mn']) && isset($_POST['ss'])) {
|
553 |
-
$wp_user_sched_post_date = $_POST['aa'] . '-' . $_POST['mm'] . '-' . $_POST['jj'] . ' ' . $_POST['hh'] . ':' . $_POST['mn'] . ':' . $_POST['ss'];
|
554 |
-
} else {
|
555 |
-
//V5.0.0 Gutenberg Editor
|
556 |
-
$wp_user_sched_post_date = get_the_date('Y-m-d H:i:s', $_POST['post_ID']);
|
557 |
-
}
|
558 |
-
$post_date = date('Y-m-d H:i:s', strtotime($wp_user_sched_post_date));
|
559 |
-
|
560 |
-
//ShareNow
|
561 |
-
$sched_type = 3;
|
562 |
-
$sched_date = $current_user_date;
|
563 |
-
$sched_date_utc = date('Y-m-d H:i:s', strtotime("-30 seconds", strtotime($current_utc_date)));
|
564 |
-
$myTimeSettings = false;
|
565 |
-
|
566 |
-
//allow for User Post Date (Schedule)
|
567 |
-
if (!empty($post_date) && $current_user_date <= $post_date) {
|
568 |
-
$sched_type = 2;
|
569 |
-
$sched_date = date('Y-m-d H:i:59', strtotime($post_date));
|
570 |
-
$sched_date_utc = date('Y-m-d H:i:s', strtotime(B2S_Util::getUTCForDate($sched_date, $user_timezone * (-1))));
|
571 |
-
}
|
572 |
-
|
573 |
-
//Schedule post for best times
|
574 |
-
if (isset($_POST['b2s-post-meta-box-sched-select']) && $_POST['b2s-post-meta-box-sched-select'] == 1) {
|
575 |
-
if (isset($_POST['b2s-post-meta-box-best-time-settings'])) {
|
576 |
-
$sched_type = 2;
|
577 |
-
$myTimeSettings = unserialize(stripslashes($_POST['b2s-post-meta-box-best-time-settings']));
|
578 |
-
if ($myTimeSettings !== false && is_array($myTimeSettings) && isset($myTimeSettings['times']) && isset($myTimeSettings['type'])) {
|
579 |
-
$myTimeSettings = $myTimeSettings;
|
580 |
-
}
|
581 |
-
}
|
582 |
-
}
|
583 |
-
|
584 |
-
delete_option('B2S_PLUGIN_POST_CONTENT_' . (int) $_POST['post_ID']);
|
585 |
-
$keywords = $hook_filter->get_wp_post_hashtag((int) $_POST['post_ID'], get_post_type((int) $_POST['post_ID']));
|
586 |
-
$url = get_permalink($_POST['post_ID']);
|
587 |
-
$title = isset($_POST['post_title']) ? B2S_Util::getTitleByLanguage(strip_tags($_POST['post_title']), strtolower($b2sPostLang)) : '';
|
588 |
-
$content = (isset($_POST['content']) && !empty($_POST['content'])) ? trim($_POST['content']) : '';
|
589 |
-
$excerpt = (isset($_POST['excerpt']) && !empty($_POST['excerpt'])) ? trim($_POST['excerpt']) : get_the_excerpt((int) $_POST['post_ID']);
|
590 |
-
$images_urls = $hook_filter->get_wp_post_image((int) $_POST['post_ID'], true, $content);
|
591 |
-
$image_url = ((!empty($images_urls) && isset(array_values($images_urls)[0][0])) ? array_values($images_urls)[0][0] : false);
|
592 |
-
|
593 |
-
$options = new B2S_Options((int) $_POST['user_ID']);
|
594 |
-
$optionPostFormat = $options->_getOption('post_template');
|
595 |
-
|
596 |
-
$defaultPostData = array('default_titel' => $title,
|
597 |
-
'image_url' => ($image_url !== false) ? trim(urldecode($image_url)) : '',
|
598 |
-
'lang' => trim(strtolower(substr(B2S_LANGUAGE, 0, 2))),
|
599 |
-
'no_cache' => 0, //default inactive , 1=active 0=not
|
600 |
-
'board' => '', 'group' => '', 'url' => $url, 'user_timezone' => $user_timezone); // 'publish_date' => $sched_date, OLD FOR Share Now?
|
601 |
-
|
602 |
-
$defaultBlogPostData = array('post_id' => (int) $_POST['post_ID'], 'blog_user_id' => (int) $_POST['user_ID'], 'user_timezone' => $user_timezone, 'sched_type' => $sched_type, 'sched_date' => $sched_date, 'sched_date_utc' => $sched_date_utc);
|
603 |
-
|
604 |
-
$autoShare = new B2S_AutoPost((int) $_POST['post_ID'], $defaultBlogPostData, $current_user_date, $myTimeSettings, $title, $content, $excerpt, $url, $image_url, $keywords, $b2sPostLang, $optionPostFormat);
|
605 |
-
define('B2S_SAVE_META_BOX_AUTO_SHARE', (int) $_POST['post_ID']);
|
606 |
-
if (isset($_POST['b2s-user-last-selected-profile-id']) && (int) $_POST['b2s-user-last-selected-profile-id'] != (int) $_POST['b2s-post-meta-box-profil-dropdown'] && (int) $_POST['b2s-post-meta-box-profil-dropdown'] != 0) {
|
607 |
-
update_option('B2S_PLUGIN_SAVE_META_BOX_AUTO_SHARE_PROFILE_USER_' . (int) $_POST['user_ID'], (int) $_POST['b2s-post-meta-box-profil-dropdown'], false);
|
608 |
-
}
|
609 |
-
|
610 |
-
$metaOg = false;
|
611 |
-
$metaCard = false;
|
612 |
-
$tosCrossPosting = unserialize(B2S_PLUGIN_NETWORK_CROSSPOSTING_LIMIT);
|
613 |
-
|
614 |
-
//Delete old sched posts (don't delete, if network group changed)
|
615 |
-
if (!isset($_POST['b2s-profile-selected']) || $_POST['b2s-profile-selected'] < 0 || !isset($_POST['b2s-post-meta-box-profil-dropdown']) || (int) $_POST['b2s-post-meta-box-profil-dropdown'] == (int) $_POST['b2s-profile-selected']) {
|
616 |
-
global $wpdb;
|
617 |
-
$getSchedData = $wpdb->prepare("SELECT b.id as b2sPostId,d.network_id as networkId,d.network_type as networkType,d.network_auth_id as networkAuthId,d.network_display_name as networkUserName FROM {$wpdb->prefix}b2s_posts b LEFT JOIN {$wpdb->prefix}b2s_posts_network_details d ON (d.id = b.network_details_id) WHERE b.post_id = %d AND b.sched_type = %d AND b.publish_date = %s AND b.hide = %d", (int) $_POST['post_ID'], 3, "0000-00-00 00:00:00", 0);
|
618 |
-
$schedDataResult = $wpdb->get_results($getSchedData);
|
619 |
-
$delete_scheds = array();
|
620 |
-
foreach ($schedDataResult as $k => $value) {
|
621 |
-
array_push($delete_scheds, $value->b2sPostId);
|
622 |
-
}
|
623 |
-
if (!empty($delete_scheds)) {
|
624 |
-
require_once (B2S_PLUGIN_DIR . '/includes/B2S/Post/Tools.php');
|
625 |
-
$ship = true;
|
626 |
-
B2S_Post_Tools::deleteUserSchedPost($delete_scheds);
|
627 |
-
}
|
628 |
-
}
|
629 |
-
|
630 |
-
//TOS Twitter 032018 - none multiple Accounts - User select once
|
631 |
-
$selectedTwitterProfile = (isset($_POST['b2s-post-meta-box-profil-dropdown-twitter']) && !empty($_POST['b2s-post-meta-box-profil-dropdown-twitter'])) ? (int) $_POST['b2s-post-meta-box-profil-dropdown-twitter'] : '';
|
632 |
-
$otherTwitterProfiles = array();
|
633 |
-
$initialTwitterPostId = 0;
|
634 |
-
foreach ($networkData as $k => $value) {
|
635 |
-
$initialTwitterPost = false;
|
636 |
-
if ((int) $value->networkId == 1 || (int) $value->networkId == 3 || (int) $value->networkId == 19) {
|
637 |
-
$linkNoCache = B2S_Tools::getNoCacheData((int) $_POST['user_ID']);
|
638 |
-
if (is_array($linkNoCache) && isset($linkNoCache[$value->networkId]) && (int) $linkNoCache[$value->networkId] > 0) {
|
639 |
-
$defaultPostData['no_cache'] = $linkNoCache[$value->networkId];
|
640 |
-
}
|
641 |
-
}
|
642 |
-
if (isset($value->networkAuthId) && (int) $value->networkAuthId > 0 && isset($value->networkId) && (int) $value->networkId > 0 && isset($value->networkType)) {
|
643 |
-
//TOS Twitter 032018 - none multiple Accounts - User select once
|
644 |
-
if ((int) $value->networkId == 2) {
|
645 |
-
if ((int) $selectedTwitterProfile > 0 && (int) $selectedTwitterProfile == (int) $value->networkAuthId) {
|
646 |
-
$initialTwitterPost = true;
|
647 |
-
} else {
|
648 |
-
array_push($otherTwitterProfiles, (int) $value->networkAuthId);
|
649 |
-
continue;
|
650 |
-
}
|
651 |
-
//TOS Crossposting ignore
|
652 |
-
}
|
653 |
-
//Filter: TOS Crossposting ignore
|
654 |
-
if (isset($tosCrossPosting[$value->networkId][$value->networkType])) {
|
655 |
-
continue;
|
656 |
-
}
|
657 |
-
$res = $autoShare->prepareShareData($value->networkAuthId, $value->networkId, $value->networkType, ((isset($value->networkKind) && (int) $value->networkKind >= 0) ? $value->networkKind : 0));
|
658 |
-
if ($res !== false && is_array($res)) {
|
659 |
-
$ship = true;
|
660 |
-
$res = array_merge($res, $defaultPostData);
|
661 |
-
if (((int) $value->networkId == 12 && isset($optionPostFormat[12][0]['addLink']) && $optionPostFormat[12][0]['addLink'] === false) || ((int) $value->networkId == 24 && isset($optionPostFormat[24][0]['addLink']) && $optionPostFormat[24][0]['addLink'] === false)) {
|
662 |
-
$res['url'] = '';
|
663 |
-
}
|
664 |
-
if (((int) $value->networkId == 1 || (int) $value->networkId == 2) && isset($optionPostFormat[1][$value->networkType]['format']) && $optionPostFormat[1][$value->networkType]['format'] == 1 && isset($optionPostFormat[1][$value->networkType]['addLink']) && $optionPostFormat[1][$value->networkType]['addLink'] === false) {
|
665 |
-
$res['url'] = '';
|
666 |
-
}
|
667 |
-
$shareApprove = (isset($value->instant_sharing) && (int) $value->instant_sharing == 1) ? 1 : 0;
|
668 |
-
$insert = $autoShare->saveShareData($res, $value->networkId, $value->networkType, $value->networkAuthId, $shareApprove, strip_tags($value->networkUserName));
|
669 |
-
|
670 |
-
if ($initialTwitterPost && (int) $insert > 0) {
|
671 |
-
$initialTwitterPostId = $insert;
|
672 |
-
}
|
673 |
-
|
674 |
-
//Start - Change/Set MetaTags
|
675 |
-
//TODO Check Enable Feature
|
676 |
-
if ((int) $value->networkId == 1 && $metaOg == false && (int) $_POST['post_ID'] > 0 && isset($res['post_format']) && (int) $res['post_format'] == 0) { //LinkPost
|
677 |
-
$metaOg = true;
|
678 |
-
$meta = B2S_Meta::getInstance();
|
679 |
-
$meta->getMeta((int) $_POST['post_ID']);
|
680 |
-
if (isset($res['image_url']) && !empty($res['image_url'])) {
|
681 |
-
$meta->setMeta('og_image', trim(esc_url($res['image_url'])));
|
682 |
-
$meta->setMeta('og_image_alt', '');
|
683 |
-
$meta->updateMeta((int) $_POST['post_ID']);
|
684 |
-
}
|
685 |
-
}
|
686 |
-
if ((int) $value->networkId == 2 && $metaCard == false && (int) $_POST['post_ID'] > 0 && isset($res['post_format']) && (int) $res['post_format'] == 0) { //LinkPost
|
687 |
-
$metaCard = true;
|
688 |
-
$meta = B2S_Meta::getInstance();
|
689 |
-
$meta->getMeta((int) $_POST['post_ID']);
|
690 |
-
if (isset($res['image_url']) && !empty($res['image_url'])) {
|
691 |
-
$meta->setMeta('card_image', trim(esc_url($res['image_url'])));
|
692 |
-
$meta->updateMeta((int) $_POST['post_ID']);
|
693 |
-
}
|
694 |
-
}
|
695 |
-
//END MetaTags
|
696 |
-
}
|
697 |
-
}
|
698 |
-
}
|
699 |
-
//Reweet Twitter
|
700 |
-
if (!empty($otherTwitterProfiles) && (int) $initialTwitterPostId > 0 && (int) $_POST['post_ID'] > 0) {
|
701 |
-
global $wpdb;
|
702 |
-
$updateIntTwitter = $wpdb->prepare("UPDATE {$wpdb->prefix}b2s_posts SET post_for_relay = 1 WHERE id = %d", (int) $initialTwitterPostId);
|
703 |
-
$wpdb->get_results($updateIntTwitter);
|
704 |
-
$tw_sched_date = date('Y-m-d H:i:s', strtotime("+15 minutes", strtotime($sched_date)));
|
705 |
-
$tw_sched_date_utc = date('Y-m-d H:i:s', strtotime("+15 minutes", strtotime($sched_date_utc)));
|
706 |
-
foreach ($otherTwitterProfiles as $key => $value) {
|
707 |
-
$getNetworkDetails = $wpdb->prepare("SELECT id FROM {$wpdb->prefix}b2s_posts_network_details WHERE network_auth_id = %d", (int) $value);
|
708 |
-
$networkDetails = $wpdb->get_results($getNetworkDetails);
|
709 |
-
if (isset($networkDetails[0]->id) && $networkDetails[0]->id > 0) {
|
710 |
-
$wpdb->insert($wpdb->prefix . 'b2s_posts', array(
|
711 |
-
'post_id' => (int) $_POST['post_ID'],
|
712 |
-
'blog_user_id' => B2S_PLUGIN_BLOG_USER_ID,
|
713 |
-
'user_timezone' => $user_timezone,
|
714 |
-
'sched_type' => 4, // replay, retweet
|
715 |
-
'sched_date' => $tw_sched_date,
|
716 |
-
'sched_date_utc' => $tw_sched_date_utc,
|
717 |
-
'network_details_id' => (int) $networkDetails[0]->id,
|
718 |
-
'relay_primary_post_id' => (int) $initialTwitterPostId,
|
719 |
-
'relay_delay_min' => (int) 15,
|
720 |
-
'hook_action' => 1), array('%d', '%d', '%s', '%d', '%s', '%s', '%d', '%d', '%d', '%d'));
|
721 |
-
}
|
722 |
-
}
|
723 |
-
}
|
724 |
-
if ($ship) {
|
725 |
-
B2S_Heartbeat::getInstance()->deleteSchedPost();
|
726 |
-
B2S_Heartbeat::getInstance()->postToServer();
|
727 |
-
}
|
728 |
-
|
729 |
-
if ($sched_type != 3) {
|
730 |
-
if (isset($_POST['b2s-user-lang']) && !empty($_POST['b2s-user-lang'])) {
|
731 |
-
$dateFormat = ($_POST['b2s-user-lang'] == 'de') ? 'd.m.Y' : 'Y-m-d';
|
732 |
-
$_POST['b2s_update_publish_date'] = date($dateFormat, strtotime($sched_date));
|
733 |
-
}
|
734 |
-
}
|
735 |
-
|
736 |
-
add_filter('redirect_post_location', array($this, 'b2s_add_param_auto_share_meta_box'));
|
737 |
-
}
|
738 |
-
} else {
|
739 |
-
add_filter('redirect_post_location', array($this, 'b2s_add_param_auto_share_error_data_meta_box'));
|
740 |
-
}
|
741 |
-
} else {
|
742 |
-
if (strtolower($_POST['post_status']) == "publish" || strtolower($_POST['post_status']) == "future") {
|
743 |
-
add_filter('redirect_post_location', array($this, 'b2s_add_param_auto_share_error_meta_box'));
|
744 |
-
}
|
745 |
-
}
|
746 |
-
}
|
747 |
-
} else if (isset($_POST['post_status']) && strtolower($_POST['post_status']) == "future") {
|
748 |
-
//update existing posts, if sched date before future date
|
749 |
-
$user_timezone = isset($_POST['b2s-user-timezone']) ? (int) $_POST['b2s-user-timezone'] : 0;
|
750 |
-
$current_utc_date = gmdate('Y-m-d H:i:s');
|
751 |
-
$current_user_date = date('Y-m-d H:i:s', strtotime(B2S_Util::getUTCForDate($current_utc_date, $user_timezone)));
|
752 |
-
|
753 |
-
$post_date = '';
|
754 |
-
if (isset($_POST['post_date']) && !empty($_POST['post_date'])) {
|
755 |
-
$post_date = date('Y-m-d H:i:s', strtotime($_POST['post_date']));
|
756 |
-
}
|
757 |
-
|
758 |
-
if (empty($post_date)) {
|
759 |
-
if (isset($_POST['mm']) && isset($_POST['jj']) && isset($_POST['aa']) && isset($_POST['hh']) && isset($_POST['mn']) && isset($_POST['ss'])) {
|
760 |
-
$wp_user_sched_post_date = $_POST['aa'] . '-' . $_POST['mm'] . '-' . $_POST['jj'] . ' ' . $_POST['hh'] . ':' . $_POST['mn'] . ':' . $_POST['ss'];
|
761 |
-
} else {
|
762 |
-
//V5.0.0 Gutenberg Editor
|
763 |
-
$wp_user_sched_post_date = get_the_date('Y-m-d H:i:s', $_POST['post_ID']);
|
764 |
-
}
|
765 |
-
$post_date = date('Y-m-d H:i:s', strtotime($wp_user_sched_post_date));
|
766 |
-
}
|
767 |
-
|
768 |
-
$sched_date = date('Y-m-d H:i:59', strtotime($post_date));
|
769 |
-
$sched_date_utc = date('Y-m-d H:i:s', strtotime(B2S_Util::getUTCForDate($sched_date, $user_timezone * (-1))));
|
770 |
-
|
771 |
-
global $wpdb;
|
772 |
-
$getSchedData = $wpdb->prepare("SELECT b.sched_date_utc, b.id as b2sPostId,d.network_id as networkId,d.network_type as networkType,d.network_auth_id as networkAuthId,d.network_display_name as networkUserName FROM {$wpdb->prefix}b2s_posts b LEFT JOIN {$wpdb->prefix}b2s_posts_network_details d ON (d.id = b.network_details_id) WHERE b.post_id = %d AND b.publish_date = %s AND b.hide = %d", (int) $_POST['post_ID'], "0000-00-00 00:00:00", 0);
|
773 |
-
$schedDataResult = $wpdb->get_results($getSchedData);
|
774 |
-
foreach ($schedDataResult as $k => $value) {
|
775 |
-
if ($value->sched_date_utc <= $sched_date_utc) {
|
776 |
-
$ship = true;
|
777 |
-
require_once (B2S_PLUGIN_DIR . '/includes/B2S/Post/Tools.php');
|
778 |
-
B2S_Post_Tools::updateUserSchedTimePost($value->b2sPostId, substr($sched_date, 0, 10), substr($sched_date, 11), $user_timezone);
|
779 |
-
}
|
780 |
-
}
|
781 |
-
|
782 |
-
if ($ship) {
|
783 |
-
B2S_Heartbeat::getInstance()->updateSchedTimePost();
|
784 |
-
}
|
785 |
-
}
|
786 |
-
}
|
787 |
-
}
|
788 |
-
}
|
789 |
-
}
|
790 |
-
}
|
791 |
-
|
792 |
-
public function b2s_add_param_auto_share_meta_box($location) {
|
793 |
-
remove_filter('redirect_post_location', array($this, 'b2s_add_param_auto_share_meta_box'));
|
794 |
-
if (isset($_POST['b2s_update_publish_date'])) {
|
795 |
-
return add_query_arg(array('b2s_action' => 1, 'b2s_update_publish_date' => $_POST['b2s_update_publish_date']), $location);
|
796 |
-
}
|
797 |
-
return add_query_arg(array('b2s_action' => 1), $location);
|
798 |
-
}
|
799 |
-
|
800 |
-
public function b2s_add_param_auto_share_error_meta_box($location) {
|
801 |
-
remove_filter('redirect_post_location', array($this, 'b2s_add_param_auto_share_error_meta_box'));
|
802 |
-
return add_query_arg(array('b2s_action' => 2), $location);
|
803 |
-
}
|
804 |
-
|
805 |
-
public function b2s_add_param_auto_share_error_data_meta_box($location) {
|
806 |
-
remove_filter('redirect_post_location', array($this, 'b2s_add_param_auto_share_error_data_meta_box'));
|
807 |
-
return add_query_arg(array('b2s_action' => 3), $location);
|
808 |
-
}
|
809 |
-
|
810 |
-
public function b2s_save_post_alert_meta_box() {
|
811 |
-
if (isset($_GET['b2s_action'])) {
|
812 |
-
$b2sAction = $_GET['b2s_action'];
|
813 |
-
if ((int) $b2sAction == 1) {
|
814 |
-
$b2sLink = get_option('siteurl') . ((substr(get_option('siteurl'), -1, 1) == '/') ? '' : '/') . 'wp-admin/admin.php?page=';
|
815 |
-
if (isset($_GET['b2s_update_publish_date']) && !empty($_GET['b2s_update_publish_date'])) {
|
816 |
-
$publishDate = htmlspecialchars($_GET['b2s_update_publish_date']);
|
817 |
-
echo '<div class="updated"><p>' . esc_html__('This post will be shared into your social media from', 'blog2social') . ' ' . $publishDate . ' <a target="_blank" href="' . $b2sLink . 'blog2social-sched">' . esc_html__('show details', 'blog2social') . '</a></p></div>';
|
818 |
-
} else {
|
819 |
-
echo '<div class="updated"><p>' . esc_html__('This post will be shared on social media in 2-3 minutes!', 'blog2social') . ' <a target="_blank" href="' . $b2sLink . 'blog2social-publish">' . esc_html__('show details', 'blog2social') . '</a></p></div>';
|
820 |
-
}
|
821 |
-
}
|
822 |
-
if ((int) $b2sAction == 2) {
|
823 |
-
echo '<div class="error"><p>' . esc_html__('Please make sure that your post, page or custom post type is published or scheduled to be published on this blog before you try to post it with Blog2Social. Published WP posts will be shared with your chosen permalink, scheduled WP posts will be shared with the posting id link.', 'blog2social') . '</p></div>';
|
824 |
-
}
|
825 |
-
if ((int) $b2sAction == 3) {
|
826 |
-
echo '<div class="error"><p>' . esc_html__('There are no social network accounts assigned to your selected network collection. Please assign at least one social network account or select another network collection.', 'blog2social') . '</p></div>';
|
827 |
-
}
|
828 |
-
}
|
829 |
-
}
|
830 |
-
|
831 |
-
public function plugin_init_language() {
|
832 |
-
load_plugin_textdomain('blog2social', false, B2S_PLUGIN_LANGUAGE_PATH);
|
833 |
-
$this->defineText();
|
834 |
-
}
|
835 |
-
|
836 |
-
public function override_plugin_action_links($links) {
|
837 |
-
$premium = array();
|
838 |
-
if (defined("B2S_PLUGIN_USER_VERSION") && B2S_PLUGIN_USER_VERSION == 0) {
|
839 |
-
$premium = array('<a target="_blank" style="color: rgba(10, 154, 62, 1); font-weight: bold; font-size: 13px;" href="' . esc_url(B2S_Tools::getSupportLink('affiliate')) . '">' . esc_html__('Upgrade to Premium', 'blog2social') . '</a>');
|
840 |
-
}
|
841 |
-
/* Settings & Support */
|
842 |
-
$links = array_merge($premium, array('settings' => sprintf('<a href="%s">%s</a>', 'admin.php?page=blog2social-settings', esc_html__('Settings', 'blog2social'))), array('support' => sprintf('<a href="%s">%s</a>', 'admin.php?page=blog2social-support', esc_html__('Support', 'blog2social'))), $links);
|
843 |
-
|
844 |
-
if (!isset($links['deactivate'])) {
|
845 |
-
return $links;
|
846 |
-
}//end if
|
847 |
-
|
848 |
-
if (is_network_admin()) {
|
849 |
-
return $links;
|
850 |
-
}//end if
|
851 |
-
|
852 |
-
preg_match_all('/<a[^>]+href="(.+?)"[^>]*>/i', $links['deactivate'], $matches);
|
853 |
-
if (empty($matches) || !isset($matches[1][0])) {
|
854 |
-
return $links;
|
855 |
-
}//end if
|
856 |
-
|
857 |
-
if (isset($matches[1][0])) {
|
858 |
-
$links['deactivate'] = sprintf(
|
859 |
-
'<a id="b2s-deactivate" href="%s">%s</a>', $matches[1][0], // @codingStandardsIgnoreLine
|
860 |
-
esc_html__('Deactivate')
|
861 |
-
);
|
862 |
-
}
|
863 |
-
wp_enqueue_style('B2SPOSTBOXCSS');
|
864 |
-
wp_enqueue_script('B2SPOSTBOXJS');
|
865 |
-
|
866 |
-
return $links;
|
867 |
-
}
|
868 |
-
|
869 |
-
public function override_multisite_plugin_action_links($links) {
|
870 |
-
if (!isset($links['deactivate'])) {
|
871 |
-
return $links;
|
872 |
-
}//end if
|
873 |
-
|
874 |
-
preg_match_all('/<a[^>]+href="(.+?)"[^>]*>/i', $links['deactivate'], $matches);
|
875 |
-
if (empty($matches) || !isset($matches[1][0])) {
|
876 |
-
return $links;
|
877 |
-
}//end if
|
878 |
-
|
879 |
-
if (isset($matches[1][0])) {
|
880 |
-
$links['deactivate'] = sprintf(
|
881 |
-
'<a id="b2s-deactivate" href="%s">%s</a>', $matches[1][0], // @codingStandardsIgnoreLine
|
882 |
-
esc_html__('Network Deactivate')
|
883 |
-
);
|
884 |
-
}
|
885 |
-
wp_enqueue_style('B2SPOSTBOXCSS');
|
886 |
-
wp_enqueue_script('B2SPOSTBOXJS');
|
887 |
-
|
888 |
-
return $links;
|
889 |
-
}
|
890 |
-
|
891 |
-
public function defineText() {
|
892 |
-
define('B2S_PLUGIN_PAGE_TITLE', serialize(array('blog2social-notice' => esc_html__('Notifications', 'blog2social'), 'blog2social-publish' => esc_html__('Shared Posts', 'blog2social'), 'blog2social-approve' => esc_html__('Instant Sharing', 'blog2social'), 'blog2social-draft-post' => esc_html__('Drafts', 'blog2social'), 'blog2social-sched' => esc_html__('Scheduled Posts', 'blog2social'), 'blog2social-curation-draft' => esc_html__('Social Media Post Drafts', 'blog2social'), 'blog2social-favorites' => esc_html__('Favorites', 'blog2social'), 'blog2social-autopost' => esc_html__('Auto-Post', 'blog2social'), 'blog2social-repost' => esc_html__('Re-Share Posts', 'blog2social') . ' <span class="label label-success label-sm">' . esc_html__("NEW", "blog2social") . '</span>')));
|
893 |
-
define('B2S_PLUGIN_NETWORK_TYPE', serialize(array(esc_html__('Profile', 'blog2social'), esc_html__('Page', 'blog2social'), esc_html__('Group', 'blog2social'))));
|
894 |
-
define('B2S_PLUGIN_NETWORK_TYPE_INDIVIDUAL', serialize(array(
|
895 |
-
4 => array(0 => __('Blog', 'blog2social')),
|
896 |
-
6 => array(0 => __('Board', 'blog2social')),
|
897 |
-
11 => array(2 => __('Publication', 'blog2social')),
|
898 |
-
12 => array(1 => __('Business', 'blog2social')),
|
899 |
-
15 => array(0 => __('Subreddit', 'blog2social')),
|
900 |
-
17 => array(2 => __('Community', 'blog2social')),
|
901 |
-
18 => array(0 => __('Location', 'blog2social')),
|
902 |
-
19 => array(1 => __('Employer Branding', 'blog2social')),
|
903 |
-
24 => array(0 => __('Channel', 'blog2social')),
|
904 |
-
25 => array(0 => __('Blog', 'blog2social')),
|
905 |
-
)));
|
906 |
-
define('B2S_PLUGIN_NETWORK_KIND', serialize(array(esc_html__('Company-Page (Employer Branding Profile)', 'blog2social'), esc_html__('Business', 'blog2social'), '', '', esc_html__('Company-Page (Employer Branding Profile)', 'blog2social'))));
|
907 |
-
define('B2S_PLUGIN_NETWORK_ERROR', serialize(array('DEFAULT' => sprintf(__('The network could not publish your post. Please see the following <a target="_blank" href="%s">guide</a>.', 'blog2social'), esc_url(B2S_Tools::getSupportLink('share_error'))),
|
908 |
-
'TOKEN' => esc_html__('Your authorization has expired. Please reconnect your account in the Blog2Social network settings.', 'blog2social'),
|
909 |
-
'CONTENT' => sprintf(__('The content of your post could not be approved by the network. Please see the following <a target="_blank" href="%s">guide</a>.', 'blog2social'), esc_url(B2S_Tools::getSupportLink('content_error'))),
|
910 |
-
'RIGHT' => esc_html__('We don\'t have the permission to publish your post. Please check your authorization.', 'blog2social'),
|
911 |
-
'LOGIN' => sprintf(__('The connection to your social media account is interrupted. Please check your authorization and reconnect your account. The <a target="_blank" href="%s">troubleshooting guide</a> shows you how to fix the connection to your social media account.', 'blog2social'), esc_url(B2S_Tools::getSupportLink('troubleshoot_auth'))),
|
912 |
-
'LIMIT' => esc_html__('Your daily limit has been reached.', 'blog2social'),
|
913 |
-
'IMAGE' => esc_html__('Your post could not be posted, because your image is not available or the image source does not allow to publish', 'blog2social'),
|
914 |
-
'PROTECT' => sprintf(__('The network has blocked your account. Please see the following <a target="_blank" href="%s">guide</a>.', 'blog2social'), esc_url(B2S_Tools::getSupportLink('share_error'))),
|
915 |
-
'IMAGE_LIMIT' => sprintf(__('The number of images is reached. Please see the following <a target="_blank" href="%s">guide</a>.', 'blog2social'), esc_url(B2S_Tools::getSupportLink('share_error'))),
|
916 |
-
'RATE_LIMIT' => esc_html__('Your daily limit for this network has been reached. Please try again later.', 'blog2social'),
|
917 |
-
'INVALID_CONTENT' => sprintf(__('The network can not publish special characters such as Emoji. Please see the following <a target="_blank" href="%s">guide</a>.', 'blog2social'), esc_url(B2S_Tools::getSupportLink('share_error'))),
|
918 |
-
'EXISTS_CONTENT' => esc_html__('Your post is a duplicate.', 'blog2social'),
|
919 |
-
'URL_CONTENT' => esc_html__('The network requires a public url.', 'blog2social'),
|
920 |
-
'BLOGPOST_NOT_PUBLISHED' => esc_html__('Your blog post was not available for the network at the time of publishing.', 'blog2social'),
|
921 |
-
'EXISTS_RELAY' => esc_html__('You have already retweeted this post.', 'blog2social'),
|
922 |
-
'DEPRECATED_NETWORK_8' => esc_html__('This XING API is no longer supported by XING. Please connect your XING accounts with the new XING interface to reschedule your posts.', 'blog2social'),
|
923 |
-
'IMAGE_FOR_CURATION' => esc_html__('An image is required to post on this social network.', 'blog2social'), // special for content curation V.5.0.0
|
924 |
-
'LINK_FOR_CURATION' => esc_html__('To share social media posts on Reddit or Diigo, a link is required.', 'blog2social'), // special for content curation V.6.0.0
|
925 |
-
'IMAGE_NETWORK' => esc_html__('Your post could not be posted, because your image can not be processed by the network.', 'blog2social'),
|
926 |
-
'TEXT_NOT_PUBLISHED_12' => sprintf(__('Instagram published your post without text. Please see the following <a target="_blank" href="%s">guide</a>.', 'blog2social'), esc_url(B2S_Tools::getSupportLink('instagram_without_text'))),
|
927 |
-
'GROUP_CONTENT' => esc_html__('Your group can not be found by the network.', 'blog2social'))));
|
928 |
-
}
|
929 |
-
|
930 |
-
public function getToken() {
|
931 |
-
global $wpdb;
|
932 |
-
$sql = $wpdb->prepare("SELECT token FROM `{$wpdb->prefix}b2s_user` WHERE `blog_user_id` = %d", $this->blogUserData->ID);
|
933 |
-
$userExist = $wpdb->get_row($sql);
|
934 |
-
if (empty($userExist) || !isset($userExist->token)) {
|
935 |
-
if (isset($_GET['page']) && !empty($_GET['page']) && in_array($_GET['page'], unserialize(B2S_PLUGIN_PAGE_SLUG))) {
|
936 |
-
$postData = array('action' => 'getToken', 'blog_user_id' => $this->blogUserData->ID, 'blog_url' => get_option('home'), 'email' => $this->blogUserData->user_email, 'is_multisite' => is_multisite());
|
937 |
-
$result = json_decode(B2S_Tools::getToken($postData));
|
938 |
-
if (isset($result->result) && (int) $result->result == 1 && isset($result->token)) {
|
939 |
-
$state_url = (isset($result->state_url)) ? (int) $result->state_url : 0;
|
940 |
-
$sqlInsertToken = $wpdb->prepare("INSERT INTO `{$wpdb->prefix}b2s_user` (`token`, `blog_user_id`,`register_date`,`state_url`) VALUES (%s,%d,%s,%d);", $result->token, (int) $this->blogUserData->ID, date('Y-m-d H:i:s'), $state_url);
|
941 |
-
$wpdb->query($sqlInsertToken);
|
942 |
-
define('B2S_PLUGIN_TOKEN', $result->token);
|
943 |
-
} else {
|
944 |
-
define('B2S_PLUGIN_NOTICE', 'CONNECTION');
|
945 |
-
}
|
946 |
-
}
|
947 |
-
} else {
|
948 |
-
define('B2S_PLUGIN_TOKEN', $userExist->token);
|
949 |
-
}
|
950 |
-
}
|
951 |
-
|
952 |
-
public function getUserDetails() {
|
953 |
-
$tokenInfo = get_option('B2S_PLUGIN_USER_VERSION_' . B2S_PLUGIN_BLOG_USER_ID);
|
954 |
-
if ($tokenInfo == false || !isset($tokenInfo['B2S_PLUGIN_USER_VERSION']) || !isset($tokenInfo['B2S_PLUGIN_VERSION']) || $tokenInfo['B2S_PLUGIN_USER_VERSION_NEXT_REQUEST'] < time() || (isset($tokenInfo['B2S_PLUGIN_VERSION']) && (int) $tokenInfo['B2S_PLUGIN_VERSION'] < (int) B2S_PLUGIN_VERSION) || (isset($tokenInfo['B2S_PLUGIN_TRAIL_END']) && strtotime($tokenInfo['B2S_PLUGIN_TRAIL_END']) < strtotime(gmdate('Y-m-d H:i:s')))) {
|
955 |
-
B2S_Tools::setUserDetails();
|
956 |
-
} else {
|
957 |
-
define('B2S_PLUGIN_USER_VERSION', $tokenInfo['B2S_PLUGIN_USER_VERSION']);
|
958 |
-
if (isset($tokenInfo['B2S_PLUGIN_TRAIL_END'])) {
|
959 |
-
define('B2S_PLUGIN_TRAIL_END', $tokenInfo['B2S_PLUGIN_TRAIL_END']);
|
960 |
-
update_option('B2S_PLUGIN_DISABLE_TRAIL', true, false);
|
961 |
-
}
|
962 |
-
}
|
963 |
-
|
964 |
-
$checkUpdateOption = get_option('B2S_PLUGIN_NEXT_CHECK_UPDATE_REQUEST');
|
965 |
-
if ($checkUpdateOption == false || $checkUpdateOption < time()) {
|
966 |
-
$this->checkUpdate();
|
967 |
-
update_option('B2S_PLUGIN_NEXT_CHECK_UPDATE_REQUEST', time() + 86400, false);
|
968 |
-
}
|
969 |
-
}
|
970 |
-
|
971 |
-
private function checkUpdate() {
|
972 |
-
$args = array(
|
973 |
-
'timeout' => '5',
|
974 |
-
'redirection' => '5',
|
975 |
-
'user-agent' => "Blog2Social/" . B2S_PLUGIN_VERSION . " (Wordpress/Plugin)"
|
976 |
-
);
|
977 |
-
$result = wp_remote_retrieve_body(wp_remote_get(B2S_PLUGIN_API_ENDPOINT . 'update.txt', $args));
|
978 |
-
$currentVersion = explode('#', $result);
|
979 |
-
if (isset($currentVersion[0]) && (int) $currentVersion[0] > (int) B2S_PLUGIN_VERSION) {
|
980 |
-
define('B2S_PLUGIN_NOTICE', 'UPDATE');
|
981 |
-
}
|
982 |
-
}
|
983 |
-
|
984 |
-
public function createMenu() {
|
985 |
-
$subPages = array();
|
986 |
-
//pageTitle,menutitle,$capability, $menu_slug, $function, $icon_url, $position
|
987 |
-
add_menu_page('Blog2Social', 'Blog2Social', 'blog2social_access', 'blog2social', null, plugins_url('/assets/images/b2s_icon.png', B2S_PLUGIN_FILE));
|
988 |
-
//$parent_slug, $page_title, $menu_title, $capability, $menu_slug, $function
|
989 |
-
$subPages[] = add_submenu_page('blog2social', esc_html__('Dashboard', 'blog2social'), esc_html__('Dashboard', 'blog2social'), 'blog2social_access', 'blog2social', array($this, 'b2sstart'));
|
990 |
-
$subPages[] = add_submenu_page('blog2social', esc_html__('Share Website & Blog Content', 'blog2social'), esc_html__('Site & Blog Content', 'blog2social'), 'blog2social_access', 'blog2social-post', array($this, 'b2sPost'));
|
991 |
-
$subPages[] = add_submenu_page('blog2social', esc_html__('Create Social Media Posts', 'blog2social'), esc_html__('Social Media Posts', 'blog2social'), 'blog2social_access', 'blog2social-curation', array($this, 'b2sContentCuration'));
|
992 |
-
$subPages[] = add_submenu_page('blog2social', esc_html__('Calendar', 'blog2social'), esc_html__('Calendar', 'blog2social'), 'blog2social_access', 'blog2social-calendar', array($this, 'b2sPostCalendar'));
|
993 |
-
$subPages[] = add_submenu_page('blog2social', esc_html__('Networks', 'blog2social'), esc_html__('Networks', 'blog2social'), 'blog2social_access', 'blog2social-network', array($this, 'b2sNetwork'));
|
994 |
-
$subPages[] = add_submenu_page('blog2social', esc_html__('Settings', 'blog2social'), esc_html__('Settings', 'blog2social'), 'blog2social_access', 'blog2social-settings', array($this, 'b2sSettings'));
|
995 |
-
if (!B2S_System::isblockedArea('B2S_MENU_ITEM_WP_PR_SERVICE', B2S_PLUGIN_ADMIN)) {
|
996 |
-
$subPages[] = add_submenu_page('blog2social', esc_html__('PR-Service', 'blog2social'), esc_html__('PR-Service', 'blog2social'), 'blog2social_access', 'prg-post', array($this, 'prgPost'));
|
997 |
-
}
|
998 |
-
$subPages[] = add_submenu_page('blog2social', esc_html__('Help & Support', 'blog2social'), esc_html__('Help & Support', 'blog2social'), 'blog2social_access', 'blog2social-support', array($this, 'b2sSupport'));
|
999 |
-
if (!B2S_System::isblockedArea('B2S_MENU_ITEM_WP_LICENSE', B2S_PLUGIN_ADMIN)) {
|
1000 |
-
$subPages[] = add_submenu_page('blog2social', esc_html__('Premium', 'blog2social'), '<span class="dashicons dashicons-star-filled"></span> ' . esc_html__('PREMIUM', 'blog2social'), 'blog2social_access', 'blog2social-premium', array($this, 'b2sPremium'));
|
1001 |
-
}
|
1002 |
-
$subPages[] = add_submenu_page(null, 'B2S Post Draft', 'B2S Post Draft', 'blog2social_access', 'blog2social-draft-post', array($this, 'b2sPostDraft'));
|
1003 |
-
$subPages[] = add_submenu_page(null, 'B2S Post Favorites', 'B2S Post Favorites', 'blog2social_access', 'blog2social-favorites', array($this, 'b2sPostFavorites'));
|
1004 |
-
$subPages[] = add_submenu_page(null, 'B2S Post Sched', 'B2S Post Sched', 'blog2social_access', 'blog2social-sched', array($this, 'b2sPostSched'));
|
1005 |
-
$subPages[] = add_submenu_page(null, 'B2S Post Approve', 'B2S Post Approve', 'blog2social_access', 'blog2social-approve', array($this, 'b2sPostApprove'));
|
1006 |
-
$subPages[] = add_submenu_page(null, 'B2S Post Publish', 'B2S Post Publish', 'blog2social_access', 'blog2social-publish', array($this, 'b2sPostPublish'));
|
1007 |
-
$subPages[] = add_submenu_page(null, 'B2S Post Notice', 'B2S Post Notice', 'blog2social_access', 'blog2social-notice', array($this, 'b2sPostNotice')); //Error post page since 4.8.0
|
1008 |
-
$subPages[] = add_submenu_page(null, 'B2S Ship', 'B2S Ship', 'blog2social_access', 'blog2social-ship', array($this, 'b2sShip'));
|
1009 |
-
$subPages[] = add_submenu_page(null, 'B2S Curation Drafts', 'B2S Curation Drafts', 'blog2social_access', 'blog2social-curation-draft', array($this, 'b2sCurationDraft'));
|
1010 |
-
$subPages[] = add_submenu_page(null, 'B2S Autoposter', 'B2S Autoposter', 'blog2social_access', 'blog2social-autopost', array($this, 'b2sAutoPost'));
|
1011 |
-
$subPages[] = add_submenu_page(null, 'B2S Reposter', 'B2S Reposter', 'blog2social_access', 'blog2social-repost', array($this, 'b2sRePost'));
|
1012 |
-
$subPages[] = add_submenu_page(null, 'PRG Login', 'PRG Login', 'blog2social_access', 'prg-login', array($this, 'prgLogin'));
|
1013 |
-
$subPages[] = add_submenu_page(null, 'PRG Ship', 'PRG Ship', 'blog2social_access', 'prg-ship', array($this, 'prgShip'));
|
1014 |
-
foreach ($subPages as $var) {
|
1015 |
-
add_action($var, array($this, 'addAssets'));
|
1016 |
-
}
|
1017 |
-
}
|
1018 |
-
|
1019 |
-
public function createToolbarMenu() {
|
1020 |
-
if (!current_user_can('blog2social_access')) {
|
1021 |
-
return;
|
1022 |
-
}
|
1023 |
-
global $wp_admin_bar;
|
1024 |
-
$seo_url = strtolower(get_admin_url(null, 'admin.php?page='));
|
1025 |
-
$title = '<div id="blog2social-ab-icon" class="ab-item" style="padding-left: 25px; background-repeat: no-repeat; background-size: 16px auto; background-position: left center; background-image: url(\'' . plugins_url('/assets/images/b2s_icon.png', B2S_PLUGIN_FILE) . '\');">' . esc_html__('Blog2Social', 'blog2social') . '</div>';
|
1026 |
-
$wp_admin_bar->add_node(array(
|
1027 |
-
'id' => 'blog2social',
|
1028 |
-
'title' => $title,
|
1029 |
-
'href' => $seo_url . 'blog2social'
|
1030 |
-
));
|
1031 |
-
|
1032 |
-
$wp_admin_bar->add_node(array(
|
1033 |
-
'id' => 'blog2social-dashboard',
|
1034 |
-
'title' => esc_html__('Dashboard', 'blog2social'),
|
1035 |
-
'href' => $seo_url . 'blog2social',
|
1036 |
-
'parent' => 'blog2social'
|
1037 |
-
));
|
1038 |
-
|
1039 |
-
$wp_admin_bar->add_node(array(
|
1040 |
-
'id' => 'blog2social-post',
|
1041 |
-
'title' => esc_html__('Site & Blog Content', 'blog2social'),
|
1042 |
-
'href' => $seo_url . 'blog2social-post',
|
1043 |
-
'parent' => 'blog2social'
|
1044 |
-
));
|
1045 |
-
|
1046 |
-
$wp_admin_bar->add_node(array(
|
1047 |
-
'id' => 'blog2social-curation',
|
1048 |
-
'title' => esc_html__('Social Media Posts', 'blog2social'),
|
1049 |
-
'href' => $seo_url . 'blog2social-curation',
|
1050 |
-
'parent' => 'blog2social'
|
1051 |
-
));
|
1052 |
-
|
1053 |
-
$wp_admin_bar->add_node(array(
|
1054 |
-
'id' => 'blog2social-calendar',
|
1055 |
-
'title' => esc_html__('Calendar', 'blog2social'),
|
1056 |
-
'href' => $seo_url . 'blog2social-calendar',
|
1057 |
-
'parent' => 'blog2social'
|
1058 |
-
));
|
1059 |
-
|
1060 |
-
$wp_admin_bar->add_node(array(
|
1061 |
-
'id' => 'blog2social-network',
|
1062 |
-
'title' => esc_html__('Networks', 'blog2social'),
|
1063 |
-
'href' => $seo_url . 'blog2social-network',
|
1064 |
-
'parent' => 'blog2social'
|
1065 |
-
));
|
1066 |
-
$wp_admin_bar->add_node(array(
|
1067 |
-
'id' => 'blog2social-settings',
|
1068 |
-
'title' => esc_html__('Settings', 'blog2social'),
|
1069 |
-
'href' => $seo_url . 'blog2social-settings',
|
1070 |
-
'parent' => 'blog2social'
|
1071 |
-
));
|
1072 |
-
|
1073 |
-
if (!B2S_System::isblockedArea('B2S_MENU_ITEM_WP_PR_SERVICE', B2S_PLUGIN_ADMIN)) {
|
1074 |
-
$wp_admin_bar->add_node(array(
|
1075 |
-
'id' => 'blog2social-prg-post',
|
1076 |
-
'title' => esc_html__('PR-Service', 'blog2social'),
|
1077 |
-
'href' => $seo_url . 'prg-post',
|
1078 |
-
'parent' => 'blog2social'
|
1079 |
-
));
|
1080 |
-
}
|
1081 |
-
|
1082 |
-
$wp_admin_bar->add_node(array(
|
1083 |
-
'id' => 'blog2social-support',
|
1084 |
-
'title' => esc_html__('Help & Support', 'blog2social'),
|
1085 |
-
'href' => $seo_url . 'blog2social-support',
|
1086 |
-
'parent' => 'blog2social'
|
1087 |
-
));
|
1088 |
-
|
1089 |
-
if (!B2S_System::isblockedArea('B2S_MENU_ITEM_WP_LICENSE', B2S_PLUGIN_ADMIN)) {
|
1090 |
-
$wp_admin_bar->add_node(array(
|
1091 |
-
'id' => 'blog2social-premium',
|
1092 |
-
'title' => '<span class="ab-icon dashicons dashicons-star-filled"></span> ' . esc_html__('PREMIUM', 'blog2social'),
|
1093 |
-
'href' => $seo_url . 'blog2social-premium',
|
1094 |
-
'parent' => 'blog2social'
|
1095 |
-
));
|
1096 |
-
}
|
1097 |
-
}
|
1098 |
-
|
1099 |
-
//PageFunktion
|
1100 |
-
public function b2sstart() {
|
1101 |
-
|
1102 |
-
if (B2S_Tools::showNotice() == false) {
|
1103 |
-
wp_enqueue_script('B2SVALIDATEJS');
|
1104 |
-
wp_enqueue_style('B2SFULLCALLENDARCSS');
|
1105 |
-
wp_enqueue_style('B2SCALENDARCSS');
|
1106 |
-
wp_enqueue_script('B2SFULLCALENDARMOMENTJS');
|
1107 |
-
wp_enqueue_script('B2SFULLCALENDARJS');
|
1108 |
-
wp_enqueue_script('B2SFULLCALENDARLOCALEJS');
|
1109 |
-
wp_enqueue_script('B2SLIB');
|
1110 |
-
|
1111 |
-
wp_enqueue_script('B2SMOMENT');
|
1112 |
-
wp_enqueue_script('B2SCHARTJS');
|
1113 |
-
wp_enqueue_style('B2SSTARTCSS');
|
1114 |
-
wp_enqueue_script('B2SSTARTJS');
|
1115 |
-
wp_enqueue_style('B2SPOSTCSS');
|
1116 |
-
wp_enqueue_script('B2SPOSTJS');
|
1117 |
-
wp_enqueue_style('B2SAIRDATEPICKERCSS');
|
1118 |
-
wp_enqueue_script('B2SAIRDATEPICKERJS');
|
1119 |
-
wp_enqueue_script('B2SAIRDATEPICKERDEJS');
|
1120 |
-
wp_enqueue_script('B2SAIRDATEPICKERENJS');
|
1121 |
-
require_once( B2S_PLUGIN_DIR . 'views/b2s/dashboard.php');
|
1122 |
-
} else {
|
1123 |
-
require_once( B2S_PLUGIN_DIR . 'views/notice.php');
|
1124 |
-
}
|
1125 |
-
}
|
1126 |
-
|
1127 |
-
//PageFunktion
|
1128 |
-
public function b2sPost() {
|
1129 |
-
if (B2S_Tools::showNotice() == false) {
|
1130 |
-
wp_enqueue_script('B2SVALIDATEJS');
|
1131 |
-
wp_enqueue_style('B2SPOSTCSS');
|
1132 |
-
wp_enqueue_script('B2SPOSTJS');
|
1133 |
-
require_once( B2S_PLUGIN_DIR . 'views/b2s/post.php');
|
1134 |
-
} else {
|
1135 |
-
require_once( B2S_PLUGIN_DIR . 'views/notice.php');
|
1136 |
-
}
|
1137 |
-
}
|
1138 |
-
|
1139 |
-
//Page Curation
|
1140 |
-
public function b2sContentCuration() {
|
1141 |
-
if (B2S_Tools::showNotice() == false) {
|
1142 |
-
wp_enqueue_script('B2SVALIDATEJS');
|
1143 |
-
wp_enqueue_style('B2SCURATIONCSS');
|
1144 |
-
wp_enqueue_script('B2SEMOJIBUTTONJS');
|
1145 |
-
wp_enqueue_script('B2SCURATIONJS');
|
1146 |
-
wp_enqueue_style('B2SAIRDATEPICKERCSS');
|
1147 |
-
wp_enqueue_script('B2SAIRDATEPICKERJS');
|
1148 |
-
wp_enqueue_script('B2SAIRDATEPICKERDEJS');
|
1149 |
-
wp_enqueue_script('B2SAIRDATEPICKERENJS');
|
1150 |
-
if (current_user_can('upload_files')) {
|
1151 |
-
//Capability by Super Admin ,Administrator ,Editor ,Author
|
1152 |
-
wp_enqueue_media();
|
1153 |
-
}
|
1154 |
-
require_once( B2S_PLUGIN_DIR . 'views/b2s/curation.php');
|
1155 |
-
} else {
|
1156 |
-
require_once( B2S_PLUGIN_DIR . 'views/notice.php');
|
1157 |
-
}
|
1158 |
-
}
|
1159 |
-
|
1160 |
-
//PageFunktion
|
1161 |
-
public function b2sNetwork() {
|
1162 |
-
if (B2S_Tools::showNotice() == false) {
|
1163 |
-
wp_enqueue_script('B2SVALIDATEJS');
|
1164 |
-
wp_enqueue_style('B2SNETWORKCSS');
|
1165 |
-
wp_enqueue_script('B2SNETWORKJS');
|
1166 |
-
wp_enqueue_style('B2STIMEPICKERCSS');
|
1167 |
-
wp_enqueue_script('B2STIMEPICKERJS');
|
1168 |
-
require_once( B2S_PLUGIN_DIR . 'views/b2s/network.php');
|
1169 |
-
} else {
|
1170 |
-
require_once( B2S_PLUGIN_DIR . 'views/notice.php');
|
1171 |
-
}
|
1172 |
-
}
|
1173 |
-
|
1174 |
-
//PageFunktion
|
1175 |
-
public function b2sSettings() {
|
1176 |
-
if (B2S_Tools::showNotice() == false) {
|
1177 |
-
wp_enqueue_script('B2SVALIDATEJS');
|
1178 |
-
wp_enqueue_style('B2SSETTINGSCSS');
|
1179 |
-
wp_enqueue_script('B2SSETTINGSJS');
|
1180 |
-
wp_enqueue_style('B2STIMEPICKERCSS');
|
1181 |
-
wp_enqueue_script('B2STIMEPICKERJS');
|
1182 |
-
wp_enqueue_style('B2SBTNTOOGLECSS');
|
1183 |
-
wp_enqueue_script('B2SBTNTOOGLEJS');
|
1184 |
-
wp_enqueue_style('B2SCHOSENCSS');
|
1185 |
-
wp_enqueue_script('B2SCHOSENJS');
|
1186 |
-
|
1187 |
-
if (current_user_can('upload_files')) {
|
1188 |
-
//Capability by Super Admin ,Administrator ,Editor ,Author
|
1189 |
-
wp_enqueue_media();
|
1190 |
-
}
|
1191 |
-
require_once( B2S_PLUGIN_DIR . 'views/b2s/settings.php');
|
1192 |
-
} else {
|
1193 |
-
require_once( B2S_PLUGIN_DIR . 'views/notice.php');
|
1194 |
-
}
|
1195 |
-
}
|
1196 |
-
|
1197 |
-
//PageFunktion
|
1198 |
-
public function b2sShip() {
|
1199 |
-
if (B2S_Tools::showNotice() == false) {
|
1200 |
-
wp_enqueue_script('B2SVALIDATEJS');
|
1201 |
-
wp_enqueue_style('B2SFULLCALLENDARCSS');
|
1202 |
-
wp_enqueue_style('B2SCALENDARCSS');
|
1203 |
-
wp_enqueue_script('B2SFULLCALENDARMOMENTJS');
|
1204 |
-
wp_enqueue_script('B2SFULLCALENDARJS');
|
1205 |
-
wp_enqueue_script('B2SFULLCALENDARLOCALEJS');
|
1206 |
-
wp_enqueue_script('B2SLIB');
|
1207 |
-
wp_enqueue_style('B2SSHIPCSS');
|
1208 |
-
wp_enqueue_style('B2SDATEPICKERCSS');
|
1209 |
-
wp_enqueue_style('B2STIMEPICKERCSS');
|
1210 |
-
wp_enqueue_style('B2SWYSIWYGCSS');
|
1211 |
-
wp_enqueue_script('B2SWYSIWYGJS');
|
1212 |
-
wp_enqueue_script('B2SEMOJIBUTTONJS');
|
1213 |
-
if (substr(B2S_LANGUAGE, 0, 2) == 'de') {
|
1214 |
-
wp_enqueue_script('B2SWYSIWYGLANGDEJS');
|
1215 |
-
} else {
|
1216 |
-
wp_enqueue_script('B2SWYSIWYGLANGENJS');
|
1217 |
-
}
|
1218 |
-
wp_enqueue_script('B2SDATEPICKERJS');
|
1219 |
-
wp_enqueue_script('B2SDATEPICKERDEJS');
|
1220 |
-
wp_enqueue_script('B2SDATEPICKERENJS');
|
1221 |
-
wp_enqueue_script('B2STIMEPICKERJS');
|
1222 |
-
wp_enqueue_script('B2SSHIPJS');
|
1223 |
-
if (current_user_can('upload_files')) {
|
1224 |
-
//Capability by Super Admin ,Administrator ,Editor ,Author
|
1225 |
-
wp_enqueue_media();
|
1226 |
-
}
|
1227 |
-
require_once( B2S_PLUGIN_DIR . 'views/b2s/ship.php');
|
1228 |
-
} else {
|
1229 |
-
require_once( B2S_PLUGIN_DIR . 'views/notice.php');
|
1230 |
-
}
|
1231 |
-
}
|
1232 |
-
|
1233 |
-
//PageFunktion
|
1234 |
-
public function b2sCurationDraft() {
|
1235 |
-
if (B2S_Tools::showNotice() == false) {
|
1236 |
-
wp_enqueue_script('B2SVALIDATEJS');
|
1237 |
-
wp_enqueue_style('B2SCURATIONDRAFTCSS');
|
1238 |
-
wp_enqueue_script('B2SCURATIONDRAFTJS');
|
1239 |
-
require_once( B2S_PLUGIN_DIR . 'views/b2s/curation.draft.php');
|
1240 |
-
} else {
|
1241 |
-
require_once( B2S_PLUGIN_DIR . 'views/notice.php');
|
1242 |
-
}
|
1243 |
-
}
|
1244 |
-
|
1245 |
-
//PageFunktion
|
1246 |
-
public function b2sAutoPost() {
|
1247 |
-
if (B2S_Tools::showNotice() == false) {
|
1248 |
-
wp_enqueue_script('B2SVALIDATEJS');
|
1249 |
-
wp_enqueue_style('B2SAUTOPOSTCSS');
|
1250 |
-
wp_enqueue_script('B2SAUTOPOSTJS');
|
1251 |
-
wp_enqueue_style('B2SBTNTOOGLECSS');
|
1252 |
-
wp_enqueue_script('B2SBTNTOOGLEJS');
|
1253 |
-
wp_enqueue_style('B2SCHOSENCSS');
|
1254 |
-
wp_enqueue_script('B2SCHOSENJS');
|
1255 |
-
require_once( B2S_PLUGIN_DIR . 'views/b2s/autopost.php');
|
1256 |
-
} else {
|
1257 |
-
require_once( B2S_PLUGIN_DIR . 'views/notice.php');
|
1258 |
-
}
|
1259 |
-
}
|
1260 |
-
|
1261 |
-
//PageFunktion
|
1262 |
-
public function b2sRePost() {
|
1263 |
-
if (B2S_Tools::showNotice() == false) {
|
1264 |
-
wp_enqueue_script('B2SVALIDATEJS');
|
1265 |
-
wp_enqueue_style('B2SREPOSTCSS');
|
1266 |
-
wp_enqueue_script('B2SREPOSTJS');
|
1267 |
-
wp_enqueue_style('B2SCHOSENCSS');
|
1268 |
-
wp_enqueue_script('B2SCHOSENJS');
|
1269 |
-
wp_enqueue_style('B2SFULLCALLENDARCSS');
|
1270 |
-
wp_enqueue_style('B2SCALENDARCSS');
|
1271 |
-
wp_enqueue_script('B2SFULLCALENDARMOMENTJS');
|
1272 |
-
wp_enqueue_script('B2SFULLCALENDARJS');
|
1273 |
-
wp_enqueue_script('B2SFULLCALENDARLOCALEJS');
|
1274 |
-
wp_enqueue_script('B2SLIB');
|
1275 |
-
wp_enqueue_style('B2SDATEPICKERCSS');
|
1276 |
-
wp_enqueue_style('B2STIMEPICKERCSS');
|
1277 |
-
wp_enqueue_script('B2SDATEPICKERJS');
|
1278 |
-
wp_enqueue_script('B2SDATEPICKERDEJS');
|
1279 |
-
wp_enqueue_script('B2SDATEPICKERENJS');
|
1280 |
-
wp_enqueue_script('B2STIMEPICKERJS');
|
1281 |
-
wp_enqueue_style('B2SWYSIWYGCSS');
|
1282 |
-
wp_enqueue_script('B2SWYSIWYGJS');
|
1283 |
-
wp_enqueue_script('B2SEMOJIBUTTONJS');
|
1284 |
-
wp_enqueue_script('B2SSHIPJS');
|
1285 |
-
if (substr(B2S_LANGUAGE, 0, 2) == 'de') {
|
1286 |
-
wp_enqueue_script('B2SWYSIWYGLANGDEJS');
|
1287 |
-
} else {
|
1288 |
-
wp_enqueue_script('B2SWYSIWYGLANGENJS');
|
1289 |
-
}
|
1290 |
-
if (current_user_can('upload_files')) {
|
1291 |
-
//Capability by Super Admin ,Administrator ,Editor ,Author
|
1292 |
-
wp_enqueue_media();
|
1293 |
-
}
|
1294 |
-
require_once( B2S_PLUGIN_DIR . 'views/b2s/repost.php');
|
1295 |
-
} else {
|
1296 |
-
require_once( B2S_PLUGIN_DIR . 'views/notice.php');
|
1297 |
-
}
|
1298 |
-
}
|
1299 |
-
|
1300 |
-
//PageFunktion
|
1301 |
-
public function prgLogin() {
|
1302 |
-
wp_enqueue_script('B2SVALIDATEJS');
|
1303 |
-
if (B2S_Tools::showNotice() == false) {
|
1304 |
-
$prgInfo = get_option('B2S_PLUGIN_PRG_' . B2S_PLUGIN_BLOG_USER_ID);
|
1305 |
-
if ($prgInfo != false && isset($prgInfo['B2S_PRG_ID']) && (int) $prgInfo['B2S_PRG_ID'] > 0 && isset($prgInfo['B2S_PRG_TOKEN']) && !empty($prgInfo['B2S_PRG_TOKEN'])) {
|
1306 |
-
$postId = (int) $_GET['postId'];
|
1307 |
-
echo'<script> window.location="' . admin_url('/admin.php?page=prg-ship&postId=' . $postId, 'http') . '"; </script> ';
|
1308 |
-
wp_die();
|
1309 |
-
} else {
|
1310 |
-
wp_enqueue_style('PRGLOGINCSS');
|
1311 |
-
wp_enqueue_script('PRGLOGINJS');
|
1312 |
-
require_once( B2S_PLUGIN_DIR . 'views/prg/login.php');
|
1313 |
-
}
|
1314 |
-
} else {
|
1315 |
-
require_once( B2S_PLUGIN_DIR . 'views/notice.php');
|
1316 |
-
}
|
1317 |
-
}
|
1318 |
-
|
1319 |
-
//PageFunktion
|
1320 |
-
public function prgShip() {
|
1321 |
-
if (B2S_Tools::showNotice() == false) {
|
1322 |
-
wp_enqueue_script('B2SVALIDATEJS');
|
1323 |
-
wp_enqueue_style('PRGSHIPCSS');
|
1324 |
-
wp_enqueue_script('PRGSHIPJS');
|
1325 |
-
wp_enqueue_script('PRGGENERALJS');
|
1326 |
-
require_once( B2S_PLUGIN_DIR . 'views/prg/ship.php');
|
1327 |
-
} else {
|
1328 |
-
require_once( B2S_PLUGIN_DIR . 'views/notice.php');
|
1329 |
-
}
|
1330 |
-
}
|
1331 |
-
|
1332 |
-
//PageFunktion
|
1333 |
-
public function b2sPostSched() {
|
1334 |
-
if (B2S_Tools::showNotice() == false) {
|
1335 |
-
wp_enqueue_script('B2SVALIDATEJS');
|
1336 |
-
wp_enqueue_script('B2SLIB');
|
1337 |
-
wp_enqueue_style('B2SPOSTSCHEDCSS');
|
1338 |
-
wp_enqueue_style('B2SDATEPICKERCSS');
|
1339 |
-
wp_enqueue_style('B2STIMEPICKERCSS');
|
1340 |
-
wp_enqueue_script('B2SDATEPICKERJS');
|
1341 |
-
wp_enqueue_script('B2SDATEPICKERDEJS');
|
1342 |
-
wp_enqueue_script('B2SDATEPICKERENJS');
|
1343 |
-
wp_enqueue_script('B2STIMEPICKERJS');
|
1344 |
-
wp_enqueue_script('B2SPOSTJS');
|
1345 |
-
wp_enqueue_style('B2SWYSIWYGCSS');
|
1346 |
-
wp_enqueue_script('B2SWYSIWYGJS');
|
1347 |
-
wp_enqueue_script('B2SEMOJIBUTTONJS');
|
1348 |
-
wp_enqueue_script('B2SSHIPJS');
|
1349 |
-
if (substr(B2S_LANGUAGE, 0, 2) == 'de') {
|
1350 |
-
wp_enqueue_script('B2SWYSIWYGLANGDEJS');
|
1351 |
-
} else {
|
1352 |
-
wp_enqueue_script('B2SWYSIWYGLANGENJS');
|
1353 |
-
}
|
1354 |
-
if (current_user_can('upload_files')) {
|
1355 |
-
//Capability by Super Admin ,Administrator ,Editor ,Author
|
1356 |
-
wp_enqueue_media();
|
1357 |
-
}
|
1358 |
-
require_once( B2S_PLUGIN_DIR . 'views/b2s/post.sched.php');
|
1359 |
-
} else {
|
1360 |
-
require_once( B2S_PLUGIN_DIR . 'views/notice.php');
|
1361 |
-
}
|
1362 |
-
}
|
1363 |
-
|
1364 |
-
//PageFunktion
|
1365 |
-
public function b2sPostApprove() {
|
1366 |
-
if (B2S_Tools::showNotice() == false) {
|
1367 |
-
wp_enqueue_script('B2SVALIDATEJS');
|
1368 |
-
wp_enqueue_style('B2SPOSTAPPROVECSS');
|
1369 |
-
wp_enqueue_script('B2SPOSTJS');
|
1370 |
-
require_once( B2S_PLUGIN_DIR . 'views/b2s/post.approve.php');
|
1371 |
-
} else {
|
1372 |
-
require_once( B2S_PLUGIN_DIR . 'views/notice.php');
|
1373 |
-
}
|
1374 |
-
}
|
1375 |
-
|
1376 |
-
//PageFunktion
|
1377 |
-
public function b2sPostDraft() {
|
1378 |
-
if (B2S_Tools::showNotice() == false) {
|
1379 |
-
wp_enqueue_script('B2SVALIDATEJS');
|
1380 |
-
wp_enqueue_style('B2SPOSTDRAFTCSS');
|
1381 |
-
wp_enqueue_style('B2SDATEPICKERCSS');
|
1382 |
-
wp_enqueue_script('B2SDATEPICKERJS');
|
1383 |
-
wp_enqueue_script('B2SDATEPICKERDEJS');
|
1384 |
-
wp_enqueue_script('B2SDATEPICKERENJS');
|
1385 |
-
wp_enqueue_script('B2SPOSTJS');
|
1386 |
-
require_once( B2S_PLUGIN_DIR . 'views/b2s/post.draft.php');
|
1387 |
-
} else {
|
1388 |
-
require_once( B2S_PLUGIN_DIR . 'views/notice.php');
|
1389 |
-
}
|
1390 |
-
}
|
1391 |
-
|
1392 |
-
//PageFunktion
|
1393 |
-
public function b2sPostFavorites() {
|
1394 |
-
if (B2S_Tools::showNotice() == false) {
|
1395 |
-
wp_enqueue_script('B2SVALIDATEJS');
|
1396 |
-
wp_enqueue_style('B2SPOSTCSS');
|
1397 |
-
wp_enqueue_script('B2SPOSTJS');
|
1398 |
-
require_once( B2S_PLUGIN_DIR . 'views/b2s/post.favorites.php');
|
1399 |
-
} else {
|
1400 |
-
require_once( B2S_PLUGIN_DIR . 'views/notice.php');
|
1401 |
-
}
|
1402 |
-
}
|
1403 |
-
|
1404 |
-
//PageFunktion
|
1405 |
-
public function b2sPostCalendar() {
|
1406 |
-
if (B2S_Tools::showNotice() == false) {
|
1407 |
-
wp_enqueue_script('B2SVALIDATEJS');
|
1408 |
-
wp_enqueue_script('B2SLIB');
|
1409 |
-
wp_enqueue_style('B2SFULLCALLENDARCSS');
|
1410 |
-
wp_enqueue_style('B2SCALENDARCSS');
|
1411 |
-
wp_enqueue_style('B2SDATEPICKERCSS');
|
1412 |
-
wp_enqueue_style('B2STIMEPICKERCSS');
|
1413 |
-
wp_enqueue_script('B2SDATEPICKERJS');
|
1414 |
-
wp_enqueue_script('B2SDATEPICKERDEJS');
|
1415 |
-
wp_enqueue_script('B2SDATEPICKERENJS');
|
1416 |
-
wp_enqueue_script('B2STIMEPICKERJS');
|
1417 |
-
wp_enqueue_script('B2SCALENDARJS');
|
1418 |
-
wp_enqueue_script('B2SFULLCALENDARMOMENTJS');
|
1419 |
-
wp_enqueue_script('B2SFULLCALENDARJS');
|
1420 |
-
wp_enqueue_script('B2SFULLCALENDARLOCALEJS');
|
1421 |
-
wp_enqueue_style('B2SWYSIWYGCSS');
|
1422 |
-
wp_enqueue_script('B2SWYSIWYGJS');
|
1423 |
-
wp_enqueue_script('B2SEMOJIBUTTONJS');
|
1424 |
-
wp_enqueue_script('B2SSHIPJS');
|
1425 |
-
if (substr(B2S_LANGUAGE, 0, 2) == 'de') {
|
1426 |
-
wp_enqueue_script('B2SWYSIWYGLANGDEJS');
|
1427 |
-
} else {
|
1428 |
-
wp_enqueue_script('B2SWYSIWYGLANGENJS');
|
1429 |
-
}
|
1430 |
-
|
1431 |
-
if (current_user_can('upload_files')) {
|
1432 |
-
//Capability by Super Admin ,Administrator ,Editor ,Author
|
1433 |
-
wp_enqueue_media();
|
1434 |
-
}
|
1435 |
-
require_once( B2S_PLUGIN_DIR . 'views/b2s/post.calendar.php');
|
1436 |
-
} else {
|
1437 |
-
require_once( B2S_PLUGIN_DIR . 'views/notice.php');
|
1438 |
-
}
|
1439 |
-
}
|
1440 |
-
|
1441 |
-
//PageFunktion
|
1442 |
-
public function b2sSupport() {
|
1443 |
-
wp_enqueue_script('B2SVALIDATEJS');
|
1444 |
-
wp_enqueue_style('B2SSUPPORT');
|
1445 |
-
wp_enqueue_script('B2SSUPPORTJS');
|
1446 |
-
require_once( B2S_PLUGIN_DIR . 'views/b2s/support.php');
|
1447 |
-
}
|
1448 |
-
|
1449 |
-
//PageFunktion
|
1450 |
-
public function b2sPremium() {
|
1451 |
-
wp_enqueue_script('B2SVALIDATEJS');
|
1452 |
-
wp_enqueue_style('B2SPREMIUM');
|
1453 |
-
wp_enqueue_style('B2SCHOSENCSS');
|
1454 |
-
wp_enqueue_script('B2SCHOSENJS');
|
1455 |
-
wp_enqueue_script('B2SPREMIUMJS');
|
1456 |
-
require_once( B2S_PLUGIN_DIR . 'views/b2s/premium.php');
|
1457 |
-
}
|
1458 |
-
|
1459 |
-
//PageFunktion
|
1460 |
-
public function b2sPostPublish() {
|
1461 |
-
if (B2S_Tools::showNotice() == false) {
|
1462 |
-
wp_enqueue_script('B2SVALIDATEJS');
|
1463 |
-
wp_enqueue_style('B2SPOSTPUBLISHCSS');
|
1464 |
-
wp_enqueue_script('B2SPOSTJS');
|
1465 |
-
wp_enqueue_script('PRGGENERALJS');
|
1466 |
-
require_once( B2S_PLUGIN_DIR . 'views/b2s/post.publish.php');
|
1467 |
-
} else {
|
1468 |
-
require_once( B2S_PLUGIN_DIR . 'views/notice.php');
|
1469 |
-
}
|
1470 |
-
}
|
1471 |
-
|
1472 |
-
//PageFunktion
|
1473 |
-
public function b2sPostNotice() {
|
1474 |
-
if (B2S_Tools::showNotice() == false) {
|
1475 |
-
wp_enqueue_script('B2SVALIDATEJS');
|
1476 |
-
wp_enqueue_style('B2SPOSTNOTICECSS');
|
1477 |
-
wp_enqueue_script('B2SPOSTJS');
|
1478 |
-
wp_enqueue_script('PRGGENERALJS');
|
1479 |
-
require_once( B2S_PLUGIN_DIR . 'views/b2s/post.notice.php');
|
1480 |
-
} else {
|
1481 |
-
require_once( B2S_PLUGIN_DIR . 'views/notice.php');
|
1482 |
-
}
|
1483 |
-
}
|
1484 |
-
|
1485 |
-
//PageFunktion
|
1486 |
-
public function prgPost() {
|
1487 |
-
if (B2S_Tools::showNotice() == false) {
|
1488 |
-
wp_enqueue_script('B2SVALIDATEJS');
|
1489 |
-
wp_enqueue_style('PRGPOSTCSS');
|
1490 |
-
wp_enqueue_script('PRGPOSTJS');
|
1491 |
-
wp_enqueue_script('PRGGENERALJS');
|
1492 |
-
require_once( B2S_PLUGIN_DIR . 'views/prg/post.php');
|
1493 |
-
} else {
|
1494 |
-
require_once( B2S_PLUGIN_DIR . 'views/notice.php');
|
1495 |
-
}
|
1496 |
-
}
|
1497 |
-
|
1498 |
-
public function addBootAssets($hook) {
|
1499 |
-
if ($hook == 'edit.php') {
|
1500 |
-
wp_enqueue_script('B2SPOSTSCHEDHEARTBEATJS');
|
1501 |
-
}
|
1502 |
-
|
1503 |
-
if ($hook == 'plugins.php') {
|
1504 |
-
wp_enqueue_script('B2SPLUGINDEACTIVATEJS');
|
1505 |
-
wp_enqueue_style('B2SPLUGINDEACTIVATECSS');
|
1506 |
-
}
|
1507 |
-
}
|
1508 |
-
|
1509 |
-
public function addAssets() {
|
1510 |
-
wp_enqueue_style('B2SBOOTCSS');
|
1511 |
-
wp_enqueue_script('B2SBOOTJS');
|
1512 |
-
wp_enqueue_script('B2SGENERALJS');
|
1513 |
-
}
|
1514 |
-
|
1515 |
-
public function registerAssets() {
|
1516 |
-
wp_register_style('B2SBOOTCSS', plugins_url('assets/css/general.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1517 |
-
wp_register_style('B2SSTARTCSS', plugins_url('assets/css/b2s/start.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1518 |
-
wp_register_style('B2SPOSTCSS', plugins_url('assets/css/b2s/post.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1519 |
-
wp_register_style('B2SSHIPCSS', plugins_url('assets/css/b2s/ship.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1520 |
-
wp_register_style('B2SCURATIONCSS', plugins_url('assets/css/b2s/curation.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1521 |
-
|
1522 |
-
wp_register_style('B2SPOSTSCHEDCSS', plugins_url('assets/css/b2s/post.sched.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1523 |
-
wp_register_style('B2SPOSTDRAFTCSS', plugins_url('assets/css/b2s/post.draft.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1524 |
-
wp_register_style('B2SPOSTAPPROVECSS', plugins_url('assets/css/b2s/post.approve.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1525 |
-
wp_register_style('B2SPOSTPUBLISHCSS', plugins_url('assets/css/b2s/post.publish.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1526 |
-
wp_register_style('B2SPOSTNOTICECSS', plugins_url('assets/css/b2s/post.notice.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1527 |
-
wp_register_style('B2SNETWORKCSS', plugins_url('assets/css/b2s/network.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1528 |
-
wp_register_style('B2SSUPPORT', plugins_url('assets/css/b2s/support.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1529 |
-
wp_register_style('B2SPREMIUM', plugins_url('assets/css/b2s/premium.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1530 |
-
wp_register_style('B2SSETTINGSCSS', plugins_url('assets/css/b2s/settings.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1531 |
-
wp_register_style('PRGSHIPCSS', plugins_url('assets/css/prg/ship.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1532 |
-
wp_register_style('PRGLOGINCSS', plugins_url('assets/css/prg/login.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1533 |
-
wp_register_style('B2SDATEPICKERCSS', plugins_url('assets/lib/datepicker/css/bootstrap-datepicker3.min.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1534 |
-
wp_register_style('B2SAIRDATEPICKERCSS', plugins_url('assets/lib/air-datepicker/css/datepicker.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1535 |
-
wp_register_style('B2STIMEPICKERCSS', plugins_url('assets/lib/timepicker/timepicker.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1536 |
-
wp_register_style('PRGPOSTCSS', plugins_url('assets/css/prg/post.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1537 |
-
wp_register_style('B2SWYSIWYGCSS', plugins_url('assets/lib/wysiwyg/square.min.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1538 |
-
wp_register_style('B2SPOSTBOXCSS', plugins_url('assets/css/b2s/wp/post-box.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1539 |
-
wp_register_style('B2SNOTICECSS', plugins_url('assets/css/notice.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1540 |
-
wp_register_style('B2SFULLCALLENDARCSS', plugins_url('assets/lib/fullcalendar/fullcalendar.min.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1541 |
-
wp_register_style('B2SCALENDARCSS', plugins_url('assets/css/b2s/calendar.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1542 |
-
wp_register_style('B2SBTNTOOGLECSS', plugins_url('assets/lib/btn-toogle/bootstrap-toggle.min.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1543 |
-
wp_register_style('B2SCHOSENCSS', plugins_url('assets/lib/chosen/chosen.min.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1544 |
-
wp_register_style('B2SPLUGINDEACTIVATECSS', plugins_url('assets/css/b2s/wp/plugin-deactivate.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1545 |
-
wp_register_style('B2SCURATIONDRAFTCSS', plugins_url('assets/css/b2s/curation.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1546 |
-
wp_register_style('B2SAUTOPOSTCSS', plugins_url('assets/css/b2s/autopost.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1547 |
-
wp_register_style('B2SREPOSTCSS', plugins_url('assets/css/b2s/repost.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1548 |
-
|
1549 |
-
wp_register_script('B2SNETWORKJS', plugins_url('assets/js/b2s/network.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1550 |
-
wp_register_script('B2SSETTINGSJS', plugins_url('assets/js/b2s/settings.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1551 |
-
wp_register_script('B2SAUTOPOSTJS', plugins_url('assets/js/b2s/autopost.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1552 |
-
wp_register_script('B2SREPOSTJS', plugins_url('assets/js/b2s/repost.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1553 |
-
wp_register_script('B2SSTARTJS', plugins_url('assets/js/b2s/start.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1554 |
-
wp_register_script('B2SPOSTJS', plugins_url('assets/js/b2s/post.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1555 |
-
wp_register_script('B2SSHIPJS', plugins_url('assets/js/b2s/ship.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1556 |
-
wp_register_script('B2SCURATIONJS', plugins_url('assets/js/b2s/curation.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1557 |
-
wp_register_script('PRGSHIPJS', plugins_url('assets/js/prg/ship.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1558 |
-
wp_register_script('PRGLOGINJS', plugins_url('assets/js/prg/login.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1559 |
-
wp_register_script('B2SBOOTJS', plugins_url('assets/js/general.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1560 |
-
wp_register_script('B2SVALIDATEJS', plugins_url('assets/js/validate.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1561 |
-
|
1562 |
-
wp_register_script('B2SSUPPORTJS', plugins_url('assets/js/b2s/support.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1563 |
-
wp_register_script('B2SGENERALJS', plugins_url('assets/js/b2s/general.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1564 |
-
wp_register_script('B2SDATEPICKERJS', plugins_url('assets/lib/datepicker/js/bootstrap-datepicker.min.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1565 |
-
wp_register_script('B2SDATEPICKERDEJS', plugins_url('assets/lib/datepicker/locales/bootstrap-datepicker.de_DE.min.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1566 |
-
wp_register_script('B2SDATEPICKERENJS', plugins_url('assets/lib/datepicker/locales/bootstrap-datepicker.en_US.min.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1567 |
-
wp_register_script('B2SAIRDATEPICKERJS', plugins_url('assets/lib/air-datepicker/js/datepicker.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1568 |
-
wp_register_script('B2SAIRDATEPICKERDEJS', plugins_url('assets/lib/air-datepicker/js/locales/datepicker.de.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1569 |
-
wp_register_script('B2SAIRDATEPICKERENJS', plugins_url('assets/lib/air-datepicker/js/locales/datepicker.en.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1570 |
-
wp_register_script('B2SCHARTJS', plugins_url('assets/lib/chartjs/Chart.bundle.min.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1571 |
-
wp_register_script('B2SMOMENT', plugins_url('assets/lib/moment/moment-with-locales.min.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1572 |
-
wp_register_script('B2STIMEPICKERJS', plugins_url('assets/lib/timepicker/timepicker.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1573 |
-
wp_register_script('PRGPOSTJS', plugins_url('assets/js/prg/post.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1574 |
-
wp_register_script('PRGGENERALJS', plugins_url('assets/js/prg/general.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1575 |
-
wp_register_script('B2SWYSIWYGJS', plugins_url('assets/lib/wysiwyg/jquery.sceditor.xhtml.min.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1576 |
-
wp_register_script('B2SWYSIWYGLANGDEJS', plugins_url('assets/lib/wysiwyg/languages/de.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1577 |
-
wp_register_script('B2SWYSIWYGLANGENJS', plugins_url('assets/lib/wysiwyg/languages/en.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1578 |
-
wp_register_script('B2SPOSTBOXJS', plugins_url('assets/js/b2s/wp/post-box.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1579 |
-
wp_register_script('B2SPOSTSCHEDHEARTBEATJS', plugins_url('assets/js/b2s/wp/post-sched-heartbeat.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1580 |
-
wp_register_script('B2SCALENDARJS', plugins_url('assets/js/b2s/calendar.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1581 |
-
wp_register_script('B2SFULLCALENDARMOMENTJS', plugins_url('assets/lib/fullcalendar/lib/moment.min.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1582 |
-
wp_register_script('B2SFULLCALENDARJS', plugins_url('assets/lib/fullcalendar/fullcalendar.min.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1583 |
-
wp_register_script('B2SFULLCALENDARLOCALEJS', plugins_url('assets/lib/fullcalendar/locale-all.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1584 |
-
wp_register_script('B2SBTNTOOGLEJS', plugins_url('assets/lib/btn-toogle/bootstrap-toggle.min.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1585 |
-
wp_register_script('B2SCHOSENJS', plugins_url('assets/lib/chosen/chosen.jquery.min.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1586 |
-
wp_register_script('B2SLIB', plugins_url('assets/js/b2s/lib.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1587 |
-
wp_register_script('B2SPLUGINDEACTIVATEJS', plugins_url('assets/js/b2s/wp/plugin-deactivate.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1588 |
-
wp_register_script('B2SCURATIONDRAFTJS', plugins_url('assets/js/b2s/curation.draft.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1589 |
-
wp_register_script('B2SPREMIUMJS', plugins_url('assets/js/b2s/premium.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1590 |
-
wp_register_script('B2SEMOJIBUTTONJS', plugins_url('assets/lib/emoji-button/emoji-button.min.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1591 |
-
}
|
1592 |
-
|
1593 |
-
public function initCaps() {
|
1594 |
-
global $wp_roles;
|
1595 |
-
if (!class_exists('WP_Roles')) {
|
1596 |
-
wp_die(esc_html__('Blog2Social needs Wordpress Version 4.7.0 or higher.', 'blog2social') . ' ' . sprintf(__('<a href="%s" target="_blank">Please find more Information and help in our FAQ</a>', 'blog2social'), esc_url(B2S_Tools::getSupportLink('system'))) . ' ' . esc_html__('or', 'blog2social') . ' <a href="' . esc_url(admin_url("/plugins.php", "http")) . '/">' . esc_html__('back to install plugins', 'blog2social') . '</a>');
|
1597 |
-
}
|
1598 |
-
if (!isset($wp_roles)) {
|
1599 |
-
$wp_roles = new WP_Roles(); // @codingStandardsIgnoreLine
|
1600 |
-
}
|
1601 |
-
if (!function_exists('get_editable_roles')) {
|
1602 |
-
require_once ABSPATH . 'wp-admin/includes/user.php';
|
1603 |
-
}
|
1604 |
-
foreach (get_editable_roles() as $role_name => $role_info) {
|
1605 |
-
$wp_roles->add_cap($role_name, 'blog2social_access');
|
1606 |
-
}
|
1607 |
-
}
|
1608 |
-
|
1609 |
-
public function activatePlugin() {
|
1610 |
-
require_once(B2S_PLUGIN_DIR . 'includes/Tools.php');
|
1611 |
-
require_once (B2S_PLUGIN_DIR . 'includes/System.php');
|
1612 |
-
require_once(B2S_PLUGIN_DIR . 'includes/Options.php');
|
1613 |
-
$b2sSystem = new B2S_System();
|
1614 |
-
$b2sCheckBefore = $b2sSystem->check('before');
|
1615 |
-
if (is_array($b2sCheckBefore)) {
|
1616 |
-
$b2sSystem->deactivatePlugin();
|
1617 |
-
wp_die($b2sSystem->getErrorMessage($b2sCheckBefore) . ' ' . esc_html__('or', 'blog2social') . ' <a href="' . esc_url(admin_url("/plugins.php", "http")) . '/">' . esc_html__('back to install plugins', 'blog2social') . '</a>');
|
1618 |
-
}
|
1619 |
-
|
1620 |
-
global $wpdb;
|
1621 |
-
$mySqlPermission = true;
|
1622 |
-
/*
|
1623 |
-
* Change Table Names with Prefix
|
1624 |
-
*/
|
1625 |
-
if ($wpdb->base_prefix != 'b2s_' && $wpdb->prefix != 'b2s_') {
|
1626 |
-
$oldTables = $wpdb->get_results('SHOW TABLES LIKE "b2s_%%"');
|
1627 |
-
foreach ($oldTables as $v => $table) {
|
1628 |
-
$tableVars = array_values(get_object_vars($table));
|
1629 |
-
if (isset($tableVars[0]) && !empty($tableVars[0])) {
|
1630 |
-
$wpdb->query("ALTER TABLE `{$tableVars[0]}` RENAME `{$wpdb->base_prefix}{$tableVars[0]}`;");
|
1631 |
-
}
|
1632 |
-
}
|
1633 |
-
}
|
1634 |
-
|
1635 |
-
$sqlCreateUser = "CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}b2s_user` (
|
1636 |
-
`id` int(11) NOT NULL AUTO_INCREMENT,
|
1637 |
-
`token` varchar(255) NOT NULL,
|
1638 |
-
`blog_user_id` int(11) NOT NULL,
|
1639 |
-
`feature` TINYINT(2) NOT NULL,
|
1640 |
-
`state_url` TINYINT(2) NOT NULL,
|
1641 |
-
`register_date` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
|
1642 |
-
PRIMARY KEY (`id`), INDEX `blog_user_id` (`blog_user_id`), INDEX `token` (`token`), INDEX `feature` (`feature`)
|
1643 |
-
) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci AUTO_INCREMENT=1;";
|
1644 |
-
$wpdb->query($sqlCreateUser);
|
1645 |
-
|
1646 |
-
$b2sUserCols = $wpdb->get_results('SHOW COLUMNS FROM ' . $wpdb->prefix . 'b2s_user');
|
1647 |
-
if (is_array($b2sUserCols) && isset($b2sUserCols[0])) {
|
1648 |
-
$b2sUserColsData = array();
|
1649 |
-
foreach ($b2sUserCols as $key => $value) {
|
1650 |
-
if (isset($value->Field) && !empty($value->Field)) {
|
1651 |
-
$b2sUserColsData[] = $value->Field;
|
1652 |
-
}
|
1653 |
-
}
|
1654 |
-
if (!in_array("register_date", $b2sUserColsData)) {
|
1655 |
-
$wpdb->query("ALTER TABLE {$wpdb->prefix}b2s_user ADD register_date DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00'");
|
1656 |
-
}
|
1657 |
-
if (!in_array("state_url", $b2sUserColsData)) {
|
1658 |
-
$wpdb->query("ALTER TABLE {$wpdb->prefix}b2s_user ADD state_url TINYINT(2) NOT NULL DEFAULT '1'");
|
1659 |
-
}
|
1660 |
-
}
|
1661 |
-
|
1662 |
-
//Notice Rating - stop rating remember again
|
1663 |
-
//$wpdb->query('UPDATE `b2s_user` SET `feature` = 0');
|
1664 |
-
|
1665 |
-
$keys = $wpdb->get_results('SHOW INDEX FROM `' . $wpdb->prefix . 'b2s_user`');
|
1666 |
-
$allowIndexUser = array('PRIMARY', 'blog_user_id', 'token', 'feature');
|
1667 |
-
foreach ($keys as $k => $value) {
|
1668 |
-
if (!in_array($value->Key_name, $allowIndexUser)) {
|
1669 |
-
$wpdb->query('ALTER TABLE `' . $wpdb->prefix . 'b2s_user` DROP INDEX ' . $value->Key_name);
|
1670 |
-
}
|
1671 |
-
}
|
1672 |
-
|
1673 |
-
$sqlCreateUserPosts = "CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}b2s_posts` (
|
1674 |
-
`id` int(11) NOT NULL AUTO_INCREMENT,
|
1675 |
-
`post_id` int(11) NOT NULL,
|
1676 |
-
`blog_user_id` int(11) NOT NULL,
|
1677 |
-
`last_edit_blog_user_id` int(11) NOT NULL,
|
1678 |
-
`user_timezone` TINYINT NOT NULL DEFAULT '0',
|
1679 |
-
`sched_details_id` INT NOT NULL,
|
1680 |
-
`sched_type` TINYINT NOT NULL DEFAULT '0',
|
1681 |
-
`sched_date` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
|
1682 |
-
`sched_date_utc` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
|
1683 |
-
`publish_date` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
|
1684 |
-
`publish_link` varchar(255) NOT NULL,
|
1685 |
-
`publish_error_code` varchar(100) NOT NULL,
|
1686 |
-
`network_details_id` int(11) NOT NULL,
|
1687 |
-
`post_for_relay` TINYINT NOT NULL DEFAULT '0',
|
1688 |
-
`post_for_approve` TINYINT NOT NULL DEFAULT '0',
|
1689 |
-
`relay_primary_post_id` int(11) NOT NULL DEFAULT '0',
|
1690 |
-
`relay_delay_min` int(11) NOT NULL DEFAULT '0',
|
1691 |
-
`hook_action` TINYINT NOT NULL DEFAULT '0',
|
1692 |
-
`hide` TINYINT NOT NULL DEFAULT '0',
|
1693 |
-
`v2_id` int(11) NOT NULL DEFAULT '0',
|
1694 |
-
`post_format` int(11) DEFAULT NULL,
|
1695 |
-
PRIMARY KEY (`id`), INDEX `post_id` (`post_id`), INDEX `blog_user_id` (`blog_user_id`) , INDEX `sched_details_id` (`sched_details_id`),
|
1696 |
-
INDEX `sched_date` (`sched_date`), INDEX `sched_date_utc` (`sched_date_utc`), INDEX `publish_date` (`publish_date`) , INDEX `relay_primary_post_id` (`relay_primary_post_id`) ,
|
1697 |
-
INDEX `hook_action` (`hook_action`), INDEX `hide` (`hide`)
|
1698 |
-
) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci AUTO_INCREMENT=1 ;";
|
1699 |
-
$wpdb->query($sqlCreateUserPosts);
|
1700 |
-
|
1701 |
-
//since V4.8.0
|
1702 |
-
$b2sPostsCols = $wpdb->get_results('SHOW COLUMNS FROM ' . $wpdb->prefix . 'b2s_posts');
|
1703 |
-
if (is_array($b2sPostsCols) && isset($b2sPostsCols[0])) {
|
1704 |
-
$b2sPostsColsData = array();
|
1705 |
-
foreach ($b2sPostsCols as $key => $value) {
|
1706 |
-
if (isset($value->Field) && !empty($value->Field)) {
|
1707 |
-
$b2sPostsColsData[] = $value->Field;
|
1708 |
-
}
|
1709 |
-
}
|
1710 |
-
if (!in_array("last_edit_blog_user_id", $b2sPostsColsData)) {
|
1711 |
-
$wpdb->query("ALTER TABLE {$wpdb->prefix}b2s_posts ADD last_edit_blog_user_id INT NOT NULL DEFAULT '0'");
|
1712 |
-
}
|
1713 |
-
if (!in_array("post_for_relay", $b2sPostsColsData)) {
|
1714 |
-
$wpdb->query("ALTER TABLE {$wpdb->prefix}b2s_posts ADD post_for_relay TINYINT NOT NULL DEFAULT '0'");
|
1715 |
-
}
|
1716 |
-
if (!in_array("post_for_approve", $b2sPostsColsData)) {
|
1717 |
-
$wpdb->query("ALTER TABLE {$wpdb->prefix}b2s_posts ADD post_for_approve TINYINT NOT NULL DEFAULT '0'");
|
1718 |
-
}
|
1719 |
-
if (!in_array("relay_primary_post_id", $b2sPostsColsData)) {
|
1720 |
-
$wpdb->query("ALTER TABLE {$wpdb->prefix}b2s_posts ADD relay_primary_post_id int(11) NOT NULL DEFAULT '0'");
|
1721 |
-
$wpdb->query('ALTER TABLE `' . $wpdb->prefix . 'b2s_posts` ADD INDEX(`relay_primary_post_id`)');
|
1722 |
-
}
|
1723 |
-
if (!in_array("relay_delay_min", $b2sPostsColsData)) {
|
1724 |
-
$wpdb->query("ALTER TABLE {$wpdb->prefix}b2s_posts ADD relay_delay_min int(11) NOT NULL DEFAULT '0'");
|
1725 |
-
}
|
1726 |
-
if (!in_array("post_format", $b2sPostsColsData)) {
|
1727 |
-
$wpdb->query("ALTER TABLE {$wpdb->prefix}b2s_posts ADD post_format int(11) DEFAULT NULL");
|
1728 |
-
}
|
1729 |
-
}
|
1730 |
-
|
1731 |
-
$keys = $wpdb->get_results('SHOW INDEX FROM `' . $wpdb->prefix . 'b2s_posts`');
|
1732 |
-
$allowIndexPosts = array('PRIMARY', 'post_id', 'blog_user_id', 'sched_details_id', 'sched_date', 'sched_date_utc', 'publish_date', 'relay_primary_post_id', 'hook_action', 'hide');
|
1733 |
-
foreach ($keys as $k => $value) {
|
1734 |
-
if (!in_array($value->Key_name, $allowIndexPosts)) {
|
1735 |
-
$wpdb->query('ALTER TABLE `' . $wpdb->prefix . 'b2s_posts` DROP INDEX ' . $value->Key_name);
|
1736 |
-
}
|
1737 |
-
}
|
1738 |
-
|
1739 |
-
//Change Collation >=V4.0 Emoji
|
1740 |
-
$existsTable = $wpdb->get_results('SHOW TABLES LIKE "' . $wpdb->prefix . 'b2s_posts_sched_details"');
|
1741 |
-
if (is_array($existsTable) && !empty($existsTable)) {
|
1742 |
-
$wpdb->query('ALTER TABLE `' . $wpdb->prefix . 'b2s_posts_sched_details` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;');
|
1743 |
-
$wpdb->query('ALTER TABLE `' . $wpdb->prefix . 'b2s_posts_sched_details` CHANGE sched_data sched_data TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;');
|
1744 |
-
$wpdb->query('REPAIR TABLE `' . $wpdb->prefix . 'b2s_posts_sched_details`');
|
1745 |
-
$wpdb->query('OPTIMIZE TABLE `' . $wpdb->prefix . 'b2s_posts_sched_details`');
|
1746 |
-
} else {
|
1747 |
-
$sqlCreateUserSchedDetails = "CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}b2s_posts_sched_details` (
|
1748 |
-
`id` int(11) NOT NULL AUTO_INCREMENT,
|
1749 |
-
`sched_data` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
|
1750 |
-
`image_url` varchar(255) NOT NULL,
|
1751 |
-
PRIMARY KEY (`id`)
|
1752 |
-
) DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci AUTO_INCREMENT=1 ;";
|
1753 |
-
$wpdb->query($sqlCreateUserSchedDetails);
|
1754 |
-
}
|
1755 |
-
|
1756 |
-
$sqlCreateUserNetworkDetails = "CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}b2s_posts_network_details` (
|
1757 |
-
`id` int(11) NOT NULL AUTO_INCREMENT,
|
1758 |
-
`network_id` TINYINT NOT NULL,
|
1759 |
-
`network_type` TINYINT NOT NULL,
|
1760 |
-
`network_auth_id` int(11) NOT NULL,
|
1761 |
-
`network_display_name` varchar(100) NOT NULL,
|
1762 |
-
`data` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
|
1763 |
-
PRIMARY KEY (`id`)
|
1764 |
-
) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci AUTO_INCREMENT=1 ;";
|
1765 |
-
$wpdb->query($sqlCreateUserNetworkDetails);
|
1766 |
-
|
1767 |
-
//since 6.1.0 add settings
|
1768 |
-
$b2sNetworkDetailsCols = $wpdb->get_results('SHOW COLUMNS FROM ' . $wpdb->prefix . 'b2s_posts_network_details');
|
1769 |
-
if (is_array($b2sNetworkDetailsCols) && isset($b2sNetworkDetailsCols[0])) {
|
1770 |
-
$b2sNetworkDetailsColsData = array();
|
1771 |
-
foreach ($b2sNetworkDetailsCols as $key => $value) {
|
1772 |
-
if (isset($value->Field) && !empty($value->Field)) {
|
1773 |
-
$b2sNetworkDetailsColsData[] = $value->Field;
|
1774 |
-
}
|
1775 |
-
}
|
1776 |
-
if (!in_array("data", $b2sNetworkDetailsColsData)) {
|
1777 |
-
$wpdb->query("ALTER TABLE {$wpdb->prefix}b2s_posts_network_details ADD data text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci");
|
1778 |
-
}
|
1779 |
-
}
|
1780 |
-
|
1781 |
-
$sqlCreateUserContact = "CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}b2s_user_contact`(
|
1782 |
-
`id` int(5) NOT NULL AUTO_INCREMENT ,
|
1783 |
-
`blog_user_id` int(11) NOT NULL ,
|
1784 |
-
`name_mandant` varchar(100) NOT NULL ,
|
1785 |
-
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
1786 |
-
`name_presse` varchar(100) NOT NULL ,
|
1787 |
-
`anrede_presse` enum('0','1','2') NOT NULL DEFAULT '0' COMMENT '0=Frau,1=Herr 2=keine Angabe',
|
1788 |
-
`vorname_presse` varchar(50) NOT NULL ,
|
1789 |
-
`nachname_presse` varchar(50) NOT NULL ,
|
1790 |
-
`strasse_presse` varchar(100) NOT NULL ,
|
1791 |
-
`nummer_presse` varchar(5) NOT NULL DEFAULT '',
|
1792 |
-
`plz_presse` varchar(10) NOT NULL ,
|
1793 |
-
`ort_presse` varchar(75) NOT NULL ,
|
1794 |
-
`land_presse` varchar(3) NOT NULL DEFAULT 'DE',
|
1795 |
-
`email_presse` varchar(75) NOT NULL ,
|
1796 |
-
`telefon_presse` varchar(30) NOT NULL ,
|
1797 |
-
`fax_presse` varchar(30) NOT NULL ,
|
1798 |
-
`url_presse` varchar(150) NOT NULL ,
|
1799 |
-
PRIMARY KEY (`id`) ,
|
1800 |
-
KEY `blog_user_id`(`blog_user_id`)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci AUTO_INCREMENT=1";
|
1801 |
-
$wpdb->query($sqlCreateUserContact);
|
1802 |
-
|
1803 |
-
$sqlCreateNetworkSettings = 'CREATE TABLE IF NOT EXISTS `' . $wpdb->prefix . 'b2s_user_network_settings` (
|
1804 |
-
`id` int(11) NOT NULL AUTO_INCREMENT,
|
1805 |
-
`blog_user_id` int(11) NOT NULL,
|
1806 |
-
`mandant_id` int(11) NOT NULL,
|
1807 |
-
`network_auth_id` int(11) NOT NULL,
|
1808 |
-
PRIMARY KEY (`id`),
|
1809 |
-
INDEX `blog_user_id` (`blog_user_id`), INDEX `mandant_id` (`mandant_id`)
|
1810 |
-
) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci AUTO_INCREMENT=1;';
|
1811 |
-
$wpdb->query($sqlCreateNetworkSettings);
|
1812 |
-
|
1813 |
-
$sqlCreateDrafts = "CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}b2s_posts_drafts` (
|
1814 |
-
`id` int(11) NOT NULL AUTO_INCREMENT,
|
1815 |
-
`last_save_date` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
|
1816 |
-
`blog_user_id` int(11) NOT NULL,
|
1817 |
-
`post_id` int(11) NOT NULL,
|
1818 |
-
`save_origin` tinyint(4) NOT NULL DEFAULT 0,
|
1819 |
-
`data` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
|
1820 |
-
PRIMARY KEY (`id`),
|
1821 |
-
INDEX `blog_user_id` (`blog_user_id`), INDEX `post_id` (`post_id`)
|
1822 |
-
) DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci AUTO_INCREMENT=1;";
|
1823 |
-
$wpdb->query($sqlCreateDrafts);
|
1824 |
-
|
1825 |
-
//since V6.1.0
|
1826 |
-
$b2sPostsDraftsCols = $wpdb->get_results('SHOW COLUMNS FROM ' . $wpdb->prefix . 'b2s_posts_drafts');
|
1827 |
-
if (is_array($b2sPostsDraftsCols) && isset($b2sPostsDraftsCols[0])) {
|
1828 |
-
$b2sPostsDraftsColsData = array();
|
1829 |
-
foreach ($b2sPostsDraftsCols as $key => $value) {
|
1830 |
-
if (isset($value->Field) && !empty($value->Field)) {
|
1831 |
-
$b2sPostsDraftsColsData[] = $value->Field;
|
1832 |
-
}
|
1833 |
-
}
|
1834 |
-
if (!in_array("save_origin", $b2sPostsDraftsColsData)) {
|
1835 |
-
$wpdb->query("ALTER TABLE {$wpdb->prefix}b2s_posts_drafts ADD save_origin TINYINT NOT NULL DEFAULT '0'");
|
1836 |
-
}
|
1837 |
-
}
|
1838 |
-
|
1839 |
-
$sqlCreateFavorites = "CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}b2s_posts_favorites` (
|
1840 |
-
`id` int(11) NOT NULL AUTO_INCREMENT,
|
1841 |
-
`blog_user_id` int(11) NOT NULL,
|
1842 |
-
`post_id` int(11) NOT NULL,
|
1843 |
-
`save_date` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
|
1844 |
-
PRIMARY KEY (`id`),
|
1845 |
-
INDEX `blog_user_id` (`blog_user_id`), INDEX `post_id` (`post_id`)
|
1846 |
-
) DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci AUTO_INCREMENT=1;";
|
1847 |
-
|
1848 |
-
if (!$wpdb->query($sqlCreateFavorites)) {
|
1849 |
-
$mySqlPermission = false;
|
1850 |
-
}
|
1851 |
-
|
1852 |
-
/*
|
1853 |
-
* SET SAFETY AUTO-INCREMENT
|
1854 |
-
*/
|
1855 |
-
|
1856 |
-
$wpdb->query("ALTER TABLE `{$wpdb->prefix}b2s_posts` CHANGE `id` `id` INT(11) NOT NULL AUTO_INCREMENT;");
|
1857 |
-
$wpdb->query("ALTER TABLE `{$wpdb->prefix}b2s_posts_sched_details` CHANGE `id` `id` INT(11) NOT NULL AUTO_INCREMENT;");
|
1858 |
-
$wpdb->query("ALTER TABLE `{$wpdb->prefix}b2s_posts_network_details` CHANGE `id` `id` INT(11) NOT NULL AUTO_INCREMENT;");
|
1859 |
-
$wpdb->query("ALTER TABLE `{$wpdb->prefix}b2s_user` CHANGE `id` `id` INT(11) NOT NULL AUTO_INCREMENT;");
|
1860 |
-
$wpdb->query("ALTER TABLE `{$wpdb->prefix}b2s_user_contact` CHANGE `id` `id` INT(11) NOT NULL AUTO_INCREMENT;");
|
1861 |
-
$wpdb->query("ALTER TABLE `{$wpdb->prefix}b2s_user_network_settings` CHANGE `id` `id` INT(11) NOT NULL AUTO_INCREMENT;");
|
1862 |
-
$wpdb->query("ALTER TABLE `{$wpdb->prefix}b2s_posts_drafts` CHANGE `id` `id` INT(11) NOT NULL AUTO_INCREMENT;");
|
1863 |
-
if (!$wpdb->query("ALTER TABLE `{$wpdb->prefix}b2s_posts_favorites` CHANGE `id` `id` INT(11) NOT NULL AUTO_INCREMENT;")) {
|
1864 |
-
$mySqlPermission = false;
|
1865 |
-
}
|
1866 |
-
|
1867 |
-
if (!$mySqlPermission) {
|
1868 |
-
$b2sSystem->deactivatePlugin();
|
1869 |
-
wp_die($b2sSystem->getErrorMessage(array('dbTable' => false)) . ' ' . esc_html__('or', 'blog2social') . ' <a href="' . esc_url(admin_url("/plugins.php", "http")) . '/">' . esc_html__('back to install plugins', 'blog2social') . '</a>');
|
1870 |
-
}
|
1871 |
-
|
1872 |
-
//Activate Social Meta Tags
|
1873 |
-
$options = new B2S_Options(0, 'B2S_PLUGIN_GENERAL_OPTIONS');
|
1874 |
-
if ($options->_getOption('og_active') === false || $options->_getOption('card_active') === false) {
|
1875 |
-
$options->_setOption('og_active', 1);
|
1876 |
-
$options->_setOption('card_active', 1);
|
1877 |
-
}
|
1878 |
-
//init roles & capabilities
|
1879 |
-
$this->initCaps();
|
1880 |
-
}
|
1881 |
-
|
1882 |
-
public function deactivatePlugin($allBlogs) {
|
1883 |
-
global $wpdb;
|
1884 |
-
$optionDeleteSchedPosts = get_option('B2S_PLUGIN_DEACTIVATE_SCHED_POST');
|
1885 |
-
if ($allBlogs && is_multisite()) {
|
1886 |
-
$sql = "SELECT blog_id FROM {$wpdb->base_prefix}blogs";
|
1887 |
-
$blogIds = $wpdb->get_results($sql, ARRAY_A);
|
1888 |
-
if (is_array($blogIds) && !empty($blogIds)) {
|
1889 |
-
foreach ($blogIds as $blogId) {
|
1890 |
-
switch_to_blog($blogId['blog_id']);
|
1891 |
-
if ($optionDeleteSchedPosts !== false && (int) $optionDeleteSchedPosts == 1) {
|
1892 |
-
update_option("B2S_PLUGIN_DEACTIVATE_SCHED_POST", 1, false);
|
1893 |
-
} else {
|
1894 |
-
delete_option("B2S_PLUGIN_DEACTIVATE_SCHED_POST");
|
1895 |
-
}
|
1896 |
-
deactivate_plugins(B2S_PLUGIN_HOOK, false, false);
|
1897 |
-
restore_current_blog();
|
1898 |
-
}
|
1899 |
-
return true;
|
1900 |
-
}
|
1901 |
-
}
|
1902 |
-
if ($optionDeleteSchedPosts !== false && (int) $optionDeleteSchedPosts == 1) {
|
1903 |
-
$existsTable = $wpdb->get_results('SHOW TABLES LIKE "' . $wpdb->prefix . 'b2s_user"');
|
1904 |
-
if (is_array($existsTable) && !empty($existsTable)) {
|
1905 |
-
$sqlPosts = "SELECT a.token FROM `{$wpdb->prefix}b2s_user` a INNER JOIN {$wpdb->prefix}b2s_posts ON a.`blog_user_id` = {$wpdb->prefix}b2s_posts.`blog_user_id` where {$wpdb->prefix}b2s_posts.`hide` = 0 AND {$wpdb->prefix}b2s_posts.`sched_type` != 3 AND {$wpdb->prefix}b2s_posts.`publish_date`= '0000-00-00 00:00:00' GROUP by a.blog_user_id";
|
1906 |
-
$results = $wpdb->get_results($sqlPosts, ARRAY_A);
|
1907 |
-
if (is_array($results) && !empty($results)) {
|
1908 |
-
$tempData = array('action' => 'deleteBlogSchedPost', 'host' => get_site_url(), 'data' => serialize($results));
|
1909 |
-
$result = json_decode(B2S_Api_Post::post(B2S_PLUGIN_API_ENDPOINT, $tempData));
|
1910 |
-
if (isset($result->result) && $result->result == true) {
|
1911 |
-
$data = array('hide' => '1', 'hook_action' => '0');
|
1912 |
-
$where = array('publish_date' => '0000-00-00 00:00:00', 'hide' => '0');
|
1913 |
-
$wpdb->update($wpdb->prefix . 'b2s_posts', $data, $where, array('%d', '%d'), array('%d', '%d'));
|
1914 |
-
delete_option('B2S_PLUGIN_DEACTIVATE_SCHED_POST');
|
1915 |
-
}
|
1916 |
-
}
|
1917 |
-
}
|
1918 |
-
}
|
1919 |
-
}
|
1920 |
-
|
1921 |
-
public function releaseLocks() {
|
1922 |
-
require_once(B2S_PLUGIN_DIR . 'includes/Options.php');
|
1923 |
-
$options = new B2S_Options(get_current_user_id());
|
1924 |
-
$lock = $options->_getOption("B2S_PLUGIN_USER_CALENDAR_BLOCKED");
|
1925 |
-
|
1926 |
-
if ($lock) {
|
1927 |
-
delete_option("B2S_PLUGIN_CALENDAR_BLOCKED_" . $lock);
|
1928 |
-
$options->_setOption("B2S_PLUGIN_USER_CALENDAR_BLOCKED", false);
|
1929 |
-
}
|
1930 |
-
}
|
1931 |
-
|
1932 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class B2S_Loader {
|
4 |
+
|
5 |
+
public $blogUserData;
|
6 |
+
public $lastVersion;
|
7 |
+
|
8 |
+
public function __construct() {
|
9 |
+
|
10 |
+
}
|
11 |
+
|
12 |
+
public function load() {
|
13 |
+
if (!is_admin()) {
|
14 |
+
$this->call_public_hooks();
|
15 |
+
}
|
16 |
+
$this->call_global_hooks();
|
17 |
+
if (is_admin()) {
|
18 |
+
$this->call_admin_hooks();
|
19 |
+
}
|
20 |
+
}
|
21 |
+
|
22 |
+
public function call_global_hooks() {
|
23 |
+
|
24 |
+
$this->b2s_register_custom_post_type();
|
25 |
+
|
26 |
+
require_once(B2S_PLUGIN_DIR . 'includes/Options.php');
|
27 |
+
require_once(B2S_PLUGIN_DIR . 'includes/B2S/AutoPost.php');
|
28 |
+
require_once(B2S_PLUGIN_DIR . 'includes/B2S/Rating.php');
|
29 |
+
require_once(B2S_PLUGIN_DIR . 'includes/B2S/Heartbeat.php');
|
30 |
+
require_once(B2S_PLUGIN_DIR . 'includes/B2S/Api/Post.php');
|
31 |
+
require_once(B2S_PLUGIN_DIR . 'includes/B2S/Api/Get.php');
|
32 |
+
require_once(B2S_PLUGIN_DIR . 'includes/Util.php');
|
33 |
+
require_once(B2S_PLUGIN_DIR . 'includes/Tools.php');
|
34 |
+
require_once(B2S_PLUGIN_DIR . 'includes/B2S/Hook/Filter.php');
|
35 |
+
|
36 |
+
define('B2S_PLUGIN_POSTPERPAGE', '15');
|
37 |
+
define('B2S_PLUGIN_VERSION_TYPE', serialize(array(0 => 'Free', 1 => 'Smart', 2 => 'Pro', 3 => 'Business', 4 => 'Premium')));
|
38 |
+
define('B2S_PLUGIN_NETWORK', serialize(array(1 => 'Facebook', 2 => 'Twitter', 3 => 'Linkedin', 4 => 'Tumblr', 5 => 'Storify', 6 => 'Pinterest', 7 => 'Flickr', 8 => 'Xing', 9 => 'Diigo', 10 => 'Google+', 11 => 'Medium', 12 => 'Instagram', 13 => 'Delicious', 14 => 'Torial', 15 => 'Reddit', 16 => 'Bloglovin', 17 => 'VKontakte', 18 => 'Google My Business', 19 => 'Xing', 20 => 'Pinterest', 21 => 'Imgur', 24 => 'Telegram', 25 => 'Blogger', 26 => 'Ravelry', 27 => 'Instapaper')));
|
39 |
+
define('B2S_PLUGIN_SCHED_DEFAULT_TIMES', serialize(array(1 => array(18, 22), 2 => array(8, 10), 3 => array(7, 10), 4 => array(20, 22), 5 => array(), 6 => array(19, 22), 7 => array(7, 9), 8 => array(7, 10), 9 => array(16, 19), 10 => array(7, 10), 11 => array(8, 10), 12 => array(19, 22), 13 => array(11, 13), 14 => array(6, 8), 15 => array(6, 9), 16 => array(16, 19), 17 => array(21, 24), 18 => array(19, 21), 19 => array(7, 10), 24 => array(10, 12))));
|
40 |
+
define('B2S_PLUGIN_SCHED_DEFAULT_TIMES_INFO', serialize(array(1 => array(0 => array(13, 16), 1 => array(18, 22)), 2 => array(0 => array(7, 10), 1 => array(11, 13), 2 => array(16, 19)), 3 => array(0 => array(7, 10), 1 => array(17, 18)), 4 => array(0 => array(20, 22)), 5 => array(), 6 => array(0 => array(12, 14), 1 => array(19, 22)), 7 => array(0 => array(7, 9), 1 => array(17, 19)), 8 => array(0 => array(7, 10), 1 => array(17, 18)), 9 => array(0 => array(8, 10), 1 => array(11, 13), 2 => array(16, 19)), 10 => array(0 => array(7, 10), 1 => array(14, 15)), 11 => array(0 => array(8, 10)), 12 => array(0 => array(11, 13), 1 => array(19, 22)), 13 => array(0 => array(8, 10), 1 => array(11, 13), 2 => array(16, 19)), 14 => array(0 => array(6, 8)), 15 => array(0 => array(6, 9)), 16 => array(0 => array(16, 19)), 17 => array(0 => array(21, 1)), 18 => array(0 => array(9, 11), 1 => array(19, 21)), 19 => array(0 => array(7, 10), 1 => array(17, 18)), 20 => array(0 => array(12, 14), 1 => array(19, 22)), 24 => array(0 => array(10, 12), 1 => array(17, 19)))));
|
41 |
+
define('B2S_PLUGIN_NETWORK_ALLOW_PROFILE', serialize(array(1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 20, 21, 24, 25, 26, 27)));
|
42 |
+
define('B2S_PLUGIN_NETWORK_ALLOW_PAGE', serialize(array(1, 3, 10, 12, 17, 19)));
|
43 |
+
define('B2S_PLUGIN_NETWORK_ALLOW_GROUP', serialize(array(1, 10, 11, 17, 19)));
|
44 |
+
define('B2S_PLUGIN_NETWORK_CROSSPOSTING_LIMIT', serialize(array(19 => array(2 => 3)))); //2=group
|
45 |
+
define('B2S_PLUGIN_NETWORK_ALLOW_MODIFY_BOARD_AND_GROUP', serialize(array(6 => array('TYPE' => array(0), 'TITLE' => esc_html__('Modify pin board', 'blog2social')), 8 => array('TYPE' => array(2), 'TITLE' => esc_html__('Edit group settings', 'blog2social')), 15 => array('TYPE' => array(0), 'TITLE' => esc_html__('Modify subreddit', 'blog2social')), 19 => array('TYPE' => array(2), 'TITLE' => esc_html__('Modify forum', 'blog2social')), 20 => array('TYPE' => array(0), 'TITLE' => esc_html__('Modify pin board', 'blog2social')))));
|
46 |
+
define('B2S_PLUGIN_AUTO_POST_LIMIT', serialize(array(0 => 0, 1 => 25, 2 => 50, 3 => 100, 4 => 100)));
|
47 |
+
define('B2S_PLUGIN_RE_POST_LIMIT', serialize(array(0 => 0, 1 => 25, 2 => 50, 3 => 100, 4 => 100)));
|
48 |
+
define('B2S_PLUGIN_NETWORK_OAUTH', serialize(array(1, 2, 3, 4, 7, 8, 11, 15, 17, 18, 20, 21, 25)));
|
49 |
+
define('B2S_PLUGIN_NETWORK_SETTINGS_TEMPLATE_DEFAULT', serialize(array(
|
50 |
+
1 => array(0 => array('short_text' => array('active' => 0, 'range_min' => 200, 'range_max' => 400, 'excerpt_range_min' => 200, 'excerpt_range_max' => 400, 'limit' => 500), 'content' => "{CONTENT}\n{KEYWORDS}", 'format' => 0, 'addLink' => false),
|
51 |
+
1 => array('short_text' => array('active' => 0, 'range_min' => 200, 'range_max' => 400, 'excerpt_range_min' => 200, 'excerpt_range_max' => 400, 'limit' => 0), 'content' => "{CONTENT}\n{KEYWORDS}", 'format' => 0, 'addLink' => false),
|
52 |
+
2 => array('short_text' => array('active' => 0, 'range_min' => 200, 'range_max' => 400, 'excerpt_range_min' => 200, 'excerpt_range_max' => 400, 'limit' => 0), 'content' => "{CONTENT}\n{KEYWORDS}", 'format' => 0, 'addLink' => false)
|
53 |
+
),
|
54 |
+
2 => array(0 => array('short_text' => array('active' => 0, 'range_min' => 200, 'range_max' => 254, 'excerpt_range_min' => 200, 'excerpt_range_max' => 254, 'limit' => 280), 'content' => '{CONTENT} {KEYWORDS}', 'format' => 1, 'addLink' => true)),
|
55 |
+
3 => array(0 => array('short_text' => array('active' => 0, 'range_min' => 200, 'range_max' => 400, 'excerpt_range_min' => 200, 'excerpt_range_max' => 400, 'limit' => 3000), 'content' => "{CONTENT}\n{KEYWORDS}", 'format' => 0),
|
56 |
+
1 => array('short_text' => array('active' => 0, 'range_min' => 200, 'range_max' => 400, 'excerpt_range_min' => 200, 'excerpt_range_max' => 400, 'limit' => 3000), 'content' => "{CONTENT}\n{KEYWORDS}", 'format' => 0),
|
57 |
+
),
|
58 |
+
4 => array(0 => array('short_text' => array('active' => 0, 'range_min' => 1000, 'range_max' => 20000, 'excerpt_range_min' => 1000, 'excerpt_range_max' => 20000, 'limit' => 0), 'content' => '{CONTENT}', 'format' => false, 'disableKeywords' => true)),
|
59 |
+
6 => array(0 => array('short_text' => array('active' => 0, 'range_min' => 350, 'range_max' => 421, 'excerpt_range_min' => 350, 'excerpt_range_max' => 421, 'limit' => 495), 'content' => "{CONTENT}\n{KEYWORDS}", 'format' => false)),
|
60 |
+
7 => array(0 => array('short_text' => array('active' => 0, 'range_min' => 1000, 'range_max' => 1500, 'excerpt_range_min' => 1000, 'excerpt_range_max' => 1500, 'limit' => 0), 'content' => '{CONTENT}', 'format' => false, 'disableKeywords' => true)),
|
61 |
+
9 => array(0 => array('short_text' => array('active' => 0, 'range_min' => 200, 'range_max' => 250, 'excerpt_range_min' => 200, 'excerpt_range_max' => 250, 'limit' => 250), 'content' => '{CONTENT}', 'format' => false, 'disableKeywords' => true)),
|
62 |
+
11 => array(0 => array('short_text' => array('active' => 0, 'range_min' => 1000, 'range_max' => 20000, 'excerpt_range_min' => 1000, 'excerpt_range_max' => 20000, 'limit' => 0), 'content' => '{CONTENT}', 'format' => false, 'separateKeywords' => true),
|
63 |
+
2 => array('short_text' => array('active' => 0, 'range_min' => 1000, 'range_max' => 20000, 'excerpt_range_min' => 1000, 'excerpt_range_max' => 20000, 'limit' => 0), 'content' => '{CONTENT}', 'format' => false, 'separateKeywords' => true)),
|
64 |
+
12 => array(1 => array('short_text' => array('active' => 0, 'range_min' => 200, 'range_max' => 400, 'excerpt_range_min' => 240, 'excerpt_range_max' => 400, 'limit' => 2000), 'content' => "{CONTENT}\n{KEYWORDS}", 'format' => 1, 'addLink' => false, 'shuffleHashtags' => false)),
|
65 |
+
14 => array(0 => array('short_text' => array('active' => 0, 'range_min' => 1000, 'range_max' => 20000, 'excerpt_range_min' => 1000, 'excerpt_range_max' => 20000, 'limit' => 0), 'content' => '{CONTENT}', 'format' => false, 'disableKeywords' => true)),
|
66 |
+
15 => array(0 => array('short_text' => array('active' => 0, 'range_min' => 200, 'range_max' => 300, 'excerpt_range_min' => 200, 'excerpt_range_max' => 300, 'limit' => 0), 'content' => '{CONTENT}', 'format' => false, 'disableKeywords' => true)),
|
67 |
+
16 => array(0 => array('short_text' => array('active' => 0, 'range_min' => 1000, 'range_max' => 1500, 'excerpt_range_min' => 1000, 'excerpt_range_max' => 1500, 'limit' => 0), 'content' => '{CONTENT}', 'format' => false, 'disableKeywords' => true)),
|
68 |
+
17 => array(0 => array('short_text' => array('active' => 0, 'range_min' => 1000, 'range_max' => 1500, 'excerpt_range_min' => 1000, 'excerpt_range_max' => 1500, 'limit' => 0), 'content' => "{CONTENT}\n{KEYWORDS}", 'format' => 0),
|
69 |
+
1 => array('short_text' => array('active' => 0, 'range_min' => 1000, 'range_max' => 1500, 'excerpt_range_min' => 1000, 'excerpt_range_max' => 1500, 'limit' => 0), 'content' => "{CONTENT}\n{KEYWORDS}", 'format' => 0),
|
70 |
+
2 => array('short_text' => array('active' => 0, 'range_min' => 1000, 'range_max' => 1500, 'excerpt_range_min' => 1000, 'excerpt_range_max' => 1500, 'limit' => 0), 'content' => "{CONTENT}\n{KEYWORDS}", 'format' => 0)),
|
71 |
+
18 => array(0 => array('short_text' => array('active' => 0, 'range_min' => 1000, 'range_max' => 1500, 'excerpt_range_min' => 1000, 'excerpt_range_max' => 1500, 'limit' => 1500), 'content' => "{CONTENT}\n{KEYWORDS}", 'format' => false)),
|
72 |
+
19 => array(0 => array('short_text' => array('active' => 0, 'range_min' => 200, 'range_max' => 320, 'excerpt_range_min' => 200, 'excerpt_range_max' => 320, 'limit' => 0), 'content' => '{CONTENT}', 'format' => 0, 'disableKeywords' => true),
|
73 |
+
1 => array('short_text' => array(0 => array('active' => 0, 'range_min' => 200, 'range_max' => 320, 'excerpt_range_min' => 200, 'excerpt_range_max' => 320, 'limit' => 1000), 4 => array('active' => 0, 'range_min' => 880, 'range_max' => 920, 'excerpt_range_min' => 880, 'excerpt_range_max' => 920, 'limit' => 1000)), 'content' => '{CONTENT}', 'format' => 1, 'disableKeywords' => true),
|
74 |
+
2 => array('short_text' => array('active' => 0, 'range_min' => 200, 'range_max' => 320, 'excerpt_range_min' => 200, 'excerpt_range_max' => 320, 'limit' => 10000), 'content' => '{CONTENT}', 'format' => 1, 'disableKeywords' => true)),
|
75 |
+
24 => array(0 => array('short_text' => array('active' => 0, 'range_min' => 200, 'range_max' => 320, 'excerpt_range_min' => 200, 'excerpt_range_max' => 320, 'limit' => 420), 'content' => '{CONTENT}', 'format' => 0, 'addLink' => true)),
|
76 |
+
25 => array(0 => array('short_text' => array('active' => 0, 'range_min' => 1000, 'range_max' => 20000, 'excerpt_range_min' => 1000, 'excerpt_range_max' => 20000, 'limit' => 0), 'content' => '{CONTENT}', 'format' => false)),
|
77 |
+
26 => array(0 => array('short_text' => array('active' => 0, 'range_min' => 1000, 'range_max' => 20000, 'excerpt_range_min' => 1000, 'excerpt_range_max' => 20000, 'limit' => 0), 'content' => '{CONTENT}', 'format' => false)),
|
78 |
+
27 => array(0 => array('short_text' => array('active' => 0, 'range_min' => 1000, 'range_max' => 20000, 'excerpt_range_min' => 1000, 'excerpt_range_max' => 20000, 'limit' => 0), 'content' => '{CONTENT}', 'format' => false))
|
79 |
+
)));
|
80 |
+
define('B2S_PLUGIN_SYSTEMREQUIREMENT_WORDPRESSVERSION', '4.7.0');
|
81 |
+
define('B2S_PLUGIN_SYSTEMREQUIREMENT_PHPVERSION', '5.5.3');
|
82 |
+
define('B2S_PLUGIN_SYSTEMREQUIREMENT_MYSQLVERSION', '5.5.3');
|
83 |
+
define('B2S_PLUGIN_SYSTEMREQUIREMENT_DATABASERIGHTS', true);
|
84 |
+
define('B2S_PLUGIN_SYSTEMREQUIREMENT_HEARTBEAT', true);
|
85 |
+
define('B2S_PLUGIN_SYSTEMREQUIREMENT_PHPCURL', true);
|
86 |
+
define('B2S_PLUGIN_SYSTEMREQUIREMENT_PHPMBSTRING', true);
|
87 |
+
define('B2S_PLUGIN_SYSTEMREQUIREMENT_PHPDOM', true);
|
88 |
+
define('B2S_PLUGIN_SYSTEMREQUIREMENT_HOTLINKPROTECTION', true);
|
89 |
+
define('B2S_PLUGIN_SYSTEMREQUIREMENT_PLUGINWARNING_WORDS', serialize(array('hotlink', 'firewall', 'security', 'heartbeat', 'disable')));
|
90 |
+
define('B2S_PLUGIN_SYSTEMREQUIREMENT_WPJSON', true);
|
91 |
+
define('B2S_PLUGIN_SYSTEMREQUIREMENT_OPENSSL', true);
|
92 |
+
define('B2S_PLUGIN_PAGE_SLUG', serialize(array('blog2social', 'blog2social-post', 'blog2social-calendar', 'blog2social-curation', 'blog2social-network', 'blog2social-settings', 'prg-post', 'blog2social-support', 'blog2social-premium', 'blog2social-sched', 'blog2social-approve', 'blog2social-publish', 'blog2social-notice', 'blog2social-ship', 'blog2social-curation-draft', 'blog2social-draft-post', 'prg-login', 'prg-ship')));
|
93 |
+
define('B2S_PLUGIN_NETWORK_NOT_ALLOW_GIF', json_encode(array(16, 18, 26)));
|
94 |
+
define('B2S_PLUGIN_NETWORK_ANIMATE_GIF', json_encode(array(1 => array(0 => false, 1 => true), 2 => array(0 => false, 1 => true), 3 => array(0 => true, 1 => true), 4 => array(0 => true), 6 => array(0 => true), 7 => array(0 => false), 11 => array(0 => true), 12 => array(0 => false, 1 => false), 14 => array(0 => true), 15 => array(0 => false), 17 => array(0 => false), 19 => array(0 => true, 1 => true), 21 => array(0 => true), 24 => array(0 => true))));
|
95 |
+
define('B2S_PLUGIN_NETWORK_META_TAGS', json_encode(array('og' => array(1, 3, 15, 19, 17), 'twitter' => array(2, 24))));
|
96 |
+
define('B2S_PLUGIN_SHORTENER', serialize(array(0 => esc_html__('Bitly', 'blog2social'), 1 => esc_html__('Rebrandly', 'blog2social'), 2 => esc_html__('Sniply', 'blog2social'))));
|
97 |
+
|
98 |
+
add_filter('heartbeat_received', array(B2S_Heartbeat::getInstance(), 'init'), 10, 2);
|
99 |
+
add_action('wp_logout', array($this, 'releaseLocks'));
|
100 |
+
add_action('transition_post_status', array($this, 'b2s_auto_post_import'), 9999, 3); //for Auto-Posting imported + manuell
|
101 |
+
//add_action('rest_api_inserted_post', array($this, 'b2s_auto_post_import_rest_api_jetpack'), 9999, 3); //call via transition_post_status hook
|
102 |
+
//add_action('rest_api_init', array($this, 'b2s_rest_api_init'));
|
103 |
+
}
|
104 |
+
|
105 |
+
public function call_admin_hooks() {
|
106 |
+
|
107 |
+
require_once(B2S_PLUGIN_DIR . 'includes/Meta.php');
|
108 |
+
require_once(B2S_PLUGIN_DIR . 'includes/B2S/PostBox.php');
|
109 |
+
require_once(B2S_PLUGIN_DIR . 'includes/Notice.php');
|
110 |
+
require_once(B2S_PLUGIN_DIR . 'includes/PRG/Api/Post.php');
|
111 |
+
require_once(B2S_PLUGIN_DIR . 'includes/PRG/Api/Get.php');
|
112 |
+
require_once(B2S_PLUGIN_DIR . 'includes/Ajax/Post.php');
|
113 |
+
require_once(B2S_PLUGIN_DIR . 'includes/Ajax/Get.php');
|
114 |
+
require_once(B2S_PLUGIN_DIR . 'includes/B2S/AutoPost.php');
|
115 |
+
require_once(B2S_PLUGIN_DIR . 'includes/B2S/Rating.php');
|
116 |
+
require_once(B2S_PLUGIN_DIR . 'includes/Util.php');
|
117 |
+
require_once(B2S_PLUGIN_DIR . 'includes/Tools.php');
|
118 |
+
|
119 |
+
define('B2S_PLUGIN_BLOG_USER_ID', get_current_user_id());
|
120 |
+
define('B2S_PLUGIN_ADMIN', current_user_can('edit_others_posts'));
|
121 |
+
|
122 |
+
$this->blogUserData = get_userdata(B2S_PLUGIN_BLOG_USER_ID);
|
123 |
+
|
124 |
+
//deactivated since 4.2.0
|
125 |
+
//add_action('plugins_loaded', array($this, 'update_db_check'));
|
126 |
+
|
127 |
+
$this->update_db_check();
|
128 |
+
|
129 |
+
add_action('admin_init', array($this, 'registerAssets'));
|
130 |
+
add_action('admin_enqueue_scripts', array($this, 'addBootAssets'));
|
131 |
+
add_action('admin_menu', array($this, 'createMenu'));
|
132 |
+
add_action('admin_bar_menu', array($this, 'createToolbarMenu'), 94);
|
133 |
+
add_action('admin_notices', array('B2S_Notice', 'getProVersionNotice'));
|
134 |
+
add_action('wp_loaded', array('B2S_Notice', 'hideProVersionNotice'));
|
135 |
+
add_action('admin_notices', array($this, 'b2s_save_post_alert_meta_box'));
|
136 |
+
add_action('add_meta_boxes', array($this, 'b2s_load_post_box'));
|
137 |
+
add_action('save_post', array($this, 'b2s_save_post_box'), 1, 3);
|
138 |
+
add_action('trash_post', array($this, 'b2s_delete_sched_post'), 10);
|
139 |
+
add_action('wp_trash_post', array($this, 'b2s_delete_sched_post'), 10);
|
140 |
+
|
141 |
+
add_action('admin_footer', array($this, 'plugin_deactivate_add_modal'));
|
142 |
+
add_filter('plugin_action_links_' . B2S_PLUGIN_BASENAME, array($this, 'override_plugin_action_links'));
|
143 |
+
add_filter('network_admin_plugin_action_links_' . B2S_PLUGIN_BASENAME, array($this, 'override_multisite_plugin_action_links'));
|
144 |
+
|
145 |
+
Ajax_Get::getInstance();
|
146 |
+
Ajax_Post::getInstance();
|
147 |
+
|
148 |
+
if ((int) B2S_PLUGIN_BLOG_USER_ID > 0) {
|
149 |
+
$this->getToken();
|
150 |
+
$this->getUserDetails();
|
151 |
+
}
|
152 |
+
$this->plugin_init_language();
|
153 |
+
}
|
154 |
+
|
155 |
+
public function call_public_hooks() {
|
156 |
+
add_filter('wp_footer', array($this, 'b2s_get_full_content'), 99); //for shortcodes
|
157 |
+
add_action('wp_head', array($this, 'b2s_build_frontend_meta'), 1); // for MetaTags
|
158 |
+
}
|
159 |
+
|
160 |
+
public function b2s_build_frontend_meta() {
|
161 |
+
require_once(B2S_PLUGIN_DIR . 'includes/Meta.php');
|
162 |
+
B2S_Meta::getInstance()->_run();
|
163 |
+
}
|
164 |
+
|
165 |
+
/* public function b2s_rest_api_init() {
|
166 |
+
register_rest_route('blog2social/v1/post', '/authorize', array(
|
167 |
+
'methods' => WP_REST_Server::CREATABLE,
|
168 |
+
'callback' => array($this, 'b2s_rest_api_post_authorize')
|
169 |
+
));
|
170 |
+
} */
|
171 |
+
|
172 |
+
/* public function b2s_rest_api_post_authorize($post = array()) {
|
173 |
+
$contentType = 'application/json';
|
174 |
+
if (isset($post['token']) && !empty($post['token']) && isset($post['user']) && !empty($post['user']) && isset($post['network_id']) && (int) $post['network_id'] > 0) {
|
175 |
+
$privateKey = B2S_PLUGIN_DIR . '/includes/B2S/Api/Network/private_key.pem';
|
176 |
+
if (function_exists('openssl_public_decrypt') && file_exists($privateKey)) {
|
177 |
+
if ((int) $post['network_id'] == 6) {
|
178 |
+
try {
|
179 |
+
require_once(B2S_PLUGIN_DIR . 'includes/B2S/Api/Network/Pinterest.php');
|
180 |
+
$user = '';
|
181 |
+
$pass = '';
|
182 |
+
openssl_private_decrypt(base64_decode(trim($post['user']['pass'])), $pass, $getPrivateKey);
|
183 |
+
openssl_private_decrypt(base64_decode(trim($post['user']['name'])), $user, $getPrivateKey);
|
184 |
+
$pt = new B2S_Api_Network_Pinterest();
|
185 |
+
$result = $pt->authorize($user, $pass);
|
186 |
+
$status = isset($result['cookie_data']) && !empty($result['cookie_data']) ? 200 : 400;
|
187 |
+
$response = array('code' => $status, 'result' => array_merge($result, array('token' => $post['token'], 'network_id' => (int) $post['network_id'])));
|
188 |
+
return new WP_REST_Response($response, $status, array('Content-Type: ' . $contentType));
|
189 |
+
} catch (Exception $ex) {
|
190 |
+
$response = array('code' => 500, 'result' => array('token' => $post['token'], 'network_id' => (int) $post['network_id'], 'error' => 1, 'error_pos' => 8, 'error_data' => serialize($ex->getMessage())));
|
191 |
+
return new WP_REST_Response($response, 500, array('Content-Type: ' . $contentType));
|
192 |
+
}
|
193 |
+
}
|
194 |
+
$response = array('code' => 409, 'result' => array('token' => $post['token'], 'network_id' => (int) $post['network_id'], 'error' => 1, 'error_pos' => 9, 'error_data' => 'network_not_exists'));
|
195 |
+
return new WP_REST_Response($response, 409, array('Content-Type: ' . $contentType));
|
196 |
+
}
|
197 |
+
$response = array('code' => 501, 'result' => array('token' => $post['token'], 'network_id' => (int) $post['network_id'], 'error' => 1, 'error_pos' => 9, 'error_data' => 'openssl_not_exists'));
|
198 |
+
return new WP_REST_Response($response, 501, array('Content-Type: ' . $contentType));
|
199 |
+
}
|
200 |
+
$response = array('code' => 502, 'result' => array('error' => 1, 'error_pos' => 10, 'error_data' => 'bad_request'));
|
201 |
+
return new WP_REST_Response($response, 502, array('Content-Type: ' . $contentType));
|
202 |
+
} */
|
203 |
+
|
204 |
+
private function b2s_register_custom_post_type() {
|
205 |
+
if (post_type_exists("b2s_ex_post")) {
|
206 |
+
return;
|
207 |
+
}
|
208 |
+
register_post_type('b2s_ex_post', array('public' => false, 'label' => 'Related Posts for Blog2Social'));
|
209 |
+
}
|
210 |
+
|
211 |
+
public function plugin_deactivate_add_modal() {
|
212 |
+
include_once(B2S_PLUGIN_DIR . '/views/b2s/partials/plugin-deactivate-modal.php');
|
213 |
+
}
|
214 |
+
|
215 |
+
//Insert Posts via wordpress.com (mobile app) & jetpack
|
216 |
+
//https://developer.jetpack.com/hooks/rest_api_inserted_post/
|
217 |
+
//NOTICE: jetpack call transition_post_status hook
|
218 |
+
/* public function b2s_auto_post_import_rest_api_jetpack($post_id, $insert, $new) {
|
219 |
+
if ((int) $post_id > 0 && is_array($insert) && isset($insert['post_status']) && $insert['post_status'] == 'publish') {
|
220 |
+
$post = get_post((int) $post_id);
|
221 |
+
$this->b2s_auto_post_import($insert['post_status'], 'draft', $post);
|
222 |
+
}
|
223 |
+
} */
|
224 |
+
|
225 |
+
public function b2s_auto_post_import($new_status, $old_status, $post) {
|
226 |
+
//is first publish
|
227 |
+
if ($old_status != 'publish' && $old_status != 'trash' && $new_status == 'publish' && isset($post->post_author) && (int) $post->post_author > 0) {
|
228 |
+
if (wp_is_post_revision($post->ID)) {
|
229 |
+
return;
|
230 |
+
}
|
231 |
+
//is lock if manuell Auto-Posting in form
|
232 |
+
$isLock = get_option('B2S_LOCK_AUTO_POST_IMPORT_' . (int) $post->post_author);
|
233 |
+
if ($isLock === false) {
|
234 |
+
$options = new B2S_Options((int) $post->post_author);
|
235 |
+
$autoPostData = $options->_getOption('auto_post_import');
|
236 |
+
if ($autoPostData !== false && is_array($autoPostData)) {
|
237 |
+
if (isset($autoPostData['active']) && (int) $autoPostData['active'] == 1) {
|
238 |
+
//Premium
|
239 |
+
$tokenInfo = get_option('B2S_PLUGIN_USER_VERSION_' . (int) $post->post_author);
|
240 |
+
if ($tokenInfo !== false && isset($tokenInfo['B2S_PLUGIN_USER_VERSION']) && (int) $tokenInfo['B2S_PLUGIN_USER_VERSION'] >= 1) {
|
241 |
+
$filter = true;
|
242 |
+
if (isset($autoPostData['post_filter']) && (int) $autoPostData['post_filter'] == 1) {
|
243 |
+
if (isset($autoPostData['post_type']) && is_array($autoPostData['post_type']) && !empty($autoPostData['post_type'])) {
|
244 |
+
if (isset($autoPostData['post_type_state']) && (int) $autoPostData['post_type_state'] == 0) { //include
|
245 |
+
if (!in_array($post->post_type, $autoPostData['post_type'])) {
|
246 |
+
$filter = false;
|
247 |
+
}
|
248 |
+
} else { //exclude
|
249 |
+
if (in_array($post->post_type, $autoPostData['post_type'])) {
|
250 |
+
$filter = false;
|
251 |
+
}
|
252 |
+
}
|
253 |
+
}
|
254 |
+
if (isset($autoPostData['post_categories']) && is_array($autoPostData['post_categories']) && !empty($autoPostData['post_categories'])) {
|
255 |
+
$postcat = get_the_category($post->ID);
|
256 |
+
if ($postcat != false && is_array($postcat) && !empty($postcat)) {
|
257 |
+
foreach ($postcat as $k => $v) {
|
258 |
+
if (isset($autoPostData['post_categories_state']) && (int) $autoPostData['post_categories_state'] == 0) { //include
|
259 |
+
if (!in_array($v->term_id, $autoPostData['post_categories'])) {
|
260 |
+
$filter = false;
|
261 |
+
}
|
262 |
+
} else { //exclude
|
263 |
+
if (in_array($v->term_id, $autoPostData['post_categories'])) {
|
264 |
+
$filter = false;
|
265 |
+
}
|
266 |
+
}
|
267 |
+
}
|
268 |
+
}
|
269 |
+
}
|
270 |
+
}
|
271 |
+
if ($filter && isset($autoPostData['network_auth_id']) && !empty($autoPostData['network_auth_id']) && is_array($autoPostData['network_auth_id'])) {
|
272 |
+
//LIMIT
|
273 |
+
$limit = false;
|
274 |
+
$ship = false;
|
275 |
+
$count = 0;
|
276 |
+
$optionUserTimeZone = $options->_getOption('user_time_zone');
|
277 |
+
$userTimeZone = ($optionUserTimeZone !== false) ? $optionUserTimeZone : get_option('timezone_string');
|
278 |
+
$userTimeZoneOffset = (empty($userTimeZone)) ? get_option('gmt_offset') : B2S_Util::getOffsetToUtcByTimeZone($userTimeZone);
|
279 |
+
$current_utc_datetime = gmdate('Y-m-d H:i:s');
|
280 |
+
$current_user_date = date('Y-m-d', strtotime(B2S_Util::getUTCForDate($current_utc_datetime, $userTimeZoneOffset)));
|
281 |
+
$userVersion = (int) $tokenInfo['B2S_PLUGIN_USER_VERSION'];
|
282 |
+
|
283 |
+
$autoPostCon = $options->_getOption('auto_post_import_condition');
|
284 |
+
$conData = array();
|
285 |
+
if ($autoPostCon !== false && is_array($autoPostCon) && isset($autoPostCon['count']) && isset($autoPostCon['last_call_date'])) {
|
286 |
+
$con = unserialize(B2S_PLUGIN_AUTO_POST_LIMIT);
|
287 |
+
$limitCount = (isset($con[$userVersion]) && !empty($con[$userVersion])) ? $con[$userVersion] : $con[1]; //25 default
|
288 |
+
if (($autoPostCon['count'] < $limitCount) || ($current_user_date != $autoPostCon['last_call_date'])) {
|
289 |
+
$limit = true;
|
290 |
+
$count = ($current_user_date != $autoPostCon['last_call_date']) ? 1 : $autoPostCon['count'] + 1;
|
291 |
+
$conData = array('count' => $count, 'last_call_date' => $current_user_date);
|
292 |
+
}
|
293 |
+
} else {
|
294 |
+
$limit = true;
|
295 |
+
$count = 1;
|
296 |
+
$conData = array('count' => $count, 'last_call_date' => $current_user_date);
|
297 |
+
}
|
298 |
+
if (!empty($conData)) {
|
299 |
+
$options->_setOption('auto_post_import_condition', $conData);
|
300 |
+
}
|
301 |
+
|
302 |
+
if ($limit) {
|
303 |
+
global $wpdb;
|
304 |
+
$hook_filter = new B2S_Hook_Filter();
|
305 |
+
$optionPostFormat = $options->_getOption('post_template');
|
306 |
+
$url = get_permalink($post->ID);
|
307 |
+
$title = isset($post->post_title) ? B2S_Util::getTitleByLanguage(strip_tags($post->post_title)) : '';
|
308 |
+
$keywords = $hook_filter->get_wp_post_hashtag((int) $post->ID, $post->post_type);
|
309 |
+
if (($keywords == false || empty($keywords)) && is_plugin_active('wp-automatic/wp-automatic.php')) {
|
310 |
+
$keywords = B2S_Tools::extractKeywords($title);
|
311 |
+
}
|
312 |
+
$content = (isset($post->post_content) && !empty($post->post_content)) ? trim($post->post_content) : '';
|
313 |
+
$excerpt = (isset($post->post_excerpt) && !empty($post->post_excerpt)) ? trim($post->post_excerpt) : '';
|
314 |
+
$images_urls = $hook_filter->get_wp_post_image((int) $post->ID, true, $content);
|
315 |
+
$image_url = ((!empty($images_urls) && isset(array_values($images_urls)[0][0])) ? array_values($images_urls)[0][0] : false);
|
316 |
+
$delay = (isset($autoPostData['ship_state']) && (int) $autoPostData['ship_state'] = 0) ? 0 : (isset($autoPostData['ship_delay_time']) ? (int) $autoPostData['ship_delay_time'] : 0);
|
317 |
+
$current_user_datetime = date('Y-m-d H:i:s', strtotime(B2S_Util::getUTCForDate($current_utc_datetime, $userTimeZoneOffset)));
|
318 |
+
|
319 |
+
//ShareNow
|
320 |
+
$sched_type = 3;
|
321 |
+
$time = ($delay == 0) ? "-30 seconds" : "+" . $delay . " minutes";
|
322 |
+
$sched_date = date('Y-m-d H:i:s', strtotime($time, strtotime($current_user_datetime)));
|
323 |
+
$sched_date_utc = date('Y-m-d H:i:s', strtotime($time, strtotime($current_utc_datetime)));
|
324 |
+
|
325 |
+
$defaultPostData = array('default_titel' => $title,
|
326 |
+
'image_url' => ($image_url !== false) ? trim(urldecode($image_url)) : '',
|
327 |
+
'lang' => trim(strtolower(substr(B2S_LANGUAGE, 0, 2))),
|
328 |
+
'no_cache' => 0, //default inactive , 1=active 0=not
|
329 |
+
'board' => '', 'group' => '', 'url' => $url, 'user_timezone' => $userTimeZoneOffset);
|
330 |
+
|
331 |
+
$defaultBlogPostData = array('post_id' => (int) $post->ID, 'blog_user_id' => (int) $post->post_author, 'user_timezone' => $userTimeZoneOffset, 'sched_type' => $sched_type, 'sched_date' => $sched_date, 'sched_date_utc' => $sched_date_utc);
|
332 |
+
|
333 |
+
$autoShare = new B2S_AutoPost((int) $post->ID, $defaultBlogPostData, $current_user_date, false, $title, $content, $excerpt, $url, $image_url, $keywords, trim(strtolower(substr(B2S_LANGUAGE, 0, 2))), $optionPostFormat, true, $userVersion);
|
334 |
+
|
335 |
+
//TOS Twitter 032018 - none multiple Accounts - User select once
|
336 |
+
$networkTos = true;
|
337 |
+
|
338 |
+
foreach ($autoPostData['network_auth_id'] as $k => $value) {
|
339 |
+
$networkDetails = $wpdb->get_results($wpdb->prepare("SELECT postNetworkDetails.network_id, postNetworkDetails.network_type, postNetworkDetails.network_display_name FROM {$wpdb->prefix}b2s_posts_network_details AS postNetworkDetails WHERE postNetworkDetails.network_auth_id = %s", $value));
|
340 |
+
if ((int) $networkDetails[0]->network_id == 1 || (int) $networkDetails[0]->network_id == 3 || (int) $networkDetails[0]->network_id == 19) {
|
341 |
+
$linkNoCache = B2S_Tools::getNoCacheData((int) $post->post_author);
|
342 |
+
if (is_array($linkNoCache) && isset($linkNoCache[$networkDetails[0]->network_id]) && (int) $linkNoCache[$networkDetails[0]->network_id] > 0) {
|
343 |
+
$defaultPostData['no_cache'] = $linkNoCache[$networkDetails[0]->network_id];
|
344 |
+
}
|
345 |
+
}
|
346 |
+
if (is_array($networkDetails) && isset($networkDetails[0]->network_id) && isset($networkDetails[0]->network_type) && isset($networkDetails[0]->network_display_name)) {
|
347 |
+
//TOS Twitter 032018 - none multiple Accounts - User select once
|
348 |
+
if ((int) $networkDetails[0]->network_id != 2 || ( (int) $networkDetails[0]->network_id == 2 && $networkTos)) {
|
349 |
+
//at first: set one profile
|
350 |
+
if ((int) $networkDetails[0]->network_id == 2) {
|
351 |
+
$networkTos = false;
|
352 |
+
}
|
353 |
+
$res = $autoShare->prepareShareData($value, $networkDetails[0]->network_id, $networkDetails[0]->network_type);
|
354 |
+
if ($res !== false && is_array($res)) {
|
355 |
+
$ship = true;
|
356 |
+
$res = array_merge($res, $defaultPostData);
|
357 |
+
$autoShare->saveShareData($res, $networkDetails[0]->network_id, $networkDetails[0]->network_type, $value, 0, strip_tags($networkDetails[0]->network_display_name));
|
358 |
+
}
|
359 |
+
}
|
360 |
+
}
|
361 |
+
}
|
362 |
+
if ($ship) {
|
363 |
+
B2S_Heartbeat::getInstance()->postToServer();
|
364 |
+
}
|
365 |
+
}
|
366 |
+
}
|
367 |
+
}
|
368 |
+
}
|
369 |
+
}
|
370 |
+
} else {
|
371 |
+
//Unlock Auto-Post-Import
|
372 |
+
delete_option('B2S_LOCK_AUTO_POST_IMPORT_' . (int) $post->post_author);
|
373 |
+
}
|
374 |
+
}
|
375 |
+
}
|
376 |
+
|
377 |
+
public function update_db_check() {
|
378 |
+
$this->lastVersion = get_option('b2s_plugin_version');
|
379 |
+
if ($this->lastVersion == false || (int) $this->lastVersion < B2S_PLUGIN_VERSION) {
|
380 |
+
$this->activatePlugin();
|
381 |
+
update_option('b2s_plugin_version', B2S_PLUGIN_VERSION, false);
|
382 |
+
}
|
383 |
+
}
|
384 |
+
|
385 |
+
public function b2s_delete_sched_post($post_id) {
|
386 |
+
wp_enqueue_script('B2SPOSTSCHEDHEARTBEATJS');
|
387 |
+
if ((int) $post_id > 0) {
|
388 |
+
global $wpdb;
|
389 |
+
//Heartbeat => b2s_delete_sched_post
|
390 |
+
$sql = "SELECT id, post_for_approve FROM {$wpdb->prefix}b2s_posts WHERE post_id = %d AND hook_action <= %d AND hide = %d AND sched_date_utc != %s AND publish_date = %s";
|
391 |
+
$deleteData = $wpdb->get_results($wpdb->prepare($sql, $post_id, 2, 0, "0000-00-00 00:00:00", "0000-00-00 00:00:00"), ARRAY_A);
|
392 |
+
if (is_array($deleteData) && !empty($deleteData) && isset($deleteData[0])) {
|
393 |
+
foreach ($deleteData as $k => $value) {
|
394 |
+
if ((int) $value['id'] > 0) {
|
395 |
+
if ((int) $value['post_for_approve'] == 1) {
|
396 |
+
$data = array('hook_action' => '0', 'hide' => 1);
|
397 |
+
} else {
|
398 |
+
$data = array('hook_action' => '3', 'hide' => 1);
|
399 |
+
}
|
400 |
+
$where = array('id' => (int) $value['id']);
|
401 |
+
$wpdb->update($wpdb->prefix . 'b2s_posts', $data, $where, array('%d'), array('%d'));
|
402 |
+
}
|
403 |
+
}
|
404 |
+
}
|
405 |
+
}
|
406 |
+
}
|
407 |
+
|
408 |
+
public function b2s_get_full_content() {
|
409 |
+
if (isset($_GET['b2s_get_full_content'])) {
|
410 |
+
$b2sPostContent = do_shortcode(get_the_content());
|
411 |
+
$b2sPostId = get_the_ID();
|
412 |
+
update_option('B2S_PLUGIN_POST_CONTENT_' . $b2sPostId, $b2sPostContent, false);
|
413 |
+
}
|
414 |
+
}
|
415 |
+
|
416 |
+
public function b2s_load_post_box() {
|
417 |
+
if (defined("B2S_PLUGIN_TOKEN")) {
|
418 |
+
$post_types = get_post_types(array('public' => true));
|
419 |
+
if (is_array($post_types) && !empty($post_types)) {
|
420 |
+
foreach ($post_types as $post_type) {
|
421 |
+
if ($post_type != 'attachment' && $post_type != 'nav_menu_item') {
|
422 |
+
add_meta_box('b2s-post-meta-box-auto', esc_html__('Blog2Social: Autoposter', 'blog2social'), array($this, 'b2s_view_post_box'), $post_type, 'side', 'high');
|
423 |
+
add_meta_box('b2s-post-box-calendar-header', esc_html__('Blog2Social: Social Media Content Calendar', 'blog2social'), array($this, 'b2s_view_post_box_calendar'), $post_type, 'normal', 'high');
|
424 |
+
}
|
425 |
+
}
|
426 |
+
}
|
427 |
+
}
|
428 |
+
}
|
429 |
+
|
430 |
+
public function b2s_view_post_box() {
|
431 |
+
wp_enqueue_style('B2SAIRDATEPICKERCSS');
|
432 |
+
wp_enqueue_style('B2SPOSTBOXCSS');
|
433 |
+
wp_enqueue_script('B2SAIRDATEPICKERJS');
|
434 |
+
wp_enqueue_script('B2SAIRDATEPICKERDEJS');
|
435 |
+
wp_enqueue_script('B2SAIRDATEPICKERENJS');
|
436 |
+
wp_enqueue_script('B2SPOSTBOXJS');
|
437 |
+
|
438 |
+
wp_nonce_field("b2s-meta-box-nonce-post-area", "b2s-meta-box-nonce");
|
439 |
+
wp_nonce_field('b2s_security_nonce', 'b2s_security_nonce');
|
440 |
+
$postId = (isset($_GET['post']) && (int) $_GET['post'] > 0) ? (int) $_GET['post'] : 0;
|
441 |
+
$postType = (isset($_GET['post_type']) && !empty($_GET['post_type'])) ? sanitize_text_field($_GET['post_type']) : get_post_type($postId);
|
442 |
+
$postStatus = ($postId != 0) ? get_post_status($postId) : '';
|
443 |
+
$postBox = new B2S_PostBox();
|
444 |
+
echo $postBox->getPostBox($postId, $postType, $postStatus);
|
445 |
+
}
|
446 |
+
|
447 |
+
public function b2s_view_post_box_calendar() {
|
448 |
+
wp_enqueue_style('B2SFULLCALLENDARCSS');
|
449 |
+
wp_enqueue_style('B2SCALENDARCSS');
|
450 |
+
wp_enqueue_script('B2SFULLCALENDARMOMENTJS');
|
451 |
+
wp_enqueue_script('B2SFULLCALENDARJS');
|
452 |
+
wp_enqueue_script('B2SFULLCALENDARLOCALEJS');
|
453 |
+
wp_enqueue_script('B2SLIB');
|
454 |
+
echo '<div class="b2s-post-box-calendar-content"></div>';
|
455 |
+
}
|
456 |
+
|
457 |
+
public function b2s_save_post_box() {
|
458 |
+
|
459 |
+
if (!isset($_POST['wphb-clear-cache'])) { // WP-Hummingbird BTN clear cache - protection
|
460 |
+
if (!isset($_POST['wp-preview']) || (isset($_POST['wp-preview']) && $_POST['wp-preview'] != 'dopreview')) {
|
461 |
+
if (isset($_POST['post_ID']) && (int) $_POST['post_ID'] > 0) {
|
462 |
+
|
463 |
+
//Gutenberg WP V5.0 - B2S V5.1.0 optimization
|
464 |
+
if (!isset($_POST['post_title']) || !isset($_POST['content'])) {
|
465 |
+
$content = get_post((int) $_POST['post_ID']);
|
466 |
+
if (!isset($_POST['post_title'])) {
|
467 |
+
$_POST['post_title'] = $content->post_title;
|
468 |
+
}
|
469 |
+
if (!isset($_POST['content'])) {
|
470 |
+
$_POST['content'] = $content->post_content;
|
471 |
+
}
|
472 |
+
}
|
473 |
+
$hook_filter = new B2S_Hook_Filter();
|
474 |
+
$b2sPostLang = (isset($_POST['b2s-user-lang']) && !empty($_POST['b2s-user-lang'])) ? sanitize_text_field($_POST['b2s-user-lang']) : 'en';
|
475 |
+
//OgMeta
|
476 |
+
if (isset($_POST['isOgMetaChecked']) && (int) $_POST['isOgMetaChecked'] == 1 && (int) $_POST['post_ID'] > 0 && isset($_POST['content']) && isset($_POST['post_title'])) {
|
477 |
+
$meta = B2S_Meta::getInstance();
|
478 |
+
$meta->getMeta(((int) $_POST['post_ID']));
|
479 |
+
$title = B2S_Util::getTitleByLanguage(sanitize_text_field($_POST['post_title']), strtolower($b2sPostLang));
|
480 |
+
if (has_excerpt((int) $_POST['post_ID'])) {
|
481 |
+
$desc = sanitize_textarea_field(get_the_excerpt());
|
482 |
+
} else {
|
483 |
+
$desc = str_replace("\r\n", ' ', substr(sanitize_textarea_field(strip_shortcodes($_POST['content'])), 0, 160));
|
484 |
+
}
|
485 |
+
$images_urls = $hook_filter->get_wp_post_image((int) $_POST['post_ID'], true, ((isset($_POST['content']) && !empty($_POST['content'])) ? trim($_POST['content']) : ''));
|
486 |
+
$image_url = ((!empty($images_urls) && isset(array_values($images_urls)[0][0])) ? array_values($images_urls)[0][0] : false);
|
487 |
+
$meta->setMeta('og_title', $title);
|
488 |
+
$meta->setMeta('og_desc', $desc);
|
489 |
+
$meta->setMeta('og_image', (($image_url !== false) ? trim(esc_url(urldecode($image_url))) : ''));
|
490 |
+
$meta->setMeta('og_image_alt', ((is_array($images_urls) && !empty($images_urls) && isset($images_urls[0][1]) && !empty($images_urls[0][1])) ? esc_attr($images_urls[0][1]) : ''));
|
491 |
+
$meta->updateMeta((int) $_POST['post_ID']);
|
492 |
+
}
|
493 |
+
|
494 |
+
//CardMeta
|
495 |
+
if (isset($_POST['isCardMetaChecked']) && (int) $_POST['isCardMetaChecked'] == 1 && (int) $_POST['post_ID'] > 0 && isset($_POST['content']) && isset($_POST['post_title'])) {
|
496 |
+
$meta = B2S_Meta::getInstance();
|
497 |
+
$meta->getMeta(((int) $_POST['post_ID']));
|
498 |
+
$title = B2S_Util::getTitleByLanguage(sanitize_text_field($_POST['post_title']), strtolower($b2sPostLang));
|
499 |
+
if (has_excerpt((int) $_POST['post_ID'])) {
|
500 |
+
$desc = sanitize_textarea_field(get_the_excerpt());
|
501 |
+
} else {
|
502 |
+
$desc = str_replace("\r\n", ' ', substr(sanitize_textarea_field(strip_shortcodes($_POST['content'])), 0, 160));
|
503 |
+
}
|
504 |
+
$images_urls = $hook_filter->get_wp_post_image((int) $_POST['post_ID'], true, ((isset($_POST['content']) && !empty($_POST['content'])) ? trim($_POST['content']) : ''));
|
505 |
+
$image_url = ((!empty($images_urls) && isset(array_values($images_urls)[0][0])) ? array_values($images_urls)[0][0] : false);
|
506 |
+
$meta->setMeta('card_title', $title);
|
507 |
+
$meta->setMeta('card_desc', $desc);
|
508 |
+
$meta->setMeta('card_image', (($image_url !== false) ? trim(esc_url(urldecode($image_url))) : ''));
|
509 |
+
$meta->updateMeta((int) $_POST['post_ID']);
|
510 |
+
}
|
511 |
+
|
512 |
+
if (isset($_POST['post_ID']) && isset($_POST['user_ID']) && (int) $_POST['post_ID'] > 0 && (int) $_POST['user_ID'] > 0 && !defined("B2S_SAVE_META_BOX_AUTO_SHARE") && !wp_is_post_autosave($_POST['post_ID']) && isset($_POST['b2s-meta-box-nonce']) && wp_verify_nonce($_POST['b2s-meta-box-nonce'], 'b2s-meta-box-nonce-post-area') && isset($_POST['post_status'])) {
|
513 |
+
$ship = false;
|
514 |
+
if (isset($_POST['b2s-enable-auto-post'])) {
|
515 |
+
if ((int) $_POST['b2s-enable-auto-post'] == 1) {
|
516 |
+
if ((strtolower($_POST['post_status']) == "publish" || strtolower($_POST['post_status']) == "future") && isset($_POST['b2s-post-meta-box-profil-dropdown'])) {
|
517 |
+
$profilId = (int) $_POST['b2s-post-meta-box-profil-dropdown'];
|
518 |
+
|
519 |
+
//save network settings and besttimes if different than default
|
520 |
+
$postOptions = new B2S_Options($_POST['post_ID'], 'B2S_PLUGIN_POST_OPTIONS');
|
521 |
+
$newPostOption = $postOptions->_getOption('auto_post_manuell');
|
522 |
+
if ($newPostOption == false || !is_array($newPostOption)) {
|
523 |
+
$newPostOption = array();
|
524 |
+
}
|
525 |
+
$tempOption = array();
|
526 |
+
if (isset($_POST['b2s-profile-default']) && $profilId != (int) $_POST['b2s-profile-default']) {
|
527 |
+
$tempOption['profile'] = $profilId;
|
528 |
+
} else {
|
529 |
+
unset($tempOption['profile']);
|
530 |
+
}
|
531 |
+
if (isset($_POST['b2s-post-meta-box-profil-dropdown-twitter']) && (int) $_POST['b2s-post-meta-box-profil-dropdown-twitter'] > 0 && isset($_POST['b2s-twitter-default']) && (int) $_POST['b2s-post-meta-box-profil-dropdown-twitter'] != (int) $_POST['b2s-twitter-default']) {
|
532 |
+
$tempOption['twitter'] = (int) $_POST['b2s-post-meta-box-profil-dropdown-twitter'];
|
533 |
+
} else {
|
534 |
+
unset($tempOption['twitter']);
|
535 |
+
}
|
536 |
+
if (isset($_POST['b2s-post-meta-box-sched-select']) && isset($_POST['b2s-best-times-default']) && (int) $_POST['b2s-post-meta-box-sched-select'] != (int) $_POST['b2s-best-times-default']) {
|
537 |
+
$tempOption['best_times'] = (int) $_POST['b2s-post-meta-box-sched-select'];
|
538 |
+
} else {
|
539 |
+
unset($tempOption['best_times']);
|
540 |
+
}
|
541 |
+
$newPostOption[B2S_PLUGIN_BLOG_USER_ID] = $tempOption;
|
542 |
+
$postOptions->_setOption('auto_post_manuell', $newPostOption);
|
543 |
+
|
544 |
+
if (isset($_POST['b2s-post-meta-box-profil-data-' . $profilId]) && !empty($_POST['b2s-post-meta-box-profil-data-' . $profilId])) {
|
545 |
+
$networkData = json_decode(base64_decode($_POST['b2s-post-meta-box-profil-data-' . $profilId]));
|
546 |
+
if ($networkData !== false && is_array($networkData) && !empty($networkData)) {
|
547 |
+
$user_timezone = isset($_POST['b2s-user-timezone']) ? (int) $_POST['b2s-user-timezone'] : 0;
|
548 |
+
$current_utc_date = gmdate('Y-m-d H:i:s');
|
549 |
+
$current_user_date = date('Y-m-d H:i:s', strtotime(B2S_Util::getUTCForDate($current_utc_date, $user_timezone)));
|
550 |
+
$post_date = '';
|
551 |
+
//WP User Sched Post + B2S Share NOW
|
552 |
+
if (isset($_POST['mm']) && isset($_POST['jj']) && isset($_POST['aa']) && isset($_POST['hh']) && isset($_POST['mn']) && isset($_POST['ss'])) {
|
553 |
+
$wp_user_sched_post_date = $_POST['aa'] . '-' . $_POST['mm'] . '-' . $_POST['jj'] . ' ' . $_POST['hh'] . ':' . $_POST['mn'] . ':' . $_POST['ss'];
|
554 |
+
} else {
|
555 |
+
//V5.0.0 Gutenberg Editor
|
556 |
+
$wp_user_sched_post_date = get_the_date('Y-m-d H:i:s', $_POST['post_ID']);
|
557 |
+
}
|
558 |
+
$post_date = date('Y-m-d H:i:s', strtotime($wp_user_sched_post_date));
|
559 |
+
|
560 |
+
//ShareNow
|
561 |
+
$sched_type = 3;
|
562 |
+
$sched_date = $current_user_date;
|
563 |
+
$sched_date_utc = date('Y-m-d H:i:s', strtotime("-30 seconds", strtotime($current_utc_date)));
|
564 |
+
$myTimeSettings = false;
|
565 |
+
|
566 |
+
//allow for User Post Date (Schedule)
|
567 |
+
if (!empty($post_date) && $current_user_date <= $post_date) {
|
568 |
+
$sched_type = 2;
|
569 |
+
$sched_date = date('Y-m-d H:i:59', strtotime($post_date));
|
570 |
+
$sched_date_utc = date('Y-m-d H:i:s', strtotime(B2S_Util::getUTCForDate($sched_date, $user_timezone * (-1))));
|
571 |
+
}
|
572 |
+
|
573 |
+
//Schedule post for best times
|
574 |
+
if (isset($_POST['b2s-post-meta-box-sched-select']) && $_POST['b2s-post-meta-box-sched-select'] == 1) {
|
575 |
+
if (isset($_POST['b2s-post-meta-box-best-time-settings'])) {
|
576 |
+
$sched_type = 2;
|
577 |
+
$myTimeSettings = unserialize(stripslashes($_POST['b2s-post-meta-box-best-time-settings']));
|
578 |
+
if ($myTimeSettings !== false && is_array($myTimeSettings) && isset($myTimeSettings['times']) && isset($myTimeSettings['type'])) {
|
579 |
+
$myTimeSettings = $myTimeSettings;
|
580 |
+
}
|
581 |
+
}
|
582 |
+
}
|
583 |
+
|
584 |
+
delete_option('B2S_PLUGIN_POST_CONTENT_' . (int) $_POST['post_ID']);
|
585 |
+
$keywords = $hook_filter->get_wp_post_hashtag((int) $_POST['post_ID'], get_post_type((int) $_POST['post_ID']));
|
586 |
+
$url = get_permalink($_POST['post_ID']);
|
587 |
+
$title = isset($_POST['post_title']) ? B2S_Util::getTitleByLanguage(strip_tags($_POST['post_title']), strtolower($b2sPostLang)) : '';
|
588 |
+
$content = (isset($_POST['content']) && !empty($_POST['content'])) ? trim($_POST['content']) : '';
|
589 |
+
$excerpt = (isset($_POST['excerpt']) && !empty($_POST['excerpt'])) ? trim($_POST['excerpt']) : get_the_excerpt((int) $_POST['post_ID']);
|
590 |
+
$images_urls = $hook_filter->get_wp_post_image((int) $_POST['post_ID'], true, $content);
|
591 |
+
$image_url = ((!empty($images_urls) && isset(array_values($images_urls)[0][0])) ? array_values($images_urls)[0][0] : false);
|
592 |
+
|
593 |
+
$options = new B2S_Options((int) $_POST['user_ID']);
|
594 |
+
$optionPostFormat = $options->_getOption('post_template');
|
595 |
+
|
596 |
+
$defaultPostData = array('default_titel' => $title,
|
597 |
+
'image_url' => ($image_url !== false) ? trim(urldecode($image_url)) : '',
|
598 |
+
'lang' => trim(strtolower(substr(B2S_LANGUAGE, 0, 2))),
|
599 |
+
'no_cache' => 0, //default inactive , 1=active 0=not
|
600 |
+
'board' => '', 'group' => '', 'url' => $url, 'user_timezone' => $user_timezone); // 'publish_date' => $sched_date, OLD FOR Share Now?
|
601 |
+
|
602 |
+
$defaultBlogPostData = array('post_id' => (int) $_POST['post_ID'], 'blog_user_id' => (int) $_POST['user_ID'], 'user_timezone' => $user_timezone, 'sched_type' => $sched_type, 'sched_date' => $sched_date, 'sched_date_utc' => $sched_date_utc);
|
603 |
+
|
604 |
+
$autoShare = new B2S_AutoPost((int) $_POST['post_ID'], $defaultBlogPostData, $current_user_date, $myTimeSettings, $title, $content, $excerpt, $url, $image_url, $keywords, $b2sPostLang, $optionPostFormat);
|
605 |
+
define('B2S_SAVE_META_BOX_AUTO_SHARE', (int) $_POST['post_ID']);
|
606 |
+
if (isset($_POST['b2s-user-last-selected-profile-id']) && (int) $_POST['b2s-user-last-selected-profile-id'] != (int) $_POST['b2s-post-meta-box-profil-dropdown'] && (int) $_POST['b2s-post-meta-box-profil-dropdown'] != 0) {
|
607 |
+
update_option('B2S_PLUGIN_SAVE_META_BOX_AUTO_SHARE_PROFILE_USER_' . (int) $_POST['user_ID'], (int) $_POST['b2s-post-meta-box-profil-dropdown'], false);
|
608 |
+
}
|
609 |
+
|
610 |
+
$metaOg = false;
|
611 |
+
$metaCard = false;
|
612 |
+
$tosCrossPosting = unserialize(B2S_PLUGIN_NETWORK_CROSSPOSTING_LIMIT);
|
613 |
+
|
614 |
+
//Delete old sched posts (don't delete, if network group changed)
|
615 |
+
if (!isset($_POST['b2s-profile-selected']) || $_POST['b2s-profile-selected'] < 0 || !isset($_POST['b2s-post-meta-box-profil-dropdown']) || (int) $_POST['b2s-post-meta-box-profil-dropdown'] == (int) $_POST['b2s-profile-selected']) {
|
616 |
+
global $wpdb;
|
617 |
+
$getSchedData = $wpdb->prepare("SELECT b.id as b2sPostId,d.network_id as networkId,d.network_type as networkType,d.network_auth_id as networkAuthId,d.network_display_name as networkUserName FROM {$wpdb->prefix}b2s_posts b LEFT JOIN {$wpdb->prefix}b2s_posts_network_details d ON (d.id = b.network_details_id) WHERE b.post_id = %d AND b.sched_type = %d AND b.publish_date = %s AND b.hide = %d", (int) $_POST['post_ID'], 3, "0000-00-00 00:00:00", 0);
|
618 |
+
$schedDataResult = $wpdb->get_results($getSchedData);
|
619 |
+
$delete_scheds = array();
|
620 |
+
foreach ($schedDataResult as $k => $value) {
|
621 |
+
array_push($delete_scheds, $value->b2sPostId);
|
622 |
+
}
|
623 |
+
if (!empty($delete_scheds)) {
|
624 |
+
require_once (B2S_PLUGIN_DIR . '/includes/B2S/Post/Tools.php');
|
625 |
+
$ship = true;
|
626 |
+
B2S_Post_Tools::deleteUserSchedPost($delete_scheds);
|
627 |
+
}
|
628 |
+
}
|
629 |
+
|
630 |
+
//TOS Twitter 032018 - none multiple Accounts - User select once
|
631 |
+
$selectedTwitterProfile = (isset($_POST['b2s-post-meta-box-profil-dropdown-twitter']) && !empty($_POST['b2s-post-meta-box-profil-dropdown-twitter'])) ? (int) $_POST['b2s-post-meta-box-profil-dropdown-twitter'] : '';
|
632 |
+
$otherTwitterProfiles = array();
|
633 |
+
$initialTwitterPostId = 0;
|
634 |
+
foreach ($networkData as $k => $value) {
|
635 |
+
$initialTwitterPost = false;
|
636 |
+
if ((int) $value->networkId == 1 || (int) $value->networkId == 3 || (int) $value->networkId == 19) {
|
637 |
+
$linkNoCache = B2S_Tools::getNoCacheData((int) $_POST['user_ID']);
|
638 |
+
if (is_array($linkNoCache) && isset($linkNoCache[$value->networkId]) && (int) $linkNoCache[$value->networkId] > 0) {
|
639 |
+
$defaultPostData['no_cache'] = $linkNoCache[$value->networkId];
|
640 |
+
}
|
641 |
+
}
|
642 |
+
if (isset($value->networkAuthId) && (int) $value->networkAuthId > 0 && isset($value->networkId) && (int) $value->networkId > 0 && isset($value->networkType)) {
|
643 |
+
//TOS Twitter 032018 - none multiple Accounts - User select once
|
644 |
+
if ((int) $value->networkId == 2) {
|
645 |
+
if ((int) $selectedTwitterProfile > 0 && (int) $selectedTwitterProfile == (int) $value->networkAuthId) {
|
646 |
+
$initialTwitterPost = true;
|
647 |
+
} else {
|
648 |
+
array_push($otherTwitterProfiles, (int) $value->networkAuthId);
|
649 |
+
continue;
|
650 |
+
}
|
651 |
+
//TOS Crossposting ignore
|
652 |
+
}
|
653 |
+
//Filter: TOS Crossposting ignore
|
654 |
+
if (isset($tosCrossPosting[$value->networkId][$value->networkType])) {
|
655 |
+
continue;
|
656 |
+
}
|
657 |
+
$res = $autoShare->prepareShareData($value->networkAuthId, $value->networkId, $value->networkType, ((isset($value->networkKind) && (int) $value->networkKind >= 0) ? $value->networkKind : 0));
|
658 |
+
if ($res !== false && is_array($res)) {
|
659 |
+
$ship = true;
|
660 |
+
$res = array_merge($res, $defaultPostData);
|
661 |
+
if (((int) $value->networkId == 12 && isset($optionPostFormat[12][0]['addLink']) && $optionPostFormat[12][0]['addLink'] === false) || ((int) $value->networkId == 24 && isset($optionPostFormat[24][0]['addLink']) && $optionPostFormat[24][0]['addLink'] === false)) {
|
662 |
+
$res['url'] = '';
|
663 |
+
}
|
664 |
+
if (((int) $value->networkId == 1 || (int) $value->networkId == 2) && isset($optionPostFormat[1][$value->networkType]['format']) && $optionPostFormat[1][$value->networkType]['format'] == 1 && isset($optionPostFormat[1][$value->networkType]['addLink']) && $optionPostFormat[1][$value->networkType]['addLink'] === false) {
|
665 |
+
$res['url'] = '';
|
666 |
+
}
|
667 |
+
$shareApprove = (isset($value->instant_sharing) && (int) $value->instant_sharing == 1) ? 1 : 0;
|
668 |
+
$insert = $autoShare->saveShareData($res, $value->networkId, $value->networkType, $value->networkAuthId, $shareApprove, strip_tags($value->networkUserName));
|
669 |
+
|
670 |
+
if ($initialTwitterPost && (int) $insert > 0) {
|
671 |
+
$initialTwitterPostId = $insert;
|
672 |
+
}
|
673 |
+
|
674 |
+
//Start - Change/Set MetaTags
|
675 |
+
//TODO Check Enable Feature
|
676 |
+
if ((int) $value->networkId == 1 && $metaOg == false && (int) $_POST['post_ID'] > 0 && isset($res['post_format']) && (int) $res['post_format'] == 0) { //LinkPost
|
677 |
+
$metaOg = true;
|
678 |
+
$meta = B2S_Meta::getInstance();
|
679 |
+
$meta->getMeta((int) $_POST['post_ID']);
|
680 |
+
if (isset($res['image_url']) && !empty($res['image_url'])) {
|
681 |
+
$meta->setMeta('og_image', trim(esc_url($res['image_url'])));
|
682 |
+
$meta->setMeta('og_image_alt', '');
|
683 |
+
$meta->updateMeta((int) $_POST['post_ID']);
|
684 |
+
}
|
685 |
+
}
|
686 |
+
if ((int) $value->networkId == 2 && $metaCard == false && (int) $_POST['post_ID'] > 0 && isset($res['post_format']) && (int) $res['post_format'] == 0) { //LinkPost
|
687 |
+
$metaCard = true;
|
688 |
+
$meta = B2S_Meta::getInstance();
|
689 |
+
$meta->getMeta((int) $_POST['post_ID']);
|
690 |
+
if (isset($res['image_url']) && !empty($res['image_url'])) {
|
691 |
+
$meta->setMeta('card_image', trim(esc_url($res['image_url'])));
|
692 |
+
$meta->updateMeta((int) $_POST['post_ID']);
|
693 |
+
}
|
694 |
+
}
|
695 |
+
//END MetaTags
|
696 |
+
}
|
697 |
+
}
|
698 |
+
}
|
699 |
+
//Reweet Twitter
|
700 |
+
if (!empty($otherTwitterProfiles) && (int) $initialTwitterPostId > 0 && (int) $_POST['post_ID'] > 0) {
|
701 |
+
global $wpdb;
|
702 |
+
$updateIntTwitter = $wpdb->prepare("UPDATE {$wpdb->prefix}b2s_posts SET post_for_relay = 1 WHERE id = %d", (int) $initialTwitterPostId);
|
703 |
+
$wpdb->get_results($updateIntTwitter);
|
704 |
+
$tw_sched_date = date('Y-m-d H:i:s', strtotime("+15 minutes", strtotime($sched_date)));
|
705 |
+
$tw_sched_date_utc = date('Y-m-d H:i:s', strtotime("+15 minutes", strtotime($sched_date_utc)));
|
706 |
+
foreach ($otherTwitterProfiles as $key => $value) {
|
707 |
+
$getNetworkDetails = $wpdb->prepare("SELECT id FROM {$wpdb->prefix}b2s_posts_network_details WHERE network_auth_id = %d", (int) $value);
|
708 |
+
$networkDetails = $wpdb->get_results($getNetworkDetails);
|
709 |
+
if (isset($networkDetails[0]->id) && $networkDetails[0]->id > 0) {
|
710 |
+
$wpdb->insert($wpdb->prefix . 'b2s_posts', array(
|
711 |
+
'post_id' => (int) $_POST['post_ID'],
|
712 |
+
'blog_user_id' => B2S_PLUGIN_BLOG_USER_ID,
|
713 |
+
'user_timezone' => $user_timezone,
|
714 |
+
'sched_type' => 4, // replay, retweet
|
715 |
+
'sched_date' => $tw_sched_date,
|
716 |
+
'sched_date_utc' => $tw_sched_date_utc,
|
717 |
+
'network_details_id' => (int) $networkDetails[0]->id,
|
718 |
+
'relay_primary_post_id' => (int) $initialTwitterPostId,
|
719 |
+
'relay_delay_min' => (int) 15,
|
720 |
+
'hook_action' => 1), array('%d', '%d', '%s', '%d', '%s', '%s', '%d', '%d', '%d', '%d'));
|
721 |
+
}
|
722 |
+
}
|
723 |
+
}
|
724 |
+
if ($ship) {
|
725 |
+
B2S_Heartbeat::getInstance()->deleteSchedPost();
|
726 |
+
B2S_Heartbeat::getInstance()->postToServer();
|
727 |
+
}
|
728 |
+
|
729 |
+
if ($sched_type != 3) {
|
730 |
+
if (isset($_POST['b2s-user-lang']) && !empty($_POST['b2s-user-lang'])) {
|
731 |
+
$dateFormat = ($_POST['b2s-user-lang'] == 'de') ? 'd.m.Y' : 'Y-m-d';
|
732 |
+
$_POST['b2s_update_publish_date'] = date($dateFormat, strtotime($sched_date));
|
733 |
+
}
|
734 |
+
}
|
735 |
+
|
736 |
+
add_filter('redirect_post_location', array($this, 'b2s_add_param_auto_share_meta_box'));
|
737 |
+
}
|
738 |
+
} else {
|
739 |
+
add_filter('redirect_post_location', array($this, 'b2s_add_param_auto_share_error_data_meta_box'));
|
740 |
+
}
|
741 |
+
} else {
|
742 |
+
if (strtolower($_POST['post_status']) == "publish" || strtolower($_POST['post_status']) == "future") {
|
743 |
+
add_filter('redirect_post_location', array($this, 'b2s_add_param_auto_share_error_meta_box'));
|
744 |
+
}
|
745 |
+
}
|
746 |
+
}
|
747 |
+
} else if (isset($_POST['post_status']) && strtolower($_POST['post_status']) == "future") {
|
748 |
+
//update existing posts, if sched date before future date
|
749 |
+
$user_timezone = isset($_POST['b2s-user-timezone']) ? (int) $_POST['b2s-user-timezone'] : 0;
|
750 |
+
$current_utc_date = gmdate('Y-m-d H:i:s');
|
751 |
+
$current_user_date = date('Y-m-d H:i:s', strtotime(B2S_Util::getUTCForDate($current_utc_date, $user_timezone)));
|
752 |
+
|
753 |
+
$post_date = '';
|
754 |
+
if (isset($_POST['post_date']) && !empty($_POST['post_date'])) {
|
755 |
+
$post_date = date('Y-m-d H:i:s', strtotime($_POST['post_date']));
|
756 |
+
}
|
757 |
+
|
758 |
+
if (empty($post_date)) {
|
759 |
+
if (isset($_POST['mm']) && isset($_POST['jj']) && isset($_POST['aa']) && isset($_POST['hh']) && isset($_POST['mn']) && isset($_POST['ss'])) {
|
760 |
+
$wp_user_sched_post_date = $_POST['aa'] . '-' . $_POST['mm'] . '-' . $_POST['jj'] . ' ' . $_POST['hh'] . ':' . $_POST['mn'] . ':' . $_POST['ss'];
|
761 |
+
} else {
|
762 |
+
//V5.0.0 Gutenberg Editor
|
763 |
+
$wp_user_sched_post_date = get_the_date('Y-m-d H:i:s', $_POST['post_ID']);
|
764 |
+
}
|
765 |
+
$post_date = date('Y-m-d H:i:s', strtotime($wp_user_sched_post_date));
|
766 |
+
}
|
767 |
+
|
768 |
+
$sched_date = date('Y-m-d H:i:59', strtotime($post_date));
|
769 |
+
$sched_date_utc = date('Y-m-d H:i:s', strtotime(B2S_Util::getUTCForDate($sched_date, $user_timezone * (-1))));
|
770 |
+
|
771 |
+
global $wpdb;
|
772 |
+
$getSchedData = $wpdb->prepare("SELECT b.sched_date_utc, b.id as b2sPostId,d.network_id as networkId,d.network_type as networkType,d.network_auth_id as networkAuthId,d.network_display_name as networkUserName FROM {$wpdb->prefix}b2s_posts b LEFT JOIN {$wpdb->prefix}b2s_posts_network_details d ON (d.id = b.network_details_id) WHERE b.post_id = %d AND b.publish_date = %s AND b.hide = %d", (int) $_POST['post_ID'], "0000-00-00 00:00:00", 0);
|
773 |
+
$schedDataResult = $wpdb->get_results($getSchedData);
|
774 |
+
foreach ($schedDataResult as $k => $value) {
|
775 |
+
if ($value->sched_date_utc <= $sched_date_utc) {
|
776 |
+
$ship = true;
|
777 |
+
require_once (B2S_PLUGIN_DIR . '/includes/B2S/Post/Tools.php');
|
778 |
+
B2S_Post_Tools::updateUserSchedTimePost($value->b2sPostId, substr($sched_date, 0, 10), substr($sched_date, 11), $user_timezone);
|
779 |
+
}
|
780 |
+
}
|
781 |
+
|
782 |
+
if ($ship) {
|
783 |
+
B2S_Heartbeat::getInstance()->updateSchedTimePost();
|
784 |
+
}
|
785 |
+
}
|
786 |
+
}
|
787 |
+
}
|
788 |
+
}
|
789 |
+
}
|
790 |
+
}
|
791 |
+
|
792 |
+
public function b2s_add_param_auto_share_meta_box($location) {
|
793 |
+
remove_filter('redirect_post_location', array($this, 'b2s_add_param_auto_share_meta_box'));
|
794 |
+
if (isset($_POST['b2s_update_publish_date'])) {
|
795 |
+
return add_query_arg(array('b2s_action' => 1, 'b2s_update_publish_date' => $_POST['b2s_update_publish_date']), $location);
|
796 |
+
}
|
797 |
+
return add_query_arg(array('b2s_action' => 1), $location);
|
798 |
+
}
|
799 |
+
|
800 |
+
public function b2s_add_param_auto_share_error_meta_box($location) {
|
801 |
+
remove_filter('redirect_post_location', array($this, 'b2s_add_param_auto_share_error_meta_box'));
|
802 |
+
return add_query_arg(array('b2s_action' => 2), $location);
|
803 |
+
}
|
804 |
+
|
805 |
+
public function b2s_add_param_auto_share_error_data_meta_box($location) {
|
806 |
+
remove_filter('redirect_post_location', array($this, 'b2s_add_param_auto_share_error_data_meta_box'));
|
807 |
+
return add_query_arg(array('b2s_action' => 3), $location);
|
808 |
+
}
|
809 |
+
|
810 |
+
public function b2s_save_post_alert_meta_box() {
|
811 |
+
if (isset($_GET['b2s_action'])) {
|
812 |
+
$b2sAction = $_GET['b2s_action'];
|
813 |
+
if ((int) $b2sAction == 1) {
|
814 |
+
$b2sLink = get_option('siteurl') . ((substr(get_option('siteurl'), -1, 1) == '/') ? '' : '/') . 'wp-admin/admin.php?page=';
|
815 |
+
if (isset($_GET['b2s_update_publish_date']) && !empty($_GET['b2s_update_publish_date'])) {
|
816 |
+
$publishDate = htmlspecialchars($_GET['b2s_update_publish_date']);
|
817 |
+
echo '<div class="updated"><p>' . esc_html__('This post will be shared into your social media from', 'blog2social') . ' ' . $publishDate . ' <a target="_blank" href="' . $b2sLink . 'blog2social-sched">' . esc_html__('show details', 'blog2social') . '</a></p></div>';
|
818 |
+
} else {
|
819 |
+
echo '<div class="updated"><p>' . esc_html__('This post will be shared on social media in 2-3 minutes!', 'blog2social') . ' <a target="_blank" href="' . $b2sLink . 'blog2social-publish">' . esc_html__('show details', 'blog2social') . '</a></p></div>';
|
820 |
+
}
|
821 |
+
}
|
822 |
+
if ((int) $b2sAction == 2) {
|
823 |
+
echo '<div class="error"><p>' . esc_html__('Please make sure that your post, page or custom post type is published or scheduled to be published on this blog before you try to post it with Blog2Social. Published WP posts will be shared with your chosen permalink, scheduled WP posts will be shared with the posting id link.', 'blog2social') . '</p></div>';
|
824 |
+
}
|
825 |
+
if ((int) $b2sAction == 3) {
|
826 |
+
echo '<div class="error"><p>' . esc_html__('There are no social network accounts assigned to your selected network collection. Please assign at least one social network account or select another network collection.', 'blog2social') . '</p></div>';
|
827 |
+
}
|
828 |
+
}
|
829 |
+
}
|
830 |
+
|
831 |
+
public function plugin_init_language() {
|
832 |
+
load_plugin_textdomain('blog2social', false, B2S_PLUGIN_LANGUAGE_PATH);
|
833 |
+
$this->defineText();
|
834 |
+
}
|
835 |
+
|
836 |
+
public function override_plugin_action_links($links) {
|
837 |
+
$premium = array();
|
838 |
+
if (defined("B2S_PLUGIN_USER_VERSION") && B2S_PLUGIN_USER_VERSION == 0) {
|
839 |
+
$premium = array('<a target="_blank" style="color: rgba(10, 154, 62, 1); font-weight: bold; font-size: 13px;" href="' . esc_url(B2S_Tools::getSupportLink('affiliate')) . '">' . esc_html__('Upgrade to Premium', 'blog2social') . '</a>');
|
840 |
+
}
|
841 |
+
/* Settings & Support */
|
842 |
+
$links = array_merge($premium, array('settings' => sprintf('<a href="%s">%s</a>', 'admin.php?page=blog2social-settings', esc_html__('Settings', 'blog2social'))), array('support' => sprintf('<a href="%s">%s</a>', 'admin.php?page=blog2social-support', esc_html__('Support', 'blog2social'))), $links);
|
843 |
+
|
844 |
+
if (!isset($links['deactivate'])) {
|
845 |
+
return $links;
|
846 |
+
}//end if
|
847 |
+
|
848 |
+
if (is_network_admin()) {
|
849 |
+
return $links;
|
850 |
+
}//end if
|
851 |
+
|
852 |
+
preg_match_all('/<a[^>]+href="(.+?)"[^>]*>/i', $links['deactivate'], $matches);
|
853 |
+
if (empty($matches) || !isset($matches[1][0])) {
|
854 |
+
return $links;
|
855 |
+
}//end if
|
856 |
+
|
857 |
+
if (isset($matches[1][0])) {
|
858 |
+
$links['deactivate'] = sprintf(
|
859 |
+
'<a id="b2s-deactivate" href="%s">%s</a>', $matches[1][0], // @codingStandardsIgnoreLine
|
860 |
+
esc_html__('Deactivate')
|
861 |
+
);
|
862 |
+
}
|
863 |
+
wp_enqueue_style('B2SPOSTBOXCSS');
|
864 |
+
wp_enqueue_script('B2SPOSTBOXJS');
|
865 |
+
|
866 |
+
return $links;
|
867 |
+
}
|
868 |
+
|
869 |
+
public function override_multisite_plugin_action_links($links) {
|
870 |
+
if (!isset($links['deactivate'])) {
|
871 |
+
return $links;
|
872 |
+
}//end if
|
873 |
+
|
874 |
+
preg_match_all('/<a[^>]+href="(.+?)"[^>]*>/i', $links['deactivate'], $matches);
|
875 |
+
if (empty($matches) || !isset($matches[1][0])) {
|
876 |
+
return $links;
|
877 |
+
}//end if
|
878 |
+
|
879 |
+
if (isset($matches[1][0])) {
|
880 |
+
$links['deactivate'] = sprintf(
|
881 |
+
'<a id="b2s-deactivate" href="%s">%s</a>', $matches[1][0], // @codingStandardsIgnoreLine
|
882 |
+
esc_html__('Network Deactivate')
|
883 |
+
);
|
884 |
+
}
|
885 |
+
wp_enqueue_style('B2SPOSTBOXCSS');
|
886 |
+
wp_enqueue_script('B2SPOSTBOXJS');
|
887 |
+
|
888 |
+
return $links;
|
889 |
+
}
|
890 |
+
|
891 |
+
public function defineText() {
|
892 |
+
define('B2S_PLUGIN_PAGE_TITLE', serialize(array('blog2social-notice' => esc_html__('Notifications', 'blog2social'), 'blog2social-publish' => esc_html__('Shared Posts', 'blog2social'), 'blog2social-approve' => esc_html__('Instant Sharing', 'blog2social'), 'blog2social-draft-post' => esc_html__('Drafts', 'blog2social'), 'blog2social-sched' => esc_html__('Scheduled Posts', 'blog2social'), 'blog2social-curation-draft' => esc_html__('Social Media Post Drafts', 'blog2social'), 'blog2social-favorites' => esc_html__('Favorites', 'blog2social'), 'blog2social-autopost' => esc_html__('Auto-Post', 'blog2social'), 'blog2social-repost' => esc_html__('Re-Share Posts', 'blog2social') . ' <span class="label label-success label-sm">' . esc_html__("NEW", "blog2social") . '</span>')));
|
893 |
+
define('B2S_PLUGIN_NETWORK_TYPE', serialize(array(esc_html__('Profile', 'blog2social'), esc_html__('Page', 'blog2social'), esc_html__('Group', 'blog2social'))));
|
894 |
+
define('B2S_PLUGIN_NETWORK_TYPE_INDIVIDUAL', serialize(array(
|
895 |
+
4 => array(0 => __('Blog', 'blog2social')),
|
896 |
+
6 => array(0 => __('Board', 'blog2social')),
|
897 |
+
11 => array(2 => __('Publication', 'blog2social')),
|
898 |
+
12 => array(1 => __('Business', 'blog2social')),
|
899 |
+
15 => array(0 => __('Subreddit', 'blog2social')),
|
900 |
+
17 => array(2 => __('Community', 'blog2social')),
|
901 |
+
18 => array(0 => __('Location', 'blog2social')),
|
902 |
+
19 => array(1 => __('Employer Branding', 'blog2social')),
|
903 |
+
24 => array(0 => __('Channel', 'blog2social')),
|
904 |
+
25 => array(0 => __('Blog', 'blog2social')),
|
905 |
+
)));
|
906 |
+
define('B2S_PLUGIN_NETWORK_KIND', serialize(array(esc_html__('Company-Page (Employer Branding Profile)', 'blog2social'), esc_html__('Business', 'blog2social'), '', '', esc_html__('Company-Page (Employer Branding Profile)', 'blog2social'))));
|
907 |
+
define('B2S_PLUGIN_NETWORK_ERROR', serialize(array('DEFAULT' => sprintf(__('The network could not publish your post. Please see the following <a target="_blank" href="%s">guide</a>.', 'blog2social'), esc_url(B2S_Tools::getSupportLink('share_error'))),
|
908 |
+
'TOKEN' => esc_html__('Your authorization has expired. Please reconnect your account in the Blog2Social network settings.', 'blog2social'),
|
909 |
+
'CONTENT' => sprintf(__('The content of your post could not be approved by the network. Please see the following <a target="_blank" href="%s">guide</a>.', 'blog2social'), esc_url(B2S_Tools::getSupportLink('content_error'))),
|
910 |
+
'RIGHT' => esc_html__('We don\'t have the permission to publish your post. Please check your authorization.', 'blog2social'),
|
911 |
+
'LOGIN' => sprintf(__('The connection to your social media account is interrupted. Please check your authorization and reconnect your account. The <a target="_blank" href="%s">troubleshooting guide</a> shows you how to fix the connection to your social media account.', 'blog2social'), esc_url(B2S_Tools::getSupportLink('troubleshoot_auth'))),
|
912 |
+
'LIMIT' => esc_html__('Your daily limit has been reached.', 'blog2social'),
|
913 |
+
'IMAGE' => esc_html__('Your post could not be posted, because your image is not available or the image source does not allow to publish', 'blog2social'),
|
914 |
+
'PROTECT' => sprintf(__('The network has blocked your account. Please see the following <a target="_blank" href="%s">guide</a>.', 'blog2social'), esc_url(B2S_Tools::getSupportLink('share_error'))),
|
915 |
+
'IMAGE_LIMIT' => sprintf(__('The number of images is reached. Please see the following <a target="_blank" href="%s">guide</a>.', 'blog2social'), esc_url(B2S_Tools::getSupportLink('share_error'))),
|
916 |
+
'RATE_LIMIT' => esc_html__('Your daily limit for this network has been reached. Please try again later.', 'blog2social'),
|
917 |
+
'INVALID_CONTENT' => sprintf(__('The network can not publish special characters such as Emoji. Please see the following <a target="_blank" href="%s">guide</a>.', 'blog2social'), esc_url(B2S_Tools::getSupportLink('share_error'))),
|
918 |
+
'EXISTS_CONTENT' => esc_html__('Your post is a duplicate.', 'blog2social'),
|
919 |
+
'URL_CONTENT' => esc_html__('The network requires a public url.', 'blog2social'),
|
920 |
+
'BLOGPOST_NOT_PUBLISHED' => esc_html__('Your blog post was not available for the network at the time of publishing.', 'blog2social'),
|
921 |
+
'EXISTS_RELAY' => esc_html__('You have already retweeted this post.', 'blog2social'),
|
922 |
+
'DEPRECATED_NETWORK_8' => esc_html__('This XING API is no longer supported by XING. Please connect your XING accounts with the new XING interface to reschedule your posts.', 'blog2social'),
|
923 |
+
'IMAGE_FOR_CURATION' => esc_html__('An image is required to post on this social network.', 'blog2social'), // special for content curation V.5.0.0
|
924 |
+
'LINK_FOR_CURATION' => esc_html__('To share social media posts on Reddit or Diigo, a link is required.', 'blog2social'), // special for content curation V.6.0.0
|
925 |
+
'IMAGE_NETWORK' => esc_html__('Your post could not be posted, because your image can not be processed by the network.', 'blog2social'),
|
926 |
+
'TEXT_NOT_PUBLISHED_12' => sprintf(__('Instagram published your post without text. Please see the following <a target="_blank" href="%s">guide</a>.', 'blog2social'), esc_url(B2S_Tools::getSupportLink('instagram_without_text'))),
|
927 |
+
'GROUP_CONTENT' => esc_html__('Your group can not be found by the network.', 'blog2social'))));
|
928 |
+
}
|
929 |
+
|
930 |
+
public function getToken() {
|
931 |
+
global $wpdb;
|
932 |
+
$sql = $wpdb->prepare("SELECT token FROM `{$wpdb->prefix}b2s_user` WHERE `blog_user_id` = %d", $this->blogUserData->ID);
|
933 |
+
$userExist = $wpdb->get_row($sql);
|
934 |
+
if (empty($userExist) || !isset($userExist->token)) {
|
935 |
+
if (isset($_GET['page']) && !empty($_GET['page']) && in_array($_GET['page'], unserialize(B2S_PLUGIN_PAGE_SLUG))) {
|
936 |
+
$postData = array('action' => 'getToken', 'blog_user_id' => $this->blogUserData->ID, 'blog_url' => get_option('home'), 'email' => $this->blogUserData->user_email, 'is_multisite' => is_multisite());
|
937 |
+
$result = json_decode(B2S_Tools::getToken($postData));
|
938 |
+
if (isset($result->result) && (int) $result->result == 1 && isset($result->token)) {
|
939 |
+
$state_url = (isset($result->state_url)) ? (int) $result->state_url : 0;
|
940 |
+
$sqlInsertToken = $wpdb->prepare("INSERT INTO `{$wpdb->prefix}b2s_user` (`token`, `blog_user_id`,`register_date`,`state_url`) VALUES (%s,%d,%s,%d);", $result->token, (int) $this->blogUserData->ID, date('Y-m-d H:i:s'), $state_url);
|
941 |
+
$wpdb->query($sqlInsertToken);
|
942 |
+
define('B2S_PLUGIN_TOKEN', $result->token);
|
943 |
+
} else {
|
944 |
+
define('B2S_PLUGIN_NOTICE', 'CONNECTION');
|
945 |
+
}
|
946 |
+
}
|
947 |
+
} else {
|
948 |
+
define('B2S_PLUGIN_TOKEN', $userExist->token);
|
949 |
+
}
|
950 |
+
}
|
951 |
+
|
952 |
+
public function getUserDetails() {
|
953 |
+
$tokenInfo = get_option('B2S_PLUGIN_USER_VERSION_' . B2S_PLUGIN_BLOG_USER_ID);
|
954 |
+
if ($tokenInfo == false || !isset($tokenInfo['B2S_PLUGIN_USER_VERSION']) || !isset($tokenInfo['B2S_PLUGIN_VERSION']) || $tokenInfo['B2S_PLUGIN_USER_VERSION_NEXT_REQUEST'] < time() || (isset($tokenInfo['B2S_PLUGIN_VERSION']) && (int) $tokenInfo['B2S_PLUGIN_VERSION'] < (int) B2S_PLUGIN_VERSION) || (isset($tokenInfo['B2S_PLUGIN_TRAIL_END']) && strtotime($tokenInfo['B2S_PLUGIN_TRAIL_END']) < strtotime(gmdate('Y-m-d H:i:s')))) {
|
955 |
+
B2S_Tools::setUserDetails();
|
956 |
+
} else {
|
957 |
+
define('B2S_PLUGIN_USER_VERSION', $tokenInfo['B2S_PLUGIN_USER_VERSION']);
|
958 |
+
if (isset($tokenInfo['B2S_PLUGIN_TRAIL_END'])) {
|
959 |
+
define('B2S_PLUGIN_TRAIL_END', $tokenInfo['B2S_PLUGIN_TRAIL_END']);
|
960 |
+
update_option('B2S_PLUGIN_DISABLE_TRAIL', true, false);
|
961 |
+
}
|
962 |
+
}
|
963 |
+
|
964 |
+
$checkUpdateOption = get_option('B2S_PLUGIN_NEXT_CHECK_UPDATE_REQUEST');
|
965 |
+
if ($checkUpdateOption == false || $checkUpdateOption < time()) {
|
966 |
+
$this->checkUpdate();
|
967 |
+
update_option('B2S_PLUGIN_NEXT_CHECK_UPDATE_REQUEST', time() + 86400, false);
|
968 |
+
}
|
969 |
+
}
|
970 |
+
|
971 |
+
private function checkUpdate() {
|
972 |
+
$args = array(
|
973 |
+
'timeout' => '5',
|
974 |
+
'redirection' => '5',
|
975 |
+
'user-agent' => "Blog2Social/" . B2S_PLUGIN_VERSION . " (Wordpress/Plugin)"
|
976 |
+
);
|
977 |
+
$result = wp_remote_retrieve_body(wp_remote_get(B2S_PLUGIN_API_ENDPOINT . 'update.txt', $args));
|
978 |
+
$currentVersion = explode('#', $result);
|
979 |
+
if (isset($currentVersion[0]) && (int) $currentVersion[0] > (int) B2S_PLUGIN_VERSION) {
|
980 |
+
define('B2S_PLUGIN_NOTICE', 'UPDATE');
|
981 |
+
}
|
982 |
+
}
|
983 |
+
|
984 |
+
public function createMenu() {
|
985 |
+
$subPages = array();
|
986 |
+
//pageTitle,menutitle,$capability, $menu_slug, $function, $icon_url, $position
|
987 |
+
add_menu_page('Blog2Social', 'Blog2Social', 'blog2social_access', 'blog2social', null, plugins_url('/assets/images/b2s_icon.png', B2S_PLUGIN_FILE));
|
988 |
+
//$parent_slug, $page_title, $menu_title, $capability, $menu_slug, $function
|
989 |
+
$subPages[] = add_submenu_page('blog2social', esc_html__('Dashboard', 'blog2social'), esc_html__('Dashboard', 'blog2social'), 'blog2social_access', 'blog2social', array($this, 'b2sstart'));
|
990 |
+
$subPages[] = add_submenu_page('blog2social', esc_html__('Share Website & Blog Content', 'blog2social'), esc_html__('Site & Blog Content', 'blog2social'), 'blog2social_access', 'blog2social-post', array($this, 'b2sPost'));
|
991 |
+
$subPages[] = add_submenu_page('blog2social', esc_html__('Create Social Media Posts', 'blog2social'), esc_html__('Social Media Posts', 'blog2social'), 'blog2social_access', 'blog2social-curation', array($this, 'b2sContentCuration'));
|
992 |
+
$subPages[] = add_submenu_page('blog2social', esc_html__('Calendar', 'blog2social'), esc_html__('Calendar', 'blog2social'), 'blog2social_access', 'blog2social-calendar', array($this, 'b2sPostCalendar'));
|
993 |
+
$subPages[] = add_submenu_page('blog2social', esc_html__('Networks', 'blog2social'), esc_html__('Networks', 'blog2social'), 'blog2social_access', 'blog2social-network', array($this, 'b2sNetwork'));
|
994 |
+
$subPages[] = add_submenu_page('blog2social', esc_html__('Settings', 'blog2social'), esc_html__('Settings', 'blog2social'), 'blog2social_access', 'blog2social-settings', array($this, 'b2sSettings'));
|
995 |
+
if (!B2S_System::isblockedArea('B2S_MENU_ITEM_WP_PR_SERVICE', B2S_PLUGIN_ADMIN)) {
|
996 |
+
$subPages[] = add_submenu_page('blog2social', esc_html__('PR-Service', 'blog2social'), esc_html__('PR-Service', 'blog2social'), 'blog2social_access', 'prg-post', array($this, 'prgPost'));
|
997 |
+
}
|
998 |
+
$subPages[] = add_submenu_page('blog2social', esc_html__('Help & Support', 'blog2social'), esc_html__('Help & Support', 'blog2social'), 'blog2social_access', 'blog2social-support', array($this, 'b2sSupport'));
|
999 |
+
if (!B2S_System::isblockedArea('B2S_MENU_ITEM_WP_LICENSE', B2S_PLUGIN_ADMIN)) {
|
1000 |
+
$subPages[] = add_submenu_page('blog2social', esc_html__('Premium', 'blog2social'), '<span class="dashicons dashicons-star-filled"></span> ' . esc_html__('PREMIUM', 'blog2social'), 'blog2social_access', 'blog2social-premium', array($this, 'b2sPremium'));
|
1001 |
+
}
|
1002 |
+
$subPages[] = add_submenu_page(null, 'B2S Post Draft', 'B2S Post Draft', 'blog2social_access', 'blog2social-draft-post', array($this, 'b2sPostDraft'));
|
1003 |
+
$subPages[] = add_submenu_page(null, 'B2S Post Favorites', 'B2S Post Favorites', 'blog2social_access', 'blog2social-favorites', array($this, 'b2sPostFavorites'));
|
1004 |
+
$subPages[] = add_submenu_page(null, 'B2S Post Sched', 'B2S Post Sched', 'blog2social_access', 'blog2social-sched', array($this, 'b2sPostSched'));
|
1005 |
+
$subPages[] = add_submenu_page(null, 'B2S Post Approve', 'B2S Post Approve', 'blog2social_access', 'blog2social-approve', array($this, 'b2sPostApprove'));
|
1006 |
+
$subPages[] = add_submenu_page(null, 'B2S Post Publish', 'B2S Post Publish', 'blog2social_access', 'blog2social-publish', array($this, 'b2sPostPublish'));
|
1007 |
+
$subPages[] = add_submenu_page(null, 'B2S Post Notice', 'B2S Post Notice', 'blog2social_access', 'blog2social-notice', array($this, 'b2sPostNotice')); //Error post page since 4.8.0
|
1008 |
+
$subPages[] = add_submenu_page(null, 'B2S Ship', 'B2S Ship', 'blog2social_access', 'blog2social-ship', array($this, 'b2sShip'));
|
1009 |
+
$subPages[] = add_submenu_page(null, 'B2S Curation Drafts', 'B2S Curation Drafts', 'blog2social_access', 'blog2social-curation-draft', array($this, 'b2sCurationDraft'));
|
1010 |
+
$subPages[] = add_submenu_page(null, 'B2S Autoposter', 'B2S Autoposter', 'blog2social_access', 'blog2social-autopost', array($this, 'b2sAutoPost'));
|
1011 |
+
$subPages[] = add_submenu_page(null, 'B2S Reposter', 'B2S Reposter', 'blog2social_access', 'blog2social-repost', array($this, 'b2sRePost'));
|
1012 |
+
$subPages[] = add_submenu_page(null, 'PRG Login', 'PRG Login', 'blog2social_access', 'prg-login', array($this, 'prgLogin'));
|
1013 |
+
$subPages[] = add_submenu_page(null, 'PRG Ship', 'PRG Ship', 'blog2social_access', 'prg-ship', array($this, 'prgShip'));
|
1014 |
+
foreach ($subPages as $var) {
|
1015 |
+
add_action($var, array($this, 'addAssets'));
|
1016 |
+
}
|
1017 |
+
}
|
1018 |
+
|
1019 |
+
public function createToolbarMenu() {
|
1020 |
+
if (!current_user_can('blog2social_access')) {
|
1021 |
+
return;
|
1022 |
+
}
|
1023 |
+
global $wp_admin_bar;
|
1024 |
+
$seo_url = strtolower(get_admin_url(null, 'admin.php?page='));
|
1025 |
+
$title = '<div id="blog2social-ab-icon" class="ab-item" style="padding-left: 25px; background-repeat: no-repeat; background-size: 16px auto; background-position: left center; background-image: url(\'' . plugins_url('/assets/images/b2s_icon.png', B2S_PLUGIN_FILE) . '\');">' . esc_html__('Blog2Social', 'blog2social') . '</div>';
|
1026 |
+
$wp_admin_bar->add_node(array(
|
1027 |
+
'id' => 'blog2social',
|
1028 |
+
'title' => $title,
|
1029 |
+
'href' => $seo_url . 'blog2social'
|
1030 |
+
));
|
1031 |
+
|
1032 |
+
$wp_admin_bar->add_node(array(
|
1033 |
+
'id' => 'blog2social-dashboard',
|
1034 |
+
'title' => esc_html__('Dashboard', 'blog2social'),
|
1035 |
+
'href' => $seo_url . 'blog2social',
|
1036 |
+
'parent' => 'blog2social'
|
1037 |
+
));
|
1038 |
+
|
1039 |
+
$wp_admin_bar->add_node(array(
|
1040 |
+
'id' => 'blog2social-post',
|
1041 |
+
'title' => esc_html__('Site & Blog Content', 'blog2social'),
|
1042 |
+
'href' => $seo_url . 'blog2social-post',
|
1043 |
+
'parent' => 'blog2social'
|
1044 |
+
));
|
1045 |
+
|
1046 |
+
$wp_admin_bar->add_node(array(
|
1047 |
+
'id' => 'blog2social-curation',
|
1048 |
+
'title' => esc_html__('Social Media Posts', 'blog2social'),
|
1049 |
+
'href' => $seo_url . 'blog2social-curation',
|
1050 |
+
'parent' => 'blog2social'
|
1051 |
+
));
|
1052 |
+
|
1053 |
+
$wp_admin_bar->add_node(array(
|
1054 |
+
'id' => 'blog2social-calendar',
|
1055 |
+
'title' => esc_html__('Calendar', 'blog2social'),
|
1056 |
+
'href' => $seo_url . 'blog2social-calendar',
|
1057 |
+
'parent' => 'blog2social'
|
1058 |
+
));
|
1059 |
+
|
1060 |
+
$wp_admin_bar->add_node(array(
|
1061 |
+
'id' => 'blog2social-network',
|
1062 |
+
'title' => esc_html__('Networks', 'blog2social'),
|
1063 |
+
'href' => $seo_url . 'blog2social-network',
|
1064 |
+
'parent' => 'blog2social'
|
1065 |
+
));
|
1066 |
+
$wp_admin_bar->add_node(array(
|
1067 |
+
'id' => 'blog2social-settings',
|
1068 |
+
'title' => esc_html__('Settings', 'blog2social'),
|
1069 |
+
'href' => $seo_url . 'blog2social-settings',
|
1070 |
+
'parent' => 'blog2social'
|
1071 |
+
));
|
1072 |
+
|
1073 |
+
if (!B2S_System::isblockedArea('B2S_MENU_ITEM_WP_PR_SERVICE', B2S_PLUGIN_ADMIN)) {
|
1074 |
+
$wp_admin_bar->add_node(array(
|
1075 |
+
'id' => 'blog2social-prg-post',
|
1076 |
+
'title' => esc_html__('PR-Service', 'blog2social'),
|
1077 |
+
'href' => $seo_url . 'prg-post',
|
1078 |
+
'parent' => 'blog2social'
|
1079 |
+
));
|
1080 |
+
}
|
1081 |
+
|
1082 |
+
$wp_admin_bar->add_node(array(
|
1083 |
+
'id' => 'blog2social-support',
|
1084 |
+
'title' => esc_html__('Help & Support', 'blog2social'),
|
1085 |
+
'href' => $seo_url . 'blog2social-support',
|
1086 |
+
'parent' => 'blog2social'
|
1087 |
+
));
|
1088 |
+
|
1089 |
+
if (!B2S_System::isblockedArea('B2S_MENU_ITEM_WP_LICENSE', B2S_PLUGIN_ADMIN)) {
|
1090 |
+
$wp_admin_bar->add_node(array(
|
1091 |
+
'id' => 'blog2social-premium',
|
1092 |
+
'title' => '<span class="ab-icon dashicons dashicons-star-filled"></span> ' . esc_html__('PREMIUM', 'blog2social'),
|
1093 |
+
'href' => $seo_url . 'blog2social-premium',
|
1094 |
+
'parent' => 'blog2social'
|
1095 |
+
));
|
1096 |
+
}
|
1097 |
+
}
|
1098 |
+
|
1099 |
+
//PageFunktion
|
1100 |
+
public function b2sstart() {
|
1101 |
+
|
1102 |
+
if (B2S_Tools::showNotice() == false) {
|
1103 |
+
wp_enqueue_script('B2SVALIDATEJS');
|
1104 |
+
wp_enqueue_style('B2SFULLCALLENDARCSS');
|
1105 |
+
wp_enqueue_style('B2SCALENDARCSS');
|
1106 |
+
wp_enqueue_script('B2SFULLCALENDARMOMENTJS');
|
1107 |
+
wp_enqueue_script('B2SFULLCALENDARJS');
|
1108 |
+
wp_enqueue_script('B2SFULLCALENDARLOCALEJS');
|
1109 |
+
wp_enqueue_script('B2SLIB');
|
1110 |
+
|
1111 |
+
wp_enqueue_script('B2SMOMENT');
|
1112 |
+
wp_enqueue_script('B2SCHARTJS');
|
1113 |
+
wp_enqueue_style('B2SSTARTCSS');
|
1114 |
+
wp_enqueue_script('B2SSTARTJS');
|
1115 |
+
wp_enqueue_style('B2SPOSTCSS');
|
1116 |
+
wp_enqueue_script('B2SPOSTJS');
|
1117 |
+
wp_enqueue_style('B2SAIRDATEPICKERCSS');
|
1118 |
+
wp_enqueue_script('B2SAIRDATEPICKERJS');
|
1119 |
+
wp_enqueue_script('B2SAIRDATEPICKERDEJS');
|
1120 |
+
wp_enqueue_script('B2SAIRDATEPICKERENJS');
|
1121 |
+
require_once( B2S_PLUGIN_DIR . 'views/b2s/dashboard.php');
|
1122 |
+
} else {
|
1123 |
+
require_once( B2S_PLUGIN_DIR . 'views/notice.php');
|
1124 |
+
}
|
1125 |
+
}
|
1126 |
+
|
1127 |
+
//PageFunktion
|
1128 |
+
public function b2sPost() {
|
1129 |
+
if (B2S_Tools::showNotice() == false) {
|
1130 |
+
wp_enqueue_script('B2SVALIDATEJS');
|
1131 |
+
wp_enqueue_style('B2SPOSTCSS');
|
1132 |
+
wp_enqueue_script('B2SPOSTJS');
|
1133 |
+
require_once( B2S_PLUGIN_DIR . 'views/b2s/post.php');
|
1134 |
+
} else {
|
1135 |
+
require_once( B2S_PLUGIN_DIR . 'views/notice.php');
|
1136 |
+
}
|
1137 |
+
}
|
1138 |
+
|
1139 |
+
//Page Curation
|
1140 |
+
public function b2sContentCuration() {
|
1141 |
+
if (B2S_Tools::showNotice() == false) {
|
1142 |
+
wp_enqueue_script('B2SVALIDATEJS');
|
1143 |
+
wp_enqueue_style('B2SCURATIONCSS');
|
1144 |
+
wp_enqueue_script('B2SEMOJIBUTTONJS');
|
1145 |
+
wp_enqueue_script('B2SCURATIONJS');
|
1146 |
+
wp_enqueue_style('B2SAIRDATEPICKERCSS');
|
1147 |
+
wp_enqueue_script('B2SAIRDATEPICKERJS');
|
1148 |
+
wp_enqueue_script('B2SAIRDATEPICKERDEJS');
|
1149 |
+
wp_enqueue_script('B2SAIRDATEPICKERENJS');
|
1150 |
+
if (current_user_can('upload_files')) {
|
1151 |
+
//Capability by Super Admin ,Administrator ,Editor ,Author
|
1152 |
+
wp_enqueue_media();
|
1153 |
+
}
|
1154 |
+
require_once( B2S_PLUGIN_DIR . 'views/b2s/curation.php');
|
1155 |
+
} else {
|
1156 |
+
require_once( B2S_PLUGIN_DIR . 'views/notice.php');
|
1157 |
+
}
|
1158 |
+
}
|
1159 |
+
|
1160 |
+
//PageFunktion
|
1161 |
+
public function b2sNetwork() {
|
1162 |
+
if (B2S_Tools::showNotice() == false) {
|
1163 |
+
wp_enqueue_script('B2SVALIDATEJS');
|
1164 |
+
wp_enqueue_style('B2SNETWORKCSS');
|
1165 |
+
wp_enqueue_script('B2SNETWORKJS');
|
1166 |
+
wp_enqueue_style('B2STIMEPICKERCSS');
|
1167 |
+
wp_enqueue_script('B2STIMEPICKERJS');
|
1168 |
+
require_once( B2S_PLUGIN_DIR . 'views/b2s/network.php');
|
1169 |
+
} else {
|
1170 |
+
require_once( B2S_PLUGIN_DIR . 'views/notice.php');
|
1171 |
+
}
|
1172 |
+
}
|
1173 |
+
|
1174 |
+
//PageFunktion
|
1175 |
+
public function b2sSettings() {
|
1176 |
+
if (B2S_Tools::showNotice() == false) {
|
1177 |
+
wp_enqueue_script('B2SVALIDATEJS');
|
1178 |
+
wp_enqueue_style('B2SSETTINGSCSS');
|
1179 |
+
wp_enqueue_script('B2SSETTINGSJS');
|
1180 |
+
wp_enqueue_style('B2STIMEPICKERCSS');
|
1181 |
+
wp_enqueue_script('B2STIMEPICKERJS');
|
1182 |
+
wp_enqueue_style('B2SBTNTOOGLECSS');
|
1183 |
+
wp_enqueue_script('B2SBTNTOOGLEJS');
|
1184 |
+
wp_enqueue_style('B2SCHOSENCSS');
|
1185 |
+
wp_enqueue_script('B2SCHOSENJS');
|
1186 |
+
|
1187 |
+
if (current_user_can('upload_files')) {
|
1188 |
+
//Capability by Super Admin ,Administrator ,Editor ,Author
|
1189 |
+
wp_enqueue_media();
|
1190 |
+
}
|
1191 |
+
require_once( B2S_PLUGIN_DIR . 'views/b2s/settings.php');
|
1192 |
+
} else {
|
1193 |
+
require_once( B2S_PLUGIN_DIR . 'views/notice.php');
|
1194 |
+
}
|
1195 |
+
}
|
1196 |
+
|
1197 |
+
//PageFunktion
|
1198 |
+
public function b2sShip() {
|
1199 |
+
if (B2S_Tools::showNotice() == false) {
|
1200 |
+
wp_enqueue_script('B2SVALIDATEJS');
|
1201 |
+
wp_enqueue_style('B2SFULLCALLENDARCSS');
|
1202 |
+
wp_enqueue_style('B2SCALENDARCSS');
|
1203 |
+
wp_enqueue_script('B2SFULLCALENDARMOMENTJS');
|
1204 |
+
wp_enqueue_script('B2SFULLCALENDARJS');
|
1205 |
+
wp_enqueue_script('B2SFULLCALENDARLOCALEJS');
|
1206 |
+
wp_enqueue_script('B2SLIB');
|
1207 |
+
wp_enqueue_style('B2SSHIPCSS');
|
1208 |
+
wp_enqueue_style('B2SDATEPICKERCSS');
|
1209 |
+
wp_enqueue_style('B2STIMEPICKERCSS');
|
1210 |
+
wp_enqueue_style('B2SWYSIWYGCSS');
|
1211 |
+
wp_enqueue_script('B2SWYSIWYGJS');
|
1212 |
+
wp_enqueue_script('B2SEMOJIBUTTONJS');
|
1213 |
+
if (substr(B2S_LANGUAGE, 0, 2) == 'de') {
|
1214 |
+
wp_enqueue_script('B2SWYSIWYGLANGDEJS');
|
1215 |
+
} else {
|
1216 |
+
wp_enqueue_script('B2SWYSIWYGLANGENJS');
|
1217 |
+
}
|
1218 |
+
wp_enqueue_script('B2SDATEPICKERJS');
|
1219 |
+
wp_enqueue_script('B2SDATEPICKERDEJS');
|
1220 |
+
wp_enqueue_script('B2SDATEPICKERENJS');
|
1221 |
+
wp_enqueue_script('B2STIMEPICKERJS');
|
1222 |
+
wp_enqueue_script('B2SSHIPJS');
|
1223 |
+
if (current_user_can('upload_files')) {
|
1224 |
+
//Capability by Super Admin ,Administrator ,Editor ,Author
|
1225 |
+
wp_enqueue_media();
|
1226 |
+
}
|
1227 |
+
require_once( B2S_PLUGIN_DIR . 'views/b2s/ship.php');
|
1228 |
+
} else {
|
1229 |
+
require_once( B2S_PLUGIN_DIR . 'views/notice.php');
|
1230 |
+
}
|
1231 |
+
}
|
1232 |
+
|
1233 |
+
//PageFunktion
|
1234 |
+
public function b2sCurationDraft() {
|
1235 |
+
if (B2S_Tools::showNotice() == false) {
|
1236 |
+
wp_enqueue_script('B2SVALIDATEJS');
|
1237 |
+
wp_enqueue_style('B2SCURATIONDRAFTCSS');
|
1238 |
+
wp_enqueue_script('B2SCURATIONDRAFTJS');
|
1239 |
+
require_once( B2S_PLUGIN_DIR . 'views/b2s/curation.draft.php');
|
1240 |
+
} else {
|
1241 |
+
require_once( B2S_PLUGIN_DIR . 'views/notice.php');
|
1242 |
+
}
|
1243 |
+
}
|
1244 |
+
|
1245 |
+
//PageFunktion
|
1246 |
+
public function b2sAutoPost() {
|
1247 |
+
if (B2S_Tools::showNotice() == false) {
|
1248 |
+
wp_enqueue_script('B2SVALIDATEJS');
|
1249 |
+
wp_enqueue_style('B2SAUTOPOSTCSS');
|
1250 |
+
wp_enqueue_script('B2SAUTOPOSTJS');
|
1251 |
+
wp_enqueue_style('B2SBTNTOOGLECSS');
|
1252 |
+
wp_enqueue_script('B2SBTNTOOGLEJS');
|
1253 |
+
wp_enqueue_style('B2SCHOSENCSS');
|
1254 |
+
wp_enqueue_script('B2SCHOSENJS');
|
1255 |
+
require_once( B2S_PLUGIN_DIR . 'views/b2s/autopost.php');
|
1256 |
+
} else {
|
1257 |
+
require_once( B2S_PLUGIN_DIR . 'views/notice.php');
|
1258 |
+
}
|
1259 |
+
}
|
1260 |
+
|
1261 |
+
//PageFunktion
|
1262 |
+
public function b2sRePost() {
|
1263 |
+
if (B2S_Tools::showNotice() == false) {
|
1264 |
+
wp_enqueue_script('B2SVALIDATEJS');
|
1265 |
+
wp_enqueue_style('B2SREPOSTCSS');
|
1266 |
+
wp_enqueue_script('B2SREPOSTJS');
|
1267 |
+
wp_enqueue_style('B2SCHOSENCSS');
|
1268 |
+
wp_enqueue_script('B2SCHOSENJS');
|
1269 |
+
wp_enqueue_style('B2SFULLCALLENDARCSS');
|
1270 |
+
wp_enqueue_style('B2SCALENDARCSS');
|
1271 |
+
wp_enqueue_script('B2SFULLCALENDARMOMENTJS');
|
1272 |
+
wp_enqueue_script('B2SFULLCALENDARJS');
|
1273 |
+
wp_enqueue_script('B2SFULLCALENDARLOCALEJS');
|
1274 |
+
wp_enqueue_script('B2SLIB');
|
1275 |
+
wp_enqueue_style('B2SDATEPICKERCSS');
|
1276 |
+
wp_enqueue_style('B2STIMEPICKERCSS');
|
1277 |
+
wp_enqueue_script('B2SDATEPICKERJS');
|
1278 |
+
wp_enqueue_script('B2SDATEPICKERDEJS');
|
1279 |
+
wp_enqueue_script('B2SDATEPICKERENJS');
|
1280 |
+
wp_enqueue_script('B2STIMEPICKERJS');
|
1281 |
+
wp_enqueue_style('B2SWYSIWYGCSS');
|
1282 |
+
wp_enqueue_script('B2SWYSIWYGJS');
|
1283 |
+
wp_enqueue_script('B2SEMOJIBUTTONJS');
|
1284 |
+
wp_enqueue_script('B2SSHIPJS');
|
1285 |
+
if (substr(B2S_LANGUAGE, 0, 2) == 'de') {
|
1286 |
+
wp_enqueue_script('B2SWYSIWYGLANGDEJS');
|
1287 |
+
} else {
|
1288 |
+
wp_enqueue_script('B2SWYSIWYGLANGENJS');
|
1289 |
+
}
|
1290 |
+
if (current_user_can('upload_files')) {
|
1291 |
+
//Capability by Super Admin ,Administrator ,Editor ,Author
|
1292 |
+
wp_enqueue_media();
|
1293 |
+
}
|
1294 |
+
require_once( B2S_PLUGIN_DIR . 'views/b2s/repost.php');
|
1295 |
+
} else {
|
1296 |
+
require_once( B2S_PLUGIN_DIR . 'views/notice.php');
|
1297 |
+
}
|
1298 |
+
}
|
1299 |
+
|
1300 |
+
//PageFunktion
|
1301 |
+
public function prgLogin() {
|
1302 |
+
wp_enqueue_script('B2SVALIDATEJS');
|
1303 |
+
if (B2S_Tools::showNotice() == false) {
|
1304 |
+
$prgInfo = get_option('B2S_PLUGIN_PRG_' . B2S_PLUGIN_BLOG_USER_ID);
|
1305 |
+
if ($prgInfo != false && isset($prgInfo['B2S_PRG_ID']) && (int) $prgInfo['B2S_PRG_ID'] > 0 && isset($prgInfo['B2S_PRG_TOKEN']) && !empty($prgInfo['B2S_PRG_TOKEN'])) {
|
1306 |
+
$postId = (int) $_GET['postId'];
|
1307 |
+
echo'<script> window.location="' . admin_url('/admin.php?page=prg-ship&postId=' . $postId, 'http') . '"; </script> ';
|
1308 |
+
wp_die();
|
1309 |
+
} else {
|
1310 |
+
wp_enqueue_style('PRGLOGINCSS');
|
1311 |
+
wp_enqueue_script('PRGLOGINJS');
|
1312 |
+
require_once( B2S_PLUGIN_DIR . 'views/prg/login.php');
|
1313 |
+
}
|
1314 |
+
} else {
|
1315 |
+
require_once( B2S_PLUGIN_DIR . 'views/notice.php');
|
1316 |
+
}
|
1317 |
+
}
|
1318 |
+
|
1319 |
+
//PageFunktion
|
1320 |
+
public function prgShip() {
|
1321 |
+
if (B2S_Tools::showNotice() == false) {
|
1322 |
+
wp_enqueue_script('B2SVALIDATEJS');
|
1323 |
+
wp_enqueue_style('PRGSHIPCSS');
|
1324 |
+
wp_enqueue_script('PRGSHIPJS');
|
1325 |
+
wp_enqueue_script('PRGGENERALJS');
|
1326 |
+
require_once( B2S_PLUGIN_DIR . 'views/prg/ship.php');
|
1327 |
+
} else {
|
1328 |
+
require_once( B2S_PLUGIN_DIR . 'views/notice.php');
|
1329 |
+
}
|
1330 |
+
}
|
1331 |
+
|
1332 |
+
//PageFunktion
|
1333 |
+
public function b2sPostSched() {
|
1334 |
+
if (B2S_Tools::showNotice() == false) {
|
1335 |
+
wp_enqueue_script('B2SVALIDATEJS');
|
1336 |
+
wp_enqueue_script('B2SLIB');
|
1337 |
+
wp_enqueue_style('B2SPOSTSCHEDCSS');
|
1338 |
+
wp_enqueue_style('B2SDATEPICKERCSS');
|
1339 |
+
wp_enqueue_style('B2STIMEPICKERCSS');
|
1340 |
+
wp_enqueue_script('B2SDATEPICKERJS');
|
1341 |
+
wp_enqueue_script('B2SDATEPICKERDEJS');
|
1342 |
+
wp_enqueue_script('B2SDATEPICKERENJS');
|
1343 |
+
wp_enqueue_script('B2STIMEPICKERJS');
|
1344 |
+
wp_enqueue_script('B2SPOSTJS');
|
1345 |
+
wp_enqueue_style('B2SWYSIWYGCSS');
|
1346 |
+
wp_enqueue_script('B2SWYSIWYGJS');
|
1347 |
+
wp_enqueue_script('B2SEMOJIBUTTONJS');
|
1348 |
+
wp_enqueue_script('B2SSHIPJS');
|
1349 |
+
if (substr(B2S_LANGUAGE, 0, 2) == 'de') {
|
1350 |
+
wp_enqueue_script('B2SWYSIWYGLANGDEJS');
|
1351 |
+
} else {
|
1352 |
+
wp_enqueue_script('B2SWYSIWYGLANGENJS');
|
1353 |
+
}
|
1354 |
+
if (current_user_can('upload_files')) {
|
1355 |
+
//Capability by Super Admin ,Administrator ,Editor ,Author
|
1356 |
+
wp_enqueue_media();
|
1357 |
+
}
|
1358 |
+
require_once( B2S_PLUGIN_DIR . 'views/b2s/post.sched.php');
|
1359 |
+
} else {
|
1360 |
+
require_once( B2S_PLUGIN_DIR . 'views/notice.php');
|
1361 |
+
}
|
1362 |
+
}
|
1363 |
+
|
1364 |
+
//PageFunktion
|
1365 |
+
public function b2sPostApprove() {
|
1366 |
+
if (B2S_Tools::showNotice() == false) {
|
1367 |
+
wp_enqueue_script('B2SVALIDATEJS');
|
1368 |
+
wp_enqueue_style('B2SPOSTAPPROVECSS');
|
1369 |
+
wp_enqueue_script('B2SPOSTJS');
|
1370 |
+
require_once( B2S_PLUGIN_DIR . 'views/b2s/post.approve.php');
|
1371 |
+
} else {
|
1372 |
+
require_once( B2S_PLUGIN_DIR . 'views/notice.php');
|
1373 |
+
}
|
1374 |
+
}
|
1375 |
+
|
1376 |
+
//PageFunktion
|
1377 |
+
public function b2sPostDraft() {
|
1378 |
+
if (B2S_Tools::showNotice() == false) {
|
1379 |
+
wp_enqueue_script('B2SVALIDATEJS');
|
1380 |
+
wp_enqueue_style('B2SPOSTDRAFTCSS');
|
1381 |
+
wp_enqueue_style('B2SDATEPICKERCSS');
|
1382 |
+
wp_enqueue_script('B2SDATEPICKERJS');
|
1383 |
+
wp_enqueue_script('B2SDATEPICKERDEJS');
|
1384 |
+
wp_enqueue_script('B2SDATEPICKERENJS');
|
1385 |
+
wp_enqueue_script('B2SPOSTJS');
|
1386 |
+
require_once( B2S_PLUGIN_DIR . 'views/b2s/post.draft.php');
|
1387 |
+
} else {
|
1388 |
+
require_once( B2S_PLUGIN_DIR . 'views/notice.php');
|
1389 |
+
}
|
1390 |
+
}
|
1391 |
+
|
1392 |
+
//PageFunktion
|
1393 |
+
public function b2sPostFavorites() {
|
1394 |
+
if (B2S_Tools::showNotice() == false) {
|
1395 |
+
wp_enqueue_script('B2SVALIDATEJS');
|
1396 |
+
wp_enqueue_style('B2SPOSTCSS');
|
1397 |
+
wp_enqueue_script('B2SPOSTJS');
|
1398 |
+
require_once( B2S_PLUGIN_DIR . 'views/b2s/post.favorites.php');
|
1399 |
+
} else {
|
1400 |
+
require_once( B2S_PLUGIN_DIR . 'views/notice.php');
|
1401 |
+
}
|
1402 |
+
}
|
1403 |
+
|
1404 |
+
//PageFunktion
|
1405 |
+
public function b2sPostCalendar() {
|
1406 |
+
if (B2S_Tools::showNotice() == false) {
|
1407 |
+
wp_enqueue_script('B2SVALIDATEJS');
|
1408 |
+
wp_enqueue_script('B2SLIB');
|
1409 |
+
wp_enqueue_style('B2SFULLCALLENDARCSS');
|
1410 |
+
wp_enqueue_style('B2SCALENDARCSS');
|
1411 |
+
wp_enqueue_style('B2SDATEPICKERCSS');
|
1412 |
+
wp_enqueue_style('B2STIMEPICKERCSS');
|
1413 |
+
wp_enqueue_script('B2SDATEPICKERJS');
|
1414 |
+
wp_enqueue_script('B2SDATEPICKERDEJS');
|
1415 |
+
wp_enqueue_script('B2SDATEPICKERENJS');
|
1416 |
+
wp_enqueue_script('B2STIMEPICKERJS');
|
1417 |
+
wp_enqueue_script('B2SCALENDARJS');
|
1418 |
+
wp_enqueue_script('B2SFULLCALENDARMOMENTJS');
|
1419 |
+
wp_enqueue_script('B2SFULLCALENDARJS');
|
1420 |
+
wp_enqueue_script('B2SFULLCALENDARLOCALEJS');
|
1421 |
+
wp_enqueue_style('B2SWYSIWYGCSS');
|
1422 |
+
wp_enqueue_script('B2SWYSIWYGJS');
|
1423 |
+
wp_enqueue_script('B2SEMOJIBUTTONJS');
|
1424 |
+
wp_enqueue_script('B2SSHIPJS');
|
1425 |
+
if (substr(B2S_LANGUAGE, 0, 2) == 'de') {
|
1426 |
+
wp_enqueue_script('B2SWYSIWYGLANGDEJS');
|
1427 |
+
} else {
|
1428 |
+
wp_enqueue_script('B2SWYSIWYGLANGENJS');
|
1429 |
+
}
|
1430 |
+
|
1431 |
+
if (current_user_can('upload_files')) {
|
1432 |
+
//Capability by Super Admin ,Administrator ,Editor ,Author
|
1433 |
+
wp_enqueue_media();
|
1434 |
+
}
|
1435 |
+
require_once( B2S_PLUGIN_DIR . 'views/b2s/post.calendar.php');
|
1436 |
+
} else {
|
1437 |
+
require_once( B2S_PLUGIN_DIR . 'views/notice.php');
|
1438 |
+
}
|
1439 |
+
}
|
1440 |
+
|
1441 |
+
//PageFunktion
|
1442 |
+
public function b2sSupport() {
|
1443 |
+
wp_enqueue_script('B2SVALIDATEJS');
|
1444 |
+
wp_enqueue_style('B2SSUPPORT');
|
1445 |
+
wp_enqueue_script('B2SSUPPORTJS');
|
1446 |
+
require_once( B2S_PLUGIN_DIR . 'views/b2s/support.php');
|
1447 |
+
}
|
1448 |
+
|
1449 |
+
//PageFunktion
|
1450 |
+
public function b2sPremium() {
|
1451 |
+
wp_enqueue_script('B2SVALIDATEJS');
|
1452 |
+
wp_enqueue_style('B2SPREMIUM');
|
1453 |
+
wp_enqueue_style('B2SCHOSENCSS');
|
1454 |
+
wp_enqueue_script('B2SCHOSENJS');
|
1455 |
+
wp_enqueue_script('B2SPREMIUMJS');
|
1456 |
+
require_once( B2S_PLUGIN_DIR . 'views/b2s/premium.php');
|
1457 |
+
}
|
1458 |
+
|
1459 |
+
//PageFunktion
|
1460 |
+
public function b2sPostPublish() {
|
1461 |
+
if (B2S_Tools::showNotice() == false) {
|
1462 |
+
wp_enqueue_script('B2SVALIDATEJS');
|
1463 |
+
wp_enqueue_style('B2SPOSTPUBLISHCSS');
|
1464 |
+
wp_enqueue_script('B2SPOSTJS');
|
1465 |
+
wp_enqueue_script('PRGGENERALJS');
|
1466 |
+
require_once( B2S_PLUGIN_DIR . 'views/b2s/post.publish.php');
|
1467 |
+
} else {
|
1468 |
+
require_once( B2S_PLUGIN_DIR . 'views/notice.php');
|
1469 |
+
}
|
1470 |
+
}
|
1471 |
+
|
1472 |
+
//PageFunktion
|
1473 |
+
public function b2sPostNotice() {
|
1474 |
+
if (B2S_Tools::showNotice() == false) {
|
1475 |
+
wp_enqueue_script('B2SVALIDATEJS');
|
1476 |
+
wp_enqueue_style('B2SPOSTNOTICECSS');
|
1477 |
+
wp_enqueue_script('B2SPOSTJS');
|
1478 |
+
wp_enqueue_script('PRGGENERALJS');
|
1479 |
+
require_once( B2S_PLUGIN_DIR . 'views/b2s/post.notice.php');
|
1480 |
+
} else {
|
1481 |
+
require_once( B2S_PLUGIN_DIR . 'views/notice.php');
|
1482 |
+
}
|
1483 |
+
}
|
1484 |
+
|
1485 |
+
//PageFunktion
|
1486 |
+
public function prgPost() {
|
1487 |
+
if (B2S_Tools::showNotice() == false) {
|
1488 |
+
wp_enqueue_script('B2SVALIDATEJS');
|
1489 |
+
wp_enqueue_style('PRGPOSTCSS');
|
1490 |
+
wp_enqueue_script('PRGPOSTJS');
|
1491 |
+
wp_enqueue_script('PRGGENERALJS');
|
1492 |
+
require_once( B2S_PLUGIN_DIR . 'views/prg/post.php');
|
1493 |
+
} else {
|
1494 |
+
require_once( B2S_PLUGIN_DIR . 'views/notice.php');
|
1495 |
+
}
|
1496 |
+
}
|
1497 |
+
|
1498 |
+
public function addBootAssets($hook) {
|
1499 |
+
if ($hook == 'edit.php') {
|
1500 |
+
wp_enqueue_script('B2SPOSTSCHEDHEARTBEATJS');
|
1501 |
+
}
|
1502 |
+
|
1503 |
+
if ($hook == 'plugins.php') {
|
1504 |
+
wp_enqueue_script('B2SPLUGINDEACTIVATEJS');
|
1505 |
+
wp_enqueue_style('B2SPLUGINDEACTIVATECSS');
|
1506 |
+
}
|
1507 |
+
}
|
1508 |
+
|
1509 |
+
public function addAssets() {
|
1510 |
+
wp_enqueue_style('B2SBOOTCSS');
|
1511 |
+
wp_enqueue_script('B2SBOOTJS');
|
1512 |
+
wp_enqueue_script('B2SGENERALJS');
|
1513 |
+
}
|
1514 |
+
|
1515 |
+
public function registerAssets() {
|
1516 |
+
wp_register_style('B2SBOOTCSS', plugins_url('assets/css/general.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1517 |
+
wp_register_style('B2SSTARTCSS', plugins_url('assets/css/b2s/start.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1518 |
+
wp_register_style('B2SPOSTCSS', plugins_url('assets/css/b2s/post.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1519 |
+
wp_register_style('B2SSHIPCSS', plugins_url('assets/css/b2s/ship.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1520 |
+
wp_register_style('B2SCURATIONCSS', plugins_url('assets/css/b2s/curation.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1521 |
+
|
1522 |
+
wp_register_style('B2SPOSTSCHEDCSS', plugins_url('assets/css/b2s/post.sched.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1523 |
+
wp_register_style('B2SPOSTDRAFTCSS', plugins_url('assets/css/b2s/post.draft.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1524 |
+
wp_register_style('B2SPOSTAPPROVECSS', plugins_url('assets/css/b2s/post.approve.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1525 |
+
wp_register_style('B2SPOSTPUBLISHCSS', plugins_url('assets/css/b2s/post.publish.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1526 |
+
wp_register_style('B2SPOSTNOTICECSS', plugins_url('assets/css/b2s/post.notice.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1527 |
+
wp_register_style('B2SNETWORKCSS', plugins_url('assets/css/b2s/network.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1528 |
+
wp_register_style('B2SSUPPORT', plugins_url('assets/css/b2s/support.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1529 |
+
wp_register_style('B2SPREMIUM', plugins_url('assets/css/b2s/premium.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1530 |
+
wp_register_style('B2SSETTINGSCSS', plugins_url('assets/css/b2s/settings.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1531 |
+
wp_register_style('PRGSHIPCSS', plugins_url('assets/css/prg/ship.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1532 |
+
wp_register_style('PRGLOGINCSS', plugins_url('assets/css/prg/login.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1533 |
+
wp_register_style('B2SDATEPICKERCSS', plugins_url('assets/lib/datepicker/css/bootstrap-datepicker3.min.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1534 |
+
wp_register_style('B2SAIRDATEPICKERCSS', plugins_url('assets/lib/air-datepicker/css/datepicker.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1535 |
+
wp_register_style('B2STIMEPICKERCSS', plugins_url('assets/lib/timepicker/timepicker.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1536 |
+
wp_register_style('PRGPOSTCSS', plugins_url('assets/css/prg/post.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1537 |
+
wp_register_style('B2SWYSIWYGCSS', plugins_url('assets/lib/wysiwyg/square.min.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1538 |
+
wp_register_style('B2SPOSTBOXCSS', plugins_url('assets/css/b2s/wp/post-box.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1539 |
+
wp_register_style('B2SNOTICECSS', plugins_url('assets/css/notice.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1540 |
+
wp_register_style('B2SFULLCALLENDARCSS', plugins_url('assets/lib/fullcalendar/fullcalendar.min.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1541 |
+
wp_register_style('B2SCALENDARCSS', plugins_url('assets/css/b2s/calendar.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1542 |
+
wp_register_style('B2SBTNTOOGLECSS', plugins_url('assets/lib/btn-toogle/bootstrap-toggle.min.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1543 |
+
wp_register_style('B2SCHOSENCSS', plugins_url('assets/lib/chosen/chosen.min.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1544 |
+
wp_register_style('B2SPLUGINDEACTIVATECSS', plugins_url('assets/css/b2s/wp/plugin-deactivate.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1545 |
+
wp_register_style('B2SCURATIONDRAFTCSS', plugins_url('assets/css/b2s/curation.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1546 |
+
wp_register_style('B2SAUTOPOSTCSS', plugins_url('assets/css/b2s/autopost.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1547 |
+
wp_register_style('B2SREPOSTCSS', plugins_url('assets/css/b2s/repost.css', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1548 |
+
|
1549 |
+
wp_register_script('B2SNETWORKJS', plugins_url('assets/js/b2s/network.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1550 |
+
wp_register_script('B2SSETTINGSJS', plugins_url('assets/js/b2s/settings.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1551 |
+
wp_register_script('B2SAUTOPOSTJS', plugins_url('assets/js/b2s/autopost.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1552 |
+
wp_register_script('B2SREPOSTJS', plugins_url('assets/js/b2s/repost.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1553 |
+
wp_register_script('B2SSTARTJS', plugins_url('assets/js/b2s/start.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1554 |
+
wp_register_script('B2SPOSTJS', plugins_url('assets/js/b2s/post.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1555 |
+
wp_register_script('B2SSHIPJS', plugins_url('assets/js/b2s/ship.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1556 |
+
wp_register_script('B2SCURATIONJS', plugins_url('assets/js/b2s/curation.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1557 |
+
wp_register_script('PRGSHIPJS', plugins_url('assets/js/prg/ship.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1558 |
+
wp_register_script('PRGLOGINJS', plugins_url('assets/js/prg/login.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1559 |
+
wp_register_script('B2SBOOTJS', plugins_url('assets/js/general.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1560 |
+
wp_register_script('B2SVALIDATEJS', plugins_url('assets/js/validate.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1561 |
+
|
1562 |
+
wp_register_script('B2SSUPPORTJS', plugins_url('assets/js/b2s/support.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1563 |
+
wp_register_script('B2SGENERALJS', plugins_url('assets/js/b2s/general.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1564 |
+
wp_register_script('B2SDATEPICKERJS', plugins_url('assets/lib/datepicker/js/bootstrap-datepicker.min.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1565 |
+
wp_register_script('B2SDATEPICKERDEJS', plugins_url('assets/lib/datepicker/locales/bootstrap-datepicker.de_DE.min.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1566 |
+
wp_register_script('B2SDATEPICKERENJS', plugins_url('assets/lib/datepicker/locales/bootstrap-datepicker.en_US.min.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1567 |
+
wp_register_script('B2SAIRDATEPICKERJS', plugins_url('assets/lib/air-datepicker/js/datepicker.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1568 |
+
wp_register_script('B2SAIRDATEPICKERDEJS', plugins_url('assets/lib/air-datepicker/js/locales/datepicker.de.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1569 |
+
wp_register_script('B2SAIRDATEPICKERENJS', plugins_url('assets/lib/air-datepicker/js/locales/datepicker.en.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1570 |
+
wp_register_script('B2SCHARTJS', plugins_url('assets/lib/chartjs/Chart.bundle.min.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1571 |
+
wp_register_script('B2SMOMENT', plugins_url('assets/lib/moment/moment-with-locales.min.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1572 |
+
wp_register_script('B2STIMEPICKERJS', plugins_url('assets/lib/timepicker/timepicker.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1573 |
+
wp_register_script('PRGPOSTJS', plugins_url('assets/js/prg/post.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1574 |
+
wp_register_script('PRGGENERALJS', plugins_url('assets/js/prg/general.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1575 |
+
wp_register_script('B2SWYSIWYGJS', plugins_url('assets/lib/wysiwyg/jquery.sceditor.xhtml.min.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1576 |
+
wp_register_script('B2SWYSIWYGLANGDEJS', plugins_url('assets/lib/wysiwyg/languages/de.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1577 |
+
wp_register_script('B2SWYSIWYGLANGENJS', plugins_url('assets/lib/wysiwyg/languages/en.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1578 |
+
wp_register_script('B2SPOSTBOXJS', plugins_url('assets/js/b2s/wp/post-box.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1579 |
+
wp_register_script('B2SPOSTSCHEDHEARTBEATJS', plugins_url('assets/js/b2s/wp/post-sched-heartbeat.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1580 |
+
wp_register_script('B2SCALENDARJS', plugins_url('assets/js/b2s/calendar.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1581 |
+
wp_register_script('B2SFULLCALENDARMOMENTJS', plugins_url('assets/lib/fullcalendar/lib/moment.min.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1582 |
+
wp_register_script('B2SFULLCALENDARJS', plugins_url('assets/lib/fullcalendar/fullcalendar.min.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1583 |
+
wp_register_script('B2SFULLCALENDARLOCALEJS', plugins_url('assets/lib/fullcalendar/locale-all.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1584 |
+
wp_register_script('B2SBTNTOOGLEJS', plugins_url('assets/lib/btn-toogle/bootstrap-toggle.min.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1585 |
+
wp_register_script('B2SCHOSENJS', plugins_url('assets/lib/chosen/chosen.jquery.min.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1586 |
+
wp_register_script('B2SLIB', plugins_url('assets/js/b2s/lib.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1587 |
+
wp_register_script('B2SPLUGINDEACTIVATEJS', plugins_url('assets/js/b2s/wp/plugin-deactivate.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1588 |
+
wp_register_script('B2SCURATIONDRAFTJS', plugins_url('assets/js/b2s/curation.draft.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1589 |
+
wp_register_script('B2SPREMIUMJS', plugins_url('assets/js/b2s/premium.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1590 |
+
wp_register_script('B2SEMOJIBUTTONJS', plugins_url('assets/lib/emoji-button/emoji-button.min.js', B2S_PLUGIN_FILE), array(), B2S_PLUGIN_VERSION);
|
1591 |
+
}
|
1592 |
+
|
1593 |
+
public function initCaps() {
|
1594 |
+
global $wp_roles;
|
1595 |
+
if (!class_exists('WP_Roles')) {
|
1596 |
+
wp_die(esc_html__('Blog2Social needs Wordpress Version 4.7.0 or higher.', 'blog2social') . ' ' . sprintf(__('<a href="%s" target="_blank">Please find more Information and help in our FAQ</a>', 'blog2social'), esc_url(B2S_Tools::getSupportLink('system'))) . ' ' . esc_html__('or', 'blog2social') . ' <a href="' . esc_url(admin_url("/plugins.php", "http")) . '/">' . esc_html__('back to install plugins', 'blog2social') . '</a>');
|
1597 |
+
}
|
1598 |
+
if (!isset($wp_roles)) {
|
1599 |
+
$wp_roles = new WP_Roles(); // @codingStandardsIgnoreLine
|
1600 |
+
}
|
1601 |
+
if (!function_exists('get_editable_roles')) {
|
1602 |
+
require_once ABSPATH . 'wp-admin/includes/user.php';
|
1603 |
+
}
|
1604 |
+
foreach (get_editable_roles() as $role_name => $role_info) {
|
1605 |
+
$wp_roles->add_cap($role_name, 'blog2social_access');
|
1606 |
+
}
|
1607 |
+
}
|
1608 |
+
|
1609 |
+
public function activatePlugin() {
|
1610 |
+
require_once(B2S_PLUGIN_DIR . 'includes/Tools.php');
|
1611 |
+
require_once (B2S_PLUGIN_DIR . 'includes/System.php');
|
1612 |
+
require_once(B2S_PLUGIN_DIR . 'includes/Options.php');
|
1613 |
+
$b2sSystem = new B2S_System();
|
1614 |
+
$b2sCheckBefore = $b2sSystem->check('before');
|
1615 |
+
if (is_array($b2sCheckBefore)) {
|
1616 |
+
$b2sSystem->deactivatePlugin();
|
1617 |
+
wp_die($b2sSystem->getErrorMessage($b2sCheckBefore) . ' ' . esc_html__('or', 'blog2social') . ' <a href="' . esc_url(admin_url("/plugins.php", "http")) . '/">' . esc_html__('back to install plugins', 'blog2social') . '</a>');
|
1618 |
+
}
|
1619 |
+
|
1620 |
+
global $wpdb;
|
1621 |
+
$mySqlPermission = true;
|
1622 |
+
/*
|
1623 |
+
* Change Table Names with Prefix
|
1624 |
+
*/
|
1625 |
+
if ($wpdb->base_prefix != 'b2s_' && $wpdb->prefix != 'b2s_') {
|
1626 |
+
$oldTables = $wpdb->get_results('SHOW TABLES LIKE "b2s_%%"');
|
1627 |
+
foreach ($oldTables as $v => $table) {
|
1628 |
+
$tableVars = array_values(get_object_vars($table));
|
1629 |
+
if (isset($tableVars[0]) && !empty($tableVars[0])) {
|
1630 |
+
$wpdb->query("ALTER TABLE `{$tableVars[0]}` RENAME `{$wpdb->base_prefix}{$tableVars[0]}`;");
|
1631 |
+
}
|
1632 |
+
}
|
1633 |
+
}
|
1634 |
+
|
1635 |
+
$sqlCreateUser = "CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}b2s_user` (
|
1636 |
+
`id` int(11) NOT NULL AUTO_INCREMENT,
|
1637 |
+
`token` varchar(255) NOT NULL,
|
1638 |
+
`blog_user_id` int(11) NOT NULL,
|
1639 |
+
`feature` TINYINT(2) NOT NULL,
|
1640 |
+
`state_url` TINYINT(2) NOT NULL,
|
1641 |
+
`register_date` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
|
1642 |
+
PRIMARY KEY (`id`), INDEX `blog_user_id` (`blog_user_id`), INDEX `token` (`token`), INDEX `feature` (`feature`)
|
1643 |
+
) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci AUTO_INCREMENT=1;";
|
1644 |
+
$wpdb->query($sqlCreateUser);
|
1645 |
+
|
1646 |
+
$b2sUserCols = $wpdb->get_results('SHOW COLUMNS FROM ' . $wpdb->prefix . 'b2s_user');
|
1647 |
+
if (is_array($b2sUserCols) && isset($b2sUserCols[0])) {
|
1648 |
+
$b2sUserColsData = array();
|
1649 |
+
foreach ($b2sUserCols as $key => $value) {
|
1650 |
+
if (isset($value->Field) && !empty($value->Field)) {
|
1651 |
+
$b2sUserColsData[] = $value->Field;
|
1652 |
+
}
|
1653 |
+
}
|
1654 |
+
if (!in_array("register_date", $b2sUserColsData)) {
|
1655 |
+
$wpdb->query("ALTER TABLE {$wpdb->prefix}b2s_user ADD register_date DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00'");
|
1656 |
+
}
|
1657 |
+
if (!in_array("state_url", $b2sUserColsData)) {
|
1658 |
+
$wpdb->query("ALTER TABLE {$wpdb->prefix}b2s_user ADD state_url TINYINT(2) NOT NULL DEFAULT '1'");
|
1659 |
+
}
|
1660 |
+
}
|
1661 |
+
|
1662 |
+
//Notice Rating - stop rating remember again
|
1663 |
+
//$wpdb->query('UPDATE `b2s_user` SET `feature` = 0');
|
1664 |
+
|
1665 |
+
$keys = $wpdb->get_results('SHOW INDEX FROM `' . $wpdb->prefix . 'b2s_user`');
|
1666 |
+
$allowIndexUser = array('PRIMARY', 'blog_user_id', 'token', 'feature');
|
1667 |
+
foreach ($keys as $k => $value) {
|
1668 |
+
if (!in_array($value->Key_name, $allowIndexUser)) {
|
1669 |
+
$wpdb->query('ALTER TABLE `' . $wpdb->prefix . 'b2s_user` DROP INDEX ' . $value->Key_name);
|
1670 |
+
}
|
1671 |
+
}
|
1672 |
+
|
1673 |
+
$sqlCreateUserPosts = "CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}b2s_posts` (
|
1674 |
+
`id` int(11) NOT NULL AUTO_INCREMENT,
|
1675 |
+
`post_id` int(11) NOT NULL,
|
1676 |
+
`blog_user_id` int(11) NOT NULL,
|
1677 |
+
`last_edit_blog_user_id` int(11) NOT NULL,
|
1678 |
+
`user_timezone` TINYINT NOT NULL DEFAULT '0',
|
1679 |
+
`sched_details_id` INT NOT NULL,
|
1680 |
+
`sched_type` TINYINT NOT NULL DEFAULT '0',
|
1681 |
+
`sched_date` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
|
1682 |
+
`sched_date_utc` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
|
1683 |
+
`publish_date` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
|
1684 |
+
`publish_link` varchar(255) NOT NULL,
|
1685 |
+
`publish_error_code` varchar(100) NOT NULL,
|
1686 |
+
`network_details_id` int(11) NOT NULL,
|
1687 |
+
`post_for_relay` TINYINT NOT NULL DEFAULT '0',
|
1688 |
+
`post_for_approve` TINYINT NOT NULL DEFAULT '0',
|
1689 |
+
`relay_primary_post_id` int(11) NOT NULL DEFAULT '0',
|
1690 |
+
`relay_delay_min` int(11) NOT NULL DEFAULT '0',
|
1691 |
+
`hook_action` TINYINT NOT NULL DEFAULT '0',
|
1692 |
+
`hide` TINYINT NOT NULL DEFAULT '0',
|
1693 |
+
`v2_id` int(11) NOT NULL DEFAULT '0',
|
1694 |
+
`post_format` int(11) DEFAULT NULL,
|
1695 |
+
PRIMARY KEY (`id`), INDEX `post_id` (`post_id`), INDEX `blog_user_id` (`blog_user_id`) , INDEX `sched_details_id` (`sched_details_id`),
|
1696 |
+
INDEX `sched_date` (`sched_date`), INDEX `sched_date_utc` (`sched_date_utc`), INDEX `publish_date` (`publish_date`) , INDEX `relay_primary_post_id` (`relay_primary_post_id`) ,
|
1697 |
+
INDEX `hook_action` (`hook_action`), INDEX `hide` (`hide`)
|
1698 |
+
) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci AUTO_INCREMENT=1 ;";
|
1699 |
+
$wpdb->query($sqlCreateUserPosts);
|
1700 |
+
|
1701 |
+
//since V4.8.0
|
1702 |
+
$b2sPostsCols = $wpdb->get_results('SHOW COLUMNS FROM ' . $wpdb->prefix . 'b2s_posts');
|
1703 |
+
if (is_array($b2sPostsCols) && isset($b2sPostsCols[0])) {
|
1704 |
+
$b2sPostsColsData = array();
|
1705 |
+
foreach ($b2sPostsCols as $key => $value) {
|
1706 |
+
if (isset($value->Field) && !empty($value->Field)) {
|
1707 |
+
$b2sPostsColsData[] = $value->Field;
|
1708 |
+
}
|
1709 |
+
}
|
1710 |
+
if (!in_array("last_edit_blog_user_id", $b2sPostsColsData)) {
|
1711 |
+
$wpdb->query("ALTER TABLE {$wpdb->prefix}b2s_posts ADD last_edit_blog_user_id INT NOT NULL DEFAULT '0'");
|
1712 |
+
}
|
1713 |
+
if (!in_array("post_for_relay", $b2sPostsColsData)) {
|
1714 |
+
$wpdb->query("ALTER TABLE {$wpdb->prefix}b2s_posts ADD post_for_relay TINYINT NOT NULL DEFAULT '0'");
|
1715 |
+
}
|
1716 |
+
if (!in_array("post_for_approve", $b2sPostsColsData)) {
|
1717 |
+
$wpdb->query("ALTER TABLE {$wpdb->prefix}b2s_posts ADD post_for_approve TINYINT NOT NULL DEFAULT '0'");
|
1718 |
+
}
|
1719 |
+
if (!in_array("relay_primary_post_id", $b2sPostsColsData)) {
|
1720 |
+
$wpdb->query("ALTER TABLE {$wpdb->prefix}b2s_posts ADD relay_primary_post_id int(11) NOT NULL DEFAULT '0'");
|
1721 |
+
$wpdb->query('ALTER TABLE `' . $wpdb->prefix . 'b2s_posts` ADD INDEX(`relay_primary_post_id`)');
|
1722 |
+
}
|
1723 |
+
if (!in_array("relay_delay_min", $b2sPostsColsData)) {
|
1724 |
+
$wpdb->query("ALTER TABLE {$wpdb->prefix}b2s_posts ADD relay_delay_min int(11) NOT NULL DEFAULT '0'");
|
1725 |
+
}
|
1726 |
+
if (!in_array("post_format", $b2sPostsColsData)) {
|
1727 |
+
$wpdb->query("ALTER TABLE {$wpdb->prefix}b2s_posts ADD post_format int(11) DEFAULT NULL");
|
1728 |
+
}
|
1729 |
+
}
|
1730 |
+
|
1731 |
+
$keys = $wpdb->get_results('SHOW INDEX FROM `' . $wpdb->prefix . 'b2s_posts`');
|
1732 |
+
$allowIndexPosts = array('PRIMARY', 'post_id', 'blog_user_id', 'sched_details_id', 'sched_date', 'sched_date_utc', 'publish_date', 'relay_primary_post_id', 'hook_action', 'hide');
|
1733 |
+
foreach ($keys as $k => $value) {
|
1734 |
+
if (!in_array($value->Key_name, $allowIndexPosts)) {
|
1735 |
+
$wpdb->query('ALTER TABLE `' . $wpdb->prefix . 'b2s_posts` DROP INDEX ' . $value->Key_name);
|
1736 |
+
}
|
1737 |
+
}
|
1738 |
+
|
1739 |
+
//Change Collation >=V4.0 Emoji
|
1740 |
+
$existsTable = $wpdb->get_results('SHOW TABLES LIKE "' . $wpdb->prefix . 'b2s_posts_sched_details"');
|
1741 |
+
if (is_array($existsTable) && !empty($existsTable)) {
|
1742 |
+
$wpdb->query('ALTER TABLE `' . $wpdb->prefix . 'b2s_posts_sched_details` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;');
|
1743 |
+
$wpdb->query('ALTER TABLE `' . $wpdb->prefix . 'b2s_posts_sched_details` CHANGE sched_data sched_data TEXT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;');
|
1744 |
+
$wpdb->query('REPAIR TABLE `' . $wpdb->prefix . 'b2s_posts_sched_details`');
|
1745 |
+
$wpdb->query('OPTIMIZE TABLE `' . $wpdb->prefix . 'b2s_posts_sched_details`');
|
1746 |
+
} else {
|
1747 |
+
$sqlCreateUserSchedDetails = "CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}b2s_posts_sched_details` (
|
1748 |
+
`id` int(11) NOT NULL AUTO_INCREMENT,
|
1749 |
+
`sched_data` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
|
1750 |
+
`image_url` varchar(255) NOT NULL,
|
1751 |
+
PRIMARY KEY (`id`)
|
1752 |
+
) DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci AUTO_INCREMENT=1 ;";
|
1753 |
+
$wpdb->query($sqlCreateUserSchedDetails);
|
1754 |
+
}
|
1755 |
+
|
1756 |
+
$sqlCreateUserNetworkDetails = "CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}b2s_posts_network_details` (
|
1757 |
+
`id` int(11) NOT NULL AUTO_INCREMENT,
|
1758 |
+
`network_id` TINYINT NOT NULL,
|
1759 |
+
`network_type` TINYINT NOT NULL,
|
1760 |
+
`network_auth_id` int(11) NOT NULL,
|
1761 |
+
`network_display_name` varchar(100) NOT NULL,
|
1762 |
+
`data` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci,
|
1763 |
+
PRIMARY KEY (`id`)
|
1764 |
+
) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci AUTO_INCREMENT=1 ;";
|
1765 |
+
$wpdb->query($sqlCreateUserNetworkDetails);
|
1766 |
+
|
1767 |
+
//since 6.1.0 add settings
|
1768 |
+
$b2sNetworkDetailsCols = $wpdb->get_results('SHOW COLUMNS FROM ' . $wpdb->prefix . 'b2s_posts_network_details');
|
1769 |
+
if (is_array($b2sNetworkDetailsCols) && isset($b2sNetworkDetailsCols[0])) {
|
1770 |
+
$b2sNetworkDetailsColsData = array();
|
1771 |
+
foreach ($b2sNetworkDetailsCols as $key => $value) {
|
1772 |
+
if (isset($value->Field) && !empty($value->Field)) {
|
1773 |
+
$b2sNetworkDetailsColsData[] = $value->Field;
|
1774 |
+
}
|
1775 |
+
}
|
1776 |
+
if (!in_array("data", $b2sNetworkDetailsColsData)) {
|
1777 |
+
$wpdb->query("ALTER TABLE {$wpdb->prefix}b2s_posts_network_details ADD data text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci");
|
1778 |
+
}
|
1779 |
+
}
|
1780 |
+
|
1781 |
+
$sqlCreateUserContact = "CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}b2s_user_contact`(
|
1782 |
+
`id` int(5) NOT NULL AUTO_INCREMENT ,
|
1783 |
+
`blog_user_id` int(11) NOT NULL ,
|
1784 |
+
`name_mandant` varchar(100) NOT NULL ,
|
1785 |
+
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
|
1786 |
+
`name_presse` varchar(100) NOT NULL ,
|
1787 |
+
`anrede_presse` enum('0','1','2') NOT NULL DEFAULT '0' COMMENT '0=Frau,1=Herr 2=keine Angabe',
|
1788 |
+
`vorname_presse` varchar(50) NOT NULL ,
|
1789 |
+
`nachname_presse` varchar(50) NOT NULL ,
|
1790 |
+
`strasse_presse` varchar(100) NOT NULL ,
|
1791 |
+
`nummer_presse` varchar(5) NOT NULL DEFAULT '',
|
1792 |
+
`plz_presse` varchar(10) NOT NULL ,
|
1793 |
+
`ort_presse` varchar(75) NOT NULL ,
|
1794 |
+
`land_presse` varchar(3) NOT NULL DEFAULT 'DE',
|
1795 |
+
`email_presse` varchar(75) NOT NULL ,
|
1796 |
+
`telefon_presse` varchar(30) NOT NULL ,
|
1797 |
+
`fax_presse` varchar(30) NOT NULL ,
|
1798 |
+
`url_presse` varchar(150) NOT NULL ,
|
1799 |
+
PRIMARY KEY (`id`) ,
|
1800 |
+
KEY `blog_user_id`(`blog_user_id`)) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci AUTO_INCREMENT=1";
|
1801 |
+
$wpdb->query($sqlCreateUserContact);
|
1802 |
+
|
1803 |
+
$sqlCreateNetworkSettings = 'CREATE TABLE IF NOT EXISTS `' . $wpdb->prefix . 'b2s_user_network_settings` (
|
1804 |
+
`id` int(11) NOT NULL AUTO_INCREMENT,
|
1805 |
+
`blog_user_id` int(11) NOT NULL,
|
1806 |
+
`mandant_id` int(11) NOT NULL,
|
1807 |
+
`network_auth_id` int(11) NOT NULL,
|
1808 |
+
PRIMARY KEY (`id`),
|
1809 |
+
INDEX `blog_user_id` (`blog_user_id`), INDEX `mandant_id` (`mandant_id`)
|
1810 |
+
) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci AUTO_INCREMENT=1;';
|
1811 |
+
$wpdb->query($sqlCreateNetworkSettings);
|
1812 |
+
|
1813 |
+
$sqlCreateDrafts = "CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}b2s_posts_drafts` (
|
1814 |
+
`id` int(11) NOT NULL AUTO_INCREMENT,
|
1815 |
+
`last_save_date` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
|
1816 |
+
`blog_user_id` int(11) NOT NULL,
|
1817 |
+
`post_id` int(11) NOT NULL,
|
1818 |
+
`save_origin` tinyint(4) NOT NULL DEFAULT 0,
|
1819 |
+
`data` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL,
|
1820 |
+
PRIMARY KEY (`id`),
|
1821 |
+
INDEX `blog_user_id` (`blog_user_id`), INDEX `post_id` (`post_id`)
|
1822 |
+
) DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci AUTO_INCREMENT=1;";
|
1823 |
+
$wpdb->query($sqlCreateDrafts);
|
1824 |
+
|
1825 |
+
//since V6.1.0
|
1826 |
+
$b2sPostsDraftsCols = $wpdb->get_results('SHOW COLUMNS FROM ' . $wpdb->prefix . 'b2s_posts_drafts');
|
1827 |
+
if (is_array($b2sPostsDraftsCols) && isset($b2sPostsDraftsCols[0])) {
|
1828 |
+
$b2sPostsDraftsColsData = array();
|
1829 |
+
foreach ($b2sPostsDraftsCols as $key => $value) {
|
1830 |
+
if (isset($value->Field) && !empty($value->Field)) {
|
1831 |
+
$b2sPostsDraftsColsData[] = $value->Field;
|
1832 |
+
}
|
1833 |
+
}
|
1834 |
+
if (!in_array("save_origin", $b2sPostsDraftsColsData)) {
|
1835 |
+
$wpdb->query("ALTER TABLE {$wpdb->prefix}b2s_posts_drafts ADD save_origin TINYINT NOT NULL DEFAULT '0'");
|
1836 |
+
}
|
1837 |
+
}
|
1838 |
+
|
1839 |
+
$sqlCreateFavorites = "CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}b2s_posts_favorites` (
|
1840 |
+
`id` int(11) NOT NULL AUTO_INCREMENT,
|
1841 |
+
`blog_user_id` int(11) NOT NULL,
|
1842 |
+
`post_id` int(11) NOT NULL,
|
1843 |
+
`save_date` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00',
|
1844 |
+
PRIMARY KEY (`id`),
|
1845 |
+
INDEX `blog_user_id` (`blog_user_id`), INDEX `post_id` (`post_id`)
|
1846 |
+
) DEFAULT CHARSET=utf8mb4 COLLATE utf8mb4_unicode_ci AUTO_INCREMENT=1;";
|
1847 |
+
|
1848 |
+
if (!$wpdb->query($sqlCreateFavorites)) {
|
1849 |
+
$mySqlPermission = false;
|
1850 |
+
}
|
1851 |
+
|
1852 |
+
/*
|
1853 |
+
* SET SAFETY AUTO-INCREMENT
|
1854 |
+
*/
|
1855 |
+
|
1856 |
+
$wpdb->query("ALTER TABLE `{$wpdb->prefix}b2s_posts` CHANGE `id` `id` INT(11) NOT NULL AUTO_INCREMENT;");
|
1857 |
+
$wpdb->query("ALTER TABLE `{$wpdb->prefix}b2s_posts_sched_details` CHANGE `id` `id` INT(11) NOT NULL AUTO_INCREMENT;");
|
1858 |
+
$wpdb->query("ALTER TABLE `{$wpdb->prefix}b2s_posts_network_details` CHANGE `id` `id` INT(11) NOT NULL AUTO_INCREMENT;");
|
1859 |
+
$wpdb->query("ALTER TABLE `{$wpdb->prefix}b2s_user` CHANGE `id` `id` INT(11) NOT NULL AUTO_INCREMENT;");
|
1860 |
+
$wpdb->query("ALTER TABLE `{$wpdb->prefix}b2s_user_contact` CHANGE `id` `id` INT(11) NOT NULL AUTO_INCREMENT;");
|
1861 |
+
$wpdb->query("ALTER TABLE `{$wpdb->prefix}b2s_user_network_settings` CHANGE `id` `id` INT(11) NOT NULL AUTO_INCREMENT;");
|
1862 |
+
$wpdb->query("ALTER TABLE `{$wpdb->prefix}b2s_posts_drafts` CHANGE `id` `id` INT(11) NOT NULL AUTO_INCREMENT;");
|
1863 |
+
if (!$wpdb->query("ALTER TABLE `{$wpdb->prefix}b2s_posts_favorites` CHANGE `id` `id` INT(11) NOT NULL AUTO_INCREMENT;")) {
|
1864 |
+
$mySqlPermission = false;
|
1865 |
+
}
|
1866 |
+
|
1867 |
+
if (!$mySqlPermission) {
|
1868 |
+
$b2sSystem->deactivatePlugin();
|
1869 |
+
wp_die($b2sSystem->getErrorMessage(array('dbTable' => false)) . ' ' . esc_html__('or', 'blog2social') . ' <a href="' . esc_url(admin_url("/plugins.php", "http")) . '/">' . esc_html__('back to install plugins', 'blog2social') . '</a>');
|
1870 |
+
}
|
1871 |
+
|
1872 |
+
//Activate Social Meta Tags
|
1873 |
+
$options = new B2S_Options(0, 'B2S_PLUGIN_GENERAL_OPTIONS');
|
1874 |
+
if ($options->_getOption('og_active') === false || $options->_getOption('card_active') === false) {
|
1875 |
+
$options->_setOption('og_active', 1);
|
1876 |
+
$options->_setOption('card_active', 1);
|
1877 |
+
}
|
1878 |
+
//init roles & capabilities
|
1879 |
+
$this->initCaps();
|
1880 |
+
}
|
1881 |
+
|
1882 |
+
public function deactivatePlugin($allBlogs) {
|
1883 |
+
global $wpdb;
|
1884 |
+
$optionDeleteSchedPosts = get_option('B2S_PLUGIN_DEACTIVATE_SCHED_POST');
|
1885 |
+
if ($allBlogs && is_multisite()) {
|
1886 |
+
$sql = "SELECT blog_id FROM {$wpdb->base_prefix}blogs";
|
1887 |
+
$blogIds = $wpdb->get_results($sql, ARRAY_A);
|
1888 |
+
if (is_array($blogIds) && !empty($blogIds)) {
|
1889 |
+
foreach ($blogIds as $blogId) {
|
1890 |
+
switch_to_blog($blogId['blog_id']);
|
1891 |
+
if ($optionDeleteSchedPosts !== false && (int) $optionDeleteSchedPosts == 1) {
|
1892 |
+
update_option("B2S_PLUGIN_DEACTIVATE_SCHED_POST", 1, false);
|
1893 |
+
} else {
|
1894 |
+
delete_option("B2S_PLUGIN_DEACTIVATE_SCHED_POST");
|
1895 |
+
}
|
1896 |
+
deactivate_plugins(B2S_PLUGIN_HOOK, false, false);
|
1897 |
+
restore_current_blog();
|
1898 |
+
}
|
1899 |
+
return true;
|
1900 |
+
}
|
1901 |
+
}
|
1902 |
+
if ($optionDeleteSchedPosts !== false && (int) $optionDeleteSchedPosts == 1) {
|
1903 |
+
$existsTable = $wpdb->get_results('SHOW TABLES LIKE "' . $wpdb->prefix . 'b2s_user"');
|
1904 |
+
if (is_array($existsTable) && !empty($existsTable)) {
|
1905 |
+
$sqlPosts = "SELECT a.token FROM `{$wpdb->prefix}b2s_user` a INNER JOIN {$wpdb->prefix}b2s_posts ON a.`blog_user_id` = {$wpdb->prefix}b2s_posts.`blog_user_id` where {$wpdb->prefix}b2s_posts.`hide` = 0 AND {$wpdb->prefix}b2s_posts.`sched_type` != 3 AND {$wpdb->prefix}b2s_posts.`publish_date`= '0000-00-00 00:00:00' GROUP by a.blog_user_id";
|
1906 |
+
$results = $wpdb->get_results($sqlPosts, ARRAY_A);
|
1907 |
+
if (is_array($results) && !empty($results)) {
|
1908 |
+
$tempData = array('action' => 'deleteBlogSchedPost', 'host' => get_site_url(), 'data' => serialize($results));
|
1909 |
+
$result = json_decode(B2S_Api_Post::post(B2S_PLUGIN_API_ENDPOINT, $tempData));
|
1910 |
+
if (isset($result->result) && $result->result == true) {
|
1911 |
+
$data = array('hide' => '1', 'hook_action' => '0');
|
1912 |
+
$where = array('publish_date' => '0000-00-00 00:00:00', 'hide' => '0');
|
1913 |
+
$wpdb->update($wpdb->prefix . 'b2s_posts', $data, $where, array('%d', '%d'), array('%d', '%d'));
|
1914 |
+
delete_option('B2S_PLUGIN_DEACTIVATE_SCHED_POST');
|
1915 |
+
}
|
1916 |
+
}
|
1917 |
+
}
|
1918 |
+
}
|
1919 |
+
}
|
1920 |
+
|
1921 |
+
public function releaseLocks() {
|
1922 |
+
require_once(B2S_PLUGIN_DIR . 'includes/Options.php');
|
1923 |
+
$options = new B2S_Options(get_current_user_id());
|
1924 |
+
$lock = $options->_getOption("B2S_PLUGIN_USER_CALENDAR_BLOCKED");
|
1925 |
+
|
1926 |
+
if ($lock) {
|
1927 |
+
delete_option("B2S_PLUGIN_CALENDAR_BLOCKED_" . $lock);
|
1928 |
+
$options->_setOption("B2S_PLUGIN_USER_CALENDAR_BLOCKED", false);
|
1929 |
+
}
|
1930 |
+
}
|
1931 |
+
|
1932 |
+
}
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Tags: auto post, auto publish, social media scheduling, social media calendar, s
|
|
5 |
Donate link: https://paypal.me/adenion
|
6 |
Requires at least: 4.7.0
|
7 |
Tested up to: 5.8
|
8 |
-
Stable tag: 6.8.
|
9 |
License: GPLv3
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
@@ -224,6 +224,8 @@ To get started with the basics of Blog2Social and maybe find some useful tips an
|
|
224 |
7. Keep track of your shared posts and scheduling plan with the Social Media Calendar.
|
225 |
|
226 |
== Changelog ==
|
|
|
|
|
227 |
= 6.8.5 =
|
228 |
Usability Optimization & LinkedIn text length updated
|
229 |
= 6.8.4 =
|
@@ -292,6 +294,8 @@ Usability Optimization, Rebrandly integration, url parameter settings
|
|
292 |
New Image Posts, Imgur, Animated Gifs and Emojis
|
293 |
|
294 |
== Upgrade Notice ==
|
|
|
|
|
295 |
= 6.8.5 =
|
296 |
Usability Optimization & LinkedIn text length updated
|
297 |
= 6.8.4 =
|
5 |
Donate link: https://paypal.me/adenion
|
6 |
Requires at least: 4.7.0
|
7 |
Tested up to: 5.8
|
8 |
+
Stable tag: 6.8.6
|
9 |
License: GPLv3
|
10 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
|
224 |
7. Keep track of your shared posts and scheduling plan with the Social Media Calendar.
|
225 |
|
226 |
== Changelog ==
|
227 |
+
= 6.8.6 =
|
228 |
+
Bugfixing Meta Tags
|
229 |
= 6.8.5 =
|
230 |
Usability Optimization & LinkedIn text length updated
|
231 |
= 6.8.4 =
|
294 |
New Image Posts, Imgur, Animated Gifs and Emojis
|
295 |
|
296 |
== Upgrade Notice ==
|
297 |
+
= 6.8.6 =
|
298 |
+
Bugfixing Meta Tags
|
299 |
= 6.8.5 =
|
300 |
Usability Optimization & LinkedIn text length updated
|
301 |
= 6.8.4 =
|