PluginProbe
Tagembed: Social Media Feeds and Customer Reviews Widget / 4.5
Tagembed: Social Media Feeds and Customer Reviews Widget v4.5
7.5 7.6 7.7 7.4 trunk 3.10 3.9 4.0 4.1 4.2 4.3 4.4 4.5 4.6 4.7 4.8 4.9 5.0 5.1 5.2 5.3 5.4 5.5 5.6 5.7 All 42 releases
← All changes | tagembed.php +116 -214 5.04.5 View file →
@@ -2,9 +2,9 @@
2 2 /**
3 3 * Plugin Name: Tagembed Widget
4 4 * Plugin URI: https://tagembed.com/
5 5 * Description: Display Facebook feed, Instagram feed, Twitter feed, YouTube Videos and more social feeds from 15+ social networks on any page, posts or widgets using shortcode. Beautifully clean, customizable, and responsive Social Media Feed Widget Plugin for WordPress.
6 - * Version: 5.0
6 + * Version: 4.5
7 7 * Author: Tagembed
8 8 * Author URI: https://tagembed.com/
9 9 */
10 10 if (!defined('WPINC'))
@@ -9,15 +9,13 @@
9 9 */
10 10 if (!defined('WPINC'))
11 11 die;
12 12 /* --Start-- Create Constant */
13 -!defined('TAGEMBED_PLUGIN_VERSION') && define('TAGEMBED_PLUGIN_VERSION', '5.0');
13 +!defined('TAGEMBED_PLUGIN_VERSION') && define('TAGEMBED_PLUGIN_VERSION', '4.5');
14 14 !defined('TAGEMBED_PLUGIN_DIR_PATH') && define('TAGEMBED_PLUGIN_DIR_PATH', plugin_dir_path(__FILE__));
15 15 !defined('TAGEMBED_PLUGIN_URL') && define('TAGEMBED_PLUGIN_URL', plugin_dir_url(__FILE__));
16 16 !defined('TAGEMBED_PLUGIN_REDIRECT_URL') && define('TAGEMBED_PLUGIN_REDIRECT_URL', get_admin_url(null, 'admin.php?page='));
17 17 !defined('TAGEMBED_PLUGIN_API_URL') && define('TAGEMBED_PLUGIN_API_URL', "https://api.tagembed.com/app/");
18 -!defined('TAGEMBED_PLUGIN_SERVER_URL') && define('TAGEMBED_PLUGIN_SERVER_URL', "https://api.tagembed.com/app/");
19 -!defined('TAGEMBED_PLUGIN_REACT_URL') && define('TAGEMBED_PLUGIN_REACT_URL', "https://widget.tagembed.com/");
20 18 !defined('TAGEMBED_PLUGIN_CALL_BACK_URL') && define('TAGEMBED_PLUGIN_CALL_BACK_URL', admin_url() . "admin.php?page=tagembed");
21 19 /* --End-- Create Constant */
22 20 /* --Start--Include Files */
23 21 include_once TAGEMBED_PLUGIN_DIR_PATH . "helper/helper.php";
@@ -23,9 +21,9 @@
23 21 include_once TAGEMBED_PLUGIN_DIR_PATH . "helper/helper.php";
24 22 /* --End--Include Files */
25 23 /* --Start-- Add Js And Css */
26 24 function tagembed_plugin_scripts_css() {
27 - wp_enqueue_script('__tagembed__embbedJs', TAGEMBED_PLUGIN_REACT_URL . 'embed.min.js', ['jquery'], TAGEMBED_PLUGIN_VERSION, true);
25 + wp_enqueue_script('__tagembed__embbedJs', 'https://widget.tagembed.com/embed.min.js', ['jquery'], TAGEMBED_PLUGIN_VERSION, true);
28 26 if (is_admin()):
29 27 /* CSS */
30 28 wp_enqueue_style('__tagembed__commonCss', TAGEMBED_PLUGIN_URL . '/assets/css/common.css', '', TAGEMBED_PLUGIN_VERSION);
31 29 wp_enqueue_style('__tagembed__toastCss', TAGEMBED_PLUGIN_URL . '/assets/css/toast.css', '', TAGEMBED_PLUGIN_VERSION);
@@ -38,10 +36,8 @@
38 36 wp_enqueue_script('__tagembed__toastJs', TAGEMBED_PLUGIN_URL . '/assets/js/toast.js', ['jquery'], TAGEMBED_PLUGIN_VERSION, true);
39 37 wp_enqueue_script('__tagembed__confirmDialogJs', TAGEMBED_PLUGIN_URL . '/assets/js/confirm_dialog.js', ['jquery'], TAGEMBED_PLUGIN_VERSION, true);
40 38 wp_enqueue_script('__tagembed__tagemedLoaderJs', TAGEMBED_PLUGIN_URL . '/assets/js/loader.js', ['jquery'], TAGEMBED_PLUGIN_VERSION, true);
41 39 wp_enqueue_script('__tagembed__deactive-js', TAGEMBED_PLUGIN_URL . '/assets/js/tagembed.deactive.js', ['jquery'], TAGEMBED_PLUGIN_VERSION, true);
42 - $__tagembed__ajax_call_security_nones = wp_create_nonce('__tagembed__ajax_call_security_nones');
43 - wp_localize_script('__tagembed__deactive-js', '__tagembed__ajax_call_security_nones_object', ['__tagembed__ajax_call_security_nones' => $__tagembed__ajax_call_security_nones]);
44 40 wp_enqueue_script('__tagembed__tagembedDialogFormJs', TAGEMBED_PLUGIN_URL . '/assets/js/dialog.form.js', ["jquery"], TAGEMBED_PLUGIN_VERSION, true);
45 41 /* --Start-- Gutenberge */
46 42 if (!function_exists("register_block_type")):
47 43 return;
@@ -78,10 +74,9 @@
78 74
79 75 /* --Start-- Add & Manage Views */
80 76 function __tagembed__view() {
81 77 if (!empty(__tagembed__user()->isLogin) && __tagembed__user()->isLogin == 'yes'):
82 - /* Remove This */ /* $__tagembed__menus = __tagembed__menus(['__tagembed__menu_condation' => 'STATUS = 1']); */
83 - $__tagembed__menus = __tagembed__menus(['__tagembed__menu_condation' => 1]);
78 + $__tagembed__menus = __tagembed__menus(['__tagembed__menu_condation' => 'STATUS = 1']);
84 79 if (empty($__tagembed__menus)):
85 80 include_once TAGEMBED_PLUGIN_DIR_PATH . "views/widget/widgetView.php";
86 81 else:
87 82 include_once TAGEMBED_PLUGIN_DIR_PATH . "views/" . $__tagembed__menus[0]->path . ".php";
@@ -94,17 +89,11 @@
94 89 /* --Start-- Manage Ajax Calls */
95 90 add_action("wp_ajax_data", "__tagembed__dataAjaxHandler");
96 91 function __tagembed__dataAjaxHandler() {
97 92 if (empty($_REQUEST['__tagembed__ajax_action']))
98 - return false;
93 + return FALSE;
99 94 $data = __tagembed__sanitizeRequestData($_REQUEST);
100 95 $data = (object) $data;
101 - /* --Start-- Manage Ajax call Request Security */
102 - $__tagembed__ajaxCallSecurityNones = isset($data->__tagembed__ajax_call_nones) ? sanitize_text_field($data->__tagembed__ajax_call_nones) : '';
103 - if (!wp_verify_nonce($__tagembed__ajaxCallSecurityNones, "__tagembed__ajax_call_security_nones"))
104 - return __tagembed__exitWithDanger();
105 - /* --End-- Manage Ajax call Request Security */
106 -
107 96 /* --Start__ Sanetize All Input */
108 97 foreach ($data as $key => $value):
109 98 if (!in_array($key, ['emailId', 'password', 'youtubePlaylist']))
110 99 inputSanetize($value);
@@ -122,9 +111,9 @@
122 111 $param['fullName'] = sanitize_text_field($data->fullName);
123 112 $param['emailId'] = sanitize_email($data->emailId);
124 113 $param['password'] = $data->password;
125 114 /* --End-- Manage Param Data */
126 - $response = __tagembed__wpApiCall(TAGEMBED_PLUGIN_API_URL . 'apiaccount/register', $param, []);
115 + $response = __tagembed__wpApiCall(TAGEMBED_PLUGIN_API_URL . 'apiaccount/register', $param);
127 116 $response = __tagembed__manageApiResponse($response);
128 117 unset($param);
129 118 $param = ['userId' => sanitize_key($response->userId)];
130 119 __tagembed__wpApiCall(TAGEMBED_PLUGIN_API_URL . 'apiwidget/create', $param, ['Authorization:' . $response->accessToken]);
@@ -169,9 +158,8 @@
169 158 if (__tagembed__manageActiveWidget($data->widgetId))
170 159 __tagembed__exitWithSuccess();
171 160 return __tagembed__exitWithDanger();
172 161 break;
173 -
174 162 case "__tagembed__menue":
175 163 if (empty($data->menueId))
176 164 return __tagembed__exitWithDanger();
177 165 if (__tagembed__menus(['__tagembed__menu_id' => $data->menueId]))
@@ -177,9 +165,8 @@
177 165 if (__tagembed__menus(['__tagembed__menu_id' => $data->menueId]))
178 166 __tagembed__exitWithSuccess(["redirectUrl" => TAGEMBED_PLUGIN_REDIRECT_URL . 'tagembed']);
179 167 return __tagembed__exitWithDanger();
180 168 break;
181 -
182 169 case "__tagembed__create_widget":
183 170 if (empty($__tagembed__user_details) || empty($data->name))
184 171 return __tagembed__exitWithDanger("Validation Error", ['name' => 'Widget name is required']);
185 172 $data->profanity = (isset($data->profanity)) ? 0 : 1;
@@ -362,21 +349,8 @@
362 349 unset($param);
363 350 $response = __tagembed__manageApiResponse($response);
364 351 return __tagembed__exitWithSuccess($response);
365 352 break;
366 - case "__tagembed__search_facebook_page":
367 - if (empty($data->facebookPageData))
368 - return __tagembed__exitWithDanger();
369 - /* --Start-- Manage Param Data */
370 - $param['facebookPageData'] = $data->facebookPageData;
371 - $param['userId'] = sanitize_key($__tagembed__user_details->userId);
372 - /* --End-- Manage Param Data */
373 - /* --Start-- Call And Manage Api Call */
374 - $response = __tagembed__wpApiCall(TAGEMBED_PLUGIN_API_URL . 'apifeed/searchfacebookpage', $param, ['Authorization:' . $__tagembed__user_details->accessToken]);
375 - unset($param);
376 - $response = __tagembed__manageApiResponse($response);
377 - return __tagembed__exitWithSuccess($response);
378 - break;
379 353 case "__tagembed__get_facebook_page_albums":
380 354 if (empty($__tagembed__user_details) || empty($data->connectedAccountsId))
381 355 return __tagembed__exitWithDanger();
382 356 /* --Start-- Manage Param Data */
@@ -411,20 +385,8 @@
411 385 unset($param);
412 386 $response = __tagembed__manageApiResponse($response);
413 387 return __tagembed__exitWithSuccess($response);
414 388 break;
415 - case "__tagembed__get_slack_channel_list":
416 - if (empty($data->connectedAccountsId))
417 - return __tagembed__exitWithDanger();
418 - /* --Start-- Manage Param Data */
419 - $param['connectedAccountsId'] = $data->connectedAccountsId;
420 - $param['userId'] = sanitize_key($__tagembed__user_details->userId);
421 - /* --End-- Manage Param Data */
422 - $response = __tagembed__wpApiCall(TAGEMBED_PLUGIN_API_URL . 'apifeed/getslackchannellist', $param, ['Authorization:' . $__tagembed__user_details->accessToken]);
423 - unset($param);
424 - $response = __tagembed__manageApiResponse($response);
425 - return __tagembed__exitWithSuccess($response);
426 - break;
427 389 case "__tagembed__get_feed":
428 390 if (empty($__tagembed__user_details) || empty($data->widgetId))
429 391 return __tagembed__exitWithDanger();
430 392 /* --Start-- Manage Param Data */
@@ -555,16 +517,8 @@
555 517 unset($data->youtubePlaylist);
556 518 break;
557 519 endswitch;
558 520 break;
559 - case 8:
560 - switch ($__tagembed__feed_filter_id):
561 - case 1:
562 - case 2:
563 - $__tagembed__feed_input_data['auth'] = 1;
564 - break;
565 - endswitch;
566 - break;
567 521 case 10:
568 522 if (in_array($__tagembed__feed_filter_id, [1, 16, 17])):
569 523 if (!preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i", $data->feed))
570 524 return __tagembed__exitWithDanger("Validation Error", ["feed" => "Enter Valid URL"]);
@@ -628,12 +582,8 @@
628 582 $__tagembed__feed_input_data['name'] = $data->name;
629 583 break;
630 584 case 18:
631 585 switch ($__tagembed__feed_filter_id):
632 - case 23:
633 - if (!preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i", $data->feed))
634 - return __tagembed__exitWithDanger("Validation Error", ["feed" => "Enter Valid URL"]);
635 - break;
636 586 case 26:
637 587 $__tagembed__feed_input_data['hashtagCaption'] = sanitize_key(isset($data->hashtagCaption) ? 1 : 0);
638 588 $__tagembed__feed_input_data['hashtagOlder'] = sanitize_key(isset($data->hashtagOlder) ? 1 : 0);
639 589 break;
@@ -648,17 +598,8 @@
648 598 if (!strstr($yelpBusinessUrl['host'], 'yelp'))
649 599 return __tagembed__exitWithDanger("Validation Error", ["feed" => "'Enter Yelp Business Url"]);
650 600 $__tagembed__feed_input_data['feed'] = $__tagembed__feed_input_data['name'] = explode('/', $yelpBusinessUrl['path'])[2];
651 601 break;
652 - case 20:
653 - $__tagembed__feed_input_data['auth'] = 1;
654 - $slackData = isset($data->slackChannelList) ? $data->slackChannelList : "";
655 - if (!empty($slackData)):
656 - $slackData = explode('#', $slackData);
657 - $__tagembed__feed_input_data['name'] = $slackData[1];
658 - $__tagembed__feed_input_data['feed'] = $slackData[0];
659 - endif;
660 - break;
661 602 case 23:
662 603 if (!preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i", $data->feed))
663 604 return __tagembed__exitWithDanger("Validation Error", ["feed" => "Enter Valid URL"]);
664 605 $airbnbListUrl = parse_url($data->feed);
@@ -714,87 +655,20 @@
714 655 return __tagembed__exitWithDanger("Validation Error", ["feed" => "Enter Valid URL"]);
715 656 preg_match("/[^\/]+$/", "$data->feed", $matches);
716 657 $__tagembed__feed_input_data['name'] = $__tagembed__feed_input_data['feed'] = $matches[0];
717 658 break;
718 - case 34:
719 - if (!preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i", $data->feed))
720 - return __tagembed__exitWithDanger("Validation Error", ["feed" => "Enter Valid URL"]);
721 - $__tagembed__feed_input_data['name'] = explode('/', $data->feed)[3];
722 - $__tagembed__feed_input_data['feed'] = $data->feed;
723 - break;
724 - case 35:
725 - if (!preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i", $data->feed))
726 - return __tagembed__exitWithDanger("Validation Error", ["feed" => "Enter Valid URL"]);
727 - $__tagembed__feed_input_data['name'] = explode('Reviews-', $data->feed)[1];
728 - $__tagembed__feed_input_data['name'] = explode('.html', $__tagembed__feed_input_data['name'])[0];
729 - $__tagembed__feed_input_data['feed'] = $data->feed;
730 - break;
731 - case 37:
732 - $data->feed = explode('.html', $data->feed)[0];
733 - if (!preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i", $data->feed))
734 - return __tagembed__exitWithDanger("Validation Error", ["feed" => "Enter Valid URL"]);
735 - $__tagembed__feed_input_data['name'] = $data->feed;
736 - $__tagembed__feed_input_data['feed'] = explode('item/', $data->feed)[1];
737 - break;
738 659 endswitch;
739 660 unset($data);
740 - /* --Start-- Manage Api Calling */
741 - $byApiCall = 0;
742 - if (empty($__tagembed__feed_input_data['authId'])):
743 - switch ($__tagembed__feed_input_data['networkId']):
744 - case 4:
745 - if ($__tagembed__feed_filter_id == 33):
746 - $byApiCall = 1;
747 - $__tagembed__feed_input_data['byApiCall'] = 1;
748 - endif;
749 - break;
750 - case 5:
751 - case 7:
752 - case 6:
753 - case 10:
754 - case 11:
755 - case 12:
756 - case 19:
757 - case 23:
758 - case 28:
759 - case 29:
760 - case 33:
761 - case 34:
762 - case 35:
763 - case 37:
764 - $byApiCall = 1;
765 - $__tagembed__feed_input_data['byApiCall'] = 1;
766 - break;
767 - case 31:
768 - if ($__tagembed__feed_filter_id == 2):
769 - $byApiCall = 1;
770 - $__tagembed__feed_input_data['byApiCall'] = 1;
771 - endif;
772 - break;
773 - case 32:
774 - if (in_array($__tagembed__feed_filter_id, [2, 75])):
775 - $byApiCall = 1;
776 - $__tagembed__feed_input_data['byApiCall'] = 1;
777 - endif;
778 - break;
779 - endswitch;
780 - else:
781 - $byApiCall = 1;
782 - $__tagembed__feed_input_data['byApiCall'] = 1;
783 - endif;
784 - $__tagembed__feed_input_data['appUser'] = 1;
785 - /* --End-- Manage Api Calling */
786 -
787 661 $response = __tagembed__wpApiCall(TAGEMBED_PLUGIN_API_URL . 'apifeed/create', ['feedData' => $__tagembed__feed_input_data], ['Authorization:' . $__tagembed__user_details->accessToken]);
788 662 $response = __tagembed__manageApiResponse($response);
789 - return __tagembed__exitWithSuccess(["byapiCall" => $byApiCall, "__tagembed__requestCallBackUrl" => TAGEMBED_PLUGIN_CALL_BACK_URL, "redirectUrl" => TAGEMBED_PLUGIN_API_URL . "apiauth/getauth", "__tagembed__feedData" => $response->__tagembed__feedData]);
663 + return __tagembed__exitWithSuccess(["__tagembed__requestCallBackUrl" => TAGEMBED_PLUGIN_CALL_BACK_URL, "redirectUrl" => TAGEMBED_PLUGIN_API_URL . "apiauth/getauth", "__tagembed__feedData" => $response->__tagembed__feedData]);
790 664 break;
791 665 case "__tagembed__make_payment":
792 - if (empty($__tagembed__user_details) || empty($data->planId) || empty($data->priceCode))
666 + if (empty($__tagembed__user_details) || empty($data->plan) || empty($data->price))
793 667 return __tagembed__exitWithDanger();
794 668 /* --Start-- Manage Param Data */
795 - $param['planId'] = sanitize_key($data->planId);
796 - $param['priceCode'] = $data->priceCode;
669 + $param['plan'] = sanitize_key($data->plan);
670 + $param['price'] = sanitize_key($data->price);
797 671 /* --Start-- Manage Param Data */
798 672 $param['userId'] = sanitize_key($__tagembed__user_details->userId);
799 673 $param['email'] = $__tagembed__user_details->email;
800 674 $param['name'] = $__tagembed__user_details->name;
@@ -804,12 +678,12 @@
804 678 $response = __tagembed__manageApiResponse($response);
805 679 return __tagembed__exitWithSuccess(["__tagembed__requestCallBackUrl" => TAGEMBED_PLUGIN_CALL_BACK_URL, "redirectUrl" => TAGEMBED_PLUGIN_API_URL . "apiaccount/makepayment", "__tagembed__paymentData" => $response->__tagembed__paymentData]);
806 680 break;
807 681 case "__tagembed__cancel_subscription":
808 - if (empty($__tagembed__user_details) || empty($data->planId))
682 + if (empty($__tagembed__user_details) || empty($data->plan))
809 683 return __tagembed__exitWithDanger();
810 684 /* --Start-- Manage Param Data */
811 - $param['planId'] = sanitize_key($data->planId);
685 + $param['plan'] = sanitize_key($data->plan);
812 686 /* --Start-- Manage Param Data */
813 687 $param['userId'] = sanitize_key($__tagembed__user_details->userId);
814 688 $param['email'] = $__tagembed__user_details->email;
815 689 $param['name'] = $__tagembed__user_details->name;
@@ -911,8 +785,36 @@
911 785 $response->installedPluginVersion = $installedPluginVersion;
912 786 $response->pluginUpgradeURL = admin_url() . "plugins.php";
913 787 return __tagembed__exitWithSuccess($response);
914 788 break;
789 + case "__tagembed__get_en_user_id":
790 + if (empty($__tagembed__user_details))
791 + return __tagembed__exitWithDanger();
792 + /* --Start-- Manage Param Data */
793 + $param['userId'] = sanitize_key($__tagembed__user_details->userId);
794 + /* --End-- Manage Param Data */
795 + $response = __tagembed__wpApiCall(TAGEMBED_PLUGIN_API_URL . 'apiauth/enuserid', $param, ['Authorization: __tagembed__']);
796 + $response = __tagembed__manageApiResponse($response);
797 + unset($param);
798 + if (!empty($response->userId))
799 + return __tagembed__exitWithSuccess(["shareLink" => "https://app.tagembed.com/apiauth/connections/" . $response->userId]);
800 + return __tagembed__exitWithDanger();
801 + break;
802 + case "__tagembed__share_link":
803 + if (empty($__tagembed__user_details) || empty($data->emailIds) || empty($data->enUserId))
804 + return __tagembed__exitWithDanger();
805 + /* --Start-- Manage Param Data */
806 + $param['userId'] = sanitize_key($__tagembed__user_details->userId);
807 + $param['userEmailId'] = sanitize_email($__tagembed__user_details->email);
808 + $param['userName'] = sanitize_text_field($__tagembed__user_details->name);
809 + $param['emailIds'] = sanitize_text_field($data->emailIds);
810 + $param['enUserId'] = sanitize_key($data->enUserId);
811 + /* --End-- Manage Param Data */
812 + $response = __tagembed__wpApiCall(TAGEMBED_PLUGIN_API_URL . 'apiauth/sendconnectionemail', $param, ['Authorization:' . $__tagembed__user_details->accessToken]);
813 + $response = __tagembed__manageApiResponse($response);
814 + unset($param);
815 + return __tagembed__exitWithSuccess($response);
816 + break;
915 817 case "__tagembed__check_user_token":
916 818 if (empty($__tagembed__user_details))
917 819 return __tagembed__exitWithDanger();
918 820 /* --Start-- Manage Param Data */
@@ -1028,19 +930,8 @@
1028 930 unset($param);
1029 931 $response = __tagembed__manageApiResponse($response);
1030 932 return __tagembed__exitWithSuccess($response);
1031 933 break;
1032 - case "__tagembed__get_and_manage_intercom_chat_setting":
1033 - if (empty($__tagembed__user_details))
1034 - return __tagembed__exitWithDanger();
1035 - /* --Start-- Manage Param Data */
1036 - $param['userId'] = sanitize_key($__tagembed__user_details->userId);
1037 - /* --End-- Manage Param Data */
1038 - $response = __tagembed__wpApiCall(TAGEMBED_PLUGIN_API_URL . 'apiaccount/getIntercomSettingData', $param, ['Authorization:' . $__tagembed__user_details->accessToken]);
1039 - unset($param);
1040 - $response = __tagembed__manageApiResponse($response);
1041 - return __tagembed__exitWithSuccess($response);
1042 - break;
1043 934 default:
1044 935 return __tagembed__exitWithDanger();
1045 936 endswitch;
1046 937 }
@@ -1049,10 +940,11 @@
1049 940 /* --Start-- Manage Login And Register On Plugin Activate */
1050 941 function __tagembed__manageLoginAndRegisterOnPluginActivate() {
1051 942 global $wpdb;
1052 943 $__tagembed__activeUserData = wp_get_current_user();
1053 - if (empty($__tagembed__activeUserData->roles) || $__tagembed__activeUserData->roles[0] != "administrator")
944 + if ($__tagembed__activeUserData->roles[0] != "administrator")
1054 945 return false;
946 +
1055 947 if (!empty($__tagembed__activeUserData->data->user_email) && !empty($__tagembed__activeUserData->data->display_name)):
1056 948 $__tagembed__activeUserName = $__tagembed__activeUserData->data->display_name;
1057 949 $__tagembed__activeUserEmail = $__tagembed__activeUserData->data->user_email;
1058 950
@@ -1092,18 +984,21 @@
1092 984 global $wpdb;
1093 985 $return = false;
1094 986 $user = __tagembed__user($response->emailId);
1095 987 if (empty($user->email)):
1096 - if ($wpdb->query($wpdb->prepare("INSERT INTO wp_tagembed_user (userId, name, email, accessToken, isLogin) VALUES (%d, %s, %s, %s, %s)", $response->userId, $response->name, $response->emailId, $response->accessToken, 'yes'))):
988 + if ($wpdb->insert('wp_tagembed_user', ["userId" => $response->userId, "name" => $response->name, "email" => $response->emailId, "accessToken" => $response->accessToken, "isLogin" => "yes"])):
1097 989 $return = true;
1098 990 endif;
1099 991 else:
1100 - if ($wpdb->query($wpdb->prepare("UPDATE wp_tagembed_user SET userId = %d, name = %s, email = %s, accessToken = %s, isLogin = %s WHERE email = %s", $response->userId, $response->name, $response->emailId, $response->accessToken, 'yes', $response->emailId))):
992 + if ($wpdb->update('wp_tagembed_user', ["userId" => $response->userId, "name" => $response->name, "email" => $response->emailId, "accessToken" => $response->accessToken, "isLogin" => "yes",], ['email' => $response->emailId])):
1101 993 $return = true;
1102 994 endif;
1103 995 endif;
1104 996 __tagembed__manageActiveOptions($response->emailId, "yes"); /* Manage Active Options */
1105 997 if ($return):
998 + if (count($response->collaboratorlist)):
999 + __tagembed__manageCollaborator($response->collaboratorlist, $response->userId);
1000 + endif;
1106 1001 __tagembed__manageActiveWidgetsUser($response->userId);
1107 1002 endif;
1108 1003 return $return;
1109 1004 }
@@ -1109,18 +1004,18 @@
1109 1004 }
1110 1005 /* --End-- Login */
1111 1006
1112 1007 /* --Start-- Manage Active Options */
1113 -function __tagembed__manageActiveOptions($email = null, $other = null) {
1008 +function __tagembed__manageActiveOptions($email = NULL, $other = NULL) {
1114 1009 global $wpdb;
1115 - if ($email == null && $other != null):
1116 - $wpdb->query($wpdb->prepare("UPDATE wp_tagembed_active_options SET isLogin = %s WHERE id = %d", $other, 1));
1010 + if ($email == NULL && $other != NULL):
1011 + $wpdb->update('wp_tagembed_active_options', ["isLogin" => $other], ['id' => 1]);
1117 1012 else:
1118 - $__tagembed__activeOptions = $wpdb->get_results($wpdb->prepare("SELECT email FROM wp_tagembed_active_options WHERE id = %d", 1));
1013 + $__tagembed__activeOptions = $wpdb->get_results("SELECT email FROM wp_tagembed_active_options WHERE(id = 1)");
1119 1014 if (empty($__tagembed__activeOptions[0]->email)):
1120 - $wpdb->query($wpdb->prepare("INSERT INTO wp_tagembed_active_options (email, isLogin) VALUES (%s, %s)", $email, $other));
1015 + $wpdb->insert('wp_tagembed_active_options', ["email" => $email, "isLogin" => $other]);
1121 1016 else:
1122 - $wpdb->query($wpdb->prepare("UPDATE wp_tagembed_active_options SET email = %s, isLogin = %s WHERE id = %d", $email, $other, 1));
1017 + $wpdb->update('wp_tagembed_active_options', ["email" => $email, "isLogin" => $other], ['id' => 1]);
1123 1018 endif;
1124 1019 endif;
1125 1020 }
1126 1021 /* --End-- Manage Active Options */
@@ -1126,9 +1021,9 @@
1126 1021 /* --End-- Manage Active Options */
1127 1022 /* --Start--Get User Last Login Email Id */
1128 1023 function __tagembed__getActiveOptions() {
1129 1024 global $wpdb;
1130 - $results = $wpdb->get_results($wpdb->prepare("SELECT email, isLogin FROM wp_tagembed_active_options WHERE id = %d", 1));
1025 + $__tagembed__activeOptions = $wpdb->get_results("SELECT email,isLogin FROM wp_tagembed_active_options WHERE(id = 1)");
1131 1026 return $__tagembed__activeOptions;
1132 1027 }
1133 1028 /* --End--Get User last Login Email Id */
1134 1029 /* --Start-- Logout */
@@ -1133,10 +1028,10 @@
1133 1028 /* --End--Get User last Login Email Id */
1134 1029 /* --Start-- Logout */
1135 1030 function tagembed_logout() {
1136 1031 global $wpdb;
1137 - if ($wpdb->query($wpdb->prepare("UPDATE wp_tagembed_user SET isLogin = %s WHERE isLogin = %s", "no", "yes"))):
1138 - __tagembed__manageActiveOptions(null, "no"); /* Manage Active Options */
1032 + if ($wpdb->update('wp_tagembed_user', ["isLogin" => "no"], ["isLogin" => "yes"])):
1033 + __tagembed__manageActiveOptions(NULL, "no"); /* Manage Active Options */
1139 1034 return true;
1140 1035 endif;
1141 1036 return false;
1142 1037 }
@@ -1146,11 +1041,11 @@
1146 1041 global $wpdb;
1147 1042 if (empty($__tagembed__menu_condatation))
1148 1043 return $wpdb->get_results("SELECT * FROM wp_tagembed_menus");
1149 1044 if (array_key_exists('__tagembed__menu_condation', $__tagembed__menu_condatation))
1150 - return $wpdb->get_results($wpdb->prepare("SELECT * FROM wp_tagembed_menus WHERE status = %s", $__tagembed__menu_condatation['__tagembed__menu_condation']));
1045 + return $wpdb->get_results("SELECT * FROM wp_tagembed_menus WHERE " . $__tagembed__menu_condatation['__tagembed__menu_condation']);
1151 1046 if (array_key_exists('__tagembed__menu_id', $__tagembed__menu_condatation)):
1152 - if ($wpdb->query($wpdb->prepare("UPDATE wp_tagembed_menus SET status = %d WHERE status = %d", 0, 1)) && $wpdb->query($wpdb->prepare("UPDATE wp_tagembed_menus SET status = %d WHERE id = %d", 1, $__tagembed__menu_condatation['__tagembed__menu_id'])))
1047 + if ($wpdb->update('wp_tagembed_menus', ["status" => 0], ["status" => 1]) && $wpdb->update('wp_tagembed_menus', ["status" => 1], ["id" => $__tagembed__menu_condatation['__tagembed__menu_id']]))
1153 1048 return true;
1154 1049 return false;
1155 1050 endif;
1156 1051 }
@@ -1159,11 +1054,11 @@
1159 1054 function __tagembed__user($email = null) {
1160 1055 global $wpdb;
1161 1056 $__tagembed__userResponse = "";
1162 1057 if (empty($email)):
1163 - $__tagembed__userResponse = $wpdb->get_results($wpdb->prepare("SELECT * FROM wp_tagembed_user WHERE isLogin = %s", 'yes'));
1058 + $__tagembed__userResponse = $wpdb->get_results("SELECT * FROM wp_tagembed_user WHERE(isLogin = 'yes')");
1164 1059 else:
1165 - $__tagembed__userResponse = $wpdb->get_results($wpdb->prepare("SELECT * FROM wp_tagembed_user WHERE email = %s", $email));
1060 + $__tagembed__userResponse = $wpdb->get_results("SELECT * FROM wp_tagembed_user WHERE(email = '" . $email . "')");
1166 1061 endif;
1167 1062 if (!empty($__tagembed__userResponse))
1168 1063 return $__tagembed__userResponse[0];
1169 1064 return;
@@ -1176,8 +1071,45 @@
1176 1071 return $__tagembed__user_dataResponse[0];
1177 1072 return;
1178 1073 }
1179 1074 /* --End-- Get User Details */
1075 +/* --Start-- Get Collaborator Details */
1076 +function __tagembed__collaborator($userId) {
1077 + global $wpdb;
1078 + return $wpdb->get_results("SELECT * FROM wp_tagembed_collaborator WHERE(userId = '" . $userId . "')");
1079 +}
1080 +/* --End-- Get Collaborator Details */
1081 +/* --Start-- Manage Collaborator */
1082 +function __tagembed__manageCollaborator($collaboratorList, $userId) {
1083 + global $wpdb;
1084 + $prevCollaboratorList = __tagembed__convertObjectToArray(__tagembed__collaborator($userId));
1085 + $collaboratorList = __tagembed__convertObjectToArray($collaboratorList);
1086 + $collaboratorListIds = [];
1087 + if (is_array($collaboratorList))
1088 + $collaboratorListIds = array_column($collaboratorList, 'id');
1089 + $prevCollaboratorListIds = [];
1090 + if (is_array($prevCollaboratorList)):
1091 + $prevCollaboratorListIds = array_column($prevCollaboratorList, 'collaboratorId');
1092 + $commonCollaboratorIds = array_intersect($prevCollaboratorListIds, $collaboratorListIds);
1093 + $prevCollaboratorListIds = array_diff($prevCollaboratorListIds, $commonCollaboratorIds);
1094 + $collaboratorListIds = array_diff($collaboratorListIds, $commonCollaboratorIds);
1095 + endif;
1096 + if (count($prevCollaboratorListIds)):
1097 + foreach ($prevCollaboratorListIds as $delId):
1098 + if ($wpdb->delete('wp_tagembed_collaborator', ["collaboratorId" => $delId, "userId" => $userId]))
1099 + $wpdb->delete('wp_tagembed_widget', ["userId" => $delId]);
1100 + endforeach;
1101 + endif;
1102 + foreach ($collaboratorList as $key => $collaborator):
1103 + if (in_array($collaborator['id'], $collaboratorListIds)):
1104 + $wpdb->insert('wp_tagembed_collaborator', ["userId" => $userId, "collaboratorId" => $collaboratorList[$key]['id'], "name" => $collaboratorList[$key]['name']]);
1105 + elseif (in_array($collaborator['id'], $commonCollaboratorIds)):
1106 + $wpdb->update('wp_tagembed_collaborator', ["userId" => $userId, "name" => $collaboratorList[$key]['name'],], ['collaboratorId' => $collaborator['id'], "userId" => $userId]);
1107 + endif;
1108 + endforeach;
1109 + return true;
1110 +}
1111 +/* --End-- Manage Collaborator */
1180 1112 /* --Start-- Get Widget */
1181 1113 function __tagembed__widgets() {
1182 1114 $returnWidgetData = [];
1183 1115 $__tagembed__user_details = __tagembed__user();
@@ -1209,12 +1141,12 @@
1209 1141 $activeWidgetUserId = __tagembed__activeWidget();
1210 1142 if ($activeWidgetUserId == $widgetId)
1211 1143 return true;
1212 1144 if (empty($activeWidgetUserId)):
1213 - $wpdb->query($wpdb->prepare("INSERT INTO wp_tagembed_active_widget (widgetId) VALUES (%s)", $widgetId));
1145 + $wpdb->insert('wp_tagembed_active_widget', ["widgetId" => $widgetId]);
1214 1146 return true;
1215 1147 else:
1216 - $wpdb->query($wpdb->prepare("UPDATE wp_tagembed_active_widget SET widgetId = %s WHERE id = %d", $widgetId, 1));
1148 + $wpdb->update('wp_tagembed_active_widget', ["widgetId" => $widgetId], ['id' => 1]);
1217 1149 return true;
1218 1150 endif;
1219 1151 return false;
1220 1152 }
@@ -1223,11 +1155,10 @@
1223 1155 function __tagembed__activeWidgetUser() {
1224 1156 global $wpdb;
1225 1157 $__tagembed__activeWidgetUserResponse = "";
1226 1158 $__tagembed__activeWidgetUserResponse = $wpdb->get_results("SELECT * FROM wp_tagembed_active_widget_user");
1227 - if (!empty($__tagembed__activeWidgetUserResponse)):
1159 + if (!empty($__tagembed__activeWidgetUserResponse))
1228 1160 return $__tagembed__activeWidgetUserResponse[0]->userId;
1229 - endif;
1230 1161 return;
1231 1162 }
1232 1163 /* --End-- Get Active Widget User */
1233 1164 /* --Start-- Manage Active Widget User */
@@ -1237,12 +1168,12 @@
1237 1168 $activeWidgetUserId = __tagembed__activeWidgetUser();
1238 1169 if ($activeWidgetUserId == $userId)
1239 1170 return true;
1240 1171 if (empty($activeWidgetUserId)):
1241 - $wpdb->query($wpdb->prepare("INSERT INTO wp_tagembed_active_widget_user (userId) VALUES (%d)", $userId));
1172 + $wpdb->insert('wp_tagembed_active_widget_user', ["userId" => $userId]);
1242 1173 return true;
1243 1174 else:
1244 - $wpdb->query($wpdb->prepare("UPDATE wp_tagembed_active_widget_user SET userId = %d WHERE id = %d", $userId, 1));
1175 + $wpdb->update('wp_tagembed_active_widget_user', ["userId" => $userId], ['id' => 1]);
1245 1176 return true;
1246 1177 endif;
1247 1178 return false;
1248 1179 }
@@ -1252,26 +1183,22 @@
1252 1183 function __tagembed__createDatabaseTableForPlugin() {
1253 1184 global $wpdb;
1254 1185 require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
1255 1186 $wpdb->query("CREATE TABLE IF NOT EXISTS `wp_tagembed_user` (`id` int(11) NOT NULL AUTO_INCREMENT,`userId` varchar(100) NOT NULL,`name` varchar(100) NOT NULL,`email` varchar(100) NOT NULL,`accessToken` varchar(255) NOT NULL,`isLogin` enum('no', 'yes') NOT NULL,PRIMARY KEY(`id`)) ENGINE = InnoDB DEFAULT CHARSET = latin1");
1187 + $wpdb->query("CREATE TABLE IF NOT EXISTS `wp_tagembed_collaborator` (`id` int(11) NOT NULL AUTO_INCREMENT,`userId` varchar(100) NOT NULL,`collaboratorId` varchar(100) NOT NULL,`name` varchar(100) NOT NULL,PRIMARY KEY(`id`)) ENGINE = InnoDB DEFAULT CHARSET = latin1");
1256 1188 $wpdb->query("CREATE TABLE IF NOT EXISTS `wp_tagembed_active_widget_user` (`id` int(11) NOT NULL AUTO_INCREMENT,`userId` varchar(100) NOT NULL,PRIMARY KEY(`id`)) ENGINE = InnoDB DEFAULT CHARSET = latin1");
1257 1189 $wpdb->query("CREATE TABLE IF NOT EXISTS `wp_tagembed_menus` (`id` int(11) NOT NULL AUTO_INCREMENT,`name` varchar(100) NOT NULL,`status` tinyint(2) NOT NULL,`path` varchar(255) NOT NULL,PRIMARY KEY(`id`)) ENGINE = InnoDB DEFAULT CHARSET = latin1");
1258 1190 $wpdb->query("CREATE TABLE IF NOT EXISTS `wp_tagembed_active_widget` (`id` int(11) NOT NULL AUTO_INCREMENT,`widgetId` varchar(100) NOT NULL,PRIMARY KEY(`id`)) ENGINE = InnoDB DEFAULT CHARSET = latin1");
1259 1191 $wpdb->query("CREATE TABLE IF NOT EXISTS `wp_tagembed_active_options` (`id` int(11) NOT NULL AUTO_INCREMENT,`email` varchar(500) NOT NULL,`isLogin` enum('no', 'yes'),PRIMARY KEY(`id`)) ENGINE = InnoDB DEFAULT CHARSET = latin1");
1260 -
1261 - /* --Start-- Manage Tagembed Plugin Menus */
1262 - $__tagembed__checkAlreadyExistMenusDataExistOrNot = $wpdb->get_results("SELECT id FROM wp_tagembed_menus");
1263 - if (empty($__tagembed__checkAlreadyExistMenusDataExistOrNot)):
1264 - $__tagembed__menus = [['name' => 'Widget', 'status' => 0, 'path' => 'widget/widgetView'], ['name' => 'Feed', 'status' => 1, 'path' => 'feed/addView'], ['name' => 'Choose Theme', 'status' => 0, 'path' => 'theme/themeView'], ['name' => 'Filter', 'status' => 0, 'path' => 'filter/filterView'], ['name' => 'Customize', 'status' => 0, 'path' => 'customize/customizeView'], ['name' => 'Display', 'status' => 0, 'path' => 'display/displayView'], ['name' => 'Social Accounts', 'status' => 0, 'path' => 'socialAccount/socialAccountView'], ['name' => 'Support', 'status' => 0, 'path' => 'support/supportView'], ['name' => 'Upgrade', 'status' => 0, 'path' => 'upgrade/upgradeView'], ['name' => 'Analytics', 'status' => 0, 'path' => 'analytics/analyticsView']];
1265 - foreach ($__tagembed__menus as $__tagembed__menu):
1266 - $wpdb->query($wpdb->prepare("INSERT INTO wp_tagembed_menus (name, status, path) VALUES (%s, %s, %s)", $__tagembed__menu['name'], $__tagembed__menu['status'], $__tagembed__menu['path']));
1267 - endforeach;
1268 - endif;
1269 - /* --End-- Manage Tagembed Plugin Menus */
1192 + /* Manage Tagembed Plugin Menus */
1193 + $__tagembed__menus = [['name' => 'Widget', 'status' => 0, 'path' => 'widget/widgetView'], ['name' => 'Feed', 'status' => 1, 'path' => 'feed/addView'], ['name' => 'Choose Theme', 'status' => 0, 'path' => 'theme/themeView'], ['name' => 'Filter', 'status' => 0, 'path' => 'filter/filterView'], ['name' => 'Customize', 'status' => 0, 'path' => 'customize/customizeView'], ['name' => 'Display', 'status' => 0, 'path' => 'display/displayView'], ['name' => 'Social Accounts', 'status' => 0, 'path' => 'socialAccount/socialAccountView'], ['name' => 'Support', 'status' => 0, 'path' => 'support/supportView'], ['name' => 'Upgrade', 'status' => 0, 'path' => 'upgrade/upgradeView'], ['name' => 'Analytics', 'status' => 0, 'path' => 'analytics/analyticsView']];
1194 + foreach ($__tagembed__menus as $__tagembed__menu)
1195 + $wpdb->insert('wp_tagembed_menus', ["name" => $__tagembed__menu['name'], "status" => $__tagembed__menu['status'], "path" => $__tagembed__menu['path']]);
1270 1196 }
1271 1197 function __tagembed__dropDatabaseTablesForPlugin() {
1272 1198 global $wpdb;
1273 1199 $wpdb->query("DROP table IF EXISTS wp_tagembed_user");
1200 + $wpdb->query("DROP table IF EXISTS wp_tagembed_collaborator");
1274 1201 $wpdb->query("DROP table IF EXISTS wp_tagembed_active_widget_user");
1275 1202 $wpdb->query("DROP table IF EXISTS wp_tagembed_active_widget");
1276 1203 $wpdb->query("DROP table IF EXISTS wp_tagembed_menus");
1277 1204 }
@@ -1292,15 +1219,11 @@
1292 1219 /* register_deactivation_hook(__FILE__, '__tagembed__pluginDeactivate');
1293 1220 function __tagembed__pluginDeactivate() {
1294 1221 __tagembed__dropDatabaseTablesForPlugin();
1295 1222 } */
1296 -
1297 1223 /* --End-- Manage Active Deactive And Uninstall Webhook */
1298 1224 /* --Start--Manage Redirect After Plugin Activate */
1299 1225 function __tagembed__plginActivationRedirect() {
1300 - $__tagembed__activeUserData = wp_get_current_user();
1301 - if (empty($__tagembed__activeUserData->roles))
1302 - return false;
1303 1226 exit(wp_redirect(TAGEMBED_PLUGIN_CALL_BACK_URL));
1304 1227 }
1305 1228 /* --End--Manage Redirect After Plugin Activate */
1306 1229 /* --Start--Manage Setting Link */
@@ -1342,26 +1265,8 @@
1342 1265 }
1343 1266 return $returnData;
1344 1267 }
1345 1268 /* --End--Manage Chat Hide And Show */
1346 -
1347 -/* --Sart--Get And Manage Social Accout Id */
1348 -function __tagembed__get_user_social_account_id() {
1349 - $__tagembed__user_details = __tagembed__user();
1350 - $param['userId'] = $__tagembed__user_details->userId;
1351 - $response = __tagembed__wpApiCall(TAGEMBED_PLUGIN_API_URL . 'apiaccount/getsocialaccountid', $param, ['Authorization:' . $__tagembed__user_details->accessToken]);
1352 - if (isset($response->head->status)):
1353 - if ($response->head->status):
1354 - $response = __tagembed__manageApiResponse($response);
1355 - if (!empty($response->userId)):
1356 - return $response->userId;
1357 - endif;
1358 - endif;
1359 - endif;
1360 - return false;
1361 -}
1362 -/* --End--Manage Chat Hide And Show */
1363 -
1364 1269 /* --Start-- Manage Hide And Show Admin Notificationa */
1365 1270 function __tagembed__generalAdminNotice() {
1366 1271 $__tagmebed__page_name = "";
1367 1272 if (!empty($_GET['page'])):
@@ -1411,22 +1316,19 @@
1411 1316 }
1412 1317 /* --End-- Manage Hide And Show Admin Notificationa */
1413 1318 /* --End-- Drop Database Table */
1414 1319 /* --Start-- Create Short Code */
1320 +add_shortcode("tagembed", "__tagembed__PluginShortCode");
1415 1321 function __tagembed__PluginShortCode($attr) {
1416 - extract(shortcode_atts(['width' => '', 'height' => '',], $attr, 'tagembed'));
1417 1322 $widgetId = (isset($attr[1]) ? $attr[1] : '');
1418 - if (!empty($widgetId) && is_numeric($widgetId) && (($width === '' || preg_match('/^\d+(px|%|)$/', $width)) && ($height === '' || preg_match('/^\d+(px|%|)$/', $height)))):
1419 - $output = '<span class=""></span>';
1420 - $output .= '<div style="width:' . $width . '; height:' . $height . ';overflow: auto;" class="tagembed-container">';
1421 - $output .= '<div style="width:100%; height:100%;" class="tagembed-socialwall tagembed-analystic" data-wall-id="' . $widgetId . '"></div>';
1422 - $output .= '</div>';
1423 - else:
1424 - $output = '<span style="display: block;text-align: center;border: 1px solid #eee;padding: 5px 15px;background-color: #fafafa;">Invalid Parameters Provided In The Tagembed Shortcode.</span>';
1425 - endif;
1426 - return $output;
1323 + $width = (isset($attr['width']) ? $attr['width'] : '');
1324 + $height = (isset($attr['height']) ? $attr['height'] : '');
1325 + $code = '<span class=""></span>';
1326 + $code .= '<div style="width:' . $width . '; height:' . $height . ';overflow: auto;" class="tagembed-container">';
1327 + $code .= '<div style="width:100%; height:100%;" class="tagembed-socialwall tagembed-analystic" data-wall-id="' . $widgetId . '"></div>';
1328 + $code .= '</div>';
1329 + return $code;
1427 1330 }
1428 -add_shortcode("tagembed", "__tagembed__PluginShortCode");
1429 1331 /* --End-- Create Short Code */
1430 1332
1431 1333
1432 1334