]> git.mxchange.org Git - friendica.git/commitdiff
Merge pull request #911 from annando/master
authortobiasd <tobias.diekershoff@gmx.net>
Sun, 16 Feb 2014 13:15:44 +0000 (14:15 +0100)
committertobiasd <tobias.diekershoff@gmx.net>
Sun, 16 Feb 2014 13:15:44 +0000 (14:15 +0100)
target="_blank" and api improvements

1  2 
include/text.php

diff --combined include/text.php
index 4ce823ccd3cfd9964e9e440367b24b9d7571ee71,0638f9e241f3a3936b9d1f72f09407498361d5cc..872bf74255179417a2d2156a3e3926cc0497c016
@@@ -218,16 -218,14 +218,16 @@@ function xmlify($str) 
                                break;
                }       
        }*/
 -
 +      /*
        $buffer = mb_ereg_replace("&", "&amp;", $str);
        $buffer = mb_ereg_replace("'", "&apos;", $buffer);
 -      $buffer = mb_ereg_replace("\"", "&quot;", $buffer);
 +      $buffer = mb_ereg_replace('"', "&quot;", $buffer);
        $buffer = mb_ereg_replace("<", "&lt;", $buffer);
        $buffer = mb_ereg_replace(">", "&gt;", $buffer);
 -
 +      */
 +      $buffer = htmlspecialchars($str, ENT_QUOTES);
        $buffer = trim($buffer);
 +      
        return($buffer);
  }}
  
@@@ -240,13 -238,11 +240,13 @@@ if(! function_exists('unxmlify')) 
  function unxmlify($s) {
  //    $ret = str_replace('&amp;','&', $s);
  //    $ret = str_replace(array('&lt;','&gt;','&quot;','&apos;'),array('<','>','"',"'"),$ret);
 -      $ret = mb_ereg_replace('&amp;', '&', $s);
 +      /*$ret = mb_ereg_replace('&amp;', '&', $s);
        $ret = mb_ereg_replace('&apos;', "'", $ret);
        $ret = mb_ereg_replace('&quot;', '"', $ret);
        $ret = mb_ereg_replace('&lt;', "<", $ret);
        $ret = mb_ereg_replace('&gt;', ">", $ret);
 +      */
 +      $ret = htmlspecialchars_decode($s, ENT_QUOTES);
        return $ret;    
  }}
  
@@@ -968,7 -964,7 +968,7 @@@ if(! function_exists('linkify')) 
   * @param string $s
   */
  function linkify($s) {
-       $s = preg_replace("/(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\'\%\$\!\+]*)/", ' <a href="$1" target="external-link">$1</a>', $s);
+       $s = preg_replace("/(https?\:\/\/[a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\'\%\$\!\+]*)/", ' <a href="$1" target="_blank">$1</a>', $s);
        $s = preg_replace("/\<(.*?)(src|href)=(.*?)\&amp\;(.*?)\>/ism",'<$1$2=$3&$4>',$s);
        return($s);
  }}
@@@ -1133,7 -1129,7 +1133,7 @@@ function smilies($s, $sample = false) 
                '<img class="smiley" src="' . $a->get_baseurl() . '/images/like.gif" alt=":like" />',
                '<img class="smiley" src="' . $a->get_baseurl() . '/images/dislike.gif" alt=":dislike" />',
                '<a href="http://friendica.com">~friendica <img class="smiley" src="' . $a->get_baseurl() . '/images/friendica-16.png" alt="~friendica" /></a>',
 -              '<a href="http://friendica.com">red <img class="smiley" src="' . $a->get_baseurl() . '/images/rhash-16.png" alt="red" /></a>'
 +              '<a href="http://redmatrix.me/">red <img class="smiley" src="' . $a->get_baseurl() . '/images/rhash-16.png" alt="red" /></a>'
        );
  
        $params = array('texts' => $texts, 'icons' => $icons, 'string' => $s);
@@@ -1301,13 -1297,13 +1301,13 @@@ function prepare_body(&$item,$attach = 
                                $tag["url"] = $searchpath.strtolower($tag["term"]);
  
                        if ($tag["type"] == TERM_HASHTAG) {
-                               $hashtags[] = "#<a href=\"".$tag["url"]."\" target=\"external-link\">".$tag["term"]."</a>";
+                               $hashtags[] = "#<a href=\"".$tag["url"]."\" target=\"_blank\">".$tag["term"]."</a>";
                                $prefix = "#";
                        } elseif ($tag["type"] == TERM_MENTION) {
-                               $mentions[] = "@<a href=\"".$tag["url"]."\" target=\"external-link\">".$tag["term"]."</a>";
+                               $mentions[] = "@<a href=\"".$tag["url"]."\" target=\"_blank\">".$tag["term"]."</a>";
                                $prefix = "@";
                        }
-                       $tags[] = $prefix."<a href=\"".$tag["url"]."\" target=\"external-link\">".$tag["term"]."</a>";
+                       $tags[] = $prefix."<a href=\"".$tag["url"]."\" target=\"_blank\">".$tag["term"]."</a>";
                }
        }
  
                                        $title = ((strlen(trim($mtch[4]))) ? escape_tags(trim($mtch[4])) : escape_tags($mtch[1]));
                                        $title .= ' ' . $mtch[2] . ' ' . t('bytes');
  
-                                       $as .= '<a href="' . strip_tags($the_url) . '" title="' . $title . '" class="attachlink" target="external-link" >' . $icon . '</a>';
+                                       $as .= '<a href="' . strip_tags($the_url) . '" title="' . $title . '" class="attachlink" target="_blank" >' . $icon . '</a>';
                                }
                        }
                }