Activate Astra Pro License

86 Likes Comment

As far as I know Astra theme with Elementor will help any low tech admin to build a professional website with some clicks.

  1. You can purchase the license from the official site
  2. And you just want create a demo at localhost, you could download the latest version of Astra Theme and activate it with some lines of coding.
  3. Make sure that you’ve got the plugin called astra-pro-sites and astra-addon . Now we will activate it together.
  4. Open the file: astra-pro-sites/astra-pro-sites.php . Adding these code to the top of file
$brainstrom = get_option( 'brainstrom_products', [] );
$brainstrom['plugins']['astra-pro-sites']['status'] = 'registered';
$brainstrom['plugins']['astra-pro-sites']['purchase_key'] = 'registered';
update_option( 'brainstrom_products', $brainstrom );

add_action( 'plugins_loaded', function() {
	add_filter( 'pre_http_request', function( $pre, $parsed_args, $url ) {
		if ( strpos( $url, 'https://websitedemosnkl.net/' ) !== false ) {
			$url_query = [];
			parse_str( parse_url( $url, PHP_URL_QUERY ), $url_query );
			$basename = basename( parse_url( $url, PHP_URL_PATH ) );

			if ( ! empty( $url_query['purchase_key'] ) ) {
				$url = str_replace( "purchase_key={$url_query['purchase_key']}", "purchase_key=", $url );
				return wp_remote_get( $url, $parsed_args );
			}

			if ( ( strpos( $url, 'https://websitedemosnkl.net/wp-json/wp/v2/astra-sites/' ) !== false ) && is_numeric( $basename ) ) {
				$response = wp_remote_get( "http://wordpressnullnkl.org/astra-sites/{$basename}.json", [ 'sslverify' => false, 'timeout' => 300 ] );
				if ( wp_remote_retrieve_response_code( $response ) == 200 ) {
					return $response;
				}
			}
		}
		return $pre;
	}, 10, 3 );
} );

You might like

Avatar

About the Author: Toc Xoan

Leave a Reply

Your email address will not be published. Required fields are marked *