本文整理汇总了PHP中ExtensionManager::fetch方法的典型用法代码示例。如果您正苦于以下问题:PHP ExtensionManager::fetch方法的具体用法?PHP ExtensionManager::fetch怎么用?PHP ExtensionManager::fetch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ExtensionManager
的用法示例。
在下文中一共展示了ExtensionManager::fetch方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sort
public function sort(&$sort, &$order, $params)
{
if (is_null($sort)) {
$sort = 'name';
}
return ExtensionManager::fetch(array(), array(), $sort . ' ' . $order);
}
示例2: view
public function view()
{
header('Content-Type: text/xml');
$response = new XMLElement('response');
$id = $_GET['id'];
$version = Symphony::Configuration()->get('version', 'symphony');
// remove text followed by numbers e.g. 2.3beta2 or 2.3rc1
$version = preg_replace("/[a-z]+[0-9]+/i", '', $version);
// remove text e.g. 2.3beta
$version = preg_replace("/[a-z]+/i", '', $version);
$symphony_version = self::normaliseVersionNumber($version);
$response->setAttribute('symphony-version', $symphony_version);
if (empty($id)) {
$response->setAttribute('error', '404');
echo $response->generate();
die;
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, sprintf('http://symphonyextensions.com/api/extensions/%s/', $id));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_USERAGENT, 'extension_status; Symphony ' . Symphony::Configuration()->get('version', 'symphony'));
curl_setopt($ch, CURLOPT_REFERER, URL);
$xml = curl_exec($ch);
if (!$xml) {
$response->setAttribute('error', '404');
echo $response->generate();
die;
}
$extension = simplexml_load_string($xml);
$compatibility = $extension->xpath("//compatibility/symphony[@version='" . $symphony_version . "']");
$extensions = ExtensionManager::fetch();
$current_version = $extensions[$id]['version'];
$response->setAttribute('current-local-version', $current_version);
if (count($compatibility) == 0) {
$response->setAttribute('compatible-version-exists', 'no');
} else {
$latest_version = $compatibility[0]->attributes()->use;
$github_url = $extension->xpath("//link[@rel='github:page']/@href");
$extension_url = $extension->xpath("//link[@rel='site:extension']/@href");
$response->setAttribute('compatible-version-exists', 'yes');
$response->setAttribute('latest-url', (string) $github_url[0] . '/tree/' . $latest_version);
$response->setAttribute('latest', $latest_version);
$response->setAttribute('can-update', version_compare($latest_version, $current_version, '>') ? 'yes' : 'no');
$response->setAttribute('extension-url', 'http://symphonyextensions.com' . (string) $extension_url[0]);
}
echo $response->generate();
die;
}