WordPress.org

Ready to get started?Download WordPress

Forums

Relocate Upload
not work with HTTPS (1 post)

  1. shakemid
    Member
    Posted 3 years ago #

    Hello,

    I found it does not work with HTTPS.
    I made a patch for relocate-upload.php to work with HTTPS.
    It seems to work well with WordPress 3.0.1.

    Please consider about the patch.
    Regards.

    --- relocate-upload.php.orig    2010-10-11 20:06:04.000000000 +0900
    +++ relocate-upload.php 2010-10-11 20:30:11.000000000 +0900
    @@ -92,7 +92,11 @@
            {       jQuery($element).attr({disabled: true});
                    jQuery($element).siblings("span").html(' Moving...');
                    jQuery.get(
    -                       "<?php echo WP_CONTENT_URL."/plugins/relocate-upload/relocate-upload.php"; ?>",
    +                       "<?php
    +                $content_url = ( empty($_SERVER['HTTPS']) )
    +                    ? WP_CONTENT_URL
    +                    : str_replace( "http://", "https://", WP_CONTENT_URL );
    +                echo $content_url."/plugins/relocate-upload/relocate-upload.php"; ?>",
                            {       ru_folder: $element.selectedIndex,
                                           id: $element.getAttribute('media_id'),
                                     _wpnonce: '<?php echo wp_create_nonce("ru_request_move") ?>',
    @@ -292,6 +296,6 @@
    
     add_filter( 'wp_get_attachment_url', "wp_get_attachment_url_absolute_path_fix");
    -function wp_get_attachment_url_absolute_path_fix($url) {       return preg_replace('#(http://.*?/).*?/'.(SERVER_DOC_ROOT).'/#','\1',$url); }
    +function wp_get_attachment_url_absolute_path_fix($url) {       return preg_replace('#(https?://.*?/).*?/'.(SERVER_DOC_ROOT).'/#','\1',$url); }
    
     ?>

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic