@@ -218,16 +218,16 @@ function do_plugin_activate() {
218218 $ slug = isset ( $ _POST ['slug ' ] ) ? sanitize_text_field ( $ _POST ['slug ' ] ) : '' ;
219219 $ full_slug = isset ( $ _POST ['full_slug ' ] ) ? sanitize_text_field ( $ _POST ['full_slug ' ] ) : '' ;
220220 if ( ! $ slug || ! $ full_slug ) {
221- wp_send_json_error ( array ( 'status ' => 'error ' , 'message ' => 'Invalid slug. ' ), 400 );
221+ wp_send_json_error ( array ( 'status ' => 'error ' , 'message ' => __ ( 'Invalid slug. ' , STACKABLE_I18N ) ), 400 );
222222 }
223223
224224 if ( ! check_ajax_referer ( 'stk_activate_useful_plugin ' , 'nonce ' , false ) ) {
225- wp_send_json_error ( array ( 'status ' => 'error ' , 'message ' => 'Security check failed. ' ), 403 );
225+ wp_send_json_error ( array ( 'status ' => 'error ' , 'message ' => __ ( 'Security check failed. ' , STACKABLE_I18N ) ), 403 );
226226 return ;
227227 }
228228
229229 if ( ! current_user_can ( 'activate_plugins ' ) ) {
230- wp_send_json_error ( array ( 'status ' => 'error ' , 'message ' => 'Insufficient permissions. ' ), 403 );
230+ wp_send_json_error ( array ( 'status ' => 'error ' , 'message ' => __ ( 'Insufficient permissions. ' , STACKABLE_I18N ) ), 403 );
231231 return ;
232232 }
233233
@@ -241,11 +241,11 @@ function do_plugin_activate() {
241241 $ result = activate_plugin ( $ full_slug , '' , false , true );
242242
243243 if ( is_wp_error ( $ result ) ) {
244- wp_send_json_error ( array ( 'status ' => 'error ' , 'message ' => 'Failed to activate plugin. ' ), 500 );
244+ wp_send_json_error ( array ( 'status ' => 'error ' , 'message ' => __ ( 'Failed to activate plugin. ' , STACKABLE_I18N ) ), 500 );
245245 return ;
246246 }
247247
248- wp_send_json_success ( array ( 'status ' => 'success ' , 'message ' => 'Successfully activated plugin. ' ), 200 );
248+ wp_send_json_success ( array ( 'status ' => 'success ' , 'message ' => __ ( 'Successfully activated plugin. ' , STACKABLE_I18N ) ), 200 );
249249 }
250250
251251
@@ -260,7 +260,7 @@ function check_cimo_status() {
260260 $ slug = 'cimo-image-optimizer ' ;
261261 // Verify nonce
262262 if ( ! check_ajax_referer ( 'stackable_cimo_status ' , 'nonce ' , false ) ) {
263- wp_send_json_error ( array ( 'status ' => 'error ' , 'message ' => 'Security check failed. ' ), 403 );
263+ wp_send_json_error ( array ( 'status ' => 'error ' , 'message ' => __ ( 'Security check failed. ' , STACKABLE_I18N ) ), 403 );
264264 return ;
265265 }
266266
@@ -271,20 +271,20 @@ function check_cimo_status() {
271271 );
272272
273273 if ( ! $ action || ( $ action !== 'install ' && $ action !== 'activate ' ) ) {
274- wp_send_json_error ( array ( 'status ' => 'error ' , 'message ' => 'Invalid request action. ' ), 400 );
274+ wp_send_json_error ( array ( 'status ' => 'error ' , 'message ' => __ ( 'Invalid request action. ' , STACKABLE_I18N ) ), 400 );
275275 return ;
276276 }
277277
278278 if ( ( $ action === 'install ' && ! current_user_can ( 'install_plugins ' ) ) ||
279279 ( $ action === 'activate ' && ! current_user_can ( 'activate_plugins ' ) ) ) {
280- wp_send_json_error ( array ( 'status ' => 'error ' , 'message ' => 'Insufficient permissions. ' ), 403 );
280+ wp_send_json_error ( array ( 'status ' => 'error ' , 'message ' => __ ( 'Insufficient permissions. ' , STACKABLE_I18N ) ), 403 );
281281 return ;
282282 }
283283
284284 $ full_slug = self ::$ PLUGINS [ $ slug ][ 'full_slug ' ];
285285
286286 // Clear plugin cache to ensure we get the most current status
287- + wp_clean_plugins_cache ();
287+ wp_clean_plugins_cache ();
288288
289289 if ( $ action === 'install ' && ! self ::is_plugin_installed ( $ full_slug ) ) {
290290 $ response [ 'status ' ] = 'installing ' ;
0 commit comments