本文整理汇总了PHP中Plugin::load方法的典型用法代码示例。如果您正苦于以下问题:PHP Plugin::load方法的具体用法?PHP Plugin::load怎么用?PHP Plugin::load使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Plugin
的用法示例。
在下文中一共展示了Plugin::load方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testInstall
public function testInstall($verify = 1)
{
global $DB;
// Delete if Table of Monitoring yet in DB
$query = "SHOW FULL TABLES WHERE TABLE_TYPE LIKE 'VIEW'";
$result = $DB->query($query);
while ($data = $DB->fetch_array($result)) {
if (strstr($data[0], "monitoring")) {
$DB->query("DROP VIEW " . $data[0]);
}
}
$query = "SHOW TABLES";
$result = $DB->query($query);
while ($data = $DB->fetch_array($result)) {
if (strstr($data[0], "monitoring")) {
$DB->query("DROP TABLE " . $data[0]);
}
}
passthru("cd ../tools && /usr/local/bin/php -f cli_install.php");
$_SESSION['glpi_use_mode'] = 2;
$_SESSION["glpiID"] = 2;
Plugin::load("monitoring");
loadLanguage("en_GB");
if ($verify == '1') {
$MonitoringInstall = new MonitoringInstall();
$MonitoringInstall->testDB("monitoring");
}
$GLPIlog = new GLPIlogs();
$GLPIlog->testSQLlogs();
$GLPIlog->testPHPlogs();
}
示例2: plugin
/**
* Carrega o plugin informado
*
* @version 0.1 18/05/2011 Initial
*/
public function plugin($pluginName)
{
if (!class_exists('Plugin')) {
require OB_DIR . '/lib/core/Plugin.php';
}
return Plugin::load($pluginName);
}
示例3: load
function load($pluginAPI)
{
parent::load($pluginAPI);
return new Error("LOADING_ERROR");
$eventM =& $this->_pluginAPI->getEventManager();
$a = $eventM->subscribeToEvent('viewPage', new Callback('onViewHelloWorld', array($this, 'onViewPage')));
}
示例4: 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;
}
示例5: stream
public function stream()
{
$data = null;
foreach (Plugin::get_plugins('stream_song_preview') as $plugin_name) {
$plugin = new Plugin($plugin_name);
if ($plugin->load($GLOBALS['user'])) {
if ($plugin->_plugin->stream_song_preview($this->file)) {
break;
}
}
}
return $data;
}
示例6: 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;
}
示例7: Copyright
You should have received a copy of the GNU Affero General Public License
along with Webservices. If not, see <http://www.gnu.org/licenses/>.
@package Webservices
@author Nelly Mahu-Lasson
@copyright Copyright (c) 2009-2015 Webservices plugin team
@license AGPL License 3.0 or (at your option) any later version
http://www.gnu.org/licenses/agpl-3.0-standalone.html
@link https://forge.glpi-project.org/projects/webservices
@link http://www.glpi-project.org/
@since 2009
--------------------------------------------------------------------------
*/
include "../../../inc/includes.php";
Plugin::load('webservices', true);
if (!isset($_GET["id"])) {
$_GET["id"] = "";
}
$webservices = new PluginWebservicesClient();
if (isset($_POST["add"])) {
$webservices->check(-1, CREATE, $_POST);
$webservices->add($_POST);
Html::back();
} else {
if (isset($_POST["update"])) {
$webservices->check($_POST["id"], UPDATE);
$webservices->update($_POST);
Html::back();
} else {
if (isset($_POST["purge"])) {
示例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: 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;
}
示例10: define
http://indepnet.net/ http://glpi-project.org
-------------------------------------------------------------------------
LICENSE
This file is part of GLPI.
GLPI is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
GLPI 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 GLPI; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
--------------------------------------------------------------------------
*/
// ----------------------------------------------------------------------
// Original Author of file: Vincent MAZZONI
// Purpose of file:
// ----------------------------------------------------------------------
define('GLPI_ROOT', '../../..');
include GLPI_ROOT . "/inc/includes.php";
Plugin::load('fusioninventory', true);
$dropdown = new PluginFusioninventoryMib_Label();
include GLPI_ROOT . "/front/dropdown.common.form.php";
示例11: 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;
}
}
}
}
示例12: unserialize
pdf is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
pdf 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 pdf. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
include "../../../inc/includes.php";
Plugin::load('pdf', true);
include_once GLPI_ROOT . "/lib/ezpdf/class.ezpdf.php";
$type = $_SESSION["plugin_pdf"]["type"];
$item = new $type();
$tab_id = unserialize($_SESSION["plugin_pdf"]["tab_id"]);
unset($_SESSION["plugin_pdf"]["tab_id"]);
$query = "SELECT `tabref`\n FROM `glpi_plugin_pdf_preferences`\n WHERE `users_ID` = '" . $_SESSION['glpiID'] . "'\n AND `itemtype` = '{$type}'";
$result = $DB->query($query);
$tab = array();
while ($data = $DB->fetch_array($result)) {
if ($data["tabref"] == 'landscape') {
$pag = 1;
} else {
$tab[] = $data["tabref"];
}
}
示例13:
$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;
$preferences = $GLOBALS['user']->get_preferences($_REQUEST['tab']);
break;
default:
示例14: Copyright
* @version $Id: HEADER 15930 2012-12-15 11:10:55Z tsmr $
-------------------------------------------------------------------------
Ocsinventoryng plugin for GLPI
Copyright (C) 2012-2013 by the ocsinventoryng plugin Development Team.
https://forge.indepnet.net/projects/ocsinventoryng
-------------------------------------------------------------------------
LICENSE
This file is part of ocsinventoryng.
Ocsinventoryng plugin is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
Ocsinventoryng plugin 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 ocsinventoryng. If not, see <http://www.gnu.org/licenses/>.
---------------------------------------------------------------------------------------------------------------------------------------------------- */
include '../../../inc/includes.php';
Plugin::load('ocsinventoryng', true);
plugin_ocsinventoryng_checkRight("ocsng", "r");
Html::header('OCS Inventory NG', '', "plugins", "ocsinventoryng", "ocsserver");
Search::show('PluginOcsinventoryngOcsServer');
Html::footer();
示例15: accept
public function accept()
{
if ($GLOBALS['user']->has_access('75')) {
$sql = "UPDATE `wanted` SET `accepted` = '1' WHERE `mbid` = ?";
Dba::write($sql, array($this->mbid));
$this->accepted = 1;
foreach (Plugin::get_plugins('process_wanted') as $plugin_name) {
debug_event('wanted', 'Using Wanted Process plugin: ' . $plugin_name, '5');
$plugin = new Plugin($plugin_name);
if ($plugin->load($GLOBALS['user'])) {
$plugin->_plugin->process_wanted($this);
}
}
}
}