本文整理汇总了PHP中Bundle类的典型用法代码示例。如果您正苦于以下问题:PHP Bundle类的具体用法?PHP Bundle怎么用?PHP Bundle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Bundle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
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('kamers@kamergenood.nl', '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);
});
}
}
示例2: setUp
/**
* 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'));
}
示例3: __destruct
public function __destruct()
{
Bundle::disable('email');
Bundle::disable('settings');
Bundle::disable('modules');
Bundle::disable('navigation');
}
示例4: tearDown
/**
* Destroy the testing environment.
*/
public function tearDown()
{
Bundle::$started = array();
Bundle::$routed = array();
Router::$names = array();
Router::$routes = array();
}
示例5: get_links_tree
/**
* Build a multi-array of parent > children.
*
* @return array An array representing the page tree.
*/
public function get_links_tree()
{
if (\Bundle::exists('pages')) {
$all_links = Link::with('page')->order_by('order', 'asc')->get(array('id', 'group_id', 'title', 'class'));
} else {
$all_links = Link::order_by('order', 'asc')->get(array('id', 'group_id', 'title', 'class'));
}
// First, re-index the array.
foreach ($all_links as $row) {
$pages[$row->id] = array('id' => $row->id, 'li_id' => 'link_', 'link_type' => $row->link_type, 'rel' => $row->navigation_group_id, 'parent_id' => $this->id, 'title' => $row->title, 'url' => $row->url, 'target' => $row->target, 'class' => $row->class);
}
unset($all_links);
// Build a multidimensional array of parent > children.
foreach ($pages as $row) {
if (array_key_exists($row['parent_id'], $pages)) {
// Add this page to the children array of the parent page.
$pages[$row['parent_id']]['children'][] =& $pages[$row['id']];
}
// This is a root page.
if ($row['parent_id'] == 0) {
$page_array[] =& $pages[$row['id']];
}
}
return $page_array;
}
示例6: testIssues
public function testIssues()
{
Bundle::start('flyswatter');
// Seed Database
Controller::call('flyswatter::seed@seed');
$issue = Issue::find(1);
$this->assertNotNull($issue->id);
}
示例7: _getSeedFolders
/**
* @return array of paths that we can find seeds
*/
protected function _getSeedFolders()
{
$bins = array(path('app') . 'seeds' . DIRECTORY_SEPARATOR);
foreach (Bundle::$bundles as $bundle) {
$bins[] = Bundle::path($bundle['location']) . 'seeds' . DIRECTORY_SEPARATOR;
}
return $bins;
}
示例8: users
public function users()
{
if (\Bundle::exists('permissions')) {
return $this->has_many('Users\\Model\\User');
} else {
throw new \Exception('Permissions module is not installed. To call goups with users you must install the permissions module.');
}
}
示例9: send
/**
* 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);
}
示例10: group
public function group()
{
if (\Bundle::exists('groups')) {
return $this->belongs_to('Groups\\Model\\Group');
} else {
throw new \Exception('Groups module is not installed. To call users with group you must install the groups module.');
}
}
示例11: path
/**
* Get the path to a view on disk.
*
* @param $view
*
* @return string
* @throws \Exception
*/
protected function path($view)
{
$root = \Bundle::path(\Bundle::name($view)) . 'views';
$path = $root . DS . \Bundle::element($view);
if (file_exists($path)) {
return $path;
}
throw new \Exception("View [{$view}] does not exist.");
}
示例12: get_new
public function get_new()
{
$this->data['section_bar_active'] = __('email::lang.Send Email')->get(ADM_LANG);
$this->data['groups_dropdown'] = null;
if (Bundle::exists('groups')) {
$this->data['groups_dropdown'] = Groups\Model\Group::all();
}
$this->data['email_templates'] = Email\Model\Template::all();
return $this->theme->render('email::email.new', $this->data);
}
示例13: getUsers
private function getUsers($name)
{
try {
$users = $this->model->getUsersWithName($name);
$this->values->users = $users;
$this->values->name = $name;
} catch (NoResultException $e) {
$this->request->error = Bundle::get('friends.users.not.found', $name);
}
}
示例14: post_process
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';
}
示例15: build
/**
* Create requested Form Object.
* @author anza
* @param string $form Name of Form Object to be created.
* @throws FormNotFoundException When impossible to find class of Form Object.
* @return New Form Object if its class exists.
*/
public static function build($form)
{
try {
$fo = $form . self::FO;
if (class_exists($fo)) {
return new $fo();
}
} catch (LogicException $e) {
throw new FormNotFoundException(Bundle::get('form.validation.form.not.found', $fo));
}
}