本文整理汇总了PHP中Package::load方法的典型用法代码示例。如果您正苦于以下问题:PHP Package::load方法的具体用法?PHP Package::load怎么用?PHP Package::load使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Package
的用法示例。
在下文中一共展示了Package::load方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setup
/**
* Setup the test
*/
public function setup()
{
\Package::load('hybrid');
\Config::load('autho', 'autho');
\Config::set('autho.hash_type', 'sha1');
\Config::set('autho.salt', '12345');
}
示例2: before
public function before()
{
parent::before();
// Load Exchange package
\Package::load('Skills');
$this->skills = \Skills\Skills::forge();
}
示例3: action_index
/**
*
*/
public function action_index()
{
Package::load('oil');
\Oil\Generate_Scaffold::forge(['page1', 'title:string', 'content:text'], "orm");
$this->title = 'Backend Dashboard';
$this->template->content = Presenter::forge('backend/page');
}
示例4: sendEmail
public static function sendEmail(EmailOptions $emailOptions)
{
// Load FuelPHP Email Package
\Package::load("email");
// Create an Email instance
$email = \Email\Email::forge();
// Set the "email to"
foreach ($emailOptions->to as $to) {
$email->to($to);
}
// Set the subject
$email->subject($emailOptions->subject);
// And set the body.
$view = \View::forge('emails/' . $emailOptions->emailTypeName, $emailOptions->vars);
$email->html_body($view);
// Try sending the email
try {
$response = $email->send();
} catch (\EmailValidationFailedException $e) {
$response = false;
} catch (\EmailSendingFailedException $e) {
$response = false;
} catch (\Exception $e) {
$response = false;
}
return $response;
}
示例5: post_parse_payments
public function post_parse_payments()
{
$config = array('path' => DOCROOT . 'uploads/csv', 'randomize' => true, 'ext_whitelist' => array('csv'));
Upload::process($config);
if (Upload::is_valid()) {
//Upload::save();
$file = Upload::get_files();
$uploaded_file = $file[0]['file'];
Package::load("excel");
$excel = PHPExcel_IOFactory::createReader('CSV')->setDelimiter(',')->setEnclosure('"')->setLineEnding("\n")->setSheetIndex(0)->load($uploaded_file);
$objWorksheet = $excel->setActiveSheetIndex(0);
$highestRow = $objWorksheet->getHighestRow();
$highestColumn = $objWorksheet->getHighestColumn();
$highestColumnIndex = PHPExcel_Cell::columnIndexFromString($highestColumn);
//read from file
for ($row = 1; $row <= $highestRow; ++$row) {
$file_data = array();
for ($col = 0; $col <= $highestColumnIndex; ++$col) {
$value = $objWorksheet->getCellByColumnAndRow($col, $row)->getValue();
$file_data[$col] = trim($value);
}
$result[] = $file_data;
}
print_r($result);
} else {
print "Invalid uploads";
}
}
示例6: logger
function logger($level, $msg, $method = null)
{
static $labels = array(100 => 'DEBUG', 200 => 'INFO', 250 => 'NOTICE', 300 => 'WARNING', 400 => 'ERROR', 500 => 'CRITICAL', 550 => 'ALERT', 600 => 'EMERGENCY', 700 => 'ALL');
// make sure $level has the correct value
if (is_int($level) and !isset($labels[$level]) or is_string($level) and !array_search(strtoupper($level), $labels)) {
throw new \FuelException('Invalid level "' . $level . '" passed to logger()');
}
// get the levels defined to be logged
$loglabels = \Config::get('log_threshold');
// bail out if we don't need logging at all
if ($loglabels == \Fuel::L_NONE) {
return false;
}
// if profiling is active log the message to the profile
if (\Config::get('profiling')) {
\Console::log($method . ' - ' . $msg);
}
// if it's not an array, assume it's an "up to" level
if (!is_array($loglabels)) {
$a = array();
foreach ($labels as $l => $label) {
$l >= $loglabels and $a[] = $l;
}
$loglabels = $a;
}
// do we need to log the message with this level?
if (!in_array($level, $loglabels)) {
return false;
}
!class_exists('Log') and \Package::load('log');
return \Log::instance()->log($level, (empty($method) ? '' : $method . ' - ') . $msg);
}
示例7: __construct
/**
* Initialize class and forge a Sprockets Instance
*/
public function __construct()
{
!\Package::loaded('sprockets') and \Package::load('sprockets');
// When in console mode, DOCROOT is the path to the project root, not the public/
$config = array('asset_compile_dir' => DOCROOT . 'public/assets/', 'force_minify' => true);
static::$sprockets = \Sprockets::forge('default', $config);
}
示例8: create_user
public function create_user($userdata)
{
$password = \Arr::get($userdata, 'password', null);
$email = \Arr::get($userdata, 'email', null);
if (is_null($password) || is_null($email)) {
Logger::instance()->log_log_in_attempt(Model_Log_In_Attempt::$ATTEMPT_BAD_CRIDENTIALS, $email);
throw new LogInFailed(\Lang::get('ethanol.errors.loginInvalid'));
}
$user = Auth_Driver::get_core_user($email);
$security = new Model_User_Security();
//Generate a salt
$security->salt = Hasher::instance()->hash(\Date::time(), Random::instance()->random());
$security->password = Hasher::instance()->hash($password, $security->salt);
if (\Config::get('ethanol.activate_emails', false)) {
$keyLength = \Config::get('ethanol.activation_key_length');
$security->activation_hash = Random::instance()->random($keyLength);
$user->activated = 0;
//Send email
\Package::load('email');
//Build an array of data that can be passed to the email template
$emailData = array('email' => $user->email, 'activation_path' => \Str::tr(\Config::get('ethanol.activation_path'), array('key' => $security->activation_hash)));
$email = \Email::forge()->from(\Config::get('ethanol.activation_email_from'))->to($user->email, $user->username)->subject(\Config::get('ethanol.activation_email_subject'))->html_body(\View::forge('ethanol/activation_email', $emailData))->send();
} else {
$user->activated = 1;
$security->activation_hash = '';
}
$user->security = $security;
$user->save();
$user->clean_security();
return $user;
}
示例9: before
public function before()
{
parent::before();
// Load Slills package
\Package::load('Skills');
$this->skillsPackage = \Skills\Skills::forge();
}
示例10: before
public function before()
{
parent::before();
$this->template->title = "Rodasnet.com";
$this->template->pageTitle = "Get in contact with Daniel.";
// Load Contacts package
\Package::load('Contacts');
$this->ServiceContacts = \Contacts\Contacts::forge();
}
示例11: action_recover
public function action_recover($hash = null)
{
if (Input::Method() === "POST") {
if ($user = \Model\Auth_User::find_by_email(Input::POST('email'))) {
// generate a recovery hash
$hash = \Auth::instance()->hash_password(\Str::random()) . $user->id;
// and store it in the user profile
\Auth::update_user(array('lostpassword_hash' => $hash, 'lostpassword_created' => time()), $user->username);
// send an email out with a reset link
\Package::load('email');
$email = \Email::forge();
$html = 'Your password recovery link <a href="' . Uri::Create('login/recover/' . $hash) . '">Recover My Password!</a>';
// use a view file to generate the email message
$email->html_body($html);
// give it a subject
$email->subject(\Settings::Get('site_name') . ' Password Recovery');
// GET ADMIN EMAIL FROM SETTINGS?
$admin_email = Settings::get('admin_email');
if (empty($admin_email) === false) {
$from = $admin_email;
} else {
$from = 'support@' . str_replace('http:', '', str_replace('/', '', Uri::Base(false)));
}
$email->from($from);
$email->to($user->email, $user->fullname);
// and off it goes (if all goes well)!
try {
// send the email
$email->send();
Session::set('success', 'Email has been sent to ' . $user->email . '! Please check your spam folder!');
} catch (\Exception $e) {
Session::Set('error', 'We failed to send the eamil , contact ' . $admin_email);
\Response::redirect_back();
}
} else {
Session::Set('error', 'Sorry there is not a matching email!');
}
} elseif (empty($hash) === false) {
$hash = str_replace(Uri::Create('login/recover/'), '', Uri::current());
$user = substr($hash, 44);
if ($user = \Model\Auth_User::find_by_id($user)) {
// do we have this hash for this user, and hasn't it expired yet , must be within 24 hours
if (isset($user->lostpassword_hash) and $user->lostpassword_hash == $hash and time() - $user->lostpassword_created < 86400) {
// invalidate the hash
\Auth::update_user(array('lostpassword_hash' => null, 'lostpassword_created' => null), $user->username);
// log the user in and go to the profile to change the password
if (\Auth::instance()->force_login($user->id)) {
Session::Set('current_password', Auth::reset_password($user->username));
Response::Redirect(Uri::Create('user/settings'));
}
}
}
Session::Set('error', 'Invalid Hash!');
}
$this->template->content = View::forge('login/recover');
}
示例12: render
/**
* Overrides uc_product_handler_field_weight::render().
*/
public function render($values)
{
$package = Package::load($values->{$this->aliases['package_id']});
if ($this->options['format'] == 'numeric') {
return $package->weight;
}
if ($this->options['format'] == 'uc_weight') {
return uc_weight_format($package->weight, $package->weight_units);
}
}
示例13: sendmail
protected function sendmail($data)
{
Package::load('email');
$email = Email::forge();
$email->from($data['from'], $data['from_name']);
$email->to($data['to'], $data['to_name']);
$email->subject($data['subject']);
$email->body($data['body']);
$email->send();
}
示例14: __construct
public function __construct($order)
{
\Package::load('email');
// Load email addresses from config (these will be bcc receivers)
\Config::load('auto_response_emails', 'autoresponders');
$bcc = \Config::get('autoresponders.order_emails', false);
if (!$bcc) {
$bcc = \Config::get('autoresponders.default_emails', false);
}
$this->emailData = $this->createEmailData($order, $bcc);
}
示例15: action_get_one
public function action_get_one($id = 1)
{
$timeStart = microtime(true);
$memoryStart = memory_get_usage();
Package::load('orm');
$post = Model_Fuel_Orm_Post::find($id);
echo $post->title . '<br>' . "\n";
$comment = array_shift($post->comments);
echo $comment->body . '<br>' . "\n";
echo microtime(true) - $timeStart . " secs<br>\n";
echo (memory_get_usage() - $memoryStart) / 1024 . " KB\n";
}