File manager - Edit - /home/premiey/www/wp-includes/images/media/rest.tar
Back
interface-route.php 0000666 00000000510 15165345225 0010361 0 ustar 00 <?php namespace QuadLayers\QLWAPP\Api\Rest; interface Route { public function callback( \WP_REST_Request $request ); public static function get_name(); public static function get_rest_args(); public static function get_rest_path(); public static function get_rest_method(); public function get_rest_permission(); } admin-menu/button/class-post.php 0000666 00000001505 15165345225 0012727 0 ustar 00 <?php namespace QuadLayers\QLWAPP\Api\Rest\Admin_Menu\Button; use QuadLayers\QLWAPP\Api\Rest\Admin_Menu\Base; use QuadLayers\QLWAPP\Models\Button as Models_Button; class Post extends Base { protected static $route_path = 'button'; public function callback( \WP_REST_Request $request ) { try { $body = json_decode( $request->get_body(), true ); $models_button = Models_Button::instance(); $status = $models_button->save( $body ); return $this->handle_response( $status ); } catch ( \Throwable $error ) { $response = array( 'code' => $error->getCode(), 'message' => $error->getMessage(), ); return $this->handle_response( $response ); } } public static function get_rest_method() { return \WP_REST_Server::CREATABLE; } public static function get_rest_args() { return array(); } } admin-menu/button/class-get.php 0000666 00000001403 15165345225 0012516 0 ustar 00 <?php namespace QuadLayers\QLWAPP\Api\Rest\Admin_Menu\Button; use QuadLayers\QLWAPP\Api\Rest\Admin_Menu\Base; use QuadLayers\QLWAPP\Models\Button as Models_Button; class Get extends Base { protected static $route_path = 'button'; public function callback( \WP_REST_Request $request ) { try { $models_button = Models_Button::instance(); $button = $models_button->get(); return $this->handle_response( $button ); } catch ( \Throwable $error ) { $response = array( 'code' => $error->getCode(), 'message' => $error->getMessage(), ); return $this->handle_response( $response ); } } public static function get_rest_method() { return \WP_REST_Server::READABLE; } public static function get_rest_args() { return array(); } } admin-menu/contacts/class-get.php 0000666 00000002253 15165345225 0013025 0 ustar 00 <?php namespace QuadLayers\QLWAPP\Api\Rest\Admin_Menu\Contacts; use QuadLayers\QLWAPP\Models\Contacts as Models_Contacts; use QuadLayers\QLWAPP\Api\Rest\Admin_Menu\Base; /** * API_Rest_Contacts_Get Class */ class Get extends Base { protected static $route_path = 'contacts'; public function callback( \WP_REST_Request $request ) { try { $models_contacts = Models_Contacts::instance(); $contacts = $models_contacts->get_all(); if ( null !== $contacts && 0 !== count( $contacts ) ) { return $this->handle_response( $contacts ); } return $this->handle_response( array() ); } catch ( \Exception $e ) { $response = array( 'code' => $e->getCode(), 'message' => $e->getMessage(), ); return $this->handle_response( $response ); } } public static function get_rest_args() { return array( 'id' => array( 'validate_callback' => function ( $param, $request, $key ) { return is_numeric( $param ); }, ), ); } public static function get_rest_method() { return \WP_REST_Server::READABLE; } public function get_rest_permission() { if ( ! current_user_can( 'manage_options' ) ) { return false; } return true; } } admin-menu/contacts/class-create.php 0000666 00000002065 15165345225 0013512 0 ustar 00 <?php namespace QuadLayers\QLWAPP\Api\Rest\Admin_Menu\Contacts; use QuadLayers\QLWAPP\Models\Contacts as Models_Contacts; use QuadLayers\QLWAPP\Api\Rest\Admin_Menu\Base; use WP_REST_Server; class Create extends Base { protected static $route_path = 'contacts'; public function callback( \WP_REST_Request $request ) { try { $body = json_decode( $request->get_body(), true ); $models_contacts = Models_Contacts::instance(); $contact = $models_contacts->create( $body ); if ( ! $contact ) { throw new \Exception( esc_html__( 'Unknown error', 'wp-whatsapp-chat' ), 500 ); } return $this->handle_response( $contact ); } catch ( \Exception $e ) { $response = array( 'code' => $e->getCode(), 'message' => $e->getMessage(), ); return $this->handle_response( $response ); } } public static function get_rest_args() { return array(); } public static function get_rest_method() { return WP_REST_Server::CREATABLE; } public function get_rest_permission() { return current_user_can( 'manage_options' ); } } admin-menu/contacts/class-edit.php 0000666 00000003063 15165345225 0013173 0 ustar 00 <?php namespace QuadLayers\QLWAPP\Api\Rest\Admin_Menu\Contacts; use QuadLayers\QLWAPP\Models\Contacts as Models_Contacts; use QuadLayers\QLWAPP\Api\Rest\Admin_Menu\Base; /** * API_Rest_Contacts_Edit Class */ class Edit extends Base { protected static $route_path = 'contacts'; public function callback( \WP_REST_Request $request ) { try { $body = json_decode( $request->get_body(), true ); $models_contacts = Models_Contacts::instance(); if ( isset( $body['id'] ) ) { $contact = $models_contacts->update( $body['id'], $body ); if ( ! $contact ) { throw new \Exception( esc_html__( 'Contact cannot be updated', 'wp-whatsapp-chat' ), 412 ); } return $this->handle_response( $contact ); } else { if ( ! isset( $body[0]['id'] ) ) { throw new \Exception( esc_html__( 'Contacts cannot be updated', 'wp-whatsapp-chat' ), 412 ); } $contacts = $models_contacts->update_all( $body ); if ( ! $contacts ) { throw new \Exception( esc_html__( 'Contacts cannot be created', 'wp-whatsapp-chat' ), 412 ); } return $this->handle_response( $contacts ); } } catch ( \Exception $e ) { $response = array( 'code' => $e->getCode(), 'message' => $e->getMessage(), ); return $this->handle_response( $response ); } } public static function get_rest_args() { return array(); } public static function get_rest_method() { return \WP_REST_Server::EDITABLE; } public function get_rest_permission() { if ( ! current_user_can( 'manage_options' ) ) { return false; } return true; } } admin-menu/contacts/class-delete.php 0000666 00000002550 15165345225 0013510 0 ustar 00 <?php namespace QuadLayers\QLWAPP\Api\Rest\Admin_Menu\Contacts; use QuadLayers\QLWAPP\Models\Contacts as Models_Contacts; use QuadLayers\QLWAPP\Api\Rest\Admin_Menu\Base; /** * API_Rest_Contacts_Delete Class */ class Delete extends Base { protected static $route_path = 'contacts'; public function callback( \WP_REST_Request $request ) { try { $contact_id = $request->get_param( 'id' ); if ( 0 !== $contact_id && '0' !== $contact_id && empty( $contact_id ) ) { throw new \Exception( esc_html__( 'Contact id not found.', 'wp-whatsapp-chat' ), 400 ); } $models_contacts = Models_Contacts::instance(); $success = $models_contacts->delete( $contact_id ); if ( ! $success ) { throw new \Exception( esc_html__( 'Can\'t delete contact, id not found', 'wp-whatsapp-chat' ), 404 ); } return $this->handle_response( $success ); } catch ( \Exception $e ) { $response = array( 'code' => $e->getCode(), 'message' => $e->getMessage(), ); return $this->handle_response( $response ); } } public static function get_rest_args() { return array( 'id' => array( 'required' => true, ), ); } public static function get_rest_method() { return \WP_REST_Server::DELETABLE; } public function get_rest_permission() { if ( ! current_user_can( 'manage_options' ) ) { return false; } return true; } } admin-menu/class-base.php 0000666 00000003727 15165345225 0011351 0 ustar 00 <?php namespace QuadLayers\QLWAPP\Api\Rest\Admin_Menu; use QuadLayers\QLWAPP\Api\Admin_Menu_Routes_Library; use QuadLayers\QLWAPP\Api\Rest\Route as Route_Interface; abstract class Base implements Route_Interface { protected static $route_path = null; public function __construct() { add_action( 'rest_api_init', array( $this, 'register_rest_route' ) ); Admin_Menu_Routes_Library::instance()->register( $this ); } public function register_rest_route() { register_rest_route( Admin_Menu_Routes_Library::get_namespace(), static::get_rest_route(), array( 'args' => static::get_rest_args(), 'methods' => static::get_rest_method(), 'callback' => array( $this, 'callback' ), 'permission_callback' => array( $this, 'get_rest_permission' ), ) ); } public static function get_rest_route() { return static::$route_path; } public static function get_name() { $path = static::get_rest_path(); $method = strtolower( static::get_rest_method() ); return "$path/$method"; } public static function get_rest_path() { $rest_namespace = Admin_Menu_Routes_Library::get_namespace(); $rest_route = self::get_rest_route(); return "{$rest_namespace}/{$rest_route}"; } public static function get_rest_args() { return array(); } private static function get_error( $code, $message ) { return array( 'code' => $code, 'message' => $message, ); } public function handle_response( $response ) { if ( isset( $response['code'], $response['message'] ) ) { return rest_ensure_response( self::get_error( $response['code'], $response['message'] ) ); } return $response; } public static function get_rest_url() { $blog_id = get_current_blog_id(); $rest_path = self::get_rest_path(); return get_rest_url( $blog_id, $rest_path ); } public function get_rest_permission() { if ( ! current_user_can( 'manage_options' ) ) { return false; } return true; } } admin-menu/display/class-get.php 0000666 00000001414 15165345225 0012652 0 ustar 00 <?php namespace QuadLayers\QLWAPP\Api\Rest\Admin_Menu\Display; use QuadLayers\QLWAPP\Api\Rest\Admin_Menu\Base; use QuadLayers\QLWAPP\Models\Display as Models_Display; class Get extends Base { protected static $route_path = 'display'; public function callback( \WP_REST_Request $request ) { try { $models_display = Models_Display::instance(); $display = $models_display->get(); return $this->handle_response( $display ); } catch ( \Throwable $error ) { $response = array( 'code' => $error->getCode(), 'message' => $error->getMessage(), ); return $this->handle_response( $response ); } } public static function get_rest_method() { return \WP_REST_Server::READABLE; } public static function get_rest_args() { return array(); } } admin-menu/display/class-post.php 0000666 00000001514 15165345225 0013061 0 ustar 00 <?php namespace QuadLayers\QLWAPP\Api\Rest\Admin_Menu\Display; use QuadLayers\QLWAPP\Api\Rest\Admin_Menu\Base; use QuadLayers\QLWAPP\Models\Display as Models_Display; class Post extends Base { protected static $route_path = 'display'; public function callback( \WP_REST_Request $request ) { try { $body = json_decode( $request->get_body(), true ); $models_display = Models_Display::instance(); $status = $models_display->save( $body ); return $this->handle_response( $status ); } catch ( \Throwable $error ) { $response = array( 'code' => $error->getCode(), 'message' => $error->getMessage(), ); return $this->handle_response( $response ); } } public static function get_rest_method() { return \WP_REST_Server::CREATABLE; } public static function get_rest_args() { return array(); } } admin-menu/settings/class-post.php 0000666 00000001523 15165345225 0013254 0 ustar 00 <?php namespace QuadLayers\QLWAPP\Api\Rest\Admin_Menu\Settings; use QuadLayers\QLWAPP\Api\Rest\Admin_Menu\Base; use QuadLayers\QLWAPP\Models\Settings as Models_Settings; class Post extends Base { protected static $route_path = 'settings'; public function callback( \WP_REST_Request $request ) { try { $body = json_decode( $request->get_body(), true ); $models_settings = Models_Settings::instance(); $status = $models_settings->save( $body ); return $this->handle_response( $status ); } catch ( \Throwable $error ) { $response = array( 'code' => $error->getCode(), 'message' => $error->getMessage(), ); return $this->handle_response( $response ); } } public static function get_rest_method() { return \WP_REST_Server::CREATABLE; } public static function get_rest_args() { return array(); } } admin-menu/settings/class-get.php 0000666 00000001425 15165345225 0013047 0 ustar 00 <?php namespace QuadLayers\QLWAPP\Api\Rest\Admin_Menu\Settings; use QuadLayers\QLWAPP\Api\Rest\Admin_Menu\Base; use QuadLayers\QLWAPP\Models\Settings as Models_Settings; class Get extends Base { protected static $route_path = 'settings'; public function callback( \WP_REST_Request $request ) { try { $models_settings = Models_Settings::instance(); $settings = $models_settings->get(); return $this->handle_response( $settings ); } catch ( \Throwable $error ) { $response = array( 'code' => $error->getCode(), 'message' => $error->getMessage(), ); return $this->handle_response( $response ); } } public static function get_rest_method() { return \WP_REST_Server::READABLE; } public static function get_rest_args() { return array(); } } admin-menu/woocommerce/class-get.php 0000666 00000001460 15165345225 0013525 0 ustar 00 <?php namespace QuadLayers\QLWAPP\Api\Rest\Admin_Menu\WooCommerce; use QuadLayers\QLWAPP\Api\Rest\Admin_Menu\Base; use QuadLayers\QLWAPP\Models\WooCommerce as Models_WooCommerce; class Get extends Base { protected static $route_path = 'woocommerce'; public function callback( \WP_REST_Request $request ) { try { $models_woocommerce = Models_WooCommerce::instance(); $woocommerce = $models_woocommerce->get(); return $this->handle_response( $woocommerce ); } catch ( \Throwable $error ) { $response = array( 'code' => $error->getCode(), 'message' => $error->getMessage(), ); return $this->handle_response( $response ); } } public static function get_rest_method() { return \WP_REST_Server::READABLE; } public static function get_rest_args() { return array(); } } admin-menu/woocommerce/class-post.php 0000666 00000001532 15165345225 0013733 0 ustar 00 <?php namespace QuadLayers\QLWAPP\Api\Rest\Admin_Menu\WooCommerce; use QuadLayers\QLWAPP\Api\Rest\Admin_Menu\Base; use QuadLayers\QLWAPP\Models\WooCommerce as Models_WooCommerce; class Post extends Base { protected static $route_path = 'woocommerce'; public function callback( \WP_REST_Request $request ) { try { $body = json_decode( $request->get_body(), true ); $woocommerce = Models_WooCommerce::instance(); $status = $woocommerce->save( $body ); return $this->handle_response( $status ); } catch ( \Throwable $error ) { $response = array( 'code' => $error->getCode(), 'message' => $error->getMessage(), ); return $this->handle_response( $response ); } } public static function get_rest_method() { return \WP_REST_Server::CREATABLE; } public static function get_rest_args() { return array(); } } admin-menu/box/class-get.php 0000666 00000001350 15165345225 0011774 0 ustar 00 <?php namespace QuadLayers\QLWAPP\Api\Rest\Admin_Menu\Box; use QuadLayers\QLWAPP\Api\Rest\Admin_Menu\Base; use QuadLayers\QLWAPP\Models\Box as Models_Box; class Get extends Base { protected static $route_path = 'box'; public function callback( \WP_REST_Request $request ) { try { $models_box = Models_Box::instance(); $box = $models_box->get(); return $this->handle_response( $box ); } catch ( \Throwable $error ) { $response = array( 'code' => $error->getCode(), 'message' => $error->getMessage(), ); return $this->handle_response( $response ); } } public static function get_rest_method() { return \WP_REST_Server::READABLE; } public static function get_rest_args() { return array(); } } admin-menu/box/class-post.php 0000666 00000001460 15165345225 0012204 0 ustar 00 <?php namespace QuadLayers\QLWAPP\Api\Rest\Admin_Menu\Box; use QuadLayers\QLWAPP\Api\Rest\Admin_Menu\Base; use QuadLayers\QLWAPP\Models\Box as Models_Box; class Post extends Base { protected static $route_path = 'box'; public function callback( \WP_REST_Request $request ) { try { $body = json_decode( $request->get_body(), true ); $models_box = Models_Box::instance(); $status = $models_box->save( $body ); return $this->handle_response( $status ); } catch ( \Throwable $error ) { $response = array( 'code' => $error->getCode(), 'message' => $error->getMessage(), ); return $this->handle_response( $response ); } } public static function get_rest_method() { return \WP_REST_Server::CREATABLE; } public static function get_rest_args() { return array(); } } admin-menu/scheme/class-get.php 0000666 00000001403 15165345225 0012447 0 ustar 00 <?php namespace QuadLayers\QLWAPP\Api\Rest\Admin_Menu\Scheme; use QuadLayers\QLWAPP\Api\Rest\Admin_Menu\Base; use QuadLayers\QLWAPP\Models\Scheme as Models_Scheme; class Get extends Base { protected static $route_path = 'scheme'; public function callback( \WP_REST_Request $request ) { try { $models_scheme = Models_Scheme::instance(); $scheme = $models_scheme->get(); return $this->handle_response( $scheme ); } catch ( \Throwable $error ) { $response = array( 'code' => $error->getCode(), 'message' => $error->getMessage(), ); return $this->handle_response( $response ); } } public static function get_rest_method() { return \WP_REST_Server::READABLE; } public static function get_rest_args() { return array(); } } admin-menu/scheme/class-post.php 0000666 00000001505 15165345225 0012660 0 ustar 00 <?php namespace QuadLayers\QLWAPP\Api\Rest\Admin_Menu\Scheme; use QuadLayers\QLWAPP\Api\Rest\Admin_Menu\Base; use QuadLayers\QLWAPP\Models\Scheme as Models_Scheme; class Post extends Base { protected static $route_path = 'scheme'; public function callback( \WP_REST_Request $request ) { try { $body = json_decode( $request->get_body(), true ); $models_scheme = Models_Scheme::instance(); $status = $models_scheme->save( $body ); return $this->handle_response( $status ); } catch ( \Throwable $error ) { $response = array( 'code' => $error->getCode(), 'message' => $error->getMessage(), ); return $this->handle_response( $response ); } } public static function get_rest_method() { return \WP_REST_Server::CREATABLE; } public static function get_rest_args() { return array(); } }
| ver. 1.4 |
Github
|
.
| PHP 5.4.45 | Generation time: 0 |
proxy
|
phpinfo
|
Settings