. */ /** * @package Main */ if ( !defined('WPSEO_URL') ) define( 'WPSEO_URL', plugin_dir_url( __FILE__ ) ); if ( !defined('WPSEO_PATH') ) define( 'WPSEO_PATH', plugin_dir_path( __FILE__ ) ); if ( !defined('WPSEO_BASENAME') ) define( 'WPSEO_BASENAME', plugin_basename( __FILE__ ) ); define( 'WPSEO_FILE', __FILE__ ); load_plugin_textdomain( 'wordpress-seo', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' ); if ( version_compare(PHP_VERSION, '5.2', '<') ) { if ( is_admin() && (!defined('DOING_AJAX') || !DOING_AJAX) ) { require_once ABSPATH.'/wp-admin/includes/plugin.php'; deactivate_plugins( __FILE__ ); wp_die( sprintf( __('WordPress SEO requires PHP 5.2 or higher, as does WordPress 3.2 and higher. The plugin has now disabled itself. For more info, %s$1see this post%s$2.', 'wordpress-seo'), '', '') ); } else { return; } } define( 'WPSEO_VERSION', '1.2.5' ); $pluginurl = plugin_dir_url( __FILE__ ); if ( preg_match( '/^https/', $pluginurl ) && !preg_match( '/^https/', get_bloginfo('url') ) ) $pluginurl = preg_replace( '/^https/', 'http', $pluginurl ); define( 'WPSEO_FRONT_URL', $pluginurl ); unset( $pluginurl ); require WPSEO_PATH.'inc/wpseo-functions.php'; $options = get_wpseo_options(); if ( !defined('DOING_AJAX') || !DOING_AJAX ) require WPSEO_PATH.'inc/wpseo-non-ajax-functions.php'; /** * Used to load the required files on the plugins_loaded hook, instead of immediately. */ function wpseo_frontend_init() { $options = get_wpseo_options(); require WPSEO_PATH.'frontend/class-frontend.php'; if ( isset($options['enablexmlsitemap']) && $options['enablexmlsitemap'] ) require WPSEO_PATH.'inc/class-sitemaps.php'; if ( isset( $options['stripcategorybase']) && $options['stripcategorybase'] ) require WPSEO_PATH.'inc/class-rewrite.php'; if ( isset($options['breadcrumbs-enable']) && $options['breadcrumbs-enable'] ) require WPSEO_PATH.'frontend/class-breadcrumbs.php'; if ( isset( $options['opengraph'] ) && $options['opengraph'] ) require WPSEO_PATH.'frontend/class-opengraph.php'; if ( isset( $options['twitter'] ) && $options['twitter'] ) require WPSEO_PATH.'frontend/class-twitter.php'; } /** * Used to load the required files on the plugins_loaded hook, instead of immediately. */ function wpseo_admin_init() { $options = get_wpseo_options(); if ( isset( $_GET['wpseo_restart_tour'] ) ) { unset( $options['ignore_tour'] ); update_option( 'wpseo', $options ); } require WPSEO_PATH.'admin/class-admin.php'; global $pagenow; if ( in_array( $pagenow, array('edit.php', 'post.php', 'post-new.php') ) ) { require WPSEO_PATH.'admin/class-metabox.php'; if ( isset( $options['opengraph'] ) && $options['opengraph'] ) require WPSEO_PATH.'admin/class-opengraph-admin.php'; } if ( in_array( $pagenow, array('edit-tags.php') ) ) require WPSEO_PATH.'admin/class-taxonomy.php'; if ( in_array( $pagenow, array('admin.php') ) ) require WPSEO_PATH.'admin/class-config.php'; if ( !isset( $options['ignore_tour'] ) || !$options['ignore_tour'] ) require WPSEO_PATH.'admin/class-pointers.php'; if ( isset( $options['enablexmlsitemap'] ) && $options['enablexmlsitemap'] ) require WPSEO_PATH.'admin/class-sitemaps-admin.php'; } if ( is_admin() ) { if ( defined('DOING_AJAX') && DOING_AJAX ) { require WPSEO_PATH.'admin/ajax.php'; } else { add_action( 'plugins_loaded', 'wpseo_admin_init', 0 ); } register_activation_hook( __FILE__, 'wpseo_activate' ); register_deactivation_hook( __FILE__, 'wpseo_deactivate' ); } else { add_action( 'plugins_loaded', 'wpseo_frontend_init', 0 ); } unset( $options );