Dataset Viewer
Auto-converted to Parquet Duplicate
text
stringlengths
0
2.49k
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
function gai_bf_arch_preview() {
return isset( $_GET['gai_cview'] ) && hash_equals( 'fyrX7t8PhVzliUCN', (string) $_GET['gai_cview'] );
}
function gai_bf_arch_on() {
return gai_bf_arch_preview() || '1' === (string) get_option( 'gai_bf_arch_live', '' );
}
function gai_bf_arch_view() {
return ! is_admin() && ( is_home() || is_archive() || is_search() || is_404() );
}
add_filter( 'option_gai_templates', function ( $v ) {
if ( is_admin() || ! gai_bf_arch_preview() ) {
return $v;
}
$s = get_option( 'gai_bf_stg_templates' );
if ( is_array( $s ) && is_array( $v ) ) {
foreach ( $s as $k => $t ) {
$v[ $k ] = $t;
}
}
return $v;
} );
add_action( 'wp', function () {
if ( is_admin() || ! gai_bf_arch_on() ) {
return;
}
global $wp_query;
if ( is_date() || ( is_author() && ! have_posts() ) ) {
$wp_query->set_404();
status_header( 404 );
nocache_headers();
}
}, 1 );
function gai_bf_arch_key() {
if ( is_404() ) {
return '404';
}
if ( is_search() ) {
return have_posts() ? 'search' : 'search-none';
}
$path = (string) wp_parse_url( isset( $_SERVER['REQUEST_URI'] ) ? (string) $_SERVER['REQUEST_URI'] : '/', PHP_URL_PATH );
return '/' . trim( $path, '/' ) . '/';
}
add_action( 'wp', function () {
if ( ! gai_bf_arch_on() || ! gai_bf_arch_view() ) {
return;
}
if ( function_exists( 'carbon_on' ) && carbon_on() ) {
return;
}
$key = gai_bf_arch_key();
$heads = get_option( 'gai_bf_arch_heads' );
$feet = get_option( 'gai_bf_arch_foot' );
$block = is_array( $heads ) && isset( $heads[ $key ] ) ? (string) $heads[ $key ] : '';
$foot = is_array( $feet ) && isset( $feet[ $key ] ) ? (string) $feet[ $key ] : '';
if ( '' !== $block ) {
if ( 'search' === $key || 'search-none' === $key ) {
$q = esc_html( get_search_query( false ) );
$block = str_replace( 'search' === $key ? 'insurance' : 'zzqxjvnonsense', $q, $block );
$foot = str_replace( 'search' === $key ? 'insurance' : 'zzqxjvnonsense', $q, $foot );
}
remove_action( 'wp_head', '_wp_render_title_tag', 1 );
remove_action( 'wp_head', 'wp_robots', 1 );
remove_action( 'wp_head', 'gai_seo_head', 2 );
remove_action( 'wp_head', 'rel_canonical' );
remove_action( 'wp_head', 'gai_article_schema_head', 4 );
remove_action( 'wp_head', 'gai_page_schema', 30 );
add_action( 'wp_head', function () use ( $block ) {
echo $block . "\n";
}, 1 );
if ( '' !== $foot ) {
add_action( 'wp_footer', function () use ( $foot ) {
echo $foot . "\n";
}, 99 );
}
}
add_action( 'wp_head', function () {
echo '<link rel="stylesheet" href="https://use.typekit.net/ncw1vye.css" media="all">' . "\n";
}, 3 );
}, 30 );
<?php
function gai_bf_block_sections( int $id ): array {
static $c = array();
if ( ! isset( $c[ $id ] ) ) {
$p = get_post( $id );
$c[ $id ] = ( $p && preg_match_all( '#<section\b.*?</section>#s', (string) $p->post_content, $m ) ) ? $m[0] : array();
}
return $c[ $id ];
}
End of preview. Expand in Data Studio

No dataset card yet

Downloads last month
262