%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /dom495844/wp-content/plugins/wpmu-dev-seo/includes/integration/maxmind/
Upload File :
Create Path :
Current File : //dom495844/wp-content/plugins/wpmu-dev-seo/includes/integration/maxmind/class-controller.php

<?php
/**
 * Controls MaxMind functionality.
 *
 * @package SmartCrawl
 */

namespace SmartCrawl\Integration\Maxmind;

use SmartCrawl\Admin\Settings\Admin_Settings;
use SmartCrawl\Controllers;
use SmartCrawl\Logger;
use SmartCrawl\Settings;
use SmartCrawl\Singleton;

/**
 * MaxMind main controller.
 */
class Controller extends Controllers\Controller {

	use Singleton;

	/**
	 * Should this module run?
	 *
	 * @return bool
	 */
	public function should_run() {
		return true;
	}

	/**
	 * Initialization method.
	 *
	 * @return void
	 */
	protected function init() {
		add_action( 'wp_ajax_smartcrawl_download_geodb', array( $this, 'download_geodb' ) );
		add_action( 'wp_ajax_smartcrawl_reset_geodb', array( $this, 'reset_geodb' ) );
	}

	/**
	 * Includes methods when the controller stops running.
	 *
	 * @return void
	 */
	protected function terminate() {
		parent::terminate();

		remove_action( 'wp_ajax_smartcrawl_download_geodb', array( $this, 'download_geodb' ) );
		remove_action( 'wp_ajax_smartcrawl_reset_geodb', array( $this, 'reset_geodb' ) );
	}

	/**
	 * Ajax handler to download GEODB from Maxmind.
	 */
	public function download_geodb() {
		$data = $this->get_request_data();

		if ( empty( $data ) ) {
			wp_send_json_error( array( 'message' => __( 'Invalid POST request.', 'wds' ) ) );
		}

		$license_key = \smartcrawl_get_array_value( $data, 'license_key' );

		if ( ! $license_key ) {
			wp_send_json_error( array( 'message' => __( 'License key is required.', 'wds' ) ) );
		}

		$symb_key = GeoDB::get()->activate_license( $license_key );

		if ( is_wp_error( $symb_key ) ) {
			Logger::error( 'Error from MaxMind: ' . $symb_key->get_error_message() );

			wp_send_json_error(
				array(
					'message' => $symb_key->get_error_message(),
				)
			);
		}

		wp_send_json_success( array( 'key' => $symb_key ) );
	}

	/**
	 * Ajax handler to reset GEODB and license key settings for Maxmind.
	 */
	public function reset_geodb() {
		$data = $this->get_request_data();

		if ( empty( $data ) ) {
			wp_send_json_error( array( 'message' => __( 'Invalid POST request.', 'wds' ) ) );
		}

		GeoDB::get()->delete_license();
		GeoDB::get()->delete_db();

		wp_send_json_success();
	}

	/**
	 * Retrieves HTTP Request data.
	 *
	 * @return array|mixed
	 */
	private function get_request_data() {
		return isset( $_POST['_wds_nonce'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['_wds_nonce'] ) ), 'wds-admin-nonce' ) ? stripslashes_deep( $_POST ) : array();
	}
}

Zerion Mini Shell 1.0
Page not found - Broad Street Financial
[et_pb_section fb_built=”1″ theme_builder_area=”post_content” _builder_version=”4.20.0″ _module_preset=”default”][et_pb_row _builder_version=”4.20.0″ _module_preset=”default” theme_builder_area=”post_content”][et_pb_column _builder_version=”4.20.0″ _module_preset=”default” type=”4_4″ theme_builder_area=”post_content”][et_pb_text _builder_version=”4.20.0″ _module_preset=”default” theme_builder_area=”post_content” hover_enabled=”0″ sticky_enabled=”0″]

Page Not Found

Sorry the requested page you are looking for is missing or has been moved.

Please check out our site and see if you can find what you are looking for.

[/et_pb_text][/et_pb_column][/et_pb_row][/et_pb_section]