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


PHP Error::getInstance方法代码示例

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


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

示例1: displayFooter

 /**
  * Display the HTML-Footer
  */
 public function displayFooter()
 {
     if (!Request::isAjax()) {
         include 'tpl/tpl.Frontend.footer.php';
     }
     Error::getInstance()->footer_sent = true;
 }
开发者ID:n0rthface,项目名称:Runalyze,代码行数:10,代码来源:class.FrontendSharedList.php

示例2: object

 /**
  * Get training object
  * @param int $index optional
  * @return \TrainingObject
  */
 public final function object($index = 0)
 {
     if ($index > 0) {
         Error::getInstance()->addDebug('ParserAbstractSingle has only one training, asked for index = ' . $index);
     }
     return $this->TrainingObject;
 }
开发者ID:9x,项目名称:Runalyze,代码行数:12,代码来源:class.ParserAbstractSingle.php

示例3: canHandleData

 /**
  * Can the strategy handle the data?
  * 
  * To test this, we try to fetch a gtopo30-value.
  * This costs only 0.1 credit per call.
  * 
  * We assume that Geonames will find elevation data for all points.
  * 
  * @see http://www.geonames.org/export/webservice-exception.html
  */
 public function canHandleData()
 {
     $url = 'http://api.geonames.org/gtopo30JSON?lat=47.01&lng=10.2&username=' . $this->USERNAME;
     $response = json_decode(\Filesystem::getExternUrlContent($url), true);
     if (is_null($response)) {
         return false;
     }
     if (isset($response['gtopo30'])) {
         return true;
     }
     if (isset($response['status']) && isset($response['status']['value'])) {
         switch ((int) $response['status']['value']) {
             case 10:
                 \Error::getInstance()->addWarning('Geonames user account is not valid.');
                 break;
             case 18:
                 \Error::getInstance()->addDebug('Geonames-request failed: daily limit of credits exceeded');
                 break;
             case 19:
                 \Error::getInstance()->addDebug('Geonames-request failed: hourly limit of credits exceeded');
                 break;
             case 20:
                 \Error::getInstance()->addDebug('Geonames-request failed: weekly limit of credits exceeded');
                 break;
             default:
                 if (isset($response['status']['message'])) {
                     \Error::getInstance()->addDebug('Geonames response: ' . $response['status']['message']);
                 }
         }
     }
     return false;
 }
开发者ID:guancio,项目名称:Runalyze,代码行数:42,代码来源:Geonames.php

示例4: object

 /**
  * Get training object
  * @param int $index optional index
  * @return TrainingObject
  */
 public final function object($index = 0)
 {
     if (!isset($this->TrainingObjects[$index])) {
         Error::getInstance()->addDebug('Parser has only ' . $this->numberOfTrainings() . ' trainings, but asked for index = ' . $index);
         return end($this->TrainingObjects);
     }
     return $this->TrainingObjects[$index];
 }
开发者ID:9x,项目名称:Runalyze,代码行数:13,代码来源:class.ParserAbstractMultiple.php

示例5: __construct

 /**
  * Constructor
  */
 function __construct($url = null)
 {
     $this->url = "";
     $this->module = null;
     $this->action = null;
     $this->args = array();
     $this->error = Error::getInstance();
     $this->addGetParameters();
     $this->addPostParameters();
     $this->parseUrl($url);
 }
开发者ID:ripplecrpht,项目名称:ripplecrpht,代码行数:14,代码来源:HttpRequest.class.php

示例6: initPlugin

 /**
  * Initialize this plugin
  * @see PluginPanel::initPlugin()
  */
 protected function initPlugin()
 {
     $this->fileNameStart = SessionAccountHandler::getId() . '-runalyze-backup';
     if (isset($_GET['json'])) {
         if (move_uploaded_file($_FILES['qqfile']['tmp_name'], realpath(dirname(__FILE__)) . '/import/' . $_FILES['qqfile']['name'])) {
             Error::getInstance()->footer_sent = true;
             echo '{"success":true}';
         } else {
             echo '{"error":"Moving file did not work. Set chmod 777 for ' . realpath(dirname(__FILE__)) . '/import/"}';
         }
         exit;
     }
 }
开发者ID:Nugman,项目名称:Runalyze,代码行数:17,代码来源:class.RunalyzePluginTool_DbBackup.php

示例7: sendMail

 /**
  * Send an email via smtp
  * @param string $to
  * @param string $subject
  * @param string $message
  * @return boolean 
  */
 public static function sendMail($to, $subject, $message)
 {
     $sender = MAIL_SENDER == '' ? 'mail@runalyze.de' : MAIL_SENDER;
     try {
         $message = Swift_Message::newInstance()->setSubject($subject)->setBody($message, 'text/html')->setFrom(array($sender => MAIL_NAME))->setTo($to);
         $transport = Swift_SmtpTransport::newInstance(SMTP_HOST, SMTP_PORT, SMTP_SECURITY)->setUsername(SMTP_USERNAME)->setPassword(SMTP_PASSWORD);
         $mailer = Swift_Mailer::newInstance($transport);
         return $mailer->send($message);
     } catch (Exception $e) {
         Error::getInstance()->addError('Mail could not be sent: ' . $e->getMessage());
         return false;
     }
 }
开发者ID:n0rthface,项目名称:Runalyze,代码行数:20,代码来源:class.System.php

示例8: displayFooter

 /**
  * Function to display the HTML-Footer
  */
 public function displayFooter()
 {
     if (!Request::isAjax()) {
         if (self::$IS_IFRAME) {
             include 'tpl/tpl.FrontendSharedIframe.footer.php';
         }
         include 'tpl/tpl.Frontend.footer.php';
     }
     if (RUNALYZE_DEBUG && Error::getInstance()->hasErrors()) {
         Error::getInstance()->display();
     }
     Error::getInstance()->footer_sent = true;
 }
开发者ID:9x,项目名称:Runalyze,代码行数:16,代码来源:class.FrontendShared.php

示例9: asString

 /**
  * Get clothes as string
  * @return string
  */
 public function asString()
 {
     $usedClothes = array();
     $clothes = ClothesFactory::AllClothes();
     foreach ($this->ids as $id) {
         $id = (int) trim($id);
         if (isset($clothes[$id])) {
             $usedClothes[] = $clothes[$id]['name'];
         } else {
             Error::getInstance()->addWarning('Asked for unknown clothes-ID: "' . $id . '"');
         }
     }
     return implode(', ', $usedClothes);
 }
开发者ID:n0rthface,项目名称:Runalyze,代码行数:18,代码来源:class.Clothes.php

示例10: canHandleData

 /**
  * Can the strategy handle the data?
  * 
  * We assume that DataScienceToolkit will find elevation data for all points.
  * 
  * @see http://www.datasciencetoolkit.org/developerdocs#coordinates2statistics
  */
 public function canHandleData()
 {
     $url = 'http://www.datasciencetoolkit.org/coordinates2statistics/49.4%2c7.7?statistics=elevation';
     $response = json_decode(\Filesystem::getExternUrlContent($url), true);
     if (is_null($response)) {
         return false;
     }
     if (is_array($response) && isset($response[0]['statistics'])) {
         return true;
     }
     if (isset($response['error'])) {
         \Error::getInstance()->addDebug('DataScienceToolkit response: ' . $response['error']);
     }
     return false;
 }
开发者ID:n0rthface,项目名称:Runalyze,代码行数:22,代码来源:DataScienceToolkit.php

示例11: canHandleData

 /**
  * Can the strategy handle the data?
  * 
  * We assume that GoogleMaps will find elevation data for all points.
  * 
  * @see https://developers.google.com/maps/documentation/elevation/?hl=de&csw=1
  */
 public function canHandleData()
 {
     $url = 'http://maps.googleapis.com/maps/api/elevation/json?locations=49.4,7.7&sensor=false';
     $response = json_decode(\Filesystem::getExternUrlContent($url), true);
     if (is_null($response)) {
         return false;
     }
     if (is_array($response) && isset($response['results'])) {
         return true;
     }
     if (isset($response['status'])) {
         \Error::getInstance()->addDebug('GoogleMaps response: ' . $response['status']);
     }
     return false;
 }
开发者ID:guancio,项目名称:Runalyze,代码行数:22,代码来源:GoogleMaps.php

示例12: loadFile

 /**
  * Load file
  */
 protected function loadFile()
 {
     if (!file_exists($this->schemeFile)) {
         Error::getInstance()->addError('Cannot find database scheme: ' . $this->schemeFile);
         return;
     } else {
         include $this->schemeFile;
         if (!isset($TABLENAME) || !isset($FIELDS) || !isset($FIELDSETS)) {
             Error::getInstance()->addError('$TABLENAME, $FIELDS and $FIELDSETS must be defined in scheme file: ' . $this->schemeFile);
         } else {
             $this->tableName = PREFIX . $TABLENAME;
             $this->fields = array_merge($this->fields, $FIELDS);
             $this->fieldsets = array_merge($this->fieldsets, $FIELDSETS);
             $this->hiddenKeys = array_merge($this->hiddenKeys, $HIDDEN_KEYS);
         }
     }
 }
开发者ID:n0rthface,项目名称:Runalyze,代码行数:20,代码来源:class.DatabaseScheme.php

示例13: display

 public static function display($date, $format = self::SHORT_FORMAT, $language = null, $useOrdinalSuffix = true, $timeZone = null)
 {
     $returnValue = '';
     $currentLocale = setlocale(LC_TIME, 0);
     $currentTimeZone = 'America/Montreal';
     $defaultLanguage = 'fr';
     $timeZones = DateTimeZone::listIdentifiers();
     $dateTimeZone = new DateTimeZone(in_array($timeZone, $timeZones) ? $timeZone : $currentTimeZone);
     $currentDateTimeZone = new DateTimeZone($currentTimeZone);
     try {
         if (!is_null($language)) {
             $language = $defaultLanguage;
         }
         /*if (!is_null($language)) {
               $locales = array(
                   'fr_CA' => array('fr_CA.UTF-8', 'fr_CA.utf8', 'fra'),
                   'en_CA' => array('en_CA.UTF-8', 'en_CA.utf8'),
               );
               if (isset($locales[$language])) {
                   setlocale(LC_TIME,  $locales[$language]);
               } else {
                   $language = $defaultLanguage;
               }
           } else {
               $language = strstr($currentLocale, '.', true); // Take only characters before dot
           }*/
         if (!empty($date)) {
             $dateTime = new DateTime(is_numeric($date) ? "@{$date}" : $date);
             if (!is_null($timeZone)) {
                 // if timezone is not null, display date with the good one.
                 $dateTime->setTimestamp($dateTime->getTimestamp() + $dateTimeZone->getOffset($dateTime));
             }
             $ordinalSuffix = $useOrdinalSuffix ? $dateTime->format('S') : '';
             $returnValue = strftime(self::getFormat($language, $format, $ordinalSuffix), $dateTime->getTimestamp());
         }
     } catch (Exception $e) {
         Error::getInstance()->log('[' . date('Y-m-d H:i:s') . ' ] - SimpleDate::display() - ' . $e->getMessage() . "\n");
         $returnValue = $date;
     }
     setlocale(LC_TIME, $currentLocale);
     return $returnValue;
 }
开发者ID:jabouzi,项目名称:paypal,代码行数:42,代码来源:Date.php

示例14: __construct

 public function __construct($url = "")
 {
     if (!defined('COOLPOST')) {
         die("ERROR HACK");
         exit;
     }
     $this->siteClose();
     if (!empty($_GET["url"])) {
         $url = $_GET["url"];
     }
     $url = rtrim($url, '/');
     $url = explode('/', $url);
     $file = ENGINE_DIR . '/controllers/' . $url[0] . '.class.php';
     if (file_exists($file)) {
         if (!$this->controllerAllowed($url[0])) {
             $controller = Error::getInstance();
         } else {
             $controller = new $url[0]();
         }
     } else {
         if (empty($url[0])) {
             $controller = new Index();
         } else {
             $controller = Error::getInstance();
         }
     }
     if (!empty($url[1]) && isset($url[1])) {
         if (!$this->methodAllowed($controller, $url[1])) {
             $controller = Error::getInstance();
         } else {
             if (!empty($url[2])) {
                 $controller->{$url}[1]($url[2]);
             } else {
                 $controller->{$url}[1]();
             }
         }
     } else {
         $controller->defaultPage();
     }
 }
开发者ID:barabash97,项目名称:coolpost,代码行数:40,代码来源:init.php

示例15: object

 /**
  * Get training objects
  * @param int $index optional index
  * @return array array of TrainingObject
  */
 public final function object($index = 0)
 {
     if (is_null($this->Parser)) {
         Error::getInstance()->addError('Parser of Importer is empty. Returned default TrainingObject.');
         return new TrainingObject(DataObject::$DEFAULT_ID);
     }
     return $this->Parser->object($index);
 }
开发者ID:n0rthface,项目名称:Runalyze,代码行数:13,代码来源:class.ImporterFiletypeAbstract.php


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