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

No Description

class-wc-embed.php 4.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. <?php
  2. /**
  3. * WooCommerce product embed
  4. *
  5. * @version 2.4.11
  6. * @package WooCommerce\Classes\Embed
  7. */
  8. if ( ! defined( 'ABSPATH' ) ) {
  9. exit;
  10. }
  11. /**
  12. * Embed Class which handles any WooCommerce Products that are embedded on this site or another site.
  13. */
  14. class WC_Embed {
  15. /**
  16. * Init embed class.
  17. *
  18. * @since 2.4.11
  19. */
  20. public static function init() {
  21. // Filter all of the content that's going to be embedded.
  22. add_filter( 'the_excerpt_embed', array( __CLASS__, 'the_excerpt' ), 10 );
  23. // Make sure no comments display. Doesn't make sense for products.
  24. add_action( 'embed_content_meta', array( __CLASS__, 'remove_comments_button' ), 5 );
  25. // In the comments place let's display the product rating.
  26. add_action( 'embed_content_meta', array( __CLASS__, 'get_ratings' ), 5 );
  27. // Add some basic styles.
  28. add_action( 'embed_head', array( __CLASS__, 'print_embed_styles' ) );
  29. }
  30. /**
  31. * Remove comments button on product embeds.
  32. *
  33. * @since 2.6.0
  34. */
  35. public static function remove_comments_button() {
  36. if ( self::is_embedded_product() ) {
  37. remove_action( 'embed_content_meta', 'print_embed_comments_button' );
  38. }
  39. }
  40. /**
  41. * Check if this is an embedded product - to make sure we don't mess up regular posts.
  42. *
  43. * @since 2.4.11
  44. * @return bool
  45. */
  46. public static function is_embedded_product() {
  47. if ( function_exists( 'is_embed' ) && is_embed() && is_product() ) {
  48. return true;
  49. }
  50. return false;
  51. }
  52. /**
  53. * Create the excerpt for embedded products - we want to add the buy button to it.
  54. *
  55. * @since 2.4.11
  56. * @param string $excerpt Embed short description.
  57. * @return string
  58. */
  59. public static function the_excerpt( $excerpt ) {
  60. global $post;
  61. // Get product.
  62. $_product = wc_get_product( get_the_ID() );
  63. // Make sure we're only affecting embedded products.
  64. if ( self::is_embedded_product() ) {
  65. echo '<p><span class="wc-embed-price">' . $_product->get_price_html() . '</span></p>'; // WPCS: XSS ok.
  66. if ( ! empty( $post->post_excerpt ) ) {
  67. ob_start();
  68. woocommerce_template_single_excerpt();
  69. $excerpt = ob_get_clean();
  70. }
  71. // Add the button.
  72. $excerpt .= self::product_buttons();
  73. }
  74. return $excerpt;
  75. }
  76. /**
  77. * Create the button to go to the product page for embedded products.
  78. *
  79. * @since 2.4.11
  80. * @return string
  81. */
  82. public static function product_buttons() {
  83. $_product = wc_get_product( get_the_ID() );
  84. $buttons = array();
  85. $button = '<a href="%s" class="wp-embed-more wc-embed-button">%s</a>';
  86. if ( $_product->is_type( 'simple' ) && $_product->is_purchasable() && $_product->is_in_stock() ) {
  87. $buttons[] = sprintf( $button, esc_url( add_query_arg( 'add-to-cart', get_the_ID(), wc_get_cart_url() ) ), esc_html__( 'Buy now', 'woocommerce' ) );
  88. }
  89. $buttons[] = sprintf( $button, get_the_permalink(), esc_html__( 'Read more', 'woocommerce' ) );
  90. return '<p>' . implode( ' ', $buttons ) . '</p>';
  91. }
  92. /**
  93. * Prints the markup for the rating stars.
  94. *
  95. * @since 2.4.11
  96. */
  97. public static function get_ratings() {
  98. // Make sure we're only affecting embedded products.
  99. if ( ! self::is_embedded_product() ) {
  100. return;
  101. }
  102. $_product = wc_get_product( get_the_ID() );
  103. if ( $_product && $_product->get_average_rating() > 0 ) {
  104. ?>
  105. <div class="wc-embed-rating">
  106. <?php
  107. printf(
  108. /* translators: %s: average rating */
  109. esc_html__( 'Rated %s out of 5', 'woocommerce' ),
  110. esc_html( $_product->get_average_rating() )
  111. );
  112. ?>
  113. </div>
  114. <?php
  115. }
  116. }
  117. /**
  118. * Basic styling.
  119. */
  120. public static function print_embed_styles() {
  121. if ( ! self::is_embedded_product() ) {
  122. return;
  123. }
  124. ?>
  125. <style type="text/css">
  126. a.wc-embed-button {
  127. border-radius: 4px;
  128. border: 1px solid #ddd;
  129. box-shadow: 0px 1px 0 0px rgba(0, 0, 0, 0.05);
  130. display:inline-block;
  131. padding: .5em;
  132. }
  133. a.wc-embed-button:hover, a.wc-embed-button:focus {
  134. border: 1px solid #ccc;
  135. box-shadow: 0px 1px 0 0px rgba(0, 0, 0, 0.1);
  136. color: #999;
  137. text-decoration: none;
  138. }
  139. .wp-embed-excerpt p {
  140. margin: 0 0 1em;
  141. }
  142. .wc-embed-price {
  143. display: block;
  144. opacity: .75;
  145. font-weight: 700;
  146. margin-top: -.75em;
  147. }
  148. .wc-embed-rating {
  149. display: inline-block;
  150. }
  151. </style>
  152. <?php
  153. }
  154. }
  155. WC_Embed::init();