pike.git / lib / modules / Web.pmod / Auth.pmod / module.pmod

version» Context lines:

pike.git/lib/modules/Web.pmod/Auth.pmod/module.pmod:27:    //! Sign the parameters    //!    //! @param secret    //! The API secret    string sign(string secret)    {    return md5(sort(params)->name_value()*"" + secret);    }       //! Parameter keys -  array(string) _indices() +  protected array(string) _indices()    {    return params->get_name();    }       //! Parameter values -  array(string) _values() +  protected array(string) _values()    {    return params->get_value();    }       //! Returns the array of @[Param]eters    array(Param) get_params()    {    return params;    }   
pike.git/lib/modules/Web.pmod/Auth.pmod/module.pmod:85:       return this;    }       //! Add @[p] to the array of @[Param]eters    //!    //! @param p    //!    //! @returns    //! A new @[Params] object -  this_program `+(Param|this_program p) +  protected this_program `+(Param|this_program p)    {    if (mappingp(p)) {    foreach (p; string k; string v) {    params += ({ Param(k, v) });    }       return this;    }       if (INSTANCE_OF(p, this))    params += p->get_params();    else    params += ({ p });       return this;    }       //! Remove @[p] from the @[Param]eters array of the current object.    //!    //! @param p -  this_program `-(Param|this_program p) +  protected this_program `-(Param|this_program p)    {    if (!p) return this;       array(Param) the_params;    if (INSTANCE_OF(p, this))    the_params = p->get_params();    else    the_params = ({ p });       return object_program(this)(@(params-the_params));    }       //! Index lookup    //!    //! @param key    //! The name of a @[Param]erter to find. -  Param `[](string key) +  protected Param `[](string key)    {    foreach (params, Param p)    if (p->get_name() == key)    return p;       return 0;    }       //! Clone the current instance    this_program clone()    {    return object_program(this)(@params);    }       //! String format method    //!    //! @param t -  string _sprintf(int t) +  protected string _sprintf(int t)    {    return t == 'O' && sprintf("%O(%O)", object_program(this), params);    }       //! Casting method    //!    //! @param how -  mixed cast(string how) +  protected mixed cast(string how)    {    switch (how) {    case "mapping": return to_mapping();    case "string": return to_query();    } -  +  error("Cant cast %O() to %O\n", this_program, how);    }   }      //! Representation of a parameter.   //!   //! Many Social web services use a RESTful communication and have similiar   //! API's. This class is suitable for many RESTful web services and if this   //! class doesn't suite a particular service, just inherit this class and   //! rewrite the behaviour where needed.   //!
pike.git/lib/modules/Web.pmod/Auth.pmod/module.pmod:228:       //! Same as @[name_value()] except this URL encodes the value.    string name_value_encoded()    {    return urlencode(name) + "=" + urlencode(value);    }       //! Comparer method. Checks if @[other] equals this object    //!    //! @param other -  int(0..1) `==(mixed other) +  protected int(0..1) `==(mixed other)    {    if (!INSTANCE_OF(this, other)) return 0;    if (name == other->get_name())    return value == other->get_value();       return 0;    }       //! Checks if this object is greater than @[other]    //!    //! @param other -  int(0..1) `>(mixed other) +  protected int(0..1) `>(mixed other)    {    if (!INSTANCE_OF(this, other)) return 0;    if (name == other->get_name())    return value > other->get_value();       return name > other->get_name();    }       //! Checks if this object is less than @[other]    //!    //! @param other -  int(0..1) `<(mixed other) +  protected int(0..1) `<(mixed other)    {    if (!INSTANCE_OF(this, other)) return 0;    if (name == other->get_name())    return value < other->get_value();       return name < other->get_name();    }       //! String format method    //!    //! @param t -  string _sprintf(int t) +  protected string _sprintf(int t)    {    return t == 'O' && sprintf("%O(%O,%O)", object_program(this), name, value);    }    -  mixed cast(string how) +  protected mixed cast(string how)    {    switch (how)    {    case "string": return name_value_encoded();    }       error("Cant cast %O() to %O\n", this_program, how);    }       //! Makes sure @[v] to set as @[value] is in UTF-8 encoding