@@ -17,14 +17,14 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | public static function instance() |
| 19 | 19 | {
|
| 20 | - if(!isset(self::$instance)) |
|
| 20 | + if (!isset(self::$instance)) |
|
| 21 | 21 | self::$instance = new Loader(); |
| 22 | 22 | return self::$instance; |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | private function get_root() |
| 26 | 26 | {
|
| 27 | - if(!isset($this->root)) |
|
| 27 | + if (!isset($this->root)) |
|
| 28 | 28 | {
|
| 29 | 29 | $current_directory = dirname(__FILE__); |
| 30 | 30 | $current_directory = substr($current_directory, 0, -7); |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | private static function get_extension($type) |
| 54 | 54 | {
|
| 55 | - switch($type) |
|
| 55 | + switch ($type) |
|
| 56 | 56 | {
|
| 57 | 57 | case 'collector' : |
| 58 | 58 | case 'controller' : |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | |
| 72 | 72 | public static function getImagePath($type, $file) |
| 73 | 73 | {
|
| 74 | - if($type == 'photo') |
|
| 74 | + if ($type == 'photo') |
|
| 75 | 75 | $type = 'photo/processed'; |
| 76 | 76 | |
| 77 | 77 | $path = self::instance()->get_root(); |
@@ -107,18 +107,18 @@ discard block |
||
| 107 | 107 | |
| 108 | 108 | public static function load($type, $files, $data = array()) |
| 109 | 109 | {
|
| 110 | - foreach((array) $files as $file) |
|
| 110 | + foreach ((array) $files as $file) |
|
| 111 | 111 | {
|
| 112 | 112 | $file_path = self::instance()->get_path($type, $file); |
| 113 | - if(in_array($file_path, self::instance()->get_included_files()) && $type !== 'view') |
|
| 113 | + if (in_array($file_path, self::instance()->get_included_files()) && $type !== 'view') |
|
| 114 | 114 | continue; |
| 115 | 115 | |
| 116 | - if(!file_exists($file_path)) |
|
| 116 | + if (!file_exists($file_path)) |
|
| 117 | 117 | Debugger::logMessage("Requested file does not exist: {$type}, {$file}");
|
| 118 | 118 | |
| 119 | 119 | self::instance()->add_included_file($file_path); |
| 120 | 120 | |
| 121 | - switch($type) |
|
| 121 | + switch ($type) |
|
| 122 | 122 | {
|
| 123 | 123 | case 'images' : |
| 124 | 124 | case 'scripts' : |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | |
| 149 | 149 | $reflectionObject = self::create_reflection_class($file); |
| 150 | 150 | |
| 151 | - if( |
|
| 151 | + if ( |
|
| 152 | 152 | $reflectionObject->hasMethod('instance') &&
|
| 153 | 153 | $reflectionObject->getMethod('instance')->isStatic())
|
| 154 | 154 | {
|
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | |
| 164 | 164 | $reflectionObject = self::create_reflection_class($file); |
| 165 | 165 | |
| 166 | - if($reflectionObject->hasMethod('__construct'))
|
|
| 166 | + if ($reflectionObject->hasMethod('__construct'))
|
|
| 167 | 167 | return $reflectionObject->newInstanceArgs($data); |
| 168 | 168 | else |
| 169 | 169 | return $reflectionObject->newInstance(); |
@@ -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); |