本文整理汇总了PHP中Plugins::find_all方法的典型用法代码示例。如果您正苦于以下问题:PHP Plugins::find_all方法的具体用法?PHP Plugins::find_all怎么用?PHP Plugins::find_all使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Plugins
的用法示例。
在下文中一共展示了Plugins::find_all方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例2: check_files
/**
* Проверка файлов на различия, проверяется по размеру файла и наличие файла в ФС
* @retun array
*/
public static function check_files()
{
$respoonse = self::request('https://api.github.com/repos/:rep/git/trees/:branch?recursive=true');
$respoonse = json_decode($respoonse, TRUE);
$files = array('new_files' => array(), 'diff_files' => array(), 'third_party_plugins' => array());
$cache = Cache::instance();
$cached_files = $cache->get(self::CACHE_KEY_FILES);
if ($cached_files !== NULL) {
return $cached_files;
}
if (isset($respoonse['tree'])) {
$plugins = array();
foreach ($respoonse['tree'] as $row) {
$filepath = DOCROOT . $row['path'];
if (!file_exists($filepath)) {
$files['new_files'][] = self::build_remote_url('https://raw.githubusercontent.com/:rep/:branch/' . $row['path']);
continue;
}
if (is_dir($filepath)) {
if (preg_match('/cms\\/plugins\\/([\\w\\_]+)/', $filepath, $matches)) {
if (!empty($matches[1])) {
$plugins[$matches[1]] = $matches[1];
}
}
continue;
}
$filesize = filesize($filepath);
if ($filesize != $row['size']) {
$diff = $filesize - self::_count_file_lines($filepath) - $row['size'];
if ($diff > 1 or $diff < -1) {
$files['diff_files'][] = array('diff' => Text::bytes($diff), 'url' => self::build_remote_url('https://raw.githubusercontent.com/:rep/:branch/' . $row['path']));
}
}
}
if (!empty($plugins)) {
$local_plugins = array_keys(Plugins::find_all());
$files['third_party_plugins'] = array_diff($local_plugins, $plugins);
}
$cache->set(self::CACHE_KEY_FILES, $files);
}
return $files;
}
示例3: defined
<?php
defined('SYSPATH') or die('No direct access allowed.');
$plugins = Arr::get($post, 'plugins', array());
if (!empty($post['insert_test_data'])) {
$plugins['test'] = 'test';
}
Plugins::find_all();
foreach ($plugins as $name) {
$plugin = Plugins::get_registered($name);
if ($plugin instanceof Plugin_Decorator and $plugin->is_installable()) {
$plugin->activate();
}
}
示例4: defined
<?php
defined('SYSPATH') or die('No direct access allowed.');
Observer::observe('installer_step_other', function ($data) {
$plugins = Plugins::find_all();
echo View::factory('plugins/install', array('plugins' => $plugins, 'data' => $data));
});