aboutsummaryrefslogtreecommitdiffstats
path: root/include
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 /include
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 'include')
-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
5 files changed, 8 insertions, 77 deletions
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
{