gins that use cookies and sets a consent banner in just a few clicks. Works well with Smash Balloon plugins.', 'instagram-feed'), 'icon' => SBI_BUILDER_URL . 'assets/img/wpconsent-icon.png', 'color' => 'blue', 'active' => true ] ] : self::get_awesomemotive_plugins(), 'star_icons' => SBI_PLUGIN_URL . 'admin/assets/img/stars.svg' ], [ 'id' => 'success-page', 'template' => SBI_BUILDER_DIR . 'templates/onboarding/success-page.php', 'heading' => __('Awesome. You are all set up!', 'instagram-feed'), 'description' => __('Here\'s an overview of everything that is set up', 'instagram-feed'), 'upgradeContent' => [ 'heading' => __('Upgrade to unlock hashtag feeds, tagged feeds, a popup lightbox and more', 'instagram-feed'), 'description' => __('To unlock these features and much more, upgrade to Pro and enter your license key below.', 'instagram-feed'), 'button' => [ 'text' => __('Upgrade to Instagram Feed Pro', 'instagram-feed'), 'link' => 'https://smashballoon.com/instagram-feed/instagram-lite-upgrade/?license_key&upgrade=true&utm_campaign=instagram-free&utm_source=setup&utm_medium=upgrade-license' ], 'upgradeCouppon' => 'Upgrade today and save 50% on a Pro License! (auto-applied at checkout)', 'banner' => SBI_BUILDER_URL . 'assets/img/success-banner.jpg', 'upgradeFeaturesList' => [ [ 'heading' => __('Hashtag Feeds', 'instagram-feed'), 'icon' => '' ], [ 'heading' => __('Tagged Feeds', 'instagram-feed'), 'icon' => '' ], [ 'heading' => __('Lightbox', 'instagram-feed'), 'icon' => '' ], [ 'heading' => __('And many more', 'instagram-feed'), 'icon' => '' ] ] ] ], ] ]; $dynamic_features_list = self::get_dynamic_features_list(); if (isset($data['steps']) && sizeof($dynamic_features_list) > 0) { $key_cf_ft = array_search('configure-features', array_column($data['steps'], 'id')); if ($key_cf_ft !== false) { $new_features_lit = array_merge($data['steps'][$key_cf_ft]['featuresList'], $dynamic_features_list); $data['steps'][$key_cf_ft]['featuresList'] = $new_features_lit; } } return $data; } /** * Return Awesome Motive Plugins * * @return array * * @since 6.X */ public static function get_awesomemotive_plugins() { $installed_plugins = get_plugins(); $awesomemotive_plugins_list = [ [ 'plugin' => 'allinoneseo', 'data' => [ 'type' => 'install_plugins', 'id' => 'allinoneseo', 'pluginName' => __('All in One SEO', 'instagram-feed'), ], 'heading' => __('All in One SEO Toolkit', 'instagram-feed'), 'description' => __('Out-of-the-box SEO for WordPress. Features like XML Sitemaps, SEO for custom post types, SEO for blogs, business sites, or ecommerce sites, and much more.', 'instagram-feed'), 'color' => 'blue', 'active' => true, 'icon' => SBI_BUILDER_URL . 'assets/img/allinoneseo.png', 'installs_number' => '3 Million+ Installs' ], [ 'plugin' => 'monsterinsight', 'data' => [ 'type' => 'install_plugins', 'id' => 'monsterinsight', 'pluginName' => __('MonsterInsights', 'instagram-feed'), ], 'heading' => __('Analytics by MonsterInsights', 'instagram-feed'), 'description' => __('Make it “effortless” to connect your WordPress site with Google Analytics, so you can start making data-driven decisions to grow your business.', 'instagram-feed'), 'color' => 'blue', 'active' => true, 'icon' => SBI_BUILDER_URL . 'assets/img/monsterinsight.png', 'installs_number' => '3 Million+ Installs' ], [ 'plugin' => 'wpforms', 'data' => [ 'type' => 'install_plugins', 'id' => 'wpforms', 'pluginName' => __('WPForms', 'instagram-feed'), ], 'heading' => __('Forms by WPForms', 'instagram-feed'), 'description' => __('Create contact, subscription or payment forms with the most beginner friendly drag & drop WordPress forms plugin', 'instagram-feed'), 'color' => 'blue', 'active' => true, 'icon' => SBI_BUILDER_URL . 'assets/img/wpforms.png', 'installs_number' => '5 Million+ Installs' ], [ 'plugin' => 'seedprod', 'data' => [ 'type' => 'install_plugins', 'id' => 'seedprod', 'pluginName' => __('SeedProd', 'instagram-feed'), ], 'heading' => __('SeedProd Website Builder', 'instagram-feed'), 'description' => __('A simple and powerful theme builder, landing page builder, "coming soon" page builder, and maintenance mode notice builder', 'instagram-feed'), 'color' => 'blue', 'active' => true, 'icon' => SBI_BUILDER_URL . 'assets/img/seedprod.png', 'installs_number' => '900 Thousand+ Installs' ], [ 'plugin' => 'optinmonster', 'data' => [ 'type' => 'install_plugins', 'id' => 'optinmonster', 'pluginName' => __('OptinMonster', 'instagram-feed'), ], 'heading' => __('OptinMonster Popup Builder', 'instagram-feed'), 'description' => __('Make popups & opt-in forms to build your email newsletter subscribers, generate leads, and close sales', 'instagram-feed'), 'color' => 'blue', 'active' => true, 'icon' => SBI_BUILDER_URL . 'assets/img/optinmonster.png', 'installs_number' => '1 Million+ Installs' ], [ 'plugin' => 'pushengage', 'data' => [ 'type' => 'install_plugins', 'id' => 'pushengage', 'pluginName' => __('PushEngage', 'instagram-feed'), ], 'heading' => __('PushEngage Notifications', 'instagram-feed'), 'description' => __('Create and send high-converting web push notifications to your website visitors.', 'instagram-feed'), 'color' => 'blue', 'active' => true, 'icon' => SBI_BUILDER_URL . 'assets/img/pushengage.svg', 'installs_number' => '10 Thousand+ Installs' ] ]; $available_plugins = []; foreach ($awesomemotive_plugins_list as $plugin) { if (!self::check_awesome_motive_plugin($plugin['plugin'], $installed_plugins)) { array_push($available_plugins, $plugin); } } return array_slice($available_plugins, 0, 3); } /** * Check if AWESOME MOTIVE Plugin * * @return boolean * * @since 6.X */ public static function check_awesome_motive_plugin($plugin, $installed_plugins) { switch ($plugin) { case 'allinoneseo': if ( isset($installed_plugins['all-in-one-seo-pack/all_in_one_seo_pack.php']) || isset($installed_plugins['all-in-one-seo-pack-pro/all_in_one_seo_pack.php']) ) { return true; } return false; case 'monsterinsight': if ( isset($installed_plugins['google-analytics-for-wordpress/googleanalytics.php']) || isset($installed_plugins['google-analytics-premium/googleanalytics-premium.php']) ) { return true; } return false; case 'wpforms': if ( isset($installed_plugins['wpforms-lite/wpforms.php']) || isset($installed_plugins['wpforms/wpforms.php']) ) { return true; } return false; case 'seedprod': if ( isset($installed_plugins['coming-soon/coming-soon.php']) ) { return true; } return false; case 'optinmonster': if ( isset($installed_plugins['optinmonster/optin-monster-wp-api.php']) ) { return true; } return false; case 'pushengage': if ( isset($installed_plugins['pushengage/main.php']) ) { return true; } return false; } return false; // phpcs:ignore Generic.PHP.UpperCaseConstant } /** * Return Dynamic Features List depending on multiple criteria * * @return array * * @since 6.X */ public static function get_dynamic_features_list() { $features_list = []; $smash_plugin_list = self::get_smash_plugins_list(); if (isset($smash_plugin_list['plugins']) && sizeof($smash_plugin_list['plugins']) > 0) { $description_plugins = implode(', ', $smash_plugin_list['text']); $search = ','; $description_plugins_text = strrev(preg_replace(strrev("/$search/"), strrev(' and '), strrev($description_plugins), 1)); $plugins_info = []; foreach ($smash_plugin_list['plugins'] as $p_item) { if ($p_item['is_istalled'] === false) { array_push( $plugins_info, $p_item ); } } array_push( $features_list, [ 'data' => [ 'id' => $description_plugins, 'type' => 'install_plugins', 'plugins' => 'smash' ], 'heading' => __('Social Feed Collection', 'instagram-feed'), 'description' => __('Install', 'instagram-feed') . ' ' . $description_plugins_text . ' ' . __('feed plugins for more fresh content', 'instagram-feed'), 'color' => 'blue', 'active' => true, 'icon' => '', 'plugins' => $plugins_info, 'tooltip' => __('Smash Balloon offers the best social media feed solutions for WordPress. Enabling this feature will install additional plugins to power all of the supported platforms', 'instagram-feed'), ] ); } // Reviews Plugin $reviews_plugin = self::get_smash_reviews_plugin(); if ($reviews_plugin !== false) { array_push($features_list, $reviews_plugin); } // WPChat Plugin $wpchat_plugin = self::get_smash_wpchat_plugin(); if ($wpchat_plugin !== false) { array_push($features_list, $wpchat_plugin); } return $features_list; } /** * Return Uninstalled SmashBalloon Plugins * * @return array * * @since 6.X */ public static function get_smash_plugins_list() { $installed_plugins = get_plugins(); // check whether the pro or free plugins are installed $is_facebook_installed = false; $facebook_plugin = 'custom-facebook-feed/custom-facebook-feed.php'; if (isset($installed_plugins['custom-facebook-feed-pro/custom-facebook-feed.php'])) { $is_facebook_installed = true; $facebook_plugin = 'custom-facebook-feed-pro/custom-facebook-feed.php'; } elseif (isset($installed_plugins['custom-facebook-feed/custom-facebook-feed.php'])) { $is_facebook_installed = true; } $is_instagram_installed = false; $instagram_plugin = 'instagram-feed/instagram-feed.php'; if (isset($installed_plugins['instagram-feed-pro/instagram-feed.php'])) { $is_instagram_installed = true; $instagram_plugin = 'instagram-feed-pro/instagram-feed.php'; } elseif (isset($installed_plugins['instagram-feed/instagram-feed.php'])) { $is_instagram_installed = true; } $is_twitter_installed = false; $twitter_plugin = 'custom-twitter-feeds/custom-twitter-feed.php'; if (isset($installed_plugins['custom-twitter-feeds-pro/custom-twitter-feed.php'])) { $is_twitter_installed = true; $twitter_plugin = 'custom-twitter-feeds-pro/custom-twitter-feed.php'; } elseif (isset($installed_plugins['custom-twitter-feeds/custom-twitter-feed.php'])) { $is_twitter_installed = true; } $is_youtube_installed = false; $youtube_plugin = 'feeds-for-youtube/youtube-feed.php'; if (isset($installed_plugins['youtube-feed-pro/youtube-feed.php'])) { $is_youtube_installed = true; $youtube_plugin = 'youtube-feed-pro/youtube-feed.php'; } elseif (isset($installed_plugins['feeds-for-youtube/youtube-feed.php'])) { $is_youtube_installed = true; } $is_tiktok_installed = false; $tiktok_plugin = 'feeds-for-tiktok/feeds-for-tiktok.php'; if (isset($installed_plugins['tiktok-feeds-pro/tiktok-feeds-pro.php'])) { $is_tiktok_installed = true; $tiktok_plugin = 'tiktok-feeds-pro/tiktok-feeds-pro.php'; } elseif (isset($installed_plugins['feeds-for-tiktok/feeds-for-tiktok.php'])) { $is_tiktok_installed = true; } $smash_list = [ 'text' => [], 'plugins' => [ [ 'type' => 'instagram', 'is_istalled' => $is_instagram_installed, 'download_link' => $instagram_plugin, 'min_php' => '5.6.0', 'icon' => SBI_PLUGIN_URL . 'admin/assets/img/insta-icon.svg' ], [ 'type' => 'facebook', 'is_istalled' => $is_facebook_installed, 'download_link' => $facebook_plugin, 'min_php' => '5.6.0', 'icon' => SBI_PLUGIN_URL . 'admin/assets/img/fb-icon.svg' ], [ 'type' => 'twitter', 'is_istalled' => $is_twitter_installed, 'download_link' => $twitter_plugin, 'min_php' => '5.6.0', 'icon' => SBI_PLUGIN_URL . 'admin/assets/img/twitter-icon.svg' ], [ 'type' => 'youtube', 'is_istalled' => $is_youtube_installed, 'download_link' => $youtube_plugin, 'min_php' => '5.6.0', 'icon' => SBI_PLUGIN_URL . 'admin/assets/img/youtube-icon.svg' ], [ 'type' => 'tiktok', 'is_istalled' => $is_tiktok_installed, 'download_link' => $tiktok_plugin, 'min_php' => '7.0', 'icon' => SBI_PLUGIN_URL . 'admin/assets/img/tiktok-icon.svg' ] ] ]; foreach ($smash_list['plugins'] as $mash_plugin) { if (version_compare(PHP_VERSION, $mash_plugin['min_php'], '<')) { $mash_plugin['is_istalled'] = true; } if ($mash_plugin['type'] === self::$plugin_name || $mash_plugin['is_istalled'] === true) { unset($mash_plugin); } else { array_push($smash_list['text'], ucfirst($mash_plugin['type'])); } } return $smash_list; } /** * Return Reviews Plugin if not Installed * * @return array * * @since 6.X */ public static function get_smash_reviews_plugin() { $installed_plugins = get_plugins(); $min_php = '7.1'; $is_reviews_installed = false; $reviews_plugin = 'reviews-feed/sb-reviews.php'; if (isset($installed_plugins['reviews-feed-pro/sb-reviews-pro.php'])) { $is_reviews_installed = true; $reviews_plugin = 'reviews-feed-pro/sb-reviews-pro.php'; } elseif (isset($installed_plugins['reviews-feed/sb-reviews.php'])) { $is_reviews_installed = true; } if (version_compare(PHP_VERSION, $min_php, '<')) { $is_reviews_installed = true; } if ($is_reviews_installed === false) { return [ 'data' => [ 'id' => 'reviews', 'type' => 'install_plugins' ], 'heading' => __('Customer Reviews Plugin', 'instagram-feed'), 'description' => __('Install Reviews Feed to display customer reviews from Google or Yelp and build trust', 'instagram-feed'), 'color' => 'blue', 'active' => true, 'icon' => '', 'plugins' => [ [ 'type' => 'reviews', 'is_istalled' => $is_reviews_installed, 'download_link' => $reviews_plugin, 'min_php' => $min_php, 'icon' => SBI_PLUGIN_URL . 'admin/assets/img/reviews-icon.svg' ] ], 'tooltip' => __('Enabling this feature will install Reviews Feed plugin. Reviews Feed by Smash Balloon helps users to display reviews from Google, TripAdvisor, TrustPilot and more.', 'instagram-feed'), ]; } return false; } /** * Return WPChat Plugin if not Installed * * @return array|false * * @since 6.X */ public static function get_smash_wpchat_plugin() { $installed_plugins = get_plugins(); $min_php = '8.0'; $is_wpchat_installed = false; $wpchat_plugin = 'smashballoon-wpchat-livechat-customer-support/wp-chat.php'; if (isset($installed_plugins['wp-chat-pro/wp-chat-pro.php'])) { $is_wpchat_installed = true; $wpchat_plugin = 'wp-chat-pro/wp-chat-pro.php'; } elseif (isset($installed_plugins['smashballoon-wpchat-livechat-customer-support/wp-chat.php'])) { $is_wpchat_installed = true; } if (version_compare(PHP_VERSION, $min_php, '<')) { $is_wpchat_installed = true; } if ($is_wpchat_installed === false) { return [ 'data' => [ 'id' => 'wpchat', 'type' => 'install_plugins' ], 'heading' => __('WPChat Plugin', 'instagram-feed'), 'description' => __('Install WPChat and connect with customers on WhatsApp, Messenger, Telegram & Instagram and more', 'instagram-feed'), 'color' => 'blue', 'active' => true, 'icon' => '', 'plugins' => [ [ 'type' => 'wpchat', 'is_istalled' => $is_wpchat_installed, 'download_link' => $wpchat_plugin, 'min_php' => $min_php, 'icon' => SBI_PLUGIN_URL . 'admin/assets/img/wpchat-icon.svg' ] ], 'tooltip' => __('Enabling this feature will install WPChat plugin. WPChat by Smash Balloon helps you add live chat and customer support to your website.', 'instagram-feed'), ]; } return false; } /** * Wizard Wrapper. * * @since 6.0 */ public function feed_builder() { include_once SBI_BUILDER_DIR . 'templates/wizard.php'; } /** * Register Menu. * * @since 6.0 */ public function register_menu() { $cap = current_user_can('manage_instagram_feed_options') ? 'manage_instagram_feed_options' : 'manage_options'; $cap = apply_filters('sbi_settings_pages_capability', $cap); $submenu = self::should_init_wizard() ? 'sb-instagram-feed' : 'sb'; $feed_builder = add_submenu_page( $submenu, __('Setup', 'instagram-feed'), __('Setup', 'instagram-feed'), $cap, 'sbi-setup', array($this, 'feed_builder'), 0 ); add_action('load-' . $feed_builder, array($this, 'builder_enqueue_admin_scripts')); } /** * Check if we need to Init the Onboarding wizard * * @since 6.0 */ public static function should_init_wizard() { $statues = get_option(self::$statues_name, array()); if (!isset($statues['wizard_dismissed']) || $statues['wizard_dismissed'] === false) { return true; } return false; } /** * Process Wizard Data * Save Settings, Install Plugins and more * * @since 6.0.8 */ public function process_wizard_data() { if (!isset($_POST['data'])) { wp_send_json_error(); } check_ajax_referer('sbi-admin', 'nonce'); if (!sbi_current_user_can('manage_instagram_feed_options')) { wp_send_json_error(); } $sbi_settings = get_option('sb_instagram_settings', array()); $onboarding_data = sanitize_text_field(stripslashes($_POST['data'])); $onboarding_data = json_decode($onboarding_data, true); foreach ($onboarding_data as $single_data) { if ($single_data['type'] === 'settings') { $sbi_settings[$single_data['id']] = $single_data['id'] === 'sb_instagram_disable_resize' ? false : true; } if ($single_data['type'] === 'install_plugins' && current_user_can('install_plugins')) { $plugins = explode(',', $single_data['id']); // Deleting Redirect Data for 3rd plugins // $this->disable_installed_plugins_redirect(); foreach ($plugins as $plugin_name) { @SBI_Onboarding_wizard::install_single_plugin($plugin_name); $this->disable_installed_plugins_redirect(); } } // SMASH-1245 — opt-in consent from onboarding success page. // Storage is the dedicated consent options (NOT sb_instagram_settings), // and we set $dismiss_modal=true so the post-onboarding re-prompt won't fire. if ( isset( $single_data['type'] ) && 'consent' === $single_data['type'] && isset( $single_data['value'] ) && true === $single_data['value'] // phpcs:ignore Generic.PHP.UpperCaseConstant && class_exists( 'SBI_Consent' ) ) { \SBI_Consent::update( true, true, true ); // phpcs:ignore Generic.PHP.UpperCaseConstant } } update_option('sb_instagram_settings', $sbi_settings); wp_die(); } /** * Install Plugin * * @since 6.X */ public static function install_single_plugin($plugin_name) { $plugin_download = self::get_plugin_download_link(strtolower(str_replace(' ', '', $plugin_name))); if ($plugin_download === false || !current_user_can('install_plugins')) { return false; } if (strpos($plugin_download, 'https://downloads.wordpress.org/plugin/') !== 0) { return false; } set_current_screen('sbi-feed-builder'); // Prepare variables. $url = esc_url_raw( add_query_arg( array( 'page' => 'sbi-feed-builder', ), admin_url('admin.php') ) ); $creds = request_filesystem_credentials($url, '', false, false, null); // Check for file system permissions. if (false === $creds || !WP_Filesystem($creds)) { return false; } require_once SBI_PLUGIN_DIR . 'inc/admin/class-install-skin.php'; // Do not allow WordPress to search/download translations, as this will break JS output. remove_action('upgrader_process_complete', array('Language_Pack_Upgrader', 'async_upgrade'), 20); // Create the plugin upgrader with our custom skin. $installer = new PluginSilentUpgrader(new Sbi_Install_Skin()); // Error check. if (!method_exists($installer, 'install') || empty($plugin_download)) { wp_send_json_error($error); } $installer->install(esc_url_raw(wp_unslash($plugin_download))); // Flush the cache and return the newly installed plugin basename. wp_cache_flush(); $plugin_basename = $installer->plugin_info(); if ($plugin_basename) { activate_plugin($plugin_basename); } } /** * Get Plugin Download * * @since 6.X */ public static function get_plugin_download_link($plugin_name) { $plugin_download = false; switch (strtolower($plugin_name)) { case 'wpconsent': $plugin_download = 'https://downloads.wordpress.org/plugin/wpconsent-cookies-banner-privacy-suite.zip'; break; case 'facebook': $plugin_download = 'https://downloads.wordpress.org/plugin/custom-facebook-feed.zip'; break; case 'instagram': $plugin_download = 'https://downloads.wordpress.org/plugin/instagram-feed.zip'; break; case 'twitter': $plugin_download = 'https://downloads.wordpress.org/plugin/custom-twitter-feeds.zip'; break; case 'youtube': $plugin_download = 'https://downloads.wordpress.org/plugin/feeds-for-youtube.zip'; break; case 'tiktok': $plugin_download = 'https://downloads.wordpress.org/plugin/feeds-for-tiktok.zip'; break; case 'reviews': $plugin_download = 'https://downloads.wordpress.org/plugin/reviews-feed.zip'; break; case 'wpchat': $plugin_download = 'https://downloads.wordpress.org/plugin/smashballoon-wpchat-livechat-customer-support.zip'; break; case 'allinoneseo': $plugin_download = 'https://downloads.wordpress.org/plugin/all-in-one-seo-pack.zip'; break; case 'monsterinsight': $plugin_download = 'https://downloads.wordpress.org/plugin/google-analytics-for-wordpress.zip'; break; case 'wpforms': $plugin_download = 'https://downloads.wordpress.org/plugin/wpforms-lite.zip'; break; case 'seedprod': $plugin_download = 'https://downloads.wordpress.org/plugin/coming-soon.zip'; break; case 'optinmonster': $plugin_download = 'https://downloads.wordpress.org/plugin/optinmonster.zip'; break; case 'pushengage': $plugin_download = 'https://downloads.wordpress.org/plugin/pushengage.zip'; break; } return $plugin_download; } /** * Disable Installed Plugins Redirect * * @since 6.0.8 */ public function disable_installed_plugins_redirect() { // Monster Insight delete_transient('_monsterinsights_activation_redirect'); // All in one SEO update_option('aioseo_activation_redirect', true); // WPForms update_option('wpforms_activation_redirect', true); // Optin Monster delete_transient('optin_monster_api_activation_redirect'); update_option('optin_monster_api_activation_redirect_disabled', true); // Seed PROD update_option('seedprod_dismiss_setup_wizard', true); // PushEngage delete_transient('pushengage_activation_redirect'); // Smash Plugin redirect remove $this->disable_smash_installed_plugins_redirect(); } /** * Disable Smash Balloon Plugins Redirect * * @since 6.0.8 */ public function disable_smash_installed_plugins_redirect() { $smash_list = [ 'facebook' => 'cff_plugin_do_activation_redirect', 'instagram' => 'sbi_plugin_do_activation_redirect', 'youtube' => 'sby_plugin_do_activation_redirect', 'twitter' => 'ctf_plugin_do_activation_redirect', 'reviews' => 'sbr_plugin_do_activation_redirect', 'wpchat' => 'wpchat_plugin_do_activation_redirect', ]; if (isset($smash_list[self::$plugin_name])) { unset($smash_list[self::$plugin_name]); } foreach ($smash_list as $key => $opt) { delete_option($opt); } } /** * Dismiss Onboarding Wizard * * @since 6.0.8 */ public function dismiss_wizard() { check_ajax_referer('sbi-admin', 'nonce'); if (!sbi_current_user_can('manage_instagram_feed_options')) { wp_send_json_error(); } $sbi_statuses_option = get_option('sbi_statuses', array()); $sbi_statuses_option['wizard_dismissed'] = true; update_option('sbi_statuses', $sbi_statuses_option); wp_send_json_error(); } } WordPress › Error

There has been a critical error on this website.

Learn more about troubleshooting WordPress.