本文整理汇总了PHP中fCore类的典型用法代码示例。如果您正苦于以下问题:PHP fCore类的具体用法?PHP fCore怎么用?PHP fCore使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了fCore类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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('[email protected]', 'example');
$email->addRecipient($user->getEmail(), $user->getUsername());
// Set who the email is from
$email->setFromEmail('[email protected]','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('[email protected]', './email/[email protected]', './email/[email protected]', 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('<[email protected]>' => array('subject' => 'A Tést of Iñtërnâtiônàlizætiøn', 'from' => '[email protected]', 'to' => '[email protected]', 'verified' => NULL, 'decrypted' => NULL), '<[email protected]>' => array('subject' => 'UTF-8 …', 'from' => '[email protected]', 'to' => '[email protected]', 'verified' => NULL, 'decrypted' => NULL), '<[email protected]>' => array('subject' => 'More UTF-8: ⅞ ⅝ ⅜ ⅛', 'from' => '[email protected]', 'to' => '[email protected]', 'verified' => NULL, 'decrypted' => NULL), '<[email protected]>' => array('subject' => 'Attachments Test', 'from' => '[email protected]', 'to' => '[email protected]', 'verified' => NULL, 'decrypted' => NULL), '<[email protected]>' => array('subject' => 'Inline Images and Attachments', 'from' => '[email protected]', 'to' => '[email protected]', 'verified' => NULL, 'decrypted' => NULL), '<[email protected]>' => array('subject' => 'Multiple To and Cc', 'from' => '[email protected]', 'to' => '[email protected]', 'verified' => NULL, 'decrypted' => NULL), '<[email protected]>' => array('subject' => 'Re: Multiple To and Cc', 'from' => '[email protected]', 'to' => '[email protected]', 'verified' => NULL, 'decrypted' => NULL), '<[email protected]>' => array('subject' => 'Re: Multiple To and Cc', 'from' => '[email protected]', 'to' => '[email protected]', 'verified' => NULL, 'decrypted' => NULL), '<[email protected]>' => array('subject' => 'Re: Multiple To and Cc', 'from' => '[email protected]', 'to' => '[email protected]', 'verified' => NULL, 'decrypted' => NULL), '<[email protected]>' => array('subject' => 'Re: Multiple To and Cc', 'from' => '[email protected]', 'to' => '[email protected]', 'verified' => NULL, 'decrypted' => NULL), '<[email protected]>' => array('subject' => 'Re: Multiple To and Cc', 'from' => '[email protected]', 'to' => '[email protected]', 'verified' => NULL, 'decrypted' => NULL), '<[email protected]>' => array('subject' => 'This message has been signed', 'from' => '[email protected]', 'to' => '[email protected]', 'verified' => TRUE, 'decrypted' => NULL), '<[email protected]>' => array('subject' => 'This message has also been signed', 'from' => '[email protected]', 'to' => '[email protected]', 'verified' => TRUE, 'decrypted' => NULL));
if ($username == '[email protected]') {
$expected_output['<[email protected]>'] = array('subject' => 'This message is signed and encrypted', 'from' => '[email protected]', 'to' => '[email protected]', 'verified' => TRUE, 'decrypted' => TRUE);
$expected_output['<[email protected]>'] = array('subject' => 'This message is encrypted', 'from' => '[email protected]', 'to' => '[email protected]', 'verified' => NULL, 'decrypted' => TRUE);
}
$expected_output = array_merge($expected_output, array('<[email protected]>' => array('subject' => 'This is a test of fEmail signing', 'from' => '[email protected]', 'to' => '[email protected]', 'verified' => TRUE, 'decrypted' => NULL), '<[email protected]>' => array('subject' => 'This is a test of fEmail encryption', 'from' => '[email protected]', 'to' => '[email protected]', 'verified' => NULL, 'decrypted' => TRUE), '<[email protected]>' => array('subject' => 'This is a test of fEmail encryption + signing', 'from' => '[email protected]', 'to' => '[email protected]', '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
示例16: clear
/**
* Clears the WHOLE cache of every key, use with caution!
*
* xcache may require a login or password depending on your ini settings.
*
* @return boolean If the cache was successfully cleared
*/
public function clear()
{
switch ($this->type) {
case 'apc':
return apc_clear_cache('user');
case 'database':
$this->data_store->query("DELETE FROM %r", $this->config['table']);
return TRUE;
case 'directory':
$files = array_diff(scandir($this->config['path']), array('.', '..'));
$success = TRUE;
foreach ($files as $file) {
$success = unlink($this->config['path'] . $file) && $success;
}
return $success;
case 'file':
$this->data_store = array();
$this->config['state'] = 'dirty';
return TRUE;
case 'memcache':
return $this->data_store->flush();
case 'redis':
return $this->data_store->flushDB();
case 'xcache':
fCore::startErrorCapture();
xcache_clear_cache(XC_TYPE_VAR, 0);
return (bool) fCore::stopErrorCapture();
}
}
开发者ID:mrjwc,项目名称:printmaster,代码行数:36,代码来源:fCache.php
示例17: clean
/**
* Removes any invalid UTF-8 characters from a string or array of strings
*
* @param array|string $value The string or array of strings to clean
* @return string The cleaned string
*/
public static function clean($value)
{
if (!is_array($value)) {
if (self::$can_ignore_invalid === NULL) {
self::$can_ignore_invalid = !in_array(strtolower(ICONV_IMPL), array('unknown', 'ibm iconv'));
}
fCore::startErrorCapture(E_NOTICE);
$value = self::iconv('UTF-8', 'UTF-8' . (self::$can_ignore_invalid ? '//IGNORE' : ''), (string) $value);
fCore::stopErrorCapture();
return $value;
}
$keys = array_keys($value);
$num_keys = sizeof($keys);
for ($i = 0; $i < $num_keys; $i++) {
$value[$keys[$i]] = self::clean($value[$keys[$i]]);
}
return $value;
}
开发者ID:mrjwc,项目名称:printmaster,代码行数:24,代码来源:fUTF8.php
示例18: open
/**
* Opens the session for writing, is automatically called by ::clear(), ::get() and ::set()
*
* A `Cannot send session cache limiter` warning will be triggered if this,
* ::add(), ::clear(), ::delete(), ::get() or ::set() is called after output
* has been sent to the browser. To prevent such a warning, explicitly call
* this method before generating any output.
*
* @param boolean $cookie_only_session_id If the session id should only be allowed via cookie - this is a security issue and should only be set to `FALSE` when absolutely necessary
* @return void
*/
public static function open($cookie_only_session_id = TRUE)
{
if (self::$open) {
return;
}
self::$open = TRUE;
if (self::$normal_timespan === NULL) {
self::$normal_timespan = ini_get('session.gc_maxlifetime');
}
if (self::$backend && self::exists() && session_module_name() != 'user') {
throw new fProgrammerException('A custom backend was provided by %1$s, however the session has already been started, so it can not be used', __CLASS__ . '::setBackend()');
}
// If the session is already open, we just piggy-back without setting options
if (!self::exists()) {
if ($cookie_only_session_id) {
ini_set('session.use_cookies', 1);
ini_set('session.use_only_cookies', 1);
}
// If we are using a custom backend we have to set the session handler
if (self::$backend && session_module_name() != 'user') {
session_set_save_handler(array('fSession', 'openCache'), array('fSession', 'closeCache'), array('fSession', 'readCache'), array('fSession', 'writeCache'), array('fSession', 'destroyCache'), array('fSession', 'gcCache'));
}
// https://bugs.php.net/bug.php?id=68063
// Fix warning with Bad IDs
fCore::startErrorCapture();
$started = session_start();
fCore::stopErrorCapture();
if (!$started) {
session_regenerate_id(TRUE);
session_start();
}
}
// If the session has existed for too long, reset it
if (isset($_SESSION['fSession::expires']) && $_SESSION['fSession::expires'] < $_SERVER['REQUEST_TIME']) {
$_SESSION = array();
self::regenerateID();
}
if (!isset($_SESSION['fSession::type'])) {
$_SESSION['fSession::type'] = 'normal';
}
// We store the expiration time for a session to allow for both normal and persistent sessions
if ($_SESSION['fSession::type'] == 'persistent' && self::$persistent_timespan) {
$_SESSION['fSession::expires'] = $_SERVER['REQUEST_TIME'] + self::$persistent_timespan;
} else {
$_SESSION['fSession::expires'] = $_SERVER['REQUEST_TIME'] + self::$normal_timespan;
}
}
开发者ID:alandsidel,项目名称:flourish-classes,代码行数:58,代码来源:fSession.php
示例19: write
/**
* Sends commands to the IMAP or POP3 server
*
* @param string $command The command to send
* @param integer $expected The number of lines or regex expected for a POP3 command
* @return array The response from the server
*/
private function write($command, $expected = NULL)
{
if (!$this->connection) {
throw new fProgrammerException('Unable to send data since the connection has already been closed');
}
if ($this->type == 'imap') {
$identifier = 'a' . str_pad($this->command_num++, 4, '0', STR_PAD_LEFT);
$command = $identifier . ' ' . $command;
}
if (substr($command, -2) != "\r\n") {
$command .= "\r\n";
}
if (fCore::getDebug($this->debug)) {
fCore::debug("Sending:\n" . trim($command), $this->debug);
}
$res = fwrite($this->connection, $command);
if ($res === FALSE) {
throw new fConnectivityException('Unable to write data to %1$s server %2$s on port %3$s', strtoupper($this->type), $this->host, $this->port);
}
if ($this->type == 'imap') {
return $this->read('#^' . $identifier . '#');
} elseif ($this->type == 'pop3') {
return $this->read($expected);
}
}
开发者ID:philip,项目名称:flourish,代码行数:32,代码来源:fMailbox.php
示例20: registerActiveRecordStaticMethod
/**
* Registers a callback for an fActiveRecord method that falls through to fActiveRecord::__callStatic() or hits a predefined method hook
*
* Only available to PHP 5.3+ which supports the __callStatic magic method.
*
* The callback should accept the following parameters:
*
* - **`&$class`**: The class calling the static method
* - **`$method_name`**: The method that was called
* - **`&$parameters`**: The parameters passed to the method
*
* @throws fProgrammerException When the PHP version less than 5.3
*
* @param mixed $class The class name or instance of the class to register for, `'*'` will register for all classes
* @param string $method The method to hook for - this can be a complete method name or `{prefix}*` where `*` will match any column name
* @param callback $callback The callback to execute - see method description for parameter list
* @return void
*/
public static function registerActiveRecordStaticMethod($class, $method, $callback)
{
if (!fCore::checkVersion('5.3')) {
throw new fProgrammerException('fORM::registerActiveRecordStaticMethod is only available to PHP 5.3+', $method);
}
$class = self::getClass($class);
if (!isset(self::$active_record_static_method_callbacks[$class])) {
self::$active_record_static_method_callbacks[$class] = array();
}
if (is_string($callback) && strpos($callback, '::') !== FALSE) {
$callback = explode('::', $callback);
}
self::$active_record_static_method_callbacks[$class][$method] = $callback;
self::$cache['getActiveRecordStaticMethod'] = array();
}
开发者ID:gopalgrover23,项目名称:flourish-classes,代码行数:33,代码来源:fORM.php
注:本文中的fCore类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论