⌈⌋ branch:  freshcode


Check-in [7d2a749ebc]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
SHA1:7d2a749ebcfed0a17d3675fcf968596780ceb3fa
Date: 2014-08-02 20:50:25
User: mario
Comment:Moved defaults into static ::$defaults to also override UserAgent
Tags And Properties
  • branch=trunk inherited from [82405bb421]
  • sym-trunk inherited from [82405bb421]
Context
2014-08-02
20:51
[f5ea6d4058] Added "Project Spotlight" to page footer, and a cron-job for rotating 3 random projects in there. (user: mario, tags: trunk)
20:50
[7d2a749ebc] Moved defaults into static ::$defaults to also override UserAgent (user: mario, tags: trunk)
2014-07-31
21:59
[dbe565ce99] DW in sidebar, a bit more API feed filtering (user: mario, tags: trunk)
Changes

Changes to lib/curl.php.

53
54
55
56
57
58
59












60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79

80
81

82
83
84
85
86
87
88
89
90
91


    /**
     * resource / curl handle
     *
     */
    public $handle = NULL;














    /**
     * Initialize, where $params is usually just an $url, or an [OPT=>val] list
     *
     */
    function __construct($params) {
    
        // create
        $this->handle = is_object($params) ? $params : curl_init();
        
        // default options
        $this->returntransfer(1)
             ->httpget(1)
             ->http200aliases(array(200,201,202,203))
             ->header(0)
             ->UserAgent("freshcode/0.5 (U) +http://freshcode.club/")
             ->followlocation(!ini_get("safe_mode"));
             
        // option is just URL string

        if (is_string($params)) {
            $this->url($params);

        }
        // multiple [url=>$url, post=>$bool, ..] options
        elseif (is_array($params)) foreach ($params as $cmd=>$opt) {
            $this->__call($cmd, array($opt));
        }
    }

    
    /**
     * Most invocations are mapped onto CURL_CONST settings,







>
>
>
>
>
>
>
>
>
>
>
>











|
|
|
<
<
<
|
<
<
>
|
<
>
|

|







53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85



86


87
88

89
90
91
92
93
94
95
96
97
98
99


    /**
     * resource / curl handle
     *
     */
    public $handle = NULL;
    
    
    /**
     * Setup parameters.
     *
     */
    static $defaults = array(
        "returntransfer" => 1,
        "httpget" => 1,
        "http200aliases" => array(200, 201, 202, 203),
        "header" => 0,
    );


    /**
     * Initialize, where $params is usually just an $url, or an [OPT=>val] list
     *
     */
    function __construct($params) {
    
        // create
        $this->handle = is_object($params) ? $params : curl_init();
        
        // merge options
        $params = array_merge(
            curl::$defaults,



            array("followlocation" => !ini_get("safe_mode")),


            is_array($params) ? array_change_key_case($params) : array(),
            is_string($params) ? array("url" => $params) : array()

        );

        // multiple [url=>$url, post=>$bool, ..] options
        if (is_array($params)) foreach ($params as $cmd=>$opt) {
            $this->__call($cmd, array($opt));
        }
    }

    
    /**
     * Most invocations are mapped onto CURL_CONST settings,

lib/htmlpurifier.phar became executable.

cannot compute difference between binary files