load_modules(); } } /** * Check if we just got activated. */ if ( !function_exists( 'aioseop_activate' ) ) { function aioseop_activate() { global $aiosp_activation; $aiosp_activation = true; } } /** * Check if settings need to be updated / migrated from old version. */ if ( !function_exists( 'aioseop_update_settings_check' ) ) { function aioseop_update_settings_check() { global $aioseop_options; if ( isset( $_POST['aioseop_migrate'] ) ) aioseop_mrt_fix_meta(); if ( ( isset( $_POST['aioseop_migrate_options'] ) ) || ( empty( $aioseop_options ) ) ) { aioseop_mrt_mkarry(); } // WPML has now attached to filters, read settings again so they can be translated $aioseop_options = get_option( 'aioseop_options' ); } } /** * Update old settings to current format. */ if ( !function_exists( 'aioseop_mrt_fix_meta' ) ) { function aioseop_mrt_fix_meta() { global $wpdb, $aiosp_activation; $wpdb->query( "UPDATE $wpdb->postmeta SET meta_key = '_aioseop_keywords' WHERE meta_key = 'keywords'" ); $wpdb->query( "UPDATE $wpdb->postmeta SET meta_key = '_aioseop_title' WHERE meta_key = 'title'" ); $wpdb->query( "UPDATE $wpdb->postmeta SET meta_key = '_aioseop_description' WHERE meta_key = 'description'" ); $wpdb->query( "UPDATE $wpdb->postmeta SET meta_key = '_aioseop_meta' WHERE meta_key = 'aiosp_meta'" ); $wpdb->query( "UPDATE $wpdb->postmeta SET meta_key = '_aioseop_disable' WHERE meta_key = 'aiosp_disable'" ); if ( !$aiosp_activation ) // don't echo on initial plugin activation echo "
" . __( "Updating SEO post meta in database.", 'all_in_one_seo_pack' ) . "
';
die( "jQuery('div#aioseop_" . $target . "_" . $post_id . "').fadeOut('fast', function() {
jQuery('div#aioseop_" . $target . "_" . $post_id . "').html('" . addslashes_gpc($output) . "').fadeIn('fast');
});" );
}
}
if ( !function_exists( 'aioseop_ajax_init' ) ) {
function aioseop_ajax_init() {
if ( !empty( $_POST ) && !empty( $_POST['settings'] ) && !empty( $_POST['nonce-aioseop']) && !empty( $_POST['options'] ) ) {
$_POST = stripslashes_deep( $_POST );
$settings = esc_attr( $_POST['settings'] );
if ( ! defined( 'AIOSEOP_AJAX_MSG_TMPL' ) )
define( 'AIOSEOP_AJAX_MSG_TMPL', "jQuery('div#aiosp_$settings').fadeOut('fast', function(){jQuery('div#aiosp_$settings').html('%s').fadeIn('fast');});" );
if ( !wp_verify_nonce($_POST['nonce-aioseop'], 'aioseop-nonce') ) die( sprintf( AIOSEOP_AJAX_MSG_TMPL, __( "Unauthorized access; try reloading the page.", 'all_in_one_seo_pack' ) ) );
} else {
die(0);
}
}
}
if ( !function_exists( 'aioseop_mrt_pccolumn' ) ) {
function aioseop_mrt_pccolumn($aioseopcn, $aioseoppi) {
$id = $aioseoppi;
$target = null;
if( $aioseopcn == 'seotitle' ) $target = 'title';
if( $aioseopcn == 'seokeywords' ) $target = 'keywords';
if( $aioseopcn == 'seodesc' ) $target = 'description';
if ( !$target ) return;
if( current_user_can( 'edit_post', $id ) ) { ?>
$v ) {
$excluded[$k] = trim( $v );
if ( empty( $excluded[$k] ) ) unset( $excluded[$k] );
}
if ( empty( $excluded ) ) $excluded = null;
}
}
if ( !empty( $excluded ) ) {
if ( $url === null )
$url = $_SERVER['REQUEST_URI'];
else {
$url = parse_url( $url );
if ( !empty( $url['path'] ) )
$url = $url['path'];
else
return false;
}
if ( !empty( $url ) )
foreach( $excluded as $exedd )
if ( ( $exedd ) && ( stripos( $url, $exedd ) !== FALSE ) )
return true;
}
return false;
}
}
if ( !function_exists( 'aioseop_get_pages_start' ) ) {
function aioseop_get_pages_start( $excludes ) {
global $aioseop_get_pages_start;
$aioseop_get_pages_start = 1;
return $excludes;
}
}
if ( !function_exists( 'aioseop_get_pages' ) ) {
function aioseop_get_pages( $pages ) {
global $aioseop_get_pages_start;
if ( !$aioseop_get_pages_start ) return $pages;
foreach ( $pages as $k => $v ) {
$postID = $v->ID;
$menulabel = stripslashes( get_post_meta( $postID, '_aioseop_menulabel', true ) );
if ( $menulabel ) $pages[$k]->post_title = $menulabel;
}
$aioseop_get_pages_start = 0;
return $pages;
}
}
// The following two functions are GPLed from Sarah G's Page Menu Editor, http://wordpress.org/extend/plugins/page-menu-editor/.
if ( !function_exists( 'aioseop_list_pages' ) ) {
function aioseop_list_pages( $content ) {
global $wp_version;
$matches = array();
if ( preg_match_all( '/