@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | |
21 | 21 | public function setToAddress($email, $person = null) |
22 | 22 | { |
23 | - if($person) |
|
23 | + if ($person) |
|
24 | 24 | $this->to[] = "{$person} <{$email}>"; |
25 | 25 | else |
26 | 26 | $this->to[] = "{$email}"; |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | |
42 | 42 | public function send() |
43 | 43 | { |
44 | - if(!Loader::isLive()) |
|
44 | + if (!Loader::isLive()) |
|
45 | 45 | { |
46 | 46 | Debugger::logMessage("Email Failed:\n\n{$this->message}"); |
47 | 47 | return; |
@@ -51,14 +51,14 @@ discard block |
||
51 | 51 | $subject = $this->subject; |
52 | 52 | $message = $this->message; |
53 | 53 | |
54 | - if(empty($to) || empty($subject) || empty($message)) |
|
54 | + if (empty($to) || empty($subject) || empty($message)) |
|
55 | 55 | { |
56 | 56 | Debugger::logMessage("Attempted to send an email without all of the required fields."); |
57 | 57 | return; |
58 | 58 | } |
59 | 59 | |
60 | 60 | $header = ''; |
61 | - foreach($this->headers as $key => $value) |
|
61 | + foreach ($this->headers as $key => $value) |
|
62 | 62 | { |
63 | 63 | $header .= "{$key}: {$value}\r\n"; |
64 | 64 | } |
@@ -18,9 +18,9 @@ discard block |
||
18 | 18 | |
19 | 19 | static function getServer($key = null) |
20 | 20 | { |
21 | - if($key) |
|
21 | + if ($key) |
|
22 | 22 | { |
23 | - if(isset(self::$server[$key])) |
|
23 | + if (isset(self::$server[$key])) |
|
24 | 24 | return self::$server[$key]; |
25 | 25 | return false; |
26 | 26 | } |
@@ -29,16 +29,16 @@ discard block |
||
29 | 29 | |
30 | 30 | static function isAjax() |
31 | 31 | { |
32 | - if(self::getServer(self::$AJAX_REQUEST)) |
|
32 | + if (self::getServer(self::$AJAX_REQUEST)) |
|
33 | 33 | return true; |
34 | 34 | return false; |
35 | 35 | } |
36 | 36 | |
37 | 37 | static function getGet($key = null) |
38 | 38 | { |
39 | - if($key) |
|
39 | + if ($key) |
|
40 | 40 | { |
41 | - if(isset(self::$get[$key])) |
|
41 | + if (isset(self::$get[$key])) |
|
42 | 42 | return self::$get[$key]; |
43 | 43 | return false; |
44 | 44 | } |
@@ -47,9 +47,9 @@ discard block |
||
47 | 47 | |
48 | 48 | static function getPost($key = null) |
49 | 49 | { |
50 | - if($key) |
|
50 | + if ($key) |
|
51 | 51 | { |
52 | - if(isset(self::$post[$key])) |
|
52 | + if (isset(self::$post[$key])) |
|
53 | 53 | return self::$post[$key]; |
54 | 54 | return false; |
55 | 55 | } |
@@ -39,20 +39,20 @@ discard block |
||
39 | 39 | public function perform() |
40 | 40 | { |
41 | 41 | $weighted_array = array(); |
42 | - foreach($this->result as $row) |
|
42 | + foreach ($this->result as $row) |
|
43 | 43 | { |
44 | 44 | $weight = $this->get_search_weight($row); |
45 | - if($weight > 0) |
|
45 | + if ($weight > 0) |
|
46 | 46 | $weighted_array[$row->id] = $weight; |
47 | 47 | } |
48 | 48 | arsort($weighted_array); |
49 | 49 | |
50 | 50 | $final_array = array(); |
51 | - foreach($weighted_array as $id => $weight) |
|
51 | + foreach ($weighted_array as $id => $weight) |
|
52 | 52 | { |
53 | - foreach($this->result as $row) |
|
53 | + foreach ($this->result as $row) |
|
54 | 54 | { |
55 | - if($row->id == $id) |
|
55 | + if ($row->id == $id) |
|
56 | 56 | $final_array[] = $row; |
57 | 57 | } |
58 | 58 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | private function get_search_weight($row) |
63 | 63 | { |
64 | 64 | $weight = 0; |
65 | - foreach($this->weight as $weight_array) |
|
65 | + foreach ($this->weight as $weight_array) |
|
66 | 66 | { |
67 | 67 | $text = $row->{$weight_array['field']}; |
68 | 68 | $weight += $weight_array['weight'] * substr_count(strtolower($text), strtolower($this->query)); |
@@ -15,11 +15,11 @@ discard block |
||
15 | 15 | static private function form_url_array($host, $uri) |
16 | 16 | { |
17 | 17 | $uri = substr($uri, 1); |
18 | - if(strpos($uri, '?')) |
|
18 | + if (strpos($uri, '?')) |
|
19 | 19 | $uri = substr($uri, 0, strpos($uri, '?')); |
20 | 20 | $uri_array = explode('/', $uri); |
21 | 21 | |
22 | - if(!Loader::isLive()) |
|
22 | + if (!Loader::isLive()) |
|
23 | 23 | $host = substr($host, strpos($host, '.') + 1); |
24 | 24 | |
25 | 25 | self::$array['host'] = $host; |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | self::$array['base'] = 'http://' . (!Loader::isLive() ? 'dev.' : '') . $host . '/'; |
34 | 34 | self::$array['uri'] = '/' . implode('/', $uri_array); |
35 | 35 | |
36 | - if(end($uri_array) == '') |
|
36 | + if (end($uri_array) == '') |
|
37 | 37 | $uri_array = array_slice($uri_array, 0, count($uri_array) - 1); |
38 | 38 | self::$array['pieces'] = (array) $uri_array; |
39 | 39 | } |
@@ -61,21 +61,21 @@ discard block |
||
61 | 61 | static function getExtension() |
62 | 62 | { |
63 | 63 | $file = self::getPiece(-1); |
64 | - if(substr($file, -1) == '/') |
|
64 | + if (substr($file, -1) == '/') |
|
65 | 65 | return false; |
66 | - return substr($file, strrpos($file, '.') + 1);; |
|
66 | + return substr($file, strrpos($file, '.') + 1); ; |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | static function getPiece($piece = null) |
70 | 70 | { |
71 | - if(!$piece) |
|
71 | + if (!$piece) |
|
72 | 72 | return self::$array['pieces']; |
73 | 73 | |
74 | - if($piece == -1) |
|
74 | + if ($piece == -1) |
|
75 | 75 | return end(self::$array['pieces']); |
76 | 76 | |
77 | 77 | $piece = $piece - 1; |
78 | - if(array_key_exists($piece, self::$array['pieces'])) |
|
78 | + if (array_key_exists($piece, self::$array['pieces'])) |
|
79 | 79 | return self::$array['pieces'][$piece]; |
80 | 80 | return; |
81 | 81 | } |
@@ -11,39 +11,39 @@ discard block |
||
11 | 11 | |
12 | 12 | public static function isBoolean($value, $strict = false) |
13 | 13 | { |
14 | - if($strict && ($value === true || $value === false)) |
|
14 | + if ($strict && ($value === true || $value === false)) |
|
15 | 15 | return true; |
16 | - if(!$strict && ((bool) $value === true || (bool) $value === false)) |
|
16 | + if (!$strict && ((bool) $value === true || (bool) $value === false)) |
|
17 | 17 | return true; |
18 | 18 | return false; |
19 | 19 | } |
20 | 20 | |
21 | 21 | public static function isDate($value) |
22 | 22 | { |
23 | - if(strtotime($value) !== -1) |
|
23 | + if (strtotime($value) !== -1) |
|
24 | 24 | return true; |
25 | - if(date('y', $value) !== false) |
|
25 | + if (date('y', $value) !== false) |
|
26 | 26 | return true; |
27 | 27 | return false; |
28 | 28 | } |
29 | 29 | |
30 | 30 | public static function isInteger($value, $strict = false) |
31 | 31 | { |
32 | - if($strict) |
|
32 | + if ($strict) |
|
33 | 33 | return is_int($value); |
34 | 34 | return (int) $value == $value; |
35 | 35 | } |
36 | 36 | |
37 | 37 | public static function isIP($value) |
38 | 38 | { |
39 | - if(self::isInteger(ip2long($value))) |
|
39 | + if (self::isInteger(ip2long($value))) |
|
40 | 40 | return true; |
41 | 41 | return false; |
42 | 42 | } |
43 | 43 | |
44 | 44 | public static function isString($value, $strict = false) |
45 | 45 | { |
46 | - if($strict) |
|
46 | + if ($strict) |
|
47 | 47 | return is_string($value); |
48 | 48 | return (string) $value == $value; |
49 | 49 | } |
@@ -67,14 +67,14 @@ discard block |
||
67 | 67 | private static function check_value($pattern, $string) |
68 | 68 | { |
69 | 69 | preg_match($pattern, $string, $matches); |
70 | - if(empty($matches)) |
|
70 | + if (empty($matches)) |
|
71 | 71 | return false; |
72 | 72 | return $matches[0] == $string; |
73 | 73 | } |
74 | 74 | |
75 | 75 | public static function checkRequest($type, $key, $validation, $strict = false) |
76 | 76 | { |
77 | - switch($type) |
|
77 | + switch ($type) |
|
78 | 78 | { |
79 | 79 | case 'server': |
80 | 80 | $value = Request::getServer($key); |
@@ -84,10 +84,10 @@ discard block |
||
84 | 84 | break; |
85 | 85 | } |
86 | 86 | |
87 | - if($value == false) |
|
87 | + if ($value == false) |
|
88 | 88 | return false; |
89 | 89 | |
90 | - switch($validation) |
|
90 | + switch ($validation) |
|
91 | 91 | { |
92 | 92 | case 'boolean': |
93 | 93 | return self::isBoolean($value, $strict); |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | |
27 | 27 | public static function instance() |
28 | 28 | { |
29 | - if(!isset(self::$instance)) |
|
29 | + if (!isset(self::$instance)) |
|
30 | 30 | self::$instance = new Visitor(); |
31 | 31 | return self::$instance; |
32 | 32 | } |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | public static function getBrowser() |
36 | 36 | { |
37 | 37 | Loader::load('utility', 'environment/BrowserEnvironment'); |
38 | - if(!isset(self::instance()->browser)) |
|
38 | + if (!isset(self::instance()->browser)) |
|
39 | 39 | self::instance()->browser = new BrowserEnvironment(); |
40 | 40 | return self::instance()->browser; |
41 | 41 | } |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | public static function getPlatform() |
45 | 45 | { |
46 | 46 | Loader::load('utility', 'environment/PlatformEnvironment'); |
47 | - if(!isset(self::instance()->platform)) |
|
47 | + if (!isset(self::instance()->platform)) |
|
48 | 48 | self::instance()->platform = new PlatformEnvironment(); |
49 | 49 | return self::instance()->platform; |
50 | 50 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | public static function getIP() |
54 | 54 | { |
55 | 55 | Loader::load('utility', 'Request'); |
56 | - if(!isset(self::instance()->ip_address)) |
|
56 | + if (!isset(self::instance()->ip_address)) |
|
57 | 57 | self::instance()->ip_address = Request::getServer('REMOTE_ADDR'); |
58 | 58 | return self::instance()->ip_address; |
59 | 59 | } |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | Loader::loadInstance('utility', 'Database'); |
80 | 80 | |
81 | 81 | $query = $this->get_tracking_query(); |
82 | - if(Database::execute($query) == true) |
|
82 | + if (Database::execute($query) == true) |
|
83 | 83 | { |
84 | 84 | $this->raw_visit_log_id = Database::lastInsertID(); |
85 | 85 | return true; |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | |
95 | 95 | $columns = '`'; |
96 | 96 | $values = "'"; |
97 | - foreach(self::$tracking_field_array as $field_column => $server_array_key) |
|
97 | + foreach (self::$tracking_field_array as $field_column => $server_array_key) |
|
98 | 98 | { |
99 | 99 | $value = Request::getServer($server_array_key); |
100 | 100 | $value = Database::escape($value); |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | $values .= "{$value}','"; |
104 | 104 | } |
105 | 105 | |
106 | - if(Request::hasPost()) |
|
106 | + if (Request::hasPost()) |
|
107 | 107 | { |
108 | 108 | $value = Request::getPost(); |
109 | 109 | $value = serialize($value); |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | |
122 | 122 | private function track_response_error($code) |
123 | 123 | { |
124 | - if(isset($this->raw_visit_log_id) && $this->raw_visit_log_id > 0) |
|
124 | + if (isset($this->raw_visit_log_id) && $this->raw_visit_log_id > 0) |
|
125 | 125 | { |
126 | 126 | $query = "UPDATE `jpemeric_stat`.`raw_visit_log` SET `code` = '{$code}' WHERE `id` = '{$this->raw_visit_log_id}' LIMIT 1"; |
127 | 127 | return Database::execute($query); |
@@ -9,9 +9,9 @@ discard block |
||
9 | 9 | protected function execute() |
10 | 10 | { |
11 | 11 | $is_acceptable = true; |
12 | - foreach($this->getUnacceptableWords() as $unacceptableWord) |
|
12 | + foreach ($this->getUnacceptableWords() as $unacceptableWord) |
|
13 | 13 | { |
14 | - if(stristr($unacceptableWord->word, $this->content)) |
|
14 | + if (stristr($unacceptableWord->word, $this->content)) |
|
15 | 15 | $is_acceptable = false; |
16 | 16 | } |
17 | 17 | return $is_acceptable; |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | private $unacceptableWords; |
21 | 21 | private function getUnacceptableWords() |
22 | 22 | { |
23 | - if(!$this->unacceptableWords) |
|
23 | + if (!$this->unacceptableWords) |
|
24 | 24 | $this->unacceptableWords = UnacceptableWordCollector::getWords(); |
25 | 25 | return $this->unacceptableWords; |
26 | 26 | } |
@@ -10,12 +10,12 @@ discard block |
||
10 | 10 | |
11 | 11 | protected function execute() |
12 | 12 | { |
13 | - if(stristr($this->content, '#') === false) |
|
13 | + if (stristr($this->content, '#') === false) |
|
14 | 14 | return; |
15 | 15 | |
16 | 16 | // yeah yeah, i'm currently ignoring the link, whatevs |
17 | 17 | $parameters = func_get_args(); |
18 | - if(count($parameters) > 1 || (count($parameters) == 1 && !is_array($parameters[0]))) |
|
18 | + if (count($parameters) > 1 || (count($parameters) == 1 && !is_array($parameters[0]))) |
|
19 | 19 | { |
20 | 20 | trigger_error('Unexpected parameters passed into AutolinkTwitterHash!'); |
21 | 21 | return; |
@@ -23,10 +23,10 @@ discard block |
||
23 | 23 | $parameters = array_shift($parameters); |
24 | 24 | |
25 | 25 | $found_hash = preg_match_all(self::$HASH_PATTERN, $this->content, $matches, PREG_SET_ORDER); |
26 | - if($found_hash === false || $found_hash === 0) |
|
26 | + if ($found_hash === false || $found_hash === 0) |
|
27 | 27 | return; |
28 | 28 | |
29 | - foreach($matches as $match) |
|
29 | + foreach ($matches as $match) |
|
30 | 30 | { |
31 | 31 | $replacement = $this->get_replacement_link($match[1], $match[0]); |
32 | 32 | $this->content = str_replace($match[0], $replacement, $this->content); |
@@ -10,11 +10,11 @@ discard block |
||
10 | 10 | |
11 | 11 | protected function execute() |
12 | 12 | { |
13 | - if(stristr($this->content, 'http') === false) |
|
13 | + if (stristr($this->content, 'http') === false) |
|
14 | 14 | return; |
15 | 15 | |
16 | 16 | $parameters = func_get_args(); |
17 | - if(count($parameters) > 1 || (count($parameters) == 1 && !is_array($parameters[0]))) |
|
17 | + if (count($parameters) > 1 || (count($parameters) == 1 && !is_array($parameters[0]))) |
|
18 | 18 | { |
19 | 19 | trigger_error('Unexpected parameters passed into AutolinkTwitterURL!'); |
20 | 20 | return; |
@@ -22,10 +22,10 @@ discard block |
||
22 | 22 | $parameters = array_shift($parameters); |
23 | 23 | |
24 | 24 | $found_link = preg_match_all(self::$LINK_PATTERN, $this->content, $matches, PREG_SET_ORDER); |
25 | - if($found_link === false || $found_link === 0) |
|
25 | + if ($found_link === false || $found_link === 0) |
|
26 | 26 | return; |
27 | 27 | |
28 | - foreach($matches as $match) |
|
28 | + foreach ($matches as $match) |
|
29 | 29 | { |
30 | 30 | $parameters['href'] = $match[0]; |
31 | 31 | $display_url = $this->get_display_url($match); |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | { |
42 | 42 | $display_url = $this->check_for_redirect($match[0]); |
43 | 43 | |
44 | - if(strlen($display_url) > (self::$DISPLAY_URL_LENGTH - 2)) |
|
44 | + if (strlen($display_url) > (self::$DISPLAY_URL_LENGTH - 2)) |
|
45 | 45 | { |
46 | 46 | $display_url = substr($display_url, 0, self::$DISPLAY_URL_LENGTH); |
47 | 47 | $display_url .= '...'; |
@@ -53,12 +53,12 @@ discard block |
||
53 | 53 | private function get_replacement_link($parameters, $display_url) |
54 | 54 | { |
55 | 55 | $link = '<a'; |
56 | - foreach($parameters as $attribute => $value) |
|
56 | + foreach ($parameters as $attribute => $value) |
|
57 | 57 | { |
58 | 58 | $link .= ' '; |
59 | 59 | $link .= $attribute; |
60 | 60 | $link .= '='; |
61 | - $link .= '"' . $value .'"'; |
|
61 | + $link .= '"' . $value . '"'; |
|
62 | 62 | } |
63 | 63 | $link .= '>'; |
64 | 64 | $link .= $display_url; |
@@ -70,14 +70,14 @@ discard block |
||
70 | 70 | private function check_for_redirect($url) |
71 | 71 | { |
72 | 72 | $headers = @get_headers($url); |
73 | - if($headers === false) |
|
73 | + if ($headers === false) |
|
74 | 74 | $headers = $this->get_headers($url); |
75 | 75 | |
76 | - if(stristr($headers[0], '301') !== false || stristr($headers[0], '302') !== false) |
|
76 | + if (stristr($headers[0], '301') !== false || stristr($headers[0], '302') !== false) |
|
77 | 77 | { |
78 | - foreach($headers as $header) |
|
78 | + foreach ($headers as $header) |
|
79 | 79 | { |
80 | - if(substr($header, 0, 9) == 'Location:') |
|
80 | + if (substr($header, 0, 9) == 'Location:') |
|
81 | 81 | break; |
82 | 82 | } |
83 | 83 |