Skip to content

Instantly share code, notes, and snippets.

@cliffordp
Last active February 12, 2017 16:38
Show Gist options
  • Save cliffordp/6902783 to your computer and use it in GitHub Desktop.
Save cliffordp/6902783 to your computer and use it in GitHub Desktop.
PageLines DMS Force SSL/HTTPS
<?php
/*
Plugin Name: PageLines DMS Force SSL/HTTPS (for WP Engine)
Author: TourKick (Clifford P)
Author URI: http://tourkick.com/?utm_source=pagelines&utm_medium=plugin&utm_content=pluginuri&utm_campaign=dmsforcessl
Plugin URI: http://www.pagelinestheme.com/pagelines-dms-ssl-https/?utm_source=pagelines&utm_medium=plugin&utm_content=pluginuri&utm_campaign=dmsforcessl
Description: Force PageLines DMS SSL/HTTPS. <a href="http://www.pagelinestheme.com/pagelines-dms-ssl-https/" target="_blank">http://www.pagelinestheme.com/pagelines-dms-ssl-https/</a> may also be helpful.
License: GPLv2
Version: 1.2
*/
if( defined('WP_SITEURL') // or could use DOMAIN_CURRENT_SITE for Multisite -- if changed, change in both places
&& preg_match('/.staging.wpengine.com$/', constant('WP_SITEURL')) ) {} else {
// Force PL SSL if not WP Engine Staging Site
add_action( 'pl_force_ssl', '__return_true' );
add_filter( 'pless_vars', 'make_ssl_vars' );
function make_ssl_vars( $vars ) {
$vars['plSectionsRoot'] = str_replace( 'http://', 'https://', $vars['plSectionsRoot'] );
$vars['plRoot'] = str_replace( 'http://', 'https://', $vars['plRoot'] );
return $vars;
}
// If PL DMS Editor won't save changes on a site with SSL
// don't add unless you absolutely need to
// add_action('wp_ajax_nopriv_pl_editor_actions', 'pl_editor_actions');
}
<?php
/*
Plugin Name: PageLines DMS Force SSL/HTTPS (not WP Engine specific)
Author: TourKick (Clifford P)
Author URI: http://tourkick.com/?utm_source=pagelines&utm_medium=plugin&utm_content=pluginuri&utm_campaign=dmsforcessl
Plugin URI: http://www.pagelinestheme.com/pagelines-dms-ssl-https/?utm_source=pagelines&utm_medium=plugin&utm_content=pluginuri&utm_campaign=dmsforcessl
Description: Force PageLines DMS SSL/HTTPS. <a href="http://www.pagelinestheme.com/pagelines-dms-ssl-https/" target="_blank">http://www.pagelinestheme.com/pagelines-dms-ssl-https/</a> may also be helpful.
License: GPLv2
Version: 1.2
*/
// Force PL SSL
add_action( 'pl_force_ssl', '__return_true' );
add_filter( 'pless_vars', 'make_ssl_vars' );
function make_ssl_vars( $vars ) {
$vars['plSectionsRoot'] = str_replace( 'http://', 'https://', $vars['plSectionsRoot'] );
$vars['plRoot'] = str_replace( 'http://', 'https://', $vars['plRoot'] );
return $vars;
}
// If PL DMS Editor won't save changes on a site with SSL
// don't add unless you absolutely need to
// add_action('wp_ajax_nopriv_pl_editor_actions', 'pl_editor_actions');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment