Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

class Parameters: Encoding of Name in function Add

Hi Mark,
I want the Name of Parameter not to be encoded when using the Add function of Parameters class.
Is it possible to leave the $Name untouched when passing a 5th parameter?

function Add($Name, $Value, $EncodeValue = 1, $Id = '', $EncodeName = 1) {
	if ($EncodeValue && !is_array($Value)) $Value = urlencode($Value);
	if ($EncodeName) $Name = urlencode($Name);
	$this->aParameters[$Name] = array("Value" => $Value, "Id" => $Id);
 }
Background:
I need the name to be "PredefindeAttributes[AttributeName]". But with encoding it becomes: name="PredefinedAttributes%5BAttributeName%5D" and I can't get the Array back using ForceIncomingArray("PredefinedAttributes", false) than.

I would be great if you're going to change the function as suggested above!?

Comments

  • MarkMark Vanilla Staff
    The function already gives you the option of not encoding the name. Just call it like this:

    Add("ParameterName", "ParameterValue", 1, '', 0);
  • SVN says "Checked out external at revision 38."
    and I get
    
    	// Add an element to the collection
    	function Add($Name, $Value, $EncodeValue = 1, $Id = '') {
    		if ($EncodeValue && !is_array($Value)) $Value = urlencode($Value);
    		$Name = urlencode($Name);
    		$this->aParameters[$Name] = array("Value" => $Value, "Id" => $Id);
     	}
    
    Maybe something wents from with my SVN here. I never used it before working with Vanilla.
    The code in my first posting is my suggestion..
  • MarkMark Vanilla Staff
    Ahhhh - my bad - Mildly hungover, sorry.

    It's been done in svn.
This discussion has been closed.