本文整理汇总了PHP中core::event方法的典型用法代码示例。如果您正苦于以下问题:PHP core::event方法的具体用法?PHP core::event怎么用?PHP core::event使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core
的用法示例。
在下文中一共展示了core::event方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: unbind
public function unbind($event)
{
unset($this->bindEv[$event]);
$this->O->event()->unbind($event);
$this->change();
}
示例2: remove_after
function remove_after()
{
core::event('comment_remove', $this);
}
示例3: route
/**
* Try base route,
* otherwise try find out node
*
* @todo move stuff to controller
*/
function route($parts)
{
// Try abse routes
if (parent::route($parts)) {
return true;
}
$uri = implode('/', $parts);
$in_index = empty($parts);
if ($in_index) {
$this->render_index();
return true;
}
$comment_filter = $this->create_filter('sat.comment/modify');
$this->append_filter('comment_modify', $comment_filter);
if (!$comment_filter->match_uri($uri)) {
$comment_filter = null;
}
$pagination_filter = $this->create_filter('pagination');
// append filter for later use
$this->append_filter('pagination', $pagination_filter);
$pagination_filter->match_uri($uri);
// string(54) "14_dvigatel_mehanicheskaya_chast/klapanniy_zazor_2zzge"
$node_url = '/' . $uri;
if (strings::substr($node_url, -5) != loader::DOT_HTML) {
$node_url .= '/';
}
$this->_static_node_url = $node_url;
$c_site_id = $this->context->get_current_site_id();
$_item = $this->context->get_tree_item($c_site_id, $node_url, tf_sat::TREE_URL);
if (!$_item) {
throw new router_exception('Node not found', router_exception::NOT_FOUND);
}
/** @var sat_node_item $item */
$item = $this->context->get_node($_item['id']);
if (!$item) {
throw new router_exception('Node item not found', router_exception::NOT_FOUND);
}
core::dprint(array('Found node %d, %s ', $item->id, $item->title));
$tlayout = $item->get_template();
if (isset($tlayout['site']['order'])) {
$item->get_children_handle()->set_order($tlayout['site']['order']);
}
core::event('sat_route_before', $item);
/* pagination filter */
$page = $pagination_filter->get_start();
try {
$item->apply_children_filter($page);
} catch (collection_filter_exception $e) {
throw new router_exception($e->getMessage(), router_exception::NOT_FOUND);
}
$item->get_parent();
// load secondary, if not disabled
if (!isset($tlayout["site"]["item"]["deps"]) || $tlayout["site"]["item"]["deps"]) {
$item->with_deps(@$tlayout["site"]["item"]["deps"]);
$item->load_secondary(@$tlayout["site"]["item"]["deps"]);
}
$this->_current_node = $item;
// for comments bindings
$this->context->controller->set_current_item($item);
if ($comment_filter) {
$comment_filter->run();
}
/** @var tf_renderer */
$renderer = $this->context->renderer;
//
// template alternative layout {layout}.tpl
//
if ($tlayout['template']) {
$renderer->set_page_template($tlayout['template']);
}
core::event('sat_render_before', $item);
$renderer->current->node = $item->render();
$renderer->current->node_chain = $this->context->get_node_parents($item->id)->render();
$renderer->set_main_template(($tpl = $this->context->get_controller()->get_template()) ? $tpl : 'sat/node/item');
return true;
}
示例4: logout
/**
* Out
*/
public function logout()
{
if (!$this->_logged_in) {
return false;
}
core::event('logout', $this->get_user());
$this->set_user(0);
$this->_logged_in = false;
$this->update_session_uid();
return true;
}
示例5: output_end
/**
* Post out
* Finish output
*/
private function output_end($tpl, $return = false)
{
$this->_buffer = '';
if ($this->_is_null_template()) {
return;
}
/* display if template given
or return if $return passed
skip if template is empty (ajax)
*/
if (!empty($tpl)) {
$tpl .= loader::DOT_TPL;
// assign data
$this->get_parser()->assign($this->get_data());
core::dprint('[RENDER] using ' . $tpl . ' with ' . $this->get_main_template() . ' [' . $this->template_url . ']');
// in ajax dies silently, if no template found
try {
$this->_buffer = $this->get_parser()->fetch($tpl);
} catch (SmartyException $e) {
$this->_buffer = '<code>ParserException: ' . $e->getMessage() . (core::is_debug() ? nl2br($e->getTraceAsString()) : '') . '</code>';
}
// make some editor magic
if (core::in_editor()) {
core::lib('editor')->on_output_before($this->_buffer);
}
core::event('core_after_output', $this->_buffer);
// fix spaces (30260 -> 27611 time 0.0017)
// $html = preg_replace('#>[\s]{2,}<#smU', '><', $html);
// $html = str_replace(array("\n", "\r", ' '), '', $html);
// $this->tpl_parser->display($tpl);
$this->_buffer = trim($this->_buffer);
if ($return) {
return $this->_buffer;
} else {
echo $this->_buffer;
}
}
}