aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormistic100 <mistic@piwigo.org>2013-11-10 16:18:55 +0000
committermistic100 <mistic@piwigo.org>2013-11-10 16:18:55 +0000
commite6722ac1b4bf45a9416f175cf2729982f42fc8f0 (patch)
tree206a0d5308cc247a8235afe7a0503d4bf026117a
parentca80b5ade87f2cdf7ac7d7672910ff08005a3680 (diff)
delete replace_space function, modify get_cat_display_name_* functions
git-svn-id: http://piwigo.org/svn/trunk@25425 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--admin/cat_list.php3
-rw-r--r--admin/picture_modify.php3
-rw-r--r--admin/user_perm.php2
-rw-r--r--include/category_cats.inc.php2
-rw-r--r--include/functions.inc.php47
-rw-r--r--include/functions_category.inc.php3
-rw-r--r--include/functions_html.inc.php31
-rw-r--r--include/ws_functions/pwg.categories.php2
-rw-r--r--index.php2
-rw-r--r--search_rules.php3
10 files changed, 13 insertions, 85 deletions
diff --git a/admin/cat_list.php b/admin/cat_list.php
index 6caa393f4..e7fc7805c 100644
--- a/admin/cat_list.php
+++ b/admin/cat_list.php
@@ -203,8 +203,7 @@ if (isset($_GET['parent_id']))
$navigation.= get_cat_display_name_from_id(
$_GET['parent_id'],
- $base_url.'&amp;parent_id=',
- false
+ $base_url.'&amp;parent_id='
);
}
// +-----------------------------------------------------------------------+
diff --git a/admin/picture_modify.php b/admin/picture_modify.php
index 814ec27d8..9c1af0dd4 100644
--- a/admin/picture_modify.php
+++ b/admin/picture_modify.php
@@ -392,8 +392,7 @@ while ($row = pwg_db_fetch_assoc($result))
$name =
get_cat_display_name_cache(
$row['uppercats'],
- get_root_url().'admin.php?page=album-',
- false
+ get_root_url().'admin.php?page=album-'
);
if ($row['category_id'] == $storage_category_id)
diff --git a/admin/user_perm.php b/admin/user_perm.php
index 36ab8a825..e995c065e 100644
--- a/admin/user_perm.php
+++ b/admin/user_perm.php
@@ -128,7 +128,7 @@ if (pwg_db_num_rows($result) > 0)
{
$template->append(
'categories_because_of_groups',
- get_cat_display_name_cache($category['uppercats'], null, false)
+ get_cat_display_name_cache($category['uppercats'], null)
);
}
}
diff --git a/include/category_cats.inc.php b/include/category_cats.inc.php
index f579a6cdd..670c7f842 100644
--- a/include/category_cats.inc.php
+++ b/include/category_cats.inc.php
@@ -296,7 +296,7 @@ if (count($categories) > 0)
if ($page['section']=='recent_cats')
{
- $name = get_cat_display_name_cache($category['uppercats'], null, false);
+ $name = get_cat_display_name_cache($category['uppercats'], null);
}
else
{
diff --git a/include/functions.inc.php b/include/functions.inc.php
index 41fbb7d44..8996df05b 100644
--- a/include/functions.inc.php
+++ b/include/functions.inc.php
@@ -64,53 +64,6 @@ function get_elapsed_time( $start, $end )
return number_format( $end - $start, 3, '.', ' ').' s';
}
-// - The replace_space function replaces space and '-' characters
-// by their HTML equivalent &nbsb; and &minus;
-// - The function does not replace characters in HTML tags
-// - This function was created because IE5 does not respect the
-// CSS "white-space: nowrap;" property unless space and minus
-// characters are replaced like this function does.
-// - Example :
-// <div class="foo">My friend</div>
-// ( 01234567891111111111222222222233 )
-// ( 0123456789012345678901 )
-// becomes :
-// <div class="foo">My&nbsp;friend</div>
-function replace_space( $string )
-{
- //return $string;
- $return_string = '';
- // $remaining is the rest of the string where to replace spaces characters
- $remaining = $string;
- // $start represents the position of the next '<' character
- // $end represents the position of the next '>' character
- ; // -> 0
- $end = strpos ( $remaining, '>' ); // -> 16
- // as long as a '<' and his friend '>' are found, we loop
- while ( ($start=strpos( $remaining, '<' )) !==false
- and ($end=strpos( $remaining, '>' )) !== false )
- {
- // $treatment is the part of the string to treat
- // In the first loop of our example, this variable is empty, but in the
- // second loop, it equals 'My friend'
- $treatment = substr ( $remaining, 0, $start );
- // Replacement of ' ' by his equivalent '&nbsp;'
- $treatment = str_replace( ' ', '&nbsp;', $treatment );
- $treatment = str_replace( '-', '&minus;', $treatment );
- // composing the string to return by adding the treated string and the
- // following HTML tag -> 'My&nbsp;friend</div>'
- $return_string.= $treatment.substr( $remaining, $start, $end-$start+1 );
- // the remaining string is deplaced to the part after the '>' of this
- // loop
- $remaining = substr ( $remaining, $end + 1, strlen( $remaining ) );
- }
- $treatment = str_replace( ' ', '&nbsp;', $remaining );
- $treatment = str_replace( '-', '&minus;', $treatment );
- $return_string.= $treatment;
-
- return $return_string;
-}
-
// get_extension returns the part of the string after the last "."
function get_extension( $filename )
{
diff --git a/include/functions_category.inc.php b/include/functions_category.inc.php
index 7cde5e35c..02261fa56 100644
--- a/include/functions_category.inc.php
+++ b/include/functions_category.inc.php
@@ -250,8 +250,7 @@ function display_select_categories($categories,
$option = strip_tags(
get_cat_display_name_cache(
$category['uppercats'],
- null,
- false
+ null
)
);
}
diff --git a/include/functions_html.inc.php b/include/functions_html.inc.php
index ae776f55e..3f9c6542a 100644
--- a/include/functions_html.inc.php
+++ b/include/functions_html.inc.php
@@ -31,12 +31,9 @@
*
* @param array cat_informations
* @param string url
- * @param boolean replace_space
* @return string
*/
-function get_cat_display_name($cat_informations,
- $url = '',
- $replace_space = false)
+function get_cat_display_name($cat_informations, $url = '')
{
global $conf;
@@ -86,14 +83,7 @@ function get_cat_display_name($cat_informations,
$output.= $cat['name'].'</a>';
}
}
- if ($replace_space)
- {
- return replace_space($output);
- }
- else
- {
- return $output;
- }
+ return $output;
}
/**
@@ -106,12 +96,10 @@ function get_cat_display_name($cat_informations,
*
* @param string uppercats
* @param string url
- * @param boolean replace_space
* @return string
*/
function get_cat_display_name_cache($uppercats,
$url = '',
- $replace_space = false,
$single_link = false,
$link_class = null)
{
@@ -184,14 +172,7 @@ SELECT id, name, permalink
$output.= '</a>';
}
- if ($replace_space)
- {
- return replace_space($output);
- }
- else
- {
- return $output;
- }
+ return $output;
}
/**
@@ -230,12 +211,10 @@ function render_comment_content($content)
return $content;
}
-function get_cat_display_name_from_id($cat_id,
- $url = '',
- $replace_space = false)
+function get_cat_display_name_from_id($cat_id, $url = '')
{
$cat_info = get_cat_info($cat_id);
- return get_cat_display_name($cat_info['upper_names'], $url, $replace_space);
+ return get_cat_display_name($cat_info['upper_names'], $url);
}
/**
diff --git a/include/ws_functions/pwg.categories.php b/include/ws_functions/pwg.categories.php
index 70a555398..ae8f45ed5 100644
--- a/include/ws_functions/pwg.categories.php
+++ b/include/ws_functions/pwg.categories.php
@@ -259,7 +259,7 @@ SELECT
if ($params['fullname'])
{
- $row['name'] = strip_tags(get_cat_display_name_cache($row['uppercats'], null, false));
+ $row['name'] = strip_tags(get_cat_display_name_cache($row['uppercats'], null));
}
else
{
diff --git a/index.php b/index.php
index a79f90166..25f1d0d4a 100644
--- a/index.php
+++ b/index.php
@@ -230,7 +230,7 @@ if ( empty($page['is_external']) or !$page['is_external'] )
$hints = array();
foreach ( $cats as $cat )
{
- $hints[] = get_cat_display_name( array($cat), '', false );
+ $hints[] = get_cat_display_name( array($cat), '' );
}
$template->assign( 'category_search_results', $hints);
}
diff --git a/search_rules.php b/search_rules.php
index 56664a148..a4c72d861 100644
--- a/search_rules.php
+++ b/search_rules.php
@@ -149,8 +149,7 @@ SELECT id, uppercats, global_rank
'search_categories',
get_cat_display_name_cache(
$category['uppercats'],
- null, // no url on category names
- false // no blank replacement
+ null // no url on category names
)
);
}