' . esc_html__( 'Warm the cache', 'tibospeed' ) . '' . esc_html__( 'Opens every page once so the first visitor gets the fast version too.', 'tibospeed' ) . '
';
echo '
' . esc_html__( 'Convert images to WebP', 'tibospeed' ) . '' . esc_html( $wleft ? sprintf( /* translators: %s: number of images */ __( '%s images are waiting to be converted.', 'tibospeed' ), number_format_i18n( $wleft ) ) : __( 'All images are converted.', 'tibospeed' ) ) . '
';
echo '
' . esc_html__( 'Clean the database', 'tibospeed' ) . '' . esc_html( $junk ? sprintf( /* translators: %s: number of records */ __( '%s unnecessary records (revisions, spam, expired data…).', 'tibospeed' ), number_format_i18n( $junk ) ) : __( 'Nothing to clean.', 'tibospeed' ) ) . '
';
tibospeed_card( __( 'Speed profile', 'tibospeed' ), __( 'Applied with one click; you can change individual settings on the tabs later.', 'tibospeed' ) );
echo '
';
}
}
/**
* Pro özellikleri.
*
* @return array
*/
function tibospeed_pro_features() {
return array(
array( __( 'Cloud-free critical CSS:', 'tibospeed' ), __( 'For each page type, the CSS visible on screen is measured on your site and inlined; the rest loads without blocking.', 'tibospeed' ) ),
array( __( 'Measured LCP:', 'tibospeed' ), __( 'The largest image is actually measured on mobile and desktop and given priority.', 'tibospeed' ) ),
array( __( 'Real visitor speed:', 'tibospeed' ), __( 'The LCP, INP and CLS your visitors experience, page by page (cookieless).', 'tibospeed' ) ),
array( __( 'Self-healing optimization:', 'tibospeed' ), __( 'If a delayed script causes errors for visitors, it is excluded automatically.', 'tibospeed' ) ),
array( __( 'AVIF and CDN:', 'tibospeed' ), __( 'Even smaller images and rewriting to your own CDN address.', 'tibospeed' ) ),
);
}
/**
* Önbellek.
*/
function tibospeed_tab_onbellek() {
tibospeed_card( __( 'Page cache', 'tibospeed' ), __( 'Pages are stored as ready-made HTML files. On Apache and LiteSpeed servers, these files are served without running PHP or WordPress at all: static-site speed.', 'tibospeed' ) );
tibospeed_f_toggle( 'cache', __( 'Page cache', 'tibospeed' ), __( 'Logged-in users, visitors with items in the cart, and cart / checkout / account pages are excluded from the cache automatically.', 'tibospeed' ) );
tibospeed_f_num( 'cache_hours', __( 'Cache lifetime', 'tibospeed' ), __( 'hours. When content changes, the related pages are refreshed instantly anyway; this lifetime is a safety net.', 'tibospeed' ), 1, 720 );
tibospeed_f_toggle( 'preload', __( 'Automatic preload', 'tibospeed' ), __( 'Purged pages are rebuilt in the background right away; visitors never get a slow page.', 'tibospeed' ) );
tibospeed_f_toggle( 'cache_mobile', __( 'Separate cache for mobile', 'tibospeed' ), __( 'Turn on only if your theme outputs different HTML on mobile (not needed for responsive themes or WebTibo themes).', 'tibospeed' ) );
tibospeed_f_toggle( 'browser_cache', __( 'Browser cache and compression', 'tibospeed' ), __( '1-year browser caching and gzip compression for images, CSS, JS and fonts (.htaccess).', 'tibospeed' ) );
echo '
' . esc_html__( 'Smart purge', 'tibospeed' ) . '
' . esc_html__( 'When a post is updated, only that post, the home page, its categories, tags, author page and (for products) the shop page are refreshed. Site-wide changes such as menus, theme settings, Elementor templates or plugin updates refresh the whole cache. No setup needed.', 'tibospeed' ) . '
';
echo '';
}
/**
* CSS ve JavaScript.
*/
function tibospeed_tab_dosyalar() {
tibospeed_card( __( 'JavaScript', 'tibospeed' ), __( 'JavaScript is what slows page loading down the most.', 'tibospeed' ) );
tibospeed_f_toggle( 'js_defer', __( 'Safe defer', 'tibospeed' ), __( 'Scripts run after the page is rendered. WordPress\'s own safety rules are used: a script that would break if deferred is loaded normally.', 'tibospeed' ), __( 'Risk: very low', 'tibospeed' ) );
tibospeed_f_choice(
'js_delay',
__( 'Delay until first interaction', 'tibospeed' ),
array(
'off' => array( __( 'Off', 'tibospeed' ), __( 'No scripts are delayed.', 'tibospeed' ) ),
'third' => array( __( 'Analytics, ad and chat scripts', 'tibospeed' ), __( 'Google Analytics, Tag Manager, Meta Pixel, Hotjar, Clarity, live chat… run when the visitor scrolls, taps or after a few seconds. Recommended.', 'tibospeed' ) ),
'all' => array( __( 'All JavaScript', 'tibospeed' ), __( 'Highest score. Sliders, menus and animations start on the first interaction; check your site on mobile.', 'tibospeed' ) ),
)
);
tibospeed_f_num( 'delay_timeout', __( 'Run delayed scripts at the latest after', 'tibospeed' ), __( 'seconds (0: on interaction only). Recommended so that analytics also counts visitors who leave without interacting.', 'tibospeed' ), 0, 60 );
echo '';
tibospeed_card( __( 'CSS and HTML', 'tibospeed' ) );
tibospeed_f_toggle( 'css_minify', __( 'CSS minification', 'tibospeed' ), __( 'Theme and plugin CSS files are served as minified copies. Original files are not touched.', 'tibospeed' ) );
tibospeed_f_toggle( 'html_minify', __( 'HTML minification', 'tibospeed' ), __( 'Unnecessary whitespace and comments are removed.', 'tibospeed' ) );
tibospeed_f_toggle( 'block_css_split', __( 'CSS only for blocks in use', 'tibospeed' ), __( 'Gutenberg block styles are loaded for the blocks used on the page instead of one large file.', 'tibospeed' ) );
echo '';
tibospeed_card( __( 'Fonts and connections', 'tibospeed' ) );
tibospeed_f_toggle( 'fonts_local', __( 'Host Google Fonts locally', 'tibospeed' ), __( 'Fonts are downloaded from Google once and served from your own server. Visitors don\'t connect to Google (also better for privacy). When enabled, the plugin connects to Google only to download the font files.', 'tibospeed' ) );
tibospeed_f_toggle( 'fonts_swap', __( 'Show text while fonts load', 'tibospeed' ), __( 'Adds font-display: swap; text appears immediately instead of a blank screen.', 'tibospeed' ) );
tibospeed_f_toggle( 'preconnect', __( 'Preconnect to external servers', 'tibospeed' ), __( 'Connections to external servers used on the page are opened early (up to 4).', 'tibospeed' ) );
tibospeed_f_choice(
'speculation',
__( 'Instant page navigation', 'tibospeed' ),
array(
'off' => array( __( 'Off', 'tibospeed' ), '' ),
'prefetch' => array( __( 'Prefetch', 'tibospeed' ), __( 'The next page is downloaded when the mouse hovers over a link. Recommended.', 'tibospeed' ) ),
'prerender' => array( __( 'Prerender', 'tibospeed' ), __( 'The next page is fully prepared in the background and opens instantly on click.', 'tibospeed' ) ),
)
);
echo '';
tibospeed_card( __( 'WordPress cleanup', 'tibospeed' ) );
tibospeed_f_toggle( 'no_emoji', __( 'Remove the emoji script', 'tibospeed' ), __( 'All modern browsers display emojis themselves.', 'tibospeed' ) );
tibospeed_f_toggle( 'no_embeds', __( 'Remove the WordPress embed script', 'tibospeed' ), __( 'Embeds such as YouTube and X keep working.', 'tibospeed' ) );
tibospeed_f_toggle( 'no_dashicons', __( 'Don\'t load Dashicons for visitors', 'tibospeed' ), __( 'The admin icon font is loaded only for logged-in users.', 'tibospeed' ) );
tibospeed_f_toggle( 'head_clean', __( ' cleanup', 'tibospeed' ), __( 'RSD, wlwmanifest, shortlink and generator tags are removed.', 'tibospeed' ) );
tibospeed_f_choice(
'heartbeat',
'Heartbeat',
array(
'default' => array( __( 'Default', 'tibospeed' ), '' ),
'reduce' => array( __( 'Reduced', 'tibospeed' ), __( 'Once a minute in the admin. Recommended.', 'tibospeed' ) ),
'off_front' => array( __( 'Off on the site', 'tibospeed' ), __( 'Reduced + never runs on visitor pages.', 'tibospeed' ) ),
)
);
echo '';
}
/**
* Görsel ve video.
*/
function tibospeed_tab_medya() {
tibospeed_card( __( 'Images', 'tibospeed' ) );
tibospeed_f_toggle( 'lcp', __( 'Prioritize the largest image (LCP)', 'tibospeed' ), __( 'The main image at the top of the page is loaded first and preloaded. This setting affects Google\'s speed score the most.', 'tibospeed' ) );
tibospeed_f_toggle( 'lazy', __( 'Lazy loading', 'tibospeed' ), __( 'Off-screen images and iframes load on scroll (a native browser feature, no JavaScript needed).', 'tibospeed' ) );
tibospeed_f_num( 'lazy_skip', __( 'Number of images to load immediately', 'tibospeed' ), __( 'So that the logo and top images aren\'t lazy loaded.', 'tibospeed' ), 0, 10 );
tibospeed_f_toggle( 'img_dims', __( 'Add missing width / height', 'tibospeed' ), __( 'Prevents content from shifting while the page loads (CLS).', 'tibospeed' ) );
echo '';
$w = tibospeed_webp_stats();
$ok = tibospeed_webp_supported();
tibospeed_card( 'WebP', __( 'Images are converted to WebP on your server; 25–35% smaller on average. No external service, quota or monthly fee.', 'tibospeed' ) );
tibospeed_f_toggle( 'webp', __( 'Generate and use WebP', 'tibospeed' ), __( 'New uploads are converted automatically. Originals are kept; if the WebP is larger, it isn\'t used.', 'tibospeed' ) );
tibospeed_f_num( 'webp_quality', __( 'Quality', 'tibospeed' ), __( '(80–85 recommended)', 'tibospeed' ), 40, 100 );
echo '
' . esc_html__( 'Your server\'s image library doesn\'t support WebP. Ask your host to enable WebP support for GD or Imagick.', 'tibospeed' ) . '
';
}
echo '';
tibospeed_card( __( 'Video', 'tibospeed' ) );
tibospeed_f_toggle( 'yt_facade', __( 'YouTube preview', 'tibospeed' ), __( 'YouTube videos are replaced with a lightweight preview image that looks the same; the video loads on click. Saves about 1 MB per video.', 'tibospeed' ) );
echo '';
}
/**
* WooCommerce ve Elementor.
*/
function tibospeed_tab_eklentiler() {
tibospeed_card( 'WooCommerce' );
if ( ! class_exists( 'WooCommerce' ) ) {
echo '
' . esc_html__( 'WooCommerce is not installed.', 'tibospeed' ) . '
';
}
tibospeed_f_toggle( 'woo_fragments', __( 'Remove the "cart fragments" request when the cart is empty', 'tibospeed' ), __( 'WooCommerce sends a request to the server on every page to refresh the cart. When the cart is empty, this request is unnecessary and defeats the page cache.', 'tibospeed' ) );
tibospeed_f_toggle( 'woo_assets', __( 'Don\'t load WooCommerce files outside the shop', 'tibospeed' ), __( 'Blog posts and pages without products skip WooCommerce styles and scripts. Shop, product, cart, checkout and account pages, and pages with product blocks or shortcodes, are not affected. Check your header mini cart after enabling.', 'tibospeed' ) );
echo '
' . esc_html__( 'Cart, checkout and my account pages are not cached, and their JavaScript is not delayed.', 'tibospeed' ) . '
' . esc_html__( 'A visitor who adds a product to the cart gets uncached (personal) pages from then on.', 'tibospeed' ) . '
' . esc_html__( 'When stock or price changes, the product, its categories and the shop page are refreshed instantly.', 'tibospeed' ) . '
' . esc_html__( 'When a scheduled sale starts or ends, the affected products are refreshed in the cache automatically.', 'tibospeed' ) . '
';
echo '';
tibospeed_card( 'Elementor', __( 'Brings Elementor\'s own performance settings to their fastest values.', 'tibospeed' ) );
if ( ! defined( 'ELEMENTOR_VERSION' ) ) {
echo '
' . esc_html__( 'Elementor is not installed.', 'tibospeed' ) . '
' . esc_html__( 'Elementor\'s "Element Caching" and "Lazy Load Background Images" experiments have no effect if they don\'t exist in your Elementor version. You can also see these settings under Elementor → Settings → Features.', 'tibospeed' ) . '
';
}
/**
* Gelişmiş.
*/
function tibospeed_tab_gelismis() {
tibospeed_card( __( 'Exclusions', 'tibospeed' ) );
tibospeed_f_list( 'exclude_urls', __( 'URLs never to cache', 'tibospeed' ), __( 'A part of the URL, one per line. Example: /contact', 'tibospeed' ) );
tibospeed_f_list( 'exclude_cookies', __( 'Cookies that bypass the cache', 'tibospeed' ), __( 'Visitors with this cookie are not served from the cache (start of the cookie name).', 'tibospeed' ) );
tibospeed_f_list( 'ignore_params', __( 'Ignored URL parameters', 'tibospeed' ), __( 'Visitors arriving with these parameters (ad and campaign links) still get the fast cached page.', 'tibospeed' ) );
tibospeed_f_list( 'delay_exclude', __( 'JavaScript never to delay', 'tibospeed' ), __( 'A file name, script ID or a piece of the code. Example: slider.min.js', 'tibospeed' ) );
tibospeed_f_list( 'defer_exclude', __( 'Scripts never to defer', 'tibospeed' ), __( 'WordPress script handle. Example: my-theme-script', 'tibospeed' ) );
echo '';
tibospeed_card( __( 'Server', 'tibospeed' ) );
/* translators: %s: server type */
echo '
';
}
// The settings screen is a full app: other plugins' notices are not shown on it.
add_action(
'in_admin_header',
function () {
$sc = function_exists( 'get_current_screen' ) ? get_current_screen() : null;
if ( $sc && 'toplevel_page_tibospeed' === $sc->id ) {
remove_all_actions( 'admin_notices' );
remove_all_actions( 'all_admin_notices' );
}
},
1000
);
// WebTibo themes group their products under one "WebTibo" heading in the admin menu.
add_filter(
'webtibo_menu_group',
function ( $g ) {
$g[] = 'tibospeed';
return $g;
}
);