本文整理汇总了PHP中plugin::listPlugin方法的典型用法代码示例。如果您正苦于以下问题:PHP plugin::listPlugin方法的具体用法?PHP plugin::listPlugin怎么用?PHP plugin::listPlugin使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类plugin
的用法示例。
在下文中一共展示了plugin::listPlugin方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Exception
if (init('action') == 'toggle') {
if (!isConnect('admin')) {
throw new Exception(__('401 - Accès non autorisé', __FILE__));
}
$plugin = plugin::byId(init('id'));
if (!is_object($plugin)) {
throw new Exception(__('Plugin introuvable : ', __FILE__) . init('id'));
}
$plugin->setIsEnable(init('state'));
ajax::success();
}
if (init('action') == 'all') {
if (!isConnect()) {
throw new Exception(__('401 - Accès non autorisé', __FILE__));
}
ajax::success(utils::o2a(plugin::listPlugin()));
}
if (init('action') == 'pluginupload') {
$uploaddir = dirname(__FILE__) . '/../../tmp';
if (!file_exists($uploaddir)) {
mkdir($uploaddir);
}
if (!file_exists($uploaddir)) {
throw new Exception(__('Répertoire d\'upload non trouvé : ', __FILE__) . $uploaddir);
}
if (!isset($_FILES['file'])) {
throw new Exception(__('Aucun fichier trouvé. Vérifié parametre PHP (post size limit)', __FILE__));
}
$extension = strtolower(strrchr($_FILES['file']['name'], '.'));
if (!in_array($extension, array('.zip'))) {
throw new Exception('Extension du fichier non valide (autorisé .zip) : ' . $extension);
示例2: toHtml
public function toHtml($_version = 'dashboard', $options = '', $_cmdColor = null, $_cache = 2)
{
$version = jeedom::versionAlias($_version);
$html = '';
$template_name = 'cmd.' . $this->getType() . '.' . $this->getSubType() . '.' . $this->getTemplate($version, 'default');
$template = '';
if (!isset(self::$_templateArray[$version . '::' . $template_name])) {
if ($this->getTemplate($version, 'default') != 'default') {
if (config::byKey('active', 'widget') == 1) {
$template = getTemplate('core', $version, $template_name, 'widget');
}
if ($template == '') {
foreach (plugin::listPlugin(true) as $plugin) {
$template = getTemplate('core', $version, $template_name, $plugin->getId());
if ($template != '') {
break;
}
}
}
if ($template == '') {
$template_name = 'cmd.' . $this->getType() . '.' . $this->getSubType() . '.default';
$template = getTemplate('core', $version, $template_name);
}
} else {
$template = getTemplate('core', $version, $template_name);
}
self::$_templateArray[$version . '::' . $template_name] = $template;
} else {
$template = self::$_templateArray[$version . '::' . $template_name];
}
$replace = array('#id#' => $this->getId(), '#name#' => $this->getDisplay('icon') != '' ? $this->getDisplay('icon') : $this->getName(), '#name_display#' => $this->getDisplay('icon') != '' ? $this->getDisplay('icon') : $this->getName(), '#history#' => '', '#displayHistory#' => 'display : none;', '#unite#' => $this->getUnite(), '#minValue#' => $this->getConfiguration('minValue', 0), '#maxValue#' => $this->getConfiguration('maxValue', 100), '#logicalId#' => $this->getLogicalId());
if ($_cmdColor == null && $version != 'scenario') {
$eqLogic = $this->getEqLogic();
$vcolor = $version == 'mobile' ? 'mcmdColor' : 'cmdColor';
if ($eqLogic->getPrimaryCategory() == '') {
$replace['#cmdColor#'] = jeedom::getConfiguration('eqLogic:category:default:' . $vcolor);
} else {
$replace['#cmdColor#'] = jeedom::getConfiguration('eqLogic:category:' . $eqLogic->getPrimaryCategory() . ':' . $vcolor);
}
} else {
$replace['#cmdColor#'] = $_cmdColor;
}
if ($this->getDisplay('doNotShowNameOnView') == 1 && ($_version == 'dview' || $_version == 'mview')) {
$replace['#name_display#'] = '';
$replace['#name#'] = '';
} else {
if ($this->getDisplay('doNotShowNameOnDashboard') == 1 && ($_version == 'mobile' || $_version == 'dashboard')) {
$replace['#name_display#'] = '';
$replace['#name#'] = '';
} else {
$replace['#name_display#'] .= '<br/>';
}
}
if ($this->getType() == 'info') {
$replace['#state#'] = '';
$replace['#tendance#'] = '';
$replace['#state#'] = $this->execCmd(null, $_cache);
if (strpos($replace['#state#'], 'error::') !== false) {
$template = getTemplate('core', $version, 'cmd.error');
$replace['#state#'] = str_replace('error::', '', $replace['#state#']);
} else {
if ($this->getSubType() == 'binary' && $this->getDisplay('invertBinary') == 1) {
$replace['#state#'] = $replace['#state#'] == 1 ? 0 : 1;
}
}
if (method_exists($this, 'formatValueWidget')) {
$replace['#state#'] = $this->formatValueWidget($replace['#state#']);
}
$replace['#collectDate#'] = $this->getCollectDate();
$replace['#valueDate#'] = $this->getValueDate();
if ($this->getIsHistorized() == 1) {
$replace['#history#'] = 'history cursor';
if (config::byKey('displayStatsWidget') == 1 && strpos($template, '#displayHistory#') !== false) {
$showStat = true;
if ($this->getDisplay('doNotShowStatOnDashboard') == 1 && $_version == 'dashboard') {
$showStat = false;
}
if ($this->getDisplay('doNotShowStatOnView') == 1 && ($_version == 'dview' || $_version == 'mview')) {
$showStat = false;
}
if ($this->getDisplay('doNotShowStatOnMobile') == 1 && $_version == 'mobile') {
$showStat = false;
}
if ($showStat) {
$startHist = date('Y-m-d H:i:s', strtotime(date('Y-m-d H:i:s') . ' -' . config::byKey('historyCalculPeriod') . ' hour'));
$replace['#displayHistory#'] = '';
$historyStatistique = $this->getStatistique($startHist, date('Y-m-d H:i:s'));
if ($historyStatistique['avg'] == 0 && $historyStatistique['min'] == 0 && $historyStatistique['max'] == 0) {
$replace['#averageHistoryValue#'] = round($replace['#state#'], 1);
$replace['#minHistoryValue#'] = round($replace['#state#'], 1);
$replace['#maxHistoryValue#'] = round($replace['#state#'], 1);
} else {
$replace['#averageHistoryValue#'] = round($historyStatistique['avg'], 1);
$replace['#minHistoryValue#'] = round($historyStatistique['min'], 1);
$replace['#maxHistoryValue#'] = round($historyStatistique['max'], 1);
}
$startHist = date('Y-m-d H:i:s', strtotime(date('Y-m-d H:i:s') . ' -' . config::byKey('historyCalculTendance') . ' hour'));
$tendance = $this->getTendance($startHist, date('Y-m-d H:i:s'));
if ($tendance > config::byKey('historyCalculTendanceThresholddMax')) {
$replace['#tendance#'] = 'fa fa-arrow-up';
//.........这里部分代码省略.........
示例3: dirname
* along with Jeedom. If not, see <http://www.gnu.org/licenses/>.
*/
try {
require_once dirname(__FILE__) . '/../../core/php/core.inc.php';
include_file('core', 'authentification', 'php');
if (init('action') == 'getInfoApplication') {
if (!isConnect()) {
throw new Exception(__('401 - Accès non autorisé', __FILE__), -1234);
}
$_SESSION['user']->refresh();
$return = array();
$return['user_id'] = $_SESSION['user']->getId();
$return['nodeJsKey'] = config::byKey('nodeJsKey');
$return['userProfils'] = $_SESSION['user']->getOptions();
$return['plugins'] = array();
foreach (plugin::listPlugin(true) as $plugin) {
if ($plugin->getMobile() != '') {
$return['plugins'][] = utils::o2a($plugin);
}
}
$return['custom'] = array();
$return['custom']['js'] = file_exists(dirname(__FILE__) . '/../../mobile/custom/custom.js');
$return['custom']['css'] = file_exists(dirname(__FILE__) . '/../../mobile/custom/custom.css');
ajax::success($return);
}
if (!isConnect('admin')) {
throw new Exception(__('401 - Accès non autorisé', __FILE__), -1234);
}
if (init('action') == 'ssh') {
ajax::success(shell_exec(init('command')));
}
示例4: Exception
<?php
if (!isConnect()) {
throw new Exception('{{Error 401 Unauthorized');
}
$notifyTheme = array('info' => '{{Bleu}}', 'error' => '{{Rouge}}', 'success' => '{{Vert}}', 'warning' => '{{Jaune}}');
$homePage = array('core::dashboard' => '{{Dashboard}}', 'core::view' => '{{Vue}}', 'core::plan' => '{{Design}}');
foreach (plugin::listPlugin() as $pluginList) {
if ($pluginList->isActive() == 1 && $pluginList->getDisplay() != '') {
$homePage[$pluginList->getId() . '::' . $pluginList->getDisplay()] = $pluginList->getName();
}
}
?>
<legend>{{Profil}}</legend>
<div class="panel-group" id="accordionConfiguration">
<input style="display: none;" class="userAttr form-control" data-l1key="id" />
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordionConfiguration" href="#config_themes">
Thèmes
</a>
</h3>
</div>
<div id="config_themes" class="panel-collapse collapse in">
<div class="panel-body">
<form class="form-horizontal">
<fieldset>
<div class="form-group">
<label class="col-sm-3 control-label">{{Desktop}}</label>
示例5: redirect
$homeLink .= '&fullscreen=1';
}
} else {
$homeLink = 'index.php?v=d&p=dashboard';
}
}
$title = 'Jeedom';
if (init('p') == '' && isConnect()) {
redirect($homeLink);
}
$page = '';
if (isConnect() && init('p') != '') {
$page = init('p');
$title = ucfirst($page) . ' - ' . $title;
}
$plugins_list = plugin::listPlugin(true, true);
$plugin_menu = '';
$panel_menu = '';
if (count($plugins_list) > 0) {
foreach ($plugins_list as $category_name => $category) {
$icon = '';
if (isset($JEEDOM_INTERNAL_CONFIG['plugin']['category'][$category_name]) && isset($JEEDOM_INTERNAL_CONFIG['plugin']['category'][$category_name]['icon'])) {
$icon = $JEEDOM_INTERNAL_CONFIG['plugin']['category'][$category_name]['icon'];
}
$name = $category_name;
if (isset($JEEDOM_INTERNAL_CONFIG['plugin']['category'][$category_name]) && isset($JEEDOM_INTERNAL_CONFIG['plugin']['category'][$category_name]['name'])) {
$name = $JEEDOM_INTERNAL_CONFIG['plugin']['category'][$category_name]['name'];
}
$plugin_menu .= '<li class="dropdown-submenu"><a data-toggle="dropdown"><i class="fa ' . $icon . '"></i> {{' . $name . '}}</a>';
$plugin_menu .= '<ul class="dropdown-menu">';
foreach ($category as $pluginList) {
示例6: saveTicket
public static function saveTicket($_ticket)
{
$jsonrpc = self::getJsonRpc();
$_ticket['user_plugin'] = '';
foreach (plugin::listPlugin() as $plugin) {
$_ticket['user_plugin'] .= $plugin->getId();
$update = $plugin->getUpdate();
if (is_object($update)) {
$_ticket['user_plugin'] .= '[' . $update->getConfiguration('version', 'stable') . ',' . $update->getLocalVersion() . ']';
}
$_ticket['user_plugin'] .= ',';
}
trim($_ticket['user_plugin'], ',');
if (isset($_ticket['options']['page'])) {
$_ticket['options']['page'] = substr($_ticket['options']['page'], strpos($_ticket['options']['page'], 'index.php'));
}
if (isset($_ticket['allowRemoteAccess']) && $_ticket['allowRemoteAccess'] == 1) {
$user = user::createTemporary(72);
$_ticket['options']['remoteAccess'] = 'Http : ' . $user->getDirectUrlAccess();
if (config::byKey('market::allowDNS') == 1 && config::byKey('market::redirectSSH') == 1 && config::byKey('ngrok::port') != '') {
$_ticket['options']['remoteAccess'] .= ' | SSH : dns.jeedom.com:' . config::byKey('ngrok::port');
}
}
$_ticket['options']['jeedom_version'] = jeedom::version();
if (!$jsonrpc->sendRequest('ticket::save', array('ticket' => $_ticket))) {
throw new Exception($jsonrpc->getErrorMessage());
}
return $jsonrpc->getResult();
}
示例7: loadTranslation
public static function loadTranslation()
{
$return = array();
if (file_exists(self::getPathTranslationFile(self::getLanguage()))) {
$return = file_get_contents(self::getPathTranslationFile(self::getLanguage()));
if (is_json($return)) {
$return = json_decode($return, true);
} else {
$return = array();
}
foreach (plugin::listPlugin(true, false, false) as $plugin) {
$return = array_merge($return, $plugin->getTranslation(self::getLanguage()));
}
}
return $return;
}
示例8: findNewUpdateObject
public static function findNewUpdateObject()
{
foreach (plugin::listPlugin() as $plugin) {
$plugin_id = $plugin->getId();
$update = self::byTypeAndLogicalId('plugin', $plugin_id);
if (!is_object($update)) {
$update = new update();
$update->setLogicalId($plugin_id);
$update->setType('plugin');
$update->setLocalVersion(date('Y-m-d H:i:s'));
$update->save();
}
$find = array();
if (method_exists($plugin_id, 'listMarketObject')) {
foreach ($plugin_id::listMarketObject() as $logical_id) {
$find[$logical_id] = true;
$update = self::byTypeAndLogicalId($plugin_id, $logical_id);
if (!is_object($update)) {
$update = new update();
$update->setLogicalId($logical_id);
$update->setType($plugin_id);
$update->setLocalVersion(date('Y-m-d H:i:s'));
$update->save();
}
}
foreach (self::byType($plugin_id) as $update) {
if (!isset($find[$update->getLogicalId()])) {
$update->remove();
}
}
} else {
$values = array('type' => $plugin_id);
$sql = 'DELETE FROM `update`
WHERE type=:type';
DB::Prepare($sql, $values, DB::FETCH_TYPE_ROW);
}
}
}