Add plugins
This commit is contained in:
		
							parent
							
								
									3c806a5b2b
								
							
						
					
					
						commit
						d3bc2d8bd5
					
				
					 4 changed files with 413 additions and 0 deletions
				
			
		
							
								
								
									
										23
									
								
								plugins/af_youtube_thumbnail/init.php
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								plugins/af_youtube_thumbnail/init.php
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,23 @@ | |||
| <?php | ||||
| class Af_Youtube_Thumbnail extends Plugin { | ||||
|   function about() { | ||||
|     return array(0.1, | ||||
|       "Add the thumbnail for Youtube videos", | ||||
|       "gdott9"); | ||||
|   } | ||||
| 
 | ||||
|   function init($host) { | ||||
|     $host->add_hook($host::HOOK_ARTICLE_FILTER, $this); | ||||
|   } | ||||
| 
 | ||||
|   function hook_article_filter($article) { | ||||
|     if(strpos($article["link"], "youtube.com") !== FALSE) { | ||||
|       $video_id = str_replace('https://www.youtube.com/watch?v=', '', $article["link"]); | ||||
|       $article["content"] = '<img src="https://img.youtube.com/vi/'.$video_id.'/hqdefault.jpg" alt="'.$article["title"].'" />'; | ||||
|     } | ||||
| 
 | ||||
|     return $article; | ||||
|   } | ||||
| 
 | ||||
|   function api_version() { return 2; } | ||||
| } | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue