public function __construct($user = null, $pass = null) { if ($user == null) { $user = get_config('qtype_coderunner', 'ideone_user'); } if ($pass == null) { $pass = get_config('qtype_coderunner', 'ideone_password'); } qtype_coderunner_sandbox::__construct($user, $pass); // A map from Ideone language names (regular expressions) to their // local short name, where appropriate $aliases = array('C99 strict.*' => 'c', '.*python *2\\.[789]\\.[0-9].*' => 'python2', 'Python 3.*python-3\\.*' => 'python3', 'Java.*sun-jdk.*' => 'java'); $this->client = $client = new SoapClient("http://ideone.com/api/1/service.wsdl"); $this->langmap = array(); // Construct a map from language name to id $response = $this->client->getLanguages($user, $pass); $this->langserror = $response['error']; if ($this->langserror == self::OK) { foreach ($response['languages'] as $id => $lang) { $this->langmap[$lang] = $id; foreach ($aliases as $pattern => $alias) { if (preg_match('/' . $pattern . '/', $lang)) { $this->langmap[$alias] = $id; } } } } else { $this->langmap = array(); } }
public function __construct() { qtype_coderunner_sandbox::__construct(); list($this->httpcode, $this->response) = $this->http_request('languages', self::HTTP_GET); if ($this->httpcode == 200 && is_array($this->response)) { $this->languages = array(); foreach ($this->response as $lang) { $this->languages[] = $lang[0]; } } else { $this->languages = array(); } }
public function __construct($user = null, $pass = null) { qtype_coderunner_sandbox::__construct($user, $pass); }