⌈⌋ ⎇ branch:  freshcode


Check-in [7d2a749ebc]

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

Overview
Comment:Moved defaults into static ::$defaults to also override UserAgent
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 7d2a749ebcfed0a17d3675fcf968596780ceb3fa
User & Date: mario 2014-08-02 20:50:25
Context
2014-08-02
20:51
Added "Project Spotlight" to page footer, and a cron-job for rotating 3 random projects in there. check-in: f5ea6d4058 user: mario tags: trunk
20:50
Moved defaults into static ::$defaults to also override UserAgent check-in: 7d2a749ebc user: mario tags: trunk
2014-07-31
21:59
DW in sidebar, a bit more API feed filtering check-in: dbe565ce99 user: mario tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

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