本文整理汇总了PHP中self::read方法的典型用法代码示例。如果您正苦于以下问题:PHP self::read方法的具体用法?PHP self::read怎么用?PHP self::read使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类self
的用法示例。
在下文中一共展示了self::read方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: load
/**
* Loads session.
* @since 1.0.0
*
* @param string $options Filename as options.
*
* @return object Session.
*/
public static function load($options)
{
if (!isset(static::$filename)) {
static::$filename = $options;
}
$sess = new self();
if (file_exists($options)) {
$sess->read($options);
}
return $sess;
}
示例2: getInstance
/**
* Get settings instance
*
* @return ilObjDiskQuotaSettings
*/
public static function getInstance()
{
global $ilDB;
$query = "SELECT object_reference.ref_id FROM object_reference,tree,object_data " . "WHERE tree.parent = " . $ilDB->quote(SYSTEM_FOLDER_ID, 'integer') . " " . "AND object_data.type = " . $ilDB->quote('facs', 'text') . "AND object_reference.ref_id = tree.child " . "AND object_reference.obj_id = object_data.obj_id";
$res = $ilDB->query($query);
$row = $res->fetchRow(DB_FETCHMODE_ASSOC);
$ref_id = $row["ref_id"];
if ($ref_id) {
$obj = new self($ref_id);
$obj->read();
return $obj;
}
}
示例3: buildInstance
/**
* @param shibServerData $shibServerData
*
* @return shibUser
*/
public static function buildInstance(shibServerData $shibServerData)
{
$shibUser = new self();
$shibUser->shibServerData = $shibServerData;
$ext_id = $shibUser->shibServerData->getLogin();
$shibUser->setExternalAccount($ext_id);
$existing_usr_id = self::getUsrIdByExtId($ext_id);
if ($existing_usr_id) {
$shibUser->setId($existing_usr_id);
$shibUser->read();
}
$shibUser->setAuthMode('shibboleth');
return $shibUser;
}
示例4: getInstance
/**
* Short description for 'getInstance'
*
* Long description (if any) ...
*
* @param unknown $instance Parameter description (if any) ...
* @return mixed Return description (if any) ...
*/
public static function getInstance($instance)
{
$hztv = new self();
if ($hztv->read($instance) === false) {
return false;
}
return $hztv;
}
示例5: self
static function __init()
{
self::$savePath = $CONFIG['session.save_path'];
self::$cookiePath = $CONFIG['session.cookie_path'];
self::$cookieDomain = $CONFIG['session.cookie_domain'];
$CONFIG['session.auth_vars'] && (self::$authVars = array_merge(self::$authVars, $CONFIG['session.auth_vars']));
$CONFIG['session.group_vars'] && (self::$groupVars = array_merge(self::$groupVars, $CONFIG['session.group_vars']));
self::$authVars = array_flip(self::$authVars);
self::$groupVars = array_flip(self::$groupVars);
if (self::$maxIdleTime < 1 && self::$maxLifeTime < 1) {
user_error('At least one of the SESSION::$max*Time variables must be strictly positive.');
}
if (mt_rand(1, self::$gcProbabilityDenominator) <= self::$gcProbabilityNumerator) {
$adapter = new self('0lastGC');
$i = $adapter->read();
$j = max(self::$maxIdleTime, self::$maxLifeTime);
if ($j && $_SERVER['REQUEST_TIME'] - $i > $j) {
$adapter->write($_SERVER['REQUEST_TIME']);
register_shutdown_function(array(__CLASS__, 'gc'), $j);
}
unset($adapter);
}
if (isset($_COOKIE['SID'])) {
self::setSID($_COOKIE['SID']);
self::$adapter = new self(self::$SID);
$i = self::$adapter->read();
} else {
$i = false;
}
if ($i) {
$i = unserialize($i);
self::$lastseen = $i[0];
self::$birthtime = $i[1];
if (self::$maxIdleTime && $_SERVER['REQUEST_TIME'] - self::$lastseen > self::$maxIdleTime) {
// Session has idled
self::onIdle();
self::$isIdled = true;
} else {
if (self::$maxLifeTime && $_SERVER['REQUEST_TIME'] - self::$birthtime > self::$maxLifeTime) {
// Session has expired
self::onExpire();
} else {
self::$DATA =& $i[2];
}
}
if (isset($_SERVER['HTTPS']) && (!isset($_COOKIE['SSL']) || $i[3] != $_COOKIE['SSL'])) {
self::regenerateId(true);
} else {
self::$sslid = $i[3];
if ('-' == self::$sslid[0] && isset($_SERVER['HTTPS'])) {
self::$sslid = p::strongId();
setcookie('SSL', self::$sslid, 0, self::$cookiePath, self::$cookieDomain, true, true);
unset($_SERVER['HTTP_IF_NONE_MATCH'], $_SERVER['HTTP_IF_MODIFIED_SINCE']);
}
}
} else {
self::regenerateId(true);
}
}
示例6: find_or_create
/**
* Fine a specific record, or create it
* if not found
*
* @param string $type
* @param string $authenticator
* @param string $domain
* @return mixed
*/
public static function find_or_create($type, $authenticator, $domain = null)
{
$hzad = new self();
$hzad->type = $type;
$hzad->authenticator = $authenticator;
$hzad->domain = $domain;
$hzad->read();
if (empty($hzad->id) && !$hzad->create()) {
return false;
}
return $hzad;
}
示例7: find_or_create
/**
* Find a record, creating it if not found.
*
* @param string $type
* @param string $authenticator
* @param string $domain
* @param string $username
* @return mixed Object on success, False on failure
*/
public static function find_or_create($type, $authenticator, $domain, $username)
{
$hzad = Domain::find_or_create($type, $authenticator, $domain);
if (!is_object($hzad)) {
return false;
}
if (empty($username)) {
return false;
}
$hzal = new self();
$hzal->username = $username;
$hzal->auth_domain_id = $hzad->id;
$hzal->read();
if (empty($hzal->id) && !$hzal->create()) {
return false;
}
return $hzal;
}
示例8: create
/**
* @param string $cachePath
* @param FileScanner $scanner
* @return CachingFileScanner
*/
public static function create($cachePath, FileScanner $scanner)
{
$self = new self($cachePath, $scanner);
$self->read();
return $self;
}
示例9: saveValue
static function saveValue($k, $v)
{
$config = new self();
$config->read();
$config->set($k, $v);
$config->save();
}
示例10: load
/**
* Loads a WKT string into a Geometry Object
*
* @param string $WKT
*
* @return Geometry\Geometry
*/
public static function load($WKT)
{
$instance = new self();
return $instance->read($WKT);
}
示例11: getInstance
/**
* Short description for 'getInstance' Long description (if any) . ..
*
* @param unknown $instance Parameter description (if any) ...
* @param unknown $storage Parameter description (if any) ...
* @return mixed Return description (if any) ...
*/
public static function getInstance($instance, $storage = null)
{
$hzup = new self();
if ($hzup->read($instance) === false) {
return false;
}
return $hzup;
}
示例12: getInstance
/**
* Returns a reference to a group object
*
* @param mixed $group A string (cn) or integer (ID)
* @return mixed Object if instance found, false if not
*/
public static function getInstance($group)
{
static $instances;
// Set instances array
if (!isset($instances)) {
$instances = array();
}
// Do we have a matching instance?
if (!isset($instances[$group])) {
// If an ID is passed, check for a match in existing instances
if (is_numeric($group)) {
foreach ($instances as $instance) {
if ($instance && $instance->get('gidNumber') == $group) {
// Match found
return $instance;
break;
}
}
}
// No matches
// Create group object
$hzg = new self();
if ($hzg->read($group) === false) {
$instances[$group] = false;
} else {
$instances[$group] = $hzg;
}
}
// Return instance
return $instances[$group];
}
示例13: file_gc
/**
* Cleanup expired cache entries.
*/
private static function file_gc()
{
$dir = new DirectoryIterator(\Sledgehammer\TMP_DIR . 'Cache');
$files = [];
foreach ($dir as $entry) {
if ($entry->isFile()) {
$files[] = $entry->getFilename();
}
}
shuffle($files);
$files = array_slice($files, 0, ceil(count($files) / 10));
// Take 10% of the files
$cache = new self('GC', 'file');
foreach ($files as $id) {
$cache->_guid = $id;
$cache->_file = fopen(\Sledgehammer\TMP_DIR . 'Cache/' . $id, 'r');
$hit = $cache->read($output);
fclose($cache->_file);
$cache->_file = null;
if ($hit === false) {
// Expired?
$cache->clear();
}
}
}
示例14: find_or_create
/**
* Find a project. Create it if one doesn't exist.
*
* @param string $name Project name
* @return mixed
*/
public static function find_or_create($name)
{
$hztp = new self();
if (is_numeric($name)) {
$hztp->id = $name;
} else {
$hztp->name = $name;
}
if ($hztp->read() == false) {
if ($hztp->create() == false) {
return false;
}
}
return $hztp;
}