Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php final class PhrictionDocumentDeleteTransaction extends PhrictionDocumentVersionTr..

Decoded Output download

<?php

final class PhrictionDocumentDeleteTransaction
  extends PhrictionDocumentVersionTransaction {

  const TRANSACTIONTYPE = 'delete';

  public function generateOldValue($object) {
    return null;
  }

  public function applyInternalEffects($object, $value) {
    $object->setStatus(PhrictionDocumentStatus::STATUS_DELETED);

    $content = $this->getNewDocumentContent($object);

    $content->setContent('');
    $content->setChangeType(PhrictionChangeType::CHANGE_DELETE);
  }

  public function getActionStrength() {
    return 150;
  }

  public function getActionName() {
    return pht('Deleted');
  }

  public function getTitle() {
    return pht(
      '%s deleted this document.',
      $this->renderAuthor());
  }

  public function getTitleForFeed() {
    return pht(
      '%s deleted %s.',
      $this->renderAuthor(),
      $this->renderObject());
  }

  public function validateTransactions($object, array $xactions) {
    $errors = array();

    $e_text = null;
    foreach ($xactions as $xaction) {
      switch ($object->getStatus()) {
        case PhrictionDocumentStatus::STATUS_DELETED:
          if ($xaction->getMetadataValue('contentDelete')) {
            $e_text = pht(
              'This document is already deleted. You must specify '.
              'content to re-create the document and make further edits.');
          } else {
            $e_text = pht(
              'An already deleted document can not be deleted.');
          }
          break;
        case PhrictionDocumentStatus::STATUS_MOVED:
          $e_text = pht('A moved document can not be deleted.');
          break;
        case PhrictionDocumentStatus::STATUS_STUB:
          $e_text = pht('A stub document can not be deleted.');
          break;
        default:
          break;
      }

      if ($e_text !== null) {
        $errors[] = $this->newInvalidError($e_text);
      }

    }

    return $errors;
  }

  public function getIcon() {
    return 'fa-trash-o';
  }

  public function getColor() {
    return 'red';
  }

}
 ?>

Did this file decode correctly?

Original Code

<?php

final class PhrictionDocumentDeleteTransaction
  extends PhrictionDocumentVersionTransaction {

  const TRANSACTIONTYPE = 'delete';

  public function generateOldValue($object) {
    return null;
  }

  public function applyInternalEffects($object, $value) {
    $object->setStatus(PhrictionDocumentStatus::STATUS_DELETED);

    $content = $this->getNewDocumentContent($object);

    $content->setContent('');
    $content->setChangeType(PhrictionChangeType::CHANGE_DELETE);
  }

  public function getActionStrength() {
    return 150;
  }

  public function getActionName() {
    return pht('Deleted');
  }

  public function getTitle() {
    return pht(
      '%s deleted this document.',
      $this->renderAuthor());
  }

  public function getTitleForFeed() {
    return pht(
      '%s deleted %s.',
      $this->renderAuthor(),
      $this->renderObject());
  }

  public function validateTransactions($object, array $xactions) {
    $errors = array();

    $e_text = null;
    foreach ($xactions as $xaction) {
      switch ($object->getStatus()) {
        case PhrictionDocumentStatus::STATUS_DELETED:
          if ($xaction->getMetadataValue('contentDelete')) {
            $e_text = pht(
              'This document is already deleted. You must specify '.
              'content to re-create the document and make further edits.');
          } else {
            $e_text = pht(
              'An already deleted document can not be deleted.');
          }
          break;
        case PhrictionDocumentStatus::STATUS_MOVED:
          $e_text = pht('A moved document can not be deleted.');
          break;
        case PhrictionDocumentStatus::STATUS_STUB:
          $e_text = pht('A stub document can not be deleted.');
          break;
        default:
          break;
      }

      if ($e_text !== null) {
        $errors[] = $this->newInvalidError($e_text);
      }

    }

    return $errors;
  }

  public function getIcon() {
    return 'fa-trash-o';
  }

  public function getColor() {
    return 'red';
  }

}

Function Calls

None

Variables

None

Stats

MD5 99228839f0a72d4e5a153d62638b0e92
Eval Count 0
Decode Time 89 ms