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 +200 -57 4.14.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: 4.1
6 + * Version: 4.5
7 7 * Author: Tagembed
8 8 * Author URI: https://tagembed.com/
9 9 */
10 10 if (!defined('WPINC'))
@@ -9,9 +9,9 @@
9 9 */
10 10 if (!defined('WPINC'))
11 11 die;
12 12 /* --Start-- Create Constant */
13 -!defined('TAGEMBED_PLUGIN_VERSION') && define('TAGEMBED_PLUGIN_VERSION', '4.1');
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/");
@@ -41,9 +41,9 @@
41 41 /* --Start-- Gutenberge */
42 42 if (!function_exists("register_block_type")):
43 43 return;
44 44 else:
45 - wp_register_script("__editor-js", TAGEMBED_PLUGIN_URL . '/assets/js/editor/editor.js', ["wp-blocks", "wp-element", "wp-editor", "wp-components", "wp-i18n", "wp-data", "wp-compose"], TAGEMBED_PLUGIN_VERSION);
45 + wp_register_script("__editor-js", TAGEMBED_PLUGIN_URL . '/assets/js/editor/editor.js', ["wp-block-editor", "wp-blocks", "wp-element", "wp-components", "wp-i18n", "wp-data", "wp-compose"], TAGEMBED_PLUGIN_VERSION);
46 46 register_block_type("tagembed-block/tagembed", ["editor_script" => "__editor-js", "editor_style" => "__editor-css", "style" => "__editor-style-css"]);
47 47 endif;
48 48 /* --End-- Gutenberge */
49 49 endif;
@@ -70,8 +70,9 @@
70 70 add_menu_page('Tagembed', 'Tagembed', 'manage_options', 'tagembed', '__tagembed__view', 'data:image/svg+xml;base64,' . base64_encode($svg));
71 71 }
72 72 add_action("admin_menu", '__tagembed__plugin_menus');
73 73 /* --End-- Add Menus */
74 +
74 75 /* --Start-- Add & Manage Views */
75 76 function __tagembed__view() {
76 77 if (!empty(__tagembed__user()->isLogin) && __tagembed__user()->isLogin == 'yes'):
77 78 $__tagembed__menus = __tagembed__menus(['__tagembed__menu_condation' => 'STATUS = 1']);
@@ -336,8 +337,20 @@
336 337 unset($param);
337 338 $response = __tagembed__manageApiResponse($response);
338 339 return __tagembed__exitWithSuccess($response);
339 340 break;
341 + case "__tagembed__search_vk_communities":
342 + if (empty($__tagembed__user_details) || empty($data->vkCommunitiesName))
343 + return __tagembed__exitWithDanger();
344 + /* --Start-- Manage Param Data */
345 + $param['vkCommunitiesName'] = $data->vkCommunitiesName;
346 + $param['userId'] = sanitize_key($__tagembed__user_details->userId);
347 + /* --End-- Manage Param Data */
348 + $response = __tagembed__wpApiCall(TAGEMBED_PLUGIN_API_URL . 'apifeed/searchVkCommunities', $param, ['Authorization:' . $__tagembed__user_details->accessToken]);
349 + unset($param);
350 + $response = __tagembed__manageApiResponse($response);
351 + return __tagembed__exitWithSuccess($response);
352 + break;
340 353 case "__tagembed__get_facebook_page_albums":
341 354 if (empty($__tagembed__user_details) || empty($data->connectedAccountsId))
342 355 return __tagembed__exitWithDanger();
343 356 /* --Start-- Manage Param Data */
@@ -461,8 +474,16 @@
461 474 $__tagembed__feed_input_data['value2'] = strtolower($pintrestHeaders[2]);
462 475 break;
463 476 endswitch;
464 477 break;
478 + case 6:
479 + switch ($__tagembed__feed_filter_id):
480 + case 1:
481 + case 2:
482 + $__tagembed__feed_input_data['feed'] = $__tagembed__feed_input_data['name'] = $data->feed;
483 + break;
484 + endswitch;
485 + break;
465 486 case 7:
466 487 if (in_array($__tagembed__feed_filter_id, [1, 71])):
467 488 $isUrl = false;
468 489 if (preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i", $data->feed))
@@ -497,10 +518,12 @@
497 518 break;
498 519 endswitch;
499 520 break;
500 521 case 10:
501 - if (!preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i", $data->feed))
502 - return __tagembed__exitWithDanger("Validation Error", ["feed" => "Enter Valid URL"]);
522 + if (in_array($__tagembed__feed_filter_id, [1, 16, 17])):
523 + if (!preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i", $data->feed))
524 + return __tagembed__exitWithDanger("Validation Error", ["feed" => "Enter Valid URL"]);
525 + endif;
503 526 switch ($__tagembed__feed_filter_id):
504 527 case 16:
505 528 $postUrl = parse_url($data->feed);
506 529 if (!strstr($postUrl['host'], 'linkedin'))
@@ -539,10 +562,21 @@
539 562 $__tagembed__feed_input_data['feed'] = $companyPageUrl;
540 563 $url[2] = str_replace("-", " ", "$url[2]");
541 564 $__tagembed__feed_input_data['page'] = ucwords($url[2], " ");
542 565 break;
566 + case 2:
567 + $__tagembed__feed_input_data['feed'] = $__tagembed__feed_input_data['name'] = $data->feed;
568 + break;
543 569 endswitch;
544 570 break;
571 + case 11:
572 + switch ($__tagembed__feed_filter_id):
573 + case 1:
574 + case 2:
575 + $__tagembed__feed_input_data['feed'] = $__tagembed__feed_input_data['name'] = $data->feed;
576 + break;
577 + endswitch;
578 + break;
545 579 case 12:
546 580 if (!preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i", $data->feed))
547 581 return __tagembed__exitWithDanger("Validation Error", ["feed" => "Enter Valid URL"]);
548 582 $__tagembed__feed_input_data['name'] = $data->name;
@@ -556,8 +590,16 @@
556 590 endswitch;
557 591 if (!in_array($__tagembed__feed_filter_id, [34]))
558 592 $__tagembed__feed_input_data['auth'] = 1;
559 593 break;
594 + case 19:
595 + if (!preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i", $data->feed))
596 + return __tagembed__exitWithDanger("Validation Error", ["feed" => "Enter Valid URL"]);
597 + $yelpBusinessUrl = parse_url($data->feed);
598 + if (!strstr($yelpBusinessUrl['host'], 'yelp'))
599 + return __tagembed__exitWithDanger("Validation Error", ["feed" => "'Enter Yelp Business Url"]);
600 + $__tagembed__feed_input_data['feed'] = $__tagembed__feed_input_data['name'] = explode('/', $yelpBusinessUrl['path'])[2];
601 + break;
560 602 case 23:
561 603 if (!preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i", $data->feed))
562 604 return __tagembed__exitWithDanger("Validation Error", ["feed" => "Enter Valid URL"]);
563 605 $airbnbListUrl = parse_url($data->feed);
@@ -568,14 +610,8 @@
568 610 return __tagembed__exitWithDanger("Validation Error", ["feed" => "'Enter Airbnb Url"]);
569 611 endif;
570 612 $__tagembed__feed_input_data['name'] = $data->name;
571 613 break;
572 - case 33:
573 - if (!preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i", $data->feed))
574 - return __tagembed__exitWithDanger("Validation Error", ["feed" => "Enter Valid URL"]);
575 - preg_match("/[^\/]+$/", "$data->feed", $matches);
576 - $__tagembed__feed_input_data['name'] = $__tagembed__feed_input_data['feed'] = $matches[0];
577 - break;
578 614 case 28:
579 615 if (!preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i", $data->feed))
580 616 return __tagembed__exitWithDanger("Validation Error", ["feed" => "Enter Valid URL"]);
581 617 $capeterraCompanyUrl = parse_url($data->feed);
@@ -591,24 +627,36 @@
591 627 if (!strstr($etsyShopUrl['host'], 'etsy'))
592 628 return __tagembed__exitWithDanger("Validation Error", ["feed" => "'Enter Etsy Shop Url"]);
593 629 $__tagembed__feed_input_data['feed'] = $__tagembed__feed_input_data['name'] = explode('/shop/', $etsyShopUrl['path'])[1];
594 630 break;
595 - case 19:
596 - if (!preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i", $data->feed))
597 - return __tagembed__exitWithDanger("Validation Error", ["feed" => "Enter Valid URL"]);
598 - $yelpBusinessUrl = parse_url($data->feed);
599 - if (!strstr($yelpBusinessUrl['host'], 'yelp'))
600 - return __tagembed__exitWithDanger("Validation Error", ["feed" => "'Enter Yelp Business Url"]);
601 - $__tagembed__feed_input_data['feed'] = $__tagembed__feed_input_data['name'] = explode('/', $yelpBusinessUrl['path'])[2];
631 + case 31:
632 + switch ($__tagembed__feed_filter_id):
633 + case 2:
634 + $__tagembed__feed_input_data['feed'] = $__tagembed__feed_input_data['name'] = $data->feed;
635 + break;
636 + endswitch;
637 + if (!in_array($__tagembed__feed_filter_id, [2]))
638 + $__tagembed__feed_input_data['auth'] = 1;
602 639 break;
603 - case 11:
640 + case 32:
604 641 switch ($__tagembed__feed_filter_id):
605 - case 1:
606 642 case 2:
607 643 $__tagembed__feed_input_data['feed'] = $__tagembed__feed_input_data['name'] = $data->feed;
608 644 break;
645 + case 75:
646 + $__tagembed__feed_input_data['communitiesName'] = $data->communitiesName;
647 + $__tagembed__feed_input_data['communitiesId'] = $data->communitiesId;
648 + break;
609 649 endswitch;
650 + if (!in_array($__tagembed__feed_filter_id, [2, 75]))
651 + $__tagembed__feed_input_data['auth'] = 1;
610 652 break;
653 + case 33:
654 + if (!preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i", $data->feed))
655 + return __tagembed__exitWithDanger("Validation Error", ["feed" => "Enter Valid URL"]);
656 + preg_match("/[^\/]+$/", "$data->feed", $matches);
657 + $__tagembed__feed_input_data['name'] = $__tagembed__feed_input_data['feed'] = $matches[0];
658 + break;
611 659 endswitch;
612 660 unset($data);
613 661 $response = __tagembed__wpApiCall(TAGEMBED_PLUGIN_API_URL . 'apifeed/create', ['feedData' => $__tagembed__feed_input_data], ['Authorization:' . $__tagembed__user_details->accessToken]);
614 662 $response = __tagembed__manageApiResponse($response);
@@ -808,8 +856,23 @@
808 856 unset($param);
809 857 $response = __tagembed__manageApiResponse($response);
810 858 return __tagembed__exitWithSuccess($response);
811 859 break;
860 + case "__tagembed__update_footer_customization_option":
861 + /* --Start-- Manage Param Data */
862 + $param['widgetId'] = sanitize_key($data->widgetId);
863 + $param['userId'] = sanitize_key($__tagembed__user_details->userId);
864 + $param['personalizationId'] = sanitize_key($data->personalizationId);
865 + $param['themeRuleId'] = sanitize_key($data->themeRuleId);
866 + $param['loadMoreStatus'] = sanitize_key($data->loadMoreStatus);
867 + $param['autoScrollStatus'] = sanitize_key($data->autoScrollStatus);
868 + $param['showMoreTxt'] = $data->showMoreTxt;
869 + /* --End-- Manage Param Data */
870 + $response = __tagembed__wpApiCall(TAGEMBED_PLUGIN_API_URL . 'apicustomization/footer', $param, ['Authorization:' . $__tagembed__user_details->accessToken]);
871 + unset($param);
872 + $response = __tagembed__manageApiResponse($response);
873 + return __tagembed__exitWithSuccess($response);
874 + break;
812 875 case "__tagembed__update_layout_customization_option":
813 876 /* --Start-- Manage Param Data */
814 877 $param['widgetId'] = sanitize_key($data->widgetId);
815 878 $param['userId'] = sanitize_key($__tagembed__user_details->userId);
@@ -819,11 +882,9 @@
819 882 $param['padding'] = sanitize_key($data->padding);
820 883 $param['minimumPostWidth'] = sanitize_key($data->minimumPostWidth);
821 884 $param['columnCount'] = sanitize_key($data->columnCount);
822 885 $param['columnCountMobile'] = sanitize_key($data->columnCountMobile);
823 - $param['loadMoreStatus'] = sanitize_key($data->loadMoreStatus);
824 886 $param['postText'] = sanitize_key($data->postText);
825 - $param['trimcontent'] = sanitize_key($data->trimcontent);
826 887 $param['mobilePopup'] = sanitize_key($data->mobilePopup);
827 888 $param['postFeatured'] = sanitize_key($data->postFeatured);
828 889 /* --End-- Manage Param Data */
829 890 $response = __tagembed__wpApiCall(TAGEMBED_PLUGIN_API_URL . 'apicustomization/layout', $param, ['Authorization:' . $__tagembed__user_details->accessToken]);
@@ -874,20 +935,66 @@
874 935 return __tagembed__exitWithDanger();
875 936 endswitch;
876 937 }
877 938 /* --End-- Manage Ajax Calls */
939 +
940 +/* --Start-- Manage Login And Register On Plugin Activate */
941 +function __tagembed__manageLoginAndRegisterOnPluginActivate() {
942 + global $wpdb;
943 + $__tagembed__activeUserData = wp_get_current_user();
944 + if ($__tagembed__activeUserData->roles[0] != "administrator")
945 + return false;
946 +
947 + if (!empty($__tagembed__activeUserData->data->user_email) && !empty($__tagembed__activeUserData->data->display_name)):
948 + $__tagembed__activeUserName = $__tagembed__activeUserData->data->display_name;
949 + $__tagembed__activeUserEmail = $__tagembed__activeUserData->data->user_email;
950 +
951 + /* --Start-- Mange Other Active Options */
952 + $__tagembed__activeOptions = __tagembed__getActiveOptions();
953 + if (!empty($__tagembed__activeOptions[0]->email)):
954 + if (empty($__tagembed__activeOptions[0]->isLogin) || $__tagembed__activeOptions[0]->isLogin == "no")
955 + return false;
956 + $__tagembed__activeUserEmail = $__tagembed__activeOptions[0]->email;
957 + endif;
958 + /* --End-- Mange Other Active Options */
959 + $param = [];
960 + /* --Start-- Manage Param Data */
961 + $param['fullName'] = sanitize_text_field($__tagembed__activeUserName);
962 + $param['emailId'] = sanitize_email($__tagembed__activeUserEmail);
963 + $param['password'] = "TagembedWordpressUserPassword";
964 + /* --End-- Manage Param Data */
965 + $response = __tagembed__wpApiCall(TAGEMBED_PLUGIN_API_URL . 'apiaccount/register', $param);
966 + $response = __tagembed__manageApiResponse($response);
967 + unset($param);
968 + if (!empty($response->userId)):
969 + /* --Start--Mange Frist Widget Create Process */
970 + if ($response->createFirstWidget):
971 + $param = ['userId' => sanitize_key($response->userId)];
972 + __tagembed__wpApiCall(TAGEMBED_PLUGIN_API_URL . 'apiwidget/create', $param, ['Authorization:' . $response->accessToken]);
973 + endif;
974 + /* --End--Mange Frist Widget Create Process */
975 + __tagembed__login($response); /* After Register Manage User Login Process */
976 + endif;
977 +
978 + endif;
979 +}
980 +/* --End-- Manage Login And Register On Plugin Activate */
981 +
878 982 /* --Start-- Login */
879 983 function __tagembed__login($response) {
880 984 global $wpdb;
881 985 $return = false;
882 986 $user = __tagembed__user($response->emailId);
883 - if (empty($user->email)) {
884 - if ($wpdb->insert('wp_tagembed_user', ["userId" => $response->userId, "name" => $response->name, "email" => $response->emailId, "accessToken" => $response->accessToken, "isLogin" => "yes"]))
987 + if (empty($user->email)):
988 + if ($wpdb->insert('wp_tagembed_user', ["userId" => $response->userId, "name" => $response->name, "email" => $response->emailId, "accessToken" => $response->accessToken, "isLogin" => "yes"])):
885 989 $return = true;
886 - } else {
887 - if ($wpdb->update('wp_tagembed_user', ["userId" => $response->userId, "name" => $response->name, "email" => $response->emailId, "accessToken" => $response->accessToken, "isLogin" => "yes",], ['email' => $response->emailId]))
990 + endif;
991 + else:
992 + if ($wpdb->update('wp_tagembed_user', ["userId" => $response->userId, "name" => $response->name, "email" => $response->emailId, "accessToken" => $response->accessToken, "isLogin" => "yes",], ['email' => $response->emailId])):
888 993 $return = true;
889 - }
994 + endif;
995 + endif;
996 + __tagembed__manageActiveOptions($response->emailId, "yes"); /* Manage Active Options */
890 997 if ($return):
891 998 if (count($response->collaboratorlist)):
892 999 __tagembed__manageCollaborator($response->collaboratorlist, $response->userId);
893 1000 endif;
@@ -895,13 +1002,38 @@
895 1002 endif;
896 1003 return $return;
897 1004 }
898 1005 /* --End-- Login */
1006 +
1007 +/* --Start-- Manage Active Options */
1008 +function __tagembed__manageActiveOptions($email = NULL, $other = NULL) {
1009 + global $wpdb;
1010 + if ($email == NULL && $other != NULL):
1011 + $wpdb->update('wp_tagembed_active_options', ["isLogin" => $other], ['id' => 1]);
1012 + else:
1013 + $__tagembed__activeOptions = $wpdb->get_results("SELECT email FROM wp_tagembed_active_options WHERE(id = 1)");
1014 + if (empty($__tagembed__activeOptions[0]->email)):
1015 + $wpdb->insert('wp_tagembed_active_options', ["email" => $email, "isLogin" => $other]);
1016 + else:
1017 + $wpdb->update('wp_tagembed_active_options', ["email" => $email, "isLogin" => $other], ['id' => 1]);
1018 + endif;
1019 + endif;
1020 +}
1021 +/* --End-- Manage Active Options */
1022 +/* --Start--Get User Last Login Email Id */
1023 +function __tagembed__getActiveOptions() {
1024 + global $wpdb;
1025 + $__tagembed__activeOptions = $wpdb->get_results("SELECT email,isLogin FROM wp_tagembed_active_options WHERE(id = 1)");
1026 + return $__tagembed__activeOptions;
1027 +}
1028 +/* --End--Get User last Login Email Id */
899 1029 /* --Start-- Logout */
900 1030 function tagembed_logout() {
901 1031 global $wpdb;
902 - if ($wpdb->update('wp_tagembed_user', ["isLogin" => "no"], ["isLogin" => "yes"]))
1032 + if ($wpdb->update('wp_tagembed_user', ["isLogin" => "no"], ["isLogin" => "yes"])):
1033 + __tagembed__manageActiveOptions(NULL, "no"); /* Manage Active Options */
903 1034 return true;
1035 + endif;
904 1036 return false;
905 1037 }
906 1038 /* --End-- Logout */
907 1039 /* --Start--Manage Menues */
@@ -982,8 +1114,10 @@
982 1114 $returnWidgetData = [];
983 1115 $__tagembed__user_details = __tagembed__user();
984 1116 if (!empty($__tagembed__user_details)):
985 1117 $response = __tagembed__wpApiCall(TAGEMBED_PLUGIN_API_URL . 'apiwidget/get', ['userId' => sanitize_key($__tagembed__user_details->userId)], ['Authorization:' . $__tagembed__user_details->accessToken]);
1118 + if (!isset($response->head->status))
1119 + return $returnWidgetData;
986 1120 if (!$response->head->status || $response->head->code != 200 || !$response->body || empty($response->body))
987 1121 return $returnWidgetData;
988 1122 $returnWidgetData = $response->body;
989 1123 endif;
@@ -1053,10 +1187,11 @@
1053 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");
1054 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");
1055 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");
1056 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");
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");
1057 1192 /* Manage Tagembed Plugin Menus */
1058 - $__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']];
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']];
1059 1194 foreach ($__tagembed__menus as $__tagembed__menu)
1060 1195 $wpdb->insert('wp_tagembed_menus', ["name" => $__tagembed__menu['name'], "status" => $__tagembed__menu['status'], "path" => $__tagembed__menu['path']]);
1061 1196 }
1062 1197 function __tagembed__dropDatabaseTablesForPlugin() {
@@ -1071,13 +1206,16 @@
1071 1206 /* --Start-- Manage Active Deactive And Uninstall Webhook */
1072 1207 register_activation_hook(__FILE__, '__tagembed__pluginActivate');
1073 1208 function __tagembed__pluginActivate() {
1074 1209 __tagembed__createDatabaseTableForPlugin();
1210 + __tagembed__manageLoginAndRegisterOnPluginActivate();
1075 1211 add_action('activated_plugin', '__tagembed__plginActivationRedirect');
1076 1212 }
1077 1213 register_uninstall_hook(__FILE__, '__tagembed__pluginUnistall');
1078 1214 function __tagembed__pluginUnistall() {
1079 1215 __tagembed__dropDatabaseTablesForPlugin();
1216 + global $wpdb;
1217 + $wpdb->query("DROP table IF EXISTS wp_tagembed_active_options"); /* Delete When Plugin Uninstall */
1080 1218 }
1081 1219 /* register_deactivation_hook(__FILE__, '__tagembed__pluginDeactivate');
1082 1220 function __tagembed__pluginDeactivate() {
1083 1221 __tagembed__dropDatabaseTablesForPlugin();
@@ -1098,8 +1236,9 @@
1098 1236 /* --Start--Manage Database On Plugin Update Time */
1099 1237 function __tagembed__manageDatabaseOnPluginUpdateTime() {
1100 1238 __tagembed__dropDatabaseTablesForPlugin();
1101 1239 __tagembed__createDatabaseTableForPlugin();
1240 + __tagembed__manageLoginAndRegisterOnPluginActivate();
1102 1241 }
1103 1242 add_action('upgrader_process_complete', '__tagembed__manageDatabaseOnPluginUpdateTime', 10, 2);
1104 1243 /* --End--Manage Database On Plugin Update Time */
1105 1244 /* --Sart--Manage Chat Hide And Show */
@@ -1106,18 +1245,20 @@
1106 1245 function __tagembed__chat() {
1107 1246 $returnData = false;
1108 1247 TRY {
1109 1248 $response = __tagembed__wpApiCall(TAGEMBED_PLUGIN_API_URL . 'apiaccount/chat', ['pluginName' => 'wordpress'], ['Authorization: __tagembed__']);
1110 - if ($response->head->status):
1111 - $response = __tagembed__manageApiResponse($response);
1112 - if (!empty($response->chat) && is_array($response->chat)):
1113 - foreach ($response->chat as $chat):
1114 - if ($chat->location == "all"):
1115 - $returnData = "all";
1116 - elseif ($chat->location == "inner"):
1117 - $returnData = "inner";
1118 - endif;
1119 - endforeach;
1249 + if (isset($response->head->status)):
1250 + if ($response->head->status):
1251 + $response = __tagembed__manageApiResponse($response);
1252 + if (!empty($response->chat) && is_array($response->chat)):
1253 + foreach ($response->chat as $chat):
1254 + if ($chat->location == "all"):
1255 + $returnData = "all";
1256 + elseif ($chat->location == "inner"):
1257 + $returnData = "inner";
1258 + endif;
1259 + endforeach;
1260 + endif;
1120 1261 endif;
1121 1262 endif;
1122 1263 } CATCH (Exception $e) {
1123 1264
@@ -1133,26 +1274,28 @@
1133 1274 $__tagmebed__page_name = $__tagmebed__page_name['page'];
1134 1275 endif;
1135 1276 TRY {
1136 1277 $response = __tagembed__wpApiCall(TAGEMBED_PLUGIN_API_URL . 'apiaccount/notification', ['callBy' => 'wordpress'], ['Authorization: __tagembed__']);
1137 - if ($response->head->status):
1138 - $response = __tagembed__manageApiResponse($response);
1139 - if (!empty($response->notifications) && is_array($response->notifications)):
1140 - $htmlData = "";
1141 - foreach ($response->notifications as $notifications):
1142 - if ($notifications->location == "tagembed" || $notifications->location == "inner"):
1143 - if ($__tagmebed__page_name != "tagembed")
1144 - continue;
1145 - $htmlData .= '<div class="notice notice-' . esc_html($notifications->type) . ' is-dismissible">';
1146 - $htmlData .= '<p>' . $notifications->message . '</p>';
1147 - $htmlData .= '</div>';
1148 - elseif ($notifications->location == "all"):
1149 - $htmlData .= '<div class="notice notice-' . esc_html($notifications->type) . ' is-dismissible">';
1150 - $htmlData .= '<p>' . $notifications->message . '</p>';
1151 - $htmlData .= '</div>';
1152 - endif;
1153 - endforeach;
1154 - echo $htmlData;
1278 + if (!is_wp_error($response)):
1279 + if (isset($response->head->status)):
1280 + $response = __tagembed__manageApiResponse($response);
1281 + if (!empty($response->notifications) && is_array($response->notifications)):
1282 + $htmlData = "";
1283 + foreach ($response->notifications as $notifications):
1284 + if ($notifications->location == "tagembed" || $notifications->location == "inner"):
1285 + if ($__tagmebed__page_name != "tagembed")
1286 + continue;
1287 + $htmlData .= '<div class="notice notice-' . esc_html($notifications->type) . ' is-dismissible">';
1288 + $htmlData .= '<p>' . $notifications->message . '</p>';
1289 + $htmlData .= '</div>';
1290 + elseif ($notifications->location == "all"):
1291 + $htmlData .= '<div class="notice notice-' . esc_html($notifications->type) . ' is-dismissible">';
1292 + $htmlData .= '<p>' . $notifications->message . '</p>';
1293 + $htmlData .= '</div>';
1294 + endif;
1295 + endforeach;
1296 + echo $htmlData;
1297 + endif;
1155 1298 endif;
1156 1299 endif;
1157 1300 } CATCH (Exception $e) {
1158 1301