本文整理汇总了PHP中plugin::byId方法的典型用法代码示例。如果您正苦于以下问题:PHP plugin::byId方法的具体用法?PHP plugin::byId怎么用?PHP plugin::byId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类plugin
的用法示例。
在下文中一共展示了plugin::byId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: jeedomPluginAutoload
function jeedomPluginAutoload($classname)
{
$plugin = null;
try {
$plugin = plugin::byId($classname);
} catch (Exception $e) {
if (!is_object($plugin)) {
if (strpos($classname, 'Real') !== false) {
$plugin = plugin::byId(substr($classname, 0, -4));
}
if (!is_object($plugin) && strpos($classname, 'Cmd') !== false) {
$classname = str_replace('Cmd', '', $classname);
try {
$plugin = plugin::byId($classname);
} catch (Exception $e) {
if (strpos($classname, '_') !== false && strpos($classname, 'com_') === false) {
$plugin = plugin::byId(substr($classname, 0, strpos($classname, '_')));
}
}
}
if (!is_object($plugin) && strpos($classname, '_') !== false && strpos($classname, 'com_') === false) {
$plugin = plugin::byId(substr($classname, 0, strpos($classname, '_')));
}
}
}
try {
if (is_object($plugin)) {
if ($plugin->isActive() == 1) {
$include = $plugin->getInclude();
include_file('core', $include['file'], $include['type'], $plugin->getId());
}
}
} catch (Exception $e) {
}
}
示例2: getClass
private static function getClass($_id)
{
if (get_called_class() != __CLASS__) {
return get_called_class();
}
$values = array('id' => $_id);
$sql = 'SELECT plugin,isEnable
FROM eqLogic
WHERE eqReal_id=:id';
$result = DB::Prepare($sql, $values, DB::FETCH_TYPE_ROW);
$eqTyme_name = $result['plugin'];
if ($result['isEnable'] == 0) {
try {
$plugin = null;
if ($eqTyme_name != '') {
$plugin = plugin::byId($eqTyme_name);
}
if (!is_object($plugin) || $plugin->isActive() == 0) {
return __CLASS__;
}
} catch (Exception $e) {
return __CLASS__;
}
}
if (class_exists($eqTyme_name)) {
if (method_exists($eqTyme_name, 'getClassCmd')) {
return $eqTyme_name::getClassCmd();
}
}
if (class_exists($eqTyme_name . 'Real')) {
return $eqTyme_name . 'Real';
}
return __CLASS__;
}
示例3: Exception
<?php
if (!isConnect('admin')) {
throw new Exception('{{401 - Accès non autorisé}}');
}
$plugin = plugin::byId('denonavr');
sendVarToJS('eqType', $plugin->getId());
$eqLogics = eqLogic::byType($plugin->getId());
?>
<div class="row row-overflow">
<div class="col-lg-2 col-md-3 col-sm-4">
<div class="bs-sidebar">
<ul id="ul_eqLogic" class="nav nav-list bs-sidenav">
<a class="btn btn-default eqLogicAction" style="width : 100%;margin-top : 5px;margin-bottom: 5px;" data-action="add"><i class="fa fa-plus-circle"></i> {{Ajouter un template}}</a>
<li class="filter" style="margin-bottom: 5px;"><input class="filter form-control input-sm" placeholder="{{Rechercher}}" style="width: 100%"/></li>
<?php
foreach ($eqLogics as $eqLogic) {
echo '<li class="cursor li_eqLogic" data-eqLogic_id="' . $eqLogic->getId() . '"><a>' . $eqLogic->getHumanName(true) . '</a></li>';
}
?>
</ul>
</div>
</div>
<div class="col-lg-10 col-md-9 col-sm-8 eqLogicThumbnailDisplay" style="border-left: solid 1px #EEE; padding-left: 25px;">
<legend>{{Mes Denons}}
</legend>
<div class="eqLogicThumbnailContainer">
<div class="cursor eqLogicAction" data-action="add" style="background-color : #ffffff; height : 200px;margin-bottom : 10px;padding : 5px;border-radius: 2px;width : 160px;margin-left : 10px;" >
示例4: dirname
require_once dirname(__FILE__) . "/core.inc.php";
if (isset($argv)) {
foreach ($argv as $arg) {
$argList = explode('=', $arg);
if (isset($argList[0]) && isset($argList[1])) {
$_GET[$argList[0]] = $argList[1];
}
}
}
try {
set_time_limit(config::byKey('maxExecTimeScript', 10));
$plugin_id = init('plugin_id');
if ($plugin_id == '') {
throw new Exception(__('Le plugin ID ne peut être vide', __FILE__));
}
$plugin = plugin::byId($plugin_id);
if (!is_object($plugin)) {
throw new Exception(__('Plugin non trouvé : ', __FILE__) . init('plugin_id'));
}
$function = init('function');
if ($function == '') {
throw new Exception(__('La fonction ne peut être vide', __FILE__));
}
if (!class_exists($plugin_id) || !method_exists($plugin_id, $function)) {
throw new Exception(__('Il n\'existe aucune méthode : ', __FILE__) . $plugin_id . '::' . $function);
}
// log::add(init('plugin_id', 'plugin'), 'info', __('Lancement de ', __FILE__) . $plugin_id . '::' . $function . '()');
$plugin_id::$function();
} catch (Exception $e) {
log::add(init('plugin_id', 'plugin'), 'error', $e->getMessage());
die($e->getMessage());
示例5: Exception
throw new Exception('{{401 - Accès non autorisé}}');
}
sendVarToJS('market_display_info', array('logicalId' => init('logicalId'), 'name' => init('name')));
sendVarToJS('market_type', init('type'));
try {
if (init('logicalId') != '' && init('type') != '') {
$market = market::byLogicalIdAndType(init('logicalId'), init('type'));
}
} catch (Exception $e) {
$market = null;
}
if (is_object($market) && !$market->getIsAuthor()) {
throw new Exception('{{Vous n\'êtes pas l\'auteur du plugin}}');
}
if (init('type') == 'plugin') {
$plugin = plugin::byId(init('logicalId'));
if (!is_object($plugin)) {
throw new Exception('{{Le plugin :}} ' . init('logicalId') . ' {{est introuvable}}');
}
$plugin_info = utils::o2a($plugin);
$plugin_info['logicalId'] = $plugin_info['id'];
unset($plugin_info['id']);
sendVarToJS('market_display_info', $plugin_info);
}
?>
<div style="display: none;width : 100%" id="div_alertMarketSend"></div>
<a class="btn btn-success pull-right" style="color : white;" id="bt_sendToMarket"><i class="fa fa-cloud-upload"></i> {{Envoyer}}</a>
示例6:
if (count($matches) == 4 && @is_numeric($matches[1][0]) && @$matches[1][0] != '' && @is_numeric($matches[2][0]) && @$matches[2][0] != '' && @is_numeric($matches[3][0]) && @$matches[3][0] != '') {
$value = 'data[0].' . $value;
}
$cmd->setConfiguration('value', $value);
if ($eqLogic->getConfiguration('device') == 'fibaro.fgrm221') {
if ($cmd->getConfiguration('class') == '0x25' && $this->getConfiguration('data[0].val') && $this->getType() == 'info') {
$cmd->setConfiguration('class', '0x26');
}
}
if ($eqLogic->getConfiguration('device') == 'fibaro.fgs221') {
if ($cmd->getConfiguration('instanceId') == 1) {
$cmd->setConfiguration('instanceId', 0);
}
if ($cmd->getConfiguration('instanceId') == 2) {
$cmd->setConfiguration('instanceId', 1);
}
}
$cmd->save();
}
}
$cron = cron::byClassAndFunction('zwave', 'pull');
if (is_object($cron)) {
$cron->halt();
$cron->remove();
}
$plugin = plugin::byId('zwave');
if (is_object($plugin)) {
$plugin->setIsEnable(0);
}
echo "\nFin de la migration vers openzwave!!!!!!";
echo "\n/!\\IL EST VIVEMENT CONSEILLE DE REDEMARRER JEEDOM/!\\ ";
示例7: remove
public function remove()
{
$cache = cache::byKey('market::info::' . $this->getLogicalId());
if (is_object($cache)) {
$cache->remove();
}
switch ($this->getType()) {
case 'plugin':
try {
$plugin = plugin::byId($this->getLogicalId());
if (is_object($plugin)) {
try {
$plugin->setIsEnable(0);
} catch (Exception $e) {
}
foreach (eqLogic::byType($this->getLogicalId()) as $eqLogic) {
try {
$eqLogic->remove();
} catch (Exception $e) {
}
}
}
config::remove('*', $this->getLogicalId());
} catch (Exception $e) {
}
try {
$cibDir = dirname(__FILE__) . '/../../plugins/' . $this->getLogicalId();
if (file_exists($cibDir)) {
rrmdir($cibDir);
}
} catch (Exception $e) {
}
break;
default:
$type = $this->getType();
if (class_exists($type) && method_exists($type, 'removeFromMarket')) {
$type::removeFromMarket($this);
}
break;
}
$update = update::byTypeAndLogicalId($this->getType(), $this->getLogicalId());
if (is_object($update)) {
$update->remove();
}
}
示例8: Exception
<?php
if (!isConnect('admin')) {
throw new Exception('{{401 - Accès non autorisé}}');
}
$plugin = plugin::byId('ecowatt');
sendVarToJS('eqType', $plugin->getId());
$eqLogics = eqLogic::byType($plugin->getId());
?>
<div class="row row-overflow">
<div class="col-lg-2 col-md-3 col-sm-4">
<div class="bs-sidebar">
<ul id="ul_eqLogic" class="nav nav-list bs-sidenav">
<a class="btn btn-default eqLogicAction" style="width : 100%;margin-top : 5px;margin-bottom: 5px;" data-action="add"><i class="fa fa-plus-circle"></i> {{Ajouter un ecowatt}}</a>
<li class="filter" style="margin-bottom: 5px;"><input class="filter form-control input-sm" placeholder="{{Rechercher}}" style="width: 100%"/></li>
<?php
foreach ($eqLogics as $eqLogic) {
echo '<li class="cursor li_eqLogic" data-eqLogic_id="' . $eqLogic->getId() . '"><a>' . $eqLogic->getHumanName(true) . '</a></li>';
}
?>
</ul>
</div>
</div>
<div class="col-lg-10 col-md-9 col-sm-8 eqLogicThumbnailDisplay" style="border-left: solid 1px #EEE; padding-left: 25px;">
<legend>{{Mes Eco 2 Watts}}
</legend>
<div class="eqLogicThumbnailContainer">
<div class="cursor eqLogicAction" data-action="add" style="text-align: center; background-color : #ffffff; height : 200px;margin-bottom : 10px;padding : 5px;border-radius: 2px;width : 160px;margin-left : 10px;" >
<i class="fa fa-plus-circle" style="font-size : 7em;color:#94ca02;"></i>
示例9: Exception
<?php
if (!isConnect('admin')) {
throw new Exception('{{401 - Accès non autorisé}}');
}
$plugin = plugin::byId('nabaztag');
sendVarToJS('eqType', $plugin->getId());
$eqLogics = eqLogic::byType($plugin->getId());
?>
<div class="row row-overflow">
<div class="col-sm-2">
<div class="bs-sidebar">
<ul id="ul_eqLogic" class="nav nav-list bs-sidenav">
<a class="btn btn-default eqLogicAction" style="width : 100%;margin-top : 5px;margin-bottom: 5px;" data-action="add"><i class="fa fa-plus-circle"></i> {{Ajouter un équipement}}</a>
<li class="filter" style="margin-bottom: 5px;"><input class="filter form-control input-sm" placeholder="{{Rechercher}}" style="width: 100%"/></li>
<?php
foreach ($eqLogics as $eqLogic) {
$opacity = $eqLogic->getIsEnable() ? '' : jeedom::getConfiguration('eqLogic:style:noactive');
echo '<li class="cursor li_eqLogic" data-eqLogic_id="' . $eqLogic->getId() . '" style="' . $opacity . '"><a>' . $eqLogic->getHumanName(true) . '</a></li>';
}
?>
</ul>
</div>
</div>
<div class="col-lg-10 col-md-9 col-sm-8 eqLogicThumbnailDisplay" style="border-left: solid 1px #EEE; padding-left: 25px;">
<legend>{{Mes Nabaztag}}
</legend>
<?php
if (count($eqLogics) == 0) {
echo "<br/><br/><br/><center><span style='color:#767676;font-size:1.2em;font-weight: bold;'>{{Vous n'avez pas encore de Nabaztag, cliquez sur Ajouter pour commencer}}</span></center>";
示例10: Exception
<?php
if (!isConnect('admin')) {
throw new Exception('{{401 - Accès non autorisé}}');
}
$plugin = plugin::byId('karotz');
sendVarToJS('eqType', $plugin->getId());
$eqLogics = eqLogic::byType($plugin->getId());
?>
<div class="row row-overflow">
<div class="col-lg-2">
<div class="bs-sidebar">
<ul id="ul_eqLogic" class="nav nav-list bs-sidenav">
<a class="btn btn-default eqLogicAction" style="width : 100%;margin-top : 5px;margin-bottom: 5px;" data-action="add"><i class="fa fa-plus-circle"></i> {{Ajouter un Karotz}}</a>
<li class="filter" style="margin-bottom: 5px;"><input class="filter form-control input-sm" placeholder="{{Rechercher}}" style="width: 100%"/></li>
<?php
foreach ($eqLogics as $eqLogic) {
echo '<li class="cursor li_eqLogic" data-eqLogic_id="' . $eqLogic->getId() . '"><a>' . $eqLogic->getHumanName(true) . '</a></li>';
}
?>
</ul>
</div>
</div>
<div class="col-lg-10 col-md-9 col-sm-8 eqLogicThumbnailDisplay" style="border-left: solid 1px #EEE; padding-left: 25px;">
<legend>{{Mes Karotzs}}</legend>
<div class="eqLogicThumbnailContainer">
<div class="cursor eqLogicAction" data-action="add" style="text-align: center; background-color : #ffffff; height : 200px;margin-bottom : 10px;padding : 5px;border-radius: 2px;width : 160px;margin-left : 10px;" >
<i class="fa fa-plus-circle" style="font-size : 7em;color:#94ca02;"></i>
<br>
<span style="font-size : 1.1em;position:relative; top : 23px;word-break: break-all;white-space: pre-wrap;word-wrap: break-word;;color:#94ca02">Ajouter</span>
示例11: Exception
<?php
if (!isConnect('admin')) {
throw new Exception('{{401 - Accès non autorisé}}');
}
$plugin = plugin::byId('mode');
sendVarToJS('eqType', $plugin->getId());
$eqLogics = eqLogic::byType($plugin->getId());
?>
<div class="row row-overflow">
<div class="col-lg-2 col-md-3 col-sm-4">
<div class="bs-sidebar">
<ul id="ul_eqLogic" class="nav nav-list bs-sidenav">
<a class="btn btn-default eqLogicAction" style="width : 100%;margin-top : 5px;margin-bottom: 5px;" data-action="add"><i class="fa fa-plus-circle"></i> {{Ajouter un mode}}</a>
<li class="filter" style="margin-bottom: 5px;"><input class="filter form-control input-sm" placeholder="{{Rechercher}}" style="width: 100%"/></li>
<?php
foreach ($eqLogics as $eqLogic) {
$opacity = $eqLogic->getIsEnable() ? '' : jeedom::getConfiguration('eqLogic:style:noactive');
echo '<li class="cursor li_eqLogic" data-eqLogic_id="' . $eqLogic->getId() . '" style="' . $opacity . '"><a>' . $eqLogic->getHumanName(true) . '</a></li>';
}
?>
</ul>
</div>
</div>
<div class="col-lg-10 col-md-9 col-sm-8 eqLogicThumbnailDisplay" style="border-left: solid 1px #EEE; padding-left: 25px;">
<legend><i class="fa fa-th-large"></i> {{Mes Modes}}
</legend>
<div class="eqLogicThumbnailContainer">
<div class="cursor eqLogicAction" data-action="add" style="text-align: center; background-color : #ffffff; height : 200px;margin-bottom : 10px;padding : 5px;border-radius: 2px;width : 160px;margin-left : 10px;" >
示例12: Exception
<?php
if (!isConnect('admin')) {
throw new Exception('{{401 - Accès non autorisé}}');
}
$plugin = plugin::byId('openvpn');
sendVarToJS('eqType', $plugin->getId());
$eqLogics = eqLogic::byType($plugin->getId());
?>
<div class="row row-overflow">
<div class="col-lg-2 col-md-3 col-sm-4">
<div class="bs-sidebar">
<ul id="ul_eqLogic" class="nav nav-list bs-sidenav">
<a class="btn btn-default eqLogicAction" style="width : 100%;margin-top : 5px;margin-bottom: 5px;" data-action="add"><i class="fa fa-plus-circle"></i> {{Ajouter un openvpn}}</a>
<li class="filter" style="margin-bottom: 5px;"><input class="filter form-control input-sm" placeholder="{{Rechercher}}" style="width: 100%"/></li>
<?php
foreach ($eqLogics as $eqLogic) {
echo '<li class="cursor li_eqLogic" data-eqLogic_id="' . $eqLogic->getId() . '"><a>' . $eqLogic->getHumanName() . '</a></li>';
}
?>
</ul>
</div>
</div>
<div class="col-lg-10 col-md-9 col-sm-8 eqLogicThumbnailDisplay" style="border-left: solid 1px #EEE; padding-left: 25px;">
<legend>{{Mes openvpns}}
</legend>
<div class="eqLogicThumbnailContainer">
<div class="cursor eqLogicAction" data-action="add" style="text-align: center; background-color : #ffffff; height : 200px;margin-bottom : 10px;padding : 5px;border-radius: 2px;width : 160px;margin-left : 10px;" >
示例13: Exception
<?php
if (!isConnect('admin')) {
throw new Exception('{{401 - Accès non autorisé}}');
}
$plugin = plugin::byId('wazeintime');
sendVarToJS('eqType', $plugin->getId());
$eqLogics = eqLogic::byType($plugin->getId());
?>
<div class="row row-overflow">
<div class="col-lg-2">
<div class="bs-sidebar">
<ul id="ul_eqLogic" class="nav nav-list bs-sidenav">
<a class="btn btn-default eqLogicAction" style="width : 100%;margin-top : 5px;margin-bottom: 5px;" data-action="add"><i class="fa fa-plus-circle"></i> {{Ajouter un trajet}}</a>
<li class="filter" style="margin-bottom: 5px;"><input class="filter form-control input-sm" placeholder="{{Rechercher}}" style="width: 100%"/></li>
<?php
foreach ($eqLogics as $eqLogic) {
echo '<li class="cursor li_eqLogic" data-eqLogic_id="' . $eqLogic->getId() . '"><a>' . $eqLogic->getHumanName(true) . '</a></li>';
}
?>
</ul>
</div>
</div>
<div class="col-lg-10 col-md-9 col-sm-8 eqLogicThumbnailDisplay" style="border-left: solid 1px #EEE; padding-left: 25px;">
<legend><i class="fa fa-car"></i> {{Mes Trajets}}
</legend>
<div class="eqLogicThumbnailContainer">
<div class="cursor eqLogicAction" data-action="add" style="text-align: center; background-color : #ffffff; height : 200px;margin-bottom : 10px;padding : 5px;border-radius: 2px;width : 160px;margin-left : 10px;" >
<i class="fa fa-plus-circle" style="font-size : 7em;color:#94ca02;"></i>
<br>
<span style="font-size : 1.1em;position:relative; top : 23px;word-break: break-all;white-space: pre-wrap;word-wrap: break-word;;color:#94ca02">Ajouter</span>
示例14: changeMode
public static function changeMode($_mode)
{
switch ($_mode) {
case 'master':
if (config::byKey('jeeNetwork::mode') != 'master') {
$cron = new cron();
$cron->setClass('history');
$cron->setFunction('historize');
$cron->setSchedule('*/5 * * * * *');
$cron->setTimeout(5);
$cron->save();
$cron = new cron();
$cron->setClass('scenario');
$cron->setFunction('check');
$cron->setSchedule('* * * * * *');
$cron->setTimeout(5);
$cron->save();
$cron = new cron();
$cron->setClass('cmd');
$cron->setFunction('collect');
$cron->setSchedule('*/5 * * * * *');
$cron->setTimeout(5);
$cron->save();
$cron = new cron();
$cron->setClass('history');
$cron->setFunction('archive');
$cron->setSchedule('00 * * * * *');
$cron->setTimeout(20);
$cron->save();
config::save('jeeNetwork::mode', 'master');
}
break;
case 'slave':
if (config::byKey('jeeNetwork::mode') != 'slave') {
foreach (eqLogic::all() as $eqLogic) {
$eqLogic->remove();
}
foreach (object::all() as $object) {
$object->remove();
}
foreach (update::all() as $update) {
switch ($update->getType()) {
case 'core':
break;
case 'plugin':
try {
$plugin = plugin::byId($update->getLogicalId());
if (is_object($plugin) && $plugin->getAllowRemote() != 1) {
$update->deleteObjet();
}
} catch (Exception $e) {
}
break;
default:
$update->deleteObjet();
break;
}
}
foreach (view::all() as $view) {
$view->remove();
}
foreach (plan::all() as $plan) {
$plan->remove();
}
foreach (scenario::all() as $scenario) {
$scenario->remove();
}
foreach (listener::all() as $listener) {
$listener->remove();
}
$cron = cron::byClassAndFunction('history', 'historize');
if (is_object($cron)) {
$cron->remove();
}
$cron = cron::byClassAndFunction('scenario', 'check');
if (is_object($cron)) {
$cron->remove();
}
$cron = cron::byClassAndFunction('cmd', 'collect');
if (is_object($cron)) {
$cron->remove();
}
$cron = cron::byClassAndFunction('history', 'archive');
if (is_object($cron)) {
$cron->remove();
}
$user = new user();
$user->setLogin('jeedom_master');
$user->setPassword(config::genKey(255));
$user->setRights('admin', 1);
$user->save();
config::save('jeeNetwork::mode', 'slave');
}
break;
}
}
示例15: saveTranslation
public static function saveTranslation()
{
$core = array();
$plugins = array();
foreach (self::getTranslation(self::getLanguage()) as $page => $translation) {
if (strpos($page, 'plugins/') === false) {
$core[$page] = $translation;
} else {
$plugin = substr($page, strpos($page, 'plugins/') + 8);
$plugin = substr($plugin, 0, strpos($plugin, '/'));
if (!isset($plugins[$plugin])) {
$plugins[$plugin] = array();
}
$plugins[$plugin][$page] = $translation;
}
}
file_put_contents(self::getPathTranslationFile(self::getLanguage()), json_encode($core, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE));
foreach ($plugins as $plugin_name => $translation) {
try {
$plugin = plugin::byId($plugin_name);
$plugin->saveTranslation(self::getLanguage(), $translation);
} catch (Exception $e) {
}
}
}