本文整理汇总了PHP中static::id方法的典型用法代码示例。如果您正苦于以下问题:PHP static::id方法的具体用法?PHP static::id怎么用?PHP static::id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类static
的用法示例。
在下文中一共展示了static::id方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create
/**
* Generates a captcha image, writing it to the output
* It is used internally by this bundle when pointing to "/captcha" (see [vendor]\routes.php)
* Typically, you won't use this function, but use the above img() function instead
*
* @access public
* @return img
*/
public static function create($id = null)
{
static::$char = Str::random(static::$config['length'], static::$config['type']);
static::$id = $id ? $id : static::$config['id'];
Session::put('captchaHash', Hash::make(static::$config['sensitive'] === true ? static::$char : Str::lower(static::$char)));
$bg_image = static::asset('backgrounds');
$bg_image_info = getimagesize($bg_image);
if ($bg_image_info['mime'] == 'image/jpg' || $bg_image_info['mime'] == 'image/jpeg') {
$old_image = imagecreatefromjpeg($bg_image);
} elseif ($bg_image_info['mime'] == 'image/gif') {
$old_image = imagecreatefromgif($bg_image);
} elseif ($bg_image_info['mime'] == 'image/png') {
$old_image = imagecreatefrompng($bg_image);
}
$new_image = imagecreatetruecolor(static::$config['width'], static::$config['height']);
$bg = imagecolorallocate($new_image, 255, 255, 255);
imagefill($new_image, 0, 0, $bg);
imagecopyresampled($new_image, $old_image, 0, 0, 0, 0, static::$config['width'], static::$config['height'], $bg_image_info[0], $bg_image_info[1]);
$bg = imagecolorallocate($new_image, 255, 255, 255);
for ($i = 0; $i < strlen(static::$char); $i++) {
$color_cols = explode(',', static::asset('colors'));
$fg = imagecolorallocate($new_image, trim($color_cols[0]), trim($color_cols[1]), trim($color_cols[2]));
imagettftext($new_image, static::asset('fontsizes'), rand(-10, 15), 10 + $i * static::$config['space'], rand(static::$config['height'] - 10, static::$config['height'] - 5), $fg, static::asset('fonts'), static::$char[$i]);
}
imagealphablending($new_image, false);
header('Cache-Control: no-cache, no-store, max-age=0, must-revalidate');
header('Pragma: no-cache');
header("Content-type: image/jpg");
header('Content-Disposition: inline; filename=' . static::$id . '.jpg');
imagejpeg($new_image, null, 80);
imagedestroy($new_image);
}
示例2: setUp
function setUp()
{
static::$id = 7777777;
static::$pattern = "iformbuilder\\.com\\/exzact\\/api\\/v60\\/profiles\\/[0-9]+\\/optionlists";
$this->setResourceType('Iform\\Resources\\OptionList\\OptionLists');
parent::setUp();
}
示例3: idType
/**
* @return \Fubhy\GraphQL\Type\Definition\Types\Scalars\IdType
*/
public static function idType()
{
if (!isset(static::$id)) {
static::$id = new IdType();
}
return static::$id;
}
示例4: setUp
function setUp()
{
static::$id = 7777777;
static::$pattern = "iformbuilder\\.com\\/exzact\\/api\\/v60\\/profiles\\/[0-9]+\\/pages\\/" . static::$id . "\\/elements";
$this->setIdentifier(static::$id);
$this->setResourceType('Iform\\Resources\\Element\\Elements');
parent::setUp();
}
示例5: setId
/**
* component의 id를 지정한다.
*
* @param string $id 지정할 id
*
* @return void
*/
public static function setId($id)
{
if (property_exists(static::class, 'id')) {
static::$id = $id;
} else {
self::$id[static::class] = $id;
}
}
示例6: required
public static function required()
{
static::preInit();
$sid = session_id();
if (!$sid) {
session_start();
$sid = session_id();
if (!isset($_SESSION['ip'], $_SESSION['logins'])) {
// Session not started for this session
$_SESSION = array('ip' => sha1($_SERVER['REMOTE_ADDR']), 'ua' => sha1($_SERVER['HTTP_USER_AGENT']), 'start' => time(), 'active' => time(), 'messages' => array(), 'logins' => array(), 'vars' => array());
} else {
}
static::$session =& $_SESSION;
static::$id = session_id();
}
}
示例7: start
public static function start()
{
// run gc
static::gc();
// get session id
$name = Config::get('session.name', 'anchorcms');
static::$id = Cookie::get($name);
if (static::$id === false) {
Log::info('Session cookie not found: ' . $name);
static::$id = Str::random(32);
}
// load session data
$sql = "select data from sessions where id = ? and ip = ? and ua = ? limit 1";
$args = array(static::$id, Input::ip_address(), Input::user_agent());
if ($session = Db::row($sql, $args)) {
static::$data = unserialize($session->data);
} else {
// Session not found regenerate ID
static::$id = Str::random(32);
Db::insert('sessions', array('id' => static::$id, 'date' => date(DATE_ISO8601), 'ip' => Input::ip_address(), 'ua' => Input::user_agent(), 'data' => serialize(static::$data)));
}
}
示例8: setUserId
/**
* Authentication classes should call this method
*
* @param string $id user id as identified by the authentication classes
*
* @return void
*/
public static function setUserId($id)
{
static::$id = $id;
}
示例9: batchDelete
public static function batchDelete($bulkId, $async = true)
{
$bulk = [];
foreach ($bulkId as $id) {
$obj = new static(static::getPrimaryArray($id));
$bulk[] = ['delete' => $obj->setBulkParams(['id' => $obj->id()])];
}
if ($async) {
return static::asyncBulk($bulk);
} else {
return static::bulk($bulk);
}
}
示例10: id
/**
* Returns the session id.
* Calling this method will not auto start the session. You might have to manually
* assert a started session.
*
* Passing an id into it, you can also replace the session id if the session
* has not already been started.
* Note that depending on the session handler, not all characters are allowed
* within the session id. For example, the file session handler only allows
* characters in the range a-z A-Z 0-9 , (comma) and - (minus).
*
* @param string|null $id Id to replace the current session id
* @return string Session id
*/
public static function id($id = null)
{
if ($id) {
static::$id = $id;
session_id(static::$id);
}
if (static::started()) {
return session_id();
}
return static::$id;
}
示例11: tearDown
function tearDown()
{
m::close();
static::$id = "";
static::$pattern = "";
unset($this->stub);
unset($this->resourceType);
unset($this->resource);
unset($this->identifier);
}
示例12: clear
/**
* Clears the session, the session id, and renews the session.
*
* @return void
*/
public static function clear()
{
$_SESSION = null;
static::$id = null;
static::renew();
}
示例13: destroy
public static function destroy()
{
$_SESSION = array();
session_destroy();
static::$id = null;
}
示例14: registerApp
/**
* Register app service and singleton containers that bound with current app ID.
* Exit application if empty ID provided.
*
* @param mixed $config
* @param mixed $id
* @return mixed
*/
protected function registerApp($config, $id)
{
if (empty(trim($id))) {
exit('App ID must not be empty!');
}
$this->config = $config;
static::$id = $id;
if (!isset(static::$services[$id])) {
static::$services[$id] = [];
}
if (!isset(static::$singletons[$id])) {
static::$singletons[$id] = [];
}
if (!isset(static::$apps[$id])) {
static::$apps[$id] = $this;
}
return static::$apps[$id];
}
示例15: setUniqueIdentifier
/**
* Authentication classes should call this method
*
* @param string $id user id as identified by the authentication classes
*
* @return void
*/
public static function setUniqueIdentifier($id)
{
static::$id = $id;
}