関数 preview_theme_ob_filter_callback()
2014/12/17
関数 preview_theme_ob_filter_callback()
定義ファイル :/blog/wp-includes/theme.php 2
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | function preview_theme_ob_filter_callback( $matches ) { if ( strpos($matches[4], 'onclick') !== false ) $matches[4] = preg_replace('#onclick=([\'"]).*?(?<!\\\)\\1#i', '', $matches[4]); //Strip out any onclicks from rest of <a>. (?<!\\\) means to ignore the '" if it's escaped by \ to prevent breaking mid-attribute. if ( ( false !== strpos($matches[3], '/wp-admin/') ) || ( false !== strpos( $matches[3], '://' ) && 0 !== strpos( $matches[3], home_url() ) ) || ( false !== strpos($matches[3], '/feed/') ) || ( false !== strpos($matches[3], '/trackback/') ) ) return $matches[1] . "#$matches[2] onclick=$matches[2]return false;" . $matches[4]; $stylesheet = isset( $_GET['stylesheet'] ) ? $_GET['stylesheet'] : ''; $template = isset( $_GET['template'] ) ? $_GET['template'] : ''; $link = add_query_arg( array( 'preview' => 1, 'template' => $template, 'stylesheet' => $stylesheet, 'preview_iframe' => 1 ), $matches[3] ); if ( 0 === strpos($link, 'preview=1') ) $link = "?$link"; return $matches[1] . esc_attr( $link ) . $matches[4]; } |