Skip to content

Commit

Permalink
chore: quick save
Browse files Browse the repository at this point in the history
  • Loading branch information
filisko committed Jul 14, 2022
1 parent 90ddb40 commit 21efbb1
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 108 deletions.
24 changes: 0 additions & 24 deletions gump.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1942,28 +1942,4 @@ protected function validate_valid_array_size_equal($field, array $input, array $
{
return !(!is_array($input[$field]) || count($input[$field]) != $params[0]);
}

/**
* Determine if the provided value is a valid Twitter account.
*
* @param string $field
* @param array $input
* @param array $params
* @param mixed $value
*
* @return bool
* @throws Exception if Twitter API has changed, in such case report on GitHub please.
*/
protected function validate_valid_twitter($field, array $input, array $params = [], $value = null)
{
$json = EnvHelpers::file_get_contents("http://twitter.com/users/username_available?username=".$input[$field]);

$result = json_decode($json);

if (!isset($result->reason)) {
throw new Exception('Twitter JSON response changed. Please report this on GitHub.');
}

return $result->reason === "taken";
}
}
11 changes: 1 addition & 10 deletions src/EnvHelpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,11 @@ public static function gethostbyname($hostname)
return gethostbyname($hostname);
}

/**
* @inheritDoc file_get_contents
*/
public static function file_get_contents(
$filename, $use_include_path = false, $context = null, $offset = 0, $maxlen = null
) {
return file_get_contents($filename, $use_include_path, $context, $offset, $maxlen);
}

/**
* @inheritDoc file_exists
*/
public static function file_exists($filename)
{
return file_exists($filename);
}
}
}
74 changes: 0 additions & 74 deletions tests/Validators/ValidTwitterValidatorTest.php

This file was deleted.

0 comments on commit 21efbb1

Please sign in to comment.