Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Jeff's solution worked well with English text but it got broken when the tweet contained non-ASCII characters. This solution avoids that problem:</p> <pre><code>mb_internal_encoding("UTF-8"); // Return hyperlinked tweet text from json_decoded status object: function MakeStatusLinks($status) {$TextLength=mb_strlen($status['text']); // Number of UTF-8 characters in plain tweet. for ($i=0;$i&lt;$TextLength;$i++) {$ch=mb_substr($status['text'],$i,1); if ($ch&lt;&gt;"\n") $ChAr[]=$ch; else $ChAr[]="\n&lt;br/&gt;"; // Keep new lines in HTML tweet. } if (isset($status['entities']['user_mentions'])) foreach ($status['entities']['user_mentions'] as $entity) {$ChAr[$entity['indices'][0]] = "&lt;a href='https://twitter.com/".$entity['screen_name']."'&gt;".$ChAr[$entity['indices'][0]]; $ChAr[$entity['indices'][1]-1].="&lt;/a&gt;"; } if (isset($status['entities']['hashtags'])) foreach ($status['entities']['hashtags'] as $entity) {$ChAr[$entity['indices'][0]] = "&lt;a href='https://twitter.com/search?q=%23".$entity['text']."'&gt;".$ChAr[$entity['indices'][0]]; $ChAr[$entity['indices'][1]-1] .= "&lt;/a&gt;"; } if (isset($status['entities']['urls'])) foreach ($status['entities']['urls'] as $entity) {$ChAr[$entity['indices'][0]] = "&lt;a href='".$entity['expanded_url']."'&gt;".$entity['display_url']."&lt;/a&gt;"; for ($i=$entity['indices'][0]+1;$i&lt;$entity['indices'][1];$i++) $ChAr[$i]=''; } if (isset($status['entities']['media'])) foreach ($status['entities']['media'] as $entity) {$ChAr[$entity['indices'][0]] = "&lt;a href='".$entity['expanded_url']."'&gt;".$entity['display_url']."&lt;/a&gt;"; for ($i=$entity['indices'][0]+1;$i&lt;$entity['indices'][1];$i++) $ChAr[$i]=''; } return implode('', $ChAr); // HTML tweet. } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload