當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Workflow::request方法代碼示例

本文整理匯總了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;
}
開發者ID:njql007,項目名稱:alfred-github-workflow,代碼行數:31,代碼來源:action.php

示例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 . '\\""');
}
開發者ID:Frinstio,項目名稱:AlfredWorkflow.com,代碼行數:31,代碼來源:action.php

示例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;
 }
開發者ID:RStankov,項目名稱:config_files,代碼行數:31,代碼來源:action.php

示例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;
}
開發者ID:jessefurmanek,項目名稱:dotfiles,代碼行數:31,代碼來源:action.php


注:本文中的Workflow::request方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。