本文整理汇总了PHP中Plugin::get_plugins方法的典型用法代码示例。如果您正苦于以下问题:PHP Plugin::get_plugins方法的具体用法?PHP Plugin::get_plugins怎么用?PHP Plugin::get_plugins使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Plugin
的用法示例。
在下文中一共展示了Plugin::get_plugins方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_images
protected static function get_images($artist_name)
{
$images = array();
if (AmpConfig::get('echonest_api_key')) {
$echonest = new EchoNest_Client(new EchoNest_HttpClient_Requests());
$echonest->authenticate(AmpConfig::get('echonest_api_key'));
try {
$images = $echonest->getArtistApi()->setName($artist_name)->getImages();
} catch (Exception $e) {
debug_event('echonest', 'EchoNest artist images error: ' . $e->getMessage(), '1');
}
}
foreach (Plugin::get_plugins('get_photos') as $plugin_name) {
$plugin = new Plugin($plugin_name);
if ($plugin->load($GLOBALS['user'])) {
$images += $plugin->_plugin->get_photos($artist_name);
}
}
return $images;
}
示例2: date
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
$last_seen = $client->last_seen ? date("m\\/d\\/y - H:i", $client->last_seen) : T_('Never');
$create_date = $client->create_date ? date("m\\/d\\/y - H:i", $client->create_date) : T_('Unknown');
$client->format();
UI::show_box_top($client->f_name);
?>
<div class="user_avatar">
<?php
if ($client->f_avatar) {
echo $client->f_avatar . "<br /><br />";
}
if (AmpConfig::get('sociable')) {
echo $client->get_display_follow();
$plugins = Plugin::get_plugins('display_user_field');
?>
<ul id="plugins_user_field">
<?php
foreach ($plugins as $plugin_name) {
$plugin = new Plugin($plugin_name);
if ($plugin->load($client)) {
?>
<li><?php
$plugin->_plugin->display_user_field();
?>
</li>
<?php
}
}
?>
示例3: display_ui_links
public static function display_ui_links($object_type, $object_id)
{
echo "<ul>";
echo "<li><a onclick=\"handleShareAction('" . AmpConfig::get('web_path') . "/share.php?action=show_create&type=" . $object_type . "&id=" . $object_id . "')\">" . UI::get_icon('share', T_('Advanced Share')) . " " . T_('Advanced Share') . "</a></li>";
if (AmpConfig::get('download')) {
$dllink = "";
if ($object_type == "song" || $object_type == "video") {
$dllink = AmpConfig::get('web_path') . "/play/index.php?action=download&type=" . $object_type . "&oid=" . $object_id . "&uid=-1";
} else {
if (Access::check_function('batch_download') && check_can_zip($object_type)) {
$dllink = AmpConfig::get('web_path') . "/batch.php?action=" . $object_type . "&id=" . $object_id;
}
}
if (!empty($dllink)) {
if (AmpConfig::get('require_session')) {
// Add session information to the link to avoid authentication
$dllink .= "&ssid=" . Stream::get_session();
}
echo "<li><a rel=\"nohtml\" href=\"" . $dllink . "\">" . UI::get_icon('download', T_('Temporary direct link')) . " " . T_('Temporary direct link') . "</a></li>";
}
}
echo "<li style='padding-top: 8px; text-align: right;'>";
$plugins = Plugin::get_plugins('external_share');
foreach ($plugins as $plugin_name) {
echo "<a onclick=\"handleShareAction('" . AmpConfig::get('web_path') . "/share.php?action=external_share&plugin=" . $plugin_name . "&type=" . $object_type . "&id=" . $object_id . "')\" target=\"_blank\">" . UI::get_icon('share_' . strtolower($plugin_name), $plugin_name) . "</a> ";
}
echo "</li>";
echo "</ul>";
}
示例4: load_all
/**
* Load wanted release data.
* @param boolean $track_details
*/
public function load_all($track_details = true)
{
$mb = new MusicBrainz(new RequestsHttpAdapter());
$this->songs = array();
try {
$group = $mb->lookup('release-group', $this->mbid, array('releases'));
// Set fresh data
$this->name = $group->title;
$this->year = date("Y", strtotime($group->{'first-release-date'}));
// Load from database if already cached
$this->songs = Song_preview::get_song_previews($this->mbid);
if (count($group->releases) > 0) {
$this->release_mbid = $group->releases[0]->id;
if ($track_details && count($this->songs) == 0) {
// Use the first release as reference for track content
$release = $mb->lookup('release', $this->release_mbid, array('recordings'));
foreach ($release->media as $media) {
foreach ($media->tracks as $track) {
$song = array();
$song['disk'] = $media->position;
$song['track'] = $track->number;
$song['title'] = $track->title;
$song['mbid'] = $track->id;
if ($this->artist) {
$song['artist'] = $this->artist;
}
$song['artist_mbid'] = $this->artist_mbid;
$song['session'] = session_id();
$song['album_mbid'] = $this->mbid;
if ($this->artist) {
$artist = new Artist($this->artist);
$artist_name = $artist->name;
} else {
$wartist = Wanted::get_missing_artist($this->artist_mbid);
$artist_name = $wartist['name'];
}
$song['file'] = null;
foreach (Plugin::get_plugins('get_song_preview') as $plugin_name) {
$plugin = new Plugin($plugin_name);
if ($plugin->load($GLOBALS['user'])) {
$song['file'] = $plugin->_plugin->get_song_preview($track->id, $artist_name, $track->title);
if ($song['file'] != null) {
break;
}
}
}
if ($song != null) {
$this->songs[] = new Song_Preview(Song_preview::insert($song));
}
}
}
}
}
} catch (Exception $e) {
$this->songs = array();
}
foreach ($this->songs as $song) {
$song->f_album = $this->name;
$song->format();
}
}
示例5: T_
} else {
$GLOBALS['user']->upload_avatar();
//$_REQUEST['action'] = 'confirm';
$title = T_('Updated');
$text = T_('Your Account has been updated');
$next_url = AmpConfig::get('web_path') . '/preferences.php?tab=account';
}
$notification_text = T_('User updated successfully');
break;
case 'grant':
// Make sure we're a user and they came from the form
if (!Access::check('interface', '25') && $GLOBALS['user']->id > 0) {
UI::access_denied();
exit;
}
if ($_REQUEST['token'] && in_array($_REQUEST['plugin'], Plugin::get_plugins('save_mediaplay'))) {
// we receive a token for a valid plugin, have to call getSession and obtain a session key
if ($plugin = new Plugin($_REQUEST['plugin'])) {
$plugin->load($GLOBALS['user']);
if ($plugin->_plugin->get_session($GLOBALS['user']->id, $_REQUEST['token'])) {
$title = T_('Updated');
$text = T_('Your Account has been updated') . ' : ' . $_REQUEST['plugin'];
$next_url = AmpConfig::get('web_path') . '/preferences.php?tab=plugins';
} else {
$title = T_('Error');
$text = T_('Your Account has not been updated') . ' : ' . $_REQUEST['plugin'];
$next_url = AmpConfig::get('web_path') . '/preferences.php?tab=plugins';
}
}
}
$fullname = $GLOBALS['user']->fullname;
示例6: array
if (!defined('AJAX_INCLUDE')) {
exit;
}
$results = array();
switch ($_REQUEST['action']) {
case 'geolocation':
if (AmpConfig::get('geolocation')) {
if ($GLOBALS['user']->id) {
$latitude = floatval($_REQUEST['latitude']);
$longitude = floatval($_REQUEST['longitude']);
$name = $_REQUEST['name'];
if (empty($name)) {
// First try to get from local cache (avoid external api requests)
$name = Stats::get_cached_place_name($latitude, $longitude);
if (empty($name)) {
foreach (Plugin::get_plugins('get_location_name') as $plugin_name) {
$plugin = new Plugin($plugin_name);
if ($plugin->load($GLOBALS['user'])) {
$name = $plugin->_plugin->get_location_name($latitude, $longitude);
if (!empty($name)) {
break;
}
}
}
}
}
// Better to check for bugged values here and keep previous user good location
// Someone listing music at 0.0,0.0 location would need a waterproof music player btw
if ($latitude > 0 && $longitude > 0) {
Session::update_geolocation(session_id(), $latitude, $longitude, $name);
}
示例7: get_lyrics
/**
* Get lyrics.
* @return array
*/
public function get_lyrics()
{
if ($this->lyrics) {
return array('text' => $this->lyrics);
}
foreach (Plugin::get_plugins('get_lyrics') as $plugin_name) {
$plugin = new Plugin($plugin_name);
if ($plugin->load($GLOBALS['user'])) {
$lyrics = $plugin->_plugin->get_lyrics($this);
if ($lyrics != false) {
return $lyrics;
}
}
}
return null;
}
示例8: set_rating
/**
* set_rating
* This function sets the rating for the current object.
* If no userid is passed in, we use the currently logged in user.
*/
public function set_rating($rating, $user_id = null)
{
if (is_null($user_id)) {
$user_id = $GLOBALS['user']->id;
}
$user_id = intval($user_id);
debug_event('Rating', "Setting rating for {$this->type} {$this->id} to {$rating}", 5);
// If score is -1, then remove rating
if ($rating == '-1') {
$sql = "DELETE FROM `rating` WHERE " . "`object_id` = ? AND " . "`object_type` = ? AND " . "`user` = ?";
$params = array($this->id, $this->type, $user_id);
} else {
$sql = "REPLACE INTO `rating` " . "(`object_id`, `object_type`, `rating`, `user`) " . "VALUES (?, ?, ?, ?)";
$params = array($this->id, $this->type, $rating, $user_id);
}
Dba::write($sql, $params);
parent::add_to_cache('rating_' . $this->type . '_user' . $user_id, $this->id, $rating);
foreach (Plugin::get_plugins('save_rating') as $plugin_name) {
$plugin = new Plugin($plugin_name);
if ($plugin->load($GLOBALS['user'])) {
$plugin->_plugin->save_rating($this, $rating);
}
}
return true;
}
示例9: show_footer
/**
* show_footer
*
* Shows the footer template and possibly profiling info.
*/
public static function show_footer()
{
if (!defined("TABLE_RENDERED")) {
show_table_render();
}
$plugins = Plugin::get_plugins('display_on_footer');
foreach ($plugins as $plugin_name) {
$plugin = new Plugin($plugin_name);
if ($plugin->load($GLOBALS['user'])) {
$plugin->_plugin->display_on_footer();
}
}
require_once AmpConfig::get('prefix') . UI::find_template('footer.inc.php');
if (isset($_REQUEST['profiling'])) {
Dba::show_profile();
}
}
示例10: foreach
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License v2
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
foreach (Plugin::get_plugins('display_home') as $plugin_name) {
$plugin = new Plugin($plugin_name);
if ($plugin->load($GLOBALS['user'])) {
$plugin->_plugin->display_home();
}
}
if (AmpConfig::get('home_now_playing')) {
?>
<div id="now_playing">
<?php
show_now_playing();
?>
</div> <!-- Close Now Playing Div -->
<?php
}
?>
示例11: _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));
}
}
}
}
}
示例12: set_flag
/**
* set_flag
* This function sets the user flag for the current object.
* If no userid is passed in, we use the currently logged in user.
*/
public function set_flag($flagged, $user_id = null)
{
if ($user_id === null) {
$user_id = $GLOBALS['user']->id;
}
$user_id = intval($user_id);
debug_event('Userflag', "Setting userflag for {$this->type} {$this->id} to {$flagged}", 5);
if (!$flagged) {
$sql = "DELETE FROM `user_flag` WHERE " . "`object_id` = ? AND " . "`object_type` = ? AND " . "`user` = ?";
$params = array($this->id, $this->type, $user_id);
} else {
$sql = "REPLACE INTO `user_flag` " . "(`object_id`, `object_type`, `user`, `date`) " . "VALUES (?, ?, ?, ?)";
$params = array($this->id, $this->type, $user_id, time());
Useractivity::post_activity($user_id, 'userflag', $this->type, $this->id);
}
Dba::write($sql, $params);
parent::add_to_cache('userflag_' . $this->type . '_user' . $user_id, $this->id, $flagged);
// Forward flag to last.fm and Libre.fm (song only)
if ($this->type == 'song') {
$user = new User($user_id);
$song = new Song($this->id);
if ($song) {
$song->format();
foreach (Plugin::get_plugins('save_mediaplay') as $plugin_name) {
try {
$plugin = new Plugin($plugin_name);
if ($plugin->load($user)) {
$plugin->_plugin->set_flag($song, $flagged);
}
} catch (Exception $e) {
debug_event('user.class.php', 'Stats plugin error: ' . $e->getMessage(), '1');
}
}
}
}
return true;
}
示例13: debug_event
/* Verify that this plugin exists */
$plugins = Plugin::get_plugins();
if (!array_key_exists($_REQUEST['plugin'], $plugins)) {
debug_event('plugins', 'Error: Invalid Plugin: ' . $_REQUEST['plugin'] . ' selected', '1');
break;
}
$plugin = new Plugin($_REQUEST['plugin']);
$plugin->upgrade();
User::rebuild_all_preferences();
$url = AmpConfig::get('web_path') . '/admin/modules.php?action=show_plugins';
$title = T_('Plugin Upgraded');
$body = '';
show_confirmation($title, $body, $url);
break;
case 'show_plugins':
$plugins = Plugin::get_plugins();
UI::show_box_top(T_('Plugins'), 'box box_localplay_plugins');
require_once AmpConfig::get('prefix') . '/templates/show_plugins.inc.php';
UI::show_box_bottom();
break;
case 'show_localplay':
$controllers = Localplay::get_controllers();
UI::show_box_top(T_('Localplay Controllers'), 'box box_localplay_controllers');
require_once AmpConfig::get('prefix') . '/templates/show_localplay_controllers.inc.php';
UI::show_box_bottom();
break;
case 'show_catalog_types':
$catalogs = Catalog::get_catalog_types();
UI::show_box_top(T_('Catalog Types'), 'box box_catalog_types');
require_once AmpConfig::get('prefix') . '/templates/show_catalog_types.inc.php';
UI::show_box_bottom();
示例14: stream_control
/**
* stream_control
* Check all stream control plugins
* @param array $media_ids
* @param User $user
* @return boolean
*/
public static function stream_control($media_ids, User $user = null)
{
if ($user == null) {
$user = $GLOBALS['user'];
}
foreach (Plugin::get_plugins('stream_control') as $plugin_name) {
$plugin = new Plugin($plugin_name);
if ($plugin->load($user)) {
if (!$plugin->_plugin->stream_control($media_ids)) {
return false;
}
}
}
return true;
}
示例15: display_map
public function display_map($user = 0, $object_type = null, $object_id = 0, $start_date = null, $end_date = null, $zoom = 'day')
{
$pts = $this->get_geolocation_pts($user, $object_type, $object_id, $start_date, $end_date, $zoom);
foreach (Plugin::get_plugins('display_map') as $plugin_name) {
$plugin = new Plugin($plugin_name);
if ($plugin->load($GLOBALS['user'])) {
if ($plugin->_plugin->display_map($pts)) {
break;
}
}
}
}