当前位置: 首页>>代码示例>>PHP>>正文


PHP Fx::trigger方法代码示例

本文整理汇总了PHP中Floxim\Floxim\System\Fx::trigger方法的典型用法代码示例。如果您正苦于以下问题:PHP Fx::trigger方法的具体用法?PHP Fx::trigger怎么用?PHP Fx::trigger使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Floxim\Floxim\System\Fx的用法示例。


在下文中一共展示了Fx::trigger方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: route

 public function route($url = null, $context = null)
 {
     if ($url instanceof \Floxim\Main\Page\Entity) {
         $url = fx::collection(array($url));
     }
     if ($url instanceof \Floxim\Floxim\System\Collection) {
         $path = $url;
         $url = $path->last()->get('url');
     } else {
         $url = preg_replace("~^/~", '', $url);
         $path = $this->getPath($url, $context['site_id']);
         if (!$path) {
             return;
         }
     }
     $page = $path->last();
     if (!$page) {
         return null;
     } else {
         $url = preg_replace("~\\?.+\$~", '', $url);
         if ($url && !$page->hasVirtualPath() && urldecode($url) != $page['url'] && $page['url'] !== '404/') {
             fx::http()->redirect($page['url'], 301);
             fx::debug($url, '!=', $page['url']);
             die;
         }
     }
     fx::env('page', $page);
     fx::http()->status('200');
     $layout_ib = $this->getLayoutInfoblock($page);
     fx::trigger('before_layout_render', array('layout_infoblock' => $layout_ib));
     $res = $layout_ib->render();
     return $res;
 }
开发者ID:floxim,项目名称:floxim,代码行数:33,代码来源:Front.php

示例2: addSave

 public function addSave($input)
 {
     $result = array('status' => 'ok');
     $keyword = trim($input['keyword']);
     $name = trim($input['name']);
     $vendor = trim($input['vendor']);
     if (empty($keyword)) {
         $keyword = fx::util()->strToKeyword($name);
     }
     //$keyword = $vendor.'.'.fx::util()->underscoreToCamel($keyword,true);
     $keyword = fx::util()->camelToUnderscore($vendor) . '.' . $keyword;
     $existing = fx::data('layout')->where('keyword', $keyword)->one();
     if ($existing) {
         return array('status' => 'error', 'text' => sprintf(fx::alang('Layout %s already exists'), $keyword));
     }
     $data = array('name' => $name, 'keyword' => $keyword);
     $layout = fx::data('layout')->create($data);
     try {
         $layout->save();
         $layout->scaffold();
         fx::trigger('layout_created', array('layout' => $layout));
         $result['reload'] = '#admin.layout.all';
     } catch (Exception $e) {
         $result['status'] = 'error';
     }
     return $result;
 }
开发者ID:floxim,项目名称:floxim,代码行数:27,代码来源:Layout.php

示例3: getMoreMenu

 public static function getMoreMenu()
 {
     $more_menu = array();
     $c_page = fx::env('page');
     $more_menu['edit_current_page'] = array('name' => fx::alang('Edit current page', 'system'), 'button' => array('entity' => 'content', 'action' => 'add_edit', 'content_type' => $c_page['type'], 'content_id' => $c_page['id']));
     $more_menu['layout_settings'] = array('name' => fx::alang('Layout settings', 'system'), 'button' => array('entity' => 'infoblock', 'action' => 'layout_settings', 'page_id' => fx::env('page_id')));
     $more_menu['switch_theme'] = array('name' => fx::alang('Change theme', 'system'), 'button' => array('entity' => 'layout', 'action' => 'change_theme', 'page_id' => fx::env('page_id')));
     $more_menu['page_infoblocks'] = array('name' => fx::alang('Page infoblocks', 'system'), 'button' => array('entity' => 'infoblock', 'action' => 'list_for_page', 'page_id' => fx::env('page_id')));
     $res = array('name' => fx::alang('More'), 'children' => $more_menu);
     fx::trigger('admin_more_menu_ready', array('menu' => &$res));
     $res['children'] = array_values($res['children']);
     return $res;
 }
开发者ID:piarsonforked,项目名称:floxim,代码行数:13,代码来源:Adminpanel.php

示例4: route

 public function route($url = null, $context = null)
 {
     $path = fx::router()->getPath($url, $context['site_id']);
     if (!$path) {
         return;
     }
     $page = $path->last();
     if (!$page) {
         return null;
     } else {
         $url = preg_replace("~\\?.+\$~", '', $url);
         if ($url && !$page->hasVirtualPath() && urldecode($url) != $page['url'] && $page['url'] !== '/404/') {
             fx::http()->redirect($page['url'], 301);
             exit;
         }
     }
     fx::env('page', $page);
     fx::http()->status('200');
     $layout_ib = $this->getLayoutInfoblock($page);
     fx::trigger('before_layout_render', array('layout_infoblock' => $layout_ib));
     $res = $layout_ib->render();
     return $res;
 }
开发者ID:piarsonforked,项目名称:floxim,代码行数:23,代码来源:Front.php

示例5: loadTemplateVariant

 public static function loadTemplateVariant($name, $action = null, $context = null, $force_group = false, $tags = null)
 {
     // just return new template instance
     if (!$action) {
         $tpl_class = self::import($name);
         if (!$tpl_class) {
             return false;
         }
         return new $tpl_class(null, $context);
     }
     // if group is forced
     if ($force_group) {
         $tpl_class = self::import($force_group);
         if (!$tpl_class) {
             return false;
         }
         // recount action name for external group
         if ($force_group !== $name) {
             $action = str_replace(".", "_", $name) . "__" . $action;
         }
         $method = $tpl_class::getActionMethod($action, $context, $tags);
         if (!$method) {
             return false;
         }
         $tpl = new $tpl_class(null, $context);
         $tpl->forceMethod($method);
         return $tpl;
     }
     // run full process - trigger event and collect external implementations
     $base_class = self::import($name);
     $found_variants = fx::trigger('loadTemplate', array('name' => $name, 'action' => $action, 'context' => $context, 'full_name' => $name . ':' . $action, 'tags' => $tags));
     // no external implementation, quickly return base one
     if (!$found_variants) {
         if (!$base_class) {
             return false;
         }
         $method = $base_class::getActionMethod($action, $context, $tags);
         if (!$method) {
             return false;
         }
         $tpl = new $base_class(null, $context);
         $tpl->forceMethod($method);
         return $tpl;
     }
     if ($local_method = $base_class::getActionMethod($action, $context, $tags, true)) {
         $local_method[2] = $base_class;
         $found_variants[] = $local_method;
     }
     usort($found_variants, function ($a, $b) use($base_class) {
         $ap = $a[1];
         $bp = $b[1];
         if ($ap > $bp) {
             return -1;
         }
         if ($ap < $bp) {
             return 1;
         }
         $a_loc = $a[2] === $base_class;
         $b_loc = $b[2] === $base_class;
         if ($a_loc) {
             return 1;
         }
         if ($b_loc) {
             return -1;
         }
         return 0;
     });
     $winner = $found_variants[0];
     $winner_class = $winner[2];
     $tpl = new $winner_class(null, $context);
     $tpl->forceMethod($winner[0]);
     return $tpl;
 }
开发者ID:floxim,项目名称:floxim,代码行数:73,代码来源:Loader.php

示例6: can

 public function can($action, $target)
 {
     $method = 'can' . fx::util()->underscoreToCamel($action);
     if (method_exists($this, $method)) {
         $res = $this->{$method}($target);
         if (is_bool($res)) {
             return $res;
         }
     }
     if ($this->isAdmin()) {
         return true;
     }
     $event_res = fx::trigger('checkAbility', array('user' => $this, 'action' => $action, 'target' => $target));
     return $event_res;
 }
开发者ID:floxim,项目名称:module-user,代码行数:15,代码来源:Entity.php

示例7: renderArea

 public static function renderArea($area, $context, $mode = 'both')
 {
     if (isset($area['size'])) {
         $area['size'] = preg_replace("~[^a-z0-9]+~i", ',', $area['size']);
     }
     $is_admin = fx::isAdmin();
     if ($mode != 'marker') {
         fx::trigger('render_area', array('area' => $area));
         if ($is_admin && $context->isIdle()) {
             return;
         }
     }
     if ($is_admin) {
         ob_start();
     }
     if ($mode != 'marker' && (!isset($area['render']) || $area['render'] != 'manual')) {
         $area_blocks = fx::page()->getAreaInfoblocks($area['id']);
         $pos = 1;
         foreach ($area_blocks as $ib) {
             $ib->addParams(array('infoblock_area_position' => $pos));
             $result = $ib->render();
             echo $result;
             $pos++;
         }
     }
     if ($is_admin) {
         $area_result = ob_get_clean();
         self::$area_replacements[] = array($area, $area_result);
         $marker = '###fxa' . (count(self::$area_replacements) - 1);
         if ($mode != 'both') {
             $marker .= '|' . $mode;
         }
         $marker .= '###';
         echo $marker;
     }
 }
开发者ID:floxim,项目名称:floxim,代码行数:36,代码来源:Template.php


注:本文中的Floxim\Floxim\System\Fx::trigger方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。