"> css-text-orientation.js 77628cf8bf first comm 3 years ago css-text-spacing.js 77628cf8bf first comm 3 years ago css-textshadow.js 77628cf8bf first comm 3 years ago css-touch-action.js 77628cf8bf first comm 3 years ago css-transitions.js 77628cf8bf first comm 3 years ago css-unicode-bidi.js 77628cf8bf first comm 3 years ago css-unset-value.js 77628cf8bf first comm 3 years ago css-variables.js 77628cf8bf first comm 3 years ago css-when-else.js 77628cf8bf first comm 3 years ago css-widows-orphans.js 77628cf8bf first comm 3 years ago css-width-stretch.js 77628cf8bf first comm 3 years ago css-writing-mode.js 77628cf8bf first comm 3 years ago css-zoom.js 77628cf8bf first comm 3 years ago css3-attr.js 77628cf8bf first comm 3 years ago css3-boxsizing.js 77628cf8bf first comm 3 years ago css3-colors.js 77628cf8bf first comm 3 years ago css3-cursors-grab.js 77628cf8bf first comm 3 years ago css3-cursors-newer.js 77628cf8bf first comm 3 years ago css3-cursors.js 77628cf8bf first comm 3 years ago css3-tabsize.js 77628cf8bf first comm 3 years ago currentcolor.js 77628cf8bf first comm 3 years ago custom-elements.js 77628cf8bf first comm 3 years ago custom-elementsv1.js 77628cf8bf first comm 3 years ago customevent.js 77628cf8bf first comm 3 years ago datalist.js 77628cf8bf first comm 3 years ago dataset.js 77628cf8bf first comm 3 years ago datauri.js 77628cf8bf first comm 3 years ago date-tolocaledatestring.js 77628cf8bf first comm 3 years ago declarative-shadow-dom.js 77628cf8bf first comm 3 years ago decorators.js 77628cf8bf first comm 3 years ago details.js 77628cf8bf first comm 3 years ago deviceorientation.js 77628cf8bf first comm 3 years ago devicepixelratio.js 77628cf8bf first comm 3 years ago dialog.js 77628cf8bf first comm 3 years ago dispatchevent.js 77628cf8bf first comm 3 years ago dnssec.js 77628cf8bf first comm 3 years ago do-not-track.js 77628cf8bf first comm 3 years ago document-currentscript.js 77628cf8bf first comm 3 years ago document-evaluate-xpath.js 77628cf8bf first comm 3 years ago document-execcommand.js 77628cf8bf first comm 3 years ago document-policy.js 77628cf8bf first comm 3 years ago document-scrollingelement.js 77628cf8bf first comm 3 years ago documenthead.js 77628cf8bf first comm 3 years ago dom-manip-convenience.js 77628cf8bf first comm 3 years ago dom-range.js 77628cf8bf first comm 3 years ago domcontentloaded.js 77628cf8bf first comm 3 years ago dommatrix.js 77628cf8bf first comm 3 years ago download.js 77628cf8bf first comm 3 years ago dragndrop.js 77628cf8bf first comm 3 years ago element-closest.js 77628cf8bf first comm 3 years ago element-from-point.js 77628cf8bf first comm 3 years ago element-scroll-methods.js 77628cf8bf first comm 3 years ago eme.js 77628cf8bf first comm 3 years ago eot.js 77628cf8bf first comm 3 years ago es5.js 77628cf8bf first comm 3 years ago es6-class.js 77628cf8bf first comm 3 years ago es6-generators.js 77628cf8bf first comm 3 years ago es6-module-dynamic-import.js 77628cf8bf first comm 3 years ago es6-module.js 77628cf8bf first comm 3 years ago es6-number.js 77628cf8bf first comm 3 years ago es6-string-includes.js 77628cf8bf first comm 3 years ago es6.js 77628cf8bf first comm 3 years ago eventsource.js 77628cf8bf first comm 3 years ago extended-system-fonts.js 77628cf8bf first comm 3 years ago feature-policy.js 77628cf8bf first comm 3 years ago fetch.js 77628cf8bf first comm 3 years ago fieldset-disabled.js 77628cf8bf first comm 3 years ago fileapi.js 77628cf8bf first comm 3 years ago filereader.js 77628cf8bf first comm 3 years ago filereadersync.js 77628cf8bf first comm 3 years ago filesystem.js 77628cf8bf first comm 3 years ago flac.js 77628cf8bf first comm 3 years ago flexbox-gap.js 77628cf8bf first comm 3 years ago flexbox.js 77628cf8bf first comm 3 years ago flow-root.js 77628cf8bf first comm 3 years ago focusin-focusout-events.js 77628cf8bf first comm 3 years ago font-family-system-ui.js 77628cf8bf first comm 3 years ago font-feature.js 77628cf8bf first comm 3 years ago font-kerning.js 77628cf8bf first comm 3 years ago font-loading.js 77628cf8bf first comm 3 years ago font-size-adjust.js 77628cf8bf first comm 3 years ago font-smooth.js 77628cf8bf first comm 3 years ago font-unicode-range.js 77628cf8bf first comm 3 years ago font-variant-alternates.js 77628cf8bf first comm 3 years ago font-variant-numeric.js 77628cf8bf first comm 3 years ago fontface.js 77628cf8bf first comm 3 years ago form-attribute.js 77628cf8bf first comm 3 years ago form-submit-attributes.js 77628cf8bf first comm 3 years ago form-validation.js 77628cf8bf first comm 3 years ago forms.js 77628cf8bf first comm 3 years ago fullscreen.js 77628cf8bf first comm 3 years ago gamepad.js 77628cf8bf first comm 3 years ago geolocation.js 77628cf8bf first comm 3 years ago getboundingclientrect.js 77628cf8bf first comm 3 years ago getcomputedstyle.js 77628cf8bf first comm 3 years ago getelementsbyclassname.js 77628cf8bf first comm 3 years ago getrandomvalues.js 77628cf8bf first comm 3 years ago gyroscope.js 77628cf8bf first comm 3 years ago hardwareconcurrency.js 77628cf8bf first comm 3 years ago hashchange.js 77628cf8bf first comm 3 years ago heif.js 77628cf8bf first comm 3 years ago hevc.js 77628cf8bf first comm 3 years ago hidden.js 77628cf8bf first comm 3 years ago high-resolution-time.js 77628cf8bf first comm 3 years ago history.js 77628cf8bf first comm 3 years ago html-media-capture.js 77628cf8bf first comm 3 years ago html5semantic.js 77628cf8bf first comm 3 years ago http-live-streaming.js 77628cf8bf first comm 3 years ago http2.js 77628cf8bf first comm 3 years ago http3.js 77628cf8bf first comm 3 years ago iframe-sandbox.js 77628cf8bf first comm 3 years ago iframe-seamless.js 77628cf8bf first comm 3 years ago iframe-srcdoc.js 77628cf8bf first comm 3 years ago imagecapture.js 77628cf8bf first comm 3 years ago ime.js 77628cf8bf first comm 3 years ago img-naturalwidth-naturalheight.js 77628cf8bf first comm 3 years ago import-maps.js 77628cf8bf first comm 3 years ago imports.js 77628cf8bf first comm 3 years ago indeterminate-checkbox.js 77628cf8bf first comm 3 years ago indexeddb.js 77628cf8bf first comm 3 years ago indexeddb2.js 77628cf8bf first comm 3 years ago inline-block.js 77628cf8bf first comm 3 years ago innertext.js 77628cf8bf first comm 3 years ago input-autocomplete-onoff.js 77628cf8bf first comm 3 years ago input-color.js 77628cf8bf first comm 3 years ago input-datetime.js 77628cf8bf first comm 3 years ago input-email-tel-url.js 77628cf8bf first comm 3 years ago input-event.js 77628cf8bf first comm 3 years ago input-file-accept.js 77628cf8bf first comm 3 years ago input-file-directory.js 77628cf8bf first comm 3 years ago input-file-multiple.js 77628cf8bf first comm 3 years ago input-inputmode.js 77628cf8bf first comm 3 years ago input-minlength.js 77628cf8bf first comm 3 years ago input-number.js 77628cf8bf first comm 3 years ago input-pattern.js 77628cf8bf first comm 3 years ago input-placeholder.js 77628cf8bf first comm 3 years ago input-range.js 77628cf8bf first comm 3 years ago input-search.js 77628cf8bf first comm 3 years ago input-selection.js 77628cf8bf first comm 3 years ago insert-adjacent.js 77628cf8bf first comm 3 years ago insertadjacenthtml.js 77628cf8bf first comm 3 years ago internationalization.js 77628cf8bf first comm 3 years ago intersectionobserver-v2.js 77628cf8bf first comm 3 years ago intersectionobserver.js 77628cf8bf first comm 3 years ago intl-pluralrules.js 77628cf8bf first comm 3 years ago intrinsic-width.js 77628cf8bf first comm 3 years ago jpeg2000.js 77628cf8bf first comm 3 years ago jpegxl.js 77628cf8bf first comm 3 years ago jpegxr.js 77628cf8bf first comm 3 years ago js-regexp-lookbehind.js 77628cf8bf first comm 3 years ago json.js 77628cf8bf first comm 3 years ago justify-content-space-evenly.js 77628cf8bf first comm 3 years ago kerning-pairs-ligatures.js 77628cf8bf first comm 3 years ago keyboardevent-charcode.js 77628cf8bf first comm 3 years ago keyboardevent-code.js 77628cf8bf first comm 3 years ago keyboardevent-getmodifierstate.js 77628cf8bf first comm 3 years ago keyboardevent-key.js 77628cf8bf first comm 3 years ago keyboardevent-location.js 77628cf8bf first comm 3 years ago keyboardevent-which.js 77628cf8bf first comm 3 years ago lazyload.js 77628cf8bf first comm 3 years ago let.js 77628cf8bf first comm 3 years ago link-icon-png.js 77628cf8bf first comm 3 years ago link-icon-svg.js 77628cf8bf first comm 3 years ago link-rel-dns-prefetch.js 77628cf8bf first comm 3 years ago link-rel-modulepreload.js 77628cf8bf first comm 3 years ago link-rel-preconnect.js 77628cf8bf first comm 3 years ago link-rel-prefetch.js 77628cf8bf first comm 3 years ago link-rel-preload.js 77628cf8bf first comm 3 years ago link-rel-prerender.js 77628cf8bf first comm 3 years ago loading-lazy-attr.js 77628cf8bf first comm 3 years ago localecompare.js 77628cf8bf first comm 3 years ago magnetometer.js 77628cf8bf first comm 3 years ago matchesselector.js 77628cf8bf first comm 3 years ago matchmedia.js 77628cf8bf first comm 3 years ago mathml.js 77628cf8bf first comm 3 years ago maxlength.js 77628cf8bf first comm 3 years ago mdn-css-unicode-bidi-isolate-override.js 77628cf8bf first comm 3 years ago mdn-css-unicode-bidi-isolate.js 77628cf8bf first comm 3 years ago mdn-css-unicode-bidi-plaintext.js 77628cf8bf first comm 3 years ago mdn-text-decoration-color.js 77628cf8bf first comm 3 years ago mdn-text-decoration-line.js 77628cf8bf first comm 3 years ago mdn-text-decoration-shorthand.js 77628cf8bf first comm 3 years ago mdn-text-decoration-style.js 77628cf8bf first comm 3 years ago media-fragments.js 77628cf8bf first comm 3 years ago mediacapture-fromelement.js 77628cf8bf first comm 3 years ago mediarecorder.js 77628cf8bf first comm 3 years ago mediasource.js 77628cf8bf first comm 3 years ago menu.js 77628cf8bf first comm 3 years ago meta-theme-color.js 77628cf8bf first comm 3 years ago meter.js 77628cf8bf first comm 3 years ago midi.js 77628cf8bf first comm 3 years ago minmaxwh.js 77628cf8bf first comm 3 years ago mp3.js 77628cf8bf first comm 3 years ago mpeg-dash.js 77628cf8bf first comm 3 years ago mpeg4.js 77628cf8bf first comm 3 years ago multibackgrounds.js 77628cf8bf first comm 3 years ago multicolumn.js 77628cf8bf first comm 3 years ago mutation-events.js 77628cf8bf first comm 3 years ago mutationobserver.js 77628cf8bf first comm 3 years ago namevalue-storage.js 77628cf8bf first comm 3 years ago native-filesystem-api.js 77628cf8bf first comm 3 years ago nav-timing.js 77628cf8bf first comm 3 years ago netinfo.js 77628cf8bf first comm 3 years ago notifications.js 77628cf8bf first comm 3 years ago object-entries.js 77628cf8bf first comm 3 years ago object-fit.js 77628cf8bf first comm 3 years ago object-observe.js 77628cf8bf first comm 3 years ago object-values.js 77628cf8bf first comm 3 years ago objectrtc.js 77628cf8bf first comm 3 years ago offline-apps.js 77628cf8bf first comm 3 years ago offscreencanvas.js 77628cf8bf first comm 3 years ago ogg-vorbis.js 77628cf8bf first comm 3 years ago ogv.js 77628cf8bf first comm 3 years ago ol-reversed.js 77628cf8bf first comm 3 years ago once-event-listener.js 77628cf8bf first comm 3 years ago online-status.js 77628cf8bf first comm 3 years ago opus.js 77628cf8bf first comm 3 years ago orientation-sensor.js 77628cf8bf first comm 3 years ago outline.js 77628cf8bf first comm 3 years ago pad-start-end.js 77628cf8bf first comm 3 years ago page-transition-events.js 77628cf8bf first comm 3 years ago pagevisibility.js 77628cf8bf first comm 3 years ago passive-event-listener.js 77628cf8bf first comm 3 years ago passwordrules.js 77628cf8bf first comm 3 years ago path2d.js 77628cf8bf first comm 3 years ago payment-request.js 77628cf8bf first comm 3 years ago pdf-viewer.js 77628cf8bf first comm 3 years ago permissions-api.js 77628cf8bf first comm 3 years ago permissions-policy.js 77628cf8bf first comm 3 years ago picture-in-picture.js 77628cf8bf first comm 3 years ago picture.js 77628cf8bf first comm 3 years ago ping.js 77628cf8bf first comm 3 years ago png-alpha.js 77628cf8bf first comm 3 years ago pointer-events.js 77628cf8bf first comm 3 years ago pointer.js 77628cf8bf first comm 3 years ago pointerlock.js 77628cf8bf first comm 3 years ago portals.js 77628cf8bf first comm 3 years ago prefers-color-scheme.js 77628cf8bf first comm 3 years ago prefers-reduced-motion.js 77628cf8bf first comm 3 years ago progress.js 77628cf8bf first comm 3 years ago promise-finally.js 77628cf8bf first comm 3 years ago promises.js 77628cf8bf first comm 3 years ago proximity.js 77628cf8bf first comm 3 years ago proxy.js 77628cf8bf first comm 3 years ago publickeypinning.js 77628cf8bf first comm 3 years ago push-api.js 77628cf8bf first comm 3 years ago queryselector.js 77628cf8bf first comm 3 years ago readonly-attr.js 77628cf8bf first comm 3 years ago referrer-policy.js 77628cf8bf first comm 3 years ago registerprotocolhandler.js 77628cf8bf first comm 3 years ago rel-noopener.js 77628cf8bf first comm 3 years ago rel-noreferrer.js 77628cf8bf first comm 3 years ago rellist.js 77628cf8bf first comm 3 years ago rem.js 77628cf8bf first comm 3 years ago requestanimationframe.js 77628cf8bf first comm 3 years ago requestidlecallback.js 77628cf8bf first comm 3 years ago resizeobserver.js 77628cf8bf first comm 3 years ago resource-timing.js 77628cf8bf first comm 3 years ago rest-parameters.js 77628cf8bf first comm 3 years ago rtcpeerconnection.js 77628cf8bf first comm 3 years ago ruby.js 77628cf8bf first comm 3 years ago run-in.js 77628cf8bf first comm 3 years ago same-site-cookie-attribute.js 77628cf8bf first comm 3 years ago screen-orientation.js 77628cf8bf first comm 3 years ago script-async.js 77628cf8bf first comm 3 years ago script-defer.js 77628cf8bf first comm 3 years ago scrollintoview.js 77628cf8bf first comm 3 years ago scrollintoviewifneeded.js 77628cf8bf first comm 3 years ago sdch.js 77628cf8bf first comm 3 years ago selection-api.js 77628cf8bf first comm 3 years ago server-timing.js 77628cf8bf first comm 3 years ago serviceworkers.js 77628cf8bf first comm 3 years ago setimmediate.js 77628cf8bf first comm 3 years ago shadowdom.js 77628cf8bf first comm 3 years ago shadowdomv1.js 77628cf8bf first comm 3 years ago sharedarraybuffer.js 77628cf8bf first comm 3 years ago sharedworkers.js 77628cf8bf first comm 3 years ago sni.js 77628cf8bf first comm 3 years ago spdy.js 77628cf8bf first comm 3 years ago speech-recognition.js 77628cf8bf first comm 3 years ago speech-synthesis.js 77628cf8bf first comm 3 years ago spellcheck-attribute.js 77628cf8bf first comm 3 years ago sql-storage.js 77628cf8bf first comm 3 years ago srcset.js 77628cf8bf first comm 3 years ago stream.js 77628cf8bf first comm 3 years ago streams.js 77628cf8bf first comm 3 years ago stricttransportsecurity.js 77628cf8bf first comm 3 years ago style-scoped.js 77628cf8bf first comm 3 years ago subresource-bundling.js 77628cf8bf first comm 3 years ago subresource-integrity.js 77628cf8bf first comm 3 years ago svg-css.js 77628cf8bf first comm 3 years ago svg-filters.js 77628cf8bf first comm 3 years ago svg-fonts.js 77628cf8bf first comm 3 years ago svg-fragment.js 77628cf8bf first comm 3 years ago svg-html.js 77628cf8bf first comm 3 years ago svg-html5.js 77628cf8bf first comm 3 years ago svg-img.js 77628cf8bf first comm 3 years ago svg-smil.js 77628cf8bf first comm 3 years ago svg.js 77628cf8bf first comm 3 years ago sxg.js 77628cf8bf first comm 3 years ago tabindex-attr.js 77628cf8bf first comm 3 years ago template-literals.js 77628cf8bf first comm 3 years ago template.js 77628cf8bf first comm 3 years ago temporal.js 77628cf8bf first comm 3 years ago testfeat.js 77628cf8bf first comm 3 years ago text-decoration.js 77628cf8bf first comm 3 years ago text-emphasis.js 77628cf8bf first comm 3 years ago text-overflow.js 77628cf8bf first comm 3 years ago text-size-adjust.js 77628cf8bf first comm 3 years ago text-stroke.js 77628cf8bf first comm 3 years ago textcontent.js 77628cf8bf first comm 3 years ago textencoder.js 77628cf8bf first comm 3 years ago tls1-1.js 77628cf8bf first comm 3 years ago tls1-2.js 77628cf8bf first comm 3 years ago tls1-3.js 77628cf8bf first comm 3 years ago touch.js 77628cf8bf first comm 3 years ago transforms2d.js 77628cf8bf first comm 3 years ago transforms3d.js 77628cf8bf first comm 3 years ago trusted-types.js 77628cf8bf first comm 3 years ago ttf.js 77628cf8bf first comm 3 years ago typedarrays.js 77628cf8bf first comm 3 years ago u2f.js 77628cf8bf first comm 3 years ago unhandledrejection.js 77628cf8bf first comm 3 years ago upgradeinsecurerequests.js 77628cf8bf first comm 3 years ago url-scroll-to-text-fragment.js 77628cf8bf first comm 3 years ago url.js 77628cf8bf first comm 3 years ago urlsearchparams.js 77628cf8bf first comm 3 years ago use-strict.js 77628cf8bf first comm 3 years ago user-select-none.js 77628cf8bf first comm 3 years ago user-timing.js 77628cf8bf first comm 3 years ago variable-fonts.js 77628cf8bf first comm 3 years ago vector-effect.js 77628cf8bf first comm 3 years ago vibration.js 77628cf8bf first comm 3 years ago video.js 77628cf8bf first comm 3 years ago videotracks.js 77628cf8bf first comm 3 years ago viewport-unit-variants.js 77628cf8bf first comm 3 years ago viewport-units.js 77628cf8bf first comm 3 years ago wai-aria.js 77628cf8bf first comm 3 years ago wake-lock.js 77628cf8bf first comm 3 years ago wasm.js 77628cf8bf first comm 3 years ago wav.js 77628cf8bf first comm 3 years ago wbr-element.js 77628cf8bf first comm 3 years ago web-animation.js 77628cf8bf first comm 3 years ago web-app-manifest.js 77628cf8bf first comm 3 years ago web-bluetooth.js 77628cf8bf first comm 3 years ago web-serial.js 77628cf8bf first comm 3 years ago web-share.js 77628cf8bf first comm 3 years ago webauthn.js 77628cf8bf first comm 3 years ago webcodecs.js 77628cf8bf first comm 3 years ago webgl.js 77628cf8bf first comm 3 years ago webgl2.js 77628cf8bf first comm 3 years ago webgpu.js 77628cf8bf first comm 3 years ago webhid.js 77628cf8bf first comm 3 years ago webkit-user-drag.js 77628cf8bf first comm 3 years ago webm.js 77628cf8bf first comm 3 years ago webnfc.js 77628cf8bf first comm 3 years ago webp.js 77628cf8bf first comm 3 years ago websockets.js 77628cf8bf first comm 3 years ago webtransport.js 77628cf8bf first comm 3 years ago webusb.js 77628cf8bf first comm 3 years ago webvr.js 77628cf8bf first comm 3 years ago webvtt.js 77628cf8bf first comm 3 years ago webworkers.js 77628cf8bf first comm 3 years ago webxr.js 77628cf8bf first comm 3 years ago will-change.js 77628cf8bf first comm 3 years ago woff.js 77628cf8bf first comm 3 years ago woff2.js 77628cf8bf first comm 3 years ago word-break.js 77628cf8bf first comm 3 years ago wordwrap.js 77628cf8bf first comm 3 years ago x-doc-messaging.js 77628cf8bf first comm 3 years ago x-frame-options.js 77628cf8bf first comm 3 years ago xhr2.js 77628cf8bf first comm 3 years ago xhtml.js 77628cf8bf first comm 3 years ago xhtmlsmil.js 77628cf8bf first comm 3 years ago xml-serializer.js 77628cf8bf first comm 3 years ago tum/whitesports - Gogs: Simplico Git Service

No Description

class-wc-https.php 4.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. <?php
  2. if ( ! defined( 'ABSPATH' ) ) {
  3. exit; // Exit if accessed directly
  4. }
  5. /**
  6. * WC_HTTPS class.
  7. *
  8. * @class WC_HTTPS
  9. * @version 2.2.0
  10. * @package WooCommerce\Classes
  11. * @category Class
  12. * @author WooThemes
  13. */
  14. class WC_HTTPS {
  15. /**
  16. * Hook in our HTTPS functions if we're on the frontend. This will ensure any links output to a page (when viewing via HTTPS) are also served over HTTPS.
  17. */
  18. public static function init() {
  19. if ( 'yes' === get_option( 'woocommerce_force_ssl_checkout' ) && ! is_admin() ) {
  20. // HTTPS urls with SSL on
  21. $filters = array(
  22. 'post_thumbnail_html',
  23. 'wp_get_attachment_image_attributes',
  24. 'wp_get_attachment_url',
  25. 'option_stylesheet_url',
  26. 'option_template_url',
  27. 'script_loader_src',
  28. 'style_loader_src',
  29. 'template_directory_uri',
  30. 'stylesheet_directory_uri',
  31. 'site_url',
  32. );
  33. foreach ( $filters as $filter ) {
  34. add_filter( $filter, array( __CLASS__, 'force_https_url' ), 999 );
  35. }
  36. add_filter( 'page_link', array( __CLASS__, 'force_https_page_link' ), 10, 2 );
  37. add_action( 'template_redirect', array( __CLASS__, 'force_https_template_redirect' ) );
  38. if ( 'yes' == get_option( 'woocommerce_unforce_ssl_checkout' ) ) {
  39. add_action( 'template_redirect', array( __CLASS__, 'unforce_https_template_redirect' ) );
  40. }
  41. }
  42. add_action( 'http_api_curl', array( __CLASS__, 'http_api_curl' ), 10, 3 );
  43. }
  44. /**
  45. * Force https for urls.
  46. *
  47. * @param mixed $content
  48. * @return string
  49. */
  50. public static function force_https_url( $content ) {
  51. if ( is_ssl() ) {
  52. if ( is_array( $content ) ) {
  53. $content = array_map( 'WC_HTTPS::force_https_url', $content );
  54. } else {
  55. $content = str_replace( 'http:', 'https:', $content );
  56. }
  57. }
  58. return $content;
  59. }
  60. /**
  61. * Force a post link to be SSL if needed.
  62. *
  63. * @param string $link
  64. * @param int $page_id
  65. *
  66. * @return string
  67. */
  68. public static function force_https_page_link( $link, $page_id ) {
  69. if ( in_array( $page_id, array( get_option( 'woocommerce_checkout_page_id' ), get_option( 'woocommerce_myaccount_page_id' ) ) ) ) {
  70. $link = str_replace( 'http:', 'https:', $link );
  71. } elseif ( 'yes' === get_option( 'woocommerce_unforce_ssl_checkout' ) && ! wc_site_is_https() ) {
  72. $link = str_replace( 'https:', 'http:', $link );
  73. }
  74. return $link;
  75. }
  76. /**
  77. * Template redirect - if we end up on a page ensure it has the correct http/https url.
  78. */
  79. public static function force_https_template_redirect() {
  80. if ( ! is_ssl() && ( is_checkout() || is_account_page() || apply_filters( 'woocommerce_force_ssl_checkout', false ) ) ) {
  81. if ( 0 === strpos( $_SERVER['REQUEST_URI'], 'http' ) ) {
  82. wp_safe_redirect( preg_replace( '|^http://|', 'https://', $_SERVER['REQUEST_URI'] ) );
  83. exit;
  84. } else {
  85. wp_safe_redirect( 'https://' . ( ! empty( $_SERVER['HTTP_X_FORWARDED_HOST'] ) ? $_SERVER['HTTP_X_FORWARDED_HOST'] : $_SERVER['HTTP_HOST'] ) . $_SERVER['REQUEST_URI'] );
  86. exit;
  87. }
  88. }
  89. }
  90. /**
  91. * Template redirect - if we end up on a page ensure it has the correct http/https url.
  92. */
  93. public static function unforce_https_template_redirect() {
  94. if ( function_exists( 'is_customize_preview' ) && is_customize_preview() ) {
  95. return;
  96. }
  97. if ( ! wc_site_is_https() && is_ssl() && $_SERVER['REQUEST_URI'] && ! is_checkout() && ! is_ajax() && ! is_account_page() && apply_filters( 'woocommerce_unforce_ssl_checkout', true ) ) {
  98. if ( 0 === strpos( $_SERVER['REQUEST_URI'], 'http' ) ) {
  99. wp_safe_redirect( preg_replace( '|^https://|', 'http://', $_SERVER['REQUEST_URI'] ) );
  100. exit;
  101. } else {
  102. wp_safe_redirect( 'http://' . ( ! empty( $_SERVER['HTTP_X_FORWARDED_HOST'] ) ? $_SERVER['HTTP_X_FORWARDED_HOST'] : $_SERVER['HTTP_HOST'] ) . $_SERVER['REQUEST_URI'] );
  103. exit;
  104. }
  105. }
  106. }
  107. /**
  108. * Force posts to PayPal to use TLS v1.2. See:
  109. * https://core.trac.wordpress.org/ticket/36320
  110. * https://core.trac.wordpress.org/ticket/34924#comment:13
  111. * https://www.paypal-knowledge.com/infocenter/index?page=content&widgetview=true&id=FAQ1914&viewlocale=en_US
  112. *
  113. * @param string $handle
  114. * @param mixed $r
  115. * @param string $url
  116. */
  117. public static function http_api_curl( $handle, $r, $url ) {
  118. if ( strstr( $url, 'https://' ) && ( strstr( $url, '.paypal.com/nvp' ) || strstr( $url, '.paypal.com/cgi-bin/webscr' ) ) ) {
  119. curl_setopt( $handle, CURLOPT_SSLVERSION, 6 );
  120. }
  121. }
  122. }
  123. WC_HTTPS::init();