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 | * @file |
||
4 | * @ingroup SMWLanguage |
||
5 | */ |
||
6 | |||
7 | /** |
||
8 | * Protect against register_globals vulnerabilities. |
||
9 | * This line must be present before any global variable is referenced. |
||
10 | */ |
||
11 | if ( !defined( 'MEDIAWIKI' ) ) { |
||
12 | die(); |
||
13 | } |
||
14 | |||
15 | global $smwgIP; |
||
0 ignored issues
–
show
Compatibility
Best Practice
introduced
by
Use of
global functionality is not recommended; it makes your code harder to test, and less reusable.
Instead of relying on 1. Pass all data via parametersfunction myFunction($a, $b) {
// Do something
}
2. Create a class that maintains your stateclass MyClass {
private $a;
private $b;
public function __construct($a, $b) {
$this->a = $a;
$this->b = $b;
}
public function myFunction() {
// Do something
}
}
Loading history...
|
|||
16 | include_once ( $smwgIP . 'languages/SMW_Language.php' ); |
||
17 | |||
18 | /** |
||
19 | * Catalan language labels for important SMW labels (namespaces, datatypes,...). |
||
20 | * |
||
21 | * @author Toniher |
||
22 | * @ingroup SMWLanguage |
||
23 | * @ingroup Language |
||
24 | */ |
||
25 | class SMWLanguageCa extends SMWLanguage { |
||
0 ignored issues
–
show
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.
You can fix this by adding a namespace to your class: namespace YourVendor;
class YourClass { }
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.
Loading history...
|
|||
26 | |||
27 | protected $m_DatatypeLabels = array( |
||
28 | '_wpg' => 'Pàgina', // name of page datatype |
||
29 | '_txt' => 'Text', // name of the text type |
||
30 | '_cod' => 'Codi', // name of the (source) code type |
||
31 | '_boo' => 'Booleà', // name of the boolean type |
||
32 | '_num' => 'Nombre', // name for the datatype of numbers |
||
33 | '_geo' => 'Coordenades geogràfiques', // name of the geocoord type |
||
34 | '_tem' => 'Temperatura', // name of the temperature type |
||
35 | '_dat' => 'Data', // name of the datetime (calendar) type |
||
36 | '_ema' => 'Adreça electrònica', // name of the email type |
||
37 | '_uri' => 'URL', // name of the URL type |
||
38 | '_anu' => 'URI-Anotació', // name of the annotation URI type (OWL annotation property) |
||
39 | '_tel' => 'Número de telèfon', // name of the telephone (URI) type |
||
40 | '_rec' => 'Registre', // name of record data type |
||
41 | '_qty' => 'Quantitat', // name of the number type with units of measurement |
||
42 | '_mlt_rec' => 'Monolingual text', |
||
43 | ); |
||
44 | |||
45 | protected $m_DatatypeAliases = array( |
||
46 | 'URI' => '_uri', |
||
47 | 'Decimal' => '_num', |
||
48 | 'Enter' => '_num', |
||
49 | 'Cadena' => '_txt', // old name of the string type |
||
50 | 'Enumeració' => '_txt', |
||
51 | 'Número de telèfon' => '_tel', |
||
52 | 'Adreça electrònica' => '_ema', |
||
53 | 'Coordenada geogràfica' => '_geo', |
||
54 | 'Polígon geogràfic' => '_gpo', |
||
55 | ); |
||
56 | |||
57 | protected $m_SpecialProperties = array( |
||
58 | // always start upper-case |
||
59 | '_TYPE' => 'Té tipus', |
||
60 | '_URI' => 'URI equivalent', |
||
61 | '_SUBP' => 'Subpropietat de', |
||
62 | '_SUBC' => 'Subcategoria de', |
||
63 | '_UNIT' => 'Unitats de mesura', |
||
64 | '_IMPO' => 'Importat de', |
||
65 | '_CONV' => 'Correspon a', |
||
66 | '_SERV' => 'Proporciona servei', |
||
67 | '_PVAL' => 'Permet valor', |
||
68 | '_MDAT' => 'Data de modificació', |
||
69 | '_CDAT' => 'Data de creació', |
||
70 | '_NEWP' => 'És pàgina nova', |
||
71 | '_LEDT' => 'Darrer editor és', |
||
72 | '_ERRP' => 'Té valor incorrecte per a', |
||
73 | '_LIST' => 'Té camps', |
||
74 | '_SOBJ' => 'Té subobjecte', |
||
75 | '_ASK' => 'Té consulta', |
||
76 | '_ASKST'=> 'Cadena de consulta', |
||
77 | '_ASKFO'=> 'Format de consulta', |
||
78 | '_ASKSI'=> 'Mida de consulta', |
||
79 | '_ASKDE'=> 'Profunditat de consulta', |
||
80 | '_ASKDU'=> 'Durada de consulta', |
||
81 | '_MEDIA'=> 'Tipus Media', |
||
82 | '_MIME' => 'Tipus MIME', |
||
83 | '_ERRC' => 'Has processing error', |
||
84 | '_ERRT' => 'Has processing error text', |
||
85 | '_PREC' => 'Display precision of', |
||
86 | '_LCODE' => 'Language code', |
||
87 | '_TEXT' => 'Text', |
||
88 | '_PDESC' => 'Has property description', |
||
89 | '_PVAP' => 'Allows pattern', |
||
90 | '_DTITLE' => 'Display title of', |
||
91 | '_PVUC' => 'Has uniqueness constraint', |
||
92 | ); |
||
93 | |||
94 | protected $m_SpecialPropertyAliases = array( |
||
95 | 'Unitat de mesura' => '_UNIT' |
||
96 | ); |
||
97 | |||
98 | protected $m_Namespaces = array( |
||
99 | SMW_NS_PROPERTY => 'Propietat', |
||
100 | SMW_NS_PROPERTY_TALK => 'Propietat_Discussió', |
||
101 | SMW_NS_TYPE => 'Tipus', |
||
102 | SMW_NS_TYPE_TALK => 'Tipus_Discussió', |
||
103 | SMW_NS_CONCEPT => 'Concepte', |
||
104 | SMW_NS_CONCEPT_TALK => 'Concepte_Discussió' |
||
105 | ); |
||
106 | |||
107 | protected $m_dateformats = array( array( SMW_Y ), array( SMW_MY, SMW_YM ), array( SMW_MDY, SMW_DMY, SMW_YMD, SMW_YDM ) ); |
||
108 | |||
109 | protected $m_months = array( "gener", "febrer", "març", "abril", "maig", "juny", "juliol", "agost", "setembre", "octubre", "novembre", "desembre" ); |
||
110 | |||
111 | protected $m_monthsshort = array( "gen", "febr", "març", "abr", "maig", "juny", "jul", "ag", "set", "oct", "nov", "des" ); |
||
112 | |||
113 | } |
||
114 | |||
115 | |||
116 |
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.