本文整理汇总了PHP中Output类的典型用法代码示例。如果您正苦于以下问题:PHP Output类的具体用法?PHP Output怎么用?PHP Output使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Output类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: AlbumChart
public function AlbumChart($uri)
{
$log = new Logger("./log.txt");
$request = new ImgRequest($uri);
if ($request->isMalformed()) {
$log->logGeneration($request, $hostid, true);
$log->logString(" ERROR: " . $request->getMalformedString());
die($request->getMalformedString() . (SITE != '' ? "<br />Please see " . SITE . " for further help" : ""));
}
if ($request->getCharttype() == "group") {
$log->logGeneration($request, $hostid, true);
$log->logString(" ERROR: Groupcharts disabled");
die("Groupcharts are no longer supported!");
}
$userfeed = new UserFeed($request->getRawusername(), $request);
$albumlist = new AlbumList();
$i = 0;
while (($album = $userfeed->getNextItem()) && $i < $request->getCount()) {
$albumfeed = new AlbumFeed($album);
if (!$albumfeed->isValid()) {
continue;
}
$albumlist->addItem($albumfeed->getImageUrl());
unset($albumfeed);
$i++;
}
$image = new ImgGenerator($albumlist, $request);
$log->logGeneration($request);
$output = new Output($image, $request);
if ($output->getFileExists()) {
$log->logString(" WARNING: File Existed!");
}
}
示例2: processRequest
/**
* This file is a part of MyWebSQL package
*
* @file: modules/download.php
* @author Samnan ur Rehman
* @copyright (c) 2008-2012 Samnan ur Rehman
* @web http://mywebsql.net
* @license http://mywebsql.net/license
*/
function processRequest(&$db)
{
if (!ini_get('safe_mode')) {
set_time_limit(0);
}
Session::close();
switch ($_REQUEST['id']) {
case 'backup':
include_once BASE_PATH . "/config/backups.php";
$compression = v($_REQUEST['compression']);
$file = get_backup_filename($compression);
include_once BASE_PATH . "/lib/output.php";
$output = new Output($file, $compression);
$message = '<div class="message ui-state-highlight">' . __('Database backup successfully created') . '</div>';
if ($output->is_valid()) {
downloadDatabase($db, false);
$output->end();
} else {
$message = '<div class="error ui-state-highlight">' . __('Failed to create database backup') . '</div>';
}
echo view('backup', array('MESSAGE' => $message), $db->getObjectList());
break;
case 'exportres':
downloadResults($db);
break;
case 'exporttbl':
downloadTable($db, $_REQUEST['name']);
break;
case 'export':
downloadDatabase($db);
break;
}
}
示例3: renderForConsole
/**
* @param Output $output
* @param Exception $e
*/
public function renderForConsole(Output $output, Exception $e)
{
if (\Norma\App::$debug) {
$output->setVerbosity(Output::VERBOSITY_DEBUG);
}
(new Console())->renderException($e, $output);
}
示例4: id
function id($id)
{
$OUTPUT = new Output();
// save to array of ids that have been looked up thus far
// look up permissions and check if user is a member of any groups that have permissions
$OUTPUT->error(3, "Insufficient Document Level Privleges");
// if document does not exist in this collection, add it to the collection
}
示例5: permission
private function permission($rule = 0, $permission = null)
{
$OUTPUT = new Output();
if ($rule > 1 && $this->role < $rule) {
// Something About the logic here is not working.
if (!is_null($permission) && is_array($this->permissions)) {
if (!in_array($permission, $this->permissions)) {
$OUTPUT->error(1, "Insufficient Priveleges");
}
} else {
$OUTPUT->error(1, "Insufficient Priveleges");
}
}
}
示例6: __construct
function __construct($id = null)
{
if (!is_null($id)) {
if ($this->valid_id($id)) {
session_id($id);
} else {
$OUTPUT = new Output();
$OUTPUT->error(2, "Session_id is invalid");
}
}
if (!$this->session_active()) {
session_start();
}
$this->id = session_id();
}
示例7: action_index
public function action_index() {
$menuitems = "";
$fkey = 0;
foreach ($this->items as $item) {
$text = $type = $noajax = $picture = $right = '';
extract($item);
//echo $type."_".$right;
if ($this->parent) {
$righttype = get_class($this->parent) . '_' . $type;
} else {
$righttype = $type;
}
if ($right and !Auth::getInstance()->getRights($righttype,'view'))
continue;
if ($type == "newline") {
//$menuitems .= "</tr><tr>";
} else {
$uri = new UriConstructor();
$uri->clear();
Output::assign('hotkey', $fkey++<11?"Ctrl + f{$fkey }":"");
Output::assign('text',$text);
Output::assign('hyphertext',hypher::addhypher($text));
Output::assign('ajax',($item[noajax]?'':"data-silent='{$this->parent->getMainTarget()}' legotarget='{$this->parent->getName()}'"));
Output::assign('type',$type);
Output::assign('url',$uri->set($this->parent->getName(),$type)->url());
Output::assign('selected',($this->parent->getAction()==$type?" menu-item-sel":""));
Output::assign('picture', (empty($picture) ? "" : "style='background-image: URL(\"/picture/{$picture}\");'"));
$menuitems .= $this->fetch('menu_item.tpl');
}
}
Output::assign('menuitems',$menuitems);
return $this->fetch('menu.tpl');
}
示例8: response
protected function response($data = array(), $http_code = 200)
{
if (empty($data))
{
\Output::$status = 404;
return;
}
\Output::$status = $http_code;
// If the format method exists, call and return the output in that format
if (method_exists('Controller_Rest', '_format_'.$this->request->format))
{
// Set the correct format header
\Output::set_header('Content-Type', $this->_supported_formats[$this->request->format]);
$this->output = $this->{'_format_'.$this->request->format}($data);
}
// Format not supported, output directly
else
{
$this->output = (string) $data;
}
}
示例9: postIndex
public function postIndex()
{
$input = Input::only('first_name', 'last_name', 'email', 'username', 'password', 'domain_id');
$domain_id = Cookie::get('domain_hash') ? Cookie::get('domain_hash') : 'NULL';
$rules = array('first_name' => 'required|min:1', 'email' => 'required|email|unique:users,email,NULL,id,deleted_at,NULL,domain_id,' . $domain_id, 'username' => 'required|min:3|must_alpha_num|unique:users,username,NULL,id,deleted_at,NULL,domain_id,' . $domain_id, 'password' => 'required|min:6');
$v = Validator::make($input, $rules);
if ($v->fails()) {
return Output::push(array('path' => 'register', 'errors' => $v, 'input' => TRUE));
}
$profile = new Profile(array('first_name' => $input['first_name'], 'last_name' => $input['last_name'], 'website' => ''));
$profile->save();
$user = new User(array('domain_id' => Cookie::get('domain_hash') ? Cookie::get('domain_hash') : NULL, 'email' => $input['email'], 'username' => $input['username'], 'password' => Hash::make($input['password']), 'status' => Cookie::get('domain_hash') ? 4 : 3));
$user->profile()->associate($profile);
$user->save();
if ($user->id) {
if ($user->status == 4) {
$this->add_phone_number($user->id);
}
$cookie = Cookie::forget('rndext');
$confirmation = App::make('email-confirmation');
$confirmation->send($user);
Mail::send('emails.register', array('new_user' => $input['username']), function ($message) {
$message->from(Config::get('mail.from.address'), Config::get('mail.from.name'))->to(Input::get('email'))->subject(_('New user registration'));
});
Event::fire('logger', array(array('account_register', array('id' => $user->id, 'username' => $user->username), 2)));
// return Output::push(array(
// 'path' => 'register',
// 'messages' => array('success' => _('You have registered successfully')),
// ));
return Redirect::to('register')->with('success', _('You have registered successfully'))->withCookie($cookie);
} else {
return Output::push(array('path' => 'register', 'messages' => array('fail' => _('Fail to register')), 'input' => TRUE));
}
}
示例10: postReset
/**
* Handle a POST request to reset a user's password.
*
* @return Response
*/
public function postReset()
{
$credentials = Input::only('email', 'password', 'token');
//hack password_confirmation for package
$credentials['password_confirmation'] = $credentials['password'];
$rules = array('email' => 'required|email', 'password' => 'required|min:6', 'token' => 'required');
$v = Validator::make($credentials, $rules);
if ($v->fails()) {
return Output::push(array('path' => 'password/reset', 'errors' => $v, 'input' => TRUE));
}
//new style
$validtoken = $this->_isValidToken($credentials['email'], $credentials['token']);
if ($validtoken) {
$id = $this->_getUserId($credentials['email']);
if ($id) {
$user = user::find($id);
//$user->username = $input['username'];
$user->email = $credentials['email'];
if ($credentials['password']) {
$user->password = Hash::make($credentials['password']);
Event::fire('logger', array(array('account_password_update', array('id' => $id, 'username' => $user->username), 2)));
}
$user->save();
return Output::push(array('path' => 'login', 'messages' => array('success' => _('Password has been reset'))));
} else {
return Output::push(array('path' => 'password/recovery', 'messages' => array('fail' => _('Unable to process password reset'))));
}
} else {
return Output::push(array('path' => 'password/recovery', 'messages' => array('fail' => _('Invalid token'))));
}
}
示例11: fetch
/**
* Отрисовать по шаблону
* @param String $template
* @param array $date
* @return String
*/
public function fetch($template, $data = false)
{
// найти шаблон, он может быть и у любого потомка этого класса, они же и друг от друга наследуют
$dir = $this->dir;
$class = get_class($this);
while (!file_exists($dir . '/' . $template) && !file_exists($template)) {
$class = get_parent_class($class);
if ($class) {
$ref = new ReflectionClass($class);
if (!$ref->isAbstract()) {
$obj = new $class();
$dir = $obj->getDir();
}
} else {
return '';
}
}
// Если переданы данные, сделать обозначения
if ($data !== false) {
foreach ($data as $key => $value) {
Output::assign($key, $value);
}
}
$templatedir = Output::getTemplateCompiler()->getTemplateDir();
Output::getTemplateCompiler()->setTemplateDir($dir);
$content = Output::fetch($template);
Output::getTemplateCompiler()->setTemplateDir($templatedir);
return $content;
}
示例12: showrec
public function showrec($rec)
{
$out = '';
Output::assign('linkclass', 'path');
Output::assign('sllink', "file://" . $rec[path]);
Output::assign('type', 'Путь к блоку');
Output::assign('slid', '');
$out .= $this->fetch('link.tpl');
Output::assign('type', 'СЛ-');
Output::assign('sllink', $rec[sl][link]);
Output::assign('slid', $rec[sl][id]);
Output::assign('linkclass', 'filelink');
$out .= $this->fetch('link.tpl');
Output::assign('type', 'ТЗ-');
Output::assign('sllink', $rec[tz][link]);
Output::assign('slid', $rec[tz][id]);
$out .= $this->fetch('link.tpl');
$out .= "Письма: " . $rec[letter][link];
// Добавить информацию о платах в блоке
foreach ($rec[boards] as $value) {
$files = $value[filelinks][link];
$out .= $this->fetch('board.tpl', array('boardname' => $value["board_name"], 'filelinks' => $files));
}
Output::assign('dozaplink', $rec[dozaplink]);
Output::assign('filelinks', $out);
$out = $this->fetch('dozap.tpl');
$out .= "<script>\$('form[name=dozap]').submit(function(){\n \$().lego.load('lanch_nzap', \$(this).attr('action'),\$(this).serialize());\n reload_table();\n return false;\n });</script>";
$out .= $this->addComments($rec[id], 'lanch');
return $out;
}
示例13: save
function save()
{
//echoPre($_POST);die;
if ($_POST) {
$dt = array('popup_id' => post('popup_id') != '' ? post('popup_id') : '', 'popup_schedule_start' => post('popup_schedule_start') != '' ? trim(post('popup_schedule_start')) : '', 'popup_schedule_end' => post('popup_schedule_end') != '' ? trim(post('popup_schedule_end')) : '', 'popup_wording' => post('popup_wording') != '' ? strip_tags(post('popup_wording')) : '', 'popup_status' => post('popup_status') != '' ? trim(post('popup_status')) : '', 'popup_url' => post('popup_url') != '' ? trim(post('popup_url')) : '');
$modeUpdate = false;
if ($dt['popup_id'] == '') {
//insert quote
unset($dt['popup_id']);
$popup_id = $this->popup_model->insert_data($dt);
} else {
//update quote
$modeUpdate = true;
$popup_id = $this->popup_model->update_data($dt, $dt['popup_id']);
$popup_id = $dt['popup_id'];
$server_cluster = $this->config['server_cluster'];
foreach ($server_cluster as $serv) {
$json = file_get_contents($serv . 'update-json/popup');
//echo $serv . 'update-json/popup';
//echoPre($json);
}
}
$dt['popup_url'] = $dt['popup_url'] != '' ? $dt['popup_url'] : url_title($popup_id . ' ' . $dt['popup_wording']);
$this->_prosesImageQuote($dt, $popup_id);
Output::App()->redirect($this->config['base_url'] . $this->ctrler . '/&s=success');
} else {
Output::App()->redirect($this->config['base_url'] . $this->ctrler . '/&s=failed');
exit;
}
}
示例14: printMessage
/**
* Print message through output object
*
* @param string $message
* @param boolean $is_error
* @return null
*/
function printMessage($message, $is_error = false)
{
if ($this->output instanceof Output) {
$this->output->printMessage($message, $is_error);
}
// if
}
示例15: run
/**
* Execute the given command
*
* @param string $command Command to execute
* @param array $args Arguments for command
*
* @return mixed $return Command output
*/
public function run($command, $args = null)
{
Output::msg('Executing command: "' . $command . '"');
// filter the command
$command = escapeshellcmd($command);
$descSpec = array(0 => array('pipe', 'r'), 1 => array('pipe', 'w'), 2 => array('pipe', 'w'));
$pipes = null;
$return = null;
$process = proc_open($command, $descSpec, $pipes);
if (is_resource($process)) {
$return = stream_get_contents($pipes[1]);
if (empty($return)) {
// probably some sort of error
if (is_resource($pipes[2])) {
$err = trim(stream_get_contents($pipes[2]));
fclose($pipes[2]);
throw new \Exception($err);
}
}
fclose($pipes[1]);
$returnCode = proc_close($process);
Output::msg("Execution result:\n" . $return);
}
return $return;
}