| @@ -3,9 +3,9 @@ | ||
| 3 | 3 | /** |
| 4 | 4 | * Plugin Name: Tagembed: Social Media Feeds and Customer Reviews Widget |
| 5 | 5 | * Plugin URI: https://tagembed.com/ |
| 6 | 6 | * Description: Display social media feeds and user-generated content in an interactive widget. |
| 7 | - * Version: 8.0 | |
| 7 | + * Version: 8.1 | |
| 8 | 8 | * Author: Tagembed |
| 9 | 9 | * Author URI: https://tagembed.com/ |
| 10 | 10 | * License: GPLv3 |
| 11 | 11 | * License URI: https://www.gnu.org/licenses/gpl-3.0.html |
| @@ -15,9 +15,9 @@ | ||
| 15 | 15 | die; |
| 16 | 16 | endif; |
| 17 | 17 | |
| 18 | 18 | /* --Start-- Create Constant */ |
| 19 | -!defined('TAGEMBED_PLUGIN_VERSION') && define('TAGEMBED_PLUGIN_VERSION', '8.0'); | |
| 19 | +!defined('TAGEMBED_PLUGIN_VERSION') && define('TAGEMBED_PLUGIN_VERSION', '8.1'); | |
| 20 | 20 | !defined('TAGEMBED_PLUGIN_DIR_PATH') && define('TAGEMBED_PLUGIN_DIR_PATH', plugin_dir_path(__FILE__)); |
| 21 | 21 | !defined('TAGEMBED_PLUGIN_URL') && define('TAGEMBED_PLUGIN_URL', plugin_dir_url(__FILE__)); |
| 22 | 22 | !defined('TAGEMBED_PLUGIN_REDIRECT_URL') && define('TAGEMBED_PLUGIN_REDIRECT_URL', get_admin_url(null, 'admin.php?page=')); |
| 23 | 23 | |
| @@ -180,8 +180,9 @@ | ||
| 180 | 180 | $param['emailId'] = sanitize_email($data->emailId); |
| 181 | 181 | $param['password'] = $data->password; |
| 182 | 182 | $param['contact_no'] = $data->contact_no; |
| 183 | 183 | $param['calling_code'] = $data->calling_code; |
| 184 | + $param['timezone'] = !empty($data->timezone) ? sanitize_text_field($data->timezone) : ''; | |
| 184 | 185 | $param['platform'] = TAGEMBED_PLUGIN_PLATFORM; |
| 185 | 186 | /* --End-- Manage Param Data */ |
| 186 | 187 | $response = ___tagembed__wpApiCall(TAGEMBED_PLUGIN_API_URL . 'apiaccount/register', $param, []); |
| 187 | 188 | $response = ___tagembed__manageApiResponse($response); |
| @@ -761,44 +762,35 @@ | ||
| 761 | 762 | endswitch; |
| 762 | 763 | break; |
| 763 | 764 | case 10: |
| 764 | 765 | if (in_array($__tagembed__feed_filter_id, [1, 16, 17])) : |
| 765 | - if (!preg_match('/\b(?:(?:https?|ftp) :\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i', $data->feed)) : | |
| 766 | + if (!preg_match('/\b(?:(?:https?|ftp):\/\/|www\.)[-a-z0-9+&@#\/%?=~_|!:,.;]*[-a-z0-9+&@#\/%=~_|]/i', $data->feed)) : | |
| 766 | 767 | return ___tagembed__exitWithDanger('Validation Error', ['feed' => 'Enter Valid URL']); |
| 767 | 768 | endif; |
| 768 | 769 | endif; |
| 769 | 770 | switch ($__tagembed__feed_filter_id): |
| 770 | 771 | case 16: |
| 771 | - $postUrl = parse_url($data->feed); | |
| 772 | - if (!strstr($postUrl['host'], 'linkedin')) : | |
| 773 | - return ___tagembed__exitWithDanger('Validation Error', ['feed' => 'Enter Linkedin Post Url']); | |
| 772 | + $__tagembed__postHostUrl = wp_parse_url($data->feed, PHP_URL_HOST); | |
| 773 | + $__tagembed__postHostUrl = is_string($__tagembed__postHostUrl) ? strtolower($__tagembed__postHostUrl) : ''; | |
| 774 | + if ($__tagembed__postHostUrl === 'lnkd.in' || substr($__tagembed__postHostUrl, -8) === '.lnkd.in') : | |
| 775 | + $__tagembed__expandedPostUrl = ___tagembed__expandLinkedinShortUrl($data->feed); | |
| 776 | + if (!empty($__tagembed__expandedPostUrl)) : | |
| 777 | + $data->feed = $__tagembed__expandedPostUrl; | |
| 778 | + $__tagembed__postHostUrl = wp_parse_url($data->feed, PHP_URL_HOST); | |
| 779 | + $__tagembed__postHostUrl = is_string($__tagembed__postHostUrl) ? strtolower($__tagembed__postHostUrl) : ''; | |
| 780 | + endif; | |
| 774 | 781 | endif; |
| 775 | - $postUrl = $data->feed; | |
| 776 | - $postUrl = rtrim($postUrl, '/'); | |
| 777 | - preg_match('/[^\/]+$/', $postUrl, $postId); | |
| 778 | - $postId = $postId[0]; | |
| 779 | - $postId = (explode('?', $postId)[0]); | |
| 780 | - $value1 = 'LinkedIn'; | |
| 781 | - if (stripos($postId, 'activity') !== false) : | |
| 782 | - $postId = (explode('activity', $postId)[1]); | |
| 783 | - $value2 = 'activity'; | |
| 784 | - elseif (stripos($postId, 'ugcPost') !== false) : | |
| 785 | - $postId = (explode('ugcPost', $postId)[1]); | |
| 786 | - $value2 = 'ugcPost'; | |
| 787 | - else : | |
| 782 | + if (!strstr($__tagembed__postHostUrl, 'linkedin')) : | |
| 788 | 783 | return ___tagembed__exitWithDanger('Validation Error', ['feed' => 'Enter Linkedin Post Url']); |
| 789 | 784 | endif; |
| 790 | - preg_match_all('!\d+!', $postId, $postId); | |
| 791 | - if (isset($postId[0][0]) && empty($postId[0][0])) : | |
| 785 | + $__tagembed__parsedPost = ___tagembed__parseLinkedinPostUrl($data->feed); | |
| 786 | + if (empty($__tagembed__parsedPost['value2']) || empty($__tagembed__parsedPost['value3'])) : | |
| 792 | 787 | return ___tagembed__exitWithDanger('Validation Error', ['feed' => 'Enter Linkedin Post Url']); |
| 793 | 788 | endif; |
| 794 | - $value3 = $postId[0][0]; | |
| 795 | - if (empty($value1) || empty($value2) || empty($value3)) : | |
| 796 | - return ___tagembed__exitWithDanger('Validation Error', ['feed' => 'Enter Linkedin Post Url']); | |
| 797 | - endif; | |
| 798 | - $__tagembed__feed_input_data['value1'] = $value1; | |
| 799 | - $__tagembed__feed_input_data['value2'] = $value2; | |
| 800 | - $__tagembed__feed_input_data['value3'] = $value3; | |
| 789 | + $__tagembed__feed_input_data['feed'] = sanitize_text_field($data->feed); | |
| 790 | + $__tagembed__feed_input_data['value1'] = 'LinkedIn'; | |
| 791 | + $__tagembed__feed_input_data['value2'] = $__tagembed__parsedPost['value2']; | |
| 792 | + $__tagembed__feed_input_data['value3'] = $__tagembed__parsedPost['value3']; | |
| 801 | 793 | break; |
| 802 | 794 | case 1: |
| 803 | 795 | case 17: |
| 804 | 796 | $url = parse_url($data->feed); |