当前位置: 首页>>代码示例>>PHP>>正文


PHP a::get方法代码示例

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


在下文中一共展示了a::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 function __construct($image, $options = array())
 {
     $this->root = c::get('thumb.cache.root', c::get('root') . '/thumbs');
     $this->url = c::get('thumb.cache.url', c::get('url') . '/thumbs');
     if (!$image) {
         return false;
     }
     $this->obj = $image;
     // set some values from the image
     $this->sourceWidth = $this->obj->width();
     $this->sourceHeight = $this->obj->height();
     $this->width = $this->sourceWidth;
     $this->height = $this->sourceHeight;
     $this->source = $this->obj->root();
     $this->mime = $this->obj->mime();
     // set the max width and height
     $this->maxWidth = @$options['width'];
     $this->maxHeight = @$options['height'];
     // set the quality
     $this->crop = @$options['crop'];
     // set the quality
     $this->quality = a::get($options, 'quality', c::get('thumb.quality', 100));
     // set the default upscale behavior
     $this->upscale = a::get($options, 'upscale', c::get('thumb.upscale', false));
     // set the alt text
     $this->alt = a::get($options, 'alt', $this->obj->name());
     // set the className text
     $this->className = @$options['class'];
     // set the new size
     $this->size();
     // create the thumbnail
     $this->create();
 }
开发者ID:roblen,项目名称:kirbycms-extensions,代码行数:33,代码来源:thumb.php

示例2: get

 static function get($key = null, $default = null)
 {
     if ($key === null) {
         return (array) self::$vars;
     }
     return a::get(self::$vars, $key, $default);
 }
开发者ID:narrenfrei,项目名称:kirbycms,代码行数:7,代码来源:template.php

示例3: update

 public function update($data = array())
 {
     if (!panel()->user()->isAdmin() and !$this->isCurrent()) {
         throw new Exception(l('users.form.error.update.rights'));
     }
     // users which are not an admin cannot change their role
     if (!panel()->user()->isAdmin()) {
         unset($data['role']);
     }
     if (str::length(a::get($data, 'password')) > 0) {
         if (a::get($data, 'password') !== a::get($data, 'passwordconfirmation')) {
             throw new Exception(l('users.form.error.password.confirm'));
         }
     } else {
         unset($data['password']);
     }
     unset($data['passwordconfirmation']);
     if ($this->isLastAdmin() and a::get($data, 'role') !== 'admin') {
         // check the number of left admins to not convert the last one
         throw new Exception(l('user.error.lastadmin'));
     }
     parent::update($data);
     // flush the cache in case if the user data is
     // used somewhere on the site (i.e. for profiles)
     kirby()->cache()->flush();
     kirby()->trigger('panel.user.update', $this);
     return $this;
 }
开发者ID:robinandersen,项目名称:robin,代码行数:28,代码来源:user.php

示例4: get

 /**
  * Gets a value from the _SERVER array
  * 
  * <code>
  * 
  * server::get('document_root');
  * // sample output: /var/www/kirby
  * 
  * server::get();
  * // returns the whole server array
  *
  * </code>   
  *
  * @param  mixed    $key The key to look for. Pass false or null to return the entire server array. 
  * @param  mixed    $default Optional default value, which should be returned if no element has been found
  * @return mixed
  */
 public static function get($key = false, $default = null)
 {
     if (empty($key)) {
         return $_SERVER;
     }
     return a::get($_SERVER, str::upper($key), $default);
 }
开发者ID:chrishiam,项目名称:LVSL,代码行数:24,代码来源:server.php

示例5: checkPassword

 static function checkPassword($user, $password)
 {
     // check for empty passwords
     if (empty($password) || empty($user['password'])) {
         return false;
     }
     // get the encryption
     $encryption = a::get($user, 'encrypt', false);
     // handle the different
     // encryption types
     switch ($encryption) {
         // sha1 encoded
         case 'sha1':
             return sha1($password) == $user['password'] ? true : false;
             break;
             // md5 encoded
         // md5 encoded
         case 'md5':
             return md5($password) == $user['password'] ? true : false;
             break;
             // plain passwords
         // plain passwords
         default:
             return $password == $user['password'] ? true : false;
             break;
     }
     // we should never get here
     // but let's make sure
     return false;
 }
开发者ID:codecuts,项目名称:lanningsmith-website,代码行数:30,代码来源:user.php

示例6: fields

 public function fields()
 {
     $fields = $this->config->fields();
     $fields = new Fields($fields, $this->model);
     $fields = $fields->toArray();
     // make sure that no unwanted options or fields
     // are being included here
     foreach ($fields as $name => $field) {
         // remove all structure fields within structures
         if ($field['type'] == 'structure') {
             unset($fields[$name]);
             // remove invalid buttons from textareas
         } else {
             if ($field['type'] == 'textarea') {
                 $buttons = a::get($fields[$name], 'buttons');
                 if (is_array($buttons)) {
                     foreach ($buttons as $index => $value) {
                         if (in_array($value, array('link', 'email'))) {
                             unset($fields[$name]['buttons'][$index]);
                         }
                     }
                 } else {
                     if ($buttons !== false) {
                         $fields[$name]['buttons'] = array('bold', 'italic');
                     }
                 }
             }
         }
     }
     return $fields;
 }
开发者ID:irenehilber,项目名称:kirby-base,代码行数:31,代码来源:structure.php

示例7: _default

 public function _default($default)
 {
     if (empty($default)) {
         return '';
     } else {
         if (is_string($default)) {
             return $default;
         } else {
             $type = a::get($default, 'type');
             switch ($type) {
                 case 'date':
                     $format = a::get($default, 'format', 'Y-m-d');
                     return date($format);
                     break;
                 case 'datetime':
                     $format = a::get($default, 'format', 'Y-m-d H:i:s');
                     return date($format);
                     break;
                 case 'user':
                     $user = isset($default['user']) ? site()->users()->find($default['user']) : site()->user();
                     if (!$user) {
                         return '';
                     }
                     return (isset($default['field']) and $default['field'] != 'password') ? $user->{$default['field']}() : $user->username();
                     break;
                 default:
                     return $default;
                     break;
             }
         }
     }
 }
开发者ID:kompuser,项目名称:panel,代码行数:32,代码来源:field.php

示例8: get

 /**
  * Retreives a field info object from the registry
  * 
  * @param string|null $name If null, all registered fields will be returned as array
  * @param Obj|null|array
  */
 public function get($name = null)
 {
     if (is_null($name)) {
         return static::$fields;
     }
     return a::get(static::$fields, $name);
 }
开发者ID:kgchoy,项目名称:main-portfolio-website,代码行数:13,代码来源:field.php

示例9: message

 public function message()
 {
     if ($message = s::get('message') and is_array($message)) {
         $text = a::get($message, 'text');
         $type = a::get($message, 'type', 'notification');
         $element = new Brick('div');
         $element->addClass('message');
         if ($type == 'error') {
             $element->addClass('message-is-alert');
         } else {
             $element->addClass('message-is-notice');
         }
         $element->append(function () use($text) {
             $content = new Brick('span');
             $content->addClass('message-content');
             $content->text($text);
             return $content;
         });
         $element->append(function () {
             $toggle = new Brick('a');
             $toggle->attr('href', url::current());
             $toggle->addClass('message-toggle');
             $toggle->html('<i>&times;</i>');
             return $toggle;
         });
         s::remove('message');
         return $element;
     }
 }
开发者ID:irenehilber,项目名称:kirby-base,代码行数:29,代码来源:topbar.php

示例10: testGet

 public function testGet()
 {
     $this->assertEquals('testuser', a::get($this->user, 'username'));
     // get an array of keys
     $array = a::get($this->user, array('username', 'email'));
     $this->assertEquals(array('username' => 'testuser', 'email' => 'test@user.com'), $array);
 }
开发者ID:LucasFyl,项目名称:korakia,代码行数:7,代码来源:ATest.php

示例11: __construct

 public function __construct($params = array())
 {
     // start the fields collection
     $this->params = $params;
     if ($params === false) {
         $this->fields = array();
         $this->type = array();
         $this->size = false;
         $this->width = false;
         $this->height = false;
         $this->max = 0;
         $this->hide = true;
         $this->sortable = false;
     } else {
         if (is_array($params)) {
             $this->fields = a::get($params, 'fields', $this->fields);
             $this->type = a::get($params, 'type', $this->type);
             if (!is_array($this->type)) {
                 $this->type = array($this->type);
             }
             $this->size = a::get($params, 'size', $this->size);
             $this->width = a::get($params, 'width', $this->width);
             $this->height = a::get($params, 'height', $this->height);
             $this->max = a::get($params, 'max', $this->max);
             $this->hide = a::get($params, 'hide', $this->hide);
             $this->sort = a::get($params, 'sort', $this->sort);
             $this->sortable = a::get($params, 'sortable', $this->sortable);
             $this->sanitize = a::get($params, 'sanitize', true);
         }
     }
 }
开发者ID:irenehilber,项目名称:kirby-base,代码行数:31,代码来源:files.php

示例12: get

 function get($part = null, $default = null)
 {
     $path = self::$path ? self::$path : self::path();
     if (!$part) {
         return $path;
     }
     return a::get($path, $part - 1, $default);
 }
开发者ID:o-github-o,项目名称:jQuery-Ajax-Upload,代码行数:8,代码来源:uri.php

示例13: __construct

 /**
  * @param array $options
  */
 public function __construct($options)
 {
     $this->preview = a::get($options, 'preview', true);
     $this->status = a::get($options, 'status', true);
     $this->template = a::get($options, 'template', true);
     $this->url = a::get($options, 'url', true);
     $this->delete = a::get($options, 'delete', true);
 }
开发者ID:nsteiner,项目名称:kdoc,代码行数:11,代码来源:options.php

示例14: delete

 public function delete($id = null)
 {
     $filename = get('filename');
     $page = $this->page($id);
     $file = $this->file($page, $filename);
     $back = array('index' => purl('files/index/' . $page->id()), 'file' => purl($file, 'show'));
     return view('files/delete', array('p' => $page, 'f' => $file, 'back' => a::get($back, get('to'))));
 }
开发者ID:aoimedia,项目名称:kosmonautensofa,代码行数:8,代码来源:files.php

示例15: avatar

 public function avatar($username)
 {
     $user = $this->user($username);
     $back = array('users' => purl('users'), 'user' => purl($user, 'edit'), 'dashboard' => purl(''));
     if (!site()->user()->isAdmin() and !$user->isCurrent()) {
         goToErrorView('modal');
     }
     return view('users/avatar', array('user' => $user, 'uploadable' => is_writable(kirby()->roots()->avatars()), 'back' => a::get($back, get('to'))));
 }
开发者ID:aoimedia,项目名称:kosmonautensofa,代码行数:9,代码来源:users.php


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