Changeset 259 for trunk/lib/App.inc.php


Ignore:
Timestamp:
Jun 19, 2007 4:04:42 AM (17 years ago)
Author:
quinn
Message:

Misc bug fixes. Added App::dropQuery() method.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/App.inc.php

    r249 r259  
    597597     * @return                The string representation of $priority.
    598598     */
    599     function logPriorityToString ($priority) {
     599    function logPriorityToString($priority) {
    600600        $priorities = array(
    601601            LOG_EMERG   => 'emergency',
     
    621621     *
    622622     * @access  public
    623      * @param   string  $query_key  The key of the query argument to save.
     623     * @param   mixed   $query_key   The key (or keys, as an array) of the query argument to save.
    624624     * @param   mixed   $default    If the key is not available, set to this default value.
    625625     * @author  Quinn Comendant <quinn@strangecode.com>
     
    628628    function carryQuery($query_key, $default=false)
    629629    {
    630         // If not already set, and there is a non-empty value provided in the request...
    631         if (!isset($this->_carry_queries[$query_key]) && false !== getFormData($query_key, $default)) {
    632             // Copy the value of the specified query argument into the _carry_queries array.
    633             $this->_carry_queries[$query_key] = getFormData($query_key, $default);
     630        if (!is_array($query_key)) {
     631            $query_key = array($query_key);
     632        }
     633        foreach ($query_key as $k) {
     634            // If not already set, and there is a non-empty value provided in the request...
     635            if (!isset($this->_carry_queries[$k]) && false !== getFormData($k, $default)) {
     636                // Copy the value of the specified query argument into the _carry_queries array.
     637                $this->_carry_queries[$k] = getFormData($k, $default);
     638            }
     639        }
     640    }
     641
     642    /**
     643     * dropQuery() is the opposite of carryQuery(). The specified value will not appear in
     644     * url()/ohref()/printHiddenSession() modified URLs unless explicitly written in.
     645     *
     646     * @access  public
     647     * @param   mixed   $query_key  The key (or keys, as an array) of the query argument to remove.
     648     * @author  Quinn Comendant <quinn@strangecode.com>
     649     * @since   18 Jun 2007 20:57:29
     650     */
     651    function dropQuery($query_key, $default=false)
     652    {
     653        if (!is_array($query_key)) {
     654            $query_key = array($query_key);
     655        }
     656        foreach ($query_key as $k) {
     657            if (isset($this->_carry_queries[$query_key])) {
     658                // Remove the value of the specified query argument from the _carry_queries array.
     659                unset($this->_carry_queries[$query_key]);
     660            }
    634661        }
    635662    }
Note: See TracChangeset for help on using the changeset viewer.