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' ) ); } // Initialize plugin function init() { if ( function_exists( 'load_plugin_textdomain' ) ) { load_plugin_textdomain( 'google-integration-toolkit', PLUGINDIR.'/'.dirname(plugin_basename(__FILE__)) ); } } // Plugin initialization - admin function admin_init() { require_once( dirname( __FILE__ ) . '/git-admin.php' ); $this->admin = new GoogleIntegrationToolkitAdmin(); } // Add Admin menu option function admin_menu() { $file = __FILE__; // hack for 1.5 global $wp_version; if ( '1.5' == substr( $wp_version, 0, 3 ) ) { $file = 'google-integration-toolkit/google-integration-toolkit.php'; } // admin_init is called later, so need to use proxy method here add_submenu_page( 'options-general.php', 'Google Integration Toolkit', 'Google Integration Toolkit', 10, $file, array( $this, 'options_panel' ) ); } // Check if $this->admin is initialized function check_admin_helper() { if ( !$this->admin ) { wp_die( ''. __('Fatal Google Integration Toolkit error: $this->admin is not initialized!', 'google-integration-toolkit').'' ); } } // Handle options panel function options_panel() { $this->check_admin_helper(); $this->admin->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( 'url' ), $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 ) ); exit(); } } } return $status_header; } // Extra entries in
section
function wp_head() {
// Google Webmasters Tools
if ( get_option( 'git_gwt_mode' ) == 'meta' ) {
$meta = get_option( 'git_gwt_meta' );
if ( $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 <<