section add_action( 'wp_head', array( &$this, 'wp_head' ) ); // Extra content just before
add_action( 'wp_footer', array( &$this, 'wp_footer' ) ); // RSS tagging add_filter( 'the_permalink_rss', array( &$this, 'the_permalink_rss' ) ); add_filter( 'the_content', array( &$this, 'the_content' ) ); // Modify post excerpt and comments for various reasons add_filter( 'the_excerpt', array( &$this, 'the_excerpt' ) ); // Modify post content and comments for various reasons add_filter( 'comment_text', array( &$this, 'comment_text' ) ); } // Initialise plugin function init() { load_plugin_textdomain( 'google-integration-toolkit', false, dirname( plugin_basename( __FILE__ ) ).'/lang' ); } // Plugin initialisation - admin function admin_init() { // Register plugin options register_setting( 'google-integration-toolkit', 'git_gwt_mode', array( &$this, 'sanitize_gwt_mode' ) ); register_setting( 'google-integration-toolkit', 'git_gwt_meta', array( &$this, 'sanitize_metaverify' ) ); register_setting( 'google-integration-toolkit', 'git_gwt_filename', 'trim' ); register_setting( 'google-integration-toolkit', 'git_analytics_id', 'trim' ); register_setting( 'google-integration-toolkit', 'git_analytics_adsense', array( &$this, 'sanitize_bool' ) ); register_setting( 'google-integration-toolkit', 'git_rss_tagging', array( &$this, 'sanitize_bool' ) ); register_setting( 'google-integration-toolkit', 'git_rss_tag_source', 'trim' ); register_setting( 'google-integration-toolkit', 'git_rss_tag_medium', 'trim' ); register_setting( 'google-integration-toolkit', 'git_rss_tag_campaign', 'trim' ); register_setting( 'google-integration-toolkit', 'git_adsense_tag_posts', array( &$this, 'sanitize_bool' ) ); register_setting( 'google-integration-toolkit', 'git_adsense_tag_comments', array( &$this, 'sanitize_bool' ) ); register_setting( 'google-integration-toolkit', 'git_analytics_track_404', array( &$this, 'sanitize_bool' ) ); register_setting( 'google-integration-toolkit', 'git_analytics_track_404_prefix', 'trim' ); } // Add Admin menu option function admin_menu() { // admin_init is called later, so need to use proxy method here add_submenu_page( 'options-general.php', 'Google Integration Toolkit', 'Google Integration Toolkit', 'manage_options', __FILE__, array( $this, 'options_panel' ) ); } // URL handler for GWT verification function status_header( $status_header, $header ) { if ( ( $header == 404 ) && ( get_option( 'git_gwt_mode' ) == 'file' ) ) { $filename = get_option( 'git_gwt_filename' ); if ( $filename != '' ) { // Extract root dir from blog url $root = '/'; if ( preg_match( '#^http://[^/]+(/.+)$#', get_option( 'siteurl' ), $matches ) ) { $root = $matches[1]; } // Make sure it ends with slash if ( $root[ strlen($root) - 1 ] != '/' ) { $root .= '/'; } // Check if request is for GWT verification file if ( $root.$filename == $_SERVER['REQUEST_URI'] ) { //wp_die( 'Welcome, Google!', '200 OK', array( 'response' => 200 ) ); echo 'google-site-verification: ', $filename; exit(); } } } return $status_header; } // Extra entries in
section
function wp_head() {
// Google Webmasters Tools
$gwt_mode = get_option( 'git_gwt_mode' );
$meta = get_option( 'git_gwt_meta' );
if ( ( $gwt_mode == 'meta2' ) && ( $meta != '' ) ) {
echo '', "\n";
}
elseif ( ( $gwt_mode == 'meta' ) && ( $meta != '' ) ) {
echo '', "\n";
}
// Google Analytics integration with Google AdSense
$analytics_id = get_option( 'git_analytics_id' );
if ( ( $analytics_id != '' ) && get_option( 'git_analytics_adsense' ) ) {
echo << ', $message, '