]> git.mxchange.org Git - friendica.git/blobdiff - include/text.php
improved infinite scrollling
[friendica.git] / include / text.php
index 9fef4aebb59f761ae4bd81aadd342f5d8eaefc86..535c36d235f0fe81ac87c03def37bf9b937df46d 100644 (file)
@@ -2,6 +2,7 @@
 
 require_once("include/template_processor.php");
 require_once("include/friendica_smarty.php");
+require_once("mod/proxy.php");
 
 if(! function_exists('replace_macros')) {
 /**
@@ -275,17 +276,17 @@ function paginate_data(&$a, $count=null) {
        $stripped = trim($stripped,'/');
        $pagenum = $a->pager['page'];
 
-       if (($a->page_offset != "") AND !strstr($stripped, "&offset="))
+       if (($a->page_offset != "") AND !preg_match('/[?&].offset=/', $stripped))
                $stripped .= "&offset=".urlencode($a->page_offset);
-       if (!strpos($stripped, "?")) {
-               if ($pos = strpos($stripped, "&"))
-                       $stripped = substr($stripped, 0, $pos)."?".substr($stripped, $pos + 1);
-       }
 
        $url = $a->get_baseurl() . '/' . $stripped;
 
        $data = array();
        function _l(&$d, $name, $url, $text, $class="") {
+               if (!strpos($url, "?")) {
+                       if ($pos = strpos($url, "&"))
+                               $url = substr($url, 0, $pos)."?".substr($url, $pos + 1);
+               }
 
                $d[$name] = array('url'=>$url, 'text'=>$text, 'class'=>$class);
        }
@@ -384,6 +385,18 @@ function alt_pager(&$a, $i) {
 
 }}
 
+if(! function_exists('scroll_loader')) {
+/**
+ * Loader for infinite scrolling
+ * @return string html for loader
+ */
+function scroll_loader() {
+       $tpl = get_markup_template("scroll_loader.tpl");
+       return replace_macros($tpl, array(
+               'wait' => t('Loading more entries...'),
+               'end' => t('The end')
+       ));
+}}
 
 if(! function_exists('expand_acl')) {
 /**
@@ -928,7 +941,7 @@ function micropro($contact, $redirect = false, $class = '', $textmode = false) {
                        . (($click) ? ' fakelink' : '') . '" '
                        . (($redir) ? ' target="redir" ' : '')
                        . (($url) ? ' href="' . $url . '"' : '') . $click . ' ><img class="contact-block-img' . $class . $sparkle . '" src="'
-                       . $contact['micro'] . '" title="' . $contact['name'] . ' [' . $contact['url'] . ']" alt="' . $contact['name']
+                       . proxy_url($contact['micro']) . '" title="' . $contact['name'] . ' [' . $contact['url'] . ']" alt="' . $contact['name']
                        . '" /></a></div>' . "\r\n";
        }
 }}
@@ -1109,7 +1122,8 @@ function smilies($s, $sample = false) {
                ':like',
                ':dislike',
                 '~friendica',
-                'red#'
+                'red#',
+               'red#matrix'
 
        );
 
@@ -1147,7 +1161,8 @@ 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://redmatrix.me/">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/rm-16.png" alt="red" />matrix</a>',
+               '<a href="http://redmatrix.me/">red<img class="smiley" src="' . $a->get_baseurl() . '/images/rm-16.png" alt="red" />matrix</a>'
        );
 
        $params = array('texts' => $texts, 'icons' => $icons, 'string' => $s);