Development

Changeset 7062

You must first sign up to be able to contribute.

Changeset 7062

Show
Ignore:
Timestamp:
01/15/08 22:11:45 (10 months ago)
Author:
naholyr
Message:

[nahoWikiPlugin] remove useless urlencodes (handled by Symfony, and can be redondant)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/nahoWikiPlugin/trunk/lib/helper/nahoWikiHelper.php

    r7057 r7062  
    1111function link_to_diff($text, $page_name, $rev1, $rev2, $mode = 'inline') 
    1212{ 
    13   return link_to($text, 'nahoWiki/diff?page=' . urlencode($page_name) . '&oldRevision=' . $rev1 . '&revision=' . $rev2 . '&mode=' . urlencode($mode)); 
     13  return link_to($text, 'nahoWiki/diff?page=' . $page_name . '&oldRevision=' . $rev1 . '&revision=' . $rev2 . '&mode=' . $mode); 
    1414} 
    1515 
     
    2525function link_to_raw_diff($text, $page_name, $rev1, $rev2, $mode = 'unified') 
    2626{ 
    27   return link_to($text, 'nahoWiki/diff?page=' . urlencode($page_name) . '&oldRevision=' . $rev1 . '&revision=' . $rev2 . '&mode=' . urlencode($mode) . '&raw=1'); 
     27  return link_to($text, 'nahoWiki/diff?page=' . $page_name . '&oldRevision=' . $rev1 . '&revision=' . $rev2 . '&mode=' . $mode . '&raw=1'); 
    2828} 
    2929 
     
    3333 * @param string $page_name 
    3434 * @param int $revision 
     35 * @param boolean $absolute 
    3536 * 
    3637 * @return string 
    3738 */ 
    38 function url_for_wiki($page_name, $revision = null
     39function url_for_wiki($page_name, $revision = null, $absolute = false
    3940{ 
    40   return url_for('nahoWiki/view?page=' . urlencode($page_name) . '&revision=' . $revision); 
     41  $url = 'nahoWiki/view?page=' . $page_name; 
     42  if (!is_null($revision)) { 
     43    $url .= '&revision=' . $revision; 
     44  } 
     45   
     46  return url_for($url, $absolute); 
    4147} 
    4248 
     
    4652 * @param string $text text of the link (if null, we create it from the pagename+revision) 
    4753 * @param string $page_name 
    48  * @param array $options params added to the link 
    49  * @param int $revision 
     54 * @param array $options params added to the link (you can add a 'revision' option to specifiy the revision of the page you want to link to) 
    5055 * 
    5156 * @return string 
    5257 */ 
    53 function link_to_wiki($text, $page_name, $options = array(), $revision = null
     58function link_to_wiki($text, $page_name, $options = array()
    5459{ 
     60  $url = 'nahoWiki/view?page=' . $page_name 
     61  if (isset($options['revision'])) { 
     62    $url .= '&revision=' . $revision; 
     63  } 
    5564  if (is_null($text)) { 
    56     $text = htmlspecialchars($page_name); 
    57     if (!is_null($revision)) { 
     65    $text = htmlspecialchars(nahoWikiPagePeer::getBasename($page_name)); 
     66    if (isset($options['revision'])) { 
    5867      $text .= ' rev. ' . $revision; 
    5968    } 
    6069  } 
    61  
    62   return link_to($text, 'nahoWiki/view?page=' . urlencode($page_name) . '&revision=' . $revision, $options); 
     70   
     71  return link_to($text, $url, $options); 
    6372} 
    6473 
     
    6877 * @param string $username 
    6978 * @param int $revision 
     79 * @param boolean $absolute 
    7080 * 
    7181 * @return string 
    7282 */ 
    73 function url_for_wiki_user($username, $revision = null
     83function url_for_wiki_user($username, $revision = null, $absolute = false
    7484{ 
    75   return url_for_wiki($text, 'user:' . $username); 
     85  return url_for_wiki('user:' . $username, $revision, $absolute); 
    7686} 
    7787 
     
    8191 * @param string $text text of the link 
    8292 * @param string $username 
    83  * @param array $options params added to the link 
     93 * @param array $options params added to the link (you can add a 'revision' option to specifiy the revision of the page you want to link to) 
    8494 * @param int $revision 
    8595 * 
    8696 * @return string 
    8797 */ 
    88 function link_to_wiki_user($text, $username, $options = array(), $revision = null
     98function link_to_wiki_user($text, $username, $options = array()
    8999{ 
    90   return link_to_wiki($text, 'user:' . $username, $options, $revision); 
     100  return link_to_wiki($text, 'user:' . $username, $options); 
    91101} 
    92102 
     
    96106 * @param string $page_name 
    97107 * @param int $revision 
     108 * @param boolean $absolute 
    98109 * 
    99110 * @return string 
    100111 */ 
    101 function url_for_wiki_discuss($page_name, $revision = null
     112function url_for_wiki_discuss($page_name, $revision = null, $absolute = false
    102113{ 
    103   return url_for_wiki('discuss:' . $page_name, $revision); 
     114  return url_for_wiki('discuss:' . $page_name, $revision, $absolute); 
    104115} 
    105116 
     
    114125 * @return string 
    115126 */ 
    116 function link_to_wiki_discuss($text, $page_name, $options = array(), $revision = null
     127function link_to_wiki_discuss($text, $page_name, $options = array()
    117128{ 
    118   return link_to_wiki($text, 'discuss:' . $page_name, $options, $revision); 
     129  return link_to_wiki($text, 'discuss:' . $page_name, $options); 
    119130} 
    120131 
  • plugins/nahoWikiPlugin/trunk/lib/model/plugin/PluginnahoWikiContentPeer.php

    r7057 r7062  
    147147      } 
    148148      // Link 
    149       $url = 'nahoWiki/view?page=' . urlencode($replace['name'])
     149      $url = 'nahoWiki/view?page=' . $replace['name']
    150150      if (@$replace['anchor']) { 
    151151        $url .= '#' . $replace['anchor']; 
  • plugins/nahoWikiPlugin/trunk/modules/nahoWiki/lib/BasenahoWikiActions.class.php

    r7057 r7062  
    5555     
    5656    // Generate the URI parameters to keep trace of the requested page 
    57     $this->uriParams = 'page=' . urlencode($this->page->getName()); 
     57    $this->uriParams = 'page=' . $this->page->getName(); 
    5858    if ($this->revision->getRevision() != $this->page->getLatestRevision()) { 
    59       $this->uriParams .= '&revision=' . urlencode($this->revision->getRevision()); 
     59      $this->uriParams .= '&revision=' . $this->revision->getRevision(); 
    6060    } 
    6161     
  • plugins/nahoWikiPlugin/trunk/modules/nahoWiki/templates/_breadcrumbs.php

    r7057 r7062  
     1<?php use_helper('nahoWiki') ?> 
     2 
    13<div class="wiki-breadcrumbs"> 
    24  <?php $first = true; foreach ($breadcrumbs as $breadcrumb): ?> 
    35    <?php if (!$first): ?><span class="wiki-breadcrumbs-separator"><?php echo $breadcrumbs_separator ?></span><?php endif ?> 
    4     <?php echo link_to(nahoWikiPagePeer::getBasename($breadcrumb), 'nahoWiki/view?page=' . urlencode($breadcrumb)) ?> 
     6    <?php echo link_to_wiki(null, $breadcrumb) ?> 
    57  <?php $first = false; endforeach ?> 
    68</div> 
  • plugins/nahoWikiPlugin/trunk/modules/nahoWiki/templates/_index.php

    r7057 r7062  
    99      include_partial('index', array('tree' => $elements, 'base' => $fullpath, 'uriParams' => $uriParams)); 
    1010    } else { 
    11       echo link_to($name, 'nahoWiki/view?page=' . urlencode($elements), 'class=wiki-link-page'); 
     11      echo link_to_wiki($name, $elements, 'class=wiki-link-page'); 
    1212    } 
    1313  ?> 
  • plugins/nahoWikiPlugin/trunk/modules/nahoWiki/templates/_page_actions.php

    r7057 r7062  
    11<ul class="wiki-actions"> 
    22  <?php if ($canView): ?> 
    3     <li class="wiki-action-view<?php echo $action == 'view' ? ' active' : '' ?>"><?php echo link_to(__('View'), 'nahoWiki/view?' . $uriParams) ?></li> 
    4     <li class="wiki-action-edit<?php echo $action == 'edit' ? ' active' : '' ?>"><?php echo link_to(__($canEdit ? 'Edit' : 'View source'), 'nahoWiki/edit?' . $uriParams) ?></li> 
    5     <li class="wiki-action-history<?php echo $action == 'history' || $action == 'diff' ? ' active' : '' ?>"><?php echo link_to(__('History'), 'nahoWiki/history?' . $uriParams) ?></li> 
     3    <li class="wiki-action-view<?php echo $action == 'view' ? ' active' : '' ?>"><?php  
     4      echo link_to(__('View'), 'nahoWiki/view?' . $uriParams) ?></li> 
     5    <li class="wiki-action-edit<?php echo $action == 'edit' ? ' active' : '' ?>"><?php  
     6      echo link_to(__($canEdit ? 'Edit' : 'View source'), 'nahoWiki/edit?' . $uriParams) ?></li> 
     7    <li class="wiki-action-history<?php echo $action == 'history' || $action == 'diff' ? ' active' : '' ?>"><?php  
     8      echo link_to(__('History'), 'nahoWiki/history?' . $uriParams) ?></li> 
    69  <?php endif ?> 
    7   <li class="wiki-action-index<?php echo $action == 'browse' ? ' active' : '' ?>"><?php echo link_to(__('Index'), 'nahoWiki/browse?' . $uriParams) ?></li> 
     10  <li class="wiki-action-index<?php echo $action == 'browse' ? ' active' : '' ?>"><?php  
     11      echo link_to(__('Index'), 'nahoWiki/browse?' . $uriParams) ?></li> 
    812</ul> 
  • plugins/nahoWikiPlugin/trunk/modules/nahoWiki/templates/_page_history.php

    r7057 r7062  
    1 <?php use_helper('Date', 'I18N') ?> 
     1<?php use_helper('Date', 'I18N', 'nahoWiki') ?> 
    22 
    33<h1 class="wiki-title"><?php echo __('History of changes') ?></h1> 
     
    3030        <td><?php echo radiobutton_tag('revision', $revision->getRevision(), $rev2 == $revision->getRevision()) ?></td> 
    3131      <?php endif ?> 
    32       <td><?php echo link_to($page->getName() . ' rev. ' . $revision->getRevision(), 'nahoWiki/view?page=' . urlencode($page->getName()) . '&revision=' . urlencode($revision->getRevision())) ?></td> 
     32      <td><?php echo link_to_wiki(null, $page->getName(), array('revision' => $revision->getRevision())) ?></td> 
    3333      <td><?php echo format_datetime($revision->getCreatedAt('U')) ?></td> 
    34       <td><?php echo link_to($revision->getUserName(), 'nahoWiki/user?name=' . urlencode($revision->getUserName())) ?></td> 
     34      <td><?php echo link_to_wiki_user(null, $revision->getUserName()) ?></td> 
    3535      <td><em><?php echo $revision->getComment() ?></em></td> 
    3636    </tr>