Make WordPress Core

Changeset 81 in tests for wp-testlib/utils.php


Ignore:
Timestamp:
11/11/2007 10:38:57 PM (18 years ago)
Author:
tellyworth
Message:

add mask_input_value() util function

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wp-testlib/utils.php

    • Property svn:eol-style set to native
    r70 r81  
    7171        $this->events[] = array('filter' => __FUNCTION__, 'tag'=>$this->current_filter(), 'args'=>$args);
    7272        return $arg;
     73    }
     74
     75    function filterall($tag, $arg) {
     76    // this one doesn't return the result, so it's safe to use with the new 'all' filter
     77if ($this->debug) dmp(__FUNCTION__, $this->current_filter());
     78
     79        $args = func_get_args();
     80        $this->events[] = array('filter' => __FUNCTION__, 'tag'=>$tag, 'args'=>array_slice($args, 1));
    7381    }
    7482
     
    289297}
    290298
     299// mask out any input fields matching the given name
     300function mask_input_value($in, $name='_wpnonce') {
     301    return preg_replace('@<input([^>]*) name="'.preg_quote($name).'"([^>]*) value="[^>]*" />@', '<input$1 name="'.preg_quote($name).'"$2 value="***" />', $in);
     302}
     303
    291304?>
Note: See TracChangeset for help on using the changeset viewer.