本文整理汇总了PHP中Workflow::query方法的典型用法代码示例。如果您正苦于以下问题:PHP Workflow::query方法的具体用法?PHP Workflow::query怎么用?PHP Workflow::query使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Workflow
的用法示例。
在下文中一共展示了Workflow::query方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public static function init($enterprise = false, $query = null)
{
date_default_timezone_set('UTC');
self::$enterprise = $enterprise;
self::$query = $query;
if (isset($_ENV['alfred_workflow_data'])) {
$dataDir = $_ENV['alfred_workflow_data'];
} else {
$dataDir = (isset($_ENV['HOME']) ? $_ENV['HOME'] : $_SERVER['HOME']) . '/Library/Application Support/Alfred 2/Workflow Data/' . self::BUNDLE;
$_ENV['alfred_workflow_data'] = $dataDir;
}
if (!is_dir($dataDir)) {
mkdir($dataDir);
}
self::$filePids = $dataDir . '/pid';
$fileDb = $dataDir . '/db.sqlite';
$exists = file_exists($fileDb);
self::$db = new PDO('sqlite:' . $fileDb, null, null);
if (!$exists) {
self::$db->exec('
CREATE TABLE config (
key TEXT PRIMARY KEY,
value TEXT
)
');
self::createRequestCacheTable();
}
if (self::$enterprise) {
self::$baseUrl = self::getConfig('enterprise_url');
self::$apiUrl = self::$baseUrl ? self::$baseUrl . '/api/v3' : null;
self::$gistUrl = self::$baseUrl ? self::$baseUrl . '/gist' : null;
}
register_shutdown_function(array(__CLASS__, 'shutdown'));
}
示例2: init
public static function init($enterprise = false, $query = null, $hotkey = false)
{
date_default_timezone_set('UTC');
self::$enterprise = $enterprise;
self::$query = ltrim($query);
self::$hotkey = $hotkey;
$dataDir = getenv('alfred_workflow_data');
if (!$dataDir) {
$dataDir = getenv('HOME') . '/Library/Application Support/Alfred 3/Workflow Data/' . self::BUNDLE;
putenv('alfred_workflow_data="' . $dataDir . '"');
}
if (!is_dir($dataDir)) {
mkdir($dataDir);
}
self::$filePids = $dataDir . '/pid';
$fileDb = $dataDir . '/db.sqlite';
$exists = file_exists($fileDb);
self::$db = new PDO('sqlite:' . $fileDb, null, null);
if (!$exists) {
self::$db->exec('
CREATE TABLE config (
key TEXT PRIMARY KEY,
value TEXT
)
');
self::createRequestCacheTable();
}
if (self::$enterprise) {
self::$baseUrl = self::getConfig('enterprise_url');
self::$apiUrl = self::$baseUrl ? self::$baseUrl . '/api/v3' : null;
self::$gistUrl = self::$baseUrl ? self::$baseUrl . '/gist' : null;
}
self::$debug = getenv('alfred_debug') && defined('STDERR');
register_shutdown_function(array(__CLASS__, 'shutdown'));
}
示例3: init
public static function init($query = null)
{
self::$query = $query;
$dataDir = $_SERVER['HOME'] . '/Library/Application Support/Alfred 2/Workflow Data/' . self::BUNDLE;
if (!is_dir($dataDir)) {
mkdir($dataDir);
}
self::$fileCookies = $dataDir . '/cookies';
$fileDb = $dataDir . '/db.sqlite';
$exists = file_exists($fileDb);
self::$db = new PDO('sqlite:' . $fileDb, null, null, array(PDO::ATTR_PERSISTENT => true));
if (!$exists) {
self::$db->exec('
CREATE TABLE config (
key TEXT PRIMARY KEY,
value TEXT
)
');
self::$db->exec('
CREATE TABLE request_cache (
url TEXT PRIMARY KEY,
timestamp INTEGER,
etag TEXT,
content TEXT,
refresh INTEGER
)
');
}
register_shutdown_function(array(__CLASS__, 'shutdown'));
}
示例4: init
public static function init($query = null)
{
self::$query = $query;
$dataDir = $_SERVER['HOME'] . '/Library/Application Support/Alfred 2/Workflow Data/' . self::BUNDLE;
$cacheDir = $_SERVER['HOME'] . '/Library/Caches/com.runningwithcrayons.Alfred-2/Workflow Data/' . self::BUNDLE;
if (!is_dir($dataDir)) {
mkdir($dataDir);
}
if (!is_dir($cacheDir)) {
mkdir($cacheDir);
}
self::$fileCookies = $dataDir . '/cookies';
self::$fileConfig = $dataDir . '/config.json';
self::$fileCache = $cacheDir . '/cache.json';
register_shutdown_function(array(__CLASS__, 'shutdown'));
if (file_exists(self::$fileConfig)) {
self::$config = json_decode(file_get_contents(self::$fileConfig), true);
}
if (file_exists(self::$fileCache)) {
self::$cache = json_decode(file_get_contents(self::$fileCache), true);
}
}