golden hour
/home/doctorbruno/public_html/taeionline.com/wp-content/plugins_old/jetpack/modules/shortcodes
⬆️ Go Up
Upload
File/Folder
Size
Actions
archiveorg-book.php
3.31 KB
Del
OK
archiveorg.php
3.92 KB
Del
OK
archives.php
2.38 KB
Del
OK
bandcamp.php
7.7 KB
Del
OK
brightcove.php
8.77 KB
Del
OK
cartodb.php
803 B
Del
OK
class.filter-embedded-html-objects.php
13.05 KB
Del
OK
codepen.php
265 B
Del
OK
crowdsignal.php
21.85 KB
Del
OK
css
-
Del
OK
dailymotion.php
15.14 KB
Del
OK
descript.php
3 KB
Del
OK
facebook.php
4.4 KB
Del
OK
flatio.php
383 B
Del
OK
flickr.php
9.21 KB
Del
OK
getty.php
7.49 KB
Del
OK
gist.php
8.29 KB
Del
OK
googleapps.php
9.7 KB
Del
OK
googlemaps.php
7.97 KB
Del
OK
googleplus.php
1.03 KB
Del
OK
gravatar.php
4.7 KB
Del
OK
houzz.php
920 B
Del
OK
images
-
Del
OK
img
-
Del
OK
inline-pdfs.php
1.14 KB
Del
OK
instagram.php
14.47 KB
Del
OK
js
-
Del
OK
kickstarter.php
2.35 KB
Del
OK
mailchimp.php
6.91 KB
Del
OK
medium.php
3.23 KB
Del
OK
mixcloud.php
3.62 KB
Del
OK
others.php
1.58 KB
Del
OK
pinterest.php
1.79 KB
Del
OK
presentations.php
14.61 KB
Del
OK
quiz.php
9.16 KB
Del
OK
recipe.php
18.9 KB
Del
OK
scribd.php
2.45 KB
Del
OK
sitemap.php
562 B
Del
OK
slideshare.php
3.81 KB
Del
OK
slideshow.php
8.89 KB
Del
OK
smartframe.php
3.63 KB
Del
OK
soundcloud.php
8.57 KB
Del
OK
spotify.php
3.21 KB
Del
OK
ted.php
3.35 KB
Del
OK
tweet.php
8.51 KB
Del
OK
twitchtv.php
2.63 KB
Del
OK
twitter-timeline.php
1.93 KB
Del
OK
unavailable.php
2.97 KB
Del
OK
untappd-menu.php
2.41 KB
Del
OK
upcoming-events.php
1.18 KB
Del
OK
ustream.php
3.13 KB
Del
OK
videopress.php
423 B
Del
OK
vimeo.php
11.09 KB
Del
OK
vine.php
2.61 KB
Del
OK
vr.php
4.89 KB
Del
OK
wordads.php
1.81 KB
Del
OK
wufoo.php
3.38 KB
Del
OK
youtube.php
20.43 KB
Del
OK
Edit: flickr.php
<?php /** * Flickr Short Code * Author: kellan * License: BSD/GPL/public domain (take your pick) * * [flickr video=www.flickr.com/photos/kalakeli/49931239842] * [flickr video=49931239842] * [flickr video=49931239842 w=200 h=150] * [flickr video=49931239842 autoplay="yes" controls="no"] * [flickr video=49931239842 autoplay="no" controls="yes" w=200 h=150] * * <div class="flick_video" style="max-width: 100%;width: 500px;height: 300px;"><video src="https://www.flickr.com/photos/kalakeli/49931239842/play/360p/183f75d545/" controls autoplay ></video></div> * * @package automattic/jetpack */ /** * Transform embed to shortcode on save. * * @param string $content Post content. * * @return string Shortcode or the embed content itself. */ function flickr_embed_to_shortcode( $content ) { if ( ! is_string( $content ) ) { return $content; } if ( false !== strpos( $content, '<div class="flickr_video"' ) && false !== strpos( $content, '<video' ) ) { return jetpack_flickr_video_to_shortcode( $content ); } elseif ( preg_match( '/<iframe src="(https?:)?\/\/([\da-z\-]+\.)*?((static)?flickr\.com|flic\.kr)\/[^\"]+\"/', $content ) ) { return jetpack_flickr_photo_to_shortcode( $content ); } return $content; } /** * Transforms embed to shortcode on save when the photo param is used. * If embed content can not be transformed to a valid shortcode, * the embed content itself is returned. * * @param string $content Embed output. * * @return string Shortcode or the embed content. */ function jetpack_flickr_photo_to_shortcode( $content ) { preg_match( '/<iframe src=\"([^\"]+)\"(\s+height=\"([^\"]*)\")?(\s+width=\"([^\"]*)\")?/', $content, $matches ); if ( empty( $matches[1] ) ) { return $content; } $src = esc_attr( str_replace( 'player/', '', $matches[1] ) ); $height = empty( $matches[3] ) ? '' : esc_attr( $matches[3] ); $width = empty( $matches[5] ) ? '' : esc_attr( $matches[5] ); /** This action is documented in modules/shortcodes/youtube.php */ do_action( 'jetpack_embed_to_shortcode', 'flickr_photo', $src ); return '[flickr photo="' . $src . '" w=' . $width . ' h=' . $height . ']'; } /** * Transforms embed to shortcode on save when the video param is used. * If embed content can not be transformed to a valid shortcode, * the embed content itself is returned. * * @param string $content Embed output. * * @return string Shortcode or the embed content. */ function jetpack_flickr_video_to_shortcode( $content ) { // Get video src. preg_match( '/<video src=\"([^\"]+)\"/', $content, $matches ); if ( empty( $matches[1] ) ) { return $content; } preg_match( '/(https?:)?\/\/([\da-z\-]+\.)*?((static)?flickr\.com|flic\.kr)\/photos\/([^\/]+)\/\d+\//', $matches[1], $matches ); $video_src = esc_attr( $matches[0] ); // Get width and height. preg_match( '/style=\"max-width: 100%;(width:\s(\d+)px;)?(height:\s(\d+)px;)?/', $content, $matches ); $width = empty( $matches[2] ) ? '' : 'w=' . esc_attr( $matches[2] ); $height = empty( $matches[4] ) ? '' : 'h=' . esc_attr( $matches[4] ); $controls = false !== strpos( $content, 'controls' ) ? 'yes' : 'no'; $autoplay = false !== strpos( $content, 'autoplay' ) ? 'yes' : 'no'; /** This action is documented in modules/shortcodes/youtube.php */ do_action( 'jetpack_embed_to_shortcode', 'flickr_video', $video_src ); return '[flickr video="' . $video_src . '" ' . $width . ' ' . $height . ' controls="' . $controls . '" autoplay="' . $autoplay . '"]'; } add_filter( 'pre_kses', 'flickr_embed_to_shortcode' ); /** * Flickr Shortcode handler. * * @param array $atts Shortcode attributes. * * @return string Shortcode Output. */ function flickr_shortcode_handler( $atts ) { $atts = shortcode_atts( array( 'video' => 0, 'photo' => 0, 'w' => '', 'h' => '', 'controls' => 'yes', 'autoplay' => '', ), $atts, 'flickr' ); if ( ! empty( $atts['video'] ) ) { $showing = 'video'; $src = $atts['video']; } elseif ( ! empty( $atts['photo'] ) ) { $showing = 'photo'; $src = $atts['photo']; } else { return ''; } $src = str_replace( 'http://', 'https://', $src ); if ( 'video' === $showing ) { $video_id = flick_shortcode_video_id( $src ); if ( empty( $video_id ) ) { return ''; } $atts = array_map( 'esc_attr', $atts ); return flickr_shortcode_video_markup( $atts, $video_id, $src ); } elseif ( 'photo' === $showing ) { if ( ! preg_match( '~^(https?:)?//([\da-z\-]+\.)*?((static)?flickr\.com|flic\.kr)/.*~i', $src ) ) { return ''; } $height = empty( $atts['h'] ) ? 'auto' : esc_attr( $atts['h'] ); $src = sprintf( '%s/player/', untrailingslashit( $src ) ); $allow_full_screen = 'allowfullscreen webkitallowfullscreen mozallowfullscreen oallowfullscreen msallowfullscreen'; if ( class_exists( 'Jetpack_AMP_Support' ) && Jetpack_AMP_Support::is_amp_request() ) { $allow_full_screen = str_replace( ' oallowfullscreen msallowfullscreen', '', $allow_full_screen ); } return sprintf( '<iframe src="%s" height="%s" width="%s" frameborder="0" %s></iframe>', esc_url( $src ), $height, esc_attr( $atts['w'] ), $allow_full_screen ); } return false; } /** * Return HTML markup for a Flickr embed. * * @param array $atts Shortcode attributes. * @param string $id Video ID. * @param string $video_param video param of the shortcode. * * @return string Shortcode ouput for video. */ function flickr_shortcode_video_markup( $atts, $id, $video_param ) { $transient_name = "flickr_video_$id"; $video_src = get_transient( $transient_name ); if ( empty( $video_src ) ) { $video_url = ''; if ( ! is_numeric( $video_param ) ) { $video_url = $video_param; } else { // Get the URL of the video from the page of the video. $video_page_content = wp_remote_get( "http://flickr.com/photo.gne?id=$video_param" ); // Bail if we do not get any info from Flickr. if ( is_wp_error( $video_page_content ) ) { return ''; } // Extract the URL from the og:url meta tag. preg_match( '/property=\"og:url\"\scontent=\"([^\"]+)\"/', $video_page_content['body'], $matches ); if ( empty( $matches[1] ) ) { return ''; } $video_url = $matches[1]; } $provider = 'https://www.flickr.com/services/oembed/'; $oembed = _wp_oembed_get_object(); $data = (array) $oembed->fetch( $provider, $video_url ); if ( empty( $data['html'] ) ) { return ''; } // Get the embed url. preg_match( '/src=\"([^\"]+)\"/', $data['html'], $matches ); $embed_url = $matches[1]; $embed_page = wp_remote_get( $embed_url ); // Get the video url from embed html markup. preg_match( '/video.+src=\"([^\"]+)\"/', $embed_page['body'], $matches ); $video_src = $matches[1]; set_transient( $transient_name, $video_src, 2592000 ); // 30 days transient. } $style = 'max-width: 100%;'; if ( ! empty( $atts['w'] ) && is_numeric( $atts['w'] ) ) { $style .= sprintf( 'width: %dpx;', $atts['w'] ); } if ( ! empty( $atts['h'] ) && is_numeric( $atts['h'] ) ) { $style .= sprintf( 'height: %dpx;', $atts['h'] ); } $controls = 'yes' === $atts['controls'] ? 'controls' : ''; $autoplay = 'yes' === $atts['autoplay'] ? 'autoplay' : ''; return sprintf( '<div class="flick_video" style="%s"><video src="%s" %s %s /></div>', esc_attr( $style ), esc_attr( $video_src ), $controls, $autoplay ); } /** * Extract the id of the flickr video from the video param. * * @param string $video_param Video parameter of the shortcode. * * @return string|boolean ID of the video or false in case the ID can not be extracted. */ function flick_shortcode_video_id( $video_param ) { if ( preg_match( '/^https?:\/\/(www\.)?flickr\.com\/.+/', $video_param ) || preg_match( '/^https?:\/\/flic\.kr\/.+/', $video_param ) ) { // Extract the video id from the url. preg_match( '/\d+/', $video_param, $matches ); if ( empty( $matches ) ) { return false; } return $matches[0]; } elseif ( is_numeric( $video_param ) ) { return $video_param; } return false; } add_shortcode( 'flickr', 'flickr_shortcode_handler' ); // Override core's Flickr support because Flickr oEmbed doesn't support web embeds. wp_embed_register_handler( 'flickr', '#https?://(www\.)?flickr\.com/.*#i', 'jetpack_flickr_oembed_handler' ); /** * Callback to modify output of embedded Vimeo video using Jetpack's shortcode. * * @since 3.9 * * @param array $matches Regex partial matches against the URL passed. * @param array $attr Attributes received in embed response. * @param array $url Requested URL to be embedded. * * @return string Return output of Vimeo shortcode with the proper markup. */ function jetpack_flickr_oembed_handler( $matches, $attr, $url ) { /* * Legacy slideshow embeds end with /show/ * e.g. http://www.flickr.com/photos/yarnaholic/sets/72157615194738969/show/ */ if ( '/show/' !== substr( $url, -strlen( '/show/' ) ) ) { // These lookups need cached, as they don't use WP_Embed (which caches). $cache_key = md5( $url . wp_json_encode( $attr ) ); $cache_group = 'oembed_flickr'; $html = wp_cache_get( $cache_key, $cache_group ); if ( false === $html ) { $html = _wp_oembed_get_object()->get_html( $url, $attr ); wp_cache_set( $cache_key, $html, $cache_group, 60 * MINUTE_IN_SECONDS ); } return $html; } return flickr_shortcode_handler( array( 'photo' => $url ) ); }
Save