These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
0 ignored issues
–
show
|
|||
2 | /** |
||
3 | * @author Pierre-Henry Soria |
||
4 | * @email [email protected] |
||
5 | * @link http://github.com/pH-7/Nav-Doc-Script-V2 |
||
6 | * @copyright (c) 2012-2017, Pierre-Henry Soria. All Rights Reserved. |
||
7 | * @license CC-BY - http://creativecommons.org/licenses/by/3.0/ |
||
8 | */ |
||
9 | |||
10 | namespace PH7\Doc; |
||
11 | defined('PH7') or exit('Restricted access'); |
||
12 | |||
13 | /** |
||
14 | * @return string The links of the tpl files doc. |
||
15 | */ |
||
16 | function get_links_html() |
||
17 | { |
||
18 | $aFiles = glob(DATA_PATH . LANG . '/*.tpl'); |
||
19 | |||
20 | $sHtml = '<ul>'; |
||
21 | for ($i = 0, $iCount = count($aFiles); $i < $iCount; $i++) |
||
22 | { |
||
23 | $sLink = $aFiles[$i]; |
||
24 | |||
25 | $sLink = htmlentities(str_replace(array('.tpl', DATA_PATH, LANG . '/'), '', $sLink)); |
||
26 | $sName = ucfirst(str_replace(array('/', '-'), array('', ' '), $sLink)); |
||
27 | |||
28 | $sHtml .= '<li>' . ($i+1) . ') <a href="' . RELATIVE . LANG . '/' . $sLink . '" title="' . $sName . '" data-load="ajax">' . $sName . '</a>.</li>'; |
||
29 | } |
||
30 | $sHtml .= '</ul>'; |
||
31 | |||
32 | return $sHtml; |
||
33 | } |
||
34 | |||
35 | /** |
||
36 | * @return string The links of the available languages. |
||
37 | */ |
||
38 | function get_langs_html() |
||
39 | { |
||
40 | $aLangs = get_dir_list(DATA_PATH); |
||
41 | $aLangsList = include(ROOT_PATH . 'inc/conf.lang.php'); |
||
42 | |||
43 | $sHtml = '<div id="lang">'; |
||
44 | foreach ($aLangs as $sLang) |
||
45 | { |
||
46 | if ($sLang === LANG) continue; |
||
47 | $sHtml .= '<a href="' . RELATIVE . substr($sLang,0,2) . '" data-load="ajax"><img src="' . STATIC_URL . 'img/flags/' . $sLang . '.gif" alt="' . $aLangsList[$sLang] . '" title="' . $aLangsList[$sLang] . '" /></a> '; |
||
48 | } |
||
49 | $sHtml .= '</div>'; |
||
50 | |||
51 | return $sHtml; |
||
52 | } |
||
53 |
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.