/** * @preserveGlobalState disabled * @runInSeparateProcess */ public function test_curl_result() { $api = new Hm_API_Curl(); $this->assertEquals(array('unit' => 'test'), $api->command('asdf', array(), array('foo' => 'bar'))); Hm_Functions::$exec_res = NULL; $this->assertEquals(array(), $api->command('asdf', array(), array('foo' => 'bar'))); }
/** * @subpackage wordpress/functions */ function wp_fetch_content($details, $url, $post = array()) { if (!is_array($details) || empty($details) || !array_key_exists('access_token', $details)) { return array(); } $api = new Hm_API_Curl(); return $api->command($url, array('Authorization: Bearer ' . $details['access_token']), $post); }
public function process() { list($success, $form) = $this->process_form(array('github_repo')); if ($success) { $login_time = $this->session->get('login_time', false); if ($login_time) { $this->out('login_time', $login_time); } if (array_key_exists('list_path', $this->request->get)) { if (in_array($this->request->get['list_path'], array('combined_inbox', 'unread'), true)) { $this->out('list_parent', $this->request->get['list_path']); } } Hm_Github_Uid_Cache::load($this->session->get('github_read_uids', array())); $details = $this->user_config->get('github_connect_details'); $repos = $this->user_config->get('github_repos'); if (in_array($form['github_repo'], $repos, true) && $details) { $url = sprintf('https://api.github.com/repos/%s/events?page=1&per_page=25', $form['github_repo']); $api = new Hm_API_Curl(); $this->out('github_data', $api->command($url, array('Authorization: token ' . $details['access_token']))); $this->out('github_data_source', $form['github_repo']); $this->out('github_data_source_id', array_search($form['github_repo'], $repos, true)); } if (array_key_exists('list_path', $this->request->get)) { if ($this->request->get['list_path'] == 'unread') { $this->out('github_list_since', process_since_argument($this->user_config->get('unread_since_setting', DEFAULT_SINCE))); } $this->out('list_path', $this->request->get['list_path'], false); } else { $this->out('list_path', false, false); } if (array_key_exists('github_unread', $this->request->post) && $this->request->post['github_unread']) { $this->out('github_unread', true); } } }