├── bundles └── .gitignore ├── .gitignore ├── public ├── css │ ├── .gitignore │ └── style.css ├── img │ ├── .gitignore │ └── laravel.png ├── js │ ├── .gitignore │ └── script.js ├── bundles │ └── .gitignore ├── .htaccess └── index.php ├── application ├── tasks │ └── .gitignore ├── libraries │ ├── .gitignore │ └── math.php ├── migrations │ ├── .gitignore │ └── 2012_03_22_082426_create_pastes_table.php ├── models │ ├── .gitignore │ └── paste.php ├── config │ ├── .gitignore │ ├── error.php │ ├── cache.php │ ├── auth.php │ ├── session.php │ ├── database.php │ └── mimes.php ├── tests │ └── example.test.php ├── views │ ├── new.blade.php │ ├── view.blade.php │ ├── layouts │ │ └── main.blade.php │ └── error │ │ ├── 500.php │ │ └── 404.php ├── controllers │ ├── base.php │ └── home.php ├── language │ └── en │ │ └── pagination.php └── bundles.php ├── storage ├── sessions │ └── .gitignore ├── views │ ├── .gitignore │ ├── 594897248f8bedb8d1f1c3f80d90bc7c │ ├── 0184387823dfc07b79d805cc804af1eb │ ├── 361731c875833d1b5d21c99489ad0747 │ ├── 20b7e08ac1148264f4f2685ae70da1a8 │ ├── 14d681f4028c475fcb049d8229f5184c │ └── 468d2ab95a5227ac48035b216e7823c0 ├── database │ └── .gitignore ├── cache │ └── .gitignore ├── logs │ └── .gitignore └── work │ └── .gitignore ├── laravel ├── cli │ ├── tasks │ │ ├── task.php │ │ ├── test │ │ │ ├── stub.xml │ │ │ ├── phpunit.php │ │ │ └── runner.php │ │ ├── migrate │ │ │ ├── stub.php │ │ │ └── database.php │ │ ├── bundle │ │ │ ├── providers │ │ │ │ ├── github.php │ │ │ │ └── provider.php │ │ │ ├── repository.php │ │ │ └── publisher.php │ │ ├── session │ │ │ ├── migration.php │ │ │ └── manager.php │ │ ├── key.php │ │ └── route.php │ ├── artisan.php │ └── dependencies.php ├── database │ ├── query │ │ ├── grammars │ │ │ ├── mysql.php │ │ │ └── sqlserver.php │ │ └── join.php │ ├── expression.php │ ├── eloquent │ │ ├── pivot.php │ │ └── relationships │ │ │ ├── has_one.php │ │ │ ├── has_one_or_many.php │ │ │ ├── has_many.php │ │ │ ├── belongs_to.php │ │ │ └── relationship.php │ ├── connectors │ │ ├── sqlite.php │ │ ├── connector.php │ │ ├── sqlserver.php │ │ ├── postgres.php │ │ └── mysql.php │ ├── exception.php │ └── schema │ │ └── grammars │ │ └── grammar.php ├── session │ └── drivers │ │ ├── sweeper.php │ │ ├── memory.php │ │ ├── apc.php │ │ ├── redis.php │ │ ├── cookie.php │ │ ├── memcached.php │ │ ├── driver.php │ │ ├── file.php │ │ └── database.php ├── hash.php ├── cache │ └── drivers │ │ ├── memory.php │ │ ├── apc.php │ │ ├── redis.php │ │ ├── memcached.php │ │ ├── file.php │ │ ├── driver.php │ │ └── database.php ├── memcached.php ├── fluent.php ├── cache.php ├── log.php ├── section.php ├── error.php ├── session.php ├── database.php ├── ioc.php ├── pluralizer.php ├── event.php └── messages.php ├── vendor └── Symfony │ └── Component │ └── Console │ ├── composer.json │ ├── Output │ ├── NullOutput.php │ ├── ConsoleOutputInterface.php │ ├── ConsoleOutput.php │ ├── OutputInterface.php │ └── StreamOutput.php │ ├── Helper │ ├── Helper.php │ ├── HelperInterface.php │ ├── HelperSet.php │ └── FormatterHelper.php │ ├── LICENSE │ ├── README.md │ ├── Formatter │ ├── OutputFormatterStyleInterface.php │ └── OutputFormatterInterface.php │ ├── Command │ ├── HelpCommand.php │ └── ListCommand.php │ ├── Input │ ├── StringInput.php │ └── InputArgument.php │ └── Tester │ ├── CommandTester.php │ └── ApplicationTester.php ├── artisan ├── readme.md ├── license.txt └── paths.php /bundles/.gitignore: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store -------------------------------------------------------------------------------- /public/css/.gitignore: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /public/img/.gitignore: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /public/js/.gitignore: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /application/tasks/.gitignore: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /public/bundles/.gitignore: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /storage/sessions/.gitignore: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /storage/views/.gitignore: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /application/libraries/.gitignore: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /application/migrations/.gitignore: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /application/models/.gitignore: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /application/config/.gitignore: -------------------------------------------------------------------------------- 1 | local/* -------------------------------------------------------------------------------- /storage/database/.gitignore: -------------------------------------------------------------------------------- 1 | *.sqlite -------------------------------------------------------------------------------- /storage/cache/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore -------------------------------------------------------------------------------- /storage/logs/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore -------------------------------------------------------------------------------- /storage/work/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore -------------------------------------------------------------------------------- /laravel/cli/tasks/task.php: -------------------------------------------------------------------------------- 1 | 2 | RewriteEngine on 3 | 4 | RewriteCond %{REQUEST_FILENAME} !-f 5 | RewriteCond %{REQUEST_FILENAME} !-d 6 | 7 | RewriteRule ^(.*)$ index.php/$1 [L] 8 | -------------------------------------------------------------------------------- /public/js/script.js: -------------------------------------------------------------------------------- 1 | $(document).ready(function() { 2 | $('textarea').focus().tabby(); 3 | $('.save').click(function() { 4 | $('#submit').click(); 5 | }); 6 | 7 | function createPaste() { 8 | $("#paster").submit(); 9 | } 10 | }); 11 | -------------------------------------------------------------------------------- /laravel/database/query/grammars/mysql.php: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | {{directory}} 7 | 8 | 9 | -------------------------------------------------------------------------------- /application/tests/example.test.php: -------------------------------------------------------------------------------- 1 | assertTrue(true); 13 | } 14 | 15 | } -------------------------------------------------------------------------------- /laravel/session/drivers/sweeper.php: -------------------------------------------------------------------------------- 1 | Save 5 | @endsection 6 | 7 | @section('content') 8 | {{ Form::open('/', 'POST', array('id' => 'paster')) }} 9 | {{ Form::textarea('paste', Input::old('paste', $fork)) }} 10 | {{ Form::close() }} 11 | @endsection 12 | -------------------------------------------------------------------------------- /application/views/view.blade.php: -------------------------------------------------------------------------------- 1 | @layout('layouts.main') 2 | 3 | @section('buttons') 4 |
  • {{ HTML::link($id.'/raw', 'Raw') }}
  • 5 |
  • {{ HTML::link($id.'/fork', 'Fork') }}
  • 6 |
  • {{ HTML::link('/', 'New') }}
  • 7 | @endsection 8 | 9 | 10 | @section('content') 11 |
    {{ $paste }}
    12 | @endsection 13 | -------------------------------------------------------------------------------- /laravel/cli/tasks/migrate/stub.php: -------------------------------------------------------------------------------- 1 | 'required')); 17 | 18 | $validator->valid(); 19 | 20 | return $validator->errors->all(); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /storage/views/594897248f8bedb8d1f1c3f80d90bc7c: -------------------------------------------------------------------------------- 1 | 2 | 3 |
  • 4 |
  • 5 | 6 | 7 | 8 | 9 |
    10 | 11 | 12 | with(get_defined_vars())->render(); ?> -------------------------------------------------------------------------------- /laravel/cli/tasks/bundle/providers/github.php: -------------------------------------------------------------------------------- 1 | 3 |
  • Save
  • 4 | 5 | 6 | 7 | 'paster')) ; ?> 8 | 9 | 10 | 11 | 12 | with(get_defined_vars())->render(); ?> -------------------------------------------------------------------------------- /storage/views/361731c875833d1b5d21c99489ad0747: -------------------------------------------------------------------------------- 1 | 2 | 3 |
  • Save
  • 4 | 5 | 6 | 7 | 'paster')) ; ?> 8 | 9 | 10 | 11 | 12 | with(get_defined_vars())->render(); ?> -------------------------------------------------------------------------------- /storage/views/20b7e08ac1148264f4f2685ae70da1a8: -------------------------------------------------------------------------------- 1 | 2 | 3 |
  • 4 |
  • 5 |
  • 6 | 7 | 8 | 9 | 10 |
    11 | 12 | 13 | with(get_defined_vars())->render(); ?> -------------------------------------------------------------------------------- /application/migrations/2012_03_22_082426_create_pastes_table.php: -------------------------------------------------------------------------------- 1 | increments('id'); 14 | $table->text('paste'); 15 | $table->timestamps(); 16 | }); 17 | } 18 | 19 | /** 20 | * Revert the changes to the database. 21 | * 22 | * @return void 23 | */ 24 | public function down() 25 | { 26 | Schema::drop('pastes'); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /application/language/en/pagination.php: -------------------------------------------------------------------------------- 1 | '« Previous', 17 | 'next' => 'Next »', 18 | 19 | ); -------------------------------------------------------------------------------- /laravel/cli/tasks/bundle/repository.php: -------------------------------------------------------------------------------- 1 | api.$bundle); 25 | 26 | return json_decode($bundle, true); 27 | } 28 | 29 | } -------------------------------------------------------------------------------- /laravel/database/expression.php: -------------------------------------------------------------------------------- 1 | value = $value; 21 | } 22 | 23 | /** 24 | * Get the string value of the database expression. 25 | * 26 | * @return string 27 | */ 28 | public function get() 29 | { 30 | return $this->value; 31 | } 32 | 33 | /** 34 | * Get the string value of the database expression. 35 | * 36 | * @return string 37 | */ 38 | public function __toString() 39 | { 40 | return $this->get(); 41 | } 42 | 43 | } -------------------------------------------------------------------------------- /laravel/database/eloquent/pivot.php: -------------------------------------------------------------------------------- 1 | pivot_table = $table; 28 | 29 | parent::__construct(array(), true); 30 | } 31 | 32 | /** 33 | * Get the name of the pivot table. 34 | * 35 | * @return string 36 | */ 37 | public function table() 38 | { 39 | return $this->pivot_table; 40 | } 41 | 42 | } -------------------------------------------------------------------------------- /vendor/Symfony/Component/Console/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "symfony/console", 3 | "type": "library", 4 | "description": "Symfony Console Component", 5 | "keywords": [], 6 | "homepage": "http://symfony.com", 7 | "license": "MIT", 8 | "authors": [ 9 | { 10 | "name": "Fabien Potencier", 11 | "email": "fabien@symfony.com" 12 | }, 13 | { 14 | "name": "Symfony Community", 15 | "homepage": "http://symfony.com/contributors" 16 | } 17 | ], 18 | "require": { 19 | "php": ">=5.3.2" 20 | }, 21 | "autoload": { 22 | "psr-0": { "Symfony\\Component\\Console": "" } 23 | }, 24 | "target-dir": "Symfony/Component/Console", 25 | "extra": { 26 | "branch-alias": { 27 | "dev-master": "2.1-dev" 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /artisan: -------------------------------------------------------------------------------- 1 | 8 | * @link http://laravel.com 9 | */ 10 | 11 | // -------------------------------------------------------------- 12 | // Set the core Laravel path constants. 13 | // -------------------------------------------------------------- 14 | require 'paths.php'; 15 | 16 | // -------------------------------------------------------------- 17 | // Bootstrap the Laravel core. 18 | // -------------------------------------------------------------- 19 | require path('sys').'core.php'; 20 | 21 | // -------------------------------------------------------------- 22 | // Launch the Laravel "Artisan" CLI. 23 | // -------------------------------------------------------------- 24 | require path('sys').'cli/artisan'.EXT; -------------------------------------------------------------------------------- /laravel/database/connectors/sqlite.php: -------------------------------------------------------------------------------- 1 | options($config); 14 | 15 | // SQLite provides supported for "in-memory" databases, which exist only for 16 | // lifetime of the request. Any given in-memory database may only have one 17 | // PDO connection open to it at a time. These are mainly for tests. 18 | if ($config['database'] == ':memory:') 19 | { 20 | return new PDO('sqlite::memory:', null, null, $options); 21 | } 22 | 23 | $path = path('storage').'database'.DS.$config['database'].'.sqlite'; 24 | 25 | return new PDO('sqlite:'.$path, null, null, $options); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /vendor/Symfony/Component/Console/Output/NullOutput.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Console\Output; 13 | 14 | /** 15 | * NullOutput suppresses all output. 16 | * 17 | * $output = new NullOutput(); 18 | * 19 | * @author Fabien Potencier 20 | * 21 | * @api 22 | */ 23 | class NullOutput extends Output 24 | { 25 | /** 26 | * Writes a message to the output. 27 | * 28 | * @param string $message A message to write to the output 29 | * @param Boolean $newline Whether to add a newline or not 30 | */ 31 | public function doWrite($message, $newline) 32 | { 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /vendor/Symfony/Component/Console/Output/ConsoleOutputInterface.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Console\Output; 13 | 14 | use Symfony\Component\Console\Output\OutputInterface; 15 | 16 | /** 17 | * ConsoleOutputInterface is the interface implemented by ConsoleOutput class. 18 | * This adds information about stderr output stream. 19 | * 20 | * @author Dariusz Górecki 21 | */ 22 | interface ConsoleOutputInterface extends OutputInterface 23 | { 24 | /** 25 | * @return OutputInterface 26 | */ 27 | public function getErrorOutput(); 28 | 29 | public function setErrorOutput(OutputInterface $error); 30 | } 31 | -------------------------------------------------------------------------------- /laravel/cli/tasks/session/migration.php: -------------------------------------------------------------------------------- 1 | create(); 15 | 16 | // The session table consists simply of an ID, a UNIX timestamp to 17 | // indicate the expiration time, and a blob field which will hold 18 | // the serialized form of the session payload. 19 | $table->string('id')->length(40)->primary('session_primary'); 20 | 21 | $table->integer('last_activity'); 22 | 23 | $table->text('data'); 24 | }); 25 | } 26 | 27 | /** 28 | * Revert the changes to the database. 29 | * 30 | * @return void 31 | */ 32 | public function down() 33 | { 34 | Schema::table(Config::get('session.table'), function($table) 35 | { 36 | $table->drop(); 37 | }); 38 | } 39 | 40 | } -------------------------------------------------------------------------------- /application/views/layouts/main.blade.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Laravel Paste Bucket 7 | 8 | 9 | {{ HTML::style('css/style.css') }} 10 | 11 | 12 |
    13 | 19 | 20 |
      21 | @yield('buttons') 22 |
    23 |
    24 | 25 | @yield('content') 26 | 27 | {{ HTML::script('http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js') }} 28 | {{ HTML::script('js/prettify.js') }} 29 | {{ HTML::script('js/tabby.js') }} 30 | {{ HTML::script('js/script.js') }} 31 | 32 | 33 | -------------------------------------------------------------------------------- /laravel/database/exception.php: -------------------------------------------------------------------------------- 1 | inner = $inner; 23 | 24 | $this->setMessage($sql, $bindings); 25 | } 26 | 27 | /** 28 | * Set the exception message to include the SQL and bindings. 29 | * 30 | * @param string $sql 31 | * @param array $bindings 32 | * @return void 33 | */ 34 | protected function setMessage($sql, $bindings) 35 | { 36 | $this->message = $this->inner->getMessage(); 37 | 38 | $this->message .= "\n\nSQL: ".$sql."\n\nBindings: ".var_export($bindings, true); 39 | } 40 | 41 | } -------------------------------------------------------------------------------- /laravel/session/drivers/memory.php: -------------------------------------------------------------------------------- 1 | session; 23 | } 24 | 25 | /** 26 | * Save a given session to storage. 27 | * 28 | * @param array $session 29 | * @param array $config 30 | * @param bool $exists 31 | * @return void 32 | */ 33 | public function save($session, $config, $exists) 34 | { 35 | // 36 | } 37 | 38 | /** 39 | * Delete a session from storage by a given ID. 40 | * 41 | * @param string $id 42 | * @return void 43 | */ 44 | public function delete($id) 45 | { 46 | // 47 | } 48 | 49 | } -------------------------------------------------------------------------------- /laravel/database/connectors/connector.php: -------------------------------------------------------------------------------- 1 | PDO::CASE_LOWER, 12 | PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, 13 | PDO::ATTR_ORACLE_NULLS => PDO::NULL_NATURAL, 14 | PDO::ATTR_STRINGIFY_FETCHES => false, 15 | PDO::ATTR_EMULATE_PREPARES => false, 16 | ); 17 | 18 | /** 19 | * Establish a PDO database connection. 20 | * 21 | * @param array $config 22 | * @return PDO 23 | */ 24 | abstract public function connect($config); 25 | 26 | /** 27 | * Get the PDO connection options for the configuration. 28 | * 29 | * Developer specified options will override the default connection options. 30 | * 31 | * @param array $config 32 | * @return array 33 | */ 34 | protected function options($config) 35 | { 36 | $options = (isset($config['options'])) ? $config['options'] : array(); 37 | 38 | return $this->options + $options; 39 | } 40 | 41 | } -------------------------------------------------------------------------------- /storage/views/14d681f4028c475fcb049d8229f5184c: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Laravel Paste Bucket 7 | 8 | 9 | 10 | 11 | 12 |
    13 | 19 | 20 |
      21 | 22 |
    23 |
    24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /storage/views/468d2ab95a5227ac48035b216e7823c0: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Laravel Paste Bucket 7 | 8 | 9 | 10 | 11 | 12 |
    13 | 19 | 20 |
      21 | 22 |
    23 |
    24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /laravel/database/connectors/sqlserver.php: -------------------------------------------------------------------------------- 1 | PDO::CASE_LOWER, 12 | PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, 13 | PDO::ATTR_ORACLE_NULLS => PDO::NULL_NATURAL, 14 | PDO::ATTR_STRINGIFY_FETCHES => false, 15 | ); 16 | 17 | /** 18 | * Establish a PDO database connection. 19 | * 20 | * @param array $config 21 | * @return PDO 22 | */ 23 | public function connect($config) 24 | { 25 | extract($config); 26 | 27 | // Format the SQL Server connection string. This connection string format can 28 | // also be used to connect to Azure SQL Server databases. The port is defined 29 | // directly after the server name, so we'll create that first. 30 | $port = (isset($port)) ? ','.$port : ''; 31 | 32 | $dsn = "sqlsrv:Server={$host}{$port};Database={$database}"; 33 | 34 | return new PDO($dsn, $username, $password, $this->options($config)); 35 | } 36 | 37 | } -------------------------------------------------------------------------------- /vendor/Symfony/Component/Console/Helper/Helper.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Console\Helper; 13 | 14 | /** 15 | * Helper is the base class for all helper classes. 16 | * 17 | * @author Fabien Potencier 18 | */ 19 | abstract class Helper implements HelperInterface 20 | { 21 | protected $helperSet = null; 22 | 23 | /** 24 | * Sets the helper set associated with this helper. 25 | * 26 | * @param HelperSet $helperSet A HelperSet instance 27 | */ 28 | public function setHelperSet(HelperSet $helperSet = null) 29 | { 30 | $this->helperSet = $helperSet; 31 | } 32 | 33 | /** 34 | * Gets the helper set associated with this helper. 35 | * 36 | * @return HelperSet A HelperSet instance 37 | */ 38 | public function getHelperSet() 39 | { 40 | return $this->helperSet; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /vendor/Symfony/Component/Console/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2004-2012 Fabien Potencier 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is furnished 8 | to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /application/controllers/home.php: -------------------------------------------------------------------------------- 1 | relationships[$relationship] = null; 27 | } 28 | } 29 | 30 | /** 31 | * Match eagerly loaded child models to their parent models. 32 | * 33 | * @param array $parents 34 | * @param array $children 35 | * @return void 36 | */ 37 | public function match($relationship, &$parents, $children) 38 | { 39 | $foreign = $this->foreign_key(); 40 | 41 | foreach ($children as $key => $child) 42 | { 43 | $parents[$child->$foreign]->relationships[$relationship] = $child; 44 | } 45 | } 46 | 47 | } -------------------------------------------------------------------------------- /laravel/database/connectors/postgres.php: -------------------------------------------------------------------------------- 1 | options($config)); 26 | 27 | // If a character set has been specified, we'll execute a query against 28 | // the database to set the correct character set. By default, this is 29 | // set to UTF-8 which should be fine for most scenarios. 30 | if (isset($config['charset'])) 31 | { 32 | $connection->prepare("SET NAMES '{$config['charset']}'")->execute(); 33 | } 34 | 35 | return $connection; 36 | } 37 | 38 | } -------------------------------------------------------------------------------- /laravel/database/eloquent/relationships/has_one_or_many.php: -------------------------------------------------------------------------------- 1 | attributes : $attributes; 16 | 17 | $attributes[$this->foreign_key()] = $this->base->get_key(); 18 | 19 | return $this->model->create($attributes); 20 | } 21 | 22 | /** 23 | * Set the proper constraints on the relationship table. 24 | * 25 | * @return void 26 | */ 27 | protected function constrain() 28 | { 29 | $this->table->where($this->foreign_key(), '=', $this->base->get_key()); 30 | } 31 | 32 | /** 33 | * Set the proper constraints on the relationship table for an eager load. 34 | * 35 | * @param array $results 36 | * @return void 37 | */ 38 | public function eagerly_constrain($results) 39 | { 40 | $this->table->where_in($this->foreign_key(), array_keys($results)); 41 | } 42 | 43 | } -------------------------------------------------------------------------------- /application/libraries/math.php: -------------------------------------------------------------------------------- 1 | relationships[$relationship] = array(); 27 | } 28 | } 29 | 30 | /** 31 | * Match eagerly loaded child models to their parent models. 32 | * 33 | * @param array $parents 34 | * @param array $children 35 | * @return void 36 | */ 37 | public function match($relationship, &$parents, $children) 38 | { 39 | $foreign = $this->foreign_key(); 40 | 41 | foreach ($children as $key => $child) 42 | { 43 | $parents[$child->$foreign]->relationships[$relationship][$child->get_key()] = $child; 44 | } 45 | } 46 | 47 | } -------------------------------------------------------------------------------- /vendor/Symfony/Component/Console/Helper/HelperInterface.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Console\Helper; 13 | 14 | /** 15 | * HelperInterface is the interface all helpers must implement. 16 | * 17 | * @author Fabien Potencier 18 | * 19 | * @api 20 | */ 21 | interface HelperInterface 22 | { 23 | /** 24 | * Sets the helper set associated with this helper. 25 | * 26 | * @param HelperSet $helperSet A HelperSet instance 27 | * 28 | * @api 29 | */ 30 | function setHelperSet(HelperSet $helperSet = null); 31 | 32 | /** 33 | * Gets the helper set associated with this helper. 34 | * 35 | * @return HelperSet A HelperSet instance 36 | * 37 | * @api 38 | */ 39 | function getHelperSet(); 40 | 41 | /** 42 | * Returns the canonical name of this helper. 43 | * 44 | * @return string The canonical name 45 | * 46 | * @api 47 | */ 48 | function getName(); 49 | } 50 | -------------------------------------------------------------------------------- /public/index.php: -------------------------------------------------------------------------------- 1 | 8 | * @link http://laravel.com 9 | */ 10 | 11 | // -------------------------------------------------------------- 12 | // Tick... Tock... Tick... Tock... 13 | // -------------------------------------------------------------- 14 | define('LARAVEL_START', microtime(true)); 15 | 16 | // -------------------------------------------------------------- 17 | // Indicate that the request is from the web. 18 | // -------------------------------------------------------------- 19 | $web = true; 20 | 21 | // -------------------------------------------------------------- 22 | // Set the core Laravel path constants. 23 | // -------------------------------------------------------------- 24 | require '../paths.php'; 25 | 26 | // -------------------------------------------------------------- 27 | // Unset the temporary web variable. 28 | // -------------------------------------------------------------- 29 | unset($web); 30 | 31 | // -------------------------------------------------------------- 32 | // Launch Laravel. 33 | // -------------------------------------------------------------- 34 | require path('sys').'laravel.php'; -------------------------------------------------------------------------------- /laravel/session/drivers/apc.php: -------------------------------------------------------------------------------- 1 | apc = $apc; 21 | } 22 | 23 | /** 24 | * Load a session from storage by a given ID. 25 | * 26 | * If no session is found for the ID, null will be returned. 27 | * 28 | * @param string $id 29 | * @return array 30 | */ 31 | public function load($id) 32 | { 33 | return $this->apc->get($id); 34 | } 35 | 36 | /** 37 | * Save a given session to storage. 38 | * 39 | * @param array $session 40 | * @param array $config 41 | * @param bool $exists 42 | * @return void 43 | */ 44 | public function save($session, $config, $exists) 45 | { 46 | $this->apc->put($session['id'], $session, $config['lifetime']); 47 | } 48 | 49 | /** 50 | * Delete a session from storage by a given ID. 51 | * 52 | * @param string $id 53 | * @return void 54 | */ 55 | public function delete($id) 56 | { 57 | $this->apc->forget($id); 58 | } 59 | 60 | } -------------------------------------------------------------------------------- /laravel/session/drivers/redis.php: -------------------------------------------------------------------------------- 1 | redis = $redis; 21 | } 22 | 23 | /** 24 | * Load a session from storage by a given ID. 25 | * 26 | * If no session is found for the ID, null will be returned. 27 | * 28 | * @param string $id 29 | * @return array 30 | */ 31 | public function load($id) 32 | { 33 | return $this->redis->get($id); 34 | } 35 | 36 | /** 37 | * Save a given session to storage. 38 | * 39 | * @param array $session 40 | * @param array $config 41 | * @param bool $exists 42 | * @return void 43 | */ 44 | public function save($session, $config, $exists) 45 | { 46 | $this->redis->put($session['id'], $session, $config['lifetime']); 47 | } 48 | 49 | /** 50 | * Delete a session from storage by a given ID. 51 | * 52 | * @param string $id 53 | * @return void 54 | */ 55 | public function delete($id) 56 | { 57 | $this->redis->forget($id); 58 | } 59 | 60 | } -------------------------------------------------------------------------------- /laravel/cli/tasks/key.php: -------------------------------------------------------------------------------- 1 | path = path('app').'config/application'.EXT; 23 | } 24 | 25 | /** 26 | * Generate a random key for the application. 27 | * 28 | * @param array $arguments 29 | * @return void 30 | */ 31 | public function generate($arguments = array()) 32 | { 33 | // By default the Crypter class uses AES-256 encryption which uses 34 | // a 32 byte input vector, so that is the length of string we will 35 | // generate for the application token unless another length is 36 | // specified through the CLI. 37 | $key = Str::random(array_get($arguments, 0, 32)); 38 | 39 | $config = File::get($this->path); 40 | 41 | $config = str_replace("'key' => '',", "'key' => '{$key}',", $config, $count); 42 | 43 | File::put($this->path, $config); 44 | 45 | if ($count > 0) 46 | { 47 | echo "Configuration updated with secure key!"; 48 | } 49 | else 50 | { 51 | echo "An application key already exists!"; 52 | } 53 | 54 | echo PHP_EOL; 55 | } 56 | 57 | } -------------------------------------------------------------------------------- /laravel/session/drivers/cookie.php: -------------------------------------------------------------------------------- 1 | 9 | * // Create a Bcrypt hash of a value 10 | * $hash = Hash::make('secret'); 11 | * 12 | * // Use a specified number of iterations when creating the hash 13 | * $hash = Hash::make('secret', 12); 14 | * 15 | * 16 | * @param string $value 17 | * @param int $rounds 18 | * @return string 19 | */ 20 | public static function make($value, $rounds = 8) 21 | { 22 | $work = str_pad($rounds, 2, '0', STR_PAD_LEFT); 23 | 24 | // Bcrypt expects the salt to be 22 base64 encoded characters including 25 | // dots and slashes. We will get rid of the plus signs included in the 26 | // base64 data and replace them with dots. 27 | if (function_exists('openssl_random_pseudo_bytes')) 28 | { 29 | $salt = openssl_random_pseudo_bytes(16); 30 | } 31 | else 32 | { 33 | $salt = Str::random(40); 34 | } 35 | 36 | $salt = substr(strtr(base64_encode($salt), '+', '.'), 0 , 22); 37 | 38 | return crypt($value, '$2a$'.$work.'$'.$salt); 39 | } 40 | 41 | /** 42 | * Determine if an unhashed value matches a Bcrypt hash. 43 | * 44 | * @param string $value 45 | * @param string $hash 46 | * @return bool 47 | */ 48 | public static function check($value, $hash) 49 | { 50 | return crypt($value, $hash) === $hash; 51 | } 52 | 53 | } -------------------------------------------------------------------------------- /laravel/session/drivers/memcached.php: -------------------------------------------------------------------------------- 1 | memcached = $memcached; 21 | } 22 | 23 | /** 24 | * Load a session from storage by a given ID. 25 | * 26 | * If no session is found for the ID, null will be returned. 27 | * 28 | * @param string $id 29 | * @return array 30 | */ 31 | public function load($id) 32 | { 33 | return $this->memcached->get($id); 34 | } 35 | 36 | /** 37 | * Save a given session to storage. 38 | * 39 | * @param array $session 40 | * @param array $config 41 | * @param bool $exists 42 | * @return void 43 | */ 44 | public function save($session, $config, $exists) 45 | { 46 | $this->memcached->put($session['id'], $session, $config['lifetime']); 47 | } 48 | 49 | /** 50 | * Delete a session from storage by a given ID. 51 | * 52 | * @param string $id 53 | * @return void 54 | */ 55 | public function delete($id) 56 | { 57 | $this->memcached->forget($id); 58 | } 59 | 60 | } -------------------------------------------------------------------------------- /application/bundles.php: -------------------------------------------------------------------------------- 1 | array( 22 | | 'location' => 'admin', 23 | | 'handles' => 'admin', 24 | | ), 25 | | 26 | | Note that the "location" is relative to the "bundles" directory. 27 | | Now the bundle will be recognized by Laravel and will be able 28 | | to respond to requests beginning with "admin"! 29 | | 30 | | Have a bundle that lives in the root of the bundle directory 31 | | and doesn't respond to any requests? Just add the bundle 32 | | name to the array and we'll take care of the rest. 33 | | 34 | */ 35 | 36 | return array(); -------------------------------------------------------------------------------- /laravel/cli/tasks/route.php: -------------------------------------------------------------------------------- 1 | route(); 30 | 31 | echo PHP_EOL; 32 | } 33 | 34 | /** 35 | * Dump the results of the currently established route. 36 | * 37 | * @return void 38 | */ 39 | protected function route() 40 | { 41 | // We'll call the router using the method and URI specified by 42 | // the developer on the CLI. If a route is found, we will not 43 | // run the filters, but simply dump the result. 44 | $route = Router::route(Request::method(), URI::current()); 45 | 46 | if ( ! is_null($route)) 47 | { 48 | var_dump($route->response()); 49 | } 50 | else 51 | { 52 | echo '404: Not Found'; 53 | } 54 | } 55 | 56 | } -------------------------------------------------------------------------------- /laravel/database/query/join.php: -------------------------------------------------------------------------------- 1 | type = $type; 36 | $this->table = $table; 37 | } 38 | 39 | /** 40 | * Add an ON clause to the join. 41 | * 42 | * @param string $column1 43 | * @param string $operator 44 | * @param string $column2 45 | * @param string $connector 46 | * @return Join 47 | */ 48 | public function on($column1, $operator, $column2, $connector = 'AND') 49 | { 50 | $this->clauses[] = compact('column1', 'operator', 'column2', 'connector'); 51 | 52 | return $this; 53 | } 54 | 55 | /** 56 | * Add an OR ON clause to the join. 57 | * 58 | * @param string $column1 59 | * @param string $operator 60 | * @param string $column2 61 | * @return Join 62 | */ 63 | public function or_on($column1, $operator, $column2) 64 | { 65 | return $this->on($column1, $operator, $column2, 'OR'); 66 | } 67 | 68 | } -------------------------------------------------------------------------------- /laravel/cli/tasks/bundle/publisher.php: -------------------------------------------------------------------------------- 1 | move($path.'public', path('public').'bundles'.DS.$bundle); 27 | 28 | echo "Assets published for bundle [$bundle].".PHP_EOL; 29 | } 30 | 31 | /** 32 | * Copy the contents of a bundle's assets to the public folder. 33 | * 34 | * @param string $source 35 | * @param string $destination 36 | * @return void 37 | */ 38 | protected function move($source, $destination) 39 | { 40 | File::cpdir($source, $destination); 41 | } 42 | 43 | /** 44 | * Get the "to" location of the bundle's assets. 45 | * 46 | * @param string $bundle 47 | * @return string 48 | */ 49 | protected function to($bundle) 50 | { 51 | return path('public').'bundles'.DS.$bundle.DS; 52 | } 53 | 54 | /** 55 | * Get the "from" location of the bundle's assets. 56 | * 57 | * @param string $bundle 58 | * @return string 59 | */ 60 | protected function from($bundle) 61 | { 62 | return Bundle::path($bundle).'public'; 63 | } 64 | 65 | } -------------------------------------------------------------------------------- /laravel/database/connectors/mysql.php: -------------------------------------------------------------------------------- 1 | options($config)); 34 | 35 | // If a character set has been specified, we'll execute a query against 36 | // the database to set the correct character set. By default, this is 37 | // set to UTF-8 which should be fine for most scenarios. 38 | if (isset($config['charset'])) 39 | { 40 | $connection->prepare("SET NAMES '{$config['charset']}'")->execute(); 41 | } 42 | 43 | return $connection; 44 | } 45 | 46 | } -------------------------------------------------------------------------------- /laravel/cli/artisan.php: -------------------------------------------------------------------------------- 1 | getMessage(); 45 | } 46 | 47 | echo PHP_EOL; -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | ## Laravel - A PHP Framework For Web Artisans 2 | 3 | Laravel is a clean and classy framework for PHP web development. Freeing you from spaghetti code, Laravel helps you create wonderful applications using simple, expressive syntax. Development should be a creative experience that you enjoy, not something that is painful. Enjoy the fresh air. 4 | 5 | ### [Official Website & Documentation](http://laravel.com) 6 | 7 | ### Feature Overview 8 | 9 | - Simple routing using Closures or controllers. 10 | - Views and templating. 11 | - Driver based session and cache handling. 12 | - Database abstraction with query builder. 13 | - Authentication. 14 | - Migrations. 15 | - PHPUnit Integration. 16 | - A lot more. 17 | 18 | ### A Few Examples 19 | 20 | **Hello World:** 21 | 22 | Route::get('/', function() 23 | { 24 | return "Hello World!": 25 | }); 26 | 27 | **Passing Data To Views:** 28 | 29 | Route::get('user/(:num)', function($id) 30 | { 31 | $user = DB::table('users')->find($id); 32 | 33 | return View::make('profile')->with('user', $user); 34 | }); 35 | 36 | **Redirecting & Flashing Data To The Session:** 37 | 38 | return Redirect::to('profile')->with('message', 'Welcome Back!'); 39 | 40 | ### Contributing to Laravel 41 | 42 | Contributions are encouraged and welcome; however, please review the Developer Certificate of Origin in the "license.txt" file included in the repository. All commits must be signed off using the "-s" switch. 43 | 44 | git commit -s -m "this commit will be signed off automatically!" 45 | 46 | ### License 47 | 48 | Laravel is open-sourced software licensed under the MIT License. -------------------------------------------------------------------------------- /laravel/cli/tasks/test/phpunit.php: -------------------------------------------------------------------------------- 1 | 8 | * @link http://laravel.com 9 | */ 10 | 11 | // -------------------------------------------------------------- 12 | // Define the directory separator for the environment. 13 | // -------------------------------------------------------------- 14 | define('DS', DIRECTORY_SEPARATOR); 15 | 16 | // -------------------------------------------------------------- 17 | // Set the core Laravel path constants. 18 | // -------------------------------------------------------------- 19 | require 'paths.php'; 20 | 21 | // -------------------------------------------------------------- 22 | // Override the application paths when testing the core. 23 | // -------------------------------------------------------------- 24 | $config = file_get_contents('phpunit.xml'); 25 | 26 | if (strpos($config, 'laravel-tests') !== false) 27 | { 28 | $path = path('bundle').'laravel-tests'.DS; 29 | 30 | set_path('app', $path.'application'.DS); 31 | 32 | set_path('bundle', $path.'bundles'.DS); 33 | 34 | set_path('storage', $path.'storage'.DS); 35 | } 36 | 37 | // -------------------------------------------------------------- 38 | // Bootstrap the Laravel core. 39 | // -------------------------------------------------------------- 40 | require path('sys').'core.php'; 41 | 42 | // -------------------------------------------------------------- 43 | // Start the default bundle. 44 | // -------------------------------------------------------------- 45 | Laravel\Bundle::start(DEFAULT_BUNDLE); -------------------------------------------------------------------------------- /vendor/Symfony/Component/Console/README.md: -------------------------------------------------------------------------------- 1 | Console Component 2 | ================= 3 | 4 | Console eases the creation of beautiful and testable command line interfaces. 5 | 6 | The Application object manages the CLI application: 7 | 8 | use Symfony\Component\Console\Application; 9 | 10 | $console = new Application(); 11 | $console->run(); 12 | 13 | The ``run()`` method parses the arguments and options passed on the command 14 | line and executes the right command. 15 | 16 | Registering a new command can easily be done via the ``register()`` method, 17 | which returns a ``Command`` instance: 18 | 19 | use Symfony\Component\Console\Input\InputInterface; 20 | use Symfony\Component\Console\Input\InputArgument; 21 | use Symfony\Component\Console\Input\InputOption; 22 | use Symfony\Component\Console\Output\OutputInterface; 23 | 24 | $console 25 | ->register('ls') 26 | ->setDefinition(array( 27 | new InputArgument('dir', InputArgument::REQUIRED, 'Directory name'), 28 | )) 29 | ->setDescription('Displays the files in the given directory') 30 | ->setCode(function (InputInterface $input, OutputInterface $output) { 31 | $dir = $input->getArgument('dir'); 32 | 33 | $output->writeln(sprintf('Dir listing for %s', $dir)); 34 | }) 35 | ; 36 | 37 | You can also register new commands via classes. 38 | 39 | The component provides a lot of features like output coloring, input and 40 | output abstractions (so that you can easily unit-test your commands), 41 | validation, automatic help messages, ... 42 | 43 | Resources 44 | --------- 45 | 46 | Unit tests: 47 | 48 | https://github.com/symfony/symfony/tree/master/tests/Symfony/Tests/Component/Console 49 | -------------------------------------------------------------------------------- /vendor/Symfony/Component/Console/Formatter/OutputFormatterStyleInterface.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Console\Formatter; 13 | 14 | /** 15 | * Formatter style interface for defining styles. 16 | * 17 | * @author Konstantin Kudryashov 18 | * 19 | * @api 20 | */ 21 | interface OutputFormatterStyleInterface 22 | { 23 | /** 24 | * Sets style foreground color. 25 | * 26 | * @param string $color color name 27 | * 28 | * @api 29 | */ 30 | function setForeground($color = null); 31 | 32 | /** 33 | * Sets style background color. 34 | * 35 | * @param string $color color name 36 | * 37 | * @api 38 | */ 39 | function setBackground($color = null); 40 | 41 | /** 42 | * Sets some specific style option. 43 | * 44 | * @param string $option option name 45 | * 46 | * @api 47 | */ 48 | function setOption($option); 49 | 50 | /** 51 | * Unsets some specific style option. 52 | * 53 | * @param string $option option name 54 | */ 55 | function unsetOption($option); 56 | 57 | /** 58 | * Sets multiple style options at once. 59 | * 60 | * @param array $options 61 | */ 62 | function setOptions(array $options); 63 | 64 | /** 65 | * Applies the style to a given text. 66 | * 67 | * @param string $text The text to style 68 | * 69 | * @return string 70 | */ 71 | function apply($text); 72 | } 73 | -------------------------------------------------------------------------------- /laravel/session/drivers/driver.php: -------------------------------------------------------------------------------- 1 | $this->id(), 'data' => array( 44 | ':new:' => array(), 45 | ':old:' => array(), 46 | )); 47 | } 48 | 49 | /** 50 | * Get a new session ID that isn't assigned to any current session. 51 | * 52 | * @return string 53 | */ 54 | public function id() 55 | { 56 | $session = array(); 57 | 58 | // We'll containue generating random IDs until we find an ID that is 59 | // not currently assigned to a session. This is almost definitely 60 | // going to happen on the first iteration. 61 | do { 62 | 63 | $session = $this->load($id = Str::random(40)); 64 | 65 | } while ( ! is_null($session)); 66 | 67 | return $id; 68 | } 69 | 70 | } -------------------------------------------------------------------------------- /laravel/cache/drivers/memory.php: -------------------------------------------------------------------------------- 1 | get($key))); 21 | } 22 | 23 | /** 24 | * Retrieve an item from the cache driver. 25 | * 26 | * @param string $key 27 | * @return mixed 28 | */ 29 | protected function retrieve($key) 30 | { 31 | if (array_key_exists($key, $this->storage)) 32 | { 33 | return $this->storage[$key]; 34 | } 35 | } 36 | 37 | /** 38 | * Write an item to the cache for a given number of minutes. 39 | * 40 | * 41 | * // Put an item in the cache for 15 minutes 42 | * Cache::put('name', 'Taylor', 15); 43 | * 44 | * 45 | * @param string $key 46 | * @param mixed $value 47 | * @param int $minutes 48 | * @return void 49 | */ 50 | public function put($key, $value, $minutes) 51 | { 52 | $this->storage[$key] = $value; 53 | } 54 | 55 | /** 56 | * Write an item to the cache that lasts forever. 57 | * 58 | * @param string $key 59 | * @param mixed $value 60 | * @return void 61 | */ 62 | public function forever($key, $value) 63 | { 64 | $this->put($key, $value, 0); 65 | } 66 | 67 | /** 68 | * Delete an item from the cache. 69 | * 70 | * @param string $key 71 | * @return void 72 | */ 73 | public function forget($key) 74 | { 75 | unset($this->storage[$key]); 76 | } 77 | 78 | /** 79 | * Flush the entire cache. 80 | * 81 | * @return void 82 | */ 83 | public function flush() 84 | { 85 | $this->storage = array(); 86 | } 87 | 88 | } -------------------------------------------------------------------------------- /laravel/memcached.php: -------------------------------------------------------------------------------- 1 | 16 | * // Get the Memcache connection and get an item from the cache 17 | * $name = Memcached::connection()->get('name'); 18 | * 19 | * // Get the Memcache connection and place an item in the cache 20 | * Memcached::connection()->set('name', 'Taylor'); 21 | * 22 | * 23 | * @return Memcached 24 | */ 25 | public static function connection() 26 | { 27 | if (is_null(static::$connection)) 28 | { 29 | static::$connection = static::connect(Config::get('cache.memcached')); 30 | } 31 | 32 | return static::$connection; 33 | } 34 | 35 | /** 36 | * Create a new Memcached connection instance. 37 | * 38 | * @param array $servers 39 | * @return Memcached 40 | */ 41 | protected static function connect($servers) 42 | { 43 | $memcache = new \Memcache; 44 | 45 | foreach ($servers as $server) 46 | { 47 | $memcache->addServer($server['host'], $server['port'], true, $server['weight']); 48 | } 49 | 50 | if ($memcache->getVersion() === false) 51 | { 52 | throw new \Exception('Could not establish memcached connection.'); 53 | } 54 | 55 | return $memcache; 56 | } 57 | 58 | /** 59 | * Dynamically pass all other method calls to the Memcache instance. 60 | * 61 | * 62 | * // Get an item from the Memcache instance 63 | * $name = Memcached::get('name'); 64 | * 65 | * // Store data on the Memcache server 66 | * Memcached::set('name', 'Taylor'); 67 | * 68 | */ 69 | public static function __callStatic($method, $parameters) 70 | { 71 | return call_user_func_array(array(static::instance(), $method), $parameters); 72 | } 73 | 74 | } -------------------------------------------------------------------------------- /laravel/cache/drivers/apc.php: -------------------------------------------------------------------------------- 1 | key = $key; 21 | } 22 | 23 | /** 24 | * Determine if an item exists in the cache. 25 | * 26 | * @param string $key 27 | * @return bool 28 | */ 29 | public function has($key) 30 | { 31 | return ( ! is_null($this->get($key))); 32 | } 33 | 34 | /** 35 | * Retrieve an item from the cache driver. 36 | * 37 | * @param string $key 38 | * @return mixed 39 | */ 40 | protected function retrieve($key) 41 | { 42 | if (($cache = apc_fetch($this->key.$key)) !== false) 43 | { 44 | return $cache; 45 | } 46 | } 47 | 48 | /** 49 | * Write an item to the cache for a given number of minutes. 50 | * 51 | * 52 | * // Put an item in the cache for 15 minutes 53 | * Cache::put('name', 'Taylor', 15); 54 | * 55 | * 56 | * @param string $key 57 | * @param mixed $value 58 | * @param int $minutes 59 | * @return void 60 | */ 61 | public function put($key, $value, $minutes) 62 | { 63 | apc_store($this->key.$key, $value, $minutes * 60); 64 | } 65 | 66 | /** 67 | * Write an item to the cache that lasts forever. 68 | * 69 | * @param string $key 70 | * @param mixed $value 71 | * @return void 72 | */ 73 | public function forever($key, $value) 74 | { 75 | return $this->put($key, $value, 0); 76 | } 77 | 78 | /** 79 | * Delete an item from the cache. 80 | * 81 | * @param string $key 82 | * @return void 83 | */ 84 | public function forget($key) 85 | { 86 | apc_delete($this->key.$key); 87 | } 88 | 89 | } -------------------------------------------------------------------------------- /laravel/session/drivers/file.php: -------------------------------------------------------------------------------- 1 | path = $path; 21 | } 22 | 23 | /** 24 | * Load a session from storage by a given ID. 25 | * 26 | * If no session is found for the ID, null will be returned. 27 | * 28 | * @param string $id 29 | * @return array 30 | */ 31 | public function load($id) 32 | { 33 | if (file_exists($path = $this->path.$id)) 34 | { 35 | return unserialize(file_get_contents($path)); 36 | } 37 | } 38 | 39 | /** 40 | * Save a given session to storage. 41 | * 42 | * @param array $session 43 | * @param array $config 44 | * @param bool $exists 45 | * @return void 46 | */ 47 | public function save($session, $config, $exists) 48 | { 49 | file_put_contents($this->path.$session['id'], serialize($session), LOCK_EX); 50 | } 51 | 52 | /** 53 | * Delete a session from storage by a given ID. 54 | * 55 | * @param string $id 56 | * @return void 57 | */ 58 | public function delete($id) 59 | { 60 | if (file_exists($this->path.$id)) 61 | { 62 | @unlink($this->path.$id); 63 | } 64 | } 65 | 66 | /** 67 | * Delete all expired sessions from persistant storage. 68 | * 69 | * @param int $expiration 70 | * @return void 71 | */ 72 | public function sweep($expiration) 73 | { 74 | $files = glob($this->path.'*'); 75 | 76 | if ($files === false) return; 77 | 78 | foreach ($files as $file) 79 | { 80 | if (filetype($file) == 'file' and filemtime($file) < $expiration) 81 | { 82 | @unlink($file); 83 | } 84 | } 85 | } 86 | 87 | } -------------------------------------------------------------------------------- /laravel/cache/drivers/redis.php: -------------------------------------------------------------------------------- 1 | redis = $redis; 21 | } 22 | 23 | /** 24 | * Determine if an item exists in the cache. 25 | * 26 | * @param string $key 27 | * @return bool 28 | */ 29 | public function has($key) 30 | { 31 | return ( ! is_null($this->redis->get($key))); 32 | } 33 | 34 | /** 35 | * Retrieve an item from the cache driver. 36 | * 37 | * @param string $key 38 | * @return mixed 39 | */ 40 | protected function retrieve($key) 41 | { 42 | if ( ! is_null($cache = $this->redis->get($key))) 43 | { 44 | return unserialize($cache); 45 | } 46 | } 47 | 48 | /** 49 | * Write an item to the cache for a given number of minutes. 50 | * 51 | * 52 | * // Put an item in the cache for 15 minutes 53 | * Cache::put('name', 'Taylor', 15); 54 | * 55 | * 56 | * @param string $key 57 | * @param mixed $value 58 | * @param int $minutes 59 | * @return void 60 | */ 61 | public function put($key, $value, $minutes) 62 | { 63 | $this->forever($key, $value); 64 | 65 | $this->redis->expire($key, $minutes * 60); 66 | } 67 | 68 | /** 69 | * Write an item to the cache that lasts forever. 70 | * 71 | * @param string $key 72 | * @param mixed $value 73 | * @return void 74 | */ 75 | public function forever($key, $value) 76 | { 77 | $this->redis->set($key, serialize($value)); 78 | } 79 | 80 | /** 81 | * Delete an item from the cache. 82 | * 83 | * @param string $key 84 | * @return void 85 | */ 86 | public function forget($key) 87 | { 88 | $this->redis->del($key); 89 | } 90 | 91 | } -------------------------------------------------------------------------------- /vendor/Symfony/Component/Console/Formatter/OutputFormatterInterface.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Console\Formatter; 13 | 14 | /** 15 | * Formatter interface for console output. 16 | * 17 | * @author Konstantin Kudryashov 18 | * 19 | * @api 20 | */ 21 | interface OutputFormatterInterface 22 | { 23 | /** 24 | * Sets the decorated flag. 25 | * 26 | * @param Boolean $decorated Whether to decorate the messages or not 27 | * 28 | * @api 29 | */ 30 | function setDecorated($decorated); 31 | 32 | /** 33 | * Gets the decorated flag. 34 | * 35 | * @return Boolean true if the output will decorate messages, false otherwise 36 | * 37 | * @api 38 | */ 39 | function isDecorated(); 40 | 41 | /** 42 | * Sets a new style. 43 | * 44 | * @param string $name The style name 45 | * @param OutputFormatterStyleInterface $style The style instance 46 | * 47 | * @api 48 | */ 49 | function setStyle($name, OutputFormatterStyleInterface $style); 50 | 51 | /** 52 | * Checks if output formatter has style with specified name. 53 | * 54 | * @param string $name 55 | * 56 | * @return Boolean 57 | * 58 | * @api 59 | */ 60 | function hasStyle($name); 61 | 62 | /** 63 | * Gets style options from style with specified name. 64 | * 65 | * @param string $name 66 | * 67 | * @return OutputFormatterStyleInterface 68 | * 69 | * @api 70 | */ 71 | function getStyle($name); 72 | 73 | /** 74 | * Formats a message according to the given styles. 75 | * 76 | * @param string $message The message to style 77 | * 78 | * @return string The styled message 79 | * 80 | * @api 81 | */ 82 | function format($message); 83 | } 84 | -------------------------------------------------------------------------------- /laravel/cache/drivers/memcached.php: -------------------------------------------------------------------------------- 1 | key = $key; 28 | $this->memcache = $memcache; 29 | } 30 | 31 | /** 32 | * Determine if an item exists in the cache. 33 | * 34 | * @param string $key 35 | * @return bool 36 | */ 37 | public function has($key) 38 | { 39 | return ( ! is_null($this->get($key))); 40 | } 41 | 42 | /** 43 | * Retrieve an item from the cache driver. 44 | * 45 | * @param string $key 46 | * @return mixed 47 | */ 48 | protected function retrieve($key) 49 | { 50 | if (($cache = $this->memcache->get($this->key.$key)) !== false) 51 | { 52 | return $cache; 53 | } 54 | } 55 | 56 | /** 57 | * Write an item to the cache for a given number of minutes. 58 | * 59 | * 60 | * // Put an item in the cache for 15 minutes 61 | * Cache::put('name', 'Taylor', 15); 62 | * 63 | * 64 | * @param string $key 65 | * @param mixed $value 66 | * @param int $minutes 67 | * @return void 68 | */ 69 | public function put($key, $value, $minutes) 70 | { 71 | $this->memcache->set($this->key.$key, $value, 0, $minutes * 60); 72 | } 73 | 74 | /** 75 | * Write an item to the cache that lasts forever. 76 | * 77 | * @param string $key 78 | * @param mixed $value 79 | * @return void 80 | */ 81 | public function forever($key, $value) 82 | { 83 | return $this->put($key, $value, 0); 84 | } 85 | 86 | /** 87 | * Delete an item from the cache. 88 | * 89 | * @param string $key 90 | * @return void 91 | */ 92 | public function forget($key) 93 | { 94 | $this->memcache->delete($this->key.$key); 95 | } 96 | 97 | } -------------------------------------------------------------------------------- /laravel/cli/tasks/migrate/database.php: -------------------------------------------------------------------------------- 1 | table()->insert(compact('bundle', 'name', 'batch')); 19 | } 20 | 21 | /** 22 | * Delete a row from the migration table. 23 | * 24 | * @param string $bundle 25 | * @param string $name 26 | * @return void 27 | */ 28 | public function delete($bundle, $name) 29 | { 30 | $this->table()->where_bundle_and_name($bundle, $name)->delete(); 31 | } 32 | 33 | /** 34 | * Return an array of the last batch of migrations. 35 | * 36 | * @return array 37 | */ 38 | public function last() 39 | { 40 | $table = $this->table(); 41 | 42 | // First we need to grab the last batch ID from the migration table, 43 | // as this will allow us to grab the lastest batch of migrations 44 | // that need to be run for a rollback command. 45 | $id = $this->batch(); 46 | 47 | // Once we have the batch ID, we will pull all of the rows for that 48 | // batch. Then we can feed the results into the resolve method to 49 | // get the migration instances for the command. 50 | return $table->where_batch($id)->order_by('name', 'desc')->get(); 51 | } 52 | 53 | /** 54 | * Get all of the migrations that have run for a bundle. 55 | * 56 | * @param string $bundle 57 | * @return array 58 | */ 59 | public function ran($bundle) 60 | { 61 | return $this->table()->where_bundle($bundle)->lists('name'); 62 | } 63 | 64 | /** 65 | * Get the maximum batch ID from the migration table. 66 | * 67 | * @return int 68 | */ 69 | public function batch() 70 | { 71 | return $this->table()->max('batch'); 72 | } 73 | 74 | /** 75 | * Get a database query instance for the migration table. 76 | * 77 | * @return Laravel\Database\Query 78 | */ 79 | protected function table() 80 | { 81 | return DB::connection(Request::server('cli.db'))->table('laravel_migrations'); 82 | } 83 | 84 | } -------------------------------------------------------------------------------- /laravel/fluent.php: -------------------------------------------------------------------------------- 1 | 16 | * Create a new fluent container with attributes 17 | * $fluent = new Fluent(array('name' => 'Taylor')); 18 | * 19 | * 20 | * @param array $attributes 21 | * @return void 22 | */ 23 | public function __construct($attributes = array()) 24 | { 25 | foreach ($attributes as $key => $value) 26 | { 27 | $this->$key = $value; 28 | } 29 | } 30 | 31 | /** 32 | * Get an attribute from the fluent container. 33 | * 34 | * @param string $attribute 35 | * @param mixed $default 36 | * @return mixed 37 | */ 38 | public function get($attribute, $default = null) 39 | { 40 | return array_get($this->attributes, $attribute, $default); 41 | } 42 | 43 | /** 44 | * Handle dynamic calls to the container to set attributes. 45 | * 46 | * 47 | * // Fluently set the value of a few attributes 48 | * $fluent->name('Taylor')->age(25); 49 | * 50 | * // Set the value of an attribute to true (boolean) 51 | * $fluent->nullable()->name('Taylor'); 52 | * 53 | */ 54 | public function __call($method, $parameters) 55 | { 56 | $this->$method = (count($parameters) > 0) ? $parameters[0] : true; 57 | 58 | return $this; 59 | } 60 | 61 | /** 62 | * Dynamically retrieve the value of an attribute. 63 | */ 64 | public function __get($key) 65 | { 66 | if (array_key_exists($key, $this->attributes)) 67 | { 68 | return $this->attributes[$key]; 69 | } 70 | } 71 | 72 | /** 73 | * Dynamically set the value of an attribute. 74 | */ 75 | public function __set($key, $value) 76 | { 77 | $this->attributes[$key] = $value; 78 | } 79 | 80 | /** 81 | * Dynamically check if an attribute is set. 82 | */ 83 | public function __isset($key) 84 | { 85 | return isset($this->attributes[$key]); 86 | } 87 | 88 | /** 89 | * Dynamically unset an attribute. 90 | */ 91 | public function __unset($key) 92 | { 93 | unset($this->attributes[$key]); 94 | } 95 | 96 | } -------------------------------------------------------------------------------- /laravel/cli/tasks/bundle/providers/provider.php: -------------------------------------------------------------------------------- 1 | download($url)); 34 | 35 | $zip = new \ZipArchive; 36 | 37 | $zip->open($target); 38 | 39 | // Once we have the Zip archive, we can open it and extract it 40 | // into the working directory. By convention, we expect the 41 | // archive to contain one root directory with the bundle. 42 | mkdir($work.'zip'); 43 | 44 | $zip->extractTo($work.'zip'); 45 | 46 | $latest = File::latest($work.'zip')->getRealPath(); 47 | 48 | @chmod($latest, 0777); 49 | 50 | // Once we have the latest modified directory, we should be 51 | // able to move its contents over into the bundles folder 52 | // so the bundle will be usable by the develoepr. 53 | File::mvdir($latest, $path); 54 | 55 | File::rmdir($work.'zip'); 56 | 57 | @unlink($target); 58 | } 59 | 60 | /** 61 | * Download a remote zip archive from a URL. 62 | * 63 | * @param string $url 64 | * @return string 65 | */ 66 | protected function download($url) 67 | { 68 | $remote = file_get_contents($url); 69 | 70 | // If we were unable to download the zip archive correctly 71 | // we'll bomb out since we don't want to extract the last 72 | // zip that was put in the storage directory. 73 | if ($remote === false) 74 | { 75 | throw new \Exception("Error downloading bundle [{$bundle}]."); 76 | } 77 | 78 | return $remote; 79 | } 80 | 81 | } -------------------------------------------------------------------------------- /license.txt: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) <2012> 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | 22 | Developer’s Certificate of Origin 1.1 23 | 24 | By making a contribution to this project, I certify that: 25 | 26 | (a) The contribution was created in whole or in part by me and I 27 | have the right to submit it under the open source license 28 | indicated in the file; or 29 | 30 | (b) The contribution is based upon previous work that, to the best 31 | of my knowledge, is covered under an appropriate open source 32 | license and I have the right under that license to submit that 33 | work with modifications, whether created in whole or in part 34 | by me, under the same open source license (unless I am 35 | permitted to submit under a different license), as indicated 36 | in the file; or 37 | 38 | (c) The contribution was provided directly to me by some other 39 | person who certified (a), (b) or (c) and I have not modified 40 | it. 41 | 42 | (d) I understand and agree that this project and the contribution 43 | are public and that a record of the contribution (including all 44 | personal information I submit with it, including my sign-off) is 45 | maintained indefinitely and may be redistributed consistent with 46 | this project or the open source license(s) involved. -------------------------------------------------------------------------------- /laravel/cache/drivers/file.php: -------------------------------------------------------------------------------- 1 | path = $path; 21 | } 22 | 23 | /** 24 | * Determine if an item exists in the cache. 25 | * 26 | * @param string $key 27 | * @return bool 28 | */ 29 | public function has($key) 30 | { 31 | return ( ! is_null($this->get($key))); 32 | } 33 | 34 | /** 35 | * Retrieve an item from the cache driver. 36 | * 37 | * @param string $key 38 | * @return mixed 39 | */ 40 | protected function retrieve($key) 41 | { 42 | if ( ! file_exists($this->path.$key)) return null; 43 | 44 | // File based caches store have the expiration timestamp stored in 45 | // UNIX format prepended to their contents. This timestamp is then 46 | // extracted and removed when the cache is read to determine if 47 | // the file is still valid. 48 | if (time() >= substr($cache = file_get_contents($this->path.$key), 0, 10)) 49 | { 50 | return $this->forget($key); 51 | } 52 | 53 | return unserialize(substr($cache, 10)); 54 | } 55 | 56 | /** 57 | * Write an item to the cache for a given number of minutes. 58 | * 59 | * 60 | * // Put an item in the cache for 15 minutes 61 | * Cache::put('name', 'Taylor', 15); 62 | * 63 | * 64 | * @param string $key 65 | * @param mixed $value 66 | * @param int $minutes 67 | * @return void 68 | */ 69 | public function put($key, $value, $minutes) 70 | { 71 | $value = $this->expiration($minutes).serialize($value); 72 | 73 | file_put_contents($this->path.$key, $value, LOCK_EX); 74 | } 75 | 76 | /** 77 | * Write an item to the cache for five years. 78 | * 79 | * @param string $key 80 | * @param mixed $value 81 | * @return void 82 | */ 83 | public function forever($key, $value) 84 | { 85 | return $this->put($key, $value, 2628000); 86 | } 87 | 88 | /** 89 | * Delete an item from the cache. 90 | * 91 | * @param string $key 92 | * @return void 93 | */ 94 | public function forget($key) 95 | { 96 | if (file_exists($this->path.$key)) @unlink($this->path.$key); 97 | } 98 | 99 | } -------------------------------------------------------------------------------- /laravel/cache.php: -------------------------------------------------------------------------------- 1 | 18 | * // Get the default cache driver instance 19 | * $driver = Cache::driver(); 20 | * 21 | * // Get a specific cache driver instance by name 22 | * $driver = Cache::driver('memcached'); 23 | * 24 | * 25 | * @param string $driver 26 | * @return Cache\Drivers\Driver 27 | */ 28 | public static function driver($driver = null) 29 | { 30 | if (is_null($driver)) $driver = Config::get('cache.driver'); 31 | 32 | if ( ! isset(static::$drivers[$driver])) 33 | { 34 | static::$drivers[$driver] = static::factory($driver); 35 | } 36 | 37 | return static::$drivers[$driver]; 38 | } 39 | 40 | /** 41 | * Create a new cache driver instance. 42 | * 43 | * @param string $driver 44 | * @return Cache\Drivers\Driver 45 | */ 46 | protected static function factory($driver) 47 | { 48 | switch ($driver) 49 | { 50 | case 'apc': 51 | return new Cache\Drivers\APC(Config::get('cache.key')); 52 | 53 | case 'file': 54 | return new Cache\Drivers\File(path('storage').'cache'.DS); 55 | 56 | case 'memcached': 57 | return new Cache\Drivers\Memcached(Memcached::connection(), Config::get('cache.key')); 58 | 59 | case 'memory': 60 | return new Cache\Drivers\Memory; 61 | 62 | case 'redis': 63 | return new Cache\Drivers\Redis(Redis::db()); 64 | 65 | case 'database': 66 | return new Cache\Drivers\Database(Config::get('cache.key')); 67 | 68 | default: 69 | throw new \Exception("Cache driver {$driver} is not supported."); 70 | } 71 | } 72 | 73 | /** 74 | * Magic Method for calling the methods on the default cache driver. 75 | * 76 | * 77 | * // Call the "get" method on the default cache driver 78 | * $name = Cache::get('name'); 79 | * 80 | * // Call the "put" method on the default cache driver 81 | * Cache::put('name', 'Taylor', 15); 82 | * 83 | */ 84 | public static function __callStatic($method, $parameters) 85 | { 86 | return call_user_func_array(array(static::driver(), $method), $parameters); 87 | } 88 | 89 | } 90 | -------------------------------------------------------------------------------- /application/config/error.php: -------------------------------------------------------------------------------- 1 | array(), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Error Detail 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Detailed error messages contain information about the file in which an 24 | | error occurs, as well as a PHP stack trace containing the call stack. 25 | | You'll want them when you're trying to debug your application. 26 | | 27 | | If your application is in production, you'll want to turn off the error 28 | | details for enhanced security and user experience since the exception 29 | | stack trace could contain sensitive information. 30 | | 31 | */ 32 | 33 | 'detail' => true, 34 | 35 | /* 36 | |-------------------------------------------------------------------------- 37 | | Error Logging 38 | |-------------------------------------------------------------------------- 39 | | 40 | | When error logging is enabled, the "logger" Closure defined below will 41 | | be called for every error in your application. You are free to log the 42 | | errors however you want. Enjoy the flexibility. 43 | | 44 | */ 45 | 46 | 'log' => false, 47 | 48 | /* 49 | |-------------------------------------------------------------------------- 50 | | Error Logger 51 | |-------------------------------------------------------------------------- 52 | | 53 | | Because of the various ways of managing error logging, you get complete 54 | | flexibility to manage error logging as you see fit. This function will 55 | | be called anytime an error occurs within your application and error 56 | | logging is enabled. 57 | | 58 | | You may log the error message however you like; however, a simple log 59 | | solution has been setup for you which will log all error messages to 60 | | text files within the application storage directory. 61 | | 62 | */ 63 | 64 | 'logger' => function($exception) 65 | { 66 | Log::exception($exception); 67 | }, 68 | 69 | ); -------------------------------------------------------------------------------- /application/views/error/500.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Error 500 - Internal Server Error 7 | 8 | 81 | 82 | 83 |
    84 | 85 | 86 |

    87 | 88 |

    Server Error: 500 (Internal Server Error)

    89 | 90 |

    What does this mean?

    91 | 92 |

    93 | Something went wrong on our servers while we were processing your request. 94 | We're really sorry about this, and will work hard to get this resolved as 95 | soon as possible. 96 |

    97 | 98 |

    99 | Perhaps you would like to go to our ? 100 |

    101 |
    102 | 103 | -------------------------------------------------------------------------------- /application/views/error/404.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Error 404 - Not Found 7 | 8 | 81 | 82 | 83 |
    84 | 85 | 86 |

    87 | 88 |

    Server Error: 404 (Not Found)

    89 | 90 |

    What does this mean?

    91 | 92 |

    93 | We couldn't find the page you requested on our servers. We're really sorry 94 | about that. It's our fault, not yours. We'll work hard to get this page 95 | back online as soon as possible. 96 |

    97 | 98 |

    99 | Perhaps you would like to go to our ? 100 |

    101 |
    102 | 103 | -------------------------------------------------------------------------------- /laravel/log.php: -------------------------------------------------------------------------------- 1 | getMessage().' in '.$e->getFile().' on line '.$e->getLine(); 25 | } 26 | 27 | /** 28 | * Write a message to the log file. 29 | * 30 | * 31 | * // Write an "error" messge to the log file 32 | * Log::write('error', 'Something went horribly wrong!'); 33 | * 34 | * // Write an "error" message using the class' magic method 35 | * Log::error('Something went horribly wrong!'); 36 | * 37 | * 38 | * @param string $type 39 | * @param string $message 40 | * @return void 41 | */ 42 | public static function write($type, $message) 43 | { 44 | // If there is a listener for the log event, we'll delegate the logging 45 | // to the event and not write to the log files. This allows for quick 46 | // swapping of log implementations for debugging. 47 | if (Event::listeners('laravel.log')) 48 | { 49 | Event::fire('laravel.log', array($type, $message)); 50 | } 51 | 52 | // If there aren't listeners on the log event, we'll just write to the 53 | // log files using the default conventions, writing one log file per 54 | // day so they files don't get too crowded. 55 | else 56 | { 57 | $message = static::format($type, $message); 58 | 59 | File::append(path('storage').'logs/'.date('Y-m-d').'.log', $message); 60 | } 61 | } 62 | 63 | /** 64 | * Format a log message for logging. 65 | * 66 | * @param string $type 67 | * @param 68 | */ 69 | protected static function format($type, $message) 70 | { 71 | return date('Y-m-d H:i:s').' '.Str::upper($type)." - {$message}".PHP_EOL; 72 | } 73 | 74 | /** 75 | * Dynamically write a log message. 76 | * 77 | * 78 | * // Write an "error" message to the log file 79 | * Log::error('This is an error!'); 80 | * 81 | * // Write a "warning" message to the log file 82 | * Log::warning('This is a warning!'); 83 | * 84 | */ 85 | public static function __callStatic($method, $parameters) 86 | { 87 | static::write($method, $parameters[0]); 88 | } 89 | 90 | } -------------------------------------------------------------------------------- /application/config/cache.php: -------------------------------------------------------------------------------- 1 | 'file', 23 | 24 | /* 25 | |-------------------------------------------------------------------------- 26 | | Cache Key 27 | |-------------------------------------------------------------------------- 28 | | 29 | | This key will be prepended to item keys stored using Memcached and APC 30 | | to prevent collisions with other applications on the server. Since the 31 | | memory based stores could be shared by other applications, we need to 32 | | be polite and use a prefix to uniquely identifier our items. 33 | | 34 | */ 35 | 36 | 'key' => 'laravel', 37 | 38 | /* 39 | |-------------------------------------------------------------------------- 40 | | Cache Database 41 | |-------------------------------------------------------------------------- 42 | | 43 | | When using the database cache driver, this database table will be used 44 | | to store the cached item. You may also add a "connection" option to 45 | | the array to specify which database connection should be used. 46 | | 47 | */ 48 | 49 | 'database' => array('table' => 'laravel_cache'), 50 | 51 | /* 52 | |-------------------------------------------------------------------------- 53 | | Memcached Servers 54 | |-------------------------------------------------------------------------- 55 | | 56 | | The Memcached servers used by your application. Memcached is a free and 57 | | open source, high-performance, distributed memory caching system. It is 58 | | generic in nature but intended for use in speeding up web applications 59 | | by alleviating database load. 60 | | 61 | | For more information, check out: http://memcached.org 62 | | 63 | */ 64 | 65 | 'memcached' => array( 66 | 67 | array('host' => '127.0.0.1', 'port' => 11211, 'weight' => 100), 68 | 69 | ), 70 | 71 | ); -------------------------------------------------------------------------------- /laravel/session/drivers/database.php: -------------------------------------------------------------------------------- 1 | connection = $connection; 24 | } 25 | 26 | /** 27 | * Load a session from storage by a given ID. 28 | * 29 | * If no session is found for the ID, null will be returned. 30 | * 31 | * @param string $id 32 | * @return array 33 | */ 34 | public function load($id) 35 | { 36 | $session = $this->table()->find($id); 37 | 38 | if ( ! is_null($session)) 39 | { 40 | return array( 41 | 'id' => $session->id, 42 | 'last_activity' => $session->last_activity, 43 | 'data' => unserialize($session->data) 44 | ); 45 | } 46 | } 47 | 48 | /** 49 | * Save a given session to storage. 50 | * 51 | * @param array $session 52 | * @param array $config 53 | * @param bool $exists 54 | * @return void 55 | */ 56 | public function save($session, $config, $exists) 57 | { 58 | if ($exists) 59 | { 60 | $this->table()->where('id', '=', $session['id'])->update(array( 61 | 'last_activity' => $session['last_activity'], 62 | 'data' => serialize($session['data']), 63 | )); 64 | } 65 | else 66 | { 67 | $this->table()->insert(array( 68 | 'id' => $session['id'], 69 | 'last_activity' => $session['last_activity'], 70 | 'data' => serialize($session['data']) 71 | )); 72 | } 73 | } 74 | 75 | /** 76 | * Delete a session from storage by a given ID. 77 | * 78 | * @param string $id 79 | * @return void 80 | */ 81 | public function delete($id) 82 | { 83 | $this->table()->delete($id); 84 | } 85 | 86 | /** 87 | * Delete all expired sessions from persistant storage. 88 | * 89 | * @param int $expiration 90 | * @return void 91 | */ 92 | public function sweep($expiration) 93 | { 94 | $this->table()->where('last_activity', '<', $expiration)->delete(); 95 | } 96 | 97 | /** 98 | * Get a session database query. 99 | * 100 | * @return Query 101 | */ 102 | private function table() 103 | { 104 | return $this->connection->table(Config::get('session.table')); 105 | } 106 | 107 | } -------------------------------------------------------------------------------- /vendor/Symfony/Component/Console/Command/HelpCommand.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Console\Command; 13 | 14 | use Symfony\Component\Console\Input\InputArgument; 15 | use Symfony\Component\Console\Input\InputOption; 16 | use Symfony\Component\Console\Input\InputInterface; 17 | use Symfony\Component\Console\Output\OutputInterface; 18 | use Symfony\Component\Console\Output\Output; 19 | use Symfony\Component\Console\Command\Command; 20 | 21 | /** 22 | * HelpCommand displays the help for a given command. 23 | * 24 | * @author Fabien Potencier 25 | */ 26 | class HelpCommand extends Command 27 | { 28 | private $command; 29 | 30 | /** 31 | * {@inheritdoc} 32 | */ 33 | protected function configure() 34 | { 35 | $this->ignoreValidationErrors(); 36 | 37 | $this 38 | ->setName('help') 39 | ->setDefinition(array( 40 | new InputArgument('command_name', InputArgument::OPTIONAL, 'The command name', 'help'), 41 | new InputOption('xml', null, InputOption::VALUE_NONE, 'To output help as XML'), 42 | )) 43 | ->setDescription('Displays help for a command') 44 | ->setHelp(<<%command.name% command displays help for a given command: 46 | 47 | php %command.full_name% list 48 | 49 | You can also output the help as XML by using the --xml option: 50 | 51 | php %command.full_name% --xml list 52 | EOF 53 | ) 54 | ; 55 | } 56 | 57 | /** 58 | * Sets the command 59 | * 60 | * @param Command $command The command to set 61 | */ 62 | public function setCommand(Command $command) 63 | { 64 | $this->command = $command; 65 | } 66 | 67 | /** 68 | * {@inheritdoc} 69 | */ 70 | protected function execute(InputInterface $input, OutputInterface $output) 71 | { 72 | if (null === $this->command) { 73 | $this->command = $this->getApplication()->get($input->getArgument('command_name')); 74 | } 75 | 76 | if ($input->getOption('xml')) { 77 | $output->writeln($this->command->asXml(), OutputInterface::OUTPUT_RAW); 78 | } else { 79 | $output->writeln($this->command->asText()); 80 | } 81 | 82 | $this->command = null; 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /laravel/cache/drivers/driver.php: -------------------------------------------------------------------------------- 1 | 17 | * // Get an item from the cache driver 18 | * $name = Cache::driver('name'); 19 | * 20 | * // Return a default value if the requested item isn't cached 21 | * $name = Cache::get('name', 'Taylor'); 22 | * 23 | * 24 | * @param string $key 25 | * @param mixed $default 26 | * @return mixed 27 | */ 28 | public function get($key, $default = null) 29 | { 30 | return ( ! is_null($item = $this->retrieve($key))) ? $item : value($default); 31 | } 32 | 33 | /** 34 | * Retrieve an item from the cache driver. 35 | * 36 | * @param string $key 37 | * @return mixed 38 | */ 39 | abstract protected function retrieve($key); 40 | 41 | /** 42 | * Write an item to the cache for a given number of minutes. 43 | * 44 | * 45 | * // Put an item in the cache for 15 minutes 46 | * Cache::put('name', 'Taylor', 15); 47 | * 48 | * 49 | * @param string $key 50 | * @param mixed $value 51 | * @param int $minutes 52 | * @return void 53 | */ 54 | abstract public function put($key, $value, $minutes); 55 | 56 | /** 57 | * Get an item from the cache, or cache and return the default value. 58 | * 59 | * 60 | * // Get an item from the cache, or cache a value for 15 minutes 61 | * $name = Cache::remember('name', 'Taylor', 15); 62 | * 63 | * // Use a closure for deferred execution 64 | * $count = Cache::remember('count', function() { return User::count(); }, 15); 65 | * 66 | * 67 | * @param string $key 68 | * @param mixed $default 69 | * @param int $minutes 70 | * @return mixed 71 | */ 72 | public function remember($key, $default, $minutes) 73 | { 74 | if ( ! is_null($item = $this->get($key, null))) return $item; 75 | 76 | $this->put($key, $default = value($default), $minutes); 77 | 78 | return $default; 79 | } 80 | 81 | /** 82 | * Delete an item from the cache. 83 | * 84 | * @param string $key 85 | * @return void 86 | */ 87 | abstract public function forget($key); 88 | 89 | /** 90 | * Get the expiration time as a UNIX timestamp. 91 | * 92 | * @param int $minutes 93 | * @return int 94 | */ 95 | protected function expiration($minutes) 96 | { 97 | return time() + ($minutes * 60); 98 | } 99 | 100 | } 101 | -------------------------------------------------------------------------------- /vendor/Symfony/Component/Console/Output/ConsoleOutput.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Console\Output; 13 | 14 | use Symfony\Component\Console\Formatter\OutputFormatter; 15 | use Symfony\Component\Console\Formatter\OutputFormatterInterface; 16 | use Symfony\Component\Console\Output\ConsoleOutputInterface; 17 | 18 | /** 19 | * ConsoleOutput is the default class for all CLI output. It uses STDOUT. 20 | * 21 | * This class is a convenient wrapper around `StreamOutput`. 22 | * 23 | * $output = new ConsoleOutput(); 24 | * 25 | * This is equivalent to: 26 | * 27 | * $output = new StreamOutput(fopen('php://stdout', 'w')); 28 | * 29 | * @author Fabien Potencier 30 | * 31 | * @api 32 | */ 33 | class ConsoleOutput extends StreamOutput implements ConsoleOutputInterface 34 | { 35 | private $stderr; 36 | 37 | /** 38 | * Constructor. 39 | * 40 | * @param integer $verbosity The verbosity level (self::VERBOSITY_QUIET, self::VERBOSITY_NORMAL, 41 | * self::VERBOSITY_VERBOSE) 42 | * @param Boolean $decorated Whether to decorate messages or not (null for auto-guessing) 43 | * @param OutputFormatter $formatter Output formatter instance 44 | * 45 | * @api 46 | */ 47 | public function __construct($verbosity = self::VERBOSITY_NORMAL, $decorated = null, OutputFormatterInterface $formatter = null) 48 | { 49 | parent::__construct(fopen('php://stdout', 'w'), $verbosity, $decorated, $formatter); 50 | $this->stderr = new StreamOutput(fopen('php://stderr', 'w'), $verbosity, $decorated, $formatter); 51 | } 52 | 53 | public function setDecorated($decorated) 54 | { 55 | parent::setDecorated($decorated); 56 | $this->stderr->setDecorated($decorated); 57 | } 58 | 59 | public function setFormatter(OutputFormatterInterface $formatter) 60 | { 61 | parent::setFormatter($formatter); 62 | $this->stderr->setFormatter($formatter); 63 | } 64 | 65 | public function setVerbosity($level) 66 | { 67 | parent::setVerbosity($level); 68 | $this->stderr->setVerbosity($level); 69 | } 70 | 71 | /** 72 | * @return OutputInterface 73 | */ 74 | public function getErrorOutput() 75 | { 76 | return $this->stderr; 77 | } 78 | 79 | public function setErrorOutput(OutputInterface $error) 80 | { 81 | $this->stderr = $error; 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /laravel/cli/tasks/session/manager.php: -------------------------------------------------------------------------------- 1 | generate(); 28 | 29 | // To create the session table, we will actually create a database 30 | // migration and then run it. This allows the application to stay 31 | // portable through the framework's migrations system. 32 | $migration = $migrator->make(array('create_session_table')); 33 | 34 | $stub = path('sys').'cli/tasks/session/migration'.EXT; 35 | 36 | File::put($migration, File::get($stub)); 37 | 38 | // By default no session driver is set within the configuration. 39 | // Since the developer is requesting that the session table be 40 | // created on the database, we'll set it. 41 | $this->driver('database'); 42 | 43 | echo PHP_EOL; 44 | 45 | $migrator->run(); 46 | } 47 | 48 | /** 49 | * Sweep the expired sessions from storage. 50 | * 51 | * @param array $arguments 52 | * @return void 53 | */ 54 | public function sweep($arguments = array()) 55 | { 56 | $driver = Session::factory(Config::get('session.driver')); 57 | 58 | // If the driver implements the "Sweeper" interface, we know that it 59 | // can sweep expired sessions from storage. Not all drivers need be 60 | // sweepers since they do their own. 61 | if ($driver instanceof Sweeper) 62 | { 63 | $lifetime = Config::get('session.lifetime'); 64 | 65 | $driver->sweep(time() - ($lifetime * 60)); 66 | } 67 | 68 | echo "The session table has been swept!"; 69 | } 70 | 71 | /** 72 | * Set the session driver to a given value. 73 | * 74 | * @param string $driver 75 | * @return void 76 | */ 77 | protected function driver($driver) 78 | { 79 | // By default no session driver is set within the configuration. 80 | // This method will replace the empty driver option with the 81 | // driver specified in the arguments. 82 | $config = File::get(path('app').'config/session'.EXT); 83 | 84 | $config = str_replace( 85 | "'driver' => '',", 86 | "'driver' => 'database',", 87 | $config 88 | ); 89 | 90 | File::put(path('app').'config/session'.EXT, $config); 91 | } 92 | 93 | } -------------------------------------------------------------------------------- /laravel/database/eloquent/relationships/belongs_to.php: -------------------------------------------------------------------------------- 1 | get_dirty() : $attributes; 24 | 25 | return $this->model->update($this->foreign_value(), $attributes); 26 | } 27 | 28 | /** 29 | * Set the proper constraints on the relationship table. 30 | * 31 | * @return void 32 | */ 33 | protected function constrain() 34 | { 35 | $this->table->where($this->base->key(), '=', $this->foreign_value()); 36 | } 37 | 38 | /** 39 | * Initialize a relationship on an array of parent models. 40 | * 41 | * @param array $parents 42 | * @param string $relationship 43 | * @return void 44 | */ 45 | public function initialize(&$parents, $relationship) 46 | { 47 | foreach ($parents as &$parent) 48 | { 49 | $parent->relationships[$relationship] = null; 50 | } 51 | } 52 | 53 | /** 54 | * Set the proper constraints on the relationship table for an eager load. 55 | * 56 | * @param array $results 57 | * @return void 58 | */ 59 | public function eagerly_constrain($results) 60 | { 61 | $keys = array(); 62 | 63 | // Inverse one-to-many relationships require us to gather the keys from the 64 | // parent models and use those keys when setting the constraint since we 65 | // are looking for the parent of a child model in this relationship. 66 | foreach ($results as $result) 67 | { 68 | $keys[] = $result->{$this->foreign_key()}; 69 | } 70 | 71 | $this->table->where_in($this->model->key(), array_unique($keys)); 72 | } 73 | 74 | /** 75 | * Match eagerly loaded child models to their parent models. 76 | * 77 | * @param array $children 78 | * @param array $parents 79 | * @return void 80 | */ 81 | public function match($relationship, &$children, $parents) 82 | { 83 | $foreign = $this->foreign_key(); 84 | 85 | foreach ($children as &$child) 86 | { 87 | if (array_key_exists($child->$foreign, $parents)) 88 | { 89 | $child->relationships[$relationship] = $parents[$child->$foreign]; 90 | } 91 | } 92 | } 93 | 94 | /** 95 | * Get the value of the foreign key from the base model. 96 | * 97 | * @return mixed 98 | */ 99 | public function foreign_value() 100 | { 101 | return $this->base->get_attribute($this->foreign); 102 | } 103 | 104 | } -------------------------------------------------------------------------------- /application/config/auth.php: -------------------------------------------------------------------------------- 1 | function($id) 22 | { 23 | if (filter_var($id, FILTER_VALIDATE_INT) !== false) 24 | { 25 | return DB::table('users')->find($id); 26 | } 27 | }, 28 | 29 | /* 30 | |-------------------------------------------------------------------------- 31 | | Authenticate User Credentials 32 | |-------------------------------------------------------------------------- 33 | | 34 | | This closure is called by the Auth::attempt() method when attempting to 35 | | authenticate a user that is logging into your application. It's like a 36 | | super buff bouncer to your application. 37 | | 38 | | If the provided credentials are correct, simply return an object that 39 | | represents the user being authenticated. As long as it has a property 40 | | for the "id", any object will work. If the credentials are not valid, 41 | | you don't meed to return anything. 42 | | 43 | */ 44 | 45 | 'attempt' => function($username, $password) 46 | { 47 | $user = DB::table('users')->where_username($username)->first(); 48 | 49 | if ( ! is_null($user) and Hash::check($password, $user->password)) 50 | { 51 | return $user; 52 | } 53 | }, 54 | 55 | /* 56 | |-------------------------------------------------------------------------- 57 | | Logout The Current User 58 | |-------------------------------------------------------------------------- 59 | | 60 | | Here you may do anything that needs to be done when a user logs out of 61 | | your application, such as call the logout method on a third-party API 62 | | you are using for authentication or anything else you desire. 63 | | 64 | */ 65 | 66 | 'logout' => function($user) {}, 67 | 68 | /* 69 | |-------------------------------------------------------------------------- 70 | | "Remember Me" Cookie Name 71 | |-------------------------------------------------------------------------- 72 | | 73 | | Here you may specify the cookie name that will be used for the cookie 74 | | that serves as the "remember me" token. Of course, a sensible default 75 | | has been set for you, so you probably don't need to change it. 76 | | 77 | */ 78 | 79 | 'cookie' => 'laravel_remember', 80 | 81 | ); -------------------------------------------------------------------------------- /laravel/section.php: -------------------------------------------------------------------------------- 1 | 23 | * // Start injecting into the "header" section 24 | * Section::start('header'); 25 | * 26 | * // Inject a raw string into the "header" section without buffering 27 | * Section::start('header', 'Laravel'); 28 | * 29 | * 30 | * @param string $section 31 | * @param string|Closure $content 32 | * @return void 33 | */ 34 | public static function start($section, $content = '') 35 | { 36 | if ($content === '') 37 | { 38 | ob_start() and static::$last[] = $section; 39 | } 40 | else 41 | { 42 | static::append($section, $content); 43 | } 44 | } 45 | 46 | /** 47 | * Inject inline content into a section. 48 | * 49 | * This is helpful for injecting simple strings such as page titles. 50 | * 51 | * 52 | * // Inject inline content into the "header" section 53 | * Section::inject('header', 'Laravel'); 54 | * 55 | * 56 | * @param string $section 57 | * @param string $content 58 | * @return void 59 | */ 60 | public static function inject($section, $content) 61 | { 62 | static::start($section, $content); 63 | } 64 | 65 | /** 66 | * Stop injecting content into a section and return its contents. 67 | * 68 | * @return string 69 | */ 70 | public static function yield_section() 71 | { 72 | return static::yield(static::stop()); 73 | } 74 | 75 | /** 76 | * Stop injecting content into a section. 77 | * 78 | * @return string 79 | */ 80 | public static function stop() 81 | { 82 | static::append($last = array_pop(static::$last), ob_get_clean()); 83 | 84 | return $last; 85 | } 86 | 87 | /** 88 | * Append content to a given section. 89 | * 90 | * @param string $section 91 | * @param string $content 92 | * @return void 93 | */ 94 | protected static function append($section, $content) 95 | { 96 | if (isset(static::$sections[$section])) 97 | { 98 | static::$sections[$section] = str_replace('@parent', $content, static::$sections[$section]); 99 | } 100 | else 101 | { 102 | static::$sections[$section] = $content; 103 | } 104 | } 105 | 106 | /** 107 | * Get the string contents of a section. 108 | * 109 | * @param string $section 110 | * @return string 111 | */ 112 | public static function yield($section) 113 | { 114 | return (isset(static::$sections[$section])) ? static::$sections[$section] : ''; 115 | } 116 | 117 | } -------------------------------------------------------------------------------- /vendor/Symfony/Component/Console/Command/ListCommand.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Console\Command; 13 | 14 | use Symfony\Component\Console\Input\InputArgument; 15 | use Symfony\Component\Console\Input\InputOption; 16 | use Symfony\Component\Console\Input\InputInterface; 17 | use Symfony\Component\Console\Output\OutputInterface; 18 | use Symfony\Component\Console\Output\Output; 19 | use Symfony\Component\Console\Command\Command; 20 | use Symfony\Component\Console\Input\InputDefinition; 21 | 22 | /** 23 | * ListCommand displays the list of all available commands for the application. 24 | * 25 | * @author Fabien Potencier 26 | */ 27 | class ListCommand extends Command 28 | { 29 | /** 30 | * {@inheritdoc} 31 | */ 32 | protected function configure() 33 | { 34 | $this 35 | ->setName('list') 36 | ->setDefinition($this->createDefinition()) 37 | ->setDescription('Lists commands') 38 | ->setHelp(<<%command.name% command lists all commands: 40 | 41 | php %command.full_name% 42 | 43 | You can also display the commands for a specific namespace: 44 | 45 | php %command.full_name% test 46 | 47 | You can also output the information as XML by using the --xml option: 48 | 49 | php %command.full_name% --xml 50 | 51 | It's also possible to get raw list of commands (useful for embedding command runner): 52 | 53 | php %command.full_name% --raw 54 | EOF 55 | ) 56 | ; 57 | } 58 | 59 | /** 60 | * {@inheritdoc} 61 | */ 62 | protected function getNativeDefinition() 63 | { 64 | return $this->createDefinition(); 65 | } 66 | 67 | /** 68 | * {@inheritdoc} 69 | */ 70 | protected function execute(InputInterface $input, OutputInterface $output) 71 | { 72 | if ($input->getOption('xml')) { 73 | $output->writeln($this->getApplication()->asXml($input->getArgument('namespace')), OutputInterface::OUTPUT_RAW); 74 | } else { 75 | $output->writeln($this->getApplication()->asText($input->getArgument('namespace'), $input->getOption('raw'))); 76 | } 77 | } 78 | 79 | private function createDefinition() 80 | { 81 | return new InputDefinition(array( 82 | new InputArgument('namespace', InputArgument::OPTIONAL, 'The namespace name'), 83 | new InputOption('xml', null, InputOption::VALUE_NONE, 'To output help as XML'), 84 | new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command list'), 85 | )); 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /vendor/Symfony/Component/Console/Input/StringInput.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Console\Input; 13 | 14 | /** 15 | * StringInput represents an input provided as a string. 16 | * 17 | * Usage: 18 | * 19 | * $input = new StringInput('foo --bar="foobar"'); 20 | * 21 | * @author Fabien Potencier 22 | * 23 | * @api 24 | */ 25 | class StringInput extends ArgvInput 26 | { 27 | const REGEX_STRING = '([^ ]+?)(?: |(?setTokens($this->tokenize($input)); 43 | } 44 | 45 | /** 46 | * Tokenizes a string. 47 | * 48 | * @param string $input The input to tokenize 49 | * 50 | * @throws \InvalidArgumentException When unable to parse input (should never happen) 51 | */ 52 | private function tokenize($input) 53 | { 54 | $input = preg_replace('/(\r\n|\r|\n|\t)/', ' ', $input); 55 | 56 | $tokens = array(); 57 | $length = strlen($input); 58 | $cursor = 0; 59 | while ($cursor < $length) { 60 | if (preg_match('/\s+/A', $input, $match, null, $cursor)) { 61 | } elseif (preg_match('/([^="\' ]+?)(=?)('.self::REGEX_QUOTED_STRING.'+)/A', $input, $match, null, $cursor)) { 62 | $tokens[] = $match[1].$match[2].stripcslashes(str_replace(array('"\'', '\'"', '\'\'', '""'), '', substr($match[3], 1, strlen($match[3]) - 2))); 63 | } elseif (preg_match('/'.self::REGEX_QUOTED_STRING.'/A', $input, $match, null, $cursor)) { 64 | $tokens[] = stripcslashes(substr($match[0], 1, strlen($match[0]) - 2)); 65 | } elseif (preg_match('/'.self::REGEX_STRING.'/A', $input, $match, null, $cursor)) { 66 | $tokens[] = stripcslashes($match[1]); 67 | } else { 68 | // should never happen 69 | // @codeCoverageIgnoreStart 70 | throw new \InvalidArgumentException(sprintf('Unable to parse input near "... %s ..."', substr($input, $cursor, 10))); 71 | // @codeCoverageIgnoreEnd 72 | } 73 | 74 | $cursor += strlen($match[0]); 75 | } 76 | 77 | return $tokens; 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /laravel/database/eloquent/relationships/relationship.php: -------------------------------------------------------------------------------- 1 | foreign = $foreign; 26 | 27 | // We will go ahead and set the model and associated instances on the 28 | // relationship to match the relationship targets passed in from the 29 | // model. These will allow us to gather the relationship info. 30 | if ($associated instanceof Model) 31 | { 32 | $this->model = $associated; 33 | } 34 | else 35 | { 36 | $this->model = new $associated; 37 | } 38 | 39 | // For relationships, we'll set the base model to be the model being 40 | // associated from. This model contains the value of the foreign 41 | // key needed to connect to the associated model. 42 | if ($model instanceof Model) 43 | { 44 | $this->base = $model; 45 | } 46 | else 47 | { 48 | $this->base = new $model; 49 | } 50 | 51 | // Next we'll set the fluent query builder for the relationship and 52 | // constrain the query such that it only returns the models that 53 | // are appropriate for the relationship. 54 | $this->table = $this->table(); 55 | 56 | $this->constrain(); 57 | } 58 | 59 | /** 60 | * Get the foreign key name for the given model. 61 | * 62 | * @param string $model 63 | * @param string $foreign 64 | * @return string 65 | */ 66 | public static function foreign($model, $foreign = null) 67 | { 68 | if ( ! is_null($foreign)) return $foreign; 69 | 70 | // If the model is an object we'll simply get the class of the object and 71 | // then take the basename, which is simply the object name minus the 72 | // namespace, and we'll append "_id" to the name. 73 | if (is_object($model)) 74 | { 75 | $model = class_basename($model); 76 | } 77 | 78 | return strtolower(basename($model).'_id'); 79 | } 80 | 81 | /** 82 | * Get a freshly instantiated instance of the related model class. 83 | * 84 | * @param array $attributes 85 | * @return Model 86 | */ 87 | protected function fresh_model($attributes = array()) 88 | { 89 | $class = get_class($this->model); 90 | 91 | return new $class($attributes); 92 | } 93 | 94 | /** 95 | * Get the foreign key for the relationship. 96 | * 97 | * @return string 98 | */ 99 | public function foreign_key() 100 | { 101 | return static::foreign($this->base, $this->foreign); 102 | } 103 | 104 | } -------------------------------------------------------------------------------- /vendor/Symfony/Component/Console/Helper/HelperSet.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Console\Helper; 13 | 14 | use Symfony\Component\Console\Command\Command; 15 | 16 | /** 17 | * HelperSet represents a set of helpers to be used with a command. 18 | * 19 | * @author Fabien Potencier 20 | */ 21 | class HelperSet 22 | { 23 | private $helpers; 24 | private $command; 25 | 26 | /** 27 | * Constructor. 28 | * 29 | * @param Helper[] $helpers An array of helper. 30 | */ 31 | public function __construct(array $helpers = array()) 32 | { 33 | $this->helpers = array(); 34 | foreach ($helpers as $alias => $helper) { 35 | $this->set($helper, is_int($alias) ? null : $alias); 36 | } 37 | } 38 | 39 | /** 40 | * Sets a helper. 41 | * 42 | * @param HelperInterface $helper The helper instance 43 | * @param string $alias An alias 44 | */ 45 | public function set(HelperInterface $helper, $alias = null) 46 | { 47 | $this->helpers[$helper->getName()] = $helper; 48 | if (null !== $alias) { 49 | $this->helpers[$alias] = $helper; 50 | } 51 | 52 | $helper->setHelperSet($this); 53 | } 54 | 55 | /** 56 | * Returns true if the helper if defined. 57 | * 58 | * @param string $name The helper name 59 | * 60 | * @return Boolean true if the helper is defined, false otherwise 61 | */ 62 | public function has($name) 63 | { 64 | return isset($this->helpers[$name]); 65 | } 66 | 67 | /** 68 | * Gets a helper value. 69 | * 70 | * @param string $name The helper name 71 | * 72 | * @return HelperInterface The helper instance 73 | * 74 | * @throws \InvalidArgumentException if the helper is not defined 75 | */ 76 | public function get($name) 77 | { 78 | if (!$this->has($name)) { 79 | throw new \InvalidArgumentException(sprintf('The helper "%s" is not defined.', $name)); 80 | } 81 | 82 | return $this->helpers[$name]; 83 | } 84 | 85 | /** 86 | * Sets the command associated with this helper set. 87 | * 88 | * @param Command $command A Command instance 89 | */ 90 | public function setCommand(Command $command = null) 91 | { 92 | $this->command = $command; 93 | } 94 | 95 | /** 96 | * Gets the command associated with this helper set. 97 | * 98 | * @return Command A Command instance 99 | */ 100 | public function getCommand() 101 | { 102 | return $this->command; 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /laravel/database/schema/grammars/grammar.php: -------------------------------------------------------------------------------- 1 | name; 18 | 19 | // We need to wrap both of the table names in quoted identifiers to protect 20 | // against any possible keyword collisions, both the table on which the 21 | // command is being executed and the referenced table are wrapped. 22 | $table = $this->wrap($table); 23 | 24 | $on = $this->wrap($command->on); 25 | 26 | // Next we need to columnize both the command table's columns as well as 27 | // the columns referenced by the foreign key. We'll cast the referenced 28 | // columns to an array since they aren't by the fluent command. 29 | $foreign = $this->columnize($command->columns); 30 | 31 | $referenced = $this->columnize((array) $command->references); 32 | 33 | $sql = "ALTER TABLE $table ADD CONSTRAINT $name "; 34 | 35 | $sql .= "FOREIGN KEY ($foreign) REFERENCES $on ($referenced)"; 36 | 37 | // Finally we will check for any "on delete" or "on update" options for 38 | // the foreign key. These control the behavior of the constraint when 39 | // an update or delete statement is run against the record. 40 | if ( ! is_null($command->on_delete)) 41 | { 42 | $sql .= " ON DELETE {$command->on_delete}"; 43 | } 44 | 45 | if ( ! is_null($command->on_update)) 46 | { 47 | $sql .= " ON UPDATE {$command->on_update}"; 48 | } 49 | 50 | return $sql; 51 | } 52 | 53 | /** 54 | * Drop a constraint from the table. 55 | * 56 | * @param Table $table 57 | * @param Fluent $fluent 58 | * @return string 59 | */ 60 | protected function drop_constraint(Table $table, Fluent $command) 61 | { 62 | return "ALTER TABLE ".$this->wrap($table)." DROP CONSTRAINT ".$command->name; 63 | } 64 | 65 | /** 66 | * Wrap a value in keyword identifiers. 67 | * 68 | * @param Table|string $value 69 | * @return string 70 | */ 71 | public function wrap($value) 72 | { 73 | // This method is primarily for convenience so we can just pass a 74 | // column or table instance into the wrap method without sending 75 | // in the name each time we need to wrap one of these objects. 76 | if ($value instanceof Table) 77 | { 78 | return $this->wrap_table($value->name); 79 | } 80 | elseif ($value instanceof Fluent) 81 | { 82 | $value = $value->name; 83 | } 84 | 85 | return parent::wrap($value); 86 | } 87 | 88 | /** 89 | * Get the appropriate data type definition for the column. 90 | * 91 | * @param Fluent $column 92 | * @return string 93 | */ 94 | protected function type(Fluent $column) 95 | { 96 | return $this->{'type_'.$column->type}($column); 97 | } 98 | 99 | } -------------------------------------------------------------------------------- /laravel/error.php: -------------------------------------------------------------------------------- 1 |

    Unhandled Exception

    23 |

    Message:

    24 |
    ".$exception->getMessage()."
    25 |

    Location:

    26 |
    ".$exception->getFile()." on line ".$exception->getLine()."
    27 |

    Stack Trace:

    28 |
    ".$exception->getTraceAsString()."
    "; 29 | } 30 | 31 | // If we're not using detailed error messages, we'll use the event 32 | // system to get the response that should be sent to the browser. 33 | // Using events gives the developer more freedom. 34 | else 35 | { 36 | $response = Event::first('500'); 37 | 38 | return Response::prepare($response)->send(); 39 | } 40 | 41 | exit(1); 42 | } 43 | 44 | /** 45 | * Handle a native PHP error as an ErrorException. 46 | * 47 | * @param int $code 48 | * @param string $error 49 | * @param string $file 50 | * @param int $line 51 | * @return void 52 | */ 53 | public static function native($code, $error, $file, $line) 54 | { 55 | if (error_reporting() === 0) return; 56 | 57 | // For a PHP error, we'll create an ErrorExcepetion and then feed that 58 | // exception to the exception method, which will create a simple view 59 | // of the exception details for the developer. 60 | $exception = new \ErrorException($error, $code, 0, $file, $line); 61 | 62 | if (in_array($code, Config::get('error.ignore'))) 63 | { 64 | return static::log($exception); 65 | 66 | return true; 67 | } 68 | 69 | static::exception($exception); 70 | } 71 | 72 | /** 73 | * Handle the PHP shutdown event. 74 | * 75 | * @return void 76 | */ 77 | public static function shutdown() 78 | { 79 | // If a fatal error occured that we have not handled yet, we will 80 | // create an ErrorException and feed it to the exception handler, 81 | // as it will not yet have been handled. 82 | $error = error_get_last(); 83 | 84 | if ( ! is_null($error)) 85 | { 86 | extract($error, EXTR_SKIP); 87 | 88 | static::exception(new \ErrorException($message, $type, 0, $file, $line)); 89 | } 90 | } 91 | 92 | /** 93 | * Log an exception. 94 | * 95 | * @param Exception $exception 96 | * @return void 97 | */ 98 | public static function log($exception) 99 | { 100 | if (Config::get('error.log')) 101 | { 102 | call_user_func(Config::get('error.logger'), $exception); 103 | } 104 | } 105 | 106 | } -------------------------------------------------------------------------------- /vendor/Symfony/Component/Console/Helper/FormatterHelper.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Console\Helper; 13 | 14 | /** 15 | * The Formatter class provides helpers to format messages. 16 | * 17 | * @author Fabien Potencier 18 | */ 19 | class FormatterHelper extends Helper 20 | { 21 | /** 22 | * Formats a message within a section. 23 | * 24 | * @param string $section The section name 25 | * @param string $message The message 26 | * @param string $style The style to apply to the section 27 | */ 28 | public function formatSection($section, $message, $style = 'info') 29 | { 30 | return sprintf('<%s>[%s] %s', $style, $section, $style, $message); 31 | } 32 | 33 | /** 34 | * Formats a message as a block of text. 35 | * 36 | * @param string|array $messages The message to write in the block 37 | * @param string $style The style to apply to the whole block 38 | * @param Boolean $large Whether to return a large block 39 | * 40 | * @return string The formatter message 41 | */ 42 | public function formatBlock($messages, $style, $large = false) 43 | { 44 | $messages = (array) $messages; 45 | 46 | $len = 0; 47 | $lines = array(); 48 | foreach ($messages as $message) { 49 | $lines[] = sprintf($large ? ' %s ' : ' %s ', $message); 50 | $len = max($this->strlen($message) + ($large ? 4 : 2), $len); 51 | } 52 | 53 | $messages = $large ? array(str_repeat(' ', $len)) : array(); 54 | foreach ($lines as $line) { 55 | $messages[] = $line.str_repeat(' ', $len - $this->strlen($line)); 56 | } 57 | if ($large) { 58 | $messages[] = str_repeat(' ', $len); 59 | } 60 | 61 | foreach ($messages as &$message) { 62 | $message = sprintf('<%s>%s', $style, $message, $style); 63 | } 64 | 65 | return implode("\n", $messages); 66 | } 67 | 68 | /** 69 | * Returns the length of a string, using mb_strlen if it is available. 70 | * 71 | * @param string $string The string to check its length 72 | * 73 | * @return integer The length of the string 74 | */ 75 | private function strlen($string) 76 | { 77 | if (!function_exists('mb_strlen')) { 78 | return strlen($string); 79 | } 80 | 81 | if (false === $encoding = mb_detect_encoding($string)) { 82 | return strlen($string); 83 | } 84 | 85 | return mb_strlen($string, $encoding); 86 | } 87 | 88 | /** 89 | * Returns the helper's canonical name. 90 | * 91 | * @return string The canonical name of the helper 92 | */ 93 | public function getName() 94 | { 95 | return 'formatter'; 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /vendor/Symfony/Component/Console/Output/OutputInterface.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Console\Output; 13 | 14 | use Symfony\Component\Console\Formatter\OutputFormatterInterface; 15 | 16 | /** 17 | * OutputInterface is the interface implemented by all Output classes. 18 | * 19 | * @author Fabien Potencier 20 | * 21 | * @api 22 | */ 23 | interface OutputInterface 24 | { 25 | const VERBOSITY_QUIET = 0; 26 | const VERBOSITY_NORMAL = 1; 27 | const VERBOSITY_VERBOSE = 2; 28 | 29 | const OUTPUT_NORMAL = 0; 30 | const OUTPUT_RAW = 1; 31 | const OUTPUT_PLAIN = 2; 32 | 33 | /** 34 | * Writes a message to the output. 35 | * 36 | * @param string|array $messages The message as an array of lines of a single string 37 | * @param Boolean $newline Whether to add a newline or not 38 | * @param integer $type The type of output 39 | * 40 | * @throws \InvalidArgumentException When unknown output type is given 41 | * 42 | * @api 43 | */ 44 | function write($messages, $newline = false, $type = 0); 45 | 46 | /** 47 | * Writes a message to the output and adds a newline at the end. 48 | * 49 | * @param string|array $messages The message as an array of lines of a single string 50 | * @param integer $type The type of output 51 | * 52 | * @api 53 | */ 54 | function writeln($messages, $type = 0); 55 | 56 | /** 57 | * Sets the verbosity of the output. 58 | * 59 | * @param integer $level The level of verbosity 60 | * 61 | * @api 62 | */ 63 | function setVerbosity($level); 64 | 65 | /** 66 | * Gets the current verbosity of the output. 67 | * 68 | * @return integer The current level of verbosity 69 | * 70 | * @api 71 | */ 72 | function getVerbosity(); 73 | 74 | /** 75 | * Sets the decorated flag. 76 | * 77 | * @param Boolean $decorated Whether to decorate the messages or not 78 | * 79 | * @api 80 | */ 81 | function setDecorated($decorated); 82 | 83 | /** 84 | * Gets the decorated flag. 85 | * 86 | * @return Boolean true if the output will decorate messages, false otherwise 87 | * 88 | * @api 89 | */ 90 | function isDecorated(); 91 | 92 | /** 93 | * Sets output formatter. 94 | * 95 | * @param OutputFormatterInterface $formatter 96 | * 97 | * @api 98 | */ 99 | function setFormatter(OutputFormatterInterface $formatter); 100 | 101 | /** 102 | * Returns current output formatter instance. 103 | * 104 | * @return OutputFormatterInterface 105 | * 106 | * @api 107 | */ 108 | function getFormatter(); 109 | } 110 | -------------------------------------------------------------------------------- /vendor/Symfony/Component/Console/Tester/CommandTester.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Console\Tester; 13 | 14 | use Symfony\Component\Console\Command\Command; 15 | use Symfony\Component\Console\Input\ArrayInput; 16 | use Symfony\Component\Console\Output\StreamOutput; 17 | 18 | /** 19 | * @author Fabien Potencier 20 | */ 21 | class CommandTester 22 | { 23 | private $command; 24 | private $input; 25 | private $output; 26 | 27 | /** 28 | * Constructor. 29 | * 30 | * @param Command $command A Command instance to test. 31 | */ 32 | public function __construct(Command $command) 33 | { 34 | $this->command = $command; 35 | } 36 | 37 | /** 38 | * Executes the command. 39 | * 40 | * Available options: 41 | * 42 | * * interactive: Sets the input interactive flag 43 | * * decorated: Sets the output decorated flag 44 | * * verbosity: Sets the output verbosity flag 45 | * 46 | * @param array $input An array of arguments and options 47 | * @param array $options An array of options 48 | * 49 | * @return integer The command exit code 50 | */ 51 | public function execute(array $input, array $options = array()) 52 | { 53 | $this->input = new ArrayInput($input); 54 | if (isset($options['interactive'])) { 55 | $this->input->setInteractive($options['interactive']); 56 | } 57 | 58 | $this->output = new StreamOutput(fopen('php://memory', 'w', false)); 59 | if (isset($options['decorated'])) { 60 | $this->output->setDecorated($options['decorated']); 61 | } 62 | if (isset($options['verbosity'])) { 63 | $this->output->setVerbosity($options['verbosity']); 64 | } 65 | 66 | return $this->command->run($this->input, $this->output); 67 | } 68 | 69 | /** 70 | * Gets the display returned by the last execution of the command. 71 | * 72 | * @return string The display 73 | */ 74 | public function getDisplay() 75 | { 76 | rewind($this->output->getStream()); 77 | 78 | return stream_get_contents($this->output->getStream()); 79 | } 80 | 81 | /** 82 | * Gets the input instance used by the last execution of the command. 83 | * 84 | * @return InputInterface The current input instance 85 | */ 86 | public function getInput() 87 | { 88 | return $this->input; 89 | } 90 | 91 | /** 92 | * Gets the output instance used by the last execution of the command. 93 | * 94 | * @return OutputInterface The current output instance 95 | */ 96 | public function getOutput() 97 | { 98 | return $this->output; 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /paths.php: -------------------------------------------------------------------------------- 1 | 8 | * @link http://laravel.com 9 | */ 10 | 11 | // -------------------------------------------------------------- 12 | // Initialize the web variable if it doesn't exist. 13 | // -------------------------------------------------------------- 14 | if ( ! isset($web)) $web = false; 15 | 16 | // -------------------------------------------------------------- 17 | // Define the directory separator for the environment. 18 | // -------------------------------------------------------------- 19 | if ( ! defined('DS')) 20 | { 21 | define('DS', DIRECTORY_SEPARATOR); 22 | } 23 | 24 | // -------------------------------------------------------------- 25 | // Define the path to the base directory. 26 | // -------------------------------------------------------------- 27 | $GLOBALS['laravel_paths']['base'] = __DIR__.DS; 28 | 29 | // -------------------------------------------------------------- 30 | // The path to the application directory. 31 | // -------------------------------------------------------------- 32 | $paths['app'] = 'application'; 33 | 34 | // -------------------------------------------------------------- 35 | // The path to the Laravel directory. 36 | // -------------------------------------------------------------- 37 | $paths['sys'] = 'laravel'; 38 | 39 | // -------------------------------------------------------------- 40 | // The path to the bundles directory. 41 | // -------------------------------------------------------------- 42 | $paths['bundle'] = 'bundles'; 43 | 44 | // -------------------------------------------------------------- 45 | // The path to the storage directory. 46 | // -------------------------------------------------------------- 47 | $paths['storage'] = 'storage'; 48 | 49 | // -------------------------------------------------------------- 50 | // The path to the public directory. 51 | // -------------------------------------------------------------- 52 | if ($web) 53 | { 54 | $GLOBALS['laravel_paths']['public'] = realpath('').DS; 55 | } 56 | else 57 | { 58 | $paths['public'] = 'public'; 59 | } 60 | 61 | // -------------------------------------------------------------- 62 | // Define each constant if it hasn't been defined. 63 | // -------------------------------------------------------------- 64 | foreach ($paths as $name => $path) 65 | { 66 | if ($web) $path = "../{$path}"; 67 | 68 | if ( ! isset($GLOBALS['laravel_paths'][$name])) 69 | { 70 | $GLOBALS['laravel_paths'][$name] = realpath($path).DS; 71 | } 72 | } 73 | 74 | /** 75 | * A global path helper function. 76 | * 77 | * 78 | * $storage = path('storage'); 79 | * 80 | * 81 | * @param string $path 82 | * @return string 83 | */ 84 | function path($path) 85 | { 86 | return $GLOBALS['laravel_paths'][$path]; 87 | } 88 | 89 | /** 90 | * A global path setter function. 91 | * 92 | * @param string $path 93 | * @param string $value 94 | * @return void 95 | */ 96 | function set_path($path, $value) 97 | { 98 | $GLOBALS['laravel_paths'][$path] = $value; 99 | } -------------------------------------------------------------------------------- /laravel/cache/drivers/database.php: -------------------------------------------------------------------------------- 1 | key = $key; 25 | } 26 | 27 | /** 28 | * Determine if an item exists in the cache. 29 | * 30 | * @param string $key 31 | * @return bool 32 | */ 33 | public function has($key) 34 | { 35 | return ( ! is_null($this->get($key))); 36 | } 37 | 38 | /** 39 | * Retrieve an item from the cache driver. 40 | * 41 | * @param string $key 42 | * @return mixed 43 | */ 44 | protected function retrieve($key) 45 | { 46 | $cache = $this->table()->where('key', '=', $this->key.$key)->first(); 47 | 48 | if ( ! is_null($cache)) 49 | { 50 | if (time() >= $cache->expiration) return $this->forget($key); 51 | 52 | return unserialize($cache->value); 53 | } 54 | } 55 | 56 | /** 57 | * Write an item to the cache for a given number of minutes. 58 | * 59 | * 60 | * // Put an item in the cache for 15 minutes 61 | * Cache::put('name', 'Taylor', 15); 62 | * 63 | * 64 | * @param string $key 65 | * @param mixed $value 66 | * @param int $minutes 67 | * @return void 68 | */ 69 | public function put($key, $value, $minutes) 70 | { 71 | $key = $this->key.$key; 72 | 73 | $value = serialize($value); 74 | 75 | $expiration = $this->expiration($minutes); 76 | 77 | // To update the value, we'll first attempt an insert against the 78 | // database and if we catch an exception, we'll assume that the 79 | // primary key already exists in the table and update. 80 | try 81 | { 82 | $this->table()->insert(compact('key', 'value', 'expiration')); 83 | } 84 | catch (\Exception $e) 85 | { 86 | $this->table()->where('key', '=', $key)->update(compact('value', 'expiration')); 87 | } 88 | } 89 | 90 | /** 91 | * Write an item to the cache for five years. 92 | * 93 | * @param string $key 94 | * @param mixed $value 95 | * @return void 96 | */ 97 | public function forever($key, $value) 98 | { 99 | return $this->put($key, $value, 2628000); 100 | } 101 | 102 | /** 103 | * Delete an item from the cache. 104 | * 105 | * @param string $key 106 | * @return void 107 | */ 108 | public function forget($key) 109 | { 110 | $this->table()->where('key', '=', $this->key.$key)->delete(); 111 | } 112 | 113 | /** 114 | * Get a query builder for the database table. 115 | * 116 | * @return Laravel\Database\Query 117 | */ 118 | protected function table() 119 | { 120 | $connection = DB::connection(Config::get('cache.database.connection')); 121 | 122 | return $connection->table(Config::get('cache.database.table')); 123 | } 124 | 125 | } -------------------------------------------------------------------------------- /public/css/style.css: -------------------------------------------------------------------------------- 1 | body 2 | { 3 | background-color:#222; 4 | margin:0; 5 | font-family:sans-serif; 6 | color : #fff; 7 | } 8 | 9 | /* header */ 10 | 11 | .header 12 | { 13 | z-index:999; 14 | padding:0.5em 0.6em 0.6em 0.5em; 15 | position:fixed; 16 | top:1em; 17 | right:1.4em; 18 | overflow:hidden; 19 | background-color:transparent; 20 | background-color:rgba(34,34,34,0.7); 21 | } 22 | 23 | .header:hover 24 | { 25 | background-color:#222; 26 | } 27 | 28 | .logo 29 | { 30 | opacity:0.8; 31 | float:right; 32 | margin-bottom:0.3em; 33 | } 34 | 35 | .logo:hover 36 | { 37 | opacity:1; 38 | } 39 | 40 | /* menu / buttons */ 41 | 42 | .buttons 43 | { 44 | margin:0; 45 | } 46 | 47 | .buttons li 48 | { 49 | display:inline; 50 | float:right; 51 | } 52 | 53 | .buttons li a, .buttons li a:visited 54 | { 55 | display:inline-block; 56 | background-color:#444; 57 | color:#aaa; 58 | padding:0.2em 0.5em 0.2em 0.5em; 59 | text-decoration:none; 60 | text-transform:uppercase; 61 | font-size:0.8em; 62 | font-weight:bold; 63 | } 64 | 65 | .buttons li a:hover 66 | { 67 | background-color:#EB4D09; 68 | color:#fff; 69 | text-shadow:0 1px 1px #75360C; 70 | } 71 | 72 | .buttons li:first-child a 73 | { 74 | border-radius:0 3px 3px 0; 75 | } 76 | 77 | .buttons li:last-child a 78 | { 79 | border-radius:3px 0 0 3px; 80 | border-right:1px solid #3d3d3d; 81 | } 82 | 83 | .buttons li a.save 84 | { 85 | border-radius:3px; 86 | } 87 | 88 | /* edit textarea */ 89 | 90 | textarea 91 | { 92 | background-color:transparent; 93 | border:0; 94 | outline:0; 95 | resize:none; 96 | color:#ddd; 97 | width:100%; 98 | box-sizing:border-box; 99 | padding:2.5em; 100 | font-family: Monaco, "Bitstream Vera Sans Mono", "Lucida Console", Terminal, monospace; 101 | font-size: 12px; 102 | } 103 | 104 | 105 | .prettyprint, textarea 106 | { 107 | position:fixed; 108 | top:0; 109 | left:0; 110 | width:100%; 111 | height:100%; 112 | margin:0; 113 | line-height:1.8em; 114 | } 115 | 116 | textarea 117 | { 118 | padding:3em; 119 | } 120 | 121 | /* code prettify styles */ 122 | .prettyprint 123 | { 124 | overflow:auto; 125 | white-space:pre-wrap; 126 | background-color:#222; 127 | font-size: 12px; 128 | font-family: Monaco, "Bitstream Vera Sans Mono", "Lucida Console", Terminal, monospace; 129 | } 130 | 131 | .prettyprint ol 132 | { 133 | color:#777; 134 | padding:2em 3em 2em 5em; 135 | } 136 | 137 | .prettyprint code 138 | { 139 | font-family: Monaco, "Bitstream Vera Sans Mono", "Lucida Console", Terminal, monospace !important; 140 | } 141 | 142 | .prettyprint ol li 143 | { 144 | padding:0; 145 | } 146 | 147 | .com 148 | { 149 | color: #555; 150 | } 151 | 152 | .lit 153 | { 154 | color: #17CFB6; 155 | } 156 | 157 | .pun, .opn, .clo 158 | { 159 | color: #93a1a1; 160 | } 161 | 162 | .fun 163 | { 164 | color: #dc322f; 165 | } 166 | 167 | .str, .atv 168 | { 169 | color: #E3B446; 170 | } 171 | 172 | .kwd, .linenums .tag 173 | { 174 | color: #DB613B; 175 | } 176 | 177 | .typ, .atn, .dec, .var 178 | { 179 | color: #fff; 180 | } 181 | 182 | .pln 183 | { 184 | color: #ccc; 185 | } 186 | -------------------------------------------------------------------------------- /laravel/cli/dependencies.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Console\Tester; 13 | 14 | use Symfony\Component\Console\Application; 15 | use Symfony\Component\Console\Input\ArrayInput; 16 | use Symfony\Component\Console\Input\InputInterface; 17 | use Symfony\Component\Console\Output\OutputInterface; 18 | use Symfony\Component\Console\Output\StreamOutput; 19 | 20 | /** 21 | * @author Fabien Potencier 22 | */ 23 | class ApplicationTester 24 | { 25 | private $application; 26 | private $input; 27 | private $output; 28 | 29 | /** 30 | * Constructor. 31 | * 32 | * @param Application $application An Application instance to test. 33 | */ 34 | public function __construct(Application $application) 35 | { 36 | $this->application = $application; 37 | } 38 | 39 | /** 40 | * Executes the application. 41 | * 42 | * Available options: 43 | * 44 | * * interactive: Sets the input interactive flag 45 | * * decorated: Sets the output decorated flag 46 | * * verbosity: Sets the output verbosity flag 47 | * 48 | * @param array $input An array of arguments and options 49 | * @param array $options An array of options 50 | * 51 | * @return integer The command exit code 52 | */ 53 | public function run(array $input, $options = array()) 54 | { 55 | $this->input = new ArrayInput($input); 56 | if (isset($options['interactive'])) { 57 | $this->input->setInteractive($options['interactive']); 58 | } 59 | 60 | $this->output = new StreamOutput(fopen('php://memory', 'w', false)); 61 | if (isset($options['decorated'])) { 62 | $this->output->setDecorated($options['decorated']); 63 | } 64 | if (isset($options['verbosity'])) { 65 | $this->output->setVerbosity($options['verbosity']); 66 | } 67 | 68 | return $this->application->run($this->input, $this->output); 69 | } 70 | 71 | /** 72 | * Gets the display returned by the last execution of the application. 73 | * 74 | * @return string The display 75 | */ 76 | public function getDisplay() 77 | { 78 | rewind($this->output->getStream()); 79 | 80 | return stream_get_contents($this->output->getStream()); 81 | } 82 | 83 | /** 84 | * Gets the input instance used by the last execution of the application. 85 | * 86 | * @return InputInterface The current input instance 87 | */ 88 | public function getInput() 89 | { 90 | return $this->input; 91 | } 92 | 93 | /** 94 | * Gets the output instance used by the last execution of the application. 95 | * 96 | * @return OutputInterface The current output instance 97 | */ 98 | public function getOutput() 99 | { 100 | return $this->output; 101 | } 102 | } 103 | -------------------------------------------------------------------------------- /laravel/session.php: -------------------------------------------------------------------------------- 1 | load(Cookie::get(Config::get('session.cookie'))); 29 | } 30 | 31 | /** 32 | * Create the session payload instance for the request. 33 | * 34 | * @param string $driver 35 | * @return void 36 | */ 37 | public static function start($driver) 38 | { 39 | static::$instance = new Session\Payload(static::factory($driver)); 40 | } 41 | 42 | /** 43 | * Create a new session driver instance. 44 | * 45 | * @param string $driver 46 | * @return Session\Drivers\Driver 47 | */ 48 | public static function factory($driver) 49 | { 50 | switch ($driver) 51 | { 52 | case 'apc': 53 | return new Session\Drivers\APC(Cache::driver('apc')); 54 | 55 | case 'cookie': 56 | return new Session\Drivers\Cookie; 57 | 58 | case 'database': 59 | return new Session\Drivers\Database(Database::connection()); 60 | 61 | case 'file': 62 | return new Session\Drivers\File(path('storage').'sessions'.DS); 63 | 64 | case 'memcached': 65 | return new Session\Drivers\Memcached(Cache::driver('memcached')); 66 | 67 | case 'memory': 68 | return new Session\Drivers\Memory; 69 | 70 | case 'redis': 71 | return new Session\Drivers\Redis(Cache::driver('redis')); 72 | 73 | default: 74 | throw new \Exception("Session driver [$driver] is not supported."); 75 | } 76 | } 77 | 78 | /** 79 | * Retrieve the active session payload instance for the request. 80 | * 81 | * 82 | * // Retrieve the session instance and get an item 83 | * Session::instance()->get('name'); 84 | * 85 | * // Retrieve the session instance and place an item in the session 86 | * Session::instance()->put('name', 'Taylor'); 87 | * 88 | * 89 | * @return Session\Payload 90 | */ 91 | public static function instance() 92 | { 93 | if (static::started()) return static::$instance; 94 | 95 | throw new \Exception("A driver must be set before using the session."); 96 | } 97 | 98 | /** 99 | * Determine if session handling has been started for the request. 100 | * 101 | * @return bool 102 | */ 103 | public static function started() 104 | { 105 | return ! is_null(static::$instance); 106 | } 107 | 108 | /** 109 | * Magic Method for calling the methods on the session singleton instance. 110 | * 111 | * 112 | * // Retrieve a value from the session 113 | * $value = Session::get('name'); 114 | * 115 | * // Write a value to the session storage 116 | * $value = Session::put('name', 'Taylor'); 117 | * 118 | * // Equivalent statement using the "instance" method 119 | * $value = Session::instance()->put('name', 'Taylor'); 120 | * 121 | */ 122 | public static function __callStatic($method, $parameters) 123 | { 124 | return call_user_func_array(array(static::instance(), $method), $parameters); 125 | } 126 | 127 | } -------------------------------------------------------------------------------- /laravel/cli/tasks/test/runner.php: -------------------------------------------------------------------------------- 1 | bundle($bundles); 20 | } 21 | 22 | /** 23 | * Run the tests for the Laravel framework. 24 | * 25 | * @return void 26 | */ 27 | public function core() 28 | { 29 | if ( ! is_dir(path('bundle').'laravel-tests')) 30 | { 31 | throw new \Exception("The bundle [laravel-tests] has not been installed!"); 32 | } 33 | 34 | // When testing the Laravel core, we will just stub the path directly 35 | // so the test bundle is not required to be registered in the bundle 36 | // configuration, as it is kind of a unique bundle. 37 | $this->stub(path('bundle').'laravel-tests/cases'); 38 | 39 | $path = path('bundle').'laravel-tests/'; 40 | 41 | $this->test(); 42 | } 43 | 44 | /** 45 | * Run the tests for a given bundle. 46 | * 47 | * @param array $bundles 48 | * @return void 49 | */ 50 | public function bundle($bundles = array()) 51 | { 52 | if (count($bundles) == 0) 53 | { 54 | $bundles = Bundle::names(); 55 | } 56 | 57 | foreach ($bundles as $bundle) 58 | { 59 | // To run PHPUnit for the application, bundles, and the framework 60 | // from one task, we'll dynamically stub PHPUnit.xml files via 61 | // the task and point the test suite to the correct directory 62 | // based on what was requested. 63 | if (is_dir($path = Bundle::path($bundle).'tests')) 64 | { 65 | $this->stub($path); 66 | 67 | $this->test(); 68 | } 69 | } 70 | } 71 | 72 | /** 73 | * Run PHPUnit with the temporary XML configuration. 74 | * 75 | * @return void 76 | */ 77 | protected function test() 78 | { 79 | // We'll simply fire off PHPUnit with the configuration switch 80 | // pointing to our temporary configuration file. This allows 81 | // us to flexibly run tests for any setup. 82 | $path = path('base').'phpunit.xml'; 83 | 84 | passthru('phpunit --configuration '.$path); 85 | 86 | @unlink($path); 87 | } 88 | 89 | /** 90 | * Write a stub phpunit.xml file to the base directory. 91 | * 92 | * @param string $directory 93 | * @return void 94 | */ 95 | protected function stub($directory) 96 | { 97 | $path = path('sys').'cli/tasks/test/'; 98 | 99 | $stub = File::get($path.'stub.xml'); 100 | 101 | // The PHPUnit bootstrap file contains several items that are swapped 102 | // at test time. This allows us to point PHPUnit at a few different 103 | // locations depending on what the developer wants to test. 104 | foreach (array('bootstrap', 'directory') as $item) 105 | { 106 | $stub = $this->{"swap_{$item}"}($stub, $path, $directory); 107 | } 108 | 109 | File::put(path('base').'phpunit.xml', $stub); 110 | } 111 | 112 | /** 113 | * Swap the bootstrap file in the stub. 114 | * 115 | * @param string $stub 116 | * @param string $path 117 | * @param string $directory 118 | * @return string 119 | */ 120 | protected function swap_bootstrap($stub, $path, $directory) 121 | { 122 | return str_replace('{{bootstrap}}', $path.'phpunit.php', $stub); 123 | } 124 | 125 | /** 126 | * Swap the directory in the stub. 127 | * 128 | * @param string $stub 129 | * @param string $path 130 | * @param string $directory 131 | * @return string 132 | */ 133 | protected function swap_directory($stub, $path, $directory) 134 | { 135 | return str_replace('{{directory}}', $directory, $stub); 136 | } 137 | 138 | } -------------------------------------------------------------------------------- /laravel/database.php: -------------------------------------------------------------------------------- 1 | 21 | * // Get the default database connection for the application 22 | * $connection = DB::connection(); 23 | * 24 | * // Get a specific connection by passing the connection name 25 | * $connection = DB::connection('mysql'); 26 | * 27 | * 28 | * @param string $connection 29 | * @return Database\Connection 30 | */ 31 | public static function connection($connection = null) 32 | { 33 | if (is_null($connection)) $connection = Config::get('database.default'); 34 | 35 | if ( ! isset(static::$connections[$connection])) 36 | { 37 | $config = Config::get("database.connections.{$connection}"); 38 | 39 | if (is_null($config)) 40 | { 41 | throw new \Exception("Database connection is not defined for [$connection]."); 42 | } 43 | 44 | static::$connections[$connection] = new Connection(static::connect($config), $config); 45 | } 46 | 47 | return static::$connections[$connection]; 48 | } 49 | 50 | /** 51 | * Get a PDO database connection for a given database configuration. 52 | * 53 | * @param array $config 54 | * @return PDO 55 | */ 56 | protected static function connect($config) 57 | { 58 | return static::connector($config['driver'])->connect($config); 59 | } 60 | 61 | /** 62 | * Create a new database connector instance. 63 | * 64 | * @param string $driver 65 | * @return Database\Connectors\Connector 66 | */ 67 | protected static function connector($driver) 68 | { 69 | switch ($driver) 70 | { 71 | case 'sqlite': 72 | return new Database\Connectors\SQLite; 73 | 74 | case 'mysql': 75 | return new Database\Connectors\MySQL; 76 | 77 | case 'pgsql': 78 | return new Database\Connectors\Postgres; 79 | 80 | case 'sqlsrv': 81 | return new Database\Connectors\SQLServer; 82 | 83 | default: 84 | throw new \Exception("Database driver [$driver] is not supported."); 85 | } 86 | } 87 | 88 | /** 89 | * Begin a fluent query against a table. 90 | * 91 | * @param string $table 92 | * @param string $connection 93 | * @return Database\Query 94 | */ 95 | public static function table($table, $connection = null) 96 | { 97 | return static::connection($connection)->table($table); 98 | } 99 | 100 | /** 101 | * Create a new database expression instance. 102 | * 103 | * Database expressions are used to inject raw SQL into a fluent query. 104 | * 105 | * @param string $value 106 | * @return Expression 107 | */ 108 | public static function raw($value) 109 | { 110 | return new Expression($value); 111 | } 112 | 113 | /** 114 | * Get the profiling data for all queries. 115 | * 116 | * @return array 117 | */ 118 | public static function profile() 119 | { 120 | return Database\Connection::$queries; 121 | } 122 | 123 | /** 124 | * Magic Method for calling methods on the default database connection. 125 | * 126 | * 127 | * // Get the driver name for the default database connection 128 | * $driver = DB::driver(); 129 | * 130 | * // Execute a fluent query on the default database connection 131 | * $users = DB::table('users')->get(); 132 | * 133 | */ 134 | public static function __callStatic($method, $parameters) 135 | { 136 | return call_user_func_array(array(static::connection(), $method), $parameters); 137 | } 138 | 139 | } -------------------------------------------------------------------------------- /application/config/session.php: -------------------------------------------------------------------------------- 1 | 'cookie', 20 | 21 | /* 22 | |-------------------------------------------------------------------------- 23 | | Session Database 24 | |-------------------------------------------------------------------------- 25 | | 26 | | The database table on which the session should be stored. It probably 27 | | goes without saying that this option only matters if you are using 28 | | the super slick database session driver. 29 | | 30 | */ 31 | 32 | 'table' => 'sessions', 33 | 34 | /* 35 | |-------------------------------------------------------------------------- 36 | | Session Garbage Collection Probability 37 | |-------------------------------------------------------------------------- 38 | | 39 | | Some session drivers require the manual clean-up of expired sessions. 40 | | This option specifies the probability of session garbage collection 41 | | occuring for any given request to the application. 42 | | 43 | | For example, the default value states that garbage collection has a 44 | | 2% chance of occuring for any given request to the application. 45 | | Feel free to tune this to your requirements. 46 | | 47 | */ 48 | 49 | 'sweepage' => array(2, 100), 50 | 51 | /* 52 | |-------------------------------------------------------------------------- 53 | | Session Lifetime 54 | |-------------------------------------------------------------------------- 55 | | 56 | | The number of minutes a session can be idle before expiring. 57 | | 58 | */ 59 | 60 | 'lifetime' => 60, 61 | 62 | /* 63 | |-------------------------------------------------------------------------- 64 | | Session Expiration On Close 65 | |-------------------------------------------------------------------------- 66 | | 67 | | Determines if the session should expire when the user's web browser closes. 68 | | 69 | */ 70 | 71 | 'expire_on_close' => false, 72 | 73 | /* 74 | |-------------------------------------------------------------------------- 75 | | Session Cookie Name 76 | |-------------------------------------------------------------------------- 77 | | 78 | | The name that should be given to the session cookie. 79 | | 80 | */ 81 | 82 | 'cookie' => 'laravel_session', 83 | 84 | /* 85 | |-------------------------------------------------------------------------- 86 | | Session Cookie Path 87 | |-------------------------------------------------------------------------- 88 | | 89 | | The path for which the session cookie is available. 90 | | 91 | */ 92 | 93 | 'path' => '/', 94 | 95 | /* 96 | |-------------------------------------------------------------------------- 97 | | Session Cookie Domain 98 | |-------------------------------------------------------------------------- 99 | | 100 | | The domain for which the session cookie is available. 101 | | 102 | */ 103 | 104 | 'domain' => null, 105 | 106 | /* 107 | |-------------------------------------------------------------------------- 108 | | HTTPS Only Session Cookie 109 | |-------------------------------------------------------------------------- 110 | | 111 | | Determines if the cookie should only be sent over HTTPS. 112 | | 113 | */ 114 | 115 | 'secure' => false, 116 | 117 | ); -------------------------------------------------------------------------------- /vendor/Symfony/Component/Console/Output/StreamOutput.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Console\Output; 13 | 14 | use Symfony\Component\Console\Formatter\OutputFormatterInterface; 15 | 16 | /** 17 | * StreamOutput writes the output to a given stream. 18 | * 19 | * Usage: 20 | * 21 | * $output = new StreamOutput(fopen('php://stdout', 'w')); 22 | * 23 | * As `StreamOutput` can use any stream, you can also use a file: 24 | * 25 | * $output = new StreamOutput(fopen('/path/to/output.log', 'a', false)); 26 | * 27 | * @author Fabien Potencier 28 | * 29 | * @api 30 | */ 31 | class StreamOutput extends Output 32 | { 33 | private $stream; 34 | 35 | /** 36 | * Constructor. 37 | * 38 | * @param mixed $stream A stream resource 39 | * @param integer $verbosity The verbosity level (self::VERBOSITY_QUIET, self::VERBOSITY_NORMAL, 40 | * self::VERBOSITY_VERBOSE) 41 | * @param Boolean $decorated Whether to decorate messages or not (null for auto-guessing) 42 | * @param OutputFormatter $formatter Output formatter instance 43 | * 44 | * @throws \InvalidArgumentException When first argument is not a real stream 45 | * 46 | * @api 47 | */ 48 | public function __construct($stream, $verbosity = self::VERBOSITY_NORMAL, $decorated = null, OutputFormatterInterface $formatter = null) 49 | { 50 | if (!is_resource($stream) || 'stream' !== get_resource_type($stream)) { 51 | throw new \InvalidArgumentException('The StreamOutput class needs a stream as its first argument.'); 52 | } 53 | 54 | $this->stream = $stream; 55 | 56 | if (null === $decorated) { 57 | $decorated = $this->hasColorSupport($decorated); 58 | } 59 | 60 | parent::__construct($verbosity, $decorated, $formatter); 61 | } 62 | 63 | /** 64 | * Gets the stream attached to this StreamOutput instance. 65 | * 66 | * @return resource A stream resource 67 | */ 68 | public function getStream() 69 | { 70 | return $this->stream; 71 | } 72 | 73 | /** 74 | * Writes a message to the output. 75 | * 76 | * @param string $message A message to write to the output 77 | * @param Boolean $newline Whether to add a newline or not 78 | * 79 | * @throws \RuntimeException When unable to write output (should never happen) 80 | */ 81 | public function doWrite($message, $newline) 82 | { 83 | if (false === @fwrite($this->stream, $message.($newline ? PHP_EOL : ''))) { 84 | // @codeCoverageIgnoreStart 85 | // should never happen 86 | throw new \RuntimeException('Unable to write output.'); 87 | // @codeCoverageIgnoreEnd 88 | } 89 | 90 | fflush($this->stream); 91 | } 92 | 93 | /** 94 | * Returns true if the stream supports colorization. 95 | * 96 | * Colorization is disabled if not supported by the stream: 97 | * 98 | * - windows without ansicon 99 | * - non tty consoles 100 | * 101 | * @return Boolean true if the stream supports colorization, false otherwise 102 | */ 103 | protected function hasColorSupport() 104 | { 105 | // @codeCoverageIgnoreStart 106 | if (DIRECTORY_SEPARATOR == '\\') { 107 | return false !== getenv('ANSICON'); 108 | } 109 | 110 | return function_exists('posix_isatty') && @posix_isatty($this->stream); 111 | // @codeCoverageIgnoreEnd 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /laravel/ioc.php: -------------------------------------------------------------------------------- 1 | 61 | * // Register an instance as a singleton in the container 62 | * IoC::instance('mailer', new Mailer); 63 | * 64 | * 65 | * @param string $name 66 | * @param mixed $instance 67 | * @return void 68 | */ 69 | public static function instance($name, $instance) 70 | { 71 | static::$singletons[$name] = $instance; 72 | } 73 | 74 | /** 75 | * Register a controller with the IoC container. 76 | * 77 | * @param string $name 78 | * @param Closure $resolver 79 | * @return void 80 | */ 81 | public static function controller($name, $resolver) 82 | { 83 | static::register("controller: {$name}", $resolver); 84 | } 85 | 86 | /** 87 | * Resolve a core Laravel class from the container. 88 | * 89 | * 90 | * // Resolve the "laravel.router" class from the container 91 | * $input = IoC::core('router'); 92 | * 93 | * // Equivalent resolution of the router using the "resolve" method 94 | * $input = IoC::resolve('laravel.router'); 95 | * 96 | * 97 | * @param string $name 98 | * @param array $parameters 99 | * @return mixed 100 | */ 101 | public static function core($name, $parameters = array()) 102 | { 103 | return static::resolve("laravel.{$name}", $parameters); 104 | } 105 | 106 | /** 107 | * Resolve an object instance from the container. 108 | * 109 | * 110 | * // Get an instance of the "mailer" object registered in the container 111 | * $mailer = IoC::resolve('mailer'); 112 | * 113 | * // Get an instance of the "mailer" object and pass parameters to the resolver 114 | * $mailer = IoC::resolve('mailer', array('test')); 115 | * 116 | * 117 | * @param string $name 118 | * @param array $parameters 119 | * @return mixed 120 | */ 121 | public static function resolve($name, $parameters = array()) 122 | { 123 | if (array_key_exists($name, static::$singletons)) 124 | { 125 | return static::$singletons[$name]; 126 | } 127 | 128 | $object = call_user_func(static::$registry[$name]['resolver'], $parameters); 129 | 130 | // If the resolver is registering as a singleton resolver, we will cache 131 | // the instance of the object in the container so we can resolve it next 132 | // time without having to instantiate a brand new instance. 133 | if (static::$registry[$name]['singleton']) 134 | { 135 | return static::$singletons[$name] = $object; 136 | } 137 | 138 | return $object; 139 | } 140 | 141 | } -------------------------------------------------------------------------------- /vendor/Symfony/Component/Console/Input/InputArgument.php: -------------------------------------------------------------------------------- 1 | 7 | * 8 | * For the full copyright and license information, please view the LICENSE 9 | * file that was distributed with this source code. 10 | */ 11 | 12 | namespace Symfony\Component\Console\Input; 13 | 14 | /** 15 | * Represents a command line argument. 16 | * 17 | * @author Fabien Potencier 18 | * 19 | * @api 20 | */ 21 | class InputArgument 22 | { 23 | const REQUIRED = 1; 24 | const OPTIONAL = 2; 25 | const IS_ARRAY = 4; 26 | 27 | private $name; 28 | private $mode; 29 | private $default; 30 | private $description; 31 | 32 | /** 33 | * Constructor. 34 | * 35 | * @param string $name The argument name 36 | * @param integer $mode The argument mode: self::REQUIRED or self::OPTIONAL 37 | * @param string $description A description text 38 | * @param mixed $default The default value (for self::OPTIONAL mode only) 39 | * 40 | * @throws \InvalidArgumentException When argument mode is not valid 41 | * 42 | * @api 43 | */ 44 | public function __construct($name, $mode = null, $description = '', $default = null) 45 | { 46 | if (null === $mode) { 47 | $mode = self::OPTIONAL; 48 | } elseif (!is_int($mode) || $mode > 7 || $mode < 1) { 49 | throw new \InvalidArgumentException(sprintf('Argument mode "%s" is not valid.', $mode)); 50 | } 51 | 52 | $this->name = $name; 53 | $this->mode = $mode; 54 | $this->description = $description; 55 | 56 | $this->setDefault($default); 57 | } 58 | 59 | /** 60 | * Returns the argument name. 61 | * 62 | * @return string The argument name 63 | */ 64 | public function getName() 65 | { 66 | return $this->name; 67 | } 68 | 69 | /** 70 | * Returns true if the argument is required. 71 | * 72 | * @return Boolean true if parameter mode is self::REQUIRED, false otherwise 73 | */ 74 | public function isRequired() 75 | { 76 | return self::REQUIRED === (self::REQUIRED & $this->mode); 77 | } 78 | 79 | /** 80 | * Returns true if the argument can take multiple values. 81 | * 82 | * @return Boolean true if mode is self::IS_ARRAY, false otherwise 83 | */ 84 | public function isArray() 85 | { 86 | return self::IS_ARRAY === (self::IS_ARRAY & $this->mode); 87 | } 88 | 89 | /** 90 | * Sets the default value. 91 | * 92 | * @param mixed $default The default value 93 | * 94 | * @throws \LogicException When incorrect default value is given 95 | */ 96 | public function setDefault($default = null) 97 | { 98 | if (self::REQUIRED === $this->mode && null !== $default) { 99 | throw new \LogicException('Cannot set a default value except for Parameter::OPTIONAL mode.'); 100 | } 101 | 102 | if ($this->isArray()) { 103 | if (null === $default) { 104 | $default = array(); 105 | } elseif (!is_array($default)) { 106 | throw new \LogicException('A default value for an array argument must be an array.'); 107 | } 108 | } 109 | 110 | $this->default = $default; 111 | } 112 | 113 | /** 114 | * Returns the default value. 115 | * 116 | * @return mixed The default value 117 | */ 118 | public function getDefault() 119 | { 120 | return $this->default; 121 | } 122 | 123 | /** 124 | * Returns the description text. 125 | * 126 | * @return string The description text 127 | */ 128 | public function getDescription() 129 | { 130 | return $this->description; 131 | } 132 | } 133 | -------------------------------------------------------------------------------- /application/config/database.php: -------------------------------------------------------------------------------- 1 | true, 18 | 19 | /* 20 | |-------------------------------------------------------------------------- 21 | | PDO Fetch Style 22 | |-------------------------------------------------------------------------- 23 | | 24 | | By default, database results will be returned as instances of the PHP 25 | | stdClass object; however, you may wish to retrieve records as arrays 26 | | instead of objects. Here you can control the PDO fetch style of the 27 | | database queries run by your application. 28 | | 29 | */ 30 | 31 | 'fetch' => PDO::FETCH_CLASS, 32 | 33 | /* 34 | |-------------------------------------------------------------------------- 35 | | Default Database Connection 36 | |-------------------------------------------------------------------------- 37 | | 38 | | The name of your default database connection. This connection will used 39 | | as the default for all database operations unless a different name is 40 | | given when performing said operation. This connection name should be 41 | | listed in the array of connections below. 42 | | 43 | */ 44 | 45 | 'default' => 'sqlite', 46 | 47 | /* 48 | |-------------------------------------------------------------------------- 49 | | Database Connections 50 | |-------------------------------------------------------------------------- 51 | | 52 | | All of the database connections used by your application. Many of your 53 | | applications will no doubt only use one connection; however, you have 54 | | the freedom to specify as many connections as you can handle. 55 | | 56 | | All database work in Laravel is done through the PHP's PDO facilities, 57 | | so make sure you have the PDO drivers for your particlar database of 58 | | choice installed on your machine. 59 | | 60 | */ 61 | 62 | 'connections' => array( 63 | 64 | 'sqlite' => array( 65 | 'driver' => 'sqlite', 66 | 'database' => 'application', 67 | 'prefix' => '', 68 | ), 69 | 70 | 'mysql' => array( 71 | 'driver' => 'mysql', 72 | 'host' => 'localhost', 73 | 'database' => 'paste', 74 | 'username' => 'root', 75 | 'password' => 'wimble', 76 | 'charset' => 'utf8', 77 | 'prefix' => '', 78 | ), 79 | 80 | 'pgsql' => array( 81 | 'driver' => 'pgsql', 82 | 'host' => 'localhost', 83 | 'database' => 'database', 84 | 'username' => 'root', 85 | 'password' => '', 86 | 'charset' => 'utf8', 87 | 'prefix' => '', 88 | ), 89 | 90 | 'sqlsrv' => array( 91 | 'driver' => 'sqlsrv', 92 | 'host' => 'localhost', 93 | 'database' => 'database', 94 | 'username' => 'root', 95 | 'password' => '', 96 | 'prefix' => '', 97 | ), 98 | 99 | ), 100 | 101 | /* 102 | |-------------------------------------------------------------------------- 103 | | Redis Databases 104 | |-------------------------------------------------------------------------- 105 | | 106 | | Redis is an open source, fast, and advanced key-value store. However, it 107 | | provides a richer set of commands than a typical key-value store such as 108 | | APC or memcached. All the cool kids are using it. 109 | | 110 | | To get the scoop on Redis, check out: http://redis.io 111 | | 112 | */ 113 | 114 | 'redis' => array( 115 | 116 | 'default' => array( 117 | 'host' => '127.0.0.1', 118 | 'port' => 6379, 119 | 'database' => 0 120 | ), 121 | 122 | ), 123 | 124 | ); -------------------------------------------------------------------------------- /application/config/mimes.php: -------------------------------------------------------------------------------- 1 | 'application/mac-binhex40', 6 | 'cpt' => 'application/mac-compactpro', 7 | 'csv' => array('text/x-comma-separated-values', 'text/comma-separated-values', 'application/octet-stream'), 8 | 'bin' => 'application/macbinary', 9 | 'dms' => 'application/octet-stream', 10 | 'lha' => 'application/octet-stream', 11 | 'lzh' => 'application/octet-stream', 12 | 'exe' => array('application/octet-stream', 'application/x-msdownload'), 13 | 'class' => 'application/octet-stream', 14 | 'psd' => 'application/x-photoshop', 15 | 'so' => 'application/octet-stream', 16 | 'sea' => 'application/octet-stream', 17 | 'dll' => 'application/octet-stream', 18 | 'oda' => 'application/oda', 19 | 'pdf' => array('application/pdf', 'application/x-download'), 20 | 'ai' => 'application/postscript', 21 | 'eps' => 'application/postscript', 22 | 'ps' => 'application/postscript', 23 | 'smi' => 'application/smil', 24 | 'smil' => 'application/smil', 25 | 'mif' => 'application/vnd.mif', 26 | 'xls' => array('application/excel', 'application/vnd.ms-excel', 'application/msexcel'), 27 | 'ppt' => array('application/powerpoint', 'application/vnd.ms-powerpoint'), 28 | 'wbxml' => 'application/wbxml', 29 | 'wmlc' => 'application/wmlc', 30 | 'dcr' => 'application/x-director', 31 | 'dir' => 'application/x-director', 32 | 'dxr' => 'application/x-director', 33 | 'dvi' => 'application/x-dvi', 34 | 'gtar' => 'application/x-gtar', 35 | 'gz' => 'application/x-gzip', 36 | 'php' => array('application/x-httpd-php', 'text/x-php'), 37 | 'php4' => 'application/x-httpd-php', 38 | 'php3' => 'application/x-httpd-php', 39 | 'phtml' => 'application/x-httpd-php', 40 | 'phps' => 'application/x-httpd-php-source', 41 | 'js' => 'application/x-javascript', 42 | 'swf' => 'application/x-shockwave-flash', 43 | 'sit' => 'application/x-stuffit', 44 | 'tar' => 'application/x-tar', 45 | 'tgz' => array('application/x-tar', 'application/x-gzip-compressed'), 46 | 'xhtml' => 'application/xhtml+xml', 47 | 'xht' => 'application/xhtml+xml', 48 | 'zip' => array('application/x-zip', 'application/zip', 'application/x-zip-compressed'), 49 | 'mid' => 'audio/midi', 50 | 'midi' => 'audio/midi', 51 | 'mpga' => 'audio/mpeg', 52 | 'mp2' => 'audio/mpeg', 53 | 'mp3' => array('audio/mpeg', 'audio/mpg', 'audio/mpeg3', 'audio/mp3'), 54 | 'aif' => 'audio/x-aiff', 55 | 'aiff' => 'audio/x-aiff', 56 | 'aifc' => 'audio/x-aiff', 57 | 'ram' => 'audio/x-pn-realaudio', 58 | 'rm' => 'audio/x-pn-realaudio', 59 | 'rpm' => 'audio/x-pn-realaudio-plugin', 60 | 'ra' => 'audio/x-realaudio', 61 | 'rv' => 'video/vnd.rn-realvideo', 62 | 'wav' => 'audio/x-wav', 63 | 'bmp' => 'image/bmp', 64 | 'gif' => 'image/gif', 65 | 'jpeg' => array('image/jpeg', 'image/pjpeg'), 66 | 'jpg' => array('image/jpeg', 'image/pjpeg'), 67 | 'jpe' => array('image/jpeg', 'image/pjpeg'), 68 | 'png' => 'image/png', 69 | 'tiff' => 'image/tiff', 70 | 'tif' => 'image/tiff', 71 | 'css' => 'text/css', 72 | 'html' => 'text/html', 73 | 'htm' => 'text/html', 74 | 'shtml' => 'text/html', 75 | 'txt' => 'text/plain', 76 | 'text' => 'text/plain', 77 | 'log' => array('text/plain', 'text/x-log'), 78 | 'rtx' => 'text/richtext', 79 | 'rtf' => 'text/rtf', 80 | 'xml' => 'text/xml', 81 | 'xsl' => 'text/xml', 82 | 'mpeg' => 'video/mpeg', 83 | 'mpg' => 'video/mpeg', 84 | 'mpe' => 'video/mpeg', 85 | 'qt' => 'video/quicktime', 86 | 'mov' => 'video/quicktime', 87 | 'avi' => 'video/x-msvideo', 88 | 'movie' => 'video/x-sgi-movie', 89 | 'doc' => 'application/msword', 90 | 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 91 | 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 92 | 'word' => array('application/msword', 'application/octet-stream'), 93 | 'xl' => 'application/excel', 94 | 'eml' => 'message/rfc822', 95 | 'json' => array('application/json', 'text/json'), 96 | 97 | ); -------------------------------------------------------------------------------- /laravel/pluralizer.php: -------------------------------------------------------------------------------- 1 | config = $config; 32 | } 33 | 34 | /** 35 | * Get the singular form of the given word. 36 | * 37 | * @param string $value 38 | * @return string 39 | */ 40 | public function singular($value) 41 | { 42 | // First we'll check the cache of inflected values. We cache each word that 43 | // is inflected so we don't have to spin through the regular expressions 44 | // each time we need to inflect a given value for the developer. 45 | if (isset($this->singular[$value])) 46 | { 47 | return $this->singular[$value]; 48 | } 49 | 50 | // English words may be automatically inflected using regular expressions. 51 | // If the word is english, we'll just pass off the word to the automatic 52 | // inflection method and return the result, which is cached. 53 | $irregular = $this->config['irregular']; 54 | 55 | $result = $this->auto($value, $this->config['singular'], $irregular); 56 | 57 | return $this->singular[$value] = $result ?: $value; 58 | } 59 | 60 | /** 61 | * Get the plural form of the given word. 62 | * 63 | * @param string $value 64 | * @param int $count 65 | * @return string 66 | */ 67 | public function plural($value, $count = 2) 68 | { 69 | if ((int) $count == 1) return $value; 70 | 71 | // First we'll check the cache of inflected values. We cache each word that 72 | // is inflected so we don't have to spin through the regular expressions 73 | // each time we need to inflect a given value for the developer. 74 | if (isset($this->plural[$value])) 75 | { 76 | return $this->plural[$value]; 77 | } 78 | 79 | // English words may be automatically inflected using regular expressions. 80 | // If the word is english, we'll just pass off the word to the automatic 81 | // inflection method and return the result, which is cached. 82 | $irregular = array_flip($this->config['irregular']); 83 | 84 | $result = $this->auto($value, $this->config['plural'], $irregular); 85 | 86 | return $this->plural[$value] = $result; 87 | } 88 | 89 | /** 90 | * Perform auto inflection on an English word. 91 | * 92 | * @param string $value 93 | * @param array $source 94 | * @param array $irregular 95 | * @return string 96 | */ 97 | protected function auto($value, $source, $irregular) 98 | { 99 | // If the word hasn't been cached, we'll check the list of words that 100 | // that are "uncountable". This should be a quick look up since we 101 | // can just hit the array directly for the value. 102 | if (in_array(Str::lower($value), $this->config['uncountable'])) 103 | { 104 | return $value; 105 | } 106 | 107 | // Next we will check the "irregular" patterns, which contains words 108 | // like "children" and "teeth" which can not be inflected using the 109 | // typically used regular expression matching approach. 110 | foreach ($irregular as $irregular => $pattern) 111 | { 112 | if (preg_match($pattern = '/'.$pattern.'$/i', $value)) 113 | { 114 | return preg_replace($pattern, $irregular, $value); 115 | } 116 | } 117 | 118 | // Finally we'll spin through the array of regular expressions and 119 | // and look for matches for the word. If we find a match we will 120 | // cache and return the inflected value for quick look up. 121 | foreach ($source as $pattern => $inflected) 122 | { 123 | if (preg_match($pattern, $value)) 124 | { 125 | return preg_replace($pattern, $inflected, $value); 126 | } 127 | } 128 | } 129 | 130 | } -------------------------------------------------------------------------------- /laravel/database/query/grammars/sqlserver.php: -------------------------------------------------------------------------------- 1 | offset > 0) 28 | { 29 | return $this->ansi_offset($query, $sql); 30 | } 31 | 32 | // Once all of the clauses have been compiled, we can join them all as 33 | // one statement. Any segments that are null or an empty string will 34 | // be removed from the array before imploding. 35 | return $this->concatenate($sql); 36 | } 37 | 38 | /** 39 | * Compile the SELECT clause for a query. 40 | * 41 | * @param Query $query 42 | * @return string 43 | */ 44 | protected function selects(Query $query) 45 | { 46 | if ( ! is_null($query->aggregate)) return; 47 | 48 | $select = ($query->distinct) ? 'SELECT DISTINCT ' : 'SELECT '; 49 | 50 | // Instead of using a "LIMIT" keyword, SQL Server uses the TOP keyword 51 | // within the SELECT statement. So, if we have a limit, we will add 52 | // it to the query here if there is not an OFFSET present. 53 | if ($query->limit > 0 and $query->offset <= 0) 54 | { 55 | $select .= 'TOP '.$query->limit.' '; 56 | } 57 | 58 | return $select.$this->columnize($query->selects); 59 | } 60 | 61 | /** 62 | * Generate the ANSI standard SQL for an offset clause. 63 | * 64 | * @param Query $query 65 | * @param array $components 66 | * @return array 67 | */ 68 | protected function ansi_offset(Query $query, $components) 69 | { 70 | // An ORDER BY clause is required to make this offset query work, so if 71 | // one doesn't exist, we'll just create a dummy clause to trick the 72 | // database and pacify it so it doesn't complain about the query. 73 | if ( ! isset($components['orderings'])) 74 | { 75 | $components['orderings'] = 'ORDER BY (SELECT 0)'; 76 | } 77 | 78 | // We need to add the row number to the query so we can compare it to 79 | // the offset and limit values given for the statement. So we'll add 80 | // an expression to the select for the row number. 81 | $orderings = $components['orderings']; 82 | 83 | $components['selects'] .= ", ROW_NUMBER() OVER ({$orderings}) AS RowNum"; 84 | 85 | unset($components['orderings']); 86 | 87 | $start = $query->offset + 1; 88 | 89 | // Next we need to calculate the constraint that should be placed on 90 | // the row number to get the correct offset and limit on the query. 91 | // If there is not limit, we'll just handle the offset. 92 | if ($query->limit > 0) 93 | { 94 | $finish = $query->offset + $query->limit; 95 | 96 | $constraint = "BETWEEN {$start} AND {$finish}"; 97 | } 98 | else 99 | { 100 | $constraint = ">= {$start}"; 101 | } 102 | 103 | // We're finally ready to build the final SQL query so we'll create 104 | // a common table expression with the query and select all of the 105 | // results with row numbers between the limit and offset. 106 | $sql = $this->concatenate($components); 107 | 108 | return "SELECT * FROM ($sql) AS TempTable WHERE RowNum {$constraint}"; 109 | } 110 | 111 | /** 112 | * Compile the LIMIT clause for a query. 113 | * 114 | * @param Query $query 115 | * @return string 116 | */ 117 | protected function limit(Query $query) 118 | { 119 | return ''; 120 | } 121 | 122 | /** 123 | * Compile the OFFSET clause for a query. 124 | * 125 | * @param Query $query 126 | * @return string 127 | */ 128 | protected function offset(Query $query) 129 | { 130 | return ''; 131 | } 132 | 133 | } -------------------------------------------------------------------------------- /laravel/event.php: -------------------------------------------------------------------------------- 1 | 27 | * // Register a callback for the "start" event 28 | * Event::listen('start', function() {return 'Started!';}); 29 | * 30 | * // Register an object instance callback for the given event 31 | * Event::listen('event', array($object, 'method')); 32 | * 33 | * 34 | * @param string $event 35 | * @param mixed $callback 36 | * @return void 37 | */ 38 | public static function listen($event, $callback) 39 | { 40 | static::$events[$event][] = $callback; 41 | } 42 | 43 | /** 44 | * Override all callbacks for a given event with a new callback. 45 | * 46 | * @param string $event 47 | * @param mixed $callback 48 | * @return void 49 | */ 50 | public static function override($event, $callback) 51 | { 52 | static::clear($event); 53 | 54 | static::listen($event, $callback); 55 | } 56 | 57 | /** 58 | * Clear all event listeners for a given event. 59 | * 60 | * @param string $event 61 | * @return void 62 | */ 63 | public static function clear($event) 64 | { 65 | unset(static::$events[$event]); 66 | } 67 | 68 | /** 69 | * Fire an event and return the first response. 70 | * 71 | * 72 | * // Fire the "start" event 73 | * $response = Event::first('start'); 74 | * 75 | * // Fire the "start" event passing an array of parameters 76 | * $response = Event::first('start', array('Laravel', 'Framework')); 77 | * 78 | * 79 | * @param string $event 80 | * @param array $parameters 81 | * @return mixed 82 | */ 83 | public static function first($event, $parameters = array()) 84 | { 85 | return head(static::fire($event, $parameters)); 86 | } 87 | 88 | /** 89 | * Fire an event and return the the first response. 90 | * 91 | * Execution will be halted after the first valid response is found. 92 | * 93 | * @param string $event 94 | * @param array $parameters 95 | * @return mixed 96 | */ 97 | public static function until($event, $parameters = array()) 98 | { 99 | return static::fire($event, $parameters, true); 100 | } 101 | 102 | /** 103 | * Fire an event so that all listeners are called. 104 | * 105 | * 106 | * // Fire the "start" event 107 | * $responses = Event::fire('start'); 108 | * 109 | * // Fire the "start" event passing an array of parameters 110 | * $responses = Event::fire('start', array('Laravel', 'Framework')); 111 | * 112 | * 113 | * @param string $event 114 | * @param array $parameters 115 | * @param bool $halt 116 | * @return array 117 | */ 118 | public static function fire($event, $parameters = array(), $halt = false) 119 | { 120 | $responses = array(); 121 | 122 | $parameters = (array) $parameters; 123 | 124 | // If the event has listeners, we will simply iterate through them and call 125 | // each listener, passing in the parameters. We will add the responses to 126 | // an array of event responses and return the array. 127 | if (static::listeners($event)) 128 | { 129 | foreach (static::$events[$event] as $callback) 130 | { 131 | $response = call_user_func_array($callback, $parameters); 132 | 133 | // If the event is set to halt, we will return the first response 134 | // that is not null. This allows the developer to easily stack 135 | // events but still get the first valid response. 136 | if ($halt and ! is_null($response)) 137 | { 138 | return $response; 139 | } 140 | 141 | // After the handler has been called, we'll add the response to 142 | // an array of responses and return the array to the caller so 143 | // all of the responses can be easily examined. 144 | $responses[] = $response; 145 | } 146 | } 147 | 148 | return $responses; 149 | } 150 | 151 | } -------------------------------------------------------------------------------- /laravel/messages.php: -------------------------------------------------------------------------------- 1 | messages = (array) $messages; 21 | } 22 | 23 | /** 24 | * Add a message to the collector. 25 | * 26 | * 27 | * // Add a message for the e-mail attribute 28 | * $messages->add('email', 'The e-mail address is invalid.'); 29 | * 30 | * 31 | * @param string $key 32 | * @param string $message 33 | * @return void 34 | */ 35 | public function add($key, $message) 36 | { 37 | if ($this->unique($key, $message)) $this->messages[$key][] = $message; 38 | } 39 | 40 | /** 41 | * Determine if a key and message combination already exists. 42 | * 43 | * @param string $key 44 | * @param string $message 45 | * @return bool 46 | */ 47 | protected function unique($key, $message) 48 | { 49 | return ! isset($this->messages[$key]) or ! in_array($message, $this->messages[$key]); 50 | } 51 | 52 | /** 53 | * Determine if messages exist for a given key. 54 | * 55 | * 56 | * // Is there a message for the e-mail attribute 57 | * return $messages->has('email'); 58 | * 59 | * // Is there a message for the any attribute 60 | * echo $messages->has(); 61 | * 62 | * 63 | * @param string $key 64 | * @return bool 65 | */ 66 | public function has($key = null) 67 | { 68 | return $this->first($key) !== ''; 69 | } 70 | 71 | /** 72 | * Get the first message from the container for a given key. 73 | * 74 | * 75 | * // Echo the first message out of all messages. 76 | * echo $messages->first(); 77 | * 78 | * // Echo the first message for the e-mail attribute 79 | * echo $messages->first('email'); 80 | * 81 | * // Format the first message for the e-mail attribute 82 | * echo $messages->first('email', '

    :message

    '); 83 | *
    84 | * 85 | * @param string $key 86 | * @param string $format 87 | * @return string 88 | */ 89 | public function first($key = null, $format = ':message') 90 | { 91 | $messages = is_null($key) ? $this->all($format) : $this->get($key, $format); 92 | 93 | return (count($messages) > 0) ? $messages[0] : ''; 94 | } 95 | 96 | /** 97 | * Get all of the messages from the container for a given key. 98 | * 99 | * 100 | * // Echo all of the messages for the e-mail attribute 101 | * echo $messages->get('email'); 102 | * 103 | * // Format all of the messages for the e-mail attribute 104 | * echo $messages->get('email', '

    :message

    '); 105 | *
    106 | * 107 | * @param string $key 108 | * @param string $format 109 | * @return array 110 | */ 111 | public function get($key, $format = ':message') 112 | { 113 | if (array_key_exists($key, $this->messages)) 114 | { 115 | return $this->format($this->messages[$key], $format); 116 | } 117 | 118 | return array(); 119 | } 120 | 121 | /** 122 | * Get all of the messages for every key in the container. 123 | * 124 | * 125 | * // Get all of the messages in the collector 126 | * $all = $messages->all(); 127 | * 128 | * // Format all of the messages in the collector 129 | * $all = $messages->all('

    :message

    '); 130 | *
    131 | * 132 | * @param string $format 133 | * @return array 134 | */ 135 | public function all($format = ':message') 136 | { 137 | $all = array(); 138 | 139 | foreach ($this->messages as $messages) 140 | { 141 | $all = array_merge($all, $this->format($messages, $format)); 142 | } 143 | 144 | return $all; 145 | } 146 | 147 | /** 148 | * Format an array of messages. 149 | * 150 | * @param array $messages 151 | * @param string $format 152 | * @return array 153 | */ 154 | protected function format($messages, $format) 155 | { 156 | $messages = (array) $messages; 157 | 158 | foreach ($messages as $key => &$message) 159 | { 160 | $message = str_replace(':message', $message, $format); 161 | } 162 | 163 | return $messages; 164 | } 165 | 166 | } --------------------------------------------------------------------------------