Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function infinite(){
- $postygdiambil="";
- $hal = $this->input->get('hal');
- $recent = $this->input->get('recent');
- /*load cache*/
- $url_c='https://admin.travelingyuk.com/wp-json/wp/v2/posts?filter[orderby]=date&order=desc&per_page=50&status=publish';
- if( $result_c = $this->is_cache($url_c)){
- $result_c = $this->cache('GET',$url_c);
- }else{
- $result_c = file_get_contents($url_c);
- $result_c = $this->cache('SET',$url_c,$result_c,3600);
- }
- $datax=json_decode($result_c,TRUE);
- if ($hal && $recent){
- if(array_key_exists('excludeinfinit', $_COOKIE)) {
- $excludeinfinits=explode(',', rtrim($_COOKIE['excludeinfinit'],","));
- array_push($excludeinfinits, $recent);
- /*cache*/
- $url='https://native.travelingyuk.com/infinit';
- if( $result = $this->is_cache($url)){
- $result = $this->cache('GET',$url);
- }else{
- $result = file_get_contents($url);
- $result = $this->cache('SET',$url,$result,3600);
- }
- $natives=json_decode($result,true);
- foreach ($excludeinfinits as $excludeinfinit) {
- if(($key=array_search($excludeinfinit,$natives))!==false){
- unset($natives[$key]);
- }
- }
- if(count($natives)>0){
- $natives=array_values($natives);
- setcookie('excludeinfinit', $_COOKIE['excludeinfinit'].$natives[0].',', time() + (60*60*24*30), '/');
- $id=$natives[0];
- /*cache*/
- $url_link='https://native.travelingyuk.com/infinit/get?id='.$id;
- if( $result_link = $this->is_cache($url_link)){
- $result_link = $this->cache('GET',$url_link);
- }else{
- $result_link = file_get_contents($url_link);
- $result_link = $this->cache('SET',$url_link,$result_link,3600);
- }
- $link = $result_link;
- $postygdiambil = base_url().substr($link,1);
- } else { //native sdh tmpil smua
- $exclude='';
- foreach ($natives as $native) {
- $exclude=$exclude.$native.',';
- }
- foreach ($excludeinfinits as $excludeinfinit) {
- $exclude=$exclude.$excludeinfinit.',';
- }
- $exclude=$exclude.$recent;
- /*cache*/
- $like=explode(',', rtrim($exclude,","));
- $datas = array_filter($datax, function ($datax) use ($like) {
- foreach ($like as $key => $r) {
- if (stripos($datax['id'], $r) !== false) {
- return false;
- }
- }
- return true;
- });
- //print_r($datas);
- setcookie('excludeinfinit', $_COOKIE['excludeinfinit'].$datas[$hal]['id'].',', time() + (60*60*24*30), '/');
- $postygdiambil=$datas[$hal]['link'];
- }
- } else {
- /*cache*/
- $url='https://native.travelingyuk.com/index.php/infinit';
- if( $result = $this->is_cache($url)){
- $result = $this->cache('GET',$url);
- }else{
- $result = file_get_contents($url);
- $result = $this->cache('SET',$url,$result,3600);
- }
- $natives=json_decode($result,true);
- if(count($natives)>0){
- //hilangkn recent post
- if(($key=array_search($recent,$natives))!==false){
- unset($natives[$key]);
- }
- setcookie('excludeinfinit', $natives[0].',', time() + (60*60*24*30), '/');
- $id=$natives[0];
- /*cache*/
- $url_link='https://native.travelingyuk.com/infinit/get?id='.$id;
- if( $result_link = $this->is_cache($url_link)){
- $result_link = $this->cache('GET',$url_link);
- }else{
- $result_link = file_get_contents($url_link);
- $result_link = $this->cache('SET',$url_link,$result_link,3600);
- }
- $link = $result_link;
- $postygdiambil = base_url().substr($link,1);
- } else {
- $exclude=(!empty($exclude) ? $exclude : 0);
- /*cache*/
- $like=explode(',', rtrim($exclude,","));
- $datas = array_filter($datax, function ($datax) use ($like) {
- foreach ($like as $key => $r) {
- if (stripos($datax['id'], $r) !== false) {
- return false;
- }
- }
- return true;
- });
- setcookie('excludeinfinit', $_COOKIE['excludeinfinit'].$datas[$hal]['id'].',', time() + (60*60*24*30), '/');
- $postygdiambil=$datas[$hal]['link'];
- }
- }
- if(is_null($postygdiambil)){
- /*cache*/
- $like=explode(',', rtrim($exclude,","));
- $datas = array_filter($datax, function ($datax) use ($like) {
- foreach ($like as $key => $r) {
- if (stripos($datax['id'], $r) !== false) {
- return false;
- }
- }
- return true;
- });
- setcookie('excludeinfinit', $_COOKIE['excludeinfinit'].$datas[$hal]['id'].',', time() + (60*60*24*30), '/');
- $postygdiambil=$datas[$hal]['link'];
- }
- $gasend=$postygdiambil."?iklan=1";//$datas[0]['link'];
- $gasend=str_replace('admin.', '', $gasend);
- $result=$this->travelingyuk->infinite($gasend,$this->device);
- echo $result['data'];
- //print_r($result['data']);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement