本文整理汇总了PHP中Plugin::get_plugin_version方法的典型用法代码示例。如果您正苦于以下问题:PHP Plugin::get_plugin_version方法的具体用法?PHP Plugin::get_plugin_version怎么用?PHP Plugin::get_plugin_version使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Plugin
的用法示例。
在下文中一共展示了Plugin::get_plugin_version方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: upgrade
/**
* upgrade
* This is a recommended plugin function
*/
public function upgrade()
{
$from_version = Plugin::get_plugin_version($this->name);
if ($from_version < 2) {
Preference::insert('catalogfav_columns', 'Catalog favorites columns', '1', '25', 'integer', 'plugins');
}
return true;
}
示例2: upgrade
/**
* upgrade
* This is a recommended plugin function
*/
public function upgrade()
{
$from_version = Plugin::get_plugin_version($this->name);
if ($from_version < 4) {
Preference::rename('lastfm_pass', 'lastfm_md5_pass');
}
if ($from_version < 5) {
Preference::delete('lastfm_md5_pass');
Preference::delete('lastfm_user');
Preference::delete('lastfm_url');
Preference::delete('lastfm_host');
Preference::delete('lastfm_port');
Preference::insert('lastfm_grant_link', 'Last.FM Grant URL', '', '25', 'string', 'plugins');
}
return true;
}
示例3: gather
/**
* gather
* This tries to get the art in question
* @param array $options
* @param int $limit
* @return array
*/
public function gather($options = array(), $limit = 0)
{
// Define vars
$results = array();
$type = $this->type;
if (isset($options['type'])) {
$type = $options['type'];
}
if (count($options) == 0) {
debug_event('Art', 'No options for art search, skipped.', 3);
return array();
}
$config = AmpConfig::get('art_order');
$methods = get_class_methods('Art');
/* If it's not set */
if (empty($config)) {
// They don't want art!
debug_event('Art', 'art_order is empty, skipping art gathering', 3);
return array();
} elseif (!is_array($config)) {
$config = array($config);
}
debug_event('Art', 'Searching using:' . json_encode($config), 3);
$plugin_names = Plugin::get_plugins('gather_arts');
foreach ($config as $method) {
$method_name = "gather_" . $method;
$data = array();
if (in_array($method, $plugin_names)) {
$plugin = new Plugin($method);
$installed_version = Plugin::get_plugin_version($plugin->_plugin->name);
if ($installed_version) {
if ($plugin->load($GLOBALS['user'])) {
$data = $plugin->_plugin->gather_arts($type, $options, $limit);
}
}
} else {
if (in_array($method_name, $methods)) {
debug_event('Art', "Method used: {$method_name}", 3);
// Some of these take options!
switch ($method_name) {
case 'gather_lastfm':
$data = $this->{$method_name}($limit, $options);
break;
case 'gather_google':
$data = $this->{$method_name}($limit, $options);
break;
default:
$data = $this->{$method_name}($limit);
break;
}
} else {
debug_event("Art", $method_name . " not defined", 1);
}
}
// Add the results we got to the current set
$results = array_merge($results, (array) $data);
if ($limit && count($results) >= $limit) {
return array_slice($results, 0, $limit);
}
}
// end foreach
return $results;
}
示例4: upgrade
/**
* upgrade
* This is a recommended plugin function
*/
public function upgrade()
{
$from_version = Plugin::get_plugin_version($this->name);
if ($from_version < 2) {
Preference::rename('librefm_pass', 'librefm_md5_pass');
}
return true;
}
示例5: T_
</th>
<th class="cel_iversion"><?php
echo T_('Installed Version');
?>
</th>
<th class="cel_action"><?php
echo T_('Action');
?>
</th>
</tr>
</thead>
<tbody>
<?php
foreach ($plugins as $plugin_name) {
$plugin = new Plugin($plugin_name);
$installed_version = Plugin::get_plugin_version($plugin->_plugin->name);
if (!$installed_version) {
$action = "<a href=\"" . $web_path . "/admin/modules.php?action=install_plugin&plugin=" . scrub_out($plugin_name) . "\">" . T_('Activate') . "</a>";
} else {
$action = "<a href=\"" . $web_path . "/admin/modules.php?action=confirm_uninstall_plugin&plugin=" . scrub_out($plugin_name) . "\">" . T_('Deactivate') . "</a>";
if ($installed_version < $plugin->_plugin->version) {
$action .= ' <a href="' . $web_path . '/admin/modules.php?action=upgrade_plugin&plugin=' . scrub_out($plugin_name) . '">' . T_('Upgrade') . '</a>';
}
}
?>
<tr class="<?php
echo UI::flip_class();
?>
">
<td class="cel_name"><?php
echo scrub_out($plugin->_plugin->name);
示例6: _get_plugin_tags
/**
* _get_plugin_tags
*
* Get additional metadata from plugins
*/
private function _get_plugin_tags()
{
$tag_order = $this->get_metadata_order();
if (!is_array($tag_order)) {
$tag_order = array($tag_order);
}
$plugin_names = Plugin::get_plugins('get_metadata');
foreach ($tag_order as $tag_source) {
if (in_array($tag_source, $plugin_names)) {
$plugin = new Plugin($tag_source);
$installed_version = Plugin::get_plugin_version($plugin->_plugin->name);
if ($installed_version) {
if ($plugin->load($GLOBALS['user'])) {
$this->tags[$tag_source] = $plugin->_plugin->get_metadata($this->gather_types, self::clean_tag_info($this->tags, self::get_tag_type($this->tags, $this->get_metadata_order_key()), $this->filename));
}
}
}
}
}