本文整理汇总了PHP中Renderer类的典型用法代码示例。如果您正苦于以下问题:PHP Renderer类的具体用法?PHP Renderer怎么用?PHP Renderer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Renderer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
示例2: _render
/**
* Render request
*
* @param array $data
* @param string|null $template
* @param string|null $blockClass
* @return $this
*/
protected function _render(array $data = array(), $template = null, $blockClass = null)
{
//create block
if ($blockClass) {
$blockClass = '\\App\\Block' . '\\' . $blockClass;
$block = new $blockClass($data);
} else {
$block = new Renderer($data);
}
if (!$template) {
//set template
$template = $this->getControllerName() . DIRECTORY_SEPARATOR . $this->getActionName() . '.phtml';
}
$block->setTemplate($template);
//get action HTML
$actionHtml = $block->toHtml();
if (!$this->isAjax()) {
$block = new Renderer(array('content' => $actionHtml));
$block->setTemplate('index.phtml');
//add system messages block
$message = new Message();
$message->setTemplate('index/messages.phtml');
$block->setChild('message', $message);
echo $block->toHtml();
} else {
echo $actionHtml;
}
return $this;
}
示例3: 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();
}
示例4: 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";
}
}
示例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: testGetProductPriceHtml
/**
* @covers \Magento\Checkout\Block\Cart\Item\Renderer::getProductPriceHtml
* @covers \Magento\Checkout\Block\Cart\Item\Renderer::getPriceRender
*/
public function testGetProductPriceHtml()
{
$priceHtml = 'some price html';
$product = $this->getMockBuilder('Magento\\Catalog\\Model\\Product')->disableOriginalConstructor()->getMock();
$priceRender = $this->getMockBuilder('Magento\\Framework\\Pricing\\Render')->disableOriginalConstructor()->getMock();
$this->layout->expects($this->atLeastOnce())->method('getBlock')->with('product.price.render.default')->will($this->returnValue($priceRender));
$priceRender->expects($this->once())->method('render')->with(\Magento\Catalog\Pricing\Price\ConfiguredPriceInterface::CONFIGURED_PRICE_CODE, $product, ['include_container' => true, 'display_minimal_price' => true, 'zone' => \Magento\Framework\Pricing\Render::ZONE_ITEM_LIST])->will($this->returnValue($priceHtml));
$this->assertEquals($priceHtml, $this->_renderer->getProductPriceHtml($product));
}
示例7: Render
public function Render(Renderer $renderer)
{
$superGlobals = GetApplication()->GetSuperGlobals();
if ($superGlobals->GetGetValueDef(ModalOperation::Param) == ModalOperation::OpenModalEditDialog || $superGlobals->GetGetValueDef(ModalOperation::Param) == ModalOperation::OpenModalInsertDialog) {
$this->grid->GetGrid()->GetPage()->UpdateValuesFromUrl();
}
$this->grid->ProcessMessages();
echo $renderer->Render($this->grid);
}
示例8: 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();
}
示例9: 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();
}
示例10: 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;
}
示例11: __construct
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();
}
示例12: 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();
}
示例13: 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;
}
示例14: getAdd
public function getAdd($parentModel, $relation, $idParentModel)
{
$parentList = $parentModel::find($idParentModel);
$relation = $parentList->{$relation}();
$sonModel = $relation->getRelated();
$sonList = new $sonModel();
$fk = $relation->getForeignKey();
$sonList->{$fk} = $idParentModel;
$sonList->save();
$renderer = new Renderer();
if (!($tableParams = Session::get($renderer::PREFIX_SESSION_AJAX_LIST . $_GET["listToken"]))) {
$result = "<span>Error al actualizar tabla, por favor, recargue la página</span>";
} else {
$result = $renderer->generateAjaxListFromRelation($tableParams[0], $tableParams[1], $tableParams[2], $tableParams[3], $tableParams[4], $tableParams[5]);
}
return json_encode($result);
}
示例15: testAddGlobal
public function testAddGlobal()
{
$this->assertFalse(isset($globals['test-key']));
Renderer::addGlobal('test-key', 'test-value');
$globals = Renderer::getGlobals();
$this->assertTrue(isset($globals['test-key']));
$this->assertEquals('test-value', $globals['test-key']);
}