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

Decoded Output download

<?php

final class PhabricatorEmojiDatasource extends PhabricatorTypeaheadDatasource {

  public function getPlaceholderText() {
    return pht('Type an emoji name...');
  }

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

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

  public function loadResults() {
    $results = $this->buildResults();
    return $this->filterResultsAgainstTokens($results);
  }

  protected function renderSpecialTokens(array $values) {
    return $this->renderTokensFromResults($this->buildResults(), $values);
  }

  private function buildResults() {
    $raw_query = $this->getRawQuery();

    $data = id(new PhabricatorEmojiRemarkupRule())->markupEmojiJSON();
    $emojis = phutil_json_decode($data);

    $results = array();
    foreach ($emojis as $shortname => $emoji) {
      $display_name = $emoji.' '.$shortname;
      $name = str_replace('_', ' ', $shortname);
      $result = id(new PhabricatorTypeaheadResult())
        ->setPHID($shortname)
        ->setName($name)
        ->setDisplayname($display_name)
        ->setAutocomplete($emoji);

      $results[$shortname] = $result;
    }
    return $results;
  }

}
 ?>

Did this file decode correctly?

Original Code

<?php

final class PhabricatorEmojiDatasource extends PhabricatorTypeaheadDatasource {

  public function getPlaceholderText() {
    return pht('Type an emoji name...');
  }

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

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

  public function loadResults() {
    $results = $this->buildResults();
    return $this->filterResultsAgainstTokens($results);
  }

  protected function renderSpecialTokens(array $values) {
    return $this->renderTokensFromResults($this->buildResults(), $values);
  }

  private function buildResults() {
    $raw_query = $this->getRawQuery();

    $data = id(new PhabricatorEmojiRemarkupRule())->markupEmojiJSON();
    $emojis = phutil_json_decode($data);

    $results = array();
    foreach ($emojis as $shortname => $emoji) {
      $display_name = $emoji.' '.$shortname;
      $name = str_replace('_', ' ', $shortname);
      $result = id(new PhabricatorTypeaheadResult())
        ->setPHID($shortname)
        ->setName($name)
        ->setDisplayname($display_name)
        ->setAutocomplete($emoji);

      $results[$shortname] = $result;
    }
    return $results;
  }

}

Function Calls

None

Variables

None

Stats

MD5 e03634971ec6b603359b8a363b549d99
Eval Count 0
Decode Time 104 ms