but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ if (!defined('ABSPATH')) { exit; } define('SSLFIX_PLUGIN_FILE', __FILE__); define('SSLFIX_PLUGIN_ROOT', dirname(__FILE__) . '/'); define('SSLFIX_PLUGIN_NAME', basename(dirname(__FILE__)) . '/' . basename(__FILE__)); define('SSLFIX_PLUGIN_VERSION', '2.2.1'); define('SSLFIX_PLUGIN_OPTIONS', 'ssl_insecure_content_fixer'); require SSLFIX_PLUGIN_ROOT . 'includes/class.SSLInsecureContentFixer.php'; SSLInsecureContentFixer::getInstance(); /** * replace http: URL with https: URL * @param string $url * @return string */ function ssl_insecure_content_fix_url($url) { // only fix if source URL starts with http:// if (stripos($url, 'http://') === 0) { $url = 'https' . substr($url, 4); } return $url; }
/** * settings admin */ public function settingsPage() { if (is_network_admin()) { // multisite network settings $options = SSLInsecureContentFixer::getInstance()->network_options; if (!empty($_POST[SSLFIX_PLUGIN_OPTIONS])) { check_admin_referer('settings', 'sslfix_nonce'); $options = wp_unslash($_POST[SSLFIX_PLUGIN_OPTIONS]); $options = $this->settingsValidate($options); if (!$this->has_settings_errors) { update_site_option(SSLFIX_PLUGIN_OPTIONS, $options); add_settings_error(SSLFIX_PLUGIN_OPTIONS, 'sslfix-network-updated', __('Multisite network settings updated.', 'ssl-insecure-content-fixer'), 'updated'); } } require SSLFIX_PLUGIN_ROOT . 'views/settings-form-network.php'; } else { // individual site settings $options = SSLInsecureContentFixer::getInstance()->options; require SSLFIX_PLUGIN_ROOT . 'views/settings-form.php'; } $min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min'; $ver = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? time() : SSLFIX_PLUGIN_VERSION; $ajax_url = $this->getNoWpAJAX(); wp_enqueue_script('sslfix-admin-settings', plugins_url("js/admin-settings{$min}.js", SSLFIX_PLUGIN_FILE), array('jquery'), $ver, true); wp_localize_script('sslfix-admin-settings', 'sslfix', array('ajax_url' => $ajax_url, 'ajax_url_ssl' => ssl_insecure_content_fix_url($ajax_url), 'msg' => array('recommended' => _x('* detected as recommended setting', 'proxy settings', 'ssl-insecure-content-fixer')))); }