当前位置: 首页>>代码示例>>PHP>>正文


PHP Workflow::removeConfig方法代码示例

本文整理汇总了PHP中Workflow::removeConfig方法的典型用法代码示例。如果您正苦于以下问题:PHP Workflow::removeConfig方法的具体用法?PHP Workflow::removeConfig怎么用?PHP Workflow::removeConfig使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Workflow的用法示例。


在下文中一共展示了Workflow::removeConfig方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: addLoginCommands

 private static function addLoginCommands()
 {
     Workflow::removeConfig('access_token');
     $token = null;
     if (count(self::$parts) > 1 && self::$parts[0] == '>' && self::$parts[1] == 'login' && isset(self::$parts[2])) {
         $token = self::$parts[2];
     }
     if (!$token) {
         Workflow::addItem(Item::create()->prefix('gh ')->title('> login')->subtitle('Generate OAuth access token')->arg('> login')->randomUid(), false);
     }
     Workflow::addItem(Item::create()->prefix('gh ')->title('> login ' . $token)->subtitle('Save OAuth access token')->arg('> login ' . $token)->valid((bool) $token, '<access_token>')->randomUid(), false);
 }
开发者ID:regedor,项目名称:alfred-github-workflow,代码行数:12,代码来源:search.php

示例2: ltrim

<?php

require 'workflow.php';
$query = ltrim($argv[1]);
$parts = explode(' ', $query);
Workflow::init($query);
if (Workflow::checkUpdate()) {
    $cmds = array('update' => 'There is an update for this Alfred workflow', 'deactivate autoupdate' => 'Deactivate auto updating this Alfred Workflow');
    foreach ($cmds as $cmd => $desc) {
        Workflow::addItem(Item::create()->prefix('gh ')->title('> ' . $cmd)->subtitle($desc)->arg('> ' . str_replace(' ', '-', $cmd))->randomUid(), false);
    }
    print Workflow::getItemsAsXml();
    exit;
}
if (!Workflow::getConfig('user') || !($users = Workflow::requestCacheJson('https://github.com/command_bar/users', 'results')) && !Workflow::requestCache('https://github.com/settings/profile')) {
    Workflow::removeConfig('user');
    $user = null;
    if (count($parts) > 1 && $parts[0] == '>' && $parts[1] == 'login' && isset($parts[2])) {
        $user = $parts[2];
    }
    Workflow::addItem(Item::create()->prefix('gh ')->title('> login ' . $user)->subtitle('Log in to GitHub')->arg('> login ' . $user)->valid((bool) $user, '<user>'));
    print Workflow::getItemsAsXml();
    return;
}
$isSystem = isset($query[0]) && $query[0] == '>';
$isMy = 'my' == $parts[0] && isset($parts[1]);
$isUser = isset($query[0]) && $query[0] == '@';
$isRepo = false;
$queryUser = null;
if ($isUser) {
    $queryUser = ltrim($parts[0], '@');
开发者ID:jesseflorig,项目名称:config,代码行数:31,代码来源:search.php

示例3: strpos

    return;
}
$enterprise = 0 === strpos($query, 'e ');
if ($enterprise) {
    $query = substr($query, 2);
}
$parts = explode(' ', $query);
Workflow::init($enterprise);
switch ($parts[1]) {
    case 'enterprise-url':
        Workflow::setConfig('enterprise_url', rtrim($parts[2], '/'));
        exec('osascript -e "tell application \\"Alfred 2\\" to search \\"ghe \\""');
        break;
    case 'enterprise-reset':
        Workflow::removeConfig('enterprise_url');
        Workflow::removeConfig('enterprise_access_token');
        Workflow::deleteCache();
        break;
    case 'login':
        if (isset($parts[2]) && $parts[2]) {
            Workflow::setAccessToken($parts[2]);
            echo 'Successfully logged in';
        } elseif (!$enterprise) {
            Workflow::startServer();
            $state = version_compare(PHP_VERSION, '5.4', '<') ? 'm' : '';
            $url = Workflow::getBaseUrl() . '/login/oauth/authorize?client_id=2d4f43826cb68e11c17c&scope=repo&state=' . $state;
            exec('open ' . escapeshellarg($url));
        }
        break;
    case 'logout':
        Workflow::removeAccessToken();
开发者ID:njql007,项目名称:alfred-github-workflow,代码行数:31,代码来源:action.php

示例4: trim

$query = trim($argv[1]);
$parts = explode(' ', $query);
switch ($parts[0]) {
    case '>':
        switch ($parts[1]) {
            case 'login':
                if (isset($parts[2]) && $parts[2]) {
                    Workflow::setConfig('access_token', $parts[2]);
                    echo 'Successfully logged in';
                } else {
                    Workflow::startServer();
                    exec('open "https://github.com/login/oauth/authorize?client_id=2d4f43826cb68e11c17c&scope=repo&state=' . version_compare(PHP_VERSION, '5.4', '<') . '"');
                }
                break;
            case 'logout':
                Workflow::removeConfig('access_token');
                Workflow::deleteCache();
                echo 'Successfully logged out';
                break;
            case 'delete-cache':
                Workflow::deleteCache();
                echo 'Successfully deleted cache';
                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;
开发者ID:regedor,项目名称:alfred-github-workflow,代码行数:31,代码来源:action.php


注:本文中的Workflow::removeConfig方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。