-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Juliano Maciel
authored and
Gustavo Fonseca
committed
Dec 14, 2018
1 parent
44ab995
commit 28e6ae8
Showing
8 changed files
with
61 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
|
||
/** | ||
* @author | ||
* SciELO - Scientific Electronic Library Online | ||
* @link | ||
* https://www.scielo.org/ | ||
* @license | ||
* Copyright SciELO All Rights Reserved. | ||
*/ | ||
|
||
defined('BASEPATH') or exit('No direct script access allowed'); | ||
|
||
if (!function_exists('pluralize')) { | ||
|
||
/** | ||
* Pluralizes a word if quantity is not one. | ||
* Based on a stackoverflow response https://stackoverflow.com/questions/1534127/pluralize-in-php. | ||
* | ||
* @param int $quantity Number of items | ||
* @param string $singular Singular form of word | ||
* @param string $plural Plural form of word; function will attempt to deduce plural form from singular if not provided | ||
* @return string Pluralized word if quantity is not one, otherwise singular | ||
*/ | ||
function pluralize($quantity, $singular, $plural = null) | ||
{ | ||
if ($quantity == 1 || !strlen($singular)) { | ||
return $singular; | ||
} | ||
|
||
if ($plural !== null) { | ||
return $plural; | ||
} | ||
|
||
$last_letter = strtolower($singular[strlen($singular) - 1]); | ||
|
||
switch ($last_letter) { | ||
case 'y': | ||
return substr($singular, 0, -1) . 'ies'; | ||
case 's': | ||
return $singular . 'es'; | ||
default: | ||
return $singular . 's'; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
<?php | ||
defined('BASEPATH') or exit('No direct script access allowed'); | ||
?> | ||
<div class="btn-group-vertical btn-group-fixed" role="group" aria-label="..."> | ||
<?=create_letter_filter(current_url())?> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters