本文整理匯總了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;
}