http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/laravel/framework/src/Illuminate/Http/Request.php ---------------------------------------------------------------------- diff --git a/vendor/laravel/framework/src/Illuminate/Http/Request.php b/vendor/laravel/framework/src/Illuminate/Http/Request.php deleted file mode 100755 index 580f119..0000000 --- a/vendor/laravel/framework/src/Illuminate/Http/Request.php +++ /dev/null @@ -1,608 +0,0 @@ -<?php namespace Illuminate\Http; - -use SplFileInfo; -use Symfony\Component\HttpFoundation\ParameterBag; -use Symfony\Component\HttpFoundation\Request as SymfonyRequest; - -class Request extends SymfonyRequest { - - /** - * The decoded JSON content for the request. - * - * @var string - */ - protected $json; - - /** - * The Illuminate session store implementation. - * - * @var \Illuminate\Session\Store - */ - protected $sessionStore; - - /** - * Return the Request instance. - * - * @return $this - */ - public function instance() - { - return $this; - } - - /** - * Get the request method. - * - * @return string - */ - public function method() - { - return $this->getMethod(); - } - - /** - * Get the root URL for the application. - * - * @return string - */ - public function root() - { - return rtrim($this->getSchemeAndHttpHost().$this->getBaseUrl(), '/'); - } - - /** - * Get the URL (no query string) for the request. - * - * @return string - */ - public function url() - { - return rtrim(preg_replace('/\?.*/', '', $this->getUri()), '/'); - } - - /** - * Get the full URL for the request. - * - * @return string - */ - public function fullUrl() - { - $query = $this->getQueryString(); - - return $query ? $this->url().'?'.$query : $this->url(); - } - - /** - * Get the current path info for the request. - * - * @return string - */ - public function path() - { - $pattern = trim($this->getPathInfo(), '/'); - - return $pattern == '' ? '/' : $pattern; - } - - /** - * Get the current encoded path info for the request. - * - * @return string - */ - public function decodedPath() - { - return rawurldecode($this->path()); - } - - /** - * Get a segment from the URI (1 based index). - * - * @param string $index - * @param mixed $default - * @return string - */ - public function segment($index, $default = null) - { - return array_get($this->segments(), $index - 1, $default); - } - - /** - * Get all of the segments for the request path. - * - * @return array - */ - public function segments() - { - $segments = explode('/', $this->path()); - - return array_values(array_filter($segments, function($v) { return $v != ''; })); - } - - /** - * Determine if the current request URI matches a pattern. - * - * @param mixed string - * @return bool - */ - public function is() - { - foreach (func_get_args() as $pattern) - { - if (str_is($pattern, urldecode($this->path()))) - { - return true; - } - } - - return false; - } - - /** - * Determine if the request is the result of an AJAX call. - * - * @return bool - */ - public function ajax() - { - return $this->isXmlHttpRequest(); - } - - /** - * Determine if the request is over HTTPS. - * - * @return bool - */ - public function secure() - { - return $this->isSecure(); - } - - /** - * Returns the client IP address. - * - * @return string - */ - public function ip() - { - return $this->getClientIp(); - } - - /** - * Returns the client IP addresses. - * - * @return array - */ - public function ips() - { - return $this->getClientIps(); - } - - /** - * Determine if the request contains a given input item key. - * - * @param string|array $key - * @return bool - */ - public function exists($key) - { - $keys = is_array($key) ? $key : func_get_args(); - - $input = $this->all(); - - foreach ($keys as $value) - { - if ( ! array_key_exists($value, $input)) return false; - } - - return true; - } - - /** - * Determine if the request contains a non-empty value for an input item. - * - * @param string|array $key - * @return bool - */ - public function has($key) - { - $keys = is_array($key) ? $key : func_get_args(); - - foreach ($keys as $value) - { - if ($this->isEmptyString($value)) return false; - } - - return true; - } - - /** - * Determine if the given input key is an empty string for "has". - * - * @param string $key - * @return bool - */ - protected function isEmptyString($key) - { - $boolOrArray = is_bool($this->input($key)) || is_array($this->input($key)); - - return ! $boolOrArray && trim((string) $this->input($key)) === ''; - } - - /** - * Get all of the input and files for the request. - * - * @return array - */ - public function all() - { - return array_replace_recursive($this->input(), $this->files->all()); - } - - /** - * Retrieve an input item from the request. - * - * @param string $key - * @param mixed $default - * @return string - */ - public function input($key = null, $default = null) - { - $input = $this->getInputSource()->all() + $this->query->all(); - - return array_get($input, $key, $default); - } - - /** - * Get a subset of the items from the input data. - * - * @param array $keys - * @return array - */ - public function only($keys) - { - $keys = is_array($keys) ? $keys : func_get_args(); - - $results = []; - - $input = $this->all(); - - foreach ($keys as $key) - { - array_set($results, $key, array_get($input, $key)); - } - - return $results; - } - - /** - * Get all of the input except for a specified array of items. - * - * @param array $keys - * @return array - */ - public function except($keys) - { - $keys = is_array($keys) ? $keys : func_get_args(); - - $results = $this->all(); - - array_forget($results, $keys); - - return $results; - } - - /** - * Retrieve a query string item from the request. - * - * @param string $key - * @param mixed $default - * @return string - */ - public function query($key = null, $default = null) - { - return $this->retrieveItem('query', $key, $default); - } - - /** - * Determine if a cookie is set on the request. - * - * @param string $key - * @return bool - */ - public function hasCookie($key) - { - return ! is_null($this->cookie($key)); - } - - /** - * Retrieve a cookie from the request. - * - * @param string $key - * @param mixed $default - * @return string - */ - public function cookie($key = null, $default = null) - { - return $this->retrieveItem('cookies', $key, $default); - } - - /** - * Retrieve a file from the request. - * - * @param string $key - * @param mixed $default - * @return \Symfony\Component\HttpFoundation\File\UploadedFile|array - */ - public function file($key = null, $default = null) - { - return array_get($this->files->all(), $key, $default); - } - - /** - * Determine if the uploaded data contains a file. - * - * @param string $key - * @return bool - */ - public function hasFile($key) - { - if ( ! is_array($files = $this->file($key))) $files = array($files); - - foreach ($files as $file) - { - if ($this->isValidFile($file)) return true; - } - - return false; - } - - /** - * Check that the given file is a valid file instance. - * - * @param mixed $file - * @return bool - */ - protected function isValidFile($file) - { - return $file instanceof SplFileInfo && $file->getPath() != ''; - } - - /** - * Retrieve a header from the request. - * - * @param string $key - * @param mixed $default - * @return string - */ - public function header($key = null, $default = null) - { - return $this->retrieveItem('headers', $key, $default); - } - - /** - * Retrieve a server variable from the request. - * - * @param string $key - * @param mixed $default - * @return string - */ - public function server($key = null, $default = null) - { - return $this->retrieveItem('server', $key, $default); - } - - /** - * Retrieve an old input item. - * - * @param string $key - * @param mixed $default - * @return mixed - */ - public function old($key = null, $default = null) - { - return $this->session()->getOldInput($key, $default); - } - - /** - * Flash the input for the current request to the session. - * - * @param string $filter - * @param array $keys - * @return void - */ - public function flash($filter = null, $keys = array()) - { - $flash = ( ! is_null($filter)) ? $this->$filter($keys) : $this->input(); - - $this->session()->flashInput($flash); - } - - /** - * Flash only some of the input to the session. - * - * @param mixed string - * @return void - */ - public function flashOnly($keys) - { - $keys = is_array($keys) ? $keys : func_get_args(); - - return $this->flash('only', $keys); - } - - /** - * Flash only some of the input to the session. - * - * @param mixed string - * @return void - */ - public function flashExcept($keys) - { - $keys = is_array($keys) ? $keys : func_get_args(); - - return $this->flash('except', $keys); - } - - /** - * Flush all of the old input from the session. - * - * @return void - */ - public function flush() - { - $this->session()->flashInput(array()); - } - - /** - * Retrieve a parameter item from a given source. - * - * @param string $source - * @param string $key - * @param mixed $default - * @return string - */ - protected function retrieveItem($source, $key, $default) - { - if (is_null($key)) - { - return $this->$source->all(); - } - - return $this->$source->get($key, $default, true); - } - - /** - * Merge new input into the current request's input array. - * - * @param array $input - * @return void - */ - public function merge(array $input) - { - $this->getInputSource()->add($input); - } - - /** - * Replace the input for the current request. - * - * @param array $input - * @return void - */ - public function replace(array $input) - { - $this->getInputSource()->replace($input); - } - - /** - * Get the JSON payload for the request. - * - * @param string $key - * @param mixed $default - * @return mixed - */ - public function json($key = null, $default = null) - { - if ( ! isset($this->json)) - { - $this->json = new ParameterBag((array) json_decode($this->getContent(), true)); - } - - if (is_null($key)) return $this->json; - - return array_get($this->json->all(), $key, $default); - } - - /** - * Get the input source for the request. - * - * @return \Symfony\Component\HttpFoundation\ParameterBag - */ - protected function getInputSource() - { - if ($this->isJson()) return $this->json(); - - return $this->getMethod() == 'GET' ? $this->query : $this->request; - } - - /** - * Determine if the request is sending JSON. - * - * @return bool - */ - public function isJson() - { - return str_contains($this->header('CONTENT_TYPE'), '/json'); - } - - /** - * Determine if the current request is asking for JSON in return. - * - * @return bool - */ - public function wantsJson() - { - $acceptable = $this->getAcceptableContentTypes(); - - return isset($acceptable[0]) && $acceptable[0] == 'application/json'; - } - - /** - * Get the data format expected in the response. - * - * @param string $default - * @return string - */ - public function format($default = 'html') - { - foreach ($this->getAcceptableContentTypes() as $type) - { - if ($format = $this->getFormat($type)) return $format; - } - - return $default; - } - - /** - * Create an Illuminate request from a Symfony instance. - * - * @param \Symfony\Component\HttpFoundation\Request $request - * @return \Illuminate\Http\Request - */ - public static function createFromBase(SymfonyRequest $request) - { - if ($request instanceof static) return $request; - - $content = $request->content; - - $request = (new static)->duplicate( - - $request->query->all(), $request->request->all(), $request->attributes->all(), - - $request->cookies->all(), $request->files->all(), $request->server->all() - ); - - $request->content = $content; - - $request->request = $request->getInputSource(); - - return $request; - } - - /** - * Get the session associated with the request. - * - * @return \Illuminate\Session\Store - * - * @throws \RuntimeException - */ - public function session() - { - if ( ! $this->hasSession()) - { - throw new \RuntimeException("Session store not set on request."); - } - - return $this->getSession(); - } - -}
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/laravel/framework/src/Illuminate/Http/Response.php ---------------------------------------------------------------------- diff --git a/vendor/laravel/framework/src/Illuminate/Http/Response.php b/vendor/laravel/framework/src/Illuminate/Http/Response.php deleted file mode 100755 index f5d5151..0000000 --- a/vendor/laravel/framework/src/Illuminate/Http/Response.php +++ /dev/null @@ -1,85 +0,0 @@ -<?php namespace Illuminate\Http; - -use ArrayObject; -use Illuminate\Support\Contracts\JsonableInterface; -use Illuminate\Support\Contracts\RenderableInterface; - -class Response extends \Symfony\Component\HttpFoundation\Response { - - use ResponseTrait; - - /** - * The original content of the response. - * - * @var mixed - */ - public $original; - - /** - * Set the content on the response. - * - * @param mixed $content - * @return $this - */ - public function setContent($content) - { - $this->original = $content; - - // If the content is "JSONable" we will set the appropriate header and convert - // the content to JSON. This is useful when returning something like models - // from routes that will be automatically transformed to their JSON form. - if ($this->shouldBeJson($content)) - { - $this->headers->set('Content-Type', 'application/json'); - - $content = $this->morphToJson($content); - } - - // If this content implements the "RenderableInterface", then we will call the - // render method on the object so we will avoid any "__toString" exceptions - // that might be thrown and have their errors obscured by PHP's handling. - elseif ($content instanceof RenderableInterface) - { - $content = $content->render(); - } - - return parent::setContent($content); - } - - /** - * Morph the given content into JSON. - * - * @param mixed $content - * @return string - */ - protected function morphToJson($content) - { - if ($content instanceof JsonableInterface) return $content->toJson(); - - return json_encode($content); - } - - /** - * Determine if the given content should be turned into JSON. - * - * @param mixed $content - * @return bool - */ - protected function shouldBeJson($content) - { - return $content instanceof JsonableInterface || - $content instanceof ArrayObject || - is_array($content); - } - - /** - * Get the original response content. - * - * @return mixed - */ - public function getOriginalContent() - { - return $this->original; - } - -} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/laravel/framework/src/Illuminate/Http/ResponseTrait.php ---------------------------------------------------------------------- diff --git a/vendor/laravel/framework/src/Illuminate/Http/ResponseTrait.php b/vendor/laravel/framework/src/Illuminate/Http/ResponseTrait.php deleted file mode 100644 index 2cfd9be..0000000 --- a/vendor/laravel/framework/src/Illuminate/Http/ResponseTrait.php +++ /dev/null @@ -1,35 +0,0 @@ -<?php namespace Illuminate\Http; - -use Symfony\Component\HttpFoundation\Cookie; - -trait ResponseTrait { - - /** - * Set a header on the Response. - * - * @param string $key - * @param string $value - * @param bool $replace - * @return $this - */ - public function header($key, $value, $replace = true) - { - $this->headers->set($key, $value, $replace); - - return $this; - } - - /** - * Add a cookie to the response. - * - * @param \Symfony\Component\HttpFoundation\Cookie $cookie - * @return $this - */ - public function withCookie(Cookie $cookie) - { - $this->headers->setCookie($cookie); - - return $this; - } - -} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/laravel/framework/src/Illuminate/Http/composer.json ---------------------------------------------------------------------- diff --git a/vendor/laravel/framework/src/Illuminate/Http/composer.json b/vendor/laravel/framework/src/Illuminate/Http/composer.json deleted file mode 100755 index d8d6b80..0000000 --- a/vendor/laravel/framework/src/Illuminate/Http/composer.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "illuminate/http", - "license": "MIT", - "authors": [ - { - "name": "Taylor Otwell", - "email": "[email protected]" - } - ], - "require": { - "php": ">=5.4.0", - "illuminate/session": "4.2.*", - "illuminate/support": "4.2.*", - "symfony/http-foundation": "2.5.*", - "symfony/http-kernel": "2.5.*" - }, - "autoload": { - "psr-0": { - "Illuminate\\Http": "" - } - }, - "target-dir": "Illuminate/Http", - "extra": { - "branch-alias": { - "dev-master": "4.2-dev" - } - }, - "minimum-stability": "dev" -} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/laravel/framework/src/Illuminate/Log/LogServiceProvider.php ---------------------------------------------------------------------- diff --git a/vendor/laravel/framework/src/Illuminate/Log/LogServiceProvider.php b/vendor/laravel/framework/src/Illuminate/Log/LogServiceProvider.php deleted file mode 100755 index 77f8f05..0000000 --- a/vendor/laravel/framework/src/Illuminate/Log/LogServiceProvider.php +++ /dev/null @@ -1,55 +0,0 @@ -<?php namespace Illuminate\Log; - -use Monolog\Logger; -use Illuminate\Support\ServiceProvider; - -class LogServiceProvider extends ServiceProvider { - - /** - * Indicates if loading of the provider is deferred. - * - * @var bool - */ - protected $defer = true; - - /** - * Register the service provider. - * - * @return void - */ - public function register() - { - $logger = new Writer( - new Logger($this->app['env']), $this->app['events'] - ); - - // Once we have an instance of the logger we'll bind it as an instance into - // the container so that it is available for resolution. We'll also bind - // the PSR Logger interface to resolve to this Monolog implementation. - $this->app->instance('log', $logger); - - $this->app->bind('Psr\Log\LoggerInterface', function($app) - { - return $app['log']->getMonolog(); - }); - - // If the setup Closure has been bound in the container, we will resolve it - // and pass in the logger instance. This allows this to defer all of the - // logger class setup until the last possible second, improving speed. - if (isset($this->app['log.setup'])) - { - call_user_func($this->app['log.setup'], $logger); - } - } - - /** - * Get the services provided by the provider. - * - * @return array - */ - public function provides() - { - return array('log', 'Psr\Log\LoggerInterface'); - } - -} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/laravel/framework/src/Illuminate/Log/Writer.php ---------------------------------------------------------------------- diff --git a/vendor/laravel/framework/src/Illuminate/Log/Writer.php b/vendor/laravel/framework/src/Illuminate/Log/Writer.php deleted file mode 100755 index 12b59f5..0000000 --- a/vendor/laravel/framework/src/Illuminate/Log/Writer.php +++ /dev/null @@ -1,311 +0,0 @@ -<?php namespace Illuminate\Log; - -use Closure; -use Illuminate\Events\Dispatcher; -use Monolog\Handler\StreamHandler; -use Monolog\Logger as MonologLogger; -use Monolog\Formatter\LineFormatter; -use Monolog\Handler\ErrorLogHandler; -use Monolog\Handler\RotatingFileHandler; -use Illuminate\Support\Contracts\JsonableInterface; -use Illuminate\Support\Contracts\ArrayableInterface; - -class Writer { - - /** - * The Monolog logger instance. - * - * @var \Monolog\Logger - */ - protected $monolog; - - /** - * All of the error levels. - * - * @var array - */ - protected $levels = array( - 'debug', - 'info', - 'notice', - 'warning', - 'error', - 'critical', - 'alert', - 'emergency', - ); - - /** - * The event dispatcher instance. - * - * @var \Illuminate\Events\Dispatcher - */ - protected $dispatcher; - - /** - * Create a new log writer instance. - * - * @param \Monolog\Logger $monolog - * @param \Illuminate\Events\Dispatcher $dispatcher - * @return void - */ - public function __construct(MonologLogger $monolog, Dispatcher $dispatcher = null) - { - $this->monolog = $monolog; - - if (isset($dispatcher)) - { - $this->dispatcher = $dispatcher; - } - } - - /** - * Call Monolog with the given method and parameters. - * - * @param string $method - * @param mixed $parameters - * @return mixed - */ - protected function callMonolog($method, $parameters) - { - if (is_array($parameters[0])) - { - $parameters[0] = json_encode($parameters[0]); - } - - return call_user_func_array(array($this->monolog, $method), $parameters); - } - - /** - * Register a file log handler. - * - * @param string $path - * @param string $level - * @return void - */ - public function useFiles($path, $level = 'debug') - { - $level = $this->parseLevel($level); - - $this->monolog->pushHandler($handler = new StreamHandler($path, $level)); - - $handler->setFormatter($this->getDefaultFormatter()); - } - - /** - * Register a daily file log handler. - * - * @param string $path - * @param int $days - * @param string $level - * @return void - */ - public function useDailyFiles($path, $days = 0, $level = 'debug') - { - $level = $this->parseLevel($level); - - $this->monolog->pushHandler($handler = new RotatingFileHandler($path, $days, $level)); - - $handler->setFormatter($this->getDefaultFormatter()); - } - - /** - * Register an error_log handler. - * - * @param string $level - * @param int $messageType - * @return void - */ - public function useErrorLog($level = 'debug', $messageType = ErrorLogHandler::OPERATING_SYSTEM) - { - $level = $this->parseLevel($level); - - $this->monolog->pushHandler($handler = new ErrorLogHandler($messageType, $level)); - - $handler->setFormatter($this->getDefaultFormatter()); - } - - /** - * Get a default Monolog formatter instance. - * - * @return \Monolog\Formatter\LineFormatter - */ - protected function getDefaultFormatter() - { - return new LineFormatter(null, null, true); - } - - /** - * Parse the string level into a Monolog constant. - * - * @param string $level - * @return int - * - * @throws \InvalidArgumentException - */ - protected function parseLevel($level) - { - switch ($level) - { - case 'debug': - return MonologLogger::DEBUG; - - case 'info': - return MonologLogger::INFO; - - case 'notice': - return MonologLogger::NOTICE; - - case 'warning': - return MonologLogger::WARNING; - - case 'error': - return MonologLogger::ERROR; - - case 'critical': - return MonologLogger::CRITICAL; - - case 'alert': - return MonologLogger::ALERT; - - case 'emergency': - return MonologLogger::EMERGENCY; - - default: - throw new \InvalidArgumentException("Invalid log level."); - } - } - - /** - * Register a new callback handler for when - * a log event is triggered. - * - * @param \Closure $callback - * @return void - * - * @throws \RuntimeException - */ - public function listen(Closure $callback) - { - if ( ! isset($this->dispatcher)) - { - throw new \RuntimeException("Events dispatcher has not been set."); - } - - $this->dispatcher->listen('illuminate.log', $callback); - } - - /** - * Get the underlying Monolog instance. - * - * @return \Monolog\Logger - */ - public function getMonolog() - { - return $this->monolog; - } - - /** - * Get the event dispatcher instance. - * - * @return \Illuminate\Events\Dispatcher - */ - public function getEventDispatcher() - { - return $this->dispatcher; - } - - /** - * Set the event dispatcher instance. - * - * @param \Illuminate\Events\Dispatcher - * @return void - */ - public function setEventDispatcher(Dispatcher $dispatcher) - { - $this->dispatcher = $dispatcher; - } - - /** - * Fires a log event. - * - * @param string $level - * @param string $message - * @param array $context - * @return void - */ - protected function fireLogEvent($level, $message, array $context = array()) - { - // If the event dispatcher is set, we will pass along the parameters to the - // log listeners. These are useful for building profilers or other tools - // that aggregate all of the log messages for a given "request" cycle. - if (isset($this->dispatcher)) - { - $this->dispatcher->fire('illuminate.log', compact('level', 'message', 'context')); - } - } - - /** - * Dynamically pass log calls into the writer. - * - * @param mixed (level, param, param) - * @return mixed - */ - public function write() - { - $level = head(func_get_args()); - - return call_user_func_array(array($this, $level), array_slice(func_get_args(), 1)); - } - - /** - * Dynamically handle error additions. - * - * @param string $method - * @param mixed $parameters - * @return mixed - * - * @throws \BadMethodCallException - */ - public function __call($method, $parameters) - { - if (in_array($method, $this->levels)) - { - $this->formatParameters($parameters); - - call_user_func_array(array($this, 'fireLogEvent'), array_merge(array($method), $parameters)); - - $method = 'add'.ucfirst($method); - - return $this->callMonolog($method, $parameters); - } - - throw new \BadMethodCallException("Method [$method] does not exist."); - } - - /** - * Format the parameters for the logger. - * - * @param mixed $parameters - * @return void - */ - protected function formatParameters(&$parameters) - { - if (isset($parameters[0])) - { - if (is_array($parameters[0])) - { - $parameters[0] = var_export($parameters[0], true); - } - elseif ($parameters[0] instanceof JsonableInterface) - { - $parameters[0] = $parameters[0]->toJson(); - } - elseif ($parameters[0] instanceof ArrayableInterface) - { - $parameters[0] = var_export($parameters[0]->toArray(), true); - } - } - } - -} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/laravel/framework/src/Illuminate/Log/composer.json ---------------------------------------------------------------------- diff --git a/vendor/laravel/framework/src/Illuminate/Log/composer.json b/vendor/laravel/framework/src/Illuminate/Log/composer.json deleted file mode 100755 index 155dc57..0000000 --- a/vendor/laravel/framework/src/Illuminate/Log/composer.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "illuminate/log", - "license": "MIT", - "authors": [ - { - "name": "Taylor Otwell", - "email": "[email protected]" - } - ], - "require": { - "php": ">=5.4.0", - "illuminate/support": "4.2.*", - "monolog/monolog": "~1.6" - }, - "require-dev": { - "illuminate/events": "4.2.*" - }, - "autoload": { - "psr-0": { - "Illuminate\\Log": "" - } - }, - "target-dir": "Illuminate/Log", - "extra": { - "branch-alias": { - "dev-master": "4.2-dev" - } - }, - "minimum-stability": "dev" -} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/laravel/framework/src/Illuminate/Mail/MailServiceProvider.php ---------------------------------------------------------------------- diff --git a/vendor/laravel/framework/src/Illuminate/Mail/MailServiceProvider.php b/vendor/laravel/framework/src/Illuminate/Mail/MailServiceProvider.php deleted file mode 100755 index e05818a..0000000 --- a/vendor/laravel/framework/src/Illuminate/Mail/MailServiceProvider.php +++ /dev/null @@ -1,261 +0,0 @@ -<?php namespace Illuminate\Mail; - -use Swift_Mailer; -use Illuminate\Support\ServiceProvider; -use Swift_SmtpTransport as SmtpTransport; -use Swift_MailTransport as MailTransport; -use Illuminate\Mail\Transport\LogTransport; -use Illuminate\Mail\Transport\MailgunTransport; -use Illuminate\Mail\Transport\MandrillTransport; -use Swift_SendmailTransport as SendmailTransport; - -class MailServiceProvider extends ServiceProvider { - - /** - * Indicates if loading of the provider is deferred. - * - * @var bool - */ - protected $defer = true; - - /** - * Register the service provider. - * - * @return void - */ - public function register() - { - $me = $this; - - $this->app->bindShared('mailer', function($app) use ($me) - { - $me->registerSwiftMailer(); - - // Once we have create the mailer instance, we will set a container instance - // on the mailer. This allows us to resolve mailer classes via containers - // for maximum testability on said classes instead of passing Closures. - $mailer = new Mailer( - $app['view'], $app['swift.mailer'], $app['events'] - ); - - $this->setMailerDependencies($mailer, $app); - - // If a "from" address is set, we will set it on the mailer so that all mail - // messages sent by the applications will utilize the same "from" address - // on each one, which makes the developer's life a lot more convenient. - $from = $app['config']['mail.from']; - - if (is_array($from) && isset($from['address'])) - { - $mailer->alwaysFrom($from['address'], $from['name']); - } - - // Here we will determine if the mailer should be in "pretend" mode for this - // environment, which will simply write out e-mail to the logs instead of - // sending it over the web, which is useful for local dev environments. - $pretend = $app['config']->get('mail.pretend', false); - - $mailer->pretend($pretend); - - return $mailer; - }); - } - - /** - * Set a few dependencies on the mailer instance. - * - * @param \Illuminate\Mail\Mailer $mailer - * @param \Illuminate\Foundation\Application $app - * @return void - */ - protected function setMailerDependencies($mailer, $app) - { - $mailer->setContainer($app); - - if ($app->bound('log')) - { - $mailer->setLogger($app['log']); - } - - if ($app->bound('queue')) - { - $mailer->setQueue($app['queue']); - } - } - - /** - * Register the Swift Mailer instance. - * - * @return void - */ - public function registerSwiftMailer() - { - $config = $this->app['config']['mail']; - - $this->registerSwiftTransport($config); - - // Once we have the transporter registered, we will register the actual Swift - // mailer instance, passing in the transport instances, which allows us to - // override this transporter instances during app start-up if necessary. - $this->app['swift.mailer'] = $this->app->share(function($app) - { - return new Swift_Mailer($app['swift.transport']); - }); - } - - /** - * Register the Swift Transport instance. - * - * @param array $config - * @return void - * - * @throws \InvalidArgumentException - */ - protected function registerSwiftTransport($config) - { - switch ($config['driver']) - { - case 'smtp': - return $this->registerSmtpTransport($config); - - case 'sendmail': - return $this->registerSendmailTransport($config); - - case 'mail': - return $this->registerMailTransport($config); - - case 'mailgun': - return $this->registerMailgunTransport($config); - - case 'mandrill': - return $this->registerMandrillTransport($config); - - case 'log': - return $this->registerLogTransport($config); - - default: - throw new \InvalidArgumentException('Invalid mail driver.'); - } - } - - /** - * Register the SMTP Swift Transport instance. - * - * @param array $config - * @return void - */ - protected function registerSmtpTransport($config) - { - $this->app['swift.transport'] = $this->app->share(function($app) use ($config) - { - extract($config); - - // The Swift SMTP transport instance will allow us to use any SMTP backend - // for delivering mail such as Sendgrid, Amazon SES, or a custom server - // a developer has available. We will just pass this configured host. - $transport = SmtpTransport::newInstance($host, $port); - - if (isset($encryption)) - { - $transport->setEncryption($encryption); - } - - // Once we have the transport we will check for the presence of a username - // and password. If we have it we will set the credentials on the Swift - // transporter instance so that we'll properly authenticate delivery. - if (isset($username)) - { - $transport->setUsername($username); - - $transport->setPassword($password); - } - - return $transport; - }); - } - - /** - * Register the Sendmail Swift Transport instance. - * - * @param array $config - * @return void - */ - protected function registerSendmailTransport($config) - { - $this->app['swift.transport'] = $this->app->share(function($app) use ($config) - { - return SendmailTransport::newInstance($config['sendmail']); - }); - } - - /** - * Register the Mail Swift Transport instance. - * - * @param array $config - * @return void - */ - protected function registerMailTransport($config) - { - $this->app['swift.transport'] = $this->app->share(function() - { - return MailTransport::newInstance(); - }); - } - - /** - * Register the Mailgun Swift Transport instance. - * - * @param array $config - * @return void - */ - protected function registerMailgunTransport($config) - { - $mailgun = $this->app['config']->get('services.mailgun', array()); - - $this->app->bindShared('swift.transport', function() use ($mailgun) - { - return new MailgunTransport($mailgun['secret'], $mailgun['domain']); - }); - } - - /** - * Register the Mandrill Swift Transport instance. - * - * @param array $config - * @return void - */ - protected function registerMandrillTransport($config) - { - $mandrill = $this->app['config']->get('services.mandrill', array()); - - $this->app->bindShared('swift.transport', function() use ($mandrill) - { - return new MandrillTransport($mandrill['secret']); - }); - } - - /** - * Register the "Log" Swift Transport instance. - * - * @param array $config - * @return void - */ - protected function registerLogTransport($config) - { - $this->app->bindShared('swift.transport', function($app) - { - return new LogTransport($app->make('Psr\Log\LoggerInterface')); - }); - } - - /** - * Get the services provided by the provider. - * - * @return array - */ - public function provides() - { - return array('mailer', 'swift.mailer', 'swift.transport'); - } - -} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/laravel/framework/src/Illuminate/Mail/Mailer.php ---------------------------------------------------------------------- diff --git a/vendor/laravel/framework/src/Illuminate/Mail/Mailer.php b/vendor/laravel/framework/src/Illuminate/Mail/Mailer.php deleted file mode 100755 index fb10040..0000000 --- a/vendor/laravel/framework/src/Illuminate/Mail/Mailer.php +++ /dev/null @@ -1,504 +0,0 @@ -<?php namespace Illuminate\Mail; - -use Closure; -use Swift_Mailer; -use Swift_Message; -use Illuminate\Log\Writer; -use Illuminate\View\Factory; -use Illuminate\Events\Dispatcher; -use Illuminate\Queue\QueueManager; -use Illuminate\Container\Container; -use Illuminate\Support\SerializableClosure; - -class Mailer { - - /** - * The view factory instance. - * - * @var \Illuminate\View\Factory - */ - protected $views; - - /** - * The Swift Mailer instance. - * - * @var \Swift_Mailer - */ - protected $swift; - - /** - * The event dispatcher instance. - * - * @var \Illuminate\Events\Dispatcher - */ - protected $events; - - /** - * The global from address and name. - * - * @var array - */ - protected $from; - - /** - * The log writer instance. - * - * @var \Illuminate\Log\Writer - */ - protected $logger; - - /** - * The IoC container instance. - * - * @var \Illuminate\Container\Container - */ - protected $container; - - /* - * The QueueManager instance. - * - * @var \Illuminate\Queue\QueueManager - */ - protected $queue; - - /** - * Indicates if the actual sending is disabled. - * - * @var bool - */ - protected $pretending = false; - - /** - * Array of failed recipients. - * - * @var array - */ - protected $failedRecipients = array(); - - /** - * Array of parsed views containing html and text view name. - * - * @var array - */ - protected $parsedViews = array(); - - /** - * Create a new Mailer instance. - * - * @param \Illuminate\View\Factory $views - * @param \Swift_Mailer $swift - * @param \Illuminate\Events\Dispatcher $events - * @return void - */ - public function __construct(Factory $views, Swift_Mailer $swift, Dispatcher $events = null) - { - $this->views = $views; - $this->swift = $swift; - $this->events = $events; - } - - /** - * Set the global from address and name. - * - * @param string $address - * @param string $name - * @return void - */ - public function alwaysFrom($address, $name = null) - { - $this->from = compact('address', 'name'); - } - - /** - * Send a new message when only a plain part. - * - * @param string $view - * @param array $data - * @param mixed $callback - * @return int - */ - public function plain($view, array $data, $callback) - { - return $this->send(array('text' => $view), $data, $callback); - } - - /** - * Send a new message using a view. - * - * @param string|array $view - * @param array $data - * @param \Closure|string $callback - * @return void - */ - public function send($view, array $data, $callback) - { - // First we need to parse the view, which could either be a string or an array - // containing both an HTML and plain text versions of the view which should - // be used when sending an e-mail. We will extract both of them out here. - list($view, $plain) = $this->parseView($view); - - $data['message'] = $message = $this->createMessage(); - - $this->callMessageBuilder($callback, $message); - - // Once we have retrieved the view content for the e-mail we will set the body - // of this message using the HTML type, which will provide a simple wrapper - // to creating view based emails that are able to receive arrays of data. - $this->addContent($message, $view, $plain, $data); - - $message = $message->getSwiftMessage(); - - $this->sendSwiftMessage($message); - } - - /** - * Queue a new e-mail message for sending. - * - * @param string|array $view - * @param array $data - * @param \Closure|string $callback - * @param string $queue - * @return mixed - */ - public function queue($view, array $data, $callback, $queue = null) - { - $callback = $this->buildQueueCallable($callback); - - return $this->queue->push('mailer@handleQueuedMessage', compact('view', 'data', 'callback'), $queue); - } - - /** - * Queue a new e-mail message for sending on the given queue. - * - * @param string $queue - * @param string|array $view - * @param array $data - * @param \Closure|string $callback - * @return mixed - */ - public function queueOn($queue, $view, array $data, $callback) - { - return $this->queue($view, $data, $callback, $queue); - } - - /** - * Queue a new e-mail message for sending after (n) seconds. - * - * @param int $delay - * @param string|array $view - * @param array $data - * @param \Closure|string $callback - * @param string $queue - * @return mixed - */ - public function later($delay, $view, array $data, $callback, $queue = null) - { - $callback = $this->buildQueueCallable($callback); - - return $this->queue->later($delay, 'mailer@handleQueuedMessage', compact('view', 'data', 'callback'), $queue); - } - - /** - * Queue a new e-mail message for sending after (n) seconds on the given queue. - * - * @param string $queue - * @param int $delay - * @param string|array $view - * @param array $data - * @param \Closure|string $callback - * @return mixed - */ - public function laterOn($queue, $delay, $view, array $data, $callback) - { - return $this->later($delay, $view, $data, $callback, $queue); - } - - /** - * Build the callable for a queued e-mail job. - * - * @param mixed $callback - * @return mixed - */ - protected function buildQueueCallable($callback) - { - if ( ! $callback instanceof Closure) return $callback; - - return serialize(new SerializableClosure($callback)); - } - - /** - * Handle a queued e-mail message job. - * - * @param \Illuminate\Queue\Jobs\Job $job - * @param array $data - * @return void - */ - public function handleQueuedMessage($job, $data) - { - $this->send($data['view'], $data['data'], $this->getQueuedCallable($data)); - - $job->delete(); - } - - /** - * Get the true callable for a queued e-mail message. - * - * @param array $data - * @return mixed - */ - protected function getQueuedCallable(array $data) - { - if (str_contains($data['callback'], 'SerializableClosure')) - { - return with(unserialize($data['callback']))->getClosure(); - } - - return $data['callback']; - } - - /** - * Add the content to a given message. - * - * @param \Illuminate\Mail\Message $message - * @param string $view - * @param string $plain - * @param array $data - * @return void - */ - protected function addContent($message, $view, $plain, $data) - { - if (isset($view)) - { - $message->setBody($this->getView($view, $data), 'text/html'); - } - - if (isset($plain)) - { - $message->addPart($this->getView($plain, $data), 'text/plain'); - } - } - - /** - * Parse the given view name or array. - * - * @param string|array $view - * @return array - * - * @throws \InvalidArgumentException - */ - protected function parseView($view) - { - if (is_string($view)) return array($view, null); - - // If the given view is an array with numeric keys, we will just assume that - // both a "pretty" and "plain" view were provided, so we will return this - // array as is, since must should contain both views with numeric keys. - if (is_array($view) && isset($view[0])) - { - return $view; - } - - // If the view is an array, but doesn't contain numeric keys, we will assume - // the the views are being explicitly specified and will extract them via - // named keys instead, allowing the developers to use one or the other. - elseif (is_array($view)) - { - return array( - array_get($view, 'html'), array_get($view, 'text') - ); - } - - throw new \InvalidArgumentException("Invalid view."); - } - - /** - * Send a Swift Message instance. - * - * @param \Swift_Message $message - * @return void - */ - protected function sendSwiftMessage($message) - { - if ($this->events) - { - $this->events->fire('mailer.sending', array($message)); - } - - if ( ! $this->pretending) - { - $this->swift->send($message, $this->failedRecipients); - } - elseif (isset($this->logger)) - { - $this->logMessage($message); - } - } - - /** - * Log that a message was sent. - * - * @param \Swift_Message $message - * @return void - */ - protected function logMessage($message) - { - $emails = implode(', ', array_keys((array) $message->getTo())); - - $this->logger->info("Pretending to mail message to: {$emails}"); - } - - /** - * Call the provided message builder. - * - * @param \Closure|string $callback - * @param \Illuminate\Mail\Message $message - * @return mixed - * - * @throws \InvalidArgumentException - */ - protected function callMessageBuilder($callback, $message) - { - if ($callback instanceof Closure) - { - return call_user_func($callback, $message); - } - elseif (is_string($callback)) - { - return $this->container[$callback]->mail($message); - } - - throw new \InvalidArgumentException("Callback is not valid."); - } - - /** - * Create a new message instance. - * - * @return \Illuminate\Mail\Message - */ - protected function createMessage() - { - $message = new Message(new Swift_Message); - - // If a global from address has been specified we will set it on every message - // instances so the developer does not have to repeat themselves every time - // they create a new message. We will just go ahead and push the address. - if (isset($this->from['address'])) - { - $message->from($this->from['address'], $this->from['name']); - } - - return $message; - } - - /** - * Render the given view. - * - * @param string $view - * @param array $data - * @return \Illuminate\View\View - */ - protected function getView($view, $data) - { - return $this->views->make($view, $data)->render(); - } - - /** - * Tell the mailer to not really send messages. - * - * @param bool $value - * @return void - */ - public function pretend($value = true) - { - $this->pretending = $value; - } - - /** - * Check if the mailer is pretending to send messages. - * - * @return bool - */ - public function isPretending() - { - return $this->pretending; - } - - /** - * Get the view factory instance. - * - * @return \Illuminate\View\Factory - */ - public function getViewFactory() - { - return $this->views; - } - - /** - * Get the Swift Mailer instance. - * - * @return \Swift_Mailer - */ - public function getSwiftMailer() - { - return $this->swift; - } - - /** - * Get the array of failed recipients. - * - * @return array - */ - public function failures() - { - return $this->failedRecipients; - } - - /** - * Set the Swift Mailer instance. - * - * @param \Swift_Mailer $swift - * @return void - */ - public function setSwiftMailer($swift) - { - $this->swift = $swift; - } - - /** - * Set the log writer instance. - * - * @param \Illuminate\Log\Writer $logger - * @return $this - */ - public function setLogger(Writer $logger) - { - $this->logger = $logger; - - return $this; - } - - /** - * Set the queue manager instance. - * - * @param \Illuminate\Queue\QueueManager $queue - * @return $this - */ - public function setQueue(QueueManager $queue) - { - $this->queue = $queue; - - return $this; - } - - /** - * Set the IoC container instance. - * - * @param \Illuminate\Container\Container $container - * @return void - */ - public function setContainer(Container $container) - { - $this->container = $container; - } - -} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/laravel/framework/src/Illuminate/Mail/Message.php ---------------------------------------------------------------------- diff --git a/vendor/laravel/framework/src/Illuminate/Mail/Message.php b/vendor/laravel/framework/src/Illuminate/Mail/Message.php deleted file mode 100755 index 4085571..0000000 --- a/vendor/laravel/framework/src/Illuminate/Mail/Message.php +++ /dev/null @@ -1,295 +0,0 @@ -<?php namespace Illuminate\Mail; - -use Swift_Image; -use Swift_Attachment; - -class Message { - - /** - * The Swift Message instance. - * - * @var \Swift_Message - */ - protected $swift; - - /** - * Create a new message instance. - * - * @param \Swift_Message $swift - * @return void - */ - public function __construct($swift) - { - $this->swift = $swift; - } - - /** - * Add a "from" address to the message. - * - * @param string $address - * @param string $name - * @return $this - */ - public function from($address, $name = null) - { - $this->swift->setFrom($address, $name); - - return $this; - } - - /** - * Set the "sender" of the message. - * - * @param string $address - * @param string $name - * @return $this - */ - public function sender($address, $name = null) - { - $this->swift->setSender($address, $name); - - return $this; - } - - /** - * Set the "return path" of the message. - * - * @param string $address - * @return $this - */ - public function returnPath($address) - { - $this->swift->setReturnPath($address); - - return $this; - } - - /** - * Add a recipient to the message. - * - * @param string|array $address - * @param string $name - * @return $this - */ - public function to($address, $name = null) - { - return $this->addAddresses($address, $name, 'To'); - } - - /** - * Add a carbon copy to the message. - * - * @param string $address - * @param string $name - * @return $this - */ - public function cc($address, $name = null) - { - return $this->addAddresses($address, $name, 'Cc'); - } - - /** - * Add a blind carbon copy to the message. - * - * @param string $address - * @param string $name - * @return $this - */ - public function bcc($address, $name = null) - { - return $this->addAddresses($address, $name, 'Bcc'); - } - - /** - * Add a reply to address to the message. - * - * @param string $address - * @param string $name - * @return $this - */ - public function replyTo($address, $name = null) - { - return $this->addAddresses($address, $name, 'ReplyTo'); - } - - /** - * Add a recipient to the message. - * - * @param string|array $address - * @param string $name - * @param string $type - * @return $this - */ - protected function addAddresses($address, $name, $type) - { - if (is_array($address)) - { - $this->swift->{"set{$type}"}($address, $name); - } - else - { - $this->swift->{"add{$type}"}($address, $name); - } - - return $this; - } - - /** - * Set the subject of the message. - * - * @param string $subject - * @return $this - */ - public function subject($subject) - { - $this->swift->setSubject($subject); - - return $this; - } - - /** - * Set the message priority level. - * - * @param int $level - * @return $this - */ - public function priority($level) - { - $this->swift->setPriority($level); - - return $this; - } - - /** - * Attach a file to the message. - * - * @param string $file - * @param array $options - * @return $this - */ - public function attach($file, array $options = array()) - { - $attachment = $this->createAttachmentFromPath($file); - - return $this->prepAttachment($attachment, $options); - } - - /** - * Create a Swift Attachment instance. - * - * @param string $file - * @return \Swift_Attachment - */ - protected function createAttachmentFromPath($file) - { - return Swift_Attachment::fromPath($file); - } - - /** - * Attach in-memory data as an attachment. - * - * @param string $data - * @param string $name - * @param array $options - * @return $this - */ - public function attachData($data, $name, array $options = array()) - { - $attachment = $this->createAttachmentFromData($data, $name); - - return $this->prepAttachment($attachment, $options); - } - - /** - * Create a Swift Attachment instance from data. - * - * @param string $data - * @param string $name - * @return \Swift_Attachment - */ - protected function createAttachmentFromData($data, $name) - { - return Swift_Attachment::newInstance($data, $name); - } - - /** - * Embed a file in the message and get the CID. - * - * @param string $file - * @return string - */ - public function embed($file) - { - return $this->swift->embed(Swift_Image::fromPath($file)); - } - - /** - * Embed in-memory data in the message and get the CID. - * - * @param string $data - * @param string $name - * @param string $contentType - * @return string - */ - public function embedData($data, $name, $contentType = null) - { - $image = Swift_Image::newInstance($data, $name, $contentType); - - return $this->swift->embed($image); - } - - /** - * Prepare and attach the given attachment. - * - * @param \Swift_Attachment $attachment - * @param array $options - * @return $this - */ - protected function prepAttachment($attachment, $options = array()) - { - // First we will check for a MIME type on the message, which instructs the - // mail client on what type of attachment the file is so that it may be - // downloaded correctly by the user. The MIME option is not required. - if (isset($options['mime'])) - { - $attachment->setContentType($options['mime']); - } - - // If an alternative name was given as an option, we will set that on this - // attachment so that it will be downloaded with the desired names from - // the developer, otherwise the default file names will get assigned. - if (isset($options['as'])) - { - $attachment->setFilename($options['as']); - } - - $this->swift->attach($attachment); - - return $this; - } - - /** - * Get the underlying Swift Message instance. - * - * @return \Swift_Message - */ - public function getSwiftMessage() - { - return $this->swift; - } - - /** - * Dynamically pass missing methods to the Swift instance. - * - * @param string $method - * @param array $parameters - * @return mixed - */ - public function __call($method, $parameters) - { - $callable = array($this->swift, $method); - - return call_user_func_array($callable, $parameters); - } - -} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/laravel/framework/src/Illuminate/Mail/Transport/LogTransport.php ---------------------------------------------------------------------- diff --git a/vendor/laravel/framework/src/Illuminate/Mail/Transport/LogTransport.php b/vendor/laravel/framework/src/Illuminate/Mail/Transport/LogTransport.php deleted file mode 100644 index 1fe8136..0000000 --- a/vendor/laravel/framework/src/Illuminate/Mail/Transport/LogTransport.php +++ /dev/null @@ -1,87 +0,0 @@ -<?php namespace Illuminate\Mail\Transport; - -use Swift_Transport; -use Swift_Mime_Message; -use Swift_Mime_MimeEntity; -use Psr\Log\LoggerInterface; -use Swift_Events_EventListener; - -class LogTransport implements Swift_Transport { - - /** - * The Logger instance. - * - * @var \Psr\Log\LoggerInterface - */ - protected $logger; - - /** - * Create a new log transport instance. - * - * @param \Psr\Log\LoggerInterface $logger - * @return void - */ - public function __construct(LoggerInterface $logger) - { - $this->logger = $logger; - } - - /** - * {@inheritdoc} - */ - public function isStarted() - { - return true; - } - - /** - * {@inheritdoc} - */ - public function start() - { - return true; - } - - /** - * {@inheritdoc} - */ - public function stop() - { - return true; - } - - /** - * {@inheritdoc} - */ - public function send(Swift_Mime_Message $message, &$failedRecipients = null) - { - $this->logger->debug($this->getMimeEntityString($message)); - } - - /** - * Get a loggable string out of a Swiftmailer entity. - * - * @param \Swift_Mime_MimeEntity $entity - * @return string - */ - protected function getMimeEntityString(Swift_Mime_MimeEntity $entity) - { - $string = (string) $entity->getHeaders().PHP_EOL.$entity->getBody(); - - foreach ($entity->getChildren() as $children) - { - $string .= PHP_EOL.PHP_EOL.$this->getMimeEntityString($children); - } - - return $string; - } - - /** - * {@inheritdoc} - */ - public function registerPlugin(Swift_Events_EventListener $plugin) - { - // - } - -} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/laravel/framework/src/Illuminate/Mail/Transport/MailgunTransport.php ---------------------------------------------------------------------- diff --git a/vendor/laravel/framework/src/Illuminate/Mail/Transport/MailgunTransport.php b/vendor/laravel/framework/src/Illuminate/Mail/Transport/MailgunTransport.php deleted file mode 100644 index 3b19f88..0000000 --- a/vendor/laravel/framework/src/Illuminate/Mail/Transport/MailgunTransport.php +++ /dev/null @@ -1,168 +0,0 @@ -<?php namespace Illuminate\Mail\Transport; - -use Swift_Transport; -use GuzzleHttp\Client; -use Swift_Mime_Message; -use GuzzleHttp\Post\PostFile; -use Swift_Events_EventListener; - -class MailgunTransport implements Swift_Transport { - - /** - * The Mailgun API key. - * - * @var string - */ - protected $key; - - /** - * The Mailgun domain. - * - * @var string - */ - protected $domain; - - /** - * THe Mailgun API end-point. - * - * @var string - */ - protected $url; - - /** - * Create a new Mailgun transport instance. - * - * @param string $key - * @param string $domain - * @return void - */ - public function __construct($key, $domain) - { - $this->key = $key; - $this->setDomain($domain); - } - - /** - * {@inheritdoc} - */ - public function isStarted() - { - return true; - } - - /** - * {@inheritdoc} - */ - public function start() - { - return true; - } - - /** - * {@inheritdoc} - */ - public function stop() - { - return true; - } - - /** - * {@inheritdoc} - */ - public function send(Swift_Mime_Message $message, &$failedRecipients = null) - { - $client = $this->getHttpClient(); - - $client->post($this->url, ['auth' => ['api', $this->key], - 'body' => [ - 'to' => $this->getTo($message), - 'message' => new PostFile('message', (string) $message), - ], - ]); - } - - /** - * {@inheritdoc} - */ - public function registerPlugin(Swift_Events_EventListener $plugin) - { - // - } - - /** - * Get the "to" payload field for the API request. - * - * @param \Swift_Mime_Message $message - * @return array - */ - protected function getTo(Swift_Mime_Message $message) - { - $formatted = []; - - $contacts = array_merge( - (array) $message->getTo(), (array) $message->getCc(), (array) $message->getBcc() - ); - - foreach ($contacts as $address => $display) - { - $formatted[] = $display ? $display." <$address>" : $address; - } - - return implode(',', $formatted); - } - - /** - * Get a new HTTP client instance. - * - * @return \GuzzleHttp\Client - */ - protected function getHttpClient() - { - return new Client; - } - - /** - * Get the API key being used by the transport. - * - * @return string - */ - public function getKey() - { - return $this->key; - } - - /** - * Set the API key being used by the transport. - * - * @param string $key - * @return void - */ - public function setKey($key) - { - return $this->key = $key; - } - - /** - * Get the domain being used by the transport. - * - * @return string - */ - public function getDomain() - { - return $this->domain; - } - - /** - * Set the domain being used by the transport. - * - * @param string $domain - * @return void - */ - public function setDomain($domain) - { - $this->url = 'https://api.mailgun.net/v2/'.$domain.'/messages.mime'; - - return $this->domain = $domain; - } - -} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/laravel/framework/src/Illuminate/Mail/Transport/MandrillTransport.php ---------------------------------------------------------------------- diff --git a/vendor/laravel/framework/src/Illuminate/Mail/Transport/MandrillTransport.php b/vendor/laravel/framework/src/Illuminate/Mail/Transport/MandrillTransport.php deleted file mode 100644 index daa823b..0000000 --- a/vendor/laravel/framework/src/Illuminate/Mail/Transport/MandrillTransport.php +++ /dev/null @@ -1,107 +0,0 @@ -<?php namespace Illuminate\Mail\Transport; - -use Swift_Transport; -use GuzzleHttp\Client; -use Swift_Mime_Message; -use Swift_Events_EventListener; - -class MandrillTransport implements Swift_Transport { - - /** - * The Mandrill API key. - * - * @var string - */ - protected $key; - - /** - * Create a new Mandrill transport instance. - * - * @param string $key - * @return void - */ - public function __construct($key) - { - $this->key = $key; - } - - /** - * {@inheritdoc} - */ - public function isStarted() - { - return true; - } - - /** - * {@inheritdoc} - */ - public function start() - { - return true; - } - - /** - * {@inheritdoc} - */ - public function stop() - { - return true; - } - - /** - * {@inheritdoc} - */ - public function send(Swift_Mime_Message $message, &$failedRecipients = null) - { - $client = $this->getHttpClient(); - - $client->post('https://mandrillapp.com/api/1.0/messages/send-raw.json', [ - 'body' => [ - 'key' => $this->key, - 'raw_message' => (string) $message, - 'async' => false, - ], - ]); - } - - /** - * {@inheritdoc} - */ - public function registerPlugin(Swift_Events_EventListener $plugin) - { - // - } - - /** - * Get a new HTTP client instance. - * - * @return \GuzzleHttp\Client - */ - protected function getHttpClient() - { - return new Client; - } - - /** - * Get the API key being used by the transport. - * - * @return string - */ - public function getKey() - { - return $this->key; - } - - /** - * Set the API key being used by the transport. - * - * @param string $key - * @return void - */ - public function setKey($key) - { - return $this->key = $key; - } - -} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/laravel/framework/src/Illuminate/Mail/composer.json ---------------------------------------------------------------------- diff --git a/vendor/laravel/framework/src/Illuminate/Mail/composer.json b/vendor/laravel/framework/src/Illuminate/Mail/composer.json deleted file mode 100755 index 0fe7384..0000000 --- a/vendor/laravel/framework/src/Illuminate/Mail/composer.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "name": "illuminate/mail", - "license": "MIT", - "authors": [ - { - "name": "Taylor Otwell", - "email": "[email protected]" - } - ], - "require": { - "php": ">=5.4.0", - "illuminate/container": "4.2.*", - "illuminate/log": "4.2.*", - "illuminate/support": "4.2.*", - "illuminate/view": "4.2.*", - "swiftmailer/swiftmailer": "~5.1" - }, - "require-dev": { - "illuminate/queue": "4.2.*" - }, - "autoload": { - "psr-0": { - "Illuminate\\Mail": "" - } - }, - "target-dir": "Illuminate/Mail", - "extra": { - "branch-alias": { - "dev-master": "4.2-dev" - } - }, - "minimum-stability": "dev" -} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/laravel/framework/src/Illuminate/Pagination/BootstrapPresenter.php ---------------------------------------------------------------------- diff --git a/vendor/laravel/framework/src/Illuminate/Pagination/BootstrapPresenter.php b/vendor/laravel/framework/src/Illuminate/Pagination/BootstrapPresenter.php deleted file mode 100644 index dc9c7c2..0000000 --- a/vendor/laravel/framework/src/Illuminate/Pagination/BootstrapPresenter.php +++ /dev/null @@ -1,42 +0,0 @@ -<?php namespace Illuminate\Pagination; - -class BootstrapPresenter extends Presenter { - - /** - * Get HTML wrapper for a page link. - * - * @param string $url - * @param int $page - * @param string $rel - * @return string - */ - public function getPageLinkWrapper($url, $page, $rel = null) - { - $rel = is_null($rel) ? '' : ' rel="'.$rel.'"'; - - return '<li><a href="'.$url.'"'.$rel.'>'.$page.'</a></li>'; - } - - /** - * Get HTML wrapper for disabled text. - * - * @param string $text - * @return string - */ - public function getDisabledTextWrapper($text) - { - return '<li class="disabled"><span>'.$text.'</span></li>'; - } - - /** - * Get HTML wrapper for active text. - * - * @param string $text - * @return string - */ - public function getActivePageWrapper($text) - { - return '<li class="active"><span>'.$text.'</span></li>'; - } - -} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/laravel/framework/src/Illuminate/Pagination/Factory.php ---------------------------------------------------------------------- diff --git a/vendor/laravel/framework/src/Illuminate/Pagination/Factory.php b/vendor/laravel/framework/src/Illuminate/Pagination/Factory.php deleted file mode 100755 index 4026495..0000000 --- a/vendor/laravel/framework/src/Illuminate/Pagination/Factory.php +++ /dev/null @@ -1,289 +0,0 @@ -<?php namespace Illuminate\Pagination; - -use Illuminate\Http\Request; -use Illuminate\View\Factory as ViewFactory; -use Symfony\Component\Translation\TranslatorInterface; - -class Factory { - - /** - * The request instance. - * - * @var \Symfony\Component\HttpFoundation\Request - */ - protected $request; - - /** - * The view factory instance. - * - * @var \Illuminate\View\Factory - */ - protected $view; - - /** - * The translator implementation. - * - * @var \Symfony\Component\Translation\TranslatorInterface - */ - protected $trans; - - /** - * The name of the pagination view. - * - * @var string - */ - protected $viewName; - - /** - * The number of the current page. - * - * @var int - */ - protected $currentPage; - - /** - * The locale to be used by the translator. - * - * @var string - */ - protected $locale; - - /** - * The base URL in use by the paginator. - * - * @var string - */ - protected $baseUrl; - - /** - * The input parameter used for the current page. - * - * @var string - */ - protected $pageName; - - /** - * Create a new pagination factory. - * - * @param \Symfony\Component\HttpFoundation\Request $request - * @param \Illuminate\View\Factory $view - * @param \Symfony\Component\Translation\TranslatorInterface $trans - * @param string $pageName - * @return void - */ - public function __construct(Request $request, ViewFactory $view, TranslatorInterface $trans, $pageName = 'page') - { - $this->view = $view; - $this->trans = $trans; - $this->request = $request; - $this->pageName = $pageName; - $this->setupPaginationEnvironment(); - } - - /** - * Setup the pagination environment. - * - * @return void - */ - protected function setupPaginationEnvironment() - { - $this->view->addNamespace('pagination', __DIR__.'/views'); - } - - /** - * Get a new paginator instance. - * - * @param array $items - * @param int $total - * @param int|null $perPage - * @return \Illuminate\Pagination\Paginator - */ - public function make(array $items, $total, $perPage = null) - { - $paginator = new Paginator($this, $items, $total, $perPage); - - return $paginator->setupPaginationContext(); - } - - /** - * Get the pagination view. - * - * @param \Illuminate\Pagination\Paginator $paginator - * @param string $view - * @return \Illuminate\View\View - */ - public function getPaginationView(Paginator $paginator, $view = null) - { - $data = array('environment' => $this, 'paginator' => $paginator); - - return $this->view->make($this->getViewName($view), $data); - } - - /** - * Get the number of the current page. - * - * @return int - */ - public function getCurrentPage() - { - $page = (int) $this->currentPage ?: $this->request->input($this->pageName, 1); - - if ($page < 1 || filter_var($page, FILTER_VALIDATE_INT) === false) - { - return 1; - } - - return $page; - } - - /** - * Set the number of the current page. - * - * @param int $number - * @return void - */ - public function setCurrentPage($number) - { - $this->currentPage = $number; - } - - /** - * Get the root URL for the request. - * - * @return string - */ - public function getCurrentUrl() - { - return $this->baseUrl ?: $this->request->url(); - } - - /** - * Set the base URL in use by the paginator. - * - * @param string $baseUrl - * @return void - */ - public function setBaseUrl($baseUrl) - { - $this->baseUrl = $baseUrl; - } - - /** - * Set the input page parameter name used by the paginator. - * - * @param string $pageName - * @return void - */ - public function setPageName($pageName) - { - $this->pageName = $pageName; - } - - /** - * Get the input page parameter name used by the paginator. - * - * @return string - */ - public function getPageName() - { - return $this->pageName; - } - - /** - * Get the name of the pagination view. - * - * @param string $view - * @return string - */ - public function getViewName($view = null) - { - if ( ! is_null($view)) return $view; - - return $this->viewName ?: 'pagination::slider'; - } - - /** - * Set the name of the pagination view. - * - * @param string $viewName - * @return void - */ - public function setViewName($viewName) - { - $this->viewName = $viewName; - } - - /** - * Get the locale of the paginator. - * - * @return string - */ - public function getLocale() - { - return $this->locale; - } - - /** - * Set the locale of the paginator. - * - * @param string $locale - * @return void - */ - public function setLocale($locale) - { - $this->locale = $locale; - } - - /** - * Get the active request instance. - * - * @return \Symfony\Component\HttpFoundation\Request - */ - public function getRequest() - { - return $this->request; - } - - /** - * Set the active request instance. - * - * @param \Symfony\Component\HttpFoundation\Request $request - * @return void - */ - public function setRequest(Request $request) - { - $this->request = $request; - } - - /** - * Get the current view factory. - * - * @return \Illuminate\View\Factory - */ - public function getViewFactory() - { - return $this->view; - } - - /** - * Set the current view factory. - * - * @param \Illuminate\View\Factory $view - * @return void - */ - public function setViewFactory(ViewFactory $view) - { - $this->view = $view; - } - - /** - * Get the translator instance. - * - * @return \Symfony\Component\Translation\TranslatorInterface - */ - public function getTranslator() - { - return $this->trans; - } - -} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/laravel/framework/src/Illuminate/Pagination/PaginationServiceProvider.php ---------------------------------------------------------------------- diff --git a/vendor/laravel/framework/src/Illuminate/Pagination/PaginationServiceProvider.php b/vendor/laravel/framework/src/Illuminate/Pagination/PaginationServiceProvider.php deleted file mode 100755 index dfec6df..0000000 --- a/vendor/laravel/framework/src/Illuminate/Pagination/PaginationServiceProvider.php +++ /dev/null @@ -1,43 +0,0 @@ -<?php namespace Illuminate\Pagination; - -use Illuminate\Support\ServiceProvider; - -class PaginationServiceProvider extends ServiceProvider { - - /** - * Indicates if loading of the provider is deferred. - * - * @var bool - */ - protected $defer = true; - - /** - * Register the service provider. - * - * @return void - */ - public function register() - { - $this->app->bindShared('paginator', function($app) - { - $paginator = new Factory($app['request'], $app['view'], $app['translator']); - - $paginator->setViewName($app['config']['view.pagination']); - - $app->refresh('request', $paginator, 'setRequest'); - - return $paginator; - }); - } - - /** - * Get the services provided by the provider. - * - * @return array - */ - public function provides() - { - return array('paginator'); - } - -} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/laravel/framework/src/Illuminate/Pagination/Paginator.php ---------------------------------------------------------------------- diff --git a/vendor/laravel/framework/src/Illuminate/Pagination/Paginator.php b/vendor/laravel/framework/src/Illuminate/Pagination/Paginator.php deleted file mode 100755 index 7c1f8b7..0000000 --- a/vendor/laravel/framework/src/Illuminate/Pagination/Paginator.php +++ /dev/null @@ -1,544 +0,0 @@ -<?php namespace Illuminate\Pagination; - -use Countable; -use ArrayAccess; -use ArrayIterator; -use IteratorAggregate; -use Illuminate\Support\Collection; -use Illuminate\Support\Contracts\JsonableInterface; -use Illuminate\Support\Contracts\ArrayableInterface; - -class Paginator implements ArrayableInterface, ArrayAccess, Countable, IteratorAggregate, JsonableInterface { - - /** - * The pagination factory. - * - * @var \Illuminate\Pagination\Factory - */ - protected $factory; - - /** - * The items being paginated. - * - * @var array - */ - protected $items; - - /** - * The total number of items. - * - * @var int - */ - protected $total; - - /** - * Indicates if a pagination doing "quick" pagination has more items. - * - * @var bool - */ - protected $hasMore; - - /** - * The amount of items to show per page. - * - * @var int - */ - protected $perPage; - - /** - * Get the current page for the request. - * - * @var int - */ - protected $currentPage; - - /** - * Get the last available page number. - * - * @return int - */ - protected $lastPage; - - /** - * The number of the first item in this range. - * - * @var int - */ - protected $from; - - /** - * The number of the last item in this range. - * - * @var int - */ - protected $to; - - /** - * All of the additional query string values. - * - * @var array - */ - protected $query = array(); - - /** - * The fragment to be appended to all URLs. - * - * @var string - */ - protected $fragment; - - /** - * Create a new Paginator instance. - * - * @param \Illuminate\Pagination\Factory $factory - * @param array $items - * @param int $total - * @param int|null $perPage - * @return void - */ - public function __construct(Factory $factory, array $items, $total, $perPage = null) - { - $this->factory = $factory; - - if (is_null($perPage)) - { - $this->perPage = (int) $total; - $this->hasMore = count($items) > $this->perPage; - $this->items = array_slice($items, 0, $this->perPage); - } - else - { - $this->items = $items; - $this->total = (int) $total; - $this->perPage = (int) $perPage; - } - } - - /** - * Setup the pagination context (current and last page). - * - * @return $this - */ - public function setupPaginationContext() - { - $this->calculateCurrentAndLastPages(); - - $this->calculateItemRanges(); - - return $this; - } - - /** - * Calculate the current and last pages for this instance. - * - * @return void - */ - protected function calculateCurrentAndLastPages() - { - if ($this->isQuickPaginating()) - { - $this->currentPage = $this->factory->getCurrentPage(); - - $this->lastPage = $this->hasMore ? $this->currentPage + 1 : $this->currentPage; - } - else - { - $this->lastPage = max((int) ceil($this->total / $this->perPage), 1); - - $this->currentPage = $this->calculateCurrentPage($this->lastPage); - } - } - - /** - * Calculate the first and last item number for this instance. - * - * @return void - */ - protected function calculateItemRanges() - { - $this->from = $this->total ? ($this->currentPage - 1) * $this->perPage + 1 : 0; - - $this->to = min($this->total, $this->currentPage * $this->perPage); - } - - /** - * Get the current page for the request. - * - * @param int $lastPage - * @return int - */ - protected function calculateCurrentPage($lastPage) - { - $page = $this->factory->getCurrentPage(); - - // The page number will get validated and adjusted if it either less than one - // or greater than the last page available based on the count of the given - // items array. If it's greater than the last, we'll give back the last. - if (is_numeric($page) && $page > $lastPage) - { - return $lastPage > 0 ? $lastPage : 1; - } - - return $this->isValidPageNumber($page) ? (int) $page : 1; - } - - /** - * Determine if the given value is a valid page number. - * - * @param int $page - * @return bool - */ - protected function isValidPageNumber($page) - { - return $page >= 1 && filter_var($page, FILTER_VALIDATE_INT) !== false; - } - - /** - * Get the pagination links view. - * - * @param string $view - * @return \Illuminate\View\View - */ - public function links($view = null) - { - return $this->factory->getPaginationView($this, $view); - } - - /** - * Get a URL for a given page number. - * - * @param int $page - * @return string - */ - public function getUrl($page) - { - $parameters = array( - $this->factory->getPageName() => $page, - ); - - // If we have any extra query string key / value pairs that need to be added - // onto the URL, we will put them in query string form and then attach it - // to the URL. This allows for extra information like sortings storage. - if (count($this->query) > 0) - { - $parameters = array_merge($this->query, $parameters); - } - - $fragment = $this->buildFragment(); - - return $this->factory->getCurrentUrl().'?'.http_build_query($parameters, null, '&').$fragment; - } - - /** - * Get / set the URL fragment to be appended to URLs. - * - * @param string|null $fragment - * @return $this|string - */ - public function fragment($fragment = null) - { - if (is_null($fragment)) return $this->fragment; - - $this->fragment = $fragment; - - return $this; - } - - /** - * Build the full fragment portion of a URL. - * - * @return string - */ - protected function buildFragment() - { - return $this->fragment ? '#'.$this->fragment : ''; - } - - /** - * Add a query string value to the paginator. - * - * @param string $key - * @param string $value - * @return $this - */ - public function appends($key, $value = null) - { - if (is_array($key)) return $this->appendArray($key); - - return $this->addQuery($key, $value); - } - - /** - * Add an array of query string values. - * - * @param array $keys - * @return $this - */ - protected function appendArray(array $keys) - { - foreach ($keys as $key => $value) - { - $this->addQuery($key, $value); - } - - return $this; - } - - /** - * Add a query string value to the paginator. - * - * @param string $key - * @param string $value - * @return $this - */ - public function addQuery($key, $value) - { - if ($key !== $this->factory->getPageName()) - { - $this->query[$key] = $value; - } - - return $this; - } - - /** - * Determine if the paginator is doing "quick" pagination. - * - * @return bool - */ - public function isQuickPaginating() - { - return is_null($this->total); - } - - /** - * Get the current page for the request. - * - * @param int|null $total - * @return int - */ - public function getCurrentPage($total = null) - { - if (is_null($total)) - { - return $this->currentPage; - } - - return min($this->currentPage, (int) ceil($total / $this->perPage)); - } - - /** - * Get the last page that should be available. - * - * @return int - */ - public function getLastPage() - { - return $this->lastPage; - } - - /** - * Get the number of the first item on the paginator. - * - * @return int - */ - public function getFrom() - { - return $this->from; - } - - /** - * Get the number of the last item on the paginator. - * - * @return int - */ - public function getTo() - { - return $this->to; - } - - /** - * Get the number of items to be displayed per page. - * - * @return int - */ - public function getPerPage() - { - return $this->perPage; - } - - /** - * Get a collection instance containing the items. - * - * @return \Illuminate\Support\Collection - */ - public function getCollection() - { - return new Collection($this->items); - } - - /** - * Get the items being paginated. - * - * @return array - */ - public function getItems() - { - return $this->items; - } - - /** - * Set the items being paginated. - * - * @param mixed $items - * @return void - */ - public function setItems($items) - { - $this->items = $items; - } - - /** - * Get the total number of items in the collection. - * - * @return int - */ - public function getTotal() - { - return $this->total; - } - - /** - * Set the base URL in use by the paginator. - * - * @param string $baseUrl - * @return void - */ - public function setBaseUrl($baseUrl) - { - $this->factory->setBaseUrl($baseUrl); - } - - /** - * Get the pagination factory. - * - * @return \Illuminate\Pagination\Factory - */ - public function getFactory() - { - return $this->factory; - } - - /** - * Get an iterator for the items. - * - * @return \ArrayIterator - */ - public function getIterator() - { - return new ArrayIterator($this->items); - } - - /** - * Determine if the list of items is empty or not. - * - * @return bool - */ - public function isEmpty() - { - return empty($this->items); - } - - /** - * Get the number of items for the current page. - * - * @return int - */ - public function count() - { - return count($this->items); - } - - /** - * Determine if the given item exists. - * - * @param mixed $key - * @return bool - */ - public function offsetExists($key) - { - return array_key_exists($key, $this->items); - } - - /** - * Get the item at the given offset. - * - * @param mixed $key - * @return mixed - */ - public function offsetGet($key) - { - return $this->items[$key]; - } - - /** - * Set the item at the given offset. - * - * @param mixed $key - * @param mixed $value - * @return void - */ - public function offsetSet($key, $value) - { - $this->items[$key] = $value; - } - - /** - * Unset the item at the given key. - * - * @param mixed $key - * @return void - */ - public function offsetUnset($key) - { - unset($this->items[$key]); - } - - /** - * Get the instance as an array. - * - * @return array - */ - public function toArray() - { - return array( - 'total' => $this->total, 'per_page' => $this->perPage, - 'current_page' => $this->currentPage, 'last_page' => $this->lastPage, - 'from' => $this->from, 'to' => $this->to, 'data' => $this->getCollection()->toArray(), - ); - } - - /** - * Convert the object to its JSON representation. - * - * @param int $options - * @return string - */ - public function toJson($options = 0) - { - return json_encode($this->toArray(), $options); - } - - /** - * Call a method on the underlying Collection - * - * @param string $method - * @param array $arguments - * @return mixed - */ - public function __call($method, $arguments) - { - return call_user_func_array(array($this->getCollection(), $method), $arguments); - } - -} http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/80fd786e/vendor/laravel/framework/src/Illuminate/Pagination/Presenter.php ---------------------------------------------------------------------- diff --git a/vendor/laravel/framework/src/Illuminate/Pagination/Presenter.php b/vendor/laravel/framework/src/Illuminate/Pagination/Presenter.php deleted file mode 100755 index ea77be8..0000000 --- a/vendor/laravel/framework/src/Illuminate/Pagination/Presenter.php +++ /dev/null @@ -1,277 +0,0 @@ -<?php namespace Illuminate\Pagination; - -abstract class Presenter { - - /** - * The paginator instance being rendered. - * - * @var \Illuminate\Pagination\Paginator - */ - protected $paginator; - - /** - * The current page of the paginator. - * - * @var int - */ - protected $currentPage; - - /** - * The last available page of the paginator. - * - * @var int - */ - protected $lastPage; - - /** - * Create a new Presenter instance. - * - * @param \Illuminate\Pagination\Paginator $paginator - * @return void - */ - public function __construct(Paginator $paginator) - { - $this->paginator = $paginator; - $this->lastPage = $this->paginator->getLastPage(); - $this->currentPage = $this->paginator->getCurrentPage(); - } - - /** - * Get HTML wrapper for a page link. - * - * @param string $url - * @param int $page - * @param string $rel - * @return string - */ - abstract public function getPageLinkWrapper($url, $page, $rel = null); - - /** - * Get HTML wrapper for disabled text. - * - * @param string $text - * @return string - */ - abstract public function getDisabledTextWrapper($text); - - /** - * Get HTML wrapper for active text. - * - * @param string $text - * @return string - */ - abstract public function getActivePageWrapper($text); - - /** - * Render the Pagination contents. - * - * @return string - */ - public function render() - { - // The hard-coded thirteen represents the minimum number of pages we need to - // be able to create a sliding page window. If we have less than that, we - // will just render a simple range of page links insteadof the sliding. - if ($this->lastPage < 13) - { - $content = $this->getPageRange(1, $this->lastPage); - } - else - { - $content = $this->getPageSlider(); - } - - return $this->getPrevious().$content.$this->getNext(); - } - - /** - * Create a range of pagination links. - * - * @param int $start - * @param int $end - * @return string - */ - public function getPageRange($start, $end) - { - $pages = array(); - - for ($page = $start; $page <= $end; $page++) - { - // If the current page is equal to the page we're iterating on, we will create a - // disabled link for that page. Otherwise, we can create a typical active one - // for the link. We will use this implementing class's methods to get HTML. - if ($this->currentPage == $page) - { - $pages[] = $this->getActivePageWrapper($page); - } - else - { - $pages[] = $this->getLink($page); - } - } - - return implode('', $pages); - } - - /** - * Create a pagination slider link window. - * - * @return string - */ - protected function getPageSlider() - { - $window = 6; - - // If the current page is very close to the beginning of the page range, we will - // just render the beginning of the page range, followed by the last 2 of the - // links in this list, since we will not have room to create a full slider. - if ($this->currentPage <= $window) - { - $ending = $this->getFinish(); - - return $this->getPageRange(1, $window + 2).$ending; - } - - // If the current page is close to the ending of the page range we will just get - // this first couple pages, followed by a larger window of these ending pages - // since we're too close to the end of the list to create a full on slider. - elseif ($this->currentPage >= $this->lastPage - $window) - { - $start = $this->lastPage - 8; - - $content = $this->getPageRange($start, $this->lastPage); - - return $this->getStart().$content; - } - - // If we have enough room on both sides of the current page to build a slider we - // will surround it with both the beginning and ending caps, with this window - // of pages in the middle providing a Google style sliding paginator setup. - else - { - $content = $this->getAdjacentRange(); - - return $this->getStart().$content.$this->getFinish(); - } - } - - /** - * Get the page range for the current page window. - * - * @return string - */ - public function getAdjacentRange() - { - return $this->getPageRange($this->currentPage - 3, $this->currentPage + 3); - } - - /** - * Create the beginning leader of a pagination slider. - * - * @return string - */ - public function getStart() - { - return $this->getPageRange(1, 2).$this->getDots(); - } - - /** - * Create the ending cap of a pagination slider. - * - * @return string - */ - public function getFinish() - { - $content = $this->getPageRange($this->lastPage - 1, $this->lastPage); - - return $this->getDots().$content; - } - - /** - * Get the previous page pagination element. - * - * @param string $text - * @return string - */ - public function getPrevious($text = '«') - { - // If the current page is less than or equal to one, it means we can't go any - // further back in the pages, so we will render a disabled previous button - // when that is the case. Otherwise, we will give it an active "status". - if ($this->currentPage <= 1) - { - return $this->getDisabledTextWrapper($text); - } - - $url = $this->paginator->getUrl($this->currentPage - 1); - - return $this->getPageLinkWrapper($url, $text, 'prev'); - } - - /** - * Get the next page pagination element. - * - * @param string $text - * @return string - */ - public function getNext($text = '»') - { - // If the current page is greater than or equal to the last page, it means we - // can't go any further into the pages, as we're already on this last page - // that is available, so we will make it the "next" link style disabled. - if ($this->currentPage >= $this->lastPage) - { - return $this->getDisabledTextWrapper($text); - } - - $url = $this->paginator->getUrl($this->currentPage + 1); - - return $this->getPageLinkWrapper($url, $text, 'next'); - } - - /** - * Get a pagination "dot" element. - * - * @return string - */ - public function getDots() - { - return $this->getDisabledTextWrapper("..."); - } - - /** - * Create a pagination slider link. - * - * @param mixed $page - * @return string - */ - public function getLink($page) - { - $url = $this->paginator->getUrl($page); - - return $this->getPageLinkWrapper($url, $page); - } - - /** - * Set the value of the current page. - * - * @param int $page - * @return void - */ - public function setCurrentPage($page) - { - $this->currentPage = $page; - } - - /** - * Set the value of the last page. - * - * @param int $page - * @return void - */ - public function setLastPage($page) - { - $this->lastPage = $page; - } - -}
