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


PHP fCore类代码示例

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


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

示例1: email_plugin_notify

function email_plugin_notify($check,$check_result,$subscription,$alt_email=false) {
  global $status_array;
  $user = new User($subscription->getUserId());
  $email = new fEmail();
  // This sets up fSMTP to connect to the gmail SMTP server
  // with a 5 second timeout. Gmail requires a secure connection.
  $smtp = new fSMTP(sys_var('smtp_server'), sys_var('smtp_port'), TRUE, 5);
  $smtp->authenticate(sys_var('smtp_user'), sys_var('smtp_pass'));
  if ($alt_email) {
    $email_address = usr_var('alt_email',$user->getUserId());
  } else {
    $email_address = $user->getEmail(); 
  }
  $email->addRecipient($email_address, $user->getUsername());
  // Set who the email is from
  $email->setFromEmail(sys_var('email_from'), sys_var('email_from_display'));
  // Set the subject include UTF-8 curly quotes
  $email->setSubject(str_replace('{check_name}', $check->prepareName(), sys_var('email_subject')));
  // Set the body to include a string containing UTF-8
  $state = $status_array[$check_result->getStatus()];
  $email->setHTMLBody("<p>$state Alert for {$check->prepareName()} </p><p>The check returned {$check_result->prepareValue()}</p><p>Warning Threshold is : ". $check->getWarn() . "</p><p>Error Threshold is : ". $check->getError() . '</p><p>View Alert Details : <a href="' . fURL::getDomain() . '/' . CheckResult::makeURL('list',$check_result) . '">'.$check->prepareName()."</a></p>");
  $email->setBody("
  $state Alert for {$check->prepareName()}
The check returned {$check_result->prepareValue()}
Warning Threshold is : ". $check->getWarn() . "
Error Threshold is : ". $check->getError() . "
           ");
  try {  
    $message_id = $email->send($smtp);
  } catch ( fConnectivityException $e) { 
    fCore::debug("email send failed",FALSE);
  }
}
开发者ID:nleskiw,项目名称:Graphite-Tattle,代码行数:33,代码来源:email_plugin.php

示例2: email_notify

function email_notify($check,$check_result,$subscription) {
 global $status_array;
 $user = new User($subscription->getUserId());
 echo 'email plugin!';
 $email = new fEmail();
 // This sets up fSMTP to connect to the gmail SMTP server
 // with a 5 second timeout. Gmail requires a secure connection.
 $smtp = new fSMTP('smtp.gmail.com', 465, TRUE, 5);
 $smtp->authenticate('example@example.com', 'example');
 $email->addRecipient($user->getEmail(), $user->getUsername());
 // Set who the email is from
 $email->setFromEmail('flourish@example.com','Tattle');
 // Set the subject include UTF-8 curly quotes
 $email->setSubject('Tattle : Alert for ' . $check->prepareName());
 // Set the body to include a string containing UTF-8
 $state = $status_array[$check_result->getStatus()];
 $email->setHTMLBody("<p>$state Alert for {$check->prepareName()} </p><p>The check returned {$check_result->prepareValue()}</p><p>Warning Threshold is : ". $check->getWarn() . "</p><p>Error Threshold is : ". $check->getError() . '</p><p>View Alert Details : <a href="' . $fURL::getDomain() . '/' . CheckResult::makeURL('list',$check_result) . '">'.$check->prepareName()."</a></p>");
 $email->setBody("
$state Alert for {$check->prepareName()}
The check returned {$check_result->prepareValue()}
Warning Threshold is : ". $check->getWarn() . "
Error Threshold is : ". $check->getError() . "
           ");
 try {  
   $message_id = $email->send($smtp);
 } catch ( fConnectivityException $e) { 
   fCore::debug("email send failed",FALSE);
 }


}
开发者ID:rberger,项目名称:Graphite-Tattle,代码行数:31,代码来源:email_plugin.php

示例3: setUp

 public function setUp()
 {
     $_SERVER['SERVER_NAME'] = 'flourishlib.com';
     if (defined('EMAIL_DEBUG')) {
         fCore::enableDebugging(TRUE);
     }
 }
开发者ID:philip,项目名称:flourish,代码行数:7,代码来源:fSMTPTest.php

示例4: __destruct

 /**
  * Finishing placing elements if buffering was used
  * 
  * @internal
  * 
  * @return void
  */
 public function __destruct()
 {
     // The __destruct method can't throw unhandled exceptions intelligently, so we will always catch here just in case
     try {
         $this->placeBuffered();
     } catch (Exception $e) {
         fCore::handleException($e);
     }
 }
开发者ID:philip,项目名称:flourish,代码行数:16,代码来源:fTemplating.php

示例5: setUp

 public function setUp()
 {
     if (defined('SKIPPING') || !defined('EMAIL_PASSWORD')) {
         $this->markTestSkipped();
     }
     $_SERVER['SERVER_NAME'] = 'flourishlib.com';
     if (defined('EMAIL_DEBUG')) {
         fCore::enableDebugging(TRUE);
     }
 }
开发者ID:nurulimamnotes,项目名称:flourish-old,代码行数:10,代码来源:fSMTPTest.php

示例6: hipchat_master_notify

function hipchat_master_notify($check, $check_result, $subscription, $toUser = true)
{
    global $status_array;
    global $debug;
    if (!is_callable('curl_init')) {
        fCore::debug("!!! WARNING !!! function curl_init() not found, probably php-curl is not installed");
    }
    $state = $status_array[$check_result->getStatus()];
    if (strtolower($state) == 'ok') {
        $color = sys_var('hipchat_ok_color');
    } elseif (strtolower($state) == 'warning') {
        $color = sys_var('hipchat_warning_color');
    } elseif (strtolower($state) == 'error') {
        $color = sys_var('hipchat_error_color');
    }
    $url = $GLOBALS['TATTLE_DOMAIN'] . '/' . CheckResult::makeURL('list', $check_result);
    $data = array('color' => $color, 'notify' => sys_var('hipchat_notify') == 'true' ? true : false, 'message_format' => 'html', 'message' => "<b>" . $check->prepareName() . "</b><br />The check returned: {$check_result->getValue()}<br />View Alert Details : <a href=\"" . $url . "\">" . $url . "</a>");
    if ($debug && $toUser == false) {
        $url = 'https://api.hipchat.com/v2/room?auth_token=' . sys_var('hipchat_apikey');
        $c = curl_init();
        curl_setopt($c, CURLOPT_URL, $url);
        curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
        fCore::debug("Rooms: " . curl_exec($c) . "\n", FALSE);
        fCore::debug("URL: " . 'https://api.hipchat.com/v2/room/' . strtolower(sys_var('hipchat_room')) . '/notification?auth_token=' . sys_var('hipchat_apikey') . "\n", FALSE);
        fCore::debug("Data: " . print_r($data, true) . "\n", FALSE);
    }
    if ($toUser == false) {
        $url = 'https://api.hipchat.com/v2/room/' . strtolower(sys_var('hipchat_room')) . '/notification?auth_token=' . sys_var('hipchat_apikey');
    } else {
        $url = 'https://api.hipchat.com/v2/user/' . usr_var('hipchat_user', $subscription->getUserId()) . '/message?auth_token=' . sys_var('hipchat_apikey');
    }
    fCore::debug("HipChat Calling: {$url}", FALSE);
    $c = curl_init();
    curl_setopt($c, CURLOPT_URL, $url);
    curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($c, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Content-Length: ' . strlen(json_encode($data))));
    curl_setopt($c, CURLOPT_POSTFIELDS, json_encode($data));
    $response = curl_exec($c);
    if ($response === false) {
        fCore::debug("Curl error: " . curl_error($c) . "\n", FALSE);
    }
    echo "\n\nResponse: " . curl_getinfo($c, CURLINFO_HTTP_CODE) . ' - ' . $response . "\n\n";
}
开发者ID:nagyist,项目名称:Tattle,代码行数:43,代码来源:hipchat_plugin.php

示例7: __construct

 /**
  * Creates the time to represent, no timezone is allowed since times don't have timezones
  * 
  * @throws fValidationException  When `$time` is not a valid time
  * 
  * @param  fTime|object|string|integer $time  The time to represent, `NULL` is interpreted as now
  * @return fTime
  */
 public function __construct($time = NULL)
 {
     if ($time === NULL) {
         $timestamp = time();
     } elseif (is_numeric($time) && ctype_digit($time)) {
         $timestamp = (int) $time;
     } elseif (is_string($time) && in_array(strtoupper($time), array('CURRENT_TIMESTAMP', 'CURRENT_TIME'))) {
         $timestamp = time();
     } else {
         if (is_object($time) && is_callable(array($time, '__toString'))) {
             $time = $time->__toString();
         } elseif (is_numeric($time) || is_object($time)) {
             $time = (string) $time;
         }
         $time = fTimestamp::callUnformatCallback($time);
         $timestamp = strtotime($time);
     }
     $is_51 = fCore::checkVersion('5.1');
     $is_valid = $is_51 && $timestamp !== FALSE || !$is_51 && $timestamp !== -1;
     if (!$is_valid) {
         throw new fValidationException('The time specified, %s, does not appear to be a valid time', $time);
     }
     $this->time = strtotime(date('1970-01-01 H:i:s', $timestamp));
 }
开发者ID:JhunCabas,项目名称:material-management,代码行数:32,代码来源:fTime.php

示例8: __construct

 /**
  * Creates the date to represent, no timezone is allowed since dates don't have timezones
  *
  * @throws fValidationException  When `$date` is not a valid date
  *
  * @param  fDate|object|string|integer $date  The date to represent, `NULL` is interpreted as today
  * @return fDate
  */
 public function __construct($date = NULL)
 {
     if ($date === NULL) {
         $timestamp = time();
     } elseif (is_numeric($date) && preg_match('#^-?\\d+$#D', $date)) {
         $timestamp = (int) $date;
     } elseif (is_string($date) && in_array(strtoupper($date), array('CURRENT_TIMESTAMP', 'CURRENT_DATE'))) {
         $timestamp = time();
     } else {
         if (is_object($date) && is_callable(array($date, '__toString'))) {
             $date = $date->__toString();
         } elseif (is_numeric($date) || is_object($date)) {
             $date = (string) $date;
         }
         $date = fTimestamp::callUnformatCallback($date);
         $timestamp = strtotime(fTimestamp::fixISOWeek($date));
     }
     $is_51 = fCore::checkVersion('5.1');
     $is_valid = $is_51 && $timestamp !== FALSE || !$is_51 && $timestamp !== -1;
     if (!$is_valid) {
         throw new fValidationException('The date specified, %s, does not appear to be a valid date', $date);
     }
     $this->date = strtotime(date('Y-m-d 00:00:00', $timestamp));
 }
开发者ID:gopalgrover23,项目名称:flourish-classes,代码行数:32,代码来源:fDate.php

示例9: tearDown

 public function tearDown()
 {
     // There seems to be an issue with the sybase driver on netbsd which this
     // test triggers, causing a segfault
     if (DB_TYPE == 'mssql' && fCore::checkOS('netbsd')) {
         return;
     }
     if (defined('SKIPPING')) {
         return;
     }
     fORMDatabase::retrieve()->enableDebugging(FALSE);
     fORMRelated::reset();
 }
开发者ID:nurulimamnotes,项目名称:flourish-old,代码行数:13,代码来源:fRecordSetWithMultipleSchemasTest.php

示例10: tossIfDeleted

 /**
  * Throws an exception if the directory has been deleted
  * 
  * @return void
  */
 protected function tossIfDeleted()
 {
     if ($this->deleted) {
         throw new fProgrammerException("The action requested can not be performed because the directory has been deleted\n\nBacktrace for fDirectory::delete() call:\n%s", fCore::backtrace(0, $this->deleted));
     }
 }
开发者ID:JhunCabas,项目名称:material-management,代码行数:11,代码来源:fDirectory.php

示例11: setBounceToEmail

 /**
  * Adds the email address the email will be bounced to
  * 
  * This email address will be set to the `Return-Path` header.
  * 
  * @param  string $email  The email address to bounce to
  * @return void
  */
 public function setBounceToEmail($email)
 {
     if (ini_get('safe_mode') && !fCore::checkOS('windows')) {
         throw new fProgrammerException('It is not possible to set a Bounce-To Email address when safe mode is enabled on a non-Windows server');
     }
     if (!$email) {
         return;
     }
     $this->bounce_to_email = $this->combineNameEmail('', $email);
 }
开发者ID:russss,项目名称:hackspace-foundation-sites,代码行数:18,代码来源:fEmail.php

示例12: translate

 /**
  * Translates Flourish SQL into the dialect for the current database
  * 
  * @internal
  * 
  * @param  array $statements  The SQL statements to translate
  * @return array  The translated SQL statements all ready for execution. Statements that have been translated will have string key of the number, `:` and the original SQL, all other will have a numeric key.
  */
 public function translate($statements)
 {
     $output = array();
     foreach ($statements as $number => $sql) {
         // These fixes don't need to know about strings
         $new_sql = $this->translateBasicSyntax($sql);
         if (in_array($this->database->getType(), array('mssql', 'oracle', 'db2'))) {
             $new_sql = $this->translateLimitOffsetToRowNumber($new_sql);
         }
         // SQL Server does not like to give unicode results back to PHP without some coersion
         if ($this->database->getType() == 'mssql') {
             $new_sql = $this->fixMSSQLNationalColumns($new_sql);
         }
         // Oracle has this nasty habit of silently translating empty strings to null
         if ($this->database->getType() == 'oracle') {
             $new_sql = $this->fixOracleEmptyStrings($new_sql);
         }
         $extra_statements = array();
         $new_sql = $this->translateCreateTableStatements($new_sql, $extra_statements);
         if ($sql != $new_sql || $extra_statements) {
             fCore::debug(self::compose("Original SQL:%s", "\n" . $sql), $this->debug);
             $translated_sql = $new_sql;
             if ($extra_statements) {
                 $translated_sql .= '; ' . join('; ', $extra_statements);
             }
             fCore::debug(self::compose("Translated SQL:%s", "\n" . $translated_sql), $this->debug);
         }
         $output = array_merge($output, array($number . ':' . $sql => $new_sql), $extra_statements);
     }
     return $output;
 }
开发者ID:JhunCabas,项目名称:material-management,代码行数:39,代码来源:fSQLTranslation.php

示例13: testListGet

 /**
  * @dataProvider serverProvider
  */
 public function testListGet($type, $host, $port, $secure, $username, $password)
 {
     $mailbox = new fMailbox($type, $host, $username, $password, $port, $secure, 5);
     fMailbox::addSMIMEPair('tests@flourishlib.com', './email/tests@flourishlib.com.crt', './email/tests@flourishlib.com.key', EMAIL_PASSWORD);
     $messages = array();
     foreach ($mailbox->listMessages() as $uid => $overview) {
         $info = $mailbox->fetchMessage($uid);
         if (!isset($info['headers'])) {
             fCore::expose($info);
         }
         $messages[$info['headers']['message-id']] = array('subject' => $info['headers']['subject'], 'from' => $info['headers']['from']['mailbox'] . '@' . $info['headers']['from']['host'], 'to' => $info['headers']['to'][0]['mailbox'] . '@' . $info['headers']['from']['host'], 'verified' => !empty($info['verified']) ? $info['verified'] : NULL, 'decrypted' => !empty($info['decrypted']) ? $info['decrypted'] : NULL);
     }
     $expected_output = array('<q2gf11c048f1004281807ra1bfdc89j7c0275bcfdbc5f34@mail.gmail.com>' => array('subject' => 'A Tést of Iñtërnâtiônàlizætiøn', 'from' => 'will@flourishlib.com', 'to' => 'tests@flourishlib.com', 'verified' => NULL, 'decrypted' => NULL), '<x2rf11c048f1004281814pf5f5b26erc4d91f2bebdbd882@mail.gmail.com>' => array('subject' => 'UTF-8 …', 'from' => 'will@flourishlib.com', 'to' => 'tests@flourishlib.com', 'verified' => NULL, 'decrypted' => NULL), '<u2uf11c048f1004281816u3a62bfc7n1961eb403c5eac93@mail.gmail.com>' => array('subject' => 'More UTF-8: ⅞ ⅝ ⅜ ⅛', 'from' => 'will@flourishlib.com', 'to' => 'tests@flourishlib.com', 'verified' => NULL, 'decrypted' => NULL), '<j2kf11c048f1004281820u126d756avb7df16d022e237eb@mail.gmail.com>' => array('subject' => 'Attachments Test', 'from' => 'will@flourishlib.com', 'to' => 'tests@flourishlib.com', 'verified' => NULL, 'decrypted' => NULL), '<r2xf11c048f1004281822n5370c981r8d1c80953684dd77@mail.gmail.com>' => array('subject' => 'Inline Images and Attachments', 'from' => 'will@flourishlib.com', 'to' => 'tests@flourishlib.com', 'verified' => NULL, 'decrypted' => NULL), '<z2lf11c048f1004281828u48cb2c8ci33108197a8db660c@mail.gmail.com>' => array('subject' => 'Multiple To and Cc', 'from' => 'will@flourishlib.com', 'to' => 'tests@flourishlib.com', 'verified' => NULL, 'decrypted' => NULL), '<h2rd0cf2b3e1004281830q66be99f1j9b08abacf56b6c04@mail.gmail.com>' => array('subject' => 'Re: Multiple To and Cc', 'from' => 'flourishlib@gmail.com', 'to' => 'flourishlib@gmail.com', 'verified' => NULL, 'decrypted' => NULL), '<1284737a820.1113498215007594659.3298566658971949728@zoho.com>' => array('subject' => 'Re: Multiple To and Cc', 'from' => 'flourishlib@zoho.com', 'to' => 'flourishlib@zoho.com', 'verified' => NULL, 'decrypted' => NULL), '<8CCB5542832A7C9-1F1C-35E4@webmail-d017.sysops.aol.com>' => array('subject' => 'Re: Multiple To and Cc', 'from' => 'flourishlib@aim.com', 'to' => 'flourishlib@aim.com', 'verified' => NULL, 'decrypted' => NULL), '<4BD8E4BF.4090207@flourishlib.com>' => array('subject' => 'Re: Multiple To and Cc', 'from' => 'tests@flourishlib.com', 'to' => 'flourishlib@flourishlib.com', 'verified' => NULL, 'decrypted' => NULL), '<20100429014944.259410@gmx.com>' => array('subject' => 'Re: Multiple To and Cc', 'from' => 'flourishlib@gmx.com', 'to' => 'tests@gmx.com', 'verified' => NULL, 'decrypted' => NULL), '<4BD8E692.1000308@flourishlib.com>' => array('subject' => 'This message has been signed', 'from' => 'tests@flourishlib.com', 'to' => 'tests@flourishlib.com', 'verified' => TRUE, 'decrypted' => NULL), '<4BD8E723.2090502@flourishlib.com>' => array('subject' => 'This message has also been signed', 'from' => 'tests@flourishlib.com', 'to' => 'tests@flourishlib.com', 'verified' => TRUE, 'decrypted' => NULL));
     if ($username == 'tests@flourishlib.com') {
         $expected_output['<4BD8E7EF.1010806@flourishlib.com>'] = array('subject' => 'This message is signed and encrypted', 'from' => 'tests@flourishlib.com', 'to' => 'tests@flourishlib.com', 'verified' => TRUE, 'decrypted' => TRUE);
         $expected_output['<4BD8E815.1050209@flourishlib.com>'] = array('subject' => 'This message is encrypted', 'from' => 'tests@flourishlib.com', 'to' => 'tests@flourishlib.com', 'verified' => NULL, 'decrypted' => TRUE);
     }
     $expected_output = array_merge($expected_output, array('<14776209491fdb20ccc4f78438756ee3@flourish.wbond.net>' => array('subject' => 'This is a test of fEmail signing', 'from' => 'tests@flourishlib.com', 'to' => 'tests@flourishlib.com', 'verified' => TRUE, 'decrypted' => NULL), '<e92c457a98a30d85fcb4c98b169dd31f@flourish.wbond.net>' => array('subject' => 'This is a test of fEmail encryption', 'from' => 'tests@flourishlib.com', 'to' => 'tests@flourishlib.com', 'verified' => NULL, 'decrypted' => TRUE), '<3f6a8d86e841be31e25c1df8fd303a5d@flourish.wbond.net>' => array('subject' => 'This is a test of fEmail encryption + signing', 'from' => 'tests@flourishlib.com', 'to' => 'tests@flourishlib.com', 'verified' => TRUE, 'decrypted' => TRUE)));
     $this->assertEquals($expected_output, $messages);
 }
开发者ID:nurulimamnotes,项目名称:flourish-old,代码行数:23,代码来源:fMailboxTest.php

示例14: seedRandom

 /**
  * Makes sure that the PRNG has been seeded with a fairly secure value
  * 
  * @return void
  */
 private static function seedRandom()
 {
     static $seeded = FALSE;
     if ($seeded) {
         return;
     }
     $old_level = error_reporting(error_reporting() & ~E_WARNING);
     $bytes = NULL;
     // On linux/unix/solaris we should be able to use /dev/urandom
     if (!fCore::checkOS('windows') && ($handle = fopen('/dev/urandom', 'rb'))) {
         $bytes = fread($handle, 32);
         fclose($handle);
         // On windows we should be able to use the Cryptographic Application Programming Interface COM object
     } elseif (fCore::checkOS('windows') && class_exists('COM', FALSE)) {
         try {
             // This COM object no longer seems to work on PHP 5.2.9+, no response on the bug report yet
             $capi = new COM('CAPICOM.Utilities.1');
             $bytes = base64_decode($capi->getrandom(32, 0));
             unset($capi);
         } catch (Exception $e) {
         }
     }
     // If we could not use the OS random number generators we get some of the most unique info we can
     if (!$bytes) {
         $bytes = microtime(TRUE) . uniqid('', TRUE) . join('', stat(__FILE__)) . disk_free_space(__FILE__);
     }
     error_reporting($old_level);
     $seed = md5($bytes);
     $seed = base_convert($seed, 16, 10);
     $seed = (double) substr($seed, 0, 13) + (double) substr($seed, 14, 13);
     mt_srand($seed);
     $seeded = TRUE;
 }
开发者ID:jsuarez,项目名称:MyDesign,代码行数:38,代码来源:fCryptography.php

示例15: checkPHPVersion

 /**
  * Checks to make sure the current version of PHP is high enough to support timezone features
  * 
  * @return void
  */
 private static function checkPHPVersion()
 {
     if (!fCore::checkVersion('5.1')) {
         throw new fEnvironmentException('The %s class takes advantage of the timezone features in PHP 5.1.0 and newer. Unfortunately it appears you are running an older version of PHP.', __CLASS__);
     }
 }
开发者ID:jsuarez,项目名称:MyDesign,代码行数:11,代码来源:fTimestamp.php


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