From 4cbd05010fcdf6e5ac7cd6130ac742b22881249d Mon Sep 17 00:00:00 2001 From: Stefano Novelli Date: Wed, 22 Feb 2023 14:17:38 +0100 Subject: [PATCH 1/3] Basic instagram support (with Iframe) --- resources/dist/css/shortcodes.css | 2 +- resources/views/instagram.blade.php | 1 + src/LaravelShortcodePlus.php | 7 ++++++ src/Parsers/Instagram.php | 33 +++++++++++++++++++++++++++++ 4 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 resources/views/instagram.blade.php create mode 100644 src/Parsers/Instagram.php diff --git a/resources/dist/css/shortcodes.css b/resources/dist/css/shortcodes.css index 1084a8c..ad57aff 100644 --- a/resources/dist/css/shortcodes.css +++ b/resources/dist/css/shortcodes.css @@ -1 +1 @@ -/*! tailwindcss v3.2.1 | MIT License | https://tailwindcss.com*/*,:after,:before{box-sizing:border-box;border:0 solid #e5e7eb}:after,:before{--tw-content:""}html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:initial}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button;background-color:initial;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:initial}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:#3b82f680;--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:#3b82f680;--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.absolute{position:absolute}.relative{position:relative}.right-0{right:0}.mx-auto{margin-left:auto;margin-right:auto}.block{display:block}.flex{display:flex}.h-full{height:100%}.w-48{width:12rem}.w-full{width:100%}.max-w-2xl{max-width:42rem}.shrink-0{flex-shrink:0}.snap-x{scroll-snap-type:x var(--tw-scroll-snap-strictness)}.snap-mandatory{--tw-scroll-snap-strictness:mandatory}.snap-center{scroll-snap-align:center}.gap-4{gap:1rem}.overflow-auto{overflow:auto}.rounded-lg{border-radius:.5rem}.bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}.object-cover{-o-object-fit:cover;object-fit:cover}.px-1{padding-left:.25rem;padding-right:.25rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-0{padding-top:0;padding-bottom:0}.font-sans{font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}.text-base{font-size:1rem;line-height:1.5rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xs{font-size:.75rem;line-height:1rem}.font-bold{font-weight:700}.uppercase{text-transform:uppercase}.text-red-500{--tw-text-opacity:1;color:rgb(239 68 68/var(--tw-text-opacity))}.text-gray-600{--tw-text-opacity:1;color:rgb(75 85 99/var(--tw-text-opacity))}.opacity-60{opacity:.6}.ring-red-500{--tw-ring-opacity:1;--tw-ring-color:rgb(239 68 68/var(--tw-ring-opacity))}.shortcode_youtube{margin-top:2rem;margin-bottom:2rem;display:block;max-width:1080px;border-radius:.5rem;--tw-bg-opacity:1;background-color:rgb(0 0 0/var(--tw-bg-opacity))}.shortcode_youtube>iframe{height:100%;max-height:480px;width:100%;border-radius:.5rem}.shortcode_spotify{margin-top:2rem;margin-bottom:2rem;height:24rem;width:100%;max-width:1080px;border-radius:.5rem}.shortcode_faq{position:relative;margin-left:auto;margin-right:auto;overflow:hidden;border-top-width:4px;--tw-border-opacity:1;border-color:rgb(17 24 39/var(--tw-border-opacity));padding:.5rem;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}@media (prefers-color-scheme:dark){.shortcode_faq{--tw-border-opacity:1;border-color:rgb(243 244 246/var(--tw-border-opacity))}}@media (min-width:640px){.shortcode_faq{padding-left:1rem;padding-right:1rem}}.shortcode_faq>summary{cursor:pointer;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-size:1rem;line-height:1.5rem}.shortcode_faq>summary:hover{opacity:.9}.shortcode_faq>summary>span{margin-left:.5rem;font-size:1.25rem;line-height:1.75rem;font-weight:900;--tw-text-opacity:1;color:rgb(17 24 39/var(--tw-text-opacity))}@media (prefers-color-scheme:dark){.shortcode_faq>summary>span{--tw-text-opacity:1;color:rgb(243 244 246/var(--tw-text-opacity))}}@media (min-width:640px){.shortcode_faq>summary>span{font-size:1.5rem;line-height:2rem}}.shortcode_faq>p{max-width:42rem;overflow:hidden;padding:1rem}@media (min-width:640px){.shortcode_faq>p{padding-left:0;padding-right:0}}.shortcode_spoiler{margin-bottom:1rem;display:block}.shortcode_spoiler>details{border-width:4px;--tw-border-opacity:1;border-color:rgb(220 38 38/var(--tw-border-opacity))}.shortcode_spoiler>details>summary{cursor:pointer;--tw-bg-opacity:1;background-color:rgb(220 38 38/var(--tw-bg-opacity));text-align:center;--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.shortcode_spoiler>details>span{display:block;--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity));padding:.75rem}@media (prefers-color-scheme:dark){.shortcode_spoiler>details>span{--tw-bg-opacity:1;background-color:rgb(17 24 39/var(--tw-bg-opacity))}}.shortcode_facebook{display:block}.focus\:ring-2:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}@media (prefers-color-scheme:dark){.dark\:bg-gray-900{--tw-bg-opacity:1;background-color:rgb(17 24 39/var(--tw-bg-opacity))}.dark\:text-gray-300{--tw-text-opacity:1;color:rgb(209 213 219/var(--tw-text-opacity))}}@media (min-width:640px){.sm\:px-0{padding-left:0;padding-right:0}} \ No newline at end of file +/*! tailwindcss v3.2.1 | MIT License | https://tailwindcss.com*/*,:after,:before{box-sizing:border-box;border:0 solid #e5e7eb}:after,:before{--tw-content:""}html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:initial}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-size:100%;font-weight:inherit;line-height:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}[type=button],[type=reset],[type=submit],button{-webkit-appearance:button;background-color:initial;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:initial}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]{display:none}*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:#3b82f680;--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:#3b82f680;--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: }.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.right-0{right:0}.top-0{top:0}.left-0{left:0}.z-50{z-index:50}.m-auto{margin:auto}.mx-auto{margin-right:auto}.ml-auto,.mx-auto{margin-left:auto}.block{display:block}.flex{display:flex}.inline-flex{display:inline-flex}.hidden{display:none}.h-full{height:100%}.h-5{height:1.25rem}.w-48{width:12rem}.w-full{width:100%}.w-5{width:1.25rem}.max-w-2xl{max-width:42rem}.shrink-0{flex-shrink:0}.cursor-pointer{cursor:pointer}.cursor-zoom-out{cursor:zoom-out}.cursor-zoom-in{cursor:zoom-in}.snap-x{scroll-snap-type:x var(--tw-scroll-snap-strictness)}.snap-mandatory{--tw-scroll-snap-strictness:mandatory}.snap-center{scroll-snap-align:center}.items-center{align-items:center}.gap-4{gap:1rem}.overflow-auto{overflow:auto}.overflow-y-scroll{overflow-y:scroll}.rounded-lg{border-radius:.5rem}.bg-white{--tw-bg-opacity:1;background-color:rgb(255 255 255/var(--tw-bg-opacity))}.bg-black{--tw-bg-opacity:1;background-color:rgb(0 0 0/var(--tw-bg-opacity))}.bg-transparent{background-color:initial}.bg-opacity-70{--tw-bg-opacity:0.7}.object-cover{-o-object-fit:cover;object-fit:cover}.p-10{padding:2.5rem}.p-1\.5{padding:.375rem}.p-1{padding:.25rem}.px-1{padding-left:.25rem;padding-right:.25rem}.py-0\.5{padding-top:.125rem;padding-bottom:.125rem}.py-0{padding-top:0;padding-bottom:0}.text-center{text-align:center}.font-sans{font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji}.text-base{font-size:1rem;line-height:1.5rem}.text-sm{font-size:.875rem;line-height:1.25rem}.text-xs{font-size:.75rem;line-height:1rem}.text-xl{font-size:1.25rem;line-height:1.75rem}.font-bold{font-weight:700}.font-semibold{font-weight:600}.uppercase{text-transform:uppercase}.text-red-500{--tw-text-opacity:1;color:rgb(239 68 68/var(--tw-text-opacity))}.text-gray-600{--tw-text-opacity:1;color:rgb(75 85 99/var(--tw-text-opacity))}.text-gray-900{--tw-text-opacity:1;color:rgb(17 24 39/var(--tw-text-opacity))}.text-gray-400{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity))}.opacity-60{opacity:.6}.shadow{--tw-shadow:0 1px 3px 0 #0000001a,0 1px 2px -1px #0000001a;--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color),0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow)}.ring-red-500{--tw-ring-opacity:1;--tw-ring-color:rgb(239 68 68/var(--tw-ring-opacity))}.backdrop-blur{--tw-backdrop-blur:blur(8px);-webkit-backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia);backdrop-filter:var(--tw-backdrop-blur) var(--tw-backdrop-brightness) var(--tw-backdrop-contrast) var(--tw-backdrop-grayscale) var(--tw-backdrop-hue-rotate) var(--tw-backdrop-invert) var(--tw-backdrop-opacity) var(--tw-backdrop-saturate) var(--tw-backdrop-sepia)}.shortcode_youtube{margin-top:2rem;margin-bottom:2rem;display:block;max-width:1080px;border-radius:.5rem;--tw-bg-opacity:1;background-color:rgb(0 0 0/var(--tw-bg-opacity))}.shortcode_youtube>iframe{height:100%;max-height:480px;width:100%;border-radius:.5rem}.shortcode_spotify{margin-top:2rem;margin-bottom:2rem;height:24rem;width:100%;max-width:1080px;border-radius:.5rem}.shortcode_faq{position:relative;margin-left:auto;margin-right:auto;overflow:hidden;border-top-width:4px;--tw-border-opacity:1;border-color:rgb(17 24 39/var(--tw-border-opacity));padding:.5rem;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}@media (prefers-color-scheme:dark){.shortcode_faq{--tw-border-opacity:1;border-color:rgb(243 244 246/var(--tw-border-opacity))}}@media (min-width:640px){.shortcode_faq{padding-left:1rem;padding-right:1rem}}.shortcode_faq>summary{cursor:pointer;font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-size:1rem;line-height:1.5rem}.shortcode_faq>summary:hover{opacity:.9}.shortcode_faq>summary>span{margin-left:.5rem;font-size:1.25rem;line-height:1.75rem;font-weight:900;--tw-text-opacity:1;color:rgb(17 24 39/var(--tw-text-opacity))}@media (prefers-color-scheme:dark){.shortcode_faq>summary>span{--tw-text-opacity:1;color:rgb(243 244 246/var(--tw-text-opacity))}}@media (min-width:640px){.shortcode_faq>summary>span{font-size:1.5rem;line-height:2rem}}.shortcode_faq>p{max-width:42rem;overflow:hidden;padding:1rem}@media (min-width:640px){.shortcode_faq>p{padding-left:0;padding-right:0}}.shortcode_spoiler{margin-bottom:1rem;display:block}.shortcode_spoiler>details{border-width:4px;--tw-border-opacity:1;border-color:rgb(220 38 38/var(--tw-border-opacity))}.shortcode_spoiler>details>summary{cursor:pointer;--tw-bg-opacity:1;background-color:rgb(220 38 38/var(--tw-bg-opacity));text-align:center;--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.shortcode_spoiler>details>span{display:block;--tw-bg-opacity:1;background-color:rgb(243 244 246/var(--tw-bg-opacity));padding:.75rem}@media (prefers-color-scheme:dark){.shortcode_spoiler>details>span{--tw-bg-opacity:1;background-color:rgb(17 24 39/var(--tw-bg-opacity))}}.shortcode_facebook{display:block}.hover\:bg-gray-200:hover{--tw-bg-opacity:1;background-color:rgb(229 231 235/var(--tw-bg-opacity))}.hover\:text-gray-900:hover{--tw-text-opacity:1;color:rgb(17 24 39/var(--tw-text-opacity))}.focus\:ring-2:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow,0 0 #0000)}@media (prefers-color-scheme:dark){.dark\:bg-gray-900{--tw-bg-opacity:1;background-color:rgb(17 24 39/var(--tw-bg-opacity))}.dark\:bg-gray-700{--tw-bg-opacity:1;background-color:rgb(55 65 81/var(--tw-bg-opacity))}.dark\:text-gray-300{--tw-text-opacity:1;color:rgb(209 213 219/var(--tw-text-opacity))}.dark\:text-white{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}.dark\:hover\:bg-gray-800:hover{--tw-bg-opacity:1;background-color:rgb(31 41 55/var(--tw-bg-opacity))}.dark\:hover\:text-white:hover{--tw-text-opacity:1;color:rgb(255 255 255/var(--tw-text-opacity))}}@media (min-width:640px){.sm\:px-0{padding-left:0;padding-right:0}}@media (min-width:768px){.md\:inset-0{top:0;right:0;bottom:0;left:0}} \ No newline at end of file diff --git a/resources/views/instagram.blade.php b/resources/views/instagram.blade.php new file mode 100644 index 0000000..15aaad0 --- /dev/null +++ b/resources/views/instagram.blade.php @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/LaravelShortcodePlus.php b/src/LaravelShortcodePlus.php index 9f23957..7ccc84e 100755 --- a/src/LaravelShortcodePlus.php +++ b/src/LaravelShortcodePlus.php @@ -6,6 +6,7 @@ use Murdercode\LaravelShortcodePlus\Parsers\Faq; use Murdercode\LaravelShortcodePlus\Parsers\Gallery; use Murdercode\LaravelShortcodePlus\Parsers\Image; +use Murdercode\LaravelShortcodePlus\Parsers\Instagram; use Murdercode\LaravelShortcodePlus\Parsers\Spoiler; use Murdercode\LaravelShortcodePlus\Parsers\Spotify; use Murdercode\LaravelShortcodePlus\Parsers\Twitter; @@ -30,6 +31,7 @@ public function __construct(protected string $content = '') public function parseAll(): string { $this->content = $this->parseFacebookTag(); + $this->content = $this->parseInstagramTag(); $this->content = $this->parseTwitterTag(); $this->content = $this->parseYoutubeTag(); $this->content = $this->parseSpotifyTag(); @@ -71,6 +73,11 @@ public function parseFacebookTag(): string return Facebook::parse($this->content); } + public function parseInstagramTag(): string + { + return Instagram::parse($this->content); + } + public function parseImageTag(): string { return Image::parse($this->content); diff --git a/src/Parsers/Instagram.php b/src/Parsers/Instagram.php new file mode 100644 index 0000000..b7dd4ac --- /dev/null +++ b/src/Parsers/Instagram.php @@ -0,0 +1,33 @@ +'; + + $url = str_contains($matches[1], 'instagram.com') ? $matches[1] : null; + + $regex = '/\/p\/([a-zA-Z0-9_-]+)/'; + preg_match($regex, $url, $matches); + $post_id = $matches[1]; + + $embed_url = "https://www.instagram.com/p/" . $post_id . "/embed"; + if ($url) { + return view('shortcode-plus::instagram', compact('embed_url'))->render(); + } + + return 'No Facebook URL found'; + }, + $content + ); + } +} From 4e984ea711f52bf2f8079e86508dc613c0615ae0 Mon Sep 17 00:00:00 2001 From: Stefano Novelli Date: Wed, 22 Feb 2023 14:18:06 +0100 Subject: [PATCH 2/3] IG polish code --- src/Parsers/Instagram.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/Parsers/Instagram.php b/src/Parsers/Instagram.php index b7dd4ac..a0a013c 100644 --- a/src/Parsers/Instagram.php +++ b/src/Parsers/Instagram.php @@ -9,10 +9,6 @@ public static function parse(string $content): string return preg_replace_callback( '/\[instagram url="(.*?)"]/', function ($matches) { - //$url = "https://www.instagram.com/p/Cn11ke-obrU"; - //$post_id = substr(strrchr($url, "/"), 1); - //$embed_url = "https://www.instagram.com/p/" . $post_id . "/embed"; - //echo ''; $url = str_contains($matches[1], 'instagram.com') ? $matches[1] : null; From be53d5a176d6bebd725047cfee698e1a6d27d9f7 Mon Sep 17 00:00:00 2001 From: murdercode Date: Wed, 22 Feb 2023 13:18:44 +0000 Subject: [PATCH 3/3] Fix styling --- src/Parsers/Instagram.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Parsers/Instagram.php b/src/Parsers/Instagram.php index a0a013c..57475ae 100644 --- a/src/Parsers/Instagram.php +++ b/src/Parsers/Instagram.php @@ -9,14 +9,13 @@ public static function parse(string $content): string return preg_replace_callback( '/\[instagram url="(.*?)"]/', function ($matches) { - $url = str_contains($matches[1], 'instagram.com') ? $matches[1] : null; $regex = '/\/p\/([a-zA-Z0-9_-]+)/'; preg_match($regex, $url, $matches); $post_id = $matches[1]; - $embed_url = "https://www.instagram.com/p/" . $post_id . "/embed"; + $embed_url = 'https://www.instagram.com/p/'.$post_id.'/embed'; if ($url) { return view('shortcode-plus::instagram', compact('embed_url'))->render(); }