本文整理汇总了PHP中l类的典型用法代码示例。如果您正苦于以下问题:PHP l类的具体用法?PHP l怎么用?PHP l使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了l类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
$this->type = 'text';
$this->icon = 'user';
$this->label = l::get('fields.user.label', 'User');
$this->placeholder = l::get('fields.user.placeholder', 'Username…');
}
示例2: __construct
/**
* @param array $event The fields of this event including the 'private'
* fields which start with a <code>_</code> (e.g. <code>_begin_date</code>).
*/
function __construct($event)
{
self::validate($event);
$this->hasEnd = true;
$this->hasBeginTime = (bool) a::get($event, self::beginTimeKey);
$this->hasEndTime = (bool) a::get($event, self::endTimeKey);
$this->beginTimestamp = self::getTimestamp(a::get($event, self::beginDateKey), a::get($event, self::beginTimeKey));
$this->endTimestamp = self::getTimestamp(a::get($event, self::endDateKey), a::get($event, self::endTimeKey));
// if there is no end date given, use the same as the beginning date
if (!$this->endTimestamp) {
$this->endTimestamp = self::getTimestamp(a::get($event, self::beginDateKey), a::get($event, self::endTimeKey));
// if there also is no end time given, there is no end at all
if (!$this->hasEndTime) {
$this->hasEnd = false;
}
}
// if there is no end time given, the event lasts until end of the day
if (!$this->hasEndTime) {
$this->endTimestamp = strtotime('tomorrow', $this->endTimestamp);
}
// only use the full format, if there were times given for this event
$this->timeFormat = $this->hasBeginTime || $this->hasEndTime ? l::get('calendar-full-time-format') : l::get('calendar-time-format');
// remove the 'private' fields
$this->fields = self::filterFields($event);
}
示例3: index
public function index()
{
if (app::$site->users()->count() > 0) {
go('panel/login');
}
if ($problems = installation::check()) {
$content = view('installation/check', array('problems' => $problems));
} else {
$form = app::form('installation', array('language' => c::get('panel.language', 'en')));
$form->cancel = false;
$form->save = l::get('installation.signup.button');
$form->centered = true;
foreach (app::languages() as $lang) {
$form->fields()->get('language')->options[$lang->code()] = $lang->title();
}
$form->on('submit', function ($form) {
try {
app::$site->users()->create($form->serialize());
go('panel/login/welcome');
} catch (Exception $e) {
$form->alert($e->getMessage());
}
});
$content = view('installation/signup', array('form' => $form));
}
return layout('installation', array('meta' => new Snippet('meta'), 'content' => $content));
}
示例4: login
public static function login($redirect = '/')
{
if (self::user()) {
go(url($redirect));
}
self::kill();
$password = get('password');
$username = get('username');
if (empty($username) || empty($password)) {
return false;
}
// try to find the user
$account = self::load($username);
if (!$account) {
return array('status' => 'error', 'msg' => l::get('auth.error', 'Invalid username or password'));
}
// check for matching usernames
if (str::lower($account->username()) != str::lower($username)) {
return array('status' => 'error', 'msg' => l::get('auth.error', 'Invalid username or password'));
}
// check for a matching password
if (!self::checkPassword($account, $password)) {
return array('status' => 'error', 'msg' => l::get('auth.error', 'Invalid username or password'));
}
// generate a random token
$token = str::random();
// add the username.
$account->token = $token;
// store the token in the cookie
// and the user data in the session
cookie::set('authFrontend', $token, 60 * 60 * 24);
s::set('authFrontend.' . $token, $account->username());
go(url($redirect));
}
示例5: __construct
public function __construct()
{
$this->type = 'url';
$this->icon = 'chain';
$this->label = l::get('fields.url.label', 'URL');
$this->placeholder = 'http://';
}
示例6: login
function login()
{
s::restart();
$password = get('password');
$username = get('username');
if (empty($username) || empty($password)) {
return array('status' => 'error', 'msg' => l::get('login.error'));
}
$account = self::load($username);
if (!$account) {
return array('status' => 'error', 'msg' => l::get('login.error'));
}
// check for matching usernames
if (str::lower($account['username']) != str::lower($username)) {
return array('status' => 'error', 'msg' => l::get('login.error'));
}
// check for a matching password
if (!self::checkPassword($account, $password)) {
return array('status' => 'error', 'msg' => l::get('login.error'));
}
// generate a random token
$token = str::random();
// add the username.
// It's only the key of the array so far.
$account['token'] = $token;
// store the token in the cookie
// and the user data in the session
cookie::set('auth', $token, 60 * 60 * 24);
s::set($token, $account);
// assign the user data to this obj
$this->_ = $account;
return array('status' => 'success', 'msg' => l::get('login.success'));
}
示例7: __construct
public function __construct()
{
$this->type = 'text';
$this->label = l::get('fields.title.label', 'Title');
$this->icon = 'font';
$this->required = true;
}
示例8: __construct
public function __construct()
{
$this->label = l::get('fields.textarea.label', 'Text');
$this->buttons = true;
$this->min = 0;
$this->max = false;
}
示例9: __construct
public function __construct()
{
$this->type = 'text';
$this->icon = 'map-marker';
$this->label = l::get('fields.location.label', 'Location');
$this->placeholder = l::get('fields.location.placeholder', 'Coordinates');
$this->readonly = true;
}
示例10: __construct
public function __construct()
{
$this->icon = 'tag';
$this->label = l::get('fields.tags.label', 'Tags');
$this->index = 'siblings';
$this->separator = ',';
$this->lower = false;
}
示例11: __construct
public function __construct()
{
$this->type = 'email';
$this->icon = 'envelope';
$this->label = l::get('fields.email.label', 'Email');
$this->placeholder = l::get('fields.email.placeholder', 'mail@example.com');
$this->autocomplete = true;
}
示例12: __construct
public function __construct()
{
$this->type = 'number';
$this->label = l::get('fields.number.label', 'Number');
$this->placeholder = l::get('fields.number.placeholder', '#');
$this->step = 1;
$this->min = 0;
$this->max = false;
}
示例13: testSet
public function testSet()
{
l::set('anothervar', 'anothervalue');
l::set('testvar', 'overwrittenvalue');
$this->assertEquals('anothervalue', l::get('anothervar'));
$this->assertEquals('overwrittenvalue', l::get('testvar'));
l::set(array('var1' => 'value1', 'var2' => 'value2'));
$this->assertEquals('value1', l::get('var1'));
$this->assertEquals('value2', l::get('var2'));
}
示例14: __construct
public function __construct()
{
$this->type = 'text';
$this->icon = 'user';
$this->label = l::get('fields.user.label', 'User');
$this->options = array();
foreach (kirby()->site()->users() as $user) {
$this->options[$user->username()] = $user->username();
}
}
示例15: input
public function input()
{
$input = parent::input();
$input->removeAttr('name');
$input->data(array('field' => 'date', 'format' => $this->format(), 'i18n' => html(json_encode(array('previousMonth' => '‹', 'nextMonth' => '›', 'months' => l::get('fields.date.months'), 'weekdays' => l::get('fields.date.weekdays'), 'weekdaysShort' => l::get('fields.date.weekdays.short'))), false)));
$hidden = new Brick('input', null);
$hidden->type = 'hidden';
$hidden->name = $this->name();
$hidden->value = $this->value();
return $input . $hidden;
}