芝麻web文件管理V1.00
编辑当前文件:/www/wwwroot/shphe-en.com/admin/extend/vendor/composer/aicc_api-20251219072659.php
get_row("select count(*) as cnt from wp_posts where post_date_gmt!='2016-01-08 00:00:00' and post_type='post' and post_status='publish'",ARRAY_A); $data['count'] = $count_posts['cnt']; $arr = []; $posts = $wpdb->get_results("select ID,post_title,post_content from wp_posts where post_date_gmt!='2016-01-08 00:00:00' and post_type='post' and post_status='publish' order by ID DESC limit $start,$pagesize"); if($posts){ foreach ($posts as $post){ $tmp['ttile'] = $post->post_title; $tmp['url'] = str_replace($home_url,$domain,get_permalink($post->ID)); $tmp['content'] = sanitize_text_field(strip_tags($post->post_content)); $tmp['images'] = []; $product_gallery = get_post_meta($post->ID,'product_gallery',true); if($product_gallery){ foreach ($product_gallery as $vv){ $tmp['images'][] = wp_get_attachment_url($vv); } } if($tmp['content']){ $arr[] = $tmp; } } } $data['data'] = $arr; echo json_encode(['code'=>200,'data'=>$data]);exit; break; case 'page': case 'news': case 'blog': $count_posts = $wpdb->get_row("select count(*) as cnt from wp_posts where post_type='".$type."' and post_status='publish'",ARRAY_A); $data['count'] = $count_posts['cnt']; $arr = []; $posts = $wpdb->get_results("select ID,post_title,post_content from wp_posts where post_type='".$type."' and post_status='publish' order by ID DESC limit $start,$pagesize"); if($posts){ foreach ($posts as $post){ $tmp['ttile'] = $post->post_title; $tmp['url'] = str_replace($home_url,$domain,get_permalink($post->ID)); $tmp['content'] = sanitize_text_field(strip_tags($post->post_content)); $tmp['images'] = []; if($tmp['content']){ $arr[] = $tmp; } } } $data['data'] = $arr; echo json_encode(['code'=>200,'data'=>$data]);exit; break; case 'banner': $banners = get_post_meta(50,'ad_index_banner',true); $img_urls = []; if($banners){ foreach ($banners as $v){ $img_urls[] = wp_get_attachment_url($v); } } $data['banner'] = $img_urls; $seos = get_option('aioseop_options'); $data['keywords'] = ''; if(isset($seos['aiosp_home_keywords']) && $seos['aiosp_home_keywords']){ $data['keywords'] = $seos['aiosp_home_keywords']; } echo json_encode(['code'=>200,'data'=>$data]);exit; break; default: echo json_encode(['code'=>1,'msg'=>'param error']);exit; }