'error'] ) ) { wp_send_json_error( array( 'message' => self::get_error_message( $check_key_response ), ) ); } if ( ! empty( $check_key_response['license_data']['error'] ) ) { wp_send_json_error( array( 'message' => self::get_error_message( $check_key_response ), ) ); } if ( $check_key_response['license_data']['license'] !== 'valid' ) { wp_send_json_error( array( 'message' => self::get_error_message( $check_key_response ), ) ); } $license_data = $check_key_response['license_data']; $settings = new SettingsManagerService(); $settings->update_settings([ 'license_status' => $license_data['license'] , 'license_info' => $license_data, 'license_key' => $license ]); update_option( 'sbr_license_key', $license ); update_option( 'sbr_license_data', $license_data ); update_option( 'sbr_license_status', $license_data['license'] ); // Redirect. $oth = hash( 'sha512', wp_rand() ); $hashed_oth = hash_hmac( 'sha512', $oth, wp_salt() ); update_option( 'sbr_one_click_upgrade', $oth ); $version = '1.0'; $version_info = self::get_version_info( $license_data ); $file = ''; if ( isset( $version_info->package ) ) { $file = $version_info->package; } $siteurl = admin_url(); $endpoint = admin_url( 'admin-ajax.php' ); $redirect = admin_url( 'admin.php?page=' . self::REDIRECT ); $url = add_query_arg( array( 'key' => $license, 'oth' => $hashed_oth, 'endpoint' => $endpoint, 'version' => $version, 'siteurl' => $siteurl, 'homeurl' => $home_url, 'redirect' => rawurldecode( base64_encode( $redirect ) ), 'file' => rawurldecode( base64_encode( $file ) ), 'plugin_name' => self::NAME, ), self::UPGRADE_URL ); wp_send_json_success( array( 'url' => $url, ) ); } wp_send_json_error( array( 'message' => esc_html__( 'Could not connect.', 'reviews-feed' ) ) ); } /** * Endpoint for one-click upgrade. * * @since 4.0 */ public static function install_upgrade() { $error = esc_html__( 'Could not install upgrade. Please download from smashballoon.com and install manually.', 'reviews-feed' ); // verify params present (oth & download link). $post_oth = ! empty( $_REQUEST['oth'] ) ? sanitize_text_field( $_REQUEST['oth'] ) : ''; $post_url = ! empty( $_REQUEST['file'] ) ? $_REQUEST['file'] : ''; if ( empty( $post_oth ) || empty( $post_url ) ) { wp_send_json_error( $error ); } // Verify oth. $oth = get_option( 'sbr_one_click_upgrade' ); if ( empty( $oth ) ) { wp_send_json_error( $error ); } if ( hash_hmac( 'sha512', $oth, wp_salt() ) !== $post_oth ) { wp_send_json_error( $error ); } // Delete so cannot replay. delete_option( 'sbr_one_click_upgrade' ); // Set the current screen to avoid undefined notices. set_current_screen( self::REDIRECT ); // Prepare variables. $url = esc_url_raw( add_query_arg( array( 'page' => self::REDIRECT, ), admin_url( 'admin.php' ) ) ); // Verify pro not installed. $active = activate_plugin( self::SLUG, $url, false, true ); if ( ! is_wp_error( $active ) ) { deactivate_plugins( plugin_basename( SBR_PLUGIN_DIR ) ); wp_send_json_success( esc_html__( 'Plugin installed & activated.', 'reviews-feed' ) ); } $creds = request_filesystem_credentials( $url, '', false, false, null ); // Check for file system permissions. if ( false === $creds ) { wp_send_json_error( $error ); } if ( ! WP_Filesystem( $creds ) ) { wp_send_json_error( $error ); } // We do not need any extra credentials if we have gotten this far, so let's install the plugin. $license = get_option( 'sbr_license_key' ); if ( empty( $license ) ) { wp_send_json_error( new \WP_Error( '403', esc_html__( 'You are not licensed.', 'reviews-feed' ) ) ); } // 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. #require_once trailingslashit( SBR_PLUGIN_DIR ) . 'inc/Admin/PluginSilentUpgrader.php'; #require_once trailingslashit( SBR_PLUGIN_DIR ) . 'inc/Admin/PluginSilentUpgraderSkin.php'; #require_once trailingslashit( SBR_PLUGIN_DIR ) . 'inc/Admin/class-install-skin.php'; $installer = new \SmashBalloon\Reviews\Common\Helpers\PluginSilentUpgrader( new \SmashBalloon\Reviews\Common\Helpers\SBR_Install_Skin() ); // Error check. if ( ! method_exists( $installer, 'install' ) || empty( $post_url ) ) { wp_send_json_error( $error ); } $license_data = get_option( 'sbr_license_data' ); if ( ! empty( $license_data ) ) { $version_info = self::get_version_info( $license_data ); $file = ''; if ( isset( $version_info->package ) ) { $file = $version_info->package; } } else { wp_send_json_error( new \WP_Error( '403', esc_html__( 'You are not licensed.', 'reviews-feed' ) ) ); } if ( ! empty( $file ) ) { $installer->install( $file ); // phpcs:ignore // Check license key. // Flush the cache and return the newly installed plugin basename. wp_cache_flush(); $plugin_basename = $installer->plugin_info(); if ( $plugin_basename ) { deactivate_plugins( plugin_basename( SBR_PLUGIN_BASENAME ), true ); // Activate the plugin silently. $activated = activate_plugin( $plugin_basename ); if ( ! is_wp_error( $activated ) ) { wp_send_json_success( esc_html__( 'Plugin installed & activated.', 'reviews-feed' ) ); } else { // Reactivate the lite plugin if pro activation failed. $activated = activate_plugin( plugin_basename( SBR_PLUGIN_BASENAME ), '', false, true ); wp_send_json_error( esc_html__( 'Pro version installed but needs to be activated from the Plugins page inside your WordPress admin.', 'reviews-feed' ) ); } } } wp_send_json_error( $error ); } /** * Whether or not it's likely to be a reachable URL for upgrade * * @param string $url * * @return bool * * @since 4.0 */ public static function is_dev_url( $url = '' ) { $is_local_url = false; // Trim it up $url = strtolower( trim( $url ) ); // Need to get the host...so let's add the scheme so we can use parse_url if ( false === strpos( $url, 'http://' ) && false === strpos( $url, 'https://' ) ) { $url = 'http://' . $url; } $url_parts = parse_url( $url ); $host = ! empty( $url_parts['host'] ) ? $url_parts['host'] : false; if ( ! empty( $url ) && ! empty( $host ) ) { if ( false !== ip2long( $host ) ) { if ( ! filter_var( $host, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE ) ) { $is_local_url = true; } } elseif ( 'localhost' === $host ) { $is_local_url = true; } $tlds_to_check = array( '.local', ':8888', ':8080', ':8081', '.invalid', '.example', '.test' ); foreach ( $tlds_to_check as $tld ) { if ( false !== strpos( $host, $tld ) ) { $is_local_url = true; break; } } if ( substr_count( $host, '.' ) > 1 ) { $subdomains_to_check = array(); foreach ( $subdomains_to_check as $subdomain ) { $subdomain = str_replace( '.', '(.)', $subdomain ); $subdomain = str_replace( array( '*', '(.)' ), '(.*)', $subdomain ); if ( preg_match( '/^(' . $subdomain . ')/', $host ) ) { $is_local_url = true; break; } } } } return $is_local_url; } /** * Handle API Response and check for an error. * * @param array $response * * @return string * * @since 4.0 */ public static function get_error_message( $response ) { $message = ''; if ( isset( $response['error'] ) ) { $error = sanitize_text_field( $response['error'] ); switch ( $error ) { case 'expired': $message = __( 'This license is expired.', 'reviews-feed' ); break; default: $message = __( 'We encountered a problem unlocking the PRO features. Please install the PRO version manually.', 'reviews-feed' ); } } return $message; } }
Fatal error: Uncaught SmashBalloon\Reviews\Vendor\DI\NotFoundException: No entry or class found for 'SmashBalloon\Reviews\Common\Services\SBR_Upgrader' in /var/www/html/cronicasdorock.com.br/web/wp-content/plugins/reviews-feed/vendor/php-di/php-di/src/Container.php:115 Stack trace: #0 /var/www/html/cronicasdorock.com.br/web/wp-content/plugins/reviews-feed/class/Common/ServiceContainer.php(66): SmashBalloon\Reviews\Vendor\DI\Container->get('SmashBalloon\\Re...') #1 /var/www/html/cronicasdorock.com.br/web/wp-content/plugins/reviews-feed/bootstrap.php(143): SmashBalloon\Reviews\Common\ServiceContainer->register() #2 /var/www/html/cronicasdorock.com.br/web/wp-content/plugins/reviews-feed/sb-reviews.php(43): require_once('/var/www/html/c...') #3 /var/www/html/cronicasdorock.com.br/web/wp-settings.php(526): include_once('/var/www/html/c...') #4 /var/www/html/cronicasdorock.com.br/web/wp-config.php(104): require_once('/var/www/html/c...') #5 /var/www/html/cronicasdorock.com.br/web/wp-load.php(50): require_once('/var/www/html/c.. in /var/www/html/cronicasdorock.com.br/web/wp-content/plugins/reviews-feed/vendor/php-di/php-di/src/Container.php on line 115