public function __construct() { Bundle::register('settings'); Bundle::start('settings'); Bundle::register('modules'); Bundle::start('modules'); }
/** * Setup the test environment. */ public function setUp() { Bundle::start('oneauth'); Config::set('application.url', 'http://localhost'); Config::set('application.index', ''); Config::set('oneauth::urls', array('registration' => 'auth/register', 'login' => 'auth/login', 'callback' => 'auth/callback', 'registered' => 'auth/home', 'logged_in' => 'auth/account')); }
/** * Set up a mock environment to test iBundle. * * @return null */ public function __construct() { // Start the bundle Bundle::start('ibundle'); // Set test ibundle cache file $this->cache_file = ibundle_config('file', Bundle::path('ibundle') . 'storage/test.cache'); }
public function run() { Bundle::start('messages'); $twoweeks = date('Y-m-d', strtotime('+2 weeks')); $week = date('Y-m-d', strtotime('+1 weeks')); $tomorrow = date('Y-m-d', strtotime('+1 day')); $rooms = Room::where_del_date($tomorrow)->or_where('del_date', '=', $week)->or_where('del_date', '=', $twoweeks)->get(); foreach ($rooms as $room) { switch ($room->del_date) { case $twoweeks: $expire_date = "over twee weken"; break; case $week: $expire_date = "over een week"; break; case $tomorrow: $expire_date = "morgen"; break; } Message::send(function ($message) use($room, $expire_date) { $message->to($room->email); $message->from('*****@*****.**', 'Kamergenood'); $message->subject('Verleng de kameradvertentie: "' . $room->title . '"'); $message->body('view: emails.extend'); $message->body->id = $room->id; $message->body->title = $room->title; $message->body->url = $room->url; $message->body->delkey = $room->delkey; $message->body->expire_date = $expire_date; $message->html(true); }); } }
/** * Sends an email * * @param string $email * @param string $title * @param string $content * @return boolean */ public static function send($email, $title, $content) { Bundle::start('swiftmailer'); $transporter = Swift_SmtpTransport::newInstance('smtp.googlemail.com', Config::get('gotin::gotin.smtp_port'), 'ssl')->setUsername(Config::get('gotin::gotin.smtp_user'))->setPassword(Config::get('gotin::gotin.smtp_password')); $mailer = Swift_Mailer::newInstance($transporter); $message = Swift_Message::newInstance($title)->setFrom(array(Config::get('gotin::gotin.from_email') => Config::get('gotin::gotin.from_title')))->setTo(array($email => $email))->setBody($content, 'text/html'); return $mailer->send($message); }
public function testIssues() { Bundle::start('flyswatter'); // Seed Database Controller::call('flyswatter::seed@seed'); $issue = Issue::find(1); $this->assertNotNull($issue->id); }
public function __construct() { Bundle::register('modules'); Bundle::start('modules'); Bundle::register('navigation'); Bundle::start('navigation'); Bundle::register('pages'); Bundle::start('pages'); }
public function post_process() { Log::write('PayPal', 'Trying to process IPN'); Bundle::start('paypal-ipn'); $listener = new IpnListener(); // $listener->use_sandbox = true; try { $listener->requirePostMethod(); $verified = $listener->processIpn(); } catch (Exception $e) { Log::info($e->getMessage()); } if ($verified) { Log::write('PayPal', 'IPN payment looks verified'); $data = Input::get(); $settings = IniHandle::readini(); if (!in_array($data['payment_status'], array('Completed', 'COMPLETED', 'completed'))) { Log::write('PayPal', 'payment not completed'); return View::make('msg.error')->with('error', 'PayPal: payment not completed'); } if (strtolower($data['receiver_email']) != strtolower($settings['ppemail'])) { Log::write('PayPal', 'receive email not same as set in settings. Settings: ' . $settings['ppemail'] . ' ||| PayPal email: ' . $data['receiver_email']); return View::make('msg.error')->with('error', 'PayPal: receive email not same as set in settings'); } if (Payment::where('transaction_id', '=', $data['txn_id'])->count() != 0) { Log::write('PayPal', 'transaction ID already exists'); return View::make('msg.error')->with('error', 'PayPal: transaction ID already exists'); } if (strtolower($data['mc_currency']) != strtolower($settings['ppcurrency'])) { Log::write('PayPal', 'Currencies do not match'); return View::make('msg.error')->with('error', 'PayPal: currencies do not match'); } Log::write('PayPal', 'Got past all PLAN controller checks now going into CUSTOM'); if (strtolower($data['custom']) == 'plan') { $result = Payment::verifyPlan($data); if (!$result) { return $result; } } elseif (strtolower($data['custom']) == 'blacklist_skype' || strtolower($data['custom']) == 'blacklist_ip') { $result = Payment::verifyBlacklist($data); if (!$result) { return $result; } } else { Log::write('PayPal', 'Custom not found, can\'t verify anything'); return View::make('msg.error')->with('error', 'Fraudulent payment?'); } Log::write('PayPal', 'Now trying to add Payment info to DB'); $payment = Payment::create(array('user_id' => $data['option_selection1'], 'token' => $data['ipn_track_id'], 'date' => date('Y-m-d H:i:s', time()), 'ack' => $data['payment_status'], 'transaction_id' => $data['txn_id'], 'amount' => $data['mc_gross'], 'paypal_fee' => $data['mc_fee'], 'status' => $data['payment_status'], 'description' => $data['custom'])); Log::write('PayPal', 'Successful payment, DB id: ' . $payment->id); } else { Log::write('PayPal', 'IPN listener returns false on check'); } return 'handled'; }
static function start() { Bundle::start('htmlki'); error_reporting(-1); static::$logged = array(); assert_options(ASSERT_BAIL, 1); if (!static::$attached) { static::$attached = true; \Event::listen('laravel.log', array(get_called_class(), 'onLog')); } }
public function __construct() { // the required modules must be enabled already // at this point Bundle::register('email'); Bundle::start('email'); Bundle::register('settings'); Bundle::start('settings'); Bundle::register('modules'); Bundle::start('modules'); Bundle::register('navigation'); Bundle::start('navigation'); }
public function post_upload($galleryID) { $path = path('public') . 'images/' . $galleryID; Fineuploader::init($path); $name = Fineuploader::getName(); $fuResponse = Fineuploader::upload($name); if (isset($fuResponse['success']) && $fuResponse['success'] == true) { $file = Fineuploader::getUploadName(); Bundle::start('resizer'); $success = Resizer::open($file)->resize(300, 300, 'landscape')->save($path . '/thumbs/' . $name, 90); Images::create($galleryID, $name); } return Response::json($fuResponse); }
public static function listRole() { Bundle::start('datagrid'); $rolelist = Admin_UserRole::where('roleid', '<>', 1)->get(); $datagrid = new Datagrid(); $datagrid->setFields(array('roleid' => 'Role Id', 'role' => 'User Role Description')); $datagrid->setAction('edit', 'editRoleModal', true, array('roleid')); //false,array('id'=>'roleid','data-toggle'=>'modal')); $datagrid->setAction('delete', 'deleteRole', true, array('roleid')); $datagrid->setContainer('list01', 'span12'); $datagrid->setTable('users', 'table table-bordered table-hover table-striped table-condensed'); $datagrid->build($rolelist, 'roleid'); return $datagrid->render(); }
public function run() { Bundle::start('messages'); $today = date('Y-m-d'); $rooms = Room::where_del_date($today)->get(); foreach ($rooms as $room) { Message::send(function ($message) use($room) { $message->to($room->email); $message->from('*****@*****.**', 'Kamergenood'); $message->subject('Kamer verlopen en verwijderd: "' . $room->title . '"'); $message->body('view: emails.deleted'); $message->body->title = $room->title; $message->html(true); }); $path_room_folder = getcwd() . '/public_html/img/room/' . $room->id; File::rmdir($path_room_folder); $room->delete(); } }
public function create_user($data, $is_admin) { Session::load(); Bundle::start('sentry'); try { $user_id = Sentry::user()->create($data); if ($user_id) { if ($is_admin) { $permissions = array('is_admin' => 1); if (Sentry::user($data['email'])->update_permissions($permissions)) { // all good } else { throw new \Exception('Error updation permission.'); } } } else { throw new \Exception('Error creating user.'); } } catch (Sentry\SentryException $e) { throw $e; } }
/** * Load the file corresponding to a given class. * * This method is registerd in the bootstrap file as an SPL auto-loader. * * @param string $class * @return void */ public static function load($class) { // First, we will check to see if the class has been aliased. If it has, // we will register the alias, which may cause the auto-loader to be // called again for the "real" class name. if (isset(static::$aliases[$class])) { class_alias(static::$aliases[$class], $class); } elseif (isset(static::$mappings[$class])) { require static::$mappings[$class]; } // If the class namespace is mapped to a directory, we will load the // class using the PSR-0 standards from that directory; however, we // will trim off the beginning of the namespace to account for // the root of the mapped directory. if (!is_null($info = static::namespaced($class))) { $class = substr($class, strlen($info['namespace'])); return static::load_psr($class, $info['directory']); } elseif (($slash = strpos($class, '\\')) !== false) { $namespace = substr($class, 0, $slash); // If the class is namespaced to an existing bundle and the bundle has // not been started, we will start the bundle and attempt to load the // class file again. If that fails, an error will be thrown by PHP. // // This allows bundle classes to be loaded by the auto-loader before // their class mappings have actually been registered; however, it // is up to the bundle developer to namespace their classes to // match the name of their bundle. if (Bundle::exists($namespace) and !Bundle::started($namespace)) { Bundle::start(strtolower($namespace)); static::load($class); } } // If the class is not maped and is not part of a bundle or a mapped // namespace, we'll make a last ditch effort to load the class via // the PSR-0 from one of the registered directories. static::load_psr($class); }
/** * Setup the test environment. */ public function setUp() { Bundle::start('oneauth'); }
<?php Bundle::start('basset'); Basset::collection('styles', function ($collection) { $collection->add('css/normalize.css'); $collection->add('css/bootstrap.css'); $collection->add('css/bootstrap-responsive.css'); $collection->add('css/styles.css'); }); Basset::collection('scripts', function ($collection) { $collection->add('js/libs/jquery.min.js'); $collection->add('js/libs/bootstrap/bootstrap-dropdown.js'); $collection->add('js/libs/bootstrap/bootstrap-alert.js'); }); Basset::collection('scripts-home-index', function ($collection) { $collection->add('js/libs/jquery.min.js'); $collection->add('js/libs/bootstrap/bootstrap-dropdown.js'); $collection->add('js/libs/bootstrap/bootstrap-alert.js'); $collection->add('js/libs/jquery.cycle2.min.js'); $collection->add('js/libs/jquery.cycle2.carousel.min.js'); $collection->add('js/home.js'); }); Basset::collection('scripts-dashboard-profile', function ($collection) { $collection->add('js/libs/jquery.min.js'); $collection->add('js/libs/bootstrap/bootstrap-dropdown.js'); $collection->add('js/libs/bootstrap/bootstrap-alert.js'); $collection->add('js/libs/bootstrap/bootstrap-tab.js'); }); Basset::collection('styles-tags-show', function ($collection) { $collection->add('css/normalize.css'); $collection->add('css/bootstrap.css');
<?php // Start the stampie bundle Bundle::start('stampie'); class TestPostmark extends PHPUnit_Framework_TestCase { /** * Test to send a real-world message * * @return void */ public function testSendEmail() { require 'fixtures/message.php'; $postmark = IoC::resolve('postmark'); $return = $postmark->send(new Message('*****@*****.**')); $this->assertTrue($return); } }
Route::filter('auth', function () { if (Auth::guest()) { return Redirect::make('', 401); } }); // -------------------------------------------------------------- // Setting system tables // -------------------------------------------------------------- DBManager::$hidden = Config::get('domain::dbmanager.hidden'); $api_version = Config::get('layla.domain.api.version'); // -------------------------------------------------------------- // Map the Base Controller // -------------------------------------------------------------- Autoloader::map(array('Domain_Base_Controller' => __DIR__ . DS . 'controllers' . DS . 'base' . EXT)); Route::filter('api_auth', function () { if (!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW'])) { //return Response::json(array(), 401); } //Auth::attempt(); }); Bundle::start('thirdparty_bob'); // -------------------------------------------------------------- // Load the routes // -------------------------------------------------------------- Route::group(array('before' => 'api_auth'), function () use($api_version) { Route::api(Config::get('routes'), 'domain', Config::get('layla.domain.url_prefix')); }); // -------------------------------------------------------------- // Set aliases // -------------------------------------------------------------- Autoloader::alias('Domain\\Libraries\\Response', 'Response');
// Register the Base Controller // -------------------------------------------------------------- Autoloader::map(array('Admin_Base_Controller' => __DIR__ . DS . 'controllers' . DS . 'base' . EXT)); // -------------------------------------------------------------- // Register namespaces // -------------------------------------------------------------- Autoloader::namespaces(array('Admin' => __DIR__)); // -------------------------------------------------------------- // Register controllers // -------------------------------------------------------------- Route::pages(Config::get('routes'), 'admin', Config::get('layla.admin.url_prefix')); // -------------------------------------------------------------- // Start bundles // -------------------------------------------------------------- Bundle::start('thirdparty_bootsparks'); Bundle::start('thirdparty_menu'); // -------------------------------------------------------------- // Default Composer // -------------------------------------------------------------- View::composer('admin::layouts.default', function ($view) { $view->shares('url', prefix('admin') . '/'); Asset::container('header')->add('jquery', 'js/jquery.min.js')->add('bootstrap', 'bootstrap/css/bootstrap.css')->add('main', 'html/layla.css'); Asset::container('footer')->add('bootstrap', 'js/bootstrap.js'); }); // -------------------------------------------------------------- // Adding menu items // -------------------------------------------------------------- Menu::handler('main')->add('home', 'Home', null, array('class' => 'icon-home'))->add('pages', 'Pages', null, array('class' => 'icon-pages'))->add('media', 'Media', null, array('class' => 'icon-media'))->add('accounts', 'Accounts', null, array('class' => 'icon-accounts'))->add('settings', 'Settings', null, array('class' => 'icon-settings'))->add('#', '', null, array('class' => 'logo'))->add('profile', 'Profile', null, array('class' => 'icon-profile')); // -------------------------------------------------------------- // Registering forms and pages // --------------------------------------------------------------
public function testRelativeTimeFutureTime10Hours() { Bundle::start('relativetime'); $time = time() + 36000; $this->assertEquals(RelativeTime::get($time), '10 hours from now'); }
public function testRouteResolution() { Bundle::start('flyswatter'); $this->assertEquals('flyswatter::home@index', Router::route('GET', Bundle::get('flyswatter')['handles'])->action['uses']); }
<?php namespace Vane; \Bundle::$bundles['vane']['ignorePlarx'] = array('Str', 'HLEx', 'Log', 'Event', 'Validator'); if (!\Bundle::exists('plarx')) { throw new Error('Vane requires Plarx bundle installed.'); } else { \Bundle::start('plarx'); \Px\Plarx::supersede(__NAMESPACE__, \Bundle::option('vane', 'ignorePlarx')); } if (!\Bundle::exists('squall')) { throw new Error('Vane requires Squall bundle installed.'); } else { \Bundle::start('squall'); \Squall\initEx(__NAMESPACE__); } \Autoloader::namespaces(array(__NAMESPACE__ => __DIR__ . DS . 'classes')); require_once __DIR__ . DS . 'core.php'; overrideHTMLki('vane::', __NAMESPACE__); // vane::auth[:[!]perm[:[!]perm.2[...]]] [|filter:2 [|...]] // // This filter will always deny access for non-authorized users even if guest // permissions allow for given features - this is so because protected controllers // rely on current user being logged in. \Route::filter('vane::auth', function ($feature_1 = null) { $features = is_array($feature_1) ? $feature_1 : func_get_args(); $block = is_object(end($features)) ? array_pop($features) : null; $user = \Auth::user(); if ($user and !$user instanceof UserInterface) { $msg = "When using vane::auth filter object returned by Auth::user()" . " (" . get_class($user) . " here) must implement Vane\\UserInterface." . " This is not so - returned 403 for user {$user->id}.";
public function __construct() { Bundle::register('groups'); Bundle::start('groups'); }
public function setup() { Bundle::start('theme'); $config = array('theme_path' => 'themes'); $this->theme = new Theme($this->themeName, $config); }
<div>Dilaporkan, {{ AppHelper::date($date_tomorrow, 'j F Y') }}</div> @else <div>Dilaporkan, {{ AppHelper::date($range['end'], 'j F Y') }}</div> @endif <div class="position-sign row-fluid"> <div class="two-third span8">Sekretaris</div> <div class="one-third span4">Bendahara</div> </div> <div class="name-sign"> <div class="two-third span8">{{ $account->secretary }}</div> <div class="one-third span4">{{ $account->treasurer }}</div> </div> <div class="clearfix"></div> <div class="notes"> <?php Bundle::start('sparkdown'); ?> {{ Sparkdown\Markdown($account->announcement); }} </div> </div> @endsection @section('javascript') <script type="text/javascript"> $('.print').click(function(e) { $('#main-container').printElement({ overrideElementCSS: [ { href: '/css/print.css', media:'print'}
/** * Edit item * @return Response */ public function post_edit($id = null) { if (!Auth::can('edit_items')) { Vsession::cadd('y', __('site.not_allowed'))->cflash('status'); return Redirect::to_action('item@list'); } // Input ID if (!$id || !$this->item_exists($id, 'items')) { return Redirect::to_action('item@list'); } $id = trim(filter_var($id, FILTER_SANITIZE_NUMBER_INT)); if (Input::get('submit')) { $rules = array('name' => 'required|max:200', 'category' => 'required|cat_exists', 'code' => 'required|max:50|code_unique:' . $id, 'part_num' => 'required|max:20', 'buying_price' => 'numeric', 'selling_price' => 'numeric', 'location' => 'max:200'); if (Auth::can('upload_item_images')) { $rules['image'] = 'image|mimes:jpg,png,gif'; } $input = Input::all(); $validation = Validator::make($input, $rules); if ($validation->fails()) { Vsession::cadd('r', $validation->errors->first())->cflash('status'); } else { foreach ($input as $key => $value) { $input[$key] = $value !== '' ? trim(filter_var($value, FILTER_SANITIZE_STRING)) : null; } $date = new \DateTime(); DB::table('items')->where('id', '=', $id)->update(array('name' => $input['name'], 'categories_id' => $input['category'], 'code' => $input['code'], 'part_num' => $input['part_num'], 'buying_price' => $input['buying_price'], 'selling_price' => $input['selling_price'], 'location' => $input['location'], 'description' => $input['description'], 'created_at' => $date, 'updated_at' => $date)); if (Auth::can('upload_item_images')) { if (Input::file('image') !== null && Input::file('image.name') !== '') { $path = Config::get('application.upload_path') . DS . 'images' . DS . 'items' . DS . $id . '.' . File::extension(Input::file('image.name')); // Starting resizer Bundle::start('resizer'); $success = Resizer::open(Input::file('image'))->resize(500, 500, 'crop')->save($path, 90); } } Vsession::cadd('g', __('site.st_item_saved'))->cflash('status'); return Redirect::to_action('item@edit/' . $id); } } return $this->get_edit($id); }
public static function setUpBeforeClass() { Bundle::start('squi'); require_once Bundle::path('squi') . 'tests/client.php'; }
| */ Bundle::start(DEFAULT_BUNDLE); /* |-------------------------------------------------------------------------- | Auto-Start Other Bundles |-------------------------------------------------------------------------- | | Bundles that are used throughout the application may be auto-started | so they are immediately available on every request without needing | to explicitly start them within the application. | */ foreach (Bundle::$bundles as $bundle => $config) { if ($config['auto']) { Bundle::start($bundle); } } /* |-------------------------------------------------------------------------- | Register The Catch-All Route |-------------------------------------------------------------------------- | | This route will catch all requests that do not hit another route in | the application, and will raise the 404 error event so the error | can be handled by the developer in their 404 event listener. | */ Routing\Router::register('*', '(:all)', function () { return Event::first('404'); });
/** * Start and setup the Placeholdr bundle if not already started. * * @return null */ public function __construct() { Bundle::start('placeholdr'); }