replaceHtmlEntity() static public method

|----------------------------------------------------------------------------
static public replaceHtmlEntity ( $array, $toArray = false )
 /**
  * Aggregates the statements in the LRS (with the $lrsId) with the $pipeline.
  * @param string $lrsId
  * @param [mixed] $pipeline
  * @return [Aggregate] http://php.net/manual/en/mongocollection.aggregate.php#refsect1-mongocollection.aggregate-examples
  */
 public function aggregate($lrsId, array $pipeline)
 {
     if (strpos(json_encode($pipeline), '$out') !== false) {
         return;
     }
     $pipeline[0]['$match'] = ['$and' => [(object) $pipeline[0]['$match'], [self::LRS_ID_KEY => $lrsId, 'active' => true]]];
     return Helpers::replaceHtmlEntity($this->db->statements->aggregate($pipeline), true);
 }
 /**
  * Makes a statements result.
  * @param [\stdClass] $statements
  * @param Int $count
  * @param [String => Mixed] $opts
  * @return \stdClass
  */
 private function makeStatementsResult(array $statements, $count, array $opts)
 {
     // Defaults to empty array of statements.
     $statements = $statements ?: [];
     // Replaces '&46;' in keys with '.' in statements.
     // http://docs.learninglocker.net/docs/installation#quirks
     $statements = Helpers::replaceHtmlEntity($statements);
     // Creates the statement result.
     $statement_result = (object) ['more' => $this->getMoreLink($count, $opts['limit'], $opts['offset']), 'statements' => $statements];
     return json_encode($statement_result);
 }
 /**
  * Gets the statements selected by the report with the given ID and options.
  * @param String $id ID to match.
  * @param [String => Mixed] $opts
  * @return [[String => Mixed]] Statements selected by the report.
  */
 public function statements($id, array $opts)
 {
     $report = $this->show($id, $opts);
     return (new QueryRepository())->where($report->lrs_id, Helpers::replaceHtmlEntity($report->where))->orderBy('statement.stored', 'DESC');
 }
 /**
  * Gets the statement from the model as an Object.
  * @param Model $model
  * @return \stdClass
  */
 protected function formatModel(Model $model)
 {
     return Helpers::replaceHtmlEntity($model->statement);
 }
 public function toArray()
 {
     return (array) \Locker\Helpers\Helpers::replaceHtmlEntity(parent::toArray());
 }
Esempio n. 6
0
?>

<div class="row">
  <div class="col-xs-12 col-sm-12 col-lg-12">
    <div class="statement-row clearfix">

      <span onclick="$('.state-{{ $statement['id'] }}').toggle();"><i class="icon icon-cog lightgrey pull-left"></i></span>

      <span class="pull-left statement-avatar">
          <img src="{{ $avatar }}" alt='avatar' class="img-circle avatar" />
      </span> 
        
      {{ $name }}
      
      <i>{{ $verb }}</i>
        
      <a href="{{ $object_id }}">{{{ $object }}}</a>

      <small>| {{ $stored->diffForHumans() }} ({{ $stored->toDayDateTimeString() }})</small>

      <div class="full-statement state-{{ $statement['id'] }}" style="display:none;">
        <?php 
$statement = \Locker\Helpers\Helpers::replaceHtmlEntity($json);
?>
        <pre>{{{ json_encode($statement,JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) }}}</pre>
      </div>

    </div>
  </div>
</div>
 /**
  * Aggregates the statements in the LRS (with the $lrsId) with the $pipeline.
  * @param [string => mixed] $opts
  * @param [mixed] $pipeline
  * @return [Aggregate] http://php.net/manual/en/mongocollection.aggregate.php#refsect1-mongocollection.aggregate-examples
  */
 public function aggregate(array $opts, array $pipeline)
 {
     if (strpos(json_encode($pipeline), '$out') !== false) {
         return;
     }
     $match = [self::LRS_ID_KEY => $opts['lrs_id'], 'active' => true];
     $scopes = $opts['scopes'];
     if (in_array('all', $scopes) || in_array('all/read', $scopes) || in_array('statements/read', $scopes)) {
         // Get all statements.
     } else {
         if (in_array('statements/read/mine', $scopes)) {
             $match['client_id'] = $opts['client']->_id;
         } else {
             throw new Exceptions\Exception('Unauthorized request.', 401);
         }
     }
     $pipeline[0]['$match'] = ['$and' => [(object) $pipeline[0]['$match'], $match]];
     $cache_key = sha1(json_encode($pipeline));
     $create_cache = function () use($pipeline, $cache_key) {
         $expiration = Carbon::now()->addMinutes(10);
         $result = Helpers::replaceHtmlEntity($this->db->statements->aggregate($pipeline), true);
         IlluminateCache::put($cache_key, $result, $expiration);
         return $result;
     };
     //$result = IlluminateCache::get($cache_key, $create_cache);
     $result = $create_cache();
     return $result;
 }
 /**
  * Gets the statement with the given $id.
  * @param String $id Statement's UUID.
  * @param boolean $voided determines if the statement is voided.
  * @return Response
  */
 public function show($id, $voided = false)
 {
     // Runs filters.
     if ($result = $this->checkVersion()) {
         return $result;
     }
     $statement = $this->statements->show($id, array_merge(['voided' => $voided], $this->getOptions()));
     return \Response::json(Helpers::replaceHtmlEntity($statement), 200);
 }