本文整理汇总了PHP中Floxim\Floxim\System\Fx::listen方法的典型用法代码示例。如果您正苦于以下问题:PHP Fx::listen方法的具体用法?PHP Fx::listen怎么用?PHP Fx::listen使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Floxim\Floxim\System\Fx
的用法示例。
在下文中一共展示了Fx::listen方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handleThumbs
protected function handleThumbs()
{
fx::listen('unlink', function ($e) {
$f = $e['file'];
if (fx::files()->isMetaFile($f)) {
return;
}
if (fx::path()->isInside($f, fx::path('@thumbs'))) {
return;
}
if (!fx::path()->isInside($f, fx::path('@content_files'))) {
return;
}
$thumbs = \Floxim\Floxim\System\Thumb::findThumbs($f);
foreach ($thumbs as $thumb) {
fx::files()->rm($thumb);
}
});
}
示例2: init
public function init()
{
fx::template()->import('floxim.layout.wrapper');
fx::listen('before_save', function ($e) {
$entity = $e['entity'];
if (!$entity instanceof \Floxim\Floxim\Component\InfoblockVisual\Entity) {
return;
}
if (!preg_match("~column_new-in-(\\d+)~", $entity['area'], $column_infoblock_id)) {
return;
}
$column_infoblock_id = $column_infoblock_id[1];
$column = fx::data('floxim.layout.column')->create(array('infoblock_id' => $column_infoblock_id));
if (preg_match("~(before|after)-(\\d+)~", $entity['area'], $rel_col)) {
$column['__move_' . $rel_col[1]] = $rel_col[2];
}
fx::log($rel_col, $column);
$column->save();
$entity['area'] = $column['area_keyword'];
});
}
示例3: getAreas
public function getAreas()
{
$areas = array();
ob_start();
fx::listen('render_area.get_areas', function ($e) use(&$areas) {
$areas[$e['area']['id']] = $e['area'];
});
$this->render(array('_idle' => true));
fx::unlisten('render_area.get_areas');
// hm, since IB render res is cached, we can not just remove added files
// because they won't be added again
// may be we should switch off caching for idle mode
//fx::page()->clear_files();
ob_get_clean();
return $areas;
}