| @@ 117-130 (lines=14) @@ | ||
| 114 | * |
|
| 115 | * @return string |
|
| 116 | */ |
|
| 117 | protected function getFileContent ( $url , $progress = false ) |
|
| 118 | { |
|
| 119 | $context = stream_context_create ( self::$opts ); |
|
| 120 | if ( $progress ) |
|
| 121 | { |
|
| 122 | stream_context_set_params ( $context , array ( |
|
| 123 | "notification" => array ( |
|
| 124 | $this , 'stream_notification_callback' |
|
| 125 | ) |
|
| 126 | ) ); |
|
| 127 | } |
|
| 128 | ||
| 129 | return file_get_contents ( $url , false , $context ); |
|
| 130 | } |
|
| 131 | ||
| 132 | /** |
|
| 133 | * @param $url |
|
| @@ 137-152 (lines=16) @@ | ||
| 134 | * |
|
| 135 | * @return string |
|
| 136 | */ |
|
| 137 | protected function getStreamContent ( $url , $progress = false ) |
|
| 138 | { |
|
| 139 | $context = stream_context_create ( self::$opts ); |
|
| 140 | if ( $progress ) |
|
| 141 | { |
|
| 142 | stream_context_set_params ( $context , array ( |
|
| 143 | "notification" => array ( |
|
| 144 | $this , 'stream_notification_callback' |
|
| 145 | ) |
|
| 146 | ) ); |
|
| 147 | } |
|
| 148 | ||
| 149 | $handle = fopen ( $url , "r" , null , $context ); |
|
| 150 | ||
| 151 | return stream_get_contents ( $handle ); |
|
| 152 | } |
|
| 153 | ||
| 154 | public function putContent ( $url , $content ) |
|
| 155 | { |
|