Example #1
0
        //private static object GpcEncodeValue(object value, LocalConfiguration config)
        //{
        //    if (value != null && value.GetType() == typeof(string))
        //    {
        //         // url-decodes the values: (COOKIES ONLY)
        //        string svalue = HttpUtility.UrlDecode((string)value, Configuration.Application.Globalization.PageEncoding);

        //        // quotes the values:
        //        if (Configuration.Global.GlobalVariables.QuoteGpcVariables)
        //        {
        //            if (config.Variables.QuoteInDbManner)
        //                svalue = StringUtils.AddDbSlashes(svalue);
        //            svalue = StringUtils.AddCSlashes(svalue, true, true);
        //        }

        //        //
        //        value = svalue;
        //    }

        //    return value;
        //}

        /// <summary>
        /// Adds variables from one auto-global array to another.
        /// </summary>
        /// <param name="dst">The target array.</param>
        /// <param name="src">The source array.</param>
        /// <remarks>Variable values are deeply copied.</remarks>
        /// <exception cref="ArgumentNullException"><paramref name="dst"/> is a <B>null</B> reference.</exception>
        /// <exception cref="ArgumentNullException"><paramref name="src"/> is a <B>null</B> reference.</exception>
        private static void AddVariables(PhpArray /*!*/ dst, PhpArray /*!*/ src)
        {
            Debug.Assert(dst != null && src != null);

            foreach (KeyValuePair <IntStringKey, object> entry in src)
            {
                dst[entry.Key] = PhpVariable.DeepCopy(entry.Value);
            }
        }
Example #2
0
 /// <summary>
 /// Retrieves a deep copy of this instance.
 /// </summary>
 /// <returns>The copy.</returns>
 /// <remarks>
 /// If this <see cref="PhpSmartReference"/> <see cref="IsAliased"/>, this instance is returned without copying.
 /// That is because deep copying stops on references in PHP. If this instance's <see cref="IsAliased"/> is
 /// <B>false</B>, a new <see cref="PhpSmartReference"/> referencing a deep copy of the current value is returned.
 /// </remarks>
 public override object DeepCopy()
 {
     return(IsAliased ? this : new PhpSmartReference(PhpVariable.DeepCopy(value)));
 }