本文整理汇总了PHP中SkinTemplate::setContext方法的典型用法代码示例。如果您正苦于以下问题:PHP SkinTemplate::setContext方法的具体用法?PHP SkinTemplate::setContext怎么用?PHP SkinTemplate::setContext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkinTemplate
的用法示例。
在下文中一共展示了SkinTemplate::setContext方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getContextSetup
/**
* Creates a new set of object for the actual test context, including a new
* outputpage and skintemplate.
*
* @param string $mode The mode for the test cases (desktop, mobile)
* @return array Array of objects, including MobileContext (context),
* SkinTemplate (sk) and OutputPage (out)
*/
protected function getContextSetup($mode, $mfXAnalyticsItems)
{
// Create a new MobileContext object for this test
MobileContext::setInstance(null);
// create a new instance of MobileContext
$context = MobileContext::singleton();
// create a DerivativeContext to use in MobileContext later
$mainContext = new DerivativeContext(RequestContext::getMain());
// create a new, empty OutputPage
$out = new OutputPage($context);
// create a new, empty SkinTemplate
$sk = new SkinTemplate();
// create a new Title (main page)
$title = Title::newMainPage();
// create a FauxRequest to use instead of a WebRequest object (FauxRequest forces
// the creation of a FauxResponse, which allows to investigate sent header values)
$request = new FauxRequest();
// set the new request object to the context
$mainContext->setRequest($request);
// set the main page title to the context
$mainContext->setTitle($title);
// set the context to the SkinTemplate
$sk->setContext($mainContext);
// set the OutputPage to the context
$mainContext->setOutput($out);
// set the DerivativeContext as a base to MobileContext
$context->setContext($mainContext);
// set the mode to MobileContext
$context->setUseFormat($mode);
// if there are any XAnalytics items, add them
foreach ($mfXAnalyticsItems as $key => $val) {
$context->addAnalyticsLogItem($key, $val);
}
// set the newly created MobileContext object as the current instance to use
MobileContext::setInstance($context);
// return the stuff
return array('out' => $out, 'sk' => $sk, 'context' => $context);
}