public function ajax_generate_template() {
check_ajax_referer( 'ftl_ajax_nonce', 'nonce' );
$object_id = intval( $_POST['object_id'] );
$object_type = sanitize_text_field( $_POST['object_type'] );
$use_custom = intval( $_POST['use_custom'] ) === 1;
$update_meta = function($k, $v) use ($object_id, $object_type) { $object_type === 'term' ? update_term_meta( $object_id, $k, $v ) : update_post_meta( $object_id, $k, $v ); };
$update_meta( '_ftl_use_custom_settings', $use_custom ? '1' : '0' );
$url = $object_type === 'term' ? get_term_link( $object_id ) : get_permalink( $object_id );
$html = wp_remote_retrieve_body( wp_remote_get( add_query_arg( 'ftl_bypass', '1', $url ), array( 'timeout' => 30, 'sslverify' => false ) ) );
$global_quality = get_option('ftl_global_image_quality', '80');
if ( $use_custom ) {
$update_meta( '_ftl_selected_assets', array(
'css' => isset( $_POST['selected_css'] ) ? (array) $_POST['selected_css'] : array(),
'js' => isset( $_POST['selected_js'] ) ? (array) $_POST['selected_js'] : array(),
'images' => isset( $_POST['selected_images'] ) ? (array) $_POST['selected_images'] : array()
));
$options = array(
'auto_unify' => false,
'minify_html' => get_option('ftl_global_minify_html', '1') === '1',
'image_quality' => $global_quality,
'selected_css' => isset( $_POST['selected_css'] ) ? (array) $_POST['selected_css'] : array(),
'selected_js' => isset( $_POST['selected_js'] ) ? (array) $_POST['selected_js'] : array(),
'selected_images' => isset( $_POST['selected_images'] ) ? (array) $_POST['selected_images'] : array(),
);
} else {
$options = array(
'auto_unify' => true,
'minify_html' => get_option('ftl_global_minify_html', '1') === '1',
'unify_css' => get_option('ftl_global_unify_css', '1') === '1',
'unify_js' => get_option('ftl_global_unify_js', '1') === '1',
'optimize_images' => get_option('ftl_global_optimize_images', '1') === '1',
'image_quality' => $global_quality,
'exclude_scripts' => get_option('ftl_global_exclude_scripts', ''),
'exclude_styles' => get_option('ftl_global_exclude_styles', ''),
'exclude_images' => get_option('ftl_global_exclude_images', ''),
);
}
$cache = new FTL_Cache();
$cache->save_template( $object_id, $object_type, $html, $options );
wp_send_json_success();
}
Fatal error: Uncaught Error: Class "FTL_Admin" not found in /home/homologacentral/public_html/wp-content/plugins/headless-pwa-wp/wp-ftl-enhancer.php:24
Stack trace:
#0 /home/homologacentral/public_html/wp-content/plugins/headless-pwa-wp/wp-ftl-enhancer.php(28): run_wp_ftl_enhancer()
#1 /home/homologacentral/public_html/wp-settings.php(528): include_once('/home/homologac...')
#2 /home/homologacentral/public_html/wp-config.php(117): require_once('/home/homologac...')
#3 /home/homologacentral/public_html/wp-load.php(50): require_once('/home/homologac...')
#4 /home/homologacentral/public_html/wp-blog-header.php(13): require_once('/home/homologac...')
#5 /home/homologacentral/public_html/index.php(17): require('/home/homologac...')
#6 {main}
thrown in /home/homologacentral/public_html/wp-content/plugins/headless-pwa-wp/wp-ftl-enhancer.php on line 24