Beispiel #1
0
function ewww_image_optimizer_admin_init()
{
    ewwwio_debug_message('<b>' . __FUNCTION__ . '()</b>');
    ewwwio_memory(__FUNCTION__);
    ewww_image_optimizer_init();
    if (!function_exists('is_plugin_active_for_network') && is_multisite()) {
        // need to include the plugin library for the is_plugin_active function
        require_once ABSPATH . 'wp-admin/includes/plugin.php';
    }
    if (is_multisite() && is_plugin_active_for_network(EWWW_IMAGE_OPTIMIZER_PLUGIN_FILE_REL)) {
        // set the common network settings if they have been POSTed
        if (isset($_POST['ewww_image_optimizer_delay']) && wp_verify_nonce($_REQUEST['_wpnonce'], 'ewww_image_optimizer_options-options')) {
            if (empty($_POST['ewww_image_optimizer_debug'])) {
                $_POST['ewww_image_optimizer_debug'] = '';
            }
            update_site_option('ewww_image_optimizer_debug', $_POST['ewww_image_optimizer_debug']);
            if (empty($_POST['ewww_image_optimizer_jpegtran_copy'])) {
                $_POST['ewww_image_optimizer_jpegtran_copy'] = '';
            }
            update_site_option('ewww_image_optimizer_jpegtran_copy', $_POST['ewww_image_optimizer_jpegtran_copy']);
            if (empty($_POST['ewww_image_optimizer_jpg_lossy'])) {
                $_POST['ewww_image_optimizer_jpg_lossy'] = '';
            }
            update_site_option('ewww_image_optimizer_jpg_lossy', $_POST['ewww_image_optimizer_jpg_lossy']);
            if (empty($_POST['ewww_image_optimizer_png_lossy'])) {
                $_POST['ewww_image_optimizer_png_lossy'] = '';
            }
            update_site_option('ewww_image_optimizer_png_lossy', $_POST['ewww_image_optimizer_png_lossy']);
            if (empty($_POST['ewww_image_optimizer_lossy_fast'])) {
                $_POST['ewww_image_optimizer_lossy_fast'] = '';
            }
            update_site_option('ewww_image_optimizer_lossy_fast', $_POST['ewww_image_optimizer_lossy_fast']);
            if (empty($_POST['ewww_image_optimizer_lossy_skip_full'])) {
                $_POST['ewww_image_optimizer_lossy_skip_full'] = '';
            }
            update_site_option('ewww_image_optimizer_lossy_skip_full', $_POST['ewww_image_optimizer_lossy_skip_full']);
            if (empty($_POST['ewww_image_optimizer_metadata_skip_full'])) {
                $_POST['ewww_image_optimizer_metadata_skip_full'] = '';
            }
            update_site_option('ewww_image_optimizer_metadata_skip_full', $_POST['ewww_image_optimizer_metadata_skip_full']);
            if (empty($_POST['ewww_image_optimizer_delete_originals'])) {
                $_POST['ewww_image_optimizer_delete_originals'] = '';
            }
            update_site_option('ewww_image_optimizer_delete_originals', $_POST['ewww_image_optimizer_delete_originals']);
            if (empty($_POST['ewww_image_optimizer_jpg_to_png'])) {
                $_POST['ewww_image_optimizer_jpg_to_png'] = '';
            }
            update_site_option('ewww_image_optimizer_jpg_to_png', $_POST['ewww_image_optimizer_jpg_to_png']);
            if (empty($_POST['ewww_image_optimizer_png_to_jpg'])) {
                $_POST['ewww_image_optimizer_png_to_jpg'] = '';
            }
            update_site_option('ewww_image_optimizer_png_to_jpg', $_POST['ewww_image_optimizer_png_to_jpg']);
            if (empty($_POST['ewww_image_optimizer_gif_to_png'])) {
                $_POST['ewww_image_optimizer_gif_to_png'] = '';
            }
            update_site_option('ewww_image_optimizer_gif_to_png', $_POST['ewww_image_optimizer_gif_to_png']);
            if (empty($_POST['ewww_image_optimizer_webp'])) {
                $_POST['ewww_image_optimizer_webp'] = '';
            }
            update_site_option('ewww_image_optimizer_webp', $_POST['ewww_image_optimizer_webp']);
            if (empty($_POST['ewww_image_optimizer_jpg_background'])) {
                $_POST['ewww_image_optimizer_jpg_background'] = '';
            }
            update_site_option('ewww_image_optimizer_jpg_background', ewww_image_optimizer_jpg_background($_POST['ewww_image_optimizer_jpg_background']));
            if (empty($_POST['ewww_image_optimizer_jpg_quality'])) {
                $_POST['ewww_image_optimizer_jpg_quality'] = '';
            }
            update_site_option('ewww_image_optimizer_jpg_quality', ewww_image_optimizer_jpg_quality($_POST['ewww_image_optimizer_jpg_quality']));
            if (empty($_POST['ewww_image_optimizer_disable_convert_links'])) {
                $_POST['ewww_image_optimizer_disable_convert_links'] = '';
            }
            update_site_option('ewww_image_optimizer_disable_convert_links', $_POST['ewww_image_optimizer_disable_convert_links']);
            if (empty($_POST['ewww_image_optimizer_cloud_key'])) {
                $_POST['ewww_image_optimizer_cloud_key'] = '';
            }
            update_site_option('ewww_image_optimizer_cloud_key', ewww_image_optimizer_cloud_key_sanitize($_POST['ewww_image_optimizer_cloud_key']));
            if (empty($_POST['ewww_image_optimizer_cloud_jpg'])) {
                $_POST['ewww_image_optimizer_cloud_jpg'] = '';
            }
            update_site_option('ewww_image_optimizer_cloud_jpg', $_POST['ewww_image_optimizer_cloud_jpg']);
            if (empty($_POST['ewww_image_optimizer_cloud_png'])) {
                $_POST['ewww_image_optimizer_cloud_png'] = '';
            }
            update_site_option('ewww_image_optimizer_cloud_png', $_POST['ewww_image_optimizer_cloud_png']);
            if (empty($_POST['ewww_image_optimizer_cloud_png_compress'])) {
                $_POST['ewww_image_optimizer_cloud_png_compress'] = '';
            }
            update_site_option('ewww_image_optimizer_cloud_png_compress', $_POST['ewww_image_optimizer_cloud_png_compress']);
            if (empty($_POST['ewww_image_optimizer_cloud_gif'])) {
                $_POST['ewww_image_optimizer_cloud_gif'] = '';
            }
            update_site_option('ewww_image_optimizer_cloud_gif', $_POST['ewww_image_optimizer_cloud_gif']);
            if (empty($_POST['ewww_image_optimizer_auto'])) {
                $_POST['ewww_image_optimizer_auto'] = '';
            }
            update_site_option('ewww_image_optimizer_auto', $_POST['ewww_image_optimizer_auto']);
            if (empty($_POST['ewww_image_optimizer_aux_paths'])) {
                $_POST['ewww_image_optimizer_aux_paths'] = '';
            }
            update_site_option('ewww_image_optimizer_aux_paths', ewww_image_optimizer_aux_paths_sanitize($_POST['ewww_image_optimizer_aux_paths']));
            if (empty($_POST['ewww_image_optimizer_enable_cloudinary'])) {
                $_POST['ewww_image_optimizer_enable_cloudinary'] = '';
            }
            update_site_option('ewww_image_optimizer_enable_cloudinary', $_POST['ewww_image_optimizer_enable_cloudinary']);
            if (empty($_POST['ewww_image_optimizer_delay'])) {
                $_POST['ewww_image_optimizer_delay'] = '';
            }
            update_site_option('ewww_image_optimizer_delay', intval($_POST['ewww_image_optimizer_delay']));
            if (empty($_POST['ewww_image_optimizer_disable_resizes'])) {
                $_POST['ewww_image_optimizer_disable_resizes'] = array();
            }
            update_site_option('ewww_image_optimizer_disable_resizes', $_POST['ewww_image_optimizer_disable_resizes']);
            if (empty($_POST['ewww_image_optimizer_disable_resizes_opt'])) {
                $_POST['ewww_image_optimizer_disable_resizes_opt'] = array();
            }
            update_site_option('ewww_image_optimizer_disable_resizes_opt', $_POST['ewww_image_optimizer_disable_resizes_opt']);
            if (empty($_POST['ewww_image_optimizer_skip_size'])) {
                $_POST['ewww_image_optimizer_skip_size'] = '';
            }
            update_site_option('ewww_image_optimizer_skip_size', intval($_POST['ewww_image_optimizer_skip_size']));
            if (empty($_POST['ewww_image_optimizer_skip_png_size'])) {
                $_POST['ewww_image_optimizer_skip_png_size'] = '';
            }
            update_site_option('ewww_image_optimizer_skip_png_size', intval($_POST['ewww_image_optimizer_skip_png_size']));
            if (empty($_POST['ewww_image_optimizer_noauto'])) {
                $_POST['ewww_image_optimizer_noauto'] = '';
            }
            update_site_option('ewww_image_optimizer_noauto', $_POST['ewww_image_optimizer_noauto']);
            if (empty($_POST['ewww_image_optimizer_defer'])) {
                $_POST['ewww_image_optimizer_defer'] = '';
            }
            update_site_option('ewww_image_optimizer_defer', $_POST['ewww_image_optimizer_defer']);
            if (empty($_POST['ewww_image_optimizer_include_media_paths'])) {
                $_POST['ewww_image_optimizer_include_media_paths'] = '';
            }
            update_site_option('ewww_image_optimizer_include_media_paths', $_POST['ewww_image_optimizer_include_media_paths']);
            if (empty($_POST['ewww_image_optimizer_webp_for_cdn'])) {
                $_POST['ewww_image_optimizer_webp_for_cdn'] = '';
            }
            update_site_option('ewww_image_optimizer_webp_for_cdn', $_POST['ewww_image_optimizer_webp_for_cdn']);
            //if (empty($_POST['ewww_image_optimizer_webp_cdn_path'])) $_POST['ewww_image_optimizer_webp_cdn_path'] = '';
            //update_site_option('ewww_image_optimizer_webp_cdn_path', $_POST['ewww_image_optimizer_webp_cdn_path']);
            add_action('network_admin_notices', 'ewww_image_optimizer_network_settings_saved');
        }
    }
    // register all the common EWWW IO settings
    register_setting('ewww_image_optimizer_options', 'ewww_image_optimizer_debug');
    register_setting('ewww_image_optimizer_options', 'ewww_image_optimizer_jpegtran_copy');
    register_setting('ewww_image_optimizer_options', 'ewww_image_optimizer_jpg_lossy');
    register_setting('ewww_image_optimizer_options', 'ewww_image_optimizer_png_lossy');
    register_setting('ewww_image_optimizer_options', 'ewww_image_optimizer_lossy_fast');
    register_setting('ewww_image_optimizer_options', 'ewww_image_optimizer_lossy_skip_full');
    register_setting('ewww_image_optimizer_options', 'ewww_image_optimizer_metadata_skip_full');
    register_setting('ewww_image_optimizer_options', 'ewww_image_optimizer_delete_originals');
    register_setting('ewww_image_optimizer_options', 'ewww_image_optimizer_jpg_to_png');
    register_setting('ewww_image_optimizer_options', 'ewww_image_optimizer_png_to_jpg');
    register_setting('ewww_image_optimizer_options', 'ewww_image_optimizer_gif_to_png');
    register_setting('ewww_image_optimizer_options', 'ewww_image_optimizer_webp');
    register_setting('ewww_image_optimizer_options', 'ewww_image_optimizer_jpg_background', 'ewww_image_optimizer_jpg_background');
    register_setting('ewww_image_optimizer_options', 'ewww_image_optimizer_jpg_quality', 'ewww_image_optimizer_jpg_quality');
    register_setting('ewww_image_optimizer_options', 'ewww_image_optimizer_disable_convert_links');
    register_setting('ewww_image_optimizer_options', 'ewww_image_optimizer_bulk_resume');
    register_setting('ewww_image_optimizer_options', 'ewww_image_optimizer_bulk_attachments');
    register_setting('ewww_image_optimizer_options', 'ewww_image_optimizer_aux_resume');
    register_setting('ewww_image_optimizer_options', 'ewww_image_optimizer_aux_attachments');
    register_setting('ewww_image_optimizer_options', 'ewww_image_optimizer_aux_type');
    register_setting('ewww_image_optimizer_options', 'ewww_image_optimizer_cloud_key', 'ewww_image_optimizer_cloud_key_sanitize');
    register_setting('ewww_image_optimizer_options', 'ewww_image_optimizer_cloud_jpg');
    register_setting('ewww_image_optimizer_options', 'ewww_image_optimizer_cloud_png');
    register_setting('ewww_image_optimizer_options', 'ewww_image_optimizer_cloud_png_compress');
    register_setting('ewww_image_optimizer_options', 'ewww_image_optimizer_cloud_gif');
    register_setting('ewww_image_optimizer_options', 'ewww_image_optimizer_auto');
    register_setting('ewww_image_optimizer_options', 'ewww_image_optimizer_aux_paths', 'ewww_image_optimizer_aux_paths_sanitize');
    register_setting('ewww_image_optimizer_options', 'ewww_image_optimizer_enable_cloudinary');
    register_setting('ewww_image_optimizer_options', 'ewww_image_optimizer_delay', 'intval');
    register_setting('ewww_image_optimizer_options', 'ewww_image_optimizer_disable_resizes');
    register_setting('ewww_image_optimizer_options', 'ewww_image_optimizer_disable_resizes_opt');
    register_setting('ewww_image_optimizer_options', 'ewww_image_optimizer_skip_size', 'intval');
    register_setting('ewww_image_optimizer_options', 'ewww_image_optimizer_skip_png_size', 'intval');
    register_setting('ewww_image_optimizer_options', 'ewww_image_optimizer_import_status');
    register_setting('ewww_image_optimizer_options', 'ewww_image_optimizer_noauto');
    register_setting('ewww_image_optimizer_options', 'ewww_image_optimizer_defer');
    register_setting('ewww_image_optimizer_options', 'ewww_image_optimizer_include_media_paths');
    register_setting('ewww_image_optimizer_options', 'ewww_image_optimizer_webp_for_cdn');
    //	register_setting('ewww_image_optimizer_options', 'ewww_image_optimizer_webp_cdn_path');
    ewww_image_optimizer_exec_init();
    ewww_image_optimizer_cron_setup('ewww_image_optimizer_auto');
    ewww_image_optimizer_cron_setup('ewww_image_optimizer_defer');
    // require the files that do the bulk processing
    require_once EWWW_IMAGE_OPTIMIZER_PLUGIN_PATH . 'bulk.php';
    require_once EWWW_IMAGE_OPTIMIZER_PLUGIN_PATH . 'aux-optimize.php';
    require_once EWWW_IMAGE_OPTIMIZER_PLUGIN_PATH . 'mwebp.php';
    // queue the function that contains custom styling for our progressbars, but only in wp 3.8+
    global $wp_version;
    if (substr($wp_version, 0, 3) >= 3.8) {
        add_action('admin_enqueue_scripts', 'ewww_image_optimizer_progressbar_style');
    }
    ewwwio_memory(__FUNCTION__);
    //	ewww_image_optimizer_debug_log();
}
Beispiel #2
0
function ewww_image_optimizer_admin_init() {
	ewwwio_debug_message( '<b>' . __FUNCTION__ . '()</b>' );
	ewwwio_memory( __FUNCTION__ );
	ewww_image_optimizer_init();
	if ( ! function_exists( 'is_plugin_active_for_network' ) && is_multisite() ) {
		// need to include the plugin library for the is_plugin_active function
		require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
	}
	if ( is_multisite() && is_plugin_active_for_network(EWWW_IMAGE_OPTIMIZER_PLUGIN_FILE_REL ) ) {
		// set the common network settings if they have been POSTed
		if ( isset( $_POST['ewww_image_optimizer_delay'] ) && current_user_can( 'manage_options' ) && wp_verify_nonce( $_REQUEST['_wpnonce'], 'ewww_image_optimizer_options-options' ) ) {
			ewwwio_debug_message( print_r( $_POST, true ) );
			$_POST['ewww_image_optimizer_debug'] = ( empty( $_POST['ewww_image_optimizer_debug'] ) ? false : true );
			update_site_option( 'ewww_image_optimizer_debug', $_POST['ewww_image_optimizer_debug'] );
			$_POST['ewww_image_optimizer_jpegtran_copy'] = ( empty( $_POST['ewww_image_optimizer_jpegtran_copy'] ) ? false : true );
			update_site_option( 'ewww_image_optimizer_jpegtran_copy', $_POST['ewww_image_optimizer_jpegtran_copy'] );
			if ( empty( $_POST['ewww_image_optimizer_jpg_level'] ) ) $_POST['ewww_image_optimizer_jpg_level'] = '';
			update_site_option( 'ewww_image_optimizer_jpg_level', (int) $_POST['ewww_image_optimizer_jpg_level'] );
			if ( empty( $_POST[ 'ewww_image_optimizer_png_level'] ) ) $_POST['ewww_image_optimizer_png_level'] = '';
			update_site_option( 'ewww_image_optimizer_png_level', (int) $_POST['ewww_image_optimizer_png_level'] );
			if ( empty( $_POST['ewww_image_optimizer_gif_level'] ) ) $_POST['ewww_image_optimizer_gif_level'] = '';
			update_site_option( 'ewww_image_optimizer_gif_level', (int) $_POST['ewww_image_optimizer_gif_level'] );
			if ( empty( $_POST['ewww_image_optimizer_pdf_level'] ) ) $_POST['ewww_image_optimizer_pdf_level'] = '';
			update_site_option( 'ewww_image_optimizer_pdf_level', (int) $_POST['ewww_image_optimizer_pdf_level'] );
			$_POST['ewww_image_optimizer_lossy_skip_full'] = ( empty( $_POST['ewww_image_optimizer_lossy_skip_full'] ) ? false : true );
			update_site_option( 'ewww_image_optimizer_lossy_skip_full', $_POST['ewww_image_optimizer_lossy_skip_full'] );
			$_POST['ewww_image_optimizer_metadata_skip_full'] = ( empty( $_POST['ewww_image_optimizer_metadata_skip_full'] ) ? false : true );
			update_site_option( 'ewww_image_optimizer_metadata_skip_full', $_POST['ewww_image_optimizer_metadata_skip_full'] );
			$_POST['ewww_image_optimizer_delete_originals'] = ( empty( $_POST['ewww_image_optimizer_delete_originals'] ) ? false : true );
			update_site_option( 'ewww_image_optimizer_delete_originals', $_POST['ewww_image_optimizer_delete_originals'] );
			$_POST['ewww_image_optimizer_jpg_to_png'] = ( empty( $_POST['ewww_image_optimizer_jpg_to_png'] ) ? false : true );
			update_site_option( 'ewww_image_optimizer_jpg_to_png', $_POST['ewww_image_optimizer_jpg_to_png'] );
			$_POST['ewww_image_optimizer_png_to_jpg'] = ( empty( $_POST['ewww_image_optimizer_png_to_jpg'] ) ? false : true );
			update_site_option( 'ewww_image_optimizer_png_to_jpg', $_POST['ewww_image_optimizer_png_to_jpg'] );
			$_POST['ewww_image_optimizer_gif_to_png'] = ( empty( $_POST['ewww_image_optimizer_gif_to_png'] ) ? false : true );
			update_site_option( 'ewww_image_optimizer_gif_to_png', $_POST['ewww_image_optimizer_gif_to_png'] );
			$_POST['ewww_image_optimizer_webp'] = ( empty( $_POST['ewww_image_optimizer_webp'] ) ? false : true );
			update_site_option( 'ewww_image_optimizer_webp', $_POST['ewww_image_optimizer_webp'] );
			if (empty($_POST['ewww_image_optimizer_jpg_background'])) $_POST['ewww_image_optimizer_jpg_background'] = '';
			update_site_option( 'ewww_image_optimizer_jpg_background', ewww_image_optimizer_jpg_background( $_POST['ewww_image_optimizer_jpg_background'] ) );
			if (empty($_POST['ewww_image_optimizer_jpg_quality'])) $_POST['ewww_image_optimizer_jpg_quality'] = '';
			update_site_option( 'ewww_image_optimizer_jpg_quality', ewww_image_optimizer_jpg_quality( $_POST['ewww_image_optimizer_jpg_quality'] ) );
			$_POST['ewww_image_optimizer_disable_convert_links'] = ( empty( $_POST['ewww_image_optimizer_disable_convert_links'] ) ? false : true );
			update_site_option( 'ewww_image_optimizer_disable_convert_links', $_POST['ewww_image_optimizer_disable_convert_links'] );
			if ( empty( $_POST['ewww_image_optimizer_cloud_key'] ) ) $_POST['ewww_image_optimizer_cloud_key'] = '';
			update_site_option( 'ewww_image_optimizer_cloud_key', ewww_image_optimizer_cloud_key_sanitize( $_POST['ewww_image_optimizer_cloud_key'] ) );
			$_POST['ewww_image_optimizer_auto'] = ( empty( $_POST['ewww_image_optimizer_auto'] ) ? false : true );
			update_site_option('ewww_image_optimizer_auto', $_POST['ewww_image_optimizer_auto']);
			if ( empty( $_POST['ewww_image_optimizer_aux_paths'] ) ) $_POST['ewww_image_optimizer_aux_paths'] = '';
			update_site_option( 'ewww_image_optimizer_aux_paths', ewww_image_optimizer_aux_paths_sanitize( $_POST['ewww_image_optimizer_aux_paths'] ) );
			$_POST['ewww_image_optimizer_enable_cloudinary'] = ( empty( $_POST['ewww_image_optimizer_enable_cloudinary'] ) ? false : true );
			update_site_option('ewww_image_optimizer_enable_cloudinary', $_POST['ewww_image_optimizer_enable_cloudinary']);
			if ( empty( $_POST['ewww_image_optimizer_delay'] ) ) $_POST['ewww_image_optimizer_delay'] = '';
			update_site_option( 'ewww_image_optimizer_delay', (int) $_POST['ewww_image_optimizer_delay'] );
			if ( empty( $_POST['ewww_image_optimizer_maxmediawidth'] ) ) $_POST['ewww_image_optimizer_maxmediawidth'] = 0;
			update_site_option( 'ewww_image_optimizer_maxmediawidth', (int) $_POST['ewww_image_optimizer_maxmediawidth'] );
			if ( empty( $_POST['ewww_image_optimizer_maxmediaheight'] ) ) $_POST['ewww_image_optimizer_maxmediaheight'] = 0;
			update_site_option( 'ewww_image_optimizer_maxmediaheight', (int) $_POST['ewww_image_optimizer_maxmediaheight'] );
			if ( empty( $_POST['ewww_image_optimizer_maxotherwidth'] ) ) $_POST['ewww_image_optimizer_maxotherwidth'] = 0;
			update_site_option( 'ewww_image_optimizer_maxotherwidth', (int) $_POST['ewww_image_optimizer_maxotherwidth'] );
			if ( empty( $_POST['ewww_image_optimizer_maxotherheight'] ) ) $_POST['ewww_image_optimizer_maxotherheight'] = 0;
			update_site_option( 'ewww_image_optimizer_maxotherheight', (int) $_POST['ewww_image_optimizer_maxotherheight'] );
			$_POST['ewww_image_optimizer_resize_existing'] = ( empty( $_POST['ewww_image_optimizer_resize_existing'] ) ? false : true );
			update_site_option( 'ewww_image_optimizer_resize_existing', $_POST['ewww_image_optimizer_resize_existing'] );
			if (empty($_POST['ewww_image_optimizer_disable_resizes'])) $_POST['ewww_image_optimizer_disable_resizes'] = array();
			update_site_option('ewww_image_optimizer_disable_resizes', $_POST['ewww_image_optimizer_disable_resizes']);
			if (empty($_POST['ewww_image_optimizer_disable_resizes_opt'])) $_POST['ewww_image_optimizer_disable_resizes_opt'] = array();
			update_site_option('ewww_image_optimizer_disable_resizes_opt', $_POST['ewww_image_optimizer_disable_resizes_opt']);
			if (empty($_POST['ewww_image_optimizer_skip_size'])) $_POST['ewww_image_optimizer_skip_size'] = '';
			update_site_option('ewww_image_optimizer_skip_size', (int) $_POST['ewww_image_optimizer_skip_size'] );
			if (empty($_POST['ewww_image_optimizer_skip_png_size'])) $_POST['ewww_image_optimizer_skip_png_size'] = '';
			update_site_option('ewww_image_optimizer_skip_png_size', (int) $_POST['ewww_image_optimizer_skip_png_size'] );
			$_POST['ewww_image_optimizer_parallel_optimization'] = ( empty( $_POST['ewww_image_optimizer_parallel_optimization'] ) ? false : true );
			update_site_option('ewww_image_optimizer_parallel_optimization', $_POST['ewww_image_optimizer_parallel_optimization']);
//			$_POST['ewww_image_optimizer_defer'] = ( empty( $_POST['ewww_image_optimizer_defer'] ) ? false : true );
//			update_site_option('ewww_image_optimizer_defer', $_POST['ewww_image_optimizer_defer']);
			$_POST['ewww_image_optimizer_include_media_paths'] = ( empty( $_POST['ewww_image_optimizer_include_media_paths'] ) ? false : true );
			update_site_option('ewww_image_optimizer_include_media_paths', $_POST['ewww_image_optimizer_include_media_paths']);
			$_POST['ewww_image_optimizer_webp_for_cdn'] = ( empty( $_POST['ewww_image_optimizer_webp_for_cdn'] ) ? false : true );
			update_site_option('ewww_image_optimizer_webp_for_cdn', $_POST['ewww_image_optimizer_webp_for_cdn']);
			//if (empty($_POST['ewww_image_optimizer_webp_cdn_path'])) $_POST['ewww_image_optimizer_webp_cdn_path'] = '';
			//update_site_option('ewww_image_optimizer_webp_cdn_path', $_POST['ewww_image_optimizer_webp_cdn_path']);
			add_action('network_admin_notices', 'ewww_image_optimizer_network_settings_saved');
		}
	}
	// register all the common EWWW IO settings
	register_setting( 'ewww_image_optimizer_options', 'ewww_image_optimizer_debug', 'boolval' );
	register_setting( 'ewww_image_optimizer_options', 'ewww_image_optimizer_jpegtran_copy', 'boolval' );
	register_setting( 'ewww_image_optimizer_options', 'ewww_image_optimizer_jpg_level', 'intval' );
	register_setting( 'ewww_image_optimizer_options', 'ewww_image_optimizer_png_level', 'intval' );
	register_setting( 'ewww_image_optimizer_options', 'ewww_image_optimizer_gif_level', 'intval' );
	register_setting( 'ewww_image_optimizer_options', 'ewww_image_optimizer_pdf_level', 'intval' );
	register_setting( 'ewww_image_optimizer_options', 'ewww_image_optimizer_lossy_skip_full', 'boolval' );
	register_setting( 'ewww_image_optimizer_options', 'ewww_image_optimizer_metadata_skip_full', 'boolval' );
	register_setting( 'ewww_image_optimizer_options', 'ewww_image_optimizer_delete_originals', 'boolval' );
	register_setting( 'ewww_image_optimizer_options', 'ewww_image_optimizer_jpg_to_png', 'boolval' );
	register_setting( 'ewww_image_optimizer_options', 'ewww_image_optimizer_png_to_jpg', 'boolval' );
	register_setting( 'ewww_image_optimizer_options', 'ewww_image_optimizer_gif_to_png', 'boolval' );
	register_setting( 'ewww_image_optimizer_options', 'ewww_image_optimizer_webp', 'boolval' );
	register_setting( 'ewww_image_optimizer_options', 'ewww_image_optimizer_jpg_background', 'ewww_image_optimizer_jpg_background' );
	register_setting( 'ewww_image_optimizer_options', 'ewww_image_optimizer_jpg_quality', 'ewww_image_optimizer_jpg_quality' );
	register_setting( 'ewww_image_optimizer_options', 'ewww_image_optimizer_disable_convert_links', 'boolval' );
	register_setting( 'ewww_image_optimizer_options', 'ewww_image_optimizer_bulk_resume' );
	register_setting( 'ewww_image_optimizer_options', 'ewww_image_optimizer_bulk_attachments' );
	register_setting( 'ewww_image_optimizer_options', 'ewww_image_optimizer_aux_resume' );
	register_setting( 'ewww_image_optimizer_options', 'ewww_image_optimizer_aux_attachments' );
	register_setting( 'ewww_image_optimizer_options', 'ewww_image_optimizer_cloud_key', 'ewww_image_optimizer_cloud_key_sanitize' );
	register_setting( 'ewww_image_optimizer_options', 'ewww_image_optimizer_auto', 'boolval' );
	register_setting( 'ewww_image_optimizer_options', 'ewww_image_optimizer_aux_paths', 'ewww_image_optimizer_aux_paths_sanitize' );
	register_setting( 'ewww_image_optimizer_options', 'ewww_image_optimizer_enable_cloudinary', 'boolval' );
	register_setting( 'ewww_image_optimizer_options', 'ewww_image_optimizer_delay', 'intval' );
	register_setting( 'ewww_image_optimizer_options', 'ewww_image_optimizer_maxmediawidth', 'intval' );
	register_setting( 'ewww_image_optimizer_options', 'ewww_image_optimizer_maxmediaheight', 'intval' );
	register_setting( 'ewww_image_optimizer_options', 'ewww_image_optimizer_maxotherwidth', 'intval' );
	register_setting( 'ewww_image_optimizer_options', 'ewww_image_optimizer_maxotherheight', 'intval' );
	register_setting( 'ewww_image_optimizer_options', 'ewww_image_optimizer_resize_existing', 'boolval' );
	register_setting( 'ewww_image_optimizer_options', 'ewww_image_optimizer_disable_resizes', 'ewww_image_optimizer_disable_resizes_sanitize' );
	register_setting( 'ewww_image_optimizer_options', 'ewww_image_optimizer_disable_resizes_opt', 'ewww_image_optimizer_disable_resizes_sanitize' );
	register_setting( 'ewww_image_optimizer_options', 'ewww_image_optimizer_skip_size', 'intval' );
	register_setting( 'ewww_image_optimizer_options', 'ewww_image_optimizer_skip_png_size', 'intval' );
	register_setting( 'ewww_image_optimizer_options', 'ewww_image_optimizer_import_status' );
	register_setting( 'ewww_image_optimizer_options', 'ewww_image_optimizer_parallel_optimization', 'boolval' );
//	register_setting( 'ewww_image_optimizer_options', 'ewww_image_optimizer_defer', 'boolval' );
	register_setting( 'ewww_image_optimizer_options', 'ewww_image_optimizer_include_media_paths', 'boolval' );
	register_setting( 'ewww_image_optimizer_options', 'ewww_image_optimizer_webp_for_cdn', 'boolval' );
//	register_setting( 'ewww_image_optimizer_options', 'ewww_image_optimizer_webp_cdn_path' );
	ewww_image_optimizer_exec_init();
	ewww_image_optimizer_cron_setup( 'ewww_image_optimizer_auto' );
//	ewww_image_optimizer_cron_setup( 'ewww_image_optimizer_defer' );
	// require the files that do the bulk processing 
	require_once( EWWW_IMAGE_OPTIMIZER_PLUGIN_PATH . 'bulk.php' );
	require_once( EWWW_IMAGE_OPTIMIZER_PLUGIN_PATH . 'aux-optimize.php' );
	require_once( EWWW_IMAGE_OPTIMIZER_PLUGIN_PATH . 'mwebp.php' );
	// queue the function that contains custom styling for our progressbars
	add_action('admin_enqueue_scripts', 'ewww_image_optimizer_progressbar_style'); 
	ewwwio_memory( __FUNCTION__ );
//	ewww_image_optimizer_debug_log();
}