@param string $query
@param array $data

@return string
432281
private function postProcessHttpQueryString(string $query, array $data): string
    {
        if ($this->getEncodeArraysUsingDuplication()) {
            $query = preg_replace('/%5B(?:[0-9]|[1-9][0-9]+)%5D=/', '=', $query);
        }

        if (!is_null($processor = $this->getHttpQueryCustomProcessor())) {
            $query = $processor($query, $data);
        }

        return $query;
    }
14814
private function filterQuery(string $query): string
    {
        if ($query !== '' && $query[0] === '?') {
            $query = \substr($query, 1);
        }

        $parts = \explode('&', $query);
        foreach ($parts as $index => $part) {
            [$key, $value] = $this->splitQueryValue($part);
            if ($value === null) {
                $parts[$index] = $this->filterQueryOrFragment($key);
                continue;
            }

            $parts[$index] = $this->filterQueryOrFragment($key) . '=' . $this->filterQueryOrFragment($value);
        }

        return implode('&', $parts);
    }
1284600
public function output_html($data, $query='') {
        global $OUTPUT;

        $this->load_choices();
        $currentsetting = array();
        foreach ($data as $key) {
            if ($key != 'none' and array_key_exists($key, $this->choices)) {
                $currentsetting[] = $key; // already selected first
            }
        }

        $context = (object) [
            'id' => $this->get_id(),
            'name' => $this->get_full_name(),
        ];

        $options = $this->choices;
        $selects = [];
        for ($i = 0; $i < count($this->choices) - 1; $i++) {
            if (!array_key_exists($i, $currentsetting)) {
                $currentsetting[$i] = 'none';
            }
            $selects[] = [
                'key' => $i,
                'options' => array_map(function($option) use ($options, $currentsetting, $i) {
                    return [
                        'name' => $options[$option],
                        'value' => $option,
                        'selected' => $currentsetting[$i] == $option
                    ];
                }, array_keys($options))
            ];
        }
        $context->selects = $selects;

        $element = $OUTPUT->render_from_template('core_admin/setting_courselist_frontpage', $context);

        return format_admin_setting($this, $this->visiblename, $element, $this->description, false, '', null, $query);
    }
727989
public function override($query)
    {
        foreach ($this->data as $key => $value) {
            $query = str_replace(
                sprintf('{%s}', $key),
                $value,
                $query
            );
        }

        return $query;
    }
972669
public function searchMePins($query, array $data = [])
    {
        $data["query"] = $query;
        $response = $this->request->get("me/search/pins", $data);
        return new Collection($this->master, $response, "Pin");
    }
646436
private static function parseQuery( $query )
   {

      if ( empty( $query ) )
      {
         return [];
      }

      $elements = [];

      \parse_str( $query, $elements );

      if ( ! \is_array( $elements ) )
      {
         return [];
      }

      return $elements;

   }
29984
public function update($query, $data, $option = array())
    {
        return $this->collection->update($query, $data, $option);
    }
888047
public function create($routeName, array $data = array(), array $query = array())
    {
        return $this->createUrl(parent::create($routeName, $data, $query));
    }
1305498
public function update($query, array $data) {
        $stmt = $this->executeQuery($query, $data);

        return $stmt->rowCount();       
    }
727999
protected static function normalizeQuery(?string $query): ?string
    {
        if (null === $query) {
            return null;
        }

        if ('' === $query) {
            return '';
        }

        $parts = [];
        $order = [];

        // sort query params by key and remove missing keys
        foreach (explode('&', $query) as $param) {
            if ('' === $param || '=' === $param[0]) {
                continue;
            }
            $parts[] = $param;
            $kvp = explode('=', $param, 2);
            $order[] = $kvp[0];
        }

        array_multisort($order, SORT_ASC, $parts);

        return parent::normalizeQuery(implode('&', $parts));
    }
486999
public function output_html($data, $query='') {
        global $CFG, $OUTPUT;

        $return = '';
        $brtag = html_writer::empty_tag('br');

        $searchareas = \core_search\manager::get_search_areas_list();
        $anyenabled = !empty(\core_search\manager::get_search_areas_list(true));
        $anyindexed = false;
        foreach ($searchareas as $areaid => $searcharea) {
            list($componentname, $varname) = $searcharea->get_config_var_name();
            if (get_config($componentname, $varname . '_indexingstart')) {
                $anyindexed = true;
                break;
            }
        }

        $return .= $OUTPUT->heading(get_string('searchsetupinfo', 'admin'), 3, 'main');

        $table = new html_table();
        $table->head = array(get_string('step', 'search'), get_string('status'));
        $table->colclasses = array('leftalign step', 'leftalign status');
        $table->id = 'searchsetup';
        $table->attributes['class'] = 'admintable generaltable';
        $table->data = array();

        $return .= $brtag . get_string('searchsetupdescription', 'search') . $brtag . $brtag;

        // Select a search engine.
        $row = array();
        $url = new moodle_url('/admin/settings.php?section=manageglobalsearch#admin-searchengine');
        $row[0] = '1. ' . html_writer::tag('a', get_string('selectsearchengine', 'admin'),
                        array('href' => $url));

        $status = html_writer::tag('span', get_string('no'), array('class' => 'statuscritical'));
        if (!empty($CFG->searchengine)) {
            $status = html_writer::tag('span', get_string('pluginname', 'search_' . $CFG->searchengine),
                array('class' => 'statusok'));

        }
        $row[1] = $status;
        $table->data[] = $row;

        // Available areas.
        $row = array();
        $url = new moodle_url('/admin/searchareas.php');
        $row[0] = '2. ' . html_writer::tag('a', get_string('enablesearchareas', 'admin'),
                        array('href' => $url));

        $status = html_writer::tag('span', get_string('no'), array('class' => 'statuscritical'));
        if ($anyenabled) {
            $status = html_writer::tag('span', get_string('yes'), array('class' => 'statusok'));

        }
        $row[1] = $status;
        $table->data[] = $row;

        // Setup search engine.
        $row = array();
        if (empty($CFG->searchengine)) {
            $row[0] = '3. ' . get_string('setupsearchengine', 'admin');
            $row[1] = html_writer::tag('span', get_string('no'), array('class' => 'statuscritical'));
        } else {
            $url = new moodle_url('/admin/settings.php?section=search' . $CFG->searchengine);
            $row[0] = '3. ' . html_writer::tag('a', get_string('setupsearchengine', 'admin'),
                            array('href' => $url));
            // Check the engine status.
            $searchengine = \core_search\manager::search_engine_instance();
            try {
                $serverstatus = $searchengine->is_server_ready();
            } catch (\moodle_exception $e) {
                $serverstatus = $e->getMessage();
            }
            if ($serverstatus === true) {
                $status = html_writer::tag('span', get_string('yes'), array('class' => 'statusok'));
            } else {
                $status = html_writer::tag('span', $serverstatus, array('class' => 'statuscritical'));
            }
            $row[1] = $status;
        }
        $table->data[] = $row;

        // Indexed data.
        $row = array();
        $url = new moodle_url('/admin/searchareas.php');
        $row[0] = '4. ' . html_writer::tag('a', get_string('indexdata', 'admin'), array('href' => $url));
        if ($anyindexed) {
            $status = html_writer::tag('span', get_string('yes'), array('class' => 'statusok'));
        } else {
            $status = html_writer::tag('span', get_string('no'), array('class' => 'statuscritical'));
        }
        $row[1] = $status;
        $table->data[] = $row;

        // Enable global search.
        $row = array();
        $url = new moodle_url("/admin/search.php?query=enableglobalsearch");
        $row[0] = '5. ' . html_writer::tag('a', get_string('enableglobalsearch', 'admin'),
                        array('href' => $url));
        $status = html_writer::tag('span', get_string('no'), array('class' => 'statuscritical'));
        if (\core_search\manager::is_global_search_enabled()) {
            $status = html_writer::tag('span', get_string('yes'), array('class' => 'statusok'));
        }
        $row[1] = $status;
        $table->data[] = $row;

        $return .= html_writer::table($table);

        return highlight($query, $return);
    }
29570
public function queryFromFilter(Query $query, array $data = [])
    {
        $query = parent::queryFromFilter($query, $data);

        //"Username" field
        if (!empty($data['username']) && strlen($data['username']) > 2) {
            $query->where([sprintf('%s.username LIKE', $this->getAlias()) => sprintf('%%%s%%', $data['username'])]);
        }

        //"Group" field
        if (!empty($data['group']) && is_positive($data['group'])) {
            $query->where([sprintf('%s.group_id', $this->getAlias()) => $data['group']]);
        }

        //"Status" field
        if (!empty($data['status'])) {
            switch ($data['status']) {
                case 'active':
                    $query->where([
                        sprintf('%s.active', $this->getAlias()) => true,
                        sprintf('%s.banned', $this->getAlias()) => false,
                    ]);

                    break;
                case 'pending':
                    $query->where([sprintf('%s.active', $this->getAlias()) => false]);

                    break;
                case 'banned':
                    $query->where([sprintf('%s.banned', $this->getAlias()) => true]);

                    break;
            }
        }

        return $query;
    }
932111
private function parseQuery($query)
	{
		$string = '';
		if (is_array($query))
		{
			foreach ($query as $index => $value)
			{
				$string .= !empty($string) ? ' AND ' : '';
				$string .= $index . ':' . $value;
			}
		}
		else
		{
			$string = 'id:' . $query;
		}
		return $string;
	}
378819
public function insert( $query, array $data = [ ] )
    {
        $id = NULL;

        $statement = $this->database->prepare( $query );

        if ( FALSE === $statement )
        {
            $this->close();

            throw new DatabaseException( 'Failed to create prepared statement.' );
        }

        $result = $statement->execute( $data );

        $this->query = $statement->queryString;

        if ( FALSE !== $result )
        {
            $result = ( int ) $this->database->lastInsertId();
        }

        return $result;
    }
108590
private function executeQuery($query, $data = null) {
        $stmt = $this->conn->prepare($query);
        $stmt->execute($data);
        
        return $stmt;
    }
515037
public function output_html($data, $query = '') {
        global $PAGE, $OUTPUT;

        $icon = new pix_icon('i/loading', get_string('loading', 'admin'), 'moodle', ['class' => 'loadingicon']);
        $context = (object) [
            'id' => $this->get_id(),
            'name' => $this->get_full_name(),
            'value' => $data,
            'icon' => $icon->export_for_template($OUTPUT),
            'haspreviewconfig' => !empty($this->previewconfig),
            'forceltr' => $this->get_force_ltr()
        ];

        $element = $OUTPUT->render_from_template('core_admin/setting_configcolourpicker', $context);
        $PAGE->requires->js_init_call('M.util.init_colour_picker', array($this->get_id(), $this->previewconfig));

        return format_admin_setting($this, $this->visiblename, $element, $this->description, true, '',
            $this->get_defaultsetting(), $query);
    }
577362
public function output_html($data, $query='') {
        global $OUTPUT;

        $default = $this->get_defaultsetting();
        $current = $this->get_setting();

        if (!$this->load_choices() || empty($this->choices)) {
            return '';
        }

        $context = (object) [
            'id' => $this->get_id(),
            'name' => $this->get_full_name(),
        ];

        if (!is_null($default) && array_key_exists($default, $this->choices)) {
            $defaultinfo = $this->choices[$default];
        } else {
            $defaultinfo = NULL;
        }

        // Warnings.
        $warning = '';
        if ($current === null) {
            // First run.
        } else if (empty($current) && (array_key_exists('', $this->choices) || array_key_exists(0, $this->choices))) {
            // No warning.
        } else if (!array_key_exists($current, $this->choices)) {
            $warning = get_string('warningcurrentsetting', 'admin', $current);
            if (!is_null($default) && $data == $current) {
                $data = $default; // Use default instead of first value when showing the form.
            }
        }

        $options = [];
        $template = 'core_admin/setting_configselect';

        if (!empty($this->optgroups)) {
            $optgroups = [];
            foreach ($this->optgroups as $label => $choices) {
                $optgroup = array('label' => $label, 'options' => []);
                foreach ($choices as $value => $name) {
                    $optgroup['options'][] = [
                        'value' => $value,
                        'name' => $name,
                        'selected' => (string) $value == $data
                    ];
                    unset($this->choices[$value]);
                }
                $optgroups[] = $optgroup;
            }
            $context->options = $options;
            $context->optgroups = $optgroups;
            $template = 'core_admin/setting_configselect_optgroup';
        }

        foreach ($this->choices as $value => $name) {
            $options[] = [
                'value' => $value,
                'name' => $name,
                'selected' => (string) $value == $data
            ];
        }
        $context->options = $options;

        $element = $OUTPUT->render_from_template($template, $context);

        return format_admin_setting($this, $this->visiblename, $element, $this->description, true, $warning, $defaultinfo, $query);
    }