function tab_tag($tab_name, $active_link, $active_tab, $url, $tab_class, $commCount = 0, $forum_link = false) { $tab_title = __($tab_name . '_tab_help'); $tab_text = __(ucfirst($tab_name)); if ($commCount) { $tab_text = '<span class="reduced">' . $commCount . '</span>' . '<span>' . $tab_text . ' (' . $commCount . ')' . '</span>'; } else { $tab_text = '<span>' . $tab_text . '</span>'; } if ($forum_link) { if ($active_link) { use_helper('Forum'); $link = f_link_to($tab_text, $url, array('class' => $tab_class, 'title' => $tab_title)); } else { $link = '<div class="' . $tab_class . '" title="' . $tab_title . '">' . $tab_text . '</div>'; } } else { $options_array = array('class' => $tab_class, 'title' => $tab_title); if (!$active_link) { $options_array['tag'] = 'div'; } $link = link_to_if($active_link, $tab_text, $url, $options_array); } return '<li' . setActiveIf($tab_name, $active_tab) . '>' . $link . '</li>'; }
</td> </tr> <?php } ?> </tbody> </table> <div class="pager"> Requester per page: <?php foreach ($max_array as $i => $v) { if ($i) { echo ' | '; } echo link_to_if($max != $v, $v, '@default_index?module=requester&max=' . $v); } ?> <div> <form action="<?php echo url_for('@default_index?module=requester'); ?> "> <?php if (isset($mission_for)) { $url_add = '&mission_for=' . $mission_for->getId(); ?> <input type="hidden" name="mission_for" value="<?php echo $mission_for->getId(); ?> "/>
<strong class="name"><?php echo op_link_to_member($activity->getMember()); ?> </strong> <span class="bodyText"><?php echo op_activity_body_filter($activity); ?> </span> </span> <span class="info"> <span class="time"><?php echo $time = op_format_activity_time(strtotime($activity->getCreatedAt())); if ($activity->getSource()) { ?> from <?php echo link_to_if($activity->getSourceUri(), $activity->getSource(), $activity->getSourceUri()); } ?> </span> <?php if ($activity->getPublicFlag() != ActivityDataTable::PUBLIC_FLAG_SNS) { ?> <span class="public_flag"><?php echo __('Public flag'); ?> : <?php echo $activity->getPublicFlagCaption(); ?> </span> <?php }
</ul> </td> </tr> </tbody> <?php } ?> </table> <div class="pager"> Mission per page: <?php foreach ($max_array as $i => $v) { if ($i) { echo ' | '; } echo link_to_if($max != $v, $v, '@default_index?module=mission&max=' . $v); } ?> <div> <form action="<?php echo url_for('@default_index?module=mission'); ?> "> <?php echo link_to('Previous', '@default_index?module=mission&page=' . $pager->getPreviousPage(), array('class' => 'btn-pager-prev')); ?> <input type="text" name="page" class="active-page" value="<?php echo $pager->getPage(); ?> "/> <strong>of <?php
"> <?php echo link_to_if($pDeal->canReset_to_share(), __('Schritt 2: Deal'), 'deals/step_share?did=' . $pDeal->getId()); ?> </li> <li class="<?php echo $lAction == 'step_coupon' ? 'active' : ""; ?> "> <?php echo link_to_if($pDeal->canReset_to_coupon(), __('Schritt 3: Gutschein'), 'deals/step_coupon?did=' . $pDeal->getId()); ?> </li> <li class="<?php echo $lAction == 'step_billing' ? 'active' : ""; ?> "> <?php echo link_to_if($pDeal->canReset_to_billing(), __('Schritt 4: Rechnung'), 'deals/step_billing?did=' . $pDeal->getId()); ?> </li> <li class="<?php echo $lAction == 'step_verify' ? 'active' : ""; ?> "> <span><?php echo __('Schritt 5: Prüfen'); ?> </span> </li> </ul>
?> <td><?php $value = $documento->__toString(); echo link_to($value ? $value : $undefined, 'documentos/edit?id_documento=' . $documento->getPrimaryKey()); ?> </td> <td><?php $proyecto = $documento->getProyecto(); $value = $proyecto ? $proyecto->__toString() : ""; echo link_to_if($proyecto instanceof Proyecto ? 1 : 0, $value ? $value : $undefined, 'proyectos/edit?id_proyecto=' . $documento->getIdProyecto()); ?> </td> <td><?php $fase = $documento->getFase(); $value = $fase ? $fase->__toString() : ""; echo link_to_if($fase instanceof Fase ? 1 : 0, $value ? $value : $undefined, 'fases/edit?id_fase=' . $documento->getIdFase()); ?> </td> <td><?php echo $documento->getIdEntregable() ? __('Entregable') : __('Reunión'); ?> </td> <td><?php $value = ""; if ($documento->getIdEntregable()) { $entregable = $documento->getEntregable(); if ($entregable instanceof Entregable) { $texto = $entregable->__toString(); $value = link_to($texto ? $texto : "—", "asignaciones/edit_entregable?id_entregable=" . $entregable->getPrimaryKey()); } } else {
<?php foreach ($functions as $item) { ?> <?php echo render_show(__('Related function'), link_to(render_title($item), array($item, 'module' => 'function'))); ?> <?php } ?> </div> <div class="section" id="controlArea"> <?php echo link_to_if(QubitAcl::check($resource, 'update'), '<h2>' . __('Control area') . '</h2>', array($resource, 'module' => 'actor', 'action' => 'edit'), array('anchor' => 'controlArea', 'title' => __('Edit control area'))); ?> <?php echo render_show(__('Description identifier'), render_value($resource->descriptionIdentifier)); ?> <?php echo render_show(__('Institution identifier'), render_value($resource->getInstitutionResponsibleIdentifier(array('cultureFallback' => true)))); ?> <?php echo render_show(__('Rules and/or conventions used'), render_value($resource->getRules(array('cultureFallback' => true)))); ?> <?php
</td> </tr> <?php } ?> </tbody> </table> <div class="pager"> Agency per page: <?php foreach ($max_array as $i => $v) { if ($i) { echo ' | '; } echo link_to_if($max != $v, $v, '@default_index?module=agency&max=' . $v); } ?> <div> <form action="<?php echo url_for('@default_index?module=agency'); ?> "> <?php echo link_to('Previous', '@default_index?module=agency&page=' . $pager->getPreviousPage(), array('class' => 'btn-pager-prev')); ?> <input type="text" name="page" class="active-page" value="<?php echo $pager->getPage(); ?> "/> <strong>of <?php
?> <?php echo render_show(__('Reproduction services'), render_value($resource->getReproductionServices(array('cultureFallback' => true)))); ?> <?php echo render_show(__('Public areas'), render_value($resource->getPublicFacilities(array('cultureFallback' => true)))); ?> </div> <div class="section" id="controlArea"> <?php echo link_to_if(SecurityPriviliges::editCredentials($sf_user, 'repository'), '<h2>' . __('Control area') . '</h2>', array($resource, 'module' => 'repository', 'action' => 'edit'), array('anchor' => 'controlArea', 'title' => __('Edit control area'))); ?> <?php echo render_show(__('Description identifier'), render_value($resource->descIdentifier)); ?> <?php echo render_show(__('Institution identifier'), render_value($resource->getDescInstitutionIdentifier(array('cultureFallback' => true)))); ?> <?php echo render_show(__('Rules and/or conventions used'), render_value($resource->getDescRules(array('cultureFallback' => true)))); ?> <?php
echo link_to('Remove', 'pending_member/delete?id=' . $application_temp->getId(), array('class' => 'action-remove', 'method' => 'delete', 'confirm' => 'Are you sure?')); ?> </td> </tr> <?php } ?> </tbody> </table> <div class="pager">Application per page: <?php foreach ($max_array as $i => $v) { if ($i) { echo ' | '; } echo link_to_if($max != $v, $v, 'pending_member/search?max=' . $v); } ?> <div> <form action="<?php echo url_for('pending_member/search'); ?> "><?php echo link_to('Previous', 'pending_member/search?page=' . $pager->getPreviousPage(), array('class' => 'btn-pager-prev')); ?> <input type="text" name="page" class="active-page" value="<?php echo $pager->getPage(); ?> " /> <strong>of <?php echo link_to($pager->getLastPage(), 'pending_member/search?page=' . $pager->getLastPage());
</td> </tr> <?php } ?> </tbody> </table> <div class="pager"> People per page: <?php foreach ($max_array as $i => $v) { if ($i) { echo ' | '; } echo link_to_if($max != $v, $v, '@passenger_find?module=passenger&max=' . $v . $linkdata2); } ?> <div> <form action="<?php echo url_for('@passenger_find?module=passenger' . $linkdata2); ?> "> <?php echo link_to('Previous', '@passenger_find?module=passenger&page=' . $pager->getPreviousPage() . $linkdata2, array('class' => 'btn-pager-prev')); ?> <input type="text" name="page" class="active-page" value="<?php echo $pager->getPage(); ?> "/> <strong>of <?php
echo $paginationId; ?> "> <?php if ($pager->haveToPaginate()) { ?> <?php if ($pager->getPage() !== $pager->getFirstPage()) { echo link_to('« First', 'sf_image_pool_chooser', array('page' => $pager->getFirstPage()) + $extra); echo ' | '; echo link_to('‹ Previous', 'sf_image_pool_chooser', array('page' => $pager->getPreviousPage()) + $extra); echo ' | '; } foreach ($pager->getLinks(10) as $link) { // Link if it's not the currrent page :) echo link_to_if($link !== $pager->getPage(), $link, 'sf_image_pool_chooser', array('page' => $link) + $extra); echo ' | '; } if ($pager->getNextPage() !== $pager->getLastPage()) { echo link_to('Next ›', 'sf_image_pool_chooser', array('page' => $pager->getNextPage()) + $extra); echo ' | '; echo link_to('Last »', 'sf_image_pool_chooser', array('page' => $pager->getLastPage()) + $extra); } ?> <br /> <?php } ?> Displaying <?php
<td><?php $parametros = "?id_documento=" . $historico_documento->getIdDocumento(); $parametros .= '&version=' . $historico_documento->getVersion(); $documento = $historico_documento->getDocumento(); $value = $documento ? $documento->getNombre() : ""; echo link_to_if($documento instanceof Documento, $value ? $value : "—", 'historico_documentos/show' . $parametros); ?> </td> <td align="right"><?php echo link_to($historico_documento->getVersion() ? $historico_documento->getVersion() : __('-'), 'historico_documentos/show' . $parametros); ?> </td> <td><?php echo $historico_documento->getNombreFich(); ?> </td> <td align="right"><?php echo $historico_documento->getTamanoFormateado(); ?> </td> <td><?php echo $historico_documento->getFecha() ? format_date($historico_documento->getFecha(), "g") : ''; ?> </td> <td><?php $usuario = $historico_documento->getUsuario(); $nombre = $usuario ? $usuario->__toString() : "- " . __('Sin definir') . " -"; echo $nombre ? $nombre : "—"; ?> </td>
?> </tbody> </table> <div class="pager"> Members per page: <?php foreach ($max_array as $i => $v) { if ($i) { echo ' | '; } $url = '@default_index?module=member&max=' . $v; if ($master_for) { $url .= '&master_for=' . $master_for->getId(); } echo link_to_if($max != $v, $v, $url); } ?> <div> <form action="<?php echo url_for('@default_index?module=member'); ?> "> <?php if ($master_for) { $url_add = '&master_for=' . $master_for->getId(); ?> <input type="hidden" name="master_for" value="<?php echo $master_for->getId(); ?> "/>
</ul> </td> </tr> <?php } ?> </tbody> </table> <div class="pager"> People per page: <?php foreach ($max_array as $i => $v) { if ($i) { echo ' | '; } echo link_to_if($max != $v, $v, 'person/subscribe?id=' . $email_list->getId() . '&max=' . $v); } ?> <div> <form action="<?php echo url_for('person/subscribe?id=' . $email_list->getId()); ?> "> <?php echo link_to('Previous', 'person/subscribe?id=' . $email_list->getId() . '&page=' . $pager->getPreviousPage(), array('class' => 'btn-pager-prev')); ?> <input type="text" name="page" class="active-page" value="<?php echo $pager->getPage(); ?> "/> <strong>of <?php
?> "><?php echo $rt_shop_category->getTitle(); ?> </a></td> <td class="rt-admin-publish-toggle"> <?php echo rt_nice_boolean($rt_shop_category->getPublished()); ?> <div style="display:none;"><?php echo $rt_shop_category->getId(); ?> </div> </td> <td><?php echo link_to_if($rt_shop_category->version > 1, $rt_shop_category->version, 'rtShopCategoryAdmin/versions?id=' . $rt_shop_category->getId()); ?> </td> <td><?php echo $rt_shop_category->getCreatedAt(); ?> </td> <td> <ul class="rt-admin-tools"> <li><?php echo rt_button_show(url_for('rtShopCategoryAdmin/show?id=' . $rt_shop_category->getId())); ?> </li> <li><?php echo rt_button_edit(url_for('rtShopCategoryAdmin/edit?id=' . $rt_shop_category->getId())); ?>
echo link_to('Remove', 'pending_member/delete?id=' . $application_temp->getId(), array('class' => 'action-remove', 'method' => 'delete', 'confirm' => 'Are you sure?')); ?> </td> </tr> <?php } ?> </tbody> </table> <div class="pager">Application per page: <?php foreach ($max_array as $i => $v) { if ($i) { echo ' | '; } echo link_to_if($max != $v, $v, 'pending_member/index?max=' . $v); } ?> <div> <form action="<?php echo url_for('pending_member/index'); ?> "><?php echo link_to('Previous', 'pending_member/index?page=' . $pager->getPreviousPage(), array('class' => 'btn-pager-prev')); ?> <input type="text" name="page" class="active-page" value="<?php echo $pager->getPage(); ?> " /> <strong>of <?php echo link_to($pager->getLastPage(), 'pending_member/index?page=' . $pager->getLastPage());
<?php echo $i == '0' ? 'first-line' : ''; ?> "> <div class="<?php echo $day == $today ? 'today' : ($day == $page_date ? ' current' : ' default'); ?> "> <?php if (!empty($events) && $month[1] == $page_month[1]) { ?> <?php foreach ($events as $event) { ?> <p><?php echo link_to_if(isset($event['url']), date('d', strtotime($day)), $event['url'], array('title' => $event['title'], 'class' => 'link')); ?> </p> <?php } ?> <?php } elseif ($month[1] == $page_month[1]) { ?> <p><?php echo date('d', strtotime($day)); ?> </p> <?php } ?>
/** * If the condition passed as first argument is false, * creates a <a> link tag of the given name using a routed URL * based on the module/action passed as argument and the routing configuration. * If the condition is true, the given name is returned between <span> tags * * <b>Options:</b> * - 'tag' - the HTML tag that must enclose the name if the condition is true, defaults to <span> * - 'absolute' - if set to true, the helper outputs an absolute URL * - 'query_string' - to append a query string (starting by ?) to the routed url * - 'anchor' - to append an anchor (starting by #) to the routed url * - 'confirm' - displays a javascript confirmation alert when the link is clicked * - 'popup' - if set to true, the link opens a new browser window * - 'post' - if set to true, the link submits a POST request instead of GET (caution: do not use inside a form) * * <b>Examples:</b> * <code> * echo link_to_unless($user->isAdministrator(), 'Delete this page', 'my_module/my_action'); * => <span>Delete this page</span> * echo link_to_unless(!$user->isAdministrator(), 'Delete this page', 'my_module/my_action'); * => <a href="/path/to/my/action">Delete this page</a> * </code> * * @param bool $condition condition * @param string $name name of the link, i.e. string to appear between the <a> tags * @param string $internal_uri 'module/action' or '@rule' of the action * @param array $options additional HTML compliant <a> tag parameters * @return string XHTML compliant <a href> tag or name * @see link_to */ function link_to_unless($condition, $name = '', $internal_uri = '', $options = array()) { return link_to_if(!$condition, $name, $internal_uri, $options); }
</td> </tr> </tbody> <?php } ?> </table> <span><a href="/mission_photo">Back</a></span> <div class="pager"> Mission per page: <?php foreach ($max_array as $i => $v) { if ($i) { echo ' | '; } echo link_to_if($max != $v, $v, 'mission_photo/show?max=' . $v . '&id=' . $mission_photo->getId()); } ?> <div> <form action="<?php echo url_for('mission_photo/show'); ?> "> <input type="hidden" value="<?php echo $mission_photo->getId(); ?> " name="id"> <?php echo link_to('Previous', 'mission_photo/show?page=' . $pager->getPreviousPage() . '&id=' . $mission_photo->getId(), array('class' => 'btn-pager-prev')); ?> <input type="text" name="page" class="active-page" value="<?php
</td> </tr> <?php } ?> </tbody> </table> <div class="pager"> Sent email per page: <?php foreach ($max_array as $i => $v) { if ($i) { echo ' | '; } echo link_to_if($max != $v, $v, 'email/listEditBulkSentEmail?max=' . $v); } ?> <div> <form action="<?php echo url_for('email/listEditBulkSentEmail'); ?> "> <?php echo link_to('Previous', 'email/listEditBulkSentEmail?page=' . $pager->getPreviousPage(), array('class' => 'btn-pager-prev')); ?> <input type="text" name="page" class="active-page" value="<?php echo $pager->getPage(); ?> "/> <strong>of <?php
<h1><?php echo __('View rights holder'); ?> </h1> <?php echo link_to_if(QubitAcl::check($resource, 'update'), '<h1 class="label">' . render_title($resource) . '</h1>', array($resource, 'module' => 'rightsholder', 'action' => 'edit'), array('title' => __('Edit rights holder'))); ?> <?php if (isset($errorSchema)) { ?> <div class="messages error"> <ul> <?php foreach ($errorSchema as $error) { ?> <li><?php echo $error; ?> </li> <?php } ?> </ul> </div> <?php } ?> <?php
<?php echo get_component('aclGroup', 'tabs'); ?> <h1><?php echo __('View permissions'); ?> </h1> <?php echo link_to_if(QubitAcl::check($group, 'edit'), '<h1 class="label">' . render_title($group) . '</h1>', array($group, 'module' => 'aclGroup', 'action' => 'edit'), array('title' => __('Edit group'))); ?> <div class="section"> <?php if (0 < count($acl)) { ?> <table id="groupPermissions" class="sticky-enabled"> <thead> <tr> <th colspan="2"> </th> <?php foreach ($groups as $groupId) { ?> <th><?php echo render_title(QubitAclGroup::getById($groupId)); ?> </th> <?php }
/** * If the condition passed as first argument is false, * creates a <a> link tag of the given name using a routed URL * based on the module/action passed as argument and the routing configuration. * If the condition is true, the given name is returned between <span> tags * * <b>Options:</b> * - 'tag' - the HTML tag that must enclose the name if the condition is true, defaults to <span> * - 'absolute' - if set to true, the helper outputs an absolute URL * - 'query_string' - to append a query string (starting by ?) to the routed url * - 'confirm' - displays a javascript confirmation alert when the link is clicked * - 'popup' - if set to true, the link opens a new browser window * - 'post' - if set to true, the link submits a POST request instead of GET (caution: do not use inside a form) * * <b>Examples:</b> * <code> * echo link_to_unless($user->isAdministrator(), 'Delete this page', 'my_module/my_action'); * => <span>Delete this page</span> * echo link_to_unless(!$user->isAdministrator(), 'Delete this page', 'my_module/my_action'); * => <a href="/path/to/my/action">Delete this page</a> * </code> * * @param bool condition * @param string name of the link, i.e. string to appear between the <a> tags * @param string 'module/action' or '@rule' of the action * @param array additional HTML compliant <a> tag parameters * @return string XHTML compliant <a href> tag or name * @see link_to */ function link_to_unless($condition, $name = '', $url = '', $options = array()) { return link_to_if(!$condition, $name, $url, $options); }
</td> </tr> <?php } ?> </tbody> </table> <div class="pager"> People per page: <?php foreach ($max_array as $i => $v) { if ($i) { echo ' | '; } echo link_to_if($max != $v, $v, '@requester_find?module=requester&max=' . $v); } ?> <div> <form action="<?php echo url_for('@requester_find?module=requester'); ?> "> <?php echo link_to('Previous', '@requester_find?module=requester&page=' . $pager->getPreviousPage(), array('class' => 'btn-pager-prev')); ?> <input type="text" name="page" class="active-page" value="<?php echo $pager->getPage(); ?> "/> <strong>of <?php
</td> </tr> <?php } ?> </tbody> </table> <div class="pager"> Camp per page: <?php foreach ($max_array as $i => $v) { if ($i) { echo ' | '; } echo link_to_if($max != $v, $v, '@default_index?module=camp&max=' . $v); } ?> <div> <form action="<?php echo url_for('@default_index?module=camp'); ?> "> <?php echo link_to('Previous', '@default_index?module=camp&page=' . $pager->getPreviousPage(), array('class' => 'btn-pager-prev')); ?> <input type="text" name="page" class="active-page" value="<?php echo $pager->getPage(); ?> "/> <strong>of <?php
echo render_show(__('Scope'), render_value($isad->ehriScope)); ?> <?php echo render_show(__('Priority'), render_value($isad->priorities[$isad->ehriPriority])); ?> <?php echo render_show(__('Copyright Issue'), render_value($isad->ehriCopyrightIssue ? "Yes" : "No")); ?> </div> <!-- /.section#ehriMetadata --> <div class="section" id="rightsArea"> <?php echo link_to_if(QubitAcl::check($resource, 'update'), '<h2>' . __('Rights area') . '</h2>', array($resource, 'module' => 'informationobject', 'action' => 'edit'), array('anchor' => 'rightsArea', 'title' => __('Edit rights area'))); ?> <?php echo get_component('right', 'relatedRights', array('resource' => $resource)); ?> </div> <!-- /.section#rightsArea --> <?php if (0 < count($resource->digitalObjects)) { ?> <?php echo get_partial('digitalobject/metadata', array('resource' => $resource->digitalObjects[0])); ?>
?> <?php } ?> </div> <div class="section" style="margin-left: 2em;"> <?php if ($child = $resource->getChildByUsageId(QubitTerm::THUMBNAIL_ID)) { ?> <?php echo link_to_if(SecurityPriviliges::editCredentials($sf_user, 'informationObject'), '<h2>' . __('Digital object (%1%) rights area', array('%1%' => $child->usage)) . '</h2>', array($resource, 'module' => 'digitalobject', 'action' => 'edit'), array('title' => __('Edit digital object'))); ?> <?php foreach ($child->getRights() as $item) { ?> <?php echo get_partial('right/right', array('resource' => $item->object)); ?> <?php } ?> <?php
<div align="right"> <input type="submit" value="Update"/> </div> </form> </div> <?php if ($pager->getNbResults()) { ?> <div class="pager"> Mission Request per page: <?php foreach ($max_array as $i => $v) { if ($i) { echo ' | '; } echo link_to_if($max != $v, $v, '@missing_waivers?max=' . $v); } ?> <div> <form action="<?php echo url_for('@missing_waivers'); ?> "> <?php echo link_to('Previous', '@missing_waivers?page=' . $pager->getPreviousPage(), array('class' => 'btn-pager-prev')); ?> <input type="text" name="page" class="active-page" value="<?php echo $pager->getPage(); ?> "/> <strong>of <?php
{ return 'test'; } } $o2 = new testObjectWithToString(); $t->is(link_to($o2, '@homepage'), '<a href="module/action">test</a>', 'link_to() can take an object as its first argument'); // link_to_if() $t->diag('link_to_if()'); $t->is(link_to_if(true, 'test', '@homepage'), '<a href="module/action">test</a>', 'link_to_if() returns an HTML "a" tag if the condition is true'); $t->is(link_to_if(false, 'test', '@homepage'), '<span>test</span>', 'link_to_if() returns an HTML "span" tag by default if the condition is false'); $t->is(link_to_if(false, 'test', '@homepage', array('tag' => 'div')), '<div>test</div>', 'link_to_if() takes a "tag" option'); $t->is(link_to_if(true, 'test', '@homepage', 'tag=div'), '<a href="module/action">test</a>', 'link_to_if() removes "tag" option (given as string) in true case'); $t->is(link_to_if(true, 'test', '@homepage', array('tag' => 'div')), '<a href="module/action">test</a>', 'link_to_if() removes "tag" option (given as array) in true case'); $t->is(link_to_if(false, 'test', '@homepage', array('query_string' => 'foo=bar', 'absolute' => true, 'absolute_url' => 'http://www.google.com/')), '<span>test</span>', 'link_to_if() returns an HTML "span" tag by default if the condition is false'); $t->is(link_to_if(true, 'test', 'homepage', array(), array('class' => 'test')), '<a class="test" href="homepage">test</a>', 'link_to_if() accepts link_to2 compatible usage'); $t->is(link_to_if(false, 'test', 'homepage', array(), array('class' => 'test')), '<span class="test">test</span>', 'link_to_if() accepts link_to2 compatible usage'); // link_to_unless() $t->diag('link_to_unless()'); $t->is(link_to_unless(false, 'test', '@homepage'), '<a href="module/action">test</a>', 'link_to_unless() returns an HTML "a" tag if the condition is false'); $t->is(link_to_unless(true, 'test', '@homepage'), '<span>test</span>', 'link_to_unless() returns an HTML "span" tag by default if the condition is true'); $t->is(link_to_unless(true, 'test', 'homepage', array(), array('class' => 'test')), '<span class="test">test</span>', 'link_to_unless() accepts link_to2 compatible usage'); $t->is(link_to_unless(false, 'test', 'homepage', array(), array('class' => 'test')), '<a class="test" href="homepage">test</a>', 'link_to_unless() accepts link_to2 compatible usage'); // public_path() $t->diag('public_path()'); $t->is(public_path('pdf/download.pdf'), '/public/pdf/download.pdf', 'public_path() returns the public path'); $t->is(public_path('/pdf/download.pdf'), '/public/pdf/download.pdf', 'public_path() returns the public path if starting with slash'); $t->is(public_path('pdf/download.pdf', true), 'https://example.org/public/pdf/download.pdf', 'public_path() returns the public path'); // mail_to() $t->diag('mail_to()'); $t->is(mail_to('*****@*****.**'), '<a href="mailto:fabien.potencier@symfony-project.com">fabien.potencier@symfony-project.com</a>', 'mail_to() creates a mailto a tag'); $t->is(mail_to('*****@*****.**', 'fabien'), '<a href="mailto:fabien.potencier@symfony-project.com">fabien</a>', 'mail_to() creates a mailto a tag');