PluginProbe ʕ •ᴥ•ʔ
Photo Gallery by FooGallery : Responsive Image Gallery, Masonry Gallery & Carousel / 3.1.26.2
Photo Gallery by FooGallery : Responsive Image Gallery, Masonry Gallery & Carousel v3.1.26.2
trunk 1.10.3 2.0.24 2.1.34 2.2.44 2.3.3 2.4.32 3.0.6 3.1.11 3.1.12 3.1.13 3.1.20 3.1.25 3.1.26 3.1.26.1 3.1.26.2
foogallery / includes / class-foogallery-force-https.php
foogallery / includes Last commit date
admin 2 months ago compatibility 2 months ago extensions 2 months ago foopluginbase 2 months ago public 2 months ago thumbs 2 months ago asset-manifest.php 2 months ago class-attachment-filters.php 2 months ago class-command-palette.php 2 months ago class-foogallery-animated-gif-support.php 2 months ago class-foogallery-attachment-custom-class.php 2 months ago class-foogallery-attachment-type.php 2 months ago class-foogallery-attachment.php 2 months ago class-foogallery-cache.php 2 months ago class-foogallery-common-fields.php 2 months ago class-foogallery-crop-position.php 2 months ago class-foogallery-datasource-media_library.php 2 months ago class-foogallery-debug.php 2 months ago class-foogallery-extensions-compatibility.php 2 months ago class-foogallery-force-https.php 2 months ago class-foogallery-lazyload.php 2 months ago class-foogallery-license-constant-handler.php 2 months ago class-foogallery-lightbox.php 2 months ago class-foogallery-paging.php 2 months ago class-foogallery-password-protect.php 2 months ago class-foogallery-sitemaps.php 2 months ago class-foogallery-widget.php 2 months ago class-foogallery.php 2 months ago class-gallery-advanced-settings.php 2 months ago class-il8n.php 2 months ago class-override-thumbnail.php 2 months ago class-posttypes.php 2 months ago class-previews.php 2 months ago class-retina.php 2 months ago class-thumbnail-dimensions.php 2 months ago class-thumbnails.php 2 months ago class-version-check.php 2 months ago constants.php 2 months ago functions.php 2 months ago includes.php 2 months ago index.php 2 months ago render-functions.php 2 months ago
class-foogallery-force-https.php
91 lines
1 <?php
2 /**
3 * Class used to force HTTPS for all FooGallery assets
4 * @since 1.6.18
5 */
6 if ( ! class_exists( 'FooGallery_ForceHttps' ) ) {
7
8 class FooGallery_ForceHttps {
9
10 function __construct() {
11 add_filter( 'foogallery_admin_settings_override', array($this, 'add_settings' ) );
12 add_action( 'plugins_loaded', array( $this, 'enable_force' ) );
13 }
14
15 /**
16 * Enables the force checks based on the setting. This is done here so that the setting is only checked once per page load, rather than multiple times
17 *
18 */
19 function enable_force() {
20 if ( 'on' === foogallery_get_setting( 'force_https' ) ) {
21 add_filter( 'foogallery_process_image_url', array( $this, 'force_images_to_https' ), 99 );
22 add_filter( 'foogallery_enqueue_style_src', array( $this, 'force_css_to_https'), 99, 2 );
23 add_filter( 'foogallery_core_gallery_script', array( $this, 'force_js_to_https'), 99 );
24 }
25 }
26
27 /**
28 * Add settings for Force Https
29 * @param $settings
30 *
31 * @return array
32 */
33 function add_settings( $settings ) {
34 $settings['settings'][] = array(
35 'id' => 'force_https',
36 'title' => __( 'Force HTTPS', 'foogallery' ),
37 'desc' => __( 'Force all assets (thumbnails, javascript, css) to load over the HTTPS protocol. This can help overcome some issues when moving your site across to HTTPS and you get mixed content errors.', 'foogallery' ),
38 'type' => 'checkbox',
39 'tab' => 'advanced'
40 );
41 return $settings;
42 }
43
44 /**
45 * Helper function that does the replacement and forces Https
46 *
47 * @param $url
48 *
49 * @return string
50 */
51 function force_https( $url ) {
52 return str_replace( 'http://', 'https://', $url );
53 }
54
55 /**
56 * Force an image URL to Https
57 *
58 * @param $url
59 *
60 * @return string
61 */
62 function force_images_to_https( $url ) {
63 return $this->force_https( $url );
64 }
65
66 /**
67 * Force any CSS loaded using the foogallery_enqueue_style function to Https
68 *
69 * @param $src
70 * @param $handle
71 *
72 * @return string
73 */
74 function force_css_to_https( $src, $handle ) {
75 $src = $this->force_https( $src );
76 return $src;
77 }
78
79 /**
80 * Force the js loaded for the default gallery templates to Https
81 *
82 * @param $src
83 *
84 * @return string
85 */
86 function force_js_to_https( $src ) {
87 $src = $this->force_https( $src );
88 return $src;
89 }
90 }
91 }