@@ -100,9 +100,9 @@ |
||
100 | 100 | } |
101 | 101 | |
102 | 102 | $plural = $this->plural($this->lang, $n); |
103 | - if ($plural > $this->nPlurals-1) { |
|
103 | + if ($plural > $this->nPlurals - 1) { |
|
104 | 104 | // incorrectly defined plural function or wrong $nPlurals |
105 | - return $this->nPlurals-1; |
|
105 | + return $this->nPlurals - 1; |
|
106 | 106 | } else { |
107 | 107 | return $plural; |
108 | 108 | } |
@@ -63,11 +63,11 @@ |
||
63 | 63 | private $useDefaultPluralForm; |
64 | 64 | |
65 | 65 | /** |
66 | - * Constructor |
|
67 | - * |
|
68 | - * @param array $translation PMF translation array for current language |
|
69 | - * @return void |
|
70 | - */ |
|
66 | + * Constructor |
|
67 | + * |
|
68 | + * @param array $translation PMF translation array for current language |
|
69 | + * @return void |
|
70 | + */ |
|
71 | 71 | public function __construct($translation) |
72 | 72 | { |
73 | 73 | $this->PMF_TRANSL = $translation; |
@@ -117,8 +117,8 @@ discard block |
||
117 | 117 | // $network seems to be a real network address |
118 | 118 | $x = ip2long($ip_arr[1]); |
119 | 119 | // Evaluate the netmask: <Network Mask> or <CIDR> |
120 | - $mask = ( long2ip($x) == $ip_arr[1] ? $x : 0xffffffff << (32 - $ip_arr[1])); |
|
121 | - $matched = ( ($ip_long & $mask) == ($network_long & $mask) ); |
|
120 | + $mask = (long2ip($x) == $ip_arr[1] ? $x : 0xffffffff << (32 - $ip_arr[1])); |
|
121 | + $matched = (($ip_long & $mask) == ($network_long & $mask)); |
|
122 | 122 | } |
123 | 123 | |
124 | 124 | return $matched; |
@@ -153,8 +153,8 @@ discard block |
||
153 | 153 | $bytes_addr = unpack("n*", inet_pton($addr)); |
154 | 154 | $bytes_test = unpack("n*", inet_pton($ip)); |
155 | 155 | |
156 | - for ($i = 1; $i <= ceil($preflen / 16); $i++) { |
|
157 | - $left = $preflen - 16 * ($i-1); |
|
156 | + for ($i = 1; $i <= ceil($preflen/16); $i++) { |
|
157 | + $left = $preflen - 16*($i - 1); |
|
158 | 158 | if ($left > 16) { |
159 | 159 | $left = 16; |
160 | 160 | } |
@@ -117,15 +117,15 @@ discard block |
||
117 | 117 | */ |
118 | 118 | public function copy($source, $dest) |
119 | 119 | { |
120 | - if (! is_readable($source)) { |
|
120 | + if (!is_readable($source)) { |
|
121 | 121 | throw new PMF_Exception('/config/constants.php is not readable.'); |
122 | 122 | } |
123 | 123 | |
124 | - if (! is_writable(dirname($dest))) { |
|
124 | + if (!is_writable(dirname($dest))) { |
|
125 | 125 | throw new PMF_Exception(sprintf('%s is not writeable.', $dest)); |
126 | 126 | } |
127 | 127 | |
128 | - if (! copy($source, $dest)) { |
|
128 | + if (!copy($source, $dest)) { |
|
129 | 129 | $error = error_get_last(); |
130 | 130 | throw new PMF_Exception($error['message']); |
131 | 131 | } |
@@ -149,19 +149,19 @@ discard block |
||
149 | 149 | |
150 | 150 | $directoryName = substr($source, strrpos($source, '/') + 1); |
151 | 151 | |
152 | - $this->mkdir($dest . '/' . $directoryName, 0750, true); |
|
152 | + $this->mkdir($dest.'/'.$directoryName, 0750, true); |
|
153 | 153 | |
154 | 154 | while ($file = readdir($directoryHandle)) |
155 | 155 | { |
156 | 156 | if ('.' != $file && '..' != $file) { |
157 | 157 | |
158 | - if (! is_dir($source . '/' . $file)) { |
|
158 | + if (!is_dir($source.'/'.$file)) { |
|
159 | 159 | $this->copy( |
160 | - $source . '/' . $file, |
|
161 | - $dest . '/' . $directoryName . '/' . $file |
|
160 | + $source.'/'.$file, |
|
161 | + $dest.'/'.$directoryName.'/'.$file |
|
162 | 162 | ); |
163 | - } else { |
|
164 | - $this->recursiveCopy($source . '/' . $file, $dest . '/' . $directoryName); |
|
163 | + } else { |
|
164 | + $this->recursiveCopy($source.'/'.$file, $dest.'/'.$directoryName); |
|
165 | 165 | } |
166 | 166 | } |
167 | 167 | } |
@@ -160,7 +160,7 @@ |
||
160 | 160 | $source . '/' . $file, |
161 | 161 | $dest . '/' . $directoryName . '/' . $file |
162 | 162 | ); |
163 | - } else { |
|
163 | + } else { |
|
164 | 164 | $this->recursiveCopy($source . '/' . $file, $dest . '/' . $directoryName); |
165 | 165 | } |
166 | 166 | } |
@@ -92,10 +92,10 @@ |
||
92 | 92 | $result = $this->_config->getDb()->query($query); |
93 | 93 | while ($row = $this->_config->getDb()->fetchObject($result)) { |
94 | 94 | $data[$row->id] = array( |
95 | - 'time' => $row->time, |
|
96 | - 'usr' => $row->usr, |
|
97 | - 'text' => $row->text, |
|
98 | - 'ip' => $row->ip |
|
95 | + 'time' => $row->time, |
|
96 | + 'usr' => $row->usr, |
|
97 | + 'text' => $row->text, |
|
98 | + 'ip' => $row->ip |
|
99 | 99 | ); |
100 | 100 | } |
101 | 101 |
@@ -147,7 +147,7 @@ |
||
147 | 147 | WHERE |
148 | 148 | time < %d", |
149 | 149 | PMF_Db::getTablePrefix(), |
150 | - $_SERVER['REQUEST_TIME'] - 30 * 86400 |
|
150 | + $_SERVER['REQUEST_TIME'] - 30*86400 |
|
151 | 151 | ); |
152 | 152 | |
153 | 153 | if ($this->_config->getDb()->query($query)) { |
@@ -210,7 +210,7 @@ |
||
210 | 210 | $tagName = trim($tagName); |
211 | 211 | if (PMF_String::strlen($tagName) > 0) { |
212 | 212 | if (!in_array(PMF_String::strtolower($tagName), |
213 | - array_map(array('PMF_String', 'strtolower'), $currentTags))) { |
|
213 | + array_map(array('PMF_String', 'strtolower'), $currentTags))) { |
|
214 | 214 | // Create the new tag |
215 | 215 | $newTagId = $this->_config->getDb()->nextId(PMF_Db::getTablePrefix().'faqtags', 'tagging_id'); |
216 | 216 | $query = sprintf(" |
@@ -703,7 +703,7 @@ |
||
703 | 703 | } |
704 | 704 | |
705 | 705 | /** |
706 | - * @param $chr |
|
706 | + * @param string $chr |
|
707 | 707 | * |
708 | 708 | * @return bool |
709 | 709 | */ |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | $i++; |
445 | 445 | if ($max - $min > 0) { |
446 | 446 | $CSSRelevanceLevel = |
447 | - (int)($CSSRelevanceMinLevel + $CSSRelevanceMaxLevel * ($tag['count'] - $min) / ($max - $min)); |
|
447 | + (int)($CSSRelevanceMinLevel + $CSSRelevanceMaxLevel*($tag['count'] - $min)/($max - $min)); |
|
448 | 448 | } |
449 | 449 | $class = 'relevance'.$CSSRelevanceLevel; |
450 | 450 | $html .= '<span class="'.$class.'">'; |
@@ -612,7 +612,7 @@ discard block |
||
612 | 612 | foreach ($this->getPopularTags($limit) as $tagId => $tagFreq) { |
613 | 613 | $tagName = $this->getTagNameById($tagId); |
614 | 614 | $direction = $this->is_english($tagName[0]) ? 'ltr' : 'rtl'; |
615 | - $html .= sprintf( |
|
615 | + $html .= sprintf( |
|
616 | 616 | '<a class="btn tag" style="direction:%s;" href="?action=search&tagging_id=%d">%s (%d)</a>', |
617 | 617 | $direction, |
618 | 618 | $tagId, |
@@ -595,8 +595,9 @@ discard block |
||
595 | 595 | if ($result) { |
596 | 596 | while ($row = $this->_config->getDb()->fetchObject($result)) { |
597 | 597 | $tags[$row->tagging_id] = $row->freq; |
598 | - if (--$limit === 0) |
|
599 | - break; |
|
598 | + if (--$limit === 0) { |
|
599 | + break; |
|
600 | + } |
|
600 | 601 | } |
601 | 602 | } |
602 | 603 | return $tags; |
@@ -632,10 +633,12 @@ discard block |
||
632 | 633 | */ |
633 | 634 | public function is_english($chr) |
634 | 635 | { |
635 | - if (($chr >= 'A') && ($chr <= 'Z')) |
|
636 | - return true; |
|
637 | - if (($chr >= 'a') && ($chr <= 'z')) |
|
638 | - return true; |
|
636 | + if (($chr >= 'A') && ($chr <= 'Z')) { |
|
637 | + return true; |
|
638 | + } |
|
639 | + if (($chr >= 'a') && ($chr <= 'z')) { |
|
640 | + return true; |
|
641 | + } |
|
639 | 642 | return false; |
640 | 643 | } |
641 | 644 | } |
@@ -65,12 +65,12 @@ |
||
65 | 65 | $hashtags = ''; |
66 | 66 | |
67 | 67 | if ($tags != '') { |
68 | - $hashtags = '#' . str_replace(',', ' #', $tags); |
|
68 | + $hashtags = '#'.str_replace(',', ' #', $tags); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | $message = PMF_String::htmlspecialchars($question); |
72 | - $message .= ' ' . $hashtags; |
|
73 | - $message .= ' ' . $link; |
|
72 | + $message .= ' '.$hashtags; |
|
73 | + $message .= ' '.$link; |
|
74 | 74 | |
75 | 75 | $this->connection->post('statuses/update', array('status' => $message)); |
76 | 76 | } |
@@ -59,18 +59,18 @@ discard block |
||
59 | 59 | */ |
60 | 60 | public function getImage($email, $params = array()) |
61 | 61 | { |
62 | - $imageUrl = $this->getUrl() . 'avatar/' . $this->getHash($email); |
|
62 | + $imageUrl = $this->getUrl().'avatar/'.$this->getHash($email); |
|
63 | 63 | |
64 | 64 | $opts = array(); |
65 | 65 | |
66 | 66 | if (isset($params['default'])) { |
67 | - $opts[] = 'default='. $params['default']; |
|
67 | + $opts[] = 'default='.$params['default']; |
|
68 | 68 | } |
69 | 69 | if (isset($params['size'])) { |
70 | - $opts[] = 'size='. $params['size']; |
|
70 | + $opts[] = 'size='.$params['size']; |
|
71 | 71 | } |
72 | 72 | if (isset($params['rating'])) { |
73 | - $opts[] = 'rating='. $params['rating']; |
|
73 | + $opts[] = 'rating='.$params['rating']; |
|
74 | 74 | } |
75 | 75 | if (isset($params['force_default']) && $params['force_default'] === true) { |
76 | 76 | $opts[] = 'forcedefault=y'; |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | $params['class'] = ''; |
80 | 80 | } |
81 | 81 | |
82 | - $gravatar = $imageUrl . (sizeof($opts) > 0 ? '?' . implode($opts, '&') : false); |
|
82 | + $gravatar = $imageUrl.(sizeof($opts) > 0 ? '?'.implode($opts, '&') : false); |
|
83 | 83 | |
84 | 84 | return sprintf( |
85 | 85 | '<img src="%s" class="%s" alt="Gravatar">', |
@@ -106,7 +106,7 @@ |
||
106 | 106 | while (($row = $this->_config->getDb()->fetchObject($result))) { |
107 | 107 | |
108 | 108 | $counter++; |
109 | - if (($showArchive && ($counter > $this->_config->get('records.numberOfShownNewsEntries'))) || |
|
109 | + if (($showArchive && ($counter > $this->_config->get('records.numberOfShownNewsEntries'))) || |
|
110 | 110 | ((!$showArchive) && (!$forceConfLimit) && |
111 | 111 | ($counter <= $this->_config->get('records.numberOfShownNewsEntries'))) || |
112 | 112 | ((!$showArchive) && $forceConfLimit)) { |
@@ -42,10 +42,10 @@ discard block |
||
42 | 42 | private $_config; |
43 | 43 | |
44 | 44 | /** |
45 | - * Language strings |
|
46 | - * |
|
47 | - * @var string |
|
48 | - */ |
|
45 | + * Language strings |
|
46 | + * |
|
47 | + * @var string |
|
48 | + */ |
|
49 | 49 | private $pmf_lang; |
50 | 50 | |
51 | 51 | /** |
@@ -152,9 +152,9 @@ discard block |
||
152 | 152 | foreach ($news as $item) { |
153 | 153 | |
154 | 154 | $url = sprintf('%s?action=news&newsid=%d&newslang=%s', |
155 | - PMF_Link::getSystemRelativeUri(), |
|
156 | - $item['id'], |
|
157 | - $item['lang']); |
|
155 | + PMF_Link::getSystemRelativeUri(), |
|
156 | + $item['id'], |
|
157 | + $item['lang']); |
|
158 | 158 | $oLink = new PMF_Link($url, $this->_config); |
159 | 159 | |
160 | 160 | if (isset($item['header'])) { |
@@ -291,10 +291,10 @@ |
||
291 | 291 | public function update(Array $newConfigs) |
292 | 292 | { |
293 | 293 | $runtimeConfigs = array( |
294 | - 'core.database', // PMF_DB_Driver |
|
295 | - 'core.instance', // PMF_Instance |
|
296 | - 'core.language', // Language |
|
297 | - 'core.ldap', // PMF_Ldap |
|
294 | + 'core.database', // PMF_DB_Driver |
|
295 | + 'core.instance', // PMF_Instance |
|
296 | + 'core.language', // Language |
|
297 | + 'core.ldap', // PMF_Ldap |
|
298 | 298 | 'core.ldapConfig' // $PMF_LDAP |
299 | 299 | ); |
300 | 300 | if (is_array($newConfigs)) { |