Json::initialize PHP Method

initialize() protected method

protected initialize ( $which = NULL )
  protected function initialize($which = NULL)
  {
    switch($which)
    {
      case 'entries':
        //initialize caches
        $this->entries = array();
        $this->entries_entry_ids = array();
        $this->entries_custom_fields = array();
        $this->entries_matrix_rows = NULL;
        $this->entries_rel_data = NULL;
        $this->entries_relationship_data = NULL;
        $this->entries_playa_data = NULL;
        $this->entries_channel_files_data = NULL;
        break;
    }

    $this->xhr = ee()->TMPL->fetch_param('xhr') === 'yes';

    $this->terminate = ee()->TMPL->fetch_param('terminate') === 'yes';

    $this->fields = (ee()->TMPL->fetch_param('fields')) ? explode('|', ee()->TMPL->fetch_param('fields')) : array();

    $this->date_format = ee()->TMPL->fetch_param('date_format');

    // get rid of EE formatted dates
    if ($this->date_format && strstr($this->date_format, '%'))
    {
      $this->date_format = str_replace('%', '', $this->date_format);
    }

    $this->jsonp = ee()->TMPL->fetch_param('jsonp') === 'yes';

    ee()->load->library('jsonp');

    $this->callback = (ee()->TMPL->fetch_param('callback') && ee()->jsonp->isValidCallback(ee()->TMPL->fetch_param('callback')))
          ? ee()->TMPL->fetch_param('callback') : NULL;

    $this->content_type = ee()->TMPL->fetch_param('content_type', ($this->jsonp && $this->callback) ? 'application/javascript' : 'application/json');
  }