Reports a page action with dependencies to the log
@param Page $page The page being manipulated
@param Enums\Action $action The operation executed on the page
427413
function ReportPageAction(Page $page, Enums\Action $action)
    {
        $logItem = $this->CreateLogItem(Enums\ObjectType::Page(), $action);       
        if (!$action->Equals(Enums\Action::Delete()))
        {
            $logPage = new LogPage();
            $logPage->SetLogItem($logItem);
            $logPage->SetPage($page);
            $logPage->Save();
        }
        else
        {
            $this->ReportSiteAction($page->GetSite(), Enums\Action::ChildDelete());
        }
    }
186043
function ReportUserAction(User $user, Enums\Action $action)
    {
        $logItem = $this->CreateLogItem(Enums\ObjectType::User(), $action);       
        if (!$action->Equals(Enums\Action::Delete()))
        {
            $logUser = new LogUser();
            $logUser->SetLogItem($logItem);
            $logUser->SetUser($user);
            $logUser->Save();
        }
    }
65628
function ReportSiteAction(Site $site, Enums\Action $action)
    {
        $logItem = $this->CreateLogItem(Enums\ObjectType::Site(), $action);       
        if (!$action->Equals(Enums\Action::Delete()))
        {
            $logSite = new LogSite();
            $logSite->SetLogItem($logItem);
            $logSite->SetSite($site);
            $logSite->Save();
        }
    }
1294043
public function action(Action $action) {
        if($action->register === Action::REGISTER_AT_END) {
            $this->registerActionsLast[] = $action;
        } else {
            if($action->register) {
                $this->registerAction($action);
            }
        }
    }
693725
public function Bans($Action = '', $Search = '', $Page = '', $ID = '') {
      $this->Permission('Garden.Moderation.Manage');
      
      // Page setup
      $this->AddSideMenu();
      $this->Title(T('Banning Options'));
      $this->AddJsFile('bans.js');

      list($Offset, $Limit) = OffsetLimit($Page, 20);

      $BanModel = new BanModel();
      $this->_BanModel = $BanModel;

      switch (strtolower($Action)) {
         case 'add':
         case 'edit':
            $this->Form->SetModel($BanModel);

            if ($this->Form->AuthenticatedPostBack()) {
               if ($ID)
                  $this->Form->SetFormValue('BanID', $ID);
               try {
                  // Save the ban.
                  $this->Form->Save();
               } catch (Exception $Ex) {
                  $this->Form->AddError($Ex);
               }
            } else {
               if ($ID)
               $this->Form->SetData($BanModel->GetID($ID));
            }
            $this->SetData('_BanTypes', array('IPAddress' => T('IP Address'), 'Email' => T('Email'), 'Name' => T('Name')));
            $this->View = 'Ban';
            break;
         case 'delete':
            $BanModel->Delete(array('BanID' => $ID));
            $this->View = 'BanDelete';
            break;
         default:
            $Bans = $BanModel->GetWhere(array(), 'BanType, BanValue', 'asc', $Limit, $Offset)->ResultArray();
            $this->SetData('Bans', $Bans);
            break;
      }

      $this->Render();
   }
715193
private function runCurrentPage(MbPage $mbPage)
    {
        //Get MbAction from current action
        $mbAction = $mbPage->getMbAction($this->action);

        //Check if MbAction is invalid
        if (is_null($mbAction)) {
            $mbAction = $mbPage->addMbAction($this->action);

            if (!$mbAction->functionExist()) {
                throw new MbException(
                    "The action {$this->action} was not instantiated in " . MbPage::class . " of the page {$this->page}!"
                );
            }
        }

        $requiredParams = $mbAction->getRequiredParams();

        //Set capability of page if the capability of MbAction is not defined
        if (is_null($mbAction->getCapability())) {
            $mbAction->setCapability($mbPage->getCapability());
        }

        //Check if MbAction requires login and if there is any user logged in
        if ($mbAction->isRequiresLogin() && !$this->mbRequest->isLogged()) {
            throw new MbException(
                "The action {$this->action} of the page {$this->page} requires wordpress login!"
            );
        } //Check if MbAction capability is allowed
        elseif ($mbAction->isRequiresLogin() && !current_user_can($mbAction->getCapability())) {
            throw new MbException(
                "The action {$this->action} of the page {$this->page} requires a user with more access permissions!"
            );
        } //Check if MbAction requires a MbRequest ajax
        elseif ($mbAction->isRequiresAjax() && !$this->mbRequest->isAjax()) {
            throw new MbException(
                "The action {$this->action} of the page {$this->page} needs to be requested in admin-ajax.php!"
            );
        } //Check if the method request defined in MbAction is allowed
        elseif (!is_null($mbAction->getRequiresMethod()) && $mbAction->getRequiresMethod() != $this->mbRequest->method()) {
            throw new MbException(
                "The action {$this->action} of the page {$this->page} must be called by request method {$mbAction->getRequiresMethod()}!"
            );
        } //Check if the method request defined in MbAction is allowed
        elseif (!empty($requiredParams) && !$this->mbRequest->hasQuery($requiredParams)) {
            throw new MbException(
                "The action {$this->action} of the page {$this->page} requires the parameters " . implode(', ', $requiredParams) . "!"
            );
        }

        ob_start();

        try {

            MbEvent::callEvents($this, MbEvent::BEFORE_ACTION, $mbAction);

            //Set page parameter to View
            $mbView = new MbView();

            $mbView->setView('index', $this->page, $this->action);

            ob_start();
            $actionResponse = $this->runAction($mbAction, $mbView, [
                $this->mbRequest,
                $this->mbResponse,
                $mbView,
            ]);
            $buffer = (ob_get_contents());
            ob_end_clean();


            if($this->mbResponse->isBuffer()){
                if($this->getMbRequest()->isBlogAdmin() || $this->getMbRequest()->isAjax() || $this->getMbRequest()->isShortcode()) {
                    throw new MbException("the buffer is only available for admin-post.php");
                } else {
                    $actionResponse = $buffer;
                }
            }

            MbEvent::callEvents($this, MbEvent::AFTER_ACTION, $mbAction);

        } catch (\Exception $e) {
            MbEvent::callEvents($this, MbEvent::EXCEPTION_ACTION, $e);
            $actionResponse = $e;
        } finally {
            MbEvent::callEvents($this, MbEvent::FINISH_ACTION, $mbAction);
        }

        if(!$this->mbResponse->isRedirection()) {

            if (is_null($actionResponse) && !$this->getMbRequest()->isAjax()) {
                $actionResponse = $mbAction->getMbPage()->getController()->getMbView();
            }

            $this->mbResponse->setContent($actionResponse);
        }
    }
853942
public function validate($page, Constraint $constraint)
    {
        if (!$page instanceof CreateAction && !$page instanceof Page) {
            throw new \InvalidArgumentException(sprintf(
                '%s can only validate %s or %s objects; %s given.',
                self::class,
                Page::class,
                CreateAction::class,
                is_object($page) ? get_class($page) : gettype($page)
            ));
        }
        if ($actualPage = $this->pageLoader->retrieveByPath(
            $page instanceof CreateAction
                ? $page->getFullPath()
                : $page->getPath()
        )) {
            $this->context
                ->buildViolation($constraint->message)
                    ->atPath('path')
                    ->setParameter('{{ name }}', $actualPage->getName())
                    ->setParameter('{{ path }}', $actualPage->getPath())
                    ->setParameter('{{ parent }}', $actualPage->getParent()->getName())
                ->addViolation()
            ;
        }
    }
824399
public function handle(Action $action)
    {
        $this->action = $action;
        $ref          = $action->getRef();
        $el           = $action->getElement();

        $this->query = str_ensure_left($action->param(0), '\\');

        // transform <a> attributes that wont matter modifiers
        $el->setAttribute('class', $el->getAttribute('class') . ' phpdoc-link');
        $el->setAttribute('href', $ref->phpdoc->url($action->param(0)));


        if ( $action->containsModifier('popover') ) {
            $this->popover();
        } elseif ( $action->containsModifier('modal') ) {
            $this->modal();
        } elseif ( $action->containsModifier('type') ) {
            $this->type();
        }
    }
33999
public function update(Page &$page)
    {
        $data = $page->exportData();
        $endpoint= '/admin/pages/'.$page->id.'.json';
        $response = $this->request(
            $endpoint, 'PUT', array(
            'page' => $data
            )
        );
        $page->setData($response['page']);
    }
943424
private function doPersistIfValid(Page $page)
    {
        if (null === $page->getParent() && !empty($this->persist)) {
            // If root, only persist
            $this->em->persist($page);
            return;
        }

        $method = '';
        if (self::PERSIST_AS_FIRST_CHILD === $this->persist) {
            $method = 'insertNodeAsFirstChildOf';
        } elseif (self::PERSIST_AS_LAST_CHILD === $this->persist) {
            $method = 'insertNodeAsLastChildOf';
        }

        if (!empty($method)) {
            $this->em->getRepository('BackBee\NestedNode\Page')->$method($page, $page->getParent(), $this->isSection);
            $this->em->persist($page);
        }
    }
758623
protected function  o_page($id, $action, $options = '') {
    if  ($action !== 'new') {
      $o = & $this->objects[$id];
    }

    switch  ($action) {
    case  'new':
      $this->numPages++;
      $this->objects[$id] = array('t'=>'page', 'info'=>array('parent'=>$this->currentNode, 'pageNum'=>$this->numPages));

      if  (is_array($options)) {
        // then this must be a page insertion, array should contain 'rid','pos'=[before|after]
        $options['id'] = $id;
        $this->o_pages($this->currentNode, 'page', $options);
      } else {
        $this->o_pages($this->currentNode, 'page', $id);
      }

      $this->currentPage = $id;
      //make a contents object to go with this page
      $this->numObj++;
      $this->o_contents($this->numObj, 'new', $id);
      $this->currentContents = $this->numObj;
      $this->objects[$id]['info']['contents'] = array();
      $this->objects[$id]['info']['contents'][] = $this->numObj;

      $match =  ($this->numPages%2 ?  'odd' :  'even');
      foreach($this->addLooseObjects as  $oId=>$target) {
        if  ($target === 'all' || $match === $target) {
          $this->objects[$id]['info']['contents'][] = $oId;
        }
      }
      break;

    case  'content':
      $o['info']['contents'][] = $options;
      break;

    case  'annot':
      // add an annotation to this page
      if  (!isset($o['info']['annot'])) {
        $o['info']['annot'] = array();
      }

      // $options should contain the id of the annotation dictionary
      $o['info']['annot'][] = $options;
      break;

    case  'out':
      $res = "\n$id 0 obj\n<< /Type /Page";
      $res.= "\n/Parent ".$o['info']['parent']." 0 R";

      if  (isset($o['info']['annot'])) {
        $res.= "\n/Annots [";
        foreach($o['info']['annot'] as  $aId) {
          $res.= " $aId 0 R";
        }
        $res.= " ]";
      }

      $count =  count($o['info']['contents']);
      if  ($count == 1) {
        $res.= "\n/Contents ".$o['info']['contents'][0]." 0 R";
      } else  if  ($count>1) {
        $res.= "\n/Contents [\n";

        // reverse the page contents so added objects are below normal content
        //foreach (array_reverse($o['info']['contents']) as  $cId) {
        // Back to normal now that I've got transparency working --Benj
        foreach ($o['info']['contents'] as  $cId) {
          $res.= "$cId 0 R\n";
        }
        $res.= "]";
      }

      $res.= "\n>>\nendobj";
      return  $res;
    }
  }
244729
public function attachAction(RequiredActionInterface $action)
    {
        $actions = $this->getRequiredActions();
        $actions[] = $action;
        $this->setOption(self::OPTION_REQUIRED_ACTIONS, $actions);
    }
1359356
public function postUpdate(PageInterface $page, LifecycleEventArgs $event)
    {
        /** @var \Doctrine\ORM\EntityManagerInterface $em */
        $em = $event->getObjectManager();
        $uow = $em->getUnitOfWork();

        $changeSet = $uow->getEntityChangeSet($page);
        if (array_key_exists('enabled', $changeSet)) {
            if ($page->isEnabled()) {
                $this->discardPageRedirections($page);
            } else {
                $this->buildPageRedirections($page);
            }
        }
    }
1305271
private function handleActionParameter($actionParameter, $document, $locale)
    {
        switch ($actionParameter) {
            case 'publish':
                $this->getDocumentManager()->publish($document, $locale);
                break;
        }
    }
790370
public function action($page, $id, $action)
    {
        $this->authorize($action, $eloquent = app('scaffold.model'));

        $response = app('scaffold.actions')->exec('action::' . $action, [$eloquent]);

        if ($response instanceof Response || $response instanceof Renderable) {
            return $response;
        }

        return back()->with(
            'messages',
            [trans('administrator::messages.action_success')]
        );
    }
70135
public function doAction($action,$params){
        if(method_exists($this,$action)){
            $this->$action($params);
        }
        else{
            $this->ActionNotFound($action,$params);
        }
    }
580369
function ReportMemberAction(Member $member, Enums\Action $action)
    {
        $logItem = $this->CreateLogItem(Enums\ObjectType::Member(), $action);       
        if (!$action->Equals(Enums\Action::Delete()))
        {
            $logMember = new LogMember();
            $logMember->SetLogItem($logItem);
            $logMember->SetMember($member);
            $logMember->Save();
        }
    }