update for version 1.0.1
This commit is contained in:
4
code/vendor/thomaswelton/laravel-gravatar/.gitignore
vendored
Normal file
4
code/vendor/thomaswelton/laravel-gravatar/.gitignore
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
/vendor
|
||||
composer.phar
|
||||
composer.lock
|
||||
.DS_Store
|
||||
11
code/vendor/thomaswelton/laravel-gravatar/.travis.yml
vendored
Normal file
11
code/vendor/thomaswelton/laravel-gravatar/.travis.yml
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
language: php
|
||||
|
||||
php:
|
||||
- 5.4
|
||||
- 5.5
|
||||
|
||||
before_script:
|
||||
- curl -s http://getcomposer.org/installer | php
|
||||
- php composer.phar install --dev
|
||||
|
||||
script: phpunit
|
||||
20
code/vendor/thomaswelton/laravel-gravatar/LICENSE
vendored
Normal file
20
code/vendor/thomaswelton/laravel-gravatar/LICENSE
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Thomas Welton
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
93
code/vendor/thomaswelton/laravel-gravatar/README.md
vendored
Normal file
93
code/vendor/thomaswelton/laravel-gravatar/README.md
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
[](https://travis-ci.org/thomaswelton/laravel-gravatar)
|
||||
[](https://packagist.org/packages/thomaswelton/laravel-gravatar)
|
||||
[](https://packagist.org/packages/thomaswelton/laravel-gravatar)
|
||||
[](https://bitdeli.com/free "Bitdeli Badge")
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
Update your `composer.json` file to include this package as a dependency
|
||||
```json
|
||||
"thomaswelton/laravel-gravatar": "~1.0"
|
||||
```
|
||||
|
||||
Register the Gravatar service provider by adding it to the providers array in the `config/app.php` file.
|
||||
```
|
||||
Thomaswelton\LaravelGravatar\LaravelGravatarServiceProvider
|
||||
```
|
||||
|
||||
Alias the Gravatar facade by adding it to the aliases array in the `config/app.php` file.
|
||||
```php
|
||||
'aliases' => array(
|
||||
'Gravatar' => 'Thomaswelton\LaravelGravatar\Facades\Gravatar'
|
||||
)
|
||||
```
|
||||
|
||||
## Configuration - Optional
|
||||
|
||||
Copy the config file into your project by running
|
||||
```
|
||||
php artisan vendor:publish
|
||||
```
|
||||
|
||||
### Default Image
|
||||
|
||||
Update the config file to specify the default avatar size to use and a default image to be return if no Gravatar is found.
|
||||
|
||||
Allowed defaults:
|
||||
- (bool) `false`
|
||||
- (string) `404`
|
||||
- (string) `mm`: (mystery-man) a simple, cartoon-style silhouetted outline of a person (does not vary by email hash).
|
||||
- (string) `identicon`: a geometric pattern based on an email hash.
|
||||
- (string) `monsterid`: a generated 'monster' with different colors, faces, etc.
|
||||
- (string) `wavatar`: generated faces with differing features and backgrounds.
|
||||
- (string) `retro`: awesome generated, 8-bit arcade-style pixelated faces.
|
||||
|
||||
Example images can be viewed on [the Gravatar website](https://gravatar.com/site/implement/images/).
|
||||
|
||||
### Content Ratings
|
||||
|
||||
By default only "G" rated images will be shown. You can change this system wide in the config file by editing `'maxRating' => 'g'` allowed values are
|
||||
- `g`: suitable for display on all websites with any audience type.
|
||||
- `pg`: may contain rude gestures, provocatively dressed individuals, the lesser swear words, or mild violence.
|
||||
- `r`: may contain such things as harsh profanity, intense violence, nudity, or hard drug use.
|
||||
- `x`: may contain hardcore sexual imagery or extremely disturbing violence.
|
||||
|
||||
The content rating can be changed by changing the `$rating` argument when calling `Gravatar::src` or `Gravatar::image`.
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
### Gravatar::exists($email)
|
||||
Returns a boolean telling if the given `$email` has got a Gravatar.
|
||||
|
||||
### Gravatar::src($email, $size = null, $rating = null)
|
||||
|
||||
Returns the https URL for the Gravatar of the email address specified.
|
||||
Can optionally pass in the size required as an integer. The size will be contained within a range between 1 - 512 as gravatar will no return sizes greater than 512 of less than 1
|
||||
|
||||
```html
|
||||
<!-- Show image with default dimensions -->
|
||||
<img src="{{ Gravatar::src('thomaswelton@me.com') }}">
|
||||
|
||||
<!-- Show image at 200px -->
|
||||
<img src="{{ Gravatar::src('thomaswelton@me.com', 200) }}">
|
||||
|
||||
<!-- Show image at 512px scaled in HTML to 1024px -->
|
||||
<img src="{{ Gravatar::src('thomaswelton@me.com', 1024) }}" width=1024>
|
||||
```
|
||||
|
||||
### Gravatar::image($email, $alt = null, $attributes = array(), $rating = null)
|
||||
|
||||
Returns the HTML for an `<img>` tag
|
||||
|
||||
```php
|
||||
// Show image with default dimensions
|
||||
echo Gravatar::image('thomaswelton@me.com');
|
||||
|
||||
// Show image at 200px
|
||||
echo Gravatar::image('thomaswelton@me.com', 'Some picture', array('width' => 200, 'height' => 200));
|
||||
|
||||
// Show image at 512px scaled in HTML to 1024px
|
||||
echo Gravatar::image('thomaswelton@me.com', 'Some picture', array('width' => 1024, 'height' => 1024));
|
||||
```
|
||||
34
code/vendor/thomaswelton/laravel-gravatar/composer.json
vendored
Normal file
34
code/vendor/thomaswelton/laravel-gravatar/composer.json
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"name":"thomaswelton/laravel-gravatar",
|
||||
"description":"Laravel 5 Gravatar helper",
|
||||
"keywords":[
|
||||
"laravel",
|
||||
"laravel5",
|
||||
"gravatar"
|
||||
],
|
||||
"homepage":"https://github.com/thomaswelton/laravel-gravatar",
|
||||
"license":"MIT",
|
||||
"authors":[
|
||||
{
|
||||
"name":"ThomasWelton",
|
||||
"email":"thomaswelton@me.com",
|
||||
"role":"Developer"
|
||||
},
|
||||
{
|
||||
"name":"Antoine Augusti",
|
||||
"email":"antoine.augusti@gmail.com",
|
||||
"role":"Developer"
|
||||
}
|
||||
],
|
||||
"require":{
|
||||
"php":">=5.4.0",
|
||||
"illuminate/support":"~5.0",
|
||||
"thomaswelton/gravatarlib":"0.1.x"
|
||||
},
|
||||
"autoload":{
|
||||
"psr-0":{
|
||||
"Thomaswelton\\LaravelGravatar":"src/"
|
||||
}
|
||||
},
|
||||
"minimum-stability":"stable"
|
||||
}
|
||||
23
code/vendor/thomaswelton/laravel-gravatar/config/gravatar.php
vendored
Normal file
23
code/vendor/thomaswelton/laravel-gravatar/config/gravatar.php
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
return array(
|
||||
// --- The default avatar size
|
||||
'size' => 80,
|
||||
|
||||
// --- The default avatar to display if we have no results
|
||||
// (bool) false
|
||||
// (string) 404
|
||||
// (string) mm: (mystery-man) a simple, cartoon-style silhouetted outline of a person (does not vary by email hash).
|
||||
// (string) identicon: a geometric pattern based on an email hash.
|
||||
// (string) monsterid: a generated 'monster' with different colors, faces, etc.
|
||||
// (string) wavatar: generated faces with differing features and backgrounds.
|
||||
// (string) retro: awesome generated, 8-bit arcade-style pixelated faces.
|
||||
'default' => 'identicon',
|
||||
|
||||
// --- Set the type of avatars we allow to show
|
||||
// - g: suitable for display on all websites with any audience type.
|
||||
// - pg: may contain rude gestures, provocatively dressed individuals, the lesser swear words, or mild violence.
|
||||
// - r: may contain such things as harsh profanity, intense violence, nudity, or hard drug use.
|
||||
// - x: may contain hardcore sexual imagery or extremely disturbing violence.
|
||||
'maxRating' => 'g'
|
||||
);
|
||||
18
code/vendor/thomaswelton/laravel-gravatar/phpunit.xml
vendored
Normal file
18
code/vendor/thomaswelton/laravel-gravatar/phpunit.xml
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<phpunit backupGlobals="false"
|
||||
backupStaticAttributes="false"
|
||||
bootstrap="vendor/autoload.php"
|
||||
colors="true"
|
||||
convertErrorsToExceptions="true"
|
||||
convertNoticesToExceptions="true"
|
||||
convertWarningsToExceptions="true"
|
||||
processIsolation="false"
|
||||
stopOnFailure="false"
|
||||
syntaxCheck="false"
|
||||
>
|
||||
<testsuites>
|
||||
<testsuite name="Package Test Suite">
|
||||
<directory suffix=".php">./tests/</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
</phpunit>
|
||||
14
code/vendor/thomaswelton/laravel-gravatar/src/Thomaswelton/LaravelGravatar/Facades/Gravatar.php
vendored
Normal file
14
code/vendor/thomaswelton/laravel-gravatar/src/Thomaswelton/LaravelGravatar/Facades/Gravatar.php
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
<?php namespace Thomaswelton\LaravelGravatar\Facades;
|
||||
|
||||
use Illuminate\Support\Facades\Facade;
|
||||
|
||||
class Gravatar extends Facade
|
||||
{
|
||||
/**
|
||||
* Get the registered name of the component.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected static function getFacadeAccessor() { return 'gravatar'; }
|
||||
|
||||
}
|
||||
75
code/vendor/thomaswelton/laravel-gravatar/src/Thomaswelton/LaravelGravatar/Gravatar.php
vendored
Normal file
75
code/vendor/thomaswelton/laravel-gravatar/src/Thomaswelton/LaravelGravatar/Gravatar.php
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php namespace Thomaswelton\LaravelGravatar;
|
||||
|
||||
use Illuminate\Contracts\Config\Repository as Config;
|
||||
use Illuminate\Support\Facades\HTML;
|
||||
use thomaswelton\GravatarLib\Gravatar as GravatarLib;
|
||||
|
||||
class Gravatar extends GravatarLib
|
||||
{
|
||||
private $defaultSize = null;
|
||||
|
||||
public function __construct(Config $config)
|
||||
{
|
||||
// Set default configuration values
|
||||
$this->setDefaultImage($config->get('gravatar.default'));
|
||||
$this->defaultSize = $config->get('gravatar.size');
|
||||
$this->setMaxRating($config->get('gravatar.maxRating', 'g'));
|
||||
|
||||
// Enable secure images by default
|
||||
$this->enableSecureImages();
|
||||
}
|
||||
|
||||
public function src($email, $size = null, $rating = null)
|
||||
{
|
||||
if (is_null($size))
|
||||
{
|
||||
$size = $this->defaultSize;
|
||||
}
|
||||
|
||||
$size = max(1, min(512, $size));
|
||||
|
||||
$this->setAvatarSize($size);
|
||||
|
||||
if ( ! is_null($rating))
|
||||
{
|
||||
$this->setMaxRating($rating);
|
||||
}
|
||||
|
||||
return htmlentities($this->buildGravatarURL($email));
|
||||
}
|
||||
|
||||
public function image($email, $alt = null, $attributes = array(), $rating = null)
|
||||
{
|
||||
$dimensions = array();
|
||||
|
||||
if (array_key_exists('width', $attributes)) $dimensions[] = $attributes['width'];
|
||||
if (array_key_exists('height', $attributes)) $dimensions[] = $attributes['height'];
|
||||
|
||||
$max_dimension = (count($dimensions)) ? min(512, max($dimensions)) : $this->defaultSize;
|
||||
|
||||
$src = $this->src($email, $max_dimension, $rating);
|
||||
|
||||
if ( ! array_key_exists('width', $attributes) && !array_key_exists('height', $attributes))
|
||||
{
|
||||
$attributes['width'] = $this->size;
|
||||
$attributes['height'] = $this->size;
|
||||
}
|
||||
|
||||
return $this->formatImage($src, $alt, $attributes);
|
||||
}
|
||||
|
||||
public function exists($email)
|
||||
{
|
||||
$this->setDefaultImage('404');
|
||||
|
||||
$url = $this->buildGravatarURL($email);
|
||||
$headers = get_headers($url, 1);
|
||||
|
||||
return strpos($headers[0], '200') ? true : false;
|
||||
}
|
||||
|
||||
private function formatImage($src, $alt, $attributes)
|
||||
{
|
||||
return '<img src="'.$src.'" alt="'.$alt.'" height="'.$attributes['height'].'" width="'.$attributes['width'].'">';
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php namespace Thomaswelton\LaravelGravatar;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class LaravelGravatarServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Boot the service provider.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
$this->setupConfig();
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup the config.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function setupConfig()
|
||||
{
|
||||
$source = realpath(__DIR__.'/../../../config/gravatar.php');
|
||||
$this->publishes([$source => config_path('gravatar.php')]);
|
||||
$this->mergeConfigFrom($source, 'gravatar');
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the service provider.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
$this->app['gravatar'] = $this->app->share(function($app)
|
||||
{
|
||||
return new Gravatar($this->app['config']);
|
||||
});
|
||||
}
|
||||
}
|
||||
0
code/vendor/thomaswelton/laravel-gravatar/tests/.gitkeep
vendored
Normal file
0
code/vendor/thomaswelton/laravel-gravatar/tests/.gitkeep
vendored
Normal file
Reference in New Issue
Block a user