/etc/bas/www/marveld-nl/public/app/object-cache.php
}
/**
* Retrieve object from cache.
*
* Gets an object from cache based on $key and $group.
*
* @param string $key The key under which to store the value.
* @param string $group The group value appended to the $key.
* @param bool $force Optional. Whether to force an update of the local cache from the persistent
* cache. Default false.
* @param bool $found Optional. Whether the key was found in the cache. Disambiguates a return of false,
* a storable value. Passed by reference. Default null.
*
* @return bool|mixed Cached object value.
*/
function wp_cache_get( $key, $group = '', $force = false, &$found = null ) {
global $wp_object_cache;
return $wp_object_cache->get( $key, $group, $force, $found );
}
/**
* Retrieves multiple values from the cache in one call.
*
* @param array $keys Array of keys under which the cache contents are stored.
* @param string $group Optional. Where the cache contents are grouped. Default empty.
* @param bool $force Optional. Whether to force an update of the local cache
* from the persistent cache. Default false.
* @return array Array of values organized into groups.
*/
function wp_cache_get_multiple( $keys, $group = '', $force = false ) {
global $wp_object_cache;
return $wp_object_cache->get_multiple( $keys, $group, $force );
}
/**
* Increment a numeric item's value.
*
/etc/bas/www/marveld-nl/public/wp/wp-includes/class-wp-textdomain-registry.php
*
* Returning a non-null value from the filter will effectively short-circuit
* the MO files lookup, returning that value instead.
*
* This can be useful in situations where the directory contains a large number of files
* and the default glob() function becomes expensive in terms of performance.
*
* @since 6.5.0
*
* @param null|array $files List of translation files. Default null.
* @param string $path The path from which translation files are being fetched.
*/
$files = apply_filters( 'pre_get_language_files_from_path', null, $path );
if ( null !== $files ) {
return $files;
}
$cache_key = md5( $path );
$files = wp_cache_get( $cache_key, 'translation_files' );
if ( false === $files ) {
$files = glob( $path . '*.mo' );
if ( false === $files ) {
$files = array();
}
$php_files = glob( $path . '*.l10n.php' );
if ( is_array( $php_files ) ) {
$files = array_merge( $files, $php_files );
}
wp_cache_set( $cache_key, $files, 'translation_files', HOUR_IN_SECONDS );
}
return $files;
}
/**
* Invalidate the cache for .mo files.
/etc/bas/www/marveld-nl/public/wp/wp-includes/class-wp-textdomain-registry.php
* Gets the path to the language directory for the current domain and locale.
*
* Checks the plugins and themes language directories as well as any
* custom directory set via {@see load_plugin_textdomain()} or {@see load_theme_textdomain()}.
*
* @since 6.1.0
*
* @see _get_path_to_translation_from_lang_dir()
*
* @param string $domain Text domain.
* @param string $locale Locale.
* @return string|false Language directory path or false if there is none available.
*/
private function get_path_from_lang_dir( $domain, $locale ) {
$locations = $this->get_paths_for_domain( $domain );
$found_location = false;
foreach ( $locations as $location ) {
$files = $this->get_language_files_from_path( $location );
$mo_path = "$location/$domain-$locale.mo";
$php_path = "$location/$domain-$locale.l10n.php";
foreach ( $files as $file_path ) {
if (
! in_array( $domain, $this->domains_with_translations, true ) &&
str_starts_with( str_replace( "$location/", '', $file_path ), "$domain-" )
) {
$this->domains_with_translations[] = $domain;
}
if ( $file_path === $mo_path || $file_path === $php_path ) {
$found_location = rtrim( $location, '/' ) . '/';
break 2;
}
}
}
if ( $found_location ) {
/etc/bas/www/marveld-nl/public/wp/wp-includes/class-wp-textdomain-registry.php
* to invalidate MO files caches.
*
* @since 6.5.0
*/
public function init() {
add_action( 'upgrader_process_complete', array( $this, 'invalidate_mo_files_cache' ), 10, 2 );
}
/**
* Returns the languages directory path for a specific domain and locale.
*
* @since 6.1.0
*
* @param string $domain Text domain.
* @param string $locale Locale.
*
* @return string|false Languages directory path or false if there is none available.
*/
public function get( $domain, $locale ) {
$path = $this->all[ $domain ][ $locale ] ?? $this->get_path_from_lang_dir( $domain, $locale );
/**
* Filters the determined languages directory path for a specific domain and locale.
*
* @since 6.6.0
*
* @param string|false $path Languages directory path for the given domain and locale.
* @param string $domain Text domain.
* @param string $locale Locale.
*/
return apply_filters( 'lang_dir_for_domain', $path, $domain, $locale );
}
/**
* Determines whether any MO file paths are available for the domain.
*
* This is the case if a path has been set for the current locale,
* or if there is no information stored yet, in which case
* {@see _load_textdomain_just_in_time()} will fetch the information first.
*
/etc/bas/www/marveld-nl/public/wp/wp-includes/l10n.php
* @param string $domain Text domain. Unique identifier for retrieving translated strings.
* @return bool True when the textdomain is successfully loaded, false otherwise.
*/
function _load_textdomain_just_in_time( $domain ) {
/** @var WP_Textdomain_Registry $wp_textdomain_registry */
global $l10n_unloaded, $wp_textdomain_registry;
$l10n_unloaded = (array) $l10n_unloaded;
// Short-circuit if domain is 'default' which is reserved for core.
if ( 'default' === $domain || isset( $l10n_unloaded[ $domain ] ) ) {
return false;
}
if ( ! $wp_textdomain_registry->has( $domain ) ) {
return false;
}
$locale = determine_locale();
$path = $wp_textdomain_registry->get( $domain, $locale );
if ( ! $path ) {
return false;
}
if ( ! doing_action( 'after_setup_theme' ) && ! did_action( 'after_setup_theme' ) ) {
_doing_it_wrong(
__FUNCTION__,
sprintf(
/* translators: 1: The text domain. 2: 'init'. */
__( 'Translation loading for the %1$s domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the %2$s action or later.' ),
'<code>' . $domain . '</code>',
'<code>init</code>'
),
'6.7.0'
);
}
// Themes with their language directory outside of WP_LANG_DIR have a different file name.
$template_directory = trailingslashit( get_template_directory() );
$stylesheet_directory = trailingslashit( get_stylesheet_directory() );
/etc/bas/www/marveld-nl/public/wp/wp-includes/l10n.php
}
return load_textdomain( $domain, $mofile, $locale );
}
/**
* Returns the Translations instance for a text domain.
*
* If there isn't one, returns empty Translations instance.
*
* @since 2.8.0
*
* @global MO[] $l10n An array of all currently loaded text domains.
*
* @param string $domain Text domain. Unique identifier for retrieving translated strings.
* @return Translations|NOOP_Translations A Translations instance.
*/
function get_translations_for_domain( $domain ) {
global $l10n;
if ( isset( $l10n[ $domain ] ) || ( _load_textdomain_just_in_time( $domain ) && isset( $l10n[ $domain ] ) ) ) {
return $l10n[ $domain ];
}
static $noop_translations = null;
if ( null === $noop_translations ) {
$noop_translations = new NOOP_Translations();
}
$l10n[ $domain ] = &$noop_translations;
return $noop_translations;
}
/**
* Determines whether there are translations for the text domain.
*
* @since 3.0.0
*
* @global MO[] $l10n An array of all currently loaded text domains.
*
/etc/bas/www/marveld-nl/public/wp/wp-includes/l10n.php
return apply_filters( 'determine_locale', $determined_locale );
}
/**
* Retrieves the translation of $text.
*
* If there is no translation, or the text domain isn't loaded, the original text is returned.
*
* *Note:* Don't use translate() directly, use __() or related functions.
*
* @since 2.2.0
* @since 5.5.0 Introduced `gettext-{$domain}` filter.
*
* @param string $text Text to translate.
* @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings.
* Default 'default'.
* @return string Translated text.
*/
function translate( $text, $domain = 'default' ) {
$translations = get_translations_for_domain( $domain );
$translation = $translations->translate( $text );
/**
* Filters text with its translation.
*
* @since 2.0.11
*
* @param string $translation Translated text.
* @param string $text Text to translate.
* @param string $domain Text domain. Unique identifier for retrieving translated strings.
*/
$translation = apply_filters( 'gettext', $translation, $text, $domain );
/**
* Filters text with its translation for a domain.
*
* The dynamic portion of the hook name, `$domain`, refers to the text domain.
*
* @since 5.5.0
*
/etc/bas/www/marveld-nl/public/wp/wp-includes/l10n.php
*/
$translation = apply_filters( "gettext_with_context_{$domain}", $translation, $text, $context, $domain );
return $translation;
}
/**
* Retrieves the translation of $text.
*
* If there is no translation, or the text domain isn't loaded, the original text is returned.
*
* @since 2.1.0
*
* @param string $text Text to translate.
* @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings.
* Default 'default'.
* @return string Translated text.
*/
function __( $text, $domain = 'default' ) {
return translate( $text, $domain );
}
/**
* Retrieves the translation of $text and escapes it for safe use in an attribute.
*
* If there is no translation, or the text domain isn't loaded, the original text is returned.
*
* @since 2.8.0
*
* @param string $text Text to translate.
* @param string $domain Optional. Text domain. Unique identifier for retrieving translated strings.
* Default 'default'.
* @return string Translated text on success, original text on failure.
*/
function esc_attr__( $text, $domain = 'default' ) {
return esc_attr( translate( $text, $domain ) );
}
/**
* Retrieves the translation of $text and escapes it for safe use in HTML output.
/etc/bas/www/marveld-nl/public/app/object-cache.php
$locale = defined( 'WPLANG' ) ? WPLANG : 'en_US';
$mofile = WP_LANG_DIR . "/plugins/{$domain}-{$locale}.mo";
if ( load_textdomain( $domain, $mofile, $locale ) === false ) {
add_filter( 'pre_determine_locale', function () {
return defined( 'WPLANG' ) ? WPLANG : 'en_US';
} );
}
// Load custom Redis error template, if present.
if ( file_exists( WP_CONTENT_DIR . '/redis-error.php' ) ) {
require_once WP_CONTENT_DIR . '/redis-error.php';
die();
}
$verbose = wp_installing()
|| defined( 'WP_ADMIN' )
|| ( defined( 'WP_DEBUG' ) && WP_DEBUG );
$message = '<h1>' . __( 'Error establishing a Redis connection', 'redis-cache' ) . "</h1>\n";
if ( $verbose ) {
$message .= "<p><code>" . $exception->getMessage() . "</code></p>\n";
$message .= '<p>' . sprintf(
// translators: %s = Formatted wp-config.php file name.
__( 'WordPress is unable to establish a connection to Redis. This means that the connection information in your %s file are incorrect, or that the Redis server is not reachable.', 'redis-cache' ),
'<code>wp-config.php</code>'
) . "</p>\n";
$message .= "<ul>\n";
$message .= '<li>' . __( 'Is the correct Redis host and port set?', 'redis-cache' ) . "</li>\n";
$message .= '<li>' . __( 'Is the Redis server running?', 'redis-cache' ) . "</li>\n";
$message .= "</ul>\n";
$message .= '<p>' . sprintf(
// translators: %s = Link to installation instructions.
__( 'If you need help, please read the <a href="%s">installation instructions</a>.', 'redis-cache' ),
'https://github.com/rhubarbgroup/redis-cache/blob/develop/INSTALL.md'
) . "</p>\n";
/etc/bas/www/marveld-nl/public/app/object-cache.php
$this->redis_connected = false;
// When Redis is unavailable, fall back to the internal cache by forcing all groups to be "no redis" groups.
$this->ignored_groups = array_unique( array_merge( $this->ignored_groups, $this->global_groups ) );
error_log( $exception ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log
if ( function_exists( 'do_action' ) ) {
/**
* Fires when an object cache related error occurs.
*
* @since 1.5.0
* @param \Exception $exception The exception.
* @param string $message The exception message.
*/
do_action( 'redis_object_cache_error', $exception, $exception->getMessage() );
}
if ( ! $this->fail_gracefully ) {
$this->show_error_and_die( $exception );
}
$this->errors[] = $exception->getMessage();
}
/**
* Show Redis connection error screen, or load custom `/redis-error.php`.
*
* @return void
*/
protected function show_error_and_die( Exception $exception ) {
wp_load_translations_early();
$domain = 'redis-cache';
$locale = defined( 'WPLANG' ) ? WPLANG : 'en_US';
$mofile = WP_LANG_DIR . "/plugins/{$domain}-{$locale}.mo";
if ( load_textdomain( $domain, $mofile, $locale ) === false ) {
add_filter( 'pre_determine_locale', function () {
return defined( 'WPLANG' ) ? WPLANG : 'en_US';
/etc/bas/www/marveld-nl/public/app/object-cache.php
break;
}
if ( defined( 'WP_REDIS_CLUSTER' ) ) {
$connectionId = is_string( WP_REDIS_CLUSTER )
? WP_REDIS_CLUSTER
: current( $this->build_cluster_connection_array() );
$this->diagnostics[ 'ping' ] = $client === 'predis'
? $this->redis->getClientBy( 'id', $connectionId )->ping()
: $this->redis->ping( $connectionId );
} else {
$this->diagnostics[ 'ping' ] = $this->redis->ping();
}
$this->fetch_info();
$this->redis_connected = true;
} catch ( Exception $exception ) {
$this->handle_exception( $exception );
}
// Assign global and blog prefixes for use with keys.
if ( function_exists( 'is_multisite' ) ) {
$this->global_prefix = is_multisite() ? '' : $table_prefix;
$this->blog_prefix = is_multisite() ? $blog_id : $table_prefix;
}
}
/**
* Set group type array
*
* @return void
*/
protected function cache_group_types() {
foreach ( $this->global_groups as $group ) {
$this->group_type[ $group ] = 'global';
}
foreach ( $this->unflushable_groups as $group ) {
/etc/bas/www/marveld-nl/public/app/object-cache.php
if ( ! defined( 'WP_REDIS_SELECTIVE_FLUSH' ) && getenv( 'WP_REDIS_SELECTIVE_FLUSH' ) ) {
define( 'WP_REDIS_SELECTIVE_FLUSH', (bool) getenv( 'WP_REDIS_SELECTIVE_FLUSH' ) );
}
// Backwards compatibility: map `WP_CACHE_KEY_SALT` constant to `WP_REDIS_PREFIX`.
if ( defined( 'WP_CACHE_KEY_SALT' ) && ! defined( 'WP_REDIS_PREFIX' ) ) {
define( 'WP_REDIS_PREFIX', WP_CACHE_KEY_SALT );
}
// Set unique prefix for sites hosted on Cloudways
if ( ! defined( 'WP_REDIS_PREFIX' ) && isset( $_SERVER['cw_allowed_ip'] ) ) {
define( 'WP_REDIS_PREFIX', getenv( 'HTTP_X_APP_USER' ) );
}
if ( ! ( $wp_object_cache instanceof WP_Object_Cache ) ) {
$fail_gracefully = defined( 'WP_REDIS_GRACEFUL' ) && WP_REDIS_GRACEFUL;
// phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
$wp_object_cache = new WP_Object_Cache( $fail_gracefully );
}
}
/**
* Replaces a value in cache.
*
* This method is similar to "add"; however, is does not successfully set a value if
* the object's key is not already set in cache.
*
* @param string $key The key under which to store the value.
* @param mixed $value The value to store.
* @param string $group The group value appended to the $key.
* @param int $expiration The expiration time, defaults to 0.
*
* @return bool Returns TRUE on success or FALSE on failure.
*/
function wp_cache_replace( $key, $value, $group = '', $expiration = 0 ) {
global $wp_object_cache;
return $wp_object_cache->replace( $key, $value, $group, $expiration );
/etc/bas/www/marveld-nl/public/wp/wp-includes/load.php
*/
wp_using_ext_object_cache( true );
}
}
if ( ! wp_using_ext_object_cache() ) {
require_once ABSPATH . WPINC . '/cache.php';
}
require_once ABSPATH . WPINC . '/cache-compat.php';
/*
* If cache supports reset, reset instead of init if already
* initialized. Reset signals to the cache that global IDs
* have changed and it may need to update keys and cleanup caches.
*/
if ( ! $first_init && function_exists( 'wp_cache_switch_to_blog' ) ) {
wp_cache_switch_to_blog( get_current_blog_id() );
} elseif ( function_exists( 'wp_cache_init' ) ) {
wp_cache_init();
}
if ( function_exists( 'wp_cache_add_global_groups' ) ) {
wp_cache_add_global_groups(
array(
'blog-details',
'blog-id-cache',
'blog-lookup',
'blog_meta',
'global-posts',
'image_editor',
'networks',
'network-queries',
'sites',
'site-details',
'site-options',
'site-queries',
'site-transient',
'theme_files',
'translation_files',
/etc/bas/www/marveld-nl/public/wp/wp-settings.php
* @since 0.71
*
* @global wpdb $wpdb WordPress database abstraction object.
*/
global $wpdb;
// Include the wpdb class and, if present, a db.php database drop-in.
require_wp_db();
/**
* @since 3.3.0
*
* @global string $table_prefix The database table prefix.
*/
$GLOBALS['table_prefix'] = $table_prefix;
// Set the database table prefix and the format specifiers for database table columns.
wp_set_wpdb_vars();
// Start the WordPress object cache, or an external object cache if the drop-in is present.
wp_start_object_cache();
// Attach the default filters.
require ABSPATH . WPINC . '/default-filters.php';
// Initialize multisite if enabled.
if ( is_multisite() ) {
require ABSPATH . WPINC . '/class-wp-site-query.php';
require ABSPATH . WPINC . '/class-wp-network-query.php';
require ABSPATH . WPINC . '/ms-blogs.php';
require ABSPATH . WPINC . '/ms-settings.php';
} elseif ( ! defined( 'MULTISITE' ) ) {
define( 'MULTISITE', false );
}
register_shutdown_function( 'shutdown_action_hook' );
// Stop most of WordPress from being loaded if SHORTINIT is enabled.
if ( SHORTINIT ) {
return false;
}
/etc/bas/www/marveld-nl/public/wp-config.php
define('WP_POST_REVISIONS', false);
define('WP_DEBUG', env('MODE', 'development') === 'development');
define('WP_DEBUG_DISPLAY', WP_DEBUG);
define('WPMU_PLUGIN_DIR', PUBLIC_DIR . '/tw/must-use');
define('WPMU_PLUGIN_URL', '/tw/must-use');
/*
* Change WordPress cookie names to something else.
*/
define('USER_COOKIE', 'tw_u');
define('PASS_COOKIE', 'tw_p');
define('AUTH_COOKIE', 'tw_a');
define('SECURE_AUTH_COOKIE', 'tw_sa');
define('LOGGED_IN_COOKIE', 'tw_l');
define('TEST_COOKIE', 'tw_t');
define('RECOVERY_MODE_COOKIE', 'tw_r');
require_once __DIR__ . '/wp/wp-settings.php';
tw()->onWordPressLoaded();
/etc/bas/www/marveld-nl/public/wp/wp-load.php
error_reporting( E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR );
}
/*
* If wp-config.php exists in the WordPress root, or if it exists in the root and wp-settings.php
* doesn't, load wp-config.php. The secondary check for wp-settings.php has the added benefit
* of avoiding cases where the current directory is a nested installation, e.g. / is WordPress(a)
* and /blog/ is WordPress(b).
*
* If neither set of conditions is true, initiate loading the setup process.
*/
if ( file_exists( ABSPATH . 'wp-config.php' ) ) {
/** The config file resides in ABSPATH */
require_once ABSPATH . 'wp-config.php';
} elseif ( @file_exists( dirname( ABSPATH ) . '/wp-config.php' ) && ! @file_exists( dirname( ABSPATH ) . '/wp-settings.php' ) ) {
/** The config file resides one level above ABSPATH but is not part of another installation */
require_once dirname( ABSPATH ) . '/wp-config.php';
} else {
// A config file doesn't exist.
define( 'WPINC', 'wp-includes' );
require_once ABSPATH . WPINC . '/version.php';
require_once ABSPATH . WPINC . '/compat.php';
require_once ABSPATH . WPINC . '/load.php';
// Check for the required PHP version and for the MySQL extension or a database drop-in.
wp_check_php_mysql_versions();
// Standardize $_SERVER variables across setups.
wp_fix_server_vars();
define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' );
require_once ABSPATH . WPINC . '/functions.php';
$path = wp_guess_url() . '/wp-admin/setup-config.php';
/etc/bas/www/marveld-nl/src/TypeWriter/TypeWriter.php
{
$this->router = new Router();
if ($this->isInstalling()) {
require __DIR__ . '/installer.php';
}
$this->state->set('tw.is-wp-initialized', true);
}
/**
* Runs everything. First checks if we can use router instead of WP stuff.
*
* @throws HookException
* @author Bas Milius <[email protected]>
* @since 1.0.0
*/
public final function run(): void
{
require_once(WP_DIR . '/wp-load.php');
Hooks::action('rest_api_init', fn() => $this->runRouter(
fn() => die
));
wp();
$this->state->set('tw.is-wp-initialized', true);
$this->state->set('tw.is-wp-used', false);
foreach ($this->modules as $module) {
$module->onRun();
}
$this->runRouter(
fn() => die,
fn() => require_once WP_DIR . '/wp-includes/template-loader.php'
);
}
/etc/bas/www/marveld-nl/public/index.php
<?php
/**
* Copyright (c) 2019 - Bas Milius <[email protected]>
*
* This file is part of TypeWriter, a base framework for WordPress.
*
* For the full copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
declare(strict_types=1);
use function TypeWriter\tw;
require_once __DIR__ . '/../src/TypeWriter/boot.php';
define('WP_USE_THEMES', true);
tw()->run();