[ Index ] |
MailPress 7.2 |
[ Index ] [ Classes ] [ Functions ] [ Variables ] [ Constants ] [ Statistics ] |
[Summary view] [Print] [Text view]
1 <?php 2 class MP_oembed_provider_Twitter extends MP_oembed_provider_ 3 { 4 public $id = 'Twitter'; 5 6 function data2html( $html, $data, $url ) 7 { 8 switch ( $data->type ) 9 { 10 case 'rich' : 11 12 $data->author_id = substr( $data->author_url, strrpos( $data->author_url, '/' ) + 1 ); 13 14 $data->status_id = substr( $data->url, strrpos( $data->url, '/' ) + 1 ); 15 16 preg_match_all( "'<p(.*?)>(.*?)</p>'si", $data->html, $matches, PREG_SET_ORDER ); 17 $data->text = $matches[0][2]; 18 19 preg_match_all( "'<a(.*?)>(.*?)</a>'si", $data->html, $matches, PREG_SET_ORDER ); 20 21 $m = array_pop($matches); 22 $data->datetime = $m[2]; 23 24 $r =array( '%1$s' => $data->url, 25 '%2$s' => $data->author_id, 26 '%3$s' => $data->author_name, 27 '%4$s' => esc_url( 'https://avatars.io/twitter/' . $data->author_id ), 28 // '%4$s' => esc_url( 'https://twitter.com/' . $data->author_id . '/profile_image?size=normal' ), 29 '%5$s' => $data->status_id, 30 '%6$s' => $data->text, 31 '%7$s' => $data->datetime 32 ); 33 34 $template = file_get_contents( MP_ABSPATH . 'mp-includes/html/twitter.html' ); 35 36 $html = str_replace( array_keys($r), $r, $template ); 37 38 break; 39 } 40 return $html; 41 } 42 } 43 new MP_oembed_provider_Twitter();
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Tue May 19 15:55:14 2020 | Cross-referenced by PHPXref 0.7.1 |