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 PhabricatorBadgesDatasource extends PhabricatorTypeaheadDatasource { ..

Decoded Output download

<?php

final class PhabricatorBadgesDatasource
  extends PhabricatorTypeaheadDatasource {

  public function getBrowseTitle() {
    return pht('Browse Badges');
  }

  public function getPlaceholderText() {
    return pht('Type a badge name...');
  }

  public function getDatasourceApplicationClass() {
    return 'PhabricatorBadgesApplication';
  }

  public function loadResults() {
    $viewer = $this->getViewer();
    $raw_query = $this->getRawQuery();

    $params = $this->getParameters();
    $recipient_phid = $params['recipientPHID'];

    $badges = id(new PhabricatorBadgesQuery())
      ->setViewer($viewer)
      ->requireCapabilities(
        array(
          PhabricatorPolicyCapability::CAN_VIEW,
          PhabricatorPolicyCapability::CAN_EDIT,
        ))
      ->execute();

    $awards = id(new PhabricatorBadgesAwardQuery())
      ->setViewer($viewer)
      ->withAwarderPHIDs(array($viewer->getPHID()))
      ->withRecipientPHIDs(array($recipient_phid))
      ->execute();
    $awards = mpull($awards, null, 'getBadgePHID');

    $results = array();
    foreach ($badges as $badge) {
      $closed = null;

      $badge_awards = idx($awards, $badge->getPHID(), null);
      if ($badge_awards) {
        $closed = pht('Already awarded');
      }

      $status = $badge->getStatus();
      if ($status === PhabricatorBadgesBadge::STATUS_ARCHIVED) {
        $closed = pht('Archived');
      }

      $results[] = id(new PhabricatorTypeaheadResult())
        ->setName($badge->getName())
        ->setIcon($badge->getIcon())
        ->setColor(
          PhabricatorBadgesQuality::getQualityColor($badge->getQuality()))
        ->setClosed($closed)
        ->setPHID($badge->getPHID());
    }

    $results = $this->filterResultsAgainstTokens($results);

    return $results;
  }

}
 ?>

Did this file decode correctly?

Original Code

<?php

final class PhabricatorBadgesDatasource
  extends PhabricatorTypeaheadDatasource {

  public function getBrowseTitle() {
    return pht('Browse Badges');
  }

  public function getPlaceholderText() {
    return pht('Type a badge name...');
  }

  public function getDatasourceApplicationClass() {
    return 'PhabricatorBadgesApplication';
  }

  public function loadResults() {
    $viewer = $this->getViewer();
    $raw_query = $this->getRawQuery();

    $params = $this->getParameters();
    $recipient_phid = $params['recipientPHID'];

    $badges = id(new PhabricatorBadgesQuery())
      ->setViewer($viewer)
      ->requireCapabilities(
        array(
          PhabricatorPolicyCapability::CAN_VIEW,
          PhabricatorPolicyCapability::CAN_EDIT,
        ))
      ->execute();

    $awards = id(new PhabricatorBadgesAwardQuery())
      ->setViewer($viewer)
      ->withAwarderPHIDs(array($viewer->getPHID()))
      ->withRecipientPHIDs(array($recipient_phid))
      ->execute();
    $awards = mpull($awards, null, 'getBadgePHID');

    $results = array();
    foreach ($badges as $badge) {
      $closed = null;

      $badge_awards = idx($awards, $badge->getPHID(), null);
      if ($badge_awards) {
        $closed = pht('Already awarded');
      }

      $status = $badge->getStatus();
      if ($status === PhabricatorBadgesBadge::STATUS_ARCHIVED) {
        $closed = pht('Archived');
      }

      $results[] = id(new PhabricatorTypeaheadResult())
        ->setName($badge->getName())
        ->setIcon($badge->getIcon())
        ->setColor(
          PhabricatorBadgesQuality::getQualityColor($badge->getQuality()))
        ->setClosed($closed)
        ->setPHID($badge->getPHID());
    }

    $results = $this->filterResultsAgainstTokens($results);

    return $results;
  }

}

Function Calls

None

Variables

None

Stats

MD5 d8f96307fc3a87a1aec7bc1edae8f70e
Eval Count 0
Decode Time 84 ms