| 1 |
<?php |
| 2 |
defined( 'ABSPATH' ) || die( 'Cheatin\' uh?' ); |
| 3 |
|
| 4 |
if ( function_exists( 'fn_lc_fix_ssl_upload_url' ) && defined( 'SLC_VERSION' ) && version_compare( SLC_VERSION, '2.2.8' ) < 0 ) : |
| 5 |
|
| 6 |
/** |
| 7 |
* Fixes a bug in Screets Live Chat plugin (prior version 2.2.8), preventing wp_get_upload_dir() to work properly. |
| 8 |
*/ |
| 9 |
remove_filter( 'upload_dir', 'fn_lc_fix_ssl_upload_url' ); |
| 10 |
add_filter( 'upload_dir', 'imagify_screets_lc_fix_ssl_upload_url' ); |
| 11 |
/** |
| 12 |
* Filters the uploads directory data to force https URLs. |
| 13 |
* |
| 14 |
* @since 1.6.7 |
| 15 |
* @author Grégory Viguier |
| 16 |
* |
| 17 |
* @param array $uploads Array of upload directory data with keys of 'path', 'url', 'subdir, 'basedir', 'baseurl', and 'error'. |
| 18 |
* @return array |
| 19 |
*/ |
| 20 |
function imagify_screets_lc_fix_ssl_upload_url( $uploads ) { |
| 21 |
if ( false !== $uploads['error'] || ! is_ssl() ) { |
| 22 |
return $uploads; |
| 23 |
} |
| 24 |
|
| 25 |
$uploads['url'] = str_replace( 'http://', 'https://', $uploads['url'] ); |
| 26 |
$uploads['baseurl'] = str_replace( 'http://', 'https://', $uploads['baseurl'] ); |
| 27 |
|
| 28 |
return $uploads; |
| 29 |
} |
| 30 |
|
| 31 |
endif; |
| 32 |
|