'dengeli', // Önbellek. 'cache' => 1, 'cache_hours' => 10, 'cache_mobile' => 0, 'preload' => 1, 'ignore_params' => 'utm_source, utm_medium, utm_campaign, utm_term, utm_content, utm_id, gclid, fbclid, msclkid, gad_source, _ga, mc_cid, mc_eid, ref', 'exclude_urls' => '', 'exclude_cookies' => '', 'browser_cache' => 1, // Dosyalar. 'html_minify' => 1, 'css_minify' => 1, 'js_defer' => 1, 'js_delay' => 'third', 'delay_timeout' => 10, 'delay_exclude' => '', 'defer_exclude' => '', // Medya. 'lazy' => 1, 'lazy_skip' => 2, 'img_dims' => 1, 'lcp' => 1, 'webp' => 1, 'webp_quality' => 82, 'yt_facade' => 1, // Yazı tipleri ve bağlantılar. 'fonts_local' => 0, 'fonts_swap' => 1, 'preconnect' => 1, 'speculation' => 'prefetch', // WordPress temizliği. 'no_emoji' => 1, 'no_embeds' => 1, 'no_dashicons' => 1, 'block_css_split' => 1, 'head_clean' => 1, 'heartbeat' => 'reduce', // WooCommerce. 'woo_fragments' => 1, 'woo_assets' => 0, // Veritabanı. 'revisions_keep' => 10, 'db_auto' => 0, ); } /** * Profil açıklamaları. * * @return array */ function tibospeed_profiles() { return array( 'guvenli' => array( __( 'Safe', 'tibospeed' ), __( 'Cache, minification, images and WordPress cleanup. Doesn\'t touch JavaScript. Causes no issues on any site.', 'tibospeed' ) ), 'dengeli' => array( __( 'Balanced', 'tibospeed' ), __( 'Safe + defers JavaScript using WordPress\'s own safety rules and delays analytics and ad scripts until the first interaction. Recommended.', 'tibospeed' ) ), 'ucus' => array( __( 'Flight mode', 'tibospeed' ), __( 'Balanced + all JavaScript waits for the first interaction, and page navigation is prerendered. Highest score; check sliders and menus.', 'tibospeed' ) ), ); } /** * Profilin ayarları. * * @param string $p Profil. * @return array */ function tibospeed_profile_settings( $p ) { $s = tibospeed_defaults(); if ( 'guvenli' === $p ) { $s['js_defer'] = 0; $s['js_delay'] = 'off'; $s['speculation'] = 'off'; $s['lazy_skip'] = 3; } elseif ( 'ucus' === $p ) { $s['js_delay'] = 'all'; $s['speculation'] = 'prerender'; $s['fonts_local'] = 1; $s['woo_assets'] = 1; } $s['profile'] = $p; return apply_filters( 'tibospeed_profile_settings', $s, $p ); } /** * Ayarlar. * * @param bool $reset Önbelleği sil. * @return array */ function tibospeed_settings( $reset = false ) { static $s = null; if ( $reset ) { $s = null; } if ( null === $s ) { $o = get_option( 'tibospeed_settings', array() ); $s = wp_parse_args( is_array( $o ) ? $o : array(), tibospeed_defaults() ); } return $s; } /** * Tek ayar. * * @param string $k Anahtar. * @return mixed */ function tibospeed_get( $k ) { $s = tibospeed_settings(); return isset( $s[ $k ] ) ? $s[ $k ] : null; } /** * Virgül ya da satırla ayrılmış listeyi diziye çevir. * * @param string $k Ayar anahtarı. * @return string[] */ function tibospeed_list( $k ) { return array_values( array_filter( array_map( 'trim', preg_split( '/[\r\n,]+/', (string) tibospeed_get( $k ) ) ) ) ); } /** * Pro eki etkin mi? * * @return bool */ function tibospeed_is_pro() { return (bool) apply_filters( 'tibospeed_is_pro', false ); } /** * Pro sayfası. * * @param string $medium Kaynak. * @return string */ function tibospeed_pro_url( $medium = 'panel' ) { return 'https://webtibo.com/eklentiler/tibospeed/?utm_source=eklenti&utm_medium=' . rawurlencode( $medium ); } /** * Ayarları temizle. Formda olmayan anahtarlar mevcut değerini korur. * * @param array $in Ham girdi. * @param array $keys Bu formdaki anahtarlar. * @return array */ function tibospeed_sanitize( $in, $keys ) { $d = tibospeed_defaults(); $out = tibospeed_settings(); $sel = array( 'js_delay' => array( 'off', 'third', 'all' ), 'speculation' => array( 'off', 'prefetch', 'prerender' ), 'heartbeat' => array( 'default', 'reduce', 'off_front' ), 'db_auto' => array( '0', 'weekly' ), 'profile' => array( 'guvenli', 'dengeli', 'ucus', 'ozel' ), ); $num = array( 'cache_hours' => array( 1, 720 ), 'delay_timeout' => array( 0, 60 ), 'lazy_skip' => array( 0, 10 ), 'webp_quality' => array( 40, 100 ), 'revisions_keep' => array( 0, 100 ), ); $txt = array( 'ignore_params', 'exclude_urls', 'exclude_cookies', 'delay_exclude', 'defer_exclude' ); foreach ( $keys as $k ) { if ( ! array_key_exists( $k, $d ) ) { continue; } $v = isset( $in[ $k ] ) ? $in[ $k ] : null; if ( isset( $sel[ $k ] ) ) { $out[ $k ] = in_array( (string) $v, $sel[ $k ], true ) ? (string) $v : $d[ $k ]; } elseif ( isset( $num[ $k ] ) ) { $out[ $k ] = max( $num[ $k ][0], min( $num[ $k ][1], (int) $v ) ); } elseif ( in_array( $k, $txt, true ) ) { $lines = array_filter( array_map( 'trim', preg_split( '/[\r\n]+/', sanitize_textarea_field( (string) $v ) ) ) ); $out[ $k ] = implode( "\n", $lines ); } else { $out[ $k ] = empty( $v ) ? 0 : 1; } } return $out; }