Changeset 25425


Ignore:
Timestamp:
Nov 10, 2013, 5:18:55 PM (7 years ago)
Author:
mistic100
Message:

delete replace_space function, modify get_cat_display_name_* functions

Location:
trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/cat_list.php

    r25018 r25425  
    204204  $navigation.= get_cat_display_name_from_id(
    205205    $_GET['parent_id'],
    206     $base_url.'&parent_id=',
    207     false
     206    $base_url.'&parent_id='
    208207    );
    209208}
  • trunk/admin/picture_modify.php

    r25019 r25425  
    393393    get_cat_display_name_cache(
    394394      $row['uppercats'],
    395       get_root_url().'admin.php?page=album-',
    396       false
     395      get_root_url().'admin.php?page=album-'
    397396      );
    398397
  • trunk/admin/user_perm.php

    r25018 r25425  
    129129    $template->append(
    130130      'categories_because_of_groups',
    131       get_cat_display_name_cache($category['uppercats'], null, false)
     131      get_cat_display_name_cache($category['uppercats'], null)
    132132      );
    133133  }
  • trunk/include/category_cats.inc.php

    r25018 r25425  
    297297    if ($page['section']=='recent_cats')
    298298    {
    299       $name = get_cat_display_name_cache($category['uppercats'], null, false);
     299      $name = get_cat_display_name_cache($category['uppercats'], null);
    300300    }
    301301    else
  • trunk/include/functions.inc.php

    r25360 r25425  
    6363{
    6464  return number_format( $end - $start, 3, '.', ' ').' s';
    65 }
    66 
    67 // - The replace_space function replaces space and '-' characters
    68 //   by their HTML equivalent  &nbsb; and −
    69 // - The function does not replace characters in HTML tags
    70 // - This function was created because IE5 does not respect the
    71 //   CSS "white-space: nowrap;" property unless space and minus
    72 //   characters are replaced like this function does.
    73 // - Example :
    74 //                 <div class="foo">My friend</div>
    75 //               ( 01234567891111111111222222222233 )
    76 //               (           0123456789012345678901 )
    77 // becomes :
    78 //             <div class="foo">My&nbsp;friend</div>
    79 function replace_space( $string )
    80 {
    81   //return $string;
    82   $return_string = '';
    83   // $remaining is the rest of the string where to replace spaces characters
    84   $remaining = $string;
    85   // $start represents the position of the next '<' character
    86   // $end   represents the position of the next '>' character
    87   ; // -> 0
    88   $end   = strpos ( $remaining, '>' ); // -> 16
    89   // as long as a '<' and his friend '>' are found, we loop
    90   while ( ($start=strpos( $remaining, '<' )) !==false
    91         and ($end=strpos( $remaining, '>' )) !== false )
    92   {
    93     // $treatment is the part of the string to treat
    94     // In the first loop of our example, this variable is empty, but in the
    95     // second loop, it equals 'My friend'
    96     $treatment = substr ( $remaining, 0, $start );
    97     // Replacement of ' ' by his equivalent '&nbsp;'
    98     $treatment = str_replace( ' ', '&nbsp;', $treatment );
    99     $treatment = str_replace( '-', '&minus;', $treatment );
    100     // composing the string to return by adding the treated string and the
    101     // following HTML tag -> 'My&nbsp;friend</div>'
    102     $return_string.= $treatment.substr( $remaining, $start, $end-$start+1 );
    103     // the remaining string is deplaced to the part after the '>' of this
    104     // loop
    105     $remaining = substr ( $remaining, $end + 1, strlen( $remaining ) );
    106   }
    107   $treatment = str_replace( ' ', '&nbsp;', $remaining );
    108   $treatment = str_replace( '-', '&minus;', $treatment );
    109   $return_string.= $treatment;
    110 
    111   return $return_string;
    11265}
    11366
  • trunk/include/functions_category.inc.php

    r23813 r25425  
    251251        get_cat_display_name_cache(
    252252          $category['uppercats'],
    253           null,
    254           false
     253          null
    255254          )
    256255        );
  • trunk/include/functions_html.inc.php

    r25202 r25425  
    3232 * @param array cat_informations
    3333 * @param string url
    34  * @param boolean replace_space
    3534 * @return string
    3635 */
    37 function get_cat_display_name($cat_informations,
    38                               $url = '',
    39                               $replace_space = false)
     36function get_cat_display_name($cat_informations, $url = '')
    4037{
    4138  global $conf;
     
    8784    }
    8885  }
    89   if ($replace_space)
    90   {
    91     return replace_space($output);
    92   }
    93   else
    94   {
    95     return $output;
    96   }
     86  return $output;
    9787}
    9888
     
    10797 * @param string uppercats
    10898 * @param string url
    109  * @param boolean replace_space
    11099 * @return string
    111100 */
    112101function get_cat_display_name_cache($uppercats,
    113102                                    $url = '',
    114                                     $replace_space = false,
    115103                                    $single_link = false,
    116104                                    $link_class = null)
     
    185173  }
    186174
    187   if ($replace_space)
    188   {
    189     return replace_space($output);
    190   }
    191   else
    192   {
    193     return $output;
    194   }
     175  return $output;
    195176}
    196177
     
    231212}
    232213
    233 function get_cat_display_name_from_id($cat_id,
    234                                       $url = '',
    235                                       $replace_space = false)
     214function get_cat_display_name_from_id($cat_id, $url = '')
    236215{
    237216  $cat_info = get_cat_info($cat_id);
    238   return get_cat_display_name($cat_info['upper_names'], $url, $replace_space);
     217  return get_cat_display_name($cat_info['upper_names'], $url);
    239218}
    240219
  • trunk/include/ws_functions/pwg.categories.php

    r25281 r25425  
    260260    if ($params['fullname'])
    261261    {
    262       $row['name'] = strip_tags(get_cat_display_name_cache($row['uppercats'], null, false));
     262      $row['name'] = strip_tags(get_cat_display_name_cache($row['uppercats'], null));
    263263    }
    264264    else
  • trunk/index.php

    r23533 r25425  
    231231      foreach ( $cats as $cat )
    232232      {
    233         $hints[] = get_cat_display_name( array($cat), '', false );
     233        $hints[] = get_cat_display_name( array($cat), '' );
    234234      }
    235235      $template->assign( 'category_search_results', $hints);
  • trunk/search_rules.php

    r25018 r25425  
    150150      get_cat_display_name_cache(
    151151          $category['uppercats'],
    152           null,                      // no url on category names
    153           false                    // no blank replacement
     152          null                      // no url on category names
    154153          )
    155154      );
Note: See TracChangeset for help on using the changeset viewer.