当前位置: 首页>>代码示例>>PHP>>正文


PHP Functions::log方法代码示例

本文整理汇总了PHP中Functions::log方法的典型用法代码示例。如果您正苦于以下问题:PHP Functions::log方法的具体用法?PHP Functions::log怎么用?PHP Functions::log使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Functions的用法示例。


在下文中一共展示了Functions::log方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: classImplements

 /**
  * Checks whether a class implements an interface or not.
  * 
  * @param string $class Class to check
  * @param string $interface Interface to check
  * 
  * @return boolean Implements?
  */
 public static function classImplements($class, $interface)
 {
     $ref = new ReflectionClass($class);
     try {
         return $ref->implementsInterface($interface);
     } catch (Exception $e) {
         Functions::log(Functions::LOG_ERROR, $e->getMessage());
         return false;
     }
 }
开发者ID:GIDIX,项目名称:quicktalk,代码行数:18,代码来源:Functions.php

示例2: display

 public static function display($file, $returnValue = false)
 {
     global $errorMessage, $token;
     $user = self::getReadOnlyUser();
     $tplFile = self::getThemePath() . basename($file) . '.php';
     if (!is_file($tplFile)) {
         Functions::log(Functions::LOG_ERROR, 'Template for "' . $file . '.php" missing.');
     }
     if (strpos(file_get_contents($tplFile), 'global $') !== false) {
         Functions::log(Functions::LOG_ERROR, 'Invalid call in template "' . $file . '.php".');
     }
     if ($returnValue) {
         return $token->auto_append(file_get_contents($tplFile));
     } else {
         ob_start();
         include $tplFile;
         $content = ob_get_contents();
         ob_get_clean();
         $content = $token->auto_append($content);
         echo $content;
     }
 }
开发者ID:GIDIX,项目名称:quicktalk,代码行数:22,代码来源:Templates.php

示例3: radioRelay_action_radioRelay

function radioRelay_action_radioRelay()
{
    global $_, $conf, $myUser;
    //Mise à jour des droits
    $myUser->loadRight();
    switch ($_['action']) {
        case 'radioRelay_delete_radioRelay':
            if ($myUser->can('radio relais', 'd')) {
                $radioRelayManager = new RadioRelay();
                $radioRelayManager->delete(array('id' => $_['id']));
                header('location:setting.php?section=radioRelay');
            } else {
                header('location:setting.php?section=radioRelay&error=Vous n\'avez pas le droit de faire ça!');
            }
            break;
        case 'radioRelay_plugin_setting':
            $conf->put('plugin_radioRelay_emitter_pin', $_['emiterPin']);
            $conf->put('plugin_radioRelay_emitter_code', $_['emiterCode']);
            header('location: setting.php?section=preference&block=radioRelay');
            break;
        case 'radioRelay_add_radioRelay':
            //Vérifie si on veut modifier ou ajouter un relai
            $right_toverify = isset($_['id']) ? 'u' : 'c';
            if ($myUser->can('radio relais', $right_toverify)) {
                $radioRelay = new RadioRelay();
                //Si modification on charge la ligne au lieu de la créer
                if ($right_toverify == "u") {
                    $radioRelay = $radioRelay->load(array("id" => $_['id']));
                }
                $radioRelay->setName($_['nameRadioRelay']);
                $radioRelay->setDescription($_['descriptionRadioRelay']);
                $radioRelay->setRadioCode($_['radioCodeRadioRelay']);
                $radioRelay->setRoom($_['roomRadioRelay']);
                $radioRelay->setPulse($_['pulseRadioRelay']);
                $radioRelay->save();
                header('location:setting.php?section=radioRelay');
            } else {
                header('location:setting.php?section=radioRelay&error=Vous n\'avez pas le droit de faire ça!');
            }
            break;
        case 'radioRelay_change_state':
            global $_, $myUser;
            if ($myUser->can('radio relais', 'u')) {
                $radioRelay = new RadioRelay();
                $radioRelay = $radioRelay->getById($_['engine']);
                Event::emit('relay_change_state', array('relay' => $radioRelay, 'state' => $_['state']));
                if ($radioRelay->getPulse() == 0) {
                    $cmd = dirname(__FILE__) . '/radioEmission ' . $conf->get('plugin_radioRelay_emitter_pin') . ' ' . $conf->get('plugin_radioRelay_emitter_code') . ' ' . $radioRelay->getRadioCode() . ' ' . $_['state'];
                } else {
                    $cmd = dirname(__FILE__) . '/radioEmission ' . $conf->get('plugin_radioRelay_emitter_pin') . ' ' . $conf->get('plugin_radioRelay_emitter_code') . ' ' . $radioRelay->getRadioCode() . ' pulse ' . $radioRelay->getPulse();
                }
                //TODO change bdd state
                Functions::log('Launch system command : ' . $cmd);
                system($cmd, $out);
                if (!isset($_['webservice'])) {
                    header('location:index.php?module=room&id=' . $radioRelay->getRoom());
                } else {
                    $affirmations = array('A vos ordres!', 'Bien!', 'Oui commandant!', 'Avec plaisir!', 'J\'aime vous obéir!', 'Avec plaisir!', 'Certainement!', 'Je fais ça sans tarder!', 'Avec plaisir!', 'Oui chef!');
                    $affirmation = $affirmations[rand(0, count($affirmations) - 1)];
                    $response = array('responses' => array(array('type' => 'talk', 'sentence' => $affirmation)));
                    $json = json_encode($response);
                    echo $json == '[]' ? '{}' : $json;
                }
            } else {
                $response = array('responses' => array(array('type' => 'talk', 'sentence' => 'Je ne vous connais pas, je refuse de faire ça!')));
                echo json_encode($response);
            }
            break;
    }
}
开发者ID:thib3113,项目名称:yana-server,代码行数:70,代码来源:relay.plugin.disabled.php

示例4: unset

    unset($_POST[$token->getTokenName()]);
    $pageCreators = PluginHelper::delegate('__onCreatePage', array(substr($pageName, 0, strlen($pageName) - 4), $_GET));
    if (count($pageCreators) == 1) {
        // Get single page creator
        foreach ($pageCreators as $p) {
            $pageCreator = $p;
        }
        // Does it implement PageCreator?
        if (!$pageCreator instanceof PageCreator) {
            Functions::log(Functions::LOG_ERROR, get_class($pageCreator) . ' does not implement interface PageCreator');
        } else {
            Templates::assign('pageTitle', $pageCreator->getTitle());
            Templates::assign('customContent', $pageCreator->getContent());
            Templates::display('custom');
        }
        exit;
    } else {
        if (count($pageCreators) > 1) {
            // CLASH OF PLUGINS!!
            $errorMessage = 'Page Creator conflict for page ' . $pageName . ':<br /><br /><ul>';
            foreach ($pageCreators as $package => $pageCreator) {
                $errorMessage .= '<b>' . $package . '</b>: ' . get_class($pageCreator);
            }
            $errorMessage .= '</ul>';
            Functions::log(Functions::LOG_ERROR, $errorMessage);
            exit;
        }
    }
}
// Else, show 404 page
Templates::display('404');
开发者ID:GIDIX,项目名称:quicktalk,代码行数:31,代码来源:handler.php

示例5: radiorelay_plugin_change_state

function radiorelay_plugin_change_state($engine, $state)
{
    global $conf;
    $radioRelay = new RadioRelay();
    $radioRelay = $radioRelay->getById($engine);
    $cmd = dirname(__FILE__) . '/radioEmission ' . $conf->get('plugin_radioRelay_emitter_pin') . ' ' . $conf->get('plugin_radioRelay_emitter_code') . ' ' . $radioRelay->radiocode . ' ';
    $cmd .= $radioRelay->pulse == 0 ? $state == 1 ? 'on' : 'off' : 'pulse ' . $radioRelay->pulse;
    $radioRelay->state = $state;
    Functions::log('Launch system command : ' . $cmd);
    system($cmd, $out);
    $radioRelay->save();
}
开发者ID:kofeve,项目名称:yana-server,代码行数:12,代码来源:radioRelay.plugin.php

示例6: error

 protected function error($msg, $sql, $code)
 {
     Functions::log(Functions::LOG_ERROR, $msg . '<br /><br /><code class="important">' . $sql . '</code>');
     /* die('
     				<h1>Database Error ('.$code.')</h1>
     
     				'.(!is_null($sql) ? '<code>' . $sql . '</code>' : '').'
     				<p>'.$msg.'</p>
     			'); */
 }
开发者ID:GIDIX,项目名称:quicktalk,代码行数:10,代码来源:Database.php

示例7: wireRelay_action_wireRelay

function wireRelay_action_wireRelay()
{
    global $_, $conf, $myUser;
    switch ($_['action']) {
        case 'wireRelay_delete_wireRelay':
            if ($myUser->can('relais filaire', 'd')) {
                $wireRelayManager = new WireRelay();
                $wireRelayManager->delete(array('id' => $_['id']));
            }
            header('location:setting.php?section=wireRelay');
            break;
        case 'wireRelay_plugin_setting':
            $conf->put('plugin_wireRelay_emitter_pin', $_['emiterPin']);
            $conf->put('plugin_wireRelay_emitter_code', $_['emiterCode']);
            header('location: setting.php?section=preference&block=wireRelay');
            break;
        case 'wireRelay_add_wireRelay':
            if ($myUser->can('relais filaire', $_['id'] != '' ? 'u' : 'c')) {
                $wireRelayManager = new WireRelay();
                $wireRelay = $_['id'] != '' ? $wireRelayManager->getById($_['id']) : new WireRelay();
                $wireRelay->setName($_['nameWireRelay']);
                $wireRelay->setDescription($_['descriptionWireRelay']);
                $wireRelay->setPin($_['pinWireRelay']);
                $wireRelay->setRoom($_['roomWireRelay']);
                $wireRelay->setPulse($_['pulseWireRelay']);
                $wireRelay->save();
            }
            header('location:setting.php?section=wireRelay');
            break;
        case 'wireRelay_change_state':
            global $_, $myUser;
            if ($myUser->can('relais filaire', 'u')) {
                $wireRelay = new WireRelay();
                $wireRelay = $wireRelay->getById($_['engine']);
                //TODO - remplacer par Gpio::mode($wireRelay->getPin(),'out');
                $cmd = '/usr/local/bin/gpio mode ' . $wireRelay->getPin() . ' out';
                Functions::log('Launch system command : ' . $cmd);
                system($cmd, $out);
                if ($wireRelay->getPulse() == 0) {
                    //TODO - remplacer par Gpio::write($wireRelay->getPin(),$_['state']);
                    $cmd = '/usr/local/bin/gpio write ' . $wireRelay->getPin() . ' ' . $_['state'];
                    Functions::log('Launch system command : ' . $cmd);
                    system($cmd, $out);
                } else {
                    //TODO - remplacer par Gpio::write($wireRelay->getPin(),1);
                    $cmd = '/usr/local/bin/gpio write ' . $wireRelay->getPin() . ' 1';
                    system($cmd, $out);
                    usleep($wireRelay->getPulse());
                    //TODO - remplacer par Gpio::write($wireRelay->getPin(),0);
                    $cmd = '/usr/local/bin/gpio write ' . $wireRelay->getPin() . ' 0';
                    Functions::log('Launch system command : ' . $cmd);
                    system($cmd, $out);
                }
                //TODO change bdd state
                if (!isset($_['webservice'])) {
                    header('location:index.php?module=room&id=' . $wireRelay->getRoom());
                } else {
                    $affirmations = array('A vos ordres!', 'Bien!', 'Oui commandant!', 'Avec plaisir!', 'J\'aime vous obéir!', 'Avec plaisir!', 'Certainement!', 'Je fais ça sans tarder!', 'Avec plaisir!', 'Oui chef!');
                    $affirmation = $affirmations[rand(0, count($affirmations) - 1)];
                    $response = array('responses' => array(array('type' => 'talk', 'sentence' => $affirmation)));
                    $json = json_encode($response);
                    echo $json == '[]' ? '{}' : $json;
                }
            } else {
                $response = array('responses' => array(array('type' => 'talk', 'sentence' => 'Je ne vous connais pas, je refuse de faire ça!')));
                echo json_encode($response);
            }
            break;
    }
}
开发者ID:thib3113,项目名称:yana-server,代码行数:70,代码来源:relay.plugin.disabled.php

示例8: alterBase

 public static function alterBase($versions, $current)
 {
     $manager = new User();
     foreach ($versions as $version) {
         if ($version['version'] <= $current) {
             continue;
         }
         foreach ($version['sql'] as $command) {
             $sql = str_replace(array('{PREFIX}'), array(MYSQL_PREFIX), $command);
             Functions::log('Execute alter base query : ' . $sql);
             $manager->customQuery($sql);
         }
     }
 }
开发者ID:kofeve,项目名称:yana-server,代码行数:14,代码来源:Functions.class.php

示例9: command

 public static function command($cmd)
 {
     Functions::log('Launch system command : ' . $cmd);
     return system($cmd);
 }
开发者ID:parrain27,项目名称:yana-server,代码行数:5,代码来源:System.class.php

示例10: loadActivePlugins

 /**
  * Load plugins that are marked as active.
  * This also checks for the implementation of PluginInterface in the main class of the plugin.
  */
 public static function loadActivePlugins()
 {
     $plugins = self::getActivePlugins();
     foreach ($plugins as $plugin) {
         try {
             $pluginClass = self::getEntryPointClassForPlugin($plugin);
             // Load class
             include_once PATH . 'plugins/' . $plugin->getPackageName() . '/Plugin.php';
             // Finally, start plugin
             $p = new $pluginClass($plugin->getPackageName(), $plugin->getTitle(), $plugin->getDescription(), $plugin->getAuthor(), $plugin->getURL(), 1, $plugin->getID());
             if (!$p instanceof PluginInterface) {
                 throw new InvalidManifestException('Plugin ' . $plugin->getPackageName() . ' does not implement PluginInterface.', 42);
             }
             $plugins[$plugin->getPackageName()] = $p;
         } catch (InvalidManifestException $e) {
             Functions::log(Functions::LOG_ERROR, $e->getMessage());
         } catch (InvalidPluginException $e) {
             Functions::log(Functions::LOG_ERROR, $e->getMessage());
         }
     }
     self::$loadedPlugins = $plugins;
 }
开发者ID:GIDIX,项目名称:quicktalk,代码行数:26,代码来源:PluginHelper.php

示例11: scrapeFilmUserReviews

 /** FILM REVIEWS **/
 public function scrapeFilmUserReviews()
 {
     $numPages = 1090;
     // This number we've got after having run scrapeFilmList()
     for ($page = 1; $page <= $numPages; $page++) {
         Functions::log(PHP_EOL . "Page " . $page);
         Functions::log("========================");
         $pageFilms = $this->_retrieveFilmListPage($page);
         $films = $this->_parseFilmListPage($pageFilms);
         foreach ($films as $film) {
             Functions::log($film['name']);
             $filmHtml = $this->_retrieveFilmReviewsHtml($film['id']);
             $filmReviews = $this->parseFilmReviews($filmHtml, $film['id']);
             // Let's store in the DB
             $db = new Database(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
             $this->_saveFilmReviewsDB($db, $filmReviews);
         }
     }
 }
开发者ID:brunogarcia,项目名称:filmaffinity,代码行数:20,代码来源:Scraper.php


注:本文中的Functions::log方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。