本文整理汇总了PHP中Environment::isEmbedded方法的典型用法代码示例。如果您正苦于以下问题:PHP Environment::isEmbedded方法的具体用法?PHP Environment::isEmbedded怎么用?PHP Environment::isEmbedded使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Environment
的用法示例。
在下文中一共展示了Environment::isEmbedded方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dispatch
/**
* @see \Components\Http_Scriptlet::dispatch() dispatch
*/
public static function dispatch(Http_Scriptlet_Context $context_, Uri $uri_)
{
$response = $context_->getResponse();
$content = null;
try {
// FIXME Temporary fix - create a explicit route for ui/scriptlet/embedded.
if (Environment::isEmbedded()) {
$scriptlet = new Ui_Scriptlet_Embedded();
$scriptlet->request = $context_->getRequest();
$scriptlet->response = $context_->getResponse();
$method = $scriptlet->request->getMethod();
if (false === method_exists($scriptlet, strtolower($method))) {
throw new Http_Exception('ui/scriptlet', null, Http_Exception::NOT_FOUND);
}
$content = $scriptlet->{$method}();
} else {
$content = parent::dispatch($context_, $uri_);
}
} catch (\Exception $e) {
Runtime::addException($e);
if ($e instanceof Http_Exception) {
$e->sendHeader();
}
}
echo $content;
}
示例2: __construct
public function __construct()
{
Environment::isEmbedded(true);
$this->template = __DIR__ . '/embedded.tpl';
$this->script('ui/jquery/jquery-1.11.2.min', false, false);
$this->script('runtime/libstd');
$this->script('ui/jquery/mobile/jquery.mobile.touch.min');
$this->script('ui/common');
$this->style('ui/common');
$this->panel = new Ui_Panel('ui-panel');
$this->panel->scriptlet = $this;
}
示例3: display
/**
* Displays this panel or sub-panel.
*
* @param string $panel_ Name of sub-panel to display
*
* @throws Ui_Panel_Exception
*/
public function display($panel_ = null)
{
if (null !== $panel_) {
if (isset($this->m_children[$panel_])) {
return $this->m_children[$panel_]->display();
}
return;
}
if (null === $this->m_form) {
if (Environment::isEmbedded() && null !== $this->callback) {
throw new Ui_Panel_Exception('ui/panel', 'Panels with callbacks require a form in embedded mode.');
}
} else {
if ($this->m_form->id() === $this->id()) {
$this->m_attributes['ui-panel-form'] = null;
$this->m_classes['ui_panel_form'] = 'ui_panel_form';
if ($this->ajaxEnabled) {
if (Environment::isEmbedded()) {
$path = [$this->name => \str\typeToPath(get_class($this))];
$panel = $this;
while ($panel = $panel->parent) {
$path[$panel->name] = \str\typeToPath(get_class($panel));
}
$this->m_attributes['ui-panel-path'] = json_encode(array_reverse($path));
}
} else {
$this->tag = 'form';
}
if (isset($this->m_attributes['action'])) {
$this->m_attributes['action'] = $this->m_formProperties['action'];
}
$this->m_attributes['accept-charset'] = $this->m_formProperties['accept-charset'];
$this->m_attributes['enctype'] = $this->m_formProperties['enctype'];
$this->m_attributes['method'] = $this->m_formProperties['method'];
}
}
if (null !== $this->tag) {
printf('<%s id="%s" %s>', $this->tag, $this->id(), $this->attributes());
if ('form' === $this->tag) {
printf('<input type="hidden" name="ui-panel-submitted" value="%s">', $this->id());
}
}
echo $this->render();
if (null !== $this->tag) {
printf('</%s>', $this->tag);
}
}