get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}shopp_product WHERE slug = %s", $slug ) );
if ( $results ) {
add_shortcode( 'shoppseo', 'shopp_seo_shortcode' );
ob_start( 'shopp_seo_callback' );
}
}
}
global $shopp_seo_data;
$shopp_seo_data = array();
function shopp_seo_callback( $data ) {
global $shopp_seo_data;
if ( preg_match( '#
(.*)#', $data, $matches ) && isset( $shopp_seo_data['title'] ) ) {
$seo_options = get_option( 'aioseop_options' );
if ( $seo_options ) {
$title_format = str_replace( '%blog_title%', get_bloginfo( 'name' ), $seo_options['aiosp_post_title_format'] );
$data = str_replace( $matches[0], '' . str_replace( '%post_title%', $shopp_seo_data['title'], $title_format ) . '', $data );
}
}
if ( preg_match( '##', $data, $matches ) && isset( $shopp_seo_data['desc'] ) ) {
$data = str_replace( $matches[0], '', $data );
}
return $data;
}
function shopp_seo_shortcode( $attribs ) {
global $shopp_seo_data;
if ( isset( $attribs['title'] ) ) {
$shopp_seo_data['title'] = $attribs['title'];
}
if ( isset( $attribs['desc'] ) ) {
$shopp_seo_data['desc'] = $attribs['desc'];
}
}
?>