@@ -70,15 +70,15 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | $result = false; |
| 72 | 72 | |
| 73 | - $entity_guid = (int)$entity_guid; |
|
| 73 | + $entity_guid = (int) $entity_guid; |
|
| 74 | 74 | $value_type = detect_extender_valuetype($value, $value_type); |
| 75 | 75 | |
| 76 | - $owner_guid = (int)$owner_guid; |
|
| 76 | + $owner_guid = (int) $owner_guid; |
|
| 77 | 77 | if ($owner_guid == 0) { |
| 78 | 78 | $owner_guid = _elgg_services()->session->getLoggedInUserGuid(); |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - $access_id = (int)$access_id; |
|
| 81 | + $access_id = (int) $access_id; |
|
| 82 | 82 | $time = time(); |
| 83 | 83 | |
| 84 | 84 | $value_id = elgg_get_metastring_id($value); |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | function update($annotation_id, $name, $value, $value_type, $owner_guid, $access_id) { |
| 131 | 131 | |
| 132 | 132 | |
| 133 | - $annotation_id = (int)$annotation_id; |
|
| 133 | + $annotation_id = (int) $annotation_id; |
|
| 134 | 134 | |
| 135 | 135 | $annotation = elgg_get_annotation_from_id($annotation_id); |
| 136 | 136 | if (!$annotation) { |
@@ -143,12 +143,12 @@ discard block |
||
| 143 | 143 | $name = trim($name); |
| 144 | 144 | $value_type = detect_extender_valuetype($value, $value_type); |
| 145 | 145 | |
| 146 | - $owner_guid = (int)$owner_guid; |
|
| 146 | + $owner_guid = (int) $owner_guid; |
|
| 147 | 147 | if ($owner_guid == 0) { |
| 148 | 148 | $owner_guid = _elgg_services()->session->getLoggedInUserGuid(); |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | - $access_id = (int)$access_id; |
|
| 151 | + $access_id = (int) $access_id; |
|
| 152 | 152 | |
| 153 | 153 | $value_id = elgg_get_metastring_id($value); |
| 154 | 154 | if (!$value_id) { |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | function getRow($id) { |
| 54 | 54 | |
| 55 | 55 | |
| 56 | - $id = (int)$id; |
|
| 56 | + $id = (int) $id; |
|
| 57 | 57 | |
| 58 | 58 | return _elgg_services()->db->getDataRow("SELECT * FROM {$this->CONFIG->dbprefix}entity_relationships WHERE id = $id"); |
| 59 | 59 | } |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | function delete($id) { |
| 69 | 69 | |
| 70 | 70 | |
| 71 | - $id = (int)$id; |
|
| 71 | + $id = (int) $id; |
|
| 72 | 72 | |
| 73 | 73 | $relationship = get_relationship($id); |
| 74 | 74 | |
@@ -99,9 +99,9 @@ discard block |
||
| 99 | 99 | throw new \InvalidArgumentException($msg); |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | - $guid_one = (int)$guid_one; |
|
| 102 | + $guid_one = (int) $guid_one; |
|
| 103 | 103 | $relationship = sanitise_string($relationship); |
| 104 | - $guid_two = (int)$guid_two; |
|
| 104 | + $guid_two = (int) $guid_two; |
|
| 105 | 105 | $time = time(); |
| 106 | 106 | |
| 107 | 107 | // Check for duplicates |
@@ -144,9 +144,9 @@ discard block |
||
| 144 | 144 | function check($guid_one, $relationship, $guid_two) { |
| 145 | 145 | |
| 146 | 146 | |
| 147 | - $guid_one = (int)$guid_one; |
|
| 147 | + $guid_one = (int) $guid_one; |
|
| 148 | 148 | $relationship = sanitise_string($relationship); |
| 149 | - $guid_two = (int)$guid_two; |
|
| 149 | + $guid_two = (int) $guid_two; |
|
| 150 | 150 | |
| 151 | 151 | $query = "SELECT * FROM {$this->CONFIG->dbprefix}entity_relationships |
| 152 | 152 | WHERE guid_one=$guid_one |
@@ -175,9 +175,9 @@ discard block |
||
| 175 | 175 | function remove($guid_one, $relationship, $guid_two) { |
| 176 | 176 | |
| 177 | 177 | |
| 178 | - $guid_one = (int)$guid_one; |
|
| 178 | + $guid_one = (int) $guid_one; |
|
| 179 | 179 | $relationship = sanitise_string($relationship); |
| 180 | - $guid_two = (int)$guid_two; |
|
| 180 | + $guid_two = (int) $guid_two; |
|
| 181 | 181 | |
| 182 | 182 | $obj = check_entity_relationship($guid_one, $relationship, $guid_two); |
| 183 | 183 | if ($obj == false) { |
@@ -194,7 +194,7 @@ discard block |
||
| 194 | 194 | AND relationship = '$relationship' |
| 195 | 195 | AND guid_two = $guid_two"; |
| 196 | 196 | |
| 197 | - return (bool)_elgg_services()->db->deleteData($query); |
|
| 197 | + return (bool) _elgg_services()->db->deleteData($query); |
|
| 198 | 198 | } else { |
| 199 | 199 | return false; |
| 200 | 200 | } |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | function getAll($guid, $inverse_relationship = false) { |
| 261 | 261 | |
| 262 | 262 | |
| 263 | - $guid = (int)$guid; |
|
| 263 | + $guid = (int) $guid; |
|
| 264 | 264 | |
| 265 | 265 | $where = ($inverse_relationship ? "guid_two='$guid'" : "guid_one='$guid'"); |
| 266 | 266 | |
@@ -81,7 +81,7 @@ |
||
| 81 | 81 | $this->send403(); |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | - $cache_timestamp = (int)_elgg_services()->config->get('lastcache'); |
|
| 84 | + $cache_timestamp = (int) _elgg_services()->config->get('lastcache'); |
|
| 85 | 85 | |
| 86 | 86 | if ($cache_timestamp == $ts) { |
| 87 | 87 | $this->sendCacheHeaders($etag); |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | $timeout = 2; |
| 220 | 220 | } |
| 221 | 221 | $hour = 60 * 60; |
| 222 | - return (int)((float)$timeout * $hour); |
|
| 222 | + return (int) ((float) $timeout * $hour); |
|
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | /** |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | $token = get_input('__elgg_token'); |
| 236 | - $ts = (int)get_input('__elgg_ts'); |
|
| 236 | + $ts = (int) get_input('__elgg_ts'); |
|
| 237 | 237 | if ($token && $this->validateTokenTimestamp($ts)) { |
| 238 | 238 | // The tokens are present and the time looks valid: this is probably a mismatch due to the |
| 239 | 239 | // login form being on a different domain. |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | } |
| 288 | 288 | } |
| 289 | 289 | |
| 290 | - return _elgg_services()->crypto->getHmac([(int)$timestamp, $session_token], 'md5') |
|
| 290 | + return _elgg_services()->crypto->getHmac([(int) $timestamp, $session_token], 'md5') |
|
| 291 | 291 | ->getToken(); |
| 292 | 292 | } |
| 293 | 293 | |
@@ -290,7 +290,7 @@ |
||
| 290 | 290 | * @return void |
| 291 | 291 | */ |
| 292 | 292 | public function setMaxLineLength($len) { |
| 293 | - $this->maxLineLength = (int)$len; |
|
| 293 | + $this->maxLineLength = (int) $len; |
|
| 294 | 294 | } |
| 295 | 295 | |
| 296 | 296 | /** |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | */ |
| 14 | 14 | protected function createRandomAnnotations($entity, $max = 1) { |
| 15 | 15 | $annotations = array(); |
| 16 | - for ($i=0; $i<$max; $i++) { |
|
| 16 | + for ($i = 0; $i < $max; $i++) { |
|
| 17 | 17 | $name = 'test_annotation_name_' . rand(); |
| 18 | 18 | $value = rand(); |
| 19 | 19 | $id = create_annotation($entity->getGUID(), $name, $value, 'integer', $entity->getGUID()); |
@@ -503,13 +503,13 @@ discard block |
||
| 503 | 503 | $a_e_map = array(); |
| 504 | 504 | |
| 505 | 505 | // create test annotations on a few entities. |
| 506 | - for ($i=0; $i<3; $i++) { |
|
| 506 | + for ($i = 0; $i < 3; $i++) { |
|
| 507 | 507 | do { |
| 508 | 508 | $e = $this->entities[array_rand($this->entities)]; |
| 509 | - } while(in_array($e->guid, $a_e_map)); |
|
| 509 | + } while (in_array($e->guid, $a_e_map)); |
|
| 510 | 510 | $annotations = $this->createRandomAnnotations($e); |
| 511 | 511 | |
| 512 | - foreach($annotations as $a) { |
|
| 512 | + foreach ($annotations as $a) { |
|
| 513 | 513 | $options['annotation_names'][] = $a->name; |
| 514 | 514 | $a_e_map[$a->id] = $e->guid; |
| 515 | 515 | } |
@@ -529,13 +529,13 @@ discard block |
||
| 529 | 529 | $a_e_map = array(); |
| 530 | 530 | |
| 531 | 531 | // create test annotations on a few entities. |
| 532 | - for ($i=0; $i<3; $i++) { |
|
| 532 | + for ($i = 0; $i < 3; $i++) { |
|
| 533 | 533 | do { |
| 534 | 534 | $e = $this->entities[array_rand($this->entities)]; |
| 535 | - } while(in_array($e->guid, $a_e_map)); |
|
| 535 | + } while (in_array($e->guid, $a_e_map)); |
|
| 536 | 536 | $annotations = $this->createRandomAnnotations($e); |
| 537 | 537 | |
| 538 | - foreach($annotations as $a) { |
|
| 538 | + foreach ($annotations as $a) { |
|
| 539 | 539 | $options['annotation_values'][] = $a->value; |
| 540 | 540 | $a_e_map[$a->id] = $e->guid; |
| 541 | 541 | } |
@@ -555,16 +555,16 @@ discard block |
||
| 555 | 555 | $a_e_map = array(); |
| 556 | 556 | |
| 557 | 557 | // create test annotations on a single entity |
| 558 | - for ($i=0; $i<3; $i++) { |
|
| 558 | + for ($i = 0; $i < 3; $i++) { |
|
| 559 | 559 | do { |
| 560 | 560 | $e = $this->entities[array_rand($this->entities)]; |
| 561 | - } while(in_array($e->guid, $a_e_map)); |
|
| 561 | + } while (in_array($e->guid, $a_e_map)); |
|
| 562 | 562 | |
| 563 | 563 | // remove annotations left over from previous tests. |
| 564 | 564 | elgg_delete_annotations(array('annotation_owner_guid' => $e->guid)); |
| 565 | 565 | $annotations = $this->createRandomAnnotations($e); |
| 566 | 566 | |
| 567 | - foreach($annotations as $a) { |
|
| 567 | + foreach ($annotations as $a) { |
|
| 568 | 568 | $options['annotation_owner_guids'][] = $e->guid; |
| 569 | 569 | $a_e_map[$a->id] = $e->guid; |
| 570 | 570 | } |
@@ -282,8 +282,8 @@ |
||
| 282 | 282 | // the page's session_token might have expired (not matching __elgg_session in the session), but |
| 283 | 283 | // we still allow it to be given to validate the tokens in the page. |
| 284 | 284 | $session_token = get_input('session_token', null, false); |
| 285 | - $pairs = (array)get_input('pairs', array(), false); |
|
| 286 | - $valid_tokens = (object)array(); |
|
| 285 | + $pairs = (array) get_input('pairs', array(), false); |
|
| 286 | + $valid_tokens = (object) array(); |
|
| 287 | 287 | foreach ($pairs as $pair) { |
| 288 | 288 | list($ts, $token) = explode(',', $pair, 2); |
| 289 | 289 | if ($actions->validateTokenOwnership($token, $ts, $session_token)) { |
@@ -212,8 +212,8 @@ |
||
| 212 | 212 | $q = str_replace(array('_', '%'), array('\_', '\%'), $q); |
| 213 | 213 | |
| 214 | 214 | // for the group members search: group guid - should be numeric |
| 215 | - if (!$g = get_input('term', get_input('g'))){ |
|
| 216 | - $g=0; |
|
| 215 | + if (!$g = get_input('term', get_input('g'))) { |
|
| 216 | + $g = 0; |
|
| 217 | 217 | } |
| 218 | 218 | else { |
| 219 | 219 | $g = sanitise_string($g); |
@@ -214,8 +214,7 @@ |
||
| 214 | 214 | // for the group members search: group guid - should be numeric |
| 215 | 215 | if (!$g = get_input('term', get_input('g'))){ |
| 216 | 216 | $g=0; |
| 217 | - } |
|
| 218 | - else { |
|
| 217 | + } else { |
|
| 219 | 218 | $g = sanitise_string($g); |
| 220 | 219 | |
| 221 | 220 | // replace mysql vars with escaped strings |
@@ -357,9 +357,9 @@ discard block |
||
| 357 | 357 | |
| 358 | 358 | // Sanitise |
| 359 | 359 | if (!is_array($to)) { |
| 360 | - $to = array((int)$to); |
|
| 360 | + $to = array((int) $to); |
|
| 361 | 361 | } |
| 362 | - $from = (int)$from; |
|
| 362 | + $from = (int) $from; |
|
| 363 | 363 | //$subject = sanitise_string($subject); |
| 364 | 364 | |
| 365 | 365 | // Get notification methods |
@@ -476,9 +476,9 @@ discard block |
||
| 476 | 476 | function notify_user($to, $from, $subject, $message, array $params = array(), $methods_override = "") { |
| 477 | 477 | |
| 478 | 478 | if (!is_array($to)) { |
| 479 | - $to = array((int)$to); |
|
| 479 | + $to = array((int) $to); |
|
| 480 | 480 | } |
| 481 | - $from = (int)$from; |
|
| 481 | + $from = (int) $from; |
|
| 482 | 482 | $from = get_entity($from) ? $from : elgg_get_site_entity()->guid; |
| 483 | 483 | $sender = get_entity($from); |
| 484 | 484 | $summary = elgg_extract('summary', $params, ''); |
@@ -511,7 +511,7 @@ discard block |
||
| 511 | 511 | // Are we overriding delivery? |
| 512 | 512 | $methods = $methods_override; |
| 513 | 513 | if (!$methods) { |
| 514 | - $tmp = (array)get_user_notification_settings($guid); |
|
| 514 | + $tmp = (array) get_user_notification_settings($guid); |
|
| 515 | 515 | $methods = array(); |
| 516 | 516 | foreach ($tmp as $k => $v) { |
| 517 | 517 | // Add method if method is turned on for user! |
@@ -559,7 +559,7 @@ discard block |
||
| 559 | 559 | * @return \stdClass|false |
| 560 | 560 | */ |
| 561 | 561 | function get_user_notification_settings($user_guid = 0) { |
| 562 | - $user_guid = (int)$user_guid; |
|
| 562 | + $user_guid = (int) $user_guid; |
|
| 563 | 563 | |
| 564 | 564 | if ($user_guid == 0) { |
| 565 | 565 | $user_guid = elgg_get_logged_in_user_guid(); |
@@ -600,7 +600,7 @@ discard block |
||
| 600 | 600 | * @return bool |
| 601 | 601 | */ |
| 602 | 602 | function set_user_notification_setting($user_guid, $method, $value) { |
| 603 | - $user_guid = (int)$user_guid; |
|
| 603 | + $user_guid = (int) $user_guid; |
|
| 604 | 604 | $method = sanitise_string($method); |
| 605 | 605 | |
| 606 | 606 | $user = get_entity($user_guid); |