aboutsummaryrefslogtreecommitdiffstats
path: root/include/functions_html.inc.php
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2006-02-10 02:10:41 +0000
committerrvelices <rv-github@modusoptimus.com>2006-02-10 02:10:41 +0000
commitda21a99873a5fd74e4d476fdc948bb052a267949 (patch)
tree0590e5dd81ba1577f8c1f1b7ed5d6568551d02ba /include/functions_html.inc.php
parentc8e9793412ac8207754021a69753ead23a6c29d5 (diff)
feature 77: standard navigation link - finalized
3 small fixes: simplified code (unnecessary $page['tab_expand']), urls in comments (at end of line nl2br issue+regex+html 4 validated) and $page['where'] correction for most_visited git-svn-id: http://piwigo.org/svn/trunk@1031 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include/functions_html.inc.php')
-rw-r--r--include/functions_html.inc.php57
1 files changed, 33 insertions, 24 deletions
diff --git a/include/functions_html.inc.php b/include/functions_html.inc.php
index bee99f92f..e53e5e2f1 100644
--- a/include/functions_html.inc.php
+++ b/include/functions_html.inc.php
@@ -81,7 +81,7 @@ function create_navigation_bar($url, $nb_element, $start,
if ($cur_page != 1)
{
$navbar.= '<a href="';
- $navbar.= $url.'&amp;start=0';
+ $navbar.= $url;
$navbar.= '" class="'.$link_class.'" rel="start">'.$lang['first_page'];
$navbar.= '</a>';
}
@@ -95,7 +95,11 @@ function create_navigation_bar($url, $nb_element, $start,
{
$previous = $start - $nb_element_page;
$navbar.= '<a href="';
- $navbar.= $url.'&amp;start='.$previous;
+ $navbar.= $url;
+ if ($previous>0)
+ {
+ $navbar.= '&amp;start='.$previous;
+ }
$navbar.= '" class="'.$link_class.'" rel="prev">'.$lang['previous_page'];
$navbar.= '</a>';
}
@@ -103,12 +107,12 @@ function create_navigation_bar($url, $nb_element, $start,
{
$navbar.= $lang['previous_page'];
}
- $navbar.= ' | ';
+ $navbar.= ' |';
if ($cur_page > $pages_around + 1)
{
$navbar.= '&nbsp;<a href="';
- $navbar.= $url.'&amp;start=0';
+ $navbar.= $url;
$navbar.= '" class="'.$link_class.'">1</a>';
if ($cur_page > $pages_around + 2)
{
@@ -129,16 +133,12 @@ function create_navigation_bar($url, $nb_element, $start,
{
$temp_start = ($i - 1) * $nb_element_page;
$navbar.= '&nbsp;<a href="';
- $navbar.= $url.'&amp;start='.$temp_start;
- $navbar.= '" class="'.$link_class.'"';
- if ($i == $cur_page - 1)
+ $navbar.= $url;
+ if ($temp_start>0)
{
- $navbar.= ' rel="prev"';
- }
- if ($i == $cur_page + 1)
- {
- $navbar.= ' rel="next"';
+ $navbar.= '&amp;start='.$temp_start;
}
+ $navbar.= '" class="'.$link_class.'"';
$navbar.='>'.$i.'</a>';
}
else
@@ -182,7 +182,7 @@ function create_navigation_bar($url, $nb_element, $start,
$temp_start = ($maximum - 1) * $nb_element_page;
$navbar.= '<a href="';
$navbar.= $url.'&amp;start='.$temp_start;
- $navbar.= '" class="'.$link_class.'">'.$lang['last_page'];
+ $navbar.= '" class="'.$link_class.'" rel="last">'.$lang['last_page'];
$navbar.= '</a>';
}
else
@@ -350,6 +350,11 @@ function get_html_menu_category($categories)
$level = 0;
$menu = '';
+ $page_cat = 0;
+ if (isset($page['cat']) and is_numeric($page['cat']) )
+ {
+ $page_cat = $page['cat'];
+ }
foreach ($categories as $category)
{
$level = substr_count($category['global_rank'], '.') + 1;
@@ -370,16 +375,19 @@ function get_html_menu_category($categories)
$ref_level = $level;
$menu.= "\n\n".'<li';
- if (isset($page['cat'])
- and is_numeric($page['cat'])
- and $category['id'] == $page['cat'])
+ if ($category['id'] == $page_cat)
{
$menu.= ' class="selected"';
}
$menu.= '>';
$url = PHPWG_ROOT_PATH.'category.php?cat='.$category['id'];
- $menu.= "\n".'<a href="'.$url.'">'.$category['name'].'</a>';
+ $menu.= "\n".'<a href="'.$url.'"';
+ if ($category['id'] == $page['cat_id_uppercat'])
+ {
+ $menu.= ' rel="up"';
+ }
+ $menu.= '>'.$category['name'].'</a>';
if ($category['nb_images'] > 0)
{
@@ -408,11 +416,11 @@ function get_html_menu_category($categories)
*/
function parse_comment_content($content)
{
- $content = nl2br($content);
-
- $pattern = '/(http?:\/\/\S*)/';
- $replacement = '<a href="$1">$1</a>';
+ $pattern = '/(https?:\/\/\S*)/';
+ $replacement = '<a href="$1" rel="nofollow">$1</a>';
$content = preg_replace($pattern, $replacement, $content);
+
+ $content = nl2br($content);
// replace _word_ by an underlined word
$pattern = '/\b_(\S*)_\b/';
@@ -425,10 +433,11 @@ function parse_comment_content($content)
$content = preg_replace($pattern, $replacement, $content);
// replace /word/ by an italic word
- $pattern = "/\/(\S*)\/(\s)/";
- $replacement = '<span style="font-style:italic;">$1$2</span>';
- $content = preg_replace($pattern, $replacement, $content);
+ $pattern = "/\/(\S*)\/(\s)/";
+ $replacement = '<span style="font-style:italic;">$1$2</span>';
+ $content = preg_replace($pattern, $replacement, $content);
+ $content = '<div>'.$content.'</div>';
return $content;
}