create( 'ShortPixel\CriticalCSS' ); } function shortpixel_critical_css_container($env = 'prod' ) { static $container; if ( empty( $container ) ) { $container = new Dice(); include __DIR__ . "/config_{$env}.php"; } return $container; } /** * Init function shortcut */ function shortpixel_critical_css_init() { shortpixel_critical_css()->init(); $settings = shortpixel_critical_css()->settings_manager->get_settings(); if( empty($settings['ccss_spio_apikey_found_dismissed']) && !ApiKeyTools::getApiKey() && ApiKeyTools::getSPIOApiKey() ) { add_action( 'admin_notices', 'shortpixel_critical_css_spio_apikey_found' ); } if(defined('DISABLE_WP_CRON') && DISABLE_WP_CRON && empty($settings['ccss_cron_disabled_notice_dismissed'])) { add_action( 'admin_notices', 'shortpixel_critical_css_cron_disabled_notice' ); } } /** * API run function shortcut */ function shortpixel_critical_css_api_run() { return shortpixel_critical_css()->api_run(intval($_POST['queue_id'])); } /** * API remove function shortcut */ function shortpixel_critical_css_api_remove() { return shortpixel_critical_css()->api_queue_remove(intval($_POST['queue_id'])); } function shortpixel_critical_css_web_run() { return shortpixel_critical_css()->web_queue_run(intval($_POST['queue_id'])); } function shortpixel_critical_css_web_remove() { return shortpixel_critical_css()->web_queue_remove(intval($_POST['queue_id'])); } /** * Get CSS function shortcut */ function shortpixel_critical_css_get() { return shortpixel_critical_css()->get_ccss(); } /** * Contact function shortcut */ function shortpixel_critical_css_contact() { return shortpixel_critical_css()->contact(); } /** * Contact function shortcut */ function shortpixel_critical_css_usekey() { return shortpixel_critical_css()->use_spio_key(); } function shortpixel_critical_css_getapikey() { return shortpixel_critical_css()->get_apikey(); } function shortpixel_critical_css_updateapikey() { return shortpixel_critical_css()->update_apikey(); } function shortpixel_critical_css_dismiss() { return shortpixel_critical_css()->dismiss_notification(); } function shortpixel_critical_css_switch_theme() { return shortpixel_critical_css()->switch_theme(); } function shortpixel_critical_css_force_web_check() { return shortpixel_critical_css()->force_web_check(); } /** * Activate function shortcut */ function shortpixel_critical_css_activate() { shortpixel_critical_css()->init(); shortpixel_critical_css()->activate(); } /** * Deactivate function shortcut */ function shortpixel_critical_css_deactivate() { shortpixel_critical_css()->deactivate(); } /** * Error for older php */ function shortpixel_critical_css_php_upgrade_notice() { $info = get_plugin_data( __FILE__ ); _e( sprintf( '
Oops! %s requires a minimum PHP version of 5.4.0. Your current version is: %s. Please contact your host to upgrade.
You already have a ShortPixel account for this website. Do you want to use ShortPixel Critical CSS with this account?
Opps! %s is corrupted it seems, please re-install the plugin.
Permalinks Settings and choose any option except Plain. If the Permalinks are not set to plain, you might need to check with your hosting or admin why the rewrites are not working.' ); ?>