本文整理汇总了PHP中Renderer::render方法的典型用法代码示例。如果您正苦于以下问题:PHP Renderer::render方法的具体用法?PHP Renderer::render怎么用?PHP Renderer::render使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Renderer
的用法示例。
在下文中一共展示了Renderer::render方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFinishedSniplet
public static function getFinishedSniplet()
{
$taoExt = common_ext_ExtensionsManager::singleton()->getExtensionById('tao');
$tpl = $taoExt->getConstant('DIR_VIEWS') . 'templates' . DIRECTORY_SEPARATOR . 'snippet' . DIRECTORY_SEPARATOR . 'finishService.tpl';
$renderer = new Renderer($tpl);
return $renderer->render();
}
示例2: getAuthoring
/**
* @deprecated
* @see taoTests_models_classes_TestModel::getAuthoring()
*/
public function getAuthoring(core_kernel_classes_Resource $test)
{
$ext = common_ext_ExtensionsManager::singleton()->getExtensionById('taoWfTest');
$testService = taoTests_models_classes_TestsService::singleton();
$itemSequence = array();
$itemUris = array();
$i = 1;
foreach ($testService->getTestItems($test) as $item) {
$itemUris[] = $item->getUri();
$itemSequence[$i] = array('uri' => tao_helpers_Uri::encode($item->getUri()), 'label' => $item->getLabel());
$i++;
}
// data for item sequence, terrible solution
// @todo implement an ajax request for labels or pass from tree to sequence
$allItems = array();
foreach ($testService->getAllItems() as $itemUri => $itemLabel) {
$allItems['item_' . tao_helpers_Uri::encode($itemUri)] = $itemLabel;
}
$widget = new Renderer($ext->getConstant('DIR_VIEWS') . 'templates' . DIRECTORY_SEPARATOR . 'authoring.tpl');
$widget->setData('uri', $test->getUri());
$widget->setData('allItems', json_encode($allItems));
$widget->setData('itemSequence', $itemSequence);
// data for generis tree form
$widget->setData('relatedItems', json_encode(tao_helpers_Uri::encodeArray($itemUris)));
$openNodes = tao_models_classes_GenerisTreeFactory::getNodesToOpen($itemUris, new core_kernel_classes_Class(TAO_ITEM_CLASS));
$widget->setData('itemRootNode', TAO_ITEM_CLASS);
$widget->setData('itemOpenNodes', $openNodes);
$widget->setData('saveUrl', _url('saveItems', 'Authoring', 'taoWfTest'));
return $widget->render();
}
示例3: getStuff
public static function getStuff()
{
$config = self::getConfig();
if (common::LoggedIn()) {
if ($config['wysiwygEnabled']) {
global $addonPathCode, $page;
require_once $addonPathCode . "/Renderer.php";
$renderer = new Renderer($config, $addonPathCode . "/lib/parsedown");
print $renderer->render($_REQUEST['content']);
//haha, very secure. NOT!
$nonce_str = 'EasyMark4Life!';
//TODO: sanitize $config stuff
//"stuff" is defined in edit.js
print "<script>";
print "var nonceStr = '" . $nonce_str . "';";
print "var postNonce = '" . common::new_nonce('post', true) . "';";
print "setTimeout(stuff, " . htmlspecialchars($config['wysiwygDelay']) . "*1000);";
print "</script>";
// cleanup old page object
unset($page);
}
} else {
print "Have to be logged in to use this feature";
}
}
示例4: testRender_ChangeValueHasStringType
/**
* @dataProvider renderChangeDataProvider
* @param $expectedDiff
* @param $oldValue
* @param $newValue
* @param array|null $renderOptions
*/
public function testRender_ChangeValueHasStringType($expectedDiff, $oldValue, $newValue, array $renderOptions = null)
{
$expectedDiff = implode(PHP_EOL, $expectedDiff);
$diffRenderer = new Renderer($renderOptions);
$actualDiff = $diffRenderer->render(new Change(implode(PHP_EOL, $oldValue), implode(PHP_EOL, $newValue)));
$this->assertEquals($expectedDiff, $actualDiff);
}
示例5: getAuthoring
/**
* @deprecated
* @see taoTests_models_classes_TestModel::getAuthoring()
*/
public function getAuthoring(core_kernel_classes_Resource $test)
{
$process = $test->getUniquePropertyValue(new core_kernel_classes_Property(TEST_TESTCONTENT_PROP));
$ext = common_ext_ExtensionsManager::singleton()->getExtensionById('taoWfAdvTest');
$widget = new Renderer($ext->getConstant('DIR_VIEWS') . 'templates' . DIRECTORY_SEPARATOR . 'authoring.tpl');
$widget->setData('processUri', $process->getUri());
$widget->setData('label', __('Authoring %s', $test->getLabel()));
return $widget->render();
}
示例6: getAuthoring
/**
* (non-PHPdoc)
*
* @see taoTests_models_classes_TestModel::getAuthoring()
*/
public function getAuthoring(core_kernel_classes_Resource $content)
{
common_Logger::i('Generating form for delivery content ' . $content->getUri());
$widget = new Renderer($this->extension->getConstant('DIR_VIEWS') . 'templates' . DIRECTORY_SEPARATOR . 'authoring.tpl');
$form = new taoSimpleDelivery_actions_form_ContentForm($this->getClass(), $content);
$widget->setData('formContent', $form->getForm()->render());
$widget->setData('saveUrl', _url('save', 'Authoring', 'taoSimpleDelivery'));
$widget->setData('formId', $form->getForm()->getName());
return $widget->render();
}
示例7: testRender
/**
* render() should recursively render each group
*/
public function testRender()
{
$root = (new Element\Group())->appendChild(new Element\Text('foo '))->appendChild((new Element\Group())->appendChild(new Element\Control\Word\B())->appendChild(new Element\Text('bar'))->appendChild(new Element\Control\Word\B(0)));
$this->assertFalse($root->getIsRendered());
$renderer = new Renderer();
$root = $renderer->render($root);
$this->assertTrue($root instanceof Element\Group);
$this->assertTrue($root->getIsRendered());
$this->assertTrue($root->getLastChild()->getChild(1)->getStyle()->getCharacter()->getIsBold());
return;
}
示例8: Renderer
function __construct($get)
{
$this->php_fixes();
// it's easier to handle some redirection through php rather than relying on a more complex .htaccess file to do all the work
if ($this->handle_redirects()) {
return;
}
// parse get request
$r = new Renderer($get);
// handle rendering of the page
$r->render();
}
示例9: getAuthoring
/**
* @deprecated
* @see taoTests_models_classes_TestModel::getAuthoring()
*/
public function getAuthoring(core_kernel_classes_Resource $test)
{
$testService = taoTests_models_classes_TestsService::singleton();
$class = new core_kernel_classes_Class(CLASS_LTI_TESTCONTENT);
$content = $test->getOnePropertyValue(new core_kernel_classes_Property(TEST_TESTCONTENT_PROP));
common_Logger::i('Generating form for ' . $content->getUri());
$form = new ltiTestConsumer_actions_form_LtiLinkForm($content);
$form->getForm()->setActions(array());
$widget = new Renderer($this->extension->getConstant('DIR_VIEWS') . 'templates' . DIRECTORY_SEPARATOR . 'authoring.tpl');
$widget->setData('formContent', $form->getForm()->render());
$widget->setData('saveUrl', _url('save', 'Authoring', 'ltiTestConsumer'));
$widget->setData('formName', $form->getForm()->getName());
return $widget->render();
}
示例10: SectionToContent
function SectionToContent($section_data)
{
global $addonPathCode, $addonPathData;
if ($section_data['type'] == self::$sectionType) {
$config = array();
$conf = $addonPathData . '/config.php';
if (file_exists($conf)) {
include $conf;
$config = $settings;
}
require_once $addonPathCode . "/Renderer.php";
$renderer = new Renderer($config, $addonPathCode . "/lib/parsedown/");
$section_data['content'] = $renderer->render($section_data['content']);
}
return $section_data;
}
示例11: run
/**
* Dispatch
*/
public function run()
{
$config = Service::get('config');
$request = Service::get('request');
$route = Service::get('router')->find($request->getUrl());
$user = Service::get('user')->getUser();
if (empty($user) & !empty(Cookie::get($config->getVal('remember/cookie_name')))) {
$user = Service::get('user');
$user = $user->find();
}
if (empty($user)) {
if (!in_array($request->getUrl(), array('/login', '/auth', '/gate', '/register', '/reg'))) {
$response = new RedirectResponse('/gate');
$response->send();
}
}
if (!empty($route)) {
$controller_class = $route['controller'] . 'Controller';
if (!class_exists($controller_class)) {
throw new \Exception("Controller class [" . $route['controller'] . "] doesn't exist");
}
$controller = new $controller_class();
if (!method_exists($controller, $route['action'] . 'Action')) {
throw new \Exception("Method [" . $route['action'] . "Action ] doesn't exist in [" . $route['controller'] . "]");
}
$action = $route['action'] . 'Action';
$response = call_user_func_array(array($controller, $action), $route['params']);
if ($response->type == 'html') {
$renderer = new Renderer(URL . '/src/template.php');
$renderer->setVars(array('content' => $response->content));
$response->content = $renderer->render();
}
$response->send();
} else {
throw new \Exception("Wrong route [" . $request->getUrl() . "]");
}
}
示例12: renderSlider
public function renderSlider()
{
$sliderView = new Renderer();
$sliderView->render($this->imgArr);
}
示例13: render
/**
* Renders the HTML to PDF
*/
function render()
{
$this->_process_html();
$this->_css->apply_styles($this->_tree);
$root = null;
foreach ($this->_tree->get_frames() as $frame) {
// Set up the root frame
if (is_null($root)) {
$root = Frame_Factory::decorate_root($this->_tree->get_root());
continue;
}
// Create the appropriate decorators, reflowers & positioners.
$deco = Frame_Factory::decorate_frame($frame, $this);
$deco->set_root($root);
// FIXME: handle generated content
if ($frame->get_style()->display == "list-item" && in_array($frame->get_style()->list_style_type, List_Bullet_Frame_Decorator::$BULLET_TYPES)) {
// Insert a list-bullet frame
$node = $this->_xml->createElement("bullet");
// arbitrary choice
$b_f = new Frame($node);
$style = $this->_css->create_style();
$style->display = "-dompdf-list-bullet";
$style->inherit($frame->get_style());
$b_f->set_style($style);
$deco->prepend_child(Frame_Factory::decorate_frame($b_f));
}
}
$this->_pdf = Canvas_Factory::get_instance($this->_paper_size, $this->_orientation);
$root->set_containing_block(0, 0, $this->_pdf->get_width(), $this->_pdf->get_height());
// This is where the magic happens:
$root->reflow();
$renderer = new Renderer($this->_pdf);
$renderer->render($root);
}
示例14: dispatch
/**
* @param null|string $controllerName
* @param null|string $actionName
* @return void
* @throws RuntimeException
*/
public function dispatch($controllerName = null, $actionName = null)
{
if ($this->isUrlRewritingEnabled && $this->router instanceof Router) {
$this->getRouter()->route($this);
} else {
if ($this->isUrlRewritingEnabled) {
$this->parseUrl();
} else {
$this->parseQueryString();
}
}
$controllerName = isset($controllerName) ? $controllerName : $this->getController();
$actionName = isset($actionName) ? $actionName : $this->getAction();
$response = $this->handleRequest($controllerName, $actionName);
$this->setResponse($response);
$renderer = new Renderer();
$renderer->render($this);
}
示例15: render
/**
* Renders the pagination.
*
* @param string $renderer The pagination renderer to use.
* @param array $options Additional options. Optional.
*/
public function render($renderer = null, $options = null)
{
$renderer = new Renderer($renderer, $options, $this);
return $renderer->render();
}