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


PHP Update::request方法代码示例

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


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

示例1: get_repositories_list

 public function get_repositories_list()
 {
     $response = Update::request('https://api.github.com/users/KodiCMS/repos');
     $response = json_decode($response, true);
     $local_plugins = array_keys(Plugins::find_all());
     $repo_plugins = array();
     foreach ($response as $repo) {
         if (strpos($repo['name'], 'plugin-') !== 0) {
             continue;
         }
         $replo_plugin_name = substr($repo['name'], strlen('plugin-'));
         $repo_plugins[] = array('id' => $replo_plugin_name, 'name' => ucfirst(Inflector::humanize($replo_plugin_name)), 'description' => $repo['description'], 'url' => $repo['html_url'], 'clone_url' => $repo['clone_url'], 'archive_url' => $repo['html_url'] . '/archive/' . $repo['default_branch'] . '.zip', 'is_installed' => in_array($replo_plugin_name, $local_plugins), 'is_new' => time() - strtotime($repo['created_at']) < Date::MONTH, 'last_update' => Date::format(strtotime($repo['updated_at'])), 'homepage' => $repo['homepage'], 'plugin_path' => DIRECTORY_SEPARATOR . implode(DIRECTORY_SEPARATOR, array('cms', 'plugins', $replo_plugin_name)), 'stars' => $repo['stargazers_count'], 'watchers' => $repo['watchers_count']);
     }
     $this->response($repo_plugins);
 }
开发者ID:ZerGabriel,项目名称:cms-1,代码行数:15,代码来源:plugins.php

示例2: find_remote

 /**
  * 
  * @return array
  */
 public static function find_remote()
 {
     $respoonse = Update::request('https://api.github.com/repos/KodiCMS/patches/git/trees/master?recursive=true');
     $respoonse = json_decode($respoonse, TRUE);
     $patches = array();
     $cache = Cache::instance();
     $cached_patches = $cache->get('patches_cache');
     if ($cached_patches !== NULL) {
         return $cached_patches;
     }
     if (isset($respoonse['tree'])) {
         $installed_patches = self::installed();
         foreach ($respoonse['tree'] as $row) {
             if (!in_array($row['path'], $installed_patches) and pathinfo($row['path'], PATHINFO_EXTENSION) == 'php') {
                 $patches[$row['path']] = 'https://raw.githubusercontent.com/KodiCMS/patches/master/' . $row['path'];
             }
         }
         $cache->set('patches_cache', $patches);
     }
     return $patches;
 }
开发者ID:ZerGabriel,项目名称:cms-1,代码行数:25,代码来源:patch.php


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