Skip to content

Commit f59ec0c

Browse files
committed
Added support for SSL loading scripts.
1 parent 7aa5c07 commit f59ec0c

File tree

4 files changed

+38
-2
lines changed

4 files changed

+38
-2
lines changed

paystack-forms.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,39 @@
1414
if ( ! defined( 'WPINC' ) ) {
1515
die;
1616
}
17+
// fix some badly enqueued scripts with no sense of HTTPS
18+
add_action('wp_print_scripts', 'enqueueScriptsFix', 100);
19+
add_action('wp_print_styles', 'enqueueStylesFix', 100);
1720

21+
/**
22+
* force plugins to load scripts with SSL if page is SSL
23+
*/
24+
function enqueueScriptsFix() {
25+
if (!is_admin()) {
26+
if (!empty($_SERVER['HTTPS'])) {
27+
global $wp_scripts;
28+
foreach ((array) $wp_scripts->registered as $script) {
29+
if (stripos($script->src, 'http://', 0) !== FALSE)
30+
$script->src = str_replace('http://', 'https://', $script->src);
31+
}
32+
}
33+
}
34+
}
35+
36+
/**
37+
* force plugins to load styles with SSL if page is SSL
38+
*/
39+
function enqueueStylesFix() {
40+
if (!is_admin()) {
41+
if (!empty($_SERVER['HTTPS'])) {
42+
global $wp_styles;
43+
foreach ((array) $wp_styles->registered as $script) {
44+
if (stripos($script->src, 'http://', 0) !== FALSE)
45+
$script->src = str_replace('http://', 'https://', $script->src);
46+
}
47+
}
48+
}
49+
}
1850

1951

2052
/**

paystack_forms.zip

-57.4 KB
Binary file not shown.

public/class-paystack-forms-public.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ function cf_shortcode($atts) {
169169
// echo '<p>Total charge:'.$currency.'<b class="total_charge">13,000</b></p>';
170170
echo '<p> <br /><input type="submit" class="btn btn-danger" value="'.$paybtn.'" ></p>';
171171

172-
echo '<img src="'. plugins_url( '../images/[email protected]' , __FILE__ ) .'" alt="cardlogos" width="300" height="36" class="alignnone size-full wp-image-1096" />';
172+
echo '<img src="'. plugins_url( '../images/[email protected]' , __FILE__ ) .'" alt="cardlogos" class="paystack-cardlogos size-full wp-image-1096" />';
173173
echo '</form>';
174174
# code...
175175
}else{
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
/**
22
* All of the CSS for your public-facing functionality should be
33
* included in this file.
4-
*/
4+
*/
5+
.paystack-cardlogos {
6+
width:300px !important;
7+
height:36px !important;
8+
}

0 commit comments

Comments
 (0)