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


PHP Action类代码示例

本文整理汇总了PHP中Action的典型用法代码示例。如果您正苦于以下问题:PHP Action类的具体用法?PHP Action怎么用?PHP Action使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: addAction

 /**
  * @param Action $action
  */
 public function addAction(Action $action)
 {
     if ($this->hasAction($name = $action->getName())) {
         throw new \InvalidArgumentException(sprintf('Action "%s" already exists.', $name));
     }
     $this->actions[$name] = $action;
 }
开发者ID:loic425,项目名称:Sylius,代码行数:10,代码来源:ActionGroup.php

示例2: getNextStates

 /**
  * Available paths from current state.
  *
  * @return array
  */
 public function getNextStates()
 {
     $maxMissionaries = $this->missionariesRight;
     if ($this->boatLocation == 'left') {
         $maxMissionaries = $this->missionariesLeft;
     }
     $maxCannibals = $this->cannibalsRight;
     if ($this->boatLocation == 'left') {
         $maxCannibals = $this->cannibalsLeft;
     }
     $maxMissionaries = min(BOAT_SIZE, $maxMissionaries);
     $maxCannibals = min(BOAT_SIZE, $maxCannibals);
     $states = [];
     for ($missionaries = 0; $missionaries <= $maxMissionaries; ++$missionaries) {
         for ($cannibals = 0; $cannibals <= $maxCannibals; ++$cannibals) {
             if ($missionaries == 0 && $cannibals == 0) {
                 continue;
             }
             if ($missionaries + $cannibals > BOAT_SIZE) {
                 continue;
             }
             $action = new Action($missionaries, $cannibals);
             if ($action->isValidAction()) {
                 $state = clone $this;
                 $state = $state->transfer($missionaries, $cannibals);
                 $node = new Node($state, $this, $action, 0, 0);
                 array_push($states, $node);
             }
         }
     }
     return $states;
 }
开发者ID:ankitpokhrel,项目名称:MissionariesAndCannibals-PHP,代码行数:37,代码来源:State.php

示例3: index

 public function index()
 {
     // Route
     if (isset($this->request->get['route']) && $this->request->get['route'] != 'startup/router') {
         $route = $this->request->get['route'];
     } else {
         $route = $this->config->get('action_default');
     }
     $data = array();
     // Sanitize the call
     $route = preg_replace('/[^a-zA-Z0-9_\\/]/', '', (string) $route);
     // Trigger the pre events
     $result = $this->event->trigger('controller/' . $route . '/before', array(&$route, &$data));
     if (!is_null($result)) {
         return $result;
     }
     $action = new Action($route);
     // Any output needs to be another Action object.
     $output = $action->execute($this->registry, $data);
     // Trigger the post events
     $result = $this->event->trigger('controller/' . $route . '/after', array(&$route, &$output));
     if (!is_null($result)) {
         return $result;
     }
     return $output;
 }
开发者ID:brunoxu,项目名称:mycncart,代码行数:26,代码来源:router.php

示例4: onEndShowScripts

 function onEndShowScripts(Action $action)
 {
     $action->inlineScript('var infinite_scroll_on_next_only = ' . ($this->on_next_only ? 'true' : 'false') . ';');
     $action->inlineScript('var ajax_loader_url = "' . $this->path('ajax-loader.gif') . '";');
     $action->script($this->path('jquery.infinitescroll.js'));
     $action->script($this->path('infinitescroll.js'));
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:7,代码来源:InfiniteScrollPlugin.php

示例5: init

 function init($mySql, $queries, $lang, $module, $idUrl)
 {
     $HelperOther = new HelperOther();
     $Details = new Details();
     $Action = new Action();
     $entry = $mySql->fetch_row($queries->selectById($mySql, $module, $idUrl));
     $getColumn = $queries->selectAll($mySql, $module);
     $layout = $Details->debut($lang, $module);
     for ($i = 0; $i < $mySql->num_fields($getColumn); $i++) {
         $column = $mySql->fetch_field($getColumn);
         $column = $column->name;
         $details = $entry[$i];
         if ($Action->exclusion($module, $column)) {
             $field = $HelperOther->findField($column);
             @(!(include_once 'controller/fields/' . $field . '.class.php'));
             if (class_exists($field)) {
                 $getValue = new $field($lang, $module, $details, $column, DETAIL);
                 $details = $getValue->details;
                 $layout .= $Details->detail($details);
             }
         }
     }
     $layout .= $Details->fin();
     return $layout;
 }
开发者ID:WebPassions,项目名称:2013,代码行数:25,代码来源:action_detail.class.php

示例6: nextAttemptSort

 /**
  * Sorts the actions based on which is to execute next.
  * @param Action $a
  * @param Action $b
  * @return -1 if $a < $b, 1 if $a > $b, 0 if $a == $b
  */
 private function nextAttemptSort($a, $b)
 {
     if ($a->getNextAttempt() == $b->getNextAttempt()) {
         return 0;
     }
     return $a->getNextAttempt() < $b->getNextAttempt() ? -1 : 1;
 }
开发者ID:carriercomm,项目名称:Twitterbot,代码行数:13,代码来源:twitterbot.php

示例7: get

 public function get()
 {
     $action = new Action('common/order_status');
     $data = $action->execute($this->registry);
     $response['order_status'] = $data['order_status'];
     $this->response->setOutput($response);
 }
开发者ID:projectwife,项目名称:tesitoo-opencart,代码行数:7,代码来源:order_status.php

示例8: index

 public function index()
 {
     // Route
     if (isset($this->request->get['route']) && $this->request->get['route'] != 'startup/router') {
         $route = $this->request->get['route'];
     } else {
         $route = $this->config->get('action_default');
     }
     // Sanitize the call
     $route = str_replace('../', '', (string) $route);
     // Trigger the pre events
     $result = $this->event->trigger('controller/' . $route . '/before', array(&$route, &$data));
     if (!is_null($result)) {
         return $result;
     }
     // We dont want to use the loader class as it would make an controller callable.
     $action = new Action($route);
     // Any output needs to be another Action object.
     $output = $action->execute($this->registry);
     // Trigger the post events
     $result = $this->event->trigger('controller/' . $route . '/after', array(&$route, &$data, &$output));
     if (!is_null($result)) {
         return $result;
     }
     return $output;
 }
开发者ID:web3d,项目名称:mincart,代码行数:26,代码来源:router.php

示例9: add

 protected function add(Action $action)
 {
     if (isset($this->actions[$action->getName()])) {
         throw new \InvalidArgumentException(sprintf('The action "%s" already exists.', $action->getName()));
     }
     $this->actions[$action->getName()] = $action;
 }
开发者ID:hostingnuggets,项目名称:WhiteOctoberAdminBundle,代码行数:7,代码来源:ActionCollection.php

示例10: index

 public function index()
 {
     // Route
     if (isset($this->request->get['route'])) {
         $route = $this->request->get['route'];
     } else {
         $route = 'common/dashboard';
     }
     $data = array();
     // Sanitize the call
     $route = str_replace('../', '', (string) $route);
     // Trigger the pre events
     $result = $this->event->trigger('controller/' . $route . '/before', array(&$route, &$data));
     if (!is_null($result)) {
         return $result;
     }
     $action = new Action($route);
     // Any output needs to be another Action object.
     $output = $action->execute($this->registry, $data);
     // Trigger the post events
     $result = $this->event->trigger('controller/' . $route . '/after', array(&$route, &$output));
     if (!is_null($result)) {
         return $result;
     }
     return $output;
 }
开发者ID:mif32,项目名称:opencart,代码行数:26,代码来源:route.php

示例11: get

 /**
  * Resource methods
  */
 public function get()
 {
     $action = new Action('common/language');
     $data = $action->execute($this->registry);
     $response['languages'] = $this->processLanguages($data['languages']);
     $this->response->setOutput($response);
 }
开发者ID:projectwife,项目名称:tesitoo-opencart,代码行数:10,代码来源:language_base.php

示例12: onEndAccountSettingsNav

 /**
  * Menu item for personal subscriptions/groups area
  *
  * @param Action $action action being executed
  *
  * @return boolean hook return
  */
 function onEndAccountSettingsNav($action)
 {
     $action_name = $action->trimmed('action');
     common_debug("ACTION NAME = " . $action_name);
     $action->menuItem(common_local_url('mirrorsettings'), _m('MENU', 'Mirroring'), _m('Configure mirroring of posts from other feeds'), $action_name === 'mirrorsettings');
     return true;
 }
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:14,代码来源:SubMirrorPlugin.php

示例13: populateFromOptions

 protected function populateFromOptions($options)
 {
     foreach ($options as $name => $attrs) {
         $action = new Action($name);
         if (isset($attrs['route_pattern'])) {
             $action->setRoute($attrs['route_name'], $attrs['route_pattern'], array());
         }
         if (isset($attrs['text'])) {
             $action->setText($attrs['text']);
         }
         if (isset($attrs['icon'])) {
             $action->setButtonIcon($attrs['icon']);
         }
         if (isset($attrs['style'])) {
             $action->setButtonStyle($attrs['style']);
         }
         if (isset($attrs['dialog'])) {
             $action->setDialog($attrs['dialog']['title'], $attrs['dialog']['message']);
         }
         if (isset($attrs['trans_domain'])) {
             $action->setTransDomain($attrs['trans_domain']);
         }
         if (isset($attrs['template'])) {
             $action->setTemplate($attrs['template']);
         }
         if (isset($attrs['roles'])) {
             $action->setRoles($attrs['roles']);
         }
         $this->add($action);
     }
 }
开发者ID:senthilkumar3282,项目名称:LyraAdminBundle,代码行数:31,代码来源:ActionCollection.php

示例14: getValidationProfile

 /**
  * Will try and find a validation profile for the action provided
  * 
  * @param Action $action
  * @return ValidationProfile
  * @throws ValidationException
  */
 public function getValidationProfile(Action $action)
 {
     if (!isset($this->profiles[$action->getName()])) {
         throw new ValidationException("Could not find a validation profile for action: [{$action->getName()}]");
     }
     return $this->profiles[$action->getName()];
 }
开发者ID:projectstorm,项目名称:php-actions,代码行数:14,代码来源:ValidationProfileBank.php

示例15: get

 /**
  * Resource methods
  */
 public function get()
 {
     $action = new Action('common/currency');
     $data = $action->execute($this->registry);
     $response['currencies'] = $this->processCurrencies($data['currencies']);
     $this->response->setOutput($response);
 }
开发者ID:projectwife,项目名称:tesitoo-opencart,代码行数:10,代码来源:currency_base.php


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