Fix for https secured sites
-
Hi,
thanks for this helpful plugin!
I ran into an issue when running this plugin on a https secured login page in a member based network. The plugin url was refered as http instead of https.The following code is a fix for the problem, you might want to upgrade your plugin to the next version.
Happy to help!
Code:
—–
<?php/*
Plugin Name: WP Fluid Images
Plugin URI: https://www.slash25.com
Description: WP Fluid Images replaces the fixed width and height attributes so your images resize in a fluid or responsive design.
Author: Pat Ramsey
Author URI: https://www.slash25.comVersion: 1.1.3
License: GNU General Public License v2.0
License URI: https://www.opensource.org/licenses/gpl-license.php
*//**
* Returns current plugin url
*
* @return string Plugin url
*/
function fluidi_plugin_url() {
return plugins_url( basename( __FILE__, ‘.php’ ), dirname( __FILE__ ) );
}add_action( ‘init’, ‘WPFluidSettingsInit’, 15 );
function WPFluidSettingsInit() {
//Translations
if ( !is_admin() ) { // instruction to only load if it is not the admin area
$foo_loc = fluidi_plugin_url().’/’.str_replace(basename( __FILE__),””,plugin_basename(__FILE__));
$js_loc = $foo_loc . ‘/lib/’;
wp_register_script(‘fluidimage’, $js_loc.’fluidimage.js’, array(‘jquery’), ‘1.0’,false);
wp_enqueue_script(‘fluidimage’);
}
}add_action ( ‘wp_footer’,’fluidstyle’ );
function fluidstyle() {
if(!is_admin()) {
echo ‘<span></span><style type=”text/css” class=”fluid-images”>img{max-width:100%;height:auto;}</style>’;
}
}add_filter( ‘post_thumbnail_html’, ‘s25_remove_image_dimensions’, 30 );
add_filter( ‘image_send_to_editor’, ‘s25_remove_image_dimensions’, 30 );
function s25_remove_image_dimensions($html){
$html = preg_replace( ‘/(width|height)=\”\d*\”\s/’, “”, $html );
return $html;
}
- The topic ‘Fix for https secured sites’ is closed to new replies.