• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP l类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了l类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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…');
 }
开发者ID:kompuser,项目名称:panel,代码行数:7,代码来源:user.php


示例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);
 }
开发者ID:igorqr,项目名称:kirby-extensions,代码行数:29,代码来源:Event.php


示例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));
 }
开发者ID:kompuser,项目名称:panel,代码行数:27,代码来源:installation.php


示例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));
 }
开发者ID:scheibome,项目名称:kirbycms-extensions,代码行数:34,代码来源:auth.php


示例5: __construct

 public function __construct()
 {
     $this->type = 'url';
     $this->icon = 'chain';
     $this->label = l::get('fields.url.label', 'URL');
     $this->placeholder = 'http://';
 }
开发者ID:robinandersen,项目名称:robin,代码行数:7,代码来源:url.php


示例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'));
 }
开发者ID:codecuts,项目名称:lanningsmith-website,代码行数:33,代码来源:user.php


示例7: __construct

 public function __construct()
 {
     $this->type = 'text';
     $this->label = l::get('fields.title.label', 'Title');
     $this->icon = 'font';
     $this->required = true;
 }
开发者ID:LucasFyl,项目名称:korakia,代码行数:7,代码来源:title.php


示例8: __construct

 public function __construct()
 {
     $this->label = l::get('fields.textarea.label', 'Text');
     $this->buttons = true;
     $this->min = 0;
     $this->max = false;
 }
开发者ID:robinandersen,项目名称:robin,代码行数:7,代码来源:textarea.php


示例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;
 }
开发者ID:junglesta,项目名称:freezer,代码行数:8,代码来源:geolocation.php


示例10: __construct

 public function __construct()
 {
     $this->icon = 'tag';
     $this->label = l::get('fields.tags.label', 'Tags');
     $this->index = 'siblings';
     $this->separator = ',';
     $this->lower = false;
 }
开发者ID:irenehilber,项目名称:kirby-base,代码行数:8,代码来源:tags.php


示例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', '[email protected]');
     $this->autocomplete = true;
 }
开发者ID:aoimedia,项目名称:kosmonautensofa,代码行数:8,代码来源:email.php


示例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;
 }
开发者ID:muten84,项目名称:luigibifulco.it,代码行数:9,代码来源:number.php


示例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'));
 }
开发者ID:aoimedia,项目名称:kosmonautensofa,代码行数:10,代码来源:LTest.php


示例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();
     }
 }
开发者ID:kristianhalte,项目名称:super_organic,代码行数:10,代码来源:user.php


示例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' => '&lsaquo;', 'nextMonth' => '&rsaquo;', '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;
 }
开发者ID:aoimedia,项目名称:kosmonautensofa,代码行数:11,代码来源:date.php


示例16: label

 public function label()
 {
     if (!$this->label) {
         return null;
     }
     $label = new Brick('label', $this->i18n($this->label));
     $label->addClass('label');
     $label->attr('for', $this->id());
     if ($this->required()) {
         $label->append(new Brick('abbr', '*', array('title' => l::get('required', 'Required'))));
     }
     return $label;
 }
开发者ID:nsteiner,项目名称:kdoc,代码行数:13,代码来源:base.php


示例17: configure

 public static function configure()
 {
     if (is_null(static::$site)) {
         static::$site = kirby::panelsetup();
     }
     // load all available routes
     static::$routes = array_merge(static::$routes, require root('panel.app.routes') . DS . 'api.php');
     static::$routes = array_merge(static::$routes, require root('panel.app.routes') . DS . 'views.php');
     // setup the blueprint root
     blueprint::$root = c::get('root.site') . DS . 'blueprints';
     // start the router
     static::$router = new Router();
     static::$router->register(static::$routes);
     // content language switcher variable
     if (static::$site->multilang()) {
         if ($language = server::get('http_language') or $language = s::get('lang')) {
             static::$site->visit('/', $language);
         }
         app::$language = static::$site->language()->code();
         s::set('lang', app::$language);
     }
     // load the interface language file
     if (static::$site->user()) {
         $languageCode = static::$site->user()->language();
     } else {
         $languageCode = c::get('panel.language', 'en');
     }
     // validate the language code
     if (!in_array($languageCode, static::languages()->keys())) {
         $languageCode = 'en';
     }
     // store the interface language
     app::$interfaceLanguage = $languageCode;
     $language = (require root('panel.app.languages') . DS . $languageCode . '.php');
     // set all language variables
     l::$data = $language['data'];
     // register router filters
     static::$router->filter('auth', function () {
         if (!app::$site->user()) {
             go('panel/login');
         }
     });
     // check for a completed installation
     static::$router->filter('isInstalled', function () {
         if (app::$site->users()->count() == 0) {
             go('panel/install');
         }
     });
     // only use the fragments of the path without params
     static::$path = implode('/', (array) url::fragments(detect::path()));
 }
开发者ID:kompuser,项目名称:panel,代码行数:51,代码来源:app.php


示例18: options

 public function options()
 {
     switch (strtolower($this->text())) {
         case 'yes/no':
             $true = l::get('fields.toggle.yes');
             $false = l::get('fields.toggle.no');
             break;
         case 'on/off':
             $true = l::get('fields.toggle.on');
             $false = l::get('fields.toggle.off');
             break;
     }
     return array('true' => $true, 'false' => $false);
 }
开发者ID:kristianhalte,项目名称:super_organic,代码行数:14,代码来源:toggle.php


示例19: file

 function file($field, $destination, $params = array())
 {
     $allowed = a::get($params, 'allowed', c::get('upload.allowed', array('image/jpeg', 'image/png', 'image/gif')));
     $maxsize = a::get($params, 'maxsize', c::get('upload.maxsize', self::max_size()));
     $overwrite = a::get($params, 'overwrite', c::get('upload.overwrite', true));
     $sanitize = a::get($params, 'sanitize', true);
     $file = a::get($_FILES, $field);
     if (empty($file)) {
         return array('status' => 'error', 'msg' => l::get('upload.errors.missing-file', 'The file has not been found'));
     }
     $name = a::get($file, 'name');
     $type = a::get($file, 'type');
     $tmp_name = a::get($file, 'tmp_name');
     $error = a::get($file, 'error');
     $size = a::get($file, 'size');
     $msg = false;
     $extension = self::mime_to_extension($type, 'jpg');
     // convert the filename to a save name
     $fname = $sanitize ? f::safe_name(f::name($name)) : f::name($name);
     // setup the destination
     $destination = str_replace('{name}', $fname, $destination);
     $destination = str_replace('{extension}', $extension, $destination);
     if (file_exists($destination) && $overwrite == false) {
         return array('status' => 'error', 'msg' => l::get('upload.errors.file-exists', 'The file exists and cannot be overwritten'));
     }
     if (empty($tmp_name)) {
         return array('status' => 'error', 'msg' => l::get('upload.errors.missing-file', 'The file has not been found'));
     }
     if ($error != 0) {
         return array('status' => 'error', 'msg' => l::get('upload.errors.invalid-upload', 'The upload failed'));
     }
     if ($size > $maxsize) {
         return array('status' => 'error', 'msg' => l::get('upload.errors.too-big', 'The file is too big'));
     }
     if (!in_array($type, $allowed)) {
         return array('status' => 'error', 'msg' => l::get('upload.errors.invalid-file', 'The file type is not allowed') . ': ' . $type);
     }
     // try to change the permissions for the destination
     @chmod(dirname($destination), 0777);
     if (!@copy($tmp_name, $destination)) {
         return array('status' => 'error', 'msg' => l::get('upload.errors.move-error', 'The file could not be moved to the server'));
     }
     // try to change the permissions for the final file
     @chmod($destination, 0777);
     return array('status' => 'success', 'msg' => l::get('upload.success', 'The file has been uploaded'), 'type' => $type, 'extension' => $extension, 'file' => $destination, 'size' => $size, 'name' => f::filename($destination));
 }
开发者ID:o-github-o,项目名称:jQuery-Ajax-Upload,代码行数:46,代码来源:upload.php


示例20: i18n

function i18n($value)
{
    if (empty($value)) {
        return null;
    } else {
        if (is_array($value)) {
            $translation = a::get($value, panel()->translation()->code());
            if (empty($translation)) {
                // try to fallback to the default language at least
                $translation = a::get($value, kirby()->option('panel.language'));
            }
            return $translation;
        } else {
            if (is_string($value) and $translation = l::get($value)) {
                return $translation;
            } else {
                return $value;
            }
        }
    }
}
开发者ID:nsteiner,项目名称:kdoc,代码行数:21,代码来源:helpers.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP l10n类代码示例发布时间:2022-05-23
下一篇:
PHP kuserPeer类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap