Exemplo n.º 1
0
 /**
  * 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;
 }
Exemplo n.º 2
0
 /**
  * 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;
 }
Exemplo n.º 3
0
 /**
  * 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;
 }
Exemplo n.º 4
0
 /**
  * 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;
 }
Exemplo n.º 5
0
</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&amp;plugin=" . scrub_out($plugin_name) . "\">" . T_('Activate') . "</a>";
    } else {
        $action = "<a href=\"" . $web_path . "/admin/modules.php?action=confirm_uninstall_plugin&amp;plugin=" . scrub_out($plugin_name) . "\">" . T_('Deactivate') . "</a>";
        if ($installed_version < $plugin->_plugin->version) {
            $action .= '&nbsp;&nbsp;<a href="' . $web_path . '/admin/modules.php?action=upgrade_plugin&amp;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);
Exemplo n.º 6
0
 /**
  * _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));
                 }
             }
         }
     }
 }