post_content;
// Get the domain names
$ssldomain = get_option( 'sc_ssl_fix_links_ssldomain' );
$normaldomain = get_option( 'sc_ssl_fix_links_normaldomain' );
$replaced = str_replace( $ssldomain, $normaldomain, $post_content);
if ($replaced != $post_content) {
// Set a transient to show the users an admin message
set_transient( "sc_ssl_fixed_links", "yes" );
// No infinite loops, please
remove_action( 'save_post', array( 'sc_ssl', 'fix_links') );
// Replace the post's content
wp_update_post( array('ID' => $post_id, 'post_content' => $replaced) );
// Add the action again
add_action( 'save_post', array( 'sc_ssl', 'fix_links') );
}
}
function fix_links_info ()
{
// Show the admin message
if ( get_transient( 'sc_ssl_fixed_links' ) == 'yes' ) {
echo '
Shared SSL: Replaced one or more links to your shared SSL domain.
';
delete_transient( 'sc_ssl_fixed_links' );
}
}
//Options menu
function fix_menu()
{
add_options_page( 'Shared SSL Options', 'Shared SSL Options', 'manage_options', 'sc_ssl_fix', 'sc_ssl_fix_options' );
}
}
function sc_ssl_fix_options()
{
echo "Shared SSL Options
";
if ( !current_user_can( 'manage_options' ) ) {
wp_die( __('You do not have sufficient permissions to access this page.') );
}
$hidden_field_name = 'sc_ssl_fix_submit_hidden';
$ssldomain_field_name = 'sc_ssl_fix_links_ssldomain';
$normaldomain_field_name = 'sc_ssl_fix_links_normal';
$wpconfig_field_name = 'sc_ssl_siteurl';
// Get the domain names
$ssldomain = get_option( 'sc_ssl_fix_links_ssldomain' );
$normaldomain = get_option( 'sc_ssl_fix_links_normaldomain' );
$wpconfig_value = sc_ssl_domainfix( $ssldomain, $normaldomain );
// Read existing option value from database
$opt_ssldomain_val = get_option( 'sc_ssl_fix_links_ssldomain' );
$opt_normaldomain_val = get_option( 'sc_ssl_fix_links_normaldomain' );
// Posted new options?
if ( isset( $_POST[ $hidden_field_name ]) && $_POST[ $hidden_field_name ] == 'Y' ) {
if ( $opt_ssldomain_val != $_POST[ $ssldomain_field_name ] || $opt_normaldomain_val != $_POST[ $normaldomain_field_name ] ) {
$wpconfig_value = sc_ssl_domainfix( $_POST[ $ssldomain_field_name ], $_POST[ $normaldomain_field_name ] );
?>