本文整理汇总了PHP中Workflow::request方法的典型用法代码示例。如果您正苦于以下问题:PHP Workflow::request方法的具体用法?PHP Workflow::request怎么用?PHP Workflow::request使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Workflow
的用法示例。
在下文中一共展示了Workflow::request方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Curl
break;
case 'refresh-cache':
$curl = new Curl();
foreach (explode(',', $parts[2]) as $url) {
Workflow::requestCache($url, $curl, null, 0, false);
}
$curl->execute();
Workflow::cleanCache();
break;
case 'activate-autoupdate':
Workflow::setConfig('autoupdate', 1);
echo 'Activated auto updating';
break;
case 'deactivate-autoupdate':
Workflow::setConfig('autoupdate', 0);
echo 'Deactivated auto updating';
break;
case 'update':
$response = Workflow::request('http://gh01.de/alfred/github/github.alfredworkflow');
if (!$response) {
echo 'Update failed';
exit;
}
$zip = __DIR__ . '/workflow.zip';
file_put_contents($zip, $response);
exec('unzip -o workflow.zip');
unlink($zip);
Workflow::deleteCache();
echo 'Successfully updated the GitHub Workflow';
break;
}
示例2: file_put_contents
$zip = __DIR__ . '/workflow.zip';
file_put_contents($zip, $c);
$phar = new PharData($zip);
foreach ($phar as $path => $file) {
copy($path, __DIR__ . '/' . $file->getFilename());
}
unlink($zip);
Workflow::deleteCache();
echo 'Successfully updated the GitHub Workflow';
break;
}
break;
case 'follow':
$c = Workflow::request('https://github.com/command_bar/' . $parts[1] . '/follow', $status, $etag, true, Workflow::getToken());
echo $c == 'true' ? 'You are now following ' . $parts[1] : 'Failed to follow ' . $parts[1];
break;
case 'unfollow':
$c = Workflow::request('https://github.com/command_bar/' . $parts[1] . '/unfollow', $status, $etag, true, Workflow::getToken());
echo $c == 'true' ? 'You are no longer following ' . $parts[1] : 'Failed to unfollow ' . $parts[1];
break;
case 'watch':
$c = Workflow::request('https://github.com/command_bar/' . $parts[1] . '/watch', $status, $etag, true, Workflow::getToken());
echo $c == 'true' ? 'You are now watching ' . $parts[1] : 'Failed to watch ' . $parts[1];
break;
case 'unwatch':
$c = Workflow::request('https://github.com/command_bar/' . $parts[1] . '/unwatch', $status, $etag, true, Workflow::getToken());
echo $c == 'true' ? 'You are no longer watching ' . $parts[1] : 'Failed to unwatch ' . $parts[1];
break;
default:
exec('osascript -e "open location \\"' . $query . '\\""');
}
示例3: PharData
echo 'Successfully logged out';
break;
case 'delete-cache':
Workflow::deleteCache();
echo 'Successfully deleted cache';
break;
case 'activate-autoupdate':
Workflow::setConfig('autoupdate', true);
echo 'Activated auto updating';
break;
case 'deactivate-autoupdate':
Workflow::setConfig('autoupdate', false);
echo 'Deactivated auto updating';
break;
case 'update':
$c = Workflow::request('http://gh01.de/alfred/github/github.alfredworkflow', $status);
if ($status != 200) {
echo 'Update failed';
exit;
}
$zip = __DIR__ . '/workflow.zip';
file_put_contents($zip, $c);
$phar = new PharData($zip);
foreach ($phar as $path => $file) {
copy($path, __DIR__ . '/' . $file->getFilename());
}
unlink($zip);
Workflow::deleteCache();
echo 'Successfully updated the GitHub Workflow';
break;
}
示例4: Curl
$curl = new Curl();
foreach (explode(',', $parts[2]) as $url) {
Workflow::requestCache($url, $curl, null, 0, false);
}
$curl->execute();
Workflow::cleanCache();
break;
case 'activate-autoupdate':
Workflow::setConfig('autoupdate', 1);
echo 'Activated auto updating';
break;
case 'deactivate-autoupdate':
Workflow::setConfig('autoupdate', 0);
echo 'Deactivated auto updating';
break;
case 'update':
$release = json_decode(Workflow::request('https://api.github.com/repos/gharlan/alfred-github-workflow/releases/latest'));
if (!isset($release->assets[0]->browser_download_url)) {
echo 'Update failed';
exit;
}
$response = Workflow::request($release->assets[0]->browser_download_url, null, null, false);
if (!$response) {
echo 'Update failed';
exit;
}
$path = getenv('alfred_workflow_data') . '/github.alfredworkflow';
file_put_contents($path, $response);
exec('open ' . escapeshellarg($path));
break;
}