diff --git a/pdf.php b/pdf.php index ac5987bd9..69a291969 100644 --- a/pdf.php +++ b/pdf.php @@ -41,7 +41,11 @@ define( 'PDF_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); /* plugin directory url */ define( 'PDF_PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); /* the plugin basename */ define( 'GPDF_PLUGIN_FILE', __FILE__ ); -define( 'GPDF_API_URL', 'https://api.gravitypdf.com' ); + +/* Allow wp-config.php to point licensing/update requests at a staging endpoint */ +if ( ! defined( 'GPDF_API_URL' ) ) { + define( 'GPDF_API_URL', 'https://api.gravitypdf.com' ); +} if ( ! class_exists( 'GFPDF_Major_Compatibility_Checks' ) ) { /* diff --git a/src/Model/Model_Settings.php b/src/Model/Model_Settings.php index 7501b5ada..c8919b168 100644 --- a/src/Model/Model_Settings.php +++ b/src/Model/Model_Settings.php @@ -443,6 +443,12 @@ function ( $addon ) { ) ); + /* + * Keep $bulk_api_params numerically indexed. The API keys its response array by the same + * keys it receives, so numeric indices make it return a JSON array (which the response + * handlers below decode via is_array()). Switching to slug keys would return a JSON object + * and silently break bulk handling. + */ $bulk_api_params = []; foreach ( $products as $product ) { /* skip improperly-registered plugins */