| @@ -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.2 | |
| 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.2'); | |
| 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-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; |
| @@ -337,8 +337,20 @@ | ||
| 337 | 337 | unset($param); |
| 338 | 338 | $response = __tagembed__manageApiResponse($response); |
| 339 | 339 | return __tagembed__exitWithSuccess($response); |
| 340 | 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; | |
| 341 | 353 | case "__tagembed__get_facebook_page_albums": |
| 342 | 354 | if (empty($__tagembed__user_details) || empty($data->connectedAccountsId)) |
| 343 | 355 | return __tagembed__exitWithDanger(); |
| 344 | 356 | /* --Start-- Manage Param Data */ |
| @@ -462,8 +474,16 @@ | ||
| 462 | 474 | $__tagembed__feed_input_data['value2'] = strtolower($pintrestHeaders[2]); |
| 463 | 475 | break; |
| 464 | 476 | endswitch; |
| 465 | 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; | |
| 466 | 486 | case 7: |
| 467 | 487 | if (in_array($__tagembed__feed_filter_id, [1, 71])): |
| 468 | 488 | $isUrl = false; |
| 469 | 489 | if (preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i", $data->feed)) |
| @@ -498,10 +518,12 @@ | ||
| 498 | 518 | break; |
| 499 | 519 | endswitch; |
| 500 | 520 | break; |
| 501 | 521 | case 10: |
| 502 | - if (!preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i", $data->feed)) | |
| 503 | - 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; | |
| 504 | 526 | switch ($__tagembed__feed_filter_id): |
| 505 | 527 | case 16: |
| 506 | 528 | $postUrl = parse_url($data->feed); |
| 507 | 529 | if (!strstr($postUrl['host'], 'linkedin')) |
| @@ -540,10 +562,21 @@ | ||
| 540 | 562 | $__tagembed__feed_input_data['feed'] = $companyPageUrl; |
| 541 | 563 | $url[2] = str_replace("-", " ", "$url[2]"); |
| 542 | 564 | $__tagembed__feed_input_data['page'] = ucwords($url[2], " "); |
| 543 | 565 | break; |
| 566 | + case 2: | |
| 567 | + $__tagembed__feed_input_data['feed'] = $__tagembed__feed_input_data['name'] = $data->feed; | |
| 568 | + break; | |
| 544 | 569 | endswitch; |
| 545 | 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; | |
| 546 | 579 | case 12: |
| 547 | 580 | if (!preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i", $data->feed)) |
| 548 | 581 | return __tagembed__exitWithDanger("Validation Error", ["feed" => "Enter Valid URL"]); |
| 549 | 582 | $__tagembed__feed_input_data['name'] = $data->name; |
| @@ -557,8 +590,16 @@ | ||
| 557 | 590 | endswitch; |
| 558 | 591 | if (!in_array($__tagembed__feed_filter_id, [34])) |
| 559 | 592 | $__tagembed__feed_input_data['auth'] = 1; |
| 560 | 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; | |
| 561 | 602 | case 23: |
| 562 | 603 | if (!preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i", $data->feed)) |
| 563 | 604 | return __tagembed__exitWithDanger("Validation Error", ["feed" => "Enter Valid URL"]); |
| 564 | 605 | $airbnbListUrl = parse_url($data->feed); |
| @@ -569,14 +610,8 @@ | ||
| 569 | 610 | return __tagembed__exitWithDanger("Validation Error", ["feed" => "'Enter Airbnb Url"]); |
| 570 | 611 | endif; |
| 571 | 612 | $__tagembed__feed_input_data['name'] = $data->name; |
| 572 | 613 | break; |
| 573 | - case 33: | |
| 574 | - if (!preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i", $data->feed)) | |
| 575 | - return __tagembed__exitWithDanger("Validation Error", ["feed" => "Enter Valid URL"]); | |
| 576 | - preg_match("/[^\/]+$/", "$data->feed", $matches); | |
| 577 | - $__tagembed__feed_input_data['name'] = $__tagembed__feed_input_data['feed'] = $matches[0]; | |
| 578 | - break; | |
| 579 | 614 | case 28: |
| 580 | 615 | if (!preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i", $data->feed)) |
| 581 | 616 | return __tagembed__exitWithDanger("Validation Error", ["feed" => "Enter Valid URL"]); |
| 582 | 617 | $capeterraCompanyUrl = parse_url($data->feed); |
| @@ -592,24 +627,36 @@ | ||
| 592 | 627 | if (!strstr($etsyShopUrl['host'], 'etsy')) |
| 593 | 628 | return __tagembed__exitWithDanger("Validation Error", ["feed" => "'Enter Etsy Shop Url"]); |
| 594 | 629 | $__tagembed__feed_input_data['feed'] = $__tagembed__feed_input_data['name'] = explode('/shop/', $etsyShopUrl['path'])[1]; |
| 595 | 630 | break; |
| 596 | - case 19: | |
| 597 | - if (!preg_match("/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i", $data->feed)) | |
| 598 | - return __tagembed__exitWithDanger("Validation Error", ["feed" => "Enter Valid URL"]); | |
| 599 | - $yelpBusinessUrl = parse_url($data->feed); | |
| 600 | - if (!strstr($yelpBusinessUrl['host'], 'yelp')) | |
| 601 | - return __tagembed__exitWithDanger("Validation Error", ["feed" => "'Enter Yelp Business Url"]); | |
| 602 | - $__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; | |
| 603 | 639 | break; |
| 604 | - case 11: | |
| 640 | + case 32: | |
| 605 | 641 | switch ($__tagembed__feed_filter_id): |
| 606 | - case 1: | |
| 607 | 642 | case 2: |
| 608 | 643 | $__tagembed__feed_input_data['feed'] = $__tagembed__feed_input_data['name'] = $data->feed; |
| 609 | 644 | break; |
| 645 | + case 75: | |
| 646 | + $__tagembed__feed_input_data['communitiesName'] = $data->communitiesName; | |
| 647 | + $__tagembed__feed_input_data['communitiesId'] = $data->communitiesId; | |
| 648 | + break; | |
| 610 | 649 | endswitch; |
| 650 | + if (!in_array($__tagembed__feed_filter_id, [2, 75])) | |
| 651 | + $__tagembed__feed_input_data['auth'] = 1; | |
| 611 | 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; | |
| 612 | 659 | endswitch; |
| 613 | 660 | unset($data); |
| 614 | 661 | $response = __tagembed__wpApiCall(TAGEMBED_PLUGIN_API_URL . 'apifeed/create', ['feedData' => $__tagembed__feed_input_data], ['Authorization:' . $__tagembed__user_details->accessToken]); |
| 615 | 662 | $response = __tagembed__manageApiResponse($response); |
| @@ -888,20 +935,66 @@ | ||
| 888 | 935 | return __tagembed__exitWithDanger(); |
| 889 | 936 | endswitch; |
| 890 | 937 | } |
| 891 | 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 | + | |
| 892 | 982 | /* --Start-- Login */ |
| 893 | 983 | function __tagembed__login($response) { |
| 894 | 984 | global $wpdb; |
| 895 | 985 | $return = false; |
| 896 | 986 | $user = __tagembed__user($response->emailId); |
| 897 | - if (empty($user->email)) { | |
| 898 | - 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"])): | |
| 899 | 989 | $return = true; |
| 900 | - } else { | |
| 901 | - 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])): | |
| 902 | 993 | $return = true; |
| 903 | - } | |
| 994 | + endif; | |
| 995 | + endif; | |
| 996 | + __tagembed__manageActiveOptions($response->emailId, "yes"); /* Manage Active Options */ | |
| 904 | 997 | if ($return): |
| 905 | 998 | if (count($response->collaboratorlist)): |
| 906 | 999 | __tagembed__manageCollaborator($response->collaboratorlist, $response->userId); |
| 907 | 1000 | endif; |
| @@ -909,13 +1002,38 @@ | ||
| 909 | 1002 | endif; |
| 910 | 1003 | return $return; |
| 911 | 1004 | } |
| 912 | 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 */ | |
| 913 | 1029 | /* --Start-- Logout */ |
| 914 | 1030 | function tagembed_logout() { |
| 915 | 1031 | global $wpdb; |
| 916 | - 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 */ | |
| 917 | 1034 | return true; |
| 1035 | + endif; | |
| 918 | 1036 | return false; |
| 919 | 1037 | } |
| 920 | 1038 | /* --End-- Logout */ |
| 921 | 1039 | /* --Start--Manage Menues */ |
| @@ -1069,10 +1187,11 @@ | ||
| 1069 | 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"); |
| 1070 | 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"); |
| 1071 | 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"); |
| 1072 | 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"); | |
| 1073 | 1192 | /* Manage Tagembed Plugin Menus */ |
| 1074 | - $__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']]; | |
| 1075 | 1194 | foreach ($__tagembed__menus as $__tagembed__menu) |
| 1076 | 1195 | $wpdb->insert('wp_tagembed_menus', ["name" => $__tagembed__menu['name'], "status" => $__tagembed__menu['status'], "path" => $__tagembed__menu['path']]); |
| 1077 | 1196 | } |
| 1078 | 1197 | function __tagembed__dropDatabaseTablesForPlugin() { |
| @@ -1087,13 +1206,16 @@ | ||
| 1087 | 1206 | /* --Start-- Manage Active Deactive And Uninstall Webhook */ |
| 1088 | 1207 | register_activation_hook(__FILE__, '__tagembed__pluginActivate'); |
| 1089 | 1208 | function __tagembed__pluginActivate() { |
| 1090 | 1209 | __tagembed__createDatabaseTableForPlugin(); |
| 1210 | + __tagembed__manageLoginAndRegisterOnPluginActivate(); | |
| 1091 | 1211 | add_action('activated_plugin', '__tagembed__plginActivationRedirect'); |
| 1092 | 1212 | } |
| 1093 | 1213 | register_uninstall_hook(__FILE__, '__tagembed__pluginUnistall'); |
| 1094 | 1214 | function __tagembed__pluginUnistall() { |
| 1095 | 1215 | __tagembed__dropDatabaseTablesForPlugin(); |
| 1216 | + global $wpdb; | |
| 1217 | + $wpdb->query("DROP table IF EXISTS wp_tagembed_active_options"); /* Delete When Plugin Uninstall */ | |
| 1096 | 1218 | } |
| 1097 | 1219 | /* register_deactivation_hook(__FILE__, '__tagembed__pluginDeactivate'); |
| 1098 | 1220 | function __tagembed__pluginDeactivate() { |
| 1099 | 1221 | __tagembed__dropDatabaseTablesForPlugin(); |
| @@ -1114,8 +1236,9 @@ | ||
| 1114 | 1236 | /* --Start--Manage Database On Plugin Update Time */ |
| 1115 | 1237 | function __tagembed__manageDatabaseOnPluginUpdateTime() { |
| 1116 | 1238 | __tagembed__dropDatabaseTablesForPlugin(); |
| 1117 | 1239 | __tagembed__createDatabaseTableForPlugin(); |
| 1240 | + __tagembed__manageLoginAndRegisterOnPluginActivate(); | |
| 1118 | 1241 | } |
| 1119 | 1242 | add_action('upgrader_process_complete', '__tagembed__manageDatabaseOnPluginUpdateTime', 10, 2); |
| 1120 | 1243 | /* --End--Manage Database On Plugin Update Time */ |
| 1121 | 1244 | /* --Sart--Manage Chat Hide And Show */ |