[PATCH] HTTPS support
-
Current version, 1.3.7, doesn’t work over HTTPS as it tries to load JS and CSS files over HTTP. The fix is to replace the use of internal constants with plugins_url() as recommended. Here’s the patch:
1. Change in dcwp_slick_contact.php line 60 from:
return WP_PLUGIN_URL . '/slick-contact-forms';
to:
return plugins_url('', __FILE__);
2.Change in inc/dcwp_plugin_admin.php line 29 from:
wp_enqueue_style('dcwp_plugin_admin_dcscf_css', WP_CONTENT_URL . '/plugins/' . plugin_basename(dirname($this->filename)). '/css/admin.css');
to:
wp_enqueue_style('dcwp_plugin_admin_dcscf_css', dc_jqslickcontact::get_plugin_directory() . '/css/admin.css');
and line 37 from:
wp_enqueue_style('dcwp_plugin_admin_dcscf_jquery', WP_CONTENT_URL . '/plugins/' . plugin_basename(dirname($this->filename)). '/js/jquery.admin.js');
to:
wp_enqueue_script('dcwp_plugin_admin_dcscf_jquery', dc_jqslickcontact::get_plugin_directory() . '/js/jquery.admin.js');
3. Remove in inc/dcwp_admin.php the row 209:
add_action('init', array(&$this, 'my_init_method'));
and 240-252:
function my_init_method() { if ( version_compare( get_bloginfo( 'version' ) , '3.0' , '<' ) && is_ssl() ) { $wp_content_url = str_replace( 'https://' , 'https://' , get_option( 'siteurl' ) ); } else { $wp_content_url = get_option( 'siteurl' ); } $wp_content_url .= '/wp-content'; $wp_plugin_url = $wp_content_url . '/plugins'; wp_register_style('dcwp_plugin_admin_dcscf_css', $wp_plugin_url .'/slick-contact-forms/css/admin.css'); wp_enqueue_style('dcwp_plugin_admin_dcscf_css'); }
This patch fixes two other bugs as well. The removed lines added admin CSS style unnecessarily to all front end pages; a different piece of code already ensures the style is added to admin pages where it’s needed. Removing this speeds up every site that uses this plugin. The second one is that admin jQuery code was incorrectly enqueued as a style instead of a script.
- The topic ‘[PATCH] HTTPS support’ is closed to new replies.