Exemplo n.º 1
0
function get_video_info($videoId)
{
    $apiKey = 'AIzaSyCcizuO4G6c5xGUVmY6zPkuGhxugkL_FOU';
    $snippet = api_request("https://www.googleapis.com/youtube/v3/videos?key={$apiKey}&part=snippet&id={$videoId}");
    $contentDetails = api_request("https://www.googleapis.com/youtube/v3/videos?key={$apiKey}&part=contentDetails&id={$videoId}");
    if ($snippet && $contentDetails) {
        $interval = new DateInterval($contentDetails->items['0']->contentDetails->duration);
        $result = ['preview' => $snippet->items['0']->snippet->thumbnails->standard->url, 'duration' => $interval->h * 3600 + $interval->i * 60 + $interval->s];
    } else {
        $result = false;
    }
    return $result;
}
Exemplo n.º 2
0
        $content = '?' . '>' . trim($content);
        eval($content);
    } else {
        $smarty->display('setting_content.php');
    }
} elseif ($step == 'done') {
    $content = api_request($apiget);
    if ($content) {
        //$content=str_replace('<'.'?php','<'.'?',$content);
        $content = '?' . '>' . trim($content);
        eval($content);
    } else {
        $smarty->display('done_content.php');
    }
} elseif ($step == 'active') {
    $content = api_request($apiget);
    if ($content) {
        //$content=str_replace('<'.'?php','<'.'?',$content);
        $content = '?' . '>' . trim($content);
        eval($content);
    } else {
        $smarty->display('active_content.php');
    }
}
function api_request($apiget)
{
    global $t, $ecs_charset;
    $api_comment = $t->request('http://cloud.ecshop.com/install_api.php', $apiget);
    $api_str = $api_comment['body'];
    include_once ROOT_PATH . 'includes/cls_json.php';
    $json = new JSON();
Exemplo n.º 3
0
function get_zone_keys($zone)
{
    $ret = array();
    foreach (api_request($zone['url'] . "/cryptokeys") as $key) {
        if (!isset($key['active'])) {
            continue;
        }
        $key['dstxt'] = $zone['name'] . ' IN DNSKEY ' . $key['dnskey'] . "\n\n";
        if (isset($key['ds'])) {
            foreach ($key['ds'] as $ds) {
                $key['dstxt'] .= $zone['name'] . ' IN DS ' . $ds . "\n";
            }
            unset($key['ds']);
        }
        $ret[] = $key;
    }
    return $ret;
}
Exemplo n.º 4
0
<?php

include '../../config.php';
include '../../functions.php';
/**
 * List all tickets including pagination and filtering.
 *
 * Response: JSON
 * Type: GET
 * URL: /tickets
 *
 * --
 *
 * GET Params:
 *
 * - page: Current page
 * - status: Filer ticket status (OPEN,ASSIGNED,CLOSED)
 * - date_from: Select tickets newer than created date (Y-m-d)
 * - date_until: Select tickets older than created date  (Y-m-d)
 */
$list = api_request($config['token'], $config['endpoint'] . 'tickets?page=1&status=ASSIGNED&date_from=2015-01-01&date_until=2016-01-01');
print_r($list);
Exemplo n.º 5
0
function get_forks($username, $repository)
{
    $request = api_request("repos/{$username}/{$repository}/forks");
    if ($request === false) {
        return false;
    }
    $usernames = array();
    foreach ($request as $fork) {
        $usernames[$fork->owner->login] = array('username' => $fork->owner->login, 'repository' => $fork->name);
    }
    return $usernames;
}
Exemplo n.º 6
0
function get_pull($username, $repository, $pull_id)
{
    $request = api_request("repos/{$username}/{$repository}/pulls/{$pull_id}");
    $pull = $request->pull;
    $pull_data = array('base' => array($pull->base->user->login, $pull->base->ref), 'head' => array($pull->head->user->login, $pull->head->ref), 'state' => $pull->state);
    return $pull_data;
}
function get_network($username, $repository)
{
	$request = api_request("repos/show/$username/$repository/network");
	if ($request === false)
	{
		return false;
	}

	$usernames = array();
	foreach ($request->network as $network)
	{
		$usernames[$network->owner] = array(
			'username'		=> $network->owner,
			'repository'	=> $network->name,
		);
	}

	return $usernames;
}