Changeset 2870073
- Timestamp:
- 02/23/2023 02:53:30 PM (3 years ago)
- Location:
- simple-lazy-load-videos/trunk
- Files:
-
- 4 edited
-
includes/class-main.php (modified) (6 diffs)
-
languages/simple-lazy-load-videos.pot (modified) (2 diffs)
-
readme.txt (modified) (3 diffs)
-
simple-lazy-load-videos.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
simple-lazy-load-videos/trunk/includes/class-main.php
r2862066 r2870073 31 31 add_filter( 'oembed_dataparse', array( $this, 'change_oembed' ), 10, 3 ); 32 32 add_action( 'save_post', array( $this, 'flush_oembed_cache' ), 10, 3 ); 33 34 /** Add shortcodes */ 35 add_shortcode( 'sllv_video', array( $this, 'shortcode' ) ); 33 36 } 34 37 … … 81 84 */ 82 85 function change_oembed( $return, $data, $url ) { 83 $video = new SLLV_Template(); 86 $template = new SLLV_Template(); 87 84 88 if ( isset( $data->title ) ) { 85 89 $video_title = $data->title; … … 92 96 $video_id = $matches[1]; 93 97 94 $return = $ video->video( array(98 $return = $template->video( array( 95 99 'provider' => 'youtube', 96 100 'title' => $video_title, … … 98 102 'url' => 'https://youtu.be/' . $video_id, 99 103 'thumbnail' => 'https://i.ytimg.com/vi/' . $video_id . '/' . $this->get_settings( 'youtube_thumbnail_size' ) . '.jpg', 100 'play' => $ video->youtube,104 'play' => $template->youtube, 101 105 ) ); 102 } 103 104 if ( 'Vimeo' === $data->provider_name ) { 105 $return = $video->video( array( 106 } elseif ( 'Vimeo' === $data->provider_name ) { 107 $return = $template->video( array( 106 108 'provider' => 'vimeo', 107 109 'title' => $video_title, … … 109 111 'url' => 'https://vimeo.com/' . $data->video_id, 110 112 'thumbnail' => substr( $data->thumbnail_url, 0, -3 ) . $this->get_settings( 'vimeo_thumbnail_size' ), 111 'play' => $ video->vimeo,113 'play' => $template->vimeo, 112 114 ) ); 113 115 } … … 125 127 } 126 128 129 130 /** 131 * Shortcode [sllv_video] 132 */ 133 public function shortcode( $atts, $content ) { 134 $atts = shortcode_atts( array( 135 136 ), $atts ); 137 138 $template = new SLLV_Template(); 139 $functions = new SLLV_Functions(); 140 141 $video_url = $content; 142 143 $determine_video = $functions->determine_video_url( $video_url ); 144 145 if ( 'youtube' === $determine_video['type'] ) { 146 $thumbnail = $functions->get_youtube_thumb( $determine_video['id'], $this->get_settings( 'youtube_thumbnail_size' ) ); 147 $play = $template->youtube; 148 } elseif ( 'vimeo' === $determine_video['type'] ) { 149 $thumbnail = $functions->get_vimeo_thumb( $determine_video['id'] ); 150 $play = $template->vimeo; 151 } 152 153 $return = $template->video( array( 154 'provider' => $determine_video['type'], 155 'title' => __( 'Video', 'simple-lazy-load-videos' ), 156 'id' => $determine_video['id'], 157 'url' => $video_url, 158 'thumbnail' => $thumbnail, 159 'play' => $play, 160 ) ); 161 162 return $return; 163 } 164 127 165 } 128 166 } -
simple-lazy-load-videos/trunk/languages/simple-lazy-load-videos.pot
r2862066 r2870073 4 4 "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" 5 5 "Project-Id-Version: Simple Lazy Load Videos\n" 6 "POT-Creation-Date: 2023-02- 08 14:28+0200\n"6 "POT-Creation-Date: 2023-02-23 16:49+0200\n" 7 7 "PO-Revision-Date: 2020-01-08 15:52+0200\n" 8 8 "Last-Translator: \n" … … 22 22 "X-Poedit-SearchPathExcluded-0: *.js\n" 23 23 24 #: includes/class-main.php: 8724 #: includes/class-main.php:91 includes/class-main.php:155 25 25 msgid "Video" 26 26 msgstr "" -
simple-lazy-load-videos/trunk/readme.txt
r2866277 r2870073 3 3 Tags: performance, video, vimeo, youtube 4 4 Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=V5Q9SBB54LMDC&source=url 5 Requires at least: 5.0 5 6 Tested up to: 6.1.1 6 7 Requires PHP: 5.6 7 Stable tag: 0. 7.68 Stable tag: 0.8 8 9 License: GPLv2 or later 9 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 23 24 = How does this plugin work? = 24 25 Instead of loading the iframe of your video on page load, it only loads the video preview image. 26 This will work automatically for all videos that have been inserted through the standard page editor. 27 = Is it possible to insert a video using a shortcode? = 28 Yes, you can use the `[sllv_video]` shortcode using a link to a YouTube or Vimeo video as its value, like: 29 30 `[sllv_video]https://youtu.be/GywDFkY3z-c[/sllv_video]` 31 32 = Can I embed a lazy loaded video into my template file? = 33 Yes, but you cannot insert a shortcode `[sllv_video]` into your template file directly. 34 You will need to pass the code into apply_shortcodes() function and display its output like this: 35 36 `<?php echo apply_shortcodes( '[sllv_video]https://youtu.be/GywDFkY3z-c[/sllv_video]' ); ?>` 25 37 26 38 == Screenshots == … … 29 41 30 42 == Changelog == 43 = 0.8 = 44 * Add shortcode to display SLLV in theme templates 45 * Update Frequently Asked Questions 46 * Small code refactor 47 31 48 = 0.7.6 = 32 49 * Fix editor styles -
simple-lazy-load-videos/trunk/simple-lazy-load-videos.php
r2866277 r2870073 4 4 * Plugin URI: https://github.com/radkill/simple-lazy-load-videos 5 5 * Description: Simple Lazy Load for embedded video from Youtube and Vimeo 6 * Version: 0.7.6 6 * Version: 0.8 7 * Requires at least: 5.0 7 8 * Requires PHP: 5.6 8 9 * Author: Valerii Bohdanov … … 52 53 require_once( SLLV_PATH . 'includes/class-template.php' ); 53 54 require_once( SLLV_PATH . 'includes/class-options.php' ); 55 require_once( SLLV_PATH . 'includes/class-functions.php' ); 54 56 55 57
Note: See TracChangeset
for help on using the changeset viewer.