How to use clear method of http class

Best Atoum code snippet using http.clear

ModeratorController.php

Source:ModeratorController.php Github

copy

Full Screen

...126 }127 public function approvedPictureAlbum()128 {129 if ($this->oModeratorModel->approvedPictureAlbum($this->httpRequest->post('album_id'))) {130 $this->clearPictureCache();131 $this->sMsg = t('The photo album has been approved!');132 } else {133 $this->sMsg = t('Oops! The photo album could not be approved!');134 }135 Header::redirect(Uri::get(PH7_ADMIN_MOD, 'moderator', 'picturealbum'), $this->sMsg);136 }137 public function approvedPhoto()138 {139 if ($this->oModeratorModel->approvedPicture($this->httpRequest->post('picture_id'))) {140 $this->clearPictureCache();141 $this->sMsg = t('The picture has been approved!');142 } else {143 $this->sMsg = t('Oops! The picture could not be approved!');144 }145 Header::redirect(Uri::get(PH7_ADMIN_MOD, 'moderator', 'picture'), $this->sMsg);146 }147 public function approvedVideoAlbum()148 {149 if ($this->oModeratorModel->approvedVideoAlbum($this->httpRequest->post('album_id'))) {150 $this->clearVideoCache();151 $this->sMsg = t('The video album has been approved!');152 } else {153 $this->sMsg = t('Oops! The video album could not be approved!');154 }155 Header::redirect(Uri::get(PH7_ADMIN_MOD, 'moderator', 'videoalbum'), $this->sMsg);156 }157 public function approvedVideo()158 {159 if ($this->oModeratorModel->approvedVideo($this->httpRequest->post('video_id'))) {160 $this->clearVideoCache();161 $this->sMsg = t('The video has been approved!');162 } else {163 $this->sMsg = t('Oops! The video could not be approved!');164 }165 Header::redirect(Uri::get(PH7_ADMIN_MOD, 'moderator', 'video'), $this->sMsg);166 }167 public function approvedAvatar()168 {169 if ($this->oModeratorModel->approvedAvatar($this->httpRequest->post('id'))) {170 $this->clearAvatarCache();171 $this->sMsg = t('The profile photo has been approved!');172 } else {173 $this->sMsg = t('Oops! The profile photo could not be approved!');174 }175 Header::redirect(Uri::get(PH7_ADMIN_MOD, 'moderator', 'avatar'), $this->sMsg);176 }177 public function approvedBackground()178 {179 if ($this->oModeratorModel->approvedBackground($this->httpRequest->post('id'))) {180 $this->clearUserBgCache();181 $this->sMsg = t('The wallpaper has been approved!');182 } else {183 $this->sMsg = t('Oops! The wallpaper could not be approved!');184 }185 Header::redirect(Uri::get(PH7_ADMIN_MOD, 'moderator', 'background'), $this->sMsg);186 }187 public function disapprovedPictureAlbum()188 {189 if ($this->oModeratorModel->approvedPictureAlbum($this->httpRequest->post('album_id'), '0')) {190 $this->clearPictureCache();191 $this->sMsg = t('The photo album has been disapproved!');192 } else {193 $this->sMsg = t('Oops! The photo album could not be disapproved!');194 }195 Header::redirect(Uri::get(PH7_ADMIN_MOD, 'moderator', 'picturealbum'), $this->sMsg);196 }197 public function disapprovedPhoto()198 {199 if ($this->oModeratorModel->approvedPicture($this->httpRequest->post('picture_id'), '0')) {200 $this->clearPictureCache();201 $this->sMsg = t('The picture has been disapproved!');202 } else {203 $this->sMsg = t('Oops! The picture could not be disapproved!');204 }205 Header::redirect(Uri::get(PH7_ADMIN_MOD, 'moderator', 'picture'), $this->sMsg);206 }207 public function disapprovedVideoAlbum()208 {209 if ($this->oModeratorModel->approvedVideoAlbum($this->httpRequest->post('album_id'), '0')) {210 $this->clearVideoCache();211 $this->sMsg = t('The video album has been disapproved!');212 } else {213 $this->sMsg = t('Oops! The video album could not be disapproved!');214 }215 Header::redirect(Uri::get(PH7_ADMIN_MOD, 'moderator', 'videoalbum'), $this->sMsg);216 }217 public function disapprovedVideo()218 {219 if ($this->oModeratorModel->approvedVideo($this->httpRequest->post('video_id'), '0')) {220 $this->clearVideoCache();221 $this->sMsg = t('The video has been disapproved!');222 } else {223 $this->sMsg = t('Oops! The video could not be disapproved!');224 }225 Header::redirect(Uri::get(PH7_ADMIN_MOD, 'moderator', 'video'), $this->sMsg);226 }227 public function disapprovedAvatar()228 {229 if ($this->oModeratorModel->approvedAvatar($this->httpRequest->post('id'), '0')) {230 $this->clearAvatarCache();231 $this->sMsg = t('The profile photo has been disapproved!');232 } else {233 $this->sMsg = t('Oops! The profile photo could not be disapprove!');234 }235 Header::redirect(Uri::get(PH7_ADMIN_MOD, 'moderator', 'avatar'), $this->sMsg);236 }237 public function disapprovedBackground()238 {239 if ($this->oModeratorModel->approvedBackground($this->httpRequest->post('id'), '0')) {240 $this->clearUserBgCache();241 $this->sMsg = t('The wallpaper has been disapproved!');242 } else {243 $this->sMsg = t('Oops! The wallpaper could not be disapprove!');244 }245 Header::redirect(Uri::get(PH7_ADMIN_MOD, 'moderator', 'background'), $this->sMsg);246 }247 public function deletePictureAlbum()248 {249 if (250 (new PictureCoreModel)->deletePhoto($this->httpRequest->post('id'), $this->httpRequest->post('album_id'))251 && $this->oModeratorModel->deletePictureAlbum($this->httpRequest->post('album_id'))252 ) {253 $sDir = PH7_PATH_PUBLIC_DATA_SYS_MOD . 'picture/img/' . $this->httpRequest->post('username') . PH7_DS . $this->httpRequest->post('album_id') . PH7_DS;254 $this->file->deleteDir($sDir);255 $this->clearPictureCache();256 $this->sMsg = t('The photo album has been deleted!');257 } else {258 $this->sMsg = t('Oops! The photo album could not be deleted');259 }260 Header::redirect(Uri::get(PH7_ADMIN_MOD, 'moderator', 'picturealbum'), $this->sMsg);261 }262 public function deletePhoto()263 {264 $bPicture = (new PictureCoreModel)->deletePhoto($this->httpRequest->post('id'), $this->httpRequest->post('album_id'), $this->httpRequest->post('picture_id'));265 if ($bPicture) {266 (new PictureCore)->deletePhoto($this->httpRequest->post('album_id'), $this->httpRequest->post('username'), $this->httpRequest->post('picture_link'));267 $this->clearPictureCache();268 $this->sMsg = t('The picture has been deleted!');269 } else {270 $this->sMsg = t('Oops! The picture could not be deleted!');271 }272 Header::redirect(Uri::get(PH7_ADMIN_MOD, 'moderator', 'picture'), $this->sMsg);273 }274 public function deleteVideoAlbum()275 {276 if (277 (new VideoCoreModel)->deleteVideo($this->httpRequest->post('id'), $this->httpRequest->post('album_id'))278 && $this->oModeratorModel->deleteVideoAlbum($this->httpRequest->post('album_id'))279 ) {280 $sDir = PH7_PATH_PUBLIC_DATA_SYS_MOD . 'video/file/' . $this->httpRequest->post('username') . PH7_DS . $this->httpRequest->post('album_id') . PH7_DS;281 $this->file->deleteDir($sDir);282 $this->clearVideoCache();283 $this->sMsg = t('The video album has been deleted!');284 } else {285 $this->sMsg = t('Oops! The video album could not be deleted');286 }287 Header::redirect(Uri::get(PH7_ADMIN_MOD, 'moderator', 'videoalbum'), $this->sMsg);288 }289 public function deleteVideo()290 {291 $bVideo = (new VideoCoreModel)->deleteVideo($this->httpRequest->post('id'), $this->httpRequest->post('album_id'), $this->httpRequest->post('video_id'));292 if ($bVideo) {293 (new VideoCore)->deleteVideo($this->httpRequest->post('album_id'), $this->httpRequest->post('username'), $this->httpRequest->post('video_link'));294 $this->clearVideoCache();295 $this->sMsg = t('The video has been deleted!');296 } else {297 $this->sMsg = t('Oops! The video could not be deleted!');298 }299 Header::redirect(Uri::get(PH7_ADMIN_MOD, 'moderator', 'video'), $this->sMsg);300 }301 public function deleteAvatar()302 {303 (new Admin)->deleteAvatar($this->httpRequest->post('id'), $this->httpRequest->post('username'));304 $this->clearAvatarCache();305 Header::redirect(Uri::get(PH7_ADMIN_MOD, 'moderator', 'avatar'), $this->sMsg);306 }307 public function deleteBackground()308 {309 (new Admin)->deleteBackground($this->httpRequest->post('id'), $this->httpRequest->post('username'));310 $this->clearUserBgCache();311 Header::redirect(Uri::get(PH7_ADMIN_MOD, 'moderator', 'background'), $this->sMsg);312 }313 /**314 * Clear PictureCoreModel Cache315 *316 * @return void317 */318 private function clearPictureCache()319 {320 (new Cache)->start(PictureCoreModel::CACHE_GROUP, null, null)->clear();321 }322 /**323 * Clear VideoCoreModel Cache324 *325 * @return void326 */327 private function clearVideoCache()328 {329 (new Cache)->start(VideoCoreModel::CACHE_GROUP, null, null)->clear();330 }331 /**332 * Clear "Design Avatar" & "UserCoreModel Avatar" Cache333 *334 * @return void335 */336 private function clearAvatarCache()337 {338 (new Cache)339 ->start(Design::CACHE_AVATAR_GROUP . $this->httpRequest->post('username'), null, null)->clear()340 ->start(UserCoreModel::CACHE_GROUP, 'avatar' . $this->httpRequest->post('id'), null)->clear();341 }342 /**343 * Clear UserCoreModel Background Cache344 *345 * @return void346 */347 private function clearUserBgCache()348 {349 (new Cache)->start(UserCoreModel::CACHE_GROUP, 'background' . $this->httpRequest->post('id'), null)->clear();350 }351}...

Full Screen

Full Screen

HttpTestCase.php

Source:HttpTestCase.php Github

copy

Full Screen

...64 * Clear GET values65 *66 * @return Zend_Controller_Request_HttpTestCase67 */68 public function clearQuery()69 {70 $_GET = array();71 return $this;72 }73 /**74 * Clear POST values75 *76 * @return Zend_Controller_Request_HttpTestCase77 */78 public function clearPost()79 {80 $_POST = array();81 return $this;82 }83 /**84 * Set raw POST body85 *86 * @param string $content87 * @return Zend_Controller_Request_HttpTestCase88 */89 public function setRawBody($content)90 {91 $this->_rawBody = (string) $content;92 return $this;93 }94 /**95 * Get RAW POST body96 *97 * @return string|null98 */99 public function getRawBody()100 {101 return $this->_rawBody;102 }103 /**104 * Clear raw POST body105 *106 * @return Zend_Controller_Request_HttpTestCase107 */108 public function clearRawBody()109 {110 $this->_rawBody = null;111 return $this;112 }113 /**114 * Set a cookie115 *116 * @param string $key117 * @param mixed $value118 * @return Zend_Controller_Request_HttpTestCase119 */120 public function setCookie($key, $value)121 {122 $_COOKIE[(string) $key] = $value;123 return $this;124 }125 /**126 * Set multiple cookies at once127 *128 * @param array $cookies129 * @return void130 */131 public function setCookies(array $cookies)132 {133 foreach ($cookies as $key => $value) {134 $_COOKIE[$key] = $value;135 }136 return $this;137 }138 /**139 * Clear all cookies140 *141 * @return Zend_Controller_Request_HttpTestCase142 */143 public function clearCookies()144 {145 $_COOKIE = array();146 return $this;147 }148 /**149 * Set request method150 *151 * @param string $type152 * @return Zend_Controller_Request_HttpTestCase153 */154 public function setMethod($type)155 {156 $type = strtoupper(trim((string) $type));157 if (!in_array($type, $this->_validMethodTypes)) {158 #require_once 'Zend/Controller/Exception.php';159 throw new Zend_Controller_Exception('Invalid request method specified');160 }161 $this->_method = $type;162 return $this;163 }164 /**165 * Get request method166 *167 * @return string|null168 */169 public function getMethod()170 {171 return $this->_method;172 }173 /**174 * Set a request header175 *176 * @param string $key177 * @param string $value178 * @return Zend_Controller_Request_HttpTestCase179 */180 public function setHeader($key, $value)181 {182 $key = $this->_normalizeHeaderName($key);183 $this->_headers[$key] = (string) $value;184 return $this;185 }186 /**187 * Set request headers188 *189 * @param array $headers190 * @return Zend_Controller_Request_HttpTestCase191 */192 public function setHeaders(array $headers)193 {194 foreach ($headers as $key => $value) {195 $this->setHeader($key, $value);196 }197 return $this;198 }199 /**200 * Get request header201 *202 * @param string $header203 * @param mixed $default204 * @return string|null205 */206 public function getHeader($header, $default = null)207 {208 $header = $this->_normalizeHeaderName($header);209 if (array_key_exists($header, $this->_headers)) {210 return $this->_headers[$header];211 }212 return $default;213 }214 /**215 * Get all request headers216 *217 * @return array218 */219 public function getHeaders()220 {221 return $this->_headers;222 }223 /**224 * Clear request headers225 *226 * @return Zend_Controller_Request_HttpTestCase227 */228 public function clearHeaders()229 {230 $this->_headers = array();231 return $this;232 }233 /**234 * Get REQUEST_URI235 *236 * @return null|string237 */238 public function getRequestUri()239 {240 return $this->_requestUri;241 }242 /**...

Full Screen

Full Screen

Handler.php

Source:Handler.php Github

copy

Full Screen

...69 private function __get_error_bar_html()70 {71 return "72<style>73 #mw-error-clear-cache-form-holder{74 width:100%;75 }76 #mw-error-clear-cache-forms{77 margin:10px;78 }79 #mw-error-clear-cache-forms form{80 display: inline-block;81 }82 #mw-error-clear-cache-iframe{83 border: none;84 height: 30px;85 width: 100%;86 background: transparent;87 }88</style>89<div id='mw-error-clear-cache-form-holder'>90<div id='mw-error-clear-cache-forms'>91 <h1>You can perform some tasks:92 <form action='" . api_url('mw_post_update') . "' target='mw-error-clear-cache-iframe'>93<button type='submit'>Reload database</button></form>94<form action='" . api_url('clearcache') . "' target='mw-error-clear-cache-iframe'>95 <button type='submit'>Clear cache</button></form>96 <form method='get' >97 <button type='submit'>Refresh</button></form>98 </h1>99</div>100<iframe name='mw-error-clear-cache-iframe' id='mw-error-clear-cache-iframe'></iframe>101</div>102";103 }104// onsubmit='alert(\"Done\")'105}...

Full Screen

Full Screen

context.go

Source:context.go Github

copy

Full Screen

...83// This is usually called by a handler wrapper to clean up request84// variables at the end of a request lifetime. See ClearHandler().85func Clear(r *http.Request) {86 mutex.Lock()87 clear(r)88 mutex.Unlock()89}90// clear is Clear without the lock.91func clear(r *http.Request) {92 delete(data, r)93 delete(datat, r)94}95// Purge removes request data stored for longer than maxAge, in seconds.96// It returns the amount of requests removed.97//98// If maxAge <= 0, all request data is removed.99//100// This is only used for sanity check: in case context cleaning was not101// properly set some request data can be kept forever, consuming an increasing102// amount of memory. In case this is detected, Purge() must be called103// periodically until the problem is fixed.104func Purge(maxAge int) int {105 mutex.Lock()106 count := 0107 if maxAge <= 0 {108 count = len(data)109 data = make(map[*http.Request]map[interface{}]interface{})110 datat = make(map[*http.Request]int64)111 } else {112 min := time.Now().Unix() - int64(maxAge)113 for r := range data {114 if datat[r] < min {115 clear(r)116 count++117 }118 }119 }120 mutex.Unlock()121 return count122}123// ClearHandler wraps an http.Handler and clears request values at the end124// of a request lifetime.125func ClearHandler(h http.Handler) http.Handler {126 return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {127 defer Clear(r)128 h.ServeHTTP(w, r)129 })130}...

Full Screen

Full Screen

clear

Using AI Code Generation

copy

Full Screen

1$ch = curl_init();2curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);3curl_setopt($ch, CURLOPT_HEADER, 1);4curl_setopt($ch, CURLOPT_HTTPHEADER, array('Connection: close'));5curl_setopt($ch, CURLOPT_TIMEOUT, 1);6curl_setopt($ch, CURLOPT_POST, 1);7curl_setopt($ch, CURLOPT_POSTFIELDS, "clear");8curl_exec($ch);9curl_close($ch);10$ch = curl_init();11curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);12curl_setopt($ch, CURLOPT_HEADER, 1);13curl_setopt($ch, CURLOPT_HTTPHEADER, array('Connection: close'));14curl_setopt($ch, CURLOPT_TIMEOUT, 1);15curl_setopt($ch, CURLOPT_POST, 1);16curl_setopt($ch, CURLOPT_POSTFIELDS, "set=1");17curl_exec($ch);18curl_close($ch);19$ch = curl_init();20curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);21curl_setopt($ch, CURLOPT_HEADER, 1);22curl_setopt($ch, CURLOPT_HTTPHEADER, array('Connection: close'));23curl_setopt($ch, CURLOPT_TIMEOUT, 1);24curl_setopt($ch, CURLOPT_POST, 1);25curl_setopt($ch, CURLOPT_POSTFIELDS, "get");26curl_exec($ch);27curl_close($ch);28$ch = curl_init();29curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);30curl_setopt($ch, CURLOPT_HEADER, 1);31curl_setopt($ch, CURLOPT_HTTPHEADER, array('Connection: close'));32curl_setopt($ch, CURLOPT_TIMEOUT, 1);33curl_setopt($ch, CURLOPT_POST, 1);34curl_setopt($ch, CURLOPT_POSTFIELDS, "increment");35curl_exec($ch);36curl_close($ch);37$ch = curl_init();

Full Screen

Full Screen

clear

Using AI Code Generation

copy

Full Screen

1require_once 'HTTP.php';2$http = new HTTP();3$http->clear();4require_once 'HTTP.php';5$http = new HTTP();6$http->clear();7require_once 'HTTP.php';8$http = new HTTP();9$http->clear();10require_once 'HTTP.php';11$http = new HTTP();12$http->clear();13require_once 'HTTP.php';14$http = new HTTP();15$http->clear();16require_once 'HTTP.php';17$http = new HTTP();18$http->clear();19require_once 'HTTP.php';20$http = new HTTP();21$http->clear();22require_once 'HTTP.php';23$http = new HTTP();24$http->clear();25require_once 'HTTP.php';26$http = new HTTP();27$http->clear();28require_once 'HTTP.php';29$http = new HTTP();30$http->clear();31require_once 'HTTP.php';32$http = new HTTP();

Full Screen

Full Screen

clear

Using AI Code Generation

copy

Full Screen

1$curl = new http_class;2$curl->clear();3$curl->set('method', 'GET');4$curl->getcookies();5$curl->getheaders();6$curl->getbody();7$curl->getstatus();8$curl->getredirect();9$curl->getredirectaddress();10$curl = new http_class;11$curl->clear();12$curl->set('method', 'GET');13$curl->getcookies();14$curl->getheaders();15$curl->getbody();16$curl->getstatus();17$curl->getredirect();18$curl->getredirectaddress();19$curl = new http_class;20$curl->clear();

Full Screen

Full Screen

clear

Using AI Code Generation

copy

Full Screen

1include("http.php");2$ob = new http();3$ob->clear();4$ob->set("name","Rajesh");5$ob->set("age","23");6$ob->set("address","Saharanpur");7$ob->set("mobile","9999999999");8$ob->set("email","

Full Screen

Full Screen

clear

Using AI Code Generation

copy

Full Screen

1$cookie_path = '/tmp/';2$cookie_file = $cookie_path . 'cookie.txt';3$cookie_file = realpath($cookie_file);4$cookie_file = str_replace("\\", "/", $cookie_file);5$cookie_file = "C:/xampp/tmp/cookie.txt";6$cookie_file = realpath($cookie_file);7$cookie_file = str_replace("\\", "/", $cookie_file);8$ch = curl_init();9curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file);10curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);11curl_setopt($ch, CURLOPT_HEADER, 1);12$output = curl_exec($ch);13curl_close($ch);14$ch = curl_init();15curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file);16curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);17curl_setopt($ch, CURLOPT_HEADER, 1);18$output = curl_exec($ch);19curl_close($ch);20echo $output;

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Atoum automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Trigger clear code on LambdaTest Cloud Grid

Execute automation tests with clear on a cloud-based Grid of 3000+ real browsers and operating systems for both web and mobile applications.

Test now for Free

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful