@@ -20,6 +20,6 @@ |
||
| 20 | 20 | ) |
| 21 | 21 | ); |
| 22 | 22 | |
| 23 | -Router::route($redirect,$direct); |
|
| 23 | +Router::route($redirect, $direct); |
|
| 24 | 24 | |
| 25 | 25 | ?> |
| 26 | 26 | \ No newline at end of file |
@@ -26,7 +26,7 @@ |
||
| 26 | 26 | {
|
| 27 | 27 | //if(!$this->time_to_run($frequency)) |
| 28 | 28 | // continue; |
| 29 | - if ($cron != 'TwitterCron') continue; |
|
| 29 | + if ($cron != 'TwitterCron') continue; |
|
| 30 | 30 | |
| 31 | 31 | Loader::load('utility', "cron/{$cron}");
|
| 32 | 32 | $reflection = new ReflectionClass($cron); |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | |
| 23 | 23 | public function activate() |
| 24 | 24 | {
|
| 25 | - foreach(self::$CRON_ARRAY as $cron => $frequency) |
|
| 25 | + foreach (self::$CRON_ARRAY as $cron => $frequency) |
|
| 26 | 26 | {
|
| 27 | 27 | //if(!$this->time_to_run($frequency)) |
| 28 | 28 | // continue; |
@@ -49,19 +49,19 @@ discard block |
||
| 49 | 49 | $operator = explode(' ', $frequency);
|
| 50 | 50 | list($time['minute'], $time['hour'], $time['day'], $time['month'], $time['weekday']) = $operator; |
| 51 | 51 | |
| 52 | - foreach($time as $key => $value) |
|
| 52 | + foreach ($time as $key => $value) |
|
| 53 | 53 | {
|
| 54 | - if($value == '*') |
|
| 54 | + if ($value == '*') |
|
| 55 | 55 | continue; |
| 56 | - if(stristr($value, '/')) |
|
| 56 | + if (stristr($value, '/')) |
|
| 57 | 57 | {
|
| 58 | 58 | $value = substr($value, 2); |
| 59 | - if($cur[$key] % $value == 0) |
|
| 59 | + if ($cur[$key] % $value == 0) |
|
| 60 | 60 | continue; |
| 61 | 61 | else |
| 62 | 62 | return; |
| 63 | 63 | } |
| 64 | - if($cur[$key] == $value) |
|
| 64 | + if ($cur[$key] == $value) |
|
| 65 | 65 | continue; |
| 66 | 66 | return; |
| 67 | 67 | } |
@@ -26,7 +26,9 @@ discard block |
||
| 26 | 26 | {
|
| 27 | 27 | //if(!$this->time_to_run($frequency)) |
| 28 | 28 | // continue; |
| 29 | - if ($cron != 'TwitterCron') continue; |
|
| 29 | + if ($cron != 'TwitterCron') {
|
|
| 30 | + continue; |
|
| 31 | + } |
|
| 30 | 32 | |
| 31 | 33 | Loader::load('utility', "cron/{$cron}");
|
| 32 | 34 | $reflection = new ReflectionClass($cron); |
@@ -51,18 +53,21 @@ discard block |
||
| 51 | 53 | |
| 52 | 54 | foreach($time as $key => $value) |
| 53 | 55 | {
|
| 54 | - if($value == '*') |
|
| 55 | - continue; |
|
| 56 | + if($value == '*') {
|
|
| 57 | + continue; |
|
| 58 | + } |
|
| 56 | 59 | if(stristr($value, '/')) |
| 57 | 60 | {
|
| 58 | 61 | $value = substr($value, 2); |
| 59 | - if($cur[$key] % $value == 0) |
|
| 60 | - continue; |
|
| 61 | - else |
|
| 62 | - return; |
|
| 62 | + if($cur[$key] % $value == 0) {
|
|
| 63 | + continue; |
|
| 64 | + } else {
|
|
| 65 | + return; |
|
| 66 | + } |
|
| 67 | + } |
|
| 68 | + if($cur[$key] == $value) {
|
|
| 69 | + continue; |
|
| 63 | 70 | } |
| 64 | - if($cur[$key] == $value) |
|
| 65 | - continue; |
|
| 66 | 71 | return; |
| 67 | 72 | } |
| 68 | 73 | return true; |
@@ -16,17 +16,17 @@ discard block |
||
| 16 | 16 | |
| 17 | 17 | private function __construct($write_params, $read_params) |
| 18 | 18 | {
|
| 19 | - $this->write_connection = $this->connect( |
|
| 20 | - $write_params->host, |
|
| 21 | - $write_params->user, |
|
| 22 | - $write_params->password |
|
| 23 | - ); |
|
| 24 | - |
|
| 25 | - $this->read_connection = $this->connect( |
|
| 26 | - $read_params->host, |
|
| 27 | - $read_params->user, |
|
| 28 | - $read_params->password |
|
| 29 | - ); |
|
| 19 | + $this->write_connection = $this->connect( |
|
| 20 | + $write_params->host, |
|
| 21 | + $write_params->user, |
|
| 22 | + $write_params->password |
|
| 23 | + ); |
|
| 24 | + |
|
| 25 | + $this->read_connection = $this->connect( |
|
| 26 | + $read_params->host, |
|
| 27 | + $read_params->user, |
|
| 28 | + $read_params->password |
|
| 29 | + ); |
|
| 30 | 30 | |
| 31 | 31 | return $this; |
| 32 | 32 | } |
@@ -45,12 +45,12 @@ discard block |
||
| 45 | 45 | public static function instance() |
| 46 | 46 | {
|
| 47 | 47 | if(!isset(self::$instance)) {
|
| 48 | - global $config; |
|
| 49 | - self::$instance = new Database( |
|
| 50 | - $config->database->master, |
|
| 51 | - $config->database->slave |
|
| 52 | - ); |
|
| 53 | - } |
|
| 48 | + global $config; |
|
| 49 | + self::$instance = new Database( |
|
| 50 | + $config->database->master, |
|
| 51 | + $config->database->slave |
|
| 52 | + ); |
|
| 53 | + } |
|
| 54 | 54 | |
| 55 | 55 | return self::$instance; |
| 56 | 56 | } |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | $mysqli = new mysqli($host, $username, $password); |
| 37 | 37 | |
| 38 | 38 | $has_connection_error = $mysqli->connect_error; |
| 39 | - if(isset($has_connection_error)) |
|
| 39 | + if (isset($has_connection_error)) |
|
| 40 | 40 | $this->has_connection_error = true; |
| 41 | 41 | |
| 42 | 42 | return $mysqli; |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | |
| 45 | 45 | public static function instance() |
| 46 | 46 | {
|
| 47 | - if(!isset(self::$instance)) {
|
|
| 47 | + if (!isset(self::$instance)) {
|
|
| 48 | 48 | global $config; |
| 49 | 49 | self::$instance = new Database( |
| 50 | 50 | $config->database->master, |
@@ -63,11 +63,11 @@ discard block |
||
| 63 | 63 | public static function select($query) |
| 64 | 64 | {
|
| 65 | 65 | $start = microtime(true); |
| 66 | - if($result = self::instance()->read_connection->query($query)) |
|
| 66 | + if ($result = self::instance()->read_connection->query($query)) |
|
| 67 | 67 | {
|
| 68 | 68 | self::instance()->log_query($query, $start); |
| 69 | 69 | $array = array(); |
| 70 | - while($row = $result->fetch_object()) |
|
| 70 | + while ($row = $result->fetch_object()) |
|
| 71 | 71 | $array[] = $row; |
| 72 | 72 | $result->close(); |
| 73 | 73 | return $array; |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | public static function selectRow($query) |
| 80 | 80 | {
|
| 81 | 81 | $result = self::select($query); |
| 82 | - if(is_array($result)) |
|
| 82 | + if (is_array($result)) |
|
| 83 | 83 | return array_pop($result); |
| 84 | 84 | return false; |
| 85 | 85 | } |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | public static function execute($query) |
| 88 | 88 | {
|
| 89 | 89 | $start = microtime(true); |
| 90 | - if(self::instance()->write_connection->query($query)) |
|
| 90 | + if (self::instance()->write_connection->query($query)) |
|
| 91 | 91 | {
|
| 92 | 92 | self::instance()->log_query($query, $start); |
| 93 | 93 | return true; |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | public static function lastInsertID() |
| 100 | 100 | {
|
| 101 | 101 | $id = self::instance()->write_connection->insert_id; |
| 102 | - if($id == 0) |
|
| 102 | + if ($id == 0) |
|
| 103 | 103 | return false; |
| 104 | 104 | return $id; |
| 105 | 105 | } |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | private function gather_query_data() |
| 120 | 120 | {
|
| 121 | 121 | $query_data = array(); |
| 122 | - foreach($this->query_log as $query) |
|
| 122 | + foreach ($this->query_log as $query) |
|
| 123 | 123 | {
|
| 124 | 124 | $query = self::explain($query); |
| 125 | 125 | $query_data[] = $query; |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | {
|
| 132 | 132 | $sql = 'EXPLAIN ' . $query['sql']; |
| 133 | 133 | |
| 134 | - if($result = self::instance()->read_connection->query($sql)) |
|
| 134 | + if ($result = self::instance()->read_connection->query($sql)) |
|
| 135 | 135 | {
|
| 136 | 136 | $row = $result->fetch_assoc(); |
| 137 | 137 | $query['explain'] = $row; |
@@ -36,8 +36,9 @@ discard block |
||
| 36 | 36 | $mysqli = new mysqli($host, $username, $password); |
| 37 | 37 | |
| 38 | 38 | $has_connection_error = $mysqli->connect_error; |
| 39 | - if(isset($has_connection_error)) |
|
| 40 | - $this->has_connection_error = true; |
|
| 39 | + if(isset($has_connection_error)) {
|
|
| 40 | + $this->has_connection_error = true; |
|
| 41 | + } |
|
| 41 | 42 | |
| 42 | 43 | return $mysqli; |
| 43 | 44 | } |
@@ -67,8 +68,9 @@ discard block |
||
| 67 | 68 | {
|
| 68 | 69 | self::instance()->log_query($query, $start); |
| 69 | 70 | $array = array(); |
| 70 | - while($row = $result->fetch_object()) |
|
| 71 | - $array[] = $row; |
|
| 71 | + while($row = $result->fetch_object()) {
|
|
| 72 | + $array[] = $row; |
|
| 73 | + } |
|
| 72 | 74 | $result->close(); |
| 73 | 75 | return $array; |
| 74 | 76 | } |
@@ -79,8 +81,9 @@ discard block |
||
| 79 | 81 | public static function selectRow($query) |
| 80 | 82 | {
|
| 81 | 83 | $result = self::select($query); |
| 82 | - if(is_array($result)) |
|
| 83 | - return array_pop($result); |
|
| 84 | + if(is_array($result)) {
|
|
| 85 | + return array_pop($result); |
|
| 86 | + } |
|
| 84 | 87 | return false; |
| 85 | 88 | } |
| 86 | 89 | |
@@ -99,8 +102,9 @@ discard block |
||
| 99 | 102 | public static function lastInsertID() |
| 100 | 103 | {
|
| 101 | 104 | $id = self::instance()->write_connection->insert_id; |
| 102 | - if($id == 0) |
|
| 103 | - return false; |
|
| 105 | + if($id == 0) {
|
|
| 106 | + return false; |
|
| 107 | + } |
|
| 104 | 108 | return $id; |
| 105 | 109 | } |
| 106 | 110 | |
@@ -9,7 +9,7 @@ |
||
| 9 | 9 | |
| 10 | 10 | public function __construct($user_agent = null) |
| 11 | 11 | {
|
| 12 | - if(!isset($user_agent)) |
|
| 12 | + if (!isset($user_agent)) |
|
| 13 | 13 | $user_agent = Request::getServer('HTTP_USER_AGENT');
|
| 14 | 14 | $this->user_agent = $user_agent; |
| 15 | 15 | } |
@@ -9,8 +9,9 @@ |
||
| 9 | 9 | |
| 10 | 10 | public function __construct($user_agent = null) |
| 11 | 11 | {
|
| 12 | - if(!isset($user_agent)) |
|
| 13 | - $user_agent = Request::getServer('HTTP_USER_AGENT');
|
|
| 12 | + if(!isset($user_agent)) {
|
|
| 13 | + $user_agent = Request::getServer('HTTP_USER_AGENT');
|
|
| 14 | + } |
|
| 14 | 15 | $this->user_agent = $user_agent; |
| 15 | 16 | } |
| 16 | 17 | |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | public function setSize($size) |
| 54 | 54 | {
|
| 55 | - if($this->get_version() > 1) |
|
| 55 | + if ($this->get_version() > 1) |
|
| 56 | 56 | $position = strrpos($this->file, '-v'); |
| 57 | 57 | else |
| 58 | 58 | $position = strrpos($this->file, '.'); |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | |
| 63 | 63 | public function getDimensions() |
| 64 | 64 | {
|
| 65 | - if(!$this->isValid()) |
|
| 65 | + if (!$this->isValid()) |
|
| 66 | 66 | return false; |
| 67 | 67 | $imageinfo = getimagesize($this->getInternalPath()); |
| 68 | 68 | return array($imageinfo[0], $imageinfo[1]); |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | |
| 86 | 86 | private function get_image($image) |
| 87 | 87 | {
|
| 88 | - if(preg_match(self::$VERSION_PREG_MATCH, $image)) |
|
| 88 | + if (preg_match(self::$VERSION_PREG_MATCH, $image)) |
|
| 89 | 89 | return preg_replace(self::$VERSION_PREG_MATCH, '', $image); |
| 90 | 90 | else |
| 91 | 91 | return $image; |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | |
| 100 | 100 | private function get_file($image) |
| 101 | 101 | {
|
| 102 | - if($this->get_version() > 1) |
|
| 102 | + if ($this->get_version() > 1) |
|
| 103 | 103 | {
|
| 104 | 104 | $position = strrpos($image, '.'); |
| 105 | 105 | return substr($image, 0, $position) . '-v' . $this->get_version() . substr($image, $position); |
@@ -111,14 +111,14 @@ discard block |
||
| 111 | 111 | private $version; |
| 112 | 112 | private function get_version() |
| 113 | 113 | {
|
| 114 | - if(!$this->version) |
|
| 114 | + if (!$this->version) |
|
| 115 | 115 | {
|
| 116 | - $path = Loader::getRoot() .'/images/' . substr($this->image, 0, strrpos($this->image, '.')) . '*'; |
|
| 116 | + $path = Loader::getRoot() . '/images/' . substr($this->image, 0, strrpos($this->image, '.')) . '*'; |
|
| 117 | 117 | $files = glob($path); |
| 118 | - if(count($files) > 0) |
|
| 118 | + if (count($files) > 0) |
|
| 119 | 119 | {
|
| 120 | 120 | preg_match(self::$VERSION_PREG_MATCH, $files[0], $matches); |
| 121 | - if(count($matches)) |
|
| 121 | + if (count($matches)) |
|
| 122 | 122 | $this->version = $matches[1]; |
| 123 | 123 | else |
| 124 | 124 | $this->version = 1; |
@@ -52,18 +52,20 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | public function setSize($size) |
| 54 | 54 | {
|
| 55 | - if($this->get_version() > 1) |
|
| 56 | - $position = strrpos($this->file, '-v'); |
|
| 57 | - else |
|
| 58 | - $position = strrpos($this->file, '.'); |
|
| 55 | + if($this->get_version() > 1) {
|
|
| 56 | + $position = strrpos($this->file, '-v'); |
|
| 57 | + } else {
|
|
| 58 | + $position = strrpos($this->file, '.'); |
|
| 59 | + } |
|
| 59 | 60 | |
| 60 | 61 | $this->file = substr($this->file, 0, $position) . '-s' . $size . substr($this->file, $position); |
| 61 | 62 | } |
| 62 | 63 | |
| 63 | 64 | public function getDimensions() |
| 64 | 65 | {
|
| 65 | - if(!$this->isValid()) |
|
| 66 | - return false; |
|
| 66 | + if(!$this->isValid()) {
|
|
| 67 | + return false; |
|
| 68 | + } |
|
| 67 | 69 | $imageinfo = getimagesize($this->getInternalPath()); |
| 68 | 70 | return array($imageinfo[0], $imageinfo[1]); |
| 69 | 71 | } |
@@ -85,10 +87,11 @@ discard block |
||
| 85 | 87 | |
| 86 | 88 | private function get_image($image) |
| 87 | 89 | {
|
| 88 | - if(preg_match(self::$VERSION_PREG_MATCH, $image)) |
|
| 89 | - return preg_replace(self::$VERSION_PREG_MATCH, '', $image); |
|
| 90 | - else |
|
| 91 | - return $image; |
|
| 90 | + if(preg_match(self::$VERSION_PREG_MATCH, $image)) {
|
|
| 91 | + return preg_replace(self::$VERSION_PREG_MATCH, '', $image); |
|
| 92 | + } else {
|
|
| 93 | + return $image; |
|
| 94 | + } |
|
| 92 | 95 | } |
| 93 | 96 | |
| 94 | 97 | private function get_image_meta($image) |
@@ -103,9 +106,9 @@ discard block |
||
| 103 | 106 | {
|
| 104 | 107 | $position = strrpos($image, '.'); |
| 105 | 108 | return substr($image, 0, $position) . '-v' . $this->get_version() . substr($image, $position); |
| 109 | + } else {
|
|
| 110 | + return $image; |
|
| 106 | 111 | } |
| 107 | - else |
|
| 108 | - return $image; |
|
| 109 | 112 | } |
| 110 | 113 | |
| 111 | 114 | private $version; |
@@ -118,10 +121,11 @@ discard block |
||
| 118 | 121 | if(count($files) > 0) |
| 119 | 122 | {
|
| 120 | 123 | preg_match(self::$VERSION_PREG_MATCH, $files[0], $matches); |
| 121 | - if(count($matches)) |
|
| 122 | - $this->version = $matches[1]; |
|
| 123 | - else |
|
| 124 | - $this->version = 1; |
|
| 124 | + if(count($matches)) {
|
|
| 125 | + $this->version = $matches[1]; |
|
| 126 | + } else {
|
|
| 127 | + $this->version = 1; |
|
| 128 | + } |
|
| 125 | 129 | } |
| 126 | 130 | } |
| 127 | 131 | return $this->version; |
@@ -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)); |
@@ -42,8 +42,9 @@ discard block |
||
| 42 | 42 | foreach($this->result as $row) |
| 43 | 43 | {
|
| 44 | 44 | $weight = $this->get_search_weight($row); |
| 45 | - if($weight > 0) |
|
| 46 | - $weighted_array[$row->id] = $weight; |
|
| 45 | + if($weight > 0) {
|
|
| 46 | + $weighted_array[$row->id] = $weight; |
|
| 47 | + } |
|
| 47 | 48 | } |
| 48 | 49 | arsort($weighted_array); |
| 49 | 50 | |
@@ -52,8 +53,9 @@ discard block |
||
| 52 | 53 | {
|
| 53 | 54 | foreach($this->result as $row) |
| 54 | 55 | {
|
| 55 | - if($row->id == $id) |
|
| 56 | - $final_array[] = $row; |
|
| 56 | + if($row->id == $id) {
|
|
| 57 | + $final_array[] = $row; |
|
| 58 | + } |
|
| 57 | 59 | } |
| 58 | 60 | } |
| 59 | 61 | return $final_array; |
@@ -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); |
@@ -26,8 +26,9 @@ discard block |
||
| 26 | 26 | |
| 27 | 27 | public static function instance() |
| 28 | 28 | {
|
| 29 | - if(!isset(self::$instance)) |
|
| 30 | - self::$instance = new Visitor(); |
|
| 29 | + if(!isset(self::$instance)) {
|
|
| 30 | + self::$instance = new Visitor(); |
|
| 31 | + } |
|
| 31 | 32 | return self::$instance; |
| 32 | 33 | } |
| 33 | 34 | |
@@ -35,8 +36,9 @@ discard block |
||
| 35 | 36 | public static function getBrowser() |
| 36 | 37 | {
|
| 37 | 38 | Loader::load('utility', 'environment/BrowserEnvironment');
|
| 38 | - if(!isset(self::instance()->browser)) |
|
| 39 | - self::instance()->browser = new BrowserEnvironment(); |
|
| 39 | + if(!isset(self::instance()->browser)) {
|
|
| 40 | + self::instance()->browser = new BrowserEnvironment(); |
|
| 41 | + } |
|
| 40 | 42 | return self::instance()->browser; |
| 41 | 43 | } |
| 42 | 44 | |
@@ -44,8 +46,9 @@ discard block |
||
| 44 | 46 | public static function getPlatform() |
| 45 | 47 | {
|
| 46 | 48 | Loader::load('utility', 'environment/PlatformEnvironment');
|
| 47 | - if(!isset(self::instance()->platform)) |
|
| 48 | - self::instance()->platform = new PlatformEnvironment(); |
|
| 49 | + if(!isset(self::instance()->platform)) {
|
|
| 50 | + self::instance()->platform = new PlatformEnvironment(); |
|
| 51 | + } |
|
| 49 | 52 | return self::instance()->platform; |
| 50 | 53 | } |
| 51 | 54 | |
@@ -53,8 +56,9 @@ discard block |
||
| 53 | 56 | public static function getIP() |
| 54 | 57 | {
|
| 55 | 58 | Loader::load('utility', 'Request');
|
| 56 | - if(!isset(self::instance()->ip_address)) |
|
| 57 | - self::instance()->ip_address = Request::getServer('REMOTE_ADDR');
|
|
| 59 | + if(!isset(self::instance()->ip_address)) {
|
|
| 60 | + self::instance()->ip_address = Request::getServer('REMOTE_ADDR');
|
|
| 61 | + } |
|
| 58 | 62 | return self::instance()->ip_address; |
| 59 | 63 | } |
| 60 | 64 | |
@@ -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 | } |
@@ -11,8 +11,9 @@ discard block |
||
| 11 | 11 | $is_acceptable = true; |
| 12 | 12 | foreach($this->getUnacceptableWords() as $unacceptableWord) |
| 13 | 13 | {
|
| 14 | - if(stristr($unacceptableWord->word, $this->content)) |
|
| 15 | - $is_acceptable = false; |
|
| 14 | + if(stristr($unacceptableWord->word, $this->content)) {
|
|
| 15 | + $is_acceptable = false; |
|
| 16 | + } |
|
| 16 | 17 | } |
| 17 | 18 | return $is_acceptable; |
| 18 | 19 | } |
@@ -20,8 +21,9 @@ discard block |
||
| 20 | 21 | private $unacceptableWords; |
| 21 | 22 | private function getUnacceptableWords() |
| 22 | 23 | {
|
| 23 | - if(!$this->unacceptableWords) |
|
| 24 | - $this->unacceptableWords = UnacceptableWordCollector::getWords(); |
|
| 24 | + if(!$this->unacceptableWords) {
|
|
| 25 | + $this->unacceptableWords = UnacceptableWordCollector::getWords(); |
|
| 26 | + } |
|
| 25 | 27 | return $this->unacceptableWords; |
| 26 | 28 | } |
| 27 | 29 | |
@@ -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,8 +10,9 @@ discard block |
||
| 10 | 10 | |
| 11 | 11 | protected function execute() |
| 12 | 12 | {
|
| 13 | - if(stristr($this->content, '#') === false) |
|
| 14 | - return; |
|
| 13 | + if(stristr($this->content, '#') === false) {
|
|
| 14 | + return; |
|
| 15 | + } |
|
| 15 | 16 | |
| 16 | 17 | // yeah yeah, i'm currently ignoring the link, whatevs |
| 17 | 18 | $parameters = func_get_args(); |
@@ -23,8 +24,9 @@ discard block |
||
| 23 | 24 | $parameters = array_shift($parameters); |
| 24 | 25 | |
| 25 | 26 | $found_hash = preg_match_all(self::$HASH_PATTERN, $this->content, $matches, PREG_SET_ORDER); |
| 26 | - if($found_hash === false || $found_hash === 0) |
|
| 27 | - return; |
|
| 27 | + if($found_hash === false || $found_hash === 0) {
|
|
| 28 | + return; |
|
| 29 | + } |
|
| 28 | 30 | |
| 29 | 31 | foreach($matches as $match) |
| 30 | 32 | {
|