本文整理汇总了PHP中Render::text方法的典型用法代码示例。如果您正苦于以下问题:PHP Render::text方法的具体用法?PHP Render::text怎么用?PHP Render::text使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Render
的用法示例。
在下文中一共展示了Render::text方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: html_interface
public function html_interface($params = [])
{
Session::permit_admin();
$data = ['items' => Util::parse_html_interface()];
$template = new Template(MD . 'templates/html_interface.html');
Render::text($template->render($data));
}
示例2: order_request
public function order_request($params = [])
{
$quote = Quote::read_by_params($params);
if (!isset($quote['id'])) {
Render::error_404();
}
$order = $params;
$order += $quote;
$order['country'] = Util::get_countries()[$order['country']];
$order['payment'] = Util::get_payments()[$order['payment']];
if (!isset($order['po'])) {
$order['po'] = '';
}
$body = Template::render_doc_by_name('order-email', $order);
// send order request to "WinWrap Web Primary/web.primary@winwrap.com"
$linkc = 'https://www.winwrap.com/web/basic/support/admin/new_company.asp' . '?license=16' . '&company=' . urlencode($order['company']) . '&country=' . urlencode($order['country']) . '&billingaddress=' . urlencode(str_replace("\r\n", '|', $order['address'])) . '&billingname=' . urlencode($order['billing_name']) . '&billingaddr=' . urlencode($order['billing_email']) . '&billingphone=' . urlencode($order['billing_phone']) . '&name=' . urlencode($order['technical_name']) . '&addr=' . urlencode($order['technical_email']);
$link = 'https://www.winwrap.com/web/basic/support/admin/new_fees.asp' . '?licenseid=' . '&company=' . urlencode($order['company']) . '&feecount=0' . '&payment=' . urlencode($order['payment']) . '&po=' . urlencode($order['po']);
if (!is_null($quote['discount'])) {
$link .= '&WWXX00=' . urlencode($quote['discount']) . '&WWXX00_DESC=' . urlencode($quote['discount_desc']);
}
$problem = false;
$parts = [];
foreach ($quote['items'] as $item) {
$link .= '&' . $item['part'] . '=' . $item['quantity'];
$part = substr($item['part'], 0, 6);
if (array_search($part, $parts)) {
$problem = true;
} else {
$parts[] = $part;
}
if (isset($item['override'])) {
$link .= '&' . $part . '-override=' . $item['override'];
}
}
$bodyc = '1) Click on this link to create the new company:' . "\r\n" . $linkc . "\r\n\r\n";
if ($problem) {
$bodyc .= '*** the following link will not create the correct fees ***' . "\r\n";
}
$bodyc .= '2) Click on this link to create the fees and invoice:' . "\r\n" . $link . "\r\n\r\n" . $body;
$args = ['IP: ' . $_SERVER['REMOTE_ADDR'] . "\r\n\r\n" . 'toname' => 'WinWrap Web Primary', 'toemail' => 'web.primary@winwrap.com', 'fromname' => 'WinWrap Web Primary', 'fromemail' => 'web.primary@winwrap.com', 'subject' => 'WinWrap Basic Order Request', 'body' => $bodyc];
if (GoogleMail::send($args) !== true) {
header('Status: 500');
return;
}
$status = '1/2: send to ' . $args['toemail'] . "\r\n";
//echo '<pre>' . $body . '</pre>'; exit;
// send order request to puchaser
$args = ['toname' => $order['billing_name'], 'toemail' => $order['billing_email'], 'fromname' => 'WinWrap Support', 'fromemail' => 'support@mail.winwrap.com', 'subject' => 'WinWrap Basic Order Request', 'body' => $body];
if (GoogleMail::send($args) !== true) {
header('Status: 500');
return;
}
$status .= '2/2: send to ' . $args['toemail'];
Render::text($status);
}
示例3: template
public function template($params = [])
{
Render::text(Doc::by_name($params['name'])['content']);
}
示例4: download
public function download($params = [])
{
//echo '<pre>'; print_r($params); echo '</pre>'; exit;
$setups_map = ['NET' => ['setup-4.0.msi' => 'WinWrap-NET4.0-setup.msi'], 'WPF' => ['setup-4.0-wpf.msi' => 'WinWrap-WPF4.0-setup.msi'], 'AZW' => ['setup-4.0-azw.msi' => 'WinWrap-AZW4.0-setup.msi'], 'COM' => ['setup32.msi' => 'WinWrap-COM32-setup.msi', 'setup64.msi' => 'WinWrap-COM64-setup.msi']];
$all = [];
foreach ($setups_map as $setup_map) {
$all += $setup_map;
}
//$setups_map['ALL'] = $all; // disable for now (1/8/15)
// select the platform's setup_map
$platform = $params['platform'];
$setup_map = $setups_map[$platform];
if (!isset($setup_map)) {
error_404();
}
// select the evaluator
$key = $params['key'];
$evaluator = Evaluator::read_by_key($key);
//Render::json($evaluator); exit; // debug
$error = false;
if (!isset($evaluator['id'])) {
$error = 'Invalid evaluator key.';
} else {
if (Util2::expired($evaluator['agreement_date'], 60, $evaluator['expiration_date'])) {
$error = 'Evaluation period has expired.';
}
}
if ($error) {
Render::html(Doc::by_name('message')['content'], ['title' => 'Download Request Failed', 'message' => $error]);
return;
}
// create evaluator cerificate
$readme = Template::render_doc_by_name('evaluate-readme');
$certificate = new Certificate();
$certificate->set_by_evaluator($evaluator, true);
// add download record
$version = file_get_contents(EVALDIR . 'version.txt');
$model = ['evaluator_id' => $evaluator['id'], 'ip' => $_SERVER['REMOTE_ADDR'], 'platform' => $platform != 'ALL' ? $platform : implode(',', array_keys($setups_map)), 'version' => $version];
$download = EvaluatorDownload::create($model);
// create signed certificate
$html = $certificate->sign();
//Render::text($_SERVER['HTTP_HOST'] . SUBDIR . "\r\n" . $html); exit;
// create a temporary file
$path = tempnam("tmp", "zip");
$zipname = 'WinWrap-Basic-Evaluation-' . $platform;
$zip = new ZipArchive();
$okay = $zip->open($path, ZipArchive::CREATE | ZipArchive::OVERWRITE);
$okay |= $zip->addEmptyDir($zipname);
$okay |= $zip->addFromString($zipname . '/readme.htm', $readme);
$okay |= $zip->addFromString($zipname . '/Evaluation.htm', $html);
$okay |= $zip->addFromString($zipname . '/version.txt', $version);
foreach ($setup_map as $setup => $name) {
$okay |= $zip->addFile(EVALDIR . $setup, $zipname . '/' . $name);
}
$okay |= $zip->close();
if (!$okay) {
Render::text("ZipArchive failed.");
return;
}
//$contents = file_get_contents($path);
//file_put_contents(TEMPDIR . 'x.zip', $contents);
// send zip file
if (true) {
header('Cache-Control: max-age=288000');
header('Content-Description: File Transfer');
header('Content-Type: application/zip');
//header("Content-Type: application/force-download");
header('Content-Length: ' . filesize($path));
header('Content-Transfer-Encoding: binary');
header('Content-Disposition: attachment; filename="' . $zipname . '.zip"');
ob_end_flush();
readfile($path);
}
unlink($path);
// set download date
$update = ['download_date' => gmdate('Y-m-d')];
EvaluatorDownload::update($update, $download['id']);
// done
exit;
}