<?php /* * This file is part of SwiftMailer. * (c) 2004-2009 Chris Corbyn * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ /* * Autoloader and dependency injection initialization for Swift Mailer. */ if (defined('SWIFT_REQUIRED_LOADED')) { return; } define('SWIFT_REQUIRED_LOADED', true); //Load Swift utility class require dirname(__FILE__) . '/library/classes/Swift.php'; //Start the autoloader Swift::registerAutoload(); //Load the init script to set up dependency injection require dirname(__FILE__) . '/library/swift_init.php'; // Register a mailer in the IoC container Laravel\IoC::singleton('mailer', function () { $transport = Laravel\IoC::resolve('mailer.transport'); return Swift_Mailer::newInstance($transport); }); // Register a transporter in the IoC container Laravel\IoC::register('mailer.transport', function () { return Swift_MailTransport::newInstance(); });
* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ Laravel\IoC::singleton('HTMLPurifier', function () { if (!class_exists('HTMLPurifier_Config', false)) { if (Config::get('purifier.preload')) { // Load the all of HTML Purifier right now. // This increases performance with a slight hit to memory usage. require dirname(__FILE__) . '/library/HTMLPurifier.includes.php'; } // Load the HTML Purifier auto loader require dirname(__FILE__) . '/library/HTMLPurifier.auto.php'; } // Create a new configuration object $config = HTMLPurifier_Config::createDefault(); if (!Config::get('purifier.finalize')) { // Allow configuration to be modified $config->autoFinalize = false; } // Use the same character set as Laravel $config->set('Core.Encoding', Config::get('application.encoding')); if (is_array($settings = Config::get('purifier.settings'))) { // Load the settings $config->loadArray($settings); } // Configure additional options $config = HTMLPurifier_Config::create($config); // Return the purifier instance return new HTMLPurifier($config); });
<?php Autoloader::namespaces(array('Sendersuite' => Bundle::path('sendersuite') . 'lib')); // Register sendersuite in the IoC container Laravel\IoC::singleton('sendersuite', function () { $confProvider = new \Sendersuite\ConfigurationProvider(); if (\Laravel\Config::get('sendersuite::config.debugmode')) { $apiConnection = new \Sendersuite\EventConnection(); } else { $apiConnection = new \Sendersuite\HttpConnection(); } $ssApi = new \Sendersuite\Api($apiConnection, $confProvider); return $ssApi; });
| { | return 'Hello World!'; | }); | | It's easy to allow URI wildcards using (:num) or (:any): | | Route::put('hello/(:any)', function($name) | { | return "Welcome, $name."; | }); | */ $providers = array('facebook/(:any?)', 'twitter/(:any?)', 'google/(:any?)'); Route::get('/', array('uses' => 'home@index')); Route::get($providers, array('as' => '', function () { Laravel\IoC::resolve('opauth'); })); Route::post('done', function () { $response = unserialize(base64_decode($_POST['opauth'])); echo "<pre>"; print_r($response); echo "</pre>"; }); /* |-------------------------------------------------------------------------- | Application 404 & 500 Error Handlers |-------------------------------------------------------------------------- | | To centralize and simplify 404 handling, Laravel uses an awesome event | system to retrieve the response. Feel free to modify this function to | your tastes and the needs of your application.
<?php Autoloader::map(array('Opauth' => __DIR__ . '/Opauth/Opauth.php')); Laravel\IoC::singleton('opauth', function () { $config = array('Strategy' => array('Facebook' => array('app_id' => 'APP_ID', 'app_secret' => 'APP_SECRET'), 'Twitter' => array('key' => 'APP_KEY', 'secret' => 'APP_SECRET')), 'security_salt' => 'YOURSALTGOESHERE!', 'path' => '/opauth-bundle/public/', 'callback_transport' => 'post', 'callback_url' => '/opauth-bundle/public/done'); return new Opauth($config); });
* Autoloader and dependency injection initialization for Swift Mailer. */ if (defined('SWIFT_REQUIRED_LOADED')) { return; } define('SWIFT_REQUIRED_LOADED', true); //Load Swift utility class require dirname(__FILE__) . '/library/classes/Swift.php'; //Start the autoloader Swift::registerAutoload(); //Load the init script to set up dependency injection require dirname(__FILE__) . '/library/swift_init.php'; // Register a mailer in the IoC container Laravel\IoC::singleton('mailer', function () { $transport = Laravel\IoC::resolve('mailer.transport'); return Swift_Mailer::newInstance($transport); }); // Register a transporter in the IoC container Laravel\IoC::register('mailer.transport', function () { /* * USE Mail() Transport */ // return Swift_MailTransport::newInstance(); /* * USE SMTP Transport * * Set SMTP cretentials in /cms/config/settings.php */ $transport = Swift_SmtpTransport::newInstance(Config::get('cms::settings.mail_smtp'), 25)->setUsername(Config::get('cms::settings.mail_username'))->setPassword(Config::get('cms::settings.mail_password')); return $transport; });
<?php /** * @author Daniel Schniepp < http://daniel-schniepp.com/ > * @copyright 2012 daniel-schniepp.com * @license http://creativecommons.org/licenses/by-sa/3.0/ * @package Vimeo Advanced API (Laravel Bundle) * @version 1.0 - 2012-08-22 */ Autoloader::map(array('phpVimeo' => Bundle::path('vimeo-api') . 'vimeo/vimeo.php')); Laravel\IoC::singleton('vimeo-api', function () { $consumer_key = Config::get('vimeo.consumer_key'); $consumer_secret = Config::get('vimeo.consumer_secret'); $access_token = Config::get('vimeo.access_token'); $access_token_secret = Config::get('vimeo.access_token_secret'); return new phpVimeo($consumer_key, $consumer_secret, $access_token, $access_token_secret); });
* You can also change the $options here * $name = (Auth::user()) ? Auth::user()->name : 'Anonymous'; * $options['upload_dir'] = path('public').'/pictures/'.$name.'/'; * $options['upload_url'] = URL::base().'/pictures/'.$name.'/'; * * However it's better to change the options per controller, like this: * $uploader = IoC::resolve('Uploader'); * $uploader * ->with_option('override_name' , 'MyFixedName') * ->with_option('script_url' , URL::to_route('dbupload')) * ->Start(); */ Laravel\IoC::register('Uploader', function () { $options = Config::get('juploader::settings'); $uploader = isset($options['UploaderClass']) ? $options['UploaderClass'] : 'Uploader\\FileUploadHandler'; $arguments = isset($options['UploaderArguments']) ? $options['UploaderArguments'] : null; $server_options = $options['Server']; return new Uploader\UploadServer($uploader, $arguments, $server_options); }); /** * Assets Management */ Asset::container('juploader')->bundle('juploader')->add('fileupload-ui-css', 'css/jquery.fileupload-ui.css')->add('style', 'css/style.css')->add('jquery-ui', 'js/vendor/jquery.ui.widget.js')->add('tmpl', 'js/extra/tmpl.min.js')->add('load-image', 'js/extra/load-image.min.js')->add('iframe-transport', 'js/jquery.iframe-transport.js')->add('fileupload', 'js/jquery.fileupload.js')->add('fileupload-fp', 'js/jquery.fileupload-fp.js')->add('fileupload-ui', 'js/jquery.fileupload-ui.js')->add('locale', 'js/locale.js'); Asset::container('juploader-gallery')->bundle('juploader')->add('bootstrap-gallery-css', 'css/extra/bootstrap-image-gallery.min.css')->add('bootstrap-gallery', 'js/extra/bootstrap-image-gallery.min.js'); /** * Use this asset only if you are going to * use the library canvas-to-blob * mode details here: https://github.com/blueimp/jQuery-File-Upload/wiki */ Asset::container('juploader-optional')->bundle('juploader')->add('canvas-to-blob', 'js/extra/canvas-to-blob.min.js'); /**
<?php Autoloader::map(array('stripe-oauth' => Bundle::path('laravel-stripe-oauth-bundle') . 'PHP-StripeOAuth/StripeOAuth.class.php')); Laravel\IoC::singleton('stripe-oauth', function () { $config = array(); $config['_cID'] = Config::get('stripeoauth._cid', Config::get('stripe-oauth::stripeoauth._cid')); $config['secret'] = Config::get('stripeoauth.secret', Config::get('stripe-oauth::stripeoauth.secret')); return new FoursquareApi($config['_cID'], $config['secret']); });
<?php Autoloader::map(array('Hybrid_Auth' => Bundle::path('hybridauth') . 'hybridauth/Hybrid/Auth.php', 'Hybrid_Endpoint' => Bundle::path('hybridauth') . 'hybridauth/Hybrid/Endpoint.php')); Laravel\IoC::singleton('hybridauth', function () { return new Hybrid_Auth(path('app') . '/config/hybridauth.php'); });
<?php /** * @author Andrew Zappella < http://www.suisseo.ch/ > * @copyright 2012 Suisseo SARL * @license http://creativecommons.org/licenses/by-sa/3.0/ * @package Google API PHP Client (Laravel Bundle) * @version 0.2.1 - 2013-03-17 */ const BUNDLE_NAME = 'google-api-php-client'; Autoloader::map(array('Google_Client' => Bundle::path(BUNDLE_NAME) . 'google-api-php-client' . DS . 'src' . DS . 'Google_Client.php')); // Autoloader::directories(array(Bundle::path(BUNDLE_NAME).'google-api-php-client'.DS.'src'.DS.'contrib')); Laravel\IoC::singleton('google-api-php-client', function () { $bundle_prefix = Bundle::prefix(BUNDLE_NAME); $config = array(); $config['application_name'] = Config::get($bundle_prefix . 'google.application_name'); $config['oauth2_client_id'] = Config::get($bundle_prefix . 'google.client_id'); $config['oauth2_client_secret'] = Config::get($bundle_prefix . 'google.client_secret'); $config['oauth2_redirect_uri'] = Config::get($bundle_prefix . 'google.redirect_uri'); $config['developer_key'] = Config::get($bundle_prefix . 'google.developer_key'); $config['use_objects'] = Config::get($bundle_prefix . 'google.use_objects'); $google = new Google_Client($config); $google->setScopes(Config::get($bundle_prefix . 'google.set_scopes')); $google->setAccessType(Config::get($bundle_prefix . 'google.access_type')); $google->setApprovalPrompt(Config::get($bundle_prefix . 'google.approval_prompt')); // autoload Google API services $classes = Google::services(); $mappings = Google::format_mappings($classes); Autoloader::map($mappings); return $google; });
<?php /** * @author Tracy Mazelin * @copyright 2013 Tracy Mazelin * @license apache license 2.0, code is distributed "as is", use at own risk, all rights reserved */ Autoloader::map(array('FellowshipOne' => path('app') . 'libraries/FellowshipOne.php')); Laravel\IoC::singleton('FellowshipOne', function () { $settings = Config::get('fellowshipone'); return new FellowshipOne($settings); });